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
src/datahub/common/date_range.py
project-origin/datahub-service
1
66409
<reponame>project-origin/datahub-service from datetime import datetime from dateutil.relativedelta import relativedelta from .models import SummaryResolution class LabelRange(object): """ Generates an ordered list of labels each corresponding to a period of time (defined by its begin, end, and the "resolution" parameter). For example, provided the following inputs:: begin = datetime(2020, 1, 1, 0, 0, 0) end = datetime(2020, 1, 3, 0, 0, 0) resolution = SummaryResolution.day labels = list(LabelRange(begin, end, resolution)) Results in the following list:: ['2020-01-01', '2020-01-02', '2020-01-03'] """ RESOLUTIONS = { SummaryResolution.hour: '%Y-%m-%d %H:00', SummaryResolution.day: '%Y-%m-%d', SummaryResolution.month: '%Y-%m', SummaryResolution.year: '%Y', } LABEL_STEP = { SummaryResolution.hour: relativedelta(hours=1), SummaryResolution.day: relativedelta(days=1), SummaryResolution.month: relativedelta(months=1), SummaryResolution.year: relativedelta(years=1), SummaryResolution.all: None, } def __init__(self, begin, end, resolution): """ :param datetime begin: :param datetime end: :param SummaryResolution resolution: """ self.begin = begin self.end = end self.resolution = resolution def __iter__(self): return iter(self.get_label_range()) def get_label_range(self): format = self.RESOLUTIONS[self.resolution] step = self.LABEL_STEP[self.resolution] begin = self.begin labels = [] while begin < self.end: labels.append(begin.strftime(format)) begin += step return labels
[ 1, 529, 276, 1112, 420, 29958, 4836, 29899, 12574, 29914, 1272, 29882, 431, 29899, 5509, 13, 3166, 12865, 1053, 12865, 13, 3166, 2635, 4422, 29889, 2674, 1926, 287, 2554, 1053, 14215, 287, 2554, 13, 13, 3166, 869, 9794, 1053, 6991, 5219, 12375, 918, 13, 13, 13, 1990, 15796, 6069, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 3251, 1078, 385, 10372, 1051, 310, 11073, 1269, 6590, 304, 263, 3785, 13, 1678, 310, 931, 313, 12119, 491, 967, 3380, 29892, 1095, 29892, 322, 278, 376, 9778, 918, 29908, 3443, 467, 13, 13, 1678, 1152, 1342, 29892, 4944, 278, 1494, 10970, 1057, 13, 13, 4706, 3380, 353, 12865, 29898, 29906, 29900, 29906, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1095, 353, 12865, 29898, 29906, 29900, 29906, 29900, 29892, 29871, 29896, 29892, 29871, 29941, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 10104, 353, 6991, 5219, 12375, 918, 29889, 3250, 13, 4706, 11073, 353, 1051, 29898, 4775, 6069, 29898, 463, 29892, 1095, 29892, 10104, 876, 13, 13, 1678, 17212, 297, 278, 1494, 1051, 1057, 13, 13, 4706, 6024, 29906, 29900, 29906, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 742, 525, 29906, 29900, 29906, 29900, 29899, 29900, 29896, 29899, 29900, 29906, 742, 525, 29906, 29900, 29906, 29900, 29899, 29900, 29896, 29899, 29900, 29941, 2033, 13, 13, 1678, 9995, 13, 13, 1678, 390, 2890, 5607, 2692, 27946, 353, 426, 13, 4706, 6991, 5219, 12375, 918, 29889, 18721, 29901, 14210, 29979, 19222, 29885, 19222, 29881, 1273, 29950, 29901, 29900, 29900, 742, 13, 4706, 6991, 5219, 12375, 918, 29889, 3250, 29901, 14210, 29979, 19222, 29885, 19222, 29881, 742, 13, 4706, 6991, 5219, 12375, 918, 29889, 10874, 29901, 14210, 29979, 19222, 29885, 742, 13, 4706, 6991, 5219, 12375, 918, 29889, 6360, 29901, 14210, 29979, 742, 13, 1678, 500, 13, 13, 1678, 365, 2882, 6670, 29918, 1254, 15488, 353, 426, 13, 4706, 6991, 5219, 12375, 918, 29889, 18721, 29901, 14215, 287, 2554, 29898, 29882, 2470, 29922, 29896, 511, 13, 4706, 6991, 5219, 12375, 918, 29889, 3250, 29901, 14215, 287, 2554, 29898, 16700, 29922, 29896, 511, 13, 4706, 6991, 5219, 12375, 918, 29889, 10874, 29901, 14215, 287, 2554, 29898, 10874, 29879, 29922, 29896, 511, 13, 4706, 6991, 5219, 12375, 918, 29889, 6360, 29901, 14215, 287, 2554, 29898, 6360, 29879, 29922, 29896, 511, 13, 4706, 6991, 5219, 12375, 918, 29889, 497, 29901, 6213, 29892, 13, 1678, 500, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3380, 29892, 1095, 29892, 10104, 1125, 13, 4706, 9995, 13, 4706, 584, 3207, 12865, 3380, 29901, 13, 4706, 584, 3207, 12865, 1095, 29901, 13, 4706, 584, 3207, 6991, 5219, 12375, 918, 10104, 29901, 13, 4706, 9995, 13, 4706, 1583, 29889, 463, 353, 3380, 13, 4706, 1583, 29889, 355, 353, 1095, 13, 4706, 1583, 29889, 9778, 918, 353, 10104, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 736, 4256, 29898, 1311, 29889, 657, 29918, 1643, 29918, 3881, 3101, 13, 13, 1678, 822, 679, 29918, 1643, 29918, 3881, 29898, 1311, 1125, 13, 4706, 3402, 353, 1583, 29889, 15989, 5607, 2692, 27946, 29961, 1311, 29889, 9778, 918, 29962, 13, 4706, 4331, 353, 1583, 29889, 24461, 6670, 29918, 1254, 15488, 29961, 1311, 29889, 9778, 918, 29962, 13, 4706, 3380, 353, 1583, 29889, 463, 13, 4706, 11073, 353, 5159, 13, 13, 4706, 1550, 3380, 529, 1583, 29889, 355, 29901, 13, 9651, 11073, 29889, 4397, 29898, 463, 29889, 710, 615, 603, 29898, 4830, 876, 13, 9651, 3380, 4619, 4331, 13, 13, 4706, 736, 11073, 13, 2 ]
quantity/history/api.py
wyjcpu/quantity
0
1613524
<filename>quantity/history/api.py # -*- coding: utf-8 -*- from quantity.history.day import Day def init(dtype='D', export='csv', path='history'): return Day(path=path, export=export).init() def update_single_code(dtype='D', stock_code=None, path='history', export='csv'): if stock_code is None: raise Exception('stock code is None') return Day(path=path, export=export).update_single_code(stock_code) def update(dtype='D', export='csv', path='history'): return Day(path=path, export=export).update()
[ 1, 529, 9507, 29958, 22640, 29914, 18434, 29914, 2754, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 14728, 29889, 18434, 29889, 3250, 1053, 8373, 13, 13, 13, 1753, 2069, 29898, 29881, 1853, 2433, 29928, 742, 5609, 2433, 7638, 742, 2224, 2433, 18434, 29374, 13, 1678, 736, 8373, 29898, 2084, 29922, 2084, 29892, 5609, 29922, 15843, 467, 2344, 580, 13, 13, 13, 1753, 2767, 29918, 14369, 29918, 401, 29898, 29881, 1853, 2433, 29928, 742, 10961, 29918, 401, 29922, 8516, 29892, 2224, 2433, 18434, 742, 5609, 2433, 7638, 29374, 13, 1678, 565, 10961, 29918, 401, 338, 6213, 29901, 13, 4706, 12020, 8960, 877, 17712, 775, 338, 6213, 1495, 13, 308, 13, 1678, 736, 8373, 29898, 2084, 29922, 2084, 29892, 5609, 29922, 15843, 467, 5504, 29918, 14369, 29918, 401, 29898, 17712, 29918, 401, 29897, 13, 13, 13, 1753, 2767, 29898, 29881, 1853, 2433, 29928, 742, 5609, 2433, 7638, 742, 2224, 2433, 18434, 29374, 13, 1678, 736, 8373, 29898, 2084, 29922, 2084, 29892, 5609, 29922, 15843, 467, 5504, 580, 13, 2 ]
foo/pictureR/wordsTemplate.py
MangetsuC/arkHelper
147
14724
<filename>foo/pictureR/wordsTemplate.py<gh_stars>100-1000 from PIL import Image, ImageDraw, ImageFont from numpy import asarray from cv2 import cvtColor, COLOR_RGB2BGR, imshow, waitKey from os import getcwd def getFontSize_name(resolution): x = resolution[0] if x <= 1024: return (16, (1024,576)) elif x <= 1280: return (21, (1280,720)) elif x <= 1440: return (23, (1440,810)) elif x <= 1600: return (26, (1600,900)) else: return (31, (1920,1080)) def getTemplatePic_CH(words, fontsize): #字号典型值 基建干员名称23 进驻总览房屋名称28(1440*810) 基建干员名称30 进驻总览房屋名称38(1920*1080) ttf = ImageFont.truetype(getcwd() + "/res/fonts/SourceHanSansCN-Regular.otf", fontsize) #字体选用思源黑体 wordsPic = Image.new('RGB', ttf.getsize(words)) wordsDraw = ImageDraw.Draw(wordsPic) wordsDraw.text((0, 0), words, font=ttf, fill=(255,255,255)) #创建对应的模板 #temp = cvtColor(asarray(wordsPic), COLOR_RGB2BGR) #imshow('test', temp) #waitKey(0) return cvtColor(asarray(wordsPic), COLOR_RGB2BGR) def getTemplatePic_NUM(num, fontsize): #字号典型值 进驻总览干员心情28 num = str(num) ttf = ImageFont.truetype(getcwd() + "/res/fonts/Bender.otf", fontsize) #字体选用bender wordsPic = Image.new('RGB', ttf.getsize(num), color = (255, 255, 255)) wordsDraw = ImageDraw.Draw(wordsPic) wordsDraw.text((0, 0), num, font=ttf, fill=(0,0,0)) #创建对应的模板 return cvtColor(asarray(wordsPic), COLOR_RGB2BGR)
[ 1, 529, 9507, 29958, 5431, 29914, 12095, 29934, 29914, 9303, 6733, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 3166, 349, 6227, 1053, 7084, 29892, 7084, 8537, 29892, 7084, 9824, 13, 3166, 12655, 1053, 408, 2378, 13, 3166, 13850, 29906, 1053, 13850, 29873, 3306, 29892, 23958, 1955, 29918, 28212, 29906, 29933, 14345, 29892, 527, 4294, 29892, 4480, 2558, 13, 3166, 2897, 1053, 679, 29883, 9970, 13, 13, 1753, 679, 9824, 3505, 29918, 978, 29898, 9778, 918, 1125, 13, 1678, 921, 353, 10104, 29961, 29900, 29962, 13, 1678, 565, 921, 5277, 29871, 29896, 29900, 29906, 29946, 29901, 13, 4706, 736, 313, 29896, 29953, 29892, 313, 29896, 29900, 29906, 29946, 29892, 29945, 29955, 29953, 876, 13, 1678, 25342, 921, 5277, 29871, 29896, 29906, 29947, 29900, 29901, 13, 4706, 736, 313, 29906, 29896, 29892, 313, 29896, 29906, 29947, 29900, 29892, 29955, 29906, 29900, 876, 13, 1678, 25342, 921, 5277, 29871, 29896, 29946, 29946, 29900, 29901, 13, 4706, 736, 313, 29906, 29941, 29892, 313, 29896, 29946, 29946, 29900, 29892, 29947, 29896, 29900, 876, 13, 1678, 25342, 921, 5277, 29871, 29896, 29953, 29900, 29900, 29901, 13, 4706, 736, 313, 29906, 29953, 29892, 313, 29896, 29953, 29900, 29900, 29892, 29929, 29900, 29900, 876, 13, 1678, 1683, 29901, 13, 4706, 736, 313, 29941, 29896, 29892, 313, 29896, 29929, 29906, 29900, 29892, 29896, 29900, 29947, 29900, 876, 13, 13, 1753, 679, 6733, 29925, 293, 29918, 3210, 29898, 9303, 29892, 4079, 2311, 1125, 13, 1678, 396, 30578, 30850, 31259, 30883, 30959, 29871, 31359, 30886, 232, 188, 181, 31911, 30548, 31685, 29906, 29941, 29871, 31174, 236, 172, 190, 233, 131, 190, 235, 170, 139, 31975, 31654, 30548, 31685, 29906, 29947, 29898, 29896, 29946, 29946, 29900, 29930, 29947, 29896, 29900, 29897, 29871, 31359, 30886, 232, 188, 181, 31911, 30548, 31685, 29941, 29900, 29871, 31174, 236, 172, 190, 233, 131, 190, 235, 170, 139, 31975, 31654, 30548, 31685, 29941, 29947, 29898, 29896, 29929, 29906, 29900, 29930, 29896, 29900, 29947, 29900, 29897, 13, 1678, 260, 13264, 353, 7084, 9824, 29889, 509, 14484, 668, 29898, 657, 29883, 9970, 580, 718, 5591, 690, 29914, 28586, 29914, 4435, 29950, 273, 29903, 550, 13778, 29899, 4597, 1070, 29889, 327, 29888, 613, 4079, 2311, 29897, 396, 30578, 30988, 31333, 30406, 31579, 31193, 236, 190, 148, 30988, 13, 1678, 3838, 29925, 293, 353, 7084, 29889, 1482, 877, 28212, 742, 260, 13264, 29889, 657, 2311, 29898, 9303, 876, 13, 1678, 3838, 8537, 353, 7084, 8537, 29889, 8537, 29898, 9303, 29925, 293, 29897, 13, 1678, 3838, 8537, 29889, 726, 3552, 29900, 29892, 29871, 29900, 511, 3838, 29892, 4079, 29922, 698, 29888, 29892, 5445, 7607, 29906, 29945, 29945, 29892, 29906, 29945, 29945, 29892, 29906, 29945, 29945, 876, 396, 31441, 30886, 30783, 31370, 30210, 31382, 233, 160, 194, 13, 1678, 396, 7382, 353, 13850, 29873, 3306, 29898, 294, 2378, 29898, 9303, 29925, 293, 511, 23958, 1955, 29918, 28212, 29906, 29933, 14345, 29897, 13, 1678, 396, 326, 4294, 877, 1688, 742, 5694, 29897, 13, 1678, 396, 10685, 2558, 29898, 29900, 29897, 13, 1678, 736, 13850, 29873, 3306, 29898, 294, 2378, 29898, 9303, 29925, 293, 511, 23958, 1955, 29918, 28212, 29906, 29933, 14345, 29897, 13, 13, 1753, 679, 6733, 29925, 293, 29918, 13967, 29898, 1949, 29892, 4079, 2311, 1125, 13, 1678, 396, 30578, 30850, 31259, 30883, 30959, 29871, 31174, 236, 172, 190, 233, 131, 190, 235, 170, 139, 232, 188, 181, 31911, 30869, 30993, 29906, 29947, 13, 1678, 954, 353, 851, 29898, 1949, 29897, 13, 1678, 260, 13264, 353, 7084, 9824, 29889, 509, 14484, 668, 29898, 657, 29883, 9970, 580, 718, 5591, 690, 29914, 28586, 29914, 29933, 1581, 29889, 327, 29888, 613, 4079, 2311, 29897, 396, 30578, 30988, 31333, 30406, 29890, 1581, 13, 1678, 3838, 29925, 293, 353, 7084, 29889, 1482, 877, 28212, 742, 260, 13264, 29889, 657, 2311, 29898, 1949, 511, 2927, 353, 313, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 876, 13, 1678, 3838, 8537, 353, 7084, 8537, 29889, 8537, 29898, 9303, 29925, 293, 29897, 13, 1678, 3838, 8537, 29889, 726, 3552, 29900, 29892, 29871, 29900, 511, 954, 29892, 4079, 29922, 698, 29888, 29892, 5445, 7607, 29900, 29892, 29900, 29892, 29900, 876, 396, 31441, 30886, 30783, 31370, 30210, 31382, 233, 160, 194, 13, 1678, 736, 13850, 29873, 3306, 29898, 294, 2378, 29898, 9303, 29925, 293, 511, 23958, 1955, 29918, 28212, 29906, 29933, 14345, 29897, 2 ]
Packs/CaseManagement-Generic/Scripts/LinkIncidentsButton/LinkIncidentsButton.py
diCagri/content
799
83208
<filename>Packs/CaseManagement-Generic/Scripts/LinkIncidentsButton/LinkIncidentsButton.py<gh_stars>100-1000 import demistomock as demisto action = demisto.getArg('action') if action not in ['link', 'unlink']: action = 'link' demisto.results(demisto.executeCommand("linkIncidents", {"linkedIncidentIDs": demisto.getArg("linkedIncidentIDs"), "action": action}))
[ 1, 529, 9507, 29958, 16638, 29879, 29914, 8259, 27107, 29899, 15809, 29914, 4081, 29879, 29914, 6595, 797, 29883, 16719, 3125, 29914, 6595, 797, 29883, 16719, 3125, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 5215, 1261, 391, 290, 1698, 408, 1261, 5137, 13, 13, 2467, 353, 1261, 5137, 29889, 657, 8559, 877, 2467, 1495, 13, 361, 3158, 451, 297, 6024, 2324, 742, 525, 348, 2324, 2033, 29901, 13, 1678, 3158, 353, 525, 2324, 29915, 13, 13, 2310, 5137, 29889, 9902, 29898, 2310, 5137, 29889, 7978, 6255, 703, 2324, 797, 29883, 16719, 613, 8853, 2324, 287, 797, 29883, 1693, 1367, 29879, 1115, 1261, 5137, 29889, 657, 8559, 703, 2324, 287, 797, 29883, 1693, 1367, 29879, 4968, 13, 462, 462, 462, 308, 376, 2467, 1115, 3158, 20073, 13, 2 ]
directory/block_producer/migrations/0008_increase_text_size.py
Remmeauth/bp-directory-back
0
101882
# Generated by Django 2.2.6 on 2019-10-10 08:35 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('block_producer', '0007_add_status_description_field'), ] operations = [ migrations.AlterField( model_name='blockproducer', name='logo_url', field=models.URLField(blank=True, default='https://block-producers-directory.s3-us-west-2.amazonaws.com/bps/logos/default-block-producer-logotype.png', max_length=1000), ), migrations.AlterField( model_name='blockproducer', name='status_description', field=models.TextField(blank=True, max_length=10000), ), migrations.AlterField( model_name='blockproducercomment', name='text', field=models.CharField(max_length=1000), ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29953, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29900, 29899, 29896, 29900, 29871, 29900, 29947, 29901, 29941, 29945, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 1271, 29918, 5498, 2265, 742, 525, 29900, 29900, 29900, 29955, 29918, 1202, 29918, 4882, 29918, 8216, 29918, 2671, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 1271, 5498, 2265, 742, 13, 9651, 1024, 2433, 14569, 29918, 2271, 742, 13, 9651, 1746, 29922, 9794, 29889, 4219, 3073, 29898, 19465, 29922, 5574, 29892, 2322, 2433, 991, 597, 1271, 29899, 5498, 22543, 29899, 12322, 29889, 29879, 29941, 29899, 375, 29899, 5933, 29899, 29906, 29889, 17260, 10467, 29889, 510, 29914, 29890, 567, 29914, 1188, 359, 29914, 4381, 29899, 1271, 29899, 5498, 2265, 29899, 1188, 327, 668, 29889, 2732, 742, 4236, 29918, 2848, 29922, 29896, 29900, 29900, 29900, 511, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 1271, 5498, 2265, 742, 13, 9651, 1024, 2433, 4882, 29918, 8216, 742, 13, 9651, 1746, 29922, 9794, 29889, 15778, 29898, 19465, 29922, 5574, 29892, 4236, 29918, 2848, 29922, 29896, 29900, 29900, 29900, 29900, 511, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 1271, 5498, 2265, 9342, 742, 13, 9651, 1024, 2433, 726, 742, 13, 9651, 1746, 29922, 9794, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29900, 29900, 511, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
conftest.py
berpress/MT5WT
0
13286
import pytest from common.common import NETTING_ACCOUNT from fixture.application import Application @pytest.fixture(scope="session") def app(request): base_url = request.config.getoption("--base_url") fixture = Application(base_url) fixture.wd.maximize_window() fixture.wd.implicitly_wait(10) yield fixture fixture.destroy() def pytest_addoption(parser): parser.addoption( "--base_url", action="store", default="https://trade.mql5.com/trade", help="base_url", ) @pytest.fixture() def auth_netting(app): if not app.auth.is_auth(NETTING_ACCOUNT.login): app.auth.open() app.auth.auth_terminal(NETTING_ACCOUNT.login, NETTING_ACCOUNT.password)
[ 1, 1053, 11451, 1688, 13, 3166, 3619, 29889, 9435, 1053, 405, 2544, 29911, 4214, 29918, 2477, 18736, 13, 3166, 5713, 15546, 29889, 6214, 1053, 8427, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 543, 7924, 1159, 13, 1753, 623, 29898, 3827, 1125, 13, 1678, 2967, 29918, 2271, 353, 2009, 29889, 2917, 29889, 657, 3385, 703, 489, 3188, 29918, 2271, 1159, 13, 1678, 5713, 15546, 353, 8427, 29898, 3188, 29918, 2271, 29897, 13, 1678, 5713, 15546, 29889, 9970, 29889, 27525, 675, 29918, 7165, 580, 13, 1678, 5713, 15546, 29889, 9970, 29889, 6574, 4019, 368, 29918, 10685, 29898, 29896, 29900, 29897, 13, 1678, 7709, 5713, 15546, 13, 1678, 5713, 15546, 29889, 20524, 580, 13, 13, 13, 1753, 11451, 1688, 29918, 1202, 3385, 29898, 16680, 1125, 13, 1678, 13812, 29889, 1202, 3385, 29898, 13, 4706, 376, 489, 3188, 29918, 2271, 613, 13, 4706, 3158, 543, 8899, 613, 13, 4706, 2322, 543, 991, 597, 3018, 311, 29889, 29885, 1519, 29945, 29889, 510, 29914, 3018, 311, 613, 13, 4706, 1371, 543, 3188, 29918, 2271, 613, 13, 1678, 1723, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 4817, 29918, 1212, 1259, 29898, 932, 1125, 13, 1678, 565, 451, 623, 29889, 5150, 29889, 275, 29918, 5150, 29898, 6006, 29911, 4214, 29918, 2477, 18736, 29889, 7507, 1125, 13, 4706, 623, 29889, 5150, 29889, 3150, 580, 13, 4706, 623, 29889, 5150, 29889, 5150, 29918, 8489, 979, 29898, 6006, 29911, 4214, 29918, 2477, 18736, 29889, 7507, 29892, 405, 2544, 29911, 4214, 29918, 2477, 18736, 29889, 5630, 29897, 13, 2 ]
setup.py
Bonifatius94/sc2sim
0
32738
<gh_stars>0 from setuptools import setup def load_pip_dependency_list(): with open('./requirements.txt', 'r', encoding='utf-8') as file: return file.read().splitlines() def load_readme_desc(): with open("README.md", "r", encoding="utf-8") as readme_file: return readme_file.read() setup( name="sc2sim", version="1.0.0", author="<NAME>", author_email="<EMAIL>", description="A StarCraft II environment for reinforcement learning purposes", long_description=load_readme_desc(), long_description_content_type="text/markdown", url="https://github.com/Bonifatius94/sc2sim", packages=["sc2sim"], python_requires=">=3", install_requires=load_pip_dependency_list() )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 1753, 2254, 29918, 13096, 29918, 10836, 29918, 1761, 7295, 13, 1678, 411, 1722, 877, 6904, 12277, 1860, 29889, 3945, 742, 525, 29878, 742, 8025, 2433, 9420, 29899, 29947, 1495, 408, 934, 29901, 13, 4706, 736, 934, 29889, 949, 2141, 5451, 9012, 580, 13, 13, 1753, 2254, 29918, 949, 1004, 29918, 14273, 7295, 13, 1678, 411, 1722, 703, 16310, 2303, 29889, 3487, 613, 376, 29878, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 1303, 1004, 29918, 1445, 29901, 13, 4706, 736, 1303, 1004, 29918, 1445, 29889, 949, 580, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 1557, 29906, 3601, 613, 13, 1678, 1873, 543, 29896, 29889, 29900, 29889, 29900, 613, 13, 1678, 4148, 543, 29966, 5813, 28341, 13, 1678, 4148, 29918, 5269, 543, 29966, 26862, 6227, 28341, 13, 1678, 6139, 543, 29909, 7828, 29907, 4154, 1944, 5177, 363, 15561, 1454, 13561, 6509, 11976, 613, 13, 1678, 1472, 29918, 8216, 29922, 1359, 29918, 949, 1004, 29918, 14273, 3285, 13, 1678, 1472, 29918, 8216, 29918, 3051, 29918, 1853, 543, 726, 29914, 3502, 3204, 613, 13, 1678, 3142, 543, 991, 597, 3292, 29889, 510, 29914, 29933, 265, 361, 2219, 375, 29929, 29946, 29914, 1557, 29906, 3601, 613, 13, 1678, 9741, 29922, 3366, 1557, 29906, 3601, 12436, 13, 1678, 3017, 29918, 276, 339, 2658, 543, 18572, 29941, 613, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 1359, 29918, 13096, 29918, 10836, 29918, 1761, 580, 13, 29897, 13, 2 ]
tests/test_tree_adapter.py
benkrikler/fast-carpenter-github-test
12
88480
import awkward as ak import numpy as np import pytest from pytest_lazyfixture import lazy_fixture from fast_carpenter.testing import FakeBEEvent import fast_carpenter.tree_adapter as tree_adapter from fast_carpenter.tree_adapter import ArrayMethods ############################################################################### # Uproot3 tests ############################################################################### @pytest.fixture def uproot3_adapter(uproot3_tree): return tree_adapter.create({"adapter": "uproot3", "tree": uproot3_tree}) def test_uproot3_num_entries(uproot3_tree, uproot3_adapter): assert uproot3_adapter.num_entries == uproot3_tree.numentries def test_uproot3_getitem(uproot3_tree, uproot3_adapter): assert ak.all(uproot3_adapter["Muon_Py"] == uproot3_tree["Muon_Py"].array()) ############################################################################### # Uproot4 tests ############################################################################### @pytest.fixture def uproot4_adapter(uproot4_tree): return tree_adapter.create({"adapter": "uproot4", "tree": uproot4_tree}) @pytest.fixture def uproot4_ranged_adapter(uproot4_tree, event_range): return tree_adapter.create_ranged( { "adapter": "uproot4", "tree": uproot4_tree, "start": event_range.start_entry, "stop": event_range.stop_entry } ) @pytest.fixture def uproot4_masked_adapter(uproot4_tree, event_range): return tree_adapter.create_masked( { "adapter": "uproot4", "tree": uproot4_tree, "start": event_range.start_entry, "stop": event_range.stop_entry, "mask": [(i % 2) == 0 for i in range(event_range.start_entry, event_range.stop_entry)] } ) def test_uproot4_num_entries(uproot4_tree, uproot4_adapter): assert uproot4_adapter.num_entries == uproot4_tree.num_entries def test_uproot4_getitem(uproot4_tree, uproot4_adapter): assert ak.all(uproot4_adapter["Muon_Py"] == uproot4_tree["Muon_Py"].array()) def test_uproot4_evaluate(uproot4_tree, uproot4_adapter): result = uproot4_adapter.evaluate("Muon_Py * NMuon") assert ak.num(result, axis=0) == ak.num(uproot4_tree["Muon_Py"].array(), axis=0) def test_uproot4_range(uproot4_tree, uproot4_ranged_adapter, event_range): assert uproot4_ranged_adapter.num_entries == event_range.entries_in_block def test_uproot4_add_retrieve(uproot4_tree, uproot4_ranged_adapter): muon_px = uproot4_ranged_adapter["Muon_Px"] assert ArrayMethods.filtered_len(muon_px) == len(uproot4_ranged_adapter) muon_py, muon_pz = uproot4_ranged_adapter.arrays(["Muon_Py", "Muon_Pz"], how=tuple) muon_momentum = np.hypot(muon_py, muon_pz) uproot4_ranged_adapter.new_variable("Muon_momentum", muon_momentum) retrieve_momentum = uproot4_ranged_adapter["Muon_momentum"] assert len(retrieve_momentum) == len(muon_momentum) assert ak.all(ak.flatten(retrieve_momentum) == ak.flatten(muon_momentum)) def test_overwrite(uproot4_ranged_adapter): muon_px = uproot4_ranged_adapter["Muon_Px"] assert ("Muon_Px" in uproot4_ranged_adapter) with pytest.raises(ValueError) as err: uproot4_ranged_adapter.new_variable("Muon_Px", muon_px / muon_px) assert "Muon_Px" in str(err) def test_to_pandas(full_wrapped_tree): chunk = FakeBEEvent(full_wrapped_tree, "mc") inputs = ['Electron_Px', 'Electron_Py', 'EventWeight'] df = ArrayMethods.to_pandas(chunk.tree, inputs) assert list(df.keys()) == inputs def test_arraydict_to_pandas_with_new_variable(uproot4_ranged_adapter): muon_py, muon_pz = uproot4_ranged_adapter.arrays(["Muon_Py", "Muon_Pz"], how=tuple) muon_momentum = np.hypot(muon_py, muon_pz) uproot4_ranged_adapter.new_variable("Muon_momentum", muon_momentum) inputs = ['Muon_Py', 'Muon_Pz', 'Muon_momentum'] arrays = { 'Muon_Py': muon_py, 'Muon_Pz': muon_pz, 'Muon_momentum': muon_momentum, } df = ArrayMethods.arraydict_to_pandas(arrays) assert list(df.keys()) == inputs assert len(df) == ak.count_nonzero(muon_py) @pytest.mark.parametrize( "tree_under_test", [ lazy_fixture("uproot4_adapter"), lazy_fixture("uproot4_ranged_adapter"), lazy_fixture("uproot4_masked_adapter"), ] ) def test_to_pandas_with_new_variable(tree_under_test): muon_py, muon_pz = tree_under_test.arrays(["Muon_Py", "Muon_Pz"], how=tuple) muon_momentum = np.hypot(muon_py, muon_pz) assert len(muon_momentum) == len(muon_py) tree_under_test.new_variable("Muon_momentum", muon_momentum) inputs = ['Muon_Py', 'Muon_Pz', 'Muon_momentum'] df = ArrayMethods.to_pandas(tree_under_test, inputs) assert list(df.keys()) == inputs assert len(df) == ak.count_nonzero(muon_py) @pytest.mark.parametrize( "tree_under_test, how", [ (lazy_fixture("uproot4_adapter"), tuple), (lazy_fixture("uproot4_adapter"), list), (lazy_fixture("uproot4_ranged_adapter"), tuple), (lazy_fixture("uproot4_ranged_adapter"), list), (lazy_fixture("uproot4_masked_adapter"), tuple), (lazy_fixture("uproot4_masked_adapter"), list), ] ) def test_arrays_to_tuple_or_list(tree_under_test, how): muon_py, muon_pz = tree_under_test.arrays(["Muon_Py", "Muon_Pz"], how=tuple) muon_momentum = np.hypot(muon_py, muon_pz) tree_under_test.new_variable("Muon_momentum", muon_momentum) _, _, muon_momentum_new = tree_under_test.arrays(["Muon_Py", "Muon_Pz", "Muon_momentum"], how=how) assert ak.all(muon_momentum_new == muon_momentum) @pytest.mark.parametrize( "tree_under_test", [ lazy_fixture("uproot4_adapter"), lazy_fixture("uproot4_ranged_adapter"), lazy_fixture("uproot4_masked_adapter"), ] ) def test_arrays_to_dict(tree_under_test): muon_py, muon_pz = tree_under_test.arrays(["Muon_Py", "Muon_Pz"], how=tuple) muon_momentum = np.hypot(muon_py, muon_pz) tree_under_test.new_variable("Muon_momentum", muon_momentum) array_dict = tree_under_test.arrays(["Muon_Py", "Muon_Pz", "Muon_momentum"], how=dict) assert ak.all(array_dict["Muon_momentum"] == muon_momentum) @pytest.mark.parametrize( "tree_under_test", [ lazy_fixture("uproot4_adapter"), lazy_fixture("uproot4_ranged_adapter"), lazy_fixture("uproot4_masked_adapter"), ] ) def test_arrays_as_np_lists(tree_under_test): muon_py, muon_pz = tree_under_test.arrays(["Muon_Py", "Muon_Pz"], how=tuple) muon_momentum = np.hypot(muon_py, muon_pz) tree_under_test.new_variable("Muon_momentum", muon_momentum) np_array = ArrayMethods.arrays_as_np_array(tree_under_test, ["Muon_Py", "Muon_Pz", "Muon_momentum"], how=dict) assert ak.all(np_array[-1] == muon_momentum)
[ 1, 1053, 13689, 1328, 408, 11208, 13, 5215, 12655, 408, 7442, 13, 5215, 11451, 1688, 13, 3166, 11451, 1688, 29918, 433, 1537, 7241, 15546, 1053, 17366, 29918, 7241, 15546, 13, 13, 3166, 5172, 29918, 4287, 29886, 5893, 29889, 13424, 1053, 383, 1296, 15349, 2624, 13, 5215, 5172, 29918, 4287, 29886, 5893, 29889, 8336, 29918, 21412, 408, 5447, 29918, 21412, 13, 3166, 5172, 29918, 4287, 29886, 5893, 29889, 8336, 29918, 21412, 1053, 4398, 26112, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 501, 771, 327, 29941, 6987, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 701, 4632, 29941, 29918, 21412, 29898, 29884, 771, 327, 29941, 29918, 8336, 1125, 13, 1678, 736, 5447, 29918, 21412, 29889, 3258, 3319, 29908, 21412, 1115, 376, 29884, 771, 327, 29941, 613, 376, 8336, 1115, 701, 4632, 29941, 29918, 8336, 1800, 13, 13, 13, 1753, 1243, 29918, 29884, 771, 327, 29941, 29918, 1949, 29918, 26586, 29898, 29884, 771, 327, 29941, 29918, 8336, 29892, 701, 4632, 29941, 29918, 21412, 1125, 13, 1678, 4974, 701, 4632, 29941, 29918, 21412, 29889, 1949, 29918, 26586, 1275, 701, 4632, 29941, 29918, 8336, 29889, 29876, 942, 2722, 13, 13, 13, 1753, 1243, 29918, 29884, 771, 327, 29941, 29918, 657, 667, 29898, 29884, 771, 327, 29941, 29918, 8336, 29892, 701, 4632, 29941, 29918, 21412, 1125, 13, 1678, 4974, 11208, 29889, 497, 29898, 29884, 771, 327, 29941, 29918, 21412, 3366, 29924, 29884, 265, 29918, 19737, 3108, 1275, 701, 4632, 29941, 29918, 8336, 3366, 29924, 29884, 265, 29918, 19737, 16862, 2378, 3101, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 501, 771, 327, 29946, 6987, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 701, 4632, 29946, 29918, 21412, 29898, 29884, 771, 327, 29946, 29918, 8336, 1125, 13, 1678, 736, 5447, 29918, 21412, 29889, 3258, 3319, 29908, 21412, 1115, 376, 29884, 771, 327, 29946, 613, 376, 8336, 1115, 701, 4632, 29946, 29918, 8336, 1800, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29898, 29884, 771, 327, 29946, 29918, 8336, 29892, 1741, 29918, 3881, 1125, 13, 1678, 736, 5447, 29918, 21412, 29889, 3258, 29918, 29878, 4618, 29898, 13, 4706, 426, 13, 9651, 376, 21412, 1115, 376, 29884, 771, 327, 29946, 613, 13, 9651, 376, 8336, 1115, 701, 4632, 29946, 29918, 8336, 29892, 13, 9651, 376, 2962, 1115, 1741, 29918, 3881, 29889, 2962, 29918, 8269, 29892, 13, 9651, 376, 9847, 1115, 1741, 29918, 3881, 29889, 9847, 29918, 8269, 13, 4706, 500, 13, 1678, 1723, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 701, 4632, 29946, 29918, 13168, 287, 29918, 21412, 29898, 29884, 771, 327, 29946, 29918, 8336, 29892, 1741, 29918, 3881, 1125, 13, 1678, 736, 5447, 29918, 21412, 29889, 3258, 29918, 13168, 287, 29898, 13, 4706, 426, 13, 9651, 376, 21412, 1115, 376, 29884, 771, 327, 29946, 613, 376, 8336, 1115, 701, 4632, 29946, 29918, 8336, 29892, 13, 9651, 376, 2962, 1115, 1741, 29918, 3881, 29889, 2962, 29918, 8269, 29892, 376, 9847, 1115, 1741, 29918, 3881, 29889, 9847, 29918, 8269, 29892, 13, 9651, 376, 13168, 1115, 17288, 29875, 1273, 29871, 29906, 29897, 1275, 29871, 29900, 363, 474, 297, 3464, 29898, 3696, 29918, 3881, 29889, 2962, 29918, 8269, 29892, 1741, 29918, 3881, 29889, 9847, 29918, 8269, 4638, 13, 4706, 500, 13, 1678, 1723, 13, 13, 13, 1753, 1243, 29918, 29884, 771, 327, 29946, 29918, 1949, 29918, 26586, 29898, 29884, 771, 327, 29946, 29918, 8336, 29892, 701, 4632, 29946, 29918, 21412, 1125, 13, 1678, 4974, 701, 4632, 29946, 29918, 21412, 29889, 1949, 29918, 26586, 1275, 701, 4632, 29946, 29918, 8336, 29889, 1949, 29918, 26586, 13, 13, 13, 1753, 1243, 29918, 29884, 771, 327, 29946, 29918, 657, 667, 29898, 29884, 771, 327, 29946, 29918, 8336, 29892, 701, 4632, 29946, 29918, 21412, 1125, 13, 1678, 4974, 11208, 29889, 497, 29898, 29884, 771, 327, 29946, 29918, 21412, 3366, 29924, 29884, 265, 29918, 19737, 3108, 1275, 701, 4632, 29946, 29918, 8336, 3366, 29924, 29884, 265, 29918, 19737, 16862, 2378, 3101, 13, 13, 13, 1753, 1243, 29918, 29884, 771, 327, 29946, 29918, 24219, 403, 29898, 29884, 771, 327, 29946, 29918, 8336, 29892, 701, 4632, 29946, 29918, 21412, 1125, 13, 1678, 1121, 353, 701, 4632, 29946, 29918, 21412, 29889, 24219, 403, 703, 29924, 29884, 265, 29918, 19737, 334, 405, 29924, 29884, 265, 1159, 13, 1678, 4974, 11208, 29889, 1949, 29898, 2914, 29892, 9685, 29922, 29900, 29897, 1275, 11208, 29889, 1949, 29898, 29884, 771, 327, 29946, 29918, 8336, 3366, 29924, 29884, 265, 29918, 19737, 16862, 2378, 3285, 9685, 29922, 29900, 29897, 13, 13, 13, 1753, 1243, 29918, 29884, 771, 327, 29946, 29918, 3881, 29898, 29884, 771, 327, 29946, 29918, 8336, 29892, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29892, 1741, 29918, 3881, 1125, 13, 1678, 4974, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29889, 1949, 29918, 26586, 1275, 1741, 29918, 3881, 29889, 26586, 29918, 262, 29918, 1271, 13, 13, 13, 1753, 1243, 29918, 29884, 771, 327, 29946, 29918, 1202, 29918, 276, 509, 2418, 29898, 29884, 771, 327, 29946, 29918, 8336, 29892, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 1125, 13, 1678, 3887, 265, 29918, 1756, 353, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 3366, 29924, 29884, 265, 29918, 29925, 29916, 3108, 13, 1678, 4974, 4398, 26112, 29889, 4572, 287, 29918, 2435, 29898, 2589, 265, 29918, 1756, 29897, 1275, 7431, 29898, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 29897, 13, 13, 1678, 3887, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 353, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 12436, 920, 29922, 23583, 29897, 13, 1678, 3887, 265, 29918, 29885, 2932, 398, 353, 7442, 29889, 29882, 1478, 327, 29898, 2589, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 29897, 13, 1678, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29889, 1482, 29918, 11918, 703, 29924, 29884, 265, 29918, 29885, 2932, 398, 613, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 13, 1678, 10563, 29918, 29885, 2932, 398, 353, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 3366, 29924, 29884, 265, 29918, 29885, 2932, 398, 3108, 13, 1678, 4974, 7431, 29898, 276, 509, 2418, 29918, 29885, 2932, 398, 29897, 1275, 7431, 29898, 2589, 265, 29918, 29885, 2932, 398, 29897, 13, 1678, 4974, 11208, 29889, 497, 29898, 557, 29889, 1579, 8606, 29898, 276, 509, 2418, 29918, 29885, 2932, 398, 29897, 1275, 11208, 29889, 1579, 8606, 29898, 2589, 265, 29918, 29885, 2932, 398, 876, 13, 13, 13, 1753, 1243, 29918, 957, 3539, 29898, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 1125, 13, 1678, 3887, 265, 29918, 1756, 353, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 3366, 29924, 29884, 265, 29918, 29925, 29916, 3108, 13, 1678, 4974, 4852, 29924, 29884, 265, 29918, 29925, 29916, 29908, 297, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 29897, 408, 4589, 29901, 13, 4706, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29889, 1482, 29918, 11918, 703, 29924, 29884, 265, 29918, 29925, 29916, 613, 3887, 265, 29918, 1756, 847, 3887, 265, 29918, 1756, 29897, 13, 1678, 4974, 376, 29924, 29884, 265, 29918, 29925, 29916, 29908, 297, 851, 29898, 3127, 29897, 13, 13, 13, 1753, 1243, 29918, 517, 29918, 15112, 29898, 8159, 29918, 29893, 336, 2986, 29918, 8336, 1125, 13, 1678, 19875, 353, 383, 1296, 15349, 2624, 29898, 8159, 29918, 29893, 336, 2986, 29918, 8336, 29892, 376, 14047, 1159, 13, 1678, 10970, 353, 6024, 29923, 781, 1617, 29918, 29925, 29916, 742, 525, 29923, 781, 1617, 29918, 19737, 742, 525, 2624, 22676, 2033, 13, 1678, 4489, 353, 4398, 26112, 29889, 517, 29918, 15112, 29898, 29812, 29889, 8336, 29892, 10970, 29897, 13, 1678, 4974, 1051, 29898, 2176, 29889, 8149, 3101, 1275, 10970, 13, 13, 13, 1753, 1243, 29918, 2378, 8977, 29918, 517, 29918, 15112, 29918, 2541, 29918, 1482, 29918, 11918, 29898, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 1125, 13, 1678, 3887, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 353, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 12436, 920, 29922, 23583, 29897, 13, 1678, 3887, 265, 29918, 29885, 2932, 398, 353, 7442, 29889, 29882, 1478, 327, 29898, 2589, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 29897, 13, 1678, 701, 4632, 29946, 29918, 29878, 4618, 29918, 21412, 29889, 1482, 29918, 11918, 703, 29924, 29884, 265, 29918, 29885, 2932, 398, 613, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 13, 1678, 10970, 353, 6024, 29924, 29884, 265, 29918, 19737, 742, 525, 29924, 29884, 265, 29918, 29925, 29920, 742, 525, 29924, 29884, 265, 29918, 29885, 2932, 398, 2033, 13, 1678, 7049, 353, 426, 13, 4706, 525, 29924, 29884, 265, 29918, 19737, 2396, 3887, 265, 29918, 2272, 29892, 13, 4706, 525, 29924, 29884, 265, 29918, 29925, 29920, 2396, 3887, 265, 29918, 29886, 29920, 29892, 13, 4706, 525, 29924, 29884, 265, 29918, 29885, 2932, 398, 2396, 3887, 265, 29918, 29885, 2932, 398, 29892, 13, 1678, 500, 13, 1678, 4489, 353, 4398, 26112, 29889, 2378, 8977, 29918, 517, 29918, 15112, 29898, 2378, 29879, 29897, 13, 13, 1678, 4974, 1051, 29898, 2176, 29889, 8149, 3101, 1275, 10970, 13, 1678, 4974, 7431, 29898, 2176, 29897, 1275, 11208, 29889, 2798, 29918, 5464, 9171, 29898, 2589, 265, 29918, 2272, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 376, 8336, 29918, 5062, 29918, 1688, 613, 13, 1678, 518, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 21412, 4968, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 4968, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 13168, 287, 29918, 21412, 4968, 13, 1678, 4514, 13, 29897, 13, 1753, 1243, 29918, 517, 29918, 15112, 29918, 2541, 29918, 1482, 29918, 11918, 29898, 8336, 29918, 5062, 29918, 1688, 1125, 13, 1678, 3887, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 353, 5447, 29918, 5062, 29918, 1688, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 12436, 920, 29922, 23583, 29897, 13, 1678, 3887, 265, 29918, 29885, 2932, 398, 353, 7442, 29889, 29882, 1478, 327, 29898, 2589, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 29897, 13, 1678, 4974, 7431, 29898, 2589, 265, 29918, 29885, 2932, 398, 29897, 1275, 7431, 29898, 2589, 265, 29918, 2272, 29897, 13, 1678, 5447, 29918, 5062, 29918, 1688, 29889, 1482, 29918, 11918, 703, 29924, 29884, 265, 29918, 29885, 2932, 398, 613, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 13, 1678, 10970, 353, 6024, 29924, 29884, 265, 29918, 19737, 742, 525, 29924, 29884, 265, 29918, 29925, 29920, 742, 525, 29924, 29884, 265, 29918, 29885, 2932, 398, 2033, 13, 1678, 4489, 353, 4398, 26112, 29889, 517, 29918, 15112, 29898, 8336, 29918, 5062, 29918, 1688, 29892, 10970, 29897, 13, 13, 1678, 4974, 1051, 29898, 2176, 29889, 8149, 3101, 1275, 10970, 13, 1678, 4974, 7431, 29898, 2176, 29897, 1275, 11208, 29889, 2798, 29918, 5464, 9171, 29898, 2589, 265, 29918, 2272, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 376, 8336, 29918, 5062, 29918, 1688, 29892, 920, 613, 13, 1678, 518, 13, 4706, 313, 433, 1537, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 21412, 4968, 18761, 511, 13, 4706, 313, 433, 1537, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 21412, 4968, 1051, 511, 13, 4706, 313, 433, 1537, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 4968, 18761, 511, 13, 4706, 313, 433, 1537, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 4968, 1051, 511, 13, 4706, 313, 433, 1537, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 13168, 287, 29918, 21412, 4968, 18761, 511, 13, 4706, 313, 433, 1537, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 13168, 287, 29918, 21412, 4968, 1051, 511, 13, 1678, 4514, 13, 29897, 13, 1753, 1243, 29918, 2378, 29879, 29918, 517, 29918, 23583, 29918, 272, 29918, 1761, 29898, 8336, 29918, 5062, 29918, 1688, 29892, 920, 1125, 13, 1678, 3887, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 353, 5447, 29918, 5062, 29918, 1688, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 12436, 920, 29922, 23583, 29897, 13, 1678, 3887, 265, 29918, 29885, 2932, 398, 353, 7442, 29889, 29882, 1478, 327, 29898, 2589, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 29897, 13, 1678, 5447, 29918, 5062, 29918, 1688, 29889, 1482, 29918, 11918, 703, 29924, 29884, 265, 29918, 29885, 2932, 398, 613, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 1678, 17117, 17117, 3887, 265, 29918, 29885, 2932, 398, 29918, 1482, 353, 5447, 29918, 5062, 29918, 1688, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 613, 376, 29924, 29884, 265, 29918, 29885, 2932, 398, 12436, 920, 29922, 3525, 29897, 13, 1678, 4974, 11208, 29889, 497, 29898, 2589, 265, 29918, 29885, 2932, 398, 29918, 1482, 1275, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 376, 8336, 29918, 5062, 29918, 1688, 613, 13, 1678, 518, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 21412, 4968, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 4968, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 13168, 287, 29918, 21412, 4968, 13, 1678, 4514, 13, 29897, 13, 1753, 1243, 29918, 2378, 29879, 29918, 517, 29918, 8977, 29898, 8336, 29918, 5062, 29918, 1688, 1125, 13, 1678, 3887, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 353, 5447, 29918, 5062, 29918, 1688, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 12436, 920, 29922, 23583, 29897, 13, 1678, 3887, 265, 29918, 29885, 2932, 398, 353, 7442, 29889, 29882, 1478, 327, 29898, 2589, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 29897, 13, 1678, 5447, 29918, 5062, 29918, 1688, 29889, 1482, 29918, 11918, 703, 29924, 29884, 265, 29918, 29885, 2932, 398, 613, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 1678, 1409, 29918, 8977, 353, 5447, 29918, 5062, 29918, 1688, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 613, 376, 29924, 29884, 265, 29918, 29885, 2932, 398, 12436, 920, 29922, 8977, 29897, 13, 1678, 4974, 11208, 29889, 497, 29898, 2378, 29918, 8977, 3366, 29924, 29884, 265, 29918, 29885, 2932, 398, 3108, 1275, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 376, 8336, 29918, 5062, 29918, 1688, 613, 13, 1678, 518, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 21412, 4968, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 29878, 4618, 29918, 21412, 4968, 13, 4706, 17366, 29918, 7241, 15546, 703, 29884, 771, 327, 29946, 29918, 13168, 287, 29918, 21412, 4968, 13, 1678, 4514, 13, 29897, 13, 1753, 1243, 29918, 2378, 29879, 29918, 294, 29918, 9302, 29918, 21513, 29898, 8336, 29918, 5062, 29918, 1688, 1125, 13, 1678, 3887, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 353, 5447, 29918, 5062, 29918, 1688, 29889, 2378, 29879, 29898, 3366, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 12436, 920, 29922, 23583, 29897, 13, 1678, 3887, 265, 29918, 29885, 2932, 398, 353, 7442, 29889, 29882, 1478, 327, 29898, 2589, 265, 29918, 2272, 29892, 3887, 265, 29918, 29886, 29920, 29897, 13, 1678, 5447, 29918, 5062, 29918, 1688, 29889, 1482, 29918, 11918, 703, 29924, 29884, 265, 29918, 29885, 2932, 398, 613, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 1678, 7442, 29918, 2378, 353, 4398, 26112, 29889, 2378, 29879, 29918, 294, 29918, 9302, 29918, 2378, 29898, 8336, 29918, 5062, 29918, 1688, 29892, 6796, 29924, 29884, 265, 29918, 19737, 613, 376, 29924, 29884, 265, 29918, 29925, 29920, 613, 376, 29924, 29884, 265, 29918, 29885, 2932, 398, 12436, 920, 29922, 8977, 29897, 13, 1678, 4974, 11208, 29889, 497, 29898, 9302, 29918, 2378, 14352, 29896, 29962, 1275, 3887, 265, 29918, 29885, 2932, 398, 29897, 13, 2 ]
main/python-sphinx-removed-in/template.py
RoastVeg/cports
0
37759
<reponame>RoastVeg/cports pkgname = "python-sphinx-removed-in" pkgver = "0.2.1" pkgrel = 0 build_style = "python_module" hostmakedepends = ["python-setuptools"] checkdepends = ["python-sphinx"] depends = ["python-sphinx"] pkgdesc = "Sphinx extension for versionremoved and removed-in directives" maintainer = "q66 <<EMAIL>>" license = "BSD-3-Clause" url = "https://github.com/MrSenko/sphinx-removed-in" source = f"$(PYPI_SITE)/s/sphinx-removed-in/sphinx-removed-in-{pkgver}.tar.gz" sha256 = "0588239cb534cd97b1d3900d0444311c119e45296a9f73f1ea81ea81a2cd3db1" # dependency of pytest options = ["!check"]
[ 1, 529, 276, 1112, 420, 29958, 9588, 579, 29963, 387, 29914, 29883, 4011, 13, 15865, 978, 353, 376, 4691, 29899, 29879, 561, 14668, 29899, 1745, 8238, 29899, 262, 29908, 13, 15865, 369, 353, 376, 29900, 29889, 29906, 29889, 29896, 29908, 13, 15865, 2674, 353, 29871, 29900, 13, 4282, 29918, 3293, 353, 376, 4691, 29918, 5453, 29908, 13, 3069, 29885, 12535, 1022, 1975, 353, 6796, 4691, 29899, 842, 21245, 8789, 3108, 13, 3198, 2716, 1975, 353, 6796, 4691, 29899, 29879, 561, 14668, 3108, 13, 2716, 1975, 353, 6796, 4691, 29899, 29879, 561, 14668, 3108, 13, 15865, 14273, 353, 376, 29903, 561, 14668, 6081, 363, 1873, 1745, 8238, 322, 6206, 29899, 262, 1513, 3145, 29908, 13, 29885, 2365, 4008, 353, 376, 29939, 29953, 29953, 3532, 26862, 6227, 6778, 29908, 13, 506, 1947, 353, 376, 29933, 7230, 29899, 29941, 29899, 20216, 1509, 29908, 13, 2271, 353, 376, 991, 597, 3292, 29889, 510, 29914, 20335, 29903, 264, 2901, 29914, 29879, 561, 14668, 29899, 1745, 8238, 29899, 262, 29908, 13, 4993, 353, 285, 29908, 12330, 20055, 2227, 29918, 29903, 9094, 6802, 29879, 29914, 29879, 561, 14668, 29899, 1745, 8238, 29899, 262, 29914, 29879, 561, 14668, 29899, 1745, 8238, 29899, 262, 29899, 29912, 15865, 369, 1836, 12637, 29889, 18828, 29908, 13, 17051, 29906, 29945, 29953, 353, 376, 29900, 29945, 29947, 29947, 29906, 29941, 29929, 10702, 29945, 29941, 29946, 2252, 29929, 29955, 29890, 29896, 29881, 29941, 29929, 29900, 29900, 29881, 29900, 29946, 29946, 29946, 29941, 29896, 29896, 29883, 29896, 29896, 29929, 29872, 29946, 29945, 29906, 29929, 29953, 29874, 29929, 29888, 29955, 29941, 29888, 29896, 11248, 29947, 29896, 11248, 29947, 29896, 29874, 29906, 2252, 29941, 2585, 29896, 29908, 13, 29937, 10609, 310, 11451, 1688, 13, 6768, 353, 6796, 29991, 3198, 3108, 13, 2 ]
src/Cogs/InfoCog.py
kodyVS/Discord-Bot-Development
5
11746
<filename>src/Cogs/InfoCog.py from discord.ext import commands import discord import requests from bs4 import BeautifulSoup # work in progress! more languages welcome! class InfoCog(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(name = 'docs', brief = 'programming language documentation', description = 'documentation for languages, access by calling `.docs <language> <query>`', aliases = ['documentation', 'info']) async def docs(self, ctx, language: str, query): # access docs based on language if language == 'python' or language == 'python3': full_link = 'https://docs.python.org/3/genindex-all.html' page = requests.get(full_link).content soup = BeautifulSoup(page, 'html.parser') link_descriptions = [] for link in soup.findAll('a'): if query in link.contents[0]: link_descriptions.append(f"[{link.contents[0]}](https://docs.python.org/3/{link['href']})") link_descriptions = list(dict.fromkeys(link_descriptions)) link_descriptions = link_descriptions[:10] ### TODO: multi-lingual docs support (devdocs.io?) ### TODO: faster searching (current 4-5 secs) ### TODO: filter results -> currently only pick top ten, and there are some odd results as well embed = discord.Embed(title="Python 3 Docs", color = 0x00ff00) embed.add_field(name=f'{len(link_descriptions)} results found for `{query}` :', value='\n'.join( link_descriptions), inline=False) embed.set_thumbnail(url= 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/240px-Python-logo-notext.svg.png') await ctx.send(embed=embed) @commands.command(name='github', brief = 'view top 10 daily github repos', description = 'see the names and descriptions of the top x github repos today with `.github x` (default 10)', aliases=['gh']) async def github(self, ctx, amount: int = 10): '''Gets the GitHub first < amount > repositories without embeds''' page = requests.get( 'https://github-trending-api.now.sh/repositories?q=sort=stars&order=desc&since=daily') response = [ f"{entry['description']}: {'<' + entry['url'] + '>'}\n" for entry in page.json()[:amount]] embed = discord.Embed( title=f"**GitHub's top {str(amount)} today**", description='\n'.join(response), color=0x00ff00) await ctx.send(embed=embed)
[ 1, 529, 9507, 29958, 4351, 29914, 29907, 12099, 29914, 3401, 29907, 468, 29889, 2272, 13, 3166, 2313, 536, 29889, 1062, 1053, 8260, 13, 5215, 2313, 536, 13, 13, 5215, 7274, 13, 3166, 24512, 29946, 1053, 25685, 29903, 1132, 13, 13, 29937, 664, 297, 6728, 29991, 901, 10276, 12853, 29991, 13, 1990, 22140, 29907, 468, 29898, 26381, 29889, 29907, 468, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9225, 1125, 13, 4706, 1583, 29889, 7451, 353, 9225, 13, 13, 1678, 732, 26381, 29889, 6519, 29898, 978, 353, 525, 2640, 742, 11473, 353, 525, 28426, 4086, 5106, 742, 6139, 353, 525, 12663, 363, 10276, 29892, 2130, 491, 5432, 5050, 2640, 529, 11675, 29958, 529, 1972, 13885, 742, 14430, 2129, 353, 6024, 12663, 742, 525, 3888, 11287, 13, 1678, 7465, 822, 10561, 29898, 1311, 29892, 12893, 29892, 4086, 29901, 851, 29892, 2346, 1125, 13, 4706, 396, 2130, 10561, 2729, 373, 4086, 13, 13, 4706, 565, 4086, 1275, 525, 4691, 29915, 470, 4086, 1275, 525, 4691, 29941, 2396, 13, 9651, 2989, 29918, 2324, 353, 525, 991, 597, 2640, 29889, 4691, 29889, 990, 29914, 29941, 29914, 1885, 2248, 29899, 497, 29889, 1420, 29915, 13, 9651, 1813, 353, 7274, 29889, 657, 29898, 8159, 29918, 2324, 467, 3051, 13, 9651, 22300, 353, 25685, 29903, 1132, 29898, 3488, 29892, 525, 1420, 29889, 16680, 1495, 13, 13, 9651, 1544, 29918, 2783, 699, 1980, 353, 5159, 13, 13, 9651, 363, 1544, 297, 22300, 29889, 2886, 3596, 877, 29874, 29374, 13, 18884, 565, 2346, 297, 1544, 29889, 10853, 29961, 29900, 5387, 13, 462, 1678, 1544, 29918, 2783, 699, 1980, 29889, 4397, 29898, 29888, 29908, 19660, 2324, 29889, 10853, 29961, 29900, 12258, 850, 991, 597, 2640, 29889, 4691, 29889, 990, 29914, 29941, 19248, 2324, 1839, 12653, 2033, 1800, 1159, 13, 13, 9651, 1544, 29918, 2783, 699, 1980, 353, 1051, 29898, 8977, 29889, 3166, 8149, 29898, 2324, 29918, 2783, 699, 1980, 876, 13, 9651, 1544, 29918, 2783, 699, 1980, 353, 1544, 29918, 2783, 699, 1980, 7503, 29896, 29900, 29962, 13, 13, 9651, 835, 14402, 29901, 2473, 29899, 1847, 950, 10561, 2304, 313, 3359, 2640, 29889, 601, 7897, 13, 9651, 835, 14402, 29901, 8473, 11975, 313, 3784, 29871, 29946, 29899, 29945, 409, 2395, 29897, 13, 9651, 835, 14402, 29901, 4175, 2582, 1599, 5279, 871, 5839, 2246, 3006, 29892, 322, 727, 526, 777, 7736, 2582, 408, 1532, 13, 13, 9651, 8297, 353, 2313, 536, 29889, 6026, 2580, 29898, 3257, 543, 11980, 29871, 29941, 360, 12332, 613, 2927, 353, 29871, 29900, 29916, 29900, 29900, 600, 29900, 29900, 29897, 13, 9651, 8297, 29889, 1202, 29918, 2671, 29898, 978, 29922, 29888, 29915, 29912, 2435, 29898, 2324, 29918, 2783, 699, 1980, 2915, 2582, 1476, 363, 23230, 1972, 10114, 584, 742, 995, 2433, 29905, 29876, 4286, 7122, 29898, 13, 18884, 1544, 29918, 2783, 699, 1980, 511, 10583, 29922, 8824, 29897, 13, 9651, 8297, 29889, 842, 29918, 386, 21145, 29898, 2271, 29922, 13, 18884, 525, 991, 597, 9009, 29889, 2851, 3393, 29889, 990, 29914, 6011, 29914, 22382, 29914, 386, 3774, 29914, 29883, 29914, 29883, 29941, 29914, 11980, 29899, 14569, 29899, 6812, 486, 29889, 15120, 29914, 29906, 29946, 29900, 1756, 29899, 11980, 29899, 14569, 29899, 6812, 486, 29889, 15120, 29889, 2732, 1495, 13, 13, 9651, 7272, 12893, 29889, 6717, 29898, 17987, 29922, 17987, 29897, 13, 13, 1678, 732, 26381, 29889, 6519, 29898, 978, 2433, 3292, 742, 11473, 353, 525, 1493, 2246, 29871, 29896, 29900, 14218, 18546, 17573, 742, 6139, 353, 525, 4149, 278, 2983, 322, 2342, 1980, 310, 278, 2246, 921, 18546, 17573, 9826, 411, 5050, 3292, 921, 29952, 313, 4381, 29871, 29896, 29900, 29897, 742, 14430, 2129, 29922, 1839, 12443, 11287, 13, 1678, 7465, 822, 18546, 29898, 1311, 29892, 12893, 29892, 5253, 29901, 938, 353, 29871, 29896, 29900, 1125, 13, 4706, 14550, 29954, 1691, 278, 25492, 937, 529, 5253, 1405, 28914, 1728, 8297, 29879, 12008, 13, 4706, 1813, 353, 7274, 29889, 657, 29898, 13, 9651, 525, 991, 597, 3292, 29899, 509, 2548, 29899, 2754, 29889, 3707, 29889, 845, 29914, 276, 1066, 20106, 29973, 29939, 29922, 6605, 29922, 303, 1503, 29987, 2098, 29922, 14273, 29987, 16076, 29922, 29881, 8683, 1495, 13, 4706, 2933, 353, 518, 13, 9651, 285, 29908, 29912, 8269, 1839, 8216, 2033, 6177, 11117, 26717, 718, 6251, 1839, 2271, 2033, 718, 525, 16299, 1012, 29876, 29908, 363, 6251, 297, 1813, 29889, 3126, 580, 7503, 14506, 5262, 13, 4706, 8297, 353, 2313, 536, 29889, 6026, 2580, 29898, 13, 9651, 3611, 29922, 29888, 29908, 1068, 28712, 16046, 29915, 29879, 2246, 426, 710, 29898, 14506, 2915, 9826, 1068, 613, 6139, 2433, 29905, 29876, 4286, 7122, 29898, 5327, 511, 2927, 29922, 29900, 29916, 29900, 29900, 600, 29900, 29900, 29897, 13, 4706, 7272, 12893, 29889, 6717, 29898, 17987, 29922, 17987, 29897, 13, 2 ]
app/__init__.py
ednilsonlomazi/AnonymousRepSys-API
0
104424
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from flask import Flask app = Flask(__name__) app.config['SECRET_KEY'] = 'uma-string-muito-segura' app.config['DEBUG'] = True engine = create_engine('mysql+pymysql://admdenuncia:adm-senha@localhost/denuncia', echo=True) Session = sessionmaker(bind=engine) session = Session() Base = declarative_base() MAX_CHAR_TEXTO = 10000 from app.controllers import default
[ 1, 515, 4576, 284, 305, 6764, 1053, 1653, 29918, 10599, 13, 3166, 4576, 284, 305, 6764, 29889, 1062, 29889, 311, 16544, 1230, 1053, 7669, 1230, 29918, 3188, 13, 3166, 4576, 284, 305, 6764, 29889, 555, 1053, 4867, 28107, 13, 3166, 29784, 1053, 2379, 1278, 13, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 29871, 13, 932, 29889, 2917, 1839, 1660, 22245, 29911, 29918, 10818, 2033, 353, 525, 10859, 29899, 1807, 29899, 2589, 2049, 29899, 10199, 2002, 29915, 13, 932, 29889, 2917, 1839, 18525, 2033, 353, 5852, 13, 13, 13, 10599, 353, 1653, 29918, 10599, 877, 7938, 29974, 29886, 962, 952, 1519, 597, 328, 29885, 1145, 28027, 29901, 328, 29885, 29899, 4881, 2350, 29992, 7640, 29914, 1145, 28027, 742, 2916, 29922, 5574, 29897, 13, 7317, 353, 4867, 28107, 29898, 5355, 29922, 10599, 29897, 13, 7924, 353, 16441, 580, 13, 5160, 353, 7669, 1230, 29918, 3188, 580, 13, 13, 12648, 29918, 11282, 29918, 4330, 29990, 4986, 353, 29871, 29896, 29900, 29900, 29900, 29900, 13, 13, 3166, 623, 29889, 1285, 11897, 1053, 2322, 13, 2 ]
pywren/pywren_ibm_cloud/invokers.py
thetolga/pywren-ibm-cloud
0
5617
# # Copyright 2018 PyWren Team # # 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 time import logging import random from pywren_ibm_cloud.cf_connector import CloudFunctions logger = logging.getLogger(__name__) class IBMCloudFunctionsInvoker: def __init__(self, cf_config, retry_config): self.namespace = cf_config['namespace'] self.endpoint = cf_config['endpoint'] self.cf_action_name = cf_config['action_name'] # Runtime self.invocation_retry = retry_config['invocation_retry'] self.retry_sleeps = retry_config['retry_sleeps'] self.retries = retry_config['retries'] self.client = CloudFunctions(cf_config) log_msg = 'IBM Cloud Functions init for {}'.format(self.cf_action_name) logger.info(log_msg) if(logger.getEffectiveLevel() == logging.WARNING): print(log_msg) def invoke(self, payload): """ Invoke -- return information about this invocation """ act_id = self.client.invoke(self.cf_action_name, payload) attempts = 1 while not act_id and self.invocation_retry and attempts < self.retries: attempts += 1 selected_sleep = random.choice(self.retry_sleeps) exec_id = payload['executor_id'] call_id = payload['call_id'] log_msg = ('Executor ID {} Function {} - Invocation failed - retry {} in {} seconds'.format(exec_id, call_id, attempts, selected_sleep)) logger.debug(log_msg) time.sleep(selected_sleep) act_id = self.client.invoke(self.cf_action_name, payload) return act_id def config(self): """ Return config dict """ return {'cf_action_name': self.cf_action_name, 'cf_namespace': self.namespace, 'cf_endpoint': self.endpoint}
[ 1, 396, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29947, 10772, 29956, 1267, 8583, 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, 13, 5215, 931, 13, 5215, 12183, 13, 5215, 4036, 13, 3166, 282, 5693, 1267, 29918, 29690, 29918, 9274, 29889, 6854, 29918, 11958, 2801, 1053, 14293, 6678, 29879, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 27955, 20442, 6678, 29879, 12165, 17933, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 274, 29888, 29918, 2917, 29892, 337, 2202, 29918, 2917, 1125, 13, 4706, 1583, 29889, 22377, 353, 274, 29888, 29918, 2917, 1839, 22377, 2033, 13, 4706, 1583, 29889, 29734, 353, 274, 29888, 29918, 2917, 1839, 29734, 2033, 13, 4706, 1583, 29889, 6854, 29918, 2467, 29918, 978, 353, 274, 29888, 29918, 2917, 1839, 2467, 29918, 978, 2033, 29871, 396, 24875, 13, 4706, 1583, 29889, 11569, 10610, 29918, 276, 2202, 353, 337, 2202, 29918, 2917, 1839, 11569, 10610, 29918, 276, 2202, 2033, 13, 4706, 1583, 29889, 276, 2202, 29918, 29879, 280, 8961, 353, 337, 2202, 29918, 2917, 1839, 276, 2202, 29918, 29879, 280, 8961, 2033, 13, 4706, 1583, 29889, 2267, 2722, 353, 337, 2202, 29918, 2917, 1839, 2267, 2722, 2033, 13, 4706, 1583, 29889, 4645, 353, 14293, 6678, 29879, 29898, 6854, 29918, 2917, 29897, 13, 13, 4706, 1480, 29918, 7645, 353, 525, 8979, 29924, 14293, 6680, 29879, 2069, 363, 6571, 4286, 4830, 29898, 1311, 29889, 6854, 29918, 2467, 29918, 978, 29897, 13, 4706, 17927, 29889, 3888, 29898, 1188, 29918, 7645, 29897, 13, 4706, 565, 29898, 21707, 29889, 657, 13971, 573, 10108, 580, 1275, 12183, 29889, 29956, 25614, 1125, 13, 9651, 1596, 29898, 1188, 29918, 7645, 29897, 13, 13, 1678, 822, 15928, 29898, 1311, 29892, 20092, 1125, 13, 4706, 9995, 13, 4706, 512, 5744, 1192, 736, 2472, 1048, 445, 2437, 10610, 13, 4706, 9995, 539, 13, 4706, 1044, 29918, 333, 353, 1583, 29889, 4645, 29889, 9772, 29898, 1311, 29889, 6854, 29918, 2467, 29918, 978, 29892, 20092, 29897, 13, 4706, 14734, 353, 29871, 29896, 13, 308, 13, 4706, 1550, 451, 1044, 29918, 333, 322, 1583, 29889, 11569, 10610, 29918, 276, 2202, 322, 14734, 529, 1583, 29889, 2267, 2722, 29901, 13, 9651, 14734, 4619, 29871, 29896, 13, 9651, 4629, 29918, 17059, 353, 4036, 29889, 16957, 29898, 1311, 29889, 276, 2202, 29918, 29879, 280, 8961, 29897, 13, 9651, 2279, 29918, 333, 353, 20092, 1839, 4258, 3406, 29918, 333, 2033, 13, 9651, 1246, 29918, 333, 353, 20092, 1839, 4804, 29918, 333, 2033, 13, 632, 13, 9651, 1480, 29918, 7645, 353, 6702, 13366, 3553, 6571, 6680, 6571, 448, 15518, 10610, 5229, 448, 337, 2202, 6571, 297, 6571, 6923, 4286, 4830, 29898, 4258, 29918, 333, 29892, 1246, 29918, 333, 29892, 14734, 29892, 4629, 29918, 17059, 876, 13, 9651, 17927, 29889, 8382, 29898, 1188, 29918, 7645, 29897, 13, 632, 13, 9651, 931, 29889, 17059, 29898, 8391, 29918, 17059, 29897, 13, 9651, 1044, 29918, 333, 353, 1583, 29889, 4645, 29889, 9772, 29898, 1311, 29889, 6854, 29918, 2467, 29918, 978, 29892, 20092, 29897, 13, 13, 4706, 736, 1044, 29918, 333, 13, 13, 1678, 822, 2295, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 7106, 2295, 9657, 13, 4706, 9995, 13, 4706, 736, 11117, 6854, 29918, 2467, 29918, 978, 2396, 1583, 29889, 6854, 29918, 2467, 29918, 978, 29892, 13, 18884, 525, 6854, 29918, 22377, 2396, 1583, 29889, 22377, 29892, 13, 18884, 525, 6854, 29918, 29734, 2396, 1583, 29889, 29734, 29913, 13, 2 ]
utils.py
KiranRaghavendra1248/Yolo-v3
0
127551
from __future__ import division import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np import cv2 # Note origin is top-left corner of the image # Formula for bx,by,bh,w # bx=sigmoid(tx)+cx , by=sigmoid(ty)+cy # where tx,ty is prediction of NN and cx,cy is the origin # i.e top left corner of present grid cell #bw=pw*exp(tw), bh=ph*exp(th) # where tw,th is prediction of NN # pw,ph is height and width of predefined bounding box def letterbox_image(img, inp_dim): '''resize image with unchanged aspect ratio using padding''' img_w, img_h = img.shape[1], img.shape[0] w,h = inp_dim new_w = int(img_w * min(torch.true_divide(w ,img_w), torch.true_divide(h, img_h))) new_h = int(img_h * min(torch.true_divide(w ,img_w), torch.true_divide(h, img_h))) resized_image = cv2.resize(img, (new_w, new_h), interpolation=cv2.INTER_CUBIC) canvas = np.full((inp_dim[1], inp_dim[0], 3), 128) canvas[(h - new_h) // 2:(h - new_h) // 2 + new_h, (w - new_w) // 2:(w - new_w) // 2 + new_w, :] = resized_image return canvas def prep_image(img, inp_dim): """ Prepare image for inputting to the neural network. Here img , in_dim both are single values which are fed one by one to this fun by the map function Returns a Variable """ img = letterbox_image(img, inp_dim) img = img[:, :, ::-1].transpose((2, 0, 1)).copy() img = torch.from_numpy(img).float().div(255.0).unsqueeze(0) return img def load_classes(namesfile): fp = open(namesfile, "r") names = fp.read().split("\n")[:-1] return names def bbox_iou(box1, box2): """ Returns the IoU of two bounding boxes Note: box1 contains bbx attributes of 1 bbx box2 contains bbx attributes of all other bbx """ # Get the coordinates of bounding boxes b1_x1, b1_y1, b1_x2, b1_y2 = box1[:, 0], box1[:, 1], box1[:, 2], box1[:, 3] b2_x1, b2_y1, b2_x2, b2_y2 = box2[:, 0], box2[:, 1], box2[:, 2], box2[:, 3] # get the corrdinates of the intersection rectangle inter_rect_x1 = torch.max(b1_x1, b2_x1) inter_rect_y1 = torch.max(b1_y1, b2_y1) inter_rect_x2 = torch.min(b1_x2, b2_x2) inter_rect_y2 = torch.min(b1_y2, b2_y2) # Intersection area inter_area = torch.clamp(inter_rect_x2 - inter_rect_x1 + 1, min=0) * torch.clamp(inter_rect_y2 - inter_rect_y1 + 1, min=0) # Union Area b1_area = (b1_x2 - b1_x1 + 1) * (b1_y2 - b1_y1 + 1) b2_area = (b2_x2 - b2_x1 + 1) * (b2_y2 - b2_y1 + 1) iou = inter_area / (b1_area + b2_area - inter_area) return iou def predict_transform(prediction, inp_dim, anchors, num_classes, CUDA = True): # predict_transform takes in 5 parameters; # prediction (our output), inp_dim (input image dimension), # anchors, num_classes, and an optional CUDA flag batch_size = prediction.size(0) stride = inp_dim // prediction.size(2) grid_size = inp_dim // stride bbox_attrs = 5 + num_classes # 5 + 80 num_anchors = len(anchors) # 3 # There is [13,13] grid and each grid, at a particular scale # Outputs 3 bounding boxes. # Total bounding boxes= 13 * 13 * 3 = 507 # Bounding box attributes= 5 + C = 85 #[1, 255, 13, 13] prediction = prediction.view(batch_size, bbox_attrs * num_anchors, grid_size * grid_size) #[1, 255, 169] prediction = prediction.transpose(1, 2).contiguous() #[1, 169, 255] prediction = prediction.view(batch_size, grid_size * grid_size * num_anchors, bbox_attrs) #[1, 507, 85] anchors = [(a[0] / stride, a[1] / stride) for a in anchors] #Sigmoid the centre_X, centre_Y. and object confidencce prediction[:,:,0] = torch.sigmoid(prediction[:,:,0]) prediction[:,:,1] = torch.sigmoid(prediction[:,:,1]) prediction[:,:,4] = torch.sigmoid(prediction[:,:,4]) #Add the center offsets grid = np.arange(grid_size) a,b = np.meshgrid(grid, grid) #[13,13] x_offset = torch.FloatTensor(a).view(-1,1) #[169,1] y_offset = torch.FloatTensor(b).view(-1,1) #[169,1] if CUDA: x_offset = x_offset.cuda() y_offset = y_offset.cuda() # Here this is what happens # [169,1],[169,1]--cat--> [169,2]--repeat-->[169,6]--view--> # [507,2]--unsqueeze-->[1,507,2] x_y_offset = torch.cat((x_offset, y_offset), 1).repeat(1,num_anchors).view(-1,2).unsqueeze(0) prediction[:,:,:2] += x_y_offset # Log space transform height and the width # Anchors are a tensor where each element is a tuple h,w anchors = torch.FloatTensor(anchors) if CUDA: anchors = anchors.cuda() # This is what happens here # [3, 2]--repeat-->[507, 2]--unsqueeze-->[1,507,2] anchors = anchors.repeat(grid_size*grid_size, 1).unsqueeze(0) prediction[:,:,2:4] = torch.exp(prediction[:,:,2:4])*anchors # Apply sigmoid activation to the the class scores prediction[:, :, 5: 5 + num_classes] = torch.sigmoid((prediction[:, :, 5: 5 + num_classes])) # Resize the detections map to the size of the input image prediction[:, :, :4] *= stride return prediction def write_results(prediction, confidence, num_classes, nms_conf = 0.4): # Object Confidence Thresholding conf_mask = (prediction[:, :, 4] > confidence).float().unsqueeze(2) prediction = prediction * conf_mask # Performing Non-maximum Suppression box_corner = prediction.new(prediction.shape) box_corner[:,:,0] = (prediction[:,:,0] - prediction[:,:,2]/2) box_corner[:,:,1] = (prediction[:,:,1] - prediction[:,:,3]/2) box_corner[:,:,2] = (prediction[:,:,0] + prediction[:,:,2]/2) box_corner[:,:,3] = (prediction[:,:,1] + prediction[:,:,3]/2) prediction[:,:,:4] = box_corner[:,:,:4] batch_size = prediction.size(0) write = False for ind in range(batch_size): image_pred = prediction[ind] #image_pred is now 2D tensor #confidence threshholding #NMS # At this point, we're only concerned with the class score # having the maximum value. So, we remove the 80 class scores # from each row, and instead add the index of the class having # the maximum values, as well the class score of that class. max_conf, max_conf_score = torch.max(image_pred[:, 5:5 + num_classes], 1) # torch.max() returns max value and the index where max exists max_conf = max_conf.float().unsqueeze(1) max_conf_score = max_conf_score.float().unsqueeze(1) # concatinating index values and max probability with box coordinates as columns seq = (image_pred[:, :5], max_conf, max_conf_score) image_pred = torch.cat(seq, 1) # Now image_pred dim is [num_bbox,7] # We have set bounding box attributes of those boxes with objectness # score less than the threshold as zero. Now we will remove them. non_zero_ind = (torch.nonzero(image_pred[:, 4])) try: image_pred_ = image_pred[non_zero_ind.squeeze(), :].view(-1, 7) except: continue # For PyTorch 0.4 compatibility # Since the above code with not raise exception for no detection # as scalars are supported in PyTorch 0.4 if image_pred_.shape[0] == 0: continue # The try-except block is there to handle situations where # we get no detections. In that case, we use continue to skip # the rest of the loop body for this image. # Get the various classes detected in the image try: img_classes = torch.unique(image_pred_[:, -1]) # -1 index holds the class index except: continue for cls in img_classes: # perform NMS # get the detections with one particular class cls_mask = image_pred_ * (image_pred_[:, -1] == cls).float().unsqueeze(1) # Unsqueeze is used as broadcasting b/w vector and matrix is not possible # Hence we make the vector a matrix using unsqueeze # Tensors are broadcastable if # When iterating over the dimension sizes, starting at the trailing dimension, # the dimension sizes must either be equal, one of them is 1, # or one of them does not exist. # Now cls_mask dim=[num_bbx,7] # Basically now all bbx attributes are zero for those bbxs which # doesnt contain present class class_mask_ind = torch.nonzero(cls_mask[:, -2]).squeeze() image_pred_class = image_pred_[class_mask_ind].view(-1, 7) # sort the detections such that the entry with the maximum objectness # confidence is at the top sorted_, conf_sort_index = torch.sort(image_pred_class[:, 4], descending=True) image_pred_class = image_pred_class[conf_sort_index] idx = image_pred_class.size(0) # Number of detections for i in range(idx): # Get the IOUs of all boxes that come after the one we are looking at # in the loop try: ious = bbox_iou(image_pred_class[i].unsqueeze(0), image_pred_class[i + 1:]) except ValueError: break except IndexError: break # Zero out all the detections that have IoU > treshhold iou_mask = (ious < nms_conf).float().unsqueeze(1) image_pred_class[i + 1:] *= iou_mask # Remove the non-zero entries non_zero_ind = torch.nonzero(image_pred_class[:, 4]).squeeze() image_pred_class = image_pred_class[non_zero_ind].view(-1, 7) # We use the write flag to indicate whether the tensor has been initialized # or not. Once it has been initialized, we concatenate subsequent detections to it. # At the end of loop that iterates over classes, we add the resultant # detections to the tensor output. #Concatenate the batch_id of the image to the detection #this helps us identify which image does the detection correspond to #We use a linear structure to hold ALL the detections from the batch #the batch_dim is flattened #batch is identified by extra batch column batch_ind = image_pred_class.new(image_pred_class.size(0), 1).fill_(ind) # Repeat the batch_id for as many detections of the class cls in the image seq = batch_ind, image_pred_class if not write: output = torch.cat(seq, 1) write = True else: out = torch.cat(seq, 1) output = torch.cat((output, out)) # At the end of the function, we check whether output has been initialized at all or not. # If it hasn't been means there's hasn't been a single detection in any images of the batch. # In that case, we return 0. try: return output except: return 0
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8542, 30004, 13, 30004, 13, 5215, 4842, 305, 30004, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 30004, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 30004, 13, 3166, 4842, 305, 29889, 1300, 468, 3665, 1053, 28736, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 13850, 29906, 30004, 13, 30004, 13, 29937, 3940, 3978, 338, 2246, 29899, 1563, 11155, 310, 278, 1967, 30004, 13, 29937, 25515, 363, 289, 29916, 29892, 1609, 29892, 29890, 29882, 29892, 29893, 30004, 13, 30004, 13, 29937, 289, 29916, 29922, 18816, 29885, 3398, 29898, 7508, 7240, 18904, 1919, 491, 29922, 18816, 29885, 3398, 29898, 1017, 7240, 1270, 30004, 13, 29937, 988, 25568, 29892, 1017, 338, 18988, 310, 405, 29940, 322, 28232, 29892, 1270, 338, 278, 3978, 30004, 13, 29937, 474, 29889, 29872, 2246, 2175, 11155, 310, 2198, 6856, 3038, 30004, 13, 30004, 13, 29937, 29890, 29893, 29922, 29886, 29893, 29930, 4548, 29898, 7516, 511, 289, 29882, 29922, 561, 29930, 4548, 29898, 386, 8443, 13, 29937, 988, 3252, 29892, 386, 338, 18988, 310, 405, 29940, 30004, 13, 29937, 282, 29893, 29892, 561, 338, 3171, 322, 2920, 310, 758, 12119, 3216, 292, 3800, 30004, 13, 30004, 13, 30004, 13, 1753, 5497, 1884, 29918, 3027, 29898, 2492, 29892, 297, 29886, 29918, 6229, 1125, 30004, 13, 1678, 14550, 21476, 1967, 411, 443, 15033, 9565, 11959, 773, 7164, 12008, 30004, 13, 1678, 10153, 29918, 29893, 29892, 10153, 29918, 29882, 353, 10153, 29889, 12181, 29961, 29896, 1402, 10153, 29889, 12181, 29961, 29900, 29962, 30004, 13, 1678, 281, 29892, 29882, 353, 297, 29886, 29918, 6229, 30004, 13, 1678, 716, 29918, 29893, 353, 938, 29898, 2492, 29918, 29893, 334, 1375, 29898, 7345, 305, 29889, 3009, 29918, 4563, 680, 29898, 29893, 1919, 2492, 29918, 29893, 511, 4842, 305, 29889, 3009, 29918, 4563, 680, 29898, 29882, 29892, 10153, 29918, 29882, 4961, 30004, 13, 1678, 716, 29918, 29882, 353, 938, 29898, 2492, 29918, 29882, 334, 1375, 29898, 7345, 305, 29889, 3009, 29918, 4563, 680, 29898, 29893, 1919, 2492, 29918, 29893, 511, 4842, 305, 29889, 3009, 29918, 4563, 680, 29898, 29882, 29892, 10153, 29918, 29882, 4961, 30004, 13, 1678, 620, 1891, 29918, 3027, 353, 13850, 29906, 29889, 21476, 29898, 2492, 29892, 313, 1482, 29918, 29893, 29892, 716, 29918, 29882, 511, 29694, 29922, 11023, 29906, 29889, 23845, 29918, 29907, 7466, 2965, 8443, 13, 30004, 13, 1678, 10508, 353, 7442, 29889, 8159, 3552, 262, 29886, 29918, 6229, 29961, 29896, 1402, 297, 29886, 29918, 6229, 29961, 29900, 1402, 29871, 29941, 511, 29871, 29896, 29906, 29947, 8443, 13, 30004, 13, 1678, 10508, 15625, 29882, 448, 716, 29918, 29882, 29897, 849, 29871, 29906, 5919, 29882, 448, 716, 29918, 29882, 29897, 849, 29871, 29906, 718, 716, 29918, 29882, 29892, 313, 29893, 448, 716, 29918, 29893, 29897, 849, 29871, 29906, 5919, 29893, 448, 716, 29918, 29893, 29897, 849, 29871, 29906, 718, 716, 29918, 29893, 29892, 584, 29962, 353, 620, 1891, 29918, 3027, 30004, 13, 30004, 13, 1678, 736, 10508, 30004, 13, 30004, 13, 1753, 8273, 29918, 3027, 29898, 2492, 29892, 297, 29886, 29918, 6229, 1125, 30004, 13, 1678, 9995, 30004, 13, 1678, 349, 3445, 598, 1967, 363, 1881, 1259, 304, 278, 19677, 3564, 22993, 13, 1678, 2266, 10153, 1919, 297, 29918, 6229, 29871, 1716, 526, 2323, 1819, 607, 526, 21242, 697, 491, 697, 304, 445, 2090, 30004, 13, 1678, 491, 278, 2910, 740, 30004, 13, 1678, 16969, 263, 28736, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 10153, 353, 5497, 1884, 29918, 3027, 29898, 2492, 29892, 297, 29886, 29918, 6229, 8443, 13, 1678, 10153, 353, 10153, 7503, 29892, 584, 29892, 4761, 29899, 29896, 1822, 3286, 4220, 3552, 29906, 29892, 29871, 29900, 29892, 29871, 29896, 8106, 8552, 26471, 13, 1678, 10153, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 2492, 467, 7411, 2141, 4563, 29898, 29906, 29945, 29945, 29889, 29900, 467, 6948, 802, 29872, 911, 29898, 29900, 8443, 13, 1678, 736, 10153, 30004, 13, 30004, 13, 1753, 2254, 29918, 13203, 29898, 7039, 1445, 1125, 30004, 13, 1678, 285, 29886, 353, 1722, 29898, 7039, 1445, 29892, 376, 29878, 1159, 30004, 13, 1678, 2983, 353, 285, 29886, 29889, 949, 2141, 5451, 14182, 29876, 1159, 7503, 29899, 29896, 29962, 30004, 13, 1678, 736, 2983, 30004, 13, 30004, 13, 1753, 289, 1884, 29918, 29875, 283, 29898, 1884, 29896, 29892, 3800, 29906, 1125, 30004, 13, 1678, 9995, 30004, 13, 1678, 16969, 278, 22244, 29965, 310, 1023, 3216, 292, 16273, 30004, 13, 1678, 3940, 29901, 30004, 13, 4706, 3800, 29896, 3743, 289, 29890, 29916, 8393, 310, 29871, 29896, 289, 29890, 29916, 30004, 13, 4706, 3800, 29906, 3743, 289, 29890, 29916, 8393, 310, 599, 916, 289, 29890, 29916, 30004, 13, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 396, 3617, 278, 10350, 310, 3216, 292, 16273, 30004, 13, 1678, 289, 29896, 29918, 29916, 29896, 29892, 289, 29896, 29918, 29891, 29896, 29892, 289, 29896, 29918, 29916, 29906, 29892, 289, 29896, 29918, 29891, 29906, 353, 3800, 29896, 7503, 29892, 29871, 29900, 1402, 3800, 29896, 7503, 29892, 29871, 29896, 1402, 3800, 29896, 7503, 29892, 29871, 29906, 1402, 3800, 29896, 7503, 29892, 29871, 29941, 29962, 30004, 13, 1678, 289, 29906, 29918, 29916, 29896, 29892, 289, 29906, 29918, 29891, 29896, 29892, 289, 29906, 29918, 29916, 29906, 29892, 289, 29906, 29918, 29891, 29906, 353, 3800, 29906, 7503, 29892, 29871, 29900, 1402, 3800, 29906, 7503, 29892, 29871, 29896, 1402, 3800, 29906, 7503, 29892, 29871, 29906, 1402, 3800, 29906, 7503, 29892, 29871, 29941, 29962, 30004, 13, 30004, 13, 1678, 396, 679, 278, 1034, 5499, 262, 1078, 310, 278, 17686, 16701, 30004, 13, 1678, 1006, 29918, 1621, 29918, 29916, 29896, 353, 4842, 305, 29889, 3317, 29898, 29890, 29896, 29918, 29916, 29896, 29892, 289, 29906, 29918, 29916, 29896, 8443, 13, 1678, 1006, 29918, 1621, 29918, 29891, 29896, 353, 4842, 305, 29889, 3317, 29898, 29890, 29896, 29918, 29891, 29896, 29892, 289, 29906, 29918, 29891, 29896, 8443, 13, 1678, 1006, 29918, 1621, 29918, 29916, 29906, 353, 4842, 305, 29889, 1195, 29898, 29890, 29896, 29918, 29916, 29906, 29892, 289, 29906, 29918, 29916, 29906, 8443, 13, 1678, 1006, 29918, 1621, 29918, 29891, 29906, 353, 4842, 305, 29889, 1195, 29898, 29890, 29896, 29918, 29891, 29906, 29892, 289, 29906, 29918, 29891, 29906, 8443, 13, 30004, 13, 1678, 396, 4124, 2042, 4038, 30004, 13, 1678, 1006, 29918, 6203, 353, 4842, 305, 29889, 695, 1160, 29898, 1639, 29918, 1621, 29918, 29916, 29906, 448, 1006, 29918, 1621, 29918, 29916, 29896, 718, 29871, 29896, 29892, 1375, 29922, 29900, 29897, 334, 4842, 305, 29889, 695, 1160, 29898, 1639, 29918, 1621, 29918, 29891, 29906, 448, 1006, 29918, 1621, 29918, 29891, 29896, 718, 29871, 29896, 11167, 13, 462, 462, 462, 462, 462, 268, 1375, 29922, 29900, 8443, 13, 30004, 13, 1678, 396, 7761, 18320, 30004, 13, 1678, 289, 29896, 29918, 6203, 353, 313, 29890, 29896, 29918, 29916, 29906, 448, 289, 29896, 29918, 29916, 29896, 718, 29871, 29896, 29897, 334, 313, 29890, 29896, 29918, 29891, 29906, 448, 289, 29896, 29918, 29891, 29896, 718, 29871, 29896, 8443, 13, 1678, 289, 29906, 29918, 6203, 353, 313, 29890, 29906, 29918, 29916, 29906, 448, 289, 29906, 29918, 29916, 29896, 718, 29871, 29896, 29897, 334, 313, 29890, 29906, 29918, 29891, 29906, 448, 289, 29906, 29918, 29891, 29896, 718, 29871, 29896, 8443, 13, 30004, 13, 1678, 474, 283, 353, 1006, 29918, 6203, 847, 313, 29890, 29896, 29918, 6203, 718, 289, 29906, 29918, 6203, 448, 1006, 29918, 6203, 8443, 13, 30004, 13, 1678, 736, 474, 283, 30004, 13, 30004, 13, 1753, 8500, 29918, 9067, 29898, 11965, 2463, 29892, 297, 29886, 29918, 6229, 29892, 23791, 943, 29892, 954, 29918, 13203, 29892, 315, 29965, 7698, 353, 5852, 1125, 30004, 13, 1678, 396, 8500, 29918, 9067, 4893, 297, 29871, 29945, 4128, 2104, 13, 1678, 396, 18988, 313, 473, 1962, 511, 297, 29886, 29918, 6229, 313, 2080, 1967, 9927, 511, 30004, 13, 1678, 396, 23791, 943, 29892, 954, 29918, 13203, 29892, 322, 385, 13136, 315, 29965, 7698, 7353, 30004, 13, 1678, 9853, 29918, 2311, 353, 18988, 29889, 2311, 29898, 29900, 8443, 13, 1678, 380, 2426, 353, 297, 29886, 29918, 6229, 849, 18988, 29889, 2311, 29898, 29906, 8443, 13, 1678, 6856, 29918, 2311, 353, 297, 29886, 29918, 6229, 849, 380, 2426, 30004, 13, 1678, 289, 1884, 29918, 5552, 29879, 353, 29871, 29945, 718, 954, 29918, 13203, 29871, 396, 29871, 29945, 718, 29871, 29947, 29900, 30004, 13, 1678, 954, 29918, 14588, 943, 353, 7431, 29898, 14588, 943, 29897, 1678, 396, 29871, 29941, 30004, 13, 1678, 396, 1670, 338, 518, 29896, 29941, 29892, 29896, 29941, 29962, 6856, 322, 1269, 6856, 29892, 472, 263, 3153, 6287, 30004, 13, 1678, 396, 10604, 29879, 29871, 29941, 3216, 292, 16273, 22993, 13, 1678, 396, 14990, 3216, 292, 16273, 29922, 29871, 29896, 29941, 334, 29871, 29896, 29941, 334, 29871, 29941, 353, 29871, 29945, 29900, 29955, 30004, 13, 1678, 396, 350, 12449, 3800, 8393, 29922, 29871, 29945, 718, 315, 353, 29871, 29947, 29945, 30004, 13, 1678, 14330, 29896, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29941, 29962, 30004, 13, 1678, 18988, 353, 18988, 29889, 1493, 29898, 16175, 29918, 2311, 29892, 289, 1884, 29918, 5552, 29879, 334, 954, 29918, 14588, 943, 29892, 6856, 29918, 2311, 334, 6856, 29918, 2311, 8443, 13, 1678, 14330, 29896, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29896, 29953, 29929, 29962, 30004, 13, 1678, 18988, 353, 18988, 29889, 3286, 4220, 29898, 29896, 29892, 29871, 29906, 467, 1285, 5526, 681, 26471, 13, 1678, 14330, 29896, 29892, 29871, 29896, 29953, 29929, 29892, 29871, 29906, 29945, 29945, 29962, 30004, 13, 1678, 18988, 353, 18988, 29889, 1493, 29898, 16175, 29918, 2311, 29892, 6856, 29918, 2311, 334, 6856, 29918, 2311, 334, 954, 29918, 14588, 943, 29892, 289, 1884, 29918, 5552, 29879, 8443, 13, 1678, 14330, 29896, 29892, 29871, 29945, 29900, 29955, 29892, 29871, 29947, 29945, 29962, 30004, 13, 30004, 13, 1678, 23791, 943, 353, 17288, 29874, 29961, 29900, 29962, 847, 380, 2426, 29892, 263, 29961, 29896, 29962, 847, 380, 2426, 29897, 363, 263, 297, 23791, 943, 29962, 30004, 13, 30004, 13, 1678, 396, 29903, 335, 29885, 3398, 278, 29871, 8442, 29918, 29990, 29892, 8442, 29918, 29979, 29889, 322, 1203, 1970, 3615, 29883, 346, 30004, 13, 1678, 18988, 7503, 29892, 29901, 29892, 29900, 29962, 353, 4842, 305, 29889, 18816, 29885, 3398, 29898, 11965, 2463, 7503, 29892, 29901, 29892, 29900, 2314, 30004, 13, 1678, 18988, 7503, 29892, 29901, 29892, 29896, 29962, 353, 4842, 305, 29889, 18816, 29885, 3398, 29898, 11965, 2463, 7503, 29892, 29901, 29892, 29896, 2314, 30004, 13, 1678, 18988, 7503, 29892, 29901, 29892, 29946, 29962, 353, 4842, 305, 29889, 18816, 29885, 3398, 29898, 11965, 2463, 7503, 29892, 29901, 29892, 29946, 2314, 30004, 13, 30004, 13, 1678, 396, 2528, 278, 4818, 1283, 7224, 30004, 13, 1678, 6856, 353, 7442, 29889, 279, 927, 29898, 7720, 29918, 2311, 8443, 13, 1678, 263, 29892, 29890, 353, 7442, 29889, 4467, 29882, 7720, 29898, 7720, 29892, 6856, 29897, 259, 14330, 29896, 29941, 29892, 29896, 29941, 29962, 30004, 13, 30004, 13, 1678, 921, 29918, 10289, 353, 4842, 305, 29889, 11031, 29911, 6073, 29898, 29874, 467, 1493, 6278, 29896, 29892, 29896, 29897, 29871, 14330, 29896, 29953, 29929, 29892, 29896, 29962, 30004, 13, 1678, 343, 29918, 10289, 353, 4842, 305, 29889, 11031, 29911, 6073, 29898, 29890, 467, 1493, 6278, 29896, 29892, 29896, 29897, 29871, 14330, 29896, 29953, 29929, 29892, 29896, 29962, 30004, 13, 30004, 13, 1678, 565, 315, 29965, 7698, 29901, 30004, 13, 4706, 921, 29918, 10289, 353, 921, 29918, 10289, 29889, 29883, 6191, 26471, 13, 4706, 343, 29918, 10289, 353, 343, 29918, 10289, 29889, 29883, 6191, 26471, 13, 30004, 13, 1678, 396, 2266, 445, 338, 825, 5930, 30004, 13, 1678, 396, 518, 29896, 29953, 29929, 29892, 29896, 16272, 29896, 29953, 29929, 29892, 29896, 29962, 489, 4117, 15110, 518, 29896, 29953, 29929, 29892, 29906, 29962, 489, 14358, 15110, 29961, 29896, 29953, 29929, 29892, 29953, 29962, 489, 1493, 489, 3238, 13, 1678, 396, 518, 29945, 29900, 29955, 29892, 29906, 29962, 489, 6948, 802, 29872, 911, 15110, 29961, 29896, 29892, 29945, 29900, 29955, 29892, 29906, 29962, 30004, 13, 30004, 13, 1678, 921, 29918, 29891, 29918, 10289, 353, 4842, 305, 29889, 4117, 3552, 29916, 29918, 10289, 29892, 343, 29918, 10289, 511, 29871, 29896, 467, 14358, 29898, 29896, 29892, 1949, 29918, 14588, 943, 467, 1493, 6278, 29896, 29892, 29906, 467, 6948, 802, 29872, 911, 29898, 29900, 8443, 13, 30004, 13, 1678, 18988, 7503, 29892, 29901, 29892, 29901, 29906, 29962, 4619, 921, 29918, 29891, 29918, 10289, 30004, 13, 30004, 13, 1678, 396, 4522, 2913, 4327, 3171, 322, 278, 2920, 30004, 13, 30004, 13, 1678, 396, 530, 305, 943, 526, 263, 12489, 988, 1269, 1543, 338, 263, 18761, 298, 29892, 29893, 30004, 13, 1678, 23791, 943, 353, 4842, 305, 29889, 11031, 29911, 6073, 29898, 14588, 943, 8443, 13, 30004, 13, 1678, 565, 315, 29965, 7698, 29901, 30004, 13, 4706, 23791, 943, 353, 23791, 943, 29889, 29883, 6191, 26471, 13, 1678, 396, 910, 338, 825, 5930, 1244, 30004, 13, 1678, 396, 518, 29941, 29892, 29871, 29906, 29962, 489, 14358, 15110, 29961, 29945, 29900, 29955, 29892, 29871, 29906, 29962, 489, 6948, 802, 29872, 911, 15110, 29961, 29896, 29892, 29945, 29900, 29955, 29892, 29906, 29962, 30004, 13, 1678, 23791, 943, 353, 23791, 943, 29889, 14358, 29898, 7720, 29918, 2311, 29930, 7720, 29918, 2311, 29892, 29871, 29896, 467, 6948, 802, 29872, 911, 29898, 29900, 8443, 13, 1678, 18988, 7503, 29892, 29901, 29892, 29906, 29901, 29946, 29962, 353, 4842, 305, 29889, 4548, 29898, 11965, 2463, 7503, 29892, 29901, 29892, 29906, 29901, 29946, 2314, 29930, 14588, 943, 30004, 13, 30004, 13, 1678, 396, 2401, 368, 4365, 29885, 3398, 26229, 304, 278, 278, 770, 19435, 30004, 13, 1678, 18988, 7503, 29892, 584, 29892, 29871, 29945, 29901, 29871, 29945, 718, 954, 29918, 13203, 29962, 353, 4842, 305, 29889, 18816, 29885, 3398, 3552, 11965, 2463, 7503, 29892, 584, 29892, 29871, 29945, 29901, 29871, 29945, 718, 954, 29918, 13203, 12622, 30004, 13, 30004, 13, 1678, 396, 2538, 675, 278, 1439, 29872, 1953, 2910, 304, 278, 2159, 310, 278, 1881, 1967, 30004, 13, 1678, 18988, 7503, 29892, 584, 29892, 584, 29946, 29962, 334, 29922, 380, 2426, 30004, 13, 30004, 13, 1678, 736, 18988, 30004, 13, 30004, 13, 1753, 2436, 29918, 9902, 29898, 11965, 2463, 29892, 16420, 29892, 954, 29918, 13203, 29892, 302, 1516, 29918, 5527, 353, 29871, 29900, 29889, 29946, 1125, 30004, 13, 1678, 396, 4669, 10811, 5084, 498, 12268, 292, 30004, 13, 1678, 1970, 29918, 13168, 353, 313, 11965, 2463, 7503, 29892, 584, 29892, 29871, 29946, 29962, 1405, 16420, 467, 7411, 2141, 6948, 802, 29872, 911, 29898, 29906, 8443, 13, 1678, 18988, 353, 18988, 334, 1970, 29918, 13168, 30004, 13, 1678, 396, 27313, 292, 10050, 29899, 27525, 398, 9179, 23881, 30004, 13, 1678, 3800, 29918, 2616, 1089, 353, 18988, 29889, 1482, 29898, 11965, 2463, 29889, 12181, 8443, 13, 1678, 3800, 29918, 2616, 1089, 7503, 29892, 29901, 29892, 29900, 29962, 353, 313, 11965, 2463, 7503, 29892, 29901, 29892, 29900, 29962, 448, 18988, 7503, 29892, 29901, 29892, 29906, 16261, 29906, 8443, 13, 1678, 3800, 29918, 2616, 1089, 7503, 29892, 29901, 29892, 29896, 29962, 353, 313, 11965, 2463, 7503, 29892, 29901, 29892, 29896, 29962, 448, 18988, 7503, 29892, 29901, 29892, 29941, 16261, 29906, 8443, 13, 1678, 3800, 29918, 2616, 1089, 7503, 29892, 29901, 29892, 29906, 29962, 353, 313, 11965, 2463, 7503, 29892, 29901, 29892, 29900, 29962, 718, 18988, 7503, 29892, 29901, 29892, 29906, 16261, 29906, 8443, 13, 1678, 3800, 29918, 2616, 1089, 7503, 29892, 29901, 29892, 29941, 29962, 353, 313, 11965, 2463, 7503, 29892, 29901, 29892, 29896, 29962, 718, 18988, 7503, 29892, 29901, 29892, 29941, 16261, 29906, 8443, 13, 1678, 18988, 7503, 29892, 29901, 29892, 29901, 29946, 29962, 353, 3800, 29918, 2616, 1089, 7503, 29892, 29901, 29892, 29901, 29946, 29962, 30004, 13, 30004, 13, 1678, 9853, 29918, 2311, 353, 18988, 29889, 2311, 29898, 29900, 8443, 13, 30004, 13, 1678, 2436, 353, 7700, 30004, 13, 30004, 13, 1678, 363, 1399, 297, 3464, 29898, 16175, 29918, 2311, 1125, 30004, 13, 4706, 1967, 29918, 11965, 353, 18988, 29961, 513, 29962, 30004, 13, 4706, 396, 3027, 29918, 11965, 338, 1286, 29871, 29906, 29928, 12489, 30004, 13, 965, 396, 5527, 5084, 266, 3781, 8948, 292, 30004, 13, 965, 396, 29940, 4345, 30004, 13, 4706, 396, 29871, 2180, 445, 1298, 29892, 591, 29915, 276, 871, 15041, 411, 278, 770, 8158, 30004, 13, 4706, 396, 29871, 2534, 278, 7472, 995, 29889, 1105, 29892, 591, 3349, 278, 29871, 29947, 29900, 770, 19435, 30004, 13, 4706, 396, 29871, 515, 1269, 1948, 29892, 322, 2012, 788, 278, 2380, 310, 278, 770, 2534, 30004, 13, 4706, 396, 29871, 278, 7472, 1819, 29892, 408, 1532, 278, 770, 8158, 310, 393, 770, 22993, 13, 4706, 4236, 29918, 5527, 29892, 4236, 29918, 5527, 29918, 13628, 353, 4842, 305, 29889, 3317, 29898, 3027, 29918, 11965, 7503, 29892, 29871, 29945, 29901, 29945, 718, 954, 29918, 13203, 1402, 29871, 29896, 8443, 13, 4706, 396, 4842, 305, 29889, 3317, 580, 3639, 4236, 995, 322, 278, 2380, 988, 4236, 4864, 30004, 13, 4706, 4236, 29918, 5527, 353, 4236, 29918, 5527, 29889, 7411, 2141, 6948, 802, 29872, 911, 29898, 29896, 8443, 13, 4706, 4236, 29918, 5527, 29918, 13628, 353, 4236, 29918, 5527, 29918, 13628, 29889, 7411, 2141, 6948, 802, 29872, 911, 29898, 29896, 8443, 13, 4706, 396, 3022, 21203, 1218, 2380, 1819, 322, 4236, 6976, 411, 3800, 10350, 408, 4341, 30004, 13, 4706, 19359, 353, 313, 3027, 29918, 11965, 7503, 29892, 584, 29945, 1402, 4236, 29918, 5527, 29892, 4236, 29918, 5527, 29918, 13628, 8443, 13, 4706, 1967, 29918, 11965, 353, 4842, 305, 29889, 4117, 29898, 11762, 29892, 29871, 29896, 8443, 13, 4706, 396, 2567, 1967, 29918, 11965, 3964, 338, 518, 1949, 29918, 29890, 1884, 29892, 29955, 29962, 30004, 13, 30004, 13, 4706, 396, 1334, 505, 731, 3216, 292, 3800, 8393, 310, 1906, 16273, 411, 1203, 2264, 30004, 13, 4706, 396, 8158, 3109, 1135, 278, 16897, 408, 5225, 29889, 2567, 591, 674, 3349, 963, 22993, 13, 4706, 1661, 29918, 9171, 29918, 513, 353, 313, 7345, 305, 29889, 5464, 9171, 29898, 3027, 29918, 11965, 7503, 29892, 29871, 29946, 12622, 30004, 13, 4706, 1018, 29901, 30004, 13, 9651, 1967, 29918, 11965, 29918, 353, 1967, 29918, 11965, 29961, 5464, 29918, 9171, 29918, 513, 29889, 29879, 802, 29872, 911, 3285, 584, 1822, 1493, 6278, 29896, 29892, 29871, 29955, 8443, 13, 4706, 5174, 29901, 30004, 13, 9651, 6773, 30004, 13, 30004, 13, 4706, 396, 1152, 10772, 29911, 25350, 29871, 29900, 29889, 29946, 24521, 30004, 13, 4706, 396, 4001, 278, 2038, 775, 411, 451, 12020, 3682, 363, 694, 15326, 30004, 13, 4706, 396, 408, 8716, 1503, 526, 6969, 297, 10772, 29911, 25350, 29871, 29900, 29889, 29946, 30004, 13, 4706, 565, 1967, 29918, 11965, 5396, 12181, 29961, 29900, 29962, 1275, 29871, 29900, 29901, 30004, 13, 9651, 6773, 30004, 13, 4706, 396, 29871, 450, 1018, 29899, 19499, 2908, 338, 727, 304, 4386, 18845, 988, 30004, 13, 4706, 396, 29871, 591, 679, 694, 1439, 29872, 1953, 29889, 512, 393, 1206, 29892, 591, 671, 6773, 304, 14383, 30004, 13, 4706, 396, 29871, 278, 1791, 310, 278, 2425, 3573, 363, 445, 1967, 22993, 13, 4706, 396, 3617, 278, 5164, 4413, 17809, 297, 278, 1967, 30004, 13, 4706, 1018, 29901, 30004, 13, 9651, 10153, 29918, 13203, 353, 4842, 305, 29889, 13092, 29898, 3027, 29918, 11965, 29918, 7503, 29892, 448, 29896, 2314, 30004, 13, 9651, 396, 448, 29896, 2380, 8640, 278, 770, 2380, 30004, 13, 4706, 5174, 29901, 30004, 13, 9651, 6773, 30004, 13, 4706, 363, 1067, 29879, 297, 10153, 29918, 13203, 29901, 30004, 13, 4706, 396, 2189, 405, 4345, 30004, 13, 4706, 396, 679, 278, 1439, 29872, 1953, 411, 697, 3153, 770, 30004, 13, 9651, 1067, 29879, 29918, 13168, 353, 1967, 29918, 11965, 29918, 334, 313, 3027, 29918, 11965, 29918, 7503, 29892, 448, 29896, 29962, 1275, 1067, 29879, 467, 7411, 2141, 6948, 802, 29872, 911, 29898, 29896, 8443, 13, 9651, 396, 853, 29879, 802, 29872, 911, 338, 1304, 408, 12672, 292, 289, 29914, 29893, 4608, 322, 4636, 338, 451, 1950, 30004, 13, 9651, 396, 10133, 591, 1207, 278, 4608, 263, 4636, 773, 9644, 802, 29872, 911, 30004, 13, 9651, 396, 323, 575, 943, 526, 12672, 519, 565, 30004, 13, 9651, 396, 1932, 4256, 1218, 975, 278, 9927, 15786, 29892, 6257, 472, 278, 25053, 9927, 11167, 13, 9651, 396, 278, 9927, 15786, 1818, 2845, 367, 5186, 29892, 697, 310, 963, 338, 29871, 29896, 11167, 13, 9651, 396, 470, 697, 310, 963, 947, 451, 1863, 22993, 13, 9651, 396, 2567, 1067, 29879, 29918, 13168, 3964, 11759, 1949, 29918, 1327, 29916, 29892, 29955, 29962, 30004, 13, 9651, 396, 13702, 1286, 599, 289, 29890, 29916, 8393, 526, 5225, 363, 1906, 289, 29890, 10351, 607, 30004, 13, 9651, 396, 19403, 1712, 2198, 770, 30004, 13, 9651, 770, 29918, 13168, 29918, 513, 353, 4842, 305, 29889, 5464, 9171, 29898, 25932, 29918, 13168, 7503, 29892, 448, 29906, 14664, 29879, 802, 29872, 911, 26471, 13, 9651, 1967, 29918, 11965, 29918, 1990, 353, 1967, 29918, 11965, 29918, 29961, 1990, 29918, 13168, 29918, 513, 1822, 1493, 6278, 29896, 29892, 29871, 29955, 8443, 13, 30004, 13, 9651, 396, 2656, 278, 1439, 29872, 1953, 1316, 393, 278, 6251, 411, 278, 7472, 1203, 2264, 30004, 13, 9651, 396, 16420, 338, 472, 278, 2246, 30004, 13, 9651, 12705, 3383, 1970, 29918, 6605, 29918, 2248, 353, 4842, 305, 29889, 6605, 29898, 3027, 29918, 11965, 29918, 1990, 7503, 29892, 29871, 29946, 1402, 5153, 2548, 29922, 5574, 8443, 13, 9651, 1967, 29918, 11965, 29918, 1990, 353, 1967, 29918, 11965, 29918, 1990, 29961, 5527, 29918, 6605, 29918, 2248, 29962, 30004, 13, 9651, 22645, 353, 1967, 29918, 11965, 29918, 1990, 29889, 2311, 29898, 29900, 29897, 396, 9681, 310, 1439, 29872, 1953, 30004, 13, 30004, 13, 9651, 363, 474, 297, 3464, 29898, 13140, 1125, 30004, 13, 18884, 396, 3617, 278, 10663, 15922, 310, 599, 16273, 393, 2041, 1156, 278, 697, 591, 526, 3063, 472, 30004, 13, 18884, 396, 297, 278, 2425, 30004, 13, 18884, 1018, 29901, 30004, 13, 462, 1678, 474, 681, 353, 289, 1884, 29918, 29875, 283, 29898, 3027, 29918, 11965, 29918, 1990, 29961, 29875, 1822, 6948, 802, 29872, 911, 29898, 29900, 511, 1967, 29918, 11965, 29918, 1990, 29961, 29875, 718, 29871, 29896, 29901, 2314, 30004, 13, 18884, 5174, 7865, 2392, 29901, 30004, 13, 462, 1678, 2867, 30004, 13, 30004, 13, 18884, 5174, 11374, 2392, 29901, 30004, 13, 462, 1678, 2867, 30004, 13, 30004, 13, 18884, 396, 28933, 714, 599, 278, 1439, 29872, 1953, 393, 505, 22244, 29965, 1405, 9941, 29882, 8948, 30004, 13, 18884, 474, 283, 29918, 13168, 353, 313, 2738, 529, 302, 1516, 29918, 5527, 467, 7411, 2141, 6948, 802, 29872, 911, 29898, 29896, 8443, 13, 18884, 1967, 29918, 11965, 29918, 1990, 29961, 29875, 718, 29871, 29896, 17531, 334, 29922, 474, 283, 29918, 13168, 30004, 13, 30004, 13, 18884, 396, 15154, 278, 1661, 29899, 9171, 9976, 30004, 13, 18884, 1661, 29918, 9171, 29918, 513, 353, 4842, 305, 29889, 5464, 9171, 29898, 3027, 29918, 11965, 29918, 1990, 7503, 29892, 29871, 29946, 14664, 29879, 802, 29872, 911, 26471, 13, 18884, 1967, 29918, 11965, 29918, 1990, 353, 1967, 29918, 11965, 29918, 1990, 29961, 5464, 29918, 9171, 29918, 513, 1822, 1493, 6278, 29896, 29892, 29871, 29955, 8443, 13, 30004, 13, 30004, 13, 18884, 396, 1334, 671, 278, 2436, 7353, 304, 12266, 3692, 278, 12489, 756, 1063, 16601, 30004, 13, 18884, 396, 470, 451, 29889, 9038, 372, 756, 1063, 16601, 29892, 591, 16125, 403, 15352, 1439, 29872, 1953, 304, 372, 22993, 13, 18884, 396, 2180, 278, 1095, 310, 2425, 393, 4256, 1078, 975, 4413, 29892, 591, 788, 278, 1121, 424, 30004, 13, 18884, 396, 1439, 29872, 1953, 304, 278, 12489, 1962, 22993, 13, 30004, 13, 30004, 13, 9651, 396, 1168, 29883, 2579, 403, 278, 9853, 29918, 333, 310, 278, 1967, 304, 278, 15326, 30004, 13, 9651, 396, 1366, 6911, 502, 12439, 607, 1967, 947, 278, 15326, 3928, 304, 30004, 13, 9651, 396, 4806, 671, 263, 5608, 3829, 304, 4808, 15149, 278, 1439, 29872, 1953, 515, 278, 9853, 30004, 13, 9651, 396, 1552, 9853, 29918, 6229, 338, 1652, 8606, 287, 30004, 13, 9651, 396, 16175, 338, 15659, 491, 4805, 9853, 1897, 30004, 13, 9651, 9853, 29918, 513, 353, 1967, 29918, 11965, 29918, 1990, 29889, 1482, 29898, 3027, 29918, 11965, 29918, 1990, 29889, 2311, 29898, 29900, 511, 29871, 29896, 467, 5589, 23538, 513, 8443, 13, 9651, 396, 830, 11666, 278, 9853, 29918, 333, 363, 408, 1784, 1439, 29872, 1953, 310, 278, 770, 1067, 29879, 297, 278, 1967, 30004, 13, 9651, 19359, 353, 9853, 29918, 513, 29892, 1967, 29918, 11965, 29918, 1990, 30004, 13, 30004, 13, 9651, 565, 451, 2436, 29901, 30004, 13, 18884, 1962, 353, 4842, 305, 29889, 4117, 29898, 11762, 29892, 29871, 29896, 8443, 13, 18884, 2436, 353, 5852, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 714, 353, 4842, 305, 29889, 4117, 29898, 11762, 29892, 29871, 29896, 8443, 13, 18884, 1962, 353, 4842, 305, 29889, 4117, 3552, 4905, 29892, 714, 876, 30004, 13, 30004, 13, 9651, 396, 2180, 278, 1095, 310, 278, 740, 29892, 591, 1423, 3692, 1962, 756, 1063, 16601, 472, 599, 470, 451, 22993, 13, 9651, 396, 960, 372, 22602, 29915, 29873, 1063, 2794, 727, 29915, 29879, 22602, 29915, 29873, 1063, 263, 2323, 15326, 297, 738, 4558, 310, 278, 9853, 22993, 13, 9651, 396, 512, 393, 1206, 29892, 591, 736, 29871, 29900, 22993, 13, 30004, 13, 1678, 1018, 29901, 30004, 13, 4706, 736, 1962, 30004, 13, 1678, 5174, 29901, 30004, 13, 4706, 736, 29871, 29900, 30004, 13, 30004, 13, 2 ]
panel/depends.py
apatlpo/panel
1
101442
from __future__ import absolute_import, division, unicode_literals import param from .widgets import Widget ipywidget_classes = {} def param_value_if_widget(arg): if isinstance(arg, Widget): return arg.param.value from .pane.ipywidget import IPyWidget if IPyWidget.applies(arg) and hasattr(arg, 'value'): name = type(arg).__name__ if name in ipywidget_classes: ipy_param = ipywidget_classes[name] else: ipy_param = param.parameterized_class(name, {'value': param.Parameter()}) ipywidget_classes[name] = ipy_param ipy_inst = ipy_param(value=arg.value) arg.observe(lambda event: ipy_inst.param.set_param(value=event['new']), 'value') return ipy_inst.param.value return arg def depends(*args, **kwargs): updated_args = [param_value_if_widget(a) for a in args] updated_kwargs = {k: param_value_if_widget(v) for k, v in kwargs.items()} return param.depends(*updated_args, **updated_kwargs)
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 8542, 29892, 29104, 29918, 20889, 1338, 13, 13, 5215, 1828, 13, 13, 3166, 869, 8030, 29879, 1053, 27080, 13, 13, 666, 5693, 3690, 29918, 13203, 353, 6571, 13, 13, 13, 1753, 1828, 29918, 1767, 29918, 361, 29918, 8030, 29898, 1191, 1125, 13, 1678, 565, 338, 8758, 29898, 1191, 29892, 27080, 1125, 13, 4706, 736, 1852, 29889, 3207, 29889, 1767, 13, 13, 1678, 515, 869, 29886, 1662, 29889, 666, 5693, 3690, 1053, 5641, 29891, 8801, 13, 1678, 565, 5641, 29891, 8801, 29889, 932, 3687, 29898, 1191, 29897, 322, 756, 5552, 29898, 1191, 29892, 525, 1767, 29374, 13, 4706, 1024, 353, 1134, 29898, 1191, 467, 1649, 978, 1649, 13, 4706, 565, 1024, 297, 474, 2272, 8030, 29918, 13203, 29901, 13, 9651, 474, 2272, 29918, 3207, 353, 474, 2272, 8030, 29918, 13203, 29961, 978, 29962, 13, 4706, 1683, 29901, 13, 9651, 474, 2272, 29918, 3207, 353, 1828, 29889, 15501, 1891, 29918, 1990, 29898, 978, 29892, 11117, 1767, 2396, 1828, 29889, 9329, 580, 1800, 13, 4706, 474, 2272, 8030, 29918, 13203, 29961, 978, 29962, 353, 474, 2272, 29918, 3207, 13, 4706, 474, 2272, 29918, 2611, 353, 474, 2272, 29918, 3207, 29898, 1767, 29922, 1191, 29889, 1767, 29897, 13, 4706, 1852, 29889, 711, 16349, 29898, 2892, 1741, 29901, 474, 2272, 29918, 2611, 29889, 3207, 29889, 842, 29918, 3207, 29898, 1767, 29922, 3696, 1839, 1482, 2033, 511, 525, 1767, 1495, 13, 4706, 736, 474, 2272, 29918, 2611, 29889, 3207, 29889, 1767, 13, 1678, 736, 1852, 13, 13, 13, 1753, 7111, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 4784, 29918, 5085, 353, 518, 3207, 29918, 1767, 29918, 361, 29918, 8030, 29898, 29874, 29897, 363, 263, 297, 29871, 6389, 29962, 13, 1678, 4784, 29918, 19290, 353, 426, 29895, 29901, 1828, 29918, 1767, 29918, 361, 29918, 8030, 29898, 29894, 29897, 363, 413, 29892, 325, 297, 9049, 5085, 29889, 7076, 28296, 13, 13, 1678, 736, 1828, 29889, 2716, 1975, 10456, 21402, 29918, 5085, 29892, 3579, 21402, 29918, 19290, 29897, 13, 2 ]
Asap-3.8.4/Python/asap3/Utilities/BrennerImport.py
auag92/n2dm
1
180024
<filename>Asap-3.8.4/Python/asap3/Utilities/BrennerImport.py # Copyright (C) 2007 CAMP # Please see the accompanying LICENSE file for further information. """Imports a brenner *.d coordinate file and/or a input.d file""" """This file is used with the BrennerPotential only""" """TODO: Add nice error messages""" from ASE.ChemicalElements.symbol import symbols from ASE import Atom from Asap import * from Asap import ListOfAtoms import string class BrennerImport: title = "Default parameter set (overwrites default set of brenner implementation)" atoms = [] movable = [] #1=movable; 2=non-movable step = 0.5 #femtoseconds numAtoms = 0 #number of atoms kFlag = 1 #brenner k-flag rll = 2.5 #some radius that has quite some influence #the following parameters cannot be set in adaption of the brenner potential in asap: cubedimension = [200, 200, 200] #calculated automatically if not deactivated in BrennerPotential constructor: therefore ignored lennardJonesParameter = [] #parameters for lennardJones: ignored starttime = 0 #starttime: ignored nxmol = 500 #every x steps write output file: ignored: #but the user can call potential.WriteXmol() femtosecond=1e-15 def __init__(self): """Imports coord.d and input.d""" #Returns a predictor/corrector object #TODO: NOT TESTED! def getPredictorCorrector(self, atoms): pd = PredictorCorrector(atoms, self.GetStepSize(), self.GetMovableParam()) return pd #Sets all parameter that can be set in the potential (a BrennerPotential) #TODO: NOT TESTED - especially ! def setPotentialParameters(self, potential): potential.SetKFlag(self.GetKFlag()) potential.SetRll(self.GetRll()) potential.SetMinRangeTree(100) #To maintain compatibility with the brenner source and the #c implementation of the brenner source we read it as done #in the c-source. (See bren2.c/initkt() for details!) #Parameter that don't have a self as prefix are IGNORED!!!! def initInput(self, filepath): #first line: f=open(filepath, 'r') [kuc, maxkb, self.kFlag, self.nxmol]= self.ReadInt(f, 4) self.ReadLine(f) #ignore the rest of the 1st line [pseed, self.rll, temp, pbl]= self.ReadFloat(f, 4) self.ReadLine(f) #ignore the rest of the 2nd line self.ipot = self.ReadInt(f, 1)[0] #=1 REBO (C,H,Si,Ge), =2 tight-binding for C: self.ReadLine(f) #ignore the rest of the 3rd line self.lennardJonesParameter = [] while 1: result = self.ReadFloat(f, 4) self.ReadLine(f); #ifgnore the rest of the line if result==[]: break; [a,b,c,d] = result; if a>0: self.lennardJonesParameter.append(a) self.lennardJonesParameter.append(b) self.lennardJonesParameter.append(c) self.lennardJonesParameter.append(d) def initCoord(self, filepath): """Imports the coordinates (the rest is ignored) of a brenner *.d file: # are comments that do not belong to the file: # textual description: diamond lattice # atoms: 63 # start time and stepsize: 0.20000000000E+01 0.50000000000E+00 # cube dimension: 0.20000000000E+03 0.20000000000E+03 0.20000000000E+03 #number, element number, x,y,z coordinates, 1=movable 2=unmovable atom 1 6 0.12239212990E+01 -0.37850461006E+01 -0.76280212402E+00 2 # 2 6 -0.11044621468E+01 -0.38742597103E+01 -0.95745104551E+00 2 ... 63 1 0.72413903475E+00 0.10444240570E+02 -0.26598501205E+01 2 """ f=open(filepath, 'r') self.title = self.ReadLine(f) self.numAtoms = self.ReadInt(f, 1)[0] self.starttime, self.step = self.ReadFloat(f, 2) self.cubedimension = self.ReadFloat(f, 3) self.movable = [] atoms = [] for i in range(self.numAtoms): atomID = self.ReadInt(f, 1)[0] symbol = symbols[(self.ReadInt(f, 1)[0])] coord = self.ReadFloat(f, 3) movable= self.ReadInt(f, 1) atoms.append(Atom(symbol, coord)) self.movable.append(movable[0]) self.atoms = ListOfAtoms(atoms, [[self.cubedimension[0], 0, 0],[0, self.cubedimension[1], 0],[0, 0, self.cubedimension[2]]]) def GetListOfAtoms(self): return self.atoms; def GetMovableParam(self): return self.movable; def GetCubeSize(self): return self.cubedimension; #in FEMTOSECONDS def GetStepSize(self): return self.step; #in FEMTOSECONDS def GetStartTime(self): return self.starttime; def GetKFlag(self): return self.kFlag def GetNxmol(self): return self.nxmol def GetRll(self): return self.rll #contains tupels of [natom, xmad, epstd, sigtd] def GetLennardJonesParameter(self): return self.lennardJonesParameter; ####################################### # PRIVATE FUNCTIONS # ####################################### #reads a line def ReadLine(self, f): return f.readline(); #reads 'numbers' integers def ReadInt(self, f, numbers): result = [] for i in range(numbers): number = '' ch = f.read(1) if ch=="": #EOF return result while ch in string.whitespace: ch = f.read(1) if ch=="": #EOF return result while ch not in string.whitespace: number += ch ch = f.read(1) result.append(int(number)) return result #reads 'numbers' floats def ReadFloat(self, f, numbers): result = [] for i in range(numbers): number = '' ch = f.read(1) if ch=="": #EOF return result while ch in string.whitespace: ch = f.read(1) while ch not in string.whitespace: number += ch ch = f.read(1) result.append(float(number)) return result
[ 1, 529, 9507, 29958, 2887, 481, 29899, 29941, 29889, 29947, 29889, 29946, 29914, 11980, 29914, 294, 481, 29941, 29914, 7270, 1907, 29914, 29933, 1267, 1089, 17518, 29889, 2272, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29900, 29955, 29871, 12766, 3580, 13, 29937, 3529, 1074, 278, 10259, 1384, 292, 365, 2965, 1430, 1660, 934, 363, 4340, 2472, 29889, 13, 13, 15945, 29908, 1888, 4011, 263, 289, 1267, 1089, 20611, 29881, 14821, 934, 322, 29914, 272, 263, 1881, 29889, 29881, 934, 15945, 29908, 13, 15945, 29908, 4013, 934, 338, 1304, 411, 278, 350, 1267, 1089, 29925, 327, 2556, 871, 15945, 29908, 13, 15945, 29908, 4986, 3970, 29901, 3462, 7575, 1059, 7191, 15945, 29908, 13, 13, 3166, 319, 1660, 29889, 1451, 331, 936, 18868, 29889, 18098, 1053, 15072, 13, 3166, 319, 1660, 1053, 2180, 290, 13, 13, 3166, 1094, 481, 1053, 334, 13, 3166, 1094, 481, 1053, 2391, 2776, 4178, 4835, 13, 13, 5215, 1347, 13, 13, 1990, 350, 1267, 1089, 17518, 29901, 13, 13, 29871, 3611, 353, 376, 4592, 3443, 731, 313, 957, 8231, 267, 2322, 731, 310, 289, 1267, 1089, 5314, 5513, 13, 29871, 28422, 353, 5159, 29871, 13, 29871, 2351, 519, 353, 5159, 29871, 396, 29896, 29922, 13529, 519, 29936, 29871, 29906, 29922, 5464, 29899, 13529, 519, 13, 29871, 4331, 353, 29871, 29900, 29889, 29945, 1678, 396, 29888, 331, 517, 23128, 13, 29871, 954, 4178, 4835, 353, 29871, 29900, 29871, 396, 4537, 310, 28422, 13, 29871, 413, 21979, 353, 29871, 29896, 268, 396, 1182, 264, 1089, 413, 29899, 15581, 13, 29871, 364, 645, 353, 29871, 29906, 29889, 29945, 268, 396, 5372, 11855, 393, 756, 3755, 777, 9949, 13, 13, 29871, 396, 1552, 1494, 4128, 2609, 367, 731, 297, 594, 29874, 683, 310, 278, 289, 1267, 1089, 7037, 297, 408, 481, 29901, 13, 29871, 13630, 287, 326, 2673, 353, 518, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29962, 396, 15807, 630, 6336, 565, 451, 316, 11236, 630, 297, 350, 1267, 1089, 29925, 327, 2556, 5823, 29901, 5480, 17262, 13, 29871, 301, 2108, 538, 29967, 2873, 9329, 353, 5159, 418, 396, 16744, 363, 301, 2108, 538, 29967, 2873, 29901, 17262, 13, 29871, 1369, 2230, 353, 29871, 29900, 462, 259, 396, 2962, 2230, 29901, 17262, 13, 29871, 302, 29916, 29885, 324, 353, 29871, 29945, 29900, 29900, 462, 268, 396, 17991, 921, 6576, 2436, 1962, 934, 29901, 17262, 29901, 29871, 13, 462, 462, 29871, 396, 4187, 278, 1404, 508, 1246, 7037, 29889, 6113, 29990, 29885, 324, 580, 13, 13, 29871, 4445, 517, 7496, 29922, 29896, 29872, 29899, 29896, 29945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 1125, 13, 1678, 9995, 1888, 4011, 29311, 29889, 29881, 322, 1881, 29889, 29881, 15945, 29908, 13, 259, 13, 29871, 396, 11609, 29879, 263, 8500, 272, 29914, 15728, 272, 1203, 13, 29871, 396, 4986, 3970, 29901, 6058, 17067, 1254, 3352, 29991, 13, 29871, 822, 679, 23084, 919, 272, 12521, 1621, 272, 29898, 1311, 29892, 28422, 1125, 13, 4706, 10518, 353, 21099, 919, 272, 12521, 1621, 272, 29898, 271, 4835, 29892, 1583, 29889, 2577, 14448, 3505, 3285, 1583, 29889, 2577, 29924, 586, 519, 4736, 3101, 13, 4706, 736, 10518, 13, 13, 29871, 396, 29903, 1691, 599, 3443, 393, 508, 367, 731, 297, 278, 7037, 313, 29874, 350, 1267, 1089, 29925, 327, 2556, 29897, 13, 29871, 396, 4986, 3970, 29901, 6058, 17067, 1254, 3352, 448, 7148, 1738, 13, 29871, 822, 731, 29925, 327, 2556, 11507, 29898, 1311, 29892, 7037, 1125, 13, 4706, 7037, 29889, 2697, 29968, 21979, 29898, 1311, 29889, 2577, 29968, 21979, 3101, 13, 4706, 7037, 29889, 2697, 29934, 645, 29898, 1311, 29889, 2577, 29934, 645, 3101, 13, 4706, 7037, 29889, 2697, 8140, 6069, 9643, 29898, 29896, 29900, 29900, 29897, 13, 13, 13, 29871, 396, 1762, 7344, 24521, 411, 278, 289, 1267, 1089, 2752, 322, 278, 29871, 13, 29871, 396, 29883, 5314, 310, 278, 289, 1267, 1089, 2752, 591, 1303, 372, 408, 2309, 13, 29871, 396, 262, 278, 274, 29899, 4993, 29889, 313, 13393, 289, 1267, 29906, 29889, 29883, 29914, 2344, 1193, 580, 363, 4902, 14366, 13, 29871, 396, 9329, 393, 1016, 29915, 29873, 505, 263, 1583, 408, 10944, 526, 306, 29954, 6632, 19386, 6824, 6824, 13, 29871, 822, 2069, 4290, 29898, 1311, 29892, 934, 2084, 1125, 13, 4706, 396, 4102, 1196, 29901, 13, 4706, 285, 29922, 3150, 29898, 1445, 2084, 29892, 525, 29878, 1495, 13, 12, 29961, 29895, 1682, 29892, 4236, 21066, 29892, 1583, 29889, 29895, 21979, 29892, 1583, 29889, 23818, 29885, 324, 13192, 1583, 29889, 6359, 2928, 29898, 29888, 29892, 29871, 29946, 29897, 13, 4706, 1583, 29889, 6359, 3542, 29898, 29888, 29897, 396, 17281, 278, 1791, 310, 278, 29871, 29896, 303, 1196, 13, 4706, 518, 29886, 26776, 29892, 1583, 29889, 29878, 645, 29892, 5694, 29892, 282, 2204, 13192, 1583, 29889, 6359, 11031, 29898, 29888, 29892, 29871, 29946, 29897, 13, 4706, 1583, 29889, 6359, 3542, 29898, 29888, 29897, 396, 17281, 278, 1791, 310, 278, 29871, 29906, 299, 1196, 13, 4706, 1583, 29889, 666, 327, 353, 1583, 29889, 6359, 2928, 29898, 29888, 29892, 29871, 29896, 9601, 29900, 29962, 396, 29922, 29896, 5195, 8456, 313, 29907, 29892, 29950, 29892, 25598, 29892, 7999, 511, 353, 29906, 19932, 29899, 19672, 363, 315, 29901, 29871, 13, 4706, 1583, 29889, 6359, 3542, 29898, 29888, 29897, 396, 17281, 278, 1791, 310, 278, 29871, 29941, 5499, 1196, 13, 4706, 1583, 29889, 29880, 2108, 538, 29967, 2873, 9329, 353, 5159, 13, 4706, 1550, 29871, 29896, 29901, 13, 3986, 1121, 353, 1583, 29889, 6359, 11031, 29898, 29888, 29892, 29871, 29946, 29897, 13, 3986, 1583, 29889, 6359, 3542, 29898, 29888, 416, 396, 361, 5138, 487, 278, 1791, 310, 278, 1196, 13, 3986, 565, 1121, 1360, 2636, 29901, 13, 632, 2867, 29936, 13, 3986, 518, 29874, 29892, 29890, 29892, 29883, 29892, 29881, 29962, 353, 1121, 29936, 13, 3986, 565, 263, 29958, 29900, 29901, 13, 632, 1583, 29889, 29880, 2108, 538, 29967, 2873, 9329, 29889, 4397, 29898, 29874, 29897, 13, 632, 1583, 29889, 29880, 2108, 538, 29967, 2873, 9329, 29889, 4397, 29898, 29890, 29897, 13, 632, 1583, 29889, 29880, 2108, 538, 29967, 2873, 9329, 29889, 4397, 29898, 29883, 29897, 13, 632, 1583, 29889, 29880, 2108, 538, 29967, 2873, 9329, 29889, 4397, 29898, 29881, 29897, 13, 308, 13, 13, 29871, 822, 2069, 7967, 536, 29898, 1311, 29892, 934, 2084, 1125, 13, 1678, 9995, 1888, 4011, 278, 10350, 313, 1552, 1791, 338, 17262, 29897, 310, 263, 289, 1267, 1089, 20611, 29881, 934, 29901, 13, 1678, 396, 526, 6589, 393, 437, 451, 6852, 304, 278, 934, 29901, 13, 539, 13, 418, 396, 1426, 950, 6139, 29901, 13, 418, 11502, 898, 24094, 4706, 13, 418, 396, 28422, 29901, 462, 462, 268, 6756, 13, 539, 29953, 29941, 259, 13, 418, 396, 1369, 931, 322, 6576, 675, 29901, 30004, 13, 539, 29900, 29889, 29906, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29923, 29974, 29900, 29896, 1678, 29900, 29889, 29945, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29923, 29974, 29900, 29900, 965, 13, 418, 396, 28704, 9927, 29901, 9651, 6756, 13, 539, 29900, 29889, 29906, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29923, 29974, 29900, 29941, 1678, 29900, 29889, 29906, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29923, 29974, 29900, 29941, 1678, 29900, 29889, 29906, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29923, 29974, 29900, 29941, 259, 13, 418, 396, 4537, 29892, 29871, 1543, 1353, 29892, 921, 29892, 29891, 29892, 29920, 10350, 29892, 29871, 29896, 29922, 13529, 519, 29871, 29906, 29922, 348, 13529, 519, 12301, 30004, 13, 539, 29896, 268, 29953, 1678, 29900, 29889, 29896, 29906, 29906, 29941, 29929, 29906, 29896, 29906, 29929, 29929, 29900, 29923, 29974, 29900, 29896, 29871, 448, 29900, 29889, 29941, 29955, 29947, 29945, 29900, 29946, 29953, 29896, 29900, 29900, 29953, 29923, 29974, 29900, 29896, 29871, 448, 29900, 29889, 29955, 29953, 29906, 29947, 29900, 29906, 29896, 29906, 29946, 29900, 29906, 29923, 29974, 29900, 29900, 259, 29906, 396, 30004, 13, 539, 29906, 268, 29953, 29871, 448, 29900, 29889, 29896, 29896, 29900, 29946, 29946, 29953, 29906, 29896, 29946, 29953, 29947, 29923, 29974, 29900, 29896, 29871, 448, 29900, 29889, 29941, 29947, 29955, 29946, 29906, 29945, 29929, 29955, 29896, 29900, 29941, 29923, 29974, 29900, 29896, 29871, 448, 29900, 29889, 29929, 29945, 29955, 29946, 29945, 29896, 29900, 29946, 29945, 29945, 29896, 29923, 29974, 29900, 29900, 259, 29906, 30004, 13, 418, 2023, 13, 539, 29953, 29941, 1678, 29896, 1678, 29900, 29889, 29955, 29906, 29946, 29896, 29941, 29929, 29900, 29941, 29946, 29955, 29945, 29923, 29974, 29900, 29900, 1678, 29900, 29889, 29896, 29900, 29946, 29946, 29946, 29906, 29946, 29900, 29945, 29955, 29900, 29923, 29974, 29900, 29906, 29871, 448, 29900, 29889, 29906, 29953, 29945, 29929, 29947, 29945, 29900, 29896, 29906, 29900, 29945, 29923, 29974, 29900, 29896, 259, 29906, 13, 13, 1678, 9995, 13, 1678, 285, 29922, 3150, 29898, 1445, 2084, 29892, 525, 29878, 1495, 13, 1678, 1583, 29889, 3257, 353, 1583, 29889, 6359, 3542, 29898, 29888, 29897, 13, 1678, 1583, 29889, 1949, 4178, 4835, 353, 1583, 29889, 6359, 2928, 29898, 29888, 29892, 29871, 29896, 9601, 29900, 29962, 13, 1678, 1583, 29889, 2962, 2230, 29892, 1583, 29889, 10568, 353, 1583, 29889, 6359, 11031, 29898, 29888, 29892, 29871, 29906, 29897, 13, 1678, 1583, 29889, 29883, 431, 287, 326, 2673, 353, 1583, 29889, 6359, 11031, 29898, 29888, 29892, 29871, 29941, 29897, 13, 1678, 1583, 29889, 13529, 519, 353, 5159, 13, 1678, 28422, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 1311, 29889, 1949, 4178, 4835, 1125, 13, 418, 12301, 1367, 353, 1583, 29889, 6359, 2928, 29898, 29888, 29892, 29871, 29896, 9601, 29900, 29962, 13, 418, 5829, 353, 15072, 15625, 1311, 29889, 6359, 2928, 29898, 29888, 29892, 29871, 29896, 9601, 29900, 2314, 29962, 13, 418, 29311, 29871, 353, 1583, 29889, 6359, 11031, 29898, 29888, 29892, 29871, 29941, 29897, 13, 418, 2351, 519, 29922, 1583, 29889, 6359, 2928, 29898, 29888, 29892, 29871, 29896, 29897, 13, 418, 28422, 29889, 4397, 29898, 4178, 290, 29898, 18098, 29892, 29311, 876, 13, 418, 1583, 29889, 13529, 519, 29889, 4397, 29898, 13529, 519, 29961, 29900, 2314, 13, 1678, 1583, 29889, 271, 4835, 353, 2391, 2776, 4178, 4835, 29898, 271, 4835, 29892, 5519, 1311, 29889, 29883, 431, 287, 326, 2673, 29961, 29900, 1402, 29871, 29900, 29892, 29871, 29900, 16272, 29900, 29892, 1583, 29889, 29883, 431, 287, 326, 2673, 29961, 29896, 1402, 29871, 29900, 16272, 29900, 29892, 29871, 29900, 29892, 1583, 29889, 29883, 431, 287, 326, 2673, 29961, 29906, 5262, 2314, 13, 268, 13, 29871, 822, 3617, 1293, 2776, 4178, 4835, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 271, 4835, 29936, 13, 13, 29871, 822, 3617, 29924, 586, 519, 4736, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 13529, 519, 29936, 13, 13, 29871, 822, 3617, 29907, 4003, 3505, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 29883, 431, 287, 326, 2673, 29936, 13, 13, 29871, 396, 262, 383, 12665, 4986, 1660, 6007, 8452, 13, 29871, 822, 3617, 14448, 3505, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 10568, 29936, 13, 13, 29871, 396, 262, 383, 12665, 4986, 1660, 6007, 8452, 13, 29871, 822, 3617, 4763, 2481, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 2962, 2230, 29936, 13, 259, 13, 29871, 822, 3617, 29968, 21979, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 29895, 21979, 13, 13, 29871, 822, 3617, 29940, 29916, 29885, 324, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 23818, 29885, 324, 13, 13, 29871, 822, 3617, 29934, 645, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 29878, 645, 13, 13, 29871, 396, 11516, 260, 786, 1379, 310, 518, 29876, 8678, 29892, 921, 19581, 29892, 9358, 4172, 29892, 4365, 1594, 29962, 13, 29871, 822, 3617, 29931, 2108, 538, 29967, 2873, 9329, 29898, 1311, 1125, 13, 259, 736, 1583, 29889, 29880, 2108, 538, 29967, 2873, 9329, 29936, 13, 13, 13, 418, 13, 29871, 835, 13383, 13383, 4136, 13, 29871, 396, 3986, 349, 3960, 29963, 3040, 383, 28700, 29903, 3986, 396, 13, 29871, 835, 13383, 13383, 4136, 13, 29871, 396, 949, 29879, 263, 1196, 13, 29871, 822, 7523, 3542, 29898, 1311, 29892, 285, 1125, 13, 1678, 736, 285, 29889, 949, 1220, 890, 13, 13, 29871, 396, 949, 29879, 525, 20326, 29915, 11920, 29871, 13, 29871, 822, 7523, 2928, 29898, 1311, 29892, 285, 29892, 3694, 1125, 13, 1678, 1121, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 20326, 1125, 13, 418, 1353, 353, 6629, 13, 418, 521, 353, 285, 29889, 949, 29898, 29896, 29897, 13, 418, 565, 521, 26359, 1115, 396, 29923, 9800, 13, 4706, 736, 1121, 13, 418, 1550, 521, 297, 1347, 29889, 1332, 3246, 3535, 29901, 13, 4706, 521, 353, 285, 29889, 949, 29898, 29896, 29897, 13, 418, 565, 521, 26359, 1115, 396, 29923, 9800, 13, 4706, 736, 1121, 13, 418, 1550, 521, 451, 297, 1347, 29889, 1332, 3246, 3535, 29901, 13, 4706, 1353, 4619, 521, 13, 4706, 521, 353, 285, 29889, 949, 29898, 29896, 29897, 13, 418, 1121, 29889, 4397, 29898, 524, 29898, 4537, 876, 13, 1678, 736, 1121, 13, 13, 29871, 396, 949, 29879, 525, 20326, 29915, 5685, 1446, 29871, 13, 29871, 822, 7523, 11031, 29898, 1311, 29892, 285, 29892, 3694, 1125, 13, 1678, 1121, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 20326, 1125, 13, 418, 1353, 353, 6629, 13, 418, 521, 353, 285, 29889, 949, 29898, 29896, 29897, 13, 418, 565, 521, 26359, 1115, 396, 29923, 9800, 13, 4706, 736, 1121, 13, 418, 1550, 521, 297, 1347, 29889, 1332, 3246, 3535, 29901, 13, 4706, 521, 353, 285, 29889, 949, 29898, 29896, 29897, 13, 418, 1550, 521, 451, 297, 1347, 29889, 1332, 3246, 3535, 29901, 13, 4706, 1353, 4619, 521, 13, 4706, 521, 353, 285, 29889, 949, 29898, 29896, 29897, 13, 418, 1121, 29889, 4397, 29898, 7411, 29898, 4537, 876, 13, 1678, 736, 1121, 13, 2 ]
src/sofie_pd_component/dns/model/__init__.py
SOFIE-project/Provisioning-and-Discovery
1
155184
""" # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed # with this work for additional information regarding copyright # ownership. The ASF licenses this file to you under the Apache # License, Version 2.0 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of the # License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. """ import json from decimal import Decimal import os import time import uuid from datetime import datetime import boto3 from botocore.exceptions import ClientError class DB(object): def __init__(self): super(DB, self).__init__() self.dynamodb = boto3.resource("dynamodb", region_name="us-west-1") def add_beacon(self, data): table = self.dynamodb.Table("iotbeacon") beacon = { "ID": str(data.get("mac", None)), # mac address "UUID": data.get("UUID", None), "major": data.get("major", None), "minor": data.get("minor", None), "gps": data.get("gps", None), "created_at": str(datetime.utcnow()), } try: response = table.put_item(Item=beacon, ReturnValues="ALL_OLD") return response except ClientError as e: print("Unexpected error: %s" % e) def get_beacon(self, Id): table = self.dynamodb.Table("iotbeacon") try: response = table.get_item(Key={"ID": Id}) return response except ClientError as e: print("Unexpected error: %s" % e)
[ 1, 9995, 13, 29937, 10413, 21144, 304, 278, 13380, 18540, 10606, 313, 3289, 29943, 29897, 1090, 697, 470, 901, 13, 29937, 17737, 3406, 19405, 8571, 4110, 29889, 29871, 2823, 278, 6058, 12107, 934, 13235, 13, 29937, 411, 445, 664, 363, 5684, 2472, 11211, 3509, 1266, 13, 29937, 27428, 29889, 29871, 450, 3339, 29943, 7794, 11259, 445, 934, 304, 366, 1090, 278, 13380, 13, 29937, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 451, 671, 445, 934, 13, 29937, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 29871, 887, 1122, 4017, 263, 3509, 310, 278, 13, 29937, 19245, 472, 13, 29937, 13, 29937, 259, 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, 13, 29937, 2411, 2957, 29889, 29871, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 13, 29937, 11239, 322, 27028, 1090, 278, 19245, 29889, 13, 13, 15945, 29908, 13, 13, 5215, 4390, 13, 3166, 13677, 1053, 3826, 3039, 13, 5215, 2897, 13, 5215, 931, 13, 5215, 318, 5416, 13, 3166, 12865, 1053, 12865, 13, 13, 5215, 289, 3747, 29941, 13, 3166, 9225, 542, 487, 29889, 11739, 29879, 1053, 12477, 2392, 13, 13, 13, 1990, 6535, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 4051, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 29881, 2926, 10396, 353, 289, 3747, 29941, 29889, 10314, 703, 29881, 2926, 10396, 613, 5120, 29918, 978, 543, 375, 29899, 5933, 29899, 29896, 1159, 13, 13, 1678, 822, 788, 29918, 915, 23074, 29898, 1311, 29892, 848, 1125, 13, 4706, 1591, 353, 1583, 29889, 29881, 2926, 10396, 29889, 3562, 703, 24414, 915, 23074, 1159, 13, 4706, 367, 23074, 353, 426, 13, 9651, 376, 1367, 1115, 851, 29898, 1272, 29889, 657, 703, 8628, 613, 6213, 8243, 29871, 396, 5825, 3211, 13, 9651, 376, 29965, 11150, 1115, 848, 29889, 657, 703, 29965, 11150, 613, 6213, 511, 13, 9651, 376, 21355, 1115, 848, 29889, 657, 703, 21355, 613, 6213, 511, 13, 9651, 376, 1195, 272, 1115, 848, 29889, 657, 703, 1195, 272, 613, 6213, 511, 13, 9651, 376, 29887, 567, 1115, 848, 29889, 657, 703, 29887, 567, 613, 6213, 511, 13, 9651, 376, 11600, 29918, 271, 1115, 851, 29898, 12673, 29889, 329, 29883, 3707, 25739, 13, 4706, 500, 13, 4706, 1018, 29901, 13, 9651, 2933, 353, 1591, 29889, 649, 29918, 667, 29898, 2001, 29922, 915, 23074, 29892, 7106, 9065, 543, 9818, 29918, 5607, 29928, 1159, 13, 9651, 736, 2933, 13, 4706, 5174, 12477, 2392, 408, 321, 29901, 13, 9651, 1596, 703, 29965, 13996, 6021, 1059, 29901, 1273, 29879, 29908, 1273, 321, 29897, 13, 13, 1678, 822, 679, 29918, 915, 23074, 29898, 1311, 29892, 5163, 1125, 13, 4706, 1591, 353, 1583, 29889, 29881, 2926, 10396, 29889, 3562, 703, 24414, 915, 23074, 1159, 13, 4706, 1018, 29901, 13, 9651, 2933, 353, 1591, 29889, 657, 29918, 667, 29898, 2558, 3790, 29908, 1367, 1115, 5163, 1800, 13, 9651, 736, 2933, 13, 4706, 5174, 12477, 2392, 408, 321, 29901, 13, 9651, 1596, 703, 29965, 13996, 6021, 1059, 29901, 1273, 29879, 29908, 1273, 321, 29897, 13, 2 ]
tb/test_arp_64.py
sergachev/verilog-ethernet
2
8548
<reponame>sergachev/verilog-ethernet #!/usr/bin/env python """ Copyright (c) 2014-2018 <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. """ from myhdl import * import os import axis_ep import eth_ep import arp_ep module = 'arp_64' testbench = 'test_%s' % module srcs = [] srcs.append("../rtl/%s.v" % module) srcs.append("../rtl/lfsr.v") srcs.append("../rtl/arp_cache.v") srcs.append("../rtl/arp_eth_rx_64.v") srcs.append("../rtl/arp_eth_tx_64.v") srcs.append("%s.v" % testbench) src = ' '.join(srcs) build_cmd = "iverilog -o %s.vvp %s" % (testbench, src) def bench(): # Inputs clk = Signal(bool(0)) rst = Signal(bool(0)) current_test = Signal(intbv(0)[8:]) s_eth_hdr_valid = Signal(bool(0)) s_eth_dest_mac = Signal(intbv(0)[48:]) s_eth_src_mac = Signal(intbv(0)[48:]) s_eth_type = Signal(intbv(0)[16:]) s_eth_payload_axis_tdata = Signal(intbv(0)[64:]) s_eth_payload_axis_tkeep = Signal(intbv(0)[8:]) s_eth_payload_axis_tvalid = Signal(bool(0)) s_eth_payload_axis_tlast = Signal(bool(0)) s_eth_payload_axis_tuser = Signal(bool(0)) m_eth_payload_axis_tready = Signal(bool(0)) m_eth_hdr_ready = Signal(bool(0)) arp_request_valid = Signal(bool(0)) arp_request_ip = Signal(intbv(0)[32:]) arp_response_ready = Signal(bool(0)) local_mac = Signal(intbv(0)[48:]) local_ip = Signal(intbv(0)[32:]) gateway_ip = Signal(intbv(0)[32:]) subnet_mask = Signal(intbv(0)[32:]) clear_cache = Signal(bool(0)) # Outputs s_eth_hdr_ready = Signal(bool(0)) s_eth_payload_axis_tready = Signal(bool(0)) m_eth_hdr_valid = Signal(bool(0)) m_eth_dest_mac = Signal(intbv(0)[48:]) m_eth_src_mac = Signal(intbv(0)[48:]) m_eth_type = Signal(intbv(0)[16:]) m_eth_payload_axis_tdata = Signal(intbv(0)[64:]) m_eth_payload_axis_tkeep = Signal(intbv(0)[8:]) m_eth_payload_axis_tvalid = Signal(bool(0)) m_eth_payload_axis_tlast = Signal(bool(0)) m_eth_payload_axis_tuser = Signal(bool(0)) arp_request_ready = Signal(bool(0)) arp_response_valid = Signal(bool(0)) arp_response_error = Signal(bool(0)) arp_response_mac = Signal(intbv(0)[48:]) # sources and sinks eth_source_pause = Signal(bool(0)) eth_sink_pause = Signal(bool(0)) eth_source = eth_ep.EthFrameSource() eth_source_logic = eth_source.create_logic( clk, rst, eth_hdr_ready=s_eth_hdr_ready, eth_hdr_valid=s_eth_hdr_valid, eth_dest_mac=s_eth_dest_mac, eth_src_mac=s_eth_src_mac, eth_type=s_eth_type, eth_payload_tdata=s_eth_payload_axis_tdata, eth_payload_tkeep=s_eth_payload_axis_tkeep, eth_payload_tvalid=s_eth_payload_axis_tvalid, eth_payload_tready=s_eth_payload_axis_tready, eth_payload_tlast=s_eth_payload_axis_tlast, eth_payload_tuser=s_eth_payload_axis_tuser, pause=eth_source_pause, name='eth_source' ) eth_sink = eth_ep.EthFrameSink() eth_sink_logic = eth_sink.create_logic( clk, rst, eth_hdr_ready=m_eth_hdr_ready, eth_hdr_valid=m_eth_hdr_valid, eth_dest_mac=m_eth_dest_mac, eth_src_mac=m_eth_src_mac, eth_type=m_eth_type, eth_payload_tdata=m_eth_payload_axis_tdata, eth_payload_tkeep=m_eth_payload_axis_tkeep, eth_payload_tvalid=m_eth_payload_axis_tvalid, eth_payload_tready=m_eth_payload_axis_tready, eth_payload_tlast=m_eth_payload_axis_tlast, eth_payload_tuser=m_eth_payload_axis_tuser, pause=eth_sink_pause, name='eth_sink' ) arp_request_source = axis_ep.AXIStreamSource() arp_request_source_logic = arp_request_source.create_logic( clk, rst, tdata=(arp_request_ip,), tvalid=arp_request_valid, tready=arp_request_ready, name='arp_request_source' ) arp_response_sink = axis_ep.AXIStreamSink() arp_response_sink_logic = arp_response_sink.create_logic( clk, rst, tdata=(arp_response_error, arp_response_mac), tvalid=arp_response_valid, tready=arp_response_ready, name='arp_response_sink' ) # DUT if os.system(build_cmd): raise Exception("Error running build command") dut = Cosimulation( "vvp -m myhdl %s.vvp -lxt2" % testbench, clk=clk, rst=rst, current_test=current_test, s_eth_hdr_valid=s_eth_hdr_valid, s_eth_hdr_ready=s_eth_hdr_ready, s_eth_dest_mac=s_eth_dest_mac, s_eth_src_mac=s_eth_src_mac, s_eth_type=s_eth_type, s_eth_payload_axis_tdata=s_eth_payload_axis_tdata, s_eth_payload_axis_tkeep=s_eth_payload_axis_tkeep, s_eth_payload_axis_tvalid=s_eth_payload_axis_tvalid, s_eth_payload_axis_tready=s_eth_payload_axis_tready, s_eth_payload_axis_tlast=s_eth_payload_axis_tlast, s_eth_payload_axis_tuser=s_eth_payload_axis_tuser, m_eth_hdr_valid=m_eth_hdr_valid, m_eth_hdr_ready=m_eth_hdr_ready, m_eth_dest_mac=m_eth_dest_mac, m_eth_src_mac=m_eth_src_mac, m_eth_type=m_eth_type, m_eth_payload_axis_tdata=m_eth_payload_axis_tdata, m_eth_payload_axis_tkeep=m_eth_payload_axis_tkeep, m_eth_payload_axis_tvalid=m_eth_payload_axis_tvalid, m_eth_payload_axis_tready=m_eth_payload_axis_tready, m_eth_payload_axis_tlast=m_eth_payload_axis_tlast, m_eth_payload_axis_tuser=m_eth_payload_axis_tuser, arp_request_valid=arp_request_valid, arp_request_ready=arp_request_ready, arp_request_ip=arp_request_ip, arp_response_valid=arp_response_valid, arp_response_ready=arp_response_ready, arp_response_error=arp_response_error, arp_response_mac=arp_response_mac, local_mac=local_mac, local_ip=local_ip, gateway_ip=gateway_ip, subnet_mask=subnet_mask, clear_cache=clear_cache ) @always(delay(4)) def clkgen(): clk.next = not clk @instance def check(): yield delay(100) yield clk.posedge rst.next = 1 yield clk.posedge rst.next = 0 yield clk.posedge yield delay(100) yield clk.posedge yield clk.posedge local_mac.next = 0xDAD1D2D3D4D5 local_ip.next = 0xc0a80165 gateway_ip.next = 0xc0a80101 subnet_mask.next = 0xFFFFFF00 yield clk.posedge print("test 1: ARP request") current_test.next = 1 test_frame = arp_ep.ARPFrame() test_frame.eth_dest_mac = 0xFFFFFFFFFFFF test_frame.eth_src_mac = 0x5A5152535455 test_frame.eth_type = 0x0806 test_frame.arp_htype = 0x0001 test_frame.arp_ptype = 0x0800 test_frame.arp_hlen = 6 test_frame.arp_plen = 4 test_frame.arp_oper = 1 test_frame.arp_sha = 0x5A5152535455 test_frame.arp_spa = 0xc0a80164 test_frame.arp_tha = 0x000000000000 test_frame.arp_tpa = 0xc0a80165 eth_source.send(test_frame.build_eth()) yield eth_sink.wait() rx_frame = eth_sink.recv() check_frame = arp_ep.ARPFrame() check_frame.parse_eth(rx_frame) assert check_frame.eth_dest_mac == 0x5A5152535455 assert check_frame.eth_src_mac == 0xDAD1D2D3D4D5 assert check_frame.eth_type == 0x0806 assert check_frame.arp_htype == 0x0001 assert check_frame.arp_ptype == 0x0800 assert check_frame.arp_hlen == 6 assert check_frame.arp_plen == 4 assert check_frame.arp_oper == 2 assert check_frame.arp_sha == 0xDAD1D2D3D4D5 assert check_frame.arp_spa == 0xc0a80165 assert check_frame.arp_tha == 0x5A5152535455 assert check_frame.arp_tpa == 0xc0a80164 yield delay(100) yield clk.posedge print("test 2: Cached read") current_test.next = 2 arp_request_source.send([(0xc0a80164,)]) yield arp_response_sink.wait() err, mac = arp_response_sink.recv().data[0] assert not err assert mac == 0x5A5152535455 yield delay(100) yield clk.posedge print("test 3: Unached read") current_test.next = 3 arp_request_source.send([(0xc0a80166,)]) # wait for ARP request packet yield eth_sink.wait() rx_frame = eth_sink.recv() check_frame = arp_ep.ARPFrame() check_frame.parse_eth(rx_frame) assert check_frame.eth_dest_mac == 0xFFFFFFFFFFFF assert check_frame.eth_src_mac == 0xDAD1D2D3D4D5 assert check_frame.eth_type == 0x0806 assert check_frame.arp_htype == 0x0001 assert check_frame.arp_ptype == 0x0800 assert check_frame.arp_hlen == 6 assert check_frame.arp_plen == 4 assert check_frame.arp_oper == 1 assert check_frame.arp_sha == 0xDAD1D2D3D4D5 assert check_frame.arp_spa == 0xc0a80165 assert check_frame.arp_tha == 0x000000000000 assert check_frame.arp_tpa == 0xc0a80166 # generate response test_frame = arp_ep.ARPFrame() test_frame.eth_dest_mac = 0xDAD1D2D3D4D5 test_frame.eth_src_mac = 0x6A6162636465 test_frame.eth_type = 0x0806 test_frame.arp_htype = 0x0001 test_frame.arp_ptype = 0x0800 test_frame.arp_hlen = 6 test_frame.arp_plen = 4 test_frame.arp_oper = 2 test_frame.arp_sha = 0x6A6162636465 test_frame.arp_spa = 0xc0a80166 test_frame.arp_tha = 0xDAD1D2D3D4D5 test_frame.arp_tpa = 0xc0a80165 eth_source.send(test_frame.build_eth()) # wait for lookup yield arp_response_sink.wait() err, mac = arp_response_sink.recv().data[0] assert not err assert mac == 0x6A6162636465 yield delay(100) yield clk.posedge print("test 4: Unached read, outside of subnet") current_test.next = 4 arp_request_source.send([(0x08080808,)]) # wait for ARP request packet yield eth_sink.wait() rx_frame = eth_sink.recv() check_frame = arp_ep.ARPFrame() check_frame.parse_eth(rx_frame) assert check_frame.eth_dest_mac == 0xFFFFFFFFFFFF assert check_frame.eth_src_mac == 0xDAD1D2D3D4D5 assert check_frame.eth_type == 0x0806 assert check_frame.arp_htype == 0x0001 assert check_frame.arp_ptype == 0x0800 assert check_frame.arp_hlen == 6 assert check_frame.arp_plen == 4 assert check_frame.arp_oper == 1 assert check_frame.arp_sha == 0xDAD1D2D3D4D5 assert check_frame.arp_spa == 0xc0a80165 assert check_frame.arp_tha == 0x000000000000 assert check_frame.arp_tpa == 0xc0a80101 # generate response test_frame = arp_ep.ARPFrame() test_frame.eth_dest_mac = 0xDAD1D2D3D4D5 test_frame.eth_src_mac = 0xAABBCCDDEEFF test_frame.eth_type = 0x0806 test_frame.arp_htype = 0x0001 test_frame.arp_ptype = 0x0800 test_frame.arp_hlen = 6 test_frame.arp_plen = 4 test_frame.arp_oper = 2 test_frame.arp_sha = 0xAABBCCDDEEFF test_frame.arp_spa = 0xc0a80101 test_frame.arp_tha = 0xDAD1D2D3D4D5 test_frame.arp_tpa = 0xc0a80165 eth_source.send(test_frame.build_eth()) # wait for lookup yield arp_response_sink.wait() err, mac = arp_response_sink.recv().data[0] assert not err assert mac == 0xAABBCCDDEEFF yield delay(100) yield clk.posedge print("test 5: Unached read, timeout") current_test.next = 5 arp_request_source.send([(0xc0a80167,)]) yield arp_response_sink.wait() err, mac = arp_response_sink.recv().data[0] assert err # check for 4 ARP requests assert eth_sink.count() == 4 while not eth_sink.empty(): rx_frame = eth_sink.recv() check_frame = arp_ep.ARPFrame() check_frame.parse_eth(rx_frame) assert check_frame.eth_dest_mac == 0xFFFFFFFFFFFF assert check_frame.eth_src_mac == 0xDAD1D2D3D4D5 assert check_frame.eth_type == 0x0806 assert check_frame.arp_htype == 0x0001 assert check_frame.arp_ptype == 0x0800 assert check_frame.arp_hlen == 6 assert check_frame.arp_plen == 4 assert check_frame.arp_oper == 1 assert check_frame.arp_sha == 0xDAD1D2D3D4D5 assert check_frame.arp_spa == 0xc0a80165 assert check_frame.arp_tha == 0x000000000000 assert check_frame.arp_tpa == 0xc0a80167 yield delay(100) yield clk.posedge print("test 6: Broadcast") current_test.next = 6 # subnet broadcast arp_request_source.send([(0xc0a801ff,)]) yield arp_response_sink.wait() err, mac = arp_response_sink.recv().data[0] assert not err assert mac == 0xffffffffffff # general broadcast arp_request_source.send([(0xffffffff,)]) yield arp_response_sink.wait() err, mac = arp_response_sink.recv().data[0] assert not err assert mac == 0xffffffffffff yield delay(100) raise StopSimulation return instances() def test_bench(): sim = Simulation(bench()) sim.run() if __name__ == '__main__': print("Running test...") test_bench()
[ 1, 529, 276, 1112, 420, 29958, 643, 29887, 1829, 29894, 29914, 369, 26140, 29899, 621, 824, 300, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 13, 11882, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29946, 29899, 29906, 29900, 29896, 29947, 529, 5813, 29958, 13, 13, 27293, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 974, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 262, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 517, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 9708, 583, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 29888, 595, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 13, 1576, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 13, 497, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 13, 28350, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 29902, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 13, 29943, 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, 20656, 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, 5265, 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, 12015, 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, 13, 28350, 7791, 7818, 12982, 1525, 29889, 13, 13, 15945, 29908, 13, 13, 3166, 590, 29882, 11671, 1053, 334, 13, 5215, 2897, 13, 13, 5215, 9685, 29918, 1022, 13, 5215, 11314, 29918, 1022, 13, 5215, 564, 29886, 29918, 1022, 13, 13, 5453, 353, 525, 6834, 29918, 29953, 29946, 29915, 13, 1688, 1785, 305, 353, 525, 1688, 29918, 29995, 29879, 29915, 1273, 3883, 13, 13, 4351, 29879, 353, 5159, 13, 13, 4351, 29879, 29889, 4397, 703, 6995, 2273, 29880, 22584, 29879, 29889, 29894, 29908, 1273, 3883, 29897, 13, 4351, 29879, 29889, 4397, 703, 6995, 2273, 29880, 29914, 29880, 5847, 29878, 29889, 29894, 1159, 13, 4351, 29879, 29889, 4397, 703, 6995, 2273, 29880, 29914, 6834, 29918, 8173, 29889, 29894, 1159, 13, 4351, 29879, 29889, 4397, 703, 6995, 2273, 29880, 29914, 6834, 29918, 621, 29918, 17697, 29918, 29953, 29946, 29889, 29894, 1159, 13, 4351, 29879, 29889, 4397, 703, 6995, 2273, 29880, 29914, 6834, 29918, 621, 29918, 7508, 29918, 29953, 29946, 29889, 29894, 1159, 13, 4351, 29879, 29889, 4397, 11702, 29879, 29889, 29894, 29908, 1273, 1243, 1785, 305, 29897, 13, 13, 4351, 353, 525, 15300, 7122, 29898, 4351, 29879, 29897, 13, 13, 4282, 29918, 9006, 353, 376, 2147, 26140, 448, 29877, 1273, 29879, 29889, 29894, 29894, 29886, 1273, 29879, 29908, 1273, 313, 1688, 1785, 305, 29892, 4765, 29897, 13, 13, 1753, 3856, 305, 7295, 13, 13, 1678, 396, 10567, 29879, 13, 1678, 1067, 29895, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 364, 303, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 1857, 29918, 1688, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29947, 29901, 2314, 13, 13, 1678, 269, 29918, 621, 29918, 29882, 7707, 29918, 3084, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 269, 29918, 621, 29918, 7854, 29918, 8628, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29946, 29947, 29901, 2314, 13, 1678, 269, 29918, 621, 29918, 4351, 29918, 8628, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29946, 29947, 29901, 2314, 13, 1678, 269, 29918, 621, 29918, 1853, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29896, 29953, 29901, 2314, 13, 1678, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29953, 29946, 29901, 2314, 13, 1678, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29947, 29901, 2314, 13, 1678, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 13, 1678, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 286, 29918, 621, 29918, 29882, 7707, 29918, 2040, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 13, 1678, 564, 29886, 29918, 3827, 29918, 3084, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 564, 29886, 29918, 3827, 29918, 666, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29941, 29906, 29901, 2314, 13, 1678, 564, 29886, 29918, 5327, 29918, 2040, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 13, 1678, 1887, 29918, 8628, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29946, 29947, 29901, 2314, 13, 1678, 1887, 29918, 666, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29941, 29906, 29901, 2314, 13, 1678, 28646, 29918, 666, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29941, 29906, 29901, 2314, 13, 1678, 1014, 1212, 29918, 13168, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29941, 29906, 29901, 2314, 13, 1678, 2821, 29918, 8173, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 13, 1678, 396, 10604, 29879, 13, 1678, 269, 29918, 621, 29918, 29882, 7707, 29918, 2040, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 13, 1678, 286, 29918, 621, 29918, 29882, 7707, 29918, 3084, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 286, 29918, 621, 29918, 7854, 29918, 8628, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29946, 29947, 29901, 2314, 13, 1678, 286, 29918, 621, 29918, 4351, 29918, 8628, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29946, 29947, 29901, 2314, 13, 1678, 286, 29918, 621, 29918, 1853, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29896, 29953, 29901, 2314, 13, 1678, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29953, 29946, 29901, 2314, 13, 1678, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29947, 29901, 2314, 13, 1678, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 13, 1678, 564, 29886, 29918, 3827, 29918, 2040, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 564, 29886, 29918, 5327, 29918, 3084, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 564, 29886, 29918, 5327, 29918, 2704, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 564, 29886, 29918, 5327, 29918, 8628, 353, 9954, 284, 29898, 524, 29890, 29894, 29898, 29900, 9601, 29946, 29947, 29901, 2314, 13, 13, 1678, 396, 8974, 322, 269, 19363, 13, 1678, 11314, 29918, 4993, 29918, 29886, 1071, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 1678, 11314, 29918, 29879, 682, 29918, 29886, 1071, 353, 9954, 284, 29898, 11227, 29898, 29900, 876, 13, 13, 1678, 11314, 29918, 4993, 353, 11314, 29918, 1022, 29889, 29923, 386, 4308, 4435, 580, 13, 13, 1678, 11314, 29918, 4993, 29918, 19227, 353, 11314, 29918, 4993, 29889, 3258, 29918, 19227, 29898, 13, 4706, 1067, 29895, 29892, 13, 4706, 364, 303, 29892, 13, 4706, 11314, 29918, 29882, 7707, 29918, 2040, 29922, 29879, 29918, 621, 29918, 29882, 7707, 29918, 2040, 29892, 13, 4706, 11314, 29918, 29882, 7707, 29918, 3084, 29922, 29879, 29918, 621, 29918, 29882, 7707, 29918, 3084, 29892, 13, 4706, 11314, 29918, 7854, 29918, 8628, 29922, 29879, 29918, 621, 29918, 7854, 29918, 8628, 29892, 13, 4706, 11314, 29918, 4351, 29918, 8628, 29922, 29879, 29918, 621, 29918, 4351, 29918, 8628, 29892, 13, 4706, 11314, 29918, 1853, 29922, 29879, 29918, 621, 29918, 1853, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 1272, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 17462, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 3084, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 2040, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 4230, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 1792, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 29892, 13, 4706, 19957, 29922, 621, 29918, 4993, 29918, 29886, 1071, 29892, 13, 4706, 1024, 2433, 621, 29918, 4993, 29915, 13, 1678, 1723, 13, 13, 1678, 11314, 29918, 29879, 682, 353, 11314, 29918, 1022, 29889, 29923, 386, 4308, 29903, 682, 580, 13, 13, 1678, 11314, 29918, 29879, 682, 29918, 19227, 353, 11314, 29918, 29879, 682, 29889, 3258, 29918, 19227, 29898, 13, 4706, 1067, 29895, 29892, 13, 4706, 364, 303, 29892, 13, 4706, 11314, 29918, 29882, 7707, 29918, 2040, 29922, 29885, 29918, 621, 29918, 29882, 7707, 29918, 2040, 29892, 13, 4706, 11314, 29918, 29882, 7707, 29918, 3084, 29922, 29885, 29918, 621, 29918, 29882, 7707, 29918, 3084, 29892, 13, 4706, 11314, 29918, 7854, 29918, 8628, 29922, 29885, 29918, 621, 29918, 7854, 29918, 8628, 29892, 13, 4706, 11314, 29918, 4351, 29918, 8628, 29922, 29885, 29918, 621, 29918, 4351, 29918, 8628, 29892, 13, 4706, 11314, 29918, 1853, 29922, 29885, 29918, 621, 29918, 1853, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 1272, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 17462, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 3084, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 2040, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 4230, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 29892, 13, 4706, 11314, 29918, 23813, 29918, 29873, 1792, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 29892, 13, 4706, 19957, 29922, 621, 29918, 29879, 682, 29918, 29886, 1071, 29892, 13, 4706, 1024, 2433, 621, 29918, 29879, 682, 29915, 13, 1678, 1723, 13, 13, 1678, 564, 29886, 29918, 3827, 29918, 4993, 353, 9685, 29918, 1022, 29889, 23867, 3835, 4435, 580, 13, 13, 1678, 564, 29886, 29918, 3827, 29918, 4993, 29918, 19227, 353, 564, 29886, 29918, 3827, 29918, 4993, 29889, 3258, 29918, 19227, 29898, 13, 4706, 1067, 29895, 29892, 13, 4706, 364, 303, 29892, 13, 4706, 260, 1272, 7607, 6834, 29918, 3827, 29918, 666, 29892, 511, 13, 4706, 260, 3084, 29922, 6834, 29918, 3827, 29918, 3084, 29892, 13, 4706, 260, 2040, 29922, 6834, 29918, 3827, 29918, 2040, 29892, 13, 4706, 1024, 2433, 6834, 29918, 3827, 29918, 4993, 29915, 13, 1678, 1723, 13, 13, 1678, 564, 29886, 29918, 5327, 29918, 29879, 682, 353, 9685, 29918, 1022, 29889, 23867, 3835, 29903, 682, 580, 13, 13, 1678, 564, 29886, 29918, 5327, 29918, 29879, 682, 29918, 19227, 353, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 3258, 29918, 19227, 29898, 13, 4706, 1067, 29895, 29892, 13, 4706, 364, 303, 29892, 13, 4706, 260, 1272, 7607, 6834, 29918, 5327, 29918, 2704, 29892, 564, 29886, 29918, 5327, 29918, 8628, 511, 13, 4706, 260, 3084, 29922, 6834, 29918, 5327, 29918, 3084, 29892, 13, 4706, 260, 2040, 29922, 6834, 29918, 5327, 29918, 2040, 29892, 13, 4706, 1024, 2433, 6834, 29918, 5327, 29918, 29879, 682, 29915, 13, 1678, 1723, 13, 13, 1678, 396, 360, 2692, 13, 1678, 565, 2897, 29889, 5205, 29898, 4282, 29918, 9006, 1125, 13, 4706, 12020, 8960, 703, 2392, 2734, 2048, 1899, 1159, 13, 13, 1678, 9379, 353, 13526, 326, 2785, 29898, 13, 4706, 376, 29894, 29894, 29886, 448, 29885, 590, 29882, 11671, 1273, 29879, 29889, 29894, 29894, 29886, 448, 29880, 486, 29906, 29908, 1273, 1243, 1785, 305, 29892, 13, 4706, 1067, 29895, 29922, 20495, 29892, 13, 4706, 364, 303, 29922, 29878, 303, 29892, 13, 4706, 1857, 29918, 1688, 29922, 3784, 29918, 1688, 29892, 13, 13, 4706, 269, 29918, 621, 29918, 29882, 7707, 29918, 3084, 29922, 29879, 29918, 621, 29918, 29882, 7707, 29918, 3084, 29892, 13, 4706, 269, 29918, 621, 29918, 29882, 7707, 29918, 2040, 29922, 29879, 29918, 621, 29918, 29882, 7707, 29918, 2040, 29892, 13, 4706, 269, 29918, 621, 29918, 7854, 29918, 8628, 29922, 29879, 29918, 621, 29918, 7854, 29918, 8628, 29892, 13, 4706, 269, 29918, 621, 29918, 4351, 29918, 8628, 29922, 29879, 29918, 621, 29918, 4351, 29918, 8628, 29892, 13, 4706, 269, 29918, 621, 29918, 1853, 29922, 29879, 29918, 621, 29918, 1853, 29892, 13, 4706, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 29892, 13, 4706, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 29892, 13, 4706, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 29892, 13, 4706, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 29892, 13, 4706, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 29892, 13, 4706, 269, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 29922, 29879, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 29892, 13, 13, 4706, 286, 29918, 621, 29918, 29882, 7707, 29918, 3084, 29922, 29885, 29918, 621, 29918, 29882, 7707, 29918, 3084, 29892, 13, 4706, 286, 29918, 621, 29918, 29882, 7707, 29918, 2040, 29922, 29885, 29918, 621, 29918, 29882, 7707, 29918, 2040, 29892, 13, 4706, 286, 29918, 621, 29918, 7854, 29918, 8628, 29922, 29885, 29918, 621, 29918, 7854, 29918, 8628, 29892, 13, 4706, 286, 29918, 621, 29918, 4351, 29918, 8628, 29922, 29885, 29918, 621, 29918, 4351, 29918, 8628, 29892, 13, 4706, 286, 29918, 621, 29918, 1853, 29922, 29885, 29918, 621, 29918, 1853, 29892, 13, 4706, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1272, 29892, 13, 4706, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 17462, 29892, 13, 4706, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 3084, 29892, 13, 4706, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 2040, 29892, 13, 4706, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 4230, 29892, 13, 4706, 286, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 29922, 29885, 29918, 621, 29918, 23813, 29918, 8990, 29918, 29873, 1792, 29892, 13, 13, 4706, 564, 29886, 29918, 3827, 29918, 3084, 29922, 6834, 29918, 3827, 29918, 3084, 29892, 13, 4706, 564, 29886, 29918, 3827, 29918, 2040, 29922, 6834, 29918, 3827, 29918, 2040, 29892, 13, 4706, 564, 29886, 29918, 3827, 29918, 666, 29922, 6834, 29918, 3827, 29918, 666, 29892, 13, 4706, 564, 29886, 29918, 5327, 29918, 3084, 29922, 6834, 29918, 5327, 29918, 3084, 29892, 13, 4706, 564, 29886, 29918, 5327, 29918, 2040, 29922, 6834, 29918, 5327, 29918, 2040, 29892, 13, 4706, 564, 29886, 29918, 5327, 29918, 2704, 29922, 6834, 29918, 5327, 29918, 2704, 29892, 13, 4706, 564, 29886, 29918, 5327, 29918, 8628, 29922, 6834, 29918, 5327, 29918, 8628, 29892, 13, 13, 4706, 1887, 29918, 8628, 29922, 2997, 29918, 8628, 29892, 13, 4706, 1887, 29918, 666, 29922, 2997, 29918, 666, 29892, 13, 4706, 28646, 29918, 666, 29922, 17062, 1582, 29918, 666, 29892, 13, 4706, 1014, 1212, 29918, 13168, 29922, 1491, 1212, 29918, 13168, 29892, 13, 4706, 2821, 29918, 8173, 29922, 8551, 29918, 8173, 13, 1678, 1723, 13, 13, 1678, 732, 21936, 29898, 18829, 29898, 29946, 876, 13, 1678, 822, 1067, 29895, 1885, 7295, 13, 4706, 1067, 29895, 29889, 4622, 353, 451, 1067, 29895, 13, 13, 1678, 732, 8758, 13, 1678, 822, 1423, 7295, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 364, 303, 29889, 4622, 353, 29871, 29896, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 364, 303, 29889, 4622, 353, 29871, 29900, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 1887, 29918, 8628, 29889, 4622, 353, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 1887, 29918, 666, 29889, 4622, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 4706, 28646, 29918, 666, 29889, 4622, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29900, 29896, 13, 4706, 1014, 1212, 29918, 13168, 29889, 4622, 353, 29871, 29900, 29916, 22098, 4198, 29900, 29900, 13, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 1596, 703, 1688, 29871, 29896, 29901, 9033, 29925, 2009, 1159, 13, 4706, 1857, 29918, 1688, 29889, 4622, 353, 29871, 29896, 13, 13, 4706, 1243, 29918, 2557, 353, 564, 29886, 29918, 1022, 29889, 1718, 29925, 4308, 580, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 7854, 29918, 8628, 353, 29871, 29900, 29916, 22098, 22098, 22098, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 4351, 29918, 8628, 353, 29871, 29900, 29916, 29945, 29909, 29945, 29896, 29945, 29906, 29945, 29941, 29945, 29946, 29945, 29945, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 1853, 353, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 400, 668, 353, 29871, 29900, 29916, 29900, 29900, 29900, 29896, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 415, 668, 353, 29871, 29900, 29916, 29900, 29947, 29900, 29900, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 29785, 353, 29871, 29953, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 572, 264, 353, 29871, 29946, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 3372, 353, 29871, 29896, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 17051, 353, 29871, 29900, 29916, 29945, 29909, 29945, 29896, 29945, 29906, 29945, 29941, 29945, 29946, 29945, 29945, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 1028, 29874, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29946, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 15457, 353, 29871, 29900, 29916, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 29873, 3274, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 4706, 11314, 29918, 4993, 29889, 6717, 29898, 1688, 29918, 2557, 29889, 4282, 29918, 621, 3101, 13, 13, 4706, 7709, 11314, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 364, 29916, 29918, 2557, 353, 11314, 29918, 29879, 682, 29889, 3757, 29894, 580, 13, 4706, 1423, 29918, 2557, 353, 564, 29886, 29918, 1022, 29889, 1718, 29925, 4308, 580, 13, 4706, 1423, 29918, 2557, 29889, 5510, 29918, 621, 29898, 17697, 29918, 2557, 29897, 13, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 7854, 29918, 8628, 1275, 29871, 29900, 29916, 29945, 29909, 29945, 29896, 29945, 29906, 29945, 29941, 29945, 29946, 29945, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 4351, 29918, 8628, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 1853, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 400, 668, 1275, 29871, 29900, 29916, 29900, 29900, 29900, 29896, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 415, 668, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29900, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29785, 1275, 29871, 29953, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 572, 264, 1275, 29871, 29946, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 3372, 1275, 29871, 29906, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 17051, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 1028, 29874, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 15457, 1275, 29871, 29900, 29916, 29945, 29909, 29945, 29896, 29945, 29906, 29945, 29941, 29945, 29946, 29945, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29873, 3274, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29946, 13, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 1596, 703, 1688, 29871, 29906, 29901, 315, 3791, 1303, 1159, 13, 4706, 1857, 29918, 1688, 29889, 4622, 353, 29871, 29906, 13, 13, 4706, 564, 29886, 29918, 3827, 29918, 4993, 29889, 6717, 4197, 29898, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29946, 29892, 29897, 2314, 13, 13, 4706, 7709, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 4589, 29892, 5825, 353, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 3757, 29894, 2141, 1272, 29961, 29900, 29962, 13, 13, 4706, 4974, 451, 4589, 13, 4706, 4974, 5825, 1275, 29871, 29900, 29916, 29945, 29909, 29945, 29896, 29945, 29906, 29945, 29941, 29945, 29946, 29945, 29945, 13, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 1596, 703, 1688, 29871, 29941, 29901, 853, 3791, 1303, 1159, 13, 4706, 1857, 29918, 1688, 29889, 4622, 353, 29871, 29941, 13, 13, 4706, 564, 29886, 29918, 3827, 29918, 4993, 29889, 6717, 4197, 29898, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29953, 29892, 29897, 2314, 13, 13, 4706, 396, 4480, 363, 9033, 29925, 2009, 18203, 13, 4706, 7709, 11314, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 364, 29916, 29918, 2557, 353, 11314, 29918, 29879, 682, 29889, 3757, 29894, 580, 13, 4706, 1423, 29918, 2557, 353, 564, 29886, 29918, 1022, 29889, 1718, 29925, 4308, 580, 13, 4706, 1423, 29918, 2557, 29889, 5510, 29918, 621, 29898, 17697, 29918, 2557, 29897, 13, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 7854, 29918, 8628, 1275, 29871, 29900, 29916, 22098, 22098, 22098, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 4351, 29918, 8628, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 1853, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 400, 668, 1275, 29871, 29900, 29916, 29900, 29900, 29900, 29896, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 415, 668, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29900, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29785, 1275, 29871, 29953, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 572, 264, 1275, 29871, 29946, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 3372, 1275, 29871, 29896, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 17051, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 1028, 29874, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 15457, 1275, 29871, 29900, 29916, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29873, 3274, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29953, 13, 13, 4706, 396, 5706, 2933, 13, 4706, 1243, 29918, 2557, 353, 564, 29886, 29918, 1022, 29889, 1718, 29925, 4308, 580, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 7854, 29918, 8628, 353, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 4351, 29918, 8628, 353, 29871, 29900, 29916, 29953, 29909, 29953, 29896, 29953, 29906, 29953, 29941, 29953, 29946, 29953, 29945, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 1853, 353, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 400, 668, 353, 29871, 29900, 29916, 29900, 29900, 29900, 29896, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 415, 668, 353, 29871, 29900, 29916, 29900, 29947, 29900, 29900, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 29785, 353, 29871, 29953, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 572, 264, 353, 29871, 29946, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 3372, 353, 29871, 29906, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 17051, 353, 29871, 29900, 29916, 29953, 29909, 29953, 29896, 29953, 29906, 29953, 29941, 29953, 29946, 29953, 29945, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 1028, 29874, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29953, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 15457, 353, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 29873, 3274, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 4706, 11314, 29918, 4993, 29889, 6717, 29898, 1688, 29918, 2557, 29889, 4282, 29918, 621, 3101, 13, 13, 4706, 396, 4480, 363, 16280, 13, 4706, 7709, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 4589, 29892, 5825, 353, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 3757, 29894, 2141, 1272, 29961, 29900, 29962, 13, 13, 4706, 4974, 451, 4589, 13, 4706, 4974, 5825, 1275, 29871, 29900, 29916, 29953, 29909, 29953, 29896, 29953, 29906, 29953, 29941, 29953, 29946, 29953, 29945, 13, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 1596, 703, 1688, 29871, 29946, 29901, 853, 3791, 1303, 29892, 5377, 310, 1014, 1212, 1159, 13, 4706, 1857, 29918, 1688, 29889, 4622, 353, 29871, 29946, 13, 13, 4706, 564, 29886, 29918, 3827, 29918, 4993, 29889, 6717, 4197, 29898, 29900, 29916, 29900, 29947, 29900, 29947, 29900, 29947, 29900, 29947, 29892, 29897, 2314, 13, 13, 4706, 396, 4480, 363, 9033, 29925, 2009, 18203, 13, 4706, 7709, 11314, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 364, 29916, 29918, 2557, 353, 11314, 29918, 29879, 682, 29889, 3757, 29894, 580, 13, 4706, 1423, 29918, 2557, 353, 564, 29886, 29918, 1022, 29889, 1718, 29925, 4308, 580, 13, 4706, 1423, 29918, 2557, 29889, 5510, 29918, 621, 29898, 17697, 29918, 2557, 29897, 13, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 7854, 29918, 8628, 1275, 29871, 29900, 29916, 22098, 22098, 22098, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 4351, 29918, 8628, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 621, 29918, 1853, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 400, 668, 1275, 29871, 29900, 29916, 29900, 29900, 29900, 29896, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 415, 668, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29900, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29785, 1275, 29871, 29953, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 572, 264, 1275, 29871, 29946, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 3372, 1275, 29871, 29896, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 17051, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 1028, 29874, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 15457, 1275, 29871, 29900, 29916, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 4706, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29873, 3274, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29900, 29896, 13, 13, 4706, 396, 5706, 2933, 13, 4706, 1243, 29918, 2557, 353, 564, 29886, 29918, 1022, 29889, 1718, 29925, 4308, 580, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 7854, 29918, 8628, 353, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 4351, 29918, 8628, 353, 29871, 29900, 29916, 29909, 2882, 29933, 4174, 29928, 2287, 29923, 4198, 13, 4706, 1243, 29918, 2557, 29889, 621, 29918, 1853, 353, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 400, 668, 353, 29871, 29900, 29916, 29900, 29900, 29900, 29896, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 415, 668, 353, 29871, 29900, 29916, 29900, 29947, 29900, 29900, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 29785, 353, 29871, 29953, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 572, 264, 353, 29871, 29946, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 3372, 353, 29871, 29906, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 17051, 353, 29871, 29900, 29916, 29909, 2882, 29933, 4174, 29928, 2287, 29923, 4198, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 1028, 29874, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29900, 29896, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 15457, 353, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 4706, 1243, 29918, 2557, 29889, 6834, 29918, 29873, 3274, 353, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 4706, 11314, 29918, 4993, 29889, 6717, 29898, 1688, 29918, 2557, 29889, 4282, 29918, 621, 3101, 13, 13, 4706, 396, 4480, 363, 16280, 13, 4706, 7709, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 4589, 29892, 5825, 353, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 3757, 29894, 2141, 1272, 29961, 29900, 29962, 13, 13, 4706, 4974, 451, 4589, 13, 4706, 4974, 5825, 1275, 29871, 29900, 29916, 29909, 2882, 29933, 4174, 29928, 2287, 29923, 4198, 13, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 1596, 703, 1688, 29871, 29945, 29901, 853, 3791, 1303, 29892, 11815, 1159, 13, 4706, 1857, 29918, 1688, 29889, 4622, 353, 29871, 29945, 13, 13, 4706, 564, 29886, 29918, 3827, 29918, 4993, 29889, 6717, 4197, 29898, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29955, 29892, 29897, 2314, 13, 13, 4706, 7709, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 4589, 29892, 5825, 353, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 3757, 29894, 2141, 1272, 29961, 29900, 29962, 13, 13, 4706, 4974, 4589, 13, 13, 4706, 396, 1423, 363, 29871, 29946, 9033, 29925, 7274, 13, 4706, 4974, 11314, 29918, 29879, 682, 29889, 2798, 580, 1275, 29871, 29946, 13, 13, 4706, 1550, 451, 11314, 29918, 29879, 682, 29889, 6310, 7295, 13, 9651, 364, 29916, 29918, 2557, 353, 11314, 29918, 29879, 682, 29889, 3757, 29894, 580, 13, 13, 9651, 1423, 29918, 2557, 353, 564, 29886, 29918, 1022, 29889, 1718, 29925, 4308, 580, 13, 9651, 1423, 29918, 2557, 29889, 5510, 29918, 621, 29898, 17697, 29918, 2557, 29897, 13, 13, 9651, 4974, 1423, 29918, 2557, 29889, 621, 29918, 7854, 29918, 8628, 1275, 29871, 29900, 29916, 22098, 22098, 22098, 13, 9651, 4974, 1423, 29918, 2557, 29889, 621, 29918, 4351, 29918, 8628, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 9651, 4974, 1423, 29918, 2557, 29889, 621, 29918, 1853, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 400, 668, 1275, 29871, 29900, 29916, 29900, 29900, 29900, 29896, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 415, 668, 1275, 29871, 29900, 29916, 29900, 29947, 29900, 29900, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29785, 1275, 29871, 29953, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 572, 264, 1275, 29871, 29946, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 3372, 1275, 29871, 29896, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 17051, 1275, 29871, 29900, 29916, 29928, 3035, 29896, 29928, 29906, 29928, 29941, 29928, 29946, 29928, 29945, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 1028, 29874, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29945, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 15457, 1275, 29871, 29900, 29916, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 9651, 4974, 1423, 29918, 2557, 29889, 6834, 29918, 29873, 3274, 1275, 29871, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 29953, 29955, 13, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 13, 4706, 7709, 1067, 29895, 29889, 4752, 479, 13, 4706, 1596, 703, 1688, 29871, 29953, 29901, 25484, 1159, 13, 4706, 1857, 29918, 1688, 29889, 4622, 353, 29871, 29953, 13, 13, 4706, 396, 1014, 1212, 12672, 13, 4706, 564, 29886, 29918, 3827, 29918, 4993, 29889, 6717, 4197, 29898, 29900, 21791, 29900, 29874, 29947, 29900, 29896, 600, 29892, 29897, 2314, 13, 13, 4706, 7709, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 4589, 29892, 5825, 353, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 3757, 29894, 2141, 1272, 29961, 29900, 29962, 13, 13, 4706, 4974, 451, 4589, 13, 4706, 4974, 5825, 1275, 29871, 29900, 29916, 17156, 17156, 17156, 13, 13, 4706, 396, 2498, 12672, 13, 4706, 564, 29886, 29918, 3827, 29918, 4993, 29889, 6717, 4197, 29898, 29900, 29916, 17156, 17156, 29892, 29897, 2314, 13, 13, 4706, 7709, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 10685, 580, 13, 4706, 4589, 29892, 5825, 353, 564, 29886, 29918, 5327, 29918, 29879, 682, 29889, 3757, 29894, 2141, 1272, 29961, 29900, 29962, 13, 13, 4706, 4974, 451, 4589, 13, 4706, 4974, 5825, 1275, 29871, 29900, 29916, 17156, 17156, 17156, 13, 13, 4706, 7709, 9055, 29898, 29896, 29900, 29900, 29897, 13, 13, 4706, 12020, 22303, 8942, 2785, 13, 13, 1678, 736, 8871, 580, 13, 13, 1753, 1243, 29918, 1785, 305, 7295, 13, 1678, 1027, 353, 3439, 2785, 29898, 1785, 305, 3101, 13, 1678, 1027, 29889, 3389, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1596, 703, 27795, 1243, 856, 1159, 13, 1678, 1243, 29918, 1785, 305, 580, 13, 13, 2 ]
leo/core/leoRst.py
thomasbuttler/leo-editor
1,550
1610725
# -*- coding: utf-8 -*- #@+leo-ver=5-thin #@+node:ekr.20090502071837.3: * @file leoRst.py #@@first #@+<< docstring >> #@+node:ekr.20090502071837.4: ** << docstring >> """Support for restructured text (rST), adapted from rst3 plugin. For full documentation, see: http://leoeditor.com/rstplugin3.html To generate documents from rST files, Python's docutils_ module must be installed. The code will use the SilverCity_ syntax coloring package if is is available.""" #@-<< docstring >> #@+<< imports >> #@+node:ekr.20100908120927.5971: ** << imports >> (leoRst) import io import os import re import time # Third-part imports... try: import docutils import docutils.core from docutils import parsers from docutils.parsers import rst except Exception: docutils = None # type:ignore # Leo imports. from leo.core import leoGlobals as g # Aliases & traces. StringIO = io.StringIO if 'plugins' in getattr(g.app, 'debug', []): print('leoRst.py: docutils:', bool(docutils)) print('leoRst.py: parsers:', bool(parsers)) print('leoRst.py: rst:', bool(rst)) #@-<< imports >> #@+others #@+node:ekr.20150509035745.1: ** cmd (decorator) def cmd(name): """Command decorator for the RstCommands class.""" return g.new_cmd_decorator(name, ['c', 'rstCommands',]) #@+node:ekr.20090502071837.33: ** class RstCommands class RstCommands: """ A class to convert @rst nodes to rST markup. """ #@+others #@+node:ekr.20090502071837.34: *3* rst: Birth #@+node:ekr.20090502071837.35: *4* rst.__init__ def __init__(self, c): """Ctor for the RstCommand class.""" self.c = c # # Statistics. self.n_intermediate = 0 # Number of intermediate files written. self.n_docutils = 0 # Number of docutils files written. # # Http support for HtmlParserClass. See http_addNodeMarker. self.anchor_map = {} # Keys are anchors. Values are positions self.http_map = {} # Keys are named hyperlink targets. Value are positions. self.nodeNumber = 0 # Unique node number. # # For writing. self.at_auto_underlines = '' # Full set of underlining characters. self.at_auto_write = False # True: in @auto-rst importer. self.encoding = 'utf-8' # From any @encoding directive. self.path = '' # The path from any @path directive. self.result_list = [] # The intermediate results. self.root = None # The @rst node being processed. # # Default settings. self.default_underline_characters = '#=+*^~`-:><-' self.user_filter_b = None self.user_filter_h = None # # Complete the init. self.reloadSettings() #@+node:ekr.20210326084034.1: *4* rst.reloadSettings def reloadSettings(self): """RstCommand.reloadSettings""" c = self.c getBool, getString = c.config.getBool, c.config.getString # # Reporting options. self.silent = not getBool('rst3-verbose', default=True) # # Http options. self.http_server_support = getBool('rst3-http-server-support', default=False) self.node_begin_marker = getString('rst3-node-begin-marker') or 'http-node-marker-' # # Output options. self.default_path = getString('rst3-default-path') or '' self.generate_rst_header_comment = getBool('rst3-generate-rst-header-comment', default=True) self.underline_characters = ( getString('rst3-underline-characters') or self.default_underline_characters) self.write_intermediate_file = getBool('rst3-write-intermediate-file', default=True) self.write_intermediate_extension = getString('rst3-write-intermediate-extension') or '.txt' # # Docutils options. self.call_docutils = getBool('rst3-call-docutils', default=True) self.publish_argv_for_missing_stylesheets = getString('rst3-publish-argv-for-missing-stylesheets') or '' self.stylesheet_embed = getBool('rst3-stylesheet-embed', default=False) # New in leoSettings.leo. self.stylesheet_name = getString('rst3-stylesheet-name') or 'default.css' self.stylesheet_path = getString('rst3-stylesheet-path') or '' #@+node:ekr.20100813041139.5920: *3* rst: Entry points #@+node:ekr.20210403150303.1: *4* rst.rst-convert-legacy-outline @cmd('rst-convert-legacy-outline') @cmd('convert-legacy-rst-outline') def convert_legacy_outline(self, event=None): """ Convert @rst-preformat nodes and `@ @rst-options` doc parts. """ c = self.c for p in c.all_unique_positions(): if g.match_word(p.h, 0, '@rst-preformat'): self.preformat(p) self.convert_rst_options(p) #@+node:ekr.20210403153112.1: *5* rst.convert_rst_options options_pat = re.compile(r'^@ @rst-options', re.MULTILINE) default_pat = re.compile(r'^default_path\s*=(.*)$', re.MULTILINE) def convert_rst_options(self, p): """ Convert options @doc parts. Change headline to @path <fn>. """ m1 = self.options_pat.search(p.b) m2 = self.default_pat.search(p.b) if m1 and m2 and m2.start() > m1.start(): fn = m2.group(1).strip() if fn: old_h = p.h p.h = f"@path {fn}" print(f"{old_h} => {p.h}") #@+node:ekr.20210403151958.1: *5* rst.preformat def preformat(self, p): """Convert p.b as if preformatted. Change headline to @rst-no-head""" if not p.b.strip(): return p.b = '::\n\n' + ''.join( f" {s}" if s.strip() else '\n' for s in g.splitLines(p.b)) old_h = p.h p.h = '@rst-no-head' print(f"{old_h} => {p.h}") #@+node:ekr.20090511055302.5793: *4* rst.rst3 command & helpers @cmd('rst3') def rst3(self, event=None): """Write all @rst nodes.""" t1 = time.time() self.n_intermediate = self.n_docutils = 0 self.processTopTree(self.c.p) t2 = time.time() g.es_print( f"rst3: wrote...\n" f"{self.n_intermediate:4} intermediate file{g.plural(self.n_intermediate)}\n" f"{self.n_docutils:4} docutils file{g.plural(self.n_docutils)}\n" f"in {t2 - t1:4.2f} sec.") #@+node:ekr.20090502071837.62: *5* rst.processTopTree def processTopTree(self, p): """Call processTree for @rst and @slides node p's subtree or p's ancestors.""" def predicate(p): return self.is_rst_node(p) or g.match_word(p.h, 0, '@slides') roots = g.findRootsWithPredicate(self.c, p, predicate=predicate) if roots: for p in roots: self.processTree(p) else: g.warning('No @rst or @slides nodes in', p.h) #@+node:ekr.20090502071837.63: *5* rst.processTree def processTree(self, root): """Process all @rst nodes in a tree.""" for p in root.self_and_subtree(): if self.is_rst_node(p): if self.in_rst_tree(p): g.trace(f"ignoring nested @rst node: {p.h}") else: h = p.h.strip() fn = h[4:].strip() if fn: source = self.write_rst_tree(p, fn) self.write_docutils_files(fn, p, source) elif g.match_word(h, 0, "@slides"): if self.in_slides_tree(p): g.trace(f"ignoring nested @slides node: {p.h}") else: self.write_slides(p) #@+node:ekr.20090502071837.64: *5* rst.write_rst_tree def write_rst_tree(self, p, fn): """Convert p's tree to rst sources.""" c = self.c self.root = p.copy() # # Init encoding and path. d = c.scanAllDirectives(p) self.encoding = d.get('encoding') or 'utf-8' self.path = d.get('path') or '' # Write the output to self.result_list. self.result_list = [] # All output goes here. if self.generate_rst_header_comment: self.result_list.append(f".. rst3: filename: {fn}") for p in self.root.self_and_subtree(): self.writeNode(p) source = self.compute_result() return source #@+node:ekr.20100822092546.5835: *5* rst.write_slides & helper def write_slides(self, p): """Convert p's children to slides.""" c = self.c p = p.copy() h = p.h i = g.skip_id(h, 1) # Skip the '@' kind, fn = h[:i].strip(), h[i:].strip() if not fn: g.error(f"{kind} requires file name") return title = p.firstChild().h if p and p.firstChild() else '<no slide>' title = title.strip().capitalize() n_tot = p.numberOfChildren() n = 1 d = c.scanAllDirectives(p) self.encoding = d.get('encoding') or 'utf-8' self.path = d.get('path') or '' for child in p.children(): # Compute the slide's file name. fn2, ext = g.os_path_splitext(fn) fn2 = f"{fn2}-{n:03d}{ext}" # Use leading zeros for :glob:. n += 1 # Write the rst sources. self.result_list = [] self.writeSlideTitle(title, n - 1, n_tot) self.result_list.append(child.b) source = self.compute_result() self.write_docutils_files(fn2, p, source) #@+node:ekr.20100822174725.5836: *6* rst.writeSlideTitle def writeSlideTitle(self, title, n, n_tot): """Write the title, underlined with the '#' character.""" if n != 1: title = f"{title} ({n} of {n_tot})" width = max(4, len(g.toEncodedString(title, encoding=self.encoding, reportErrors=False))) self.result_list.append(f"{title}\n{'#' * width}") #@+node:ekr.20090502071837.85: *5* rst.writeNode & helper def writeNode(self, p): """Append the rst srouces to self.result_list.""" c = self.c if self.is_ignore_node(p) or self.in_ignore_tree(p): return if g.match_word(p.h, 0, '@rst-no-head'): self.result_list.append(self.filter_b(c, p)) else: self.http_addNodeMarker(p) if p != self.root: self.result_list.append(self.underline(p, self.filter_h(c, p))) self.result_list.append(self.filter_b(c, p)) #@+node:ekr.20090502071837.96: *6* rst.http_addNodeMarker def http_addNodeMarker(self, p): """ Add a node marker for the mod_http plugin (HtmlParserClass class). The first three elements are a stack of tags, the rest is html code:: [ <tag n start>, <tag n end>, <other stack elements>, <html line 1>, <html line 2>, ... ] <other stack elements> has the same structure:: [<tag n-1 start>, <tag n-1 end>, <other stack elements>] """ if self.http_server_support: self.nodeNumber += 1 anchorname = f"{self.node_begin_marker}{self.nodeNumber}" self.result_list.append(f".. _{anchorname}:") self.http_map[anchorname] = p.copy() #@+node:ekr.20100813041139.5919: *4* rst.write_docutils_files & helpers def write_docutils_files(self, fn, p, source): """Write source to the intermediate file and write the output from docutils..""" junk, ext = g.os_path_splitext(fn) ext = ext.lower() fn = self.computeOutputFileName(fn) ok = self.createDirectoryForFile(fn) if not ok: return # Write the intermediate file. if self.write_intermediate_file: self.writeIntermediateFile(fn, source) # Should we call docutils? if not self.call_docutils: return if ext not in ('.htm', '.html', '.tex', '.pdf', '.s5', '.odt'): # #1884: test now. return # Write the result from docutils. s = self.writeToDocutils(source, ext) if s and ext in ('.html', '.htm'): s = self.addTitleToHtml(s) if not s: return s = g.toEncodedString(s, 'utf-8') with open(fn, 'wb') as f: f.write(s) self.n_docutils += 1 self.report(fn) #@+node:ekr.20100813041139.5913: *5* rst.addTitleToHtml def addTitleToHtml(self, s): """ Replace an empty <title> element by the contents of the first <h1> element. """ i = s.find('<title></title>') if i == -1: return s m = re.search(r'<h1>([^<]*)</h1>', s) if not m: m = re.search(r'<h1><[^>]+>([^<]*)</a></h1>', s) if m: s = s.replace('<title></title>', f"<title>{m.group(1)}</title>") return s #@+node:ekr.20090502071837.89: *5* rst.computeOutputFileName def computeOutputFileName(self, fn): """Return the full path to the output file.""" c = self.c openDirectory = c.frame.openDirectory if self.default_path: path = g.os_path_finalize_join(self.path, self.default_path, fn) elif self.path: path = g.os_path_finalize_join(self.path, fn) elif openDirectory: path = g.os_path_finalize_join(self.path, openDirectory, fn) else: path = g.os_path_finalize_join(fn) return path #@+node:ekr.20100813041139.5914: *5* rst.createDirectoryForFile def createDirectoryForFile(self, fn): """ Create the directory for fn if a) it doesn't exist and b) the user options allow it. Return True if the directory existed or was made. """ c, ok = self.c, False # 1815. # Create the directory if it doesn't exist. theDir, junk = g.os_path_split(fn) theDir = g.os_path_finalize(theDir) # 1341 if g.os_path_exists(theDir): return True if c and c.config and c.config.create_nonexistent_directories: theDir = c.expand_path_expression(theDir) ok = g.makeAllNonExistentDirectories(theDir) # type:ignore if not ok: g.error('did not create:', theDir) return ok #@+node:ekr.20100813041139.5912: *5* rst.writeIntermediateFile def writeIntermediateFile(self, fn, s): """Write s to to the file whose name is fn.""" # ext = self.getOption(p, 'write_intermediate_extension') ext = self.write_intermediate_extension if not ext.startswith('.'): ext = '.' + ext fn = fn + ext with open(fn, 'w', encoding=self.encoding) as f: f.write(s) self.n_intermediate += 1 self.report(fn) #@+node:ekr.20090502071837.65: *5* rst.writeToDocutils & helper def writeToDocutils(self, s, ext): """Send s to docutils using the writer implied by ext and return the result.""" if not docutils: g.error('writeToDocutils: docutils not present') return None join = g.os_path_finalize_join openDirectory = self.c.frame.openDirectory overrides = {'output_encoding': self.encoding} # # Compute the args list if the stylesheet path does not exist. styleSheetArgsDict = self.handleMissingStyleSheetArgs() if ext == '.pdf': module = g.import_module('leo.plugins.leo_pdf') if not module: return None writer = module.Writer() # Get an instance. writer_name = None else: writer = None for ext2, writer_name in ( ('.html', 'html'), ('.htm', 'html'), ('.tex', 'latex'), ('.pdf', 'leo.plugins.leo_pdf'), ('.s5', 's5'), ('.odt', 'odt'), ): if ext2 == ext: break else: g.error(f"unknown docutils extension: {ext}") return None # # Make the stylesheet path relative to open directory. rel_stylesheet_path = self.stylesheet_path or '' stylesheet_path = join(openDirectory, rel_stylesheet_path) assert self.stylesheet_name path = join(self.stylesheet_path, self.stylesheet_name) if not self.stylesheet_embed: rel_path = join(rel_stylesheet_path, self.stylesheet_name) rel_path = rel_path.replace('\\', '/') overrides['stylesheet'] = rel_path overrides['stylesheet_path'] = None overrides['embed_stylesheet'] = None elif os.path.exists(path): if ext != '.pdf': overrides['stylesheet'] = path overrides['stylesheet_path'] = None elif styleSheetArgsDict: g.es_print('using publish_argv_for_missing_stylesheets', styleSheetArgsDict) overrides.update(styleSheetArgsDict) # MWC add args to settings elif rel_stylesheet_path == stylesheet_path: g.error(f"stylesheet not found: {path}") else: g.error('stylesheet not found\n', path) if self.path: g.es_print('@path:', self.path) g.es_print('open path:', openDirectory) if rel_stylesheet_path: g.es_print('relative path:', rel_stylesheet_path) try: result = None result = docutils.core.publish_string(source=s, reader_name='standalone', parser_name='restructuredtext', writer=writer, writer_name=writer_name, settings_overrides=overrides) if isinstance(result, bytes): result = g.toUnicode(result) except docutils.ApplicationError as error: g.error('Docutils error:') g.blue(error) except Exception: g.es_print('Unexpected docutils exception') g.es_exception() return result #@+node:ekr.20090502071837.66: *6* rst.handleMissingStyleSheetArgs def handleMissingStyleSheetArgs(self, s=None): """ Parse the publish_argv_for_missing_stylesheets option, returning a dict containing the parsed args. """ if 0: # See http://docutils.sourceforge.net/docs/user/config.html#documentclass return { 'documentclass': 'report', 'documentoptions': 'english,12pt,lettersize', } if not s: s = self.publish_argv_for_missing_stylesheets if not s: return {} # # Handle argument lists such as this: # --language=en,--documentclass=report,--documentoptions=[english,12pt,lettersize] d = {} while s: s = s.strip() if not s.startswith('--'): break s = s[2:].strip() eq = s.find('=') cm = s.find(',') if eq == -1 or (-1 < cm < eq): # key[nl] or key, val = '' cm = s.find(',') if cm == -1: key = s.strip() s = '' else: key = s[:cm].strip() s = s[cm + 1 :].strip() else: # key = val key = s[:eq].strip() s = s[eq + 1 :].strip() if s.startswith('['): # [...] rb = s.find(']') if rb == -1: break # Bad argument. val = s[: rb + 1] s = s[rb + 1 :].strip() if s.startswith(','): s = s[1:].strip() else: # val[nl] or val, cm = s.find(',') if cm == -1: val = s s = '' else: val = s[:cm].strip() s = s[cm + 1 :].strip() if not key: break if not val.strip(): val = '1' d[str(key)] = str(val) return d #@+node:ekr.20090512153903.5803: *4* rst.writeAtAutoFile & helpers def writeAtAutoFile(self, p, fileName, outputFile): """ at.writeAtAutoContents calls this method to write an @auto tree containing imported rST code. at.writeAtAutoContents will close the output file. """ self.result_list = [] self.initAtAutoWrite(p) self.root = p.copy() after = p.nodeAfterTree() if not self.isSafeWrite(p): return False try: self.at_auto_write = True # Set the flag for underline. p = p.firstChild() # A hack: ignore the root node. while p and p != after: self.writeNode(p) # side effect: advances p s = self.compute_result() outputFile.write(s) ok = True except Exception: ok = False finally: self.at_auto_write = False return ok #@+node:ekr.20090513073632.5733: *5* rst.initAtAutoWrite def initAtAutoWrite(self, p): """Init underlining for for an @auto write.""" # User-defined underlining characters make no sense in @auto-rst. d = p.v.u.get('rst-import', {}) underlines2 = d.get('underlines2', '') # # Do *not* set a default for overlining characters. if len(underlines2) > 1: underlines2 = underlines2[0] g.warning(f"too many top-level underlines, using {underlines2}") underlines1 = d.get('underlines1', '') # # Pad underlines with default characters. default_underlines = '=+*^~"\'`-:><_' if underlines1: for ch in default_underlines[1:]: if ch not in underlines1: underlines1 = underlines1 + ch else: underlines1 = default_underlines self.at_auto_underlines = underlines2 + underlines1 self.underlines1 = underlines1 self.underlines2 = underlines2 #@+node:ekr.20210401155057.7: *5* rst.isSafeWrite def isSafeWrite(self, p): """ Return True if node p contributes nothing but rst-options to the write. """ lines = g.splitLines(p.b) for z in lines: if z.strip() and not z.startswith('@') and not z.startswith('.. '): # A real line that will not be written. g.error('unsafe @auto-rst') g.es('body text will be ignored in\n', p.h) return False return True #@+node:ekr.20090502071837.67: *4* rst.writeNodeToString def writeNodeToString(self, p): """ rst.writeNodeToString: A utility for scripts. Not used in Leo. Write p's tree to a string as if it were an @rst node. Return the string. """ return self.write_rst_tree(p, fn=p.h) #@+node:ekr.20210329105456.1: *3* rst: Filters #@+node:ekr.20210329105948.1: *4* rst.filter_b & self.filter_h def filter_b(self, c, p): """ Filter p.b with user_filter_b function. Don't allow filtering when in the @auto-rst logic. """ if self.user_filter_b and not self.at_auto_write: try: # pylint: disable=not-callable return self.user_filter_b(c, p) except Exception: g.es_exception() self.user_filter_b = None return p.b def filter_h(self, c, p): """ Filter p.h with user_filter_h function. Don't allow filtering when in the @auto-rst logic. """ if self.user_filter_h and not self.at_auto_write: try: # pylint: disable=not-callable return self.user_filter_h(c, p) except Exception: g.es_exception() self.user_filter_h = None return p.h #@+node:ekr.20210329111528.1: *4* rst.register_*_filter def register_body_filter(self, f): """Register the user body filter.""" self.user_filter_b = f def register_headline_filter(self, f): """Register the user headline filter.""" self.user_filter_h = f #@+node:ekr.20210331084407.1: *3* rst: Predicates def in_ignore_tree(self, p): return any(g.match_word(p2.h, 0, '@rst-ignore-tree') for p2 in self.rst_parents(p)) def in_rst_tree(self, p): return any(self.is_rst_node(p2) for p2 in self.rst_parents(p)) def in_slides_tree(self, p): return any(g.match_word(p.h, 0, "@slides") for p2 in self.rst_parents(p)) def is_ignore_node(self, p): return g.match_words(p.h, 0, ('@rst-ignore', '@rst-ignore-node')) def is_rst_node(self, p): return g.match_word(p.h, 0, "@rst") and not g.match(p.h, 0, "@rst-") def rst_parents(self, p): for p2 in p.parents(): if p2 == self.root: return yield p2 #@+node:ekr.20090502071837.88: *3* rst: Utils #@+node:ekr.20210326165315.1: *4* rst.compute_result def compute_result(self): """Concatenate all strings in self.result, ensuring exactly one blank line between strings.""" return ''.join(f"{s.rstrip()}\n\n" for s in self.result_list if s.strip()) #@+node:ekr.20090502071837.43: *4* rst.dumpDict def dumpDict(self, d, tag): """Dump the given settings dict.""" g.pr(tag + '...') for key in sorted(d): g.pr(f" {key:20} {d.get(key)}") #@+node:ekr.20090502071837.90: *4* rst.encode def encode(self, s): """return s converted to an encoded string.""" return g.toEncodedString(s, encoding=self.encoding, reportErrors=True) #@+node:ekr.20090502071837.91: *4* rst.report def report(self, name): """Issue a report to the log pane.""" if self.silent: return name = g.os_path_finalize(name) # 1341 g.pr(f"wrote: {name}") #@+node:ekr.20090502071837.92: *4* rst.rstComment def rstComment(self, s): return f".. {s}" #@+node:ekr.20090502071837.93: *4* rst.underline def underline(self, p, s): """ Return the underlining string to be used at the given level for string s. This includes the headline, and possibly a leading overlining line. """ # Never add the root's headline. if not s: return '' encoded_s = g.toEncodedString(s, encoding=self.encoding, reportErrors=False) if self.at_auto_write: # We *might* generate overlines for top-level sections. u = self.at_auto_underlines level = p.level() - self.root.level() # This is tricky. The index n depends on several factors. if self.underlines2: level -= 1 # There *is* a double-underlined section. n = level else: n = level - 1 if 0 <= n < len(u): ch = u[n] elif u: ch = u[-1] else: g.trace('can not happen: no u') ch = '#' # Write longer underlines for non-ascii characters. n = max(4, len(encoded_s)) if level == 0 and self.underlines2: # Generate an overline and an underline. return f"{ch * n}\n{p.h}\n{ch * n}" # Generate only an underline. return f"{p.h}\n{ch * n}" # # The user is responsible for top-level overlining. u = self.underline_characters # '''#=+*^~"'`-:><_''' level = max(0, p.level() - self.root.level()) level = min(level + 1, len(u) - 1) # Reserve the first character for explicit titles. ch = u[level] n = max(4, len(encoded_s)) return f"{s.strip()}\n{ch * n}" #@-others #@-others #@@language python #@@tabwidth -4 #@@pagewidth 70 #@-leo
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 29992, 29974, 280, 29877, 29899, 369, 29922, 29945, 29899, 386, 262, 13, 29937, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29941, 29901, 334, 732, 1445, 454, 29877, 29934, 303, 29889, 2272, 13, 29937, 25380, 4102, 13, 29937, 29992, 29974, 9314, 1574, 1807, 5099, 13, 29937, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29946, 29901, 3579, 3532, 1574, 1807, 5099, 13, 15945, 29908, 14039, 363, 1791, 1247, 2955, 1426, 313, 29878, 1254, 511, 23430, 515, 364, 303, 29941, 7079, 29889, 13, 13, 2831, 2989, 5106, 29892, 1074, 29901, 1732, 597, 280, 29877, 15204, 29889, 510, 29914, 29878, 303, 8582, 29941, 29889, 1420, 13, 13, 1762, 5706, 10701, 515, 364, 1254, 2066, 29892, 5132, 29915, 29879, 1574, 13239, 29918, 3883, 1818, 367, 13, 25537, 29889, 450, 775, 674, 671, 278, 16466, 16885, 29918, 5877, 2927, 292, 3577, 565, 338, 338, 13, 16515, 1213, 15945, 13, 29937, 29992, 29899, 9314, 1574, 1807, 5099, 13, 29937, 29992, 29974, 9314, 24802, 5099, 13, 29937, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29929, 29900, 29947, 29896, 29906, 29900, 29929, 29906, 29955, 29889, 29945, 29929, 29955, 29896, 29901, 3579, 3532, 24802, 5099, 313, 280, 29877, 29934, 303, 29897, 13, 5215, 12013, 13, 5215, 2897, 13, 5215, 337, 13, 5215, 931, 13, 29937, 18008, 29899, 1595, 24802, 856, 13, 2202, 29901, 13, 1678, 1053, 1574, 13239, 13, 1678, 1053, 1574, 13239, 29889, 3221, 13, 1678, 515, 1574, 13239, 1053, 610, 4253, 13, 1678, 515, 1574, 13239, 29889, 862, 4253, 1053, 364, 303, 13, 19499, 8960, 29901, 13, 1678, 1574, 13239, 353, 6213, 29871, 396, 1134, 29901, 17281, 13, 29937, 22533, 24802, 29889, 13, 3166, 454, 29877, 29889, 3221, 1053, 454, 29877, 29954, 2127, 1338, 408, 330, 13, 29937, 10785, 2129, 669, 26695, 29889, 13, 1231, 5971, 353, 12013, 29889, 1231, 5971, 13, 361, 525, 12800, 29915, 297, 679, 5552, 29898, 29887, 29889, 932, 29892, 525, 8382, 742, 5159, 1125, 13, 1678, 1596, 877, 280, 29877, 29934, 303, 29889, 2272, 29901, 1574, 13239, 29901, 742, 6120, 29898, 1514, 13239, 876, 13, 1678, 1596, 877, 280, 29877, 29934, 303, 29889, 2272, 29901, 29871, 610, 4253, 29901, 742, 6120, 29898, 862, 4253, 876, 13, 1678, 1596, 877, 280, 29877, 29934, 303, 29889, 2272, 29901, 418, 364, 303, 29901, 742, 6120, 29898, 29878, 303, 876, 13, 29937, 29992, 29899, 9314, 24802, 5099, 13, 29937, 29992, 29974, 720, 414, 13, 29937, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29945, 29900, 29945, 29900, 29929, 29900, 29941, 29945, 29955, 29946, 29945, 29889, 29896, 29901, 3579, 9920, 313, 19557, 1061, 29897, 13, 1753, 9920, 29898, 978, 1125, 13, 1678, 9995, 6255, 10200, 1061, 363, 278, 390, 303, 5261, 4167, 770, 1213, 15945, 13, 1678, 736, 330, 29889, 1482, 29918, 9006, 29918, 19557, 1061, 29898, 978, 29892, 6024, 29883, 742, 525, 29878, 303, 5261, 4167, 742, 2314, 13, 29937, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29941, 29941, 29901, 3579, 770, 390, 303, 5261, 4167, 13, 1990, 390, 303, 5261, 4167, 29901, 13, 1678, 9995, 13, 1678, 319, 770, 304, 3588, 732, 29878, 303, 7573, 304, 364, 1254, 24986, 29889, 13, 1678, 9995, 13, 1678, 396, 29992, 29974, 720, 414, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29941, 29946, 29901, 334, 29941, 29930, 364, 303, 29901, 350, 7515, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29941, 29945, 29901, 334, 29946, 29930, 364, 303, 17255, 2344, 1649, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 274, 1125, 13, 4706, 9995, 29907, 7345, 363, 278, 390, 303, 6255, 770, 1213, 15945, 13, 4706, 1583, 29889, 29883, 353, 274, 13, 4706, 396, 13, 4706, 396, 27098, 29889, 13, 4706, 1583, 29889, 29876, 29918, 1639, 13847, 353, 29871, 29900, 29871, 396, 9681, 310, 19697, 2066, 3971, 29889, 13, 4706, 1583, 29889, 29876, 29918, 1514, 13239, 353, 29871, 29900, 29871, 396, 9681, 310, 1574, 13239, 2066, 3971, 29889, 13, 4706, 396, 13, 4706, 396, 9056, 2304, 363, 24726, 11726, 2385, 29889, 29871, 2823, 1732, 29918, 1202, 4247, 24619, 29889, 13, 4706, 1583, 29889, 25367, 29918, 1958, 353, 6571, 29871, 396, 4813, 952, 526, 23791, 943, 29889, 2630, 1041, 526, 11909, 13, 4706, 1583, 29889, 1124, 29918, 1958, 353, 6571, 29871, 396, 4813, 952, 526, 4257, 11266, 2324, 22525, 29889, 29871, 7865, 526, 11909, 29889, 13, 4706, 1583, 29889, 3177, 4557, 353, 29871, 29900, 29871, 396, 853, 1387, 2943, 1353, 29889, 13, 4706, 396, 13, 4706, 396, 1152, 5007, 29889, 13, 4706, 1583, 29889, 271, 29918, 6921, 29918, 5062, 9012, 353, 6629, 29871, 396, 14846, 731, 310, 1090, 1915, 292, 4890, 29889, 13, 4706, 1583, 29889, 271, 29918, 6921, 29918, 3539, 353, 7700, 29871, 396, 5852, 29901, 297, 732, 6921, 29899, 29878, 303, 527, 18505, 29889, 13, 4706, 1583, 29889, 22331, 353, 525, 9420, 29899, 29947, 29915, 29871, 396, 3645, 738, 732, 22331, 17041, 29889, 13, 4706, 1583, 29889, 2084, 353, 6629, 29871, 396, 450, 2224, 515, 738, 732, 2084, 17041, 29889, 13, 4706, 1583, 29889, 2914, 29918, 1761, 353, 5159, 29871, 396, 450, 19697, 2582, 29889, 13, 4706, 1583, 29889, 4632, 353, 6213, 29871, 396, 450, 732, 29878, 303, 2943, 1641, 19356, 29889, 13, 4706, 396, 13, 4706, 396, 13109, 6055, 29889, 13, 4706, 1583, 29889, 4381, 29918, 15614, 29918, 3090, 21706, 353, 16321, 29922, 29974, 29930, 29985, 30022, 27969, 29901, 5299, 29899, 29915, 13, 4706, 1583, 29889, 1792, 29918, 4572, 29918, 29890, 353, 6213, 13, 4706, 1583, 29889, 1792, 29918, 4572, 29918, 29882, 353, 6213, 13, 4706, 396, 13, 4706, 396, 25034, 278, 2069, 29889, 13, 4706, 1583, 29889, 28120, 9585, 580, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29941, 29906, 29953, 29900, 29947, 29946, 29900, 29941, 29946, 29889, 29896, 29901, 334, 29946, 29930, 364, 303, 29889, 28120, 9585, 13, 1678, 822, 19763, 9585, 29898, 1311, 1125, 13, 4706, 9995, 29934, 303, 6255, 29889, 28120, 9585, 15945, 29908, 13, 4706, 274, 353, 1583, 29889, 29883, 13, 4706, 679, 24693, 29892, 679, 1231, 353, 274, 29889, 2917, 29889, 657, 24693, 29892, 274, 29889, 2917, 29889, 13719, 13, 4706, 396, 13, 4706, 396, 13969, 292, 3987, 29889, 13, 4706, 1583, 29889, 25590, 296, 353, 451, 679, 24693, 877, 29878, 303, 29941, 29899, 369, 15828, 742, 2322, 29922, 5574, 29897, 13, 4706, 396, 13, 4706, 396, 9056, 3987, 29889, 13, 4706, 1583, 29889, 1124, 29918, 2974, 29918, 5924, 353, 679, 24693, 877, 29878, 303, 29941, 29899, 1124, 29899, 2974, 29899, 5924, 742, 2322, 29922, 8824, 29897, 13, 4706, 1583, 29889, 3177, 29918, 463, 29918, 22976, 353, 679, 1231, 877, 29878, 303, 29941, 29899, 3177, 29899, 463, 29899, 22976, 1495, 470, 525, 1124, 29899, 3177, 29899, 22976, 29899, 29915, 13, 4706, 396, 13, 4706, 396, 10604, 3987, 29889, 13, 4706, 1583, 29889, 4381, 29918, 2084, 353, 679, 1231, 877, 29878, 303, 29941, 29899, 4381, 29899, 2084, 1495, 470, 6629, 13, 4706, 1583, 29889, 17158, 29918, 29878, 303, 29918, 6672, 29918, 9342, 353, 679, 24693, 877, 29878, 303, 29941, 29899, 17158, 29899, 29878, 303, 29899, 6672, 29899, 9342, 742, 2322, 29922, 5574, 29897, 13, 4706, 1583, 29889, 15614, 29918, 3090, 21706, 353, 313, 13, 9651, 679, 1231, 877, 29878, 303, 29941, 29899, 15614, 29899, 3090, 21706, 1495, 13, 9651, 470, 1583, 29889, 4381, 29918, 15614, 29918, 3090, 21706, 29897, 13, 4706, 1583, 29889, 3539, 29918, 1639, 13847, 29918, 1445, 353, 679, 24693, 877, 29878, 303, 29941, 29899, 3539, 29899, 1639, 13847, 29899, 1445, 742, 2322, 29922, 5574, 29897, 13, 4706, 1583, 29889, 3539, 29918, 1639, 13847, 29918, 17588, 353, 679, 1231, 877, 29878, 303, 29941, 29899, 3539, 29899, 1639, 13847, 29899, 17588, 1495, 470, 15300, 3945, 29915, 13, 4706, 396, 13, 4706, 396, 28197, 13239, 3987, 29889, 13, 4706, 1583, 29889, 4804, 29918, 1514, 13239, 353, 679, 24693, 877, 29878, 303, 29941, 29899, 4804, 29899, 1514, 13239, 742, 2322, 29922, 5574, 29897, 13, 4706, 1583, 29889, 23679, 29918, 19218, 29918, 1454, 29918, 27259, 29918, 9783, 354, 1691, 353, 679, 1231, 877, 29878, 303, 29941, 29899, 23679, 29899, 19218, 29899, 1454, 29899, 27259, 29899, 9783, 354, 1691, 1495, 470, 6629, 13, 4706, 1583, 29889, 13558, 29918, 17987, 353, 679, 24693, 877, 29878, 303, 29941, 29899, 13558, 29899, 17987, 742, 2322, 29922, 8824, 29897, 29871, 396, 1570, 297, 454, 29877, 9585, 29889, 280, 29877, 29889, 13, 4706, 1583, 29889, 13558, 29918, 978, 353, 679, 1231, 877, 29878, 303, 29941, 29899, 13558, 29899, 978, 1495, 470, 525, 4381, 29889, 4268, 29915, 13, 4706, 1583, 29889, 13558, 29918, 2084, 353, 679, 1231, 877, 29878, 303, 29941, 29899, 13558, 29899, 2084, 1495, 470, 6629, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29947, 29896, 29941, 29900, 29946, 29896, 29896, 29941, 29929, 29889, 29945, 29929, 29906, 29900, 29901, 334, 29941, 29930, 364, 303, 29901, 28236, 3291, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29946, 29900, 29941, 29896, 29945, 29900, 29941, 29900, 29941, 29889, 29896, 29901, 334, 29946, 29930, 364, 303, 29889, 29878, 303, 29899, 13441, 29899, 1397, 4135, 29899, 449, 1220, 13, 1678, 732, 9006, 877, 29878, 303, 29899, 13441, 29899, 1397, 4135, 29899, 449, 1220, 1495, 13, 1678, 732, 9006, 877, 13441, 29899, 1397, 4135, 29899, 29878, 303, 29899, 449, 1220, 1495, 13, 1678, 822, 3588, 29918, 1397, 4135, 29918, 449, 1220, 29898, 1311, 29892, 1741, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 14806, 732, 29878, 303, 29899, 1457, 4830, 7573, 322, 11159, 732, 29878, 303, 29899, 6768, 29952, 1574, 5633, 29889, 13, 4706, 9995, 13, 4706, 274, 353, 1583, 29889, 29883, 13, 4706, 363, 282, 297, 274, 29889, 497, 29918, 13092, 29918, 1066, 2187, 7295, 13, 9651, 565, 330, 29889, 4352, 29918, 1742, 29898, 29886, 29889, 29882, 29892, 29871, 29900, 29892, 18803, 29878, 303, 29899, 1457, 4830, 29374, 13, 18884, 1583, 29889, 1457, 4830, 29898, 29886, 29897, 13, 9651, 1583, 29889, 13441, 29918, 29878, 303, 29918, 6768, 29898, 29886, 29897, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29946, 29900, 29941, 29896, 29945, 29941, 29896, 29896, 29906, 29889, 29896, 29901, 334, 29945, 29930, 364, 303, 29889, 13441, 29918, 29878, 303, 29918, 6768, 13, 1678, 3987, 29918, 5031, 353, 337, 29889, 12198, 29898, 29878, 29915, 29985, 29992, 732, 29878, 303, 29899, 6768, 742, 337, 29889, 29924, 8647, 6227, 8895, 29897, 13, 1678, 2322, 29918, 5031, 353, 337, 29889, 12198, 29898, 29878, 29915, 29985, 4381, 29918, 2084, 29905, 29879, 29930, 7607, 5575, 1262, 742, 337, 29889, 29924, 8647, 6227, 8895, 29897, 13, 13, 1678, 822, 3588, 29918, 29878, 303, 29918, 6768, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 13, 4706, 14806, 3987, 732, 1514, 5633, 29889, 10726, 2343, 1220, 304, 732, 2084, 529, 9144, 15513, 13, 4706, 9995, 13, 4706, 286, 29896, 353, 1583, 29889, 6768, 29918, 5031, 29889, 4478, 29898, 29886, 29889, 29890, 29897, 13, 4706, 286, 29906, 353, 1583, 29889, 4381, 29918, 5031, 29889, 4478, 29898, 29886, 29889, 29890, 29897, 13, 4706, 565, 286, 29896, 322, 286, 29906, 322, 286, 29906, 29889, 2962, 580, 1405, 286, 29896, 29889, 2962, 7295, 13, 9651, 7876, 353, 286, 29906, 29889, 2972, 29898, 29896, 467, 17010, 580, 13, 9651, 565, 7876, 29901, 13, 18884, 2030, 29918, 29882, 353, 282, 29889, 29882, 13, 18884, 282, 29889, 29882, 353, 285, 29908, 29992, 2084, 426, 9144, 5038, 13, 18884, 1596, 29898, 29888, 29908, 29912, 1025, 29918, 29882, 29913, 1149, 426, 29886, 29889, 29882, 27195, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29946, 29900, 29941, 29896, 29945, 29896, 29929, 29945, 29947, 29889, 29896, 29901, 334, 29945, 29930, 364, 303, 29889, 1457, 4830, 13, 1678, 822, 758, 4830, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 18455, 282, 29889, 29890, 408, 565, 758, 689, 19667, 29889, 10726, 2343, 1220, 304, 732, 29878, 303, 29899, 1217, 29899, 2813, 15945, 29908, 13, 4706, 565, 451, 282, 29889, 29890, 29889, 17010, 7295, 13, 9651, 736, 13, 4706, 282, 29889, 29890, 353, 525, 1057, 29905, 29876, 29905, 29876, 29915, 718, 525, 4286, 7122, 29898, 13, 9651, 285, 29908, 1678, 426, 29879, 5038, 565, 269, 29889, 17010, 580, 1683, 11297, 29876, 29915, 13, 18884, 363, 269, 297, 330, 29889, 5451, 20261, 29898, 29886, 29889, 29890, 876, 13, 4706, 2030, 29918, 29882, 353, 282, 29889, 29882, 13, 4706, 282, 29889, 29882, 353, 18803, 29878, 303, 29899, 1217, 29899, 2813, 29915, 13, 4706, 1596, 29898, 29888, 29908, 29912, 1025, 29918, 29882, 29913, 1149, 426, 29886, 29889, 29882, 27195, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29896, 29896, 29900, 29945, 29945, 29941, 29900, 29906, 29889, 29945, 29955, 29929, 29941, 29901, 334, 29946, 29930, 364, 303, 29889, 29878, 303, 29941, 1899, 669, 1371, 414, 13, 1678, 732, 9006, 877, 29878, 303, 29941, 1495, 13, 1678, 822, 364, 303, 29941, 29898, 1311, 29892, 1741, 29922, 8516, 1125, 13, 4706, 9995, 6113, 599, 732, 29878, 303, 7573, 1213, 15945, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 1583, 29889, 29876, 29918, 1639, 13847, 353, 1583, 29889, 29876, 29918, 1514, 13239, 353, 29871, 29900, 13, 4706, 1583, 29889, 5014, 7031, 9643, 29898, 1311, 29889, 29883, 29889, 29886, 29897, 13, 4706, 260, 29906, 353, 931, 29889, 2230, 580, 13, 4706, 330, 29889, 267, 29918, 2158, 29898, 13, 9651, 285, 29908, 29878, 303, 29941, 29901, 5456, 856, 29905, 29876, 29908, 13, 9651, 285, 29908, 29912, 1311, 29889, 29876, 29918, 1639, 13847, 29901, 29946, 29913, 19697, 934, 29912, 29887, 29889, 572, 3631, 29898, 1311, 29889, 29876, 29918, 1639, 13847, 11383, 29876, 29908, 13, 9651, 285, 29908, 29912, 1311, 29889, 29876, 29918, 1514, 13239, 29901, 29946, 29913, 1574, 13239, 934, 29912, 29887, 29889, 572, 3631, 29898, 1311, 29889, 29876, 29918, 1514, 13239, 11383, 29876, 29908, 13, 9651, 285, 29908, 262, 426, 29873, 29906, 448, 260, 29896, 29901, 29946, 29889, 29906, 29888, 29913, 5226, 23157, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29953, 29906, 29901, 334, 29945, 29930, 364, 303, 29889, 5014, 7031, 9643, 13, 1678, 822, 1889, 7031, 9643, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 5594, 1889, 9643, 363, 732, 29878, 303, 322, 732, 2536, 2247, 2943, 282, 29915, 29879, 1014, 8336, 470, 282, 29915, 29879, 19525, 943, 1213, 15945, 13, 13, 4706, 822, 24384, 29898, 29886, 1125, 13, 9651, 736, 1583, 29889, 275, 29918, 29878, 303, 29918, 3177, 29898, 29886, 29897, 470, 330, 29889, 4352, 29918, 1742, 29898, 29886, 29889, 29882, 29892, 29871, 29900, 29892, 18803, 2536, 2247, 1495, 13, 13, 4706, 16778, 353, 330, 29889, 2886, 9588, 1862, 3047, 23084, 9593, 29898, 1311, 29889, 29883, 29892, 282, 29892, 24384, 29922, 11965, 9593, 29897, 13, 4706, 565, 16778, 29901, 13, 9651, 363, 282, 297, 16778, 29901, 13, 18884, 1583, 29889, 5014, 9643, 29898, 29886, 29897, 13, 4706, 1683, 29901, 13, 9651, 330, 29889, 27392, 877, 3782, 732, 29878, 303, 470, 732, 2536, 2247, 7573, 297, 742, 282, 29889, 29882, 29897, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29953, 29941, 29901, 334, 29945, 29930, 364, 303, 29889, 5014, 9643, 13, 1678, 822, 1889, 9643, 29898, 1311, 29892, 3876, 1125, 13, 4706, 9995, 7032, 599, 732, 29878, 303, 7573, 297, 263, 5447, 1213, 15945, 13, 4706, 363, 282, 297, 3876, 29889, 1311, 29918, 392, 29918, 1491, 8336, 7295, 13, 9651, 565, 1583, 29889, 275, 29918, 29878, 303, 29918, 3177, 29898, 29886, 1125, 13, 18884, 565, 1583, 29889, 262, 29918, 29878, 303, 29918, 8336, 29898, 29886, 1125, 13, 462, 1678, 330, 29889, 15003, 29898, 29888, 29908, 647, 8253, 9322, 732, 29878, 303, 2943, 29901, 426, 29886, 29889, 29882, 27195, 13, 18884, 1683, 29901, 13, 462, 1678, 298, 353, 282, 29889, 29882, 29889, 17010, 580, 13, 462, 1678, 7876, 353, 298, 29961, 29946, 29901, 1822, 17010, 580, 13, 462, 1678, 565, 7876, 29901, 13, 462, 4706, 2752, 353, 1583, 29889, 3539, 29918, 29878, 303, 29918, 8336, 29898, 29886, 29892, 7876, 29897, 13, 462, 4706, 1583, 29889, 3539, 29918, 1514, 13239, 29918, 5325, 29898, 9144, 29892, 282, 29892, 2752, 29897, 13, 9651, 25342, 330, 29889, 4352, 29918, 1742, 29898, 29882, 29892, 29871, 29900, 29892, 17962, 2536, 2247, 29908, 1125, 13, 18884, 565, 1583, 29889, 262, 29918, 2536, 2247, 29918, 8336, 29898, 29886, 1125, 13, 462, 1678, 330, 29889, 15003, 29898, 29888, 29908, 647, 8253, 9322, 732, 2536, 2247, 2943, 29901, 426, 29886, 29889, 29882, 27195, 13, 18884, 1683, 29901, 13, 462, 1678, 1583, 29889, 3539, 29918, 2536, 2247, 29898, 29886, 29897, 13, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29953, 29946, 29901, 334, 29945, 29930, 364, 303, 29889, 3539, 29918, 29878, 303, 29918, 8336, 13, 1678, 822, 2436, 29918, 29878, 303, 29918, 8336, 29898, 1311, 29892, 282, 29892, 7876, 1125, 13, 4706, 9995, 18455, 282, 29915, 29879, 5447, 304, 364, 303, 8974, 1213, 15945, 13, 4706, 274, 353, 1583, 29889, 29883, 13, 4706, 1583, 29889, 4632, 353, 282, 29889, 8552, 580, 13, 4706, 396, 13, 4706, 396, 10886, 8025, 322, 2224, 29889, 13, 4706, 270, 353, 274, 29889, 16192, 3596, 17392, 3145, 29898, 29886, 29897, 13, 4706, 1583, 29889, 22331, 353, 270, 29889, 657, 877, 22331, 1495, 470, 525, 9420, 29899, 29947, 29915, 13, 4706, 1583, 29889, 2084, 353, 270, 29889, 657, 877, 2084, 1495, 470, 6629, 13, 4706, 396, 14350, 278, 1962, 304, 1583, 29889, 2914, 29918, 1761, 29889, 13, 4706, 1583, 29889, 2914, 29918, 1761, 353, 5159, 29871, 396, 2178, 1962, 5771, 1244, 29889, 13, 4706, 565, 1583, 29889, 17158, 29918, 29878, 303, 29918, 6672, 29918, 9342, 29901, 13, 9651, 1583, 29889, 2914, 29918, 1761, 29889, 4397, 29898, 29888, 29908, 636, 364, 303, 29941, 29901, 10422, 29901, 426, 9144, 27195, 13, 4706, 363, 282, 297, 1583, 29889, 4632, 29889, 1311, 29918, 392, 29918, 1491, 8336, 7295, 13, 9651, 1583, 29889, 3539, 4247, 29898, 29886, 29897, 13, 4706, 2752, 353, 1583, 29889, 26017, 29918, 2914, 580, 13, 4706, 736, 2752, 13, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29947, 29906, 29906, 29900, 29929, 29906, 29945, 29946, 29953, 29889, 29945, 29947, 29941, 29945, 29901, 334, 29945, 29930, 364, 303, 29889, 3539, 29918, 2536, 2247, 669, 16876, 13, 1678, 822, 2436, 29918, 2536, 2247, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 18455, 282, 29915, 29879, 4344, 304, 2243, 2247, 1213, 15945, 13, 4706, 274, 353, 1583, 29889, 29883, 13, 4706, 282, 353, 282, 29889, 8552, 580, 13, 4706, 298, 353, 282, 29889, 29882, 13, 4706, 474, 353, 330, 29889, 11014, 29918, 333, 29898, 29882, 29892, 29871, 29896, 29897, 29871, 396, 4971, 666, 278, 18803, 29915, 13, 4706, 2924, 29892, 7876, 353, 298, 7503, 29875, 1822, 17010, 3285, 298, 29961, 29875, 29901, 1822, 17010, 580, 13, 4706, 565, 451, 7876, 29901, 13, 9651, 330, 29889, 2704, 29898, 29888, 29908, 29912, 14380, 29913, 6858, 934, 1024, 1159, 13, 9651, 736, 13, 4706, 3611, 353, 282, 29889, 4102, 5938, 2141, 29882, 565, 282, 322, 282, 29889, 4102, 5938, 580, 1683, 12801, 1217, 20343, 16299, 13, 4706, 3611, 353, 3611, 29889, 17010, 2141, 5030, 2410, 675, 580, 13, 4706, 302, 29918, 4260, 353, 282, 29889, 4537, 2776, 19334, 580, 13, 4706, 302, 353, 29871, 29896, 13, 4706, 270, 353, 274, 29889, 16192, 3596, 17392, 3145, 29898, 29886, 29897, 13, 4706, 1583, 29889, 22331, 353, 270, 29889, 657, 877, 22331, 1495, 470, 525, 9420, 29899, 29947, 29915, 13, 4706, 1583, 29889, 2084, 353, 270, 29889, 657, 877, 2084, 1495, 470, 6629, 13, 4706, 363, 2278, 297, 282, 29889, 11991, 7295, 13, 9651, 396, 11796, 29872, 278, 20343, 29915, 29879, 934, 1024, 29889, 13, 9651, 7876, 29906, 29892, 1294, 353, 330, 29889, 359, 29918, 2084, 29918, 23579, 568, 486, 29898, 9144, 29897, 13, 9651, 7876, 29906, 353, 285, 29908, 29912, 9144, 29906, 7402, 29912, 29876, 29901, 29900, 29941, 29881, 1157, 1062, 5038, 29871, 396, 4803, 8236, 24786, 363, 584, 23705, 29901, 29889, 13, 9651, 302, 4619, 29871, 29896, 13, 9651, 396, 14350, 278, 364, 303, 8974, 29889, 13, 9651, 1583, 29889, 2914, 29918, 1761, 353, 5159, 13, 9651, 1583, 29889, 3539, 29903, 7459, 7030, 29898, 3257, 29892, 302, 448, 29871, 29896, 29892, 302, 29918, 4260, 29897, 13, 9651, 1583, 29889, 2914, 29918, 1761, 29889, 4397, 29898, 5145, 29889, 29890, 29897, 13, 9651, 2752, 353, 1583, 29889, 26017, 29918, 2914, 580, 13, 9651, 1583, 29889, 3539, 29918, 1514, 13239, 29918, 5325, 29898, 9144, 29906, 29892, 282, 29892, 2752, 29897, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29947, 29906, 29906, 29896, 29955, 29946, 29955, 29906, 29945, 29889, 29945, 29947, 29941, 29953, 29901, 334, 29953, 29930, 364, 303, 29889, 3539, 29903, 7459, 7030, 13, 1678, 822, 2436, 29903, 7459, 7030, 29898, 1311, 29892, 3611, 29892, 302, 29892, 302, 29918, 4260, 1125, 13, 4706, 9995, 6113, 278, 3611, 29892, 1090, 21354, 411, 278, 16321, 29915, 2931, 1213, 15945, 13, 4706, 565, 302, 2804, 29871, 29896, 29901, 13, 9651, 3611, 353, 285, 29908, 29912, 3257, 29913, 21313, 29876, 29913, 310, 426, 29876, 29918, 4260, 1800, 29908, 13, 4706, 2920, 353, 4236, 29898, 29946, 29892, 7431, 29898, 29887, 29889, 517, 8566, 6797, 1231, 29898, 3257, 29892, 13, 9651, 8025, 29922, 1311, 29889, 22331, 29892, 3461, 22463, 29922, 8824, 4961, 13, 4706, 1583, 29889, 2914, 29918, 1761, 29889, 4397, 29898, 29888, 29908, 29912, 3257, 1012, 29876, 10998, 29937, 29915, 334, 2920, 27195, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29947, 29945, 29901, 334, 29945, 29930, 364, 303, 29889, 3539, 4247, 669, 16876, 13, 1678, 822, 2436, 4247, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 18277, 278, 364, 303, 27236, 283, 778, 304, 1583, 29889, 2914, 29918, 1761, 1213, 15945, 13, 4706, 274, 353, 1583, 29889, 29883, 13, 4706, 565, 1583, 29889, 275, 29918, 17281, 29918, 3177, 29898, 29886, 29897, 470, 1583, 29889, 262, 29918, 17281, 29918, 8336, 29898, 29886, 1125, 13, 9651, 736, 13, 4706, 565, 330, 29889, 4352, 29918, 1742, 29898, 29886, 29889, 29882, 29892, 29871, 29900, 29892, 18803, 29878, 303, 29899, 1217, 29899, 2813, 29374, 13, 9651, 1583, 29889, 2914, 29918, 1761, 29889, 4397, 29898, 1311, 29889, 4572, 29918, 29890, 29898, 29883, 29892, 282, 876, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1124, 29918, 1202, 4247, 24619, 29898, 29886, 29897, 13, 9651, 565, 282, 2804, 1583, 29889, 4632, 29901, 13, 18884, 1583, 29889, 2914, 29918, 1761, 29889, 4397, 29898, 1311, 29889, 15614, 29898, 29886, 29892, 1583, 29889, 4572, 29918, 29882, 29898, 29883, 29892, 282, 4961, 13, 9651, 1583, 29889, 2914, 29918, 1761, 29889, 4397, 29898, 1311, 29889, 4572, 29918, 29890, 29898, 29883, 29892, 282, 876, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29929, 29953, 29901, 334, 29953, 29930, 364, 303, 29889, 1124, 29918, 1202, 4247, 24619, 13, 1678, 822, 1732, 29918, 1202, 4247, 24619, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 13, 4706, 3462, 263, 2943, 17456, 363, 278, 878, 29918, 1124, 7079, 313, 10922, 11726, 2385, 770, 467, 13, 13, 4706, 450, 937, 2211, 3161, 526, 263, 5096, 310, 8282, 29892, 278, 1791, 338, 3472, 775, 1057, 13, 13, 9651, 518, 13, 18884, 529, 4039, 302, 1369, 10202, 529, 4039, 302, 1095, 10202, 529, 1228, 5096, 3161, 10202, 13, 18884, 529, 1420, 1196, 29871, 29896, 10202, 529, 1420, 1196, 29871, 29906, 10202, 2023, 13, 9651, 4514, 13, 13, 4706, 529, 1228, 5096, 3161, 29958, 756, 278, 1021, 3829, 1057, 13, 13, 9651, 518, 29966, 4039, 302, 29899, 29896, 1369, 10202, 529, 4039, 302, 29899, 29896, 1095, 10202, 529, 1228, 5096, 3161, 29958, 29962, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 1124, 29918, 2974, 29918, 5924, 29901, 13, 9651, 1583, 29889, 3177, 4557, 4619, 29871, 29896, 13, 9651, 17360, 978, 353, 285, 29908, 29912, 1311, 29889, 3177, 29918, 463, 29918, 22976, 1157, 1311, 29889, 3177, 4557, 5038, 13, 9651, 1583, 29889, 2914, 29918, 1761, 29889, 4397, 29898, 29888, 29908, 636, 7722, 25367, 978, 6177, 1159, 13, 9651, 1583, 29889, 1124, 29918, 1958, 29961, 25367, 978, 29962, 353, 282, 29889, 8552, 580, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29947, 29896, 29941, 29900, 29946, 29896, 29896, 29941, 29929, 29889, 29945, 29929, 29896, 29929, 29901, 334, 29946, 29930, 364, 303, 29889, 3539, 29918, 1514, 13239, 29918, 5325, 669, 1371, 414, 13, 1678, 822, 2436, 29918, 1514, 13239, 29918, 5325, 29898, 1311, 29892, 7876, 29892, 282, 29892, 2752, 1125, 13, 4706, 9995, 6113, 2752, 304, 278, 19697, 934, 322, 2436, 278, 1962, 515, 1574, 13239, 636, 15945, 29908, 13, 4706, 432, 2960, 29892, 1294, 353, 330, 29889, 359, 29918, 2084, 29918, 23579, 568, 486, 29898, 9144, 29897, 13, 4706, 1294, 353, 1294, 29889, 13609, 580, 13, 4706, 7876, 353, 1583, 29889, 26017, 6466, 17020, 29898, 9144, 29897, 13, 4706, 3431, 353, 1583, 29889, 3258, 9882, 2831, 2283, 29898, 9144, 29897, 13, 4706, 565, 451, 3431, 29901, 13, 9651, 736, 13, 4706, 396, 14350, 278, 19697, 934, 29889, 13, 4706, 565, 1583, 29889, 3539, 29918, 1639, 13847, 29918, 1445, 29901, 13, 9651, 1583, 29889, 3539, 4074, 13847, 2283, 29898, 9144, 29892, 2752, 29897, 13, 4706, 396, 10575, 591, 1246, 1574, 13239, 29973, 13, 4706, 565, 451, 1583, 29889, 4804, 29918, 1514, 13239, 29901, 13, 9651, 736, 13, 4706, 565, 1294, 451, 297, 313, 4286, 13357, 742, 15300, 1420, 742, 15300, 4776, 742, 15300, 5140, 742, 15300, 29879, 29945, 742, 15300, 397, 29873, 29374, 29871, 396, 396, 29896, 29947, 29947, 29946, 29901, 1243, 1286, 29889, 13, 9651, 736, 13, 4706, 396, 14350, 278, 1121, 515, 1574, 13239, 29889, 13, 4706, 269, 353, 1583, 29889, 3539, 1762, 14526, 13239, 29898, 4993, 29892, 1294, 29897, 13, 4706, 565, 269, 322, 1294, 297, 313, 4286, 1420, 742, 15300, 13357, 29374, 13, 9651, 269, 353, 1583, 29889, 1202, 7030, 1762, 10922, 29898, 29879, 29897, 13, 4706, 565, 451, 269, 29901, 13, 9651, 736, 13, 4706, 269, 353, 330, 29889, 517, 8566, 6797, 1231, 29898, 29879, 29892, 525, 9420, 29899, 29947, 1495, 13, 4706, 411, 1722, 29898, 9144, 29892, 525, 29893, 29890, 1495, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 29879, 29897, 13, 9651, 1583, 29889, 29876, 29918, 1514, 13239, 4619, 29871, 29896, 13, 4706, 1583, 29889, 12276, 29898, 9144, 29897, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29947, 29896, 29941, 29900, 29946, 29896, 29896, 29941, 29929, 29889, 29945, 29929, 29896, 29941, 29901, 334, 29945, 29930, 364, 303, 29889, 1202, 7030, 1762, 10922, 13, 1678, 822, 788, 7030, 1762, 10922, 29898, 1311, 29892, 269, 1125, 13, 4706, 9995, 13, 4706, 22108, 385, 4069, 529, 3257, 29958, 1543, 491, 278, 8118, 310, 278, 937, 529, 29882, 29896, 29958, 13, 4706, 1543, 29889, 13, 4706, 9995, 13, 4706, 474, 353, 269, 29889, 2886, 877, 29966, 3257, 2565, 3257, 29958, 1495, 13, 4706, 565, 474, 1275, 448, 29896, 29901, 13, 9651, 736, 269, 13, 4706, 286, 353, 337, 29889, 4478, 29898, 29878, 29915, 29966, 29882, 29896, 29958, 4197, 29985, 29966, 29962, 7528, 829, 29882, 29896, 29958, 742, 269, 29897, 13, 4706, 565, 451, 286, 29901, 13, 9651, 286, 353, 337, 29889, 4478, 29898, 29878, 29915, 29966, 29882, 29896, 5299, 22896, 29958, 10062, 29958, 4197, 29985, 29966, 29962, 7528, 829, 29874, 2565, 29882, 29896, 29958, 742, 269, 29897, 13, 4706, 565, 286, 29901, 13, 9651, 269, 353, 269, 29889, 6506, 877, 29966, 3257, 2565, 3257, 29958, 742, 13, 18884, 285, 29908, 29966, 3257, 26208, 29885, 29889, 2972, 29898, 29896, 2915, 829, 3257, 29958, 1159, 13, 4706, 736, 269, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29947, 29929, 29901, 334, 29945, 29930, 364, 303, 29889, 26017, 6466, 17020, 13, 1678, 822, 10272, 6466, 17020, 29898, 1311, 29892, 7876, 1125, 13, 4706, 9995, 11609, 278, 2989, 2224, 304, 278, 1962, 934, 1213, 15945, 13, 4706, 274, 353, 1583, 29889, 29883, 13, 4706, 1722, 9882, 353, 274, 29889, 2557, 29889, 3150, 9882, 13, 4706, 565, 1583, 29889, 4381, 29918, 2084, 29901, 13, 9651, 2224, 353, 330, 29889, 359, 29918, 2084, 29918, 8394, 675, 29918, 7122, 29898, 1311, 29889, 2084, 29892, 1583, 29889, 4381, 29918, 2084, 29892, 7876, 29897, 13, 4706, 25342, 1583, 29889, 2084, 29901, 13, 9651, 2224, 353, 330, 29889, 359, 29918, 2084, 29918, 8394, 675, 29918, 7122, 29898, 1311, 29889, 2084, 29892, 7876, 29897, 13, 4706, 25342, 1722, 9882, 29901, 13, 9651, 2224, 353, 330, 29889, 359, 29918, 2084, 29918, 8394, 675, 29918, 7122, 29898, 1311, 29889, 2084, 29892, 1722, 9882, 29892, 7876, 29897, 13, 4706, 1683, 29901, 13, 9651, 2224, 353, 330, 29889, 359, 29918, 2084, 29918, 8394, 675, 29918, 7122, 29898, 9144, 29897, 13, 4706, 736, 2224, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29947, 29896, 29941, 29900, 29946, 29896, 29896, 29941, 29929, 29889, 29945, 29929, 29896, 29946, 29901, 334, 29945, 29930, 364, 303, 29889, 3258, 9882, 2831, 2283, 13, 1678, 822, 1653, 9882, 2831, 2283, 29898, 1311, 29892, 7876, 1125, 13, 4706, 9995, 13, 4706, 6204, 278, 3884, 363, 7876, 565, 13, 4706, 263, 29897, 372, 1838, 29915, 29873, 1863, 322, 13, 4706, 289, 29897, 278, 1404, 3987, 2758, 372, 29889, 13, 13, 4706, 7106, 5852, 565, 278, 3884, 22856, 470, 471, 1754, 29889, 13, 4706, 9995, 13, 4706, 274, 29892, 3431, 353, 1583, 29889, 29883, 29892, 7700, 29871, 396, 29871, 29896, 29947, 29896, 29945, 29889, 13, 4706, 396, 6204, 278, 3884, 565, 372, 1838, 29915, 29873, 1863, 29889, 13, 4706, 278, 9170, 29892, 432, 2960, 353, 330, 29889, 359, 29918, 2084, 29918, 5451, 29898, 9144, 29897, 13, 4706, 278, 9170, 353, 330, 29889, 359, 29918, 2084, 29918, 8394, 675, 29898, 1552, 9170, 29897, 29871, 396, 29871, 29896, 29941, 29946, 29896, 13, 4706, 565, 330, 29889, 359, 29918, 2084, 29918, 9933, 29898, 1552, 9170, 1125, 13, 9651, 736, 5852, 13, 4706, 565, 274, 322, 274, 29889, 2917, 322, 274, 29889, 2917, 29889, 3258, 29918, 9290, 29916, 9696, 29918, 11851, 3842, 29901, 13, 9651, 278, 9170, 353, 274, 29889, 18837, 29918, 2084, 29918, 17471, 29898, 1552, 9170, 29897, 13, 9651, 3431, 353, 330, 29889, 5675, 3596, 12283, 1252, 9696, 17392, 3842, 29898, 1552, 9170, 29897, 29871, 396, 1134, 29901, 17281, 13, 9651, 565, 451, 3431, 29901, 13, 18884, 330, 29889, 2704, 877, 18361, 451, 1653, 29901, 742, 278, 9170, 29897, 13, 4706, 736, 3431, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29896, 29900, 29900, 29947, 29896, 29941, 29900, 29946, 29896, 29896, 29941, 29929, 29889, 29945, 29929, 29896, 29906, 29901, 334, 29945, 29930, 364, 303, 29889, 3539, 4074, 13847, 2283, 13, 1678, 822, 2436, 4074, 13847, 2283, 29898, 1311, 29892, 7876, 29892, 269, 1125, 13, 4706, 9995, 6113, 269, 304, 304, 278, 934, 5069, 1024, 338, 7876, 1213, 15945, 13, 4706, 396, 1294, 353, 1583, 29889, 657, 8375, 29898, 29886, 29892, 525, 3539, 29918, 1639, 13847, 29918, 17588, 1495, 13, 4706, 1294, 353, 1583, 29889, 3539, 29918, 1639, 13847, 29918, 17588, 13, 4706, 565, 451, 1294, 29889, 27382, 2541, 877, 6169, 1125, 13, 9651, 1294, 353, 525, 6169, 718, 1294, 13, 4706, 7876, 353, 7876, 718, 1294, 13, 4706, 411, 1722, 29898, 9144, 29892, 525, 29893, 742, 8025, 29922, 1311, 29889, 22331, 29897, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 29879, 29897, 13, 9651, 1583, 29889, 29876, 29918, 1639, 13847, 4619, 29871, 29896, 13, 4706, 1583, 29889, 12276, 29898, 9144, 29897, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29953, 29945, 29901, 334, 29945, 29930, 364, 303, 29889, 3539, 1762, 14526, 13239, 669, 16876, 13, 1678, 822, 2436, 1762, 14526, 13239, 29898, 1311, 29892, 269, 29892, 1294, 1125, 13, 4706, 9995, 12600, 269, 304, 1574, 13239, 773, 278, 9227, 2411, 2957, 491, 1294, 322, 736, 278, 1121, 1213, 15945, 13, 4706, 565, 451, 1574, 13239, 29901, 13, 9651, 330, 29889, 2704, 877, 3539, 1762, 14526, 13239, 29901, 1574, 13239, 451, 2198, 1495, 13, 9651, 736, 6213, 13, 4706, 5988, 353, 330, 29889, 359, 29918, 2084, 29918, 8394, 675, 29918, 7122, 13, 4706, 1722, 9882, 353, 1583, 29889, 29883, 29889, 2557, 29889, 3150, 9882, 13, 4706, 975, 24040, 353, 11117, 4905, 29918, 22331, 2396, 1583, 29889, 22331, 29913, 13, 4706, 396, 13, 4706, 396, 11796, 29872, 278, 6389, 1051, 565, 278, 11949, 4155, 2224, 947, 451, 1863, 29889, 13, 4706, 3114, 10654, 7883, 21533, 353, 1583, 29889, 8411, 18552, 292, 5568, 10654, 7883, 580, 13, 4706, 565, 1294, 1275, 15300, 5140, 2396, 13, 9651, 3883, 353, 330, 29889, 5215, 29918, 5453, 877, 280, 29877, 29889, 12800, 29889, 280, 29877, 29918, 5140, 1495, 13, 9651, 565, 451, 3883, 29901, 13, 18884, 736, 6213, 13, 9651, 9227, 353, 3883, 29889, 10507, 580, 29871, 396, 3617, 385, 2777, 29889, 13, 9651, 9227, 29918, 978, 353, 6213, 13, 4706, 1683, 29901, 13, 9651, 9227, 353, 6213, 13, 9651, 363, 1294, 29906, 29892, 9227, 29918, 978, 297, 313, 13, 18884, 313, 4286, 1420, 742, 525, 1420, 5477, 13, 18884, 313, 4286, 13357, 742, 525, 1420, 5477, 13, 18884, 313, 4286, 4776, 742, 525, 25694, 5477, 13, 18884, 313, 4286, 5140, 742, 525, 280, 29877, 29889, 12800, 29889, 280, 29877, 29918, 5140, 5477, 13, 18884, 313, 4286, 29879, 29945, 742, 525, 29879, 29945, 5477, 13, 18884, 313, 4286, 397, 29873, 742, 525, 397, 29873, 5477, 13, 632, 1125, 13, 18884, 565, 1294, 29906, 1275, 1294, 29901, 13, 462, 1678, 2867, 13, 9651, 1683, 29901, 13, 18884, 330, 29889, 2704, 29898, 29888, 29908, 26690, 1574, 13239, 6081, 29901, 426, 1062, 27195, 13, 18884, 736, 6213, 13, 4706, 396, 13, 4706, 396, 8561, 278, 11949, 4155, 2224, 6198, 304, 1722, 3884, 29889, 13, 4706, 1104, 29918, 13558, 29918, 2084, 353, 1583, 29889, 13558, 29918, 2084, 470, 6629, 13, 4706, 11949, 4155, 29918, 2084, 353, 5988, 29898, 3150, 9882, 29892, 1104, 29918, 13558, 29918, 2084, 29897, 13, 4706, 4974, 1583, 29889, 13558, 29918, 978, 13, 4706, 2224, 353, 5988, 29898, 1311, 29889, 13558, 29918, 2084, 29892, 1583, 29889, 13558, 29918, 978, 29897, 13, 4706, 565, 451, 1583, 29889, 13558, 29918, 17987, 29901, 13, 9651, 1104, 29918, 2084, 353, 5988, 29898, 2674, 29918, 13558, 29918, 2084, 29892, 1583, 29889, 13558, 29918, 978, 29897, 13, 9651, 1104, 29918, 2084, 353, 1104, 29918, 2084, 29889, 6506, 877, 1966, 742, 8207, 1495, 13, 9651, 975, 24040, 1839, 13558, 2033, 353, 1104, 29918, 2084, 13, 9651, 975, 24040, 1839, 13558, 29918, 2084, 2033, 353, 6213, 13, 9651, 975, 24040, 1839, 17987, 29918, 13558, 2033, 353, 6213, 13, 4706, 25342, 2897, 29889, 2084, 29889, 9933, 29898, 2084, 1125, 13, 9651, 565, 1294, 2804, 15300, 5140, 2396, 13, 18884, 975, 24040, 1839, 13558, 2033, 353, 2224, 13, 18884, 975, 24040, 1839, 13558, 29918, 2084, 2033, 353, 6213, 13, 4706, 25342, 3114, 10654, 7883, 21533, 29901, 13, 9651, 330, 29889, 267, 29918, 2158, 877, 4746, 9805, 29918, 19218, 29918, 1454, 29918, 27259, 29918, 9783, 354, 1691, 742, 3114, 10654, 7883, 21533, 29897, 13, 9651, 975, 24040, 29889, 5504, 29898, 3293, 10654, 7883, 21533, 29897, 29871, 396, 341, 29956, 29907, 788, 6389, 304, 6055, 13, 4706, 25342, 1104, 29918, 13558, 29918, 2084, 1275, 11949, 4155, 29918, 2084, 29901, 13, 9651, 330, 29889, 2704, 29898, 29888, 29908, 13558, 451, 1476, 29901, 426, 2084, 27195, 13, 4706, 1683, 29901, 13, 9651, 330, 29889, 2704, 877, 13558, 451, 1476, 29905, 29876, 742, 2224, 29897, 13, 9651, 565, 1583, 29889, 2084, 29901, 13, 18884, 330, 29889, 267, 29918, 2158, 877, 29992, 2084, 29901, 742, 1583, 29889, 2084, 29897, 13, 9651, 330, 29889, 267, 29918, 2158, 877, 3150, 2224, 29901, 742, 1722, 9882, 29897, 13, 9651, 565, 1104, 29918, 13558, 29918, 2084, 29901, 13, 18884, 330, 29889, 267, 29918, 2158, 877, 22925, 2224, 29901, 742, 1104, 29918, 13558, 29918, 2084, 29897, 13, 4706, 1018, 29901, 13, 9651, 1121, 353, 6213, 13, 9651, 1121, 353, 1574, 13239, 29889, 3221, 29889, 23679, 29918, 1807, 29898, 4993, 29922, 29879, 29892, 13, 462, 1678, 9591, 29918, 978, 2433, 1689, 18785, 742, 13, 462, 1678, 13812, 29918, 978, 2433, 5060, 1247, 2955, 726, 742, 13, 462, 1678, 9227, 29922, 13236, 29892, 13, 462, 1678, 9227, 29918, 978, 29922, 13236, 29918, 978, 29892, 13, 462, 1678, 6055, 29918, 957, 24040, 29922, 957, 24040, 29897, 13, 9651, 565, 338, 8758, 29898, 2914, 29892, 6262, 1125, 13, 18884, 1121, 353, 330, 29889, 517, 2525, 12858, 29898, 2914, 29897, 13, 4706, 5174, 1574, 13239, 29889, 4873, 2392, 408, 1059, 29901, 13, 9651, 330, 29889, 2704, 877, 14526, 13239, 1059, 29901, 1495, 13, 9651, 330, 29889, 9539, 29898, 2704, 29897, 13, 4706, 5174, 8960, 29901, 13, 9651, 330, 29889, 267, 29918, 2158, 877, 29965, 13996, 6021, 1574, 13239, 3682, 1495, 13, 9651, 330, 29889, 267, 29918, 11739, 580, 13, 4706, 736, 1121, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29953, 29953, 29901, 334, 29953, 29930, 364, 303, 29889, 8411, 18552, 292, 5568, 10654, 7883, 13, 1678, 822, 4386, 18552, 292, 5568, 10654, 7883, 29898, 1311, 29892, 269, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 20969, 278, 9805, 29918, 19218, 29918, 1454, 29918, 27259, 29918, 9783, 354, 1691, 2984, 29892, 13, 4706, 7863, 263, 9657, 6943, 278, 21213, 6389, 29889, 13, 4706, 9995, 13, 4706, 565, 29871, 29900, 29901, 13, 9651, 396, 2823, 1732, 597, 1514, 13239, 29889, 28315, 29889, 1212, 29914, 2640, 29914, 1792, 29914, 2917, 29889, 1420, 29937, 18329, 13, 9651, 736, 426, 13, 18884, 525, 18329, 2396, 525, 12276, 742, 13, 18884, 525, 3225, 6768, 2396, 525, 996, 1674, 29892, 29896, 29906, 415, 29892, 1026, 2153, 675, 742, 13, 9651, 500, 13, 4706, 565, 451, 269, 29901, 13, 9651, 269, 353, 1583, 29889, 23679, 29918, 19218, 29918, 1454, 29918, 27259, 29918, 9783, 354, 1691, 13, 4706, 565, 451, 269, 29901, 13, 9651, 736, 6571, 13, 4706, 396, 13, 4706, 396, 29273, 2980, 8857, 1316, 408, 445, 29901, 13, 4706, 396, 1192, 11675, 29922, 264, 7839, 18329, 29922, 12276, 7839, 3225, 6768, 11759, 996, 1674, 29892, 29896, 29906, 415, 29892, 1026, 2153, 675, 29962, 13, 4706, 270, 353, 6571, 13, 4706, 1550, 269, 29901, 13, 9651, 269, 353, 269, 29889, 17010, 580, 13, 9651, 565, 451, 269, 29889, 27382, 2541, 877, 489, 29374, 13, 18884, 2867, 13, 9651, 269, 353, 269, 29961, 29906, 29901, 1822, 17010, 580, 13, 9651, 11594, 353, 269, 29889, 2886, 877, 29922, 1495, 13, 9651, 7477, 353, 269, 29889, 2886, 29317, 1495, 13, 9651, 565, 11594, 1275, 448, 29896, 470, 8521, 29896, 529, 7477, 529, 11594, 1125, 29871, 396, 1820, 29961, 12938, 29962, 470, 1820, 29892, 13, 18884, 659, 353, 6629, 13, 18884, 7477, 353, 269, 29889, 2886, 29317, 1495, 13, 18884, 565, 7477, 1275, 448, 29896, 29901, 13, 462, 1678, 1820, 353, 269, 29889, 17010, 580, 13, 462, 1678, 269, 353, 6629, 13, 18884, 1683, 29901, 13, 462, 1678, 1820, 353, 269, 7503, 4912, 1822, 17010, 580, 13, 462, 1678, 269, 353, 269, 29961, 4912, 718, 29871, 29896, 584, 1822, 17010, 580, 13, 9651, 1683, 29901, 29871, 396, 1820, 353, 659, 13, 18884, 1820, 353, 269, 7503, 1837, 1822, 17010, 580, 13, 18884, 269, 353, 269, 29961, 1837, 718, 29871, 29896, 584, 1822, 17010, 580, 13, 18884, 565, 269, 29889, 27382, 2541, 877, 1839, 1125, 29871, 396, 21945, 13, 462, 1678, 364, 29890, 353, 269, 29889, 2886, 877, 29962, 1495, 13, 462, 1678, 565, 364, 29890, 1275, 448, 29896, 29901, 13, 462, 4706, 2867, 29871, 396, 9178, 2980, 29889, 13, 462, 1678, 659, 353, 269, 7503, 364, 29890, 718, 29871, 29896, 29962, 13, 462, 1678, 269, 353, 269, 29961, 6050, 718, 29871, 29896, 584, 1822, 17010, 580, 13, 462, 1678, 565, 269, 29889, 27382, 2541, 29898, 3788, 1125, 13, 462, 4706, 269, 353, 269, 29961, 29896, 29901, 1822, 17010, 580, 13, 18884, 1683, 29901, 29871, 396, 659, 29961, 12938, 29962, 470, 659, 29892, 13, 462, 1678, 7477, 353, 269, 29889, 2886, 29317, 1495, 13, 462, 1678, 565, 7477, 1275, 448, 29896, 29901, 13, 462, 4706, 659, 353, 269, 13, 462, 4706, 269, 353, 6629, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 659, 353, 269, 7503, 4912, 1822, 17010, 580, 13, 462, 4706, 269, 353, 269, 29961, 4912, 718, 29871, 29896, 584, 1822, 17010, 580, 13, 9651, 565, 451, 1820, 29901, 13, 18884, 2867, 13, 9651, 565, 451, 659, 29889, 17010, 7295, 13, 18884, 659, 353, 525, 29896, 29915, 13, 9651, 270, 29961, 710, 29898, 1989, 4638, 353, 851, 29898, 791, 29897, 13, 4706, 736, 270, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29896, 29906, 29896, 29945, 29941, 29929, 29900, 29941, 29889, 29945, 29947, 29900, 29941, 29901, 334, 29946, 29930, 364, 303, 29889, 3539, 4178, 12300, 2283, 669, 1371, 414, 13, 1678, 822, 2436, 4178, 12300, 2283, 29898, 1311, 29892, 282, 29892, 29729, 29892, 1962, 2283, 1125, 13, 4706, 9995, 13, 4706, 472, 29889, 3539, 4178, 12300, 21002, 5717, 445, 1158, 304, 2436, 385, 732, 6921, 5447, 13, 4706, 6943, 19673, 364, 1254, 775, 29889, 13, 13, 4706, 472, 29889, 3539, 4178, 12300, 21002, 674, 3802, 278, 1962, 934, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 2914, 29918, 1761, 353, 5159, 13, 4706, 1583, 29889, 2344, 4178, 12300, 6113, 29898, 29886, 29897, 13, 4706, 1583, 29889, 4632, 353, 282, 29889, 8552, 580, 13, 4706, 1156, 353, 282, 29889, 3177, 13555, 9643, 580, 13, 4706, 565, 451, 1583, 29889, 275, 17618, 1725, 6113, 29898, 29886, 1125, 13, 9651, 736, 7700, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 271, 29918, 6921, 29918, 3539, 353, 5852, 29871, 396, 3789, 278, 7353, 363, 1090, 1220, 29889, 13, 9651, 282, 353, 282, 29889, 4102, 5938, 580, 29871, 396, 319, 15833, 29901, 11455, 278, 3876, 2943, 29889, 13, 9651, 1550, 282, 322, 282, 2804, 1156, 29901, 13, 18884, 1583, 29889, 3539, 4247, 29898, 29886, 29897, 29871, 396, 2625, 2779, 29901, 3061, 2925, 282, 13, 9651, 269, 353, 1583, 29889, 26017, 29918, 2914, 580, 13, 9651, 1962, 2283, 29889, 3539, 29898, 29879, 29897, 13, 9651, 3431, 353, 5852, 13, 4706, 5174, 8960, 29901, 13, 9651, 3431, 353, 7700, 13, 4706, 7146, 29901, 13, 9651, 1583, 29889, 271, 29918, 6921, 29918, 3539, 353, 7700, 13, 4706, 736, 3431, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29896, 29941, 29900, 29955, 29941, 29953, 29941, 29906, 29889, 29945, 29955, 29941, 29941, 29901, 334, 29945, 29930, 364, 303, 29889, 2344, 4178, 12300, 6113, 13, 1678, 822, 2069, 4178, 12300, 6113, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 6644, 1090, 1915, 292, 363, 363, 385, 732, 6921, 2436, 1213, 15945, 13, 4706, 396, 4911, 29899, 12119, 1090, 1915, 292, 4890, 1207, 694, 4060, 297, 732, 6921, 29899, 29878, 303, 29889, 13, 4706, 270, 353, 282, 29889, 29894, 29889, 29884, 29889, 657, 877, 29878, 303, 29899, 5215, 742, 426, 1800, 13, 4706, 1090, 9012, 29906, 353, 270, 29889, 657, 877, 5062, 9012, 29906, 742, 27255, 13, 4706, 396, 13, 4706, 396, 1938, 334, 1333, 29930, 731, 263, 2322, 363, 975, 1915, 292, 4890, 29889, 13, 4706, 565, 7431, 29898, 5062, 9012, 29906, 29897, 1405, 29871, 29896, 29901, 13, 9651, 1090, 9012, 29906, 353, 1090, 9012, 29906, 29961, 29900, 29962, 13, 9651, 330, 29889, 27392, 29898, 29888, 29908, 517, 29877, 1784, 2246, 29899, 5563, 1090, 9012, 29892, 773, 426, 5062, 9012, 29906, 27195, 13, 4706, 1090, 9012, 29896, 353, 270, 29889, 657, 877, 5062, 9012, 29896, 742, 27255, 13, 4706, 396, 13, 4706, 396, 18011, 1090, 9012, 411, 2322, 4890, 29889, 13, 4706, 2322, 29918, 5062, 9012, 353, 525, 29922, 29974, 29930, 29985, 30022, 26732, 11120, 29899, 29901, 5299, 29918, 29915, 13, 4706, 565, 1090, 9012, 29896, 29901, 13, 9651, 363, 521, 297, 2322, 29918, 5062, 9012, 29961, 29896, 29901, 5387, 13, 18884, 565, 521, 451, 297, 1090, 9012, 29896, 29901, 13, 462, 1678, 1090, 9012, 29896, 353, 1090, 9012, 29896, 718, 521, 13, 4706, 1683, 29901, 13, 9651, 1090, 9012, 29896, 353, 2322, 29918, 5062, 9012, 13, 4706, 1583, 29889, 271, 29918, 6921, 29918, 5062, 9012, 353, 1090, 9012, 29906, 718, 1090, 9012, 29896, 13, 4706, 1583, 29889, 5062, 9012, 29896, 353, 1090, 9012, 29896, 13, 4706, 1583, 29889, 5062, 9012, 29906, 353, 1090, 9012, 29906, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29946, 29900, 29896, 29896, 29945, 29945, 29900, 29945, 29955, 29889, 29955, 29901, 334, 29945, 29930, 364, 303, 29889, 275, 17618, 1725, 6113, 13, 1678, 822, 338, 17618, 1725, 6113, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 13, 4706, 7106, 5852, 565, 2943, 282, 640, 5026, 3078, 541, 13, 4706, 364, 303, 29899, 6768, 304, 278, 2436, 29889, 13, 4706, 9995, 13, 4706, 3454, 353, 330, 29889, 5451, 20261, 29898, 29886, 29889, 29890, 29897, 13, 4706, 363, 503, 297, 3454, 29901, 13, 9651, 565, 503, 29889, 17010, 580, 322, 451, 503, 29889, 27382, 2541, 877, 29992, 1495, 322, 451, 503, 29889, 27382, 2541, 877, 636, 525, 1125, 13, 18884, 396, 319, 1855, 1196, 393, 674, 451, 367, 3971, 29889, 13, 18884, 330, 29889, 2704, 877, 348, 11177, 732, 6921, 29899, 29878, 303, 1495, 13, 18884, 330, 29889, 267, 877, 2587, 1426, 674, 367, 17262, 297, 29905, 29876, 742, 282, 29889, 29882, 29897, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29953, 29955, 29901, 334, 29946, 29930, 364, 303, 29889, 3539, 4247, 8246, 13, 1678, 822, 2436, 4247, 8246, 29898, 1311, 29892, 282, 1125, 13, 4706, 9995, 13, 4706, 364, 303, 29889, 3539, 4247, 8246, 29901, 319, 19725, 363, 12078, 29889, 2216, 1304, 297, 22533, 29889, 13, 13, 4706, 14350, 282, 29915, 29879, 5447, 304, 263, 1347, 408, 565, 372, 892, 385, 732, 29878, 303, 2943, 29889, 13, 4706, 7106, 278, 1347, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 3539, 29918, 29878, 303, 29918, 8336, 29898, 29886, 29892, 7876, 29922, 29886, 29889, 29882, 29897, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29941, 29906, 29929, 29896, 29900, 29945, 29946, 29945, 29953, 29889, 29896, 29901, 334, 29941, 29930, 364, 303, 29901, 2514, 2153, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29941, 29906, 29929, 29896, 29900, 29945, 29929, 29946, 29947, 29889, 29896, 29901, 334, 29946, 29930, 364, 303, 29889, 4572, 29918, 29890, 669, 1583, 29889, 4572, 29918, 29882, 13, 1678, 822, 4175, 29918, 29890, 29898, 1311, 29892, 274, 29892, 282, 1125, 13, 4706, 9995, 13, 4706, 19916, 282, 29889, 29890, 411, 1404, 29918, 4572, 29918, 29890, 740, 29889, 13, 4706, 3872, 29915, 29873, 2758, 21166, 746, 297, 278, 732, 6921, 29899, 29878, 303, 5900, 29889, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 1792, 29918, 4572, 29918, 29890, 322, 451, 1583, 29889, 271, 29918, 6921, 29918, 3539, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 282, 2904, 524, 29901, 11262, 29922, 1333, 29899, 4804, 519, 13, 18884, 736, 1583, 29889, 1792, 29918, 4572, 29918, 29890, 29898, 29883, 29892, 282, 29897, 13, 9651, 5174, 8960, 29901, 13, 18884, 330, 29889, 267, 29918, 11739, 580, 13, 18884, 1583, 29889, 1792, 29918, 4572, 29918, 29890, 353, 6213, 13, 4706, 736, 282, 29889, 29890, 13, 13, 1678, 822, 4175, 29918, 29882, 29898, 1311, 29892, 274, 29892, 282, 1125, 13, 4706, 9995, 13, 4706, 19916, 282, 29889, 29882, 411, 1404, 29918, 4572, 29918, 29882, 740, 29889, 13, 4706, 3872, 29915, 29873, 2758, 21166, 746, 297, 278, 732, 6921, 29899, 29878, 303, 5900, 29889, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 1792, 29918, 4572, 29918, 29882, 322, 451, 1583, 29889, 271, 29918, 6921, 29918, 3539, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 282, 2904, 524, 29901, 11262, 29922, 1333, 29899, 4804, 519, 13, 18884, 736, 1583, 29889, 1792, 29918, 4572, 29918, 29882, 29898, 29883, 29892, 282, 29897, 13, 9651, 5174, 8960, 29901, 13, 18884, 330, 29889, 267, 29918, 11739, 580, 13, 18884, 1583, 29889, 1792, 29918, 4572, 29918, 29882, 353, 6213, 13, 4706, 736, 282, 29889, 29882, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29941, 29906, 29929, 29896, 29896, 29896, 29945, 29906, 29947, 29889, 29896, 29901, 334, 29946, 29930, 364, 303, 29889, 9573, 24563, 29918, 4572, 13, 1678, 822, 6036, 29918, 2587, 29918, 4572, 29898, 1311, 29892, 285, 1125, 13, 4706, 9995, 15213, 278, 1404, 3573, 4175, 1213, 15945, 13, 4706, 1583, 29889, 1792, 29918, 4572, 29918, 29890, 353, 285, 13, 13, 1678, 822, 6036, 29918, 2813, 1220, 29918, 4572, 29898, 1311, 29892, 285, 1125, 13, 4706, 9995, 15213, 278, 1404, 2343, 1220, 4175, 1213, 15945, 13, 4706, 1583, 29889, 1792, 29918, 4572, 29918, 29882, 353, 285, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29941, 29941, 29896, 29900, 29947, 29946, 29946, 29900, 29955, 29889, 29896, 29901, 334, 29941, 29930, 364, 303, 29901, 21099, 293, 1078, 13, 1678, 822, 297, 29918, 17281, 29918, 8336, 29898, 1311, 29892, 282, 1125, 13, 4706, 736, 738, 29898, 29887, 29889, 4352, 29918, 1742, 29898, 29886, 29906, 29889, 29882, 29892, 29871, 29900, 29892, 18803, 29878, 303, 29899, 17281, 29899, 8336, 1495, 13, 9651, 363, 282, 29906, 297, 1583, 29889, 29878, 303, 29918, 862, 1237, 29898, 29886, 876, 13, 13, 1678, 822, 297, 29918, 29878, 303, 29918, 8336, 29898, 1311, 29892, 282, 1125, 13, 4706, 736, 738, 29898, 1311, 29889, 275, 29918, 29878, 303, 29918, 3177, 29898, 29886, 29906, 29897, 363, 282, 29906, 297, 1583, 29889, 29878, 303, 29918, 862, 1237, 29898, 29886, 876, 13, 13, 1678, 822, 297, 29918, 2536, 2247, 29918, 8336, 29898, 1311, 29892, 282, 1125, 13, 4706, 736, 738, 29898, 29887, 29889, 4352, 29918, 1742, 29898, 29886, 29889, 29882, 29892, 29871, 29900, 29892, 17962, 2536, 2247, 1159, 363, 282, 29906, 297, 1583, 29889, 29878, 303, 29918, 862, 1237, 29898, 29886, 876, 13, 13, 1678, 822, 338, 29918, 17281, 29918, 3177, 29898, 1311, 29892, 282, 1125, 13, 4706, 736, 330, 29889, 4352, 29918, 9303, 29898, 29886, 29889, 29882, 29892, 29871, 29900, 29892, 6702, 29992, 29878, 303, 29899, 17281, 742, 18803, 29878, 303, 29899, 17281, 29899, 3177, 8785, 13, 13, 1678, 822, 338, 29918, 29878, 303, 29918, 3177, 29898, 1311, 29892, 282, 1125, 13, 4706, 736, 330, 29889, 4352, 29918, 1742, 29898, 29886, 29889, 29882, 29892, 29871, 29900, 29892, 17962, 29878, 303, 1159, 322, 451, 330, 29889, 4352, 29898, 29886, 29889, 29882, 29892, 29871, 29900, 29892, 17962, 29878, 303, 29899, 1159, 13, 13, 1678, 822, 364, 303, 29918, 862, 1237, 29898, 1311, 29892, 282, 1125, 13, 4706, 363, 282, 29906, 297, 282, 29889, 862, 1237, 7295, 13, 9651, 565, 282, 29906, 1275, 1583, 29889, 4632, 29901, 13, 18884, 736, 13, 9651, 7709, 282, 29906, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29947, 29947, 29901, 334, 29941, 29930, 364, 303, 29901, 22310, 29879, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29906, 29896, 29900, 29941, 29906, 29953, 29896, 29953, 29945, 29941, 29896, 29945, 29889, 29896, 29901, 334, 29946, 29930, 364, 303, 29889, 26017, 29918, 2914, 13, 1678, 822, 10272, 29918, 2914, 29898, 1311, 1125, 13, 4706, 9995, 1168, 29883, 2579, 403, 599, 6031, 297, 1583, 29889, 2914, 29892, 5662, 3864, 3721, 697, 9654, 1196, 1546, 6031, 1213, 15945, 13, 4706, 736, 525, 4286, 7122, 29898, 29888, 29908, 29912, 29879, 29889, 29878, 17010, 580, 1012, 29876, 29905, 29876, 29908, 363, 269, 297, 1583, 29889, 2914, 29918, 1761, 565, 269, 29889, 17010, 3101, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29946, 29941, 29901, 334, 29946, 29930, 364, 303, 29889, 15070, 21533, 13, 1678, 822, 16766, 21533, 29898, 1311, 29892, 270, 29892, 4055, 1125, 13, 4706, 9995, 29928, 3427, 278, 2183, 6055, 9657, 1213, 15945, 13, 4706, 330, 29889, 558, 29898, 4039, 718, 525, 856, 1495, 13, 4706, 363, 1820, 297, 12705, 29898, 29881, 1125, 13, 9651, 330, 29889, 558, 29898, 29888, 29908, 29871, 426, 1989, 29901, 29906, 29900, 29913, 426, 29881, 29889, 657, 29898, 1989, 2915, 1159, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29929, 29900, 29901, 334, 29946, 29930, 364, 303, 29889, 12508, 13, 1678, 822, 19750, 29898, 1311, 29892, 269, 1125, 13, 4706, 9995, 2457, 269, 11543, 304, 385, 18511, 1347, 1213, 15945, 13, 4706, 736, 330, 29889, 517, 8566, 6797, 1231, 29898, 29879, 29892, 8025, 29922, 1311, 29889, 22331, 29892, 3461, 22463, 29922, 5574, 29897, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29929, 29896, 29901, 334, 29946, 29930, 364, 303, 29889, 12276, 13, 1678, 822, 3461, 29898, 1311, 29892, 1024, 1125, 13, 4706, 9995, 29902, 893, 434, 263, 3461, 304, 278, 1480, 282, 1662, 1213, 15945, 13, 4706, 565, 1583, 29889, 25590, 296, 29901, 13, 9651, 736, 13, 4706, 1024, 353, 330, 29889, 359, 29918, 2084, 29918, 8394, 675, 29898, 978, 29897, 29871, 396, 29871, 29896, 29941, 29946, 29896, 13, 4706, 330, 29889, 558, 29898, 29888, 29908, 29893, 4859, 29901, 426, 978, 27195, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29929, 29906, 29901, 334, 29946, 29930, 364, 303, 29889, 29878, 303, 20001, 13, 1678, 822, 364, 303, 20001, 29898, 1311, 29892, 269, 1125, 13, 4706, 736, 285, 29908, 636, 426, 29879, 5038, 13, 1678, 396, 29992, 29974, 3177, 29901, 1416, 29878, 29889, 29906, 29900, 29900, 29929, 29900, 29945, 29900, 29906, 29900, 29955, 29896, 29947, 29941, 29955, 29889, 29929, 29941, 29901, 334, 29946, 29930, 364, 303, 29889, 15614, 13, 1678, 822, 1090, 1220, 29898, 1311, 29892, 282, 29892, 269, 1125, 13, 4706, 9995, 13, 4706, 7106, 278, 1090, 1915, 292, 1347, 304, 367, 1304, 472, 278, 2183, 3233, 363, 1347, 269, 29889, 13, 4706, 910, 7805, 278, 2343, 1220, 29892, 322, 10075, 263, 8236, 975, 1915, 292, 1196, 29889, 13, 4706, 9995, 13, 4706, 396, 12391, 788, 278, 3876, 29915, 29879, 2343, 1220, 29889, 13, 4706, 565, 451, 269, 29901, 13, 9651, 736, 6629, 13, 4706, 18511, 29918, 29879, 353, 330, 29889, 517, 8566, 6797, 1231, 29898, 29879, 29892, 8025, 29922, 1311, 29889, 22331, 29892, 3461, 22463, 29922, 8824, 29897, 13, 4706, 565, 1583, 29889, 271, 29918, 6921, 29918, 3539, 29901, 13, 9651, 396, 1334, 334, 29885, 523, 29930, 5706, 975, 9012, 363, 2246, 29899, 5563, 13926, 29889, 13, 9651, 318, 353, 1583, 29889, 271, 29918, 6921, 29918, 5062, 9012, 13, 9651, 3233, 353, 282, 29889, 5563, 580, 448, 1583, 29889, 4632, 29889, 5563, 580, 13, 9651, 396, 910, 338, 28722, 29889, 450, 2380, 302, 7111, 373, 3196, 13879, 29889, 13, 9651, 565, 1583, 29889, 5062, 9012, 29906, 29901, 13, 18884, 3233, 22361, 29871, 29896, 29871, 396, 1670, 334, 275, 29930, 263, 3765, 29899, 5062, 21354, 4004, 29889, 13, 18884, 302, 353, 3233, 13, 9651, 1683, 29901, 13, 18884, 302, 353, 3233, 448, 29871, 29896, 13, 9651, 565, 29871, 29900, 5277, 302, 529, 7431, 29898, 29884, 1125, 13, 18884, 521, 353, 318, 29961, 29876, 29962, 13, 9651, 25342, 318, 29901, 13, 18884, 521, 353, 318, 14352, 29896, 29962, 13, 9651, 1683, 29901, 13, 18884, 330, 29889, 15003, 877, 3068, 451, 3799, 29901, 694, 318, 1495, 13, 18884, 521, 353, 16321, 29915, 13, 9651, 396, 14350, 5520, 1090, 9012, 363, 1661, 29899, 294, 18869, 4890, 29889, 13, 9651, 302, 353, 4236, 29898, 29946, 29892, 7431, 29898, 26716, 29918, 29879, 876, 13, 9651, 565, 3233, 1275, 29871, 29900, 322, 1583, 29889, 5062, 9012, 29906, 29901, 13, 18884, 396, 3251, 403, 385, 975, 1220, 322, 385, 1090, 1220, 29889, 13, 18884, 736, 285, 29908, 29912, 305, 334, 302, 1012, 29876, 29912, 29886, 29889, 29882, 1012, 29876, 29912, 305, 334, 302, 5038, 13, 9651, 396, 3251, 403, 871, 385, 1090, 1220, 29889, 13, 9651, 736, 285, 29908, 29912, 29886, 29889, 29882, 1012, 29876, 29912, 305, 334, 302, 5038, 13, 4706, 396, 13, 4706, 396, 450, 1404, 338, 14040, 363, 2246, 29899, 5563, 975, 1915, 292, 29889, 13, 4706, 318, 353, 1583, 29889, 15614, 29918, 3090, 21706, 29871, 396, 29871, 14550, 29937, 29922, 29974, 29930, 29985, 30022, 29908, 11120, 29899, 29901, 5299, 29918, 12008, 13, 4706, 3233, 353, 4236, 29898, 29900, 29892, 282, 29889, 5563, 580, 448, 1583, 29889, 4632, 29889, 5563, 3101, 13, 4706, 3233, 353, 1375, 29898, 5563, 718, 29871, 29896, 29892, 7431, 29898, 29884, 29897, 448, 29871, 29896, 29897, 29871, 396, 27811, 278, 937, 2931, 363, 6261, 17735, 29889, 13, 4706, 521, 353, 318, 29961, 5563, 29962, 13, 4706, 302, 353, 4236, 29898, 29946, 29892, 7431, 29898, 26716, 29918, 29879, 876, 13, 4706, 736, 285, 29908, 29912, 29879, 29889, 17010, 580, 1012, 29876, 29912, 305, 334, 302, 5038, 13, 1678, 396, 29992, 29899, 720, 414, 13, 29937, 29992, 29899, 720, 414, 13, 29937, 25380, 11675, 3017, 13, 29937, 25380, 3891, 2103, 448, 29946, 13, 29937, 25380, 3488, 2103, 29871, 29955, 29900, 13, 29937, 29992, 29899, 280, 29877, 13, 2 ]
functest/tests/unit/odl/test_odl.py
hashnfv/hashnfv-functest
0
7320
<gh_stars>0 #!/usr/bin/env python # Copyright (c) 2016 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 """Define the classes required to fully cover odl.""" import errno import logging import os import unittest from keystoneauth1.exceptions import auth_plugins import mock from robot.errors import DataError, RobotError from robot.result import model from robot.utils.robottime import timestamp_to_secs import six from six.moves import urllib from functest.core import testcase from functest.opnfv_tests.sdn.odl import odl __author__ = "<NAME> <<EMAIL>>" class ODLVisitorTesting(unittest.TestCase): """The class testing ODLResultVisitor.""" # pylint: disable=missing-docstring def setUp(self): self.visitor = odl.ODLResultVisitor() def test_empty(self): self.assertFalse(self.visitor.get_data()) def test_ok(self): data = {'name': 'foo', 'parent': 'bar', 'status': 'PASS', 'starttime': "20161216 16:00:00.000", 'endtime': "20161216 16:00:01.000", 'elapsedtime': 1000, 'text': 'Hello, World!', 'critical': True} test = model.TestCase( name=data['name'], status=data['status'], message=data['text'], starttime=data['starttime'], endtime=data['endtime']) test.parent = mock.Mock() config = {'name': data['parent'], 'criticality.test_is_critical.return_value': data[ 'critical']} test.parent.configure_mock(**config) self.visitor.visit_test(test) self.assertEqual(self.visitor.get_data(), [data]) class ODLTesting(unittest.TestCase): """The super class which testing classes could inherit.""" # pylint: disable=missing-docstring logging.disable(logging.CRITICAL) _keystone_ip = "127.0.0.1" _neutron_url = "http://127.0.0.2:9696" _sdn_controller_ip = "127.0.0.3" _os_auth_url = "http://{}:5000/v3".format(_keystone_ip) _os_projectname = "admin" _os_username = "admin" _os_password = "<PASSWORD>" _odl_webport = "8080" _odl_restconfport = "8181" _odl_username = "admin" _odl_password = "<PASSWORD>" _os_userdomainname = 'Default' _os_projectdomainname = 'Default' def setUp(self): for var in ("INSTALLER_TYPE", "SDN_CONTROLLER", "SDN_CONTROLLER_IP"): if var in os.environ: del os.environ[var] os.environ["OS_AUTH_URL"] = self._os_auth_url os.environ["OS_USERNAME"] = self._os_username os.environ["OS_USER_DOMAIN_NAME"] = self._os_userdomainname os.environ["OS_PASSWORD"] = self._os_password os.environ["OS_PROJECT_NAME"] = self._os_projectname os.environ["OS_PROJECT_DOMAIN_NAME"] = self._os_projectdomainname os.environ["OS_PASSWORD"] = self._os_password self.test = odl.ODLTests(case_name='odl', project_name='functest') self.defaultargs = {'odlusername': self._odl_username, 'odlpassword': self._odl_password, 'neutronurl': "http://{}:9696".format( self._keystone_ip), 'osauthurl': self._os_auth_url, 'osusername': self._os_username, 'osuserdomainname': self._os_userdomainname, 'osprojectname': self._os_projectname, 'osprojectdomainname': self._os_projectdomainname, 'ospassword': self._os_password, 'odlip': self._keystone_ip, 'odlwebport': self._odl_webport, 'odlrestconfport': self._odl_restconfport, 'pushtodb': False} class ODLParseResultTesting(ODLTesting): """The class testing ODLTests.parse_results().""" # pylint: disable=missing-docstring _config = {'name': 'dummy', 'starttime': '20161216 16:00:00.000', 'endtime': '20161216 16:00:01.000'} @mock.patch('robot.api.ExecutionResult', side_effect=DataError) def test_raises_exc(self, mock_method): with self.assertRaises(DataError): self.test.parse_results() mock_method.assert_called_once_with( os.path.join(odl.ODLTests.res_dir, 'output.xml')) def _test_result(self, config, result): suite = mock.Mock() suite.configure_mock(**config) with mock.patch('robot.api.ExecutionResult', return_value=mock.Mock(suite=suite)): self.test.parse_results() self.assertEqual(self.test.result, result) self.assertEqual(self.test.start_time, timestamp_to_secs(config['starttime'])) self.assertEqual(self.test.stop_time, timestamp_to_secs(config['endtime'])) self.assertEqual(self.test.details, {'description': config['name'], 'tests': []}) def test_null_passed(self): self._config.update({'statistics.critical.passed': 0, 'statistics.critical.total': 20}) self._test_result(self._config, 0) def test_no_test(self): self._config.update({'statistics.critical.passed': 20, 'statistics.critical.total': 0}) self._test_result(self._config, 0) def test_half_success(self): self._config.update({'statistics.critical.passed': 10, 'statistics.critical.total': 20}) self._test_result(self._config, 50) def test_success(self): self._config.update({'statistics.critical.passed': 20, 'statistics.critical.total': 20}) self._test_result(self._config, 100) class ODLRobotTesting(ODLTesting): """The class testing ODLTests.set_robotframework_vars().""" # pylint: disable=missing-docstring @mock.patch('fileinput.input', side_effect=Exception()) def test_set_vars_ko(self, mock_method): self.assertFalse(self.test.set_robotframework_vars()) mock_method.assert_called_once_with( os.path.join(odl.ODLTests.odl_test_repo, 'csit/variables/Variables.robot'), inplace=True) @mock.patch('fileinput.input', return_value=[]) def test_set_vars_empty(self, mock_method): self.assertTrue(self.test.set_robotframework_vars()) mock_method.assert_called_once_with( os.path.join(odl.ODLTests.odl_test_repo, 'csit/variables/Variables.robot'), inplace=True) @mock.patch('sys.stdout', new_callable=six.StringIO) def _test_set_vars(self, msg1, msg2, *args): line = mock.MagicMock() line.__iter__.return_value = [msg1] with mock.patch('fileinput.input', return_value=line) as mock_method: self.assertTrue(self.test.set_robotframework_vars()) mock_method.assert_called_once_with( os.path.join(odl.ODLTests.odl_test_repo, 'csit/variables/Variables.robot'), inplace=True) self.assertEqual(args[0].getvalue(), "{}\n".format(msg2)) def test_set_vars_auth_default(self): self._test_set_vars( "@{AUTH} ", "@{AUTH} admin admin") def test_set_vars_auth1(self): self._test_set_vars( "@{AUTH1} foo bar", "@{AUTH1} foo bar") @mock.patch('sys.stdout', new_callable=six.StringIO) def test_set_vars_auth_foo(self, *args): line = mock.MagicMock() line.__iter__.return_value = ["@{AUTH} "] with mock.patch('fileinput.input', return_value=line) as mock_method: self.assertTrue(self.test.set_robotframework_vars('foo', 'bar')) mock_method.assert_called_once_with( os.path.join(odl.ODLTests.odl_test_repo, 'csit/variables/Variables.robot'), inplace=True) self.assertEqual( args[0].getvalue(), "@{AUTH} foo bar\n") class ODLMainTesting(ODLTesting): """The class testing ODLTests.run_suites().""" # pylint: disable=missing-docstring def _get_run_suites_kwargs(self, key=None): kwargs = {'odlusername': self._odl_username, 'odlpassword': self._odl_password, 'neutronurl': self._neutron_url, 'osauthurl': self._os_auth_url, 'osusername': self._os_username, 'osuserdomainname': self._os_userdomainname, 'osprojectname': self._os_projectname, 'osprojectdomainname': self._os_projectdomainname, 'ospassword': self._os_password, 'odlip': self._sdn_controller_ip, 'odlwebport': self._odl_webport, 'odlrestconfport': self._odl_restconfport} if key: del kwargs[key] return kwargs def _test_run_suites(self, status, *args): kwargs = self._get_run_suites_kwargs() self.assertEqual(self.test.run_suites(**kwargs), status) if len(args) > 0: args[0].assert_called_once_with( odl.ODLTests.res_dir) if len(args) > 1: variable = [ 'KEYSTONEURL:{}://{}'.format( urllib.parse.urlparse(self._os_auth_url).scheme, urllib.parse.urlparse(self._os_auth_url).netloc), 'NEUTRONURL:{}'.format(self._neutron_url), 'OS_AUTH_URL:"{}"'.format(self._os_auth_url), 'OSUSERNAME:"{}"'.format(self._os_username), 'OSUSERDOMAINNAME:"{}"'.format(self._os_userdomainname), 'OSTENANTNAME:"{}"'.format(self._os_projectname), 'OSPROJECTDOMAINNAME:"{}"'.format(self._os_projectdomainname), 'OSPASSWORD:"{}"'.format(self._os_password), 'ODL_SYSTEM_IP:{}'.format(self._sdn_controller_ip), 'PORT:{}'.format(self._odl_webport), 'RESTCONFPORT:{}'.format(self._odl_restconfport)] args[1].assert_called_once_with( odl.ODLTests.basic_suite_dir, odl.ODLTests.neutron_suite_dir, log='NONE', output=os.path.join(odl.ODLTests.res_dir, 'output.xml'), report='NONE', stdout=mock.ANY, variable=variable) if len(args) > 2: args[2].assert_called_with( os.path.join(odl.ODLTests.res_dir, 'stdout.txt')) def _test_no_keyword(self, key): kwargs = self._get_run_suites_kwargs(key) self.assertEqual(self.test.run_suites(**kwargs), testcase.TestCase.EX_RUN_ERROR) def test_no_odlusername(self): self._test_no_keyword('odlusername') def test_no_odlpassword(self): self._test_no_keyword('odlpassword') def test_no_neutronurl(self): self._test_no_keyword('neutronurl') def test_no_osauthurl(self): self._test_no_keyword('osauthurl') def test_no_osusername(self): self._test_no_keyword('osusername') def test_no_osprojectname(self): self._test_no_keyword('osprojectname') def test_no_ospassword(self): self._test_no_keyword('ospassword') def test_no_odlip(self): self._test_no_keyword('odlip') def test_no_odlwebport(self): self._test_no_keyword('odlwebport') def test_no_odlrestconfport(self): self._test_no_keyword('odlrestconfport') def test_set_vars_ko(self): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=False) as mock_object: self._test_run_suites(testcase.TestCase.EX_RUN_ERROR) mock_object.assert_called_once_with( self._odl_username, self._odl_password) @mock.patch('os.makedirs', side_effect=Exception) def test_makedirs_exc(self, mock_method): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ self.assertRaises(Exception): self._test_run_suites(testcase.TestCase.EX_RUN_ERROR, mock_method) @mock.patch('os.makedirs', side_effect=OSError) def test_makedirs_oserror(self, mock_method): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True): self._test_run_suites(testcase.TestCase.EX_RUN_ERROR, mock_method) @mock.patch('robot.run', side_effect=RobotError) @mock.patch('os.makedirs') def test_run_ko(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ self.assertRaises(RobotError): self._test_run_suites(testcase.TestCase.EX_RUN_ERROR, *args) @mock.patch('robot.run') @mock.patch('os.makedirs') def test_parse_results_ko(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(self.test, 'parse_results', side_effect=RobotError): self._test_run_suites(testcase.TestCase.EX_RUN_ERROR, *args) @mock.patch('robot.run') @mock.patch('os.makedirs') def test_ok(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_run_suites(testcase.TestCase.EX_OK, *args) @mock.patch('robot.run') @mock.patch('os.makedirs', side_effect=OSError(errno.EEXIST, '')) def test_makedirs_oserror17(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_run_suites(testcase.TestCase.EX_OK, *args) @mock.patch('robot.run', return_value=1) @mock.patch('os.makedirs') def test_testcases_in_failure(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_run_suites(testcase.TestCase.EX_OK, *args) class ODLRunTesting(ODLTesting): """The class testing ODLTests.run().""" # pylint: disable=missing-docstring def _test_no_env_var(self, var): with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): del os.environ[var] self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) def _test_run(self, status=testcase.TestCase.EX_OK, exception=None, **kwargs): odlip = kwargs['odlip'] if 'odlip' in kwargs else '127.0.0.3' odlwebport = kwargs['odlwebport'] if 'odlwebport' in kwargs else '8080' odlrestconfport = (kwargs['odlrestconfport'] if 'odlrestconfport' in kwargs else '8181') with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): if exception: self.test.run_suites = mock.Mock(side_effect=exception) else: self.test.run_suites = mock.Mock(return_value=status) self.assertEqual(self.test.run(), status) self.test.run_suites.assert_called_once_with( odl.ODLTests.default_suites, neutronurl=self._neutron_url, odlip=odlip, odlpassword=self._odl_password, odlrestconfport=odlrestconfport, odlusername=self._odl_username, odlwebport=odlwebport, osauthurl=self._os_auth_url, ospassword=self._os_password, osprojectname=self._os_projectname, osusername=self._os_username, osprojectdomainname=self._os_projectdomainname, osuserdomainname=self._os_userdomainname) def _test_multiple_suites(self, suites, status=testcase.TestCase.EX_OK, **kwargs): odlip = kwargs['odlip'] if 'odlip' in kwargs else '127.0.0.3' odlwebport = kwargs['odlwebport'] if 'odlwebport' in kwargs else '8080' odlrestconfport = (kwargs['odlrestconfport'] if 'odlrestconfport' in kwargs else '8181') with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): self.test.run_suites = mock.Mock(return_value=status) self.assertEqual(self.test.run(suites=suites), status) self.test.run_suites.assert_called_once_with( suites, neutronurl=self._neutron_url, odlip=odlip, odlpassword=self._odl_password, odlrestconfport=odlrestconfport, odlusername=self._odl_username, odlwebport=odlwebport, osauthurl=self._os_auth_url, ospassword=self._os_password, osprojectname=self._os_projectname, osusername=self._os_username, osprojectdomainname=self._os_projectdomainname, osuserdomainname=self._os_userdomainname) def test_exc(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', side_effect=auth_plugins.MissingAuthPlugin()): self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) def test_no_os_auth_url(self): self._test_no_env_var("OS_AUTH_URL") def test_no_os_username(self): self._test_no_env_var("OS_USERNAME") def test_no_os_password(self): self._test_no_env_var("OS_PASSWORD") def test_no_os__name(self): self._test_no_env_var("OS_PROJECT_NAME") def test_run_suites_false(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip self._test_run(testcase.TestCase.EX_RUN_ERROR, odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) def test_run_suites_exc(self): with self.assertRaises(Exception): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip self._test_run(status=testcase.TestCase.EX_RUN_ERROR, exception=Exception(), odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) def test_no_sdn_controller_ip(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) def test_without_installer_type(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip self._test_run(testcase.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) def test_suites(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip self._test_multiple_suites( [odl.ODLTests.basic_suite_dir], testcase.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) def test_fuel(self): os.environ["INSTALLER_TYPE"] = "fuel" self._test_run(testcase.TestCase.EX_OK, odlip=urllib.parse.urlparse(self._neutron_url).hostname, odlwebport='8181', odlrestconfport='8282') def test_apex_no_controller_ip(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): os.environ["INSTALLER_TYPE"] = "apex" self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) def test_apex(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "apex" self._test_run(testcase.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8081', odlrestconfport='8081') def test_netvirt_no_controller_ip(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): os.environ["INSTALLER_TYPE"] = "netvirt" self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) def test_netvirt(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "netvirt" self._test_run(testcase.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8081', odlrestconfport='8081') def test_joid_no_controller_ip(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): os.environ["INSTALLER_TYPE"] = "joid" self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) def test_joid(self): os.environ["SDN_CONTROLLER"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "joid" self._test_run(testcase.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8080') def test_compass(self): os.environ["INSTALLER_TYPE"] = "compass" self._test_run(testcase.TestCase.EX_OK, odlip=urllib.parse.urlparse(self._neutron_url).hostname, odlrestconfport='8080') def test_daisy_no_controller_ip(self): with mock.patch('functest.utils.openstack_utils.get_endpoint', return_value=ODLTesting._neutron_url): os.environ["INSTALLER_TYPE"] = "daisy" self.assertEqual(self.test.run(), testcase.TestCase.EX_RUN_ERROR) def test_daisy(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "daisy" self._test_run(testcase.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8181', odlrestconfport='8087') class ODLArgParserTesting(ODLTesting): """The class testing ODLParser.""" # pylint: disable=missing-docstring def setUp(self): self.parser = odl.ODLParser() super(ODLArgParserTesting, self).setUp() def test_default(self): self.assertEqual(self.parser.parse_args(), self.defaultargs) def test_basic(self): self.defaultargs['neutronurl'] = self._neutron_url self.defaultargs['odlip'] = self._sdn_controller_ip self.assertEqual( self.parser.parse_args( ["--neutronurl={}".format(self._neutron_url), "--odlip={}".format(self._sdn_controller_ip)]), self.defaultargs) @mock.patch('sys.stderr', new_callable=six.StringIO) def test_fail(self, mock_method): self.defaultargs['foo'] = 'bar' with self.assertRaises(SystemExit): self.parser.parse_args(["--foo=bar"]) self.assertTrue(mock_method.getvalue().startswith("usage:")) def _test_arg(self, arg, value): self.defaultargs[arg] = value self.assertEqual( self.parser.parse_args(["--{}={}".format(arg, value)]), self.defaultargs) def test_odlusername(self): self._test_arg('odlusername', 'foo') def test_odlpassword(self): self._test_arg('odlpassword', 'foo') def test_osauthurl(self): self._test_arg('osauthurl', 'http://127.0.0.4:5000/v2') def test_neutronurl(self): self._test_arg('neutronurl', 'http://127.0.0.4:9696') def test_osusername(self): self._test_arg('osusername', 'foo') def test_osuserdomainname(self): self._test_arg('osuserdomainname', 'domain') def test_osprojectname(self): self._test_arg('osprojectname', 'foo') def test_osprojectdomainname(self): self._test_arg('osprojectdomainname', 'domain') def test_ospassword(self): self._test_arg('ospassword', 'foo') def test_odlip(self): self._test_arg('odlip', '127.0.0.4') def test_odlwebport(self): self._test_arg('odlwebport', '80') def test_odlrestconfport(self): self._test_arg('odlrestconfport', '80') def test_pushtodb(self): self.defaultargs['pushtodb'] = True self.assertEqual(self.parser.parse_args(["--{}".format('pushtodb')]), self.defaultargs) def test_multiple_args(self): self.defaultargs['neutronurl'] = self._neutron_url self.defaultargs['odlip'] = self._sdn_controller_ip self.assertEqual( self.parser.parse_args( ["--neutronurl={}".format(self._neutron_url), "--odlip={}".format(self._sdn_controller_ip)]), self.defaultargs) if __name__ == "__main__": logging.disable(logging.CRITICAL) unittest.main(verbosity=2)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29953, 26048, 322, 4045, 29889, 13, 29937, 13, 29937, 2178, 10462, 21676, 29889, 910, 1824, 322, 278, 10259, 1384, 292, 17279, 13, 29937, 526, 1754, 3625, 1090, 278, 4958, 310, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 13, 29937, 607, 18509, 583, 445, 4978, 29892, 322, 338, 3625, 472, 13, 29937, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 13, 15945, 29908, 3206, 457, 278, 4413, 3734, 304, 8072, 4612, 2413, 29880, 1213, 15945, 13, 13, 5215, 4589, 1217, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 443, 27958, 13, 13, 3166, 1589, 858, 650, 5150, 29896, 29889, 11739, 29879, 1053, 4817, 29918, 12800, 13, 5215, 11187, 13, 3166, 19964, 29889, 12523, 1053, 3630, 2392, 29892, 6417, 327, 2392, 13, 3166, 19964, 29889, 2914, 1053, 1904, 13, 3166, 19964, 29889, 13239, 29889, 13716, 1501, 603, 1053, 14334, 29918, 517, 29918, 344, 2395, 13, 5215, 4832, 13, 3166, 4832, 29889, 13529, 267, 1053, 3142, 1982, 13, 13, 3166, 2090, 312, 342, 29889, 3221, 1053, 1243, 4878, 13, 3166, 2090, 312, 342, 29889, 459, 29876, 29888, 29894, 29918, 21150, 29889, 4928, 29876, 29889, 397, 29880, 1053, 2413, 29880, 13, 13, 1649, 8921, 1649, 353, 9872, 5813, 29958, 3532, 26862, 6227, 6778, 29908, 13, 13, 13, 1990, 438, 19558, 6116, 2105, 3057, 292, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 9995, 1576, 770, 6724, 438, 19558, 3591, 6116, 2105, 1213, 15945, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1730, 2105, 353, 2413, 29880, 29889, 13668, 29931, 3591, 6116, 2105, 580, 13, 13, 1678, 822, 1243, 29918, 6310, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 1730, 2105, 29889, 657, 29918, 1272, 3101, 13, 13, 1678, 822, 1243, 29918, 554, 29898, 1311, 1125, 13, 4706, 848, 353, 11117, 978, 2396, 525, 5431, 742, 13, 18884, 525, 3560, 2396, 525, 1646, 742, 13, 18884, 525, 4882, 2396, 525, 25711, 742, 13, 18884, 525, 2962, 2230, 2396, 376, 29906, 29900, 29896, 29953, 29896, 29906, 29896, 29953, 29871, 29896, 29953, 29901, 29900, 29900, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 613, 13, 18884, 525, 355, 2230, 2396, 376, 29906, 29900, 29896, 29953, 29896, 29906, 29896, 29953, 29871, 29896, 29953, 29901, 29900, 29900, 29901, 29900, 29896, 29889, 29900, 29900, 29900, 613, 13, 18884, 525, 295, 28170, 2230, 2396, 29871, 29896, 29900, 29900, 29900, 29892, 13, 18884, 525, 726, 2396, 525, 10994, 29892, 2787, 29991, 742, 13, 18884, 525, 9695, 936, 2396, 5852, 29913, 13, 4706, 1243, 353, 1904, 29889, 3057, 8259, 29898, 13, 9651, 1024, 29922, 1272, 1839, 978, 7464, 4660, 29922, 1272, 1839, 4882, 7464, 2643, 29922, 1272, 1839, 726, 7464, 13, 9651, 1369, 2230, 29922, 1272, 1839, 2962, 2230, 7464, 1095, 2230, 29922, 1272, 1839, 355, 2230, 11287, 13, 4706, 1243, 29889, 3560, 353, 11187, 29889, 18680, 580, 13, 4706, 2295, 353, 11117, 978, 2396, 848, 1839, 3560, 7464, 13, 462, 29871, 525, 9695, 936, 537, 29889, 1688, 29918, 275, 29918, 9695, 936, 29889, 2457, 29918, 1767, 2396, 848, 29961, 13, 462, 418, 525, 9695, 936, 2033, 29913, 13, 4706, 1243, 29889, 3560, 29889, 17591, 29918, 17640, 29898, 1068, 2917, 29897, 13, 4706, 1583, 29889, 1730, 2105, 29889, 1730, 277, 29918, 1688, 29898, 1688, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1730, 2105, 29889, 657, 29918, 1272, 3285, 518, 1272, 2314, 13, 13, 13, 1990, 438, 19558, 3057, 292, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 9995, 1576, 2428, 770, 607, 6724, 4413, 1033, 13125, 1213, 15945, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 13, 1678, 12183, 29889, 20472, 29898, 21027, 29889, 11341, 1806, 2965, 1964, 29897, 13, 13, 1678, 903, 446, 858, 650, 29918, 666, 353, 376, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29908, 13, 1678, 903, 17821, 1617, 29918, 2271, 353, 376, 1124, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29906, 29901, 29929, 29953, 29929, 29953, 29908, 13, 1678, 903, 4928, 29876, 29918, 8299, 29918, 666, 353, 376, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29941, 29908, 13, 1678, 903, 359, 29918, 5150, 29918, 2271, 353, 376, 1124, 597, 29912, 6177, 29945, 29900, 29900, 29900, 29914, 29894, 29941, 1642, 4830, 7373, 446, 858, 650, 29918, 666, 29897, 13, 1678, 903, 359, 29918, 4836, 978, 353, 376, 6406, 29908, 13, 1678, 903, 359, 29918, 6786, 353, 376, 6406, 29908, 13, 1678, 903, 359, 29918, 5630, 353, 9872, 25711, 17013, 11903, 13, 1678, 903, 397, 29880, 29918, 2676, 637, 353, 376, 29947, 29900, 29947, 29900, 29908, 13, 1678, 903, 397, 29880, 29918, 5060, 5527, 637, 353, 376, 29947, 29896, 29947, 29896, 29908, 13, 1678, 903, 397, 29880, 29918, 6786, 353, 376, 6406, 29908, 13, 1678, 903, 397, 29880, 29918, 5630, 353, 9872, 25711, 17013, 11903, 13, 1678, 903, 359, 29918, 1792, 7247, 978, 353, 525, 4592, 29915, 13, 1678, 903, 359, 29918, 4836, 7247, 978, 353, 525, 4592, 29915, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 363, 722, 297, 4852, 25580, 9818, 1001, 29918, 11116, 613, 376, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 613, 376, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 29908, 1125, 13, 9651, 565, 722, 297, 2897, 29889, 21813, 29901, 13, 18884, 628, 2897, 29889, 21813, 29961, 1707, 29962, 13, 4706, 2897, 29889, 21813, 3366, 3267, 29918, 20656, 29950, 29918, 4219, 3108, 353, 1583, 3032, 359, 29918, 5150, 29918, 2271, 13, 4706, 2897, 29889, 21813, 3366, 3267, 29918, 11889, 5813, 3108, 353, 1583, 3032, 359, 29918, 6786, 13, 4706, 2897, 29889, 21813, 3366, 3267, 29918, 11889, 29918, 3970, 29032, 29918, 5813, 3108, 353, 1583, 3032, 359, 29918, 1792, 7247, 978, 13, 4706, 2897, 29889, 21813, 3366, 3267, 29918, 25711, 17013, 3108, 353, 1583, 3032, 359, 29918, 5630, 13, 4706, 2897, 29889, 21813, 3366, 3267, 29918, 8618, 17637, 29918, 5813, 3108, 353, 1583, 3032, 359, 29918, 4836, 978, 13, 4706, 2897, 29889, 21813, 3366, 3267, 29918, 8618, 17637, 29918, 3970, 29032, 29918, 5813, 3108, 353, 1583, 3032, 359, 29918, 4836, 7247, 978, 13, 4706, 2897, 29889, 21813, 3366, 3267, 29918, 25711, 17013, 3108, 353, 1583, 3032, 359, 29918, 5630, 13, 4706, 1583, 29889, 1688, 353, 2413, 29880, 29889, 13668, 29931, 24376, 29898, 4878, 29918, 978, 2433, 397, 29880, 742, 2060, 29918, 978, 2433, 7692, 312, 342, 1495, 13, 4706, 1583, 29889, 4381, 5085, 353, 11117, 397, 29880, 6786, 2396, 1583, 3032, 397, 29880, 29918, 6786, 29892, 13, 462, 9651, 525, 397, 29880, 5630, 2396, 1583, 3032, 397, 29880, 29918, 5630, 29892, 13, 462, 9651, 525, 17821, 1617, 2271, 2396, 376, 1124, 597, 29912, 6177, 29929, 29953, 29929, 29953, 1642, 4830, 29898, 13, 462, 18884, 1583, 3032, 446, 858, 650, 29918, 666, 511, 13, 462, 9651, 525, 359, 5150, 2271, 2396, 1583, 3032, 359, 29918, 5150, 29918, 2271, 29892, 13, 462, 9651, 525, 359, 6786, 2396, 1583, 3032, 359, 29918, 6786, 29892, 13, 462, 9651, 525, 359, 1792, 7247, 978, 2396, 1583, 3032, 359, 29918, 1792, 7247, 978, 29892, 13, 462, 9651, 525, 359, 4836, 978, 2396, 1583, 3032, 359, 29918, 4836, 978, 29892, 13, 462, 9651, 525, 359, 4836, 7247, 978, 2396, 1583, 3032, 359, 29918, 4836, 7247, 978, 29892, 13, 462, 9651, 525, 359, 5630, 2396, 1583, 3032, 359, 29918, 5630, 29892, 13, 462, 9651, 525, 397, 3466, 2396, 1583, 3032, 446, 858, 650, 29918, 666, 29892, 13, 462, 9651, 525, 397, 29880, 2676, 637, 2396, 1583, 3032, 397, 29880, 29918, 2676, 637, 29892, 13, 462, 9651, 525, 397, 29880, 5060, 5527, 637, 2396, 1583, 3032, 397, 29880, 29918, 5060, 5527, 637, 29892, 13, 462, 9651, 525, 13364, 400, 10396, 2396, 7700, 29913, 13, 13, 13, 1990, 438, 19558, 12914, 3591, 3057, 292, 29898, 13668, 29931, 3057, 292, 1125, 13, 13, 1678, 9995, 1576, 770, 6724, 438, 19558, 24376, 29889, 5510, 29918, 9902, 2141, 15945, 29908, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 13, 1678, 903, 2917, 353, 11117, 978, 2396, 525, 29881, 11770, 742, 525, 2962, 2230, 2396, 525, 29906, 29900, 29896, 29953, 29896, 29906, 29896, 29953, 29871, 29896, 29953, 29901, 29900, 29900, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 742, 13, 1669, 525, 355, 2230, 2396, 525, 29906, 29900, 29896, 29953, 29896, 29906, 29896, 29953, 29871, 29896, 29953, 29901, 29900, 29900, 29901, 29900, 29896, 29889, 29900, 29900, 29900, 10827, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 307, 7451, 29889, 2754, 29889, 20418, 3591, 742, 2625, 29918, 15987, 29922, 1469, 2392, 29897, 13, 1678, 822, 1243, 29918, 336, 4637, 29918, 735, 29883, 29898, 1311, 29892, 11187, 29918, 5696, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1469, 2392, 1125, 13, 9651, 1583, 29889, 1688, 29889, 5510, 29918, 9902, 580, 13, 4706, 11187, 29918, 5696, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 9651, 2897, 29889, 2084, 29889, 7122, 29898, 397, 29880, 29889, 13668, 29931, 24376, 29889, 690, 29918, 3972, 29892, 525, 4905, 29889, 3134, 8785, 13, 13, 1678, 822, 903, 1688, 29918, 2914, 29898, 1311, 29892, 2295, 29892, 1121, 1125, 13, 4706, 9460, 353, 11187, 29889, 18680, 580, 13, 4706, 9460, 29889, 17591, 29918, 17640, 29898, 1068, 2917, 29897, 13, 4706, 411, 11187, 29889, 5041, 877, 307, 7451, 29889, 2754, 29889, 20418, 3591, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 17640, 29889, 18680, 29898, 13495, 29922, 13495, 22164, 13, 9651, 1583, 29889, 1688, 29889, 5510, 29918, 9902, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 2914, 29892, 1121, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 2962, 29918, 2230, 29892, 13, 462, 632, 14334, 29918, 517, 29918, 344, 2395, 29898, 2917, 1839, 2962, 2230, 25901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 9847, 29918, 2230, 29892, 13, 462, 632, 14334, 29918, 517, 29918, 344, 2395, 29898, 2917, 1839, 355, 2230, 25901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 14144, 29892, 13, 462, 632, 11117, 8216, 2396, 2295, 1839, 978, 7464, 525, 21150, 2396, 5159, 1800, 13, 13, 1678, 822, 1243, 29918, 4304, 29918, 3364, 287, 29898, 1311, 1125, 13, 4706, 1583, 3032, 2917, 29889, 5504, 3319, 29915, 6112, 6765, 29889, 9695, 936, 29889, 3364, 287, 2396, 29871, 29900, 29892, 13, 462, 632, 525, 6112, 6765, 29889, 9695, 936, 29889, 7827, 2396, 29871, 29906, 29900, 1800, 13, 4706, 1583, 3032, 1688, 29918, 2914, 29898, 1311, 3032, 2917, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 1688, 29898, 1311, 1125, 13, 4706, 1583, 3032, 2917, 29889, 5504, 3319, 29915, 6112, 6765, 29889, 9695, 936, 29889, 3364, 287, 2396, 29871, 29906, 29900, 29892, 13, 462, 632, 525, 6112, 6765, 29889, 9695, 936, 29889, 7827, 2396, 29871, 29900, 1800, 13, 4706, 1583, 3032, 1688, 29918, 2914, 29898, 1311, 3032, 2917, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 24498, 29918, 8698, 29898, 1311, 1125, 13, 4706, 1583, 3032, 2917, 29889, 5504, 3319, 29915, 6112, 6765, 29889, 9695, 936, 29889, 3364, 287, 2396, 29871, 29896, 29900, 29892, 13, 462, 632, 525, 6112, 6765, 29889, 9695, 936, 29889, 7827, 2396, 29871, 29906, 29900, 1800, 13, 4706, 1583, 3032, 1688, 29918, 2914, 29898, 1311, 3032, 2917, 29892, 29871, 29945, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 8698, 29898, 1311, 1125, 13, 4706, 1583, 3032, 2917, 29889, 5504, 3319, 29915, 6112, 6765, 29889, 9695, 936, 29889, 3364, 287, 2396, 29871, 29906, 29900, 29892, 13, 462, 632, 525, 6112, 6765, 29889, 9695, 936, 29889, 7827, 2396, 29871, 29906, 29900, 1800, 13, 4706, 1583, 3032, 1688, 29918, 2914, 29898, 1311, 3032, 2917, 29892, 29871, 29896, 29900, 29900, 29897, 13, 13, 13, 1990, 438, 19558, 21860, 327, 3057, 292, 29898, 13668, 29931, 3057, 292, 1125, 13, 13, 1678, 9995, 1576, 770, 6724, 438, 19558, 24376, 29889, 842, 29918, 307, 7451, 4468, 29918, 16908, 2141, 15945, 29908, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 1445, 2080, 29889, 2080, 742, 2625, 29918, 15987, 29922, 2451, 3101, 13, 1678, 822, 1243, 29918, 842, 29918, 16908, 29918, 2901, 29898, 1311, 29892, 11187, 29918, 5696, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 1688, 29889, 842, 29918, 307, 7451, 4468, 29918, 16908, 3101, 13, 4706, 11187, 29918, 5696, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 9651, 2897, 29889, 2084, 29889, 7122, 29898, 397, 29880, 29889, 13668, 29931, 24376, 29889, 397, 29880, 29918, 1688, 29918, 20095, 29892, 13, 462, 308, 525, 2395, 277, 29914, 20897, 29914, 10444, 1849, 29889, 307, 7451, 5477, 297, 6689, 29922, 5574, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 1445, 2080, 29889, 2080, 742, 736, 29918, 1767, 11759, 2314, 13, 1678, 822, 1243, 29918, 842, 29918, 16908, 29918, 6310, 29898, 1311, 29892, 11187, 29918, 5696, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 1688, 29889, 842, 29918, 307, 7451, 4468, 29918, 16908, 3101, 13, 4706, 11187, 29918, 5696, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 9651, 2897, 29889, 2084, 29889, 7122, 29898, 397, 29880, 29889, 13668, 29931, 24376, 29889, 397, 29880, 29918, 1688, 29918, 20095, 29892, 13, 462, 308, 525, 2395, 277, 29914, 20897, 29914, 10444, 1849, 29889, 307, 7451, 5477, 297, 6689, 29922, 5574, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 9675, 29889, 25393, 742, 716, 29918, 4804, 519, 29922, 28319, 29889, 1231, 5971, 29897, 13, 1678, 822, 903, 1688, 29918, 842, 29918, 16908, 29898, 1311, 29892, 10191, 29896, 29892, 10191, 29906, 29892, 334, 5085, 1125, 13, 4706, 1196, 353, 11187, 29889, 19095, 293, 18680, 580, 13, 4706, 1196, 17255, 1524, 26914, 2457, 29918, 1767, 353, 518, 7645, 29896, 29962, 13, 4706, 411, 11187, 29889, 5041, 877, 1445, 2080, 29889, 2080, 742, 736, 29918, 1767, 29922, 1220, 29897, 408, 11187, 29918, 5696, 29901, 13, 9651, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 1688, 29889, 842, 29918, 307, 7451, 4468, 29918, 16908, 3101, 13, 9651, 11187, 29918, 5696, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 18884, 2897, 29889, 2084, 29889, 7122, 29898, 397, 29880, 29889, 13668, 29931, 24376, 29889, 397, 29880, 29918, 1688, 29918, 20095, 29892, 13, 462, 632, 525, 2395, 277, 29914, 20897, 29914, 10444, 1849, 29889, 307, 7451, 5477, 297, 6689, 29922, 5574, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5085, 29961, 29900, 1822, 657, 1767, 3285, 29850, 1012, 29876, 1642, 4830, 29898, 7645, 29906, 876, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 16908, 29918, 5150, 29918, 4381, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 842, 29918, 16908, 29898, 13, 9651, 17962, 29912, 20656, 29950, 29913, 9162, 13, 9651, 17962, 29912, 20656, 29950, 29913, 965, 4113, 1678, 4113, 1159, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 16908, 29918, 5150, 29896, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 842, 29918, 16908, 29898, 13, 9651, 17962, 29912, 20656, 29950, 29896, 29913, 965, 7953, 1678, 2594, 613, 13, 9651, 17962, 29912, 20656, 29950, 29896, 29913, 965, 7953, 1678, 2594, 1159, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 9675, 29889, 25393, 742, 716, 29918, 4804, 519, 29922, 28319, 29889, 1231, 5971, 29897, 13, 1678, 822, 1243, 29918, 842, 29918, 16908, 29918, 5150, 29918, 5431, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 1196, 353, 11187, 29889, 19095, 293, 18680, 580, 13, 4706, 1196, 17255, 1524, 26914, 2457, 29918, 1767, 353, 6796, 28312, 20656, 29950, 29913, 376, 29962, 13, 4706, 411, 11187, 29889, 5041, 877, 1445, 2080, 29889, 2080, 742, 736, 29918, 1767, 29922, 1220, 29897, 408, 11187, 29918, 5696, 29901, 13, 9651, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 1688, 29889, 842, 29918, 307, 7451, 4468, 29918, 16908, 877, 5431, 742, 525, 1646, 8785, 13, 9651, 11187, 29918, 5696, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 18884, 2897, 29889, 2084, 29889, 7122, 29898, 397, 29880, 29889, 13668, 29931, 24376, 29889, 397, 29880, 29918, 1688, 29918, 20095, 29892, 13, 462, 632, 525, 2395, 277, 29914, 20897, 29914, 10444, 1849, 29889, 307, 7451, 5477, 297, 6689, 29922, 5574, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 13, 18884, 6389, 29961, 29900, 1822, 657, 1767, 3285, 13, 18884, 17962, 29912, 20656, 29950, 29913, 965, 7953, 1678, 2594, 29905, 29876, 1159, 13, 13, 13, 1990, 438, 19558, 6330, 3057, 292, 29898, 13668, 29931, 3057, 292, 1125, 13, 13, 1678, 9995, 1576, 770, 6724, 438, 19558, 24376, 29889, 3389, 29918, 2146, 3246, 2141, 15945, 29908, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 13, 1678, 822, 903, 657, 29918, 3389, 29918, 2146, 3246, 29918, 19290, 29898, 1311, 29892, 1820, 29922, 8516, 1125, 13, 4706, 9049, 5085, 353, 11117, 397, 29880, 6786, 2396, 1583, 3032, 397, 29880, 29918, 6786, 29892, 13, 462, 29871, 525, 397, 29880, 5630, 2396, 1583, 3032, 397, 29880, 29918, 5630, 29892, 13, 462, 29871, 525, 17821, 1617, 2271, 2396, 1583, 3032, 17821, 1617, 29918, 2271, 29892, 13, 462, 29871, 525, 359, 5150, 2271, 2396, 1583, 3032, 359, 29918, 5150, 29918, 2271, 29892, 13, 462, 29871, 525, 359, 6786, 2396, 1583, 3032, 359, 29918, 6786, 29892, 13, 462, 29871, 525, 359, 1792, 7247, 978, 2396, 1583, 3032, 359, 29918, 1792, 7247, 978, 29892, 13, 462, 29871, 525, 359, 4836, 978, 2396, 1583, 3032, 359, 29918, 4836, 978, 29892, 13, 462, 29871, 525, 359, 4836, 7247, 978, 2396, 1583, 3032, 359, 29918, 4836, 7247, 978, 29892, 13, 462, 29871, 525, 359, 5630, 2396, 1583, 3032, 359, 29918, 5630, 29892, 13, 462, 29871, 525, 397, 3466, 2396, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 13, 462, 29871, 525, 397, 29880, 2676, 637, 2396, 1583, 3032, 397, 29880, 29918, 2676, 637, 29892, 13, 462, 29871, 525, 397, 29880, 5060, 5527, 637, 2396, 1583, 3032, 397, 29880, 29918, 5060, 5527, 637, 29913, 13, 4706, 565, 1820, 29901, 13, 9651, 628, 9049, 5085, 29961, 1989, 29962, 13, 4706, 736, 9049, 5085, 13, 13, 1678, 822, 903, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1311, 29892, 4660, 29892, 334, 5085, 1125, 13, 4706, 9049, 5085, 353, 1583, 3032, 657, 29918, 3389, 29918, 2146, 3246, 29918, 19290, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 29918, 2146, 3246, 29898, 1068, 19290, 511, 4660, 29897, 13, 4706, 565, 7431, 29898, 5085, 29897, 1405, 29871, 29900, 29901, 13, 9651, 6389, 29961, 29900, 1822, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 18884, 2413, 29880, 29889, 13668, 29931, 24376, 29889, 690, 29918, 3972, 29897, 13, 4706, 565, 7431, 29898, 5085, 29897, 1405, 29871, 29896, 29901, 13, 9651, 2286, 353, 518, 13, 18884, 525, 10818, 1254, 12413, 4219, 29901, 8875, 597, 8875, 4286, 4830, 29898, 13, 462, 1678, 3142, 1982, 29889, 5510, 29889, 2271, 5510, 29898, 1311, 3032, 359, 29918, 5150, 29918, 2271, 467, 816, 2004, 29892, 13, 462, 1678, 3142, 1982, 29889, 5510, 29889, 2271, 5510, 29898, 1311, 3032, 359, 29918, 5150, 29918, 2271, 467, 1212, 2029, 511, 13, 18884, 525, 8186, 2692, 29934, 1164, 4219, 29901, 8875, 4286, 4830, 29898, 1311, 3032, 17821, 1617, 29918, 2271, 511, 13, 18884, 525, 3267, 29918, 20656, 29950, 29918, 4219, 6160, 29912, 5038, 4286, 4830, 29898, 1311, 3032, 359, 29918, 5150, 29918, 2271, 511, 13, 18884, 525, 3267, 11889, 5813, 6160, 29912, 5038, 4286, 4830, 29898, 1311, 3032, 359, 29918, 6786, 511, 13, 18884, 525, 3267, 11889, 3970, 29032, 5813, 6160, 29912, 5038, 4286, 4830, 29898, 1311, 3032, 359, 29918, 1792, 7247, 978, 511, 13, 18884, 525, 3718, 1430, 13566, 5813, 6160, 29912, 5038, 4286, 4830, 29898, 1311, 3032, 359, 29918, 4836, 978, 511, 13, 18884, 525, 3267, 8618, 17637, 3970, 29032, 5813, 6160, 29912, 5038, 4286, 4830, 29898, 1311, 3032, 359, 29918, 4836, 7247, 978, 511, 13, 18884, 525, 3267, 25711, 17013, 6160, 29912, 5038, 4286, 4830, 29898, 1311, 3032, 359, 29918, 5630, 511, 13, 18884, 525, 13668, 29931, 29918, 14816, 1254, 12665, 29918, 5690, 29901, 8875, 4286, 4830, 29898, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 511, 13, 18884, 525, 15082, 29901, 8875, 4286, 4830, 29898, 1311, 3032, 397, 29880, 29918, 2676, 637, 511, 13, 18884, 525, 1525, 1254, 6007, 29943, 15082, 29901, 8875, 4286, 4830, 29898, 1311, 3032, 397, 29880, 29918, 5060, 5527, 637, 4638, 13, 9651, 6389, 29961, 29896, 1822, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 18884, 2413, 29880, 29889, 13668, 29931, 24376, 29889, 16121, 29918, 13495, 29918, 3972, 29892, 13, 18884, 2413, 29880, 29889, 13668, 29931, 24376, 29889, 17821, 1617, 29918, 13495, 29918, 3972, 29892, 13, 18884, 1480, 2433, 29940, 12413, 742, 13, 18884, 1962, 29922, 359, 29889, 2084, 29889, 7122, 29898, 397, 29880, 29889, 13668, 29931, 24376, 29889, 690, 29918, 3972, 29892, 525, 4905, 29889, 3134, 5477, 13, 18884, 3461, 2433, 29940, 12413, 742, 13, 18884, 27591, 29922, 17640, 29889, 2190, 29979, 29892, 13, 18884, 2286, 29922, 11918, 29897, 13, 4706, 565, 7431, 29898, 5085, 29897, 1405, 29871, 29906, 29901, 13, 9651, 6389, 29961, 29906, 1822, 9294, 29918, 13998, 29918, 2541, 29898, 13, 18884, 2897, 29889, 2084, 29889, 7122, 29898, 397, 29880, 29889, 13668, 29931, 24376, 29889, 690, 29918, 3972, 29892, 525, 25393, 29889, 3945, 8785, 13, 13, 1678, 822, 903, 1688, 29918, 1217, 29918, 26766, 29898, 1311, 29892, 1820, 1125, 13, 4706, 9049, 5085, 353, 1583, 3032, 657, 29918, 3389, 29918, 2146, 3246, 29918, 19290, 29898, 1989, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 29918, 2146, 3246, 29898, 1068, 19290, 511, 13, 462, 308, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 397, 29880, 6786, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 397, 29880, 6786, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 397, 29880, 5630, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 397, 29880, 5630, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 17821, 1617, 2271, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 17821, 1617, 2271, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 5150, 2271, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 359, 5150, 2271, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 6786, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 359, 6786, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 4836, 978, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 359, 4836, 978, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 5630, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 359, 5630, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 397, 3466, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 397, 3466, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 397, 29880, 2676, 637, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 397, 29880, 2676, 637, 1495, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 397, 29880, 5060, 5527, 637, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 26766, 877, 397, 29880, 5060, 5527, 637, 1495, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 16908, 29918, 2901, 29898, 1311, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 8824, 29897, 408, 11187, 29918, 3318, 29901, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 9651, 11187, 29918, 3318, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 18884, 1583, 3032, 397, 29880, 29918, 6786, 29892, 1583, 3032, 397, 29880, 29918, 5630, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29889, 29885, 12535, 12935, 742, 2625, 29918, 15987, 29922, 2451, 29897, 13, 1678, 822, 1243, 29918, 29885, 12535, 12935, 29918, 735, 29883, 29898, 1311, 29892, 11187, 29918, 5696, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 5574, 511, 320, 13, 18884, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2451, 1125, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29892, 13, 462, 462, 29871, 11187, 29918, 5696, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29889, 29885, 12535, 12935, 742, 2625, 29918, 15987, 29922, 29949, 29173, 29897, 13, 1678, 822, 1243, 29918, 29885, 12535, 12935, 29918, 359, 2704, 29898, 1311, 29892, 11187, 29918, 5696, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 5574, 1125, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29892, 13, 462, 462, 29871, 11187, 29918, 5696, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 307, 7451, 29889, 3389, 742, 2625, 29918, 15987, 29922, 21860, 327, 2392, 29897, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29889, 29885, 12535, 12935, 1495, 13, 1678, 822, 1243, 29918, 3389, 29918, 2901, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 5574, 511, 320, 13, 18884, 1583, 29889, 9294, 29934, 1759, 267, 29898, 21860, 327, 2392, 1125, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29892, 334, 5085, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 307, 7451, 29889, 3389, 1495, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29889, 29885, 12535, 12935, 1495, 13, 1678, 822, 1243, 29918, 5510, 29918, 9902, 29918, 2901, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 5574, 511, 320, 13, 18884, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 5510, 29918, 9902, 742, 13, 462, 462, 29871, 2625, 29918, 15987, 29922, 21860, 327, 2392, 1125, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29892, 334, 5085, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 307, 7451, 29889, 3389, 1495, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29889, 29885, 12535, 12935, 1495, 13, 1678, 822, 1243, 29918, 554, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 5574, 511, 320, 13, 18884, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 5510, 29918, 9902, 29374, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 334, 5085, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 307, 7451, 29889, 3389, 1495, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29889, 29885, 12535, 12935, 742, 2625, 29918, 15987, 29922, 29949, 29173, 29898, 3127, 1217, 29889, 29923, 5746, 9047, 29892, 6629, 876, 13, 1678, 822, 1243, 29918, 29885, 12535, 12935, 29918, 359, 2704, 29896, 29955, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 5574, 511, 320, 13, 18884, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 5510, 29918, 9902, 29374, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 334, 5085, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 307, 7451, 29889, 3389, 742, 736, 29918, 1767, 29922, 29896, 29897, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29889, 29885, 12535, 12935, 1495, 13, 1678, 822, 1243, 29918, 1688, 11436, 29918, 262, 29918, 14057, 545, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 411, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 842, 29918, 307, 7451, 4468, 29918, 16908, 742, 13, 462, 1669, 736, 29918, 1767, 29922, 5574, 511, 320, 13, 18884, 11187, 29889, 5041, 29889, 3318, 29898, 1311, 29889, 1688, 29892, 525, 5510, 29918, 9902, 29374, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29918, 2146, 3246, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 334, 5085, 29897, 13, 13, 13, 1990, 438, 19558, 6558, 3057, 292, 29898, 13668, 29931, 3057, 292, 1125, 13, 13, 1678, 9995, 1576, 770, 6724, 438, 19558, 24376, 29889, 3389, 2141, 15945, 29908, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 13, 1678, 822, 903, 1688, 29918, 1217, 29918, 6272, 29918, 1707, 29898, 1311, 29892, 722, 1125, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 628, 2897, 29889, 21813, 29961, 1707, 29962, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 13, 462, 632, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 903, 1688, 29918, 3389, 29898, 1311, 29892, 4660, 29922, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 29871, 3682, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 2413, 3466, 353, 9049, 5085, 1839, 397, 3466, 2033, 565, 525, 397, 3466, 29915, 297, 9049, 5085, 1683, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29941, 29915, 13, 4706, 2413, 29880, 2676, 637, 353, 9049, 5085, 1839, 397, 29880, 2676, 637, 2033, 565, 525, 397, 29880, 2676, 637, 29915, 297, 9049, 5085, 1683, 525, 29947, 29900, 29947, 29900, 29915, 13, 4706, 2413, 29880, 5060, 5527, 637, 353, 313, 19290, 1839, 397, 29880, 5060, 5527, 637, 2033, 13, 462, 965, 565, 525, 397, 29880, 5060, 5527, 637, 29915, 297, 9049, 5085, 1683, 525, 29947, 29896, 29947, 29896, 1495, 13, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 565, 3682, 29901, 13, 18884, 1583, 29889, 1688, 29889, 3389, 29918, 2146, 3246, 353, 11187, 29889, 18680, 29898, 2975, 29918, 15987, 29922, 11739, 29897, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 1688, 29889, 3389, 29918, 2146, 3246, 353, 11187, 29889, 18680, 29898, 2457, 29918, 1767, 29922, 4882, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 4660, 29897, 13, 9651, 1583, 29889, 1688, 29889, 3389, 29918, 2146, 3246, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 18884, 2413, 29880, 29889, 13668, 29931, 24376, 29889, 4381, 29918, 2146, 3246, 29892, 13, 18884, 11553, 1617, 2271, 29922, 1311, 3032, 17821, 1617, 29918, 2271, 29892, 13, 18884, 2413, 3466, 29922, 397, 3466, 29892, 2413, 29880, 5630, 29922, 1311, 3032, 397, 29880, 29918, 5630, 29892, 13, 18884, 2413, 29880, 5060, 5527, 637, 29922, 397, 29880, 5060, 5527, 637, 29892, 13, 18884, 2413, 29880, 6786, 29922, 1311, 3032, 397, 29880, 29918, 6786, 29892, 2413, 29880, 2676, 637, 29922, 397, 29880, 2676, 637, 29892, 13, 18884, 2897, 5150, 2271, 29922, 1311, 3032, 359, 29918, 5150, 29918, 2271, 29892, 13, 18884, 288, 1028, 465, 1742, 29922, 1311, 3032, 359, 29918, 5630, 29892, 13, 18884, 2897, 4836, 978, 29922, 1311, 3032, 359, 29918, 4836, 978, 29892, 13, 18884, 2897, 6786, 29922, 1311, 3032, 359, 29918, 6786, 29892, 13, 18884, 2897, 4836, 7247, 978, 29922, 1311, 3032, 359, 29918, 4836, 7247, 978, 29892, 13, 18884, 2897, 1792, 7247, 978, 29922, 1311, 3032, 359, 29918, 1792, 7247, 978, 29897, 13, 13, 1678, 822, 903, 1688, 29918, 20787, 29918, 2146, 3246, 29898, 1311, 29892, 480, 3246, 29892, 13, 462, 795, 4660, 29922, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 3579, 19290, 1125, 13, 4706, 2413, 3466, 353, 9049, 5085, 1839, 397, 3466, 2033, 565, 525, 397, 3466, 29915, 297, 9049, 5085, 1683, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29941, 29915, 13, 4706, 2413, 29880, 2676, 637, 353, 9049, 5085, 1839, 397, 29880, 2676, 637, 2033, 565, 525, 397, 29880, 2676, 637, 29915, 297, 9049, 5085, 1683, 525, 29947, 29900, 29947, 29900, 29915, 13, 4706, 2413, 29880, 5060, 5527, 637, 353, 313, 19290, 1839, 397, 29880, 5060, 5527, 637, 2033, 13, 462, 965, 565, 525, 397, 29880, 5060, 5527, 637, 29915, 297, 9049, 5085, 1683, 525, 29947, 29896, 29947, 29896, 1495, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 1583, 29889, 1688, 29889, 3389, 29918, 2146, 3246, 353, 11187, 29889, 18680, 29898, 2457, 29918, 1767, 29922, 4882, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 29898, 2146, 3246, 29922, 2146, 3246, 511, 4660, 29897, 13, 9651, 1583, 29889, 1688, 29889, 3389, 29918, 2146, 3246, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 18884, 480, 3246, 29892, 13, 18884, 11553, 1617, 2271, 29922, 1311, 3032, 17821, 1617, 29918, 2271, 29892, 13, 18884, 2413, 3466, 29922, 397, 3466, 29892, 2413, 29880, 5630, 29922, 1311, 3032, 397, 29880, 29918, 5630, 29892, 13, 18884, 2413, 29880, 5060, 5527, 637, 29922, 397, 29880, 5060, 5527, 637, 29892, 13, 18884, 2413, 29880, 6786, 29922, 1311, 3032, 397, 29880, 29918, 6786, 29892, 2413, 29880, 2676, 637, 29922, 397, 29880, 2676, 637, 29892, 13, 18884, 2897, 5150, 2271, 29922, 1311, 3032, 359, 29918, 5150, 29918, 2271, 29892, 13, 18884, 288, 1028, 465, 1742, 29922, 1311, 3032, 359, 29918, 5630, 29892, 13, 18884, 2897, 4836, 978, 29922, 1311, 3032, 359, 29918, 4836, 978, 29892, 13, 18884, 2897, 6786, 29922, 1311, 3032, 359, 29918, 6786, 29892, 13, 18884, 2897, 4836, 7247, 978, 29922, 1311, 3032, 359, 29918, 4836, 7247, 978, 29892, 13, 18884, 2897, 1792, 7247, 978, 29922, 1311, 3032, 359, 29918, 1792, 7247, 978, 29897, 13, 13, 1678, 822, 1243, 29918, 735, 29883, 29898, 1311, 1125, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 2625, 29918, 15987, 29922, 5150, 29918, 12800, 29889, 18552, 292, 6444, 16288, 580, 1125, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 13, 462, 632, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 29918, 5150, 29918, 2271, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 6272, 29918, 1707, 703, 3267, 29918, 20656, 29950, 29918, 4219, 1159, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 29918, 6786, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 6272, 29918, 1707, 703, 3267, 29918, 11889, 5813, 1159, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 29918, 5630, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 6272, 29918, 1707, 703, 3267, 29918, 25711, 17013, 1159, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 359, 1649, 978, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1217, 29918, 6272, 29918, 1707, 703, 3267, 29918, 8618, 17637, 29918, 5813, 1159, 13, 13, 1678, 822, 1243, 29918, 3389, 29918, 2146, 3246, 29918, 4541, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29892, 13, 462, 539, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 13, 462, 539, 2413, 29880, 2676, 637, 29922, 1311, 3032, 397, 29880, 29918, 2676, 637, 29897, 13, 13, 1678, 822, 1243, 29918, 3389, 29918, 2146, 3246, 29918, 735, 29883, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2451, 1125, 13, 9651, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 9651, 1583, 3032, 1688, 29918, 3389, 29898, 4882, 29922, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29892, 13, 462, 965, 3682, 29922, 2451, 3285, 13, 462, 965, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 13, 462, 965, 2413, 29880, 2676, 637, 29922, 1311, 3032, 397, 29880, 29918, 2676, 637, 29897, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 4928, 29876, 29918, 8299, 29918, 666, 29898, 1311, 1125, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 13, 462, 632, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 1243, 29918, 14037, 29918, 6252, 261, 29918, 1853, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 539, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 13, 462, 539, 2413, 29880, 2676, 637, 29922, 1311, 3032, 397, 29880, 29918, 2676, 637, 29897, 13, 13, 1678, 822, 1243, 29918, 2146, 3246, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 1583, 3032, 1688, 29918, 20787, 29918, 2146, 3246, 29898, 13, 9651, 518, 397, 29880, 29889, 13668, 29931, 24376, 29889, 16121, 29918, 13495, 29918, 3972, 1402, 13, 9651, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 9651, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 13, 9651, 2413, 29880, 2676, 637, 29922, 1311, 3032, 397, 29880, 29918, 2676, 637, 29897, 13, 13, 1678, 822, 1243, 29918, 29888, 2491, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 29888, 2491, 29908, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 539, 2413, 3466, 29922, 2271, 1982, 29889, 5510, 29889, 2271, 5510, 29898, 1311, 3032, 17821, 1617, 29918, 2271, 467, 28988, 29892, 13, 462, 539, 2413, 29880, 2676, 637, 2433, 29947, 29896, 29947, 29896, 742, 13, 462, 539, 2413, 29880, 5060, 5527, 637, 2433, 29947, 29906, 29947, 29906, 1495, 13, 13, 1678, 822, 1243, 29918, 4085, 29916, 29918, 1217, 29918, 8299, 29918, 666, 29898, 1311, 1125, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 4085, 29916, 29908, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 13, 462, 632, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 1243, 29918, 4085, 29916, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 4085, 29916, 29908, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 539, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 2413, 29880, 2676, 637, 2433, 29947, 29900, 29947, 29896, 742, 13, 462, 539, 2413, 29880, 5060, 5527, 637, 2433, 29947, 29900, 29947, 29896, 1495, 13, 13, 1678, 822, 1243, 29918, 1212, 15389, 29918, 1217, 29918, 8299, 29918, 666, 29898, 1311, 1125, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 1212, 15389, 29908, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 13, 462, 632, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 1243, 29918, 1212, 15389, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 1212, 15389, 29908, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 539, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 2413, 29880, 2676, 637, 2433, 29947, 29900, 29947, 29896, 742, 13, 462, 539, 2413, 29880, 5060, 5527, 637, 2433, 29947, 29900, 29947, 29896, 1495, 13, 13, 1678, 822, 1243, 29918, 2212, 333, 29918, 1217, 29918, 8299, 29918, 666, 29898, 1311, 1125, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 2212, 333, 29908, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 13, 462, 632, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 1243, 29918, 2212, 333, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 2212, 333, 29908, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 539, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 2413, 29880, 2676, 637, 2433, 29947, 29900, 29947, 29900, 1495, 13, 13, 1678, 822, 1243, 29918, 2388, 465, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 2388, 465, 29908, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 539, 2413, 3466, 29922, 2271, 1982, 29889, 5510, 29889, 2271, 5510, 29898, 1311, 3032, 17821, 1617, 29918, 2271, 467, 28988, 29892, 13, 462, 539, 2413, 29880, 5060, 5527, 637, 2433, 29947, 29900, 29947, 29900, 1495, 13, 13, 1678, 822, 1243, 29918, 1388, 13344, 29918, 1217, 29918, 8299, 29918, 666, 29898, 1311, 1125, 13, 4706, 411, 11187, 29889, 5041, 877, 7692, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 29889, 657, 29918, 29734, 742, 13, 462, 4706, 736, 29918, 1767, 29922, 13668, 29931, 3057, 292, 3032, 17821, 1617, 29918, 2271, 1125, 13, 9651, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 1388, 13344, 29908, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1688, 29889, 3389, 3285, 13, 462, 632, 1243, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 29934, 3904, 29918, 11432, 29897, 13, 13, 1678, 822, 1243, 29918, 1388, 13344, 29898, 1311, 1125, 13, 4706, 2897, 29889, 21813, 3366, 7230, 29940, 29918, 22412, 1672, 2208, 1001, 29918, 5690, 3108, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 2897, 29889, 21813, 3366, 25580, 9818, 1001, 29918, 11116, 3108, 353, 376, 1388, 13344, 29908, 13, 4706, 1583, 3032, 1688, 29918, 3389, 29898, 1688, 4878, 29889, 3057, 8259, 29889, 5746, 29918, 8949, 29892, 13, 462, 539, 2413, 3466, 29922, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 29892, 2413, 29880, 2676, 637, 2433, 29947, 29896, 29947, 29896, 742, 13, 462, 539, 2413, 29880, 5060, 5527, 637, 2433, 29947, 29900, 29947, 29955, 1495, 13, 13, 13, 1990, 438, 19558, 8559, 11726, 3057, 292, 29898, 13668, 29931, 3057, 292, 1125, 13, 13, 1678, 9995, 1576, 770, 6724, 438, 19558, 11726, 1213, 15945, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 16680, 353, 2413, 29880, 29889, 13668, 29931, 11726, 580, 13, 4706, 2428, 29898, 13668, 29931, 8559, 11726, 3057, 292, 29892, 1583, 467, 842, 3373, 580, 13, 13, 1678, 822, 1243, 29918, 4381, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 16680, 29889, 5510, 29918, 5085, 3285, 1583, 29889, 4381, 5085, 29897, 13, 13, 1678, 822, 1243, 29918, 16121, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4381, 5085, 1839, 17821, 1617, 2271, 2033, 353, 1583, 3032, 17821, 1617, 29918, 2271, 13, 4706, 1583, 29889, 4381, 5085, 1839, 397, 3466, 2033, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 1583, 29889, 16680, 29889, 5510, 29918, 5085, 29898, 13, 18884, 6796, 489, 17821, 1617, 2271, 3790, 29913, 1642, 4830, 29898, 1311, 3032, 17821, 1617, 29918, 2271, 511, 13, 462, 376, 489, 397, 3466, 3790, 29913, 1642, 4830, 29898, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 4638, 511, 13, 9651, 1583, 29889, 4381, 5085, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 9675, 29889, 303, 20405, 742, 716, 29918, 4804, 519, 29922, 28319, 29889, 1231, 5971, 29897, 13, 1678, 822, 1243, 29918, 14057, 29898, 1311, 29892, 11187, 29918, 5696, 1125, 13, 4706, 1583, 29889, 4381, 5085, 1839, 5431, 2033, 353, 525, 1646, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 1125, 13, 9651, 1583, 29889, 16680, 29889, 5510, 29918, 5085, 29898, 3366, 489, 5431, 29922, 1646, 20068, 13, 4706, 1583, 29889, 9294, 5574, 29898, 17640, 29918, 5696, 29889, 657, 1767, 2141, 27382, 2541, 703, 21125, 29901, 5783, 13, 13, 1678, 822, 903, 1688, 29918, 1191, 29898, 1311, 29892, 1852, 29892, 995, 1125, 13, 4706, 1583, 29889, 4381, 5085, 29961, 1191, 29962, 353, 995, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 1583, 29889, 16680, 29889, 5510, 29918, 5085, 29898, 3366, 489, 8875, 3790, 29913, 1642, 4830, 29898, 1191, 29892, 995, 4638, 511, 13, 9651, 1583, 29889, 4381, 5085, 29897, 13, 13, 1678, 822, 1243, 29918, 397, 29880, 6786, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 397, 29880, 6786, 742, 525, 5431, 1495, 13, 13, 1678, 822, 1243, 29918, 397, 29880, 5630, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 397, 29880, 5630, 742, 525, 5431, 1495, 13, 13, 1678, 822, 1243, 29918, 359, 5150, 2271, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 359, 5150, 2271, 742, 525, 1124, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29946, 29901, 29945, 29900, 29900, 29900, 29914, 29894, 29906, 1495, 13, 13, 1678, 822, 1243, 29918, 17821, 1617, 2271, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 17821, 1617, 2271, 742, 525, 1124, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29946, 29901, 29929, 29953, 29929, 29953, 1495, 13, 13, 1678, 822, 1243, 29918, 359, 6786, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 359, 6786, 742, 525, 5431, 1495, 13, 13, 1678, 822, 1243, 29918, 359, 1792, 7247, 978, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 359, 1792, 7247, 978, 742, 525, 7247, 1495, 13, 13, 1678, 822, 1243, 29918, 359, 4836, 978, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 359, 4836, 978, 742, 525, 5431, 1495, 13, 13, 1678, 822, 1243, 29918, 359, 4836, 7247, 978, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 359, 4836, 7247, 978, 742, 525, 7247, 1495, 13, 13, 1678, 822, 1243, 29918, 359, 5630, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 359, 5630, 742, 525, 5431, 1495, 13, 13, 1678, 822, 1243, 29918, 397, 3466, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 397, 3466, 742, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29946, 1495, 13, 13, 1678, 822, 1243, 29918, 397, 29880, 2676, 637, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 397, 29880, 2676, 637, 742, 525, 29947, 29900, 1495, 13, 13, 1678, 822, 1243, 29918, 397, 29880, 5060, 5527, 637, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1688, 29918, 1191, 877, 397, 29880, 5060, 5527, 637, 742, 525, 29947, 29900, 1495, 13, 13, 1678, 822, 1243, 29918, 13364, 400, 10396, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4381, 5085, 1839, 13364, 400, 10396, 2033, 353, 5852, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 16680, 29889, 5510, 29918, 5085, 29898, 3366, 489, 8875, 1642, 4830, 877, 13364, 400, 10396, 1495, 11724, 13, 462, 308, 1583, 29889, 4381, 5085, 29897, 13, 13, 1678, 822, 1243, 29918, 20787, 29918, 5085, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4381, 5085, 1839, 17821, 1617, 2271, 2033, 353, 1583, 3032, 17821, 1617, 29918, 2271, 13, 4706, 1583, 29889, 4381, 5085, 1839, 397, 3466, 2033, 353, 1583, 3032, 4928, 29876, 29918, 8299, 29918, 666, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 1583, 29889, 16680, 29889, 5510, 29918, 5085, 29898, 13, 18884, 6796, 489, 17821, 1617, 2271, 3790, 29913, 1642, 4830, 29898, 1311, 3032, 17821, 1617, 29918, 2271, 511, 13, 462, 376, 489, 397, 3466, 3790, 29913, 1642, 4830, 29898, 1311, 3032, 4928, 29876, 29918, 8299, 29918, 666, 4638, 511, 13, 9651, 1583, 29889, 4381, 5085, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 12183, 29889, 20472, 29898, 21027, 29889, 11341, 1806, 2965, 1964, 29897, 13, 1678, 443, 27958, 29889, 3396, 29898, 18248, 359, 537, 29922, 29906, 29897, 13, 2 ]
code_week11_76_712/unique_paths.py
dylanlee101/leetcode
0
1837
''' 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。 问总共有多少条不同的路径? 例如,上图是一个7 x 3 的网格。有多少可能的路径?   示例 1: 输入: m = 3, n = 2 输出: 3 解释: 从左上角开始,总共有 3 条路径可以到达右下角。 1. 向右 -> 向右 -> 向下 2. 向右 -> 向下 -> 向右 3. 向下 -> 向右 -> 向右 示例 2: 输入: m = 7, n = 3 输出: 28 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/unique-paths ''' class Solution: def uniquePaths(self, m: int, n: int) -> int: dp = [1] + [0] * n for i in range(m): for j in range(n): dp[j] = dp[j] + dp[j-1] return dp[-2]
[ 1, 14550, 13, 30287, 30502, 31429, 30943, 30313, 30956, 30909, 30287, 30502, 286, 921, 302, 29871, 31222, 31168, 30210, 31651, 30429, 31432, 29871, 30419, 31558, 31020, 30940, 30505, 30557, 30861, 30275, 31062, 31410, 30573, 30015, 4763, 30024, 29871, 30409, 30267, 13, 13, 31429, 30943, 30313, 31951, 30936, 31557, 30815, 31331, 30557, 31391, 30767, 31331, 31803, 31618, 30846, 30287, 233, 176, 168, 30267, 31429, 30943, 30313, 31787, 30861, 31798, 30780, 31222, 31168, 30210, 31803, 30557, 31432, 30419, 30505, 30557, 30861, 30275, 31062, 31410, 30573, 30015, 12881, 728, 30024, 30409, 30267, 13, 13, 31658, 233, 131, 190, 31611, 30417, 30923, 31022, 31217, 30413, 30980, 30210, 30874, 232, 193, 135, 30882, 13, 13, 13, 13, 31507, 30847, 30214, 30429, 30861, 30392, 30287, 30502, 29955, 921, 29871, 29941, 29871, 30210, 31222, 31168, 30267, 30417, 30923, 31022, 30682, 30815, 30210, 30874, 232, 193, 135, 30882, 13, 13, 30081, 13, 13, 30858, 31507, 30081, 29896, 29901, 13, 13, 31573, 30752, 29901, 286, 353, 29871, 29941, 29892, 302, 353, 29871, 29906, 13, 31573, 30544, 29901, 29871, 29941, 13, 31201, 236, 138, 141, 29901, 13, 31594, 31651, 30429, 31432, 31026, 31020, 30214, 233, 131, 190, 31611, 30417, 29871, 29941, 29871, 31217, 30874, 232, 193, 135, 30682, 30651, 30780, 31798, 31803, 30557, 31432, 30267, 13, 29896, 29889, 29871, 31331, 31803, 1599, 29871, 31331, 31803, 1599, 29871, 31331, 30557, 13, 29906, 29889, 29871, 31331, 31803, 1599, 29871, 31331, 30557, 1599, 29871, 31331, 31803, 13, 29941, 29889, 29871, 31331, 30557, 1599, 29871, 31331, 31803, 1599, 29871, 31331, 31803, 13, 30858, 31507, 30081, 29906, 29901, 13, 13, 31573, 30752, 29901, 286, 353, 29871, 29955, 29892, 302, 353, 29871, 29941, 13, 31573, 30544, 29901, 29871, 29906, 29947, 13, 13, 30805, 31193, 30383, 31074, 233, 140, 166, 30419, 3226, 300, 3399, 30409, 13, 236, 150, 193, 31092, 30383, 991, 597, 280, 300, 401, 29899, 18038, 29889, 510, 29914, 17199, 29879, 29914, 13092, 29899, 24772, 13, 12008, 13, 1990, 24380, 29901, 13, 1678, 822, 5412, 2605, 29879, 29898, 1311, 29892, 286, 29901, 938, 29892, 302, 29901, 938, 29897, 1599, 938, 29901, 13, 4706, 270, 29886, 353, 518, 29896, 29962, 718, 518, 29900, 29962, 334, 302, 13, 4706, 363, 474, 297, 3464, 29898, 29885, 1125, 13, 9651, 363, 432, 297, 3464, 29898, 29876, 1125, 13, 18884, 270, 29886, 29961, 29926, 29962, 353, 270, 29886, 29961, 29926, 29962, 718, 270, 29886, 29961, 29926, 29899, 29896, 29962, 13, 4706, 736, 270, 29886, 14352, 29906, 29962, 2 ]
example/example.py
jaewoolee82/translatetool
2
172806
<filename>example/example.py import translatetool import asyncio async def runit(): add = translatetool.translate("Papago Client ID", "Papago Client Secret") add1 = await add.translate("ko", "en", "안녕하세요, 테스트 입니다.") # 언어: ko, en, ja, zh-CN, zh-TW, vi, id, th, de, ru, es, it, fr print(add1) asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.run(runit())
[ 1, 529, 9507, 29958, 4773, 29914, 4773, 29889, 2272, 13, 5215, 1301, 5066, 300, 1507, 13, 5215, 408, 948, 3934, 13, 13, 13, 12674, 822, 1065, 277, 7295, 13, 1678, 788, 353, 1301, 5066, 300, 1507, 29889, 21652, 703, 29925, 481, 4425, 12477, 3553, 613, 376, 29925, 481, 4425, 12477, 10213, 1159, 13, 1678, 788, 29896, 353, 7272, 788, 29889, 21652, 703, 2901, 613, 376, 264, 613, 376, 31734, 238, 136, 152, 30944, 31578, 31527, 29892, 29871, 240, 136, 143, 30784, 31177, 29871, 239, 161, 136, 31063, 30709, 23157, 396, 29871, 239, 153, 187, 31129, 29901, 5812, 29892, 427, 29892, 12337, 29892, 503, 29882, 29899, 13778, 29892, 503, 29882, 29899, 16240, 29892, 3516, 29892, 1178, 29892, 266, 29892, 316, 29892, 5796, 29892, 831, 29892, 372, 29892, 1424, 13, 1678, 1596, 29898, 1202, 29896, 29897, 13, 13, 13, 294, 948, 3934, 29889, 842, 29918, 3696, 29918, 7888, 29918, 22197, 29898, 294, 948, 3934, 29889, 7685, 10378, 2624, 18405, 15644, 3101, 13, 294, 948, 3934, 29889, 3389, 29898, 3389, 277, 3101, 13, 2 ]
spacy/lang/tt/__init__.py
algteam/spacy_zh_model
5
1600179
<reponame>algteam/spacy_zh_model<filename>spacy/lang/tt/__init__.py # coding: utf8 from __future__ import unicode_literals from .lex_attrs import LEX_ATTRS from .punctuation import TOKENIZER_INFIXES from .stop_words import STOP_WORDS from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from ..tokenizer_exceptions import BASE_EXCEPTIONS from ...attrs import LANG from ...language import Language from ...util import update_exc class TatarDefaults(Language.Defaults): lex_attr_getters = dict(Language.Defaults.lex_attr_getters) lex_attr_getters[LANG] = lambda text: 'tt' lex_attr_getters.update(LEX_ATTRS) tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) infixes = tuple(TOKENIZER_INFIXES) stop_words = STOP_WORDS class Tatar(Language): lang = 'tt' Defaults = TatarDefaults __all__ = ['Tatar']
[ 1, 529, 276, 1112, 420, 29958, 9564, 14318, 29914, 1028, 4135, 29918, 17599, 29918, 4299, 29966, 9507, 29958, 1028, 4135, 29914, 3893, 29914, 698, 29914, 1649, 2344, 26914, 2272, 13, 29937, 14137, 29901, 23616, 29947, 30004, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 30004, 13, 30004, 13, 3166, 869, 2506, 29918, 5552, 29879, 1053, 365, 5746, 29918, 1299, 5659, 29903, 30004, 13, 3166, 869, 29886, 18049, 29884, 362, 1053, 7495, 29968, 1430, 26664, 1001, 29918, 1177, 25634, 2890, 30004, 13, 3166, 869, 9847, 29918, 9303, 1053, 6850, 4590, 29918, 11686, 8452, 30004, 13, 3166, 869, 6979, 3950, 29918, 11739, 29879, 1053, 7495, 29968, 1430, 26664, 1001, 29918, 5746, 4741, 7982, 27946, 30004, 13, 3166, 6317, 6979, 3950, 29918, 11739, 29879, 1053, 350, 8127, 29918, 5746, 4741, 7982, 27946, 30004, 13, 3166, 2023, 5552, 29879, 1053, 365, 19453, 30004, 13, 3166, 2023, 11675, 1053, 17088, 30004, 13, 3166, 2023, 4422, 1053, 2767, 29918, 735, 29883, 30004, 13, 30004, 13, 30004, 13, 1990, 323, 14873, 24863, 29898, 21233, 29889, 24863, 1125, 30004, 13, 1678, 19566, 29918, 5552, 29918, 657, 2153, 353, 9657, 29898, 21233, 29889, 24863, 29889, 2506, 29918, 5552, 29918, 657, 2153, 8443, 13, 1678, 19566, 29918, 5552, 29918, 657, 2153, 29961, 29931, 19453, 29962, 353, 14013, 1426, 29901, 525, 698, 29915, 30004, 13, 30004, 13, 1678, 19566, 29918, 5552, 29918, 657, 2153, 29889, 5504, 29898, 1307, 29990, 29918, 1299, 5659, 29903, 8443, 13, 30004, 13, 1678, 5993, 3950, 29918, 11739, 29879, 353, 2767, 29918, 735, 29883, 29898, 25416, 29918, 5746, 4741, 7982, 27946, 29892, 7495, 29968, 1430, 26664, 1001, 29918, 5746, 4741, 7982, 27946, 8443, 13, 1678, 3041, 861, 267, 353, 18761, 29898, 4986, 29968, 1430, 26664, 1001, 29918, 1177, 25634, 2890, 8443, 13, 30004, 13, 1678, 5040, 29918, 9303, 353, 6850, 4590, 29918, 11686, 8452, 30004, 13, 30004, 13, 30004, 13, 1990, 323, 14873, 29898, 21233, 1125, 30004, 13, 1678, 6361, 353, 525, 698, 29915, 30004, 13, 1678, 13109, 29879, 353, 323, 14873, 24863, 30004, 13, 30004, 13, 30004, 13, 1649, 497, 1649, 353, 6024, 29911, 14873, 2033, 30004, 13, 2 ]
scripts/06_I.py
HalfInner/AoC2019
1
180439
''' --- Day 6: Universal Orbit Map --- You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. You download a map of the local orbits (your puzzle input). Except for the universal Center of Mass (COM), every object in space is in orbit around exactly one other object. An orbit looks roughly like this: \ \ | | AAA--> o o <--BBB | | / / In this diagram, the object BBB is in orbit around AAA. The path that BBB takes around AAA (drawn with lines) is only partly shown. In the map data, this orbital relationship is written AAA)BBB, which means "BBB is in orbit around AAA". Before you use your map data to plot a course, you need to make sure it wasn't corrupted during the download. To verify maps, the Universal Orbit Map facility uses orbit count checksums - the total number of direct orbits (like the one shown above) and indirect orbits. Whenever A orbits B and B orbits C, then A indirectly orbits C. This chain can be any number of objects long: if A orbits B, B orbits C, and C orbits D, then A indirectly orbits D. For example, suppose you have the following map: COM)B B)C C)D D)E E)F B)G G)H D)I E)J J)K K)L Visually, the above map of orbits looks like this: G - H J - K - L / / COM - B - C - D - E - F \ I In this visual representation, when two objects are connected by a line, the one on the right directly orbits the one on the left. Here, we can count the total number of orbits as follows: D directly orbits C and indirectly orbits B and COM, a total of 3 orbits. L directly orbits K and indirectly orbits J, E, D, C, B, and COM, a total of 7 orbits. COM orbits nothing. The total number of direct and indirect orbits in this example is 42. What is the total number of direct and indirect orbits in your map data? ''' import sys import anytree GLOBAL_PATH = {} def calculate_depth(universe, root_planet='COM', depth=0, path=[]): # print('{}>{}({})'.format(depth, root_planet, depth), end='\n') path.append(root_planet) if root_planet in ('YOU', 'SAN'): GLOBAL_PATH[root_planet] = path.copy() print('Path', path) if root_planet not in universe: path.pop() return 0, depth cur_indirect_orbits = depth cur_direct_orbits = len(universe[root_planet]) for planet in universe[root_planet]: planet_direct_orbits, planet_indirect_orbits = calculate_depth(universe, planet, depth + 1, path) cur_direct_orbits += planet_direct_orbits cur_indirect_orbits += planet_indirect_orbits path.pop() return cur_direct_orbits, cur_indirect_orbits def assembly_universe(orbits): universe = {} for source, ring in orbits: if source not in universe.keys(): universe[source] = [] universe[source].append(ring) # print('Universe', universe) return universe def parse_file(file_path: str): orbits = [] with open(file_path, 'r') as f: for line in f: orbit = line.replace('\n', '').replace('\r', '').split(')') orbits.append((orbit[0], orbit[1])) return orbits def main(argv): center_of_mass = 'COM' print(calculate_depth(assembly_universe(parse_file(argv[1])), center_of_mass)) step = 0 idx = 0 while GLOBAL_PATH['YOU'][idx] == GLOBAL_PATH['SAN'][idx]: idx += 1 print('idx={} YOUdepth={} SANdepth={} diff_you={} diff_san={} diff_you_san={}'.format( idx, len(GLOBAL_PATH['YOU']), len(GLOBAL_PATH['SAN']), len(GLOBAL_PATH['YOU']) - idx, len(GLOBAL_PATH['SAN']) - idx, len(GLOBAL_PATH['YOU']) - idx + len(GLOBAL_PATH['SAN']) - idx)) if __name__ == "__main__": sys.exit(main(sys.argv))
[ 1, 14550, 13, 5634, 8373, 29871, 29953, 29901, 21536, 1394, 2966, 7315, 11474, 13, 3492, 29915, 345, 2982, 287, 472, 278, 21536, 1394, 2966, 7315, 24454, 373, 29389, 29891, 29889, 7311, 11322, 297, 2913, 4049, 20789, 6782, 5393, 1546, 470, 14836, 29892, 278, 16980, 11053, 1244, 526, 5407, 363, 9138, 8543, 12049, 1546, 29892, 363, 1342, 29892, 366, 322, 7510, 29889, 887, 5142, 263, 2910, 310, 278, 1887, 470, 14836, 313, 8066, 20285, 280, 1881, 467, 13, 13, 1252, 1547, 363, 278, 15968, 7817, 310, 7360, 313, 19795, 511, 1432, 1203, 297, 2913, 338, 297, 16980, 2820, 3721, 697, 916, 1203, 29889, 530, 16980, 3430, 20928, 763, 445, 29901, 13, 13, 462, 29871, 320, 13, 462, 259, 320, 13, 462, 1678, 891, 13, 462, 1678, 891, 13, 6344, 29909, 15110, 288, 9651, 288, 529, 489, 14388, 29933, 13, 462, 1678, 891, 13, 462, 1678, 891, 13, 462, 259, 847, 13, 462, 29871, 847, 13, 797, 445, 13722, 29892, 278, 1203, 350, 14388, 338, 297, 16980, 2820, 319, 6344, 29889, 450, 2224, 393, 350, 14388, 4893, 2820, 319, 6344, 313, 19811, 1233, 411, 3454, 29897, 338, 871, 22669, 4318, 29889, 512, 278, 2910, 848, 29892, 445, 19528, 2410, 9443, 338, 3971, 319, 6344, 29897, 14388, 29933, 29892, 607, 2794, 376, 14388, 29933, 338, 297, 16980, 2820, 319, 6344, 1642, 13, 13, 18743, 366, 671, 596, 2910, 848, 304, 6492, 263, 3236, 29892, 366, 817, 304, 1207, 1854, 372, 9007, 29915, 29873, 1034, 14214, 2645, 278, 5142, 29889, 1763, 11539, 11053, 29892, 278, 21536, 1394, 2966, 7315, 24454, 3913, 16980, 2302, 1423, 2083, 29879, 448, 278, 3001, 1353, 310, 1513, 470, 14836, 313, 4561, 278, 697, 4318, 2038, 29897, 322, 26377, 470, 14836, 29889, 13, 13, 10401, 1310, 319, 470, 14836, 350, 322, 350, 470, 14836, 315, 29892, 769, 319, 26377, 368, 470, 14836, 315, 29889, 910, 9704, 508, 367, 738, 1353, 310, 3618, 1472, 29901, 565, 319, 470, 14836, 350, 29892, 350, 470, 14836, 315, 29892, 322, 315, 470, 14836, 360, 29892, 769, 319, 26377, 368, 470, 14836, 360, 29889, 13, 13, 2831, 1342, 29892, 7755, 366, 505, 278, 1494, 2910, 29901, 13, 13, 19795, 29897, 29933, 13, 29933, 29897, 29907, 13, 29907, 29897, 29928, 13, 29928, 29897, 29923, 13, 29923, 29897, 29943, 13, 29933, 29897, 29954, 13, 29954, 29897, 29950, 13, 29928, 29897, 29902, 13, 29923, 29897, 29967, 13, 29967, 29897, 29968, 13, 29968, 29897, 29931, 13, 6116, 1474, 29892, 278, 2038, 2910, 310, 470, 14836, 3430, 763, 445, 29901, 13, 13, 4706, 402, 448, 379, 539, 435, 448, 476, 448, 365, 13, 539, 847, 965, 847, 13, 19795, 448, 350, 448, 315, 448, 360, 448, 382, 448, 383, 13, 1669, 320, 13, 18884, 306, 13, 797, 445, 7604, 8954, 29892, 746, 1023, 3618, 526, 6631, 491, 263, 1196, 29892, 278, 697, 373, 278, 1492, 4153, 470, 14836, 278, 697, 373, 278, 2175, 29889, 13, 13, 10605, 29892, 591, 508, 2302, 278, 3001, 1353, 310, 470, 14836, 408, 4477, 29901, 13, 13, 29928, 4153, 470, 14836, 315, 322, 26377, 368, 470, 14836, 350, 322, 23353, 29892, 263, 3001, 310, 29871, 29941, 470, 14836, 29889, 13, 29931, 4153, 470, 14836, 476, 322, 26377, 368, 470, 14836, 435, 29892, 382, 29892, 360, 29892, 315, 29892, 350, 29892, 322, 23353, 29892, 263, 3001, 310, 29871, 29955, 470, 14836, 29889, 13, 19795, 470, 14836, 3078, 29889, 13, 1576, 3001, 1353, 310, 1513, 322, 26377, 470, 14836, 297, 445, 1342, 338, 29871, 29946, 29906, 29889, 13, 13, 5618, 338, 278, 3001, 1353, 310, 1513, 322, 26377, 470, 14836, 297, 596, 2910, 848, 29973, 13, 12008, 13, 13, 5215, 10876, 13, 5215, 738, 8336, 13, 13, 29954, 28902, 1964, 29918, 10145, 353, 6571, 13, 13, 13, 1753, 8147, 29918, 19488, 29898, 348, 12193, 29892, 3876, 29918, 9018, 300, 2433, 19795, 742, 10809, 29922, 29900, 29892, 2224, 29922, 2636, 1125, 13, 1678, 396, 1596, 877, 8875, 26208, 2119, 29912, 1800, 4286, 4830, 29898, 19488, 29892, 3876, 29918, 9018, 300, 29892, 10809, 511, 1095, 2433, 29905, 29876, 1495, 13, 1678, 2224, 29889, 4397, 29898, 4632, 29918, 9018, 300, 29897, 13, 1678, 565, 3876, 29918, 9018, 300, 297, 6702, 29979, 27269, 742, 525, 29903, 2190, 29374, 13, 4706, 402, 28902, 1964, 29918, 10145, 29961, 4632, 29918, 9018, 300, 29962, 353, 2224, 29889, 8552, 580, 13, 4706, 1596, 877, 2605, 742, 2224, 29897, 13, 13, 1678, 565, 3876, 29918, 9018, 300, 451, 297, 19859, 29901, 13, 4706, 2224, 29889, 7323, 580, 13, 4706, 736, 29871, 29900, 29892, 10809, 13, 13, 1678, 3151, 29918, 513, 1088, 29918, 11831, 1169, 353, 10809, 13, 1678, 3151, 29918, 11851, 29918, 11831, 1169, 353, 7431, 29898, 348, 12193, 29961, 4632, 29918, 9018, 300, 2314, 13, 1678, 363, 15754, 297, 19859, 29961, 4632, 29918, 9018, 300, 5387, 13, 4706, 15754, 29918, 11851, 29918, 11831, 1169, 29892, 15754, 29918, 513, 1088, 29918, 11831, 1169, 353, 8147, 29918, 19488, 29898, 348, 12193, 29892, 15754, 29892, 10809, 718, 29871, 29896, 29892, 2224, 29897, 13, 4706, 3151, 29918, 11851, 29918, 11831, 1169, 4619, 15754, 29918, 11851, 29918, 11831, 1169, 13, 4706, 3151, 29918, 513, 1088, 29918, 11831, 1169, 4619, 15754, 29918, 513, 1088, 29918, 11831, 1169, 13, 13, 1678, 2224, 29889, 7323, 580, 13, 1678, 736, 3151, 29918, 11851, 29918, 11831, 1169, 29892, 3151, 29918, 513, 1088, 29918, 11831, 1169, 13, 13, 13, 1753, 11470, 29918, 348, 12193, 29898, 11831, 1169, 1125, 13, 1678, 19859, 353, 6571, 13, 1678, 363, 2752, 29892, 9228, 297, 470, 14836, 29901, 13, 4706, 565, 2752, 451, 297, 19859, 29889, 8149, 7295, 13, 9651, 19859, 29961, 4993, 29962, 353, 5159, 13, 4706, 19859, 29961, 4993, 1822, 4397, 29898, 5393, 29897, 13, 1678, 396, 1596, 877, 8110, 3901, 742, 19859, 29897, 13, 1678, 736, 19859, 13, 13, 13, 1753, 6088, 29918, 1445, 29898, 1445, 29918, 2084, 29901, 851, 1125, 13, 1678, 470, 14836, 353, 5159, 13, 1678, 411, 1722, 29898, 1445, 29918, 2084, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 4706, 363, 1196, 297, 285, 29901, 13, 9651, 16980, 353, 1196, 29889, 6506, 28909, 29876, 742, 525, 2824, 6506, 28909, 29878, 742, 525, 2824, 5451, 877, 29897, 1495, 13, 9651, 470, 14836, 29889, 4397, 3552, 272, 2966, 29961, 29900, 1402, 16980, 29961, 29896, 12622, 13, 1678, 736, 470, 14836, 13, 13, 13, 1753, 1667, 29898, 19218, 1125, 13, 1678, 4818, 29918, 974, 29918, 25379, 353, 525, 19795, 29915, 13, 1678, 1596, 29898, 15807, 403, 29918, 19488, 29898, 26936, 29918, 348, 12193, 29898, 5510, 29918, 1445, 29898, 19218, 29961, 29896, 2314, 511, 4818, 29918, 974, 29918, 25379, 876, 13, 13, 1678, 4331, 353, 29871, 29900, 13, 1678, 22645, 353, 29871, 29900, 13, 1678, 1550, 402, 28902, 1964, 29918, 10145, 1839, 29979, 27269, 2033, 29961, 13140, 29962, 1275, 402, 28902, 1964, 29918, 10145, 1839, 29903, 2190, 2033, 29961, 13140, 5387, 22645, 4619, 29871, 29896, 13, 1678, 1596, 877, 13140, 3790, 29913, 612, 27269, 19488, 3790, 29913, 317, 2190, 19488, 3790, 29913, 2923, 29918, 6293, 3790, 29913, 2923, 29918, 28455, 3790, 29913, 2923, 29918, 6293, 29918, 28455, 3790, 29913, 4286, 4830, 29898, 13, 4706, 22645, 29892, 13, 4706, 7431, 29898, 29954, 28902, 1964, 29918, 10145, 1839, 29979, 27269, 2033, 511, 13, 4706, 7431, 29898, 29954, 28902, 1964, 29918, 10145, 1839, 29903, 2190, 2033, 511, 13, 4706, 7431, 29898, 29954, 28902, 1964, 29918, 10145, 1839, 29979, 27269, 11287, 448, 22645, 29892, 13, 4706, 7431, 29898, 29954, 28902, 1964, 29918, 10145, 1839, 29903, 2190, 11287, 448, 22645, 29892, 13, 4706, 7431, 29898, 29954, 28902, 1964, 29918, 10145, 1839, 29979, 27269, 11287, 448, 22645, 718, 7431, 29898, 29954, 28902, 1964, 29918, 10145, 1839, 29903, 2190, 11287, 448, 22645, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 10876, 29889, 13322, 29898, 3396, 29898, 9675, 29889, 19218, 876, 13, 2 ]
ping-pong_main.py
AlgoritmikaPodolsk/ping_pong
1
176739
from pygame import * from random import randint # подгружаем отдельно функции для работы со шрифтом font.init() font1 = font.Font(None, 80) back = (100, 100, 200) lose = font1.render('YOU LOSE!', True, (180, 0, 0)) # класс-родитель для других спрайтов class GameSprite(sprite.Sprite): # конструктор класса def __init__(self, player_image, player_x, player_y, size_x, size_y, player_speed): # Вызываем конструктор класса (Sprite): sprite.Sprite.__init__(self) # каждый спрайт должен хранить свойство image - изображение self.image = transform.scale(image.load(player_image), (size_x, size_y)) self.speed = player_speed # каждый спрайт должен хранить свойство rect - прямоугольник, в который он вписан self.rect = self.image.get_rect() self.rect.x = player_x self.rect.y = player_y # метод, отрисовывающий героя на окне def reset(self): window.blit(self.image, (self.rect.x, self.rect.y)) # класс главного игрока class Player(GameSprite): # метод для управления спрайтом стрелками клавиатуры def update(self): keys = key.get_pressed() if keys[K_LEFT] and self.rect.x > 5: self.rect.x -= self.speed if keys[K_RIGHT] and self.rect.x < win_width - 80: self.rect.x += self.speed # класс спрайта-врага class Enemy(GameSprite): # движение врага def update(self): self.rect.y += self.speed global lost # исчезает, если дойдет до края экрана if self.rect.y > win_height: self.rect.x = randint(80, win_width - 80) self.rect.y = 0 lost = lost + 1 # Создаем окошко win_width = 700 win_height = 500 display.set_caption("Ping-pong") window = display.set_mode((win_width, win_height)) finish = False run = True while run: # событие нажатия на кнопку Закрыть for e in event.get(): if e.type == QUIT: run = False # сама игра: действия спрайтов, проверка правил игры, перерисовка if not finish: # обновляем фон window.fill(back) display.update() # цикл срабатывает каждую 0.02 секунды time.delay(20)
[ 1, 515, 22028, 1053, 334, 13, 3166, 4036, 1053, 20088, 524, 13, 29937, 3693, 29969, 1086, 2711, 3098, 22362, 11372, 20153, 3540, 3807, 24534, 1778, 3354, 641, 30011, 4816, 13, 5657, 29889, 2344, 580, 13, 5657, 29896, 353, 4079, 29889, 9824, 29898, 8516, 29892, 29871, 29947, 29900, 29897, 13, 1627, 353, 313, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29897, 13, 2226, 353, 4079, 29896, 29889, 9482, 877, 29979, 27269, 11247, 1660, 29991, 742, 5852, 29892, 313, 29896, 29947, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 876, 13, 13, 29937, 9955, 8808, 29899, 13508, 2584, 3807, 11935, 531, 8821, 29977, 4820, 13, 1990, 8448, 29903, 558, 568, 29898, 15099, 568, 29889, 29903, 558, 568, 1125, 13, 1678, 396, 3920, 18212, 8331, 9955, 13637, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4847, 29918, 3027, 29892, 4847, 29918, 29916, 29892, 4847, 29918, 29891, 29892, 2159, 29918, 29916, 29892, 2159, 29918, 29891, 29892, 4847, 29918, 19322, 1125, 13, 4706, 396, 14966, 10706, 3098, 3920, 18212, 8331, 9955, 13637, 313, 29903, 558, 568, 1125, 13, 4706, 29227, 29889, 29903, 558, 568, 17255, 2344, 12035, 1311, 29897, 13, 13, 4706, 396, 1787, 24057, 29977, 531, 8821, 24139, 11213, 4054, 17942, 507, 1413, 24913, 3501, 1967, 448, 1866, 15124, 11567, 13, 4706, 1583, 29889, 3027, 353, 4327, 29889, 7052, 29898, 3027, 29889, 1359, 29898, 9106, 29918, 3027, 511, 313, 2311, 29918, 29916, 29892, 2159, 29918, 29891, 876, 13, 4706, 1583, 29889, 19322, 353, 4847, 29918, 19322, 13, 13, 4706, 396, 1787, 24057, 29977, 531, 8821, 24139, 11213, 4054, 17942, 507, 1413, 24913, 3501, 7705, 448, 23380, 1630, 29960, 588, 693, 3316, 29892, 490, 12423, 6524, 490, 25736, 13, 4706, 1583, 29889, 1621, 353, 1583, 29889, 3027, 29889, 657, 29918, 1621, 580, 13, 4706, 1583, 29889, 1621, 29889, 29916, 353, 4847, 29918, 29916, 13, 4706, 1583, 29889, 1621, 29889, 29891, 353, 4847, 29918, 29891, 13, 13, 1678, 396, 20148, 29957, 29892, 18501, 7044, 29982, 846, 16059, 10342, 576, 29970, 665, 6752, 821, 13, 1678, 822, 10092, 29898, 1311, 1125, 13, 4706, 3474, 29889, 2204, 277, 29898, 1311, 29889, 3027, 29892, 313, 1311, 29889, 1621, 29889, 29916, 29892, 1583, 29889, 1621, 29889, 29891, 876, 13, 13, 29937, 9955, 8808, 13986, 1868, 10689, 576, 642, 13, 1990, 14574, 29898, 14199, 29903, 558, 568, 1125, 13, 1678, 396, 20148, 29957, 3807, 14548, 6052, 531, 8821, 29977, 4816, 21373, 29944, 13021, 9955, 21252, 15934, 13, 1678, 822, 2767, 29898, 1311, 1125, 13, 4706, 6611, 353, 1820, 29889, 657, 29918, 13120, 580, 13, 4706, 565, 6611, 29961, 29968, 29918, 28024, 29962, 322, 1583, 29889, 1621, 29889, 29916, 1405, 29871, 29945, 29901, 13, 9651, 1583, 29889, 1621, 29889, 29916, 22361, 1583, 29889, 19322, 13, 4706, 565, 6611, 29961, 29968, 29918, 22789, 3912, 29962, 322, 1583, 29889, 1621, 29889, 29916, 529, 5401, 29918, 2103, 448, 29871, 29947, 29900, 29901, 13, 9651, 1583, 29889, 1621, 29889, 29916, 4619, 1583, 29889, 19322, 13, 13, 29937, 9955, 8808, 531, 8821, 29977, 676, 29899, 18524, 1779, 1678, 13, 1990, 1174, 6764, 29898, 14199, 29903, 558, 568, 1125, 13, 1678, 396, 16186, 11567, 19195, 1779, 13, 1678, 822, 2767, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1621, 29889, 29891, 4619, 1583, 29889, 19322, 13, 4706, 5534, 5714, 13, 4706, 396, 9971, 1093, 1902, 1257, 29892, 1694, 12068, 1447, 29977, 1216, 29932, 1447, 6697, 29970, 2352, 3360, 477, 13, 4706, 565, 1583, 29889, 1621, 29889, 29891, 1405, 5401, 29918, 3545, 29901, 13, 9651, 1583, 29889, 1621, 29889, 29916, 353, 20088, 524, 29898, 29947, 29900, 29892, 5401, 29918, 2103, 448, 29871, 29947, 29900, 29897, 13, 9651, 1583, 29889, 1621, 29889, 29891, 353, 29871, 29900, 13, 9651, 5714, 353, 5714, 718, 29871, 29896, 13, 13, 29937, 5579, 8728, 3098, 614, 551, 28567, 13, 5080, 29918, 2103, 353, 29871, 29955, 29900, 29900, 13, 5080, 29918, 3545, 353, 29871, 29945, 29900, 29900, 13, 4990, 29889, 842, 29918, 6671, 703, 29925, 292, 29899, 29886, 549, 1159, 13, 7165, 353, 2479, 29889, 842, 29918, 8513, 3552, 5080, 29918, 2103, 29892, 5401, 29918, 3545, 876, 13, 13, 13, 4951, 728, 353, 7700, 13, 3389, 353, 5852, 13, 8000, 1065, 29901, 13, 1678, 396, 1778, 6326, 18380, 665, 2711, 8883, 665, 1186, 570, 29964, 1382, 3982, 10300, 1413, 13, 1678, 363, 321, 297, 1741, 29889, 657, 7295, 13, 4706, 565, 321, 29889, 1853, 1275, 660, 29965, 1806, 29901, 13, 9651, 1065, 353, 7700, 13, 13, 1678, 396, 2489, 1155, 13781, 29901, 20046, 29970, 531, 8821, 29977, 4820, 29892, 10613, 780, 642, 12318, 29944, 10689, 3541, 29892, 2942, 641, 7044, 642, 13, 1678, 565, 451, 8341, 29901, 13, 4706, 396, 1604, 2835, 1225, 3098, 15779, 13, 4706, 3474, 29889, 5589, 29898, 1627, 29897, 13, 4706, 2479, 29889, 5504, 580, 13, 1678, 396, 12442, 29951, 29944, 29246, 3102, 3327, 20120, 1787, 8784, 30005, 29871, 29900, 29889, 29900, 29906, 1586, 1382, 29921, 4184, 13, 1678, 931, 29889, 18829, 29898, 29906, 29900, 29897, 13, 2 ]
pynetlib/tests/test_route.py
migibert/pynet
2
156117
<gh_stars>1-10 from __future__ import absolute_import import mock import unittest from . import read_file from nose_parameterized import parameterized from pynetlib.route import Route from pynetlib.exceptions import ObjectNotFoundException, ObjectAlreadyExistsException class TestRoute(unittest.TestCase): def setUp(self): self.ip_route_list_output = read_file('ip_route_list') def test_init_route(self): destination = 'destination' device = 'eth0' route = Route(destination, device) self.assertIsNone(route.metric) self.assertIsNone(route.source) self.assertIsNone(route.gateway) self.assertIsNone(route.namespace) @parameterized.expand([ ('1.2.1.2/30', None, None, None, None, None, False, False, False), ('1.2.3.4/30', None, None, None, None, None, False, True, True), ('default', 'wlo1', None, None, '600', '192.168.0.254', True, False, True), ('169.254.0.0/16', 'docker0', 'link', None, '1000', None, False, False, True), ('172.17.0.0/16', 'docker0', 'link', '172.17.0.1', None, None, False, False, True), ('192.168.0.0/24', 'wlo1', 'link', '192.168.0.11', '600', None, False, False, True) ]) @mock.patch('pynetlib.route.execute_command') def test_route_discovery(self, destination, device, scope, source, metric, gateway, default, prohibit, reachable, execute_command): execute_command.return_value = self.ip_route_list_output route = Route(destination, device) route.scope = scope route.source = source route.gateway = gateway route.metric = metric routes = Route.discover() self.assertEqual(len(routes), 6) found_route = routes[routes.index(route)] self.assertTrue(self.deep_equality(route, found_route)) self.assertEqual(found_route.is_default(), default) self.assertEqual(found_route.is_prohibited(), prohibit) self.assertEqual(found_route.is_reachable(), reachable) @mock.patch('pynetlib.route.execute_command') def test_refresh_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('default', 'wlo1') route.refresh() execute_command.assert_called_once_with("ip route list", namespace=None) self.assertEqual(route.metric, '600') self.assertEqual(route.gateway, '192.168.0.254') self.assertIsNone(route.source) self.assertIsNone(route.scope) self.assertIsNone(route.namespace) @mock.patch('pynetlib.route.execute_command') def test_refresh_non_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('destination', 'device') with self.assertRaises(ObjectNotFoundException): route.refresh() execute_command.assert_called_once_with("ip route list", namespace=None) @mock.patch('pynetlib.route.execute_command') def test_contains_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('default', 'wlo1') route.gateway = '192.168.0.254' self.assertTrue(route.exists()) execute_command.assert_called_once_with('ip route list', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_add_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('default', 'wlo1') route.gateway = '192.168.0.254' with self.assertRaises(ObjectAlreadyExistsException): route.create() execute_command.assert_called_once_with('ip route list', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_add_non_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('1.2.3.4', 'wlo1') route.gateway = '192.168.0.254' route.create() execute_command.assert_called_with('ip route add 1.2.3.4 dev wlo1 via 192.168.0.254', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_delete_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('default', 'wlo1') route.gateway = '192.168.0.254' route.delete() execute_command.assert_called_with('ip route del default', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_delete_non_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('1.2.3.4', 'wlo1') route.gateway = '192.168.0.254' with self.assertRaises(ObjectNotFoundException): route.delete() execute_command.assert_called_with('ip route del 1.2.3.4', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_prohibit_non_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('10.10.10.10/24', 'wlo1') route.prohibit() execute_command.assert_called_with('ip route add prohibit 10.10.10.10/24', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_prohibit_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('1.2.3.4/30', None) with self.assertRaises(ObjectAlreadyExistsException): route.prohibit() execute_command.assert_called_with('ip route del 1.2.3.4', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_unreachable_non_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('10.10.10.10/24', 'wlo1') route.unreachable() execute_command.assert_called_with('ip route add unreachable 10.10.10.10/24', namespace=None) @mock.patch('pynetlib.route.execute_command') def test_unreachable_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('1.2.3.4/30', None) with self.assertRaises(ObjectAlreadyExistsException): route.unreachable() execute_command.assert_called_with('ip route del 1.2.3.4', namespace=None) def deep_equality(self, expected, actual): return expected.destination == actual.destination \ and expected.device == actual.device \ and expected.scope == actual.scope \ and expected.source == actual.source \ and expected.metric == actual.metric \ and expected.gateway == actual.gateway
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 5215, 11187, 13, 5215, 443, 27958, 13, 3166, 869, 1053, 1303, 29918, 1445, 13, 3166, 26414, 29918, 15501, 1891, 1053, 3443, 1891, 13, 3166, 282, 948, 300, 1982, 29889, 13134, 1053, 12034, 13, 3166, 282, 948, 300, 1982, 29889, 11739, 29879, 1053, 4669, 17413, 2451, 29892, 4669, 2499, 2040, 24217, 2451, 13, 13, 13, 1990, 4321, 12085, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 353, 1303, 29918, 1445, 877, 666, 29918, 13134, 29918, 1761, 1495, 13, 13, 1678, 822, 1243, 29918, 2344, 29918, 13134, 29898, 1311, 1125, 13, 4706, 12551, 353, 525, 23848, 29915, 13, 4706, 4742, 353, 525, 621, 29900, 29915, 13, 4706, 5782, 353, 12034, 29898, 23848, 29892, 4742, 29897, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 13134, 29889, 16414, 29897, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 13134, 29889, 4993, 29897, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 13134, 29889, 17062, 1582, 29897, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 13134, 29889, 22377, 29897, 13, 13, 1678, 732, 15501, 1891, 29889, 18837, 4197, 13, 4706, 6702, 29896, 29889, 29906, 29889, 29896, 29889, 29906, 29914, 29941, 29900, 742, 6213, 29892, 6213, 29892, 6213, 29892, 6213, 29892, 6213, 29892, 7700, 29892, 7700, 29892, 7700, 511, 13, 4706, 6702, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 29914, 29941, 29900, 742, 6213, 29892, 6213, 29892, 6213, 29892, 6213, 29892, 6213, 29892, 7700, 29892, 5852, 29892, 5852, 511, 13, 4706, 6702, 4381, 742, 525, 29893, 417, 29896, 742, 6213, 29892, 6213, 29892, 525, 29953, 29900, 29900, 742, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 742, 5852, 29892, 7700, 29892, 5852, 511, 13, 4706, 6702, 29896, 29953, 29929, 29889, 29906, 29945, 29946, 29889, 29900, 29889, 29900, 29914, 29896, 29953, 742, 525, 14695, 29900, 742, 525, 2324, 742, 6213, 29892, 525, 29896, 29900, 29900, 29900, 742, 6213, 29892, 7700, 29892, 7700, 29892, 5852, 511, 13, 4706, 6702, 29896, 29955, 29906, 29889, 29896, 29955, 29889, 29900, 29889, 29900, 29914, 29896, 29953, 742, 525, 14695, 29900, 742, 525, 2324, 742, 525, 29896, 29955, 29906, 29889, 29896, 29955, 29889, 29900, 29889, 29896, 742, 6213, 29892, 6213, 29892, 7700, 29892, 7700, 29892, 5852, 511, 13, 4706, 6702, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29900, 29914, 29906, 29946, 742, 525, 29893, 417, 29896, 742, 525, 2324, 742, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29896, 29896, 742, 525, 29953, 29900, 29900, 742, 6213, 29892, 7700, 29892, 7700, 29892, 5852, 29897, 13, 268, 2314, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 13134, 29918, 2218, 11911, 29891, 29898, 1311, 29892, 12551, 29892, 4742, 29892, 6874, 29892, 2752, 29892, 12714, 29892, 28646, 29892, 2322, 29892, 21460, 277, 29892, 6159, 519, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 29898, 23848, 29892, 4742, 29897, 13, 4706, 5782, 29889, 6078, 353, 6874, 13, 4706, 5782, 29889, 4993, 353, 2752, 13, 4706, 5782, 29889, 17062, 1582, 353, 28646, 13, 4706, 5782, 29889, 16414, 353, 12714, 13, 4706, 12049, 353, 12034, 29889, 2218, 11911, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 27894, 511, 29871, 29953, 29897, 13, 4706, 1476, 29918, 13134, 353, 12049, 29961, 27894, 29889, 2248, 29898, 13134, 4638, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 24535, 29918, 13895, 29898, 13134, 29892, 1476, 29918, 13134, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 11940, 29918, 13134, 29889, 275, 29918, 4381, 3285, 2322, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 11940, 29918, 13134, 29889, 275, 29918, 771, 6335, 1573, 3285, 21460, 277, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 11940, 29918, 13134, 29889, 275, 29918, 276, 496, 519, 3285, 6159, 519, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 22379, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 4381, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 22379, 580, 13, 4706, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 703, 666, 5782, 1051, 613, 7397, 29922, 8516, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13134, 29889, 16414, 29892, 525, 29953, 29900, 29900, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13134, 29889, 17062, 1582, 29892, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 1495, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 13134, 29889, 4993, 29897, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 13134, 29889, 6078, 29897, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 13134, 29889, 22377, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 22379, 29918, 5464, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 23848, 742, 525, 10141, 1495, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2061, 17413, 2451, 1125, 13, 9651, 5782, 29889, 22379, 580, 13, 9651, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 703, 666, 5782, 1051, 613, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 11516, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 4381, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 17062, 1582, 353, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 29915, 13, 4706, 1583, 29889, 9294, 5574, 29898, 13134, 29889, 9933, 3101, 13, 4706, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 877, 666, 5782, 1051, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 1202, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 4381, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 17062, 1582, 353, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2061, 2499, 2040, 24217, 2451, 1125, 13, 9651, 5782, 29889, 3258, 580, 13, 9651, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 877, 666, 5782, 1051, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 1202, 29918, 5464, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 17062, 1582, 353, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 29915, 13, 4706, 5782, 29889, 3258, 580, 13, 4706, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 2541, 877, 666, 5782, 788, 29871, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 2906, 281, 417, 29896, 3025, 29871, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 8143, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 4381, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 17062, 1582, 353, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 29915, 13, 4706, 5782, 29889, 8143, 580, 13, 4706, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 2541, 877, 666, 5782, 628, 2322, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 8143, 29918, 5464, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 17062, 1582, 353, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29906, 29945, 29946, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2061, 17413, 2451, 1125, 13, 9651, 5782, 29889, 8143, 580, 13, 9651, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 2541, 877, 666, 5782, 628, 29871, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 771, 6335, 277, 29918, 5464, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29914, 29906, 29946, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 771, 6335, 277, 580, 13, 4706, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 2541, 877, 666, 5782, 788, 21460, 277, 29871, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29914, 29906, 29946, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 771, 6335, 277, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 29914, 29941, 29900, 742, 6213, 29897, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2061, 2499, 2040, 24217, 2451, 1125, 13, 9651, 5782, 29889, 771, 6335, 277, 580, 13, 9651, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 2541, 877, 666, 5782, 628, 29871, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 348, 276, 496, 519, 29918, 5464, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29914, 29906, 29946, 742, 525, 29893, 417, 29896, 1495, 13, 4706, 5782, 29889, 348, 276, 496, 519, 580, 13, 4706, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 2541, 877, 666, 5782, 788, 443, 276, 496, 519, 29871, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29889, 29896, 29900, 29914, 29906, 29946, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 29886, 948, 300, 1982, 29889, 13134, 29889, 7978, 29918, 6519, 1495, 13, 1678, 822, 1243, 29918, 348, 276, 496, 519, 29918, 735, 15423, 29918, 13134, 29898, 1311, 29892, 6222, 29918, 6519, 1125, 13, 4706, 6222, 29918, 6519, 29889, 2457, 29918, 1767, 353, 1583, 29889, 666, 29918, 13134, 29918, 1761, 29918, 4905, 13, 4706, 5782, 353, 12034, 877, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 29914, 29941, 29900, 742, 6213, 29897, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2061, 2499, 2040, 24217, 2451, 1125, 13, 9651, 5782, 29889, 348, 276, 496, 519, 580, 13, 9651, 6222, 29918, 6519, 29889, 9294, 29918, 13998, 29918, 2541, 877, 666, 5782, 628, 29871, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 742, 7397, 29922, 8516, 29897, 13, 13, 1678, 822, 6483, 29918, 13895, 29898, 1311, 29892, 3806, 29892, 3935, 1125, 13, 4706, 736, 3806, 29889, 23848, 1275, 3935, 29889, 23848, 320, 13, 9651, 322, 3806, 29889, 10141, 1275, 3935, 29889, 10141, 320, 13, 9651, 322, 3806, 29889, 6078, 1275, 3935, 29889, 6078, 320, 13, 9651, 322, 3806, 29889, 4993, 1275, 3935, 29889, 4993, 320, 13, 9651, 322, 3806, 29889, 16414, 1275, 3935, 29889, 16414, 320, 13, 9651, 322, 3806, 29889, 17062, 1582, 1275, 3935, 29889, 17062, 1582, 13, 2 ]
vega/search_space/networks/tensorflow/losses/__init__.py
Lzc06/vega
12
176951
<reponame>Lzc06/vega<gh_stars>10-100 from .cross_entropy_weight_decay import CrossEntropyWeightDecay from .mix_auxiliary_loss import MixAuxiliaryLoss
[ 1, 529, 276, 1112, 420, 29958, 29931, 29920, 29883, 29900, 29953, 29914, 345, 3249, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 3166, 869, 19128, 29918, 296, 14441, 29918, 7915, 29918, 7099, 388, 1053, 11189, 5292, 14441, 22676, 6185, 388, 13, 3166, 869, 28084, 29918, 2993, 2638, 653, 29918, 6758, 1053, 23478, 29909, 1314, 2638, 653, 29931, 2209, 13, 2 ]
aboutus/views.py
maxalmina/kudo
0
78595
<reponame>maxalmina/kudo<filename>aboutus/views.py from django.shortcuts import render # Create your views here. def labView(request): return render(request, 'aboutus/aboutus.html')
[ 1, 529, 276, 1112, 420, 29958, 3317, 284, 13257, 29914, 29895, 5333, 29966, 9507, 29958, 12717, 375, 29914, 7406, 29889, 2272, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 1753, 9775, 1043, 29898, 3827, 1125, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 12717, 375, 29914, 12717, 375, 29889, 1420, 1495, 2 ]
test/wavelet_test.py
fulmen27/SpectroFit
1
69075
"""import pywt import numpy as np import matplotlib.pyplot as plt t = np.linspace(-1, 1, 200, endpoint=False) sig = np.cos(2 * np.pi * 7 * t) + np.real(np.exp(-7*(t-0.4)**2)*np.exp(1j*2*np.pi*2*(t-0.4))) plt.plot(t, sig) plt.show() widths = np.arange(1, 31) cwtmatr, freqs = pywt.cwt(sig, widths, 'mexh') print(cwtmatr) print(freqs) plt.imshow(cwtmatr, extent=[-1, 1, 1, 31], cmap='PRGn', aspect='auto', vmax=abs(cwtmatr).max(), vmin=-abs(cwtmatr).max()) # doctest: +SKIP plt.show() # doctest: +SKIP""" import numpy as np import matplotlib.pyplot as plt import pywt import pywt.data t = [i for i in range(100)] t = np.asarray(t) sig = np.cos(2 * np.pi / 7 * t) + np.cos(2 * np.pi / 50 * t) - np.cos(2 * np.pi / 4 * t) + np.cos(2 * np.pi / 2 * t) """ ca, cd = pywt.dwt(sig, "bior3.5") cd_0 = [0 for _ in range(len(cd))] ca_0 = [0 for _ in range(len(ca))] sig_ret = pywt.idwt(ca, cd_0, "bior3.5") sig_ret2 = pywt.idwt(ca_0, cd, "bior3.5")""" coeffs = pywt.wavedec(sig, "rbio6.8", level=3) print(pywt.wavelist('rbio')) print(len(coeffs)) coeffs[3] = np.asarray([0 for i in range(len(coeffs[3]))]) coeffs[2] = np.asarray([0 for i in range(len(coeffs[2]))]) coeffs[1] = np.asarray([0 for i in range(len(coeffs[1]))]) # coeffs[0] = np.asarray([0 for i in range(len(coeffs[0]))]) sig_ret = pywt.waverec(coeffs, "rbio6.8") # plt.plot(t, sig) plt.plot(t, sig_ret) # plt.plot(t, np.cos(2 * np.pi / 7 * t)) plt.plot(t, np.cos(2 * np.pi / 50 * t)) # plt.plot(t, - np.cos(2 * np.pi / 4 * t)) # plt.plot(t, np.cos(2 * np.pi / 2 * t)) plt.show()
[ 1, 9995, 5215, 282, 5693, 29873, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 29873, 353, 7442, 29889, 1915, 3493, 6278, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 29900, 29900, 29892, 16248, 29922, 8824, 29897, 13, 18816, 29871, 353, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 334, 29871, 29955, 334, 260, 29897, 718, 7442, 29889, 6370, 29898, 9302, 29889, 4548, 6278, 29955, 16395, 29873, 29899, 29900, 29889, 29946, 29897, 1068, 29906, 11877, 9302, 29889, 4548, 29898, 29896, 29926, 29930, 29906, 29930, 9302, 29889, 1631, 29930, 29906, 16395, 29873, 29899, 29900, 29889, 29946, 4961, 13, 572, 29873, 29889, 5317, 29898, 29873, 29892, 4365, 29897, 13, 572, 29873, 29889, 4294, 580, 13, 2103, 29879, 353, 7442, 29889, 279, 927, 29898, 29896, 29892, 29871, 29941, 29896, 29897, 13, 29883, 14554, 2922, 29878, 29892, 3005, 29939, 29879, 353, 282, 5693, 29873, 29889, 29883, 14554, 29898, 18816, 29892, 2920, 29879, 29892, 525, 29885, 735, 29882, 1495, 13, 2158, 29898, 29883, 14554, 2922, 29878, 29897, 13, 2158, 29898, 29888, 7971, 29879, 29897, 13, 572, 29873, 29889, 326, 4294, 29898, 29883, 14554, 2922, 29878, 29892, 15834, 11759, 29899, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29941, 29896, 1402, 274, 1958, 2433, 10593, 29954, 29876, 742, 9565, 2433, 6921, 742, 13, 965, 325, 3317, 29922, 6897, 29898, 29883, 14554, 2922, 29878, 467, 3317, 3285, 325, 1195, 10457, 6897, 29898, 29883, 14554, 2922, 29878, 467, 3317, 3101, 29871, 396, 437, 312, 342, 29901, 718, 16033, 5690, 13, 572, 29873, 29889, 4294, 580, 396, 437, 312, 342, 29901, 718, 16033, 5690, 15945, 29908, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 5215, 282, 5693, 29873, 13, 5215, 282, 5693, 29873, 29889, 1272, 13, 13, 29873, 353, 518, 29875, 363, 474, 297, 3464, 29898, 29896, 29900, 29900, 4638, 13, 29873, 353, 7442, 29889, 294, 2378, 29898, 29873, 29897, 13, 18816, 353, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29955, 334, 260, 29897, 718, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29945, 29900, 334, 260, 29897, 448, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29946, 334, 260, 29897, 718, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29906, 334, 260, 29897, 13, 13, 15945, 29908, 13, 1113, 29892, 14965, 353, 282, 5693, 29873, 29889, 29881, 14554, 29898, 18816, 29892, 376, 29890, 1611, 29941, 29889, 29945, 1159, 13, 2252, 29918, 29900, 353, 518, 29900, 363, 903, 297, 3464, 29898, 2435, 29898, 2252, 28166, 13, 1113, 29918, 29900, 353, 518, 29900, 363, 903, 297, 3464, 29898, 2435, 29898, 1113, 28166, 13, 18816, 29918, 2267, 353, 282, 5693, 29873, 29889, 333, 14554, 29898, 1113, 29892, 14965, 29918, 29900, 29892, 376, 29890, 1611, 29941, 29889, 29945, 1159, 13, 18816, 29918, 2267, 29906, 353, 282, 5693, 29873, 29889, 333, 14554, 29898, 1113, 29918, 29900, 29892, 14965, 29892, 376, 29890, 1611, 29941, 29889, 29945, 1159, 15945, 29908, 13, 13, 1111, 12352, 29879, 353, 282, 5693, 29873, 29889, 29893, 10511, 687, 29898, 18816, 29892, 376, 6050, 601, 29953, 29889, 29947, 613, 3233, 29922, 29941, 29897, 13, 2158, 29898, 2272, 14554, 29889, 29893, 6447, 391, 877, 6050, 601, 8785, 13, 2158, 29898, 2435, 29898, 1111, 12352, 29879, 876, 13, 1111, 12352, 29879, 29961, 29941, 29962, 353, 7442, 29889, 294, 2378, 4197, 29900, 363, 474, 297, 3464, 29898, 2435, 29898, 1111, 12352, 29879, 29961, 29941, 12622, 2314, 13, 1111, 12352, 29879, 29961, 29906, 29962, 353, 7442, 29889, 294, 2378, 4197, 29900, 363, 474, 297, 3464, 29898, 2435, 29898, 1111, 12352, 29879, 29961, 29906, 12622, 2314, 13, 1111, 12352, 29879, 29961, 29896, 29962, 353, 7442, 29889, 294, 2378, 4197, 29900, 363, 474, 297, 3464, 29898, 2435, 29898, 1111, 12352, 29879, 29961, 29896, 12622, 2314, 13, 29937, 1302, 12352, 29879, 29961, 29900, 29962, 353, 7442, 29889, 294, 2378, 4197, 29900, 363, 474, 297, 3464, 29898, 2435, 29898, 1111, 12352, 29879, 29961, 29900, 12622, 2314, 13, 18816, 29918, 2267, 353, 282, 5693, 29873, 29889, 2766, 369, 687, 29898, 1111, 12352, 29879, 29892, 376, 6050, 601, 29953, 29889, 29947, 1159, 13, 13, 29937, 14770, 29889, 5317, 29898, 29873, 29892, 4365, 29897, 13, 572, 29873, 29889, 5317, 29898, 29873, 29892, 4365, 29918, 2267, 29897, 13, 29937, 14770, 29889, 5317, 29898, 29873, 29892, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29955, 334, 260, 876, 13, 572, 29873, 29889, 5317, 29898, 29873, 29892, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29945, 29900, 334, 260, 876, 13, 29937, 14770, 29889, 5317, 29898, 29873, 29892, 448, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29946, 334, 260, 876, 13, 29937, 14770, 29889, 5317, 29898, 29873, 29892, 7442, 29889, 3944, 29898, 29906, 334, 7442, 29889, 1631, 847, 29871, 29906, 334, 260, 876, 13, 572, 29873, 29889, 4294, 580, 2 ]
templatebot/utils/logger.py
elfq/template-bot-v2
1
199653
import asyncio from aiohttp import ClientSession from requests import post from datetime import datetime from termcolor import colored from logging import debug, info, warn, error, critical termc = { "debug": "white", "info": "green", "warn": "yellow", "error": "red", "critical": "red", } class LogLevel: DEBUG = 5 INFO = 4 WARNING = 3 ERROR = 2 CRITICAL = 1 class WebhookLogger: def __init__( self, name: str, url: str = None, level: int = LogLevel.INFO, loop=asyncio.get_event_loop(), ): self.name = name self.url = url self.level = level self.sess = ClientSession() self.loop = loop def create_content(self, logtype: str, content: str): timestamp = str(datetime.now()).split(".")[0] content = f"__**{logtype}**__ @ {timestamp}:\n{content}" data = { "username": self.name, "avatar_url": "https://vcokltfre.github.io/static/img/service.png", "content": content, "allowed_mentions": {"users": False, "roles": False, "everyone": False}, } return data def send(self, logtype: str, content: str): print(colored(f"[{logtype}] {content}", termc[logtype.lower()])) if not self.url: return data = self.create_content(logtype, content) post(self.url, json=data) async def send_async(self, logtype: str, content: str): print(colored(f"[{logtype}] {content}", termc[logtype.lower()])) if not self.url: return data = self.create_content(logtype, content) if self.sess.closed: self.sess = ClientSession() task = self.loop.create_task(self.sess.post(self.url, json=data)) task ## Synchronous methods def debug_s(self, content): self.send("debug", content) def info_s(self, content): self.send("info", content) def warn_s(self, content): self.send("warn", content) def error_s(self, content): self.send("error", content) def critical_s(self, content): self.send("critical", content) ## Asynchronous methods async def debug(self, content): await self.send_async("debug", content) async def info(self, content): await self.send_async("info", content) async def warn(self, content): await self.send_async("warn", content) async def error(self, content): await self.send_async("error", content) async def critical(self, content): await self.send_async("critical", content)
[ 1, 1053, 408, 948, 3934, 13, 3166, 263, 601, 1124, 1053, 12477, 7317, 13, 3166, 7274, 1053, 1400, 13, 3166, 12865, 1053, 12865, 13, 3166, 1840, 2780, 1053, 28684, 13, 3166, 12183, 1053, 4744, 29892, 5235, 29892, 29383, 29892, 1059, 29892, 12187, 13, 13, 8489, 29883, 353, 426, 13, 1678, 376, 8382, 1115, 376, 10921, 613, 13, 1678, 376, 3888, 1115, 376, 12692, 613, 13, 1678, 376, 25442, 1115, 376, 29136, 613, 13, 1678, 376, 2704, 1115, 376, 1127, 613, 13, 1678, 376, 9695, 936, 1115, 376, 1127, 613, 13, 29913, 13, 13, 13, 1990, 4522, 10108, 29901, 13, 1678, 21681, 353, 29871, 29945, 13, 1678, 15233, 353, 29871, 29946, 13, 1678, 399, 25614, 353, 29871, 29941, 13, 1678, 14431, 353, 29871, 29906, 13, 1678, 15600, 1806, 2965, 1964, 353, 29871, 29896, 13, 13, 13, 1990, 2563, 20849, 16363, 29901, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 1024, 29901, 851, 29892, 13, 4706, 3142, 29901, 851, 353, 6213, 29892, 13, 4706, 3233, 29901, 938, 353, 4522, 10108, 29889, 11690, 29892, 13, 4706, 2425, 29922, 294, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 3285, 13, 268, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 2271, 353, 3142, 13, 4706, 1583, 29889, 5563, 353, 3233, 13, 4706, 1583, 29889, 29879, 404, 353, 12477, 7317, 580, 13, 4706, 1583, 29889, 7888, 353, 2425, 13, 13, 1678, 822, 1653, 29918, 3051, 29898, 1311, 29892, 1480, 1853, 29901, 851, 29892, 2793, 29901, 851, 1125, 13, 4706, 14334, 353, 851, 29898, 12673, 29889, 3707, 16655, 5451, 17350, 1159, 29961, 29900, 29962, 13, 4706, 2793, 353, 285, 29908, 1649, 1068, 29912, 1188, 1853, 29913, 1068, 1649, 732, 426, 16394, 29913, 3583, 29876, 29912, 3051, 5038, 13, 4706, 848, 353, 426, 13, 9651, 376, 6786, 1115, 1583, 29889, 978, 29892, 13, 9651, 376, 485, 14873, 29918, 2271, 1115, 376, 991, 597, 7071, 554, 1896, 10745, 29889, 3292, 29889, 601, 29914, 7959, 29914, 2492, 29914, 5509, 29889, 2732, 613, 13, 9651, 376, 3051, 1115, 2793, 29892, 13, 9651, 376, 24622, 29918, 358, 1080, 1115, 8853, 7193, 1115, 7700, 29892, 376, 307, 793, 1115, 7700, 29892, 376, 17991, 650, 1115, 7700, 1118, 13, 4706, 500, 13, 4706, 736, 848, 13, 13, 1678, 822, 3638, 29898, 1311, 29892, 1480, 1853, 29901, 851, 29892, 2793, 29901, 851, 1125, 13, 4706, 1596, 29898, 2780, 287, 29898, 29888, 29908, 19660, 1188, 1853, 6525, 426, 3051, 17671, 1840, 29883, 29961, 1188, 1853, 29889, 13609, 580, 12622, 13, 4706, 565, 451, 1583, 29889, 2271, 29901, 13, 9651, 736, 13, 4706, 848, 353, 1583, 29889, 3258, 29918, 3051, 29898, 1188, 1853, 29892, 2793, 29897, 13, 4706, 1400, 29898, 1311, 29889, 2271, 29892, 4390, 29922, 1272, 29897, 13, 13, 1678, 7465, 822, 3638, 29918, 12674, 29898, 1311, 29892, 1480, 1853, 29901, 851, 29892, 2793, 29901, 851, 1125, 13, 4706, 1596, 29898, 2780, 287, 29898, 29888, 29908, 19660, 1188, 1853, 6525, 426, 3051, 17671, 1840, 29883, 29961, 1188, 1853, 29889, 13609, 580, 12622, 13, 4706, 565, 451, 1583, 29889, 2271, 29901, 13, 9651, 736, 13, 4706, 848, 353, 1583, 29889, 3258, 29918, 3051, 29898, 1188, 1853, 29892, 2793, 29897, 13, 4706, 565, 1583, 29889, 29879, 404, 29889, 15603, 29901, 13, 9651, 1583, 29889, 29879, 404, 353, 12477, 7317, 580, 13, 13, 4706, 3414, 353, 1583, 29889, 7888, 29889, 3258, 29918, 7662, 29898, 1311, 29889, 29879, 404, 29889, 2490, 29898, 1311, 29889, 2271, 29892, 4390, 29922, 1272, 876, 13, 4706, 3414, 13, 13, 1678, 444, 317, 15374, 3519, 13, 13, 1678, 822, 4744, 29918, 29879, 29898, 1311, 29892, 2793, 1125, 13, 4706, 1583, 29889, 6717, 703, 8382, 613, 2793, 29897, 13, 13, 1678, 822, 5235, 29918, 29879, 29898, 1311, 29892, 2793, 1125, 13, 4706, 1583, 29889, 6717, 703, 3888, 613, 2793, 29897, 13, 13, 1678, 822, 29383, 29918, 29879, 29898, 1311, 29892, 2793, 1125, 13, 4706, 1583, 29889, 6717, 703, 25442, 613, 2793, 29897, 13, 13, 1678, 822, 1059, 29918, 29879, 29898, 1311, 29892, 2793, 1125, 13, 4706, 1583, 29889, 6717, 703, 2704, 613, 2793, 29897, 13, 13, 1678, 822, 12187, 29918, 29879, 29898, 1311, 29892, 2793, 1125, 13, 4706, 1583, 29889, 6717, 703, 9695, 936, 613, 2793, 29897, 13, 13, 1678, 444, 1094, 15374, 3519, 13, 13, 1678, 7465, 822, 4744, 29898, 1311, 29892, 2793, 1125, 13, 4706, 7272, 1583, 29889, 6717, 29918, 12674, 703, 8382, 613, 2793, 29897, 13, 13, 1678, 7465, 822, 5235, 29898, 1311, 29892, 2793, 1125, 13, 4706, 7272, 1583, 29889, 6717, 29918, 12674, 703, 3888, 613, 2793, 29897, 13, 13, 1678, 7465, 822, 29383, 29898, 1311, 29892, 2793, 1125, 13, 4706, 7272, 1583, 29889, 6717, 29918, 12674, 703, 25442, 613, 2793, 29897, 13, 13, 1678, 7465, 822, 1059, 29898, 1311, 29892, 2793, 1125, 13, 4706, 7272, 1583, 29889, 6717, 29918, 12674, 703, 2704, 613, 2793, 29897, 13, 13, 1678, 7465, 822, 12187, 29898, 1311, 29892, 2793, 1125, 13, 4706, 7272, 1583, 29889, 6717, 29918, 12674, 703, 9695, 936, 613, 2793, 29897, 13, 2 ]
demo/views/utils.py
SalvatoreTosti/pyramid-demo
1
128624
import json def failure(message, status=400): return { 'status' : status, 'message' : message, 'payload' : '' } def success(message='success.', payload='', status=200): return { 'status' : status, 'message': message, 'payload' : payload } def validateJSON(request): try: request.json_body except json.decoder.JSONDecodeError: return failure('malformed JSON message.') def _validateInteger(value, valueName): try: int(value) except (ValueError, TypeError): return failure('expected '+ valueName + ' to be an integer value.') def validateIntegers(dictionary, values): for arg in values: errorMessage = _validateInteger(dictionary.get(arg), arg) if errorMessage: return errorMessage def validatePositiveIntegers(dictionary, values): for arg in values: value = dictionary.get(arg) integer = int(value) if integer < 0: return failure('expected '+ arg + ' to be a positive integer value.') def _validateFloat(value, valueName): try: float(value) except ValueError: return failure('expected '+ valueName + ' to be a float value.') def validateFloats(dictionary, values): for arg in values: errorMessage = _validateFloat(dictionary.get(arg), arg) if errorMessage: return errorMessage def validatePositiveFloats(dictionary, values): for arg in values: value = dictionary.get(arg) flt = float(value) if flt < 0: return failure('expected '+ arg + ' to be a positive float value.')
[ 1, 1053, 4390, 13, 13, 1753, 10672, 29898, 4906, 29892, 4660, 29922, 29946, 29900, 29900, 1125, 13, 1678, 736, 426, 13, 4706, 525, 4882, 29915, 584, 4660, 29892, 13, 4706, 525, 4906, 29915, 584, 2643, 29892, 13, 4706, 525, 23813, 29915, 584, 6629, 13, 1678, 500, 13, 13, 1753, 2551, 29898, 4906, 2433, 8698, 29889, 742, 20092, 2433, 742, 4660, 29922, 29906, 29900, 29900, 1125, 13, 1678, 736, 426, 13, 4706, 525, 4882, 29915, 584, 4660, 29892, 13, 4706, 525, 4906, 2396, 2643, 29892, 13, 4706, 525, 23813, 29915, 584, 20092, 13, 1678, 500, 13, 13, 1753, 12725, 7249, 29898, 3827, 1125, 13, 1678, 1018, 29901, 13, 4706, 2009, 29889, 3126, 29918, 2587, 13, 1678, 5174, 4390, 29889, 7099, 6119, 29889, 7249, 2772, 401, 2392, 29901, 13, 4706, 736, 10672, 877, 5156, 15628, 4663, 2643, 29889, 1495, 13, 13, 1753, 903, 15480, 7798, 29898, 1767, 29892, 995, 1170, 1125, 13, 1678, 1018, 29901, 13, 4706, 938, 29898, 1767, 29897, 13, 1678, 5174, 313, 1917, 2392, 29892, 20948, 1125, 13, 4706, 736, 10672, 877, 9684, 525, 29974, 995, 1170, 718, 525, 304, 367, 385, 6043, 995, 29889, 1495, 13, 13, 1753, 12725, 797, 371, 5743, 29898, 27126, 29892, 1819, 1125, 13, 1678, 363, 1852, 297, 1819, 29901, 13, 4706, 1059, 3728, 353, 903, 15480, 7798, 29898, 27126, 29889, 657, 29898, 1191, 511, 1852, 29897, 13, 4706, 565, 1059, 3728, 29901, 13, 9651, 736, 1059, 3728, 13, 13, 1753, 12725, 9135, 3321, 797, 371, 5743, 29898, 27126, 29892, 1819, 1125, 13, 1678, 363, 1852, 297, 1819, 29901, 13, 4706, 995, 353, 8600, 29889, 657, 29898, 1191, 29897, 13, 4706, 6043, 353, 938, 29898, 1767, 29897, 13, 4706, 565, 6043, 529, 29871, 29900, 29901, 13, 9651, 736, 10672, 877, 9684, 525, 29974, 1852, 718, 525, 304, 367, 263, 6374, 6043, 995, 29889, 1495, 13, 13, 1753, 903, 15480, 11031, 29898, 1767, 29892, 995, 1170, 1125, 13, 1678, 1018, 29901, 13, 4706, 5785, 29898, 1767, 29897, 13, 1678, 5174, 7865, 2392, 29901, 13, 4706, 736, 10672, 877, 9684, 525, 29974, 995, 1170, 718, 525, 304, 367, 263, 5785, 995, 29889, 1495, 1678, 13, 13, 1753, 12725, 29943, 417, 1446, 29898, 27126, 29892, 1819, 1125, 13, 1678, 363, 1852, 297, 1819, 29901, 13, 4706, 1059, 3728, 353, 903, 15480, 11031, 29898, 27126, 29889, 657, 29898, 1191, 511, 1852, 29897, 13, 4706, 565, 1059, 3728, 29901, 13, 9651, 736, 1059, 3728, 29871, 13, 13, 1753, 12725, 9135, 3321, 29943, 417, 1446, 29898, 27126, 29892, 1819, 1125, 13, 1678, 363, 1852, 297, 1819, 29901, 13, 4706, 995, 353, 8600, 29889, 657, 29898, 1191, 29897, 13, 4706, 1652, 29873, 353, 5785, 29898, 1767, 29897, 13, 4706, 565, 1652, 29873, 529, 29871, 29900, 29901, 13, 9651, 736, 10672, 877, 9684, 525, 29974, 1852, 718, 525, 304, 367, 263, 6374, 5785, 995, 29889, 1495, 13, 29871, 13, 268, 2 ]
src/main/python/taf/foundation/plugins/web/selenium/browser.py
WesleyPeng/uiXautomation
6
1602828
# Copyright (c) 2017-2018 {Flair Inc.} <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys from selenium import webdriver from selenium.webdriver import Remote as RemoteWebDriver from taf.foundation.api.ui.web import Browser as IBrowser from taf.foundation.plugins.web.selenium.support.browserwaithandler import \ BrowserWaitHandler class Browser(IBrowser): def __init__( self, name='firefox', identifier=None, **kwargs ): super(Browser, self).__init__( name, identifier, **kwargs ) @staticmethod def launch(url='about:blank', **kwargs): if not Browser.cache: Browser( kwargs.get('name'), kwargs.get('identifier') ) Browser.cache.current.get(url) BrowserWaitHandler( Browser.cache.current, kwargs.get('timeout', 30.0) ).wait() def activate(self): super(Browser, self).activate() self.cache.current.switch_to.window( self.cache.current.current_window_handle ) def maximize(self): self.cache.current.maximize_window() def sync(self, timeout=30): BrowserWaitHandler( self.cache.current, timeout ).wait() def get_screenshot_data(self): if isinstance(self.cache.current, RemoteWebDriver): return self.cache.current.get_screenshot_as_png() else: raise RuntimeError( "Selenium Web Driver is required" ) def _create_instance( self, name, **kwargs ): kwargs.setdefault('is_remote', False) is_remote = str( kwargs.pop('is_remote') ).lower() not in ('false', 'no') if is_remote: _instance = RemoteWebDriver( command_executor=kwargs.get( 'command_executor', 'http://{host}:{port}/wd/hub'.format( host=kwargs.get('host', 'localhost'), port=kwargs.get('port', 4444) ) ), desired_capabilities=kwargs.get( 'desired_capabilities', { 'browserName': { 'firefox': 'firefox', 'ff': 'firefox', 'chrome': 'chrome', 'gc': 'chrome', 'googlechrome': 'chrome' }.get( name.lower(), 'firefox' ), } ), browser_profile=kwargs.get('browser_profile'), proxy=kwargs.get('proxy'), keep_alive=kwargs.get('keep_alive', False), file_detector=kwargs.get('file_detector'), options=kwargs.get('options') ) else: _browser_creation_strategies = { 'ff': self._make_firefox, 'firefox': self._make_firefox, 'googlechrome': self._make_chrome, 'chrome': self._make_chrome, 'gc': self._make_chrome, } _creator = _browser_creation_strategies.get( name.lower() ) if not callable(_creator): raise ValueError('Unsupported browser type') _instance = _creator(**kwargs) # _instance.get('about:blank') return _instance def _make_firefox(self, **kwargs): return webdriver.Firefox(**kwargs) def _make_chrome(self, **kwargs): _driver_dir = os.path.join( os.path.dirname(__file__), 'support' ) _default_driver_dir = os.path.join( _driver_dir, 'chromedriver.exe' ) if sys.platform.startswith('linux'): _default_driver_dir = \ '/opt/google/chrome/chromedriver' if os.path.exists(_default_driver_dir): _driver_bin_file_path = _default_driver_dir else: _driver_bin_file_path = os.path.join( _driver_dir, 'chromedriver' ) os.environ['webdriver.chrome.driver'] = \ _driver_bin_file_path return webdriver.Chrome( _driver_bin_file_path, **kwargs )
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29955, 29899, 29906, 29900, 29896, 29947, 426, 29943, 433, 381, 9266, 5003, 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, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 13, 3166, 18866, 1053, 1856, 9465, 13, 3166, 18866, 29889, 29813, 1053, 5240, 866, 408, 5240, 866, 3609, 12376, 13, 13, 3166, 260, 2142, 29889, 11940, 362, 29889, 2754, 29889, 1481, 29889, 2676, 1053, 27088, 408, 15731, 8777, 13, 3166, 260, 2142, 29889, 11940, 362, 29889, 12800, 29889, 2676, 29889, 27373, 29889, 5924, 29889, 15965, 2766, 389, 392, 1358, 1053, 320, 13, 1678, 27088, 15716, 4598, 13, 13, 13, 1990, 27088, 29898, 8979, 8777, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 1024, 2433, 8696, 8944, 742, 13, 9651, 15882, 29922, 8516, 29892, 13, 9651, 3579, 19290, 13, 268, 1125, 13, 4706, 2428, 29898, 21537, 29892, 1583, 467, 1649, 2344, 12035, 13, 9651, 1024, 29892, 15882, 29892, 3579, 19290, 13, 4706, 1723, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 6826, 29898, 2271, 2433, 12717, 29901, 19465, 742, 3579, 19290, 1125, 13, 4706, 565, 451, 27088, 29889, 8173, 29901, 13, 9651, 27088, 29898, 13, 18884, 9049, 5085, 29889, 657, 877, 978, 5477, 13, 18884, 9049, 5085, 29889, 657, 877, 25378, 1495, 13, 9651, 1723, 13, 13, 4706, 27088, 29889, 8173, 29889, 3784, 29889, 657, 29898, 2271, 29897, 13, 13, 4706, 27088, 15716, 4598, 29898, 13, 9651, 27088, 29889, 8173, 29889, 3784, 29892, 13, 9651, 9049, 5085, 29889, 657, 877, 15619, 742, 29871, 29941, 29900, 29889, 29900, 29897, 13, 4706, 13742, 10685, 580, 13, 13, 1678, 822, 5039, 403, 29898, 1311, 1125, 13, 4706, 2428, 29898, 21537, 29892, 1583, 467, 11236, 403, 580, 13, 13, 4706, 1583, 29889, 8173, 29889, 3784, 29889, 15123, 29918, 517, 29889, 7165, 29898, 13, 9651, 1583, 29889, 8173, 29889, 3784, 29889, 3784, 29918, 7165, 29918, 8411, 13, 4706, 1723, 13, 13, 1678, 822, 5256, 675, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8173, 29889, 3784, 29889, 27525, 675, 29918, 7165, 580, 13, 13, 1678, 822, 16523, 29898, 1311, 29892, 11815, 29922, 29941, 29900, 1125, 13, 4706, 27088, 15716, 4598, 29898, 13, 9651, 1583, 29889, 8173, 29889, 3784, 29892, 13, 9651, 11815, 13, 4706, 13742, 10685, 580, 13, 13, 1678, 822, 679, 29918, 29879, 24546, 8711, 29918, 1272, 29898, 1311, 1125, 13, 4706, 565, 338, 8758, 29898, 1311, 29889, 8173, 29889, 3784, 29892, 5240, 866, 3609, 12376, 1125, 13, 9651, 736, 1583, 29889, 8173, 29889, 3784, 29889, 657, 29918, 29879, 24546, 8711, 29918, 294, 29918, 2732, 580, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 29898, 13, 18884, 376, 29903, 13462, 2563, 26391, 338, 3734, 29908, 13, 9651, 1723, 13, 13, 1678, 822, 903, 3258, 29918, 8758, 29898, 13, 9651, 1583, 29892, 1024, 29892, 3579, 19290, 13, 268, 1125, 13, 4706, 9049, 5085, 29889, 842, 4381, 877, 275, 29918, 16674, 742, 7700, 29897, 13, 13, 4706, 338, 29918, 16674, 353, 851, 29898, 13, 9651, 9049, 5085, 29889, 7323, 877, 275, 29918, 16674, 1495, 13, 4706, 13742, 13609, 580, 451, 297, 6702, 4541, 742, 525, 1217, 1495, 13, 13, 4706, 565, 338, 29918, 16674, 29901, 13, 9651, 903, 8758, 353, 5240, 866, 3609, 12376, 29898, 13, 18884, 1899, 29918, 4258, 3406, 29922, 19290, 29889, 657, 29898, 13, 462, 1678, 525, 6519, 29918, 4258, 3406, 742, 13, 462, 1678, 525, 1124, 597, 29912, 3069, 6177, 29912, 637, 6822, 9970, 29914, 29882, 431, 4286, 4830, 29898, 13, 462, 4706, 3495, 29922, 19290, 29889, 657, 877, 3069, 742, 525, 7640, 5477, 13, 462, 4706, 2011, 29922, 19290, 29889, 657, 877, 637, 742, 29871, 29946, 29946, 29946, 29946, 29897, 13, 462, 1678, 1723, 13, 18884, 10353, 13, 18884, 7429, 29918, 5030, 11614, 29922, 19290, 29889, 657, 29898, 13, 462, 1678, 525, 2783, 2859, 29918, 5030, 11614, 742, 13, 462, 1678, 426, 13, 462, 4706, 525, 15965, 1170, 2396, 426, 13, 462, 9651, 525, 8696, 8944, 2396, 525, 8696, 8944, 742, 13, 462, 9651, 525, 600, 2396, 525, 8696, 8944, 742, 13, 462, 9651, 525, 18114, 2396, 525, 18114, 742, 13, 462, 9651, 525, 27354, 2396, 525, 18114, 742, 13, 462, 9651, 525, 3608, 18114, 2396, 525, 18114, 29915, 13, 462, 4706, 500, 29889, 657, 29898, 13, 462, 9651, 1024, 29889, 13609, 3285, 13, 462, 9651, 525, 8696, 8944, 29915, 13, 462, 4706, 10353, 13, 462, 1678, 500, 13, 18884, 10353, 13, 18884, 4714, 29918, 10185, 29922, 19290, 29889, 657, 877, 15965, 29918, 10185, 5477, 13, 18884, 10166, 29922, 19290, 29889, 657, 877, 14701, 5477, 13, 18884, 3013, 29918, 284, 573, 29922, 19290, 29889, 657, 877, 17462, 29918, 284, 573, 742, 7700, 511, 13, 18884, 934, 29918, 4801, 3019, 29922, 19290, 29889, 657, 877, 1445, 29918, 4801, 3019, 5477, 13, 18884, 3987, 29922, 19290, 29889, 657, 877, 6768, 1495, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 903, 15965, 29918, 1037, 362, 29918, 710, 1845, 583, 353, 426, 13, 18884, 525, 600, 2396, 1583, 3032, 5675, 29918, 8696, 8944, 29892, 13, 18884, 525, 8696, 8944, 2396, 1583, 3032, 5675, 29918, 8696, 8944, 29892, 13, 18884, 525, 3608, 18114, 2396, 1583, 3032, 5675, 29918, 18114, 29892, 13, 18884, 525, 18114, 2396, 1583, 3032, 5675, 29918, 18114, 29892, 13, 18884, 525, 27354, 2396, 1583, 3032, 5675, 29918, 18114, 29892, 13, 9651, 500, 13, 13, 9651, 903, 1037, 1061, 353, 903, 15965, 29918, 1037, 362, 29918, 710, 1845, 583, 29889, 657, 29898, 13, 18884, 1024, 29889, 13609, 580, 13, 9651, 1723, 13, 13, 9651, 565, 451, 1246, 519, 7373, 1037, 1061, 1125, 13, 18884, 12020, 7865, 2392, 877, 25807, 29884, 3016, 287, 4714, 1134, 1495, 13, 13, 9651, 903, 8758, 353, 903, 1037, 1061, 29898, 1068, 19290, 29897, 13, 9651, 396, 903, 8758, 29889, 657, 877, 12717, 29901, 19465, 1495, 13, 13, 4706, 736, 903, 8758, 13, 13, 1678, 822, 903, 5675, 29918, 8696, 8944, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 736, 1856, 9465, 29889, 18654, 8944, 29898, 1068, 19290, 29897, 13, 13, 1678, 822, 903, 5675, 29918, 18114, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 903, 9465, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 9651, 2897, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 13, 9651, 525, 5924, 29915, 13, 4706, 1723, 13, 13, 4706, 903, 4381, 29918, 9465, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 9651, 903, 9465, 29918, 3972, 29892, 13, 9651, 525, 27433, 287, 3511, 29889, 8097, 29915, 13, 4706, 1723, 13, 13, 4706, 565, 10876, 29889, 12120, 29889, 27382, 2541, 877, 9389, 29374, 13, 9651, 903, 4381, 29918, 9465, 29918, 3972, 353, 320, 13, 18884, 8207, 3670, 29914, 3608, 29914, 18114, 29914, 27433, 287, 3511, 29915, 13, 13, 4706, 565, 2897, 29889, 2084, 29889, 9933, 7373, 4381, 29918, 9465, 29918, 3972, 1125, 13, 9651, 903, 9465, 29918, 2109, 29918, 1445, 29918, 2084, 353, 903, 4381, 29918, 9465, 29918, 3972, 13, 4706, 1683, 29901, 13, 9651, 903, 9465, 29918, 2109, 29918, 1445, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 18884, 903, 9465, 29918, 3972, 29892, 525, 27433, 287, 3511, 29915, 13, 9651, 1723, 13, 13, 4706, 2897, 29889, 21813, 1839, 29813, 29889, 18114, 29889, 9465, 2033, 353, 320, 13, 9651, 903, 9465, 29918, 2109, 29918, 1445, 29918, 2084, 13, 13, 4706, 736, 1856, 9465, 29889, 1451, 4871, 29898, 13, 9651, 903, 9465, 29918, 2109, 29918, 1445, 29918, 2084, 29892, 13, 9651, 3579, 19290, 13, 4706, 1723, 13, 2 ]
local_branching_data_generation.py
deepmind/neural_lns
2
81309
# Copyright 2021 DeepMind Technologies Limited. # # 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. # ============================================================================ """Library with functions required to generate LNS imitation data for one MIP.""" import collections as py_collections import os import pickle from typing import Any, Dict, Optional, Sequence, Text from absl import logging import ml_collections import numpy as np from neural_lns import data_utils from neural_lns import local_branching_expert from neural_lns import mip_utils # LP feature extraction needs to fully process the root node, so allow enough # time for that. MIN_SOLVE_TIME = 1800 # SCIP solving parameters SCIP_SOLVING_PARAMS = ml_collections.ConfigDict({ 'seed': 42, 'time_limit_seconds': 1800, 'relative_gap': 0 }) def get_incumbent( instance_name: Text, dataset: Text, solution_index: int) -> Optional[mip_utils.MPSolutionResponse]: """Tries to retrieve a solution for the MIP from corresponding pickle file.""" instance_path = os.path.join(dataset, instance_name) solutions = pickle.load(open(instance_path, 'rb')) if len(solutions) <= solution_index: raise ValueError( f'Fewer than {solution_index+1} solutions found for {instance_name}') else: solution = solutions[solution_index] return solution def get_flipped_vars(mip: mip_utils.MPModel, incumbent: mip_utils.MPSolutionResponse, improved: mip_utils.MPSolutionResponse, var_names: np.ndarray) -> np.ndarray: """Returns an array indicating which binary variables were flipped.""" is_flipped = {} # Note that non-binary variables are always assigned a 0. for idx, variable in enumerate(mip.variable): if (mip_utils.is_var_binary(variable) and round( incumbent.variable_value[idx]) != round(improved.variable_value[idx])): is_flipped[variable.name] = 1.0 else: is_flipped[variable.name] = 0.0 # Make sure the array has the variables in the order in which they appear in # the features. is_flipped_reordered = np.zeros(len(var_names), dtype=np.bool) for idx, var_name in enumerate(var_names): if 'Constant' in var_name.decode(): is_flipped_reordered[idx] = 0.0 else: is_flipped_reordered[idx] = is_flipped[var_name.decode()] return is_flipped_reordered def enhance_root_features( root_features: Dict[str, Any], incumbents: Sequence[Any], lp_sol: Optional[Any] = None ) -> Dict[str, Any]: """Adds incumbent var values and integer mask to the feature array. This accepts a list of up to NUM_PAST_INCUMBENTS past incumbents, sorted from most recent to least. Each incumbent will introduce two columns to the features: The first column represents the incumbent variable values, and the second one is a all-ones column indicating that the incumbent is present in the features. A final column is added to the end that masks out continuous variables. Args: root_features: Root features without incumbent information. incumbents: List of past incumbents, ordered by most recent first. lp_sol: solution to the LP relaxation of the LNS MIP solved by the expert. Returns: Updated features dict. """ if len(incumbents) > data_utils.NUM_PAST_INCUMBENTS: raise ValueError( f'The number of past incumbents is not sufficient: {len(incumbents)}') # Fill columns corresponding to incumbents for idx, incumbent in enumerate(incumbents): column = data_utils.NUM_ROOT_VARIABLE_FEATURES + 2 * idx incumbent_values = np.array( [incumbent[var_name.decode()] for var_name in root_features['variable_names']], dtype=root_features['variable_features'].dtype) # Override features column corresponding to incumbent values. root_features['variable_features'][:, column] = incumbent_values # Override features column corresponding to incumbent presence indicator. root_features['variable_features'][:, column + 1] = np.ones( len(incumbent_values)) if lp_sol is not None: lp_sol_values = np.array([ lp_sol[var_name.decode()] for var_name in root_features['variable_names'] ], dtype=root_features['variable_features'].dtype) lp_sol_column_index = data_utils.NUM_ROOT_VARIABLE_FEATURES + 2 * len( incumbents) root_features['variable_features'][:, lp_sol_column_index] = lp_sol_values # The last column masks out the continuous variables. integer_values_mask = np.ones(len(root_features['variable_names']), dtype=root_features['variable_features'].dtype) for idx, _ in enumerate(integer_values_mask): if idx not in root_features['all_integer_variable_indices']: integer_values_mask[idx] = 0.0 root_features['variable_features'][:, -1] = integer_values_mask return root_features def generate_data_for_instance( instance_name: Text, dataset: Text, neighbourhood_size: int = 20, percentage: bool = False, sequence_length: int = 10, add_incumbent_to_scip: bool = True, solution_index: int = 0, scip_params: ml_collections.ConfigDict = SCIP_SOLVING_PARAMS, num_var_features: int = data_utils.NUM_VARIABLE_FEATURES) -> int: """Generates data from which we learn to imitate the expert. This loads a MIP instance from a pickle file and generates the expert data. Args: instance_name: The name of the MIP instance. dataset: Dataset name that the instance belongs to. neighbourhood_size: Maximum Hamming dist to search. percentage: Whether neighbourhood_size should be treated as a percentage of total number of variables. sequence_length: How many consecutive improvements to do. add_incumbent_to_scip: Whether to feed SCIP the incumbent solution. solution_index: Which of the solutions to use as the first incumbent. scip_params: Dictionary of SCIP parameters to use. num_var_features: Number of features, NUM_VARIABLE_FEATURES or NUM_VARIABLE_FEATURES_LP. Returns: status: 1 if expert data generation was successful, 0 otherwise. """ mip = pickle.load(open(os.path.join(dataset, instance_name), 'rb')) if percentage: num_integer = 0 for var in mip.variable: if var.is_integer: num_integer += 1 neighbourhood_size = int(num_integer * neighbourhood_size / 100) try: incumbent = get_incumbent(instance_name, dataset, solution_index) except ValueError: logging.warning('No solution found for %s', instance_name) return 0 root_features = data_utils.get_features(mip, scip_params) if root_features is None or root_features['variable_features'] is None: logging.warning('No root features found for %s', instance_name) return 0 # Append dummy columns to the variable features, which is where we will put # the past incumbent solutions and the mask for assigned values at each step. num_extra_var_features = num_var_features - data_utils.NUM_ROOT_VARIABLE_FEATURES dummy_columns = np.zeros((root_features['variable_features'].shape[0], num_extra_var_features), dtype=root_features['variable_features'].dtype) if root_features is not None: root_features['variable_features'] = np.concatenate( [root_features['variable_features'], dummy_columns], axis=1) assert root_features['variable_features'].shape[ 1] == data_utils.NUM_VARIABLE_FEATURES status = 1 past_incumbents = py_collections.deque([incumbent]) for step in range(sequence_length): incumbent = past_incumbents[0] improved_sol = local_branching_expert.improve_solution( mip, incumbent, neighbourhood_size, scip_params, add_incumbent_to_scip=add_incumbent_to_scip) lp_sol = local_branching_expert.get_lns_lp_solution( mip, incumbent, neighbourhood_size, scip_params) if improved_sol is None: # In case of solver failure, print a warning and break. logging.warning('Solver failed for MIP %s at step %d ', instance_name, step) status = 0 break # Add features corresponding to the incumbent solution and integer mask. # NB This will overwrite the last column of the variable features. features = enhance_root_features(root_features, past_incumbents, lp_sol) # Figure out which variables were flipped between incumbent and improved. features['best_solution_labels'] = get_flipped_vars( mip, incumbent, improved_sol, features['variable_names']) # Add new incumbent to incumbent list, and prune to size if necessary past_incumbents.appendleft(improved_sol) if len(past_incumbents) > data_utils.NUM_PAST_INCUMBENTS: past_incumbents.pop() return status
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 21784, 29924, 513, 8364, 11763, 28873, 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, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 29871, 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, 1360, 13, 15945, 29908, 12284, 411, 3168, 3734, 304, 5706, 365, 3059, 527, 7018, 848, 363, 697, 341, 5690, 1213, 15945, 13, 13, 5215, 16250, 408, 11451, 29918, 29027, 13, 5215, 2897, 13, 5215, 5839, 280, 13, 3166, 19229, 1053, 3139, 29892, 360, 919, 29892, 28379, 29892, 922, 3910, 29892, 3992, 13, 13, 3166, 633, 2536, 1053, 12183, 13, 5215, 286, 29880, 29918, 29027, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 19677, 29918, 29880, 1983, 1053, 848, 29918, 13239, 13, 3166, 19677, 29918, 29880, 1983, 1053, 1887, 29918, 17519, 292, 29918, 735, 10700, 13, 3166, 19677, 29918, 29880, 1983, 1053, 286, 666, 29918, 13239, 13, 13, 13, 29937, 23671, 4682, 4805, 428, 4225, 304, 8072, 1889, 278, 3876, 2943, 29892, 577, 2758, 3307, 13, 29937, 931, 363, 393, 29889, 13, 16173, 29918, 29903, 5607, 12064, 29918, 15307, 353, 29871, 29896, 29947, 29900, 29900, 13, 13, 29937, 12314, 5690, 17069, 4128, 13, 7187, 5690, 29918, 29903, 5607, 29963, 4214, 29918, 16320, 29909, 4345, 353, 286, 29880, 29918, 29027, 29889, 3991, 21533, 3319, 13, 1678, 525, 26776, 2396, 29871, 29946, 29906, 29892, 13, 1678, 525, 2230, 29918, 13400, 29918, 23128, 2396, 29871, 29896, 29947, 29900, 29900, 29892, 13, 1678, 525, 22925, 29918, 29887, 481, 2396, 29871, 29900, 13, 1800, 13, 13, 13, 1753, 679, 29918, 3742, 3774, 296, 29898, 13, 1678, 2777, 29918, 978, 29901, 3992, 29892, 13, 1678, 8783, 29901, 3992, 29892, 13, 1678, 1650, 29918, 2248, 29901, 938, 29897, 1599, 28379, 29961, 29885, 666, 29918, 13239, 29889, 3580, 13296, 918, 5103, 5387, 13, 29871, 9995, 29911, 2722, 304, 10563, 263, 1650, 363, 278, 341, 5690, 515, 6590, 5839, 280, 934, 1213, 15945, 13, 29871, 2777, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 24713, 29892, 2777, 29918, 978, 29897, 13, 29871, 6851, 353, 5839, 280, 29889, 1359, 29898, 3150, 29898, 8758, 29918, 2084, 29892, 525, 6050, 8785, 13, 13, 29871, 565, 7431, 29898, 2929, 17925, 29897, 5277, 1650, 29918, 2248, 29901, 13, 1678, 12020, 7865, 2392, 29898, 13, 4706, 285, 29915, 8263, 556, 1135, 426, 2929, 918, 29918, 2248, 29974, 29896, 29913, 6851, 1476, 363, 426, 8758, 29918, 978, 29913, 1495, 13, 29871, 1683, 29901, 13, 1678, 1650, 353, 6851, 29961, 2929, 918, 29918, 2248, 29962, 13, 13, 29871, 736, 1650, 13, 13, 13, 1753, 679, 29918, 20157, 2986, 29918, 16908, 29898, 29885, 666, 29901, 286, 666, 29918, 13239, 29889, 3580, 3195, 29892, 13, 462, 268, 5528, 3774, 296, 29901, 286, 666, 29918, 13239, 29889, 3580, 13296, 918, 5103, 29892, 13, 462, 268, 16710, 29901, 286, 666, 29918, 13239, 29889, 3580, 13296, 918, 5103, 29892, 13, 462, 268, 722, 29918, 7039, 29901, 7442, 29889, 299, 2378, 29897, 1599, 7442, 29889, 299, 2378, 29901, 13, 29871, 9995, 11609, 29879, 385, 1409, 23941, 607, 7581, 3651, 892, 285, 492, 2986, 1213, 15945, 13, 29871, 338, 29918, 20157, 2986, 353, 6571, 13, 13, 29871, 396, 3940, 393, 1661, 29899, 19541, 3651, 526, 2337, 9859, 263, 29871, 29900, 29889, 13, 29871, 363, 22645, 29892, 2286, 297, 26985, 29898, 29885, 666, 29889, 11918, 1125, 13, 1678, 565, 313, 29885, 666, 29918, 13239, 29889, 275, 29918, 1707, 29918, 19541, 29898, 11918, 29897, 322, 4513, 29898, 13, 4706, 5528, 3774, 296, 29889, 11918, 29918, 1767, 29961, 13140, 2314, 2804, 4513, 29898, 326, 771, 1490, 29889, 11918, 29918, 1767, 29961, 13140, 12622, 29901, 13, 418, 338, 29918, 20157, 2986, 29961, 11918, 29889, 978, 29962, 353, 29871, 29896, 29889, 29900, 13, 1678, 1683, 29901, 13, 418, 338, 29918, 20157, 2986, 29961, 11918, 29889, 978, 29962, 353, 29871, 29900, 29889, 29900, 13, 13, 29871, 396, 8561, 1854, 278, 1409, 756, 278, 3651, 297, 278, 1797, 297, 607, 896, 2615, 297, 13, 29871, 396, 278, 5680, 29889, 13, 29871, 338, 29918, 20157, 2986, 29918, 276, 21693, 353, 7442, 29889, 3298, 359, 29898, 2435, 29898, 1707, 29918, 7039, 511, 26688, 29922, 9302, 29889, 11227, 29897, 13, 29871, 363, 22645, 29892, 722, 29918, 978, 297, 26985, 29898, 1707, 29918, 7039, 1125, 13, 1678, 565, 525, 12075, 424, 29915, 297, 722, 29918, 978, 29889, 13808, 7295, 13, 418, 338, 29918, 20157, 2986, 29918, 276, 21693, 29961, 13140, 29962, 353, 29871, 29900, 29889, 29900, 13, 1678, 1683, 29901, 13, 418, 338, 29918, 20157, 2986, 29918, 276, 21693, 29961, 13140, 29962, 353, 338, 29918, 20157, 2986, 29961, 1707, 29918, 978, 29889, 13808, 580, 29962, 13, 13, 29871, 736, 338, 29918, 20157, 2986, 29918, 276, 21693, 13, 13, 13, 1753, 26371, 749, 29918, 4632, 29918, 22100, 29898, 13, 1678, 3876, 29918, 22100, 29901, 360, 919, 29961, 710, 29892, 3139, 1402, 13, 1678, 5528, 3774, 1237, 29901, 922, 3910, 29961, 10773, 1402, 13, 1678, 301, 29886, 29918, 2929, 29901, 28379, 29961, 10773, 29962, 353, 6213, 13, 1678, 1723, 1599, 360, 919, 29961, 710, 29892, 3139, 5387, 13, 29871, 9995, 2528, 29879, 5528, 3774, 296, 722, 1819, 322, 6043, 11105, 304, 278, 4682, 1409, 29889, 13, 13, 29871, 910, 21486, 263, 1051, 310, 701, 304, 28019, 29918, 7228, 1254, 29918, 1177, 29907, 5005, 29933, 3919, 29903, 4940, 5528, 3774, 1237, 29892, 13, 29871, 12705, 515, 1556, 7786, 304, 3203, 29889, 7806, 5528, 3774, 296, 674, 14944, 1023, 4341, 13, 29871, 304, 278, 5680, 29901, 450, 937, 1897, 11524, 278, 5528, 3774, 296, 2286, 1819, 29892, 13, 29871, 322, 278, 1473, 697, 338, 263, 599, 29899, 2873, 1897, 23941, 393, 278, 5528, 3774, 296, 338, 13, 29871, 2198, 297, 278, 5680, 29889, 13, 13, 29871, 319, 2186, 1897, 338, 2715, 304, 278, 1095, 393, 11105, 29879, 714, 9126, 3651, 29889, 13, 13, 29871, 826, 3174, 29901, 13, 1678, 3876, 29918, 22100, 29901, 28272, 5680, 1728, 5528, 3774, 296, 2472, 29889, 13, 1678, 5528, 3774, 1237, 29901, 2391, 310, 4940, 5528, 3774, 1237, 29892, 10372, 491, 1556, 7786, 937, 29889, 13, 1678, 301, 29886, 29918, 2929, 29901, 1650, 304, 278, 23671, 26681, 362, 310, 278, 365, 3059, 341, 5690, 7484, 491, 278, 17924, 29889, 13, 13, 29871, 16969, 29901, 13, 1678, 25723, 5680, 9657, 29889, 13, 29871, 9995, 13, 29871, 565, 7431, 29898, 3742, 3774, 1237, 29897, 1405, 848, 29918, 13239, 29889, 13967, 29918, 7228, 1254, 29918, 1177, 29907, 5005, 29933, 3919, 29903, 29901, 13, 1678, 12020, 7865, 2392, 29898, 13, 4706, 285, 29915, 1576, 1353, 310, 4940, 5528, 3774, 1237, 338, 451, 8002, 29901, 426, 2435, 29898, 3742, 3774, 1237, 2915, 1495, 13, 13, 29871, 396, 383, 453, 4341, 6590, 304, 5528, 3774, 1237, 13, 29871, 363, 22645, 29892, 5528, 3774, 296, 297, 26985, 29898, 3742, 3774, 1237, 1125, 13, 1678, 1897, 353, 848, 29918, 13239, 29889, 13967, 29918, 21289, 29918, 26865, 29902, 6181, 29918, 16359, 1299, 11499, 29903, 718, 29871, 29906, 334, 22645, 13, 1678, 5528, 3774, 296, 29918, 5975, 353, 7442, 29889, 2378, 29898, 13, 4706, 518, 3742, 3774, 296, 29961, 1707, 29918, 978, 29889, 13808, 580, 29962, 13, 308, 363, 722, 29918, 978, 297, 3876, 29918, 22100, 1839, 11918, 29918, 7039, 2033, 1402, 13, 4706, 26688, 29922, 4632, 29918, 22100, 1839, 11918, 29918, 22100, 13359, 29881, 1853, 29897, 13, 13, 1678, 396, 6811, 2426, 5680, 1897, 6590, 304, 5528, 3774, 296, 1819, 29889, 13, 1678, 3876, 29918, 22100, 1839, 11918, 29918, 22100, 2033, 7503, 29892, 1897, 29962, 353, 5528, 3774, 296, 29918, 5975, 13, 13, 1678, 396, 6811, 2426, 5680, 1897, 6590, 304, 5528, 3774, 296, 10122, 27717, 29889, 13, 1678, 3876, 29918, 22100, 1839, 11918, 29918, 22100, 2033, 7503, 29892, 1897, 718, 29871, 29896, 29962, 353, 7442, 29889, 2873, 29898, 13, 4706, 7431, 29898, 3742, 3774, 296, 29918, 5975, 876, 13, 13, 29871, 565, 301, 29886, 29918, 2929, 338, 451, 6213, 29901, 13, 1678, 301, 29886, 29918, 2929, 29918, 5975, 353, 7442, 29889, 2378, 4197, 13, 4706, 301, 29886, 29918, 2929, 29961, 1707, 29918, 978, 29889, 13808, 580, 29962, 13, 4706, 363, 722, 29918, 978, 297, 3876, 29918, 22100, 1839, 11918, 29918, 7039, 2033, 13, 1678, 21251, 13, 462, 632, 26688, 29922, 4632, 29918, 22100, 1839, 11918, 29918, 22100, 13359, 29881, 1853, 29897, 13, 13, 1678, 301, 29886, 29918, 2929, 29918, 4914, 29918, 2248, 353, 848, 29918, 13239, 29889, 13967, 29918, 21289, 29918, 26865, 29902, 6181, 29918, 16359, 1299, 11499, 29903, 718, 29871, 29906, 334, 7431, 29898, 13, 4706, 5528, 3774, 1237, 29897, 13, 1678, 3876, 29918, 22100, 1839, 11918, 29918, 22100, 2033, 7503, 29892, 301, 29886, 29918, 2929, 29918, 4914, 29918, 2248, 29962, 353, 301, 29886, 29918, 2929, 29918, 5975, 13, 13, 29871, 396, 450, 1833, 1897, 11105, 29879, 714, 278, 9126, 3651, 29889, 13, 29871, 6043, 29918, 5975, 29918, 13168, 353, 7442, 29889, 2873, 29898, 2435, 29898, 4632, 29918, 22100, 1839, 11918, 29918, 7039, 2033, 511, 13, 462, 18884, 26688, 29922, 4632, 29918, 22100, 1839, 11918, 29918, 22100, 13359, 29881, 1853, 29897, 13, 29871, 363, 22645, 29892, 903, 297, 26985, 29898, 16031, 29918, 5975, 29918, 13168, 1125, 13, 1678, 565, 22645, 451, 297, 3876, 29918, 22100, 1839, 497, 29918, 16031, 29918, 11918, 29918, 513, 1575, 2033, 29901, 13, 418, 6043, 29918, 5975, 29918, 13168, 29961, 13140, 29962, 353, 29871, 29900, 29889, 29900, 13, 13, 29871, 3876, 29918, 22100, 1839, 11918, 29918, 22100, 2033, 7503, 29892, 448, 29896, 29962, 353, 6043, 29918, 5975, 29918, 13168, 13, 13, 29871, 736, 3876, 29918, 22100, 13, 13, 13, 1753, 5706, 29918, 1272, 29918, 1454, 29918, 8758, 29898, 13, 1678, 2777, 29918, 978, 29901, 3992, 29892, 13, 1678, 8783, 29901, 3992, 29892, 13, 1678, 29643, 29918, 2311, 29901, 938, 353, 29871, 29906, 29900, 29892, 13, 1678, 19649, 29901, 6120, 353, 7700, 29892, 13, 1678, 5665, 29918, 2848, 29901, 938, 353, 29871, 29896, 29900, 29892, 13, 1678, 788, 29918, 3742, 3774, 296, 29918, 517, 29918, 29879, 7334, 29901, 6120, 353, 5852, 29892, 13, 1678, 1650, 29918, 2248, 29901, 938, 353, 29871, 29900, 29892, 13, 1678, 4560, 29886, 29918, 7529, 29901, 286, 29880, 29918, 29027, 29889, 3991, 21533, 353, 12314, 5690, 29918, 29903, 5607, 29963, 4214, 29918, 16320, 29909, 4345, 29892, 13, 1678, 954, 29918, 1707, 29918, 22100, 29901, 938, 353, 848, 29918, 13239, 29889, 13967, 29918, 26865, 29902, 6181, 29918, 16359, 1299, 11499, 29903, 29897, 1599, 938, 29901, 13, 29871, 9995, 5631, 1078, 848, 515, 607, 591, 5110, 304, 527, 10388, 278, 17924, 29889, 13, 13, 29871, 910, 15376, 263, 341, 5690, 2777, 515, 263, 5839, 280, 934, 322, 16785, 278, 17924, 848, 29889, 13, 13, 29871, 826, 3174, 29901, 13, 1678, 2777, 29918, 978, 29901, 450, 1024, 310, 278, 341, 5690, 2777, 29889, 13, 1678, 8783, 29901, 13373, 24541, 1024, 393, 278, 2777, 14393, 304, 29889, 13, 1678, 29643, 29918, 2311, 29901, 5918, 12539, 7904, 4056, 1320, 304, 2740, 29889, 13, 1678, 19649, 29901, 26460, 29643, 29918, 2311, 881, 367, 14914, 408, 263, 19649, 13, 18884, 310, 3001, 1353, 310, 3651, 29889, 13, 1678, 5665, 29918, 2848, 29901, 1128, 1784, 18942, 28473, 304, 437, 29889, 13, 1678, 788, 29918, 3742, 3774, 296, 29918, 517, 29918, 29879, 7334, 29901, 26460, 304, 8343, 12314, 5690, 278, 5528, 3774, 296, 1650, 29889, 13, 1678, 1650, 29918, 2248, 29901, 8449, 310, 278, 6851, 304, 671, 408, 278, 937, 5528, 3774, 296, 29889, 13, 1678, 4560, 29886, 29918, 7529, 29901, 13343, 310, 12314, 5690, 4128, 304, 671, 29889, 13, 1678, 954, 29918, 1707, 29918, 22100, 29901, 9681, 310, 5680, 29892, 28019, 29918, 26865, 29902, 6181, 29918, 16359, 1299, 11499, 29903, 470, 13, 462, 418, 28019, 29918, 26865, 29902, 6181, 29918, 16359, 1299, 11499, 29903, 29918, 13208, 29889, 13, 13, 29871, 16969, 29901, 13, 1678, 4660, 29901, 29871, 29896, 565, 17924, 848, 12623, 471, 9150, 29892, 29871, 29900, 6467, 29889, 13, 29871, 9995, 13, 29871, 286, 666, 353, 5839, 280, 29889, 1359, 29898, 3150, 29898, 359, 29889, 2084, 29889, 7122, 29898, 24713, 29892, 2777, 29918, 978, 511, 525, 6050, 8785, 13, 29871, 565, 19649, 29901, 13, 1678, 954, 29918, 16031, 353, 29871, 29900, 13, 1678, 363, 722, 297, 286, 666, 29889, 11918, 29901, 13, 418, 565, 722, 29889, 275, 29918, 16031, 29901, 13, 4706, 954, 29918, 16031, 4619, 29871, 29896, 13, 1678, 29643, 29918, 2311, 353, 938, 29898, 1949, 29918, 16031, 334, 29643, 29918, 2311, 847, 29871, 29896, 29900, 29900, 29897, 13, 13, 29871, 1018, 29901, 13, 1678, 5528, 3774, 296, 353, 679, 29918, 3742, 3774, 296, 29898, 8758, 29918, 978, 29892, 8783, 29892, 1650, 29918, 2248, 29897, 13, 29871, 5174, 7865, 2392, 29901, 13, 1678, 12183, 29889, 27392, 877, 3782, 1650, 1476, 363, 1273, 29879, 742, 2777, 29918, 978, 29897, 13, 1678, 736, 29871, 29900, 13, 13, 29871, 3876, 29918, 22100, 353, 848, 29918, 13239, 29889, 657, 29918, 22100, 29898, 29885, 666, 29892, 4560, 29886, 29918, 7529, 29897, 13, 29871, 565, 3876, 29918, 22100, 338, 6213, 470, 3876, 29918, 22100, 1839, 11918, 29918, 22100, 2033, 338, 6213, 29901, 13, 1678, 12183, 29889, 27392, 877, 3782, 3876, 5680, 1476, 363, 1273, 29879, 742, 2777, 29918, 978, 29897, 13, 1678, 736, 29871, 29900, 13, 13, 29871, 396, 22871, 20254, 4341, 304, 278, 2286, 5680, 29892, 607, 338, 988, 591, 674, 1925, 13, 29871, 396, 278, 4940, 5528, 3774, 296, 6851, 322, 278, 11105, 363, 9859, 1819, 472, 1269, 4331, 29889, 13, 29871, 954, 29918, 17833, 29918, 1707, 29918, 22100, 353, 954, 29918, 1707, 29918, 22100, 448, 848, 29918, 13239, 29889, 13967, 29918, 21289, 29918, 26865, 29902, 6181, 29918, 16359, 1299, 11499, 29903, 13, 29871, 20254, 29918, 13099, 353, 7442, 29889, 3298, 359, 3552, 4632, 29918, 22100, 1839, 11918, 29918, 22100, 13359, 12181, 29961, 29900, 1402, 13, 462, 9651, 954, 29918, 17833, 29918, 1707, 29918, 22100, 511, 13, 462, 965, 26688, 29922, 4632, 29918, 22100, 1839, 11918, 29918, 22100, 13359, 29881, 1853, 29897, 13, 13, 29871, 565, 3876, 29918, 22100, 338, 451, 6213, 29901, 13, 1678, 3876, 29918, 22100, 1839, 11918, 29918, 22100, 2033, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 13, 4706, 518, 4632, 29918, 22100, 1839, 11918, 29918, 22100, 7464, 20254, 29918, 13099, 1402, 9685, 29922, 29896, 29897, 13, 13, 1678, 4974, 3876, 29918, 22100, 1839, 11918, 29918, 22100, 13359, 12181, 29961, 13, 308, 29896, 29962, 1275, 848, 29918, 13239, 29889, 13967, 29918, 26865, 29902, 6181, 29918, 16359, 1299, 11499, 29903, 13, 13, 29871, 4660, 353, 29871, 29896, 13, 29871, 4940, 29918, 3742, 3774, 1237, 353, 11451, 29918, 29027, 29889, 311, 802, 4197, 3742, 3774, 296, 2314, 13, 13, 29871, 363, 4331, 297, 3464, 29898, 16506, 29918, 2848, 1125, 13, 1678, 5528, 3774, 296, 353, 4940, 29918, 3742, 3774, 1237, 29961, 29900, 29962, 13, 1678, 16710, 29918, 2929, 353, 1887, 29918, 17519, 292, 29918, 735, 10700, 29889, 326, 771, 345, 29918, 2929, 918, 29898, 13, 4706, 286, 666, 29892, 5528, 3774, 296, 29892, 29643, 29918, 2311, 29892, 4560, 29886, 29918, 7529, 29892, 13, 4706, 788, 29918, 3742, 3774, 296, 29918, 517, 29918, 29879, 7334, 29922, 1202, 29918, 3742, 3774, 296, 29918, 517, 29918, 29879, 7334, 29897, 13, 13, 1678, 301, 29886, 29918, 2929, 353, 1887, 29918, 17519, 292, 29918, 735, 10700, 29889, 657, 29918, 29880, 1983, 29918, 22833, 29918, 2929, 918, 29898, 13, 4706, 286, 666, 29892, 5528, 3774, 296, 29892, 29643, 29918, 2311, 29892, 4560, 29886, 29918, 7529, 29897, 13, 13, 1678, 565, 16710, 29918, 2929, 338, 6213, 29901, 13, 418, 396, 512, 1206, 310, 899, 369, 10672, 29892, 1596, 263, 9177, 322, 2867, 29889, 13, 418, 12183, 29889, 27392, 877, 13296, 369, 5229, 363, 341, 5690, 1273, 29879, 472, 4331, 1273, 29881, 13420, 13, 462, 418, 2777, 29918, 978, 29892, 4331, 29897, 13, 418, 4660, 353, 29871, 29900, 13, 418, 2867, 13, 13, 1678, 396, 3462, 5680, 6590, 304, 278, 5528, 3774, 296, 1650, 322, 6043, 11105, 29889, 13, 1678, 396, 405, 29933, 910, 674, 26556, 278, 1833, 1897, 310, 278, 2286, 5680, 29889, 13, 1678, 5680, 353, 26371, 749, 29918, 4632, 29918, 22100, 29898, 4632, 29918, 22100, 29892, 4940, 29918, 3742, 3774, 1237, 29892, 301, 29886, 29918, 2929, 29897, 13, 13, 1678, 396, 11479, 714, 607, 3651, 892, 285, 492, 2986, 1546, 5528, 3774, 296, 322, 16710, 29889, 13, 1678, 5680, 1839, 13318, 29918, 2929, 918, 29918, 21134, 2033, 353, 679, 29918, 20157, 2986, 29918, 16908, 29898, 13, 4706, 286, 666, 29892, 5528, 3774, 296, 29892, 16710, 29918, 2929, 29892, 5680, 1839, 11918, 29918, 7039, 11287, 13, 13, 1678, 396, 3462, 716, 5528, 3774, 296, 304, 5528, 3774, 296, 1051, 29892, 322, 544, 1540, 304, 2159, 565, 5181, 13, 1678, 4940, 29918, 3742, 3774, 1237, 29889, 4397, 1563, 29898, 326, 771, 1490, 29918, 2929, 29897, 13, 1678, 565, 7431, 29898, 29886, 579, 29918, 3742, 3774, 1237, 29897, 1405, 848, 29918, 13239, 29889, 13967, 29918, 7228, 1254, 29918, 1177, 29907, 5005, 29933, 3919, 29903, 29901, 13, 418, 4940, 29918, 3742, 3774, 1237, 29889, 7323, 580, 13, 13, 29871, 736, 4660, 13, 2 ]
yocto/poky/bitbake/lib/bb/ui/crumbs/hobcolor.py
jxtxinbing/ops-build
16
23934
<filename>yocto/poky/bitbake/lib/bb/ui/crumbs/hobcolor.py # # BitBake Graphical GTK User Interface # # Copyright (C) 2012 Intel Corporation # # Authored by <NAME> <<EMAIL>> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. class HobColors: WHITE = "#ffffff" PALE_GREEN = "#aaffaa" ORANGE = "#eb8e68" PALE_RED = "#ffaaaa" GRAY = "#aaaaaa" LIGHT_GRAY = "#dddddd" SLIGHT_DARK = "#5f5f5f" DARK = "#3c3b37" BLACK = "#000000" PALE_BLUE = "#53b8ff" DEEP_RED = "#aa3e3e" KHAKI = "#fff68f" OK = WHITE RUNNING = PALE_GREEN WARNING = ORANGE ERROR = PALE_RED
[ 1, 529, 9507, 29958, 9029, 312, 29877, 29914, 29886, 554, 29891, 29914, 2966, 29890, 1296, 29914, 1982, 29914, 1327, 29914, 1481, 29914, 7283, 3774, 29879, 29914, 29882, 711, 2780, 29889, 2272, 13, 29937, 13, 29937, 18531, 29933, 1296, 12367, 936, 21342, 29968, 4911, 25796, 13, 29937, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29906, 4706, 18555, 15025, 13, 29937, 13, 29937, 13361, 287, 491, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 13, 29937, 910, 1824, 338, 3889, 7047, 29936, 366, 508, 2654, 391, 2666, 372, 322, 29914, 272, 6623, 13, 29937, 372, 1090, 278, 4958, 310, 278, 15143, 4593, 5236, 19245, 1873, 29871, 29906, 408, 13, 29937, 6369, 491, 278, 12362, 18540, 10606, 29889, 13, 29937, 13, 29937, 910, 1824, 338, 13235, 297, 278, 4966, 393, 372, 674, 367, 5407, 29892, 13, 29937, 541, 399, 1806, 8187, 2692, 13764, 29979, 399, 1718, 29934, 13566, 29979, 29936, 1728, 1584, 278, 2411, 2957, 1370, 21867, 29891, 310, 13, 29937, 341, 1001, 3210, 13566, 2882, 6227, 11937, 470, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 29871, 2823, 278, 13, 29937, 15143, 4593, 5236, 19245, 363, 901, 4902, 29889, 13, 29937, 13, 29937, 887, 881, 505, 4520, 263, 3509, 310, 278, 15143, 4593, 5236, 19245, 3412, 13, 29937, 411, 445, 1824, 29936, 565, 451, 29892, 2436, 304, 278, 12362, 18540, 10606, 29892, 9266, 1696, 13, 29937, 29871, 29945, 29896, 21504, 7103, 29892, 29008, 386, 383, 10102, 29892, 12115, 29892, 14861, 29871, 29900, 29906, 29896, 29896, 29900, 29899, 29896, 29941, 29900, 29896, 8278, 29889, 13, 13, 1990, 25302, 1625, 943, 29901, 13, 1678, 12317, 9094, 4706, 353, 12305, 17156, 600, 29908, 13, 1678, 17687, 1307, 29918, 29954, 1525, 1430, 259, 353, 12305, 29874, 3470, 7340, 29908, 13, 1678, 6323, 24336, 539, 353, 12305, 774, 29947, 29872, 29953, 29947, 29908, 13, 1678, 17687, 1307, 29918, 19386, 268, 353, 12305, 600, 27137, 29908, 13, 1678, 402, 22800, 308, 353, 12305, 27137, 7340, 29908, 13, 1678, 365, 22530, 29918, 29954, 22800, 259, 353, 12305, 1289, 1289, 1289, 29908, 13, 1678, 317, 5265, 29954, 3912, 29918, 29928, 1718, 29968, 29871, 353, 12305, 29945, 29888, 29945, 29888, 29945, 29888, 29908, 13, 1678, 360, 1718, 29968, 308, 353, 12305, 29941, 29883, 29941, 29890, 29941, 29955, 29908, 13, 1678, 350, 29931, 11375, 4706, 353, 12305, 29900, 29900, 29900, 29900, 29900, 29900, 29908, 13, 1678, 17687, 1307, 29918, 13367, 4462, 1678, 353, 12305, 29945, 29941, 29890, 29947, 600, 29908, 13, 1678, 5012, 15488, 29918, 19386, 268, 353, 12305, 7340, 29941, 29872, 29941, 29872, 29908, 13, 1678, 476, 15715, 29968, 29902, 4706, 353, 12305, 18725, 29953, 29947, 29888, 29908, 13, 13, 1678, 9280, 353, 12317, 9094, 13, 1678, 27694, 29940, 4214, 353, 17687, 1307, 29918, 29954, 1525, 1430, 13, 1678, 399, 25614, 353, 6323, 24336, 13, 1678, 14431, 353, 17687, 1307, 29918, 19386, 13, 2 ]
tests/system_tests/rest_api.py
Curtis241/taskmgr
0
186759
<gh_stars>0 import requests class RequestBody: def __init__(self, name: str, value1: str = None, value2: str = None): self.__name = name self.__value1 = value1 self.__value2 = value2 def __iter__(self): yield "name", self.__name if self.__value1 is not None: yield "value1", self.__value1 if self.__value2 is not None: yield "value2", self.__value2 class TaskModel: def __init__(self, text: str, project: str, label: str, date_expression: str): self.index = None self.text = text self.project = project self.label = label self.date_expression = date_expression def __iter__(self): if self.index is not None: yield "index", self.index yield "text", self.text yield "project", self.project yield "label", self.label yield "date_expression", self.date_expression class RestApi: def __init__(self): self.__basename = "http://localhost:8000/" def __build_path(self, path: str) -> str: return f"{self.__basename}{path}" @staticmethod def __parse_response(response: requests.Response): response.raise_for_status() if response.status_code in [200, 201]: return response.json() def get(self, path: str) -> dict: with requests.Session() as session: response = session.get(self.__build_path(path)) return self.__parse_response(response) def post(self, path: str, data: dict): with requests.Session() as session: response = session.post(self.__build_path(path), json=data) return self.__parse_response(response) def put(self, path: str, data: dict = None): with requests.Session() as session: if data: response = session.put(self.__build_path(path), json=data) else: response = session.put(self.__build_path(path)) return self.__parse_response(response) def delete(self, path: str): with requests.Session() as session: response = session.delete(self.__build_path(path)) return self.__parse_response(response) class Project(RestApi): def __init__(self): super().__init__() def get_list(self) -> dict: return self.put("unique/", dict(RequestBody("project"))) class Label(RestApi): def __init__(self): super().__init__() def get_list(self) -> dict: return self.put("unique/", dict(RequestBody("label"))) class Task(RestApi): def __init__(self): super().__init__() def get_task(self, index: str) -> dict: return self.get(f"tasks/task/{index}") def delete_task(self, uuid: str) -> dict: return self.delete(f"tasks/task/delete/{uuid}") def undelete_task(self, uuid: str) -> dict: return self.delete(f"tasks/task/undelete/{uuid}") def complete_task(self, uuid: str) -> dict: return self.put(f"tasks/task/complete/{uuid}") def incomplete_task(self, uuid: str) -> dict: return self.put(f"tasks/task/incomplete/{uuid}") class Tasks(RestApi): def __init__(self): super().__init__() self.__group_path = "group/" self.__count_path = "count/" self.__filter_path = "filter/" def get_all(self) -> dict: return self.get("tasks") def add(self, text: str, project: str, label: str, date_expression: str) -> dict: return self.post("tasks", dict(TaskModel(text, project, label, date_expression))) def edit(self, index: str, text: str, project: str, label: str, date_expression: str) -> dict: model = TaskModel(text, project, label, date_expression) model.index = index return self.put("tasks", dict(model)) def remove_all(self) -> dict: return self.delete("tasks") def reschedule(self): self.put("reschedule/") def group_by_label(self): return self.put(self.__group_path, dict(RequestBody("label"))) def group_by_project(self): return self.put(self.__group_path, dict(RequestBody("project"))) def group_by_due_date(self): return self.put(self.__group_path, dict(RequestBody("due_date"))) def count_all(self) -> dict: return self.get("count_all") def count_by_due_date(self, due_date: str) -> dict: return self.put(self.__count_path, dict(RequestBody("due_date", due_date))) def count_by_project(self, project_name: str) -> dict: return self.put(self.__count_path, dict(RequestBody("project", project_name))) def count_by_due_date_range(self, min_date: str, max_date: str) -> dict: request_body = dict(RequestBody("due_date_range", min_date, max_date)) return self.put(self.__count_path, request_body) def filter_by_project(self, project_name: str) -> dict: return self.put(self.__filter_path, dict(RequestBody("project", project_name))) def filter_by_label(self, label: str) -> dict: return self.put(self.__filter_path, dict(RequestBody("label", label))) def filter_by_text(self, text: str) -> dict: return self.put(self.__filter_path, dict(RequestBody("text", text))) def filter_by_due_date(self, due_date: str) -> dict: return self.put(self.__filter_path, dict(RequestBody("due_date", due_date))) def filter_by_status(self, status: str) -> dict: return self.put(self.__filter_path, dict(RequestBody("status", status))) def filter_by_due_date_range(self, min_date: str, max_date: str) -> dict: return self.put(self.__filter_path, dict(RequestBody("due_date_range", min_date, max_date)))
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 7274, 13, 13, 13, 1990, 10729, 8434, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29901, 851, 29892, 995, 29896, 29901, 851, 353, 6213, 29892, 995, 29906, 29901, 851, 353, 6213, 1125, 13, 4706, 1583, 17255, 978, 353, 1024, 13, 4706, 1583, 17255, 1767, 29896, 353, 995, 29896, 13, 4706, 1583, 17255, 1767, 29906, 353, 995, 29906, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 7709, 376, 978, 613, 1583, 17255, 978, 13, 13, 4706, 565, 1583, 17255, 1767, 29896, 338, 451, 6213, 29901, 13, 9651, 7709, 376, 1767, 29896, 613, 1583, 17255, 1767, 29896, 13, 13, 4706, 565, 1583, 17255, 1767, 29906, 338, 451, 6213, 29901, 13, 9651, 7709, 376, 1767, 29906, 613, 1583, 17255, 1767, 29906, 13, 13, 13, 1990, 9330, 3195, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1426, 29901, 851, 29892, 2060, 29901, 851, 29892, 3858, 29901, 851, 29892, 2635, 29918, 17471, 29901, 851, 1125, 13, 4706, 1583, 29889, 2248, 353, 6213, 13, 4706, 1583, 29889, 726, 353, 1426, 13, 4706, 1583, 29889, 4836, 353, 2060, 13, 4706, 1583, 29889, 1643, 353, 3858, 13, 4706, 1583, 29889, 1256, 29918, 17471, 353, 2635, 29918, 17471, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 565, 1583, 29889, 2248, 338, 451, 6213, 29901, 13, 9651, 7709, 376, 2248, 613, 1583, 29889, 2248, 13, 13, 4706, 7709, 376, 726, 613, 1583, 29889, 726, 13, 4706, 7709, 376, 4836, 613, 1583, 29889, 4836, 13, 4706, 7709, 376, 1643, 613, 1583, 29889, 1643, 13, 4706, 7709, 376, 1256, 29918, 17471, 613, 1583, 29889, 1256, 29918, 17471, 13, 13, 13, 1990, 11654, 11713, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 17255, 6500, 3871, 353, 376, 1124, 597, 7640, 29901, 29947, 29900, 29900, 29900, 12975, 13, 13, 1678, 822, 4770, 4282, 29918, 2084, 29898, 1311, 29892, 2224, 29901, 851, 29897, 1599, 851, 29901, 13, 4706, 736, 285, 29908, 29912, 1311, 17255, 6500, 3871, 1157, 2084, 5038, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 4770, 5510, 29918, 5327, 29898, 5327, 29901, 7274, 29889, 5103, 1125, 13, 4706, 2933, 29889, 22692, 29918, 1454, 29918, 4882, 580, 13, 4706, 565, 2933, 29889, 4882, 29918, 401, 297, 518, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29896, 5387, 13, 9651, 736, 2933, 29889, 3126, 580, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 2224, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 411, 7274, 29889, 7317, 580, 408, 4867, 29901, 13, 9651, 2933, 353, 4867, 29889, 657, 29898, 1311, 17255, 4282, 29918, 2084, 29898, 2084, 876, 13, 9651, 736, 1583, 17255, 5510, 29918, 5327, 29898, 5327, 29897, 13, 13, 1678, 822, 1400, 29898, 1311, 29892, 2224, 29901, 851, 29892, 848, 29901, 9657, 1125, 13, 4706, 411, 7274, 29889, 7317, 580, 408, 4867, 29901, 13, 9651, 2933, 353, 4867, 29889, 2490, 29898, 1311, 17255, 4282, 29918, 2084, 29898, 2084, 511, 4390, 29922, 1272, 29897, 13, 9651, 736, 1583, 17255, 5510, 29918, 5327, 29898, 5327, 29897, 13, 13, 1678, 822, 1925, 29898, 1311, 29892, 2224, 29901, 851, 29892, 848, 29901, 9657, 353, 6213, 1125, 13, 4706, 411, 7274, 29889, 7317, 580, 408, 4867, 29901, 13, 9651, 565, 848, 29901, 13, 18884, 2933, 353, 4867, 29889, 649, 29898, 1311, 17255, 4282, 29918, 2084, 29898, 2084, 511, 4390, 29922, 1272, 29897, 13, 9651, 1683, 29901, 13, 18884, 2933, 353, 4867, 29889, 649, 29898, 1311, 17255, 4282, 29918, 2084, 29898, 2084, 876, 13, 9651, 736, 1583, 17255, 5510, 29918, 5327, 29898, 5327, 29897, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 2224, 29901, 851, 1125, 13, 4706, 411, 7274, 29889, 7317, 580, 408, 4867, 29901, 13, 9651, 2933, 353, 4867, 29889, 8143, 29898, 1311, 17255, 4282, 29918, 2084, 29898, 2084, 876, 13, 9651, 736, 1583, 17255, 5510, 29918, 5327, 29898, 5327, 29897, 13, 13, 13, 1990, 8010, 29898, 15078, 11713, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 1678, 822, 679, 29918, 1761, 29898, 1311, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 703, 13092, 29914, 613, 9657, 29898, 3089, 8434, 703, 4836, 29908, 4961, 13, 13, 13, 1990, 15796, 29898, 15078, 11713, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 1678, 822, 679, 29918, 1761, 29898, 1311, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 703, 13092, 29914, 613, 9657, 29898, 3089, 8434, 703, 1643, 29908, 4961, 13, 13, 13, 1990, 9330, 29898, 15078, 11713, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 1678, 822, 679, 29918, 7662, 29898, 1311, 29892, 2380, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 657, 29898, 29888, 29908, 20673, 29914, 7662, 19248, 2248, 27195, 13, 13, 1678, 822, 5217, 29918, 7662, 29898, 1311, 29892, 318, 5416, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 8143, 29898, 29888, 29908, 20673, 29914, 7662, 29914, 8143, 19248, 25118, 27195, 13, 13, 1678, 822, 563, 29872, 2810, 29918, 7662, 29898, 1311, 29892, 318, 5416, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 8143, 29898, 29888, 29908, 20673, 29914, 7662, 29914, 9140, 2810, 19248, 25118, 27195, 13, 13, 1678, 822, 4866, 29918, 7662, 29898, 1311, 29892, 318, 5416, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 29888, 29908, 20673, 29914, 7662, 29914, 8835, 19248, 25118, 27195, 13, 13, 1678, 822, 28907, 29918, 7662, 29898, 1311, 29892, 318, 5416, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 29888, 29908, 20673, 29914, 7662, 29914, 262, 8835, 19248, 25118, 27195, 13, 13, 13, 1990, 9330, 29879, 29898, 15078, 11713, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 17255, 2972, 29918, 2084, 353, 376, 2972, 12975, 13, 4706, 1583, 17255, 2798, 29918, 2084, 353, 376, 2798, 12975, 13, 4706, 1583, 17255, 4572, 29918, 2084, 353, 376, 4572, 12975, 13, 13, 1678, 822, 679, 29918, 497, 29898, 1311, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 657, 703, 20673, 1159, 13, 13, 1678, 822, 788, 29898, 1311, 29892, 1426, 29901, 851, 29892, 2060, 29901, 851, 29892, 3858, 29901, 851, 29892, 2635, 29918, 17471, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 2490, 703, 20673, 613, 9657, 29898, 5398, 3195, 29898, 726, 29892, 2060, 29892, 3858, 29892, 2635, 29918, 17471, 4961, 13, 13, 1678, 822, 3863, 29898, 1311, 29892, 2380, 29901, 851, 29892, 1426, 29901, 851, 29892, 2060, 29901, 851, 29892, 3858, 29901, 851, 29892, 2635, 29918, 17471, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 1904, 353, 9330, 3195, 29898, 726, 29892, 2060, 29892, 3858, 29892, 2635, 29918, 17471, 29897, 13, 4706, 1904, 29889, 2248, 353, 2380, 13, 4706, 736, 1583, 29889, 649, 703, 20673, 613, 9657, 29898, 4299, 876, 13, 13, 1678, 822, 3349, 29918, 497, 29898, 1311, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 8143, 703, 20673, 1159, 13, 13, 1678, 822, 620, 305, 11272, 29898, 1311, 1125, 13, 4706, 1583, 29889, 649, 703, 690, 305, 11272, 29914, 1159, 13, 13, 1678, 822, 2318, 29918, 1609, 29918, 1643, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 2972, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 1643, 29908, 4961, 13, 13, 1678, 822, 2318, 29918, 1609, 29918, 4836, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 2972, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 4836, 29908, 4961, 13, 13, 1678, 822, 2318, 29918, 1609, 29918, 29123, 29918, 1256, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 2972, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 29123, 29918, 1256, 29908, 4961, 13, 13, 1678, 822, 2302, 29918, 497, 29898, 1311, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 657, 703, 2798, 29918, 497, 1159, 13, 13, 1678, 822, 2302, 29918, 1609, 29918, 29123, 29918, 1256, 29898, 1311, 29892, 2861, 29918, 1256, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 2798, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 29123, 29918, 1256, 613, 2861, 29918, 1256, 4961, 13, 13, 1678, 822, 2302, 29918, 1609, 29918, 4836, 29898, 1311, 29892, 2060, 29918, 978, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 2798, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 4836, 613, 2060, 29918, 978, 4961, 13, 13, 1678, 822, 2302, 29918, 1609, 29918, 29123, 29918, 1256, 29918, 3881, 29898, 1311, 29892, 1375, 29918, 1256, 29901, 851, 29892, 4236, 29918, 1256, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 2009, 29918, 2587, 353, 9657, 29898, 3089, 8434, 703, 29123, 29918, 1256, 29918, 3881, 613, 1375, 29918, 1256, 29892, 4236, 29918, 1256, 876, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 2798, 29918, 2084, 29892, 2009, 29918, 2587, 29897, 13, 13, 1678, 822, 4175, 29918, 1609, 29918, 4836, 29898, 1311, 29892, 2060, 29918, 978, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 4572, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 4836, 613, 2060, 29918, 978, 4961, 13, 13, 1678, 822, 4175, 29918, 1609, 29918, 1643, 29898, 1311, 29892, 3858, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 4572, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 1643, 613, 3858, 4961, 13, 13, 1678, 822, 4175, 29918, 1609, 29918, 726, 29898, 1311, 29892, 1426, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 4572, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 726, 613, 1426, 4961, 13, 13, 1678, 822, 4175, 29918, 1609, 29918, 29123, 29918, 1256, 29898, 1311, 29892, 2861, 29918, 1256, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 4572, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 29123, 29918, 1256, 613, 2861, 29918, 1256, 4961, 13, 13, 1678, 822, 4175, 29918, 1609, 29918, 4882, 29898, 1311, 29892, 4660, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 4572, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 4882, 613, 4660, 4961, 13, 13, 1678, 822, 4175, 29918, 1609, 29918, 29123, 29918, 1256, 29918, 3881, 29898, 1311, 29892, 1375, 29918, 1256, 29901, 851, 29892, 4236, 29918, 1256, 29901, 851, 29897, 1599, 9657, 29901, 13, 4706, 736, 1583, 29889, 649, 29898, 1311, 17255, 4572, 29918, 2084, 29892, 9657, 29898, 3089, 8434, 703, 29123, 29918, 1256, 29918, 3881, 613, 1375, 29918, 1256, 29892, 4236, 29918, 1256, 4961, 13, 13, 13, 13, 13, 2 ]
sentence-reading/common_words.py
michalovsky/knowlegde-based-ai-mini-projects
0
155764
names = ["Serena", "Andrew", "Bobbie", "Cason", "David", "Farzana", "Frank", "Hannah", "Ida", "Irene", "Jim", "Jose", "Keith", "Laura", "Lucy", "Meredith", "Nick", "Ada", "Yeeling", "Yan"] pre_nouns = ["an", "a", "the", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "much", "every", "any", "each", "some", "more"] question_words = ["What", "Which", "Where", "Who", "When", "Why", "How", "At what time"] adverbs = ["very", "just", "before", "too", "well", "also", "such", "near", "still", "never", "between", "far", "together", "often", "always", "once", "enough", "soon", "early", "slow", "fine"] adjectives = ["hot", "other", "long", "first", "new", "round", "good", "great", "low", "same", "right", "old", "small", "large", "even", "big", "high", "light", "kind", "own", "last", "hard", "late", "real", "next", "white", "second", "main", "plain", "usual", "young", "ready", "red", "direct", "black", "short", "numeral", "complete", "whole", "best", "better", "fast", "simple", "cold", "certain", "dark", "correct", "able", "done", "final", "green", "quick", "warm", "free", "strong", "special", "clear", "full", "blue", "deep", "busy", "common", "gold", "possible", "dry", "cool"] articles = ["the", "a", "an"] conjunctions = ["and", "or", "but", "if", "then", "than", "though"] nouns = ["that", "color", "this", "there", "word", "time", "way", "these", "thing", "day", "number", "water", "people", "side", "now", "part", "place", "man", "year", "name", "form", "line", "boy", "sentence", "end", "home", "hand", "port", "land", "here", "men", "house", "picture", "animal", "point", "mother", "world", "self", "earth", "father", "head", "page", "country", "school", "food", "sun", "eye", "door", "city", "tree", "cross", "story", "sea", "left", "night", "life", "children", "example", "ease", "paper", "music", "book", "letter", "mile", "river", "car", "feet", "group", "rain", "room", "friend", "idea", "fish", "mountain", "north", "base", "horse", "face", "wood", "girl", "list", "bird", "body", "dog", "family", "song", "state", "product", "class", "wind", "question", "ship", "area", "rock", "order", "fire", "south", "problem", "piece", "farm", "top", "king", "size", "hour", "true", "step", "west", "ground", "table", "morning", "vowel", "war", "pattern", "center", "love", "person", "money", "road", "map", "science", "notice", "voice", "power", "town", "unit", "machine", "note", "plan", "figure", "star", "box", "noun", "field", "pound", "beauty", "front", "week", "minute", "mind", "tail", "fact", "street", "inch", "nothing", "course", "wheel", "force", "object", "surface", "moon", "island", "foot", "test", "boat", "plane", "age", "game", "shape", "heat", "snow", "bed", "east", "weight", "language"] numerals = ["one", "two", "three", "four", "hundred", "five", "six", "ten", "thousand"] other = ["will", "dont", "while", "sure", "ever", "oh", "ago", "yes", "perhaps"] possesive_pronouns = ["his", "your", "their", "her", "my", "our"] prepositions = ["of", "to", "in", "for", "on", "with", "as", "at", "from", "by", "out", "up", "about", "so", "over", "down", "after", "back", "under", "through", "off", "again", "since", "until", "above", "during", "toward", "against", "behind", "yet", "among"] pronouns = ["it", "you", "he", "I", "they", "we", "she", "them", "him", "me", "us", "those"] quantities = ["some", "all", "each", "many", "more", "no", "most", "any", "little", "only", "every", "much", "few", "both", "half", "less", "several", "lot"] verbs = ["is", "was", "are", "be", "have", "had", "can", "were", "use", "said", "do", "would", "write", "like", "make", "see", "has", "look", "could", "go", "come", "did", "sound", "know", "call", "may", "been", "find", "work", "take", "get", "made", "live", "came", "show", "give", "think", "say", "help", "turn", "cause", "mean", "differ", "move", "does", "tell", "set", "want", "air", "play", "put", "read", "spell", "add", "must", "follow", "act", "ask", "change", "went", "need", "try", "build", "stand", "should", "found", "answer", "grow", "study", "learn", "plant", "cover", "thought", "let", "keep", "start", "might", "saw", "draw", "run", "press", "close", "stop", "open", "seem", "begin", "got", "walk", "mark", "care", "carry", "took", "eat", "began", "hear", "cut", "watch", "feel", "talk", "pose", "leave", "measure", "happen", "told", "knew", "pass", "heard", "am", "remember", "hold", "interest", "reach", "sing", "listen", "travel", "lay", "serve", "appear", "rule", "govern", "pull", "fall", "fly", "lead", "cry", "wait", "rest", "drive", "stood", "contain", "teach", "gave", "develop", "sleep", "produce", "stay", "decide", "record", "wonder", "laugh", "ran", "check", "miss", "brought", "bring", "sit", "fill"] versions_of_to_be = ["am", "is", "are", "was", "were"]
[ 1, 2983, 353, 6796, 1748, 2386, 613, 13, 308, 376, 2855, 3973, 613, 13, 308, 376, 29362, 10993, 613, 13, 308, 376, 29907, 1658, 613, 13, 308, 376, 19504, 613, 13, 308, 376, 29943, 11129, 1648, 613, 13, 308, 376, 7675, 29895, 613, 13, 308, 376, 29950, 812, 801, 613, 13, 308, 376, 1204, 29874, 613, 13, 308, 376, 29902, 28593, 613, 13, 308, 376, 29967, 326, 613, 13, 308, 376, 26473, 613, 13, 308, 376, 9598, 389, 613, 13, 308, 376, 5661, 2002, 613, 13, 308, 376, 24126, 1270, 613, 13, 308, 376, 29924, 14561, 389, 613, 13, 308, 376, 29940, 860, 613, 13, 308, 376, 29909, 1388, 613, 13, 308, 376, 29979, 29872, 14067, 613, 13, 308, 376, 29979, 273, 3108, 13, 13, 1457, 29918, 29876, 1309, 29879, 353, 6796, 273, 613, 376, 29874, 613, 376, 1552, 613, 376, 650, 613, 376, 10184, 613, 376, 17536, 613, 376, 17823, 613, 376, 20818, 613, 376, 28319, 613, 376, 344, 854, 613, 376, 29872, 523, 613, 376, 29876, 457, 613, 376, 841, 613, 376, 29885, 987, 613, 13, 632, 376, 17991, 613, 376, 1384, 613, 376, 4204, 613, 376, 5372, 613, 376, 5514, 3108, 13, 13, 12470, 29918, 9303, 353, 6796, 5618, 613, 376, 8809, 436, 613, 376, 11921, 613, 376, 22110, 613, 376, 10401, 613, 376, 11008, 613, 376, 5328, 613, 376, 4178, 825, 931, 3108, 13, 13, 328, 369, 5824, 353, 6796, 1201, 613, 376, 5143, 613, 376, 11083, 613, 376, 517, 29877, 613, 376, 5872, 613, 376, 15189, 613, 376, 14565, 613, 376, 28502, 613, 376, 303, 453, 613, 376, 484, 369, 613, 376, 14811, 613, 376, 15641, 613, 13, 965, 376, 29873, 12966, 613, 376, 29877, 15535, 613, 376, 21936, 613, 376, 10646, 613, 376, 264, 820, 613, 376, 578, 265, 613, 376, 799, 368, 613, 376, 28544, 613, 376, 29888, 457, 3108, 13, 13, 328, 622, 3145, 353, 6796, 8711, 613, 376, 1228, 613, 376, 5426, 613, 376, 4102, 613, 376, 1482, 613, 376, 14486, 613, 376, 16773, 613, 376, 7979, 271, 613, 376, 677, 613, 376, 17642, 613, 376, 1266, 613, 376, 1025, 613, 376, 9278, 613, 13, 795, 376, 16961, 613, 376, 11884, 613, 376, 3752, 613, 376, 9812, 613, 376, 4366, 613, 376, 14380, 613, 376, 776, 613, 376, 4230, 613, 376, 6800, 613, 376, 9632, 613, 376, 6370, 613, 376, 4622, 613, 376, 10921, 613, 13, 795, 376, 7496, 613, 376, 3396, 613, 376, 24595, 613, 376, 375, 950, 613, 376, 6293, 865, 613, 376, 2040, 613, 376, 1127, 613, 376, 11851, 613, 376, 8517, 613, 376, 12759, 613, 376, 8058, 284, 613, 13, 795, 376, 8835, 613, 376, 15970, 280, 613, 376, 13318, 613, 376, 6878, 357, 613, 376, 11255, 613, 376, 12857, 613, 376, 29883, 1025, 613, 376, 14082, 613, 376, 26031, 613, 376, 15728, 613, 376, 519, 613, 13, 795, 376, 15091, 613, 376, 8394, 613, 376, 12692, 613, 376, 24561, 613, 376, 29893, 2817, 613, 376, 9021, 613, 376, 1110, 613, 376, 18732, 613, 376, 8551, 613, 376, 8159, 613, 376, 9539, 613, 376, 24535, 613, 13, 795, 376, 8262, 29891, 613, 376, 9435, 613, 376, 29887, 1025, 613, 376, 27338, 613, 376, 29881, 719, 613, 376, 1111, 324, 3108, 13, 13, 18569, 353, 6796, 1552, 613, 376, 29874, 613, 376, 273, 3108, 13, 13, 535, 29926, 651, 29879, 353, 6796, 392, 613, 376, 272, 613, 376, 4187, 613, 376, 361, 613, 376, 6098, 613, 376, 27603, 613, 376, 3592, 3108, 13, 13, 29876, 1309, 29879, 353, 6796, 5747, 613, 376, 2780, 613, 376, 1366, 613, 376, 12711, 613, 376, 1742, 613, 376, 2230, 613, 376, 1582, 613, 376, 386, 968, 613, 376, 1918, 613, 376, 3250, 613, 376, 4537, 613, 376, 13405, 613, 376, 25719, 613, 13, 308, 376, 2975, 613, 376, 3707, 613, 376, 1595, 613, 376, 6689, 613, 376, 1171, 613, 376, 6360, 613, 376, 978, 613, 376, 689, 613, 376, 1220, 613, 376, 19415, 613, 376, 18616, 663, 613, 376, 355, 613, 376, 5184, 613, 13, 308, 376, 3179, 613, 376, 637, 613, 376, 1049, 613, 376, 4150, 613, 376, 1527, 613, 376, 8697, 613, 376, 12095, 613, 376, 273, 3039, 613, 376, 3149, 613, 376, 29885, 1228, 613, 376, 11526, 613, 376, 1311, 613, 13, 308, 376, 799, 386, 613, 376, 22212, 613, 376, 2813, 613, 376, 3488, 613, 376, 13509, 613, 376, 27041, 613, 376, 1181, 397, 613, 376, 11445, 613, 376, 1032, 29872, 613, 376, 17433, 613, 376, 12690, 613, 376, 8336, 613, 376, 19128, 613, 13, 308, 376, 24098, 613, 376, 344, 29874, 613, 376, 1563, 613, 376, 11147, 613, 376, 19264, 613, 376, 11991, 613, 376, 4773, 613, 376, 29872, 559, 613, 376, 19773, 613, 376, 23596, 613, 376, 2909, 613, 376, 15670, 613, 13, 308, 376, 26763, 613, 376, 3511, 613, 376, 4287, 613, 376, 1725, 300, 613, 376, 2972, 613, 376, 6038, 613, 376, 8345, 613, 376, 18326, 613, 376, 11729, 613, 376, 15161, 613, 376, 16476, 475, 613, 376, 29876, 2072, 613, 376, 3188, 613, 13, 308, 376, 2015, 344, 613, 376, 2161, 613, 376, 6115, 613, 376, 29887, 5168, 613, 376, 1761, 613, 376, 18513, 613, 376, 2587, 613, 376, 26169, 613, 376, 11922, 613, 376, 21453, 613, 376, 3859, 613, 376, 4704, 613, 376, 1990, 613, 13, 308, 376, 14800, 613, 376, 12470, 613, 376, 3527, 613, 376, 6203, 613, 376, 20821, 613, 376, 2098, 613, 376, 8696, 613, 376, 29879, 2438, 613, 376, 17199, 613, 376, 12343, 346, 613, 376, 29888, 2817, 613, 376, 3332, 613, 13, 308, 376, 9292, 613, 376, 2311, 613, 376, 18721, 613, 376, 3009, 613, 376, 10568, 613, 376, 5933, 613, 376, 2057, 613, 376, 2371, 613, 376, 12257, 1076, 613, 376, 29894, 27531, 613, 376, 4495, 613, 376, 11037, 613, 13, 308, 376, 5064, 613, 376, 417, 345, 613, 376, 10532, 613, 376, 29885, 4992, 613, 376, 9972, 613, 376, 1958, 613, 376, 29879, 15277, 613, 376, 1333, 625, 613, 376, 14917, 613, 376, 13519, 613, 376, 27734, 613, 376, 5441, 613, 13, 308, 376, 23523, 613, 376, 6812, 613, 376, 9018, 613, 376, 4532, 613, 376, 8508, 613, 376, 1884, 613, 376, 29876, 1309, 613, 376, 2671, 613, 376, 29886, 618, 613, 376, 915, 1300, 29891, 613, 376, 8862, 613, 376, 18448, 613, 13, 308, 376, 1195, 1082, 613, 376, 24021, 613, 376, 18237, 613, 376, 17028, 613, 376, 29352, 613, 376, 22466, 613, 376, 28450, 613, 376, 15775, 613, 376, 29893, 10552, 613, 376, 10118, 613, 376, 3318, 613, 376, 7610, 2161, 613, 13, 308, 376, 4346, 265, 613, 376, 275, 1049, 613, 376, 6661, 613, 376, 1688, 613, 376, 833, 271, 613, 376, 22116, 613, 376, 482, 613, 376, 11802, 613, 376, 12181, 613, 376, 354, 271, 613, 376, 29879, 3707, 613, 376, 2580, 613, 376, 23027, 613, 13, 308, 376, 7915, 613, 376, 11675, 3108, 13, 13, 8058, 1338, 353, 6796, 650, 613, 376, 10184, 613, 376, 17536, 613, 376, 17823, 613, 376, 29882, 6453, 613, 376, 20818, 613, 376, 28319, 613, 376, 841, 613, 376, 386, 681, 392, 3108, 13, 13, 1228, 353, 6796, 14043, 613, 376, 29881, 609, 613, 376, 8000, 613, 376, 29879, 545, 613, 376, 1310, 613, 376, 1148, 613, 376, 4425, 613, 376, 3582, 613, 376, 546, 4252, 3108, 13, 13, 28802, 267, 573, 29918, 558, 265, 1309, 29879, 353, 6796, 22880, 613, 376, 8066, 613, 376, 1552, 381, 613, 376, 2276, 613, 376, 1357, 613, 376, 473, 3108, 13, 13, 1457, 1066, 2187, 353, 6796, 974, 613, 376, 517, 613, 376, 262, 613, 376, 1454, 613, 376, 265, 613, 376, 2541, 613, 376, 294, 613, 376, 271, 613, 376, 3166, 613, 376, 1609, 613, 376, 449, 613, 376, 786, 613, 376, 12717, 613, 376, 578, 613, 376, 957, 613, 13, 18884, 376, 3204, 613, 376, 7045, 613, 376, 1627, 613, 376, 5062, 613, 376, 20678, 613, 376, 2696, 613, 376, 351, 475, 613, 376, 16076, 613, 376, 29305, 613, 376, 27215, 613, 376, 29881, 3864, 613, 13, 18884, 376, 29873, 340, 538, 613, 376, 351, 475, 303, 613, 376, 915, 16887, 613, 376, 29891, 300, 613, 376, 314, 549, 3108, 13, 13, 558, 265, 1309, 29879, 353, 6796, 277, 613, 376, 6293, 613, 376, 354, 613, 376, 29902, 613, 376, 19562, 613, 376, 705, 613, 376, 11360, 613, 376, 386, 331, 613, 376, 26994, 613, 376, 1004, 613, 376, 375, 613, 376, 386, 852, 3108, 13, 13, 12150, 1907, 353, 6796, 5372, 613, 376, 497, 613, 376, 4204, 613, 376, 13011, 613, 376, 5514, 613, 376, 1217, 613, 376, 3242, 613, 376, 1384, 613, 376, 29880, 1992, 613, 376, 6194, 613, 376, 17991, 613, 376, 29885, 987, 613, 376, 29888, 809, 613, 13, 795, 376, 20313, 613, 376, 24498, 613, 376, 2222, 613, 376, 344, 369, 284, 613, 376, 8276, 3108, 13, 13, 369, 5824, 353, 6796, 275, 613, 376, 11102, 613, 376, 598, 613, 376, 915, 613, 376, 17532, 613, 376, 21312, 613, 376, 3068, 613, 376, 29893, 406, 613, 376, 1509, 613, 376, 4977, 333, 613, 376, 1867, 613, 376, 29893, 483, 613, 376, 3539, 613, 376, 4561, 613, 376, 5675, 613, 13, 308, 376, 4149, 613, 376, 5349, 613, 376, 6914, 613, 376, 26680, 613, 376, 1484, 613, 376, 2763, 613, 376, 18361, 613, 376, 29802, 613, 376, 28385, 613, 376, 4804, 613, 376, 13029, 613, 376, 915, 264, 613, 376, 2886, 613, 376, 1287, 613, 13, 308, 376, 19730, 613, 376, 657, 613, 376, 26350, 613, 376, 9258, 613, 376, 29883, 420, 613, 376, 4294, 613, 376, 29887, 573, 613, 376, 386, 682, 613, 376, 20834, 613, 376, 8477, 613, 376, 685, 613, 376, 29883, 1071, 613, 376, 12676, 613, 13, 308, 376, 29881, 8349, 613, 376, 11631, 613, 376, 13221, 613, 376, 29873, 514, 613, 376, 842, 613, 376, 29893, 424, 613, 376, 1466, 613, 376, 1456, 613, 376, 649, 613, 376, 949, 613, 376, 1028, 514, 613, 376, 1202, 613, 376, 21969, 613, 13, 308, 376, 23031, 613, 376, 627, 613, 376, 1278, 613, 376, 3167, 613, 376, 29893, 296, 613, 376, 26180, 613, 376, 2202, 613, 376, 4282, 613, 376, 1689, 613, 376, 9344, 613, 376, 11940, 613, 376, 12011, 613, 376, 29887, 798, 613, 13, 308, 376, 18082, 29891, 613, 376, 19668, 613, 376, 24389, 613, 376, 11911, 613, 376, 386, 1774, 613, 376, 1026, 613, 376, 17462, 613, 376, 2962, 613, 376, 29885, 523, 613, 376, 29879, 1450, 613, 376, 4012, 613, 376, 3389, 613, 376, 2139, 613, 13, 308, 376, 5358, 613, 376, 9847, 613, 376, 3150, 613, 376, 344, 331, 613, 376, 463, 613, 376, 7085, 613, 376, 20919, 613, 376, 3502, 613, 376, 18020, 613, 376, 4287, 719, 613, 376, 517, 554, 613, 376, 29872, 271, 613, 376, 28060, 273, 613, 13, 308, 376, 354, 279, 613, 376, 7582, 613, 376, 12344, 613, 376, 1725, 295, 613, 376, 29873, 2235, 613, 376, 4220, 613, 376, 280, 1351, 613, 376, 26658, 613, 376, 29882, 19934, 613, 376, 29873, 1025, 613, 376, 29895, 1482, 613, 376, 3364, 613, 376, 354, 538, 613, 13, 308, 376, 314, 613, 376, 1745, 1096, 613, 376, 8948, 613, 376, 1639, 342, 613, 376, 276, 496, 613, 376, 2976, 613, 376, 20631, 613, 376, 3018, 955, 613, 376, 8387, 613, 376, 16349, 613, 376, 932, 799, 613, 376, 7491, 613, 13, 308, 376, 29887, 6170, 613, 376, 26746, 613, 376, 11950, 613, 376, 17652, 613, 376, 280, 328, 613, 376, 29883, 719, 613, 376, 10685, 613, 376, 5060, 613, 376, 21594, 613, 376, 9337, 613, 376, 1285, 475, 613, 376, 371, 496, 613, 376, 29887, 1351, 613, 13, 308, 376, 4888, 613, 376, 17059, 613, 376, 5498, 346, 613, 376, 303, 388, 613, 376, 311, 8204, 613, 376, 11651, 613, 376, 29893, 8417, 613, 376, 433, 6129, 613, 376, 661, 613, 376, 3198, 613, 376, 9894, 613, 13, 308, 376, 1182, 1774, 613, 376, 1182, 292, 613, 376, 29879, 277, 613, 376, 5589, 3108, 13, 13, 26100, 29918, 974, 29918, 517, 29918, 915, 353, 6796, 314, 613, 376, 275, 613, 376, 598, 613, 376, 11102, 613, 376, 29893, 406, 3108, 2 ]
infinite_scroll_pagination/serializers.py
nitely/django-infinite-scroll-pagination
89
175351
<gh_stars>10-100 #-*- coding: utf-8 -*- import re import time from datetime import datetime from django.core.paginator import InvalidPage from django.utils import timezone from django.conf import settings __all__ = [ 'page_key', 'to_page_key', 'InvalidPage'] PAGE_RE = re.compile(r'^(?P<value>[0-9]+\.[0-9]{6})-(?P<pk>[0-9]+)$') def _make_aware_maybe(dt): if not getattr(settings, 'USE_TZ', False): return dt if timezone.is_aware(dt): return dt.astimezone(timezone.utc) return timezone.make_aware(dt, timezone=timezone.utc) def _fromtimestamp(ts): if not getattr(settings, 'USE_TZ', False): return datetime.fromtimestamp(ts) return datetime.utcfromtimestamp(ts) # py2 only def _timestamp(dt): if timezone.is_naive(dt): return time.mktime(( dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, -1, -1, -1)) + dt.microsecond / 1e6 return (dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds() def page_key(raw_page): """ Parse a raw page value of ``timestamp-pk`` format. Return a tuple of (timestamp, pk) :raises: ``InvalidPage`` """ if not raw_page: return None, None m = re.match(PAGE_RE, raw_page) if m is None: raise InvalidPage('Bad key format') try: timestamp = _fromtimestamp(float(m.group('value'))) except (OverflowError, ValueError): raise InvalidPage('Key out of range') return _make_aware_maybe(timestamp), m.group('pk') def to_page_key(value=None, pk=None): """Serialize a value and pk to `timestamp-pk`` format""" if value is None: return '' if isinstance(value, (tuple, list)): (value,) = value value = _make_aware_maybe(value) try: timestamp = value.timestamp() except AttributeError: timestamp = _timestamp(value) return '{:.6f}-{}'.format(timestamp, pk)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 29899, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 337, 13, 5215, 931, 13, 3166, 12865, 1053, 12865, 13, 13, 3166, 9557, 29889, 3221, 29889, 13573, 262, 1061, 1053, 21403, 5074, 13, 3166, 9557, 29889, 13239, 1053, 29431, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 3488, 29918, 1989, 742, 13, 1678, 525, 517, 29918, 3488, 29918, 1989, 742, 13, 1678, 525, 13919, 5074, 2033, 13, 13, 7228, 1692, 29918, 1525, 353, 337, 29889, 12198, 29898, 29878, 29915, 29985, 10780, 29925, 29966, 1767, 24566, 29900, 29899, 29929, 29962, 3124, 7226, 29900, 29899, 29929, 3199, 29953, 1800, 29899, 10780, 29925, 29966, 20571, 24566, 29900, 29899, 29929, 10062, 1262, 1495, 13, 13, 13, 1753, 903, 5675, 29918, 28327, 29918, 26026, 29898, 6008, 1125, 13, 1678, 565, 451, 679, 5552, 29898, 11027, 29892, 525, 17171, 29918, 29911, 29999, 742, 7700, 1125, 13, 4706, 736, 11636, 13, 1678, 565, 29431, 29889, 275, 29918, 28327, 29898, 6008, 1125, 13, 4706, 736, 11636, 29889, 579, 603, 8028, 29898, 2230, 8028, 29889, 329, 29883, 29897, 13, 1678, 736, 29431, 29889, 5675, 29918, 28327, 29898, 6008, 29892, 29431, 29922, 2230, 8028, 29889, 329, 29883, 29897, 13, 13, 13, 1753, 903, 3166, 16394, 29898, 1372, 1125, 13, 1678, 565, 451, 679, 5552, 29898, 11027, 29892, 525, 17171, 29918, 29911, 29999, 742, 7700, 1125, 13, 4706, 736, 12865, 29889, 3166, 16394, 29898, 1372, 29897, 13, 1678, 736, 12865, 29889, 329, 29883, 3166, 16394, 29898, 1372, 29897, 13, 13, 13, 29937, 11451, 29906, 871, 13, 1753, 903, 16394, 29898, 6008, 1125, 13, 1678, 565, 29431, 29889, 275, 29918, 1056, 573, 29898, 6008, 1125, 13, 4706, 736, 931, 29889, 29885, 1193, 603, 3552, 13, 9651, 11636, 29889, 6360, 29892, 11636, 29889, 10874, 29892, 11636, 29889, 3250, 29892, 13, 9651, 11636, 29889, 18721, 29892, 11636, 29889, 1195, 1082, 29892, 11636, 29889, 7496, 29892, 13, 9651, 448, 29896, 29892, 448, 29896, 29892, 448, 29896, 876, 718, 11636, 29889, 29885, 2357, 7496, 847, 29871, 29896, 29872, 29953, 13, 1678, 736, 313, 6008, 448, 12865, 29898, 29896, 29929, 29955, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 260, 29920, 3888, 29922, 2230, 8028, 29889, 329, 29883, 8106, 7827, 29918, 23128, 580, 13, 13, 13, 1753, 1813, 29918, 1989, 29898, 1610, 29918, 3488, 1125, 13, 1678, 9995, 13, 1678, 20969, 263, 10650, 1813, 995, 310, 4954, 16394, 29899, 20571, 16159, 3402, 29889, 13, 1678, 7106, 263, 18761, 310, 313, 16394, 29892, 282, 29895, 29897, 13, 13, 1678, 584, 336, 4637, 29901, 4954, 13919, 5074, 16159, 13, 1678, 9995, 13, 1678, 565, 451, 10650, 29918, 3488, 29901, 13, 4706, 736, 6213, 29892, 6213, 13, 1678, 286, 353, 337, 29889, 4352, 29898, 7228, 1692, 29918, 1525, 29892, 10650, 29918, 3488, 29897, 13, 1678, 565, 286, 338, 6213, 29901, 13, 4706, 12020, 21403, 5074, 877, 22050, 1820, 3402, 1495, 13, 1678, 1018, 29901, 13, 4706, 14334, 353, 903, 3166, 16394, 29898, 7411, 29898, 29885, 29889, 2972, 877, 1767, 29915, 4961, 13, 1678, 5174, 313, 23773, 2392, 29892, 7865, 2392, 1125, 13, 4706, 12020, 21403, 5074, 877, 2558, 714, 310, 3464, 1495, 13, 1678, 736, 903, 5675, 29918, 28327, 29918, 26026, 29898, 16394, 511, 286, 29889, 2972, 877, 20571, 1495, 13, 13, 13, 1753, 304, 29918, 3488, 29918, 1989, 29898, 1767, 29922, 8516, 29892, 282, 29895, 29922, 8516, 1125, 13, 1678, 9995, 1748, 6646, 263, 995, 322, 282, 29895, 304, 421, 16394, 29899, 20571, 16159, 3402, 15945, 29908, 13, 1678, 565, 995, 338, 6213, 29901, 13, 4706, 736, 6629, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 23583, 29892, 1051, 22164, 13, 4706, 313, 1767, 29892, 29897, 353, 995, 13, 1678, 995, 353, 903, 5675, 29918, 28327, 29918, 26026, 29898, 1767, 29897, 13, 1678, 1018, 29901, 13, 4706, 14334, 353, 995, 29889, 16394, 580, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 14334, 353, 903, 16394, 29898, 1767, 29897, 13, 1678, 736, 22372, 29901, 29889, 29953, 29888, 7402, 8875, 4286, 4830, 29898, 16394, 29892, 282, 29895, 29897, 13, 2 ]
sellalert.py
sjmiller609/cvs_scraper
0
21960
import requests import json from pprint import pprint import re import time import sys #getdata = requests.get(geturl) #pprint (vars(getdata)) from bs4 import BeautifulSoup from geopy.geocoders import Nominatim if len(sys.argv) != 4: print(sys.argv[0]+" <item> <location> <num items>") exit() #get list of product IDs item = sys.argv[1].replace(" ","+") print("searching for items with: "+item) geturl = "http://www.cvs.com/search/N-0?searchTerm="+item+"&navNum="+sys.argv[3] print("search url: "+geturl) #This step is important.Converting QString to Ascii for lxml to process #archive_links = html.fromstring(str(result.toAscii())) #print archive_links response = requests.get(geturl) print(str(response)) page = str(BeautifulSoup(response.content,"html.parser")) print(page) exit() def getURL(page): start_link = page.find("href") if start_link == -1: return None, 0 start_quote = page.find('"', start_link) end_quote = page.find('"', start_quote + 1) url = page[start_quote + 1: end_quote] return url, end_quote def getUrls(urls,page): url, n = getURL(page) if url: urls.append(url) getUrls(urls,page[n:]) urls = [] getUrls(urls,page) for url in urls: print(url) itemlist = [] skuidlist = [] for i in range(0,len(urls)): m = re.search('/shop/.*/.*/.*/(.*)-skuid-(\d{6})',urls[i]) if m and m.group(2) not in skuidlist: itemlist.append(m.group(1)) skuidlist.append(m.group(2)) print("items found:") for item in itemlist: print("\t"+item) #TODO: now the page loads these in js, so we need to interpret js exit() geolocator = Nominatim() location = geolocator.geocode(sys.argv[2]) print((location.latitude,location.longitude)) posturl = "http://www.cvs.com/rest/bean/cvs/catalog/CvsBohServiceHandler/storeInventoryValues" dicts = [] print('loading initial inventory...') for i in range(0,len(skuidlist)): time.sleep(2) productId = skuidlist[i] postdata = {'productId': productId, 'productSPUlnd': 'true','favstore':'NULL','geolatitude':str(location.latitude),'geolongitude':str(location.longitude)} inv = requests.post(posturl,data=postdata) dict = {} jsons = inv.json()['atgResponse'] for j in range(0,len(jsons)): temp = jsons[j] if(temp['Qty'] == ''): temp['Qty'] = '0' dict[temp['storeAddress']] = temp['Qty'] dicts.append(dict) print(str(100*i/len(skuidlist))+"%") while True: for j in range(0,len(skuidlist)): #delay between requests print('3 seconds...') time.sleep(3) productId = skuidlist[j] postdata = {'productId': productId, 'productSPUlnd': 'true','favstore':'NULL','geolatitude':str(location.latitude),'geolongitude':str(location.longitude)} inv = requests.post(posturl,data=postdata) jsons = inv.json()['atgResponse'] for i in range(0,len(jsons)): temp = jsons[i] if(temp['Qty'] == ''): temp['Qty'] = '0' if(dicts[j][temp['storeAddress']] != temp['Qty']): print("was: "+dicts[j][temp['storeAddress']]+" now: "+temp['Qty']) sold = int(dicts[j][temp['storeAddress']]) - int(temp['Qty']) print(temp['storeAddress']+" sold "+str(sold) + " of item " +itemlist[j]) dicts[j][temp['storeAddress']] = temp['Qty']
[ 1, 1053, 7274, 13, 5215, 4390, 13, 3166, 282, 2158, 1053, 282, 2158, 13, 5215, 337, 13, 5215, 931, 13, 5215, 10876, 13, 29937, 657, 1272, 353, 7274, 29889, 657, 29898, 657, 2271, 29897, 13, 29937, 407, 29878, 524, 313, 16908, 29898, 657, 1272, 876, 13, 3166, 24512, 29946, 1053, 25685, 29903, 1132, 13, 3166, 1737, 2270, 29889, 479, 542, 397, 414, 1053, 405, 5817, 271, 326, 13, 13, 361, 7431, 29898, 9675, 29889, 19218, 29897, 2804, 29871, 29946, 29901, 13, 1678, 1596, 29898, 9675, 29889, 19218, 29961, 29900, 10062, 29908, 529, 667, 29958, 529, 5479, 29958, 529, 1949, 4452, 29958, 1159, 13, 1678, 6876, 580, 13, 13, 29937, 657, 1051, 310, 3234, 23481, 13, 667, 353, 10876, 29889, 19218, 29961, 29896, 1822, 6506, 703, 28796, 29974, 1159, 13, 2158, 703, 4478, 292, 363, 4452, 411, 29901, 15691, 667, 29897, 13, 657, 2271, 353, 376, 1124, 597, 1636, 29889, 29883, 4270, 29889, 510, 29914, 4478, 29914, 29940, 29899, 29900, 29973, 4478, 14343, 543, 29974, 667, 13578, 29987, 6654, 8009, 543, 29974, 9675, 29889, 19218, 29961, 29941, 29962, 13, 2158, 703, 4478, 3142, 29901, 15691, 657, 2271, 29897, 13, 13, 29937, 4013, 4331, 338, 4100, 29889, 1168, 369, 1259, 660, 1231, 304, 1094, 18869, 363, 301, 3134, 304, 1889, 13, 29937, 10867, 29918, 4965, 353, 3472, 29889, 3166, 1807, 29898, 710, 29898, 2914, 29889, 517, 2887, 18869, 22130, 13, 29937, 2158, 18871, 29918, 4965, 13, 13, 5327, 353, 7274, 29889, 657, 29898, 657, 2271, 29897, 13, 2158, 29898, 710, 29898, 5327, 876, 13, 13, 3488, 353, 851, 29898, 3629, 1300, 6845, 29903, 1132, 29898, 5327, 29889, 3051, 1699, 1420, 29889, 16680, 5783, 13, 2158, 29898, 3488, 29897, 13, 13322, 580, 13, 13, 1753, 679, 4219, 29898, 3488, 1125, 13, 1678, 1369, 29918, 2324, 353, 1813, 29889, 2886, 703, 12653, 1159, 13, 1678, 565, 1369, 29918, 2324, 1275, 448, 29896, 29901, 13, 4706, 736, 6213, 29892, 29871, 29900, 13, 1678, 1369, 29918, 1396, 353, 1813, 29889, 2886, 877, 29908, 742, 1369, 29918, 2324, 29897, 13, 1678, 1095, 29918, 1396, 353, 1813, 29889, 2886, 877, 29908, 742, 1369, 29918, 1396, 718, 29871, 29896, 29897, 13, 1678, 3142, 353, 1813, 29961, 2962, 29918, 1396, 718, 29871, 29896, 29901, 1095, 29918, 1396, 29962, 13, 1678, 736, 3142, 29892, 1095, 29918, 1396, 13, 13, 1753, 679, 5983, 29879, 29898, 26045, 29892, 3488, 1125, 13, 1678, 3142, 29892, 302, 353, 679, 4219, 29898, 3488, 29897, 13, 1678, 565, 3142, 29901, 13, 4706, 23942, 29889, 4397, 29898, 2271, 29897, 13, 4706, 679, 5983, 29879, 29898, 26045, 29892, 3488, 29961, 29876, 29901, 2314, 13, 13, 26045, 353, 5159, 13, 657, 5983, 29879, 29898, 26045, 29892, 3488, 29897, 13, 1454, 3142, 297, 23942, 29901, 13, 1678, 1596, 29898, 2271, 29897, 13, 13, 667, 1761, 353, 5159, 13, 808, 5416, 1761, 353, 5159, 13, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 26045, 22164, 13, 1678, 286, 353, 337, 29889, 4478, 11219, 19032, 6294, 3877, 29889, 3877, 29889, 3877, 28104, 6817, 808, 5416, 29899, 1194, 29881, 29912, 29953, 1800, 742, 26045, 29961, 29875, 2314, 13, 1678, 565, 286, 322, 286, 29889, 2972, 29898, 29906, 29897, 451, 297, 2071, 5416, 1761, 29901, 13, 268, 12, 667, 1761, 29889, 4397, 29898, 29885, 29889, 2972, 29898, 29896, 876, 13, 268, 12, 808, 5416, 1761, 29889, 4397, 29898, 29885, 29889, 2972, 29898, 29906, 876, 29871, 13, 13, 2158, 703, 7076, 1476, 29901, 1159, 13, 1454, 2944, 297, 2944, 1761, 29901, 13, 12, 2158, 14182, 29873, 17969, 667, 29897, 13, 29937, 4986, 3970, 29901, 1286, 278, 1813, 15376, 1438, 297, 6965, 29892, 577, 591, 817, 304, 6613, 6965, 13, 13322, 580, 13, 13, 479, 324, 542, 1061, 353, 405, 5817, 271, 326, 580, 13, 5479, 353, 1737, 324, 542, 1061, 29889, 24756, 401, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 13, 2158, 3552, 5479, 29889, 5066, 4279, 29892, 5479, 29889, 5426, 4279, 876, 13, 13, 13, 2490, 2271, 353, 376, 1124, 597, 1636, 29889, 29883, 4270, 29889, 510, 29914, 5060, 29914, 14471, 29914, 29883, 4270, 29914, 28045, 29914, 29907, 4270, 29933, 1148, 3170, 4598, 29914, 8899, 797, 23886, 9065, 29908, 13, 13, 8977, 29879, 353, 5159, 13, 13, 2158, 877, 13234, 2847, 11817, 706, 856, 1495, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 808, 5416, 1761, 22164, 13, 1678, 931, 29889, 17059, 29898, 29906, 29897, 13, 1678, 3234, 1204, 353, 2071, 5416, 1761, 29961, 29875, 29962, 13, 1678, 1400, 1272, 353, 11117, 4704, 1204, 2396, 3234, 1204, 29892, 525, 4704, 5550, 29965, 29880, 299, 2396, 525, 3009, 3788, 29888, 485, 8899, 22099, 10074, 3788, 479, 324, 271, 4279, 2396, 710, 29898, 5479, 29889, 5066, 4279, 511, 29915, 479, 324, 549, 4279, 2396, 710, 29898, 5479, 29889, 5426, 4279, 2915, 13, 1678, 2437, 353, 7274, 29889, 2490, 29898, 2490, 2271, 29892, 1272, 29922, 2490, 1272, 29897, 13, 1678, 9657, 353, 6571, 13, 1678, 6965, 787, 353, 2437, 29889, 3126, 580, 1839, 271, 29887, 5103, 2033, 13, 1678, 363, 432, 297, 3464, 29898, 29900, 29892, 2435, 29898, 1315, 787, 22164, 13, 268, 12, 7382, 353, 6965, 787, 29961, 29926, 29962, 13, 268, 12, 361, 29898, 7382, 1839, 29984, 1017, 2033, 1275, 6629, 1125, 13, 268, 12, 12, 7382, 1839, 29984, 1017, 2033, 353, 525, 29900, 29915, 13, 268, 12, 8977, 29961, 7382, 1839, 8899, 7061, 2033, 29962, 353, 5694, 1839, 29984, 1017, 2033, 13, 1678, 9657, 29879, 29889, 4397, 29898, 8977, 29897, 13, 1678, 1596, 29898, 710, 29898, 29896, 29900, 29900, 29930, 29875, 29914, 2435, 29898, 808, 5416, 1761, 876, 13578, 29995, 1159, 13, 13, 8000, 5852, 29901, 13, 1678, 363, 432, 297, 3464, 29898, 29900, 29892, 2435, 29898, 808, 5416, 1761, 22164, 13, 268, 12, 29937, 18829, 1546, 7274, 13, 268, 12, 2158, 877, 29941, 6923, 856, 1495, 13, 268, 12, 2230, 29889, 17059, 29898, 29941, 29897, 13, 268, 12, 4704, 1204, 353, 2071, 5416, 1761, 29961, 29926, 29962, 13, 268, 12, 2490, 1272, 353, 11117, 4704, 1204, 2396, 3234, 1204, 29892, 525, 4704, 5550, 29965, 29880, 299, 2396, 525, 3009, 3788, 29888, 485, 8899, 22099, 10074, 3788, 479, 324, 271, 4279, 2396, 710, 29898, 5479, 29889, 5066, 4279, 511, 29915, 479, 324, 549, 4279, 2396, 710, 29898, 5479, 29889, 5426, 4279, 2915, 13, 268, 12, 11569, 353, 7274, 29889, 2490, 29898, 2490, 2271, 29892, 1272, 29922, 2490, 1272, 29897, 13, 268, 12, 1315, 787, 353, 2437, 29889, 3126, 580, 1839, 271, 29887, 5103, 2033, 13, 268, 12, 1454, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 1315, 787, 22164, 13, 268, 12, 12, 7382, 353, 6965, 787, 29961, 29875, 29962, 13, 268, 12, 12, 361, 29898, 7382, 1839, 29984, 1017, 2033, 1275, 6629, 1125, 13, 268, 12, 12, 12, 7382, 1839, 29984, 1017, 2033, 353, 525, 29900, 29915, 13, 268, 12, 12, 361, 29898, 8977, 29879, 29961, 29926, 3816, 7382, 1839, 8899, 7061, 2033, 29962, 2804, 5694, 1839, 29984, 1017, 2033, 1125, 13, 268, 12, 12, 12, 2158, 703, 11102, 29901, 15691, 8977, 29879, 29961, 29926, 3816, 7382, 1839, 8899, 7061, 2033, 10062, 29908, 1286, 29901, 15691, 7382, 1839, 29984, 1017, 11287, 13, 268, 12, 12, 12, 29879, 1025, 353, 938, 29898, 8977, 29879, 29961, 29926, 3816, 7382, 1839, 8899, 7061, 2033, 2314, 448, 938, 29898, 7382, 1839, 29984, 1017, 11287, 13, 268, 12, 12, 12, 2158, 29898, 7382, 1839, 8899, 7061, 2033, 13578, 5239, 15691, 710, 29898, 29879, 1025, 29897, 718, 376, 310, 2944, 376, 718, 667, 1761, 29961, 29926, 2314, 13, 268, 12, 12, 12, 8977, 29879, 29961, 29926, 3816, 7382, 1839, 8899, 7061, 2033, 29962, 353, 5694, 1839, 29984, 1017, 2033, 13, 2 ]
Python/shortest-way-to-form-string.py
sm2774us/leetcode_interview_prep_2021
0
166110
<filename>Python/shortest-way-to-form-string.py # Time: O(m + n), m is the length of source # , n is the length of target # Space: O(m) # greedy solution class Solution(object): def shortestWay(self, source, target): """ :type source: str :type target: str :rtype: int """ lookup = [[None for _ in range(26)] for _ in range(len(source)+1)] find_char_next_pos = [None]*26 for i in reversed(range(len(source))): find_char_next_pos[ord(source[i])-ord('a')] = i+1 lookup[i] = list(find_char_next_pos) result, start = 1, 0 for c in target: start = lookup[start][ord(c)-ord('a')] if start != None: continue result += 1 start = lookup[0][ord(c)-ord('a')] if start == None: return -1 return result
[ 1, 529, 9507, 29958, 11980, 29914, 12759, 342, 29899, 1582, 29899, 517, 29899, 689, 29899, 1807, 29889, 2272, 13, 29937, 5974, 29901, 29871, 438, 29898, 29885, 718, 302, 511, 286, 338, 278, 3309, 310, 2752, 13, 29937, 18884, 1919, 302, 338, 278, 3309, 310, 3646, 13, 29937, 14121, 29901, 438, 29898, 29885, 29897, 13, 13, 29937, 1395, 7584, 1650, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 3273, 342, 29956, 388, 29898, 1311, 29892, 2752, 29892, 3646, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 2752, 29901, 851, 13, 4706, 584, 1853, 3646, 29901, 851, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 4706, 9995, 13, 4706, 16280, 353, 5519, 8516, 363, 903, 297, 3464, 29898, 29906, 29953, 4638, 363, 903, 297, 3464, 29898, 2435, 29898, 4993, 7240, 29896, 4638, 13, 4706, 1284, 29918, 3090, 29918, 4622, 29918, 1066, 353, 518, 8516, 14178, 29906, 29953, 13, 4706, 363, 474, 297, 18764, 287, 29898, 3881, 29898, 2435, 29898, 4993, 876, 1125, 13, 9651, 1284, 29918, 3090, 29918, 4622, 29918, 1066, 29961, 536, 29898, 4993, 29961, 29875, 2314, 29899, 536, 877, 29874, 1495, 29962, 353, 474, 29974, 29896, 13, 9651, 16280, 29961, 29875, 29962, 353, 1051, 29898, 2886, 29918, 3090, 29918, 4622, 29918, 1066, 29897, 13, 13, 4706, 1121, 29892, 1369, 353, 29871, 29896, 29892, 29871, 29900, 13, 4706, 363, 274, 297, 3646, 29901, 13, 9651, 1369, 353, 16280, 29961, 2962, 3816, 536, 29898, 29883, 6817, 536, 877, 29874, 1495, 29962, 13, 9651, 565, 1369, 2804, 6213, 29901, 13, 18884, 6773, 13, 9651, 1121, 4619, 29871, 29896, 13, 9651, 1369, 353, 16280, 29961, 29900, 3816, 536, 29898, 29883, 6817, 536, 877, 29874, 1495, 29962, 13, 9651, 565, 1369, 1275, 6213, 29901, 13, 18884, 736, 448, 29896, 13, 4706, 736, 1121, 13, 2 ]
amocrm_asterisk_ng/crm/amocrm/kernel/calls/call_records/file_converters/core/__init__.py
iqtek/amocrn_asterisk_ng
0
5702
from .IFileConverter import IFileConverter
[ 1, 515, 869, 29902, 2283, 18545, 1053, 306, 2283, 18545, 13, 2 ]
necromancer/cli/shell_command.py
SeedyROM/necromancer
0
174527
''' Usage: necro shell|s USER_COMMAND Options USER_COMMAND a command in the .necro.toml ''' from docopt import docopt if __name__ == '__main__': print(docopt(__doc__))
[ 1, 14550, 13, 27573, 29901, 452, 24077, 6473, 29989, 29879, 3148, 1001, 29918, 19795, 1529, 2797, 13, 13, 5856, 13, 1678, 3148, 1001, 29918, 19795, 1529, 2797, 4706, 263, 1899, 297, 278, 869, 484, 24077, 29889, 15135, 29880, 13, 12008, 13, 13, 3166, 437, 1111, 415, 1053, 437, 1111, 415, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1596, 29898, 1514, 3670, 22168, 1514, 1649, 876, 13, 2 ]
implementation/h2o-fakegame/h2o-py/h2o/model/multinomial.py
kordikp/AutoMLprediction
1
87156
<reponame>kordikp/AutoMLprediction from builtins import zip from ..frame import H2OFrame from ..h2o import H2OConnection from .model_base import ModelBase class H2OMultinomialModel(ModelBase): def _make_model(self): return H2OMultinomialModel() def confusion_matrix(self, data): """ Returns a confusion matrix based of H2O's default prediction threshold for a dataset """ if not isinstance(data, H2OFrame): raise ValueError("data argument must be of type H2OFrame, but got {0}" .format(type(data))) j = H2OConnection.post_json("Predictions/models/" + self._id + "/frames/" + data.frame_id) return j["model_metrics"][0]["cm"]["table"] def hit_ratio_table(self, train=False, valid=False, xval=False): """ Retrieve the Hit Ratios If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are "train", "valid", and "xval" :param train: If train is True, then return the R^2 value for the training data. :param valid: If valid is True, then return the R^2 value for the validation data. :param xval: If xval is True, then return the R^2 value for the cross validation data. :return: The R^2 for this regression model. """ tm = ModelBase._get_metrics(self, train, valid, xval) m = {} for k,v in zip(list(tm.keys()),list(tm.values())): m[k] = None if v is None else v.hit_ratio_table() return list(m.values())[0] if len(m) == 1 else m def mean_per_class_error(self, train=False, valid=False, xval=False): """ Retrieve the mean per class error across all classes If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are "train", "valid", and "xval" Parameters ---------- train : bool, optional If True, return the mean_per_class_error value for the training data. valid : bool, optional If True, return the mean_per_class_error value for the validation data. xval : bool, optional If True, return the mean_per_class_error value for each of the cross-validated splits. Returns ------- The mean_per_class_error values for the specified key(s). """ tm = ModelBase._get_metrics(self, train, valid, xval) m = {} for k,v in zip(list(tm.keys()),list(tm.values())): m[k] = None if v is None else v.mean_per_class_error() return list(m.values())[0] if len(m) == 1 else m def plot(self, timestep="AUTO", metric="AUTO", **kwargs): """ Plots training set (and validation set if available) scoring history for an H2OMultinomialModel. The timestep and metric arguments are restricted to what is available in its scoring history. :param timestep: A unit of measurement for the x-axis. :param metric: A unit of measurement for the y-axis. :return: A scoring history plot. """ if self._model_json["algo"] in ("deeplearning", "drf", "gbm"): if metric == "AUTO": metric = "classification_error" elif metric not in ("logloss","classification_error","MSE"): raise ValueError("metric for H2OMultinomialModel must be one of: AUTO, logloss, classification_error, MSE") self._plot(timestep=timestep, metric=metric, **kwargs)
[ 1, 529, 276, 1112, 420, 29958, 29619, 638, 29886, 29914, 12300, 1988, 11965, 2463, 13, 3166, 4240, 1144, 1053, 14319, 13, 3166, 6317, 2557, 1053, 379, 29906, 29949, 4308, 13, 3166, 6317, 29882, 29906, 29877, 1053, 379, 29906, 29949, 5350, 13, 3166, 869, 4299, 29918, 3188, 1053, 8125, 5160, 13, 13, 1990, 379, 29906, 6488, 499, 262, 7615, 3195, 29898, 3195, 5160, 1125, 13, 13, 29871, 822, 903, 5675, 29918, 4299, 29898, 1311, 1125, 13, 1678, 736, 379, 29906, 6488, 499, 262, 7615, 3195, 580, 13, 13, 29871, 822, 14679, 29918, 5344, 29898, 1311, 29892, 848, 1125, 13, 1678, 9995, 13, 1678, 16969, 263, 14679, 4636, 2729, 310, 379, 29906, 29949, 29915, 29879, 2322, 18988, 16897, 363, 263, 8783, 13, 1678, 9995, 13, 1678, 565, 451, 338, 8758, 29898, 1272, 29892, 379, 29906, 29949, 4308, 1125, 12020, 7865, 2392, 703, 1272, 2980, 1818, 367, 310, 1134, 379, 29906, 29949, 4308, 29892, 541, 2355, 426, 29900, 5038, 13, 462, 462, 462, 4706, 869, 4830, 29898, 1853, 29898, 1272, 4961, 13, 1678, 432, 353, 379, 29906, 29949, 5350, 29889, 2490, 29918, 3126, 703, 23084, 919, 1080, 29914, 9794, 12975, 718, 1583, 3032, 333, 718, 5591, 19935, 12975, 718, 848, 29889, 2557, 29918, 333, 29897, 13, 1678, 736, 432, 3366, 4299, 29918, 2527, 10817, 3108, 29961, 29900, 29962, 3366, 4912, 3108, 3366, 2371, 3108, 13, 13, 29871, 822, 7124, 29918, 3605, 601, 29918, 2371, 29898, 1311, 29892, 7945, 29922, 8824, 29892, 2854, 29922, 8824, 29892, 921, 791, 29922, 8824, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 278, 14309, 390, 2219, 359, 13, 13, 1678, 960, 599, 526, 7700, 313, 4381, 511, 769, 736, 278, 6694, 12714, 995, 29889, 13, 1678, 960, 901, 1135, 697, 3987, 338, 731, 304, 5852, 29892, 769, 736, 263, 8600, 310, 21556, 988, 278, 6611, 526, 376, 14968, 613, 376, 3084, 613, 13, 1678, 322, 376, 29916, 791, 29908, 13, 13, 1678, 584, 3207, 7945, 29901, 960, 7945, 338, 5852, 29892, 769, 736, 278, 390, 29985, 29906, 995, 363, 278, 6694, 848, 29889, 13, 1678, 584, 3207, 2854, 29901, 960, 2854, 338, 5852, 29892, 769, 736, 278, 390, 29985, 29906, 995, 363, 278, 8845, 848, 29889, 13, 1678, 584, 3207, 921, 791, 29901, 29871, 960, 921, 791, 338, 5852, 29892, 769, 736, 278, 390, 29985, 29906, 995, 363, 278, 4891, 8845, 848, 29889, 13, 1678, 584, 2457, 29901, 450, 390, 29985, 29906, 363, 445, 17855, 1904, 29889, 13, 1678, 9995, 13, 1678, 27702, 353, 8125, 5160, 3032, 657, 29918, 2527, 10817, 29898, 1311, 29892, 7945, 29892, 2854, 29892, 921, 791, 29897, 13, 1678, 286, 353, 6571, 13, 1678, 363, 413, 29892, 29894, 297, 14319, 29898, 1761, 29898, 18276, 29889, 8149, 25739, 1761, 29898, 18276, 29889, 5975, 22130, 29901, 286, 29961, 29895, 29962, 353, 6213, 565, 325, 338, 6213, 1683, 325, 29889, 27342, 29918, 3605, 601, 29918, 2371, 580, 13, 1678, 736, 1051, 29898, 29885, 29889, 5975, 3101, 29961, 29900, 29962, 565, 7431, 29898, 29885, 29897, 1275, 29871, 29896, 1683, 286, 13, 13, 13, 29871, 822, 2099, 29918, 546, 29918, 1990, 29918, 2704, 29898, 1311, 29892, 7945, 29922, 8824, 29892, 2854, 29922, 8824, 29892, 921, 791, 29922, 8824, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 278, 2099, 639, 770, 1059, 4822, 599, 4413, 13, 13, 1678, 960, 599, 526, 7700, 313, 4381, 511, 769, 736, 278, 6694, 12714, 995, 29889, 13, 1678, 960, 901, 1135, 697, 3987, 338, 731, 304, 5852, 29892, 769, 736, 263, 8600, 310, 21556, 988, 278, 6611, 526, 376, 14968, 613, 376, 3084, 613, 13, 1678, 322, 376, 29916, 791, 29908, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 418, 7945, 584, 6120, 29892, 13136, 13, 4706, 960, 5852, 29892, 736, 278, 2099, 29918, 546, 29918, 1990, 29918, 2704, 995, 363, 278, 6694, 848, 29889, 13, 13, 418, 2854, 584, 6120, 29892, 13136, 13, 4706, 960, 5852, 29892, 736, 278, 2099, 29918, 546, 29918, 1990, 29918, 2704, 995, 363, 278, 8845, 848, 29889, 13, 13, 418, 921, 791, 584, 6120, 29892, 13136, 13, 4706, 960, 5852, 29892, 736, 278, 2099, 29918, 546, 29918, 1990, 29918, 2704, 995, 363, 1269, 310, 278, 4891, 29899, 3084, 630, 8536, 1169, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 418, 450, 2099, 29918, 546, 29918, 1990, 29918, 2704, 1819, 363, 278, 6790, 1820, 29898, 29879, 467, 13, 1678, 9995, 13, 1678, 27702, 353, 8125, 5160, 3032, 657, 29918, 2527, 10817, 29898, 1311, 29892, 7945, 29892, 2854, 29892, 921, 791, 29897, 13, 1678, 286, 353, 6571, 13, 1678, 363, 413, 29892, 29894, 297, 14319, 29898, 1761, 29898, 18276, 29889, 8149, 25739, 1761, 29898, 18276, 29889, 5975, 22130, 29901, 286, 29961, 29895, 29962, 353, 6213, 565, 325, 338, 6213, 1683, 325, 29889, 12676, 29918, 546, 29918, 1990, 29918, 2704, 580, 13, 1678, 736, 1051, 29898, 29885, 29889, 5975, 3101, 29961, 29900, 29962, 565, 7431, 29898, 29885, 29897, 1275, 29871, 29896, 1683, 286, 13, 13, 29871, 822, 6492, 29898, 1311, 29892, 5335, 342, 1022, 543, 20656, 29949, 613, 12714, 543, 20656, 29949, 613, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 1858, 1862, 6694, 731, 313, 392, 8845, 731, 565, 3625, 29897, 26654, 4955, 363, 385, 379, 29906, 6488, 499, 262, 7615, 3195, 29889, 450, 5335, 342, 1022, 322, 12714, 13, 1678, 6273, 526, 22078, 304, 825, 338, 3625, 297, 967, 26654, 4955, 29889, 13, 13, 1678, 584, 3207, 5335, 342, 1022, 29901, 319, 5190, 310, 20039, 363, 278, 921, 29899, 8990, 29889, 13, 1678, 584, 3207, 12714, 29901, 319, 5190, 310, 20039, 363, 278, 343, 29899, 8990, 29889, 13, 1678, 584, 2457, 29901, 319, 26654, 4955, 6492, 29889, 13, 1678, 9995, 13, 13, 1678, 565, 1583, 3032, 4299, 29918, 3126, 3366, 284, 1484, 3108, 297, 4852, 311, 29872, 552, 5699, 613, 376, 7707, 29888, 613, 376, 29887, 5838, 29908, 1125, 13, 418, 565, 12714, 1275, 376, 20656, 29949, 1115, 12714, 353, 376, 1990, 2450, 29918, 2704, 29908, 13, 418, 25342, 12714, 451, 297, 4852, 1188, 6758, 3284, 1990, 2450, 29918, 2704, 3284, 29924, 1660, 29908, 1125, 13, 4706, 12020, 7865, 2392, 703, 16414, 363, 379, 29906, 6488, 499, 262, 7615, 3195, 1818, 367, 697, 310, 29901, 26524, 29949, 29892, 1480, 6758, 29892, 12965, 29918, 2704, 29892, 341, 1660, 1159, 13, 13, 1678, 1583, 3032, 5317, 29898, 9346, 342, 1022, 29922, 9346, 342, 1022, 29892, 12714, 29922, 16414, 29892, 3579, 19290, 29897, 13, 2 ]
investing_algorithm_framework/views/utils.py
coding-kitties/investing-algorithm-framework
9
156680
from flask import jsonify def normalize_query_param(value): """ Given a non-flattened query parameter value, and if the value is a list only containing 1 item, then the value is flattened. :param value: a value from a query parameter :return: a normalized query parameter value """ if len(value) == 1 and value[0].lower() in ["true", "false"]: if value[0].lower() == "true": return True return False return value if len(value) > 1 else value[0] def normalize_query(params): """ Converts query parameters from only containing one value for each parameter, to include parameters with multiple values as lists. :param params: a flask query parameters data_provider structure :return: a dict of normalized query parameters """ params_non_flat = params.to_dict(flat=False) return {k: normalize_query_param(v) for k, v in params_non_flat.items()} def create_paginated_response(query_set, serializer): """ Creates a paginated response from a query set. The given query set is paginated the function. :param query_set: a lazy query :param serializer: an instance of an marshmallow schema :return: a json of paginated query """ paginated_query_set = query_set.paginate() return jsonify( { 'total': paginated_query_set.total, 'page': paginated_query_set.page, 'per_page': paginated_query_set.per_page, 'items': serializer.dump(paginated_query_set.items, many=True) } )
[ 1, 515, 29784, 1053, 4390, 1598, 13, 13, 13, 1753, 4226, 675, 29918, 1972, 29918, 3207, 29898, 1767, 1125, 13, 1678, 9995, 13, 1678, 11221, 263, 1661, 29899, 1579, 8606, 287, 2346, 3443, 995, 29892, 13, 1678, 322, 565, 278, 995, 338, 263, 1051, 871, 6943, 29871, 29896, 2944, 29892, 13, 1678, 769, 278, 995, 338, 1652, 8606, 287, 29889, 13, 13, 1678, 584, 3207, 995, 29901, 263, 995, 515, 263, 2346, 3443, 13, 1678, 584, 2457, 29901, 263, 4226, 1891, 2346, 3443, 995, 13, 1678, 9995, 13, 13, 1678, 565, 7431, 29898, 1767, 29897, 1275, 29871, 29896, 322, 995, 29961, 29900, 1822, 13609, 580, 297, 6796, 3009, 613, 376, 4541, 3108, 29901, 13, 13, 4706, 565, 995, 29961, 29900, 1822, 13609, 580, 1275, 376, 3009, 1115, 13, 9651, 736, 5852, 13, 4706, 736, 7700, 13, 13, 1678, 736, 995, 565, 7431, 29898, 1767, 29897, 1405, 29871, 29896, 1683, 995, 29961, 29900, 29962, 13, 13, 13, 1753, 4226, 675, 29918, 1972, 29898, 7529, 1125, 13, 1678, 9995, 13, 1678, 1281, 369, 1372, 2346, 4128, 515, 871, 6943, 697, 995, 363, 1269, 3443, 29892, 13, 1678, 304, 3160, 4128, 411, 2999, 1819, 408, 8857, 29889, 13, 13, 1678, 584, 3207, 8636, 29901, 263, 29784, 2346, 4128, 848, 29918, 18121, 3829, 13, 1678, 584, 2457, 29901, 263, 9657, 310, 4226, 1891, 2346, 4128, 13, 1678, 9995, 13, 1678, 8636, 29918, 5464, 29918, 20620, 353, 8636, 29889, 517, 29918, 8977, 29898, 20620, 29922, 8824, 29897, 13, 1678, 736, 426, 29895, 29901, 4226, 675, 29918, 1972, 29918, 3207, 29898, 29894, 29897, 363, 413, 29892, 325, 297, 8636, 29918, 5464, 29918, 20620, 29889, 7076, 28296, 13, 13, 13, 1753, 1653, 29918, 13573, 262, 630, 29918, 5327, 29898, 1972, 29918, 842, 29892, 7797, 3950, 1125, 13, 1678, 9995, 13, 1678, 6760, 1078, 263, 10203, 262, 630, 2933, 515, 263, 2346, 731, 29889, 450, 2183, 2346, 731, 13, 1678, 338, 10203, 262, 630, 278, 740, 29889, 13, 13, 1678, 584, 3207, 2346, 29918, 842, 29901, 263, 17366, 2346, 13, 1678, 584, 3207, 7797, 3950, 29901, 385, 2777, 310, 385, 1766, 845, 29885, 9536, 10938, 13, 1678, 584, 2457, 29901, 263, 4390, 310, 10203, 262, 630, 2346, 13, 1678, 9995, 13, 1678, 10203, 262, 630, 29918, 1972, 29918, 842, 353, 2346, 29918, 842, 29889, 13573, 16976, 580, 13, 13, 1678, 736, 4390, 1598, 29898, 13, 4706, 426, 13, 9651, 525, 7827, 2396, 10203, 262, 630, 29918, 1972, 29918, 842, 29889, 7827, 29892, 13, 9651, 525, 3488, 2396, 10203, 262, 630, 29918, 1972, 29918, 842, 29889, 3488, 29892, 13, 9651, 525, 546, 29918, 3488, 2396, 10203, 262, 630, 29918, 1972, 29918, 842, 29889, 546, 29918, 3488, 29892, 13, 9651, 525, 7076, 2396, 7797, 3950, 29889, 15070, 29898, 13573, 262, 630, 29918, 1972, 29918, 842, 29889, 7076, 29892, 1784, 29922, 5574, 29897, 13, 4706, 500, 13, 1678, 1723, 13, 2 ]
publications/ECSO2017/poissonvspsra.py
clancia/air-traffic-data-driven-modelling
0
61746
import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set(context='talk') palette = sns.color_palette() beta = 1 landa = 1./beta reps = 25 pois = np.random.exponential(beta, reps) pois = pois.cumsum() psra = np.arange(reps)*beta + np.random.exponential(beta, reps) - landa psra.sort() f, ax = plt.subplots(1, 2, sharex=True, figsize=(24, 10)) yy = np.arange(reps) + 1 for x, y in zip(pois, yy): ax[0].plot([x, x], [0, y], c=palette[0], ls='--', lw=2) ax[0].step(pois, yy, lw=5) ax[0].scatter(pois, np.zeros(reps)) ax[0].set_title(r'Poisson arrivals, $\lambda$ = {:.1f}'.format(landa)) ax[0].set_xlabel('time') ax[0].set_ylabel('count') for x, y in zip(psra, yy): ax[1].plot([x, x], [0, y], c=palette[0], ls='--', lw=2) ax[1].step(psra, yy, lw=5) ax[1].scatter(psra, np.zeros(reps)) title = r'Pre-scheduled random arrivals, $\sigma$ = {:.1f}'.format(landa) ax[1].set_title(title) ax[1].set_xlabel('time') plt.savefig('pois_psra.png')
[ 1, 1053, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 409, 370, 1398, 408, 269, 1983, 13, 13, 29879, 1983, 29889, 842, 29898, 4703, 2433, 29873, 2235, 1495, 13, 29886, 26456, 353, 269, 1983, 29889, 2780, 29918, 29886, 26456, 580, 13, 13, 3571, 353, 29871, 29896, 13, 25241, 353, 29871, 29896, 6904, 3571, 13, 276, 567, 353, 29871, 29906, 29945, 13, 13, 17376, 353, 7442, 29889, 8172, 29889, 735, 1112, 2556, 29898, 3571, 29892, 337, 567, 29897, 13, 17376, 353, 772, 275, 29889, 29883, 398, 2083, 580, 13, 13, 567, 336, 353, 7442, 29889, 279, 927, 29898, 276, 567, 11877, 3571, 718, 7442, 29889, 8172, 29889, 735, 1112, 2556, 29898, 3571, 29892, 337, 567, 29897, 448, 2982, 29874, 13, 567, 336, 29889, 6605, 580, 13, 13, 29888, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 29896, 29892, 29871, 29906, 29892, 6232, 29916, 29922, 5574, 29892, 2537, 2311, 7607, 29906, 29946, 29892, 29871, 29896, 29900, 876, 13, 13, 8071, 353, 7442, 29889, 279, 927, 29898, 276, 567, 29897, 718, 29871, 29896, 13, 13, 1454, 921, 29892, 343, 297, 14319, 29898, 17376, 29892, 343, 29891, 1125, 13, 1678, 4853, 29961, 29900, 1822, 5317, 4197, 29916, 29892, 921, 1402, 518, 29900, 29892, 343, 1402, 274, 29922, 29886, 26456, 29961, 29900, 1402, 19375, 2433, 489, 742, 301, 29893, 29922, 29906, 29897, 13, 1165, 29961, 29900, 1822, 10568, 29898, 17376, 29892, 343, 29891, 29892, 301, 29893, 29922, 29945, 29897, 13, 1165, 29961, 29900, 1822, 1557, 2620, 29898, 17376, 29892, 7442, 29889, 3298, 359, 29898, 276, 567, 876, 13, 1165, 29961, 29900, 1822, 842, 29918, 3257, 29898, 29878, 29915, 9837, 17387, 18517, 29879, 29892, 779, 2892, 29938, 353, 12365, 29889, 29896, 29888, 29913, 4286, 4830, 29898, 25241, 876, 13, 1165, 29961, 29900, 1822, 842, 29918, 29916, 1643, 877, 2230, 1495, 13, 1165, 29961, 29900, 1822, 842, 29918, 29891, 1643, 877, 2798, 1495, 13, 13, 1454, 921, 29892, 343, 297, 14319, 29898, 567, 336, 29892, 343, 29891, 1125, 13, 1678, 4853, 29961, 29896, 1822, 5317, 4197, 29916, 29892, 921, 1402, 518, 29900, 29892, 343, 1402, 274, 29922, 29886, 26456, 29961, 29900, 1402, 19375, 2433, 489, 742, 301, 29893, 29922, 29906, 29897, 13, 1165, 29961, 29896, 1822, 10568, 29898, 567, 336, 29892, 343, 29891, 29892, 301, 29893, 29922, 29945, 29897, 13, 1165, 29961, 29896, 1822, 1557, 2620, 29898, 567, 336, 29892, 7442, 29889, 3298, 359, 29898, 276, 567, 876, 13, 3257, 353, 364, 29915, 6572, 29899, 816, 14989, 4036, 18517, 29879, 29892, 779, 3754, 29938, 353, 12365, 29889, 29896, 29888, 29913, 4286, 4830, 29898, 25241, 29897, 13, 1165, 29961, 29896, 1822, 842, 29918, 3257, 29898, 3257, 29897, 13, 1165, 29961, 29896, 1822, 842, 29918, 29916, 1643, 877, 2230, 1495, 13, 13, 572, 29873, 29889, 7620, 1003, 877, 17376, 29918, 567, 336, 29889, 2732, 1495, 13, 2 ]
python/my_custard.py
ensan-hcl/CustardKit
1
73049
<filename>python/my_custard.py from source.custard import * custard = Custard( identifier="my_custard", language=Language.ja_JP, input_style=InputStyle.direct, metadata=Metadata( custard_version="1.0", display_name="私のカスタード", ), interface=Interface( key_style=KeyStyle.tenkey_style, key_layout=GridFitLayout(row_count=2, column_count=2), keys=[ KeyData( specifier=GridFitSpecifier(x=0, y=0), key=SystemKey(SystemKeyType.change_keyboard) ), KeyData( specifier=GridFitSpecifier(x=0, y=1), key=CustomKey( design=KeyDesign( label=TextLabel(text="あ"), color=KeyColor.normal ), press_actions=[], longpress_actions=LongpressAction( start=[ DeleteAction(1), ] ), variations=[ FlickVariationData( direction=FlickDirection.left, key=Variation( design=VariationDesign( label=TextLabel(text="い"), ), press_actions=[ InputAction("い") ], longpress_actions=LongpressAction() ) ) ] ) ), KeyData( specifier=GridFitSpecifier(x=1, y=0), key=CustomKey( design=KeyDesign( label=TextLabel(text="あ"), color=KeyColor.normal ), press_actions=[], longpress_actions=LongpressAction( start=[ DeleteAction(1), ] ), variations=[ FlickVariationData( direction=FlickDirection.left, key=Variation( design=VariationDesign( label=TextLabel(text="い"), ), press_actions=[ InputAction("い") ], ) ) ] ) ), KeyData( specifier=GridFitSpecifier(x=1, y=1), key=CustomKey( design=KeyDesign( label=TextLabel(text="あ"), color=KeyColor.normal ), press_actions=[], longpress_actions=LongpressAction( start=[ DeleteAction(1), ] ), variations=[ FlickVariationData( direction=FlickDirection.left, key=Variation( design=VariationDesign( label=TextLabel(text="い"), ), press_actions=[ InputAction("い") ], ) ) ] ) ), ] ) ) custard.write(name="my_custard")
[ 1, 529, 9507, 29958, 4691, 29914, 1357, 29918, 29883, 504, 538, 29889, 2272, 13, 3166, 2752, 29889, 29883, 504, 538, 1053, 334, 13, 13, 29883, 504, 538, 353, 315, 504, 538, 29898, 13, 1678, 15882, 543, 1357, 29918, 29883, 504, 538, 613, 13, 1678, 4086, 29922, 21233, 29889, 1764, 29918, 29967, 29925, 29892, 13, 1678, 1881, 29918, 3293, 29922, 4290, 5568, 29889, 11851, 29892, 13, 1678, 15562, 29922, 18417, 29898, 13, 4706, 25387, 538, 29918, 3259, 543, 29896, 29889, 29900, 613, 13, 4706, 2479, 29918, 978, 543, 234, 170, 132, 30199, 30439, 30255, 30369, 30185, 30335, 613, 13, 1678, 10353, 13, 1678, 5067, 29922, 10448, 29898, 13, 4706, 1820, 29918, 3293, 29922, 2558, 5568, 29889, 841, 1989, 29918, 3293, 29892, 13, 4706, 1820, 29918, 2680, 29922, 5756, 29943, 277, 3453, 29898, 798, 29918, 2798, 29922, 29906, 29892, 1897, 29918, 2798, 29922, 29906, 511, 13, 4706, 6611, 11759, 13, 9651, 7670, 1469, 29898, 13, 18884, 1580, 3709, 29922, 5756, 29943, 277, 10299, 3709, 29898, 29916, 29922, 29900, 29892, 343, 29922, 29900, 511, 13, 18884, 1820, 29922, 3924, 2558, 29898, 3924, 2558, 1542, 29889, 3167, 29918, 1989, 3377, 29897, 13, 9651, 10353, 13, 9651, 7670, 1469, 29898, 13, 18884, 1580, 3709, 29922, 5756, 29943, 277, 10299, 3709, 29898, 29916, 29922, 29900, 29892, 343, 29922, 29896, 511, 13, 18884, 1820, 29922, 7281, 2558, 29898, 13, 462, 1678, 2874, 29922, 2558, 4002, 647, 29898, 13, 462, 4706, 3858, 29922, 1626, 4775, 29898, 726, 543, 30641, 4968, 13, 462, 4706, 2927, 29922, 2558, 3306, 29889, 8945, 13, 462, 1678, 10353, 13, 462, 1678, 3965, 29918, 7387, 11759, 1402, 13, 462, 1678, 1472, 2139, 29918, 7387, 29922, 8208, 2139, 4276, 29898, 13, 462, 4706, 1369, 11759, 13, 462, 9651, 21267, 4276, 29898, 29896, 511, 13, 462, 4706, 4514, 13, 462, 1678, 10353, 13, 462, 1678, 21833, 11759, 13, 462, 4706, 383, 1406, 10444, 362, 1469, 29898, 13, 462, 9651, 5305, 29922, 29943, 1406, 21602, 29889, 1563, 29892, 13, 462, 9651, 1820, 29922, 10444, 362, 29898, 13, 462, 18884, 2874, 29922, 10444, 362, 4002, 647, 29898, 13, 462, 462, 1678, 3858, 29922, 1626, 4775, 29898, 726, 543, 30298, 4968, 13, 462, 18884, 10353, 13, 462, 18884, 3965, 29918, 7387, 11759, 13, 462, 462, 1678, 10567, 4276, 703, 30298, 1159, 13, 462, 18884, 21251, 13, 462, 18884, 1472, 2139, 29918, 7387, 29922, 8208, 2139, 4276, 580, 13, 462, 9651, 1723, 13, 462, 4706, 1723, 13, 462, 1678, 4514, 13, 18884, 1723, 13, 9651, 10353, 13, 13, 9651, 7670, 1469, 29898, 13, 18884, 1580, 3709, 29922, 5756, 29943, 277, 10299, 3709, 29898, 29916, 29922, 29896, 29892, 343, 29922, 29900, 511, 13, 18884, 1820, 29922, 7281, 2558, 29898, 13, 462, 1678, 2874, 29922, 2558, 4002, 647, 29898, 13, 462, 4706, 3858, 29922, 1626, 4775, 29898, 726, 543, 30641, 4968, 13, 462, 4706, 2927, 29922, 2558, 3306, 29889, 8945, 13, 462, 1678, 10353, 13, 462, 1678, 3965, 29918, 7387, 11759, 1402, 13, 462, 1678, 1472, 2139, 29918, 7387, 29922, 8208, 2139, 4276, 29898, 13, 462, 4706, 1369, 11759, 13, 462, 9651, 21267, 4276, 29898, 29896, 511, 13, 462, 4706, 4514, 13, 462, 1678, 10353, 13, 462, 1678, 21833, 11759, 13, 462, 4706, 383, 1406, 10444, 362, 1469, 29898, 13, 462, 9651, 5305, 29922, 29943, 1406, 21602, 29889, 1563, 29892, 13, 462, 9651, 1820, 29922, 10444, 362, 29898, 13, 462, 18884, 2874, 29922, 10444, 362, 4002, 647, 29898, 13, 462, 462, 1678, 3858, 29922, 1626, 4775, 29898, 726, 543, 30298, 4968, 13, 462, 18884, 10353, 13, 462, 18884, 3965, 29918, 7387, 11759, 13, 462, 462, 1678, 10567, 4276, 703, 30298, 1159, 13, 462, 18884, 21251, 13, 462, 9651, 1723, 13, 462, 4706, 1723, 13, 462, 1678, 4514, 13, 18884, 1723, 13, 9651, 10353, 13, 13, 9651, 7670, 1469, 29898, 13, 18884, 1580, 3709, 29922, 5756, 29943, 277, 10299, 3709, 29898, 29916, 29922, 29896, 29892, 343, 29922, 29896, 511, 13, 18884, 1820, 29922, 7281, 2558, 29898, 13, 462, 1678, 2874, 29922, 2558, 4002, 647, 29898, 13, 462, 4706, 3858, 29922, 1626, 4775, 29898, 726, 543, 30641, 4968, 13, 462, 4706, 2927, 29922, 2558, 3306, 29889, 8945, 13, 462, 1678, 10353, 13, 462, 1678, 3965, 29918, 7387, 11759, 1402, 13, 462, 1678, 1472, 2139, 29918, 7387, 29922, 8208, 2139, 4276, 29898, 13, 462, 4706, 1369, 11759, 13, 462, 9651, 21267, 4276, 29898, 29896, 511, 13, 462, 4706, 4514, 13, 462, 1678, 10353, 13, 462, 1678, 21833, 11759, 13, 462, 4706, 383, 1406, 10444, 362, 1469, 29898, 13, 462, 9651, 5305, 29922, 29943, 1406, 21602, 29889, 1563, 29892, 13, 462, 9651, 1820, 29922, 10444, 362, 29898, 13, 462, 18884, 2874, 29922, 10444, 362, 4002, 647, 29898, 13, 462, 462, 1678, 3858, 29922, 1626, 4775, 29898, 726, 543, 30298, 4968, 13, 462, 18884, 10353, 13, 462, 18884, 3965, 29918, 7387, 11759, 13, 462, 462, 1678, 10567, 4276, 703, 30298, 1159, 13, 462, 18884, 21251, 13, 462, 9651, 1723, 13, 462, 4706, 1723, 13, 462, 1678, 4514, 13, 18884, 1723, 13, 9651, 10353, 13, 4706, 4514, 13, 1678, 1723, 13, 29897, 13, 13, 29883, 504, 538, 29889, 3539, 29898, 978, 543, 1357, 29918, 29883, 504, 538, 1159, 13, 2 ]
PythonExercicios/ex062.py
VitorFRodrigues/Python-curso
0
174163
print('{:=^40}'.format(' Progressão Aritmética ')) primeiro = int(input('Digite o primeiro valor da PA: ')) razao = int(input('Digite a razão da PA: ')) print('Os 10 primeiros termos da progressão serão: ', end=' ') cont = 0 termos = 10 while cont != termos: proximo = primeiro+razao*cont print(proximo, end=' -> ') cont += 1 if cont == termos: print('') aux = int(input('Você quer que mostre mais termos? Digite 0 se não quiser: ')) termos += aux print('ACABOU! A progressão foi finalizada com {} termos exibidos.'.format(termos))
[ 1, 1596, 877, 29912, 9361, 29985, 29946, 29900, 29913, 4286, 4830, 877, 20018, 1368, 319, 768, 29885, 24142, 525, 876, 13, 10080, 3350, 353, 938, 29898, 2080, 877, 14991, 568, 288, 19695, 16497, 1146, 17687, 29901, 525, 876, 13, 336, 1362, 29877, 353, 938, 29898, 2080, 877, 14991, 568, 263, 8006, 1368, 1146, 17687, 29901, 525, 876, 13, 2158, 877, 24768, 29871, 29896, 29900, 6019, 17177, 1840, 359, 1146, 6728, 1368, 724, 1368, 29901, 13420, 1095, 2433, 25710, 13, 13, 1285, 353, 29871, 29900, 13, 357, 7681, 353, 29871, 29896, 29900, 13, 8000, 640, 2804, 1840, 359, 29901, 13, 1678, 23203, 29877, 353, 19695, 29974, 336, 1362, 29877, 29930, 1285, 13, 1678, 1596, 29898, 771, 29761, 29892, 1095, 2433, 1599, 25710, 13, 1678, 640, 4619, 29871, 29896, 13, 1678, 565, 640, 1275, 1840, 359, 29901, 13, 4706, 1596, 877, 1495, 13, 4706, 3479, 353, 938, 29898, 2080, 877, 29963, 542, 30037, 22320, 712, 1556, 276, 3503, 1840, 359, 29973, 10951, 568, 29871, 29900, 409, 8145, 439, 7608, 29901, 525, 876, 13, 4706, 1840, 359, 4619, 3479, 13, 2158, 877, 2477, 2882, 27269, 29991, 319, 6728, 1368, 4732, 2186, 18954, 419, 6571, 1840, 359, 429, 747, 4396, 29889, 4286, 4830, 29898, 357, 7681, 876, 13, 2 ]
xsearch/__init__.py
e2dubba/py-xsearch
0
1607201
<gh_stars>0 from .xsearch import *
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 869, 29916, 4478, 1053, 334, 13, 2 ]
tests/test_FileReader.py
llj0824/nycMap
0
137565
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from nycmap.util import FileReader TEST_CSV_FILE = 'data/rollingsales_queensSample.csv' TEST_COLUMN = "NEIGHBORHOOD" def testParseExcelFile_correctSize(): df = FileReader.parseCsvFile(TEST_CSV_FILE) assert df[TEST_COLUMN].size == 60
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 11451, 1688, 13, 3166, 7098, 29883, 1958, 29889, 4422, 1053, 3497, 6982, 13, 13, 18267, 29918, 29907, 7597, 29918, 7724, 353, 525, 1272, 29914, 1245, 886, 2122, 29918, 802, 575, 17708, 29889, 7638, 29915, 13, 18267, 29918, 15032, 29127, 353, 376, 8186, 6259, 29950, 29933, 1955, 8187, 13668, 29908, 13, 13, 1753, 1243, 12914, 22926, 2283, 29918, 15728, 3505, 7295, 13, 1678, 4489, 353, 3497, 6982, 29889, 5510, 29907, 4501, 2283, 29898, 18267, 29918, 29907, 7597, 29918, 7724, 29897, 13, 1678, 4974, 4489, 29961, 18267, 29918, 15032, 29127, 1822, 2311, 1275, 29871, 29953, 29900, 13, 2 ]
tests/base/test_endpoints_authentication.py
rapydo/http-api
8
18494
from restapi.connectors import Connector from restapi.env import Env from restapi.services.authentication import BaseAuthentication, Role from restapi.tests import API_URI, BaseTests, FlaskClient from restapi.utilities.logs import log class TestApp(BaseTests): def test_no_auth(self, client: FlaskClient) -> None: r = client.get(f"{API_URI}/tests/noauth") assert r.status_code == 200 assert self.get_content(r) == "OK" if Env.get_bool("AUTH_ENABLE"): headers, _ = self.do_login(client, None, None) # Tokens are ignored r = client.get(f"{API_URI}/tests/noauth", headers=headers) assert r.status_code == 200 assert self.get_content(r) == "OK" # Tokens are ignored even if invalid r = client.get( f"{API_URI}/tests/noauth", headers={"Authorization": "Bearer invalid"} ) assert r.status_code == 200 assert self.get_content(r) == "OK" def test_auth(self, client: FlaskClient) -> None: if not Env.get_bool("AUTH_ENABLE"): log.warning("Skipping authentication tests") return r = client.get(f"{API_URI}/tests/authentication") assert r.status_code == 401 r = client.get( f"{API_URI}/tests/authentication", headers={"Authorization": "Bearer invalid"}, ) assert r.status_code == 401 headers, token = self.do_login(client, None, None) r = client.get(f"{API_URI}/tests/authentication", headers=headers) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == BaseAuthentication.default_user if not Env.get_bool("ALLOW_ACCESS_TOKEN_PARAMETER"): # access token parameter is not allowed by default r = client.get( f"{API_URI}/tests/authentication", query_string={"access_token": token} ) assert r.status_code == 401 def test_optional_auth(self, client: FlaskClient) -> None: if not Env.get_bool("AUTH_ENABLE"): log.warning("Skipping authentication tests") return # Optional authentication can accept missing tokens r = client.get(f"{API_URI}/tests/optionalauthentication") assert r.status_code == 204 headers, token = self.do_login(client, None, None) # Or valid tokens r = client.get(f"{API_URI}/tests/optionalauthentication", headers=headers) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == BaseAuthentication.default_user # But not invalid tokens, i.e. if presented the tokens is always validated r = client.get( f"{API_URI}/tests/authentication", headers={"Authorization": "Bearer invalid"}, ) assert r.status_code == 401 if not Env.get_bool("ALLOW_ACCESS_TOKEN_PARAMETER"): # access token parameter is not allowed by default r = client.get( f"{API_URI}/tests/optionalauthentication", query_string={"access_token": token}, ) # query token is ignored but the endpoint accepts missing tokens assert r.status_code == 204 r = client.get( f"{API_URI}/tests/optionalauthentication", query_string={"access_token": "invalid"}, ) # invalid tokens should be rejected, but query token is ignored assert r.status_code == 204 def test_access_token_parameter(self, client: FlaskClient) -> None: if not Env.get_bool("AUTH_ENABLE"): log.warning("Skipping authentication tests") return r = client.get(f"{API_URI}/tests/queryauthentication") assert r.status_code == 401 r = client.get( f"{API_URI}/tests/queryauthentication", headers={"Authorization": "Bearer invalid"}, ) assert r.status_code == 401 headers, token = self.do_login(client, None, None) r = client.get(f"{API_URI}/tests/queryauthentication", headers=headers) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == BaseAuthentication.default_user r = client.get( f"{API_URI}/tests/queryauthentication", query_string={"access_token": token} ) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == BaseAuthentication.default_user r = client.get( f"{API_URI}/tests/queryauthentication", query_string={"access_token": "invalid"}, ) assert r.status_code == 401 def test_optional_access_token_parameter(self, client: FlaskClient) -> None: if not Env.get_bool("AUTH_ENABLE"): log.warning("Skipping authentication tests") return # Optional authentication can accept missing tokens r = client.get(f"{API_URI}/tests/optionalqueryauthentication") assert r.status_code == 204 headers, token = self.do_login(client, None, None) # Or valid tokens r = client.get(f"{API_URI}/tests/optionalqueryauthentication", headers=headers) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == BaseAuthentication.default_user # But not invalid tokens, i.e. if presented the tokens is always validated r = client.get( f"{API_URI}/tests/optionalqueryauthentication", headers={"Authorization": "Bearer invalid"}, ) assert r.status_code == 401 r = client.get( f"{API_URI}/tests/optionalqueryauthentication", query_string={"access_token": token}, ) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == BaseAuthentication.default_user r = client.get( f"{API_URI}/tests/optionalqueryauthentication", query_string={"access_token": "invalid"}, ) # invalid tokens should be rejected, but query token is ignored assert r.status_code == 401 def test_authentication_with_multiple_roles(self, client: FlaskClient) -> None: if not Env.get_bool("AUTH_ENABLE"): log.warning("Skipping authentication tests") return r = client.get(f"{API_URI}/tests/manyrolesauthentication") assert r.status_code == 401 r = client.get(f"{API_URI}/tests/unknownroleauthentication") assert r.status_code == 401 admin_headers, _ = self.do_login(client, None, None) r = client.get( f"{API_URI}/tests/manyrolesauthentication", headers=admin_headers ) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == BaseAuthentication.default_user r = client.get( f"{API_URI}/tests/unknownroleauthentication", headers=admin_headers ) assert r.status_code == 401 if Env.get_bool("MAIN_LOGIN_ENABLE"): uuid, data = self.create_user(client, roles=[Role.USER]) user_header, _ = self.do_login( client, data.get("email"), data.get("password") ) r = client.get( f"{API_URI}/tests/manyrolesauthentication", headers=user_header ) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == data.get("email") r = client.get( f"{API_URI}/tests/unknownroleauthentication", headers=user_header ) assert r.status_code == 401 self.delete_user(client, uuid) def test_authentication_with_auth_callback(self, client: FlaskClient) -> None: if not Env.get_bool("AUTH_ENABLE"): log.warning("Skipping authentication tests") return auth = Connector.get_authentication_instance() user = auth.get_user(username=BaseAuthentication.default_user) assert user is not None VALID = f"/tests/preloadcallback/{user.uuid}" INVALID = "/tests/preloadcallback/12345678-90ab-cdef-1234-567890abcdef" admin_headers, _ = self.do_login(client, None, None) # Verify both endpoint ... r = client.get( f"{API_URI}{VALID}", query_string={"test": True}, headers=admin_headers ) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, dict) assert len(content) == 1 assert "email" in content assert content["email"] == user.email r = client.get( f"{API_URI}{INVALID}", query_string={"test": True}, headers=admin_headers ) assert r.status_code == 401 # and get_schema! r = client.get( f"{API_URI}{VALID}", query_string={"get_schema": True}, headers=admin_headers, ) assert r.status_code == 200 content = self.get_content(r) assert isinstance(content, list) assert len(content) == 1 assert content[0]["key"] == "test" assert content[0]["type"] == "boolean" r = client.get( f"{API_URI}{INVALID}", query_string={"get_schema": True}, headers=admin_headers, ) assert r.status_code == 401
[ 1, 515, 1791, 2754, 29889, 6915, 943, 1053, 1281, 484, 2801, 13, 3166, 1791, 2754, 29889, 6272, 1053, 1174, 29894, 13, 3166, 1791, 2754, 29889, 9916, 29889, 23055, 1053, 7399, 16746, 29892, 1528, 280, 13, 3166, 1791, 2754, 29889, 21150, 1053, 3450, 29918, 15551, 29892, 7399, 24376, 29892, 2379, 1278, 4032, 13, 3166, 1791, 2754, 29889, 4422, 1907, 29889, 20756, 1053, 1480, 13, 13, 13, 1990, 4321, 2052, 29898, 5160, 24376, 1125, 13, 1678, 822, 1243, 29918, 1217, 29918, 5150, 29898, 1311, 29892, 3132, 29901, 2379, 1278, 4032, 29897, 1599, 6213, 29901, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1217, 5150, 1159, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 4974, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 1275, 376, 8949, 29908, 13, 13, 4706, 565, 1174, 29894, 29889, 657, 29918, 11227, 703, 20656, 29950, 29918, 1430, 6181, 29908, 1125, 13, 9651, 9066, 29892, 903, 353, 1583, 29889, 1867, 29918, 7507, 29898, 4645, 29892, 6213, 29892, 6213, 29897, 13, 13, 9651, 396, 11890, 575, 526, 17262, 13, 9651, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1217, 5150, 613, 9066, 29922, 13662, 29897, 13, 9651, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 9651, 4974, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 1275, 376, 8949, 29908, 13, 13, 4706, 396, 11890, 575, 526, 17262, 1584, 565, 8340, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1217, 5150, 613, 9066, 3790, 29908, 25471, 1115, 376, 29933, 799, 261, 8340, 9092, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 4974, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 1275, 376, 8949, 29908, 13, 13, 1678, 822, 1243, 29918, 5150, 29898, 1311, 29892, 3132, 29901, 2379, 1278, 4032, 29897, 1599, 6213, 29901, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 20656, 29950, 29918, 1430, 6181, 29908, 1125, 13, 9651, 1480, 29889, 27392, 703, 29903, 1984, 3262, 10760, 6987, 1159, 13, 9651, 736, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 23055, 1159, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 23055, 613, 13, 9651, 9066, 3790, 29908, 25471, 1115, 376, 29933, 799, 261, 8340, 10758, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 9066, 29892, 5993, 353, 1583, 29889, 1867, 29918, 7507, 29898, 4645, 29892, 6213, 29892, 6213, 29897, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 23055, 613, 9066, 29922, 13662, 29897, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 7399, 16746, 29889, 4381, 29918, 1792, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 1964, 27998, 29918, 2477, 23524, 29918, 4986, 29968, 1430, 29918, 16320, 25797, 4945, 29908, 1125, 13, 9651, 396, 2130, 5993, 3443, 338, 451, 6068, 491, 2322, 13, 9651, 364, 353, 3132, 29889, 657, 29898, 13, 18884, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 23055, 613, 2346, 29918, 1807, 3790, 29908, 5943, 29918, 6979, 1115, 5993, 29913, 13, 9651, 1723, 13, 9651, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 1678, 822, 1243, 29918, 25253, 29918, 5150, 29898, 1311, 29892, 3132, 29901, 2379, 1278, 4032, 29897, 1599, 6213, 29901, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 20656, 29950, 29918, 1430, 6181, 29908, 1125, 13, 9651, 1480, 29889, 27392, 703, 29903, 1984, 3262, 10760, 6987, 1159, 13, 9651, 736, 13, 13, 4706, 396, 28379, 10760, 508, 3544, 4567, 18897, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 23055, 1159, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 13, 13, 4706, 9066, 29892, 5993, 353, 1583, 29889, 1867, 29918, 7507, 29898, 4645, 29892, 6213, 29892, 6213, 29897, 13, 13, 4706, 396, 1394, 2854, 18897, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 23055, 613, 9066, 29922, 13662, 29897, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 7399, 16746, 29889, 4381, 29918, 1792, 13, 13, 4706, 396, 1205, 451, 8340, 18897, 29892, 474, 29889, 29872, 29889, 565, 9132, 278, 18897, 338, 2337, 2854, 630, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 23055, 613, 13, 9651, 9066, 3790, 29908, 25471, 1115, 376, 29933, 799, 261, 8340, 10758, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 1964, 27998, 29918, 2477, 23524, 29918, 4986, 29968, 1430, 29918, 16320, 25797, 4945, 29908, 1125, 13, 9651, 396, 2130, 5993, 3443, 338, 451, 6068, 491, 2322, 13, 9651, 364, 353, 3132, 29889, 657, 29898, 13, 18884, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 23055, 613, 13, 18884, 2346, 29918, 1807, 3790, 29908, 5943, 29918, 6979, 1115, 5993, 1118, 13, 9651, 1723, 13, 9651, 396, 2346, 5993, 338, 17262, 541, 278, 16248, 21486, 4567, 18897, 13, 9651, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 13, 13, 9651, 364, 353, 3132, 29889, 657, 29898, 13, 18884, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 23055, 613, 13, 18884, 2346, 29918, 1807, 3790, 29908, 5943, 29918, 6979, 1115, 376, 20965, 10758, 13, 9651, 1723, 13, 9651, 396, 8340, 18897, 881, 367, 22225, 29892, 541, 2346, 5993, 338, 17262, 13, 9651, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 13, 13, 1678, 822, 1243, 29918, 5943, 29918, 6979, 29918, 15501, 29898, 1311, 29892, 3132, 29901, 2379, 1278, 4032, 29897, 1599, 6213, 29901, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 20656, 29950, 29918, 1430, 6181, 29908, 1125, 13, 9651, 1480, 29889, 27392, 703, 29903, 1984, 3262, 10760, 6987, 1159, 13, 9651, 736, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1972, 23055, 1159, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1972, 23055, 613, 13, 9651, 9066, 3790, 29908, 25471, 1115, 376, 29933, 799, 261, 8340, 10758, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 9066, 29892, 5993, 353, 1583, 29889, 1867, 29918, 7507, 29898, 4645, 29892, 6213, 29892, 6213, 29897, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1972, 23055, 613, 9066, 29922, 13662, 29897, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 7399, 16746, 29889, 4381, 29918, 1792, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1972, 23055, 613, 2346, 29918, 1807, 3790, 29908, 5943, 29918, 6979, 1115, 5993, 29913, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 7399, 16746, 29889, 4381, 29918, 1792, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 1972, 23055, 613, 13, 9651, 2346, 29918, 1807, 3790, 29908, 5943, 29918, 6979, 1115, 376, 20965, 10758, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 1678, 822, 1243, 29918, 25253, 29918, 5943, 29918, 6979, 29918, 15501, 29898, 1311, 29892, 3132, 29901, 2379, 1278, 4032, 29897, 1599, 6213, 29901, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 20656, 29950, 29918, 1430, 6181, 29908, 1125, 13, 9651, 1480, 29889, 27392, 703, 29903, 1984, 3262, 10760, 6987, 1159, 13, 9651, 736, 13, 13, 4706, 396, 28379, 10760, 508, 3544, 4567, 18897, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 1972, 23055, 1159, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 13, 13, 4706, 9066, 29892, 5993, 353, 1583, 29889, 1867, 29918, 7507, 29898, 4645, 29892, 6213, 29892, 6213, 29897, 13, 13, 4706, 396, 1394, 2854, 18897, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 1972, 23055, 613, 9066, 29922, 13662, 29897, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 7399, 16746, 29889, 4381, 29918, 1792, 13, 13, 4706, 396, 1205, 451, 8340, 18897, 29892, 474, 29889, 29872, 29889, 565, 9132, 278, 18897, 338, 2337, 2854, 630, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 1972, 23055, 613, 13, 9651, 9066, 3790, 29908, 25471, 1115, 376, 29933, 799, 261, 8340, 10758, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 1972, 23055, 613, 13, 9651, 2346, 29918, 1807, 3790, 29908, 5943, 29918, 6979, 1115, 5993, 1118, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 7399, 16746, 29889, 4381, 29918, 1792, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 25253, 1972, 23055, 613, 13, 9651, 2346, 29918, 1807, 3790, 29908, 5943, 29918, 6979, 1115, 376, 20965, 10758, 13, 4706, 1723, 13, 4706, 396, 8340, 18897, 881, 367, 22225, 29892, 541, 2346, 5993, 338, 17262, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 1678, 822, 1243, 29918, 23055, 29918, 2541, 29918, 20787, 29918, 307, 793, 29898, 1311, 29892, 3132, 29901, 2379, 1278, 4032, 29897, 1599, 6213, 29901, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 20656, 29950, 29918, 1430, 6181, 29908, 1125, 13, 9651, 1480, 29889, 27392, 703, 29903, 1984, 3262, 10760, 6987, 1159, 13, 9651, 736, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 13011, 307, 793, 23055, 1159, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 26690, 12154, 23055, 1159, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 4113, 29918, 13662, 29892, 903, 353, 1583, 29889, 1867, 29918, 7507, 29898, 4645, 29892, 6213, 29892, 6213, 29897, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 13011, 307, 793, 23055, 613, 9066, 29922, 6406, 29918, 13662, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 7399, 16746, 29889, 4381, 29918, 1792, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 26690, 12154, 23055, 613, 9066, 29922, 6406, 29918, 13662, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 565, 1174, 29894, 29889, 657, 29918, 11227, 703, 29032, 29918, 14480, 1177, 29918, 1430, 6181, 29908, 1125, 13, 9651, 318, 5416, 29892, 848, 353, 1583, 29889, 3258, 29918, 1792, 29898, 4645, 29892, 16178, 11759, 16727, 29889, 11889, 2314, 13, 9651, 1404, 29918, 6672, 29892, 903, 353, 1583, 29889, 1867, 29918, 7507, 29898, 13, 18884, 3132, 29892, 848, 29889, 657, 703, 5269, 4968, 848, 29889, 657, 703, 5630, 1159, 13, 9651, 1723, 13, 13, 9651, 364, 353, 3132, 29889, 657, 29898, 13, 18884, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 13011, 307, 793, 23055, 613, 9066, 29922, 1792, 29918, 6672, 13, 9651, 1723, 13, 9651, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 9651, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 9651, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 9651, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 9651, 4974, 376, 5269, 29908, 297, 2793, 13, 9651, 4974, 2793, 3366, 5269, 3108, 1275, 848, 29889, 657, 703, 5269, 1159, 13, 13, 9651, 364, 353, 3132, 29889, 657, 29898, 13, 18884, 285, 29908, 29912, 8787, 29918, 15551, 6822, 21150, 29914, 26690, 12154, 23055, 613, 9066, 29922, 1792, 29918, 6672, 13, 9651, 1723, 13, 9651, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 9651, 1583, 29889, 8143, 29918, 1792, 29898, 4645, 29892, 318, 5416, 29897, 13, 13, 1678, 822, 1243, 29918, 23055, 29918, 2541, 29918, 5150, 29918, 14035, 29898, 1311, 29892, 3132, 29901, 2379, 1278, 4032, 29897, 1599, 6213, 29901, 13, 13, 4706, 565, 451, 1174, 29894, 29889, 657, 29918, 11227, 703, 20656, 29950, 29918, 1430, 6181, 29908, 1125, 13, 9651, 1480, 29889, 27392, 703, 29903, 1984, 3262, 10760, 6987, 1159, 13, 9651, 736, 13, 13, 4706, 4817, 353, 1281, 484, 2801, 29889, 657, 29918, 23055, 29918, 8758, 580, 13, 4706, 1404, 353, 4817, 29889, 657, 29918, 1792, 29898, 6786, 29922, 5160, 16746, 29889, 4381, 29918, 1792, 29897, 13, 13, 4706, 4974, 1404, 338, 451, 6213, 13, 13, 4706, 12599, 1367, 353, 285, 23901, 21150, 29914, 1457, 1359, 14035, 19248, 1792, 29889, 25118, 5038, 13, 4706, 2672, 26707, 353, 5591, 21150, 29914, 1457, 1359, 14035, 29914, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29899, 29929, 29900, 370, 29899, 29883, 1753, 29899, 29896, 29906, 29941, 29946, 29899, 29945, 29953, 29955, 29947, 29929, 29900, 10736, 1753, 29908, 13, 4706, 4113, 29918, 13662, 29892, 903, 353, 1583, 29889, 1867, 29918, 7507, 29898, 4645, 29892, 6213, 29892, 6213, 29897, 13, 13, 4706, 396, 1798, 1598, 1716, 16248, 2023, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 1157, 26707, 17671, 2346, 29918, 1807, 3790, 29908, 1688, 1115, 5852, 1118, 9066, 29922, 6406, 29918, 13662, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 9657, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 376, 5269, 29908, 297, 2793, 13, 4706, 4974, 2793, 3366, 5269, 3108, 1275, 1404, 29889, 5269, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 1157, 1177, 26707, 17671, 2346, 29918, 1807, 3790, 29908, 1688, 1115, 5852, 1118, 9066, 29922, 6406, 29918, 13662, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 13, 4706, 396, 322, 679, 29918, 11010, 29991, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 1157, 26707, 17671, 13, 9651, 2346, 29918, 1807, 3790, 29908, 657, 29918, 11010, 1115, 5852, 1118, 13, 9651, 9066, 29922, 6406, 29918, 13662, 29892, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 4706, 2793, 353, 1583, 29889, 657, 29918, 3051, 29898, 29878, 29897, 13, 4706, 4974, 338, 8758, 29898, 3051, 29892, 1051, 29897, 13, 4706, 4974, 7431, 29898, 3051, 29897, 1275, 29871, 29896, 13, 4706, 4974, 2793, 29961, 29900, 29962, 3366, 1989, 3108, 1275, 376, 1688, 29908, 13, 4706, 4974, 2793, 29961, 29900, 29962, 3366, 1853, 3108, 1275, 376, 20054, 29908, 13, 13, 4706, 364, 353, 3132, 29889, 657, 29898, 13, 9651, 285, 29908, 29912, 8787, 29918, 15551, 1157, 1177, 26707, 17671, 13, 9651, 2346, 29918, 1807, 3790, 29908, 657, 29918, 11010, 1115, 5852, 1118, 13, 9651, 9066, 29922, 6406, 29918, 13662, 29892, 13, 4706, 1723, 13, 4706, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29896, 13, 2 ]
tests/checks/integration/test_os_updates.py
borgified/datadog-checks
100
189133
<reponame>borgified/datadog-checks # 3p import mock # project from checks import AgentCheck from tests.checks.common import AgentCheckTest, load_check class TestFileUnit(AgentCheckTest): CHECK_NAME = 'os_updates' def __init__(self, *args, **kwargs): AgentCheckTest.__init__(self, *args, **kwargs) self.config = { "init_config": {}, "instances": [{}] } @mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value='2;1') def test_basic_check(self, *args): self.run_check(self.config) self.assertMetric('updates.available', value=2) self.assertMetric('updates.security', value=1) @mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value=None) def test_no_error_if_no_binary(self, *args): self.run_check(self.config) # Shouldn't have any metrics if we can't fetch anything self.assertMetric('updates.available', count=0) self.assertMetric('updates.security', count=0) @mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value='not-splittable') def test_no_error_if_bad_format(self, *args): self.run_check(self.config) self.assertMetric('updates.available', count=0) self.assertMetric('updates.security', count=0) @mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value='a;b') def test_no_error_if_not_numeric(self, *args): self.run_check(self.config) self.assertMetric('updates.available', count=0) self.assertMetric('updates.security', count=0) @mock.patch('utils.platform.Platform.is_linux', return_value=False) def test_only_on_linux(self, *args): self.run_check(self.config) # Shouldn't have any metrics on non-Linux platforms self.assertMetric('updates.available', count=0) self.assertMetric('updates.security', count=0)
[ 1, 529, 276, 1112, 420, 29958, 14203, 2164, 29914, 4130, 328, 468, 29899, 3198, 29879, 13, 29937, 29871, 29941, 29886, 13, 5215, 11187, 13, 13, 29937, 2060, 13, 3166, 12747, 1053, 28330, 5596, 13, 3166, 6987, 29889, 3198, 29879, 29889, 9435, 1053, 28330, 5596, 3057, 29892, 2254, 29918, 3198, 13, 13, 13, 1990, 4321, 2283, 8325, 29898, 19661, 5596, 3057, 1125, 13, 1678, 23557, 29918, 5813, 353, 525, 359, 29918, 786, 15190, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 28330, 5596, 3057, 17255, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 4706, 1583, 29889, 2917, 353, 426, 13, 12, 1678, 376, 2344, 29918, 2917, 1115, 24335, 13, 12, 1678, 376, 2611, 2925, 1115, 15974, 6525, 13, 4706, 500, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29918, 786, 15190, 29889, 3373, 15190, 5596, 29889, 657, 29918, 1491, 5014, 29918, 4905, 742, 736, 29918, 1767, 2433, 29906, 29936, 29896, 1495, 13, 1678, 822, 1243, 29918, 16121, 29918, 3198, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 1583, 29889, 3389, 29918, 3198, 29898, 1311, 29889, 2917, 29897, 13, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 16515, 742, 995, 29922, 29906, 29897, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 8926, 742, 995, 29922, 29896, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29918, 786, 15190, 29889, 3373, 15190, 5596, 29889, 657, 29918, 1491, 5014, 29918, 4905, 742, 736, 29918, 1767, 29922, 8516, 29897, 13, 1678, 822, 1243, 29918, 1217, 29918, 2704, 29918, 361, 29918, 1217, 29918, 19541, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 1583, 29889, 3389, 29918, 3198, 29898, 1311, 29889, 2917, 29897, 13, 13, 4706, 396, 10575, 29876, 29915, 29873, 505, 738, 21556, 565, 591, 508, 29915, 29873, 6699, 3099, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 16515, 742, 2302, 29922, 29900, 29897, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 8926, 742, 2302, 29922, 29900, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29918, 786, 15190, 29889, 3373, 15190, 5596, 29889, 657, 29918, 1491, 5014, 29918, 4905, 742, 736, 29918, 1767, 2433, 1333, 29899, 23579, 986, 519, 1495, 13, 1678, 822, 1243, 29918, 1217, 29918, 2704, 29918, 361, 29918, 12313, 29918, 4830, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 1583, 29889, 3389, 29918, 3198, 29898, 1311, 29889, 2917, 29897, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 16515, 742, 2302, 29922, 29900, 29897, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 8926, 742, 2302, 29922, 29900, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 359, 29918, 786, 15190, 29889, 3373, 15190, 5596, 29889, 657, 29918, 1491, 5014, 29918, 4905, 742, 736, 29918, 1767, 2433, 29874, 29936, 29890, 1495, 13, 1678, 822, 1243, 29918, 1217, 29918, 2704, 29918, 361, 29918, 1333, 29918, 21574, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 1583, 29889, 3389, 29918, 3198, 29898, 1311, 29889, 2917, 29897, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 16515, 742, 2302, 29922, 29900, 29897, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 8926, 742, 2302, 29922, 29900, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 877, 13239, 29889, 12120, 29889, 21889, 29889, 275, 29918, 9389, 742, 736, 29918, 1767, 29922, 8824, 29897, 13, 1678, 822, 1243, 29918, 6194, 29918, 265, 29918, 9389, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 1583, 29889, 3389, 29918, 3198, 29898, 1311, 29889, 2917, 29897, 13, 13, 4706, 396, 10575, 29876, 29915, 29873, 505, 738, 21556, 373, 1661, 29899, 24085, 21796, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 16515, 742, 2302, 29922, 29900, 29897, 13, 4706, 1583, 29889, 9294, 10095, 2200, 877, 786, 15190, 29889, 8926, 742, 2302, 29922, 29900, 29897, 13, 2 ]
deps/lib/python3.5/site-packages/openzwave/group.py
jfarmer08/hassio
0
42348
# -*- coding: utf-8 -*- """ .. module:: openzwave.group This file is part of **python-openzwave** project https://github.com/OpenZWave/python-openzwave. :platform: Unix, Windows, MacOS X :sinopsis: openzwave API .. moduleauthor: bibi21000 aka <NAME> <<EMAIL>> License : GPL(v3) **python-openzwave** is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. **python-openzwave** is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with python-openzwave. If not, see http://www.gnu.org/licenses. """ from openzwave.object import ZWaveObject # Set default logging handler to avoid "No handler found" warnings. import logging try: # Python 2.7+ from logging import NullHandler except ImportError: class NullHandler(logging.Handler): """NullHandler logger for python 2.6""" def emit(self, record): pass logger = logging.getLogger('openzwave') logger.addHandler(NullHandler()) class ZWaveGroup(ZWaveObject): """ The driver object. Hold options of the manager Also used to retrieve information about the library, ... """ def __init__(self, group_index, network=None, node_id=None): """ Initialize driver object :param group_index: index of the group :type group_index: int :param network: The network object to access the manager :type network: ZWaveNetwork :param node_id: ID of node :type node_id: int """ ZWaveObject.__init__(self, group_index, network) self._node_id = node_id self._index = group_index def __str__(self): """ The string representation of the group. :rtype: str """ return 'index: [%s] label: [%s]' % (self.index, self.label) @property def index(self): """ The index of the group. :rtype: int """ return self._index @property def label(self): """ The label of the group. :rtype: int """ return self._network.manager.getGroupLabel(self.home_id, self._node_id, self.index) @property def max_associations(self): """ The number of associations. :rtype: int """ return self._network.manager.getMaxAssociations(self.home_id, self._node_id, self.index) @property def associations(self): """ The members of associations. :rtype: set() """ return self._network.manager.getAssociations(self.home_id, self._node_id, self.index) @property def associations_instances(self): """ The members of associations with theirs instances. Nodes that does not support multi-instances have an instanceid equal to 0. :rtype: set() of tuples (nodeid,instanceid) """ return self._network.manager.getAssociationsInstances(self.home_id, self._node_id, self.index) def add_association(self, target_node_id, instance=0x00): """ Adds a node to an association group. Due to the possibility of a device being asleep, the command is assumed to complete with success, and the association data held in this class is updated directly. This will be reverted by a future Association message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases. :param target_node_id: Identifier for the node that will be added to the association group. :type target_node_id: int :param instance: The instance that will be added to the association group. :type instance: int """ self._network.manager.addAssociation(self.home_id, self._node_id, self.index, target_node_id, instance) def remove_association(self, target_node_id, instance=0x00): """ Removes a node from an association group. Due to the possibility of a device being asleep, the command is assumed to succeed, and the association data held in this class is updated directly. This will be reverted by a future Association message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases. :param target_node_id: Identifier for the node that will be removed from the association group. :type target_node_id: int :param instance: The instance that will be added to the association group. :type instance: int """ self._network.manager.removeAssociation(self._network.home_id, self._node_id, self.index, target_node_id, instance) def to_dict(self, extras=['all']): """ Return a dict representation of the group. :param extras: The extra inforamtions to add :type extras: [] :returns: A dict :rtype: dict() """ if 'all' in extras: extras = ['associations'] ret = {} ret['label'] = self.label if 'associations' in extras: ret['associations'] = dict.fromkeys(self.associations, 0) return ret
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 636, 3883, 1057, 1722, 7659, 1351, 29889, 2972, 13, 13, 4013, 934, 338, 760, 310, 3579, 4691, 29899, 3150, 7659, 1351, 1068, 2060, 2045, 597, 3292, 29889, 510, 29914, 6585, 29999, 29956, 1351, 29914, 4691, 29899, 3150, 7659, 1351, 29889, 13, 1678, 584, 12120, 29901, 26663, 29892, 3852, 29892, 4326, 3267, 1060, 13, 1678, 584, 5223, 15368, 29901, 1722, 7659, 1351, 3450, 13, 13, 636, 3883, 8921, 29901, 29727, 29875, 29906, 29896, 29900, 29900, 29900, 263, 1335, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 13, 29931, 293, 1947, 584, 402, 7390, 29898, 29894, 29941, 29897, 13, 13, 1068, 4691, 29899, 3150, 7659, 1351, 1068, 338, 3889, 7047, 29901, 366, 508, 2654, 391, 2666, 372, 322, 29914, 272, 6623, 13, 277, 1090, 278, 4958, 310, 278, 15143, 4593, 5236, 19245, 408, 6369, 491, 13, 1552, 12362, 18540, 10606, 29892, 2845, 1873, 29871, 29941, 310, 278, 19245, 29892, 470, 13, 29898, 271, 596, 2984, 29897, 738, 2678, 1873, 29889, 13, 13, 1068, 4691, 29899, 3150, 7659, 1351, 1068, 338, 13235, 297, 278, 4966, 393, 372, 674, 367, 5407, 29892, 13, 4187, 399, 1806, 8187, 2692, 13764, 29979, 399, 1718, 29934, 13566, 29979, 29936, 1728, 1584, 278, 2411, 2957, 1370, 21867, 29891, 310, 13, 29924, 1001, 3210, 13566, 2882, 6227, 11937, 470, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 2823, 278, 13, 29954, 11601, 4593, 5236, 19245, 363, 901, 4902, 29889, 13, 3492, 881, 505, 4520, 263, 3509, 310, 278, 15143, 4593, 5236, 19245, 13, 284, 549, 411, 3017, 29899, 3150, 7659, 1351, 29889, 960, 451, 29892, 1074, 1732, 597, 1636, 29889, 18713, 29889, 990, 29914, 506, 11259, 29889, 13, 13, 15945, 29908, 13, 3166, 1722, 7659, 1351, 29889, 3318, 1053, 796, 29956, 1351, 2061, 13, 13, 29937, 3789, 2322, 12183, 7834, 304, 4772, 376, 3782, 7834, 1476, 29908, 18116, 29889, 13, 5215, 12183, 13, 2202, 29901, 29871, 396, 5132, 29871, 29906, 29889, 29955, 29974, 13, 1678, 515, 12183, 1053, 19014, 4598, 13, 19499, 16032, 2392, 29901, 13, 1678, 770, 19014, 4598, 29898, 21027, 29889, 4598, 1125, 13, 4706, 9995, 7327, 4598, 17927, 363, 3017, 29871, 29906, 29889, 29953, 15945, 29908, 13, 4706, 822, 20076, 29898, 1311, 29892, 2407, 1125, 13, 9651, 1209, 13, 21707, 353, 12183, 29889, 657, 16363, 877, 3150, 7659, 1351, 1495, 13, 21707, 29889, 1202, 4598, 29898, 7327, 4598, 3101, 13, 13, 1990, 796, 29956, 1351, 4782, 29898, 29999, 29956, 1351, 2061, 1125, 13, 1678, 9995, 13, 1678, 450, 7156, 1203, 29889, 13, 1678, 21771, 3987, 310, 278, 8455, 13, 1678, 3115, 1304, 304, 10563, 2472, 1048, 278, 3489, 29892, 2023, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2318, 29918, 2248, 29892, 3564, 29922, 8516, 29892, 2943, 29918, 333, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 25455, 7156, 1203, 13, 13, 4706, 584, 3207, 2318, 29918, 2248, 29901, 2380, 310, 278, 2318, 13, 4706, 584, 1853, 2318, 29918, 2248, 29901, 938, 13, 4706, 584, 3207, 3564, 29901, 450, 3564, 1203, 304, 2130, 278, 8455, 13, 4706, 584, 1853, 3564, 29901, 796, 29956, 1351, 13724, 13, 4706, 584, 3207, 2943, 29918, 333, 29901, 3553, 310, 2943, 13, 4706, 584, 1853, 2943, 29918, 333, 29901, 938, 13, 13, 4706, 9995, 13, 13, 4706, 796, 29956, 1351, 2061, 17255, 2344, 12035, 1311, 29892, 2318, 29918, 2248, 29892, 3564, 29897, 13, 13, 4706, 1583, 3032, 3177, 29918, 333, 353, 2943, 29918, 333, 13, 4706, 1583, 3032, 2248, 353, 2318, 29918, 2248, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 1347, 8954, 310, 278, 2318, 29889, 13, 13, 4706, 584, 29878, 1853, 29901, 851, 13, 13, 4706, 9995, 13, 4706, 736, 525, 2248, 29901, 518, 29995, 29879, 29962, 3858, 29901, 518, 29995, 29879, 29962, 29915, 1273, 313, 1311, 29889, 2248, 29892, 1583, 29889, 1643, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2380, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 2380, 310, 278, 2318, 29889, 13, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 2248, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3858, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 3858, 310, 278, 2318, 29889, 13, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 11618, 29889, 12847, 29889, 657, 4782, 4775, 29898, 1311, 29889, 5184, 29918, 333, 29892, 1583, 3032, 3177, 29918, 333, 29892, 1583, 29889, 2248, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4236, 29918, 21264, 800, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 1353, 310, 27733, 29889, 13, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 11618, 29889, 12847, 29889, 657, 7976, 29254, 800, 29898, 1311, 29889, 5184, 29918, 333, 29892, 1583, 3032, 3177, 29918, 333, 29892, 1583, 29889, 2248, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 27733, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 5144, 310, 27733, 29889, 13, 13, 4706, 584, 29878, 1853, 29901, 731, 580, 13, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 11618, 29889, 12847, 29889, 657, 29254, 800, 29898, 1311, 29889, 5184, 29918, 333, 29892, 1583, 3032, 3177, 29918, 333, 29892, 1583, 29889, 2248, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 27733, 29918, 2611, 2925, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 5144, 310, 27733, 411, 1009, 29879, 8871, 29889, 13, 4706, 405, 2631, 393, 947, 451, 2304, 2473, 29899, 2611, 2925, 505, 385, 2777, 333, 5186, 304, 29871, 29900, 29889, 13, 13, 4706, 584, 29878, 1853, 29901, 731, 580, 310, 5291, 2701, 313, 3177, 333, 29892, 8758, 333, 29897, 13, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 11618, 29889, 12847, 29889, 657, 29254, 800, 3379, 2925, 29898, 1311, 29889, 5184, 29918, 333, 29892, 1583, 3032, 3177, 29918, 333, 29892, 1583, 29889, 2248, 29897, 13, 13, 1678, 822, 788, 29918, 21264, 362, 29898, 1311, 29892, 3646, 29918, 3177, 29918, 333, 29892, 2777, 29922, 29900, 29916, 29900, 29900, 1125, 13, 4706, 9995, 13, 4706, 3462, 29879, 263, 2943, 304, 385, 15477, 2318, 29889, 13, 13, 4706, 16809, 304, 278, 13331, 310, 263, 4742, 1641, 408, 5436, 29892, 278, 1899, 338, 12023, 304, 13, 4706, 4866, 411, 2551, 29892, 322, 278, 15477, 848, 4934, 297, 445, 770, 338, 4784, 4153, 29889, 29871, 910, 13, 4706, 674, 367, 29538, 287, 491, 263, 5434, 7993, 2643, 515, 278, 4742, 565, 278, 796, 29899, 29956, 1351, 13, 4706, 2643, 2869, 5229, 304, 679, 1549, 29889, 29871, 28578, 6939, 29879, 674, 367, 2665, 297, 13, 4706, 1716, 4251, 29889, 13, 13, 4706, 584, 3207, 3646, 29918, 3177, 29918, 333, 29901, 20286, 363, 278, 2943, 393, 674, 367, 2715, 304, 278, 15477, 2318, 29889, 13, 4706, 584, 1853, 3646, 29918, 3177, 29918, 333, 29901, 938, 13, 4706, 584, 3207, 2777, 29901, 450, 2777, 393, 674, 367, 2715, 304, 278, 15477, 2318, 29889, 13, 4706, 584, 1853, 2777, 29901, 938, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 11618, 29889, 12847, 29889, 1202, 29254, 362, 29898, 1311, 29889, 5184, 29918, 333, 29892, 1583, 3032, 3177, 29918, 333, 29892, 1583, 29889, 2248, 29892, 3646, 29918, 3177, 29918, 333, 29892, 2777, 29897, 13, 13, 1678, 822, 3349, 29918, 21264, 362, 29898, 1311, 29892, 3646, 29918, 3177, 29918, 333, 29892, 2777, 29922, 29900, 29916, 29900, 29900, 1125, 13, 4706, 9995, 13, 4706, 5240, 586, 267, 263, 2943, 515, 385, 15477, 2318, 29889, 13, 13, 4706, 16809, 304, 278, 13331, 310, 263, 4742, 1641, 408, 5436, 29892, 278, 1899, 338, 12023, 304, 13, 4706, 9269, 29892, 322, 278, 15477, 848, 4934, 297, 445, 770, 338, 4784, 4153, 29889, 29871, 910, 13, 4706, 674, 367, 29538, 287, 491, 263, 5434, 7993, 2643, 515, 278, 4742, 565, 278, 796, 29899, 29956, 1351, 13, 4706, 2643, 2869, 5229, 304, 679, 1549, 29889, 259, 28578, 6939, 29879, 674, 367, 2665, 13, 4706, 297, 1716, 4251, 29889, 13, 13, 4706, 584, 3207, 3646, 29918, 3177, 29918, 333, 29901, 20286, 363, 278, 2943, 393, 674, 367, 6206, 515, 278, 15477, 2318, 29889, 13, 4706, 584, 1853, 3646, 29918, 3177, 29918, 333, 29901, 938, 13, 4706, 584, 3207, 2777, 29901, 450, 2777, 393, 674, 367, 2715, 304, 278, 15477, 2318, 29889, 13, 4706, 584, 1853, 2777, 29901, 938, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 11618, 29889, 12847, 29889, 5992, 29254, 362, 29898, 1311, 3032, 11618, 29889, 5184, 29918, 333, 29892, 1583, 3032, 3177, 29918, 333, 29892, 1583, 29889, 2248, 29892, 3646, 29918, 3177, 29918, 333, 29892, 2777, 29897, 13, 13, 1678, 822, 304, 29918, 8977, 29898, 1311, 29892, 429, 10678, 29922, 1839, 497, 2033, 1125, 13, 4706, 9995, 13, 4706, 7106, 263, 9657, 8954, 310, 278, 2318, 29889, 13, 13, 4706, 584, 3207, 429, 10678, 29901, 450, 4805, 297, 1454, 8035, 1080, 304, 788, 13, 4706, 584, 1853, 429, 10678, 29901, 5159, 13, 4706, 584, 18280, 29901, 319, 9657, 13, 4706, 584, 29878, 1853, 29901, 9657, 580, 13, 13, 4706, 9995, 13, 4706, 565, 525, 497, 29915, 297, 429, 10678, 29901, 13, 9651, 429, 10678, 353, 6024, 21264, 800, 2033, 13, 4706, 3240, 353, 6571, 13, 4706, 3240, 1839, 1643, 2033, 353, 1583, 29889, 1643, 13, 4706, 565, 525, 21264, 800, 29915, 297, 429, 10678, 29901, 13, 9651, 3240, 1839, 21264, 800, 2033, 353, 9657, 29889, 3166, 8149, 29898, 1311, 29889, 21264, 800, 29892, 29871, 29900, 29897, 13, 4706, 736, 3240, 13, 2 ]
toontown/ai/HolidayBaseAI.py
LittleNed/toontown-stride
3
104999
<filename>toontown/ai/HolidayBaseAI.py from direct.directnotify.DirectNotifyGlobal import * class HolidayBaseAI: def __init__(self, air, holidayId): self.air = air self.holidayId = holidayId def start(self): pass def stop(self): pass
[ 1, 529, 9507, 29958, 517, 609, 776, 29914, 1794, 29914, 29950, 17211, 388, 5160, 23869, 29889, 2272, 13, 3166, 1513, 29889, 11851, 25140, 29889, 17392, 3664, 1598, 12756, 1053, 334, 13, 13, 1990, 4168, 22394, 5160, 23869, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4799, 29892, 8753, 22394, 1204, 1125, 13, 4706, 1583, 29889, 1466, 353, 4799, 13, 4706, 1583, 29889, 5391, 22394, 1204, 353, 8753, 22394, 1204, 13, 13, 1678, 822, 1369, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 5040, 29898, 1311, 1125, 13, 4706, 1209, 2 ]
jp.atcoder/abc212/abc212_g/24795188.py
kagemeka/atcoder-submissions
1
91823
<filename>jp.atcoder/abc212/abc212_g/24795188.py<gh_stars>1-10 import typing from collections import defaultdict class FindDivisors(): def __call__( self, n: int, ) -> typing.List[int]: a = [] i = 1 while i * i < n: if n % i: i += 1 continue a.append(i) a.append(n // i) i += 1 if i * i == n: a.append(i) a.sort() return a class PrimeFactors(): def __call__( self, n: int, ) -> typing.NoReturn: a = [] p = 2 while p * p <= n: if n % p: p += 1 continue a.append(p) while not n % p: n //= p if n > 1: a.append(n) return a def solve( p: int, ) -> typing.NoReturn: n = p - 1 divs = FindDivisors()(n) pf = PrimeFactors()(n) mod = 998244353 dp = defaultdict(int) for d in divs: dp[d] = n // d % mod for p in pf: for d in divs: if d % p: continue dp[d // p] -= dp[d] dp[d // p] %= mod c = 1 for d in divs: c += dp[d] * n // d % mod c %= mod print(c) def main() -> typing.NoReturn: p = int(input()) solve(p) main()
[ 1, 529, 9507, 29958, 16865, 29889, 271, 29883, 6119, 29914, 10736, 29906, 29896, 29906, 29914, 10736, 29906, 29896, 29906, 29918, 29887, 29914, 29906, 29946, 29955, 29929, 29945, 29896, 29947, 29947, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 19229, 13, 3166, 16250, 1053, 2322, 8977, 13, 13, 13, 1990, 10987, 12596, 275, 943, 7295, 13, 29871, 822, 4770, 4804, 12035, 13, 1678, 1583, 29892, 13, 1678, 302, 29901, 938, 29892, 13, 29871, 1723, 1599, 19229, 29889, 1293, 29961, 524, 5387, 13, 1678, 263, 353, 5159, 13, 1678, 474, 353, 29871, 29896, 13, 1678, 1550, 474, 334, 474, 529, 302, 29901, 13, 418, 565, 302, 1273, 474, 29901, 13, 4706, 474, 4619, 29871, 29896, 13, 4706, 6773, 13, 418, 263, 29889, 4397, 29898, 29875, 29897, 13, 418, 263, 29889, 4397, 29898, 29876, 849, 474, 29897, 13, 418, 474, 4619, 29871, 29896, 13, 1678, 565, 474, 334, 474, 1275, 302, 29901, 263, 29889, 4397, 29898, 29875, 29897, 13, 1678, 263, 29889, 6605, 580, 13, 1678, 736, 263, 13, 13, 13, 13, 1990, 15512, 20738, 943, 7295, 13, 29871, 822, 4770, 4804, 12035, 13, 1678, 1583, 29892, 13, 1678, 302, 29901, 938, 29892, 13, 29871, 1723, 1599, 19229, 29889, 3782, 11609, 29901, 13, 1678, 263, 353, 5159, 13, 1678, 282, 353, 29871, 29906, 13, 1678, 1550, 282, 334, 282, 5277, 302, 29901, 13, 418, 565, 302, 1273, 282, 29901, 13, 4706, 282, 4619, 29871, 29896, 13, 4706, 6773, 13, 418, 263, 29889, 4397, 29898, 29886, 29897, 13, 418, 1550, 451, 302, 1273, 282, 29901, 302, 849, 29922, 282, 13, 1678, 565, 302, 1405, 29871, 29896, 29901, 263, 29889, 4397, 29898, 29876, 29897, 13, 1678, 736, 263, 13, 13, 13, 13, 1753, 4505, 29898, 13, 29871, 282, 29901, 938, 29892, 13, 29897, 1599, 19229, 29889, 3782, 11609, 29901, 13, 29871, 302, 353, 282, 448, 29871, 29896, 13, 29871, 24641, 353, 10987, 12596, 275, 943, 580, 29898, 29876, 29897, 13, 29871, 282, 29888, 353, 15512, 20738, 943, 580, 29898, 29876, 29897, 13, 13, 29871, 878, 353, 29871, 29929, 29929, 29947, 29906, 29946, 29946, 29941, 29945, 29941, 13, 29871, 270, 29886, 353, 2322, 8977, 29898, 524, 29897, 13, 29871, 363, 270, 297, 24641, 29901, 13, 1678, 270, 29886, 29961, 29881, 29962, 353, 302, 849, 270, 1273, 878, 13, 13, 29871, 363, 282, 297, 282, 29888, 29901, 13, 1678, 363, 270, 297, 24641, 29901, 13, 418, 565, 270, 1273, 282, 29901, 6773, 13, 418, 270, 29886, 29961, 29881, 849, 282, 29962, 22361, 270, 29886, 29961, 29881, 29962, 13, 418, 270, 29886, 29961, 29881, 849, 282, 29962, 1273, 29922, 878, 13, 13, 29871, 274, 353, 29871, 29896, 13, 29871, 363, 270, 297, 24641, 29901, 13, 1678, 274, 4619, 270, 29886, 29961, 29881, 29962, 334, 302, 849, 270, 1273, 878, 13, 1678, 274, 1273, 29922, 878, 13, 29871, 1596, 29898, 29883, 29897, 13, 13, 13, 13, 1753, 1667, 580, 1599, 19229, 29889, 3782, 11609, 29901, 13, 29871, 282, 353, 938, 29898, 2080, 3101, 13, 29871, 4505, 29898, 29886, 29897, 13, 13, 13, 13, 3396, 580, 13, 2 ]
tools/demo_single_img_test.py
neolixcn/BiSeNet
0
161221
import sys sys.path.insert(0, '.') import os import argparse import torch import torch.nn as nn from PIL import Image import numpy as np import cv2 import time import lib.transform_cv2 as T from lib.models import model_factory from configs import cfg_factory from lib.cityscapes_labels import trainId2color torch.set_grad_enabled(False) np.random.seed(123) # args parse = argparse.ArgumentParser() parse.add_argument('--cfg-file', dest='cfg_file', type=str, default='bisenetv2', help="specify the name without suffix of config file",) parse.add_argument('--weight-path', type=str, default='./res/model_final.pth',) parse.add_argument('--img-path', dest='img_path', type=str, default='./example.png',) parse.add_argument('--save-path', dest='save_path', type=str, default='./res.jpg',) args = parse.parse_args() cfg = cfg_factory[args.cfg_file] if os.path.exists(args.save_path): os.path.makedirs(args.save_path) palette = np.random.randint(0, 256, (256, 3), dtype=np.uint8) # define model net = model_factory[cfg.model_type](19) net.load_state_dict(torch.load(args.weight_path, map_location='cpu')) net.eval() net.cuda() # prepare data to_tensor = T.ToTensor( mean=(0.3257, 0.3690, 0.3223), # city, rgb std=(0.2112, 0.2148, 0.2115), ) # im = cv2.imread(args.img_path)[:, :, ::-1] im = cv2.imread(args.img_path) im = cv2.resize(im, (1024,512))[:, :, ::-1] # im = cv2.resize(im, (1024,1024))[:, :, ::-1] #im = cv2.resize(im, (1920,1024))[:, :, ::-1] im = to_tensor(dict(im=im, lb=None))['im'].unsqueeze(0).cuda() # inference start = time.time() out = net(im)[0].argmax(dim=1).squeeze().detach().cpu() # .numpy() end = time.time() # pred = palette[out] color_map = torch.ones((out.shape[0], out.shape[1], 3))* 255 for id in trainId2color: color_map[out == id] = torch.tensor(trainId2color[id]).float() color_map = color_map.numpy() cv2.imwrite(args.save_path, color_map) print("total time:", end - start)
[ 1, 29871, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 15300, 1495, 13, 5215, 2897, 13, 5215, 1852, 5510, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 3166, 349, 6227, 1053, 7084, 13, 5215, 12655, 408, 7442, 13, 5215, 13850, 29906, 13, 5215, 931, 13, 13, 5215, 4303, 29889, 9067, 29918, 11023, 29906, 408, 323, 13, 3166, 4303, 29889, 9794, 1053, 1904, 29918, 14399, 13, 3166, 2295, 29879, 1053, 274, 16434, 29918, 14399, 13, 3166, 4303, 29889, 12690, 1557, 11603, 29918, 21134, 1053, 7945, 1204, 29906, 2780, 13, 13, 7345, 305, 29889, 842, 29918, 5105, 29918, 17590, 29898, 8824, 29897, 13, 9302, 29889, 8172, 29889, 26776, 29898, 29896, 29906, 29941, 29897, 13, 13, 13, 29937, 6389, 13, 5510, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 5510, 29889, 1202, 29918, 23516, 877, 489, 16859, 29899, 1445, 742, 2731, 2433, 16859, 29918, 1445, 742, 1134, 29922, 710, 29892, 2322, 2433, 29890, 7674, 300, 29894, 29906, 742, 1371, 543, 6550, 1598, 278, 1024, 1728, 25557, 310, 2295, 934, 613, 29897, 13, 5510, 29889, 1202, 29918, 23516, 877, 489, 7915, 29899, 2084, 742, 1134, 29922, 710, 29892, 2322, 2433, 6904, 690, 29914, 4299, 29918, 8394, 29889, 29886, 386, 742, 29897, 13, 5510, 29889, 1202, 29918, 23516, 877, 489, 2492, 29899, 2084, 742, 2731, 2433, 2492, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 2433, 6904, 4773, 29889, 2732, 742, 29897, 13, 5510, 29889, 1202, 29918, 23516, 877, 489, 7620, 29899, 2084, 742, 2731, 2433, 7620, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 2433, 6904, 690, 29889, 6173, 742, 29897, 13, 5085, 353, 6088, 29889, 5510, 29918, 5085, 580, 13, 16859, 353, 274, 16434, 29918, 14399, 29961, 5085, 29889, 16859, 29918, 1445, 29962, 13, 13, 361, 2897, 29889, 2084, 29889, 9933, 29898, 5085, 29889, 7620, 29918, 2084, 1125, 13, 1678, 2897, 29889, 2084, 29889, 29885, 12535, 12935, 29898, 5085, 29889, 7620, 29918, 2084, 29897, 13, 13, 29886, 26456, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29906, 29945, 29953, 29892, 313, 29906, 29945, 29953, 29892, 29871, 29941, 511, 26688, 29922, 9302, 29889, 13470, 29947, 29897, 13, 13, 29937, 4529, 1904, 13, 1212, 353, 1904, 29918, 14399, 29961, 16859, 29889, 4299, 29918, 1853, 850, 29896, 29929, 29897, 13, 1212, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 7345, 305, 29889, 1359, 29898, 5085, 29889, 7915, 29918, 2084, 29892, 2910, 29918, 5479, 2433, 21970, 8785, 13, 1212, 29889, 14513, 580, 13, 1212, 29889, 29883, 6191, 580, 13, 13, 29937, 19012, 848, 13, 517, 29918, 20158, 353, 323, 29889, 1762, 29911, 6073, 29898, 13, 1678, 2099, 7607, 29900, 29889, 29941, 29906, 29945, 29955, 29892, 29871, 29900, 29889, 29941, 29953, 29929, 29900, 29892, 29871, 29900, 29889, 29941, 29906, 29906, 29941, 511, 396, 4272, 29892, 15552, 29890, 13, 1678, 3659, 7607, 29900, 29889, 29906, 29896, 29896, 29906, 29892, 29871, 29900, 29889, 29906, 29896, 29946, 29947, 29892, 29871, 29900, 29889, 29906, 29896, 29896, 29945, 511, 13, 29897, 13, 29937, 527, 353, 13850, 29906, 29889, 326, 949, 29898, 5085, 29889, 2492, 29918, 2084, 29897, 7503, 29892, 584, 29892, 4761, 29899, 29896, 29962, 13, 326, 353, 13850, 29906, 29889, 326, 949, 29898, 5085, 29889, 2492, 29918, 2084, 29897, 13, 326, 353, 13850, 29906, 29889, 21476, 29898, 326, 29892, 313, 29896, 29900, 29906, 29946, 29892, 29945, 29896, 29906, 876, 7503, 29892, 584, 29892, 4761, 29899, 29896, 29962, 13, 29937, 527, 353, 13850, 29906, 29889, 21476, 29898, 326, 29892, 313, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 876, 7503, 29892, 584, 29892, 4761, 29899, 29896, 29962, 13, 29937, 326, 353, 13850, 29906, 29889, 21476, 29898, 326, 29892, 313, 29896, 29929, 29906, 29900, 29892, 29896, 29900, 29906, 29946, 876, 7503, 29892, 584, 29892, 4761, 29899, 29896, 29962, 13, 326, 353, 304, 29918, 20158, 29898, 8977, 29898, 326, 29922, 326, 29892, 27981, 29922, 8516, 876, 1839, 326, 13359, 6948, 802, 29872, 911, 29898, 29900, 467, 29883, 6191, 580, 13, 13, 29937, 27262, 13, 2962, 353, 931, 29889, 2230, 580, 13, 449, 353, 7787, 29898, 326, 9601, 29900, 1822, 1191, 3317, 29898, 6229, 29922, 29896, 467, 29879, 802, 29872, 911, 2141, 4801, 496, 2141, 21970, 580, 396, 869, 23749, 580, 13, 355, 353, 931, 29889, 2230, 580, 13, 29937, 4450, 353, 282, 26456, 29961, 449, 29962, 13, 2780, 29918, 1958, 353, 4842, 305, 29889, 2873, 3552, 449, 29889, 12181, 29961, 29900, 1402, 714, 29889, 12181, 29961, 29896, 1402, 29871, 29941, 876, 29930, 29871, 29906, 29945, 29945, 13, 1454, 1178, 297, 7945, 1204, 29906, 2780, 29901, 13, 1678, 2927, 29918, 1958, 29961, 449, 1275, 1178, 29962, 353, 4842, 305, 29889, 20158, 29898, 14968, 1204, 29906, 2780, 29961, 333, 14664, 7411, 580, 13, 2780, 29918, 1958, 353, 2927, 29918, 1958, 29889, 23749, 580, 13, 11023, 29906, 29889, 326, 3539, 29898, 5085, 29889, 7620, 29918, 2084, 29892, 2927, 29918, 1958, 29897, 13, 2158, 703, 7827, 931, 29901, 613, 1095, 448, 1369, 29897, 2 ]
scripts/netket/mbl/check/3_ndm_proc.py
GillianGrayson/qs
0
137382
import netket as nk import numpy as np from numpy import linalg as la import pandas as pd import os from netket.hilbert import Fock from tqdm import tqdm # Model params model = 'mbl' N = 8 seed = 3 W = 15.0 U = 1.0 J = 1.0 dt = 1 gamma = 0.1 # Ansatz params beta = 2 alpha = 2 n_samples = 5000 n_iter = 1000 np.random.seed(seed) cpp_path = f"/media/sf_Work/dl/netket/{model}/test/cpp" save_path = f"/media/sf_Work/dl/netket/{model}/N({N})_rnd({seed})_H({W:0.4f}_{U:0.4f}_{J:0.4f})_D({dt}_{gamma:0.4f})" if not os.path.exists(f"{save_path}"): os.makedirs(f"{save_path}") energies = np.random.uniform(-1.0, 1.0, N) # Hilbert space hi = Fock(n_max=1, n_particles=N//2, N=N) # The Hamiltonian ha = nk.operator.LocalOperator(hi) # List of dissipative jump operators j_ops = [] for boson_id in range(N - 1): ha += W * energies[boson_id] * nk.operator.boson.number(hi, boson_id) ha += U * nk.operator.boson.number(hi, boson_id) * nk.operator.boson.number(hi, boson_id + 1) ha -= J * (nk.operator.boson.create(hi, boson_id) * nk.operator.boson.destroy(hi, boson_id + 1) + nk.operator.boson.create(hi, boson_id + 1) * nk.operator.boson.destroy(hi, boson_id)) if dt == 1: A = (nk.operator.boson.create(hi, boson_id + 1) + nk.operator.boson.create(hi, boson_id)) * (nk.operator.boson.destroy(hi, boson_id + 1) - nk.operator.boson.destroy(hi, boson_id)) elif dt == 0: A = nk.operator.boson.create(hi, boson_id) * nk.operator.boson.destroy(hi, boson_id) j_ops.append(np.sqrt(gamma) * A) ha += W * energies[N - 1] * nk.operator.boson.number(hi, N - 1) if dt == 0: A = nk.operator.boson.create(hi, N - 1) * nk.operator.boson.destroy(hi, N - 1) j_ops.append(np.sqrt(gamma) * A) # Create the Liouvillian lind = nk.operator.LocalLiouvillian(ha, j_ops) # Neural quantum state model: Positive-Definite Neural Density Matrix using the ansatz from Torlai and Melko ndm = nk.models.NDM( alpha=alpha, beta=beta, ) # Metropolis Sampling graph = nk.graph.Hypercube(N, n_dim=1, pbc=False) sa_graph = nk.graph.disjoint_union(graph, graph) sa = nk.sampler.MetropolisExchange(lind.hilbert, graph=sa_graph) # Optimizer op = nk.optimizer.Sgd(0.01) sr = nk.optimizer.SR(diag_shift=0.01) # Variational state vs = nk.vqs.MCMixedState(sa, ndm, n_samples=n_samples) vs.init_parameters(nk.nn.initializers.normal(stddev=0.01)) # Driver ss = nk.SteadyState(lind, op, variational_state=vs, preconditioner=sr) metrics_dict = { 'iteration': np.linspace(1, n_iter, n_iter), 'ldagl_mean': [], 'ldagl_error_of_mean': [], 'norm_rho_diff': [], 'norm_rho_diff_conj': [] } # Calculate exact rho rho_exact = nk.exact.steady_state(lind, method="iterative", sparse=True, tol=1e-10) for it in tqdm(range(n_iter)): out = ss.run(n_iter=1) metrics_dict['ldagl_mean'].append(ss.ldagl.mean) metrics_dict['ldagl_error_of_mean'].append(ss.ldagl.error_of_mean) rho_neural = np.array(ss.state.to_matrix()) rho_diff = rho_exact - rho_neural rho_diff_conj = rho_exact - rho_neural.conjugate() metrics_dict['norm_rho_diff'].append(la.norm(rho_diff)) metrics_dict['norm_rho_diff_conj'].append(la.norm(rho_diff_conj)) metrics_df = pd.DataFrame(metrics_dict) metrics_df.to_excel(f"{save_path}/NDM({alpha}_{beta}_{n_samples}_{n_iter}).xlsx", index=False)
[ 1, 1053, 7787, 7873, 408, 302, 29895, 13, 5215, 12655, 408, 7442, 13, 3166, 12655, 1053, 301, 979, 29887, 408, 425, 13, 5215, 11701, 408, 10518, 13, 5215, 2897, 13, 3166, 7787, 7873, 29889, 29882, 309, 2151, 1053, 383, 1698, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 13, 29937, 8125, 8636, 13, 4299, 353, 525, 29885, 2204, 29915, 13, 29940, 353, 29871, 29947, 13, 26776, 353, 29871, 29941, 13, 29956, 353, 29871, 29896, 29945, 29889, 29900, 13, 29965, 353, 29871, 29896, 29889, 29900, 13, 29967, 353, 29871, 29896, 29889, 29900, 13, 6008, 353, 29871, 29896, 13, 4283, 353, 29871, 29900, 29889, 29896, 13, 13, 29937, 21877, 4101, 8636, 13, 3571, 353, 29871, 29906, 13, 2312, 353, 29871, 29906, 13, 29876, 29918, 27736, 353, 29871, 29945, 29900, 29900, 29900, 13, 29876, 29918, 1524, 353, 29871, 29896, 29900, 29900, 29900, 13, 13, 9302, 29889, 8172, 29889, 26776, 29898, 26776, 29897, 13, 13, 8223, 29918, 2084, 353, 285, 23901, 9799, 29914, 4668, 29918, 5531, 29914, 11671, 29914, 1212, 7873, 19248, 4299, 6822, 1688, 29914, 8223, 29908, 13, 7620, 29918, 2084, 353, 285, 23901, 9799, 29914, 4668, 29918, 5531, 29914, 11671, 29914, 1212, 7873, 19248, 4299, 6822, 29940, 3319, 29940, 1800, 29918, 29878, 299, 3319, 26776, 1800, 29918, 29950, 3319, 29956, 29901, 29900, 29889, 29946, 29888, 3227, 29965, 29901, 29900, 29889, 29946, 29888, 3227, 29967, 29901, 29900, 29889, 29946, 29888, 1800, 29918, 29928, 3319, 6008, 3227, 4283, 29901, 29900, 29889, 29946, 29888, 1800, 29908, 13, 361, 451, 2897, 29889, 2084, 29889, 9933, 29898, 29888, 29908, 29912, 7620, 29918, 2084, 5038, 1125, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 29888, 29908, 29912, 7620, 29918, 2084, 27195, 13, 13, 759, 29887, 583, 353, 7442, 29889, 8172, 29889, 29590, 6278, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29892, 405, 29897, 13, 13, 29937, 12338, 2151, 2913, 13, 2918, 353, 383, 1698, 29898, 29876, 29918, 3317, 29922, 29896, 29892, 302, 29918, 1595, 4027, 29922, 29940, 458, 29906, 29892, 405, 29922, 29940, 29897, 13, 13, 29937, 450, 27752, 13, 2350, 353, 302, 29895, 29889, 6891, 29889, 7717, 26486, 29898, 2918, 29897, 13, 13, 29937, 2391, 310, 16317, 666, 1230, 12500, 12768, 13, 29926, 29918, 3554, 353, 5159, 13, 13, 1454, 13601, 265, 29918, 333, 297, 3464, 29898, 29940, 448, 29871, 29896, 1125, 13, 1678, 447, 4619, 399, 334, 18190, 583, 29961, 27737, 265, 29918, 333, 29962, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 4537, 29898, 2918, 29892, 13601, 265, 29918, 333, 29897, 13, 1678, 447, 4619, 501, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 4537, 29898, 2918, 29892, 13601, 265, 29918, 333, 29897, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 4537, 29898, 2918, 29892, 13601, 265, 29918, 333, 718, 29871, 29896, 29897, 13, 1678, 447, 22361, 435, 334, 313, 29876, 29895, 29889, 6891, 29889, 27737, 265, 29889, 3258, 29898, 2918, 29892, 13601, 265, 29918, 333, 29897, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 20524, 29898, 2918, 29892, 13601, 265, 29918, 333, 718, 29871, 29896, 29897, 718, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 3258, 29898, 2918, 29892, 13601, 265, 29918, 333, 718, 29871, 29896, 29897, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 20524, 29898, 2918, 29892, 13601, 265, 29918, 333, 876, 13, 1678, 565, 11636, 1275, 29871, 29896, 29901, 13, 4706, 319, 353, 313, 29876, 29895, 29889, 6891, 29889, 27737, 265, 29889, 3258, 29898, 2918, 29892, 13601, 265, 29918, 333, 718, 29871, 29896, 29897, 718, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 3258, 29898, 2918, 29892, 13601, 265, 29918, 333, 876, 334, 313, 29876, 29895, 29889, 6891, 29889, 27737, 265, 29889, 20524, 29898, 2918, 29892, 13601, 265, 29918, 333, 718, 29871, 29896, 29897, 448, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 20524, 29898, 2918, 29892, 13601, 265, 29918, 333, 876, 13, 1678, 25342, 11636, 1275, 29871, 29900, 29901, 13, 4706, 319, 353, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 3258, 29898, 2918, 29892, 13601, 265, 29918, 333, 29897, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 20524, 29898, 2918, 29892, 13601, 265, 29918, 333, 29897, 13, 1678, 432, 29918, 3554, 29889, 4397, 29898, 9302, 29889, 3676, 29898, 4283, 29897, 334, 319, 29897, 13, 2350, 4619, 399, 334, 18190, 583, 29961, 29940, 448, 29871, 29896, 29962, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 4537, 29898, 2918, 29892, 405, 448, 29871, 29896, 29897, 13, 361, 11636, 1275, 29871, 29900, 29901, 13, 1678, 319, 353, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 3258, 29898, 2918, 29892, 405, 448, 29871, 29896, 29897, 334, 302, 29895, 29889, 6891, 29889, 27737, 265, 29889, 20524, 29898, 2918, 29892, 405, 448, 29871, 29896, 29897, 13, 1678, 432, 29918, 3554, 29889, 4397, 29898, 9302, 29889, 3676, 29898, 4283, 29897, 334, 319, 29897, 13, 13, 29937, 6204, 278, 2718, 5128, 453, 713, 13, 29880, 513, 353, 302, 29895, 29889, 6891, 29889, 7717, 23410, 5128, 453, 713, 29898, 2350, 29892, 432, 29918, 3554, 29897, 13, 13, 29937, 2448, 3631, 12101, 2106, 1904, 29901, 10321, 3321, 29899, 3206, 262, 568, 2448, 3631, 360, 575, 537, 22513, 773, 278, 6063, 4101, 515, 4794, 433, 29875, 322, 6286, 2901, 13, 299, 29885, 353, 302, 29895, 29889, 9794, 29889, 2797, 29924, 29898, 13, 1678, 15595, 29922, 2312, 29892, 13, 1678, 21762, 29922, 3571, 29892, 13, 29897, 13, 13, 29937, 19110, 275, 3685, 10335, 13, 4262, 353, 302, 29895, 29889, 4262, 29889, 26322, 546, 29883, 4003, 29898, 29940, 29892, 302, 29918, 6229, 29922, 29896, 29892, 282, 12328, 29922, 8824, 29897, 13, 4977, 29918, 4262, 353, 302, 29895, 29889, 4262, 29889, 2218, 12090, 29918, 13094, 29898, 4262, 29892, 3983, 29897, 13, 4977, 353, 302, 29895, 29889, 13445, 20069, 29889, 10095, 10759, 275, 1252, 3167, 29898, 29880, 513, 29889, 29882, 309, 2151, 29892, 3983, 29922, 4977, 29918, 4262, 29897, 13, 13, 29937, 20693, 326, 3950, 13, 459, 353, 302, 29895, 29889, 20640, 3950, 29889, 29903, 29887, 29881, 29898, 29900, 29889, 29900, 29896, 29897, 13, 21935, 353, 302, 29895, 29889, 20640, 3950, 29889, 14098, 29898, 6051, 351, 29918, 10889, 29922, 29900, 29889, 29900, 29896, 29897, 13, 13, 29937, 9586, 1288, 2106, 13, 4270, 353, 302, 29895, 29889, 29894, 29939, 29879, 29889, 12513, 29924, 11925, 2792, 29898, 4977, 29892, 29871, 299, 29885, 29892, 302, 29918, 27736, 29922, 29876, 29918, 27736, 29897, 13, 4270, 29889, 2344, 29918, 16744, 29898, 29876, 29895, 29889, 15755, 29889, 11228, 19427, 29889, 8945, 29898, 4172, 3359, 29922, 29900, 29889, 29900, 29896, 876, 13, 13, 29937, 26391, 13, 893, 353, 302, 29895, 29889, 7789, 3714, 2792, 29898, 29880, 513, 29892, 1015, 29892, 1197, 1288, 29918, 3859, 29922, 4270, 29892, 758, 16122, 261, 29922, 21935, 29897, 13, 13, 2527, 10817, 29918, 8977, 353, 426, 13, 1678, 525, 1524, 362, 2396, 7442, 29889, 1915, 3493, 29898, 29896, 29892, 302, 29918, 1524, 29892, 302, 29918, 1524, 511, 13, 1678, 525, 430, 351, 29880, 29918, 12676, 2396, 19997, 13, 1678, 525, 430, 351, 29880, 29918, 2704, 29918, 974, 29918, 12676, 2396, 19997, 13, 1678, 525, 12324, 29918, 4650, 29918, 12765, 2396, 19997, 13, 1678, 525, 12324, 29918, 4650, 29918, 12765, 29918, 535, 29926, 2396, 5159, 13, 29913, 13, 13, 29937, 20535, 403, 2684, 364, 1251, 13, 4650, 29918, 735, 627, 353, 302, 29895, 29889, 735, 627, 29889, 303, 1479, 29891, 29918, 3859, 29898, 29880, 513, 29892, 1158, 543, 1524, 1230, 613, 29234, 29922, 5574, 29892, 304, 29880, 29922, 29896, 29872, 29899, 29896, 29900, 29897, 13, 13, 1454, 372, 297, 260, 29939, 18933, 29898, 3881, 29898, 29876, 29918, 1524, 22164, 13, 1678, 714, 353, 17971, 29889, 3389, 29898, 29876, 29918, 1524, 29922, 29896, 29897, 13, 1678, 21556, 29918, 8977, 1839, 430, 351, 29880, 29918, 12676, 13359, 4397, 29898, 893, 29889, 430, 351, 29880, 29889, 12676, 29897, 13, 1678, 21556, 29918, 8977, 1839, 430, 351, 29880, 29918, 2704, 29918, 974, 29918, 12676, 13359, 4397, 29898, 893, 29889, 430, 351, 29880, 29889, 2704, 29918, 974, 29918, 12676, 29897, 13, 1678, 364, 1251, 29918, 484, 3631, 353, 7442, 29889, 2378, 29898, 893, 29889, 3859, 29889, 517, 29918, 5344, 3101, 13, 1678, 364, 1251, 29918, 12765, 353, 364, 1251, 29918, 735, 627, 448, 364, 1251, 29918, 484, 3631, 13, 1678, 364, 1251, 29918, 12765, 29918, 535, 29926, 353, 364, 1251, 29918, 735, 627, 448, 364, 1251, 29918, 484, 3631, 29889, 535, 29926, 688, 403, 580, 13, 1678, 21556, 29918, 8977, 1839, 12324, 29918, 4650, 29918, 12765, 13359, 4397, 29898, 433, 29889, 12324, 29898, 4650, 29918, 12765, 876, 13, 1678, 21556, 29918, 8977, 1839, 12324, 29918, 4650, 29918, 12765, 29918, 535, 29926, 13359, 4397, 29898, 433, 29889, 12324, 29898, 4650, 29918, 12765, 29918, 535, 29926, 876, 13, 13, 2527, 10817, 29918, 2176, 353, 10518, 29889, 17271, 29898, 2527, 10817, 29918, 8977, 29897, 13, 2527, 10817, 29918, 2176, 29889, 517, 29918, 24633, 29898, 29888, 29908, 29912, 7620, 29918, 2084, 6822, 2797, 29924, 3319, 2312, 3227, 3571, 3227, 29876, 29918, 27736, 3227, 29876, 29918, 1524, 7690, 20267, 29916, 613, 2380, 29922, 8824, 29897, 13, 2 ]
flask_login_without_orm/main.py
leynier/flask-login-without-orm
5
144231
from json import load from os import getenv from typing import Dict, Optional from flask import Flask, redirect, url_for from flask_login import ( LoginManager, UserMixin, current_user, login_required, login_user, logout_user, ) app = Flask(__name__) app.config["SECRET_KEY"] = getenv("SECRET_KEY", default="secret_key_example") login_manager = LoginManager(app) users: Dict[str, "User"] = {} class User(UserMixin): def __init__(self, id: str, username: str, email: str, password: str): self.id = id self.username = username self.email = email self.password = password @staticmethod def get(user_id: str) -> Optional["User"]: return users.get(user_id) def __str__(self) -> str: return f"<Id: {self.id}, Username: {self.username}, Email: {self.email}>" def __repr__(self) -> str: return self.__str__() with open("users.json") as file: data = load(file) for key in data: users[key] = User( id=key, username=data[key]["username"], email=data[key]["email"], password=data[key]["password"], ) @login_manager.user_loader def load_user(user_id: str) -> Optional[User]: return User.get(user_id) @app.get("/") def index(): username = "anonymous" if current_user.is_authenticated: # type: ignore username = current_user.username # type: ignore return f""" <h1>Hi {username}</h1> <h3>Welcome to Flask Login without ORM!</h3> """ @app.get("/login/<id>/<password>") def login(id, password): user = User.get(id) print(user) if user and user.password == password: login_user(user) return redirect(url_for("index")) return "<h1>Invalid user id or password</h1>" @app.get("/logout") @login_required def logout(): logout_user() return redirect(url_for("index")) @app.get("/settings") @login_required def settings(): return "<h1>Route protected</h1>"
[ 1, 515, 4390, 1053, 2254, 13, 3166, 2897, 1053, 679, 6272, 13, 3166, 19229, 1053, 360, 919, 29892, 28379, 13, 13, 3166, 29784, 1053, 2379, 1278, 29892, 6684, 29892, 3142, 29918, 1454, 13, 3166, 29784, 29918, 7507, 1053, 313, 13, 1678, 19130, 3260, 29892, 13, 1678, 4911, 29924, 861, 262, 29892, 13, 1678, 1857, 29918, 1792, 29892, 13, 1678, 6464, 29918, 12403, 29892, 13, 1678, 6464, 29918, 1792, 29892, 13, 1678, 1480, 449, 29918, 1792, 29892, 13, 29897, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 932, 29889, 2917, 3366, 1660, 22245, 29911, 29918, 10818, 3108, 353, 679, 6272, 703, 1660, 22245, 29911, 29918, 10818, 613, 2322, 543, 19024, 29918, 1989, 29918, 4773, 1159, 13, 13, 7507, 29918, 12847, 353, 19130, 3260, 29898, 932, 29897, 13, 13, 7193, 29901, 360, 919, 29961, 710, 29892, 376, 2659, 3108, 353, 6571, 13, 13, 13, 1990, 4911, 29898, 2659, 29924, 861, 262, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1178, 29901, 851, 29892, 8952, 29901, 851, 29892, 4876, 29901, 851, 29892, 4800, 29901, 851, 1125, 13, 4706, 1583, 29889, 333, 353, 1178, 13, 4706, 1583, 29889, 6786, 353, 8952, 13, 4706, 1583, 29889, 5269, 353, 4876, 13, 4706, 1583, 29889, 5630, 353, 4800, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29898, 1792, 29918, 333, 29901, 851, 29897, 1599, 28379, 3366, 2659, 3108, 29901, 13, 4706, 736, 4160, 29889, 657, 29898, 1792, 29918, 333, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 285, 29908, 29966, 1204, 29901, 426, 1311, 29889, 333, 1118, 4911, 978, 29901, 426, 1311, 29889, 6786, 1118, 22608, 29901, 426, 1311, 29889, 5269, 29913, 11903, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 1583, 17255, 710, 1649, 580, 13, 13, 13, 2541, 1722, 703, 7193, 29889, 3126, 1159, 408, 934, 29901, 13, 1678, 848, 353, 2254, 29898, 1445, 29897, 13, 1678, 363, 1820, 297, 848, 29901, 13, 4706, 4160, 29961, 1989, 29962, 353, 4911, 29898, 13, 9651, 1178, 29922, 1989, 29892, 13, 9651, 8952, 29922, 1272, 29961, 1989, 29962, 3366, 6786, 12436, 13, 9651, 4876, 29922, 1272, 29961, 1989, 29962, 3366, 5269, 12436, 13, 9651, 4800, 29922, 1272, 29961, 1989, 29962, 3366, 5630, 12436, 13, 4706, 1723, 13, 13, 13, 29992, 7507, 29918, 12847, 29889, 1792, 29918, 12657, 13, 1753, 2254, 29918, 1792, 29898, 1792, 29918, 333, 29901, 851, 29897, 1599, 28379, 29961, 2659, 5387, 13, 1678, 736, 4911, 29889, 657, 29898, 1792, 29918, 333, 29897, 13, 13, 13, 29992, 932, 29889, 657, 11974, 1159, 13, 1753, 2380, 7295, 13, 1678, 8952, 353, 376, 25772, 29908, 13, 1678, 565, 1857, 29918, 1792, 29889, 275, 29918, 27218, 630, 29901, 29871, 396, 1134, 29901, 11455, 13, 4706, 8952, 353, 1857, 29918, 1792, 29889, 6786, 29871, 396, 1134, 29901, 11455, 13, 1678, 736, 285, 15945, 29908, 13, 4706, 529, 29882, 29896, 29958, 18567, 426, 6786, 16040, 29882, 29896, 29958, 13, 4706, 529, 29882, 29941, 29958, 28862, 2763, 304, 2379, 1278, 19130, 1728, 6323, 29924, 29991, 829, 29882, 29941, 29958, 13, 1678, 9995, 13, 13, 13, 29992, 932, 29889, 657, 11974, 7507, 29914, 29966, 333, 20690, 29966, 5630, 29958, 1159, 13, 1753, 6464, 29898, 333, 29892, 4800, 1125, 13, 1678, 1404, 353, 4911, 29889, 657, 29898, 333, 29897, 13, 1678, 1596, 29898, 1792, 29897, 13, 1678, 565, 1404, 322, 1404, 29889, 5630, 1275, 4800, 29901, 13, 4706, 6464, 29918, 1792, 29898, 1792, 29897, 13, 4706, 736, 6684, 29898, 2271, 29918, 1454, 703, 2248, 5783, 13, 1678, 736, 9872, 29882, 29896, 29958, 13919, 1404, 1178, 470, 4800, 829, 29882, 29896, 11903, 13, 13, 13, 29992, 932, 29889, 657, 11974, 1188, 449, 1159, 13, 29992, 7507, 29918, 12403, 13, 1753, 1480, 449, 7295, 13, 1678, 1480, 449, 29918, 1792, 580, 13, 1678, 736, 6684, 29898, 2271, 29918, 1454, 703, 2248, 5783, 13, 13, 13, 29992, 932, 29889, 657, 11974, 11027, 1159, 13, 29992, 7507, 29918, 12403, 13, 1753, 6055, 7295, 13, 1678, 736, 9872, 29882, 29896, 29958, 12085, 6364, 829, 29882, 29896, 11903, 13, 2 ]
test/warning_test.py
evanofslack/samila
1
162122
<gh_stars>1-10 # -*- coding: utf-8 -*- """ >>> import os >>> import json >>> from samila import * >>> from pytest import warns >>> g = GenerativeImage(lambda x,y: 0, lambda x,y: 0) >>> g.generate(step=0.1) >>> result = g.save_data() >>> g_ = GenerativeImage(data=open('data.json', 'r')) >>> g_.data1 == g.data1 True >>> g_.data2 == g.data2 True >>> with open('data.json', 'w') as fp: ... json.dump({'data1': [0], 'data2': [0], 'matplotlib_version': '0'}, fp) >>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."): ... g = GenerativeImage(lambda x,y: 0, lambda x,y: 0, data=open('data.json', 'r')) >>> with open('config.json', 'w') as fp: ... json.dump({'f1': 'x', 'f2': 'y', 'matplotlib_version': '0'}, fp) >>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."): ... g = GenerativeImage(config=open('config.json', 'r')) >>> os.remove('data.json') >>> os.remove('config.json') """
[ 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, 15945, 29908, 13, 6778, 29958, 1053, 2897, 13, 6778, 29958, 1053, 4390, 13, 6778, 29958, 515, 269, 1344, 29874, 1053, 334, 13, 6778, 29958, 515, 11451, 1688, 1053, 1370, 1983, 13, 6778, 29958, 330, 353, 3251, 1230, 2940, 29898, 2892, 921, 29892, 29891, 29901, 29871, 29900, 29892, 14013, 921, 29892, 29891, 29901, 29871, 29900, 29897, 13, 6778, 29958, 330, 29889, 17158, 29898, 10568, 29922, 29900, 29889, 29896, 29897, 13, 6778, 29958, 1121, 353, 330, 29889, 7620, 29918, 1272, 580, 13, 6778, 29958, 330, 29918, 353, 3251, 1230, 2940, 29898, 1272, 29922, 3150, 877, 1272, 29889, 3126, 742, 525, 29878, 8785, 13, 6778, 29958, 330, 5396, 1272, 29896, 1275, 330, 29889, 1272, 29896, 13, 5574, 13, 6778, 29958, 330, 5396, 1272, 29906, 1275, 330, 29889, 1272, 29906, 13, 5574, 13, 6778, 29958, 411, 1722, 877, 1272, 29889, 3126, 742, 525, 29893, 1495, 408, 285, 29886, 29901, 13, 856, 268, 4390, 29889, 15070, 3319, 29915, 1272, 29896, 2396, 518, 29900, 1402, 525, 1272, 29906, 2396, 518, 29900, 1402, 525, 2922, 17357, 29918, 3259, 2396, 525, 29900, 16675, 285, 29886, 29897, 13, 6778, 29958, 411, 1370, 1983, 29898, 7944, 22709, 29892, 1993, 29922, 29878, 29908, 4435, 22889, 1873, 28104, 29897, 338, 1422, 515, 15850, 29892, 24580, 1122, 367, 1422, 1213, 1125, 13, 856, 268, 330, 353, 3251, 1230, 2940, 29898, 2892, 921, 29892, 29891, 29901, 29871, 29900, 29892, 14013, 921, 29892, 29891, 29901, 29871, 29900, 29892, 848, 29922, 3150, 877, 1272, 29889, 3126, 742, 525, 29878, 8785, 13, 6778, 29958, 411, 1722, 877, 2917, 29889, 3126, 742, 525, 29893, 1495, 408, 285, 29886, 29901, 13, 856, 268, 4390, 29889, 15070, 3319, 29915, 29888, 29896, 2396, 525, 29916, 742, 525, 29888, 29906, 2396, 525, 29891, 742, 525, 2922, 17357, 29918, 3259, 2396, 525, 29900, 16675, 285, 29886, 29897, 13, 6778, 29958, 411, 1370, 1983, 29898, 7944, 22709, 29892, 1993, 29922, 29878, 29908, 4435, 22889, 1873, 28104, 29897, 338, 1422, 515, 15850, 29892, 24580, 1122, 367, 1422, 1213, 1125, 13, 856, 268, 330, 353, 3251, 1230, 2940, 29898, 2917, 29922, 3150, 877, 2917, 29889, 3126, 742, 525, 29878, 8785, 13, 6778, 29958, 2897, 29889, 5992, 877, 1272, 29889, 3126, 1495, 13, 6778, 29958, 2897, 29889, 5992, 877, 2917, 29889, 3126, 1495, 13, 15945, 29908, 13, 2 ]
tests/reproducibility/fixtures.py
zblumen/stellargraph
3
88576
<gh_stars>1-10 # -*- coding: utf-8 -*- # # Copyright 2020 Data61, CSIRO # # 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 def models_equals(model1, model2): w1 = model1.get_weights() w2 = model2.get_weights() return all(np.array_equal(w, w_new) for w, w_new in zip(w1, w2)) def assert_reproducible(func, num_iter=20): """ Assert Keras models produced from calling ``func`` are reproducible. Args: func (callable): Function to check for reproducible model num_iter (int, default 20): Number of iterations to run through to validate reproducibility. """ model = func() for i in range(num_iter): model_new = func() assert models_equals(model, model_new), ( model.get_weights(), model_new.get_weights(), )
[ 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, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 3630, 29953, 29896, 29892, 315, 5425, 1672, 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, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1753, 4733, 29918, 10954, 29898, 4299, 29896, 29892, 1904, 29906, 1125, 13, 1678, 281, 29896, 353, 1904, 29896, 29889, 657, 29918, 705, 5861, 580, 13, 1678, 281, 29906, 353, 1904, 29906, 29889, 657, 29918, 705, 5861, 580, 13, 1678, 736, 599, 29898, 9302, 29889, 2378, 29918, 11745, 29898, 29893, 29892, 281, 29918, 1482, 29897, 363, 281, 29892, 281, 29918, 1482, 297, 14319, 29898, 29893, 29896, 29892, 281, 29906, 876, 13, 13, 13, 1753, 4974, 29918, 276, 5498, 15520, 29898, 9891, 29892, 954, 29918, 1524, 29922, 29906, 29900, 1125, 13, 1678, 9995, 13, 1678, 16499, 12693, 294, 4733, 7371, 515, 5432, 4954, 9891, 16159, 526, 9483, 15520, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 3653, 313, 4804, 519, 1125, 6680, 304, 1423, 363, 9483, 15520, 1904, 13, 4706, 954, 29918, 1524, 313, 524, 29892, 2322, 29871, 29906, 29900, 1125, 9681, 310, 24372, 304, 1065, 1549, 304, 12725, 9483, 455, 29890, 1793, 29889, 13, 13, 1678, 9995, 13, 1678, 1904, 353, 3653, 580, 13, 1678, 363, 474, 297, 3464, 29898, 1949, 29918, 1524, 1125, 13, 4706, 1904, 29918, 1482, 353, 3653, 580, 13, 4706, 4974, 4733, 29918, 10954, 29898, 4299, 29892, 1904, 29918, 1482, 511, 313, 13, 9651, 1904, 29889, 657, 29918, 705, 5861, 3285, 13, 9651, 1904, 29918, 1482, 29889, 657, 29918, 705, 5861, 3285, 13, 4706, 1723, 13, 2 ]
V2RaycSpider0825/MiddleKey/VMes_IO.py
TOMJERRY23333/V2RayCloudSpider
1
2235
from spiderNest.preIntro import * path_ = os.path.dirname(os.path.dirname(__file__)) + '/dataBase/log_information.csv' def save_login_info(VMess, class_): """ VMess入库 class_: ssr or v2ray """ now = str(datetime.now()).split('.')[0] with open(path_, 'a', encoding='utf-8', newline='') as f: writer = csv.writer(f) # 入库时间,Vmess,初始化状态:0 writer.writerow(['{}'.format(now), '{}'.format(VMess), class_, '0']) def vmess_IO(class_): """ 获取可用订阅链接并刷新存储池 class_: ssr ; v2ray """ def refresh_log(dataFlow): with open(path_, 'w', encoding='utf-8', newline='') as f: writer = csv.writer(f) writer.writerows(dataFlow) try: with open(path_, 'r', encoding='utf-8') as f: reader = csv.reader(f) vm_q = [vm for vm in reader] new_q = vm_q for i, value in enumerate(reversed(vm_q)): if value[-1] == '0' and value[-2] == class_: vm = value[1] new_q[-(i + 1)][-1] = '1' break refresh_log(new_q) return vm except UnboundLocalError: return '无可用订阅连接' def avi_num(): from datetime import datetime, timedelta with open(path_, 'r', encoding='utf-8') as f: reader = csv.reader(f) vm_list = [i for i in reader] # ['2020-08-06 04:27:59', 'link','class_', '1'] vm_q = [vm for vm in vm_list if vm[-1] == '0'] tag_items = '' for vm in vm_list: if vm[-1] == '0': bei_ing_time = datetime.fromisoformat(vm[0]) + timedelta(hours=12) tag_items += '\n【√可选】【{}】#{}'.format(bei_ing_time, vm[-2]) # return vm_q.__len__() return tag_items
[ 1, 515, 805, 1241, 29940, 342, 29889, 1457, 2928, 307, 1053, 334, 13, 13, 2084, 29918, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 876, 718, 8207, 1272, 5160, 29914, 1188, 29918, 19678, 29889, 7638, 29915, 13, 13, 13, 1753, 4078, 29918, 7507, 29918, 3888, 29898, 9219, 404, 29892, 770, 29918, 1125, 13, 1678, 9995, 13, 1678, 11400, 404, 30752, 31700, 13, 1678, 770, 29918, 29901, 17971, 29878, 470, 325, 29906, 764, 13, 1678, 9995, 13, 1678, 1286, 353, 851, 29898, 12673, 29889, 3707, 16655, 5451, 12839, 29861, 29900, 29962, 13, 1678, 411, 1722, 29898, 2084, 3383, 525, 29874, 742, 8025, 2433, 9420, 29899, 29947, 742, 25899, 2433, 1495, 408, 285, 29901, 13, 4706, 9227, 353, 11799, 29889, 13236, 29898, 29888, 29897, 13, 4706, 396, 29871, 30752, 31700, 30594, 31016, 30214, 29963, 12062, 29892, 31120, 31020, 30705, 31531, 31613, 29901, 29900, 13, 4706, 9227, 29889, 13236, 340, 18959, 8875, 4286, 4830, 29898, 3707, 511, 525, 8875, 4286, 4830, 29898, 9219, 404, 511, 770, 3383, 525, 29900, 11287, 13, 13, 13, 1753, 325, 12062, 29918, 5971, 29898, 1990, 29918, 1125, 13, 1678, 9995, 13, 268, 31024, 30683, 30682, 30406, 235, 177, 165, 236, 155, 136, 236, 150, 193, 31092, 31666, 232, 139, 186, 30374, 30946, 232, 133, 171, 31853, 13, 1678, 770, 29918, 29901, 17971, 29878, 2056, 325, 29906, 764, 13, 1678, 9995, 13, 13, 1678, 822, 11086, 29918, 1188, 29898, 1272, 17907, 1125, 13, 4706, 411, 1722, 29898, 2084, 3383, 525, 29893, 742, 8025, 2433, 9420, 29899, 29947, 742, 25899, 2433, 1495, 408, 285, 29901, 13, 9651, 9227, 353, 11799, 29889, 13236, 29898, 29888, 29897, 13, 9651, 9227, 29889, 13236, 1242, 29898, 1272, 17907, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 411, 1722, 29898, 2084, 3383, 525, 29878, 742, 8025, 2433, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 9651, 9591, 353, 11799, 29889, 16950, 29898, 29888, 29897, 13, 9651, 22419, 29918, 29939, 353, 518, 6925, 363, 22419, 297, 9591, 29962, 13, 9651, 716, 29918, 29939, 353, 22419, 29918, 29939, 13, 9651, 363, 474, 29892, 995, 297, 26985, 29898, 276, 874, 287, 29898, 6925, 29918, 29939, 22164, 13, 18884, 565, 995, 14352, 29896, 29962, 1275, 525, 29900, 29915, 322, 995, 14352, 29906, 29962, 1275, 770, 29918, 29901, 13, 462, 1678, 22419, 353, 995, 29961, 29896, 29962, 13, 462, 1678, 716, 29918, 29939, 14352, 29898, 29875, 718, 29871, 29896, 29897, 3816, 29899, 29896, 29962, 353, 525, 29896, 29915, 13, 462, 1678, 2867, 13, 4706, 11086, 29918, 1188, 29898, 1482, 29918, 29939, 29897, 13, 4706, 736, 22419, 13, 1678, 5174, 853, 9917, 7717, 2392, 29901, 13, 4706, 736, 525, 31352, 30682, 30406, 235, 177, 165, 236, 155, 136, 31903, 31092, 29915, 13, 13, 13, 1753, 1029, 29875, 29918, 1949, 7295, 13, 1678, 515, 12865, 1053, 12865, 29892, 5335, 287, 2554, 13, 1678, 411, 1722, 29898, 2084, 3383, 525, 29878, 742, 8025, 2433, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 4706, 9591, 353, 11799, 29889, 16950, 29898, 29888, 29897, 13, 13, 4706, 22419, 29918, 1761, 353, 518, 29875, 363, 474, 297, 9591, 29962, 13, 4706, 396, 6024, 29906, 29900, 29906, 29900, 29899, 29900, 29947, 29899, 29900, 29953, 29871, 29900, 29946, 29901, 29906, 29955, 29901, 29945, 29929, 742, 525, 2324, 3788, 1990, 29918, 742, 525, 29896, 2033, 13, 13, 4706, 22419, 29918, 29939, 353, 518, 6925, 363, 22419, 297, 22419, 29918, 1761, 565, 22419, 14352, 29896, 29962, 1275, 525, 29900, 2033, 13, 13, 4706, 4055, 29918, 7076, 353, 6629, 13, 4706, 363, 22419, 297, 22419, 29918, 1761, 29901, 13, 9651, 565, 22419, 14352, 29896, 29962, 1275, 525, 29900, 2396, 13, 18884, 2862, 29918, 292, 29918, 2230, 353, 12865, 29889, 3166, 10718, 4830, 29898, 6925, 29961, 29900, 2314, 718, 5335, 287, 2554, 29898, 29882, 2470, 29922, 29896, 29906, 29897, 13, 18884, 4055, 29918, 7076, 4619, 11297, 29876, 31478, 30562, 30682, 31333, 31472, 31478, 8875, 31472, 29937, 8875, 4286, 4830, 29898, 27242, 29918, 292, 29918, 2230, 29892, 22419, 14352, 29906, 2314, 13, 13, 4706, 396, 736, 22419, 29918, 29939, 17255, 2435, 1649, 580, 13, 4706, 736, 4055, 29918, 7076, 13, 2 ]
understandability/understandability.py
zhangshyue/regex-library
0
194282
<filename>understandability/understandability.py import root_pb2 as root import re import sys import base64 from google.protobuf.json_format import MessageToDict import json escape_reserved = ['+', '*', '?', '^', '$', '\\', '.', '[', ']', '{', '}', '(', ')', '|', '/'] messages = [] def add_annotation(entity, note, output): annotation = output.annotations.add() annotation.note = note annotation.entity = entity # Analyze understandability of [] def analyze_set(tokens, output): set_string = "[" set_messages = [] characters = [] # what is in set for i in range(len(tokens)): set_string += tokens[i].token if tokens[i].token == "]" and tokens[i].type == root.TokenType.CharacterClass: # \d better than [0-9] if i == 1 and tokens[0].type == root.TokenType.CharacterClass and \ tokens[0].characterclass == root.CharacterClassType.RangeSet and tokens[0].token == "0-9": add_annotation("[0-9]", "\\d", output) # \D better than [^\d], \S better than [^\s], \W better than [^\w] if i == 2 and tokens[0].type == root.TokenType.CharacterClass and \ tokens[0].characterclass == root.CharacterClassType.SetNegation and \ tokens[1].type == root.TokenType.CharacterClass and \ (tokens[1].characterclass == root.CharacterClassType.Digit or \ tokens[1].characterclass == root.CharacterClassType.Word or \ tokens[1].characterclass == root.CharacterClassType.Whitespace): add_annotation("[^" + tokens[1].token + "]", "\\" + tokens[1].token[-1].upper(), output) # T3 \$ better than [$] -- T3 if i == 1 and tokens[0].token in escape_reserved: add_annotation("[" + tokens[0].token + "]", "\\" + tokens[0].token, output) # [aaabbb] is equivalent to [ab] if len(set(characters)) != len(characters): add_annotation(set_string, "repeated characters in []", output) return set_messages, i + 1 # [}{] better than [\0175\0173] # T2 and T4 (repetitive but no better solution for now) if tokens[i].type == root.TokenType.Escape: if tokens[i].escape == root.EscapeType.Hexadecimal: char = bytearray.fromhex(tokens[i].token[-2:]).decode('unicode-escape') elif tokens[i].escape == root.EscapeType.Octal: char = tokens[i].token.encode('utf-8').decode('unicode-escape') else: char = "" if char and char in escape_reserved: add_annotation(tokens[i].token, "\\" + char, output) elif char: add_annotation(tokens[i].token, char, output) if tokens[i].type == root.TokenType.Character: characters.extend(list(tokens[i].token)) else: characters.append(tokens[i].token) return set_messages, i + 1 def analyze(tokens, output, raw): # regular expression is limited to 128 characters if len(raw) > 128: add_annotation(raw, "rejex is too long. Limit rejex to 128 characters", output) i = 0 while i < len(tokens): token = tokens[i] # print(token) if i >= 1 and token.type == root.TokenType.QuantifierModifier and \ token.quantifiermodifier == root.QuantifierModifierType.SpecifiedQuantifier: # S1 if token.token[1:-1].isdigit() and int(token.token[1:-1]) < 6: add_annotation(tokens[i - 1].token + token.token, tokens[i - 1].token * int(token.token[1:-1]), output) else: # S3 # S{7,7} should be S{7} # S{3,3} should be SSS nums = re.findall("\d", token.token[1:-1]) if len(nums) == 2 and nums[0] == nums[1]: if int(nums[0]) < 6: add_annotation(tokens[i - 1].token + token.token, tokens[i - 1].token * int(nums[0]), output) else: add_annotation(tokens[i - 1].token + token.token, tokens[i - 1].token + "{" + str(nums[0]) + "}", output) # L1 if len(nums) == 1 and int(nums[0]) < 5: add_annotation(tokens[i - 1].token + token.token, tokens[i - 1].token * int(nums[0]) + "+", output) # L2 if token.type == root.TokenType.QuantifierModifier and \ token.quantifiermodifier == root.QuantifierModifierType.Star: if i - 1 >= 0 and tokens[i - 1].type == root.TokenType.Character and len(tokens[i - 1].token) >= 2 and \ tokens[i - 1].token[-1] == tokens[i - 1].token[-2]: add_annotation(tokens[i - 1].token + token.token, tokens[i - 1].token[:-1] + "+", output) # T2 and T4 if token.type == root.TokenType.Escape: if token.escape == root.EscapeType.Hexadecimal: char = bytearray.fromhex(token.token[-2:]).decode('unicode-escape') elif token.escape == root.EscapeType.Octal: char = token.token.encode('utf-8').decode('unicode-escape') else: char = "" if char and char in escape_reserved: add_annotation(token.token, "\\" + char, output) elif char: add_annotation(token.token, char, output) # [] if token.type == root.TokenType.CharacterClass and \ token.characterclass == root.CharacterClassType.OpenSet: set_messages, length = analyze_set(tokens[i + 1:], output) i += length - 1 # += 1 later i += 1 # https://www.dcode.fr/regular-expression-simplificator # Get some ideas from here # https://help.analyticsedge.com/error/400-regular-expression-too-long/ # Got some ideas about regex length def main(): expr_raw = base64.b64decode(sys.argv[1]) expr = root.Root() expr.ParseFromString(expr_raw) output = root.Output() analyze(expr.expression.tokens, output, expr.expression.raw) if len(output.annotations) <= 1: output.status = str(len(output.annotations)) + " understandability error found" else: output.status = str(len(output.annotations)) + " understandability errors found" print(base64.b64encode(output.SerializeToString()).decode('utf-8')) if __name__ == "__main__": main()
[ 1, 529, 9507, 29958, 5062, 1689, 3097, 29914, 5062, 1689, 3097, 29889, 2272, 13, 5215, 3876, 29918, 24381, 29906, 408, 3876, 13, 5215, 337, 13, 5215, 10876, 13, 5215, 2967, 29953, 29946, 13, 3166, 5386, 29889, 17529, 9721, 29889, 3126, 29918, 4830, 1053, 7777, 1762, 21533, 13, 5215, 4390, 13, 13, 21587, 29918, 690, 9841, 353, 6024, 29974, 742, 525, 29930, 742, 525, 29973, 742, 525, 29985, 742, 14180, 742, 525, 1966, 742, 15300, 742, 525, 29961, 742, 525, 29962, 742, 22372, 742, 525, 29913, 742, 525, 29317, 25710, 742, 525, 29989, 742, 8207, 2033, 13, 19158, 353, 5159, 13, 13, 13, 1753, 788, 29918, 18317, 29898, 10041, 29892, 4443, 29892, 1962, 1125, 13, 1678, 17195, 353, 1962, 29889, 6735, 800, 29889, 1202, 580, 13, 1678, 17195, 29889, 6812, 353, 4443, 13, 1678, 17195, 29889, 10041, 353, 7855, 13, 13, 13, 29937, 11597, 29891, 911, 2274, 3097, 310, 5159, 13, 1753, 27599, 29918, 842, 29898, 517, 12360, 29892, 1962, 1125, 13, 1678, 731, 29918, 1807, 353, 376, 3366, 13, 1678, 731, 29918, 19158, 353, 5159, 13, 1678, 4890, 353, 5159, 29871, 396, 825, 338, 297, 731, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 517, 12360, 22164, 13, 4706, 731, 29918, 1807, 4619, 18897, 29961, 29875, 1822, 6979, 13, 4706, 565, 18897, 29961, 29875, 1822, 6979, 1275, 376, 18017, 322, 18897, 29961, 29875, 1822, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 20755, 2385, 29901, 13, 9651, 396, 320, 29881, 2253, 1135, 518, 29900, 29899, 29929, 29962, 13, 9651, 565, 474, 1275, 29871, 29896, 322, 18897, 29961, 29900, 1822, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 20755, 2385, 322, 320, 13, 462, 1678, 18897, 29961, 29900, 1822, 18609, 1990, 1275, 3876, 29889, 20755, 2385, 1542, 29889, 6069, 2697, 322, 18897, 29961, 29900, 1822, 6979, 1275, 376, 29900, 29899, 29929, 1115, 13, 18884, 788, 29918, 18317, 703, 29961, 29900, 29899, 29929, 29962, 613, 376, 1966, 29881, 613, 1962, 29897, 13, 9651, 396, 320, 29928, 2253, 1135, 518, 3823, 29881, 1402, 320, 29903, 2253, 1135, 518, 3823, 29879, 1402, 320, 29956, 2253, 1135, 518, 3823, 29893, 29962, 13, 9651, 565, 474, 1275, 29871, 29906, 322, 18897, 29961, 29900, 1822, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 20755, 2385, 322, 320, 13, 462, 1678, 18897, 29961, 29900, 1822, 18609, 1990, 1275, 3876, 29889, 20755, 2385, 1542, 29889, 2697, 29940, 387, 362, 322, 320, 13, 462, 1678, 18897, 29961, 29896, 1822, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 20755, 2385, 322, 320, 13, 462, 1678, 313, 517, 12360, 29961, 29896, 1822, 18609, 1990, 1275, 3876, 29889, 20755, 2385, 1542, 29889, 14991, 277, 470, 320, 13, 462, 268, 18897, 29961, 29896, 1822, 18609, 1990, 1275, 3876, 29889, 20755, 2385, 1542, 29889, 14463, 470, 320, 13, 462, 268, 18897, 29961, 29896, 1822, 18609, 1990, 1275, 3876, 29889, 20755, 2385, 1542, 29889, 8809, 3246, 3535, 1125, 13, 18884, 788, 29918, 18317, 703, 22896, 29908, 718, 18897, 29961, 29896, 1822, 6979, 718, 376, 29962, 613, 376, 1966, 29908, 718, 18897, 29961, 29896, 1822, 6979, 14352, 29896, 1822, 21064, 3285, 1962, 29897, 13, 9651, 396, 323, 29941, 20282, 2253, 1135, 518, 29938, 29962, 1192, 323, 29941, 13, 9651, 565, 474, 1275, 29871, 29896, 322, 18897, 29961, 29900, 1822, 6979, 297, 10169, 29918, 690, 9841, 29901, 13, 18884, 788, 29918, 18317, 703, 3366, 718, 18897, 29961, 29900, 1822, 6979, 718, 376, 29962, 613, 376, 1966, 29908, 718, 18897, 29961, 29900, 1822, 6979, 29892, 1962, 29897, 13, 9651, 396, 518, 7340, 370, 1327, 29962, 338, 7126, 304, 518, 370, 29962, 13, 9651, 565, 7431, 29898, 842, 29898, 3090, 21706, 876, 2804, 7431, 29898, 3090, 21706, 1125, 13, 18884, 788, 29918, 18317, 29898, 842, 29918, 1807, 29892, 376, 276, 412, 630, 4890, 297, 5159, 613, 1962, 29897, 13, 9651, 736, 731, 29918, 19158, 29892, 474, 718, 29871, 29896, 13, 4706, 396, 518, 1157, 29962, 2253, 1135, 12452, 29900, 29896, 29955, 29945, 29905, 29900, 29896, 29955, 29941, 29962, 13, 4706, 396, 323, 29906, 322, 323, 29946, 313, 3445, 300, 3321, 541, 694, 2253, 1650, 363, 1286, 29897, 13, 4706, 565, 18897, 29961, 29875, 1822, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 14190, 5738, 29901, 13, 9651, 565, 18897, 29961, 29875, 1822, 21587, 1275, 3876, 29889, 14190, 5738, 1542, 29889, 29950, 735, 1943, 29883, 3039, 29901, 13, 18884, 1373, 353, 7023, 2378, 29889, 3166, 20970, 29898, 517, 12360, 29961, 29875, 1822, 6979, 14352, 29906, 29901, 14664, 13808, 877, 2523, 356, 29899, 21587, 1495, 13, 9651, 25342, 18897, 29961, 29875, 1822, 21587, 1275, 3876, 29889, 14190, 5738, 1542, 29889, 25375, 284, 29901, 13, 18884, 1373, 353, 18897, 29961, 29875, 1822, 6979, 29889, 12508, 877, 9420, 29899, 29947, 2824, 13808, 877, 2523, 356, 29899, 21587, 1495, 13, 9651, 1683, 29901, 13, 18884, 1373, 353, 5124, 13, 9651, 565, 1373, 322, 1373, 297, 10169, 29918, 690, 9841, 29901, 13, 18884, 788, 29918, 18317, 29898, 517, 12360, 29961, 29875, 1822, 6979, 29892, 376, 1966, 29908, 718, 1373, 29892, 1962, 29897, 13, 9651, 25342, 1373, 29901, 13, 18884, 788, 29918, 18317, 29898, 517, 12360, 29961, 29875, 1822, 6979, 29892, 1373, 29892, 1962, 29897, 13, 4706, 565, 18897, 29961, 29875, 1822, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 20755, 29901, 13, 9651, 4890, 29889, 21843, 29898, 1761, 29898, 517, 12360, 29961, 29875, 1822, 6979, 876, 13, 4706, 1683, 29901, 13, 9651, 4890, 29889, 4397, 29898, 517, 12360, 29961, 29875, 1822, 6979, 29897, 13, 1678, 736, 731, 29918, 19158, 29892, 474, 718, 29871, 29896, 13, 13, 13, 1753, 27599, 29898, 517, 12360, 29892, 1962, 29892, 10650, 1125, 13, 1678, 396, 4943, 4603, 338, 9078, 304, 29871, 29896, 29906, 29947, 4890, 13, 1678, 565, 7431, 29898, 1610, 29897, 1405, 29871, 29896, 29906, 29947, 29901, 13, 4706, 788, 29918, 18317, 29898, 1610, 29892, 376, 276, 29926, 735, 338, 2086, 1472, 29889, 9628, 277, 337, 29926, 735, 304, 29871, 29896, 29906, 29947, 4890, 613, 1962, 29897, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 474, 529, 7431, 29898, 517, 12360, 1125, 13, 4706, 5993, 353, 18897, 29961, 29875, 29962, 13, 4706, 396, 1596, 29898, 6979, 29897, 13, 4706, 565, 474, 6736, 29871, 29896, 322, 5993, 29889, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 22930, 3709, 2111, 3709, 322, 320, 13, 18884, 5993, 29889, 12150, 3709, 26625, 1275, 3876, 29889, 22930, 3709, 2111, 3709, 1542, 29889, 10299, 2164, 22930, 3709, 29901, 13, 9651, 396, 317, 29896, 13, 9651, 565, 5993, 29889, 6979, 29961, 29896, 13018, 29896, 1822, 275, 26204, 580, 322, 938, 29898, 6979, 29889, 6979, 29961, 29896, 13018, 29896, 2314, 529, 29871, 29953, 29901, 13, 18884, 788, 29918, 18317, 29898, 517, 12360, 29961, 29875, 448, 29871, 29896, 1822, 6979, 718, 5993, 29889, 6979, 29892, 18897, 29961, 29875, 448, 29871, 29896, 1822, 6979, 334, 938, 29898, 6979, 29889, 6979, 29961, 29896, 13018, 29896, 11724, 1962, 29897, 13, 9651, 1683, 29901, 13, 18884, 396, 317, 29941, 13, 18884, 396, 317, 29912, 29955, 29892, 29955, 29913, 881, 367, 317, 29912, 29955, 29913, 13, 18884, 396, 317, 29912, 29941, 29892, 29941, 29913, 881, 367, 317, 1799, 13, 18884, 954, 29879, 353, 337, 29889, 2886, 497, 14182, 29881, 613, 5993, 29889, 6979, 29961, 29896, 13018, 29896, 2314, 13, 18884, 565, 7431, 29898, 1949, 29879, 29897, 1275, 29871, 29906, 322, 954, 29879, 29961, 29900, 29962, 1275, 954, 29879, 29961, 29896, 5387, 13, 462, 1678, 565, 938, 29898, 1949, 29879, 29961, 29900, 2314, 529, 29871, 29953, 29901, 13, 462, 4706, 788, 29918, 18317, 29898, 517, 12360, 29961, 29875, 448, 29871, 29896, 1822, 6979, 718, 5993, 29889, 6979, 29892, 18897, 29961, 29875, 448, 29871, 29896, 1822, 6979, 334, 938, 29898, 1949, 29879, 29961, 29900, 11724, 1962, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 788, 29918, 18317, 29898, 517, 12360, 29961, 29875, 448, 29871, 29896, 1822, 6979, 718, 5993, 29889, 6979, 29892, 13, 462, 462, 539, 18897, 29961, 29875, 448, 29871, 29896, 1822, 6979, 718, 376, 6377, 718, 851, 29898, 1949, 29879, 29961, 29900, 2314, 718, 376, 17671, 1962, 29897, 13, 18884, 396, 365, 29896, 13, 18884, 565, 7431, 29898, 1949, 29879, 29897, 1275, 29871, 29896, 322, 938, 29898, 1949, 29879, 29961, 29900, 2314, 529, 29871, 29945, 29901, 13, 462, 1678, 788, 29918, 18317, 29898, 517, 12360, 29961, 29875, 448, 29871, 29896, 1822, 6979, 718, 5993, 29889, 6979, 29892, 18897, 29961, 29875, 448, 29871, 29896, 1822, 6979, 334, 938, 29898, 1949, 29879, 29961, 29900, 2314, 718, 15691, 613, 1962, 29897, 13, 4706, 396, 365, 29906, 13, 4706, 565, 5993, 29889, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 22930, 3709, 2111, 3709, 322, 320, 13, 18884, 5993, 29889, 12150, 3709, 26625, 1275, 3876, 29889, 22930, 3709, 2111, 3709, 1542, 29889, 16213, 29901, 13, 9651, 565, 474, 448, 29871, 29896, 6736, 29871, 29900, 322, 18897, 29961, 29875, 448, 29871, 29896, 1822, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 20755, 322, 7431, 29898, 517, 12360, 29961, 29875, 448, 29871, 29896, 1822, 6979, 29897, 6736, 29871, 29906, 322, 320, 13, 462, 1678, 18897, 29961, 29875, 448, 29871, 29896, 1822, 6979, 14352, 29896, 29962, 1275, 18897, 29961, 29875, 448, 29871, 29896, 1822, 6979, 14352, 29906, 5387, 13, 18884, 788, 29918, 18317, 29898, 517, 12360, 29961, 29875, 448, 29871, 29896, 1822, 6979, 718, 5993, 29889, 6979, 29892, 18897, 29961, 29875, 448, 29871, 29896, 1822, 6979, 7503, 29899, 29896, 29962, 718, 15691, 613, 1962, 29897, 13, 4706, 396, 323, 29906, 322, 323, 29946, 13, 4706, 565, 5993, 29889, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 14190, 5738, 29901, 13, 9651, 565, 5993, 29889, 21587, 1275, 3876, 29889, 14190, 5738, 1542, 29889, 29950, 735, 1943, 29883, 3039, 29901, 13, 18884, 1373, 353, 7023, 2378, 29889, 3166, 20970, 29898, 6979, 29889, 6979, 14352, 29906, 29901, 14664, 13808, 877, 2523, 356, 29899, 21587, 1495, 13, 9651, 25342, 5993, 29889, 21587, 1275, 3876, 29889, 14190, 5738, 1542, 29889, 25375, 284, 29901, 13, 18884, 1373, 353, 5993, 29889, 6979, 29889, 12508, 877, 9420, 29899, 29947, 2824, 13808, 877, 2523, 356, 29899, 21587, 1495, 13, 9651, 1683, 29901, 13, 18884, 1373, 353, 5124, 13, 9651, 565, 1373, 322, 1373, 297, 10169, 29918, 690, 9841, 29901, 13, 18884, 788, 29918, 18317, 29898, 6979, 29889, 6979, 29892, 376, 1966, 29908, 718, 1373, 29892, 1962, 29897, 13, 9651, 25342, 1373, 29901, 13, 18884, 788, 29918, 18317, 29898, 6979, 29889, 6979, 29892, 1373, 29892, 1962, 29897, 13, 4706, 396, 5159, 13, 4706, 565, 5993, 29889, 1853, 1275, 3876, 29889, 6066, 1542, 29889, 20755, 2385, 322, 320, 13, 18884, 5993, 29889, 18609, 1990, 1275, 3876, 29889, 20755, 2385, 1542, 29889, 6585, 2697, 29901, 13, 9651, 731, 29918, 19158, 29892, 3309, 353, 27599, 29918, 842, 29898, 517, 12360, 29961, 29875, 718, 29871, 29896, 29901, 1402, 1962, 29897, 13, 9651, 474, 4619, 3309, 448, 29871, 29896, 29871, 396, 4619, 29871, 29896, 2678, 13, 4706, 474, 4619, 29871, 29896, 13, 13, 13, 29937, 2045, 597, 1636, 29889, 29881, 401, 29889, 1341, 29914, 15227, 29899, 17471, 29899, 3601, 572, 928, 1061, 13, 29937, 3617, 777, 7014, 515, 1244, 13, 29937, 2045, 597, 8477, 29889, 7054, 22026, 12864, 29889, 510, 29914, 2704, 29914, 29946, 29900, 29900, 29899, 15227, 29899, 17471, 29899, 517, 29877, 29899, 5426, 29914, 13, 29937, 15992, 777, 7014, 1048, 6528, 3309, 13, 13, 1753, 1667, 7295, 13, 1678, 22010, 29918, 1610, 353, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 13, 1678, 22010, 353, 3876, 29889, 10303, 580, 13, 1678, 22010, 29889, 12914, 4591, 1231, 29898, 13338, 29918, 1610, 29897, 13, 1678, 1962, 353, 3876, 29889, 6466, 580, 13, 1678, 27599, 29898, 13338, 29889, 17471, 29889, 517, 12360, 29892, 1962, 29892, 22010, 29889, 17471, 29889, 1610, 29897, 13, 1678, 565, 7431, 29898, 4905, 29889, 6735, 800, 29897, 5277, 29871, 29896, 29901, 13, 4706, 1962, 29889, 4882, 353, 851, 29898, 2435, 29898, 4905, 29889, 6735, 800, 876, 718, 376, 2274, 3097, 1059, 1476, 29908, 13, 1678, 1683, 29901, 13, 4706, 1962, 29889, 4882, 353, 851, 29898, 2435, 29898, 4905, 29889, 6735, 800, 876, 718, 376, 2274, 3097, 4436, 1476, 29908, 13, 1678, 1596, 29898, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 4905, 29889, 1748, 6646, 8246, 16655, 13808, 877, 9420, 29899, 29947, 8785, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
nemo/collections/nlp/utils/evaluation_utils.py
ParikhKadam/NeMo
1
23242
# ============================================================================= # Copyright 2020 NVIDIA. 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 from nemo import logging def analyze_confusion_matrix(cm, dict, max_pairs=10): """ Sort all confusions in the confusion matrix by value and display results. Print results in a format: (name -> name, value) Args: cm: Confusion matrix dict: Dictionary with key as a name and index as a value (Intents or Slots) max_pairs: Max number of confusions to print """ threshold = 5 # just arbitrary value to take confusion with at least this number confused_pairs = {} size = cm.shape[0] for i in range(size): res = cm[i].argsort() for j in range(size): pos = res[size - j - 1] # no confusion - same row and column if pos == i: continue elif cm[i][pos] >= threshold: str = f'{dict[i]} -> {dict[pos]}' confused_pairs[str] = cm[i][pos] else: break # sort by max confusions and print first max_pairs sorted_confused_pairs = sorted(confused_pairs.items(), key=lambda x: x[1], reverse=True) for i, pair_str in enumerate(sorted_confused_pairs): if i >= max_pairs: break logging.info(pair_str) def errors_per_class(cm, dict): """ Summarize confusions per each class in the confusion matrix. It can be useful both for Intents and Slots. It counts each confusion twice in both directions. Args: cm: Confusion matrix dict: Dictionary with key as a name and index as a value (Intents or Slots) """ size = cm.shape[0] confused_per_class = {} total_errors = 0 for class_num in range(size): sum = 0 for i in range(size): if i != class_num: sum += cm[class_num][i] sum += cm[i][class_num] confused_per_class[dict[class_num]] = sum total_errors += sum # logging.info(f'{dict[class_num]} - {sum}') logging.info(f'Total errors (multiplied by 2): {total_errors}') sorted_confused_per_class = sorted(confused_per_class.items(), key=lambda x: x[1], reverse=True) for conf_str in sorted_confused_per_class: logging.info(conf_str) def log_misclassified_queries(intent_labels, intent_preds, queries, intent_dict, limit=50): """ Display examples of Intent mistakes. In a format: Query, predicted and labeled intent names. """ logging.info(f'*** Misclassified intent queries (limit {limit}) ***') cnt = 0 for i in range(len(intent_preds)): if intent_labels[i] != intent_preds[i]: query = queries[i].split('\t')[0] logging.info( f'{query} (predicted: {intent_dict[intent_preds[i]]} - labeled: {intent_dict[intent_labels[i]]})' ) cnt = cnt + 1 if cnt >= limit: break def log_misclassified_slots( intent_labels, intent_preds, slot_labels, slot_preds, subtokens_mask, queries, intent_dict, slot_dict, limit=50 ): """ Display examples of Slot mistakes. In a format: Query, predicted and labeled intent names and list of predicted and labeled slot numbers. also prints dictionary of the slots at the start for easier reading. """ logging.info('') logging.info(f'*** Misclassified slots queries (limit {limit}) ***') # print slot dictionary logging.info(f'Slot dictionary:') str = '' for i, slot in enumerate(slot_dict): str += f'{i} - {slot}, ' if i % 5 == 4 or i == len(slot_dict) - 1: logging.info(str) str = '' logging.info('----------------') cnt = 0 for i in range(len(intent_preds)): cur_slot_pred = slot_preds[i][subtokens_mask[i]] cur_slot_label = slot_labels[i][subtokens_mask[i]] if not np.all(cur_slot_pred == cur_slot_label): query = queries[i].split('\t')[0] logging.info( f'{query} (predicted: {intent_dict[intent_preds[i]]} - labeled: {intent_dict[intent_labels[i]]})' ) logging.info(f'p: {cur_slot_pred}') logging.info(f'l: {cur_slot_label}') cnt = cnt + 1 if cnt >= limit: break def check_problematic_slots(slot_preds_list, slot_dict): """ Check non compliance of B- and I- slots for datasets that use such slot encoding. """ cnt = 0 # for sentence in slot_preds: # slots = sentence.split(" ") sentence = slot_preds_list for i in range(len(sentence)): slot_name = slot_dict[int(sentence[i])] if slot_name.startswith("I-"): prev_slot_name = slot_dict[int(sentence[i - 1])] if slot_name[2:] != prev_slot_name[2:]: print("Problem: " + slot_name + " - " + prev_slot_name) cnt += 1 print("Total problematic slots: " + str(cnt))
[ 1, 396, 1275, 9166, 9166, 9166, 9166, 4936, 25512, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 405, 13044, 10764, 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, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 25512, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 6583, 29877, 1053, 12183, 13, 13, 13, 1753, 27599, 29918, 5527, 3958, 29918, 5344, 29898, 4912, 29892, 9657, 29892, 4236, 29918, 29886, 7121, 29922, 29896, 29900, 1125, 13, 1678, 9995, 13, 1678, 20025, 599, 1970, 375, 1080, 297, 278, 14679, 4636, 491, 995, 322, 2479, 2582, 29889, 13, 1678, 13905, 2582, 297, 263, 3402, 29901, 313, 978, 1599, 1024, 29892, 995, 29897, 13, 1678, 826, 3174, 29901, 13, 4706, 7477, 29901, 10811, 3958, 4636, 13, 4706, 9657, 29901, 13343, 411, 1820, 408, 263, 1024, 322, 2380, 408, 263, 995, 313, 2928, 1237, 470, 14866, 1862, 29897, 13, 4706, 4236, 29918, 29886, 7121, 29901, 5918, 1353, 310, 1970, 375, 1080, 304, 1596, 13, 1678, 9995, 13, 1678, 16897, 353, 29871, 29945, 29871, 396, 925, 11472, 995, 304, 2125, 14679, 411, 472, 3203, 445, 1353, 13, 1678, 9613, 29918, 29886, 7121, 353, 6571, 13, 1678, 2159, 353, 7477, 29889, 12181, 29961, 29900, 29962, 13, 1678, 363, 474, 297, 3464, 29898, 2311, 1125, 13, 4706, 620, 353, 7477, 29961, 29875, 1822, 5085, 441, 580, 13, 4706, 363, 432, 297, 3464, 29898, 2311, 1125, 13, 9651, 926, 353, 620, 29961, 2311, 448, 432, 448, 29871, 29896, 29962, 13, 9651, 396, 694, 14679, 448, 1021, 1948, 322, 1897, 13, 9651, 565, 926, 1275, 474, 29901, 13, 18884, 6773, 13, 9651, 25342, 7477, 29961, 29875, 3816, 1066, 29962, 6736, 16897, 29901, 13, 18884, 851, 353, 285, 29915, 29912, 8977, 29961, 29875, 12258, 1599, 426, 8977, 29961, 1066, 29962, 10162, 13, 18884, 9613, 29918, 29886, 7121, 29961, 710, 29962, 353, 7477, 29961, 29875, 3816, 1066, 29962, 13, 9651, 1683, 29901, 13, 18884, 2867, 13, 13, 1678, 396, 2656, 491, 4236, 1970, 375, 1080, 322, 1596, 937, 4236, 29918, 29886, 7121, 13, 1678, 12705, 29918, 5527, 3880, 29918, 29886, 7121, 353, 12705, 29898, 5527, 3880, 29918, 29886, 7121, 29889, 7076, 3285, 1820, 29922, 2892, 921, 29901, 921, 29961, 29896, 1402, 11837, 29922, 5574, 29897, 13, 1678, 363, 474, 29892, 5101, 29918, 710, 297, 26985, 29898, 24582, 29918, 5527, 3880, 29918, 29886, 7121, 1125, 13, 4706, 565, 474, 6736, 4236, 29918, 29886, 7121, 29901, 13, 9651, 2867, 13, 4706, 12183, 29889, 3888, 29898, 18784, 29918, 710, 29897, 13, 13, 13, 1753, 4436, 29918, 546, 29918, 1990, 29898, 4912, 29892, 9657, 1125, 13, 1678, 9995, 13, 1678, 6991, 3034, 675, 1970, 375, 1080, 639, 1269, 770, 297, 278, 14679, 4636, 29889, 13, 1678, 739, 508, 367, 5407, 1716, 363, 3159, 1237, 322, 14866, 1862, 29889, 13, 1678, 739, 18139, 1269, 14679, 8951, 297, 1716, 18112, 29889, 13, 1678, 826, 3174, 29901, 13, 4706, 7477, 29901, 10811, 3958, 4636, 13, 4706, 9657, 29901, 13343, 411, 1820, 408, 263, 1024, 322, 2380, 408, 263, 995, 313, 2928, 1237, 470, 14866, 1862, 29897, 13, 1678, 9995, 13, 1678, 2159, 353, 7477, 29889, 12181, 29961, 29900, 29962, 13, 1678, 9613, 29918, 546, 29918, 1990, 353, 6571, 13, 1678, 3001, 29918, 12523, 353, 29871, 29900, 13, 1678, 363, 770, 29918, 1949, 297, 3464, 29898, 2311, 1125, 13, 4706, 2533, 353, 29871, 29900, 13, 4706, 363, 474, 297, 3464, 29898, 2311, 1125, 13, 9651, 565, 474, 2804, 770, 29918, 1949, 29901, 13, 18884, 2533, 4619, 7477, 29961, 1990, 29918, 1949, 3816, 29875, 29962, 13, 18884, 2533, 4619, 7477, 29961, 29875, 3816, 1990, 29918, 1949, 29962, 13, 4706, 9613, 29918, 546, 29918, 1990, 29961, 8977, 29961, 1990, 29918, 1949, 5262, 353, 2533, 13, 4706, 3001, 29918, 12523, 4619, 2533, 13, 4706, 396, 12183, 29889, 3888, 29898, 29888, 29915, 29912, 8977, 29961, 1990, 29918, 1949, 12258, 448, 426, 2083, 29913, 1495, 13, 13, 1678, 12183, 29889, 3888, 29898, 29888, 29915, 11536, 4436, 313, 18056, 2957, 491, 29871, 29906, 1125, 426, 7827, 29918, 12523, 29913, 1495, 13, 1678, 12705, 29918, 5527, 3880, 29918, 546, 29918, 1990, 353, 12705, 29898, 5527, 3880, 29918, 546, 29918, 1990, 29889, 7076, 3285, 1820, 29922, 2892, 921, 29901, 921, 29961, 29896, 1402, 11837, 29922, 5574, 29897, 13, 1678, 363, 1970, 29918, 710, 297, 12705, 29918, 5527, 3880, 29918, 546, 29918, 1990, 29901, 13, 4706, 12183, 29889, 3888, 29898, 5527, 29918, 710, 29897, 13, 13, 13, 1753, 1480, 29918, 26737, 1990, 2164, 29918, 339, 6358, 29898, 14029, 29918, 21134, 29892, 7609, 29918, 11965, 29879, 29892, 9365, 29892, 7609, 29918, 8977, 29892, 4046, 29922, 29945, 29900, 1125, 13, 1678, 9995, 13, 1678, 17440, 6455, 310, 11171, 28947, 29889, 13, 1678, 512, 263, 3402, 29901, 13641, 29892, 25383, 322, 301, 24025, 7609, 2983, 29889, 13, 1678, 9995, 13, 1678, 12183, 29889, 3888, 29898, 29888, 29915, 17435, 20929, 1990, 2164, 7609, 9365, 313, 13400, 426, 13400, 1800, 18610, 1495, 13, 1678, 274, 593, 353, 29871, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 14029, 29918, 11965, 29879, 22164, 13, 4706, 565, 7609, 29918, 21134, 29961, 29875, 29962, 2804, 7609, 29918, 11965, 29879, 29961, 29875, 5387, 13, 9651, 2346, 353, 9365, 29961, 29875, 1822, 5451, 28909, 29873, 29861, 29900, 29962, 13, 9651, 12183, 29889, 3888, 29898, 13, 18884, 285, 29915, 29912, 1972, 29913, 313, 11965, 18186, 29901, 426, 14029, 29918, 8977, 29961, 14029, 29918, 11965, 29879, 29961, 29875, 5262, 29913, 448, 301, 24025, 29901, 426, 14029, 29918, 8977, 29961, 14029, 29918, 21134, 29961, 29875, 5262, 1800, 29915, 13, 9651, 1723, 13, 9651, 274, 593, 353, 274, 593, 718, 29871, 29896, 13, 9651, 565, 274, 593, 6736, 4046, 29901, 13, 18884, 2867, 13, 13, 13, 1753, 1480, 29918, 26737, 1990, 2164, 29918, 2536, 1862, 29898, 13, 1678, 7609, 29918, 21134, 29892, 7609, 29918, 11965, 29879, 29892, 21497, 29918, 21134, 29892, 21497, 29918, 11965, 29879, 29892, 1014, 517, 12360, 29918, 13168, 29892, 9365, 29892, 7609, 29918, 8977, 29892, 21497, 29918, 8977, 29892, 4046, 29922, 29945, 29900, 13, 1125, 13, 1678, 9995, 13, 1678, 17440, 6455, 310, 317, 8276, 28947, 29889, 13, 1678, 512, 263, 3402, 29901, 13641, 29892, 25383, 322, 301, 24025, 7609, 2983, 322, 1051, 310, 25383, 322, 301, 24025, 21497, 3694, 29889, 13, 1678, 884, 14677, 8600, 310, 278, 2243, 1862, 472, 278, 1369, 363, 6775, 5183, 29889, 13, 1678, 9995, 13, 1678, 12183, 29889, 3888, 877, 1495, 13, 1678, 12183, 29889, 3888, 29898, 29888, 29915, 17435, 20929, 1990, 2164, 2243, 1862, 9365, 313, 13400, 426, 13400, 1800, 18610, 1495, 13, 1678, 396, 1596, 21497, 8600, 13, 1678, 12183, 29889, 3888, 29898, 29888, 29915, 29903, 8276, 8600, 29901, 1495, 13, 1678, 851, 353, 6629, 13, 1678, 363, 474, 29892, 21497, 297, 26985, 29898, 2536, 327, 29918, 8977, 1125, 13, 4706, 851, 4619, 285, 29915, 29912, 29875, 29913, 448, 426, 2536, 327, 1118, 525, 13, 4706, 565, 474, 1273, 29871, 29945, 1275, 29871, 29946, 470, 474, 1275, 7431, 29898, 2536, 327, 29918, 8977, 29897, 448, 29871, 29896, 29901, 13, 9651, 12183, 29889, 3888, 29898, 710, 29897, 13, 9651, 851, 353, 6629, 13, 13, 1678, 12183, 29889, 3888, 877, 2683, 1495, 13, 1678, 274, 593, 353, 29871, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 14029, 29918, 11965, 29879, 22164, 13, 4706, 3151, 29918, 2536, 327, 29918, 11965, 353, 21497, 29918, 11965, 29879, 29961, 29875, 3816, 1491, 517, 12360, 29918, 13168, 29961, 29875, 5262, 13, 4706, 3151, 29918, 2536, 327, 29918, 1643, 353, 21497, 29918, 21134, 29961, 29875, 3816, 1491, 517, 12360, 29918, 13168, 29961, 29875, 5262, 13, 4706, 565, 451, 7442, 29889, 497, 29898, 2764, 29918, 2536, 327, 29918, 11965, 1275, 3151, 29918, 2536, 327, 29918, 1643, 1125, 13, 9651, 2346, 353, 9365, 29961, 29875, 1822, 5451, 28909, 29873, 29861, 29900, 29962, 13, 9651, 12183, 29889, 3888, 29898, 13, 18884, 285, 29915, 29912, 1972, 29913, 313, 11965, 18186, 29901, 426, 14029, 29918, 8977, 29961, 14029, 29918, 11965, 29879, 29961, 29875, 5262, 29913, 448, 301, 24025, 29901, 426, 14029, 29918, 8977, 29961, 14029, 29918, 21134, 29961, 29875, 5262, 1800, 29915, 13, 9651, 1723, 13, 9651, 12183, 29889, 3888, 29898, 29888, 29915, 29886, 29901, 426, 2764, 29918, 2536, 327, 29918, 11965, 29913, 1495, 13, 9651, 12183, 29889, 3888, 29898, 29888, 29915, 29880, 29901, 426, 2764, 29918, 2536, 327, 29918, 1643, 29913, 1495, 13, 9651, 274, 593, 353, 274, 593, 718, 29871, 29896, 13, 9651, 565, 274, 593, 6736, 4046, 29901, 13, 18884, 2867, 13, 13, 13, 1753, 1423, 29918, 17199, 2454, 29918, 2536, 1862, 29898, 2536, 327, 29918, 11965, 29879, 29918, 1761, 29892, 21497, 29918, 8977, 1125, 13, 1678, 9995, 5399, 1661, 752, 13036, 310, 350, 29899, 322, 306, 29899, 2243, 1862, 363, 20035, 393, 671, 1316, 21497, 8025, 29889, 9995, 13, 1678, 274, 593, 353, 29871, 29900, 13, 13, 1678, 396, 363, 10541, 297, 21497, 29918, 11965, 29879, 29901, 13, 1678, 396, 2243, 1862, 353, 10541, 29889, 5451, 703, 16521, 13, 1678, 10541, 353, 21497, 29918, 11965, 29879, 29918, 1761, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 18616, 663, 22164, 13, 4706, 21497, 29918, 978, 353, 21497, 29918, 8977, 29961, 524, 29898, 18616, 663, 29961, 29875, 2314, 29962, 13, 4706, 565, 21497, 29918, 978, 29889, 27382, 2541, 703, 29902, 29899, 29908, 1125, 13, 9651, 12379, 29918, 2536, 327, 29918, 978, 353, 21497, 29918, 8977, 29961, 524, 29898, 18616, 663, 29961, 29875, 448, 29871, 29896, 2314, 29962, 13, 9651, 565, 21497, 29918, 978, 29961, 29906, 17531, 2804, 12379, 29918, 2536, 327, 29918, 978, 29961, 29906, 29901, 5387, 13, 18884, 1596, 703, 26604, 29901, 376, 718, 21497, 29918, 978, 718, 376, 448, 376, 718, 12379, 29918, 2536, 327, 29918, 978, 29897, 13, 18884, 274, 593, 4619, 29871, 29896, 13, 1678, 1596, 703, 11536, 1108, 2454, 2243, 1862, 29901, 376, 718, 851, 29898, 20047, 876, 13, 2 ]
enderecos/models.py
evaristofm/pontos_turisticos
0
122284
from django.db import models class Endereco(models.Model): linha_1 = models.CharField(max_length=150) linha_2 = models.CharField(max_length=150, blank=True, null=True) cidade = models.CharField(max_length=100) estado = models.CharField(max_length=50) pais = models.CharField(max_length=70) latitude = models.IntegerField(blank=True, null=True) longitude = models.IntegerField(blank=True, null=True) def __str__(self): return self.linha_1
[ 1, 515, 9557, 29889, 2585, 1053, 4733, 13, 13, 1990, 2796, 406, 1111, 29898, 9794, 29889, 3195, 1125, 13, 1678, 6276, 2350, 29918, 29896, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29945, 29900, 29897, 13, 1678, 6276, 2350, 29918, 29906, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29945, 29900, 29892, 9654, 29922, 5574, 29892, 1870, 29922, 5574, 29897, 13, 1678, 17931, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29900, 29897, 13, 1678, 12082, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29945, 29900, 29897, 13, 1678, 282, 1759, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29955, 29900, 29897, 13, 1678, 26271, 353, 4733, 29889, 7798, 3073, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29897, 13, 1678, 28745, 353, 4733, 29889, 7798, 3073, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 1915, 2350, 29918, 29896, 2 ]
vespid/features/interdisciplinarity.py
QS-2/VESPID
0
62007
import logging from vespid import setup_logger logger = setup_logger(__name__) import pandas as pd import numpy as np from tqdm import tqdm def calculate_interdisciplinarity_score( membership_vectors ): ''' Given a set of entities and one vector for each representing the (ordered) strength of membership of that entity across a set of clusters, calculate the level of interdisciplinarity for each entity. NOTE: length of membership_vectors should be the same for all entities for an accurate calculation. Parameters ---------- membership_vectors: numpy array of shape (n_samples, n_clusters) that indicates how strongly each sample/entity belongs to a cluster (e.g. membership_vectors[0] = [0.1, 0.2, 0.3, 0.4] would indicate the strongest association for sample 0 with cluster 3 and the weakest with cluster 0). Returns ------- numpy array of float scores of shape (n_samples,) in the range [0.0, 1.0]. ''' num_clusters = membership_vectors.shape[1] # (N / N-1) * (1 - max(P)) * (1 - stdev(P)) id_scores = (num_clusters / (num_clusters - 1)) * \ (1 - membership_vectors.max(axis=1)) * \ (1 - membership_vectors.std(axis=1)) # In some instances, the score can go higher than 1.0 # Make sure that doesn't happen but we alert on it over_max = id_scores[id_scores > 1.0].sum() if over_max > 0: logger.warn(f"Found {over_max} instances in which score is above 1.0. " "Forcing these to be 1.0...") id_scores[id_scores > 1.0] = 1.0 return id_scores def interdisciplinarity_from_citation_clusters( graph, year, cluster_attribute='clusterID' ): ''' Uses Cypher query with Neo4j instance (enriched with paper cluster labels e.g. from HDBSCAN clustering) to determine how interdisciplinary papers' references and citations are. Uses a similar scoring logic as what is used in vespid.models.clustering with HDBSCAN soft clustering probabilities. Parameters ---------- graph: Neo4jConnectionHandler object. Used for querying the graph for citation information. year: int. Indicates the maximum year of publication of interest. cluster_attribute: str. Indicates the node attribute to use for determining the cluster membership of the node (e.g. 'cluster_id_2019'). Returns ------- pandas DataFrame with columns ['paperID', 'id_score'] of length n_nodes, with id_score being interdisciplinarity scores of shape (n_nodes,) ''' def fill_out_vector(cluster_identifiers, cluster_values, num_total_clusters): ''' Takes a partial membership vector and fills out the missing elements with zeros, placing the nonzero elements properly. Parameters ---------- cluster_identifiers: numpy array of ints. Indicates which clusters map to the values given in ``cluster_values`` (and thus must be the same length as ``cluster_values``) for the node in question. cluster_values: numpy array of float. Indicates the strength of membership the entity has to each cluster for the node in question. num_total_clusters: int. Indicates how many clusters there are in the total solution. Must be greater than or equal to the values provided in ``cluster_identifiers``. Returns ------- numpy array of shape (num_total_clusters,) representing the cluster membership strengths/probabilities of the node. ''' if len(cluster_identifiers) != len(cluster_values): raise ValueError("cluster_identifiers and cluster_values " f"must be of the same length, but got {len(cluster_identifiers)} " f"and {len(cluster_values)}, resp.") if num_total_clusters < np.max(cluster_identifiers): raise ValueError(f"num_total_clusters ({num_total_clusters}) " "must not be less than the maximum " f"cluster_identifiers value ({np.max(cluster_identifiers)})") if len(cluster_identifiers) > len(np.unique(cluster_identifiers)): raise ValueError("cluster_identifiers contains duplicate values") # Build out an all-zeros vector of the proper length cluster_vector = np.zeros(num_total_clusters) # Fill in the right zeros to reflect cluster membership values cluster_vector[cluster_identifiers] = cluster_values return cluster_vector # Query in the same fashion as what is used to generate BW centrality scores # Effectively insures that all papers are either published in `year` or # are referenced by ones published in `year` # also ignores publications that lack a cluster ID or are noise (clusterID = -1) query = f""" MATCH (p:Publication)<-[c:CITED_BY]-(m:Publication) WHERE c.publicationDate.year = {year} AND m.publicationDate.year <= {year} AND p.{cluster_attribute} IS NOT NULL AND toInteger(p.{cluster_attribute}) > -1 AND m.{cluster_attribute} IS NOT NULL AND toInteger(m.{cluster_attribute}) > -1 WITH DISTINCT p AS p, COUNT(c) AS NumTotalCitations MATCH (p)<-[c:CITED_BY]-(m:Publication) WHERE c.publicationDate.year = {year} AND m.publicationDate.year <= {year} AND m.{cluster_attribute} IS NOT NULL AND toInteger(m.{cluster_attribute}) > -1 WITH p, NumTotalCitations, toInteger(m.{cluster_attribute}) AS CitationClusterLabel, COUNT(m) AS NumCitationsInCluster RETURN p.id AS paperID, p.publicationDate.year AS Year, toInteger(p.{cluster_attribute}) AS PrimaryClusterLabel, CitationClusterLabel, toFloat(NumCitationsInCluster) / NumTotalCitations AS FractionalMembership """ df = graph.cypher_query_to_dataframe(query, verbose=False) logger.debug(f"Years covered by network-ID-scoring query are {df['Year'].min()} to {df['Year'].max()}") # Which papers didn't have a membership value for the cluster they're assigned to? # AKA which ones failed to have any citations/references from within their own cluster? df['PrimaryLabelMatchesCitation'] = df['PrimaryClusterLabel'] == df['CitationClusterLabel'] num_zero_primary_membership = \ df['paperID'].nunique() - df.loc[df['PrimaryLabelMatchesCitation'], 'paperID'].nunique() fraction_zero_primary_membership = round(num_zero_primary_membership / df['paperID'].nunique() * 100, 2) if num_zero_primary_membership > 0: logger.warn(f"No citations from host cluster found for " f"{num_zero_primary_membership} ({fraction_zero_primary_membership}%) papers! " "This suggests that the clustering solution may not be very good or " "that the citation network was undersampled") query = f""" MATCH (p:Publication) WHERE p.{cluster_attribute} IS NOT NULL AND p.publicationDate.year = {year} RETURN MAX(toInteger(p.{cluster_attribute})) """ # cluster labels are zero-indexed, so need +1 num_clusters = graph.cypher_query_to_dataframe(query, verbose=False).iloc[0,0] + 1 tqdm.pandas(desc="Building full cluster membership vectors from citation-based membership per paper") # Group membership into list for each paper cluster_vectors = df.groupby('paperID', sort=False).agg(list).progress_apply( lambda row: fill_out_vector( row['CitationClusterLabel'], row['FractionalMembership'], num_clusters ), axis=1 ) id_scores = calculate_interdisciplinarity_score( np.array(cluster_vectors.tolist()) ) output = pd.DataFrame({ 'paperID': df['paperID'].unique(), 'scoreInterDNetwork': id_scores }) #TODO: maybe additional weighting from dendrogram distance/cluster exemplar-exemplar distance? return output
[ 1, 1053, 12183, 13, 3166, 28999, 5935, 1053, 6230, 29918, 21707, 13, 21707, 353, 6230, 29918, 21707, 22168, 978, 1649, 29897, 13, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 13, 1753, 8147, 29918, 1639, 2218, 13326, 18220, 537, 29918, 13628, 29898, 13, 1678, 28512, 29918, 345, 14359, 13, 1125, 13, 1678, 14550, 13, 1678, 11221, 263, 731, 310, 16212, 322, 13, 1678, 697, 4608, 363, 1269, 15783, 278, 313, 21693, 29897, 9324, 13, 1678, 310, 28512, 310, 393, 7855, 4822, 263, 731, 310, 24554, 29892, 13, 1678, 8147, 278, 3233, 310, 1006, 2218, 13326, 18220, 537, 363, 1269, 7855, 29889, 13, 13, 1678, 6058, 29923, 29901, 3309, 310, 28512, 29918, 345, 14359, 881, 367, 278, 1021, 363, 13, 1678, 599, 16212, 363, 385, 16232, 13944, 29889, 13, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 28512, 29918, 345, 14359, 29901, 12655, 1409, 310, 8267, 313, 29876, 29918, 27736, 29892, 302, 29918, 695, 504, 414, 29897, 29871, 13, 4706, 393, 14088, 920, 13818, 1269, 4559, 29914, 10041, 14393, 304, 13, 4706, 263, 9867, 313, 29872, 29889, 29887, 29889, 28512, 29918, 345, 14359, 29961, 29900, 29962, 353, 518, 29900, 29889, 29896, 29892, 29871, 29900, 29889, 29906, 29892, 29871, 29900, 29889, 29941, 29892, 29871, 29900, 29889, 29946, 29962, 29871, 13, 4706, 723, 12266, 278, 4549, 342, 15477, 363, 4559, 29871, 29900, 411, 13, 4706, 9867, 29871, 29941, 322, 278, 8062, 342, 411, 9867, 29871, 29900, 467, 13, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 12655, 1409, 310, 5785, 19435, 310, 8267, 313, 29876, 29918, 27736, 29892, 29897, 297, 278, 3464, 13, 1678, 518, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 1822, 13, 1678, 14550, 13, 1678, 954, 29918, 695, 504, 414, 353, 28512, 29918, 345, 14359, 29889, 12181, 29961, 29896, 29962, 13, 13, 1678, 396, 313, 29940, 847, 405, 29899, 29896, 29897, 334, 313, 29896, 448, 4236, 29898, 29925, 876, 334, 313, 29896, 448, 380, 3359, 29898, 29925, 876, 13, 1678, 1178, 29918, 1557, 2361, 353, 313, 1949, 29918, 695, 504, 414, 847, 313, 1949, 29918, 695, 504, 414, 448, 29871, 29896, 876, 334, 320, 13, 4706, 313, 29896, 448, 28512, 29918, 345, 14359, 29889, 3317, 29898, 8990, 29922, 29896, 876, 334, 320, 13, 9651, 313, 29896, 448, 28512, 29918, 345, 14359, 29889, 4172, 29898, 8990, 29922, 29896, 876, 13, 13, 1678, 396, 512, 777, 8871, 29892, 278, 8158, 508, 748, 6133, 1135, 29871, 29896, 29889, 29900, 13, 1678, 396, 8561, 1854, 393, 1838, 29915, 29873, 3799, 541, 591, 6655, 373, 372, 13, 1678, 975, 29918, 3317, 353, 1178, 29918, 1557, 2361, 29961, 333, 29918, 1557, 2361, 1405, 29871, 29896, 29889, 29900, 1822, 2083, 580, 13, 1678, 565, 975, 29918, 3317, 1405, 29871, 29900, 29901, 13, 4706, 17927, 29889, 25442, 29898, 29888, 29908, 9692, 426, 957, 29918, 3317, 29913, 8871, 297, 607, 8158, 338, 2038, 29871, 29896, 29889, 29900, 29889, 376, 13, 4706, 376, 2831, 3277, 1438, 304, 367, 29871, 29896, 29889, 29900, 856, 1159, 13, 4706, 1178, 29918, 1557, 2361, 29961, 333, 29918, 1557, 2361, 1405, 29871, 29896, 29889, 29900, 29962, 353, 29871, 29896, 29889, 29900, 13, 13, 1678, 736, 1178, 29918, 1557, 2361, 13, 13, 13, 1753, 1006, 2218, 13326, 18220, 537, 29918, 3166, 29918, 29883, 7018, 29918, 695, 504, 414, 29898, 13, 1678, 3983, 29892, 29871, 13, 1678, 1629, 29892, 13, 1678, 9867, 29918, 12715, 2433, 19594, 1367, 29915, 13, 268, 1125, 13, 1678, 14550, 13, 1678, 10783, 267, 8045, 8096, 2346, 411, 2448, 29877, 29946, 29926, 2777, 313, 264, 4018, 287, 411, 5650, 9867, 11073, 13, 1678, 321, 29889, 29887, 29889, 515, 379, 4051, 7187, 2190, 16993, 3241, 29897, 304, 8161, 920, 1006, 2218, 13326, 3821, 13, 1678, 15055, 29915, 9282, 322, 7537, 800, 526, 29889, 10783, 267, 263, 2788, 26654, 13, 1678, 5900, 408, 825, 338, 1304, 297, 28999, 5935, 29889, 9794, 29889, 695, 504, 3241, 411, 13, 1678, 379, 4051, 7187, 2190, 4964, 16993, 3241, 2070, 11614, 29889, 13, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 3983, 29901, 2448, 29877, 29946, 29926, 5350, 4598, 1203, 29889, 501, 8485, 363, 2346, 292, 278, 13, 4706, 3983, 363, 274, 7018, 2472, 29889, 13, 308, 13, 1678, 1629, 29901, 938, 29889, 1894, 293, 1078, 278, 7472, 1629, 310, 17745, 310, 13, 4706, 4066, 29889, 13, 13, 1678, 9867, 29918, 12715, 29901, 851, 29889, 1894, 293, 1078, 278, 2943, 5352, 304, 671, 13, 4706, 363, 3683, 2827, 278, 9867, 28512, 310, 278, 2943, 13, 4706, 313, 29872, 29889, 29887, 29889, 525, 19594, 29918, 333, 29918, 29906, 29900, 29896, 29929, 2824, 13, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 11701, 3630, 4308, 411, 4341, 6024, 19773, 1367, 742, 525, 333, 29918, 13628, 2033, 310, 29871, 13, 1678, 3309, 302, 29918, 18010, 29892, 411, 1178, 29918, 13628, 1641, 1006, 2218, 13326, 18220, 537, 29871, 13, 1678, 19435, 310, 8267, 313, 29876, 29918, 18010, 29892, 29897, 13, 1678, 14550, 13, 13, 1678, 822, 5445, 29918, 449, 29918, 8111, 29898, 19594, 29918, 1693, 14903, 29892, 9867, 29918, 5975, 29892, 954, 29918, 7827, 29918, 695, 504, 414, 1125, 13, 4706, 14550, 13, 4706, 323, 6926, 263, 7687, 28512, 4608, 322, 27793, 714, 278, 4567, 29871, 13, 4706, 3161, 411, 24786, 29892, 24421, 278, 1661, 9171, 3161, 6284, 29889, 13, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 9867, 29918, 1693, 14903, 29901, 12655, 1409, 310, 938, 29879, 29889, 1894, 293, 1078, 607, 24554, 13, 9651, 2910, 304, 278, 1819, 2183, 297, 4954, 19594, 29918, 5975, 16159, 313, 392, 4550, 1818, 13, 9651, 367, 278, 1021, 3309, 408, 4954, 19594, 29918, 5975, 29952, 6348, 363, 278, 2943, 13, 9651, 297, 1139, 29889, 13, 13, 4706, 9867, 29918, 5975, 29901, 12655, 1409, 310, 5785, 29889, 1894, 293, 1078, 278, 9324, 13, 9651, 310, 28512, 278, 7855, 756, 304, 1269, 9867, 363, 278, 2943, 13, 9651, 297, 1139, 29889, 13, 13, 4706, 954, 29918, 7827, 29918, 695, 504, 414, 29901, 938, 29889, 1894, 293, 1078, 920, 1784, 24554, 727, 13, 9651, 526, 297, 278, 3001, 1650, 29889, 19928, 367, 7621, 1135, 470, 29871, 13, 9651, 5186, 304, 278, 1819, 4944, 297, 4954, 19594, 29918, 1693, 14903, 29952, 1412, 13, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 12655, 1409, 310, 8267, 313, 1949, 29918, 7827, 29918, 695, 504, 414, 29892, 29897, 15783, 13, 4706, 278, 9867, 28512, 9324, 29879, 29914, 22795, 11614, 310, 278, 13, 4706, 2943, 29889, 13, 4706, 14550, 13, 308, 13, 4706, 565, 7431, 29898, 19594, 29918, 1693, 14903, 29897, 2804, 7431, 29898, 19594, 29918, 5975, 1125, 13, 9651, 12020, 7865, 2392, 703, 19594, 29918, 1693, 14903, 322, 9867, 29918, 5975, 376, 13, 9651, 285, 29908, 21969, 367, 310, 278, 1021, 3309, 29892, 541, 2355, 426, 2435, 29898, 19594, 29918, 1693, 14903, 2915, 376, 13, 9651, 285, 29908, 392, 426, 2435, 29898, 19594, 29918, 5975, 19230, 4613, 23157, 13, 13, 4706, 565, 954, 29918, 7827, 29918, 695, 504, 414, 529, 7442, 29889, 3317, 29898, 19594, 29918, 1693, 14903, 1125, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29908, 1949, 29918, 7827, 29918, 695, 504, 414, 21313, 1949, 29918, 7827, 29918, 695, 504, 414, 1800, 376, 13, 9651, 376, 21969, 451, 367, 3109, 1135, 278, 7472, 376, 13, 9651, 285, 29908, 19594, 29918, 1693, 14903, 995, 21313, 9302, 29889, 3317, 29898, 19594, 29918, 1693, 14903, 26972, 1159, 13, 13, 4706, 565, 7431, 29898, 19594, 29918, 1693, 14903, 29897, 1405, 7431, 29898, 9302, 29889, 13092, 29898, 19594, 29918, 1693, 14903, 22164, 13, 9651, 12020, 7865, 2392, 703, 19594, 29918, 1693, 14903, 3743, 7929, 1819, 1159, 13, 308, 13, 4706, 396, 8878, 714, 385, 599, 29899, 3298, 359, 4608, 310, 278, 1571, 3309, 13, 4706, 9867, 29918, 8111, 353, 7442, 29889, 3298, 359, 29898, 1949, 29918, 7827, 29918, 695, 504, 414, 29897, 13, 308, 13, 4706, 396, 383, 453, 297, 278, 1492, 24786, 304, 9432, 9867, 28512, 1819, 13, 4706, 9867, 29918, 8111, 29961, 19594, 29918, 1693, 14903, 29962, 353, 9867, 29918, 5975, 13, 308, 13, 4706, 736, 9867, 29918, 8111, 13, 268, 13, 1678, 396, 13641, 297, 278, 1021, 13460, 408, 825, 338, 1304, 304, 5706, 350, 29956, 6555, 537, 19435, 13, 1678, 396, 26475, 3598, 1663, 1973, 393, 599, 15055, 526, 2845, 6369, 297, 421, 6360, 29952, 470, 29871, 13, 1678, 396, 526, 16180, 491, 6743, 6369, 297, 421, 6360, 29952, 13, 1678, 396, 884, 5330, 2361, 25964, 393, 10225, 263, 9867, 3553, 470, 526, 11462, 313, 19594, 1367, 353, 448, 29896, 29897, 13, 1678, 2346, 353, 285, 15945, 29908, 13, 1678, 341, 14789, 313, 29886, 29901, 19858, 362, 29897, 16406, 29961, 29883, 29901, 29907, 1806, 3352, 29918, 22716, 29962, 17722, 29885, 29901, 19858, 362, 29897, 29871, 13, 1678, 5754, 274, 29889, 3597, 362, 2539, 29889, 6360, 353, 426, 6360, 29913, 29871, 13, 1678, 5300, 286, 29889, 3597, 362, 2539, 29889, 6360, 5277, 426, 6360, 29913, 13, 1678, 5300, 282, 29889, 29912, 19594, 29918, 12715, 29913, 8519, 6058, 4265, 29871, 13, 1678, 5300, 304, 7798, 29898, 29886, 29889, 29912, 19594, 29918, 12715, 1800, 1405, 448, 29896, 13, 1678, 5300, 286, 29889, 29912, 19594, 29918, 12715, 29913, 8519, 6058, 4265, 13, 1678, 5300, 304, 7798, 29898, 29885, 29889, 29912, 19594, 29918, 12715, 1800, 1405, 448, 29896, 13, 1678, 22659, 360, 9047, 28852, 282, 3339, 282, 29892, 21122, 29898, 29883, 29897, 3339, 11848, 11536, 29907, 24182, 13, 268, 13, 1678, 341, 14789, 313, 29886, 29897, 16406, 29961, 29883, 29901, 29907, 1806, 3352, 29918, 22716, 29962, 17722, 29885, 29901, 19858, 362, 29897, 13, 1678, 5754, 274, 29889, 3597, 362, 2539, 29889, 6360, 353, 426, 6360, 29913, 29871, 13, 1678, 5300, 286, 29889, 3597, 362, 2539, 29889, 6360, 5277, 426, 6360, 29913, 13, 1678, 5300, 286, 29889, 29912, 19594, 29918, 12715, 29913, 8519, 6058, 4265, 13, 1678, 5300, 304, 7798, 29898, 29885, 29889, 29912, 19594, 29918, 12715, 1800, 1405, 448, 29896, 13, 1678, 22659, 282, 29892, 29871, 13, 1678, 11848, 11536, 29907, 24182, 29892, 29871, 13, 1678, 304, 7798, 29898, 29885, 29889, 29912, 19594, 29918, 12715, 1800, 3339, 315, 7018, 6821, 5402, 4775, 29892, 29871, 13, 1678, 21122, 29898, 29885, 29897, 3339, 11848, 29907, 24182, 797, 6821, 5402, 13, 268, 13, 1678, 28081, 24015, 282, 29889, 333, 3339, 5650, 1367, 29892, 29871, 13, 1678, 282, 29889, 3597, 362, 2539, 29889, 6360, 3339, 8905, 29892, 29871, 13, 1678, 304, 7798, 29898, 29886, 29889, 29912, 19594, 29918, 12715, 1800, 3339, 28267, 6821, 5402, 4775, 29892, 29871, 13, 1678, 315, 7018, 6821, 5402, 4775, 29892, 29871, 13, 1678, 304, 11031, 29898, 8009, 29907, 24182, 797, 6821, 5402, 29897, 847, 11848, 11536, 29907, 24182, 3339, 7347, 428, 284, 29924, 1590, 10475, 13, 1678, 9995, 13, 268, 13, 1678, 4489, 353, 3983, 29889, 1270, 8096, 29918, 1972, 29918, 517, 29918, 1272, 2557, 29898, 1972, 29892, 26952, 29922, 8824, 29897, 13, 1678, 17927, 29889, 8382, 29898, 29888, 29908, 12883, 29879, 10664, 491, 3564, 29899, 1367, 29899, 1557, 8253, 2346, 526, 426, 2176, 1839, 12883, 13359, 1195, 28296, 304, 426, 2176, 1839, 12883, 13359, 3317, 580, 27195, 13, 268, 13, 1678, 396, 8449, 15055, 3282, 29915, 29873, 505, 263, 28512, 995, 363, 278, 9867, 896, 29915, 276, 9859, 304, 29973, 13, 1678, 396, 319, 29968, 29909, 607, 6743, 5229, 304, 505, 738, 7537, 800, 29914, 276, 10662, 515, 2629, 1009, 1914, 9867, 29973, 13, 1678, 4489, 1839, 26666, 4775, 9652, 267, 29907, 7018, 2033, 353, 4489, 1839, 26666, 6821, 5402, 4775, 2033, 1275, 4489, 1839, 29907, 7018, 6821, 5402, 4775, 2033, 13, 1678, 954, 29918, 9171, 29918, 16072, 29918, 29885, 1590, 10475, 353, 320, 13, 4706, 4489, 1839, 19773, 1367, 13359, 29876, 13092, 580, 448, 4489, 29889, 2029, 29961, 2176, 1839, 26666, 4775, 9652, 267, 29907, 7018, 7464, 525, 19773, 1367, 13359, 29876, 13092, 580, 13, 1678, 15958, 29918, 9171, 29918, 16072, 29918, 29885, 1590, 10475, 353, 4513, 29898, 1949, 29918, 9171, 29918, 16072, 29918, 29885, 1590, 10475, 847, 4489, 1839, 19773, 1367, 13359, 29876, 13092, 580, 334, 29871, 29896, 29900, 29900, 29892, 29871, 29906, 29897, 13, 1678, 565, 954, 29918, 9171, 29918, 16072, 29918, 29885, 1590, 10475, 1405, 29871, 29900, 29901, 13, 4706, 17927, 29889, 25442, 29898, 29888, 29908, 3782, 7537, 800, 515, 3495, 9867, 1476, 363, 376, 13, 462, 1678, 285, 29908, 29912, 1949, 29918, 9171, 29918, 16072, 29918, 29885, 1590, 10475, 29913, 21313, 29888, 13857, 29918, 9171, 29918, 16072, 29918, 29885, 1590, 10475, 10560, 29897, 15055, 29991, 376, 13, 462, 1678, 376, 4013, 14661, 393, 278, 16993, 3241, 1650, 1122, 451, 367, 1407, 1781, 470, 376, 13, 462, 1678, 376, 5747, 278, 274, 7018, 3564, 471, 23400, 981, 29881, 1159, 13, 268, 13, 1678, 2346, 353, 285, 15945, 29908, 13, 1678, 341, 14789, 313, 29886, 29901, 19858, 362, 29897, 13, 1678, 5754, 282, 29889, 29912, 19594, 29918, 12715, 29913, 8519, 6058, 4265, 13, 1678, 5300, 282, 29889, 3597, 362, 2539, 29889, 6360, 353, 426, 6360, 29913, 13, 1678, 28081, 24015, 18134, 29898, 517, 7798, 29898, 29886, 29889, 29912, 19594, 29918, 12715, 20073, 13, 1678, 9995, 13, 1678, 396, 9867, 11073, 526, 5225, 29899, 2248, 287, 29892, 577, 817, 718, 29896, 13, 1678, 954, 29918, 695, 504, 414, 353, 3983, 29889, 1270, 8096, 29918, 1972, 29918, 517, 29918, 1272, 2557, 29898, 1972, 29892, 26952, 29922, 8824, 467, 309, 542, 29961, 29900, 29892, 29900, 29962, 718, 29871, 29896, 13, 13, 1678, 260, 29939, 18933, 29889, 15112, 29898, 14273, 543, 8893, 292, 2989, 9867, 28512, 12047, 515, 274, 7018, 29899, 6707, 28512, 639, 5650, 1159, 13, 1678, 396, 6431, 28512, 964, 1051, 363, 1269, 5650, 13, 1678, 9867, 29918, 345, 14359, 353, 4489, 29889, 27789, 877, 19773, 1367, 742, 2656, 29922, 8824, 467, 16170, 29898, 1761, 467, 18035, 29918, 7302, 29898, 13, 4706, 14013, 1948, 29901, 5445, 29918, 449, 29918, 8111, 29898, 13, 9651, 1948, 1839, 29907, 7018, 6821, 5402, 4775, 7464, 13, 9651, 1948, 1839, 29943, 13857, 284, 29924, 1590, 10475, 7464, 13, 9651, 954, 29918, 695, 504, 414, 13, 4706, 10353, 29871, 13, 4706, 9685, 29922, 29896, 13, 1678, 1723, 13, 13, 1678, 1178, 29918, 1557, 2361, 353, 8147, 29918, 1639, 2218, 13326, 18220, 537, 29918, 13628, 29898, 13, 4706, 7442, 29889, 2378, 29898, 19594, 29918, 345, 14359, 29889, 25027, 391, 3101, 13, 1678, 1723, 13, 13, 1678, 1962, 353, 10518, 29889, 17271, 3319, 13, 4706, 525, 19773, 1367, 2396, 4489, 1839, 19773, 1367, 13359, 13092, 3285, 13, 4706, 525, 13628, 4074, 29928, 13724, 2396, 1178, 29918, 1557, 2361, 13, 1678, 5615, 13, 13, 1678, 396, 4986, 3970, 29901, 5505, 5684, 7688, 292, 515, 270, 355, 307, 1393, 5418, 29914, 19594, 29455, 279, 29899, 735, 16305, 279, 5418, 29973, 13, 13, 1678, 736, 1962, 2 ]
nablapps/core/models.py
pettaroni/nablaweb
0
105430
<reponame>pettaroni/nablaweb<filename>nablapps/core/models.py """ Abstract models to be included in other apps """ # Ignore pylint problems with Meta-classes # pylint: disable=missing-docstring,too-few-public-methods from datetime import datetime from django.db import models from django.conf import settings from django.contrib.sites.models import Site from image_cropping.fields import ImageRatioField class BaseImageModel(models.Model): """ Abstract model for representing a single image. """ file = models.ImageField( max_length=100, verbose_name="Bildefil", upload_to="uploads/content" ) def __str__(self): return f"({self.id}) {self.file.url if self.file else ''}" def image_thumb(self): """Return a string containing html for showing a thumbnail of the image""" if not self.file: return 'No image' return f'<img src="{self.file.url}" style="max-width:100px;max-height:100px;"/>' image_thumb.allow_tags = True image_thumb.short_description = "Thumbnail" class Meta: abstract = True class WithPicture(models.Model): """ Abstract model to be mixed in to models requiring a single image. """ picture = models.ImageField( upload_to="uploads/news_pictures", null=True, blank=True, verbose_name="Bilde", help_text=("Bilder som er større enn 770x300 px ser best ut. " "Du kan beskjære bildet etter opplasting."), ) cropping = ImageRatioField( 'picture', '770x300', allow_fullsize=False, verbose_name="Beskjæring" ) class Meta: abstract = True def get_picture_url(self): """Return the absolute url of the main picture""" domain = Site.objects.get_current().domain media_url = settings.MEDIA_URL filename = self.picture.name return f'http://{domain}{media_url}{filename}' class TimeStamped(models.Model): """ Abstract model which adds datetime fields indicating when the model was created and/or changed and fields indicating who did it. The user fields has to be updated manually or through the admin interface using ChangedByMixin. """ created_date = models.DateTimeField( verbose_name="Publiseringsdato", auto_now_add=True, null=True ) created_by = models.ForeignKey( settings.AUTH_USER_MODEL, verbose_name="Opprettet av", related_name="%(class)s_created", editable=False, blank=True, null=True, on_delete=models.CASCADE, ) last_changed_date = models.DateTimeField( verbose_name="Redigeringsdato", auto_now=True, null=True ) last_changed_by = models.ForeignKey( settings.AUTH_USER_MODEL, verbose_name="Endret av", related_name="%(class)s_edited", editable=False, blank=True, null=True, on_delete=models.CASCADE, ) class Meta: abstract = True def has_been_edited(self): """Return whether the object has been changed since creation""" return abs((self.last_changed_date - self.created_date).seconds) > 1
[ 1, 529, 276, 1112, 420, 29958, 29886, 1803, 5022, 29875, 29914, 8511, 2676, 29966, 9507, 29958, 8511, 407, 29879, 29914, 3221, 29914, 9794, 29889, 2272, 13, 15945, 29908, 13, 9118, 4733, 304, 367, 5134, 297, 916, 11446, 13, 15945, 29908, 13, 29937, 18076, 487, 282, 2904, 524, 4828, 411, 20553, 29899, 13203, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 27259, 29899, 1514, 1807, 29892, 517, 29877, 29899, 29888, 809, 29899, 3597, 29899, 23515, 13, 3166, 12865, 1053, 12865, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 21570, 29889, 16315, 29889, 9794, 1053, 10781, 13, 3166, 1967, 29918, 24077, 3262, 29889, 9621, 1053, 7084, 29934, 20819, 3073, 13, 13, 13, 1990, 7399, 2940, 3195, 29898, 9794, 29889, 3195, 1125, 13, 1678, 9995, 13, 1678, 25513, 1904, 363, 15783, 263, 2323, 1967, 29889, 13, 1678, 9995, 13, 13, 1678, 934, 353, 4733, 29889, 2940, 3073, 29898, 13, 4706, 4236, 29918, 2848, 29922, 29896, 29900, 29900, 29892, 13, 4706, 26952, 29918, 978, 543, 29933, 309, 1753, 309, 613, 13, 4706, 6441, 29918, 517, 543, 9009, 29879, 29914, 3051, 29908, 13, 1678, 1723, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 3319, 1311, 29889, 333, 1800, 426, 1311, 29889, 1445, 29889, 2271, 565, 1583, 29889, 1445, 1683, 6629, 5038, 13, 13, 1678, 822, 1967, 29918, 386, 3774, 29898, 1311, 1125, 13, 4706, 9995, 11609, 263, 1347, 6943, 3472, 363, 6445, 263, 266, 21145, 310, 278, 1967, 15945, 29908, 13, 4706, 565, 451, 1583, 29889, 1445, 29901, 13, 9651, 736, 525, 3782, 1967, 29915, 13, 4706, 736, 285, 29915, 29966, 2492, 4765, 10724, 1311, 29889, 1445, 29889, 2271, 5038, 3114, 543, 3317, 29899, 2103, 29901, 29896, 29900, 29900, 1756, 29936, 3317, 29899, 3545, 29901, 29896, 29900, 29900, 1756, 29936, 4681, 29915, 13, 13, 1678, 1967, 29918, 386, 3774, 29889, 9536, 29918, 11338, 353, 5852, 13, 1678, 1967, 29918, 386, 3774, 29889, 12759, 29918, 8216, 353, 376, 1349, 21145, 29908, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 9846, 353, 5852, 13, 13, 13, 1990, 2973, 28210, 29898, 9794, 29889, 3195, 1125, 13, 1678, 9995, 13, 1678, 25513, 1904, 304, 367, 12849, 297, 304, 4733, 26795, 263, 2323, 1967, 29889, 13, 1678, 9995, 13, 1678, 7623, 353, 4733, 29889, 2940, 3073, 29898, 13, 4706, 6441, 29918, 517, 543, 9009, 29879, 29914, 15753, 29918, 29886, 10373, 613, 13, 4706, 1870, 29922, 5574, 29892, 13, 4706, 9654, 29922, 5574, 29892, 13, 4706, 26952, 29918, 978, 543, 29933, 7154, 613, 13, 4706, 1371, 29918, 726, 29922, 703, 29933, 2700, 1047, 604, 380, 10181, 276, 427, 29876, 29871, 29955, 29955, 29900, 29916, 29941, 29900, 29900, 282, 29916, 724, 1900, 3477, 29889, 376, 13, 462, 259, 376, 29928, 29884, 6841, 3008, 29895, 29926, 30078, 276, 14071, 300, 634, 357, 4575, 4230, 292, 1213, 511, 13, 1678, 1723, 13, 13, 1678, 8182, 3262, 353, 7084, 29934, 20819, 3073, 29898, 13, 4706, 525, 12095, 742, 13, 4706, 525, 29955, 29955, 29900, 29916, 29941, 29900, 29900, 742, 13, 4706, 2758, 29918, 8159, 2311, 29922, 8824, 29892, 13, 4706, 26952, 29918, 978, 543, 29933, 8488, 29926, 30078, 5393, 29908, 13, 1678, 1723, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 9846, 353, 5852, 13, 13, 1678, 822, 679, 29918, 12095, 29918, 2271, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 8380, 3142, 310, 278, 1667, 7623, 15945, 29908, 13, 4706, 5354, 353, 10781, 29889, 12650, 29889, 657, 29918, 3784, 2141, 7247, 13, 4706, 5745, 29918, 2271, 353, 6055, 29889, 2303, 4571, 29909, 29918, 4219, 13, 4706, 10422, 353, 1583, 29889, 12095, 29889, 978, 13, 4706, 736, 285, 29915, 1124, 597, 29912, 7247, 1157, 9799, 29918, 2271, 1157, 9507, 10162, 13, 13, 13, 1990, 5974, 855, 1160, 287, 29898, 9794, 29889, 3195, 1125, 13, 1678, 9995, 13, 1678, 25513, 1904, 607, 12778, 12865, 4235, 23941, 13, 1678, 746, 278, 1904, 471, 2825, 322, 29914, 272, 3939, 13, 1678, 322, 4235, 23941, 1058, 1258, 372, 29889, 13, 13, 1678, 450, 1404, 4235, 756, 304, 367, 4784, 7522, 470, 1549, 13, 1678, 278, 4113, 5067, 773, 678, 4618, 2059, 29924, 861, 262, 29889, 13, 1678, 9995, 13, 13, 1678, 2825, 29918, 1256, 353, 4733, 29889, 11384, 3073, 29898, 13, 4706, 26952, 29918, 978, 543, 21076, 29880, 7608, 886, 29881, 1219, 613, 13, 4706, 4469, 29918, 3707, 29918, 1202, 29922, 5574, 29892, 13, 4706, 1870, 29922, 5574, 13, 1678, 1723, 13, 13, 1678, 2825, 29918, 1609, 353, 4733, 29889, 27755, 2558, 29898, 13, 4706, 6055, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 29892, 13, 4706, 26952, 29918, 978, 543, 29949, 407, 13158, 300, 1029, 613, 13, 4706, 4475, 29918, 978, 543, 29995, 29898, 1990, 29897, 29879, 29918, 11600, 613, 13, 4706, 3863, 519, 29922, 8824, 29892, 13, 4706, 9654, 29922, 5574, 29892, 13, 4706, 1870, 29922, 5574, 29892, 13, 4706, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 13, 1678, 1723, 13, 13, 1678, 1833, 29918, 15033, 29918, 1256, 353, 4733, 29889, 11384, 3073, 29898, 13, 4706, 26952, 29918, 978, 543, 9039, 4087, 886, 29881, 1219, 613, 13, 4706, 4469, 29918, 3707, 29922, 5574, 29892, 13, 4706, 1870, 29922, 5574, 13, 1678, 1723, 13, 13, 1678, 1833, 29918, 15033, 29918, 1609, 353, 4733, 29889, 27755, 2558, 29898, 13, 4706, 6055, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 29892, 13, 4706, 26952, 29918, 978, 543, 5044, 2267, 1029, 613, 13, 4706, 4475, 29918, 978, 543, 29995, 29898, 1990, 29897, 29879, 29918, 287, 1573, 613, 13, 4706, 3863, 519, 29922, 8824, 29892, 13, 4706, 9654, 29922, 5574, 29892, 13, 4706, 1870, 29922, 5574, 29892, 13, 4706, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 13, 1678, 1723, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 9846, 353, 5852, 13, 13, 1678, 822, 756, 29918, 915, 264, 29918, 287, 1573, 29898, 1311, 1125, 13, 4706, 9995, 11609, 3692, 278, 1203, 756, 1063, 3939, 1951, 11265, 15945, 29908, 13, 4706, 736, 6425, 3552, 1311, 29889, 4230, 29918, 15033, 29918, 1256, 448, 1583, 29889, 11600, 29918, 1256, 467, 23128, 29897, 1405, 29871, 29896, 13, 2 ]
machine_learning_examples/linear_regression_class/overfitting.py
austinburks/nlp-udemy
0
161678
# notes for this course can be found at: # https://deeplearningcourses.com/c/data-science-linear-regression-in-python # https://www.udemy.com/data-science-linear-regression-in-python import numpy as np import matplotlib.pyplot as plt def make_poly(X, deg): n = len(X) data = [np.ones(n)] for d in xrange(deg): data.append(X**(d+1)) return np.vstack(data).T def fit(X, Y): return np.linalg.solve(X.T.dot(X), X.T.dot(Y)) def fit_and_display(X, Y, sample, deg): N = len(X) train_idx = np.random.choice(N, sample) Xtrain = X[train_idx] Ytrain = Y[train_idx] plt.scatter(Xtrain, Ytrain) plt.show() # fit polynomial Xtrain_poly = make_poly(Xtrain, deg) w = fit(Xtrain_poly, Ytrain) # display the polynomial X_poly = make_poly(X, deg) Y_hat = X_poly.dot(w) plt.plot(X, Y) plt.plot(X, Y_hat) plt.scatter(Xtrain, Ytrain) plt.title("deg = %d" % deg) plt.show() def get_mse(Y, Yhat): d = Y - Yhat return d.dot(d) / len(d) def plot_train_vs_test_curves(X, Y, sample=20, max_deg=20): N = len(X) train_idx = np.random.choice(N, sample) Xtrain = X[train_idx] Ytrain = Y[train_idx] test_idx = [idx for idx in xrange(N) if idx not in train_idx] # test_idx = np.random.choice(N, sample) Xtest = X[test_idx] Ytest = Y[test_idx] mse_trains = [] mse_tests = [] for deg in xrange(max_deg+1): Xtrain_poly = make_poly(Xtrain, deg) w = fit(Xtrain_poly, Ytrain) Yhat_train = Xtrain_poly.dot(w) mse_train = get_mse(Ytrain, Yhat_train) Xtest_poly = make_poly(Xtest, deg) Yhat_test = Xtest_poly.dot(w) mse_test = get_mse(Ytest, Yhat_test) mse_trains.append(mse_train) mse_tests.append(mse_test) plt.plot(mse_trains, label="train mse") plt.plot(mse_tests, label="test mse") plt.legend() plt.show() plt.plot(mse_trains, label="train mse") plt.legend() plt.show() if __name__ == "__main__": # make up some data and plot it N = 100 X = np.linspace(0, 6*np.pi, N) Y = np.sin(X) plt.plot(X, Y) plt.show() for deg in (5, 6, 7, 8, 9): fit_and_display(X, Y, 10, deg) plot_train_vs_test_curves(X, Y)
[ 1, 396, 11486, 363, 445, 3236, 508, 367, 1476, 472, 29901, 13, 29937, 2045, 597, 311, 29872, 552, 5699, 29883, 29781, 29889, 510, 29914, 29883, 29914, 1272, 29899, 29879, 15277, 29899, 10660, 29899, 276, 11476, 29899, 262, 29899, 4691, 13, 29937, 2045, 597, 1636, 29889, 1151, 1357, 29889, 510, 29914, 1272, 29899, 29879, 15277, 29899, 10660, 29899, 276, 11476, 29899, 262, 29899, 4691, 13, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 13, 1753, 1207, 29918, 22678, 29898, 29990, 29892, 3587, 1125, 13, 1678, 302, 353, 7431, 29898, 29990, 29897, 13, 1678, 848, 353, 518, 9302, 29889, 2873, 29898, 29876, 4638, 13, 1678, 363, 270, 297, 921, 3881, 29898, 12163, 1125, 13, 4706, 848, 29889, 4397, 29898, 29990, 1068, 29898, 29881, 29974, 29896, 876, 13, 1678, 736, 7442, 29889, 29894, 1429, 29898, 1272, 467, 29911, 13, 13, 13, 1753, 6216, 29898, 29990, 29892, 612, 1125, 13, 1678, 736, 7442, 29889, 29880, 979, 29887, 29889, 2929, 345, 29898, 29990, 29889, 29911, 29889, 6333, 29898, 29990, 511, 1060, 29889, 29911, 29889, 6333, 29898, 29979, 876, 13, 13, 13, 1753, 6216, 29918, 392, 29918, 4990, 29898, 29990, 29892, 612, 29892, 4559, 29892, 3587, 1125, 13, 1678, 405, 353, 7431, 29898, 29990, 29897, 13, 1678, 7945, 29918, 13140, 353, 7442, 29889, 8172, 29889, 16957, 29898, 29940, 29892, 4559, 29897, 13, 1678, 1060, 14968, 353, 1060, 29961, 14968, 29918, 13140, 29962, 13, 1678, 612, 14968, 353, 612, 29961, 14968, 29918, 13140, 29962, 13, 13, 1678, 14770, 29889, 1557, 2620, 29898, 29990, 14968, 29892, 612, 14968, 29897, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 1678, 396, 6216, 10159, 13, 1678, 1060, 14968, 29918, 22678, 353, 1207, 29918, 22678, 29898, 29990, 14968, 29892, 3587, 29897, 13, 1678, 281, 353, 6216, 29898, 29990, 14968, 29918, 22678, 29892, 612, 14968, 29897, 13, 13, 1678, 396, 2479, 278, 10159, 13, 1678, 1060, 29918, 22678, 353, 1207, 29918, 22678, 29898, 29990, 29892, 3587, 29897, 13, 1678, 612, 29918, 2455, 353, 1060, 29918, 22678, 29889, 6333, 29898, 29893, 29897, 13, 1678, 14770, 29889, 5317, 29898, 29990, 29892, 612, 29897, 13, 1678, 14770, 29889, 5317, 29898, 29990, 29892, 612, 29918, 2455, 29897, 13, 1678, 14770, 29889, 1557, 2620, 29898, 29990, 14968, 29892, 612, 14968, 29897, 13, 1678, 14770, 29889, 3257, 703, 12163, 353, 1273, 29881, 29908, 1273, 3587, 29897, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 1753, 679, 29918, 29885, 344, 29898, 29979, 29892, 612, 2455, 1125, 13, 1678, 270, 353, 612, 448, 612, 2455, 13, 1678, 736, 270, 29889, 6333, 29898, 29881, 29897, 847, 7431, 29898, 29881, 29897, 13, 13, 13, 1753, 6492, 29918, 14968, 29918, 4270, 29918, 1688, 29918, 2764, 1960, 29898, 29990, 29892, 612, 29892, 4559, 29922, 29906, 29900, 29892, 4236, 29918, 12163, 29922, 29906, 29900, 1125, 13, 1678, 405, 353, 7431, 29898, 29990, 29897, 13, 1678, 7945, 29918, 13140, 353, 7442, 29889, 8172, 29889, 16957, 29898, 29940, 29892, 4559, 29897, 13, 1678, 1060, 14968, 353, 1060, 29961, 14968, 29918, 13140, 29962, 13, 1678, 612, 14968, 353, 612, 29961, 14968, 29918, 13140, 29962, 13, 13, 1678, 1243, 29918, 13140, 353, 518, 13140, 363, 22645, 297, 921, 3881, 29898, 29940, 29897, 565, 22645, 451, 297, 7945, 29918, 13140, 29962, 13, 1678, 396, 1243, 29918, 13140, 353, 7442, 29889, 8172, 29889, 16957, 29898, 29940, 29892, 4559, 29897, 13, 1678, 1060, 1688, 353, 1060, 29961, 1688, 29918, 13140, 29962, 13, 1678, 612, 1688, 353, 612, 29961, 1688, 29918, 13140, 29962, 13, 13, 1678, 286, 344, 29918, 3018, 1144, 353, 5159, 13, 1678, 286, 344, 29918, 21150, 353, 5159, 13, 1678, 363, 3587, 297, 921, 3881, 29898, 3317, 29918, 12163, 29974, 29896, 1125, 13, 4706, 1060, 14968, 29918, 22678, 353, 1207, 29918, 22678, 29898, 29990, 14968, 29892, 3587, 29897, 13, 4706, 281, 353, 6216, 29898, 29990, 14968, 29918, 22678, 29892, 612, 14968, 29897, 13, 4706, 612, 2455, 29918, 14968, 353, 1060, 14968, 29918, 22678, 29889, 6333, 29898, 29893, 29897, 13, 4706, 286, 344, 29918, 14968, 353, 679, 29918, 29885, 344, 29898, 29979, 14968, 29892, 612, 2455, 29918, 14968, 29897, 13, 13, 4706, 1060, 1688, 29918, 22678, 353, 1207, 29918, 22678, 29898, 29990, 1688, 29892, 3587, 29897, 13, 4706, 612, 2455, 29918, 1688, 353, 1060, 1688, 29918, 22678, 29889, 6333, 29898, 29893, 29897, 13, 4706, 286, 344, 29918, 1688, 353, 679, 29918, 29885, 344, 29898, 29979, 1688, 29892, 612, 2455, 29918, 1688, 29897, 13, 13, 4706, 286, 344, 29918, 3018, 1144, 29889, 4397, 29898, 29885, 344, 29918, 14968, 29897, 13, 4706, 286, 344, 29918, 21150, 29889, 4397, 29898, 29885, 344, 29918, 1688, 29897, 13, 13, 1678, 14770, 29889, 5317, 29898, 29885, 344, 29918, 3018, 1144, 29892, 3858, 543, 14968, 286, 344, 1159, 13, 1678, 14770, 29889, 5317, 29898, 29885, 344, 29918, 21150, 29892, 3858, 543, 1688, 286, 344, 1159, 13, 1678, 14770, 29889, 26172, 580, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 1678, 14770, 29889, 5317, 29898, 29885, 344, 29918, 3018, 1144, 29892, 3858, 543, 14968, 286, 344, 1159, 13, 1678, 14770, 29889, 26172, 580, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 1207, 701, 777, 848, 322, 6492, 372, 13, 1678, 405, 353, 29871, 29896, 29900, 29900, 13, 1678, 1060, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29892, 29871, 29953, 29930, 9302, 29889, 1631, 29892, 405, 29897, 13, 1678, 612, 353, 7442, 29889, 5223, 29898, 29990, 29897, 13, 13, 1678, 14770, 29889, 5317, 29898, 29990, 29892, 612, 29897, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 1678, 363, 3587, 297, 313, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29892, 29871, 29929, 1125, 13, 4706, 6216, 29918, 392, 29918, 4990, 29898, 29990, 29892, 612, 29892, 29871, 29896, 29900, 29892, 3587, 29897, 13, 1678, 6492, 29918, 14968, 29918, 4270, 29918, 1688, 29918, 2764, 1960, 29898, 29990, 29892, 612, 29897, 13, 2 ]
tests/test_rainbowplantlife.py
gloriousDan/recipe-scrapers
0
95452
from recipe_scrapers.rainbowplantlife import RainbowPlantLife from tests import ScraperTest class TestRainbowPlantLifeScraper(ScraperTest): scraper_class = RainbowPlantLife def test_host(self): self.assertEqual("rainbowplantlife.com", self.harvester_class.host()) def test_author(self): self.assertEqual("<NAME>", self.harvester_class.author()) def test_title(self): self.assertEqual( "Vegan Brown Butter Peach Cobbler", self.harvester_class.title() ) def test_total_time(self): self.assertEqual(60, self.harvester_class.total_time()) def test_yields(self): self.assertEqual("10 servings", self.harvester_class.yields()) def test_image(self): self.assertEqual( "https://rainbowplantlife.com/wp-content/uploads/2020/11/peachblueberrrycobbler286of1029.jpg", self.harvester_class.image(), ) def test_ingredients(self): self.assertEqual( [ "1 pound (454g) ripe but relatively firm peaches", "1/2 cup (75-85g) fresh blueberries", "1/3 cup (45g) coconut sugar (or brown sugar)", "1 teaspoon ground cinnamon", "1/4 teaspoon nutmeg ((I recommend freshly grated nutmeg))", "Scant 1/2 teaspoon ground ginger", "2 pinches of ground cardamom ((optional))", "10 tablespoons (140g) Country Crock Plant Butter", "1 1/2 cups (180g) all-purpose flour", "Scant 2/3 cup ((60g) old-fashioned rolled oats)", "1 cup (200g) organic cane sugar", "1/4 - 1/2 teaspoon kosher salt", "2 teaspoons baking powder", "1 1/3 cups (320 mL) full-fat oat milk (I used Oatly)", "1 1/2 teaspoons pure vanilla extract", "1/4 - 1/2 teaspoon pure almond extract ((optional))", "For serving: vegan vanilla ice cream ((optional))", ], self.harvester_class.ingredients(), ) def test_instructions(self): self.assertEqual( "\n".join( [ "Arrange a rack in the middle of your oven and preheat it to 375°F/190°C.", "Cut the peaches in half and remove the pits, then cut the peaches into 1/4-1/2 inch thick slices (3/4 cm - 1 1/4 cm). Transfer the peaches to a medium or large bowl. Add the blueberries, coconut sugar, cinnamon, nutmeg, ginger, and cardamom (if using), and toss gently to combine. Set aside for 30 minutes to allow the fruit to absorb the flavors.", "Heat a skillet over medium heat, then add the Plant Butter. Once the butter is melted, stir it often and swirl the pan to ensure even browning and cooking, until it foams and then eventually browns. You might want to stand back to avoid splatter. The browning process should take 5-8 minutes. Take the browned butter off the heat and immediately pour brown into a 2-quart/2-liter baking pan. See note below on alternative pan sizes.*", "In a medium or large bowl, combine the flour, oats, cane sugar, salt, and baking powder. Whisk in the oat milk and vanilla extract and almond extract (if using) until well combined. Using a ladle or measuring cup, ladle the batter on top of the brown butter. Ladling, instead of pouring all of the batter on top at once, helps the butter swirl and mix into batter. Top the cobbler with the peach-blueberry mixture.", "Bake the cobbler for 45-50 minutes, rotating the pan 180° halfway through to ensure even browning, until the top is deeply golden brown and bubbling. Mine took exactly 45 minutes.", "Allow the cobbler to cool slightly before serving. Serve warm and, if desired, with vegan vanilla ice cream on top.", ] ), self.harvester_class.instructions(), ) def test_ratings(self): self.assertEqual(4.96, self.harvester_class.ratings())
[ 1, 515, 9522, 412, 29918, 1557, 2390, 414, 29889, 6038, 17729, 24389, 19264, 1053, 21431, 17729, 3247, 424, 26754, 13, 3166, 6987, 1053, 2522, 336, 546, 3057, 13, 13, 13, 1990, 4321, 29934, 475, 17729, 3247, 424, 26754, 4421, 336, 546, 29898, 4421, 336, 546, 3057, 1125, 13, 13, 1678, 24559, 546, 29918, 1990, 353, 21431, 17729, 3247, 424, 26754, 13, 13, 1678, 822, 1243, 29918, 3069, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 703, 6038, 17729, 24389, 19264, 29889, 510, 613, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 3069, 3101, 13, 13, 1678, 822, 1243, 29918, 8921, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 28945, 5813, 28341, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 8921, 3101, 13, 13, 1678, 822, 1243, 29918, 3257, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 376, 29963, 387, 273, 9817, 1205, 357, 3938, 496, 315, 20838, 1358, 613, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 3257, 580, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 7827, 29918, 2230, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29953, 29900, 29892, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 7827, 29918, 2230, 3101, 13, 13, 1678, 822, 1243, 29918, 29891, 969, 29879, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 703, 29896, 29900, 3348, 886, 613, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 29891, 969, 29879, 3101, 13, 13, 1678, 822, 1243, 29918, 3027, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 376, 991, 597, 6038, 17729, 24389, 19264, 29889, 510, 29914, 11912, 29899, 3051, 29914, 9009, 29879, 29914, 29906, 29900, 29906, 29900, 29914, 29896, 29896, 29914, 412, 496, 9539, 495, 29878, 719, 29883, 20838, 1358, 29906, 29947, 29953, 974, 29896, 29900, 29906, 29929, 29889, 6173, 613, 13, 9651, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 3027, 3285, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 292, 1127, 10070, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 518, 13, 18884, 376, 29896, 282, 618, 313, 29946, 29945, 29946, 29887, 29897, 10107, 412, 541, 13774, 9226, 1236, 14520, 613, 13, 18884, 376, 29896, 29914, 29906, 18002, 313, 29955, 29945, 29899, 29947, 29945, 29887, 29897, 10849, 7254, 495, 2722, 613, 13, 18884, 376, 29896, 29914, 29941, 18002, 313, 29946, 29945, 29887, 29897, 1302, 535, 329, 26438, 313, 272, 17354, 26438, 19123, 13, 18884, 376, 29896, 734, 294, 1129, 265, 5962, 274, 2559, 314, 265, 613, 13, 18884, 376, 29896, 29914, 29946, 734, 294, 1129, 265, 18254, 29885, 387, 5135, 29902, 6907, 10849, 368, 867, 630, 18254, 29885, 387, 876, 613, 13, 18884, 376, 4421, 424, 29871, 29896, 29914, 29906, 734, 294, 1129, 265, 5962, 330, 5621, 613, 13, 18884, 376, 29906, 12534, 6609, 310, 5962, 5881, 314, 290, 5135, 25253, 876, 613, 13, 18884, 376, 29896, 29900, 6131, 1129, 787, 313, 29896, 29946, 29900, 29887, 29897, 15456, 8764, 384, 18058, 1205, 357, 613, 13, 18884, 376, 29896, 29871, 29896, 29914, 29906, 2723, 567, 313, 29896, 29947, 29900, 29887, 29897, 599, 29899, 15503, 4220, 1652, 473, 613, 13, 18884, 376, 4421, 424, 29871, 29906, 29914, 29941, 18002, 5135, 29953, 29900, 29887, 29897, 2030, 29899, 29888, 10904, 287, 29081, 288, 1446, 19123, 13, 18884, 376, 29896, 18002, 313, 29906, 29900, 29900, 29887, 29897, 2894, 293, 508, 29872, 26438, 613, 13, 18884, 376, 29896, 29914, 29946, 448, 29871, 29896, 29914, 29906, 734, 294, 1129, 265, 413, 359, 2276, 15795, 613, 13, 18884, 376, 29906, 734, 294, 1129, 787, 289, 5086, 4764, 672, 613, 13, 18884, 376, 29896, 29871, 29896, 29914, 29941, 2723, 567, 313, 29941, 29906, 29900, 286, 29931, 29897, 2989, 29899, 29888, 271, 288, 271, 27274, 313, 29902, 1304, 438, 271, 368, 19123, 13, 18884, 376, 29896, 29871, 29896, 29914, 29906, 734, 294, 1129, 787, 8296, 1109, 2911, 6597, 613, 13, 18884, 376, 29896, 29914, 29946, 448, 29871, 29896, 29914, 29906, 734, 294, 1129, 265, 8296, 394, 8315, 6597, 5135, 25253, 876, 613, 13, 18884, 376, 2831, 16330, 29901, 12461, 273, 1109, 2911, 14890, 907, 314, 5135, 25253, 876, 613, 13, 9651, 21251, 13, 9651, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 292, 1127, 10070, 3285, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 2611, 582, 1953, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 6634, 29876, 1642, 7122, 29898, 13, 18884, 518, 13, 462, 1678, 376, 1433, 3881, 263, 1153, 384, 297, 278, 7256, 310, 596, 288, 854, 322, 758, 354, 271, 372, 304, 29871, 29941, 29955, 29945, 30073, 29943, 29914, 29896, 29929, 29900, 30073, 29907, 19602, 13, 462, 1678, 376, 29907, 329, 278, 1236, 14520, 297, 4203, 322, 3349, 278, 282, 1169, 29892, 769, 5700, 278, 1236, 14520, 964, 29871, 29896, 29914, 29946, 29899, 29896, 29914, 29906, 297, 305, 12003, 269, 29399, 313, 29941, 29914, 29946, 7477, 448, 29871, 29896, 29871, 29896, 29914, 29946, 7477, 467, 17934, 278, 1236, 14520, 304, 263, 18350, 470, 2919, 12580, 29880, 29889, 3462, 278, 7254, 495, 2722, 29892, 1302, 535, 329, 26438, 29892, 274, 2559, 314, 265, 29892, 18254, 29885, 387, 29892, 330, 5621, 29892, 322, 5881, 314, 290, 313, 361, 773, 511, 322, 28189, 330, 2705, 304, 14405, 29889, 3789, 17786, 363, 29871, 29941, 29900, 6233, 304, 2758, 278, 15774, 304, 6425, 11831, 278, 21054, 943, 19602, 13, 462, 1678, 376, 3868, 271, 263, 2071, 7324, 975, 18350, 12871, 29892, 769, 788, 278, 18058, 1205, 357, 29889, 9038, 278, 541, 357, 338, 286, 2152, 287, 29892, 23546, 372, 4049, 322, 2381, 5168, 278, 7243, 304, 9801, 1584, 3347, 1076, 322, 7984, 292, 29892, 2745, 372, 1701, 2232, 322, 769, 10201, 3347, 1983, 29889, 887, 1795, 864, 304, 2317, 1250, 304, 4772, 8536, 2620, 29889, 450, 3347, 1076, 1889, 881, 2125, 29871, 29945, 29899, 29947, 6233, 29889, 11190, 278, 3347, 9571, 541, 357, 1283, 278, 12871, 322, 7389, 1671, 17354, 964, 263, 29871, 29906, 29899, 339, 442, 29914, 29906, 29899, 20889, 289, 5086, 7243, 29889, 2823, 4443, 2400, 373, 8671, 7243, 15786, 5575, 613, 13, 462, 1678, 376, 797, 263, 18350, 470, 2919, 12580, 29880, 29892, 14405, 278, 1652, 473, 29892, 288, 1446, 29892, 508, 29872, 26438, 29892, 15795, 29892, 322, 289, 5086, 4764, 672, 29889, 806, 3873, 297, 278, 288, 271, 27274, 322, 1109, 2911, 6597, 322, 394, 8315, 6597, 313, 361, 773, 29897, 2745, 1532, 12420, 29889, 5293, 263, 11979, 280, 470, 7540, 3864, 18002, 29892, 11979, 280, 278, 10193, 373, 2246, 310, 278, 17354, 541, 357, 29889, 19955, 1847, 29892, 2012, 310, 1671, 292, 599, 310, 278, 10193, 373, 2246, 472, 2748, 29892, 6911, 278, 541, 357, 2381, 5168, 322, 6837, 964, 10193, 29889, 7488, 278, 274, 20838, 1358, 411, 278, 1236, 496, 29899, 9539, 16344, 29544, 19602, 13, 462, 1678, 376, 29933, 1296, 278, 274, 20838, 1358, 363, 29871, 29946, 29945, 29899, 29945, 29900, 6233, 29892, 5731, 1218, 278, 7243, 29871, 29896, 29947, 29900, 30073, 4203, 1582, 1549, 304, 9801, 1584, 3347, 1076, 29892, 2745, 278, 2246, 338, 24344, 22843, 17354, 322, 289, 431, 21435, 29889, 26833, 3614, 3721, 29871, 29946, 29945, 6233, 19602, 13, 462, 1678, 376, 15930, 278, 274, 20838, 1358, 304, 12528, 10029, 1434, 16330, 29889, 1816, 345, 14294, 322, 29892, 565, 7429, 29892, 411, 12461, 273, 1109, 2911, 14890, 907, 314, 373, 2246, 19602, 13, 18884, 4514, 13, 9651, 10353, 13, 9651, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 2611, 582, 1953, 3285, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 3605, 886, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29946, 29889, 29929, 29953, 29892, 1583, 29889, 8222, 29894, 4156, 29918, 1990, 29889, 3605, 886, 3101, 13, 2 ]
Utmp.py
HenryHu/pybbs
14
61717
<gh_stars>10-100 import Config import os import struct import random import time import signal import User import UCache from sysv_ipc import * from UtmpHead import UtmpHead from commondata import CommonData from UserInfo import UserInfo from Log import Log from Util import Util import Login # from SemLock import SemLock UTMPFILE_SIZE = UserInfo.size * Config.USHM_SIZE UTMPHEAD_SIZE = 4 * Config.USHM_SIZE + 4 * (Config.UTMP_HASHSIZE + 1) + 4 * 3 + 8 * Config.USHM_SIZE class Utmp: utmpshm = None @staticmethod def Init(): if (Utmp.utmpshm == None): try: Log.info("attaching to UTMP shared memory") Utmp.utmpshm = SharedMemory(Config.Config.GetInt("UTMP_SHMKEY", 3699), size = UTMPFILE_SIZE) Log.info("attaching to UTMPHEAD shared memory") UtmpHead.utmphead = SharedMemory(Config.Config.GetInt("UTMPHEAD_SHMKEY", 3698), size = UTMPHEAD_SIZE); except ExistentialError: Log.info("Creating UTMP shared memory") Utmp.utmpshm = SharedMemory(Config.Config.GetInt("UTMP_SHMKEY", 3699), size = UTMPFILE_SIZE, flags = IPC_CREAT, mode = 0660, init_character='\0') Log.info("Creating UTMPHEAD shared memory") UtmpHead.utmphead = SharedMemory(Config.Config.GetInt("UTMPHEAD_SHMKEY", 3698), size = UTMPHEAD_SIZE, flags = IPC_CREAT, mode = 0660, init_character='\0') Utmp.ResetUtmp() Log.info("Utmp initialization finished") else: Log.info("Utmp already initialized") @staticmethod def ResetUtmp(locked=False): Log.info("Initializing UTMPHEAD shared memory") if not locked: fd = Utmp.Lock() UtmpHead.SetNumber(0) UtmpHead.SetHashHead(0, 1) UtmpHead.SetListHead(0) for i in range(Config.USHM_SIZE - 1): UtmpHead.SetNext(i, i+2) UtmpHead.SetNext(Config.USHM_SIZE - 1, 0) if not locked: Utmp.Unlock(fd) @staticmethod def Hash(userid): hash = UCache.UCache.Hash(userid) if (hash == 0): return 0 hash = (hash / 3) % Config.UTMP_HASHSIZE if (hash == 0): return 1 return hash @staticmethod def Lock(): #try: #SemLock.Lock(Config.UCACHE_SEMLOCK, timeout = 10); #return 0; #except BusyError: #return -1; # Log.debug("Utmp.Lock enter()") lockf = os.open(Config.BBS_ROOT + "UTMP", os.O_RDWR | os.O_CREAT, 0600) if (lockf < 0): Log.error("Fail to open lock file!") raise Exception("fail to lock!") Util.FLock(lockf, shared = False) # Log.debug("Utmp.Lock succ()") return lockf @staticmethod def Unlock(lockf): #SemLock.Unlock(Config.UCACHE_SEMLOCK) # Log.debug("Utmp.Unlock") Util.FUnlock(lockf) os.close(lockf) @staticmethod def GetNewUtmpEntry(userinfo): utmpfd = Utmp.Lock() pos = -2 try: UtmpHead.SetReadOnly(0) userinfo.utmpkey = random.randint(0, 99999999); pos = UtmpHead.GetHashHead(0) - 1; Log.debug("New entry: %d" % (pos + 1)) if (pos == -1): UtmpHead.SetReadOnly(1) Log.error("Utmp full!") raise Exception("Utmp full!") login = Login.Login(pos + 1) if (not login.list_add(userinfo.userid)): UtmpHead.SetReadOnly(1) Log.error("Utmp list loop!") raise Exception("Utmp list loop!") login.hash_add(userinfo.userid) #if (UtmpHead.GetListHead() == 0): #UtmpHead.SetListPrev(pos, pos+1) #UtmpHead.SetListNext(pos, pos+1) #UtmpHead.SetListHead(pos+1) #else: #i = UtmpHead.GetListHead() #if (Utmp.GetUserId(i-1).lower() >= userinfo.userid.lower()): #UtmpHead.SetListPrev(pos, UtmpHead.GetListPrev(i-1)) #UtmpHead.SetListNext(pos, i) #UtmpHead.SetListPrev(i-1, pos+1) #UtmpHead.SetListNext(UtmpHead.GetListPrev(pos) - 1, pos+1) #UtmpHead.SetListHead(pos+1) #else: #count = 0; #i = UtmpHead.GetListNext(i-1) #while ((Utmp.GetUserId(i-1).lower() < userinfo.userid.lower()) and (i != UtmpHead.GetListHead())): #i = UtmpHead.GetListNext(i-1) #count = count + 1; #if (count > Config.USHM_SIZE): #UtmpHead.SetListHead(0) #Utmp.RebuildList() #UtmpHead.SetReadOnly(1) #Utmp.Unlock(utmpfd) #Log.error("Utmp list loop!") #return -1 # wrong! exit(-1)! #UtmpHead.SetListPrev(pos, UtmpHead.GetListPrev(i-1)) #UtmpHead.SetListNext(pos, i) #UtmpHead.SetListPrev(i-1, pos+1) #UtmpHead.SetListNext(UtmpHead.GetListPrev(pos) - 1, pos+1) # UtmpHead.SetHashHead(0, UtmpHead.GetNext(pos)) # Log.debug("New freelist head: %d" % UtmpHead.GetHashHead(0)) if (Utmp.IsActive(pos)): if (Utmp.GetPid(pos) != 0): Log.warn("allocating an active utmp!") try: os.kill(Utmp.GetPid(pos), signal.SIGHUP) except OSError: pass userinfo.SetIndex(pos + 1) userinfo.save() # Utmp.SetUserInfo(pos, userinfo) # hashkey = Utmp.Hash(userinfo.userid) # i = UtmpHead.GetHashHead(hashkey); # UtmpHead.SetNext(pos, i) # UtmpHead.SetHashHead(hashkey, pos+1) UtmpHead.IncNumber() CommonData.UpdateMaxUser(); now = int(time.time()) if ((now > UtmpHead.GetUptime() + 120) or (now < UtmpHead.GetUptime() - 120)): UtmpHead.SetUptime(now) for n in range(Config.USHM_SIZE): if (Utmp.IsActive(n) and Utmp.GetPid(n) != 0): try: os.kill(Utmp.GetPid(n), 0) except OSError: username = Utmp.GetUserId(n) Utmp.Clear2(n+1) User.User.RemoveMsgCount(username) UtmpHead.SetReadOnly(1) finally: # lock is important! Utmp.Unlock(utmpfd) # Log.info("New entry: %d" % pos) return pos + 1; @staticmethod def IsActive(login): return Utmp.GetInt(login, UserInfo.ACTIVE_POS) @staticmethod def GetUserId(login): return Utmp.GetString(login, UserInfo.USERID_POS, UserInfo.USERID_SIZE) @staticmethod def GetUid(login): return Utmp.GetInt(login, UserInfo.UID_POS) @staticmethod def GetPid(login): return Utmp.GetInt(login, UserInfo.PID_POS) @staticmethod def GetInt(login, offset): return struct.unpack('=i', Utmp.utmpshm.read(4, login * UserInfo.size + offset))[0] @staticmethod def GetString(login, offset, size): return Util.CString(Utmp.utmpshm.read(size, login * UserInfo.size + offset)) @staticmethod def SetUserInfo(pos, userinfo): Utmp.utmpshm.write(userinfo.pack(), pos * UserInfo.size) @staticmethod def Clear(uent, useridx, pid): lock = Utmp.Lock() try: UtmpHead.SetReadOnly(0) if (((useridx == 0) or (Utmp.GetUid(uent - 1) == useridx)) and (pid == Utmp.GetPid(uent - 1))): Utmp.Clear2(uent); UtmpHead.SetReadOnly(1) finally: # lock is important! Utmp.Unlock(lock) @staticmethod def Clear2(uent): userinfo = UserInfo(uent) Log.debug("clearing user %s uid %d loginid %d" % (userinfo.userid, userinfo.uid, uent)) user = UCache.UCache.GetUserByUid(userinfo.uid) UCache.UCache.DoAfterLogout(user, userinfo, uent, 0) login = Login.Login(uent) login.hash_remove() login.list_remove() if (userinfo.active): UtmpHead.DecNumber() Log.debug("zeroing utmp %d" % uent) zeroinfo = UserInfo() zeroinfo.SetIndex(uent) zeroinfo.save() @staticmethod def RebuildList(): lock = Utmp.Lock() try: entries = [] hashes = {} active = set() for i in xrange(Config.USHM_SIZE): userinfo = UserInfo(i + 1) if userinfo.active == 1: entries.append((i, userinfo.userid)) hash = Utmp.Hash(userinfo.userid) hashes[hash] = hashes.get(hash, []) + [i] active.add(i) if entries == []: Log.info("NO USER! RESET!") Utmp.ResetUtmp(locked=True) else: cnt = len(entries) Log.info("Rebuild Utmp with %d entries" % cnt) entries.sort(key=lambda entry: entry[1]) UtmpHead.SetReadOnly(0) # rebuild list UtmpHead.SetListHead(entries[0][0] + 1) for i in xrange(len(entries)): pos = entries[i][0] next = entries[(i + 1) % cnt][0] prev = entries[(i - 1 + cnt) % cnt][0] UtmpHead.SetListNext(pos, next + 1) UtmpHead.SetListPrev(pos, prev + 1) print pos, "prev", prev, "next", next # rebuild hash for hash in hashes: cnt = len(hashes[hash]) UtmpHead.SetHashHead(hash, hashes[hash][0] + 1) print "hash", hash, "head", hashes[hash][0] for i in xrange(cnt): pos = hashes[hash][i] if i < cnt - 1: next = hashes[hash][i + 1] else: next = -1 UtmpHead.SetNext(pos, next + 1) print "next", pos, next for i in xrange(Config.UTMP_HASHSIZE): if i != 0 and UtmpHead.GetHashHead(i) != 0 and not i in hashes: UtmpHead.SetHashHead(i, 0) print "reset", i # TODO: rebuild free list at hash[0] #if min(active) > 0: # UtmpHead.SetHashHead(0, 1) UtmpHead.SetReadOnly(1) finally: Utmp.Unlock(lock)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 12782, 13, 5215, 2897, 13, 5215, 2281, 13, 5215, 4036, 13, 5215, 931, 13, 5215, 7182, 13, 5215, 4911, 13, 5215, 501, 10408, 13, 3166, 10876, 29894, 29918, 666, 29883, 1053, 334, 13, 3166, 501, 7050, 5494, 1053, 501, 7050, 5494, 13, 3166, 844, 898, 532, 1053, 13103, 1469, 13, 3166, 4911, 3401, 1053, 4911, 3401, 13, 3166, 4522, 1053, 4522, 13, 3166, 22310, 1053, 22310, 13, 5215, 19130, 13, 29937, 515, 9444, 16542, 1053, 9444, 16542, 13, 13, 2692, 3580, 7724, 29918, 14226, 353, 4911, 3401, 29889, 2311, 334, 12782, 29889, 3308, 29950, 29924, 29918, 14226, 13, 2692, 3580, 23252, 29918, 14226, 353, 29871, 29946, 334, 12782, 29889, 3308, 29950, 29924, 29918, 14226, 718, 29871, 29946, 334, 313, 3991, 29889, 2692, 3580, 29918, 29950, 24943, 14226, 718, 29871, 29896, 29897, 718, 29871, 29946, 334, 29871, 29941, 718, 29871, 29947, 334, 12782, 29889, 3308, 29950, 29924, 29918, 14226, 13, 13, 1990, 501, 7050, 29901, 13, 1678, 3477, 29885, 567, 7184, 353, 6213, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 10886, 7295, 13, 4706, 565, 313, 29965, 7050, 29889, 329, 29885, 567, 7184, 1275, 6213, 1125, 13, 9651, 1018, 29901, 13, 18884, 4522, 29889, 3888, 703, 1131, 9733, 304, 501, 29911, 3580, 7258, 3370, 1159, 13, 18884, 501, 7050, 29889, 329, 29885, 567, 7184, 353, 21236, 16015, 29898, 3991, 29889, 3991, 29889, 2577, 2928, 703, 2692, 3580, 29918, 7068, 29924, 10818, 613, 29871, 29941, 29953, 29929, 29929, 511, 2159, 353, 501, 29911, 3580, 7724, 29918, 14226, 29897, 13, 18884, 4522, 29889, 3888, 703, 1131, 9733, 304, 501, 29911, 3580, 23252, 7258, 3370, 1159, 13, 18884, 501, 7050, 5494, 29889, 329, 1526, 2813, 353, 21236, 16015, 29898, 3991, 29889, 3991, 29889, 2577, 2928, 703, 2692, 3580, 23252, 29918, 7068, 29924, 10818, 613, 29871, 29941, 29953, 29929, 29947, 511, 2159, 353, 501, 29911, 3580, 23252, 29918, 14226, 416, 13, 9651, 5174, 1222, 391, 2556, 2392, 29901, 13, 18884, 4522, 29889, 3888, 703, 9832, 1218, 501, 29911, 3580, 7258, 3370, 1159, 13, 18884, 501, 7050, 29889, 329, 29885, 567, 7184, 353, 21236, 16015, 29898, 3991, 29889, 3991, 29889, 2577, 2928, 703, 2692, 3580, 29918, 7068, 29924, 10818, 613, 29871, 29941, 29953, 29929, 29929, 511, 2159, 353, 501, 29911, 3580, 7724, 29918, 14226, 29892, 13449, 353, 5641, 29907, 29918, 22245, 1299, 29892, 4464, 353, 29871, 29900, 29953, 29953, 29900, 29892, 2069, 29918, 18609, 2433, 29905, 29900, 1495, 13, 18884, 4522, 29889, 3888, 703, 9832, 1218, 501, 29911, 3580, 23252, 7258, 3370, 1159, 13, 18884, 501, 7050, 5494, 29889, 329, 1526, 2813, 353, 21236, 16015, 29898, 3991, 29889, 3991, 29889, 2577, 2928, 703, 2692, 3580, 23252, 29918, 7068, 29924, 10818, 613, 29871, 29941, 29953, 29929, 29947, 511, 2159, 353, 501, 29911, 3580, 23252, 29918, 14226, 29892, 13449, 353, 5641, 29907, 29918, 22245, 1299, 29892, 4464, 353, 29871, 29900, 29953, 29953, 29900, 29892, 2069, 29918, 18609, 2433, 29905, 29900, 1495, 13, 18884, 501, 7050, 29889, 27175, 29965, 7050, 580, 13, 9651, 4522, 29889, 3888, 703, 29965, 7050, 17865, 7743, 1159, 13, 4706, 1683, 29901, 13, 9651, 4522, 29889, 3888, 703, 29965, 7050, 2307, 16601, 1159, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2538, 300, 29965, 7050, 29898, 29113, 29922, 8824, 1125, 13, 4706, 4522, 29889, 3888, 703, 15514, 5281, 501, 29911, 3580, 23252, 7258, 3370, 1159, 13, 4706, 565, 451, 22822, 29901, 13, 9651, 285, 29881, 353, 501, 7050, 29889, 16542, 580, 13, 4706, 501, 7050, 5494, 29889, 2697, 4557, 29898, 29900, 29897, 13, 4706, 501, 7050, 5494, 29889, 2697, 10438, 5494, 29898, 29900, 29892, 29871, 29896, 29897, 13, 4706, 501, 7050, 5494, 29889, 2697, 1293, 5494, 29898, 29900, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 3991, 29889, 3308, 29950, 29924, 29918, 14226, 448, 29871, 29896, 1125, 13, 9651, 501, 7050, 5494, 29889, 2697, 9190, 29898, 29875, 29892, 474, 29974, 29906, 29897, 13, 4706, 501, 7050, 5494, 29889, 2697, 9190, 29898, 3991, 29889, 3308, 29950, 29924, 29918, 14226, 448, 29871, 29896, 29892, 29871, 29900, 29897, 13, 4706, 565, 451, 22822, 29901, 13, 9651, 501, 7050, 29889, 2525, 908, 29898, 11512, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 11874, 29898, 1792, 333, 1125, 13, 4706, 6608, 353, 501, 10408, 29889, 29965, 10408, 29889, 10438, 29898, 1792, 333, 29897, 13, 4706, 565, 313, 8568, 1275, 29871, 29900, 1125, 13, 9651, 736, 29871, 29900, 13, 4706, 6608, 353, 313, 8568, 847, 29871, 29941, 29897, 1273, 12782, 29889, 2692, 3580, 29918, 29950, 24943, 14226, 13, 4706, 565, 313, 8568, 1275, 29871, 29900, 1125, 13, 9651, 736, 29871, 29896, 13, 4706, 736, 6608, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 18199, 7295, 13, 4706, 396, 2202, 29901, 13, 9651, 396, 28516, 16542, 29889, 16542, 29898, 3991, 29889, 23129, 2477, 9606, 29918, 1660, 1988, 29949, 7077, 29892, 11815, 353, 29871, 29896, 29900, 416, 13, 9651, 396, 2457, 29871, 29900, 29936, 13, 4706, 396, 19499, 8406, 29891, 2392, 29901, 13, 9651, 396, 2457, 448, 29896, 29936, 13, 29937, 4706, 4522, 29889, 8382, 703, 29965, 7050, 29889, 16542, 3896, 580, 1159, 13, 4706, 7714, 29888, 353, 2897, 29889, 3150, 29898, 3991, 29889, 29933, 9851, 29918, 21289, 718, 376, 2692, 3580, 613, 2897, 29889, 29949, 29918, 29934, 29928, 9980, 891, 2897, 29889, 29949, 29918, 22245, 1299, 29892, 29871, 29900, 29953, 29900, 29900, 29897, 13, 4706, 565, 313, 908, 29888, 529, 29871, 29900, 1125, 13, 9651, 4522, 29889, 2704, 703, 16243, 304, 1722, 7714, 934, 29991, 1159, 13, 9651, 12020, 8960, 703, 14057, 304, 7714, 29991, 1159, 13, 4706, 22310, 29889, 10536, 1698, 29898, 908, 29888, 29892, 7258, 353, 7700, 29897, 13, 29937, 4706, 4522, 29889, 8382, 703, 29965, 7050, 29889, 16542, 8348, 580, 1159, 13, 4706, 736, 7714, 29888, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 853, 908, 29898, 908, 29888, 1125, 13, 4706, 396, 28516, 16542, 29889, 2525, 908, 29898, 3991, 29889, 23129, 2477, 9606, 29918, 1660, 1988, 29949, 7077, 29897, 13, 29937, 4706, 4522, 29889, 8382, 703, 29965, 7050, 29889, 2525, 908, 1159, 13, 4706, 22310, 29889, 29943, 2525, 908, 29898, 908, 29888, 29897, 13, 4706, 2897, 29889, 5358, 29898, 908, 29888, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3617, 4373, 29965, 7050, 9634, 29898, 1792, 3888, 1125, 13, 4706, 3477, 1526, 11512, 353, 501, 7050, 29889, 16542, 580, 13, 4706, 926, 353, 448, 29906, 13, 4706, 1018, 29901, 13, 9651, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29900, 29897, 13, 13, 9651, 1404, 3888, 29889, 329, 1526, 1989, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 416, 13, 9651, 926, 353, 501, 7050, 5494, 29889, 2577, 10438, 5494, 29898, 29900, 29897, 448, 29871, 29896, 29936, 13, 9651, 4522, 29889, 8382, 703, 4373, 6251, 29901, 1273, 29881, 29908, 1273, 313, 1066, 718, 29871, 29896, 876, 13, 9651, 565, 313, 1066, 1275, 448, 29896, 1125, 13, 18884, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29896, 29897, 13, 18884, 4522, 29889, 2704, 703, 29965, 7050, 2989, 29991, 1159, 13, 18884, 12020, 8960, 703, 29965, 7050, 2989, 29991, 1159, 13, 13, 9651, 6464, 353, 19130, 29889, 11049, 29898, 1066, 718, 29871, 29896, 29897, 13, 9651, 565, 313, 1333, 6464, 29889, 1761, 29918, 1202, 29898, 1792, 3888, 29889, 1792, 333, 22164, 13, 18884, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29896, 29897, 13, 18884, 4522, 29889, 2704, 703, 29965, 7050, 1051, 2425, 29991, 1159, 13, 18884, 12020, 8960, 703, 29965, 7050, 1051, 2425, 29991, 1159, 13, 9651, 6464, 29889, 8568, 29918, 1202, 29898, 1792, 3888, 29889, 1792, 333, 29897, 13, 13, 4706, 396, 361, 313, 29965, 7050, 5494, 29889, 2577, 1293, 5494, 580, 1275, 29871, 29900, 1125, 13, 9651, 396, 29965, 7050, 5494, 29889, 2697, 1293, 6572, 29894, 29898, 1066, 29892, 926, 29974, 29896, 29897, 13, 9651, 396, 29965, 7050, 5494, 29889, 2697, 1293, 9190, 29898, 1066, 29892, 926, 29974, 29896, 29897, 13, 9651, 396, 29965, 7050, 5494, 29889, 2697, 1293, 5494, 29898, 1066, 29974, 29896, 29897, 13, 4706, 396, 2870, 29901, 13, 9651, 396, 29875, 353, 501, 7050, 5494, 29889, 2577, 1293, 5494, 580, 13, 9651, 396, 361, 313, 29965, 7050, 29889, 2577, 2659, 1204, 29898, 29875, 29899, 29896, 467, 13609, 580, 6736, 1404, 3888, 29889, 1792, 333, 29889, 13609, 580, 1125, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 6572, 29894, 29898, 1066, 29892, 501, 7050, 5494, 29889, 2577, 1293, 6572, 29894, 29898, 29875, 29899, 29896, 876, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 9190, 29898, 1066, 29892, 474, 29897, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 6572, 29894, 29898, 29875, 29899, 29896, 29892, 926, 29974, 29896, 29897, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 9190, 29898, 29965, 7050, 5494, 29889, 2577, 1293, 6572, 29894, 29898, 1066, 29897, 448, 29871, 29896, 29892, 926, 29974, 29896, 29897, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 5494, 29898, 1066, 29974, 29896, 29897, 13, 9651, 396, 2870, 29901, 13, 18884, 396, 2798, 353, 29871, 29900, 29936, 13, 18884, 396, 29875, 353, 501, 7050, 5494, 29889, 2577, 1293, 9190, 29898, 29875, 29899, 29896, 29897, 13, 18884, 396, 8000, 5135, 29965, 7050, 29889, 2577, 2659, 1204, 29898, 29875, 29899, 29896, 467, 13609, 580, 529, 1404, 3888, 29889, 1792, 333, 29889, 13609, 3101, 322, 313, 29875, 2804, 501, 7050, 5494, 29889, 2577, 1293, 5494, 22130, 29901, 13, 462, 1678, 396, 29875, 353, 501, 7050, 5494, 29889, 2577, 1293, 9190, 29898, 29875, 29899, 29896, 29897, 13, 462, 1678, 396, 2798, 353, 2302, 718, 29871, 29896, 29936, 13, 462, 1678, 396, 361, 313, 2798, 1405, 12782, 29889, 3308, 29950, 29924, 29918, 14226, 1125, 13, 462, 4706, 396, 29965, 7050, 5494, 29889, 2697, 1293, 5494, 29898, 29900, 29897, 13, 462, 4706, 396, 29965, 7050, 29889, 29934, 774, 29884, 789, 1293, 580, 13, 462, 4706, 396, 29965, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29896, 29897, 13, 462, 4706, 396, 29965, 7050, 29889, 2525, 908, 29898, 329, 1526, 11512, 29897, 13, 462, 4706, 396, 3403, 29889, 2704, 703, 29965, 7050, 1051, 2425, 29991, 1159, 13, 462, 4706, 396, 2457, 448, 29896, 396, 2743, 29991, 6876, 6278, 29896, 20198, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 6572, 29894, 29898, 1066, 29892, 501, 7050, 5494, 29889, 2577, 1293, 6572, 29894, 29898, 29875, 29899, 29896, 876, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 9190, 29898, 1066, 29892, 474, 29897, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 6572, 29894, 29898, 29875, 29899, 29896, 29892, 926, 29974, 29896, 29897, 13, 18884, 396, 29965, 7050, 5494, 29889, 2697, 1293, 9190, 29898, 29965, 7050, 5494, 29889, 2577, 1293, 6572, 29894, 29898, 1066, 29897, 448, 29871, 29896, 29892, 926, 29974, 29896, 29897, 13, 29937, 4706, 501, 7050, 5494, 29889, 2697, 10438, 5494, 29898, 29900, 29892, 501, 7050, 5494, 29889, 2577, 9190, 29898, 1066, 876, 13, 29937, 4706, 4522, 29889, 8382, 703, 4373, 3005, 295, 391, 2343, 29901, 1273, 29881, 29908, 1273, 501, 7050, 5494, 29889, 2577, 10438, 5494, 29898, 29900, 876, 13, 13, 9651, 565, 313, 29965, 7050, 29889, 3624, 9966, 29898, 1066, 22164, 13, 18884, 565, 313, 29965, 7050, 29889, 2577, 29925, 333, 29898, 1066, 29897, 2804, 29871, 29900, 1125, 13, 462, 1678, 4522, 29889, 25442, 703, 15956, 1218, 385, 6136, 3477, 1526, 29991, 1159, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 2897, 29889, 21174, 29898, 29965, 7050, 29889, 2577, 29925, 333, 29898, 1066, 511, 7182, 29889, 5425, 29954, 29950, 4897, 29897, 13, 462, 1678, 5174, 438, 29173, 29901, 13, 462, 4706, 1209, 13, 9651, 1404, 3888, 29889, 2697, 3220, 29898, 1066, 718, 29871, 29896, 29897, 13, 9651, 1404, 3888, 29889, 7620, 580, 13, 29937, 4706, 501, 7050, 29889, 2697, 2659, 3401, 29898, 1066, 29892, 1404, 3888, 29897, 13, 29937, 4706, 6608, 1989, 353, 501, 7050, 29889, 10438, 29898, 1792, 3888, 29889, 1792, 333, 29897, 13, 13, 29937, 4706, 474, 353, 501, 7050, 5494, 29889, 2577, 10438, 5494, 29898, 8568, 1989, 416, 13, 29937, 4706, 501, 7050, 5494, 29889, 2697, 9190, 29898, 1066, 29892, 474, 29897, 13, 29937, 4706, 501, 7050, 5494, 29889, 2697, 10438, 5494, 29898, 8568, 1989, 29892, 926, 29974, 29896, 29897, 13, 13, 9651, 501, 7050, 5494, 29889, 797, 29883, 4557, 580, 13, 9651, 13103, 1469, 29889, 6422, 7976, 2659, 890, 13, 13, 9651, 1286, 353, 938, 29898, 2230, 29889, 2230, 3101, 13, 9651, 565, 5135, 3707, 1405, 501, 7050, 5494, 29889, 2577, 29965, 415, 603, 580, 718, 29871, 29896, 29906, 29900, 29897, 470, 313, 3707, 529, 501, 7050, 5494, 29889, 2577, 29965, 415, 603, 580, 448, 29871, 29896, 29906, 29900, 22164, 13, 18884, 501, 7050, 5494, 29889, 2697, 29965, 415, 603, 29898, 3707, 29897, 13, 18884, 363, 302, 297, 3464, 29898, 3991, 29889, 3308, 29950, 29924, 29918, 14226, 1125, 13, 462, 1678, 565, 313, 29965, 7050, 29889, 3624, 9966, 29898, 29876, 29897, 322, 501, 7050, 29889, 2577, 29925, 333, 29898, 29876, 29897, 2804, 29871, 29900, 1125, 13, 462, 4706, 1018, 29901, 13, 462, 9651, 2897, 29889, 21174, 29898, 29965, 7050, 29889, 2577, 29925, 333, 29898, 29876, 511, 29871, 29900, 29897, 13, 462, 4706, 5174, 438, 29173, 29901, 13, 462, 9651, 8952, 353, 501, 7050, 29889, 2577, 2659, 1204, 29898, 29876, 29897, 13, 462, 9651, 501, 7050, 29889, 18759, 29906, 29898, 29876, 29974, 29896, 29897, 13, 462, 9651, 4911, 29889, 2659, 29889, 15941, 16190, 3981, 29898, 6786, 29897, 13, 9651, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29896, 29897, 13, 4706, 7146, 29901, 396, 7714, 338, 4100, 29991, 13, 9651, 501, 7050, 29889, 2525, 908, 29898, 329, 1526, 11512, 29897, 13, 29937, 4706, 4522, 29889, 3888, 703, 4373, 6251, 29901, 1273, 29881, 29908, 1273, 926, 29897, 13, 4706, 736, 926, 718, 29871, 29896, 29936, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1317, 9966, 29898, 7507, 1125, 13, 4706, 736, 501, 7050, 29889, 2577, 2928, 29898, 7507, 29892, 4911, 3401, 29889, 17923, 18474, 29918, 24815, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3617, 2659, 1204, 29898, 7507, 1125, 13, 4706, 736, 501, 7050, 29889, 2577, 1231, 29898, 7507, 29892, 4911, 3401, 29889, 11889, 1367, 29918, 24815, 29892, 4911, 3401, 29889, 11889, 1367, 29918, 14226, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3617, 29965, 333, 29898, 7507, 1125, 13, 4706, 736, 501, 7050, 29889, 2577, 2928, 29898, 7507, 29892, 4911, 3401, 29889, 11150, 29918, 24815, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3617, 29925, 333, 29898, 7507, 1125, 13, 4706, 736, 501, 7050, 29889, 2577, 2928, 29898, 7507, 29892, 4911, 3401, 29889, 29925, 1367, 29918, 24815, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3617, 2928, 29898, 7507, 29892, 9210, 1125, 13, 4706, 736, 2281, 29889, 348, 4058, 877, 29922, 29875, 742, 501, 7050, 29889, 329, 29885, 567, 7184, 29889, 949, 29898, 29946, 29892, 6464, 334, 4911, 3401, 29889, 2311, 718, 9210, 876, 29961, 29900, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3617, 1231, 29898, 7507, 29892, 9210, 29892, 2159, 1125, 13, 4706, 736, 22310, 29889, 29907, 1231, 29898, 29965, 7050, 29889, 329, 29885, 567, 7184, 29889, 949, 29898, 2311, 29892, 6464, 334, 4911, 3401, 29889, 2311, 718, 9210, 876, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3789, 2659, 3401, 29898, 1066, 29892, 1404, 3888, 1125, 13, 4706, 501, 7050, 29889, 329, 29885, 567, 7184, 29889, 3539, 29898, 1792, 3888, 29889, 4058, 3285, 926, 334, 4911, 3401, 29889, 2311, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 17732, 29898, 8122, 29892, 1404, 13140, 29892, 23107, 1125, 13, 4706, 7714, 353, 501, 7050, 29889, 16542, 580, 13, 4706, 1018, 29901, 13, 9651, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29900, 29897, 13, 13, 9651, 565, 313, 3552, 1792, 13140, 1275, 29871, 29900, 29897, 470, 313, 29965, 7050, 29889, 2577, 29965, 333, 29898, 8122, 448, 29871, 29896, 29897, 1275, 1404, 13140, 876, 322, 313, 5935, 1275, 501, 7050, 29889, 2577, 29925, 333, 29898, 8122, 448, 29871, 29896, 876, 1125, 13, 18884, 501, 7050, 29889, 18759, 29906, 29898, 8122, 416, 13, 13, 9651, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29896, 29897, 13, 4706, 7146, 29901, 396, 7714, 338, 4100, 29991, 13, 9651, 501, 7050, 29889, 2525, 908, 29898, 908, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 17732, 29906, 29898, 8122, 1125, 13, 4706, 1404, 3888, 353, 4911, 3401, 29898, 8122, 29897, 13, 13, 4706, 4522, 29889, 8382, 703, 8551, 292, 1404, 1273, 29879, 318, 333, 1273, 29881, 6464, 333, 1273, 29881, 29908, 1273, 313, 1792, 3888, 29889, 1792, 333, 29892, 1404, 3888, 29889, 5416, 29892, 318, 296, 876, 13, 4706, 1404, 353, 501, 10408, 29889, 29965, 10408, 29889, 2577, 2659, 2059, 29965, 333, 29898, 1792, 3888, 29889, 5416, 29897, 13, 4706, 501, 10408, 29889, 29965, 10408, 29889, 6132, 13555, 3403, 449, 29898, 1792, 29892, 1404, 3888, 29892, 318, 296, 29892, 29871, 29900, 29897, 13, 13, 4706, 6464, 353, 19130, 29889, 11049, 29898, 8122, 29897, 13, 4706, 6464, 29889, 8568, 29918, 5992, 580, 13, 4706, 6464, 29889, 1761, 29918, 5992, 580, 13, 13, 4706, 565, 313, 1792, 3888, 29889, 4925, 1125, 13, 9651, 501, 7050, 5494, 29889, 6185, 4557, 580, 13, 13, 4706, 4522, 29889, 8382, 703, 9171, 292, 3477, 1526, 1273, 29881, 29908, 1273, 318, 296, 29897, 13, 4706, 5225, 3888, 353, 4911, 3401, 580, 13, 4706, 5225, 3888, 29889, 2697, 3220, 29898, 8122, 29897, 13, 4706, 5225, 3888, 29889, 7620, 580, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 12936, 29884, 789, 1293, 7295, 13, 4706, 7714, 353, 501, 7050, 29889, 16542, 580, 13, 4706, 1018, 29901, 13, 9651, 9976, 353, 5159, 13, 9651, 6608, 267, 353, 6571, 13, 9651, 6136, 353, 731, 580, 13, 9651, 363, 474, 297, 921, 3881, 29898, 3991, 29889, 3308, 29950, 29924, 29918, 14226, 1125, 13, 18884, 1404, 3888, 353, 4911, 3401, 29898, 29875, 718, 29871, 29896, 29897, 13, 18884, 565, 1404, 3888, 29889, 4925, 1275, 29871, 29896, 29901, 13, 462, 1678, 9976, 29889, 4397, 3552, 29875, 29892, 1404, 3888, 29889, 1792, 333, 876, 13, 462, 1678, 6608, 353, 501, 7050, 29889, 10438, 29898, 1792, 3888, 29889, 1792, 333, 29897, 13, 462, 1678, 6608, 267, 29961, 8568, 29962, 353, 6608, 267, 29889, 657, 29898, 8568, 29892, 518, 2314, 718, 518, 29875, 29962, 13, 462, 1678, 6136, 29889, 1202, 29898, 29875, 29897, 13, 13, 9651, 565, 9976, 1275, 5159, 29901, 13, 18884, 4522, 29889, 3888, 703, 6632, 3148, 1001, 29991, 5195, 10490, 29991, 1159, 13, 18884, 501, 7050, 29889, 27175, 29965, 7050, 29898, 29113, 29922, 5574, 29897, 13, 9651, 1683, 29901, 13, 18884, 274, 593, 353, 7431, 29898, 26586, 29897, 13, 18884, 4522, 29889, 3888, 703, 29934, 774, 29884, 789, 501, 7050, 411, 1273, 29881, 9976, 29908, 1273, 274, 593, 29897, 13, 18884, 9976, 29889, 6605, 29898, 1989, 29922, 2892, 6251, 29901, 6251, 29961, 29896, 2314, 13, 18884, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29900, 29897, 13, 13, 18884, 396, 337, 4282, 1051, 13, 18884, 501, 7050, 5494, 29889, 2697, 1293, 5494, 29898, 26586, 29961, 29900, 3816, 29900, 29962, 718, 29871, 29896, 29897, 13, 18884, 363, 474, 297, 921, 3881, 29898, 2435, 29898, 26586, 22164, 13, 462, 1678, 926, 353, 9976, 29961, 29875, 3816, 29900, 29962, 13, 462, 1678, 2446, 353, 9976, 15625, 29875, 718, 29871, 29896, 29897, 1273, 274, 593, 3816, 29900, 29962, 13, 462, 1678, 12379, 353, 9976, 15625, 29875, 448, 29871, 29896, 718, 274, 593, 29897, 1273, 274, 593, 3816, 29900, 29962, 13, 462, 1678, 501, 7050, 5494, 29889, 2697, 1293, 9190, 29898, 1066, 29892, 2446, 718, 29871, 29896, 29897, 13, 462, 1678, 501, 7050, 5494, 29889, 2697, 1293, 6572, 29894, 29898, 1066, 29892, 12379, 718, 29871, 29896, 29897, 13, 462, 1678, 1596, 926, 29892, 376, 16304, 613, 12379, 29892, 376, 4622, 613, 2446, 13, 13, 18884, 396, 337, 4282, 6608, 13, 18884, 363, 6608, 297, 6608, 267, 29901, 13, 462, 1678, 274, 593, 353, 7431, 29898, 8568, 267, 29961, 8568, 2314, 13, 462, 1678, 501, 7050, 5494, 29889, 2697, 10438, 5494, 29898, 8568, 29892, 6608, 267, 29961, 8568, 3816, 29900, 29962, 718, 29871, 29896, 29897, 13, 462, 1678, 1596, 376, 8568, 613, 6608, 29892, 376, 2813, 613, 6608, 267, 29961, 8568, 3816, 29900, 29962, 13, 462, 1678, 363, 474, 297, 921, 3881, 29898, 20047, 1125, 13, 462, 4706, 926, 353, 6608, 267, 29961, 8568, 3816, 29875, 29962, 13, 462, 4706, 565, 474, 529, 274, 593, 448, 29871, 29896, 29901, 13, 462, 9651, 2446, 353, 6608, 267, 29961, 8568, 3816, 29875, 718, 29871, 29896, 29962, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 2446, 353, 448, 29896, 13, 462, 4706, 501, 7050, 5494, 29889, 2697, 9190, 29898, 1066, 29892, 2446, 718, 29871, 29896, 29897, 13, 462, 4706, 1596, 376, 4622, 613, 926, 29892, 2446, 13, 18884, 363, 474, 297, 921, 3881, 29898, 3991, 29889, 2692, 3580, 29918, 29950, 24943, 14226, 1125, 13, 462, 1678, 565, 474, 2804, 29871, 29900, 322, 501, 7050, 5494, 29889, 2577, 10438, 5494, 29898, 29875, 29897, 2804, 29871, 29900, 322, 451, 474, 297, 6608, 267, 29901, 13, 462, 4706, 501, 7050, 5494, 29889, 2697, 10438, 5494, 29898, 29875, 29892, 29871, 29900, 29897, 13, 462, 4706, 1596, 376, 12071, 613, 474, 13, 13, 18884, 396, 14402, 29901, 337, 4282, 3889, 1051, 472, 6608, 29961, 29900, 29962, 13, 13, 18884, 396, 361, 1375, 29898, 4925, 29897, 1405, 29871, 29900, 29901, 13, 18884, 396, 1678, 501, 7050, 5494, 29889, 2697, 10438, 5494, 29898, 29900, 29892, 29871, 29896, 29897, 13, 13, 18884, 501, 7050, 5494, 29889, 2697, 6359, 11730, 29898, 29896, 29897, 13, 4706, 7146, 29901, 13, 9651, 501, 7050, 29889, 2525, 908, 29898, 908, 29897, 13, 13, 2 ]
app/__init__.py
lwalter/flask-angular-starter
13
32541
<reponame>lwalter/flask-angular-starter from app.factory import create_app
[ 1, 529, 276, 1112, 420, 29958, 29880, 29893, 13794, 29914, 1579, 1278, 29899, 6825, 29899, 303, 4254, 13, 3166, 623, 29889, 14399, 1053, 1653, 29918, 932, 13, 2 ]
sum/4-sum-II.py
windowssocket/py_leetcode
3
32073
# LTE using two pointers O(n**3) class Solution(object): def fourSumCount(self, A, B, C, D): # corner case: if len(A) == 0: return 0 A.sort() B.sort() C.sort() D.sort() count = 0 for i in range(len(A)): for j in range(len(B)): k = 0 t = len(D) - 1 while 0 <= k < len(C) and 0 <= t < len(D): if A[i] + B[j] + C[k] + D[t] > 0: t -= 1 elif A[i] + B[j] + C[k] + D[t] < 0: k += 1 else: tmp1 = 1 tmp2 = 1 while 0 <= k < len(C) - 1 and C[k + 1] == C[k]: k += 1 tmp1 += 1 while 1 <= t < len(D) and D[t - 1] == D[t]: t -= 1 tmp2 += 1 count += tmp1 * tmp2 k += 1 t -= 1 return count # hashmap Solution AC O(n**2) class Solution(object): def fourSumCount(self, A, B, C, D): """ :type A: List[int] :type B: List[int] :type C: List[int] :type D: List[int] :rtype: int """ hashtable = {} count = 0 for a in A: for b in B: if a+b in hashtable: hashtable[a+b] += 1 else: hashtable[a+b] = 1 for c in C: for d in D: if -c-d in hashtable: count += hashtable[-c-d] return count
[ 1, 396, 365, 4330, 773, 1023, 12589, 438, 29898, 29876, 1068, 29941, 29897, 13, 1990, 24380, 29898, 3318, 1125, 13, 13, 1678, 822, 3023, 11139, 3981, 29898, 1311, 29892, 319, 29892, 350, 29892, 315, 29892, 360, 1125, 13, 4706, 396, 11155, 1206, 29901, 13, 4706, 565, 7431, 29898, 29909, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 4706, 319, 29889, 6605, 580, 13, 4706, 350, 29889, 6605, 580, 13, 4706, 315, 29889, 6605, 580, 13, 4706, 360, 29889, 6605, 580, 13, 13, 4706, 2302, 353, 29871, 29900, 13, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 29909, 22164, 13, 9651, 363, 432, 297, 3464, 29898, 2435, 29898, 29933, 22164, 13, 18884, 413, 353, 29871, 29900, 13, 18884, 260, 353, 7431, 29898, 29928, 29897, 448, 29871, 29896, 13, 13, 18884, 1550, 29871, 29900, 5277, 413, 529, 7431, 29898, 29907, 29897, 322, 29871, 29900, 5277, 260, 529, 7431, 29898, 29928, 1125, 13, 462, 1678, 565, 319, 29961, 29875, 29962, 718, 350, 29961, 29926, 29962, 718, 315, 29961, 29895, 29962, 718, 360, 29961, 29873, 29962, 1405, 29871, 29900, 29901, 13, 462, 4706, 260, 22361, 29871, 29896, 13, 462, 1678, 25342, 319, 29961, 29875, 29962, 718, 350, 29961, 29926, 29962, 718, 315, 29961, 29895, 29962, 718, 360, 29961, 29873, 29962, 529, 29871, 29900, 29901, 13, 462, 4706, 413, 4619, 29871, 29896, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 13128, 29896, 353, 29871, 29896, 13, 462, 4706, 13128, 29906, 353, 29871, 29896, 13, 462, 4706, 1550, 29871, 29900, 5277, 413, 529, 7431, 29898, 29907, 29897, 448, 29871, 29896, 322, 315, 29961, 29895, 718, 29871, 29896, 29962, 1275, 315, 29961, 29895, 5387, 13, 462, 9651, 413, 4619, 29871, 29896, 13, 462, 9651, 13128, 29896, 4619, 29871, 29896, 13, 462, 4706, 1550, 29871, 29896, 5277, 260, 529, 7431, 29898, 29928, 29897, 322, 360, 29961, 29873, 448, 29871, 29896, 29962, 1275, 360, 29961, 29873, 5387, 13, 462, 9651, 260, 22361, 29871, 29896, 13, 462, 9651, 13128, 29906, 4619, 29871, 29896, 13, 462, 4706, 2302, 4619, 13128, 29896, 334, 13128, 29906, 13, 462, 4706, 413, 4619, 29871, 29896, 13, 462, 4706, 260, 22361, 29871, 29896, 13, 13, 4706, 736, 2302, 13, 13, 13, 29937, 6608, 1958, 24380, 14614, 438, 29898, 29876, 1068, 29906, 29897, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 3023, 11139, 3981, 29898, 1311, 29892, 319, 29892, 350, 29892, 315, 29892, 360, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 319, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 1853, 350, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 1853, 315, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 1853, 360, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 4706, 9995, 13, 4706, 756, 400, 519, 353, 6571, 13, 4706, 2302, 353, 29871, 29900, 13, 4706, 363, 263, 297, 319, 29901, 13, 9651, 363, 289, 297, 350, 29901, 13, 18884, 565, 263, 29974, 29890, 297, 756, 400, 519, 29901, 13, 462, 1678, 756, 400, 519, 29961, 29874, 29974, 29890, 29962, 4619, 29871, 29896, 13, 13, 18884, 1683, 29901, 13, 462, 1678, 756, 400, 519, 29961, 29874, 29974, 29890, 29962, 353, 29871, 29896, 13, 13, 4706, 363, 274, 297, 315, 29901, 13, 9651, 363, 270, 297, 360, 29901, 13, 18884, 565, 448, 29883, 29899, 29881, 297, 756, 400, 519, 29901, 13, 462, 1678, 2302, 4619, 756, 400, 519, 14352, 29883, 29899, 29881, 29962, 13, 4706, 736, 2302, 2 ]
app/app/migrations/0001_initial.py
poornachandrakashi/covid-cough-prediction
3
34691
# Generated by Django 2.1.1 on 2020-04-05 06:12 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Response', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('location', models.CharField(max_length=200)), ('email', models.EmailField(max_length=200)), ('cough', models.FileField(upload_to='')), ('uploaded_at', models.DateTimeField(auto_now_add=True)), ], ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29896, 29889, 29896, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29900, 29946, 29899, 29900, 29945, 29871, 29900, 29953, 29901, 29896, 29906, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 2847, 353, 5852, 13, 13, 1678, 9962, 353, 518, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 5103, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 12300, 3073, 29898, 6921, 29918, 11600, 29922, 5574, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 29892, 26952, 29918, 978, 2433, 1367, 1495, 511, 13, 18884, 6702, 978, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29900, 29900, 8243, 13, 18884, 6702, 5479, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29900, 29900, 8243, 13, 18884, 6702, 5269, 742, 4733, 29889, 9823, 3073, 29898, 3317, 29918, 2848, 29922, 29906, 29900, 29900, 8243, 13, 18884, 6702, 29883, 820, 742, 4733, 29889, 2283, 3073, 29898, 9009, 29918, 517, 2433, 1495, 511, 13, 18884, 6702, 9009, 287, 29918, 271, 742, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29918, 1202, 29922, 5574, 8243, 13, 9651, 21251, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
migrations/versions/4250dfa822a4_feed_countries.py
cuducos/findaconf
9
147812
"""Feed: Countries Revision ID: 4250dfa822a4 Revises: <PASSWORD> Create Date: 2014-12-10 22:24:01.089932 """ # revision identifiers, used by Alembic. revision = '4250dfa822a4' down_revision = '<PASSWORD>' from alembic import op import sqlalchemy as sa from sqlalchemy.sql import table, column from csv import reader from findaconf import app from findaconf.models import Continent, Country def upgrade(): # load countries iso3166.csv and build a dictionary csv_path = app.config['BASEDIR'].child('migrations', 'csv', 'en') csv_file = csv_path.child('iso3166.csv') countries = dict() with open(csv_file) as file_handler: csv = list(reader(file_handler)) for c in csv: countries[c[0]] = c[1] # load countries-continents from country_continent.csv csv_file = csv_path.child('country_continent.csv') with open(csv_file) as file_handler: csv = list(reader(file_handler)) country_continent = [{'country': c[0], 'continent': c[1]} for c in csv] # loop and feed countries table data = list() for item in country_continent: # get continent id continent_guess = item['continent'].lower() continent = Continent.query.filter_by(alpha2=continent_guess).first() # include country if continent is not None: country_name = countries.get(item['country'], False) if country_name: data.append({'alpha2': item['country'].lower(), 'title': country_name, 'continent_id': continent.id}) # Create an ad-hoc table to use for the insert statement. country_table = table('country', column('alpha2', sa.String), column('title', sa.String), column('continent_id', sa.Integer), ) # Insert data. op.bulk_insert(country_table, data) def downgrade(): op.execute(Country.__table__.delete())
[ 1, 9995, 29737, 29901, 3917, 2722, 13, 13, 1123, 4924, 3553, 29901, 29871, 29946, 29906, 29945, 29900, 2176, 29874, 29947, 29906, 29906, 29874, 29946, 13, 1123, 1730, 267, 29901, 529, 25711, 17013, 29958, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29896, 29946, 29899, 29896, 29906, 29899, 29896, 29900, 29871, 29906, 29906, 29901, 29906, 29946, 29901, 29900, 29896, 29889, 29900, 29947, 29929, 29929, 29941, 29906, 13, 13, 15945, 29908, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 525, 29946, 29906, 29945, 29900, 2176, 29874, 29947, 29906, 29906, 29874, 29946, 29915, 13, 3204, 29918, 276, 4924, 353, 12801, 25711, 17013, 16299, 13, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 13, 3166, 4576, 284, 305, 6764, 29889, 2850, 1053, 1591, 29892, 1897, 13, 13, 3166, 11799, 1053, 9591, 13, 3166, 1284, 29874, 5527, 1053, 623, 13, 3166, 1284, 29874, 5527, 29889, 9794, 1053, 2866, 8946, 29892, 15456, 13, 13, 13, 1753, 14955, 7295, 13, 13, 1678, 396, 2254, 10916, 338, 29877, 29941, 29896, 29953, 29953, 29889, 7638, 322, 2048, 263, 8600, 13, 1678, 11799, 29918, 2084, 353, 623, 29889, 2917, 1839, 25416, 9464, 13359, 5145, 877, 26983, 800, 742, 525, 7638, 742, 525, 264, 1495, 13, 1678, 11799, 29918, 1445, 353, 11799, 29918, 2084, 29889, 5145, 877, 10718, 29941, 29896, 29953, 29953, 29889, 7638, 1495, 13, 1678, 10916, 353, 9657, 580, 13, 1678, 411, 1722, 29898, 7638, 29918, 1445, 29897, 408, 934, 29918, 13789, 29901, 13, 4706, 11799, 353, 1051, 29898, 16950, 29898, 1445, 29918, 13789, 876, 13, 4706, 363, 274, 297, 11799, 29901, 13, 9651, 10916, 29961, 29883, 29961, 29900, 5262, 353, 274, 29961, 29896, 29962, 13, 13, 1678, 396, 2254, 10916, 29899, 1285, 262, 1237, 515, 4234, 29918, 1285, 8946, 29889, 7638, 13, 1678, 11799, 29918, 1445, 353, 11799, 29918, 2084, 29889, 5145, 877, 13509, 29918, 1285, 8946, 29889, 7638, 1495, 13, 1678, 411, 1722, 29898, 7638, 29918, 1445, 29897, 408, 934, 29918, 13789, 29901, 13, 4706, 11799, 353, 1051, 29898, 16950, 29898, 1445, 29918, 13789, 876, 13, 4706, 4234, 29918, 1285, 8946, 353, 518, 10998, 13509, 2396, 274, 29961, 29900, 1402, 525, 1285, 8946, 2396, 274, 29961, 29896, 12258, 363, 274, 297, 11799, 29962, 13, 13, 1678, 396, 2425, 322, 8343, 10916, 1591, 13, 1678, 848, 353, 1051, 580, 13, 1678, 363, 2944, 297, 4234, 29918, 1285, 8946, 29901, 13, 13, 4706, 396, 679, 25523, 1178, 13, 4706, 25523, 29918, 2543, 404, 353, 2944, 1839, 1285, 8946, 13359, 13609, 580, 13, 4706, 25523, 353, 2866, 8946, 29889, 1972, 29889, 4572, 29918, 1609, 29898, 2312, 29906, 29922, 1285, 8946, 29918, 2543, 404, 467, 4102, 580, 13, 13, 4706, 396, 3160, 4234, 13, 4706, 565, 25523, 338, 451, 6213, 29901, 13, 9651, 4234, 29918, 978, 353, 10916, 29889, 657, 29898, 667, 1839, 13509, 7464, 7700, 29897, 13, 9651, 565, 4234, 29918, 978, 29901, 13, 18884, 848, 29889, 4397, 3319, 29915, 2312, 29906, 2396, 2944, 1839, 13509, 13359, 13609, 3285, 13, 462, 632, 525, 3257, 2396, 4234, 29918, 978, 29892, 13, 462, 632, 525, 1285, 8946, 29918, 333, 2396, 25523, 29889, 333, 1800, 13, 13, 1678, 396, 6204, 385, 594, 29899, 29882, 542, 1591, 304, 671, 363, 278, 4635, 3229, 29889, 13, 1678, 4234, 29918, 2371, 353, 1591, 877, 13509, 742, 13, 4706, 1897, 877, 2312, 29906, 742, 872, 29889, 1231, 511, 13, 4706, 1897, 877, 3257, 742, 872, 29889, 1231, 511, 13, 4706, 1897, 877, 1285, 8946, 29918, 333, 742, 872, 29889, 7798, 511, 13, 1678, 1723, 13, 13, 1678, 396, 24505, 848, 29889, 13, 1678, 1015, 29889, 8645, 29895, 29918, 7851, 29898, 13509, 29918, 2371, 29892, 848, 29897, 13, 13, 13, 1753, 1623, 8228, 7295, 13, 1678, 1015, 29889, 7978, 29898, 20779, 17255, 2371, 26914, 8143, 3101, 13, 2 ]
src/controllerarena/controllers/refVec.py
VerifiableRobotics/controller-arena
0
29331
# code for python reference dipole vector field controller # these functions require stuff #from mathFuns import * from numpy import * from math import * class refVec: # define the constructor def __init__(self, q_0, controller_flag): # Initialize controller state self.phi_prev = None self.q_prev = q_0 self.e_int_w = 0 self.e_int_u = 0 # set gains self.k_p_u = 1 # u indicates it is an position gain. p indicates it is a proportional gain. self.k_p_w = 3 # w indicates it is an angular gain. p indicates it is a proportional gain. if controller_flag == 1: # PID self.k_i_w = 1 self.k_i_u = 1 self.k_d = -1 # the derivative gain is only on the angle elif controller_flag == 2: # PI self.k_i_w = 1 self.k_i_u = 1 self.k_d = 0 elif controller_flag == 3: # PD self.k_i_w = 0 self.k_i_u = 0 self.k_d = -1 else: # P self.k_i_w = 0 self.k_i_u = 0 self.k_d = 0 def get_output(self, q_d, q, dt): # obtain reference vector field value F = self.get_vector_field(q, q_d) # F is an column vector ## obtain control signal as a fcn of reference vector field value u = self.get_control(q, q_d, F, dt) return u def get_vector_field(self, q, q_d): # return type: numpy array # note: unsure if this vector field was just an example from the paper!! # compute vector field F # unpack # x = q[0][0] # y = q[1][0] # x_d = q_d[0][0] # y_d = q_d[1][0] # # # # compute [taken from paper draft], where r = [1;0] and lambda = 3 # Fx = 2*(x - x_d)**2 - (y - y_d)**2 # Fy = 3*(x - x_d)*(y - y_d) # F = array([[Fx],[Fy]]) lamb = 3 theta_d = q_d[2][0] delta_p = q[0:2] - q_d[0:2] # location - location_desired r = array([[cos(theta_d)],[sin(theta_d)]]) F = lamb*(dot(transpose(r), delta_p)[0][0])*delta_p - r*(dot(transpose(delta_p), delta_p)[0][0]) # should be col vector print F return F # col vector def get_control(self, q, q_d, F, dt): # I think that this control law is not a function of the vector field, and that it should # work if F(q) changes # # compute control signal u delta_p = q[0:2] - q_d[0:2] # location - location_desired self.e_int_w += self.sub_angles(q[2][0],q_d[2][0])*dt # accumulate angular error self.e_int_u += linalg.norm(delta_p)*dt # accumulate position error theta = q[2][0] # unpack gains k_p_u = self.k_p_u k_p_w = self.k_p_w k_i_w = self.k_i_w k_i_u = self.k_i_u k_d = self.k_d Fx = F[0][0] Fy = F[1][0] phi = atan2(Fy,Fx) # backward finite difference for phidot if self.phi_prev == None: # if this is the first pass through the controller, phi_dot = 0 self.phi_prev = phi # end if phi_dot = (phi-self.phi_prev)/dt self.phi_prev = phi q_dot = (q-self.q_prev)/dt self.q_prev = q # controller v = -k_p_u*sign( dot(transpose(delta_p), array([[cos(theta)],[sin(theta)]]) )[0][0] )*tanh(linalg.norm(delta_p)**2) - k_i_u*self.e_int_u w = -k_p_w*self.sub_angles(theta, phi) - k_i_w*self.e_int_w - k_d*phi_dot # k_d determines whether derivative term is used, k_i for i term u = array([[v], [w]]) print u return u def update_state(self, q_d, q, dt): # x_k+1 = 0 pass def sub_angles(self, ang1, ang2): return (ang1 - ang2 + pi)%(2*pi) - pi # For future: # pass r vector as parameter # low pass filtering for derivatives (PD control?) [phidot] # visual stuff # global feedback plan is the ref vecf field # controller is a function of vector field, but you can use a better controller to get better performance
[ 1, 396, 775, 363, 3017, 3407, 652, 15831, 4608, 1746, 4701, 13, 13, 29937, 1438, 3168, 1996, 6433, 13, 29937, 3166, 5844, 29943, 6948, 1053, 334, 13, 3166, 12655, 1053, 334, 13, 3166, 5844, 1053, 334, 13, 13, 1990, 2143, 25987, 29901, 13, 12, 29937, 4529, 278, 5823, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3855, 29918, 29900, 29892, 4701, 29918, 15581, 1125, 13, 4706, 396, 25455, 4701, 2106, 13, 4706, 1583, 29889, 2876, 29918, 16304, 353, 6213, 13, 4706, 1583, 29889, 29939, 29918, 16304, 353, 3855, 29918, 29900, 13, 4706, 1583, 29889, 29872, 29918, 524, 29918, 29893, 353, 29871, 29900, 13, 4706, 1583, 29889, 29872, 29918, 524, 29918, 29884, 353, 29871, 29900, 13, 308, 13, 4706, 396, 731, 330, 2708, 13, 4706, 1583, 29889, 29895, 29918, 29886, 29918, 29884, 353, 29871, 29896, 259, 396, 318, 14088, 372, 338, 385, 2602, 11581, 29889, 282, 14088, 372, 338, 263, 29839, 11581, 29889, 13, 4706, 1583, 29889, 29895, 29918, 29886, 29918, 29893, 353, 29871, 29941, 259, 396, 281, 14088, 372, 338, 385, 6401, 11581, 29889, 282, 14088, 372, 338, 263, 29839, 11581, 29889, 13, 4706, 565, 4701, 29918, 15581, 1275, 29871, 29896, 29901, 396, 349, 1367, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29893, 353, 29871, 29896, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29884, 353, 29871, 29896, 13, 9651, 1583, 29889, 29895, 29918, 29881, 353, 448, 29896, 396, 278, 16291, 11581, 338, 871, 373, 278, 10696, 13, 4706, 25342, 4701, 29918, 15581, 1275, 29871, 29906, 29901, 396, 349, 29902, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29893, 353, 29871, 29896, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29884, 353, 29871, 29896, 13, 9651, 1583, 29889, 29895, 29918, 29881, 353, 29871, 29900, 13, 4706, 25342, 4701, 29918, 15581, 1275, 29871, 29941, 29901, 396, 349, 29928, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29893, 353, 29871, 29900, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29884, 353, 29871, 29900, 13, 9651, 1583, 29889, 29895, 29918, 29881, 353, 448, 29896, 13, 4706, 1683, 29901, 396, 349, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29893, 353, 29871, 29900, 13, 9651, 1583, 29889, 29895, 29918, 29875, 29918, 29884, 353, 29871, 29900, 13, 9651, 1583, 29889, 29895, 29918, 29881, 353, 29871, 29900, 13, 13, 1678, 822, 679, 29918, 4905, 29898, 1311, 29892, 3855, 29918, 29881, 29892, 3855, 29892, 11636, 1125, 396, 4017, 3407, 4608, 1746, 995, 13, 4706, 383, 353, 1583, 29889, 657, 29918, 8111, 29918, 2671, 29898, 29939, 29892, 3855, 29918, 29881, 29897, 396, 383, 338, 385, 1897, 4608, 13, 4706, 444, 4017, 2761, 7182, 408, 263, 285, 18038, 310, 3407, 4608, 1746, 995, 13, 4706, 318, 353, 1583, 29889, 657, 29918, 6451, 29898, 29939, 29892, 3855, 29918, 29881, 29892, 383, 29892, 11636, 29897, 13, 4706, 736, 318, 13, 13, 1678, 822, 679, 29918, 8111, 29918, 2671, 29898, 1311, 29892, 3855, 29892, 3855, 29918, 29881, 1125, 13, 12, 12, 29937, 736, 1134, 29901, 12655, 1409, 13, 12, 12, 29937, 4443, 29901, 9644, 545, 565, 445, 4608, 1746, 471, 925, 385, 1342, 515, 278, 5650, 6824, 13, 12, 12, 29937, 10272, 4608, 1746, 383, 13, 12, 12, 29937, 443, 4058, 13, 4706, 396, 12, 12, 29916, 353, 3855, 29961, 29900, 3816, 29900, 29962, 13, 4706, 396, 12, 12, 29891, 353, 3855, 29961, 29896, 3816, 29900, 29962, 13, 4706, 396, 12, 12, 29916, 29918, 29881, 353, 3855, 29918, 29881, 29961, 29900, 3816, 29900, 29962, 13, 4706, 396, 12, 12, 29891, 29918, 29881, 353, 3855, 29918, 29881, 29961, 29896, 3816, 29900, 29962, 13, 4706, 396, 12, 12, 29937, 13, 4706, 396, 12, 12, 29937, 10272, 518, 29873, 9424, 515, 5650, 18195, 1402, 988, 364, 353, 518, 29896, 29936, 29900, 29962, 322, 14013, 353, 29871, 29941, 13, 4706, 396, 12, 12, 29943, 29916, 353, 29871, 29906, 16395, 29916, 448, 921, 29918, 29881, 29897, 1068, 29906, 448, 313, 29891, 448, 343, 29918, 29881, 29897, 1068, 29906, 13, 4706, 396, 12, 12, 29943, 29891, 353, 29871, 29941, 16395, 29916, 448, 921, 29918, 29881, 11877, 29898, 29891, 448, 343, 29918, 29881, 29897, 13, 4706, 396, 12, 12, 29943, 353, 1409, 4197, 29961, 29943, 29916, 16272, 29943, 29891, 24960, 13, 4706, 301, 1117, 353, 29871, 29941, 13, 4706, 278, 941, 29918, 29881, 353, 3855, 29918, 29881, 29961, 29906, 3816, 29900, 29962, 13, 4706, 19471, 29918, 29886, 353, 3855, 29961, 29900, 29901, 29906, 29962, 448, 3855, 29918, 29881, 29961, 29900, 29901, 29906, 29962, 396, 4423, 448, 4423, 29918, 2783, 2859, 13, 4706, 364, 353, 1409, 4197, 29961, 3944, 29898, 3416, 29918, 29881, 29897, 16272, 5223, 29898, 3416, 29918, 29881, 4638, 2314, 29871, 13, 4706, 383, 353, 301, 1117, 16395, 6333, 29898, 3286, 4220, 29898, 29878, 511, 19471, 29918, 29886, 9601, 29900, 3816, 29900, 2314, 29930, 4181, 29918, 29886, 448, 364, 16395, 6333, 29898, 3286, 4220, 29898, 4181, 29918, 29886, 511, 29871, 19471, 29918, 29886, 9601, 29900, 3816, 29900, 2314, 396, 881, 367, 784, 4608, 13, 4706, 1596, 383, 13, 4706, 736, 383, 396, 784, 4608, 13, 268, 13, 1678, 822, 679, 29918, 6451, 29898, 1311, 29892, 3855, 29892, 3855, 29918, 29881, 29892, 383, 29892, 11636, 1125, 13, 12, 12, 29937, 306, 1348, 393, 445, 2761, 4307, 338, 451, 263, 740, 310, 278, 4608, 1746, 29892, 322, 393, 372, 881, 13, 12, 12, 29937, 664, 565, 383, 29898, 29939, 29897, 3620, 13, 12, 12, 29937, 29871, 13, 12, 12, 29937, 10272, 2761, 7182, 318, 29871, 13, 4706, 19471, 29918, 29886, 353, 3855, 29961, 29900, 29901, 29906, 29962, 448, 3855, 29918, 29881, 29961, 29900, 29901, 29906, 29962, 396, 4423, 448, 4423, 29918, 2783, 2859, 13, 4706, 1583, 29889, 29872, 29918, 524, 29918, 29893, 4619, 1583, 29889, 1491, 29918, 19536, 29898, 29939, 29961, 29906, 3816, 29900, 1402, 29939, 29918, 29881, 29961, 29906, 3816, 29900, 2314, 29930, 6008, 396, 18414, 5987, 6401, 1059, 13, 4706, 1583, 29889, 29872, 29918, 524, 29918, 29884, 4619, 301, 979, 29887, 29889, 12324, 29898, 4181, 29918, 29886, 11877, 6008, 396, 18414, 5987, 2602, 1059, 13, 4706, 278, 941, 353, 3855, 29961, 29906, 3816, 29900, 29962, 13, 308, 13, 4706, 396, 443, 4058, 330, 2708, 13, 4706, 413, 29918, 29886, 29918, 29884, 353, 1583, 29889, 29895, 29918, 29886, 29918, 29884, 13, 4706, 413, 29918, 29886, 29918, 29893, 353, 1583, 29889, 29895, 29918, 29886, 29918, 29893, 13, 4706, 413, 29918, 29875, 29918, 29893, 353, 1583, 29889, 29895, 29918, 29875, 29918, 29893, 13, 4706, 413, 29918, 29875, 29918, 29884, 353, 1583, 29889, 29895, 29918, 29875, 29918, 29884, 13, 4706, 413, 29918, 29881, 353, 1583, 29889, 29895, 29918, 29881, 13, 308, 13, 4706, 383, 29916, 353, 383, 29961, 29900, 3816, 29900, 29962, 13, 4706, 383, 29891, 353, 383, 29961, 29896, 3816, 29900, 29962, 13, 4706, 1374, 29875, 353, 472, 273, 29906, 29898, 29943, 29891, 29892, 29943, 29916, 29897, 13, 308, 13, 12, 12, 29937, 1250, 1328, 8093, 4328, 363, 1374, 333, 327, 13, 4706, 565, 1583, 29889, 2876, 29918, 16304, 1275, 6213, 29901, 396, 565, 445, 338, 278, 937, 1209, 1549, 278, 4701, 29892, 1374, 29875, 29918, 6333, 353, 29871, 29900, 13, 9651, 1583, 29889, 2876, 29918, 16304, 353, 1374, 29875, 13, 12, 12, 29937, 1095, 565, 12, 13, 4706, 1374, 29875, 29918, 6333, 353, 313, 2876, 29899, 1311, 29889, 2876, 29918, 16304, 6802, 6008, 13, 4706, 1583, 29889, 2876, 29918, 16304, 353, 1374, 29875, 13, 13, 4706, 3855, 29918, 6333, 353, 313, 29939, 29899, 1311, 29889, 29939, 29918, 16304, 6802, 6008, 13, 4706, 1583, 29889, 29939, 29918, 16304, 353, 3855, 13, 308, 13, 4706, 396, 4701, 13, 4706, 325, 353, 448, 29895, 29918, 29886, 29918, 29884, 29930, 4530, 29898, 8329, 29898, 3286, 4220, 29898, 4181, 29918, 29886, 511, 1409, 4197, 29961, 3944, 29898, 3416, 29897, 16272, 5223, 29898, 3416, 4638, 2314, 1723, 29961, 29900, 3816, 29900, 29962, 1723, 29930, 13161, 29882, 29898, 29880, 979, 29887, 29889, 12324, 29898, 4181, 29918, 29886, 29897, 1068, 29906, 29897, 448, 413, 29918, 29875, 29918, 29884, 29930, 1311, 29889, 29872, 29918, 524, 29918, 29884, 13, 4706, 281, 353, 448, 29895, 29918, 29886, 29918, 29893, 29930, 1311, 29889, 1491, 29918, 19536, 29898, 3416, 29892, 1374, 29875, 29897, 448, 413, 29918, 29875, 29918, 29893, 29930, 1311, 29889, 29872, 29918, 524, 29918, 29893, 448, 413, 29918, 29881, 29930, 2876, 29918, 6333, 29871, 396, 413, 29918, 29881, 3683, 1475, 3692, 16291, 1840, 338, 1304, 29892, 413, 29918, 29875, 363, 474, 1840, 13, 4706, 318, 353, 1409, 4197, 29961, 29894, 1402, 518, 29893, 24960, 13, 4706, 1596, 318, 13, 4706, 736, 318, 13, 13, 1678, 822, 2767, 29918, 3859, 29898, 1311, 29892, 3855, 29918, 29881, 29892, 3855, 29892, 11636, 1125, 13, 268, 12, 29937, 921, 29918, 29895, 29974, 29896, 353, 29871, 29900, 13, 268, 12, 3364, 13, 13, 1678, 822, 1014, 29918, 19536, 29898, 1311, 29892, 2614, 29896, 29892, 2614, 29906, 1125, 13, 268, 12, 2457, 313, 574, 29896, 448, 2614, 29906, 718, 2930, 29897, 29995, 29898, 29906, 29930, 1631, 29897, 448, 2930, 13, 29937, 1152, 5434, 29901, 13, 29937, 1209, 364, 4608, 408, 3443, 29871, 13, 29937, 4482, 1209, 21166, 363, 25748, 313, 25014, 2761, 7897, 518, 561, 333, 327, 29962, 13, 29937, 7604, 6433, 13, 29937, 5534, 16705, 3814, 338, 278, 2143, 9649, 29888, 1746, 13, 29937, 4701, 338, 263, 740, 310, 4608, 1746, 29892, 541, 366, 508, 671, 263, 2253, 4701, 304, 679, 2253, 4180, 13, 13, 13, 13, 2 ]
download-package/PythonExercises/ex015.py
MCLeitao/Python-Exercises
0
172205
# Write a program that asks the number of kilometers a car has driven and the number of days it has been hired. # Calculate the price to pay, knowing that the car costs US$ 60 per day and US$ 0.15 per km driven. k = float(input('Enter how many kilometers the car has traveled: ')) d = float(input('Enter how many days the car has been rented: ')) t = (k * 0.15) + (d * 60) print('The total rental of the car is {}US${:.2f}{}'.format('\033[1;31;40m', t, '\033[m'))
[ 1, 396, 14350, 263, 1824, 393, 19514, 278, 1353, 310, 20052, 2699, 263, 1559, 756, 18225, 322, 278, 1353, 310, 3841, 372, 756, 1063, 298, 2859, 29889, 13, 29937, 20535, 403, 278, 8666, 304, 5146, 29892, 13797, 393, 278, 1559, 21544, 3148, 29938, 29871, 29953, 29900, 639, 2462, 322, 3148, 29938, 29871, 29900, 29889, 29896, 29945, 639, 2383, 18225, 29889, 13, 13, 29895, 353, 5785, 29898, 2080, 877, 10399, 920, 1784, 20052, 2699, 278, 1559, 756, 1020, 345, 839, 29901, 525, 876, 13, 29881, 353, 5785, 29898, 2080, 877, 10399, 920, 1784, 3841, 278, 1559, 756, 1063, 364, 14927, 29901, 525, 876, 13, 29873, 353, 313, 29895, 334, 29871, 29900, 29889, 29896, 29945, 29897, 718, 313, 29881, 334, 29871, 29953, 29900, 29897, 13, 2158, 877, 1576, 3001, 364, 13703, 310, 278, 1559, 338, 6571, 3308, 5303, 29901, 29889, 29906, 29888, 1157, 29913, 4286, 4830, 28909, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29896, 29936, 29946, 29900, 29885, 742, 260, 29892, 11297, 29900, 29941, 29941, 29961, 29885, 8785, 13, 2 ]
vendor/packages/nose/unit_tests/test_importer.py
DESHRAJ/fjord
2
1614605
import os import sys import unittest import nose.config import nose.importer class TestImporter(unittest.TestCase): def setUp(self): self.p = sys.path[:] def tearDown(self): sys.path = self.p[:] def test_add_paths(self): where = os.path.abspath(os.path.join(os.path.dirname(__file__), 'support')) foo = os.path.join(where, 'foo') foobar = os.path.join(foo, 'bar') nose.importer.add_path(foobar) assert not foobar in sys.path assert not foo in sys.path assert where in sys.path assert sys.path[0] == where, "%s first should be %s" % (sys.path, where) def test_import(self): where = os.path.abspath(os.path.join(os.path.dirname(__file__), 'support')) foo = os.path.join(where, 'foo') foobar = os.path.join(foo, 'bar') imp = nose.importer.Importer() mod = imp.importFromDir(foobar, 'buz') assert where in sys.path # buz has an intra-package import that sets boodle assert mod.boodle def test_module_no_file(self): where = os.path.abspath(os.path.join(os.path.dirname(__file__), 'support')) foo = os.path.join(where, 'foo') foobar = os.path.join(foo, 'bar') # something that's not a real module and has no __file__ sys.modules['buz'] = 'Whatever' imp = nose.importer.Importer() mod = imp.importFromDir(foobar, 'buz') assert where in sys.path # buz has an intra-package import that sets boodle assert mod.boodle if __name__ == '__main__': unittest.main()
[ 1, 1053, 2897, 13, 5215, 10876, 13, 5215, 443, 27958, 13, 5215, 26414, 29889, 2917, 13, 5215, 26414, 29889, 326, 18505, 13, 13, 1990, 4321, 24192, 9555, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29886, 353, 10876, 29889, 2084, 7503, 29962, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 10876, 29889, 2084, 353, 1583, 29889, 29886, 7503, 29962, 13, 268, 13, 1678, 822, 1243, 29918, 1202, 29918, 24772, 29898, 1311, 1125, 13, 4706, 988, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 13, 462, 462, 632, 525, 5924, 8785, 13, 4706, 7953, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3062, 29892, 525, 5431, 1495, 13, 4706, 1701, 22872, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5431, 29892, 525, 1646, 1495, 13, 4706, 26414, 29889, 326, 18505, 29889, 1202, 29918, 2084, 29898, 1181, 22872, 29897, 13, 308, 13, 4706, 4974, 451, 1701, 22872, 297, 10876, 29889, 2084, 13, 4706, 4974, 451, 7953, 297, 10876, 29889, 2084, 13, 4706, 4974, 988, 297, 10876, 29889, 2084, 13, 4706, 4974, 10876, 29889, 2084, 29961, 29900, 29962, 1275, 988, 29892, 11860, 29879, 937, 881, 367, 1273, 29879, 29908, 1273, 313, 9675, 29889, 2084, 29892, 988, 29897, 13, 13, 1678, 822, 1243, 29918, 5215, 29898, 1311, 1125, 13, 4706, 988, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 13, 462, 462, 632, 525, 5924, 8785, 13, 4706, 7953, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3062, 29892, 525, 5431, 1495, 13, 4706, 1701, 22872, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5431, 29892, 525, 1646, 1495, 13, 13, 4706, 2411, 353, 26414, 29889, 326, 18505, 29889, 24192, 9555, 580, 13, 4706, 878, 353, 2411, 29889, 5215, 4591, 9170, 29898, 1181, 22872, 29892, 525, 2423, 29920, 1495, 13, 4706, 4974, 988, 297, 10876, 29889, 2084, 13, 4706, 396, 1321, 29920, 756, 385, 938, 336, 29899, 5113, 1053, 393, 6166, 1045, 397, 280, 13, 4706, 4974, 878, 29889, 833, 397, 280, 13, 13, 1678, 822, 1243, 29918, 5453, 29918, 1217, 29918, 1445, 29898, 1311, 1125, 13, 4706, 988, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 13, 462, 462, 632, 525, 5924, 8785, 13, 4706, 7953, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3062, 29892, 525, 5431, 1495, 13, 4706, 1701, 22872, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5431, 29892, 525, 1646, 1495, 13, 13, 4706, 396, 1554, 393, 29915, 29879, 451, 263, 1855, 3883, 322, 756, 694, 4770, 1445, 1649, 13, 4706, 10876, 29889, 7576, 1839, 2423, 29920, 2033, 353, 525, 8809, 5564, 29915, 13, 13, 4706, 2411, 353, 26414, 29889, 326, 18505, 29889, 24192, 9555, 580, 13, 4706, 878, 353, 2411, 29889, 5215, 4591, 9170, 29898, 1181, 22872, 29892, 525, 2423, 29920, 1495, 13, 4706, 4974, 988, 297, 10876, 29889, 2084, 13, 4706, 396, 1321, 29920, 756, 385, 938, 336, 29899, 5113, 1053, 393, 6166, 1045, 397, 280, 13, 4706, 4974, 878, 29889, 833, 397, 280, 13, 308, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
pomade/assertions.py
saucelabs/pomade
0
48968
from pprint import pformat import json import time import traceback import sys from config import SPIN_TIMEOUT class FailTestException(Exception): pass def spinAssert(msg, test, timeout=None, args=[]): timeout = timeout or SPIN_TIMEOUT name = getattr(test, '__name__', 'unknown') last_e = None for i in xrange(timeout): try: if not test(*args): raise AssertionError(msg) if i > 0: print msg, "success on %s (%s)" % (i + 1, name) break except FailTestException: raise except Exception, e: if (str(e), type(e)) != (str(last_e), type(last_e)): print msg, "(try: %s):" % (i + 1), str(e), type(e) traceback.print_exc(file=sys.stdout) last_e = e time.sleep(1) else: print "%s fail (%s tries) (%s)" % (msg, i + 1, name) raise AssertionError(msg) class PomadeAssertions(object): def _format(self, var): formatted_var = pformat(var) return formatted_var def assert_equal(self, first, second, message=None): self.assertEqual(first, second, message) def assert_not_equal(self, first, second, message=None): self.assertNotEqual(first, second, message) def assert_is_valid_json(self, filename): try: with open(filename) as fo: json.load(fo) except ValueError, e: self.fail(filename + " is not valid json (%s)" % e.message) def assert_less(self, first, second, message=None): message = (message if message else "%s not less than %s" % (first, second)) self.assertTrue(first < second, message) def assert_less_equal(self, first, second, message=None): message = (message if message else "%s not less than or equal to %s" % (first, second)) self.assertTrue(first <= second, message) def assert_greater(self, first, second, message=None): message = (message if message else "%s not greater than %s" % (first, second)) self.assertTrue(first > second, message) def assert_greater_equal(self, first, second, message=None): message = (message if message else "%s not greater than or equal to %s" % (first, second)) self.assertTrue(first >= second, message) def assert_none(self, item, message=None): message = (message if message else "%s should have been None" % pformat(item)) self.assertTrue(item is None, message) def assert_not_none(self, item, message=None): message = (message if message else "%s should not have been None" % pformat(item)) self.assertFalse(item is None, message) def assert_excepts(self, exception_type, func, *args, **kwargs): excepted = False try: val = func(*args, **kwargs) print ("assert_excepts: Crap. That wasn't supposed to work." " Here's what I got: ", pformat(val)) except exception_type, e: print ("assert_excepts: Okay, %s failed the way it was supposed" " to: %s" % (func, e)) excepted = True self.assertTrue(excepted, "assert_excepts: calling %s didn't raise %s" % (func, exception_type)) def assert_in(self, needle, haystack, message=None): return self.assert_contains(haystack, needle, message) def assert_not_in(self, needle, haystack, message=None): return self.assert_not_contains(haystack, needle, message) def assert_contains(self, haystack, needle, message=None): displaystack = self._format(haystack) message = (message if message else "%s not found in %s" % (needle, displaystack)) its_in_there = False try: if needle in haystack: its_in_there = True except: pass try: if not its_in_there and haystack in needle: print "! HEY !" * 5 print "HEY! it looks like you called assert_contains backwards" print "! HEY !" * 5 except: pass self.assertTrue(needle in haystack, message) def assert_any(self, conditions, message=None): message = (message if message else "%s were all False" % pformat(conditions)) self.assertTrue(any(conditions), message) def assert_not_any(self, conditions, message=None): message = (message if message else "%s was not all False" % pformat(conditions)) self.assertFalse(any(conditions), message) def assert_not_contains(self, haystack, needle, message=None): displaystack = self._format(haystack) message = (message if message else "%s not wanted but found in %s" % (needle, displaystack)) self.assertFalse(needle in haystack, message) def assert_startswith(self, haystack, needle, message=None): displaystack = self._format(haystack) message = (message if message else "%s should have been at the beginning of %s" % (needle, displaystack)) self.assertTrue(haystack.startswith(needle), message) def assert_endswith(self, haystack, needle, message=None): displaystack = self._format(haystack) message = (message if message else "%s should have been at the end of %s" % (needle, displaystack)) self.assertTrue(haystack.endswith(needle), message) def assert_not_startswith(self, haystack, needle, message=None): displaystack = self._format(haystack) message = (message if message else "%s should not have been at the beginning of %s" % (needle, displaystack)) self.assertFalse(haystack.startswith(needle), message) def assert_is(self, expected, actual, message=None): message = message if message else "%s is not %s" % (expected, actual) self.assertTrue(expected is actual) def assert_is_not(self, expected, actual, message=None): message = message if message else "%s is %s" % (expected, actual) self.assertTrue(expected is not actual) def spinAssert(self, *args, **kwargs): return spinAssert(*args, **kwargs) class BasicAssertions(object): # PomadeAssertions depends on these basic assertions, which come with # unittest.TestCase but we don't want to subclass that here. So let's # just duplicate the functionality, sigh def assertTrue(self, test, msg=None): msg = msg or "%s was not true" % test assert test is True def assertEqual(self, obj1, obj2, msg=None): msg = msg or "%s != %s" % (obj1, obj2) assert obj1 == obj2, msg def assertFalse(self, test, msg): msg = msg or "%s was not false" % test assert test is False, msg def assertNotEqual(self, obj1, obj2, msg): msg = msg or "%s == %s" % (obj1, obj2) assert obj1 != obj2, msg
[ 1, 515, 282, 2158, 1053, 282, 4830, 13, 5215, 4390, 13, 5215, 931, 13, 5215, 9637, 1627, 13, 5215, 10876, 13, 3166, 2295, 1053, 10937, 1177, 29918, 15307, 12015, 13, 13, 13, 1990, 29098, 3057, 2451, 29898, 2451, 1125, 13, 1678, 1209, 13, 13, 13, 1753, 10917, 14697, 29898, 7645, 29892, 1243, 29892, 11815, 29922, 8516, 29892, 6389, 29922, 2636, 1125, 13, 1678, 11815, 353, 11815, 470, 10937, 1177, 29918, 15307, 12015, 13, 1678, 1024, 353, 679, 5552, 29898, 1688, 29892, 525, 1649, 978, 1649, 742, 525, 26690, 1495, 13, 1678, 1833, 29918, 29872, 353, 6213, 13, 1678, 363, 474, 297, 921, 3881, 29898, 15619, 1125, 13, 4706, 1018, 29901, 13, 9651, 565, 451, 1243, 10456, 5085, 1125, 13, 18884, 12020, 16499, 291, 2392, 29898, 7645, 29897, 13, 9651, 565, 474, 1405, 29871, 29900, 29901, 13, 18884, 1596, 10191, 29892, 376, 8698, 373, 1273, 29879, 313, 29995, 29879, 5513, 1273, 313, 29875, 718, 29871, 29896, 29892, 1024, 29897, 13, 9651, 2867, 13, 4706, 5174, 29098, 3057, 2451, 29901, 13, 9651, 12020, 13, 4706, 5174, 8960, 29892, 321, 29901, 13, 9651, 565, 313, 710, 29898, 29872, 511, 1134, 29898, 29872, 876, 2804, 313, 710, 29898, 4230, 29918, 29872, 511, 1134, 29898, 4230, 29918, 29872, 22164, 13, 18884, 1596, 10191, 29892, 18227, 2202, 29901, 1273, 29879, 1125, 29908, 1273, 313, 29875, 718, 29871, 29896, 511, 29871, 851, 29898, 29872, 511, 1134, 29898, 29872, 29897, 13, 18884, 9637, 1627, 29889, 2158, 29918, 735, 29883, 29898, 1445, 29922, 9675, 29889, 25393, 29897, 13, 9651, 1833, 29918, 29872, 353, 321, 13, 4706, 931, 29889, 17059, 29898, 29896, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 11860, 29879, 4418, 313, 29995, 29879, 14335, 29897, 313, 29995, 29879, 5513, 1273, 313, 7645, 29892, 474, 718, 29871, 29896, 29892, 1024, 29897, 13, 4706, 12020, 16499, 291, 2392, 29898, 7645, 29897, 13, 13, 13, 1990, 14351, 1943, 14697, 1080, 29898, 3318, 1125, 13, 13, 1678, 822, 903, 4830, 29898, 1311, 29892, 722, 1125, 13, 4706, 20917, 29918, 1707, 353, 282, 4830, 29898, 1707, 29897, 13, 4706, 736, 20917, 29918, 1707, 13, 13, 1678, 822, 4974, 29918, 11745, 29898, 1311, 29892, 937, 29892, 1473, 29892, 2643, 29922, 8516, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 4102, 29892, 1473, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1333, 29918, 11745, 29898, 1311, 29892, 937, 29892, 1473, 29892, 2643, 29922, 8516, 1125, 13, 4706, 1583, 29889, 9294, 3664, 9843, 29898, 4102, 29892, 1473, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 275, 29918, 3084, 29918, 3126, 29898, 1311, 29892, 10422, 1125, 13, 4706, 1018, 29901, 13, 9651, 411, 1722, 29898, 9507, 29897, 408, 1701, 29901, 13, 18884, 4390, 29889, 1359, 29898, 1181, 29897, 13, 4706, 5174, 7865, 2392, 29892, 321, 29901, 13, 9651, 1583, 29889, 14057, 29898, 9507, 718, 376, 338, 451, 2854, 4390, 313, 29995, 29879, 5513, 1273, 321, 29889, 4906, 29897, 13, 13, 1678, 822, 4974, 29918, 2222, 29898, 1311, 29892, 937, 29892, 1473, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 451, 3109, 1135, 1273, 29879, 29908, 1273, 313, 4102, 29892, 1473, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 4102, 529, 1473, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 2222, 29918, 11745, 29898, 1311, 29892, 937, 29892, 1473, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 451, 3109, 1135, 470, 5186, 304, 1273, 29879, 29908, 1273, 313, 4102, 29892, 1473, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 4102, 5277, 1473, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 7979, 1008, 29898, 1311, 29892, 937, 29892, 1473, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 451, 7621, 1135, 1273, 29879, 29908, 1273, 313, 4102, 29892, 1473, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 4102, 1405, 1473, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 7979, 1008, 29918, 11745, 29898, 1311, 29892, 937, 29892, 1473, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 451, 7621, 1135, 470, 5186, 304, 1273, 29879, 29908, 1273, 313, 4102, 29892, 1473, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 4102, 6736, 1473, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 9290, 29898, 1311, 29892, 2944, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 881, 505, 1063, 6213, 29908, 1273, 282, 4830, 29898, 667, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 667, 338, 6213, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1333, 29918, 9290, 29898, 1311, 29892, 2944, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 881, 451, 505, 1063, 6213, 29908, 1273, 282, 4830, 29898, 667, 876, 13, 4706, 1583, 29889, 9294, 8824, 29898, 667, 338, 6213, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 19499, 29879, 29898, 1311, 29892, 3682, 29918, 1853, 29892, 3653, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 5174, 287, 353, 7700, 13, 4706, 1018, 29901, 13, 9651, 659, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 9651, 1596, 4852, 9294, 29918, 19499, 29879, 29901, 315, 2390, 29889, 2193, 9007, 29915, 29873, 7424, 304, 664, 1213, 13, 18884, 376, 2266, 29915, 29879, 825, 306, 2355, 29901, 9162, 282, 4830, 29898, 791, 876, 13, 4706, 5174, 3682, 29918, 1853, 29892, 321, 29901, 13, 9651, 1596, 4852, 9294, 29918, 19499, 29879, 29901, 20419, 29892, 1273, 29879, 5229, 278, 982, 372, 471, 7424, 29908, 13, 18884, 376, 304, 29901, 1273, 29879, 29908, 1273, 313, 9891, 29892, 321, 876, 13, 9651, 5174, 287, 353, 5852, 13, 4706, 1583, 29889, 9294, 5574, 29898, 19499, 287, 29892, 376, 9294, 29918, 19499, 29879, 29901, 5432, 1273, 29879, 3282, 29915, 29873, 12020, 1273, 29879, 29908, 13, 9651, 1273, 313, 9891, 29892, 3682, 29918, 1853, 876, 13, 13, 1678, 822, 4974, 29918, 262, 29898, 1311, 29892, 817, 280, 29892, 14842, 1429, 29892, 2643, 29922, 8516, 1125, 13, 4706, 736, 1583, 29889, 9294, 29918, 11516, 29898, 29882, 388, 1429, 29892, 817, 280, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1333, 29918, 262, 29898, 1311, 29892, 817, 280, 29892, 14842, 1429, 29892, 2643, 29922, 8516, 1125, 13, 4706, 736, 1583, 29889, 9294, 29918, 1333, 29918, 11516, 29898, 29882, 388, 1429, 29892, 817, 280, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 11516, 29898, 1311, 29892, 14842, 1429, 29892, 817, 280, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2479, 1429, 353, 1583, 3032, 4830, 29898, 29882, 388, 1429, 29897, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 451, 1476, 297, 1273, 29879, 29908, 1273, 313, 26180, 280, 29892, 2479, 1429, 876, 13, 13, 4706, 967, 29918, 262, 29918, 12711, 353, 7700, 13, 4706, 1018, 29901, 13, 9651, 565, 817, 280, 297, 14842, 1429, 29901, 13, 18884, 967, 29918, 262, 29918, 12711, 353, 5852, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 13, 4706, 1018, 29901, 13, 9651, 565, 451, 967, 29918, 262, 29918, 12711, 322, 14842, 1429, 297, 817, 280, 29901, 13, 18884, 1596, 376, 29991, 379, 13282, 1738, 29908, 334, 29871, 29945, 13, 18884, 1596, 376, 9606, 29979, 29991, 372, 3430, 763, 366, 2000, 4974, 29918, 11516, 28953, 29908, 13, 18884, 1596, 376, 29991, 379, 13282, 1738, 29908, 334, 29871, 29945, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 26180, 280, 297, 14842, 1429, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1384, 29898, 1311, 29892, 5855, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 892, 599, 7700, 29908, 1273, 282, 4830, 29898, 1116, 2187, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1384, 29898, 1116, 2187, 511, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1333, 29918, 1384, 29898, 1311, 29892, 5855, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 471, 451, 599, 7700, 29908, 1273, 282, 4830, 29898, 1116, 2187, 876, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1384, 29898, 1116, 2187, 511, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1333, 29918, 11516, 29898, 1311, 29892, 14842, 1429, 29892, 817, 280, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2479, 1429, 353, 1583, 3032, 4830, 29898, 29882, 388, 1429, 29897, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 451, 5131, 541, 1476, 297, 1273, 29879, 29908, 1273, 313, 26180, 280, 29892, 2479, 1429, 876, 13, 4706, 1583, 29889, 9294, 8824, 29898, 26180, 280, 297, 14842, 1429, 29892, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 27382, 2541, 29898, 1311, 29892, 14842, 1429, 29892, 817, 280, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2479, 1429, 353, 1583, 3032, 4830, 29898, 29882, 388, 1429, 29897, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 881, 505, 1063, 472, 278, 6763, 310, 1273, 29879, 29908, 13, 9651, 1273, 313, 26180, 280, 29892, 2479, 1429, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29882, 388, 1429, 29889, 27382, 2541, 29898, 26180, 280, 511, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1975, 2541, 29898, 1311, 29892, 14842, 1429, 29892, 817, 280, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2479, 1429, 353, 1583, 3032, 4830, 29898, 29882, 388, 1429, 29897, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 881, 505, 1063, 472, 278, 1095, 310, 1273, 29879, 29908, 13, 9651, 1273, 313, 26180, 280, 29892, 2479, 1429, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29882, 388, 1429, 29889, 1975, 2541, 29898, 26180, 280, 511, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 1333, 29918, 27382, 2541, 29898, 1311, 29892, 14842, 1429, 29892, 817, 280, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2479, 1429, 353, 1583, 3032, 4830, 29898, 29882, 388, 1429, 29897, 13, 4706, 2643, 353, 313, 4906, 565, 2643, 13, 9651, 1683, 11860, 29879, 881, 451, 505, 1063, 472, 278, 6763, 310, 1273, 29879, 29908, 13, 9651, 1273, 313, 26180, 280, 29892, 2479, 1429, 876, 13, 4706, 1583, 29889, 9294, 8824, 29898, 29882, 388, 1429, 29889, 27382, 2541, 29898, 26180, 280, 511, 2643, 29897, 13, 13, 1678, 822, 4974, 29918, 275, 29898, 1311, 29892, 3806, 29892, 3935, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 2643, 565, 2643, 1683, 11860, 29879, 338, 451, 1273, 29879, 29908, 1273, 313, 9684, 29892, 3935, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9684, 338, 3935, 29897, 13, 13, 1678, 822, 4974, 29918, 275, 29918, 1333, 29898, 1311, 29892, 3806, 29892, 3935, 29892, 2643, 29922, 8516, 1125, 13, 4706, 2643, 353, 2643, 565, 2643, 1683, 11860, 29879, 338, 1273, 29879, 29908, 1273, 313, 9684, 29892, 3935, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9684, 338, 451, 3935, 29897, 13, 13, 1678, 822, 10917, 14697, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 736, 10917, 14697, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 13, 1990, 19219, 14697, 1080, 29898, 3318, 1125, 13, 1678, 396, 14351, 1943, 14697, 1080, 7111, 373, 1438, 6996, 4974, 1080, 29892, 607, 2041, 411, 13, 1678, 396, 443, 27958, 29889, 3057, 8259, 541, 591, 1016, 29915, 29873, 864, 304, 19481, 393, 1244, 29889, 1105, 1235, 29915, 29879, 13, 1678, 396, 925, 7929, 278, 9863, 29892, 269, 1141, 13, 1678, 822, 4974, 5574, 29898, 1311, 29892, 1243, 29892, 10191, 29922, 8516, 1125, 13, 4706, 10191, 353, 10191, 470, 11860, 29879, 471, 451, 1565, 29908, 1273, 1243, 13, 4706, 4974, 1243, 338, 5852, 13, 13, 1678, 822, 4974, 9843, 29898, 1311, 29892, 5446, 29896, 29892, 5446, 29906, 29892, 10191, 29922, 8516, 1125, 13, 4706, 10191, 353, 10191, 470, 11860, 29879, 2804, 1273, 29879, 29908, 1273, 313, 5415, 29896, 29892, 5446, 29906, 29897, 13, 4706, 4974, 5446, 29896, 1275, 5446, 29906, 29892, 10191, 13, 13, 1678, 822, 4974, 8824, 29898, 1311, 29892, 1243, 29892, 10191, 1125, 13, 4706, 10191, 353, 10191, 470, 11860, 29879, 471, 451, 2089, 29908, 1273, 1243, 13, 4706, 4974, 1243, 338, 7700, 29892, 10191, 13, 13, 1678, 822, 4974, 3664, 9843, 29898, 1311, 29892, 5446, 29896, 29892, 5446, 29906, 29892, 10191, 1125, 13, 4706, 10191, 353, 10191, 470, 11860, 29879, 1275, 1273, 29879, 29908, 1273, 313, 5415, 29896, 29892, 5446, 29906, 29897, 13, 4706, 4974, 5446, 29896, 2804, 5446, 29906, 29892, 10191, 2 ]
exercise-05/programming_assignment/rbf.py
AleRiccardi/technical-neural-network-course
0
115963
import random from abc import abstractmethod import math from sklearn.cluster import KMeans import numpy as np import matplotlib.pyplot as plt def euclidian_distance(a, b): """ Calculating Euclidian distance between 2 vectors :param a: 1st vector :param b: 2nd vector :return: """ assert len(a) == len(b) d = 0 for feature in range(len(a)): d += (a[feature] - b[feature]) ** 2 return d ** 0.5 class Network(object): """ Radial Basis Function network """ def __init__(self, num_rbf, epochs=50, seed=999): """ Initialize the network """ np.random.seed(seed) self.X = None self.y = None self.num_rbf = num_rbf self.errors_train = [] self.errors_val = [] self.rbf_layer = None self.output_layer = None self.epochs = epochs def fit(self, X_train, y_train, X_val, y_val): self.rbf_layer = RBFlayer(self.num_rbf, X.shape[1]) self.output_layer = OutLayer(self.num_rbf, y.shape[1]) self.rbf_layer.find_centers(X) self.rbf_layer.find_sizes() # loop per every epochs and pattern for ep in range(1, self.epochs + 1): errors_train = [] for pattern, teacher in zip(X_train, y_train): # rbf layer R_vect = self.rbf_layer.forward(pattern) output = self.output_layer.forward(R_vect) self.output_layer.adjust_weights(teacher) loss = self.mean_squared_error(teacher, output) errors_train.append(loss) self.errors_train.append(sum(errors_train) / len(errors_train)) # validation errors_val = [] for pattern, teacher in zip(X_val, y_val): R_vect = self.rbf_layer.forward(pattern) output = self.output_layer.forward(R_vect) loss = self.mean_squared_error(teacher, output) errors_val.append(loss) self.errors_val.append(sum(errors_val) / len(errors_val)) print('Epoch ({})\t||\ttrain loss: {:.4f}\t||\tval loss: {:.4f}'.format(ep, self.errors_train[-1], self.errors_val[-1])) self.save_errors() @staticmethod def mean_squared_error(teacher, output): error = np.sum((teacher - output) ** 2) return error def predict(self, X): outputs = [] for pattern in X: # forward computation R_vect = self.rbf_layer.forward(pattern) output = self.output_layer.forward(R_vect) outputs.append(output) return np.array(outputs) def save_errors(self): f = open('learning.curve', 'w') print('#\tX\tY', file=f) for x, y in enumerate(self.errors_val): print('\t{}\t{}'.format(x, y), file=f) f.close() class RBFlayer: def __init__(self, num_neurons, len_input, closest_percent=0.1): self.centers = np.zeros((num_neurons, len_input)) self.sizes = np.zeros((num_neurons,)) self.num_neurons = num_neurons self.distances_matrix = np.zeros((num_neurons, num_neurons)) # how many closest centers to consider for each center # when computing its radius self.closest_percent = closest_percent def find_centers(self, all_inputs): """ Sets self.centers with centers found with K-means clustering algorithm the number of centers is the number of neurons. :param all_inputs: :return: """ # find center vectors with Kmeans clustering method kmeans = KMeans(n_clusters=self.num_neurons) kmeans.fit(all_inputs) self.centers = kmeans.cluster_centers_ def find_sizes(self): # fill in distance matrix for i in range(self.num_neurons): for j in range(i + 1, self.num_neurons): if i == j: self.distances_matrix[i, j] = 0 else: a = self.centers[i, :] b = self.centers[j, :] dist = euclidian_distance(a, b) self.distances_matrix[i, j] = dist self.distances_matrix[j, i] = dist # set size for each center to the mean of the distances # to 'closest_percent' of the closest centers num_closest = math.ceil(self.num_neurons * self.closest_percent) # sorting each row of the distance matrix sorted_distances = np.sort(self.distances_matrix) for i, c in enumerate(self.centers): # and taking 'num_closest' distances starting from the second one # because first is 0 distance between a center and itself self.sizes[i] = np.mean(sorted_distances[i, 1:num_closest + 1]) def forward(self, X): """ calculate the output of the RBF layer :param X: input pattern :return: """ distances = [] # get distances from centers for i in range(self.num_neurons): distances.append(euclidian_distance(self.centers[i], X)) # apply the rest of the formula distances = np.array([distances], dtype=float) distances /= 2 * np.square(self.sizes) distances = np.exp(-distances) return distances class OutLayer: def __init__(self, n_rbf, n_outputs, learning_rate=0.01): self.net = None self.out_rbf = None self.output = None self.sigma = None # initialize weights randomly self.weights = np.random.uniform(-.5, .5, size=(n_rbf, n_outputs)) self.learning_rate = learning_rate def forward(self, R): """ Forward propagation. :param X: :return: """ self.out_rbf = R self.output = np.dot(R, self.weights) return self.output def adjust_weights(self, teacher): out_sub = (teacher - self.output) # calculate weight changes with delta rule delta = self.learning_rate * np.dot(self.out_rbf.T, out_sub) # apply weight changes self.weights += delta def read_dat(name): """Read data from file. """ X = [] y = [] with open(name) as f: for line in f: if line.startswith('# P'): # second line # P=350 N=2 M=1 splits = line.split(' ') N = int(splits[1][2:]) M = int(splits[2][2:]) continue elif line[0] == '#': continue line = line.strip() elements = line.split(' ') if '' in elements: elements = list(filter(''.__ne__, elements)) X.append(elements[:N]) y.append(elements[N:N + M]) X = np.array(X).astype(np.float) y = np.array(y).astype(np.float) return X, y def train_test_split(X, y, split=0.75): assert X.shape[0] == y.shape[0] size = X.shape[0] sep = int(split * size) for i in range(size): j = random.randint(0, size - 1) x_tmp = X[i, :] X[i, :] = X[j, :] X[j, :] = x_tmp y_tmp = y[i, :] y[i, :] = y[j, :] y[j, :] = y_tmp return X[:sep, :], y[:sep, :], X[sep:, :], y[sep:, :] if __name__ == "__main__": # read dataset X, y = read_dat('PA-B-train-04.dat') # take 'split' percent of the data # and further split it to train and validation samples X_train, y_train, X_val, y_val = train_test_split(X, y, split=.8) # initialize the network net = Network(num_rbf=100, epochs=60, seed=7) # train and validate each epoch net.fit(X_train, y_train, X_val, y_val) # test the network by predicting output from the unseen data print('Test prediction:') prediction = net.predict(X_val) # print predicted and true values side bt side for i, (y_pred, y_val) in enumerate(zip(prediction, y_val)): print('Pattern ({}) || prediction: {:.5f}, actual value: {:.5f}'.format(i, y_pred[0, 0], y_val[0])) # plot errors for training and validation plt.plot(net.errors_train) plt.plot(net.errors_val) plt.ylabel('Loss') plt.xlabel('Epochs') plt.show()
[ 1, 1053, 4036, 13, 3166, 25638, 1053, 9846, 5696, 13, 5215, 5844, 13, 13, 3166, 2071, 19668, 29889, 19594, 1053, 476, 6816, 550, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 13, 1753, 11878, 695, 333, 713, 29918, 19244, 29898, 29874, 29892, 289, 1125, 13, 1678, 9995, 13, 1678, 20535, 1218, 16430, 695, 333, 713, 5418, 1546, 29871, 29906, 12047, 13, 1678, 584, 3207, 263, 29901, 29871, 29896, 303, 4608, 13, 1678, 584, 3207, 289, 29901, 29871, 29906, 299, 4608, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 4974, 7431, 29898, 29874, 29897, 1275, 7431, 29898, 29890, 29897, 13, 1678, 270, 353, 29871, 29900, 13, 1678, 363, 4682, 297, 3464, 29898, 2435, 29898, 29874, 22164, 13, 4706, 270, 4619, 313, 29874, 29961, 14394, 29962, 448, 289, 29961, 14394, 2314, 3579, 29871, 29906, 13, 13, 1678, 736, 270, 3579, 29871, 29900, 29889, 29945, 13, 13, 13, 1990, 8527, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 4957, 616, 4886, 275, 6680, 3564, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 954, 29918, 29878, 1635, 29892, 21502, 12168, 29922, 29945, 29900, 29892, 16717, 29922, 29929, 29929, 29929, 1125, 13, 4706, 9995, 13, 4706, 25455, 278, 3564, 13, 4706, 9995, 13, 4706, 7442, 29889, 8172, 29889, 26776, 29898, 26776, 29897, 13, 13, 4706, 1583, 29889, 29990, 353, 6213, 13, 4706, 1583, 29889, 29891, 353, 6213, 13, 4706, 1583, 29889, 1949, 29918, 29878, 1635, 353, 954, 29918, 29878, 1635, 13, 4706, 1583, 29889, 12523, 29918, 14968, 353, 5159, 13, 4706, 1583, 29889, 12523, 29918, 791, 353, 5159, 13, 4706, 1583, 29889, 29878, 1635, 29918, 13148, 353, 6213, 13, 4706, 1583, 29889, 4905, 29918, 13148, 353, 6213, 13, 4706, 1583, 29889, 1022, 2878, 29879, 353, 21502, 12168, 13, 13, 1678, 822, 6216, 29898, 1311, 29892, 1060, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 791, 29892, 343, 29918, 791, 1125, 13, 4706, 1583, 29889, 29878, 1635, 29918, 13148, 353, 390, 29933, 8754, 2747, 29898, 1311, 29889, 1949, 29918, 29878, 1635, 29892, 1060, 29889, 12181, 29961, 29896, 2314, 13, 4706, 1583, 29889, 4905, 29918, 13148, 353, 4451, 14420, 29898, 1311, 29889, 1949, 29918, 29878, 1635, 29892, 343, 29889, 12181, 29961, 29896, 2314, 13, 13, 4706, 1583, 29889, 29878, 1635, 29918, 13148, 29889, 2886, 29918, 1760, 414, 29898, 29990, 29897, 13, 4706, 1583, 29889, 29878, 1635, 29918, 13148, 29889, 2886, 29918, 29879, 7093, 580, 13, 4706, 396, 2425, 639, 1432, 21502, 12168, 322, 4766, 13, 4706, 363, 9358, 297, 3464, 29898, 29896, 29892, 1583, 29889, 1022, 2878, 29879, 718, 29871, 29896, 1125, 13, 9651, 4436, 29918, 14968, 353, 5159, 13, 9651, 363, 4766, 29892, 15703, 297, 14319, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 1125, 13, 18884, 396, 364, 1635, 7546, 13, 18884, 390, 29918, 345, 312, 353, 1583, 29889, 29878, 1635, 29918, 13148, 29889, 11333, 29898, 11037, 29897, 13, 18884, 1962, 353, 1583, 29889, 4905, 29918, 13148, 29889, 11333, 29898, 29934, 29918, 345, 312, 29897, 13, 18884, 1583, 29889, 4905, 29918, 13148, 29889, 328, 5143, 29918, 705, 5861, 29898, 371, 11665, 29897, 13, 18884, 6410, 353, 1583, 29889, 12676, 29918, 26613, 1965, 29918, 2704, 29898, 371, 11665, 29892, 1962, 29897, 13, 18884, 4436, 29918, 14968, 29889, 4397, 29898, 6758, 29897, 13, 9651, 1583, 29889, 12523, 29918, 14968, 29889, 4397, 29898, 2083, 29898, 12523, 29918, 14968, 29897, 847, 7431, 29898, 12523, 29918, 14968, 876, 13, 13, 9651, 396, 8845, 13, 9651, 4436, 29918, 791, 353, 5159, 13, 9651, 363, 4766, 29892, 15703, 297, 14319, 29898, 29990, 29918, 791, 29892, 343, 29918, 791, 1125, 13, 18884, 390, 29918, 345, 312, 353, 1583, 29889, 29878, 1635, 29918, 13148, 29889, 11333, 29898, 11037, 29897, 13, 18884, 1962, 353, 1583, 29889, 4905, 29918, 13148, 29889, 11333, 29898, 29934, 29918, 345, 312, 29897, 13, 18884, 6410, 353, 1583, 29889, 12676, 29918, 26613, 1965, 29918, 2704, 29898, 371, 11665, 29892, 1962, 29897, 13, 18884, 4436, 29918, 791, 29889, 4397, 29898, 6758, 29897, 13, 9651, 1583, 29889, 12523, 29918, 791, 29889, 4397, 29898, 2083, 29898, 12523, 29918, 791, 29897, 847, 7431, 29898, 12523, 29918, 791, 876, 13, 13, 9651, 1596, 877, 29923, 1129, 305, 21313, 11606, 29873, 29989, 4295, 698, 6038, 6410, 29901, 12365, 29889, 29946, 29888, 1012, 29873, 29989, 4295, 29873, 791, 6410, 29901, 12365, 29889, 29946, 29888, 29913, 4286, 4830, 29898, 1022, 29892, 1583, 29889, 12523, 29918, 14968, 14352, 29896, 1402, 13, 462, 462, 462, 462, 462, 1678, 1583, 29889, 12523, 29918, 791, 14352, 29896, 12622, 13, 4706, 1583, 29889, 7620, 29918, 12523, 580, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2099, 29918, 26613, 1965, 29918, 2704, 29898, 371, 11665, 29892, 1962, 1125, 13, 4706, 1059, 353, 7442, 29889, 2083, 3552, 371, 11665, 448, 1962, 29897, 3579, 29871, 29906, 29897, 13, 4706, 736, 1059, 13, 13, 1678, 822, 8500, 29898, 1311, 29892, 1060, 1125, 13, 4706, 14391, 353, 5159, 13, 4706, 363, 4766, 297, 1060, 29901, 13, 9651, 396, 6375, 16287, 13, 9651, 390, 29918, 345, 312, 353, 1583, 29889, 29878, 1635, 29918, 13148, 29889, 11333, 29898, 11037, 29897, 13, 9651, 1962, 353, 1583, 29889, 4905, 29918, 13148, 29889, 11333, 29898, 29934, 29918, 345, 312, 29897, 13, 13, 9651, 14391, 29889, 4397, 29898, 4905, 29897, 13, 4706, 736, 7442, 29889, 2378, 29898, 4905, 29879, 29897, 13, 13, 1678, 822, 4078, 29918, 12523, 29898, 1311, 1125, 13, 4706, 285, 353, 1722, 877, 21891, 29889, 2764, 345, 742, 525, 29893, 1495, 13, 4706, 1596, 14237, 29905, 29873, 29990, 29905, 29873, 29979, 742, 934, 29922, 29888, 29897, 13, 4706, 363, 921, 29892, 343, 297, 26985, 29898, 1311, 29889, 12523, 29918, 791, 1125, 13, 9651, 1596, 28909, 29873, 29912, 1012, 29873, 8875, 4286, 4830, 29898, 29916, 29892, 343, 511, 934, 29922, 29888, 29897, 13, 4706, 285, 29889, 5358, 580, 13, 13, 13, 1990, 390, 29933, 8754, 2747, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 954, 29918, 16115, 787, 29892, 7431, 29918, 2080, 29892, 21438, 29918, 25376, 29922, 29900, 29889, 29896, 1125, 13, 4706, 1583, 29889, 1760, 414, 353, 7442, 29889, 3298, 359, 3552, 1949, 29918, 16115, 787, 29892, 7431, 29918, 2080, 876, 13, 4706, 1583, 29889, 29879, 7093, 353, 7442, 29889, 3298, 359, 3552, 1949, 29918, 16115, 787, 29892, 876, 13, 4706, 1583, 29889, 1949, 29918, 16115, 787, 353, 954, 29918, 16115, 787, 13, 4706, 1583, 29889, 5721, 2925, 29918, 5344, 353, 7442, 29889, 3298, 359, 3552, 1949, 29918, 16115, 787, 29892, 954, 29918, 16115, 787, 876, 13, 4706, 396, 920, 1784, 21438, 1644, 414, 304, 2050, 363, 1269, 4818, 13, 4706, 396, 746, 20602, 967, 11855, 13, 4706, 1583, 29889, 11291, 342, 29918, 25376, 353, 21438, 29918, 25376, 13, 13, 1678, 822, 1284, 29918, 1760, 414, 29898, 1311, 29892, 599, 29918, 2080, 29879, 1125, 13, 4706, 9995, 13, 4706, 317, 1691, 1583, 29889, 1760, 414, 411, 1644, 414, 1476, 411, 476, 29899, 1004, 550, 16993, 3241, 5687, 13, 4706, 278, 1353, 310, 1644, 414, 338, 278, 1353, 310, 26808, 787, 29889, 13, 4706, 584, 3207, 599, 29918, 2080, 29879, 29901, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 396, 1284, 4818, 12047, 411, 476, 1004, 550, 16993, 3241, 1158, 13, 4706, 413, 1004, 550, 353, 476, 6816, 550, 29898, 29876, 29918, 695, 504, 414, 29922, 1311, 29889, 1949, 29918, 16115, 787, 29897, 13, 4706, 413, 1004, 550, 29889, 9202, 29898, 497, 29918, 2080, 29879, 29897, 13, 4706, 1583, 29889, 1760, 414, 353, 413, 1004, 550, 29889, 19594, 29918, 1760, 414, 29918, 13, 13, 1678, 822, 1284, 29918, 29879, 7093, 29898, 1311, 1125, 13, 4706, 396, 5445, 297, 5418, 4636, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 1949, 29918, 16115, 787, 1125, 13, 9651, 363, 432, 297, 3464, 29898, 29875, 718, 29871, 29896, 29892, 1583, 29889, 1949, 29918, 16115, 787, 1125, 13, 18884, 565, 474, 1275, 432, 29901, 13, 462, 1678, 1583, 29889, 5721, 2925, 29918, 5344, 29961, 29875, 29892, 432, 29962, 353, 29871, 29900, 13, 18884, 1683, 29901, 13, 462, 1678, 263, 353, 1583, 29889, 1760, 414, 29961, 29875, 29892, 584, 29962, 13, 462, 1678, 289, 353, 1583, 29889, 1760, 414, 29961, 29926, 29892, 584, 29962, 13, 462, 1678, 1320, 353, 11878, 695, 333, 713, 29918, 19244, 29898, 29874, 29892, 289, 29897, 13, 462, 1678, 1583, 29889, 5721, 2925, 29918, 5344, 29961, 29875, 29892, 432, 29962, 353, 1320, 13, 462, 1678, 1583, 29889, 5721, 2925, 29918, 5344, 29961, 29926, 29892, 474, 29962, 353, 1320, 13, 13, 4706, 396, 731, 2159, 363, 1269, 4818, 304, 278, 2099, 310, 278, 24610, 13, 4706, 396, 304, 525, 11291, 342, 29918, 25376, 29915, 310, 278, 21438, 1644, 414, 13, 4706, 954, 29918, 11291, 342, 353, 5844, 29889, 27696, 29898, 1311, 29889, 1949, 29918, 16115, 787, 334, 1583, 29889, 11291, 342, 29918, 25376, 29897, 13, 4706, 396, 16548, 1269, 1948, 310, 278, 5418, 4636, 13, 4706, 12705, 29918, 5721, 2925, 353, 7442, 29889, 6605, 29898, 1311, 29889, 5721, 2925, 29918, 5344, 29897, 13, 4706, 363, 474, 29892, 274, 297, 26985, 29898, 1311, 29889, 1760, 414, 1125, 13, 9651, 396, 322, 5622, 525, 1949, 29918, 11291, 342, 29915, 24610, 6257, 515, 278, 1473, 697, 13, 9651, 396, 1363, 937, 338, 29871, 29900, 5418, 1546, 263, 4818, 322, 3528, 13, 9651, 1583, 29889, 29879, 7093, 29961, 29875, 29962, 353, 7442, 29889, 12676, 29898, 24582, 29918, 5721, 2925, 29961, 29875, 29892, 29871, 29896, 29901, 1949, 29918, 11291, 342, 718, 29871, 29896, 2314, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 1060, 1125, 13, 4706, 9995, 13, 4706, 8147, 278, 1962, 310, 278, 390, 28062, 7546, 13, 4706, 584, 3207, 1060, 29901, 1881, 4766, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 24610, 353, 5159, 13, 4706, 396, 679, 24610, 515, 1644, 414, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 1949, 29918, 16115, 787, 1125, 13, 9651, 24610, 29889, 4397, 29898, 12932, 695, 333, 713, 29918, 19244, 29898, 1311, 29889, 1760, 414, 29961, 29875, 1402, 1060, 876, 13, 13, 4706, 396, 3394, 278, 1791, 310, 278, 7063, 13, 4706, 24610, 353, 7442, 29889, 2378, 4197, 5721, 2925, 1402, 26688, 29922, 7411, 29897, 13, 4706, 24610, 847, 29922, 29871, 29906, 334, 7442, 29889, 17619, 29898, 1311, 29889, 29879, 7093, 29897, 13, 4706, 24610, 353, 7442, 29889, 4548, 6278, 5721, 2925, 29897, 13, 4706, 736, 24610, 13, 13, 13, 1990, 4451, 14420, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 302, 29918, 29878, 1635, 29892, 13, 462, 302, 29918, 4905, 29879, 29892, 13, 462, 6509, 29918, 10492, 29922, 29900, 29889, 29900, 29896, 1125, 13, 4706, 1583, 29889, 1212, 353, 6213, 13, 4706, 1583, 29889, 449, 29918, 29878, 1635, 353, 6213, 13, 4706, 1583, 29889, 4905, 353, 6213, 13, 4706, 1583, 29889, 3754, 353, 6213, 13, 4706, 396, 11905, 18177, 20459, 13, 4706, 1583, 29889, 705, 5861, 353, 7442, 29889, 8172, 29889, 29590, 6278, 29889, 29945, 29892, 869, 29945, 29892, 2159, 7607, 29876, 29918, 29878, 1635, 29892, 302, 29918, 4905, 29879, 876, 13, 4706, 1583, 29889, 21891, 29918, 10492, 353, 6509, 29918, 10492, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 390, 1125, 13, 4706, 9995, 13, 4706, 1152, 1328, 13089, 362, 29889, 13, 4706, 584, 3207, 1060, 29901, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 1583, 29889, 449, 29918, 29878, 1635, 353, 390, 13, 4706, 1583, 29889, 4905, 353, 7442, 29889, 6333, 29898, 29934, 29892, 1583, 29889, 705, 5861, 29897, 13, 4706, 736, 1583, 29889, 4905, 13, 13, 1678, 822, 10365, 29918, 705, 5861, 29898, 1311, 29892, 15703, 1125, 13, 4706, 714, 29918, 1491, 353, 313, 371, 11665, 448, 1583, 29889, 4905, 29897, 13, 4706, 396, 8147, 7688, 3620, 411, 19471, 5751, 13, 4706, 19471, 353, 1583, 29889, 21891, 29918, 10492, 334, 7442, 29889, 6333, 29898, 1311, 29889, 449, 29918, 29878, 1635, 29889, 29911, 29892, 714, 29918, 1491, 29897, 13, 4706, 396, 3394, 7688, 3620, 13, 4706, 1583, 29889, 705, 5861, 4619, 19471, 13, 13, 13, 1753, 1303, 29918, 4130, 29898, 978, 1125, 13, 1678, 9995, 6359, 848, 515, 934, 29889, 13, 1678, 9995, 13, 1678, 1060, 353, 5159, 13, 1678, 343, 353, 5159, 13, 1678, 411, 1722, 29898, 978, 29897, 408, 285, 29901, 13, 4706, 363, 1196, 297, 285, 29901, 13, 9651, 565, 1196, 29889, 27382, 2541, 14237, 349, 29374, 13, 18884, 396, 1473, 1196, 13, 18884, 396, 349, 29922, 29941, 29945, 29900, 1678, 405, 29922, 29906, 1678, 341, 29922, 29896, 13, 18884, 8536, 1169, 353, 1196, 29889, 5451, 877, 1678, 25710, 13, 18884, 405, 353, 938, 29898, 23579, 1169, 29961, 29896, 3816, 29906, 29901, 2314, 13, 18884, 341, 353, 938, 29898, 23579, 1169, 29961, 29906, 3816, 29906, 29901, 2314, 13, 18884, 6773, 13, 9651, 25342, 1196, 29961, 29900, 29962, 1275, 16321, 2396, 13, 18884, 6773, 13, 9651, 1196, 353, 1196, 29889, 17010, 580, 13, 9651, 3161, 353, 1196, 29889, 5451, 877, 25710, 13, 9651, 565, 6629, 297, 3161, 29901, 13, 18884, 3161, 353, 1051, 29898, 4572, 877, 4286, 1649, 484, 1649, 29892, 3161, 876, 13, 9651, 1060, 29889, 4397, 29898, 17664, 7503, 29940, 2314, 13, 9651, 343, 29889, 4397, 29898, 17664, 29961, 29940, 29901, 29940, 718, 341, 2314, 13, 4706, 1060, 353, 7442, 29889, 2378, 29898, 29990, 467, 579, 668, 29898, 9302, 29889, 7411, 29897, 13, 4706, 343, 353, 7442, 29889, 2378, 29898, 29891, 467, 579, 668, 29898, 9302, 29889, 7411, 29897, 13, 13, 1678, 736, 1060, 29892, 343, 13, 13, 13, 1753, 7945, 29918, 1688, 29918, 5451, 29898, 29990, 29892, 343, 29892, 6219, 29922, 29900, 29889, 29955, 29945, 1125, 13, 1678, 4974, 1060, 29889, 12181, 29961, 29900, 29962, 1275, 343, 29889, 12181, 29961, 29900, 29962, 13, 1678, 2159, 353, 1060, 29889, 12181, 29961, 29900, 29962, 13, 1678, 16345, 353, 938, 29898, 5451, 334, 2159, 29897, 13, 13, 1678, 363, 474, 297, 3464, 29898, 2311, 1125, 13, 4706, 432, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 2159, 448, 29871, 29896, 29897, 13, 4706, 921, 29918, 7050, 353, 1060, 29961, 29875, 29892, 584, 29962, 13, 4706, 1060, 29961, 29875, 29892, 584, 29962, 353, 1060, 29961, 29926, 29892, 584, 29962, 13, 4706, 1060, 29961, 29926, 29892, 584, 29962, 353, 921, 29918, 7050, 13, 4706, 343, 29918, 7050, 353, 343, 29961, 29875, 29892, 584, 29962, 13, 4706, 343, 29961, 29875, 29892, 584, 29962, 353, 343, 29961, 29926, 29892, 584, 29962, 13, 4706, 343, 29961, 29926, 29892, 584, 29962, 353, 343, 29918, 7050, 13, 13, 1678, 736, 1060, 7503, 19570, 29892, 584, 1402, 343, 7503, 19570, 29892, 584, 1402, 1060, 29961, 19570, 29901, 29892, 584, 1402, 343, 29961, 19570, 29901, 29892, 584, 29962, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 1303, 8783, 13, 1678, 1060, 29892, 343, 353, 1303, 29918, 4130, 877, 7228, 29899, 29933, 29899, 14968, 29899, 29900, 29946, 29889, 4130, 1495, 13, 1678, 396, 2125, 525, 5451, 29915, 10151, 310, 278, 848, 13, 1678, 396, 322, 4340, 6219, 372, 304, 7945, 322, 8845, 11916, 13, 1678, 1060, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 791, 29892, 343, 29918, 791, 353, 7945, 29918, 1688, 29918, 5451, 29898, 29990, 29892, 343, 29892, 6219, 21098, 29947, 29897, 13, 13, 1678, 396, 11905, 278, 3564, 13, 1678, 7787, 353, 8527, 29898, 1949, 29918, 29878, 1635, 29922, 29896, 29900, 29900, 29892, 21502, 12168, 29922, 29953, 29900, 29892, 16717, 29922, 29955, 29897, 13, 1678, 396, 7945, 322, 12725, 1269, 21502, 305, 13, 1678, 7787, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 791, 29892, 343, 29918, 791, 29897, 13, 13, 1678, 396, 1243, 278, 3564, 491, 8500, 292, 1962, 515, 278, 443, 28026, 848, 13, 1678, 1596, 877, 3057, 18988, 29901, 1495, 13, 1678, 18988, 353, 7787, 29889, 27711, 29898, 29990, 29918, 791, 29897, 13, 1678, 396, 1596, 25383, 322, 1565, 1819, 2625, 289, 29873, 2625, 13, 1678, 363, 474, 29892, 313, 29891, 29918, 11965, 29892, 343, 29918, 791, 29897, 297, 26985, 29898, 7554, 29898, 11965, 2463, 29892, 343, 29918, 791, 22164, 13, 4706, 1596, 877, 17144, 21313, 1800, 3830, 18988, 29901, 12365, 29889, 29945, 29888, 1118, 3935, 995, 29901, 12365, 29889, 29945, 29888, 29913, 4286, 4830, 29898, 29875, 29892, 343, 29918, 11965, 29961, 29900, 29892, 29871, 29900, 1402, 343, 29918, 791, 29961, 29900, 12622, 13, 13, 1678, 396, 6492, 4436, 363, 6694, 322, 8845, 13, 1678, 14770, 29889, 5317, 29898, 1212, 29889, 12523, 29918, 14968, 29897, 13, 1678, 14770, 29889, 5317, 29898, 1212, 29889, 12523, 29918, 791, 29897, 13, 1678, 14770, 29889, 29891, 1643, 877, 29931, 2209, 1495, 13, 1678, 14770, 29889, 29916, 1643, 877, 29923, 1129, 12168, 1495, 13, 1678, 14770, 29889, 4294, 580, 13, 2 ]
OverlayUFOs/Overlay UFOs.roboFontExt/lib/OverlayUFOs.py
connordavenport/fbOpenTools
0
10383
#coding=utf-8 from __future__ import division """ # OVERLAY UFOS For anyone looking in here, sorry the code is so messy. This is a standalone version of a script with a lot of dependencies. """ import os from AppKit import * #@PydevCodeAnalysisIgnore from vanilla import * #@PydevCodeAnalysisIgnore from mojo.drawingTools import * from mojo.events import addObserver, removeObserver from mojo.extensions import getExtensionDefault, setExtensionDefault, getExtensionDefaultColor, setExtensionDefaultColor from mojo.UI import UpdateCurrentGlyphView from fontTools.pens.transformPen import TransformPen from defconAppKit.windows.baseWindow import BaseWindowController import unicodedata #from lib.tools.defaults import getDefaultColor from lib.tools.drawing import strokePixelPath from lib.UI.spaceCenter.glyphSequenceEditText import splitText from builtins import chr selectedSymbol = u'•' def SmallTextListCell(editable=False): cell = NSTextFieldCell.alloc().init() size = NSSmallControlSize #NSMiniControlSize cell.setControlSize_(size) font = NSFont.systemFontOfSize_(NSFont.systemFontSizeForControlSize_(size)) cell.setFont_(font) cell.setEditable_(editable) return cell class TX: """ An agnostic way to get a naked font. """ @classmethod def naked(cls, f): try: return f.naked() except: return f class Tool(): """ The tool object manages the font list. This is a simplification. """ fonts = AllFonts() def addObserver(self, target, method, action): addObserver(target, method, action) def removeObserver(self, target, method, action): removeObserver(target, method, action) def getCurrentFont(self): return CurrentFont() def getFonts(self): u"""Answers the list of selected fonts, ordered by their path. """ return self.fonts def appendToFonts(self, path): f = OpenFont(path, showUI=False) self.fonts.append(f) def removeFromFonts(self, path): for i, f in enumerate(self.fonts): if f.path == path: del self.fonts[i] def getFontPaths(self): return [f.path or str(f.info.familyName)+" "+str(f.info.styleName) for f in self.getFonts()] def getFontLabel(self, path): if path is None: return None if not path: return 'Untitled' name = path.split('/')[-1] status = selectedSymbol return status, path, name def getFontLabels(self): labels = {} for path in self.getFontPaths(): if path: label = self.getFontLabel(path) name = label[-1] else: name = 'Untitled' if not name in labels: labels[name] = [] labels[name].append(label) sortedLabels = [] for _, labelSet in sorted(labels.items()): if len(labelSet) == 1: # There is only a single font with this name sortedLabels.append(labelSet[0]) else: # Otherwise we'll have to construct new names to show the difference for status, path, name in sorted(labelSet): sortedLabels.append((status, path, '%s "%s"' % (name, '/'.join(path.split('/')[:-1])))) return sortedLabels class C: """ Some constants. """ C2 = 100 BUTTON_WIDTH = 80 STYLE_CHECKBOXSIZE = 'small' STYLE_LABELSIZE = 'small' STYLE_RADIOSIZE = 'small' L = 22 LL = 25 class OverlayUFOs(BaseWindowController): DEFAULTKEY = "com.fontbureau.overlayUFO" DEFAULTKEY_FILLCOLOR = "%s.fillColor" %DEFAULTKEY DEFAULTKEY_STROKECOLOR = "%s.strokeColor" %DEFAULTKEY DEFAULTKEY_STROKE = "%s.stroke" %DEFAULTKEY DEFAULTKEY_FILL = "%s.fill" %DEFAULTKEY FALLBACK_FILLCOLOR = NSColor.colorWithCalibratedRed_green_blue_alpha_(.5, 0, .5, .1) FALLBACK_STROKECOLOR = NSColor.colorWithCalibratedRed_green_blue_alpha_(.5, 0, .5, .5) VERSION = 1.0 NAME = u'Overlay UFOs' MANUAL = u"""In the current glyph window, this will present the view the same glyph from a separate UFO or set of UFOs.<br/> This does NOT import the UFO into a background layer. Instead, it renders a outline directly from the UFO into the glyph window view. <ul> <li>There is no need to import duplicate data into a background layer.</li> <li>The source outline is always live; when changes are made to the source, they will automatically appear in the current without re-importing.</li> <li>The source font does not need to be opened with a UI.</li> </ul> <h3>DIALOG</h3> <ul> <li>A floating dialog is present to let you open and select source fonts, fill, stroke, color.</li> <li>Source Fonts: The default source font list is self.getOpenFonts(). The refresh button will return this list to self.getOpenFonts().</li> <li>Adding Fonts: You can manually add fonts by selecting a UFO file. The UFO file will open without an interface.</li> <li>Removing Fonts: There are buttons for removing selected fonts and for clearing the source font list.</li> </ul> <h3>BUGS/IMPROVEMENTS</h3> <ul> <li>Known Issue: The source font is drawn on top of the current font, instead of behind it. So, it is good to select a color with a low opacity.</li> <li>Known Bug: If the glyph window for both source and current fonts are open, it is possible to select and inadvertently edit the source outline in the current window. I don't know how to solve this.</li> <li>Improvement?: Add options to scale the source font.</li> <li>Improvement?: Set different colors, fill settings for each font?</li> </ul> """ # Fixed width of the window. VIEWMINSIZE = 400 VIEWSIZE = VIEWMINSIZE VIEWMAXSIZE = VIEWMINSIZE WINDOW_POSSIZE = (130, 20, VIEWSIZE, 260) WINDOW_MINSIZE = (VIEWMINSIZE, 260) WINDOW_MAXSIZE = (VIEWMAXSIZE, 260) def getPathListDescriptor(self): return [ dict(title='Status', key='status', cell=SmallTextListCell(editable=False), width=12, editable=False), dict(title='Name', key='name', width=300, cell=SmallTextListCell(editable=False), editable=False), dict(title='Path', key='path', width=0, editable=False), ] ################ # OBSERVERS AND UPDATERS ################ def fontSelectionChanged(self): self.setSourceFonts() def activateModule(self): self.tool.addObserver(self, 'drawInactive', 'drawInactive') self.tool.addObserver(self, 'drawBackground', 'drawBackground') self.tool.addObserver(self, 'fontDidOpen', 'fontDidOpen') self.tool.addObserver(self, 'fontWillClose', 'fontWillClose') def deactivateModule(self): removeObserver(self, 'drawBackground') removeObserver(self, 'drawInactive') removeObserver(self, 'fontDidOpen') removeObserver(self, 'fontWillClose') ################ # CONTEXTS ################ def fontDidOpen(self, info): font = info.get('font') if font: self.tool.fonts.append(font) self.refreshCallback() def fontWillClose(self, info): font = info.get('font') path = font.path if path: self.tool.removeFromFonts(path) self.refreshCallback() def __init__(self): self.tool = Tool() self.w = FloatingWindow((400, 200), "Overlay UFOs", minSize=(400, 200)) self.populateView() self.getView().open() def getView(self): return self.w def refreshCallback(self, sender=None): """ Update the font list. """ self.getView().fontList.set(self.getFontItems()) def resetCallback(self, sender=None): """ Resets the view to the currently opened fonts. """ self.tool.fonts = AllFonts() self.getView().fontList.set(self.getFontItems()) def addCallback(self, sender=None): """ Open a font without UI and add it to the font list. """ f = OpenFont(None, showUI=False) if f is None: return self.tool.appendToFonts(f.path) self.refreshCallback() def populateView(self): """ The UI """ self.fillColor = getExtensionDefaultColor(self.DEFAULTKEY_FILLCOLOR, self.FALLBACK_FILLCOLOR) self.strokeColor = getExtensionDefaultColor(self.DEFAULTKEY_STROKECOLOR, self.FALLBACK_STROKECOLOR) self.contextBefore = self.contextAfter = '' # Populating the view can only happen after the view is attached to the window, # or else the relative widths go wrong. view = self.getView() view.add = Button((-40, 3, 30, 22), '+', callback=self.addCallback) view.reset = Button((-40, 30, 30, 22), chr(8634), callback=self.resetCallback) # Flag to see if the selection list click is in progress. We are resetting the selection # ourselves, using the list "buttons", but changing that selection will cause another # list update, that should be ignored. self._selectionChanging = False # Indicate that we are a drawing module self._canDraw = True self.sources = [] x = y = 4 view.fontList = List((C.C2, y, 250, -65), self.getFontItems(), selectionCallback=self.fontListCallback, drawFocusRing=False, enableDelete=False, allowsMultipleSelection=False, allowsEmptySelection=True, drawHorizontalLines=True, showColumnTitles=False, columnDescriptions=self.getPathListDescriptor(), rowHeight=16, ) view.viewEnabled = CheckBox((x, y, C.BUTTON_WIDTH, 22), "Show", callback=self.viewCallback, sizeStyle=C.STYLE_CHECKBOXSIZE, value=True) y += C.L view.fill = CheckBox((x, y, 60, 22), "Fill", sizeStyle=C.STYLE_CHECKBOXSIZE, #value=getExtensionDefault("%s.%s" %(self.DEFAULTKEY, "fill"), True), value = True, callback=self.fillCallback) y += C.L color = getExtensionDefaultColor(self.DEFAULTKEY_FILLCOLOR, self.FALLBACK_FILLCOLOR) view.color = ColorWell((x, y, 60, 22), color=color, callback=self.colorCallback) y += C.L + 5 view.stroke = CheckBox((x, y, 60, 22), "Stroke", sizeStyle=C.STYLE_CHECKBOXSIZE, #value=getExtensionDefault("%s.%s" %(self.DEFAULTKEY, "stroke"), False), value = False, callback=self.strokeCallback) y += C.LL view.alignText = TextBox((x, y, 90, 50), 'Alignment', sizeStyle=C.STYLE_LABELSIZE) y += C.L view.align = RadioGroup((x, y, 90, 50), ['Left', 'Center', 'Right'], isVertical=True, sizeStyle=C.STYLE_RADIOSIZE, callback=self.alignCallback) view.align.set(0) #view.contextLabel = TextBox((C.C2, -58, 90, 50), 'Contexts', sizeStyle=C.STYLE_LABELSIZE) view.viewCurrent = CheckBox((C.C2, -60, 150, 22), "Always View Current", sizeStyle=C.STYLE_CHECKBOXSIZE, value = False, callback=self.contextEditCallback) #view.contextUandlc = CheckBox((C.C2+170, -60, 85, 22), "Match Case", sizeStyle=C.STYLE_CHECKBOXSIZE, # value = False, # callback=self.contextEditCallback) view.contextBefore = EditText((C.C2, -30, 85, 20), callback=self.contextEditCallback, continuous=True, sizeStyle="small", placeholder='Left Context') view.contextCurrent = EditText((C.C2+95, -30, 60, 20), callback=self.contextCurrentEditCallback, continuous=True, sizeStyle="small") view.contextAfter = EditText((C.C2+165, -30, 85, 20), callback=self.contextEditCallback, continuous=True, sizeStyle="small", placeholder='Right Context') self.activateModule() self.setUpBaseWindowBehavior() def fontListCallback(self, sender): u"""If there is a selection, toggle the status of these fonts.""" # Avoid recursive loop because of changing font selection if not self._selectionChanging: for selectedIndex in sender.getSelection(): item = sender.get()[selectedIndex] if item['status']: item['status'] = '' else: item['status'] = selectedSymbol # If shift is held when pressing an entry in the font list, # the non-selected fonts will swap with the current's state if NSEvent.modifierFlags() & NSShiftKeyMask: items = [sender.get()[i] for i in range(len(sender.get())) if i != selectedIndex] for subItems in items: if item['status'] == '': subItems['status'] = selectedSymbol else: subItems['status'] = '' self._selectionChanging = True # Avoid recursive loop because of changing font selection sender.setSelection([]) self._selectionChanging = False self.updateView() def canDraw(self): return True """ There is an experimental feature that will change the case of the context characters based on the case of the current glyph. But I'm disabling that for now. """ #def isUpper(self, g): # char = CharacterTX.glyph2Char(g) # if len(char) > 1: # char = char[0] # if unicodedata.category(char) == 'Lu': # return True # return False #def isLower(self, g): # char = CharacterTX.glyph2Char(g) # if len(char) > 1: # char = char[0] # if unicodedata.category(char) == 'Ll': # return True # return False def getHiddenFont(self, path): from builtins import str for f in self.tool.getFonts(): if f.path == path: return f elif path == str(f.info.familyName)+" "+str(f.info.styleName): return f def drawBackground(self, info): u"""Draw the background of defined glyphs and fonbts. Scale is available as mouse.scale.""" view = self.getView() if not view.viewEnabled.get(): return fill = getExtensionDefault(self.DEFAULTKEY_FILL, True) stroke = getExtensionDefault(self.DEFAULTKEY_STROKE, True) fillcolor = getExtensionDefaultColor(self.DEFAULTKEY_FILLCOLOR, self.FALLBACK_FILLCOLOR) glyph = info.get('glyph') if glyph is not None: current = glyph.getParent() else: current = self.tool.getCurrentFont() if glyph is None or current is None: return align = self.getAlignment() # Get the fonts from the list and see if they are selected. sourceItems = self.getSourceFonts() showFonts = [] for item in sourceItems: if not item['status']: continue path = item['path'] font = self.getHiddenFont(path) showFonts.append(font) if view.viewCurrent.get() and current not in showFonts: showFonts.append(current) for font in showFonts: self.fillColor.setFill() self.strokeColor.setStroke() contextBefore, contextCurrent, contextAfter = self.getContexts() if font is not None: contextBefore = splitText(contextBefore, TX.naked(font).unicodeData, TX.naked(font).groups) contextBefore = [font[gname] for gname in contextBefore if gname in font.keys()] contextAfter = splitText(contextAfter, TX.naked(font).unicodeData, TX.naked(font).groups) contextAfter = [font[gname] for gname in contextAfter if gname in font.keys()] contextCurrent = splitText(contextCurrent, TX.naked(font).unicodeData, TX.naked(font).groups) if len(contextCurrent) > 0: contextCurrent = [font[gname] for gname in [contextCurrent[0]] if gname in font.keys()] if len(contextCurrent) > 0: sourceGlyph = contextCurrent[0] else: sourceGlyph = None elif glyph.name in font.keys(): sourceGlyph = font[glyph.name] else: sourceGlyph = None """ #There is an experimental feature that will change the case of the context characters based on the case of the current glyph. But I'm disabling that for now. if view.contextUandlc.get(): caseTransform = None if self.isUpper(glyph): caseTransform = FontTX.unicodes.getUpperFromLower elif self.isLower(glyph): caseTransform = FontTX.unicodes.getLowerFromUpper if caseTransform: for i, g in enumerate(contextBefore): newG = caseTransform(g) if newG is not None: contextBefore[i] = newG newG = caseTransform(sourceGlyph) if newG is not None: sourceGlyph = newG if caseTransform: for i, g in enumerate(contextAfter): newG = caseTransform(g) if newG is not None: contextAfter[i] = newG """ scale(current.info.unitsPerEm/float(font.info.unitsPerEm)) widthOffset = 0 if sourceGlyph is not None: if align == 'center': destCenter = float(glyph.width/2) / current.info.unitsPerEm sourceCenter = float(sourceGlyph.width/2) / font.info.unitsPerEm widthOffset = (destCenter-sourceCenter) * font.info.unitsPerEm elif align == 'right': widthOffset = ( ( glyph.width / glyph.getParent().info.unitsPerEm ) - (sourceGlyph.width / sourceGlyph.getParent().info.unitsPerEm ) ) * font.info.unitsPerEm translate(widthOffset, 0) previousGlyph = sourceGlyph contextBefore.reverse() totalWidth = 0 for i, cbGlyph in enumerate(contextBefore): kernValue = 0 if previousGlyph is not None and previousGlyph.getParent() == cbGlyph.getParent(): # Uncomment to activate kerning. Requires FontTX. #kernValue += FontTX.kerning.getValue((previousGlyph.name, cbGlyph.name), font.kerning, font.groups) kernValue += 0 translate(-cbGlyph.width-kernValue, 0) totalWidth += cbGlyph.width + kernValue drawGlyphPath = TX.naked(cbGlyph).getRepresentation("defconAppKit.NSBezierPath") if view.fill.get(): drawGlyphPath.fill() if view.stroke.get(): strokePixelPath(drawGlyphPath) previousGlyph = cbGlyph translate(totalWidth, 0) totalWidth = 0 contextCurrentAndAfter = [sourceGlyph]+contextAfter for i, cbGlyph in enumerate(contextCurrentAndAfter): if cbGlyph is None: cbGlyph = sourceGlyph nextGlyph = None if i + 1 < len(contextCurrentAndAfter): nextGlyph = contextCurrentAndAfter[i+1] if (i == 0 and cbGlyph == glyph) or sourceGlyph is None: pass else: drawGlyphPath = TX.naked(cbGlyph).getRepresentation("defconAppKit.NSBezierPath") if view.fill.get(): drawGlyphPath.fill() if view.stroke.get(): strokePixelPath(drawGlyphPath) kernValue = 0 if cbGlyph is not None and nextGlyph is not None and nextGlyph.getParent() == cbGlyph.getParent(): #kernValue = FontTX.kerning.getValue((cbGlyph.name, nextGlyph.name), font.kerning, font.groups) # Uncomment to activate kerning. Requires FontTX. kernValue = 0 width = 0 if cbGlyph is not None: width = cbGlyph.width translate(width+kernValue, 0) totalWidth += width + kernValue previousGlyph = cbGlyph translate(-totalWidth, 0) translate(-widthOffset, 0) scale(font.info.unitsPerEm/float(current.info.unitsPerEm)) #restore() drawInactive = drawBackground def viewCallback(self, sender): self.updateView() def getSourceFonts(self): """ Get the fonts in the list. """ view = self.getView() return view.fontList.get() def setSourceFonts(self): u""" Set the font list from the current set of open fonts. """ view = self.getView() labels = [] currentSelection = [] for d in self.getSourceFonts(): if d['status']: currentSelection.append(d['path']) for status, path, name in self.tool.getFontLabels(): if path in currentSelection: status = selectedSymbol else: status = '' labels.append(dict(status=status, path=path, name=name)) view.fontList.set(labels) def colorCallback(self, sender): """ Change the color. """ selectedColor = sender.get() r = selectedColor.redComponent() g = selectedColor.greenComponent() b = selectedColor.blueComponent() a = 1 strokeColor = NSColor.colorWithCalibratedRed_green_blue_alpha_(r, g, b, a) setExtensionDefaultColor(self.DEFAULTKEY_FILLCOLOR, selectedColor) setExtensionDefaultColor(self.DEFAULTKEY_STROKECOLOR, strokeColor) self.fillColor = selectedColor self.strokeColor = strokeColor self.updateView() def fillCallback(self, sender): """ Change the fill status. """ setExtensionDefault(self.DEFAULTKEY_FILL, sender.get()) self.updateView() def strokeCallback(self, sender): """ Change the stroke status. """ setExtensionDefault(self.DEFAULTKEY_STROKE, sender.get()) self.updateView() def alignCallback(self, sender): """ Change the alignment status. """ self.updateView() def getAlignment(self): """ Get the alignment as a string. """ view = self.getView() index = view.align.get() if index == 0: return 'left' elif index == 1: return 'center' elif index == 2: return 'right' def updateView(self, sender=None): UpdateCurrentGlyphView() def windowCloseCallback(self, sender): self.deactivateModule() self.updateView() BaseWindowController.windowCloseCallback(self, sender) def getFontItems(self, update=False): """ Get all fonts in a way that can be set into a vanilla list. """ paths = set() # Set of all unique paths in the merges lists itemsByName = {} if update: # If update flag is set, then keep the existing selected fonts. for item in self.getSourceFonts(): if item['status']: itemsByName[item['name']] = item currentStatuses = {} if hasattr(self.getView(), 'fontList'): for d in self.getSourceFonts(): currentStatuses[d['path']] = d['status'] for status, path, uniqueName in self.tool.getFontLabels(): if path in currentStatuses: status = currentStatuses[path] else: status = selectedSymbol if not uniqueName in itemsByName.keys():# If it is not already there, add this to the list itemsByName[uniqueName] = dict(status=status, path=path, name=uniqueName) fontList = [] for key, item in sorted(itemsByName.items()): fontList.append(item) return fontList ################ # CONTEXTS ################ def getContexts(self): if not hasattr(self, 'contextBefore'): self.contextBefore = '' if not hasattr(self, 'contextAfter'): self.contextAfter = '' if not hasattr(self, 'contextCurrent'): self.contextCurrent = None return self.contextBefore, self.contextCurrent, self.contextAfter def setContexts(self, contextBefore, contextCurrent, contextAfter): self.contextBefore = contextBefore self.contextCurrent = contextCurrent self.contextAfter = contextAfter def contextEditCallback(self, sender): before = self.getView().contextBefore.get() current = self.getView().contextCurrent.get() or None after = self.getView().contextAfter.get() self.setContexts(before, current, after) self.updateView() def contextCurrentEditCallback(self, sender): #if sender.get(): #sender.set(sender.get()[0]) self.contextEditCallback(sender) if __name__ == "__main__": OverlayUFOs()
[ 1, 396, 29883, 3689, 29922, 9420, 29899, 29947, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 15945, 29908, 13, 29937, 438, 5348, 18799, 501, 29943, 3267, 13, 13, 2831, 5019, 3063, 297, 1244, 29892, 7423, 278, 775, 338, 577, 4473, 29891, 29889, 910, 338, 263, 2317, 18785, 1873, 310, 263, 2471, 411, 263, 3287, 310, 9962, 29889, 13, 15945, 29908, 13, 5215, 2897, 13, 3166, 2401, 13117, 1053, 334, 396, 29992, 19737, 3359, 3399, 21067, 4848, 23805, 13, 3166, 1109, 2911, 1053, 334, 396, 29992, 19737, 3359, 3399, 21067, 4848, 23805, 29871, 13, 13, 3166, 2730, 2212, 29889, 4012, 292, 24183, 1053, 334, 13, 3166, 2730, 2212, 29889, 13604, 1053, 788, 28066, 29892, 3349, 28066, 13, 3166, 2730, 2212, 29889, 24299, 1053, 679, 17657, 4592, 29892, 731, 17657, 4592, 29892, 679, 17657, 4592, 3306, 29892, 731, 17657, 4592, 3306, 13, 3166, 2730, 2212, 29889, 3120, 1053, 10318, 7583, 29954, 27026, 1043, 13, 3166, 4079, 24183, 29889, 29886, 575, 29889, 9067, 29925, 264, 1053, 4103, 689, 29925, 264, 13, 3166, 822, 535, 2052, 13117, 29889, 10499, 29889, 3188, 5907, 1053, 7399, 5907, 2956, 13, 5215, 443, 293, 6797, 532, 13, 13, 29937, 3166, 4303, 29889, 8504, 29889, 4381, 29879, 1053, 679, 4592, 3306, 13, 3166, 4303, 29889, 8504, 29889, 4012, 292, 1053, 19782, 29637, 2605, 13, 3166, 4303, 29889, 3120, 29889, 3493, 13409, 29889, 16808, 561, 20529, 24739, 1053, 6219, 1626, 13, 13, 3166, 4240, 1144, 1053, 18460, 13, 13, 8391, 14730, 353, 318, 29915, 30119, 29915, 13, 13, 1753, 18285, 1626, 1293, 4617, 29898, 5628, 519, 29922, 8824, 1125, 13, 1678, 3038, 353, 405, 1254, 1062, 3073, 4617, 29889, 15956, 2141, 2344, 580, 13, 1678, 2159, 353, 405, 1799, 29885, 497, 4809, 3505, 396, 3059, 29924, 2172, 4809, 3505, 13, 1678, 3038, 29889, 842, 4809, 3505, 23538, 2311, 29897, 13, 1678, 4079, 353, 3865, 9824, 29889, 5205, 9824, 2776, 3505, 23538, 3059, 9824, 29889, 5205, 9824, 3505, 2831, 4809, 3505, 23538, 2311, 876, 13, 1678, 3038, 29889, 842, 9824, 23538, 5657, 29897, 13, 1678, 3038, 29889, 842, 6103, 519, 23538, 5628, 519, 29897, 13, 1678, 736, 3038, 13, 13, 1990, 323, 29990, 29901, 13, 1678, 9995, 13, 1678, 530, 946, 6582, 293, 982, 304, 679, 263, 302, 12535, 4079, 29889, 13, 1678, 9995, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 302, 12535, 29898, 25932, 29892, 285, 1125, 13, 4706, 1018, 29901, 13, 9651, 736, 285, 29889, 8546, 287, 580, 13, 4706, 5174, 29901, 13, 9651, 736, 285, 13, 632, 13, 1990, 21704, 7295, 13, 1678, 9995, 13, 1678, 450, 5780, 1203, 767, 1179, 278, 4079, 1051, 29889, 910, 338, 263, 5466, 2450, 29889, 13, 1678, 9995, 13, 1678, 23849, 353, 2178, 9824, 29879, 580, 13, 268, 13, 1678, 822, 788, 28066, 29898, 1311, 29892, 3646, 29892, 1158, 29892, 3158, 1125, 13, 4706, 788, 28066, 29898, 5182, 29892, 1158, 29892, 3158, 29897, 13, 13, 1678, 822, 3349, 28066, 29898, 1311, 29892, 3646, 29892, 1158, 29892, 3158, 1125, 13, 4706, 3349, 28066, 29898, 5182, 29892, 1158, 29892, 3158, 29897, 13, 13, 1678, 822, 679, 7583, 9824, 29898, 1311, 1125, 13, 4706, 736, 9626, 9824, 580, 13, 268, 13, 1678, 822, 679, 9824, 29879, 29898, 1311, 1125, 13, 4706, 318, 15945, 29908, 29909, 1983, 17538, 278, 1051, 310, 4629, 23849, 29892, 10372, 491, 1009, 2224, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 28586, 13, 308, 13, 1678, 822, 9773, 1762, 9824, 29879, 29898, 1311, 29892, 2224, 1125, 13, 4706, 285, 353, 4673, 9824, 29898, 2084, 29892, 1510, 3120, 29922, 8824, 29897, 13, 4706, 1583, 29889, 28586, 29889, 4397, 29898, 29888, 29897, 13, 308, 13, 1678, 822, 3349, 4591, 9824, 29879, 29898, 1311, 29892, 2224, 1125, 13, 4706, 363, 474, 29892, 285, 297, 26985, 29898, 1311, 29889, 28586, 1125, 13, 9651, 565, 285, 29889, 2084, 1275, 2224, 29901, 13, 18884, 628, 1583, 29889, 28586, 29961, 29875, 29962, 13, 13, 1678, 822, 679, 9824, 2605, 29879, 29898, 1311, 1125, 13, 4706, 736, 518, 29888, 29889, 2084, 470, 851, 29898, 29888, 29889, 3888, 29889, 11922, 1170, 7240, 29908, 15691, 710, 29898, 29888, 29889, 3888, 29889, 3293, 1170, 29897, 363, 285, 297, 1583, 29889, 657, 9824, 29879, 580, 29962, 13, 268, 13, 1678, 822, 679, 9824, 4775, 29898, 1311, 29892, 2224, 1125, 13, 4706, 565, 2224, 338, 6213, 29901, 13, 9651, 736, 6213, 13, 4706, 565, 451, 2224, 29901, 13, 9651, 736, 525, 29965, 593, 17707, 29915, 13, 4706, 1024, 353, 2224, 29889, 5451, 11219, 1495, 14352, 29896, 29962, 13, 4706, 4660, 353, 4629, 14730, 13, 4706, 736, 4660, 29892, 2224, 29892, 1024, 13, 268, 13, 1678, 822, 679, 9824, 4775, 29879, 29898, 1311, 1125, 13, 4706, 11073, 353, 6571, 13, 4706, 363, 2224, 297, 1583, 29889, 657, 9824, 2605, 29879, 7295, 13, 9651, 565, 2224, 29901, 13, 18884, 3858, 353, 1583, 29889, 657, 9824, 4775, 29898, 2084, 29897, 13, 18884, 1024, 353, 3858, 14352, 29896, 29962, 13, 9651, 1683, 29901, 13, 18884, 1024, 353, 525, 29965, 593, 17707, 29915, 13, 9651, 565, 451, 1024, 297, 11073, 29901, 13, 18884, 11073, 29961, 978, 29962, 353, 5159, 13, 9651, 11073, 29961, 978, 1822, 4397, 29898, 1643, 29897, 13, 4706, 12705, 4775, 29879, 353, 5159, 13, 4706, 363, 17117, 3858, 2697, 297, 12705, 29898, 21134, 29889, 7076, 580, 1125, 13, 9651, 565, 7431, 29898, 1643, 2697, 29897, 1275, 29871, 29896, 29901, 396, 1670, 338, 871, 263, 2323, 4079, 411, 445, 1024, 13, 18884, 12705, 4775, 29879, 29889, 4397, 29898, 1643, 2697, 29961, 29900, 2314, 13, 9651, 1683, 29901, 396, 13466, 591, 29915, 645, 505, 304, 3386, 716, 2983, 304, 1510, 278, 4328, 13, 18884, 363, 4660, 29892, 2224, 29892, 1024, 297, 12705, 29898, 1643, 2697, 1125, 13, 462, 1678, 12705, 4775, 29879, 29889, 4397, 3552, 4882, 29892, 2224, 29892, 14210, 29879, 11860, 29879, 29908, 29915, 1273, 313, 978, 29892, 8207, 4286, 7122, 29898, 2084, 29889, 5451, 11219, 1495, 7503, 29899, 29896, 12622, 876, 13, 4706, 736, 12705, 4775, 29879, 13, 13, 1990, 315, 29901, 13, 1678, 9995, 13, 1678, 3834, 17727, 29889, 13, 1678, 9995, 13, 1678, 315, 29906, 353, 29871, 29896, 29900, 29900, 13, 1678, 350, 2692, 29911, 1164, 29918, 22574, 353, 29871, 29947, 29900, 13, 1678, 6850, 29979, 1307, 29918, 3210, 16658, 8456, 29990, 14226, 353, 525, 9278, 29915, 13, 1678, 6850, 29979, 1307, 29918, 24461, 6670, 14226, 353, 525, 9278, 29915, 13, 1678, 6850, 29979, 1307, 29918, 29934, 3035, 25925, 29902, 10721, 353, 525, 9278, 29915, 13, 1678, 365, 353, 29871, 29906, 29906, 13, 1678, 27624, 353, 29871, 29906, 29945, 13, 13, 1990, 6811, 8387, 29965, 5800, 29879, 29898, 5160, 5907, 2956, 1125, 13, 268, 13, 1678, 22236, 10818, 353, 376, 510, 29889, 5657, 29890, 13411, 29889, 957, 8387, 29965, 5800, 29908, 13, 1678, 22236, 10818, 29918, 3738, 2208, 15032, 1955, 353, 11860, 29879, 29889, 5589, 3306, 29908, 1273, 23397, 10818, 13, 1678, 22236, 10818, 29918, 1254, 1672, 6059, 15032, 1955, 353, 11860, 29879, 29889, 25893, 3306, 29908, 1273, 23397, 10818, 13, 1678, 22236, 10818, 29918, 1254, 1672, 6059, 353, 11860, 29879, 29889, 25893, 29908, 1273, 23397, 10818, 13, 1678, 22236, 10818, 29918, 3738, 2208, 353, 11860, 29879, 29889, 5589, 29908, 1273, 23397, 10818, 13, 1678, 383, 9818, 29933, 11375, 29918, 3738, 2208, 15032, 1955, 353, 3865, 3306, 29889, 2780, 3047, 7856, 4626, 630, 9039, 29918, 12692, 29918, 9539, 29918, 2312, 29918, 11891, 29945, 29892, 29871, 29900, 29892, 869, 29945, 29892, 869, 29896, 29897, 13, 1678, 383, 9818, 29933, 11375, 29918, 1254, 1672, 6059, 15032, 1955, 353, 3865, 3306, 29889, 2780, 3047, 7856, 4626, 630, 9039, 29918, 12692, 29918, 9539, 29918, 2312, 29918, 11891, 29945, 29892, 29871, 29900, 29892, 869, 29945, 29892, 869, 29945, 29897, 13, 1678, 13, 1678, 478, 1001, 13381, 353, 29871, 29896, 29889, 29900, 13, 268, 13, 1678, 27085, 353, 318, 29915, 3563, 8387, 501, 5800, 29879, 29915, 13, 13, 1678, 341, 2190, 29965, 1964, 353, 318, 15945, 29908, 797, 278, 1857, 330, 27026, 3474, 29892, 445, 674, 2198, 278, 1776, 278, 1021, 330, 27026, 515, 263, 5004, 29871, 13, 1678, 501, 5800, 470, 731, 310, 501, 5800, 29879, 19423, 1182, 3779, 13, 1678, 910, 947, 6058, 1053, 278, 501, 5800, 964, 263, 3239, 7546, 29889, 8669, 29892, 372, 7697, 414, 263, 27887, 4153, 515, 278, 501, 5800, 964, 278, 330, 27026, 3474, 1776, 29889, 13, 1678, 529, 352, 29958, 13, 1678, 529, 492, 29958, 8439, 338, 694, 817, 304, 1053, 7929, 848, 964, 263, 3239, 7546, 21106, 492, 29958, 13, 1678, 529, 492, 29958, 1576, 2752, 27887, 338, 2337, 5735, 29936, 746, 3620, 526, 1754, 304, 278, 2752, 29892, 896, 674, 6336, 29871, 13, 1678, 2615, 297, 278, 1857, 1728, 337, 29899, 5215, 292, 21106, 492, 29958, 13, 1678, 529, 492, 29958, 1576, 2752, 4079, 947, 451, 817, 304, 367, 6496, 411, 263, 3740, 21106, 492, 29958, 13, 1678, 1533, 352, 29958, 13, 1678, 529, 29882, 29941, 29958, 4571, 1964, 29949, 29954, 829, 29882, 29941, 29958, 29871, 13, 1678, 529, 352, 29958, 13, 1678, 529, 492, 29958, 29909, 16526, 7928, 338, 2198, 304, 1235, 366, 1722, 322, 1831, 2752, 23849, 29892, 5445, 29892, 19782, 29892, 2927, 21106, 492, 29958, 13, 1678, 529, 492, 29958, 4435, 10928, 29879, 29901, 450, 2322, 2752, 4079, 1051, 338, 1583, 29889, 657, 6585, 9824, 29879, 2141, 450, 11086, 2826, 674, 29871, 13, 1678, 736, 445, 1051, 304, 1583, 29889, 657, 6585, 9824, 29879, 2141, 829, 492, 29958, 13, 1678, 529, 492, 29958, 2528, 292, 10928, 29879, 29901, 887, 508, 7522, 788, 23849, 491, 18851, 263, 501, 5800, 934, 29889, 29871, 13, 1678, 450, 501, 5800, 934, 674, 1722, 1728, 385, 5067, 21106, 492, 29958, 13, 1678, 529, 492, 29958, 7301, 21081, 10928, 29879, 29901, 1670, 526, 9828, 363, 11077, 4629, 23849, 322, 363, 2821, 292, 278, 2752, 4079, 1051, 21106, 492, 29958, 13, 1678, 1533, 352, 29958, 29871, 13, 1678, 529, 29882, 29941, 29958, 7838, 10749, 29914, 29902, 3580, 1672, 12064, 13780, 29903, 829, 29882, 29941, 29958, 13, 1678, 529, 352, 29958, 13, 1678, 529, 492, 29958, 29968, 21369, 26246, 29901, 450, 2752, 4079, 338, 12061, 373, 2246, 310, 278, 1857, 4079, 29892, 2012, 310, 5742, 372, 29889, 29871, 13, 1678, 1105, 29892, 372, 338, 1781, 304, 1831, 263, 2927, 411, 263, 4482, 17012, 21106, 492, 29958, 13, 1678, 529, 492, 29958, 29968, 21369, 28209, 29901, 960, 278, 330, 27026, 3474, 363, 1716, 2752, 322, 1857, 23849, 526, 1722, 29892, 372, 338, 1950, 29871, 13, 1678, 304, 1831, 322, 297, 328, 1765, 2705, 3863, 278, 2752, 27887, 297, 278, 1857, 3474, 29889, 306, 1016, 29915, 29873, 1073, 920, 304, 4505, 445, 21106, 492, 29958, 13, 1678, 529, 492, 29958, 1888, 16123, 882, 25825, 3462, 3987, 304, 6287, 278, 2752, 4079, 21106, 492, 29958, 13, 1678, 529, 492, 29958, 1888, 16123, 882, 25825, 3789, 1422, 11955, 29892, 5445, 6055, 363, 1269, 4079, 29973, 829, 492, 29958, 13, 1678, 1533, 352, 29958, 13, 1678, 9995, 13, 13, 1678, 396, 383, 11925, 2920, 310, 278, 3474, 29889, 13, 1678, 5473, 29923, 29956, 16173, 14226, 353, 29871, 29946, 29900, 29900, 13, 1678, 5473, 29923, 29956, 14226, 353, 5473, 29923, 29956, 16173, 14226, 13, 1678, 5473, 29923, 29956, 12648, 14226, 353, 5473, 29923, 29956, 16173, 14226, 13, 13, 1678, 399, 1177, 3970, 29956, 29918, 13152, 1799, 29902, 10721, 353, 313, 29896, 29941, 29900, 29892, 29871, 29906, 29900, 29892, 5473, 29923, 29956, 14226, 29892, 29871, 29906, 29953, 29900, 29897, 13, 1678, 399, 1177, 3970, 29956, 29918, 16173, 14226, 353, 313, 29963, 8673, 29956, 16173, 14226, 29892, 29871, 29906, 29953, 29900, 29897, 13, 1678, 399, 1177, 3970, 29956, 29918, 12648, 14226, 353, 313, 29963, 8673, 29956, 12648, 14226, 29892, 29871, 29906, 29953, 29900, 29897, 13, 13, 1678, 822, 679, 2605, 1293, 19124, 29898, 1311, 1125, 29871, 13, 4706, 736, 518, 13, 9651, 9657, 29898, 3257, 2433, 5709, 742, 1820, 2433, 4882, 742, 3038, 29922, 12636, 497, 1626, 1293, 4617, 29898, 5628, 519, 29922, 8824, 511, 2920, 29922, 29896, 29906, 29892, 3863, 519, 29922, 8824, 511, 13, 9651, 9657, 29898, 3257, 2433, 1170, 742, 29871, 1820, 2433, 978, 742, 2920, 29922, 29941, 29900, 29900, 29892, 3038, 29922, 12636, 497, 1626, 1293, 4617, 29898, 5628, 519, 29922, 8824, 511, 3863, 519, 29922, 8824, 511, 13, 9651, 9657, 29898, 3257, 2433, 2605, 742, 1820, 2433, 2084, 742, 2920, 29922, 29900, 29892, 3863, 519, 29922, 8824, 511, 13, 4706, 4514, 13, 268, 13, 1678, 835, 7346, 4136, 29937, 13, 1678, 396, 438, 29933, 18603, 29903, 5300, 11901, 25832, 23598, 13, 1678, 835, 7346, 4136, 29937, 13, 268, 13, 1678, 822, 4079, 15097, 7590, 29898, 1311, 1125, 259, 13, 4706, 1583, 29889, 842, 4435, 9824, 29879, 580, 13, 268, 13, 1678, 822, 5039, 403, 7355, 29898, 1311, 1125, 13, 4706, 1583, 29889, 10154, 29889, 1202, 28066, 29898, 1311, 29892, 525, 4012, 797, 4925, 742, 525, 4012, 797, 4925, 1495, 13, 4706, 1583, 29889, 10154, 29889, 1202, 28066, 29898, 1311, 29892, 525, 4012, 10581, 742, 525, 4012, 10581, 1495, 13, 4706, 1583, 29889, 10154, 29889, 1202, 28066, 29898, 1311, 29892, 525, 5657, 9260, 6585, 742, 525, 5657, 9260, 6585, 1495, 13, 4706, 1583, 29889, 10154, 29889, 1202, 28066, 29898, 1311, 29892, 525, 5657, 12984, 11123, 742, 525, 5657, 12984, 11123, 1495, 13, 308, 13, 1678, 822, 316, 11236, 403, 7355, 29898, 1311, 1125, 13, 4706, 3349, 28066, 29898, 1311, 29892, 525, 4012, 10581, 1495, 13, 4706, 3349, 28066, 29898, 1311, 29892, 525, 4012, 797, 4925, 1495, 13, 4706, 3349, 28066, 29898, 1311, 29892, 525, 5657, 9260, 6585, 1495, 13, 4706, 3349, 28066, 29898, 1311, 29892, 525, 5657, 12984, 11123, 1495, 13, 308, 13, 1678, 835, 7346, 4136, 29937, 13, 1678, 396, 8707, 4330, 29990, 9375, 13, 1678, 835, 7346, 4136, 29937, 13, 13, 1678, 822, 4079, 9260, 6585, 29898, 1311, 29892, 5235, 1125, 13, 4706, 4079, 353, 5235, 29889, 657, 877, 5657, 1495, 13, 4706, 565, 4079, 29901, 13, 9651, 1583, 29889, 10154, 29889, 28586, 29889, 4397, 29898, 5657, 29897, 13, 9651, 1583, 29889, 22379, 10717, 580, 13, 13, 1678, 822, 4079, 12984, 11123, 29898, 1311, 29892, 5235, 1125, 13, 4706, 4079, 353, 5235, 29889, 657, 877, 5657, 1495, 13, 4706, 2224, 353, 4079, 29889, 2084, 13, 4706, 565, 2224, 29901, 13, 9651, 1583, 29889, 10154, 29889, 5992, 4591, 9824, 29879, 29898, 2084, 29897, 13, 9651, 1583, 29889, 22379, 10717, 580, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 10154, 353, 21704, 580, 13, 4706, 1583, 29889, 29893, 353, 26043, 1218, 5907, 3552, 29946, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 511, 376, 3563, 8387, 501, 5800, 29879, 613, 1375, 3505, 7607, 29946, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 876, 13, 4706, 1583, 29889, 7323, 5987, 1043, 580, 13, 4706, 1583, 29889, 657, 1043, 2141, 3150, 580, 13, 13, 1678, 822, 679, 1043, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 29893, 13, 268, 13, 1678, 822, 11086, 10717, 29898, 1311, 29892, 10004, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 10318, 278, 4079, 1051, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 657, 1043, 2141, 5657, 1293, 29889, 842, 29898, 1311, 29889, 657, 9824, 6913, 3101, 13, 268, 13, 1678, 822, 10092, 10717, 29898, 1311, 29892, 10004, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 2538, 1691, 278, 1776, 304, 278, 5279, 6496, 23849, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 10154, 29889, 28586, 353, 2178, 9824, 29879, 580, 13, 4706, 1583, 29889, 657, 1043, 2141, 5657, 1293, 29889, 842, 29898, 1311, 29889, 657, 9824, 6913, 3101, 13, 268, 13, 1678, 822, 788, 10717, 29898, 1311, 29892, 10004, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 4673, 263, 4079, 1728, 3740, 322, 788, 372, 304, 278, 4079, 1051, 29889, 13, 4706, 9995, 13, 4706, 285, 353, 4673, 9824, 29898, 8516, 29892, 1510, 3120, 29922, 8824, 29897, 13, 4706, 565, 285, 338, 6213, 29901, 13, 9651, 736, 13, 4706, 1583, 29889, 10154, 29889, 4397, 1762, 9824, 29879, 29898, 29888, 29889, 2084, 29897, 13, 4706, 1583, 29889, 22379, 10717, 580, 13, 308, 13, 1678, 822, 19450, 1043, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 450, 3740, 13, 4706, 9995, 13, 4706, 1583, 29889, 5589, 3306, 353, 679, 17657, 4592, 3306, 29898, 1311, 29889, 23397, 10818, 29918, 3738, 2208, 15032, 1955, 29892, 1583, 29889, 29943, 9818, 29933, 11375, 29918, 3738, 2208, 15032, 1955, 29897, 13, 4706, 1583, 29889, 25893, 3306, 353, 679, 17657, 4592, 3306, 29898, 1311, 29889, 23397, 10818, 29918, 1254, 1672, 6059, 15032, 1955, 29892, 1583, 29889, 29943, 9818, 29933, 11375, 29918, 1254, 1672, 6059, 15032, 1955, 29897, 13, 4706, 1583, 29889, 4703, 18743, 353, 1583, 29889, 4703, 13555, 353, 6629, 13, 308, 13, 4706, 396, 6977, 18099, 278, 1776, 508, 871, 3799, 1156, 278, 1776, 338, 10959, 304, 278, 3474, 29892, 13, 4706, 396, 470, 1683, 278, 6198, 2920, 29879, 748, 2743, 29889, 13, 4706, 1776, 353, 1583, 29889, 657, 1043, 580, 13, 4706, 1776, 29889, 1202, 353, 11025, 3552, 29899, 29946, 29900, 29892, 29871, 29941, 29892, 29871, 29941, 29900, 29892, 29871, 29906, 29906, 511, 525, 29974, 742, 6939, 29922, 1311, 29889, 1202, 10717, 29897, 13, 4706, 1776, 29889, 12071, 353, 11025, 3552, 29899, 29946, 29900, 29892, 29871, 29941, 29900, 29892, 29871, 29941, 29900, 29892, 29871, 29906, 29906, 511, 18460, 29898, 29947, 29953, 29941, 29946, 511, 6939, 29922, 1311, 29889, 12071, 10717, 29897, 13, 4706, 396, 28697, 304, 1074, 565, 278, 9262, 1051, 2828, 338, 297, 6728, 29889, 1334, 526, 10092, 1259, 278, 9262, 13, 4706, 396, 20278, 29892, 773, 278, 1051, 376, 4187, 7453, 613, 541, 6480, 393, 9262, 674, 4556, 1790, 13, 4706, 396, 1051, 2767, 29892, 393, 881, 367, 17262, 29889, 13, 4706, 1583, 3032, 21731, 1451, 9776, 353, 7700, 13, 4706, 396, 1894, 9593, 393, 591, 526, 263, 11580, 3883, 13, 4706, 1583, 3032, 3068, 8537, 353, 5852, 13, 268, 13, 4706, 1583, 29889, 29879, 2863, 353, 5159, 13, 13, 4706, 921, 353, 343, 353, 29871, 29946, 13, 13, 4706, 1776, 29889, 5657, 1293, 353, 2391, 3552, 29907, 29889, 29907, 29906, 29892, 343, 29892, 29871, 29906, 29945, 29900, 29892, 448, 29953, 29945, 511, 1583, 29889, 657, 9824, 6913, 3285, 29871, 13, 9651, 9262, 10717, 29922, 1311, 29889, 5657, 1293, 10717, 29892, 13, 9651, 4216, 20560, 29934, 292, 29922, 8824, 29892, 29871, 13, 9651, 9025, 12498, 29922, 8824, 29892, 29871, 13, 9651, 6511, 15329, 552, 15097, 29922, 8824, 29892, 13, 9651, 6511, 8915, 15097, 29922, 5574, 29892, 13, 9651, 4216, 24932, 20261, 29922, 5574, 29892, 13, 9651, 1510, 4409, 29911, 277, 793, 29922, 8824, 29892, 13, 9651, 1897, 4002, 699, 1980, 29922, 1311, 29889, 657, 2605, 1293, 19124, 3285, 13, 9651, 1948, 7011, 29922, 29896, 29953, 29892, 13, 4706, 1723, 3986, 13, 4706, 1776, 29889, 1493, 10861, 353, 5399, 3313, 3552, 29916, 29892, 343, 29892, 315, 29889, 29933, 2692, 29911, 1164, 29918, 22574, 29892, 29871, 29906, 29906, 511, 376, 8964, 613, 29871, 13, 632, 6939, 29922, 1311, 29889, 1493, 10717, 29892, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 3210, 16658, 8456, 29990, 14226, 29892, 29871, 13, 632, 995, 29922, 5574, 29897, 13, 4706, 343, 4619, 315, 29889, 29931, 13, 4706, 1776, 29889, 5589, 353, 5399, 3313, 3552, 29916, 29892, 343, 29892, 29871, 29953, 29900, 29892, 29871, 29906, 29906, 511, 376, 20876, 613, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 3210, 16658, 8456, 29990, 14226, 29892, 29871, 13, 9651, 396, 1767, 29922, 657, 17657, 4592, 11702, 29879, 29889, 29995, 29879, 29908, 1273, 29898, 1311, 29889, 23397, 10818, 29892, 376, 5589, 4968, 5852, 511, 13, 9651, 995, 353, 5852, 29892, 13, 9651, 6939, 29922, 1311, 29889, 5589, 10717, 29897, 13, 4706, 343, 4619, 315, 29889, 29931, 13, 4706, 2927, 353, 679, 17657, 4592, 3306, 29898, 1311, 29889, 23397, 10818, 29918, 3738, 2208, 15032, 1955, 29892, 1583, 29889, 29943, 9818, 29933, 11375, 29918, 3738, 2208, 15032, 1955, 29897, 13, 4706, 1776, 29889, 2780, 353, 9159, 11284, 3552, 29916, 29892, 343, 29892, 29871, 29953, 29900, 29892, 29871, 29906, 29906, 511, 29871, 13, 9651, 2927, 29922, 2780, 29892, 13, 9651, 6939, 29922, 1311, 29889, 2780, 10717, 29897, 13, 4706, 343, 4619, 315, 29889, 29931, 718, 29871, 29945, 13, 4706, 1776, 29889, 25893, 353, 5399, 3313, 3552, 29916, 29892, 343, 29892, 29871, 29953, 29900, 29892, 29871, 29906, 29906, 511, 376, 855, 10946, 613, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 3210, 16658, 8456, 29990, 14226, 29892, 29871, 13, 9651, 396, 1767, 29922, 657, 17657, 4592, 11702, 29879, 29889, 29995, 29879, 29908, 1273, 29898, 1311, 29889, 23397, 10818, 29892, 376, 25893, 4968, 7700, 511, 13, 9651, 995, 353, 7700, 29892, 29871, 13, 9651, 6939, 29922, 1311, 29889, 25893, 10717, 29897, 13, 13, 4706, 343, 4619, 315, 29889, 2208, 13, 4706, 1776, 29889, 2520, 1626, 353, 3992, 3313, 3552, 29916, 29892, 343, 29892, 29871, 29929, 29900, 29892, 29871, 29945, 29900, 511, 525, 14658, 742, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 24461, 6670, 14226, 29897, 13, 4706, 343, 4619, 315, 29889, 29931, 13, 4706, 1776, 29889, 2520, 353, 9204, 4782, 3552, 29916, 29892, 343, 29892, 29871, 29929, 29900, 29892, 29871, 29945, 29900, 511, 6024, 8091, 742, 525, 13409, 742, 525, 7341, 7464, 338, 29270, 29922, 5574, 29892, 29871, 13, 9651, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 29934, 3035, 25925, 29902, 10721, 29892, 6939, 29922, 1311, 29889, 2520, 10717, 29897, 13, 4706, 1776, 29889, 2520, 29889, 842, 29898, 29900, 29897, 13, 308, 13, 4706, 396, 1493, 29889, 4703, 4775, 353, 3992, 3313, 3552, 29907, 29889, 29907, 29906, 29892, 448, 29945, 29947, 29892, 29871, 29929, 29900, 29892, 29871, 29945, 29900, 511, 525, 2677, 29879, 742, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 24461, 6670, 14226, 29897, 13, 13, 4706, 1776, 29889, 1493, 7583, 353, 5399, 3313, 3552, 29907, 29889, 29907, 29906, 29892, 448, 29953, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29906, 29906, 511, 376, 2499, 1994, 4533, 9626, 613, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 3210, 16658, 8456, 29990, 14226, 29892, 13, 9651, 995, 353, 7700, 29892, 13, 9651, 6939, 29922, 1311, 29889, 4703, 6103, 10717, 29897, 13, 13, 4706, 396, 1493, 29889, 4703, 29965, 392, 29880, 29883, 353, 5399, 3313, 3552, 29907, 29889, 29907, 29906, 29974, 29896, 29955, 29900, 29892, 448, 29953, 29900, 29892, 29871, 29947, 29945, 29892, 29871, 29906, 29906, 511, 376, 9652, 11733, 613, 2159, 5568, 29922, 29907, 29889, 1254, 29979, 1307, 29918, 3210, 16658, 8456, 29990, 14226, 29892, 13, 4706, 396, 1678, 995, 353, 7700, 29892, 13, 4706, 396, 1678, 6939, 29922, 1311, 29889, 4703, 6103, 10717, 29897, 13, 13, 4706, 1776, 29889, 4703, 18743, 353, 7641, 1626, 3552, 29907, 29889, 29907, 29906, 29892, 448, 29941, 29900, 29892, 29871, 29947, 29945, 29892, 29871, 29906, 29900, 511, 6939, 29922, 1311, 29889, 4703, 6103, 10717, 29892, 9126, 29922, 5574, 29892, 2159, 5568, 543, 9278, 613, 12983, 2433, 8091, 15228, 1495, 13, 4706, 1776, 29889, 4703, 7583, 353, 7641, 1626, 3552, 29907, 29889, 29907, 29906, 29974, 29929, 29945, 29892, 448, 29941, 29900, 29892, 29871, 29953, 29900, 29892, 29871, 29906, 29900, 511, 6939, 29922, 1311, 29889, 4703, 7583, 6103, 10717, 29892, 9126, 29922, 5574, 29892, 2159, 5568, 543, 9278, 1159, 13, 4706, 1776, 29889, 4703, 13555, 353, 7641, 1626, 3552, 29907, 29889, 29907, 29906, 29974, 29896, 29953, 29945, 29892, 448, 29941, 29900, 29892, 29871, 29947, 29945, 29892, 29871, 29906, 29900, 511, 6939, 29922, 1311, 29889, 4703, 6103, 10717, 29892, 9126, 29922, 5574, 29892, 2159, 5568, 543, 9278, 613, 12983, 2433, 7341, 15228, 1495, 13, 4706, 1583, 29889, 11236, 403, 7355, 580, 13, 4706, 1583, 29889, 842, 3373, 5160, 5907, 28100, 580, 13, 13, 1678, 822, 4079, 1293, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 318, 15945, 29908, 3644, 727, 338, 263, 9262, 29892, 20429, 278, 4660, 310, 1438, 23849, 1213, 15945, 13, 4706, 396, 319, 5405, 16732, 2425, 1363, 310, 6480, 4079, 9262, 13, 4706, 565, 451, 1583, 3032, 21731, 1451, 9776, 29901, 13, 9651, 363, 4629, 3220, 297, 10004, 29889, 657, 15097, 7295, 13, 18884, 2944, 353, 10004, 29889, 657, 580, 29961, 8391, 3220, 29962, 13, 18884, 565, 2944, 1839, 4882, 2033, 29901, 13, 462, 1678, 2944, 1839, 4882, 2033, 353, 6629, 13, 18884, 1683, 29901, 13, 462, 1678, 2944, 1839, 4882, 2033, 353, 4629, 14730, 13, 462, 308, 13, 18884, 396, 960, 9500, 338, 4934, 746, 24795, 385, 6251, 297, 278, 4079, 1051, 29892, 29871, 13, 18884, 396, 278, 1661, 29899, 8391, 23849, 674, 17945, 411, 278, 1857, 29915, 29879, 2106, 13, 18884, 565, 405, 1660, 794, 29889, 26625, 15675, 580, 669, 405, 1799, 29882, 2027, 2558, 19832, 29901, 13, 462, 1678, 4452, 353, 518, 15452, 29889, 657, 580, 29961, 29875, 29962, 363, 474, 297, 3464, 29898, 2435, 29898, 15452, 29889, 657, 22130, 565, 474, 2804, 4629, 3220, 29962, 13, 462, 1678, 363, 1014, 6913, 297, 4452, 29901, 13, 462, 4706, 565, 2944, 1839, 4882, 2033, 1275, 525, 2396, 13, 462, 9651, 1014, 6913, 1839, 4882, 2033, 353, 4629, 14730, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 1014, 6913, 1839, 4882, 2033, 353, 6629, 13, 462, 268, 13, 9651, 1583, 3032, 21731, 1451, 9776, 353, 5852, 13, 9651, 396, 319, 5405, 16732, 2425, 1363, 310, 6480, 4079, 9262, 13, 9651, 10004, 29889, 842, 15097, 4197, 2314, 13, 9651, 1583, 3032, 21731, 1451, 9776, 353, 7700, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 13, 1678, 822, 508, 8537, 29898, 1311, 1125, 13, 4706, 736, 5852, 13, 13, 1678, 9995, 13, 1678, 1670, 338, 385, 17986, 4682, 393, 674, 1735, 278, 1206, 310, 278, 3030, 4890, 2729, 373, 278, 1206, 310, 278, 1857, 330, 27026, 29889, 1205, 306, 29915, 29885, 766, 17961, 393, 363, 1286, 29889, 13, 1678, 9995, 13, 1678, 396, 1753, 338, 26214, 29898, 1311, 29892, 330, 1125, 13, 1678, 396, 1678, 1373, 353, 26804, 28627, 29889, 16808, 561, 29906, 5914, 29898, 29887, 29897, 13, 1678, 396, 1678, 565, 7431, 29898, 3090, 29897, 1405, 29871, 29896, 29901, 13, 1678, 396, 4706, 1373, 353, 1373, 29961, 29900, 29962, 13, 1678, 396, 1678, 565, 443, 293, 6797, 532, 29889, 7320, 29898, 3090, 29897, 1275, 525, 24126, 2396, 13, 1678, 396, 4706, 736, 5852, 13, 1678, 396, 1678, 736, 7700, 13, 13, 1678, 396, 1753, 338, 19357, 29898, 1311, 29892, 330, 1125, 13, 1678, 396, 1678, 1373, 353, 26804, 28627, 29889, 16808, 561, 29906, 5914, 29898, 29887, 29897, 13, 1678, 396, 1678, 565, 7431, 29898, 3090, 29897, 1405, 29871, 29896, 29901, 13, 1678, 396, 4706, 1373, 353, 1373, 29961, 29900, 29962, 13, 1678, 396, 1678, 565, 443, 293, 6797, 532, 29889, 7320, 29898, 3090, 29897, 1275, 525, 29931, 29880, 2396, 13, 1678, 396, 4706, 736, 5852, 13, 1678, 396, 1678, 736, 7700, 13, 13, 1678, 822, 679, 25108, 9824, 29898, 1311, 29892, 2224, 1125, 13, 4706, 515, 4240, 1144, 1053, 851, 13, 4706, 363, 285, 297, 1583, 29889, 10154, 29889, 657, 9824, 29879, 7295, 13, 9651, 565, 285, 29889, 2084, 1275, 2224, 29901, 13, 18884, 736, 285, 13, 9651, 25342, 2224, 1275, 851, 29898, 29888, 29889, 3888, 29889, 11922, 1170, 7240, 29908, 15691, 710, 29898, 29888, 29889, 3888, 29889, 3293, 1170, 1125, 13, 18884, 736, 285, 13, 13, 1678, 822, 4216, 10581, 29898, 1311, 29892, 5235, 1125, 13, 4706, 318, 15945, 29908, 8537, 278, 3239, 310, 3342, 330, 27026, 29879, 322, 10866, 29890, 1372, 29889, 29871, 13, 4706, 2522, 744, 338, 3625, 408, 9495, 29889, 7052, 1213, 15945, 308, 13, 4706, 1776, 353, 1583, 29889, 657, 1043, 580, 13, 4706, 565, 451, 1776, 29889, 1493, 10861, 29889, 657, 7295, 13, 9651, 736, 13, 4706, 5445, 353, 679, 17657, 4592, 29898, 1311, 29889, 23397, 10818, 29918, 3738, 2208, 29892, 5852, 29897, 13, 4706, 19782, 353, 679, 17657, 4592, 29898, 1311, 29889, 23397, 10818, 29918, 1254, 1672, 6059, 29892, 5852, 29897, 13, 4706, 5445, 2780, 353, 679, 17657, 4592, 3306, 29898, 1311, 29889, 23397, 10818, 29918, 3738, 2208, 15032, 1955, 29892, 1583, 29889, 29943, 9818, 29933, 11375, 29918, 3738, 2208, 15032, 1955, 29897, 13, 13, 308, 13, 4706, 330, 27026, 353, 5235, 29889, 657, 877, 16808, 561, 1495, 13, 4706, 565, 330, 27026, 338, 451, 6213, 29901, 13, 9651, 1857, 353, 330, 27026, 29889, 657, 9780, 580, 13, 4706, 1683, 29901, 13, 9651, 1857, 353, 1583, 29889, 10154, 29889, 657, 7583, 9824, 580, 13, 4706, 565, 330, 27026, 338, 6213, 470, 1857, 338, 6213, 29901, 13, 9651, 736, 29871, 13, 4706, 7595, 353, 1583, 29889, 657, 14658, 580, 13, 308, 13, 4706, 396, 3617, 278, 23849, 515, 278, 1051, 322, 1074, 565, 896, 526, 4629, 29889, 13, 4706, 2752, 6913, 353, 1583, 29889, 657, 4435, 9824, 29879, 580, 13, 4706, 1510, 9824, 29879, 353, 5159, 13, 4706, 363, 2944, 297, 2752, 6913, 29901, 13, 9651, 565, 451, 2944, 1839, 4882, 2033, 29901, 13, 18884, 6773, 13, 9651, 2224, 353, 2944, 1839, 2084, 2033, 13, 9651, 4079, 353, 1583, 29889, 657, 25108, 9824, 29898, 2084, 29897, 13, 9651, 1510, 9824, 29879, 29889, 4397, 29898, 5657, 29897, 13, 308, 13, 4706, 565, 1776, 29889, 1493, 7583, 29889, 657, 580, 322, 1857, 451, 297, 1510, 9824, 29879, 29901, 13, 9651, 1510, 9824, 29879, 29889, 4397, 29898, 3784, 29897, 13, 268, 13, 4706, 363, 4079, 297, 1510, 9824, 29879, 29901, 13, 9651, 1583, 29889, 5589, 3306, 29889, 842, 20876, 580, 13, 9651, 1583, 29889, 25893, 3306, 29889, 842, 855, 10946, 580, 13, 632, 13, 9651, 3030, 18743, 29892, 3030, 7583, 29892, 3030, 13555, 353, 1583, 29889, 657, 2677, 29879, 580, 13, 632, 13, 9651, 565, 4079, 338, 451, 6213, 29901, 1678, 13, 18884, 3030, 18743, 353, 6219, 1626, 29898, 4703, 18743, 29892, 323, 29990, 29889, 8546, 287, 29898, 5657, 467, 2523, 356, 1469, 29892, 323, 29990, 29889, 8546, 287, 29898, 5657, 467, 13155, 29897, 13, 18884, 3030, 18743, 353, 518, 5657, 29961, 29887, 978, 29962, 363, 330, 978, 297, 3030, 18743, 565, 330, 978, 297, 4079, 29889, 8149, 580, 29962, 13, 18884, 3030, 13555, 353, 6219, 1626, 29898, 4703, 13555, 29892, 323, 29990, 29889, 8546, 287, 29898, 5657, 467, 2523, 356, 1469, 29892, 323, 29990, 29889, 8546, 287, 29898, 5657, 467, 13155, 29897, 13, 18884, 3030, 13555, 353, 518, 5657, 29961, 29887, 978, 29962, 363, 330, 978, 297, 3030, 13555, 565, 330, 978, 297, 4079, 29889, 8149, 580, 29962, 13, 18884, 3030, 7583, 353, 6219, 1626, 29898, 4703, 7583, 29892, 323, 29990, 29889, 8546, 287, 29898, 5657, 467, 2523, 356, 1469, 29892, 323, 29990, 29889, 8546, 287, 29898, 5657, 467, 13155, 29897, 13, 18884, 565, 7431, 29898, 4703, 7583, 29897, 1405, 29871, 29900, 29901, 13, 462, 1678, 3030, 7583, 353, 518, 5657, 29961, 29887, 978, 29962, 363, 330, 978, 297, 518, 4703, 7583, 29961, 29900, 5262, 565, 330, 978, 297, 4079, 29889, 8149, 580, 29962, 13, 462, 1678, 565, 7431, 29898, 4703, 7583, 29897, 1405, 29871, 29900, 29901, 13, 462, 4706, 2752, 29954, 27026, 353, 3030, 7583, 29961, 29900, 29962, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 2752, 29954, 27026, 353, 6213, 13, 18884, 25342, 330, 27026, 29889, 978, 297, 4079, 29889, 8149, 7295, 13, 462, 1678, 2752, 29954, 27026, 353, 4079, 29961, 16808, 561, 29889, 978, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 2752, 29954, 27026, 353, 6213, 4706, 13, 462, 13, 18884, 9995, 13, 18884, 396, 8439, 338, 385, 17986, 4682, 393, 674, 1735, 278, 1206, 310, 278, 3030, 4890, 2729, 373, 278, 1206, 310, 278, 1857, 330, 27026, 29889, 1205, 306, 29915, 29885, 766, 17961, 393, 363, 1286, 29889, 13, 462, 13, 18884, 565, 1776, 29889, 4703, 29965, 392, 29880, 29883, 29889, 657, 7295, 13, 462, 1678, 1206, 13372, 353, 6213, 13, 462, 1678, 565, 1583, 29889, 275, 26214, 29898, 16808, 561, 1125, 13, 462, 4706, 1206, 13372, 353, 10928, 28627, 29889, 2523, 2631, 29889, 657, 26214, 4591, 19357, 13, 462, 1678, 25342, 1583, 29889, 275, 19357, 29898, 16808, 561, 1125, 13, 462, 4706, 1206, 13372, 353, 10928, 28627, 29889, 2523, 2631, 29889, 657, 19357, 4591, 26214, 13, 462, 1678, 565, 1206, 13372, 29901, 13, 462, 4706, 363, 474, 29892, 330, 297, 26985, 29898, 4703, 18743, 1125, 13, 462, 9651, 716, 29954, 353, 1206, 13372, 29898, 29887, 29897, 13, 462, 9651, 565, 716, 29954, 338, 451, 6213, 29901, 13, 462, 18884, 3030, 18743, 29961, 29875, 29962, 353, 716, 29954, 13, 462, 4706, 716, 29954, 353, 1206, 13372, 29898, 4993, 29954, 27026, 29897, 13, 462, 4706, 565, 716, 29954, 338, 451, 6213, 29901, 13, 462, 9651, 2752, 29954, 27026, 353, 716, 29954, 13, 462, 1678, 565, 1206, 13372, 29901, 13, 462, 4706, 363, 474, 29892, 330, 297, 26985, 29898, 4703, 13555, 1125, 13, 462, 9651, 716, 29954, 353, 1206, 13372, 29898, 29887, 29897, 13, 462, 9651, 565, 716, 29954, 338, 451, 6213, 29901, 13, 462, 18884, 3030, 13555, 29961, 29875, 29962, 353, 716, 29954, 259, 13, 18884, 9995, 462, 539, 13, 462, 462, 3986, 13, 18884, 6287, 29898, 3784, 29889, 3888, 29889, 348, 1169, 5894, 6026, 29914, 7411, 29898, 5657, 29889, 3888, 29889, 348, 1169, 5894, 6026, 876, 13, 462, 29871, 13, 18884, 2920, 10302, 353, 29871, 29900, 13, 18884, 565, 2752, 29954, 27026, 338, 451, 6213, 29901, 13, 462, 1678, 565, 7595, 1275, 525, 5064, 2396, 13, 462, 4706, 2731, 13409, 353, 5785, 29898, 16808, 561, 29889, 2103, 29914, 29906, 29897, 847, 1857, 29889, 3888, 29889, 348, 1169, 5894, 6026, 13, 462, 4706, 2752, 13409, 353, 5785, 29898, 4993, 29954, 27026, 29889, 2103, 29914, 29906, 29897, 847, 4079, 29889, 3888, 29889, 348, 1169, 5894, 6026, 13, 462, 4706, 2920, 10302, 353, 313, 7854, 13409, 29899, 4993, 13409, 29897, 334, 4079, 29889, 3888, 29889, 348, 1169, 5894, 6026, 13, 462, 1678, 25342, 7595, 1275, 525, 1266, 2396, 13, 462, 4706, 2920, 10302, 353, 313, 313, 29871, 330, 27026, 29889, 2103, 847, 330, 27026, 29889, 657, 9780, 2141, 3888, 29889, 348, 1169, 5894, 6026, 1723, 448, 313, 4993, 29954, 27026, 29889, 2103, 847, 2752, 29954, 27026, 29889, 657, 9780, 2141, 3888, 29889, 348, 1169, 5894, 6026, 1723, 1723, 334, 4079, 29889, 3888, 29889, 348, 1169, 5894, 6026, 13, 18884, 14240, 29898, 2103, 10302, 29892, 29871, 29900, 29897, 13, 462, 13, 18884, 3517, 29954, 27026, 353, 2752, 29954, 27026, 13, 18884, 3030, 18743, 29889, 24244, 580, 13, 18884, 3001, 6110, 353, 29871, 29900, 13, 18884, 363, 474, 29892, 26324, 29954, 27026, 297, 26985, 29898, 4703, 18743, 1125, 13, 462, 1678, 413, 824, 1917, 353, 29871, 29900, 13, 462, 1678, 565, 3517, 29954, 27026, 338, 451, 6213, 322, 3517, 29954, 27026, 29889, 657, 9780, 580, 1275, 26324, 29954, 27026, 29889, 657, 9780, 7295, 13, 462, 4706, 396, 853, 9342, 304, 5039, 403, 413, 824, 292, 29889, 830, 339, 2658, 10928, 28627, 29889, 13, 462, 4706, 396, 22178, 1917, 4619, 10928, 28627, 29889, 22178, 292, 29889, 23433, 3552, 24957, 29954, 27026, 29889, 978, 29892, 26324, 29954, 27026, 29889, 978, 511, 4079, 29889, 22178, 292, 29892, 4079, 29889, 13155, 29897, 13, 462, 4706, 413, 824, 1917, 4619, 29871, 29900, 13, 462, 308, 13, 462, 1678, 14240, 6278, 10702, 29954, 27026, 29889, 2103, 29899, 22178, 1917, 29892, 29871, 29900, 29897, 13, 462, 1678, 3001, 6110, 4619, 26324, 29954, 27026, 29889, 2103, 718, 413, 824, 1917, 13, 462, 1678, 4216, 29954, 27026, 2605, 353, 323, 29990, 29889, 8546, 287, 29898, 10702, 29954, 27026, 467, 657, 1123, 26081, 703, 1753, 535, 2052, 13117, 29889, 29940, 1744, 6096, 631, 2605, 1159, 13, 462, 1678, 565, 1776, 29889, 5589, 29889, 657, 7295, 13, 462, 4706, 4216, 29954, 27026, 2605, 29889, 5589, 580, 13, 462, 1678, 565, 1776, 29889, 25893, 29889, 657, 7295, 13, 462, 4706, 19782, 29637, 2605, 29898, 4012, 29954, 27026, 2605, 29897, 13, 462, 1678, 3517, 29954, 27026, 353, 26324, 29954, 27026, 13, 18884, 14240, 29898, 7827, 6110, 29892, 29871, 29900, 29897, 13, 462, 13, 18884, 3001, 6110, 353, 29871, 29900, 13, 18884, 3030, 7583, 2855, 13555, 353, 518, 4993, 29954, 27026, 10062, 4703, 13555, 13, 13, 18884, 363, 474, 29892, 26324, 29954, 27026, 297, 26985, 29898, 4703, 7583, 2855, 13555, 1125, 13, 462, 1678, 565, 26324, 29954, 27026, 338, 6213, 29901, 13, 462, 4706, 26324, 29954, 27026, 353, 2752, 29954, 27026, 13, 462, 1678, 2446, 29954, 27026, 353, 6213, 13, 462, 1678, 565, 474, 718, 29871, 29896, 529, 7431, 29898, 4703, 7583, 2855, 13555, 1125, 13, 462, 4706, 2446, 29954, 27026, 353, 3030, 7583, 2855, 13555, 29961, 29875, 29974, 29896, 29962, 13, 462, 1678, 565, 313, 29875, 1275, 29871, 29900, 322, 26324, 29954, 27026, 1275, 330, 27026, 29897, 470, 2752, 29954, 27026, 338, 6213, 29901, 13, 462, 4706, 1209, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 4216, 29954, 27026, 2605, 353, 323, 29990, 29889, 8546, 287, 29898, 10702, 29954, 27026, 467, 657, 1123, 26081, 703, 1753, 535, 2052, 13117, 29889, 29940, 1744, 6096, 631, 2605, 1159, 13, 462, 4706, 565, 1776, 29889, 5589, 29889, 657, 7295, 13, 462, 9651, 4216, 29954, 27026, 2605, 29889, 5589, 580, 13, 462, 4706, 565, 1776, 29889, 25893, 29889, 657, 7295, 13, 462, 9651, 19782, 29637, 2605, 29898, 4012, 29954, 27026, 2605, 29897, 13, 462, 1678, 413, 824, 1917, 353, 29871, 29900, 13, 462, 268, 13, 462, 1678, 565, 26324, 29954, 27026, 338, 451, 6213, 322, 2446, 29954, 27026, 338, 451, 6213, 322, 2446, 29954, 27026, 29889, 657, 9780, 580, 1275, 26324, 29954, 27026, 29889, 657, 9780, 7295, 13, 462, 4706, 396, 22178, 1917, 353, 10928, 28627, 29889, 22178, 292, 29889, 23433, 3552, 10702, 29954, 27026, 29889, 978, 29892, 2446, 29954, 27026, 29889, 978, 511, 4079, 29889, 22178, 292, 29892, 4079, 29889, 13155, 29897, 13, 462, 4706, 396, 853, 9342, 304, 5039, 403, 413, 824, 292, 29889, 830, 339, 2658, 10928, 28627, 29889, 13, 462, 4706, 413, 824, 1917, 353, 29871, 29900, 13, 462, 268, 13, 462, 1678, 2920, 353, 29871, 29900, 13, 462, 1678, 565, 26324, 29954, 27026, 338, 451, 6213, 29901, 13, 462, 4706, 2920, 353, 26324, 29954, 27026, 29889, 2103, 13, 462, 1678, 14240, 29898, 2103, 29974, 22178, 1917, 29892, 29871, 29900, 29897, 13, 462, 1678, 3001, 6110, 4619, 2920, 718, 413, 824, 1917, 13, 462, 1678, 3517, 29954, 27026, 353, 26324, 29954, 27026, 13, 462, 13, 18884, 14240, 6278, 7827, 6110, 29892, 29871, 29900, 29897, 13, 462, 13, 18884, 14240, 6278, 2103, 10302, 29892, 29871, 29900, 29897, 13, 18884, 6287, 29898, 5657, 29889, 3888, 29889, 348, 1169, 5894, 6026, 29914, 7411, 29898, 3784, 29889, 3888, 29889, 348, 1169, 5894, 6026, 876, 13, 4706, 396, 5060, 487, 580, 13, 268, 13, 1678, 4216, 797, 4925, 353, 4216, 10581, 13, 13, 1678, 822, 1776, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 13, 1678, 822, 679, 4435, 9824, 29879, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 23849, 297, 278, 1051, 29889, 13, 4706, 9995, 13, 4706, 1776, 353, 1583, 29889, 657, 1043, 580, 13, 4706, 736, 1776, 29889, 5657, 1293, 29889, 657, 580, 13, 13, 1678, 822, 731, 4435, 9824, 29879, 29898, 1311, 1125, 13, 4706, 318, 15945, 29908, 13, 4706, 3789, 278, 4079, 1051, 515, 278, 1857, 731, 310, 1722, 23849, 29889, 13, 4706, 9995, 13, 4706, 1776, 353, 1583, 29889, 657, 1043, 580, 13, 4706, 11073, 353, 5159, 13, 4706, 1857, 15097, 353, 5159, 13, 4706, 363, 270, 297, 1583, 29889, 657, 4435, 9824, 29879, 7295, 13, 9651, 565, 270, 1839, 4882, 2033, 29901, 13, 18884, 1857, 15097, 29889, 4397, 29898, 29881, 1839, 2084, 11287, 13, 4706, 363, 4660, 29892, 2224, 29892, 1024, 297, 1583, 29889, 10154, 29889, 657, 9824, 4775, 29879, 7295, 13, 9651, 565, 2224, 297, 1857, 15097, 29901, 13, 18884, 4660, 353, 4629, 14730, 13, 9651, 1683, 29901, 13, 18884, 4660, 353, 6629, 13, 9651, 11073, 29889, 4397, 29898, 8977, 29898, 4882, 29922, 4882, 29892, 2224, 29922, 2084, 29892, 1024, 29922, 978, 876, 13, 4706, 1776, 29889, 5657, 1293, 29889, 842, 29898, 21134, 29897, 13, 13, 1678, 822, 2927, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 9995, 13, 4706, 10726, 278, 2927, 29889, 13, 4706, 9995, 13, 4706, 4629, 3306, 353, 10004, 29889, 657, 580, 13, 4706, 364, 353, 4629, 3306, 29889, 1127, 5308, 580, 13, 4706, 330, 353, 4629, 3306, 29889, 12692, 5308, 580, 13, 4706, 289, 353, 4629, 3306, 29889, 9539, 5308, 580, 13, 4706, 263, 353, 29871, 29896, 13, 4706, 19782, 3306, 353, 3865, 3306, 29889, 2780, 3047, 7856, 4626, 630, 9039, 29918, 12692, 29918, 9539, 29918, 2312, 23538, 29878, 29892, 330, 29892, 289, 29892, 263, 29897, 13, 4706, 731, 17657, 4592, 3306, 29898, 1311, 29889, 23397, 10818, 29918, 3738, 2208, 15032, 1955, 29892, 4629, 3306, 29897, 13, 4706, 731, 17657, 4592, 3306, 29898, 1311, 29889, 23397, 10818, 29918, 1254, 1672, 6059, 15032, 1955, 29892, 19782, 3306, 29897, 13, 4706, 1583, 29889, 5589, 3306, 353, 4629, 3306, 13, 4706, 1583, 29889, 25893, 3306, 353, 19782, 3306, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 13, 1678, 822, 5445, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 9995, 13, 4706, 10726, 278, 5445, 4660, 29889, 13, 4706, 9995, 13, 4706, 731, 17657, 4592, 29898, 1311, 29889, 23397, 10818, 29918, 3738, 2208, 29892, 10004, 29889, 657, 3101, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 13, 1678, 822, 19782, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 9995, 13, 4706, 10726, 278, 19782, 4660, 29889, 13, 4706, 9995, 13, 4706, 731, 17657, 4592, 29898, 1311, 29889, 23397, 10818, 29918, 1254, 1672, 6059, 29892, 10004, 29889, 657, 3101, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 13, 1678, 822, 7595, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 9995, 13, 4706, 10726, 278, 22239, 4660, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 13, 1678, 822, 679, 14658, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 22239, 408, 263, 1347, 29889, 13, 4706, 9995, 13, 4706, 1776, 353, 1583, 29889, 657, 1043, 580, 13, 4706, 2380, 353, 1776, 29889, 2520, 29889, 657, 580, 13, 4706, 565, 2380, 1275, 29871, 29900, 29901, 13, 9651, 736, 525, 1563, 29915, 13, 4706, 25342, 2380, 1275, 29871, 29896, 29901, 13, 9651, 736, 525, 5064, 29915, 13, 4706, 25342, 2380, 1275, 29871, 29906, 29901, 13, 9651, 736, 525, 1266, 29915, 13, 13, 1678, 822, 2767, 1043, 29898, 1311, 29892, 10004, 29922, 8516, 1125, 13, 4706, 10318, 7583, 29954, 27026, 1043, 580, 13, 13, 1678, 822, 3474, 11123, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 1583, 29889, 311, 11236, 403, 7355, 580, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 4706, 7399, 5907, 2956, 29889, 7165, 11123, 10717, 29898, 1311, 29892, 10004, 29897, 13, 13, 1678, 822, 679, 9824, 6913, 29898, 1311, 29892, 2767, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 3617, 599, 23849, 297, 263, 982, 393, 508, 367, 731, 964, 263, 1109, 2911, 1051, 29889, 13, 4706, 9995, 13, 4706, 10898, 353, 731, 580, 396, 3789, 310, 599, 5412, 10898, 297, 278, 2778, 2710, 8857, 13, 4706, 4452, 2059, 1170, 353, 6571, 13, 4706, 565, 2767, 29901, 396, 960, 2767, 7353, 338, 731, 29892, 769, 3013, 278, 5923, 4629, 23849, 29889, 13, 9651, 363, 2944, 297, 1583, 29889, 657, 4435, 9824, 29879, 7295, 13, 18884, 565, 2944, 1839, 4882, 2033, 29901, 13, 462, 1678, 4452, 2059, 1170, 29961, 667, 1839, 978, 2033, 29962, 353, 2944, 13, 4706, 1857, 5709, 267, 353, 6571, 13, 4706, 565, 756, 5552, 29898, 1311, 29889, 657, 1043, 3285, 525, 5657, 1293, 29374, 13, 9651, 363, 270, 297, 1583, 29889, 657, 4435, 9824, 29879, 7295, 13, 18884, 1857, 5709, 267, 29961, 29881, 1839, 2084, 2033, 29962, 353, 270, 1839, 4882, 2033, 13, 13, 4706, 363, 4660, 29892, 2224, 29892, 5412, 1170, 297, 1583, 29889, 10154, 29889, 657, 9824, 4775, 29879, 7295, 13, 9651, 565, 2224, 297, 1857, 5709, 267, 29901, 13, 18884, 4660, 353, 1857, 5709, 267, 29961, 2084, 29962, 13, 9651, 1683, 29901, 13, 18884, 4660, 353, 4629, 14730, 13, 13, 9651, 565, 451, 5412, 1170, 297, 4452, 2059, 1170, 29889, 8149, 7295, 29937, 960, 372, 338, 451, 2307, 727, 29892, 788, 445, 304, 278, 1051, 13, 18884, 4452, 2059, 1170, 29961, 13092, 1170, 29962, 353, 9657, 29898, 4882, 29922, 4882, 29892, 2224, 29922, 2084, 29892, 1024, 29922, 13092, 1170, 29897, 13, 4706, 4079, 1293, 353, 5159, 13, 4706, 363, 1820, 29892, 2944, 297, 12705, 29898, 7076, 2059, 1170, 29889, 7076, 580, 1125, 13, 9651, 4079, 1293, 29889, 4397, 29898, 667, 29897, 13, 4706, 736, 4079, 1293, 13, 268, 13, 1678, 835, 7346, 4136, 29937, 13, 1678, 396, 8707, 4330, 29990, 9375, 13, 1678, 835, 7346, 4136, 29937, 13, 268, 13, 1678, 822, 679, 2677, 29879, 29898, 1311, 1125, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 4703, 18743, 29374, 13, 9651, 1583, 29889, 4703, 18743, 353, 6629, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 4703, 13555, 29374, 13, 9651, 1583, 29889, 4703, 13555, 353, 6629, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 4703, 7583, 29374, 13, 9651, 1583, 29889, 4703, 7583, 353, 6213, 13, 4706, 736, 1583, 29889, 4703, 18743, 29892, 1583, 29889, 4703, 7583, 29892, 1583, 29889, 4703, 13555, 13, 308, 13, 1678, 822, 731, 2677, 29879, 29898, 1311, 29892, 3030, 18743, 29892, 3030, 7583, 29892, 3030, 13555, 1125, 13, 308, 13, 4706, 1583, 29889, 4703, 18743, 353, 3030, 18743, 13, 4706, 1583, 29889, 4703, 7583, 353, 3030, 7583, 13, 4706, 1583, 29889, 4703, 13555, 353, 3030, 13555, 13, 308, 13, 1678, 822, 3030, 6103, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 1434, 353, 1583, 29889, 657, 1043, 2141, 4703, 18743, 29889, 657, 580, 13, 4706, 1857, 353, 1583, 29889, 657, 1043, 2141, 4703, 7583, 29889, 657, 580, 470, 6213, 13, 4706, 1156, 353, 1583, 29889, 657, 1043, 2141, 4703, 13555, 29889, 657, 580, 13, 4706, 1583, 29889, 842, 2677, 29879, 29898, 11083, 29892, 1857, 29892, 1156, 29897, 13, 4706, 1583, 29889, 5504, 1043, 580, 13, 632, 13, 1678, 822, 3030, 7583, 6103, 10717, 29898, 1311, 29892, 10004, 1125, 13, 4706, 396, 361, 10004, 29889, 657, 7295, 13, 9651, 396, 15452, 29889, 842, 29898, 15452, 29889, 657, 580, 29961, 29900, 2314, 13, 4706, 1583, 29889, 4703, 6103, 10717, 29898, 15452, 29897, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 268, 13, 1678, 6811, 8387, 29965, 5800, 29879, 580, 2 ]
myy/accounts/admin.py
ramadevim/Travel-website
0
34318
from django.contrib import admin # Register your models here. from .models import Register admin.site.register(Register)
[ 1, 515, 9557, 29889, 21570, 1053, 4113, 13, 13, 29937, 12577, 596, 4733, 1244, 29889, 13, 3166, 869, 9794, 1053, 12577, 13, 13, 6406, 29889, 2746, 29889, 9573, 29898, 15213, 29897, 2 ]
server/utils.py
caesuric/cardrpg-public
1
119872
import random import struct # from numba import jit from constants import * # @jit def serialize_list(list): return_list = [] for i in list: if i!=None: return_list.append(i.to_JSON()) else: return_list.append(None) return return_list def serialize_char_list(list, main_char): return_list = [] for i in list: if i!=None and i==main_char: return_list.append(i.to_JSON()) elif i!=None: return_list.append(i.to_JSON_light()) else: return_list.append(None) return return_list def serialize_char_list_full(list, main_char): return_list = [] for i in list: if i!=None and i==main_char: return_list.append(i.to_JSON_first()) elif i!=None: return_list.append(i.to_JSON_light_first()) else: return_list.append(None) return return_list def serialize_char_list_to_binary(list, main_char): data = struct.pack('!I',len(list)) for i in list: if i!=None and i==main_char: data += struct.pack('cc','F','F') data += i.to_binary() elif i!=None: data += struct.pack('cc','T','F') data += i.to_binary_light() return data def serialize_char_list_to_binary_full(list, main_char): data = struct.pack('!I',len(list)) for i in list: if i!=None and i==main_char: data += struct.pack('cc','F','T') data += i.to_binary_first() elif i!=None: data += struct.pack('cc','T','T') data += i.to_binary_light_first() return data # @jit def serialize_2d_boolean_list(list): return_list = [] for i in list: return_sub_list = [] for j in i: if j: return_sub_list.append('T') else: return_sub_list.append('F') return_list.append(return_sub_list) return return_list neighbors_has_run = False neighbors_answers = {} # @jit def neighbors(source,mob,game,char,step=tile_size): if not neighbors_has_run: run_neighbors(game, step=step) x,y=source return neighbors_answers[(x,y)] # @jit def run_neighbors(game, step=tile_size): global neighbors_has_run global neighbors_answers for x in range(0,(tile_size*8)*4,step): for y in range(0,(tile_size*8)*4,step): value = [] value = neighbors_step(x+step,y,value,game) value = neighbors_step(x-step,y,value,game) value = neighbors_step(x,y+step,value,game) value = neighbors_step(x,y-step,value,game) neighbors_answers[(x,y)] = value neighbors_has_run = True # @jit def classic_neighbors(source, mob, game, char, step=tile_size): x,y=source value = [] value = classic_neighbors_step(x+step,y,value,mob,game,char) value = classic_neighbors_step(x-step,y,value,mob,game,char) value = classic_neighbors_step(x,y+step,value,mob,game,char) value = classic_neighbors_step(x,y-step,value,mob,game,char) return value # @jit def neighbors_step(x,y,value,game): if not game.is_wall(x,y): if not game.is_door(x,y): value.append((x,y)) return value # @jit def classic_neighbors_step(x,y,value,mob,game,char): if not game.is_wall(x,y): if not game.is_door(x,y): if not game.is_collision_mobs_only(x,y,mob): value.append((x,y)) return value def neighbors_idle(source, mob, game, dest_x, dest_y, step=tile_size): x,y=source value = [] value = neighbors_idle_step(x+step,y,value,mob,game,dest_x,dest_y) value = neighbors_idle_step(x-step,y,value,mob,game,dest_x,dest_y) value = neighbors_idle_step(x,y+step,value,mob,game,dest_x,dest_y) value = neighbors_idle_step(x,y-step,value,mob,game,dest_x,dest_y) return value def neighbors_idle_step(x,y,value,mob,game,dest_x,dest_y): if not game.is_wall(x,y): if not game.is_door(x,y): if not game.is_collision_mobs_only(x,y,mob): value.append((x,y)) return value def neighbors_sound(source, game, step = tile_size): x,y=source value = [] value = neighbors_sound_step(x+step,y,value,game) value = neighbors_sound_step(x-step,y,value,game) value = neighbors_sound_step(x,y+step,value,game) value = neighbors_sound_step(x,y-step,value,game) return value def neighbors_sound_step(x,y,value,game): if not game.is_wall(x,y): if not game.is_door(x,y): value.append((x,y)) return value # @jit def monster_in_way(mob,game,x,y): return game.is_collision_mobs_only(x,y,mob) # @jit def move_cost(src,dest): x1,y1 = src x2,y2 = dest return abs(x1-x2)+abs(y1-y2) # return max(abs(x1-x2),abs(y1-y2)) # @jit def heuristic(a,b): (x1,y1)=a (x2,y2)=b return abs(x1-x2)+abs(y1-y2) # return max(abs(x1-x2),abs(y1-y2)) # @jit def random_drop(): # roll = random.randint(1,48) # return random_drop_table[roll] return random.randint(0,10) # random_drop_table = [0,0,0,0,0,0,0,0,1,1,1,2,3,4,5,6,6,6,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,10,11,12,13,13,13,13,13,13,13,14,14,14,15,16] def set_up_empty_2d_array(length,filler=''): value = [] for x in range(length): column = [] for y in range(length): column.append(filler) value.append(column) return value # @jit def count_table_items(table): count = 0 for element in table: if element: count+=int(element) return count # @jit def humanize_time(time): seconds = int(time/60) decimal = time-(seconds*60) decimal = float(decimal) / float(60) time = float(seconds) + decimal return "%.2f" % time def tiles_to_binary(tiles): data = struct.pack('!I',len(tiles)/3) i = 0 while i<len(tiles): data += struct.pack('!IIc',tiles[i],tiles[i+1],str(tiles[i+2])) i+=3 return data def sight_to_binary(sight): data = struct.pack('!I',len(sight)/3) i = 0 while i<len(sight): data += struct.pack('!IIc',sight[i],sight[i+1],boolean_to_char(sight[i+2])) i+=3 return data def effects_to_binary(effects): data = struct.pack('!I',len(effects)) for item in effects: data += struct.pack('!H',item) return data def effects_duration_to_binary(durations): data = struct.pack('!I',len(durations)) for item in durations: data += struct.pack('!I',item) return data def string_array_to_binary(array): data = struct.pack('!I',len(array)) for item in array: data += struct.pack('15s',item) return data def animations_to_binary(animations): data = struct.pack('!I',len(animations)) for item in animations: items = item.split(',') data += struct.pack('!IIII7s',int(items[0]),int(items[1]),int(items[2]),int(items[3]),items[4]) return data def serialize_list_as_binary(items): data = struct.pack('!I',len(items)) for item in items: data += item.to_binary() return data def unsigned_integer_array_to_binary(array): data = struct.pack('!I',len(array)) for item in array: data += struct.pack('!I',item) return data def boolean_array_to_binary(array): data = struct.pack('!I',len(array)) for item in array: data += struct.pack('c',boolean_to_char(item)) return data def boolean_to_char(value): if value: return 'T' return 'F'
[ 1, 1053, 4036, 13, 5215, 2281, 13, 29937, 515, 954, 2291, 1053, 432, 277, 13, 13, 3166, 17727, 1053, 334, 13, 13, 29937, 732, 29926, 277, 13, 1753, 28755, 29918, 1761, 29898, 1761, 1125, 13, 1678, 736, 29918, 1761, 353, 5159, 13, 1678, 363, 474, 297, 1051, 29901, 13, 4706, 565, 474, 19216, 8516, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 29875, 29889, 517, 29918, 7249, 3101, 13, 4706, 1683, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 8516, 29897, 13, 1678, 736, 736, 29918, 1761, 13, 1753, 28755, 29918, 3090, 29918, 1761, 29898, 1761, 29892, 1667, 29918, 3090, 1125, 13, 1678, 736, 29918, 1761, 353, 5159, 13, 1678, 363, 474, 297, 1051, 29901, 13, 4706, 565, 474, 19216, 8516, 322, 474, 1360, 3396, 29918, 3090, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 29875, 29889, 517, 29918, 7249, 3101, 13, 4706, 25342, 474, 19216, 8516, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 29875, 29889, 517, 29918, 7249, 29918, 4366, 3101, 13, 4706, 1683, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 8516, 29897, 13, 1678, 736, 736, 29918, 1761, 13, 1753, 28755, 29918, 3090, 29918, 1761, 29918, 8159, 29898, 1761, 29892, 1667, 29918, 3090, 1125, 13, 1678, 736, 29918, 1761, 353, 5159, 13, 1678, 363, 474, 297, 1051, 29901, 13, 4706, 565, 474, 19216, 8516, 322, 474, 1360, 3396, 29918, 3090, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 29875, 29889, 517, 29918, 7249, 29918, 4102, 3101, 13, 4706, 25342, 474, 19216, 8516, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 29875, 29889, 517, 29918, 7249, 29918, 4366, 29918, 4102, 3101, 13, 4706, 1683, 29901, 13, 9651, 736, 29918, 1761, 29889, 4397, 29898, 8516, 29897, 13, 1678, 736, 736, 29918, 1761, 13, 1753, 28755, 29918, 3090, 29918, 1761, 29918, 517, 29918, 19541, 29898, 1761, 29892, 1667, 29918, 3090, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 1761, 876, 13, 1678, 363, 474, 297, 1051, 29901, 13, 4706, 565, 474, 19216, 8516, 322, 474, 1360, 3396, 29918, 3090, 29901, 13, 9651, 848, 4619, 2281, 29889, 4058, 877, 617, 3788, 29943, 3788, 29943, 1495, 13, 9651, 848, 4619, 474, 29889, 517, 29918, 19541, 580, 13, 4706, 25342, 474, 19216, 8516, 29901, 13, 9651, 848, 4619, 2281, 29889, 4058, 877, 617, 3788, 29911, 3788, 29943, 1495, 13, 9651, 848, 4619, 474, 29889, 517, 29918, 19541, 29918, 4366, 580, 13, 1678, 736, 848, 13, 1753, 28755, 29918, 3090, 29918, 1761, 29918, 517, 29918, 19541, 29918, 8159, 29898, 1761, 29892, 1667, 29918, 3090, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 1761, 876, 13, 1678, 363, 474, 297, 1051, 29901, 13, 4706, 565, 474, 19216, 8516, 322, 474, 1360, 3396, 29918, 3090, 29901, 13, 9651, 848, 4619, 2281, 29889, 4058, 877, 617, 3788, 29943, 3788, 29911, 1495, 13, 9651, 848, 4619, 474, 29889, 517, 29918, 19541, 29918, 4102, 580, 13, 4706, 25342, 474, 19216, 8516, 29901, 13, 9651, 848, 4619, 2281, 29889, 4058, 877, 617, 3788, 29911, 3788, 29911, 1495, 13, 9651, 848, 4619, 474, 29889, 517, 29918, 19541, 29918, 4366, 29918, 4102, 580, 13, 1678, 736, 848, 13, 29937, 732, 29926, 277, 13, 1753, 28755, 29918, 29906, 29881, 29918, 20054, 29918, 1761, 29898, 1761, 1125, 13, 1678, 736, 29918, 1761, 353, 5159, 13, 1678, 363, 474, 297, 1051, 29901, 13, 4706, 736, 29918, 1491, 29918, 1761, 353, 5159, 13, 4706, 363, 432, 297, 474, 29901, 13, 9651, 565, 432, 29901, 13, 18884, 736, 29918, 1491, 29918, 1761, 29889, 4397, 877, 29911, 1495, 13, 9651, 1683, 29901, 13, 18884, 736, 29918, 1491, 29918, 1761, 29889, 4397, 877, 29943, 1495, 13, 4706, 736, 29918, 1761, 29889, 4397, 29898, 2457, 29918, 1491, 29918, 1761, 29897, 13, 1678, 736, 736, 29918, 1761, 13, 484, 1141, 29890, 943, 29918, 5349, 29918, 3389, 353, 7700, 13, 484, 1141, 29890, 943, 29918, 550, 17538, 353, 6571, 13, 29937, 732, 29926, 277, 13, 1753, 22092, 943, 29898, 4993, 29892, 29885, 711, 29892, 11802, 29892, 3090, 29892, 10568, 29922, 29873, 488, 29918, 2311, 1125, 13, 1678, 565, 451, 22092, 943, 29918, 5349, 29918, 3389, 29901, 13, 4706, 1065, 29918, 484, 1141, 29890, 943, 29898, 11802, 29892, 4331, 29922, 10568, 29897, 13, 1678, 921, 29892, 29891, 29922, 4993, 13, 1678, 736, 22092, 943, 29918, 550, 17538, 15625, 29916, 29892, 29891, 4638, 13, 29937, 732, 29926, 277, 13, 1753, 1065, 29918, 484, 1141, 29890, 943, 29898, 11802, 29892, 4331, 29922, 29873, 488, 29918, 2311, 1125, 13, 1678, 5534, 22092, 943, 29918, 5349, 29918, 3389, 13, 1678, 5534, 22092, 943, 29918, 550, 17538, 13, 1678, 363, 921, 297, 3464, 29898, 29900, 22657, 29873, 488, 29918, 2311, 29930, 29947, 11877, 29946, 29892, 10568, 1125, 13, 4706, 363, 343, 297, 3464, 29898, 29900, 22657, 29873, 488, 29918, 2311, 29930, 29947, 11877, 29946, 29892, 10568, 1125, 13, 9651, 995, 353, 5159, 13, 9651, 995, 353, 22092, 943, 29918, 10568, 29898, 29916, 29974, 10568, 29892, 29891, 29892, 1767, 29892, 11802, 29897, 13, 9651, 995, 353, 22092, 943, 29918, 10568, 29898, 29916, 29899, 10568, 29892, 29891, 29892, 1767, 29892, 11802, 29897, 13, 9651, 995, 353, 22092, 943, 29918, 10568, 29898, 29916, 29892, 29891, 29974, 10568, 29892, 1767, 29892, 11802, 29897, 13, 9651, 995, 353, 22092, 943, 29918, 10568, 29898, 29916, 29892, 29891, 29899, 10568, 29892, 1767, 29892, 11802, 29897, 13, 9651, 22092, 943, 29918, 550, 17538, 15625, 29916, 29892, 29891, 4638, 353, 995, 13, 1678, 22092, 943, 29918, 5349, 29918, 3389, 353, 5852, 13, 29937, 732, 29926, 277, 13, 1753, 22037, 29918, 484, 1141, 29890, 943, 29898, 4993, 29892, 22458, 29892, 3748, 29892, 1373, 29892, 4331, 29922, 29873, 488, 29918, 2311, 1125, 13, 1678, 921, 29892, 29891, 29922, 4993, 13, 1678, 995, 353, 5159, 13, 1678, 995, 353, 22037, 29918, 484, 1141, 29890, 943, 29918, 10568, 29898, 29916, 29974, 10568, 29892, 29891, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 3090, 29897, 13, 1678, 995, 353, 22037, 29918, 484, 1141, 29890, 943, 29918, 10568, 29898, 29916, 29899, 10568, 29892, 29891, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 3090, 29897, 13, 1678, 995, 353, 22037, 29918, 484, 1141, 29890, 943, 29918, 10568, 29898, 29916, 29892, 29891, 29974, 10568, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 3090, 29897, 13, 1678, 995, 353, 22037, 29918, 484, 1141, 29890, 943, 29918, 10568, 29898, 29916, 29892, 29891, 29899, 10568, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 3090, 29897, 13, 1678, 736, 995, 13, 29937, 732, 29926, 277, 13, 1753, 22092, 943, 29918, 10568, 29898, 29916, 29892, 29891, 29892, 1767, 29892, 11802, 1125, 13, 1678, 565, 451, 3748, 29889, 275, 29918, 11358, 29898, 29916, 29892, 29891, 1125, 13, 4706, 565, 451, 3748, 29889, 275, 29918, 17433, 29898, 29916, 29892, 29891, 1125, 13, 9651, 995, 29889, 4397, 3552, 29916, 29892, 29891, 876, 13, 1678, 736, 995, 13, 29937, 732, 29926, 277, 13, 1753, 22037, 29918, 484, 1141, 29890, 943, 29918, 10568, 29898, 29916, 29892, 29891, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 3090, 1125, 13, 1678, 565, 451, 3748, 29889, 275, 29918, 11358, 29898, 29916, 29892, 29891, 1125, 13, 4706, 565, 451, 3748, 29889, 275, 29918, 17433, 29898, 29916, 29892, 29891, 1125, 13, 9651, 565, 451, 3748, 29889, 275, 29918, 22017, 2459, 29918, 29885, 26290, 29918, 6194, 29898, 29916, 29892, 29891, 29892, 29885, 711, 1125, 13, 18884, 995, 29889, 4397, 3552, 29916, 29892, 29891, 876, 13, 1678, 736, 995, 13, 1753, 22092, 943, 29918, 333, 280, 29898, 4993, 29892, 22458, 29892, 3748, 29892, 2731, 29918, 29916, 29892, 2731, 29918, 29891, 29892, 4331, 29922, 29873, 488, 29918, 2311, 1125, 13, 1678, 921, 29892, 29891, 29922, 4993, 13, 1678, 995, 353, 5159, 13, 1678, 995, 353, 22092, 943, 29918, 333, 280, 29918, 10568, 29898, 29916, 29974, 10568, 29892, 29891, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 7854, 29918, 29916, 29892, 7854, 29918, 29891, 29897, 13, 1678, 995, 353, 22092, 943, 29918, 333, 280, 29918, 10568, 29898, 29916, 29899, 10568, 29892, 29891, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 7854, 29918, 29916, 29892, 7854, 29918, 29891, 29897, 13, 1678, 995, 353, 22092, 943, 29918, 333, 280, 29918, 10568, 29898, 29916, 29892, 29891, 29974, 10568, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 7854, 29918, 29916, 29892, 7854, 29918, 29891, 29897, 13, 1678, 995, 353, 22092, 943, 29918, 333, 280, 29918, 10568, 29898, 29916, 29892, 29891, 29899, 10568, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 7854, 29918, 29916, 29892, 7854, 29918, 29891, 29897, 13, 1678, 736, 995, 13, 1753, 22092, 943, 29918, 333, 280, 29918, 10568, 29898, 29916, 29892, 29891, 29892, 1767, 29892, 29885, 711, 29892, 11802, 29892, 7854, 29918, 29916, 29892, 7854, 29918, 29891, 1125, 13, 1678, 565, 451, 3748, 29889, 275, 29918, 11358, 29898, 29916, 29892, 29891, 1125, 13, 4706, 565, 451, 3748, 29889, 275, 29918, 17433, 29898, 29916, 29892, 29891, 1125, 13, 9651, 565, 451, 3748, 29889, 275, 29918, 22017, 2459, 29918, 29885, 26290, 29918, 6194, 29898, 29916, 29892, 29891, 29892, 29885, 711, 1125, 13, 18884, 995, 29889, 4397, 3552, 29916, 29892, 29891, 876, 13, 1678, 736, 995, 13, 1753, 22092, 943, 29918, 29802, 29898, 4993, 29892, 3748, 29892, 4331, 353, 25900, 29918, 2311, 1125, 13, 1678, 921, 29892, 29891, 29922, 4993, 13, 1678, 995, 353, 5159, 13, 1678, 995, 353, 22092, 943, 29918, 29802, 29918, 10568, 29898, 29916, 29974, 10568, 29892, 29891, 29892, 1767, 29892, 11802, 29897, 13, 1678, 995, 353, 22092, 943, 29918, 29802, 29918, 10568, 29898, 29916, 29899, 10568, 29892, 29891, 29892, 1767, 29892, 11802, 29897, 13, 1678, 995, 353, 22092, 943, 29918, 29802, 29918, 10568, 29898, 29916, 29892, 29891, 29974, 10568, 29892, 1767, 29892, 11802, 29897, 13, 1678, 995, 353, 22092, 943, 29918, 29802, 29918, 10568, 29898, 29916, 29892, 29891, 29899, 10568, 29892, 1767, 29892, 11802, 29897, 13, 1678, 736, 995, 13, 1753, 22092, 943, 29918, 29802, 29918, 10568, 29898, 29916, 29892, 29891, 29892, 1767, 29892, 11802, 1125, 13, 1678, 565, 451, 3748, 29889, 275, 29918, 11358, 29898, 29916, 29892, 29891, 1125, 13, 4706, 565, 451, 3748, 29889, 275, 29918, 17433, 29898, 29916, 29892, 29891, 1125, 13, 9651, 995, 29889, 4397, 3552, 29916, 29892, 29891, 876, 13, 1678, 736, 995, 13, 13, 29937, 732, 29926, 277, 13, 1753, 1601, 2475, 29918, 262, 29918, 1582, 29898, 29885, 711, 29892, 11802, 29892, 29916, 29892, 29891, 1125, 13, 1678, 736, 3748, 29889, 275, 29918, 22017, 2459, 29918, 29885, 26290, 29918, 6194, 29898, 29916, 29892, 29891, 29892, 29885, 711, 29897, 13, 29937, 732, 29926, 277, 13, 1753, 4337, 29918, 18253, 29898, 4351, 29892, 7854, 1125, 13, 1678, 921, 29896, 29892, 29891, 29896, 353, 4765, 13, 1678, 921, 29906, 29892, 29891, 29906, 353, 2731, 13, 1678, 736, 6425, 29898, 29916, 29896, 29899, 29916, 29906, 7240, 6897, 29898, 29891, 29896, 29899, 29891, 29906, 29897, 13, 1678, 396, 736, 4236, 29898, 6897, 29898, 29916, 29896, 29899, 29916, 29906, 511, 6897, 29898, 29891, 29896, 29899, 29891, 29906, 876, 13, 29937, 732, 29926, 277, 13, 1753, 540, 332, 4695, 29898, 29874, 29892, 29890, 1125, 13, 1678, 313, 29916, 29896, 29892, 29891, 29896, 3892, 29874, 13, 1678, 313, 29916, 29906, 29892, 29891, 29906, 3892, 29890, 13, 1678, 736, 6425, 29898, 29916, 29896, 29899, 29916, 29906, 7240, 6897, 29898, 29891, 29896, 29899, 29891, 29906, 29897, 13, 1678, 396, 736, 4236, 29898, 6897, 29898, 29916, 29896, 29899, 29916, 29906, 511, 6897, 29898, 29891, 29896, 29899, 29891, 29906, 876, 13, 29937, 732, 29926, 277, 13, 1753, 4036, 29918, 8865, 7295, 13, 1678, 396, 9679, 353, 4036, 29889, 9502, 524, 29898, 29896, 29892, 29946, 29947, 29897, 13, 1678, 396, 736, 4036, 29918, 8865, 29918, 2371, 29961, 1245, 29962, 13, 1678, 736, 4036, 29889, 9502, 524, 29898, 29900, 29892, 29896, 29900, 29897, 13, 29937, 4036, 29918, 8865, 29918, 2371, 353, 518, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 29892, 29953, 29892, 29953, 29892, 29953, 29892, 29955, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29947, 29892, 29929, 29892, 29896, 29900, 29892, 29896, 29896, 29892, 29896, 29906, 29892, 29896, 29941, 29892, 29896, 29941, 29892, 29896, 29941, 29892, 29896, 29941, 29892, 29896, 29941, 29892, 29896, 29941, 29892, 29896, 29941, 29892, 29896, 29946, 29892, 29896, 29946, 29892, 29896, 29946, 29892, 29896, 29945, 29892, 29896, 29953, 29962, 13, 1753, 731, 29918, 786, 29918, 6310, 29918, 29906, 29881, 29918, 2378, 29898, 2848, 29892, 29888, 5495, 2433, 29374, 13, 1678, 995, 353, 5159, 13, 1678, 363, 921, 297, 3464, 29898, 2848, 1125, 13, 4706, 1897, 353, 5159, 13, 4706, 363, 343, 297, 3464, 29898, 2848, 1125, 13, 9651, 1897, 29889, 4397, 29898, 29888, 5495, 29897, 13, 4706, 995, 29889, 4397, 29898, 4914, 29897, 13, 1678, 736, 995, 13, 29937, 732, 29926, 277, 13, 1753, 2302, 29918, 2371, 29918, 7076, 29898, 2371, 1125, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 363, 1543, 297, 1591, 29901, 13, 4706, 565, 1543, 29901, 13, 9651, 2302, 23661, 524, 29898, 5029, 29897, 13, 1678, 736, 2302, 13, 29937, 732, 29926, 277, 13, 1753, 5199, 675, 29918, 2230, 29898, 2230, 1125, 13, 1678, 6923, 353, 938, 29898, 2230, 29914, 29953, 29900, 29897, 13, 1678, 13677, 353, 931, 17722, 23128, 29930, 29953, 29900, 29897, 13, 1678, 13677, 353, 5785, 29898, 7099, 3039, 29897, 847, 5785, 29898, 29953, 29900, 29897, 13, 1678, 931, 353, 5785, 29898, 23128, 29897, 718, 13677, 13, 1678, 736, 11860, 29889, 29906, 29888, 29908, 1273, 931, 13, 1753, 260, 5475, 29918, 517, 29918, 19541, 29898, 1376, 267, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 1376, 267, 6802, 29941, 29897, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 474, 29966, 2435, 29898, 1376, 267, 1125, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29991, 2687, 29883, 742, 1376, 267, 29961, 29875, 1402, 1376, 267, 29961, 29875, 29974, 29896, 1402, 710, 29898, 1376, 267, 29961, 29875, 29974, 29906, 12622, 13, 4706, 474, 23661, 29941, 13, 1678, 736, 848, 13, 1753, 11126, 29918, 517, 29918, 19541, 29898, 29879, 523, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 29879, 523, 6802, 29941, 29897, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 474, 29966, 2435, 29898, 29879, 523, 1125, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29991, 2687, 29883, 742, 29879, 523, 29961, 29875, 1402, 29879, 523, 29961, 29875, 29974, 29896, 1402, 20054, 29918, 517, 29918, 3090, 29898, 29879, 523, 29961, 29875, 29974, 29906, 12622, 13, 4706, 474, 23661, 29941, 13, 1678, 736, 848, 13, 1753, 9545, 29918, 517, 29918, 19541, 29898, 15987, 29879, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 15987, 29879, 876, 13, 1678, 363, 2944, 297, 9545, 29901, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29991, 29950, 742, 667, 29897, 13, 1678, 736, 848, 13, 1753, 9545, 29918, 19708, 29918, 517, 29918, 19541, 29898, 29881, 332, 800, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 29881, 332, 800, 876, 13, 1678, 363, 2944, 297, 1411, 800, 29901, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29991, 29902, 742, 667, 29897, 13, 1678, 736, 848, 13, 1753, 1347, 29918, 2378, 29918, 517, 29918, 19541, 29898, 2378, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 2378, 876, 13, 1678, 363, 2944, 297, 1409, 29901, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29896, 29945, 29879, 742, 667, 29897, 13, 1678, 736, 848, 13, 1753, 3778, 800, 29918, 517, 29918, 19541, 29898, 11576, 800, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 11576, 800, 876, 13, 1678, 363, 2944, 297, 3778, 800, 29901, 13, 4706, 4452, 353, 2944, 29889, 5451, 29317, 1495, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29991, 2687, 2687, 29955, 29879, 742, 524, 29898, 7076, 29961, 29900, 11724, 524, 29898, 7076, 29961, 29896, 11724, 524, 29898, 7076, 29961, 29906, 11724, 524, 29898, 7076, 29961, 29941, 11724, 7076, 29961, 29946, 2314, 13, 1678, 736, 848, 13, 1753, 28755, 29918, 1761, 29918, 294, 29918, 19541, 29898, 7076, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 7076, 876, 13, 1678, 363, 2944, 297, 4452, 29901, 13, 4706, 848, 4619, 2944, 29889, 517, 29918, 19541, 580, 13, 1678, 736, 848, 13, 1753, 12780, 29918, 16031, 29918, 2378, 29918, 517, 29918, 19541, 29898, 2378, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 2378, 876, 13, 1678, 363, 2944, 297, 1409, 29901, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29991, 29902, 742, 667, 29897, 13, 1678, 736, 848, 13, 1753, 7223, 29918, 2378, 29918, 517, 29918, 19541, 29898, 2378, 1125, 13, 1678, 848, 353, 2281, 29889, 4058, 877, 29991, 29902, 742, 2435, 29898, 2378, 876, 13, 1678, 363, 2944, 297, 1409, 29901, 13, 4706, 848, 4619, 2281, 29889, 4058, 877, 29883, 742, 20054, 29918, 517, 29918, 3090, 29898, 667, 876, 13, 1678, 736, 848, 13, 1753, 7223, 29918, 517, 29918, 3090, 29898, 1767, 1125, 13, 1678, 565, 995, 29901, 13, 4706, 736, 525, 29911, 29915, 13, 1678, 736, 525, 29943, 29915, 13, 2 ]
kopf/reactor/callbacks.py
pawelkopka/kopf
0
175815
""" Callback signatures for typing. Since these signatures contain a lot of copy-pasted kwargs and are not so important for the codebase, they are moved to this separate module. """ import logging from typing import NewType, Any, Union, Optional from typing_extensions import Protocol from kopf.structs import bodies from kopf.structs import diffs from kopf.structs import patches # A specialised type to highlight the purpose or origin of the data of type Any, # to not be mixed with other arbitrary Any values, where it is indeed "any". HandlerResult = NewType('HandlerResult', object) class ActivityHandlerFn(Protocol): def __call__( # lgtm[py/similar-function] self, *args: Any, logger: Union[logging.Logger, logging.LoggerAdapter], **kwargs: Any, ) -> Optional[HandlerResult]: ... class ResourceHandlerFn(Protocol): def __call__( # lgtm[py/similar-function] self, *args: Any, type: str, event: Union[str, bodies.Event], body: bodies.Body, meta: bodies.Meta, spec: bodies.Spec, status: bodies.Status, uid: str, name: str, namespace: Optional[str], patch: patches.Patch, logger: Union[logging.Logger, logging.LoggerAdapter], diff: diffs.Diff, old: Optional[Union[bodies.BodyEssence, Any]], # "Any" is for field-handlers. new: Optional[Union[bodies.BodyEssence, Any]], # "Any" is for field-handlers. **kwargs: Any, ) -> Optional[HandlerResult]: ... class WhenHandlerFn(Protocol): def __call__( # lgtm[py/similar-function] self, *args: Any, type: str, event: Union[str, bodies.Event], body: bodies.Body, meta: bodies.Meta, spec: bodies.Spec, status: bodies.Status, uid: str, name: str, namespace: Optional[str], patch: patches.Patch, logger: Union[logging.Logger, logging.LoggerAdapter], diff: diffs.Diff, old: Optional[Union[bodies.BodyEssence, Any]], # "Any" is for field-handlers. new: Optional[Union[bodies.BodyEssence, Any]], # "Any" is for field-handlers. **kwargs: Any, ) -> bool: ...
[ 1, 9995, 13, 10717, 1804, 3698, 363, 19229, 29889, 13, 13, 23036, 1438, 1804, 3698, 1712, 263, 3287, 310, 3509, 29899, 29886, 28470, 9049, 5085, 322, 526, 13, 1333, 577, 4100, 363, 278, 775, 3188, 29892, 896, 526, 6153, 304, 445, 5004, 3883, 29889, 13, 15945, 29908, 13, 5215, 12183, 13, 3166, 19229, 1053, 1570, 1542, 29892, 3139, 29892, 7761, 29892, 28379, 13, 13, 3166, 19229, 29918, 24299, 1053, 1019, 5770, 13, 13, 3166, 413, 15818, 29889, 4984, 29879, 1053, 17873, 13, 3166, 413, 15818, 29889, 4984, 29879, 1053, 2923, 29879, 13, 3166, 413, 15818, 29889, 4984, 29879, 1053, 13261, 267, 13, 13, 29937, 319, 4266, 3368, 1134, 304, 12141, 278, 6437, 470, 3978, 310, 278, 848, 310, 1134, 3139, 29892, 13, 29937, 304, 451, 367, 12849, 411, 916, 11472, 3139, 1819, 29892, 988, 372, 338, 6200, 376, 1384, 1642, 13, 4598, 3591, 353, 1570, 1542, 877, 4598, 3591, 742, 1203, 29897, 13, 13, 13, 1990, 13414, 4598, 29137, 29898, 17830, 1125, 13, 1678, 822, 4770, 4804, 12035, 29871, 396, 301, 4141, 29885, 29961, 2272, 29914, 29764, 29899, 2220, 29962, 13, 9651, 1583, 29892, 13, 9651, 334, 5085, 29901, 3139, 29892, 13, 9651, 17927, 29901, 7761, 29961, 21027, 29889, 16363, 29892, 12183, 29889, 16363, 6168, 1402, 13, 9651, 3579, 19290, 29901, 3139, 29892, 13, 1678, 1723, 1599, 28379, 29961, 4598, 3591, 5387, 2023, 13, 13, 13, 1990, 18981, 4598, 29137, 29898, 17830, 1125, 13, 1678, 822, 4770, 4804, 12035, 29871, 396, 301, 4141, 29885, 29961, 2272, 29914, 29764, 29899, 2220, 29962, 13, 9651, 1583, 29892, 13, 9651, 334, 5085, 29901, 3139, 29892, 13, 9651, 1134, 29901, 851, 29892, 13, 9651, 1741, 29901, 7761, 29961, 710, 29892, 17873, 29889, 2624, 1402, 13, 9651, 3573, 29901, 17873, 29889, 8434, 29892, 13, 9651, 12700, 29901, 17873, 29889, 19346, 29892, 13, 9651, 1580, 29901, 17873, 29889, 10299, 29892, 13, 9651, 4660, 29901, 17873, 29889, 5709, 29892, 13, 9651, 318, 333, 29901, 851, 29892, 13, 9651, 1024, 29901, 851, 29892, 13, 9651, 7397, 29901, 28379, 29961, 710, 1402, 13, 9651, 13261, 29901, 13261, 267, 29889, 29925, 905, 29892, 13, 9651, 17927, 29901, 7761, 29961, 21027, 29889, 16363, 29892, 12183, 29889, 16363, 6168, 1402, 13, 9651, 2923, 29901, 2923, 29879, 29889, 26023, 29892, 13, 9651, 2030, 29901, 28379, 29961, 19986, 29961, 29890, 397, 583, 29889, 8434, 29923, 893, 663, 29892, 3139, 20526, 29871, 396, 376, 10773, 29908, 338, 363, 1746, 29899, 3179, 9306, 29889, 13, 9651, 716, 29901, 28379, 29961, 19986, 29961, 29890, 397, 583, 29889, 8434, 29923, 893, 663, 29892, 3139, 20526, 29871, 396, 376, 10773, 29908, 338, 363, 1746, 29899, 3179, 9306, 29889, 13, 9651, 3579, 19290, 29901, 3139, 29892, 13, 1678, 1723, 1599, 28379, 29961, 4598, 3591, 5387, 2023, 13, 13, 13, 1990, 1932, 4598, 29137, 29898, 17830, 1125, 13, 1678, 822, 4770, 4804, 12035, 29871, 396, 301, 4141, 29885, 29961, 2272, 29914, 29764, 29899, 2220, 29962, 13, 9651, 1583, 29892, 13, 9651, 334, 5085, 29901, 3139, 29892, 13, 9651, 1134, 29901, 851, 29892, 13, 9651, 1741, 29901, 7761, 29961, 710, 29892, 17873, 29889, 2624, 1402, 13, 9651, 3573, 29901, 17873, 29889, 8434, 29892, 13, 9651, 12700, 29901, 17873, 29889, 19346, 29892, 13, 9651, 1580, 29901, 17873, 29889, 10299, 29892, 13, 9651, 4660, 29901, 17873, 29889, 5709, 29892, 13, 9651, 318, 333, 29901, 851, 29892, 13, 9651, 1024, 29901, 851, 29892, 13, 9651, 7397, 29901, 28379, 29961, 710, 1402, 13, 9651, 13261, 29901, 13261, 267, 29889, 29925, 905, 29892, 13, 9651, 17927, 29901, 7761, 29961, 21027, 29889, 16363, 29892, 12183, 29889, 16363, 6168, 1402, 13, 9651, 2923, 29901, 2923, 29879, 29889, 26023, 29892, 13, 9651, 2030, 29901, 28379, 29961, 19986, 29961, 29890, 397, 583, 29889, 8434, 29923, 893, 663, 29892, 3139, 20526, 29871, 396, 376, 10773, 29908, 338, 363, 1746, 29899, 3179, 9306, 29889, 13, 9651, 716, 29901, 28379, 29961, 19986, 29961, 29890, 397, 583, 29889, 8434, 29923, 893, 663, 29892, 3139, 20526, 29871, 396, 376, 10773, 29908, 338, 363, 1746, 29899, 3179, 9306, 29889, 13, 9651, 3579, 19290, 29901, 3139, 29892, 13, 1678, 1723, 1599, 6120, 29901, 2023, 13, 2 ]
shipane_sdk/transaction.py
awfssv/ShiPanE-Python-SDK
1
2295
# -*- coding: utf-8 -*- class Transaction(object): def __init__(self, **kwargs): self._completed_at = kwargs.get('completed_at') self._type = kwargs.get('type') self._symbol = kwargs.get('symbol') self._price = kwargs.get('price') self._amount = kwargs.get('amount') def __eq__(self, other): if self.completed_at != other.completed_at: return False if self.type != other.type: return False if self.symbol != other.symbol: return False if self.price != other.price: return False if self.amount != other.amount: return False return True def get_cn_type(self): return u'买入' if self.type == 'BUY' else u'卖出' @property def completed_at(self): return self._completed_at @completed_at.setter def completed_at(self, value): self._completed_at = value @property def type(self): return self._type @type.setter def type(self, value): self._type = value @property def symbol(self): return self._symbol @symbol.setter def symbol(self, value): self._symbol = value @property def price(self): return self._price @price.setter def price(self, value): self._price = value @property def amount(self): return self._amount @amount.setter def amount(self, value): self._amount = value
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 13, 1990, 4103, 2467, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 1583, 3032, 5729, 9446, 29918, 271, 353, 9049, 5085, 29889, 657, 877, 5729, 9446, 29918, 271, 1495, 13, 4706, 1583, 3032, 1853, 353, 9049, 5085, 29889, 657, 877, 1853, 1495, 13, 4706, 1583, 3032, 18098, 353, 9049, 5085, 29889, 657, 877, 18098, 1495, 13, 4706, 1583, 3032, 9175, 353, 9049, 5085, 29889, 657, 877, 9175, 1495, 13, 4706, 1583, 3032, 14506, 353, 9049, 5085, 29889, 657, 877, 14506, 1495, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 565, 1583, 29889, 5729, 9446, 29918, 271, 2804, 916, 29889, 5729, 9446, 29918, 271, 29901, 13, 9651, 736, 7700, 13, 4706, 565, 1583, 29889, 1853, 2804, 916, 29889, 1853, 29901, 13, 9651, 736, 7700, 13, 4706, 565, 1583, 29889, 18098, 2804, 916, 29889, 18098, 29901, 13, 9651, 736, 7700, 13, 4706, 565, 1583, 29889, 9175, 2804, 916, 29889, 9175, 29901, 13, 9651, 736, 7700, 13, 4706, 565, 1583, 29889, 14506, 2804, 916, 29889, 14506, 29901, 13, 9651, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 679, 29918, 18038, 29918, 1853, 29898, 1311, 1125, 13, 4706, 736, 318, 29915, 231, 188, 179, 30752, 29915, 565, 1583, 29889, 1853, 1275, 525, 7838, 29979, 29915, 1683, 318, 29915, 232, 144, 153, 30544, 29915, 13, 13, 1678, 732, 6799, 13, 1678, 822, 8676, 29918, 271, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 5729, 9446, 29918, 271, 13, 13, 1678, 732, 5729, 9446, 29918, 271, 29889, 842, 357, 13, 1678, 822, 8676, 29918, 271, 29898, 1311, 29892, 995, 1125, 13, 4706, 1583, 3032, 5729, 9446, 29918, 271, 353, 995, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1134, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1853, 13, 13, 1678, 732, 1853, 29889, 842, 357, 13, 1678, 822, 1134, 29898, 1311, 29892, 995, 1125, 13, 4706, 1583, 3032, 1853, 353, 995, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5829, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 18098, 13, 13, 1678, 732, 18098, 29889, 842, 357, 13, 1678, 822, 5829, 29898, 1311, 29892, 995, 1125, 13, 4706, 1583, 3032, 18098, 353, 995, 13, 13, 1678, 732, 6799, 13, 1678, 822, 8666, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 9175, 13, 13, 1678, 732, 9175, 29889, 842, 357, 13, 1678, 822, 8666, 29898, 1311, 29892, 995, 1125, 13, 4706, 1583, 3032, 9175, 353, 995, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5253, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 14506, 13, 13, 1678, 732, 14506, 29889, 842, 357, 13, 1678, 822, 5253, 29898, 1311, 29892, 995, 1125, 13, 4706, 1583, 3032, 14506, 353, 995, 13, 2 ]
bench/__init__.py
ThePhantomTiger/BenchmarkPC
1
97995
from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate import os app = Flask(__name__) app.debug = True #Database POSTGRES = { 'user': 'postgres', 'pw': 'test', 'db': 'benchmarkpc', 'host': 'localhost', 'port': '5432', } # app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s' % POSTGRES app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL'] app.config['SECRET_KEY'] = '<KEY>' app.config['UPLOAD_FOLDER'] = os.path.join('bench', 'static', 'Images') db = SQLAlchemy(app) migrate = Migrate(app, db) from flask_wtf.csrf import CsrfProtect from flask_login import LoginManager csrf = CsrfProtect(app) login_manager = LoginManager() login_manager.init_app(app) from bench import routes, models
[ 1, 515, 29784, 1053, 2379, 1278, 29892, 4050, 29918, 6886, 13, 3166, 29784, 29918, 2850, 284, 305, 6764, 1053, 3758, 2499, 305, 6764, 13, 3166, 29784, 29918, 26983, 403, 1053, 341, 4481, 403, 13, 5215, 2897, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 932, 29889, 8382, 353, 5852, 13, 29937, 9112, 13, 5438, 29954, 15989, 353, 426, 13, 1678, 525, 1792, 2396, 525, 2490, 7201, 742, 13, 1678, 525, 29886, 29893, 2396, 525, 1688, 742, 13, 1678, 525, 2585, 2396, 525, 1785, 16580, 6739, 742, 13, 1678, 525, 3069, 2396, 525, 7640, 742, 13, 1678, 525, 637, 2396, 525, 29945, 29946, 29941, 29906, 742, 13, 29913, 13, 29937, 623, 29889, 2917, 1839, 4176, 1964, 3210, 12665, 29979, 29918, 25832, 27982, 29918, 15551, 2033, 353, 525, 29272, 597, 29995, 29898, 1792, 29897, 29879, 16664, 29898, 29886, 29893, 29897, 29879, 29992, 29995, 29898, 3069, 29897, 29879, 16664, 29898, 637, 29897, 29879, 22584, 29898, 2585, 29897, 29879, 29915, 1273, 11971, 29954, 15989, 13, 932, 29889, 2917, 1839, 4176, 1964, 3210, 12665, 29979, 29918, 25832, 27982, 29918, 15551, 2033, 353, 2897, 29889, 21813, 1839, 25832, 27982, 29918, 4219, 2033, 13, 932, 29889, 2917, 1839, 1660, 22245, 29911, 29918, 10818, 2033, 353, 12801, 10818, 16299, 13, 932, 29889, 2917, 1839, 4897, 29428, 29918, 29943, 5607, 8032, 2033, 353, 2897, 29889, 2084, 29889, 7122, 877, 1785, 305, 742, 525, 7959, 742, 525, 20163, 1495, 13, 13, 2585, 353, 3758, 2499, 305, 6764, 29898, 932, 29897, 13, 26983, 403, 353, 341, 4481, 403, 29898, 932, 29892, 4833, 29897, 13, 3166, 29784, 29918, 29893, 13264, 29889, 2395, 9600, 1053, 24277, 9600, 1184, 371, 312, 13, 3166, 29784, 29918, 7507, 1053, 19130, 3260, 13, 2395, 9600, 353, 24277, 9600, 1184, 371, 312, 29898, 932, 29897, 13, 7507, 29918, 12847, 353, 19130, 3260, 580, 13, 7507, 29918, 12847, 29889, 2344, 29918, 932, 29898, 932, 29897, 13, 3166, 3856, 305, 1053, 12049, 29892, 4733, 2 ]
entity/cards/SWL_26H/LETL_236.py
x014/lushi_script
102
199144
<reponame>x014/lushi_script # -*- coding: utf-8 -*- from hearthstone.entities import Entity from entity.spell_entity import SpellEntity class LETL_236(SpellEntity): """ 火焰践踏5 对所有敌人造成$6点伤害。每有一个尚未行动的敌人,重复一次。 """ def __init__(self, entity: Entity): super().__init__(entity) self.damage = 6 self.range = 7 def play(self, game, hero, target): power = game.get_spell_power(self.spell_school, hero.own) # 获取技能列表 action_list = game.get_action_list(not hero.own) action_list.sort() # self.cost 这个技能的速度, cnt = 0 for action in action_list: if action.spell.cost >= self.cost: # 假设同速下,我方先使用技能 cnt += 1 hero_list = game.get_hero_list(not hero.own()) for i in range(cnt): for h in hero_list: h.got_damage(game, (self.damage + power) * self.damage_advantage[self.lettuce_role][h.lettuce_role])
[ 1, 529, 276, 1112, 420, 29958, 29916, 29900, 29896, 29946, 29914, 29880, 1878, 29875, 29918, 2154, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 8293, 386, 12734, 29889, 296, 1907, 1053, 14945, 13, 13, 3166, 7855, 29889, 1028, 514, 29918, 10041, 1053, 1706, 514, 6691, 13, 13, 13, 1990, 365, 2544, 29931, 29918, 29906, 29941, 29953, 29898, 5592, 514, 6691, 1125, 13, 1678, 9995, 13, 308, 31313, 234, 135, 179, 235, 186, 184, 235, 187, 146, 29945, 13, 308, 30783, 30744, 30417, 233, 152, 143, 30313, 31420, 30494, 29938, 29953, 30940, 231, 191, 167, 232, 177, 182, 30267, 31951, 30417, 30287, 30502, 232, 179, 157, 31295, 30448, 30846, 30210, 233, 152, 143, 30313, 30214, 30908, 31810, 30287, 30936, 30267, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7855, 29901, 14945, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 10041, 29897, 13, 4706, 1583, 29889, 16846, 482, 353, 29871, 29953, 13, 4706, 1583, 29889, 3881, 353, 29871, 29955, 13, 13, 1678, 822, 1708, 29898, 1311, 29892, 3748, 29892, 13444, 29892, 3646, 1125, 13, 4706, 3081, 353, 3748, 29889, 657, 29918, 1028, 514, 29918, 13519, 29898, 1311, 29889, 1028, 514, 29918, 27041, 29892, 13444, 29889, 776, 29897, 13, 4706, 396, 29871, 31024, 30683, 31615, 30815, 31025, 30746, 13, 4706, 3158, 29918, 1761, 353, 3748, 29889, 657, 29918, 2467, 29918, 1761, 29898, 1333, 13444, 29889, 776, 29897, 13, 4706, 3158, 29918, 1761, 29889, 6605, 580, 13, 4706, 396, 1583, 29889, 18253, 29871, 30810, 30502, 31615, 30815, 30210, 31859, 30898, 29892, 13, 4706, 274, 593, 353, 29871, 29900, 13, 4706, 363, 3158, 297, 3158, 29918, 1761, 29901, 13, 9651, 565, 3158, 29889, 1028, 514, 29889, 18253, 6736, 1583, 29889, 18253, 29901, 13, 18884, 396, 29871, 232, 132, 138, 30872, 30980, 31859, 30557, 30214, 30672, 30525, 31244, 30785, 30406, 31615, 30815, 13, 18884, 274, 593, 4619, 29871, 29896, 13, 4706, 13444, 29918, 1761, 353, 3748, 29889, 657, 29918, 29882, 1489, 29918, 1761, 29898, 1333, 13444, 29889, 776, 3101, 13, 4706, 363, 474, 297, 3464, 29898, 20047, 1125, 13, 9651, 363, 298, 297, 13444, 29918, 1761, 29901, 13, 18884, 298, 29889, 7085, 29918, 16846, 482, 29898, 11802, 29892, 313, 1311, 29889, 16846, 482, 718, 3081, 29897, 334, 1583, 29889, 16846, 482, 29918, 17263, 8501, 29961, 1311, 29889, 13650, 24551, 29918, 12154, 3816, 29882, 29889, 13650, 24551, 29918, 12154, 2314, 13, 2 ]
core/decorators/multiprocessing_decorator.py
daniele21/Stock_Analysis
0
179841
<reponame>daniele21/Stock_Analysis from multiprocessing import Process import logging logger = logging.getLogger(__name__) def multi_process_run(func): def wrapper(*args, **kwargs): """ Args: fn: function to be run into multiprocess way args: tuple of args --> (arg1. arg2, ...) Returns: """ proc = Process(target=func, args=args, kwargs=kwargs) proc.start() proc.join() exit_code = proc.exitcode return return wrapper
[ 1, 529, 276, 1112, 420, 29958, 29881, 6067, 280, 29906, 29896, 29914, 20754, 384, 29918, 21067, 4848, 13, 3166, 6674, 307, 985, 292, 1053, 10554, 13, 5215, 12183, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 2473, 29918, 5014, 29918, 3389, 29898, 9891, 1125, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 7876, 29901, 740, 304, 367, 1065, 964, 6674, 307, 985, 982, 13, 9651, 6389, 29901, 18761, 310, 6389, 6660, 313, 1191, 29896, 29889, 1852, 29906, 29892, 29757, 13, 13, 4706, 16969, 29901, 13, 13, 4706, 9995, 13, 4706, 9580, 353, 10554, 29898, 5182, 29922, 9891, 29892, 6389, 29922, 5085, 29892, 9049, 5085, 29922, 19290, 29897, 13, 4706, 9580, 29889, 2962, 580, 13, 4706, 9580, 29889, 7122, 580, 13, 13, 4706, 6876, 29918, 401, 353, 9580, 29889, 13322, 401, 13, 13, 4706, 736, 13, 1678, 736, 14476, 13, 2 ]
EnvironmentVariables.py
Phillipdk/PlayGround
0
197829
<filename>EnvironmentVariables.py """ This test is to test the API call and see if it works. It is an integration test. """ import os TemperatureVector = [120, 110, 130, 150] # Temperture [celsius] TimeVectorHr = [0, 1, 2, 3 ] # Time [Hr] client_id = os.environ['CLIENT_ID'] client_secret = os.environ['CLIENT_SECRET'] componentId = os.environ['COMPONENT_ID'] print(client_id) print(client_secret) print(componentId)
[ 1, 529, 9507, 29958, 18649, 10444, 1849, 29889, 2272, 13, 15945, 29908, 29871, 13, 4013, 1243, 338, 304, 1243, 278, 3450, 1246, 322, 1074, 565, 372, 1736, 29889, 739, 338, 385, 29871, 13, 27925, 1243, 29889, 13, 15945, 29908, 13, 5215, 2897, 13, 13, 5776, 546, 1535, 12877, 353, 518, 29896, 29906, 29900, 29892, 29871, 29896, 29896, 29900, 29892, 29871, 29896, 29941, 29900, 29892, 29871, 29896, 29945, 29900, 29962, 396, 6789, 10700, 545, 518, 2242, 1039, 375, 29962, 13, 2481, 12877, 29950, 29878, 353, 418, 518, 29900, 29892, 1678, 29896, 29892, 1678, 29906, 29892, 1678, 29941, 29871, 4514, 396, 5974, 518, 29950, 29878, 29962, 13, 13, 4645, 29918, 333, 353, 2897, 29889, 21813, 1839, 27205, 3919, 29918, 1367, 2033, 13, 4645, 29918, 19024, 353, 2897, 29889, 21813, 1839, 27205, 3919, 29918, 1660, 22245, 29911, 2033, 13, 9700, 1204, 353, 2897, 29889, 21813, 1839, 21514, 1164, 3919, 29918, 1367, 2033, 13, 13, 13, 2158, 29898, 4645, 29918, 333, 29897, 13, 2158, 29898, 4645, 29918, 19024, 29897, 13, 2158, 29898, 9700, 1204, 29897, 2 ]
src/randonet/pytorch/transformer.py
ahgamut/randonet
0
27917
from randonet.generator.param import Param, IntParam, FloatParam, BinaryParam, ChoiceParam, TupleParam from randonet.generator.unit import Unit, Factory as _Factory from randonet.generator.conv import ConvFactory, ConvTransposeFactory from collections import namedtuple class TransformerEncoder(_Factory): def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("TransformerEncoder", ['encoder_layer', 'num_layers', 'norm']) self.params = self.template_fn( encoder_layer=Param(name="encoder_layer", default=None), num_layers=Param(name="num_layers", default=None), norm=Param(name="norm", default=None), ) for k,v in kwargs.items(): getattr(self.params, k).val = v class TransformerDecoder(_Factory): def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("TransformerDecoder", ['decoder_layer', 'num_layers', 'norm']) self.params = self.template_fn( decoder_layer=Param(name="decoder_layer", default=None), num_layers=Param(name="num_layers", default=None), norm=Param(name="norm", default=None), ) for k,v in kwargs.items(): getattr(self.params, k).val = v class TransformerEncoderLayer(_Factory): def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("TransformerEncoderLayer", ['d_model', 'nhead', 'dim_feedforward', 'dropout', 'activation']) self.params = self.template_fn( d_model=Param(name="d_model", default=None), nhead=Param(name="nhead", default=None), dim_feedforward=IntParam(name="dim_feedforward", default=2048), dropout=FloatParam(name="dropout", default=0.1), activation=ChoiceParam(name="activation", choices=("relu",), cprobs=(1,), default="relu"), ) for k,v in kwargs.items(): getattr(self.params, k).val = v class TransformerDecoderLayer(_Factory): def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("TransformerDecoderLayer", ['d_model', 'nhead', 'dim_feedforward', 'dropout', 'activation']) self.params = self.template_fn( d_model=Param(name="d_model", default=None), nhead=Param(name="nhead", default=None), dim_feedforward=IntParam(name="dim_feedforward", default=2048), dropout=FloatParam(name="dropout", default=0.1), activation=ChoiceParam(name="activation", choices=("relu",), cprobs=(1,), default="relu"), ) for k,v in kwargs.items(): getattr(self.params, k).val = v class Transformer(_Factory): def __init__(self, **kwargs): _Factory.__init__(self) self.template_fn = namedtuple("Transformer", ['d_model', 'nhead', 'num_encoder_layers', 'num_decoder_layers', 'dim_feedforward', 'dropout', 'activation', 'custom_encoder', 'custom_decoder']) self.params = self.template_fn( d_model=IntParam(name="d_model", default=512), nhead=IntParam(name="nhead", default=8), num_encoder_layers=IntParam(name="num_encoder_layers", default=6), num_decoder_layers=IntParam(name="num_decoder_layers", default=6), dim_feedforward=IntParam(name="dim_feedforward", default=2048), dropout=FloatParam(name="dropout", default=0.1), activation=ChoiceParam(name="activation", choices=("relu",), cprobs=(1,), default="relu"), custom_encoder=Param(name="custom_encoder", default=None), custom_decoder=Param(name="custom_decoder", default=None), ) for k,v in kwargs.items(): getattr(self.params, k).val = v
[ 1, 29871, 13, 3166, 364, 9214, 300, 29889, 27959, 29889, 3207, 1053, 12662, 29892, 3159, 4736, 29892, 27842, 4736, 29892, 29479, 4736, 29892, 14542, 625, 4736, 29892, 12603, 552, 4736, 13, 3166, 364, 9214, 300, 29889, 27959, 29889, 5441, 1053, 13223, 29892, 27561, 408, 903, 5126, 13, 3166, 364, 9214, 300, 29889, 27959, 29889, 20580, 1053, 1281, 29894, 5126, 29892, 1281, 29894, 4300, 4220, 5126, 13, 3166, 16250, 1053, 4257, 23583, 13, 13, 13, 1990, 4103, 24784, 8566, 6119, 7373, 5126, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 903, 5126, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 6886, 29918, 9144, 353, 4257, 23583, 703, 13372, 261, 8566, 6119, 613, 6024, 3977, 6119, 29918, 13148, 742, 525, 1949, 29918, 29277, 742, 525, 12324, 11287, 13, 4706, 1583, 29889, 7529, 353, 1583, 29889, 6886, 29918, 9144, 29898, 13, 9651, 2094, 6119, 29918, 13148, 29922, 4736, 29898, 978, 543, 3977, 6119, 29918, 13148, 613, 2322, 29922, 8516, 511, 13, 9651, 954, 29918, 29277, 29922, 4736, 29898, 978, 543, 1949, 29918, 29277, 613, 2322, 29922, 8516, 511, 13, 9651, 6056, 29922, 4736, 29898, 978, 543, 12324, 613, 2322, 29922, 8516, 511, 13, 4706, 1723, 13, 4706, 363, 413, 29892, 29894, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 679, 5552, 29898, 1311, 29889, 7529, 29892, 413, 467, 791, 353, 325, 13, 13, 13, 1990, 4103, 24784, 6185, 6119, 7373, 5126, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 903, 5126, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 6886, 29918, 9144, 353, 4257, 23583, 703, 13372, 261, 6185, 6119, 613, 6024, 7099, 6119, 29918, 13148, 742, 525, 1949, 29918, 29277, 742, 525, 12324, 11287, 13, 4706, 1583, 29889, 7529, 353, 1583, 29889, 6886, 29918, 9144, 29898, 13, 9651, 1602, 6119, 29918, 13148, 29922, 4736, 29898, 978, 543, 7099, 6119, 29918, 13148, 613, 2322, 29922, 8516, 511, 13, 9651, 954, 29918, 29277, 29922, 4736, 29898, 978, 543, 1949, 29918, 29277, 613, 2322, 29922, 8516, 511, 13, 9651, 6056, 29922, 4736, 29898, 978, 543, 12324, 613, 2322, 29922, 8516, 511, 13, 4706, 1723, 13, 4706, 363, 413, 29892, 29894, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 679, 5552, 29898, 1311, 29889, 7529, 29892, 413, 467, 791, 353, 325, 13, 13, 13, 1990, 4103, 24784, 8566, 6119, 14420, 7373, 5126, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 903, 5126, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 6886, 29918, 9144, 353, 4257, 23583, 703, 13372, 261, 8566, 6119, 14420, 613, 6024, 29881, 29918, 4299, 742, 525, 29876, 2813, 742, 525, 6229, 29918, 18798, 11333, 742, 525, 8865, 449, 742, 525, 11236, 362, 11287, 13, 4706, 1583, 29889, 7529, 353, 1583, 29889, 6886, 29918, 9144, 29898, 13, 9651, 270, 29918, 4299, 29922, 4736, 29898, 978, 543, 29881, 29918, 4299, 613, 2322, 29922, 8516, 511, 13, 9651, 302, 2813, 29922, 4736, 29898, 978, 543, 29876, 2813, 613, 2322, 29922, 8516, 511, 13, 9651, 3964, 29918, 18798, 11333, 29922, 2928, 4736, 29898, 978, 543, 6229, 29918, 18798, 11333, 613, 2322, 29922, 29906, 29900, 29946, 29947, 511, 13, 9651, 5768, 449, 29922, 11031, 4736, 29898, 978, 543, 8865, 449, 613, 2322, 29922, 29900, 29889, 29896, 511, 13, 9651, 26229, 29922, 29620, 4736, 29898, 978, 543, 11236, 362, 613, 19995, 29922, 703, 2674, 29884, 613, 511, 274, 771, 5824, 7607, 29896, 29892, 511, 2322, 543, 2674, 29884, 4968, 13, 4706, 1723, 13, 4706, 363, 413, 29892, 29894, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 679, 5552, 29898, 1311, 29889, 7529, 29892, 413, 467, 791, 353, 325, 13, 13, 13, 1990, 4103, 24784, 6185, 6119, 14420, 7373, 5126, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 903, 5126, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 6886, 29918, 9144, 353, 4257, 23583, 703, 13372, 261, 6185, 6119, 14420, 613, 6024, 29881, 29918, 4299, 742, 525, 29876, 2813, 742, 525, 6229, 29918, 18798, 11333, 742, 525, 8865, 449, 742, 525, 11236, 362, 11287, 13, 4706, 1583, 29889, 7529, 353, 1583, 29889, 6886, 29918, 9144, 29898, 13, 9651, 270, 29918, 4299, 29922, 4736, 29898, 978, 543, 29881, 29918, 4299, 613, 2322, 29922, 8516, 511, 13, 9651, 302, 2813, 29922, 4736, 29898, 978, 543, 29876, 2813, 613, 2322, 29922, 8516, 511, 13, 9651, 3964, 29918, 18798, 11333, 29922, 2928, 4736, 29898, 978, 543, 6229, 29918, 18798, 11333, 613, 2322, 29922, 29906, 29900, 29946, 29947, 511, 13, 9651, 5768, 449, 29922, 11031, 4736, 29898, 978, 543, 8865, 449, 613, 2322, 29922, 29900, 29889, 29896, 511, 13, 9651, 26229, 29922, 29620, 4736, 29898, 978, 543, 11236, 362, 613, 19995, 29922, 703, 2674, 29884, 613, 511, 274, 771, 5824, 7607, 29896, 29892, 511, 2322, 543, 2674, 29884, 4968, 13, 4706, 1723, 13, 4706, 363, 413, 29892, 29894, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 679, 5552, 29898, 1311, 29889, 7529, 29892, 413, 467, 791, 353, 325, 13, 13, 13, 1990, 4103, 24784, 7373, 5126, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 903, 5126, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 6886, 29918, 9144, 353, 4257, 23583, 703, 13372, 261, 613, 6024, 29881, 29918, 4299, 742, 525, 29876, 2813, 742, 525, 1949, 29918, 3977, 6119, 29918, 29277, 742, 525, 1949, 29918, 7099, 6119, 29918, 29277, 742, 525, 6229, 29918, 18798, 11333, 742, 525, 8865, 449, 742, 525, 11236, 362, 742, 525, 6341, 29918, 3977, 6119, 742, 525, 6341, 29918, 7099, 6119, 11287, 13, 4706, 1583, 29889, 7529, 353, 1583, 29889, 6886, 29918, 9144, 29898, 13, 9651, 270, 29918, 4299, 29922, 2928, 4736, 29898, 978, 543, 29881, 29918, 4299, 613, 2322, 29922, 29945, 29896, 29906, 511, 13, 9651, 302, 2813, 29922, 2928, 4736, 29898, 978, 543, 29876, 2813, 613, 2322, 29922, 29947, 511, 13, 9651, 954, 29918, 3977, 6119, 29918, 29277, 29922, 2928, 4736, 29898, 978, 543, 1949, 29918, 3977, 6119, 29918, 29277, 613, 2322, 29922, 29953, 511, 13, 9651, 954, 29918, 7099, 6119, 29918, 29277, 29922, 2928, 4736, 29898, 978, 543, 1949, 29918, 7099, 6119, 29918, 29277, 613, 2322, 29922, 29953, 511, 13, 9651, 3964, 29918, 18798, 11333, 29922, 2928, 4736, 29898, 978, 543, 6229, 29918, 18798, 11333, 613, 2322, 29922, 29906, 29900, 29946, 29947, 511, 13, 9651, 5768, 449, 29922, 11031, 4736, 29898, 978, 543, 8865, 449, 613, 2322, 29922, 29900, 29889, 29896, 511, 13, 9651, 26229, 29922, 29620, 4736, 29898, 978, 543, 11236, 362, 613, 19995, 29922, 703, 2674, 29884, 613, 511, 274, 771, 5824, 7607, 29896, 29892, 511, 2322, 543, 2674, 29884, 4968, 13, 9651, 2888, 29918, 3977, 6119, 29922, 4736, 29898, 978, 543, 6341, 29918, 3977, 6119, 613, 2322, 29922, 8516, 511, 13, 9651, 2888, 29918, 7099, 6119, 29922, 4736, 29898, 978, 543, 6341, 29918, 7099, 6119, 613, 2322, 29922, 8516, 511, 13, 4706, 1723, 13, 4706, 363, 413, 29892, 29894, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 679, 5552, 29898, 1311, 29889, 7529, 29892, 413, 467, 791, 353, 325, 13, 13, 2 ]
Loan_Approval_Analysis/code.py
justsidd/greyatom-python-for-data-science
0
141537
<filename>Loan_Approval_Analysis/code.py # -------------- import pandas as pd import numpy as np from scipy.stats import mode bank=pd.read_csv(path) categorical_var=bank.select_dtypes(include = 'object') numerical_var=bank.select_dtypes(include = 'number') bank.drop('Loan_ID',axis=1,inplace=True) banks=bank bank_mode=banks.mode().iloc[0] banks.fillna(bank_mode,inplace=True) avg_loan_amount=bank.pivot_table(index=['Gender','Married','Self_Employed'],values='LoanAmount',aggfunc='mean') loan_approved_se = len(banks[(banks.Self_Employed=='Yes') & (banks.Loan_Status=='Y')]) loan_approved_nse = len(banks[(banks.Self_Employed=='No') & (banks.Loan_Status=='Y')]) percentage_se = float(loan_approved_se*100)/len(banks['Self_Employed']) percentage_nse = float(loan_approved_nse*100)/len(banks['Self_Employed']) loan_term = banks['Loan_Amount_Term'].apply(lambda x: int(x)/12 ) big_loan_term=len(loan_term[loan_term>=25]) loan_groupby = banks.groupby('Loan_Status') loan_groupby = loan_groupby['ApplicantIncome','Credit_History'] mean_values = loan_groupby.mean()
[ 1, 529, 9507, 29958, 3410, 273, 29918, 2052, 307, 791, 29918, 21067, 4848, 29914, 401, 29889, 2272, 13, 29937, 448, 9072, 29899, 13, 5215, 11701, 408, 10518, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 3166, 4560, 2272, 29889, 16202, 1053, 4464, 6756, 13, 30004, 13, 9157, 29922, 15926, 29889, 949, 29918, 7638, 29898, 2084, 8443, 13, 30004, 13, 29883, 20440, 936, 29918, 1707, 29922, 9157, 29889, 2622, 29918, 29881, 8768, 29898, 2856, 353, 525, 3318, 1495, 30004, 13, 30004, 13, 8058, 936, 29918, 1707, 29922, 9157, 29889, 2622, 29918, 29881, 8768, 29898, 2856, 353, 525, 4537, 1495, 30004, 13, 30004, 13, 9157, 29889, 8865, 877, 3410, 273, 29918, 1367, 742, 8990, 29922, 29896, 29892, 262, 6689, 29922, 5574, 8443, 13, 30004, 13, 29890, 1331, 29922, 9157, 30004, 13, 30004, 13, 9157, 29918, 8513, 29922, 29890, 1331, 29889, 8513, 2141, 309, 542, 29961, 29900, 29962, 30004, 13, 30004, 13, 29890, 1331, 29889, 5589, 1056, 29898, 9157, 29918, 8513, 29892, 262, 6689, 29922, 5574, 8443, 13, 30004, 13, 485, 29887, 29918, 417, 273, 29918, 14506, 29922, 9157, 29889, 29886, 11002, 29918, 2371, 29898, 2248, 29922, 1839, 29954, 1581, 3788, 7083, 1255, 3788, 24313, 29918, 10495, 2376, 287, 7464, 5975, 2433, 3410, 273, 18087, 742, 16170, 9891, 2433, 12676, 1495, 30004, 13, 30004, 13, 417, 273, 29918, 9961, 1490, 29918, 344, 353, 7431, 29898, 29890, 1331, 15625, 29890, 1331, 29889, 24313, 29918, 10495, 2376, 287, 1360, 29915, 8241, 1495, 669, 313, 29890, 1331, 29889, 3410, 273, 29918, 5709, 1360, 29915, 29979, 1495, 2314, 30004, 13, 30004, 13, 417, 273, 29918, 9961, 1490, 29918, 29876, 344, 353, 7431, 29898, 29890, 1331, 15625, 29890, 1331, 29889, 24313, 29918, 10495, 2376, 287, 1360, 29915, 3782, 1495, 669, 313, 29890, 1331, 29889, 3410, 273, 29918, 5709, 1360, 29915, 29979, 1495, 2314, 30004, 13, 30004, 13, 25376, 482, 29918, 344, 353, 5785, 29898, 417, 273, 29918, 9961, 1490, 29918, 344, 29930, 29896, 29900, 29900, 6802, 2435, 29898, 29890, 1331, 1839, 24313, 29918, 10495, 2376, 287, 2033, 8443, 13, 30004, 13, 25376, 482, 29918, 29876, 344, 353, 5785, 29898, 417, 273, 29918, 9961, 1490, 29918, 29876, 344, 29930, 29896, 29900, 29900, 6802, 2435, 29898, 29890, 1331, 1839, 24313, 29918, 10495, 2376, 287, 2033, 8443, 13, 30004, 13, 417, 273, 29918, 8489, 353, 24388, 1839, 3410, 273, 29918, 18087, 29918, 14343, 13359, 7302, 29898, 2892, 921, 29901, 938, 29898, 29916, 6802, 29896, 29906, 1723, 30004, 13, 30004, 13, 3752, 29918, 417, 273, 29918, 8489, 29922, 2435, 29898, 417, 273, 29918, 8489, 29961, 417, 273, 29918, 8489, 18572, 29906, 29945, 2314, 30004, 13, 30004, 13, 417, 273, 29918, 27789, 353, 24388, 29889, 27789, 877, 3410, 273, 29918, 5709, 1495, 30004, 13, 30004, 13, 417, 273, 29918, 27789, 353, 24806, 29918, 27789, 1839, 2052, 506, 424, 797, 2763, 3788, 15507, 277, 29918, 20570, 2033, 30004, 13, 30004, 13, 12676, 29918, 5975, 353, 24806, 29918, 27789, 29889, 12676, 580, 13, 13, 13, 2 ]
app/domain/rules.py
patromi/tracardi
0
1602707
import logging from app.event_server.service.persistence_service import PersistenceService from app.service.storage.elastic_storage import ElasticStorage rules_logger = logging.getLogger('Rules') class Rules(list): @staticmethod def storage() -> PersistenceService: return PersistenceService(ElasticStorage(index_key="rule"))
[ 1, 1053, 12183, 13, 3166, 623, 29889, 3696, 29918, 2974, 29889, 5509, 29889, 28249, 29918, 5509, 1053, 9034, 11416, 3170, 13, 3166, 623, 29889, 5509, 29889, 12925, 29889, 295, 6288, 29918, 12925, 1053, 1260, 6288, 10486, 13, 13, 13, 19238, 29918, 21707, 353, 12183, 29889, 657, 16363, 877, 29934, 2540, 1495, 13, 13, 13, 1990, 390, 2540, 29898, 1761, 1125, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 8635, 580, 1599, 9034, 11416, 3170, 29901, 13, 4706, 736, 9034, 11416, 3170, 29898, 29923, 4230, 293, 10486, 29898, 2248, 29918, 1989, 543, 7491, 5783, 13, 2 ]
hackerrank/weekofcode23/commuting-strings.py
mikhail-dvorkin/competitions
7
181367
def kmp(s): p = [-1] k = -1 for c in s: while k >= 0 and s[k] != c: k = p[k] k += 1 p.append(k) return p def period(s): k = len(s) - kmp(s)[-1] if len(s) % k == 0: return k return len(s) s = input() m = int(input()) p = period(s) print(m // p % (10**9 + 7))
[ 1, 822, 413, 1526, 29898, 29879, 1125, 13, 12, 29886, 353, 21069, 29896, 29962, 13, 12, 29895, 353, 448, 29896, 13, 12, 1454, 274, 297, 269, 29901, 13, 12, 12, 8000, 413, 6736, 29871, 29900, 322, 269, 29961, 29895, 29962, 2804, 274, 29901, 13, 12, 12, 12, 29895, 353, 282, 29961, 29895, 29962, 13, 12, 12, 29895, 4619, 29871, 29896, 13, 12, 12, 29886, 29889, 4397, 29898, 29895, 29897, 13, 12, 2457, 282, 13, 13, 1753, 3785, 29898, 29879, 1125, 13, 12, 29895, 353, 7431, 29898, 29879, 29897, 448, 413, 1526, 29898, 29879, 9601, 29899, 29896, 29962, 13, 12, 361, 7431, 29898, 29879, 29897, 1273, 413, 1275, 29871, 29900, 29901, 13, 12, 12, 2457, 413, 13, 12, 2457, 7431, 29898, 29879, 29897, 13, 13, 13, 29879, 353, 1881, 580, 13, 29885, 353, 938, 29898, 2080, 3101, 13, 13, 29886, 353, 3785, 29898, 29879, 29897, 13, 2158, 29898, 29885, 849, 282, 1273, 313, 29896, 29900, 1068, 29929, 718, 29871, 29955, 876, 13, 2 ]
src/screenlogger.py
swbooking/RobotMaria
0
22361
<gh_stars>0 class ScreenLogger: def __init__(self, loghandler=None, verbose = True): self.LogMessage = None self.LogHandler = loghandler self.Verbose = verbose return def Log(self, message): if self.LogMessage != message: self.LogMessage = message if self.LogHandler != None: self.LogHandler(self.LogMessage) if self.Verbose: print self.LogMessage return
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 1990, 22666, 16363, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1480, 13789, 29922, 8516, 29892, 26952, 353, 5852, 1125, 13, 4706, 1583, 29889, 3403, 3728, 353, 6213, 13, 4706, 1583, 29889, 3403, 4598, 353, 1480, 13789, 13, 4706, 1583, 29889, 6565, 15828, 353, 26952, 13, 4706, 736, 13, 1678, 822, 4522, 29898, 1311, 29892, 2643, 1125, 13, 4706, 565, 1583, 29889, 3403, 3728, 2804, 2643, 29901, 13, 9651, 1583, 29889, 3403, 3728, 353, 2643, 13, 9651, 565, 1583, 29889, 3403, 4598, 2804, 6213, 29901, 13, 18884, 1583, 29889, 3403, 4598, 29898, 1311, 29889, 3403, 3728, 29897, 13, 9651, 565, 1583, 29889, 6565, 15828, 29901, 13, 18884, 1596, 1583, 29889, 3403, 3728, 13, 4706, 736, 13, 2 ]
boto3_type_annotations_with_docs/boto3_type_annotations/sns/paginator.py
cowboygneox/boto3_type_annotations
119
193154
from typing import Dict from botocore.paginate import Paginator class ListEndpointsByPlatformApplication(Paginator): def paginate(self, PlatformApplicationArn: str, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`SNS.Client.list_endpoints_by_platform_application`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListEndpointsByPlatformApplication>`_ **Request Syntax** :: response_iterator = paginator.paginate( PlatformApplicationArn='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'Endpoints': [ { 'EndpointArn': 'string', 'Attributes': { 'string': 'string' } }, ], } **Response Structure** - *(dict) --* Response for ListEndpointsByPlatformApplication action. - **Endpoints** *(list) --* Endpoints returned for ListEndpointsByPlatformApplication action. - *(dict) --* Endpoint for mobile app and device. - **EndpointArn** *(string) --* EndpointArn for mobile app and device. - **Attributes** *(dict) --* Attributes for endpoint. - *(string) --* - *(string) --* :type PlatformApplicationArn: string :param PlatformApplicationArn: **[REQUIRED]** PlatformApplicationArn for ListEndpointsByPlatformApplicationInput action. :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass class ListPhoneNumbersOptedOut(Paginator): def paginate(self, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`SNS.Client.list_phone_numbers_opted_out`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListPhoneNumbersOptedOut>`_ **Request Syntax** :: response_iterator = paginator.paginate( PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'phoneNumbers': [ 'string', ], 'NextToken': 'string' } **Response Structure** - *(dict) --* The response from the ``ListPhoneNumbersOptedOut`` action. - **phoneNumbers** *(list) --* A list of phone numbers that are opted out of receiving SMS messages. The list is paginated, and each page can contain up to 100 phone numbers. - *(string) --* - **NextToken** *(string) --* A token to resume pagination. :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass class ListPlatformApplications(Paginator): def paginate(self, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`SNS.Client.list_platform_applications`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListPlatformApplications>`_ **Request Syntax** :: response_iterator = paginator.paginate( PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'PlatformApplications': [ { 'PlatformApplicationArn': 'string', 'Attributes': { 'string': 'string' } }, ], } **Response Structure** - *(dict) --* Response for ListPlatformApplications action. - **PlatformApplications** *(list) --* Platform applications returned when calling ListPlatformApplications action. - *(dict) --* Platform application object. - **PlatformApplicationArn** *(string) --* PlatformApplicationArn for platform application object. - **Attributes** *(dict) --* Attributes for platform application object. - *(string) --* - *(string) --* :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass class ListSubscriptions(Paginator): def paginate(self, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`SNS.Client.list_subscriptions`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListSubscriptions>`_ **Request Syntax** :: response_iterator = paginator.paginate( PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'Subscriptions': [ { 'SubscriptionArn': 'string', 'Owner': 'string', 'Protocol': 'string', 'Endpoint': 'string', 'TopicArn': 'string' }, ], } **Response Structure** - *(dict) --* Response for ListSubscriptions action - **Subscriptions** *(list) --* A list of subscriptions. - *(dict) --* A wrapper type for the attributes of an Amazon SNS subscription. - **SubscriptionArn** *(string) --* The subscription's ARN. - **Owner** *(string) --* The subscription's owner. - **Protocol** *(string) --* The subscription's protocol. - **Endpoint** *(string) --* The subscription's endpoint (format depends on the protocol). - **TopicArn** *(string) --* The ARN of the subscription's topic. :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass class ListSubscriptionsByTopic(Paginator): def paginate(self, TopicArn: str, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`SNS.Client.list_subscriptions_by_topic`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListSubscriptionsByTopic>`_ **Request Syntax** :: response_iterator = paginator.paginate( TopicArn='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'Subscriptions': [ { 'SubscriptionArn': 'string', 'Owner': 'string', 'Protocol': 'string', 'Endpoint': 'string', 'TopicArn': 'string' }, ], } **Response Structure** - *(dict) --* Response for ListSubscriptionsByTopic action. - **Subscriptions** *(list) --* A list of subscriptions. - *(dict) --* A wrapper type for the attributes of an Amazon SNS subscription. - **SubscriptionArn** *(string) --* The subscription's ARN. - **Owner** *(string) --* The subscription's owner. - **Protocol** *(string) --* The subscription's protocol. - **Endpoint** *(string) --* The subscription's endpoint (format depends on the protocol). - **TopicArn** *(string) --* The ARN of the subscription's topic. :type TopicArn: string :param TopicArn: **[REQUIRED]** The ARN of the topic for which you wish to find subscriptions. :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass class ListTopics(Paginator): def paginate(self, PaginationConfig: Dict = None) -> Dict: """ Creates an iterator that will paginate through responses from :py:meth:`SNS.Client.list_topics`. See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sns-2010-03-31/ListTopics>`_ **Request Syntax** :: response_iterator = paginator.paginate( PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) **Response Syntax** :: { 'Topics': [ { 'TopicArn': 'string' }, ], } **Response Structure** - *(dict) --* Response for ListTopics action. - **Topics** *(list) --* A list of topic ARNs. - *(dict) --* A wrapper type for the topic's Amazon Resource Name (ARN). To retrieve a topic's attributes, use ``GetTopicAttributes`` . - **TopicArn** *(string) --* The topic's ARN. :type PaginationConfig: dict :param PaginationConfig: A dictionary that provides parameters to control pagination. - **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination. - **PageSize** *(integer) --* The size of each page. - **StartingToken** *(string) --* A token to specify where to start paginating. This is the ``NextToken`` from a previous response. :rtype: dict :returns: """ pass
[ 1, 515, 19229, 1053, 360, 919, 13, 3166, 9225, 542, 487, 29889, 13573, 16976, 1053, 349, 26584, 1061, 13, 13, 13, 1990, 2391, 5044, 9748, 2059, 21889, 4873, 29898, 29925, 26584, 1061, 1125, 13, 1678, 822, 10203, 16976, 29898, 1311, 29892, 28096, 4873, 1433, 29876, 29901, 851, 29892, 349, 351, 3381, 3991, 29901, 360, 919, 353, 6213, 29897, 1599, 360, 919, 29901, 13, 4706, 9995, 13, 4706, 6760, 1078, 385, 20380, 393, 674, 10203, 16976, 1549, 20890, 515, 584, 2272, 29901, 29885, 621, 18078, 29903, 3059, 29889, 4032, 29889, 1761, 29918, 355, 9748, 29918, 1609, 29918, 12120, 29918, 6214, 1412, 13, 4706, 2823, 884, 29901, 421, 29909, 7811, 3450, 10854, 362, 529, 991, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 27102, 29914, 3609, 8787, 29914, 29879, 1983, 29899, 29906, 29900, 29896, 29900, 29899, 29900, 29941, 29899, 29941, 29896, 29914, 1293, 5044, 9748, 2059, 21889, 4873, 13885, 29918, 13, 308, 13, 4706, 3579, 3089, 21306, 1068, 13, 4706, 4761, 13, 3986, 2933, 29918, 17609, 353, 10203, 262, 1061, 29889, 13573, 16976, 29898, 13, 795, 28096, 4873, 1433, 29876, 2433, 1807, 742, 13, 795, 349, 351, 3381, 3991, 3790, 13, 462, 29871, 525, 7976, 6913, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 5074, 3505, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 4763, 292, 6066, 2396, 525, 1807, 29915, 13, 795, 500, 13, 3986, 1723, 13, 308, 13, 4706, 3579, 5103, 21306, 1068, 13, 4706, 4761, 13, 9651, 426, 13, 18884, 525, 5044, 9748, 2396, 518, 13, 462, 1678, 426, 13, 462, 4706, 525, 25602, 1433, 29876, 2396, 525, 1807, 742, 13, 462, 4706, 525, 15801, 2396, 426, 13, 462, 9651, 525, 1807, 2396, 525, 1807, 29915, 13, 462, 4706, 500, 13, 462, 1678, 2981, 13, 18884, 21251, 13, 9651, 500, 13, 308, 13, 4706, 3579, 5103, 3767, 12425, 1068, 13, 3986, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 9651, 13291, 363, 2391, 5044, 9748, 2059, 21889, 4873, 3158, 29889, 13, 9651, 448, 3579, 5044, 9748, 1068, 334, 29898, 1761, 29897, 1192, 29930, 29871, 13, 795, 2796, 9748, 4133, 363, 2391, 5044, 9748, 2059, 21889, 4873, 3158, 29889, 13, 795, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 18884, 2796, 3149, 363, 10426, 623, 322, 4742, 29889, 13, 18884, 448, 3579, 25602, 1433, 29876, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 2796, 3149, 1433, 29876, 363, 10426, 623, 322, 4742, 29889, 13, 18884, 448, 3579, 15801, 1068, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 462, 29871, 6212, 5026, 363, 16248, 29889, 13, 462, 29871, 448, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 1678, 448, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 4706, 584, 1853, 28096, 4873, 1433, 29876, 29901, 1347, 13, 4706, 584, 3207, 28096, 4873, 1433, 29876, 29901, 3579, 29961, 1525, 29984, 3120, 19386, 29962, 1068, 13, 3986, 28096, 4873, 1433, 29876, 363, 2391, 5044, 9748, 2059, 21889, 4873, 4290, 3158, 29889, 13, 4706, 584, 1853, 349, 351, 3381, 3991, 29901, 9657, 13, 4706, 584, 3207, 349, 351, 3381, 3991, 29901, 13, 3986, 319, 8600, 393, 8128, 4128, 304, 2761, 10203, 3381, 29889, 13, 3986, 448, 3579, 7976, 6913, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 3001, 1353, 310, 4452, 304, 736, 29889, 960, 278, 3001, 1353, 310, 4452, 3625, 338, 901, 1135, 278, 995, 6790, 297, 4236, 29899, 7076, 769, 263, 4954, 9190, 6066, 16159, 674, 367, 4944, 297, 278, 1962, 393, 366, 508, 671, 304, 620, 2017, 10203, 3381, 29889, 13, 3986, 448, 3579, 5074, 3505, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 2159, 310, 1269, 1813, 29889, 13, 3986, 448, 3579, 4763, 292, 6066, 1068, 334, 29898, 1807, 29897, 1192, 29930, 13, 9651, 319, 5993, 304, 6084, 988, 304, 1369, 10203, 262, 1218, 29889, 910, 338, 278, 4954, 9190, 6066, 16159, 515, 263, 3517, 2933, 29889, 13, 4706, 584, 29878, 1853, 29901, 9657, 13, 4706, 584, 18280, 29901, 13, 4706, 9995, 13, 4706, 1209, 13, 13, 13, 1990, 2391, 9861, 29478, 20624, 287, 3744, 29898, 29925, 26584, 1061, 1125, 13, 1678, 822, 10203, 16976, 29898, 1311, 29892, 349, 351, 3381, 3991, 29901, 360, 919, 353, 6213, 29897, 1599, 360, 919, 29901, 13, 4706, 9995, 13, 4706, 6760, 1078, 385, 20380, 393, 674, 10203, 16976, 1549, 20890, 515, 584, 2272, 29901, 29885, 621, 18078, 29903, 3059, 29889, 4032, 29889, 1761, 29918, 6710, 29918, 20326, 29918, 3670, 287, 29918, 449, 1412, 13, 4706, 2823, 884, 29901, 421, 29909, 7811, 3450, 10854, 362, 529, 991, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 27102, 29914, 3609, 8787, 29914, 29879, 1983, 29899, 29906, 29900, 29896, 29900, 29899, 29900, 29941, 29899, 29941, 29896, 29914, 1293, 9861, 29478, 20624, 287, 3744, 13885, 29918, 13, 308, 13, 4706, 3579, 3089, 21306, 1068, 13, 4706, 4761, 13, 3986, 2933, 29918, 17609, 353, 10203, 262, 1061, 29889, 13573, 16976, 29898, 13, 795, 349, 351, 3381, 3991, 3790, 13, 462, 29871, 525, 7976, 6913, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 5074, 3505, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 4763, 292, 6066, 2396, 525, 1807, 29915, 13, 795, 500, 13, 3986, 1723, 13, 308, 13, 4706, 3579, 5103, 21306, 1068, 13, 4706, 4761, 13, 9651, 426, 13, 18884, 525, 6710, 29478, 2396, 518, 13, 462, 1678, 525, 1807, 742, 13, 18884, 21251, 13, 18884, 525, 9190, 6066, 2396, 525, 1807, 29915, 13, 9651, 500, 13, 308, 13, 4706, 3579, 5103, 3767, 12425, 1068, 13, 3986, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 9651, 450, 2933, 515, 278, 4954, 1293, 9861, 29478, 20624, 287, 3744, 16159, 3158, 29889, 13, 9651, 448, 3579, 6710, 29478, 1068, 334, 29898, 1761, 29897, 1192, 29930, 29871, 13, 795, 319, 1051, 310, 9008, 3694, 393, 526, 3523, 287, 714, 310, 13442, 317, 4345, 7191, 29889, 450, 1051, 338, 10203, 262, 630, 29892, 322, 1269, 1813, 508, 1712, 701, 304, 29871, 29896, 29900, 29900, 9008, 3694, 29889, 13, 795, 448, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 9651, 448, 3579, 9190, 6066, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 795, 319, 5993, 304, 620, 2017, 10203, 3381, 29889, 13, 4706, 584, 1853, 349, 351, 3381, 3991, 29901, 9657, 13, 4706, 584, 3207, 349, 351, 3381, 3991, 29901, 13, 3986, 319, 8600, 393, 8128, 4128, 304, 2761, 10203, 3381, 29889, 13, 3986, 448, 3579, 7976, 6913, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 3001, 1353, 310, 4452, 304, 736, 29889, 960, 278, 3001, 1353, 310, 4452, 3625, 338, 901, 1135, 278, 995, 6790, 297, 4236, 29899, 7076, 769, 263, 4954, 9190, 6066, 16159, 674, 367, 4944, 297, 278, 1962, 393, 366, 508, 671, 304, 620, 2017, 10203, 3381, 29889, 13, 3986, 448, 3579, 5074, 3505, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 2159, 310, 1269, 1813, 29889, 13, 3986, 448, 3579, 4763, 292, 6066, 1068, 334, 29898, 1807, 29897, 1192, 29930, 13, 9651, 319, 5993, 304, 6084, 988, 304, 1369, 10203, 262, 1218, 29889, 910, 338, 278, 4954, 9190, 6066, 16159, 515, 263, 3517, 2933, 29889, 13, 4706, 584, 29878, 1853, 29901, 9657, 13, 4706, 584, 18280, 29901, 13, 4706, 9995, 13, 4706, 1209, 13, 13, 13, 1990, 2391, 21889, 2052, 5795, 29898, 29925, 26584, 1061, 1125, 13, 1678, 822, 10203, 16976, 29898, 1311, 29892, 349, 351, 3381, 3991, 29901, 360, 919, 353, 6213, 29897, 1599, 360, 919, 29901, 13, 4706, 9995, 13, 4706, 6760, 1078, 385, 20380, 393, 674, 10203, 16976, 1549, 20890, 515, 584, 2272, 29901, 29885, 621, 18078, 29903, 3059, 29889, 4032, 29889, 1761, 29918, 12120, 29918, 932, 5795, 1412, 13, 4706, 2823, 884, 29901, 421, 29909, 7811, 3450, 10854, 362, 529, 991, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 27102, 29914, 3609, 8787, 29914, 29879, 1983, 29899, 29906, 29900, 29896, 29900, 29899, 29900, 29941, 29899, 29941, 29896, 29914, 1293, 21889, 2052, 5795, 13885, 29918, 13, 308, 13, 4706, 3579, 3089, 21306, 1068, 13, 4706, 4761, 13, 3986, 2933, 29918, 17609, 353, 10203, 262, 1061, 29889, 13573, 16976, 29898, 13, 795, 349, 351, 3381, 3991, 3790, 13, 462, 29871, 525, 7976, 6913, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 5074, 3505, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 4763, 292, 6066, 2396, 525, 1807, 29915, 13, 795, 500, 13, 3986, 1723, 13, 308, 13, 4706, 3579, 5103, 21306, 1068, 13, 4706, 4761, 13, 9651, 426, 13, 18884, 525, 21889, 2052, 5795, 2396, 518, 13, 462, 1678, 426, 13, 462, 4706, 525, 21889, 4873, 1433, 29876, 2396, 525, 1807, 742, 13, 462, 4706, 525, 15801, 2396, 426, 13, 462, 9651, 525, 1807, 2396, 525, 1807, 29915, 13, 462, 4706, 500, 13, 462, 1678, 2981, 13, 18884, 21251, 13, 9651, 500, 13, 308, 13, 4706, 3579, 5103, 3767, 12425, 1068, 13, 3986, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 9651, 13291, 363, 2391, 21889, 2052, 5795, 3158, 29889, 13, 9651, 448, 3579, 21889, 2052, 5795, 1068, 334, 29898, 1761, 29897, 1192, 29930, 29871, 13, 795, 28096, 8324, 4133, 746, 5432, 2391, 21889, 2052, 5795, 3158, 29889, 13, 795, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 18884, 28096, 2280, 1203, 29889, 13, 18884, 448, 3579, 21889, 4873, 1433, 29876, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 28096, 4873, 1433, 29876, 363, 7481, 2280, 1203, 29889, 13, 18884, 448, 3579, 15801, 1068, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 462, 29871, 6212, 5026, 363, 7481, 2280, 1203, 29889, 13, 462, 29871, 448, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 1678, 448, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 4706, 584, 1853, 349, 351, 3381, 3991, 29901, 9657, 13, 4706, 584, 3207, 349, 351, 3381, 3991, 29901, 13, 3986, 319, 8600, 393, 8128, 4128, 304, 2761, 10203, 3381, 29889, 13, 3986, 448, 3579, 7976, 6913, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 3001, 1353, 310, 4452, 304, 736, 29889, 960, 278, 3001, 1353, 310, 4452, 3625, 338, 901, 1135, 278, 995, 6790, 297, 4236, 29899, 7076, 769, 263, 4954, 9190, 6066, 16159, 674, 367, 4944, 297, 278, 1962, 393, 366, 508, 671, 304, 620, 2017, 10203, 3381, 29889, 13, 3986, 448, 3579, 5074, 3505, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 2159, 310, 1269, 1813, 29889, 13, 3986, 448, 3579, 4763, 292, 6066, 1068, 334, 29898, 1807, 29897, 1192, 29930, 13, 9651, 319, 5993, 304, 6084, 988, 304, 1369, 10203, 262, 1218, 29889, 910, 338, 278, 4954, 9190, 6066, 16159, 515, 263, 3517, 2933, 29889, 13, 4706, 584, 29878, 1853, 29901, 9657, 13, 4706, 584, 18280, 29901, 13, 4706, 9995, 13, 4706, 1209, 13, 13, 13, 1990, 2391, 4035, 7588, 1980, 29898, 29925, 26584, 1061, 1125, 13, 1678, 822, 10203, 16976, 29898, 1311, 29892, 349, 351, 3381, 3991, 29901, 360, 919, 353, 6213, 29897, 1599, 360, 919, 29901, 13, 4706, 9995, 13, 4706, 6760, 1078, 385, 20380, 393, 674, 10203, 16976, 1549, 20890, 515, 584, 2272, 29901, 29885, 621, 18078, 29903, 3059, 29889, 4032, 29889, 1761, 29918, 1491, 7588, 1980, 1412, 13, 4706, 2823, 884, 29901, 421, 29909, 7811, 3450, 10854, 362, 529, 991, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 27102, 29914, 3609, 8787, 29914, 29879, 1983, 29899, 29906, 29900, 29896, 29900, 29899, 29900, 29941, 29899, 29941, 29896, 29914, 1293, 4035, 7588, 1980, 13885, 29918, 13, 308, 13, 4706, 3579, 3089, 21306, 1068, 13, 4706, 4761, 13, 3986, 2933, 29918, 17609, 353, 10203, 262, 1061, 29889, 13573, 16976, 29898, 13, 795, 349, 351, 3381, 3991, 3790, 13, 462, 29871, 525, 7976, 6913, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 5074, 3505, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 4763, 292, 6066, 2396, 525, 1807, 29915, 13, 795, 500, 13, 3986, 1723, 13, 308, 13, 4706, 3579, 5103, 21306, 1068, 13, 4706, 4761, 13, 9651, 426, 13, 18884, 525, 4035, 7588, 1980, 2396, 518, 13, 462, 1678, 426, 13, 462, 4706, 525, 4035, 22371, 1433, 29876, 2396, 525, 1807, 742, 13, 462, 4706, 525, 28213, 2396, 525, 1807, 742, 13, 462, 4706, 525, 17830, 2396, 525, 1807, 742, 13, 462, 4706, 525, 25602, 2396, 525, 1807, 742, 13, 462, 4706, 525, 7031, 293, 1433, 29876, 2396, 525, 1807, 29915, 13, 462, 1678, 2981, 13, 18884, 21251, 13, 9651, 500, 13, 308, 13, 4706, 3579, 5103, 3767, 12425, 1068, 13, 3986, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 9651, 13291, 363, 2391, 4035, 7588, 1980, 3158, 13, 9651, 448, 3579, 4035, 7588, 1980, 1068, 334, 29898, 1761, 29897, 1192, 29930, 29871, 13, 795, 319, 1051, 310, 21696, 1980, 29889, 13, 795, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 18884, 319, 14476, 1134, 363, 278, 8393, 310, 385, 16631, 317, 3059, 25691, 29889, 13, 18884, 448, 3579, 4035, 22371, 1433, 29876, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 9033, 29940, 29889, 13, 18884, 448, 3579, 28213, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 12271, 29889, 13, 18884, 448, 3579, 17830, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 9608, 29889, 13, 18884, 448, 3579, 25602, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 16248, 313, 4830, 7111, 373, 278, 9608, 467, 13, 18884, 448, 3579, 7031, 293, 1433, 29876, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 9033, 29940, 310, 278, 25691, 29915, 29879, 11261, 29889, 13, 4706, 584, 1853, 349, 351, 3381, 3991, 29901, 9657, 13, 4706, 584, 3207, 349, 351, 3381, 3991, 29901, 13, 3986, 319, 8600, 393, 8128, 4128, 304, 2761, 10203, 3381, 29889, 13, 3986, 448, 3579, 7976, 6913, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 3001, 1353, 310, 4452, 304, 736, 29889, 960, 278, 3001, 1353, 310, 4452, 3625, 338, 901, 1135, 278, 995, 6790, 297, 4236, 29899, 7076, 769, 263, 4954, 9190, 6066, 16159, 674, 367, 4944, 297, 278, 1962, 393, 366, 508, 671, 304, 620, 2017, 10203, 3381, 29889, 13, 3986, 448, 3579, 5074, 3505, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 2159, 310, 1269, 1813, 29889, 13, 3986, 448, 3579, 4763, 292, 6066, 1068, 334, 29898, 1807, 29897, 1192, 29930, 13, 9651, 319, 5993, 304, 6084, 988, 304, 1369, 10203, 262, 1218, 29889, 910, 338, 278, 4954, 9190, 6066, 16159, 515, 263, 3517, 2933, 29889, 13, 4706, 584, 29878, 1853, 29901, 9657, 13, 4706, 584, 18280, 29901, 13, 4706, 9995, 13, 4706, 1209, 13, 13, 13, 1990, 2391, 4035, 7588, 1980, 2059, 7031, 293, 29898, 29925, 26584, 1061, 1125, 13, 1678, 822, 10203, 16976, 29898, 1311, 29892, 7488, 293, 1433, 29876, 29901, 851, 29892, 349, 351, 3381, 3991, 29901, 360, 919, 353, 6213, 29897, 1599, 360, 919, 29901, 13, 4706, 9995, 13, 4706, 6760, 1078, 385, 20380, 393, 674, 10203, 16976, 1549, 20890, 515, 584, 2272, 29901, 29885, 621, 18078, 29903, 3059, 29889, 4032, 29889, 1761, 29918, 1491, 7588, 1980, 29918, 1609, 29918, 13010, 1412, 13, 4706, 2823, 884, 29901, 421, 29909, 7811, 3450, 10854, 362, 529, 991, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 27102, 29914, 3609, 8787, 29914, 29879, 1983, 29899, 29906, 29900, 29896, 29900, 29899, 29900, 29941, 29899, 29941, 29896, 29914, 1293, 4035, 7588, 1980, 2059, 7031, 293, 13885, 29918, 13, 308, 13, 4706, 3579, 3089, 21306, 1068, 13, 4706, 4761, 13, 3986, 2933, 29918, 17609, 353, 10203, 262, 1061, 29889, 13573, 16976, 29898, 13, 795, 7488, 293, 1433, 29876, 2433, 1807, 742, 13, 795, 349, 351, 3381, 3991, 3790, 13, 462, 29871, 525, 7976, 6913, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 5074, 3505, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 4763, 292, 6066, 2396, 525, 1807, 29915, 13, 795, 500, 13, 3986, 1723, 13, 308, 13, 4706, 3579, 5103, 21306, 1068, 13, 4706, 4761, 13, 9651, 426, 13, 18884, 525, 4035, 7588, 1980, 2396, 518, 13, 462, 1678, 426, 13, 462, 4706, 525, 4035, 22371, 1433, 29876, 2396, 525, 1807, 742, 13, 462, 4706, 525, 28213, 2396, 525, 1807, 742, 13, 462, 4706, 525, 17830, 2396, 525, 1807, 742, 13, 462, 4706, 525, 25602, 2396, 525, 1807, 742, 13, 462, 4706, 525, 7031, 293, 1433, 29876, 2396, 525, 1807, 29915, 13, 462, 1678, 2981, 13, 18884, 21251, 13, 9651, 500, 13, 308, 13, 4706, 3579, 5103, 3767, 12425, 1068, 13, 3986, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 9651, 13291, 363, 2391, 4035, 7588, 1980, 2059, 7031, 293, 3158, 29889, 13, 9651, 448, 3579, 4035, 7588, 1980, 1068, 334, 29898, 1761, 29897, 1192, 29930, 29871, 13, 795, 319, 1051, 310, 21696, 1980, 29889, 13, 795, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 18884, 319, 14476, 1134, 363, 278, 8393, 310, 385, 16631, 317, 3059, 25691, 29889, 13, 18884, 448, 3579, 4035, 22371, 1433, 29876, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 9033, 29940, 29889, 13, 18884, 448, 3579, 28213, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 12271, 29889, 13, 18884, 448, 3579, 17830, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 9608, 29889, 13, 18884, 448, 3579, 25602, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 25691, 29915, 29879, 16248, 313, 4830, 7111, 373, 278, 9608, 467, 13, 18884, 448, 3579, 7031, 293, 1433, 29876, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 9033, 29940, 310, 278, 25691, 29915, 29879, 11261, 29889, 13, 4706, 584, 1853, 7488, 293, 1433, 29876, 29901, 1347, 13, 4706, 584, 3207, 7488, 293, 1433, 29876, 29901, 3579, 29961, 1525, 29984, 3120, 19386, 29962, 1068, 13, 3986, 450, 9033, 29940, 310, 278, 11261, 363, 607, 366, 6398, 304, 1284, 21696, 1980, 29889, 13, 4706, 584, 1853, 349, 351, 3381, 3991, 29901, 9657, 13, 4706, 584, 3207, 349, 351, 3381, 3991, 29901, 13, 3986, 319, 8600, 393, 8128, 4128, 304, 2761, 10203, 3381, 29889, 13, 3986, 448, 3579, 7976, 6913, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 3001, 1353, 310, 4452, 304, 736, 29889, 960, 278, 3001, 1353, 310, 4452, 3625, 338, 901, 1135, 278, 995, 6790, 297, 4236, 29899, 7076, 769, 263, 4954, 9190, 6066, 16159, 674, 367, 4944, 297, 278, 1962, 393, 366, 508, 671, 304, 620, 2017, 10203, 3381, 29889, 13, 3986, 448, 3579, 5074, 3505, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 2159, 310, 1269, 1813, 29889, 13, 3986, 448, 3579, 4763, 292, 6066, 1068, 334, 29898, 1807, 29897, 1192, 29930, 13, 9651, 319, 5993, 304, 6084, 988, 304, 1369, 10203, 262, 1218, 29889, 910, 338, 278, 4954, 9190, 6066, 16159, 515, 263, 3517, 2933, 29889, 13, 4706, 584, 29878, 1853, 29901, 9657, 13, 4706, 584, 18280, 29901, 13, 4706, 9995, 13, 4706, 1209, 13, 13, 13, 1990, 2391, 7031, 1199, 29898, 29925, 26584, 1061, 1125, 13, 1678, 822, 10203, 16976, 29898, 1311, 29892, 349, 351, 3381, 3991, 29901, 360, 919, 353, 6213, 29897, 1599, 360, 919, 29901, 13, 4706, 9995, 13, 4706, 6760, 1078, 385, 20380, 393, 674, 10203, 16976, 1549, 20890, 515, 584, 2272, 29901, 29885, 621, 18078, 29903, 3059, 29889, 4032, 29889, 1761, 29918, 3332, 1199, 1412, 13, 4706, 2823, 884, 29901, 421, 29909, 7811, 3450, 10854, 362, 529, 991, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 27102, 29914, 3609, 8787, 29914, 29879, 1983, 29899, 29906, 29900, 29896, 29900, 29899, 29900, 29941, 29899, 29941, 29896, 29914, 1293, 7031, 1199, 13885, 29918, 13, 308, 13, 4706, 3579, 3089, 21306, 1068, 13, 4706, 4761, 13, 3986, 2933, 29918, 17609, 353, 10203, 262, 1061, 29889, 13573, 16976, 29898, 13, 795, 349, 351, 3381, 3991, 3790, 13, 462, 29871, 525, 7976, 6913, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 5074, 3505, 2396, 29871, 29896, 29906, 29941, 29892, 13, 462, 29871, 525, 4763, 292, 6066, 2396, 525, 1807, 29915, 13, 795, 500, 13, 3986, 1723, 13, 308, 13, 4706, 3579, 5103, 21306, 1068, 13, 4706, 4761, 13, 9651, 426, 13, 18884, 525, 7031, 1199, 2396, 518, 13, 462, 1678, 426, 13, 462, 4706, 525, 7031, 293, 1433, 29876, 2396, 525, 1807, 29915, 13, 462, 1678, 2981, 13, 18884, 21251, 13, 9651, 500, 13, 308, 13, 4706, 3579, 5103, 3767, 12425, 1068, 13, 3986, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 9651, 13291, 363, 2391, 7031, 1199, 3158, 29889, 13, 9651, 448, 3579, 7031, 1199, 1068, 334, 29898, 1761, 29897, 1192, 29930, 29871, 13, 795, 319, 1051, 310, 11261, 9033, 29940, 29879, 29889, 13, 795, 448, 334, 29898, 8977, 29897, 1192, 29930, 29871, 13, 18884, 319, 14476, 1134, 363, 278, 11261, 29915, 29879, 16631, 18981, 4408, 313, 15249, 467, 1763, 10563, 263, 11261, 29915, 29879, 8393, 29892, 671, 4954, 2577, 7031, 293, 15801, 16159, 869, 13, 18884, 448, 3579, 7031, 293, 1433, 29876, 1068, 334, 29898, 1807, 29897, 1192, 29930, 29871, 13, 462, 29871, 450, 11261, 29915, 29879, 9033, 29940, 29889, 13, 4706, 584, 1853, 349, 351, 3381, 3991, 29901, 9657, 13, 4706, 584, 3207, 349, 351, 3381, 3991, 29901, 13, 3986, 319, 8600, 393, 8128, 4128, 304, 2761, 10203, 3381, 29889, 13, 3986, 448, 3579, 7976, 6913, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 3001, 1353, 310, 4452, 304, 736, 29889, 960, 278, 3001, 1353, 310, 4452, 3625, 338, 901, 1135, 278, 995, 6790, 297, 4236, 29899, 7076, 769, 263, 4954, 9190, 6066, 16159, 674, 367, 4944, 297, 278, 1962, 393, 366, 508, 671, 304, 620, 2017, 10203, 3381, 29889, 13, 3986, 448, 3579, 5074, 3505, 1068, 334, 29898, 16031, 29897, 1192, 29930, 13, 9651, 450, 2159, 310, 1269, 1813, 29889, 13, 3986, 448, 3579, 4763, 292, 6066, 1068, 334, 29898, 1807, 29897, 1192, 29930, 13, 9651, 319, 5993, 304, 6084, 988, 304, 1369, 10203, 262, 1218, 29889, 910, 338, 278, 4954, 9190, 6066, 16159, 515, 263, 3517, 2933, 29889, 13, 4706, 584, 29878, 1853, 29901, 9657, 13, 4706, 584, 18280, 29901, 13, 4706, 9995, 13, 4706, 1209, 13, 2 ]
jax3d/projects/nesf/nerfstatic/utils/jax_process_zero.py
google-research/jax3d
33
187044
<reponame>google-research/jax3d # Copyright 2022 The jax3d 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. """Helper for functions which should only be execute on jax process zero.""" from flax.metrics import tensorboard from flax.training import checkpoints import jax def _make_summary_fn(fn_name: str): """Creates a forwarding summary function, which prefixes the given tag.""" def summary_fn(self, tag, *args, **kwargs): # pylint: disable=protected-access if self._impl is None: return getattr(self._impl, fn_name)(tag, *args, **kwargs) # pylint: enable=protected-access summary_fn.__name__ = fn_name return summary_fn class SummaryWriter(object): """Creates a normal SummaryWriter if this is host 0. A dummy otherwise.""" def __init__(self, log_dir: str): self._impl = None if jax.process_index() == 0: self._impl = tensorboard.SummaryWriter(log_dir) text = _make_summary_fn("text") image = _make_summary_fn("image") scalar = _make_summary_fn("scalar") histogram = _make_summary_fn("histogram") def save_checkpoint(*args, **kwargs): """Only save a checkpoint if this is jax process 0. Otherwise pass.""" if jax.process_index() != 0: return checkpoints.save_checkpoint(*args, **kwargs)
[ 1, 529, 276, 1112, 420, 29958, 3608, 29899, 690, 2842, 29914, 6487, 29941, 29881, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29906, 450, 432, 1165, 29941, 29881, 13189, 943, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 15945, 29908, 10739, 363, 3168, 607, 881, 871, 367, 6222, 373, 432, 1165, 1889, 5225, 1213, 15945, 13, 13, 3166, 17422, 29916, 29889, 2527, 10817, 1053, 12489, 3377, 13, 3166, 17422, 29916, 29889, 26495, 1053, 1423, 9748, 13, 5215, 432, 1165, 13, 13, 13, 1753, 903, 5675, 29918, 7727, 29918, 9144, 29898, 9144, 29918, 978, 29901, 851, 1125, 13, 29871, 9995, 9832, 1078, 263, 6375, 292, 15837, 740, 29892, 607, 10944, 267, 278, 2183, 4055, 1213, 15945, 13, 29871, 822, 15837, 29918, 9144, 29898, 1311, 29892, 4055, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 24681, 29899, 5943, 13, 1678, 565, 1583, 3032, 13699, 338, 6213, 29901, 13, 418, 736, 13, 1678, 679, 5552, 29898, 1311, 3032, 13699, 29892, 7876, 29918, 978, 5033, 4039, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 1678, 396, 282, 2904, 524, 29901, 9025, 29922, 24681, 29899, 5943, 13, 29871, 15837, 29918, 9144, 17255, 978, 1649, 353, 7876, 29918, 978, 13, 29871, 736, 15837, 29918, 9144, 13, 13, 13, 1990, 6991, 5219, 10507, 29898, 3318, 1125, 13, 29871, 9995, 9832, 1078, 263, 4226, 6991, 5219, 10507, 565, 445, 338, 3495, 29871, 29900, 29889, 319, 20254, 6467, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 1480, 29918, 3972, 29901, 851, 1125, 13, 1678, 1583, 3032, 13699, 353, 6213, 13, 1678, 565, 432, 1165, 29889, 5014, 29918, 2248, 580, 1275, 29871, 29900, 29901, 13, 418, 1583, 3032, 13699, 353, 12489, 3377, 29889, 26289, 10507, 29898, 1188, 29918, 3972, 29897, 13, 13, 29871, 1426, 353, 903, 5675, 29918, 7727, 29918, 9144, 703, 726, 1159, 13, 29871, 1967, 353, 903, 5675, 29918, 7727, 29918, 9144, 703, 3027, 1159, 13, 29871, 17336, 353, 903, 5675, 29918, 7727, 29918, 9144, 703, 19529, 279, 1159, 13, 29871, 9825, 13342, 353, 903, 5675, 29918, 7727, 29918, 9144, 703, 29882, 391, 13342, 1159, 13, 13, 13, 1753, 4078, 29918, 3198, 3149, 10456, 5085, 29892, 3579, 19290, 1125, 13, 29871, 9995, 11730, 4078, 263, 1423, 3149, 565, 445, 338, 432, 1165, 1889, 29871, 29900, 29889, 13466, 1209, 1213, 15945, 13, 29871, 565, 432, 1165, 29889, 5014, 29918, 2248, 580, 2804, 29871, 29900, 29901, 13, 1678, 736, 13, 29871, 1423, 9748, 29889, 7620, 29918, 3198, 3149, 10456, 5085, 29892, 3579, 19290, 29897, 13, 2 ]
livestreaming-tools/blog.py
holdenk/livestreaming-tools
7
160244
<reponame>holdenk/livestreaming-tools #!/home/hkarau/repos/livestreaming-tools/myvenv/bin/python from __future__ import print_function import logging import os import markdown2 from embed_helpers import * from shortten import shortten from utils import pacific_now, get_now_to_match logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel("DEBUG") def tw_link(username): if len(username) > 2 and username[0] == "@": return ("<a href='https://www.twitter.com/{short_username}'>{username}</a>" .format(username=username, short_username=username[1:])) else: return username def format_event_blog(event): logger.debug("Formatting event title: {0}\n".format(event["title"])) now = pacific_now() event_in_past = event["date"] < now.date() or \ ("start" in event and event["start"] and event["start"] < now) def me_or_us(): if event["copresenters"] is not None: presenters = ["@holdenkarau"] presenters.extend(event["copresenters"]) presenters_html = ",".join(map(tw_link, presenters)) return "us ({presenters_html})".format(presenters_html=presenters_html) else: return "<a href='http://www.twitter.com/holdenkarau'>me</a>" def thanks_or_come_join(): if event_in_past: return "Thanks for joining {me_or_us} on {date}" else: return "Come join {me_or_us} on {time_or_date}" def time_or_date(): if event["start"]: return event["start"].strftime("%A %d %B @ %H:%M") else: return event["date"].strftime("%A %d. %B %Y") def year(): year = str(event["date"].year) if year in event["event_name"]: return "" else: return " " + year def where(): if event["event_name"] is not None: if event["location"] is not None: return "at {event_name}{year} {location}" return "" def talk_details(): if event["talk_description"] is not None: new_description = markdown2.markdown(event["talk_description"]) return "The talk covered: {new_description}.".format(new_description=new_description) elif event["room"] is not None: return "The room will be <b>{room}</b>." return "" def event_type(): if event["event_type"] is not None: return event["event_type"] elif "book" in event["title"].lower(): return "signing" else: return "talk" def talk_links(): link_text = "" if event["short_repo_link"] is not None: link_text += 'You can find the code for this <a href="{short_repo_link}">talk at {repo_link}</a>.' if event["short_slides_link"] is not None: link_text += 'The <a href="{short_slides_link}">slides are at {short_slides_link}</a>.' if event["short_video_link"] is not None: link_text += 'The <a href="{short_video_link}">video of the talk is up at {short_video_link}</a>.' if event["short_related_video"] is not None: link_text += 'There is a <a href="{short_related_video}">related video</a> you might want to check out.' # Put the link's in a paragraph. if event["short_codelab_link"] is not None: link_text += 'And if you want there is a <a href="{short_codelab_link}">related codelab you can try out</a>.' if link_text != "": link_text = "<p>{0}</p>".format(link_text) if link_text == "" and event_type() == "talk": link_text = "I'll update this post with the slides soon." return link_text def talk_embeds(): embed_text = "" if is_youtube(event["video_link"]): embed_text += embed_youtube(event["video_link"]) elif is_vimeo(event["video_link"]): embed_text += embed_vimeo(event["video_link"]) if is_youtube(event["related_video"]): embed_text += embed_youtube(event["related_video"]) if is_slideshare(event["slides_link"]): embed_text += embed_slideshare(event["slides_link"]) return embed_text def discussion(): if event["discussion_link"]: return '<a href="{short_discussion_link}">Join in the discussion at {short_discussion_link}</a> :)' elif event_in_past: return "Comment bellow to join in the discussion :)" else: return "Come see to the {event_type} or comment bellow to join in the discussion :)" def footer(): return os.getenv( "POST_FOOTER", '<a href="http://bit.ly/holdenTalkFeedback">Talk feedback is appreciated at http://bit.ly/holdenTalkFeedback</a>') def title_w_link(): if event['short_talk_link']: return '<a href="{short_talk_link}">{title}</a>' return '{title}' def generate_related_links(): if event['related_links']: links = map(lambda link_text: '<a href="{link}">{text}</a>'.format(link=link_text[0], text=link_text[1]), event['related_links']) return 'And some related links: ' + ", ".join(links) return "" fmt_elements = event.copy() other_elements = { 'event_type': event_type(), 'me_or_us': me_or_us(), 'year': year(), 'time_or_date': time_or_date(), 'thanks_or_come_join': thanks_or_come_join(), 'where': where(), 'talk_details': talk_details(), 'talk_links': talk_links(), 'talk_embeds': talk_embeds(), 'title_w_link': title_w_link(), 'related_links': generate_related_links(), 'discussion': discussion(), 'footer': footer()} fmt_elements.update(other_elements) # Format until we're done c = 0 post_string = event['blog_fmt_text'] or \ ("{thanks_or_come_join} {where} for {title_w_link}.{talk_details}{talk_links}" "{talk_embeds}{related_links}{discussion}.{footer}") result = post_string.format(**fmt_elements) while result != result.format(**fmt_elements): result = result.format(**fmt_elements) return result def make_event_blogs(events, blog_service): """Make the posts for the provided events. Mutates the events to contain the new post text if we generate a post.""" logger.debug("Looking at events {0}".format(events)) event_and_posts = map(lambda event: (event, format_event_blog(event)), events) event_and_posts_to_be_updated = filter( lambda e_p: e_p[0]["post_id"] is not None and e_p[0]["last_post_text"] != e_p[1], event_and_posts) event_and_posts_to_be_created = filter( lambda e_p: e_p[0]["last_post_text"] is None and e_p[0]["post_id"] is None, event_and_posts) logger.debug("New posts to be created {0}".format(event_and_posts_to_be_created)) logger.debug(dir(blog_service)) logger.debug(dir(blog_service.blogs())) blog_id_query = blog_service.blogs().getByUrl(url="http://blog.holdenkarau.com") blog_id = blog_id_query.execute()['id'] logger.debug("Blog id {blog_id}".format(blog_id=blog_id)) for event, post in event_and_posts_to_be_created: event["changed"] = True post_query = blog_service.posts().insert( body={"title": event["title"] + " @ " + event["event_name"], "content": post}, blogId=blog_id) post_result = post_query.execute() event["post_link"] = str(post_result["url"]) event["post_id"] = str(post_result["id"]) event["last_post_text"] = post event["short_post_link"] = shortten(event["post_link"]) # Temporary hack only make one post per call, leave the rest for later # so as to not overwhelm. TODO(holden) -- better schedualing break for event, post in event_and_posts_to_be_updated: event["changed"] = True post_query = blog_service.posts().update( body={"title": event["title"] + " @ " + event["event_name"], "content": post}, blogId=blog_id, postId=event["post_id"]) post_query.execute() event["last_post_text"] = post return events
[ 1, 529, 276, 1112, 420, 29958, 8948, 5842, 29914, 17843, 342, 1633, 292, 29899, 8504, 13, 29937, 14708, 5184, 29914, 29882, 5689, 585, 29914, 276, 1066, 29914, 17843, 342, 1633, 292, 29899, 8504, 29914, 1357, 854, 29894, 29914, 2109, 29914, 4691, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 12183, 13, 5215, 2897, 13, 13, 5215, 2791, 3204, 29906, 13, 13, 3166, 8297, 29918, 3952, 6774, 1053, 334, 13, 3166, 3273, 841, 1053, 3273, 841, 13, 3166, 3667, 29879, 1053, 22906, 928, 29918, 3707, 29892, 679, 29918, 3707, 29918, 517, 29918, 4352, 13, 13, 21027, 29889, 16121, 3991, 580, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 21707, 29889, 842, 10108, 703, 18525, 1159, 13, 13, 13, 1753, 3252, 29918, 2324, 29898, 6786, 1125, 13, 1678, 565, 7431, 29898, 6786, 29897, 1405, 29871, 29906, 322, 8952, 29961, 29900, 29962, 1275, 17962, 1115, 13, 4706, 736, 4852, 29966, 29874, 2822, 2433, 991, 597, 1636, 29889, 24946, 29889, 510, 19248, 12759, 29918, 6786, 10162, 26208, 6786, 16040, 29874, 11903, 13, 18884, 869, 4830, 29898, 6786, 29922, 6786, 29892, 3273, 29918, 6786, 29922, 6786, 29961, 29896, 29901, 12622, 13, 1678, 1683, 29901, 13, 4706, 736, 8952, 13, 13, 13, 1753, 3402, 29918, 3696, 29918, 7312, 29898, 3696, 1125, 13, 1678, 17927, 29889, 8382, 703, 2500, 23980, 1741, 3611, 29901, 426, 29900, 1012, 29876, 1642, 4830, 29898, 3696, 3366, 3257, 3108, 876, 13, 13, 1678, 1286, 353, 22906, 928, 29918, 3707, 580, 13, 1678, 1741, 29918, 262, 29918, 29886, 579, 353, 1741, 3366, 1256, 3108, 529, 1286, 29889, 1256, 580, 470, 320, 13, 4706, 4852, 2962, 29908, 297, 1741, 322, 1741, 3366, 2962, 3108, 322, 1741, 3366, 2962, 3108, 529, 1286, 29897, 13, 13, 1678, 822, 592, 29918, 272, 29918, 375, 7295, 13, 4706, 565, 1741, 3366, 9708, 690, 296, 414, 3108, 338, 451, 6213, 29901, 13, 9651, 2198, 414, 353, 6796, 29992, 8948, 264, 5689, 585, 3108, 13, 9651, 2198, 414, 29889, 21843, 29898, 3696, 3366, 9708, 690, 296, 414, 20068, 13, 9651, 2198, 414, 29918, 1420, 353, 9162, 1642, 7122, 29898, 1958, 29898, 7516, 29918, 2324, 29892, 2198, 414, 876, 13, 9651, 736, 376, 375, 21313, 6338, 414, 29918, 1420, 1800, 1642, 4830, 29898, 6338, 414, 29918, 1420, 29922, 6338, 414, 29918, 1420, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 9872, 29874, 2822, 2433, 1124, 597, 1636, 29889, 24946, 29889, 510, 29914, 8948, 264, 5689, 585, 11041, 1004, 829, 29874, 11903, 13, 13, 1678, 822, 3969, 29918, 272, 29918, 2763, 29918, 7122, 7295, 13, 4706, 565, 1741, 29918, 262, 29918, 29886, 579, 29901, 13, 9651, 736, 376, 16894, 363, 22960, 426, 1004, 29918, 272, 29918, 375, 29913, 373, 426, 1256, 5038, 13, 4706, 1683, 29901, 13, 9651, 736, 376, 27796, 5988, 426, 1004, 29918, 272, 29918, 375, 29913, 373, 426, 2230, 29918, 272, 29918, 1256, 5038, 13, 13, 1678, 822, 931, 29918, 272, 29918, 1256, 7295, 13, 4706, 565, 1741, 3366, 2962, 3108, 29901, 13, 9651, 736, 1741, 3366, 2962, 16862, 710, 615, 603, 11702, 29909, 1273, 29881, 1273, 29933, 732, 1273, 29950, 16664, 29924, 1159, 13, 4706, 1683, 29901, 13, 9651, 736, 1741, 3366, 1256, 16862, 710, 615, 603, 11702, 29909, 1273, 29881, 29889, 1273, 29933, 1273, 29979, 1159, 13, 13, 1678, 822, 1629, 7295, 13, 4706, 1629, 353, 851, 29898, 3696, 3366, 1256, 16862, 6360, 29897, 13, 4706, 565, 1629, 297, 1741, 3366, 3696, 29918, 978, 3108, 29901, 13, 9651, 736, 5124, 13, 4706, 1683, 29901, 13, 9651, 736, 376, 376, 718, 1629, 13, 13, 1678, 822, 988, 7295, 13, 4706, 565, 1741, 3366, 3696, 29918, 978, 3108, 338, 451, 6213, 29901, 13, 9651, 565, 1741, 3366, 5479, 3108, 338, 451, 6213, 29901, 13, 18884, 736, 376, 271, 426, 3696, 29918, 978, 1157, 6360, 29913, 426, 5479, 5038, 13, 4706, 736, 5124, 13, 13, 1678, 822, 5193, 29918, 14144, 7295, 13, 4706, 565, 1741, 3366, 29873, 2235, 29918, 8216, 3108, 338, 451, 6213, 29901, 13, 9651, 716, 29918, 8216, 353, 2791, 3204, 29906, 29889, 3502, 3204, 29898, 3696, 3366, 29873, 2235, 29918, 8216, 20068, 13, 9651, 736, 376, 1576, 5193, 10664, 29901, 426, 1482, 29918, 8216, 29913, 1213, 29889, 4830, 29898, 1482, 29918, 8216, 29922, 1482, 29918, 8216, 29897, 13, 4706, 25342, 1741, 3366, 8345, 3108, 338, 451, 6213, 29901, 13, 9651, 736, 376, 1576, 5716, 674, 367, 529, 29890, 26208, 8345, 16040, 29890, 29958, 1213, 13, 4706, 736, 5124, 13, 13, 1678, 822, 1741, 29918, 1853, 7295, 13, 4706, 565, 1741, 3366, 3696, 29918, 1853, 3108, 338, 451, 6213, 29901, 13, 9651, 736, 1741, 3366, 3696, 29918, 1853, 3108, 13, 4706, 25342, 376, 2909, 29908, 297, 1741, 3366, 3257, 16862, 13609, 7295, 13, 9651, 736, 376, 4530, 292, 29908, 13, 4706, 1683, 29901, 13, 9651, 736, 376, 29873, 2235, 29908, 13, 13, 1678, 822, 5193, 29918, 4965, 7295, 13, 4706, 1544, 29918, 726, 353, 5124, 13, 4706, 565, 1741, 3366, 12759, 29918, 20095, 29918, 2324, 3108, 338, 451, 6213, 29901, 13, 9651, 1544, 29918, 726, 4619, 525, 3492, 508, 1284, 278, 775, 363, 445, 529, 29874, 2822, 10724, 12759, 29918, 20095, 29918, 2324, 29913, 1013, 29873, 2235, 472, 426, 20095, 29918, 2324, 16040, 29874, 29958, 6169, 13, 4706, 565, 1741, 3366, 12759, 29918, 2536, 2247, 29918, 2324, 3108, 338, 451, 6213, 29901, 13, 9651, 1544, 29918, 726, 4619, 525, 1576, 529, 29874, 2822, 10724, 12759, 29918, 2536, 2247, 29918, 2324, 29913, 1013, 2536, 2247, 526, 472, 426, 12759, 29918, 2536, 2247, 29918, 2324, 16040, 29874, 29958, 6169, 13, 4706, 565, 1741, 3366, 12759, 29918, 9641, 29918, 2324, 3108, 338, 451, 6213, 29901, 13, 9651, 1544, 29918, 726, 4619, 525, 1576, 529, 29874, 2822, 10724, 12759, 29918, 9641, 29918, 2324, 29913, 1013, 9641, 310, 278, 5193, 338, 701, 472, 426, 12759, 29918, 9641, 29918, 2324, 16040, 29874, 29958, 6169, 13, 4706, 565, 1741, 3366, 12759, 29918, 12817, 29918, 9641, 3108, 338, 451, 6213, 29901, 13, 9651, 1544, 29918, 726, 4619, 525, 8439, 338, 263, 529, 29874, 2822, 10724, 12759, 29918, 12817, 29918, 9641, 29913, 1013, 12817, 4863, 829, 29874, 29958, 366, 1795, 864, 304, 1423, 714, 6169, 13, 4706, 396, 12065, 278, 1544, 29915, 29879, 297, 263, 14880, 29889, 13, 4706, 565, 1741, 3366, 12759, 29918, 19284, 295, 370, 29918, 2324, 3108, 338, 451, 6213, 29901, 13, 9651, 1544, 29918, 726, 4619, 525, 2855, 565, 366, 864, 727, 338, 263, 529, 29874, 2822, 10724, 12759, 29918, 19284, 295, 370, 29918, 2324, 29913, 1013, 12817, 15234, 295, 370, 366, 508, 1018, 714, 829, 29874, 29958, 6169, 13, 4706, 565, 1544, 29918, 726, 2804, 376, 1115, 13, 9651, 1544, 29918, 726, 353, 9872, 29886, 26208, 29900, 16040, 29886, 29958, 1642, 4830, 29898, 2324, 29918, 726, 29897, 13, 4706, 565, 1544, 29918, 726, 1275, 5124, 322, 1741, 29918, 1853, 580, 1275, 376, 29873, 2235, 1115, 13, 9651, 1544, 29918, 726, 353, 376, 29902, 29915, 645, 2767, 445, 1400, 411, 278, 2243, 2247, 4720, 1213, 13, 4706, 736, 1544, 29918, 726, 13, 13, 1678, 822, 5193, 29918, 1590, 5779, 7295, 13, 4706, 8297, 29918, 726, 353, 5124, 13, 4706, 565, 338, 29918, 19567, 29898, 3696, 3366, 9641, 29918, 2324, 3108, 1125, 13, 9651, 8297, 29918, 726, 4619, 8297, 29918, 19567, 29898, 3696, 3366, 9641, 29918, 2324, 20068, 13, 4706, 25342, 338, 29918, 29894, 603, 29877, 29898, 3696, 3366, 9641, 29918, 2324, 3108, 1125, 13, 9651, 8297, 29918, 726, 4619, 8297, 29918, 29894, 603, 29877, 29898, 3696, 3366, 9641, 29918, 2324, 20068, 13, 4706, 565, 338, 29918, 19567, 29898, 3696, 3366, 12817, 29918, 9641, 3108, 1125, 13, 9651, 8297, 29918, 726, 4619, 8297, 29918, 19567, 29898, 3696, 3366, 12817, 29918, 9641, 20068, 13, 4706, 565, 338, 29918, 2536, 2247, 29882, 598, 29898, 3696, 3366, 2536, 2247, 29918, 2324, 3108, 1125, 13, 9651, 8297, 29918, 726, 4619, 8297, 29918, 2536, 2247, 29882, 598, 29898, 3696, 3366, 2536, 2247, 29918, 2324, 20068, 13, 4706, 736, 8297, 29918, 726, 13, 13, 1678, 822, 10679, 7295, 13, 4706, 565, 1741, 3366, 26404, 29918, 2324, 3108, 29901, 13, 9651, 736, 12801, 29874, 2822, 10724, 12759, 29918, 26404, 29918, 2324, 29913, 1013, 17242, 297, 278, 10679, 472, 426, 12759, 29918, 26404, 29918, 2324, 16040, 29874, 29958, 4248, 29915, 13, 4706, 25342, 1741, 29918, 262, 29918, 29886, 579, 29901, 13, 9651, 736, 376, 20001, 289, 4743, 304, 5988, 297, 278, 10679, 4248, 29908, 13, 4706, 1683, 29901, 13, 9651, 736, 376, 27796, 1074, 304, 278, 426, 3696, 29918, 1853, 29913, 470, 3440, 289, 4743, 304, 5988, 297, 278, 10679, 4248, 29908, 13, 13, 13, 1678, 822, 24166, 7295, 13, 4706, 736, 2897, 29889, 657, 6272, 29898, 13, 9651, 376, 5438, 29918, 5800, 2891, 1001, 613, 13, 9651, 12801, 29874, 2822, 543, 1124, 597, 2966, 29889, 368, 29914, 8948, 264, 29911, 2235, 29737, 1627, 1013, 29911, 2235, 16705, 338, 7556, 472, 1732, 597, 2966, 29889, 368, 29914, 8948, 264, 29911, 2235, 29737, 1627, 829, 29874, 29958, 1495, 13, 13, 1678, 822, 3611, 29918, 29893, 29918, 2324, 7295, 13, 4706, 565, 1741, 1839, 12759, 29918, 29873, 2235, 29918, 2324, 2033, 29901, 13, 9651, 736, 12801, 29874, 2822, 10724, 12759, 29918, 29873, 2235, 29918, 2324, 29913, 1013, 29912, 3257, 16040, 29874, 16299, 13, 4706, 736, 22372, 3257, 10162, 13, 13, 1678, 822, 5706, 29918, 12817, 29918, 4965, 7295, 13, 4706, 565, 1741, 1839, 12817, 29918, 4965, 2033, 29901, 13, 9651, 2988, 353, 2910, 29898, 2892, 1544, 29918, 726, 29901, 13, 18884, 12801, 29874, 2822, 10724, 2324, 29913, 1013, 29912, 726, 16040, 29874, 29958, 4286, 4830, 29898, 2324, 29922, 2324, 29918, 726, 29961, 29900, 1402, 1426, 29922, 2324, 29918, 726, 29961, 29896, 11724, 13, 18884, 1741, 1839, 12817, 29918, 4965, 11287, 13, 9651, 736, 525, 2855, 777, 4475, 2988, 29901, 525, 718, 9162, 11393, 7122, 29898, 4965, 29897, 13, 4706, 736, 5124, 13, 13, 1678, 19200, 29918, 17664, 353, 1741, 29889, 8552, 580, 13, 1678, 916, 29918, 17664, 353, 426, 13, 4706, 525, 3696, 29918, 1853, 2396, 1741, 29918, 1853, 3285, 13, 4706, 525, 1004, 29918, 272, 29918, 375, 2396, 592, 29918, 272, 29918, 375, 3285, 525, 6360, 2396, 1629, 3285, 13, 4706, 525, 2230, 29918, 272, 29918, 1256, 2396, 931, 29918, 272, 29918, 1256, 3285, 13, 4706, 525, 386, 1331, 29918, 272, 29918, 2763, 29918, 7122, 2396, 3969, 29918, 272, 29918, 2763, 29918, 7122, 3285, 525, 3062, 2396, 988, 3285, 13, 4706, 525, 29873, 2235, 29918, 14144, 2396, 5193, 29918, 14144, 3285, 525, 29873, 2235, 29918, 4965, 2396, 5193, 29918, 4965, 3285, 525, 29873, 2235, 29918, 1590, 5779, 2396, 5193, 29918, 1590, 5779, 3285, 13, 4706, 525, 3257, 29918, 29893, 29918, 2324, 2396, 3611, 29918, 29893, 29918, 2324, 3285, 13, 4706, 525, 12817, 29918, 4965, 2396, 5706, 29918, 12817, 29918, 4965, 3285, 13, 4706, 525, 26404, 2396, 10679, 3285, 525, 21720, 2396, 24166, 28296, 13, 1678, 19200, 29918, 17664, 29889, 5504, 29898, 1228, 29918, 17664, 29897, 13, 13, 1678, 396, 19191, 2745, 591, 29915, 276, 2309, 13, 1678, 274, 353, 29871, 29900, 13, 1678, 1400, 29918, 1807, 353, 1741, 1839, 7312, 29918, 23479, 29918, 726, 2033, 470, 320, 13, 4706, 4852, 29912, 386, 1331, 29918, 272, 29918, 2763, 29918, 7122, 29913, 426, 3062, 29913, 363, 426, 3257, 29918, 29893, 29918, 2324, 1836, 29912, 29873, 2235, 29918, 14144, 1157, 29873, 2235, 29918, 4965, 5038, 13, 308, 29850, 29873, 2235, 29918, 1590, 5779, 1157, 12817, 29918, 4965, 1157, 26404, 1836, 29912, 21720, 27195, 13, 1678, 1121, 353, 1400, 29918, 1807, 29889, 4830, 29898, 1068, 23479, 29918, 17664, 29897, 13, 1678, 1550, 1121, 2804, 1121, 29889, 4830, 29898, 1068, 23479, 29918, 17664, 1125, 13, 4706, 1121, 353, 1121, 29889, 4830, 29898, 1068, 23479, 29918, 17664, 29897, 13, 1678, 736, 1121, 13, 13, 13, 1753, 1207, 29918, 3696, 29918, 25762, 29898, 13604, 29892, 12618, 29918, 5509, 1125, 13, 1678, 9995, 9984, 278, 11803, 363, 278, 4944, 4959, 29889, 13, 1678, 20749, 1078, 278, 4959, 304, 1712, 278, 716, 1400, 1426, 565, 591, 5706, 263, 1400, 1213, 15945, 13, 1678, 17927, 29889, 8382, 703, 14959, 292, 472, 4959, 426, 29900, 29913, 1642, 4830, 29898, 13604, 876, 13, 1678, 1741, 29918, 392, 29918, 14080, 353, 2910, 29898, 2892, 1741, 29901, 313, 3696, 29892, 3402, 29918, 3696, 29918, 7312, 29898, 3696, 8243, 4959, 29897, 13, 1678, 1741, 29918, 392, 29918, 14080, 29918, 517, 29918, 915, 29918, 21402, 353, 4175, 29898, 13, 4706, 14013, 321, 29918, 29886, 29901, 321, 29918, 29886, 29961, 29900, 29962, 3366, 2490, 29918, 333, 3108, 338, 451, 6213, 322, 321, 29918, 29886, 29961, 29900, 29962, 3366, 4230, 29918, 2490, 29918, 726, 3108, 2804, 321, 29918, 29886, 29961, 29896, 1402, 13, 4706, 1741, 29918, 392, 29918, 14080, 29897, 13, 1678, 1741, 29918, 392, 29918, 14080, 29918, 517, 29918, 915, 29918, 11600, 353, 4175, 29898, 13, 4706, 14013, 321, 29918, 29886, 29901, 321, 29918, 29886, 29961, 29900, 29962, 3366, 4230, 29918, 2490, 29918, 726, 3108, 338, 6213, 322, 321, 29918, 29886, 29961, 29900, 29962, 3366, 2490, 29918, 333, 3108, 338, 6213, 29892, 13, 4706, 1741, 29918, 392, 29918, 14080, 29897, 13, 1678, 17927, 29889, 8382, 703, 4373, 11803, 304, 367, 2825, 426, 29900, 29913, 1642, 4830, 29898, 3696, 29918, 392, 29918, 14080, 29918, 517, 29918, 915, 29918, 11600, 876, 13, 1678, 17927, 29889, 8382, 29898, 3972, 29898, 7312, 29918, 5509, 876, 13, 1678, 17927, 29889, 8382, 29898, 3972, 29898, 7312, 29918, 5509, 29889, 25762, 22130, 13, 1678, 12618, 29918, 333, 29918, 1972, 353, 12618, 29918, 5509, 29889, 25762, 2141, 657, 2059, 5983, 29898, 2271, 543, 1124, 597, 7312, 29889, 8948, 264, 5689, 585, 29889, 510, 1159, 13, 1678, 12618, 29918, 333, 353, 12618, 29918, 333, 29918, 1972, 29889, 7978, 580, 1839, 333, 2033, 13, 1678, 17927, 29889, 8382, 703, 29933, 1188, 1178, 426, 7312, 29918, 333, 29913, 1642, 4830, 29898, 7312, 29918, 333, 29922, 7312, 29918, 333, 876, 13, 1678, 363, 1741, 29892, 1400, 297, 1741, 29918, 392, 29918, 14080, 29918, 517, 29918, 915, 29918, 11600, 29901, 13, 4706, 1741, 3366, 15033, 3108, 353, 5852, 13, 4706, 1400, 29918, 1972, 353, 12618, 29918, 5509, 29889, 14080, 2141, 7851, 29898, 13, 9651, 3573, 3790, 29908, 3257, 1115, 1741, 3366, 3257, 3108, 718, 376, 732, 376, 718, 1741, 3366, 3696, 29918, 978, 12436, 376, 3051, 1115, 1400, 1118, 13, 9651, 12618, 1204, 29922, 7312, 29918, 333, 29897, 13, 4706, 1400, 29918, 2914, 353, 1400, 29918, 1972, 29889, 7978, 580, 13, 4706, 1741, 3366, 2490, 29918, 2324, 3108, 353, 851, 29898, 2490, 29918, 2914, 3366, 2271, 20068, 13, 4706, 1741, 3366, 2490, 29918, 333, 3108, 353, 851, 29898, 2490, 29918, 2914, 3366, 333, 20068, 13, 4706, 1741, 3366, 4230, 29918, 2490, 29918, 726, 3108, 353, 1400, 13, 4706, 1741, 3366, 12759, 29918, 2490, 29918, 2324, 3108, 353, 3273, 841, 29898, 3696, 3366, 2490, 29918, 2324, 20068, 13, 4706, 396, 6789, 1971, 653, 15833, 871, 1207, 697, 1400, 639, 1246, 29892, 5967, 278, 1791, 363, 2678, 13, 4706, 396, 577, 408, 304, 451, 975, 1332, 16422, 29889, 14402, 29898, 8948, 264, 29897, 1192, 2253, 28598, 950, 292, 13, 4706, 2867, 13, 1678, 363, 1741, 29892, 1400, 297, 1741, 29918, 392, 29918, 14080, 29918, 517, 29918, 915, 29918, 21402, 29901, 13, 4706, 1741, 3366, 15033, 3108, 353, 5852, 13, 4706, 1400, 29918, 1972, 353, 12618, 29918, 5509, 29889, 14080, 2141, 5504, 29898, 13, 9651, 3573, 3790, 29908, 3257, 1115, 1741, 3366, 3257, 3108, 718, 376, 732, 376, 718, 1741, 3366, 3696, 29918, 978, 12436, 376, 3051, 1115, 1400, 1118, 13, 9651, 12618, 1204, 29922, 7312, 29918, 333, 29892, 1400, 1204, 29922, 3696, 3366, 2490, 29918, 333, 20068, 13, 4706, 1400, 29918, 1972, 29889, 7978, 580, 13, 4706, 1741, 3366, 4230, 29918, 2490, 29918, 726, 3108, 353, 1400, 13, 1678, 736, 4959, 13, 2 ]
118-Pascals-Triangle/solution.py
alfmunny/leetcode
0
95127
class Solution: def generate(self, numRows: int) -> List[List[int]]: ans = [] for i in range(1, numRows+1): level = [1] * i if ans: for j in range(1, i-1): level[j] = ans[-1][j-1] + ans[-1][j] ans.append(level) return ans
[ 1, 770, 24380, 29901, 13, 1678, 822, 5706, 29898, 1311, 29892, 954, 10661, 29901, 938, 29897, 1599, 2391, 29961, 1293, 29961, 524, 5262, 29901, 13, 4706, 6063, 353, 5159, 13, 308, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 954, 10661, 29974, 29896, 1125, 13, 9651, 3233, 353, 518, 29896, 29962, 334, 474, 13, 632, 13, 9651, 565, 6063, 29901, 13, 18884, 363, 432, 297, 3464, 29898, 29896, 29892, 474, 29899, 29896, 1125, 13, 462, 1678, 3233, 29961, 29926, 29962, 353, 6063, 14352, 29896, 3816, 29926, 29899, 29896, 29962, 718, 6063, 14352, 29896, 3816, 29926, 29962, 13, 462, 268, 13, 9651, 6063, 29889, 4397, 29898, 5563, 29897, 13, 632, 13, 4706, 736, 6063, 13, 2 ]
unit_test/test_vx_base_target.py
owl129/vxhunter
189
190709
<filename>unit_test/test_vx_base_target.py from common import BaseTestCase, mock from serial_debuger.vx_base_target import VxSerialBaseTarget class VxSerialCmdDebugerTests(BaseTestCase): def setUp(self): super(VxSerialCmdDebugerTests, self).setUp() self.target = VxSerialBaseTarget() self.target.serial = mock.Mock() def check_serial_alive(self): self.target.check_serial_alive = mock.Mock(return_value=True) self.assertEqual(self.target.check_serial_alive(), True) def test_send_and_recvuntil(self): self.target.check_serial_alive = mock.Mock(return_value=True) self.target.serial.sendlinethen = mock.Mock(return_value="help # # some output") rsp = self.target.send_and_recvuntil("help") self.assertEqual(rsp, "help # # some output") def test_prepare_memory_dump_command(self): command = self.target.prepare_memory_dump_command(1000, 16) self.assertEqual(command, 'mem -dump 0x3e8 0x10') command = self.target.prepare_memory_dump_command(0x1000, 0x20) self.assertEqual(command, 'mem -dump 0x1000 0x20') def test_memory_dump_data_parser(self): dump_data = "80001000: 3C 08 10 00 40 88 60 00 - 40 80 68 00 00 00 00 40 \t <...@.`. @.h....@\r\n#" output_data = self.target.memory_dump_data_parser(dump_data) self.assertEqual(output_data, {2147487744: '3C081000408860004080680000000040'}) dump_data = "80001000: 3C 08 10 00 40 88 60 00 - 40 80 68 00 00 00 00 40 \t <...@.`. @.h....@\r\n" \ "80001010: 00 00 00 40 00 00 00 40 - 00 00 00 40 00 00 00 40 \t ...@...@ ...@...@\r\n#" output_data = self.target.memory_dump_data_parser(dump_data) self.assertEqual(output_data, {2147487744: '3C081000408860004080680000000040', 2147487760: '00000040000000400000004000000040'}) # print(output_data) def test_dump_memroy(self): self.target.send_and_recvuntil = mock.Mock( return_value=" mem -dump 0x80001000 0x20\r\n" "80001000: 3C 08 10 00 40 88 60 00 - 40 80 68 00 00 00 00 40 \t <...@.`. @.h....@\r\n" "80001010: 00 00 00 40 00 00 00 40 - 00 00 00 40 00 00 00 40 \t ...@...@ ...@...@\r\n#") output_data = self.target._dump_memroy(start_address=0x80001000, size=0x20) self.assertEqual(output_data, {2147487744: '3C081000408860004080680000000040', 2147487760: '00000040000000400000004000000040'}) def test_get_mem_dump(self): self.target.send_and_recvuntil = mock.Mock( return_value=" mem -dump 0x80001000 0x20\r\n" "80001000: 3C 08 10 00 40 88 60 00 - 40 80 68 00 00 00 00 40 \t <...@.`. @.h....@\r\n" "80001010: 00 00 00 40 00 00 00 40 - 00 00 00 40 00 00 00 40 \t ...@...@ ...@...@\r\n#") output_data = self.target.get_mem_dump(start_address=0x80001000, size=0x20) self.assertEqual(output_data.encode('hex'), '3c08100040886000408068000000004000000040000000400000004000000040')
[ 1, 529, 9507, 29958, 5441, 29918, 1688, 29914, 1688, 29918, 29894, 29916, 29918, 3188, 29918, 5182, 29889, 2272, 13, 3166, 3619, 1053, 7399, 3057, 8259, 29892, 11187, 13, 3166, 7797, 29918, 8382, 261, 29889, 29894, 29916, 29918, 3188, 29918, 5182, 1053, 478, 29916, 9125, 5160, 8667, 13, 13, 13, 1990, 478, 29916, 9125, 23651, 11862, 261, 24376, 29898, 5160, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29963, 29916, 9125, 23651, 11862, 261, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 5182, 353, 478, 29916, 9125, 5160, 8667, 580, 13, 4706, 1583, 29889, 5182, 29889, 15550, 353, 11187, 29889, 18680, 580, 13, 13, 1678, 822, 1423, 29918, 15550, 29918, 284, 573, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5182, 29889, 3198, 29918, 15550, 29918, 284, 573, 353, 11187, 29889, 18680, 29898, 2457, 29918, 1767, 29922, 5574, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 5182, 29889, 3198, 29918, 15550, 29918, 284, 573, 3285, 5852, 29897, 13, 13, 1678, 822, 1243, 29918, 6717, 29918, 392, 29918, 3757, 29894, 29305, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5182, 29889, 3198, 29918, 15550, 29918, 284, 573, 353, 11187, 29889, 18680, 29898, 2457, 29918, 1767, 29922, 5574, 29897, 13, 4706, 1583, 29889, 5182, 29889, 15550, 29889, 6717, 1915, 621, 264, 353, 11187, 29889, 18680, 29898, 2457, 29918, 1767, 543, 8477, 396, 396, 777, 1962, 1159, 13, 4706, 364, 1028, 353, 1583, 29889, 5182, 29889, 6717, 29918, 392, 29918, 3757, 29894, 29305, 703, 8477, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29878, 1028, 29892, 376, 8477, 396, 396, 777, 1962, 1159, 13, 13, 1678, 822, 1243, 29918, 19125, 29918, 14834, 29918, 15070, 29918, 6519, 29898, 1311, 1125, 13, 4706, 1899, 353, 1583, 29889, 5182, 29889, 19125, 29918, 14834, 29918, 15070, 29918, 6519, 29898, 29896, 29900, 29900, 29900, 29892, 29871, 29896, 29953, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6519, 29892, 525, 6954, 448, 15070, 29871, 29900, 29916, 29941, 29872, 29947, 29871, 29900, 29916, 29896, 29900, 1495, 13, 4706, 1899, 353, 1583, 29889, 5182, 29889, 19125, 29918, 14834, 29918, 15070, 29918, 6519, 29898, 29900, 29916, 29896, 29900, 29900, 29900, 29892, 29871, 29900, 29916, 29906, 29900, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6519, 29892, 525, 6954, 448, 15070, 29871, 29900, 29916, 29896, 29900, 29900, 29900, 29871, 29900, 29916, 29906, 29900, 1495, 13, 13, 1678, 822, 1243, 29918, 14834, 29918, 15070, 29918, 1272, 29918, 16680, 29898, 1311, 1125, 13, 4706, 16766, 29918, 1272, 353, 376, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29901, 259, 29941, 29907, 29871, 29900, 29947, 29871, 29896, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29947, 29947, 29871, 29953, 29900, 29871, 29900, 29900, 448, 29871, 29946, 29900, 29871, 29947, 29900, 29871, 29953, 29947, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 320, 29873, 29871, 529, 856, 29992, 29889, 1412, 732, 29889, 29882, 3045, 29992, 29905, 29878, 29905, 29876, 29937, 29908, 13, 4706, 1962, 29918, 1272, 353, 1583, 29889, 5182, 29889, 14834, 29918, 15070, 29918, 1272, 29918, 16680, 29898, 15070, 29918, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 4905, 29918, 1272, 29892, 426, 29906, 29896, 29946, 29955, 29946, 29947, 29955, 29955, 29946, 29946, 29901, 525, 29941, 29907, 29900, 29947, 29896, 29900, 29900, 29900, 29946, 29900, 29947, 29947, 29953, 29900, 29900, 29900, 29946, 29900, 29947, 29900, 29953, 29947, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29915, 1800, 13, 4706, 16766, 29918, 1272, 353, 376, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29901, 259, 29941, 29907, 29871, 29900, 29947, 29871, 29896, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29947, 29947, 29871, 29953, 29900, 29871, 29900, 29900, 448, 29871, 29946, 29900, 29871, 29947, 29900, 29871, 29953, 29947, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 320, 29873, 29871, 529, 856, 29992, 29889, 1412, 732, 29889, 29882, 3045, 29992, 29905, 29878, 29905, 29876, 29908, 320, 13, 462, 1678, 376, 29947, 29900, 29900, 29900, 29896, 29900, 29896, 29900, 29901, 259, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 448, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 320, 29873, 29871, 2023, 29992, 856, 29992, 2023, 29992, 856, 29992, 29905, 29878, 29905, 29876, 29937, 29908, 13, 4706, 1962, 29918, 1272, 353, 1583, 29889, 5182, 29889, 14834, 29918, 15070, 29918, 1272, 29918, 16680, 29898, 15070, 29918, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 4905, 29918, 1272, 29892, 426, 29906, 29896, 29946, 29955, 29946, 29947, 29955, 29955, 29946, 29946, 29901, 525, 29941, 29907, 29900, 29947, 29896, 29900, 29900, 29900, 29946, 29900, 29947, 29947, 29953, 29900, 29900, 29900, 29946, 29900, 29947, 29900, 29953, 29947, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 742, 13, 462, 462, 4706, 29906, 29896, 29946, 29955, 29946, 29947, 29955, 29955, 29953, 29900, 29901, 525, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29915, 1800, 13, 4706, 396, 1596, 29898, 4905, 29918, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 15070, 29918, 6954, 4727, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5182, 29889, 6717, 29918, 392, 29918, 3757, 29894, 29305, 353, 11187, 29889, 18680, 29898, 13, 9651, 736, 29918, 1767, 543, 2626, 448, 15070, 29871, 29900, 29916, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29871, 29900, 29916, 29906, 29900, 29905, 29878, 29905, 29876, 29908, 13, 462, 308, 376, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29901, 259, 29941, 29907, 29871, 29900, 29947, 29871, 29896, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29947, 29947, 29871, 29953, 29900, 29871, 29900, 29900, 448, 29871, 29946, 29900, 29871, 29947, 29900, 29871, 29953, 29947, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 320, 29873, 29871, 529, 856, 29992, 29889, 1412, 732, 29889, 29882, 3045, 29992, 29905, 29878, 29905, 29876, 29908, 13, 462, 308, 376, 29947, 29900, 29900, 29900, 29896, 29900, 29896, 29900, 29901, 259, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 448, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 320, 29873, 29871, 2023, 29992, 856, 29992, 2023, 29992, 856, 29992, 29905, 29878, 29905, 29876, 29937, 1159, 13, 4706, 1962, 29918, 1272, 353, 1583, 29889, 5182, 3032, 15070, 29918, 6954, 4727, 29898, 2962, 29918, 7328, 29922, 29900, 29916, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29892, 2159, 29922, 29900, 29916, 29906, 29900, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 4905, 29918, 1272, 29892, 426, 29906, 29896, 29946, 29955, 29946, 29947, 29955, 29955, 29946, 29946, 29901, 525, 29941, 29907, 29900, 29947, 29896, 29900, 29900, 29900, 29946, 29900, 29947, 29947, 29953, 29900, 29900, 29900, 29946, 29900, 29947, 29900, 29953, 29947, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 742, 13, 462, 462, 4706, 29906, 29896, 29946, 29955, 29946, 29947, 29955, 29955, 29953, 29900, 29901, 525, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29915, 1800, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 6954, 29918, 15070, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5182, 29889, 6717, 29918, 392, 29918, 3757, 29894, 29305, 353, 11187, 29889, 18680, 29898, 13, 9651, 736, 29918, 1767, 543, 2626, 448, 15070, 29871, 29900, 29916, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29871, 29900, 29916, 29906, 29900, 29905, 29878, 29905, 29876, 29908, 13, 462, 308, 376, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29901, 259, 29941, 29907, 29871, 29900, 29947, 29871, 29896, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29947, 29947, 29871, 29953, 29900, 29871, 29900, 29900, 448, 29871, 29946, 29900, 29871, 29947, 29900, 29871, 29953, 29947, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 320, 29873, 29871, 529, 856, 29992, 29889, 1412, 732, 29889, 29882, 3045, 29992, 29905, 29878, 29905, 29876, 29908, 13, 462, 308, 376, 29947, 29900, 29900, 29900, 29896, 29900, 29896, 29900, 29901, 259, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 448, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29900, 29900, 29871, 29946, 29900, 320, 29873, 29871, 2023, 29992, 856, 29992, 2023, 29992, 856, 29992, 29905, 29878, 29905, 29876, 29937, 1159, 13, 4706, 1962, 29918, 1272, 353, 1583, 29889, 5182, 29889, 657, 29918, 6954, 29918, 15070, 29898, 2962, 29918, 7328, 29922, 29900, 29916, 29947, 29900, 29900, 29900, 29896, 29900, 29900, 29900, 29892, 2159, 29922, 29900, 29916, 29906, 29900, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 4905, 29918, 1272, 29889, 12508, 877, 20970, 5477, 525, 29941, 29883, 29900, 29947, 29896, 29900, 29900, 29900, 29946, 29900, 29947, 29947, 29953, 29900, 29900, 29900, 29946, 29900, 29947, 29900, 29953, 29947, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 1495, 2 ]
PythonExercicios/ex039.py
lordvinick/Python
0
29724
<filename>PythonExercicios/ex039.py print('\033[36m='*12, '\033[32mAlistamento Militar', '\033[36m='*12) from datetime import date ano = int(input('Em que ano você nasceu? ')) atual = date.today().year idade = atual - ano print(f'Você tem \033[32m{idade} \033[36manos em \033[32m{atual}.') if idade == 18: print('\033[36mTa na hora de se alistar.') elif idade < 18: print(f'\033[36mAinda falta(m) \033[32m{18 - idade} \033[36mano(s) para se alistar \nSeu alistamento será em \033[32m{ano+18}.') elif idade > 18: print(f'\033[31mVocê deveria ter se alistado há \033[32m{idade - 18} \033[31manos atrás.\n\033[36mSeu alistamento foi em \033[32m{ano+18}.')
[ 1, 529, 9507, 29958, 11980, 1252, 6269, 19382, 29914, 735, 29900, 29941, 29929, 29889, 2272, 13, 2158, 28909, 29900, 29941, 29941, 29961, 29941, 29953, 29885, 2433, 29930, 29896, 29906, 29892, 11297, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 29909, 1761, 4487, 3833, 3673, 742, 11297, 29900, 29941, 29941, 29961, 29941, 29953, 29885, 2433, 29930, 29896, 29906, 29897, 13, 3166, 12865, 1053, 2635, 13, 1562, 353, 938, 29898, 2080, 877, 6026, 712, 19410, 7931, 30037, 8281, 22541, 29973, 525, 876, 13, 271, 950, 353, 2635, 29889, 27765, 2141, 6360, 13, 5558, 353, 472, 950, 448, 19410, 13, 2158, 29898, 29888, 29915, 29963, 542, 30037, 1350, 320, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 29912, 5558, 29913, 320, 29900, 29941, 29941, 29961, 29941, 29953, 1171, 359, 953, 320, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 29912, 271, 950, 1836, 1495, 13, 361, 1178, 1943, 1275, 29871, 29896, 29947, 29901, 13, 1678, 1596, 28909, 29900, 29941, 29941, 29961, 29941, 29953, 29885, 29911, 29874, 1055, 298, 2207, 316, 409, 394, 391, 279, 29889, 1495, 13, 23681, 1178, 1943, 529, 29871, 29896, 29947, 29901, 13, 1678, 1596, 29898, 29888, 12764, 29900, 29941, 29941, 29961, 29941, 29953, 29885, 29909, 11054, 11092, 941, 29898, 29885, 29897, 320, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 29912, 29896, 29947, 448, 1178, 1943, 29913, 320, 29900, 29941, 29941, 29961, 29941, 29953, 1171, 29877, 29898, 29879, 29897, 1702, 409, 394, 391, 279, 320, 29876, 2008, 29884, 394, 391, 4487, 724, 29976, 953, 320, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 29912, 1562, 29974, 29896, 29947, 1836, 1495, 13, 23681, 1178, 1943, 1405, 29871, 29896, 29947, 29901, 13, 1678, 1596, 29898, 29888, 12764, 29900, 29941, 29941, 29961, 29941, 29896, 29885, 29963, 542, 30037, 316, 369, 423, 1935, 409, 394, 391, 912, 14859, 320, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 29912, 5558, 448, 29871, 29896, 29947, 29913, 320, 29900, 29941, 29941, 29961, 29941, 29896, 1171, 359, 472, 11964, 7790, 29876, 29905, 29900, 29941, 29941, 29961, 29941, 29953, 29885, 2008, 29884, 394, 391, 4487, 4732, 953, 320, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 29912, 1562, 29974, 29896, 29947, 1836, 1495, 13, 2 ]
integration/bazel_workspace_tests/bazel_ngtsc_plugin/packages.bzl
John-Cassidy/angular
95,154
24397
<filename>integration/bazel_workspace_tests/bazel_ngtsc_plugin/packages.bzl ANGULAR_PACKAGES_CONFIG = [ ("@angular/animations", struct(entry_points = ["browser"])), ("@angular/common", struct(entry_points = ["http/testing", "http", "testing"])), ("@angular/compiler", struct(entry_points = ["testing"])), ("@angular/core", struct(entry_points = ["testing"])), ("@angular/forms", struct(entry_points = [])), ("@angular/platform-browser", struct(entry_points = ["testing", "animations"])), ("@angular/platform-browser-dynamic", struct(entry_points = ["testing"])), ("@angular/router", struct(entry_points = [])), ] ANGULAR_PACKAGES = [ struct( name = name[len("@angular/"):], entry_points = config.entry_points, platform = config.platform if hasattr(config, "platform") else "browser", module_name = name, ) for name, config in ANGULAR_PACKAGES_CONFIG ]
[ 1, 529, 9507, 29958, 27925, 29914, 27975, 295, 29918, 1287, 3493, 29918, 21150, 29914, 27975, 295, 29918, 865, 1372, 29883, 29918, 8582, 29914, 8318, 29889, 29890, 29920, 29880, 13, 19453, 13309, 1718, 29918, 29925, 11375, 10461, 29903, 29918, 25903, 353, 518, 13, 1678, 4852, 29992, 6825, 29914, 11576, 800, 613, 2281, 29898, 8269, 29918, 9748, 353, 6796, 15965, 20068, 511, 13, 1678, 4852, 29992, 6825, 29914, 9435, 613, 2281, 29898, 8269, 29918, 9748, 353, 6796, 1124, 29914, 13424, 613, 376, 1124, 613, 376, 13424, 20068, 511, 13, 1678, 4852, 29992, 6825, 29914, 21789, 613, 2281, 29898, 8269, 29918, 9748, 353, 6796, 13424, 20068, 511, 13, 1678, 4852, 29992, 6825, 29914, 3221, 613, 2281, 29898, 8269, 29918, 9748, 353, 6796, 13424, 20068, 511, 13, 1678, 4852, 29992, 6825, 29914, 9514, 613, 2281, 29898, 8269, 29918, 9748, 353, 518, 2314, 511, 13, 1678, 4852, 29992, 6825, 29914, 12120, 29899, 15965, 613, 2281, 29898, 8269, 29918, 9748, 353, 6796, 13424, 613, 376, 11576, 800, 20068, 511, 13, 1678, 4852, 29992, 6825, 29914, 12120, 29899, 15965, 29899, 16626, 613, 2281, 29898, 8269, 29918, 9748, 353, 6796, 13424, 20068, 511, 13, 1678, 4852, 29992, 6825, 29914, 15140, 613, 2281, 29898, 8269, 29918, 9748, 353, 518, 2314, 511, 13, 29962, 13, 13, 19453, 13309, 1718, 29918, 29925, 11375, 10461, 29903, 353, 518, 13, 1678, 2281, 29898, 13, 4706, 1024, 353, 1024, 29961, 2435, 29475, 6825, 12975, 1125, 1402, 13, 4706, 6251, 29918, 9748, 353, 2295, 29889, 8269, 29918, 9748, 29892, 13, 4706, 7481, 353, 2295, 29889, 12120, 565, 756, 5552, 29898, 2917, 29892, 376, 12120, 1159, 1683, 376, 15965, 613, 13, 4706, 3883, 29918, 978, 353, 1024, 29892, 13, 1678, 1723, 13, 1678, 363, 1024, 29892, 2295, 297, 319, 9312, 13309, 1718, 29918, 29925, 11375, 10461, 29903, 29918, 25903, 13, 29962, 13, 2 ]
scripts/upload-readme.py
slashben/regolibrary
0
179074
import requests import os import json import re class ReadmeApi(object): def __init__(self): super().__init__() self.doc_version = None def authenticate(self, api_key): r = requests.get('https://dash.readme.com/api/v1', auth=(api_key, '')) if r.status_code != 200: raise Exception('Failed to authenticate') auth_response = r.json() self.jwt = auth_response['jwtSecret'] self.base_url = auth_response['baseUrl'] self.api_key = api_key def set_version(self, version:str): self.doc_version = version def get_categories(self): url = "https://dash.readme.com/api/v1/categories" querystring = {"perPage":"1000","page":"1"} r = requests.request("GET", url, params=querystring, auth=(self.api_key, '')) if r.status_code != 200: raise Exception('Failed to get categories') return r.json() def get_category(self,category_slug : str): url = "https://dash.readme.com/api/v1/categories/%s" % category_slug r = requests.request("GET", url,headers={"Accept": "application/json"}, auth=(self.api_key, '')) if r.status_code != 200: raise Exception('Failed to get categories') return r.json() def get_docs_in_category(self, category_slug: str): url = "https://dash.readme.com/api/v1/categories/%s/docs" % category_slug r = requests.request("GET", url, headers={"Accept":"application/json"}, auth=(self.api_key, '')) if r.status_code != 200: raise Exception('Failed to docs for category') return r.json() def get_doc(self, doc_slug: str): url = "https://dash.readme.com/api/v1/docs/%s" % doc_slug r = requests.request("GET", url, headers={"Accept":"application/json"}, auth=(self.api_key, '')) if r.status_code == 404: return None if r.status_code < 200 or 299 < r.status_code: raise Exception('Failed to docs for category') return r.json() def delete_doc(self, doc_slug: str): url = "https://dash.readme.com/api/v1/docs/%s" % doc_slug r = requests.request("DELETE", url, headers={"Accept":"application/json"}, auth=(self.api_key, '')) if r.status_code < 200 or 299 < r.status_code: raise Exception('Failed to delete doc (%d)'%r.status_code) def create_doc(self, slug: str, parent_id: str, order: int, title: str, body: str, category: str): url = "https://dash.readme.com/api/v1/docs" payload = { "hidden": False, "order": order, "title": title, "type": "basic", "body": body, "category": category, "parentDoc": parent_id, "slug": slug } headers = { "Accept": "application/json", "Content-Type": "application/json", } r = requests.request("POST", url, json=payload, headers=headers, auth=(self.api_key, '')) if r.status_code < 200 or 299 < r.status_code: raise Exception('Failed to create doc: %s'%r.text) return r.json() def update_doc(self, doc_slug: str, order: int, title: str, body: str, category: str): url = "https://dash.readme.com/api/v1/docs/%s" % doc_slug payload = { "hidden": False, "order": order, "title": title, "body": body, "category": category } headers = { "Accept": "application/json", "Content-Type": "application/json", } r = requests.request("PUT", url, json=payload, headers=headers, auth=(self.api_key, '')) if r.status_code < 200 or 299 < r.status_code: raise Exception('Failed to update doc: %s'%r.text) return r.json() def validate_readme_structure(readmeapi : ReadmeApi): categories = readmeapi.get_categories() filtered_categories = list(filter(lambda c: c['title'] == 'Controls',categories)) if len(filtered_categories) != 1: raise Exception('Readme structure validation failure: missing "Controls" category (or more than one)') controls_category = filtered_categories[0] docs_in_control_category = readmeapi.get_docs_in_category(controls_category['slug']) filtered_docs = list(filter(lambda d: d['title'] == 'Controls',docs_in_control_category)) if len(filtered_docs) != 1: raise Exception('Readme structure validation failure: missing "Controls" document') def get_document_for_control(readmeapi : ReadmeApi, control): categories = readmeapi.get_categories() filtered_categories = list(filter(lambda c: c['title'] == 'Controls',categories)) if len(filtered_categories) != 1: raise Exception('Readme structure failure: missing "Controls" category (or more than one)') controls_category = filtered_categories[0] docs_in_control_category = readmeapi.get_docs_in_category(controls_category['slug']) filtered_docs = list(filter(lambda d: d['title'].startswith(control['id']),docs_in_control_category)) if len(filtered_docs) != 1: return None control_doc = filtered_docs[0] return control_doc def get_frameworks_for_control(control): r = [] for frameworks_json_file_name in filter(lambda fn: fn.endswith('.json'),os.listdir('frameworks')): framework = json.load(open(os.path.join('frameworks',frameworks_json_file_name))) if framework['name'].startswith('developer'): continue if control['name'] in framework['controlsNames']: r.append(framework['name']) return r def create_md_for_control(control): related_resources = set() control_config_input = {} host_sensor = False cloud_control = False for rule_obj in control['rules']: if 'match' in rule_obj: for match_obj in rule_obj['match']: if 'resources' in match_obj: related_resources.update(set(match_obj['resources'])) if 'controlConfigInputs' in rule_obj: for control_config in rule_obj['controlConfigInputs']: control_config_input[control_config['path']] = control_config if 'attributes' in rule_obj: if 'hostSensorRule' in rule_obj['attributes']: host_sensor = True if 'relevantCloudProviders' in rule_obj: cloud_control = len(rule_obj['relevantCloudProviders']) > 0 md_text = '' md_text += '# %s\n' % control['name'] if host_sensor: md_text += '*Note: to enable this control run Kubescape with host sensor (see [here](https://hub.armo.cloud/docs/host-sensor))*\n' if cloud_control: md_text += '*Note: this control relevant for cloud managed Kubernetes cluster*\n' md_text += '## Framework\n' md_text += ', '.join(get_frameworks_for_control(control)) + '\n' md_text += '## Severity\n' severity_map = {1:'Low',2:'Low',3:'Low',4:'Low',5:'Medium',6:'Medium',7:'High',8:'High',9:'Critical',10:'Critical'} md_text += '%s\n' % severity_map[int(control['baseScore'])] md_text += '## Description of the the issue\n' description = control['long_description'] if 'long_description' in control else control['description'] if len(control_config_input): description += 'Note, this control is configurable. See below the details.' md_text += description + '\n' md_text += '## Related resources\n' md_text += ', '.join(sorted(list(related_resources))) + '\n' md_text += '## What does this control test\n' test = control['test'] if 'test' in control else control['description'] md_text += test + '\n' md_text += '## Remediation\n' md_text += control['remediation'] + '\n' if len(control_config_input): configuration_text = '## Configuration\nThis control can be configured using the following parameters. Read CLI/UI documentation about how to change parameters.\n' for control_config_name in control_config_input: control_config = control_config_input[control_config_name] configuration_text += '### ' + control_config['name'] + '\n' config_name = control_config['path'].split('.')[-1] configuration_text += '[' + config_name + '](doc:configuration_parameter_%s)'%config_name.lower() + '\n' configuration_text += control_config['description'] + '\n' md_text += configuration_text md_text += '## Example\n' if 'example' in control: md_text += '```\n' +control['example'] + '\n```' + '\n' else: md_text += 'No example\n' return md_text def generate_slug(control): return control['id'].lower() def get_configuration_parameters_info(): default_config_inputs = None with open('default-config-inputs.json','r') as f: default_config_inputs = json.load(f)['settings']['postureControlInputs'] config_parameters = {} for control_json_file_name in filter(lambda fn: fn.endswith('.json'),os.listdir('controls')): try: control_obj = json.load(open(os.path.join('controls',control_json_file_name))) control_obj['rules'] = [] for rule_directory_name in os.listdir('rules'): rule_metadata_file_name = os.path.join('rules',rule_directory_name,'rule.metadata.json') if os.path.isfile(rule_metadata_file_name): rule_obj = json.load(open(rule_metadata_file_name)) if rule_obj['name'] in control_obj['rulesNames']: control_obj['rules'].append(rule_obj) if 'controlConfigInputs' in rule_obj: for config in rule_obj['controlConfigInputs']: name = config['path'].split('.')[-1] config_parameters[name] = config except Exception as e: print('error processing %s: %s'%(control_json_file_name,e)) return config_parameters, default_config_inputs def main(): API_KEY = os.getenv('README_API_KEY') if not API_KEY: raise Exception('README_API_KEY is not defined') # Validate connection readmeapi = ReadmeApi() readmeapi.authenticate(API_KEY) print('Authenticated') # Validated structure validate_readme_structure(readmeapi) print('Readme structure validated') control_category_obj = readmeapi.get_category('controls') parent_control_doc = readmeapi.get_doc('controls') #print("Parent doc\n",parent_control_doc) if os.getenv('PRUNE_CONTROLS'): for control_doc in readmeapi.get_docs_in_category('controls'): if control_doc['_id'] == parent_control_doc['_id']: for child_doc in control_doc['children']: readmeapi.delete_doc(child_doc['slug']) print('Deleted %s'%child_doc['slug']) # Configuration parameter processing config_parameters, default_config_inputs = get_configuration_parameters_info() parent_configuration_parameters_doc = readmeapi.get_doc('configuration-parameters') i = 0 for config_parameters_path in sorted(list(config_parameters.keys())): print('Processing ',config_parameters_path) # Create md md = '# %s\n' % config_parameters_path md += '## Description\n' md += config_parameters[config_parameters_path]['description'] + '\n' md += '## Default values\n' for dvalue in default_config_inputs[config_parameters_path]: md += '* %s\n' % dvalue title = 'Parameter: %s' % config_parameters_path config_parameter_slug = 'configuration_parameter_' + config_parameters_path.lower() config_parameter_doc = readmeapi.get_doc(config_parameter_slug) if config_parameter_doc: readmeapi.update_doc(config_parameter_slug,i,title,md,control_category_obj['_id']) print('\tupdated') else: parent_config_param_doc = readmeapi.get_doc('configuration-parameters') readmeapi.create_doc(config_parameter_slug,parent_config_param_doc['_id'],i,title,md,control_category_obj['_id']) print('\tcreated') i = i + 1 # Start processing for control_json_file_name in filter(lambda fn: fn.endswith('.json'),os.listdir('controls')): #try: if True: print('processing %s' % control_json_file_name) control_obj = json.load(open(os.path.join('controls',control_json_file_name))) base_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) if 'controlID' in control_obj: controlID = control_obj['controlID'] example_file_name = controlID.replace('C-00','c0') + '.yaml' example_file_name = os.path.join('controls','examples',example_file_name) if os.path.isfile(example_file_name): with open(example_file_name) as f: control_obj['example'] = f.read() if 'example' in control_obj and len(control_obj['example']) > 0 and control_obj['example'][0] == '@': example_file_name = os.path.join(base_dir,control_obj['example'][1:]) if os.path.isfile(example_file_name): with open(example_file_name) as f: control_obj['example'] = f.read() else: print('warning: %s is not a file' % example_file_name) control_obj['rules'] = [] for rule_directory_name in os.listdir('rules'): rule_metadata_file_name = os.path.join('rules',rule_directory_name,'rule.metadata.json') if os.path.isfile(rule_metadata_file_name): rule_obj = json.load(open(rule_metadata_file_name)) if rule_obj['name'] in control_obj['rulesNames']: control_obj['rules'].append(rule_obj) md = create_md_for_control(control_obj) title = '%(id)s - %(name)s' % control_obj control_slug = generate_slug(control_obj) control_doc = readmeapi.get_doc(control_slug) if control_doc and len(control_obj['id']) > 2: readmeapi.update_doc(control_slug,int(control_obj['id'][2:]),title,md,control_category_obj['_id']) print('\tupdated') else: readmeapi.create_doc(control_slug,parent_control_doc['_id'],int(control_obj['id'][2:]),title,md,control_category_obj['_id']) print('\tcreated') #except Exception as e: # print('error processing %s: %s'%(control_json_file_name,e)) # Delete children of control doc in co exit(0) if __name__ == '__main__': main()
[ 1, 1053, 7274, 13, 5215, 2897, 13, 5215, 4390, 13, 5215, 337, 13, 13, 1990, 7523, 1004, 11713, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 1514, 29918, 3259, 353, 6213, 13, 13, 1678, 822, 15585, 403, 29898, 1311, 29892, 7882, 29918, 1989, 1125, 13, 4706, 364, 353, 7274, 29889, 657, 877, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 742, 4817, 7607, 2754, 29918, 1989, 29892, 6629, 876, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 2804, 29871, 29906, 29900, 29900, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 15585, 403, 1495, 13, 4706, 4817, 29918, 5327, 353, 364, 29889, 3126, 580, 13, 4706, 1583, 29889, 29926, 14554, 353, 4817, 29918, 5327, 1839, 29926, 14554, 28459, 2033, 13, 4706, 1583, 29889, 3188, 29918, 2271, 353, 4817, 29918, 5327, 1839, 3188, 5983, 2033, 13, 4706, 1583, 29889, 2754, 29918, 1989, 353, 7882, 29918, 1989, 13, 13, 1678, 822, 731, 29918, 3259, 29898, 1311, 29892, 1873, 29901, 710, 1125, 13, 4706, 1583, 29889, 1514, 29918, 3259, 353, 1873, 13, 13, 1678, 822, 679, 29918, 20683, 29898, 1311, 1125, 13, 4706, 3142, 353, 376, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 20683, 29908, 13, 13, 4706, 2346, 1807, 353, 8853, 546, 5074, 4710, 29896, 29900, 29900, 29900, 3284, 3488, 4710, 29896, 9092, 13, 13, 4706, 364, 353, 7274, 29889, 3827, 703, 7194, 613, 3142, 29892, 8636, 29922, 1972, 1807, 29892, 4817, 7607, 1311, 29889, 2754, 29918, 1989, 29892, 6629, 876, 13, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 2804, 29871, 29906, 29900, 29900, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 679, 13997, 1495, 13, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1678, 822, 679, 29918, 7320, 29898, 1311, 29892, 7320, 29918, 29517, 584, 851, 1125, 13, 4706, 3142, 353, 376, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 20683, 22584, 29879, 29908, 1273, 7663, 29918, 29517, 13, 13, 4706, 364, 353, 7274, 29889, 3827, 703, 7194, 613, 3142, 29892, 13662, 3790, 29908, 23965, 1115, 376, 6214, 29914, 3126, 10758, 4817, 7607, 1311, 29889, 2754, 29918, 1989, 29892, 6629, 876, 13, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 2804, 29871, 29906, 29900, 29900, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 679, 13997, 1495, 13, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1678, 822, 679, 29918, 2640, 29918, 262, 29918, 7320, 29898, 1311, 29892, 7663, 29918, 29517, 29901, 851, 1125, 13, 4706, 3142, 353, 376, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 20683, 22584, 29879, 29914, 2640, 29908, 1273, 7663, 29918, 29517, 13, 13, 4706, 364, 353, 7274, 29889, 3827, 703, 7194, 613, 3142, 29892, 9066, 3790, 29908, 23965, 4710, 6214, 29914, 3126, 10758, 4817, 7607, 1311, 29889, 2754, 29918, 1989, 29892, 6629, 876, 13, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 2804, 29871, 29906, 29900, 29900, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 10561, 363, 7663, 1495, 13, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1678, 822, 679, 29918, 1514, 29898, 1311, 29892, 1574, 29918, 29517, 29901, 851, 1125, 13, 4706, 3142, 353, 376, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 2640, 22584, 29879, 29908, 1273, 1574, 29918, 29517, 13, 13, 4706, 364, 353, 7274, 29889, 3827, 703, 7194, 613, 3142, 29892, 9066, 3790, 29908, 23965, 4710, 6214, 29914, 3126, 10758, 4817, 7607, 1311, 29889, 2754, 29918, 1989, 29892, 6629, 876, 13, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 9651, 736, 6213, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 529, 29871, 29906, 29900, 29900, 470, 29871, 29906, 29929, 29929, 529, 364, 29889, 4882, 29918, 401, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 10561, 363, 7663, 1495, 13, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1678, 822, 5217, 29918, 1514, 29898, 1311, 29892, 1574, 29918, 29517, 29901, 851, 1125, 13, 4706, 3142, 353, 376, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 2640, 22584, 29879, 29908, 1273, 1574, 29918, 29517, 13, 13, 4706, 364, 353, 7274, 29889, 3827, 703, 2287, 18476, 613, 3142, 29892, 9066, 3790, 29908, 23965, 4710, 6214, 29914, 3126, 10758, 4817, 7607, 1311, 29889, 2754, 29918, 1989, 29892, 6629, 876, 13, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 529, 29871, 29906, 29900, 29900, 470, 29871, 29906, 29929, 29929, 529, 364, 29889, 4882, 29918, 401, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 5217, 1574, 313, 29995, 29881, 16029, 29995, 29878, 29889, 4882, 29918, 401, 29897, 13, 268, 13, 1678, 822, 1653, 29918, 1514, 29898, 1311, 29892, 2243, 688, 29901, 851, 29892, 3847, 29918, 333, 29901, 851, 29892, 1797, 29901, 938, 29892, 3611, 29901, 851, 29892, 3573, 29901, 851, 29892, 7663, 29901, 851, 1125, 13, 4706, 3142, 353, 376, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 2640, 29908, 13, 13, 4706, 20092, 353, 426, 13, 9651, 376, 10892, 1115, 7700, 29892, 13, 9651, 376, 2098, 1115, 1797, 29892, 13, 9651, 376, 3257, 1115, 3611, 29892, 13, 9651, 376, 1853, 1115, 376, 16121, 613, 13, 9651, 376, 2587, 1115, 3573, 29892, 13, 9651, 376, 7320, 1115, 7663, 29892, 13, 9651, 376, 3560, 14526, 1115, 3847, 29918, 333, 29892, 13, 9651, 376, 29517, 1115, 2243, 688, 13, 4706, 500, 13, 4706, 9066, 353, 426, 13, 9651, 376, 23965, 1115, 376, 6214, 29914, 3126, 613, 13, 9651, 376, 3916, 29899, 1542, 1115, 376, 6214, 29914, 3126, 613, 13, 4706, 500, 13, 13, 4706, 364, 353, 7274, 29889, 3827, 703, 5438, 613, 3142, 29892, 4390, 29922, 23813, 29892, 9066, 29922, 13662, 29892, 4817, 7607, 1311, 29889, 2754, 29918, 1989, 29892, 6629, 876, 13, 13, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 529, 29871, 29906, 29900, 29900, 470, 29871, 29906, 29929, 29929, 529, 364, 29889, 4882, 29918, 401, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 1653, 1574, 29901, 1273, 29879, 29915, 29995, 29878, 29889, 726, 29897, 13, 13, 4706, 736, 364, 29889, 3126, 580, 13, 308, 13, 1678, 822, 2767, 29918, 1514, 29898, 1311, 29892, 1574, 29918, 29517, 29901, 851, 29892, 1797, 29901, 938, 29892, 3611, 29901, 851, 29892, 3573, 29901, 851, 29892, 7663, 29901, 851, 1125, 13, 13, 4706, 3142, 353, 376, 991, 597, 14592, 29889, 949, 1004, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 2640, 22584, 29879, 29908, 1273, 1574, 29918, 29517, 13, 13, 4706, 20092, 353, 426, 13, 9651, 376, 10892, 1115, 7700, 29892, 13, 9651, 376, 2098, 1115, 1797, 29892, 13, 9651, 376, 3257, 1115, 3611, 29892, 13, 9651, 376, 2587, 1115, 3573, 29892, 13, 9651, 376, 7320, 1115, 7663, 13, 4706, 500, 13, 4706, 9066, 353, 426, 13, 9651, 376, 23965, 1115, 376, 6214, 29914, 3126, 613, 13, 9651, 376, 3916, 29899, 1542, 1115, 376, 6214, 29914, 3126, 613, 13, 4706, 500, 13, 13, 4706, 364, 353, 7274, 29889, 3827, 703, 12336, 613, 3142, 29892, 4390, 29922, 23813, 29892, 9066, 29922, 13662, 29892, 4817, 7607, 1311, 29889, 2754, 29918, 1989, 29892, 6629, 876, 13, 13, 4706, 565, 364, 29889, 4882, 29918, 401, 529, 29871, 29906, 29900, 29900, 470, 29871, 29906, 29929, 29929, 529, 364, 29889, 4882, 29918, 401, 29901, 13, 9651, 12020, 8960, 877, 17776, 304, 2767, 1574, 29901, 1273, 29879, 29915, 29995, 29878, 29889, 726, 29897, 13, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1753, 12725, 29918, 949, 1004, 29918, 23905, 29898, 949, 1004, 2754, 584, 7523, 1004, 11713, 1125, 13, 1678, 13997, 353, 1303, 1004, 2754, 29889, 657, 29918, 20683, 580, 13, 1678, 22289, 29918, 20683, 353, 1051, 29898, 4572, 29898, 2892, 274, 29901, 274, 1839, 3257, 2033, 1275, 525, 17825, 742, 20683, 876, 13, 1678, 565, 7431, 29898, 4572, 287, 29918, 20683, 29897, 2804, 29871, 29896, 29901, 13, 4706, 12020, 8960, 877, 6359, 1004, 3829, 8845, 10672, 29901, 4567, 376, 17825, 29908, 7663, 313, 272, 901, 1135, 697, 29897, 1495, 13, 1678, 11761, 29918, 7320, 353, 22289, 29918, 20683, 29961, 29900, 29962, 13, 1678, 10561, 29918, 262, 29918, 6451, 29918, 7320, 353, 1303, 1004, 2754, 29889, 657, 29918, 2640, 29918, 262, 29918, 7320, 29898, 26255, 29918, 7320, 1839, 29517, 11287, 13, 1678, 22289, 29918, 2640, 353, 1051, 29898, 4572, 29898, 2892, 270, 29901, 270, 1839, 3257, 2033, 1275, 525, 17825, 742, 2640, 29918, 262, 29918, 6451, 29918, 7320, 876, 13, 1678, 565, 7431, 29898, 4572, 287, 29918, 2640, 29897, 2804, 29871, 29896, 29901, 13, 4706, 12020, 8960, 877, 6359, 1004, 3829, 8845, 10672, 29901, 4567, 376, 17825, 29908, 1842, 1495, 13, 13, 1753, 679, 29918, 3225, 29918, 1454, 29918, 6451, 29898, 949, 1004, 2754, 584, 7523, 1004, 11713, 29892, 2761, 1125, 13, 1678, 13997, 353, 1303, 1004, 2754, 29889, 657, 29918, 20683, 580, 13, 1678, 22289, 29918, 20683, 353, 1051, 29898, 4572, 29898, 2892, 274, 29901, 274, 1839, 3257, 2033, 1275, 525, 17825, 742, 20683, 876, 13, 1678, 565, 7431, 29898, 4572, 287, 29918, 20683, 29897, 2804, 29871, 29896, 29901, 13, 4706, 12020, 8960, 877, 6359, 1004, 3829, 10672, 29901, 4567, 376, 17825, 29908, 7663, 313, 272, 901, 1135, 697, 29897, 1495, 13, 1678, 11761, 29918, 7320, 353, 22289, 29918, 20683, 29961, 29900, 29962, 13, 1678, 10561, 29918, 262, 29918, 6451, 29918, 7320, 353, 1303, 1004, 2754, 29889, 657, 29918, 2640, 29918, 262, 29918, 7320, 29898, 26255, 29918, 7320, 1839, 29517, 11287, 13, 1678, 22289, 29918, 2640, 353, 1051, 29898, 4572, 29898, 2892, 270, 29901, 270, 1839, 3257, 13359, 27382, 2541, 29898, 6451, 1839, 333, 2033, 511, 2640, 29918, 262, 29918, 6451, 29918, 7320, 876, 13, 1678, 565, 7431, 29898, 4572, 287, 29918, 2640, 29897, 2804, 29871, 29896, 29901, 13, 4706, 736, 6213, 13, 1678, 2761, 29918, 1514, 353, 22289, 29918, 2640, 29961, 29900, 29962, 13, 1678, 736, 2761, 29918, 1514, 13, 13, 13, 13, 1753, 679, 29918, 4468, 29879, 29918, 1454, 29918, 6451, 29898, 6451, 1125, 13, 1678, 364, 353, 5159, 13, 1678, 363, 29143, 29918, 3126, 29918, 1445, 29918, 978, 297, 4175, 29898, 2892, 7876, 29901, 7876, 29889, 1975, 2541, 12839, 3126, 5477, 359, 29889, 1761, 3972, 877, 4468, 29879, 8785, 29901, 13, 4706, 6890, 353, 4390, 29889, 1359, 29898, 3150, 29898, 359, 29889, 2084, 29889, 7122, 877, 4468, 29879, 742, 4468, 29879, 29918, 3126, 29918, 1445, 29918, 978, 4961, 13, 4706, 565, 6890, 1839, 978, 13359, 27382, 2541, 877, 6734, 29374, 13, 9651, 6773, 13, 4706, 565, 2761, 1839, 978, 2033, 297, 6890, 1839, 26255, 8659, 2033, 29901, 13, 9651, 364, 29889, 4397, 29898, 4468, 1839, 978, 11287, 13, 1678, 736, 364, 13, 1678, 13, 13, 1753, 1653, 29918, 3487, 29918, 1454, 29918, 6451, 29898, 6451, 1125, 13, 1678, 4475, 29918, 13237, 353, 731, 580, 13, 1678, 2761, 29918, 2917, 29918, 2080, 353, 6571, 13, 1678, 3495, 29918, 29879, 6073, 353, 7700, 13, 1678, 9570, 29918, 6451, 353, 7700, 13, 1678, 363, 5751, 29918, 5415, 297, 2761, 1839, 19238, 2033, 29901, 13, 4706, 565, 525, 4352, 29915, 297, 5751, 29918, 5415, 29901, 13, 9651, 363, 1993, 29918, 5415, 297, 5751, 29918, 5415, 1839, 4352, 2033, 29901, 13, 18884, 565, 525, 13237, 29915, 297, 1993, 29918, 5415, 29901, 13, 462, 1678, 4475, 29918, 13237, 29889, 5504, 29898, 842, 29898, 4352, 29918, 5415, 1839, 13237, 25901, 13, 4706, 565, 525, 6451, 3991, 4290, 29879, 29915, 297, 5751, 29918, 5415, 29901, 13, 9651, 363, 2761, 29918, 2917, 297, 5751, 29918, 5415, 1839, 6451, 3991, 4290, 29879, 2033, 29901, 13, 18884, 2761, 29918, 2917, 29918, 2080, 29961, 6451, 29918, 2917, 1839, 2084, 2033, 29962, 353, 2761, 29918, 2917, 13, 4706, 565, 525, 15697, 29915, 297, 5751, 29918, 5415, 29901, 13, 9651, 565, 525, 3069, 29903, 6073, 10740, 29915, 297, 5751, 29918, 5415, 1839, 15697, 2033, 29901, 13, 18884, 3495, 29918, 29879, 6073, 353, 5852, 13, 4706, 565, 525, 276, 6591, 20442, 1184, 29454, 29915, 297, 5751, 29918, 5415, 29901, 13, 9651, 9570, 29918, 6451, 353, 7431, 29898, 7491, 29918, 5415, 1839, 276, 6591, 20442, 1184, 29454, 11287, 1405, 29871, 29900, 13, 13, 1678, 22821, 29918, 726, 353, 6629, 13, 1678, 22821, 29918, 726, 4619, 16321, 1273, 29879, 29905, 29876, 29915, 1273, 2761, 1839, 978, 2033, 13, 1678, 565, 3495, 29918, 29879, 6073, 29901, 13, 4706, 22821, 29918, 726, 4619, 525, 29930, 9842, 29901, 304, 9025, 445, 2761, 1065, 29024, 21587, 411, 3495, 23530, 313, 4149, 518, 4150, 850, 991, 597, 29882, 431, 29889, 2817, 29877, 29889, 9274, 29914, 2640, 29914, 3069, 29899, 29879, 6073, 876, 17710, 29876, 29915, 13, 1678, 565, 9570, 29918, 6451, 29901, 13, 4706, 22821, 29918, 726, 4619, 525, 29930, 9842, 29901, 445, 2761, 8018, 363, 9570, 8745, 476, 17547, 9867, 17710, 29876, 29915, 13, 1678, 22821, 29918, 726, 4619, 525, 2277, 16657, 29905, 29876, 29915, 13, 1678, 22821, 29918, 726, 4619, 13420, 15300, 7122, 29898, 657, 29918, 4468, 29879, 29918, 1454, 29918, 6451, 29898, 6451, 876, 718, 11297, 29876, 29915, 13, 1678, 22821, 29918, 726, 4619, 525, 2277, 14621, 537, 29905, 29876, 29915, 13, 1678, 2775, 537, 29918, 1958, 353, 426, 29896, 11283, 29931, 340, 742, 29906, 11283, 29931, 340, 742, 29941, 11283, 29931, 340, 742, 29946, 11283, 29931, 340, 742, 29945, 11283, 19302, 1974, 742, 29953, 11283, 19302, 1974, 742, 29955, 11283, 16382, 742, 29947, 11283, 16382, 742, 29929, 11283, 29907, 768, 936, 742, 29896, 29900, 11283, 29907, 768, 936, 10827, 13, 1678, 22821, 29918, 726, 4619, 14210, 29879, 29905, 29876, 29915, 1273, 2775, 537, 29918, 1958, 29961, 524, 29898, 6451, 1839, 3188, 20097, 2033, 4638, 13, 1678, 22821, 29918, 726, 4619, 525, 2277, 12953, 310, 278, 278, 2228, 29905, 29876, 29915, 13, 1678, 6139, 353, 2761, 1839, 5426, 29918, 8216, 2033, 565, 525, 5426, 29918, 8216, 29915, 297, 2761, 1683, 2761, 1839, 8216, 2033, 13, 1678, 565, 7431, 29898, 6451, 29918, 2917, 29918, 2080, 1125, 13, 4706, 6139, 4619, 525, 9842, 29892, 445, 2761, 338, 17127, 519, 29889, 2823, 2400, 278, 4902, 6169, 13, 1678, 22821, 29918, 726, 4619, 6139, 718, 11297, 29876, 29915, 13, 1678, 22821, 29918, 726, 4619, 525, 2277, 6376, 630, 7788, 29905, 29876, 29915, 13, 13, 1678, 22821, 29918, 726, 4619, 13420, 15300, 7122, 29898, 24582, 29898, 1761, 29898, 12817, 29918, 13237, 4961, 718, 11297, 29876, 29915, 13, 1678, 22821, 29918, 726, 4619, 525, 2277, 1724, 947, 445, 2761, 1243, 29905, 29876, 29915, 13, 1678, 1243, 353, 2761, 1839, 1688, 2033, 565, 525, 1688, 29915, 297, 2761, 1683, 2761, 1839, 8216, 2033, 13, 1678, 22821, 29918, 726, 4619, 1243, 718, 11297, 29876, 29915, 13, 1678, 22821, 29918, 726, 4619, 525, 2277, 5240, 287, 11685, 29905, 29876, 29915, 13, 1678, 22821, 29918, 726, 4619, 2761, 1839, 1745, 287, 11685, 2033, 718, 11297, 29876, 29915, 13, 13, 1678, 565, 7431, 29898, 6451, 29918, 2917, 29918, 2080, 1125, 13, 4706, 5285, 29918, 726, 353, 525, 2277, 20999, 29905, 29876, 4013, 2761, 508, 367, 13252, 773, 278, 1494, 4128, 29889, 7523, 24492, 29914, 3120, 5106, 1048, 920, 304, 1735, 4128, 7790, 29876, 29915, 13, 4706, 363, 2761, 29918, 2917, 29918, 978, 297, 2761, 29918, 2917, 29918, 2080, 29901, 13, 9651, 2761, 29918, 2917, 353, 2761, 29918, 2917, 29918, 2080, 29961, 6451, 29918, 2917, 29918, 978, 29962, 13, 9651, 5285, 29918, 726, 4619, 525, 2277, 29937, 525, 718, 2761, 29918, 2917, 1839, 978, 2033, 718, 11297, 29876, 29915, 13, 9651, 2295, 29918, 978, 353, 2761, 29918, 2917, 1839, 2084, 13359, 5451, 12839, 1495, 14352, 29896, 29962, 13, 9651, 5285, 29918, 726, 4619, 525, 1839, 718, 2295, 29918, 978, 718, 525, 850, 1514, 29901, 13305, 29918, 15501, 29918, 29995, 29879, 16029, 29995, 2917, 29918, 978, 29889, 13609, 580, 718, 11297, 29876, 29915, 13, 9651, 5285, 29918, 726, 4619, 2761, 29918, 2917, 1839, 8216, 2033, 718, 11297, 29876, 29915, 13, 4706, 22821, 29918, 726, 4619, 5285, 29918, 726, 13, 13, 1678, 22821, 29918, 726, 4619, 525, 2277, 8741, 29905, 29876, 29915, 13, 1678, 565, 525, 4773, 29915, 297, 2761, 29901, 13, 4706, 22821, 29918, 726, 4619, 525, 28956, 29905, 29876, 29915, 718, 6451, 1839, 4773, 2033, 718, 11297, 29876, 16159, 20497, 718, 11297, 29876, 29915, 13, 1678, 1683, 29901, 13, 4706, 22821, 29918, 726, 4619, 525, 3782, 1342, 29905, 29876, 29915, 13, 1678, 736, 22821, 29918, 726, 13, 13, 1753, 5706, 29918, 29517, 29898, 6451, 1125, 13, 1678, 736, 2761, 1839, 333, 13359, 13609, 580, 13, 13, 1753, 679, 29918, 13305, 29918, 16744, 29918, 3888, 7295, 13, 1678, 2322, 29918, 2917, 29918, 2080, 29879, 353, 6213, 13, 1678, 411, 1722, 877, 4381, 29899, 2917, 29899, 2080, 29879, 29889, 3126, 3788, 29878, 1495, 408, 285, 29901, 13, 4706, 2322, 29918, 2917, 29918, 2080, 29879, 353, 4390, 29889, 1359, 29898, 29888, 29897, 1839, 11027, 16215, 2490, 545, 4809, 4290, 29879, 2033, 13, 13, 1678, 2295, 29918, 16744, 353, 6571, 13, 1678, 363, 2761, 29918, 3126, 29918, 1445, 29918, 978, 297, 4175, 29898, 2892, 7876, 29901, 7876, 29889, 1975, 2541, 12839, 3126, 5477, 359, 29889, 1761, 3972, 877, 26255, 8785, 29901, 13, 4706, 1018, 29901, 13, 9651, 2761, 29918, 5415, 353, 4390, 29889, 1359, 29898, 3150, 29898, 359, 29889, 2084, 29889, 7122, 877, 26255, 742, 6451, 29918, 3126, 29918, 1445, 29918, 978, 4961, 13, 9651, 2761, 29918, 5415, 1839, 19238, 2033, 353, 5159, 13, 9651, 363, 5751, 29918, 12322, 29918, 978, 297, 2897, 29889, 1761, 3972, 877, 19238, 29374, 13, 18884, 5751, 29918, 19635, 29918, 1445, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 877, 19238, 742, 7491, 29918, 12322, 29918, 978, 5501, 7491, 29889, 19635, 29889, 3126, 1495, 13, 18884, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 7491, 29918, 19635, 29918, 1445, 29918, 978, 1125, 13, 462, 1678, 5751, 29918, 5415, 353, 4390, 29889, 1359, 29898, 3150, 29898, 7491, 29918, 19635, 29918, 1445, 29918, 978, 876, 13, 462, 1678, 565, 5751, 29918, 5415, 1839, 978, 2033, 297, 2761, 29918, 5415, 1839, 19238, 8659, 2033, 29901, 13, 462, 4706, 2761, 29918, 5415, 1839, 19238, 13359, 4397, 29898, 7491, 29918, 5415, 29897, 259, 13, 462, 4706, 565, 525, 6451, 3991, 4290, 29879, 29915, 297, 5751, 29918, 5415, 29901, 13, 462, 9651, 363, 2295, 297, 5751, 29918, 5415, 1839, 6451, 3991, 4290, 29879, 2033, 29901, 13, 462, 18884, 1024, 353, 2295, 1839, 2084, 13359, 5451, 12839, 1495, 14352, 29896, 29962, 13, 462, 18884, 2295, 29918, 16744, 29961, 978, 29962, 353, 2295, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 877, 2704, 9068, 1273, 29879, 29901, 1273, 29879, 29915, 29995, 29898, 6451, 29918, 3126, 29918, 1445, 29918, 978, 29892, 29872, 876, 13, 308, 13, 1678, 736, 2295, 29918, 16744, 29892, 2322, 29918, 2917, 29918, 2080, 29879, 13, 13, 1753, 1667, 7295, 13, 1678, 3450, 29918, 10818, 353, 2897, 29889, 657, 6272, 877, 16310, 2303, 29918, 8787, 29918, 10818, 1495, 13, 1678, 565, 451, 3450, 29918, 10818, 29901, 13, 4706, 12020, 8960, 877, 16310, 2303, 29918, 8787, 29918, 10818, 338, 451, 3342, 1495, 13, 268, 13, 1678, 396, 15758, 403, 3957, 13, 1678, 1303, 1004, 2754, 353, 7523, 1004, 11713, 580, 13, 1678, 1303, 1004, 2754, 29889, 27218, 403, 29898, 8787, 29918, 10818, 29897, 13, 1678, 1596, 877, 6444, 4173, 630, 1495, 13, 13, 1678, 396, 15758, 630, 3829, 13, 1678, 12725, 29918, 949, 1004, 29918, 23905, 29898, 949, 1004, 2754, 29897, 13, 1678, 1596, 877, 6359, 1004, 3829, 2854, 630, 1495, 13, 13, 1678, 2761, 29918, 7320, 29918, 5415, 353, 1303, 1004, 2754, 29889, 657, 29918, 7320, 877, 26255, 1495, 13, 1678, 3847, 29918, 6451, 29918, 1514, 353, 1303, 1004, 2754, 29889, 657, 29918, 1514, 877, 26255, 1495, 13, 1678, 396, 2158, 703, 9780, 1574, 29905, 29876, 613, 3560, 29918, 6451, 29918, 1514, 29897, 13, 1678, 565, 2897, 29889, 657, 6272, 877, 10593, 3904, 29923, 29918, 22412, 1672, 8547, 29374, 13, 4706, 363, 2761, 29918, 1514, 297, 1303, 1004, 2754, 29889, 657, 29918, 2640, 29918, 262, 29918, 7320, 877, 26255, 29374, 13, 9651, 565, 2761, 29918, 1514, 1839, 29918, 333, 2033, 1275, 3847, 29918, 6451, 29918, 1514, 1839, 29918, 333, 2033, 29901, 13, 18884, 363, 2278, 29918, 1514, 297, 2761, 29918, 1514, 1839, 11991, 2033, 29901, 13, 462, 1678, 1303, 1004, 2754, 29889, 8143, 29918, 1514, 29898, 5145, 29918, 1514, 1839, 29517, 11287, 13, 462, 1678, 1596, 877, 2772, 22742, 1273, 29879, 29915, 29995, 5145, 29918, 1514, 1839, 29517, 11287, 13, 13, 1678, 396, 20999, 3443, 9068, 13, 1678, 2295, 29918, 16744, 29892, 2322, 29918, 2917, 29918, 2080, 29879, 353, 679, 29918, 13305, 29918, 16744, 29918, 3888, 580, 13, 1678, 3847, 29918, 13305, 29918, 16744, 29918, 1514, 353, 1303, 1004, 2754, 29889, 657, 29918, 1514, 877, 13305, 29899, 16744, 1495, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 363, 2295, 29918, 16744, 29918, 2084, 297, 12705, 29898, 1761, 29898, 2917, 29918, 16744, 29889, 8149, 22130, 29901, 13, 4706, 1596, 877, 7032, 292, 13420, 2917, 29918, 16744, 29918, 2084, 29897, 13, 4706, 396, 6204, 22821, 13, 4706, 22821, 353, 16321, 1273, 29879, 29905, 29876, 29915, 1273, 2295, 29918, 16744, 29918, 2084, 13, 4706, 22821, 4619, 525, 2277, 12953, 29905, 29876, 29915, 13, 4706, 22821, 4619, 2295, 29918, 16744, 29961, 2917, 29918, 16744, 29918, 2084, 22322, 8216, 2033, 718, 11297, 29876, 29915, 13, 4706, 22821, 4619, 525, 2277, 13109, 1819, 29905, 29876, 29915, 13, 4706, 363, 270, 1767, 297, 2322, 29918, 2917, 29918, 2080, 29879, 29961, 2917, 29918, 16744, 29918, 2084, 5387, 13, 9651, 22821, 4619, 525, 29930, 1273, 29879, 29905, 29876, 29915, 1273, 270, 1767, 13, 13, 4706, 3611, 353, 525, 9329, 29901, 1273, 29879, 29915, 1273, 2295, 29918, 16744, 29918, 2084, 13, 4706, 2295, 29918, 15501, 29918, 29517, 353, 525, 13305, 29918, 15501, 29918, 29915, 718, 2295, 29918, 16744, 29918, 2084, 29889, 13609, 580, 13, 4706, 2295, 29918, 15501, 29918, 1514, 353, 1303, 1004, 2754, 29889, 657, 29918, 1514, 29898, 2917, 29918, 15501, 29918, 29517, 29897, 13, 13, 4706, 565, 2295, 29918, 15501, 29918, 1514, 29901, 13, 9651, 1303, 1004, 2754, 29889, 5504, 29918, 1514, 29898, 2917, 29918, 15501, 29918, 29517, 29892, 29875, 29892, 3257, 29892, 3487, 29892, 6451, 29918, 7320, 29918, 5415, 1839, 29918, 333, 11287, 13, 9651, 1596, 28909, 29873, 21402, 1495, 13, 4706, 1683, 29901, 13, 9651, 3847, 29918, 2917, 29918, 3207, 29918, 1514, 353, 1303, 1004, 2754, 29889, 657, 29918, 1514, 877, 13305, 29899, 16744, 1495, 13, 9651, 1303, 1004, 2754, 29889, 3258, 29918, 1514, 29898, 2917, 29918, 15501, 29918, 29517, 29892, 3560, 29918, 2917, 29918, 3207, 29918, 1514, 1839, 29918, 333, 7464, 29875, 29892, 3257, 29892, 3487, 29892, 6451, 29918, 7320, 29918, 5415, 1839, 29918, 333, 11287, 13, 9651, 1596, 28909, 29873, 11600, 1495, 13, 4706, 474, 353, 474, 718, 29871, 29896, 13, 268, 13, 1678, 396, 7370, 9068, 13, 1678, 363, 2761, 29918, 3126, 29918, 1445, 29918, 978, 297, 4175, 29898, 2892, 7876, 29901, 7876, 29889, 1975, 2541, 12839, 3126, 5477, 359, 29889, 1761, 3972, 877, 26255, 8785, 29901, 13, 4706, 396, 2202, 29901, 13, 4706, 565, 5852, 29901, 13, 9651, 1596, 877, 19170, 1273, 29879, 29915, 1273, 2761, 29918, 3126, 29918, 1445, 29918, 978, 29897, 13, 9651, 2761, 29918, 5415, 353, 4390, 29889, 1359, 29898, 3150, 29898, 359, 29889, 2084, 29889, 7122, 877, 26255, 742, 6451, 29918, 3126, 29918, 1445, 29918, 978, 4961, 13, 13, 9651, 2967, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 4961, 13, 9651, 565, 525, 6451, 1367, 29915, 297, 2761, 29918, 5415, 29901, 13, 18884, 2761, 1367, 353, 2761, 29918, 5415, 1839, 6451, 1367, 2033, 13, 18884, 1342, 29918, 1445, 29918, 978, 353, 2761, 1367, 29889, 6506, 877, 29907, 29899, 29900, 29900, 3788, 29883, 29900, 1495, 718, 15300, 25162, 29915, 13, 18884, 1342, 29918, 1445, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 877, 26255, 3788, 19057, 742, 4773, 29918, 1445, 29918, 978, 29897, 13, 18884, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 4773, 29918, 1445, 29918, 978, 1125, 13, 462, 1678, 411, 1722, 29898, 4773, 29918, 1445, 29918, 978, 29897, 408, 285, 29901, 13, 462, 4706, 2761, 29918, 5415, 1839, 4773, 2033, 353, 285, 29889, 949, 580, 13, 462, 1678, 13, 9651, 565, 525, 4773, 29915, 297, 2761, 29918, 5415, 322, 7431, 29898, 6451, 29918, 5415, 1839, 4773, 11287, 1405, 29871, 29900, 322, 2761, 29918, 5415, 1839, 4773, 2033, 29961, 29900, 29962, 1275, 18803, 2396, 13, 18884, 1342, 29918, 1445, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 3972, 29892, 6451, 29918, 5415, 1839, 4773, 2033, 29961, 29896, 29901, 2314, 13, 18884, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 4773, 29918, 1445, 29918, 978, 1125, 13, 462, 1678, 411, 1722, 29898, 4773, 29918, 1445, 29918, 978, 29897, 408, 285, 29901, 13, 462, 4706, 2761, 29918, 5415, 1839, 4773, 2033, 353, 285, 29889, 949, 580, 13, 18884, 1683, 29901, 13, 462, 1678, 1596, 877, 27392, 29901, 1273, 29879, 338, 451, 263, 934, 29915, 1273, 1342, 29918, 1445, 29918, 978, 29897, 13, 632, 13, 9651, 2761, 29918, 5415, 1839, 19238, 2033, 353, 5159, 13, 9651, 363, 5751, 29918, 12322, 29918, 978, 297, 2897, 29889, 1761, 3972, 877, 19238, 29374, 13, 18884, 5751, 29918, 19635, 29918, 1445, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 877, 19238, 742, 7491, 29918, 12322, 29918, 978, 5501, 7491, 29889, 19635, 29889, 3126, 1495, 13, 18884, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 7491, 29918, 19635, 29918, 1445, 29918, 978, 1125, 13, 462, 1678, 5751, 29918, 5415, 353, 4390, 29889, 1359, 29898, 3150, 29898, 7491, 29918, 19635, 29918, 1445, 29918, 978, 876, 13, 462, 1678, 565, 5751, 29918, 5415, 1839, 978, 2033, 297, 2761, 29918, 5415, 1839, 19238, 8659, 2033, 29901, 13, 462, 4706, 2761, 29918, 5415, 1839, 19238, 13359, 4397, 29898, 7491, 29918, 5415, 29897, 13, 13, 9651, 22821, 353, 1653, 29918, 3487, 29918, 1454, 29918, 6451, 29898, 6451, 29918, 5415, 29897, 13, 632, 13, 9651, 3611, 353, 14210, 29898, 333, 29897, 29879, 448, 1273, 29898, 978, 29897, 29879, 29915, 1273, 2761, 29918, 5415, 13, 13, 9651, 2761, 29918, 29517, 353, 5706, 29918, 29517, 29898, 6451, 29918, 5415, 29897, 13, 632, 13, 9651, 2761, 29918, 1514, 353, 1303, 1004, 2754, 29889, 657, 29918, 1514, 29898, 6451, 29918, 29517, 29897, 13, 13, 9651, 565, 2761, 29918, 1514, 322, 7431, 29898, 6451, 29918, 5415, 1839, 333, 11287, 1405, 29871, 29906, 29901, 13, 18884, 1303, 1004, 2754, 29889, 5504, 29918, 1514, 29898, 6451, 29918, 29517, 29892, 524, 29898, 6451, 29918, 5415, 1839, 333, 2033, 29961, 29906, 29901, 11724, 3257, 29892, 3487, 29892, 6451, 29918, 7320, 29918, 5415, 1839, 29918, 333, 11287, 13, 18884, 1596, 28909, 29873, 21402, 1495, 13, 9651, 1683, 29901, 13, 18884, 1303, 1004, 2754, 29889, 3258, 29918, 1514, 29898, 6451, 29918, 29517, 29892, 3560, 29918, 6451, 29918, 1514, 1839, 29918, 333, 7464, 524, 29898, 6451, 29918, 5415, 1839, 333, 2033, 29961, 29906, 29901, 11724, 3257, 29892, 3487, 29892, 6451, 29918, 7320, 29918, 5415, 1839, 29918, 333, 11287, 13, 18884, 1596, 28909, 29873, 11600, 1495, 13, 13, 4706, 396, 19499, 8960, 408, 321, 29901, 13, 4706, 396, 1678, 1596, 877, 2704, 9068, 1273, 29879, 29901, 1273, 29879, 29915, 29995, 29898, 6451, 29918, 3126, 29918, 1445, 29918, 978, 29892, 29872, 876, 13, 13, 1678, 396, 21267, 4344, 310, 2761, 1574, 297, 1302, 13, 1678, 6876, 29898, 29900, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 13, 2 ]
rnaseq/src/bam2coverage.py
cjops/gtex-pipeline
3
137918
<filename>rnaseq/src/bam2coverage.py #!/usr/bin/env python3 # Author: <NAME> import argparse import subprocess import os from datetime import datetime import gzip import pyBigWig parser = argparse.ArgumentParser(description='Computes coverage in bigWig and/or bedGraph format from input BAM.') parser.add_argument('bam_file', help='Input BAM file') parser.add_argument('chr_sizes', help='Chromosome sizes for the reference genome used') parser.add_argument('prefix', help='Prefix for output file names') parser.add_argument('--intersect', default=None, type=str, help='BED file containing intervals to calculate coverage on') parser.add_argument('-f', '--format', default=['bigwig'], type=str.lower, nargs='+', choices=['bigwig', 'bedgraph']) parser.add_argument('--sam_flags', default='-F 768', help='Flags for samtools. Default: filter out secondary and QC-failed reads') parser.add_argument('-o', '--output', default='.', help='Output directory') args = parser.parse_args() print('['+datetime.now().strftime("%b %d %H:%M:%S")+'] Starting coverage computation', flush=True) print(' * generating bedGraph from BAM', flush=True) # bedGraph file must be sorted for compatibility with bedGraphToBigWig bgpath = os.path.join(args.output, args.prefix + '.bedGraph') # exclude reads that are: not primary alignment; failed platform/vendor quality checks (flags 8 & 9) cmd = 'samtools view '+args.sam_flags+' -b '+args.bam_file+' | bedtools genomecov -bga -split -ibam - | sort -k1,1 -k2,2n > '+bgpath subprocess.call(cmd, shell=True, executable='/bin/bash') if 'bigwig' in args.format: print(' * generating bigWig from bedGraph', flush=True) bwpath = os.path.join(args.output, args.prefix + '.bigWig') cmd = 'bedGraphToBigWig '+bgpath+' '+args.chr_sizes+' '+bwpath subprocess.call(cmd, shell=True, executable='/bin/bash') if args.intersect is not None: print(' * calculating coverage on BED intervals', flush=True) bw = pyBigWig.open(bwpath) with gzip.open(bwpath.replace('.bigWig', '.coverage.gz'), 'wt') as f, gzip.open(args.intersect) as bed: f.write('\t'.join(['gene_id', 'chr', 'start', 'end', 'coverage'])+'\n') for line in bed: line = line.decode().strip().split() c = bw.values(line[0], int(line[1]), int(line[2]), numpy=True) f.write('\t'.join([line[3], line[0], line[1], line[2], ','.join(c.astype(int).astype(str))])+'\n') bw.close() if 'bedgraph' not in args.format: os.remove(bgpath) print('['+datetime.now().strftime("%b %d %H:%M:%S")+'] Done', flush=True)
[ 1, 529, 9507, 29958, 27539, 559, 29939, 29914, 4351, 29914, 29890, 314, 29906, 11911, 482, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 13361, 29901, 529, 5813, 29958, 13, 13, 5215, 1852, 5510, 13, 5215, 1014, 5014, 13, 5215, 2897, 13, 3166, 12865, 1053, 12865, 13, 5215, 330, 7554, 13, 5215, 11451, 6970, 29956, 335, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 20606, 267, 23746, 297, 4802, 29956, 335, 322, 29914, 272, 6592, 9527, 3402, 515, 1881, 350, 5194, 29889, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 29890, 314, 29918, 1445, 742, 1371, 2433, 4290, 350, 5194, 934, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 22495, 29918, 29879, 7093, 742, 1371, 2433, 1451, 456, 359, 608, 15786, 363, 278, 3407, 2531, 608, 1304, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 13506, 742, 1371, 2433, 23095, 363, 1962, 934, 2983, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1639, 8803, 742, 2322, 29922, 8516, 29892, 1134, 29922, 710, 29892, 1371, 2433, 29933, 3352, 934, 6943, 18747, 304, 8147, 23746, 373, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29888, 742, 525, 489, 4830, 742, 2322, 29922, 1839, 3752, 9192, 7464, 1134, 29922, 710, 29889, 13609, 29892, 302, 5085, 2433, 29974, 742, 19995, 29922, 1839, 3752, 9192, 742, 525, 2580, 4262, 11287, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 13445, 29918, 15764, 742, 2322, 2433, 29899, 29943, 29871, 29955, 29953, 29947, 742, 1371, 2433, 15675, 363, 3514, 8504, 29889, 13109, 29901, 4175, 714, 16723, 322, 660, 29907, 29899, 26061, 13623, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29877, 742, 525, 489, 4905, 742, 2322, 2433, 29889, 742, 1371, 2433, 6466, 3884, 1495, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 13, 2158, 877, 1839, 29974, 12673, 29889, 3707, 2141, 710, 615, 603, 11702, 29890, 1273, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 1159, 29974, 2033, 23748, 23746, 16287, 742, 28371, 29922, 5574, 29897, 13, 13, 2158, 877, 29871, 334, 14655, 6592, 9527, 515, 350, 5194, 742, 28371, 29922, 5574, 29897, 13, 29937, 6592, 9527, 934, 1818, 367, 12705, 363, 24521, 411, 6592, 9527, 1762, 6970, 29956, 335, 13, 16264, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 4905, 29892, 6389, 29889, 13506, 718, 15300, 2580, 9527, 1495, 13, 29937, 19060, 13623, 393, 526, 29901, 451, 7601, 22239, 29936, 5229, 7481, 29914, 19167, 11029, 12747, 313, 15764, 29871, 29947, 669, 29871, 29929, 29897, 13, 9006, 353, 525, 13445, 8504, 1776, 525, 29974, 5085, 29889, 13445, 29918, 15764, 23097, 448, 29890, 525, 29974, 5085, 29889, 29890, 314, 29918, 1445, 23097, 891, 6592, 8504, 2531, 608, 24542, 448, 29890, 3249, 448, 5451, 448, 747, 314, 448, 891, 2656, 448, 29895, 29896, 29892, 29896, 448, 29895, 29906, 29892, 29906, 29876, 1405, 525, 29974, 16264, 2084, 13, 1491, 5014, 29889, 4804, 29898, 9006, 29892, 6473, 29922, 5574, 29892, 16813, 2433, 29914, 2109, 29914, 13067, 1495, 13, 13, 361, 525, 3752, 9192, 29915, 297, 6389, 29889, 4830, 29901, 13, 1678, 1596, 877, 29871, 334, 14655, 4802, 29956, 335, 515, 6592, 9527, 742, 28371, 29922, 5574, 29897, 13, 1678, 289, 29893, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 4905, 29892, 6389, 29889, 13506, 718, 15300, 3752, 29956, 335, 1495, 13, 1678, 9920, 353, 525, 2580, 9527, 1762, 6970, 29956, 335, 525, 29974, 16264, 2084, 23097, 525, 29974, 5085, 29889, 22495, 29918, 29879, 7093, 23097, 525, 29974, 29890, 29893, 2084, 13, 1678, 1014, 5014, 29889, 4804, 29898, 9006, 29892, 6473, 29922, 5574, 29892, 16813, 2433, 29914, 2109, 29914, 13067, 1495, 13, 13, 1678, 565, 6389, 29889, 1639, 8803, 338, 451, 6213, 29901, 13, 4706, 1596, 877, 29871, 334, 25202, 23746, 373, 350, 3352, 18747, 742, 28371, 29922, 5574, 29897, 13, 4706, 289, 29893, 353, 11451, 6970, 29956, 335, 29889, 3150, 29898, 29890, 29893, 2084, 29897, 13, 4706, 411, 330, 7554, 29889, 3150, 29898, 29890, 29893, 2084, 29889, 6506, 12839, 3752, 29956, 335, 742, 15300, 11911, 482, 29889, 18828, 5477, 525, 14554, 1495, 408, 285, 29892, 330, 7554, 29889, 3150, 29898, 5085, 29889, 1639, 8803, 29897, 408, 6592, 29901, 13, 9651, 285, 29889, 3539, 28909, 29873, 4286, 7122, 18959, 29887, 1600, 29918, 333, 742, 525, 22495, 742, 525, 2962, 742, 525, 355, 742, 525, 11911, 482, 2033, 7240, 12764, 29876, 1495, 13, 9651, 363, 1196, 297, 6592, 29901, 13, 18884, 1196, 353, 1196, 29889, 13808, 2141, 17010, 2141, 5451, 580, 13, 18884, 274, 353, 289, 29893, 29889, 5975, 29898, 1220, 29961, 29900, 1402, 938, 29898, 1220, 29961, 29896, 11724, 938, 29898, 1220, 29961, 29906, 11724, 12655, 29922, 5574, 29897, 13, 18884, 285, 29889, 3539, 28909, 29873, 4286, 7122, 4197, 1220, 29961, 29941, 1402, 1196, 29961, 29900, 1402, 1196, 29961, 29896, 1402, 1196, 29961, 29906, 1402, 13420, 4286, 7122, 29898, 29883, 29889, 579, 668, 29898, 524, 467, 579, 668, 29898, 710, 876, 2314, 29974, 12764, 29876, 1495, 13, 4706, 289, 29893, 29889, 5358, 580, 13, 13, 361, 525, 2580, 4262, 29915, 451, 297, 6389, 29889, 4830, 29901, 13, 1678, 2897, 29889, 5992, 29898, 16264, 2084, 29897, 13, 13, 2158, 877, 1839, 29974, 12673, 29889, 3707, 2141, 710, 615, 603, 11702, 29890, 1273, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 1159, 29974, 2033, 25679, 742, 28371, 29922, 5574, 29897, 13, 2 ]
examples/get_started_example.py
th2-net/th2-data-services
3
108771
from collections import Generator from th2_data_services import DataSource, Data, Filter from datetime import datetime # [1] Create DataSource object to connect to rpt-data-provider. DEMO_HOST = "10.64.66.66" # th2-kube-demo Host port where rpt-data-provider is located. DEMO_PORT = "30999" # Node port of rpt-data-provider. data_source = DataSource(f"http://{DEMO_HOST}:{DEMO_PORT}") START_TIME = datetime( year=2021, month=6, day=17, hour=9, minute=44, second=41, microsecond=692724 ) # object given in utc format END_TIME = datetime(year=2021, month=6, day=17, hour=12, minute=45, second=49, microsecond=28579) # [2] Get events or messages from START_TIME to END_TIME. # [2.1] Get events. events: Data = data_source.get_events_from_data_provider( startTimestamp=START_TIME, endTimestamp=END_TIME, attachedMessages=True, # Use Filter class to apply rpt-data-provider filters. filters=[ # Use the list to set multiple filters. Filter("name", "ExecutionReport"), Filter("type", "Send message"), ], ) # [2.2] Get messages. messages: Data = data_source.get_messages_from_data_provider( startTimestamp=START_TIME, endTimestamp=END_TIME, attachedMessages=True, stream=["demo-conn2"], filters=Filter("body", "195"), ) # [3] Work with your Data object. # [3.1] Filter. filtered_events: Data = events.filter(lambda e: e["body"] != []) # Filter events with empty body. # [3.2] Map. def transform_function(record): return {"eventName": record["eventName"], "successful": record["successful"]} filtered_and_mapped_events = filtered_events.map(transform_function) # [3.3] Data pipeline. # Instead of doing data transformations step by step you can do it in one line. filtered_and_mapped_events_by_pipeline = events.filter(lambda e: e["body"] != []).map(transform_function) # Content of these two Data objects should be equal. assert list(filtered_and_mapped_events) == list(filtered_and_mapped_events_by_pipeline) # [3.4] Sift. Skip the first few items or limit them. events_from_11_to_end: Generator = events.sift(skip=10) only_first_10_events: Generator = events.sift(limit=10) # [3.5] Changing cache status. events.use_cache(True) # [3.6] Walk through data. for event in events: # Do something with event (event is a dict). print(event) # After first iteration the events has a cache file. # Now they will be used the cache in following iteration. # [3.7] Get number of the elements in the Data object. number_of_events = events.len # [3.8] Check that Data object isn't empty. # The data source should be not empty. assert events.is_empty is False # [3.9] Convert Data object to the list of elements(events or messages). # Be careful, this can take too much memory. events_list = list(events) # [3.10] Get event/message by id. desired_event = "9ce8a2ff-d600-4366-9aba-2082cfc69901:ef1d722e-cf5e-11eb-bcd0-ced60009573f" desired_events = [ "deea079b-4235-4421-abf6-6a3ac1d04c76:ef1d3a20-cf5e-11eb-bcd0-ced60009573f", "a34e3cb4-c635-4a90-8f42-37dd984209cb:ef1c5cea-cf5e-11eb-bcd0-ced60009573f", ] desired_message = "demo-conn1:first:1619506157132265837" desired_messages = [ "demo-conn1:first:1619506157132265836", "demo-conn1:first:1619506157132265833", ] data_source.find_events_by_id_from_data_provider(desired_event) # Returns 1 event (dict). data_source.find_events_by_id_from_data_provider(desired_events) # Returns 2 events list(dict). data_source.find_messages_by_id_from_data_provider(desired_message) # Returns 1 message (dict). data_source.find_messages_by_id_from_data_provider(desired_messages) # Returns 2 messages list(dict). # [3.11] The cache inheritance. # Creates a new Data object that will use cache from the events Data object. events_with_batch = events.filter(lambda record: record.get("batchId")) # New Data objects don't use their own cache by default but use the cache of the parent Data object. # Use use_cache method to activate caching. After that, the Data object will create its own cache file. events_with_batch.use_cache(True) list(events_with_batch) events_types_with_batch = events_with_batch.map(lambda record: {"eventType": record.get("eventType")}) events_without_types_with_batch = events_types_with_batch.filter(lambda record: not record.get("eventType")) events_without_types_with_batch.use_cache(True)
[ 1, 515, 16250, 1053, 3251, 1061, 13, 3166, 266, 29906, 29918, 1272, 29918, 9916, 1053, 3630, 4435, 29892, 3630, 29892, 19916, 13, 3166, 12865, 1053, 12865, 13, 13, 13, 29937, 518, 29896, 29962, 6204, 3630, 4435, 1203, 304, 4511, 304, 364, 415, 29899, 1272, 29899, 18121, 29889, 13, 2287, 6720, 29918, 20832, 353, 376, 29896, 29900, 29889, 29953, 29946, 29889, 29953, 29953, 29889, 29953, 29953, 29908, 29871, 396, 266, 29906, 29899, 29895, 4003, 29899, 17482, 29871, 16956, 2011, 988, 364, 415, 29899, 1272, 29899, 18121, 338, 5982, 29889, 13, 2287, 6720, 29918, 15082, 353, 376, 29941, 29900, 29929, 29929, 29929, 29908, 29871, 396, 9071, 2011, 310, 364, 415, 29899, 1272, 29899, 18121, 29889, 13, 1272, 29918, 4993, 353, 3630, 4435, 29898, 29888, 29908, 1124, 597, 29912, 2287, 6720, 29918, 20832, 6177, 29912, 2287, 6720, 29918, 15082, 27195, 13, 13, 25826, 29918, 15307, 353, 12865, 29898, 13, 1678, 1629, 29922, 29906, 29900, 29906, 29896, 29892, 4098, 29922, 29953, 29892, 2462, 29922, 29896, 29955, 29892, 7234, 29922, 29929, 29892, 11015, 29922, 29946, 29946, 29892, 1473, 29922, 29946, 29896, 29892, 9200, 7496, 29922, 29953, 29929, 29906, 29955, 29906, 29946, 13, 29897, 29871, 396, 1203, 2183, 297, 3477, 29883, 3402, 13, 11794, 29918, 15307, 353, 12865, 29898, 6360, 29922, 29906, 29900, 29906, 29896, 29892, 4098, 29922, 29953, 29892, 2462, 29922, 29896, 29955, 29892, 7234, 29922, 29896, 29906, 29892, 11015, 29922, 29946, 29945, 29892, 1473, 29922, 29946, 29929, 29892, 9200, 7496, 29922, 29906, 29947, 29945, 29955, 29929, 29897, 13, 13, 29937, 518, 29906, 29962, 3617, 4959, 470, 7191, 515, 6850, 8322, 29918, 15307, 304, 11056, 29918, 15307, 29889, 13, 29937, 518, 29906, 29889, 29896, 29962, 3617, 4959, 29889, 13, 13604, 29901, 3630, 353, 848, 29918, 4993, 29889, 657, 29918, 13604, 29918, 3166, 29918, 1272, 29918, 18121, 29898, 13, 1678, 1369, 27939, 29922, 25826, 29918, 15307, 29892, 13, 1678, 1095, 27939, 29922, 11794, 29918, 15307, 29892, 13, 1678, 10959, 25510, 29922, 5574, 29892, 13, 1678, 396, 4803, 19916, 770, 304, 3394, 364, 415, 29899, 1272, 29899, 18121, 18094, 29889, 13, 1678, 18094, 11759, 29871, 396, 4803, 278, 1051, 304, 731, 2999, 18094, 29889, 13, 4706, 19916, 703, 978, 613, 376, 20418, 13020, 4968, 13, 4706, 19916, 703, 1853, 613, 376, 12600, 2643, 4968, 13, 1678, 21251, 13, 29897, 13, 13, 29937, 518, 29906, 29889, 29906, 29962, 3617, 7191, 29889, 13, 19158, 29901, 3630, 353, 848, 29918, 4993, 29889, 657, 29918, 19158, 29918, 3166, 29918, 1272, 29918, 18121, 29898, 13, 1678, 1369, 27939, 29922, 25826, 29918, 15307, 29892, 13, 1678, 1095, 27939, 29922, 11794, 29918, 15307, 29892, 13, 1678, 10959, 25510, 29922, 5574, 29892, 13, 1678, 4840, 29922, 3366, 17482, 29899, 13082, 29906, 12436, 13, 1678, 18094, 29922, 5072, 703, 2587, 613, 376, 29896, 29929, 29945, 4968, 13, 29897, 13, 13, 29937, 518, 29941, 29962, 5244, 411, 596, 3630, 1203, 29889, 13, 29937, 518, 29941, 29889, 29896, 29962, 19916, 29889, 13, 4572, 287, 29918, 13604, 29901, 3630, 353, 4959, 29889, 4572, 29898, 2892, 321, 29901, 321, 3366, 2587, 3108, 2804, 518, 2314, 29871, 396, 19916, 4959, 411, 4069, 3573, 29889, 13, 13, 13, 29937, 518, 29941, 29889, 29906, 29962, 7315, 29889, 13, 1753, 4327, 29918, 2220, 29898, 11651, 1125, 13, 1678, 736, 8853, 3696, 1170, 1115, 2407, 3366, 3696, 1170, 12436, 376, 8698, 1319, 1115, 2407, 3366, 8698, 1319, 3108, 29913, 13, 13, 13, 4572, 287, 29918, 392, 29918, 655, 2986, 29918, 13604, 353, 22289, 29918, 13604, 29889, 1958, 29898, 9067, 29918, 2220, 29897, 13, 13, 29937, 518, 29941, 29889, 29941, 29962, 3630, 16439, 29889, 13, 29937, 539, 8669, 310, 2599, 848, 29304, 4331, 491, 4331, 366, 508, 437, 372, 297, 697, 1196, 29889, 13, 4572, 287, 29918, 392, 29918, 655, 2986, 29918, 13604, 29918, 1609, 29918, 13096, 5570, 353, 4959, 29889, 4572, 29898, 2892, 321, 29901, 321, 3366, 2587, 3108, 2804, 5159, 467, 1958, 29898, 9067, 29918, 2220, 29897, 13, 13, 29937, 10576, 310, 1438, 1023, 3630, 3618, 881, 367, 5186, 29889, 13, 9294, 1051, 29898, 4572, 287, 29918, 392, 29918, 655, 2986, 29918, 13604, 29897, 1275, 1051, 29898, 4572, 287, 29918, 392, 29918, 655, 2986, 29918, 13604, 29918, 1609, 29918, 13096, 5570, 29897, 13, 13, 29937, 518, 29941, 29889, 29946, 29962, 317, 2027, 29889, 4971, 666, 278, 937, 2846, 4452, 470, 4046, 963, 29889, 13, 13604, 29918, 3166, 29918, 29896, 29896, 29918, 517, 29918, 355, 29901, 3251, 1061, 353, 4959, 29889, 29879, 2027, 29898, 11014, 29922, 29896, 29900, 29897, 13, 6194, 29918, 4102, 29918, 29896, 29900, 29918, 13604, 29901, 3251, 1061, 353, 4959, 29889, 29879, 2027, 29898, 13400, 29922, 29896, 29900, 29897, 13, 13, 29937, 518, 29941, 29889, 29945, 29962, 678, 9776, 7090, 4660, 29889, 13, 13604, 29889, 1509, 29918, 8173, 29898, 5574, 29897, 13, 13, 29937, 518, 29941, 29889, 29953, 29962, 12878, 1549, 848, 29889, 13, 1454, 1741, 297, 4959, 29901, 13, 1678, 396, 1938, 1554, 411, 1741, 313, 3696, 338, 263, 9657, 467, 13, 1678, 1596, 29898, 3696, 29897, 13, 29937, 2860, 937, 12541, 278, 4959, 756, 263, 7090, 934, 29889, 13, 29937, 2567, 896, 674, 367, 1304, 278, 7090, 297, 1494, 12541, 29889, 13, 13, 29937, 518, 29941, 29889, 29955, 29962, 3617, 1353, 310, 278, 3161, 297, 278, 3630, 1203, 29889, 13, 4537, 29918, 974, 29918, 13604, 353, 4959, 29889, 2435, 13, 13, 29937, 518, 29941, 29889, 29947, 29962, 5399, 393, 3630, 1203, 3508, 29915, 29873, 4069, 29889, 13, 29937, 450, 848, 2752, 881, 367, 451, 4069, 29889, 13, 9294, 4959, 29889, 275, 29918, 6310, 338, 7700, 13, 13, 29937, 518, 29941, 29889, 29929, 29962, 14806, 3630, 1203, 304, 278, 1051, 310, 3161, 29898, 13604, 470, 7191, 467, 13, 29937, 1522, 16010, 29892, 445, 508, 2125, 2086, 1568, 3370, 29889, 13, 13604, 29918, 1761, 353, 1051, 29898, 13604, 29897, 13, 13, 29937, 518, 29941, 29889, 29896, 29900, 29962, 3617, 1741, 29914, 4906, 491, 1178, 29889, 13, 2783, 2859, 29918, 3696, 353, 376, 29929, 346, 29947, 29874, 29906, 600, 29899, 29881, 29953, 29900, 29900, 29899, 29946, 29941, 29953, 29953, 29899, 29929, 5363, 29899, 29906, 29900, 29947, 29906, 6854, 29883, 29953, 29929, 29929, 29900, 29896, 29901, 1389, 29896, 29881, 29955, 29906, 29906, 29872, 29899, 6854, 29945, 29872, 29899, 29896, 29896, 774, 29899, 29890, 2252, 29900, 29899, 1133, 29953, 29900, 29900, 29900, 29929, 29945, 29955, 29941, 29888, 29908, 13, 2783, 2859, 29918, 13604, 353, 518, 13, 1678, 376, 311, 11248, 29900, 29955, 29929, 29890, 29899, 29946, 29906, 29941, 29945, 29899, 29946, 29946, 29906, 29896, 29899, 370, 29888, 29953, 29899, 29953, 29874, 29941, 562, 29896, 29881, 29900, 29946, 29883, 29955, 29953, 29901, 1389, 29896, 29881, 29941, 29874, 29906, 29900, 29899, 6854, 29945, 29872, 29899, 29896, 29896, 774, 29899, 29890, 2252, 29900, 29899, 1133, 29953, 29900, 29900, 29900, 29929, 29945, 29955, 29941, 29888, 613, 13, 1678, 376, 29874, 29941, 29946, 29872, 29941, 10702, 29946, 29899, 29883, 29953, 29941, 29945, 29899, 29946, 29874, 29929, 29900, 29899, 29947, 29888, 29946, 29906, 29899, 29941, 29955, 1289, 29929, 29947, 29946, 29906, 29900, 29929, 10702, 29901, 1389, 29896, 29883, 29945, 346, 29874, 29899, 6854, 29945, 29872, 29899, 29896, 29896, 774, 29899, 29890, 2252, 29900, 29899, 1133, 29953, 29900, 29900, 29900, 29929, 29945, 29955, 29941, 29888, 613, 13, 29962, 13, 2783, 2859, 29918, 4906, 353, 376, 17482, 29899, 13082, 29896, 29901, 4102, 29901, 29896, 29953, 29896, 29929, 29945, 29900, 29953, 29896, 29945, 29955, 29896, 29941, 29906, 29906, 29953, 29945, 29947, 29941, 29955, 29908, 13, 2783, 2859, 29918, 19158, 353, 518, 13, 1678, 376, 17482, 29899, 13082, 29896, 29901, 4102, 29901, 29896, 29953, 29896, 29929, 29945, 29900, 29953, 29896, 29945, 29955, 29896, 29941, 29906, 29906, 29953, 29945, 29947, 29941, 29953, 613, 13, 1678, 376, 17482, 29899, 13082, 29896, 29901, 4102, 29901, 29896, 29953, 29896, 29929, 29945, 29900, 29953, 29896, 29945, 29955, 29896, 29941, 29906, 29906, 29953, 29945, 29947, 29941, 29941, 613, 13, 29962, 13, 13, 1272, 29918, 4993, 29889, 2886, 29918, 13604, 29918, 1609, 29918, 333, 29918, 3166, 29918, 1272, 29918, 18121, 29898, 2783, 2859, 29918, 3696, 29897, 29871, 396, 16969, 29871, 29896, 1741, 313, 8977, 467, 13, 1272, 29918, 4993, 29889, 2886, 29918, 13604, 29918, 1609, 29918, 333, 29918, 3166, 29918, 1272, 29918, 18121, 29898, 2783, 2859, 29918, 13604, 29897, 29871, 396, 16969, 29871, 29906, 4959, 1051, 29898, 8977, 467, 13, 13, 1272, 29918, 4993, 29889, 2886, 29918, 19158, 29918, 1609, 29918, 333, 29918, 3166, 29918, 1272, 29918, 18121, 29898, 2783, 2859, 29918, 4906, 29897, 29871, 396, 16969, 29871, 29896, 2643, 313, 8977, 467, 13, 1272, 29918, 4993, 29889, 2886, 29918, 19158, 29918, 1609, 29918, 333, 29918, 3166, 29918, 1272, 29918, 18121, 29898, 2783, 2859, 29918, 19158, 29897, 29871, 396, 16969, 29871, 29906, 7191, 1051, 29898, 8977, 467, 13, 13, 29937, 518, 29941, 29889, 29896, 29896, 29962, 450, 7090, 20328, 29889, 13, 29937, 6760, 1078, 263, 716, 3630, 1203, 393, 674, 671, 7090, 515, 278, 4959, 3630, 1203, 29889, 13, 13604, 29918, 2541, 29918, 16175, 353, 4959, 29889, 4572, 29898, 2892, 2407, 29901, 2407, 29889, 657, 703, 16175, 1204, 5783, 13, 13, 29937, 1570, 3630, 3618, 1016, 29915, 29873, 671, 1009, 1914, 7090, 491, 2322, 541, 671, 278, 7090, 310, 278, 3847, 3630, 1203, 29889, 13, 29937, 4803, 671, 29918, 8173, 1158, 304, 5039, 403, 22488, 29889, 2860, 393, 29892, 278, 3630, 1203, 674, 1653, 967, 1914, 7090, 934, 29889, 13, 13604, 29918, 2541, 29918, 16175, 29889, 1509, 29918, 8173, 29898, 5574, 29897, 13, 13, 1761, 29898, 13604, 29918, 2541, 29918, 16175, 29897, 13, 13, 13604, 29918, 8768, 29918, 2541, 29918, 16175, 353, 4959, 29918, 2541, 29918, 16175, 29889, 1958, 29898, 2892, 2407, 29901, 8853, 3696, 1542, 1115, 2407, 29889, 657, 703, 3696, 1542, 1159, 1800, 13, 13, 13604, 29918, 14037, 29918, 8768, 29918, 2541, 29918, 16175, 353, 4959, 29918, 8768, 29918, 2541, 29918, 16175, 29889, 4572, 29898, 2892, 2407, 29901, 451, 2407, 29889, 657, 703, 3696, 1542, 5783, 13, 13604, 29918, 14037, 29918, 8768, 29918, 2541, 29918, 16175, 29889, 1509, 29918, 8173, 29898, 5574, 29897, 13, 2 ]
build/lib/abp/openai/wrappers/reward_wrapper.py
LinearZoetrope/abp
0
94323
from gym import Wrapper import inspect import logging from functools import partial logger = logging.getLogger(__name__) class RewardWrapper(Wrapper): """ Adds support for reward decomposition of the environment. To support reward decompisition the environment has to return reward as a list of dictionary values Example: [ { "id": "unique ID of the type", "value": integer value indicating the reward got for this type, "description": description of the type (Can be used for explanation) } ] By default returns decomposed reward. It can be turned off by setting decompose_reward = False """ def __init__(self, env): super(RewardWrapper, self).__init__(env) def step(self, action, decompose_reward = True): #TODO THIS DOES NOT WORK!!!! args , _ = inspect.getargspec(self.unwrapped._step, ) if "decompose_reward" in args: self.unwrapped._step = partial(self.unwrapped._step, decompose_reward = decompose_reward) return self.env.step(action)
[ 1, 515, 330, 962, 1053, 399, 6794, 13, 13, 5215, 16096, 13, 5215, 12183, 13, 3166, 2090, 312, 8789, 1053, 7687, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 1990, 390, 809, 538, 15646, 29898, 15646, 1125, 13, 13, 1678, 9995, 13, 13, 1678, 3462, 29879, 2304, 363, 20751, 26227, 310, 278, 5177, 29889, 13, 1678, 1763, 2304, 20751, 316, 2388, 275, 654, 278, 5177, 756, 304, 736, 20751, 408, 263, 1051, 310, 8600, 1819, 13, 1678, 8741, 29901, 13, 1678, 518, 13, 4706, 426, 13, 3986, 376, 333, 1115, 376, 13092, 3553, 310, 278, 1134, 613, 13, 3986, 376, 1767, 1115, 6043, 995, 23941, 278, 20751, 2355, 363, 445, 1134, 29892, 13, 3986, 376, 8216, 1115, 6139, 310, 278, 1134, 313, 6028, 367, 1304, 363, 8252, 29897, 13, 4706, 500, 13, 1678, 4514, 13, 13, 1678, 2648, 2322, 3639, 17753, 4752, 20751, 29889, 739, 508, 367, 6077, 1283, 491, 4444, 316, 19438, 29918, 276, 1328, 353, 7700, 13, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8829, 1125, 13, 4706, 2428, 29898, 29934, 809, 538, 15646, 29892, 1583, 467, 1649, 2344, 12035, 6272, 29897, 13, 13, 1678, 822, 4331, 29898, 1311, 29892, 3158, 29892, 316, 19438, 29918, 276, 1328, 353, 5852, 1125, 13, 4706, 396, 4986, 3970, 3446, 3235, 11662, 2890, 6058, 399, 1955, 29968, 6824, 6824, 13, 4706, 6389, 1919, 903, 353, 16096, 29889, 657, 5085, 3135, 29898, 1311, 29889, 348, 29893, 336, 2986, 3032, 10568, 29892, 1723, 13, 4706, 565, 376, 311, 19438, 29918, 276, 1328, 29908, 297, 6389, 29901, 13, 9651, 1583, 29889, 348, 29893, 336, 2986, 3032, 10568, 353, 7687, 29898, 1311, 29889, 348, 29893, 336, 2986, 3032, 10568, 29892, 316, 19438, 29918, 276, 1328, 353, 316, 19438, 29918, 276, 1328, 29897, 13, 4706, 736, 1583, 29889, 6272, 29889, 10568, 29898, 2467, 29897, 13, 2 ]