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
listlengths
7
549k
src/golem/__init__.py
aspuru-guzik-group/golem
10
101441
<gh_stars>1-10 from ._version import get_versions __version__ = get_versions()['version'] del get_versions from .golem import Golem from .extensions import BaseDist, Delta, Normal, TruncatedNormal, FoldedNormal from .extensions import Uniform, TruncatedUniform, BoundedUniform, Gamma from .extensions import Poisson, DiscreteLaplace, Categorical from .extensions import FrozenNormal, FrozenUniform, FrozenGamma from .extensions import FrozenPoisson, FrozenDiscreteLaplace, FrozenCategorical
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 869, 29918, 3259, 1053, 679, 29918, 26100, 13, 1649, 3259, 1649, 353, 679, 29918, 26100, 580, 1839, 3259, 2033, 13, 6144, 679, 29918, 26100, 13, 13, 3166, 869, 1484, 2409, 1053, 402, 1772, 29885, 13, 3166, 869, 24299, 1053, 7399, 13398, 29892, 360, 2554, 29892, 21981, 29892, 1605, 4661, 630, 19077, 29892, 383, 1025, 287, 19077, 13, 3166, 869, 24299, 1053, 853, 5560, 29892, 1605, 4661, 630, 2525, 5560, 29892, 350, 7261, 2525, 5560, 29892, 402, 2735, 13, 3166, 869, 24299, 1053, 3929, 17387, 29892, 3295, 9084, 29931, 481, 1265, 29892, 315, 20440, 936, 13, 3166, 869, 24299, 1053, 25022, 2256, 19077, 29892, 25022, 2256, 2525, 5560, 29892, 25022, 2256, 6642, 13, 3166, 869, 24299, 1053, 25022, 2256, 9837, 17387, 29892, 25022, 2256, 4205, 9084, 29931, 481, 1265, 29892, 25022, 2256, 29907, 20440, 936, 13, 2 ]
fib.py
ednl/bigint
0
57140
<reponame>ednl/bigint #!/usr/bin/env python3 from sys import argv try: N = int(argv[1]) except (IndexError, ValueError): exit("Not a number") a = 0 b = 1 for _ in range(N): a, b = b, a + b print(a)
[ 1, 529, 276, 1112, 420, 29958, 287, 12938, 29914, 3752, 524, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 3166, 10876, 1053, 1852, 29894, 13, 13, 2202, 29901, 13, 1678, 405, 353, 938, 29898, 19218, 29961, 29896, 2314, 13, 19499, 313, 3220, 2392, 29892, 7865, 2392, 1125, 13, 1678, 6876, 703, 3664, 263, 1353, 1159, 13, 13, 29874, 353, 29871, 29900, 13, 29890, 353, 29871, 29896, 13, 1454, 903, 297, 3464, 29898, 29940, 1125, 13, 1678, 263, 29892, 289, 353, 289, 29892, 263, 718, 289, 13, 13, 2158, 29898, 29874, 29897, 13, 2 ]
BOOK/MAIN/05-file-handling/chapter-5/02-copy-atheletics.py
kabirsrivastava3/python-practice
0
1613339
# A file sports.dat contains information in following format : #Event ~ Participant #A function that would read contents from file sports.dat and creates a file named Atheletic.dat copying only those records from sports.dat where the event name is " Atheletics ". def eventParticipant(): file1 = open("sports.txt","r") file2 = open("Atheletics.txt","w") listObj = file1.readlines() for index in listObj: print(index[:9]) if index[:9] == "atheletic" or index[:9] == "Atheletic": file2.write(index) file1.close() file2.close() eventParticipant()
[ 1, 396, 319, 934, 14717, 29889, 4130, 3743, 2472, 297, 1494, 3402, 584, 13, 29937, 2624, 3695, 3455, 12654, 424, 13, 29937, 29909, 740, 393, 723, 1303, 8118, 515, 934, 14717, 29889, 4130, 322, 10017, 263, 934, 4257, 319, 1552, 1026, 293, 29889, 4130, 17596, 871, 1906, 6475, 515, 14717, 29889, 4130, 988, 278, 1741, 1024, 338, 376, 319, 1552, 1026, 1199, 11393, 13, 13, 13, 1753, 29871, 1741, 7439, 12654, 424, 7295, 13, 1678, 934, 29896, 353, 1722, 703, 29879, 4011, 29889, 3945, 3284, 29878, 1159, 13, 1678, 934, 29906, 353, 1722, 703, 29909, 1552, 1026, 1199, 29889, 3945, 3284, 29893, 1159, 13, 1678, 1051, 9930, 353, 934, 29896, 29889, 949, 9012, 580, 13, 1678, 363, 2380, 297, 1051, 9930, 29901, 13, 4706, 1596, 29898, 2248, 7503, 29929, 2314, 13, 4706, 565, 2380, 7503, 29929, 29962, 1275, 376, 271, 354, 1026, 293, 29908, 470, 2380, 7503, 29929, 29962, 1275, 376, 29909, 1552, 1026, 293, 1115, 13, 9651, 934, 29906, 29889, 3539, 29898, 2248, 29897, 13, 632, 13, 1678, 934, 29896, 29889, 5358, 580, 13, 1678, 934, 29906, 29889, 5358, 580, 13, 268, 13, 3696, 7439, 12654, 424, 580, 13, 13, 13, 13, 13, 13, 2 ]
platformer/ai.py
lukaszzalewski0001/2d_platformer
0
1600877
''' Copyright 2019 <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 math import random class EnemyAI: '''Creates EnemyAI object, that controls ai\'s behaviour''' def __init__(self, player, movement, ai_scheme, ai_level): self.player = player self.movement = movement self.ai_scheme = ai_scheme self.ai_level = ai_level self.weapon = None def tick(self): ''' Runs enemy's ai depending on ai_scheme value ai_scheme = 1: ai moves left and right ai_scheme = 2: ai moves left and right, but also jumps ai_scheme = 3: ai moves towards player ai_scheme = 4: ai moves and jumps towards player ''' if self.ai_scheme == 1: self.__dumb_moving_left_right_ai() elif self.ai_scheme == 2: self.__full_dumb_movement_ai() elif self.ai_scheme == 3: self.__moving_to_player_ai() elif self.ai_scheme == 4: self.__full_movement_ai() def shooting_ai(self): ''' Responds for enemy's shooting depending on ai_level ai_level = 0: ai shoots in random direction ai_level = 1: ai shoots towards player ''' if self.ai_level == 0: self.weapon.shoot([self.movement.enemy_pos[0] - 16, self.movement.enemy_pos[1]], math.radians(random.randrange(360))) if self.ai_level == 1: angle = math.atan2(self.player.player_pos[1] - self.movement.enemy_pos[1], self.player.player_pos[0] - self.movement.enemy_pos[0]) self.weapon.shoot([self.movement.enemy_pos[0] - 16, self.movement.enemy_pos[1]], angle) def __dumb_moving_left_right_ai(self): '''AI moves left and right''' self.movement.moving = True if (self.movement.enemy_pos[0] == 0 and self.movement.move_dir == 0) or self.movement.map_.is_any_solid_block_left_from_entity(self.movement.enemy_pos): self.movement.move_dir = 1 elif (self.movement.enemy_pos[0] == (self.movement.map_.map_size - 1) * 32 and self.movement.move_dir == 1) or self.movement.map_.is_any_solid_block_right_from_entity(self.movement.enemy_pos): self.movement.move_dir = 0 def __full_dumb_movement_ai(self): '''AI moves left and right, but also jumps''' self.__dumb_moving_left_right_ai() if not self.movement.jumping: self.movement.jump_current_speed = self.movement.jump_max_speed self.movement.jumping = True self.movement.jump_dir = 0 def __moving_to_player_ai(self): '''AI moves towards player''' self.movement.moving = True if abs(self.player.player_pos[0] - self.movement.enemy_pos[0]) <= 8: self.movement.moving = False elif self.player.player_pos[0] < self.movement.enemy_pos[0]: self.movement.move_dir = 0 elif self.player.player_pos[0] > self.movement.enemy_pos[0]: self.movement.move_dir = 1 def __full_movement_ai(self): '''AI moves and jumps towards player''' self.__moving_to_player_ai() if not self.movement.jumping: if self.player.player_pos[1] < self.movement.enemy_pos[1]: self.movement.jump_current_speed = self.movement.jump_max_speed self.movement.jumping = True self.movement.jump_dir = 0
[ 1, 14550, 13, 1678, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 529, 5813, 15513, 13, 13, 1678, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 1678, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 1678, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 13, 4706, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 308, 13, 1678, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 1678, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 1678, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 1678, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 1678, 27028, 1090, 278, 19245, 29889, 13, 12008, 13, 13, 5215, 5844, 13, 5215, 4036, 13, 13, 1990, 1174, 6764, 23869, 29901, 13, 1678, 14550, 9832, 1078, 1174, 6764, 23869, 1203, 29892, 393, 11761, 7468, 20333, 29879, 10468, 12008, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4847, 29892, 10298, 29892, 7468, 29918, 816, 2004, 29892, 7468, 29918, 5563, 1125, 13, 4706, 1583, 29889, 9106, 353, 4847, 13, 4706, 1583, 29889, 13529, 882, 353, 10298, 13, 4706, 1583, 29889, 1794, 29918, 816, 2004, 353, 7468, 29918, 816, 2004, 13, 4706, 1583, 29889, 1794, 29918, 5563, 353, 7468, 29918, 5563, 13, 4706, 1583, 29889, 705, 481, 265, 353, 6213, 13, 308, 13, 1678, 822, 16892, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 390, 6948, 11103, 29915, 29879, 7468, 8679, 373, 7468, 29918, 816, 2004, 995, 13, 308, 13, 4706, 7468, 29918, 816, 2004, 353, 29871, 29896, 29901, 13, 9651, 7468, 16229, 2175, 322, 1492, 13, 4706, 7468, 29918, 816, 2004, 353, 29871, 29906, 29901, 13, 9651, 7468, 16229, 2175, 322, 1492, 29892, 541, 884, 432, 17204, 13, 4706, 7468, 29918, 816, 2004, 353, 29871, 29941, 29901, 13, 9651, 7468, 16229, 7113, 4847, 13, 4706, 7468, 29918, 816, 2004, 353, 29871, 29946, 29901, 13, 9651, 7468, 16229, 322, 432, 17204, 7113, 4847, 13, 4706, 14550, 13, 13, 4706, 565, 1583, 29889, 1794, 29918, 816, 2004, 1275, 29871, 29896, 29901, 13, 9651, 1583, 17255, 29881, 3774, 29918, 13529, 292, 29918, 1563, 29918, 1266, 29918, 1794, 580, 13, 4706, 25342, 1583, 29889, 1794, 29918, 816, 2004, 1275, 29871, 29906, 29901, 13, 9651, 1583, 17255, 8159, 29918, 29881, 3774, 29918, 13529, 882, 29918, 1794, 580, 259, 13, 4706, 25342, 1583, 29889, 1794, 29918, 816, 2004, 1275, 29871, 29941, 29901, 13, 9651, 1583, 17255, 13529, 292, 29918, 517, 29918, 9106, 29918, 1794, 580, 29871, 13, 4706, 25342, 1583, 29889, 1794, 29918, 816, 2004, 1275, 29871, 29946, 29901, 13, 9651, 1583, 17255, 8159, 29918, 13529, 882, 29918, 1794, 580, 13, 13, 1678, 822, 27904, 29918, 1794, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 2538, 2818, 29879, 363, 11103, 29915, 29879, 27904, 8679, 373, 7468, 29918, 5563, 13, 13, 4706, 7468, 29918, 5563, 353, 29871, 29900, 29901, 13, 9651, 7468, 17394, 1862, 297, 4036, 5305, 13, 4706, 7468, 29918, 5563, 353, 29871, 29896, 29901, 13, 9651, 7468, 17394, 1862, 7113, 4847, 13, 4706, 14550, 13, 13, 4706, 565, 1583, 29889, 1794, 29918, 5563, 1275, 29871, 29900, 29901, 13, 632, 1583, 29889, 705, 481, 265, 29889, 845, 3155, 4197, 1311, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 29962, 448, 29871, 29896, 29953, 29892, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29896, 20526, 5844, 29889, 3665, 5834, 29898, 8172, 29889, 9502, 3881, 29898, 29941, 29953, 29900, 4961, 13, 4706, 565, 1583, 29889, 1794, 29918, 5563, 1275, 29871, 29896, 29901, 13, 9651, 10696, 353, 5844, 29889, 23402, 29906, 29898, 1311, 29889, 9106, 29889, 9106, 29918, 1066, 29961, 29896, 29962, 448, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29896, 1402, 13, 462, 1669, 1583, 29889, 9106, 29889, 9106, 29918, 1066, 29961, 29900, 29962, 448, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 2314, 13, 9651, 1583, 29889, 705, 481, 265, 29889, 845, 3155, 4197, 1311, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 29962, 448, 29871, 29896, 29953, 29892, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29896, 20526, 10696, 29897, 29871, 13, 13, 1678, 822, 4770, 29881, 3774, 29918, 13529, 292, 29918, 1563, 29918, 1266, 29918, 1794, 29898, 1311, 1125, 13, 4706, 14550, 23869, 16229, 2175, 322, 1492, 12008, 13, 4706, 1583, 29889, 13529, 882, 29889, 13529, 292, 353, 5852, 13, 4706, 565, 313, 1311, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 29962, 1275, 29871, 29900, 322, 1583, 29889, 13529, 882, 29889, 11631, 29918, 3972, 1275, 29871, 29900, 29897, 470, 1583, 29889, 13529, 882, 29889, 1958, 5396, 275, 29918, 1384, 29918, 2929, 333, 29918, 1271, 29918, 1563, 29918, 3166, 29918, 10041, 29898, 1311, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 1125, 13, 795, 1583, 29889, 13529, 882, 29889, 11631, 29918, 3972, 353, 29871, 29896, 13, 4706, 25342, 313, 1311, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 29962, 1275, 313, 1311, 29889, 13529, 882, 29889, 1958, 5396, 1958, 29918, 2311, 448, 29871, 29896, 29897, 334, 29871, 29941, 29906, 322, 1583, 29889, 13529, 882, 29889, 11631, 29918, 3972, 1275, 29871, 29896, 29897, 470, 1583, 29889, 13529, 882, 29889, 1958, 5396, 275, 29918, 1384, 29918, 2929, 333, 29918, 1271, 29918, 1266, 29918, 3166, 29918, 10041, 29898, 1311, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 1125, 13, 9651, 1583, 29889, 13529, 882, 29889, 11631, 29918, 3972, 353, 29871, 29900, 13, 13, 1678, 822, 4770, 8159, 29918, 29881, 3774, 29918, 13529, 882, 29918, 1794, 29898, 1311, 1125, 13, 4706, 14550, 23869, 16229, 2175, 322, 1492, 29892, 541, 884, 432, 17204, 12008, 13, 4706, 1583, 17255, 29881, 3774, 29918, 13529, 292, 29918, 1563, 29918, 1266, 29918, 1794, 580, 13, 13, 4706, 565, 451, 1583, 29889, 13529, 882, 29889, 29926, 3427, 292, 29901, 13, 9651, 1583, 29889, 13529, 882, 29889, 29926, 3427, 29918, 3784, 29918, 19322, 353, 1583, 29889, 13529, 882, 29889, 29926, 3427, 29918, 3317, 29918, 19322, 13, 9651, 1583, 29889, 13529, 882, 29889, 29926, 3427, 292, 353, 5852, 13, 9651, 1583, 29889, 13529, 882, 29889, 29926, 3427, 29918, 3972, 353, 29871, 29900, 13, 268, 13, 1678, 822, 4770, 13529, 292, 29918, 517, 29918, 9106, 29918, 1794, 29898, 1311, 1125, 13, 4706, 14550, 23869, 16229, 7113, 4847, 12008, 13, 4706, 1583, 29889, 13529, 882, 29889, 13529, 292, 353, 5852, 13, 4706, 565, 6425, 29898, 1311, 29889, 9106, 29889, 9106, 29918, 1066, 29961, 29900, 29962, 448, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 2314, 5277, 29871, 29947, 29901, 13, 9651, 1583, 29889, 13529, 882, 29889, 13529, 292, 353, 7700, 13, 4706, 25342, 1583, 29889, 9106, 29889, 9106, 29918, 1066, 29961, 29900, 29962, 529, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 5387, 13, 9651, 1583, 29889, 13529, 882, 29889, 11631, 29918, 3972, 353, 29871, 29900, 13, 4706, 25342, 1583, 29889, 9106, 29889, 9106, 29918, 1066, 29961, 29900, 29962, 1405, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29900, 5387, 13, 9651, 1583, 29889, 13529, 882, 29889, 11631, 29918, 3972, 353, 29871, 29896, 13, 308, 13, 1678, 822, 4770, 8159, 29918, 13529, 882, 29918, 1794, 29898, 1311, 1125, 13, 4706, 14550, 23869, 16229, 322, 432, 17204, 7113, 4847, 12008, 13, 4706, 1583, 17255, 13529, 292, 29918, 517, 29918, 9106, 29918, 1794, 580, 13, 13, 4706, 565, 451, 1583, 29889, 13529, 882, 29889, 29926, 3427, 292, 29901, 13, 9651, 565, 1583, 29889, 9106, 29889, 9106, 29918, 1066, 29961, 29896, 29962, 529, 1583, 29889, 13529, 882, 29889, 264, 6764, 29918, 1066, 29961, 29896, 5387, 13, 18884, 1583, 29889, 13529, 882, 29889, 29926, 3427, 29918, 3784, 29918, 19322, 353, 1583, 29889, 13529, 882, 29889, 29926, 3427, 29918, 3317, 29918, 19322, 13, 18884, 1583, 29889, 13529, 882, 29889, 29926, 3427, 292, 353, 5852, 13, 18884, 1583, 29889, 13529, 882, 29889, 29926, 3427, 29918, 3972, 353, 29871, 29900, 2 ]
Python/maxArea.py
alexwu2021/practice
0
164482
<reponame>alexwu2021/practice class Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int """ n = len(height) d = [0] * n for i in range(n): d[i] = height[i] for i in range(1, n): avg = d[i-1] / (i * 1.0) if height[i] >= avg: d[i] = max(d[i], d[i-1], d[i-1] + avg) else: d[i] = max(d[i], d[i-1], height[i] * (1 + d[i-1]/(avg *1.0))) for j in range(n): print('d[%d]:%d' % (j, d[j])) return d[n-1] sol = Solution() height = [10, 8, 0, 7, 7, 9, 9] ret = sol.maxArea(height) print('ret: %d' % ret)
[ 1, 529, 276, 1112, 420, 29958, 744, 29916, 29893, 29884, 29906, 29900, 29906, 29896, 29914, 29886, 1461, 625, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 4236, 13799, 29898, 1311, 29892, 3171, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 3171, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 4706, 9995, 13, 4706, 302, 353, 7431, 29898, 3545, 29897, 13, 4706, 270, 353, 518, 29900, 29962, 334, 302, 29871, 13, 4706, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 9651, 270, 29961, 29875, 29962, 353, 3171, 29961, 29875, 29962, 13, 308, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 302, 1125, 13, 9651, 1029, 29887, 353, 270, 29961, 29875, 29899, 29896, 29962, 847, 313, 29875, 334, 29871, 29896, 29889, 29900, 29897, 13, 9651, 565, 3171, 29961, 29875, 29962, 6736, 1029, 29887, 29901, 13, 18884, 270, 29961, 29875, 29962, 353, 4236, 29898, 29881, 29961, 29875, 1402, 270, 29961, 29875, 29899, 29896, 1402, 270, 29961, 29875, 29899, 29896, 29962, 718, 1029, 29887, 29897, 13, 9651, 1683, 29901, 13, 18884, 270, 29961, 29875, 29962, 353, 4236, 29898, 29881, 29961, 29875, 1402, 270, 29961, 29875, 29899, 29896, 1402, 3171, 29961, 29875, 29962, 334, 313, 29896, 718, 270, 29961, 29875, 29899, 29896, 29962, 14571, 485, 29887, 334, 29896, 29889, 29900, 4961, 13, 13, 4706, 363, 432, 297, 3464, 29898, 29876, 1125, 13, 9651, 1596, 877, 29881, 29961, 29995, 29881, 5387, 29995, 29881, 29915, 1273, 313, 29926, 29892, 270, 29961, 29926, 12622, 13, 308, 13, 4706, 736, 270, 29961, 29876, 29899, 29896, 29962, 13, 13, 13, 2929, 353, 259, 24380, 580, 13, 3545, 353, 518, 29896, 29900, 29892, 29871, 29947, 29892, 29871, 29900, 29892, 29871, 29955, 29892, 29871, 29955, 29892, 29871, 29929, 29892, 29871, 29929, 29962, 13, 2267, 353, 899, 29889, 3317, 13799, 29898, 3545, 29897, 13, 2158, 877, 2267, 29901, 1273, 29881, 29915, 1273, 3240, 29897, 13, 2 ]
bc/documents/models.py
Buckinghamshire-Digital-Service/buckinghamshire-council
1
155177
<gh_stars>1-10 from django.db import models from wagtail.documents.models import AbstractDocument from wagtail.documents.models import Document as WagtailDocument class CustomDocument(AbstractDocument): talentlink_attachment_id = models.IntegerField(blank=True, null=True) admin_form_fields = WagtailDocument.admin_form_fields + ( "talentlink_attachment_id", )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 13, 3166, 281, 351, 18237, 29889, 3225, 29879, 29889, 9794, 1053, 25513, 6268, 13, 3166, 281, 351, 18237, 29889, 3225, 29879, 29889, 9794, 1053, 10854, 408, 399, 351, 18237, 6268, 13, 13, 13, 1990, 8701, 6268, 29898, 9118, 6268, 1125, 13, 1678, 24242, 2324, 29918, 14930, 358, 29918, 333, 353, 4733, 29889, 7798, 3073, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29897, 13, 1678, 4113, 29918, 689, 29918, 9621, 353, 399, 351, 18237, 6268, 29889, 6406, 29918, 689, 29918, 9621, 718, 313, 13, 4706, 376, 20411, 296, 2324, 29918, 14930, 358, 29918, 333, 613, 13, 1678, 1723, 13, 2 ]
majortom_gateway/__init__.py
grantperry/majortom_gateway_package
0
114098
from majortom_gateway.gateway_api import GatewayAPI name = "majortom_gateway"
[ 1, 515, 10067, 441, 290, 29918, 17062, 1582, 29889, 17062, 1582, 29918, 2754, 1053, 22510, 1582, 8787, 13, 978, 353, 376, 655, 29926, 441, 290, 29918, 17062, 1582, 29908, 13, 2 ]
dataset/gla_vol_time_series/cumul_to_rates_rgi01regions.py
subond/ww_tvol_study
20
36802
<gh_stars>10-100 import os, sys import pandas as pd import numpy as np import pyddem.tdem_tools as tt # example to integrate the RGI-O1 cumulative time series into rates with time-varying glacier areas # file with time-varying areas for RGI regions fn_tarea = '/home/atom/data/inventory_products/RGI/tarea_zemp.csv' # list of regional cumulative series reg_dir = '/home/atom/ongoing/work_worldwide/vol/final' list_fn_reg= [os.path.join(reg_dir,'dh_'+str(i).zfill(2)+'_rgi60_int_base_reg.csv') for i in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]] # periods of interest tlim_00_10 = [np.datetime64('2000-01-01'),np.datetime64('2010-01-01')] tlim_10_20 = [np.datetime64('2010-01-01'),np.datetime64('2020-01-01')] tlim_ar6 = [np.datetime64('2006-01-01'),np.datetime64('2019-01-01')] tlim_00_20 = [np.datetime64('2000-01-01'),np.datetime64('2020-01-01')] list_tlim = [tlim_00_10,tlim_10_20,tlim_ar6,tlim_00_20] list_tag = ['decad1','decad2','ar6','full'] # integrate the cumulative series into rates for each period and region list_df = [] for fn_reg in list_fn_reg: df_reg = pd.read_csv(fn_reg) df_agg = tt.aggregate_all_to_period(df_reg,list_tlim=list_tlim,fn_tarea=fn_tarea,frac_area=1,list_tag=list_tag) list_df.append(df_agg) # concatenate results df = pd.concat(list_df) # convert m w.e. yr-1 into kg m-2 yr-1 df.dmdtda *= 1000 df.err_dmdtda *= 1000 # keep only variables of interests df = df[['reg','period','dmdt','err_dmdt','dmdtda','err_dmdtda']] df.to_csv('/home/atom/ongoing/work_ipcc_ar6/table_hugonnet_regions_10yr_20yr_ar6period_final.csv',float_format='%.2f',index=None)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 2897, 29892, 10876, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 5215, 282, 2941, 2310, 29889, 29873, 2310, 29918, 8504, 408, 260, 29873, 13, 13, 29937, 1342, 304, 22782, 278, 390, 29954, 29902, 29899, 29949, 29896, 13299, 28524, 931, 3652, 964, 19257, 411, 931, 29899, 29894, 653, 292, 14751, 13241, 10161, 13, 13, 29937, 934, 411, 931, 29899, 29894, 653, 292, 10161, 363, 390, 29954, 29902, 12786, 13, 9144, 29918, 29873, 6203, 353, 8207, 5184, 29914, 8678, 29914, 1272, 29914, 262, 23886, 29918, 14456, 29914, 29934, 29954, 29902, 29914, 29873, 6203, 29918, 29920, 3451, 29889, 7638, 29915, 13, 13, 29937, 1051, 310, 14014, 13299, 28524, 3652, 13, 1727, 29918, 3972, 353, 8207, 5184, 29914, 8678, 29914, 7443, 292, 29914, 1287, 29918, 11526, 8157, 29914, 1555, 29914, 8394, 29915, 13, 1761, 29918, 9144, 29918, 1727, 29922, 518, 359, 29889, 2084, 29889, 7122, 29898, 1727, 29918, 3972, 5501, 12744, 29918, 18717, 710, 29898, 29875, 467, 29920, 5589, 29898, 29906, 7240, 15972, 29878, 3146, 29953, 29900, 29918, 524, 29918, 3188, 29918, 1727, 29889, 7638, 1495, 363, 474, 297, 518, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 29892, 29953, 29892, 29955, 29892, 29947, 29892, 29929, 29892, 29896, 29900, 29892, 29896, 29896, 29892, 29896, 29906, 29892, 29896, 29941, 29892, 29896, 29946, 29892, 29896, 29945, 29892, 29896, 29953, 29892, 29896, 29955, 29892, 29896, 29947, 29892, 29896, 29929, 5262, 13, 29937, 23704, 310, 4066, 13, 29873, 2576, 29918, 29900, 29900, 29918, 29896, 29900, 353, 518, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29900, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 5477, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29896, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 1495, 29962, 13, 29873, 2576, 29918, 29896, 29900, 29918, 29906, 29900, 353, 518, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29896, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 5477, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29906, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 1495, 29962, 13, 29873, 2576, 29918, 279, 29953, 353, 518, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29900, 29953, 29899, 29900, 29896, 29899, 29900, 29896, 5477, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29896, 29929, 29899, 29900, 29896, 29899, 29900, 29896, 1495, 29962, 13, 29873, 2576, 29918, 29900, 29900, 29918, 29906, 29900, 353, 518, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29900, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 5477, 9302, 29889, 12673, 29953, 29946, 877, 29906, 29900, 29906, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 1495, 29962, 13, 1761, 29918, 29873, 2576, 353, 518, 29873, 2576, 29918, 29900, 29900, 29918, 29896, 29900, 29892, 29873, 2576, 29918, 29896, 29900, 29918, 29906, 29900, 29892, 29873, 2576, 29918, 279, 29953, 29892, 29873, 2576, 29918, 29900, 29900, 29918, 29906, 29900, 29962, 13, 1761, 29918, 4039, 353, 6024, 7099, 328, 29896, 3788, 7099, 328, 29906, 3788, 279, 29953, 3788, 8159, 2033, 13, 13, 29937, 22782, 278, 13299, 28524, 3652, 964, 19257, 363, 1269, 3785, 322, 5120, 13, 1761, 29918, 2176, 353, 5159, 13, 1454, 7876, 29918, 1727, 297, 1051, 29918, 9144, 29918, 1727, 29901, 13, 1678, 4489, 29918, 1727, 353, 10518, 29889, 949, 29918, 7638, 29898, 9144, 29918, 1727, 29897, 13, 1678, 4489, 29918, 16170, 353, 260, 29873, 29889, 26193, 403, 29918, 497, 29918, 517, 29918, 19145, 29898, 2176, 29918, 1727, 29892, 1761, 29918, 29873, 2576, 29922, 1761, 29918, 29873, 2576, 29892, 9144, 29918, 29873, 6203, 29922, 9144, 29918, 29873, 6203, 29892, 1154, 29918, 6203, 29922, 29896, 29892, 1761, 29918, 4039, 29922, 1761, 29918, 4039, 29897, 13, 1678, 1051, 29918, 2176, 29889, 4397, 29898, 2176, 29918, 16170, 29897, 13, 13, 29937, 16125, 403, 2582, 13, 2176, 353, 10518, 29889, 17685, 29898, 1761, 29918, 2176, 29897, 13, 13, 29937, 3588, 286, 281, 29889, 29872, 29889, 343, 29878, 29899, 29896, 964, 12118, 286, 29899, 29906, 343, 29878, 29899, 29896, 13, 2176, 29889, 29881, 3487, 29873, 1388, 334, 29922, 29871, 29896, 29900, 29900, 29900, 13, 2176, 29889, 3127, 29918, 29881, 3487, 29873, 1388, 334, 29922, 29871, 29896, 29900, 29900, 29900, 13, 13, 29937, 3013, 871, 3651, 310, 20017, 13, 2176, 353, 4489, 29961, 1839, 1727, 3788, 19145, 3788, 29881, 3487, 29873, 3788, 3127, 29918, 29881, 3487, 29873, 3788, 29881, 3487, 29873, 1388, 3788, 3127, 29918, 29881, 3487, 29873, 1388, 2033, 29962, 13, 2176, 29889, 517, 29918, 7638, 11219, 5184, 29914, 8678, 29914, 7443, 292, 29914, 1287, 29918, 666, 617, 29918, 279, 29953, 29914, 2371, 29918, 29882, 688, 265, 1212, 29918, 1727, 1080, 29918, 29896, 29900, 4316, 29918, 29906, 29900, 4316, 29918, 279, 29953, 19145, 29918, 8394, 29889, 7638, 742, 7411, 29918, 4830, 2433, 15543, 29906, 29888, 742, 2248, 29922, 8516, 29897, 13, 2 ]
courseproject/main.py
hpaldan/IOT_SummerCourseProject_2021
0
76024
#from mqtt import MQTTClient from mqtt import MQTTClient_lib as MQTTClient from network import WLAN import machine from machine import Pin import time import math import config adc = machine.ADC() apin = adc.channel(pin='P19') wlan = WLAN(mode=WLAN.STA) wlan.connect(config.WIFI_NAME, auth=(WLAN.WPA2, config.WIFI_PW), timeout=5000) while not wlan.isconnected(): machine.idle() print("Connected to WiFi\n") client = MQTTClient(config.PYCOM_NAME, config.SERVER_NAME,user=config.ADA_USERNAME, password= <PASSWORD>.<PASSWORD>, port=1883) client.set_callback(sub_cb) client.connect() while True: milliVal = apin.voltage() celsius = (milliVal - 500.0) / 10.0 + 62 print('celsius is:' +str(celsius)) client.publish(topic=config.TOPIC_NAME, msg=str(celsius)) time.sleep(60*10)
[ 1, 396, 3166, 286, 29939, 698, 1053, 341, 29984, 19988, 4032, 30004, 13, 3166, 286, 29939, 698, 1053, 341, 29984, 19988, 4032, 29918, 1982, 408, 341, 29984, 19988, 4032, 30004, 13, 3166, 3564, 1053, 399, 29931, 2190, 30004, 13, 5215, 4933, 30004, 13, 3166, 4933, 1053, 17434, 30004, 13, 5215, 931, 30004, 13, 5215, 5844, 30004, 13, 5215, 2295, 30004, 13, 30004, 13, 328, 29883, 353, 4933, 29889, 3035, 29907, 26471, 13, 481, 262, 353, 594, 29883, 29889, 12719, 29898, 12687, 2433, 29925, 29896, 29929, 1495, 30004, 13, 30004, 13, 29893, 6468, 353, 399, 29931, 2190, 29898, 8513, 29922, 29956, 29931, 2190, 29889, 1254, 29909, 8443, 13, 29893, 6468, 29889, 6915, 29898, 2917, 29889, 22119, 3738, 29918, 5813, 29892, 4817, 7607, 29956, 29931, 2190, 29889, 29956, 7228, 29906, 29892, 2295, 29889, 22119, 3738, 29918, 29925, 29956, 511, 11815, 29922, 29945, 29900, 29900, 29900, 8443, 13, 30004, 13, 8000, 451, 281, 6468, 29889, 275, 18045, 7295, 29871, 6756, 13, 1678, 4933, 29889, 333, 280, 26471, 13, 30004, 13, 2158, 703, 20971, 2954, 304, 14570, 18800, 29905, 29876, 1159, 30004, 13, 30004, 13, 4645, 353, 341, 29984, 19988, 4032, 29898, 2917, 29889, 20055, 19795, 29918, 5813, 29892, 2295, 29889, 18603, 29918, 5813, 29892, 1792, 29922, 2917, 29889, 3035, 29909, 29918, 11889, 5813, 29892, 4800, 29922, 529, 25711, 17013, 15513, 29966, 25711, 17013, 10202, 2011, 29922, 29896, 29947, 29947, 29941, 8443, 13, 30004, 13, 4645, 29889, 842, 29918, 14035, 29898, 1491, 29918, 10702, 8443, 13, 4645, 29889, 6915, 26471, 13, 30004, 13, 30004, 13, 8000, 5852, 29901, 30004, 13, 1678, 3533, 29875, 1440, 353, 3095, 262, 29889, 1555, 29873, 482, 580, 259, 6756, 13, 1678, 6432, 1039, 375, 353, 313, 29885, 12840, 1440, 448, 29871, 29945, 29900, 29900, 29889, 29900, 29897, 847, 29871, 29896, 29900, 29889, 29900, 718, 29871, 29953, 29906, 30004, 13, 1678, 6756, 13, 1678, 1596, 877, 2242, 1039, 375, 338, 11283, 718, 710, 29898, 2242, 1039, 375, 876, 30004, 13, 30004, 13, 1678, 3132, 29889, 23679, 29898, 13010, 29922, 2917, 29889, 4986, 2227, 29907, 29918, 5813, 29892, 10191, 29922, 710, 29898, 2242, 1039, 375, 876, 30004, 13, 1678, 6756, 13, 1678, 931, 29889, 17059, 29898, 29953, 29900, 29930, 29896, 29900, 8443, 13, 1678, 6756, 13, 2 ]
tapioca_zendesk/tapioca_zendesk.py
nossas/bonde-zendesk
0
156395
<reponame>nossas/bonde-zendesk<filename>tapioca_zendesk/tapioca_zendesk.py # coding: utf-8 from tapioca import ( TapiocaAdapter, generate_wrapper_from_adapter, JSONAdapterMixin) from .resource_mapping import RESOURCE_MAPPING import os ZENDESK_API_ROOT = os.getenv('ZENDESK_API_ROOT') assert ZENDESK_API_ROOT is not None, 'ZENDESK_API_ROOT not environment.' class ZendeskClientAdapter(JSONAdapterMixin, TapiocaAdapter): api_root = ZENDESK_API_ROOT resource_mapping = RESOURCE_MAPPING def get_request_kwargs(self, api_params, *args, **kwargs): params = super(ZendeskClientAdapter, self).get_request_kwargs( api_params, *args, **kwargs) auth = (api_params.get('user') + '/token', api_params.get('password')) params['auth'] = auth return params def get_iterator_list(self, response_data): return response_data def get_iterator_next_request_kwargs(self, iterator_request_kwargs, response_data, response): pass Zendesk = generate_wrapper_from_adapter(ZendeskClientAdapter)
[ 1, 529, 276, 1112, 420, 29958, 29876, 2209, 294, 29914, 6718, 311, 29899, 29920, 355, 8488, 29966, 9507, 29958, 29873, 2754, 6400, 29918, 29920, 355, 8488, 29914, 29873, 2754, 6400, 29918, 29920, 355, 8488, 29889, 2272, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 3166, 260, 2754, 6400, 1053, 313, 13, 1678, 323, 2754, 6400, 6168, 29892, 5706, 29918, 17699, 29918, 3166, 29918, 21412, 29892, 4663, 6168, 29924, 861, 262, 29897, 13, 13, 3166, 869, 10314, 29918, 20698, 1053, 390, 2890, 22970, 4741, 29918, 1529, 18009, 4214, 13, 13, 5215, 2897, 13, 13, 29999, 1430, 2287, 16033, 29918, 8787, 29918, 21289, 353, 2897, 29889, 657, 6272, 877, 29999, 1430, 2287, 16033, 29918, 8787, 29918, 21289, 1495, 13, 13, 9294, 796, 1430, 2287, 16033, 29918, 8787, 29918, 21289, 338, 451, 6213, 29892, 525, 29999, 1430, 2287, 16033, 29918, 8787, 29918, 21289, 451, 5177, 6169, 13, 13, 1990, 796, 355, 8488, 4032, 6168, 29898, 7249, 6168, 29924, 861, 262, 29892, 323, 2754, 6400, 6168, 1125, 13, 1678, 7882, 29918, 4632, 353, 796, 1430, 2287, 16033, 29918, 8787, 29918, 21289, 13, 1678, 6503, 29918, 20698, 353, 390, 2890, 22970, 4741, 29918, 1529, 18009, 4214, 13, 13, 1678, 822, 679, 29918, 3827, 29918, 19290, 29898, 1311, 29892, 7882, 29918, 7529, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 8636, 353, 2428, 29898, 29999, 355, 8488, 4032, 6168, 29892, 1583, 467, 657, 29918, 3827, 29918, 19290, 29898, 13, 9651, 7882, 29918, 7529, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 4706, 4817, 353, 313, 2754, 29918, 7529, 29889, 657, 877, 1792, 1495, 718, 8207, 6979, 742, 7882, 29918, 7529, 29889, 657, 877, 5630, 8785, 13, 4706, 8636, 1839, 5150, 2033, 353, 4817, 13, 13, 4706, 736, 8636, 13, 13, 1678, 822, 679, 29918, 17609, 29918, 1761, 29898, 1311, 29892, 2933, 29918, 1272, 1125, 13, 4706, 736, 2933, 29918, 1272, 13, 13, 1678, 822, 679, 29918, 17609, 29918, 4622, 29918, 3827, 29918, 19290, 29898, 1311, 29892, 20380, 29918, 3827, 29918, 19290, 29892, 13, 462, 462, 308, 2933, 29918, 1272, 29892, 2933, 1125, 13, 4706, 1209, 13, 13, 13, 29999, 355, 8488, 353, 5706, 29918, 17699, 29918, 3166, 29918, 21412, 29898, 29999, 355, 8488, 4032, 6168, 29897, 13, 2 ]
core/utils.py
decosterkevin/foodtrack-back
0
90001
<reponame>decosterkevin/foodtrack-back from geopy.geocoders import OpenCage from django.conf import settings from enum import Enum def get_location_from_address(address): geolocator = OpenCage(api_key=settings.OPENCAGE_API_KEY) location = geolocator.geocode(address) if location.latitude and location.longitude: return (location.latitude, location.longitude) else: return None class ChoiceEnum(Enum): @classmethod def choices(cls): return [(choice.name, choice.value) for choice in cls]
[ 1, 529, 276, 1112, 420, 29958, 7099, 15664, 446, 3845, 29914, 1181, 397, 11294, 29899, 1627, 13, 3166, 1737, 2270, 29889, 479, 542, 397, 414, 1053, 4673, 29907, 482, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 14115, 1053, 1174, 398, 13, 13, 1753, 679, 29918, 5479, 29918, 3166, 29918, 7328, 29898, 7328, 1125, 13, 1678, 1737, 324, 542, 1061, 353, 4673, 29907, 482, 29898, 2754, 29918, 1989, 29922, 11027, 29889, 4590, 1430, 5454, 1692, 29918, 8787, 29918, 10818, 29897, 13, 1678, 4423, 353, 1737, 324, 542, 1061, 29889, 24756, 401, 29898, 7328, 29897, 13, 13, 1678, 565, 4423, 29889, 5066, 4279, 322, 4423, 29889, 5426, 4279, 29901, 13, 4706, 736, 313, 5479, 29889, 5066, 4279, 29892, 4423, 29889, 5426, 4279, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 6213, 13, 13, 1990, 14542, 625, 16854, 29898, 16854, 1125, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 19995, 29898, 25932, 1125, 13, 4706, 736, 17288, 16957, 29889, 978, 29892, 7348, 29889, 1767, 29897, 363, 7348, 297, 1067, 29879, 29962, 2 ]
my-python-lab/ExponentnumApp.py
baizoukou/my-python-lab
0
75513
<filename>my-python-lab/ExponentnumApp.py<gh_stars>0 ## creat fct def raise_to_power(base_num, pow_num): ## fct take 2 input num result = 1 ## def var call result is going to store result for index in range(pow_num): ## specify for loop that loop through range of num result = result * base_num ## math is going to be store in result return result print(raise_to_power(2,3))
[ 1, 529, 9507, 29958, 1357, 29899, 4691, 29899, 8205, 29914, 1252, 3296, 1949, 2052, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 2277, 907, 271, 285, 312, 30004, 13, 30004, 13, 1753, 12020, 29918, 517, 29918, 13519, 29898, 3188, 29918, 1949, 29892, 4764, 29918, 1949, 1125, 444, 285, 312, 2125, 29871, 29906, 1881, 954, 30004, 13, 1678, 1121, 353, 29871, 29896, 444, 822, 722, 1246, 1121, 338, 2675, 304, 3787, 1121, 30004, 13, 1678, 363, 2380, 297, 3464, 29898, 12248, 29918, 1949, 1125, 444, 6084, 363, 2425, 393, 2425, 1549, 3464, 310, 954, 30004, 13, 4706, 1121, 353, 1121, 334, 2967, 29918, 1949, 444, 5844, 338, 2675, 304, 367, 3787, 297, 1121, 30004, 13, 1678, 736, 29871, 1121, 30004, 13, 2158, 29898, 22692, 29918, 517, 29918, 13519, 29898, 29906, 29892, 29941, 876, 30004, 13, 2 ]
jobs/jobs/celeryp.py
gitdaniel228/jobSearch
0
155849
<reponame>gitdaniel228/jobSearch import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jobs.settings.production') from django.conf import settings app = Celery('jobs') app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
[ 1, 529, 276, 1112, 420, 29958, 5559, 18386, 709, 29906, 29906, 29947, 29914, 9057, 7974, 13, 5215, 2897, 13, 3166, 6432, 708, 1053, 14227, 708, 13, 13, 359, 29889, 21813, 29889, 842, 4381, 877, 29928, 29967, 2190, 17080, 29918, 10490, 29911, 4214, 29903, 29918, 6720, 14849, 1307, 742, 525, 9057, 29879, 29889, 11027, 29889, 24601, 1495, 13, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 932, 353, 14227, 708, 877, 9057, 29879, 1495, 13, 13, 932, 29889, 2917, 29918, 3166, 29918, 3318, 877, 14095, 29889, 5527, 29901, 11027, 1495, 13, 932, 29889, 1300, 397, 10669, 957, 29918, 20673, 29898, 2892, 29901, 6055, 29889, 25580, 1964, 20566, 29918, 3301, 7024, 29897, 13, 2 ]
tests/__init__.py
vpv11110000/pyss
0
52769
<reponame>vpv11110000/pyss<gh_stars>0 # -*- coding: utf-8 -*- import sys import os import random import unittest sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) DIRNAME_MODULE = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))) + os.sep sys.path.append(DIRNAME_MODULE) sys.path.append(DIRNAME_MODULE + "pyss" + os.sep) from pyss import * def pyss_module_suite(): #test_files = glob.glob('test_*.py') #module_strings = [test_file[0:len(test_file)-3] for test_file in test_files] #suites = [unittest.defaultTestLoader.loadTestsFromName(test_file) for test_file in module_strings] #test_suite = unittest.TestSuite(suites) testmodules=["test_advance", "test_assemble", "test_assign", "test_enter_leave", "test_generate", "test_pyss_model", "test_queue", "test_recurrent_statistic", "test_segment", "test_split", "test_statisticalseries", "test_storage", "test_table", "test_terminate", "test_transfer", ] loader = unittest.TestLoader() suite = unittest.TestSuite() for testMopduleName in testmodules: try: # If the module defines a suite() function, call it to get the suite. mod = __import__(testMopduleName, globals(), locals(), ['suite']) suitefn = getattr(mod, 'suite') suite.addTest(suitefn()) except (ImportError, AttributeError): # else, just load all the test cases from the module. suite.addTest(unittest.defaultTestLoader.loadTestsFromName(testMopduleName)) return suite if __name__ == '__main__': suite=pyss_module_suite() unittest.TextTestRunner().run(suite)
[ 1, 529, 276, 1112, 420, 29958, 29894, 29886, 29894, 29896, 29896, 29896, 29896, 29900, 29900, 29900, 29900, 29914, 2272, 893, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 4036, 13, 5215, 443, 27958, 13, 13, 9675, 29889, 2084, 29889, 4397, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 525, 636, 29915, 4961, 13, 13, 9464, 5813, 29918, 6720, 14849, 1307, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 29898, 9675, 29889, 19218, 29961, 29900, 12622, 876, 718, 2897, 29889, 19570, 13, 9675, 29889, 2084, 29889, 4397, 29898, 9464, 5813, 29918, 6720, 14849, 1307, 29897, 13, 9675, 29889, 2084, 29889, 4397, 29898, 9464, 5813, 29918, 6720, 14849, 1307, 718, 376, 2272, 893, 29908, 718, 2897, 29889, 19570, 29897, 13, 13, 3166, 11451, 893, 1053, 334, 13, 13, 1753, 11451, 893, 29918, 5453, 29918, 13495, 7295, 13, 13, 1678, 396, 1688, 29918, 5325, 353, 13149, 29889, 23705, 877, 1688, 29918, 10521, 2272, 1495, 13, 1678, 396, 5453, 29918, 19651, 353, 518, 1688, 29918, 1445, 29961, 29900, 29901, 2435, 29898, 1688, 29918, 1445, 6817, 29941, 29962, 363, 1243, 29918, 1445, 297, 1243, 29918, 5325, 29962, 13, 1678, 396, 2146, 3246, 353, 518, 348, 27958, 29889, 4381, 3057, 10036, 29889, 1359, 24376, 4591, 1170, 29898, 1688, 29918, 1445, 29897, 363, 1243, 29918, 1445, 297, 3883, 29918, 19651, 29962, 13, 1678, 396, 1688, 29918, 13495, 353, 443, 27958, 29889, 3057, 5091, 568, 29898, 2146, 3246, 29897, 13, 13, 1678, 1243, 7576, 29922, 3366, 1688, 29918, 17263, 749, 613, 29871, 13, 462, 376, 1688, 29918, 465, 6967, 613, 29871, 13, 462, 376, 1688, 29918, 16645, 613, 13, 462, 376, 1688, 29918, 5893, 29918, 280, 1351, 613, 29871, 13, 462, 376, 1688, 29918, 17158, 613, 13, 462, 376, 1688, 29918, 2272, 893, 29918, 4299, 613, 13, 462, 376, 1688, 29918, 9990, 613, 29871, 13, 462, 376, 1688, 29918, 3757, 1264, 29918, 6112, 4695, 613, 13, 462, 376, 1688, 29918, 28192, 613, 29871, 13, 462, 376, 1688, 29918, 5451, 613, 13, 462, 376, 1688, 29918, 6112, 391, 936, 13757, 613, 13, 462, 376, 1688, 29918, 12925, 613, 29871, 13, 462, 376, 1688, 29918, 2371, 613, 13, 462, 376, 1688, 29918, 18821, 403, 613, 13, 462, 376, 1688, 29918, 3286, 571, 613, 13, 462, 4514, 13, 13, 1678, 23466, 353, 443, 27958, 29889, 3057, 10036, 580, 13, 1678, 9460, 353, 443, 27958, 29889, 3057, 5091, 568, 580, 13, 13, 1678, 363, 1243, 29924, 459, 700, 280, 1170, 297, 1243, 7576, 29901, 13, 4706, 1018, 29901, 13, 9651, 396, 960, 278, 3883, 17645, 263, 9460, 580, 740, 29892, 1246, 372, 304, 679, 278, 9460, 29889, 13, 9651, 878, 353, 4770, 5215, 12035, 1688, 29924, 459, 700, 280, 1170, 29892, 13149, 1338, 3285, 1180, 1338, 3285, 6024, 13495, 11287, 13, 9651, 9460, 9144, 353, 679, 5552, 29898, 1545, 29892, 525, 13495, 1495, 13, 9651, 9460, 29889, 1202, 3057, 29898, 13495, 9144, 3101, 13, 4706, 5174, 313, 17518, 2392, 29892, 23833, 2392, 1125, 13, 9651, 396, 1683, 29892, 925, 2254, 599, 278, 1243, 4251, 515, 278, 3883, 29889, 13, 9651, 9460, 29889, 1202, 3057, 29898, 348, 27958, 29889, 4381, 3057, 10036, 29889, 1359, 24376, 4591, 1170, 29898, 1688, 29924, 459, 700, 280, 1170, 876, 13, 1678, 736, 9460, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 9460, 29922, 2272, 893, 29918, 5453, 29918, 13495, 580, 13, 1678, 443, 27958, 29889, 1626, 3057, 16802, 2141, 3389, 29898, 13495, 29897, 13, 13, 13, 2 ]
neural_lambda_calculus/__init__.py
brandontrabucco/neural_lambda_calculus
0
150893
"""Author: <NAME>, <NAME>, Copyright 2019"""
[ 1, 9995, 13720, 29901, 529, 5813, 10202, 529, 5813, 10202, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 15945, 29908, 2 ]
caf_verilog/cpx_multiply.py
chiranthsiddappa/caf_verilog
1
140423
from .quantizer import quantize from .io_helper import write_quantized_output from numpy import floor import os from jinja2 import Environment, FileSystemLoader from shutil import copy from .caf_verilog_base import CafVerilogBase class CpxMultiply(CafVerilogBase): def __init__(self, x, y, x_i_bits=12, x_q_bits=0, y_i_bits=12, y_q_bits=0, output_dir='.'): """ :param x: :param y: :param x_i_bits: Bit length for real values :param x_q_bits: Bit length for imaginary values :param y_i_bits: Bit length for real values :param y_q_bits: Bit length for imaginary values :param output_dir: Directory to place modules and test files """ self.x = x self.y = y self.cpx_input_length_check() self.x_i_bits = x_i_bits self.x_q_bits = x_q_bits if x_q_bits else self.x_i_bits self.y_i_bits = y_i_bits self.y_q_bits = y_q_bits if y_q_bits else self.y_i_bits self.x_quant = quantize(self.x, self.x_i_bits, self.x_q_bits) self.y_quant = quantize(self.y, self.y_i_bits, self.y_q_bits) self.output_dir = output_dir self.tb_filename = 'cpx_multiply_tb.v' self.test_value_filename = 'cpx_multiply_input_values.txt' self.test_output_filename = 'cpx_multiply_output_values.txt' copy(self.module_path(), self.output_dir) def gen_tb(self): """ Generate a test bench using quantized values. :return: """ write_quantized_output(self.output_dir, self.test_value_filename, self.x_quant, self.y_quant) self.write_cpx_multiply_tb_module() def gen_quantized_output(self): """ Perform the multiplication and then quantize to the closest representation of what the verilog module should produce for the given bit length. :return: """ """ x y (x + yi)(u + vi) = (xu - yv) + (xv + yu)i """ xu = floor(self.x_quant.real) * floor(self.y_quant.real) yv = floor(self.x_quant.imag) * floor(self.y_quant.imag) xv = floor(self.x_quant.real) * floor(self.y_quant.imag) yu = floor(self.x_quant.imag) * floor(self.y_quant.real) i_sub = xu - yv y_add = xv + yu final_out = i_sub + y_add*1j return final_out def write_cpx_multiply_tb_module(self): """ Write out a testbench file to test the cpx_multiply module. :return: """ out_tb = None t_dict = self.template_dict("cpx_multiply_tb") template_loader = FileSystemLoader(searchpath=self.tb_module_path()) env = Environment(loader=template_loader) template = env.get_template('cpx_multiply_tb.v') out_tb = template.render(**t_dict) with open(os.path.join(self.output_dir, self.tb_filename), 'w+') as tb_file: tb_file.write(out_tb) def template_dict(self, inst_name=None): t_dict = {'xi_bits': self.x_i_bits, 'xq_bits': self.x_q_bits, 'yi_bits': self.y_i_bits, 'yq_bits': self.y_q_bits} t_dict['i_out_bits'] = self.x_i_bits + self.y_i_bits t_dict['q_out_bits'] = self.x_q_bits + self.y_q_bits t_dict['cpx_multiply_input'] = os.path.abspath(os.path.join(self.output_dir, self.test_value_filename)) t_dict['cpx_multiply_output'] = os.path.abspath(os.path.join(self.output_dir, self.test_output_filename)) t_dict['cpx_multiply_name'] = inst_name if inst_name else 'cpx_multiply_tb' return t_dict
[ 1, 515, 869, 12150, 3950, 1053, 4323, 675, 13, 3166, 869, 601, 29918, 20907, 1053, 2436, 29918, 12150, 1891, 29918, 4905, 13, 3166, 12655, 1053, 11904, 13, 5215, 2897, 13, 3166, 432, 262, 1764, 29906, 1053, 16738, 29892, 3497, 3924, 10036, 13, 3166, 528, 4422, 1053, 3509, 13, 3166, 869, 1113, 29888, 29918, 369, 26140, 29918, 3188, 1053, 315, 2142, 6565, 26140, 5160, 13, 13, 13, 1990, 315, 1756, 6857, 666, 368, 29898, 29907, 2142, 6565, 26140, 5160, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 921, 29892, 343, 29892, 921, 29918, 29875, 29918, 14836, 29922, 29896, 29906, 29892, 921, 29918, 29939, 29918, 14836, 29922, 29900, 29892, 343, 29918, 29875, 29918, 14836, 29922, 29896, 29906, 29892, 343, 29918, 29939, 29918, 14836, 29922, 29900, 29892, 1962, 29918, 3972, 2433, 6169, 1125, 13, 4706, 9995, 13, 13, 4706, 584, 3207, 921, 29901, 13, 4706, 584, 3207, 343, 29901, 13, 4706, 584, 3207, 921, 29918, 29875, 29918, 14836, 29901, 18531, 3309, 363, 1855, 1819, 13, 4706, 584, 3207, 921, 29918, 29939, 29918, 14836, 29901, 18531, 3309, 363, 6382, 3821, 1819, 13, 4706, 584, 3207, 343, 29918, 29875, 29918, 14836, 29901, 18531, 3309, 363, 1855, 1819, 13, 4706, 584, 3207, 343, 29918, 29939, 29918, 14836, 29901, 18531, 3309, 363, 6382, 3821, 1819, 13, 4706, 584, 3207, 1962, 29918, 3972, 29901, 18862, 304, 2058, 10585, 322, 1243, 2066, 13, 4706, 9995, 13, 4706, 1583, 29889, 29916, 353, 921, 13, 4706, 1583, 29889, 29891, 353, 343, 13, 4706, 1583, 29889, 29883, 1756, 29918, 2080, 29918, 2848, 29918, 3198, 580, 13, 4706, 1583, 29889, 29916, 29918, 29875, 29918, 14836, 353, 921, 29918, 29875, 29918, 14836, 13, 4706, 1583, 29889, 29916, 29918, 29939, 29918, 14836, 353, 921, 29918, 29939, 29918, 14836, 565, 921, 29918, 29939, 29918, 14836, 1683, 1583, 29889, 29916, 29918, 29875, 29918, 14836, 13, 4706, 1583, 29889, 29891, 29918, 29875, 29918, 14836, 353, 343, 29918, 29875, 29918, 14836, 13, 4706, 1583, 29889, 29891, 29918, 29939, 29918, 14836, 353, 343, 29918, 29939, 29918, 14836, 565, 343, 29918, 29939, 29918, 14836, 1683, 1583, 29889, 29891, 29918, 29875, 29918, 14836, 13, 4706, 1583, 29889, 29916, 29918, 12150, 353, 4323, 675, 29898, 1311, 29889, 29916, 29892, 1583, 29889, 29916, 29918, 29875, 29918, 14836, 29892, 1583, 29889, 29916, 29918, 29939, 29918, 14836, 29897, 13, 4706, 1583, 29889, 29891, 29918, 12150, 353, 4323, 675, 29898, 1311, 29889, 29891, 29892, 1583, 29889, 29891, 29918, 29875, 29918, 14836, 29892, 1583, 29889, 29891, 29918, 29939, 29918, 14836, 29897, 13, 4706, 1583, 29889, 4905, 29918, 3972, 353, 1962, 29918, 3972, 13, 4706, 1583, 29889, 22625, 29918, 9507, 353, 525, 29883, 1756, 29918, 18056, 368, 29918, 22625, 29889, 29894, 29915, 13, 4706, 1583, 29889, 1688, 29918, 1767, 29918, 9507, 353, 525, 29883, 1756, 29918, 18056, 368, 29918, 2080, 29918, 5975, 29889, 3945, 29915, 13, 4706, 1583, 29889, 1688, 29918, 4905, 29918, 9507, 353, 525, 29883, 1756, 29918, 18056, 368, 29918, 4905, 29918, 5975, 29889, 3945, 29915, 13, 4706, 3509, 29898, 1311, 29889, 5453, 29918, 2084, 3285, 1583, 29889, 4905, 29918, 3972, 29897, 13, 13, 1678, 822, 2531, 29918, 22625, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3251, 403, 263, 1243, 3856, 305, 773, 4323, 1891, 1819, 29889, 13, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 2436, 29918, 12150, 1891, 29918, 4905, 29898, 1311, 29889, 4905, 29918, 3972, 29892, 1583, 29889, 1688, 29918, 1767, 29918, 9507, 29892, 1583, 29889, 29916, 29918, 12150, 29892, 1583, 29889, 29891, 29918, 12150, 29897, 13, 4706, 1583, 29889, 3539, 29918, 29883, 1756, 29918, 18056, 368, 29918, 22625, 29918, 5453, 580, 13, 13, 1678, 822, 2531, 29918, 12150, 1891, 29918, 4905, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 27313, 278, 21666, 322, 769, 4323, 675, 304, 278, 21438, 8954, 310, 825, 278, 1147, 26140, 3883, 881, 13, 4706, 7738, 363, 278, 2183, 2586, 3309, 29889, 13, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 9995, 13, 965, 921, 539, 343, 13, 4706, 313, 29916, 718, 343, 29875, 5033, 29884, 718, 3516, 29897, 353, 313, 29916, 29884, 448, 343, 29894, 29897, 718, 313, 29916, 29894, 718, 343, 29884, 29897, 29875, 13, 4706, 9995, 13, 4706, 921, 29884, 353, 11904, 29898, 1311, 29889, 29916, 29918, 12150, 29889, 6370, 29897, 334, 11904, 29898, 1311, 29889, 29891, 29918, 12150, 29889, 6370, 29897, 13, 4706, 343, 29894, 353, 11904, 29898, 1311, 29889, 29916, 29918, 12150, 29889, 326, 351, 29897, 334, 11904, 29898, 1311, 29889, 29891, 29918, 12150, 29889, 326, 351, 29897, 13, 4706, 921, 29894, 353, 11904, 29898, 1311, 29889, 29916, 29918, 12150, 29889, 6370, 29897, 334, 11904, 29898, 1311, 29889, 29891, 29918, 12150, 29889, 326, 351, 29897, 13, 4706, 343, 29884, 353, 11904, 29898, 1311, 29889, 29916, 29918, 12150, 29889, 326, 351, 29897, 334, 11904, 29898, 1311, 29889, 29891, 29918, 12150, 29889, 6370, 29897, 13, 4706, 474, 29918, 1491, 353, 921, 29884, 448, 343, 29894, 13, 4706, 343, 29918, 1202, 353, 921, 29894, 718, 343, 29884, 13, 4706, 2186, 29918, 449, 353, 474, 29918, 1491, 718, 343, 29918, 1202, 29930, 29896, 29926, 13, 4706, 736, 2186, 29918, 449, 13, 13, 1678, 822, 2436, 29918, 29883, 1756, 29918, 18056, 368, 29918, 22625, 29918, 5453, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 14350, 714, 263, 1243, 1785, 305, 934, 304, 1243, 278, 274, 1756, 29918, 18056, 368, 3883, 29889, 13, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 714, 29918, 22625, 353, 6213, 13, 4706, 260, 29918, 8977, 353, 1583, 29889, 6886, 29918, 8977, 703, 29883, 1756, 29918, 18056, 368, 29918, 22625, 1159, 13, 4706, 4472, 29918, 12657, 353, 3497, 3924, 10036, 29898, 4478, 2084, 29922, 1311, 29889, 22625, 29918, 5453, 29918, 2084, 3101, 13, 4706, 8829, 353, 16738, 29898, 12657, 29922, 6886, 29918, 12657, 29897, 13, 4706, 4472, 353, 8829, 29889, 657, 29918, 6886, 877, 29883, 1756, 29918, 18056, 368, 29918, 22625, 29889, 29894, 1495, 13, 4706, 714, 29918, 22625, 353, 4472, 29889, 9482, 29898, 1068, 29873, 29918, 8977, 29897, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4905, 29918, 3972, 29892, 1583, 29889, 22625, 29918, 9507, 511, 525, 29893, 29974, 1495, 408, 260, 29890, 29918, 1445, 29901, 13, 9651, 260, 29890, 29918, 1445, 29889, 3539, 29898, 449, 29918, 22625, 29897, 13, 13, 1678, 822, 4472, 29918, 8977, 29898, 1311, 29892, 832, 29918, 978, 29922, 8516, 1125, 13, 4706, 260, 29918, 8977, 353, 11117, 5389, 29918, 14836, 2396, 1583, 29889, 29916, 29918, 29875, 29918, 14836, 29892, 525, 29916, 29939, 29918, 14836, 2396, 1583, 29889, 29916, 29918, 29939, 29918, 14836, 29892, 525, 25675, 29918, 14836, 2396, 1583, 29889, 29891, 29918, 29875, 29918, 14836, 29892, 13, 462, 29871, 525, 29891, 29939, 29918, 14836, 2396, 1583, 29889, 29891, 29918, 29939, 29918, 14836, 29913, 13, 4706, 260, 29918, 8977, 1839, 29875, 29918, 449, 29918, 14836, 2033, 353, 1583, 29889, 29916, 29918, 29875, 29918, 14836, 718, 1583, 29889, 29891, 29918, 29875, 29918, 14836, 13, 4706, 260, 29918, 8977, 1839, 29939, 29918, 449, 29918, 14836, 2033, 353, 1583, 29889, 29916, 29918, 29939, 29918, 14836, 718, 1583, 29889, 29891, 29918, 29939, 29918, 14836, 13, 4706, 260, 29918, 8977, 1839, 29883, 1756, 29918, 18056, 368, 29918, 2080, 2033, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4905, 29918, 3972, 29892, 1583, 29889, 1688, 29918, 1767, 29918, 9507, 876, 13, 4706, 260, 29918, 8977, 1839, 29883, 1756, 29918, 18056, 368, 29918, 4905, 2033, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4905, 29918, 3972, 29892, 1583, 29889, 1688, 29918, 4905, 29918, 9507, 876, 13, 4706, 260, 29918, 8977, 1839, 29883, 1756, 29918, 18056, 368, 29918, 978, 2033, 353, 832, 29918, 978, 565, 832, 29918, 978, 1683, 525, 29883, 1756, 29918, 18056, 368, 29918, 22625, 29915, 13, 4706, 736, 260, 29918, 8977, 13, 2 ]
user_service/user_service/api.py
Ziang-Lu/Flask-Blog
0
775
<filename>user_service/user_service/api.py # -*- coding: utf-8 -*- """ API definition module. """ from flask import Blueprint from flask_restful import Api from .resources.user import UserAuth, UserItem, UserList, UserFollow # Create an API-related blueprint api_bp = Blueprint(name='api', import_name=__name__) api = Api(api_bp) api.add_resource(UserList, '/users') api.add_resource(UserItem, '/users/<int:id>') api.add_resource(UserAuth, '/user-auth') api.add_resource( UserFollow, '/user-follow/<int:follower_id>/<followed_username>' )
[ 1, 529, 9507, 29958, 1792, 29918, 5509, 29914, 1792, 29918, 5509, 29914, 2754, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 13, 8787, 5023, 3883, 29889, 13, 15945, 29908, 13, 13, 3166, 29784, 1053, 10924, 2158, 13, 3166, 29784, 29918, 5060, 1319, 1053, 29749, 13, 13, 3166, 869, 13237, 29889, 1792, 1053, 4911, 6444, 29892, 4911, 2001, 29892, 4911, 1293, 29892, 4911, 29943, 2952, 13, 13, 29937, 6204, 385, 3450, 29899, 12817, 7254, 2158, 13, 2754, 29918, 25288, 353, 10924, 2158, 29898, 978, 2433, 2754, 742, 1053, 29918, 978, 29922, 1649, 978, 1649, 29897, 13, 13, 2754, 353, 29749, 29898, 2754, 29918, 25288, 29897, 13, 2754, 29889, 1202, 29918, 10314, 29898, 2659, 1293, 29892, 8207, 7193, 1495, 13, 2754, 29889, 1202, 29918, 10314, 29898, 2659, 2001, 29892, 8207, 7193, 29914, 29966, 524, 29901, 333, 29958, 1495, 13, 2754, 29889, 1202, 29918, 10314, 29898, 2659, 6444, 29892, 8207, 1792, 29899, 5150, 1495, 13, 2754, 29889, 1202, 29918, 10314, 29898, 13, 1678, 4911, 29943, 2952, 29892, 8207, 1792, 29899, 23031, 29914, 29966, 524, 29901, 23031, 261, 29918, 333, 20690, 29966, 23031, 287, 29918, 6786, 16299, 13, 29897, 13, 2 ]
zerojudge/a080.py
x06lan/mt
0
126070
# from _typeshed import Self import sys input_text=[] try : while True: tem=input() if tem=="": break input_text.append(tem) except: pass tree_data={} class newtree(): def __init__(self): self.tree={} self.node=1 def tree_add_text(self,mom,input): # print(input) try: index=mom[input[0]] except: index=None if index == None : mom[input[0]]={} self.node+=1 if len(input) != 1: # print(mom) self.tree_add_text(mom[input[0]],input[1::1]) else : self.tree=mom tree=newtree() tree_data={} for x in input_text: tree.tree_add_text(tree_data,x) print(tree_data) print(tree.node)
[ 1, 396, 515, 903, 8768, 17143, 1053, 21782, 13, 5215, 10876, 13, 2080, 29918, 726, 29922, 2636, 13, 2202, 584, 13, 1678, 1550, 5852, 29901, 13, 4706, 1350, 29922, 2080, 580, 13, 4706, 565, 1350, 26359, 1115, 13, 9651, 2867, 13, 4706, 1881, 29918, 726, 29889, 4397, 29898, 1356, 29897, 13, 19499, 29901, 13, 1678, 1209, 13, 8336, 29918, 1272, 3790, 29913, 13, 1990, 716, 8336, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 539, 1583, 29889, 8336, 3790, 29913, 13, 539, 1583, 29889, 3177, 29922, 29896, 13, 1678, 822, 5447, 29918, 1202, 29918, 726, 29898, 1311, 29892, 29885, 290, 29892, 2080, 1125, 13, 9651, 396, 1596, 29898, 2080, 29897, 13, 9651, 1018, 29901, 13, 18884, 2380, 29922, 29885, 290, 29961, 2080, 29961, 29900, 5262, 13, 9651, 5174, 29901, 13, 18884, 2380, 29922, 8516, 13, 9651, 565, 2380, 1275, 6213, 584, 13, 18884, 16823, 29961, 2080, 29961, 29900, 5262, 3790, 29913, 13, 18884, 1583, 29889, 3177, 23661, 29896, 13, 9651, 565, 7431, 29898, 2080, 29897, 2804, 29871, 29896, 29901, 13, 18884, 396, 1596, 29898, 29885, 290, 29897, 13, 18884, 1583, 29889, 8336, 29918, 1202, 29918, 726, 29898, 29885, 290, 29961, 2080, 29961, 29900, 20526, 2080, 29961, 29896, 1057, 29896, 2314, 13, 9651, 1683, 584, 13, 18884, 1583, 29889, 8336, 29922, 29885, 290, 13, 8336, 29922, 1482, 8336, 580, 13, 8336, 29918, 1272, 3790, 29913, 13, 1454, 921, 297, 29871, 1881, 29918, 726, 29901, 13, 1678, 5447, 29889, 8336, 29918, 1202, 29918, 726, 29898, 8336, 29918, 1272, 29892, 29916, 29897, 13, 2158, 29898, 8336, 29918, 1272, 29897, 13, 2158, 29898, 8336, 29889, 3177, 29897, 13, 13, 2 ]
instaclient/instagram/postmedia.py
pthalin/instaclient
0
37647
from typing import Optional, List, TYPE_CHECKING if TYPE_CHECKING: from instaclient.client.instaclient import InstaClient from instaclient.instagram.instaobject import InstaBaseObject class PostMedia(InstaBaseObject): def __init__(self, client:'InstaClient', id:int, type:str, viewer:str, shortcode:str, src_url:str, is_video:bool, accessibility_caption:Optional[str]=None, tagged_users:Optional[List[str]]=None, # If Media is Video has_audio:Optional[bool]=None, video_duration:Optional[float]=None, video_view_count:Optional[int]=None, **kwargs ) -> None: super().__init__(client, id, type, viewer) self.shortcode = shortcode self.src_url = src_url self.is_video = is_video self.accessibility_caption = accessibility_caption self.tagged_users = tagged_users # IF Media is Video self.has_audio = has_audio self.video_duration = video_duration self.video_view_count = video_view_count def __repr__(self) -> str: return f'PostMedia<{self.shortcode}>' def __eq__(self, o: object) -> bool: if isinstance(o, PostMedia): if o.shortcode == self.shortcode: return True return False
[ 1, 515, 19229, 1053, 28379, 29892, 2391, 29892, 323, 6959, 29918, 3210, 16658, 4214, 13, 361, 323, 6959, 29918, 3210, 16658, 4214, 29901, 13, 1678, 515, 832, 562, 1593, 29889, 4645, 29889, 2611, 562, 1593, 1053, 2799, 29874, 4032, 13, 3166, 832, 562, 1593, 29889, 2611, 14442, 29889, 2611, 29874, 3318, 1053, 2799, 29874, 5160, 2061, 13, 13, 1990, 4918, 10572, 29898, 3379, 29874, 5160, 2061, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 29871, 13, 1678, 3132, 11283, 3379, 29874, 4032, 742, 13, 1678, 1178, 29901, 524, 29892, 13, 1678, 1134, 29901, 710, 29892, 13, 1678, 6316, 556, 29901, 710, 29892, 13, 1678, 3273, 401, 29901, 710, 29892, 13, 1678, 4765, 29918, 2271, 29901, 710, 29892, 13, 1678, 338, 29918, 9641, 29901, 11227, 29892, 13, 1678, 2130, 4127, 29918, 6671, 29901, 27636, 29961, 710, 13192, 8516, 29892, 13, 1678, 4055, 3192, 29918, 7193, 29901, 27636, 29961, 1293, 29961, 710, 5262, 29922, 8516, 29892, 13, 1678, 396, 960, 8213, 338, 13987, 13, 1678, 756, 29918, 18494, 29901, 27636, 29961, 11227, 13192, 8516, 29892, 13, 1678, 4863, 29918, 19708, 29901, 27636, 29961, 7411, 13192, 8516, 29892, 13, 1678, 4863, 29918, 1493, 29918, 2798, 29901, 27636, 29961, 524, 13192, 8516, 29892, 13, 1678, 3579, 19290, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 2428, 2141, 1649, 2344, 12035, 4645, 29892, 1178, 29892, 1134, 29892, 6316, 556, 29897, 13, 4706, 1583, 29889, 12759, 401, 353, 3273, 401, 13, 4706, 1583, 29889, 4351, 29918, 2271, 353, 4765, 29918, 2271, 13, 4706, 1583, 29889, 275, 29918, 9641, 353, 338, 29918, 9641, 13, 4706, 1583, 29889, 5943, 4127, 29918, 6671, 353, 2130, 4127, 29918, 6671, 13, 4706, 1583, 29889, 4039, 3192, 29918, 7193, 353, 4055, 3192, 29918, 7193, 13, 4706, 396, 10762, 8213, 338, 13987, 13, 4706, 1583, 29889, 5349, 29918, 18494, 353, 756, 29918, 18494, 13, 4706, 1583, 29889, 9641, 29918, 19708, 353, 4863, 29918, 19708, 13, 4706, 1583, 29889, 9641, 29918, 1493, 29918, 2798, 353, 4863, 29918, 1493, 29918, 2798, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 285, 29915, 6747, 10572, 29966, 29912, 1311, 29889, 12759, 401, 29913, 16299, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 288, 29901, 1203, 29897, 1599, 6120, 29901, 13, 4706, 565, 338, 8758, 29898, 29877, 29892, 4918, 10572, 1125, 13, 9651, 565, 288, 29889, 12759, 401, 1275, 1583, 29889, 12759, 401, 29901, 13, 18884, 736, 5852, 13, 4706, 736, 7700, 2 ]
fiware_cloto/cloto/tests/acceptance/commons/configuration.py
telefonicaid/fiware-cloto
2
112281
<reponame>telefonicaid/fiware-cloto<gh_stars>1-10 #!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright 2014 Telefónica Investigación y Desarrollo, S.A.U # # This file is part of FI-WARE project. # # 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. # # For those usages not covered by the Apache version 2.0 License please # contact with <EMAIL> # __author__ = 'arobres' REST_PATH = '../../../../manage.py' POLICY_MANAGER_IP = 'fiwarecloto' POLICY_MANAGER_PORT = 8000 FACTS_IP = 'fiwarecloto' FACTS_PORT = 5000 RABBIT_IP = 'rabbitmq' AUTH_TOKEN_OLD = '' KEYSTONE_URL = '' TENANT_ID = '' TENANT_NAME = '' USER = '' PASSWORD = '' CONTENT_TYPE = 'application/json' HEADERS = {'content-type': CONTENT_TYPE, 'X-Auth-Token': ''} DB_PATH = '../../../../cloto.db' MOCK_IP = u'127.0.0.1' MOCK_PORT = 8080 MOCK_PATH = u'commons/server_mock.py'
[ 1, 529, 276, 1112, 420, 29958, 15494, 18753, 983, 333, 29914, 7241, 2519, 29899, 695, 3747, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 8025, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29946, 9699, 29888, 26316, 28246, 2709, 343, 2726, 279, 20426, 29892, 317, 29889, 29909, 29889, 29965, 13, 29937, 13, 29937, 910, 934, 338, 760, 310, 9338, 29899, 12982, 1525, 2060, 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, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 29901, 13, 29937, 13, 29937, 4706, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 13, 29937, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 29937, 1152, 1906, 502, 1179, 451, 10664, 491, 278, 13380, 1873, 29871, 29906, 29889, 29900, 19245, 3113, 13, 29937, 6958, 411, 529, 26862, 6227, 29958, 13, 29937, 13, 1649, 8921, 1649, 353, 525, 279, 711, 690, 29915, 13, 13, 13, 1525, 1254, 29918, 10145, 353, 525, 21546, 21546, 1171, 482, 29889, 2272, 29915, 13, 29925, 5607, 2965, 29979, 29918, 1529, 3521, 17070, 29918, 5690, 353, 525, 7241, 2519, 695, 3747, 29915, 13, 29925, 5607, 2965, 29979, 29918, 1529, 3521, 17070, 29918, 15082, 353, 29871, 29947, 29900, 29900, 29900, 13, 4519, 1783, 29903, 29918, 5690, 353, 525, 7241, 2519, 695, 3747, 29915, 13, 4519, 1783, 29903, 29918, 15082, 353, 29871, 29945, 29900, 29900, 29900, 13, 29934, 2882, 22698, 29918, 5690, 353, 525, 336, 1327, 277, 28466, 29915, 13, 13, 20656, 29950, 29918, 4986, 29968, 1430, 29918, 5607, 29928, 353, 6629, 13, 10818, 1254, 12413, 29918, 4219, 353, 6629, 13, 29911, 1430, 13566, 29918, 1367, 353, 6629, 13, 29911, 1430, 13566, 29918, 5813, 353, 6629, 13, 11889, 353, 6629, 13, 25711, 17013, 353, 6629, 13, 22412, 3919, 29918, 11116, 353, 525, 6214, 29914, 3126, 29915, 13, 23252, 23598, 353, 11117, 3051, 29899, 1853, 2396, 8707, 29911, 3919, 29918, 11116, 29892, 525, 29990, 29899, 6444, 29899, 6066, 2396, 6629, 29913, 13, 4051, 29918, 10145, 353, 525, 21546, 21546, 695, 3747, 29889, 2585, 29915, 13, 6720, 7077, 29918, 5690, 353, 318, 29915, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29915, 13, 6720, 7077, 29918, 15082, 353, 29871, 29947, 29900, 29947, 29900, 13, 6720, 7077, 29918, 10145, 353, 318, 29915, 22382, 29914, 2974, 29918, 17640, 29889, 2272, 29915, 13, 2 ]
test_ensemble.py
Sette/CoNAS
0
190425
<reponame>Sette/CoNAS<filename>test_ensemble.py # -*- coding: utf-8 -*- """test_ensemble.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1Y0wUtSeRwwUQm2tJneNIcHT_C_cxRJiY """ path_logits_darts = "cnn/" path_logits1 = "cnn_space1/" path_logits2 = "cnn_space2/" path_logits3 = "cnn_space3" import pickle import os import sys import glob import json import numpy as np import torch import utils import logging import argparse import pickle import time import torch.nn as nn import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable import torchvision import torchvision.transforms as transforms save = path_logits+'/test-{}-{}'.format("ENS", time.strftime("%Y%m%d-%H%M%S")) utils.create_exp_dir(save, scripts_to_save=glob.glob('*.py')) log_format = '%(asctime)s %(message)s' logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=log_format, datefmt='%m/%d %I:%M:%S %p') fh = logging.FileHandler(os.path.join(save, 'log.txt')) fh.setFormatter(logging.Formatter(log_format)) logging.getLogger().addHandler(fh) class Cutout(object): def __init__(self, length): self.length = length def __call__(self, img): h, w = img.size(1), img.size(2) mask = np.ones((h, w), np.float32) y = np.random.randint(h) x = np.random.randint(w) y1 = np.clip(y - self.length // 2, 0, h) y2 = np.clip(y + self.length // 2, 0, h) x1 = np.clip(x - self.length // 2, 0, w) x2 = np.clip(x + self.length // 2, 0, w) mask[y1: y2, x1: x2] = 0. mask = torch.from_numpy(mask) mask = mask.expand_as(img) img *= mask return img def _data_transforms_cifar10(cutout,cutout_length): CIFAR_MEAN = [0.49139968, 0.48215827, 0.44653124] CIFAR_STD = [0.24703233, 0.24348505, 0.26158768] train_transform = transforms.Compose([ transforms.RandomCrop(32, padding=4), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize(CIFAR_MEAN, CIFAR_STD), ]) if cutout: train_transform.transforms.append(Cutout(cutout_length)) valid_transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize(CIFAR_MEAN, CIFAR_STD), ]) return train_transform, valid_transform _, test_transform = _data_transforms_cifar10(True,16) test_data = dset.CIFAR10(root="../data", train=False, download=True, transform=test_transform) test_queue = torch.utils.data.DataLoader(test_data, batch_size=96, shuffle=False, pin_memory=True, num_workers=2) targets_all = [] for step, (input, target) in enumerate(test_queue): input = Variable(input, volatile=True).cuda() targets = Variable(target, volatile=True).cuda(async=True) targets = targets.cpu().detach().numpy() targets_all.extend(targets) #print(targets) from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix import copy acc_darts_all = [] acc_1_all = [] acc_2_all = [] acc_3_all = [] acc_ensemble_all = [] for x in range(50): logits_darts = pickle.load( open( path_logits_darts + "/logits_"+str(x)+".p", "rb" ) ) print(type(logits_darts)) logits1 = pickle.load( open( path_logits1 + "/logits_"+str(x)+".p", "rb" ) ) logits2 = pickle.load( open( path_logits2 + "/logits_"+str(x)+".p", "rb" ) ) logits3 = pickle.load( open( path_logits3 + "/logits_"+str(x)+".p", "rb" ) ) logits = copy.deepcopy(logits1) for i in range(len(logits)): for j in range(len(logits[i])): logits[i][j] = logits[i][j] + logits2[i][j] + logits3[i][j] predicted_darts_all = [] for out in logits_darts: _, predicted = torch.max(out.data, 1) preds = predicted.cpu().detach().numpy() for pred in preds: predicted_darts_all.append(pred) predicted1_all = [] for out in logits1: _, predicted = torch.max(out.data, 1) preds = predicted.cpu().detach().numpy() for pred in preds: predicted1_all.append(pred) predicted2_all = [] for out in logits2: _, predicted = torch.max(out.data, 1) preds = predicted.cpu().detach().numpy() for pred in preds: predicted2_all.append(pred) predicted3_all = [] for out in logits3: _, predicted = torch.max(out.data, 1) preds = predicted.cpu().detach().numpy() for pred in preds: predicted3_all.append(pred) predicted_all = [] for out in logits: _, predicted = torch.max(out.data, 1) preds = predicted.cpu().detach().numpy() for pred in preds: predicted_all.append(pred) acc_darts_all.append(100*accuracy_score(predicted_darts_all,targets_all)) acc_1_all.append(100*accuracy_score(predicted1_all,targets_all)) acc_2_all.append(100*accuracy_score(predicted2_all,targets_all)) acc_3_all.append(100*accuracy_score(predicted3_all,targets_all)) acc_ensemble_all.append(100*accuracy_score(predicted_all,targets_all)) #prec1, prec5 = accuracy(predicted_all, target_all) logging.info('test acc space 1 epoch %d %f',x,100* accuracy_score(predicted1_all,targets_all)) logging.info('test acc space 2 epoch %d %f',x,100* accuracy_score(predicted2_all,targets_all)) logging.info('test acc space 3 epoch %d %f',x,100* accuracy_score(predicted3_all,targets_all)) logging.info('test ensemble acc epoch %d %f',x,100* accuracy_score(predicted_all,targets_all)) logging.info('test darts acc epoch %d %f',x, 100*accuracy_score(predicted_darts_all,targets_all))
[ 1, 529, 276, 1112, 420, 29958, 29903, 2353, 29914, 7967, 29940, 3289, 29966, 9507, 29958, 1688, 29918, 24031, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 1688, 29918, 24031, 29889, 666, 948, 29890, 13, 13, 28451, 19574, 5759, 491, 1530, 3717, 7606, 29889, 13, 13, 26036, 934, 338, 5982, 472, 13, 1678, 2045, 597, 1054, 370, 29889, 690, 2842, 29889, 3608, 29889, 510, 29914, 21594, 29914, 29896, 29979, 29900, 29893, 29965, 29873, 2008, 29934, 1615, 29965, 29984, 29885, 29906, 29873, 29967, 484, 12916, 29883, 3912, 29918, 29907, 29918, 18904, 29934, 29967, 29875, 29979, 13, 15945, 29908, 13, 13, 2084, 29918, 1188, 1169, 29918, 29881, 5708, 353, 376, 29883, 15755, 12975, 13, 2084, 29918, 1188, 1169, 29896, 353, 376, 29883, 15755, 29918, 3493, 29896, 12975, 13, 2084, 29918, 1188, 1169, 29906, 353, 376, 29883, 15755, 29918, 3493, 29906, 12975, 13, 2084, 29918, 1188, 1169, 29941, 353, 376, 29883, 15755, 29918, 3493, 29941, 29908, 13, 13, 5215, 5839, 280, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 13149, 13, 5215, 4390, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 3667, 29879, 13, 5215, 12183, 13, 5215, 1852, 5510, 13, 5215, 5839, 280, 13, 5215, 931, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 13239, 13, 5215, 4842, 305, 4924, 29889, 14538, 1691, 408, 270, 842, 13, 5215, 4842, 305, 29889, 1627, 1975, 29889, 29883, 566, 15755, 408, 274, 566, 15755, 13, 13, 3166, 4842, 305, 29889, 1300, 468, 3665, 1053, 28736, 13, 5215, 4842, 305, 4924, 13, 5215, 4842, 305, 4924, 29889, 9067, 29879, 408, 4327, 29879, 13, 13, 13, 7620, 353, 2224, 29918, 1188, 1169, 23097, 29914, 1688, 29899, 29912, 7402, 8875, 4286, 4830, 703, 1430, 29903, 613, 931, 29889, 710, 615, 603, 11702, 29979, 29995, 29885, 29995, 29881, 19222, 29950, 29995, 29924, 29995, 29903, 5783, 13, 13239, 29889, 3258, 29918, 4548, 29918, 3972, 29898, 7620, 29892, 12078, 29918, 517, 29918, 7620, 29922, 23705, 29889, 23705, 877, 10521, 2272, 8785, 13, 13, 1188, 29918, 4830, 353, 14210, 29898, 294, 312, 603, 29897, 29879, 1273, 29898, 4906, 29897, 29879, 29915, 13, 21027, 29889, 16121, 3991, 29898, 5461, 29922, 9675, 29889, 25393, 29892, 3233, 29922, 21027, 29889, 11690, 29892, 13, 1678, 3402, 29922, 1188, 29918, 4830, 29892, 2635, 23479, 2433, 29995, 29885, 22584, 29881, 1273, 29902, 16664, 29924, 16664, 29903, 1273, 29886, 1495, 13, 29888, 29882, 353, 12183, 29889, 2283, 4598, 29898, 359, 29889, 2084, 29889, 7122, 29898, 7620, 29892, 525, 1188, 29889, 3945, 8785, 13, 29888, 29882, 29889, 842, 18522, 29898, 21027, 29889, 18522, 29898, 1188, 29918, 4830, 876, 13, 21027, 29889, 657, 16363, 2141, 1202, 4598, 29898, 29888, 29882, 29897, 13, 13, 13, 1990, 315, 329, 449, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3309, 1125, 13, 4706, 1583, 29889, 2848, 353, 3309, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 10153, 1125, 13, 4706, 298, 29892, 281, 353, 10153, 29889, 2311, 29898, 29896, 511, 10153, 29889, 2311, 29898, 29906, 29897, 13, 4706, 11105, 353, 7442, 29889, 2873, 3552, 29882, 29892, 281, 511, 7442, 29889, 7411, 29941, 29906, 29897, 13, 4706, 343, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29882, 29897, 13, 4706, 921, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29893, 29897, 13, 13, 4706, 343, 29896, 353, 7442, 29889, 24049, 29898, 29891, 448, 1583, 29889, 2848, 849, 29871, 29906, 29892, 29871, 29900, 29892, 298, 29897, 13, 4706, 343, 29906, 353, 7442, 29889, 24049, 29898, 29891, 718, 1583, 29889, 2848, 849, 29871, 29906, 29892, 29871, 29900, 29892, 298, 29897, 13, 4706, 921, 29896, 353, 7442, 29889, 24049, 29898, 29916, 448, 1583, 29889, 2848, 849, 29871, 29906, 29892, 29871, 29900, 29892, 281, 29897, 13, 4706, 921, 29906, 353, 7442, 29889, 24049, 29898, 29916, 718, 1583, 29889, 2848, 849, 29871, 29906, 29892, 29871, 29900, 29892, 281, 29897, 13, 13, 4706, 11105, 29961, 29891, 29896, 29901, 343, 29906, 29892, 921, 29896, 29901, 921, 29906, 29962, 353, 29871, 29900, 29889, 13, 4706, 11105, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 13168, 29897, 13, 4706, 11105, 353, 11105, 29889, 18837, 29918, 294, 29898, 2492, 29897, 13, 4706, 10153, 334, 29922, 11105, 13, 4706, 736, 10153, 13, 13, 13, 1753, 903, 1272, 29918, 9067, 29879, 29918, 29883, 361, 279, 29896, 29900, 29898, 7582, 449, 29892, 7582, 449, 29918, 2848, 1125, 13, 29871, 315, 6545, 1718, 29918, 2303, 2190, 353, 518, 29900, 29889, 29946, 29929, 29896, 29941, 29929, 29929, 29953, 29947, 29892, 29871, 29900, 29889, 29946, 29947, 29906, 29896, 29945, 29947, 29906, 29955, 29892, 29871, 29900, 29889, 29946, 29946, 29953, 29945, 29941, 29896, 29906, 29946, 29962, 13, 29871, 315, 6545, 1718, 29918, 1254, 29928, 353, 518, 29900, 29889, 29906, 29946, 29955, 29900, 29941, 29906, 29941, 29941, 29892, 29871, 29900, 29889, 29906, 29946, 29941, 29946, 29947, 29945, 29900, 29945, 29892, 29871, 29900, 29889, 29906, 29953, 29896, 29945, 29947, 29955, 29953, 29947, 29962, 13, 13, 29871, 7945, 29918, 9067, 353, 4327, 29879, 29889, 1523, 4220, 4197, 13, 1678, 4327, 29879, 29889, 17875, 29907, 1336, 29898, 29941, 29906, 29892, 7164, 29922, 29946, 511, 13, 1678, 4327, 29879, 29889, 17875, 24932, 29943, 3466, 3285, 13, 1678, 4327, 29879, 29889, 1762, 29911, 6073, 3285, 13, 1678, 4327, 29879, 29889, 19077, 675, 29898, 29907, 6545, 1718, 29918, 2303, 2190, 29892, 315, 6545, 1718, 29918, 1254, 29928, 511, 13, 259, 2314, 13, 29871, 565, 5700, 449, 29901, 13, 1678, 7945, 29918, 9067, 29889, 9067, 29879, 29889, 4397, 29898, 29907, 329, 449, 29898, 7582, 449, 29918, 2848, 876, 13, 13, 29871, 2854, 29918, 9067, 353, 4327, 29879, 29889, 1523, 4220, 4197, 13, 1678, 4327, 29879, 29889, 1762, 29911, 6073, 3285, 13, 1678, 4327, 29879, 29889, 19077, 675, 29898, 29907, 6545, 1718, 29918, 2303, 2190, 29892, 315, 6545, 1718, 29918, 1254, 29928, 511, 13, 268, 2314, 13, 29871, 736, 7945, 29918, 9067, 29892, 2854, 29918, 9067, 13, 13, 3383, 1243, 29918, 9067, 353, 903, 1272, 29918, 9067, 29879, 29918, 29883, 361, 279, 29896, 29900, 29898, 5574, 29892, 29896, 29953, 29897, 13, 13, 1688, 29918, 1272, 353, 270, 842, 29889, 29907, 6545, 1718, 29896, 29900, 29898, 4632, 543, 6995, 1272, 613, 7945, 29922, 8824, 29892, 5142, 29922, 5574, 29892, 4327, 29922, 1688, 29918, 9067, 29897, 13, 13, 1688, 29918, 9990, 353, 4842, 305, 29889, 13239, 29889, 1272, 29889, 1469, 10036, 29898, 1688, 29918, 1272, 29892, 9853, 29918, 2311, 29922, 29929, 29953, 29892, 528, 21897, 29922, 8824, 29892, 12534, 29918, 14834, 29922, 5574, 29892, 954, 29918, 1287, 414, 29922, 29906, 29897, 13, 13, 5182, 29879, 29918, 497, 353, 5159, 13, 1454, 4331, 29892, 313, 2080, 29892, 3646, 29897, 297, 26985, 29898, 1688, 29918, 9990, 1125, 13, 1678, 1881, 353, 28736, 29898, 2080, 29892, 1700, 24285, 29922, 5574, 467, 29883, 6191, 580, 13, 1678, 22525, 353, 28736, 29898, 5182, 29892, 1700, 24285, 29922, 5574, 467, 29883, 6191, 29898, 12674, 29922, 5574, 29897, 13, 1678, 22525, 353, 22525, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 1678, 22525, 29918, 497, 29889, 21843, 29898, 5182, 29879, 29897, 13, 268, 13, 13, 29937, 2158, 29898, 5182, 29879, 29897, 13, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 13600, 29918, 13628, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 14679, 29918, 5344, 13, 5215, 3509, 13, 13, 5753, 29918, 29881, 5708, 29918, 497, 353, 5159, 13, 5753, 29918, 29896, 29918, 497, 353, 5159, 13, 5753, 29918, 29906, 29918, 497, 353, 5159, 13, 5753, 29918, 29941, 29918, 497, 353, 5159, 13, 5753, 29918, 24031, 29918, 497, 353, 5159, 13, 1454, 921, 297, 3464, 29898, 29945, 29900, 1125, 13, 29871, 1480, 1169, 29918, 29881, 5708, 353, 5839, 280, 29889, 1359, 29898, 1722, 29898, 2224, 29918, 1188, 1169, 29918, 29881, 5708, 718, 5591, 1188, 1169, 29918, 17969, 710, 29898, 29916, 7240, 1642, 29886, 613, 376, 6050, 29908, 1723, 1723, 13, 29871, 1596, 29898, 1853, 29898, 1188, 1169, 29918, 29881, 5708, 876, 13, 29871, 1480, 1169, 29896, 353, 5839, 280, 29889, 1359, 29898, 1722, 29898, 2224, 29918, 1188, 1169, 29896, 718, 5591, 1188, 1169, 29918, 17969, 710, 29898, 29916, 7240, 1642, 29886, 613, 376, 6050, 29908, 1723, 1723, 13, 29871, 1480, 1169, 29906, 353, 5839, 280, 29889, 1359, 29898, 1722, 29898, 2224, 29918, 1188, 1169, 29906, 718, 5591, 1188, 1169, 29918, 17969, 710, 29898, 29916, 7240, 1642, 29886, 613, 376, 6050, 29908, 1723, 1723, 13, 29871, 1480, 1169, 29941, 353, 5839, 280, 29889, 1359, 29898, 1722, 29898, 2224, 29918, 1188, 1169, 29941, 718, 5591, 1188, 1169, 29918, 17969, 710, 29898, 29916, 7240, 1642, 29886, 613, 376, 6050, 29908, 1723, 1723, 13, 29871, 1480, 1169, 353, 3509, 29889, 24535, 8552, 29898, 1188, 1169, 29896, 29897, 13, 13, 29871, 363, 474, 297, 3464, 29898, 2435, 29898, 1188, 1169, 22164, 13, 1678, 363, 432, 297, 3464, 29898, 2435, 29898, 1188, 1169, 29961, 29875, 12622, 29901, 13, 418, 1480, 1169, 29961, 29875, 3816, 29926, 29962, 353, 1480, 1169, 29961, 29875, 3816, 29926, 29962, 718, 1480, 1169, 29906, 29961, 29875, 3816, 29926, 29962, 718, 1480, 1169, 29941, 29961, 29875, 3816, 29926, 29962, 13, 268, 13, 1678, 25383, 29918, 29881, 5708, 29918, 497, 353, 5159, 13, 1678, 363, 714, 297, 1480, 1169, 29918, 29881, 5708, 29901, 13, 418, 17117, 25383, 353, 4842, 305, 29889, 3317, 29898, 449, 29889, 1272, 29892, 29871, 29896, 29897, 13, 418, 4450, 29879, 353, 25383, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 418, 363, 4450, 297, 4450, 29879, 29901, 13, 4706, 25383, 29918, 29881, 5708, 29918, 497, 29889, 4397, 29898, 11965, 29897, 13, 13, 13, 1678, 25383, 29896, 29918, 497, 353, 5159, 13, 1678, 363, 714, 297, 1480, 1169, 29896, 29901, 13, 418, 17117, 25383, 353, 4842, 305, 29889, 3317, 29898, 449, 29889, 1272, 29892, 29871, 29896, 29897, 13, 418, 4450, 29879, 353, 25383, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 418, 363, 4450, 297, 4450, 29879, 29901, 13, 4706, 25383, 29896, 29918, 497, 29889, 4397, 29898, 11965, 29897, 13, 13, 1678, 25383, 29906, 29918, 497, 353, 5159, 13, 1678, 363, 714, 297, 1480, 1169, 29906, 29901, 13, 418, 17117, 25383, 353, 4842, 305, 29889, 3317, 29898, 449, 29889, 1272, 29892, 29871, 29896, 29897, 13, 418, 4450, 29879, 353, 25383, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 418, 363, 4450, 297, 4450, 29879, 29901, 13, 4706, 25383, 29906, 29918, 497, 29889, 4397, 29898, 11965, 29897, 13, 13, 1678, 25383, 29941, 29918, 497, 353, 5159, 13, 1678, 363, 714, 297, 1480, 1169, 29941, 29901, 13, 418, 17117, 25383, 353, 4842, 305, 29889, 3317, 29898, 449, 29889, 1272, 29892, 29871, 29896, 29897, 13, 418, 4450, 29879, 353, 25383, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 418, 363, 4450, 297, 4450, 29879, 29901, 13, 4706, 25383, 29941, 29918, 497, 29889, 4397, 29898, 11965, 29897, 13, 13, 1678, 25383, 29918, 497, 353, 5159, 13, 1678, 363, 714, 297, 1480, 1169, 29901, 13, 418, 17117, 25383, 353, 4842, 305, 29889, 3317, 29898, 449, 29889, 1272, 29892, 29871, 29896, 29897, 13, 418, 4450, 29879, 353, 25383, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 418, 363, 4450, 297, 4450, 29879, 29901, 13, 4706, 25383, 29918, 497, 29889, 4397, 29898, 11965, 29897, 13, 13, 29871, 1035, 29918, 29881, 5708, 29918, 497, 29889, 4397, 29898, 29896, 29900, 29900, 29930, 562, 2764, 4135, 29918, 13628, 29898, 11965, 18186, 29918, 29881, 5708, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 1035, 29918, 29896, 29918, 497, 29889, 4397, 29898, 29896, 29900, 29900, 29930, 562, 2764, 4135, 29918, 13628, 29898, 11965, 18186, 29896, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 1035, 29918, 29906, 29918, 497, 29889, 4397, 29898, 29896, 29900, 29900, 29930, 562, 2764, 4135, 29918, 13628, 29898, 11965, 18186, 29906, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 1035, 29918, 29941, 29918, 497, 29889, 4397, 29898, 29896, 29900, 29900, 29930, 562, 2764, 4135, 29918, 13628, 29898, 11965, 18186, 29941, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 1035, 29918, 24031, 29918, 497, 29889, 4397, 29898, 29896, 29900, 29900, 29930, 562, 2764, 4135, 29918, 13628, 29898, 11965, 18186, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 1678, 396, 17990, 29896, 29892, 8303, 29945, 353, 13600, 29898, 11965, 18186, 29918, 497, 29892, 3646, 29918, 497, 29897, 13, 29871, 12183, 29889, 3888, 877, 1688, 1035, 2913, 29871, 29896, 21502, 305, 1273, 29881, 1273, 29888, 742, 29916, 29892, 29896, 29900, 29900, 29930, 13600, 29918, 13628, 29898, 11965, 18186, 29896, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 12183, 29889, 3888, 877, 1688, 1035, 2913, 29871, 29906, 21502, 305, 1273, 29881, 1273, 29888, 742, 29916, 29892, 29896, 29900, 29900, 29930, 13600, 29918, 13628, 29898, 11965, 18186, 29906, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 12183, 29889, 3888, 877, 1688, 1035, 2913, 29871, 29941, 21502, 305, 1273, 29881, 1273, 29888, 742, 29916, 29892, 29896, 29900, 29900, 29930, 13600, 29918, 13628, 29898, 11965, 18186, 29941, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 12183, 29889, 3888, 877, 1688, 21285, 1035, 21502, 305, 1273, 29881, 1273, 29888, 742, 29916, 29892, 29896, 29900, 29900, 29930, 13600, 29918, 13628, 29898, 11965, 18186, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 29871, 12183, 29889, 3888, 877, 1688, 270, 5708, 1035, 21502, 305, 1273, 29881, 1273, 29888, 742, 29916, 29892, 29871, 29896, 29900, 29900, 29930, 562, 2764, 4135, 29918, 13628, 29898, 11965, 18186, 29918, 29881, 5708, 29918, 497, 29892, 5182, 29879, 29918, 497, 876, 13, 2 ]
morphablegraphs/motion_generator/graph_walk.py
dfki-asr/morphablegraphs
5
125464
#!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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. """ Created on Tue Jul 14 18:39:41 2015 @author: <NAME> """ from datetime import datetime import collections import json import numpy as np from anim_utils.animation_data import MotionVector, align_quaternion_frames from anim_utils.animation_data.motion_concatenation import align_and_concatenate_frames from anim_utils.utilities.log import write_log, write_message_to_log, LOG_MODE_DEBUG, LOG_MODE_INFO, LOG_MODE_ERROR from .annotated_motion_vector import AnnotatedMotionVector from ..constraints.spatial_constraints import SPATIAL_CONSTRAINT_TYPE_KEYFRAME_POSITION, SPATIAL_CONSTRAINT_TYPE_TWO_HAND_POSITION from .keyframe_event_list import KeyframeEventList from ..constraints.spatial_constraints.splines.utils import plot_annotated_spline DEFAULT_PLACE_ACTION_LIST = ["placeRight", "placeLeft","insertRight","insertLeft","screwRight", "screwLeft"] #list of actions in which the orientation constraints are ignored class GraphWalkEntry(object): def __init__(self, motion_state_graph, node_key, parameters, arc_length, start_frame, end_frame, motion_primitive_constraints=None): self.node_key = node_key self.parameters = parameters self.arc_length = arc_length self.start_frame = start_frame self.end_frame = end_frame self.motion_primitive_constraints = motion_primitive_constraints self.n_spatial_components = motion_state_graph.nodes[node_key].get_n_spatial_components() self.n_time_components = motion_state_graph.nodes[node_key].get_n_time_components() @staticmethod def from_json(motion_state_graph, data): return GraphWalkEntry(motion_state_graph, tuple(data["node_key"]), np.array(data["parameters"]), data["arc_length"], data["start_frame"], data["end_frame"]) def to_json(self): data = dict() data["node_key"] =self.node_key data["parameters"] = self.parameters.tolist() data["arc_length"] = self.arc_length data["start_frame"] = self.start_frame data["end_frame"] = self.end_frame return data class HighLevelGraphWalkEntry(object): def __init__(self, action_name, start_step, end_step, action_constraints): self.action_name = action_name self.start_step = start_step self.end_step = end_step self.action_constraints = action_constraints class GraphWalk(object): """ Product of the MotionGenerate class. Contains the graph walk used to generate the frames, a mapping of frame segments to elementary actions and a list of events for certain frames. """ def __init__(self, motion_state_graph, mg_input, algorithm_config, start_pose=None, create_ca_vis_data=False): self.elementary_action_list = [] self.steps = [] self.motion_state_graph = motion_state_graph self.step_count = 0 self.mg_input = mg_input self._algorithm_config = algorithm_config self.motion_vector = MotionVector(self.motion_state_graph.skeleton, algorithm_config) if start_pose is None: start_pose = mg_input.get_start_pose() self.motion_vector.start_pose = start_pose smoothing_settings = algorithm_config["smoothing_settings"] self.spatial_smoothing_method = "smoothing" self.apply_smoothing = smoothing_settings["spatial_smoothing"] # set whether the exported motion is smoothed at transitions if "spatial_smoothing_method" in smoothing_settings: self.spatial_smoothing_method = smoothing_settings["spatial_smoothing_method"] self.motion_vector.apply_spatial_smoothing = False # deactivate smoothing during the synthesis self.use_time_parameters = algorithm_config["activate_time_variation"] self.constrain_place_orientation = algorithm_config["inverse_kinematics_settings"]["constrain_place_orientation"] write_message_to_log("Use time parameters" + str(self.use_time_parameters), LOG_MODE_DEBUG) self.keyframe_event_list = KeyframeEventList(create_ca_vis_data) self.place_action_list = DEFAULT_PLACE_ACTION_LIST def add_entry_to_action_list(self, action_name, start_step, end_step, action_constraints): self.elementary_action_list.append(HighLevelGraphWalkEntry(action_name, start_step, end_step, action_constraints)) def convert_to_annotated_motion(self, step_size=1.0): self.motion_vector.apply_spatial_smoothing = self.apply_smoothing # set wether or not smoothing is applied self.motion_vector.spatial_smoothing_method = self.spatial_smoothing_method self.convert_graph_walk_to_quaternion_frames(use_time_parameters=self.use_time_parameters, step_size=step_size) self.keyframe_event_list.update_events(self, 0) annotated_motion_vector = AnnotatedMotionVector(self.motion_state_graph.skeleton, self._algorithm_config) annotated_motion_vector.frames = self.motion_vector.frames annotated_motion_vector.n_frames = self.motion_vector.n_frames annotated_motion_vector.frame_time = self.motion_state_graph.skeleton.frame_time annotated_motion_vector.keyframe_event_list = self.keyframe_event_list annotated_motion_vector.skeleton = self.motion_state_graph.skeleton annotated_motion_vector.mg_input = self.mg_input version = 0 if "version" in self._algorithm_config["inverse_kinematics_settings"]: version = self._algorithm_config["inverse_kinematics_settings"]["version"] if version == 1: annotated_motion_vector.ik_constraints = self._create_ik_constraints() elif version == 2: annotated_motion_vector.ik_constraints = self._create_ik_constraints2() annotated_motion_vector.graph_walk = self return annotated_motion_vector def get_action_from_keyframe(self, keyframe): found_action_index = -1 step_index = self.get_step_from_keyframe(keyframe) write_message_to_log("Found keyframe in step " + str(step_index), LOG_MODE_DEBUG) if step_index < 0: return found_action_index for action_index, action in enumerate(self.elementary_action_list): if action.start_step <= step_index <= action.end_step: found_action_index = action_index return found_action_index def get_step_from_keyframe(self, keyframe): found_step_index = -1 for step_index, step in enumerate(self.steps): #Note the start_frame and end_frame are warped in update_temp_motion_vector #print step.start_frame, keyframe, step.end_frame if step.start_frame <= keyframe <= step.end_frame: found_step_index = step_index return found_step_index def convert_graph_walk_to_quaternion_frames(self, start_step=0, use_time_parameters=False, step_size=1.0): """ :param start_step: :return: """ if start_step == 0: start_frame = 0 else: start_frame = self.steps[start_step].start_frame self.motion_vector.clear(end_frame=start_frame) for step in self.steps[start_step:]: step.start_frame = start_frame #write_log(step.node_key, len(step.parameters)) quat_frames = self.motion_state_graph.nodes[step.node_key].back_project(step.parameters, use_time_parameters, step_size).get_motion_vector() if step.node_key[1].lower().endswith("leftstance"): foot_joint = "foot_r" elif step.node_key[1].lower().endswith("rightstance"): foot_joint = "foot_l" else: foot_joint = None self.motion_vector.append_frames(quat_frames, foot_joint) step.end_frame = self.get_num_of_frames()-1 start_frame = step.end_frame + 1 def get_global_spatial_parameter_vector(self, start_step=0): initial_guess = [] for step in self.steps[start_step:]: initial_guess += step.parameters[:step.n_spatial_components].tolist() return initial_guess def get_global_time_parameter_vector(self, start_step=0): initial_guess = [] for step in self.steps[start_step:]: initial_guess += step.parameters[step.n_spatial_components:].tolist() return initial_guess def update_spatial_parameters(self, parameter_vector, start_step=0): write_message_to_log("Update spatial parameters", LOG_MODE_DEBUG) offset = 0 for step in self.steps[start_step:]: new_alpha = parameter_vector[offset:offset+step.n_spatial_components] step.parameters[:step.n_spatial_components] = new_alpha offset += step.n_spatial_components def update_time_parameters(self, parameter_vector, start_step, end_step): offset = 0 for step in self.steps[start_step:end_step]: new_gamma = parameter_vector[offset:offset+step.n_time_components] step.parameters[step.n_spatial_components:] = new_gamma offset += step.n_time_components def append_quat_frames(self, new_frames): self.motion_vector.append_frames(new_frames) def get_quat_frames(self): return self.motion_vector.frames def get_num_of_frames(self): return self.motion_vector.n_frames def update_frame_annotation(self, action_name, start_frame, end_frame): """ Adds a dictionary to self.frame_annotation marking start and end frame of an action. """ self.keyframe_event_list.update_frame_annotation(action_name, start_frame, end_frame) def _create_ik_constraints(self): ik_constraints = [] for idx, action in enumerate(self.elementary_action_list): write_message_to_log("Create IK constraints for action" + " " + str(idx) + " " + str(action.start_step) + " " + str(self.steps[action.start_step].start_frame), LOG_MODE_DEBUG) if not self.constrain_place_orientation and action.action_name in self.place_action_list: constrain_orientation = False else: constrain_orientation = True start_step = action.start_step end_step = action.end_step elementary_action_ik_constraints = dict() elementary_action_ik_constraints["keyframes"] = dict() elementary_action_ik_constraints["trajectories"] = list() elementary_action_ik_constraints["collision_avoidance"] = list() frame_offset = self.steps[start_step].start_frame for step in self.steps[start_step: end_step+1]: time_function = None if self.use_time_parameters and self.motion_state_graph.nodes[step.node_key].get_n_time_components() > 0: time_function = self.motion_state_graph.nodes[step.node_key].back_project_time_function(step.parameters) step_keyframe_constraints = step.motion_primitive_constraints.convert_to_ik_constraints(self.motion_state_graph, frame_offset, time_function, constrain_orientation) elementary_action_ik_constraints["keyframes"].update(step_keyframe_constraints) elementary_action_ik_constraints["collision_avoidance"] += step.motion_primitive_constraints.get_ca_constraints() frame_offset += step.end_frame - step.start_frame + 1 if self._algorithm_config["collision_avoidance_constraints_mode"] == "ik": elementary_action_ik_constraints["trajectories"] += self._create_ik_trajectory_constraints_from_ca_trajectories(idx) elementary_action_ik_constraints["trajectories"] += self._create_ik_trajectory_constraints_from_annotated_trajectories(idx) ik_constraints.append(elementary_action_ik_constraints) return ik_constraints def _create_ik_constraints2(self): ik_constraints = collections.OrderedDict() for idx, action in enumerate(self.elementary_action_list): write_message_to_log("Create IK constraints for action" + " " + str(idx) + " " + str(action.start_step) + " " + str(self.steps[action.start_step].start_frame), LOG_MODE_DEBUG) if not self.constrain_place_orientation and action.action_name in self.place_action_list: constrain_orientation = False else: constrain_orientation = True start_step = action.start_step end_step = action.end_step frame_offset = self.steps[start_step].start_frame for step in self.steps[start_step: end_step + 1]: time_function = None if self.use_time_parameters and self.motion_state_graph.nodes[step.node_key].get_n_time_components() > 0: time_function = self.motion_state_graph.nodes[step.node_key].back_project_time_function(step.parameters) step_constraints = step.motion_primitive_constraints.convert_to_ik_constraints( self.motion_state_graph, frame_offset, time_function, constrain_orientation, version=2) ik_constraints.update(step_constraints) frame_offset += step.end_frame - step.start_frame + 1 return ik_constraints def _create_ik_trajectory_constraints_from_ca_trajectories(self, action_idx): frame_annotation = self.keyframe_event_list.frame_annotation['elementaryActionSequence'][action_idx] trajectory_constraints = list() action = self.elementary_action_list[action_idx] for ca_constraint in action.action_constraints.collision_avoidance_constraints: traj_constraint = dict() traj_constraint["trajectory"] = ca_constraint traj_constraint["fixed_range"] = False # search for closer start traj_constraint["constrain_orientation"] = False traj_constraint["start_frame"] = frame_annotation["startFrame"] traj_constraint["end_frame"] = frame_annotation["endFrame"] #TODO find a better solution than this workaround that undoes the joint name mapping from hands to tool bones for ca constraints if self.mg_input.activate_joint_mapping and ca_constraint.joint_name in list(self.mg_input.inverse_joint_name_map.keys()): joint_name = self.mg_input.inverse_joint_name_map[ca_constraint.joint_name] else: joint_name = ca_constraint.joint_name traj_constraint["joint_name"] = joint_name traj_constraint["delta"] = 1.0 trajectory_constraints.append(traj_constraint) return trajectory_constraints def _create_ik_trajectory_constraints_from_annotated_trajectories(self, action_idx): write_message_to_log("extract annotated trajectories", LOG_MODE_DEBUG) frame_annotation = self.keyframe_event_list.frame_annotation['elementaryActionSequence'][action_idx] start_frame = frame_annotation["startFrame"] trajectory_constraints = list() action = self.elementary_action_list[action_idx] for constraint in action.action_constraints.annotated_trajectory_constraints: label = list(constraint.semantic_annotation.keys())[0] write_message_to_log("trajectory constraint label " + str(list(constraint.semantic_annotation.keys())), LOG_MODE_DEBUG) action_name = action.action_name for step in self.steps[action.start_step: action.end_step+1]: motion_primitive_name = step.node_key[1] write_message_to_log("look for action annotation of " + action_name+" "+motion_primitive_name, LOG_MODE_DEBUG) if motion_primitive_name not in self.motion_state_graph.node_groups[action_name].motion_primitive_annotation_regions: continue annotations = self.motion_state_graph.node_groups[action_name].motion_primitive_annotation_regions[motion_primitive_name] write_message_to_log("action annotation" + str(annotations) +" "+ str(frame_annotation["startFrame"]) + " " + str(frame_annotation["endFrame"]), LOG_MODE_DEBUG) if label not in list(annotations.keys()): continue annotation_range = annotations[label] traj_constraint = dict() traj_constraint["trajectory"] = constraint traj_constraint["constrain_orientation"] = True traj_constraint["fixed_range"] = True time_function = None if self.use_time_parameters and self.motion_state_graph.nodes[step.node_key].get_n_time_components() > 0: time_function = self.motion_state_graph.nodes[step.node_key].back_project_time_function(step.parameters) if time_function is None: traj_constraint["start_frame"] = start_frame + annotation_range[0] traj_constraint["end_frame"] = start_frame + annotation_range[1] else: #add +1 for correct mapping TODO verify for all cases traj_constraint["start_frame"] = start_frame + int(time_function[annotation_range[0]]) + 1 traj_constraint["end_frame"] = start_frame + int(time_function[annotation_range[1]]) + 1 if self.mg_input.activate_joint_mapping and constraint.joint_name in list(self.mg_input.inverse_joint_name_map.keys()): joint_name = self.mg_input.inverse_joint_name_map[constraint.joint_name] else: joint_name = constraint.joint_name traj_constraint["joint_name"] = joint_name traj_constraint["delta"] = 1.0 write_message_to_log( "create ik trajectory constraint from label " + str(label), LOG_MODE_DEBUG) trajectory_constraints.append(traj_constraint) return trajectory_constraints def get_average_keyframe_constraint_error(self): keyframe_constraint_errors = [] step_index = 0 prev_frames = None for step_idx, step in enumerate(self.steps): quat_frames = self.motion_state_graph.nodes[step.node_key].back_project(step.parameters, use_time_parameters=False).get_motion_vector() skeleton = self.motion_vector.skeleton aligned_frames = align_and_concatenate_frames(skeleton, skeleton.aligning_root_node, quat_frames, prev_frames, self.motion_vector.start_pose, 0) for c_idx, constraint in enumerate(step.motion_primitive_constraints.constraints): if constraint.constraint_type in [SPATIAL_CONSTRAINT_TYPE_KEYFRAME_POSITION, SPATIAL_CONSTRAINT_TYPE_TWO_HAND_POSITION] and\ not "generated" in list(constraint.semantic_annotation.keys()): error = constraint.evaluate_motion_sample(aligned_frames) write_message_to_log("Error of Keyframe constraint " +str(step_idx) + "-" + str(c_idx) +": " +str(error), LOG_MODE_DEBUG) keyframe_constraint_errors.append(error) prev_frames = aligned_frames step_index += 1 if len(keyframe_constraint_errors) > 0: return np.average(keyframe_constraint_errors) else: return -1 def get_generated_constraints(self): step_count = 0 generated_constraints = dict() for step in self.steps: key = str(step.node_key) + str(step_count) generated_constraints[key] = [] for constraint in step.motion_primitive_constraints.constraints: if constraint.is_generated(): generated_constraints[key].append(constraint.position) step_count += 1 return generated_constraints def get_average_error(self): average_error = 0 for step in self.steps: average_error += step.motion_primitive_constraints.min_error if average_error > 0: average_error /= len(self.steps) return average_error def get_number_of_object_evaluations(self): objective_evaluations = 0 for step in self.steps: objective_evaluations += step.motion_primitive_constraints.evaluations return objective_evaluations def print_statistics(self): print(self.get_statistics_string()) def get_statistics_string(self): average_error = self.get_average_error() evaluations_string = "Total number of objective evaluations " + str(self.get_number_of_object_evaluations()) error_string = "Average error for " + str(len(self.steps)) + \ " motion primitives: " + str(average_error) average_keyframe_error = self.get_average_keyframe_constraint_error() if average_keyframe_error > -1: average_keyframe_error_string = "Average keyframe constraint error " + str(average_keyframe_error) else: average_keyframe_error_string = "No keyframe constraint specified" average_time_per_step = 0.0 for step in self.steps: average_time_per_step += step.motion_primitive_constraints.time average_time_per_step /= len(self.steps) average_time_string = "Average time per motion primitive " + str(average_time_per_step) return average_keyframe_error_string + "\n" + evaluations_string + "\n" + average_time_string + "\n" + error_string def export_generated_constraints(self, file_path="goals.path"): """ Converts constraints that were generated based on input constraints into a json dictionary for a debug visualization """ root_control_point_data = [] hand_constraint_data = [] for idx, step in enumerate(self.steps): step_constraints = {"semanticAnnotation": {"step": idx}} for c in step.motion_primitive_constraints.constraints: if c.constraint_type == "keyframe_position" and c.joint_name == self.motion_state_graph.skeleton.root: p = c.position if p is not None: step_constraints["position"] = [p[0], -p[2], None] elif c.constraint_type == "keyframe_2d_direction": step_constraints["direction"] = c.direction_constraint.tolist() elif c.constraint_type == "ca_constraint": #if c.constraint_type in ["RightHand", "LeftHand"]: position = [c.position[0], -c.position[2], c.position[1]] hand_constraint = {"position": position} hand_constraint_data.append(hand_constraint) root_control_point_data.append(step_constraints) constraints = {"tasks": [{"elementaryActions":[{ "action": "walk", "constraints": [{"joint": "Hips", "keyframeConstraints": root_control_point_data }, {"joint": "RightHand", "keyframeConstraints": hand_constraint_data}] }] }] } constraints["startPose"] = {"position":[0,0,0], "orientation": [0,0,0]} constraints["session"] = "session" with open(file_path, "wb") as out: json.dump(constraints, out) def get_number_of_actions(self): return len(self.elementary_action_list) def plot_constraints(self, file_name="traj"): for idx, action in enumerate(self.elementary_action_list): start_frame = self.steps[action.start_step].start_frame end_frame = self.steps[action.end_step].end_frame root_motion = self.motion_vector.frames#[start_frame:end_frame,:3] if action.action_constraints.root_trajectory is not None: traj_constraint = action.action_constraints.root_trajectory plot_annotated_spline(traj_constraint,root_motion, file_name+str(idx)+".png") def to_json(self): data = dict() data["algorithm_config"] = self._algorithm_config data["start_pose"] = self.motion_vector.start_pose data["steps"] = [] for step in self.steps: data["steps"].append(step.to_json()) return data @staticmethod def from_json(graph, data): graph_walk = GraphWalk(graph, None, data["algorithm_config"], data["start_pose"]) graph_walk.steps = [] for step_data in data["steps"]: graph_walk.steps.append(GraphWalkEntry.from_json(graph, step_data)) return graph_walk def save_to_file(self, file_path): with open(file_path, "wb") as out: json.dump(self.to_json(), out)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 360, 29943, 29968, 29902, 18156, 29889, 13, 29937, 13, 29937, 20894, 2333, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 13, 29937, 3509, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 13, 29937, 376, 6295, 14093, 4968, 304, 5376, 297, 278, 18540, 1728, 24345, 29892, 3704, 13, 29937, 1728, 29485, 278, 10462, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 13, 29937, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 13, 29937, 12407, 304, 6029, 278, 18540, 338, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 13, 29937, 1494, 5855, 29901, 13, 29937, 13, 29937, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 13, 29937, 297, 599, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 29937, 13, 29937, 6093, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 13, 29937, 6323, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 13, 29937, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 2672, 13, 29937, 11698, 382, 29963, 3919, 24972, 9818, 6093, 26524, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 13, 29937, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 13, 29937, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 19474, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 13, 29937, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 7791, 7818, 12982, 1525, 29889, 13, 15945, 29908, 13, 20399, 373, 323, 434, 2739, 29871, 29896, 29946, 29871, 29896, 29947, 29901, 29941, 29929, 29901, 29946, 29896, 29871, 29906, 29900, 29896, 29945, 13, 13, 29992, 8921, 29901, 529, 5813, 29958, 13, 15945, 29908, 13, 13, 3166, 12865, 1053, 12865, 13, 5215, 16250, 13, 5215, 4390, 13, 5215, 12655, 408, 7442, 13, 3166, 3778, 29918, 13239, 29889, 18962, 29918, 1272, 1053, 7142, 291, 12877, 29892, 7595, 29918, 339, 25744, 291, 29918, 19935, 13, 3166, 3778, 29918, 13239, 29889, 18962, 29918, 1272, 29889, 29885, 8194, 29918, 535, 29883, 2579, 362, 1053, 7595, 29918, 392, 29918, 535, 29883, 2579, 403, 29918, 19935, 13, 3166, 3778, 29918, 13239, 29889, 4422, 1907, 29889, 1188, 1053, 2436, 29918, 1188, 29892, 2436, 29918, 4906, 29918, 517, 29918, 1188, 29892, 25401, 29918, 20387, 29918, 18525, 29892, 25401, 29918, 20387, 29918, 11690, 29892, 25401, 29918, 20387, 29918, 11432, 13, 3166, 869, 6735, 630, 29918, 29885, 8194, 29918, 8111, 1053, 530, 1333, 630, 29924, 8194, 12877, 13, 3166, 6317, 13646, 29879, 29889, 1028, 15238, 29918, 13646, 29879, 1053, 10937, 1299, 25758, 29918, 6007, 1254, 4717, 10192, 29918, 11116, 29918, 10818, 29943, 4717, 2303, 29918, 24815, 22122, 29892, 10937, 1299, 25758, 29918, 6007, 1254, 4717, 10192, 29918, 11116, 29918, 16240, 29949, 29918, 29950, 9468, 29918, 24815, 22122, 13, 3166, 869, 1989, 2557, 29918, 3696, 29918, 1761, 1053, 7670, 2557, 2624, 1293, 13, 3166, 6317, 13646, 29879, 29889, 1028, 15238, 29918, 13646, 29879, 29889, 23579, 1475, 29889, 13239, 1053, 6492, 29918, 6735, 630, 29918, 23579, 457, 13, 13, 23397, 29918, 7390, 11538, 29918, 24705, 29918, 24360, 353, 6796, 6689, 7341, 613, 376, 6689, 8091, 3284, 7851, 7341, 3284, 7851, 8091, 3284, 29879, 1037, 29893, 7341, 613, 376, 29879, 1037, 29893, 8091, 3108, 396, 1761, 310, 8820, 297, 607, 278, 19843, 11938, 526, 17262, 13, 13, 13, 1990, 12367, 29956, 2235, 9634, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10884, 29918, 3859, 29918, 4262, 29892, 2943, 29918, 1989, 29892, 4128, 29892, 15232, 29918, 2848, 29892, 1369, 29918, 2557, 29892, 1095, 29918, 2557, 29892, 10884, 29918, 9469, 3321, 29918, 13646, 29879, 29922, 8516, 1125, 13, 4706, 1583, 29889, 3177, 29918, 1989, 353, 2943, 29918, 1989, 13, 4706, 1583, 29889, 16744, 353, 4128, 13, 4706, 1583, 29889, 5666, 29918, 2848, 353, 15232, 29918, 2848, 13, 4706, 1583, 29889, 2962, 29918, 2557, 353, 1369, 29918, 2557, 13, 4706, 1583, 29889, 355, 29918, 2557, 353, 1095, 29918, 2557, 13, 4706, 1583, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 353, 10884, 29918, 9469, 3321, 29918, 13646, 29879, 13, 4706, 1583, 29889, 29876, 29918, 1028, 15238, 29918, 14036, 353, 10884, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 3177, 29918, 1989, 1822, 657, 29918, 29876, 29918, 1028, 15238, 29918, 14036, 580, 13, 4706, 1583, 29889, 29876, 29918, 2230, 29918, 14036, 353, 10884, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 3177, 29918, 1989, 1822, 657, 29918, 29876, 29918, 2230, 29918, 14036, 580, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 515, 29918, 3126, 29898, 29885, 8194, 29918, 3859, 29918, 4262, 29892, 848, 1125, 13, 4706, 736, 12367, 29956, 2235, 9634, 29898, 29885, 8194, 29918, 3859, 29918, 4262, 29892, 18761, 29898, 1272, 3366, 3177, 29918, 1989, 3108, 511, 13, 462, 795, 7442, 29889, 2378, 29898, 1272, 3366, 16744, 3108, 511, 848, 3366, 5666, 29918, 2848, 12436, 13, 462, 795, 848, 3366, 2962, 29918, 2557, 12436, 848, 3366, 355, 29918, 2557, 20068, 13, 13, 1678, 822, 304, 29918, 3126, 29898, 1311, 1125, 13, 4706, 848, 353, 9657, 580, 13, 4706, 848, 3366, 3177, 29918, 1989, 3108, 353, 1311, 29889, 3177, 29918, 1989, 13, 4706, 848, 3366, 16744, 3108, 353, 1583, 29889, 16744, 29889, 25027, 391, 580, 13, 4706, 848, 3366, 5666, 29918, 2848, 3108, 353, 1583, 29889, 5666, 29918, 2848, 13, 4706, 848, 3366, 2962, 29918, 2557, 3108, 353, 1583, 29889, 2962, 29918, 2557, 13, 4706, 848, 3366, 355, 29918, 2557, 3108, 353, 1583, 29889, 355, 29918, 2557, 13, 4706, 736, 848, 13, 13, 13, 1990, 5057, 10108, 9527, 29956, 2235, 9634, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3158, 29918, 978, 29892, 1369, 29918, 10568, 29892, 1095, 29918, 10568, 29892, 3158, 29918, 13646, 29879, 1125, 13, 4706, 1583, 29889, 2467, 29918, 978, 353, 3158, 29918, 978, 13, 4706, 1583, 29889, 2962, 29918, 10568, 353, 1369, 29918, 10568, 13, 4706, 1583, 29889, 355, 29918, 10568, 353, 1095, 29918, 10568, 13, 4706, 1583, 29889, 2467, 29918, 13646, 29879, 353, 3158, 29918, 13646, 29879, 13, 13, 13, 1990, 12367, 29956, 2235, 29898, 3318, 1125, 13, 1678, 9995, 10969, 310, 278, 7142, 291, 5631, 403, 770, 29889, 2866, 2708, 278, 3983, 6686, 1304, 304, 5706, 278, 16608, 29892, 13, 4706, 263, 10417, 310, 3515, 24611, 13, 4706, 304, 22470, 8820, 322, 263, 1051, 310, 4959, 363, 3058, 16608, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10884, 29918, 3859, 29918, 4262, 29892, 286, 29887, 29918, 2080, 29892, 5687, 29918, 2917, 29892, 1369, 29918, 4220, 29922, 8516, 29892, 1653, 29918, 1113, 29918, 1730, 29918, 1272, 29922, 8824, 1125, 13, 4706, 1583, 29889, 5029, 653, 29918, 2467, 29918, 1761, 353, 5159, 13, 4706, 1583, 29889, 24530, 353, 5159, 13, 4706, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 353, 10884, 29918, 3859, 29918, 4262, 13, 4706, 1583, 29889, 10568, 29918, 2798, 353, 29871, 29900, 13, 4706, 1583, 29889, 29885, 29887, 29918, 2080, 353, 286, 29887, 29918, 2080, 13, 4706, 1583, 3032, 20567, 29918, 2917, 353, 5687, 29918, 2917, 13, 4706, 1583, 29889, 29885, 8194, 29918, 8111, 353, 7142, 291, 12877, 29898, 1311, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 26050, 11285, 29892, 5687, 29918, 2917, 29897, 13, 4706, 565, 1369, 29918, 4220, 338, 6213, 29901, 13, 9651, 1369, 29918, 4220, 353, 286, 29887, 29918, 2080, 29889, 657, 29918, 2962, 29918, 4220, 580, 13, 4706, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 2962, 29918, 4220, 353, 1369, 29918, 4220, 13, 13, 4706, 1560, 29877, 6046, 29918, 11027, 353, 5687, 29918, 2917, 3366, 3844, 29877, 6046, 29918, 11027, 3108, 13, 4706, 1583, 29889, 1028, 15238, 29918, 3844, 29877, 6046, 29918, 5696, 353, 376, 3844, 29877, 6046, 29908, 13, 4706, 1583, 29889, 7302, 29918, 3844, 29877, 6046, 353, 1560, 29877, 6046, 29918, 11027, 3366, 1028, 15238, 29918, 3844, 29877, 6046, 3108, 396, 731, 3692, 278, 5609, 287, 10884, 338, 10597, 287, 472, 1301, 2187, 13, 4706, 565, 376, 1028, 15238, 29918, 3844, 29877, 6046, 29918, 5696, 29908, 297, 1560, 29877, 6046, 29918, 11027, 29901, 13, 9651, 1583, 29889, 1028, 15238, 29918, 3844, 29877, 6046, 29918, 5696, 353, 1560, 29877, 6046, 29918, 11027, 3366, 1028, 15238, 29918, 3844, 29877, 6046, 29918, 5696, 3108, 13, 13, 4706, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 7302, 29918, 1028, 15238, 29918, 3844, 29877, 6046, 353, 7700, 396, 316, 11236, 403, 1560, 29877, 6046, 2645, 278, 14710, 6656, 13, 4706, 1583, 29889, 1509, 29918, 2230, 29918, 16744, 353, 5687, 29918, 2917, 3366, 11236, 403, 29918, 2230, 29918, 5927, 362, 3108, 13, 4706, 1583, 29889, 3075, 6038, 29918, 6689, 29918, 20659, 353, 5687, 29918, 2917, 3366, 262, 3901, 29918, 9089, 4579, 1199, 29918, 11027, 3108, 3366, 3075, 6038, 29918, 6689, 29918, 20659, 3108, 13, 4706, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 11403, 931, 4128, 29908, 718, 851, 29898, 1311, 29889, 1509, 29918, 2230, 29918, 16744, 511, 25401, 29918, 20387, 29918, 18525, 29897, 13, 4706, 1583, 29889, 1989, 2557, 29918, 3696, 29918, 1761, 353, 7670, 2557, 2624, 1293, 29898, 3258, 29918, 1113, 29918, 1730, 29918, 1272, 29897, 13, 4706, 1583, 29889, 6689, 29918, 2467, 29918, 1761, 353, 22236, 29918, 7390, 11538, 29918, 24705, 29918, 24360, 13, 13, 1678, 822, 788, 29918, 8269, 29918, 517, 29918, 2467, 29918, 1761, 29898, 1311, 29892, 3158, 29918, 978, 29892, 1369, 29918, 10568, 29892, 1095, 29918, 10568, 29892, 3158, 29918, 13646, 29879, 1125, 13, 4706, 1583, 29889, 5029, 653, 29918, 2467, 29918, 1761, 29889, 4397, 29898, 16382, 10108, 9527, 29956, 2235, 9634, 29898, 2467, 29918, 978, 29892, 1369, 29918, 10568, 29892, 1095, 29918, 10568, 29892, 3158, 29918, 13646, 29879, 876, 13, 13, 1678, 822, 3588, 29918, 517, 29918, 6735, 630, 29918, 29885, 8194, 29898, 1311, 29892, 4331, 29918, 2311, 29922, 29896, 29889, 29900, 1125, 13, 4706, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 7302, 29918, 1028, 15238, 29918, 3844, 29877, 6046, 353, 1583, 29889, 7302, 29918, 3844, 29877, 6046, 396, 731, 281, 1979, 470, 451, 1560, 29877, 6046, 338, 7436, 13, 4706, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 1028, 15238, 29918, 3844, 29877, 6046, 29918, 5696, 353, 1583, 29889, 1028, 15238, 29918, 3844, 29877, 6046, 29918, 5696, 13, 4706, 1583, 29889, 13441, 29918, 4262, 29918, 20919, 29918, 517, 29918, 339, 25744, 291, 29918, 19935, 29898, 1509, 29918, 2230, 29918, 16744, 29922, 1311, 29889, 1509, 29918, 2230, 29918, 16744, 29892, 4331, 29918, 2311, 29922, 10568, 29918, 2311, 29897, 13, 4706, 1583, 29889, 1989, 2557, 29918, 3696, 29918, 1761, 29889, 5504, 29918, 13604, 29898, 1311, 29892, 29871, 29900, 29897, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 353, 530, 1333, 630, 29924, 8194, 12877, 29898, 1311, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 26050, 11285, 29892, 1583, 3032, 20567, 29918, 2917, 29897, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 19935, 353, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 19935, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 29876, 29918, 19935, 353, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 29876, 29918, 19935, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 2557, 29918, 2230, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 26050, 11285, 29889, 2557, 29918, 2230, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 1989, 2557, 29918, 3696, 29918, 1761, 353, 1583, 29889, 1989, 2557, 29918, 3696, 29918, 1761, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 26050, 11285, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 26050, 11285, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 29885, 29887, 29918, 2080, 353, 1583, 29889, 29885, 29887, 29918, 2080, 13, 4706, 1873, 353, 29871, 29900, 13, 4706, 565, 376, 3259, 29908, 297, 1583, 3032, 20567, 29918, 2917, 3366, 262, 3901, 29918, 9089, 4579, 1199, 29918, 11027, 3108, 29901, 13, 9651, 1873, 353, 1583, 3032, 20567, 29918, 2917, 3366, 262, 3901, 29918, 9089, 4579, 1199, 29918, 11027, 3108, 3366, 3259, 3108, 13, 4706, 565, 1873, 1275, 29871, 29896, 29901, 13, 9651, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 638, 29918, 13646, 29879, 353, 1583, 3032, 3258, 29918, 638, 29918, 13646, 29879, 580, 13, 4706, 25342, 1873, 1275, 29871, 29906, 29901, 13, 9651, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 638, 29918, 13646, 29879, 353, 1583, 3032, 3258, 29918, 638, 29918, 13646, 29879, 29906, 580, 13, 4706, 9732, 630, 29918, 29885, 8194, 29918, 8111, 29889, 4262, 29918, 20919, 353, 1583, 13, 4706, 736, 9732, 630, 29918, 29885, 8194, 29918, 8111, 13, 13, 1678, 822, 679, 29918, 2467, 29918, 3166, 29918, 1989, 2557, 29898, 1311, 29892, 1820, 2557, 1125, 13, 4706, 1476, 29918, 2467, 29918, 2248, 353, 448, 29896, 13, 4706, 4331, 29918, 2248, 353, 1583, 29889, 657, 29918, 10568, 29918, 3166, 29918, 1989, 2557, 29898, 1989, 2557, 29897, 13, 4706, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 9692, 1820, 2557, 297, 4331, 376, 718, 851, 29898, 10568, 29918, 2248, 511, 25401, 29918, 20387, 29918, 18525, 29897, 13, 4706, 565, 4331, 29918, 2248, 529, 29871, 29900, 29901, 13, 9651, 736, 1476, 29918, 2467, 29918, 2248, 13, 4706, 363, 3158, 29918, 2248, 29892, 3158, 297, 26985, 29898, 1311, 29889, 5029, 653, 29918, 2467, 29918, 1761, 1125, 13, 9651, 565, 3158, 29889, 2962, 29918, 10568, 5277, 4331, 29918, 2248, 5277, 3158, 29889, 355, 29918, 10568, 29901, 13, 18884, 1476, 29918, 2467, 29918, 2248, 353, 3158, 29918, 2248, 13, 4706, 736, 1476, 29918, 2467, 29918, 2248, 13, 13, 1678, 822, 679, 29918, 10568, 29918, 3166, 29918, 1989, 2557, 29898, 1311, 29892, 1820, 2557, 1125, 13, 4706, 1476, 29918, 10568, 29918, 2248, 353, 448, 29896, 13, 4706, 363, 4331, 29918, 2248, 29892, 4331, 297, 26985, 29898, 1311, 29889, 24530, 1125, 13, 9651, 396, 9842, 278, 1369, 29918, 2557, 322, 1095, 29918, 2557, 526, 1370, 9795, 297, 2767, 29918, 7382, 29918, 29885, 8194, 29918, 8111, 13, 9651, 396, 2158, 4331, 29889, 2962, 29918, 2557, 29892, 1820, 2557, 29892, 4331, 29889, 355, 29918, 2557, 13, 9651, 565, 4331, 29889, 2962, 29918, 2557, 5277, 1820, 2557, 5277, 4331, 29889, 355, 29918, 2557, 29901, 13, 18884, 1476, 29918, 10568, 29918, 2248, 353, 4331, 29918, 2248, 13, 4706, 736, 1476, 29918, 10568, 29918, 2248, 13, 13, 1678, 822, 3588, 29918, 4262, 29918, 20919, 29918, 517, 29918, 339, 25744, 291, 29918, 19935, 29898, 1311, 29892, 1369, 29918, 10568, 29922, 29900, 29892, 671, 29918, 2230, 29918, 16744, 29922, 8824, 29892, 4331, 29918, 2311, 29922, 29896, 29889, 29900, 1125, 13, 4706, 9995, 13, 4706, 584, 3207, 1369, 29918, 10568, 29901, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 565, 1369, 29918, 10568, 1275, 29871, 29900, 29901, 13, 9651, 1369, 29918, 2557, 353, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 1369, 29918, 2557, 353, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 1822, 2962, 29918, 2557, 13, 4706, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 8551, 29898, 355, 29918, 2557, 29922, 2962, 29918, 2557, 29897, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 29901, 5387, 13, 9651, 4331, 29889, 2962, 29918, 2557, 353, 1369, 29918, 2557, 13, 9651, 396, 3539, 29918, 1188, 29898, 10568, 29889, 3177, 29918, 1989, 29892, 7431, 29898, 10568, 29889, 16744, 876, 13, 9651, 439, 271, 29918, 19935, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 1627, 29918, 4836, 29898, 10568, 29889, 16744, 29892, 671, 29918, 2230, 29918, 16744, 29892, 4331, 29918, 2311, 467, 657, 29918, 29885, 8194, 29918, 8111, 580, 13, 9651, 565, 4331, 29889, 3177, 29918, 1989, 29961, 29896, 1822, 13609, 2141, 1975, 2541, 703, 1563, 303, 749, 29908, 1125, 13, 18884, 3661, 29918, 12090, 353, 376, 6661, 29918, 29878, 29908, 13, 9651, 25342, 4331, 29889, 3177, 29918, 1989, 29961, 29896, 1822, 13609, 2141, 1975, 2541, 703, 1266, 303, 749, 29908, 1125, 13, 18884, 3661, 29918, 12090, 353, 376, 6661, 29918, 29880, 29908, 13, 9651, 1683, 29901, 13, 18884, 3661, 29918, 12090, 353, 6213, 13, 9651, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 4397, 29918, 19935, 29898, 339, 271, 29918, 19935, 29892, 3661, 29918, 12090, 29897, 13, 9651, 4331, 29889, 355, 29918, 2557, 353, 1583, 29889, 657, 29918, 1949, 29918, 974, 29918, 19935, 580, 29899, 29896, 13, 9651, 1369, 29918, 2557, 353, 4331, 29889, 355, 29918, 2557, 718, 29871, 29896, 13, 13, 1678, 822, 679, 29918, 10945, 29918, 1028, 15238, 29918, 15501, 29918, 8111, 29898, 1311, 29892, 1369, 29918, 10568, 29922, 29900, 1125, 13, 4706, 2847, 29918, 2543, 404, 353, 5159, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 29901, 5387, 13, 9651, 2847, 29918, 2543, 404, 4619, 4331, 29889, 16744, 7503, 10568, 29889, 29876, 29918, 1028, 15238, 29918, 14036, 1822, 25027, 391, 580, 13, 4706, 736, 2847, 29918, 2543, 404, 13, 13, 1678, 822, 679, 29918, 10945, 29918, 2230, 29918, 15501, 29918, 8111, 29898, 1311, 29892, 1369, 29918, 10568, 29922, 29900, 1125, 13, 4706, 2847, 29918, 2543, 404, 353, 5159, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 29901, 5387, 13, 9651, 2847, 29918, 2543, 404, 4619, 4331, 29889, 16744, 29961, 10568, 29889, 29876, 29918, 1028, 15238, 29918, 14036, 29901, 1822, 25027, 391, 580, 13, 4706, 736, 2847, 29918, 2543, 404, 13, 13, 1678, 822, 2767, 29918, 1028, 15238, 29918, 16744, 29898, 1311, 29892, 3443, 29918, 8111, 29892, 1369, 29918, 10568, 29922, 29900, 1125, 13, 4706, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 6422, 18652, 4128, 613, 25401, 29918, 20387, 29918, 18525, 29897, 13, 4706, 9210, 353, 29871, 29900, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 29901, 5387, 13, 9651, 716, 29918, 2312, 353, 3443, 29918, 8111, 29961, 10289, 29901, 10289, 29974, 10568, 29889, 29876, 29918, 1028, 15238, 29918, 14036, 29962, 13, 9651, 4331, 29889, 16744, 7503, 10568, 29889, 29876, 29918, 1028, 15238, 29918, 14036, 29962, 353, 716, 29918, 2312, 13, 9651, 9210, 4619, 4331, 29889, 29876, 29918, 1028, 15238, 29918, 14036, 13, 13, 1678, 822, 2767, 29918, 2230, 29918, 16744, 29898, 1311, 29892, 3443, 29918, 8111, 29892, 1369, 29918, 10568, 29892, 1095, 29918, 10568, 1125, 13, 4706, 9210, 353, 29871, 29900, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 29901, 355, 29918, 10568, 5387, 13, 9651, 716, 29918, 4283, 353, 3443, 29918, 8111, 29961, 10289, 29901, 10289, 29974, 10568, 29889, 29876, 29918, 2230, 29918, 14036, 29962, 13, 9651, 4331, 29889, 16744, 29961, 10568, 29889, 29876, 29918, 1028, 15238, 29918, 14036, 17531, 353, 716, 29918, 4283, 13, 9651, 9210, 4619, 4331, 29889, 29876, 29918, 2230, 29918, 14036, 13, 13, 1678, 822, 9773, 29918, 339, 271, 29918, 19935, 29898, 1311, 29892, 716, 29918, 19935, 1125, 13, 4706, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 4397, 29918, 19935, 29898, 1482, 29918, 19935, 29897, 13, 13, 1678, 822, 679, 29918, 339, 271, 29918, 19935, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 19935, 13, 13, 1678, 822, 679, 29918, 1949, 29918, 974, 29918, 19935, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 29876, 29918, 19935, 13, 13, 1678, 822, 2767, 29918, 2557, 29918, 18317, 29898, 1311, 29892, 3158, 29918, 978, 29892, 1369, 29918, 2557, 29892, 1095, 29918, 2557, 1125, 13, 4706, 9995, 3462, 29879, 263, 8600, 304, 1583, 29889, 2557, 29918, 18317, 2791, 292, 1369, 322, 1095, 13, 9651, 3515, 310, 385, 3158, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 1989, 2557, 29918, 3696, 29918, 1761, 29889, 5504, 29918, 2557, 29918, 18317, 29898, 2467, 29918, 978, 29892, 1369, 29918, 2557, 29892, 1095, 29918, 2557, 29897, 13, 13, 1678, 822, 903, 3258, 29918, 638, 29918, 13646, 29879, 29898, 1311, 1125, 13, 4706, 12380, 29918, 13646, 29879, 353, 5159, 13, 4706, 363, 22645, 29892, 3158, 297, 26985, 29898, 1311, 29889, 5029, 653, 29918, 2467, 29918, 1761, 1125, 13, 9651, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 4391, 306, 29968, 11938, 363, 3158, 29908, 718, 376, 376, 718, 851, 29898, 13140, 29897, 718, 376, 376, 718, 851, 29898, 2467, 29889, 2962, 29918, 10568, 29897, 718, 376, 376, 718, 851, 29898, 1311, 29889, 24530, 29961, 2467, 29889, 2962, 29918, 10568, 1822, 2962, 29918, 2557, 511, 25401, 29918, 20387, 29918, 18525, 29897, 13, 9651, 565, 451, 1583, 29889, 3075, 6038, 29918, 6689, 29918, 20659, 322, 3158, 29889, 2467, 29918, 978, 297, 1583, 29889, 6689, 29918, 2467, 29918, 1761, 29901, 13, 18884, 1040, 6038, 29918, 20659, 353, 7700, 13, 9651, 1683, 29901, 13, 18884, 1040, 6038, 29918, 20659, 353, 5852, 13, 9651, 1369, 29918, 10568, 353, 3158, 29889, 2962, 29918, 10568, 13, 9651, 1095, 29918, 10568, 353, 3158, 29889, 355, 29918, 10568, 13, 9651, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 353, 9657, 580, 13, 9651, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 3366, 1989, 19935, 3108, 353, 9657, 580, 13, 9651, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 3366, 3018, 622, 3842, 3108, 353, 1051, 580, 13, 9651, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 3366, 22017, 2459, 29918, 485, 3398, 749, 3108, 353, 1051, 580, 13, 9651, 3515, 29918, 10289, 353, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 1822, 2962, 29918, 2557, 13, 9651, 363, 4331, 297, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 29901, 1095, 29918, 10568, 29974, 29896, 5387, 13, 18884, 931, 29918, 2220, 353, 6213, 13, 18884, 565, 1583, 29889, 1509, 29918, 2230, 29918, 16744, 322, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 657, 29918, 29876, 29918, 2230, 29918, 14036, 580, 1405, 29871, 29900, 29901, 13, 462, 1678, 931, 29918, 2220, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 1627, 29918, 4836, 29918, 2230, 29918, 2220, 29898, 10568, 29889, 16744, 29897, 13, 13, 18884, 4331, 29918, 1989, 2557, 29918, 13646, 29879, 353, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 13441, 29918, 517, 29918, 638, 29918, 13646, 29879, 29898, 1311, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29892, 3515, 29918, 10289, 29892, 931, 29918, 2220, 29892, 1040, 6038, 29918, 20659, 29897, 13, 13, 18884, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 3366, 1989, 19935, 16862, 5504, 29898, 10568, 29918, 1989, 2557, 29918, 13646, 29879, 29897, 13, 18884, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 3366, 22017, 2459, 29918, 485, 3398, 749, 3108, 4619, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 657, 29918, 1113, 29918, 13646, 29879, 580, 13, 13, 18884, 3515, 29918, 10289, 4619, 4331, 29889, 355, 29918, 2557, 448, 4331, 29889, 2962, 29918, 2557, 718, 29871, 29896, 13, 13, 9651, 565, 1583, 3032, 20567, 29918, 2917, 3366, 22017, 2459, 29918, 485, 3398, 749, 29918, 13646, 29879, 29918, 8513, 3108, 1275, 376, 638, 1115, 13, 18884, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 3366, 3018, 622, 3842, 3108, 4619, 1583, 3032, 3258, 29918, 638, 29918, 3018, 622, 706, 29918, 13646, 29879, 29918, 3166, 29918, 1113, 29918, 3018, 622, 3842, 29898, 13140, 29897, 13, 9651, 22470, 29918, 2467, 29918, 638, 29918, 13646, 29879, 3366, 3018, 622, 3842, 3108, 4619, 1583, 3032, 3258, 29918, 638, 29918, 3018, 622, 706, 29918, 13646, 29879, 29918, 3166, 29918, 6735, 630, 29918, 3018, 622, 3842, 29898, 13140, 29897, 13, 9651, 12380, 29918, 13646, 29879, 29889, 4397, 29898, 5029, 653, 29918, 2467, 29918, 638, 29918, 13646, 29879, 29897, 13, 4706, 736, 12380, 29918, 13646, 29879, 13, 13, 1678, 822, 903, 3258, 29918, 638, 29918, 13646, 29879, 29906, 29898, 1311, 1125, 13, 4706, 12380, 29918, 13646, 29879, 353, 16250, 29889, 7514, 287, 21533, 580, 13, 4706, 363, 22645, 29892, 3158, 297, 26985, 29898, 1311, 29889, 5029, 653, 29918, 2467, 29918, 1761, 1125, 13, 9651, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 4391, 306, 29968, 11938, 363, 3158, 29908, 718, 376, 376, 718, 851, 29898, 13140, 29897, 718, 376, 376, 718, 851, 29898, 2467, 29889, 2962, 29918, 10568, 29897, 718, 376, 376, 718, 851, 29898, 1311, 29889, 24530, 29961, 2467, 29889, 2962, 29918, 10568, 1822, 2962, 29918, 2557, 511, 25401, 29918, 20387, 29918, 18525, 29897, 13, 9651, 565, 451, 1583, 29889, 3075, 6038, 29918, 6689, 29918, 20659, 322, 3158, 29889, 2467, 29918, 978, 297, 1583, 29889, 6689, 29918, 2467, 29918, 1761, 29901, 13, 18884, 1040, 6038, 29918, 20659, 353, 7700, 13, 9651, 1683, 29901, 13, 18884, 1040, 6038, 29918, 20659, 353, 5852, 13, 9651, 1369, 29918, 10568, 353, 3158, 29889, 2962, 29918, 10568, 13, 9651, 1095, 29918, 10568, 353, 3158, 29889, 355, 29918, 10568, 13, 9651, 3515, 29918, 10289, 353, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 1822, 2962, 29918, 2557, 13, 9651, 363, 4331, 297, 1583, 29889, 24530, 29961, 2962, 29918, 10568, 29901, 1095, 29918, 10568, 718, 29871, 29896, 5387, 13, 18884, 931, 29918, 2220, 353, 6213, 13, 18884, 565, 1583, 29889, 1509, 29918, 2230, 29918, 16744, 322, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 657, 29918, 29876, 29918, 2230, 29918, 14036, 580, 1405, 29871, 29900, 29901, 13, 462, 1678, 931, 29918, 2220, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 1627, 29918, 4836, 29918, 2230, 29918, 2220, 29898, 10568, 29889, 16744, 29897, 13, 13, 18884, 4331, 29918, 13646, 29879, 353, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 13441, 29918, 517, 29918, 638, 29918, 13646, 29879, 29898, 13, 462, 1678, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29892, 3515, 29918, 10289, 29892, 931, 29918, 2220, 29892, 1040, 6038, 29918, 20659, 29892, 1873, 29922, 29906, 29897, 13, 18884, 12380, 29918, 13646, 29879, 29889, 5504, 29898, 10568, 29918, 13646, 29879, 29897, 13, 13, 18884, 3515, 29918, 10289, 4619, 4331, 29889, 355, 29918, 2557, 448, 4331, 29889, 2962, 29918, 2557, 718, 29871, 29896, 13, 13, 4706, 736, 12380, 29918, 13646, 29879, 13, 13, 1678, 822, 903, 3258, 29918, 638, 29918, 3018, 622, 706, 29918, 13646, 29879, 29918, 3166, 29918, 1113, 29918, 3018, 622, 3842, 29898, 1311, 29892, 3158, 29918, 13140, 1125, 13, 4706, 3515, 29918, 18317, 353, 1583, 29889, 1989, 2557, 29918, 3696, 29918, 1761, 29889, 2557, 29918, 18317, 1839, 5029, 653, 4276, 20529, 2033, 29961, 2467, 29918, 13140, 29962, 13, 4706, 23324, 706, 29918, 13646, 29879, 353, 1051, 580, 13, 4706, 3158, 353, 1583, 29889, 5029, 653, 29918, 2467, 29918, 1761, 29961, 2467, 29918, 13140, 29962, 13, 4706, 363, 5777, 29918, 13646, 297, 3158, 29889, 2467, 29918, 13646, 29879, 29889, 22017, 2459, 29918, 485, 3398, 749, 29918, 13646, 29879, 29901, 13, 9651, 1020, 29926, 29918, 13646, 353, 9657, 580, 13, 9651, 1020, 29926, 29918, 13646, 3366, 3018, 622, 706, 3108, 353, 5777, 29918, 13646, 13, 9651, 1020, 29926, 29918, 13646, 3366, 20227, 29918, 3881, 3108, 353, 7700, 29871, 396, 2740, 363, 17649, 1369, 13, 9651, 1020, 29926, 29918, 13646, 3366, 3075, 6038, 29918, 20659, 3108, 353, 7700, 13, 9651, 1020, 29926, 29918, 13646, 3366, 2962, 29918, 2557, 3108, 353, 3515, 29918, 18317, 3366, 2962, 4308, 3108, 13, 9651, 1020, 29926, 29918, 13646, 3366, 355, 29918, 2557, 3108, 353, 3515, 29918, 18317, 3366, 355, 4308, 3108, 13, 9651, 396, 4986, 3970, 1284, 263, 2253, 1650, 1135, 445, 14725, 393, 563, 29877, 267, 278, 14002, 1024, 10417, 515, 6567, 304, 5780, 289, 2873, 363, 5777, 11938, 13, 9651, 565, 1583, 29889, 29885, 29887, 29918, 2080, 29889, 11236, 403, 29918, 12090, 29918, 20698, 322, 5777, 29918, 13646, 29889, 12090, 29918, 978, 297, 1051, 29898, 1311, 29889, 29885, 29887, 29918, 2080, 29889, 262, 3901, 29918, 12090, 29918, 978, 29918, 1958, 29889, 8149, 580, 1125, 13, 18884, 14002, 29918, 978, 353, 1583, 29889, 29885, 29887, 29918, 2080, 29889, 262, 3901, 29918, 12090, 29918, 978, 29918, 1958, 29961, 1113, 29918, 13646, 29889, 12090, 29918, 978, 29962, 13, 9651, 1683, 29901, 13, 18884, 14002, 29918, 978, 353, 5777, 29918, 13646, 29889, 12090, 29918, 978, 13, 13, 9651, 1020, 29926, 29918, 13646, 3366, 12090, 29918, 978, 3108, 353, 14002, 29918, 978, 13, 9651, 1020, 29926, 29918, 13646, 3366, 4181, 3108, 353, 29871, 29896, 29889, 29900, 13, 9651, 23324, 706, 29918, 13646, 29879, 29889, 4397, 29898, 3018, 29926, 29918, 13646, 29897, 13, 4706, 736, 23324, 706, 29918, 13646, 29879, 13, 13, 1678, 822, 903, 3258, 29918, 638, 29918, 3018, 622, 706, 29918, 13646, 29879, 29918, 3166, 29918, 6735, 630, 29918, 3018, 622, 3842, 29898, 1311, 29892, 3158, 29918, 13140, 1125, 13, 4706, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 21111, 9732, 630, 23324, 3842, 613, 25401, 29918, 20387, 29918, 18525, 29897, 13, 4706, 3515, 29918, 18317, 353, 1583, 29889, 1989, 2557, 29918, 3696, 29918, 1761, 29889, 2557, 29918, 18317, 1839, 5029, 653, 4276, 20529, 2033, 29961, 2467, 29918, 13140, 29962, 13, 4706, 1369, 29918, 2557, 353, 3515, 29918, 18317, 3366, 2962, 4308, 3108, 13, 4706, 23324, 706, 29918, 13646, 29879, 353, 1051, 580, 13, 4706, 3158, 353, 1583, 29889, 5029, 653, 29918, 2467, 29918, 1761, 29961, 2467, 29918, 13140, 29962, 13, 4706, 363, 7276, 297, 3158, 29889, 2467, 29918, 13646, 29879, 29889, 6735, 630, 29918, 3018, 622, 706, 29918, 13646, 29879, 29901, 13, 9651, 3858, 353, 1051, 29898, 13646, 29889, 12846, 7716, 29918, 18317, 29889, 8149, 3101, 29961, 29900, 29962, 13, 9651, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 3018, 622, 706, 7276, 3858, 376, 718, 851, 29898, 1761, 29898, 13646, 29889, 12846, 7716, 29918, 18317, 29889, 8149, 3101, 511, 25401, 29918, 20387, 29918, 18525, 29897, 13, 9651, 3158, 29918, 978, 353, 3158, 29889, 2467, 29918, 978, 13, 9651, 363, 4331, 297, 1583, 29889, 24530, 29961, 2467, 29889, 2962, 29918, 10568, 29901, 3158, 29889, 355, 29918, 10568, 29974, 29896, 5387, 13, 18884, 10884, 29918, 9469, 3321, 29918, 978, 353, 4331, 29889, 3177, 29918, 1989, 29961, 29896, 29962, 13, 18884, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 6914, 363, 3158, 17195, 310, 376, 718, 3158, 29918, 978, 13578, 15691, 29885, 8194, 29918, 9469, 3321, 29918, 978, 29892, 25401, 29918, 20387, 29918, 18525, 29897, 13, 13, 18884, 565, 10884, 29918, 9469, 3321, 29918, 978, 451, 297, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 3177, 29918, 13155, 29961, 2467, 29918, 978, 1822, 29885, 8194, 29918, 9469, 3321, 29918, 18317, 29918, 1727, 1080, 29901, 13, 462, 1678, 6773, 13, 18884, 25495, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 3177, 29918, 13155, 29961, 2467, 29918, 978, 1822, 29885, 8194, 29918, 9469, 3321, 29918, 18317, 29918, 1727, 1080, 29961, 29885, 8194, 29918, 9469, 3321, 29918, 978, 29962, 13, 18884, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 2467, 17195, 29908, 718, 851, 29898, 6735, 800, 29897, 718, 29908, 15691, 29871, 851, 29898, 2557, 29918, 18317, 3366, 2962, 4308, 20068, 718, 376, 376, 718, 851, 29898, 2557, 29918, 18317, 3366, 355, 4308, 3108, 511, 13, 462, 462, 268, 25401, 29918, 20387, 29918, 18525, 29897, 13, 13, 18884, 565, 3858, 451, 297, 1051, 29898, 6735, 800, 29889, 8149, 580, 1125, 13, 462, 1678, 6773, 13, 18884, 17195, 29918, 3881, 353, 25495, 29961, 1643, 29962, 13, 18884, 1020, 29926, 29918, 13646, 353, 9657, 580, 13, 18884, 1020, 29926, 29918, 13646, 3366, 3018, 622, 706, 3108, 353, 7276, 13, 18884, 1020, 29926, 29918, 13646, 3366, 3075, 6038, 29918, 20659, 3108, 353, 5852, 13, 18884, 1020, 29926, 29918, 13646, 3366, 20227, 29918, 3881, 3108, 353, 5852, 13, 18884, 931, 29918, 2220, 353, 6213, 13, 18884, 565, 1583, 29889, 1509, 29918, 2230, 29918, 16744, 322, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 657, 29918, 29876, 29918, 2230, 29918, 14036, 580, 1405, 29871, 29900, 29901, 13, 462, 1678, 931, 29918, 2220, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 1627, 29918, 4836, 29918, 2230, 29918, 2220, 29898, 10568, 29889, 16744, 29897, 13, 18884, 565, 931, 29918, 2220, 338, 6213, 29901, 13, 462, 1678, 1020, 29926, 29918, 13646, 3366, 2962, 29918, 2557, 3108, 353, 1369, 29918, 2557, 718, 17195, 29918, 3881, 29961, 29900, 29962, 13, 462, 1678, 1020, 29926, 29918, 13646, 3366, 355, 29918, 2557, 3108, 353, 1369, 29918, 2557, 718, 17195, 29918, 3881, 29961, 29896, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 1202, 718, 29896, 363, 1959, 10417, 14402, 11539, 363, 599, 4251, 13, 462, 1678, 1020, 29926, 29918, 13646, 3366, 2962, 29918, 2557, 3108, 353, 1369, 29918, 2557, 718, 938, 29898, 2230, 29918, 2220, 29961, 18317, 29918, 3881, 29961, 29900, 24960, 718, 29871, 29896, 13, 462, 1678, 1020, 29926, 29918, 13646, 3366, 355, 29918, 2557, 3108, 353, 1369, 29918, 2557, 718, 938, 29898, 2230, 29918, 2220, 29961, 18317, 29918, 3881, 29961, 29896, 24960, 718, 29871, 29896, 13, 13, 18884, 565, 1583, 29889, 29885, 29887, 29918, 2080, 29889, 11236, 403, 29918, 12090, 29918, 20698, 322, 7276, 29889, 12090, 29918, 978, 297, 1051, 29898, 1311, 29889, 29885, 29887, 29918, 2080, 29889, 262, 3901, 29918, 12090, 29918, 978, 29918, 1958, 29889, 8149, 580, 1125, 13, 462, 1678, 14002, 29918, 978, 353, 1583, 29889, 29885, 29887, 29918, 2080, 29889, 262, 3901, 29918, 12090, 29918, 978, 29918, 1958, 29961, 13646, 29889, 12090, 29918, 978, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 14002, 29918, 978, 353, 7276, 29889, 12090, 29918, 978, 13, 13, 18884, 1020, 29926, 29918, 13646, 3366, 12090, 29918, 978, 3108, 353, 14002, 29918, 978, 13, 18884, 1020, 29926, 29918, 13646, 3366, 4181, 3108, 353, 29871, 29896, 29889, 29900, 13, 18884, 2436, 29918, 4906, 29918, 517, 29918, 1188, 29898, 376, 3258, 12380, 23324, 706, 7276, 515, 3858, 376, 718, 851, 29898, 1643, 511, 25401, 29918, 20387, 29918, 18525, 29897, 13, 18884, 23324, 706, 29918, 13646, 29879, 29889, 4397, 29898, 3018, 29926, 29918, 13646, 29897, 13, 4706, 736, 23324, 706, 29918, 13646, 29879, 13, 13, 1678, 822, 679, 29918, 12483, 482, 29918, 1989, 2557, 29918, 13646, 29918, 2704, 29898, 1311, 1125, 13, 4706, 1820, 2557, 29918, 13646, 29918, 12523, 353, 5159, 13, 4706, 4331, 29918, 2248, 353, 29871, 29900, 13, 4706, 12379, 29918, 19935, 353, 6213, 13, 4706, 363, 4331, 29918, 13140, 29892, 4331, 297, 26985, 29898, 1311, 29889, 24530, 1125, 13, 9651, 439, 271, 29918, 19935, 353, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 18010, 29961, 10568, 29889, 3177, 29918, 1989, 1822, 1627, 29918, 4836, 29898, 10568, 29889, 16744, 29892, 671, 29918, 2230, 29918, 16744, 29922, 8824, 467, 657, 29918, 29885, 8194, 29918, 8111, 580, 13, 9651, 18109, 11285, 353, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 26050, 11285, 13, 9651, 26118, 29918, 19935, 353, 7595, 29918, 392, 29918, 535, 29883, 2579, 403, 29918, 19935, 29898, 26050, 11285, 29892, 18109, 11285, 29889, 2520, 292, 29918, 4632, 29918, 3177, 29892, 439, 271, 29918, 19935, 29892, 12379, 29918, 19935, 29892, 13, 462, 462, 308, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 2962, 29918, 4220, 29892, 29871, 29900, 29897, 13, 9651, 363, 274, 29918, 13140, 29892, 7276, 297, 26985, 29898, 10568, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 13646, 29879, 1125, 13, 18884, 565, 7276, 29889, 13646, 29918, 1853, 297, 518, 5550, 1299, 25758, 29918, 6007, 1254, 4717, 10192, 29918, 11116, 29918, 10818, 29943, 4717, 2303, 29918, 24815, 22122, 29892, 10937, 1299, 25758, 29918, 6007, 1254, 4717, 10192, 29918, 11116, 29918, 16240, 29949, 29918, 29950, 9468, 29918, 24815, 22122, 29962, 322, 29905, 13, 462, 259, 451, 376, 13525, 29908, 297, 1051, 29898, 13646, 29889, 12846, 7716, 29918, 18317, 29889, 8149, 580, 1125, 13, 462, 1678, 1059, 353, 7276, 29889, 24219, 403, 29918, 29885, 8194, 29918, 11249, 29898, 13671, 29918, 19935, 29897, 13, 462, 1678, 2436, 29918, 4906, 29918, 517, 29918, 1188, 703, 2392, 310, 7670, 2557, 7276, 376, 718, 710, 29898, 10568, 29918, 13140, 29897, 718, 11663, 29908, 718, 851, 29898, 29883, 29918, 13140, 29897, 718, 1115, 376, 718, 710, 29898, 2704, 511, 25401, 29918, 20387, 29918, 18525, 29897, 13, 462, 1678, 1820, 2557, 29918, 13646, 29918, 12523, 29889, 4397, 29898, 2704, 29897, 13, 9651, 12379, 29918, 19935, 353, 26118, 29918, 19935, 13, 9651, 4331, 29918, 2248, 4619, 29871, 29896, 13, 4706, 565, 7431, 29898, 1989, 2557, 29918, 13646, 29918, 12523, 29897, 1405, 29871, 29900, 29901, 13, 9651, 736, 7442, 29889, 12483, 482, 29898, 1989, 2557, 29918, 13646, 29918, 12523, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 448, 29896, 13, 13, 1678, 822, 679, 29918, 13525, 29918, 13646, 29879, 29898, 1311, 1125, 13, 4706, 4331, 29918, 2798, 353, 29871, 29900, 13, 4706, 5759, 29918, 13646, 29879, 353, 9657, 580, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29901, 13, 9651, 1820, 353, 851, 29898, 10568, 29889, 3177, 29918, 1989, 29897, 718, 851, 29898, 10568, 29918, 2798, 29897, 13, 9651, 5759, 29918, 13646, 29879, 29961, 1989, 29962, 353, 5159, 13, 9651, 363, 7276, 297, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 13646, 29879, 29901, 13, 18884, 565, 7276, 29889, 275, 29918, 13525, 7295, 13, 462, 1678, 5759, 29918, 13646, 29879, 29961, 1989, 1822, 4397, 29898, 13646, 29889, 3283, 29897, 13, 9651, 4331, 29918, 2798, 4619, 29871, 29896, 13, 4706, 736, 5759, 29918, 13646, 29879, 13, 13, 1678, 822, 679, 29918, 12483, 482, 29918, 2704, 29898, 1311, 1125, 13, 4706, 6588, 29918, 2704, 353, 29871, 29900, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29901, 13, 9651, 6588, 29918, 2704, 4619, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 1195, 29918, 2704, 13, 4706, 565, 6588, 29918, 2704, 1405, 29871, 29900, 29901, 13, 9651, 6588, 29918, 2704, 847, 29922, 7431, 29898, 1311, 29889, 24530, 29897, 13, 4706, 736, 6588, 29918, 2704, 13, 13, 1678, 822, 679, 29918, 4537, 29918, 974, 29918, 3318, 29918, 24219, 800, 29898, 1311, 1125, 13, 4706, 12091, 29918, 24219, 800, 353, 29871, 29900, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29901, 13, 9651, 12091, 29918, 24219, 800, 4619, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 24219, 800, 13, 4706, 736, 12091, 29918, 24219, 800, 13, 13, 1678, 822, 1596, 29918, 6112, 6765, 29898, 1311, 1125, 13, 4706, 1596, 29898, 1311, 29889, 657, 29918, 6112, 6765, 29918, 1807, 3101, 13, 13, 1678, 822, 679, 29918, 6112, 6765, 29918, 1807, 29898, 1311, 1125, 13, 4706, 6588, 29918, 2704, 353, 1583, 29889, 657, 29918, 12483, 482, 29918, 2704, 580, 13, 4706, 6161, 800, 29918, 1807, 353, 376, 11536, 1353, 310, 12091, 6161, 800, 376, 718, 851, 29898, 1311, 29889, 657, 29918, 4537, 29918, 974, 29918, 3318, 29918, 24219, 800, 3101, 13, 4706, 1059, 29918, 1807, 353, 376, 29909, 19698, 1059, 363, 376, 718, 851, 29898, 2435, 29898, 1311, 29889, 24530, 876, 718, 320, 13, 462, 539, 376, 10884, 28147, 3145, 29901, 376, 718, 851, 29898, 12483, 482, 29918, 2704, 29897, 13, 4706, 6588, 29918, 1989, 2557, 29918, 2704, 353, 1583, 29889, 657, 29918, 12483, 482, 29918, 1989, 2557, 29918, 13646, 29918, 2704, 580, 13, 4706, 565, 6588, 29918, 1989, 2557, 29918, 2704, 1405, 448, 29896, 29901, 13, 9651, 6588, 29918, 1989, 2557, 29918, 2704, 29918, 1807, 353, 376, 29909, 19698, 1820, 2557, 7276, 1059, 376, 718, 851, 29898, 12483, 482, 29918, 1989, 2557, 29918, 2704, 29897, 13, 4706, 1683, 29901, 13, 9651, 6588, 29918, 1989, 2557, 29918, 2704, 29918, 1807, 353, 376, 3782, 1820, 2557, 7276, 6790, 29908, 13, 4706, 6588, 29918, 2230, 29918, 546, 29918, 10568, 353, 29871, 29900, 29889, 29900, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29901, 13, 9651, 6588, 29918, 2230, 29918, 546, 29918, 10568, 4619, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 2230, 13, 4706, 6588, 29918, 2230, 29918, 546, 29918, 10568, 847, 29922, 7431, 29898, 1311, 29889, 24530, 29897, 13, 4706, 6588, 29918, 2230, 29918, 1807, 353, 376, 29909, 19698, 931, 639, 10884, 19269, 376, 718, 851, 29898, 12483, 482, 29918, 2230, 29918, 546, 29918, 10568, 29897, 13, 4706, 736, 6588, 29918, 1989, 2557, 29918, 2704, 29918, 1807, 718, 6634, 29876, 29908, 718, 6161, 800, 29918, 1807, 718, 6634, 29876, 29908, 718, 6588, 29918, 2230, 29918, 1807, 718, 6634, 29876, 29908, 718, 1059, 29918, 1807, 13, 13, 1678, 822, 5609, 29918, 13525, 29918, 13646, 29879, 29898, 1311, 29892, 934, 29918, 2084, 543, 1484, 1338, 29889, 2084, 29908, 1125, 13, 4706, 9995, 1281, 369, 1372, 11938, 393, 892, 5759, 2729, 373, 1881, 11938, 964, 263, 4390, 8600, 363, 263, 4744, 7604, 2133, 13, 4706, 9995, 13, 4706, 3876, 29918, 6451, 29918, 3149, 29918, 1272, 353, 5159, 13, 4706, 1361, 29918, 13646, 29918, 1272, 353, 5159, 13, 4706, 363, 22645, 29892, 4331, 297, 26985, 29898, 1311, 29889, 24530, 1125, 13, 9651, 4331, 29918, 13646, 29879, 353, 8853, 12846, 7716, 21978, 1115, 8853, 10568, 1115, 22645, 930, 13, 9651, 363, 274, 297, 4331, 29889, 29885, 8194, 29918, 9469, 3321, 29918, 13646, 29879, 29889, 13646, 29879, 29901, 13, 18884, 565, 274, 29889, 13646, 29918, 1853, 1275, 376, 1989, 2557, 29918, 3283, 29908, 322, 274, 29889, 12090, 29918, 978, 1275, 1583, 29889, 29885, 8194, 29918, 3859, 29918, 4262, 29889, 26050, 11285, 29889, 4632, 29901, 13, 462, 1678, 282, 353, 274, 29889, 3283, 13, 462, 1678, 565, 282, 338, 451, 6213, 29901, 13, 462, 4706, 4331, 29918, 13646, 29879, 3366, 3283, 3108, 353, 518, 29886, 29961, 29900, 1402, 448, 29886, 29961, 29906, 1402, 6213, 29962, 13, 18884, 25342, 274, 29889, 13646, 29918, 1853, 1275, 376, 1989, 2557, 29918, 29906, 29881, 29918, 20845, 1115, 13, 462, 4706, 4331, 29918, 13646, 29879, 3366, 20845, 3108, 353, 274, 29889, 20845, 29918, 13646, 29889, 25027, 391, 580, 13, 18884, 25342, 274, 29889, 13646, 29918, 1853, 1275, 376, 1113, 29918, 13646, 1115, 13, 462, 1678, 396, 361, 274, 29889, 13646, 29918, 1853, 297, 6796, 7341, 3481, 613, 376, 8091, 3481, 3108, 29901, 13, 462, 1678, 2602, 353, 518, 29883, 29889, 3283, 29961, 29900, 1402, 448, 29883, 29889, 3283, 29961, 29906, 1402, 274, 29889, 3283, 29961, 29896, 5262, 13, 462, 1678, 1361, 29918, 13646, 353, 8853, 3283, 1115, 2602, 29913, 13, 462, 1678, 1361, 29918, 13646, 29918, 1272, 29889, 4397, 29898, 3179, 29918, 13646, 29897, 13, 9651, 3876, 29918, 6451, 29918, 3149, 29918, 1272, 29889, 4397, 29898, 10568, 29918, 13646, 29879, 29897, 13, 13, 13, 4706, 11938, 353, 8853, 20673, 1115, 518, 6377, 5029, 653, 26525, 1115, 19660, 13, 462, 462, 462, 418, 376, 2467, 1115, 376, 20919, 613, 13, 462, 462, 462, 418, 376, 13646, 29879, 1115, 518, 6377, 12090, 1115, 376, 29950, 4512, 613, 13, 462, 462, 462, 462, 539, 376, 1989, 2557, 27427, 1115, 3876, 29918, 6451, 29918, 3149, 29918, 1272, 29871, 2981, 13, 462, 462, 462, 462, 418, 8853, 12090, 1115, 376, 7341, 3481, 613, 13, 462, 462, 462, 462, 539, 376, 1989, 2557, 27427, 1115, 1361, 29918, 13646, 29918, 1272, 6525, 13, 462, 462, 462, 418, 500, 29962, 13, 462, 462, 500, 29962, 13, 462, 539, 500, 13, 13, 4706, 11938, 3366, 2962, 29925, 852, 3108, 353, 8853, 3283, 1115, 29961, 29900, 29892, 29900, 29892, 29900, 1402, 376, 20659, 1115, 518, 29900, 29892, 29900, 29892, 29900, 12258, 13, 4706, 11938, 3366, 7924, 3108, 353, 376, 7924, 29908, 13, 4706, 411, 1722, 29898, 1445, 29918, 2084, 29892, 376, 29893, 29890, 1159, 408, 714, 29901, 13, 9651, 4390, 29889, 15070, 29898, 13646, 29879, 29892, 714, 29897, 13, 13, 1678, 822, 679, 29918, 4537, 29918, 974, 29918, 7387, 29898, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 29889, 5029, 653, 29918, 2467, 29918, 1761, 29897, 13, 13, 1678, 822, 6492, 29918, 13646, 29879, 29898, 1311, 29892, 934, 29918, 978, 543, 3018, 29926, 29908, 1125, 13, 4706, 363, 22645, 29892, 3158, 297, 26985, 29898, 1311, 29889, 5029, 653, 29918, 2467, 29918, 1761, 1125, 13, 9651, 1369, 29918, 2557, 353, 1583, 29889, 24530, 29961, 2467, 29889, 2962, 29918, 10568, 1822, 2962, 29918, 2557, 13, 9651, 1095, 29918, 2557, 353, 1583, 29889, 24530, 29961, 2467, 29889, 355, 29918, 10568, 1822, 355, 29918, 2557, 13, 13, 9651, 3876, 29918, 29885, 8194, 353, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 19935, 29937, 29961, 2962, 29918, 2557, 29901, 355, 29918, 2557, 29892, 29901, 29941, 29962, 13, 9651, 565, 3158, 29889, 2467, 29918, 13646, 29879, 29889, 4632, 29918, 3018, 622, 706, 338, 451, 6213, 29901, 13, 18884, 1020, 29926, 29918, 13646, 353, 3158, 29889, 2467, 29918, 13646, 29879, 29889, 4632, 29918, 3018, 622, 706, 13, 18884, 6492, 29918, 6735, 630, 29918, 23579, 457, 29898, 3018, 29926, 29918, 13646, 29892, 4632, 29918, 29885, 8194, 29892, 934, 29918, 978, 29974, 710, 29898, 13140, 7240, 1642, 2732, 1159, 13, 13, 1678, 822, 304, 29918, 3126, 29898, 1311, 1125, 13, 4706, 848, 353, 9657, 580, 13, 4706, 848, 3366, 20567, 29918, 2917, 3108, 353, 1583, 3032, 20567, 29918, 2917, 13, 4706, 848, 3366, 2962, 29918, 4220, 3108, 353, 1583, 29889, 29885, 8194, 29918, 8111, 29889, 2962, 29918, 4220, 13, 4706, 848, 3366, 24530, 3108, 353, 5159, 13, 4706, 363, 4331, 297, 1583, 29889, 24530, 29901, 13, 9651, 848, 3366, 24530, 16862, 4397, 29898, 10568, 29889, 517, 29918, 3126, 3101, 13, 4706, 736, 848, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 515, 29918, 3126, 29898, 4262, 29892, 848, 1125, 13, 4706, 3983, 29918, 20919, 353, 12367, 29956, 2235, 29898, 4262, 29892, 6213, 29892, 848, 3366, 20567, 29918, 2917, 12436, 848, 3366, 2962, 29918, 4220, 20068, 13, 4706, 3983, 29918, 20919, 29889, 24530, 353, 5159, 13, 4706, 363, 4331, 29918, 1272, 297, 848, 3366, 24530, 3108, 29901, 13, 9651, 3983, 29918, 20919, 29889, 24530, 29889, 4397, 29898, 9527, 29956, 2235, 9634, 29889, 3166, 29918, 3126, 29898, 4262, 29892, 4331, 29918, 1272, 876, 13, 4706, 736, 3983, 29918, 20919, 13, 13, 1678, 822, 4078, 29918, 517, 29918, 1445, 29898, 1311, 29892, 934, 29918, 2084, 1125, 13, 4706, 411, 1722, 29898, 1445, 29918, 2084, 29892, 376, 29893, 29890, 1159, 408, 714, 29901, 13, 9651, 4390, 29889, 15070, 29898, 1311, 29889, 517, 29918, 3126, 3285, 714, 29897, 13, 2 ]
dime/__init__.py
CURENT/dime
0
149009
from .dime import Dime
[ 1, 515, 869, 29881, 603, 1053, 360, 603, 13, 2 ]
problem01.py
goznauk/ProjectEuler.py
0
50161
<reponame>goznauk/ProjectEuler.py<gh_stars>0 i = 1 sum = 0 for i in range(1000) : if i%3==0 : sum += i elif i%5==0 : sum += i print sum
[ 1, 529, 276, 1112, 420, 29958, 1484, 3749, 585, 29895, 29914, 7653, 29923, 8584, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 29875, 353, 29871, 29896, 13, 2083, 353, 29871, 29900, 13, 1454, 474, 297, 3464, 29898, 29896, 29900, 29900, 29900, 29897, 584, 13, 12, 361, 474, 29995, 29941, 1360, 29900, 584, 13, 12, 12, 2083, 4619, 474, 13, 12, 23681, 474, 29995, 29945, 1360, 29900, 584, 13, 12, 12, 2083, 4619, 474, 13, 13, 13, 2158, 2533, 13, 2 ]
main.py
Alyxion/AquasuiteTempSync
0
165592
<gh_stars>0 # Simple Python script which fetches JSON data in the Circonus from the Aquasuite Web Service # and stores it in a local file so it can be progressed by the FanControl tool by <NAME> import requests import os import json import time import signal import traceback class GracefulKiller: kill_now = False def __init__(self): signal.signal(signal.SIGINT, self.exit_gracefully) signal.signal(signal.SIGTERM, self.exit_gracefully) def exit_gracefully(self, signum, frame): self.kill_now = True if __name__ == "__main__": target_filename = os.environ["FAN_CONTROL_TARGET_SENSOR"] temperature_url = os.environ["TEMPERATURE_URL"] update_frequency = float(os.environ["UPDATE_FREQUENCY_SECONDS"]) print(f"Synching sensor data from {temperature_url} to {target_filename}") print(f"Temperature update frequency: {update_frequency:0.1f}s") gc = GracefulKiller() while not gc.kill_now: try: data_value = 0.0 # Fetch data from Aquasuite server try: response = requests.get(temperature_url, timeout=5) temp_data = json.loads(response.text) data_value = list(temp_data.values())[0] except: print(f"An error occurred while trying to fetch temperature update. {traceback.format_exc()}") temperature = "0.0" # Try to process data try: temperature: str = data_value float_temperature = float(temperature) # cast to float. if this fails (None) we won't write it to disk except: print(f"An error occurred while trying to fetch temperature update. {traceback.format_exc()}") temperature = "20.0" # Store value in fan control file with open(f"/fancontrol/{target_filename}", "w") as temperature_file: print(f"Received water temperature update: {temperature}") temperature = temperature.replace(".", ",") temperature_file.write(temperature) except: print(f"An error occurred while trying to store temperature update. {traceback.format_exc()}") pass for counter in range(0, int(update_frequency)): time.sleep(1.0) if gc.kill_now: break
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 12545, 5132, 2471, 607, 6699, 267, 4663, 848, 297, 278, 25079, 535, 375, 515, 278, 16020, 294, 29884, 568, 2563, 6692, 13, 29937, 322, 14422, 372, 297, 263, 1887, 934, 577, 372, 508, 367, 6728, 287, 491, 278, 383, 273, 4809, 5780, 491, 529, 5813, 29958, 13, 13, 5215, 7274, 13, 5215, 2897, 13, 5215, 4390, 13, 5215, 931, 13, 5215, 7182, 13, 5215, 9637, 1627, 13, 13, 1990, 23350, 1319, 29968, 5495, 29901, 13, 1678, 12088, 29918, 3707, 353, 7700, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 7182, 29889, 25436, 29898, 25436, 29889, 5425, 29954, 10192, 29892, 1583, 29889, 13322, 29918, 3874, 346, 3730, 29897, 13, 4706, 7182, 29889, 25436, 29898, 25436, 29889, 5425, 29954, 4945, 29924, 29892, 1583, 29889, 13322, 29918, 3874, 346, 3730, 29897, 13, 13, 1678, 822, 6876, 29918, 3874, 346, 3730, 29898, 1311, 29892, 1804, 398, 29892, 3515, 1125, 13, 4706, 1583, 29889, 21174, 29918, 3707, 353, 5852, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 3646, 29918, 9507, 353, 2897, 29889, 21813, 3366, 29943, 2190, 29918, 22412, 1672, 29931, 29918, 29911, 1718, 7194, 29918, 29903, 1430, 29903, 1955, 3108, 13, 1678, 10430, 29918, 2271, 353, 2897, 29889, 21813, 3366, 4330, 3580, 1001, 1299, 11499, 29918, 4219, 3108, 13, 1678, 2767, 29918, 10745, 23860, 353, 5785, 29898, 359, 29889, 21813, 3366, 14474, 29918, 29943, 1525, 13356, 1430, 29907, 29979, 29918, 1660, 6007, 8452, 20068, 13, 1678, 1596, 29898, 29888, 29908, 29216, 305, 292, 23530, 848, 515, 426, 12863, 1535, 29918, 2271, 29913, 304, 426, 5182, 29918, 9507, 27195, 13, 1678, 1596, 29898, 29888, 29908, 5776, 546, 1535, 2767, 10868, 29901, 426, 5504, 29918, 10745, 23860, 29901, 29900, 29889, 29896, 29888, 29913, 29879, 1159, 13, 1678, 330, 29883, 353, 23350, 1319, 29968, 5495, 580, 13, 1678, 1550, 451, 330, 29883, 29889, 21174, 29918, 3707, 29901, 13, 4706, 1018, 29901, 13, 9651, 848, 29918, 1767, 353, 29871, 29900, 29889, 29900, 13, 9651, 396, 383, 3486, 848, 515, 16020, 294, 29884, 568, 1923, 13, 9651, 1018, 29901, 13, 18884, 2933, 353, 7274, 29889, 657, 29898, 12863, 1535, 29918, 2271, 29892, 11815, 29922, 29945, 29897, 13, 18884, 5694, 29918, 1272, 353, 4390, 29889, 18132, 29898, 5327, 29889, 726, 29897, 13, 18884, 848, 29918, 1767, 353, 1051, 29898, 7382, 29918, 1272, 29889, 5975, 3101, 29961, 29900, 29962, 13, 9651, 5174, 29901, 13, 18884, 1596, 29898, 29888, 29908, 2744, 1059, 10761, 1550, 1811, 304, 6699, 10430, 2767, 29889, 426, 15003, 1627, 29889, 4830, 29918, 735, 29883, 580, 27195, 13, 18884, 10430, 353, 376, 29900, 29889, 29900, 29908, 13, 9651, 396, 3967, 304, 1889, 848, 13, 9651, 1018, 29901, 13, 18884, 10430, 29901, 851, 353, 848, 29918, 1767, 13, 18884, 5785, 29918, 12863, 1535, 353, 5785, 29898, 12863, 1535, 29897, 29871, 396, 4320, 304, 5785, 29889, 565, 445, 8465, 313, 8516, 29897, 591, 2113, 29915, 29873, 2436, 372, 304, 8086, 13, 9651, 5174, 29901, 13, 18884, 1596, 29898, 29888, 29908, 2744, 1059, 10761, 1550, 1811, 304, 6699, 10430, 2767, 29889, 426, 15003, 1627, 29889, 4830, 29918, 735, 29883, 580, 27195, 13, 18884, 10430, 353, 376, 29906, 29900, 29889, 29900, 29908, 13, 9651, 396, 14491, 995, 297, 13524, 2761, 934, 13, 9651, 411, 1722, 29898, 29888, 23901, 12963, 6451, 19248, 5182, 29918, 9507, 17671, 376, 29893, 1159, 408, 10430, 29918, 1445, 29901, 13, 18884, 1596, 29898, 29888, 29908, 29816, 4094, 10430, 2767, 29901, 426, 12863, 1535, 27195, 13, 18884, 10430, 353, 10430, 29889, 6506, 17350, 613, 9162, 1159, 13, 18884, 10430, 29918, 1445, 29889, 3539, 29898, 12863, 1535, 29897, 13, 4706, 5174, 29901, 13, 9651, 1596, 29898, 29888, 29908, 2744, 1059, 10761, 1550, 1811, 304, 3787, 10430, 2767, 29889, 426, 15003, 1627, 29889, 4830, 29918, 735, 29883, 580, 27195, 13, 9651, 1209, 13, 4706, 363, 6795, 297, 3464, 29898, 29900, 29892, 938, 29898, 5504, 29918, 10745, 23860, 22164, 13, 9651, 931, 29889, 17059, 29898, 29896, 29889, 29900, 29897, 13, 9651, 565, 330, 29883, 29889, 21174, 29918, 3707, 29901, 13, 18884, 2867, 13, 2 ]
hardware/opentrons_hardware/drivers/can_bus/can_messenger.py
mrod0101/opentrons
0
161649
<reponame>mrod0101/opentrons<filename>hardware/opentrons_hardware/drivers/can_bus/can_messenger.py """Can messenger class.""" import asyncio from typing import List, Optional import logging from opentrons_hardware.drivers.can_bus import ( CanDriver, NodeId, ArbitrationId, ArbitrationIdParts, CanMessage, MessageId, ) from abc import ABC, abstractmethod from opentrons_hardware.drivers.can_bus.messages.messages import ( MessageDefinition, get_definition, ) from opentrons_hardware.utils import BinarySerializableException log = logging.getLogger(__name__) class MessageListener(ABC): """Incoming message listener.""" @abstractmethod def on_message(self, message: MessageDefinition) -> None: """A new message arrived.""" ... class CanMessenger: """High level can messaging class wrapping a CanDriver. The background task can be controlled with start/stop methods. To receive message notifications add a listener using add_listener """ def __init__(self, driver: CanDriver) -> None: """Constructor. Args: driver: The can bus driver to use. """ self._drive = driver self._listeners: List[MessageListener] = [] self._task: Optional[asyncio.Task[None]] = None async def send(self, node_id: NodeId, message: MessageDefinition) -> None: """Send a message.""" # TODO (amit, 2021-11-05): Use function code when it is better defined. arbitration_id = ArbitrationId( parts=ArbitrationIdParts( message_id=message.message_id, node_id=node_id, function_code=0 ) ) data = message.payload.serialize() log.debug( f"Sending -->\n\tarbitration_id: {arbitration_id},\n\t" f"payload: {message.payload}" ) await self._drive.send( message=CanMessage(arbitration_id=arbitration_id, data=data) ) def start(self) -> None: """Start the reader task.""" if self._task: log.warning("task already running.") return self._task = asyncio.get_event_loop().create_task(self._read_task()) async def stop(self) -> None: """Stop the reader task.""" if self._task: self._task.cancel() try: await self._task except asyncio.CancelledError: log.info("Task cancelled.") else: log.warning("task not running.") def add_listener(self, listener: MessageListener) -> None: """Add a message listener.""" self._listeners.append(listener) def remove_listener(self, listener: MessageListener) -> None: """Remove a message listener.""" self._listeners.remove(listener) async def _read_task(self) -> None: """Read task.""" async for message in self._drive: message_definition = get_definition( MessageId(message.arbitration_id.parts.message_id) ) if message_definition: try: build = message_definition.payload_type.build(message.data) log.debug( f"Received <--\n\tarbitration_id: {message.arbitration_id},\n\t" f"payload: {build}" ) for listener in self._listeners: listener.on_message(message_definition(payload=build)) # type: ignore[arg-type] # noqa: E501 except BinarySerializableException: log.exception(f"Failed to build from {message}") else: log.error(f"Message {message} is not recognized.")
[ 1, 529, 276, 1112, 420, 29958, 29885, 5964, 29900, 29896, 29900, 29896, 29914, 459, 296, 12628, 29966, 9507, 29958, 6800, 2519, 29914, 459, 296, 12628, 29918, 6800, 2519, 29914, 24477, 874, 29914, 3068, 29918, 8262, 29914, 3068, 29918, 29885, 9957, 914, 29889, 2272, 13, 15945, 29908, 6028, 4473, 15109, 770, 1213, 15945, 13, 5215, 408, 948, 3934, 13, 3166, 19229, 1053, 2391, 29892, 28379, 13, 5215, 12183, 13, 13, 3166, 1015, 296, 12628, 29918, 6800, 2519, 29889, 24477, 874, 29889, 3068, 29918, 8262, 1053, 313, 13, 1678, 1815, 12376, 29892, 13, 1678, 9071, 1204, 29892, 13, 1678, 826, 8844, 362, 1204, 29892, 13, 1678, 826, 8844, 362, 1204, 29925, 5708, 29892, 13, 1678, 1815, 3728, 29892, 13, 1678, 7777, 1204, 29892, 13, 29897, 13, 3166, 25638, 1053, 16417, 29892, 9846, 5696, 13, 13, 3166, 1015, 296, 12628, 29918, 6800, 2519, 29889, 24477, 874, 29889, 3068, 29918, 8262, 29889, 19158, 29889, 19158, 1053, 313, 13, 1678, 7777, 14683, 29892, 13, 1678, 679, 29918, 16553, 29892, 13, 29897, 13, 3166, 1015, 296, 12628, 29918, 6800, 2519, 29889, 13239, 1053, 29479, 9125, 13902, 2451, 13, 13, 1188, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 7777, 3962, 29898, 19658, 1125, 13, 1678, 9995, 797, 11506, 2643, 13254, 1213, 15945, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 373, 29918, 4906, 29898, 1311, 29892, 2643, 29901, 7777, 14683, 29897, 1599, 6213, 29901, 13, 4706, 9995, 29909, 716, 2643, 11977, 1213, 15945, 13, 4706, 2023, 13, 13, 13, 1990, 1815, 29924, 9957, 914, 29901, 13, 1678, 9995, 16382, 3233, 508, 4473, 6751, 770, 28489, 263, 1815, 12376, 29889, 13, 13, 1678, 450, 3239, 3414, 508, 367, 20704, 411, 1369, 29914, 9847, 3519, 29889, 13, 13, 1678, 1763, 7150, 2643, 25913, 788, 263, 13254, 773, 788, 29918, 25894, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7156, 29901, 1815, 12376, 29897, 1599, 6213, 29901, 13, 4706, 9995, 23770, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 7156, 29901, 450, 508, 3593, 7156, 304, 671, 29889, 13, 4706, 9995, 13, 4706, 1583, 3032, 21594, 353, 7156, 13, 4706, 1583, 3032, 20631, 414, 29901, 2391, 29961, 3728, 3962, 29962, 353, 5159, 13, 4706, 1583, 3032, 7662, 29901, 28379, 29961, 294, 948, 3934, 29889, 5398, 29961, 8516, 5262, 353, 6213, 13, 13, 1678, 7465, 822, 3638, 29898, 1311, 29892, 2943, 29918, 333, 29901, 9071, 1204, 29892, 2643, 29901, 7777, 14683, 29897, 1599, 6213, 29901, 13, 4706, 9995, 12600, 263, 2643, 1213, 15945, 13, 4706, 396, 14402, 313, 314, 277, 29892, 29871, 29906, 29900, 29906, 29896, 29899, 29896, 29896, 29899, 29900, 29945, 1125, 4803, 740, 775, 746, 372, 338, 2253, 3342, 29889, 13, 4706, 9727, 362, 29918, 333, 353, 826, 8844, 362, 1204, 29898, 13, 9651, 5633, 29922, 1433, 8844, 362, 1204, 29925, 5708, 29898, 13, 18884, 2643, 29918, 333, 29922, 4906, 29889, 4906, 29918, 333, 29892, 2943, 29918, 333, 29922, 3177, 29918, 333, 29892, 740, 29918, 401, 29922, 29900, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 848, 353, 2643, 29889, 23813, 29889, 643, 6646, 580, 13, 4706, 1480, 29889, 8382, 29898, 13, 9651, 285, 29908, 29903, 2548, 6660, 29905, 29876, 29905, 12637, 8844, 362, 29918, 333, 29901, 426, 279, 8844, 362, 29918, 333, 7570, 29876, 29905, 29873, 29908, 13, 9651, 285, 29908, 23813, 29901, 426, 4906, 29889, 23813, 5038, 13, 4706, 1723, 13, 4706, 7272, 1583, 3032, 21594, 29889, 6717, 29898, 13, 9651, 2643, 29922, 6028, 3728, 29898, 279, 8844, 362, 29918, 333, 29922, 279, 8844, 362, 29918, 333, 29892, 848, 29922, 1272, 29897, 13, 4706, 1723, 13, 13, 1678, 822, 1369, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 4763, 278, 9591, 3414, 1213, 15945, 13, 4706, 565, 1583, 3032, 7662, 29901, 13, 9651, 1480, 29889, 27392, 703, 7662, 2307, 2734, 23157, 13, 9651, 736, 13, 4706, 1583, 3032, 7662, 353, 408, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 2141, 3258, 29918, 7662, 29898, 1311, 3032, 949, 29918, 7662, 3101, 13, 13, 1678, 7465, 822, 5040, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 16329, 278, 9591, 3414, 1213, 15945, 13, 4706, 565, 1583, 3032, 7662, 29901, 13, 9651, 1583, 3032, 7662, 29889, 20713, 580, 13, 9651, 1018, 29901, 13, 18884, 7272, 1583, 3032, 7662, 13, 9651, 5174, 408, 948, 3934, 29889, 19420, 839, 2392, 29901, 13, 18884, 1480, 29889, 3888, 703, 5398, 12611, 839, 23157, 13, 4706, 1683, 29901, 13, 9651, 1480, 29889, 27392, 703, 7662, 451, 2734, 23157, 13, 13, 1678, 822, 788, 29918, 25894, 29898, 1311, 29892, 13254, 29901, 7777, 3962, 29897, 1599, 6213, 29901, 13, 4706, 9995, 2528, 263, 2643, 13254, 1213, 15945, 13, 4706, 1583, 3032, 20631, 414, 29889, 4397, 29898, 25894, 29897, 13, 13, 1678, 822, 3349, 29918, 25894, 29898, 1311, 29892, 13254, 29901, 7777, 3962, 29897, 1599, 6213, 29901, 13, 4706, 9995, 15941, 263, 2643, 13254, 1213, 15945, 13, 4706, 1583, 3032, 20631, 414, 29889, 5992, 29898, 25894, 29897, 13, 13, 1678, 7465, 822, 903, 949, 29918, 7662, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6359, 3414, 1213, 15945, 13, 4706, 7465, 363, 2643, 297, 1583, 3032, 21594, 29901, 13, 9651, 2643, 29918, 16553, 353, 679, 29918, 16553, 29898, 13, 18884, 7777, 1204, 29898, 4906, 29889, 279, 8844, 362, 29918, 333, 29889, 20895, 29889, 4906, 29918, 333, 29897, 13, 9651, 1723, 13, 9651, 565, 2643, 29918, 16553, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 2048, 353, 2643, 29918, 16553, 29889, 23813, 29918, 1853, 29889, 4282, 29898, 4906, 29889, 1272, 29897, 13, 462, 1678, 1480, 29889, 8382, 29898, 13, 462, 4706, 285, 29908, 29816, 529, 489, 29905, 29876, 29905, 12637, 8844, 362, 29918, 333, 29901, 426, 4906, 29889, 279, 8844, 362, 29918, 333, 7570, 29876, 29905, 29873, 29908, 13, 462, 4706, 285, 29908, 23813, 29901, 426, 4282, 5038, 13, 462, 1678, 1723, 13, 462, 1678, 363, 13254, 297, 1583, 3032, 20631, 414, 29901, 13, 462, 4706, 13254, 29889, 265, 29918, 4906, 29898, 4906, 29918, 16553, 29898, 23813, 29922, 4282, 876, 29871, 396, 1134, 29901, 11455, 29961, 1191, 29899, 1853, 29962, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 18884, 5174, 29479, 9125, 13902, 2451, 29901, 13, 462, 1678, 1480, 29889, 11739, 29898, 29888, 29908, 17776, 304, 2048, 515, 426, 4906, 27195, 13, 9651, 1683, 29901, 13, 18884, 1480, 29889, 2704, 29898, 29888, 29908, 3728, 426, 4906, 29913, 338, 451, 14831, 23157, 13, 2 ]
api.py
klapp101/GOAT
1
26525
import json import requests import time from discord_webhook import DiscordWebhook, DiscordEmbed webhook_url = 'https://discordapp.com/api/webhooks/672159508675690497/4UtaClAc7rKMJsEvbR4iYf-Razv4M3ZWtkYDOxBzLfiDzJhI7RSFpoLn6iijBiRcaNOR' webhook = DiscordWebhook(webhook_url) pid = '508214-660' headers = { 'Connection': 'keep-alive', 'accept': 'application/json', 'Origin': 'https://www.goat.com', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', 'content-type': 'application/x-www-form-urlencoded', 'Sec-Fetch-Site': 'cross-site', 'Sec-Fetch-Mode': 'cors', 'Referer': 'https://www.goat.com/search?query='+ pid, 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.9', } params = { 'x-algolia-agent': 'Algolia for vanilla JavaScript 3.25.1', 'x-algolia-application-id': '2FWOTDVM2O', 'x-algolia-api-key': 'ac96de6fef0e02bb95d433d8d5c7038a', } data = { "distinct": 'true', 'facetFilters': 'product_category: shoes', 'facets': 'size', 'hitsPerPage': '48', 'numericFilters': '[]', 'page': '0', 'query': pid, 'clickAnalytics': "true" } response = requests.post('https://2fwotdvm2o-dsn.algolia.net/1/indexes/product_variants_v2/query', headers=headers, params=params,json=data) response_json = response.json() response_json_dict = response_json['hits'][0] product_id = response_json_dict['product_template_id'] print(product_id) def obtainBasicInfo(): webhook = DiscordWebhook(url=webhook_url) r_api = requests.get('https://www.goat.com/web-api/v1/product_variants?productTemplateId='+ str(product_id),headers=headers) data = r_api.json() embed = DiscordEmbed(title=response_json_dict['name'], url=headers['Referer'], color=242424) embed.set_thumbnail(url=response_json_dict['main_picture_url']) sizes = [] shoe_conditions = [] box_conditions = [] prices = [] for i in data: sizes.append(str(i['size'])) shoe_conditions.append(i['shoeCondition']) box_conditions.append(i['boxCondition']) prices.append(str(int(i['lowestPriceCents']['amountUsdCents'])/100)) print(' Size: ' + str(i['size']) + '\n' + ' Shoe condition: ' + i['shoeCondition'] + '\n' + ' Box condition: ' + i['boxCondition'] + '\n' + ' $' + str(int(i['lowestPriceCents']['amountUsdCents'])/100) + '\n' + '-----------------') embed.add_embed_field(name='Size', value=(str(i['size']))) embed.add_embed_field(name='Shoe Condition', value=str(i['shoeCondition'])) embed.add_embed_field(name='Box Condition', value=str(i['boxCondition'])) embed.add_embed_field(name='Price', value='$' + str(int(i['lowestPriceCents']['amountUsdCents'])/100)) webhook.add_embed(embed) send_hook = webhook.execute() time.sleep(2) embed.fields = [] print(sizes) print(shoe_conditions) print(box_conditions) print(prices) obtainBasicInfo()
[ 1, 1053, 4390, 13, 5215, 7274, 13, 5215, 931, 13, 3166, 2313, 536, 29918, 2676, 20849, 1053, 8565, 536, 3609, 20849, 29892, 8565, 536, 6026, 2580, 13, 13, 2676, 20849, 29918, 2271, 353, 525, 991, 597, 2218, 16090, 932, 29889, 510, 29914, 2754, 29914, 2676, 1251, 12117, 29914, 29953, 29955, 29906, 29896, 29945, 29929, 29945, 29900, 29947, 29953, 29955, 29945, 29953, 29929, 29900, 29946, 29929, 29955, 29914, 29946, 29965, 941, 6821, 10644, 29955, 29878, 29968, 29924, 25498, 29923, 24666, 29934, 29946, 29875, 29979, 29888, 29899, 29934, 834, 29894, 29946, 29924, 29941, 29999, 29956, 11178, 29979, 3970, 29916, 29933, 29920, 29931, 7241, 29928, 29920, 29967, 29882, 29902, 29955, 12445, 29943, 1129, 29931, 29876, 29953, 29875, 823, 20517, 29934, 1113, 29940, 1955, 29915, 13, 2676, 20849, 353, 8565, 536, 3609, 20849, 29898, 2676, 20849, 29918, 2271, 29897, 13, 5935, 353, 525, 29945, 29900, 29947, 29906, 29896, 29946, 29899, 29953, 29953, 29900, 29915, 13, 13662, 353, 426, 13, 1678, 525, 5350, 2396, 525, 17462, 29899, 284, 573, 742, 13, 1678, 525, 16044, 2396, 525, 6214, 29914, 3126, 742, 13, 1678, 525, 23182, 2396, 525, 991, 597, 1636, 29889, 1484, 271, 29889, 510, 742, 13, 1678, 525, 2659, 29899, 19661, 2396, 525, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 15735, 524, 10578, 29936, 18555, 4326, 6570, 1060, 29871, 29896, 29900, 29918, 29896, 29946, 29918, 29953, 29897, 12113, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10228, 29914, 29955, 29929, 29889, 29900, 29889, 29941, 29929, 29946, 29945, 29889, 29947, 29947, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 742, 13, 1678, 525, 3051, 29899, 1853, 2396, 525, 6214, 29914, 29916, 29899, 1636, 29899, 689, 29899, 2271, 26716, 742, 13, 1678, 525, 7898, 29899, 20927, 29899, 17033, 2396, 525, 19128, 29899, 2746, 742, 13, 1678, 525, 7898, 29899, 20927, 29899, 6818, 2396, 525, 29883, 943, 742, 13, 1678, 525, 1123, 571, 261, 2396, 525, 991, 597, 1636, 29889, 1484, 271, 29889, 510, 29914, 4478, 29973, 1972, 2433, 29974, 23107, 29892, 13, 1678, 525, 23965, 29899, 14934, 2396, 525, 29887, 7554, 29892, 822, 9632, 29892, 1506, 742, 13, 1678, 525, 23965, 29899, 21233, 2396, 525, 264, 29899, 3308, 29892, 264, 29936, 29939, 29922, 29900, 29889, 29929, 742, 13, 29913, 13, 13, 7529, 353, 426, 13, 1678, 525, 29916, 29899, 9564, 18001, 29899, 14748, 2396, 525, 22461, 18001, 363, 1109, 2911, 8286, 29871, 29941, 29889, 29906, 29945, 29889, 29896, 742, 13, 1678, 525, 29916, 29899, 9564, 18001, 29899, 6214, 29899, 333, 2396, 525, 29906, 29943, 29956, 2891, 29928, 9219, 29906, 29949, 742, 13, 1678, 525, 29916, 29899, 9564, 18001, 29899, 2754, 29899, 1989, 2396, 525, 562, 29929, 29953, 311, 29953, 29888, 1389, 29900, 29872, 29900, 29906, 1327, 29929, 29945, 29881, 29946, 29941, 29941, 29881, 29947, 29881, 29945, 29883, 29955, 29900, 29941, 29947, 29874, 742, 13, 29913, 13, 13, 1272, 353, 426, 13, 1678, 376, 5721, 5562, 1115, 525, 3009, 742, 13, 1678, 525, 17470, 300, 3434, 2153, 2396, 525, 4704, 29918, 7320, 29901, 17394, 267, 742, 13, 1678, 525, 17470, 1691, 2396, 525, 2311, 742, 13, 1678, 525, 29882, 1169, 5894, 5074, 2396, 525, 29946, 29947, 742, 13, 1678, 525, 21574, 3434, 2153, 2396, 525, 2636, 742, 13, 1678, 525, 3488, 2396, 525, 29900, 742, 13, 1678, 525, 1972, 2396, 23107, 29892, 13, 1678, 525, 3808, 21067, 22026, 2396, 376, 3009, 29908, 13, 29913, 13, 5327, 353, 7274, 29889, 2490, 877, 991, 597, 29906, 25051, 327, 29881, 6925, 29906, 29877, 29899, 6289, 29876, 29889, 9564, 18001, 29889, 1212, 29914, 29896, 29914, 2248, 267, 29914, 4704, 29918, 5927, 1934, 29918, 29894, 29906, 29914, 1972, 742, 9066, 29922, 13662, 29892, 8636, 29922, 7529, 29892, 3126, 29922, 1272, 29897, 13, 5327, 29918, 3126, 353, 2933, 29889, 3126, 580, 13, 5327, 29918, 3126, 29918, 8977, 353, 2933, 29918, 3126, 1839, 29882, 1169, 2033, 29961, 29900, 29962, 13, 4704, 29918, 333, 353, 2933, 29918, 3126, 29918, 8977, 1839, 4704, 29918, 6886, 29918, 333, 2033, 13, 2158, 29898, 4704, 29918, 333, 29897, 13, 13, 1753, 4017, 16616, 3401, 7295, 13, 1678, 1856, 20849, 353, 8565, 536, 3609, 20849, 29898, 2271, 29922, 2676, 20849, 29918, 2271, 29897, 13, 1678, 364, 29918, 2754, 353, 7274, 29889, 657, 877, 991, 597, 1636, 29889, 1484, 271, 29889, 510, 29914, 2676, 29899, 2754, 29914, 29894, 29896, 29914, 4704, 29918, 5927, 1934, 29973, 4704, 6733, 1204, 2433, 29974, 851, 29898, 4704, 29918, 333, 511, 13662, 29922, 13662, 29897, 13, 1678, 848, 353, 364, 29918, 2754, 29889, 3126, 580, 13, 1678, 8297, 353, 8565, 536, 6026, 2580, 29898, 3257, 29922, 5327, 29918, 3126, 29918, 8977, 1839, 978, 7464, 3142, 29922, 13662, 1839, 1123, 571, 261, 7464, 2927, 29922, 29906, 29946, 29906, 29946, 29906, 29946, 29897, 13, 1678, 8297, 29889, 842, 29918, 386, 21145, 29898, 2271, 29922, 5327, 29918, 3126, 29918, 8977, 1839, 3396, 29918, 12095, 29918, 2271, 11287, 13, 1678, 15786, 353, 5159, 13, 1678, 528, 7297, 29918, 1116, 2187, 353, 5159, 13, 1678, 3800, 29918, 1116, 2187, 353, 5159, 13, 1678, 26094, 353, 5159, 13, 1678, 363, 474, 297, 848, 29901, 13, 4706, 15786, 29889, 4397, 29898, 710, 29898, 29875, 1839, 2311, 25901, 13, 4706, 528, 7297, 29918, 1116, 2187, 29889, 4397, 29898, 29875, 1839, 845, 7297, 25255, 11287, 13, 4706, 3800, 29918, 1116, 2187, 29889, 4397, 29898, 29875, 1839, 1884, 25255, 11287, 13, 4706, 26094, 29889, 4397, 29898, 710, 29898, 524, 29898, 29875, 1839, 677, 342, 13026, 29907, 1237, 16215, 14506, 29965, 4928, 29907, 1237, 2033, 6802, 29896, 29900, 29900, 876, 13, 4706, 1596, 877, 21179, 29901, 525, 718, 851, 29898, 29875, 1839, 2311, 11287, 718, 11297, 29876, 29915, 718, 525, 17550, 29872, 4195, 29901, 525, 718, 474, 1839, 845, 7297, 25255, 2033, 718, 11297, 29876, 29915, 718, 525, 11773, 4195, 29901, 525, 718, 474, 1839, 1884, 25255, 2033, 718, 11297, 29876, 29915, 718, 525, 395, 29915, 718, 851, 29898, 524, 29898, 29875, 1839, 677, 342, 13026, 29907, 1237, 16215, 14506, 29965, 4928, 29907, 1237, 2033, 6802, 29896, 29900, 29900, 29897, 718, 11297, 29876, 29915, 718, 525, 2683, 29899, 1495, 13, 4706, 8297, 29889, 1202, 29918, 17987, 29918, 2671, 29898, 978, 2433, 3505, 742, 995, 7607, 710, 29898, 29875, 1839, 2311, 2033, 4961, 13, 4706, 8297, 29889, 1202, 29918, 17987, 29918, 2671, 29898, 978, 2433, 29903, 1251, 29872, 11790, 654, 742, 995, 29922, 710, 29898, 29875, 1839, 845, 7297, 25255, 25901, 13, 4706, 8297, 29889, 1202, 29918, 17987, 29918, 2671, 29898, 978, 2433, 3313, 11790, 654, 742, 995, 29922, 710, 29898, 29875, 1839, 1884, 25255, 25901, 13, 4706, 8297, 29889, 1202, 29918, 17987, 29918, 2671, 29898, 978, 2433, 13026, 742, 995, 2433, 29938, 29915, 718, 851, 29898, 524, 29898, 29875, 1839, 677, 342, 13026, 29907, 1237, 16215, 14506, 29965, 4928, 29907, 1237, 2033, 6802, 29896, 29900, 29900, 876, 13, 4706, 1856, 20849, 29889, 1202, 29918, 17987, 29898, 17987, 29897, 13, 4706, 3638, 29918, 20849, 353, 1856, 20849, 29889, 7978, 580, 13, 4706, 931, 29889, 17059, 29898, 29906, 29897, 13, 4706, 8297, 29889, 9621, 353, 5159, 13, 1678, 1596, 29898, 29879, 7093, 29897, 13, 1678, 1596, 29898, 845, 7297, 29918, 1116, 2187, 29897, 13, 1678, 1596, 29898, 1884, 29918, 1116, 2187, 29897, 13, 1678, 1596, 29898, 558, 1575, 29897, 13, 13, 13, 711, 2408, 16616, 3401, 580, 13, 2 ]
coptim/functions/rosenbrock.py
cmazzaanthony/Optimization_Algorithms
3
27697
<reponame>cmazzaanthony/Optimization_Algorithms import numpy as np from coptim.function import Function class Rosenbrock(Function): def eval(self, x): assert len(x) == 2, '2 dimensional input only.' return 100 * (x[1] - x[0] ** 2) ** 2 + (1 - x[0]) ** 2 def gradient(self, x): assert len(x) == 2, '2 dimensional input only.' return np.array([ 2 * (-200 * x[0] * x[1] + 200 * np.power(x[0], 3) - 1 + x[0]), 200 * (x[1] - x[0] ** 2) ]) def hessian(self, x): assert len(x) == 2, '2 dimensional input only.' df_dx1 = -400 * x[1] + 1200 * x[0] ** 2 + 2 df_dx1dx2 = -400 * x[0] df_dx2dx1 = -400 * x[0] df_dx2 = 200 return np.array([[df_dx1, df_dx1dx2], [df_dx2dx1, df_dx2]])
[ 1, 529, 276, 1112, 420, 29958, 29883, 655, 10177, 9716, 2592, 29914, 20624, 326, 2133, 29918, 22461, 12404, 13, 5215, 12655, 408, 7442, 13, 3166, 1302, 415, 326, 29889, 2220, 1053, 6680, 13, 13, 13, 1990, 28929, 6729, 384, 29898, 6678, 1125, 13, 13, 1678, 822, 19745, 29898, 1311, 29892, 921, 1125, 13, 4706, 4974, 7431, 29898, 29916, 29897, 1275, 29871, 29906, 29892, 525, 29906, 22112, 1881, 871, 6169, 13, 4706, 736, 29871, 29896, 29900, 29900, 334, 313, 29916, 29961, 29896, 29962, 448, 921, 29961, 29900, 29962, 3579, 29871, 29906, 29897, 3579, 29871, 29906, 718, 313, 29896, 448, 921, 29961, 29900, 2314, 3579, 29871, 29906, 13, 13, 1678, 822, 16030, 29898, 1311, 29892, 921, 1125, 13, 4706, 4974, 7431, 29898, 29916, 29897, 1275, 29871, 29906, 29892, 525, 29906, 22112, 1881, 871, 6169, 13, 4706, 736, 7442, 29889, 2378, 4197, 13, 632, 29906, 334, 8521, 29906, 29900, 29900, 334, 921, 29961, 29900, 29962, 334, 921, 29961, 29896, 29962, 718, 29871, 29906, 29900, 29900, 334, 7442, 29889, 13519, 29898, 29916, 29961, 29900, 1402, 29871, 29941, 29897, 448, 29871, 29896, 718, 921, 29961, 29900, 11724, 13, 632, 29906, 29900, 29900, 334, 313, 29916, 29961, 29896, 29962, 448, 921, 29961, 29900, 29962, 3579, 29871, 29906, 29897, 13, 308, 2314, 13, 13, 1678, 822, 298, 404, 713, 29898, 1311, 29892, 921, 1125, 13, 4706, 4974, 7431, 29898, 29916, 29897, 1275, 29871, 29906, 29892, 525, 29906, 22112, 1881, 871, 6169, 13, 4706, 4489, 29918, 8235, 29896, 353, 448, 29946, 29900, 29900, 334, 921, 29961, 29896, 29962, 718, 29871, 29896, 29906, 29900, 29900, 334, 921, 29961, 29900, 29962, 3579, 29871, 29906, 718, 29871, 29906, 13, 4706, 4489, 29918, 8235, 29896, 8235, 29906, 353, 448, 29946, 29900, 29900, 334, 921, 29961, 29900, 29962, 13, 4706, 4489, 29918, 8235, 29906, 8235, 29896, 353, 448, 29946, 29900, 29900, 334, 921, 29961, 29900, 29962, 13, 4706, 4489, 29918, 8235, 29906, 353, 29871, 29906, 29900, 29900, 13, 13, 4706, 736, 7442, 29889, 2378, 4197, 29961, 2176, 29918, 8235, 29896, 29892, 4489, 29918, 8235, 29896, 8235, 29906, 1402, 518, 2176, 29918, 8235, 29906, 8235, 29896, 29892, 4489, 29918, 8235, 29906, 24960, 13, 2 ]
tripleo_ansible/ansible_plugins/modules/tripleo_nova_image_cache.py
pavankrao/tripleo-ansible
0
1609587
<gh_stars>0 #!/usr/bin/python # Copyright 2019 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from __future__ import absolute_import __metaclass__ = type from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.openstack import openstack_cloud_from_module from ansible.module_utils.openstack import openstack_full_argument_spec from ansible.module_utils.openstack import openstack_module_kwargs import datetime import hashlib import os import tempfile import time ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = ''' --- module: tripleo_nova_image_cache short_description: Manage Nova image cache on TripleO OpenStack deployment version_added: "2.0" author: "<NAME> (@owalsh)" description: - Manage Nova image cache on TripleO OpenStack deployment options: id: description: - ID of the image to cache required: true ttl: description: - Ensure the image remains cached for at least ttl days default: 7 state: description: - Whether the image be present in cache or expired (nova should delete it later if it is no longer used) choices: [present, expired] default: present scp_source: description: - Attempt to scp the image from this nova-compute host scp_continue_on_error: description: - Fallback to image download if scp fails default: false requirements: ["openstacksdk"] ''' EXAMPLES = ''' - name: Cache image for at least 2 weeks tripleo_nova_image_cache: id: ec151bd1-aab4-413c-b577-ced089e7d3f8 ttl: 14 - name: Allow nova to cleanup this image from cache tripleo_nova_image_cache: id: ec151bd1-aab4-413c-b577-ced089e7d3f8 state: expired - name: Cache image, try to copy from existing host tripleo_nova_image_cache: id: ec151bd1-aab4-413c-b577-ced089e7d3f8 ttl: 14 scp_source: nova-compute-0 scp_continue_on_error: true ''' def ttl_to_ts(ttl_days): """Return a timestamp at midnight UTC ttl_days in the future""" epoch = datetime.datetime.utcfromtimestamp(0) midnight_today = datetime.datetime.utcnow().replace( hour=0, minute=0, second=0, microsecond=0) expiry = midnight_today + datetime.timedelta(days=ttl_days+1) return (expiry - epoch).total_seconds() def main(): argument_spec = openstack_full_argument_spec( id=dict(required=True), ttl=dict(default=7, type='int', min=1), state=dict(default='present', choices=['expired', 'present']), _cache_dir=dict(required=True), _cache_file=dict(required=True), _chunk_size=dict(default=64 * 1024, type='int'), _prefetched_path=dict(default=None), scp_continue_on_error=dict(default=False, type='bool') ) module_kwargs = openstack_module_kwargs() module = AnsibleModule(argument_spec, **module_kwargs) image_id = module.params['id'] cache_dir = module.params['_cache_dir'] cache_file = module.params['_cache_file'] chunk_size = module.params['_chunk_size'] prefetched_path = module.params['_prefetched_path'] scp_continue = module.params['scp_continue_on_error'] ttl_days = module.params['ttl'] result = dict( changed=False, actions=[], image=None, cache_file='', exists_in_cache=False, mtime=0 ) sdk, cloud = openstack_cloud_from_module(module, min_version='0.11.3') try: result['exists_in_cache'] = exists_in_cache = os.path.exists( cache_file) if exists_in_cache: result['cache_file'] = cache_file image = cloud.image.find_image(name_or_id=image_id) exists_in_glance = image is not None if exists_in_glance: result['image'] = image.to_dict() if module.params['state'] == 'present': if not exists_in_cache: if not exists_in_glance: module.fail_json( msg="Image not found in glance: %s" % image_id) md5 = hashlib.md5() if prefetched_path: result['actions'].append({ 'name': 'Verify pre-fetched image checksum' }) with open(prefetched_path, 'rb') as prefetched_image_file: while True: chunk = prefetched_image_file.read(chunk_size) if not chunk: break md5.update(chunk) prefetched_checksum = md5.hexdigest() if prefetched_checksum == image.checksum: result['actions'].append({ 'name': 'Verify pre-fetched image', 'result': True, 'expected_md5': image.checksum, 'actual_md5': prefetched_checksum }) # FIXME: chown to the container nova uid (42436) # until we can run within the container os.chown(prefetched_path, 42436, 42436) os.rename(prefetched_path, cache_file) else: result['actions'].append({ 'name': 'Verify pre-fetched image', 'result': False, 'expected_md5': image.checksum, 'actual_md5': prefetched_checksum }) if not scp_continue: module.fail_json( msg="Pre-fetched image checksum failed") # Ignore it and download direct from glance. # As we did not create it we should not remove it. prefetched_path = '' if not prefetched_path: with tempfile.NamedTemporaryFile( 'wb', dir=cache_dir, delete=False) as temp_cache_file: try: md5 = hashlib.md5() image_stream = cloud.image.download_image( image, stream=True ) try: for chunk in image_stream.iter_content( chunk_size=chunk_size): md5.update(chunk) temp_cache_file.write(chunk) finally: image_stream.close() temp_cache_file.close() download_checksum = md5.hexdigest() if download_checksum != image.checksum: result['actions'].append({ 'name': 'Verify downloaded image', 'result': False, 'expected_md5': image.checksum, 'actual_md5': download_checksum }) module.fail_json( msg="Image data does not match checksum") result['actions'].append({ 'name': 'Verify downloaded image', 'result': True, 'expected_md5': image.checksum, 'actual_md5': download_checksum }) # FIXME: chown to the container nova uid (42436) # until we can run within the container os.chown(temp_cache_file.name, 42436, 42436) os.rename(temp_cache_file.name, cache_file) result['changed'] = True finally: try: os.unlink(temp_cache_file.name) except Exception: pass # Set the mtime in the future to prevent nova cleanup cache_file_stat = os.stat(cache_file) expiry_ts = ttl_to_ts(ttl_days) now = time.time() if cache_file_stat.st_mtime != expiry_ts: os.utime(cache_file, (now, expiry_ts)) result['actions'].append({ 'name': 'Update mtime', 'from': cache_file_stat.st_mtime, 'to': expiry_ts }) result['changed'] = True else: # expired if not exists_in_cache: result['changed'] = False else: # Set the mtime to epoch to enable nova cleanup now = time.time() ts = 0 cache_file_stat = os.stat(cache_file) if cache_file_stat.st_mtime > ts: os.utime(cache_file, (now, ts)) result['actions'].append({ 'name': 'Update mtime', 'from': cache_file_stat.st_mtime, 'to': ts }) result['changed'] = True cache_file_stat = os.stat(cache_file) result['mtime'] = cache_file_stat.st_mtime result['expires'] = time.strftime( "%a, %d %b %Y %H:%M:%S %z", time.localtime(cache_file_stat.st_mtime) ) module.exit_json(**result) except sdk.exceptions.OpenStackCloudException as e: module.fail_json(msg=str(e), extra_data=e.extra_data) if __name__ == "__main__": main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 4367, 25966, 29892, 9266, 29889, 13, 29937, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 13, 29937, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 887, 1122, 4017, 13, 29937, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 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, 399, 1806, 8187, 2692, 13, 29937, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 13, 29937, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1090, 278, 19245, 29889, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 1649, 2527, 562, 605, 1649, 353, 1134, 13, 13, 3166, 385, 1687, 29889, 5453, 29918, 13239, 29889, 16121, 1053, 530, 1687, 7355, 13, 3166, 385, 1687, 29889, 5453, 29918, 13239, 29889, 3150, 1429, 1053, 1722, 1429, 29918, 9274, 29918, 3166, 29918, 5453, 13, 3166, 385, 1687, 29889, 5453, 29918, 13239, 29889, 3150, 1429, 1053, 1722, 1429, 29918, 8159, 29918, 23516, 29918, 6550, 13, 3166, 385, 1687, 29889, 5453, 29918, 13239, 29889, 3150, 1429, 1053, 1722, 1429, 29918, 5453, 29918, 19290, 13, 5215, 12865, 13, 5215, 6608, 1982, 13, 5215, 2897, 13, 5215, 5694, 1445, 13, 5215, 931, 13, 13, 2190, 5425, 29933, 1307, 29918, 2303, 29911, 3035, 8254, 353, 426, 13, 1678, 525, 19635, 29918, 3259, 2396, 525, 29896, 29889, 29896, 742, 13, 1678, 525, 4882, 2396, 6024, 25347, 7464, 13, 1678, 525, 23765, 29918, 1609, 2396, 525, 23834, 29915, 13, 29913, 13, 13, 13, 28665, 5005, 3919, 8098, 353, 14550, 13, 5634, 13, 5453, 29901, 21954, 29877, 29918, 29876, 4273, 29918, 3027, 29918, 8173, 13, 12759, 29918, 8216, 29901, 2315, 482, 16216, 1967, 7090, 373, 8602, 552, 29949, 4673, 7264, 18209, 13, 3259, 29918, 23959, 29901, 376, 29906, 29889, 29900, 29908, 13, 8921, 29901, 9872, 5813, 29958, 20164, 340, 284, 845, 5513, 13, 8216, 29901, 13, 1678, 448, 2315, 482, 16216, 1967, 7090, 373, 8602, 552, 29949, 4673, 7264, 18209, 13, 6768, 29901, 13, 1678, 1178, 29901, 13, 418, 6139, 29901, 13, 308, 448, 3553, 310, 278, 1967, 304, 7090, 13, 418, 3734, 29901, 1565, 13, 1678, 260, 15206, 29901, 13, 418, 6139, 29901, 13, 308, 448, 22521, 545, 278, 1967, 9242, 22152, 363, 472, 3203, 260, 15206, 3841, 13, 418, 2322, 29901, 29871, 29955, 13, 1678, 2106, 29901, 13, 418, 6139, 29901, 13, 4706, 448, 26460, 278, 1967, 367, 2198, 297, 7090, 470, 1518, 2859, 13, 3986, 313, 29876, 4273, 881, 5217, 372, 2678, 565, 372, 338, 694, 5520, 1304, 29897, 13, 418, 19995, 29901, 518, 6338, 29892, 1518, 2859, 29962, 13, 418, 2322, 29901, 2198, 13, 1678, 885, 29886, 29918, 4993, 29901, 13, 418, 6139, 29901, 13, 4706, 448, 6212, 3456, 304, 885, 29886, 278, 1967, 515, 445, 26121, 29899, 26017, 3495, 13, 1678, 885, 29886, 29918, 19878, 29918, 265, 29918, 2704, 29901, 13, 418, 6139, 29901, 13, 4706, 448, 14053, 1627, 304, 1967, 5142, 565, 885, 29886, 8465, 13, 418, 2322, 29901, 2089, 13, 13, 12277, 1860, 29901, 6796, 3150, 1429, 15348, 3108, 13, 12008, 13, 13, 5746, 19297, 17101, 353, 14550, 13, 29899, 1024, 29901, 28540, 1967, 363, 472, 3203, 29871, 29906, 11405, 13, 29871, 21954, 29877, 29918, 29876, 4273, 29918, 3027, 29918, 8173, 29901, 13, 1678, 1178, 29901, 21226, 29896, 29945, 29896, 6448, 29896, 29899, 29874, 370, 29946, 29899, 29946, 29896, 29941, 29883, 29899, 29890, 29945, 29955, 29955, 29899, 1133, 29900, 29947, 29929, 29872, 29955, 29881, 29941, 29888, 29947, 13, 1678, 260, 15206, 29901, 29871, 29896, 29946, 13, 13, 29899, 1024, 29901, 29408, 26121, 304, 5941, 786, 445, 1967, 515, 7090, 13, 29871, 21954, 29877, 29918, 29876, 4273, 29918, 3027, 29918, 8173, 29901, 13, 1678, 1178, 29901, 21226, 29896, 29945, 29896, 6448, 29896, 29899, 29874, 370, 29946, 29899, 29946, 29896, 29941, 29883, 29899, 29890, 29945, 29955, 29955, 29899, 1133, 29900, 29947, 29929, 29872, 29955, 29881, 29941, 29888, 29947, 13, 1678, 2106, 29901, 1518, 2859, 13, 13, 29899, 1024, 29901, 28540, 1967, 29892, 1018, 304, 3509, 515, 5923, 3495, 13, 29871, 21954, 29877, 29918, 29876, 4273, 29918, 3027, 29918, 8173, 29901, 13, 1678, 1178, 29901, 21226, 29896, 29945, 29896, 6448, 29896, 29899, 29874, 370, 29946, 29899, 29946, 29896, 29941, 29883, 29899, 29890, 29945, 29955, 29955, 29899, 1133, 29900, 29947, 29929, 29872, 29955, 29881, 29941, 29888, 29947, 13, 1678, 260, 15206, 29901, 29871, 29896, 29946, 13, 1678, 885, 29886, 29918, 4993, 29901, 26121, 29899, 26017, 29899, 29900, 13, 1678, 885, 29886, 29918, 19878, 29918, 265, 29918, 2704, 29901, 1565, 13, 13, 12008, 13, 13, 13, 1753, 260, 15206, 29918, 517, 29918, 1372, 29898, 698, 29880, 29918, 16700, 1125, 13, 1678, 9995, 11609, 263, 14334, 472, 7145, 11147, 17998, 260, 15206, 29918, 16700, 297, 278, 5434, 15945, 29908, 13, 1678, 21502, 305, 353, 12865, 29889, 12673, 29889, 329, 29883, 3166, 16394, 29898, 29900, 29897, 13, 1678, 7145, 11147, 29918, 27765, 353, 12865, 29889, 12673, 29889, 329, 29883, 3707, 2141, 6506, 29898, 13, 4706, 7234, 29922, 29900, 29892, 11015, 29922, 29900, 29892, 1473, 29922, 29900, 29892, 9200, 7496, 29922, 29900, 29897, 13, 1678, 1518, 16129, 353, 7145, 11147, 29918, 27765, 718, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 698, 29880, 29918, 16700, 29974, 29896, 29897, 13, 1678, 736, 313, 4548, 16129, 448, 21502, 305, 467, 7827, 29918, 23128, 580, 13, 13, 13, 1753, 1667, 7295, 13, 13, 1678, 2980, 29918, 6550, 353, 1722, 1429, 29918, 8159, 29918, 23516, 29918, 6550, 29898, 13, 4706, 1178, 29922, 8977, 29898, 12403, 29922, 5574, 511, 13, 4706, 260, 15206, 29922, 8977, 29898, 4381, 29922, 29955, 29892, 1134, 2433, 524, 742, 1375, 29922, 29896, 511, 13, 4706, 2106, 29922, 8977, 29898, 4381, 2433, 6338, 742, 19995, 29922, 1839, 4548, 2859, 742, 525, 6338, 2033, 511, 13, 4706, 903, 8173, 29918, 3972, 29922, 8977, 29898, 12403, 29922, 5574, 511, 13, 4706, 903, 8173, 29918, 1445, 29922, 8977, 29898, 12403, 29922, 5574, 511, 13, 4706, 903, 29812, 29918, 2311, 29922, 8977, 29898, 4381, 29922, 29953, 29946, 334, 29871, 29896, 29900, 29906, 29946, 29892, 1134, 2433, 524, 5477, 13, 4706, 903, 29886, 999, 3486, 287, 29918, 2084, 29922, 8977, 29898, 4381, 29922, 8516, 511, 13, 4706, 885, 29886, 29918, 19878, 29918, 265, 29918, 2704, 29922, 8977, 29898, 4381, 29922, 8824, 29892, 1134, 2433, 11227, 1495, 13, 1678, 1723, 13, 1678, 3883, 29918, 19290, 353, 1722, 1429, 29918, 5453, 29918, 19290, 580, 13, 1678, 3883, 353, 530, 1687, 7355, 29898, 23516, 29918, 6550, 29892, 3579, 5453, 29918, 19290, 29897, 13, 13, 1678, 1967, 29918, 333, 353, 3883, 29889, 7529, 1839, 333, 2033, 13, 1678, 7090, 29918, 3972, 353, 3883, 29889, 7529, 1839, 29918, 8173, 29918, 3972, 2033, 13, 1678, 7090, 29918, 1445, 353, 3883, 29889, 7529, 1839, 29918, 8173, 29918, 1445, 2033, 13, 1678, 19875, 29918, 2311, 353, 3883, 29889, 7529, 1839, 29918, 29812, 29918, 2311, 2033, 13, 1678, 758, 9155, 287, 29918, 2084, 353, 3883, 29889, 7529, 1839, 29918, 29886, 999, 3486, 287, 29918, 2084, 2033, 13, 1678, 885, 29886, 29918, 19878, 353, 3883, 29889, 7529, 1839, 1557, 29886, 29918, 19878, 29918, 265, 29918, 2704, 2033, 13, 13, 1678, 260, 15206, 29918, 16700, 353, 3883, 29889, 7529, 1839, 698, 29880, 2033, 13, 13, 1678, 1121, 353, 9657, 29898, 13, 4706, 3939, 29922, 8824, 29892, 13, 4706, 8820, 11759, 1402, 13, 4706, 1967, 29922, 8516, 29892, 13, 4706, 7090, 29918, 1445, 2433, 742, 13, 4706, 4864, 29918, 262, 29918, 8173, 29922, 8824, 29892, 13, 4706, 286, 2230, 29922, 29900, 13, 1678, 1723, 13, 13, 1678, 269, 8181, 29892, 9570, 353, 1722, 1429, 29918, 9274, 29918, 3166, 29918, 5453, 29898, 5453, 29892, 1375, 29918, 3259, 2433, 29900, 29889, 29896, 29896, 29889, 29941, 1495, 13, 13, 1678, 1018, 29901, 13, 4706, 1121, 1839, 9933, 29918, 262, 29918, 8173, 2033, 353, 4864, 29918, 262, 29918, 8173, 353, 2897, 29889, 2084, 29889, 9933, 29898, 13, 9651, 7090, 29918, 1445, 29897, 13, 4706, 565, 4864, 29918, 262, 29918, 8173, 29901, 13, 9651, 1121, 1839, 8173, 29918, 1445, 2033, 353, 7090, 29918, 1445, 13, 13, 4706, 1967, 353, 9570, 29889, 3027, 29889, 2886, 29918, 3027, 29898, 978, 29918, 272, 29918, 333, 29922, 3027, 29918, 333, 29897, 13, 4706, 4864, 29918, 262, 29918, 3820, 749, 353, 1967, 338, 451, 6213, 13, 4706, 565, 4864, 29918, 262, 29918, 3820, 749, 29901, 13, 9651, 1121, 1839, 3027, 2033, 353, 1967, 29889, 517, 29918, 8977, 580, 13, 13, 4706, 565, 3883, 29889, 7529, 1839, 3859, 2033, 1275, 525, 6338, 2396, 13, 9651, 565, 451, 4864, 29918, 262, 29918, 8173, 29901, 13, 13, 18884, 565, 451, 4864, 29918, 262, 29918, 3820, 749, 29901, 13, 462, 1678, 3883, 29889, 14057, 29918, 3126, 29898, 13, 462, 4706, 10191, 543, 2940, 451, 1476, 297, 21798, 29901, 1273, 29879, 29908, 1273, 1967, 29918, 333, 29897, 13, 13, 18884, 22821, 29945, 353, 6608, 1982, 29889, 3487, 29945, 580, 13, 18884, 565, 758, 9155, 287, 29918, 2084, 29901, 13, 462, 1678, 1121, 1839, 7387, 13359, 4397, 3319, 13, 462, 4706, 525, 978, 2396, 525, 6565, 1598, 758, 29899, 9155, 287, 1967, 1423, 2083, 29915, 13, 462, 1678, 5615, 13, 462, 1678, 411, 1722, 29898, 29886, 999, 3486, 287, 29918, 2084, 29892, 525, 6050, 1495, 408, 758, 9155, 287, 29918, 3027, 29918, 1445, 29901, 13, 462, 4706, 1550, 5852, 29901, 13, 462, 9651, 19875, 353, 758, 9155, 287, 29918, 3027, 29918, 1445, 29889, 949, 29898, 29812, 29918, 2311, 29897, 13, 462, 9651, 565, 451, 19875, 29901, 13, 462, 18884, 2867, 13, 462, 9651, 22821, 29945, 29889, 5504, 29898, 29812, 29897, 13, 462, 1678, 758, 9155, 287, 29918, 3198, 2083, 353, 22821, 29945, 29889, 20970, 7501, 342, 580, 13, 462, 1678, 565, 758, 9155, 287, 29918, 3198, 2083, 1275, 1967, 29889, 3198, 2083, 29901, 13, 462, 4706, 1121, 1839, 7387, 13359, 4397, 3319, 13, 462, 9651, 525, 978, 2396, 525, 6565, 1598, 758, 29899, 9155, 287, 1967, 742, 13, 462, 9651, 525, 2914, 2396, 5852, 29892, 13, 462, 9651, 525, 9684, 29918, 3487, 29945, 2396, 1967, 29889, 3198, 2083, 29892, 13, 462, 9651, 525, 19304, 29918, 3487, 29945, 2396, 758, 9155, 287, 29918, 3198, 2083, 13, 462, 4706, 5615, 13, 462, 4706, 396, 383, 6415, 2303, 29901, 521, 776, 304, 278, 5639, 26121, 318, 333, 313, 29946, 29906, 29946, 29941, 29953, 29897, 13, 462, 4706, 396, 2745, 591, 508, 1065, 2629, 278, 5639, 13, 462, 4706, 2897, 29889, 305, 776, 29898, 29886, 999, 3486, 287, 29918, 2084, 29892, 29871, 29946, 29906, 29946, 29941, 29953, 29892, 29871, 29946, 29906, 29946, 29941, 29953, 29897, 13, 462, 4706, 2897, 29889, 1267, 420, 29898, 29886, 999, 3486, 287, 29918, 2084, 29892, 7090, 29918, 1445, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1121, 1839, 7387, 13359, 4397, 3319, 13, 462, 9651, 525, 978, 2396, 525, 6565, 1598, 758, 29899, 9155, 287, 1967, 742, 13, 462, 9651, 525, 2914, 2396, 7700, 29892, 13, 462, 9651, 525, 9684, 29918, 3487, 29945, 2396, 1967, 29889, 3198, 2083, 29892, 13, 462, 9651, 525, 19304, 29918, 3487, 29945, 2396, 758, 9155, 287, 29918, 3198, 2083, 13, 462, 4706, 5615, 13, 462, 4706, 565, 451, 885, 29886, 29918, 19878, 29901, 13, 462, 9651, 3883, 29889, 14057, 29918, 3126, 29898, 13, 462, 18884, 10191, 543, 6572, 29899, 9155, 287, 1967, 1423, 2083, 5229, 1159, 13, 462, 4706, 396, 18076, 487, 372, 322, 5142, 1513, 515, 21798, 29889, 13, 462, 4706, 396, 1094, 591, 1258, 451, 1653, 372, 591, 881, 451, 3349, 372, 29889, 13, 462, 4706, 758, 9155, 287, 29918, 2084, 353, 6629, 13, 13, 18884, 565, 451, 758, 9155, 287, 29918, 2084, 29901, 13, 462, 1678, 411, 5694, 1445, 29889, 22175, 5776, 1971, 653, 2283, 29898, 13, 462, 9651, 525, 29893, 29890, 742, 13, 462, 9651, 4516, 29922, 8173, 29918, 3972, 29892, 13, 462, 9651, 5217, 29922, 8824, 29897, 408, 5694, 29918, 8173, 29918, 1445, 29901, 13, 462, 4706, 1018, 29901, 13, 462, 9651, 22821, 29945, 353, 6608, 1982, 29889, 3487, 29945, 580, 13, 462, 9651, 1967, 29918, 5461, 353, 9570, 29889, 3027, 29889, 10382, 29918, 3027, 29898, 13, 462, 18884, 1967, 29892, 13, 462, 18884, 4840, 29922, 5574, 13, 462, 9651, 1723, 13, 462, 9651, 1018, 29901, 13, 462, 18884, 363, 19875, 297, 1967, 29918, 5461, 29889, 1524, 29918, 3051, 29898, 13, 462, 462, 4706, 19875, 29918, 2311, 29922, 29812, 29918, 2311, 1125, 13, 462, 462, 1678, 22821, 29945, 29889, 5504, 29898, 29812, 29897, 13, 462, 462, 1678, 5694, 29918, 8173, 29918, 1445, 29889, 3539, 29898, 29812, 29897, 13, 462, 9651, 7146, 29901, 13, 462, 18884, 1967, 29918, 5461, 29889, 5358, 580, 13, 462, 18884, 5694, 29918, 8173, 29918, 1445, 29889, 5358, 580, 13, 13, 462, 9651, 5142, 29918, 3198, 2083, 353, 22821, 29945, 29889, 20970, 7501, 342, 580, 13, 462, 9651, 565, 5142, 29918, 3198, 2083, 2804, 1967, 29889, 3198, 2083, 29901, 13, 462, 18884, 1121, 1839, 7387, 13359, 4397, 3319, 13, 462, 462, 1678, 525, 978, 2396, 525, 6565, 1598, 16532, 1967, 742, 13, 462, 462, 1678, 525, 2914, 2396, 7700, 29892, 13, 462, 462, 1678, 525, 9684, 29918, 3487, 29945, 2396, 1967, 29889, 3198, 2083, 29892, 13, 462, 462, 1678, 525, 19304, 29918, 3487, 29945, 2396, 5142, 29918, 3198, 2083, 13, 462, 18884, 5615, 13, 462, 18884, 3883, 29889, 14057, 29918, 3126, 29898, 13, 462, 462, 1678, 10191, 543, 2940, 848, 947, 451, 1993, 1423, 2083, 1159, 13, 462, 9651, 1121, 1839, 7387, 13359, 4397, 3319, 13, 462, 18884, 525, 978, 2396, 525, 6565, 1598, 16532, 1967, 742, 13, 462, 18884, 525, 2914, 2396, 5852, 29892, 13, 462, 18884, 525, 9684, 29918, 3487, 29945, 2396, 1967, 29889, 3198, 2083, 29892, 13, 462, 18884, 525, 19304, 29918, 3487, 29945, 2396, 5142, 29918, 3198, 2083, 13, 462, 9651, 5615, 13, 13, 462, 9651, 396, 383, 6415, 2303, 29901, 521, 776, 304, 278, 5639, 26121, 318, 333, 313, 29946, 29906, 29946, 29941, 29953, 29897, 13, 462, 9651, 396, 4706, 2745, 591, 508, 1065, 2629, 278, 5639, 13, 462, 9651, 2897, 29889, 305, 776, 29898, 7382, 29918, 8173, 29918, 1445, 29889, 978, 29892, 29871, 29946, 29906, 29946, 29941, 29953, 29892, 29871, 29946, 29906, 29946, 29941, 29953, 29897, 13, 462, 9651, 2897, 29889, 1267, 420, 29898, 7382, 29918, 8173, 29918, 1445, 29889, 978, 29892, 7090, 29918, 1445, 29897, 13, 462, 9651, 1121, 1839, 15033, 2033, 353, 5852, 13, 462, 4706, 7146, 29901, 13, 462, 9651, 1018, 29901, 13, 462, 18884, 2897, 29889, 348, 2324, 29898, 7382, 29918, 8173, 29918, 1445, 29889, 978, 29897, 13, 462, 9651, 5174, 8960, 29901, 13, 462, 18884, 1209, 13, 13, 9651, 396, 3789, 278, 286, 2230, 297, 278, 5434, 304, 5557, 26121, 5941, 786, 13, 9651, 7090, 29918, 1445, 29918, 6112, 353, 2897, 29889, 6112, 29898, 8173, 29918, 1445, 29897, 13, 9651, 1518, 16129, 29918, 1372, 353, 260, 15206, 29918, 517, 29918, 1372, 29898, 698, 29880, 29918, 16700, 29897, 13, 9651, 1286, 353, 931, 29889, 2230, 580, 13, 9651, 565, 7090, 29918, 1445, 29918, 6112, 29889, 303, 29918, 29885, 2230, 2804, 1518, 16129, 29918, 1372, 29901, 13, 18884, 2897, 29889, 329, 603, 29898, 8173, 29918, 1445, 29892, 313, 3707, 29892, 1518, 16129, 29918, 1372, 876, 13, 18884, 1121, 1839, 7387, 13359, 4397, 3319, 13, 462, 1678, 525, 978, 2396, 525, 6422, 286, 2230, 742, 13, 462, 1678, 525, 3166, 2396, 7090, 29918, 1445, 29918, 6112, 29889, 303, 29918, 29885, 2230, 29892, 13, 462, 1678, 525, 517, 2396, 1518, 16129, 29918, 1372, 13, 18884, 5615, 13, 18884, 1121, 1839, 15033, 2033, 353, 5852, 13, 13, 4706, 1683, 29901, 29871, 396, 1518, 2859, 13, 9651, 565, 451, 4864, 29918, 262, 29918, 8173, 29901, 13, 18884, 1121, 1839, 15033, 2033, 353, 7700, 13, 9651, 1683, 29901, 13, 18884, 396, 3789, 278, 286, 2230, 304, 21502, 305, 304, 9025, 26121, 5941, 786, 13, 18884, 1286, 353, 931, 29889, 2230, 580, 13, 18884, 18696, 353, 29871, 29900, 13, 18884, 7090, 29918, 1445, 29918, 6112, 353, 2897, 29889, 6112, 29898, 8173, 29918, 1445, 29897, 13, 18884, 565, 7090, 29918, 1445, 29918, 6112, 29889, 303, 29918, 29885, 2230, 1405, 18696, 29901, 13, 462, 1678, 2897, 29889, 329, 603, 29898, 8173, 29918, 1445, 29892, 313, 3707, 29892, 18696, 876, 13, 462, 1678, 1121, 1839, 7387, 13359, 4397, 3319, 13, 462, 4706, 525, 978, 2396, 525, 6422, 286, 2230, 742, 13, 462, 4706, 525, 3166, 2396, 7090, 29918, 1445, 29918, 6112, 29889, 303, 29918, 29885, 2230, 29892, 13, 462, 4706, 525, 517, 2396, 18696, 13, 462, 1678, 5615, 13, 462, 1678, 1121, 1839, 15033, 2033, 353, 5852, 13, 13, 18884, 7090, 29918, 1445, 29918, 6112, 353, 2897, 29889, 6112, 29898, 8173, 29918, 1445, 29897, 13, 18884, 1121, 1839, 29885, 2230, 2033, 353, 7090, 29918, 1445, 29918, 6112, 29889, 303, 29918, 29885, 2230, 13, 18884, 1121, 1839, 4548, 2658, 2033, 353, 931, 29889, 710, 615, 603, 29898, 13, 462, 1678, 11860, 29874, 29892, 1273, 29881, 1273, 29890, 1273, 29979, 1273, 29950, 16664, 29924, 16664, 29903, 1273, 29920, 613, 13, 462, 1678, 931, 29889, 2997, 2230, 29898, 8173, 29918, 1445, 29918, 6112, 29889, 303, 29918, 29885, 2230, 29897, 13, 18884, 1723, 13, 13, 4706, 3883, 29889, 13322, 29918, 3126, 29898, 1068, 2914, 29897, 13, 13, 1678, 5174, 269, 8181, 29889, 11739, 29879, 29889, 6585, 7264, 20442, 2451, 408, 321, 29901, 13, 4706, 3883, 29889, 14057, 29918, 3126, 29898, 7645, 29922, 710, 29898, 29872, 511, 4805, 29918, 1272, 29922, 29872, 29889, 17833, 29918, 1272, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
typical90/aj/main.py
KATO-Hiro/AtCoder
2
189232
# -*- coding: utf-8 -*- def main(): import sys input = sys.stdin.readline n, q = map(int, input().split()) x = [0] * n y = [0] * n for i in range(n): xi, yi = map(int, input().split()) x[i] = xi + yi y[i] = xi - yi x_min, x_max = min(x), max(x) y_min, y_max = min(y), max(y) for j in range(q): qi = int(input()) qi -= 1 xi = x[qi] yi = y[qi] print(max(x_max - xi, xi - x_min, y_max - yi, yi - y_min)) if __name__ == "__main__": main()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 1053, 10876, 13, 13, 1678, 1881, 353, 10876, 29889, 4172, 262, 29889, 949, 1220, 13, 13, 1678, 302, 29892, 3855, 353, 2910, 29898, 524, 29892, 1881, 2141, 5451, 3101, 13, 1678, 921, 353, 518, 29900, 29962, 334, 302, 13, 1678, 343, 353, 518, 29900, 29962, 334, 302, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 4706, 921, 29875, 29892, 343, 29875, 353, 2910, 29898, 524, 29892, 1881, 2141, 5451, 3101, 13, 4706, 921, 29961, 29875, 29962, 353, 921, 29875, 718, 343, 29875, 13, 4706, 343, 29961, 29875, 29962, 353, 921, 29875, 448, 343, 29875, 13, 268, 13, 1678, 921, 29918, 1195, 29892, 921, 29918, 3317, 353, 1375, 29898, 29916, 511, 4236, 29898, 29916, 29897, 13, 1678, 343, 29918, 1195, 29892, 343, 29918, 3317, 353, 1375, 29898, 29891, 511, 4236, 29898, 29891, 29897, 13, 268, 13, 1678, 363, 432, 297, 3464, 29898, 29939, 1125, 13, 4706, 3855, 29875, 353, 938, 29898, 2080, 3101, 13, 4706, 3855, 29875, 22361, 29871, 29896, 13, 13, 4706, 921, 29875, 353, 921, 29961, 26461, 29962, 13, 4706, 343, 29875, 353, 343, 29961, 26461, 29962, 13, 13, 4706, 1596, 29898, 3317, 29898, 29916, 29918, 3317, 448, 921, 29875, 29892, 921, 29875, 448, 921, 29918, 1195, 29892, 343, 29918, 3317, 448, 343, 29875, 29892, 343, 29875, 448, 343, 29918, 1195, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
RecoVertex/BeamSpotProducer/test/BeamFit_LumiBased_NewAlignWorkflow.py
ckamtsikis/cmssw
852
148337
import FWCore.ParameterSet.Config as cms process = cms.Process("BSworkflow") process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( "/store/express/Run2015A/StreamExpress/ALCARECO/TkAlMinBias-Express-v1/000/246/959/00000/14174DF2-490A-E511-9862-02163E0143E9.root", ) ) process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.cerr.FwkReport = cms.untracked.PSet( reportEvery = cms.untracked.int32(10000), ) process.MessageLogger.debugModules = ['BeamSpotAnalyzer'] process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) ) process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi") process.load("Configuration.StandardSequences.MagneticField_cff") process.load('Configuration.Geometry.GeometryRecoDB_cff') process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") # this GT is for the Express, to be consistent with the file above # in general this GT should be for the ReReco process.GlobalTag.globaltag = 'GR_E_V48' ## Track refit process.load("RecoTracker.TrackProducer.TrackRefitters_cff") # remove the following lines if you run on RECO files process.TrackRefitter.src = 'ALCARECOTkAlMinBias' process.TrackRefitter.NavigationSchool = '' ## PV refit process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi") from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices process.offlinePrimaryVerticesFromRefittedTrks = offlinePrimaryVertices.clone() process.offlinePrimaryVerticesFromRefittedTrks.TrackLabel = cms.InputTag("TrackRefitter") process.offlinePrimaryVerticesFromRefittedTrks.vertexCollections.maxDistanceToBeam = 1 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxNormalizedChi2 = 20 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minSiliconLayersWithHits = 5 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Significance = 5.0 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minPixelLayersWithHits = 2 ## BeamSpot fit process.load("RecoVertex.BeamSpotProducer.d0_phi_analyzer_cff") process.d0_phi_analyzer.BeamFitter.WriteAscii = True process.d0_phi_analyzer.BeamFitter.AsciiFileName = 'BeamFit_LumiBased_NewAlignWorkflow_alcareco.txt' process.d0_phi_analyzer.BeamFitter.AppendRunToFileName = False process.d0_phi_analyzer.BeamFitter.InputBeamWidth = -1 process.d0_phi_analyzer.BeamFitter.MaximumImpactParameter = 1.0 process.d0_phi_analyzer.BeamFitter.MaximumNormChi2 = 10 process.d0_phi_analyzer.BeamFitter.MinimumInputTracks = 50 process.d0_phi_analyzer.BeamFitter.MinimumPixelLayers = -1 process.d0_phi_analyzer.BeamFitter.MinimumPt = 1.0 process.d0_phi_analyzer.BeamFitter.MinimumTotalLayers = 6 process.d0_phi_analyzer.BeamFitter.OutputFileName = 'BeamFit_LumiBased_Workflow_alcareco.root' process.d0_phi_analyzer.BeamFitter.TrackAlgorithm = cms.untracked.vstring() process.d0_phi_analyzer.BeamFitter.TrackCollection = 'TrackRefitter' process.d0_phi_analyzer.BeamFitter.SaveFitResults = True process.d0_phi_analyzer.BeamFitter.SaveNtuple = False process.d0_phi_analyzer.BeamFitter.SavePVVertices = True process.d0_phi_analyzer.PVFitter.Apply3DFit = True process.d0_phi_analyzer.PVFitter.minNrVerticesForFit = 10 process.d0_phi_analyzer.PVFitter.nSigmaCut = 50.0 process.d0_phi_analyzer.PVFitter.VertexCollection = 'offlinePrimaryVerticesFromRefittedTrks' process.d0_phi_analyzer.BSAnalyzerParameters.fitEveryNLumi = 1 process.d0_phi_analyzer.BSAnalyzerParameters.resetEveryNLumi = 1 process.p = cms.Path(process.offlineBeamSpot + process.TrackRefitter + process.offlinePrimaryVerticesFromRefittedTrks + process.d0_phi_analyzer)
[ 1, 1053, 383, 29956, 9203, 29889, 9329, 2697, 29889, 3991, 408, 274, 1516, 13, 13, 5014, 353, 274, 1516, 29889, 7032, 703, 9851, 1287, 1731, 1159, 13, 13, 5014, 29889, 4993, 353, 274, 1516, 29889, 4435, 703, 11426, 4435, 613, 13, 1678, 934, 8659, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29894, 1807, 29898, 13, 418, 5591, 8899, 29914, 17073, 29914, 6558, 29906, 29900, 29896, 29945, 29909, 29914, 3835, 27404, 29914, 1964, 5454, 1525, 3217, 29914, 29911, 29895, 2499, 8140, 29933, 3173, 29899, 27404, 29899, 29894, 29896, 29914, 29900, 29900, 29900, 29914, 29906, 29946, 29953, 29914, 29929, 29945, 29929, 29914, 29900, 29900, 29900, 29900, 29900, 29914, 29896, 29946, 29896, 29955, 29946, 4037, 29906, 29899, 29946, 29929, 29900, 29909, 29899, 29923, 29945, 29896, 29896, 29899, 29929, 29947, 29953, 29906, 29899, 29900, 29906, 29896, 29953, 29941, 29923, 29900, 29896, 29946, 29941, 29923, 29929, 29889, 4632, 613, 13, 1678, 1723, 13, 29897, 13, 13, 5014, 29889, 1359, 703, 29943, 29956, 9203, 29889, 3728, 16363, 29889, 3728, 16363, 29918, 6854, 29875, 1159, 13, 5014, 29889, 3728, 16363, 29889, 2265, 29878, 29889, 29943, 29893, 29895, 13020, 29871, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29925, 2697, 29898, 13, 1678, 3461, 26526, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 524, 29941, 29906, 29898, 29896, 29900, 29900, 29900, 29900, 511, 13, 29897, 13, 5014, 29889, 3728, 16363, 29889, 8382, 2111, 2540, 353, 6024, 3629, 314, 5592, 327, 2744, 14997, 3298, 2033, 13, 13, 5014, 29889, 3317, 13634, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29925, 2697, 29898, 13, 1678, 1881, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 524, 29941, 29906, 6278, 29896, 29897, 29871, 13, 29897, 13, 13, 5014, 29889, 6768, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29925, 2697, 29898, 13, 1678, 864, 26289, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 11227, 29898, 5574, 29897, 13, 29897, 13, 13, 5014, 29889, 1359, 703, 4789, 29877, 22479, 29889, 3629, 314, 5592, 327, 23665, 2265, 29889, 3629, 314, 5592, 327, 29918, 6854, 29875, 1159, 13, 5014, 29889, 1359, 703, 8614, 29889, 15449, 16941, 2063, 29889, 19095, 1212, 293, 3073, 29918, 29883, 600, 1159, 29871, 13, 5014, 29889, 1359, 877, 8614, 29889, 7999, 7843, 29889, 7999, 7843, 4789, 29877, 4051, 29918, 29883, 600, 1495, 13, 5014, 29889, 1359, 703, 8614, 29889, 15449, 16941, 2063, 29889, 29348, 631, 10983, 2187, 29918, 12756, 8176, 29918, 29883, 600, 1159, 29871, 13, 29937, 445, 21342, 338, 363, 278, 14657, 29892, 304, 367, 13747, 411, 278, 934, 2038, 13, 29937, 297, 2498, 445, 21342, 881, 367, 363, 278, 830, 4789, 29877, 13, 5014, 29889, 12756, 8176, 29889, 23705, 1997, 351, 353, 525, 14345, 29918, 29923, 29918, 29963, 29946, 29947, 29915, 13, 13, 2277, 17026, 2143, 277, 13, 5014, 29889, 1359, 703, 4789, 29877, 5323, 4937, 29889, 17936, 23665, 2265, 29889, 17936, 5620, 277, 2153, 29918, 29883, 600, 1159, 13, 13, 29937, 3349, 278, 1494, 3454, 565, 366, 1065, 373, 5195, 3217, 2066, 13, 5014, 29889, 17936, 5620, 5171, 29889, 4351, 353, 525, 1964, 5454, 1525, 29907, 2891, 29895, 2499, 8140, 29933, 3173, 29915, 13, 5014, 29889, 17936, 5620, 5171, 29889, 20245, 4504, 1507, 353, 6629, 13, 13, 13, 2277, 349, 29963, 2143, 277, 13, 5014, 29889, 1359, 703, 17936, 292, 24183, 29889, 4300, 993, 17936, 29889, 4300, 993, 17936, 5627, 29918, 6854, 29875, 1159, 13, 13, 3166, 3599, 29877, 22479, 29889, 26666, 22479, 23665, 2265, 29889, 6880, 1220, 26666, 9114, 1575, 29918, 6854, 29875, 1053, 1283, 1220, 26666, 9114, 1575, 29871, 13, 5014, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29871, 353, 1283, 1220, 26666, 9114, 1575, 29889, 16513, 580, 13, 5014, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29889, 17936, 4775, 462, 462, 539, 353, 274, 1516, 29889, 4290, 8176, 703, 17936, 5620, 5171, 1159, 29871, 13, 5014, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29889, 369, 4776, 19466, 29889, 3317, 27469, 1762, 3629, 314, 795, 353, 29871, 29896, 13, 5014, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29889, 29911, 29895, 5072, 11507, 29889, 3317, 19077, 1891, 1451, 29875, 29906, 632, 353, 29871, 29906, 29900, 13, 5014, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29889, 29911, 29895, 5072, 11507, 29889, 1195, 26729, 4144, 29931, 388, 414, 3047, 29950, 1169, 418, 353, 29871, 29945, 13, 5014, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29889, 29911, 29895, 5072, 11507, 29889, 3317, 29928, 29900, 10140, 928, 749, 632, 353, 29871, 29945, 29889, 29900, 29871, 13, 5014, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29889, 29911, 29895, 5072, 11507, 29889, 1195, 29637, 29931, 388, 414, 3047, 29950, 1169, 4706, 353, 29871, 29906, 1678, 13, 13, 13, 462, 418, 13, 2277, 1522, 314, 5592, 327, 6216, 13, 5014, 29889, 1359, 703, 4789, 29877, 22479, 29889, 3629, 314, 5592, 327, 23665, 2265, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29918, 29883, 600, 1159, 13, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 6113, 2887, 18869, 18884, 353, 5852, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 2887, 18869, 17020, 632, 353, 525, 3629, 314, 29943, 277, 29918, 29931, 15547, 29933, 1463, 29918, 4373, 2499, 647, 5531, 1731, 29918, 284, 18020, 1111, 29889, 3945, 29915, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 18277, 6558, 1762, 17020, 539, 353, 7700, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 4290, 3629, 314, 6110, 9651, 353, 448, 29896, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 7976, 12539, 24192, 627, 9329, 1678, 353, 29871, 29896, 29889, 29900, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 7976, 12539, 29940, 555, 1451, 29875, 29906, 965, 353, 29871, 29896, 29900, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 8140, 12539, 4290, 5323, 4684, 4706, 353, 29871, 29945, 29900, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 8140, 12539, 29637, 29931, 388, 414, 4706, 353, 448, 29896, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 8140, 12539, 29925, 29873, 462, 353, 29871, 29896, 29889, 29900, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 8140, 12539, 11536, 29931, 388, 414, 4706, 353, 29871, 29953, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 6466, 17020, 9651, 353, 525, 3629, 314, 29943, 277, 29918, 29931, 15547, 29933, 1463, 29918, 5531, 1731, 29918, 284, 18020, 1111, 29889, 4632, 29915, 29871, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 17936, 22461, 4540, 9651, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29894, 1807, 580, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 17936, 7196, 965, 353, 525, 17936, 5620, 5171, 29915, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 11371, 29943, 277, 12191, 9651, 353, 5852, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 11371, 29940, 23583, 18884, 353, 7700, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 3629, 314, 29943, 5171, 29889, 11371, 29925, 29963, 9114, 1575, 9651, 353, 5852, 13, 1678, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 29925, 24460, 5171, 29889, 2052, 368, 29941, 4037, 277, 462, 29871, 353, 5852, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 29925, 24460, 5171, 29889, 1195, 29940, 29878, 9114, 1575, 2831, 29943, 277, 308, 353, 29871, 29896, 29900, 29871, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 29925, 24460, 5171, 29889, 29876, 10142, 29907, 329, 462, 259, 353, 29871, 29945, 29900, 29889, 29900, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 29925, 24460, 5171, 29889, 22479, 7196, 9651, 353, 525, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 29915, 29871, 13, 1678, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 9851, 2744, 14997, 3298, 11507, 29889, 9202, 26526, 25103, 15547, 259, 353, 29871, 29896, 13, 5014, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29889, 9851, 2744, 14997, 3298, 11507, 29889, 12071, 26526, 25103, 15547, 353, 29871, 29896, 13, 13, 13, 5014, 29889, 29886, 353, 274, 1516, 29889, 2605, 29898, 5014, 29889, 2696, 1220, 3629, 314, 5592, 327, 462, 4706, 718, 29871, 13, 462, 268, 1889, 29889, 17936, 5620, 5171, 462, 3986, 718, 29871, 13, 462, 268, 1889, 29889, 2696, 1220, 26666, 9114, 1575, 4591, 5620, 4430, 2308, 2039, 718, 13, 462, 268, 1889, 29889, 29881, 29900, 29918, 2876, 29918, 24209, 3298, 29897, 13, 2 ]
tower/utils/enemygen.py
alisonbnt/watchtower
1
178662
from ..creature import Enemy class EnemyGenerator(object): def __init__(self): self.health = None self.block = None self.hit = None def generate_enemy(self, creature, choices): species = creature.get_species() self.health = species['health'] self.block = species['block'] self.hit = species['hit'] self.guesses = {} aspect_type = 'materials' self.get_modifier(creature, aspect_type, choices[aspect_type]) aspect_type = 'places' self.get_modifier(creature, aspect_type, choices[aspect_type]) aspect_type = 'summonings' self.get_modifier(creature, aspect_type, choices[aspect_type]) aspect_type = 'banishments' self.get_modifier(creature, aspect_type, choices[aspect_type]) aspect_type = 'amulets' self.get_element_modifier(creature, aspect_type, choices[aspect_type]) aspect_type = 'potions' self.get_element_modifier(creature, aspect_type, choices[aspect_type]) return Enemy(self.health, self.block, self.hit, self.guesses) def get_modifier(self, creature, aspect_type, item): if item in creature.get_aspect_indexes(aspect_type): self.guesses.update({aspect_type: True}) aspect = creature.get_aspect(aspect_type, item) if aspect['effect'] == 'health': self.health += int(aspect['power'] * -1) elif aspect['effect'] == 'hit': self.hit += int(aspect['power']) else: self.guesses.update({aspect_type: False}) def get_element_modifier(self, creature, aspect_type, item): elements = creature.get_element_indexes(aspect_type) if item in elements: self.guesses.update({aspect_type: True}) aspect = creature.get_element_aspect(aspect_type, item) if aspect['effect'] == 'health': self.health += int(creature.get_element_value(aspect_type, 'health') * -1) elif aspect['effect'] == 'hit': self.hit += int(creature.get_element_value(aspect_type, 'hit')) else: self.guesses.update({aspect_type: False})
[ 1, 515, 6317, 1037, 1535, 1053, 1174, 6764, 13, 13, 13, 1990, 1174, 6764, 21575, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 354, 4298, 353, 6213, 13, 4706, 1583, 29889, 1271, 353, 6213, 13, 4706, 1583, 29889, 27342, 353, 6213, 13, 13, 1678, 822, 5706, 29918, 264, 6764, 29898, 1311, 29892, 23940, 29892, 19995, 1125, 13, 4706, 6606, 353, 23940, 29889, 657, 29918, 24091, 580, 13, 13, 4706, 1583, 29889, 354, 4298, 353, 6606, 1839, 354, 4298, 2033, 13, 4706, 1583, 29889, 1271, 353, 6606, 1839, 1271, 2033, 13, 4706, 1583, 29889, 27342, 353, 6606, 1839, 27342, 2033, 13, 4706, 1583, 29889, 2543, 15322, 353, 6571, 13, 4706, 9565, 29918, 1853, 353, 525, 15388, 29879, 29915, 13, 4706, 1583, 29889, 657, 29918, 26625, 29898, 1037, 1535, 29892, 9565, 29918, 1853, 29892, 19995, 29961, 294, 1103, 29918, 1853, 2314, 13, 13, 4706, 9565, 29918, 1853, 353, 525, 29886, 6048, 29915, 13, 4706, 1583, 29889, 657, 29918, 26625, 29898, 1037, 1535, 29892, 9565, 29918, 1853, 29892, 19995, 29961, 294, 1103, 29918, 1853, 2314, 13, 13, 4706, 9565, 29918, 1853, 353, 525, 2083, 3712, 886, 29915, 13, 4706, 1583, 29889, 657, 29918, 26625, 29898, 1037, 1535, 29892, 9565, 29918, 1853, 29892, 19995, 29961, 294, 1103, 29918, 1853, 2314, 13, 13, 4706, 9565, 29918, 1853, 353, 525, 2571, 728, 1860, 29915, 13, 4706, 1583, 29889, 657, 29918, 26625, 29898, 1037, 1535, 29892, 9565, 29918, 1853, 29892, 19995, 29961, 294, 1103, 29918, 1853, 2314, 13, 13, 4706, 9565, 29918, 1853, 353, 525, 314, 29884, 10376, 29915, 13, 4706, 1583, 29889, 657, 29918, 5029, 29918, 26625, 29898, 1037, 1535, 29892, 9565, 29918, 1853, 29892, 19995, 29961, 294, 1103, 29918, 1853, 2314, 13, 13, 4706, 9565, 29918, 1853, 353, 525, 17765, 1080, 29915, 13, 4706, 1583, 29889, 657, 29918, 5029, 29918, 26625, 29898, 1037, 1535, 29892, 9565, 29918, 1853, 29892, 19995, 29961, 294, 1103, 29918, 1853, 2314, 13, 13, 4706, 736, 1174, 6764, 29898, 1311, 29889, 354, 4298, 29892, 1583, 29889, 1271, 29892, 1583, 29889, 27342, 29892, 1583, 29889, 2543, 15322, 29897, 13, 13, 1678, 822, 679, 29918, 26625, 29898, 1311, 29892, 23940, 29892, 9565, 29918, 1853, 29892, 2944, 1125, 13, 4706, 565, 2944, 297, 23940, 29889, 657, 29918, 294, 1103, 29918, 2248, 267, 29898, 294, 1103, 29918, 1853, 1125, 13, 9651, 1583, 29889, 2543, 15322, 29889, 5504, 3319, 294, 1103, 29918, 1853, 29901, 5852, 1800, 13, 9651, 9565, 353, 23940, 29889, 657, 29918, 294, 1103, 29898, 294, 1103, 29918, 1853, 29892, 2944, 29897, 13, 9651, 565, 9565, 1839, 15987, 2033, 1275, 525, 354, 4298, 2396, 13, 18884, 1583, 29889, 354, 4298, 4619, 938, 29898, 294, 1103, 1839, 13519, 2033, 334, 448, 29896, 29897, 13, 9651, 25342, 9565, 1839, 15987, 2033, 1275, 525, 27342, 2396, 13, 18884, 1583, 29889, 27342, 4619, 938, 29898, 294, 1103, 1839, 13519, 11287, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 2543, 15322, 29889, 5504, 3319, 294, 1103, 29918, 1853, 29901, 7700, 1800, 13, 13, 1678, 822, 679, 29918, 5029, 29918, 26625, 29898, 1311, 29892, 23940, 29892, 9565, 29918, 1853, 29892, 2944, 1125, 13, 4706, 3161, 353, 23940, 29889, 657, 29918, 5029, 29918, 2248, 267, 29898, 294, 1103, 29918, 1853, 29897, 13, 4706, 565, 2944, 297, 3161, 29901, 13, 9651, 1583, 29889, 2543, 15322, 29889, 5504, 3319, 294, 1103, 29918, 1853, 29901, 5852, 1800, 13, 9651, 9565, 353, 23940, 29889, 657, 29918, 5029, 29918, 294, 1103, 29898, 294, 1103, 29918, 1853, 29892, 2944, 29897, 13, 9651, 565, 9565, 1839, 15987, 2033, 1275, 525, 354, 4298, 2396, 13, 18884, 1583, 29889, 354, 4298, 4619, 938, 29898, 1037, 1535, 29889, 657, 29918, 5029, 29918, 1767, 29898, 294, 1103, 29918, 1853, 29892, 13, 462, 462, 462, 795, 525, 354, 4298, 1495, 334, 448, 29896, 29897, 13, 9651, 25342, 9565, 1839, 15987, 2033, 1275, 525, 27342, 2396, 13, 18884, 1583, 29889, 27342, 4619, 938, 29898, 1037, 1535, 29889, 657, 29918, 5029, 29918, 1767, 29898, 294, 1103, 29918, 1853, 29892, 525, 27342, 8785, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 2543, 15322, 29889, 5504, 3319, 294, 1103, 29918, 1853, 29901, 7700, 1800, 13, 2 ]
DallalKosh/app/migrations/0009_auto_20171108_0603.py
CarenZarin/DallalKosh
1
1605333
<reponame>CarenZarin/DallalKosh # -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-08 06:03 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0008_auto_20171108_0549'), ] operations = [ migrations.RenameField( model_name='good', old_name='good_data', new_name='good_date', ), ]
[ 1, 529, 276, 1112, 420, 29958, 8179, 264, 29999, 27139, 29914, 29928, 497, 284, 29968, 10578, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 3251, 630, 491, 15337, 29871, 29896, 29889, 29896, 29896, 29889, 29955, 373, 29871, 29906, 29900, 29896, 29955, 29899, 29896, 29896, 29899, 29900, 29947, 29871, 29900, 29953, 29901, 29900, 29941, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 932, 742, 525, 29900, 29900, 29900, 29947, 29918, 6921, 29918, 29906, 29900, 29896, 29955, 29896, 29896, 29900, 29947, 29918, 29900, 29945, 29946, 29929, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 29934, 3871, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 16773, 742, 13, 9651, 2030, 29918, 978, 2433, 16773, 29918, 1272, 742, 13, 9651, 716, 29918, 978, 2433, 16773, 29918, 1256, 742, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
holmes/migrations/versions/21087e990aa8_change_violation_to_.py
scorphus/holmes-api
0
187383
<filename>holmes/migrations/versions/21087e990aa8_change_violation_to_.py """Change violation to contain less info Revision ID: 21087e990aa8 Revises: <PASSWORD> Create Date: 2013-12-02 22:11:34.036524 """ # revision identifiers, used by Alembic. revision = '21087e990aa8' down_revision = '2<PASSWORD>' from alembic import op import sqlalchemy as sa def upgrade(): op.drop_column('violations', 'title') op.drop_column('violations', 'description') op.add_column('violations', sa.Column('value', sa.Text, nullable=True)) def downgrade(): op.add_column('violations', sa.Column('title', sa.String(2000), nullable=False)) op.add_column('violations', sa.Column('description', sa.Text, nullable=False)) op.drop_column('violations', 'value')
[ 1, 529, 9507, 29958, 5391, 4467, 29914, 26983, 800, 29914, 26100, 29914, 29906, 29896, 29900, 29947, 29955, 29872, 29929, 29929, 29900, 7340, 29947, 29918, 3167, 29918, 1403, 22671, 29918, 517, 5396, 2272, 13, 15945, 29908, 7277, 5537, 362, 304, 1712, 3109, 5235, 13, 13, 1123, 4924, 3553, 29901, 29871, 29906, 29896, 29900, 29947, 29955, 29872, 29929, 29929, 29900, 7340, 29947, 13, 1123, 1730, 267, 29901, 529, 25711, 17013, 29958, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29896, 29941, 29899, 29896, 29906, 29899, 29900, 29906, 29871, 29906, 29906, 29901, 29896, 29896, 29901, 29941, 29946, 29889, 29900, 29941, 29953, 29945, 29906, 29946, 13, 13, 15945, 29908, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 525, 29906, 29896, 29900, 29947, 29955, 29872, 29929, 29929, 29900, 7340, 29947, 29915, 13, 3204, 29918, 276, 4924, 353, 525, 29906, 29966, 25711, 17013, 16299, 13, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 13, 13, 13, 1753, 14955, 7295, 13, 1678, 1015, 29889, 8865, 29918, 4914, 877, 1403, 324, 800, 742, 525, 3257, 1495, 13, 1678, 1015, 29889, 8865, 29918, 4914, 877, 1403, 324, 800, 742, 525, 8216, 1495, 13, 1678, 1015, 29889, 1202, 29918, 4914, 877, 1403, 324, 800, 742, 872, 29889, 4409, 877, 1767, 742, 872, 29889, 1626, 29892, 1870, 519, 29922, 5574, 876, 13, 13, 13, 1753, 1623, 8228, 7295, 13, 1678, 1015, 29889, 1202, 29918, 4914, 877, 1403, 324, 800, 742, 872, 29889, 4409, 877, 3257, 742, 872, 29889, 1231, 29898, 29906, 29900, 29900, 29900, 511, 1870, 519, 29922, 8824, 876, 13, 1678, 1015, 29889, 1202, 29918, 4914, 877, 1403, 324, 800, 742, 872, 29889, 4409, 877, 8216, 742, 872, 29889, 1626, 29892, 1870, 519, 29922, 8824, 876, 13, 1678, 1015, 29889, 8865, 29918, 4914, 877, 1403, 324, 800, 742, 525, 1767, 1495, 13, 2 ]
bot_facebook/views/__init__.py
lariodiniz/BootPlayGame
0
70120
<reponame>lariodiniz/BootPlayGame from .ativa_bot_view import ativaBotView
[ 1, 529, 276, 1112, 420, 29958, 29880, 1306, 397, 262, 466, 29914, 20967, 13454, 14199, 13, 3166, 869, 8657, 29918, 7451, 29918, 1493, 1053, 472, 4244, 29933, 327, 1043, 2 ]
transform_username.py
bbhunter/username-generation-guide
38
132948
<filename>transform_username.py #!/usr/bin/env python3 import argparse import os import re class Rule: def __str__(self): return f'{self.action}: {self.arg1}, {self.arg2}' def load_rules(filename): lines = open(filename).read().splitlines() for line in lines: l = line if not l or l.startswith('#'): continue data = re.split('( from | to )', l) if len(data) != 5: print(data) print(f'Invalid rule line: {l}') continue r = Rule() r.action = data[0].strip() r.arg1 = data[2].strip() r.arg2 = data[4].strip() yield r def apply_rule(username, rule): results = set({username}) once_sign = False if rule.action == 'replace-any-case': start_pos = 0 while True: try: index = username.lower().index(rule.arg1.lower(), start_pos) except: break left, right = username[:start_pos], username[start_pos:] right = right.lower().replace(rule.arg1.lower(), rule.arg2, 1) results.add(left+right) start_pos = index + 1 if index+len(rule.arg1) > len(username): break elif rule.action == 'replace': start_pos = 0 while True: try: index = username.index(rule.arg1, start_pos) except: break left, right = username[:start_pos], username[start_pos:] right = right.replace(rule.arg1, rule.arg2, 1) results.add(left+right) start_pos = index + 1 if index+len(rule.arg1) > len(username): break elif rule.action == 'change-case': for i in range(len(username)): new_name = username new_name = new_name[:i] + new_name[i].swapcase() + new_name[i+1:] results.add(new_name) elif rule.action == 'append': if rule.arg2 == 'right' and not username.endswith(rule.arg1): results.add(username + rule.arg1) elif rule.arg2 == 'left' and not username.startswith(rule.arg1): results.add(rule.arg1 + username) elif rule.arg2 == 'both': name = username if not username.endswith(rule.arg1): name = rule.arg1 + name if not username.startswith(rule.arg1): name = name + rule.arg1 results.add(name) once_sign = True elif rule.action == 'remove-pos': pos = int(rule.arg1) new_username = username[:pos] + username[pos+1:] results.add(new_username) once_sign = True return results, once_sign def process_rules_recursive(usernames, rules, results): for username in usernames: for r in rules: res, once_sign = apply_rule(username, r) new_res = res.difference(results) if once_sign: results = results | new_res continue if not new_res: continue for result in new_res: rec_res = process_rules_recursive(set({result}), rules, results | new_res) results = results | rec_res | new_res return results def process_rules(usernames, rules): return process_rules_recursive(usernames, rules, usernames) if __name__ == '__main__': parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description="Username mutation script", ) username_group = parser.add_mutually_exclusive_group(required=True) username_group.add_argument( '--username', help="Username to mutate", ) username_group.add_argument( '--username-list', help="Filename of username list to mutate", ) username_group.add_argument( '-I', '--username-input', action='store_true', default=False, help="Get usernames from stdin", ) parser.add_argument( 'rule_filename', type=str, help="Rule to mutate (see rules directory)", ) parser.add_argument( '--remove-known', default=False, action='store_true', help="Remove known usernames from output", ) args = parser.parse_args() if args.username: usernames = set({args.username}) elif args.username_list: usernames = set(open(args.username_list).read().splitlines()) else: import sys usernames = set() for line in sys.stdin: usernames.add(line.strip()) rules = list(load_rules(args.rule_filename)) new_usernames = process_rules(usernames, rules) if args.remove_known: usernames = new_usernames.difference(usernames) else: usernames = new_usernames print('\n'.join(usernames))
[ 1, 529, 9507, 29958, 9067, 29918, 6786, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 5215, 337, 13, 13, 13, 1990, 27308, 29901, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 29915, 29912, 1311, 29889, 2467, 6177, 426, 1311, 29889, 1191, 29896, 1118, 426, 1311, 29889, 1191, 29906, 10162, 13, 13, 13, 1753, 2254, 29918, 19238, 29898, 9507, 1125, 13, 1678, 3454, 353, 1722, 29898, 9507, 467, 949, 2141, 5451, 9012, 580, 13, 1678, 363, 1196, 297, 3454, 29901, 13, 4706, 301, 353, 1196, 13, 4706, 565, 451, 301, 470, 301, 29889, 27382, 2541, 14237, 29374, 13, 9651, 6773, 13, 4706, 848, 353, 337, 29889, 5451, 877, 29898, 515, 891, 304, 1723, 742, 301, 29897, 13, 4706, 565, 7431, 29898, 1272, 29897, 2804, 29871, 29945, 29901, 13, 9651, 1596, 29898, 1272, 29897, 13, 9651, 1596, 29898, 29888, 29915, 13919, 5751, 1196, 29901, 426, 29880, 29913, 1495, 13, 9651, 6773, 13, 13, 4706, 364, 353, 27308, 580, 13, 13, 4706, 364, 29889, 2467, 353, 848, 29961, 29900, 1822, 17010, 580, 13, 4706, 364, 29889, 1191, 29896, 353, 848, 29961, 29906, 1822, 17010, 580, 13, 4706, 364, 29889, 1191, 29906, 353, 848, 29961, 29946, 1822, 17010, 580, 13, 13, 4706, 7709, 364, 13, 13, 13, 1753, 3394, 29918, 7491, 29898, 6786, 29892, 5751, 1125, 13, 1678, 2582, 353, 731, 3319, 6786, 1800, 13, 1678, 2748, 29918, 4530, 353, 7700, 13, 13, 1678, 565, 5751, 29889, 2467, 1275, 525, 6506, 29899, 1384, 29899, 4878, 2396, 13, 4706, 1369, 29918, 1066, 353, 29871, 29900, 13, 4706, 1550, 5852, 29901, 13, 9651, 1018, 29901, 13, 18884, 2380, 353, 8952, 29889, 13609, 2141, 2248, 29898, 7491, 29889, 1191, 29896, 29889, 13609, 3285, 1369, 29918, 1066, 29897, 13, 9651, 5174, 29901, 13, 18884, 2867, 13, 9651, 2175, 29892, 1492, 353, 8952, 7503, 2962, 29918, 1066, 1402, 8952, 29961, 2962, 29918, 1066, 17531, 13, 9651, 1492, 353, 1492, 29889, 13609, 2141, 6506, 29898, 7491, 29889, 1191, 29896, 29889, 13609, 3285, 5751, 29889, 1191, 29906, 29892, 29871, 29896, 29897, 13, 9651, 2582, 29889, 1202, 29898, 1563, 29974, 1266, 29897, 13, 9651, 1369, 29918, 1066, 353, 2380, 718, 29871, 29896, 13, 13, 9651, 565, 2380, 29974, 2435, 29898, 7491, 29889, 1191, 29896, 29897, 1405, 7431, 29898, 6786, 1125, 13, 18884, 2867, 13, 13, 1678, 25342, 5751, 29889, 2467, 1275, 525, 6506, 2396, 13, 4706, 1369, 29918, 1066, 353, 29871, 29900, 13, 4706, 1550, 5852, 29901, 13, 9651, 1018, 29901, 13, 18884, 2380, 353, 8952, 29889, 2248, 29898, 7491, 29889, 1191, 29896, 29892, 1369, 29918, 1066, 29897, 13, 9651, 5174, 29901, 13, 18884, 2867, 13, 9651, 2175, 29892, 1492, 353, 8952, 7503, 2962, 29918, 1066, 1402, 8952, 29961, 2962, 29918, 1066, 17531, 13, 9651, 1492, 353, 1492, 29889, 6506, 29898, 7491, 29889, 1191, 29896, 29892, 5751, 29889, 1191, 29906, 29892, 29871, 29896, 29897, 13, 9651, 2582, 29889, 1202, 29898, 1563, 29974, 1266, 29897, 13, 9651, 1369, 29918, 1066, 353, 2380, 718, 29871, 29896, 13, 13, 9651, 565, 2380, 29974, 2435, 29898, 7491, 29889, 1191, 29896, 29897, 1405, 7431, 29898, 6786, 1125, 13, 18884, 2867, 13, 13, 1678, 25342, 5751, 29889, 2467, 1275, 525, 3167, 29899, 4878, 2396, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 6786, 22164, 13, 9651, 716, 29918, 978, 353, 8952, 13, 9651, 716, 29918, 978, 353, 716, 29918, 978, 7503, 29875, 29962, 718, 716, 29918, 978, 29961, 29875, 1822, 26276, 4878, 580, 718, 716, 29918, 978, 29961, 29875, 29974, 29896, 17531, 13, 9651, 2582, 29889, 1202, 29898, 1482, 29918, 978, 29897, 13, 13, 1678, 25342, 5751, 29889, 2467, 1275, 525, 4397, 2396, 13, 4706, 565, 5751, 29889, 1191, 29906, 1275, 525, 1266, 29915, 322, 451, 8952, 29889, 1975, 2541, 29898, 7491, 29889, 1191, 29896, 1125, 13, 9651, 2582, 29889, 1202, 29898, 6786, 718, 5751, 29889, 1191, 29896, 29897, 13, 4706, 25342, 5751, 29889, 1191, 29906, 1275, 525, 1563, 29915, 322, 451, 8952, 29889, 27382, 2541, 29898, 7491, 29889, 1191, 29896, 1125, 13, 9651, 2582, 29889, 1202, 29898, 7491, 29889, 1191, 29896, 718, 8952, 29897, 13, 4706, 25342, 5751, 29889, 1191, 29906, 1275, 525, 20313, 2396, 13, 9651, 1024, 353, 8952, 13, 9651, 565, 451, 8952, 29889, 1975, 2541, 29898, 7491, 29889, 1191, 29896, 1125, 13, 18884, 1024, 353, 5751, 29889, 1191, 29896, 718, 1024, 13, 9651, 565, 451, 8952, 29889, 27382, 2541, 29898, 7491, 29889, 1191, 29896, 1125, 13, 18884, 1024, 353, 1024, 718, 5751, 29889, 1191, 29896, 13, 9651, 2582, 29889, 1202, 29898, 978, 29897, 13, 13, 4706, 2748, 29918, 4530, 353, 5852, 13, 13, 1678, 25342, 5751, 29889, 2467, 1275, 525, 5992, 29899, 1066, 2396, 13, 4706, 926, 353, 938, 29898, 7491, 29889, 1191, 29896, 29897, 13, 4706, 716, 29918, 6786, 353, 8952, 7503, 1066, 29962, 718, 8952, 29961, 1066, 29974, 29896, 17531, 13, 4706, 2582, 29889, 1202, 29898, 1482, 29918, 6786, 29897, 13, 13, 4706, 2748, 29918, 4530, 353, 5852, 13, 13, 1678, 736, 2582, 29892, 2748, 29918, 4530, 13, 13, 13, 13, 1753, 1889, 29918, 19238, 29918, 3757, 25397, 29898, 375, 824, 1280, 29892, 6865, 29892, 2582, 1125, 13, 1678, 363, 8952, 297, 502, 824, 1280, 29901, 13, 4706, 363, 364, 297, 6865, 29901, 13, 9651, 620, 29892, 2748, 29918, 4530, 353, 3394, 29918, 7491, 29898, 6786, 29892, 364, 29897, 13, 9651, 716, 29918, 690, 353, 620, 29889, 29881, 17678, 29898, 9902, 29897, 13, 13, 9651, 565, 2748, 29918, 4530, 29901, 13, 18884, 2582, 353, 2582, 891, 716, 29918, 690, 13, 18884, 6773, 13, 13, 9651, 565, 451, 716, 29918, 690, 29901, 13, 18884, 6773, 13, 13, 9651, 363, 1121, 297, 716, 29918, 690, 29901, 13, 18884, 1162, 29918, 690, 353, 1889, 29918, 19238, 29918, 3757, 25397, 29898, 842, 3319, 2914, 9594, 6865, 29892, 2582, 891, 716, 29918, 690, 29897, 13, 18884, 2582, 353, 2582, 891, 1162, 29918, 690, 891, 716, 29918, 690, 13, 13, 1678, 736, 2582, 13, 13, 13, 1753, 1889, 29918, 19238, 29898, 375, 824, 1280, 29892, 6865, 1125, 13, 1678, 736, 1889, 29918, 19238, 29918, 3757, 25397, 29898, 375, 824, 1280, 29892, 6865, 29892, 502, 824, 1280, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 4706, 883, 2620, 29918, 1990, 29922, 1191, 5510, 29889, 22131, 9868, 29648, 18522, 29892, 13, 4706, 6139, 543, 20249, 5478, 362, 2471, 613, 13, 1678, 1723, 13, 1678, 8952, 29918, 2972, 353, 13812, 29889, 1202, 29918, 6149, 1474, 29918, 735, 7009, 573, 29918, 2972, 29898, 12403, 29922, 5574, 29897, 13, 1678, 8952, 29918, 2972, 29889, 1202, 29918, 23516, 29898, 13, 4706, 525, 489, 6786, 742, 13, 4706, 1371, 543, 20249, 304, 5478, 403, 613, 13, 1678, 1723, 13, 1678, 8952, 29918, 2972, 29889, 1202, 29918, 23516, 29898, 13, 4706, 525, 489, 6786, 29899, 1761, 742, 13, 4706, 1371, 543, 3434, 3871, 310, 8952, 1051, 304, 5478, 403, 613, 13, 1678, 1723, 13, 1678, 8952, 29918, 2972, 29889, 1202, 29918, 23516, 29898, 13, 4706, 17411, 29902, 742, 13, 4706, 525, 489, 6786, 29899, 2080, 742, 13, 4706, 3158, 2433, 8899, 29918, 3009, 742, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 1371, 543, 2577, 502, 824, 1280, 515, 3659, 262, 613, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 525, 7491, 29918, 9507, 742, 13, 4706, 1134, 29922, 710, 29892, 13, 4706, 1371, 543, 10740, 304, 5478, 403, 313, 4149, 6865, 3884, 19123, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 525, 489, 5992, 29899, 5203, 742, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 3158, 2433, 8899, 29918, 3009, 742, 13, 4706, 1371, 543, 15941, 2998, 502, 824, 1280, 515, 1962, 613, 13, 1678, 1723, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 565, 6389, 29889, 6786, 29901, 13, 4706, 502, 824, 1280, 353, 731, 3319, 5085, 29889, 6786, 1800, 13, 1678, 25342, 6389, 29889, 6786, 29918, 1761, 29901, 13, 4706, 502, 824, 1280, 353, 731, 29898, 3150, 29898, 5085, 29889, 6786, 29918, 1761, 467, 949, 2141, 5451, 9012, 3101, 13, 1678, 1683, 29901, 13, 4706, 1053, 10876, 13, 4706, 502, 824, 1280, 353, 731, 580, 13, 4706, 363, 1196, 297, 10876, 29889, 4172, 262, 29901, 13, 9651, 502, 824, 1280, 29889, 1202, 29898, 1220, 29889, 17010, 3101, 13, 13, 1678, 6865, 353, 1051, 29898, 1359, 29918, 19238, 29898, 5085, 29889, 7491, 29918, 9507, 876, 13, 13, 1678, 716, 29918, 375, 824, 1280, 353, 1889, 29918, 19238, 29898, 375, 824, 1280, 29892, 6865, 29897, 13, 13, 1678, 565, 6389, 29889, 5992, 29918, 5203, 29901, 13, 4706, 502, 824, 1280, 353, 716, 29918, 375, 824, 1280, 29889, 29881, 17678, 29898, 375, 824, 1280, 29897, 13, 1678, 1683, 29901, 13, 4706, 502, 824, 1280, 353, 716, 29918, 375, 824, 1280, 13, 13, 1678, 1596, 28909, 29876, 4286, 7122, 29898, 375, 824, 1280, 876, 13, 2 ]
Xana/ProcData/CbfMethods.py
ClLov/Xana
0
148130
<gh_stars>0 from os.path import isfile import cbf #################################### #--- Standard cbf w/r functions ---# #################################### def loadcbf(filename): if isfile(filename): f = cbf.read(filename) return f.data else: print("file ", filename, " does not exist!") return 0 def savecbf(filename, data): if not isfile(filename): cbf.write(filename, data) else: print("file ", filename, " does already exist!") return None def headercbf(filename): if isfile(filename): f = cbf.read(filename) return f.metadata else: print("file ", filename, " does not exist!") return 0
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 2897, 29889, 2084, 1053, 338, 1445, 13, 5215, 274, 1635, 13, 13, 13383, 13383, 4136, 13, 29937, 5634, 10117, 274, 1635, 281, 29914, 29878, 3168, 11474, 29937, 13, 13383, 13383, 4136, 13, 13, 1753, 2254, 29883, 1635, 29898, 9507, 1125, 13, 1678, 565, 338, 1445, 29898, 9507, 1125, 13, 4706, 285, 353, 274, 1635, 29889, 949, 29898, 9507, 29897, 13, 4706, 736, 285, 29889, 1272, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 1445, 9162, 10422, 29892, 376, 947, 451, 1863, 29991, 1159, 13, 4706, 736, 29871, 29900, 13, 13, 1753, 872, 2003, 1635, 29898, 9507, 29892, 848, 1125, 13, 1678, 565, 451, 338, 1445, 29898, 9507, 1125, 13, 4706, 274, 1635, 29889, 3539, 29898, 9507, 29892, 848, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 1445, 9162, 10422, 29892, 376, 947, 2307, 1863, 29991, 1159, 13, 1678, 736, 6213, 13, 13, 1753, 4839, 29883, 1635, 29898, 9507, 1125, 13, 1678, 565, 338, 1445, 29898, 9507, 1125, 13, 4706, 285, 353, 274, 1635, 29889, 949, 29898, 9507, 29897, 13, 4706, 736, 285, 29889, 19635, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 1445, 9162, 10422, 29892, 376, 947, 451, 1863, 29991, 1159, 13, 4706, 736, 29871, 29900, 13, 2 ]
performance/driver/classes/channel/cmdline.py
mesosphere/dcos-perf-test-driver
2
90274
import fcntl import os import select import shlex import signal import threading import time from subprocess import Popen, PIPE from performance.driver.core.events import Event, LogLineEvent, ParameterUpdateEvent, TeardownEvent, StartEvent from performance.driver.core.template import TemplateString, TemplateDict from performance.driver.core.classes import Channel from performance.driver.core.reflection import subscribesToHint, publishesHint from performance.driver.core.utils import parseTimeExpr class CmdlineExitEvent(Event): """ This event is published when the process launched through the cmdline channel has completed. The exit code is tracked. """ def __init__(self, exitcode, **kwargs): super().__init__(**kwargs) #: The exit code of the application launched by the command-line channel self.exitcode = exitcode class CmdlineExitZeroEvent(CmdlineExitEvent): """ This event is published when the process exited and the exit code is zero """ class CmdlineExitNonzeroEvent(CmdlineExitEvent): """ This event is published when the process exited and the exit code is non-zero """ class CmdlineStartedEvent(Event): """ This event is published when the process has started. It contains the process ID so the observers can attach to the process and extract useful data. """ def __init__(self, pid, *args, **kwargs): super().__init__(*args, **kwargs) self.pid = pid class CmdlineChannel(Channel): """ The *Command-line Channel* launches an application, passes the test parameters through command-line arguments and monitors it's standard output and error. :: channels: - class: channel.CmdlineChannel # The command-line to launch. cmdline: "path/to/app --args {{macros}}" # [Optional] The standard input to send to the application stdin: | some arbitrary payload with {{macros}} in it's body. # [Optional] Environment variables to define env: variable: value other: "value with {{macros}}" # [Optional] The directory to launch this app in cwd: "{{marathon_repo_dir}}" # [Optional] The script to use for teardown teardown: stop_daemon # [Optional] If set to `yes` the app will be launched as soon # as the driver is up and running. atstart: yes # [Optional] If set to `yes` (default) the app will be re-launched # if it exits on it's own. restart: yes # [Optional] If set to `yes` the "cmdline" expression will be evalued # in a shell. shell: no # [Optional] The time between the SIGINT and the SIGKILL signal gracePeriod: 10s # [Optional] Change the `kind` of log messages emitted by this channel # instead of using the default 'stdout' / 'stderr' kind: stdout: custom_out stderr: custom_err When a parameter is changed, the channel will kill the process and re-launch it with the new command-line. For every line in standard inout or output, a ``LogLineEvent`` is emitted with the contents of the line. When the application launched through this channel exits the channel can take two actions depending on it's configuration: * If ``restart: yes`` is specitied (default), the channel will re-launch the application in oder to always keep it running. * If ``restart: no`` is specified, the channel will give up and publish a ``CmdlineExitZeroEvent`` or a ``CmdlineExitNonzeroEvent`` according to the exit code of the application. .. note:: Note that if there are no ``{{macro}}`` defined anywhere in the body of the configuration this channel will not be triggered when a parameter is updated and thus the application will never be launched. If you still want the application to be launched, use the ``atstart: yes`` parameter to instruct the channel to launch the application at start. """ @subscribesToHint(ParameterUpdateEvent, TeardownEvent, StartEvent) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.activeTask = None self.activeParameters = {} self.killing = False self.lastTraceId = None # Receive parameter updates and clean-up on teardown self.eventbus.subscribe(self.handleTeardown, events=(TeardownEvent, )) self.eventbus.subscribe(self.handleStart, events=(StartEvent, )) # Get some template self.cmdlineTpl = TemplateString(self.getConfig('cmdline')) self.stdinTpl = TemplateString(self.getConfig('stdin', '')) self.envTpl = TemplateDict(self.getConfig('env', {})) self.cwdTpl = TemplateString(self.getConfig('cwd', '')) self.graceTpl = TemplateString(self.getConfig('gracePeriod', '10s')) self.teardownTpl = TemplateString(self.getConfig('teardown', '')) # Get some options config = self.getRenderedConfig() self.kindMap = config.get('kind', {}) if not 'stdout' in self.kindMap: self.kindMap['stdout'] = 'stdout' if not 'stderr' in self.kindMap: self.kindMap['stderr'] = 'stderr' @publishesHint(LogLineEvent, CmdlineExitEvent, CmdlineExitZeroEvent, CmdlineExitNonzeroEvent) def monitor(self, sourceName, proc, stdin=None): """ Oversees the execution of the process """ lines = ['', ''] # Make read operations non-blocking flag = fcntl.fcntl(proc.stdout.fileno(), fcntl.F_GETFD) fcntl.fcntl(proc.stdout.fileno(), fcntl.F_SETFL, flag | os.O_NONBLOCK) flag = fcntl.fcntl(proc.stderr.fileno(), fcntl.F_GETFD) fcntl.fcntl(proc.stderr.fileno(), fcntl.F_SETFL, flag | os.O_NONBLOCK) # Send stdin if stdin and not proc.stdin is None: proc.stdin.write(stdin) proc.stdin.close() # Wait for input in the FDs while True: if proc.poll() is None: # While process is running, use `select` to wait for an stdout/err # FD event before reading. (rlist, wlist, xlist) = select.select([proc.stdout, proc.stderr], [], []) if proc.stdout in rlist: block = proc.stdout.read(1024 * 1024) lines[0] += block.decode('utf-8') while '\n' in lines[0]: (line, lines[0]) = lines[0].split('\n', 1) self.eventbus.publish( LogLineEvent( line, sourceName, self.kindMap['stdout'], traceid=self.lastTraceId)) if proc.stderr in rlist: block = proc.stderr.read(1024 * 1024) lines[1] += block.decode('utf-8') while '\n' in lines[1]: (line, lines[1]) = lines[1].split('\n', 1) self.eventbus.publish( LogLineEvent( line, sourceName, self.kindMap['stderr'], traceid=self.lastTraceId)) else: # Drain buffers since after the process has exited, select might not work # and some remaining bytes will remain not processed. block = proc.stdout.read() if block: lines[0] += block.decode('utf-8') for line in lines[0].split('\n'): if line.strip(): self.eventbus.publish( LogLineEvent( line, sourceName, self.kindMap['stdout'], traceid=self.lastTraceId)) block = proc.stderr.read() if block: lines[1] += block.decode('utf-8') for line in lines[0].split('\n'): if line.strip(): self.eventbus.publish( LogLineEvent( line, sourceName, self.kindMap['stderr'], traceid=self.lastTraceId)) # Break loop break # Mark as stopped self.activeTask = None if not self.killing: # Dispatch the correct exit message self.logger.debug('Process exited with code {}'.format(proc.returncode)) if proc.returncode == 0: self.eventbus.publish( CmdlineExitZeroEvent(proc.returncode, traceid=self.lastTraceId)) else: self.eventbus.publish( CmdlineExitNonzeroEvent(proc.returncode, traceid=self.lastTraceId)) # Restart if configured if self.getConfig('restart', True): self.logger.warn('Process exited prematurely') self.launch(self.activeParameters) else: self.logger.info('Process completed') def kill(self): """ Kill the currently running proc """ if not self.activeTask: return # Get grace period macroValues = self.getDefinitions() gracePeriod = parseTimeExpr(self.graceTpl.apply(macroValues)) shell = self.getConfig('shell', False) # If we have a tear-down command, launch it now teardownCmd = self.teardownTpl.apply(macroValues) if teardownCmd: env = self.envTpl.apply(macroValues) if not env: env = None cwd = self.cwdTpl.apply(macroValues) if not cwd: cwd = None # Launch teardown process self.logger.info('Launching tear-down command: {}'.format(teardownCmd)) proc = Popen( teardownCmd, env=env, cwd=cwd, shell=True, preexec_fn=os.setsid) # Wait for the command to exit exitcode = proc.wait() self.logger.info('Tear-down process completed with {}'.format(exitcode)) # Then, try interrupting the process self.killing = True proc, thread = self.activeTask try: if proc.poll() is None: self.logger.debug('Sending SIGINT') os.killpg(os.getpgid(proc.pid), signal.SIGINT) except ProcessLookupError: pass # Wait for a grace period timeout = time.time() + gracePeriod self.logger.debug('Waiting for app to be terminated') while proc.poll() is None and time.time() < timeout: time.sleep(1) # And try killing it try: if proc.poll() is None: self.logger.debug('Sending SIGKILL') os.killpg(os.getpgid(proc.pid), signal.SIGTERM) except ProcessLookupError: pass thread.join() # Unset active task self.activeTask = None self.killing = False def launch(self, parameters): """ Launch process with the given command-line """ # Compose the arguments for the execution cwd = self.getConfig('cwd', required=False) shell = self.getConfig('shell', False) # Combine parameters with the definitions macroValues = self.getDefinitions().fork(parameters) # Compile arguments cmdline = self.cmdlineTpl.apply(macroValues) if not shell: args = shlex.split(cmdline) else: args = cmdline stdin = self.stdinTpl.apply(macroValues) env = self.envTpl.apply(macroValues) cwd = self.cwdTpl.apply(macroValues) # Reset empty arguments to `None` if not stdin: stdin = None if not cwd: cwd = None if not env: env = None # Launch self.logger.debug('Starting process: \'{}\''.format( args if type(args) is str else ' '.join(args))) self.activeParameters = parameters proc = Popen( args, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env, cwd=cwd, shell=shell, preexec_fn=os.setsid) # Dispatch start event self.eventbus.publish(CmdlineStartedEvent(proc.pid)) # Launch a thread to monitor it's output thread = threading.Thread( target=self.monitor, name='cmdline-monitor', args=(args[0], proc, stdin)) thread.start() # Keep track of the active task self.activeTask = (proc, thread) def handleTeardown(self, event): """ Kill process at teardown """ if self.activeTask: self.logger.warn('Killing running process') self.kill() def handleStart(self, event): """ Handle the start event """ # If this app is instructed to launch at start, satisfy this requirement now atstart = self.getConfig('atstart', default=False) if atstart: self.handleParameterUpdate(ParameterUpdateEvent({}, {}, {})) def handleParameterUpdate(self, event): """ Handle a property update """ # If we have already a task running don't re-launch it unless # the received properties are actually updating one or more parameters # in our template if self.activeTask: # We have a parameter change, kill the process # and schedule a new execution later self.kill() # Keep track of the traceid that initiated the process. This way we can # track the events that were derrived from this parameter update. self.lastTraceId = event.traceids # Launch new process self.launch(event.parameters)
[ 1, 1053, 285, 20047, 29880, 13, 5215, 2897, 13, 5215, 1831, 13, 5215, 528, 2506, 13, 5215, 7182, 13, 5215, 3244, 292, 13, 5215, 931, 13, 13, 3166, 1014, 5014, 1053, 349, 3150, 29892, 349, 29902, 4162, 13, 13, 3166, 4180, 29889, 9465, 29889, 3221, 29889, 13604, 1053, 6864, 29892, 4522, 3542, 2624, 29892, 24953, 6422, 2624, 29892, 1920, 538, 776, 2624, 29892, 7370, 2624, 13, 3166, 4180, 29889, 9465, 29889, 3221, 29889, 6886, 1053, 25663, 1231, 29892, 25663, 21533, 13, 3166, 4180, 29889, 9465, 29889, 3221, 29889, 13203, 1053, 17368, 13, 3166, 4180, 29889, 9465, 29889, 3221, 29889, 999, 1464, 1053, 21696, 5707, 1762, 28016, 29892, 9805, 267, 28016, 13, 3166, 4180, 29889, 9465, 29889, 3221, 29889, 13239, 1053, 6088, 2481, 21176, 13, 13, 13, 1990, 315, 3487, 1220, 24365, 2624, 29898, 2624, 1125, 13, 29871, 9995, 13, 29871, 910, 1741, 338, 6369, 746, 278, 1889, 15241, 1549, 278, 9920, 1220, 8242, 13, 29871, 756, 8676, 29889, 450, 6876, 775, 338, 5702, 287, 29889, 13, 29871, 9995, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 6876, 401, 29892, 3579, 19290, 1125, 13, 1678, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 13, 1678, 396, 29901, 450, 6876, 775, 310, 278, 2280, 15241, 491, 278, 1899, 29899, 1220, 8242, 13, 1678, 1583, 29889, 13322, 401, 353, 6876, 401, 13, 13, 13, 1990, 315, 3487, 1220, 24365, 24214, 2624, 29898, 23651, 1220, 24365, 2624, 1125, 13, 29871, 9995, 13, 29871, 910, 1741, 338, 6369, 746, 278, 1889, 429, 1573, 322, 278, 6876, 775, 13, 29871, 338, 5225, 13, 29871, 9995, 13, 13, 13, 1990, 315, 3487, 1220, 24365, 12283, 9171, 2624, 29898, 23651, 1220, 24365, 2624, 1125, 13, 29871, 9995, 13, 29871, 910, 1741, 338, 6369, 746, 278, 1889, 429, 1573, 322, 278, 6876, 775, 13, 29871, 338, 1661, 29899, 9171, 13, 29871, 9995, 13, 13, 13, 1990, 315, 3487, 1220, 4763, 287, 2624, 29898, 2624, 1125, 13, 29871, 9995, 13, 29871, 910, 1741, 338, 6369, 746, 278, 1889, 756, 4687, 29889, 739, 3743, 278, 1889, 13, 29871, 3553, 577, 278, 5366, 874, 508, 10641, 304, 278, 1889, 322, 6597, 5407, 848, 29889, 13, 29871, 9995, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 23107, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 1678, 1583, 29889, 5935, 353, 23107, 13, 13, 13, 1990, 315, 3487, 1220, 13599, 29898, 13599, 1125, 13, 29871, 9995, 13, 29871, 450, 334, 6255, 29899, 1220, 17368, 29930, 6826, 267, 385, 2280, 29892, 14517, 278, 1243, 4128, 13, 29871, 1549, 1899, 29899, 1220, 6273, 322, 1601, 17259, 372, 29915, 29879, 3918, 1962, 322, 1059, 29889, 13, 13, 29871, 4761, 13, 13, 1678, 18196, 29901, 13, 418, 448, 770, 29901, 8242, 29889, 23651, 1220, 13599, 13, 13, 4706, 396, 450, 1899, 29899, 1220, 304, 6826, 29889, 13, 4706, 9920, 1220, 29901, 376, 2084, 29914, 517, 29914, 932, 1192, 5085, 8620, 8628, 1883, 930, 29908, 13, 13, 4706, 396, 518, 27636, 29962, 450, 3918, 1881, 304, 3638, 304, 278, 2280, 13, 4706, 3659, 262, 29901, 891, 13, 3986, 777, 11472, 20092, 411, 8620, 8628, 1883, 930, 13, 3986, 297, 372, 29915, 29879, 3573, 29889, 13, 13, 4706, 396, 518, 27636, 29962, 16738, 3651, 304, 4529, 13, 4706, 8829, 29901, 13, 3986, 2286, 29901, 995, 13, 3986, 916, 29901, 376, 1767, 411, 8620, 8628, 1883, 930, 29908, 13, 13, 4706, 396, 518, 27636, 29962, 450, 3884, 304, 6826, 445, 623, 297, 13, 4706, 274, 9970, 29901, 376, 6224, 3034, 25206, 29918, 20095, 29918, 3972, 930, 29908, 13, 13, 4706, 396, 518, 27636, 29962, 450, 2471, 304, 671, 363, 734, 538, 776, 13, 4706, 734, 538, 776, 29901, 5040, 29918, 1388, 9857, 13, 13, 4706, 396, 518, 27636, 29962, 960, 731, 304, 421, 3582, 29952, 278, 623, 674, 367, 15241, 408, 4720, 13, 4706, 396, 408, 278, 7156, 338, 701, 322, 2734, 29889, 13, 4706, 472, 2962, 29901, 4874, 13, 13, 4706, 396, 518, 27636, 29962, 960, 731, 304, 421, 3582, 29952, 313, 4381, 29897, 278, 623, 674, 367, 337, 29899, 15343, 287, 13, 4706, 396, 565, 372, 429, 1169, 373, 372, 29915, 29879, 1914, 29889, 13, 4706, 10715, 29901, 4874, 13, 13, 4706, 396, 518, 27636, 29962, 960, 731, 304, 421, 3582, 29952, 278, 376, 9006, 1220, 29908, 4603, 674, 367, 6161, 287, 13, 4706, 396, 297, 263, 6473, 29889, 13, 4706, 6473, 29901, 694, 13, 13, 4706, 396, 518, 27636, 29962, 450, 931, 1546, 278, 317, 6259, 10192, 322, 278, 317, 6259, 29968, 24071, 7182, 13, 4706, 17659, 29853, 29901, 29871, 29896, 29900, 29879, 13, 13, 4706, 396, 518, 27636, 29962, 10726, 278, 421, 14380, 29952, 310, 1480, 7191, 953, 4430, 491, 445, 8242, 13, 4706, 396, 2012, 310, 773, 278, 2322, 525, 25393, 29915, 847, 525, 303, 20405, 29915, 13, 4706, 2924, 29901, 13, 3986, 27591, 29901, 2888, 29918, 449, 13, 3986, 380, 20405, 29901, 2888, 29918, 3127, 13, 13, 29871, 1932, 263, 3443, 338, 3939, 29892, 278, 8242, 674, 12088, 278, 1889, 322, 337, 29899, 15343, 13, 29871, 372, 411, 278, 716, 1899, 29899, 1220, 29889, 13, 13, 29871, 1152, 1432, 1196, 297, 3918, 297, 449, 470, 1962, 29892, 263, 4954, 3403, 3542, 2624, 16159, 338, 953, 4430, 13, 29871, 411, 278, 8118, 310, 278, 1196, 29889, 13, 13, 29871, 1932, 278, 2280, 15241, 1549, 445, 8242, 429, 1169, 278, 8242, 508, 2125, 13, 29871, 1023, 8820, 8679, 373, 372, 29915, 29879, 5285, 29901, 13, 13, 29871, 334, 960, 4954, 5060, 442, 29901, 4874, 16159, 338, 1580, 277, 1000, 313, 4381, 511, 278, 8242, 674, 337, 29899, 15343, 278, 13, 1678, 2280, 297, 4461, 304, 2337, 3013, 372, 2734, 29889, 13, 13, 29871, 334, 960, 4954, 5060, 442, 29901, 694, 16159, 338, 6790, 29892, 278, 8242, 674, 2367, 701, 322, 9805, 263, 13, 1678, 4954, 23651, 1220, 24365, 24214, 2624, 16159, 470, 263, 4954, 23651, 1220, 24365, 12283, 9171, 2624, 16159, 5034, 304, 278, 13, 1678, 6876, 775, 310, 278, 2280, 29889, 13, 13, 29871, 6317, 4443, 1057, 13, 268, 3940, 393, 565, 727, 526, 694, 4954, 6224, 25254, 930, 16159, 3342, 12214, 297, 278, 3573, 310, 13, 268, 278, 5285, 445, 8242, 674, 451, 367, 19799, 746, 263, 3443, 13, 268, 338, 4784, 322, 4550, 278, 2280, 674, 2360, 367, 15241, 29889, 13, 13, 268, 960, 366, 1603, 864, 278, 2280, 304, 367, 15241, 29892, 671, 278, 4954, 271, 2962, 29901, 4874, 16159, 13, 268, 3443, 304, 18690, 278, 8242, 304, 6826, 278, 2280, 472, 1369, 29889, 13, 13, 29871, 9995, 13, 13, 29871, 732, 1491, 7588, 5707, 1762, 28016, 29898, 9329, 6422, 2624, 29892, 1920, 538, 776, 2624, 29892, 7370, 2624, 29897, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 1678, 1583, 29889, 4925, 5398, 353, 6213, 13, 1678, 1583, 29889, 4925, 11507, 353, 6571, 13, 1678, 1583, 29889, 29895, 8873, 353, 7700, 13, 1678, 1583, 29889, 4230, 11591, 1204, 353, 6213, 13, 13, 1678, 396, 24328, 573, 3443, 11217, 322, 5941, 29899, 786, 373, 734, 538, 776, 13, 1678, 1583, 29889, 3696, 8262, 29889, 19496, 29898, 1311, 29889, 8411, 7141, 538, 776, 29892, 4959, 7607, 7141, 538, 776, 2624, 29892, 29871, 876, 13, 1678, 1583, 29889, 3696, 8262, 29889, 19496, 29898, 1311, 29889, 8411, 4763, 29892, 4959, 7607, 4763, 2624, 29892, 29871, 876, 13, 13, 1678, 396, 3617, 777, 4472, 13, 1678, 1583, 29889, 9006, 1220, 29911, 572, 353, 25663, 1231, 29898, 1311, 29889, 657, 3991, 877, 9006, 1220, 8785, 13, 1678, 1583, 29889, 4172, 262, 29911, 572, 353, 25663, 1231, 29898, 1311, 29889, 657, 3991, 877, 4172, 262, 742, 6629, 876, 13, 1678, 1583, 29889, 6272, 29911, 572, 353, 25663, 21533, 29898, 1311, 29889, 657, 3991, 877, 6272, 742, 6571, 876, 13, 1678, 1583, 29889, 29883, 9970, 29911, 572, 353, 25663, 1231, 29898, 1311, 29889, 657, 3991, 877, 29883, 9970, 742, 6629, 876, 13, 1678, 1583, 29889, 3874, 346, 29911, 572, 353, 25663, 1231, 29898, 1311, 29889, 657, 3991, 877, 3874, 346, 29853, 742, 525, 29896, 29900, 29879, 8785, 13, 1678, 1583, 29889, 371, 538, 776, 29911, 572, 353, 25663, 1231, 29898, 1311, 29889, 657, 3991, 877, 371, 538, 776, 742, 6629, 876, 13, 13, 1678, 396, 3617, 777, 3987, 13, 1678, 2295, 353, 1583, 29889, 657, 10716, 287, 3991, 580, 13, 1678, 1583, 29889, 14380, 3388, 353, 2295, 29889, 657, 877, 14380, 742, 426, 1800, 13, 1678, 565, 451, 525, 25393, 29915, 297, 1583, 29889, 14380, 3388, 29901, 13, 418, 1583, 29889, 14380, 3388, 1839, 25393, 2033, 353, 525, 25393, 29915, 13, 1678, 565, 451, 525, 303, 20405, 29915, 297, 1583, 29889, 14380, 3388, 29901, 13, 418, 1583, 29889, 14380, 3388, 1839, 303, 20405, 2033, 353, 525, 303, 20405, 29915, 13, 13, 29871, 732, 23679, 267, 28016, 29898, 3403, 3542, 2624, 29892, 315, 3487, 1220, 24365, 2624, 29892, 315, 3487, 1220, 24365, 24214, 2624, 29892, 13, 462, 315, 3487, 1220, 24365, 12283, 9171, 2624, 29897, 13, 29871, 822, 11819, 29898, 1311, 29892, 2752, 1170, 29892, 9580, 29892, 3659, 262, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 438, 3901, 267, 278, 8225, 310, 278, 1889, 13, 1678, 9995, 13, 1678, 3454, 353, 6024, 742, 525, 2033, 13, 13, 1678, 396, 8561, 1303, 6931, 1661, 29899, 1271, 292, 13, 1678, 7353, 353, 285, 20047, 29880, 29889, 13801, 593, 29880, 29898, 15439, 29889, 25393, 29889, 1777, 8154, 3285, 285, 20047, 29880, 29889, 29943, 29918, 7194, 26453, 29897, 13, 1678, 285, 20047, 29880, 29889, 13801, 593, 29880, 29898, 15439, 29889, 25393, 29889, 1777, 8154, 3285, 285, 20047, 29880, 29889, 29943, 29918, 1660, 8969, 29931, 29892, 7353, 891, 2897, 29889, 29949, 29918, 29940, 1164, 29933, 21339, 29897, 13, 13, 1678, 7353, 353, 285, 20047, 29880, 29889, 13801, 593, 29880, 29898, 15439, 29889, 303, 20405, 29889, 1777, 8154, 3285, 285, 20047, 29880, 29889, 29943, 29918, 7194, 26453, 29897, 13, 1678, 285, 20047, 29880, 29889, 13801, 593, 29880, 29898, 15439, 29889, 303, 20405, 29889, 1777, 8154, 3285, 285, 20047, 29880, 29889, 29943, 29918, 1660, 8969, 29931, 29892, 7353, 891, 2897, 29889, 29949, 29918, 29940, 1164, 29933, 21339, 29897, 13, 13, 1678, 396, 15076, 3659, 262, 13, 1678, 565, 3659, 262, 322, 451, 9580, 29889, 4172, 262, 338, 6213, 29901, 13, 418, 9580, 29889, 4172, 262, 29889, 3539, 29898, 4172, 262, 29897, 13, 418, 9580, 29889, 4172, 262, 29889, 5358, 580, 13, 13, 1678, 396, 20340, 363, 1881, 297, 278, 383, 29928, 29879, 13, 1678, 1550, 5852, 29901, 13, 418, 565, 9580, 29889, 29886, 3028, 580, 338, 6213, 29901, 13, 13, 4706, 396, 5806, 1889, 338, 2734, 29892, 671, 421, 2622, 29952, 304, 4480, 363, 385, 27591, 29914, 3127, 13, 4706, 396, 383, 29928, 1741, 1434, 5183, 29889, 13, 4706, 313, 29878, 1761, 29892, 281, 1761, 29892, 921, 1761, 29897, 353, 1831, 29889, 2622, 4197, 15439, 29889, 25393, 29892, 9580, 29889, 303, 20405, 1402, 19997, 13, 462, 462, 795, 518, 2314, 13, 4706, 565, 9580, 29889, 25393, 297, 364, 1761, 29901, 13, 3986, 2908, 353, 9580, 29889, 25393, 29889, 949, 29898, 29896, 29900, 29906, 29946, 334, 29871, 29896, 29900, 29906, 29946, 29897, 13, 3986, 3454, 29961, 29900, 29962, 4619, 2908, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 3986, 1550, 11297, 29876, 29915, 297, 3454, 29961, 29900, 5387, 13, 9651, 313, 1220, 29892, 3454, 29961, 29900, 2314, 353, 3454, 29961, 29900, 1822, 5451, 28909, 29876, 742, 29871, 29896, 29897, 13, 9651, 1583, 29889, 3696, 8262, 29889, 23679, 29898, 13, 18884, 4522, 3542, 2624, 29898, 13, 462, 1678, 1196, 29892, 2752, 1170, 29892, 1583, 29889, 14380, 3388, 1839, 25393, 7464, 13, 462, 1678, 9637, 333, 29922, 1311, 29889, 4230, 11591, 1204, 876, 13, 13, 4706, 565, 9580, 29889, 303, 20405, 297, 364, 1761, 29901, 13, 3986, 2908, 353, 9580, 29889, 303, 20405, 29889, 949, 29898, 29896, 29900, 29906, 29946, 334, 29871, 29896, 29900, 29906, 29946, 29897, 13, 3986, 3454, 29961, 29896, 29962, 4619, 2908, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 3986, 1550, 11297, 29876, 29915, 297, 3454, 29961, 29896, 5387, 13, 9651, 313, 1220, 29892, 3454, 29961, 29896, 2314, 353, 3454, 29961, 29896, 1822, 5451, 28909, 29876, 742, 29871, 29896, 29897, 13, 9651, 1583, 29889, 3696, 8262, 29889, 23679, 29898, 13, 18884, 4522, 3542, 2624, 29898, 13, 462, 1678, 1196, 29892, 2752, 1170, 29892, 1583, 29889, 14380, 3388, 1839, 303, 20405, 7464, 13, 462, 1678, 9637, 333, 29922, 1311, 29889, 4230, 11591, 1204, 876, 13, 13, 418, 1683, 29901, 13, 13, 4706, 396, 360, 6038, 20487, 414, 1951, 1156, 278, 1889, 756, 429, 1573, 29892, 1831, 1795, 451, 664, 13, 4706, 396, 322, 777, 9886, 6262, 674, 3933, 451, 19356, 29889, 13, 4706, 2908, 353, 9580, 29889, 25393, 29889, 949, 580, 13, 4706, 565, 2908, 29901, 13, 3986, 3454, 29961, 29900, 29962, 4619, 2908, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 3986, 363, 1196, 297, 3454, 29961, 29900, 1822, 5451, 28909, 29876, 29374, 13, 9651, 565, 1196, 29889, 17010, 7295, 13, 795, 1583, 29889, 3696, 8262, 29889, 23679, 29898, 13, 462, 29871, 4522, 3542, 2624, 29898, 13, 462, 418, 1196, 29892, 2752, 1170, 29892, 1583, 29889, 14380, 3388, 1839, 25393, 7464, 13, 462, 418, 9637, 333, 29922, 1311, 29889, 4230, 11591, 1204, 876, 13, 13, 4706, 2908, 353, 9580, 29889, 303, 20405, 29889, 949, 580, 13, 4706, 565, 2908, 29901, 13, 3986, 3454, 29961, 29896, 29962, 4619, 2908, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 3986, 363, 1196, 297, 3454, 29961, 29900, 1822, 5451, 28909, 29876, 29374, 13, 9651, 565, 1196, 29889, 17010, 7295, 13, 795, 1583, 29889, 3696, 8262, 29889, 23679, 29898, 13, 462, 29871, 4522, 3542, 2624, 29898, 13, 462, 418, 1196, 29892, 2752, 1170, 29892, 1583, 29889, 14380, 3388, 1839, 303, 20405, 7464, 13, 462, 418, 9637, 333, 29922, 1311, 29889, 4230, 11591, 1204, 876, 13, 13, 4706, 396, 28301, 2425, 13, 4706, 2867, 13, 13, 1678, 396, 4485, 408, 11084, 13, 1678, 1583, 29889, 4925, 5398, 353, 6213, 13, 1678, 565, 451, 1583, 29889, 29895, 8873, 29901, 13, 13, 418, 396, 3295, 5041, 278, 1959, 6876, 2643, 13, 418, 1583, 29889, 21707, 29889, 8382, 877, 7032, 429, 1573, 411, 775, 6571, 4286, 4830, 29898, 15439, 29889, 2457, 401, 876, 13, 418, 565, 9580, 29889, 2457, 401, 1275, 29871, 29900, 29901, 13, 4706, 1583, 29889, 3696, 8262, 29889, 23679, 29898, 13, 9651, 315, 3487, 1220, 24365, 24214, 2624, 29898, 15439, 29889, 2457, 401, 29892, 9637, 333, 29922, 1311, 29889, 4230, 11591, 1204, 876, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 3696, 8262, 29889, 23679, 29898, 13, 9651, 315, 3487, 1220, 24365, 12283, 9171, 2624, 29898, 15439, 29889, 2457, 401, 29892, 9637, 333, 29922, 1311, 29889, 4230, 11591, 1204, 876, 13, 13, 418, 396, 11654, 442, 565, 13252, 13, 418, 565, 1583, 29889, 657, 3991, 877, 5060, 442, 742, 5852, 1125, 13, 4706, 1583, 29889, 21707, 29889, 25442, 877, 7032, 429, 1573, 5188, 1535, 368, 1495, 13, 4706, 1583, 29889, 15343, 29898, 1311, 29889, 4925, 11507, 29897, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 21707, 29889, 3888, 877, 7032, 8676, 1495, 13, 13, 29871, 822, 12088, 29898, 1311, 1125, 13, 1678, 9995, 13, 1678, 29021, 278, 5279, 2734, 9580, 13, 1678, 9995, 13, 1678, 565, 451, 1583, 29889, 4925, 5398, 29901, 13, 418, 736, 13, 13, 1678, 396, 3617, 17659, 3785, 13, 1678, 11758, 9065, 353, 1583, 29889, 657, 3206, 262, 2187, 580, 13, 1678, 17659, 29853, 353, 6088, 2481, 21176, 29898, 1311, 29889, 3874, 346, 29911, 572, 29889, 7302, 29898, 25254, 9065, 876, 13, 1678, 6473, 353, 1583, 29889, 657, 3991, 877, 15903, 742, 7700, 29897, 13, 13, 1678, 396, 960, 591, 505, 263, 734, 279, 29899, 3204, 1899, 29892, 6826, 372, 1286, 13, 1678, 734, 538, 776, 23651, 353, 1583, 29889, 371, 538, 776, 29911, 572, 29889, 7302, 29898, 25254, 9065, 29897, 13, 1678, 565, 734, 538, 776, 23651, 29901, 13, 418, 8829, 353, 1583, 29889, 6272, 29911, 572, 29889, 7302, 29898, 25254, 9065, 29897, 13, 418, 565, 451, 8829, 29901, 13, 4706, 8829, 353, 6213, 13, 418, 274, 9970, 353, 1583, 29889, 29883, 9970, 29911, 572, 29889, 7302, 29898, 25254, 9065, 29897, 13, 418, 565, 451, 274, 9970, 29901, 13, 4706, 274, 9970, 353, 6213, 13, 13, 418, 396, 997, 3322, 734, 538, 776, 1889, 13, 418, 1583, 29889, 21707, 29889, 3888, 877, 17641, 292, 734, 279, 29899, 3204, 1899, 29901, 6571, 4286, 4830, 29898, 371, 538, 776, 23651, 876, 13, 418, 9580, 353, 349, 3150, 29898, 13, 3986, 734, 538, 776, 23651, 29892, 13, 3986, 8829, 29922, 6272, 29892, 13, 3986, 274, 9970, 29922, 29883, 9970, 29892, 13, 3986, 6473, 29922, 5574, 29892, 13, 3986, 758, 4258, 29918, 9144, 29922, 359, 29889, 7224, 333, 29897, 13, 13, 418, 396, 20340, 363, 278, 1899, 304, 6876, 13, 418, 6876, 401, 353, 9580, 29889, 10685, 580, 13, 418, 1583, 29889, 21707, 29889, 3888, 877, 29911, 799, 29899, 3204, 1889, 8676, 411, 6571, 4286, 4830, 29898, 13322, 401, 876, 13, 13, 1678, 396, 1987, 29892, 1018, 23754, 292, 278, 1889, 13, 1678, 1583, 29889, 29895, 8873, 353, 5852, 13, 1678, 9580, 29892, 3244, 353, 1583, 29889, 4925, 5398, 13, 1678, 1018, 29901, 13, 418, 565, 9580, 29889, 29886, 3028, 580, 338, 6213, 29901, 13, 4706, 1583, 29889, 21707, 29889, 8382, 877, 29903, 2548, 317, 6259, 10192, 1495, 13, 4706, 2897, 29889, 21174, 4061, 29898, 359, 29889, 657, 4061, 333, 29898, 15439, 29889, 5935, 511, 7182, 29889, 5425, 29954, 10192, 29897, 13, 1678, 5174, 10554, 14959, 786, 2392, 29901, 13, 418, 1209, 13, 13, 1678, 396, 20340, 363, 263, 17659, 3785, 13, 1678, 11815, 353, 931, 29889, 2230, 580, 718, 17659, 29853, 13, 1678, 1583, 29889, 21707, 29889, 8382, 877, 15716, 292, 363, 623, 304, 367, 29185, 1495, 13, 1678, 1550, 9580, 29889, 29886, 3028, 580, 338, 6213, 322, 931, 29889, 2230, 580, 529, 11815, 29901, 13, 418, 931, 29889, 17059, 29898, 29896, 29897, 13, 13, 1678, 396, 1126, 1018, 23393, 372, 13, 1678, 1018, 29901, 13, 418, 565, 9580, 29889, 29886, 3028, 580, 338, 6213, 29901, 13, 4706, 1583, 29889, 21707, 29889, 8382, 877, 29903, 2548, 317, 6259, 29968, 24071, 1495, 13, 4706, 2897, 29889, 21174, 4061, 29898, 359, 29889, 657, 4061, 333, 29898, 15439, 29889, 5935, 511, 7182, 29889, 5425, 29954, 4945, 29924, 29897, 13, 1678, 5174, 10554, 14959, 786, 2392, 29901, 13, 418, 1209, 13, 1678, 3244, 29889, 7122, 580, 13, 13, 1678, 396, 853, 842, 6136, 3414, 13, 1678, 1583, 29889, 4925, 5398, 353, 6213, 13, 1678, 1583, 29889, 29895, 8873, 353, 7700, 13, 13, 29871, 822, 6826, 29898, 1311, 29892, 4128, 1125, 13, 1678, 9995, 13, 1678, 997, 3322, 1889, 411, 278, 2183, 1899, 29899, 1220, 13, 1678, 9995, 13, 13, 1678, 396, 3831, 852, 278, 6273, 363, 278, 8225, 13, 1678, 274, 9970, 353, 1583, 29889, 657, 3991, 877, 29883, 9970, 742, 3734, 29922, 8824, 29897, 13, 1678, 6473, 353, 1583, 29889, 657, 3991, 877, 15903, 742, 7700, 29897, 13, 13, 1678, 396, 422, 26062, 4128, 411, 278, 15848, 13, 1678, 11758, 9065, 353, 1583, 29889, 657, 3206, 262, 2187, 2141, 29888, 548, 29898, 16744, 29897, 13, 13, 1678, 396, 3831, 488, 6273, 13, 1678, 9920, 1220, 353, 1583, 29889, 9006, 1220, 29911, 572, 29889, 7302, 29898, 25254, 9065, 29897, 13, 1678, 565, 451, 6473, 29901, 13, 418, 6389, 353, 528, 2506, 29889, 5451, 29898, 9006, 1220, 29897, 13, 1678, 1683, 29901, 13, 418, 6389, 353, 9920, 1220, 13, 1678, 3659, 262, 353, 1583, 29889, 4172, 262, 29911, 572, 29889, 7302, 29898, 25254, 9065, 29897, 13, 1678, 8829, 353, 1583, 29889, 6272, 29911, 572, 29889, 7302, 29898, 25254, 9065, 29897, 13, 1678, 274, 9970, 353, 1583, 29889, 29883, 9970, 29911, 572, 29889, 7302, 29898, 25254, 9065, 29897, 13, 13, 1678, 396, 2538, 300, 4069, 6273, 304, 421, 8516, 29952, 13, 1678, 565, 451, 3659, 262, 29901, 13, 418, 3659, 262, 353, 6213, 13, 1678, 565, 451, 274, 9970, 29901, 13, 418, 274, 9970, 353, 6213, 13, 1678, 565, 451, 8829, 29901, 13, 418, 8829, 353, 6213, 13, 13, 1678, 396, 997, 3322, 13, 1678, 1583, 29889, 21707, 29889, 8382, 877, 4763, 292, 1889, 29901, 320, 29915, 29912, 1012, 29915, 4286, 4830, 29898, 13, 4706, 6389, 565, 1134, 29898, 5085, 29897, 338, 851, 1683, 525, 15300, 7122, 29898, 5085, 4961, 13, 1678, 1583, 29889, 4925, 11507, 353, 4128, 13, 1678, 9580, 353, 349, 3150, 29898, 13, 4706, 6389, 29892, 13, 4706, 3659, 262, 29922, 2227, 4162, 29892, 13, 4706, 27591, 29922, 2227, 4162, 29892, 13, 4706, 380, 20405, 29922, 2227, 4162, 29892, 13, 4706, 8829, 29922, 6272, 29892, 13, 4706, 274, 9970, 29922, 29883, 9970, 29892, 13, 4706, 6473, 29922, 15903, 29892, 13, 4706, 758, 4258, 29918, 9144, 29922, 359, 29889, 7224, 333, 29897, 13, 13, 1678, 396, 3295, 5041, 1369, 1741, 13, 1678, 1583, 29889, 3696, 8262, 29889, 23679, 29898, 23651, 1220, 4763, 287, 2624, 29898, 15439, 29889, 5935, 876, 13, 13, 1678, 396, 997, 3322, 263, 3244, 304, 11819, 372, 29915, 29879, 1962, 13, 1678, 3244, 353, 3244, 292, 29889, 4899, 29898, 13, 4706, 3646, 29922, 1311, 29889, 3712, 2105, 29892, 13, 4706, 1024, 2433, 9006, 1220, 29899, 3712, 2105, 742, 13, 4706, 6389, 7607, 5085, 29961, 29900, 1402, 9580, 29892, 3659, 262, 876, 13, 1678, 3244, 29889, 2962, 580, 13, 13, 1678, 396, 19152, 5702, 310, 278, 6136, 3414, 13, 1678, 1583, 29889, 4925, 5398, 353, 313, 15439, 29892, 3244, 29897, 13, 13, 29871, 822, 4386, 7141, 538, 776, 29898, 1311, 29892, 1741, 1125, 13, 1678, 9995, 13, 1678, 29021, 1889, 472, 734, 538, 776, 13, 1678, 9995, 13, 1678, 565, 1583, 29889, 4925, 5398, 29901, 13, 418, 1583, 29889, 21707, 29889, 25442, 877, 29968, 8873, 2734, 1889, 1495, 13, 1678, 1583, 29889, 21174, 580, 13, 13, 29871, 822, 4386, 4763, 29898, 1311, 29892, 1741, 1125, 13, 1678, 9995, 13, 1678, 29273, 278, 1369, 1741, 13, 1678, 9995, 13, 13, 1678, 396, 960, 445, 623, 338, 18690, 287, 304, 6826, 472, 1369, 29892, 15523, 445, 11809, 1286, 13, 1678, 472, 2962, 353, 1583, 29889, 657, 3991, 877, 271, 2962, 742, 2322, 29922, 8824, 29897, 13, 1678, 565, 472, 2962, 29901, 13, 418, 1583, 29889, 8411, 9329, 6422, 29898, 9329, 6422, 2624, 3319, 1118, 24335, 6571, 876, 13, 13, 29871, 822, 4386, 9329, 6422, 29898, 1311, 29892, 1741, 1125, 13, 1678, 9995, 13, 1678, 29273, 263, 2875, 2767, 13, 1678, 9995, 13, 13, 1678, 396, 960, 591, 505, 2307, 263, 3414, 2734, 1016, 29915, 29873, 337, 29899, 15343, 372, 6521, 13, 1678, 396, 278, 4520, 4426, 526, 2869, 13271, 697, 470, 901, 4128, 13, 1678, 396, 297, 1749, 4472, 13, 1678, 565, 1583, 29889, 4925, 5398, 29901, 13, 13, 418, 396, 1334, 505, 263, 3443, 1735, 29892, 12088, 278, 1889, 13, 418, 396, 322, 20410, 263, 716, 8225, 2678, 13, 418, 1583, 29889, 21174, 580, 13, 13, 1678, 396, 19152, 5702, 310, 278, 9637, 333, 393, 14511, 630, 278, 1889, 29889, 910, 982, 591, 508, 13, 1678, 396, 5702, 278, 4959, 393, 892, 589, 1150, 287, 515, 445, 3443, 2767, 29889, 13, 1678, 1583, 29889, 4230, 11591, 1204, 353, 1741, 29889, 15003, 4841, 13, 13, 1678, 396, 997, 3322, 716, 1889, 13, 1678, 1583, 29889, 15343, 29898, 3696, 29889, 16744, 29897, 13, 2 ]
functest/opnfv_tests/openstack/tempest/conf_utils.py
hashnfv/hashnfv-functest
0
98069
<reponame>hashnfv/hashnfv-functest #!/usr/bin/env python # # Copyright (c) 2015 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 # import ConfigParser import logging import os import pkg_resources import shutil import subprocess import yaml from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils IMAGE_ID_ALT = None FLAVOR_ID_ALT = None GLANCE_IMAGE_PATH = os.path.join( CONST.__getattribute__('dir_functest_images'), CONST.__getattribute__('openstack_image_file_name')) TEMPEST_RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), 'tempest') TEMPEST_CUSTOM = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/test_list.txt') TEMPEST_BLACKLIST = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/blacklist.txt') TEMPEST_DEFCORE = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt') TEMPEST_RAW_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_raw_list.txt') TEMPEST_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_list.txt') REFSTACK_RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), 'refstack') TEMPEST_CONF_YAML = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml') TEST_ACCOUNTS_FILE = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/test_accounts.yaml') CI_INSTALLER_TYPE = CONST.__getattribute__('INSTALLER_TYPE') CI_INSTALLER_IP = CONST.__getattribute__('INSTALLER_IP') """ logging configuration """ logger = logging.getLogger(__name__) def get_verifier_id(): """ Returns verifier id for current Tempest """ cmd = ("rally verify list-verifiers | awk '/" + CONST.__getattribute__('tempest_deployment_name') + "/ {print $2}'") p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) deployment_uuid = p.stdout.readline().rstrip() if deployment_uuid == "": logger.error("Tempest verifier not found.") raise Exception('Error with command:%s' % cmd) return deployment_uuid def get_verifier_deployment_id(): """ Returns deployment id for active Rally deployment """ cmd = ("rally deployment list | awk '/" + CONST.__getattribute__('rally_deployment_name') + "/ {print $2}'") p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) deployment_uuid = p.stdout.readline().rstrip() if deployment_uuid == "": logger.error("Rally deployment not found.") raise Exception('Error with command:%s' % cmd) return deployment_uuid def get_verifier_repo_dir(verifier_id): """ Returns installed verifier repo directory for Tempest """ if not verifier_id: verifier_id = get_verifier_id() return os.path.join(CONST.__getattribute__('dir_rally_inst'), 'verification', 'verifier-{}'.format(verifier_id), 'repo') def get_verifier_deployment_dir(verifier_id, deployment_id): """ Returns Rally deployment directory for current verifier """ if not verifier_id: verifier_id = get_verifier_id() if not deployment_id: deployment_id = get_verifier_deployment_id() return os.path.join(CONST.__getattribute__('dir_rally_inst'), 'verification', 'verifier-{}'.format(verifier_id), 'for-deployment-{}'.format(deployment_id)) def backup_tempest_config(conf_file): """ Copy config file to tempest results directory """ if not os.path.exists(TEMPEST_RESULTS_DIR): os.makedirs(TEMPEST_RESULTS_DIR) shutil.copyfile(conf_file, os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf')) def configure_tempest(deployment_dir, image_id=None, flavor_id=None, compute_cnt=None): """ Calls rally verify and updates the generated tempest.conf with given parameters """ conf_file = configure_verifier(deployment_dir) configure_tempest_update_params(conf_file, image_id, flavor_id, compute_cnt) def configure_tempest_defcore(deployment_dir, image_id, flavor_id, image_id_alt, flavor_id_alt, tenant_id): """ Add/update needed parameters into tempest.conf file """ conf_file = configure_verifier(deployment_dir) configure_tempest_update_params(conf_file, image_id, flavor_id) logger.debug("Updating selected tempest.conf parameters for defcore...") config = ConfigParser.RawConfigParser() config.read(conf_file) config.set('DEFAULT', 'log_file', '{}/tempest.log'.format(deployment_dir)) config.set('oslo_concurrency', 'lock_path', '{}/lock_files'.format(deployment_dir)) generate_test_accounts_file(tenant_id=tenant_id) config.set('auth', 'test_accounts_file', TEST_ACCOUNTS_FILE) config.set('scenario', 'img_dir', '{}'.format(deployment_dir)) config.set('scenario', 'img_file', 'tempest-image') config.set('compute', 'image_ref', image_id) config.set('compute', 'image_ref_alt', image_id_alt) config.set('compute', 'flavor_ref', flavor_id) config.set('compute', 'flavor_ref_alt', flavor_id_alt) with open(conf_file, 'wb') as config_file: config.write(config_file) confpath = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') shutil.copyfile(conf_file, confpath) def generate_test_accounts_file(tenant_id): """ Add needed tenant and user params into test_accounts.yaml """ logger.debug("Add needed params into test_accounts.yaml...") accounts_list = [ { 'tenant_name': CONST.__getattribute__('tempest_identity_tenant_name'), 'tenant_id': str(tenant_id), 'username': CONST.__getattribute__('tempest_identity_user_name'), 'password': CONST.__getattribute__('tempest_identity_user_password') } ] with open(TEST_ACCOUNTS_FILE, "w") as f: yaml.dump(accounts_list, f, default_flow_style=False) def configure_tempest_update_params(tempest_conf_file, image_id=None, flavor_id=None, compute_cnt=1): """ Add/update needed parameters into tempest.conf file """ logger.debug("Updating selected tempest.conf parameters...") config = ConfigParser.RawConfigParser() config.read(tempest_conf_file) config.set( 'compute', 'fixed_network_name', CONST.__getattribute__('tempest_private_net_name')) config.set('compute', 'volume_device_name', CONST.__getattribute__('tempest_volume_device_name')) if CONST.__getattribute__('tempest_use_custom_images'): if image_id is not None: config.set('compute', 'image_ref', image_id) if IMAGE_ID_ALT is not None: config.set('compute', 'image_ref_alt', IMAGE_ID_ALT) if CONST.__getattribute__('tempest_use_custom_flavors'): if flavor_id is not None: config.set('compute', 'flavor_ref', flavor_id) if FLAVOR_ID_ALT is not None: config.set('compute', 'flavor_ref_alt', FLAVOR_ID_ALT) if compute_cnt > 1: # enable multinode tests config.set('compute', 'min_compute_nodes', compute_cnt) config.set('compute-feature-enabled', 'live_migration', True) config.set('identity', 'region', 'RegionOne') if os_utils.is_keystone_v3(): auth_version = 'v3' else: auth_version = 'v2' config.set('identity', 'auth_version', auth_version) config.set( 'validation', 'ssh_timeout', CONST.__getattribute__('tempest_validation_ssh_timeout')) config.set('object-storage', 'operator_role', CONST.__getattribute__('tempest_object_storage_operator_role')) if CONST.__getattribute__('OS_ENDPOINT_TYPE') is not None: sections = config.sections() if os_utils.is_keystone_v3(): config.set('identity', 'v3_endpoint_type', CONST.__getattribute__('OS_ENDPOINT_TYPE')) if 'identity-feature-enabled' not in sections: config.add_section('identity-feature-enabled') config.set('identity-feature-enabled', 'api_v2', False) config.set('identity-feature-enabled', 'api_v2_admin', False) services_list = ['compute', 'volume', 'image', 'network', 'data-processing', 'object-storage', 'orchestration'] for service in services_list: if service not in sections: config.add_section(service) config.set(service, 'endpoint_type', CONST.__getattribute__('OS_ENDPOINT_TYPE')) logger.debug('Add/Update required params defined in tempest_conf.yaml ' 'into tempest.conf file') with open(TEMPEST_CONF_YAML) as f: conf_yaml = yaml.safe_load(f) if conf_yaml: sections = config.sections() for section in conf_yaml: if section not in sections: config.add_section(section) sub_conf = conf_yaml.get(section) for key, value in sub_conf.items(): config.set(section, key, value) with open(tempest_conf_file, 'wb') as config_file: config.write(config_file) backup_tempest_config(tempest_conf_file) def configure_verifier(deployment_dir): """ Execute rally verify configure-verifier, which generates tempest.conf """ tempest_conf_file = os.path.join(deployment_dir, "tempest.conf") if os.path.isfile(tempest_conf_file): logger.debug("Verifier is already configured.") logger.debug("Reconfiguring the current verifier...") cmd = "rally verify configure-verifier --reconfigure" else: logger.info("Configuring the verifier...") cmd = "rally verify configure-verifier" ft_utils.execute_command(cmd) logger.debug("Looking for tempest.conf file...") if not os.path.isfile(tempest_conf_file): logger.error("Tempest configuration file %s NOT found." % tempest_conf_file) raise Exception("Tempest configuration file %s NOT found." % tempest_conf_file) else: return tempest_conf_file
[ 1, 529, 276, 1112, 420, 29958, 8568, 29876, 29888, 29894, 29914, 8568, 29876, 29888, 29894, 29899, 7692, 312, 342, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 2178, 10462, 21676, 13, 29937, 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, 13, 29937, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 5215, 12782, 11726, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 282, 9415, 29918, 13237, 13, 5215, 528, 4422, 13, 5215, 1014, 5014, 13, 13, 5215, 343, 8807, 13, 13, 3166, 2090, 312, 342, 29889, 13239, 29889, 3075, 1934, 1053, 8707, 1254, 13, 5215, 2090, 312, 342, 29889, 13239, 29889, 7692, 312, 342, 29918, 13239, 408, 11791, 29918, 13239, 13, 5215, 2090, 312, 342, 29889, 13239, 29889, 3150, 1429, 29918, 13239, 408, 2897, 29918, 13239, 13, 13, 13, 2382, 29918, 1367, 29918, 1964, 29911, 353, 6213, 13, 18823, 29963, 1955, 29918, 1367, 29918, 1964, 29911, 353, 6213, 13, 7239, 23219, 29918, 2382, 29918, 10145, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 1678, 8707, 1254, 17255, 657, 12715, 1649, 877, 3972, 29918, 7692, 312, 342, 29918, 8346, 5477, 13, 1678, 8707, 1254, 17255, 657, 12715, 1649, 877, 3150, 1429, 29918, 3027, 29918, 1445, 29918, 978, 8785, 13, 4330, 3580, 29923, 1254, 29918, 15989, 8647, 29903, 29918, 9464, 353, 2897, 29889, 2084, 29889, 7122, 29898, 6007, 1254, 17255, 657, 12715, 1649, 877, 3972, 29918, 9902, 5477, 13, 462, 462, 259, 525, 7382, 342, 1495, 13, 4330, 3580, 29923, 1254, 29918, 29907, 17321, 6488, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 13, 1678, 525, 7692, 312, 342, 742, 525, 459, 29876, 29888, 29894, 29918, 21150, 29914, 3150, 1429, 29914, 7382, 342, 29914, 6341, 29918, 21150, 29914, 1688, 29918, 1761, 29889, 3945, 1495, 13, 4330, 3580, 29923, 1254, 29918, 13367, 11375, 24360, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 13, 1678, 525, 7692, 312, 342, 742, 525, 459, 29876, 29888, 29894, 29918, 21150, 29914, 3150, 1429, 29914, 7382, 342, 29914, 6341, 29918, 21150, 29914, 8517, 1761, 29889, 3945, 1495, 13, 4330, 3580, 29923, 1254, 29918, 24405, 3217, 1525, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 13, 1678, 525, 7692, 312, 342, 742, 13, 1678, 525, 459, 29876, 29888, 29894, 29918, 21150, 29914, 3150, 1429, 29914, 7382, 342, 29914, 6341, 29918, 21150, 29914, 1753, 3221, 29918, 7971, 29889, 3945, 1495, 13, 4330, 3580, 29923, 1254, 29918, 4717, 29956, 29918, 24360, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4330, 3580, 29923, 1254, 29918, 15989, 8647, 29903, 29918, 9464, 29892, 525, 1688, 29918, 1610, 29918, 1761, 29889, 3945, 1495, 13, 4330, 3580, 29923, 1254, 29918, 24360, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4330, 3580, 29923, 1254, 29918, 15989, 8647, 29903, 29918, 9464, 29892, 525, 1688, 29918, 1761, 29889, 3945, 1495, 13, 25866, 1254, 11375, 29918, 15989, 8647, 29903, 29918, 9464, 353, 2897, 29889, 2084, 29889, 7122, 29898, 6007, 1254, 17255, 657, 12715, 1649, 877, 3972, 29918, 9902, 5477, 13, 462, 462, 1678, 525, 999, 1429, 1495, 13, 4330, 3580, 29923, 1254, 29918, 6007, 29943, 29918, 29979, 23956, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 13, 1678, 525, 7692, 312, 342, 742, 525, 459, 29876, 29888, 29894, 29918, 21150, 29914, 3150, 1429, 29914, 7382, 342, 29914, 6341, 29918, 21150, 29914, 7382, 342, 29918, 5527, 29889, 25162, 1495, 13, 18267, 29918, 2477, 3217, 3904, 9375, 29918, 7724, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 13, 1678, 525, 7692, 312, 342, 742, 13, 1678, 525, 459, 29876, 29888, 29894, 29918, 21150, 29914, 3150, 1429, 29914, 7382, 342, 29914, 6341, 29918, 21150, 29914, 1688, 29918, 10149, 29879, 29889, 25162, 1495, 13, 13, 8426, 29918, 25580, 9818, 1001, 29918, 11116, 353, 8707, 1254, 17255, 657, 12715, 1649, 877, 25580, 9818, 1001, 29918, 11116, 1495, 13, 8426, 29918, 25580, 9818, 1001, 29918, 5690, 353, 8707, 1254, 17255, 657, 12715, 1649, 877, 25580, 9818, 1001, 29918, 5690, 1495, 13, 13, 15945, 29908, 12183, 5285, 9995, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 679, 29918, 369, 3709, 29918, 333, 7295, 13, 1678, 9995, 13, 1678, 16969, 1147, 3709, 1178, 363, 1857, 21121, 342, 13, 1678, 9995, 13, 1678, 9920, 353, 4852, 29878, 635, 11539, 1051, 29899, 369, 14903, 891, 13689, 8207, 29908, 718, 13, 965, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 16519, 358, 29918, 978, 1495, 718, 13, 965, 5591, 426, 2158, 395, 29906, 10162, 1159, 13, 1678, 282, 353, 1014, 5014, 29889, 29925, 3150, 29898, 9006, 29892, 6473, 29922, 5574, 29892, 13, 462, 308, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 13, 462, 308, 380, 20405, 29922, 1491, 5014, 29889, 1254, 3970, 2692, 29897, 13, 1678, 18209, 29918, 25118, 353, 282, 29889, 25393, 29889, 949, 1220, 2141, 29878, 17010, 580, 13, 1678, 565, 18209, 29918, 25118, 1275, 376, 1115, 13, 4706, 17927, 29889, 2704, 703, 15637, 342, 1147, 3709, 451, 1476, 23157, 13, 4706, 12020, 8960, 877, 2392, 411, 1899, 16664, 29879, 29915, 1273, 9920, 29897, 13, 1678, 736, 18209, 29918, 25118, 13, 13, 13, 1753, 679, 29918, 369, 3709, 29918, 16519, 358, 29918, 333, 7295, 13, 1678, 9995, 13, 1678, 16969, 18209, 1178, 363, 6136, 390, 635, 18209, 13, 1678, 9995, 13, 1678, 9920, 353, 4852, 29878, 635, 18209, 1051, 891, 13689, 8207, 29908, 718, 13, 965, 8707, 1254, 17255, 657, 12715, 1649, 877, 29878, 635, 29918, 16519, 358, 29918, 978, 1495, 718, 13, 965, 5591, 426, 2158, 395, 29906, 10162, 1159, 13, 1678, 282, 353, 1014, 5014, 29889, 29925, 3150, 29898, 9006, 29892, 6473, 29922, 5574, 29892, 13, 462, 308, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 13, 462, 308, 380, 20405, 29922, 1491, 5014, 29889, 1254, 3970, 2692, 29897, 13, 1678, 18209, 29918, 25118, 353, 282, 29889, 25393, 29889, 949, 1220, 2141, 29878, 17010, 580, 13, 1678, 565, 18209, 29918, 25118, 1275, 376, 1115, 13, 4706, 17927, 29889, 2704, 703, 29934, 635, 18209, 451, 1476, 23157, 13, 4706, 12020, 8960, 877, 2392, 411, 1899, 16664, 29879, 29915, 1273, 9920, 29897, 13, 1678, 736, 18209, 29918, 25118, 13, 13, 13, 1753, 679, 29918, 369, 3709, 29918, 20095, 29918, 3972, 29898, 369, 3709, 29918, 333, 1125, 13, 1678, 9995, 13, 1678, 16969, 5130, 1147, 3709, 13761, 3884, 363, 21121, 342, 13, 1678, 9995, 13, 1678, 565, 451, 1147, 3709, 29918, 333, 29901, 13, 4706, 1147, 3709, 29918, 333, 353, 679, 29918, 369, 3709, 29918, 333, 580, 13, 13, 1678, 736, 2897, 29889, 2084, 29889, 7122, 29898, 6007, 1254, 17255, 657, 12715, 1649, 877, 3972, 29918, 29878, 635, 29918, 2611, 5477, 13, 462, 4706, 525, 369, 2450, 742, 13, 462, 4706, 525, 369, 3709, 29899, 8875, 4286, 4830, 29898, 369, 3709, 29918, 333, 511, 13, 462, 4706, 525, 20095, 1495, 13, 13, 13, 1753, 679, 29918, 369, 3709, 29918, 16519, 358, 29918, 3972, 29898, 369, 3709, 29918, 333, 29892, 18209, 29918, 333, 1125, 13, 1678, 9995, 13, 1678, 16969, 390, 635, 18209, 3884, 363, 1857, 1147, 3709, 13, 1678, 9995, 13, 1678, 565, 451, 1147, 3709, 29918, 333, 29901, 13, 4706, 1147, 3709, 29918, 333, 353, 679, 29918, 369, 3709, 29918, 333, 580, 13, 13, 1678, 565, 451, 18209, 29918, 333, 29901, 13, 4706, 18209, 29918, 333, 353, 679, 29918, 369, 3709, 29918, 16519, 358, 29918, 333, 580, 13, 13, 1678, 736, 2897, 29889, 2084, 29889, 7122, 29898, 6007, 1254, 17255, 657, 12715, 1649, 877, 3972, 29918, 29878, 635, 29918, 2611, 5477, 13, 462, 4706, 525, 369, 2450, 742, 13, 462, 4706, 525, 369, 3709, 29899, 8875, 4286, 4830, 29898, 369, 3709, 29918, 333, 511, 13, 462, 4706, 525, 1454, 29899, 16519, 358, 29899, 8875, 4286, 4830, 29898, 16519, 358, 29918, 333, 876, 13, 13, 13, 1753, 16199, 29918, 7382, 342, 29918, 2917, 29898, 5527, 29918, 1445, 1125, 13, 1678, 9995, 13, 1678, 14187, 2295, 934, 304, 5694, 342, 2582, 3884, 13, 1678, 9995, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 4330, 3580, 29923, 1254, 29918, 15989, 8647, 29903, 29918, 9464, 1125, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 4330, 3580, 29923, 1254, 29918, 15989, 8647, 29903, 29918, 9464, 29897, 13, 1678, 528, 4422, 29889, 8552, 1445, 29898, 5527, 29918, 1445, 29892, 13, 462, 1678, 2897, 29889, 2084, 29889, 7122, 29898, 4330, 3580, 29923, 1254, 29918, 15989, 8647, 29903, 29918, 9464, 29892, 525, 7382, 342, 29889, 5527, 8785, 13, 13, 13, 1753, 10822, 29918, 7382, 342, 29898, 16519, 358, 29918, 3972, 29892, 1967, 29918, 333, 29922, 8516, 29892, 21054, 272, 29918, 333, 29922, 8516, 29892, 13, 462, 418, 10272, 29918, 20047, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 315, 4293, 364, 635, 11539, 322, 11217, 278, 5759, 5694, 342, 29889, 5527, 411, 13, 1678, 2183, 4128, 13, 1678, 9995, 13, 1678, 1970, 29918, 1445, 353, 10822, 29918, 369, 3709, 29898, 16519, 358, 29918, 3972, 29897, 13, 1678, 10822, 29918, 7382, 342, 29918, 5504, 29918, 7529, 29898, 5527, 29918, 1445, 29892, 1967, 29918, 333, 29892, 21054, 272, 29918, 333, 29892, 13, 462, 462, 1678, 10272, 29918, 20047, 29897, 13, 13, 13, 1753, 10822, 29918, 7382, 342, 29918, 1753, 3221, 29898, 16519, 358, 29918, 3972, 29892, 1967, 29918, 333, 29892, 21054, 272, 29918, 333, 29892, 13, 462, 795, 1967, 29918, 333, 29918, 1997, 29892, 21054, 272, 29918, 333, 29918, 1997, 29892, 3006, 424, 29918, 333, 1125, 13, 1678, 9995, 13, 1678, 3462, 29914, 5504, 4312, 4128, 964, 5694, 342, 29889, 5527, 934, 13, 1678, 9995, 13, 1678, 1970, 29918, 1445, 353, 10822, 29918, 369, 3709, 29898, 16519, 358, 29918, 3972, 29897, 13, 1678, 10822, 29918, 7382, 342, 29918, 5504, 29918, 7529, 29898, 5527, 29918, 1445, 29892, 1967, 29918, 333, 29892, 21054, 272, 29918, 333, 29897, 13, 13, 1678, 17927, 29889, 8382, 703, 3373, 26747, 4629, 5694, 342, 29889, 5527, 4128, 363, 822, 3221, 856, 1159, 13, 1678, 2295, 353, 12782, 11726, 29889, 22131, 3991, 11726, 580, 13, 1678, 2295, 29889, 949, 29898, 5527, 29918, 1445, 29897, 13, 1678, 2295, 29889, 842, 877, 23397, 742, 525, 1188, 29918, 1445, 742, 22372, 6822, 7382, 342, 29889, 1188, 4286, 4830, 29898, 16519, 358, 29918, 3972, 876, 13, 1678, 2295, 29889, 842, 877, 359, 417, 29918, 535, 26095, 742, 525, 908, 29918, 2084, 742, 13, 1669, 22372, 6822, 908, 29918, 5325, 4286, 4830, 29898, 16519, 358, 29918, 3972, 876, 13, 1678, 5706, 29918, 1688, 29918, 10149, 29879, 29918, 1445, 29898, 841, 424, 29918, 333, 29922, 841, 424, 29918, 333, 29897, 13, 1678, 2295, 29889, 842, 877, 5150, 742, 525, 1688, 29918, 10149, 29879, 29918, 1445, 742, 17067, 1254, 29918, 2477, 3217, 3904, 9375, 29918, 7724, 29897, 13, 1678, 2295, 29889, 842, 877, 1557, 24893, 742, 525, 2492, 29918, 3972, 742, 525, 8875, 4286, 4830, 29898, 16519, 358, 29918, 3972, 876, 13, 1678, 2295, 29889, 842, 877, 1557, 24893, 742, 525, 2492, 29918, 1445, 742, 525, 7382, 342, 29899, 3027, 1495, 13, 1678, 2295, 29889, 842, 877, 26017, 742, 525, 3027, 29918, 999, 742, 1967, 29918, 333, 29897, 13, 1678, 2295, 29889, 842, 877, 26017, 742, 525, 3027, 29918, 999, 29918, 1997, 742, 1967, 29918, 333, 29918, 1997, 29897, 13, 1678, 2295, 29889, 842, 877, 26017, 742, 525, 29888, 4112, 272, 29918, 999, 742, 21054, 272, 29918, 333, 29897, 13, 1678, 2295, 29889, 842, 877, 26017, 742, 525, 29888, 4112, 272, 29918, 999, 29918, 1997, 742, 21054, 272, 29918, 333, 29918, 1997, 29897, 13, 13, 1678, 411, 1722, 29898, 5527, 29918, 1445, 29892, 525, 29893, 29890, 1495, 408, 2295, 29918, 1445, 29901, 13, 4706, 2295, 29889, 3539, 29898, 2917, 29918, 1445, 29897, 13, 13, 1678, 1970, 2084, 353, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 29898, 13, 4706, 525, 7692, 312, 342, 742, 13, 4706, 525, 459, 29876, 29888, 29894, 29918, 21150, 29914, 3150, 1429, 29914, 999, 1429, 29918, 4645, 29914, 999, 1429, 29918, 7382, 342, 29889, 5527, 1495, 13, 1678, 528, 4422, 29889, 8552, 1445, 29898, 5527, 29918, 1445, 29892, 1970, 2084, 29897, 13, 13, 13, 1753, 5706, 29918, 1688, 29918, 10149, 29879, 29918, 1445, 29898, 841, 424, 29918, 333, 1125, 13, 1678, 9995, 13, 1678, 3462, 4312, 3006, 424, 322, 1404, 8636, 964, 1243, 29918, 10149, 29879, 29889, 25162, 13, 1678, 9995, 13, 13, 1678, 17927, 29889, 8382, 703, 2528, 4312, 8636, 964, 1243, 29918, 10149, 29879, 29889, 25162, 856, 1159, 13, 1678, 15303, 29918, 1761, 353, 518, 13, 4706, 426, 13, 9651, 525, 841, 424, 29918, 978, 2396, 13, 18884, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 22350, 29918, 841, 424, 29918, 978, 5477, 13, 9651, 525, 841, 424, 29918, 333, 2396, 851, 29898, 841, 424, 29918, 333, 511, 13, 9651, 525, 6786, 2396, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 22350, 29918, 1792, 29918, 978, 5477, 13, 9651, 525, 5630, 2396, 13, 18884, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 22350, 29918, 1792, 29918, 5630, 1495, 13, 4706, 500, 13, 1678, 4514, 13, 13, 1678, 411, 1722, 29898, 18267, 29918, 2477, 3217, 3904, 9375, 29918, 7724, 29892, 376, 29893, 1159, 408, 285, 29901, 13, 4706, 343, 8807, 29889, 15070, 29898, 10149, 29879, 29918, 1761, 29892, 285, 29892, 2322, 29918, 1731, 29918, 3293, 29922, 8824, 29897, 13, 13, 13, 1753, 10822, 29918, 7382, 342, 29918, 5504, 29918, 7529, 29898, 7382, 342, 29918, 5527, 29918, 1445, 29892, 1967, 29918, 333, 29922, 8516, 29892, 13, 462, 462, 1678, 21054, 272, 29918, 333, 29922, 8516, 29892, 10272, 29918, 20047, 29922, 29896, 1125, 13, 1678, 9995, 13, 1678, 3462, 29914, 5504, 4312, 4128, 964, 5694, 342, 29889, 5527, 934, 13, 1678, 9995, 13, 1678, 17927, 29889, 8382, 703, 3373, 26747, 4629, 5694, 342, 29889, 5527, 4128, 856, 1159, 13, 1678, 2295, 353, 12782, 11726, 29889, 22131, 3991, 11726, 580, 13, 1678, 2295, 29889, 949, 29898, 7382, 342, 29918, 5527, 29918, 1445, 29897, 13, 1678, 2295, 29889, 842, 29898, 13, 4706, 525, 26017, 742, 13, 4706, 525, 20227, 29918, 11618, 29918, 978, 742, 13, 4706, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 9053, 29918, 1212, 29918, 978, 8785, 13, 1678, 2295, 29889, 842, 877, 26017, 742, 525, 24623, 29918, 10141, 29918, 978, 742, 13, 1669, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 24623, 29918, 10141, 29918, 978, 8785, 13, 1678, 565, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 1509, 29918, 6341, 29918, 8346, 29374, 13, 4706, 565, 1967, 29918, 333, 338, 451, 6213, 29901, 13, 9651, 2295, 29889, 842, 877, 26017, 742, 525, 3027, 29918, 999, 742, 1967, 29918, 333, 29897, 13, 4706, 565, 306, 1529, 1692, 29918, 1367, 29918, 1964, 29911, 338, 451, 6213, 29901, 13, 9651, 2295, 29889, 842, 877, 26017, 742, 525, 3027, 29918, 999, 29918, 1997, 742, 306, 1529, 1692, 29918, 1367, 29918, 1964, 29911, 29897, 13, 1678, 565, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 1509, 29918, 6341, 29918, 29888, 4112, 943, 29374, 13, 4706, 565, 21054, 272, 29918, 333, 338, 451, 6213, 29901, 13, 9651, 2295, 29889, 842, 877, 26017, 742, 525, 29888, 4112, 272, 29918, 999, 742, 21054, 272, 29918, 333, 29897, 13, 4706, 565, 383, 4375, 29963, 1955, 29918, 1367, 29918, 1964, 29911, 338, 451, 6213, 29901, 13, 9651, 2295, 29889, 842, 877, 26017, 742, 525, 29888, 4112, 272, 29918, 999, 29918, 1997, 742, 383, 4375, 29963, 1955, 29918, 1367, 29918, 1964, 29911, 29897, 13, 1678, 565, 10272, 29918, 20047, 1405, 29871, 29896, 29901, 13, 4706, 396, 9025, 1773, 262, 356, 6987, 13, 4706, 2295, 29889, 842, 877, 26017, 742, 525, 1195, 29918, 26017, 29918, 18010, 742, 10272, 29918, 20047, 29897, 13, 4706, 2295, 29889, 842, 877, 26017, 29899, 14394, 29899, 17590, 742, 525, 9258, 29918, 29885, 16783, 742, 5852, 29897, 13, 13, 1678, 2295, 29889, 842, 877, 22350, 742, 525, 12803, 742, 525, 18457, 6716, 1495, 13, 1678, 565, 2897, 29918, 13239, 29889, 275, 29918, 446, 858, 650, 29918, 29894, 29941, 7295, 13, 4706, 4817, 29918, 3259, 353, 525, 29894, 29941, 29915, 13, 1678, 1683, 29901, 13, 4706, 4817, 29918, 3259, 353, 525, 29894, 29906, 29915, 13, 1678, 2295, 29889, 842, 877, 22350, 742, 525, 5150, 29918, 3259, 742, 4817, 29918, 3259, 29897, 13, 1678, 2295, 29889, 842, 29898, 13, 4706, 525, 18157, 742, 525, 15269, 29918, 15619, 742, 13, 4706, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 18157, 29918, 15269, 29918, 15619, 8785, 13, 1678, 2295, 29889, 842, 877, 3318, 29899, 12925, 742, 525, 6891, 29918, 12154, 742, 13, 1669, 8707, 1254, 17255, 657, 12715, 1649, 877, 7382, 342, 29918, 3318, 29918, 12925, 29918, 6891, 29918, 12154, 8785, 13, 13, 1678, 565, 8707, 1254, 17255, 657, 12715, 1649, 877, 3267, 29918, 1430, 11191, 6992, 29911, 29918, 11116, 1495, 338, 451, 6213, 29901, 13, 4706, 13926, 353, 2295, 29889, 27117, 580, 13, 4706, 565, 2897, 29918, 13239, 29889, 275, 29918, 446, 858, 650, 29918, 29894, 29941, 7295, 13, 9651, 2295, 29889, 842, 877, 22350, 742, 525, 29894, 29941, 29918, 29734, 29918, 1853, 742, 13, 462, 539, 8707, 1254, 17255, 657, 12715, 1649, 877, 3267, 29918, 1430, 11191, 6992, 29911, 29918, 11116, 8785, 13, 9651, 565, 525, 22350, 29899, 14394, 29899, 17590, 29915, 451, 297, 13926, 29901, 13, 18884, 2295, 29889, 1202, 29918, 2042, 877, 22350, 29899, 14394, 29899, 17590, 1495, 13, 18884, 2295, 29889, 842, 877, 22350, 29899, 14394, 29899, 17590, 742, 525, 2754, 29918, 29894, 29906, 742, 7700, 29897, 13, 18884, 2295, 29889, 842, 877, 22350, 29899, 14394, 29899, 17590, 742, 525, 2754, 29918, 29894, 29906, 29918, 6406, 742, 7700, 29897, 13, 4706, 5786, 29918, 1761, 353, 6024, 26017, 742, 13, 462, 308, 525, 24623, 742, 13, 462, 308, 525, 3027, 742, 13, 462, 308, 525, 11618, 742, 13, 462, 308, 525, 1272, 29899, 19170, 742, 13, 462, 308, 525, 3318, 29899, 12925, 742, 13, 462, 308, 525, 25350, 16444, 362, 2033, 13, 4706, 363, 2669, 297, 5786, 29918, 1761, 29901, 13, 9651, 565, 2669, 451, 297, 13926, 29901, 13, 18884, 2295, 29889, 1202, 29918, 2042, 29898, 5509, 29897, 13, 9651, 2295, 29889, 842, 29898, 5509, 29892, 525, 29734, 29918, 1853, 742, 13, 462, 539, 8707, 1254, 17255, 657, 12715, 1649, 877, 3267, 29918, 1430, 11191, 6992, 29911, 29918, 11116, 8785, 13, 13, 1678, 17927, 29889, 8382, 877, 2528, 29914, 6422, 3734, 8636, 3342, 297, 5694, 342, 29918, 5527, 29889, 25162, 525, 13, 462, 525, 8941, 5694, 342, 29889, 5527, 934, 1495, 13, 1678, 411, 1722, 29898, 4330, 3580, 29923, 1254, 29918, 6007, 29943, 29918, 29979, 23956, 29897, 408, 285, 29901, 13, 4706, 1970, 29918, 25162, 353, 343, 8807, 29889, 11177, 29918, 1359, 29898, 29888, 29897, 13, 1678, 565, 1970, 29918, 25162, 29901, 13, 4706, 13926, 353, 2295, 29889, 27117, 580, 13, 4706, 363, 4004, 297, 1970, 29918, 25162, 29901, 13, 9651, 565, 4004, 451, 297, 13926, 29901, 13, 18884, 2295, 29889, 1202, 29918, 2042, 29898, 2042, 29897, 13, 9651, 1014, 29918, 5527, 353, 1970, 29918, 25162, 29889, 657, 29898, 2042, 29897, 13, 9651, 363, 1820, 29892, 995, 297, 1014, 29918, 5527, 29889, 7076, 7295, 13, 18884, 2295, 29889, 842, 29898, 2042, 29892, 1820, 29892, 995, 29897, 13, 13, 1678, 411, 1722, 29898, 7382, 342, 29918, 5527, 29918, 1445, 29892, 525, 29893, 29890, 1495, 408, 2295, 29918, 1445, 29901, 13, 4706, 2295, 29889, 3539, 29898, 2917, 29918, 1445, 29897, 13, 13, 1678, 16199, 29918, 7382, 342, 29918, 2917, 29898, 7382, 342, 29918, 5527, 29918, 1445, 29897, 13, 13, 13, 1753, 10822, 29918, 369, 3709, 29898, 16519, 358, 29918, 3972, 1125, 13, 1678, 9995, 13, 1678, 11080, 1082, 364, 635, 11539, 10822, 29899, 369, 3709, 29892, 607, 16785, 5694, 342, 29889, 5527, 13, 1678, 9995, 13, 1678, 5694, 342, 29918, 5527, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 16519, 358, 29918, 3972, 29892, 376, 7382, 342, 29889, 5527, 1159, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 7382, 342, 29918, 5527, 29918, 1445, 1125, 13, 4706, 17927, 29889, 8382, 703, 6565, 3709, 338, 2307, 13252, 23157, 13, 4706, 17927, 29889, 8382, 703, 1123, 2917, 3864, 278, 1857, 1147, 3709, 856, 1159, 13, 4706, 9920, 353, 376, 29878, 635, 11539, 10822, 29899, 369, 3709, 1192, 276, 17591, 29908, 13, 1678, 1683, 29901, 13, 4706, 17927, 29889, 3888, 703, 3991, 3864, 278, 1147, 3709, 856, 1159, 13, 4706, 9920, 353, 376, 29878, 635, 11539, 10822, 29899, 369, 3709, 29908, 13, 1678, 11791, 29918, 13239, 29889, 7978, 29918, 6519, 29898, 9006, 29897, 13, 13, 1678, 17927, 29889, 8382, 703, 14959, 292, 363, 5694, 342, 29889, 5527, 934, 856, 1159, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 275, 1445, 29898, 7382, 342, 29918, 5527, 29918, 1445, 1125, 13, 4706, 17927, 29889, 2704, 703, 15637, 342, 5285, 934, 1273, 29879, 6058, 1476, 1213, 13, 462, 268, 1273, 5694, 342, 29918, 5527, 29918, 1445, 29897, 13, 4706, 12020, 8960, 703, 15637, 342, 5285, 934, 1273, 29879, 6058, 1476, 1213, 13, 462, 4706, 1273, 5694, 342, 29918, 5527, 29918, 1445, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 5694, 342, 29918, 5527, 29918, 1445, 13, 2 ]
test/unit2/usersignup/validation_test.py
cdoremus/udacity-python_web_development-cs253
0
166515
<reponame>cdoremus/udacity-python_web_development-cs253<gh_stars>0 ''' Created on Apr 25, 2012 @author: h87966 ''' import unittest from unit2.usersignup.validation import UserSignupValidation from unit2.usersignup.validation import VERIFICATION_MESSAGES from unit2.usersignup.validation import VERIFICATION_MESSAGES_KEYS from unit2.usersignup.validation import MISMATCHED_PASSWORDS_MESSAGE class Test(unittest.TestCase): def setUp(self): self.validation = UserSignupValidation() pass def tearDown(self): pass def testIsValidUsername(self): self.assertTrue(self.validation.is_valid_username("Crag")) self.assertTrue(self.validation.is_valid_username("Crag-Doremus")) self.assertTrue(self.validation.is_valid_username("Crag_Doremus")) self.assertTrue(self.validation.is_valid_username("Cra")) self.assertFalse(self.validation.is_valid_username("ca")) self.assertFalse(self.validation.is_valid_username("cat!")) self.assertTrue(self.validation.is_valid_username("abcdefghijklmnopqrst")) self.assertFalse(self.validation.is_valid_username("abcdefghijklmnopqrstu")) pass def testIsValidPassword(self): self.assertTrue(self.validation.is_valid_password("<PASSWORD>")) self.assertTrue(self.validation.is_valid_password("<PASSWORD>")) self.assertFalse(self.validation.is_valid_password("<PASSWORD>")) pass def testIsValidEmail(self): self.assertTrue(self.validation.is_valid_email("<EMAIL>")) self.assertTrue(self.validation.is_valid_email("<EMAIL>")) self.assertFalse(self.validation.is_valid_email("Craigfoocom")) pass def testValid(self): username = "Craig" password = "<PASSWORD>" verify = "<PASSWORD>" email = "<EMAIL>" validMsgs, isValid = self.validation.validate(username, password, verify, email) self.assertTrue(isValid) self.assertEmptyMessage([VERIFICATION_MESSAGES_KEYS[0],VERIFICATION_MESSAGES_KEYS[1],VERIFICATION_MESSAGES_KEYS[2],VERIFICATION_MESSAGES_KEYS[3]], validMsgs) def testValid_BadUsername(self): username = "Craigasdfasdfasdfasdfadfadfs" password = "<PASSWORD>" verify = "craig1" email = "<EMAIL>" validMsgs, isValid = self.validation.validate(username, password, verify, email) self.assertFalse(isValid) self.assertEquals(VERIFICATION_MESSAGES[VERIFICATION_MESSAGES_KEYS[0]], validMsgs[VERIFICATION_MESSAGES_KEYS[0]]) self.assertEmptyMessage([VERIFICATION_MESSAGES_KEYS[1],VERIFICATION_MESSAGES_KEYS[2],VERIFICATION_MESSAGES_KEYS[3]], validMsgs) def testValid_BadPassword(self): username = "Craig" password = "c1" verify = "c1" email = "<EMAIL>" validMsgs, isValid = self.validation.validate(username, password, verify, email) self.assertFalse(isValid) self.assertEquals(VERIFICATION_MESSAGES[VERIFICATION_MESSAGES_KEYS[1]], validMsgs[VERIFICATION_MESSAGES_KEYS[1]]) self.assertEquals(VERIFICATION_MESSAGES[VERIFICATION_MESSAGES_KEYS[2]], validMsgs[VERIFICATION_MESSAGES_KEYS[2]]) self.assertEmptyMessage([VERIFICATION_MESSAGES_KEYS[0],VERIFICATION_MESSAGES_KEYS[3]], validMsgs) # def testValid_BadVerifyPassword(self): # username = "Craig" # password = "c1" # verify = "c1" # email = "<EMAIL>" # validMsgs, isValid = self.validation.validate(username, password, verify, email) # self.assertFalse(isValid) # self.assertEquals(VERIFICATION_MESSAGES[VERIFICATION_MESSAGES_KEYS[2]], validMsgs[VERIFICATION_MESSAGES_KEYS[2]]) # self.assertEmptyMessage([VERIFICATION_MESSAGES_KEYS[0],VERIFICATION_MESSAGES_KEYS[1],VERIFICATION_MESSAGES_KEYS[3]], validMsgs) def testValid_BadEmail(self): username = "Craig" password = "<PASSWORD>" verify = "craig1" email = "c<EMAIL>" validMsgs, isValid = self.validation.validate(username, password, verify, email) self.assertFalse(isValid) self.assertEquals(VERIFICATION_MESSAGES[VERIFICATION_MESSAGES_KEYS[3]], validMsgs[VERIFICATION_MESSAGES_KEYS[3]]) self.assertEmptyMessage([VERIFICATION_MESSAGES_KEYS[0],VERIFICATION_MESSAGES_KEYS[2],VERIFICATION_MESSAGES_KEYS[1]], validMsgs) def testValid_PasswordsDontMatch(self): username = "Craig" password = "<PASSWORD>" verify = "craig" email = "<EMAIL>" validMsgs, isValid = self.validation.validate(username, password, verify, email) self.assertFalse(isValid) self.assertEquals(MISMATCHED_PASSWORDS_MESSAGE, validMsgs[VERIFICATION_MESSAGES_KEYS[1]]) self.assertEquals(MISMATCHED_PASSWORDS_MESSAGE, validMsgs[VERIFICATION_MESSAGES_KEYS[2]]) self.assertEmptyMessage([VERIFICATION_MESSAGES_KEYS[0],VERIFICATION_MESSAGES_KEYS[3]], validMsgs) def test_is_password_and_verify_equals(self): self.assertTrue(self.validation.is_password_and_verify_equals("craig", "<PASSWORD>")) self.assertFalse(self.validation.is_password_and_verify_equals("craig", "<PASSWORD>")) def assertEmptyMessage(self, key_list, messages): for key in key_list: self.assertEquals('', messages[key], "Message with key " + key + " is not empty") if __name__ == "__main__": #import sys;sys.argv = ['', 'Test.testValidateUsername'] unittest.main()
[ 1, 529, 276, 1112, 420, 29958, 2252, 3668, 375, 29914, 566, 5946, 29899, 4691, 29918, 2676, 29918, 25431, 29899, 2395, 29906, 29945, 29941, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 12008, 13, 20399, 373, 319, 558, 29871, 29906, 29945, 29892, 29871, 29906, 29900, 29896, 29906, 13, 13, 29992, 8921, 29901, 298, 29947, 29955, 29929, 29953, 29953, 13, 12008, 13, 5215, 443, 27958, 13, 3166, 5190, 29906, 29889, 7193, 647, 786, 29889, 18157, 1053, 4911, 10140, 786, 19448, 13, 3166, 5190, 29906, 29889, 7193, 647, 786, 29889, 18157, 1053, 478, 1001, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 13, 3166, 5190, 29906, 29889, 7193, 647, 786, 29889, 18157, 1053, 478, 1001, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 13, 3166, 5190, 29906, 29889, 7193, 647, 786, 29889, 18157, 1053, 341, 3235, 29924, 14789, 3352, 29918, 25711, 11686, 8452, 29918, 2303, 1799, 10461, 13, 13, 1990, 4321, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 18157, 353, 4911, 10140, 786, 19448, 580, 13, 4706, 1209, 13, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 13, 13, 1678, 822, 1243, 3624, 7211, 20249, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 29907, 1431, 5783, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 29907, 1431, 29899, 29928, 3668, 375, 5783, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 29907, 1431, 29918, 29928, 3668, 375, 5783, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 29907, 336, 5783, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 1113, 5783, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 4117, 3850, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 10736, 1753, 12443, 823, 6321, 23521, 459, 29939, 29878, 303, 5783, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 6786, 703, 10736, 1753, 12443, 823, 6321, 23521, 459, 29939, 29878, 303, 29884, 5783, 13, 4706, 1209, 13, 13, 1678, 822, 1243, 3624, 7211, 10048, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 5630, 28945, 25711, 17013, 29958, 5783, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 5630, 28945, 25711, 17013, 29958, 5783, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 5630, 28945, 25711, 17013, 29958, 5783, 13, 4706, 1209, 13, 13, 1678, 822, 1243, 3624, 7211, 9823, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 5269, 28945, 26862, 6227, 29958, 5783, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 5269, 28945, 26862, 6227, 29958, 5783, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 18157, 29889, 275, 29918, 3084, 29918, 5269, 703, 29907, 336, 335, 5431, 510, 5783, 13, 4706, 1209, 13, 13, 1678, 822, 1243, 7211, 29898, 1311, 1125, 13, 4706, 8952, 353, 376, 29907, 336, 335, 29908, 13, 4706, 4800, 353, 9872, 25711, 17013, 11903, 13, 4706, 11539, 353, 9872, 25711, 17013, 11903, 13, 4706, 4876, 353, 9872, 26862, 6227, 11903, 13, 4706, 2854, 29924, 29879, 3174, 29892, 338, 7211, 353, 1583, 29889, 18157, 29889, 15480, 29898, 6786, 29892, 4800, 29892, 11539, 29892, 4876, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 7211, 29897, 13, 4706, 1583, 29889, 9294, 8915, 3728, 4197, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29900, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29896, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29941, 20526, 2854, 29924, 29879, 3174, 29897, 13, 308, 13, 1678, 822, 1243, 7211, 29918, 22050, 20249, 29898, 1311, 1125, 13, 4706, 8952, 353, 376, 29907, 336, 335, 294, 2176, 294, 2176, 294, 2176, 294, 2176, 328, 29888, 328, 5847, 29908, 13, 4706, 4800, 353, 9872, 25711, 17013, 11903, 13, 4706, 11539, 353, 376, 26844, 335, 29896, 29908, 13, 4706, 4876, 353, 9872, 26862, 6227, 11903, 13, 4706, 2854, 29924, 29879, 3174, 29892, 338, 7211, 353, 1583, 29889, 18157, 29889, 15480, 29898, 6786, 29892, 4800, 29892, 11539, 29892, 4876, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 275, 7211, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29900, 20526, 2854, 29924, 29879, 3174, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29900, 24960, 13, 4706, 1583, 29889, 9294, 8915, 3728, 4197, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29896, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29941, 20526, 2854, 29924, 29879, 3174, 29897, 13, 13, 1678, 822, 1243, 7211, 29918, 22050, 10048, 29898, 1311, 1125, 13, 4706, 8952, 353, 376, 29907, 336, 335, 29908, 13, 4706, 4800, 353, 376, 29883, 29896, 29908, 13, 4706, 11539, 353, 376, 29883, 29896, 29908, 13, 4706, 4876, 353, 9872, 26862, 6227, 11903, 13, 4706, 2854, 29924, 29879, 3174, 29892, 338, 7211, 353, 1583, 29889, 18157, 29889, 15480, 29898, 6786, 29892, 4800, 29892, 11539, 29892, 4876, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 275, 7211, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29896, 20526, 2854, 29924, 29879, 3174, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29896, 24960, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 20526, 2854, 29924, 29879, 3174, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 24960, 13, 4706, 1583, 29889, 9294, 8915, 3728, 4197, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29900, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29941, 20526, 2854, 29924, 29879, 3174, 29897, 13, 13, 29937, 1678, 822, 1243, 7211, 29918, 22050, 6565, 1598, 10048, 29898, 1311, 1125, 13, 29937, 4706, 8952, 353, 376, 29907, 336, 335, 29908, 13, 29937, 4706, 4800, 353, 376, 29883, 29896, 29908, 13, 29937, 4706, 11539, 353, 376, 29883, 29896, 29908, 13, 29937, 4706, 4876, 353, 9872, 26862, 6227, 11903, 13, 29937, 4706, 2854, 29924, 29879, 3174, 29892, 338, 7211, 353, 1583, 29889, 18157, 29889, 15480, 29898, 6786, 29892, 4800, 29892, 11539, 29892, 4876, 29897, 13, 29937, 4706, 1583, 29889, 9294, 8824, 29898, 275, 7211, 29897, 13, 29937, 4706, 1583, 29889, 9294, 14776, 29898, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 20526, 2854, 29924, 29879, 3174, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 24960, 13, 29937, 4706, 1583, 29889, 9294, 8915, 3728, 4197, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29900, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29896, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29941, 20526, 2854, 29924, 29879, 3174, 29897, 13, 13, 1678, 822, 1243, 7211, 29918, 22050, 9823, 29898, 1311, 1125, 13, 4706, 8952, 353, 376, 29907, 336, 335, 29908, 13, 4706, 4800, 353, 9872, 25711, 17013, 11903, 13, 4706, 11539, 353, 376, 26844, 335, 29896, 29908, 13, 4706, 4876, 353, 376, 29883, 29966, 26862, 6227, 11903, 13, 4706, 2854, 29924, 29879, 3174, 29892, 338, 7211, 353, 1583, 29889, 18157, 29889, 15480, 29898, 6786, 29892, 4800, 29892, 11539, 29892, 4876, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 275, 7211, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29941, 20526, 2854, 29924, 29879, 3174, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29941, 24960, 13, 4706, 1583, 29889, 9294, 8915, 3728, 4197, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29900, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29896, 20526, 2854, 29924, 29879, 3174, 29897, 13, 13, 1678, 822, 1243, 7211, 29918, 7129, 9303, 29928, 609, 9652, 29898, 1311, 1125, 13, 4706, 8952, 353, 376, 29907, 336, 335, 29908, 13, 4706, 4800, 353, 9872, 25711, 17013, 11903, 13, 4706, 11539, 353, 376, 26844, 335, 29908, 13, 4706, 4876, 353, 9872, 26862, 6227, 11903, 13, 4706, 2854, 29924, 29879, 3174, 29892, 338, 7211, 353, 1583, 29889, 18157, 29889, 15480, 29898, 6786, 29892, 4800, 29892, 11539, 29892, 4876, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 275, 7211, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29924, 3235, 29924, 14789, 3352, 29918, 25711, 11686, 8452, 29918, 2303, 1799, 10461, 29892, 2854, 29924, 29879, 3174, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29896, 24960, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29924, 3235, 29924, 14789, 3352, 29918, 25711, 11686, 8452, 29918, 2303, 1799, 10461, 29892, 2854, 29924, 29879, 3174, 29961, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29906, 24960, 13, 4706, 1583, 29889, 9294, 8915, 3728, 4197, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29900, 1402, 5348, 6545, 28541, 29918, 2303, 1799, 10461, 29903, 29918, 10818, 29903, 29961, 29941, 20526, 2854, 29924, 29879, 3174, 29897, 13, 13, 1678, 822, 1243, 29918, 275, 29918, 5630, 29918, 392, 29918, 27902, 29918, 10954, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 29889, 18157, 29889, 275, 29918, 5630, 29918, 392, 29918, 27902, 29918, 10954, 703, 26844, 335, 613, 9872, 25711, 17013, 29958, 5783, 13, 4706, 1583, 29889, 9294, 8824, 29898, 1311, 29889, 18157, 29889, 275, 29918, 5630, 29918, 392, 29918, 27902, 29918, 10954, 703, 26844, 335, 613, 9872, 25711, 17013, 29958, 5783, 13, 13, 1678, 822, 4974, 8915, 3728, 29898, 1311, 29892, 1820, 29918, 1761, 29892, 7191, 1125, 13, 4706, 363, 1820, 297, 1820, 29918, 1761, 29901, 13, 9651, 1583, 29889, 9294, 14776, 877, 742, 7191, 29961, 1989, 1402, 376, 3728, 411, 1820, 376, 718, 1820, 718, 376, 338, 451, 4069, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 5215, 10876, 29936, 9675, 29889, 19218, 353, 6024, 742, 525, 3057, 29889, 1688, 7211, 403, 20249, 2033, 13, 1678, 443, 27958, 29889, 3396, 580, 2 ]
user/views/contact.py
fsr/course-management
11
75282
<filename>user/views/contact.py<gh_stars>10-100 from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.http import HttpRequest from django.shortcuts import render, redirect from django.views.decorators.csrf import csrf_protect from django.utils.translation import ugettext as _ from user.forms import ContactForm from util.error.reporting import db_error CONTACT_FOOTER = """ ------------------- This message has been sent via the Course Mangement System. Sent by: """ @login_required @csrf_protect def contact_form(request: HttpRequest, user_id: int): try: user = User.objects.get(id=user_id) except User.DoesNotExist: return db_error(_('Requested user does not exist.')) assert isinstance(user, User) if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): content = form.content + CONTACT_FOOTER + request.user.email user.email_user( subject="[CM contact form] " + form.subject, message=content ) return redirect('index') else: form = ContactForm() return render( request, 'contact-form.html', { 'form': form, 'user': user } )
[ 1, 529, 9507, 29958, 1792, 29914, 7406, 29914, 12346, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 19557, 4097, 1053, 6464, 29918, 12403, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 3166, 9557, 29889, 1124, 1053, 9056, 3089, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 29892, 6684, 13, 3166, 9557, 29889, 7406, 29889, 19557, 4097, 29889, 2395, 9600, 1053, 5939, 9600, 29918, 14676, 312, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 318, 657, 726, 408, 903, 13, 13, 3166, 1404, 29889, 9514, 1053, 22387, 2500, 13, 3166, 3667, 29889, 2704, 29889, 12276, 292, 1053, 4833, 29918, 2704, 13, 13, 6007, 6040, 1783, 29918, 5800, 2891, 1001, 353, 9995, 13, 2683, 5634, 13, 4013, 2643, 756, 1063, 2665, 3025, 278, 6325, 344, 29237, 882, 2184, 29889, 13, 29903, 296, 491, 29901, 9995, 13, 13, 29992, 7507, 29918, 12403, 13, 29992, 2395, 9600, 29918, 14676, 312, 13, 1753, 6958, 29918, 689, 29898, 3827, 29901, 9056, 3089, 29892, 1404, 29918, 333, 29901, 938, 1125, 13, 1678, 1018, 29901, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 333, 29922, 1792, 29918, 333, 29897, 13, 1678, 5174, 4911, 29889, 25125, 3664, 1252, 391, 29901, 13, 4706, 736, 4833, 29918, 2704, 7373, 877, 3089, 287, 1404, 947, 451, 1863, 6169, 876, 13, 1678, 4974, 338, 8758, 29898, 1792, 29892, 4911, 29897, 13, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 883, 353, 22387, 2500, 29898, 3827, 29889, 5438, 29897, 13, 4706, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 9651, 2793, 353, 883, 29889, 3051, 718, 8707, 6040, 1783, 29918, 5800, 2891, 1001, 718, 2009, 29889, 1792, 29889, 5269, 13, 9651, 1404, 29889, 5269, 29918, 1792, 29898, 13, 18884, 4967, 543, 29961, 24494, 6958, 883, 29962, 376, 718, 883, 29889, 16009, 29892, 13, 18884, 2643, 29922, 3051, 13, 9651, 1723, 13, 9651, 736, 6684, 877, 2248, 1495, 13, 1678, 1683, 29901, 13, 4706, 883, 353, 22387, 2500, 580, 13, 13, 1678, 736, 4050, 29898, 13, 4706, 2009, 29892, 13, 4706, 525, 12346, 29899, 689, 29889, 1420, 742, 13, 4706, 426, 13, 9651, 525, 689, 2396, 883, 29892, 13, 9651, 525, 1792, 2396, 1404, 13, 4706, 500, 13, 1678, 1723, 13, 2 ]
map.py
CaptainYin/ParLTRANS
0
149510
<reponame>CaptainYin/ParLTRANS<gh_stars>0 import os import csv import numpy as np import replace #split iniloc file parf='IPL_20130913_4590_eddy2' parent_dir='Model6.5' jobscript_prefix='6_5' MapNum=96 parfpath='../loc/wbc20/'+parf+'.csv' loc=np.loadtxt(open(parfpath,'rb'),delimiter=',',usecols=(0,1,2,3)) offset=loc.shape[0]/MapNum res=loc.shape[0]%MapNum num=np.zeros((MapNum,),dtype=np.int) for i in range(0,MapNum): parf0=parf+'_'+str(i) parfpath0='../loc/wbc20/'+parf0+'.csv' if(i<res): np.savetxt(parfpath0,loc[i*(offset+1):(i+1)*(offset+1),:],fmt='%f',delimiter=',') num[i]=loc[i*(offset+1):(i+1)*(offset+1),:].shape[0] else: np.savetxt(parfpath0,loc[i*offset+res:(i+1)*offset+res,:],fmt='%f',delimiter=',') num[i]=loc[i*offset+res:(i+1)*offset+res,:].shape[0] ''' if(i==MapNum-1): np.savetxt(parfpath0,loc[i*offset:,:],fmt='%f',delimiter=',') num[i]=loc[i*offset:,:].shape[0] # print(loc[i*offset:-1,:].shape[0],'sdfg') else: np.savetxt(parfpath0,loc[i*offset:(i+1)*offset,:],fmt='%f',delimiter=',') num[i]=loc[i*offset:(i+1)*offset,:].shape[0] #print(loc[i*offset:(i+1)*offset,:].shape[0]) ''' print(num,num.sum()) #create working directory os.system("rm "+parent_dir+"/output/*") for i in range(0,MapNum): os.system("rm "+parent_dir+"."+str(i)+" -r") for i in range(0,MapNum): os.system("cp "+parent_dir+" "+parent_dir+"."+str(i)+" -r") os.system("mv "+parent_dir+"."+str(i)+"/"+jobscript_prefix+" "+parent_dir+"."+str(i)+"/"+jobscript_prefix+"."+str(i)) parameterfile=parent_dir+"."+str(i)+"/LTRANS.data" name="parfile" value='\'../../loc/wbc20/'+parf+'_'+str(i)+'.csv\'' replace.setparameter(parameterfile,name,value) replace.setparameter(parameterfile,"Numpar",str(num[i])) #run #for i in range(0,MapNum): #os.system("cd /vol6/home/zhangxy_zj/YinHQ/LTRANSv.2b-master/"+parent_dir+"."+str(i)) #os.system("pwd") # os.system("yhbatch -N 1 -n 1 -p weather "+jobscript_prefix+"."+str(i)) ''' #list=os.listdir(root) #list.sort() #for i in range(1,9): # print(i) # os.system("ncks -d ocean_time,0,,12 scs10_his_000"+str(i)+".nc ../12hour/scs10_his_000"+str(i)+".nc") #path=os.path.join(root,list[i]) #if os.path.isdir(path): # os.system("mv "+path+"/scs10_his_0001.nc ./scs10_his_00"+str(i+1).zfill(2)+".nc") # os.system("mv "+path+"/scs10_his_0002.nc ../halfhour/scs10_his_00"+str(i*4+2).zfill(2)+".nc") # os.system("mv "+path+"/scs10_his_0003.nc ../halfhour/scs10_his_00"+str(i*4+3).zfill(2)+".nc") # os.system("mv "+path+"/scs10_his_0004.nc ../halfhour/scs10_his_00"+str(i*4+4).zfill(2)+".nc") #print path,i #os.system("cp "+path+"/ocean_scs10_cur_daily.in "+path+"/ocean_scs10_cur.in") #os.system("ls "+path) with open(path+"/ocean_scs10_cur.in",'r') as f: lines=f.readlines() with open(path+"/ocean_scs10_cur.in",'w') as f_w: for line in lines: if "NHIS == 240" in line: line=" NHIS == 5\n" if "NDEFHIS == 960" in line: line=" NDEFHIS == 240\n" f_w.write(line.encode('utf-8')) '''
[ 1, 529, 276, 1112, 420, 29958, 21133, 475, 29979, 262, 29914, 2177, 29931, 26813, 29903, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 5215, 11799, 13, 5215, 12655, 408, 7442, 13, 5215, 5191, 13, 29937, 5451, 297, 309, 542, 934, 13, 862, 29888, 2433, 5690, 29931, 29918, 29906, 29900, 29896, 29941, 29900, 29929, 29896, 29941, 29918, 29946, 29945, 29929, 29900, 29918, 287, 4518, 29906, 29915, 13, 3560, 29918, 3972, 2433, 3195, 29953, 29889, 29945, 29915, 13, 9057, 2154, 29918, 13506, 2433, 29953, 29918, 29945, 29915, 13, 3388, 8009, 29922, 29929, 29953, 13, 862, 29888, 2084, 2433, 6995, 2029, 29914, 29893, 12328, 29906, 29900, 29914, 18717, 862, 29888, 29974, 4286, 7638, 29915, 13, 2029, 29922, 9302, 29889, 1359, 3945, 29898, 3150, 29898, 862, 29888, 2084, 5501, 6050, 5477, 6144, 19657, 29922, 742, 742, 1509, 22724, 7607, 29900, 29892, 29896, 29892, 29906, 29892, 29941, 876, 13, 10289, 29922, 2029, 29889, 12181, 29961, 29900, 16261, 3388, 8009, 13, 690, 29922, 2029, 29889, 12181, 29961, 29900, 29962, 29995, 3388, 8009, 13, 1949, 29922, 9302, 29889, 3298, 359, 3552, 3388, 8009, 29892, 511, 29881, 1853, 29922, 9302, 29889, 524, 29897, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 3388, 8009, 1125, 13, 1678, 610, 29888, 29900, 29922, 862, 29888, 29974, 15972, 18717, 710, 29898, 29875, 29897, 13, 1678, 610, 29888, 2084, 29900, 2433, 6995, 2029, 29914, 29893, 12328, 29906, 29900, 29914, 18717, 862, 29888, 29900, 29974, 4286, 7638, 29915, 13, 1678, 565, 29898, 29875, 29966, 690, 1125, 13, 4706, 7442, 29889, 29879, 485, 300, 486, 29898, 862, 29888, 2084, 29900, 29892, 2029, 29961, 29875, 16395, 10289, 29974, 29896, 1125, 29898, 29875, 29974, 29896, 11877, 29898, 10289, 29974, 29896, 511, 29901, 1402, 23479, 2433, 29995, 29888, 742, 6144, 19657, 29922, 742, 1495, 13, 4706, 954, 29961, 29875, 13192, 2029, 29961, 29875, 16395, 10289, 29974, 29896, 1125, 29898, 29875, 29974, 29896, 11877, 29898, 10289, 29974, 29896, 511, 29901, 1822, 12181, 29961, 29900, 29962, 13, 1678, 1683, 29901, 13, 4706, 7442, 29889, 29879, 485, 300, 486, 29898, 862, 29888, 2084, 29900, 29892, 2029, 29961, 29875, 29930, 10289, 29974, 690, 5919, 29875, 29974, 29896, 11877, 10289, 29974, 690, 29892, 29901, 1402, 23479, 2433, 29995, 29888, 742, 6144, 19657, 29922, 742, 1495, 13, 4706, 954, 29961, 29875, 13192, 2029, 29961, 29875, 29930, 10289, 29974, 690, 5919, 29875, 29974, 29896, 11877, 10289, 29974, 690, 29892, 29901, 1822, 12181, 29961, 29900, 29962, 13, 12008, 13, 12, 361, 29898, 29875, 1360, 3388, 8009, 29899, 29896, 1125, 13, 12, 12, 9302, 29889, 29879, 485, 300, 486, 29898, 862, 29888, 2084, 29900, 29892, 2029, 29961, 29875, 29930, 10289, 29901, 29892, 29901, 1402, 23479, 2433, 29995, 29888, 742, 6144, 19657, 29922, 742, 1495, 13, 12, 12, 1949, 29961, 29875, 13192, 2029, 29961, 29875, 29930, 10289, 29901, 29892, 29901, 1822, 12181, 29961, 29900, 29962, 13, 12, 29937, 12, 2158, 29898, 2029, 29961, 29875, 29930, 10289, 13018, 29896, 29892, 29901, 1822, 12181, 29961, 29900, 1402, 29915, 29879, 2176, 29887, 1495, 13, 12, 2870, 29901, 13, 12, 12, 9302, 29889, 29879, 485, 300, 486, 29898, 862, 29888, 2084, 29900, 29892, 2029, 29961, 29875, 29930, 10289, 5919, 29875, 29974, 29896, 11877, 10289, 29892, 29901, 1402, 23479, 2433, 29995, 29888, 742, 6144, 19657, 29922, 742, 1495, 13, 12, 12, 1949, 29961, 29875, 13192, 2029, 29961, 29875, 29930, 10289, 5919, 29875, 29974, 29896, 11877, 10289, 29892, 29901, 1822, 12181, 29961, 29900, 29962, 13, 12, 12, 29937, 2158, 29898, 2029, 29961, 29875, 29930, 10289, 5919, 29875, 29974, 29896, 11877, 10289, 29892, 29901, 1822, 12181, 29961, 29900, 2314, 13, 12008, 13, 2158, 29898, 1949, 29892, 1949, 29889, 2083, 3101, 13, 13, 13, 29937, 3258, 1985, 3884, 13, 359, 29889, 5205, 703, 1758, 15691, 3560, 29918, 3972, 13578, 29914, 4905, 5515, 1159, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 3388, 8009, 1125, 13, 12, 359, 29889, 5205, 703, 1758, 15691, 3560, 29918, 3972, 13578, 1213, 29974, 710, 29898, 29875, 7240, 29908, 448, 29878, 1159, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 3388, 8009, 1125, 13, 12, 359, 29889, 5205, 703, 6814, 15691, 3560, 29918, 3972, 13578, 15691, 3560, 29918, 3972, 13578, 1213, 29974, 710, 29898, 29875, 7240, 29908, 448, 29878, 1159, 13, 12, 359, 29889, 5205, 703, 29324, 15691, 3560, 29918, 3972, 13578, 1213, 29974, 710, 29898, 29875, 7240, 29908, 12975, 29974, 9057, 2154, 29918, 13506, 13578, 15691, 3560, 29918, 3972, 13578, 1213, 29974, 710, 29898, 29875, 7240, 29908, 12975, 29974, 9057, 2154, 29918, 13506, 13578, 1213, 29974, 710, 29898, 29875, 876, 13, 12, 15501, 1445, 29922, 3560, 29918, 3972, 13578, 1213, 29974, 710, 29898, 29875, 7240, 23901, 29931, 26813, 29903, 29889, 1272, 29908, 13, 12, 978, 543, 862, 1445, 29908, 13, 12, 1767, 2433, 20333, 21546, 2029, 29914, 29893, 12328, 29906, 29900, 29914, 18717, 862, 29888, 29974, 15972, 18717, 710, 29898, 29875, 7240, 4286, 7638, 29905, 4907, 13, 12, 6506, 29889, 842, 15501, 29898, 15501, 1445, 29892, 978, 29892, 1767, 29897, 13, 12, 6506, 29889, 842, 15501, 29898, 15501, 1445, 1699, 8009, 862, 613, 710, 29898, 1949, 29961, 29875, 12622, 13, 13, 29937, 3389, 13, 29937, 1454, 474, 297, 3464, 29898, 29900, 29892, 3388, 8009, 1125, 13, 12, 29937, 359, 29889, 5205, 703, 2252, 847, 1555, 29953, 29914, 5184, 29914, 29920, 11895, 3594, 29918, 29920, 29926, 29914, 29979, 262, 29950, 29984, 29914, 29931, 26813, 29903, 29894, 29889, 29906, 29890, 29899, 6207, 12975, 29974, 3560, 29918, 3972, 13578, 1213, 29974, 710, 29898, 29875, 876, 13, 12, 29937, 359, 29889, 5205, 703, 29886, 9970, 1159, 13, 29937, 12, 359, 29889, 5205, 703, 29891, 29882, 16175, 448, 29940, 29871, 29896, 448, 29876, 29871, 29896, 448, 29886, 14826, 15691, 9057, 2154, 29918, 13506, 13578, 1213, 29974, 710, 29898, 29875, 876, 13, 13, 12008, 13, 29937, 1761, 29922, 359, 29889, 1761, 3972, 29898, 4632, 29897, 13, 29937, 1761, 29889, 6605, 580, 13, 13, 29937, 1454, 474, 297, 3464, 29898, 29896, 29892, 29929, 1125, 13, 29937, 12, 2158, 29898, 29875, 29897, 13, 29937, 12, 359, 29889, 5205, 703, 29876, 4684, 448, 29881, 23474, 29918, 2230, 29892, 29900, 12985, 29896, 29906, 885, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 29900, 17969, 710, 29898, 29875, 7240, 1642, 17608, 29772, 29896, 29906, 18721, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 29900, 17969, 710, 29898, 29875, 7240, 1642, 17608, 1159, 13, 12, 29937, 2084, 29922, 359, 29889, 2084, 29889, 7122, 29898, 4632, 29892, 1761, 29961, 29875, 2314, 13, 12, 29937, 361, 2897, 29889, 2084, 29889, 275, 3972, 29898, 2084, 1125, 13, 12, 29937, 12, 359, 29889, 5205, 703, 29324, 15691, 2084, 13578, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 29900, 29896, 29889, 17608, 11431, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 17969, 710, 29898, 29875, 29974, 29896, 467, 29920, 5589, 29898, 29906, 7240, 1642, 17608, 1159, 13, 12, 29937, 12, 359, 29889, 5205, 703, 29324, 15691, 2084, 13578, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 29900, 29906, 29889, 17608, 29772, 24498, 18721, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 17969, 710, 29898, 29875, 29930, 29946, 29974, 29906, 467, 29920, 5589, 29898, 29906, 7240, 1642, 17608, 1159, 13, 12, 29937, 12, 359, 29889, 5205, 703, 29324, 15691, 2084, 13578, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 29900, 29941, 29889, 17608, 29772, 24498, 18721, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 17969, 710, 29898, 29875, 29930, 29946, 29974, 29941, 467, 29920, 5589, 29898, 29906, 7240, 1642, 17608, 1159, 13, 12, 29937, 12, 359, 29889, 5205, 703, 29324, 15691, 2084, 13578, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 29900, 29946, 29889, 17608, 29772, 24498, 18721, 29914, 1557, 29879, 29896, 29900, 29918, 22880, 29918, 29900, 29900, 17969, 710, 29898, 29875, 29930, 29946, 29974, 29946, 467, 29920, 5589, 29898, 29906, 7240, 1642, 17608, 1159, 13, 12, 12, 29937, 2158, 2224, 29892, 29875, 13, 12, 12, 29937, 359, 29889, 5205, 703, 6814, 15691, 2084, 13578, 29914, 29877, 11956, 29918, 1557, 29879, 29896, 29900, 29918, 2764, 29918, 29881, 8683, 29889, 262, 15691, 2084, 13578, 29914, 29877, 11956, 29918, 1557, 29879, 29896, 29900, 29918, 2764, 29889, 262, 1159, 13, 12, 12, 29937, 359, 29889, 5205, 703, 3137, 15691, 2084, 29897, 13, 13, 12, 12, 2541, 1722, 29898, 2084, 13578, 29914, 29877, 11956, 29918, 1557, 29879, 29896, 29900, 29918, 2764, 29889, 262, 613, 29915, 29878, 1495, 408, 285, 29901, 13, 12, 12, 418, 3454, 29922, 29888, 29889, 949, 9012, 580, 13, 12, 12, 418, 411, 1722, 29898, 2084, 13578, 29914, 29877, 11956, 29918, 1557, 29879, 29896, 29900, 29918, 2764, 29889, 262, 613, 29915, 29893, 1495, 408, 285, 29918, 29893, 29901, 13, 12, 12, 12, 1678, 363, 1196, 297, 3454, 29901, 13, 12, 12, 12, 308, 565, 376, 29940, 29950, 3235, 1275, 29871, 29906, 29946, 29900, 29908, 297, 1196, 29901, 13, 462, 462, 308, 1196, 543, 29871, 405, 29950, 3235, 1275, 29871, 29945, 29905, 29876, 29908, 13, 12, 12, 12, 12, 565, 376, 29940, 24405, 29950, 3235, 1275, 29871, 29929, 29953, 29900, 29908, 297, 1196, 29901, 13, 12, 12, 12, 12, 12, 1196, 543, 29871, 405, 24405, 29950, 3235, 1275, 29871, 29906, 29946, 29900, 29905, 29876, 29908, 13, 12, 12, 462, 285, 29918, 29893, 29889, 3539, 29898, 1220, 29889, 12508, 877, 9420, 29899, 29947, 8785, 13, 539, 14550, 13, 2 ]
spar_python/analytics/ta2/circuit_parameters/main.py
nathanawmk/SPARTA
37
111964
<filename>spar_python/analytics/ta2/circuit_parameters/main.py # ***************************************************************** # Copyright 2015 MIT Lincoln Laboratory # Project: SPAR # Authors: Yang # Description: Script to add additional parameters to Stealth # circuit descriptions. # # Modifications: # Date Name Modification # ---- ---- ------------ # 24 Mar 2013 Yang Original Version # ***************************************************************** import argparse from itertools import * from circuit_parameters import * def main(): parser = argparse.ArgumentParser(description = 'Appends additional ' 'parameters to the first line of each Stealth circuit description ' 'in the specified directory') parser.add_argument('-p, --path', dest = 'path', required = True, help = 'path to circuit') args = parser.parse_args(); (num_xor, num_other, fn_xor, fn_other) = parse_circuit(args.path) print "Number of XOR: {}\nNumber of Other: {}\nXOR fan-in: {}\nOther " \ "fan-in: {}".format(num_xor, num_other, fn_xor, fn_other) write_parameters(args.path, num_xor, num_other, fn_xor, fn_other) if __name__ == '__main__': main()
[ 1, 529, 9507, 29958, 29879, 862, 29918, 4691, 29914, 7054, 22026, 29914, 941, 29906, 29914, 6034, 3121, 29918, 16744, 29914, 3396, 29889, 2272, 13, 29937, 334, 7775, 7775, 7775, 7775, 13, 29937, 29871, 14187, 1266, 29871, 29906, 29900, 29896, 29945, 341, 1806, 17274, 16715, 7606, 259, 13, 29937, 29871, 8010, 29901, 9651, 10937, 1718, 13, 29937, 29871, 13189, 943, 29901, 9651, 27583, 13, 29937, 29871, 12953, 29901, 4706, 14415, 304, 788, 5684, 4128, 304, 2443, 4298, 13, 29937, 462, 418, 11369, 2342, 1980, 29889, 13, 29937, 29871, 13, 29937, 29871, 3382, 8232, 29901, 13, 29937, 29871, 4712, 3986, 4408, 965, 3382, 2450, 13, 29937, 29871, 23250, 3986, 23250, 965, 448, 1378, 5634, 13, 29937, 259, 29906, 29946, 1085, 29871, 29906, 29900, 29896, 29941, 259, 27583, 965, 8533, 10079, 13, 29937, 334, 7775, 7775, 7775, 7775, 13, 13, 5215, 1852, 5510, 13, 3166, 4256, 8504, 1053, 334, 13, 3166, 11369, 29918, 16744, 1053, 334, 13, 13, 1753, 1667, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 353, 525, 2052, 1975, 5684, 525, 13, 9651, 525, 16744, 304, 278, 937, 1196, 310, 1269, 2443, 4298, 11369, 6139, 525, 13, 9651, 525, 262, 278, 6790, 3884, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29886, 29892, 1192, 2084, 742, 2731, 353, 525, 2084, 742, 3734, 353, 5852, 29892, 13, 9651, 1371, 353, 525, 2084, 304, 11369, 1495, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 890, 13, 13, 1678, 313, 1949, 29918, 29916, 272, 29892, 954, 29918, 1228, 29892, 7876, 29918, 29916, 272, 29892, 7876, 29918, 1228, 29897, 353, 6088, 29918, 6034, 3121, 29898, 5085, 29889, 2084, 29897, 13, 1678, 1596, 376, 4557, 310, 1060, 1955, 29901, 426, 1012, 29876, 4557, 310, 5901, 29901, 426, 1012, 29876, 29990, 1955, 13524, 29899, 262, 29901, 426, 1012, 29876, 16107, 376, 320, 13, 4706, 376, 12963, 29899, 262, 29901, 6571, 1642, 4830, 29898, 1949, 29918, 29916, 272, 29892, 954, 29918, 1228, 29892, 7876, 29918, 29916, 272, 29892, 7876, 29918, 1228, 29897, 13, 13, 1678, 2436, 29918, 16744, 29898, 5085, 29889, 2084, 29892, 954, 29918, 29916, 272, 29892, 954, 29918, 1228, 29892, 7876, 29918, 29916, 272, 29892, 7876, 29918, 1228, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
tests/test_fast_pot.py
mudigonda/hmc_scripts
0
193265
from mjhmc.search.objective import obj_func from mjhmc.samplers.markov_jump_hmc import MarkovJumpHMC from mjhmc.misc.distributions import ProductOfT from mjhmc.misc.autocor import autocorrelation from mjhmc.misc.autocor import sample_to_df from mjhmc.fast import hmc from scipy.sparse import rand import numpy as np import theano.tensor as T import matplotlib.pyplot as plt np.random.seed(2016) nbasis=36 ndims=12 n_steps=1000 half_window=False rand_val = rand(ndims,nbasis/2,density=0.1) W = np.concatenate([rand_val.toarray(), -rand_val.toarray()],axis=1) logalpha = np.random.randn(nbasis,1) PoT_instance = ProductOfT(nbatch=100,ndims=ndims,nbasis=nbasis,W=W,logalpha=logalpha) simulate = hmc.wrapper_hmc(s_rng=s_rng,energy_fn=rw.E_val,dim=dim) a = np.zeros([1,10,n_samples]) b = np.zeros([2,10,n_samples]) for ii in np.arange(n_steps): a[:,:,ii],b[:,:,ii] = simulate() print "Acceptance Rate" print a[:,:,ii] print "Samples" print b[:,:,ii] ac_df = autocorrelation(df,half_window) #Now, we can run the same autocorrelation from the data we will extract from the data frame #but with the theano function ac= hmc.normed_autocorrelation(df) #We can compare the two plots individually and on a single plot #Drop Mic and leave. n_grad_evals = ac_df['num grad'].astype(int)
[ 1, 515, 286, 29926, 7184, 29883, 29889, 4478, 29889, 3318, 573, 1053, 5446, 29918, 9891, 13, 3166, 286, 29926, 7184, 29883, 29889, 13445, 572, 414, 29889, 3502, 586, 29918, 29926, 3427, 29918, 7184, 29883, 1053, 4485, 586, 29967, 3427, 29950, 12513, 13, 3166, 286, 29926, 7184, 29883, 29889, 29885, 10669, 29889, 27691, 29879, 1053, 10969, 2776, 29911, 13, 3166, 286, 29926, 7184, 29883, 29889, 29885, 10669, 29889, 1300, 542, 272, 1053, 1120, 542, 272, 23445, 13, 3166, 286, 29926, 7184, 29883, 29889, 29885, 10669, 29889, 1300, 542, 272, 1053, 4559, 29918, 517, 29918, 2176, 13, 3166, 286, 29926, 7184, 29883, 29889, 11255, 1053, 298, 14047, 13, 3166, 4560, 2272, 29889, 29879, 5510, 1053, 20088, 13, 5215, 12655, 408, 7442, 13, 5215, 278, 1562, 29889, 20158, 408, 323, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 9302, 29889, 8172, 29889, 26776, 29898, 29906, 29900, 29896, 29953, 29897, 13, 13, 29876, 6500, 275, 29922, 29941, 29953, 13, 299, 9893, 29922, 29896, 29906, 13, 29876, 29918, 24530, 29922, 29896, 29900, 29900, 29900, 13, 24498, 29918, 7165, 29922, 8824, 13, 9502, 29918, 791, 353, 20088, 29898, 299, 9893, 29892, 29876, 6500, 275, 29914, 29906, 29892, 21518, 537, 29922, 29900, 29889, 29896, 29897, 13, 29956, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 9502, 29918, 791, 29889, 517, 2378, 3285, 448, 9502, 29918, 791, 29889, 517, 2378, 580, 1402, 8990, 29922, 29896, 29897, 13, 1188, 2312, 353, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 29876, 6500, 275, 29892, 29896, 29897, 13, 13, 9837, 29911, 29918, 8758, 353, 10969, 2776, 29911, 29898, 9877, 905, 29922, 29896, 29900, 29900, 29892, 299, 9893, 29922, 299, 9893, 29892, 29876, 6500, 275, 29922, 29876, 6500, 275, 29892, 29956, 29922, 29956, 29892, 1188, 2312, 29922, 1188, 2312, 29897, 13, 3601, 5987, 353, 298, 14047, 29889, 17699, 29918, 7184, 29883, 29898, 29879, 29918, 29878, 865, 29922, 29879, 29918, 29878, 865, 29892, 27548, 29918, 9144, 29922, 13975, 29889, 29923, 29918, 791, 29892, 6229, 29922, 6229, 29897, 13, 29874, 353, 7442, 29889, 3298, 359, 4197, 29896, 29892, 29896, 29900, 29892, 29876, 29918, 27736, 2314, 13, 29890, 353, 7442, 29889, 3298, 359, 4197, 29906, 29892, 29896, 29900, 29892, 29876, 29918, 27736, 2314, 13, 1454, 13607, 297, 7442, 29889, 279, 927, 29898, 29876, 29918, 24530, 1125, 13, 1678, 263, 7503, 29892, 29901, 29892, 2236, 1402, 29890, 7503, 29892, 29901, 29892, 2236, 29962, 353, 29611, 580, 13, 1678, 1596, 376, 23965, 749, 390, 403, 29908, 13, 1678, 1596, 263, 7503, 29892, 29901, 29892, 2236, 29962, 13, 1678, 1596, 376, 29903, 9422, 29908, 13, 1678, 1596, 289, 7503, 29892, 29901, 29892, 2236, 29962, 13, 13, 562, 29918, 2176, 353, 1120, 542, 272, 23445, 29898, 2176, 29892, 24498, 29918, 7165, 29897, 29871, 13, 13, 29937, 10454, 29892, 591, 508, 1065, 278, 1021, 1120, 542, 272, 23445, 515, 278, 848, 591, 674, 6597, 515, 278, 848, 3515, 13, 29937, 4187, 411, 278, 278, 1562, 740, 13, 13, 562, 29922, 298, 14047, 29889, 12324, 287, 29918, 1300, 542, 272, 23445, 29898, 2176, 29897, 13, 29937, 4806, 508, 7252, 278, 1023, 24580, 29689, 322, 373, 263, 2323, 6492, 13, 13, 29937, 15063, 20279, 322, 5967, 29889, 13, 29876, 29918, 5105, 29918, 14513, 29879, 353, 1274, 29918, 2176, 1839, 1949, 4656, 13359, 579, 668, 29898, 524, 29897, 13, 2 ]
orthnet/poly/__init__.py
Orcuslc/OrthNet
32
156506
from ._legendre import Legendre, Legendre_Normalized from ._laguerre import Laguerre from ._hermite import Hermite, Hermite2 from ._chebyshev import Chebyshev, Chebyshev2 from ._jacobi import Jacobi __all__ = ['Legendre', 'Legendre_Normalized', 'Laguerre', 'Hermite', 'Hermite2', 'Chebyshev', 'Chebyshev2', 'Jacobi']
[ 1, 515, 869, 29918, 1397, 9030, 1053, 5682, 9030, 29892, 5682, 9030, 29918, 19077, 1891, 13, 3166, 869, 29918, 3110, 2853, 276, 1053, 16952, 2853, 276, 13, 3166, 869, 29918, 29882, 837, 568, 1053, 10515, 568, 29892, 10515, 568, 29906, 13, 3166, 869, 29918, 305, 774, 952, 354, 29894, 1053, 6561, 29890, 952, 354, 29894, 29892, 6561, 29890, 952, 354, 29894, 29906, 13, 3166, 869, 29918, 29926, 562, 15647, 1053, 10968, 29875, 13, 13, 1649, 497, 1649, 353, 6024, 22988, 9030, 742, 525, 22988, 9030, 29918, 19077, 1891, 742, 525, 29931, 351, 2853, 276, 742, 525, 29950, 837, 568, 742, 525, 29950, 837, 568, 29906, 742, 525, 29907, 25842, 952, 354, 29894, 742, 525, 29907, 25842, 952, 354, 29894, 29906, 742, 525, 24288, 15647, 2033, 2 ]
gzdice/rollers/FateRoller.py
gleeblezoid/Diceroller
1
174934
# Roller for FATE dice import random from ..menus import base_menus as m def fateroller(): pool = int(input("How many dice are you rolling? ")) rollagain = "Y" while str.upper(rollagain) == "Y": try: sides = 6 if pool < 1: print("Silly human") # Dice roll resolution i = 0 while i < (pool): roll = random.randint(1, sides) i = i + 1 if roll == (1 or 2): print("[+]", end=",") elif roll == (3 or 4): print("[-]", end=",") else: print("[ ]", end=",") rollagain = input( "Do you want to roll the same again?\ Enter Y or N: " ) except (NameError, TypeError, ValueError): m.main_menu() else: m.main_menu()
[ 1, 396, 8731, 1358, 363, 383, 3040, 17629, 13, 13, 5215, 4036, 13, 3166, 6317, 1527, 375, 1053, 2967, 29918, 1527, 375, 408, 286, 13, 13, 13, 1753, 285, 1008, 324, 1358, 7295, 13, 1678, 11565, 353, 938, 29898, 2080, 703, 5328, 1784, 17629, 526, 366, 27777, 29973, 376, 876, 13, 1678, 9679, 351, 475, 353, 376, 29979, 29908, 13, 1678, 1550, 851, 29889, 21064, 29898, 1245, 351, 475, 29897, 1275, 376, 29979, 1115, 13, 4706, 1018, 29901, 13, 9651, 11192, 353, 29871, 29953, 13, 13, 9651, 565, 11565, 529, 29871, 29896, 29901, 13, 18884, 1596, 703, 29903, 9403, 5199, 1159, 13, 13, 9651, 396, 360, 625, 9679, 10104, 13, 9651, 474, 353, 29871, 29900, 13, 9651, 1550, 474, 529, 313, 10109, 1125, 13, 18884, 9679, 353, 4036, 29889, 9502, 524, 29898, 29896, 29892, 11192, 29897, 13, 18884, 474, 353, 474, 718, 29871, 29896, 13, 18884, 565, 9679, 1275, 313, 29896, 470, 29871, 29906, 1125, 13, 462, 1678, 1596, 703, 29961, 29974, 29962, 613, 1095, 543, 29892, 1159, 13, 18884, 25342, 9679, 1275, 313, 29941, 470, 29871, 29946, 1125, 13, 462, 1678, 1596, 703, 14352, 29962, 613, 1095, 543, 29892, 1159, 13, 18884, 1683, 29901, 13, 462, 1678, 1596, 703, 29961, 4514, 613, 1095, 543, 29892, 1159, 13, 13, 9651, 9679, 351, 475, 353, 1881, 29898, 13, 18884, 376, 6132, 366, 864, 304, 9679, 278, 1021, 1449, 29973, 29905, 13, 18884, 9041, 612, 470, 405, 29901, 376, 13, 9651, 1723, 13, 13, 4706, 5174, 313, 1170, 2392, 29892, 20948, 29892, 7865, 2392, 1125, 13, 13, 9651, 286, 29889, 3396, 29918, 6510, 580, 13, 1678, 1683, 29901, 13, 4706, 286, 29889, 3396, 29918, 6510, 580, 13, 2 ]
src/user/migrations/0018_delete_emailpreference.py
ResearchHub/ResearchHub-Backend-Open
18
91565
<reponame>ResearchHub/ResearchHub-Backend-Open # Generated by Django 2.2.8 on 2019-12-11 22:30 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('user', '0017_emailpreference'), ] operations = [ migrations.DeleteModel( name='EmailPreference', ), ]
[ 1, 529, 276, 1112, 420, 29958, 1666, 2842, 16046, 29914, 1666, 2842, 16046, 29899, 5841, 355, 29899, 6585, 13, 29937, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29947, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29906, 29899, 29896, 29896, 29871, 29906, 29906, 29901, 29941, 29900, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 1792, 742, 525, 29900, 29900, 29896, 29955, 29918, 5269, 1457, 1659, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 12498, 3195, 29898, 13, 9651, 1024, 2433, 9823, 29925, 5679, 742, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
airflow_server/dags/cbs.py
carmelp16/anyway-etl
0
163927
<reponame>carmelp16/anyway-etl from airflow import DAG from airflow.utils.dates import days_ago from anyway_etl_airflow.operators.cli_bash_operator import CliBashOperator dag_kwargs = dict( default_args={ 'owner': 'airflow', }, schedule_interval='@daily', catchup=False, start_date=days_ago(2), ) with DAG('cbs', **dag_kwargs) as cbs_dag: CliBashOperator( 'anyway-etl cbs import-emails', task_id='import-emails' ) >> CliBashOperator( 'anyway-etl cbs process-files', task_id='process-files' ) >> [ # for local development you can use the following command to parse all types sequentially: # anyway-etl cbs parse-all CliBashOperator('anyway-etl cbs parse-accidents', task_id='parse-accidents'), CliBashOperator('anyway-etl cbs parse-involved', task_id='parse-involved'), CliBashOperator('anyway-etl cbs parse-vehicles', task_id='parse-vehicles'), ] >> CliBashOperator( 'anyway-etl cbs import-to-datastore', task_id='import-to-datastore' )
[ 1, 529, 276, 1112, 420, 29958, 29883, 2817, 295, 29886, 29896, 29953, 29914, 1384, 1582, 29899, 300, 29880, 13, 3166, 4799, 1731, 1053, 360, 10051, 13, 3166, 4799, 1731, 29889, 13239, 29889, 15190, 1053, 3841, 29918, 4425, 13, 13, 3166, 8763, 29918, 300, 29880, 29918, 1466, 1731, 29889, 3372, 4097, 29889, 11303, 29918, 13067, 29918, 6891, 1053, 315, 492, 29933, 1161, 26486, 13, 13, 13, 24157, 29918, 19290, 353, 9657, 29898, 13, 1678, 2322, 29918, 5085, 3790, 13, 4706, 525, 20348, 2396, 525, 1466, 1731, 742, 13, 1678, 2981, 13, 1678, 20410, 29918, 19207, 2433, 29992, 29881, 8683, 742, 13, 1678, 4380, 786, 29922, 8824, 29892, 13, 1678, 1369, 29918, 1256, 29922, 16700, 29918, 4425, 29898, 29906, 511, 13, 29897, 13, 13, 13, 2541, 360, 10051, 877, 29883, 5824, 742, 3579, 24157, 29918, 19290, 29897, 408, 274, 5824, 29918, 24157, 29901, 13, 1678, 315, 492, 29933, 1161, 26486, 29898, 13, 4706, 525, 1384, 1582, 29899, 300, 29880, 274, 5824, 1053, 29899, 331, 2234, 742, 3414, 29918, 333, 2433, 5215, 29899, 331, 2234, 29915, 13, 1678, 1723, 5099, 315, 492, 29933, 1161, 26486, 29898, 13, 4706, 525, 1384, 1582, 29899, 300, 29880, 274, 5824, 1889, 29899, 5325, 742, 3414, 29918, 333, 2433, 5014, 29899, 5325, 29915, 13, 1678, 1723, 5099, 518, 13, 4706, 396, 363, 1887, 5849, 366, 508, 671, 278, 1494, 1899, 304, 6088, 599, 4072, 8617, 9247, 29901, 13, 4706, 396, 259, 8763, 29899, 300, 29880, 274, 5824, 6088, 29899, 497, 13, 4706, 315, 492, 29933, 1161, 26486, 877, 1384, 1582, 29899, 300, 29880, 274, 5824, 6088, 29899, 5753, 16719, 742, 3414, 29918, 333, 2433, 5510, 29899, 5753, 16719, 5477, 13, 4706, 315, 492, 29933, 1161, 26486, 877, 1384, 1582, 29899, 300, 29880, 274, 5824, 6088, 29899, 262, 1555, 1490, 742, 3414, 29918, 333, 2433, 5510, 29899, 262, 1555, 1490, 5477, 13, 4706, 315, 492, 29933, 1161, 26486, 877, 1384, 1582, 29899, 300, 29880, 274, 5824, 6088, 29899, 345, 29882, 4027, 742, 3414, 29918, 333, 2433, 5510, 29899, 345, 29882, 4027, 5477, 13, 1678, 4514, 5099, 315, 492, 29933, 1161, 26486, 29898, 13, 4706, 525, 1384, 1582, 29899, 300, 29880, 274, 5824, 1053, 29899, 517, 29899, 4130, 579, 487, 742, 3414, 29918, 333, 2433, 5215, 29899, 517, 29899, 4130, 579, 487, 29915, 13, 1678, 1723, 13, 2 ]
Imaginary/2021/crypto/Textbook_RSA_2_Timmy_the_Lonely_Oracle/oracle.py
ruhan-islam/ctf-archives
1
121833
<filename>Imaginary/2021/crypto/Textbook_RSA_2_Timmy_the_Lonely_Oracle/oracle.py #!/usr/bin/env -S python3 -u from Crypto.Util.number import * from hidden import p, q, flag1 e = 65537 n = p*q ns = str(n) ctxt = pow(bytes_to_long(flag1), e, n) class SneakyUserException(Exception): pass def print_ctxt(t): print("Here's the encrypted message:", t) print("e =", e) print("n =", ns) def encrypt(): global e, n, ctxt ptxt = bytes_to_long(input("What's your message to encrypt? ").encode("utf8")) print_ctxt(pow(ptxt, e, n)) def decrypt(): global e, p, q, n, ctxt try: c = int(input("What's your message to decrypt? ")) if c == ctxt: raise SneakyUserException d = pow(e, -1, (p-1)*(q-1)) m = pow(c, d, n) pt = long_to_bytes(m) if pt == flag1: raise SneakyUserException print("The decrypted message is",m) print() try: print("That spells out \""+pt.decode("utf8")+"\" if that means anything to you.") except UnicodeDecodeError as u: print("I couldn't figure out what that says ... are you sure you're doing it correctly?") except SneakyUserException as e: print("Hey, that's cheating! You can't ask me to decrypt the flag!") print("I'm not playing with you any more! Go cheat somewhere else.") exit() def menu(): print() print() print("1: Get Encrypted Flag") print("2: Encrypt Message") print("3: Decrypt Message") print("4: Quit") print() choice = int(input(">>> ")) if choice == 1: print_ctxt(ctxt) print() print("Good luck!") elif choice == 2: encrypt() elif choice == 3: decrypt() elif choice == 4: print("Come back again soon!") exit() if __name__ == '__main__': print("Hi! I'm Timmy! Have you come to play with my encryption system?") print("Just let me know what I can do for you!") while True: try: menu() except Exception as ex: print("Something's gone horribly wrong.") print("I have to go now. Bye!") exit()
[ 1, 529, 9507, 29958, 1888, 351, 3821, 29914, 29906, 29900, 29906, 29896, 29914, 29883, 17929, 29914, 1626, 2909, 29918, 29934, 8132, 29918, 29906, 29918, 13711, 1357, 29918, 1552, 29918, 29931, 265, 873, 29918, 29949, 10792, 29914, 11347, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 448, 29903, 3017, 29941, 448, 29884, 13, 13, 3166, 315, 17929, 29889, 7270, 29889, 4537, 1053, 334, 13, 3166, 7934, 1053, 282, 29892, 3855, 29892, 7353, 29896, 13, 13, 29872, 353, 29871, 29953, 29945, 29945, 29941, 29955, 13, 29876, 353, 282, 29930, 29939, 13, 1983, 353, 851, 29898, 29876, 29897, 13, 312, 486, 353, 4764, 29898, 13193, 29918, 517, 29918, 5426, 29898, 15581, 29896, 511, 321, 29892, 302, 29897, 13, 13, 1990, 317, 484, 557, 29891, 2659, 2451, 29898, 2451, 1125, 13, 12, 3364, 13, 13, 1753, 1596, 29918, 312, 486, 29898, 29873, 1125, 13, 12, 2158, 703, 10605, 29915, 29879, 278, 23220, 2643, 29901, 613, 260, 29897, 13, 12, 2158, 703, 29872, 353, 613, 321, 29897, 13, 12, 2158, 703, 29876, 353, 613, 17534, 29897, 13, 13, 1753, 27924, 7295, 13, 12, 10945, 321, 29892, 302, 29892, 274, 3945, 13, 12, 415, 486, 353, 6262, 29918, 517, 29918, 5426, 29898, 2080, 703, 5618, 29915, 29879, 596, 2643, 304, 27924, 29973, 376, 467, 12508, 703, 9420, 29947, 5783, 13, 12, 2158, 29918, 312, 486, 29898, 12248, 29898, 415, 486, 29892, 321, 29892, 302, 876, 13, 13, 1753, 1602, 4641, 7295, 13, 12, 10945, 321, 29892, 282, 29892, 3855, 29892, 302, 29892, 274, 3945, 13, 12, 2202, 29901, 13, 12, 12, 29883, 353, 938, 29898, 2080, 703, 5618, 29915, 29879, 596, 2643, 304, 1602, 4641, 29973, 376, 876, 13, 12, 12, 361, 274, 1275, 274, 3945, 29901, 13, 12, 12, 12, 22692, 317, 484, 557, 29891, 2659, 2451, 13, 12, 12, 29881, 353, 4764, 29898, 29872, 29892, 448, 29896, 29892, 313, 29886, 29899, 29896, 11877, 29898, 29939, 29899, 29896, 876, 13, 12, 12, 29885, 353, 4764, 29898, 29883, 29892, 270, 29892, 302, 29897, 13, 12, 12, 415, 353, 1472, 29918, 517, 29918, 13193, 29898, 29885, 29897, 13, 12, 12, 361, 19592, 1275, 7353, 29896, 29901, 13, 12, 12, 12, 22692, 317, 484, 557, 29891, 2659, 2451, 13, 12, 12, 2158, 703, 1576, 1602, 14740, 2643, 338, 613, 29885, 29897, 13, 12, 12, 2158, 580, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 2158, 703, 7058, 805, 10071, 714, 13218, 17969, 415, 29889, 13808, 703, 9420, 29947, 1159, 13578, 5931, 565, 393, 2794, 3099, 304, 366, 23157, 13, 12, 12, 19499, 23862, 2772, 401, 2392, 408, 318, 29901, 13, 12, 12, 12, 2158, 703, 29902, 8496, 29915, 29873, 4377, 714, 825, 393, 4083, 2023, 526, 366, 1854, 366, 29915, 276, 2599, 372, 5149, 29973, 1159, 13, 12, 19499, 317, 484, 557, 29891, 2659, 2451, 408, 321, 29901, 13, 12, 12, 2158, 703, 29950, 1032, 29892, 393, 29915, 29879, 923, 1218, 29991, 887, 508, 29915, 29873, 2244, 592, 304, 1602, 4641, 278, 7353, 29991, 1159, 13, 12, 12, 2158, 703, 29902, 29915, 29885, 451, 8743, 411, 366, 738, 901, 29991, 2921, 923, 271, 9051, 1683, 23157, 13, 12, 12, 13322, 580, 13, 13, 1753, 6143, 7295, 13, 12, 2158, 580, 13, 12, 2158, 580, 13, 12, 2158, 703, 29896, 29901, 3617, 11346, 14740, 28697, 1159, 13, 12, 2158, 703, 29906, 29901, 11346, 4641, 7777, 1159, 13, 12, 2158, 703, 29941, 29901, 3826, 4641, 7777, 1159, 13, 12, 2158, 703, 29946, 29901, 751, 277, 1159, 13, 12, 2158, 580, 13, 12, 16957, 353, 938, 29898, 2080, 703, 6778, 29958, 376, 876, 13, 12, 361, 7348, 1275, 29871, 29896, 29901, 13, 12, 12, 2158, 29918, 312, 486, 29898, 312, 486, 29897, 13, 12, 12, 2158, 580, 13, 12, 12, 2158, 703, 18420, 9885, 29991, 1159, 13, 12, 23681, 7348, 1275, 29871, 29906, 29901, 13, 12, 12, 3977, 4641, 580, 13, 12, 23681, 7348, 1275, 29871, 29941, 29901, 13, 12, 12, 7099, 4641, 580, 13, 12, 23681, 7348, 1275, 29871, 29946, 29901, 13, 12, 12, 2158, 703, 27796, 1250, 1449, 4720, 29991, 1159, 13, 12, 12, 13322, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 12, 2158, 703, 18567, 29991, 306, 29915, 29885, 7870, 1357, 29991, 6975, 366, 2041, 304, 1708, 411, 590, 20956, 1788, 29973, 1159, 13, 12, 2158, 703, 14084, 1235, 592, 1073, 825, 306, 508, 437, 363, 366, 29991, 1159, 13, 12, 8000, 5852, 29901, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 6510, 580, 13, 12, 12, 19499, 8960, 408, 429, 29901, 13, 12, 12, 12, 2158, 703, 16804, 29915, 29879, 7695, 4029, 1091, 368, 2743, 23157, 13, 12, 12, 12, 2158, 703, 29902, 505, 304, 748, 1286, 29889, 2648, 29872, 29991, 1159, 13, 12, 12, 12, 13322, 580, 2 ]
conan_ue4cli/commands/build.py
hobbeshunter/conan-ue4cli
0
86918
import argparse, os, shutil, tempfile from os.path import basename, exists, join from ..common import PackageBuilder, ProfileManagement, RecipeCache, Utility from .update import update # The default username used when building packages DEFAULT_USER = 'adamrehn' def build(manager, argv): # Our supported command-line arguments parser = argparse.ArgumentParser( prog='ue4 conan build', description = 'Builds Conan packages that depend on conan-ue4cli wrappers' ) parser.add_argument('--rebuild', action='store_true', help='Rebuild packages that already exist in the local Conan cache') parser.add_argument('--dry-run', action='store_true', help='Print Conan commands instead of running them') parser.add_argument('--no-cache', action='store_true', help='Do not add the conan-ue4cli recipe cache to the list of default recipe sources') parser.add_argument('-s', '-source', action='append', dest='sources', metavar='DIR', help='Add the specified directory as an additional source of buildable package recipes (the only sources available by default are the conan-ue4cli recipe cache and the current working directory)') parser.add_argument('-o', '-option', action='append', dest='options', metavar='PKG:OPTION=VALUE', help='Specify options to pass to package recipes when building them (does not affect dependency resolution)') parser.add_argument('-user', default=DEFAULT_USER, help='Set the user for the built packages (default user is "{}")'.format(DEFAULT_USER)) parser.add_argument('-upload', default=None, metavar='REMOTE', help='Upload the built packages to the specified Conan remote') parser.add_argument('-p', '-profile', dest='profile', metavar='PROFILE', default=None, choices=ProfileManagement.listGeneratedProfiles(), help='Build packages using the specified Conan profile (defaults to the profile for the host platform and most Unreal Engine installation used to perform profile generation)') parser.add_argument('package', nargs='+', help='Package(s) to build, in either NAME or NAME==VERSION format (specify "all" to build all available packages)') # Parse the supplied command-line arguments args = parser.parse_args(argv) # If a profile was not specified, fallback to the default for the host platform (or using the generic one if the default doesn't exist) if args.profile is None: preferredDefault = ProfileManagement.profileForHostPlatform(manager) genericFallback = ProfileManagement.genericProfile() if preferredDefault in ProfileManagement.listGeneratedProfiles(): print('Using default profile for host platform "{}"'.format(preferredDefault)) args.profile = preferredDefault else: print('Warning: falling back to generic profile "{}" because the profile "{}" does not exist.'.format(genericFallback, preferredDefault)) print('You should run `ue4 conan generate` to generate the host platform profile for the current Engine installation.') args.profile = genericFallback # Retrieve the Unreal Engine version string for the specified Conan profile and use it as the channel channel = ProfileManagement.profileEngineVersion(args.profile) # Create an auto-deleting temporary directory to hold our aggregated recipe sources with tempfile.TemporaryDirectory() as tempDir: # Determine if we are including the recipe cache directory in our list of source directories cacheDir = RecipeCache.getCacheDirectory() defaultSources = [os.getcwd()] + ([cacheDir] if args.no_cache == False else []) # If the recipe cache directory does not exist (usually because this is our first build), then update it if args.no_cache == False and exists(cacheDir) == False: update(manager, argv) # Iterate over our source directories and copy our recipes to the temp directory sources = defaultSources + (args.sources if args.sources is not None else []) for source in sources: for recipe in Utility.listPackagesInDir(source): try: shutil.copytree(join(source, recipe), join(tempDir, recipe)) except FileExistsError as e: conflict = basename(str(e).split(': ')[-1].strip('"\'')) raise RuntimeError('conflicting source directories detected for recipe {}'.format(conflict)) from None # Create our package builder builder = PackageBuilder(tempDir, args.user, channel, args.profile, args.rebuild, args.dry_run) # Process the specified list of packages, resolving versions as needed packages = [] for arg in args.package: if arg.lower() == 'all': packages.extend(list([builder.identifyNewestVersion(p) for p in builder.availablePackages])) elif '==' in arg: packages.append(arg.replace('==', '/')) else: packages.append(builder.identifyNewestVersion(arg)) # Perform dependency resolution and compute the build order for the packages buildOrder = builder.computeBuildOrder(packages) # Verify that we are building at least one package if len(buildOrder) == 0: print('No packages need to be built. Use the --rebuild flag to rebuild existing packages.') return # Report the computed build order to the user uploadSuffix = ' and uploaded to the remote "{}"'.format(args.upload) if args.upload is not None else '' print('\nThe following packages will be built{}:'.format(uploadSuffix)) for package in buildOrder: print('\t' + package) # Attempt to build the packages builder.buildPackages(buildOrder, args.options if args.options is not None else []) # If a remote has been specified to upload the built packages to, attempt to do so if args.upload is not None: builder.uploadPackages(buildOrder, args.upload)
[ 1, 1053, 1852, 5510, 29892, 2897, 29892, 528, 4422, 29892, 5694, 1445, 13, 3166, 2897, 29889, 2084, 1053, 2362, 3871, 29892, 4864, 29892, 5988, 13, 3166, 6317, 9435, 1053, 22029, 5627, 29892, 20802, 27107, 29892, 830, 24044, 10408, 29892, 22310, 537, 13, 3166, 869, 5504, 1053, 2767, 13, 13, 29937, 450, 2322, 8952, 1304, 746, 5214, 9741, 13, 23397, 29918, 11889, 353, 525, 328, 314, 276, 3123, 29915, 13, 13, 1753, 2048, 29898, 12847, 29892, 1852, 29894, 1125, 13, 12, 13, 12, 29937, 8680, 6969, 1899, 29899, 1220, 6273, 13, 12, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 12, 12, 29097, 2433, 434, 29946, 378, 273, 2048, 742, 13, 12, 12, 8216, 353, 525, 8893, 29879, 1281, 273, 9741, 393, 8839, 373, 378, 273, 29899, 434, 29946, 11303, 11463, 22437, 29915, 13, 12, 29897, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 489, 276, 4282, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 29934, 774, 29884, 789, 9741, 393, 2307, 1863, 297, 278, 1887, 1281, 273, 7090, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 489, 29881, 719, 29899, 3389, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 11816, 1281, 273, 8260, 2012, 310, 2734, 963, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 489, 1217, 29899, 8173, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 6132, 451, 788, 278, 378, 273, 29899, 434, 29946, 11303, 9522, 412, 7090, 304, 278, 1051, 310, 2322, 9522, 412, 8974, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29879, 742, 17411, 4993, 742, 3158, 2433, 4397, 742, 2731, 2433, 29879, 2863, 742, 1539, 485, 279, 2433, 9464, 742, 1371, 2433, 2528, 278, 6790, 3884, 408, 385, 5684, 2752, 310, 2048, 519, 3577, 9522, 5547, 313, 1552, 871, 8974, 3625, 491, 2322, 526, 278, 378, 273, 29899, 434, 29946, 11303, 9522, 412, 7090, 322, 278, 1857, 1985, 3884, 29897, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29877, 742, 17411, 3385, 742, 3158, 2433, 4397, 742, 2731, 2433, 6768, 742, 1539, 485, 279, 2433, 21738, 29954, 29901, 14094, 2725, 29922, 19143, 742, 1371, 2433, 10299, 1598, 3987, 304, 1209, 304, 3577, 9522, 5547, 746, 5214, 963, 313, 13221, 451, 6602, 10609, 10104, 29897, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 1792, 742, 2322, 29922, 23397, 29918, 11889, 29892, 1371, 2433, 2697, 278, 1404, 363, 278, 4240, 9741, 313, 4381, 1404, 338, 376, 8875, 1159, 4286, 4830, 29898, 23397, 29918, 11889, 876, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 9009, 742, 2322, 29922, 8516, 29892, 1539, 485, 279, 2433, 1525, 29924, 2891, 29923, 742, 1371, 2433, 17553, 278, 4240, 9741, 304, 278, 6790, 1281, 273, 7592, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29886, 742, 17411, 10185, 742, 2731, 2433, 10185, 742, 1539, 485, 279, 2433, 8618, 7724, 742, 2322, 29922, 8516, 29892, 19995, 29922, 13909, 27107, 29889, 1761, 24565, 1184, 5325, 3285, 1371, 2433, 8893, 9741, 773, 278, 6790, 1281, 273, 8722, 313, 4381, 29879, 304, 278, 8722, 363, 278, 3495, 7481, 322, 1556, 853, 6370, 10863, 11161, 1304, 304, 2189, 8722, 12623, 29897, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 5113, 742, 302, 5085, 2433, 29974, 742, 1371, 2433, 14459, 29898, 29879, 29897, 304, 2048, 29892, 297, 2845, 27085, 470, 27085, 1360, 16358, 3402, 313, 6550, 1598, 376, 497, 29908, 304, 2048, 599, 3625, 9741, 29897, 1495, 13, 12, 13, 12, 29937, 20969, 278, 19056, 1899, 29899, 1220, 6273, 13, 12, 5085, 353, 13812, 29889, 5510, 29918, 5085, 29898, 19218, 29897, 13, 12, 13, 12, 29937, 960, 263, 8722, 471, 451, 6790, 29892, 6416, 1627, 304, 278, 2322, 363, 278, 3495, 7481, 313, 272, 773, 278, 10035, 697, 565, 278, 2322, 1838, 29915, 29873, 1863, 29897, 13, 12, 361, 6389, 29889, 10185, 338, 6213, 29901, 13, 12, 12, 1457, 14373, 4592, 353, 20802, 27107, 29889, 10185, 2831, 8514, 21889, 29898, 12847, 29897, 13, 12, 12, 19206, 29943, 497, 1627, 353, 20802, 27107, 29889, 19206, 13909, 580, 13, 12, 12, 361, 16389, 4592, 297, 20802, 27107, 29889, 1761, 24565, 1184, 5325, 7295, 13, 12, 12, 12, 2158, 877, 15156, 2322, 8722, 363, 3495, 7481, 29850, 5038, 4286, 4830, 29898, 1457, 14373, 4592, 876, 13, 12, 12, 12, 5085, 29889, 10185, 353, 16389, 4592, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2158, 877, 22709, 29901, 20327, 1250, 304, 10035, 8722, 29850, 5038, 1363, 278, 8722, 29850, 5038, 947, 451, 1863, 29889, 4286, 4830, 29898, 19206, 29943, 497, 1627, 29892, 16389, 4592, 876, 13, 12, 12, 12, 2158, 877, 3492, 881, 1065, 421, 434, 29946, 378, 273, 5706, 29952, 304, 5706, 278, 3495, 7481, 8722, 363, 278, 1857, 10863, 11161, 29889, 1495, 13, 12, 12, 12, 5085, 29889, 10185, 353, 10035, 29943, 497, 1627, 13, 12, 13, 12, 29937, 4649, 29878, 2418, 278, 853, 6370, 10863, 1873, 1347, 363, 278, 6790, 1281, 273, 8722, 322, 671, 372, 408, 278, 8242, 13, 12, 12719, 353, 20802, 27107, 29889, 10185, 12412, 6594, 29898, 5085, 29889, 10185, 29897, 13, 12, 13, 12, 29937, 6204, 385, 4469, 29899, 311, 1026, 292, 13201, 3884, 304, 4808, 1749, 11404, 630, 9522, 412, 8974, 13, 12, 2541, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 408, 5694, 9170, 29901, 13, 12, 12, 13, 12, 12, 29937, 5953, 837, 457, 565, 591, 526, 3704, 278, 9522, 412, 7090, 3884, 297, 1749, 1051, 310, 2752, 17525, 13, 12, 12, 8173, 9170, 353, 830, 24044, 10408, 29889, 657, 10408, 9882, 580, 13, 12, 12, 4381, 29903, 2863, 353, 518, 359, 29889, 657, 29883, 9970, 580, 29962, 718, 9310, 8173, 9170, 29962, 565, 6389, 29889, 1217, 29918, 8173, 1275, 7700, 1683, 518, 2314, 13, 12, 12, 13, 12, 12, 29937, 960, 278, 9522, 412, 7090, 3884, 947, 451, 1863, 313, 375, 1474, 1363, 445, 338, 1749, 937, 2048, 511, 769, 2767, 372, 13, 12, 12, 361, 6389, 29889, 1217, 29918, 8173, 1275, 7700, 322, 4864, 29898, 8173, 9170, 29897, 1275, 7700, 29901, 13, 12, 12, 12, 5504, 29898, 12847, 29892, 1852, 29894, 29897, 13, 12, 12, 13, 12, 12, 29937, 20504, 403, 975, 1749, 2752, 17525, 322, 3509, 1749, 9522, 5547, 304, 278, 5694, 3884, 13, 12, 12, 29879, 2863, 353, 2322, 29903, 2863, 718, 313, 5085, 29889, 29879, 2863, 565, 6389, 29889, 29879, 2863, 338, 451, 6213, 1683, 518, 2314, 13, 12, 12, 1454, 2752, 297, 8974, 29901, 13, 12, 12, 12, 1454, 9522, 412, 297, 22310, 537, 29889, 1761, 16638, 1179, 797, 9170, 29898, 4993, 1125, 13, 12, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 12, 845, 4422, 29889, 8552, 8336, 29898, 7122, 29898, 4993, 29892, 9522, 412, 511, 5988, 29898, 7382, 9170, 29892, 9522, 412, 876, 13, 12, 12, 12, 12, 19499, 3497, 24217, 2392, 408, 321, 29901, 13, 12, 12, 12, 12, 12, 5527, 29176, 353, 2362, 3871, 29898, 710, 29898, 29872, 467, 5451, 877, 29901, 525, 9601, 29899, 29896, 1822, 17010, 877, 26732, 4907, 876, 13, 12, 12, 12, 12, 12, 22692, 24875, 2392, 877, 5527, 506, 1259, 2752, 17525, 17809, 363, 9522, 412, 6571, 4286, 4830, 29898, 5527, 29176, 876, 515, 6213, 13, 12, 12, 13, 12, 12, 29937, 6204, 1749, 3577, 12856, 13, 12, 12, 16409, 353, 22029, 5627, 29898, 7382, 9170, 29892, 6389, 29889, 1792, 29892, 8242, 29892, 6389, 29889, 10185, 29892, 6389, 29889, 276, 4282, 29892, 6389, 29889, 29881, 719, 29918, 3389, 29897, 13, 12, 12, 13, 12, 12, 29937, 10554, 278, 6790, 1051, 310, 9741, 29892, 3770, 1747, 6910, 408, 4312, 13, 12, 12, 8318, 353, 5159, 13, 12, 12, 1454, 1852, 297, 6389, 29889, 5113, 29901, 13, 12, 12, 12, 361, 1852, 29889, 13609, 580, 1275, 525, 497, 2396, 13, 12, 12, 12, 12, 8318, 29889, 21843, 29898, 1761, 4197, 16409, 29889, 1693, 1598, 4373, 342, 6594, 29898, 29886, 29897, 363, 282, 297, 12856, 29889, 16515, 16638, 1179, 12622, 13, 12, 12, 12, 23681, 525, 1360, 29915, 297, 1852, 29901, 13, 12, 12, 12, 12, 8318, 29889, 4397, 29898, 1191, 29889, 6506, 877, 1360, 742, 8207, 8785, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 8318, 29889, 4397, 29898, 16409, 29889, 1693, 1598, 4373, 342, 6594, 29898, 1191, 876, 13, 12, 12, 13, 12, 12, 29937, 27313, 10609, 10104, 322, 10272, 278, 2048, 1797, 363, 278, 9741, 13, 12, 12, 4282, 7514, 353, 12856, 29889, 26017, 8893, 7514, 29898, 8318, 29897, 13, 12, 12, 13, 12, 12, 29937, 1798, 1598, 393, 591, 526, 5214, 472, 3203, 697, 3577, 13, 12, 12, 361, 7431, 29898, 4282, 7514, 29897, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 2158, 877, 3782, 9741, 817, 304, 367, 4240, 29889, 4803, 278, 1192, 276, 4282, 7353, 304, 337, 4282, 5923, 9741, 29889, 1495, 13, 12, 12, 12, 2457, 13, 12, 12, 13, 12, 12, 29937, 13969, 278, 15712, 2048, 1797, 304, 278, 1404, 13, 12, 12, 9009, 29903, 3096, 861, 353, 525, 322, 20373, 304, 278, 7592, 29850, 5038, 4286, 4830, 29898, 5085, 29889, 9009, 29897, 565, 6389, 29889, 9009, 338, 451, 6213, 1683, 6629, 13, 12, 12, 2158, 28909, 29876, 1576, 1494, 9741, 674, 367, 4240, 29912, 6177, 4286, 4830, 29898, 9009, 29903, 3096, 861, 876, 13, 12, 12, 1454, 3577, 297, 2048, 7514, 29901, 13, 12, 12, 12, 2158, 28909, 29873, 29915, 718, 3577, 29897, 13, 12, 12, 13, 12, 12, 29937, 6212, 3456, 304, 2048, 278, 9741, 13, 12, 12, 16409, 29889, 4282, 16638, 1179, 29898, 4282, 7514, 29892, 6389, 29889, 6768, 565, 6389, 29889, 6768, 338, 451, 6213, 1683, 518, 2314, 13, 12, 12, 13, 12, 12, 29937, 960, 263, 7592, 756, 1063, 6790, 304, 6441, 278, 4240, 9741, 304, 29892, 4218, 304, 437, 577, 13, 12, 12, 361, 6389, 29889, 9009, 338, 451, 6213, 29901, 13, 12, 12, 12, 16409, 29889, 9009, 16638, 1179, 29898, 4282, 7514, 29892, 6389, 29889, 9009, 29897, 13, 2 ]
language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py
Xtuden-com/language
1,199
1727
<filename>language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py<gh_stars>1000+ # coding=utf-8 # Copyright 2018 The Google AI Language Team 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. # Lint as: python3 """Sentencize the raw wikitext103.""" import tensorflow.compat.v1 as tf app = tf.app flags = tf.flags gfile = tf.gfile logging = tf.logging flags.DEFINE_string("wiki103_raw", None, "Path to raw wikitext103 train corpus.") flags.DEFINE_string("output_path", None, "Path to output the processed dataset.") FLAGS = flags.FLAGS def main(_): with open(FLAGS.wiki103_raw, "r") as f: data = f.read().strip().split("\n") data = [x.split(" . ") for x in data if x.strip() and x.strip()[0] != "="] sentences = [] for para in data: for sent in para: sentences.append(sent + ".") data = "\n".join(sentences) data = data.replace(" @.@ ", ".").replace(" @-@ ", "-").replace(" ,", ",") data = data.replace(" \'", "\'").replace(" )", ")").replace("( ", "(") data = data.replace(" ;", ";") data = "\n".join([x for x in data.split("\n") if len(x.split()) > 3]) logging.info("length = %d", len(data.split("\n"))) with open(FLAGS.output_path, "w") as f: f.write(data) if __name__ == "__main__": app.run(main)
[ 1, 529, 9507, 29958, 11675, 29914, 2151, 29918, 1062, 13857, 29914, 1655, 284, 29918, 2151, 29918, 1990, 3709, 29914, 13239, 29914, 4594, 29896, 29900, 29941, 29918, 18616, 13640, 911, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29900, 29974, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29947, 450, 5087, 319, 29902, 17088, 8583, 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, 29937, 365, 524, 408, 29901, 3017, 29941, 13, 15945, 29908, 29903, 296, 13640, 911, 278, 10650, 281, 638, 568, 486, 29896, 29900, 29941, 1213, 15945, 13, 13, 5215, 26110, 29889, 12667, 29889, 29894, 29896, 408, 15886, 13, 13, 932, 353, 15886, 29889, 932, 13, 15764, 353, 15886, 29889, 15764, 13, 29887, 1445, 353, 15886, 29889, 29887, 1445, 13, 21027, 353, 15886, 29889, 21027, 13, 13, 15764, 29889, 24405, 8895, 29918, 1807, 703, 4594, 29896, 29900, 29941, 29918, 1610, 613, 6213, 29892, 13, 462, 1678, 376, 2605, 304, 10650, 281, 638, 568, 486, 29896, 29900, 29941, 7945, 1034, 13364, 23157, 13, 15764, 29889, 24405, 8895, 29918, 1807, 703, 4905, 29918, 2084, 613, 6213, 29892, 13, 462, 1678, 376, 2605, 304, 1962, 278, 19356, 8783, 23157, 13, 13, 18823, 10749, 353, 13449, 29889, 18823, 10749, 13, 13, 13, 1753, 1667, 7373, 1125, 13, 29871, 411, 1722, 29898, 18823, 10749, 29889, 4594, 29896, 29900, 29941, 29918, 1610, 29892, 376, 29878, 1159, 408, 285, 29901, 13, 1678, 848, 353, 285, 29889, 949, 2141, 17010, 2141, 5451, 14182, 29876, 1159, 13, 13, 29871, 848, 353, 518, 29916, 29889, 5451, 703, 869, 16521, 363, 921, 297, 848, 565, 921, 29889, 17010, 580, 322, 921, 29889, 17010, 580, 29961, 29900, 29962, 2804, 376, 543, 29962, 13, 13, 29871, 25260, 353, 5159, 13, 29871, 363, 1702, 297, 848, 29901, 13, 1678, 363, 2665, 297, 1702, 29901, 13, 418, 25260, 29889, 4397, 29898, 18616, 718, 11393, 1159, 13, 29871, 848, 353, 6634, 29876, 1642, 7122, 29898, 18616, 2063, 29897, 13, 13, 29871, 848, 353, 848, 29889, 6506, 703, 732, 21240, 9162, 376, 1213, 467, 6506, 703, 732, 29899, 29992, 9162, 11663, 2564, 6506, 703, 1919, 613, 9162, 1159, 13, 29871, 848, 353, 848, 29889, 6506, 703, 320, 29915, 613, 6634, 29915, 2564, 6506, 703, 1723, 613, 16521, 2564, 6506, 703, 29898, 9162, 376, 703, 29897, 13, 29871, 848, 353, 848, 29889, 6506, 703, 2056, 613, 12159, 1159, 13, 13, 29871, 848, 353, 6634, 29876, 1642, 7122, 4197, 29916, 363, 921, 297, 848, 29889, 5451, 14182, 29876, 1159, 565, 7431, 29898, 29916, 29889, 5451, 3101, 1405, 29871, 29941, 2314, 13, 13, 29871, 12183, 29889, 3888, 703, 2848, 353, 1273, 29881, 613, 7431, 29898, 1272, 29889, 5451, 14182, 29876, 29908, 4961, 13, 13, 29871, 411, 1722, 29898, 18823, 10749, 29889, 4905, 29918, 2084, 29892, 376, 29893, 1159, 408, 285, 29901, 13, 1678, 285, 29889, 3539, 29898, 1272, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29871, 623, 29889, 3389, 29898, 3396, 29897, 13, 2 ]
setup.py
codingjoe/codingjoes_new_package
0
192096
#!/usr/bin/env python from setuptools import setup setup(version_format='{tag}.dev{commits}')
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 14669, 29898, 3259, 29918, 4830, 2433, 29912, 4039, 1836, 3359, 29912, 2055, 1169, 29913, 1495, 13, 2 ]
StatusWindow.py
BlackXanthus/PyBirch5
0
35728
#### #Made reduntant in Alpha 0.4 # # As this provided no extra functionality from the Channel, and is, in essance, # simply a speciall channel, various additions were made to Channel.py # To perform the same function. This has meant less duplication of code. #### import sys, sip from PyQt5 import QtCore, QtGui #from pybirchMdiV4 import Ui_PyBirch #from IrcConnection import IrcConnection #from ServerOutputSorter import ServerOutputSorter from pybirchMessage import Ui_BirchMessageWindow from userInputSorter import UserInputSorter from TextString import TextString from NickListView import NickListView from time import strftime from struct import unpack import string try: from PyQt5.QtCore import QString except ImportError: QString = str class StatusWindow(QtGui.QMdiSubWindow): _channel = "" _nick = "" _button = "" __version__ = "Status v. 0.1" def __init__(self, my_channel, parent=None): self._channel=my_channel self._nick="" #Config will need to be passed in later, because of the order of #creation. #self.config=my_config #print "DEBUG-------->In Channel :"+_channel_ QtGui.QMdiSubWindow.__init__(self,parent) sip.delete(self.layout()) self.ui = Ui_BirchMessageWindow() self.ui.setupUi(self) # self.ui.setupUi(self) self.ui.label_ChanName.setText(self._channel) self.setWindowTitle(self._channel) #install the key event filter. self.ui.text_input.installEventFilter(self) #self._nicklist = NickListView() #self.ui.list_NickList.setModel(self._nicklist) # self.ui.setWindowTitle(_channel_) #Quick and Dirty hashing method. #--- May have problems with similarly-named channels. eg # test, tset, ttse and so on. MUST TEST (v0.1) #http://bytes.com/topic/python/answers/23620-string-ascii-values # def __hash__(self): # global _channel_ # return unpack('%sB' % len(value), value) def get_channel_name(self): return self._channel def append_channel_text(self,myString): myQString = QString(str(myString)) showTime = "True" #self.ui.editor_Window.append(myQString) #try: # showTime=self.config.get("Channel_Settings", "Time") #except: # self.config.add_section("Channel_Settings") # self.config.set("Channel_Settings","Time", "True") # showTime="True" if showTime=="True": current_time = strftime("%H:%M") myQString="["+current_time+"] "+myQString self.ui.editor_Window.insertHtml(myQString+"<br>") #This should stop the window from updating when scrolling #up and down through the channel! # if not self.ui.editor_Window.isHorizontalSliderPressed(): self.ui.editor_Window.moveCursor(11,False) del myQString def eventFilter(self, obj ,event): if event.type() == QtCore.QEvent.KeyPress and event.matches(QtGui.QKeySequence.InsertParagraphSeparator): # self.sendToServer() self.process_input_event() if event.type() == QtCore.QEvent.KeyPress and event.key() == QtCore.Qt.Key_Tab: self.process_tab_event() return True return False def process_tab_event(self): print("Processing Tab Event") #originalString = self.ui.text_input.text() #searchString = str(originalString.rsplit(None, 1)) #searchString = originalString.split(" ")[-1] #print(searchString) #resultString = self._nicklist.search_nick(searchString) #if resultString != "": #originalString=originalString.rsplit(" ", 1)[0] #if originalString.endswith(searchString): # originalString= originalString[:-len(searchString)] #originalString = originalString.rstrip(searchString) # if len(originalString) == 0: # self.ui.text_input.setText(originalString +resultString) # else: # self.ui.text_input.setText(originalString +" "+ resultString) def process_input_event(self): channelName=self._channel originalString = self.ui.text_input.text() textToSend = originalString displayText = textToSend uIS = UserInputSorter() ts = uIS.process_input(channelName, self._nick, originalString) self.ui.editor_Window.moveCursor(11,False) # # myTextToSwitch = textToSend.split(" ") # # if myTextToSwitch[0][0:1] == "/": # if myTextToSwitch[0] == "/msg": # #Note, this doesn't in any way work. # remainderIndex = textToSend.find(myTextToSwitch[1]) # textToSend = "PRIVMSG "+myTextToSwitch[1]+" "+textToSend[remainderIndex:] # displayText = "**Messaging "+myTextToSwitch[1]+textToSend[remainderIndex:] # else: # textToSend = str(textToSend[1:]) # displayText = "---"+str(textToSend) #remainderIndex=string.find(strServerOutput,":",2) # else: # textToSend = "PRIVMSG "+channelName+" :"+textToSend # displayText = "["+_nick_+"] "+originalString #try: # showTime=self.config.get("Channel_Settings", "Time") #except: # pass showTime = "True" self.emit(QtCore.SIGNAL("UserInput"),ts.get_original_string()) myDisplayString = ts.get_display_string() if showTime == "True": current_time = strftime("%H:%M") myDisplayString="["+current_time+"] "+myDisplayString self.ui.editor_Window.insertHtml(myDisplayString+"<br>") self.ui.text_input.setText("") def nick_update(self, my_new_nick): self._nick = my_new_nick def closeEvent(self, closeEvent): self.emit(QtCore.SIGNAL("Channel_Closed"),self._channel) closeEvent.accept(); print ("<StatusWindow : Close event> PANIC Mr Mannering!") def button_click(self): #sender = self.sender if self.isMinimized(): self.show() self.showNormal() else: self.showMinimized() self.hide() ### # While insert_nick currently works, the listWidget will need a QAbstractView in order to be able to remove # items. This will deal with @, +, and other standard modifiers of the channel. definately TODO! # # def insert_nick(self, ts): # #this is being done this way for future proofing # print ("<DEBUG>Channel.py:insert_nick", ts.get_message()) # for myNick in ts.get_message().split(): # myNickToAdd = myNick.replace(":","",1 ) # self._nicklist.insert_nick(myNickToAdd) # self.ui.listWidget.addItem(QtGui.QListWidgetItem(myNickToAdd)) # def remove_nick(self, ts): # print("<DEBUG>Channel.py:remove_nick"+self._channel+" :"+ts.get_nick()) # for myNick in ts.get_nick().split(): # myNickToRemove = myNick.replace(":", "", 1) # found = self._nicklist.remove_nick(myNickToRemove) # self.ui.listWidget.removeItemWidget(QtGui.QListWidgetItem(myNickToRemove)) # if(found): # self.append_channel_text(ts.get_display_string()) # def nick_mode_change(self, ts): # self._nicklist.changeStatus(ts.get_mode_user(), ts.get_mode_settings())
[ 1, 29871, 13, 4136, 13, 29937, 29924, 1943, 2654, 1657, 424, 297, 838, 2026, 29871, 29900, 29889, 29946, 13, 29937, 13, 29937, 1094, 445, 4944, 694, 4805, 9863, 515, 278, 17368, 29892, 322, 338, 29892, 297, 3686, 749, 29892, 13, 29937, 3763, 263, 961, 455, 497, 8242, 29892, 5164, 788, 2187, 892, 1754, 304, 17368, 29889, 2272, 13, 29937, 1763, 2189, 278, 1021, 740, 29889, 910, 756, 6839, 3109, 5141, 1414, 310, 775, 29889, 29871, 13, 4136, 13, 5215, 10876, 29892, 269, 666, 13, 3166, 10772, 17303, 29945, 1053, 14705, 9203, 29892, 14705, 28707, 29871, 13, 29937, 3166, 11451, 20397, 305, 29924, 6051, 29963, 29946, 1053, 501, 29875, 29918, 19737, 29933, 381, 305, 13, 29937, 3166, 306, 2214, 5350, 1053, 306, 2214, 5350, 13, 29937, 3166, 5656, 6466, 29903, 9555, 1053, 5656, 6466, 29903, 9555, 13, 3166, 11451, 20397, 305, 3728, 1053, 501, 29875, 29918, 29933, 381, 305, 3728, 5907, 13, 3166, 1404, 4290, 29903, 9555, 1053, 4911, 4290, 29903, 9555, 13, 3166, 3992, 1231, 1053, 3992, 1231, 13, 3166, 13853, 15660, 1053, 13853, 15660, 13, 3166, 931, 1053, 851, 615, 603, 13, 13, 3166, 2281, 1053, 443, 4058, 13, 5215, 1347, 13, 13, 2202, 29901, 13, 1678, 515, 10772, 17303, 29945, 29889, 17303, 9203, 1053, 660, 1231, 13, 19499, 16032, 2392, 29901, 13, 1678, 660, 1231, 353, 851, 13, 13, 1990, 16034, 5907, 29898, 17303, 28707, 29889, 29984, 29924, 6051, 4035, 5907, 1125, 13, 13, 12, 29918, 12719, 353, 5124, 13, 12, 29918, 19254, 353, 5124, 13, 12, 29918, 3092, 353, 5124, 13, 13, 12, 1649, 3259, 1649, 353, 376, 5709, 325, 29889, 29871, 29900, 29889, 29896, 29908, 12, 13, 12, 12, 13, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 590, 29918, 12719, 29892, 3847, 29922, 8516, 1125, 13, 12, 12, 13, 12, 12, 1311, 3032, 12719, 29922, 1357, 29918, 12719, 13, 12, 12, 1311, 3032, 19254, 13776, 13, 12, 12, 29937, 3991, 674, 817, 304, 367, 4502, 297, 2678, 29892, 1363, 310, 278, 1797, 310, 13, 12, 12, 29937, 1037, 362, 29889, 13, 12, 12, 29937, 1311, 29889, 2917, 29922, 1357, 29918, 2917, 13, 12, 12, 13, 12, 12, 29937, 2158, 376, 18525, 1378, 29958, 797, 17368, 584, 17969, 29918, 12719, 29918, 13, 13, 12, 12, 17303, 28707, 29889, 29984, 29924, 6051, 4035, 5907, 17255, 2344, 12035, 1311, 29892, 3560, 29897, 13, 13, 12, 12, 29879, 666, 29889, 8143, 29898, 1311, 29889, 2680, 3101, 13, 13, 12, 12, 1311, 29889, 1481, 353, 501, 29875, 29918, 29933, 381, 305, 3728, 5907, 580, 13, 13, 12, 12, 1311, 29889, 1481, 29889, 14669, 29965, 29875, 29898, 1311, 29897, 13, 13, 29937, 12, 12, 1311, 29889, 1481, 29889, 14669, 29965, 29875, 29898, 1311, 29897, 13, 12, 12, 13, 12, 12, 1311, 29889, 1481, 29889, 1643, 29918, 1451, 273, 1170, 29889, 12038, 29898, 1311, 3032, 12719, 29897, 13, 12, 13, 12, 12, 1311, 29889, 842, 5907, 7030, 29898, 1311, 3032, 12719, 29897, 13, 13, 13, 12, 12, 29937, 6252, 278, 1820, 1741, 4175, 29889, 13, 12, 12, 1311, 29889, 1481, 29889, 726, 29918, 2080, 29889, 6252, 2624, 5072, 29898, 1311, 29897, 13, 12, 12, 13, 12, 12, 29937, 1311, 3032, 19254, 1761, 353, 13853, 15660, 580, 13, 12, 12, 29937, 1311, 29889, 1481, 29889, 1761, 29918, 29940, 860, 1293, 29889, 842, 3195, 29898, 1311, 3032, 19254, 1761, 29897, 13, 13, 13, 12, 29937, 12, 1311, 29889, 1481, 29889, 842, 5907, 7030, 7373, 12719, 19925, 13, 12, 13, 12, 29937, 2182, 860, 322, 360, 13163, 756, 2790, 1158, 29889, 12, 13, 12, 29937, 5634, 2610, 505, 4828, 411, 22829, 29899, 17514, 18196, 29889, 8087, 13, 12, 29937, 1243, 29892, 260, 842, 29892, 260, 29873, 344, 322, 577, 373, 29889, 341, 17321, 17067, 1254, 313, 29894, 29900, 29889, 29896, 29897, 13, 12, 29937, 1124, 597, 13193, 29889, 510, 29914, 13010, 29914, 4691, 29914, 550, 17538, 29914, 29906, 29941, 29953, 29906, 29900, 29899, 1807, 29899, 294, 18869, 29899, 5975, 13, 418, 396, 29871, 822, 4770, 8568, 12035, 1311, 1125, 13, 29937, 12, 12, 10945, 903, 12719, 29918, 13, 29937, 12, 12, 2457, 443, 4058, 877, 29995, 29879, 29933, 29915, 1273, 7431, 29898, 1767, 511, 995, 29897, 13, 13, 12, 1753, 679, 29918, 12719, 29918, 978, 29898, 1311, 1125, 13, 12, 13, 12, 12, 2457, 1583, 3032, 12719, 13, 13, 13, 12, 1753, 9773, 29918, 12719, 29918, 726, 29898, 1311, 29892, 1357, 1231, 1125, 13, 12, 12, 1357, 29984, 1231, 353, 660, 1231, 29898, 710, 29898, 1357, 1231, 876, 13, 12, 12, 4294, 2481, 353, 376, 5574, 29908, 13, 12, 12, 29937, 1311, 29889, 1481, 29889, 15204, 29918, 5907, 29889, 4397, 29898, 1357, 29984, 1231, 29897, 13, 12, 12, 29937, 2202, 29901, 13, 12, 12, 29937, 12, 4294, 2481, 29922, 1311, 29889, 2917, 29889, 657, 703, 13599, 29918, 9585, 613, 376, 2481, 1159, 13, 12, 12, 29937, 19499, 29901, 13, 12, 12, 29937, 12, 1311, 29889, 2917, 29889, 1202, 29918, 2042, 703, 13599, 29918, 9585, 1159, 13, 12, 12, 29937, 12, 1311, 29889, 2917, 29889, 842, 703, 13599, 29918, 9585, 3284, 2481, 613, 376, 5574, 1159, 13, 12, 12, 29937, 12, 4294, 2481, 543, 5574, 29908, 13, 12, 12, 13, 12, 12, 361, 1510, 2481, 26359, 5574, 1115, 13, 12, 12, 12, 3784, 29918, 2230, 353, 851, 615, 603, 11702, 29950, 16664, 29924, 1159, 13, 12, 12, 12, 1357, 29984, 1231, 543, 3366, 29974, 3784, 29918, 2230, 29974, 3108, 15691, 1357, 29984, 1231, 13, 12, 12, 13, 12, 12, 1311, 29889, 1481, 29889, 15204, 29918, 5907, 29889, 7851, 10922, 29898, 1357, 29984, 1231, 13578, 29966, 1182, 29958, 1159, 13, 13, 12, 12, 29937, 4013, 881, 5040, 278, 3474, 515, 13271, 746, 23064, 12, 12, 12, 29937, 786, 322, 1623, 1549, 278, 8242, 29991, 13, 29937, 12, 12, 361, 451, 1583, 29889, 1481, 29889, 15204, 29918, 5907, 29889, 275, 24932, 16973, 1241, 24104, 7295, 13, 13, 12, 12, 1311, 29889, 1481, 29889, 15204, 29918, 5907, 29889, 11631, 19890, 29898, 29896, 29896, 29892, 8824, 29897, 13, 12, 12, 13, 12, 12, 6144, 590, 29984, 1231, 13, 12, 12, 13, 13, 13, 12, 1753, 1741, 5072, 29898, 1311, 29892, 5446, 1919, 3696, 1125, 13, 12, 12, 361, 1741, 29889, 1853, 580, 1275, 14705, 9203, 29889, 29984, 2624, 29889, 2558, 10923, 322, 1741, 29889, 20317, 29898, 17303, 28707, 29889, 29984, 2558, 20529, 29889, 17491, 2177, 9895, 2008, 17954, 1125, 13, 12, 12, 539, 396, 1583, 29889, 6717, 1762, 6004, 580, 13, 12, 12, 12, 1311, 29889, 5014, 29918, 2080, 29918, 3696, 580, 13, 12, 13, 12, 12, 13, 12, 12, 361, 1741, 29889, 1853, 580, 1275, 14705, 9203, 29889, 29984, 2624, 29889, 2558, 10923, 322, 1741, 29889, 1989, 580, 1275, 14705, 9203, 29889, 17303, 29889, 2558, 29918, 8863, 29901, 13, 12, 12, 12, 1311, 29889, 5014, 29918, 3891, 29918, 3696, 580, 13, 12, 12, 12, 13, 12, 12, 12, 2457, 5852, 13, 13, 12, 12, 2457, 7700, 13, 13, 12, 1753, 1889, 29918, 3891, 29918, 3696, 29898, 1311, 1125, 13, 12, 12, 13, 12, 12, 2158, 703, 7032, 292, 11090, 6864, 1159, 13, 12, 12, 13, 12, 12, 29937, 13492, 1231, 353, 1583, 29889, 1481, 29889, 726, 29918, 2080, 29889, 726, 580, 13, 12, 12, 13, 12, 12, 29937, 4478, 1231, 353, 851, 29898, 13492, 1231, 29889, 2288, 2830, 29898, 8516, 29892, 29871, 29896, 876, 13, 12, 12, 29937, 4478, 1231, 353, 2441, 1231, 29889, 5451, 703, 376, 9601, 29899, 29896, 29962, 13, 12, 12, 13, 12, 12, 29937, 2158, 29898, 4478, 1231, 29897, 13, 12, 12, 13, 12, 12, 29937, 2914, 1231, 353, 1583, 3032, 19254, 1761, 29889, 4478, 29918, 19254, 29898, 4478, 1231, 29897, 13, 12, 12, 13, 12, 12, 29937, 361, 1121, 1231, 2804, 376, 1115, 13, 12, 12, 12, 29937, 13492, 1231, 29922, 13492, 1231, 29889, 2288, 2830, 703, 9162, 29871, 29896, 9601, 29900, 29962, 13, 12, 12, 12, 13, 12, 12, 12, 29937, 361, 2441, 1231, 29889, 1975, 2541, 29898, 4478, 1231, 1125, 13, 12, 12, 29937, 12, 12, 13492, 1231, 29922, 2441, 1231, 7503, 29899, 2435, 29898, 4478, 1231, 4638, 13, 12, 12, 12, 13, 12, 12, 12, 29937, 13492, 1231, 353, 2441, 1231, 29889, 29878, 17010, 29898, 4478, 1231, 29897, 13, 12, 12, 12, 13, 12, 12, 29937, 12, 361, 7431, 29898, 13492, 1231, 29897, 1275, 29871, 29900, 29901, 13, 12, 12, 29937, 12, 12, 1311, 29889, 1481, 29889, 726, 29918, 2080, 29889, 12038, 29898, 13492, 1231, 718, 2914, 1231, 29897, 13, 12, 12, 29937, 12, 2870, 29901, 13, 12, 12, 29937, 12, 12, 1311, 29889, 1481, 29889, 726, 29918, 2080, 29889, 12038, 29898, 13492, 1231, 718, 29908, 15691, 1121, 1231, 29897, 13, 13, 12, 1753, 1889, 29918, 2080, 29918, 3696, 29898, 1311, 1125, 13, 13, 13, 12, 12, 12719, 1170, 29922, 1311, 3032, 12719, 13, 13, 12, 12, 13492, 1231, 353, 1583, 29889, 1481, 29889, 726, 29918, 2080, 29889, 726, 580, 13, 13, 12, 12, 726, 1762, 12600, 353, 2441, 1231, 13, 12, 12, 4990, 1626, 353, 1426, 1762, 12600, 13, 13, 12, 12, 29884, 3235, 353, 4911, 4290, 29903, 9555, 580, 13, 13, 12, 12, 1372, 353, 318, 3235, 29889, 5014, 29918, 2080, 29898, 12719, 1170, 29892, 1583, 3032, 19254, 29892, 2441, 1231, 29897, 13, 12, 12, 1311, 29889, 1481, 29889, 15204, 29918, 5907, 29889, 11631, 19890, 29898, 29896, 29896, 29892, 8824, 29897, 13, 29937, 13, 29937, 12, 12, 1357, 1626, 1762, 24995, 353, 1426, 1762, 12600, 29889, 5451, 703, 16521, 13, 29937, 13, 29937, 12, 12, 361, 590, 1626, 1762, 24995, 29961, 29900, 3816, 29900, 29901, 29896, 29962, 1275, 5591, 1115, 13, 29937, 12, 12, 12, 361, 590, 1626, 1762, 24995, 29961, 29900, 29962, 1275, 5591, 7645, 1115, 13, 29937, 12, 12, 12, 4706, 396, 9842, 29892, 445, 1838, 29915, 29873, 297, 738, 982, 664, 29889, 13, 29937, 12, 12, 12, 12, 1745, 475, 672, 3220, 353, 1426, 1762, 12600, 29889, 2886, 29898, 1357, 1626, 1762, 24995, 29961, 29896, 2314, 13, 29937, 12, 12, 12, 12, 726, 1762, 12600, 353, 376, 29829, 29963, 4345, 29954, 15691, 1357, 1626, 1762, 24995, 29961, 29896, 10062, 29908, 15691, 726, 1762, 12600, 29961, 1745, 475, 672, 3220, 17531, 13, 29937, 12, 12, 12, 12, 4990, 1626, 353, 376, 1068, 19058, 6751, 15691, 1357, 1626, 1762, 24995, 29961, 29896, 10062, 726, 1762, 12600, 29961, 1745, 475, 672, 3220, 17531, 13, 29937, 12, 12, 12, 2870, 29901, 13, 29937, 12, 12, 12, 12, 726, 1762, 12600, 353, 851, 29898, 726, 1762, 12600, 29961, 29896, 29901, 2314, 13, 29937, 12, 12, 12, 12, 4990, 1626, 353, 376, 5634, 17969, 710, 29898, 726, 1762, 12600, 29897, 13, 29937, 1745, 475, 672, 3220, 29922, 1807, 29889, 2886, 29898, 710, 6004, 6466, 29892, 1115, 613, 29906, 29897, 13, 29937, 12, 12, 2870, 29901, 13, 29937, 12, 12, 12, 726, 1762, 12600, 353, 376, 29829, 29963, 4345, 29954, 15691, 12719, 1170, 13578, 584, 17969, 726, 1762, 12600, 13, 29937, 12, 12, 12, 4990, 1626, 353, 376, 3366, 29974, 29918, 19254, 28842, 3108, 15691, 13492, 1231, 13, 13, 12, 12, 29937, 2202, 29901, 13, 12, 12, 29937, 12, 4294, 2481, 29922, 1311, 29889, 2917, 29889, 657, 703, 13599, 29918, 9585, 613, 376, 2481, 1159, 13, 12, 12, 29937, 19499, 29901, 13, 12, 12, 29937, 12, 3364, 13, 13, 12, 12, 4294, 2481, 353, 376, 5574, 29908, 13, 13, 13, 12, 12, 1311, 29889, 21976, 29898, 17303, 9203, 29889, 5425, 20728, 1964, 703, 2659, 4290, 4968, 1372, 29889, 657, 29918, 13492, 29918, 1807, 3101, 13, 12, 12, 13, 12, 12, 1357, 9323, 1231, 353, 18696, 29889, 657, 29918, 4990, 29918, 1807, 580, 13, 12, 12, 13, 12, 12, 361, 1510, 2481, 1275, 376, 5574, 1115, 13, 12, 12, 12, 3784, 29918, 2230, 353, 851, 615, 603, 11702, 29950, 16664, 29924, 1159, 13, 12, 12, 12, 1357, 9323, 1231, 543, 3366, 29974, 3784, 29918, 2230, 29974, 3108, 15691, 1357, 9323, 1231, 13, 12, 12, 12, 13, 12, 12, 1311, 29889, 1481, 29889, 15204, 29918, 5907, 29889, 7851, 10922, 29898, 1357, 9323, 1231, 13578, 29966, 1182, 29958, 1159, 13, 12, 12, 1311, 29889, 1481, 29889, 726, 29918, 2080, 29889, 12038, 703, 1159, 13, 13, 13, 12, 1753, 25985, 29918, 5504, 29898, 1311, 29892, 590, 29918, 1482, 29918, 19254, 1125, 13, 12, 12, 13, 12, 12, 1311, 3032, 19254, 353, 590, 29918, 1482, 29918, 19254, 13, 13, 13, 12, 1753, 3802, 2624, 29898, 1311, 29892, 3802, 2624, 1125, 13, 13, 12, 12, 1311, 29889, 21976, 29898, 17303, 9203, 29889, 5425, 20728, 1964, 703, 13599, 29918, 6821, 2662, 4968, 1311, 3032, 12719, 29897, 13, 12, 12, 5358, 2624, 29889, 16044, 890, 13, 12, 12, 2158, 4852, 29966, 5709, 5907, 584, 23186, 1741, 29958, 349, 2190, 2965, 3237, 7908, 3241, 29991, 1159, 13, 13, 12, 1753, 2826, 29918, 3808, 29898, 1311, 1125, 13, 12, 12, 29937, 15452, 353, 1583, 29889, 15452, 13, 12, 12, 361, 1583, 29889, 275, 8140, 326, 1891, 7295, 13, 12, 12, 12, 1311, 29889, 4294, 580, 13, 12, 12, 12, 1311, 29889, 4294, 19077, 580, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 1311, 29889, 4294, 8140, 326, 1891, 580, 13, 12, 12, 12, 1311, 29889, 11458, 580, 13, 13, 2277, 29937, 13, 29937, 5806, 4635, 29918, 19254, 5279, 1736, 29892, 278, 1051, 8801, 674, 817, 263, 660, 9118, 1043, 297, 1797, 304, 367, 2221, 304, 3349, 13, 29937, 4452, 29889, 910, 674, 5376, 411, 732, 29892, 718, 29892, 322, 916, 3918, 878, 14903, 310, 278, 8242, 29889, 7403, 2486, 14402, 29991, 13, 29937, 13, 29937, 12, 1753, 4635, 29918, 19254, 29898, 1311, 29892, 18696, 1125, 13, 29937, 12, 12, 29937, 1366, 338, 1641, 2309, 445, 982, 363, 5434, 5296, 292, 13, 29937, 12, 12, 2158, 4852, 29966, 18525, 29958, 13599, 29889, 2272, 29901, 7851, 29918, 19254, 613, 18696, 29889, 657, 29918, 4906, 3101, 13, 29937, 12, 12, 1454, 590, 29940, 860, 297, 18696, 29889, 657, 29918, 4906, 2141, 5451, 7295, 13, 29937, 12, 12, 12, 1357, 29940, 860, 1762, 2528, 353, 590, 29940, 860, 29889, 6506, 703, 29901, 3284, 613, 29896, 1723, 13, 29937, 12, 12, 12, 1311, 3032, 19254, 1761, 29889, 7851, 29918, 19254, 29898, 1357, 29940, 860, 1762, 2528, 29897, 13, 12, 12, 29937, 12, 1311, 29889, 1481, 29889, 1761, 8801, 29889, 1202, 2001, 29898, 17303, 28707, 29889, 29984, 1293, 8801, 2001, 29898, 1357, 29940, 860, 1762, 2528, 876, 13, 12, 12, 13, 12, 12, 13, 29937, 12, 1753, 3349, 29918, 19254, 29898, 1311, 29892, 18696, 1125, 13, 29937, 12, 12, 2158, 28945, 18525, 29958, 13599, 29889, 2272, 29901, 5992, 29918, 19254, 17969, 1311, 3032, 12719, 13578, 584, 17969, 1372, 29889, 657, 29918, 19254, 3101, 13, 29937, 12, 12, 1454, 590, 29940, 860, 297, 18696, 29889, 657, 29918, 19254, 2141, 5451, 7295, 13, 29937, 12, 12, 12, 1357, 29940, 860, 1762, 15941, 353, 590, 29940, 860, 29889, 6506, 703, 29901, 613, 12633, 29871, 29896, 29897, 13, 29937, 12, 12, 12, 11940, 353, 1583, 3032, 19254, 1761, 29889, 5992, 29918, 19254, 29898, 1357, 29940, 860, 1762, 15941, 29897, 13, 12, 12, 29937, 12, 1311, 29889, 1481, 29889, 1761, 8801, 29889, 5992, 2001, 8801, 29898, 17303, 28707, 29889, 29984, 1293, 8801, 2001, 29898, 1357, 29940, 860, 1762, 15941, 876, 13, 29937, 12, 12, 361, 29898, 11940, 1125, 13, 29937, 12, 12, 12, 1311, 29889, 4397, 29918, 12719, 29918, 726, 29898, 1372, 29889, 657, 29918, 4990, 29918, 1807, 3101, 13, 13, 29937, 12, 1753, 25985, 29918, 8513, 29918, 3167, 29898, 1311, 29892, 18696, 1125, 13, 29937, 12, 12, 1311, 3032, 19254, 1761, 29889, 3167, 5709, 29898, 1372, 29889, 657, 29918, 8513, 29918, 1792, 3285, 18696, 29889, 657, 29918, 8513, 29918, 11027, 3101, 13, 2 ]
zerver/lib/timestamp.py
Supermanu/zulip
0
107404
<gh_stars>0 from __future__ import absolute_import import datetime import calendar from django.utils.timezone import utc as timezone_utc def floor_to_hour(dt): # type: (datetime.datetime) -> datetime.datetime return datetime.datetime(*dt.timetuple()[:4]) \ .replace(tzinfo=dt.tzinfo) def floor_to_day(dt): # type: (datetime.datetime) -> datetime.datetime return datetime.datetime(*dt.timetuple()[:3]) \ .replace(tzinfo=dt.tzinfo) def ceiling_to_hour(dt): # type: (datetime.datetime) -> datetime.datetime floor = floor_to_hour(dt) if floor == dt: return floor return floor + datetime.timedelta(hours=1) def ceiling_to_day(dt): # type: (datetime.datetime) -> datetime.datetime floor = floor_to_day(dt) if floor == dt: return floor return floor + datetime.timedelta(days=1) def timestamp_to_datetime(timestamp): # type: (float) -> datetime.datetime return datetime.datetime.fromtimestamp(float(timestamp), tz=timezone_utc) class TimezoneNotUTCException(Exception): pass def datetime_to_timestamp(dt): # type: (datetime.datetime) -> int if dt.tzinfo is None or dt.tzinfo.utcoffset(dt) != timezone_utc.utcoffset(dt): raise TimezoneNotUTCException("Datetime %s to be converted does not have a UTC timezone." % (dt,)) return calendar.timegm(dt.timetuple())
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 13, 5215, 12865, 13, 5215, 17684, 13, 3166, 9557, 29889, 13239, 29889, 2230, 8028, 1053, 3477, 29883, 408, 29431, 29918, 329, 29883, 13, 13, 1753, 11904, 29918, 517, 29918, 18721, 29898, 6008, 1125, 13, 1678, 396, 1134, 29901, 313, 12673, 29889, 12673, 29897, 1599, 12865, 29889, 12673, 13, 1678, 736, 12865, 29889, 12673, 10456, 6008, 29889, 9346, 24120, 552, 580, 7503, 29946, 2314, 320, 13, 462, 259, 869, 6506, 29898, 17559, 3888, 29922, 6008, 29889, 17559, 3888, 29897, 13, 13, 1753, 11904, 29918, 517, 29918, 3250, 29898, 6008, 1125, 13, 1678, 396, 1134, 29901, 313, 12673, 29889, 12673, 29897, 1599, 12865, 29889, 12673, 13, 1678, 736, 12865, 29889, 12673, 10456, 6008, 29889, 9346, 24120, 552, 580, 7503, 29941, 2314, 320, 13, 462, 259, 869, 6506, 29898, 17559, 3888, 29922, 6008, 29889, 17559, 3888, 29897, 13, 13, 1753, 2257, 6504, 29918, 517, 29918, 18721, 29898, 6008, 1125, 13, 1678, 396, 1134, 29901, 313, 12673, 29889, 12673, 29897, 1599, 12865, 29889, 12673, 13, 1678, 11904, 353, 11904, 29918, 517, 29918, 18721, 29898, 6008, 29897, 13, 1678, 565, 11904, 1275, 11636, 29901, 13, 4706, 736, 11904, 13, 1678, 736, 11904, 718, 12865, 29889, 9346, 287, 2554, 29898, 29882, 2470, 29922, 29896, 29897, 13, 13, 1753, 2257, 6504, 29918, 517, 29918, 3250, 29898, 6008, 1125, 13, 1678, 396, 1134, 29901, 313, 12673, 29889, 12673, 29897, 1599, 12865, 29889, 12673, 13, 1678, 11904, 353, 11904, 29918, 517, 29918, 3250, 29898, 6008, 29897, 13, 1678, 565, 11904, 1275, 11636, 29901, 13, 4706, 736, 11904, 13, 1678, 736, 11904, 718, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 29896, 29897, 13, 13, 1753, 14334, 29918, 517, 29918, 12673, 29898, 16394, 1125, 13, 1678, 396, 1134, 29901, 313, 7411, 29897, 1599, 12865, 29889, 12673, 13, 1678, 736, 12865, 29889, 12673, 29889, 3166, 16394, 29898, 7411, 29898, 16394, 511, 260, 29920, 29922, 2230, 8028, 29918, 329, 29883, 29897, 13, 13, 1990, 5974, 8028, 3664, 26913, 2451, 29898, 2451, 1125, 13, 1678, 1209, 13, 13, 1753, 12865, 29918, 517, 29918, 16394, 29898, 6008, 1125, 13, 1678, 396, 1134, 29901, 313, 12673, 29889, 12673, 29897, 1599, 938, 13, 1678, 565, 11636, 29889, 17559, 3888, 338, 6213, 470, 11636, 29889, 17559, 3888, 29889, 329, 1111, 600, 842, 29898, 6008, 29897, 2804, 29431, 29918, 329, 29883, 29889, 329, 1111, 600, 842, 29898, 6008, 1125, 13, 4706, 12020, 5974, 8028, 3664, 26913, 2451, 703, 16390, 5410, 1273, 29879, 304, 367, 11543, 947, 451, 505, 263, 17998, 29431, 1213, 1273, 313, 6008, 29892, 876, 13, 1678, 736, 17684, 29889, 9346, 387, 29885, 29898, 6008, 29889, 9346, 24120, 552, 3101, 13, 2 ]
download.py
reed-hackathon-2022/mc-bot
1
30722
<gh_stars>1-10 import io from google.oauth2.credentials import Credentials from googleapiclient.discovery import build from googleapiclient.http import MediaIoBaseDownload from google.oauth2 import service_account from oauth2client.service_account import ServiceAccountCredentials SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'] def get_drive_service(): creds = Credentials.from_authorized_user_file('googletoken.json') if not creds or not creds.valid: creds = ServiceAccountCredentials.from_json_keyfile_dict('serviceaccountcreds.json', scopes=SCOPES) return build('drive', 'v3', credentials=creds) def fetch_document(): drive_service = get_drive_service() file_id = "1s0S4oau1GuJSrzaFhYHfLLq0KRliO4rG2uerNHpXRCk" request = drive_service.files().export_media( fileId=file_id, mimeType='text/plain' ) fh = io.StringIO() downloader = MediaIoBaseDownload(fh, request) done = False while not done: status, done = downloader.next_chunk() print(f"Download status: {status :%}%") drive_service.close() return fh.getvalue()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 12013, 13, 13, 3166, 5386, 29889, 23106, 29906, 29889, 11944, 9409, 1053, 24596, 9409, 13, 3166, 5386, 481, 293, 1593, 29889, 2218, 11911, 29891, 1053, 2048, 13, 3166, 5386, 481, 293, 1593, 29889, 1124, 1053, 8213, 29902, 29877, 5160, 22954, 13, 3166, 5386, 29889, 23106, 29906, 1053, 2669, 29918, 10149, 13, 3166, 288, 5150, 29906, 4645, 29889, 5509, 29918, 10149, 1053, 6692, 10601, 28037, 13, 13, 29903, 3217, 29925, 2890, 353, 6024, 991, 597, 1636, 29889, 15947, 29889, 510, 29914, 5150, 29914, 21594, 29889, 19635, 29889, 949, 6194, 2033, 13, 13, 13, 1753, 679, 29918, 21594, 29918, 5509, 7295, 13, 1678, 907, 6289, 353, 24596, 9409, 29889, 3166, 29918, 8921, 1891, 29918, 1792, 29918, 1445, 877, 3608, 6979, 29889, 3126, 1495, 13, 1678, 565, 451, 907, 6289, 470, 451, 907, 6289, 29889, 3084, 29901, 13, 4706, 907, 6289, 353, 6692, 10601, 28037, 29889, 3166, 29918, 3126, 29918, 1989, 1445, 29918, 8977, 877, 5509, 10149, 1037, 6289, 29889, 3126, 742, 16505, 267, 29922, 29903, 3217, 29925, 2890, 29897, 13, 1678, 736, 2048, 877, 21594, 742, 525, 29894, 29941, 742, 16140, 29922, 1037, 6289, 29897, 13, 13, 13, 1753, 6699, 29918, 3225, 7295, 13, 1678, 7899, 29918, 5509, 353, 679, 29918, 21594, 29918, 5509, 580, 13, 1678, 934, 29918, 333, 353, 376, 29896, 29879, 29900, 29903, 29946, 29877, 585, 29896, 9485, 8700, 29878, 1362, 29943, 29882, 29979, 29950, 29888, 2208, 29939, 29900, 29968, 29934, 492, 29949, 29946, 29878, 29954, 29906, 2853, 29940, 29950, 29886, 29990, 10363, 29895, 29908, 13, 1678, 2009, 353, 7899, 29918, 5509, 29889, 5325, 2141, 15843, 29918, 9799, 29898, 13, 4706, 934, 1204, 29922, 1445, 29918, 333, 29892, 286, 603, 1542, 2433, 726, 29914, 24595, 29915, 13, 1678, 1723, 13, 1678, 285, 29882, 353, 12013, 29889, 1231, 5971, 580, 13, 1678, 5142, 261, 353, 8213, 29902, 29877, 5160, 22954, 29898, 29888, 29882, 29892, 2009, 29897, 13, 1678, 2309, 353, 7700, 13, 1678, 1550, 451, 2309, 29901, 13, 4706, 4660, 29892, 2309, 353, 5142, 261, 29889, 4622, 29918, 29812, 580, 13, 4706, 1596, 29898, 29888, 29908, 22954, 4660, 29901, 426, 4882, 584, 29995, 10560, 1159, 13, 1678, 7899, 29918, 5509, 29889, 5358, 580, 13, 1678, 736, 285, 29882, 29889, 657, 1767, 580, 13, 2 ]
src/anim.py
JovialKnoll/monsters
2
18914
<gh_stars>1-10 import pygame.mixer from vec2d import Vec2d from saveable import Saveable class Anim(Saveable): __slots__ = ( 'func', 'time', 'pos', 'sound', 'positional_sound', ) def __init__(self, func: str, time: int, x_or_pair, y=None, sound: pygame.mixer.Sound = None, positional_sound: bool = False): self.func = func self.time = time self.pos = Vec2d(x_or_pair, y) self.sound = sound self.positional_sound = positional_sound def save(self): # no sound right now, sorry # if we need it, either start passing sounds as paths # or don't save when there are pending Anims return self.func, self.time, self.pos @classmethod def load(cls, save_data): return cls(*save_data)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 22028, 29889, 28084, 261, 13, 13, 3166, 9649, 29906, 29881, 1053, 26393, 29906, 29881, 13, 3166, 4078, 519, 1053, 16913, 519, 13, 13, 13, 1990, 24980, 29898, 11371, 519, 1125, 13, 1678, 4770, 2536, 1862, 1649, 353, 313, 13, 4706, 525, 9891, 742, 13, 4706, 525, 2230, 742, 13, 4706, 525, 1066, 742, 13, 4706, 525, 29802, 742, 13, 4706, 525, 1066, 3245, 29918, 29802, 742, 13, 1678, 1723, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3653, 29901, 851, 29892, 931, 29901, 938, 29892, 921, 29918, 272, 29918, 18784, 29892, 343, 29922, 8516, 29892, 13, 462, 6047, 29901, 22028, 29889, 28084, 261, 29889, 29456, 353, 6213, 29892, 2602, 284, 29918, 29802, 29901, 6120, 353, 7700, 1125, 13, 4706, 1583, 29889, 9891, 353, 3653, 13, 4706, 1583, 29889, 2230, 353, 931, 13, 4706, 1583, 29889, 1066, 353, 26393, 29906, 29881, 29898, 29916, 29918, 272, 29918, 18784, 29892, 343, 29897, 13, 4706, 1583, 29889, 29802, 353, 6047, 13, 4706, 1583, 29889, 1066, 3245, 29918, 29802, 353, 2602, 284, 29918, 29802, 13, 13, 1678, 822, 4078, 29898, 1311, 1125, 13, 4706, 396, 694, 6047, 1492, 1286, 29892, 7423, 13, 4706, 396, 565, 591, 817, 372, 29892, 2845, 1369, 6819, 10083, 408, 10898, 13, 4706, 396, 470, 1016, 29915, 29873, 4078, 746, 727, 526, 28235, 530, 9893, 13, 4706, 736, 1583, 29889, 9891, 29892, 1583, 29889, 2230, 29892, 1583, 29889, 1066, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2254, 29898, 25932, 29892, 4078, 29918, 1272, 1125, 13, 4706, 736, 1067, 29879, 10456, 7620, 29918, 1272, 29897, 13, 2 ]
sketches/aquarium/aquarium.pyde
kantel/processingpy
4
153845
from fish import Fish WIDTH = 640 HEIGHT = 416 NFISHES = 15 # Anzahl der Fische FPS = 60 fishes = [] def setup(): global bg size(WIDTH, HEIGHT) this.surface.setTitle(u"<NAME>, bonbonbuntes Aquarium") bg = loadImage("background.png") for _ in range(NFISHES): fishes.append(Fish()) frameRate(FPS) def draw(): background(49, 197, 224) # Himmelblau image(bg, 0, 0) for fish in fishes: fish.show() fish.update()
[ 1, 515, 9427, 1053, 12030, 13, 13, 22574, 353, 29871, 29953, 29946, 29900, 13, 9606, 22530, 353, 29871, 29946, 29896, 29953, 13, 22498, 3235, 29950, 2890, 353, 29871, 29896, 29945, 29871, 396, 530, 17301, 589, 383, 2010, 13, 29943, 7024, 353, 29871, 29953, 29900, 13, 13, 15161, 267, 353, 5159, 13, 13, 1753, 6230, 7295, 13, 1678, 5534, 25989, 13, 1678, 2159, 29898, 22574, 29892, 17714, 22530, 29897, 13, 1678, 445, 29889, 7610, 2161, 29889, 842, 7030, 29898, 29884, 29908, 29966, 5813, 10202, 10814, 6718, 29890, 1657, 267, 16020, 22826, 1159, 13, 1678, 25989, 353, 2254, 2940, 703, 7042, 29889, 2732, 1159, 13, 1678, 363, 903, 297, 3464, 29898, 22498, 3235, 29950, 2890, 1125, 13, 4706, 9427, 267, 29889, 4397, 29898, 29943, 728, 3101, 13, 1678, 3515, 19907, 29898, 29943, 7024, 29897, 13, 268, 13, 13, 1753, 4216, 7295, 13, 1678, 3239, 29898, 29946, 29929, 29892, 29871, 29896, 29929, 29955, 29892, 29871, 29906, 29906, 29946, 29897, 396, 379, 6727, 295, 17530, 29884, 13, 1678, 1967, 29898, 16264, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 1678, 363, 9427, 297, 9427, 267, 29901, 13, 4706, 9427, 29889, 4294, 580, 13, 4706, 9427, 29889, 5504, 580, 13, 2 ]
array/arrayBasicprogram.py
abegpatel/Array-Practice-Programs
1
50115
<filename>array/arrayBasicprogram.py # -*- coding: utf-8 -*- """ Created on Wed Mar 24 22:12:02 2021 @author: Abeg """ #all symmetric pair of an array def symmetricpair(pairs): s=set() for (x,y) in pairs: s.add((x,y)) if (y,x) in s: print((x,y),"|",((y,x))) pairs=[(11,20),(30,40),(5,10),(40,30),(10,5)] print(symmetricpair(pairs),end="") #repeating element n=int(input("enter the size")) arr=[] for i in range(0,n): e=int(input()) arr.append(e) x=list(dict.fromkeys(arr)) for i in x: if(arr.count(i)>1): print(i) #non-repeating element n=int(input("enter the size")) arr=[] for i in range(0,n): e=int(input()) arr.append(e) x=list(dict.fromkeys(arr)) for i in x: if(arr.count(i)==1): print(i) #no of even element and odd elemnet in an array arr=[] n=int(input()) count1=0 count2=0 for i in range(n): e=int(input()) arr.append(e) for i in range(n): if(arr[i]%2==0): count1+=1 else: count2+=1 print("no of even",count1) print("no of odd is",count2) #finding min scalarproduct of two vector arr1=[] arr2=[] n=int(input("size of the array")) for i in range(n): e=int(input()) arr1.append(e) for i in range(n): e=int(input()) arr2.append(e) list=() arr1.sort() arr2.sort(reverse=True) sum=0 for i in range(0,n): sum=sum+arr1[i]*arr2[i] print(sum) #minimum abs difference of given array arr=[5,10,1,4,8,7] n=len(arr) sum=0 arr.sort() sum=sum+abs(arr[0]-arr[1]) sum+=abs(arr[n-1]-arr[n-2]) for i in range(1,n-1): sum+=min(abs(arr[i]-arr[i-1]),abs(arr[i]-arr[i+1])) print(sum) #finding max scalarproduct of two vector arr1=[] arr2=[] n=int(input("size of the array")) for i in range(n): e=int(input()) arr1.append(e) for i in range(n): e=int(input()) arr2.append(e) list=() arr1.sort() arr2.sort() sum=0 for i in range(0,n): sum=sum+arr1[i]*arr2[i] print(sum) # Function to return maximum product of a sublist of given list def maxProduct(A): max_ending = min_ending = 0 max_so_far = 0 for i in A: temp = max_ending max_ending = max(i, max(i * max_ending, i * min_ending)) min_ending = min(i, min(i * temp, i * min_ending)) max_so_far = max(max_so_far, max_ending) return max_so_far if __name__ == '__main__': A = [6,-10,-3,0,5] print("The maximum product of a sublist is", maxProduct(A)) #check frequency of each char n=int(input("enter the size")) arr=[] for i in range(0,n): e=int(input()) arr.append(e) x=list(dict.fromkeys(arr)) for i in x: print("{}occours {} time".format(i,arr.count(i))) #removing duplicate element prom an array n=int(input("enter the size")) arr=[] for i in range(0,n): e=int(input()) arr.append(e) x=list(dict.fromkeys(arr)) print(x) #distinctelement n=int(input("enter the size")) arr=[] for i in range(0,n): e=int(input()) arr.append(e) x=list(dict.fromkeys(arr)) print(x) print(len(x)) #ARR is disjoint or not def disjoint(arr1,arr2): for i in range(0,len(arr1)): for j in range(0,len(arr2)): if(arr1[i]==arr2[j]): return -1 else: return 1 arr1=[1,2,3,4] arr2=[1,2,3,4] res=disjoint(arr1,arr2) print(res) if(res==-1): print("not disjoint") else: print("disjoint") #dtermine array is a subset of anthor array or not def subset(arr1,arr2,m,n): i=0 j=0 for i in range(n): for j in range(m): if(arr2[i]==arr1[j]): break if(j==m): return 0 return 1 arr1=[1,2,3,4] arr2=[2,3] m=len(arr1) n=len(arr2) if(subset(arr1,arr2,m,n)): print("arr2 is a subset of arr1") else: print("not") #rotation from left to right arr=[10,20,30,40,50] k=int(input("enter the no of rotation")) k=k%len(arr) for i in range(k): x=arr.pop(-1) arr.insert(0,x) print(arr) #all no array be made equal def make_equal(arr,n): for i in range(n): while(arr[i]%2==0): arr[i]=arr[i]/2 while(arr[i]%3==0): arr[i]=arr[i]/3 for i in range(n): if arr[i]!=arr[0]: return False else: return True arr=[3,50,75,100] n=len(arr) if(make_equal(arr,n)): print("yes") else: print("no") #sum of dight in the array def sumarr(arr,n): for i in range(n): temp=arr[i] sum=0 while(temp>0): d=temp%10 sum=sum+d temp=temp//10 print(sum,end=" ",sep=" ") arr=[] n=int(input("size")) for i in range(n): e=int(input()) arr.append(e) sumarr(arr,n) #placed all even no followed odd no # variables def rearrangeEvenAndOdd(arr, n) : j = -1 for i in range(0, n) : if (arr[i] % 2 == 0) : j = j + 1 temp = arr[i] arr[i] = arr[j] arr[j] = temp n=int(input("fj")) arr=[] for i in range(n): arr.append(int(input())) rearrangeEvenAndOdd(arr, n) for i in range(n): print(arr[i],end=" ",sep=" ") #array rotation def leftrotate(arr,d,n): for i in range(d): leftrotateone(arr,n) def leftrotateone(arr,n): temp=arr[0] for i in range(n-1): arr[i]=arr[i+1] arr[n-1]=temp arr=[1,2,3,4,5,6] print(arr) leftrotate(arr,2,len(arr)) print(arr) #max Element in an array def largeelearray(arr): max=arr[0] for i in range(0,len(arr)): if arr[i]>max: max=arr[i] else: max=max return max arr=[1,2,3,4] print(largeelearray(arr)) #recurrent element in an array def recurr(arr,n): for i in range(0,n): for j in range(0,n): if arr[i]==arr[j+1]: return arr[i] else: return False arr=[2,5,1,2,3,5,1,2,4] n=len(arr) print(recurr(arr,n)) #O(n^2) #o(1) #sum of array def sumarray(arr): sum=0 for i in range(0,len(arr)): sum=sum+arr[i] return sum arr=[1,2,3,4] print(sumarray(arr)) #Twosum array """ def twosum(arr,target): outputarr=[] for i in range(0,len(arr),1): for j in range(i+1,len(arr),1): if (arr[j] == target - arr[i]): outputarr.append(i) outputarr.append(j) return outputarr target=int(input("uju")) arr=[2,3,4,5] print(twosum(arr,target))""" """ def twosum(arr,target): outputarr=[] for i in range(0,len(arr)): for j in range(i+1,len(arr)): sum=arr[i]+arr[j] if sum==target: outputarr.append(i) outputarr.append(j) return outputarr print(twosum(arr=[2,7,11,15],target=9))"""
[ 1, 529, 9507, 29958, 2378, 29914, 2378, 16616, 8860, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 15945, 19451, 13, 20399, 373, 15050, 1085, 29871, 29906, 29946, 29871, 29906, 29906, 29901, 29896, 29906, 29901, 29900, 29906, 29871, 29906, 29900, 29906, 29896, 30004, 13, 30004, 13, 29992, 8921, 29901, 1976, 387, 30004, 13, 15945, 19451, 13, 30004, 13, 29937, 497, 18348, 5101, 310, 385, 1409, 30004, 13, 1753, 18348, 18784, 29898, 29886, 7121, 1125, 30004, 13, 29871, 269, 29922, 842, 26471, 13, 29871, 363, 313, 29916, 29892, 29891, 29897, 297, 11000, 29901, 30004, 13, 1678, 269, 29889, 1202, 3552, 29916, 29892, 29891, 876, 30004, 13, 1678, 565, 313, 29891, 29892, 29916, 29897, 297, 269, 29901, 30004, 13, 418, 1596, 3552, 29916, 29892, 29891, 511, 29908, 29989, 613, 3552, 29891, 29892, 29916, 4961, 30004, 13, 29886, 7121, 11759, 29898, 29896, 29896, 29892, 29906, 29900, 21336, 29941, 29900, 29892, 29946, 29900, 21336, 29945, 29892, 29896, 29900, 21336, 29946, 29900, 29892, 29941, 29900, 21336, 29896, 29900, 29892, 29945, 4638, 30004, 13, 2158, 29898, 11967, 16414, 18784, 29898, 29886, 7121, 511, 355, 543, 1159, 30004, 13, 29937, 276, 412, 1218, 1543, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 5893, 278, 2159, 5783, 30004, 13, 2749, 29922, 2636, 30004, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29889, 4397, 29898, 29872, 8443, 13, 29916, 29922, 1761, 29898, 8977, 29889, 3166, 8149, 29898, 2749, 876, 30004, 13, 1454, 474, 297, 921, 29901, 30004, 13, 29871, 565, 29898, 2749, 29889, 2798, 29898, 29875, 15410, 29896, 1125, 30004, 13, 1678, 1596, 29898, 29875, 8443, 13, 29871, 6756, 13, 29937, 5464, 29899, 276, 412, 1218, 1543, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 5893, 278, 2159, 5783, 30004, 13, 2749, 29922, 2636, 30004, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29889, 4397, 29898, 29872, 8443, 13, 29916, 29922, 1761, 29898, 8977, 29889, 3166, 8149, 29898, 2749, 876, 30004, 13, 1454, 474, 297, 921, 29901, 30004, 13, 29871, 565, 29898, 2749, 29889, 2798, 29898, 29875, 29897, 1360, 29896, 1125, 30004, 13, 1678, 1596, 29898, 29875, 8443, 13, 29937, 1217, 310, 1584, 1543, 322, 7736, 21268, 1212, 297, 385, 1409, 30004, 13, 2749, 29922, 2636, 30004, 13, 29876, 29922, 524, 29898, 2080, 3101, 30004, 13, 2798, 29896, 29922, 29900, 30004, 13, 2798, 29906, 29922, 29900, 30004, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29889, 4397, 29898, 29872, 8443, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 565, 29898, 2749, 29961, 29875, 29962, 29995, 29906, 1360, 29900, 1125, 30004, 13, 1678, 2302, 29896, 23661, 29896, 30004, 13, 29871, 1683, 29901, 30004, 13, 1678, 2302, 29906, 23661, 29896, 30004, 13, 2158, 703, 1217, 310, 1584, 613, 2798, 29896, 8443, 13, 2158, 703, 1217, 310, 7736, 338, 613, 2798, 29906, 8443, 13, 30004, 13, 29937, 2886, 292, 1375, 17336, 4704, 310, 1023, 4608, 30004, 13, 2749, 29896, 29922, 2636, 30004, 13, 2749, 29906, 29922, 2636, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 2311, 310, 278, 29871, 1409, 5783, 30004, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29896, 29889, 4397, 29898, 29872, 8443, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29906, 29889, 4397, 29898, 29872, 8443, 13, 1761, 29922, 26471, 13, 2749, 29896, 29889, 6605, 26471, 13, 2749, 29906, 29889, 6605, 29898, 24244, 29922, 5574, 8443, 13, 2083, 29922, 29900, 30004, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 29871, 2533, 29922, 2083, 29974, 2749, 29896, 29961, 29875, 14178, 2749, 29906, 29961, 29875, 29962, 30004, 13, 2158, 29898, 2083, 8443, 13, 29937, 1195, 12539, 6425, 4328, 310, 2183, 1409, 30004, 13, 2749, 11759, 29945, 29892, 29896, 29900, 29892, 29896, 29892, 29946, 29892, 29947, 29892, 29955, 29962, 30004, 13, 29876, 29922, 2435, 29898, 2749, 8443, 13, 2083, 29922, 29900, 30004, 13, 2749, 29889, 6605, 26471, 13, 2083, 29922, 2083, 29974, 6897, 29898, 2749, 29961, 29900, 29962, 29899, 2749, 29961, 29896, 2314, 30004, 13, 2083, 23661, 6897, 29898, 2749, 29961, 29876, 29899, 29896, 29962, 29899, 2749, 29961, 29876, 29899, 29906, 2314, 30004, 13, 1454, 474, 297, 3464, 29898, 29896, 29892, 29876, 29899, 29896, 1125, 30004, 13, 29871, 2533, 23661, 1195, 29898, 6897, 29898, 2749, 29961, 29875, 29962, 29899, 2749, 29961, 29875, 29899, 29896, 11724, 6897, 29898, 2749, 29961, 29875, 29962, 29899, 2749, 29961, 29875, 29974, 29896, 12622, 30004, 13, 2158, 29898, 2083, 8443, 13, 29937, 2886, 292, 4236, 17336, 4704, 310, 1023, 4608, 30004, 13, 2749, 29896, 29922, 2636, 30004, 13, 2749, 29906, 29922, 2636, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 2311, 310, 278, 29871, 1409, 5783, 30004, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29896, 29889, 4397, 29898, 29872, 8443, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29906, 29889, 4397, 29898, 29872, 8443, 13, 1761, 29922, 26471, 13, 2749, 29896, 29889, 6605, 26471, 13, 2749, 29906, 29889, 6605, 26471, 13, 2083, 29922, 29900, 30004, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 29871, 2533, 29922, 2083, 29974, 2749, 29896, 29961, 29875, 14178, 2749, 29906, 29961, 29875, 29962, 30004, 13, 2158, 29898, 2083, 8443, 13, 29937, 6680, 304, 736, 7472, 3234, 310, 263, 1014, 1761, 310, 2183, 1051, 30004, 13, 1753, 4236, 7566, 29898, 29909, 1125, 30004, 13, 12, 3317, 29918, 2548, 353, 1375, 29918, 2548, 353, 29871, 29900, 30004, 13, 12, 3317, 29918, 578, 29918, 15641, 353, 29871, 29900, 30004, 13, 12, 1454, 474, 297, 319, 29901, 30004, 13, 12, 12, 7382, 353, 4236, 29918, 2548, 30004, 13, 12, 12, 3317, 29918, 2548, 353, 4236, 29898, 29875, 29892, 4236, 29898, 29875, 334, 4236, 29918, 2548, 29892, 474, 334, 1375, 29918, 2548, 876, 30004, 13, 12, 12, 1195, 29918, 2548, 353, 1375, 29898, 29875, 29892, 1375, 29898, 29875, 334, 5694, 29892, 474, 334, 1375, 29918, 2548, 876, 30004, 13, 12, 12, 3317, 29918, 578, 29918, 15641, 353, 4236, 29898, 3317, 29918, 578, 29918, 15641, 29892, 4236, 29918, 2548, 8443, 13, 12, 2457, 4236, 29918, 578, 29918, 15641, 30004, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 12, 29909, 353, 518, 29953, 6653, 29896, 29900, 6653, 29941, 29892, 29900, 29892, 29945, 29962, 30004, 13, 12, 2158, 703, 1576, 7472, 3234, 310, 263, 1014, 1761, 338, 613, 4236, 7566, 29898, 29909, 876, 30004, 13, 30004, 13, 29937, 3198, 10868, 310, 1269, 1373, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 5893, 278, 2159, 5783, 30004, 13, 2749, 29922, 2636, 30004, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29889, 4397, 29898, 29872, 8443, 13, 29916, 29922, 1761, 29898, 8977, 29889, 3166, 8149, 29898, 2749, 876, 30004, 13, 1454, 474, 297, 921, 29901, 30004, 13, 29871, 1596, 703, 8875, 15693, 2470, 6571, 931, 1642, 4830, 29898, 29875, 29892, 2749, 29889, 2798, 29898, 29875, 4961, 30004, 13, 29937, 1745, 21081, 7929, 1543, 2504, 385, 1409, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 5893, 278, 2159, 5783, 30004, 13, 2749, 29922, 2636, 30004, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29889, 4397, 29898, 29872, 8443, 13, 29916, 29922, 1761, 29898, 8977, 29889, 3166, 8149, 29898, 2749, 876, 30004, 13, 2158, 29898, 29916, 8443, 13, 29937, 5721, 5562, 5029, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 5893, 278, 2159, 5783, 30004, 13, 2749, 29922, 2636, 30004, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29889, 4397, 29898, 29872, 8443, 13, 29916, 29922, 1761, 29898, 8977, 29889, 3166, 8149, 29898, 2749, 876, 30004, 13, 2158, 29898, 29916, 8443, 13, 2158, 29898, 2435, 29898, 29916, 876, 30004, 13, 29937, 1718, 29934, 338, 766, 12090, 470, 451, 30004, 13, 1753, 766, 12090, 29898, 2749, 29896, 29892, 2749, 29906, 1125, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 2749, 29896, 22164, 30004, 13, 1678, 363, 432, 297, 3464, 29898, 29900, 29892, 2435, 29898, 2749, 29906, 22164, 30004, 13, 418, 565, 29898, 2749, 29896, 29961, 29875, 29962, 1360, 2749, 29906, 29961, 29926, 29962, 1125, 30004, 13, 4706, 736, 448, 29896, 30004, 13, 418, 1683, 29901, 30004, 13, 4706, 736, 29871, 29896, 30004, 13, 2749, 29896, 11759, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29962, 30004, 13, 2749, 29906, 11759, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29962, 30004, 13, 690, 29922, 2218, 12090, 29898, 2749, 29896, 29892, 2749, 29906, 8443, 13, 2158, 29898, 690, 8443, 13, 361, 29898, 690, 1360, 29899, 29896, 1125, 30004, 13, 29871, 1596, 703, 1333, 766, 12090, 1159, 30004, 13, 2870, 29901, 30004, 13, 29871, 1596, 703, 2218, 12090, 1159, 30004, 13, 30004, 13, 29937, 29881, 8489, 457, 1409, 338, 263, 11306, 310, 24612, 272, 1409, 470, 451, 30004, 13, 1753, 11306, 29898, 2749, 29896, 29892, 2749, 29906, 29892, 29885, 29892, 29876, 1125, 30004, 13, 29871, 474, 29922, 29900, 30004, 13, 29871, 432, 29922, 29900, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 1678, 363, 432, 297, 3464, 29898, 29885, 1125, 30004, 13, 418, 565, 29898, 2749, 29906, 29961, 29875, 29962, 1360, 2749, 29896, 29961, 29926, 29962, 1125, 30004, 13, 4706, 2867, 30004, 13, 1678, 565, 29898, 29926, 1360, 29885, 1125, 30004, 13, 418, 736, 29871, 29900, 30004, 13, 29871, 736, 29871, 29896, 30004, 13, 2749, 29896, 11759, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29962, 30004, 13, 2749, 29906, 11759, 29906, 29892, 29941, 29962, 30004, 13, 29885, 29922, 2435, 29898, 2749, 29896, 8443, 13, 29876, 29922, 2435, 29898, 2749, 29906, 8443, 13, 361, 29898, 6484, 29898, 2749, 29896, 29892, 2749, 29906, 29892, 29885, 29892, 29876, 22164, 30004, 13, 29871, 1596, 703, 2749, 29906, 338, 263, 11306, 310, 3948, 29896, 1159, 30004, 13, 2870, 29901, 30004, 13, 29871, 1596, 703, 1333, 1159, 30004, 13, 29937, 5450, 362, 515, 2175, 304, 1492, 30004, 13, 2749, 11759, 29896, 29900, 29892, 29906, 29900, 29892, 29941, 29900, 29892, 29946, 29900, 29892, 29945, 29900, 29962, 30004, 13, 29895, 29922, 524, 29898, 2080, 703, 5893, 278, 694, 310, 13733, 5783, 30004, 13, 29895, 29922, 29895, 29995, 2435, 29898, 2749, 8443, 13, 1454, 474, 297, 3464, 29898, 29895, 1125, 30004, 13, 29871, 921, 29922, 2749, 29889, 7323, 6278, 29896, 8443, 13, 29871, 3948, 29889, 7851, 29898, 29900, 29892, 29916, 8443, 13, 2158, 29898, 2749, 8443, 13, 29937, 497, 694, 1409, 367, 1754, 5186, 30004, 13, 1753, 1207, 29918, 11745, 29898, 2749, 29892, 29876, 1125, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 1678, 1550, 29898, 2749, 29961, 29875, 29962, 29995, 29906, 1360, 29900, 1125, 30004, 13, 418, 3948, 29961, 29875, 13192, 2749, 29961, 29875, 16261, 29906, 30004, 13, 30004, 13, 1678, 1550, 29898, 2749, 29961, 29875, 29962, 29995, 29941, 1360, 29900, 1125, 30004, 13, 418, 3948, 29961, 29875, 13192, 2749, 29961, 29875, 16261, 29941, 30004, 13, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 1678, 565, 3948, 29961, 29875, 29962, 19216, 2749, 29961, 29900, 5387, 30004, 13, 418, 736, 7700, 30004, 13, 1678, 1683, 29901, 30004, 13, 418, 736, 5852, 30004, 13, 30004, 13, 2749, 11759, 29941, 29892, 29945, 29900, 29892, 29955, 29945, 29892, 29896, 29900, 29900, 29962, 30004, 13, 29876, 29922, 2435, 29898, 2749, 8443, 13, 361, 29898, 5675, 29918, 11745, 29898, 2749, 29892, 29876, 22164, 30004, 13, 29871, 1596, 703, 3582, 1159, 30004, 13, 2870, 29901, 30004, 13, 29871, 1596, 703, 1217, 1159, 30004, 13, 29937, 2083, 310, 270, 523, 297, 278, 1409, 30004, 13, 1753, 2533, 2749, 29898, 2749, 29892, 29876, 1125, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 1678, 5694, 29922, 2749, 29961, 29875, 29962, 30004, 13, 1678, 2533, 29922, 29900, 30004, 13, 1678, 1550, 29898, 7382, 29958, 29900, 1125, 30004, 13, 418, 270, 29922, 7382, 29995, 29896, 29900, 30004, 13, 418, 2533, 29922, 2083, 29974, 29881, 30004, 13, 418, 5694, 29922, 7382, 458, 29896, 29900, 30004, 13, 1678, 1596, 29898, 2083, 29892, 355, 543, 9162, 19570, 543, 376, 8443, 13, 2749, 29922, 2636, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 2311, 5783, 30004, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 321, 29922, 524, 29898, 2080, 3101, 30004, 13, 29871, 3948, 29889, 4397, 29898, 29872, 8443, 13, 2083, 2749, 29898, 2749, 29892, 29876, 8443, 13, 30004, 13, 29937, 13974, 1133, 599, 1584, 694, 5643, 7736, 694, 30004, 13, 29937, 3651, 30004, 13, 1753, 18983, 3881, 29923, 854, 2855, 29949, 1289, 29898, 2749, 29892, 302, 29897, 584, 30004, 13, 29871, 432, 353, 448, 29896, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29900, 29892, 302, 29897, 584, 30004, 13, 1678, 565, 313, 2749, 29961, 29875, 29962, 1273, 29871, 29906, 1275, 29871, 29900, 29897, 584, 30004, 13, 4706, 432, 353, 432, 718, 29871, 29896, 30004, 13, 30004, 13, 4706, 5694, 353, 3948, 29961, 29875, 29962, 30004, 13, 4706, 3948, 29961, 29875, 29962, 353, 3948, 29961, 29926, 29962, 30004, 13, 4706, 3948, 29961, 29926, 29962, 353, 5694, 30004, 13, 29876, 29922, 524, 29898, 2080, 703, 29888, 29926, 5783, 30004, 13, 2749, 29922, 2636, 30004, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 3948, 29889, 4397, 29898, 524, 29898, 2080, 22130, 30004, 13, 276, 279, 3881, 29923, 854, 2855, 29949, 1289, 29898, 2749, 29892, 302, 8443, 13, 1454, 474, 297, 3464, 29898, 29876, 1125, 30004, 13, 29871, 1596, 29898, 2749, 29961, 29875, 1402, 355, 543, 9162, 19570, 543, 376, 8443, 13, 29937, 2378, 13733, 30004, 13, 1753, 2175, 23361, 29898, 2749, 29892, 29881, 29892, 29876, 1125, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29881, 1125, 30004, 13, 1678, 2175, 23361, 650, 29898, 2749, 29892, 29876, 8443, 13, 1753, 2175, 23361, 650, 29898, 2749, 29892, 29876, 1125, 30004, 13, 29871, 5694, 29922, 2749, 29961, 29900, 29962, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29876, 29899, 29896, 1125, 30004, 13, 1678, 3948, 29961, 29875, 13192, 2749, 29961, 29875, 29974, 29896, 29962, 30004, 13, 29871, 3948, 29961, 29876, 29899, 29896, 13192, 7382, 30004, 13, 2749, 11759, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 29892, 29953, 29962, 30004, 13, 2158, 29898, 2749, 8443, 13, 1563, 23361, 29898, 2749, 29892, 29906, 29892, 2435, 29898, 2749, 876, 30004, 13, 2158, 29898, 2749, 8443, 13, 29937, 3317, 10619, 297, 385, 1409, 30004, 13, 1753, 2919, 29872, 1945, 764, 29898, 2749, 1125, 30004, 13, 29871, 4236, 29922, 2749, 29961, 29900, 29962, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 2749, 22164, 30004, 13, 1678, 565, 3948, 29961, 29875, 29962, 29958, 3317, 29901, 30004, 13, 418, 4236, 29922, 2749, 29961, 29875, 29962, 30004, 13, 1678, 1683, 29901, 30004, 13, 418, 4236, 29922, 3317, 30004, 13, 29871, 736, 4236, 30004, 13, 2749, 11759, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29962, 30004, 13, 2158, 29898, 16961, 29872, 1945, 764, 29898, 2749, 876, 30004, 13, 29937, 3757, 1264, 1543, 297, 385, 1409, 30004, 13, 1753, 1162, 1038, 29898, 2749, 29892, 29876, 1125, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 1678, 363, 432, 297, 3464, 29898, 29900, 29892, 29876, 1125, 30004, 13, 418, 565, 3948, 29961, 29875, 29962, 1360, 2749, 29961, 29926, 29974, 29896, 5387, 30004, 13, 4706, 736, 3948, 29961, 29875, 29962, 30004, 13, 418, 1683, 29901, 30004, 13, 4706, 736, 7700, 30004, 13, 2749, 11759, 29906, 29892, 29945, 29892, 29896, 29892, 29906, 29892, 29941, 29892, 29945, 29892, 29896, 29892, 29906, 29892, 29946, 29962, 30004, 13, 29876, 29922, 2435, 29898, 2749, 8443, 13, 2158, 29898, 3757, 1038, 29898, 2749, 29892, 29876, 876, 30004, 13, 29937, 29949, 29898, 29876, 29985, 29906, 8443, 13, 29937, 29877, 29898, 29896, 8443, 13, 29937, 2083, 310, 1409, 30004, 13, 1753, 2533, 2378, 29898, 2749, 1125, 30004, 13, 29871, 2533, 29922, 29900, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 2749, 22164, 30004, 13, 1678, 2533, 29922, 2083, 29974, 2749, 29961, 29875, 29962, 30004, 13, 29871, 736, 2533, 30004, 13, 2749, 11759, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29962, 30004, 13, 2158, 29898, 2083, 2378, 29898, 2749, 876, 30004, 13, 29937, 27418, 359, 398, 1409, 30004, 13, 15945, 19451, 13, 1753, 3252, 359, 398, 29898, 2749, 29892, 5182, 1125, 30004, 13, 29871, 1962, 2749, 29922, 2636, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 2749, 511, 29896, 1125, 30004, 13, 1678, 363, 432, 297, 3464, 29898, 29875, 29974, 29896, 29892, 2435, 29898, 2749, 511, 29896, 1125, 30004, 13, 418, 565, 313, 2749, 29961, 29926, 29962, 1275, 3646, 448, 3948, 29961, 29875, 29962, 1125, 30004, 13, 3986, 1962, 2749, 29889, 4397, 29898, 29875, 8443, 13, 3986, 1962, 2749, 29889, 4397, 29898, 29926, 8443, 13, 3986, 736, 1962, 2749, 30004, 13, 5182, 29922, 524, 29898, 2080, 703, 29884, 4900, 5783, 30004, 13, 2749, 11759, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 29962, 30004, 13, 2158, 29898, 7516, 359, 398, 29898, 2749, 29892, 5182, 876, 15945, 19451, 13, 15945, 19451, 13, 1753, 3252, 359, 398, 29898, 2749, 29892, 5182, 1125, 30004, 13, 29871, 1962, 2749, 29922, 2636, 30004, 13, 29871, 363, 474, 297, 3464, 29898, 29900, 29892, 2435, 29898, 2749, 22164, 30004, 13, 1678, 363, 432, 297, 3464, 29898, 29875, 29974, 29896, 29892, 2435, 29898, 2749, 22164, 30004, 13, 418, 2533, 29922, 2749, 29961, 29875, 10062, 2749, 29961, 29926, 29962, 30004, 13, 418, 565, 2533, 1360, 5182, 29901, 30004, 13, 4706, 1962, 2749, 29889, 4397, 29898, 29875, 8443, 13, 4706, 1962, 2749, 29889, 4397, 29898, 29926, 8443, 13, 4706, 736, 1962, 2749, 30004, 13, 2158, 29898, 7516, 359, 398, 29898, 2749, 11759, 29906, 29892, 29955, 29892, 29896, 29896, 29892, 29896, 29945, 1402, 5182, 29922, 29929, 876, 15945, 19451, 13, 30004, 13, 2 ]
models/nlp/albert/run_pretraining.py
indhub/deep-learning-models
0
128252
""" albert-base wrapped_train_step w/ 32bsz, 1acc: 3.13 it/s; 3.51 it/s wrapped train_step w/ skipping loss/acc allreduce: ? it/s, 3.54 it/s wrapped train_step w/ skipping xla: ? it/s, 1.50 it/s wrapped train_batch & wrapped_allreduce: 2.99 it/s, 3.42 it/s Max per-GPU batch size (albert): base: - 512seq: 32 on p3dn w/ 2 grad_acc (1.72 it/s on TF2.1, 1.82 it/s single-node), 16 on p316 large: - 512seq: 16 on p3dn w/ 4 grad_acc (0.60 it/s on TF2.1, 0.63 it/s single-node), 8 on p316 Max per-GPU batch size (bert): base: - 512seq: 16 on p3dn w/ 4 grad_acc (0.91 it/s on TF 2.1, 1.31 it/s single-node) large: - 512seq: 8 on p3dn w/ 8 grad_acc (0.31 it/s on TF 2.1, 0.47 it/s single-node) A training run of 125k steps is 125k/(1.72 * 3600) ~= 20 hours for base trained on 512seq. """ import argparse import datetime import glob import logging import math import os from tempfile import TemporaryDirectory from typing import List import tensorflow as tf import tqdm from run_squad import run_squad_and_get_results from tensorflow_addons.optimizers import LAMB, AdamW from transformers import ( # GradientAccumulator, AutoConfig, TFAlbertForMaskedLM, TFAlbertModel, TFAutoModelForPreTraining, TFBertForPreTraining, ) from gradient_accumulator import GradientAccumulator from learning_rate_schedules import LinearWarmupLinearDecaySchedule from utils import get_tokenizer, rewrap_tf_function # See https://github.com/huggingface/transformers/issues/3782; this import must come last import horovod.tensorflow as hvd # isort:skip logger = logging.getLogger(__name__) def gather_indexes(sequence_tensor: "[batch,seq_length,width]", positions) -> tf.Tensor: """Gathers the vectors at the specific positions over a minibatch.""" sequence_shape = sequence_tensor.shape.as_list() batch_size = sequence_shape[0] seq_length = sequence_shape[1] width = sequence_shape[2] flat_offsets = tf.reshape(tf.range(0, batch_size, dtype=tf.int64) * seq_length, [-1, 1]) flat_positions = tf.reshape(positions + flat_offsets, [-1]) flat_sequence_tensor = tf.reshape(sequence_tensor, [batch_size * seq_length, width]) output_tensor = tf.gather(flat_sequence_tensor, flat_positions) output_tensor = tf.reshape(output_tensor, [batch_size, -1, width]) return output_tensor def gather_indexes_2d(sequence_tensor: "[batch,seq_length,width]", positions) -> tf.Tensor: sequence_shape = sequence_tensor.shape.as_list() batch_size = sequence_shape[0] seq_length = sequence_shape[1] flat_offsets = tf.reshape(tf.range(0, batch_size, dtype=tf.int64) * seq_length, [-1, 1]) flat_positions = tf.reshape(positions + flat_offsets, [-1]) flat_sequence_tensor = tf.reshape(sequence_tensor, [batch_size * seq_length]) output_tensor = tf.gather(flat_sequence_tensor, flat_positions) output_tensor = tf.reshape(output_tensor, [batch_size, -1]) return output_tensor def get_mlm_dataset( *, filenames: List[str], max_seq_length: int, max_predictions_per_seq: int, batch_size: int, buffer_size: int = 1000, ) -> tf.data.Dataset: """ Reads the dataset from TFRecords and returns it. """ def _parse_function(example_proto): # Parse the input `tf.Example` proto using the dictionary above. return tf.io.parse_single_example(example_proto, name_to_features) name_to_features = { "input_ids": tf.io.FixedLenFeature([max_seq_length], tf.int64), # corresponds to input_ids "input_mask": tf.io.FixedLenFeature( [max_seq_length], tf.int64 ), # corresponds to attention_mask "segment_ids": tf.io.FixedLenFeature( [max_seq_length], tf.int64 ), # corresponds to token_type_ids "masked_lm_positions": tf.io.FixedLenFeature( [max_predictions_per_seq], tf.int64 ), # The number in the sequence that is masked, in range [0, max_seq_length]. 0 signifies a pad. "masked_lm_ids": tf.io.FixedLenFeature( [max_predictions_per_seq], tf.int64 ), # The token id that is masked, in range [0, vocab_size]. 0 signifies a pad. "masked_lm_weights": tf.io.FixedLenFeature( [max_predictions_per_seq], tf.float32 ), # 1 if useful, 0 signifies a pad token "next_sentence_labels": tf.io.FixedLenFeature([1], tf.int64), } # Example input pipeline here: https://github.com/NVIDIA/DeepLearningExamples/blob/master/TensorFlow/LanguageModeling/BERT/run_pretraining.py#L443 # 2048 TFRecord files here if hvd.rank() == 0: logger.info(f"Dataset length {len(filenames)}") logger.debug(filenames) assert len(filenames) > 0, f"Filenames is an empty list" # Shard and shuffle the filenames dataset = tf.data.Dataset.from_tensor_slices(filenames) dataset = dataset.shard(hvd.size(), hvd.rank()) dataset = dataset.shuffle(buffer_size=len(filenames), reshuffle_each_iteration=True) dataset = dataset.repeat() # `cycle_length` is the number of parallel files that get read num_cpu_threads = 2 * 96 cycle_length = min(num_cpu_threads, len(filenames)) # file_to_dataset_func = lambda file: tf.data.TFRecordDataset(file).map(_parse_function) file_to_dataset_func = lambda file: tf.data.TFRecordDataset(file) dataset = dataset.interleave( file_to_dataset_func, cycle_length=cycle_length, block_length=1, num_parallel_calls=cycle_length, ) # Map and batch will be automatically fused together, see https://www.tensorflow.org/api_docs/python/tf/data/experimental/map_and_batch dataset = dataset.map(_parse_function, num_parallel_calls=num_cpu_threads) dataset = dataset.shuffle(buffer_size=buffer_size, reshuffle_each_iteration=True) dataset = dataset.batch(batch_size, drop_remainder=True) # Shuffle the batches and prefetch some batches dataset = dataset.shuffle(buffer_size=buffer_size, reshuffle_each_iteration=True) return dataset def mlm_loss_fn( prediction_logits: "[batch, max_seq_len (512), vocab_size]", label_positions: "[batch, num_masks (20)]", label_ids: "[batch, num_masks (20)]", label_weights: "[batch, num_masks (20)]", ): """ label_weights is either 1 or 0, 0 meaning masked. """ logits_at_positions = gather_indexes( prediction_logits, label_positions ) # [b, num_masks, vocab_size] preds_at_positions = tf.math.argmax(logits_at_positions, -1) # [b, num_masks] denominator = tf.reduce_sum(label_weights) + 1e-5 cross_entropy_per_token = label_weights * tf.nn.sparse_softmax_cross_entropy_with_logits( labels=label_ids, logits=logits_at_positions ) # [b, num_masks] cross_entropy_numerator = tf.reduce_sum(cross_entropy_per_token) # [1] accuracy_per_token = label_weights * tf.cast( tf.math.equal(label_ids, preds_at_positions), tf.float32 ) # [b, num_tokens] accuracy_numerator = tf.reduce_sum(accuracy_per_token) # [1] cross_entropy = cross_entropy_numerator / denominator accuracy = accuracy_numerator / denominator return cross_entropy, accuracy def sop_loss_fn( prediction_logits: "[b, 2]", next_sentence_labels: "[b, 1]", ): """ Note that this works for either NSP or SOP, the difference is in how data is generated. We want to use SOP objective. """ label_truth = tf.squeeze(next_sentence_labels) # [b] label_preds = tf.math.argmax(prediction_logits, -1) # [b] cross_entropy_batch = tf.nn.sparse_softmax_cross_entropy_with_logits( labels=label_truth, logits=prediction_logits ) # [b] accuracy_batch = tf.cast(tf.math.equal(label_truth, label_preds), tf.float16) # [b] cross_entropy = tf.reduce_mean(cross_entropy_batch) # [1] accuracy = tf.reduce_mean(accuracy_batch) # [b] return cross_entropy, accuracy def train_batch( *, model, opt, gradient_accumulator, input_ids, attention_mask, token_type_ids, label_positions, label_ids, label_weights, next_sentence_labels, skip_sop: bool, skip_mlm: bool, ): with tf.GradientTape() as tape: input_dict = { "input_ids": input_ids, "attention_mask": attention_mask, "token_type_ids": token_type_ids, } mlm_logits, sop_logits, hidden_states = model(input_dict, training=True) # MLM calculation if skip_mlm: mlm_loss, mlm_acc = tf.constant(0.0), tf.constant(0.0) else: mlm_loss, mlm_acc = mlm_loss_fn( prediction_logits=mlm_logits, label_positions=label_positions, label_ids=label_ids, label_weights=label_weights, ) # SOP calculation if skip_sop: sop_loss, sop_acc = tf.constant(0.0), tf.constant(0.0) else: sop_loss, sop_acc = sop_loss_fn( prediction_logits=sop_logits, next_sentence_labels=next_sentence_labels ) loss = tf.cast(mlm_loss, dtype=tf.float32) + tf.cast( sop_loss, dtype=tf.float32 ) # Should there be a coefficient on one of these? scaled_loss = opt.get_scaled_loss(loss) scaled_grads = tape.gradient(scaled_loss, model.trainable_variables) step_grads = opt.get_unscaled_gradients(scaled_grads) gradient_accumulator(step_grads) return loss, mlm_loss, mlm_acc, sop_loss, sop_acc def allreduce(model, opt, gradient_accumulator, loss, mlm_loss, mlm_acc, sop_loss, sop_acc): grads = gradient_accumulator.gradients # This, which is equivalent to sparse_as_dense=True, gives a mild 2% speedup from 0.62 it/s to 0.63 it/s # onn BERT-large multinode. grads = [ tf.convert_to_tensor(grad) if grad is not None and isinstance(grad, tf.IndexedSlices) else grad for grad in grads ] # TODO: Does placing this clip before or after allreduce affect accuracy? # Placing before has a regularization effect, no single example can contribute as much. # Placing before also gives a 20% speedup when training BERT-large, probably because the # gradient operations can be fused by XLA. (grads, grad_norm) = tf.clip_by_global_norm(grads, clip_norm=args.max_grad_norm) grads = [ hvd.allreduce(grad, compression=hvd.Compression.fp16) if grad is not None else None for grad in grads ] opt.apply_gradients( [(grad, var) for (grad, var) in zip(grads, model.trainable_variables) if grad is not None] ) # Clear the gradient accumulator gradient_accumulator.reset() loss = hvd.allreduce(loss) mlm_loss = hvd.allreduce(mlm_loss) mlm_acc = hvd.allreduce(mlm_acc) sop_loss = hvd.allreduce(sop_loss) sop_acc = hvd.allreduce(sop_acc) return loss, mlm_loss, mlm_acc, sop_loss, sop_acc, grad_norm # The bottleneck is here, since each node has 10 GiB/s PCI throughput, accumulating the gradients # on the CPU. If there's a way to accumulate gradients on the GPU without getting OOM, let's find it! def train_step( model, opt, gradient_accumulator, batch, gradient_accumulation_steps: int, skip_sop: bool, skip_mlm: bool, ): # MLM uses last_hidden_state, while SOP uses pooler_output # Loss is float, acc is half total_loss, total_mlm_loss, total_mlm_acc, total_sop_loss, total_sop_acc = ( tf.constant(0, dtype=tf.float32), tf.constant(0, dtype=tf.float32), tf.constant(0, dtype=tf.float32), tf.constant(0, dtype=tf.float32), tf.constant(0, dtype=tf.float16), ) for step in range(gradient_accumulation_steps): loss, mlm_loss, mlm_acc, sop_loss, sop_acc = train_batch( model=model, opt=opt, gradient_accumulator=gradient_accumulator, input_ids=batch["input_ids"][step], attention_mask=batch["input_mask"][step], token_type_ids=batch["segment_ids"][step], label_positions=batch["masked_lm_positions"][step], label_ids=batch["masked_lm_ids"][step], label_weights=batch["masked_lm_weights"][step], next_sentence_labels=batch["next_sentence_labels"][step], skip_sop=skip_sop, skip_mlm=skip_mlm, ) total_loss += loss total_mlm_loss += mlm_loss total_mlm_acc += tf.cast(mlm_acc, tf.float32) total_sop_loss += sop_loss total_sop_acc += tf.cast(sop_acc, tf.float16) total_loss /= gradient_accumulation_steps total_mlm_loss /= gradient_accumulation_steps total_mlm_acc /= gradient_accumulation_steps total_sop_loss /= gradient_accumulation_steps total_sop_acc /= gradient_accumulation_steps return_tuple = allreduce( model=model, opt=opt, gradient_accumulator=gradient_accumulator, loss=total_loss, mlm_loss=total_mlm_loss, mlm_acc=total_mlm_acc, sop_loss=total_sop_loss, sop_acc=total_sop_acc, ) return return_tuple def validation_batch(model, batch, skip_mlm: bool, skip_sop: bool): input_ids = batch["input_ids"] attention_mask = batch["input_mask"] token_type_ids = batch["segment_ids"] label_positions = batch["masked_lm_positions"] label_ids = batch["masked_lm_ids"] label_weights = batch["masked_lm_weights"] next_sentence_labels = batch["next_sentence_labels"] input_dict = { "input_ids": input_ids, "attention_mask": attention_mask, "token_type_ids": token_type_ids, } # mlm_logits: [b,seq_len,vocab_size] # sop_logits: [b,2] # hidden_states: tuple w/ len 13 mlm_logits, sop_logits, hidden_states = model(input_dict, training=False) # MLM calculation if skip_mlm: mlm_loss, mlm_acc = 0, 0 else: mlm_loss, mlm_acc = mlm_loss_fn( prediction_logits=mlm_logits, label_positions=label_positions, label_ids=label_ids, label_weights=label_weights, ) # SOP calculation if skip_sop: sop_loss, sop_acc = 0, 0 else: sop_loss, sop_acc = sop_loss_fn( prediction_logits=sop_logits, next_sentence_labels=next_sentence_labels ) loss = mlm_loss + sop_loss # Should there be a coefficient on one of these? return loss, mlm_loss, mlm_acc, sop_loss, sop_acc def run_validation(model, validation_dataset, skip_sop: bool, skip_mlm: bool): # A single TFRecord shard contains 22663 batches, or 170k examples. num_batches = 100 val_loss, val_mlm_loss, val_mlm_acc, val_sop_loss, val_sop_acc = (0, 0, 0, 0, 0) for batch in validation_dataset.take(num_batches): loss, mlm_loss, mlm_acc, sop_loss, sop_acc = validation_batch( model=model, batch=batch, skip_sop=skip_sop, skip_mlm=skip_mlm ) val_loss += loss val_mlm_loss += mlm_loss val_mlm_acc += mlm_acc val_sop_loss += sop_loss val_sop_acc += sop_acc val_loss /= num_batches val_mlm_loss /= num_batches val_mlm_acc /= num_batches val_sop_loss /= num_batches val_sop_acc /= num_batches return (val_loss, val_mlm_loss, val_mlm_acc, val_sop_loss, val_sop_acc) def hvd_barrier(): hvd.allreduce(tf.random.normal([1])) def get_squad_results( model: tf.keras.Model, model_size: str, step: int, fast: bool = False, dummy_eval: bool = False, ): # This is inefficient, since each rank will save and serialize the model separately. # It would be better to have rank 0 save the model and all the ranks read it, but # `run_name` isn't deterministic due to timestamps, so only rank 0 has the run_name. # TODO: Improve. If only tf.keras.clone_model(model) worked. with TemporaryDirectory() as dirname: path = os.path.join(dirname, "model") model.save_weights(path) hvd_barrier() cloned_model = type(model)(config=model.config) cloned_model.load_weights(path).expect_partial() hvd_barrier() per_gpu_batch_size = min(3, int(math.ceil(48 / hvd.size()))) if fast: warmup_steps = 5 total_steps = 10 dataset = "debug" else: warmup_steps = 814 total_steps = 8144 dataset = "squadv2" squad_run_name = f"pretrain{step}-" squad_results = run_squad_and_get_results( run_name=squad_run_name, fsx_prefix=args.fsx_prefix, pre_layer_norm=cloned_model.config.pre_layer_norm, model_size=model_size, load_from=cloned_model, load_step=None, batch_size=per_gpu_batch_size, # This will be less than 3, so no OOM errors checkpoint_frequency=None, validate_frequency=None, learning_rate=3e-5, warmup_steps=warmup_steps, total_steps=total_steps, dataset=dataset, dummy_eval=dummy_eval, ) hvd_barrier() if hvd.rank() == 0: return squad_results def wrap_global_functions(do_gradient_accumulation: bool): global validation_batch validation_batch = rewrap_tf_function(validation_batch) if do_gradient_accumulation: global train_batch train_batch = rewrap_tf_function(train_batch) global allreduce allreduce = rewrap_tf_function(allreduce) else: global train_step train_step = rewrap_tf_function(train_step) def main( fsx_prefix: str, model_type: str, model_size: str, batch_size: int, max_seq_length: int, gradient_accumulation_steps: int, optimizer: str, name: str, learning_rate: float, end_learning_rate: float, warmup_steps: int, total_steps: int, skip_sop: bool, skip_mlm: bool, pre_layer_norm: bool, fast_squad: bool, dummy_eval: bool, squad_steps: List[int], hidden_dropout_prob: float, ): # Hard-coded values that don't need to be arguments max_predictions_per_seq = 20 log_frequency = 1000 checkpoint_frequency = 5000 validate_frequency = 2000 histogram_frequency = 100 do_gradient_accumulation = gradient_accumulation_steps > 1 if hvd.rank() == 0: # Run name should only be used on one process to avoid race conditions current_time = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") platform = "eks" if args.fsx_prefix == "/fsx" else "sm" if skip_sop: loss_str = "-skipsop" elif skip_mlm: loss_str = "-skipmlm" else: loss_str = "" amp_str = ( "-skipamp" if not tf.config.optimizer.get_experimental_options().get("auto_mixed_precision", False) else "" ) ln_str = "-preln" if pre_layer_norm else "-postln" dropout_str = f"-{hidden_dropout_prob}dropout" if hidden_dropout_prob != 0 else "" name_str = f"-{name}" if name else "" metadata = f"{model_type}-{model_size}-{args.load_from}-{hvd.size()}gpus-{batch_size}batch-{gradient_accumulation_steps}accum-{learning_rate}lr-{args.max_grad_norm}maxgrad-{optimizer}opt-{total_steps}steps-{max_seq_length}seq{amp_str}{ln_str}{loss_str}{dropout_str}{name_str}" run_name = f"{current_time}-{platform}-{metadata}" # Logging should only happen on a single process # https://stackoverflow.com/questions/9321741/printing-to-screen-and-writing-to-a-file-at-the-same-time level = logging.INFO format = "%(asctime)-15s %(name)-12s: %(levelname)-8s %(message)s" handlers = [ logging.FileHandler(f"{fsx_prefix}/logs/albert/{run_name}.log"), logging.StreamHandler(), ] logging.basicConfig(level=level, format=format, handlers=handlers) # Check that arguments passed in properly, only after registering the alert_func and logging assert not (skip_sop and skip_mlm), "Cannot use --skip_sop and --skip_mlm" wrap_global_functions(do_gradient_accumulation) if model_type == "albert": model_desc = f"albert-{model_size}-v2" elif model_type == "bert": model_desc = f"bert-{model_size}-uncased" config = AutoConfig.from_pretrained(model_desc) config.pre_layer_norm = pre_layer_norm config.output_hidden_states = True config.hidden_dropout_prob = hidden_dropout_prob model = TFAutoModelForPreTraining.from_config(config) if args.load_from == "scratch": pass else: assert model_type == "albert", "Only loading pretrained albert models is supported" huggingface_name = f"albert-{model_size}-v2" if args.load_from == "huggingface": albert = TFAlbertModel.from_pretrained(huggingface_name, config=config) model.albert = albert elif args.load_from == "huggingfacepreds": mlm_model = TFAlbertForMaskedLM.from_pretrained(huggingface_name, config=config) model.albert = mlm_model.albert model.cls.predictions = mlm_model.predictions tokenizer = get_tokenizer() schedule = LinearWarmupLinearDecaySchedule( max_learning_rate=learning_rate, end_learning_rate=end_learning_rate, warmup_steps=warmup_steps, total_steps=total_steps, ) if optimizer == "lamb": opt = LAMB( learning_rate=schedule, weight_decay_rate=0.01, beta_1=0.9, beta_2=0.999, epsilon=1e-6, exclude_from_weight_decay=["LayerNorm", "layer_norm", "bias"], ) elif optimizer == "adam": opt = AdamW(weight_decay=0.0, learning_rate=schedule) opt = tf.keras.mixed_precision.experimental.LossScaleOptimizer(opt, loss_scale="dynamic") gradient_accumulator = GradientAccumulator() # Train filenames are [1, 2047] # Val filenames are [0] # Note the different subdirectories train_glob = f"{fsx_prefix}/albert_pretraining/tfrecords/train/max_seq_len_{max_seq_length}_max_predictions_per_seq_{max_predictions_per_seq}_masked_lm_prob_15/albert_*.tfrecord" validation_glob = f"{fsx_prefix}/albert_pretraining/tfrecords/validation/max_seq_len_{max_seq_length}_max_predictions_per_seq_{max_predictions_per_seq}_masked_lm_prob_15/albert_*.tfrecord" train_filenames = glob.glob(train_glob) validation_filenames = glob.glob(validation_glob) train_dataset = get_mlm_dataset( filenames=train_filenames, max_seq_length=max_seq_length, max_predictions_per_seq=max_predictions_per_seq, batch_size=batch_size, ) # Of shape [batch_size, ...] train_dataset = train_dataset.batch( gradient_accumulation_steps ) # Batch of batches, helpful for gradient accumulation. Shape [grad_steps, batch_size, ...] # train_dataset = ( # train_dataset.repeat() # ) # One iteration with 10 dupes, 8 nodes seems to be 60-70k steps. train_dataset = train_dataset.prefetch(buffer_size=8) # Validation should only be done on one node, since Horovod doesn't allow allreduce on a subset of ranks if hvd.rank() == 0: validation_dataset = get_mlm_dataset( filenames=validation_filenames, max_seq_length=max_seq_length, max_predictions_per_seq=max_predictions_per_seq, batch_size=batch_size, ) # validation_dataset = validation_dataset.batch(1) validation_dataset = validation_dataset.prefetch(buffer_size=8) pbar = tqdm.tqdm(total_steps) summary_writer = None # Only create a writer if we make it through a successful step if hvd.rank() == 0: logger.info(f"Starting training, job name {run_name}") for i, batch in enumerate(train_dataset): learning_rate = schedule(step=tf.constant(i, dtype=tf.float32)) loss, mlm_loss, mlm_acc, sop_loss, sop_acc, grad_norm = train_step( model=model, opt=opt, gradient_accumulator=gradient_accumulator, batch=batch, gradient_accumulation_steps=gradient_accumulation_steps, skip_sop=skip_sop, skip_mlm=skip_mlm, ) # Don't want to wrap broadcast_variables() in a tf.function, can lead to asynchronous errors if i == 0: hvd.broadcast_variables(model.variables, root_rank=0) hvd.broadcast_variables(opt.variables(), root_rank=0) is_final_step = i >= total_steps - 1 do_squad = i in squad_steps or is_final_step # Squad requires all the ranks to train, but results are only returned on rank 0 if do_squad: squad_results = get_squad_results( model=model, model_size=model_size, step=i, fast=fast_squad, dummy_eval=dummy_eval, ) if hvd.rank() == 0: squad_exact, squad_f1 = squad_results["exact"], squad_results["f1"] logger.info(f"SQuAD step {i} -- F1: {squad_f1:.3f}, Exact: {squad_exact:.3f}") # Re-wrap autograph so it doesn't get arg mismatches wrap_global_functions(do_gradient_accumulation) if hvd.rank() == 0: do_log = i % log_frequency == 0 do_checkpoint = (i % checkpoint_frequency == 0) or is_final_step do_validation = (i % validate_frequency == 0) or is_final_step pbar.update(1) description = f"Loss: {loss:.3f}, MLM: {mlm_loss:.3f}, SOP: {sop_loss:.3f}, MLM_acc: {mlm_acc:.3f}, SOP_acc: {sop_acc:.3f}" pbar.set_description(description) if do_log: logger.info(f"Train step {i} -- {description}") if do_checkpoint: checkpoint_path = f"{fsx_prefix}/checkpoints/albert/{run_name}-step{i}.ckpt" logger.info(f"Saving checkpoint at {checkpoint_path}") model.save_weights(checkpoint_path) # model.load_weights(checkpoint_path) if do_validation: val_loss, val_mlm_loss, val_mlm_acc, val_sop_loss, val_sop_acc = run_validation( model=model, validation_dataset=validation_dataset, skip_sop=skip_sop, skip_mlm=skip_mlm, ) description = f"Loss: {val_loss:.3f}, MLM: {val_mlm_loss:.3f}, SOP: {val_sop_loss:.3f}, MLM_acc: {val_mlm_acc:.3f}, SOP_acc: {val_sop_acc:.3f}" logger.info(f"Validation step {i} -- {description}") # Create summary_writer after the first step if summary_writer is None: summary_writer = tf.summary.create_file_writer( f"{fsx_prefix}/logs/albert/{run_name}" ) # Log to TensorBoard weight_norm = tf.math.sqrt( tf.math.reduce_sum([tf.norm(var, ord=2) ** 2 for var in model.trainable_variables]) ) with summary_writer.as_default(): tf.summary.scalar("weight_norm", weight_norm, step=i) tf.summary.scalar("learning_rate", learning_rate, step=i) tf.summary.scalar("train_loss", loss, step=i) tf.summary.scalar("train_mlm_loss", mlm_loss, step=i) tf.summary.scalar("train_mlm_acc", mlm_acc, step=i) tf.summary.scalar("train_sop_loss", sop_loss, step=i) tf.summary.scalar("train_sop_acc", sop_acc, step=i) tf.summary.scalar("grad_norm", grad_norm, step=i) if do_validation: tf.summary.scalar("val_loss", val_loss, step=i) tf.summary.scalar("val_mlm_loss", val_mlm_loss, step=i) tf.summary.scalar("val_mlm_acc", val_mlm_acc, step=i) tf.summary.scalar("val_sop_loss", val_sop_loss, step=i) tf.summary.scalar("val_sop_acc", val_sop_acc, step=i) if do_squad: tf.summary.scalar("squad_f1", squad_f1, step=i) tf.summary.scalar("squad_exact", squad_exact, step=i) if is_final_step: break if hvd.rank() == 0: pbar.close() logger.info(f"Finished pretraining, job name {run_name}") def get_squad_steps(extra_steps_str: str) -> List[int]: """ Parse a comma-separated string of integers, append it to list of default steps. """ extra_squad_steps = [int(val) for val in extra_steps_str.split(",")] if extra_steps_str else [] default_squad_steps = [k * 1000 for k in [5, 10, 20, 40, 60, 80, 100, 120]] return extra_squad_steps + default_squad_steps if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--model_dir", help="Unused, but passed by SageMaker") parser.add_argument("--model_type", default="albert", choices=["albert", "bert"]) parser.add_argument("--model_size", default="base", choices=["base", "large"]) parser.add_argument("--batch_size", type=int, default=32, help="per GPU") parser.add_argument("--gradient_accumulation_steps", type=int, default=2) parser.add_argument("--max_seq_length", type=int, default=512, choices=[128, 512]) parser.add_argument("--warmup_steps", type=int, default=3125) parser.add_argument("--total_steps", type=int, default=125000) parser.add_argument("--learning_rate", type=float, default=0.00176) parser.add_argument("--end_learning_rate", type=float, default=3e-5) parser.add_argument("--hidden_dropout_prob", type=float, default=0.0) parser.add_argument("--max_grad_norm", type=float, default=1.0) parser.add_argument("--optimizer", default="lamb", choices=["lamb", "adam"]) parser.add_argument("--name", default="", help="Additional info to append to metadata") parser.add_argument( "--load_from", default="scratch", choices=["scratch", "huggingface", "huggingfacepreds"], ) parser.add_argument( "--fsx_prefix", default="/fsx", choices=["/fsx", "/opt/ml/input/data/training"], help="Change to /opt/ml/input/data/training on SageMaker", ) # SageMaker does not work with 'store_const' args, since it parses into a dictionary # We will treat any value not equal to None as True, and use --skip_amp=True parser.add_argument( "--skip_amp", choices=["true"], help="For debugging. Faster startup time, slower runtime, more GPU vRAM.", ) parser.add_argument( "--skip_xla", choices=["true"], help="For debugging. Faster startup time, slower runtime, more GPU vRAM.", ) parser.add_argument( "--eager", choices=["true"], help="For debugging. Faster launch, slower runtime, more GPU vRAM.", ) parser.add_argument( "--skip_sop", choices=["true"], help="Only use MLM loss, and exclude the SOP loss.", ) parser.add_argument( "--skip_mlm", choices=["true"], help="Only use SOP loss, and exclude the MLM loss.", ) parser.add_argument( "--pre_layer_norm", choices=["true"], help="Place layer normalization before the attention & FFN, rather than after adding the residual connection. https://openreview.net/pdf?id=B1x8anVFPr", ) parser.add_argument("--extra_squad_steps", type=str) parser.add_argument("--fast_squad", choices=["true"]) parser.add_argument("--dummy_eval", choices=["true"]) args = parser.parse_args() tf.random.set_seed(42) tf.autograph.set_verbosity(0) # Horovod init hvd.init() gpus = tf.config.list_physical_devices("GPU") for gpu in gpus: tf.config.experimental.set_memory_growth(gpu, True) if gpus: tf.config.set_visible_devices(gpus[hvd.local_rank()], "GPU") # XLA, AMP, AutoGraph parse_bool = lambda arg: arg == "true" tf.config.optimizer.set_jit(not parse_bool(args.skip_xla)) tf.config.optimizer.set_experimental_options( {"auto_mixed_precision": not parse_bool(args.skip_amp)} ) tf.config.experimental_run_functions_eagerly(parse_bool(args.eager)) main( fsx_prefix=args.fsx_prefix, model_type=args.model_type, model_size=args.model_size, batch_size=args.batch_size, max_seq_length=args.max_seq_length, gradient_accumulation_steps=args.gradient_accumulation_steps, optimizer=args.optimizer, name=args.name, learning_rate=args.learning_rate, end_learning_rate=args.end_learning_rate, warmup_steps=args.warmup_steps, total_steps=args.total_steps, skip_sop=parse_bool(args.skip_sop), skip_mlm=parse_bool(args.skip_mlm), pre_layer_norm=parse_bool(args.pre_layer_norm), fast_squad=parse_bool(args.fast_squad), dummy_eval=parse_bool(args.dummy_eval), squad_steps=get_squad_steps(args.extra_squad_steps), hidden_dropout_prob=args.hidden_dropout_prob, )
[ 1, 9995, 13, 284, 2151, 29899, 3188, 13, 29893, 336, 2986, 29918, 14968, 29918, 10568, 281, 29914, 29871, 29941, 29906, 29890, 3616, 29892, 29871, 29896, 5753, 29901, 29871, 29941, 29889, 29896, 29941, 372, 29914, 29879, 29936, 29871, 29941, 29889, 29945, 29896, 372, 29914, 29879, 13, 29893, 336, 2986, 7945, 29918, 10568, 281, 29914, 14993, 3262, 6410, 29914, 5753, 599, 17469, 29901, 1577, 372, 29914, 29879, 29892, 29871, 29941, 29889, 29945, 29946, 372, 29914, 29879, 13, 29893, 336, 2986, 7945, 29918, 10568, 281, 29914, 14993, 3262, 921, 433, 29901, 1577, 372, 29914, 29879, 29892, 29871, 29896, 29889, 29945, 29900, 372, 29914, 29879, 13, 29893, 336, 2986, 7945, 29918, 16175, 669, 21021, 29918, 497, 17469, 29901, 29871, 29906, 29889, 29929, 29929, 372, 29914, 29879, 29892, 29871, 29941, 29889, 29946, 29906, 372, 29914, 29879, 13, 13, 7976, 639, 29899, 29954, 7056, 9853, 2159, 313, 284, 2151, 1125, 13, 3188, 29901, 13, 29899, 29871, 29945, 29896, 29906, 11762, 29901, 29871, 29941, 29906, 373, 282, 29941, 5200, 281, 29914, 29871, 29906, 4656, 29918, 5753, 313, 29896, 29889, 29955, 29906, 372, 29914, 29879, 373, 323, 29943, 29906, 29889, 29896, 29892, 29871, 29896, 29889, 29947, 29906, 372, 29914, 29879, 2323, 29899, 3177, 511, 29871, 29896, 29953, 373, 282, 29941, 29896, 29953, 13, 16961, 29901, 13, 29899, 29871, 29945, 29896, 29906, 11762, 29901, 29871, 29896, 29953, 373, 282, 29941, 5200, 281, 29914, 29871, 29946, 4656, 29918, 5753, 313, 29900, 29889, 29953, 29900, 372, 29914, 29879, 373, 323, 29943, 29906, 29889, 29896, 29892, 29871, 29900, 29889, 29953, 29941, 372, 29914, 29879, 2323, 29899, 3177, 511, 29871, 29947, 373, 282, 29941, 29896, 29953, 13, 13, 7976, 639, 29899, 29954, 7056, 9853, 2159, 313, 2151, 1125, 13, 3188, 29901, 13, 29899, 29871, 29945, 29896, 29906, 11762, 29901, 29871, 29896, 29953, 373, 282, 29941, 5200, 281, 29914, 29871, 29946, 4656, 29918, 5753, 313, 29900, 29889, 29929, 29896, 372, 29914, 29879, 373, 323, 29943, 29871, 29906, 29889, 29896, 29892, 29871, 29896, 29889, 29941, 29896, 372, 29914, 29879, 2323, 29899, 3177, 29897, 13, 16961, 29901, 13, 29899, 29871, 29945, 29896, 29906, 11762, 29901, 29871, 29947, 373, 282, 29941, 5200, 281, 29914, 29871, 29947, 4656, 29918, 5753, 313, 29900, 29889, 29941, 29896, 372, 29914, 29879, 373, 323, 29943, 29871, 29906, 29889, 29896, 29892, 29871, 29900, 29889, 29946, 29955, 372, 29914, 29879, 2323, 29899, 3177, 29897, 13, 13, 29909, 6694, 1065, 310, 29871, 29896, 29906, 29945, 29895, 6576, 338, 29871, 29896, 29906, 29945, 29895, 14571, 29896, 29889, 29955, 29906, 334, 29871, 29941, 29953, 29900, 29900, 29897, 3695, 29922, 29871, 29906, 29900, 6199, 363, 2967, 16370, 373, 29871, 29945, 29896, 29906, 11762, 29889, 13, 15945, 29908, 13, 13, 13, 5215, 1852, 5510, 13, 5215, 12865, 13, 5215, 13149, 13, 5215, 12183, 13, 5215, 5844, 13, 5215, 2897, 13, 3166, 5694, 1445, 1053, 6789, 1971, 653, 9882, 13, 3166, 19229, 1053, 2391, 13, 13, 5215, 26110, 408, 15886, 13, 5215, 260, 29939, 18933, 13, 3166, 1065, 29918, 29879, 3425, 1053, 1065, 29918, 29879, 3425, 29918, 392, 29918, 657, 29918, 9902, 13, 3166, 26110, 29918, 1202, 787, 29889, 20640, 19427, 1053, 365, 5194, 29933, 29892, 11783, 29956, 13, 3166, 4327, 414, 1053, 313, 29871, 396, 19295, 993, 7504, 398, 9183, 29892, 13, 1678, 11133, 3991, 29892, 13, 1678, 323, 29943, 2499, 2151, 2831, 19832, 287, 26369, 29892, 13, 1678, 323, 29943, 2499, 2151, 3195, 29892, 13, 1678, 323, 4519, 3066, 3195, 2831, 6572, 5323, 2827, 29892, 13, 1678, 323, 18426, 814, 2831, 6572, 5323, 2827, 29892, 13, 29897, 13, 13, 3166, 16030, 29918, 5753, 398, 9183, 1053, 19295, 993, 7504, 398, 9183, 13, 3166, 6509, 29918, 10492, 29918, 816, 287, 2540, 1053, 22985, 29956, 2817, 786, 12697, 6185, 388, 4504, 11272, 13, 3166, 3667, 29879, 1053, 679, 29918, 6979, 3950, 29892, 337, 6312, 29918, 13264, 29918, 2220, 13, 13, 29937, 2823, 2045, 597, 3292, 29889, 510, 29914, 29882, 688, 3460, 2161, 29914, 9067, 414, 29914, 12175, 29914, 29941, 29955, 29947, 29906, 29936, 445, 1053, 1818, 2041, 1833, 13, 5215, 4029, 586, 397, 29889, 29056, 408, 298, 27491, 29871, 396, 338, 441, 29901, 11014, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 11705, 29918, 2248, 267, 29898, 16506, 29918, 20158, 29901, 14704, 16175, 29892, 11762, 29918, 2848, 29892, 2103, 29962, 613, 11909, 29897, 1599, 15886, 29889, 29911, 6073, 29901, 13, 1678, 9995, 29954, 19467, 278, 12047, 472, 278, 2702, 11909, 975, 263, 1375, 747, 905, 1213, 15945, 13, 1678, 5665, 29918, 12181, 353, 5665, 29918, 20158, 29889, 12181, 29889, 294, 29918, 1761, 580, 13, 1678, 9853, 29918, 2311, 353, 5665, 29918, 12181, 29961, 29900, 29962, 13, 1678, 19359, 29918, 2848, 353, 5665, 29918, 12181, 29961, 29896, 29962, 13, 1678, 2920, 353, 5665, 29918, 12181, 29961, 29906, 29962, 13, 13, 1678, 12151, 29918, 2696, 7224, 353, 15886, 29889, 690, 14443, 29898, 13264, 29889, 3881, 29898, 29900, 29892, 9853, 29918, 2311, 29892, 26688, 29922, 13264, 29889, 524, 29953, 29946, 29897, 334, 19359, 29918, 2848, 29892, 21069, 29896, 29892, 29871, 29896, 2314, 13, 1678, 12151, 29918, 1066, 2187, 353, 15886, 29889, 690, 14443, 29898, 1066, 2187, 718, 12151, 29918, 2696, 7224, 29892, 21069, 29896, 2314, 13, 1678, 12151, 29918, 16506, 29918, 20158, 353, 15886, 29889, 690, 14443, 29898, 16506, 29918, 20158, 29892, 518, 16175, 29918, 2311, 334, 19359, 29918, 2848, 29892, 2920, 2314, 13, 1678, 1962, 29918, 20158, 353, 15886, 29889, 29887, 1624, 29898, 20620, 29918, 16506, 29918, 20158, 29892, 12151, 29918, 1066, 2187, 29897, 13, 1678, 1962, 29918, 20158, 353, 15886, 29889, 690, 14443, 29898, 4905, 29918, 20158, 29892, 518, 16175, 29918, 2311, 29892, 448, 29896, 29892, 2920, 2314, 13, 1678, 736, 1962, 29918, 20158, 13, 13, 13, 1753, 11705, 29918, 2248, 267, 29918, 29906, 29881, 29898, 16506, 29918, 20158, 29901, 14704, 16175, 29892, 11762, 29918, 2848, 29892, 2103, 29962, 613, 11909, 29897, 1599, 15886, 29889, 29911, 6073, 29901, 13, 1678, 5665, 29918, 12181, 353, 5665, 29918, 20158, 29889, 12181, 29889, 294, 29918, 1761, 580, 13, 1678, 9853, 29918, 2311, 353, 5665, 29918, 12181, 29961, 29900, 29962, 13, 1678, 19359, 29918, 2848, 353, 5665, 29918, 12181, 29961, 29896, 29962, 13, 13, 1678, 12151, 29918, 2696, 7224, 353, 15886, 29889, 690, 14443, 29898, 13264, 29889, 3881, 29898, 29900, 29892, 9853, 29918, 2311, 29892, 26688, 29922, 13264, 29889, 524, 29953, 29946, 29897, 334, 19359, 29918, 2848, 29892, 21069, 29896, 29892, 29871, 29896, 2314, 13, 1678, 12151, 29918, 1066, 2187, 353, 15886, 29889, 690, 14443, 29898, 1066, 2187, 718, 12151, 29918, 2696, 7224, 29892, 21069, 29896, 2314, 13, 1678, 12151, 29918, 16506, 29918, 20158, 353, 15886, 29889, 690, 14443, 29898, 16506, 29918, 20158, 29892, 518, 16175, 29918, 2311, 334, 19359, 29918, 2848, 2314, 13, 1678, 1962, 29918, 20158, 353, 15886, 29889, 29887, 1624, 29898, 20620, 29918, 16506, 29918, 20158, 29892, 12151, 29918, 1066, 2187, 29897, 13, 1678, 1962, 29918, 20158, 353, 15886, 29889, 690, 14443, 29898, 4905, 29918, 20158, 29892, 518, 16175, 29918, 2311, 29892, 448, 29896, 2314, 13, 1678, 736, 1962, 29918, 20158, 13, 13, 13, 1753, 679, 29918, 828, 29885, 29918, 24713, 29898, 13, 1678, 334, 29892, 13, 1678, 977, 264, 1280, 29901, 2391, 29961, 710, 1402, 13, 1678, 4236, 29918, 11762, 29918, 2848, 29901, 938, 29892, 13, 1678, 4236, 29918, 27711, 1080, 29918, 546, 29918, 11762, 29901, 938, 29892, 13, 1678, 9853, 29918, 2311, 29901, 938, 29892, 13, 1678, 6835, 29918, 2311, 29901, 938, 353, 29871, 29896, 29900, 29900, 29900, 29892, 13, 29897, 1599, 15886, 29889, 1272, 29889, 16390, 24541, 29901, 13, 1678, 9995, 7523, 29879, 278, 8783, 515, 323, 29943, 4789, 4339, 322, 3639, 372, 29889, 9995, 13, 13, 1678, 822, 903, 5510, 29918, 2220, 29898, 4773, 29918, 17529, 1125, 13, 4706, 396, 20969, 278, 1881, 421, 13264, 29889, 14023, 29952, 17814, 773, 278, 8600, 2038, 29889, 13, 4706, 736, 15886, 29889, 601, 29889, 5510, 29918, 14369, 29918, 4773, 29898, 4773, 29918, 17529, 29892, 1024, 29918, 517, 29918, 22100, 29897, 13, 13, 1678, 1024, 29918, 517, 29918, 22100, 353, 426, 13, 4706, 376, 2080, 29918, 4841, 1115, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 3317, 29918, 11762, 29918, 2848, 1402, 15886, 29889, 524, 29953, 29946, 511, 29871, 396, 16161, 304, 1881, 29918, 4841, 13, 4706, 376, 2080, 29918, 13168, 1115, 15886, 29889, 601, 29889, 26262, 21515, 19132, 29898, 13, 9651, 518, 3317, 29918, 11762, 29918, 2848, 1402, 15886, 29889, 524, 29953, 29946, 13, 4706, 10353, 29871, 396, 16161, 304, 8570, 29918, 13168, 13, 4706, 376, 28192, 29918, 4841, 1115, 15886, 29889, 601, 29889, 26262, 21515, 19132, 29898, 13, 9651, 518, 3317, 29918, 11762, 29918, 2848, 1402, 15886, 29889, 524, 29953, 29946, 13, 4706, 10353, 29871, 396, 16161, 304, 5993, 29918, 1853, 29918, 4841, 13, 4706, 376, 13168, 287, 29918, 21457, 29918, 1066, 2187, 1115, 15886, 29889, 601, 29889, 26262, 21515, 19132, 29898, 13, 9651, 518, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 1402, 15886, 29889, 524, 29953, 29946, 13, 4706, 10353, 29871, 396, 450, 1353, 297, 278, 5665, 393, 338, 11105, 287, 29892, 297, 3464, 518, 29900, 29892, 4236, 29918, 11762, 29918, 2848, 1822, 29871, 29900, 1804, 11057, 263, 17132, 29889, 13, 4706, 376, 13168, 287, 29918, 21457, 29918, 4841, 1115, 15886, 29889, 601, 29889, 26262, 21515, 19132, 29898, 13, 9651, 518, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 1402, 15886, 29889, 524, 29953, 29946, 13, 4706, 10353, 29871, 396, 450, 5993, 1178, 393, 338, 11105, 287, 29892, 297, 3464, 518, 29900, 29892, 7931, 370, 29918, 2311, 1822, 29871, 29900, 1804, 11057, 263, 17132, 29889, 13, 4706, 376, 13168, 287, 29918, 21457, 29918, 705, 5861, 1115, 15886, 29889, 601, 29889, 26262, 21515, 19132, 29898, 13, 9651, 518, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 1402, 15886, 29889, 7411, 29941, 29906, 13, 4706, 10353, 29871, 396, 29871, 29896, 565, 5407, 29892, 29871, 29900, 1804, 11057, 263, 17132, 5993, 13, 4706, 376, 4622, 29918, 18616, 663, 29918, 21134, 1115, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 29896, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 1678, 500, 13, 13, 1678, 396, 8741, 1881, 16439, 1244, 29901, 2045, 597, 3292, 29889, 510, 29914, 29940, 13044, 10764, 29914, 2772, 1022, 29931, 799, 1076, 1252, 9422, 29914, 10054, 29914, 6207, 29914, 29911, 6073, 17907, 29914, 21233, 3195, 292, 29914, 13635, 29911, 29914, 3389, 29918, 1457, 26495, 29889, 2272, 29937, 29931, 29946, 29946, 29941, 13, 1678, 396, 29871, 29906, 29900, 29946, 29947, 323, 29943, 9182, 2066, 1244, 13, 1678, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 4706, 17927, 29889, 3888, 29898, 29888, 29908, 16390, 24541, 3309, 426, 2435, 29898, 1777, 264, 1280, 2915, 1159, 13, 4706, 17927, 29889, 8382, 29898, 1777, 264, 1280, 29897, 13, 4706, 4974, 7431, 29898, 1777, 264, 1280, 29897, 1405, 29871, 29900, 29892, 285, 29908, 3434, 264, 1280, 338, 385, 4069, 1051, 29908, 13, 1678, 396, 1383, 538, 322, 528, 21897, 278, 977, 264, 1280, 13, 1678, 8783, 353, 15886, 29889, 1272, 29889, 16390, 24541, 29889, 3166, 29918, 20158, 29918, 29879, 29399, 29898, 1777, 264, 1280, 29897, 13, 1678, 8783, 353, 8783, 29889, 845, 538, 29898, 29882, 27491, 29889, 2311, 3285, 298, 27491, 29889, 10003, 3101, 13, 1678, 8783, 353, 8783, 29889, 845, 21897, 29898, 9040, 29918, 2311, 29922, 2435, 29898, 1777, 264, 1280, 511, 620, 29882, 21897, 29918, 4204, 29918, 1524, 362, 29922, 5574, 29897, 13, 1678, 8783, 353, 8783, 29889, 14358, 580, 13, 13, 1678, 396, 421, 23090, 29918, 2848, 29952, 338, 278, 1353, 310, 8943, 2066, 393, 679, 1303, 13, 1678, 954, 29918, 21970, 29918, 28993, 353, 29871, 29906, 334, 29871, 29929, 29953, 13, 1678, 11412, 29918, 2848, 353, 1375, 29898, 1949, 29918, 21970, 29918, 28993, 29892, 7431, 29898, 1777, 264, 1280, 876, 13, 1678, 396, 934, 29918, 517, 29918, 24713, 29918, 9891, 353, 14013, 934, 29901, 15886, 29889, 1272, 29889, 8969, 9182, 16390, 24541, 29898, 1445, 467, 1958, 7373, 5510, 29918, 2220, 29897, 13, 1678, 934, 29918, 517, 29918, 24713, 29918, 9891, 353, 14013, 934, 29901, 15886, 29889, 1272, 29889, 8969, 9182, 16390, 24541, 29898, 1445, 29897, 13, 1678, 8783, 353, 8783, 29889, 1639, 280, 1351, 29898, 13, 4706, 934, 29918, 517, 29918, 24713, 29918, 9891, 29892, 13, 4706, 11412, 29918, 2848, 29922, 23090, 29918, 2848, 29892, 13, 4706, 2908, 29918, 2848, 29922, 29896, 29892, 13, 4706, 954, 29918, 23482, 29918, 29883, 4293, 29922, 23090, 29918, 2848, 29892, 13, 1678, 1723, 13, 1678, 396, 7315, 322, 9853, 674, 367, 6336, 285, 3880, 4208, 29892, 1074, 2045, 597, 1636, 29889, 29056, 29889, 990, 29914, 2754, 29918, 2640, 29914, 4691, 29914, 13264, 29914, 1272, 29914, 735, 27910, 29914, 1958, 29918, 392, 29918, 16175, 13, 1678, 8783, 353, 8783, 29889, 1958, 7373, 5510, 29918, 2220, 29892, 954, 29918, 23482, 29918, 29883, 4293, 29922, 1949, 29918, 21970, 29918, 28993, 29897, 13, 1678, 8783, 353, 8783, 29889, 845, 21897, 29898, 9040, 29918, 2311, 29922, 9040, 29918, 2311, 29892, 620, 29882, 21897, 29918, 4204, 29918, 1524, 362, 29922, 5574, 29897, 13, 1678, 8783, 353, 8783, 29889, 16175, 29898, 16175, 29918, 2311, 29892, 5768, 29918, 1745, 475, 672, 29922, 5574, 29897, 13, 1678, 396, 1383, 21897, 278, 9853, 267, 322, 758, 9155, 777, 9853, 267, 13, 1678, 8783, 353, 8783, 29889, 845, 21897, 29898, 9040, 29918, 2311, 29922, 9040, 29918, 2311, 29892, 620, 29882, 21897, 29918, 4204, 29918, 1524, 362, 29922, 5574, 29897, 13, 13, 1678, 736, 8783, 13, 13, 13, 1753, 286, 21457, 29918, 6758, 29918, 9144, 29898, 13, 1678, 18988, 29918, 1188, 1169, 29901, 14704, 16175, 29892, 4236, 29918, 11762, 29918, 2435, 313, 29945, 29896, 29906, 511, 7931, 370, 29918, 2311, 29962, 613, 13, 1678, 3858, 29918, 1066, 2187, 29901, 14704, 16175, 29892, 954, 29918, 13168, 29879, 313, 29906, 29900, 4638, 613, 13, 1678, 3858, 29918, 4841, 29901, 14704, 16175, 29892, 954, 29918, 13168, 29879, 313, 29906, 29900, 4638, 613, 13, 1678, 3858, 29918, 705, 5861, 29901, 14704, 16175, 29892, 954, 29918, 13168, 29879, 313, 29906, 29900, 4638, 613, 13, 1125, 13, 1678, 9995, 3858, 29918, 705, 5861, 338, 2845, 29871, 29896, 470, 29871, 29900, 29892, 29871, 29900, 6593, 11105, 287, 29889, 9995, 13, 1678, 1480, 1169, 29918, 271, 29918, 1066, 2187, 353, 11705, 29918, 2248, 267, 29898, 13, 4706, 18988, 29918, 1188, 1169, 29892, 3858, 29918, 1066, 2187, 13, 1678, 1723, 29871, 396, 518, 29890, 29892, 954, 29918, 13168, 29879, 29892, 7931, 370, 29918, 2311, 29962, 13, 1678, 4450, 29879, 29918, 271, 29918, 1066, 2187, 353, 15886, 29889, 755, 29889, 1191, 3317, 29898, 1188, 1169, 29918, 271, 29918, 1066, 2187, 29892, 448, 29896, 29897, 29871, 396, 518, 29890, 29892, 954, 29918, 13168, 29879, 29962, 13, 13, 1678, 14267, 1061, 353, 15886, 29889, 17469, 29918, 2083, 29898, 1643, 29918, 705, 5861, 29897, 718, 29871, 29896, 29872, 29899, 29945, 13, 13, 1678, 4891, 29918, 296, 14441, 29918, 546, 29918, 6979, 353, 3858, 29918, 705, 5861, 334, 15886, 29889, 15755, 29889, 29879, 5510, 29918, 2695, 3317, 29918, 19128, 29918, 296, 14441, 29918, 2541, 29918, 1188, 1169, 29898, 13, 4706, 11073, 29922, 1643, 29918, 4841, 29892, 1480, 1169, 29922, 1188, 1169, 29918, 271, 29918, 1066, 2187, 13, 1678, 1723, 29871, 396, 518, 29890, 29892, 954, 29918, 13168, 29879, 29962, 13, 1678, 4891, 29918, 296, 14441, 29918, 8058, 1061, 353, 15886, 29889, 17469, 29918, 2083, 29898, 19128, 29918, 296, 14441, 29918, 546, 29918, 6979, 29897, 29871, 396, 518, 29896, 29962, 13, 13, 1678, 13600, 29918, 546, 29918, 6979, 353, 3858, 29918, 705, 5861, 334, 15886, 29889, 4384, 29898, 13, 4706, 15886, 29889, 755, 29889, 11745, 29898, 1643, 29918, 4841, 29892, 4450, 29879, 29918, 271, 29918, 1066, 2187, 511, 15886, 29889, 7411, 29941, 29906, 13, 1678, 1723, 29871, 396, 518, 29890, 29892, 954, 29918, 517, 12360, 29962, 13, 1678, 13600, 29918, 8058, 1061, 353, 15886, 29889, 17469, 29918, 2083, 29898, 562, 2764, 4135, 29918, 546, 29918, 6979, 29897, 29871, 396, 518, 29896, 29962, 13, 13, 1678, 4891, 29918, 296, 14441, 353, 4891, 29918, 296, 14441, 29918, 8058, 1061, 847, 14267, 1061, 13, 1678, 13600, 353, 13600, 29918, 8058, 1061, 847, 14267, 1061, 13, 13, 1678, 736, 4891, 29918, 296, 14441, 29892, 13600, 13, 13, 13, 1753, 12103, 29918, 6758, 29918, 9144, 29898, 13, 1678, 18988, 29918, 1188, 1169, 29901, 14704, 29890, 29892, 29871, 29906, 29962, 613, 2446, 29918, 18616, 663, 29918, 21134, 29901, 14704, 29890, 29892, 29871, 29896, 29962, 613, 13, 1125, 13, 1678, 9995, 3940, 393, 445, 1736, 363, 2845, 3865, 29925, 470, 317, 4590, 29892, 278, 4328, 338, 297, 920, 848, 338, 5759, 29889, 13, 1678, 1334, 864, 304, 671, 317, 4590, 12091, 29889, 13, 1678, 9995, 13, 1678, 3858, 29918, 509, 2806, 353, 15886, 29889, 29879, 802, 29872, 911, 29898, 4622, 29918, 18616, 663, 29918, 21134, 29897, 29871, 396, 518, 29890, 29962, 13, 1678, 3858, 29918, 11965, 29879, 353, 15886, 29889, 755, 29889, 1191, 3317, 29898, 11965, 2463, 29918, 1188, 1169, 29892, 448, 29896, 29897, 29871, 396, 518, 29890, 29962, 13, 13, 1678, 4891, 29918, 296, 14441, 29918, 16175, 353, 15886, 29889, 15755, 29889, 29879, 5510, 29918, 2695, 3317, 29918, 19128, 29918, 296, 14441, 29918, 2541, 29918, 1188, 1169, 29898, 13, 4706, 11073, 29922, 1643, 29918, 509, 2806, 29892, 1480, 1169, 29922, 11965, 2463, 29918, 1188, 1169, 13, 1678, 1723, 29871, 396, 518, 29890, 29962, 13, 1678, 13600, 29918, 16175, 353, 15886, 29889, 4384, 29898, 13264, 29889, 755, 29889, 11745, 29898, 1643, 29918, 509, 2806, 29892, 3858, 29918, 11965, 29879, 511, 15886, 29889, 7411, 29896, 29953, 29897, 29871, 396, 518, 29890, 29962, 13, 13, 1678, 4891, 29918, 296, 14441, 353, 15886, 29889, 17469, 29918, 12676, 29898, 19128, 29918, 296, 14441, 29918, 16175, 29897, 29871, 396, 518, 29896, 29962, 13, 1678, 13600, 353, 15886, 29889, 17469, 29918, 12676, 29898, 562, 2764, 4135, 29918, 16175, 29897, 29871, 396, 518, 29890, 29962, 13, 1678, 736, 4891, 29918, 296, 14441, 29892, 13600, 13, 13, 13, 1753, 7945, 29918, 16175, 29898, 13, 1678, 334, 29892, 13, 1678, 1904, 29892, 13, 1678, 3523, 29892, 13, 1678, 16030, 29918, 5753, 398, 9183, 29892, 13, 1678, 1881, 29918, 4841, 29892, 13, 1678, 8570, 29918, 13168, 29892, 13, 1678, 5993, 29918, 1853, 29918, 4841, 29892, 13, 1678, 3858, 29918, 1066, 2187, 29892, 13, 1678, 3858, 29918, 4841, 29892, 13, 1678, 3858, 29918, 705, 5861, 29892, 13, 1678, 2446, 29918, 18616, 663, 29918, 21134, 29892, 13, 1678, 14383, 29918, 29879, 459, 29901, 6120, 29892, 13, 1678, 14383, 29918, 828, 29885, 29901, 6120, 29892, 13, 1125, 13, 1678, 411, 15886, 29889, 25584, 993, 29911, 4085, 580, 408, 260, 4085, 29901, 13, 4706, 1881, 29918, 8977, 353, 426, 13, 9651, 376, 2080, 29918, 4841, 1115, 1881, 29918, 4841, 29892, 13, 9651, 376, 1131, 2509, 29918, 13168, 1115, 8570, 29918, 13168, 29892, 13, 9651, 376, 6979, 29918, 1853, 29918, 4841, 1115, 5993, 29918, 1853, 29918, 4841, 29892, 13, 4706, 500, 13, 4706, 286, 21457, 29918, 1188, 1169, 29892, 12103, 29918, 1188, 1169, 29892, 7934, 29918, 28631, 353, 1904, 29898, 2080, 29918, 8977, 29892, 6694, 29922, 5574, 29897, 13, 13, 4706, 396, 23158, 29924, 13944, 13, 4706, 565, 14383, 29918, 828, 29885, 29901, 13, 9651, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 353, 15886, 29889, 23362, 29898, 29900, 29889, 29900, 511, 15886, 29889, 23362, 29898, 29900, 29889, 29900, 29897, 13, 4706, 1683, 29901, 13, 9651, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 353, 286, 21457, 29918, 6758, 29918, 9144, 29898, 13, 18884, 18988, 29918, 1188, 1169, 29922, 828, 29885, 29918, 1188, 1169, 29892, 13, 18884, 3858, 29918, 1066, 2187, 29922, 1643, 29918, 1066, 2187, 29892, 13, 18884, 3858, 29918, 4841, 29922, 1643, 29918, 4841, 29892, 13, 18884, 3858, 29918, 705, 5861, 29922, 1643, 29918, 705, 5861, 29892, 13, 9651, 1723, 13, 4706, 396, 317, 4590, 13944, 13, 4706, 565, 14383, 29918, 29879, 459, 29901, 13, 9651, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 353, 15886, 29889, 23362, 29898, 29900, 29889, 29900, 511, 15886, 29889, 23362, 29898, 29900, 29889, 29900, 29897, 13, 4706, 1683, 29901, 13, 9651, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 353, 12103, 29918, 6758, 29918, 9144, 29898, 13, 18884, 18988, 29918, 1188, 1169, 29922, 29879, 459, 29918, 1188, 1169, 29892, 2446, 29918, 18616, 663, 29918, 21134, 29922, 4622, 29918, 18616, 663, 29918, 21134, 13, 9651, 1723, 13, 4706, 6410, 353, 15886, 29889, 4384, 29898, 828, 29885, 29918, 6758, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 29897, 718, 15886, 29889, 4384, 29898, 13, 9651, 12103, 29918, 6758, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 13, 4706, 1723, 29871, 396, 10575, 727, 367, 263, 10825, 373, 697, 310, 1438, 29973, 13, 4706, 6287, 29881, 29918, 6758, 353, 3523, 29889, 657, 29918, 7052, 29881, 29918, 6758, 29898, 6758, 29897, 13, 13, 1678, 6287, 29881, 29918, 5105, 29879, 353, 260, 4085, 29889, 24970, 29898, 7052, 29881, 29918, 6758, 29892, 1904, 29889, 14968, 519, 29918, 20897, 29897, 13, 1678, 4331, 29918, 5105, 29879, 353, 3523, 29889, 657, 29918, 348, 7052, 29881, 29918, 5105, 10070, 29898, 7052, 29881, 29918, 5105, 29879, 29897, 13, 1678, 16030, 29918, 5753, 398, 9183, 29898, 10568, 29918, 5105, 29879, 29897, 13, 1678, 736, 6410, 29892, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 29892, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 13, 13, 13, 1753, 599, 17469, 29898, 4299, 29892, 3523, 29892, 16030, 29918, 5753, 398, 9183, 29892, 6410, 29892, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 29892, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 1125, 13, 1678, 4656, 29879, 353, 16030, 29918, 5753, 398, 9183, 29889, 5105, 10070, 13, 1678, 396, 910, 29892, 607, 338, 7126, 304, 29234, 29918, 294, 29918, 1145, 344, 29922, 5574, 29892, 4076, 263, 286, 789, 29871, 29906, 29995, 6210, 786, 515, 29871, 29900, 29889, 29953, 29906, 372, 29914, 29879, 304, 29871, 29900, 29889, 29953, 29941, 372, 29914, 29879, 13, 1678, 396, 373, 29876, 350, 20161, 29899, 16961, 1773, 262, 356, 29889, 13, 1678, 4656, 29879, 353, 518, 13, 4706, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 5105, 29897, 13, 4706, 565, 4656, 338, 451, 6213, 322, 338, 8758, 29898, 5105, 29892, 15886, 29889, 3220, 287, 29903, 29399, 29897, 13, 4706, 1683, 4656, 13, 4706, 363, 4656, 297, 4656, 29879, 13, 1678, 4514, 13, 13, 1678, 396, 14402, 29901, 5538, 24421, 445, 20102, 1434, 470, 1156, 599, 17469, 6602, 13600, 29973, 13, 1678, 396, 13494, 3277, 1434, 756, 263, 4943, 2133, 2779, 29892, 694, 2323, 1342, 508, 29126, 408, 1568, 29889, 13, 1678, 396, 13494, 3277, 1434, 884, 4076, 263, 29871, 29906, 29900, 29995, 6210, 786, 746, 6694, 350, 20161, 29899, 16961, 29892, 3117, 1363, 278, 13, 1678, 396, 16030, 6931, 508, 367, 285, 3880, 491, 1060, 4375, 29889, 13, 1678, 313, 5105, 29879, 29892, 4656, 29918, 12324, 29897, 353, 15886, 29889, 24049, 29918, 1609, 29918, 10945, 29918, 12324, 29898, 5105, 29879, 29892, 20102, 29918, 12324, 29922, 5085, 29889, 3317, 29918, 5105, 29918, 12324, 29897, 13, 13, 1678, 4656, 29879, 353, 518, 13, 4706, 298, 27491, 29889, 497, 17469, 29898, 5105, 29892, 24221, 29922, 29882, 27491, 29889, 1523, 2590, 29889, 18091, 29896, 29953, 29897, 565, 4656, 338, 451, 6213, 1683, 6213, 13, 4706, 363, 4656, 297, 4656, 29879, 13, 1678, 4514, 13, 13, 1678, 3523, 29889, 7302, 29918, 5105, 10070, 29898, 13, 4706, 17288, 5105, 29892, 722, 29897, 363, 313, 5105, 29892, 722, 29897, 297, 14319, 29898, 5105, 29879, 29892, 1904, 29889, 14968, 519, 29918, 20897, 29897, 565, 4656, 338, 451, 6213, 29962, 13, 1678, 1723, 13, 13, 1678, 396, 17732, 278, 16030, 18414, 9183, 13, 1678, 16030, 29918, 5753, 398, 9183, 29889, 12071, 580, 13, 13, 1678, 6410, 353, 298, 27491, 29889, 497, 17469, 29898, 6758, 29897, 13, 1678, 286, 21457, 29918, 6758, 353, 298, 27491, 29889, 497, 17469, 29898, 828, 29885, 29918, 6758, 29897, 13, 1678, 286, 21457, 29918, 5753, 353, 298, 27491, 29889, 497, 17469, 29898, 828, 29885, 29918, 5753, 29897, 13, 1678, 12103, 29918, 6758, 353, 298, 27491, 29889, 497, 17469, 29898, 29879, 459, 29918, 6758, 29897, 13, 1678, 12103, 29918, 5753, 353, 298, 27491, 29889, 497, 17469, 29898, 29879, 459, 29918, 5753, 29897, 13, 13, 1678, 736, 6410, 29892, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 29892, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 29892, 4656, 29918, 12324, 13, 13, 13, 29937, 450, 18046, 29880, 1600, 384, 338, 1244, 29892, 1951, 1269, 2943, 756, 29871, 29896, 29900, 4406, 29933, 29914, 29879, 349, 8426, 1549, 649, 29892, 18414, 18099, 278, 4656, 10070, 13, 29937, 373, 278, 10808, 29889, 960, 727, 29915, 29879, 263, 982, 304, 18414, 5987, 4656, 10070, 373, 278, 22796, 1728, 2805, 438, 6488, 29892, 1235, 29915, 29879, 1284, 372, 29991, 13, 1753, 7945, 29918, 10568, 29898, 13, 1678, 1904, 29892, 13, 1678, 3523, 29892, 13, 1678, 16030, 29918, 5753, 398, 9183, 29892, 13, 1678, 9853, 29892, 13, 1678, 16030, 29918, 5753, 398, 2785, 29918, 24530, 29901, 938, 29892, 13, 1678, 14383, 29918, 29879, 459, 29901, 6120, 29892, 13, 1678, 14383, 29918, 828, 29885, 29901, 6120, 29892, 13, 1125, 13, 1678, 396, 23158, 29924, 3913, 1833, 29918, 10892, 29918, 3859, 29892, 1550, 317, 4590, 3913, 11565, 261, 29918, 4905, 13, 1678, 396, 365, 2209, 338, 5785, 29892, 1035, 338, 4203, 13, 1678, 3001, 29918, 6758, 29892, 3001, 29918, 828, 29885, 29918, 6758, 29892, 3001, 29918, 828, 29885, 29918, 5753, 29892, 3001, 29918, 29879, 459, 29918, 6758, 29892, 3001, 29918, 29879, 459, 29918, 5753, 353, 313, 13, 4706, 15886, 29889, 23362, 29898, 29900, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 511, 13, 4706, 15886, 29889, 23362, 29898, 29900, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 511, 13, 4706, 15886, 29889, 23362, 29898, 29900, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 511, 13, 4706, 15886, 29889, 23362, 29898, 29900, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 511, 13, 4706, 15886, 29889, 23362, 29898, 29900, 29892, 26688, 29922, 13264, 29889, 7411, 29896, 29953, 511, 13, 1678, 1723, 13, 1678, 363, 4331, 297, 3464, 29898, 24970, 29918, 5753, 398, 2785, 29918, 24530, 1125, 13, 4706, 6410, 29892, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 29892, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 353, 7945, 29918, 16175, 29898, 13, 9651, 1904, 29922, 4299, 29892, 13, 9651, 3523, 29922, 3670, 29892, 13, 9651, 16030, 29918, 5753, 398, 9183, 29922, 24970, 29918, 5753, 398, 9183, 29892, 13, 9651, 1881, 29918, 4841, 29922, 16175, 3366, 2080, 29918, 4841, 3108, 29961, 10568, 1402, 13, 9651, 8570, 29918, 13168, 29922, 16175, 3366, 2080, 29918, 13168, 3108, 29961, 10568, 1402, 13, 9651, 5993, 29918, 1853, 29918, 4841, 29922, 16175, 3366, 28192, 29918, 4841, 3108, 29961, 10568, 1402, 13, 9651, 3858, 29918, 1066, 2187, 29922, 16175, 3366, 13168, 287, 29918, 21457, 29918, 1066, 2187, 3108, 29961, 10568, 1402, 13, 9651, 3858, 29918, 4841, 29922, 16175, 3366, 13168, 287, 29918, 21457, 29918, 4841, 3108, 29961, 10568, 1402, 13, 9651, 3858, 29918, 705, 5861, 29922, 16175, 3366, 13168, 287, 29918, 21457, 29918, 705, 5861, 3108, 29961, 10568, 1402, 13, 9651, 2446, 29918, 18616, 663, 29918, 21134, 29922, 16175, 3366, 4622, 29918, 18616, 663, 29918, 21134, 3108, 29961, 10568, 1402, 13, 9651, 14383, 29918, 29879, 459, 29922, 11014, 29918, 29879, 459, 29892, 13, 9651, 14383, 29918, 828, 29885, 29922, 11014, 29918, 828, 29885, 29892, 13, 4706, 1723, 13, 4706, 3001, 29918, 6758, 4619, 6410, 13, 4706, 3001, 29918, 828, 29885, 29918, 6758, 4619, 286, 21457, 29918, 6758, 13, 4706, 3001, 29918, 828, 29885, 29918, 5753, 4619, 15886, 29889, 4384, 29898, 828, 29885, 29918, 5753, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 13, 4706, 3001, 29918, 29879, 459, 29918, 6758, 4619, 12103, 29918, 6758, 13, 4706, 3001, 29918, 29879, 459, 29918, 5753, 4619, 15886, 29889, 4384, 29898, 29879, 459, 29918, 5753, 29892, 15886, 29889, 7411, 29896, 29953, 29897, 13, 13, 1678, 3001, 29918, 6758, 847, 29922, 16030, 29918, 5753, 398, 2785, 29918, 24530, 13, 1678, 3001, 29918, 828, 29885, 29918, 6758, 847, 29922, 16030, 29918, 5753, 398, 2785, 29918, 24530, 13, 1678, 3001, 29918, 828, 29885, 29918, 5753, 847, 29922, 16030, 29918, 5753, 398, 2785, 29918, 24530, 13, 1678, 3001, 29918, 29879, 459, 29918, 6758, 847, 29922, 16030, 29918, 5753, 398, 2785, 29918, 24530, 13, 1678, 3001, 29918, 29879, 459, 29918, 5753, 847, 29922, 16030, 29918, 5753, 398, 2785, 29918, 24530, 13, 13, 1678, 736, 29918, 23583, 353, 599, 17469, 29898, 13, 4706, 1904, 29922, 4299, 29892, 13, 4706, 3523, 29922, 3670, 29892, 13, 4706, 16030, 29918, 5753, 398, 9183, 29922, 24970, 29918, 5753, 398, 9183, 29892, 13, 4706, 6410, 29922, 7827, 29918, 6758, 29892, 13, 4706, 286, 21457, 29918, 6758, 29922, 7827, 29918, 828, 29885, 29918, 6758, 29892, 13, 4706, 286, 21457, 29918, 5753, 29922, 7827, 29918, 828, 29885, 29918, 5753, 29892, 13, 4706, 12103, 29918, 6758, 29922, 7827, 29918, 29879, 459, 29918, 6758, 29892, 13, 4706, 12103, 29918, 5753, 29922, 7827, 29918, 29879, 459, 29918, 5753, 29892, 13, 1678, 1723, 13, 1678, 736, 736, 29918, 23583, 13, 13, 13, 1753, 8845, 29918, 16175, 29898, 4299, 29892, 9853, 29892, 14383, 29918, 828, 29885, 29901, 6120, 29892, 14383, 29918, 29879, 459, 29901, 6120, 1125, 13, 1678, 1881, 29918, 4841, 353, 9853, 3366, 2080, 29918, 4841, 3108, 13, 1678, 8570, 29918, 13168, 353, 9853, 3366, 2080, 29918, 13168, 3108, 13, 1678, 5993, 29918, 1853, 29918, 4841, 353, 9853, 3366, 28192, 29918, 4841, 3108, 13, 1678, 3858, 29918, 1066, 2187, 353, 9853, 3366, 13168, 287, 29918, 21457, 29918, 1066, 2187, 3108, 13, 1678, 3858, 29918, 4841, 353, 9853, 3366, 13168, 287, 29918, 21457, 29918, 4841, 3108, 13, 1678, 3858, 29918, 705, 5861, 353, 9853, 3366, 13168, 287, 29918, 21457, 29918, 705, 5861, 3108, 13, 1678, 2446, 29918, 18616, 663, 29918, 21134, 353, 9853, 3366, 4622, 29918, 18616, 663, 29918, 21134, 3108, 13, 13, 1678, 1881, 29918, 8977, 353, 426, 13, 4706, 376, 2080, 29918, 4841, 1115, 1881, 29918, 4841, 29892, 13, 4706, 376, 1131, 2509, 29918, 13168, 1115, 8570, 29918, 13168, 29892, 13, 4706, 376, 6979, 29918, 1853, 29918, 4841, 1115, 5993, 29918, 1853, 29918, 4841, 29892, 13, 1678, 500, 13, 1678, 396, 286, 21457, 29918, 1188, 1169, 29901, 518, 29890, 29892, 11762, 29918, 2435, 29892, 29894, 542, 370, 29918, 2311, 29962, 13, 1678, 396, 12103, 29918, 1188, 1169, 29901, 518, 29890, 29892, 29906, 29962, 13, 1678, 396, 7934, 29918, 28631, 29901, 18761, 281, 29914, 7431, 29871, 29896, 29941, 13, 1678, 286, 21457, 29918, 1188, 1169, 29892, 12103, 29918, 1188, 1169, 29892, 7934, 29918, 28631, 353, 1904, 29898, 2080, 29918, 8977, 29892, 6694, 29922, 8824, 29897, 13, 13, 1678, 396, 23158, 29924, 13944, 13, 1678, 565, 14383, 29918, 828, 29885, 29901, 13, 4706, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 353, 29871, 29900, 29892, 29871, 29900, 13, 1678, 1683, 29901, 13, 4706, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 353, 286, 21457, 29918, 6758, 29918, 9144, 29898, 13, 9651, 18988, 29918, 1188, 1169, 29922, 828, 29885, 29918, 1188, 1169, 29892, 13, 9651, 3858, 29918, 1066, 2187, 29922, 1643, 29918, 1066, 2187, 29892, 13, 9651, 3858, 29918, 4841, 29922, 1643, 29918, 4841, 29892, 13, 9651, 3858, 29918, 705, 5861, 29922, 1643, 29918, 705, 5861, 29892, 13, 4706, 1723, 13, 1678, 396, 317, 4590, 13944, 13, 1678, 565, 14383, 29918, 29879, 459, 29901, 13, 4706, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 353, 29871, 29900, 29892, 29871, 29900, 13, 1678, 1683, 29901, 13, 4706, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 353, 12103, 29918, 6758, 29918, 9144, 29898, 13, 9651, 18988, 29918, 1188, 1169, 29922, 29879, 459, 29918, 1188, 1169, 29892, 2446, 29918, 18616, 663, 29918, 21134, 29922, 4622, 29918, 18616, 663, 29918, 21134, 13, 4706, 1723, 13, 1678, 6410, 353, 286, 21457, 29918, 6758, 718, 12103, 29918, 6758, 29871, 396, 10575, 727, 367, 263, 10825, 373, 697, 310, 1438, 29973, 13, 1678, 736, 6410, 29892, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 29892, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 13, 13, 13, 1753, 1065, 29918, 18157, 29898, 4299, 29892, 8845, 29918, 24713, 29892, 14383, 29918, 29879, 459, 29901, 6120, 29892, 14383, 29918, 828, 29885, 29901, 6120, 1125, 13, 1678, 396, 319, 2323, 323, 29943, 9182, 528, 538, 3743, 29871, 29906, 29906, 29953, 29953, 29941, 9853, 267, 29892, 470, 29871, 29896, 29955, 29900, 29895, 6455, 29889, 13, 1678, 954, 29918, 16175, 267, 353, 29871, 29896, 29900, 29900, 13, 1678, 659, 29918, 6758, 29892, 659, 29918, 828, 29885, 29918, 6758, 29892, 659, 29918, 828, 29885, 29918, 5753, 29892, 659, 29918, 29879, 459, 29918, 6758, 29892, 659, 29918, 29879, 459, 29918, 5753, 353, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 1678, 363, 9853, 297, 8845, 29918, 24713, 29889, 19730, 29898, 1949, 29918, 16175, 267, 1125, 13, 4706, 6410, 29892, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 29892, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 353, 8845, 29918, 16175, 29898, 13, 9651, 1904, 29922, 4299, 29892, 9853, 29922, 16175, 29892, 14383, 29918, 29879, 459, 29922, 11014, 29918, 29879, 459, 29892, 14383, 29918, 828, 29885, 29922, 11014, 29918, 828, 29885, 13, 4706, 1723, 13, 4706, 659, 29918, 6758, 4619, 6410, 13, 4706, 659, 29918, 828, 29885, 29918, 6758, 4619, 286, 21457, 29918, 6758, 13, 4706, 659, 29918, 828, 29885, 29918, 5753, 4619, 286, 21457, 29918, 5753, 13, 4706, 659, 29918, 29879, 459, 29918, 6758, 4619, 12103, 29918, 6758, 13, 4706, 659, 29918, 29879, 459, 29918, 5753, 4619, 12103, 29918, 5753, 13, 13, 1678, 659, 29918, 6758, 847, 29922, 954, 29918, 16175, 267, 13, 1678, 659, 29918, 828, 29885, 29918, 6758, 847, 29922, 954, 29918, 16175, 267, 13, 1678, 659, 29918, 828, 29885, 29918, 5753, 847, 29922, 954, 29918, 16175, 267, 13, 1678, 659, 29918, 29879, 459, 29918, 6758, 847, 29922, 954, 29918, 16175, 267, 13, 1678, 659, 29918, 29879, 459, 29918, 5753, 847, 29922, 954, 29918, 16175, 267, 13, 13, 1678, 736, 313, 791, 29918, 6758, 29892, 659, 29918, 828, 29885, 29918, 6758, 29892, 659, 29918, 828, 29885, 29918, 5753, 29892, 659, 29918, 29879, 459, 29918, 6758, 29892, 659, 29918, 29879, 459, 29918, 5753, 29897, 13, 13, 13, 1753, 298, 27491, 29918, 1646, 4336, 7295, 13, 1678, 298, 27491, 29889, 497, 17469, 29898, 13264, 29889, 8172, 29889, 8945, 4197, 29896, 12622, 13, 13, 13, 1753, 679, 29918, 29879, 3425, 29918, 9902, 29898, 13, 1678, 1904, 29901, 15886, 29889, 3946, 294, 29889, 3195, 29892, 1904, 29918, 2311, 29901, 851, 29892, 4331, 29901, 938, 29892, 5172, 29901, 6120, 353, 7700, 29892, 20254, 29918, 14513, 29901, 6120, 353, 7700, 29892, 13, 1125, 13, 1678, 396, 910, 338, 297, 8462, 29892, 1951, 1269, 7115, 674, 4078, 322, 28755, 278, 1904, 16949, 29889, 13, 1678, 396, 739, 723, 367, 2253, 304, 505, 7115, 29871, 29900, 4078, 278, 1904, 322, 599, 278, 27871, 1303, 372, 29892, 541, 13, 1678, 396, 421, 3389, 29918, 978, 29952, 3508, 29915, 29873, 11806, 4695, 2861, 304, 5335, 342, 15092, 29892, 577, 871, 7115, 29871, 29900, 756, 278, 1065, 29918, 978, 29889, 13, 1678, 396, 14402, 29901, 1954, 771, 345, 29889, 960, 871, 15886, 29889, 3946, 294, 29889, 16513, 29918, 4299, 29898, 4299, 29897, 3796, 29889, 13, 1678, 411, 6789, 1971, 653, 9882, 580, 408, 4516, 978, 29901, 13, 4706, 2224, 353, 2897, 29889, 2084, 29889, 7122, 29898, 25721, 29892, 376, 4299, 1159, 13, 4706, 1904, 29889, 7620, 29918, 705, 5861, 29898, 2084, 29897, 13, 4706, 298, 27491, 29918, 1646, 4336, 580, 13, 4706, 1067, 22367, 29918, 4299, 353, 1134, 29898, 4299, 5033, 2917, 29922, 4299, 29889, 2917, 29897, 13, 4706, 1067, 22367, 29918, 4299, 29889, 1359, 29918, 705, 5861, 29898, 2084, 467, 17854, 29918, 3846, 580, 13, 4706, 298, 27491, 29918, 1646, 4336, 580, 13, 4706, 639, 29918, 29887, 3746, 29918, 16175, 29918, 2311, 353, 1375, 29898, 29941, 29892, 938, 29898, 755, 29889, 27696, 29898, 29946, 29947, 847, 298, 27491, 29889, 2311, 580, 4961, 13, 4706, 565, 5172, 29901, 13, 9651, 14294, 786, 29918, 24530, 353, 29871, 29945, 13, 9651, 3001, 29918, 24530, 353, 29871, 29896, 29900, 13, 9651, 8783, 353, 376, 8382, 29908, 13, 4706, 1683, 29901, 13, 9651, 14294, 786, 29918, 24530, 353, 29871, 29947, 29896, 29946, 13, 9651, 3001, 29918, 24530, 353, 29871, 29947, 29896, 29946, 29946, 13, 9651, 8783, 353, 376, 29879, 3425, 29894, 29906, 29908, 13, 13, 4706, 10023, 29918, 3389, 29918, 978, 353, 285, 29908, 1457, 14968, 29912, 10568, 7402, 29908, 13, 4706, 10023, 29918, 9902, 353, 1065, 29918, 29879, 3425, 29918, 392, 29918, 657, 29918, 9902, 29898, 13, 9651, 1065, 29918, 978, 29922, 29879, 3425, 29918, 3389, 29918, 978, 29892, 13, 9651, 18920, 29916, 29918, 13506, 29922, 5085, 29889, 5847, 29916, 29918, 13506, 29892, 13, 9651, 758, 29918, 13148, 29918, 12324, 29922, 695, 22367, 29918, 4299, 29889, 2917, 29889, 1457, 29918, 13148, 29918, 12324, 29892, 13, 9651, 1904, 29918, 2311, 29922, 4299, 29918, 2311, 29892, 13, 9651, 2254, 29918, 3166, 29922, 695, 22367, 29918, 4299, 29892, 13, 9651, 2254, 29918, 10568, 29922, 8516, 29892, 13, 9651, 9853, 29918, 2311, 29922, 546, 29918, 29887, 3746, 29918, 16175, 29918, 2311, 29892, 29871, 396, 910, 674, 367, 3109, 1135, 29871, 29941, 29892, 577, 694, 438, 6488, 4436, 13, 9651, 1423, 3149, 29918, 10745, 23860, 29922, 8516, 29892, 13, 9651, 12725, 29918, 10745, 23860, 29922, 8516, 29892, 13, 9651, 6509, 29918, 10492, 29922, 29941, 29872, 29899, 29945, 29892, 13, 9651, 14294, 786, 29918, 24530, 29922, 29893, 2817, 786, 29918, 24530, 29892, 13, 9651, 3001, 29918, 24530, 29922, 7827, 29918, 24530, 29892, 13, 9651, 8783, 29922, 24713, 29892, 13, 9651, 20254, 29918, 14513, 29922, 29881, 11770, 29918, 14513, 29892, 13, 4706, 1723, 13, 4706, 298, 27491, 29918, 1646, 4336, 580, 13, 13, 1678, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 4706, 736, 10023, 29918, 9902, 13, 13, 13, 1753, 12244, 29918, 10945, 29918, 12171, 29898, 1867, 29918, 24970, 29918, 5753, 398, 2785, 29901, 6120, 1125, 13, 1678, 5534, 8845, 29918, 16175, 13, 1678, 8845, 29918, 16175, 353, 337, 6312, 29918, 13264, 29918, 2220, 29898, 18157, 29918, 16175, 29897, 13, 1678, 565, 437, 29918, 24970, 29918, 5753, 398, 2785, 29901, 13, 4706, 5534, 7945, 29918, 16175, 13, 4706, 7945, 29918, 16175, 353, 337, 6312, 29918, 13264, 29918, 2220, 29898, 14968, 29918, 16175, 29897, 13, 4706, 5534, 599, 17469, 13, 4706, 599, 17469, 353, 337, 6312, 29918, 13264, 29918, 2220, 29898, 497, 17469, 29897, 13, 1678, 1683, 29901, 13, 4706, 5534, 7945, 29918, 10568, 13, 4706, 7945, 29918, 10568, 353, 337, 6312, 29918, 13264, 29918, 2220, 29898, 14968, 29918, 10568, 29897, 13, 13, 13, 1753, 1667, 29898, 13, 1678, 18920, 29916, 29918, 13506, 29901, 851, 29892, 13, 1678, 1904, 29918, 1853, 29901, 851, 29892, 13, 1678, 1904, 29918, 2311, 29901, 851, 29892, 13, 1678, 9853, 29918, 2311, 29901, 938, 29892, 13, 1678, 4236, 29918, 11762, 29918, 2848, 29901, 938, 29892, 13, 1678, 16030, 29918, 5753, 398, 2785, 29918, 24530, 29901, 938, 29892, 13, 1678, 5994, 3950, 29901, 851, 29892, 13, 1678, 1024, 29901, 851, 29892, 13, 1678, 6509, 29918, 10492, 29901, 5785, 29892, 13, 1678, 1095, 29918, 21891, 29918, 10492, 29901, 5785, 29892, 13, 1678, 14294, 786, 29918, 24530, 29901, 938, 29892, 13, 1678, 3001, 29918, 24530, 29901, 938, 29892, 13, 1678, 14383, 29918, 29879, 459, 29901, 6120, 29892, 13, 1678, 14383, 29918, 828, 29885, 29901, 6120, 29892, 13, 1678, 758, 29918, 13148, 29918, 12324, 29901, 6120, 29892, 13, 1678, 5172, 29918, 29879, 3425, 29901, 6120, 29892, 13, 1678, 20254, 29918, 14513, 29901, 6120, 29892, 13, 1678, 10023, 29918, 24530, 29901, 2391, 29961, 524, 1402, 13, 1678, 7934, 29918, 8865, 449, 29918, 22795, 29901, 5785, 29892, 13, 1125, 13, 1678, 396, 10999, 29899, 29659, 1819, 393, 1016, 29915, 29873, 817, 304, 367, 6273, 13, 1678, 4236, 29918, 27711, 1080, 29918, 546, 29918, 11762, 353, 29871, 29906, 29900, 13, 1678, 1480, 29918, 10745, 23860, 353, 29871, 29896, 29900, 29900, 29900, 13, 1678, 1423, 3149, 29918, 10745, 23860, 353, 29871, 29945, 29900, 29900, 29900, 13, 1678, 12725, 29918, 10745, 23860, 353, 29871, 29906, 29900, 29900, 29900, 13, 1678, 9825, 13342, 29918, 10745, 23860, 353, 29871, 29896, 29900, 29900, 13, 1678, 437, 29918, 24970, 29918, 5753, 398, 2785, 353, 16030, 29918, 5753, 398, 2785, 29918, 24530, 1405, 29871, 29896, 13, 13, 1678, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 4706, 396, 7525, 1024, 881, 871, 367, 1304, 373, 697, 1889, 304, 4772, 8175, 5855, 13, 4706, 1857, 29918, 2230, 353, 12865, 29889, 12673, 29889, 3707, 2141, 710, 615, 603, 11702, 29979, 29995, 29885, 29995, 29881, 19222, 29950, 29995, 29924, 29995, 29903, 1159, 13, 4706, 7481, 353, 376, 14541, 29908, 565, 6389, 29889, 5847, 29916, 29918, 13506, 1275, 5591, 5847, 29916, 29908, 1683, 376, 3844, 29908, 13, 4706, 565, 14383, 29918, 29879, 459, 29901, 13, 9651, 6410, 29918, 710, 353, 11663, 2574, 567, 459, 29908, 13, 4706, 25342, 14383, 29918, 828, 29885, 29901, 13, 9651, 6410, 29918, 710, 353, 11663, 11014, 828, 29885, 29908, 13, 4706, 1683, 29901, 13, 9651, 6410, 29918, 710, 353, 5124, 13, 13, 4706, 21332, 29918, 710, 353, 313, 13, 9651, 11663, 11014, 1160, 29908, 13, 9651, 565, 451, 15886, 29889, 2917, 29889, 20640, 3950, 29889, 657, 29918, 735, 27910, 29918, 6768, 2141, 657, 703, 6921, 29918, 29885, 11925, 29918, 17990, 2459, 613, 7700, 29897, 13, 9651, 1683, 5124, 13, 4706, 1723, 13, 4706, 301, 29876, 29918, 710, 353, 11663, 1457, 3083, 29908, 565, 758, 29918, 13148, 29918, 12324, 1683, 11663, 2490, 3083, 29908, 13, 4706, 5768, 449, 29918, 710, 353, 285, 29908, 29899, 29912, 10892, 29918, 8865, 449, 29918, 22795, 29913, 8865, 449, 29908, 565, 7934, 29918, 8865, 449, 29918, 22795, 2804, 29871, 29900, 1683, 5124, 13, 4706, 1024, 29918, 710, 353, 285, 29908, 29899, 29912, 978, 5038, 565, 1024, 1683, 5124, 13, 4706, 15562, 353, 285, 29908, 29912, 4299, 29918, 1853, 7402, 29912, 4299, 29918, 2311, 7402, 29912, 5085, 29889, 1359, 29918, 3166, 7402, 29912, 29882, 27491, 29889, 2311, 28296, 29887, 13364, 29899, 29912, 16175, 29918, 2311, 29913, 16175, 29899, 29912, 24970, 29918, 5753, 398, 2785, 29918, 24530, 29913, 5753, 398, 29899, 29912, 21891, 29918, 10492, 29913, 29212, 29899, 29912, 5085, 29889, 3317, 29918, 5105, 29918, 12324, 29913, 3317, 5105, 29899, 29912, 20640, 3950, 29913, 3670, 29899, 29912, 7827, 29918, 24530, 29913, 24530, 29899, 29912, 3317, 29918, 11762, 29918, 2848, 29913, 11762, 29912, 1160, 29918, 710, 1157, 3083, 29918, 710, 1157, 6758, 29918, 710, 1157, 8865, 449, 29918, 710, 1157, 978, 29918, 710, 5038, 13, 4706, 1065, 29918, 978, 353, 285, 29908, 29912, 3784, 29918, 2230, 7402, 29912, 12120, 7402, 29912, 19635, 5038, 13, 13, 4706, 396, 4522, 3460, 881, 871, 3799, 373, 263, 2323, 1889, 13, 4706, 396, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29929, 29941, 29906, 29896, 29955, 29946, 29896, 29914, 2158, 292, 29899, 517, 29899, 10525, 29899, 392, 29899, 16554, 29899, 517, 29899, 29874, 29899, 1445, 29899, 271, 29899, 1552, 29899, 17642, 29899, 2230, 13, 4706, 3233, 353, 12183, 29889, 11690, 13, 4706, 3402, 353, 11860, 29898, 294, 312, 603, 6817, 29896, 29945, 29879, 1273, 29898, 978, 6817, 29896, 29906, 29879, 29901, 1273, 29898, 5563, 978, 6817, 29947, 29879, 1273, 29898, 4906, 29897, 29879, 29908, 13, 4706, 25795, 353, 518, 13, 9651, 12183, 29889, 2283, 4598, 29898, 29888, 29908, 29912, 5847, 29916, 29918, 13506, 6822, 20756, 29914, 284, 2151, 19248, 3389, 29918, 978, 1836, 1188, 4968, 13, 9651, 12183, 29889, 3835, 4598, 3285, 13, 4706, 4514, 13, 4706, 12183, 29889, 16121, 3991, 29898, 5563, 29922, 5563, 29892, 3402, 29922, 4830, 29892, 25795, 29922, 3179, 9306, 29897, 13, 13, 4706, 396, 5399, 393, 6273, 4502, 297, 6284, 29892, 871, 1156, 6036, 292, 278, 6655, 29918, 9891, 322, 12183, 13, 4706, 4974, 451, 313, 11014, 29918, 29879, 459, 322, 14383, 29918, 828, 29885, 511, 376, 29089, 671, 1192, 11014, 29918, 29879, 459, 322, 1192, 11014, 29918, 828, 29885, 29908, 13, 13, 1678, 12244, 29918, 10945, 29918, 12171, 29898, 1867, 29918, 24970, 29918, 5753, 398, 2785, 29897, 13, 13, 1678, 565, 1904, 29918, 1853, 1275, 376, 284, 2151, 1115, 13, 4706, 1904, 29918, 14273, 353, 285, 29908, 284, 2151, 29899, 29912, 4299, 29918, 2311, 7402, 29894, 29906, 29908, 13, 1678, 25342, 1904, 29918, 1853, 1275, 376, 2151, 1115, 13, 4706, 1904, 29918, 14273, 353, 285, 29908, 2151, 29899, 29912, 4299, 29918, 2311, 7402, 4661, 1463, 29908, 13, 13, 1678, 2295, 353, 11133, 3991, 29889, 3166, 29918, 1457, 3018, 1312, 29898, 4299, 29918, 14273, 29897, 13, 1678, 2295, 29889, 1457, 29918, 13148, 29918, 12324, 353, 758, 29918, 13148, 29918, 12324, 13, 1678, 2295, 29889, 4905, 29918, 10892, 29918, 28631, 353, 5852, 13, 1678, 2295, 29889, 10892, 29918, 8865, 449, 29918, 22795, 353, 7934, 29918, 8865, 449, 29918, 22795, 13, 1678, 1904, 353, 323, 4519, 3066, 3195, 2831, 6572, 5323, 2827, 29889, 3166, 29918, 2917, 29898, 2917, 29897, 13, 13, 1678, 565, 6389, 29889, 1359, 29918, 3166, 1275, 376, 10526, 905, 1115, 13, 4706, 1209, 13, 1678, 1683, 29901, 13, 4706, 4974, 1904, 29918, 1853, 1275, 376, 284, 2151, 613, 376, 11730, 8363, 758, 3018, 1312, 394, 2151, 4733, 338, 6969, 29908, 13, 4706, 298, 688, 3460, 2161, 29918, 978, 353, 285, 29908, 284, 2151, 29899, 29912, 4299, 29918, 2311, 7402, 29894, 29906, 29908, 13, 4706, 565, 6389, 29889, 1359, 29918, 3166, 1275, 376, 29882, 688, 3460, 2161, 1115, 13, 9651, 394, 2151, 353, 323, 29943, 2499, 2151, 3195, 29889, 3166, 29918, 1457, 3018, 1312, 29898, 29882, 688, 3460, 2161, 29918, 978, 29892, 2295, 29922, 2917, 29897, 13, 9651, 1904, 29889, 284, 2151, 353, 394, 2151, 13, 4706, 25342, 6389, 29889, 1359, 29918, 3166, 1275, 376, 29882, 688, 3460, 2161, 11965, 29879, 1115, 13, 9651, 286, 21457, 29918, 4299, 353, 323, 29943, 2499, 2151, 2831, 19832, 287, 26369, 29889, 3166, 29918, 1457, 3018, 1312, 29898, 29882, 688, 3460, 2161, 29918, 978, 29892, 2295, 29922, 2917, 29897, 13, 9651, 1904, 29889, 284, 2151, 353, 286, 21457, 29918, 4299, 29889, 284, 2151, 13, 9651, 1904, 29889, 25932, 29889, 27711, 1080, 353, 286, 21457, 29918, 4299, 29889, 27711, 1080, 13, 13, 1678, 5993, 3950, 353, 679, 29918, 6979, 3950, 580, 13, 1678, 20410, 353, 22985, 29956, 2817, 786, 12697, 6185, 388, 4504, 11272, 29898, 13, 4706, 4236, 29918, 21891, 29918, 10492, 29922, 21891, 29918, 10492, 29892, 13, 4706, 1095, 29918, 21891, 29918, 10492, 29922, 355, 29918, 21891, 29918, 10492, 29892, 13, 4706, 14294, 786, 29918, 24530, 29922, 29893, 2817, 786, 29918, 24530, 29892, 13, 4706, 3001, 29918, 24530, 29922, 7827, 29918, 24530, 29892, 13, 1678, 1723, 13, 1678, 565, 5994, 3950, 1275, 376, 29880, 1117, 1115, 13, 4706, 3523, 353, 365, 5194, 29933, 29898, 13, 9651, 6509, 29918, 10492, 29922, 816, 11272, 29892, 13, 9651, 7688, 29918, 7099, 388, 29918, 10492, 29922, 29900, 29889, 29900, 29896, 29892, 13, 9651, 21762, 29918, 29896, 29922, 29900, 29889, 29929, 29892, 13, 9651, 21762, 29918, 29906, 29922, 29900, 29889, 29929, 29929, 29929, 29892, 13, 9651, 321, 3232, 29922, 29896, 29872, 29899, 29953, 29892, 13, 9651, 19060, 29918, 3166, 29918, 7915, 29918, 7099, 388, 29922, 3366, 14420, 29940, 555, 613, 376, 13148, 29918, 12324, 613, 376, 29890, 3173, 12436, 13, 4706, 1723, 13, 1678, 25342, 5994, 3950, 1275, 376, 328, 314, 1115, 13, 4706, 3523, 353, 11783, 29956, 29898, 7915, 29918, 7099, 388, 29922, 29900, 29889, 29900, 29892, 6509, 29918, 10492, 29922, 816, 11272, 29897, 13, 13, 1678, 3523, 353, 15886, 29889, 3946, 294, 29889, 29885, 11925, 29918, 17990, 2459, 29889, 735, 27910, 29889, 29931, 2209, 17185, 20624, 326, 3950, 29898, 3670, 29892, 6410, 29918, 7052, 543, 16626, 1159, 13, 1678, 16030, 29918, 5753, 398, 9183, 353, 19295, 993, 7504, 398, 9183, 580, 13, 13, 1678, 396, 28186, 977, 264, 1280, 526, 518, 29896, 29892, 29871, 29906, 29900, 29946, 29955, 29962, 13, 1678, 396, 2630, 977, 264, 1280, 526, 518, 29900, 29962, 13, 1678, 396, 3940, 278, 1422, 1014, 11851, 3842, 13, 1678, 7945, 29918, 23705, 353, 285, 29908, 29912, 5847, 29916, 29918, 13506, 6822, 284, 2151, 29918, 1457, 26495, 29914, 13264, 3757, 4339, 29914, 14968, 29914, 3317, 29918, 11762, 29918, 2435, 648, 3317, 29918, 11762, 29918, 2848, 2403, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 648, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 2403, 13168, 287, 29918, 21457, 29918, 22795, 29918, 29896, 29945, 29914, 284, 2151, 29918, 10521, 13264, 11651, 29908, 13, 1678, 8845, 29918, 23705, 353, 285, 29908, 29912, 5847, 29916, 29918, 13506, 6822, 284, 2151, 29918, 1457, 26495, 29914, 13264, 3757, 4339, 29914, 18157, 29914, 3317, 29918, 11762, 29918, 2435, 648, 3317, 29918, 11762, 29918, 2848, 2403, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 648, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 2403, 13168, 287, 29918, 21457, 29918, 22795, 29918, 29896, 29945, 29914, 284, 2151, 29918, 10521, 13264, 11651, 29908, 13, 13, 1678, 7945, 29918, 1777, 264, 1280, 353, 13149, 29889, 23705, 29898, 14968, 29918, 23705, 29897, 13, 1678, 8845, 29918, 1777, 264, 1280, 353, 13149, 29889, 23705, 29898, 18157, 29918, 23705, 29897, 13, 13, 1678, 7945, 29918, 24713, 353, 679, 29918, 828, 29885, 29918, 24713, 29898, 13, 4706, 977, 264, 1280, 29922, 14968, 29918, 1777, 264, 1280, 29892, 13, 4706, 4236, 29918, 11762, 29918, 2848, 29922, 3317, 29918, 11762, 29918, 2848, 29892, 13, 4706, 4236, 29918, 27711, 1080, 29918, 546, 29918, 11762, 29922, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 29892, 13, 4706, 9853, 29918, 2311, 29922, 16175, 29918, 2311, 29892, 13, 1678, 1723, 29871, 396, 4587, 8267, 518, 16175, 29918, 2311, 29892, 2023, 29962, 13, 1678, 7945, 29918, 24713, 353, 7945, 29918, 24713, 29889, 16175, 29898, 13, 4706, 16030, 29918, 5753, 398, 2785, 29918, 24530, 13, 1678, 1723, 29871, 396, 350, 905, 310, 9853, 267, 29892, 8444, 363, 16030, 18414, 2785, 29889, 1383, 4085, 518, 5105, 29918, 24530, 29892, 9853, 29918, 2311, 29892, 2023, 29962, 13, 1678, 396, 7945, 29918, 24713, 353, 313, 13, 1678, 396, 1678, 7945, 29918, 24713, 29889, 14358, 580, 13, 1678, 396, 1723, 29871, 396, 3118, 12541, 411, 29871, 29896, 29900, 5141, 267, 29892, 29871, 29947, 7573, 2444, 304, 367, 29871, 29953, 29900, 29899, 29955, 29900, 29895, 6576, 29889, 13, 1678, 7945, 29918, 24713, 353, 7945, 29918, 24713, 29889, 29886, 999, 3486, 29898, 9040, 29918, 2311, 29922, 29947, 29897, 13, 13, 1678, 396, 15758, 362, 881, 871, 367, 2309, 373, 697, 2943, 29892, 1951, 6912, 586, 397, 1838, 29915, 29873, 2758, 599, 17469, 373, 263, 11306, 310, 27871, 13, 1678, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 4706, 8845, 29918, 24713, 353, 679, 29918, 828, 29885, 29918, 24713, 29898, 13, 9651, 977, 264, 1280, 29922, 18157, 29918, 1777, 264, 1280, 29892, 13, 9651, 4236, 29918, 11762, 29918, 2848, 29922, 3317, 29918, 11762, 29918, 2848, 29892, 13, 9651, 4236, 29918, 27711, 1080, 29918, 546, 29918, 11762, 29922, 3317, 29918, 27711, 1080, 29918, 546, 29918, 11762, 29892, 13, 9651, 9853, 29918, 2311, 29922, 16175, 29918, 2311, 29892, 13, 4706, 1723, 13, 4706, 396, 8845, 29918, 24713, 353, 8845, 29918, 24713, 29889, 16175, 29898, 29896, 29897, 13, 4706, 8845, 29918, 24713, 353, 8845, 29918, 24713, 29889, 29886, 999, 3486, 29898, 9040, 29918, 2311, 29922, 29947, 29897, 13, 13, 4706, 282, 1646, 353, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 7827, 29918, 24530, 29897, 13, 4706, 15837, 29918, 13236, 353, 6213, 29871, 396, 9333, 1653, 263, 9227, 565, 591, 1207, 372, 1549, 263, 9150, 4331, 13, 13, 1678, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 4706, 17927, 29889, 3888, 29898, 29888, 29908, 4763, 292, 6694, 29892, 4982, 1024, 426, 3389, 29918, 978, 27195, 13, 13, 1678, 363, 474, 29892, 9853, 297, 26985, 29898, 14968, 29918, 24713, 1125, 13, 4706, 6509, 29918, 10492, 353, 20410, 29898, 10568, 29922, 13264, 29889, 23362, 29898, 29875, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 876, 13, 4706, 6410, 29892, 286, 21457, 29918, 6758, 29892, 286, 21457, 29918, 5753, 29892, 12103, 29918, 6758, 29892, 12103, 29918, 5753, 29892, 4656, 29918, 12324, 353, 7945, 29918, 10568, 29898, 13, 9651, 1904, 29922, 4299, 29892, 13, 9651, 3523, 29922, 3670, 29892, 13, 9651, 16030, 29918, 5753, 398, 9183, 29922, 24970, 29918, 5753, 398, 9183, 29892, 13, 9651, 9853, 29922, 16175, 29892, 13, 9651, 16030, 29918, 5753, 398, 2785, 29918, 24530, 29922, 24970, 29918, 5753, 398, 2785, 29918, 24530, 29892, 13, 9651, 14383, 29918, 29879, 459, 29922, 11014, 29918, 29879, 459, 29892, 13, 9651, 14383, 29918, 828, 29885, 29922, 11014, 29918, 828, 29885, 29892, 13, 4706, 1723, 13, 13, 4706, 396, 3872, 29915, 29873, 864, 304, 12244, 12672, 29918, 20897, 580, 297, 263, 15886, 29889, 2220, 29892, 508, 3275, 304, 20489, 4436, 13, 4706, 565, 474, 1275, 29871, 29900, 29901, 13, 9651, 298, 27491, 29889, 6729, 328, 4384, 29918, 20897, 29898, 4299, 29889, 20897, 29892, 3876, 29918, 10003, 29922, 29900, 29897, 13, 9651, 298, 27491, 29889, 6729, 328, 4384, 29918, 20897, 29898, 3670, 29889, 20897, 3285, 3876, 29918, 10003, 29922, 29900, 29897, 13, 13, 4706, 338, 29918, 8394, 29918, 10568, 353, 474, 6736, 3001, 29918, 24530, 448, 29871, 29896, 13, 4706, 437, 29918, 29879, 3425, 353, 474, 297, 10023, 29918, 24530, 470, 338, 29918, 8394, 29918, 10568, 13, 4706, 396, 18827, 6858, 599, 278, 27871, 304, 7945, 29892, 541, 2582, 526, 871, 4133, 373, 7115, 29871, 29900, 13, 4706, 565, 437, 29918, 29879, 3425, 29901, 13, 9651, 10023, 29918, 9902, 353, 679, 29918, 29879, 3425, 29918, 9902, 29898, 13, 18884, 1904, 29922, 4299, 29892, 1904, 29918, 2311, 29922, 4299, 29918, 2311, 29892, 4331, 29922, 29875, 29892, 5172, 29922, 11255, 29918, 29879, 3425, 29892, 20254, 29918, 14513, 29922, 29881, 11770, 29918, 14513, 29892, 13, 9651, 1723, 13, 9651, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 18884, 10023, 29918, 735, 627, 29892, 10023, 29918, 29888, 29896, 353, 10023, 29918, 9902, 3366, 735, 627, 12436, 10023, 29918, 9902, 3366, 29888, 29896, 3108, 13, 18884, 17927, 29889, 3888, 29898, 29888, 29908, 29903, 2182, 3035, 4331, 426, 29875, 29913, 1192, 383, 29896, 29901, 426, 29879, 3425, 29918, 29888, 29896, 29901, 29889, 29941, 29888, 1118, 1222, 627, 29901, 426, 29879, 3425, 29918, 735, 627, 29901, 29889, 29941, 29888, 27195, 13, 9651, 396, 830, 29899, 6312, 1120, 1946, 577, 372, 1838, 29915, 29873, 679, 1852, 29635, 267, 13, 9651, 12244, 29918, 10945, 29918, 12171, 29898, 1867, 29918, 24970, 29918, 5753, 398, 2785, 29897, 13, 13, 4706, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 9651, 437, 29918, 1188, 353, 474, 1273, 1480, 29918, 10745, 23860, 1275, 29871, 29900, 13, 9651, 437, 29918, 3198, 3149, 353, 313, 29875, 1273, 1423, 3149, 29918, 10745, 23860, 1275, 29871, 29900, 29897, 470, 338, 29918, 8394, 29918, 10568, 13, 9651, 437, 29918, 18157, 353, 313, 29875, 1273, 12725, 29918, 10745, 23860, 1275, 29871, 29900, 29897, 470, 338, 29918, 8394, 29918, 10568, 13, 13, 9651, 282, 1646, 29889, 5504, 29898, 29896, 29897, 13, 9651, 6139, 353, 285, 29908, 29931, 2209, 29901, 426, 6758, 29901, 29889, 29941, 29888, 1118, 23158, 29924, 29901, 426, 828, 29885, 29918, 6758, 29901, 29889, 29941, 29888, 1118, 317, 4590, 29901, 426, 29879, 459, 29918, 6758, 29901, 29889, 29941, 29888, 1118, 23158, 29924, 29918, 5753, 29901, 426, 828, 29885, 29918, 5753, 29901, 29889, 29941, 29888, 1118, 317, 4590, 29918, 5753, 29901, 426, 29879, 459, 29918, 5753, 29901, 29889, 29941, 29888, 5038, 13, 9651, 282, 1646, 29889, 842, 29918, 8216, 29898, 8216, 29897, 13, 9651, 565, 437, 29918, 1188, 29901, 13, 18884, 17927, 29889, 3888, 29898, 29888, 29908, 5323, 262, 4331, 426, 29875, 29913, 1192, 426, 8216, 27195, 13, 13, 9651, 565, 437, 29918, 3198, 3149, 29901, 13, 18884, 1423, 3149, 29918, 2084, 353, 285, 29908, 29912, 5847, 29916, 29918, 13506, 6822, 3198, 9748, 29914, 284, 2151, 19248, 3389, 29918, 978, 7402, 10568, 29912, 29875, 1836, 384, 415, 29908, 13, 18884, 17927, 29889, 3888, 29898, 29888, 29908, 29903, 5555, 1423, 3149, 472, 426, 3198, 3149, 29918, 2084, 27195, 13, 18884, 1904, 29889, 7620, 29918, 705, 5861, 29898, 3198, 3149, 29918, 2084, 29897, 13, 18884, 396, 1904, 29889, 1359, 29918, 705, 5861, 29898, 3198, 3149, 29918, 2084, 29897, 13, 13, 9651, 565, 437, 29918, 18157, 29901, 13, 18884, 659, 29918, 6758, 29892, 659, 29918, 828, 29885, 29918, 6758, 29892, 659, 29918, 828, 29885, 29918, 5753, 29892, 659, 29918, 29879, 459, 29918, 6758, 29892, 659, 29918, 29879, 459, 29918, 5753, 353, 1065, 29918, 18157, 29898, 13, 462, 1678, 1904, 29922, 4299, 29892, 13, 462, 1678, 8845, 29918, 24713, 29922, 18157, 29918, 24713, 29892, 13, 462, 1678, 14383, 29918, 29879, 459, 29922, 11014, 29918, 29879, 459, 29892, 13, 462, 1678, 14383, 29918, 828, 29885, 29922, 11014, 29918, 828, 29885, 29892, 13, 18884, 1723, 13, 18884, 6139, 353, 285, 29908, 29931, 2209, 29901, 426, 791, 29918, 6758, 29901, 29889, 29941, 29888, 1118, 23158, 29924, 29901, 426, 791, 29918, 828, 29885, 29918, 6758, 29901, 29889, 29941, 29888, 1118, 317, 4590, 29901, 426, 791, 29918, 29879, 459, 29918, 6758, 29901, 29889, 29941, 29888, 1118, 23158, 29924, 29918, 5753, 29901, 426, 791, 29918, 828, 29885, 29918, 5753, 29901, 29889, 29941, 29888, 1118, 317, 4590, 29918, 5753, 29901, 426, 791, 29918, 29879, 459, 29918, 5753, 29901, 29889, 29941, 29888, 5038, 13, 18884, 17927, 29889, 3888, 29898, 29888, 29908, 19448, 4331, 426, 29875, 29913, 1192, 426, 8216, 27195, 13, 13, 9651, 396, 6204, 15837, 29918, 13236, 1156, 278, 937, 4331, 13, 9651, 565, 15837, 29918, 13236, 338, 6213, 29901, 13, 18884, 15837, 29918, 13236, 353, 15886, 29889, 7727, 29889, 3258, 29918, 1445, 29918, 13236, 29898, 13, 462, 1678, 285, 29908, 29912, 5847, 29916, 29918, 13506, 6822, 20756, 29914, 284, 2151, 19248, 3389, 29918, 978, 5038, 13, 18884, 1723, 13, 9651, 396, 4522, 304, 323, 6073, 28397, 13, 9651, 7688, 29918, 12324, 353, 15886, 29889, 755, 29889, 3676, 29898, 13, 18884, 15886, 29889, 755, 29889, 17469, 29918, 2083, 4197, 13264, 29889, 12324, 29898, 1707, 29892, 4356, 29922, 29906, 29897, 3579, 29871, 29906, 363, 722, 297, 1904, 29889, 14968, 519, 29918, 20897, 2314, 13, 9651, 1723, 13, 9651, 411, 15837, 29918, 13236, 29889, 294, 29918, 4381, 7295, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 7915, 29918, 12324, 613, 7688, 29918, 12324, 29892, 4331, 29922, 29875, 29897, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 21891, 29918, 10492, 613, 6509, 29918, 10492, 29892, 4331, 29922, 29875, 29897, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 14968, 29918, 6758, 613, 6410, 29892, 4331, 29922, 29875, 29897, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 14968, 29918, 828, 29885, 29918, 6758, 613, 286, 21457, 29918, 6758, 29892, 4331, 29922, 29875, 29897, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 14968, 29918, 828, 29885, 29918, 5753, 613, 286, 21457, 29918, 5753, 29892, 4331, 29922, 29875, 29897, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 14968, 29918, 29879, 459, 29918, 6758, 613, 12103, 29918, 6758, 29892, 4331, 29922, 29875, 29897, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 14968, 29918, 29879, 459, 29918, 5753, 613, 12103, 29918, 5753, 29892, 4331, 29922, 29875, 29897, 13, 18884, 15886, 29889, 7727, 29889, 19529, 279, 703, 5105, 29918, 12324, 613, 4656, 29918, 12324, 29892, 4331, 29922, 29875, 29897, 13, 18884, 565, 437, 29918, 18157, 29901, 13, 462, 1678, 15886, 29889, 7727, 29889, 19529, 279, 703, 791, 29918, 6758, 613, 659, 29918, 6758, 29892, 4331, 29922, 29875, 29897, 13, 462, 1678, 15886, 29889, 7727, 29889, 19529, 279, 703, 791, 29918, 828, 29885, 29918, 6758, 613, 659, 29918, 828, 29885, 29918, 6758, 29892, 4331, 29922, 29875, 29897, 13, 462, 1678, 15886, 29889, 7727, 29889, 19529, 279, 703, 791, 29918, 828, 29885, 29918, 5753, 613, 659, 29918, 828, 29885, 29918, 5753, 29892, 4331, 29922, 29875, 29897, 13, 462, 1678, 15886, 29889, 7727, 29889, 19529, 279, 703, 791, 29918, 29879, 459, 29918, 6758, 613, 659, 29918, 29879, 459, 29918, 6758, 29892, 4331, 29922, 29875, 29897, 13, 462, 1678, 15886, 29889, 7727, 29889, 19529, 279, 703, 791, 29918, 29879, 459, 29918, 5753, 613, 659, 29918, 29879, 459, 29918, 5753, 29892, 4331, 29922, 29875, 29897, 13, 18884, 565, 437, 29918, 29879, 3425, 29901, 13, 462, 1678, 15886, 29889, 7727, 29889, 19529, 279, 703, 29879, 3425, 29918, 29888, 29896, 613, 10023, 29918, 29888, 29896, 29892, 4331, 29922, 29875, 29897, 13, 462, 1678, 15886, 29889, 7727, 29889, 19529, 279, 703, 29879, 3425, 29918, 735, 627, 613, 10023, 29918, 735, 627, 29892, 4331, 29922, 29875, 29897, 13, 13, 4706, 565, 338, 29918, 8394, 29918, 10568, 29901, 13, 9651, 2867, 13, 13, 1678, 565, 298, 27491, 29889, 10003, 580, 1275, 29871, 29900, 29901, 13, 4706, 282, 1646, 29889, 5358, 580, 13, 4706, 17927, 29889, 3888, 29898, 29888, 29908, 12881, 3276, 758, 26495, 29892, 4982, 1024, 426, 3389, 29918, 978, 27195, 13, 13, 13, 1753, 679, 29918, 29879, 3425, 29918, 24530, 29898, 17833, 29918, 24530, 29918, 710, 29901, 851, 29897, 1599, 2391, 29961, 524, 5387, 13, 1678, 9995, 20969, 263, 16694, 29899, 25048, 630, 1347, 310, 11920, 29892, 9773, 372, 304, 1051, 310, 2322, 6576, 29889, 9995, 13, 1678, 4805, 29918, 29879, 3425, 29918, 24530, 353, 518, 524, 29898, 791, 29897, 363, 659, 297, 4805, 29918, 24530, 29918, 710, 29889, 5451, 28165, 13531, 565, 4805, 29918, 24530, 29918, 710, 1683, 5159, 13, 1678, 2322, 29918, 29879, 3425, 29918, 24530, 353, 518, 29895, 334, 29871, 29896, 29900, 29900, 29900, 363, 413, 297, 518, 29945, 29892, 29871, 29896, 29900, 29892, 29871, 29906, 29900, 29892, 29871, 29946, 29900, 29892, 29871, 29953, 29900, 29892, 29871, 29947, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29906, 29900, 5262, 13, 1678, 736, 4805, 29918, 29879, 3425, 29918, 24530, 718, 2322, 29918, 29879, 3425, 29918, 24530, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 4299, 29918, 3972, 613, 1371, 543, 2525, 3880, 29892, 541, 4502, 491, 317, 482, 29924, 5790, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 4299, 29918, 1853, 613, 2322, 543, 284, 2151, 613, 19995, 29922, 3366, 284, 2151, 613, 376, 2151, 20068, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 4299, 29918, 2311, 613, 2322, 543, 3188, 613, 19995, 29922, 3366, 3188, 613, 376, 16961, 20068, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 16175, 29918, 2311, 613, 1134, 29922, 524, 29892, 2322, 29922, 29941, 29906, 29892, 1371, 543, 546, 22796, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 24970, 29918, 5753, 398, 2785, 29918, 24530, 613, 1134, 29922, 524, 29892, 2322, 29922, 29906, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 3317, 29918, 11762, 29918, 2848, 613, 1134, 29922, 524, 29892, 2322, 29922, 29945, 29896, 29906, 29892, 19995, 11759, 29896, 29906, 29947, 29892, 29871, 29945, 29896, 29906, 2314, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 29893, 2817, 786, 29918, 24530, 613, 1134, 29922, 524, 29892, 2322, 29922, 29941, 29896, 29906, 29945, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 7827, 29918, 24530, 613, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29906, 29945, 29900, 29900, 29900, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 21891, 29918, 10492, 613, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29900, 29900, 29896, 29955, 29953, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 355, 29918, 21891, 29918, 10492, 613, 1134, 29922, 7411, 29892, 2322, 29922, 29941, 29872, 29899, 29945, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 10892, 29918, 8865, 449, 29918, 22795, 613, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29900, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 3317, 29918, 5105, 29918, 12324, 613, 1134, 29922, 7411, 29892, 2322, 29922, 29896, 29889, 29900, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 20640, 3950, 613, 2322, 543, 29880, 1117, 613, 19995, 29922, 3366, 29880, 1117, 613, 376, 328, 314, 20068, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 978, 613, 2322, 543, 613, 1371, 543, 2528, 3245, 5235, 304, 9773, 304, 15562, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 1359, 29918, 3166, 613, 2322, 543, 10526, 905, 613, 19995, 29922, 3366, 10526, 905, 613, 376, 29882, 688, 3460, 2161, 613, 376, 29882, 688, 3460, 2161, 11965, 29879, 12436, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 5847, 29916, 29918, 13506, 613, 13, 4706, 2322, 13802, 5847, 29916, 613, 13, 4706, 19995, 29922, 3366, 29914, 5847, 29916, 613, 5591, 3670, 29914, 828, 29914, 2080, 29914, 1272, 29914, 26495, 12436, 13, 4706, 1371, 543, 7277, 304, 847, 3670, 29914, 828, 29914, 2080, 29914, 1272, 29914, 26495, 373, 317, 482, 29924, 5790, 613, 13, 1678, 1723, 13, 1678, 396, 317, 482, 29924, 5790, 947, 451, 664, 411, 525, 8899, 29918, 3075, 29915, 6389, 29892, 1951, 372, 610, 29879, 267, 964, 263, 8600, 13, 1678, 396, 1334, 674, 7539, 738, 995, 451, 5186, 304, 6213, 408, 5852, 29892, 322, 671, 1192, 11014, 29918, 1160, 29922, 5574, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 11014, 29918, 1160, 613, 13, 4706, 19995, 29922, 3366, 3009, 12436, 13, 4706, 1371, 543, 2831, 13490, 29889, 383, 1901, 20234, 931, 29892, 20312, 10073, 29892, 901, 22796, 325, 25058, 19602, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 11014, 29918, 29916, 433, 613, 13, 4706, 19995, 29922, 3366, 3009, 12436, 13, 4706, 1371, 543, 2831, 13490, 29889, 383, 1901, 20234, 931, 29892, 20312, 10073, 29892, 901, 22796, 325, 25058, 19602, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 29872, 1875, 613, 13, 4706, 19995, 29922, 3366, 3009, 12436, 13, 4706, 1371, 543, 2831, 13490, 29889, 383, 1901, 6826, 29892, 20312, 10073, 29892, 901, 22796, 325, 25058, 19602, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 11014, 29918, 29879, 459, 613, 19995, 29922, 3366, 3009, 12436, 1371, 543, 11730, 671, 23158, 29924, 6410, 29892, 322, 19060, 278, 317, 4590, 6410, 19602, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 11014, 29918, 828, 29885, 613, 19995, 29922, 3366, 3009, 12436, 1371, 543, 11730, 671, 317, 4590, 6410, 29892, 322, 19060, 278, 23158, 29924, 6410, 19602, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 489, 1457, 29918, 13148, 29918, 12324, 613, 13, 4706, 19995, 29922, 3366, 3009, 12436, 13, 4706, 1371, 543, 22150, 7546, 4226, 2133, 1434, 278, 8570, 669, 21379, 29940, 29892, 3265, 1135, 1156, 4417, 278, 10995, 950, 3957, 29889, 2045, 597, 3150, 27828, 29889, 1212, 29914, 5140, 29973, 333, 29922, 29933, 29896, 29916, 29947, 273, 24460, 4040, 613, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 17833, 29918, 29879, 3425, 29918, 24530, 613, 1134, 29922, 710, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 11255, 29918, 29879, 3425, 613, 19995, 29922, 3366, 3009, 20068, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 29881, 11770, 29918, 14513, 613, 19995, 29922, 3366, 3009, 20068, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 15886, 29889, 8172, 29889, 842, 29918, 26776, 29898, 29946, 29906, 29897, 13, 1678, 15886, 29889, 1300, 1946, 29889, 842, 29918, 18248, 359, 537, 29898, 29900, 29897, 13, 13, 1678, 396, 6912, 586, 397, 2069, 13, 1678, 298, 27491, 29889, 2344, 580, 13, 1678, 330, 13364, 353, 15886, 29889, 2917, 29889, 1761, 29918, 14017, 936, 29918, 3359, 1575, 703, 29954, 7056, 1159, 13, 1678, 363, 330, 3746, 297, 330, 13364, 29901, 13, 4706, 15886, 29889, 2917, 29889, 735, 27910, 29889, 842, 29918, 14834, 29918, 29887, 798, 386, 29898, 29887, 3746, 29892, 5852, 29897, 13, 1678, 565, 330, 13364, 29901, 13, 4706, 15886, 29889, 2917, 29889, 842, 29918, 12872, 29918, 3359, 1575, 29898, 29887, 13364, 29961, 29882, 27491, 29889, 2997, 29918, 10003, 580, 1402, 376, 29954, 7056, 1159, 13, 1678, 396, 1060, 4375, 29892, 319, 3580, 29892, 11133, 9527, 13, 1678, 6088, 29918, 11227, 353, 14013, 1852, 29901, 1852, 1275, 376, 3009, 29908, 13, 1678, 15886, 29889, 2917, 29889, 20640, 3950, 29889, 842, 29918, 29926, 277, 29898, 1333, 6088, 29918, 11227, 29898, 5085, 29889, 11014, 29918, 29916, 433, 876, 13, 1678, 15886, 29889, 2917, 29889, 20640, 3950, 29889, 842, 29918, 735, 27910, 29918, 6768, 29898, 13, 4706, 8853, 6921, 29918, 29885, 11925, 29918, 17990, 2459, 1115, 451, 6088, 29918, 11227, 29898, 5085, 29889, 11014, 29918, 1160, 2915, 13, 1678, 1723, 13, 1678, 15886, 29889, 2917, 29889, 735, 27910, 29918, 3389, 29918, 12171, 29918, 29872, 1875, 368, 29898, 5510, 29918, 11227, 29898, 5085, 29889, 29872, 1875, 876, 13, 13, 1678, 1667, 29898, 13, 4706, 18920, 29916, 29918, 13506, 29922, 5085, 29889, 5847, 29916, 29918, 13506, 29892, 13, 4706, 1904, 29918, 1853, 29922, 5085, 29889, 4299, 29918, 1853, 29892, 13, 4706, 1904, 29918, 2311, 29922, 5085, 29889, 4299, 29918, 2311, 29892, 13, 4706, 9853, 29918, 2311, 29922, 5085, 29889, 16175, 29918, 2311, 29892, 13, 4706, 4236, 29918, 11762, 29918, 2848, 29922, 5085, 29889, 3317, 29918, 11762, 29918, 2848, 29892, 13, 4706, 16030, 29918, 5753, 398, 2785, 29918, 24530, 29922, 5085, 29889, 24970, 29918, 5753, 398, 2785, 29918, 24530, 29892, 13, 4706, 5994, 3950, 29922, 5085, 29889, 20640, 3950, 29892, 13, 4706, 1024, 29922, 5085, 29889, 978, 29892, 13, 4706, 6509, 29918, 10492, 29922, 5085, 29889, 21891, 29918, 10492, 29892, 13, 4706, 1095, 29918, 21891, 29918, 10492, 29922, 5085, 29889, 355, 29918, 21891, 29918, 10492, 29892, 13, 4706, 14294, 786, 29918, 24530, 29922, 5085, 29889, 29893, 2817, 786, 29918, 24530, 29892, 13, 4706, 3001, 29918, 24530, 29922, 5085, 29889, 7827, 29918, 24530, 29892, 13, 4706, 14383, 29918, 29879, 459, 29922, 5510, 29918, 11227, 29898, 5085, 29889, 11014, 29918, 29879, 459, 511, 13, 4706, 14383, 29918, 828, 29885, 29922, 5510, 29918, 11227, 29898, 5085, 29889, 11014, 29918, 828, 29885, 511, 13, 4706, 758, 29918, 13148, 29918, 12324, 29922, 5510, 29918, 11227, 29898, 5085, 29889, 1457, 29918, 13148, 29918, 12324, 511, 13, 4706, 5172, 29918, 29879, 3425, 29922, 5510, 29918, 11227, 29898, 5085, 29889, 11255, 29918, 29879, 3425, 511, 13, 4706, 20254, 29918, 14513, 29922, 5510, 29918, 11227, 29898, 5085, 29889, 29881, 11770, 29918, 14513, 511, 13, 4706, 10023, 29918, 24530, 29922, 657, 29918, 29879, 3425, 29918, 24530, 29898, 5085, 29889, 17833, 29918, 29879, 3425, 29918, 24530, 511, 13, 4706, 7934, 29918, 8865, 449, 29918, 22795, 29922, 5085, 29889, 10892, 29918, 8865, 449, 29918, 22795, 29892, 13, 1678, 1723, 13, 2 ]
src/backend/qaweb/connectors.py
MovElb/Ann
0
134810
import os import sys import urllib.parse import aiohttp import aioredis import aiowiki import ujson from typing import Any, List, Dict from aiohttp import web from aioredis import Redis class BaseConnector: def __init__(self, url: str, read_timeout: int, conn_timeout: int): self._url = url self._read_timeout = read_timeout self._conn_timeout = conn_timeout self._connector = aiohttp.TCPConnector( use_dns_cache=True, ttl_dns_cache=60 * 60, limit=1024 ) self._sess = aiohttp.ClientSession( connector=self._connector, read_timeout=self._read_timeout, conn_timeout=self._conn_timeout, json_serialize=ujson.dumps, ) class SaaSConnector(BaseConnector): def __init__(self, *args: Any, **kwargs: Any): super().__init__(*args, **kwargs) self._url = self._url.format(os.environ['GAPI_KEY'], os.environ['GAPI_CX']) self._wiki = aiowiki.Wiki.wikipedia("en") async def get_documents(self, query, limit: int = 10) -> List[str]: quote_encoded = urllib.parse.quote(query) async with self._sess.get(self._url + quote_encoded) as resp: resp.raise_for_status() google_serp: Dict = await resp.json(loads=ujson.loads) urls = [item['link'] for item in google_serp.get('items', list())][:limit] titles = list(map(lambda u: u.split('/')[-1], urls)) return titles def get_wikipage(self, title) -> aiowiki.Page: return self._wiki.get_page(title) async def process_query(self, query) -> str: pass class RedisConnector: def __init__(self, host: str, port: int, master_name: str): self._host = host self._port = port self._master_name = master_name self._SUF_TEXT = '--TEXT' self._SUF_PREPRO = '--PREPRO' async def connect(self): print((self._host, self._port), self._master_name, flush=True, file=sys.stdout) sentinel = await aioredis.create_sentinel([(self._host, self._port)]) self._master: Redis = sentinel.master_for(self._master_name) async def get_text(self, title) -> str: plain = await self._master.get(title + self._SUF_TEXT) if plain: return plain.decode('utf-8') return None async def get_preprocessed(self, title): plain = await self._master.get(title + self._SUF_PREPRO) if plain: ujson.loads(plain.decode('utf-8')) return None async def dump_text(self, title, text): await self._master.set(title + self._SUF_TEXT, text) async def dump_prepro_text(self, title, prepro_text): await self._master.set(title + self._SUF_PREPRO, ujson.dumps(prepro_text)) class NetConnector(BaseConnector): def __init__(self, *args: Any, **kwargs: Any): super().__init__(*args, **kwargs) async def get_answer(self, preprocessed) -> Dict: if len(preprocessed) == 0: return {} async with self._sess.post(self._url, json={'data': preprocessed}) as resp: resp.raise_for_status() return await resp.json() def setup_connectors(app: web.Application) -> None: app['saas'] = SaaSConnector(**app['config']['saas']) app['net'] = NetConnector(**app['config']['net']) app['redis'] = RedisConnector(**app['config']['redis'])
[ 1, 1053, 2897, 13, 5215, 10876, 13, 5215, 3142, 1982, 29889, 5510, 13, 13, 5215, 263, 601, 1124, 13, 5215, 263, 1611, 287, 275, 13, 5215, 7468, 340, 10058, 13, 5215, 318, 3126, 13, 3166, 19229, 1053, 3139, 29892, 2391, 29892, 360, 919, 13, 13, 3166, 263, 601, 1124, 1053, 1856, 13, 3166, 263, 1611, 287, 275, 1053, 4367, 275, 13, 13, 13, 1990, 7399, 20971, 2801, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3142, 29901, 851, 29892, 1303, 29918, 15619, 29901, 938, 29892, 11009, 29918, 15619, 29901, 938, 1125, 13, 4706, 1583, 3032, 2271, 353, 3142, 13, 4706, 1583, 3032, 949, 29918, 15619, 353, 1303, 29918, 15619, 13, 4706, 1583, 3032, 13082, 29918, 15619, 353, 11009, 29918, 15619, 13, 4706, 1583, 3032, 11958, 2801, 353, 263, 601, 1124, 29889, 29911, 6271, 20971, 2801, 29898, 13, 9651, 671, 29918, 29881, 1983, 29918, 8173, 29922, 5574, 29892, 260, 15206, 29918, 29881, 1983, 29918, 8173, 29922, 29953, 29900, 334, 29871, 29953, 29900, 29892, 4046, 29922, 29896, 29900, 29906, 29946, 13, 4706, 1723, 13, 13, 4706, 1583, 3032, 29879, 404, 353, 263, 601, 1124, 29889, 4032, 7317, 29898, 13, 9651, 1826, 2801, 29922, 1311, 3032, 11958, 2801, 29892, 13, 9651, 1303, 29918, 15619, 29922, 1311, 3032, 949, 29918, 15619, 29892, 13, 9651, 11009, 29918, 15619, 29922, 1311, 3032, 13082, 29918, 15619, 29892, 13, 9651, 4390, 29918, 643, 6646, 29922, 29884, 3126, 29889, 29881, 17204, 29892, 13, 4706, 1723, 13, 13, 13, 1990, 5701, 29874, 29903, 20971, 2801, 29898, 5160, 20971, 2801, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29901, 3139, 29892, 3579, 19290, 29901, 3139, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 1583, 3032, 2271, 353, 1583, 3032, 2271, 29889, 4830, 29898, 359, 29889, 21813, 1839, 29954, 8787, 29918, 10818, 7464, 2897, 29889, 21813, 1839, 29954, 8787, 29918, 29907, 29990, 11287, 13, 4706, 1583, 3032, 4594, 353, 7468, 340, 10058, 29889, 5653, 29875, 29889, 6011, 703, 264, 1159, 13, 13, 1678, 7465, 822, 679, 29918, 3225, 29879, 29898, 1311, 29892, 2346, 29892, 4046, 29901, 938, 353, 29871, 29896, 29900, 29897, 1599, 2391, 29961, 710, 5387, 13, 4706, 14978, 29918, 26716, 353, 3142, 1982, 29889, 5510, 29889, 1396, 29898, 1972, 29897, 13, 13, 4706, 7465, 411, 1583, 3032, 29879, 404, 29889, 657, 29898, 1311, 3032, 2271, 718, 14978, 29918, 26716, 29897, 408, 4613, 29901, 13, 9651, 4613, 29889, 22692, 29918, 1454, 29918, 4882, 580, 13, 13, 9651, 5386, 29918, 643, 29886, 29901, 360, 919, 353, 7272, 4613, 29889, 3126, 29898, 18132, 29922, 29884, 3126, 29889, 18132, 29897, 13, 9651, 23942, 353, 518, 667, 1839, 2324, 2033, 363, 2944, 297, 5386, 29918, 643, 29886, 29889, 657, 877, 7076, 742, 1051, 3101, 3816, 29901, 13400, 29962, 13, 13, 9651, 17735, 353, 1051, 29898, 1958, 29898, 2892, 318, 29901, 318, 29889, 5451, 11219, 1495, 14352, 29896, 1402, 23942, 876, 13, 9651, 736, 17735, 13, 13, 1678, 822, 679, 29918, 2851, 22697, 29898, 1311, 29892, 3611, 29897, 1599, 7468, 340, 10058, 29889, 5074, 29901, 13, 4706, 736, 1583, 3032, 4594, 29889, 657, 29918, 3488, 29898, 3257, 29897, 13, 13, 1678, 7465, 822, 1889, 29918, 1972, 29898, 1311, 29892, 2346, 29897, 1599, 851, 29901, 13, 4706, 1209, 13, 13, 13, 1990, 4367, 275, 20971, 2801, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3495, 29901, 851, 29892, 2011, 29901, 938, 29892, 5835, 29918, 978, 29901, 851, 1125, 13, 4706, 1583, 3032, 3069, 353, 3495, 13, 4706, 1583, 3032, 637, 353, 2011, 13, 4706, 1583, 3032, 6207, 29918, 978, 353, 5835, 29918, 978, 13, 4706, 1583, 3032, 14605, 29943, 29918, 16975, 353, 525, 489, 16975, 29915, 13, 4706, 1583, 3032, 14605, 29943, 29918, 15094, 8618, 353, 525, 489, 15094, 8618, 29915, 13, 13, 1678, 7465, 822, 4511, 29898, 1311, 1125, 13, 4706, 1596, 3552, 1311, 3032, 3069, 29892, 1583, 3032, 637, 511, 1583, 3032, 6207, 29918, 978, 29892, 28371, 29922, 5574, 29892, 934, 29922, 9675, 29889, 25393, 29897, 13, 4706, 2665, 262, 295, 353, 7272, 263, 1611, 287, 275, 29889, 3258, 29918, 29879, 15440, 295, 4197, 29898, 1311, 3032, 3069, 29892, 1583, 3032, 637, 29897, 2314, 13, 4706, 1583, 3032, 6207, 29901, 4367, 275, 353, 2665, 262, 295, 29889, 6207, 29918, 1454, 29898, 1311, 3032, 6207, 29918, 978, 29897, 13, 13, 1678, 7465, 822, 679, 29918, 726, 29898, 1311, 29892, 3611, 29897, 1599, 851, 29901, 13, 4706, 8656, 353, 7272, 1583, 3032, 6207, 29889, 657, 29898, 3257, 718, 1583, 3032, 14605, 29943, 29918, 16975, 29897, 13, 4706, 565, 8656, 29901, 13, 9651, 736, 8656, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 4706, 736, 6213, 13, 13, 1678, 7465, 822, 679, 29918, 1457, 5014, 287, 29898, 1311, 29892, 3611, 1125, 13, 4706, 8656, 353, 7272, 1583, 3032, 6207, 29889, 657, 29898, 3257, 718, 1583, 3032, 14605, 29943, 29918, 15094, 8618, 29897, 13, 4706, 565, 8656, 29901, 13, 9651, 318, 3126, 29889, 18132, 29898, 24595, 29889, 13808, 877, 9420, 29899, 29947, 8785, 13, 4706, 736, 6213, 13, 13, 1678, 7465, 822, 16766, 29918, 726, 29898, 1311, 29892, 3611, 29892, 1426, 1125, 13, 4706, 7272, 1583, 3032, 6207, 29889, 842, 29898, 3257, 718, 1583, 3032, 14605, 29943, 29918, 16975, 29892, 1426, 29897, 13, 13, 1678, 7465, 822, 16766, 29918, 1457, 771, 29918, 726, 29898, 1311, 29892, 3611, 29892, 758, 771, 29918, 726, 1125, 13, 4706, 7272, 1583, 3032, 6207, 29889, 842, 29898, 3257, 718, 1583, 3032, 14605, 29943, 29918, 15094, 8618, 29892, 318, 3126, 29889, 29881, 17204, 29898, 1457, 771, 29918, 726, 876, 13, 13, 13, 1990, 12670, 20971, 2801, 29898, 5160, 20971, 2801, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29901, 3139, 29892, 3579, 19290, 29901, 3139, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 7465, 822, 679, 29918, 12011, 29898, 1311, 29892, 758, 5014, 287, 29897, 1599, 360, 919, 29901, 13, 4706, 565, 7431, 29898, 1457, 5014, 287, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 6571, 13, 13, 4706, 7465, 411, 1583, 3032, 29879, 404, 29889, 2490, 29898, 1311, 3032, 2271, 29892, 4390, 3790, 29915, 1272, 2396, 758, 5014, 287, 1800, 408, 4613, 29901, 13, 9651, 4613, 29889, 22692, 29918, 1454, 29918, 4882, 580, 13, 9651, 736, 7272, 4613, 29889, 3126, 580, 13, 13, 13, 1753, 6230, 29918, 6915, 943, 29898, 932, 29901, 1856, 29889, 4873, 29897, 1599, 6213, 29901, 13, 1678, 623, 1839, 4977, 294, 2033, 353, 5701, 29874, 29903, 20971, 2801, 29898, 1068, 932, 1839, 2917, 16215, 4977, 294, 11287, 13, 1678, 623, 1839, 1212, 2033, 353, 12670, 20971, 2801, 29898, 1068, 932, 1839, 2917, 16215, 1212, 11287, 13, 1678, 623, 1839, 1127, 275, 2033, 353, 4367, 275, 20971, 2801, 29898, 1068, 932, 1839, 2917, 16215, 1127, 275, 11287, 13, 2 ]
python/461.hamming-distance.py
stavanmehta/leetcode
0
1602548
class Solution: def hammingDistance(self, x: int, y: int) -> int:
[ 1, 770, 24380, 29901, 13, 1678, 822, 16366, 4056, 27469, 29898, 1311, 29892, 921, 29901, 938, 29892, 343, 29901, 938, 29897, 1599, 938, 29901, 13, 308, 13, 2 ]
wefe/word_embedding_model.py
raffaem/wefe
0
131715
<filename>wefe/word_embedding_model.py from gensim.models.keyedvectors import BaseKeyedVectors class WordEmbeddingModel: """A container for Word Embedding pre-trained models. It can hold gensim's KeyedVectors or gensim's api loaded models. It includes the name of the model and some vocab prefix if needed. """ def __init__(self, word_embedding: BaseKeyedVectors, model_name: str = None, vocab_prefix: str = None): """Initializes the WordEmbeddingModel container. Parameters ---------- keyed_vectors : BaseKeyedVectors. An instance of word embedding loaded through gensim KeyedVector interface or gensim's api. model_name : str, optional The name of the model, by default ''. vocab_prefix : str, optional. A prefix that will be concatenated with all word in the model vocab, by default None. Raises ------ TypeError if word_embedding is not a KeyedVectors instance. TypeError if model_name is not None and not instance of str. TypeError if vocab_prefix is not None and not instance of str. Examples -------- >>> from gensim.test.utils import common_texts >>> from gensim.models import Word2Vec >>> from wefe.word_embedding_model import WordEmbeddingModel >>> dummy_model = Word2Vec(common_texts, size=10, window=5, ... min_count=1, workers=1).wv >>> model = WordEmbeddingModel(dummy_model, 'Dummy model dim=10', ... vocab_prefix='/en/') >>> print(model.model_name_) Dummy model dim=10 >>> print(model.vocab_prefix_) /en/ Attributes ---------- model_ : KeyedVectors The object that contains the model. model_name_ : str The name of the model. vocab_prefix_ : str A prefix that will be concatenated with each word of the vocab of the model. """ if not isinstance(word_embedding, BaseKeyedVectors): raise TypeError('word_embedding must be an instance of a gensim\'s' ' KeyedVectors. Given: {}'.format(word_embedding)) else: self.model_ = word_embedding if model_name is None: self.model_name_ = 'Unnamed word embedding model' elif not isinstance(model_name, str): raise TypeError( 'model_name must be a string. Given: {}'.format(model_name)) else: self.model_name_ = model_name if vocab_prefix is None: self.vocab_prefix_ = '' elif not isinstance(vocab_prefix, str): raise TypeError( 'vocab_prefix parameter must be a string. Given: {}'.format( vocab_prefix)) else: self.vocab_prefix_ = vocab_prefix def __eq__(self, other): if self.model_ != other.model_: return False if self.model_name_ != other.model_name_: return False return True
[ 1, 529, 9507, 29958, 705, 1725, 29914, 1742, 29918, 17987, 8497, 29918, 4299, 29889, 2272, 13, 3166, 26943, 326, 29889, 9794, 29889, 1989, 287, 345, 14359, 1053, 7399, 2558, 287, 29963, 11142, 13, 13, 13, 1990, 10803, 6026, 2580, 8497, 3195, 29901, 13, 1678, 9995, 29909, 5639, 363, 10803, 2812, 2580, 8497, 758, 29899, 3018, 1312, 4733, 29889, 13, 13, 1678, 739, 508, 4808, 26943, 326, 29915, 29879, 7670, 287, 29963, 11142, 470, 26943, 326, 29915, 29879, 7882, 7500, 4733, 29889, 13, 1678, 739, 7805, 278, 1024, 310, 278, 1904, 322, 777, 7931, 370, 10944, 565, 4312, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 1734, 29918, 17987, 8497, 29901, 7399, 2558, 287, 29963, 11142, 29892, 13, 462, 1904, 29918, 978, 29901, 851, 353, 6213, 29892, 13, 462, 7931, 370, 29918, 13506, 29901, 851, 353, 6213, 1125, 13, 4706, 9995, 15514, 7093, 278, 10803, 6026, 2580, 8497, 3195, 5639, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 1820, 287, 29918, 345, 14359, 584, 7399, 2558, 287, 29963, 11142, 29889, 13, 9651, 530, 2777, 310, 1734, 23655, 7500, 1549, 26943, 326, 7670, 287, 12877, 13, 9651, 5067, 470, 26943, 326, 29915, 29879, 7882, 29889, 13, 4706, 1904, 29918, 978, 584, 851, 29892, 13136, 13, 9651, 450, 1024, 310, 278, 1904, 29892, 491, 2322, 525, 4286, 13, 4706, 7931, 370, 29918, 13506, 584, 851, 29892, 13136, 29889, 13, 9651, 319, 10944, 393, 674, 367, 16125, 630, 411, 599, 1734, 297, 278, 1904, 13, 9651, 7931, 370, 29892, 491, 2322, 6213, 29889, 13, 13, 4706, 390, 1759, 267, 13, 4706, 448, 23648, 13, 4706, 20948, 13, 9651, 565, 1734, 29918, 17987, 8497, 338, 451, 263, 7670, 287, 29963, 11142, 2777, 29889, 13, 4706, 20948, 13, 9651, 565, 1904, 29918, 978, 338, 451, 6213, 322, 451, 2777, 310, 851, 29889, 13, 4706, 20948, 13, 9651, 565, 7931, 370, 29918, 13506, 338, 451, 6213, 322, 451, 2777, 310, 851, 29889, 13, 13, 4706, 1222, 9422, 13, 4706, 448, 26589, 13, 4706, 8653, 515, 26943, 326, 29889, 1688, 29889, 13239, 1053, 3619, 29918, 726, 29879, 13, 4706, 8653, 515, 26943, 326, 29889, 9794, 1053, 10803, 29906, 25987, 13, 4706, 8653, 515, 591, 1725, 29889, 1742, 29918, 17987, 8497, 29918, 4299, 1053, 10803, 6026, 2580, 8497, 3195, 13, 13, 4706, 8653, 20254, 29918, 4299, 353, 10803, 29906, 25987, 29898, 9435, 29918, 726, 29879, 29892, 2159, 29922, 29896, 29900, 29892, 3474, 29922, 29945, 29892, 13, 4706, 2023, 462, 4706, 1375, 29918, 2798, 29922, 29896, 29892, 17162, 29922, 29896, 467, 29893, 29894, 13, 13, 4706, 8653, 1904, 353, 10803, 6026, 2580, 8497, 3195, 29898, 29881, 11770, 29918, 4299, 29892, 525, 29928, 11770, 1904, 3964, 29922, 29896, 29900, 742, 13, 4706, 2023, 462, 9651, 7931, 370, 29918, 13506, 2433, 29914, 264, 29914, 1495, 13, 4706, 8653, 1596, 29898, 4299, 29889, 4299, 29918, 978, 19925, 13, 4706, 360, 11770, 1904, 3964, 29922, 29896, 29900, 13, 4706, 8653, 1596, 29898, 4299, 29889, 29894, 542, 370, 29918, 13506, 19925, 13, 4706, 847, 264, 29914, 13, 13, 13, 4706, 6212, 5026, 13, 4706, 448, 1378, 29899, 13, 4706, 1904, 29918, 584, 7670, 287, 29963, 11142, 13, 9651, 450, 1203, 393, 3743, 278, 1904, 29889, 13, 4706, 1904, 29918, 978, 29918, 584, 851, 13, 9651, 450, 1024, 310, 278, 1904, 29889, 13, 4706, 7931, 370, 29918, 13506, 29918, 584, 851, 13, 9651, 319, 10944, 393, 674, 367, 16125, 630, 411, 1269, 1734, 310, 278, 7931, 370, 13, 9651, 310, 278, 1904, 29889, 13, 13, 4706, 9995, 13, 13, 4706, 565, 451, 338, 8758, 29898, 1742, 29918, 17987, 8497, 29892, 7399, 2558, 287, 29963, 11142, 1125, 13, 9651, 12020, 20948, 877, 1742, 29918, 17987, 8497, 1818, 367, 385, 2777, 310, 263, 26943, 326, 20333, 29879, 29915, 13, 462, 9651, 525, 7670, 287, 29963, 11142, 29889, 11221, 29901, 6571, 4286, 4830, 29898, 1742, 29918, 17987, 8497, 876, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 4299, 29918, 353, 1734, 29918, 17987, 8497, 13, 13, 4706, 565, 1904, 29918, 978, 338, 6213, 29901, 13, 9651, 1583, 29889, 4299, 29918, 978, 29918, 353, 525, 2525, 17514, 1734, 23655, 1904, 29915, 13, 4706, 25342, 451, 338, 8758, 29898, 4299, 29918, 978, 29892, 851, 1125, 13, 9651, 12020, 20948, 29898, 13, 18884, 525, 4299, 29918, 978, 1818, 367, 263, 1347, 29889, 11221, 29901, 6571, 4286, 4830, 29898, 4299, 29918, 978, 876, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 4299, 29918, 978, 29918, 353, 1904, 29918, 978, 13, 13, 4706, 565, 7931, 370, 29918, 13506, 338, 6213, 29901, 13, 9651, 1583, 29889, 29894, 542, 370, 29918, 13506, 29918, 353, 6629, 13, 4706, 25342, 451, 338, 8758, 29898, 29894, 542, 370, 29918, 13506, 29892, 851, 1125, 13, 9651, 12020, 20948, 29898, 13, 18884, 525, 29894, 542, 370, 29918, 13506, 3443, 1818, 367, 263, 1347, 29889, 11221, 29901, 6571, 4286, 4830, 29898, 13, 462, 1678, 7931, 370, 29918, 13506, 876, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 29894, 542, 370, 29918, 13506, 29918, 353, 7931, 370, 29918, 13506, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 565, 1583, 29889, 4299, 29918, 2804, 916, 29889, 4299, 29918, 29901, 13, 9651, 736, 7700, 13, 4706, 565, 1583, 29889, 4299, 29918, 978, 29918, 2804, 916, 29889, 4299, 29918, 978, 29918, 29901, 13, 9651, 736, 7700, 13, 4706, 736, 5852, 13, 2 ]
MISSIONS/bvr_sim/agent/dummy_observer/attack_seq_adjust.py
binary-husky/hmp2g
2
142380
<filename>MISSIONS/bvr_sim/agent/dummy_observer/attack_seq_adjust.py from typing import List from ..agent import Agent from ..env_cmd import CmdEnv from UTILS.colorful import * from UTILS.tensor_ops import dir2rad, np_softmax, reg_rad_at, reg_rad, repeat_at from .maneuver import maneuver_angle_to_ms, maneuver_angle_to_ms3d, maneuver_speed_to_ms, maneuver_vip import copy import random import numpy as np import time from .tools import distance_matrix from .base import Baseclass, Special, Drone, Vip, Plane, MS from .missile_policy import MS_policy from .emergent import Emergent Init_attack_order_adjust_dis = 150e3 class Attack_Adjust(): # 只执行一次的初始化调整,敌我距离小于 Init_attack_order_adjust_dis 时执行一次 def init_adjust(self): op_list = np.array([op for op in self.op_planes], dtype=object) op_dis_2_vip = [self.get_dis( op.ID, p.ID) for op in self.op_planes for p in self.my_planes if p.is_vip] assert len(op_dis_2_vip) == len(self.op_planes) sorted_index = np.argsort(op_dis_2_vip) op_list_sorted = op_list[sorted_index] op_attk_by_squad_1 = op_list_sorted[0::2] op_attk_by_squad_2 = op_list_sorted[1::2] op_list1_has_op_vip = any([op.is_vip for op in op_attk_by_squad_1]) op_list2_has_op_vip = any([op.is_vip for op in op_attk_by_squad_2]) op_vip = [op for op in self.op_planes if op.is_vip][0] assert (op_list1_has_op_vip and (not op_list2_has_op_vip)) or ( op_list2_has_op_vip and (not op_list1_has_op_vip)) if op_list2_has_op_vip: t = op_attk_by_squad_1 op_attk_by_squad_1 = op_attk_by_squad_2 op_attk_by_squad_2 = t squad_1_mem = [p for p in self.my_planes if p.squad_name == "U1"] squad_2_mem = [p for p in self.my_planes if p.squad_name == "U2"] for p in squad_1_mem: p.attack_order = [op.Name for op in op_attk_by_squad_1] # 如果攻击序列中没有有人机,则把有人机放到最后 if not any(['有人机' in p_name for p_name in p.attack_order]): p.attack_order.append(op_vip.Name) # ## print亮绿(p.Name, '分配战机进攻序列:', p.attack_order) for p in squad_2_mem: p.attack_order = [op.Name for op in op_attk_by_squad_2] # 如果攻击序列中没有有人机,则把有人机放到最后 if not any(['有人机' in p_name for p_name in p.attack_order]): p.attack_order.append(op_vip.Name) # ## print亮蓝(p.Name, '分配战机进攻序列:', p.attack_order) pass def new_init_adjust(self): all_my_plane_center = np.array([p.pos2d for p in self.my_planes]) all_my_plane_center = all_my_plane_center.mean(axis=0) # 找出敌方处于边缘的两架飞机 angle = -9999 op1_tmp = None op2_tmp = None for op1 in self.op_planes: for op2 in self.op_planes: if op1 is op2: continue delta_deg = self.get_points_angle_deg(pt1=op1.pos2d, pt_center=all_my_plane_center, pt2=op2.pos2d) if delta_deg > angle: angle = delta_deg op1_tmp = op1 op2_tmp = op2 # 以其中的op1作为角度零点,再进行计算排序 new_op_rank = [self.get_points_angle_deg( op1_tmp.pos2d, all_my_plane_center, op.pos2d) for op in self.op_planes] sorted_index = np.argsort(new_op_rank) op_list = np.array([op for op in self.op_planes], dtype=object) op_list_sorted = op_list[sorted_index] op_attk_by_squad_1 = op_list_sorted op_attk_by_squad_2 = list(reversed(op_list_sorted)) squad_1_mem = [p for p in self.my_planes if p.squad_name == "U1"] squad_2_mem = [p for p in self.my_planes if p.squad_name == "U2"] for p in squad_1_mem: p.attack_order = [op.Name for op in op_attk_by_squad_1] for p in squad_2_mem: p.attack_order = [op.Name for op in op_attk_by_squad_2] # op_attk_by_squad_2 = op_list_sorted[1::2] # op_list1_has_op_vip = any([op.is_vip for op in op_attk_by_squad_1]) # op_list2_has_op_vip = any([op.is_vip for op in op_attk_by_squad_2]) # op_vip = [op for op in self.op_planes if op.is_vip][0] # assert (op_list1_has_op_vip and (not op_list2_has_op_vip)) or ( # op_list2_has_op_vip and (not op_list1_has_op_vip)) # if op_list2_has_op_vip: # t = op_attk_by_squad_1 # op_attk_by_squad_1 = op_attk_by_squad_2 # op_attk_by_squad_2 = t # # 如果攻击序列中没有有人机,则把有人机放到最后 # if not any(['有人机' in p_name for p_name in p.attack_order]): # p.attack_order.append(op_vip.Name) # # ## print亮绿(p.Name, '分配战机进攻序列:', p.attack_order) # # 如果攻击序列中没有有人机,则把有人机放到最后 # if not any(['有人机' in p_name for p_name in p.attack_order]): # p.attack_order.append(op_vip.Name) # pass # 根据敌方每个飞机的剩余的弹药量,变动进攻序列,将无弹的目标放到最末的优先级 # 调整的条件:1、敌方无弹,2、没有正在往这个敌方目标飞行的导弹 def adjust_by_left_ammo(self): for p in self.my_planes: attack_list = [self.find_plane_by_name(op_name) for op_name in p.attack_order] attack_list = [op for op in attack_list if op is not None] new_attack_list_normal = [] new_attack_list_mvback = [] for i in range(len(attack_list)): missile_towards_op = [ms for ms in self.ms if ms.EngageTargetID==attack_list[i].ID and ms.ms_at_terminal] require_no_ms_guidence = (len(missile_towards_op)==0) if attack_list[i].OpLeftWeapon == 0 and attack_list[i].is_drone and require_no_ms_guidence: new_attack_list_mvback.append(attack_list[i]) else: new_attack_list_normal.append(attack_list[i]) new_attack_list = new_attack_list_normal + new_attack_list_mvback p.attack_order = [op.Name for op in new_attack_list] pass # 调整每个飞机的进攻序列 def adjust_attack_order(self): ''' # 在敌我距离缩小到阈值时,第一次调整进攻序列 min_distance = min([self.get_dis(op.ID, p.ID) for op in self.op_planes for p in self.my_planes]) if min_distance < Init_attack_order_adjust_dis: if not self.initial_attack_order_adjusted: self.initial_attack_order_adjusted = True self.init_adjust() ''' min_distance = min([self.get_dis(op.ID, p.ID) for op in self.op_planes for p in self.my_planes]) if min_distance > Init_attack_order_adjust_dis: self.new_init_adjust() # 根据将敌方的无弹目标放到末优先级 self.adjust_by_left_ammo() ''' # 当敌方的有人机距离小队中全部成员的距离小于50, 或者距离任意成员的距离小于30,小队内全体成员前往歼灭敌方有人机 op_vip = self.find_plane_by_name(self.op_color + "有人机") if op_vip is None: return def attack_vip_first(p): # ## print亮紫(p.attack_order) p.attack_order = [op_name for op_name in p.attack_order if "有人机" in op_name] + \ [op_name for op_name in p.attack_order if "有人机" not in op_name] # ## print亮蓝(p.attack_order) pass squads = ['U1', 'U2'] for squad in squads: p_list = self.find_planes_by_squad(squad) if len(p_list)==0: continue dis2_op_vip = [self.get_dis(p.ID, op_vip.ID) for p in p_list] if min(dis2_op_vip) < 30e3: # ## print亮紫('小队全体攻击有人机') for p in p_list: attack_vip_first(p) elif max(dis2_op_vip) < 50e3: # ## print亮紫('小队全体攻击有人机') for p in p_list: attack_vip_first(p) ''' return def adjust_attack_order_phase2(self): for p in self.my_planes: if hasattr(p, 'ms_policy_suggested_target') and p.ms_policy_suggested_target is not None: # 根据 ms_policy_suggested_target 调整攻击序列 attack_list = [self.find_plane_by_name(op_name) for op_name in p.attack_order] attack_list = [op for op in attack_list if op is not None] new_attack_list_normal = [] new_attack_list_mvback = [] for i in range(len(attack_list)): if attack_list[i].ID == p.ms_policy_suggested_target.ID: new_attack_list_mvback.append(attack_list[i]) else: new_attack_list_normal.append(attack_list[i]) new_attack_list = [p.ms_policy_suggested_target] + new_attack_list_normal + new_attack_list_mvback p.attack_order = [op.Name for op in new_attack_list]
[ 1, 529, 9507, 29958, 10403, 13507, 29903, 29914, 29890, 13416, 29918, 3601, 29914, 14748, 29914, 29881, 11770, 29918, 711, 2974, 29914, 1131, 547, 29918, 11762, 29918, 328, 5143, 29889, 2272, 13, 3166, 19229, 1053, 2391, 13, 3166, 6317, 14748, 1053, 28330, 13, 3166, 6317, 6272, 29918, 9006, 1053, 315, 3487, 21745, 13, 3166, 501, 29911, 6227, 29903, 29889, 2780, 1319, 1053, 334, 13, 3166, 501, 29911, 6227, 29903, 29889, 20158, 29918, 3554, 1053, 4516, 29906, 3665, 29892, 7442, 29918, 2695, 3317, 29892, 1072, 29918, 3665, 29918, 271, 29892, 1072, 29918, 3665, 29892, 12312, 29918, 271, 13, 3166, 869, 1171, 12932, 369, 1053, 767, 12932, 369, 29918, 2521, 29918, 517, 29918, 1516, 29892, 767, 12932, 369, 29918, 2521, 29918, 517, 29918, 1516, 29941, 29881, 29892, 767, 12932, 369, 29918, 19322, 29918, 517, 29918, 1516, 29892, 767, 12932, 369, 29918, 29894, 666, 13, 5215, 3509, 13, 5215, 4036, 13, 5215, 12655, 408, 7442, 13, 5215, 931, 13, 3166, 869, 8504, 1053, 5418, 29918, 5344, 13, 3166, 869, 3188, 1053, 7399, 1990, 29892, 12630, 29892, 4942, 650, 29892, 478, 666, 29892, 1858, 1662, 29892, 10888, 13, 3166, 869, 9894, 488, 29918, 22197, 1053, 10888, 29918, 22197, 13, 3166, 869, 25154, 5362, 1053, 27718, 5362, 13, 6644, 29918, 1131, 547, 29918, 2098, 29918, 328, 5143, 29918, 2218, 353, 29871, 29896, 29945, 29900, 29872, 29941, 13, 13, 1990, 6212, 547, 29918, 3253, 5143, 7295, 13, 1678, 396, 29871, 31557, 233, 140, 170, 30448, 30287, 30936, 30210, 31120, 31020, 30705, 31268, 233, 152, 183, 30214, 233, 152, 143, 30672, 235, 186, 160, 234, 169, 190, 30446, 30909, 10886, 29918, 1131, 547, 29918, 2098, 29918, 328, 5143, 29918, 2218, 29871, 30594, 233, 140, 170, 30448, 30287, 30936, 13, 1678, 822, 2069, 29918, 328, 5143, 29898, 1311, 1125, 13, 4706, 1015, 29918, 1761, 353, 7442, 29889, 2378, 4197, 459, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 1402, 26688, 29922, 3318, 29897, 13, 4706, 1015, 29918, 2218, 29918, 29906, 29918, 29894, 666, 353, 518, 1311, 29889, 657, 29918, 2218, 29898, 13, 9651, 1015, 29889, 1367, 29892, 282, 29889, 1367, 29897, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 13, 9651, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 565, 282, 29889, 275, 29918, 29894, 666, 29962, 13, 4706, 4974, 7431, 29898, 459, 29918, 2218, 29918, 29906, 29918, 29894, 666, 29897, 1275, 7431, 29898, 1311, 29889, 459, 29918, 9018, 267, 29897, 13, 4706, 12705, 29918, 2248, 353, 7442, 29889, 5085, 441, 29898, 459, 29918, 2218, 29918, 29906, 29918, 29894, 666, 29897, 13, 13, 4706, 1015, 29918, 1761, 29918, 24582, 353, 1015, 29918, 1761, 29961, 24582, 29918, 2248, 29962, 13, 4706, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 353, 1015, 29918, 1761, 29918, 24582, 29961, 29900, 1057, 29906, 29962, 13, 4706, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 353, 1015, 29918, 1761, 29918, 24582, 29961, 29896, 1057, 29906, 29962, 13, 4706, 1015, 29918, 1761, 29896, 29918, 5349, 29918, 459, 29918, 29894, 666, 353, 738, 4197, 459, 29889, 275, 29918, 29894, 666, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 2314, 13, 4706, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 353, 738, 4197, 459, 29889, 275, 29918, 29894, 666, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 2314, 13, 4706, 1015, 29918, 29894, 666, 353, 518, 459, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 565, 1015, 29889, 275, 29918, 29894, 666, 3816, 29900, 29962, 13, 4706, 4974, 313, 459, 29918, 1761, 29896, 29918, 5349, 29918, 459, 29918, 29894, 666, 322, 313, 1333, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 876, 470, 313, 13, 9651, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 322, 313, 1333, 1015, 29918, 1761, 29896, 29918, 5349, 29918, 459, 29918, 29894, 666, 876, 13, 4706, 565, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 29901, 13, 9651, 260, 353, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 13, 9651, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 353, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 13, 9651, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 353, 260, 13, 4706, 10023, 29918, 29896, 29918, 6954, 353, 518, 29886, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 565, 282, 29889, 29879, 3425, 29918, 978, 1275, 376, 29965, 29896, 3108, 13, 4706, 10023, 29918, 29906, 29918, 6954, 353, 518, 29886, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 565, 282, 29889, 29879, 3425, 29918, 978, 1275, 376, 29965, 29906, 3108, 13, 4706, 363, 282, 297, 10023, 29918, 29896, 29918, 6954, 29901, 13, 9651, 282, 29889, 1131, 547, 29918, 2098, 353, 518, 459, 29889, 1170, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 29962, 13, 9651, 396, 29871, 30847, 30801, 233, 151, 190, 31768, 31463, 31025, 30275, 31423, 30417, 30417, 30313, 31429, 30214, 31403, 233, 141, 141, 30417, 30313, 31429, 31182, 30780, 30878, 30822, 13, 9651, 565, 451, 738, 18959, 30417, 30313, 31429, 29915, 297, 282, 29918, 978, 363, 282, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 29962, 1125, 13, 18884, 282, 29889, 1131, 547, 29918, 2098, 29889, 4397, 29898, 459, 29918, 29894, 666, 29889, 1170, 29897, 13, 9651, 396, 444, 1596, 231, 189, 177, 234, 190, 194, 29898, 29886, 29889, 1170, 29892, 525, 30748, 31361, 233, 139, 155, 31429, 31174, 233, 151, 190, 31463, 31025, 30383, 742, 282, 29889, 1131, 547, 29918, 2098, 29897, 13, 4706, 363, 282, 297, 10023, 29918, 29906, 29918, 6954, 29901, 13, 9651, 282, 29889, 1131, 547, 29918, 2098, 353, 518, 459, 29889, 1170, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 29962, 13, 9651, 396, 29871, 30847, 30801, 233, 151, 190, 31768, 31463, 31025, 30275, 31423, 30417, 30417, 30313, 31429, 30214, 31403, 233, 141, 141, 30417, 30313, 31429, 31182, 30780, 30878, 30822, 13, 9651, 565, 451, 738, 18959, 30417, 30313, 31429, 29915, 297, 282, 29918, 978, 363, 282, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 29962, 1125, 13, 18884, 282, 29889, 1131, 547, 29918, 2098, 29889, 4397, 29898, 459, 29918, 29894, 666, 29889, 1170, 29897, 13, 9651, 396, 444, 1596, 231, 189, 177, 235, 150, 160, 29898, 29886, 29889, 1170, 29892, 525, 30748, 31361, 233, 139, 155, 31429, 31174, 233, 151, 190, 31463, 31025, 30383, 742, 282, 29889, 1131, 547, 29918, 2098, 29897, 13, 4706, 1209, 13, 13, 1678, 822, 716, 29918, 2344, 29918, 328, 5143, 29898, 1311, 1125, 13, 4706, 599, 29918, 1357, 29918, 22116, 29918, 5064, 353, 7442, 29889, 2378, 4197, 29886, 29889, 1066, 29906, 29881, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 2314, 13, 4706, 599, 29918, 1357, 29918, 22116, 29918, 5064, 353, 599, 29918, 1357, 29918, 22116, 29918, 5064, 29889, 12676, 29898, 8990, 29922, 29900, 29897, 13, 13, 4706, 396, 29871, 233, 140, 193, 30544, 233, 152, 143, 30525, 31548, 30909, 31993, 234, 191, 155, 30210, 31977, 233, 161, 185, 236, 166, 161, 31429, 13, 4706, 10696, 353, 448, 29929, 29929, 29929, 29929, 13, 4706, 1015, 29896, 29918, 7050, 353, 6213, 13, 4706, 1015, 29906, 29918, 7050, 353, 6213, 13, 4706, 363, 1015, 29896, 297, 1583, 29889, 459, 29918, 9018, 267, 29901, 13, 9651, 363, 1015, 29906, 297, 1583, 29889, 459, 29918, 9018, 267, 29901, 13, 18884, 565, 1015, 29896, 338, 1015, 29906, 29901, 6773, 13, 18884, 19471, 29918, 12163, 353, 1583, 29889, 657, 29918, 9748, 29918, 2521, 29918, 12163, 29898, 415, 29896, 29922, 459, 29896, 29889, 1066, 29906, 29881, 29892, 29871, 13, 462, 1678, 19592, 29918, 5064, 29922, 497, 29918, 1357, 29918, 22116, 29918, 5064, 29892, 29871, 13, 462, 1678, 19592, 29906, 29922, 459, 29906, 29889, 1066, 29906, 29881, 29897, 13, 18884, 565, 19471, 29918, 12163, 1405, 10696, 29901, 13, 462, 1678, 10696, 353, 19471, 29918, 12163, 13, 462, 1678, 1015, 29896, 29918, 7050, 353, 1015, 29896, 13, 462, 1678, 1015, 29906, 29918, 7050, 353, 1015, 29906, 13, 4706, 396, 29871, 30651, 31149, 30275, 30210, 459, 29896, 30732, 30573, 31432, 30898, 236, 158, 185, 30940, 30214, 31733, 31174, 30448, 31466, 31565, 233, 145, 149, 31463, 13, 4706, 716, 29918, 459, 29918, 10003, 353, 518, 1311, 29889, 657, 29918, 9748, 29918, 2521, 29918, 12163, 29898, 13, 462, 4706, 1015, 29896, 29918, 7050, 29889, 1066, 29906, 29881, 29892, 29871, 13, 462, 4706, 599, 29918, 1357, 29918, 22116, 29918, 5064, 29892, 29871, 13, 462, 4706, 1015, 29889, 1066, 29906, 29881, 29897, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 29962, 13, 4706, 12705, 29918, 2248, 353, 7442, 29889, 5085, 441, 29898, 1482, 29918, 459, 29918, 10003, 29897, 13, 4706, 1015, 29918, 1761, 353, 7442, 29889, 2378, 4197, 459, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 1402, 26688, 29922, 3318, 29897, 13, 4706, 1015, 29918, 1761, 29918, 24582, 353, 1015, 29918, 1761, 29961, 24582, 29918, 2248, 29962, 13, 4706, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 353, 1015, 29918, 1761, 29918, 24582, 13, 4706, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 353, 1051, 29898, 276, 874, 287, 29898, 459, 29918, 1761, 29918, 24582, 876, 13, 4706, 10023, 29918, 29896, 29918, 6954, 353, 518, 29886, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 565, 282, 29889, 29879, 3425, 29918, 978, 1275, 376, 29965, 29896, 3108, 13, 4706, 10023, 29918, 29906, 29918, 6954, 353, 518, 29886, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 565, 282, 29889, 29879, 3425, 29918, 978, 1275, 376, 29965, 29906, 3108, 13, 4706, 363, 282, 297, 10023, 29918, 29896, 29918, 6954, 29901, 13, 9651, 282, 29889, 1131, 547, 29918, 2098, 353, 518, 459, 29889, 1170, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 29962, 13, 4706, 363, 282, 297, 10023, 29918, 29906, 29918, 6954, 29901, 13, 9651, 282, 29889, 1131, 547, 29918, 2098, 353, 518, 459, 29889, 1170, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 29962, 13, 13, 4706, 396, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 353, 1015, 29918, 1761, 29918, 24582, 29961, 29896, 1057, 29906, 29962, 13, 4706, 396, 1015, 29918, 1761, 29896, 29918, 5349, 29918, 459, 29918, 29894, 666, 353, 738, 4197, 459, 29889, 275, 29918, 29894, 666, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 2314, 13, 4706, 396, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 353, 738, 4197, 459, 29889, 275, 29918, 29894, 666, 363, 1015, 297, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 2314, 13, 4706, 396, 1015, 29918, 29894, 666, 353, 518, 459, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 565, 1015, 29889, 275, 29918, 29894, 666, 3816, 29900, 29962, 13, 4706, 396, 4974, 313, 459, 29918, 1761, 29896, 29918, 5349, 29918, 459, 29918, 29894, 666, 322, 313, 1333, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 876, 470, 313, 13, 4706, 396, 268, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 322, 313, 1333, 1015, 29918, 1761, 29896, 29918, 5349, 29918, 459, 29918, 29894, 666, 876, 13, 4706, 396, 565, 1015, 29918, 1761, 29906, 29918, 5349, 29918, 459, 29918, 29894, 666, 29901, 13, 4706, 396, 268, 260, 353, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 13, 4706, 396, 268, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29896, 353, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 13, 4706, 396, 268, 1015, 29918, 1131, 29895, 29918, 1609, 29918, 29879, 3425, 29918, 29906, 353, 260, 13, 4706, 396, 268, 396, 29871, 30847, 30801, 233, 151, 190, 31768, 31463, 31025, 30275, 31423, 30417, 30417, 30313, 31429, 30214, 31403, 233, 141, 141, 30417, 30313, 31429, 31182, 30780, 30878, 30822, 13, 4706, 396, 268, 565, 451, 738, 18959, 30417, 30313, 31429, 29915, 297, 282, 29918, 978, 363, 282, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 29962, 1125, 13, 4706, 396, 308, 282, 29889, 1131, 547, 29918, 2098, 29889, 4397, 29898, 459, 29918, 29894, 666, 29889, 1170, 29897, 13, 4706, 396, 268, 396, 444, 1596, 231, 189, 177, 234, 190, 194, 29898, 29886, 29889, 1170, 29892, 525, 30748, 31361, 233, 139, 155, 31429, 31174, 233, 151, 190, 31463, 31025, 30383, 742, 282, 29889, 1131, 547, 29918, 2098, 29897, 13, 4706, 396, 268, 396, 29871, 30847, 30801, 233, 151, 190, 31768, 31463, 31025, 30275, 31423, 30417, 30417, 30313, 31429, 30214, 31403, 233, 141, 141, 30417, 30313, 31429, 31182, 30780, 30878, 30822, 13, 4706, 396, 268, 565, 451, 738, 18959, 30417, 30313, 31429, 29915, 297, 282, 29918, 978, 363, 282, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 29962, 1125, 13, 4706, 396, 308, 282, 29889, 1131, 547, 29918, 2098, 29889, 4397, 29898, 459, 29918, 29894, 666, 29889, 1170, 29897, 13, 4706, 396, 1209, 13, 13, 13, 1678, 396, 29871, 31393, 30763, 233, 152, 143, 30525, 31951, 30502, 236, 166, 161, 31429, 30210, 232, 140, 172, 231, 192, 156, 30210, 232, 191, 188, 235, 144, 178, 31180, 30214, 31462, 30846, 31174, 233, 151, 190, 31463, 31025, 30214, 30998, 31352, 232, 191, 188, 30210, 30895, 31062, 31182, 30780, 30878, 233, 159, 174, 30210, 231, 191, 155, 31244, 234, 189, 170, 13, 1678, 396, 29871, 31268, 233, 152, 183, 30210, 31217, 30631, 30383, 29896, 30330, 233, 152, 143, 30525, 31352, 232, 191, 188, 30214, 29906, 30330, 31423, 30417, 30724, 30505, 232, 193, 131, 30810, 30502, 233, 152, 143, 30525, 30895, 31062, 236, 166, 161, 30448, 30210, 31943, 232, 191, 188, 13, 1678, 822, 10365, 29918, 1609, 29918, 1563, 29918, 314, 4346, 29898, 1311, 1125, 13, 4706, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 29901, 13, 9651, 5337, 29918, 1761, 353, 518, 1311, 29889, 2886, 29918, 22116, 29918, 1609, 29918, 978, 29898, 459, 29918, 978, 29897, 363, 1015, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 29962, 13, 9651, 5337, 29918, 1761, 353, 518, 459, 363, 1015, 297, 5337, 29918, 1761, 565, 1015, 338, 451, 6213, 29962, 13, 9651, 716, 29918, 1131, 547, 29918, 1761, 29918, 8945, 353, 5159, 13, 9651, 716, 29918, 1131, 547, 29918, 1761, 29918, 29324, 1627, 353, 5159, 13, 9651, 363, 474, 297, 3464, 29898, 2435, 29898, 1131, 547, 29918, 1761, 22164, 13, 18884, 3052, 488, 29918, 29873, 340, 3163, 29918, 459, 353, 518, 1516, 363, 10887, 297, 1583, 29889, 1516, 565, 10887, 29889, 8100, 482, 8667, 1367, 1360, 1131, 547, 29918, 1761, 29961, 29875, 1822, 1367, 322, 10887, 29889, 1516, 29918, 271, 29918, 8489, 979, 29962, 13, 18884, 1996, 29918, 1217, 29918, 1516, 29918, 2543, 5084, 353, 313, 2435, 29898, 9894, 488, 29918, 29873, 340, 3163, 29918, 459, 29897, 1360, 29900, 29897, 13, 18884, 565, 5337, 29918, 1761, 29961, 29875, 1822, 11746, 8091, 4806, 481, 265, 1275, 29871, 29900, 322, 5337, 29918, 1761, 29961, 29875, 1822, 275, 29918, 7707, 650, 322, 1996, 29918, 1217, 29918, 1516, 29918, 2543, 5084, 29901, 13, 462, 1678, 716, 29918, 1131, 547, 29918, 1761, 29918, 29324, 1627, 29889, 4397, 29898, 1131, 547, 29918, 1761, 29961, 29875, 2314, 13, 18884, 1683, 29901, 13, 462, 1678, 716, 29918, 1131, 547, 29918, 1761, 29918, 8945, 29889, 4397, 29898, 1131, 547, 29918, 1761, 29961, 29875, 2314, 13, 9651, 716, 29918, 1131, 547, 29918, 1761, 353, 716, 29918, 1131, 547, 29918, 1761, 29918, 8945, 718, 716, 29918, 1131, 547, 29918, 1761, 29918, 29324, 1627, 13, 9651, 282, 29889, 1131, 547, 29918, 2098, 353, 518, 459, 29889, 1170, 363, 1015, 297, 716, 29918, 1131, 547, 29918, 1761, 29962, 13, 4706, 1209, 13, 13, 13, 1678, 396, 29871, 31268, 233, 152, 183, 31951, 30502, 236, 166, 161, 31429, 30210, 31174, 233, 151, 190, 31463, 31025, 13, 1678, 822, 10365, 29918, 1131, 547, 29918, 2098, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 396, 29871, 30505, 233, 152, 143, 30672, 235, 186, 160, 234, 169, 190, 234, 191, 172, 30446, 30780, 236, 155, 139, 30959, 30594, 30214, 30622, 30287, 30936, 31268, 233, 152, 183, 31174, 233, 151, 190, 31463, 31025, 13, 4706, 1375, 29918, 19244, 353, 1375, 4197, 1311, 29889, 657, 29918, 2218, 29898, 459, 29889, 1367, 29892, 282, 29889, 1367, 29897, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 2314, 13, 4706, 565, 1375, 29918, 19244, 529, 10886, 29918, 1131, 547, 29918, 2098, 29918, 328, 5143, 29918, 2218, 29901, 13, 9651, 565, 451, 1583, 29889, 11228, 29918, 1131, 547, 29918, 2098, 29918, 328, 5143, 287, 29901, 13, 18884, 1583, 29889, 11228, 29918, 1131, 547, 29918, 2098, 29918, 328, 5143, 287, 353, 5852, 13, 18884, 1583, 29889, 2344, 29918, 328, 5143, 580, 13, 308, 13, 4706, 14550, 13, 13, 4706, 1375, 29918, 19244, 353, 1375, 4197, 1311, 29889, 657, 29918, 2218, 29898, 459, 29889, 1367, 29892, 282, 29889, 1367, 29897, 363, 1015, 297, 1583, 29889, 459, 29918, 9018, 267, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 2314, 13, 4706, 565, 1375, 29918, 19244, 1405, 10886, 29918, 1131, 547, 29918, 2098, 29918, 328, 5143, 29918, 2218, 29901, 13, 9651, 1583, 29889, 1482, 29918, 2344, 29918, 328, 5143, 580, 13, 13, 4706, 396, 29871, 31393, 30763, 30998, 233, 152, 143, 30525, 30210, 31352, 232, 191, 188, 30895, 31062, 31182, 30780, 233, 159, 174, 231, 191, 155, 31244, 234, 189, 170, 13, 4706, 1583, 29889, 328, 5143, 29918, 1609, 29918, 1563, 29918, 314, 4346, 580, 13, 13, 4706, 14550, 13, 4706, 396, 29871, 30948, 233, 152, 143, 30525, 30210, 30417, 30313, 31429, 235, 186, 160, 234, 169, 190, 30446, 236, 155, 162, 30275, 30753, 30636, 30494, 31911, 30210, 235, 186, 160, 234, 169, 190, 30446, 30909, 29945, 29900, 30214, 29871, 31391, 30767, 235, 186, 160, 234, 169, 190, 31450, 31474, 30494, 31911, 30210, 235, 186, 160, 234, 169, 190, 30446, 30909, 29941, 29900, 30214, 30446, 236, 155, 162, 30728, 30753, 30988, 30494, 31911, 30658, 232, 193, 131, 233, 176, 191, 234, 132, 176, 233, 152, 143, 30525, 30417, 30313, 31429, 13, 4706, 1015, 29918, 29894, 666, 353, 1583, 29889, 2886, 29918, 22116, 29918, 1609, 29918, 978, 29898, 1311, 29889, 459, 29918, 2780, 718, 376, 30417, 30313, 31429, 1159, 13, 4706, 565, 1015, 29918, 29894, 666, 338, 6213, 29901, 736, 13, 13, 4706, 822, 5337, 29918, 29894, 666, 29918, 4102, 29898, 29886, 1125, 13, 9651, 396, 444, 1596, 231, 189, 177, 234, 183, 174, 29898, 29886, 29889, 1131, 547, 29918, 2098, 29897, 13, 9651, 282, 29889, 1131, 547, 29918, 2098, 353, 518, 459, 29918, 978, 363, 1015, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 565, 376, 30417, 30313, 31429, 29908, 297, 1015, 29918, 978, 29962, 718, 320, 13, 462, 9651, 518, 459, 29918, 978, 363, 1015, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 565, 376, 30417, 30313, 31429, 29908, 451, 297, 1015, 29918, 978, 29962, 13, 9651, 396, 444, 1596, 231, 189, 177, 235, 150, 160, 29898, 29886, 29889, 1131, 547, 29918, 2098, 29897, 13, 9651, 1209, 13, 13, 4706, 10023, 29879, 353, 6024, 29965, 29896, 742, 525, 29965, 29906, 2033, 13, 4706, 363, 10023, 297, 10023, 29879, 29901, 13, 9651, 282, 29918, 1761, 353, 1583, 29889, 2886, 29918, 9018, 267, 29918, 1609, 29918, 29879, 3425, 29898, 29879, 3425, 29897, 13, 9651, 565, 7431, 29898, 29886, 29918, 1761, 29897, 1360, 29900, 29901, 6773, 13, 9651, 766, 29906, 29918, 459, 29918, 29894, 666, 353, 518, 1311, 29889, 657, 29918, 2218, 29898, 29886, 29889, 1367, 29892, 1015, 29918, 29894, 666, 29889, 1367, 29897, 363, 282, 297, 282, 29918, 1761, 29962, 13, 9651, 565, 1375, 29898, 2218, 29906, 29918, 459, 29918, 29894, 666, 29897, 529, 29871, 29941, 29900, 29872, 29941, 29901, 13, 18884, 396, 444, 1596, 231, 189, 177, 234, 183, 174, 877, 30446, 236, 155, 162, 30753, 30988, 233, 151, 190, 31768, 30417, 30313, 31429, 1495, 13, 18884, 363, 282, 297, 282, 29918, 1761, 29901, 5337, 29918, 29894, 666, 29918, 4102, 29898, 29886, 29897, 13, 9651, 25342, 4236, 29898, 2218, 29906, 29918, 459, 29918, 29894, 666, 29897, 529, 29871, 29945, 29900, 29872, 29941, 29901, 13, 18884, 396, 444, 1596, 231, 189, 177, 234, 183, 174, 877, 30446, 236, 155, 162, 30753, 30988, 233, 151, 190, 31768, 30417, 30313, 31429, 1495, 13, 18884, 363, 282, 297, 282, 29918, 1761, 29901, 5337, 29918, 29894, 666, 29918, 4102, 29898, 29886, 29897, 13, 4706, 14550, 13, 4706, 736, 13, 13, 1678, 822, 10365, 29918, 1131, 547, 29918, 2098, 29918, 21646, 29906, 29898, 1311, 1125, 13, 4706, 363, 282, 297, 1583, 29889, 1357, 29918, 9018, 267, 29901, 13, 9651, 565, 756, 5552, 29898, 29886, 29892, 525, 1516, 29918, 22197, 29918, 29879, 12981, 2868, 29918, 5182, 1495, 322, 282, 29889, 1516, 29918, 22197, 29918, 29879, 12981, 2868, 29918, 5182, 338, 451, 6213, 29901, 13, 18884, 396, 29871, 31393, 30763, 10887, 29918, 22197, 29918, 29879, 12981, 2868, 29918, 5182, 29871, 31268, 233, 152, 183, 233, 151, 190, 31768, 31463, 31025, 13, 18884, 5337, 29918, 1761, 353, 518, 1311, 29889, 2886, 29918, 22116, 29918, 1609, 29918, 978, 29898, 459, 29918, 978, 29897, 363, 1015, 29918, 978, 297, 282, 29889, 1131, 547, 29918, 2098, 29962, 13, 18884, 5337, 29918, 1761, 353, 518, 459, 363, 1015, 297, 5337, 29918, 1761, 565, 1015, 338, 451, 6213, 29962, 13, 18884, 716, 29918, 1131, 547, 29918, 1761, 29918, 8945, 353, 5159, 13, 18884, 716, 29918, 1131, 547, 29918, 1761, 29918, 29324, 1627, 353, 5159, 13, 18884, 363, 474, 297, 3464, 29898, 2435, 29898, 1131, 547, 29918, 1761, 22164, 13, 462, 1678, 565, 5337, 29918, 1761, 29961, 29875, 1822, 1367, 1275, 282, 29889, 1516, 29918, 22197, 29918, 29879, 12981, 2868, 29918, 5182, 29889, 1367, 29901, 13, 462, 4706, 716, 29918, 1131, 547, 29918, 1761, 29918, 29324, 1627, 29889, 4397, 29898, 1131, 547, 29918, 1761, 29961, 29875, 2314, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 716, 29918, 1131, 547, 29918, 1761, 29918, 8945, 29889, 4397, 29898, 1131, 547, 29918, 1761, 29961, 29875, 2314, 13, 18884, 716, 29918, 1131, 547, 29918, 1761, 353, 518, 29886, 29889, 1516, 29918, 22197, 29918, 29879, 12981, 2868, 29918, 5182, 29962, 718, 716, 29918, 1131, 547, 29918, 1761, 29918, 8945, 718, 716, 29918, 1131, 547, 29918, 1761, 29918, 29324, 1627, 13, 18884, 282, 29889, 1131, 547, 29918, 2098, 353, 518, 459, 29889, 1170, 363, 1015, 297, 716, 29918, 1131, 547, 29918, 1761, 29962, 13, 2 ]
training_with_dt.py
AlfredYang1986/phcleanning
0
1606261
<gh_stars>0 # -*- coding: utf-8 -*- """<EMAIL>. 功能描述:job3:left join cpa和prod * @author yzy * @version 0.0 * @since 2020/08/12 * @note 落盘数据:cpa_prod_join """ import os from pyspark.sql import SparkSession from dataparepare import * from interfere import * from pyspark.sql.types import * from pyspark.sql.functions import desc from pyspark.sql.functions import rank from pyspark.sql import Window from pyspark.ml.linalg import Vectors, VectorUDT from pyspark.ml.classification import MultilayerPerceptronClassifier from pyspark.ml import Pipeline from pyspark.ml.classification import DecisionTreeClassifier from pyspark.ml.feature import StringIndexer, VectorIndexer from pyspark.ml.evaluation import MulticlassClassificationEvaluator def prepare(): os.environ["PYSPARK_PYTHON"] = "python3" # 读取s3桶中的数据 spark = SparkSession.builder \ .master("yarn") \ .appName("CPA&GYC match refactor") \ .config("spark.driver.memory", "1g") \ .config("spark.executor.cores", "1") \ .config("spark.executor.instances", "2") \ .config("spark.executor.memory", "2g") \ .config('spark.sql.codegen.wholeStage', False) \ .getOrCreate() access_key = os.getenv("AWS_ACCESS_KEY_ID") secret_key = os.getenv("AWS_SECRET_ACCESS_KEY") if access_key is not None: spark._jsc.hadoopConfiguration().set("fs.s3a.access.key", access_key) spark._jsc.hadoopConfiguration().set("fs.s3a.secret.key", secret_key) spark._jsc.hadoopConfiguration().set("fs.s3a.impl","org.apache.hadoop.fs.s3a.S3AFileSystem") spark._jsc.hadoopConfiguration().set("com.amazonaws.services.s3.enableV4", "true") # spark._jsc.hadoopConfiguration().set("fs.s3a.aws.credentials.provider","org.apache.hadoop.fs.s3a.BasicAWSCredentialsProvider") spark._jsc.hadoopConfiguration().set("fs.s3a.endpoint", "s3.cn-northwest-1.amazonaws.com.cn") return spark if __name__ == '__main__': spark = prepare() # 0. load the cleanning data df_cleanning = load_training_data(spark).select("id").distinct() # Split the data into training and test sets (30% held out for testing) (df_training, df_test) = df_cleanning.randomSplit([0.7, 0.3]) # 1. load the training data # 准备训练集合 df_result = load_training_data(spark) df_result = df_result.select("id", "label", "features") labelIndexer = StringIndexer(inputCol="label", outputCol="indexedLabel").fit(df_result) featureIndexer = VectorIndexer(inputCol="features", outputCol="indexedFeatures", maxCategories=6).fit(df_result) df_training.show(10) # 1.1 构建训练集合 df_training = df_training.join(df_result, how="left", on="id") df_training.show() # 1.2 构建测试集合 df_test = df_test.join(df_result, how="left", on="id") df_test.show() # Train a DecisionTree model. dt = DecisionTreeClassifier(labelCol="indexedLabel", featuresCol="indexedFeatures") # Chain indexers and tree in a Pipeline pipeline = Pipeline(stages=[labelIndexer, featureIndexer, dt]) # Train model. This also runs the indexers. model = pipeline.fit(df_training) # Make predictions. df_predictions = model.transform(df_test) # Select example rows to display. df_predictions.show(10) df_predictions.select("prediction", "indexedLabel", "features").show(5) # Select (prediction, true label) and compute test error evaluator = MulticlassClassificationEvaluator( labelCol="indexedLabel", predictionCol="prediction", metricName="accuracy") accuracy = evaluator.evaluate(df_predictions) print("Test Error = %g " % (1.0 - accuracy)) treeModel = model.stages[2] # summary only print(treeModel) # model.write().overwrite().save("s3a://ph-max-auto/2020-08-11/BPBatchDAG/refactor/alfred/dt") model.write().overwrite().save("s3a://ph-max-auto/2020-08-11/BPBatchDAG/refactor/zyyin/pfizer_model/0.0.4/model")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 29966, 26862, 6227, 15513, 13, 13, 31134, 30815, 233, 146, 146, 235, 194, 179, 30383, 9057, 29941, 30383, 1563, 5988, 274, 3274, 30503, 10633, 13, 29871, 334, 732, 8921, 343, 1537, 13, 29871, 334, 732, 3259, 29871, 29900, 29889, 29900, 13, 29871, 334, 732, 16076, 29871, 29906, 29900, 29906, 29900, 29914, 29900, 29947, 29914, 29896, 29906, 13, 29871, 334, 732, 6812, 259, 235, 147, 192, 234, 158, 155, 30354, 30763, 30383, 29883, 3274, 29918, 10633, 29918, 7122, 13, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 3166, 282, 952, 6378, 29889, 2850, 1053, 20814, 7317, 13, 3166, 1418, 481, 598, 29886, 598, 1053, 334, 13, 3166, 1006, 29888, 406, 1053, 334, 13, 3166, 282, 952, 6378, 29889, 2850, 29889, 8768, 1053, 334, 13, 3166, 282, 952, 6378, 29889, 2850, 29889, 12171, 1053, 5153, 13, 3166, 282, 952, 6378, 29889, 2850, 29889, 12171, 1053, 7115, 13, 3166, 282, 952, 6378, 29889, 2850, 1053, 18379, 13, 3166, 282, 952, 6378, 29889, 828, 29889, 29880, 979, 29887, 1053, 478, 11142, 29892, 16510, 29965, 12972, 13, 3166, 282, 952, 6378, 29889, 828, 29889, 1990, 2450, 1053, 9683, 309, 2747, 5894, 1547, 1617, 2385, 3709, 13, 3166, 282, 952, 6378, 29889, 828, 1053, 349, 23828, 13, 3166, 282, 952, 6378, 29889, 828, 29889, 1990, 2450, 1053, 3826, 2459, 9643, 2385, 3709, 13, 3166, 282, 952, 6378, 29889, 828, 29889, 14394, 1053, 1714, 3220, 261, 29892, 16510, 3220, 261, 13, 3166, 282, 952, 6378, 29889, 828, 29889, 24219, 362, 1053, 9683, 293, 605, 2385, 2450, 29923, 4387, 1061, 13, 13, 13, 1753, 19012, 7295, 13, 12, 359, 29889, 21813, 3366, 20055, 5550, 1718, 29968, 29918, 20055, 4690, 1164, 3108, 353, 376, 4691, 29941, 29908, 13, 12, 29937, 29871, 235, 178, 190, 30683, 29879, 29941, 233, 164, 185, 30275, 30210, 30354, 30763, 13, 12, 12597, 353, 20814, 7317, 29889, 16409, 320, 13, 12, 12, 29889, 6207, 703, 29891, 2753, 1159, 320, 13, 12, 12, 29889, 932, 1170, 703, 6271, 29909, 29987, 29954, 29979, 29907, 1993, 28559, 1159, 320, 13, 12, 12, 29889, 2917, 703, 12597, 29889, 9465, 29889, 14834, 613, 376, 29896, 29887, 1159, 320, 13, 12, 12, 29889, 2917, 703, 12597, 29889, 4258, 3406, 29889, 29883, 2361, 613, 376, 29896, 1159, 320, 13, 12, 12, 29889, 2917, 703, 12597, 29889, 4258, 3406, 29889, 2611, 2925, 613, 376, 29906, 1159, 320, 13, 12, 12, 29889, 2917, 703, 12597, 29889, 4258, 3406, 29889, 14834, 613, 376, 29906, 29887, 1159, 320, 13, 12, 12, 29889, 2917, 877, 12597, 29889, 2850, 29889, 401, 1885, 29889, 15970, 280, 27276, 742, 7700, 29897, 320, 13, 12, 12, 29889, 657, 2816, 4391, 580, 13, 13, 12, 5943, 29918, 1989, 353, 2897, 29889, 657, 6272, 703, 29909, 7811, 29918, 2477, 23524, 29918, 10818, 29918, 1367, 1159, 13, 12, 19024, 29918, 1989, 353, 2897, 29889, 657, 6272, 703, 29909, 7811, 29918, 1660, 22245, 29911, 29918, 2477, 23524, 29918, 10818, 1159, 13, 12, 361, 2130, 29918, 1989, 338, 451, 6213, 29901, 13, 12, 12, 12597, 3032, 1315, 29883, 29889, 22075, 8614, 2141, 842, 703, 5847, 29889, 29879, 29941, 29874, 29889, 5943, 29889, 1989, 613, 2130, 29918, 1989, 29897, 13, 12, 12, 12597, 3032, 1315, 29883, 29889, 22075, 8614, 2141, 842, 703, 5847, 29889, 29879, 29941, 29874, 29889, 19024, 29889, 1989, 613, 7035, 29918, 1989, 29897, 13, 12, 12, 12597, 3032, 1315, 29883, 29889, 22075, 8614, 2141, 842, 703, 5847, 29889, 29879, 29941, 29874, 29889, 13699, 3284, 990, 29889, 4288, 29889, 22075, 29889, 5847, 29889, 29879, 29941, 29874, 29889, 29903, 29941, 29909, 2283, 3924, 1159, 13, 12, 12, 12597, 3032, 1315, 29883, 29889, 22075, 8614, 2141, 842, 703, 510, 29889, 17260, 10467, 29889, 9916, 29889, 29879, 29941, 29889, 12007, 29963, 29946, 613, 376, 3009, 1159, 13, 12, 12, 29937, 16267, 3032, 1315, 29883, 29889, 22075, 8614, 2141, 842, 703, 5847, 29889, 29879, 29941, 29874, 29889, 10467, 29889, 11944, 9409, 29889, 18121, 3284, 990, 29889, 4288, 29889, 22075, 29889, 5847, 29889, 29879, 29941, 29874, 29889, 16616, 29376, 7187, 1127, 9409, 6980, 1159, 13, 12, 12, 12597, 3032, 1315, 29883, 29889, 22075, 8614, 2141, 842, 703, 5847, 29889, 29879, 29941, 29874, 29889, 29734, 613, 376, 29879, 29941, 29889, 18038, 29899, 29876, 2072, 5933, 29899, 29896, 29889, 17260, 10467, 29889, 510, 29889, 18038, 1159, 13, 13, 12, 2457, 16267, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 12, 12597, 353, 19012, 580, 13, 13, 12, 29937, 29871, 29900, 29889, 2254, 278, 4531, 9450, 848, 13, 12, 2176, 29918, 2841, 9450, 353, 2254, 29918, 26495, 29918, 1272, 29898, 12597, 467, 2622, 703, 333, 2564, 5721, 5562, 580, 13, 12, 29937, 26178, 278, 848, 964, 6694, 322, 1243, 6166, 313, 29941, 29900, 29995, 4934, 714, 363, 6724, 29897, 13, 12, 29898, 2176, 29918, 26495, 29892, 4489, 29918, 1688, 29897, 353, 4489, 29918, 2841, 9450, 29889, 8172, 18772, 4197, 29900, 29889, 29955, 29892, 29871, 29900, 29889, 29941, 2314, 13, 13, 12, 29937, 29871, 29896, 29889, 2254, 278, 6694, 848, 13, 12, 29937, 29871, 232, 138, 137, 232, 167, 138, 235, 177, 176, 234, 190, 134, 30893, 30733, 13, 12, 2176, 29918, 2914, 353, 2254, 29918, 26495, 29918, 1272, 29898, 12597, 29897, 13, 12, 2176, 29918, 2914, 353, 4489, 29918, 2914, 29889, 2622, 703, 333, 613, 376, 1643, 613, 376, 22100, 1159, 13, 12, 1643, 3220, 261, 353, 1714, 3220, 261, 29898, 2080, 1625, 543, 1643, 613, 1962, 1625, 543, 2248, 287, 4775, 2564, 9202, 29898, 2176, 29918, 2914, 29897, 13, 12, 14394, 3220, 261, 353, 16510, 3220, 261, 29898, 2080, 1625, 543, 22100, 613, 1962, 1625, 543, 2248, 287, 8263, 3698, 613, 4236, 29907, 14404, 29922, 29953, 467, 9202, 29898, 2176, 29918, 2914, 29897, 13, 12, 2176, 29918, 26495, 29889, 4294, 29898, 29896, 29900, 29897, 13, 12, 29937, 29871, 29896, 29889, 29896, 29871, 31901, 30886, 235, 177, 176, 234, 190, 134, 30893, 30733, 13, 12, 2176, 29918, 26495, 353, 4489, 29918, 26495, 29889, 7122, 29898, 2176, 29918, 2914, 29892, 920, 543, 1563, 613, 373, 543, 333, 1159, 13, 12, 2176, 29918, 26495, 29889, 4294, 580, 13, 13, 12, 29937, 29871, 29896, 29889, 29906, 29871, 31901, 30886, 31851, 31787, 30893, 30733, 13, 12, 2176, 29918, 1688, 353, 4489, 29918, 1688, 29889, 7122, 29898, 2176, 29918, 2914, 29892, 920, 543, 1563, 613, 373, 543, 333, 1159, 13, 12, 2176, 29918, 1688, 29889, 4294, 580, 13, 13, 12, 29937, 28186, 263, 3826, 2459, 9643, 1904, 29889, 13, 12, 6008, 353, 3826, 2459, 9643, 2385, 3709, 29898, 1643, 1625, 543, 2248, 287, 4775, 613, 5680, 1625, 543, 2248, 287, 8263, 3698, 1159, 13, 13, 12, 29937, 678, 475, 2380, 414, 322, 5447, 297, 263, 349, 23828, 13, 12, 13096, 5570, 353, 349, 23828, 29898, 303, 1179, 11759, 1643, 3220, 261, 29892, 4682, 3220, 261, 29892, 11636, 2314, 13, 13, 12, 29937, 28186, 1904, 29889, 29871, 910, 884, 6057, 278, 2380, 414, 29889, 13, 12, 4299, 353, 16439, 29889, 9202, 29898, 2176, 29918, 26495, 29897, 13, 13, 12, 29937, 8561, 27303, 29889, 13, 12, 2176, 29918, 27711, 1080, 353, 1904, 29889, 9067, 29898, 2176, 29918, 1688, 29897, 13, 13, 12, 29937, 7605, 1342, 4206, 304, 2479, 29889, 13, 12, 2176, 29918, 27711, 1080, 29889, 4294, 29898, 29896, 29900, 29897, 13, 12, 2176, 29918, 27711, 1080, 29889, 2622, 703, 11965, 2463, 613, 376, 2248, 287, 4775, 613, 376, 22100, 2564, 4294, 29898, 29945, 29897, 13, 13, 12, 29937, 7605, 313, 11965, 2463, 29892, 1565, 3858, 29897, 322, 10272, 1243, 1059, 13, 12, 24219, 1061, 353, 9683, 293, 605, 2385, 2450, 29923, 4387, 1061, 29898, 13, 12, 1678, 3858, 1625, 543, 2248, 287, 4775, 613, 18988, 1625, 543, 11965, 2463, 613, 12714, 1170, 543, 562, 2764, 4135, 1159, 13, 12, 562, 2764, 4135, 353, 6161, 1061, 29889, 24219, 403, 29898, 2176, 29918, 27711, 1080, 29897, 13, 12, 2158, 703, 3057, 4829, 353, 1273, 29887, 376, 1273, 313, 29896, 29889, 29900, 448, 13600, 876, 13, 13, 12, 8336, 3195, 353, 1904, 29889, 303, 1179, 29961, 29906, 29962, 13, 12, 29937, 15837, 871, 13, 12, 2158, 29898, 8336, 3195, 29897, 13, 13, 12, 29937, 1904, 29889, 3539, 2141, 957, 3539, 2141, 7620, 703, 29879, 29941, 29874, 597, 561, 29899, 3317, 29899, 6921, 29914, 29906, 29900, 29906, 29900, 29899, 29900, 29947, 29899, 29896, 29896, 29914, 29933, 29925, 23145, 7698, 29954, 29914, 999, 7168, 29914, 3131, 1127, 29914, 6008, 1159, 13, 12, 4299, 29889, 3539, 2141, 957, 3539, 2141, 7620, 703, 29879, 29941, 29874, 597, 561, 29899, 3317, 29899, 6921, 29914, 29906, 29900, 29906, 29900, 29899, 29900, 29947, 29899, 29896, 29896, 29914, 29933, 29925, 23145, 7698, 29954, 29914, 999, 7168, 29914, 1537, 29891, 262, 29914, 7810, 3950, 29918, 4299, 29914, 29900, 29889, 29900, 29889, 29946, 29914, 4299, 1159, 2 ]
src/poretitioner/utils/filtering.py
uwmisl/poretitioner
2
7180
""" ========= filtering.py ========= This module provides more granular filtering for captures. You can customize your own filters too. """ from __future__ import annotations import re from abc import ABC, ABCMeta, abstractmethod from dataclasses import dataclass from json import JSONEncoder from pathlib import PosixPath from typing import ( Any, Dict, Iterable, Mapping, NewType, Optional, Protocol, Type, TypedDict, Union, ) import h5py import numpy as np from h5py import File as Fast5File from ..hdf5 import ( HasFast5, HDF5_Group, HDF5_GroupSerialableDataclass, HDF5_GroupSerializable, HDF5_GroupSerializing, IsAttr, ) from ..logger import Logger, getLogger from ..signals import Capture from .core import NumpyArrayLike, PathLikeOrString, ReadId, stripped_by_keys from .plugin import Plugin CaptureOrTimeSeries = Union[Capture, NumpyArrayLike] # Unique identifier for a collection of filters (e.g. "ProfJeffsAwesomeFilters") FilterSetId = NewType("FilterSetId", str) # Unique identifier for an individual filter (e.g. "min_frac") FilterName = NewType("FilterName", str) __all__ = [ "does_pass_filters", "get_filters", "FilterName", "FilterSetId", "FilterConfig", "Filter", "Filters", "DEFAULT_FILTER_PLUGINS", "FilterSet", "FilterConfigs", "FilterPlugin", "PATH", ] @dataclass(frozen=True) class FILTER_PATH: ROOT = f"/Filter/" @classmethod def filter_set_path(cls, filter_set_id: FilterSetId) -> str: filter_path = str(PosixPath(FILTER_PATH.ROOT, filter_set_id)) return filter_path @classmethod def filter_set_pass_path(cls, filter_set_id: FilterSetId) -> str: pass_path = str(PosixPath(FILTER_PATH.filter_set_path(filter_set_id), "pass")) return pass_path @classmethod def filter_set_pass_path_for_read_id(cls, filter_set_id: FilterSetId, read_id: ReadId) -> str: pass_path = str(PosixPath(FILTER_PATH.filter_set_pass_path(filter_set_id), read_id)) return pass_path class FilterConfig(TypedDict): """A blueprint for how to construct a FilterPlugin. Contains a name, and any number of other attributes Note on terminology: - FilterConfig: A high-level description of a filter. - FilterPlugin: An actual, callable, implementation of a FilterConfig. For custom plugins, make sure "filepath" is an attribute that points to the file to laod """ # Mapping of a FilterName to filter configurations. FilterConfigs = NewType("FilterConfigs", Dict[FilterName, FilterConfig]) # TODO: Filter Plugin should check that name is unique. https://github.com/uwmisl/poretitioner/issues/91 class FilterPlugin(Plugin): """ Abstract class for Filter plugins. To write your own filter, subclass this abstract class and implement the `apply` method and `name` property. """ @classmethod @abstractmethod def name(cls) -> str: """Unique name for this filter. Make sure it doesn't conflict with any existing names. Returns ------- str The unique name for this filter (e.g. "fourier_transform"). Raises ------ NotImplementedError Raised if this filter is called without this name method being implemented. """ raise NotImplementedError( "'name' class method not implemented for filter. This class method should return a unique name for this filter." ) @abstractmethod def apply(self, capture: CaptureOrTimeSeries) -> bool: """Returns True if a capture passes a given filter criteria. For instance, a range filter would check that a capture's summary statistsics lie within a given range. Parameters ---------- capture : np.typing.ArrayLike Time series capture to filter. Returns ------- bool Whether this capture passes the filter. Raises ------ NotImplementedError Raised when the filter method isn't implemented by the consuming Filter class """ raise NotImplementedError( "'apply' method not implemented for filter. This method should return True if and only if applied to a capture that meets the filter criterion. For instance, " ) def __call__(self, capture: CaptureOrTimeSeries) -> bool: """Apply the filter. Defining `__call__` lets us do nice things like: class MyCustomFilter(FilterPlugin): def apply(capture): # ... pass # Later in code where filtering is done.... valid_captures = [] filters = [ MyCustomFilter(), AnotherCustomFilter(), ... ] valid_captures = [capture for capture in captures if all([filt(capture) for filt in filters])] for capture in captures: # You'd want to parallelize this in a real life example... for filt in filters: filtered_captures = filt(capture). Parameters ---------- capture : CaptureOrTimeSeries Capture to filter. Returns ------- bool Whether this capture passes the filter. """ result = self.apply(capture) return result RANGE_FILTER_DEFAULT_MINIMUM: float = -np.inf RANGE_FILTER_DEFAULT_MAXIMUM: float = np.inf class RangeFilter(FilterPlugin): def __init__(self, minimum: Optional[float] = None, maximum: Optional[float] = None): """A filter that filters based on whether a signal falls between a maximum and a minimum. Parameters ---------- minimum : float, optional The smallest value this signal should be allowed to take (inclusive), by default RangeFilter.DEFAULT_MINIMUM maximum : float, optional The largest value this signal should be allowed to take (inclusive), by default RangeFilter.DEFAULT_MAXIMUM """ self.minimum = minimum if minimum is not None else RANGE_FILTER_DEFAULT_MINIMUM self.maximum = maximum if maximum is not None else RANGE_FILTER_DEFAULT_MAXIMUM def extract(self, capture: CaptureOrTimeSeries) -> NumpyArrayLike: """Extracts a summary statistic from the capture (e.g. mean, length, standard deviation). Identity operation by default (just returns the capture). You can use this function to transform the data in a useful way before processing it (e.g. getting the mean value of a capture before filtering based on that mean.) Note: If we picture the filtering workflow as an ETL (Extract-Transform-Load) pipeline, this would be the "transform" (take data, modify it for a later purpose), but I feel that "transform" is perhaps a misleading function name in this context. Parameters ---------- capture : CaptureOrTimeSeries Capture from which to extract data. """ try: signal = capture.fractionalized() except AttributeError: signal = capture else: signal = capture return signal # signal = getattr(capture, Capture.fractionalized.__name__, capture) def is_in_range(self, value: Union[NumpyArrayLike, float]) -> bool: try: # If the value is just a float, we can use this handy syntax: return self.minimum <= value <= self.maximum except ValueError: # But we're not allowed to use that syntax on numpy arrays. return all(np.logical_and(self.minimum <= value, value <= self.maximum)) def apply(self, signal): value = self.extract(signal) return self.is_in_range(value) class StandardDeviationFilter(RangeFilter): """Filters for captures with standard deviations in some range.""" @classmethod def name(cls) -> str: return "stdv" def extract(self, capture: CaptureOrTimeSeries): signal = super().extract(capture) return np.std(signal) class MeanFilter(RangeFilter): """Filters for captures with an arithmetic mean within a range.""" @classmethod def name(cls) -> str: return "mean" def extract(self, capture: CaptureOrTimeSeries): signal = super().extract(capture) return np.mean(signal) class MedianFilter(RangeFilter): """Filters for captures with a median within a range.""" @classmethod def name(cls) -> str: return "median" def extract(self, capture: CaptureOrTimeSeries): signal = super().extract(capture) return np.median(signal) class MinimumFilter(RangeFilter): """Filters for captures with a minimum within a range.""" @classmethod def name(cls) -> str: return "min" def extract(self, capture: CaptureOrTimeSeries): signal = super().extract(capture) return np.min(signal) class MaximumFilter(RangeFilter): """Filters for captures with a maximum within a range.""" @classmethod def name(cls) -> str: return "max" def extract(self, capture: CaptureOrTimeSeries): signal = super().extract(capture) return np.max(signal) class LengthFilter(RangeFilter): """Filters captures based on their length.""" @classmethod def name(cls) -> str: return "length" def extract(self, capture: CaptureOrTimeSeries): signal = super().extract(capture) return len(signal) class EjectedFilter(FilterPlugin): """Filters captures based on whether they were ejected from the pore.""" @classmethod def name(cls) -> str: return "ejected" def extract(self, capture: Capture): return capture.ejected """ How to Create Your Own Custom Filter: Need more advanced filtering than what we provide out of the box? No problem. Create your own custom filter by inheriting from the FilterPlugin class. For this example, let's do something complex. Say you only want to examine captures that have more than 5 samples with a hyperbolic tangent greater than some threshold. That means our custom filter's `apply` function should return True if and only if the signal has more than 5 samples greater than the threshold, after taking the hyperbolic tangent in `extract`. """ class MyCustomFilter(FilterPlugin): threshold: float = 0.5 # Totally arbitrary. def name(self): return "foo" def extract(self, capture): # Do the transformations here, or pre-process it before the filter. # Gets the hyperbolic tangent of the signal. extracted = np.tanh(capture.signal) return extracted def apply(self, signal): # Only return true if more than 5 samples have a square root greater than 2.0 (arbitrary) extracted = self.extract(signal) # If we want to filter out signals with fewer than 5 matching samples, then we # should retrun True when there are 5 or more matching samples. n_meeting_threshold = len( extracted[extracted > self.threshold] ) # Number of samples greater than the threshold meets_criteria = ( n_meeting_threshold >= 5 ) # Are there at least 5 samples meeting this threshold? return meets_criteria def apply_feature_filters(capture: CaptureOrTimeSeries, filters: List[FilterPlugin]) -> bool: """ Check whether an array of current values (i.e. a single nanopore capture) passes a set of filters. Filters can be based on summary statistics (e.g., mean) and/or a range of allowed values. Notes on filter behavior: If the filters list is empty, there are no filters and the capture passes. Parameters ---------- capture : CaptureOrTimeSeries | NumpyArrayLike Capture containing time series of nanopore current values for a single capture, or the signal itself. filters : List[FilterPlugin] List of FilterPlugin instances. Write your own filter by subclassing FilterPlugin. Returns ------- boolean True if capture passes all filters; False otherwise. """ if filters is None: filters = [] # TODO: Parallelize? https://github.com/uwmisl/poretitioner/issues/67 filtered = [filter_out(capture) for filter_out in filters] print(filtered) # Did this signal pass all filters? all_passed = all(filtered) return all_passed def check_capture_ejection_by_read(f5, read_id): """Checks whether the current capture was in the pore until the voltage was reversed. Parameters ---------- f5 : h5py.File object (open for reading or more) Capture fast5 file read_id : TODO Returns ------- boolean True if the end of the capture coincides with the end of a voltage window. """ try: ejected = f5.get(f"/read_{read_id}/Signal").attrs["ejected"] except AttributeError: raise ValueError(f"path /read_{read_id} does not exist in the fast5 file.") return ejected def check_capture_ejection(end_capture, voltage_ends, tol_obs=20): """Checks whether the current capture was in the pore until the voltage was reversed. Essentially checks whether a value (end_capture) is close enough (within a margin of tol_obs) to any value in voltage_ends. Parameters ---------- end_capture : numeric The end time of the capture. voltage_ends : list of numeric List of times when the standard voltage ends. tol_obs : int, optional Tolerance for defining when the end of the capture = voltage end, by default 20 Returns ------- boolean True if the end of the capture coincides with the end of a voltage window. """ for voltage_end in voltage_ends: if np.abs(end_capture - voltage_end) < tol_obs: return True return False def filter_like_existing(config, example_fast5, example_filter_path, fast5_files, new_filter_path): # Filters a set of fast5 files exactly the same as an existing filter # TODO : #68 : implement raise NotImplementedError() def get_filter_pass_path(filter_set_id, read_id): return FILTER_PATH.filter_set_pass_path(filter_set_id) __DEFAULT_FILTER_PLUGINS = [ MeanFilter, StandardDeviationFilter, MedianFilter, MinimumFilter, MaximumFilter, LengthFilter, ] DEFAULT_FILTER_PLUGINS = { filter_plugin_class.name(): filter_plugin_class for filter_plugin_class in __DEFAULT_FILTER_PLUGINS } class Filtering(Protocol): """Classes that adhere to the Filtering protocol provide an 'apply' method to an input that returns True if and only if the input passes its filter. These are also callable, so calling a filter on an input is functionally equivalent to calling its apply method. """ def __call__(self, *args, **kwargs) -> bool: raise NotImplementedError("Filtering protocol hasn't implemented __call__ yet!") def apply(self, *args, **kwargs) -> bool: raise NotImplementedError("Filtering protocol hasn't implemented Apply yet!") @dataclass class Filter(Filtering): """A named filter that can be applied to some data. You can use this filter by just calling it on some data. my_signal = [1,2,3,4] filter = Filter(...) passed_filter: bool = filter(my_signal) Parameters ---------- config : FilterConfig A description of this filter's configuration (e.g. where it was loaded from). plugin : FilterPlugin The actual implementation of this filter. We have this class defined with """ config: FilterConfig plugin: FilterPlugin def __call__(self, *args, **kwargs) -> bool: return self.plugin(*args, **kwargs) def apply(self, *args, **kwargs) -> bool: return self.plugin.apply(*args, **kwargs) @property def name(self) -> FilterName: return FilterName(self.plugin.__class__.name()) def as_attr(self) -> Dict[str, Any]: name = self.name attrs = {**vars(self.config), **vars(self.plugin), name: name} return attrs def from_attr(self, attr) -> IsAttr: ... import json @dataclass class HDF5_FilterSerialable(Filter, HDF5_GroupSerialableDataclass): def as_group(self, parent_group: HDF5_Group, log: Optional[Logger] = None) -> HDF5_Group: log = log if log is not None else getLogger() # Note: This line simply registers a group with the name 'name' in the parent group. this_group = HDF5_Group(parent_group.require_group(self.name)) all_attrs = {**self.config, **vars(self.plugin)} this_group.create_attrs(all_attrs) # Implementers must now write their serialized instance to this group. return this_group @classmethod def from_group( cls, group: HDF5_Group, log: Optional[Logger] = None ) -> HDF5_GroupSerialableDataclass: # You see, the trouble is, in the above 'as_group' call, we lumped together # all the attributes of the FilterConfig and the FilterPlugin, not knowing # which attributes belonged to which class. # # Now, here in `from_group`, it's time to pay the piper and figure out which attribute # goes where to create a new Filter instance. # # This is likely achievable through the plugin architecture, since the plugin's # name is unique, we can try to find a plugin with a given name, then get its attributes from there. # Load log.warning("Filter.from_group not implemented...It's a whole thing (see comment)") # This is pure <NAME>. return super().from_group(group, log) # class Filters(HDF5_GroupSerialableDataclass): # filters: Filters = Dict[FilterName, Filter] def get_filters(filter_configs: Optional[FilterConfigs] = None) -> Filters: """Creates Filters from a list of filter configurations. Parameters ---------- filter_configs : Optional[FilterConfigs] A mapping of filter names to their configurations, None by default (i.e. no filtering). Returns ------- Filters A set of callable/applyable filters. """ filter_configs = filter_configs if filter_configs is not None else FilterConfigs({}) my_filters = { name: filter_from_config(name, filter_config) for name, filter_config in filter_configs.items() } return my_filters def does_pass_filters(capture: CaptureOrTimeSeries, filters: Iterable[Filter]) -> bool: """ Check whether an array of values (e.g. a single nanopore capture) passes a set of filters. Filters can be based on summary statistics (e.g., mean) and/or a range of allowed values. Parameters ---------- capture : CaptureOrTimeSeries | NumpyArrayLike Capture containing time series of nanopore current values for a single capture, or the signal itself. filters : Iterable[Filter] The set of filters to apply. Write your own filter by subclassing FilterPlugin. Returns ------- boolean True if capture passes all filters; False otherwise. """ all_passed = True for some_filter in filters: if not some_filter(capture): return False return all_passed @dataclass(frozen=True) class FilterSetProtocol(Filtering, Protocol): filter_set_id: FilterSetId filters: Filters @classmethod def from_filter_configs(cls, name: FilterSetId, filter_configs: FilterConfigs = None): ... @dataclass(frozen=True, init=False) class FilterSet(FilterSetProtocol): """ A collection of filters with a name for easy identification. Essentially a mapping of filter names to their implementations. """ def validate(self): raise NotImplementedError("Implement validation for filters!") def __init__(self, filter_set_id: FilterSetId, filters: Filters) -> None: filterset = super().__init__(self) object.__setattr__(self, "filter_set_id", filter_set_id) object.__setattr__(self, "filters", filters) # self.name = name # self.filters = filters ############################ # # FilterSetProtocol # ############################ @classmethod def from_filter_configs(cls, name: FilterSetId, filter_configs: FilterConfigs = None): filters: Filters = get_filters(filter_configs) filter_set = cls.__new__(cls, name, filters) filter_set.__init__(name, filters) return filter_set def apply(self, capture: CaptureOrTimeSeries) -> bool: return does_pass_filters(capture, self.filters.values()) def __call__(self, capture: CaptureOrTimeSeries) -> bool: return self.apply(capture) class HDF5_FilterSet(FilterSet, HDF5_GroupSerialableDataclass): def __init__(self, filter_set: FilterSet) -> None: self._filterset = filter_set ############################ # # HDF5_GroupSerializable # ############################ def name(self): return self._filterset.filter_set_id def as_group(self, parent_group: HDF5_Group, log: Optional[Logger] = None) -> HDF5_Group: filter_set_group = parent_group.require_group(self.name()) for name, filter_t in self._filterset.filters.items(): hdf5_filter = HDF5_FilterSerialable(filter_t.config, filter_t.plugin) hdf5_filter.as_group(filter_set_group) return HDF5_Group(filter_set_group) # @classmethod # def from_group( # cls, group: HDF5_Group, log: Optional[Logger] = None # ) -> HDF5_GroupSerializable: # raise NotImplementedError( # f"from_group not implemented for {cls.__name__}. Make sure you write a method that returns a serialzied version of this object." # ) def filter_from_config(name: str, config: FilterConfig, log: Logger = getLogger()) -> Filter: """Creates a Filter from a config spefication. If no "filename" is present in the FilterConfig, it's assumed to be one of the default filtesr Parameters ---------- name : str The unique name of a filter. config : FilterConfig Filter configuration to build the plugin. log : Logger, optional Logger to use for information/warnings/debug, by default getLogger() Returns ------- Filter A filter that can be applied to some data. Raises ------ AttributeError A filter plugin could not be built from the configuration description. If this error is raised, be sure to check 1) A plugin class with the name in the configuration is defined at the filepath described in the configuration 2) The plugin class inherits from the `FilterPlugin` abstract base class. """ filepath = config.get("filepath", None) # TODO: For non-default FilterPlugins, load/unpickle the class from the filepath. https://github.com/uwmisl/poretitioner/issues/91 plugin = None if name in DEFAULT_FILTER_PLUGINS: plugin = DEFAULT_FILTER_PLUGINS[name]() else: # TODO: For non-default FilterPlugins, load the class from the filepath. https://github.com/uwmisl/poretitioner/issues/91 plugin = plugin_from_file(name, filepath) pass # Make sure any plugin attributes defined in the config are moved over to the plugin instance. try: # Here, we take care of setting whatever attributes the plugin config defines on the new plugin instance. for key, value in config.items(): object.__setattr__(plugin, key, value) except AttributeError as e: log.warning( """ Uh oh, couldn't find plugin '{name}'. Are you sure: 1) A plugin class with the name '{name}' is defined in the file {filepath}? 2) That plugin class inherits from `FilterPlugin`? """ ) raise e my_filter = Filter(config, plugin) return my_filter def plugin_from_file(name: str, filepath: PathLikeOrString): """[summary] Parameters ---------- name : str [description] filepath : PathLikeOrString [description] Returns ------- [type] [description] Raises ------ NotImplementedError [description] """ # TODO: For non-default FilterPlugins, load/unpickle the class from the filepath. https://github.com/uwmisl/poretitioner/issues/91 raise NotImplementedError( "Plugin from file has not been implemented! This method should take in a filepath and filter name, and return a runnable FilterPlugin!" )
[ 1, 9995, 13, 4936, 29922, 13, 4572, 292, 29889, 2272, 13, 4936, 29922, 13, 13, 4013, 3883, 8128, 901, 3803, 1070, 21166, 363, 4332, 1973, 29889, 13, 3492, 508, 2888, 675, 596, 1914, 18094, 2086, 29889, 13, 13, 15945, 29908, 13, 3166, 4770, 29888, 9130, 1649, 1053, 25495, 13, 13, 5215, 337, 13, 3166, 25638, 1053, 16417, 29892, 16417, 19346, 29892, 9846, 5696, 13, 3166, 848, 13203, 1053, 848, 1990, 13, 3166, 4390, 1053, 4663, 8566, 6119, 13, 3166, 2224, 1982, 1053, 10321, 861, 2605, 13, 3166, 19229, 1053, 313, 13, 1678, 3139, 29892, 13, 1678, 360, 919, 29892, 13, 1678, 20504, 519, 29892, 13, 1678, 341, 20304, 29892, 13, 1678, 1570, 1542, 29892, 13, 1678, 28379, 29892, 13, 1678, 1019, 5770, 29892, 13, 1678, 5167, 29892, 13, 1678, 14213, 287, 21533, 29892, 13, 1678, 7761, 29892, 13, 29897, 13, 13, 5215, 298, 29945, 2272, 13, 5215, 12655, 408, 7442, 13, 3166, 298, 29945, 2272, 1053, 3497, 408, 23786, 29945, 2283, 13, 13, 3166, 6317, 29882, 2176, 29945, 1053, 313, 13, 1678, 11699, 29943, 579, 29945, 29892, 13, 1678, 379, 4037, 29945, 29918, 4782, 29892, 13, 1678, 379, 4037, 29945, 29918, 4782, 9125, 519, 1469, 1990, 29892, 13, 1678, 379, 4037, 29945, 29918, 4782, 9125, 13902, 29892, 13, 1678, 379, 4037, 29945, 29918, 4782, 9125, 5281, 29892, 13, 1678, 1317, 25098, 29892, 13, 29897, 13, 3166, 6317, 21707, 1053, 28468, 29892, 679, 16363, 13, 3166, 6317, 4530, 1338, 1053, 8868, 545, 13, 3166, 869, 3221, 1053, 11848, 2272, 2588, 27552, 29892, 10802, 27552, 2816, 1231, 29892, 7523, 1204, 29892, 10076, 2986, 29918, 1609, 29918, 8149, 13, 3166, 869, 8582, 1053, 1858, 3851, 13, 13, 21133, 545, 2816, 2481, 19204, 353, 7761, 29961, 21133, 545, 29892, 11848, 2272, 2588, 27552, 29962, 13, 13, 13, 29937, 853, 1387, 15882, 363, 263, 4333, 310, 18094, 313, 29872, 29889, 29887, 29889, 376, 1184, 29888, 29967, 12352, 29879, 29909, 29893, 14151, 3434, 2153, 1159, 13, 5072, 2697, 1204, 353, 1570, 1542, 703, 5072, 2697, 1204, 613, 851, 29897, 13, 13, 29937, 853, 1387, 15882, 363, 385, 5375, 4175, 313, 29872, 29889, 29887, 29889, 376, 1195, 29918, 1154, 1159, 13, 5072, 1170, 353, 1570, 1542, 703, 5072, 1170, 613, 851, 29897, 13, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 376, 13221, 29918, 3364, 29918, 26705, 613, 13, 1678, 376, 657, 29918, 26705, 613, 13, 1678, 376, 5072, 1170, 613, 13, 1678, 376, 5072, 2697, 1204, 613, 13, 1678, 376, 5072, 3991, 613, 13, 1678, 376, 5072, 613, 13, 1678, 376, 3434, 2153, 613, 13, 1678, 376, 23397, 29918, 3738, 29931, 4945, 29918, 7390, 23338, 1177, 29903, 613, 13, 1678, 376, 5072, 2697, 613, 13, 1678, 376, 5072, 3991, 29879, 613, 13, 1678, 376, 5072, 16288, 613, 13, 1678, 376, 10145, 613, 13, 29962, 13, 13, 13, 29992, 1272, 1990, 29898, 29888, 307, 2256, 29922, 5574, 29897, 13, 1990, 383, 6227, 4945, 29918, 10145, 29901, 13, 1678, 16641, 2891, 353, 285, 23901, 5072, 12975, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4175, 29918, 842, 29918, 2084, 29898, 25932, 29892, 4175, 29918, 842, 29918, 333, 29901, 19916, 2697, 1204, 29897, 1599, 851, 29901, 13, 4706, 4175, 29918, 2084, 353, 851, 29898, 9135, 861, 2605, 29898, 3738, 29931, 4945, 29918, 10145, 29889, 21289, 29892, 4175, 29918, 842, 29918, 333, 876, 13, 4706, 736, 4175, 29918, 2084, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4175, 29918, 842, 29918, 3364, 29918, 2084, 29898, 25932, 29892, 4175, 29918, 842, 29918, 333, 29901, 19916, 2697, 1204, 29897, 1599, 851, 29901, 13, 4706, 1209, 29918, 2084, 353, 851, 29898, 9135, 861, 2605, 29898, 3738, 29931, 4945, 29918, 10145, 29889, 4572, 29918, 842, 29918, 2084, 29898, 4572, 29918, 842, 29918, 333, 511, 376, 3364, 5783, 13, 4706, 736, 1209, 29918, 2084, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4175, 29918, 842, 29918, 3364, 29918, 2084, 29918, 1454, 29918, 949, 29918, 333, 29898, 25932, 29892, 4175, 29918, 842, 29918, 333, 29901, 19916, 2697, 1204, 29892, 1303, 29918, 333, 29901, 7523, 1204, 29897, 1599, 851, 29901, 13, 4706, 1209, 29918, 2084, 353, 851, 29898, 9135, 861, 2605, 29898, 3738, 29931, 4945, 29918, 10145, 29889, 4572, 29918, 842, 29918, 3364, 29918, 2084, 29898, 4572, 29918, 842, 29918, 333, 511, 1303, 29918, 333, 876, 13, 4706, 736, 1209, 29918, 2084, 13, 13, 13, 1990, 19916, 3991, 29898, 24933, 287, 21533, 1125, 13, 1678, 9995, 29909, 7254, 2158, 363, 920, 304, 3386, 263, 19916, 16288, 29889, 13, 13, 1678, 2866, 2708, 263, 1024, 29892, 322, 738, 1353, 310, 916, 8393, 13, 13, 1678, 3940, 373, 6624, 3002, 29901, 13, 13, 4706, 448, 19916, 3991, 29901, 319, 1880, 29899, 5563, 6139, 310, 263, 4175, 29889, 13, 13, 4706, 448, 19916, 16288, 29901, 530, 3935, 29892, 1246, 519, 29892, 5314, 310, 263, 19916, 3991, 29889, 13, 13, 13, 1678, 1152, 2888, 18224, 29892, 1207, 1854, 376, 1445, 2084, 29908, 338, 385, 5352, 393, 3291, 304, 278, 934, 304, 425, 397, 13, 1678, 9995, 13, 13, 13, 29937, 341, 20304, 310, 263, 19916, 1170, 304, 4175, 22920, 29889, 13, 5072, 3991, 29879, 353, 1570, 1542, 703, 5072, 3991, 29879, 613, 360, 919, 29961, 5072, 1170, 29892, 19916, 3991, 2314, 13, 13, 29937, 14402, 29901, 19916, 1858, 3851, 881, 1423, 393, 1024, 338, 5412, 29889, 2045, 597, 3292, 29889, 510, 29914, 7262, 29885, 7497, 29914, 1971, 300, 654, 261, 29914, 12175, 29914, 29929, 29896, 13, 1990, 19916, 16288, 29898, 16288, 1125, 13, 1678, 9995, 13, 1678, 25513, 770, 363, 19916, 18224, 29889, 1763, 2436, 596, 1914, 4175, 29892, 19481, 445, 9846, 13, 1678, 770, 322, 2334, 278, 421, 7302, 29952, 1158, 322, 421, 978, 29952, 2875, 29889, 13, 1678, 9995, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 9995, 8110, 802, 1024, 363, 445, 4175, 29889, 13, 4706, 8561, 1854, 372, 1838, 29915, 29873, 14529, 411, 738, 5923, 2983, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 851, 13, 9651, 450, 5412, 1024, 363, 445, 4175, 313, 29872, 29889, 29887, 29889, 376, 29888, 283, 4336, 29918, 9067, 2564, 13, 13, 4706, 390, 1759, 267, 13, 4706, 448, 23648, 13, 4706, 2216, 1888, 2037, 287, 2392, 13, 9651, 390, 1759, 287, 565, 445, 4175, 338, 2000, 1728, 445, 1024, 1158, 1641, 8762, 29889, 13, 4706, 9995, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 13, 9651, 13577, 978, 29915, 770, 1158, 451, 8762, 363, 4175, 29889, 910, 770, 1158, 881, 736, 263, 5412, 1024, 363, 445, 4175, 1213, 13, 4706, 1723, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 3394, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 29897, 1599, 6120, 29901, 13, 4706, 9995, 11609, 29879, 5852, 565, 263, 10446, 14517, 263, 2183, 4175, 16614, 29889, 13, 4706, 1152, 2777, 29892, 263, 3464, 4175, 723, 1423, 393, 263, 10446, 29915, 29879, 15837, 1002, 2879, 1199, 3804, 2629, 263, 2183, 3464, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 10446, 584, 7442, 29889, 1017, 15702, 29889, 2588, 27552, 13, 9651, 5974, 3652, 10446, 304, 4175, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 6120, 13, 9651, 26460, 445, 10446, 14517, 278, 4175, 29889, 13, 13, 4706, 390, 1759, 267, 13, 4706, 448, 23648, 13, 4706, 2216, 1888, 2037, 287, 2392, 13, 9651, 390, 1759, 287, 746, 278, 4175, 1158, 3508, 29915, 29873, 8762, 491, 278, 1136, 9929, 19916, 770, 13, 4706, 9995, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 13, 9651, 13577, 7302, 29915, 1158, 451, 8762, 363, 4175, 29889, 910, 1158, 881, 736, 5852, 565, 322, 871, 565, 7436, 304, 263, 10446, 393, 28103, 278, 4175, 28770, 291, 29889, 1152, 2777, 29892, 376, 13, 4706, 1723, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 29897, 1599, 6120, 29901, 13, 4706, 9995, 2052, 368, 278, 4175, 29889, 13, 13, 4706, 5282, 2827, 21326, 4804, 1649, 29952, 16869, 502, 437, 7575, 2712, 763, 29901, 13, 13, 4706, 770, 1619, 7281, 5072, 29898, 5072, 16288, 1125, 13, 9651, 822, 3394, 29898, 17885, 545, 1125, 13, 18884, 396, 2023, 13, 18884, 1209, 13, 13, 4706, 396, 12699, 297, 775, 988, 21166, 338, 2309, 3045, 13, 13, 4706, 2854, 29918, 17885, 1973, 353, 5159, 13, 4706, 18094, 353, 518, 1619, 7281, 5072, 3285, 7280, 7281, 5072, 3285, 2023, 4514, 13, 13, 4706, 2854, 29918, 17885, 1973, 353, 518, 17885, 545, 363, 10446, 297, 4332, 1973, 565, 599, 4197, 1777, 29873, 29898, 17885, 545, 29897, 363, 977, 29873, 297, 18094, 2314, 29962, 13, 4706, 363, 10446, 297, 4332, 1973, 29901, 396, 887, 29915, 29881, 864, 304, 8943, 675, 445, 297, 263, 1855, 2834, 1342, 856, 13, 13, 9651, 363, 977, 29873, 297, 18094, 29901, 13, 18884, 22289, 29918, 17885, 1973, 353, 977, 29873, 29898, 17885, 545, 467, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 10446, 584, 8868, 545, 2816, 2481, 19204, 13, 9651, 8868, 545, 304, 4175, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 6120, 13, 9651, 26460, 445, 10446, 14517, 278, 4175, 29889, 13, 4706, 9995, 13, 4706, 1121, 353, 1583, 29889, 7302, 29898, 17885, 545, 29897, 13, 4706, 736, 1121, 13, 13, 13, 29934, 24336, 29918, 3738, 29931, 4945, 29918, 23397, 29918, 16173, 7833, 5005, 29901, 5785, 353, 448, 9302, 29889, 7192, 13, 29934, 24336, 29918, 3738, 29931, 4945, 29918, 23397, 29918, 12648, 7833, 5005, 29901, 5785, 353, 7442, 29889, 7192, 13, 13, 13, 1990, 12146, 5072, 29898, 5072, 16288, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9212, 29901, 28379, 29961, 7411, 29962, 353, 6213, 29892, 7472, 29901, 28379, 29961, 7411, 29962, 353, 6213, 1125, 13, 4706, 9995, 29909, 4175, 393, 18094, 2729, 373, 3692, 263, 7182, 20074, 1546, 263, 7472, 322, 263, 9212, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 9212, 584, 5785, 29892, 13136, 13, 9651, 450, 19087, 995, 445, 7182, 881, 367, 6068, 304, 2125, 313, 262, 7009, 573, 511, 491, 2322, 12146, 5072, 29889, 23397, 29918, 16173, 7833, 5005, 13, 4706, 7472, 584, 5785, 29892, 13136, 13, 9651, 450, 10150, 995, 445, 7182, 881, 367, 6068, 304, 2125, 313, 262, 7009, 573, 511, 491, 2322, 12146, 5072, 29889, 23397, 29918, 12648, 7833, 5005, 13, 4706, 9995, 13, 4706, 1583, 29889, 1195, 12539, 353, 9212, 565, 9212, 338, 451, 6213, 1683, 390, 24336, 29918, 3738, 29931, 4945, 29918, 23397, 29918, 16173, 7833, 5005, 13, 4706, 1583, 29889, 27525, 398, 353, 7472, 565, 7472, 338, 451, 6213, 1683, 390, 24336, 29918, 3738, 29931, 4945, 29918, 23397, 29918, 12648, 7833, 5005, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 29897, 1599, 11848, 2272, 2588, 27552, 29901, 13, 4706, 9995, 5647, 1461, 29879, 263, 15837, 1002, 4695, 515, 278, 10446, 313, 29872, 29889, 29887, 29889, 2099, 29892, 3309, 29892, 3918, 29522, 467, 13, 13, 4706, 27486, 5858, 491, 2322, 313, 5143, 3639, 278, 10446, 467, 13, 13, 4706, 887, 508, 671, 445, 740, 304, 4327, 278, 848, 297, 263, 5407, 982, 1434, 9068, 372, 313, 29872, 29889, 29887, 29889, 13, 4706, 2805, 278, 2099, 995, 310, 263, 10446, 1434, 21166, 2729, 373, 393, 2099, 1846, 13, 13, 4706, 3940, 29901, 960, 591, 7623, 278, 21166, 27321, 408, 385, 382, 14632, 313, 5647, 1461, 29899, 13372, 29899, 5896, 29897, 16439, 29892, 445, 723, 367, 278, 376, 9067, 29908, 13, 4706, 313, 19730, 848, 29892, 6623, 372, 363, 263, 2678, 6437, 511, 541, 306, 4459, 393, 376, 9067, 29908, 338, 6060, 263, 3984, 25369, 740, 1024, 297, 445, 3030, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 10446, 584, 8868, 545, 2816, 2481, 19204, 13, 9651, 8868, 545, 515, 607, 304, 6597, 848, 29889, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 7182, 353, 10446, 29889, 29888, 13857, 284, 1891, 580, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 7182, 353, 10446, 13, 4706, 1683, 29901, 13, 9651, 7182, 353, 10446, 13, 4706, 736, 7182, 13, 4706, 396, 7182, 353, 679, 5552, 29898, 17885, 545, 29892, 8868, 545, 29889, 29888, 13857, 284, 1891, 17255, 978, 1649, 29892, 10446, 29897, 13, 13, 1678, 822, 338, 29918, 262, 29918, 3881, 29898, 1311, 29892, 995, 29901, 7761, 29961, 8009, 2272, 2588, 27552, 29892, 5785, 2314, 1599, 6120, 29901, 13, 4706, 1018, 29901, 13, 9651, 396, 960, 278, 995, 338, 925, 263, 5785, 29892, 591, 508, 671, 445, 1361, 29891, 5877, 29901, 13, 9651, 736, 1583, 29889, 1195, 12539, 5277, 995, 5277, 1583, 29889, 27525, 398, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 396, 1205, 591, 29915, 276, 451, 6068, 304, 671, 393, 5877, 373, 12655, 7049, 29889, 13, 9651, 736, 599, 29898, 9302, 29889, 1188, 936, 29918, 392, 29898, 1311, 29889, 1195, 12539, 5277, 995, 29892, 995, 5277, 1583, 29889, 27525, 398, 876, 13, 13, 1678, 822, 3394, 29898, 1311, 29892, 7182, 1125, 13, 4706, 995, 353, 1583, 29889, 21111, 29898, 25436, 29897, 13, 4706, 736, 1583, 29889, 275, 29918, 262, 29918, 3881, 29898, 1767, 29897, 13, 13, 13, 1990, 10117, 2772, 14641, 5072, 29898, 6069, 5072, 1125, 13, 1678, 9995, 3434, 2153, 363, 4332, 1973, 411, 3918, 29668, 800, 297, 777, 3464, 1213, 15945, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 4172, 29894, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 1125, 13, 4706, 7182, 353, 2428, 2141, 21111, 29898, 17885, 545, 29897, 13, 4706, 736, 7442, 29889, 4172, 29898, 25436, 29897, 13, 13, 13, 1990, 16316, 5072, 29898, 6069, 5072, 1125, 13, 1678, 9995, 3434, 2153, 363, 4332, 1973, 411, 385, 23342, 2099, 2629, 263, 3464, 1213, 15945, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 12676, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 1125, 13, 4706, 7182, 353, 2428, 2141, 21111, 29898, 17885, 545, 29897, 13, 4706, 736, 7442, 29889, 12676, 29898, 25436, 29897, 13, 13, 13, 1990, 3436, 713, 5072, 29898, 6069, 5072, 1125, 13, 1678, 9995, 3434, 2153, 363, 4332, 1973, 411, 263, 19194, 2629, 263, 3464, 1213, 15945, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 2168, 713, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 1125, 13, 4706, 7182, 353, 2428, 2141, 21111, 29898, 17885, 545, 29897, 13, 4706, 736, 7442, 29889, 2168, 713, 29898, 25436, 29897, 13, 13, 13, 1990, 3080, 12539, 5072, 29898, 6069, 5072, 1125, 13, 1678, 9995, 3434, 2153, 363, 4332, 1973, 411, 263, 9212, 2629, 263, 3464, 1213, 15945, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 1195, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 1125, 13, 4706, 7182, 353, 2428, 2141, 21111, 29898, 17885, 545, 29897, 13, 4706, 736, 7442, 29889, 1195, 29898, 25436, 29897, 13, 13, 13, 1990, 5918, 12539, 5072, 29898, 6069, 5072, 1125, 13, 1678, 9995, 3434, 2153, 363, 4332, 1973, 411, 263, 7472, 2629, 263, 3464, 1213, 15945, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 3317, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 1125, 13, 4706, 7182, 353, 2428, 2141, 21111, 29898, 17885, 545, 29897, 13, 4706, 736, 7442, 29889, 3317, 29898, 25436, 29897, 13, 13, 13, 1990, 365, 1477, 5072, 29898, 6069, 5072, 1125, 13, 1678, 9995, 3434, 2153, 4332, 1973, 2729, 373, 1009, 3309, 1213, 15945, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 2848, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 1125, 13, 4706, 7182, 353, 2428, 2141, 21111, 29898, 17885, 545, 29897, 13, 4706, 736, 7431, 29898, 25436, 29897, 13, 13, 13, 1990, 382, 622, 287, 5072, 29898, 5072, 16288, 1125, 13, 1678, 9995, 3434, 2153, 4332, 1973, 2729, 373, 3692, 896, 892, 321, 622, 287, 515, 278, 282, 487, 1213, 15945, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1024, 29898, 25932, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 29872, 622, 287, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 29901, 8868, 545, 1125, 13, 4706, 736, 10446, 29889, 29872, 622, 287, 13, 13, 13, 15945, 29908, 13, 5328, 304, 6204, 3575, 438, 1233, 8701, 19916, 29901, 13, 13, 8139, 287, 901, 12862, 21166, 1135, 825, 591, 3867, 714, 310, 278, 3800, 29973, 1939, 1108, 29889, 13, 4391, 596, 1914, 2888, 4175, 491, 7846, 11407, 515, 278, 19916, 16288, 770, 29889, 13, 13, 2831, 445, 1342, 29892, 1235, 29915, 29879, 437, 1554, 4280, 29889, 14891, 366, 871, 864, 304, 25917, 4332, 1973, 13, 5747, 505, 901, 1135, 29871, 29945, 11916, 411, 263, 11266, 2095, 293, 18806, 296, 7621, 1135, 777, 16897, 29889, 13, 13, 7058, 2794, 1749, 2888, 4175, 29915, 29879, 421, 7302, 29952, 740, 881, 736, 5852, 565, 322, 871, 565, 13, 1552, 7182, 756, 901, 1135, 29871, 29945, 11916, 7621, 1135, 278, 16897, 29892, 1156, 5622, 278, 11266, 2095, 293, 18806, 296, 297, 421, 21111, 1412, 13, 15945, 29908, 13, 13, 13, 1990, 1619, 7281, 5072, 29898, 5072, 16288, 1125, 13, 1678, 16897, 29901, 5785, 353, 29871, 29900, 29889, 29945, 29871, 396, 19013, 635, 11472, 29889, 13, 13, 1678, 822, 1024, 29898, 1311, 1125, 13, 4706, 736, 376, 5431, 29908, 13, 13, 1678, 822, 6597, 29898, 1311, 29892, 10446, 1125, 13, 4706, 396, 1938, 278, 29304, 1244, 29892, 470, 758, 29899, 5014, 372, 1434, 278, 4175, 29889, 13, 13, 4706, 396, 402, 1691, 278, 11266, 2095, 293, 18806, 296, 310, 278, 7182, 29889, 13, 4706, 23892, 353, 7442, 29889, 13161, 29882, 29898, 17885, 545, 29889, 25436, 29897, 13, 4706, 736, 23892, 13, 13, 1678, 822, 3394, 29898, 1311, 29892, 7182, 1125, 13, 4706, 396, 9333, 736, 1565, 565, 901, 1135, 29871, 29945, 11916, 505, 263, 6862, 3876, 7621, 1135, 29871, 29906, 29889, 29900, 313, 279, 8844, 653, 29897, 13, 4706, 23892, 353, 1583, 29889, 21111, 29898, 25436, 29897, 13, 13, 4706, 396, 960, 591, 864, 304, 4175, 714, 18470, 411, 28145, 1135, 29871, 29945, 9686, 11916, 29892, 769, 591, 13, 4706, 396, 881, 5663, 348, 5852, 746, 727, 526, 29871, 29945, 470, 901, 9686, 11916, 29889, 13, 4706, 302, 29918, 1004, 15133, 29918, 386, 12268, 353, 7431, 29898, 13, 9651, 23892, 29961, 21111, 287, 1405, 1583, 29889, 386, 12268, 29962, 13, 4706, 1723, 29871, 396, 9681, 310, 11916, 7621, 1135, 278, 16897, 13, 4706, 28103, 29918, 29883, 21977, 353, 313, 13, 9651, 302, 29918, 1004, 15133, 29918, 386, 12268, 6736, 29871, 29945, 13, 4706, 1723, 29871, 396, 4683, 727, 472, 3203, 29871, 29945, 11916, 11781, 445, 16897, 29973, 13, 4706, 736, 28103, 29918, 29883, 21977, 13, 13, 13, 1753, 3394, 29918, 14394, 29918, 26705, 29898, 17885, 545, 29901, 8868, 545, 2816, 2481, 19204, 29892, 18094, 29901, 2391, 29961, 5072, 16288, 2314, 1599, 6120, 29901, 13, 1678, 9995, 13, 1678, 5399, 3692, 385, 1409, 310, 1857, 1819, 313, 29875, 29889, 29872, 29889, 263, 2323, 23432, 459, 487, 10446, 29897, 13, 1678, 14517, 263, 731, 310, 18094, 29889, 2514, 2153, 508, 367, 2729, 373, 15837, 13964, 13, 1678, 313, 29872, 29889, 29887, 1696, 2099, 29897, 322, 29914, 272, 263, 3464, 310, 6068, 1819, 29889, 13, 13, 1678, 8695, 373, 4175, 6030, 29901, 960, 278, 18094, 1051, 338, 4069, 29892, 727, 526, 694, 18094, 13, 1678, 322, 278, 10446, 14517, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 10446, 584, 8868, 545, 2816, 2481, 19204, 891, 11848, 2272, 2588, 27552, 13, 4706, 8868, 545, 6943, 931, 3652, 310, 23432, 459, 487, 1857, 1819, 363, 263, 2323, 10446, 29892, 470, 278, 7182, 3528, 29889, 13, 1678, 18094, 584, 2391, 29961, 5072, 16288, 29962, 13, 4706, 2391, 310, 19916, 16288, 8871, 29889, 14350, 596, 1914, 4175, 491, 19481, 292, 19916, 16288, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 7223, 13, 4706, 5852, 565, 10446, 14517, 599, 18094, 29936, 7700, 6467, 29889, 13, 1678, 9995, 13, 1678, 565, 18094, 338, 6213, 29901, 13, 4706, 18094, 353, 5159, 13, 13, 1678, 396, 14402, 29901, 1459, 6553, 675, 29973, 2045, 597, 3292, 29889, 510, 29914, 7262, 29885, 7497, 29914, 1971, 300, 654, 261, 29914, 12175, 29914, 29953, 29955, 13, 1678, 22289, 353, 518, 4572, 29918, 449, 29898, 17885, 545, 29897, 363, 4175, 29918, 449, 297, 18094, 29962, 13, 1678, 1596, 29898, 4572, 287, 29897, 13, 13, 1678, 396, 7440, 445, 7182, 1209, 599, 18094, 29973, 13, 1678, 599, 29918, 3364, 287, 353, 599, 29898, 4572, 287, 29897, 13, 1678, 736, 599, 29918, 3364, 287, 13, 13, 13, 1753, 1423, 29918, 17885, 545, 29918, 29872, 6929, 29918, 1609, 29918, 949, 29898, 29888, 29945, 29892, 1303, 29918, 333, 1125, 13, 1678, 9995, 5596, 29879, 3692, 278, 1857, 10446, 471, 297, 278, 282, 487, 2745, 278, 11749, 13, 1678, 471, 18764, 287, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 285, 29945, 584, 298, 29945, 2272, 29889, 2283, 1203, 313, 3150, 363, 5183, 470, 901, 29897, 13, 4706, 8868, 545, 5172, 29945, 934, 13, 1678, 1303, 29918, 333, 584, 14402, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 7223, 13, 4706, 5852, 565, 278, 1095, 310, 278, 10446, 22819, 2247, 411, 278, 1095, 310, 263, 11749, 3474, 29889, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 4706, 321, 622, 287, 353, 285, 29945, 29889, 657, 29898, 29888, 23901, 949, 648, 949, 29918, 333, 6822, 10140, 284, 2564, 5552, 29879, 3366, 29872, 622, 287, 3108, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 12020, 7865, 2392, 29898, 29888, 29908, 2084, 847, 949, 648, 949, 29918, 333, 29913, 947, 451, 1863, 297, 278, 5172, 29945, 934, 23157, 13, 1678, 736, 321, 622, 287, 13, 13, 13, 1753, 1423, 29918, 17885, 545, 29918, 29872, 6929, 29898, 355, 29918, 17885, 545, 29892, 11749, 29918, 1975, 29892, 304, 29880, 29918, 26290, 29922, 29906, 29900, 1125, 13, 1678, 9995, 5596, 29879, 3692, 278, 1857, 10446, 471, 297, 278, 282, 487, 2745, 278, 11749, 13, 1678, 471, 18764, 287, 29889, 13, 13, 1678, 11044, 9247, 12747, 3692, 263, 995, 313, 355, 29918, 17885, 545, 29897, 338, 3802, 3307, 313, 2541, 262, 13, 1678, 263, 5906, 310, 304, 29880, 29918, 26290, 29897, 304, 738, 995, 297, 11749, 29918, 1975, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1095, 29918, 17885, 545, 584, 16985, 13, 4706, 450, 1095, 931, 310, 278, 10446, 29889, 13, 1678, 11749, 29918, 1975, 584, 1051, 310, 16985, 13, 4706, 2391, 310, 3064, 746, 278, 3918, 11749, 10614, 29889, 13, 1678, 304, 29880, 29918, 26290, 584, 938, 29892, 13136, 13, 4706, 16977, 261, 749, 363, 16184, 746, 278, 1095, 310, 278, 10446, 353, 11749, 1095, 29892, 491, 2322, 29871, 29906, 29900, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 7223, 13, 4706, 5852, 565, 278, 1095, 310, 278, 10446, 22819, 2247, 411, 278, 1095, 310, 263, 11749, 3474, 29889, 13, 1678, 9995, 13, 1678, 363, 11749, 29918, 355, 297, 11749, 29918, 1975, 29901, 13, 4706, 565, 7442, 29889, 6897, 29898, 355, 29918, 17885, 545, 448, 11749, 29918, 355, 29897, 529, 304, 29880, 29918, 26290, 29901, 13, 9651, 736, 5852, 13, 1678, 736, 7700, 13, 13, 13, 1753, 4175, 29918, 4561, 29918, 735, 15423, 29898, 2917, 29892, 1342, 29918, 11255, 29945, 29892, 1342, 29918, 4572, 29918, 2084, 29892, 5172, 29945, 29918, 5325, 29892, 716, 29918, 4572, 29918, 2084, 1125, 13, 1678, 396, 2514, 2153, 263, 731, 310, 5172, 29945, 2066, 3721, 278, 1021, 408, 385, 5923, 4175, 13, 1678, 396, 14402, 584, 396, 29953, 29947, 584, 2334, 13, 1678, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 13, 1753, 679, 29918, 4572, 29918, 3364, 29918, 2084, 29898, 4572, 29918, 842, 29918, 333, 29892, 1303, 29918, 333, 1125, 13, 1678, 736, 383, 6227, 4945, 29918, 10145, 29889, 4572, 29918, 842, 29918, 3364, 29918, 2084, 29898, 4572, 29918, 842, 29918, 333, 29897, 13, 13, 13, 1649, 23397, 29918, 3738, 29931, 4945, 29918, 7390, 23338, 1177, 29903, 353, 518, 13, 1678, 16316, 5072, 29892, 13, 1678, 10117, 2772, 14641, 5072, 29892, 13, 1678, 3436, 713, 5072, 29892, 13, 1678, 3080, 12539, 5072, 29892, 13, 1678, 5918, 12539, 5072, 29892, 13, 1678, 365, 1477, 5072, 29892, 13, 29962, 13, 13, 23397, 29918, 3738, 29931, 4945, 29918, 7390, 23338, 1177, 29903, 353, 426, 13, 1678, 4175, 29918, 8582, 29918, 1990, 29889, 978, 7295, 4175, 29918, 8582, 29918, 1990, 13, 1678, 363, 4175, 29918, 8582, 29918, 1990, 297, 4770, 23397, 29918, 3738, 29931, 4945, 29918, 7390, 23338, 1177, 29903, 13, 29913, 13, 13, 13, 1990, 19916, 292, 29898, 17830, 1125, 13, 1678, 9995, 27403, 393, 594, 4150, 304, 278, 19916, 292, 9608, 13, 1678, 3867, 385, 525, 7302, 29915, 1158, 304, 385, 1881, 393, 3639, 5852, 13, 1678, 565, 322, 871, 565, 278, 1881, 14517, 967, 4175, 29889, 13, 13, 1678, 4525, 526, 884, 1246, 519, 29892, 577, 5432, 263, 4175, 373, 385, 1881, 13, 1678, 338, 740, 635, 7126, 304, 5432, 967, 3394, 1158, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 1599, 6120, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 703, 5072, 292, 9608, 22602, 29915, 29873, 8762, 4770, 4804, 1649, 3447, 29991, 1159, 13, 13, 1678, 822, 3394, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 1599, 6120, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 703, 5072, 292, 9608, 22602, 29915, 29873, 8762, 2401, 368, 3447, 29991, 1159, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 19916, 29898, 5072, 292, 1125, 13, 1678, 9995, 29909, 4257, 4175, 393, 508, 367, 7436, 304, 777, 848, 29889, 13, 13, 1678, 887, 508, 671, 445, 4175, 491, 925, 5432, 372, 373, 777, 848, 29889, 13, 13, 1678, 590, 29918, 25436, 353, 518, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29962, 13, 13, 1678, 4175, 353, 19916, 29077, 13, 13, 1678, 4502, 29918, 4572, 29901, 6120, 353, 4175, 29898, 1357, 29918, 25436, 29897, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2295, 584, 19916, 3991, 13, 4706, 319, 6139, 310, 445, 4175, 29915, 29879, 5285, 313, 29872, 29889, 29887, 29889, 988, 372, 471, 7500, 515, 467, 13, 1678, 7079, 584, 19916, 16288, 13, 4706, 450, 3935, 5314, 310, 445, 4175, 29889, 13, 4706, 1334, 505, 445, 770, 3342, 411, 13, 1678, 9995, 13, 13, 1678, 2295, 29901, 19916, 3991, 13, 1678, 7079, 29901, 19916, 16288, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 1599, 6120, 29901, 13, 4706, 736, 1583, 29889, 8582, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 3394, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 1599, 6120, 29901, 13, 4706, 736, 1583, 29889, 8582, 29889, 7302, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1024, 29898, 1311, 29897, 1599, 19916, 1170, 29901, 13, 4706, 736, 19916, 1170, 29898, 1311, 29889, 8582, 17255, 1990, 26914, 978, 3101, 13, 13, 1678, 822, 408, 29918, 5552, 29898, 1311, 29897, 1599, 360, 919, 29961, 710, 29892, 3139, 5387, 13, 4706, 1024, 353, 1583, 29889, 978, 13, 4706, 12421, 29879, 353, 426, 1068, 16908, 29898, 1311, 29889, 2917, 511, 3579, 16908, 29898, 1311, 29889, 8582, 511, 1024, 29901, 1024, 29913, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 822, 515, 29918, 5552, 29898, 1311, 29892, 12421, 29897, 1599, 1317, 25098, 29901, 13, 4706, 2023, 13, 13, 13, 5215, 4390, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 379, 4037, 29945, 29918, 5072, 9125, 519, 29898, 5072, 29892, 379, 4037, 29945, 29918, 4782, 9125, 519, 1469, 1990, 1125, 13, 1678, 822, 408, 29918, 2972, 29898, 1311, 29892, 3847, 29918, 2972, 29901, 379, 4037, 29945, 29918, 4782, 29892, 1480, 29901, 28379, 29961, 16363, 29962, 353, 6213, 29897, 1599, 379, 4037, 29945, 29918, 4782, 29901, 13, 4706, 1480, 353, 1480, 565, 1480, 338, 451, 6213, 1683, 679, 16363, 580, 13, 4706, 396, 3940, 29901, 910, 1196, 3763, 28975, 263, 2318, 411, 278, 1024, 525, 978, 29915, 297, 278, 3847, 2318, 29889, 13, 4706, 445, 29918, 2972, 353, 379, 4037, 29945, 29918, 4782, 29898, 3560, 29918, 2972, 29889, 12277, 29918, 2972, 29898, 1311, 29889, 978, 876, 13, 13, 4706, 599, 29918, 5552, 29879, 353, 426, 1068, 1311, 29889, 2917, 29892, 3579, 16908, 29898, 1311, 29889, 8582, 2915, 13, 4706, 445, 29918, 2972, 29889, 3258, 29918, 5552, 29879, 29898, 497, 29918, 5552, 29879, 29897, 13, 13, 4706, 396, 1954, 2037, 414, 1818, 1286, 2436, 1009, 7797, 1891, 2777, 304, 445, 2318, 29889, 13, 4706, 736, 445, 29918, 2972, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 2972, 29898, 13, 4706, 1067, 29879, 29892, 2318, 29901, 379, 4037, 29945, 29918, 4782, 29892, 1480, 29901, 28379, 29961, 16363, 29962, 353, 6213, 13, 1678, 1723, 1599, 379, 4037, 29945, 29918, 4782, 9125, 519, 1469, 1990, 29901, 13, 4706, 396, 887, 1074, 29892, 278, 7458, 338, 29892, 297, 278, 2038, 525, 294, 29918, 2972, 29915, 1246, 29892, 591, 301, 3427, 287, 4208, 13, 4706, 396, 599, 278, 8393, 310, 278, 19916, 3991, 322, 278, 19916, 16288, 29892, 451, 13797, 13, 4706, 396, 607, 8393, 28911, 304, 607, 770, 29889, 13, 4706, 396, 13, 4706, 396, 2567, 29892, 1244, 297, 421, 3166, 29918, 2972, 1673, 372, 29915, 29879, 931, 304, 5146, 278, 2930, 546, 322, 4377, 714, 607, 5352, 13, 4706, 396, 5771, 988, 304, 1653, 263, 716, 19916, 2777, 29889, 13, 4706, 396, 13, 4706, 396, 910, 338, 5517, 27012, 519, 1549, 278, 7079, 11258, 29892, 1951, 278, 7079, 29915, 29879, 13, 4706, 396, 1024, 338, 5412, 29892, 591, 508, 1018, 304, 1284, 263, 7079, 411, 263, 2183, 1024, 29892, 769, 679, 967, 8393, 515, 727, 29889, 13, 4706, 396, 16012, 13, 4706, 1480, 29889, 27392, 703, 5072, 29889, 3166, 29918, 2972, 451, 8762, 856, 3112, 29915, 29879, 263, 3353, 2655, 313, 4149, 3440, 25760, 13, 13, 4706, 396, 910, 338, 8296, 529, 5813, 15513, 13, 4706, 736, 2428, 2141, 3166, 29918, 2972, 29898, 2972, 29892, 1480, 29897, 13, 13, 13, 29937, 770, 2514, 2153, 29898, 29950, 4037, 29945, 29918, 4782, 9125, 519, 1469, 1990, 1125, 13, 29937, 268, 18094, 29901, 13, 13, 13, 3434, 2153, 353, 360, 919, 29961, 5072, 1170, 29892, 19916, 29962, 13, 13, 13, 1753, 679, 29918, 26705, 29898, 4572, 29918, 2917, 29879, 29901, 28379, 29961, 5072, 3991, 29879, 29962, 353, 6213, 29897, 1599, 2514, 2153, 29901, 13, 1678, 9995, 9832, 1078, 2514, 2153, 515, 263, 1051, 310, 4175, 22920, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 4175, 29918, 2917, 29879, 584, 29871, 28379, 29961, 5072, 3991, 29879, 29962, 13, 4706, 319, 10417, 310, 4175, 2983, 304, 1009, 22920, 29892, 6213, 491, 2322, 313, 29875, 29889, 29872, 29889, 694, 21166, 467, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 2514, 2153, 13, 4706, 319, 731, 310, 1246, 519, 29914, 7302, 519, 18094, 29889, 13, 1678, 9995, 13, 1678, 4175, 29918, 2917, 29879, 353, 4175, 29918, 2917, 29879, 565, 4175, 29918, 2917, 29879, 338, 451, 6213, 1683, 19916, 3991, 29879, 3319, 1800, 13, 1678, 590, 29918, 26705, 353, 426, 13, 4706, 1024, 29901, 4175, 29918, 3166, 29918, 2917, 29898, 978, 29892, 4175, 29918, 2917, 29897, 13, 4706, 363, 1024, 29892, 4175, 29918, 2917, 297, 4175, 29918, 2917, 29879, 29889, 7076, 580, 13, 1678, 500, 13, 13, 1678, 736, 590, 29918, 26705, 13, 13, 13, 1753, 947, 29918, 3364, 29918, 26705, 29898, 17885, 545, 29901, 8868, 545, 2816, 2481, 19204, 29892, 18094, 29901, 20504, 519, 29961, 5072, 2314, 1599, 6120, 29901, 13, 1678, 9995, 13, 1678, 5399, 3692, 385, 1409, 310, 1819, 313, 29872, 29889, 29887, 29889, 263, 2323, 23432, 459, 487, 10446, 29897, 13, 1678, 14517, 263, 731, 310, 18094, 29889, 2514, 2153, 508, 367, 2729, 373, 15837, 13964, 13, 1678, 313, 29872, 29889, 29887, 1696, 2099, 29897, 322, 29914, 272, 263, 3464, 310, 6068, 1819, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 10446, 584, 8868, 545, 2816, 2481, 19204, 891, 11848, 2272, 2588, 27552, 13, 4706, 8868, 545, 6943, 931, 3652, 310, 23432, 459, 487, 1857, 1819, 363, 263, 2323, 10446, 29892, 470, 278, 7182, 3528, 29889, 13, 1678, 18094, 584, 20504, 519, 29961, 5072, 29962, 13, 4706, 450, 731, 310, 18094, 304, 3394, 29889, 14350, 596, 1914, 4175, 491, 19481, 292, 19916, 16288, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 7223, 13, 4706, 5852, 565, 10446, 14517, 599, 18094, 29936, 7700, 6467, 29889, 13, 1678, 9995, 13, 1678, 599, 29918, 3364, 287, 353, 5852, 13, 1678, 363, 777, 29918, 4572, 297, 18094, 29901, 13, 4706, 565, 451, 777, 29918, 4572, 29898, 17885, 545, 1125, 13, 9651, 736, 7700, 13, 1678, 736, 599, 29918, 3364, 287, 13, 13, 13, 29992, 1272, 1990, 29898, 29888, 307, 2256, 29922, 5574, 29897, 13, 1990, 19916, 2697, 17830, 29898, 5072, 292, 29892, 1019, 5770, 1125, 13, 1678, 4175, 29918, 842, 29918, 333, 29901, 19916, 2697, 1204, 13, 1678, 18094, 29901, 2514, 2153, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 4572, 29918, 2917, 29879, 29898, 25932, 29892, 1024, 29901, 19916, 2697, 1204, 29892, 4175, 29918, 2917, 29879, 29901, 19916, 3991, 29879, 353, 6213, 1125, 13, 4706, 2023, 13, 13, 13, 29992, 1272, 1990, 29898, 29888, 307, 2256, 29922, 5574, 29892, 2069, 29922, 8824, 29897, 13, 1990, 19916, 2697, 29898, 5072, 2697, 17830, 1125, 13, 1678, 9995, 13, 1678, 319, 4333, 310, 18094, 411, 263, 1024, 363, 4780, 13, 1678, 29769, 29889, 11044, 9247, 263, 10417, 310, 4175, 2983, 304, 1009, 20240, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 12725, 29898, 1311, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 703, 1888, 2037, 8845, 363, 18094, 29991, 1159, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4175, 29918, 842, 29918, 333, 29901, 19916, 2697, 1204, 29892, 18094, 29901, 2514, 2153, 29897, 1599, 6213, 29901, 13, 4706, 4175, 842, 353, 2428, 2141, 1649, 2344, 12035, 1311, 29897, 13, 4706, 1203, 17255, 842, 5552, 12035, 1311, 29892, 376, 4572, 29918, 842, 29918, 333, 613, 4175, 29918, 842, 29918, 333, 29897, 13, 4706, 1203, 17255, 842, 5552, 12035, 1311, 29892, 376, 26705, 613, 18094, 29897, 13, 4706, 396, 1583, 29889, 978, 353, 1024, 13, 4706, 396, 1583, 29889, 26705, 353, 18094, 13, 13, 1678, 835, 13383, 7346, 29937, 13, 1678, 396, 13, 1678, 396, 259, 19916, 2697, 17830, 13, 1678, 396, 13, 1678, 835, 13383, 7346, 29937, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 4572, 29918, 2917, 29879, 29898, 25932, 29892, 1024, 29901, 19916, 2697, 1204, 29892, 4175, 29918, 2917, 29879, 29901, 19916, 3991, 29879, 353, 6213, 1125, 13, 4706, 18094, 29901, 2514, 2153, 353, 679, 29918, 26705, 29898, 4572, 29918, 2917, 29879, 29897, 13, 4706, 4175, 29918, 842, 353, 1067, 29879, 17255, 1482, 12035, 25932, 29892, 1024, 29892, 18094, 29897, 13, 4706, 4175, 29918, 842, 17255, 2344, 12035, 978, 29892, 18094, 29897, 13, 4706, 736, 4175, 29918, 842, 13, 13, 1678, 822, 3394, 29898, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 29897, 1599, 6120, 29901, 13, 4706, 736, 947, 29918, 3364, 29918, 26705, 29898, 17885, 545, 29892, 1583, 29889, 26705, 29889, 5975, 3101, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 10446, 29901, 8868, 545, 2816, 2481, 19204, 29897, 1599, 6120, 29901, 13, 4706, 736, 1583, 29889, 7302, 29898, 17885, 545, 29897, 13, 13, 13, 1990, 379, 4037, 29945, 29918, 5072, 2697, 29898, 5072, 2697, 29892, 379, 4037, 29945, 29918, 4782, 9125, 519, 1469, 1990, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4175, 29918, 842, 29901, 19916, 2697, 29897, 1599, 6213, 29901, 13, 4706, 1583, 3032, 4572, 842, 353, 4175, 29918, 842, 13, 13, 1678, 835, 13383, 7346, 29937, 13, 1678, 396, 13, 1678, 396, 259, 379, 4037, 29945, 29918, 4782, 9125, 13902, 13, 1678, 396, 13, 1678, 835, 13383, 7346, 29937, 13, 13, 1678, 822, 1024, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 4572, 842, 29889, 4572, 29918, 842, 29918, 333, 13, 13, 1678, 822, 408, 29918, 2972, 29898, 1311, 29892, 3847, 29918, 2972, 29901, 379, 4037, 29945, 29918, 4782, 29892, 1480, 29901, 28379, 29961, 16363, 29962, 353, 6213, 29897, 1599, 379, 4037, 29945, 29918, 4782, 29901, 13, 4706, 4175, 29918, 842, 29918, 2972, 353, 3847, 29918, 2972, 29889, 12277, 29918, 2972, 29898, 1311, 29889, 978, 3101, 13, 4706, 363, 1024, 29892, 4175, 29918, 29873, 297, 1583, 3032, 4572, 842, 29889, 26705, 29889, 7076, 7295, 13, 9651, 298, 2176, 29945, 29918, 4572, 353, 379, 4037, 29945, 29918, 5072, 9125, 519, 29898, 4572, 29918, 29873, 29889, 2917, 29892, 4175, 29918, 29873, 29889, 8582, 29897, 13, 9651, 298, 2176, 29945, 29918, 4572, 29889, 294, 29918, 2972, 29898, 4572, 29918, 842, 29918, 2972, 29897, 13, 13, 4706, 736, 379, 4037, 29945, 29918, 4782, 29898, 4572, 29918, 842, 29918, 2972, 29897, 13, 13, 1678, 396, 732, 1990, 5696, 13, 1678, 396, 822, 515, 29918, 2972, 29898, 13, 1678, 396, 268, 1067, 29879, 29892, 2318, 29901, 379, 4037, 29945, 29918, 4782, 29892, 1480, 29901, 28379, 29961, 16363, 29962, 353, 6213, 13, 1678, 396, 1723, 1599, 379, 4037, 29945, 29918, 4782, 9125, 13902, 29901, 13, 1678, 396, 268, 12020, 2216, 1888, 2037, 287, 2392, 29898, 13, 1678, 396, 308, 285, 29908, 3166, 29918, 2972, 451, 8762, 363, 426, 25932, 17255, 978, 1649, 1836, 8561, 1854, 366, 2436, 263, 1158, 393, 3639, 263, 7797, 29920, 1000, 1873, 310, 445, 1203, 1213, 13, 1678, 396, 268, 1723, 13, 13, 13, 1753, 4175, 29918, 3166, 29918, 2917, 29898, 978, 29901, 851, 29892, 2295, 29901, 19916, 3991, 29892, 1480, 29901, 28468, 353, 679, 16363, 3101, 1599, 19916, 29901, 13, 1678, 9995, 9832, 1078, 263, 19916, 515, 263, 2295, 961, 9639, 362, 29889, 960, 694, 376, 9507, 29908, 338, 2198, 297, 278, 19916, 3991, 29892, 372, 29915, 29879, 13, 1678, 12023, 304, 367, 697, 310, 278, 2322, 977, 2167, 29878, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1024, 584, 851, 13, 4706, 450, 5412, 1024, 310, 263, 4175, 29889, 13, 1678, 2295, 584, 19916, 3991, 13, 4706, 19916, 5285, 304, 2048, 278, 7079, 29889, 13, 1678, 1480, 584, 28468, 29892, 13136, 13, 4706, 28468, 304, 671, 363, 2472, 29914, 25442, 886, 29914, 8382, 29892, 491, 2322, 679, 16363, 580, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 19916, 13, 4706, 319, 4175, 393, 508, 367, 7436, 304, 777, 848, 29889, 13, 13, 1678, 390, 1759, 267, 13, 1678, 448, 23648, 13, 1678, 23833, 2392, 13, 4706, 319, 4175, 7079, 1033, 451, 367, 4240, 515, 278, 5285, 6139, 29889, 960, 445, 1059, 338, 10425, 29892, 367, 1854, 304, 1423, 13, 308, 29896, 29897, 319, 7079, 770, 411, 278, 1024, 297, 278, 5285, 338, 3342, 472, 278, 934, 2084, 5439, 297, 278, 5285, 13, 308, 29906, 29897, 450, 7079, 770, 7846, 1169, 515, 278, 421, 5072, 16288, 29952, 9846, 2967, 770, 29889, 13, 1678, 9995, 13, 1678, 934, 2084, 353, 2295, 29889, 657, 703, 1445, 2084, 613, 6213, 29897, 13, 13, 1678, 396, 14402, 29901, 1152, 1661, 29899, 4381, 19916, 3247, 8385, 29892, 2254, 29914, 348, 23945, 280, 278, 770, 515, 278, 934, 2084, 29889, 2045, 597, 3292, 29889, 510, 29914, 7262, 29885, 7497, 29914, 1971, 300, 654, 261, 29914, 12175, 29914, 29929, 29896, 13, 1678, 7079, 353, 6213, 13, 13, 1678, 565, 1024, 297, 22236, 29918, 3738, 29931, 4945, 29918, 7390, 23338, 1177, 29903, 29901, 13, 4706, 7079, 353, 22236, 29918, 3738, 29931, 4945, 29918, 7390, 23338, 1177, 29903, 29961, 978, 29962, 580, 13, 1678, 1683, 29901, 13, 4706, 396, 14402, 29901, 1152, 1661, 29899, 4381, 19916, 3247, 8385, 29892, 2254, 278, 770, 515, 278, 934, 2084, 29889, 2045, 597, 3292, 29889, 510, 29914, 7262, 29885, 7497, 29914, 1971, 300, 654, 261, 29914, 12175, 29914, 29929, 29896, 13, 4706, 7079, 353, 7079, 29918, 3166, 29918, 1445, 29898, 978, 29892, 934, 2084, 29897, 13, 4706, 1209, 13, 13, 1678, 396, 8561, 1854, 738, 7079, 8393, 3342, 297, 278, 2295, 526, 6153, 975, 304, 278, 7079, 2777, 29889, 13, 1678, 1018, 29901, 13, 4706, 396, 2266, 29892, 591, 2125, 2562, 310, 4444, 6514, 8393, 278, 7079, 2295, 17645, 373, 278, 716, 7079, 2777, 29889, 13, 4706, 363, 1820, 29892, 995, 297, 2295, 29889, 7076, 7295, 13, 9651, 1203, 17255, 842, 5552, 12035, 8582, 29892, 1820, 29892, 995, 29897, 13, 1678, 5174, 23833, 2392, 408, 321, 29901, 13, 4706, 1480, 29889, 27392, 29898, 13, 9651, 9995, 13, 4706, 501, 29882, 9360, 29892, 8496, 29915, 29873, 1284, 7079, 22372, 978, 29913, 4286, 4683, 366, 1854, 29901, 13, 13, 308, 29896, 29897, 319, 7079, 770, 411, 278, 1024, 22372, 978, 10162, 338, 3342, 297, 278, 934, 426, 1445, 2084, 29913, 29973, 13, 13, 308, 29906, 29897, 2193, 7079, 770, 7846, 1169, 515, 421, 5072, 16288, 6522, 13, 4706, 9995, 13, 4706, 1723, 13, 4706, 12020, 321, 13, 13, 1678, 590, 29918, 4572, 353, 19916, 29898, 2917, 29892, 7079, 29897, 13, 13, 1678, 736, 590, 29918, 4572, 13, 13, 13, 1753, 7079, 29918, 3166, 29918, 1445, 29898, 978, 29901, 851, 29892, 934, 2084, 29901, 10802, 27552, 2816, 1231, 1125, 13, 1678, 9995, 29961, 7727, 29962, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1024, 584, 851, 13, 4706, 518, 8216, 29962, 13, 1678, 934, 2084, 584, 10802, 27552, 2816, 1231, 13, 4706, 518, 8216, 29962, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 518, 1853, 29962, 13, 4706, 518, 8216, 29962, 13, 13, 1678, 390, 1759, 267, 13, 1678, 448, 23648, 13, 1678, 2216, 1888, 2037, 287, 2392, 13, 4706, 518, 8216, 29962, 13, 1678, 9995, 13, 1678, 396, 14402, 29901, 1152, 1661, 29899, 4381, 19916, 3247, 8385, 29892, 2254, 29914, 348, 23945, 280, 278, 770, 515, 278, 934, 2084, 29889, 2045, 597, 3292, 29889, 510, 29914, 7262, 29885, 7497, 29914, 1971, 300, 654, 261, 29914, 12175, 29914, 29929, 29896, 13, 1678, 12020, 2216, 1888, 2037, 287, 2392, 29898, 13, 4706, 376, 16288, 515, 934, 756, 451, 1063, 8762, 29991, 910, 1158, 881, 2125, 297, 263, 934, 2084, 322, 4175, 1024, 29892, 322, 736, 263, 1065, 29876, 519, 19916, 16288, 3850, 13, 1678, 1723, 13, 2 ]
foreman/data_refinery_foreman/foreman/management/commands/test_import_external_sample_attributes.py
AlexsLemonade/refinebio
106
63570
from unittest.mock import patch from django.test import TestCase import vcr from data_refinery_common.models import ( Contribution, Experiment, ExperimentSampleAssociation, OntologyTerm, Sample, SampleAttribute, ) from data_refinery_foreman.foreman.management.commands.import_external_sample_attributes import ( Command, import_metadata, import_sample_attributes, ) TEST_METADATA = "/home/user/data_store/externally_supplied_metadata/test_data/metadata.json" class ImportExternalSampleAttributesTestCase(TestCase): def setUp(self): experiment = Experiment() experiment.accession_code = "GSE000" experiment.alternate_accession_code = "E-GEOD-000" experiment.title = "NONONONO" experiment.description = "Boooooourns. Wasabi." experiment.technology = "RNA-SEQ" experiment.save() self.experiment = experiment # Create some samples to attach metadata to sample = Sample() sample.accession_code = "SRR123" sample.technology = "RNA-SEQ" sample.source_database = "SRA" sample.title = "Not important" sample.save() experiment_sample_association = ExperimentSampleAssociation() experiment_sample_association.sample = sample experiment_sample_association.experiment = experiment experiment_sample_association.save() sample2 = Sample() sample2.accession_code = "SRR456" sample2.technology = "RNA-SEQ" sample2.source_database = "SRA" sample2.title = "Not important" sample2.save() experiment_sample_association = ExperimentSampleAssociation() experiment_sample_association.sample = sample2 experiment_sample_association.experiment = experiment experiment_sample_association.save() # Create the ontology terms I'm using in the tests name = OntologyTerm() name.ontology_term = "PATO:0000122" name.human_readable_name = "length" name.save() unit = OntologyTerm() unit.ontology_term = "UO:0010012" unit.human_readable_name = "thou" unit.save() contribution = Contribution() contribution.source_name = "refinebio_tests" contribution.methods_url = "ccdatalab.org" contribution.save() self.contribution = contribution # # Test import_sample_attributes() # def test_skip_unknown_sample(self): """Make sure that if someone has metadata for a sample that we haven't surveyed then we just do nothing""" METADATA = [{"PATO:0000122": {"value": 25, "unit": "UO:0010012"}}] import_sample_attributes("SRR789", METADATA, self.contribution) self.assertEqual(SampleAttribute.objects.all().count(), 0) def test_import_invalid_ontology_term(self): METADATA = [{"PATO:0000122": {"value": 25, "unit": "thou"}}] self.assertRaises( ValueError, import_sample_attributes, "SRR123", METADATA, self.contribution ) METADATA = [{"length": {"value": 25, "unit": "UO:0010012"}}] self.assertRaises( ValueError, import_sample_attributes, "SRR123", METADATA, self.contribution ) def test_import_valid_sample_attributes(self): METADATA = [{"PATO:0000122": {"value": 25, "unit": "UO:0010012"}}] import_sample_attributes("SRR123", METADATA, self.contribution) self.assertEqual(SampleAttribute.objects.all().count(), 1) contributed_metadata = Sample.objects.get(accession_code="SRR123").contributed_metadata self.assertEqual( contributed_metadata[self.contribution.source_name]["length"], {"unit": "thou", "value": 25}, ) # # Test import_metadata() # def test_import_valid_metadata(self): METADATA = [ { "sample_accession": "SRR123", "attributes": [{"PATO:0000122": {"value": 25, "unit": "UO:0010012"}}], } ] import_metadata(METADATA, self.contribution) self.assertEqual(SampleAttribute.objects.all().count(), 1) contributed_metadata = Sample.objects.get(accession_code="SRR123").contributed_metadata self.assertEqual( contributed_metadata[self.contribution.source_name]["length"], {"unit": "thou", "value": 25}, ) # # End-to-end test # @vcr.use_cassette("/home/user/data_store/cassettes/foreman.sample_attributes.end-to-end.yaml") def test_management_command(self): sample = Sample() sample.accession_code = "DRR001173" sample.technology = "RNA-SEQ" sample.source_database = "SRA" sample.title = "Not important" sample.save() command = Command() SOURCE_NAME = "refinebio_tests" command.handle(file=TEST_METADATA, source_name=SOURCE_NAME, methods_url="ccdatalab.org") self.assertEqual(SampleAttribute.objects.all().count(), 1) contributed_metadata = sample.contributed_metadata self.assertEqual( set(contributed_metadata[SOURCE_NAME]["biological sex"].keys()), {"value", "confidence"}, ) self.assertEqual( contributed_metadata[SOURCE_NAME]["biological sex"]["value"].human_readable_name, "female", ) self.assertAlmostEqual( contributed_metadata[SOURCE_NAME]["biological sex"]["confidence"], 0.7856624891880539 )
[ 1, 515, 443, 27958, 29889, 17640, 1053, 13261, 13, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 13, 13, 5215, 325, 7283, 13, 13, 3166, 848, 29918, 999, 262, 708, 29918, 9435, 29889, 9794, 1053, 313, 13, 1678, 2866, 3224, 29892, 13, 1678, 1222, 15362, 29892, 13, 1678, 1222, 15362, 17708, 29254, 362, 29892, 13, 1678, 18265, 3002, 14343, 29892, 13, 1678, 21029, 29892, 13, 1678, 21029, 6708, 29892, 13, 29897, 13, 3166, 848, 29918, 999, 262, 708, 29918, 1454, 11422, 29889, 1454, 11422, 29889, 21895, 29889, 26381, 29889, 5215, 29918, 23176, 29918, 11249, 29918, 15697, 1053, 313, 13, 1678, 10516, 29892, 13, 1678, 1053, 29918, 19635, 29892, 13, 1678, 1053, 29918, 11249, 29918, 15697, 29892, 13, 29897, 13, 13, 18267, 29918, 2303, 29911, 3035, 8254, 353, 5591, 5184, 29914, 1792, 29914, 1272, 29918, 8899, 29914, 735, 725, 635, 29918, 19303, 2957, 29918, 19635, 29914, 1688, 29918, 1272, 29914, 19635, 29889, 3126, 29908, 13, 13, 13, 1990, 16032, 25865, 17708, 15801, 3057, 8259, 29898, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 7639, 353, 1222, 15362, 580, 13, 4706, 7639, 29889, 5943, 291, 29918, 401, 353, 376, 29954, 1660, 29900, 29900, 29900, 29908, 13, 4706, 7639, 29889, 26123, 403, 29918, 5943, 291, 29918, 401, 353, 376, 29923, 29899, 1692, 13668, 29899, 29900, 29900, 29900, 29908, 13, 4706, 7639, 29889, 3257, 353, 376, 29940, 1164, 1164, 1164, 29949, 29908, 13, 4706, 7639, 29889, 8216, 353, 376, 29933, 3634, 3634, 29877, 473, 1983, 29889, 12547, 19266, 1213, 13, 4706, 7639, 29889, 21695, 3002, 353, 376, 29934, 3521, 29899, 1660, 29984, 29908, 13, 4706, 7639, 29889, 7620, 580, 13, 4706, 1583, 29889, 735, 15362, 353, 7639, 13, 13, 4706, 396, 6204, 777, 11916, 304, 10641, 15562, 304, 13, 4706, 4559, 353, 21029, 580, 13, 4706, 4559, 29889, 5943, 291, 29918, 401, 353, 376, 14098, 29934, 29896, 29906, 29941, 29908, 13, 4706, 4559, 29889, 21695, 3002, 353, 376, 29934, 3521, 29899, 1660, 29984, 29908, 13, 4706, 4559, 29889, 4993, 29918, 9803, 353, 376, 29903, 4717, 29908, 13, 4706, 4559, 29889, 3257, 353, 376, 3664, 4100, 29908, 13, 4706, 4559, 29889, 7620, 580, 13, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 353, 1222, 15362, 17708, 29254, 362, 580, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 29889, 11249, 353, 4559, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 29889, 735, 15362, 353, 7639, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 29889, 7620, 580, 13, 13, 4706, 4559, 29906, 353, 21029, 580, 13, 4706, 4559, 29906, 29889, 5943, 291, 29918, 401, 353, 376, 14098, 29934, 29946, 29945, 29953, 29908, 13, 4706, 4559, 29906, 29889, 21695, 3002, 353, 376, 29934, 3521, 29899, 1660, 29984, 29908, 13, 4706, 4559, 29906, 29889, 4993, 29918, 9803, 353, 376, 29903, 4717, 29908, 13, 4706, 4559, 29906, 29889, 3257, 353, 376, 3664, 4100, 29908, 13, 4706, 4559, 29906, 29889, 7620, 580, 13, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 353, 1222, 15362, 17708, 29254, 362, 580, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 29889, 11249, 353, 4559, 29906, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 29889, 735, 15362, 353, 7639, 13, 4706, 7639, 29918, 11249, 29918, 21264, 362, 29889, 7620, 580, 13, 13, 4706, 396, 6204, 278, 4625, 3002, 4958, 306, 29915, 29885, 773, 297, 278, 6987, 13, 4706, 1024, 353, 18265, 3002, 14343, 580, 13, 4706, 1024, 29889, 609, 3002, 29918, 8489, 353, 376, 29925, 1299, 29949, 29901, 29900, 29900, 29900, 29900, 29896, 29906, 29906, 29908, 13, 4706, 1024, 29889, 26029, 29918, 949, 519, 29918, 978, 353, 376, 2848, 29908, 13, 4706, 1024, 29889, 7620, 580, 13, 13, 4706, 5190, 353, 18265, 3002, 14343, 580, 13, 4706, 5190, 29889, 609, 3002, 29918, 8489, 353, 376, 29965, 29949, 29901, 29900, 29900, 29896, 29900, 29900, 29896, 29906, 29908, 13, 4706, 5190, 29889, 26029, 29918, 949, 519, 29918, 978, 353, 376, 386, 283, 29908, 13, 4706, 5190, 29889, 7620, 580, 13, 13, 4706, 11896, 353, 2866, 3224, 580, 13, 4706, 11896, 29889, 4993, 29918, 978, 353, 376, 999, 457, 24840, 29918, 21150, 29908, 13, 4706, 11896, 29889, 23515, 29918, 2271, 353, 376, 617, 29881, 2075, 370, 29889, 990, 29908, 13, 4706, 11896, 29889, 7620, 580, 13, 4706, 1583, 29889, 1285, 3224, 353, 11896, 13, 13, 1678, 396, 13, 1678, 396, 4321, 1053, 29918, 11249, 29918, 15697, 580, 13, 1678, 396, 13, 13, 1678, 822, 1243, 29918, 11014, 29918, 26690, 29918, 11249, 29898, 1311, 1125, 13, 4706, 9995, 9984, 1854, 393, 565, 4856, 756, 15562, 363, 263, 4559, 393, 591, 7359, 29915, 29873, 13, 4706, 18994, 287, 769, 591, 925, 437, 3078, 15945, 29908, 13, 13, 4706, 341, 2544, 3035, 8254, 353, 518, 6377, 29925, 1299, 29949, 29901, 29900, 29900, 29900, 29900, 29896, 29906, 29906, 1115, 8853, 1767, 1115, 29871, 29906, 29945, 29892, 376, 5441, 1115, 376, 29965, 29949, 29901, 29900, 29900, 29896, 29900, 29900, 29896, 29906, 29908, 930, 29962, 13, 4706, 1053, 29918, 11249, 29918, 15697, 703, 14098, 29934, 29955, 29947, 29929, 613, 341, 2544, 3035, 8254, 29892, 1583, 29889, 1285, 3224, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 17708, 6708, 29889, 12650, 29889, 497, 2141, 2798, 3285, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 5215, 29918, 20965, 29918, 609, 3002, 29918, 8489, 29898, 1311, 1125, 13, 4706, 341, 2544, 3035, 8254, 353, 518, 6377, 29925, 1299, 29949, 29901, 29900, 29900, 29900, 29900, 29896, 29906, 29906, 1115, 8853, 1767, 1115, 29871, 29906, 29945, 29892, 376, 5441, 1115, 376, 386, 283, 29908, 930, 29962, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 13, 9651, 7865, 2392, 29892, 1053, 29918, 11249, 29918, 15697, 29892, 376, 14098, 29934, 29896, 29906, 29941, 613, 341, 2544, 3035, 8254, 29892, 1583, 29889, 1285, 3224, 13, 4706, 1723, 13, 13, 4706, 341, 2544, 3035, 8254, 353, 518, 6377, 2848, 1115, 8853, 1767, 1115, 29871, 29906, 29945, 29892, 376, 5441, 1115, 376, 29965, 29949, 29901, 29900, 29900, 29896, 29900, 29900, 29896, 29906, 29908, 930, 29962, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 13, 9651, 7865, 2392, 29892, 1053, 29918, 11249, 29918, 15697, 29892, 376, 14098, 29934, 29896, 29906, 29941, 613, 341, 2544, 3035, 8254, 29892, 1583, 29889, 1285, 3224, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 5215, 29918, 3084, 29918, 11249, 29918, 15697, 29898, 1311, 1125, 13, 4706, 341, 2544, 3035, 8254, 353, 518, 6377, 29925, 1299, 29949, 29901, 29900, 29900, 29900, 29900, 29896, 29906, 29906, 1115, 8853, 1767, 1115, 29871, 29906, 29945, 29892, 376, 5441, 1115, 376, 29965, 29949, 29901, 29900, 29900, 29896, 29900, 29900, 29896, 29906, 29908, 930, 29962, 13, 4706, 1053, 29918, 11249, 29918, 15697, 703, 14098, 29934, 29896, 29906, 29941, 613, 341, 2544, 3035, 8254, 29892, 1583, 29889, 1285, 3224, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 17708, 6708, 29889, 12650, 29889, 497, 2141, 2798, 3285, 29871, 29896, 29897, 13, 13, 4706, 26869, 29918, 19635, 353, 21029, 29889, 12650, 29889, 657, 29898, 5943, 291, 29918, 401, 543, 14098, 29934, 29896, 29906, 29941, 2564, 1285, 7541, 29918, 19635, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 26869, 29918, 19635, 29961, 1311, 29889, 1285, 3224, 29889, 4993, 29918, 978, 29962, 3366, 2848, 12436, 13, 9651, 8853, 5441, 1115, 376, 386, 283, 613, 376, 1767, 1115, 29871, 29906, 29945, 1118, 13, 4706, 1723, 13, 13, 1678, 396, 13, 1678, 396, 4321, 1053, 29918, 19635, 580, 13, 1678, 396, 13, 13, 1678, 822, 1243, 29918, 5215, 29918, 3084, 29918, 19635, 29898, 1311, 1125, 13, 4706, 341, 2544, 3035, 8254, 353, 518, 13, 9651, 426, 13, 18884, 376, 11249, 29918, 5943, 291, 1115, 376, 14098, 29934, 29896, 29906, 29941, 613, 13, 18884, 376, 15697, 1115, 518, 6377, 29925, 1299, 29949, 29901, 29900, 29900, 29900, 29900, 29896, 29906, 29906, 1115, 8853, 1767, 1115, 29871, 29906, 29945, 29892, 376, 5441, 1115, 376, 29965, 29949, 29901, 29900, 29900, 29896, 29900, 29900, 29896, 29906, 29908, 930, 1402, 13, 9651, 500, 13, 4706, 4514, 13, 13, 4706, 1053, 29918, 19635, 29898, 2303, 29911, 3035, 8254, 29892, 1583, 29889, 1285, 3224, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 17708, 6708, 29889, 12650, 29889, 497, 2141, 2798, 3285, 29871, 29896, 29897, 13, 13, 4706, 26869, 29918, 19635, 353, 21029, 29889, 12650, 29889, 657, 29898, 5943, 291, 29918, 401, 543, 14098, 29934, 29896, 29906, 29941, 2564, 1285, 7541, 29918, 19635, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 26869, 29918, 19635, 29961, 1311, 29889, 1285, 3224, 29889, 4993, 29918, 978, 29962, 3366, 2848, 12436, 13, 9651, 8853, 5441, 1115, 376, 386, 283, 613, 376, 1767, 1115, 29871, 29906, 29945, 1118, 13, 4706, 1723, 13, 13, 1678, 396, 13, 1678, 396, 2796, 29899, 517, 29899, 355, 1243, 13, 1678, 396, 13, 1678, 732, 7071, 29878, 29889, 1509, 29918, 29883, 465, 2353, 11974, 5184, 29914, 1792, 29914, 1272, 29918, 8899, 29914, 29883, 465, 21158, 29914, 1454, 11422, 29889, 11249, 29918, 15697, 29889, 355, 29899, 517, 29899, 355, 29889, 25162, 1159, 13, 1678, 822, 1243, 29918, 21895, 29918, 6519, 29898, 1311, 1125, 13, 4706, 4559, 353, 21029, 580, 13, 4706, 4559, 29889, 5943, 291, 29918, 401, 353, 376, 8353, 29934, 29900, 29900, 29896, 29896, 29955, 29941, 29908, 13, 4706, 4559, 29889, 21695, 3002, 353, 376, 29934, 3521, 29899, 1660, 29984, 29908, 13, 4706, 4559, 29889, 4993, 29918, 9803, 353, 376, 29903, 4717, 29908, 13, 4706, 4559, 29889, 3257, 353, 376, 3664, 4100, 29908, 13, 4706, 4559, 29889, 7620, 580, 13, 13, 4706, 1899, 353, 10516, 580, 13, 4706, 7791, 4574, 4741, 29918, 5813, 353, 376, 999, 457, 24840, 29918, 21150, 29908, 13, 4706, 1899, 29889, 8411, 29898, 1445, 29922, 18267, 29918, 2303, 29911, 3035, 8254, 29892, 2752, 29918, 978, 29922, 27839, 4741, 29918, 5813, 29892, 3519, 29918, 2271, 543, 617, 29881, 2075, 370, 29889, 990, 1159, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 17708, 6708, 29889, 12650, 29889, 497, 2141, 2798, 3285, 29871, 29896, 29897, 13, 13, 4706, 26869, 29918, 19635, 353, 4559, 29889, 1285, 7541, 29918, 19635, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 731, 29898, 1285, 7541, 29918, 19635, 29961, 27839, 4741, 29918, 5813, 29962, 3366, 5365, 5996, 7916, 16862, 8149, 25739, 13, 9651, 8853, 1767, 613, 376, 5527, 5084, 10758, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 26869, 29918, 19635, 29961, 27839, 4741, 29918, 5813, 29962, 3366, 5365, 5996, 7916, 3108, 3366, 1767, 16862, 26029, 29918, 949, 519, 29918, 978, 29892, 13, 9651, 376, 29888, 331, 744, 613, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 13, 9651, 26869, 29918, 19635, 29961, 27839, 4741, 29918, 5813, 29962, 3366, 5365, 5996, 7916, 3108, 3366, 5527, 5084, 12436, 29871, 29900, 29889, 29955, 29947, 29945, 29953, 29953, 29906, 29946, 29947, 29929, 29896, 29947, 29947, 29900, 29945, 29941, 29929, 13, 4706, 1723, 13, 2 ]
src/Books/book.py
cclauss/pydantic-books-example
4
83224
<reponame>cclauss/pydantic-books-example<gh_stars>1-10 from __future__ import annotations from datetime import date from typing import Optional from pydantic import BaseModel, validator class Author(BaseModel): name: str @validator("name") def author_name_must_not_be_an_empty_string(cls, v): if not v: raise ValueError("name must not be an empty string") return v class Publisher(BaseModel): name: str @validator("name") def publisher_name_must_not_be_an_empty_string(cls, v): if not v: raise ValueError("name must not be an empty string") return v class SourceRecord(BaseModel): record: str @validator("record") def record_must_not_be_an_empty_string(cls, v): if not v: raise ValueError("record must not be an empty string") return v class Book(BaseModel): title: str source_records: list[SourceRecord] authors: list[Author] publishers: list[Publisher] publish_date: Optional[date] author: str publisher: str @validator("source_records", "authors", "publishers") def list_must_not_be_empty(cls, v): if not v: raise ValueError("list must not be empty") return v # doctests... to be run with `pytest --doctest-modules` def doctest_author(): """ >>> Author() # Must provide a `name` parameter Traceback (most recent call last): ... pydantic.error_wrappers.ValidationError: 1 validation error for Author name field required (type=value_error.missing) >>> Author(name="") # @validator() ensures that an empty string is not allowed Traceback (most recent call last): ... pydantic.error_wrappers.ValidationError: 1 validation error for Author name name must not be an empty string (type=value_error) >>> Author("") # `name =` is NOT optional Traceback (most recent call last): ... TypeError: __init__() takes exactly 1 positional argument (2 given) >>> Author(name="Bob") Author(name='Bob') >>> external_data = {"name": "<NAME>"} >>> from_dict = Author(**external_data) # Create an Author from a dict >>> from_dict Author(name='<NAME>') >>> from_dict.json() # Pydantic has json.dumps() is builtin '{"name": "<NAME>"}' """ def doctest_book(): """ >>> Book( ... title = "", ... source_records = [], ... authors = [], ... publishers = [], ... publish_date = None, ... author = "", ... publisher = "", ... ) Traceback (most recent call last): ... pydantic.error_wrappers.ValidationError: 3 validation errors for Book source_records list must not be empty (type=value_error) authors list must not be empty (type=value_error) publishers list must not be empty (type=value_error) >>> Book( ... title = "", ... source_records = [Author(name="Bob")], ... authors = [Author(name="Bob")], ... publishers = [Author(name="Bob")], ... publish_date = None, ... author = "", ... publisher = "", ... ) Traceback (most recent call last): ... pydantic.error_wrappers.ValidationError: 1 validation error for Book source_records -> 0 -> record field required (type=value_error.missing) >>> Book( ... title = "", ... source_records = [SourceRecord(record="record")], ... authors = [Author(name="Bob")], ... publishers = [Publisher(name="Bob's Publishing")], ... publish_date = None, ... author = "", ... publisher = "", ... ) Book(title='', source_records=[SourceRecord(record='record')], authors=[Author(name='Bob')], publishers=[Publisher(name="Bob's Publishing")], publish_date=None, author='', publisher='') """ def doctest_dates(): """ https://pydantic-docs.helpmanual.io/usage/types/#datetime-types >>> class DateHack(BaseModel): ... publish_date: date ... >>> DateHack(publish_date="2020-01-01") DateHack(publish_date=datetime.date(2020, 1, 1)) >>> DateHack(publish_date=1577833200) DateHack(publish_date=datetime.date(2019, 12, 31)) >>> DateHack(publish_date="1/1/2020") Traceback (most recent call last): ... pydantic.error_wrappers.ValidationError: 1 validation error for DateHack publish_date invalid date format (type=value_error.date) >>> DateHack(publish_date="January, 2020") Traceback (most recent call last): ... pydantic.error_wrappers.ValidationError: 1 validation error for DateHack publish_date invalid date format (type=value_error.date) """
[ 1, 529, 276, 1112, 420, 29958, 617, 433, 1558, 29914, 2272, 29881, 7716, 29899, 12733, 29899, 4773, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 4770, 29888, 9130, 1649, 1053, 25495, 13, 13, 3166, 12865, 1053, 2635, 13, 3166, 19229, 1053, 28379, 13, 13, 3166, 282, 2941, 7716, 1053, 7399, 3195, 29892, 2854, 1061, 13, 13, 13, 1990, 13361, 29898, 5160, 3195, 1125, 13, 1678, 1024, 29901, 851, 13, 13, 1678, 732, 3084, 1061, 703, 978, 1159, 13, 1678, 822, 4148, 29918, 978, 29918, 21969, 29918, 1333, 29918, 915, 29918, 273, 29918, 6310, 29918, 1807, 29898, 25932, 29892, 325, 1125, 13, 4706, 565, 451, 325, 29901, 13, 9651, 12020, 7865, 2392, 703, 978, 1818, 451, 367, 385, 4069, 1347, 1159, 13, 4706, 736, 325, 13, 13, 13, 1990, 12904, 261, 29898, 5160, 3195, 1125, 13, 1678, 1024, 29901, 851, 13, 13, 1678, 732, 3084, 1061, 703, 978, 1159, 13, 1678, 822, 9805, 261, 29918, 978, 29918, 21969, 29918, 1333, 29918, 915, 29918, 273, 29918, 6310, 29918, 1807, 29898, 25932, 29892, 325, 1125, 13, 4706, 565, 451, 325, 29901, 13, 9651, 12020, 7865, 2392, 703, 978, 1818, 451, 367, 385, 4069, 1347, 1159, 13, 4706, 736, 325, 13, 13, 13, 1990, 7562, 9182, 29898, 5160, 3195, 1125, 13, 1678, 2407, 29901, 851, 13, 13, 1678, 732, 3084, 1061, 703, 11651, 1159, 13, 1678, 822, 2407, 29918, 21969, 29918, 1333, 29918, 915, 29918, 273, 29918, 6310, 29918, 1807, 29898, 25932, 29892, 325, 1125, 13, 4706, 565, 451, 325, 29901, 13, 9651, 12020, 7865, 2392, 703, 11651, 1818, 451, 367, 385, 4069, 1347, 1159, 13, 4706, 736, 325, 13, 13, 13, 1990, 6726, 29898, 5160, 3195, 1125, 13, 1678, 3611, 29901, 851, 13, 1678, 2752, 29918, 3757, 4339, 29901, 1051, 29961, 4435, 9182, 29962, 13, 1678, 15717, 29901, 1051, 29961, 13720, 29962, 13, 1678, 9805, 414, 29901, 1051, 29961, 21076, 1674, 261, 29962, 13, 1678, 9805, 29918, 1256, 29901, 28379, 29961, 1256, 29962, 13, 1678, 4148, 29901, 851, 13, 1678, 9805, 261, 29901, 851, 13, 13, 1678, 732, 3084, 1061, 703, 4993, 29918, 3757, 4339, 613, 376, 5150, 943, 613, 376, 23679, 414, 1159, 13, 1678, 822, 1051, 29918, 21969, 29918, 1333, 29918, 915, 29918, 6310, 29898, 25932, 29892, 325, 1125, 13, 4706, 565, 451, 325, 29901, 13, 9651, 12020, 7865, 2392, 703, 1761, 1818, 451, 367, 4069, 1159, 13, 4706, 736, 325, 13, 13, 13, 29937, 437, 312, 9197, 856, 304, 367, 1065, 411, 421, 2272, 1688, 1192, 1867, 312, 342, 29899, 7576, 29952, 13, 13, 13, 1753, 437, 312, 342, 29918, 8921, 7295, 13, 1678, 9995, 13, 1678, 8653, 13361, 580, 29871, 396, 19928, 3867, 263, 421, 978, 29952, 3443, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 282, 2941, 7716, 29889, 2704, 29918, 29893, 336, 22437, 29889, 19448, 2392, 29901, 29871, 29896, 8845, 1059, 363, 13361, 13, 1678, 1024, 13, 418, 1746, 3734, 313, 1853, 29922, 1767, 29918, 2704, 29889, 27259, 29897, 13, 1678, 8653, 13361, 29898, 978, 543, 1159, 29871, 396, 732, 3084, 1061, 580, 5662, 1973, 393, 385, 4069, 1347, 338, 451, 6068, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 282, 2941, 7716, 29889, 2704, 29918, 29893, 336, 22437, 29889, 19448, 2392, 29901, 29871, 29896, 8845, 1059, 363, 13361, 13, 1678, 1024, 13, 418, 1024, 1818, 451, 367, 385, 4069, 1347, 313, 1853, 29922, 1767, 29918, 2704, 29897, 13, 1678, 8653, 13361, 703, 1159, 29871, 396, 421, 978, 353, 29952, 338, 6058, 13136, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 20948, 29901, 4770, 2344, 1649, 580, 4893, 3721, 29871, 29896, 2602, 284, 2980, 313, 29906, 2183, 29897, 13, 1678, 8653, 13361, 29898, 978, 543, 29362, 1159, 13, 1678, 13361, 29898, 978, 2433, 29362, 1495, 13, 1678, 8653, 7029, 29918, 1272, 353, 8853, 978, 1115, 9872, 5813, 29958, 9092, 13, 1678, 8653, 515, 29918, 8977, 353, 13361, 29898, 1068, 23176, 29918, 1272, 29897, 29871, 396, 6204, 385, 13361, 515, 263, 9657, 13, 1678, 8653, 515, 29918, 8977, 13, 1678, 13361, 29898, 978, 2433, 29966, 5813, 29958, 1495, 13, 1678, 8653, 515, 29918, 8977, 29889, 3126, 580, 29871, 396, 349, 2941, 7716, 756, 4390, 29889, 29881, 17204, 580, 338, 4240, 262, 13, 1678, 525, 6377, 978, 1115, 9872, 5813, 29958, 9092, 29915, 13, 1678, 9995, 13, 13, 13, 1753, 437, 312, 342, 29918, 2909, 7295, 13, 1678, 9995, 13, 1678, 8653, 6726, 29898, 13, 1678, 2023, 268, 3611, 353, 12633, 13, 1678, 2023, 268, 2752, 29918, 3757, 4339, 353, 19997, 13, 1678, 2023, 268, 15717, 353, 19997, 13, 1678, 2023, 268, 9805, 414, 353, 19997, 13, 1678, 2023, 268, 9805, 29918, 1256, 353, 6213, 29892, 13, 1678, 2023, 268, 4148, 353, 12633, 13, 1678, 2023, 268, 9805, 261, 353, 12633, 13, 1678, 2023, 1723, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 282, 2941, 7716, 29889, 2704, 29918, 29893, 336, 22437, 29889, 19448, 2392, 29901, 29871, 29941, 8845, 4436, 363, 6726, 13, 1678, 2752, 29918, 3757, 4339, 13, 418, 1051, 1818, 451, 367, 4069, 313, 1853, 29922, 1767, 29918, 2704, 29897, 13, 1678, 15717, 13, 418, 1051, 1818, 451, 367, 4069, 313, 1853, 29922, 1767, 29918, 2704, 29897, 13, 1678, 9805, 414, 13, 418, 1051, 1818, 451, 367, 4069, 313, 1853, 29922, 1767, 29918, 2704, 29897, 13, 1678, 8653, 6726, 29898, 13, 1678, 2023, 268, 3611, 353, 12633, 13, 1678, 2023, 268, 2752, 29918, 3757, 4339, 353, 518, 13720, 29898, 978, 543, 29362, 1159, 1402, 13, 1678, 2023, 268, 15717, 353, 518, 13720, 29898, 978, 543, 29362, 1159, 1402, 13, 1678, 2023, 268, 9805, 414, 353, 518, 13720, 29898, 978, 543, 29362, 1159, 1402, 13, 1678, 2023, 268, 9805, 29918, 1256, 353, 6213, 29892, 13, 1678, 2023, 268, 4148, 353, 12633, 13, 1678, 2023, 268, 9805, 261, 353, 12633, 13, 1678, 2023, 1723, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 282, 2941, 7716, 29889, 2704, 29918, 29893, 336, 22437, 29889, 19448, 2392, 29901, 29871, 29896, 8845, 1059, 363, 6726, 13, 1678, 2752, 29918, 3757, 4339, 1599, 29871, 29900, 1599, 2407, 13, 418, 1746, 3734, 313, 1853, 29922, 1767, 29918, 2704, 29889, 27259, 29897, 13, 1678, 8653, 6726, 29898, 13, 1678, 2023, 268, 3611, 353, 12633, 13, 1678, 2023, 268, 2752, 29918, 3757, 4339, 353, 518, 4435, 9182, 29898, 11651, 543, 11651, 1159, 1402, 13, 1678, 2023, 268, 15717, 353, 518, 13720, 29898, 978, 543, 29362, 1159, 1402, 13, 1678, 2023, 268, 9805, 414, 353, 518, 21076, 1674, 261, 29898, 978, 543, 29362, 29915, 29879, 19088, 1159, 1402, 13, 1678, 2023, 268, 9805, 29918, 1256, 353, 6213, 29892, 13, 1678, 2023, 268, 4148, 353, 12633, 13, 1678, 2023, 268, 9805, 261, 353, 12633, 13, 1678, 2023, 1723, 13, 1678, 6726, 29898, 3257, 2433, 742, 2752, 29918, 3757, 4339, 11759, 4435, 9182, 29898, 11651, 2433, 11651, 1495, 1402, 15717, 11759, 13720, 29898, 978, 2433, 29362, 1495, 1402, 9805, 414, 11759, 21076, 1674, 261, 29898, 978, 543, 29362, 29915, 29879, 19088, 1159, 1402, 9805, 29918, 1256, 29922, 8516, 29892, 4148, 2433, 742, 9805, 261, 2433, 1495, 13, 1678, 9995, 13, 13, 13, 1753, 437, 312, 342, 29918, 15190, 7295, 13, 1678, 9995, 13, 1678, 2045, 597, 2272, 29881, 7716, 29899, 2640, 29889, 8477, 11288, 29889, 601, 29914, 21125, 29914, 8768, 8484, 12673, 29899, 8768, 13, 13, 1678, 8653, 770, 4712, 29950, 547, 29898, 5160, 3195, 1125, 13, 1678, 2023, 268, 9805, 29918, 1256, 29901, 2635, 13, 1678, 2023, 13, 1678, 8653, 4712, 29950, 547, 29898, 23679, 29918, 1256, 543, 29906, 29900, 29906, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 1159, 13, 1678, 4712, 29950, 547, 29898, 23679, 29918, 1256, 29922, 12673, 29889, 1256, 29898, 29906, 29900, 29906, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 876, 13, 1678, 8653, 4712, 29950, 547, 29898, 23679, 29918, 1256, 29922, 29896, 29945, 29955, 29955, 29947, 29941, 29941, 29906, 29900, 29900, 29897, 13, 1678, 4712, 29950, 547, 29898, 23679, 29918, 1256, 29922, 12673, 29889, 1256, 29898, 29906, 29900, 29896, 29929, 29892, 29871, 29896, 29906, 29892, 29871, 29941, 29896, 876, 13, 1678, 8653, 4712, 29950, 547, 29898, 23679, 29918, 1256, 543, 29896, 29914, 29896, 29914, 29906, 29900, 29906, 29900, 1159, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 282, 2941, 7716, 29889, 2704, 29918, 29893, 336, 22437, 29889, 19448, 2392, 29901, 29871, 29896, 8845, 1059, 363, 4712, 29950, 547, 13, 1678, 9805, 29918, 1256, 13, 418, 8340, 2635, 3402, 313, 1853, 29922, 1767, 29918, 2704, 29889, 1256, 29897, 13, 1678, 8653, 4712, 29950, 547, 29898, 23679, 29918, 1256, 543, 29967, 15623, 653, 29892, 29871, 29906, 29900, 29906, 29900, 1159, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 282, 2941, 7716, 29889, 2704, 29918, 29893, 336, 22437, 29889, 19448, 2392, 29901, 29871, 29896, 8845, 1059, 363, 4712, 29950, 547, 13, 1678, 9805, 29918, 1256, 13, 418, 8340, 2635, 3402, 313, 1853, 29922, 1767, 29918, 2704, 29889, 1256, 29897, 13, 1678, 9995, 13, 2 ]
code/socialDistribution/models/author.py
CMPUT404F21TEAM/social-distribution
0
187373
from django.db import models from django.contrib.auth.models import User from django.utils import timezone import datetime import uuid from cmput404.constants import API_BASE, STRING_MAXLEN, URL_MAXLEN from .follow import Follow class Author(models.Model): """ Author model which represents all authors. All authors that interact with the application will be stored as an author. That is, the Author model can store both remote and local authors. Methods on an Author instance primarily rely on API calls to get the data corresponding to the author from a remote server. In the future, caching can be used with this model to reduce the number of API calls being sent out. When a local author is created, it must be re-fetched from the database in order to access the auto-generated author.url attribute. """ # Django Software Foundation, https://docs.djangoproject.com/en/dev/ref/models/fields/#uuidfield id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) url = models.URLField(max_length=URL_MAXLEN) host = models.URLField(max_length=STRING_MAXLEN, blank=True) displayName = models.CharField(max_length=STRING_MAXLEN, default="Anonymous User") githubUrl = models.CharField(max_length=URL_MAXLEN, null=True) profileImageUrl = models.CharField(max_length=URL_MAXLEN, null=True) created_date = models.DateTimeField(auto_now_add=True) # timestamp of when the object was last updated # will need later for caching _last_updated = models.DateTimeField(auto_now=True) # true means that field data will always be up-to-date (used by LocalAuthor) _always_up_to_date = models.BooleanField(default=False) def get_url_id(self): """ Returns the id of the author in url form """ return self.url def has_follow_request(self, author): """ Over-ridden in LocalAuthor. Always returns False """ # No endpoint give us follow request objects # Even if we GET against their inbox, we'll get back a list of posts # The alternative would be to keep track of outgoing follow requests return False def get_inbox(self): """ Gets the URL of the Authors inbox. """ return self.url.strip("/") + "/inbox/" def as_json(self): """ GET JSON representation of author """ json_data = { "type": "author", "id": self.url, "host": self.host, "displayName": self.displayName, "url": self.url, "github": self.githubUrl, "profileImage": self.profileImageUrl } return json_data def update_with_json(self, data): ''' Add or update Author model data Had to move here from utility.py due to import errors ''' try: if data.get("displayName"): self.displayName = data['displayName'] if data.get('host'): self.host = data['host'] if data.get("github"): self.githubUrl = data['github'] if data.get("profileImage"): self.profileImageUrl = data['profileImage'] self.save() except: pass def up_to_date(self): """ Checks if the author data is currently up do date. Returns true if either the data is always maintained up-to-date or if the data was recently refreshed """ limit = timezone.now()-datetime.timedelta(seconds=6) # 6 seconds ago was_recent_update = self._last_updated > limit # return true if always up-to-date or if just updated return self._always_up_to_date or was_recent_update def __str__(self) -> str: return f"Author: {self.url}" class LocalAuthor(Author): ''' LocalAuthor model which represents an author hosted on the local server. Any authors hosted on the local server will be stored as a LocalAuthor instance. This class overrides methods defined in Author to provide more efficient, local access (no API) to author data. LocalAuthor model: user Author's corresponding Django User (text) username Author's username (text) displayName Author's displayName (text) githubUrl Author's github url (text) profileImageUrl Author's profile image url (text) posts Posts created by the author follows Followers of the author (Collection of Follow objects) friend_requests Authors who have requested to follow author (Collection of LocalAuthor objects) inbox_posts Posts sent to the inbox of the author ''' user = models.OneToOneField(User, null=True, on_delete=models.CASCADE) username = models.CharField(max_length=STRING_MAXLEN, unique=True, blank=False) follow_requests = models.ManyToManyField('Author', related_name="sent_follow_requests") inbox_posts = models.ManyToManyField('InboxPost') def is_following(self, author: Author): """ Returns true if self is following author, false otherwise. """ try: self.following.get(object=author) return True except Follow.DoesNotExist: return False def has_follower(self, author: Author): """ Returns true if author is a follower of self, false otherwise. """ try: self.follows.get(actor=author) return True except Follow.DoesNotExist: return False def has_friend(self, author: Author): """ Returns true if author is a friend of self, false otherwise. """ return Follow.are_friends(self, author) def has_follow_request(self, author: Author): """ Returns true if self has a follow request from author, false otherwise. """ return self.follow_requests.filter(id=author.id).exists() def handle_follow_request(self, author: Author, accept: bool): """ Removes author from follow requests (if exists) and resolves the request. If accept is true, they are added as a follower of self. """ query_result = self.follow_requests.filter(id=author.id) if query_result.exists(): self.follow_requests.remove(query_result.first()) if accept == True: self.follows.get_or_create(actor=author) def get_followers(self): """ Gets the Authors who are followers of self. """ follows = self.follows.all() followers = [f.actor for f in follows] return followers def get_friends(self): """ Gets the Authors who are friends of self. """ follows = self.follows.all() friends = [f.actor for f in follows if self.has_friend(f.actor)] return friends def __str__(self): return self.displayName def save(self, *args, **kwargs): self._always_up_to_date = True super().save(*args, **kwargs) # Call the "real" save() method. self._set_url() def _set_url(self): """ Sets the URL of the author to be "http://{HOST}/{API_PREFIX}/author/{self.id}" if one was not set when created. This sets the URL attribute of all local authors. """ # Clark, https://stackoverflow.com/users/10424244/clark, "Django - How to get self.id when saving a new object?", # 2021-02-19, https://stackoverflow.com/a/66271445, CC BY-SA 4.0 url = f"{API_BASE}/author/{self.id}" host = f"{API_BASE}/" if self.url != url or self.host != host: Author.objects.filter(id=self.id).update(url=url, host=host)
[ 1, 515, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 3166, 9557, 29889, 13239, 1053, 29431, 13, 13, 5215, 12865, 13, 5215, 318, 5416, 13, 13, 3166, 7477, 649, 29946, 29900, 29946, 29889, 3075, 1934, 1053, 3450, 29918, 25416, 29892, 29486, 4214, 29918, 12648, 1307, 29940, 29892, 3988, 29918, 12648, 1307, 29940, 13, 3166, 869, 23031, 1053, 10306, 13, 13, 13, 1990, 13361, 29898, 9794, 29889, 3195, 1125, 13, 1678, 9995, 13361, 1904, 607, 11524, 599, 15717, 29889, 13, 13, 4706, 2178, 15717, 393, 16254, 411, 278, 2280, 674, 367, 6087, 408, 385, 4148, 29889, 2193, 338, 29892, 13, 4706, 278, 13361, 1904, 508, 3787, 1716, 7592, 322, 1887, 15717, 29889, 8108, 29879, 373, 385, 13361, 2777, 19434, 13, 4706, 19104, 373, 3450, 5717, 304, 679, 278, 848, 6590, 304, 278, 4148, 515, 263, 7592, 1923, 29889, 13, 13, 4706, 512, 278, 5434, 29892, 22488, 508, 367, 1304, 411, 445, 1904, 304, 10032, 278, 1353, 310, 3450, 5717, 1641, 2665, 714, 29889, 13, 13, 4706, 1932, 263, 1887, 4148, 338, 2825, 29892, 372, 1818, 367, 337, 29899, 9155, 287, 515, 278, 2566, 297, 1797, 304, 2130, 278, 4469, 29899, 13525, 4148, 29889, 2271, 5352, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 15337, 18540, 10606, 29892, 2045, 597, 2640, 29889, 19776, 574, 26555, 622, 29889, 510, 29914, 264, 29914, 3359, 29914, 999, 29914, 9794, 29914, 9621, 8484, 25118, 2671, 13, 1678, 1178, 353, 4733, 29889, 29965, 11150, 3073, 29898, 16072, 29918, 1989, 29922, 5574, 29892, 2322, 29922, 25118, 29889, 25118, 29946, 29892, 3863, 519, 29922, 8824, 29897, 13, 1678, 3142, 353, 4733, 29889, 4219, 3073, 29898, 3317, 29918, 2848, 29922, 4219, 29918, 12648, 1307, 29940, 29897, 13, 1678, 3495, 353, 4733, 29889, 4219, 3073, 29898, 3317, 29918, 2848, 29922, 20785, 29918, 12648, 1307, 29940, 29892, 9654, 29922, 5574, 29897, 13, 1678, 2479, 1170, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 20785, 29918, 12648, 1307, 29940, 29892, 2322, 543, 2744, 11428, 4911, 1159, 13, 1678, 18546, 5983, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 4219, 29918, 12648, 1307, 29940, 29892, 1870, 29922, 5574, 29897, 13, 1678, 8722, 2940, 5983, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 4219, 29918, 12648, 1307, 29940, 29892, 1870, 29922, 5574, 29897, 13, 1678, 2825, 29918, 1256, 353, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29918, 1202, 29922, 5574, 29897, 13, 13, 1678, 396, 14334, 310, 746, 278, 1203, 471, 1833, 4784, 13, 1678, 396, 674, 817, 2678, 363, 22488, 13, 1678, 903, 4230, 29918, 21402, 353, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29922, 5574, 29897, 13, 13, 1678, 396, 1565, 2794, 393, 1746, 848, 674, 2337, 367, 701, 29899, 517, 29899, 1256, 313, 3880, 491, 9959, 13720, 29897, 13, 1678, 903, 21936, 29918, 786, 29918, 517, 29918, 1256, 353, 4733, 29889, 18146, 3073, 29898, 4381, 29922, 8824, 29897, 13, 13, 1678, 822, 679, 29918, 2271, 29918, 333, 29898, 1311, 1125, 13, 4706, 9995, 16969, 278, 1178, 310, 278, 4148, 297, 3142, 883, 9995, 13, 4706, 736, 1583, 29889, 2271, 13, 13, 1678, 822, 756, 29918, 23031, 29918, 3827, 29898, 1311, 29892, 4148, 1125, 13, 4706, 9995, 6811, 29899, 2429, 1145, 297, 9959, 13720, 29889, 29849, 3639, 7700, 9995, 13, 4706, 396, 1939, 16248, 2367, 502, 1101, 2009, 3618, 13, 4706, 396, 7753, 565, 591, 12354, 2750, 1009, 297, 1884, 29892, 591, 29915, 645, 679, 1250, 263, 1051, 310, 11803, 13, 4706, 396, 450, 8671, 723, 367, 304, 3013, 5702, 310, 714, 17696, 1101, 7274, 13, 4706, 736, 7700, 13, 13, 1678, 822, 679, 29918, 262, 1884, 29898, 1311, 1125, 13, 4706, 9995, 402, 1691, 278, 3988, 310, 278, 13189, 943, 297, 1884, 29889, 9995, 13, 13, 4706, 736, 1583, 29889, 2271, 29889, 17010, 11974, 1159, 718, 5591, 262, 1884, 12975, 13, 13, 1678, 822, 408, 29918, 3126, 29898, 1311, 1125, 13, 4706, 9995, 12354, 4663, 8954, 310, 4148, 13, 4706, 9995, 13, 13, 4706, 4390, 29918, 1272, 353, 426, 13, 9651, 376, 1853, 1115, 376, 8921, 613, 13, 9651, 376, 333, 1115, 1583, 29889, 2271, 29892, 13, 9651, 376, 3069, 1115, 1583, 29889, 3069, 29892, 13, 9651, 376, 4990, 1170, 1115, 1583, 29889, 4990, 1170, 29892, 13, 9651, 376, 2271, 1115, 1583, 29889, 2271, 29892, 13, 9651, 376, 3292, 1115, 1583, 29889, 3292, 5983, 29892, 13, 9651, 376, 10185, 2940, 1115, 1583, 29889, 10185, 2940, 5983, 13, 4706, 500, 13, 4706, 736, 4390, 29918, 1272, 13, 13, 1678, 822, 2767, 29918, 2541, 29918, 3126, 29898, 1311, 29892, 848, 1125, 13, 4706, 14550, 13, 9651, 3462, 470, 2767, 13361, 1904, 848, 13, 9651, 14302, 304, 4337, 1244, 515, 19725, 29889, 2272, 2861, 304, 1053, 4436, 13, 4706, 14550, 13, 4706, 1018, 29901, 13, 9651, 565, 848, 29889, 657, 703, 4990, 1170, 29908, 1125, 13, 18884, 1583, 29889, 4990, 1170, 353, 848, 1839, 4990, 1170, 2033, 13, 9651, 565, 848, 29889, 657, 877, 3069, 29374, 13, 18884, 1583, 29889, 3069, 353, 848, 1839, 3069, 2033, 13, 9651, 565, 848, 29889, 657, 703, 3292, 29908, 1125, 13, 18884, 1583, 29889, 3292, 5983, 353, 848, 1839, 3292, 2033, 13, 9651, 565, 848, 29889, 657, 703, 10185, 2940, 29908, 1125, 13, 18884, 1583, 29889, 10185, 2940, 5983, 353, 848, 1839, 10185, 2940, 2033, 13, 9651, 1583, 29889, 7620, 580, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 13, 1678, 822, 701, 29918, 517, 29918, 1256, 29898, 1311, 1125, 13, 4706, 9995, 5399, 29879, 565, 278, 4148, 848, 338, 5279, 701, 437, 2635, 29889, 16969, 1565, 565, 2845, 278, 29871, 13, 9651, 848, 338, 2337, 19949, 701, 29899, 517, 29899, 1256, 470, 565, 278, 848, 471, 10325, 11086, 287, 13, 4706, 9995, 13, 13, 4706, 4046, 353, 29431, 29889, 3707, 580, 29899, 12673, 29889, 9346, 287, 2554, 29898, 23128, 29922, 29953, 29897, 29871, 396, 29871, 29953, 6923, 8020, 13, 4706, 471, 29918, 276, 1760, 29918, 5504, 353, 1583, 3032, 4230, 29918, 21402, 1405, 4046, 13, 13, 4706, 396, 736, 1565, 565, 2337, 701, 29899, 517, 29899, 1256, 470, 565, 925, 4784, 13, 4706, 736, 1583, 3032, 21936, 29918, 786, 29918, 517, 29918, 1256, 470, 471, 29918, 276, 1760, 29918, 5504, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 285, 29908, 13720, 29901, 426, 1311, 29889, 2271, 5038, 13, 13, 13, 1990, 9959, 13720, 29898, 13720, 1125, 13, 1678, 14550, 9959, 13720, 1904, 607, 11524, 385, 4148, 17791, 373, 278, 1887, 1923, 29889, 13, 13, 1678, 3139, 15717, 17791, 373, 278, 1887, 1923, 674, 367, 6087, 408, 263, 9959, 13720, 2777, 29889, 910, 770, 975, 24040, 13, 1678, 3519, 3342, 297, 13361, 304, 3867, 901, 8543, 29892, 1887, 2130, 313, 1217, 3450, 29897, 304, 4148, 848, 29889, 13, 13, 1678, 9959, 13720, 1904, 29901, 13, 4706, 1404, 18884, 13361, 29915, 29879, 6590, 15337, 4911, 313, 726, 29897, 13, 4706, 8952, 9651, 13361, 29915, 29879, 8952, 313, 726, 29897, 13, 4706, 2479, 1170, 308, 13361, 29915, 29879, 2479, 1170, 313, 726, 29897, 13, 4706, 18546, 5983, 965, 13361, 29915, 29879, 18546, 3142, 313, 726, 29897, 13, 4706, 8722, 2940, 5983, 268, 13361, 29915, 29879, 8722, 1967, 3142, 313, 726, 29897, 13, 13, 4706, 11803, 1669, 4918, 29879, 2825, 491, 278, 4148, 13, 4706, 4477, 632, 10306, 414, 310, 278, 4148, 313, 7196, 310, 10306, 3618, 29897, 13, 13, 4706, 5121, 29918, 24830, 268, 13189, 943, 1058, 505, 13877, 304, 1101, 4148, 313, 7196, 310, 9959, 13720, 3618, 29897, 13, 4706, 297, 1884, 29918, 14080, 308, 4918, 29879, 2665, 304, 278, 297, 1884, 310, 278, 4148, 13, 1678, 14550, 13, 13, 1678, 1404, 353, 4733, 29889, 6716, 1762, 6716, 3073, 29898, 2659, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29897, 13, 1678, 8952, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 20785, 29918, 12648, 1307, 29940, 29892, 5412, 29922, 5574, 29892, 9654, 29922, 8824, 29897, 13, 13, 1678, 1101, 29918, 24830, 353, 4733, 29889, 14804, 1762, 14804, 3073, 877, 13720, 742, 4475, 29918, 978, 543, 18616, 29918, 23031, 29918, 24830, 1159, 13, 1678, 297, 1884, 29918, 14080, 353, 4733, 29889, 14804, 1762, 14804, 3073, 877, 797, 1884, 6747, 1495, 13, 13, 1678, 822, 338, 29918, 23031, 292, 29898, 1311, 29892, 4148, 29901, 13361, 1125, 13, 4706, 9995, 16969, 1565, 565, 1583, 338, 1494, 4148, 29892, 2089, 6467, 29889, 9995, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 23031, 292, 29889, 657, 29898, 3318, 29922, 8921, 29897, 13, 9651, 736, 5852, 13, 4706, 5174, 10306, 29889, 25125, 3664, 1252, 391, 29901, 13, 9651, 736, 7700, 13, 13, 1678, 822, 756, 29918, 23031, 261, 29898, 1311, 29892, 4148, 29901, 13361, 1125, 13, 4706, 9995, 16969, 1565, 565, 4148, 338, 263, 1101, 261, 310, 1583, 29892, 2089, 6467, 29889, 9995, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 23031, 29879, 29889, 657, 29898, 7168, 29922, 8921, 29897, 13, 9651, 736, 5852, 13, 4706, 5174, 10306, 29889, 25125, 3664, 1252, 391, 29901, 13, 9651, 736, 7700, 13, 13, 1678, 822, 756, 29918, 18326, 29898, 1311, 29892, 4148, 29901, 13361, 1125, 13, 4706, 9995, 16969, 1565, 565, 4148, 338, 263, 5121, 310, 1583, 29892, 2089, 6467, 29889, 9995, 13, 13, 4706, 736, 10306, 29889, 598, 29918, 7932, 1975, 29898, 1311, 29892, 4148, 29897, 13, 13, 1678, 822, 756, 29918, 23031, 29918, 3827, 29898, 1311, 29892, 4148, 29901, 13361, 1125, 13, 4706, 9995, 16969, 1565, 565, 1583, 756, 263, 1101, 2009, 515, 4148, 29892, 2089, 6467, 29889, 9995, 13, 13, 4706, 736, 1583, 29889, 23031, 29918, 24830, 29889, 4572, 29898, 333, 29922, 8921, 29889, 333, 467, 9933, 580, 13, 13, 1678, 822, 4386, 29918, 23031, 29918, 3827, 29898, 1311, 29892, 4148, 29901, 13361, 29892, 3544, 29901, 6120, 1125, 13, 4706, 9995, 5240, 586, 267, 4148, 515, 1101, 7274, 313, 361, 4864, 29897, 322, 3770, 1960, 278, 2009, 29889, 960, 3544, 338, 29871, 13, 9651, 1565, 29892, 896, 526, 2715, 408, 263, 1101, 261, 310, 1583, 29889, 29871, 13, 4706, 9995, 13, 13, 4706, 2346, 29918, 2914, 353, 1583, 29889, 23031, 29918, 24830, 29889, 4572, 29898, 333, 29922, 8921, 29889, 333, 29897, 13, 4706, 565, 2346, 29918, 2914, 29889, 9933, 7295, 13, 9651, 1583, 29889, 23031, 29918, 24830, 29889, 5992, 29898, 1972, 29918, 2914, 29889, 4102, 3101, 13, 13, 4706, 565, 3544, 1275, 5852, 29901, 13, 9651, 1583, 29889, 23031, 29879, 29889, 657, 29918, 272, 29918, 3258, 29898, 7168, 29922, 8921, 29897, 13, 13, 1678, 822, 679, 29918, 23031, 414, 29898, 1311, 1125, 13, 4706, 9995, 402, 1691, 278, 13189, 943, 1058, 526, 1101, 414, 310, 1583, 29889, 9995, 13, 13, 4706, 4477, 353, 1583, 29889, 23031, 29879, 29889, 497, 580, 13, 4706, 1101, 414, 353, 518, 29888, 29889, 7168, 363, 285, 297, 4477, 29962, 13, 4706, 736, 1101, 414, 13, 13, 1678, 822, 679, 29918, 7932, 1975, 29898, 1311, 1125, 13, 4706, 9995, 402, 1691, 278, 13189, 943, 1058, 526, 7875, 310, 1583, 29889, 9995, 13, 13, 4706, 4477, 353, 1583, 29889, 23031, 29879, 29889, 497, 580, 13, 4706, 7875, 353, 518, 29888, 29889, 7168, 363, 285, 297, 4477, 565, 1583, 29889, 5349, 29918, 18326, 29898, 29888, 29889, 7168, 4638, 13, 4706, 736, 7875, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 4990, 1170, 13, 13, 1678, 822, 4078, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1583, 3032, 21936, 29918, 786, 29918, 517, 29918, 1256, 353, 5852, 13, 4706, 2428, 2141, 7620, 10456, 5085, 29892, 3579, 19290, 29897, 29871, 396, 8251, 278, 376, 6370, 29908, 4078, 580, 1158, 29889, 13, 4706, 1583, 3032, 842, 29918, 2271, 580, 13, 13, 1678, 822, 903, 842, 29918, 2271, 29898, 1311, 1125, 13, 4706, 9995, 317, 1691, 278, 3988, 310, 278, 4148, 304, 367, 376, 1124, 597, 29912, 20832, 6822, 29912, 8787, 29918, 15094, 25634, 6822, 8921, 19248, 1311, 29889, 333, 5038, 565, 697, 471, 451, 731, 746, 2825, 29889, 910, 29871, 13, 9651, 6166, 278, 3988, 5352, 310, 599, 1887, 15717, 29889, 13, 4706, 9995, 13, 4706, 396, 17129, 29892, 2045, 597, 2417, 29889, 510, 29914, 7193, 29914, 29896, 29900, 29946, 29906, 29946, 29906, 29946, 29946, 29914, 695, 935, 29892, 376, 29928, 5364, 448, 1128, 304, 679, 1583, 29889, 333, 746, 14238, 263, 716, 1203, 29973, 613, 13, 4706, 396, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29906, 29899, 29896, 29929, 29892, 2045, 597, 2417, 29889, 510, 29914, 29874, 29914, 29953, 29953, 29906, 29955, 29896, 29946, 29946, 29945, 29892, 19178, 6770, 29899, 8132, 29871, 29946, 29889, 29900, 13, 4706, 3142, 353, 285, 29908, 29912, 8787, 29918, 25416, 6822, 8921, 19248, 1311, 29889, 333, 5038, 13, 4706, 3495, 353, 285, 29908, 29912, 8787, 29918, 25416, 6822, 29908, 13, 4706, 565, 1583, 29889, 2271, 2804, 3142, 470, 1583, 29889, 3069, 2804, 3495, 29901, 13, 9651, 13361, 29889, 12650, 29889, 4572, 29898, 333, 29922, 1311, 29889, 333, 467, 5504, 29898, 2271, 29922, 2271, 29892, 3495, 29922, 3069, 29897, 13, 2 ]
reports/migrations/0005_moneyback_payment_system.py
Igorishe/Report_Traker
0
147191
<filename>reports/migrations/0005_moneyback_payment_system.py<gh_stars>0 # Generated by Django 3.2.3 on 2021-09-13 09:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('reports', '0004_alter_moneyback_wallet'), ] operations = [ migrations.AddField( model_name='moneyback', name='payment_system', field=models.CharField(choices=[('Bitcoin', 'Bitcoin'), ('Ethereum', 'Ethereum'), ('WebMoney', 'Webmoney'), ('Qiwi', 'Qiwi')], default='Bitcoin', max_length=20, verbose_name='Платежная система'), ), ]
[ 1, 529, 9507, 29958, 276, 4011, 29914, 26983, 800, 29914, 29900, 29900, 29900, 29945, 29918, 29885, 4992, 1627, 29918, 27825, 29918, 5205, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 3251, 630, 491, 15337, 29871, 29941, 29889, 29906, 29889, 29941, 373, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29929, 29899, 29896, 29941, 29871, 29900, 29929, 29901, 29945, 29946, 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, 276, 4011, 742, 525, 29900, 29900, 29900, 29946, 29918, 13794, 29918, 29885, 4992, 1627, 29918, 14625, 1026, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 29885, 4992, 1627, 742, 13, 9651, 1024, 2433, 27825, 29918, 5205, 742, 13, 9651, 1746, 29922, 9794, 29889, 27890, 29898, 1859, 1575, 11759, 877, 21591, 1111, 262, 742, 525, 21591, 1111, 262, 5477, 6702, 29923, 12711, 398, 742, 525, 29923, 12711, 398, 5477, 6702, 3609, 29924, 4992, 742, 525, 3609, 29885, 4992, 5477, 6702, 29984, 29875, 4353, 742, 525, 29984, 29875, 4353, 1495, 1402, 2322, 2433, 21591, 1111, 262, 742, 4236, 29918, 2848, 29922, 29906, 29900, 29892, 26952, 29918, 978, 2433, 30013, 684, 730, 29998, 3162, 29184, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
Spark/spark_media_CP.py
Dielam/Dielam.github.io
0
1612011
<filename>Spark/spark_media_CP.py #!/usr/bin/python #<NAME> from pyspark import SparkConf, SparkContext from shutil import rmtree import string import sys import os import os.path as path if path.exists("output"): rmtree("output") if len(sys.argv) <= 1: print("Error. No ha introducido Codigo Postal.") else: if len(sys.argv[1]) > 5: print("Error. No ha introducido un Codigo Postal correcto.") else: #Spark configuration conf = SparkConf().setAppName('AveragePriceCP') sc = SparkContext(conf=conf) RDDvar = sc.textFile("Gasolineras.csv") wanted = sys.argv[1] # CP = [6] decode = RDDvar.map(lambda line: line.encode("ascii", "ignore")) text = decode.filter(lambda line: wanted == line.split(',')[6]) # precio_gasolina_95 = [11] data = text.filter(lambda line: str(line.split(',')[11]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_gasolina_95.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[11]))) #map (CP, precio_gasolina_95) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_gasolina_95.txt") # precio_gasoleo_a = [12] data = text.filter(lambda line: str(line.split(',')[12]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_gasoleo_a.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[12]))) #map (CP, precio_gasoleo_a) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_gasoleo_a.txt") # precio_gasoleo_b = [13] data = text.filter(lambda line: str(line.split(',')[13]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_gasoleo_b.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[13]))) #map (CP, precio_gasoleo_b) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_gasoleo_b.txt") # precio_bioetanol = [14] data = text.filter(lambda line: str(line.split(',')[14]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_bioetanol.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[14]))) #map (CP, precio_bioetanol) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_bioetanol.txt") # precio_nuevo_gasoleo_a = [15] data = text.filter(lambda line: str(line.split(',')[15]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_nuevo_gasoleo_a.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[15]))) #map (CP, precio_nuevo_gasoleo_a) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_nuevo_gasoleo_a.txt") # precio_biodiesel = [16] data = text.filter(lambda line: str(line.split(',')[16]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_biodiesel.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[16]))) #map (CP, precio_biodiesel) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_biodiesel.txt") # f__ester_metilico = [17] data = text.filter(lambda line: str(line.split(',')[17]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_eter_metilico.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[17]))) #map (CP, precio_ester_metilico) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_ester_metilico.txt") # f__bioalcohol = [18] data = text.filter(lambda line: str(line.split(',')[18]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_bioalcohol.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[18]))) #map (CP, bioalcohol) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_bioalcohol.txt") # precio_gasolina_98 = [19] data = text.filter(lambda line: str(line.split(',')[19]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_gasolina_98.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[19]))) #map (CP, precio_gasolina_98) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_gasolina_98.txt") # precio_gas_natural_comprimido = [20] data = text.filter(lambda line: str(line.split(',')[20]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_gas_natural_comprimido.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[20]))) #map (CP, precio_gas_natural_comprimido) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_gas_natural_comprimido.txt") # precio_gas_natural_licuado = [21] data = text.filter(lambda line: str(line.split(',')[21]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_gas_natural_licuado.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[21]))) #map (CP, precio_gas_natural_licuado) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_gas_natural_licuado.txt") # precio_gases_licuados_del_petr = [22] data = text.filter(lambda line: str(line.split(',')[22]) != '') if data.isEmpty(): result = sc.parallelize("0") result.saveAsTextFile("output/media_cp_gases_licuados_del_petr.txt") else: precio = data.map(lambda line: (int(line.split(',')[6]),float(line.split(',')[22]))) #map (CP, precio_gases_licuados_del_petr) count = data.map(lambda line: (int(line.split(',')[6]), 1)) #map (CP, contador) aggreg1 = precio.reduceByKey(lambda a, b: a+b) aggreg2 = count.reduceByKey(lambda a, b: a+b) union = aggreg1.join(aggreg2) result = union.map(lambda line: (line[1][0]/line[1][1])) result.saveAsTextFile("output/media_cp_gases_licuados_del_petr.txt")
[ 1, 529, 9507, 29958, 29903, 6378, 29914, 12597, 29918, 9799, 29918, 6271, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 13, 29937, 29966, 5813, 29958, 13, 13, 3166, 282, 952, 6378, 1053, 20814, 16376, 29892, 20814, 2677, 13, 3166, 528, 4422, 1053, 364, 4378, 929, 13, 5215, 1347, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 2897, 29889, 2084, 408, 2224, 13, 13, 361, 2224, 29889, 9933, 703, 4905, 29908, 1125, 13, 1678, 364, 4378, 929, 703, 4905, 1159, 13, 13, 361, 7431, 29898, 9675, 29889, 19218, 29897, 5277, 29871, 29896, 29901, 13, 1678, 1596, 703, 2392, 29889, 1939, 447, 4547, 13321, 315, 397, 5973, 4918, 284, 23157, 13, 2870, 29901, 13, 1678, 565, 7431, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 1405, 29871, 29945, 29901, 13, 4706, 1596, 703, 2392, 29889, 1939, 447, 4547, 13321, 443, 315, 397, 5973, 4918, 284, 1959, 29877, 23157, 13, 1678, 1683, 29901, 13, 4706, 396, 29903, 6378, 5285, 13, 4706, 1970, 353, 20814, 16376, 2141, 842, 2052, 1170, 877, 29909, 19698, 13026, 6271, 1495, 13, 4706, 885, 353, 20814, 2677, 29898, 5527, 29922, 5527, 29897, 13, 13, 4706, 390, 7858, 1707, 353, 885, 29889, 726, 2283, 703, 29954, 294, 324, 4983, 294, 29889, 7638, 1159, 13, 4706, 5131, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 13, 4706, 396, 28505, 353, 518, 29953, 29962, 13, 4706, 21822, 353, 390, 7858, 1707, 29889, 1958, 29898, 2892, 1196, 29901, 1196, 29889, 12508, 703, 294, 18869, 613, 376, 17281, 5783, 13, 4706, 1426, 353, 21822, 29889, 4572, 29898, 2892, 1196, 29901, 5131, 1275, 1196, 29889, 5451, 29317, 29861, 29953, 2314, 13, 13, 4706, 396, 758, 3934, 29918, 25496, 324, 1099, 29918, 29929, 29945, 353, 518, 29896, 29896, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29896, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 324, 1099, 29918, 29929, 29945, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29896, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 25496, 324, 1099, 29918, 29929, 29945, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 324, 1099, 29918, 29929, 29945, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 25496, 1772, 29877, 29918, 29874, 353, 518, 29896, 29906, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29906, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 1772, 29877, 29918, 29874, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29906, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 25496, 1772, 29877, 29918, 29874, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 1772, 29877, 29918, 29874, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 25496, 1772, 29877, 29918, 29890, 353, 518, 29896, 29941, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29941, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 1772, 29877, 29918, 29890, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29941, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 25496, 1772, 29877, 29918, 29890, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 1772, 29877, 29918, 29890, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 24840, 300, 273, 324, 353, 518, 29896, 29946, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29946, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 24840, 300, 273, 324, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29946, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 24840, 300, 273, 324, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 24840, 300, 273, 324, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 29876, 434, 1365, 29918, 25496, 1772, 29877, 29918, 29874, 353, 518, 29896, 29945, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29945, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 29876, 434, 1365, 29918, 25496, 1772, 29877, 29918, 29874, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29945, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 29876, 434, 1365, 29918, 25496, 1772, 29877, 29918, 29874, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 29876, 434, 1365, 29918, 25496, 1772, 29877, 29918, 29874, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 29890, 2660, 583, 295, 353, 518, 29896, 29953, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29953, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 29890, 2660, 583, 295, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29953, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 29890, 2660, 583, 295, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 29890, 2660, 583, 295, 29889, 3945, 1159, 13, 4706, 396, 285, 1649, 4156, 29918, 2527, 309, 1417, 353, 518, 29896, 29955, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29955, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 1308, 29918, 2527, 309, 1417, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29955, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 4156, 29918, 2527, 309, 1417, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 4156, 29918, 2527, 309, 1417, 29889, 3945, 1159, 13, 4706, 396, 285, 1649, 24840, 284, 1111, 5391, 353, 518, 29896, 29947, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29947, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 24840, 284, 1111, 5391, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29947, 29962, 4961, 396, 1958, 313, 6271, 29892, 17799, 284, 1111, 5391, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 24840, 284, 1111, 5391, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 25496, 324, 1099, 29918, 29929, 29947, 353, 518, 29896, 29929, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29929, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 324, 1099, 29918, 29929, 29947, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29896, 29929, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 25496, 324, 1099, 29918, 29929, 29947, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 324, 1099, 29918, 29929, 29947, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 25496, 29918, 25047, 29918, 510, 9469, 1941, 353, 518, 29906, 29900, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29906, 29900, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 29918, 25047, 29918, 510, 9469, 1941, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29906, 29900, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 25496, 29918, 25047, 29918, 510, 9469, 1941, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 29918, 25047, 29918, 510, 9469, 1941, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 25496, 29918, 25047, 29918, 506, 29884, 912, 353, 518, 29906, 29896, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29906, 29896, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 29918, 25047, 29918, 506, 29884, 912, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29906, 29896, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 25496, 29918, 25047, 29918, 506, 29884, 912, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 25496, 29918, 25047, 29918, 506, 29884, 912, 29889, 3945, 1159, 13, 4706, 396, 758, 3934, 29918, 29887, 2129, 29918, 506, 29884, 2255, 29918, 6144, 29918, 10963, 29878, 353, 518, 29906, 29906, 29962, 13, 4706, 848, 353, 1426, 29889, 4572, 29898, 2892, 1196, 29901, 851, 29898, 1220, 29889, 5451, 29317, 29861, 29906, 29906, 2314, 2804, 27255, 13, 4706, 565, 848, 29889, 24326, 7295, 13, 9651, 1121, 353, 885, 29889, 23482, 675, 703, 29900, 1159, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 29887, 2129, 29918, 506, 29884, 2255, 29918, 6144, 29918, 10963, 29878, 29889, 3945, 1159, 13, 4706, 1683, 29901, 13, 9651, 758, 3934, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 7411, 29898, 1220, 29889, 5451, 29317, 29861, 29906, 29906, 29962, 4961, 396, 1958, 313, 6271, 29892, 758, 3934, 29918, 29887, 2129, 29918, 506, 29884, 2255, 29918, 6144, 29918, 10963, 29878, 29897, 13, 9651, 2302, 353, 848, 29889, 1958, 29898, 2892, 1196, 29901, 313, 524, 29898, 1220, 29889, 5451, 29317, 29861, 29953, 11724, 29871, 29896, 876, 396, 1958, 313, 6271, 29892, 640, 3136, 29897, 13, 9651, 11404, 29896, 353, 758, 3934, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 11404, 29906, 353, 2302, 29889, 17469, 2059, 2558, 29898, 2892, 263, 29892, 289, 29901, 263, 29974, 29890, 29897, 13, 9651, 9833, 353, 11404, 29896, 29889, 7122, 29898, 26193, 29906, 29897, 13, 9651, 1121, 353, 9833, 29889, 1958, 29898, 2892, 1196, 29901, 313, 1220, 29961, 29896, 3816, 29900, 16261, 1220, 29961, 29896, 3816, 29896, 12622, 13, 13, 9651, 1121, 29889, 7620, 2887, 1626, 2283, 703, 4905, 29914, 9799, 29918, 6814, 29918, 29887, 2129, 29918, 506, 29884, 2255, 29918, 6144, 29918, 10963, 29878, 29889, 3945, 1159, 2 ]
core/data/collates/collate_functions.py
cjy97/LibFewShot
471
75806
# -*- coding: utf-8 -*- import itertools from collections import Iterable import torch class GeneralCollateFunction(object): """A Generic `Collate_fn`. For finetuning-train. """ def __init__(self, trfms, times): """Initialize a `GeneralCollateFunction`. Args: trfms (list): A list of torchvision transforms. times (int): Specify the augment times. (0 or 1 for not to augment) """ super(GeneralCollateFunction, self).__init__() self.trfms = trfms self.times = times def method(self, batch): """Apply transforms and augmentations on a batch. The images and targets in a batch are augmented by the number of `self.times` and the targets are augmented to match the shape of images. Args: batch (list of tuple): A batch returned by dataset. Returns: tuple: A tuple of (images, targets), here len(images)=len(targets). """ try: images, targets = zip(*batch) images = list(itertools.chain.from_iterable([[image] * self.times for image in images])) images = [self.trfms(image).unsqueeze(0) for image in images] targets = list( itertools.chain.from_iterable([[target] * self.times for target in targets]) ) targets = [torch.tensor([target]) for target in targets] assert len(images) == len(targets), "Inconsistent number of images and labels!" images = torch.cat(images) targets = torch.tensor(targets, dtype=torch.int64) return images, targets except TypeError: raise TypeError( "Error, probably because the transforms are passed to the dataset, the transforms should be " "passed to the collate_fn" ) def __call__(self, batch): return self.method(batch) class FewShotAugCollateFunction(object): """`Collate_fn` for few-shot dataloader. For finetuning-val, finetuning-test and meta/metric-train/val/test. """ def __init__(self, trfms, times, times_q, way_num, shot_num, query_num, episode_size): """Initialize a `FewShotAugCollateFunction`. Args: trfms (list or tuple of list): A torchvision transfrom list of a tuple of 2 torchvision transform list. if `list`, both support and query images will be applied the same transforms, otherwise the 1st one will apply to support images and the 2nd one will apply to query images. times (int): Augment times of support iamges times_q (int ): Augment times of query images way_num (int): Few-shot way setting shot_num (int): Few-shot shot setting query_num (int): Few-shot query setting episode_size (int): Few-shot episode size setting """ super(FewShotAugCollateFunction, self).__init__() try: self.trfms_support, self.trfms_query = trfms except Exception: self.trfms_support = self.trfms_query = trfms # Allow different trfms: when single T, apply to S and Q equally; # When trfms=(T,T), apply to S and Q separately; self.times = 1 if times == 0 else times self.times_q = 1 if times_q == 0 else times_q self.way_num = way_num self.shot_num = shot_num self.query_num = query_num self.shot_aug = self.shot_num * self.times self.query_aug = self.query_num * self.times_q self.episode_size = episode_size def method(self, batch): """Apply transforms and augmentations on a **few-shot** batch. The samples of query and support are augmented separately. For example: if aug_times=5, then 01234 -> 0000011111222223333344444. Args: batch (list of tuple): A batch returned by a few-shot dataset. Returns: tuple: a tuple of (images, gt_labels). """ try: images, labels = zip( *batch ) # images = [img_label_tuple[0] for img_label_tuple in batch] # 111111222222 (5s1q for example) images_split_by_label = [ images[index : index + self.shot_num + self.query_num] for index in range(0, len(images), self.shot_num + self.query_num) ] # 111111; 222222 ; images_split_by_label_type = [ [spt_qry[: self.shot_num], spt_qry[self.shot_num :]] for spt_qry in images_split_by_label ] # 11111,1;22222,2; == [shot, query] # aug support # fixme: should have a elegant method # 1111111111,1;2222222222,2 (aug_time = 2 for example) for cls in images_split_by_label_type: cls[0] = cls[0] * self.times # aug support cls[1] = cls[1] * self.times_q # aug query # flatten and apply trfms flat = lambda t: [x for sub in t for x in flat(sub)] if isinstance(t, Iterable) else [t] images = flat(images_split_by_label_type) # 1111111111122222222222 # images = [self.trfms(image) for image in images] # list of tensors([c, h, w]) images = [ self.trfms_support(image) if index % (self.shot_aug + self.query_aug) < self.shot_aug else self.trfms_query(image) for index, image in enumerate(images) ] # list of tensors([c, h, w]) images = torch.stack(images) # [b', c, h, w] <- b' = b after aug # labels # global_labels = torch.tensor(labels,dtype=torch.int64) # global_labels = torch.tensor(labels,dtype=torch.int64).reshape(self.episode_size,self.way_num, # self.shot_num*self.times+self.query_num) global_labels = torch.tensor(labels, dtype=torch.int64).reshape( self.episode_size, self.way_num, self.shot_num + self.query_num ) global_labels = ( global_labels[..., 0] .unsqueeze(-1) .repeat( 1, 1, self.shot_num * self.times + self.query_num * self.times_q, ) ) return images, global_labels # images.shape = [e*w*(q+s) x c x h x w], global_labels.shape = [e x w x (q+s)] except TypeError: raise TypeError( "Error, probably because the transforms are passed to the dataset, the transforms should be " "passed to the collate_fn" ) def __call__(self, batch): return self.method(batch)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 4256, 8504, 13, 3166, 16250, 1053, 20504, 519, 13, 13, 5215, 4842, 305, 13, 13, 13, 1990, 4593, 1625, 9632, 6678, 29898, 3318, 1125, 13, 1678, 9995, 29909, 3251, 293, 421, 1625, 9632, 29918, 9144, 1412, 13, 13, 1678, 1152, 1436, 300, 27964, 29899, 14968, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 534, 29888, 1516, 29892, 3064, 1125, 13, 4706, 9995, 6644, 6646, 263, 421, 15263, 1625, 9632, 6678, 1412, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 534, 29888, 1516, 313, 1761, 1125, 319, 1051, 310, 4842, 305, 4924, 4327, 29879, 29889, 13, 9651, 3064, 313, 524, 1125, 12048, 1598, 278, 18765, 3064, 29889, 313, 29900, 470, 29871, 29896, 363, 451, 304, 18765, 29897, 13, 4706, 9995, 13, 4706, 2428, 29898, 15263, 1625, 9632, 6678, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 509, 29888, 1516, 353, 534, 29888, 1516, 13, 4706, 1583, 29889, 3706, 353, 3064, 13, 13, 1678, 822, 1158, 29898, 1311, 29892, 9853, 1125, 13, 4706, 9995, 2052, 368, 4327, 29879, 322, 18765, 800, 373, 263, 9853, 29889, 13, 13, 4706, 450, 4558, 322, 22525, 297, 263, 9853, 526, 18765, 287, 491, 278, 1353, 310, 421, 1311, 29889, 3706, 29952, 322, 278, 22525, 526, 18765, 287, 13, 4706, 304, 1993, 278, 8267, 310, 4558, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 9853, 313, 1761, 310, 18761, 1125, 319, 9853, 4133, 491, 8783, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 18761, 29901, 319, 18761, 310, 313, 8346, 29892, 22525, 511, 1244, 7431, 29898, 8346, 3892, 2435, 29898, 5182, 29879, 467, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 4558, 29892, 22525, 353, 14319, 10456, 16175, 29897, 13, 13, 9651, 4558, 353, 1051, 29898, 1524, 8504, 29889, 14153, 29889, 3166, 29918, 1524, 519, 4197, 29961, 3027, 29962, 334, 1583, 29889, 3706, 363, 1967, 297, 4558, 12622, 13, 9651, 4558, 353, 518, 1311, 29889, 509, 29888, 1516, 29898, 3027, 467, 6948, 802, 29872, 911, 29898, 29900, 29897, 363, 1967, 297, 4558, 29962, 13, 13, 9651, 22525, 353, 1051, 29898, 13, 18884, 4256, 8504, 29889, 14153, 29889, 3166, 29918, 1524, 519, 4197, 29961, 5182, 29962, 334, 1583, 29889, 3706, 363, 3646, 297, 22525, 2314, 13, 9651, 1723, 13, 9651, 22525, 353, 518, 7345, 305, 29889, 20158, 4197, 5182, 2314, 363, 3646, 297, 22525, 29962, 13, 13, 9651, 4974, 7431, 29898, 8346, 29897, 1275, 7431, 29898, 5182, 29879, 511, 376, 797, 3200, 9696, 1353, 310, 4558, 322, 11073, 3850, 13, 13, 9651, 4558, 353, 4842, 305, 29889, 4117, 29898, 8346, 29897, 13, 13, 9651, 22525, 353, 4842, 305, 29889, 20158, 29898, 5182, 29879, 29892, 26688, 29922, 7345, 305, 29889, 524, 29953, 29946, 29897, 13, 13, 9651, 736, 4558, 29892, 22525, 13, 4706, 5174, 20948, 29901, 13, 9651, 12020, 20948, 29898, 13, 18884, 376, 2392, 29892, 3117, 1363, 278, 4327, 29879, 526, 4502, 304, 278, 8783, 29892, 278, 4327, 29879, 881, 367, 376, 13, 18884, 376, 3364, 287, 304, 278, 5321, 403, 29918, 9144, 29908, 13, 9651, 1723, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 9853, 1125, 13, 4706, 736, 1583, 29889, 5696, 29898, 16175, 29897, 13, 13, 13, 1990, 383, 809, 2713, 327, 29909, 688, 1625, 9632, 6678, 29898, 3318, 1125, 13, 1678, 5124, 6937, 1625, 9632, 29918, 9144, 29952, 363, 2846, 29899, 8962, 1418, 7003, 1664, 29889, 13, 13, 1678, 1152, 1436, 300, 27964, 29899, 791, 29892, 1436, 300, 27964, 29899, 1688, 322, 12700, 29914, 16414, 29899, 14968, 29914, 791, 29914, 1688, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 534, 29888, 1516, 29892, 3064, 29892, 3064, 29918, 29939, 29892, 982, 29918, 1949, 29892, 10322, 29918, 1949, 29892, 2346, 29918, 1949, 29892, 12720, 29918, 2311, 1125, 13, 4706, 9995, 6644, 6646, 263, 421, 29943, 809, 2713, 327, 29909, 688, 1625, 9632, 6678, 1412, 13, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 534, 29888, 1516, 313, 1761, 470, 18761, 310, 1051, 1125, 319, 4842, 305, 4924, 1301, 3166, 1051, 310, 263, 18761, 310, 29871, 29906, 4842, 305, 4924, 4327, 1051, 29889, 13, 9651, 565, 29871, 421, 1761, 1673, 1716, 2304, 322, 2346, 4558, 674, 367, 7436, 278, 1021, 4327, 29879, 29892, 6467, 278, 29871, 29896, 303, 697, 674, 13, 9651, 3394, 304, 2304, 4558, 322, 278, 29871, 29906, 299, 697, 674, 3394, 304, 2346, 4558, 29889, 13, 9651, 3064, 313, 524, 1125, 22333, 358, 3064, 310, 2304, 474, 314, 2710, 13, 9651, 3064, 29918, 29939, 313, 524, 29871, 1125, 22333, 358, 3064, 310, 2346, 4558, 13, 9651, 982, 29918, 1949, 313, 524, 1125, 383, 809, 29899, 8962, 982, 4444, 13, 9651, 10322, 29918, 1949, 313, 524, 1125, 383, 809, 29899, 8962, 10322, 4444, 13, 9651, 2346, 29918, 1949, 313, 524, 1125, 383, 809, 29899, 8962, 2346, 4444, 13, 9651, 12720, 29918, 2311, 313, 524, 1125, 383, 809, 29899, 8962, 12720, 2159, 4444, 13, 4706, 9995, 13, 4706, 2428, 29898, 29943, 809, 2713, 327, 29909, 688, 1625, 9632, 6678, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 509, 29888, 1516, 29918, 5924, 29892, 1583, 29889, 509, 29888, 1516, 29918, 1972, 353, 534, 29888, 1516, 13, 4706, 5174, 8960, 29901, 13, 9651, 1583, 29889, 509, 29888, 1516, 29918, 5924, 353, 1583, 29889, 509, 29888, 1516, 29918, 1972, 353, 534, 29888, 1516, 13, 4706, 396, 29408, 1422, 534, 29888, 1516, 29901, 746, 2323, 323, 29892, 3394, 304, 317, 322, 660, 18018, 29936, 13, 4706, 396, 1932, 534, 29888, 1516, 7607, 29911, 29892, 29911, 511, 3394, 304, 317, 322, 660, 16949, 29936, 13, 4706, 1583, 29889, 3706, 353, 29871, 29896, 565, 3064, 1275, 29871, 29900, 1683, 3064, 13, 4706, 1583, 29889, 3706, 29918, 29939, 353, 29871, 29896, 565, 3064, 29918, 29939, 1275, 29871, 29900, 1683, 3064, 29918, 29939, 13, 4706, 1583, 29889, 1582, 29918, 1949, 353, 982, 29918, 1949, 13, 4706, 1583, 29889, 8962, 29918, 1949, 353, 10322, 29918, 1949, 13, 4706, 1583, 29889, 1972, 29918, 1949, 353, 2346, 29918, 1949, 13, 4706, 1583, 29889, 8962, 29918, 2987, 353, 1583, 29889, 8962, 29918, 1949, 334, 1583, 29889, 3706, 13, 4706, 1583, 29889, 1972, 29918, 2987, 353, 1583, 29889, 1972, 29918, 1949, 334, 1583, 29889, 3706, 29918, 29939, 13, 4706, 1583, 29889, 1022, 275, 356, 29918, 2311, 353, 12720, 29918, 2311, 13, 13, 1678, 822, 1158, 29898, 1311, 29892, 9853, 1125, 13, 4706, 9995, 2052, 368, 4327, 29879, 322, 18765, 800, 373, 263, 3579, 29888, 809, 29899, 8962, 1068, 9853, 29889, 13, 13, 4706, 450, 11916, 310, 2346, 322, 2304, 526, 18765, 287, 16949, 29889, 13, 4706, 1152, 1342, 29901, 565, 11307, 29918, 3706, 29922, 29945, 29892, 769, 29871, 29900, 29896, 29906, 29941, 29946, 1599, 29871, 29900, 29900, 29900, 29900, 29900, 29896, 29896, 29896, 29896, 29896, 29906, 29906, 29906, 29906, 29906, 29941, 29941, 29941, 29941, 29941, 29946, 29946, 29946, 29946, 29946, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 9853, 313, 1761, 310, 18761, 1125, 319, 9853, 4133, 491, 263, 2846, 29899, 8962, 8783, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 18761, 29901, 263, 18761, 310, 313, 8346, 29892, 330, 29873, 29918, 21134, 467, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 4558, 29892, 11073, 353, 14319, 29898, 13, 18884, 334, 16175, 13, 9651, 1723, 29871, 396, 4558, 353, 518, 2492, 29918, 1643, 29918, 23583, 29961, 29900, 29962, 363, 10153, 29918, 1643, 29918, 23583, 297, 9853, 29962, 29871, 396, 29871, 29896, 29896, 29896, 29896, 29896, 29896, 29906, 29906, 29906, 29906, 29906, 29906, 313, 29945, 29879, 29896, 29939, 363, 1342, 29897, 13, 9651, 4558, 29918, 5451, 29918, 1609, 29918, 1643, 353, 518, 13, 18884, 4558, 29961, 2248, 584, 2380, 718, 1583, 29889, 8962, 29918, 1949, 718, 1583, 29889, 1972, 29918, 1949, 29962, 13, 18884, 363, 2380, 297, 3464, 29898, 29900, 29892, 7431, 29898, 8346, 511, 1583, 29889, 8962, 29918, 1949, 718, 1583, 29889, 1972, 29918, 1949, 29897, 13, 9651, 4514, 29871, 396, 29871, 29896, 29896, 29896, 29896, 29896, 29896, 29936, 29871, 29906, 29906, 29906, 29906, 29906, 29906, 2056, 13, 9651, 4558, 29918, 5451, 29918, 1609, 29918, 1643, 29918, 1853, 353, 518, 13, 18884, 518, 29879, 415, 29918, 29939, 719, 7503, 1583, 29889, 8962, 29918, 1949, 1402, 269, 415, 29918, 29939, 719, 29961, 1311, 29889, 8962, 29918, 1949, 584, 5262, 13, 18884, 363, 269, 415, 29918, 29939, 719, 297, 4558, 29918, 5451, 29918, 1609, 29918, 1643, 13, 9651, 4514, 29871, 396, 29871, 29896, 29896, 29896, 29896, 29896, 29892, 29896, 29936, 29906, 29906, 29906, 29906, 29906, 29892, 29906, 29936, 29871, 1275, 518, 8962, 29892, 2346, 29962, 13, 9651, 396, 11307, 2304, 13, 9651, 396, 2329, 1004, 29901, 881, 505, 263, 19232, 1158, 13, 9651, 396, 29871, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29892, 29896, 29936, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29892, 29906, 313, 2987, 29918, 2230, 353, 29871, 29906, 363, 1342, 29897, 13, 9651, 363, 1067, 29879, 297, 4558, 29918, 5451, 29918, 1609, 29918, 1643, 29918, 1853, 29901, 13, 18884, 1067, 29879, 29961, 29900, 29962, 353, 1067, 29879, 29961, 29900, 29962, 334, 1583, 29889, 3706, 29871, 396, 11307, 2304, 13, 18884, 1067, 29879, 29961, 29896, 29962, 353, 1067, 29879, 29961, 29896, 29962, 334, 1583, 29889, 3706, 29918, 29939, 29871, 396, 11307, 2346, 13, 9651, 396, 1652, 8606, 322, 3394, 534, 29888, 1516, 13, 9651, 12151, 353, 14013, 260, 29901, 518, 29916, 363, 1014, 297, 260, 363, 921, 297, 12151, 29898, 1491, 4638, 565, 338, 8758, 29898, 29873, 29892, 20504, 519, 29897, 1683, 518, 29873, 29962, 13, 9651, 4558, 353, 12151, 29898, 8346, 29918, 5451, 29918, 1609, 29918, 1643, 29918, 1853, 29897, 13, 9651, 396, 29871, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 29906, 13, 9651, 396, 4558, 353, 518, 1311, 29889, 509, 29888, 1516, 29898, 3027, 29897, 363, 1967, 297, 4558, 29962, 29871, 396, 1051, 310, 25187, 943, 4197, 29883, 29892, 298, 29892, 281, 2314, 13, 9651, 4558, 353, 518, 13, 18884, 1583, 29889, 509, 29888, 1516, 29918, 5924, 29898, 3027, 29897, 13, 18884, 565, 2380, 1273, 313, 1311, 29889, 8962, 29918, 2987, 718, 1583, 29889, 1972, 29918, 2987, 29897, 529, 1583, 29889, 8962, 29918, 2987, 13, 18884, 1683, 1583, 29889, 509, 29888, 1516, 29918, 1972, 29898, 3027, 29897, 13, 18884, 363, 2380, 29892, 1967, 297, 26985, 29898, 8346, 29897, 13, 9651, 4514, 29871, 396, 1051, 310, 25187, 943, 4197, 29883, 29892, 298, 29892, 281, 2314, 13, 9651, 4558, 353, 4842, 305, 29889, 1429, 29898, 8346, 29897, 29871, 396, 518, 29890, 742, 274, 29892, 298, 29892, 281, 29962, 3705, 289, 29915, 353, 289, 1156, 11307, 13, 9651, 396, 11073, 13, 9651, 396, 5534, 29918, 21134, 353, 4842, 305, 29889, 20158, 29898, 21134, 29892, 29881, 1853, 29922, 7345, 305, 29889, 524, 29953, 29946, 29897, 13, 9651, 396, 5534, 29918, 21134, 353, 4842, 305, 29889, 20158, 29898, 21134, 29892, 29881, 1853, 29922, 7345, 305, 29889, 524, 29953, 29946, 467, 690, 14443, 29898, 1311, 29889, 1022, 275, 356, 29918, 2311, 29892, 1311, 29889, 1582, 29918, 1949, 29892, 13, 9651, 396, 1583, 29889, 8962, 29918, 1949, 29930, 1311, 29889, 3706, 29974, 1311, 29889, 1972, 29918, 1949, 29897, 13, 9651, 5534, 29918, 21134, 353, 4842, 305, 29889, 20158, 29898, 21134, 29892, 26688, 29922, 7345, 305, 29889, 524, 29953, 29946, 467, 690, 14443, 29898, 13, 18884, 1583, 29889, 1022, 275, 356, 29918, 2311, 29892, 1583, 29889, 1582, 29918, 1949, 29892, 1583, 29889, 8962, 29918, 1949, 718, 1583, 29889, 1972, 29918, 1949, 13, 9651, 1723, 13, 9651, 5534, 29918, 21134, 353, 313, 13, 18884, 5534, 29918, 21134, 29961, 16361, 29871, 29900, 29962, 13, 18884, 869, 6948, 802, 29872, 911, 6278, 29896, 29897, 13, 18884, 869, 14358, 29898, 13, 462, 268, 29896, 29892, 13, 462, 268, 29896, 29892, 13, 462, 1678, 1583, 29889, 8962, 29918, 1949, 334, 1583, 29889, 3706, 718, 1583, 29889, 1972, 29918, 1949, 334, 1583, 29889, 3706, 29918, 29939, 29892, 13, 18884, 1723, 13, 9651, 1723, 13, 9651, 736, 4558, 29892, 5534, 29918, 21134, 13, 9651, 396, 4558, 29889, 12181, 353, 518, 29872, 29930, 29893, 16395, 29939, 29974, 29879, 29897, 921, 274, 921, 298, 921, 281, 1402, 29871, 5534, 29918, 21134, 29889, 12181, 353, 518, 29872, 921, 281, 921, 313, 29939, 29974, 29879, 4638, 13, 4706, 5174, 20948, 29901, 13, 9651, 12020, 20948, 29898, 13, 18884, 376, 2392, 29892, 3117, 1363, 278, 4327, 29879, 526, 4502, 304, 278, 8783, 29892, 278, 4327, 29879, 881, 367, 376, 13, 18884, 376, 3364, 287, 304, 278, 5321, 403, 29918, 9144, 29908, 13, 9651, 1723, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 9853, 1125, 13, 4706, 736, 1583, 29889, 5696, 29898, 16175, 29897, 13, 2 ]
blog/context_processors/main_menu.py
evg-dev/pyblog
0
162756
from django.core.context_processors import request from blog.models import Category def menu(request): return {"category_menu": Category.objects.all(), }
[ 1, 515, 9557, 29889, 3221, 29889, 4703, 29918, 5014, 943, 1053, 2009, 13, 3166, 12618, 29889, 9794, 1053, 17943, 13, 13, 13, 1753, 6143, 29898, 3827, 1125, 13, 1678, 736, 8853, 7320, 29918, 6510, 1115, 17943, 29889, 12650, 29889, 497, 3285, 500, 13, 2 ]
tests/test_file_service/test_files_grouping_by_category.py
Masynchin/filogram
0
159409
from filogram import file_service def test_correct_files_grouping_by_category(create_unique_file): files = [] for category in ["books", "audio", "texts", "audio"]: file = create_unique_file(category=category) files.append(file) (book_file, audio_file, text_file, another_audio_file) = files files = sort_files_by_category(files) grouped_files = file_service.group_files_by_category(files) assert grouped_files == { "books": (book_file,), "texts": (text_file,), "audio": (audio_file, another_audio_file), } def sort_files_by_category(files): """Сортировка файлов по категории и уникальному ID. В основном коде сортировка файлов происходит при запросе к БД. Там они сортируются по категории, и если они совпадают, то по полю `unique_id`. Присвоить файлу во время создания поле `unique_id` нельзя, так как `FileModel` является дочерним классом NamedTuple. В данной функции `enumerate` используется в качестве замены поля `unique_id` """ files_sorted_by_category = sorted( enumerate(files), key=lambda pair: (pair[1].category, pair[0]) ) files_sorted_by_category = [file for (_, file) in files_sorted_by_category] return files_sorted_by_category def test_correct_owned_files_grouping_by_category( default_user, create_unique_file ): files = [] for category in ["books", "audio", "texts", "audio"]: file = create_unique_file(user=default_user, category=category) file_service.save_file(file) files.append(file) (book_file, audio_file, text_file, another_audio_file) = files owned_files = file_service.get_owned_files(default_user.id) grouped_files = file_service.group_files_by_category(owned_files) assert grouped_files == { "books": (book_file,), "texts": (text_file,), "audio": (audio_file, another_audio_file), }
[ 1, 515, 977, 13342, 1053, 934, 29918, 5509, 13, 13, 13, 1753, 1243, 29918, 15728, 29918, 5325, 29918, 2972, 292, 29918, 1609, 29918, 7320, 29898, 3258, 29918, 13092, 29918, 1445, 1125, 13, 1678, 2066, 353, 5159, 13, 1678, 363, 7663, 297, 6796, 12733, 613, 376, 18494, 613, 376, 726, 29879, 613, 376, 18494, 3108, 29901, 13, 4706, 934, 353, 1653, 29918, 13092, 29918, 1445, 29898, 7320, 29922, 7320, 29897, 13, 4706, 2066, 29889, 4397, 29898, 1445, 29897, 13, 13, 1678, 313, 2909, 29918, 1445, 29892, 10348, 29918, 1445, 29892, 1426, 29918, 1445, 29892, 1790, 29918, 18494, 29918, 1445, 29897, 353, 2066, 13, 1678, 2066, 353, 2656, 29918, 5325, 29918, 1609, 29918, 7320, 29898, 5325, 29897, 13, 13, 1678, 27831, 29918, 5325, 353, 934, 29918, 5509, 29889, 2972, 29918, 5325, 29918, 1609, 29918, 7320, 29898, 5325, 29897, 13, 13, 1678, 4974, 27831, 29918, 5325, 1275, 426, 13, 4706, 376, 12733, 1115, 313, 2909, 29918, 1445, 29892, 511, 13, 4706, 376, 726, 29879, 1115, 313, 726, 29918, 1445, 29892, 511, 13, 4706, 376, 18494, 1115, 313, 18494, 29918, 1445, 29892, 1790, 29918, 18494, 29918, 1445, 511, 13, 1678, 500, 13, 13, 13, 1753, 2656, 29918, 5325, 29918, 1609, 29918, 7320, 29898, 5325, 1125, 13, 1678, 9995, 30008, 1419, 811, 2899, 642, 6725, 29977, 3176, 733, 28868, 588, 5887, 606, 863, 4222, 693, 8103, 3553, 29889, 13, 13, 1678, 939, 8838, 2815, 1046, 1216, 531, 1419, 811, 2899, 642, 6725, 29977, 3176, 23061, 13580, 1695, 1077, 5945, 1502, 1186, 1386, 30032, 29889, 13, 1678, 5238, 29959, 16642, 531, 1419, 811, 1086, 9480, 733, 28868, 588, 5887, 29892, 606, 1694, 12068, 16642, 6470, 11983, 4394, 29892, 2721, 733, 13, 1678, 733, 2583, 421, 13092, 29918, 333, 1412, 13, 13, 1678, 7203, 29935, 984, 29917, 1413, 6725, 29977, 1844, 1786, 8409, 14507, 1587, 29235, 421, 13092, 29918, 333, 29952, 1538, 693, 10027, 29892, 4553, 5413, 13, 1678, 421, 2283, 3195, 29952, 14367, 1447, 20142, 5472, 9955, 29935, 13139, 405, 2795, 23215, 552, 29889, 939, 11650, 2082, 20153, 3540, 13, 1678, 421, 15172, 29952, 24160, 4364, 490, 22285, 1077, 2387, 29982, 733, 1225, 421, 13092, 29918, 333, 29952, 13, 1678, 9995, 13, 1678, 2066, 29918, 24582, 29918, 1609, 29918, 7320, 353, 12705, 29898, 13, 4706, 26985, 29898, 5325, 511, 1820, 29922, 2892, 5101, 29901, 313, 18784, 29961, 29896, 1822, 7320, 29892, 5101, 29961, 29900, 2314, 13, 1678, 1723, 13, 1678, 2066, 29918, 24582, 29918, 1609, 29918, 7320, 353, 518, 1445, 363, 313, 3383, 934, 29897, 297, 2066, 29918, 24582, 29918, 1609, 29918, 7320, 29962, 13, 1678, 736, 2066, 29918, 24582, 29918, 1609, 29918, 7320, 13, 13, 13, 1753, 1243, 29918, 15728, 29918, 26689, 29918, 5325, 29918, 2972, 292, 29918, 1609, 29918, 7320, 29898, 13, 1678, 2322, 29918, 1792, 29892, 1653, 29918, 13092, 29918, 1445, 13, 1125, 13, 1678, 2066, 353, 5159, 13, 1678, 363, 7663, 297, 6796, 12733, 613, 376, 18494, 613, 376, 726, 29879, 613, 376, 18494, 3108, 29901, 13, 4706, 934, 353, 1653, 29918, 13092, 29918, 1445, 29898, 1792, 29922, 4381, 29918, 1792, 29892, 7663, 29922, 7320, 29897, 13, 4706, 934, 29918, 5509, 29889, 7620, 29918, 1445, 29898, 1445, 29897, 13, 4706, 2066, 29889, 4397, 29898, 1445, 29897, 13, 13, 1678, 313, 2909, 29918, 1445, 29892, 10348, 29918, 1445, 29892, 1426, 29918, 1445, 29892, 1790, 29918, 18494, 29918, 1445, 29897, 353, 2066, 13, 13, 1678, 15205, 29918, 5325, 353, 934, 29918, 5509, 29889, 657, 29918, 26689, 29918, 5325, 29898, 4381, 29918, 1792, 29889, 333, 29897, 13, 1678, 27831, 29918, 5325, 353, 934, 29918, 5509, 29889, 2972, 29918, 5325, 29918, 1609, 29918, 7320, 29898, 26689, 29918, 5325, 29897, 13, 13, 1678, 4974, 27831, 29918, 5325, 1275, 426, 13, 4706, 376, 12733, 1115, 313, 2909, 29918, 1445, 29892, 511, 13, 4706, 376, 726, 29879, 1115, 313, 726, 29918, 1445, 29892, 511, 13, 4706, 376, 18494, 1115, 313, 18494, 29918, 1445, 29892, 1790, 29918, 18494, 29918, 1445, 511, 13, 1678, 500, 13, 2 ]
Stackless/demo/fakechannel.py
masamitsu-murase/stackless
854
155836
import stackless class MyChannel: def __init__(self): self.queue = [] self.balance = 0 self.temp = None def send(self, data): if self.balance < 0: receiver = self.queue.pop(0) self.temp = data receiver.insert() self.balance += 1 receiver.run() else: sender = stackless.current self.queue.append((sender, data)) self.balance += 1 stackless.schedule_remove() def receive(self): if self.balance > 0: sender, retval = self.queue.pop(0) sender.insert() self.balance -= 1 return retval else: receiver = stackless.current self.queue.append(receiver) self.balance -= 1 stackless.schedule_remove() return self.temp def f1(ch): for i in range(5): ch.send(i) print("done sending") def f2(ch): while 1: data = ch.receive() if data is None: print("done receiving") return print("received", data) def test(): ch = MyChannel() t2 = stackless.tasklet(f2)(ch) t1 = stackless.tasklet(f1)(ch) stackless.run() return ch if __name__ == "__main__": test()
[ 1, 1053, 5096, 2222, 13, 13, 13, 1990, 1619, 13599, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 9990, 353, 5159, 13, 4706, 1583, 29889, 5521, 749, 353, 29871, 29900, 13, 4706, 1583, 29889, 7382, 353, 6213, 13, 13, 1678, 822, 3638, 29898, 1311, 29892, 848, 1125, 13, 4706, 565, 1583, 29889, 5521, 749, 529, 29871, 29900, 29901, 13, 9651, 19870, 353, 1583, 29889, 9990, 29889, 7323, 29898, 29900, 29897, 13, 9651, 1583, 29889, 7382, 353, 848, 13, 9651, 19870, 29889, 7851, 580, 13, 9651, 1583, 29889, 5521, 749, 4619, 29871, 29896, 13, 9651, 19870, 29889, 3389, 580, 13, 4706, 1683, 29901, 13, 9651, 10004, 353, 5096, 2222, 29889, 3784, 13, 9651, 1583, 29889, 9990, 29889, 4397, 3552, 15452, 29892, 848, 876, 13, 9651, 1583, 29889, 5521, 749, 4619, 29871, 29896, 13, 9651, 5096, 2222, 29889, 816, 11272, 29918, 5992, 580, 13, 13, 1678, 822, 7150, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 5521, 749, 1405, 29871, 29900, 29901, 13, 9651, 10004, 29892, 3240, 791, 353, 1583, 29889, 9990, 29889, 7323, 29898, 29900, 29897, 13, 9651, 10004, 29889, 7851, 580, 13, 9651, 1583, 29889, 5521, 749, 22361, 29871, 29896, 13, 9651, 736, 3240, 791, 13, 4706, 1683, 29901, 13, 9651, 19870, 353, 5096, 2222, 29889, 3784, 13, 9651, 1583, 29889, 9990, 29889, 4397, 29898, 13556, 2147, 29897, 13, 9651, 1583, 29889, 5521, 749, 22361, 29871, 29896, 13, 9651, 5096, 2222, 29889, 816, 11272, 29918, 5992, 580, 13, 9651, 736, 1583, 29889, 7382, 13, 13, 13, 1753, 285, 29896, 29898, 305, 1125, 13, 1678, 363, 474, 297, 3464, 29898, 29945, 1125, 13, 4706, 521, 29889, 6717, 29898, 29875, 29897, 13, 1678, 1596, 703, 15091, 9348, 1159, 13, 13, 13, 1753, 285, 29906, 29898, 305, 1125, 13, 1678, 1550, 29871, 29896, 29901, 13, 4706, 848, 353, 521, 29889, 13556, 573, 580, 13, 4706, 565, 848, 338, 6213, 29901, 13, 9651, 1596, 703, 15091, 13442, 1159, 13, 9651, 736, 13, 4706, 1596, 703, 13556, 2347, 613, 848, 29897, 13, 13, 13, 1753, 1243, 7295, 13, 1678, 521, 353, 1619, 13599, 580, 13, 1678, 260, 29906, 353, 5096, 2222, 29889, 7662, 1026, 29898, 29888, 29906, 5033, 305, 29897, 13, 1678, 260, 29896, 353, 5096, 2222, 29889, 7662, 1026, 29898, 29888, 29896, 5033, 305, 29897, 13, 1678, 5096, 2222, 29889, 3389, 580, 13, 1678, 736, 521, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1243, 580, 13, 2 ]
ex065.py
raquelEllem/exerciciosPython
0
151576
<filename>ex065.py<gh_stars>0 cont = soma = media = maior = menor = 0 res = 'S' while res == 'S': num = int(input('Digite um número: ')) res = str(input('Quer continuar? [S/N] ').strip().upper()) soma += num cont += 1 if cont == 1: maior = menor = num else: if maior < num: maior = num if menor > num: menor = num media = soma / cont print('Você digitou {} números e a média foi de {:.2f}'.format(cont, media)) print('O maior valor foi de {} e o menor foi {}'.format(maior, menor))
[ 1, 529, 9507, 29958, 735, 29900, 29953, 29945, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 1285, 353, 1047, 29874, 353, 5745, 353, 17136, 353, 26764, 353, 29871, 29900, 13, 690, 353, 525, 29903, 29915, 13, 8000, 620, 1275, 525, 29903, 2396, 13, 1678, 954, 353, 938, 29898, 2080, 877, 14991, 568, 1922, 13831, 29901, 525, 876, 13, 1678, 620, 353, 851, 29898, 2080, 877, 2182, 261, 3133, 279, 29973, 518, 29903, 29914, 29940, 29962, 525, 467, 17010, 2141, 21064, 3101, 13, 1678, 1047, 29874, 4619, 954, 13, 1678, 640, 4619, 29871, 29896, 13, 1678, 565, 640, 1275, 29871, 29896, 29901, 13, 4706, 17136, 353, 26764, 353, 954, 13, 1678, 1683, 29901, 13, 4706, 565, 17136, 529, 954, 29901, 13, 9651, 17136, 353, 954, 13, 4706, 565, 26764, 1405, 954, 29901, 13, 9651, 26764, 353, 954, 13, 9799, 353, 1047, 29874, 847, 640, 13, 2158, 877, 29963, 542, 30037, 13615, 283, 6571, 12158, 359, 321, 263, 10283, 423, 4732, 316, 12365, 29889, 29906, 29888, 29913, 4286, 4830, 29898, 1285, 29892, 5745, 876, 13, 2158, 877, 29949, 17136, 16497, 4732, 316, 6571, 321, 288, 26764, 4732, 6571, 4286, 4830, 29898, 655, 1611, 29892, 26764, 876, 13, 2 ]
warprnnt_numba/rnnt_loss/rnnt_atomic_locks/utils/naive_gpu_rnnt_kernel.py
titu1994/warprnnt_numba
7
126693
# Copyright (c) 2021, NVIDIA CORPORATION. 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. # # Copyright 2018-2019, <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 math import torch from numba import cuda from warprnnt_numba.rnnt_loss.utils import rnnt_helper from warprnnt_numba.rnnt_loss.utils.cuda_utils.gpu_rnnt_kernel import logp GPU_RNNT_THREAD_SIZE = 256 @cuda.jit(device=True, inline=True) def logp( denom: torch.Tensor, acts: torch.Tensor, maxT: int, maxU: int, alphabet_size: int, mb: int, t: int, u: int, v: int ): """ Compute the sum of log probability from the activation tensor and its denominator. Args: denom: Tensor of shape [B, T, U] flattened. Represents the denominator of the logprobs activation tensor across entire vocabulary. acts: Tensor of shape [B, T, U, V+1] flattened. Represents the logprobs activation tensor. maxT: The maximum possible acoustic sequence length. Represents T in the logprobs tensor. maxU: The maximum possible target sequence length. Represents U in the logprobs tensor. alphabet_size: The vocabulary dimension V+1 (inclusive of RNNT blank). mb: Batch indexer. t: Acoustic sequence timestep indexer. u: Target sequence timestep indexer. v: Vocabulary token indexer. Returns: The sum of logprobs[mb, t, u, v] + denom[mb, t, u] """ col = (mb * maxT + t) * maxU + u return denom[col] + acts[col * alphabet_size + v] @cuda.jit() def compute_alphas_kernel_atomic_locks( acts: torch.Tensor, denom: torch.Tensor, alphas: torch.Tensor, llForward: torch.Tensor, xlen: torch.Tensor, ylen: torch.Tensor, mlabels: torch.Tensor, # [B] minibatch: int, maxT: int, maxU: int, alphabet_size: int, blank: int, lock: torch.Tensor, ): """ Compute alpha (forward variable) probabilities over the transduction step in loop, with CUDA atomic locks. Baseline reference from SpeechBrain implementation - https://github.com/speechbrain/speechbrain/blob/develop/speechbrain/nnet/loss/transducer_loss.py Args: acts: Tensor of shape [B, T, U, V+1]. Represents the logprobs activation tensor. denom: Tensor of shape [B, T, U] flattened. Represents the denominator of the logprobs activation tensor across entire vocabulary. alphas: Zero tensor of shape [B, T, U]. Will be updated inside the kernel with the forward variable probabilities. llForward: Zero tensor of shape [B]. Represents the log-likelihood of the forward pass. Returned as the forward pass loss that is reduced by the optimizer. xlen: Vector of length B which contains the actual acoustic sequence lengths in the padded activation tensor. ylen: Vector of length B which contains the actual target sequence lengths in the padded activation tensor. mlabels: Matrix of shape [B, U+1] (+1 here is due to <SOS> token - usually the RNNT blank). The matrix contains the padded target transcription that must be predicted. minibatch: Int representing the batch size. maxT: The maximum possible acoustic sequence length. Represents T in the logprobs tensor. maxU: The maximum possible target sequence length. Represents U in the logprobs tensor. alphabet_size: The vocabulary dimension V+1 (inclusive of RNNT blank). blank_: Index of the RNNT blank token in the vocabulary. Generally the first or last token in the vocab. lock: Tensor of shape [B, U+1]. Bool values, used for CUDA atomic locking. Updates: Kernel inplace updates the following inputs: - alphas: forward variable scores. - llForward: log-likelihood of forward variable. """ # // launch B blocks, each block has U threads b = cuda.blockIdx.x u = cuda.threadIdx.x T = xlen[b] # select AM length of current sample U = ylen[b] + 1 # select target length of current sample, +1 for the blank token labels: torch.Tensor = mlabels[b] # mb label start point, equivalent to mlabels + b * (maxU - 1) offset = b * maxT * maxU # pointer indexing offset t = 0 # Ordinary alpha calculations, broadcast across B=b and U=u # Look up forward variable calculation from rnnt_numpy.forward_pass() if u < U: # for each (B,U) Thread # wait the unlock of the previous computation of Alpha[b,U-1,:] # Do the computation over the whole Time sequence on alpha[B,U,:] # and then unlock the target U+1 for computation while t < T: if u == 0: # for t in range(1, T) step to initialize alphas[b, t, 0] if t > 0: alphas[offset + t * maxU] = ( alphas[offset + (t - 1) * maxU] + logp(denom, acts, maxT, maxU, alphabet_size, b, t - 1, 0, blank) ) cuda.atomic.add(lock, (b, u + 1), -1) t += 1 else: if cuda.atomic.add(lock, (b, u), 0) < 0: # for u in range(1, U) step to initialize alphas[b, 0, u] if t == 0: alphas[offset + u] = ( alphas[offset + u - 1] + logp(denom, acts, maxT, maxU, alphabet_size, b, 0, u - 1, labels[u - 1]) ) else: # for t in range(1, T) for u in range(1, U) step to compute alphas[b, t, u] emit = ( alphas[offset + t * maxU + u - 1] + logp(denom, acts, maxT, maxU, alphabet_size, b, t, u - 1, labels[u - 1]) ) no_emit = ( alphas[offset + (t - 1) * maxU + u] + logp(denom, acts, maxT, maxU, alphabet_size, b, t - 1, u, blank) ) alphas[offset + t * maxU + u] = max(no_emit, emit) + math.log1p( math.exp(-abs(no_emit - emit)) ) if u < U: cuda.atomic.add(lock, (b, u + 1), -1) cuda.atomic.add(lock, (b, u), 1) t += 1 # After final sync, alphas[b, T-1, U - 1] + logprobs[b, T-1, U-1, blank] + denom[b, T-1, U-1] gives # log-likelihood of forward pass. if u == U - 1: # for each thread b (utterance) llForward[b] = ( alphas[offset + (T - 1) * maxU + U - 1] + logp(denom, acts, maxT, maxU, alphabet_size, b, T - 1, U - 1, blank) ) @cuda.jit() def compute_betas_kernel_atomic_locks( acts: torch.Tensor, denom: torch.Tensor, betas: torch.Tensor, llBackward: torch.Tensor, xlen: torch.Tensor, ylen: torch.Tensor, mlabels: torch.Tensor, # [B, U] minibatch: int, maxT: int, maxU: int, alphabet_size: int, blank_: int, lock: torch.Tensor, ): """ Compute beta (backward variable) probabilities over the transduction step. Args: acts: Tensor of shape [B, T, U, V+1] flattened. Represents the logprobs activation tensor. denom: Tensor of shape [B, T, U] flattened. Represents the denominator of the logprobs activation tensor across entire vocabulary. betas: Zero tensor of shape [B, T, U]. Will be updated inside the kernel with the backward variable probabilities. llBackward: Zero tensor of shape [B]. Represents the log-likelihood of the backward pass. Returned as the backward pass loss that is reduced by the optimizer. xlen: Vector of length B which contains the actual acoustic sequence lengths in the padded activation tensor. ylen: Vector of length B which contains the actual target sequence lengths in the padded activation tensor. mlabels: Matrix of shape [B, U+1] (+1 here is due to <SOS> token - usually the RNNT blank). The matrix contains the padded target transcription that must be predicted. minibatch: Int representing the batch size. maxT: The maximum possible acoustic sequence length. Represents T in the logprobs tensor. maxU: The maximum possible target sequence length. Represents U in the logprobs tensor. alphabet_size: The vocabulary dimension V+1 (inclusive of RNNT blank). blank_: Index of the RNNT blank token in the vocabulary. Generally the first or last token in the vocab. lock: Tensor of shape [B, U+1]. Bool values, used for CUDA atomic locking. Updates: Kernel inplace updates the following inputs: - betas: backward variable scores. - llBackward: log-likelihood of backward variable. """ # // launch B blocks, each block has U threads b = cuda.blockIdx.x # // batch id u = cuda.threadIdx.x # label id, u T = xlen[b] # select AM length of current sample U = ylen[b] + 1 # select target length of current sample, +1 for the blank token offset = b * maxT * maxU # pointer indexing offset labels: torch.Tensor = mlabels[b] # mb label start point, equivalent to mlabels + b * (maxU - 1) # Initilize beta[b, t=T-1, u=U-1] for all b in B with log_probs[b, t=T-1, u=U-1, blank] t = T - 1 # Ordinary beta calculations, broadcast across B=b and U=u # Look up backward variable calculation from rnnt_numpy.backward_pass() if u < U: # Loop in reversed order of T - (reversed(range(T - 1)) steps while t >= 0: if u == U - 1: # Initilize beta[b, t=T-1, u=U-1] for all b in B with log_probs[b, t=T-1, u=U-1, blank] if t == T - 1: betas[offset + t * maxU + u] = logp(denom, acts, maxT, maxU, alphabet_size, b, t, u, blank_) else: # for t in reversed(range(T - 1)) step to initialize betas[b, t, U-1] betas[offset + t * maxU + u] = ( betas[offset + (t + 1) * maxU + u] + logp(denom, acts, maxT, maxU, alphabet_size, b, t, u, blank_) ) cuda.atomic.add(lock, (b, u - 1), -1) t -= 1 else: if cuda.atomic.add(lock, (b, u), 0) < 0: if t == T - 1: # Compute betas[b, T - 1, u] betas[offset + t * maxU + u] = ( betas[offset + t * maxU + u + 1] + logp(denom, acts, maxT, maxU, alphabet_size, b, t, u, labels[u]) ) else: # for t in reversed(range(T - 1)) for u in reversed(range(U - 1)) step to compute betas[b, t, u] emit = ( betas[offset + t * maxU + u + 1] + logp(denom, acts, maxT, maxU, alphabet_size, b, t, u, labels[u]) ) no_emit = (betas[offset + (t + 1) * maxU + u] + logp(denom, acts, maxT, maxU, alphabet_size, b, t, u, blank_)) betas[offset + t * maxU + u] = rnnt_helper.log_sum_exp(emit, no_emit) if u > 0: cuda.atomic.add(lock, (b, u - 1), -1) cuda.atomic.add(lock, (b, u), 1) t -= 1 # After final sync, betas[b, 0, 0] gives # log-likelihood of backward pass. if u == 0: llBackward[b] = betas[offset]
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29896, 29892, 405, 13044, 10764, 315, 1955, 29925, 1955, 8098, 29889, 29871, 2178, 10462, 21676, 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, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29947, 29899, 29906, 29900, 29896, 29929, 29892, 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, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 5215, 5844, 13, 13, 5215, 4842, 305, 13, 3166, 954, 2291, 1053, 274, 6191, 13, 13, 3166, 1370, 558, 29876, 593, 29918, 1949, 2291, 29889, 27539, 593, 29918, 6758, 29889, 13239, 1053, 364, 29876, 593, 29918, 20907, 13, 3166, 1370, 558, 29876, 593, 29918, 1949, 2291, 29889, 27539, 593, 29918, 6758, 29889, 13239, 29889, 29883, 6191, 29918, 13239, 29889, 29887, 3746, 29918, 27539, 593, 29918, 17460, 1053, 1480, 29886, 13, 13, 29954, 7056, 29918, 29934, 10262, 29911, 29918, 4690, 16310, 29918, 14226, 353, 29871, 29906, 29945, 29953, 13, 13, 13, 29992, 29883, 6191, 29889, 29926, 277, 29898, 10141, 29922, 5574, 29892, 10583, 29922, 5574, 29897, 13, 1753, 1480, 29886, 29898, 13, 1678, 972, 290, 29901, 4842, 305, 29889, 29911, 6073, 29892, 14741, 29901, 4842, 305, 29889, 29911, 6073, 29892, 4236, 29911, 29901, 938, 29892, 4236, 29965, 29901, 938, 29892, 22968, 29918, 2311, 29901, 938, 29892, 286, 29890, 29901, 938, 29892, 260, 29901, 938, 29892, 318, 29901, 938, 29892, 325, 29901, 938, 13, 1125, 13, 1678, 9995, 13, 1678, 11796, 29872, 278, 2533, 310, 1480, 6976, 515, 278, 26229, 12489, 322, 967, 14267, 1061, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 972, 290, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 29962, 1652, 8606, 287, 29889, 830, 4569, 1237, 278, 14267, 1061, 310, 278, 1480, 771, 5824, 26229, 12489, 13, 9651, 4822, 4152, 7931, 370, 352, 653, 29889, 13, 4706, 14741, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 29892, 478, 29974, 29896, 29962, 1652, 8606, 287, 29889, 830, 4569, 1237, 278, 1480, 771, 5824, 26229, 12489, 29889, 13, 4706, 4236, 29911, 29901, 450, 7472, 1950, 1274, 18291, 293, 5665, 3309, 29889, 830, 4569, 1237, 323, 297, 278, 1480, 771, 5824, 12489, 29889, 13, 4706, 4236, 29965, 29901, 450, 7472, 1950, 3646, 5665, 3309, 29889, 830, 4569, 1237, 501, 297, 278, 1480, 771, 5824, 12489, 29889, 13, 4706, 22968, 29918, 2311, 29901, 450, 7931, 370, 352, 653, 9927, 478, 29974, 29896, 313, 262, 7009, 573, 310, 390, 10262, 29911, 9654, 467, 13, 4706, 286, 29890, 29901, 350, 905, 2380, 261, 29889, 13, 4706, 260, 29901, 7255, 18291, 293, 5665, 5335, 342, 1022, 2380, 261, 29889, 13, 4706, 318, 29901, 17157, 5665, 5335, 342, 1022, 2380, 261, 29889, 13, 4706, 325, 29901, 478, 542, 370, 352, 653, 5993, 2380, 261, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 450, 2533, 310, 1480, 771, 5824, 29961, 8337, 29892, 260, 29892, 318, 29892, 325, 29962, 718, 972, 290, 29961, 8337, 29892, 260, 29892, 318, 29962, 13, 1678, 9995, 13, 1678, 784, 353, 313, 8337, 334, 4236, 29911, 718, 260, 29897, 334, 4236, 29965, 718, 318, 13, 1678, 736, 972, 290, 29961, 1054, 29962, 718, 14741, 29961, 1054, 334, 22968, 29918, 2311, 718, 325, 29962, 13, 13, 13, 29992, 29883, 6191, 29889, 29926, 277, 580, 13, 1753, 10272, 29918, 284, 16130, 29918, 17460, 29918, 21641, 29918, 908, 29879, 29898, 13, 4706, 14741, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 972, 290, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 394, 16130, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 11148, 2831, 1328, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 921, 2435, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 343, 2435, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 286, 21134, 29901, 4842, 305, 29889, 29911, 6073, 29892, 29871, 396, 518, 29933, 29962, 13, 4706, 1375, 747, 905, 29901, 938, 29892, 13, 4706, 4236, 29911, 29901, 938, 29892, 13, 4706, 4236, 29965, 29901, 938, 29892, 13, 4706, 22968, 29918, 2311, 29901, 938, 29892, 13, 4706, 9654, 29901, 938, 29892, 13, 4706, 7714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 11796, 29872, 15595, 313, 11333, 2286, 29897, 2070, 11614, 975, 278, 1301, 700, 428, 4331, 297, 2425, 29892, 13, 1678, 411, 315, 29965, 7698, 23489, 658, 4684, 29889, 13, 13, 1678, 4886, 5570, 3407, 515, 5013, 5309, 22097, 5314, 448, 13, 1678, 2045, 597, 3292, 29889, 510, 29914, 5965, 5309, 2634, 262, 29914, 5965, 5309, 2634, 262, 29914, 10054, 29914, 4888, 29914, 5965, 5309, 2634, 262, 29914, 29876, 1212, 29914, 6758, 29914, 3286, 700, 2265, 29918, 6758, 29889, 2272, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 14741, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 29892, 478, 29974, 29896, 1822, 830, 4569, 1237, 278, 1480, 771, 5824, 26229, 12489, 29889, 13, 4706, 972, 290, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 29962, 1652, 8606, 287, 29889, 830, 4569, 1237, 278, 14267, 1061, 310, 278, 1480, 771, 5824, 26229, 12489, 13, 9651, 4822, 4152, 7931, 370, 352, 653, 29889, 13, 4706, 394, 16130, 29901, 28933, 12489, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 1822, 2811, 367, 4784, 2768, 278, 8466, 411, 278, 6375, 2286, 13, 9651, 2070, 11614, 29889, 13, 4706, 11148, 2831, 1328, 29901, 28933, 12489, 310, 8267, 518, 29933, 1822, 830, 4569, 1237, 278, 1480, 29899, 5081, 22342, 310, 278, 6375, 1209, 29889, 13, 9651, 7106, 287, 408, 278, 6375, 1209, 6410, 393, 338, 12212, 491, 278, 5994, 3950, 29889, 13, 4706, 921, 2435, 29901, 16510, 310, 3309, 350, 607, 3743, 278, 3935, 1274, 18291, 293, 5665, 27497, 297, 278, 282, 23959, 13, 9651, 26229, 12489, 29889, 13, 4706, 343, 2435, 29901, 16510, 310, 3309, 350, 607, 3743, 278, 3935, 3646, 5665, 27497, 297, 278, 282, 23959, 13, 9651, 26229, 12489, 29889, 13, 4706, 286, 21134, 29901, 22513, 310, 8267, 518, 29933, 29892, 501, 29974, 29896, 29962, 20532, 29896, 1244, 338, 2861, 304, 529, 29903, 3267, 29958, 5993, 448, 5491, 278, 390, 10262, 29911, 9654, 467, 13, 9651, 450, 4636, 3743, 278, 282, 23959, 3646, 1301, 3395, 393, 1818, 367, 25383, 29889, 13, 4706, 1375, 747, 905, 29901, 3159, 15783, 278, 9853, 2159, 29889, 13, 4706, 4236, 29911, 29901, 450, 7472, 1950, 1274, 18291, 293, 5665, 3309, 29889, 830, 4569, 1237, 323, 297, 278, 1480, 771, 5824, 12489, 29889, 13, 4706, 4236, 29965, 29901, 450, 7472, 1950, 3646, 5665, 3309, 29889, 830, 4569, 1237, 501, 297, 278, 1480, 771, 5824, 12489, 29889, 13, 4706, 22968, 29918, 2311, 29901, 450, 7931, 370, 352, 653, 9927, 478, 29974, 29896, 313, 262, 7009, 573, 310, 390, 10262, 29911, 9654, 467, 13, 4706, 9654, 29918, 29901, 11374, 310, 278, 390, 10262, 29911, 9654, 5993, 297, 278, 7931, 370, 352, 653, 29889, 3251, 635, 278, 937, 470, 1833, 5993, 297, 278, 7931, 370, 29889, 13, 4706, 7714, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 501, 29974, 29896, 1822, 18912, 1819, 29892, 1304, 363, 315, 29965, 7698, 23489, 7714, 292, 29889, 13, 13, 1678, 5020, 15190, 29901, 13, 4706, 476, 5851, 297, 6689, 11217, 278, 1494, 10970, 29901, 13, 4706, 448, 259, 394, 16130, 29901, 6375, 2286, 19435, 29889, 13, 4706, 448, 259, 11148, 2831, 1328, 29901, 1480, 29899, 5081, 22342, 310, 6375, 2286, 29889, 13, 1678, 9995, 13, 1678, 396, 29871, 849, 6826, 350, 10930, 29892, 1269, 2908, 756, 501, 9717, 13, 1678, 289, 353, 274, 6191, 29889, 1271, 1204, 29916, 29889, 29916, 13, 1678, 318, 353, 274, 6191, 29889, 7097, 1204, 29916, 29889, 29916, 13, 13, 1678, 323, 353, 921, 2435, 29961, 29890, 29962, 29871, 396, 1831, 13862, 3309, 310, 1857, 4559, 13, 1678, 501, 353, 343, 2435, 29961, 29890, 29962, 718, 29871, 29896, 29871, 396, 1831, 3646, 3309, 310, 1857, 4559, 29892, 718, 29896, 363, 278, 9654, 5993, 13, 13, 1678, 11073, 29901, 4842, 305, 29889, 29911, 6073, 353, 286, 21134, 29961, 29890, 29962, 29871, 396, 286, 29890, 3858, 1369, 1298, 29892, 7126, 304, 286, 21134, 718, 289, 334, 313, 3317, 29965, 448, 29871, 29896, 29897, 13, 1678, 9210, 353, 289, 334, 4236, 29911, 334, 4236, 29965, 29871, 396, 4879, 26190, 9210, 13, 13, 1678, 260, 353, 29871, 29900, 13, 13, 1678, 396, 16557, 3821, 15595, 17203, 29892, 12672, 4822, 350, 29922, 29890, 322, 501, 29922, 29884, 13, 1678, 396, 7419, 701, 6375, 2286, 13944, 515, 364, 29876, 593, 29918, 23749, 29889, 11333, 29918, 3364, 580, 13, 1678, 565, 318, 529, 501, 29901, 13, 4706, 396, 363, 1269, 313, 29933, 29892, 29965, 29897, 10480, 13, 4706, 396, 4480, 278, 443, 908, 310, 278, 3517, 16287, 310, 838, 2026, 29961, 29890, 29892, 29965, 29899, 29896, 29892, 17531, 13, 4706, 396, 1938, 278, 16287, 975, 278, 3353, 5974, 5665, 373, 15595, 29961, 29933, 29892, 29965, 29892, 17531, 13, 4706, 396, 322, 769, 443, 908, 278, 3646, 501, 29974, 29896, 363, 16287, 13, 4706, 1550, 260, 529, 323, 29901, 13, 9651, 565, 318, 1275, 29871, 29900, 29901, 13, 18884, 396, 363, 260, 297, 3464, 29898, 29896, 29892, 323, 29897, 4331, 304, 11905, 394, 16130, 29961, 29890, 29892, 260, 29892, 29871, 29900, 29962, 13, 18884, 565, 260, 1405, 29871, 29900, 29901, 13, 462, 1678, 394, 16130, 29961, 10289, 718, 260, 334, 4236, 29965, 29962, 353, 313, 13, 462, 9651, 394, 16130, 29961, 10289, 718, 29871, 313, 29873, 448, 29871, 29896, 29897, 334, 4236, 29965, 29962, 13, 462, 9651, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 448, 29871, 29896, 29892, 29871, 29900, 29892, 9654, 29897, 13, 462, 1678, 1723, 13, 18884, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 718, 29871, 29896, 511, 448, 29896, 29897, 13, 18884, 260, 4619, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 565, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 511, 29871, 29900, 29897, 529, 29871, 29900, 29901, 13, 462, 1678, 396, 363, 318, 297, 3464, 29898, 29896, 29892, 501, 29897, 4331, 304, 11905, 394, 16130, 29961, 29890, 29892, 29871, 29900, 29892, 318, 29962, 13, 462, 1678, 565, 260, 1275, 29871, 29900, 29901, 13, 462, 4706, 394, 16130, 29961, 10289, 718, 318, 29962, 353, 313, 13, 462, 18884, 394, 16130, 29961, 10289, 718, 318, 448, 29871, 29896, 29962, 13, 462, 18884, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 29871, 29900, 29892, 318, 448, 29871, 29896, 29892, 11073, 29961, 29884, 448, 29871, 29896, 2314, 13, 462, 4706, 1723, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 396, 363, 260, 297, 3464, 29898, 29896, 29892, 323, 29897, 363, 318, 297, 3464, 29898, 29896, 29892, 501, 29897, 4331, 304, 10272, 394, 16130, 29961, 29890, 29892, 260, 29892, 318, 29962, 13, 462, 4706, 20076, 353, 313, 13, 462, 18884, 394, 16130, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 448, 29871, 29896, 29962, 13, 462, 18884, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 29892, 318, 448, 29871, 29896, 29892, 11073, 29961, 29884, 448, 29871, 29896, 2314, 13, 462, 4706, 1723, 13, 462, 4706, 694, 29918, 21976, 353, 313, 13, 462, 18884, 394, 16130, 29961, 10289, 718, 313, 29873, 448, 29871, 29896, 29897, 334, 4236, 29965, 718, 318, 29962, 13, 462, 18884, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 448, 29871, 29896, 29892, 318, 29892, 9654, 29897, 13, 462, 4706, 1723, 13, 13, 462, 4706, 394, 16130, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 29962, 353, 4236, 29898, 1217, 29918, 21976, 29892, 20076, 29897, 718, 5844, 29889, 1188, 29896, 29886, 29898, 13, 462, 9651, 5844, 29889, 4548, 6278, 6897, 29898, 1217, 29918, 21976, 448, 20076, 876, 13, 462, 4706, 1723, 13, 13, 462, 1678, 565, 318, 529, 501, 29901, 13, 462, 4706, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 718, 29871, 29896, 511, 448, 29896, 29897, 13, 13, 462, 1678, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 511, 29871, 29896, 29897, 13, 462, 1678, 260, 4619, 29871, 29896, 13, 13, 4706, 396, 2860, 2186, 16523, 29892, 394, 16130, 29961, 29890, 29892, 323, 29899, 29896, 29892, 501, 448, 29871, 29896, 29962, 718, 1480, 771, 5824, 29961, 29890, 29892, 323, 29899, 29896, 29892, 501, 29899, 29896, 29892, 9654, 29962, 718, 972, 290, 29961, 29890, 29892, 323, 29899, 29896, 29892, 501, 29899, 29896, 29962, 4076, 13, 4706, 396, 1480, 29899, 5081, 22342, 310, 6375, 1209, 29889, 13, 4706, 565, 318, 1275, 501, 448, 29871, 29896, 29901, 13, 9651, 396, 363, 1269, 3244, 289, 313, 6463, 749, 29897, 13, 9651, 11148, 2831, 1328, 29961, 29890, 29962, 353, 313, 13, 462, 1678, 394, 16130, 29961, 10289, 718, 313, 29911, 448, 29871, 29896, 29897, 334, 4236, 29965, 718, 501, 448, 29871, 29896, 29962, 13, 462, 1678, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 323, 448, 29871, 29896, 29892, 501, 448, 29871, 29896, 29892, 9654, 29897, 13, 9651, 1723, 13, 13, 13, 29992, 29883, 6191, 29889, 29926, 277, 580, 13, 1753, 10272, 29918, 6878, 294, 29918, 17460, 29918, 21641, 29918, 908, 29879, 29898, 13, 4706, 14741, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 972, 290, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 1010, 294, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 11148, 5841, 1328, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 921, 2435, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 343, 2435, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 4706, 286, 21134, 29901, 4842, 305, 29889, 29911, 6073, 29892, 29871, 396, 518, 29933, 29892, 501, 29962, 13, 4706, 1375, 747, 905, 29901, 938, 29892, 13, 4706, 4236, 29911, 29901, 938, 29892, 13, 4706, 4236, 29965, 29901, 938, 29892, 13, 4706, 22968, 29918, 2311, 29901, 938, 29892, 13, 4706, 9654, 29918, 29901, 938, 29892, 13, 4706, 7714, 29901, 4842, 305, 29889, 29911, 6073, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 11796, 29872, 21762, 313, 1627, 1328, 2286, 29897, 2070, 11614, 975, 278, 1301, 700, 428, 4331, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 14741, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 29892, 478, 29974, 29896, 29962, 1652, 8606, 287, 29889, 830, 4569, 1237, 278, 1480, 771, 5824, 26229, 12489, 29889, 13, 4706, 972, 290, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 29962, 1652, 8606, 287, 29889, 830, 4569, 1237, 278, 14267, 1061, 310, 278, 1480, 771, 5824, 26229, 12489, 13, 9651, 4822, 4152, 7931, 370, 352, 653, 29889, 13, 4706, 1010, 294, 29901, 28933, 12489, 310, 8267, 518, 29933, 29892, 323, 29892, 501, 1822, 2811, 367, 4784, 2768, 278, 8466, 411, 278, 1250, 1328, 2286, 13, 9651, 2070, 11614, 29889, 13, 4706, 11148, 5841, 1328, 29901, 28933, 12489, 310, 8267, 518, 29933, 1822, 830, 4569, 1237, 278, 1480, 29899, 5081, 22342, 310, 278, 1250, 1328, 1209, 29889, 13, 9651, 7106, 287, 408, 278, 1250, 1328, 1209, 6410, 393, 338, 12212, 491, 278, 5994, 3950, 29889, 13, 4706, 921, 2435, 29901, 16510, 310, 3309, 350, 607, 3743, 278, 3935, 1274, 18291, 293, 5665, 27497, 297, 278, 282, 23959, 13, 9651, 26229, 12489, 29889, 13, 4706, 343, 2435, 29901, 16510, 310, 3309, 350, 607, 3743, 278, 3935, 3646, 5665, 27497, 297, 278, 282, 23959, 13, 9651, 26229, 12489, 29889, 13, 4706, 286, 21134, 29901, 22513, 310, 8267, 518, 29933, 29892, 501, 29974, 29896, 29962, 20532, 29896, 1244, 338, 2861, 304, 529, 29903, 3267, 29958, 5993, 448, 5491, 278, 390, 10262, 29911, 9654, 467, 13, 9651, 450, 4636, 3743, 278, 282, 23959, 3646, 1301, 3395, 393, 1818, 367, 25383, 29889, 13, 4706, 1375, 747, 905, 29901, 3159, 15783, 278, 9853, 2159, 29889, 13, 4706, 4236, 29911, 29901, 450, 7472, 1950, 1274, 18291, 293, 5665, 3309, 29889, 830, 4569, 1237, 323, 297, 278, 1480, 771, 5824, 12489, 29889, 13, 4706, 4236, 29965, 29901, 450, 7472, 1950, 3646, 5665, 3309, 29889, 830, 4569, 1237, 501, 297, 278, 1480, 771, 5824, 12489, 29889, 13, 4706, 22968, 29918, 2311, 29901, 450, 7931, 370, 352, 653, 9927, 478, 29974, 29896, 313, 262, 7009, 573, 310, 390, 10262, 29911, 9654, 467, 13, 4706, 9654, 29918, 29901, 11374, 310, 278, 390, 10262, 29911, 9654, 5993, 297, 278, 7931, 370, 352, 653, 29889, 3251, 635, 278, 937, 470, 1833, 5993, 297, 278, 7931, 370, 29889, 13, 4706, 7714, 29901, 323, 6073, 310, 8267, 518, 29933, 29892, 501, 29974, 29896, 1822, 18912, 1819, 29892, 1304, 363, 315, 29965, 7698, 23489, 7714, 292, 29889, 13, 13, 1678, 5020, 15190, 29901, 13, 4706, 476, 5851, 297, 6689, 11217, 278, 1494, 10970, 29901, 13, 4706, 448, 259, 1010, 294, 29901, 1250, 1328, 2286, 19435, 29889, 13, 4706, 448, 259, 11148, 5841, 1328, 29901, 1480, 29899, 5081, 22342, 310, 1250, 1328, 2286, 29889, 13, 1678, 9995, 13, 1678, 396, 849, 6826, 350, 10930, 29892, 1269, 2908, 756, 501, 9717, 13, 1678, 289, 353, 274, 6191, 29889, 1271, 1204, 29916, 29889, 29916, 29871, 396, 849, 9853, 1178, 13, 1678, 318, 353, 274, 6191, 29889, 7097, 1204, 29916, 29889, 29916, 29871, 396, 3858, 1178, 29892, 318, 13, 13, 1678, 323, 353, 921, 2435, 29961, 29890, 29962, 29871, 396, 1831, 13862, 3309, 310, 1857, 4559, 13, 1678, 501, 353, 343, 2435, 29961, 29890, 29962, 718, 29871, 29896, 29871, 396, 1831, 3646, 3309, 310, 1857, 4559, 29892, 718, 29896, 363, 278, 9654, 5993, 13, 13, 1678, 9210, 353, 289, 334, 4236, 29911, 334, 4236, 29965, 29871, 396, 4879, 26190, 9210, 13, 1678, 11073, 29901, 4842, 305, 29889, 29911, 6073, 353, 286, 21134, 29961, 29890, 29962, 29871, 396, 286, 29890, 3858, 1369, 1298, 29892, 7126, 304, 286, 21134, 718, 289, 334, 313, 3317, 29965, 448, 29871, 29896, 29897, 13, 13, 1678, 396, 10886, 309, 675, 21762, 29961, 29890, 29892, 260, 29922, 29911, 29899, 29896, 29892, 318, 29922, 29965, 29899, 29896, 29962, 363, 599, 289, 297, 350, 411, 1480, 29918, 771, 5824, 29961, 29890, 29892, 260, 29922, 29911, 29899, 29896, 29892, 318, 29922, 29965, 29899, 29896, 29892, 9654, 29962, 13, 1678, 260, 353, 323, 448, 29871, 29896, 13, 13, 1678, 396, 16557, 3821, 21762, 17203, 29892, 12672, 4822, 350, 29922, 29890, 322, 501, 29922, 29884, 13, 1678, 396, 7419, 701, 1250, 1328, 2286, 13944, 515, 364, 29876, 593, 29918, 23749, 29889, 1627, 1328, 29918, 3364, 580, 13, 1678, 565, 318, 529, 501, 29901, 13, 4706, 396, 21493, 297, 18764, 287, 1797, 310, 323, 448, 313, 276, 874, 287, 29898, 3881, 29898, 29911, 448, 29871, 29896, 876, 6576, 13, 4706, 1550, 260, 6736, 29871, 29900, 29901, 13, 9651, 565, 318, 1275, 501, 448, 29871, 29896, 29901, 13, 18884, 396, 10886, 309, 675, 21762, 29961, 29890, 29892, 260, 29922, 29911, 29899, 29896, 29892, 318, 29922, 29965, 29899, 29896, 29962, 363, 599, 289, 297, 350, 411, 1480, 29918, 771, 5824, 29961, 29890, 29892, 260, 29922, 29911, 29899, 29896, 29892, 318, 29922, 29965, 29899, 29896, 29892, 9654, 29962, 13, 18884, 565, 260, 1275, 323, 448, 29871, 29896, 29901, 13, 462, 1678, 1010, 294, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 29962, 353, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 29892, 318, 29892, 9654, 19925, 13, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 363, 260, 297, 18764, 287, 29898, 3881, 29898, 29911, 448, 29871, 29896, 876, 4331, 304, 11905, 1010, 294, 29961, 29890, 29892, 260, 29892, 501, 29899, 29896, 29962, 13, 462, 1678, 1010, 294, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 29962, 353, 313, 13, 462, 9651, 1010, 294, 29961, 10289, 718, 313, 29873, 718, 29871, 29896, 29897, 334, 4236, 29965, 718, 318, 29962, 13, 462, 9651, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 29892, 318, 29892, 9654, 19925, 13, 462, 1678, 1723, 13, 13, 18884, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 448, 29871, 29896, 511, 448, 29896, 29897, 13, 18884, 260, 22361, 29871, 29896, 13, 13, 9651, 1683, 29901, 13, 18884, 565, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 511, 29871, 29900, 29897, 529, 29871, 29900, 29901, 13, 462, 1678, 565, 260, 1275, 323, 448, 29871, 29896, 29901, 13, 462, 4706, 396, 11796, 29872, 1010, 294, 29961, 29890, 29892, 323, 448, 29871, 29896, 29892, 318, 29962, 13, 462, 4706, 1010, 294, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 29962, 353, 313, 13, 462, 18884, 1010, 294, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 718, 29871, 29896, 29962, 13, 462, 18884, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 29892, 318, 29892, 11073, 29961, 29884, 2314, 13, 462, 4706, 1723, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 396, 363, 260, 297, 18764, 287, 29898, 3881, 29898, 29911, 448, 29871, 29896, 876, 363, 318, 297, 18764, 287, 29898, 3881, 29898, 29965, 448, 29871, 29896, 876, 4331, 304, 10272, 1010, 294, 29961, 29890, 29892, 260, 29892, 318, 29962, 13, 462, 4706, 20076, 353, 313, 13, 462, 18884, 1010, 294, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 718, 29871, 29896, 29962, 13, 462, 18884, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 29892, 318, 29892, 11073, 29961, 29884, 2314, 13, 462, 4706, 1723, 13, 462, 4706, 694, 29918, 21976, 353, 313, 6878, 294, 29961, 10289, 718, 313, 29873, 718, 29871, 29896, 29897, 334, 4236, 29965, 718, 318, 29962, 13, 462, 462, 259, 718, 1480, 29886, 29898, 1145, 290, 29892, 14741, 29892, 4236, 29911, 29892, 4236, 29965, 29892, 22968, 29918, 2311, 29892, 289, 29892, 260, 29892, 318, 29892, 9654, 29918, 876, 13, 13, 462, 4706, 1010, 294, 29961, 10289, 718, 260, 334, 4236, 29965, 718, 318, 29962, 353, 364, 29876, 593, 29918, 20907, 29889, 1188, 29918, 2083, 29918, 4548, 29898, 21976, 29892, 694, 29918, 21976, 29897, 13, 13, 462, 1678, 565, 318, 1405, 29871, 29900, 29901, 13, 462, 4706, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 448, 29871, 29896, 511, 448, 29896, 29897, 13, 13, 462, 1678, 274, 6191, 29889, 21641, 29889, 1202, 29898, 908, 29892, 313, 29890, 29892, 318, 511, 29871, 29896, 29897, 13, 462, 1678, 260, 22361, 29871, 29896, 13, 13, 1678, 396, 2860, 2186, 16523, 29892, 1010, 294, 29961, 29890, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 4076, 13, 1678, 396, 1480, 29899, 5081, 22342, 310, 1250, 1328, 1209, 29889, 13, 1678, 565, 318, 1275, 29871, 29900, 29901, 13, 4706, 11148, 5841, 1328, 29961, 29890, 29962, 353, 1010, 294, 29961, 10289, 29962, 13, 2 ]
devito/ir/iet/efunc.py
fffarias/devito-1
199
1611713
<filename>devito/ir/iet/efunc.py from collections import namedtuple from cached_property import cached_property from sympy import Or import cgen as c import numpy as np from devito.ir.iet.nodes import (BlankLine, Call, Callable, Conditional, Dereference, DummyExpr, Iteration, List, PointerCast, Return, While, CallableBody) from devito.ir.iet.utils import derive_parameters, diff_parameters from devito.symbolics import CondEq, CondNe, FieldFromComposite, FieldFromPointer, Macro from devito.tools import as_tuple from devito.types import PThreadArray, SharedData, Symbol, Pointer __all__ = ['ElementalFunction', 'ElementalCall', 'make_efunc', 'EntryFunction', 'ThreadFunction', 'make_thread_ctx', 'DeviceFunction'] # ElementalFunction machinery class ElementalFunction(Callable): """ A Callable performing a computation over an abstract convex iteration space. A Call to an ElementalFunction will "instantiate" such iteration space by supplying bounds and step increment for each Dimension listed in ``dynamic_parameters``. """ is_ElementalFunction = True def __init__(self, name, body, retval, parameters=None, prefix=('static', 'inline'), dynamic_parameters=None): super(ElementalFunction, self).__init__(name, body, retval, parameters, prefix) self._mapper = {} for i in as_tuple(dynamic_parameters): if i.is_Dimension: self._mapper[i] = (parameters.index(i.symbolic_min), parameters.index(i.symbolic_max)) else: self._mapper[i] = (parameters.index(i),) @cached_property def dynamic_defaults(self): return {k: tuple(self.parameters[i] for i in v) for k, v in self._mapper.items()} def make_call(self, dynamic_args_mapper=None, incr=False, retobj=None, is_indirect=False): return ElementalCall(self.name, list(self.parameters), dict(self._mapper), dynamic_args_mapper, incr, retobj, is_indirect) class ElementalCall(Call): def __init__(self, name, arguments=None, mapper=None, dynamic_args_mapper=None, incr=False, retobj=None, is_indirect=False): self._mapper = mapper or {} arguments = list(as_tuple(arguments)) dynamic_args_mapper = dynamic_args_mapper or {} for k, v in dynamic_args_mapper.items(): tv = as_tuple(v) # Sanity check if k not in self._mapper: raise ValueError("`k` is not a dynamic parameter" % k) if len(self._mapper[k]) != len(tv): raise ValueError("Expected %d values for dynamic parameter `%s`, given %d" % (len(self._mapper[k]), k, len(tv))) # Create the argument list for i, j in zip(self._mapper[k], tv): arguments[i] = j if incr is False else (arguments[i] + j) super(ElementalCall, self).__init__(name, arguments, retobj, is_indirect) def _rebuild(self, *args, dynamic_args_mapper=None, incr=False, retobj=None, **kwargs): # This guarantees that `ec._rebuild(arguments=ec.arguments) == ec` return super(ElementalCall, self)._rebuild( *args, dynamic_args_mapper=dynamic_args_mapper, incr=incr, retobj=retobj, **kwargs ) @cached_property def dynamic_defaults(self): return {k: tuple(self.arguments[i] for i in v) for k, v in self._mapper.items()} def make_efunc(name, iet, dynamic_parameters=None, retval='void', prefix='static'): """ Shortcut to create an ElementalFunction. """ return ElementalFunction(name, iet, retval, derive_parameters(iet), prefix, dynamic_parameters) # EntryFunction machinery class EntryFunction(Callable): pass # ThreadFunction machinery ThreadCtx = namedtuple('ThreadCtx', 'threads sdata funcs init activate finalize') class ThreadFunction(Callable): """ A Callable executed asynchronously by a separate thread. """ pass def _make_threads(value, sregistry): name = sregistry.make_name(prefix='threads') base_id = 1 + sum(i.size for i in sregistry.npthreads) if value is None: # The npthreads Symbol isn't actually used, but we record the fact # that some new pthreads have been allocated sregistry.make_npthreads(1) npthreads = 1 else: npthreads = sregistry.make_npthreads(value) threads = PThreadArray(name=name, npthreads=npthreads, base_id=base_id) return threads def _make_thread_init(threads, tfunc, isdata, sdata, sregistry): d = threads.index if threads.size == 1: callback = lambda body: body else: callback = lambda body: Iteration(body, d, threads.size - 1) # A unique identifier for each created pthread pthreadid = d + threads.base_id # Initialize `sdata` arguments = list(isdata.parameters) arguments[-3] = sdata.symbolic_base + d arguments[-2] = pthreadid arguments[-1] = sregistry.deviceid call0 = Call(isdata.name, arguments) # Create pthreads call1 = Call('pthread_create', (threads.symbolic_base + d, Macro('NULL'), Call(tfunc.name, [], is_indirect=True), sdata.symbolic_base + d)) threadsinit = List( header=c.Comment("Fire up and initialize `%s`" % threads.name), body=callback([call0, call1]) ) return threadsinit def _make_thread_func(name, iet, root, threads, sregistry): sid = SharedData._symbolic_id sdeviceid = SharedData._symbolic_deviceid # Create the SharedData, that is the data structure that will be used by the # main thread to pass information dows to the child thread(s) required, parameters, dynamic_parameters = diff_parameters(iet, root, [sid]) parameters = sorted(parameters, key=lambda i: i.is_Function) # Allow casting sdata = SharedData(name=sregistry.make_name(prefix='sdata'), npthreads=threads.size, fields=required, dynamic_fields=dynamic_parameters) # Create a Callable to initialize `sdata` with the known const values sbase = sdata.symbolic_base iname = 'init_%s' % sdata.dtype._type_.__name__ ibody = [DummyExpr(FieldFromPointer(i._C_name, sbase), i._C_symbol) for i in parameters] ibody.extend([ BlankLine, DummyExpr(FieldFromPointer(sdata._field_id, sbase), sid), DummyExpr(FieldFromPointer(sdata._field_deviceid, sbase), sdeviceid), DummyExpr(FieldFromPointer(sdata._field_flag, sbase), 1) ]) iparameters = parameters + [sdata, sid, sdeviceid] isdata = Callable(iname, ibody, 'void', iparameters, 'static') # Prepend the SharedData fields available upon thread activation preactions = [DummyExpr(i, FieldFromPointer(i.name, sbase)) for i in dynamic_parameters] # Append the flag reset postactions = [List(body=[ BlankLine, DummyExpr(FieldFromPointer(sdata._field_flag, sbase), 1) ])] iet = List(body=preactions + [iet] + postactions) # The thread has work to do when it receives the signal that all locks have # been set to 0 by the main thread iet = Conditional(CondEq(FieldFromPointer(sdata._field_flag, sbase), 2), iet) # The thread keeps spinning until the alive flag is set to 0 by the main thread iet = While(CondNe(FieldFromPointer(sdata._field_flag, sbase), 0), iet) # pthread functions expect exactly one argument, a void*, and must return void* tretval = 'void*' tparameter = Pointer(name='_%s' % sdata.name, dtype=np.void) # Unpack `sdata` unpack = [PointerCast(sdata, tparameter), BlankLine] for i in parameters: if i.is_AbstractFunction: unpack.append(Dereference(i, sdata)) else: unpack.append(DummyExpr(i, FieldFromPointer(i.name, sbase))) unpack.append(DummyExpr(sid, FieldFromPointer(sdata._field_id, sbase))) unpack.append(DummyExpr(sdeviceid, FieldFromPointer(sdata._field_deviceid, sbase))) iet = CallableBody([iet, Return(Macro('NULL'))], unpacks=unpack) tfunc = ThreadFunction(name, iet, tretval, tparameter, 'static') return tfunc, isdata, sdata def _make_thread_activate(threads, sdata, sync_ops, sregistry): if threads.size == 1: d = threads.index else: d = Symbol(name=sregistry.make_name(prefix=threads.index.name)) sync_locks = [s for s in sync_ops if s.is_SyncLock] condition = Or(*([CondNe(s.handle, 2) for s in sync_locks] + [CondNe(FieldFromComposite(sdata._field_flag, sdata[d]), 1)])) if threads.size == 1: activation = [While(condition)] else: activation = [DummyExpr(d, 0), While(condition, DummyExpr(d, (d + 1) % threads.size))] activation.extend([DummyExpr(FieldFromComposite(i.name, sdata[d]), i) for i in sdata.dynamic_fields]) activation.extend([DummyExpr(s.handle, 0) for s in sync_locks]) activation.append(DummyExpr(FieldFromComposite(sdata._field_flag, sdata[d]), 2)) activation = List( header=[c.Line(), c.Comment("Activate `%s`" % threads.name)], body=activation, footer=c.Line() ) return activation def _make_thread_finalize(threads, sdata): d = threads.index if threads.size == 1: callback = lambda body: body else: callback = lambda body: Iteration(body, d, threads.size - 1) threadswait = List( header=c.Comment("Wait for completion of `%s`" % threads.name), body=callback([ While(CondEq(FieldFromComposite(sdata._field_flag, sdata[d]), 2)), DummyExpr(FieldFromComposite(sdata._field_flag, sdata[d]), 0), Call('pthread_join', (threads[d], Macro('NULL'))) ]) ) return threadswait def make_thread_ctx(name, iet, root, npthreads, sync_ops, sregistry): """ Shortcut to create a ThreadFunction and all support data structures and routines to implement communication between the main thread and the child threads executing the ThreadFunction. """ threads = _make_threads(npthreads, sregistry) tfunc, isdata, sdata = _make_thread_func(name, iet, root, threads, sregistry) init = _make_thread_init(threads, tfunc, isdata, sdata, sregistry) activate = _make_thread_activate(threads, sdata, sync_ops, sregistry) finalize = _make_thread_finalize(threads, sdata) return ThreadCtx(threads, sdata, [tfunc, isdata], init, activate, finalize) # DeviceFunction machinery class DeviceFunction(Callable): """ A Callable executed asynchronously on a device. """ def __init__(self, name, body, retval='void', parameters=None, prefix='__global__'): super().__init__(name, body, retval, parameters=parameters, prefix=prefix)
[ 1, 529, 9507, 29958, 3359, 2049, 29914, 381, 29914, 2035, 29914, 1389, 4661, 29889, 2272, 13, 3166, 16250, 1053, 4257, 23583, 13, 13, 3166, 22152, 29918, 6799, 1053, 22152, 29918, 6799, 13, 3166, 5016, 2272, 1053, 1394, 13, 5215, 274, 1885, 408, 274, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 2906, 2049, 29889, 381, 29889, 2035, 29889, 18010, 1053, 313, 10358, 804, 3542, 29892, 8251, 29892, 8251, 519, 29892, 11790, 3245, 29892, 360, 406, 1659, 29892, 13, 462, 462, 360, 11770, 21176, 29892, 20504, 362, 29892, 2391, 29892, 3929, 1639, 15738, 29892, 7106, 29892, 5806, 29892, 13, 462, 462, 8251, 519, 8434, 29897, 13, 3166, 2906, 2049, 29889, 381, 29889, 2035, 29889, 13239, 1053, 21340, 29918, 16744, 29892, 2923, 29918, 16744, 13, 3166, 2906, 2049, 29889, 18098, 1199, 1053, 11790, 18630, 29892, 11790, 8139, 29892, 8989, 4591, 1523, 1066, 568, 29892, 8989, 4591, 14516, 29892, 4326, 307, 13, 3166, 2906, 2049, 29889, 8504, 1053, 408, 29918, 23583, 13, 3166, 2906, 2049, 29889, 8768, 1053, 349, 4899, 2588, 29892, 21236, 1469, 29892, 23858, 29892, 3929, 1639, 13, 13, 1649, 497, 1649, 353, 6024, 2642, 284, 6678, 742, 525, 2642, 284, 5594, 742, 525, 5675, 29918, 1389, 4661, 742, 13, 965, 525, 9634, 6678, 742, 525, 4899, 6678, 742, 525, 5675, 29918, 7097, 29918, 13073, 742, 13, 965, 525, 11501, 6678, 2033, 13, 13, 13, 29937, 10619, 284, 6678, 7672, 262, 708, 13, 13, 1990, 10619, 284, 6678, 29898, 5594, 519, 1125, 13, 13, 1678, 9995, 13, 1678, 319, 8251, 519, 15859, 263, 16287, 975, 385, 9846, 18635, 12541, 2913, 29889, 13, 13, 1678, 319, 8251, 304, 385, 10619, 284, 6678, 674, 376, 2611, 3656, 403, 29908, 1316, 12541, 2913, 491, 13, 1678, 1462, 5890, 13451, 322, 4331, 11924, 363, 1269, 4792, 2673, 9904, 297, 13, 1678, 4954, 16626, 29918, 16744, 29952, 1412, 13, 1678, 9995, 13, 13, 1678, 338, 29918, 2642, 284, 6678, 353, 5852, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 3573, 29892, 3240, 791, 29892, 4128, 29922, 8516, 29892, 10944, 29922, 877, 7959, 742, 525, 14764, 5477, 13, 462, 7343, 29918, 16744, 29922, 8516, 1125, 13, 4706, 2428, 29898, 2642, 284, 6678, 29892, 1583, 467, 1649, 2344, 12035, 978, 29892, 3573, 29892, 3240, 791, 29892, 4128, 29892, 10944, 29897, 13, 13, 4706, 1583, 3032, 655, 2496, 353, 6571, 13, 4706, 363, 474, 297, 408, 29918, 23583, 29898, 16626, 29918, 16744, 1125, 13, 9651, 565, 474, 29889, 275, 29918, 16142, 2673, 29901, 13, 18884, 1583, 3032, 655, 2496, 29961, 29875, 29962, 353, 313, 16744, 29889, 2248, 29898, 29875, 29889, 18098, 293, 29918, 1195, 511, 13, 462, 462, 259, 4128, 29889, 2248, 29898, 29875, 29889, 18098, 293, 29918, 3317, 876, 13, 9651, 1683, 29901, 13, 18884, 1583, 3032, 655, 2496, 29961, 29875, 29962, 353, 313, 16744, 29889, 2248, 29898, 29875, 511, 29897, 13, 13, 1678, 732, 29883, 3791, 29918, 6799, 13, 1678, 822, 7343, 29918, 4381, 29879, 29898, 1311, 1125, 13, 4706, 736, 426, 29895, 29901, 18761, 29898, 1311, 29889, 16744, 29961, 29875, 29962, 363, 474, 297, 325, 29897, 363, 413, 29892, 325, 297, 1583, 3032, 655, 2496, 29889, 7076, 28296, 13, 13, 1678, 822, 1207, 29918, 4804, 29898, 1311, 29892, 7343, 29918, 5085, 29918, 655, 2496, 29922, 8516, 29892, 5528, 29878, 29922, 8824, 29892, 337, 517, 29890, 29926, 29922, 8516, 29892, 13, 462, 29871, 338, 29918, 513, 1088, 29922, 8824, 1125, 13, 4706, 736, 10619, 284, 5594, 29898, 1311, 29889, 978, 29892, 1051, 29898, 1311, 29889, 16744, 511, 9657, 29898, 1311, 3032, 655, 2496, 511, 13, 462, 632, 7343, 29918, 5085, 29918, 655, 2496, 29892, 5528, 29878, 29892, 337, 517, 29890, 29926, 29892, 338, 29918, 513, 1088, 29897, 13, 13, 13, 1990, 10619, 284, 5594, 29898, 5594, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 6273, 29922, 8516, 29892, 611, 2496, 29922, 8516, 29892, 7343, 29918, 5085, 29918, 655, 2496, 29922, 8516, 29892, 13, 462, 5528, 29878, 29922, 8824, 29892, 337, 517, 29890, 29926, 29922, 8516, 29892, 338, 29918, 513, 1088, 29922, 8824, 1125, 13, 4706, 1583, 3032, 655, 2496, 353, 611, 2496, 470, 6571, 13, 13, 4706, 6273, 353, 1051, 29898, 294, 29918, 23583, 29898, 25699, 876, 13, 4706, 7343, 29918, 5085, 29918, 655, 2496, 353, 7343, 29918, 5085, 29918, 655, 2496, 470, 6571, 13, 4706, 363, 413, 29892, 325, 297, 7343, 29918, 5085, 29918, 655, 2496, 29889, 7076, 7295, 13, 9651, 9631, 353, 408, 29918, 23583, 29898, 29894, 29897, 13, 13, 9651, 396, 3087, 537, 1423, 13, 9651, 565, 413, 451, 297, 1583, 3032, 655, 2496, 29901, 13, 18884, 12020, 7865, 2392, 703, 29952, 29895, 29952, 338, 451, 263, 7343, 3443, 29908, 1273, 413, 29897, 13, 9651, 565, 7431, 29898, 1311, 3032, 655, 2496, 29961, 29895, 2314, 2804, 7431, 29898, 12427, 1125, 13, 18884, 12020, 7865, 2392, 703, 1252, 6021, 1273, 29881, 1819, 363, 7343, 3443, 22570, 29879, 1673, 2183, 1273, 29881, 29908, 13, 462, 462, 1273, 313, 2435, 29898, 1311, 3032, 655, 2496, 29961, 29895, 11724, 413, 29892, 7431, 29898, 12427, 4961, 13, 9651, 396, 6204, 278, 2980, 1051, 13, 9651, 363, 474, 29892, 432, 297, 14319, 29898, 1311, 3032, 655, 2496, 29961, 29895, 1402, 9631, 1125, 13, 18884, 6273, 29961, 29875, 29962, 353, 432, 565, 5528, 29878, 338, 7700, 1683, 313, 25699, 29961, 29875, 29962, 718, 432, 29897, 13, 13, 4706, 2428, 29898, 2642, 284, 5594, 29892, 1583, 467, 1649, 2344, 12035, 978, 29892, 6273, 29892, 337, 517, 29890, 29926, 29892, 338, 29918, 513, 1088, 29897, 13, 13, 1678, 822, 903, 276, 4282, 29898, 1311, 29892, 334, 5085, 29892, 7343, 29918, 5085, 29918, 655, 2496, 29922, 8516, 29892, 5528, 29878, 29922, 8824, 29892, 13, 462, 337, 517, 29890, 29926, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 396, 910, 10509, 267, 393, 421, 687, 3032, 276, 4282, 29898, 25699, 29922, 687, 29889, 25699, 29897, 1275, 21226, 29952, 13, 4706, 736, 2428, 29898, 2642, 284, 5594, 29892, 1583, 467, 29918, 276, 4282, 29898, 13, 9651, 334, 5085, 29892, 7343, 29918, 5085, 29918, 655, 2496, 29922, 16626, 29918, 5085, 29918, 655, 2496, 29892, 5528, 29878, 29922, 3742, 29878, 29892, 13, 9651, 337, 517, 29890, 29926, 29922, 276, 517, 29890, 29926, 29892, 3579, 19290, 13, 4706, 1723, 13, 13, 1678, 732, 29883, 3791, 29918, 6799, 13, 1678, 822, 7343, 29918, 4381, 29879, 29898, 1311, 1125, 13, 4706, 736, 426, 29895, 29901, 18761, 29898, 1311, 29889, 25699, 29961, 29875, 29962, 363, 474, 297, 325, 29897, 363, 413, 29892, 325, 297, 1583, 3032, 655, 2496, 29889, 7076, 28296, 13, 13, 13, 1753, 1207, 29918, 1389, 4661, 29898, 978, 29892, 474, 300, 29892, 7343, 29918, 16744, 29922, 8516, 29892, 3240, 791, 2433, 5405, 742, 10944, 2433, 7959, 29374, 13, 1678, 9995, 13, 1678, 13899, 7582, 304, 1653, 385, 10619, 284, 6678, 29889, 13, 1678, 9995, 13, 1678, 736, 10619, 284, 6678, 29898, 978, 29892, 474, 300, 29892, 3240, 791, 29892, 21340, 29918, 16744, 29898, 2035, 511, 10944, 29892, 13, 462, 632, 7343, 29918, 16744, 29897, 13, 13, 13, 29937, 28236, 6678, 7672, 262, 708, 13, 13, 1990, 28236, 6678, 29898, 5594, 519, 1125, 13, 1678, 1209, 13, 13, 13, 29937, 10480, 6678, 7672, 262, 708, 13, 13, 4899, 29907, 7508, 353, 4257, 23583, 877, 4899, 29907, 7508, 742, 525, 28993, 269, 1272, 2090, 2395, 2069, 5039, 403, 2186, 675, 1495, 13, 13, 13, 1990, 10480, 6678, 29898, 5594, 519, 1125, 13, 13, 1678, 9995, 13, 1678, 319, 8251, 519, 8283, 408, 9524, 5794, 491, 263, 5004, 3244, 29889, 13, 1678, 9995, 13, 13, 1678, 1209, 13, 13, 13, 1753, 903, 5675, 29918, 28993, 29898, 1767, 29892, 269, 1727, 6020, 1125, 13, 1678, 1024, 353, 269, 1727, 6020, 29889, 5675, 29918, 978, 29898, 13506, 2433, 28993, 1495, 13, 13, 1678, 2967, 29918, 333, 353, 29871, 29896, 718, 2533, 29898, 29875, 29889, 2311, 363, 474, 297, 269, 1727, 6020, 29889, 9302, 28993, 29897, 13, 13, 1678, 565, 995, 338, 6213, 29901, 13, 4706, 396, 450, 7442, 28993, 23858, 3508, 29915, 29873, 2869, 1304, 29892, 541, 591, 2407, 278, 2114, 13, 4706, 396, 393, 777, 716, 282, 28993, 505, 1063, 19591, 13, 4706, 269, 1727, 6020, 29889, 5675, 29918, 9302, 28993, 29898, 29896, 29897, 13, 4706, 7442, 28993, 353, 29871, 29896, 13, 1678, 1683, 29901, 13, 4706, 7442, 28993, 353, 269, 1727, 6020, 29889, 5675, 29918, 9302, 28993, 29898, 1767, 29897, 13, 13, 1678, 9717, 353, 349, 4899, 2588, 29898, 978, 29922, 978, 29892, 7442, 28993, 29922, 9302, 28993, 29892, 2967, 29918, 333, 29922, 3188, 29918, 333, 29897, 13, 13, 1678, 736, 9717, 13, 13, 13, 1753, 903, 5675, 29918, 7097, 29918, 2344, 29898, 28993, 29892, 260, 9891, 29892, 338, 1272, 29892, 269, 1272, 29892, 269, 1727, 6020, 1125, 13, 1678, 270, 353, 9717, 29889, 2248, 13, 1678, 565, 9717, 29889, 2311, 1275, 29871, 29896, 29901, 13, 4706, 6939, 353, 14013, 3573, 29901, 3573, 13, 1678, 1683, 29901, 13, 4706, 6939, 353, 14013, 3573, 29901, 20504, 362, 29898, 2587, 29892, 270, 29892, 9717, 29889, 2311, 448, 29871, 29896, 29897, 13, 13, 1678, 396, 319, 5412, 15882, 363, 1269, 2825, 282, 7097, 13, 1678, 282, 7097, 333, 353, 270, 718, 9717, 29889, 3188, 29918, 333, 13, 13, 1678, 396, 25455, 421, 29879, 1272, 29952, 13, 1678, 6273, 353, 1051, 29898, 275, 1272, 29889, 16744, 29897, 13, 1678, 6273, 14352, 29941, 29962, 353, 269, 1272, 29889, 18098, 293, 29918, 3188, 718, 270, 13, 1678, 6273, 14352, 29906, 29962, 353, 282, 7097, 333, 13, 1678, 6273, 14352, 29896, 29962, 353, 269, 1727, 6020, 29889, 10141, 333, 13, 1678, 1246, 29900, 353, 8251, 29898, 275, 1272, 29889, 978, 29892, 6273, 29897, 13, 13, 1678, 396, 6204, 282, 28993, 13, 1678, 1246, 29896, 353, 8251, 877, 29886, 7097, 29918, 3258, 742, 313, 28993, 29889, 18098, 293, 29918, 3188, 718, 270, 29892, 13, 462, 462, 1678, 4326, 307, 877, 10074, 5477, 13, 462, 462, 1678, 8251, 29898, 29873, 9891, 29889, 978, 29892, 19997, 338, 29918, 513, 1088, 29922, 5574, 511, 13, 462, 462, 1678, 269, 1272, 29889, 18098, 293, 29918, 3188, 718, 270, 876, 13, 13, 1678, 9717, 2344, 353, 2391, 29898, 13, 4706, 4839, 29922, 29883, 29889, 20001, 703, 18654, 701, 322, 11905, 22570, 29879, 29952, 29908, 1273, 9717, 29889, 978, 511, 13, 4706, 3573, 29922, 14035, 4197, 4804, 29900, 29892, 1246, 29896, 2314, 13, 1678, 1723, 13, 13, 1678, 736, 9717, 2344, 13, 13, 13, 1753, 903, 5675, 29918, 7097, 29918, 9891, 29898, 978, 29892, 474, 300, 29892, 3876, 29892, 9717, 29892, 269, 1727, 6020, 1125, 13, 1678, 25349, 353, 21236, 1469, 3032, 18098, 293, 29918, 333, 13, 1678, 269, 10141, 333, 353, 21236, 1469, 3032, 18098, 293, 29918, 10141, 333, 13, 13, 1678, 396, 6204, 278, 21236, 1469, 29892, 393, 338, 278, 848, 3829, 393, 674, 367, 1304, 491, 278, 13, 1678, 396, 1667, 3244, 304, 1209, 2472, 270, 1242, 304, 278, 2278, 3244, 29898, 29879, 29897, 13, 1678, 3734, 29892, 4128, 29892, 7343, 29918, 16744, 353, 2923, 29918, 16744, 29898, 2035, 29892, 3876, 29892, 518, 29879, 333, 2314, 13, 1678, 4128, 353, 12705, 29898, 16744, 29892, 1820, 29922, 2892, 474, 29901, 474, 29889, 275, 29918, 6678, 29897, 29871, 396, 29408, 23013, 13, 1678, 269, 1272, 353, 21236, 1469, 29898, 978, 29922, 29879, 1727, 6020, 29889, 5675, 29918, 978, 29898, 13506, 2433, 29879, 1272, 5477, 7442, 28993, 29922, 28993, 29889, 2311, 29892, 13, 462, 539, 4235, 29922, 12403, 29892, 7343, 29918, 9621, 29922, 16626, 29918, 16744, 29897, 13, 13, 1678, 396, 6204, 263, 8251, 519, 304, 11905, 421, 29879, 1272, 29952, 411, 278, 2998, 1040, 1819, 13, 1678, 269, 3188, 353, 269, 1272, 29889, 18098, 293, 29918, 3188, 13, 1678, 297, 420, 353, 525, 2344, 29918, 29995, 29879, 29915, 1273, 269, 1272, 29889, 29881, 1853, 3032, 1853, 5396, 1649, 978, 1649, 13, 1678, 474, 2587, 353, 518, 29928, 11770, 21176, 29898, 3073, 4591, 14516, 29898, 29875, 3032, 29907, 29918, 978, 29892, 269, 3188, 511, 474, 3032, 29907, 29918, 18098, 29897, 13, 632, 363, 474, 297, 4128, 29962, 13, 1678, 474, 2587, 29889, 21843, 4197, 13, 4706, 3164, 804, 3542, 29892, 13, 4706, 360, 11770, 21176, 29898, 3073, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 333, 29892, 269, 3188, 511, 25349, 511, 13, 4706, 360, 11770, 21176, 29898, 3073, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 10141, 333, 29892, 269, 3188, 511, 269, 10141, 333, 511, 13, 4706, 360, 11770, 21176, 29898, 3073, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 3188, 511, 29871, 29896, 29897, 13, 268, 2314, 13, 1678, 474, 16744, 353, 4128, 718, 518, 29879, 1272, 29892, 25349, 29892, 269, 10141, 333, 29962, 13, 1678, 338, 1272, 353, 8251, 519, 29898, 262, 420, 29892, 474, 2587, 29892, 525, 5405, 742, 474, 16744, 29892, 525, 7959, 1495, 13, 13, 1678, 396, 349, 3445, 355, 278, 21236, 1469, 4235, 3625, 2501, 3244, 26229, 13, 1678, 758, 7387, 353, 518, 29928, 11770, 21176, 29898, 29875, 29892, 8989, 4591, 14516, 29898, 29875, 29889, 978, 29892, 269, 3188, 876, 13, 462, 29871, 363, 474, 297, 7343, 29918, 16744, 29962, 13, 13, 1678, 396, 22871, 278, 7353, 10092, 13, 1678, 1400, 7387, 353, 518, 1293, 29898, 2587, 11759, 13, 4706, 3164, 804, 3542, 29892, 13, 4706, 360, 11770, 21176, 29898, 3073, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 3188, 511, 29871, 29896, 29897, 13, 268, 2314, 29962, 13, 13, 1678, 474, 300, 353, 2391, 29898, 2587, 29922, 1457, 7387, 718, 518, 2035, 29962, 718, 1400, 7387, 29897, 13, 13, 1678, 396, 450, 3244, 756, 664, 304, 437, 746, 372, 20586, 278, 7182, 393, 599, 658, 4684, 505, 13, 1678, 396, 1063, 731, 304, 29871, 29900, 491, 278, 1667, 3244, 13, 1678, 474, 300, 353, 11790, 3245, 29898, 10983, 18630, 29898, 3073, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 3188, 511, 29871, 29906, 511, 474, 300, 29897, 13, 13, 1678, 396, 450, 3244, 14874, 10917, 1076, 2745, 278, 18758, 7353, 338, 731, 304, 29871, 29900, 491, 278, 1667, 3244, 13, 1678, 474, 300, 353, 5806, 29898, 10983, 8139, 29898, 3073, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 3188, 511, 29871, 29900, 511, 474, 300, 29897, 13, 13, 1678, 396, 282, 7097, 3168, 2149, 3721, 697, 2980, 29892, 263, 1780, 15966, 322, 1818, 736, 1780, 29930, 13, 1678, 260, 2267, 791, 353, 525, 5405, 29930, 29915, 13, 1678, 260, 15501, 353, 3929, 1639, 29898, 978, 2433, 29918, 29995, 29879, 29915, 1273, 269, 1272, 29889, 978, 29892, 26688, 29922, 9302, 29889, 5405, 29897, 13, 13, 1678, 396, 853, 4058, 421, 29879, 1272, 29952, 13, 1678, 443, 4058, 353, 518, 14516, 15738, 29898, 29879, 1272, 29892, 260, 15501, 511, 3164, 804, 3542, 29962, 13, 1678, 363, 474, 297, 4128, 29901, 13, 4706, 565, 474, 29889, 275, 29918, 9118, 6678, 29901, 13, 9651, 443, 4058, 29889, 4397, 29898, 29928, 406, 1659, 29898, 29875, 29892, 269, 1272, 876, 13, 4706, 1683, 29901, 13, 9651, 443, 4058, 29889, 4397, 29898, 29928, 11770, 21176, 29898, 29875, 29892, 8989, 4591, 14516, 29898, 29875, 29889, 978, 29892, 269, 3188, 4961, 13, 1678, 443, 4058, 29889, 4397, 29898, 29928, 11770, 21176, 29898, 29879, 333, 29892, 8989, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 333, 29892, 269, 3188, 4961, 13, 1678, 443, 4058, 29889, 4397, 29898, 29928, 11770, 21176, 29898, 29879, 10141, 333, 29892, 8989, 4591, 14516, 29898, 29879, 1272, 3032, 2671, 29918, 10141, 333, 29892, 269, 3188, 4961, 13, 13, 1678, 474, 300, 353, 8251, 519, 8434, 4197, 2035, 29892, 7106, 29898, 15735, 307, 877, 10074, 8785, 1402, 443, 4058, 29879, 29922, 348, 4058, 29897, 13, 13, 1678, 260, 9891, 353, 10480, 6678, 29898, 978, 29892, 474, 300, 29892, 260, 2267, 791, 29892, 260, 15501, 29892, 525, 7959, 1495, 13, 13, 1678, 736, 260, 9891, 29892, 338, 1272, 29892, 269, 1272, 13, 13, 13, 1753, 903, 5675, 29918, 7097, 29918, 11236, 403, 29898, 28993, 29892, 269, 1272, 29892, 16523, 29918, 3554, 29892, 269, 1727, 6020, 1125, 13, 1678, 565, 9717, 29889, 2311, 1275, 29871, 29896, 29901, 13, 4706, 270, 353, 9717, 29889, 2248, 13, 1678, 1683, 29901, 13, 4706, 270, 353, 23858, 29898, 978, 29922, 29879, 1727, 6020, 29889, 5675, 29918, 978, 29898, 13506, 29922, 28993, 29889, 2248, 29889, 978, 876, 13, 13, 1678, 16523, 29918, 908, 29879, 353, 518, 29879, 363, 269, 297, 16523, 29918, 3554, 565, 269, 29889, 275, 29918, 21077, 16542, 29962, 13, 1678, 4195, 353, 1394, 10456, 4197, 10983, 8139, 29898, 29879, 29889, 8411, 29892, 29871, 29906, 29897, 363, 269, 297, 16523, 29918, 908, 29879, 29962, 718, 13, 462, 268, 518, 10983, 8139, 29898, 3073, 4591, 1523, 1066, 568, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 1272, 29961, 29881, 11724, 29871, 29896, 4638, 876, 13, 13, 1678, 565, 9717, 29889, 2311, 1275, 29871, 29896, 29901, 13, 4706, 26229, 353, 518, 8809, 488, 29898, 16122, 4638, 13, 1678, 1683, 29901, 13, 4706, 26229, 353, 518, 29928, 11770, 21176, 29898, 29881, 29892, 29871, 29900, 511, 13, 462, 418, 5806, 29898, 16122, 29892, 360, 11770, 21176, 29898, 29881, 29892, 313, 29881, 718, 29871, 29896, 29897, 1273, 9717, 29889, 2311, 28166, 13, 13, 1678, 26229, 29889, 21843, 4197, 29928, 11770, 21176, 29898, 3073, 4591, 1523, 1066, 568, 29898, 29875, 29889, 978, 29892, 269, 1272, 29961, 29881, 11724, 474, 29897, 13, 462, 539, 363, 474, 297, 269, 1272, 29889, 16626, 29918, 9621, 2314, 13, 1678, 26229, 29889, 21843, 4197, 29928, 11770, 21176, 29898, 29879, 29889, 8411, 29892, 29871, 29900, 29897, 363, 269, 297, 16523, 29918, 908, 29879, 2314, 13, 1678, 26229, 29889, 4397, 29898, 29928, 11770, 21176, 29898, 3073, 4591, 1523, 1066, 568, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 1272, 29961, 29881, 11724, 29871, 29906, 876, 13, 1678, 26229, 353, 2391, 29898, 13, 4706, 4839, 11759, 29883, 29889, 3542, 3285, 274, 29889, 20001, 703, 21786, 403, 22570, 29879, 29952, 29908, 1273, 9717, 29889, 978, 29897, 1402, 13, 4706, 3573, 29922, 11236, 362, 29892, 13, 4706, 24166, 29922, 29883, 29889, 3542, 580, 13, 1678, 1723, 13, 13, 1678, 736, 26229, 13, 13, 13, 1753, 903, 5675, 29918, 7097, 29918, 8394, 675, 29898, 28993, 29892, 269, 1272, 1125, 13, 1678, 270, 353, 9717, 29889, 2248, 13, 1678, 565, 9717, 29889, 2311, 1275, 29871, 29896, 29901, 13, 4706, 6939, 353, 14013, 3573, 29901, 3573, 13, 1678, 1683, 29901, 13, 4706, 6939, 353, 14013, 3573, 29901, 20504, 362, 29898, 2587, 29892, 270, 29892, 9717, 29889, 2311, 448, 29871, 29896, 29897, 13, 13, 1678, 3244, 2774, 1249, 353, 2391, 29898, 13, 4706, 4839, 29922, 29883, 29889, 20001, 703, 15716, 363, 13285, 310, 22570, 29879, 29952, 29908, 1273, 9717, 29889, 978, 511, 13, 4706, 3573, 29922, 14035, 4197, 13, 9651, 5806, 29898, 10983, 18630, 29898, 3073, 4591, 1523, 1066, 568, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 1272, 29961, 29881, 11724, 29871, 29906, 8243, 13, 9651, 360, 11770, 21176, 29898, 3073, 4591, 1523, 1066, 568, 29898, 29879, 1272, 3032, 2671, 29918, 15581, 29892, 269, 1272, 29961, 29881, 11724, 29871, 29900, 511, 13, 9651, 8251, 877, 29886, 7097, 29918, 7122, 742, 313, 28993, 29961, 29881, 1402, 4326, 307, 877, 10074, 29915, 4961, 13, 308, 2314, 13, 1678, 1723, 13, 13, 1678, 736, 3244, 2774, 1249, 13, 13, 13, 1753, 1207, 29918, 7097, 29918, 13073, 29898, 978, 29892, 474, 300, 29892, 3876, 29892, 7442, 28993, 29892, 16523, 29918, 3554, 29892, 269, 1727, 6020, 1125, 13, 1678, 9995, 13, 1678, 13899, 7582, 304, 1653, 263, 10480, 6678, 322, 599, 2304, 848, 12286, 322, 13, 1678, 6745, 1475, 304, 2334, 12084, 1546, 278, 1667, 3244, 322, 278, 2278, 13, 1678, 9717, 14012, 278, 10480, 6678, 29889, 13, 1678, 9995, 13, 1678, 9717, 353, 903, 5675, 29918, 28993, 29898, 9302, 28993, 29892, 269, 1727, 6020, 29897, 13, 1678, 260, 9891, 29892, 338, 1272, 29892, 269, 1272, 353, 903, 5675, 29918, 7097, 29918, 9891, 29898, 978, 29892, 474, 300, 29892, 3876, 29892, 9717, 29892, 269, 1727, 6020, 29897, 13, 1678, 2069, 353, 903, 5675, 29918, 7097, 29918, 2344, 29898, 28993, 29892, 260, 9891, 29892, 338, 1272, 29892, 269, 1272, 29892, 269, 1727, 6020, 29897, 13, 1678, 5039, 403, 353, 903, 5675, 29918, 7097, 29918, 11236, 403, 29898, 28993, 29892, 269, 1272, 29892, 16523, 29918, 3554, 29892, 269, 1727, 6020, 29897, 13, 1678, 2186, 675, 353, 903, 5675, 29918, 7097, 29918, 8394, 675, 29898, 28993, 29892, 269, 1272, 29897, 13, 13, 1678, 736, 10480, 29907, 7508, 29898, 28993, 29892, 269, 1272, 29892, 518, 29873, 9891, 29892, 338, 1272, 1402, 2069, 29892, 5039, 403, 29892, 2186, 675, 29897, 13, 13, 13, 29937, 21830, 6678, 7672, 262, 708, 13, 13, 13, 1990, 21830, 6678, 29898, 5594, 519, 1125, 13, 13, 1678, 9995, 13, 1678, 319, 8251, 519, 8283, 408, 9524, 5794, 373, 263, 4742, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 3573, 29892, 3240, 791, 2433, 5405, 742, 4128, 29922, 8516, 29892, 10944, 2433, 1649, 10945, 1649, 29374, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29892, 3573, 29892, 3240, 791, 29892, 4128, 29922, 16744, 29892, 10944, 29922, 13506, 29897, 13, 2 ]
src/opencmiss/utils/iron/bindings/python/opencmiss/iron/_utils.in.py
tsalemink/opencmiss.utils
0
48226
"""Utility routines and classes used by OpenCMISS """ from . import _@IRON_PYTHON_MODULE@ class CMFEError(Exception): """Base class for errors in the OpenCMISS library""" pass class CMFEType(object): """Base class for all OpenCMISS types""" pass class Enum(object): pass def wrap_cmiss_routine(routine, args=None): """Wrap a call to the OpenCMISS SWIG module Call the routine and check the return value, and raise an exception if it is non-zero. Return any other remaining return values. """ if args is None: r = routine() else: #Replace wrapped cmiss types with the underlying type new_args = [] for arg in args: if hasattr(arg, 'cmiss_type'): new_args.append(arg.cmiss_type) else: try: # Try to convert a list of CMISS types first. # Check length to avoid empty strings being converted # to an empty list if len(arg) > 0: new_args.append([a.cmiss_type for a in arg]) else: new_args.append(arg) except (TypeError, AttributeError): new_args.append(arg) r = routine(*new_args) # We will either have a list of multiple return values, or # a single status code as a return. Don't have to worry about # ever having a single return value as a list as there will always # be at least a return status. if isinstance(r, list): status = r[0] if len(r) == 1: return_val = None elif len(r) == 2: return_val = r[1] else: return_val = r[1:] else: status = r return_val = None if status != _@[email protected]_NO_ERROR: if status == _@[email protected]_POINTER_IS_NULL: raise CMFEError("CMFE type pointer is null") elif status == _@[email protected]_POINTER_NOT_NULL: raise CMFEError("CMFE type pointer is not null") elif status == _@[email protected]_COULD_NOT_ALLOCATE_POINTER: raise CMFEError("Could not allocate pointer") elif status == _@[email protected]_ERROR_CONVERTING_POINTER: raise CMFEError("Error converting pointer") else: raise CMFEError(_@[email protected]_ExtractErrorMessage()[1]) return return_val
[ 1, 9995, 7270, 537, 6745, 1475, 322, 4413, 1304, 491, 4673, 29907, 10403, 1799, 13, 15945, 29908, 13, 13, 3166, 869, 1053, 903, 29992, 8193, 1164, 29918, 20055, 4690, 1164, 29918, 6720, 14849, 1307, 29992, 13, 13, 13, 1990, 315, 29924, 16359, 2392, 29898, 2451, 1125, 13, 1678, 9995, 5160, 770, 363, 4436, 297, 278, 4673, 29907, 10403, 1799, 3489, 15945, 29908, 13, 13, 1678, 1209, 13, 13, 13, 1990, 315, 29924, 16359, 1542, 29898, 3318, 1125, 13, 1678, 9995, 5160, 770, 363, 599, 4673, 29907, 10403, 1799, 4072, 15945, 29908, 13, 13, 1678, 1209, 13, 13, 13, 1990, 1174, 398, 29898, 3318, 1125, 13, 1678, 1209, 13, 13, 13, 1753, 12244, 29918, 4912, 790, 29918, 14608, 457, 29898, 14608, 457, 29892, 6389, 29922, 8516, 1125, 13, 1678, 9995, 29956, 2390, 263, 1246, 304, 278, 4673, 29907, 10403, 1799, 25289, 6259, 3883, 13, 13, 1678, 8251, 278, 26529, 322, 1423, 278, 736, 995, 29892, 322, 12020, 385, 13, 1678, 3682, 565, 372, 338, 1661, 29899, 9171, 29889, 13, 13, 1678, 7106, 738, 916, 9886, 736, 1819, 29889, 13, 13, 1678, 9995, 13, 1678, 565, 6389, 338, 6213, 29901, 13, 4706, 364, 353, 26529, 580, 13, 1678, 1683, 29901, 13, 4706, 396, 20083, 21021, 7477, 790, 4072, 411, 278, 14407, 1134, 13, 4706, 716, 29918, 5085, 353, 5159, 13, 4706, 363, 1852, 297, 6389, 29901, 13, 9651, 565, 756, 5552, 29898, 1191, 29892, 525, 4912, 790, 29918, 1853, 29374, 13, 18884, 716, 29918, 5085, 29889, 4397, 29898, 1191, 29889, 4912, 790, 29918, 1853, 29897, 13, 9651, 1683, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 396, 3967, 304, 3588, 263, 1051, 310, 315, 10403, 1799, 4072, 937, 29889, 13, 462, 1678, 396, 5399, 3309, 304, 4772, 4069, 6031, 1641, 11543, 13, 462, 1678, 396, 304, 385, 4069, 1051, 13, 462, 1678, 565, 7431, 29898, 1191, 29897, 1405, 29871, 29900, 29901, 13, 462, 4706, 716, 29918, 5085, 29889, 4397, 4197, 29874, 29889, 4912, 790, 29918, 1853, 363, 263, 297, 1852, 2314, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 716, 29918, 5085, 29889, 4397, 29898, 1191, 29897, 13, 18884, 5174, 313, 1542, 2392, 29892, 23833, 2392, 1125, 13, 462, 1678, 716, 29918, 5085, 29889, 4397, 29898, 1191, 29897, 13, 4706, 364, 353, 26529, 10456, 1482, 29918, 5085, 29897, 13, 1678, 396, 1334, 674, 2845, 505, 263, 1051, 310, 2999, 736, 1819, 29892, 470, 13, 1678, 396, 263, 2323, 4660, 775, 408, 263, 736, 29889, 3872, 29915, 29873, 505, 304, 15982, 1048, 13, 1678, 396, 3926, 2534, 263, 2323, 736, 995, 408, 263, 1051, 408, 727, 674, 2337, 13, 1678, 396, 367, 472, 3203, 263, 736, 4660, 29889, 13, 1678, 565, 338, 8758, 29898, 29878, 29892, 1051, 1125, 13, 4706, 4660, 353, 364, 29961, 29900, 29962, 13, 4706, 565, 7431, 29898, 29878, 29897, 1275, 29871, 29896, 29901, 13, 9651, 736, 29918, 791, 353, 6213, 13, 4706, 25342, 7431, 29898, 29878, 29897, 1275, 29871, 29906, 29901, 13, 9651, 736, 29918, 791, 353, 364, 29961, 29896, 29962, 13, 4706, 1683, 29901, 13, 9651, 736, 29918, 791, 353, 364, 29961, 29896, 17531, 13, 1678, 1683, 29901, 13, 4706, 4660, 353, 364, 13, 4706, 736, 29918, 791, 353, 6213, 13, 1678, 565, 4660, 2804, 903, 29992, 8193, 1164, 29918, 20055, 4690, 1164, 29918, 6720, 14849, 1307, 29992, 29889, 29883, 1707, 29889, 24494, 16359, 29918, 6632, 29918, 11432, 29901, 13, 4706, 565, 4660, 1275, 903, 29992, 8193, 1164, 29918, 20055, 4690, 1164, 29918, 6720, 14849, 1307, 29992, 29889, 29883, 1707, 29889, 24494, 16359, 29918, 29925, 6992, 4945, 29918, 3235, 29918, 10074, 29901, 13, 9651, 12020, 315, 29924, 16359, 2392, 703, 24494, 16359, 1134, 4879, 338, 1870, 1159, 13, 4706, 25342, 4660, 1275, 903, 29992, 8193, 1164, 29918, 20055, 4690, 1164, 29918, 6720, 14849, 1307, 29992, 29889, 29883, 1707, 29889, 24494, 16359, 29918, 29925, 6992, 4945, 29918, 12256, 29918, 10074, 29901, 13, 9651, 12020, 315, 29924, 16359, 2392, 703, 24494, 16359, 1134, 4879, 338, 451, 1870, 1159, 13, 4706, 25342, 4660, 1275, 903, 29992, 8193, 1164, 29918, 20055, 4690, 1164, 29918, 6720, 14849, 1307, 29992, 29889, 29883, 1707, 29889, 24494, 16359, 29918, 3217, 29965, 10249, 29918, 12256, 29918, 1964, 16652, 3040, 29918, 29925, 6992, 4945, 29901, 13, 9651, 12020, 315, 29924, 16359, 2392, 703, 23323, 451, 23632, 4879, 1159, 13, 4706, 25342, 4660, 1275, 903, 29992, 8193, 1164, 29918, 20055, 4690, 1164, 29918, 6720, 14849, 1307, 29992, 29889, 29883, 1707, 29889, 24494, 16359, 29918, 11432, 29918, 6007, 5348, 29911, 4214, 29918, 29925, 6992, 4945, 29901, 13, 9651, 12020, 315, 29924, 16359, 2392, 703, 2392, 17415, 4879, 1159, 13, 4706, 1683, 29901, 13, 9651, 12020, 315, 29924, 16359, 2392, 7373, 29992, 8193, 1164, 29918, 20055, 4690, 1164, 29918, 6720, 14849, 1307, 29992, 29889, 4912, 1725, 29918, 5647, 1461, 2392, 3728, 580, 29961, 29896, 2314, 13, 1678, 736, 736, 29918, 791, 13, 2 ]
filesystems/click.py
Julian/Filesystems
2
37021
<reponame>Julian/Filesystems<gh_stars>1-10 """ Click support for `filesystems.Path`. """ from __future__ import absolute_import import click import filesystems class Path(click.ParamType): name = "path" def convert(self, value, param, context): if not isinstance(value, str): return value return filesystems.Path.from_string(value) PATH = Path()
[ 1, 529, 276, 1112, 420, 29958, 27501, 713, 29914, 10547, 973, 29879, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 15945, 29908, 13, 4164, 2304, 363, 421, 5325, 973, 29879, 29889, 2605, 1412, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 13, 5215, 2828, 13, 13, 5215, 22101, 29879, 13, 13, 13, 1990, 10802, 29898, 3808, 29889, 4736, 1542, 1125, 13, 13, 1678, 1024, 353, 376, 2084, 29908, 13, 13, 1678, 822, 3588, 29898, 1311, 29892, 995, 29892, 1828, 29892, 3030, 1125, 13, 4706, 565, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 9651, 736, 995, 13, 4706, 736, 22101, 29879, 29889, 2605, 29889, 3166, 29918, 1807, 29898, 1767, 29897, 13, 13, 13, 10145, 353, 10802, 580, 13, 2 ]
grr/server/hunts/results.py
nickamon/grr
0
2748
<gh_stars>0 #!/usr/bin/env python """Classes to store and manage hunt results. """ from grr.lib import rdfvalue from grr.lib import registry from grr.lib.rdfvalues import structs as rdf_structs from grr_response_proto import jobs_pb2 from grr.server import access_control from grr.server import aff4 from grr.server import data_store from grr.server import sequential_collection from grr.server.aff4_objects import aff4_queue class HuntResultNotification(rdf_structs.RDFProtoStruct): protobuf = jobs_pb2.HuntResultNotification rdf_deps = [ rdfvalue.RDFDatetime, rdfvalue.RDFURN, ] def ResultRecord(self): # TODO(amoser): The subpath could be part of the notification. return data_store.Record( queue_id=self.result_collection_urn, timestamp=self.timestamp, suffix=self.suffix, subpath="Results", value=None) RESULT_NOTIFICATION_QUEUE = rdfvalue.RDFURN("aff4:/hunt_results_queue") class HuntResultQueue(aff4_queue.Queue): """A global queue of hunt results which need to be processed.""" rdf_type = HuntResultNotification @classmethod def ClaimNotificationsForCollection(cls, token=None, start_time=None, lease_time=200, collection=None): """Return unclaimed hunt result notifications for collection. Args: token: The security token to perform database operations with. start_time: If set, an RDFDateTime indicating at what point to start claiming notifications. Only notifications with a timestamp after this point will be claimed. lease_time: How long to claim the notifications for. collection: The urn of the collection to find notifications for. If unset, the earliest (unclaimed) notification will determine the collection. Returns: A pair (collection, results) where collection is the collection that notifications were retrieved for and results is a list of Record objects which identify GrrMessage within the result collection. """ class CollectionFilter(object): def __init__(self, collection): self.collection = collection def FilterRecord(self, notification): if self.collection is None: self.collection = notification.result_collection_urn return self.collection != notification.result_collection_urn f = CollectionFilter(collection) results = [] with aff4.FACTORY.OpenWithLock( RESULT_NOTIFICATION_QUEUE, aff4_type=HuntResultQueue, lease_time=300, blocking=True, blocking_sleep_interval=15, blocking_lock_timeout=600, token=token) as queue: for record in queue.ClaimRecords( record_filter=f.FilterRecord, start_time=start_time, timeout=lease_time, limit=100000): results.append(record) return (f.collection, results) @classmethod def DeleteNotifications(cls, records, token=None): """Delete hunt notifications.""" cls.DeleteRecords(records, token=token) class HuntResultCollection(sequential_collection.GrrMessageCollection): """Sequential HuntResultCollection.""" @classmethod def StaticAdd(cls, collection_urn, rdf_value, mutation_pool=None, timestamp=None, suffix=None, **kwargs): ts = super(HuntResultCollection, cls).StaticAdd( collection_urn, rdf_value, mutation_pool=mutation_pool, timestamp=timestamp, suffix=suffix, **kwargs) HuntResultQueue.StaticAdd( RESULT_NOTIFICATION_QUEUE, HuntResultNotification( result_collection_urn=collection_urn, timestamp=ts[0], suffix=ts[1]), mutation_pool=mutation_pool) return ts class ResultQueueInitHook(registry.InitHook): pre = [aff4.AFF4InitHook] def Run(self): try: with aff4.FACTORY.Create( RESULT_NOTIFICATION_QUEUE, HuntResultQueue, mode="w", token=aff4.FACTORY.root_token): pass except access_control.UnauthorizedAccess: pass
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 27403, 304, 3787, 322, 10933, 298, 1657, 2582, 29889, 13, 15945, 29908, 13, 13, 3166, 867, 29878, 29889, 1982, 1053, 364, 2176, 1767, 13, 3166, 867, 29878, 29889, 1982, 1053, 21235, 13, 3166, 867, 29878, 29889, 1982, 29889, 29878, 2176, 5975, 1053, 2281, 29879, 408, 364, 2176, 29918, 4984, 29879, 13, 3166, 867, 29878, 29918, 5327, 29918, 17529, 1053, 17643, 29918, 24381, 29906, 13, 3166, 867, 29878, 29889, 2974, 1053, 2130, 29918, 6451, 13, 3166, 867, 29878, 29889, 2974, 1053, 2756, 29946, 13, 3166, 867, 29878, 29889, 2974, 1053, 848, 29918, 8899, 13, 3166, 867, 29878, 29889, 2974, 1053, 8617, 2556, 29918, 10855, 13, 3166, 867, 29878, 29889, 2974, 29889, 3470, 29946, 29918, 12650, 1053, 2756, 29946, 29918, 9990, 13, 13, 13, 1990, 379, 1657, 3591, 12958, 29898, 29878, 2176, 29918, 4984, 29879, 29889, 29934, 4037, 1184, 517, 19560, 1125, 13, 29871, 17814, 9721, 353, 17643, 29918, 24381, 29906, 29889, 29950, 1657, 3591, 12958, 13, 29871, 364, 2176, 29918, 311, 567, 353, 518, 13, 418, 364, 2176, 1767, 29889, 29934, 4037, 16390, 5410, 29892, 13, 418, 364, 2176, 1767, 29889, 29934, 4037, 24015, 29892, 13, 29871, 4514, 13, 13, 29871, 822, 7867, 9182, 29898, 1311, 1125, 13, 1678, 396, 14402, 29898, 14054, 261, 1125, 450, 1014, 2084, 1033, 367, 760, 310, 278, 12519, 29889, 13, 1678, 736, 848, 29918, 8899, 29889, 9182, 29898, 13, 4706, 9521, 29918, 333, 29922, 1311, 29889, 2914, 29918, 10855, 29918, 595, 29892, 13, 4706, 14334, 29922, 1311, 29889, 16394, 29892, 13, 4706, 25557, 29922, 1311, 29889, 2146, 600, 861, 29892, 13, 4706, 1014, 2084, 543, 12191, 613, 13, 4706, 995, 29922, 8516, 29897, 13, 13, 13, 15989, 8647, 29918, 12256, 6545, 28541, 29918, 11144, 4462, 353, 364, 2176, 1767, 29889, 29934, 4037, 24015, 703, 3470, 29946, 8419, 29882, 1657, 29918, 9902, 29918, 9990, 1159, 13, 13, 13, 1990, 379, 1657, 3591, 10620, 29898, 3470, 29946, 29918, 9990, 29889, 10620, 1125, 13, 29871, 9995, 29909, 5534, 9521, 310, 298, 1657, 2582, 607, 817, 304, 367, 19356, 1213, 15945, 13, 29871, 364, 2176, 29918, 1853, 353, 379, 1657, 3591, 12958, 13, 13, 29871, 732, 1990, 5696, 13, 29871, 822, 6015, 326, 3664, 8232, 2831, 7196, 29898, 25932, 29892, 13, 462, 462, 418, 5993, 29922, 8516, 29892, 13, 462, 462, 418, 1369, 29918, 2230, 29922, 8516, 29892, 13, 462, 462, 418, 454, 559, 29918, 2230, 29922, 29906, 29900, 29900, 29892, 13, 462, 462, 418, 4333, 29922, 8516, 1125, 13, 1678, 9995, 11609, 443, 29883, 13190, 298, 1657, 1121, 25913, 363, 4333, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 418, 5993, 29901, 450, 6993, 5993, 304, 2189, 2566, 6931, 411, 29889, 13, 13, 418, 1369, 29918, 2230, 29901, 960, 731, 29892, 385, 390, 4037, 11384, 23941, 472, 825, 1298, 304, 1369, 13, 4706, 5995, 292, 25913, 29889, 9333, 25913, 411, 263, 14334, 1156, 445, 13, 4706, 1298, 674, 367, 17049, 29889, 13, 13, 418, 454, 559, 29918, 2230, 29901, 1128, 1472, 304, 5995, 278, 25913, 363, 29889, 13, 13, 418, 4333, 29901, 450, 5065, 29876, 310, 278, 4333, 304, 1284, 25913, 363, 29889, 960, 443, 842, 29892, 13, 4706, 278, 24577, 313, 4661, 13190, 29897, 12519, 674, 8161, 278, 4333, 29889, 13, 13, 1678, 16969, 29901, 13, 418, 319, 5101, 313, 10855, 29892, 2582, 29897, 988, 4333, 338, 278, 4333, 13, 418, 393, 25913, 892, 27387, 363, 322, 2582, 338, 263, 1051, 310, 13, 418, 14164, 3618, 607, 12439, 1632, 29878, 3728, 2629, 278, 1121, 13, 418, 4333, 29889, 13, 1678, 9995, 13, 13, 1678, 770, 14348, 5072, 29898, 3318, 1125, 13, 13, 418, 822, 4770, 2344, 12035, 1311, 29892, 4333, 1125, 13, 4706, 1583, 29889, 10855, 353, 4333, 13, 13, 418, 822, 19916, 9182, 29898, 1311, 29892, 12519, 1125, 13, 4706, 565, 1583, 29889, 10855, 338, 6213, 29901, 13, 3986, 1583, 29889, 10855, 353, 12519, 29889, 2914, 29918, 10855, 29918, 595, 13, 4706, 736, 1583, 29889, 10855, 2804, 12519, 29889, 2914, 29918, 10855, 29918, 595, 13, 13, 1678, 285, 353, 14348, 5072, 29898, 10855, 29897, 13, 1678, 2582, 353, 5159, 13, 1678, 411, 2756, 29946, 29889, 4519, 1783, 18929, 29889, 6585, 3047, 16542, 29898, 13, 4706, 390, 2890, 8647, 29918, 12256, 6545, 28541, 29918, 11144, 4462, 29892, 13, 4706, 2756, 29946, 29918, 1853, 29922, 29950, 1657, 3591, 10620, 29892, 13, 4706, 454, 559, 29918, 2230, 29922, 29941, 29900, 29900, 29892, 13, 4706, 23473, 29922, 5574, 29892, 13, 4706, 23473, 29918, 17059, 29918, 19207, 29922, 29896, 29945, 29892, 13, 4706, 23473, 29918, 908, 29918, 15619, 29922, 29953, 29900, 29900, 29892, 13, 4706, 5993, 29922, 6979, 29897, 408, 9521, 29901, 13, 418, 363, 2407, 297, 9521, 29889, 29907, 8342, 4789, 4339, 29898, 13, 3986, 2407, 29918, 4572, 29922, 29888, 29889, 5072, 9182, 29892, 13, 3986, 1369, 29918, 2230, 29922, 2962, 29918, 2230, 29892, 13, 3986, 11815, 29922, 1511, 29918, 2230, 29892, 13, 3986, 4046, 29922, 29896, 29900, 29900, 29900, 29900, 29900, 1125, 13, 4706, 2582, 29889, 4397, 29898, 11651, 29897, 13, 1678, 736, 313, 29888, 29889, 10855, 29892, 2582, 29897, 13, 13, 29871, 732, 1990, 5696, 13, 29871, 822, 21267, 3664, 8232, 29898, 25932, 29892, 6475, 29892, 5993, 29922, 8516, 1125, 13, 1678, 9995, 12498, 298, 1657, 25913, 1213, 15945, 13, 1678, 1067, 29879, 29889, 12498, 4789, 4339, 29898, 3757, 4339, 29892, 5993, 29922, 6979, 29897, 13, 13, 13, 1990, 379, 1657, 3591, 7196, 29898, 6831, 2556, 29918, 10855, 29889, 3338, 29878, 3728, 7196, 1125, 13, 29871, 9995, 16941, 2556, 379, 1657, 3591, 7196, 1213, 15945, 13, 13, 29871, 732, 1990, 5696, 13, 29871, 822, 624, 2454, 2528, 29898, 25932, 29892, 13, 18884, 4333, 29918, 595, 29892, 13, 18884, 364, 2176, 29918, 1767, 29892, 13, 18884, 5478, 362, 29918, 10109, 29922, 8516, 29892, 13, 18884, 14334, 29922, 8516, 29892, 13, 18884, 25557, 29922, 8516, 29892, 13, 18884, 3579, 19290, 1125, 13, 1678, 18696, 353, 2428, 29898, 29950, 1657, 3591, 7196, 29892, 1067, 29879, 467, 17046, 2528, 29898, 13, 4706, 4333, 29918, 595, 29892, 13, 4706, 364, 2176, 29918, 1767, 29892, 13, 4706, 5478, 362, 29918, 10109, 29922, 6149, 362, 29918, 10109, 29892, 13, 4706, 14334, 29922, 16394, 29892, 13, 4706, 25557, 29922, 2146, 600, 861, 29892, 13, 4706, 3579, 19290, 29897, 13, 1678, 379, 1657, 3591, 10620, 29889, 17046, 2528, 29898, 13, 4706, 390, 2890, 8647, 29918, 12256, 6545, 28541, 29918, 11144, 4462, 29892, 13, 4706, 379, 1657, 3591, 12958, 29898, 13, 9651, 1121, 29918, 10855, 29918, 595, 29922, 10855, 29918, 595, 29892, 14334, 29922, 1372, 29961, 29900, 1402, 13, 9651, 25557, 29922, 1372, 29961, 29896, 11724, 13, 4706, 5478, 362, 29918, 10109, 29922, 6149, 362, 29918, 10109, 29897, 13, 1678, 736, 18696, 13, 13, 13, 1990, 7867, 10620, 6644, 29950, 2550, 29898, 1727, 6020, 29889, 6644, 29950, 2550, 1125, 13, 29871, 758, 353, 518, 3470, 29946, 29889, 29909, 4198, 29946, 6644, 29950, 2550, 29962, 13, 13, 29871, 822, 7525, 29898, 1311, 1125, 13, 1678, 1018, 29901, 13, 418, 411, 2756, 29946, 29889, 4519, 1783, 18929, 29889, 4391, 29898, 13, 3986, 390, 2890, 8647, 29918, 12256, 6545, 28541, 29918, 11144, 4462, 29892, 13, 3986, 379, 1657, 3591, 10620, 29892, 13, 3986, 4464, 543, 29893, 613, 13, 3986, 5993, 29922, 3470, 29946, 29889, 4519, 1783, 18929, 29889, 4632, 29918, 6979, 1125, 13, 4706, 1209, 13, 1678, 5174, 2130, 29918, 6451, 29889, 29965, 1056, 329, 2015, 1891, 6638, 29901, 13, 418, 1209, 13, 2 ]
selected_cols.py
launis/areadata
0
113614
def selected_cols(largeset = False, parties=True, pnroalue = True): if largeset==True: numeric_features = ['Miehet, 2018 (HE) osuudesta asukkaat', 'Naiset, 2018 (HE) osuudesta asukkaat', 'Asuntojen keskipinta-ala, 2018 (RA) osuus total', 'Talotyypit yhteensä 2019 Neliöhinta (EUR/m2) osuus total', 'Asumisväljyys, 2018 (TE) osuus total', 'Asukkaiden keski-ikä, 2018 (HE) osuus total', 'Postinumeroalueen pinta-ala osuus area_code', 'Perusasteen suorittaneet, 2018 (KO) osuudesta asukkaat', 'Ammatillisen tutkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Ylioppilastutkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Alemman korkeakoulututkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Ylemmän korkeakoulututkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Asukkaiden mediaanitulot, 2017 (HR) osuudesta asukkaat', 'Asukkaiden ostovoimakertymä, 2017 (HR) osuudesta asukkaat osuus total', 'Kesämökit yhteensä, 2018 (RA) osuudesta asukkaat', 'Pientaloasunnot, 2018 (RA) osuudesta asukkaat', 'Työlliset, 2017 (PT) osuudesta asukkaat', 'Työttömät, 2017 (PT) osuudesta asukkaat', 'Opiskelijat, 2017 (PT) osuudesta asukkaat', 'A Maatalous, metsätalous ja kalatalous, 2017 (TP) osuudesta asukkaat', 'B Kaivostoiminta ja louhinta, 2017 (TP) osuudesta asukkaat', 'C Teollisuus, 2017 (TP) osuudesta asukkaat', 'D Sähkö-, kaasu- ja lämpöhuolto, jäähdytysliiketoiminta, 2017 (TP) osuudesta asukkaat', 'E Vesihuolto, viemäri- ja jätevesihuolto ja muu ympäristön puhtaanapito, 2017 (TP) osuudesta asukkaat', 'F Rakentaminen, 2017 (TP) osuudesta asukkaat', 'G Tukku- ja vähittäiskauppa; moottoriajoneuvojen ja moottoripyörien korjaus, 2017 (TP) osuudesta asukkaat', 'H Kuljetus ja varastointi, 2017 (TP) osuudesta asukkaat', 'I Majoitus- ja ravitsemistoiminta, 2017 (TP) osuudesta asukkaat', 'J Informaatio ja viestintä, 2017 (TP) osuudesta asukkaat', 'K Rahoitus- ja vakuutustoiminta, 2017 (TP) osuudesta asukkaat', 'L Kiinteistöalan toiminta, 2017 (TP) osuudesta asukkaat', 'M Ammatillinen, tieteellinen ja tekninen toiminta, 2017 (TP) osuudesta asukkaat', 'N Hallinto- ja tukipalvelutoiminta, 2017 (TP) osuudesta asukkaat', 'O Julkinen hallinto ja maanpuolustus; pakollinen sosiaalivakuutus, 2017 (TP) osuudesta asukkaat', 'P Koulutus, 2017 (TP) osuudesta asukkaat', 'Q Terveys- ja sosiaalipalvelut, 2017 (TP) osuudesta asukkaat', 'R Taiteet, viihde ja virkistys, 2017 (TP) osuudesta asukkaat', 'S Muu palvelutoiminta, 2017 (TP) osuudesta asukkaat', 'T Kotitalouksien toiminta työnantajina; kotitalouksien eriyttämätön toiminta tavaroiden ja palveluiden tuottamiseksi omaan käyttöön, 2017 (TP) osuudesta asukkaat', 'U Kansainvälisten organisaatioiden ja toimielinten toiminta, 2017 (TP) osuudesta asukkaat', 'Ravintolat osuudesta asukkaat', 'Myymälät osuudesta asukkaat', 'Nuorten yksinasuvien taloudet, 2018 (TE) osuudesta taloudet', 'Lapsettomat nuorten parien taloudet, 2018 (TE) osuudesta taloudet', 'Lapsitaloudet, 2018 (TE) osuudesta taloudet', 'Teini-ikäisten lasten taloudet, 2018 (TE) osuudesta taloudet', 'Aikuisten taloudet, 2018 (TE) osuudesta taloudet', 'Eläkeläisten taloudet, 2018 (TE) osuudesta taloudet', 'Omistusasunnoissa asuvat taloudet, 2018 (TE) osuudesta taloudet', 'Vuokra-asunnoissa asuvat taloudet, 2018 (TE) osuudesta taloudet', 'Alimpaan tuloluokkaan kuuluvat taloudet, 2017 (TR) osuudesta taloudet', 'Keskimmäiseen tuloluokkaan kuuluvat taloudet, 2017 (TR) osuudesta taloudet', 'Ylimpään tuloluokkaan kuuluvat taloudet, 2017 (TR) osuudesta taloudet', '1.1.3 Kirkollisvero Yhteensä Saajien lukumäärä osuudesta verotetut', '11. Yrittäjätulot yhteensä Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.10 Muut veronalaiset sosiaalietuudet Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.6 Tapaturma- ym. muut päivärahat Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.7 Päivä- ja äitiyspäivärahat Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.8 Lapsen kotihoidon tuki Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.9 Kuntoutusraha ja -avustus Yhteensä Saajien lukumäärä osuudesta verotetut', '5.1.3 Vuokratulo Yhteensä Saajien lukumäärä osuudesta verotetut', '11.5.1.1 Asuntolainan korkomenot (TVL 58 § 2 mom.) Yhteensä Summa, euroa osuus total', '14.12 Opintolainavähennys Yhteensä Summa, euroa osuus total', '14.7 Kotitalousvähennys Yhteensä Summa, euroa osuus total', '2. Tulot yhteensä Yhteensä Summa, euroa osuus total', '1.1 Tuloverot yhteensä Yhteensä Summa, euroa osuus total', '4.1.C Autoetu Yhteensä Summa, euroa osuus total', '4.2 Työmatkakulujen perusteella palkkatulosta vähennettävä määrä (TVL 93 §) Yhteensä Summa, euroa osuus total', '5. Pääomatulot yhteensä Yhteensä Summa, euroa osuus total', 'Ruotsinkielisten osuus väestöstä, %, 2019', 'Taajama-aste, %, 2018', 'Ulkomaan kansalaisten osuus väestöstä, %, 2019', 'Kuntien välinen muuttovoitto/-tappio, henkilöä, 2019 osuudesta asukkaat nollatta', 'etaisyys osuus area_code','tkalue', 'Tuloveroprosentti'] else: numeric_features = ['Miehet, 2018 (HE) osuudesta asukkaat', 'Asuntojen keskipinta-ala, 2018 (RA) osuus total', 'Talotyypit yhteensä 2019 Neliöhinta (EUR/m2) osuus total', 'Asumisväljyys, 2018 (TE) osuus total', 'Asukkaiden keski-ikä, 2018 (HE) osuus total', 'Postinumeroalueen pinta-ala osuus area_code', 'Perusasteen suorittaneet, 2018 (KO) osuudesta asukkaat', 'Ammatillisen tutkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Ylioppilastutkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Alemman korkeakoulututkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Ylemmän korkeakoulututkinnon suorittaneet, 2018 (KO) osuudesta asukkaat', 'Asukkaiden ostovoimakertymä, 2017 (HR) osuudesta asukkaat osuus total', 'Kerrostaloasunnot, 2018 (RA) osuudesta asukkaat', 'Kesämökit yhteensä, 2018 (RA) osuudesta asukkaat', 'Pientaloasunnot, 2018 (RA) osuudesta asukkaat', 'Työlliset, 2017 (PT) osuudesta asukkaat', 'Työttömät, 2017 (PT) osuudesta asukkaat', 'Opiskelijat, 2017 (PT) osuudesta asukkaat', 'A Maatalous, metsätalous ja kalatalous, 2017 (TP) osuudesta asukkaat', 'J Informaatio ja viestintä, 2017 (TP) osuudesta asukkaat', 'K Rahoitus- ja vakuutustoiminta, 2017 (TP) osuudesta asukkaat', 'O Julkinen hallinto ja maanpuolustus; pakollinen sosiaalivakuutus, 2017 (TP) osuudesta asukkaat', 'P Koulutus, 2017 (TP) osuudesta asukkaat', 'Q Terveys- ja sosiaalipalvelut, 2017 (TP) osuudesta asukkaat', 'R Taiteet, viihde ja virkistys, 2017 (TP) osuudesta asukkaat', 'Ravintolat osuudesta asukkaat', 'Myymälät osuudesta asukkaat', 'Nuorten yksinasuvien taloudet, 2018 (TE) osuudesta taloudet', 'Lapsettomat nuorten parien taloudet, 2018 (TE) osuudesta taloudet', 'Lapsitaloudet, 2018 (TE) osuudesta taloudet', 'Aikuisten taloudet, 2018 (TE) osuudesta taloudet', 'Eläkeläisten taloudet, 2018 (TE) osuudesta taloudet', 'Omistusasunnoissa asuvat taloudet, 2018 (TE) osuudesta taloudet', 'Vuokra-asunnoissa asuvat taloudet, 2018 (TE) osuudesta taloudet', 'Alimpaan tuloluokkaan kuuluvat taloudet, 2017 (TR) osuudesta taloudet', 'Keskimmäiseen tuloluokkaan kuuluvat taloudet, 2017 (TR) osuudesta taloudet', 'Ylimpään tuloluokkaan kuuluvat taloudet, 2017 (TR) osuudesta taloudet', '1.1.3 Kirkollisvero Yhteensä Saajien lukumäärä osuudesta verotetut', '11. Yrittäjätulot yhteensä Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.6 Tapaturma- ym. muut päivärahat Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.7 Päivä- ja äitiyspäivärahat Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.8 Lapsen kotihoidon tuki Yhteensä Saajien lukumäärä osuudesta verotetut', '4.2.9 Kuntoutusraha ja -avustus Yhteensä Saajien lukumäärä osuudesta verotetut', '5.1.3 Vuokratulo Yhteensä Saajien lukumäärä osuudesta verotetut', '192.168.3.11 Asuntolainan korkomenot (TVL 58 § 2 mom.) Yhteensä Summa, euroa osuus total', '14.12 Opintolainavähennys Yhteensä Summa, euroa osuus total', '14.7 Kotitalousvähennys Yhteensä Summa, euroa osuus total', '1.1 Tuloverot yhteensä Yhteensä Summa, euroa osuus total', '4.1.C Autoetu Yhteensä Summa, euroa osuus total', '4.2 Työmatkakulujen perusteella palkkatulosta vähennettävä määrä (TVL 93 §) Yhteensä Summa, euroa osuus total', '5. Pääomatulot yhteensä Yhteensä Summa, euroa osuus total', 'Ruotsinkielisten osuus väestöstä, %, 2019', 'Taajama-aste, %, 2018', 'Ulkomaan kansalaisten osuus väestöstä, %, 2019', 'Kuntien välinen muuttovoitto/-tappio, henkilöä, 2019 osuudesta asukkaat nollatta', 'etaisyys osuus area_code', 'tkalue', 'Tuloveroprosentti'] col_puolueet = ['Ääniosuus KD', 'Ääniosuus KESK', 'Ääniosuus KOK', 'Ääniosuus PS', 'Ääniosuus RKP', 'Ääniosuus SDP', 'Ääniosuus VAS', 'Ääniosuus VIHR', 'Äänestysosuus'] if not pnroalue: not_in_kunta = ['Myymälät osuudesta asukkaat', 'Postinumeroalueen pinta-ala osuus area_code', 'Kuntien välinen muuttovoitto/-tappio, henkilöä, 2019 osuudesta asukkaat nollatta', 'etaisyys osuus area_code', 'tkalue', 'Ravintolat osuudesta asukkaat'] removeset = set(not_in_kunta) numeric_features[:] = [x for x in numeric_features if x not in removeset] categorical_features=[] if parties: numeric_features = numeric_features + col_puolueet return(numeric_features, categorical_features)
[ 1, 822, 4629, 29918, 22724, 29898, 27489, 267, 300, 353, 7700, 29892, 13973, 29922, 5574, 29892, 282, 29876, 307, 284, 434, 353, 5852, 1125, 30004, 13, 30004, 13, 1678, 565, 5573, 267, 300, 1360, 5574, 29901, 30004, 13, 4706, 16985, 29918, 22100, 353, 29871, 6024, 29924, 347, 9188, 29892, 29871, 29906, 29900, 29896, 29947, 313, 9606, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29940, 1759, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 9606, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 2887, 12578, 4142, 413, 8488, 666, 15073, 29899, 2883, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4717, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29911, 284, 18820, 1478, 277, 343, 29882, 371, 575, 29986, 29871, 29906, 29900, 29896, 29929, 405, 5037, 19213, 15073, 313, 29923, 4574, 29914, 29885, 29906, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29909, 2083, 275, 29894, 5581, 29926, 29891, 952, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29909, 2146, 29895, 1335, 3615, 413, 267, 1984, 29899, 638, 29986, 29892, 29871, 29906, 29900, 29896, 29947, 313, 9606, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 6747, 262, 398, 1489, 284, 434, 264, 282, 15073, 29899, 2883, 288, 2146, 375, 4038, 29918, 401, 23592, 13, 462, 632, 525, 5894, 375, 4350, 264, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 6833, 2922, 453, 7674, 7149, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29979, 5991, 407, 309, 579, 329, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29909, 2409, 1171, 10871, 446, 557, 5059, 329, 329, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29979, 2409, 29885, 3363, 10871, 446, 557, 5059, 329, 329, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29909, 2146, 29895, 1335, 3615, 5745, 273, 14193, 327, 29892, 29871, 29906, 29900, 29896, 29955, 313, 20938, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29909, 2146, 29895, 1335, 3615, 14750, 6962, 326, 557, 814, 962, 29986, 29892, 29871, 29906, 29900, 29896, 29955, 313, 20938, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29968, 267, 12682, 29997, 7354, 343, 29882, 371, 575, 29986, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4717, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29925, 993, 7003, 294, 348, 1333, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4717, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 21314, 22232, 275, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 7982, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 21314, 8705, 10063, 3003, 29892, 29871, 29906, 29900, 29896, 29955, 313, 7982, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29949, 3334, 29895, 3875, 271, 29892, 29871, 29906, 29900, 29896, 29955, 313, 7982, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29909, 3219, 2075, 681, 29892, 1539, 29879, 3003, 20521, 12337, 25364, 2075, 681, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29933, 13680, 440, 5548, 326, 15073, 12337, 301, 283, 29882, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29907, 1920, 3028, 28311, 375, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29928, 317, 7538, 12910, 15767, 13560, 294, 29884, 29899, 12337, 301, 19140, 29997, 6905, 324, 517, 29892, 432, 29986, 7538, 29881, 3637, 952, 492, 638, 10896, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29923, 478, 267, 4861, 29884, 324, 517, 29892, 3516, 331, 29986, 374, 29899, 12337, 432, 29986, 371, 1960, 4861, 29884, 324, 517, 12337, 3887, 29884, 343, 1526, 1215, 391, 3042, 2653, 400, 29874, 273, 481, 2049, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29943, 29350, 296, 314, 7026, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29954, 323, 2679, 2120, 29899, 12337, 325, 7538, 986, 29986, 3873, 585, 13410, 29936, 2730, 1501, 4108, 29926, 650, 22644, 4142, 12337, 2730, 1501, 272, 666, 29891, 29997, 19112, 10871, 29926, 1485, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29950, 476, 352, 4026, 375, 12337, 722, 24186, 524, 29875, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29902, 6973, 20252, 375, 29899, 12337, 27710, 1169, 331, 5137, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29967, 15162, 29874, 20819, 12337, 3516, 342, 524, 29986, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29968, 16790, 20252, 375, 29899, 12337, 325, 16774, 329, 23065, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29931, 16540, 6693, 391, 29997, 284, 273, 304, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29924, 1913, 2922, 453, 7026, 29892, 260, 2035, 29872, 514, 7026, 12337, 734, 3959, 7026, 304, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29940, 6573, 8941, 29899, 12337, 260, 2679, 666, 284, 955, 3066, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29949, 2739, 29895, 7026, 12713, 8941, 12337, 611, 273, 3746, 324, 504, 375, 29936, 27068, 324, 1915, 264, 269, 359, 423, 284, 440, 16774, 329, 375, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29925, 476, 5059, 329, 375, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29984, 5061, 345, 952, 29899, 12337, 269, 359, 423, 284, 666, 284, 955, 329, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29934, 10523, 568, 300, 29892, 325, 2236, 29882, 311, 12337, 325, 6793, 391, 952, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29903, 8229, 29884, 5112, 955, 3066, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29911, 27961, 2410, 283, 2039, 819, 304, 326, 15073, 7911, 3042, 424, 1175, 1099, 29936, 21062, 2410, 283, 2039, 819, 604, 19881, 698, 12682, 3003, 3042, 304, 326, 15073, 260, 485, 279, 3398, 264, 12337, 5112, 955, 29884, 3615, 5291, 1501, 314, 895, 29895, 1039, 288, 655, 273, 413, 29986, 29891, 698, 29997, 3042, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29965, 476, 550, 475, 10424, 20631, 2894, 8069, 20819, 3615, 12337, 304, 326, 709, 524, 264, 304, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29934, 485, 524, 324, 271, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 3421, 962, 5581, 3003, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29940, 29884, 27993, 343, 2039, 10189, 4090, 819, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29931, 481, 9915, 290, 271, 4948, 27993, 610, 819, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29931, 2547, 2410, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 7141, 2172, 29899, 638, 29986, 8244, 1833, 264, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29909, 18282, 8244, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 6489, 29986, 10265, 29986, 8244, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 5673, 391, 375, 294, 348, 1217, 16343, 408, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29963, 29884, 554, 336, 29899, 294, 348, 1217, 16343, 408, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 2499, 326, 3274, 273, 260, 352, 20424, 554, 1335, 273, 413, 29884, 352, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 5659, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29968, 8488, 6727, 29986, 895, 264, 260, 352, 20424, 554, 1335, 273, 413, 29884, 352, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 5659, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29979, 12552, 29986, 3363, 260, 352, 20424, 554, 1335, 273, 413, 29884, 352, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 5659, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29896, 29889, 29896, 29889, 29941, 26424, 3028, 275, 369, 29877, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29896, 29896, 29889, 612, 12123, 29986, 29926, 3003, 352, 327, 343, 29882, 371, 575, 29986, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29896, 29900, 8229, 329, 1147, 7177, 1759, 300, 269, 359, 423, 284, 2035, 29884, 566, 300, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29953, 323, 481, 1337, 655, 29899, 343, 29885, 29889, 3887, 329, 282, 29986, 440, 29986, 336, 2455, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29955, 349, 29986, 440, 29986, 29899, 12337, 7533, 4812, 952, 29886, 29986, 440, 29986, 336, 2455, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29947, 365, 2547, 264, 413, 15297, 1251, 333, 265, 5291, 1984, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29929, 476, 1657, 449, 375, 336, 2350, 12337, 448, 485, 504, 375, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29945, 29889, 29896, 29889, 29941, 478, 29884, 18468, 7207, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29896, 29896, 29889, 29945, 29889, 29896, 29889, 29896, 1094, 1657, 324, 475, 273, 413, 548, 2770, 327, 313, 8050, 29931, 29871, 29945, 29947, 16683, 29871, 29906, 16823, 1846, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29896, 29946, 29889, 29896, 29906, 6461, 524, 324, 475, 485, 7538, 2108, 952, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29896, 29946, 29889, 29955, 27961, 2410, 681, 29894, 7538, 2108, 952, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29906, 29889, 27415, 327, 343, 29882, 371, 575, 29986, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29896, 29889, 29896, 27415, 957, 327, 343, 29882, 371, 575, 29986, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29946, 29889, 29896, 29889, 29907, 11133, 24120, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 9656, 29997, 2922, 29895, 557, 21528, 4142, 639, 504, 29872, 3547, 282, 2235, 29895, 271, 352, 16233, 13108, 3169, 20764, 29986, 10424, 286, 29986, 1215, 29986, 313, 8050, 29931, 29871, 29929, 29941, 16683, 29897, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29945, 29889, 349, 29986, 29986, 290, 271, 352, 327, 343, 29882, 371, 575, 29986, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29934, 29884, 1862, 682, 709, 8244, 288, 2146, 375, 13108, 342, 15095, 29986, 29892, 19778, 29871, 29906, 29900, 29896, 29929, 23592, 13, 462, 632, 525, 29911, 29874, 1175, 3304, 29899, 4350, 29892, 19778, 29871, 29906, 29900, 29896, 29947, 23592, 13, 462, 632, 525, 29965, 29880, 29895, 4125, 273, 413, 550, 2883, 8244, 288, 2146, 375, 13108, 342, 15095, 29986, 29892, 19778, 29871, 29906, 29900, 29896, 29929, 23592, 13, 462, 632, 525, 29968, 1657, 819, 13108, 1915, 264, 3887, 17317, 1365, 20435, 24028, 29873, 932, 601, 29892, 298, 5842, 309, 29997, 29986, 29892, 29871, 29906, 29900, 29896, 29929, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 302, 3028, 14975, 23592, 13, 462, 632, 525, 1187, 13344, 952, 288, 2146, 375, 4038, 29918, 401, 3788, 11178, 284, 434, 23592, 13, 462, 632, 525, 29911, 352, 957, 459, 1883, 296, 2034, 2033, 30004, 13, 30004, 13, 1678, 1683, 29901, 30004, 13, 4706, 16985, 29918, 22100, 353, 6024, 29924, 347, 9188, 29892, 29871, 29906, 29900, 29896, 29947, 313, 9606, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 2887, 12578, 4142, 413, 8488, 666, 15073, 29899, 2883, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4717, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29911, 284, 18820, 1478, 277, 343, 29882, 371, 575, 29986, 29871, 29906, 29900, 29896, 29929, 405, 5037, 19213, 15073, 313, 29923, 4574, 29914, 29885, 29906, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29909, 2083, 275, 29894, 5581, 29926, 29891, 952, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29909, 2146, 29895, 1335, 3615, 413, 267, 1984, 29899, 638, 29986, 29892, 29871, 29906, 29900, 29896, 29947, 313, 9606, 29897, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 6747, 262, 398, 1489, 284, 434, 264, 282, 15073, 29899, 2883, 288, 2146, 375, 4038, 29918, 401, 23592, 13, 462, 632, 525, 5894, 375, 4350, 264, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 6833, 2922, 453, 7674, 7149, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29979, 5991, 407, 309, 579, 329, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29909, 2409, 1171, 10871, 446, 557, 5059, 329, 329, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29979, 2409, 29885, 3363, 10871, 446, 557, 5059, 329, 329, 29895, 2559, 265, 480, 272, 986, 1662, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 29968, 29949, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29909, 2146, 29895, 1335, 3615, 14750, 6962, 326, 557, 814, 962, 29986, 29892, 29871, 29906, 29900, 29896, 29955, 313, 20938, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29968, 261, 17627, 7003, 294, 348, 1333, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4717, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29968, 267, 12682, 29997, 7354, 343, 29882, 371, 575, 29986, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4717, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29925, 993, 7003, 294, 348, 1333, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4717, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 21314, 22232, 275, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 7982, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 21314, 8705, 10063, 3003, 29892, 29871, 29906, 29900, 29896, 29955, 313, 7982, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29949, 3334, 29895, 3875, 271, 29892, 29871, 29906, 29900, 29896, 29955, 313, 7982, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29909, 3219, 2075, 681, 29892, 1539, 29879, 3003, 20521, 12337, 25364, 2075, 681, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29967, 15162, 29874, 20819, 12337, 3516, 342, 524, 29986, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29968, 16790, 20252, 375, 29899, 12337, 325, 16774, 329, 23065, 326, 15073, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29949, 2739, 29895, 7026, 12713, 8941, 12337, 611, 273, 3746, 324, 504, 375, 29936, 27068, 324, 1915, 264, 269, 359, 423, 284, 440, 16774, 329, 375, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29925, 476, 5059, 329, 375, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29984, 5061, 345, 952, 29899, 12337, 269, 359, 423, 284, 666, 284, 955, 329, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29934, 10523, 568, 300, 29892, 325, 2236, 29882, 311, 12337, 325, 6793, 391, 952, 29892, 29871, 29906, 29900, 29896, 29955, 313, 3557, 29897, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29934, 485, 524, 324, 271, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 3421, 962, 5581, 3003, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 23592, 13, 462, 632, 525, 29940, 29884, 27993, 343, 2039, 10189, 4090, 819, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29931, 481, 9915, 290, 271, 4948, 27993, 610, 819, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29931, 2547, 2410, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29909, 18282, 8244, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 6489, 29986, 10265, 29986, 8244, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 5673, 391, 375, 294, 348, 1217, 16343, 408, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29963, 29884, 554, 336, 29899, 294, 348, 1217, 16343, 408, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29947, 313, 4330, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 2499, 326, 3274, 273, 260, 352, 20424, 554, 1335, 273, 413, 29884, 352, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 5659, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29968, 8488, 6727, 29986, 895, 264, 260, 352, 20424, 554, 1335, 273, 413, 29884, 352, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 5659, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29979, 12552, 29986, 3363, 260, 352, 20424, 554, 1335, 273, 413, 29884, 352, 4090, 271, 5969, 2736, 300, 29892, 29871, 29906, 29900, 29896, 29955, 313, 5659, 29897, 288, 2146, 566, 4405, 5969, 2736, 300, 23592, 13, 462, 632, 525, 29896, 29889, 29896, 29889, 29941, 26424, 3028, 275, 369, 29877, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29896, 29896, 29889, 612, 12123, 29986, 29926, 3003, 352, 327, 343, 29882, 371, 575, 29986, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29953, 323, 481, 1337, 655, 29899, 343, 29885, 29889, 3887, 329, 282, 29986, 440, 29986, 336, 2455, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29955, 349, 29986, 440, 29986, 29899, 12337, 7533, 4812, 952, 29886, 29986, 440, 29986, 336, 2455, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29947, 365, 2547, 264, 413, 15297, 1251, 333, 265, 5291, 1984, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 29889, 29929, 476, 1657, 449, 375, 336, 2350, 12337, 448, 485, 504, 375, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29945, 29889, 29896, 29889, 29941, 478, 29884, 18468, 7207, 612, 29882, 371, 575, 29986, 5701, 1175, 819, 301, 2679, 398, 29986, 1215, 29986, 288, 2146, 566, 4405, 1147, 327, 300, 329, 23592, 13, 462, 632, 525, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29941, 29889, 29896, 29896, 1094, 1657, 324, 475, 273, 413, 548, 2770, 327, 313, 8050, 29931, 29871, 29945, 29947, 16683, 29871, 29906, 16823, 1846, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29896, 29946, 29889, 29896, 29906, 6461, 524, 324, 475, 485, 7538, 2108, 952, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29896, 29946, 29889, 29955, 27961, 2410, 681, 29894, 7538, 2108, 952, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29896, 29889, 29896, 27415, 957, 327, 343, 29882, 371, 575, 29986, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29946, 29889, 29896, 29889, 29907, 11133, 24120, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29946, 29889, 29906, 9656, 29997, 2922, 29895, 557, 21528, 4142, 639, 504, 29872, 3547, 282, 2235, 29895, 271, 352, 16233, 13108, 3169, 20764, 29986, 10424, 286, 29986, 1215, 29986, 313, 8050, 29931, 29871, 29929, 29941, 16683, 29897, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29945, 29889, 349, 29986, 29986, 290, 271, 352, 327, 343, 29882, 371, 575, 29986, 612, 29882, 371, 575, 29986, 6991, 655, 29892, 27889, 29874, 288, 2146, 375, 3001, 23592, 13, 462, 632, 525, 29934, 29884, 1862, 682, 709, 8244, 288, 2146, 375, 13108, 342, 15095, 29986, 29892, 19778, 29871, 29906, 29900, 29896, 29929, 23592, 13, 462, 632, 525, 29911, 29874, 1175, 3304, 29899, 4350, 29892, 19778, 29871, 29906, 29900, 29896, 29947, 23592, 13, 462, 632, 525, 29965, 29880, 29895, 4125, 273, 413, 550, 2883, 8244, 288, 2146, 375, 13108, 342, 15095, 29986, 29892, 19778, 29871, 29906, 29900, 29896, 29929, 23592, 13, 462, 632, 525, 29968, 1657, 819, 13108, 1915, 264, 3887, 17317, 1365, 20435, 24028, 29873, 932, 601, 29892, 298, 5842, 309, 29997, 29986, 29892, 29871, 29906, 29900, 29896, 29929, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 302, 3028, 14975, 23592, 13, 462, 632, 525, 1187, 13344, 952, 288, 2146, 375, 4038, 29918, 401, 742, 525, 11178, 284, 434, 23592, 13, 462, 632, 525, 29911, 352, 957, 459, 1883, 296, 2034, 2033, 30004, 13, 30004, 13, 1678, 784, 29918, 3746, 324, 434, 300, 353, 6024, 30125, 29986, 1240, 359, 29884, 375, 476, 29928, 23592, 13, 462, 1678, 525, 30125, 29986, 1240, 359, 29884, 375, 476, 2890, 29968, 23592, 13, 462, 1678, 525, 30125, 29986, 1240, 359, 29884, 375, 476, 8949, 23592, 13, 462, 1678, 525, 30125, 29986, 1240, 359, 29884, 375, 11323, 23592, 13, 462, 1678, 525, 30125, 29986, 1240, 359, 29884, 375, 390, 29968, 29925, 23592, 13, 462, 1678, 525, 30125, 29986, 1240, 359, 29884, 375, 8073, 29925, 23592, 13, 462, 1678, 525, 30125, 29986, 1240, 359, 29884, 375, 478, 3289, 23592, 13, 462, 1678, 525, 30125, 29986, 1240, 359, 29884, 375, 5473, 20938, 23592, 13, 462, 1678, 525, 30125, 3363, 342, 952, 359, 29884, 375, 2033, 30004, 13, 1678, 6756, 13, 1678, 565, 451, 282, 29876, 307, 284, 434, 29901, 30004, 13, 4706, 451, 29918, 262, 29918, 29895, 16138, 353, 6024, 3421, 962, 5581, 3003, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 742, 525, 6747, 262, 398, 1489, 284, 434, 264, 282, 15073, 29899, 2883, 288, 2146, 375, 4038, 29918, 401, 742, 525, 29968, 1657, 819, 13108, 1915, 264, 3887, 17317, 1365, 20435, 24028, 29873, 932, 601, 29892, 298, 5842, 309, 29997, 29986, 29892, 29871, 29906, 29900, 29896, 29929, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 302, 3028, 14975, 742, 525, 1187, 13344, 952, 288, 2146, 375, 4038, 29918, 401, 742, 525, 11178, 284, 434, 742, 525, 29934, 485, 524, 324, 271, 288, 2146, 566, 4405, 408, 2679, 1335, 271, 2033, 1678, 6756, 13, 4706, 25388, 300, 353, 731, 29898, 1333, 29918, 262, 29918, 29895, 16138, 8443, 13, 4706, 16985, 29918, 22100, 7503, 29962, 353, 518, 29916, 363, 921, 297, 16985, 29918, 22100, 565, 921, 451, 297, 25388, 300, 29962, 30004, 13, 1678, 6756, 13, 1678, 11608, 936, 29918, 22100, 29922, 2636, 30004, 13, 30004, 13, 1678, 565, 13973, 29901, 30004, 13, 4706, 16985, 29918, 22100, 353, 16985, 29918, 22100, 718, 784, 29918, 3746, 324, 434, 300, 30004, 13, 1678, 6756, 13, 1678, 736, 29898, 21574, 29918, 22100, 29892, 11608, 936, 29918, 22100, 29897, 2 ]
ithz/security.py
ergoithz/ithz
1
1602296
<reponame>ergoithz/ithz # -*- coding: utf-8 -*- from google.appengine.api import users from ithz.data import * class SectionRights(object): view = None # level list edit = None # level list add = False # boolean assign = False # boolean def __init__(self): self.view = [0] self.edit = [] class BlogRights(object): view = None # level list viewEntry = None edit = None # level list editEntry = None add = False # boolean addEntry = False assign = False # boolean assignEntry = False def __init__(self): self.view = [0] self.edit = [] self.viewEntry = [0] self.editEntry = [] class UserRights(object): edit = None # level list list = False # boolean add = False # boolean def __init__(self): self.edit = [] class FileRights(object): add = False admin = False class ServerRights(object): admin = False class __level(object): def __init__(self,id,one,more): self.id = id self.__one = one self.__more = more self.section = SectionRights() self.blog = BlogRights() self.user = UserRights() self.file = FileRights() self.server = ServerRights() def getName(self,n=0): if n: return self.__more return self.__one levels = [ __level(0,"public user","public users"), __level(1,"admin", "admins"), __level(2,"moderator", "moderators"), __level(3,"editor","editors"), __level(4,"registered user", "registered users"), ] ''' Due GQL limitations, level's length cannot be greater than 30 From GQL reference: [...] Note: The IN and != operators use multiple queries behind the scenes. For example, the IN operator executes a separate underlying datastore query for every item in the list. The entities returned are a result of the cross-product of all the underlying datastore queries and are de-duplicated. A maximum of 30 datastore queries are allowed for any single GQL query. [...] (http://code.google.com/intl/es/appengine/docs/python/datastore/gqlreference.html) ''' __lvl = range(1,len(levels))+[0] # Admin __adm = __lvl[:] levels[1].section.view = __adm levels[1].section.edit = __adm[:-2] levels[1].section.add = True levels[1].section.assign = True levels[1].blog.view = __adm levels[1].blog.viewEntry = __adm levels[1].blog.edit = __adm[:-2] levels[1].blog.editEntry = __adm[:-2] levels[1].blog.add = True levels[1].blog.addEntry = True levels[1].blog.assign = True levels[1].blog.assignEntry = True levels[1].user.list = True levels[1].user.add = True levels[1].user.edit = __adm levels[1].file.add = True levels[1].file.admin = True levels[1].server.admin = True # Mod __mod = __lvl[:-1] levels[2].section.view = __mod levels[2].section.edit = __mod[:-2] levels[2].section.add = True levels[2].section.assign = True levels[2].blog.view = __mod levels[2].blog.viewEntry = __mod levels[2].blog.edit = __mod[:-2] levels[2].blog.editEntry = __mod[:-2] levels[2].blog.add = True levels[2].blog.addEntry = True levels[2].blog.assign = True levels[2].blog.assignEntry = True levels[2].user.list = True levels[2].user.add = True levels[2].user.edit = __mod levels[2].file.add = True levels[2].file.admin = True # Editor levels[3].section.view = [3, 4, 0] levels[3].section.edit = [3] levels[3].section.add = True levels[3].blog.view = [3, 4, 0] levels[3].blog.viewEntry = [3, 4, 0] levels[3].blog.edit = [3] levels[3].blog.editEntry = [3] levels[3].blog.add = True levels[3].blog.addEntry = True levels[3].file.add = True # Registered user levels[4].section.view = [4, 0] levels[4].blog.view = [4, 0] def getLevelName(id,n=0): ''' Returns level name of given id. ''' return levels[id].getName(n) def getUserRef(email=None): ''' Returns user reference by its email ''' return users.User(email) class User(object): ''' A class that represents an application user and it's rights and properties. ''' username = "Public user" email = "" ref = None __level = None # Level class instance def __init__(self,ref=None): level = 0 if ref==None: ref = users.get_current_user() if ref: self.username = ref.nickname() self.email = ref.email() self.ref = ref if users.is_current_user_admin(): level = 1 else: qu = getUserModel(ref) if qu and qu.level != 0: level = qu.level self.__level = levels[level] def __eq__(self,y): ''' x.__eq__(y) <==> x==y ''' return self.ref == y def getLevel(self): return self.__level.id # Sections def getSectionVisible(self): ''' Return list of visible section levels ''' return self.__level.section.view[:] def getSectionEdit(self): ''' Return list of editable section levels ''' return self.__level.section.edit[:] def getSectionAdd(self): ''' Return boolean. Can user add a section? ''' return self.__level.section.add def getSectionAssign(self): ''' Return boolean. Can user reassign a section? ''' return self.__level.section.assign # Blogs def getBlogVisible(self): ''' Return list of visible blog levels ''' return self.__level.blog.view[:] def getBlogEdit(self): ''' Return list of editable blog levels ''' return self.__level.blog.edit[:] def getBlogAdd(self): ''' Return boolean. Can user add a blog? ''' return self.__level.blog.add def getBlogAssign(self): ''' Return boolean. Can user reassign a blog? ''' return self.__level.blog.assign def getBlogEntryVisible(self): ''' Return list of visible blog levels ''' return self.__level.blog.viewEntry[:] def getBlogEntryEdit(self): ''' Return list of editable blog levels ''' return self.__level.blog.editEntry[:] def getBlogEntryAdd(self): ''' Return boolean. Can user add a blog? ''' return self.__level.blog.addEntry def getBlogEntryAssign(self): ''' Return boolean. Can user reassign a blog? ''' return self.__level.blog.assignEntry # Users def getUserAdd(self): ''' Return boolean. Can user reassign a section? ''' return self.__level.user.add def getUserEdit(self): ''' Return list of editable users' levels ''' return self.__level.user.edit[:] def getUserListing(self): ''' Return boolean. Can user list all users? ''' return self.__level.user.list def getLevel(self): ''' Return level id. ''' return self.__level.id def getLevelOver(self): ''' Return level over own level ''' if not self.__level.id in (0, 1): return self.__level.id-1 return None def getLevelName(self,n=0): ''' Return level verbose name. ''' return self.__level.getName(n) # Files def getFileAdd(self): ''' Return boolean. Can user add a file? ''' return self.__level.file.add def getFileAdmin(self): ''' Return boolean. Can user administrate files? ''' return self.__level.file.admin # Server def getServerAdmin(self): ''' Return boolean. Can user flush the cache? ''' return self.__level.server.admin # What is? def ispublic(self): ''' Returns True user is public, otherwise False ''' return (self.__level.id == 0) def isadmin(self): ''' Returns True user is admin, otherwise False ''' return (self.__level.id == 1) def ismoderator(self): ''' Returns True user is moderator, otherwise False ''' return (self.__level.id == 2) def iseditor(self): ''' Returns True user is editor, otherwise False ''' return (self.__level.id == 3) def isregistrered(self): ''' Returns True user is registered, otherwise False ''' return (self.__level.id == 4)
[ 1, 529, 276, 1112, 420, 29958, 261, 1484, 389, 29920, 29914, 389, 29920, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 5386, 29889, 932, 10599, 29889, 2754, 1053, 4160, 13, 3166, 372, 29882, 29920, 29889, 1272, 1053, 334, 13, 13, 1990, 9779, 29934, 5861, 29898, 3318, 1125, 13, 1678, 1776, 353, 6213, 396, 3233, 1051, 13, 1678, 3863, 353, 6213, 396, 3233, 1051, 13, 1678, 788, 353, 7700, 396, 7223, 13, 1678, 3566, 353, 7700, 396, 7223, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 1493, 353, 518, 29900, 29962, 13, 4706, 1583, 29889, 5628, 353, 5159, 13, 13, 1990, 350, 1188, 29934, 5861, 29898, 3318, 1125, 13, 1678, 1776, 353, 6213, 396, 3233, 1051, 13, 1678, 1776, 9634, 353, 6213, 13, 1678, 3863, 353, 6213, 396, 3233, 1051, 13, 1678, 3863, 9634, 353, 6213, 13, 1678, 788, 353, 7700, 396, 7223, 13, 1678, 788, 9634, 353, 7700, 13, 1678, 3566, 353, 7700, 396, 7223, 13, 1678, 3566, 9634, 353, 7700, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 1493, 353, 518, 29900, 29962, 13, 4706, 1583, 29889, 5628, 353, 5159, 13, 4706, 1583, 29889, 1493, 9634, 353, 518, 29900, 29962, 13, 4706, 1583, 29889, 5628, 9634, 353, 5159, 13, 9651, 13, 1990, 4911, 29934, 5861, 29898, 3318, 1125, 13, 1678, 3863, 353, 6213, 396, 3233, 1051, 13, 1678, 1051, 353, 7700, 396, 7223, 13, 1678, 788, 29871, 353, 7700, 396, 7223, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 5628, 353, 5159, 13, 13, 1990, 3497, 29934, 5861, 29898, 3318, 1125, 13, 1678, 788, 353, 7700, 13, 1678, 4113, 353, 7700, 13, 268, 13, 1990, 5656, 29934, 5861, 29898, 3318, 1125, 13, 1678, 4113, 353, 7700, 13, 13, 1990, 4770, 5563, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 333, 29892, 650, 29892, 5514, 1125, 13, 4706, 1583, 29889, 333, 353, 1178, 13, 4706, 1583, 17255, 650, 353, 697, 13, 4706, 1583, 17255, 5514, 353, 901, 13, 4706, 1583, 29889, 2042, 353, 9779, 29934, 5861, 580, 13, 4706, 1583, 29889, 7312, 353, 350, 1188, 29934, 5861, 580, 13, 4706, 1583, 29889, 1792, 353, 4911, 29934, 5861, 580, 13, 4706, 1583, 29889, 1445, 353, 3497, 29934, 5861, 580, 13, 4706, 1583, 29889, 2974, 353, 5656, 29934, 5861, 580, 13, 308, 13, 1678, 822, 679, 1170, 29898, 1311, 29892, 29876, 29922, 29900, 1125, 13, 4706, 565, 302, 29901, 13, 9651, 736, 1583, 17255, 5514, 13, 4706, 736, 1583, 17255, 650, 13, 13, 5563, 29879, 353, 518, 13, 1678, 4770, 5563, 29898, 29900, 1699, 3597, 1404, 3284, 3597, 4160, 4968, 13, 1678, 4770, 5563, 29898, 29896, 1699, 6406, 613, 376, 328, 29885, 1144, 4968, 13, 1678, 4770, 5563, 29898, 29906, 1699, 1545, 261, 1061, 613, 376, 1545, 261, 4097, 4968, 13, 1678, 4770, 5563, 29898, 29941, 1699, 15204, 3284, 5628, 943, 4968, 13, 1678, 4770, 5563, 29898, 29946, 1699, 9573, 287, 1404, 613, 376, 9573, 287, 4160, 4968, 13, 29962, 13, 12008, 16809, 402, 2239, 27028, 29892, 3233, 29915, 29879, 3309, 2609, 367, 7621, 1135, 29871, 29941, 29900, 13, 13, 1678, 3645, 402, 2239, 3407, 29901, 13, 1678, 21945, 13, 1678, 3940, 29901, 450, 2672, 322, 2804, 12768, 671, 2999, 9365, 5742, 278, 20407, 29889, 13, 1678, 1152, 1342, 29892, 278, 2672, 5455, 24138, 263, 5004, 14407, 1418, 579, 487, 13, 1678, 2346, 363, 1432, 2944, 297, 278, 1051, 29889, 450, 16212, 4133, 526, 263, 1121, 310, 13, 1678, 278, 4891, 29899, 4704, 310, 599, 278, 14407, 1418, 579, 487, 9365, 322, 526, 13, 1678, 316, 29899, 20908, 9169, 29889, 319, 7472, 310, 29871, 29941, 29900, 1418, 579, 487, 9365, 526, 6068, 363, 738, 13, 1678, 2323, 402, 2239, 2346, 29889, 13, 1678, 21945, 13, 1678, 313, 1124, 597, 401, 29889, 3608, 29889, 510, 29914, 524, 29880, 29914, 267, 29914, 932, 10599, 29914, 2640, 29914, 4691, 29914, 4130, 579, 487, 29914, 29887, 1519, 5679, 29889, 1420, 29897, 13, 12008, 13, 13, 1649, 29880, 20901, 353, 3464, 29898, 29896, 29892, 2435, 29898, 5563, 29879, 876, 29974, 29961, 29900, 29962, 13, 13, 29937, 10229, 13, 1649, 328, 29885, 353, 4770, 29880, 20901, 7503, 29962, 13, 5563, 29879, 29961, 29896, 1822, 2042, 29889, 1493, 353, 4770, 328, 29885, 13, 5563, 29879, 29961, 29896, 1822, 2042, 29889, 5628, 353, 4770, 328, 29885, 7503, 29899, 29906, 29962, 13, 5563, 29879, 29961, 29896, 1822, 2042, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 2042, 29889, 16645, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 1493, 353, 4770, 328, 29885, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 1493, 9634, 353, 4770, 328, 29885, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 5628, 353, 4770, 328, 29885, 7503, 29899, 29906, 29962, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 5628, 9634, 353, 4770, 328, 29885, 7503, 29899, 29906, 29962, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 1202, 9634, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 16645, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 7312, 29889, 16645, 9634, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 1792, 29889, 1761, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 1792, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 1792, 29889, 5628, 353, 4770, 328, 29885, 13, 5563, 29879, 29961, 29896, 1822, 1445, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 1445, 29889, 6406, 353, 5852, 13, 5563, 29879, 29961, 29896, 1822, 2974, 29889, 6406, 353, 5852, 13, 13, 29937, 3382, 13, 1649, 1545, 353, 4770, 29880, 20901, 7503, 29899, 29896, 29962, 13, 5563, 29879, 29961, 29906, 1822, 2042, 29889, 1493, 353, 4770, 1545, 13, 5563, 29879, 29961, 29906, 1822, 2042, 29889, 5628, 353, 4770, 1545, 7503, 29899, 29906, 29962, 13, 5563, 29879, 29961, 29906, 1822, 2042, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 2042, 29889, 16645, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 1493, 353, 4770, 1545, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 1493, 9634, 353, 4770, 1545, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 5628, 353, 4770, 1545, 7503, 29899, 29906, 29962, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 5628, 9634, 353, 4770, 1545, 7503, 29899, 29906, 29962, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 1202, 9634, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 16645, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 7312, 29889, 16645, 9634, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 1792, 29889, 1761, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 1792, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 1792, 29889, 5628, 353, 4770, 1545, 13, 5563, 29879, 29961, 29906, 1822, 1445, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29906, 1822, 1445, 29889, 6406, 353, 5852, 13, 13, 29937, 14059, 13, 5563, 29879, 29961, 29941, 1822, 2042, 29889, 1493, 353, 518, 29941, 29892, 29871, 29946, 29892, 29871, 29900, 29962, 13, 5563, 29879, 29961, 29941, 1822, 2042, 29889, 5628, 353, 518, 29941, 29962, 13, 5563, 29879, 29961, 29941, 1822, 2042, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29941, 1822, 7312, 29889, 1493, 353, 518, 29941, 29892, 29871, 29946, 29892, 29871, 29900, 29962, 13, 5563, 29879, 29961, 29941, 1822, 7312, 29889, 1493, 9634, 353, 518, 29941, 29892, 29871, 29946, 29892, 29871, 29900, 29962, 13, 5563, 29879, 29961, 29941, 1822, 7312, 29889, 5628, 353, 518, 29941, 29962, 13, 5563, 29879, 29961, 29941, 1822, 7312, 29889, 5628, 9634, 353, 518, 29941, 29962, 13, 5563, 29879, 29961, 29941, 1822, 7312, 29889, 1202, 353, 5852, 13, 5563, 29879, 29961, 29941, 1822, 7312, 29889, 1202, 9634, 353, 5852, 13, 5563, 29879, 29961, 29941, 1822, 1445, 29889, 1202, 353, 5852, 13, 13, 29937, 12577, 287, 1404, 13, 5563, 29879, 29961, 29946, 1822, 2042, 29889, 1493, 353, 518, 29946, 29892, 29871, 29900, 29962, 13, 5563, 29879, 29961, 29946, 1822, 7312, 29889, 1493, 353, 518, 29946, 29892, 29871, 29900, 29962, 13, 13, 1753, 679, 10108, 1170, 29898, 333, 29892, 29876, 29922, 29900, 1125, 13, 1678, 14550, 16969, 3233, 1024, 310, 2183, 1178, 29889, 14550, 13, 1678, 736, 11174, 29961, 333, 1822, 19629, 29898, 29876, 29897, 13, 13, 1753, 679, 2659, 5620, 29898, 5269, 29922, 8516, 1125, 13, 1678, 14550, 16969, 1404, 3407, 491, 967, 4876, 14550, 13, 1678, 736, 4160, 29889, 2659, 29898, 5269, 29897, 13, 539, 13, 1990, 4911, 29898, 3318, 1125, 13, 1678, 14550, 319, 770, 393, 11524, 385, 2280, 1404, 322, 372, 29915, 29879, 10462, 322, 4426, 29889, 14550, 13, 1678, 8952, 353, 376, 19858, 1404, 29908, 13, 1678, 4876, 1678, 353, 5124, 13, 1678, 2143, 418, 353, 6213, 13, 13, 1678, 4770, 5563, 353, 6213, 396, 21597, 770, 2777, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 999, 29922, 8516, 1125, 13, 4706, 3233, 353, 29871, 29900, 13, 4706, 565, 2143, 1360, 8516, 29901, 13, 9651, 2143, 353, 4160, 29889, 657, 29918, 3784, 29918, 1792, 580, 13, 462, 268, 13, 4706, 565, 2143, 29901, 13, 9651, 1583, 29889, 6786, 353, 2143, 29889, 19254, 978, 580, 13, 9651, 1583, 29889, 5269, 353, 2143, 29889, 5269, 580, 13, 9651, 1583, 29889, 999, 353, 2143, 13, 13, 9651, 565, 4160, 29889, 275, 29918, 3784, 29918, 1792, 29918, 6406, 7295, 13, 18884, 3233, 353, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 439, 353, 679, 2659, 3195, 29898, 999, 29897, 13, 18884, 565, 439, 322, 439, 29889, 5563, 2804, 29871, 29900, 29901, 13, 462, 1678, 3233, 353, 439, 29889, 5563, 13, 308, 13, 4706, 1583, 17255, 5563, 353, 11174, 29961, 5563, 29962, 13, 268, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 29891, 1125, 13, 4706, 14550, 921, 17255, 1837, 12035, 29891, 29897, 529, 1360, 29958, 921, 1360, 29891, 14550, 13, 4706, 736, 1583, 29889, 999, 1275, 343, 13, 308, 13, 1678, 822, 679, 10108, 29898, 1311, 1125, 13, 4706, 736, 1583, 17255, 5563, 29889, 333, 13, 268, 13, 1678, 396, 922, 1953, 13, 1678, 822, 679, 13438, 12911, 29898, 1311, 1125, 13, 4706, 14550, 7106, 1051, 310, 7962, 4004, 11174, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 2042, 29889, 1493, 7503, 29962, 13, 268, 13, 1678, 822, 679, 13438, 6103, 29898, 1311, 1125, 13, 4706, 14550, 7106, 1051, 310, 3863, 519, 4004, 11174, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 2042, 29889, 5628, 7503, 29962, 13, 268, 13, 1678, 822, 679, 13438, 2528, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 788, 263, 4004, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 2042, 29889, 1202, 13, 268, 13, 1678, 822, 679, 13438, 7900, 647, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 337, 16645, 263, 4004, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 2042, 29889, 16645, 13, 308, 13, 1678, 396, 350, 20756, 13, 1678, 822, 679, 29933, 1188, 12911, 29898, 1311, 1125, 13, 4706, 14550, 7106, 1051, 310, 7962, 12618, 11174, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 1493, 7503, 29962, 13, 268, 13, 1678, 822, 679, 29933, 1188, 6103, 29898, 1311, 1125, 13, 4706, 14550, 7106, 1051, 310, 3863, 519, 12618, 11174, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 5628, 7503, 29962, 13, 268, 13, 1678, 822, 679, 29933, 1188, 2528, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 788, 263, 12618, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 1202, 13, 268, 13, 1678, 822, 679, 29933, 1188, 7900, 647, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 337, 16645, 263, 12618, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 16645, 13, 308, 13, 1678, 822, 679, 29933, 1188, 9634, 12911, 29898, 1311, 1125, 13, 4706, 14550, 7106, 1051, 310, 7962, 12618, 11174, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 1493, 9634, 7503, 29962, 13, 268, 13, 1678, 822, 679, 29933, 1188, 9634, 6103, 29898, 1311, 1125, 13, 4706, 14550, 7106, 1051, 310, 3863, 519, 12618, 11174, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 5628, 9634, 7503, 29962, 13, 268, 13, 1678, 822, 679, 29933, 1188, 9634, 2528, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 788, 263, 12618, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 1202, 9634, 13, 268, 13, 1678, 822, 679, 29933, 1188, 9634, 7900, 647, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 337, 16645, 263, 12618, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 7312, 29889, 16645, 9634, 13, 308, 13, 268, 13, 1678, 396, 23861, 13, 1678, 822, 679, 2659, 2528, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 337, 16645, 263, 4004, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 1792, 29889, 1202, 13, 268, 13, 1678, 822, 679, 2659, 6103, 29898, 1311, 1125, 13, 4706, 14550, 7106, 1051, 310, 3863, 519, 4160, 29915, 11174, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 1792, 29889, 5628, 7503, 29962, 13, 268, 13, 1678, 822, 679, 2659, 1293, 292, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 1051, 599, 4160, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 1792, 29889, 1761, 13, 13, 1678, 822, 679, 10108, 29898, 1311, 1125, 13, 4706, 14550, 7106, 3233, 1178, 29889, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 333, 13, 13, 1678, 822, 679, 10108, 3563, 29898, 1311, 1125, 13, 4706, 14550, 7106, 3233, 975, 1914, 3233, 14550, 13, 4706, 565, 451, 1583, 17255, 5563, 29889, 333, 297, 313, 29900, 29892, 29871, 29896, 1125, 13, 9651, 736, 1583, 17255, 5563, 29889, 333, 29899, 29896, 13, 4706, 736, 6213, 13, 268, 13, 1678, 822, 679, 10108, 1170, 29898, 1311, 29892, 29876, 29922, 29900, 1125, 13, 4706, 14550, 7106, 3233, 26952, 1024, 29889, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 19629, 29898, 29876, 29897, 13, 268, 13, 1678, 396, 12745, 13, 1678, 822, 679, 2283, 2528, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 788, 263, 934, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 1445, 29889, 1202, 13, 268, 13, 1678, 822, 679, 2283, 12754, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 6343, 403, 2066, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 1445, 29889, 6406, 13, 308, 13, 1678, 396, 5656, 13, 1678, 822, 679, 6004, 12754, 29898, 1311, 1125, 13, 4706, 14550, 7106, 7223, 29889, 1815, 1404, 28371, 278, 7090, 29973, 14550, 13, 4706, 736, 1583, 17255, 5563, 29889, 2974, 29889, 6406, 13, 268, 13, 1678, 396, 1724, 338, 29973, 13, 1678, 822, 338, 3597, 29898, 1311, 1125, 13, 4706, 14550, 16969, 5852, 1404, 338, 970, 29892, 6467, 7700, 14550, 13, 4706, 736, 313, 1311, 17255, 5563, 29889, 333, 1275, 29871, 29900, 29897, 13, 268, 13, 1678, 822, 338, 6406, 29898, 1311, 1125, 13, 4706, 14550, 16969, 5852, 1404, 338, 4113, 29892, 6467, 7700, 14550, 13, 4706, 736, 313, 1311, 17255, 5563, 29889, 333, 1275, 29871, 29896, 29897, 13, 268, 13, 1678, 822, 338, 1545, 261, 1061, 29898, 1311, 1125, 13, 4706, 14550, 16969, 5852, 1404, 338, 17768, 1061, 29892, 6467, 7700, 14550, 13, 4706, 736, 313, 1311, 17255, 5563, 29889, 333, 1275, 29871, 29906, 29897, 13, 268, 13, 1678, 822, 338, 15204, 29898, 1311, 1125, 13, 4706, 14550, 16969, 5852, 1404, 338, 6920, 29892, 6467, 7700, 14550, 13, 4706, 736, 313, 1311, 17255, 5563, 29889, 333, 1275, 29871, 29941, 29897, 13, 268, 13, 1678, 822, 338, 29238, 14561, 29898, 1311, 1125, 13, 4706, 14550, 16969, 5852, 1404, 338, 15443, 29892, 6467, 7700, 14550, 13, 4706, 736, 313, 1311, 17255, 5563, 29889, 333, 1275, 29871, 29946, 29897, 13, 2 ]
pydocusign/test.py
enefeq/pydocusign
10
181484
<filename>pydocusign/test.py """Utilities to run tests around `pydocusign`.""" import os def fixtures_dir(): """Return absolute path to `pydocusign`'s fixtures dir, as best guess. This function supports two situations: * you use it in code repository's root, i.e. ``fixtures/`` folder is in the same folder than ``pydocusign/test.py``. * `tox` runs the documentation build, i.e. ``fixtures/`` folder is in the code repository's root, whereas ``pydocusign/test.py`` lives somewhere in ``.tox/``. Other situations are not supported at the moment. """ here = os.path.dirname(os.path.abspath(__file__)) here_parts = here.split(os.path.sep) is_tox = '.tox' in here_parts if is_tox: tox_index = here_parts.index('.tox') project_dir = here for i in range(len(here_parts) - tox_index): project_dir = os.path.dirname(project_dir) else: project_dir = os.path.dirname(here) return os.path.normpath(os.path.join(project_dir, 'fixtures'))
[ 1, 529, 9507, 29958, 2272, 1514, 375, 647, 29914, 1688, 29889, 2272, 13, 15945, 29908, 7270, 1907, 304, 1065, 6987, 2820, 421, 2272, 1514, 375, 647, 29952, 1213, 15945, 13, 5215, 2897, 13, 13, 13, 1753, 5713, 486, 1973, 29918, 3972, 7295, 13, 1678, 9995, 11609, 8380, 2224, 304, 421, 2272, 1514, 375, 647, 20497, 29879, 5713, 486, 1973, 4516, 29892, 408, 1900, 4140, 29889, 13, 13, 1678, 910, 740, 11286, 1023, 18845, 29901, 13, 13, 1678, 334, 366, 671, 372, 297, 775, 9810, 29915, 29879, 3876, 29892, 474, 29889, 29872, 29889, 4954, 7241, 486, 1973, 29914, 16159, 4138, 338, 297, 278, 13, 418, 1021, 4138, 1135, 4954, 2272, 1514, 375, 647, 29914, 1688, 29889, 2272, 29952, 1412, 13, 13, 1678, 334, 421, 517, 29916, 29952, 6057, 278, 5106, 2048, 29892, 474, 29889, 29872, 29889, 4954, 7241, 486, 1973, 29914, 16159, 4138, 338, 297, 278, 13, 418, 775, 9810, 29915, 29879, 3876, 29892, 13452, 4954, 2272, 1514, 375, 647, 29914, 1688, 29889, 2272, 16159, 12080, 9051, 297, 13, 418, 421, 1412, 517, 29916, 16527, 1412, 13, 13, 1678, 5901, 18845, 526, 451, 6969, 472, 278, 3256, 29889, 13, 13, 1678, 9995, 13, 1678, 1244, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 22168, 1445, 1649, 876, 13, 1678, 1244, 29918, 20895, 353, 1244, 29889, 5451, 29898, 359, 29889, 2084, 29889, 19570, 29897, 13, 1678, 338, 29918, 517, 29916, 353, 15300, 517, 29916, 29915, 297, 1244, 29918, 20895, 13, 1678, 565, 338, 29918, 517, 29916, 29901, 13, 4706, 304, 29916, 29918, 2248, 353, 1244, 29918, 20895, 29889, 2248, 12839, 517, 29916, 1495, 13, 4706, 2060, 29918, 3972, 353, 1244, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 4150, 29918, 20895, 29897, 448, 304, 29916, 29918, 2248, 1125, 13, 9651, 2060, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 4836, 29918, 3972, 29897, 13, 1678, 1683, 29901, 13, 4706, 2060, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 4150, 29897, 13, 1678, 736, 2897, 29889, 2084, 29889, 12324, 2084, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4836, 29918, 3972, 29892, 525, 7241, 486, 1973, 8785, 13, 2 ]
allocator.py
javicacheiro/resource-allocator
0
86690
"""Resource Allocation API""" import kvstore PREFIX = 'resources' DISK_PREFIX = 'disks' ADDRESS_PREFIX = 'networks' class ResourceManager(object): """Resource Management base class""" def __init__(self, endpoint='http://127.0.0.1:8500/v1/kv'): self.endpoint = endpoint self._kv = kvstore.Client(self.endpoint) def get_status(self, resource_status_path): """Returns the status of all the resources of a given node""" subtree = self._kv.recurse( '{}/{}'.format(PREFIX, resource_status_path)) return {self._parse_res_name(k): subtree[k] for k in subtree.keys() if subtree[k] != ""} def set_status(self, resource_status_path, status): """Sets the status of a given resource""" self._kv.set( '{}/{}/status'.format(PREFIX, resource_status_path), status) def get_free(self, resource_status_path): """Returns the list of free resources of a given node""" subtree = self._kv.recurse('{}/{}'.format(PREFIX, resource_status_path)) free_res = self._filter_res(subtree, status='free') return free_res def get_used(self, resource_status_path): """Returns the list of used resources of a given node""" subtree = self._kv.recurse('{}/{}'.format(PREFIX, resource_status_path)) used_res = self._filter_res(subtree, status='used') return used_res def _parse_res_name(self, key): """Extract disk name from key""" return key.split('/')[-2] def _filter_res(self, subtree, status='free'): """Filter resources based on status""" if status == 'free': filtered_res = [self._parse_res_name(k) for k in sorted(subtree.keys()) if subtree[k] == 'free'] elif status == 'used': filtered_res = [self._parse_res_name(k) for k in sorted(subtree.keys()) # Skip also the empty key (tree directory) if subtree[k] != 'free' and subtree[k] != ""] else: raise StatusNotSupportedError() return filtered_res class DiskManager(ResourceManager): """Manage disk allocations""" def get_used(self, node): return ResourceManager.get_used(self, DISK_PREFIX + "/" + node) def get_free(self, node): disks = ResourceManager.get_free(self, DISK_PREFIX + "/" + node) return {'number': len(disks), "disks": disks} def get_status(self, node, disk): return ResourceManager.get_status(self, DISK_PREFIX + "/" + node + "/" + disk) def set_status(self, node, disk, status): return ResourceManager.set_status(self, DISK_PREFIX + "/" + node + "/" + disk, status) def set_used(self, node, disk): return self.set_status(node, disk, "used") def set_free(self, node, disk): return self.set_status(node, disk, "free") class AddressManager(ResourceManager): """Manage network address allocations""" def get_used(self, network): return ResourceManager.get_used(self, ADDRESS_PREFIX + "/" + network) def get_free(self, network): ips = ResourceManager.get_free(self, ADDRESS_PREFIX + "/" + network) return {'number': len(ips), "ips": ips} def get_status(self, network, ip): return ResourceManager.get_status(self, ADDRESS_PREFIX + network + "/" + ip) def set_status(self, network, ip, status): return ResourceManager.set_status(self, ADDRESS_PREFIX + network + "/" + ip, status) def set_used(self, network, ip): return self.set_status(network, ip, "used") def set_free(self, network, ip): return self.set_status(network, ip, "free") class StatusNotSupportedError(Exception): pass
[ 1, 9995, 6848, 838, 5479, 3450, 15945, 29908, 13, 5215, 10908, 8899, 13, 13, 15094, 25634, 353, 525, 13237, 29915, 13, 23711, 29968, 29918, 15094, 25634, 353, 525, 2218, 2039, 29915, 13, 17744, 26785, 29918, 15094, 25634, 353, 525, 11618, 29879, 29915, 13, 13, 13, 1990, 18981, 3260, 29898, 3318, 1125, 13, 1678, 9995, 6848, 15057, 2967, 770, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 16248, 2433, 1124, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29901, 29947, 29945, 29900, 29900, 29914, 29894, 29896, 29914, 27049, 29374, 13, 4706, 1583, 29889, 29734, 353, 16248, 13, 4706, 1583, 3032, 27049, 353, 10908, 8899, 29889, 4032, 29898, 1311, 29889, 29734, 29897, 13, 13, 1678, 822, 679, 29918, 4882, 29898, 1311, 29892, 6503, 29918, 4882, 29918, 2084, 1125, 13, 4706, 9995, 11609, 29879, 278, 4660, 310, 599, 278, 7788, 310, 263, 2183, 2943, 15945, 29908, 13, 4706, 1014, 8336, 353, 1583, 3032, 27049, 29889, 276, 2764, 344, 29898, 13, 9651, 22372, 6822, 8875, 4286, 4830, 29898, 15094, 25634, 29892, 6503, 29918, 4882, 29918, 2084, 876, 13, 4706, 736, 426, 1311, 3032, 5510, 29918, 690, 29918, 978, 29898, 29895, 1125, 13, 18884, 1014, 8336, 29961, 29895, 29962, 363, 413, 297, 1014, 8336, 29889, 8149, 580, 565, 1014, 8336, 29961, 29895, 29962, 2804, 5124, 29913, 13, 13, 1678, 822, 731, 29918, 4882, 29898, 1311, 29892, 6503, 29918, 4882, 29918, 2084, 29892, 4660, 1125, 13, 4706, 9995, 29903, 1691, 278, 4660, 310, 263, 2183, 6503, 15945, 29908, 13, 4706, 1583, 3032, 27049, 29889, 842, 29898, 13, 9651, 22372, 6822, 29912, 6822, 4882, 4286, 4830, 29898, 15094, 25634, 29892, 6503, 29918, 4882, 29918, 2084, 511, 4660, 29897, 13, 13, 1678, 822, 679, 29918, 9021, 29898, 1311, 29892, 6503, 29918, 4882, 29918, 2084, 1125, 13, 4706, 9995, 11609, 29879, 278, 1051, 310, 3889, 7788, 310, 263, 2183, 2943, 15945, 29908, 13, 4706, 1014, 8336, 353, 1583, 3032, 27049, 29889, 276, 2764, 344, 877, 29912, 6822, 8875, 4286, 4830, 29898, 15094, 25634, 29892, 6503, 29918, 4882, 29918, 2084, 876, 13, 4706, 3889, 29918, 690, 353, 1583, 3032, 4572, 29918, 690, 29898, 1491, 8336, 29892, 4660, 2433, 9021, 1495, 13, 4706, 736, 3889, 29918, 690, 13, 13, 1678, 822, 679, 29918, 3880, 29898, 1311, 29892, 6503, 29918, 4882, 29918, 2084, 1125, 13, 4706, 9995, 11609, 29879, 278, 1051, 310, 1304, 7788, 310, 263, 2183, 2943, 15945, 29908, 13, 4706, 1014, 8336, 353, 1583, 3032, 27049, 29889, 276, 2764, 344, 877, 29912, 6822, 8875, 4286, 4830, 29898, 15094, 25634, 29892, 6503, 29918, 4882, 29918, 2084, 876, 13, 4706, 1304, 29918, 690, 353, 1583, 3032, 4572, 29918, 690, 29898, 1491, 8336, 29892, 4660, 2433, 3880, 1495, 13, 4706, 736, 1304, 29918, 690, 13, 13, 1678, 822, 903, 5510, 29918, 690, 29918, 978, 29898, 1311, 29892, 1820, 1125, 13, 4706, 9995, 5647, 1461, 8086, 1024, 515, 1820, 15945, 29908, 13, 4706, 736, 1820, 29889, 5451, 11219, 1495, 14352, 29906, 29962, 13, 13, 1678, 822, 903, 4572, 29918, 690, 29898, 1311, 29892, 1014, 8336, 29892, 4660, 2433, 9021, 29374, 13, 4706, 9995, 5072, 7788, 2729, 373, 4660, 15945, 29908, 13, 4706, 565, 4660, 1275, 525, 9021, 2396, 13, 9651, 22289, 29918, 690, 353, 518, 1311, 3032, 5510, 29918, 690, 29918, 978, 29898, 29895, 29897, 13, 462, 9651, 363, 413, 297, 12705, 29898, 1491, 8336, 29889, 8149, 3101, 13, 462, 9651, 565, 1014, 8336, 29961, 29895, 29962, 1275, 525, 9021, 2033, 13, 4706, 25342, 4660, 1275, 525, 3880, 2396, 13, 9651, 22289, 29918, 690, 353, 518, 1311, 3032, 5510, 29918, 690, 29918, 978, 29898, 29895, 29897, 13, 462, 9651, 363, 413, 297, 12705, 29898, 1491, 8336, 29889, 8149, 3101, 13, 462, 9651, 396, 4971, 666, 884, 278, 4069, 1820, 313, 8336, 3884, 29897, 13, 462, 9651, 565, 1014, 8336, 29961, 29895, 29962, 2804, 525, 9021, 29915, 322, 1014, 8336, 29961, 29895, 29962, 2804, 376, 3108, 13, 4706, 1683, 29901, 13, 9651, 12020, 16034, 3664, 14039, 287, 2392, 580, 13, 13, 4706, 736, 22289, 29918, 690, 13, 13, 13, 1990, 20579, 3260, 29898, 6848, 3260, 1125, 13, 1678, 9995, 2517, 482, 8086, 6643, 800, 15945, 29908, 13, 13, 1678, 822, 679, 29918, 3880, 29898, 1311, 29892, 2943, 1125, 13, 4706, 736, 18981, 3260, 29889, 657, 29918, 3880, 29898, 1311, 29892, 28657, 29968, 29918, 15094, 25634, 718, 5591, 29908, 718, 2943, 29897, 13, 13, 1678, 822, 679, 29918, 9021, 29898, 1311, 29892, 2943, 1125, 13, 4706, 766, 2039, 353, 18981, 3260, 29889, 657, 29918, 9021, 29898, 1311, 29892, 28657, 29968, 29918, 15094, 25634, 718, 5591, 29908, 718, 2943, 29897, 13, 4706, 736, 11117, 4537, 2396, 7431, 29898, 2218, 2039, 511, 376, 2218, 2039, 1115, 766, 2039, 29913, 13, 13, 1678, 822, 679, 29918, 4882, 29898, 1311, 29892, 2943, 29892, 8086, 1125, 13, 4706, 736, 18981, 3260, 29889, 657, 29918, 4882, 29898, 1311, 29892, 28657, 29968, 29918, 15094, 25634, 718, 5591, 29908, 718, 2943, 718, 5591, 29908, 718, 8086, 29897, 13, 13, 1678, 822, 731, 29918, 4882, 29898, 1311, 29892, 2943, 29892, 8086, 29892, 4660, 1125, 13, 4706, 736, 18981, 3260, 29889, 842, 29918, 4882, 29898, 1311, 29892, 28657, 29968, 29918, 15094, 25634, 718, 5591, 29908, 718, 2943, 718, 5591, 29908, 718, 8086, 29892, 4660, 29897, 13, 13, 1678, 822, 731, 29918, 3880, 29898, 1311, 29892, 2943, 29892, 8086, 1125, 13, 4706, 736, 1583, 29889, 842, 29918, 4882, 29898, 3177, 29892, 8086, 29892, 376, 3880, 1159, 13, 13, 1678, 822, 731, 29918, 9021, 29898, 1311, 29892, 2943, 29892, 8086, 1125, 13, 4706, 736, 1583, 29889, 842, 29918, 4882, 29898, 3177, 29892, 8086, 29892, 376, 9021, 1159, 13, 13, 13, 1990, 16428, 3260, 29898, 6848, 3260, 1125, 13, 1678, 9995, 2517, 482, 3564, 3211, 6643, 800, 15945, 29908, 13, 13, 1678, 822, 679, 29918, 3880, 29898, 1311, 29892, 3564, 1125, 13, 4706, 736, 18981, 3260, 29889, 657, 29918, 3880, 29898, 1311, 29892, 27827, 26785, 29918, 15094, 25634, 718, 5591, 29908, 718, 3564, 29897, 13, 13, 1678, 822, 679, 29918, 9021, 29898, 1311, 29892, 3564, 1125, 13, 4706, 474, 567, 353, 18981, 3260, 29889, 657, 29918, 9021, 29898, 1311, 29892, 27827, 26785, 29918, 15094, 25634, 718, 5591, 29908, 718, 3564, 29897, 13, 4706, 736, 11117, 4537, 2396, 7431, 29898, 4512, 511, 376, 4512, 1115, 474, 567, 29913, 13, 13, 1678, 822, 679, 29918, 4882, 29898, 1311, 29892, 3564, 29892, 10377, 1125, 13, 4706, 736, 18981, 3260, 29889, 657, 29918, 4882, 29898, 1311, 29892, 27827, 26785, 29918, 15094, 25634, 718, 3564, 718, 5591, 29908, 718, 10377, 29897, 13, 13, 1678, 822, 731, 29918, 4882, 29898, 1311, 29892, 3564, 29892, 10377, 29892, 4660, 1125, 13, 4706, 736, 18981, 3260, 29889, 842, 29918, 4882, 29898, 1311, 29892, 27827, 26785, 29918, 15094, 25634, 718, 3564, 718, 5591, 29908, 718, 10377, 29892, 4660, 29897, 13, 13, 1678, 822, 731, 29918, 3880, 29898, 1311, 29892, 3564, 29892, 10377, 1125, 13, 4706, 736, 1583, 29889, 842, 29918, 4882, 29898, 11618, 29892, 10377, 29892, 376, 3880, 1159, 13, 13, 1678, 822, 731, 29918, 9021, 29898, 1311, 29892, 3564, 29892, 10377, 1125, 13, 4706, 736, 1583, 29889, 842, 29918, 4882, 29898, 11618, 29892, 10377, 29892, 376, 9021, 1159, 13, 13, 13, 1990, 16034, 3664, 14039, 287, 2392, 29898, 2451, 1125, 13, 1678, 1209, 13, 2 ]
eda/numerical_data/correlation_heat_map.py
kmsk99/data_science_toolbar
0
150345
corr_data = df_train[['Id', 'MSSubClass', 'LotFrontage', 'LotArea', 'OverallQual', 'OverallCond', 'YearBuilt', 'YearRemodAdd', 'MasVnrArea', 'BsmtFinSF1', 'BsmtFinSF2', 'BsmtUnfSF', 'TotalBsmtSF', '1stFlrSF', '2ndFlrSF', 'LowQualFinSF', 'GrLivArea', 'BsmtFullBath', 'BsmtHalfBath', 'FullBath', 'HalfBath', 'BedroomAbvGr', 'KitchenAbvGr', 'TotRmsAbvGrd', 'Fireplaces', 'GarageYrBlt', 'GarageCars', 'GarageArea', 'WoodDeckSF', 'OpenPorchSF', 'EnclosedPorch', '3SsnPorch', 'ScreenPorch', 'PoolArea', 'MiscVal', 'MoSold', 'YrSold', 'SalePrice']] colormap = plt.cm.PuBu sns.set(font_scale=1.0) f, ax = plt.subplots(figsize=(14, 12)) plt.title('Correlation of Numeric Features with Sale Price', y=1, size=18) sns.heatmap(corr_data.corr(), square=True, linewidths=0.1, cmap=colormap, linecolor="white", vmax=0.8) # Heat Map은 seaborn 덕분에 직관적으로 이해가 가능하여 변수 간 상관관계에 대하여 쉽게 알 수 있습니다. # 또한 변수 간 다중 공선성을 감지하는 데 유용합니다. # 대각선 열을 제외한 박스 중 가장 진한 파란색을 띄는 박스가 보입니다. # 첫 번째는 'TotalBsmtSF'와 '1stFlrSF'변수의 관계입니다. # 두 번째는 'Garage'와 관련한 변수를 나타냅니다. # 두 경우 모두 변수 사이의 상관 관계가 너무 강하여 다중 공선성(MultiColarisity) 상황이 나타날 수 있습니다. # 변수가 거의 동일한 정보를 제공하므로 다중 공선성이 실제로 발생한다는 결론을 내릴 수 있습니다. # 또한 확인해야할 부분은 'SalePrice'와의 상관 관계입니다. # 'GrLivArea', 'TotalBsmtSF'및 'OverallQual'은 큰 관계를 보입니다. # 나머지 변수와의 상관 관계를 자세히 알아보기 위해 Zoomed Heat Map을 확인합니다.
[ 1, 27760, 29918, 1272, 353, 4489, 29918, 14968, 29961, 1839, 1204, 742, 525, 29924, 1799, 431, 2385, 742, 525, 29931, 327, 29348, 482, 742, 525, 29931, 327, 13799, 742, 525, 3563, 497, 24399, 742, 13, 462, 418, 525, 3563, 497, 10983, 742, 525, 12883, 3727, 2782, 742, 525, 12883, 7301, 397, 2528, 742, 525, 29924, 294, 29963, 22230, 13799, 742, 525, 29933, 3844, 29873, 12881, 20322, 29896, 742, 13, 462, 418, 525, 29933, 3844, 29873, 12881, 20322, 29906, 742, 525, 29933, 3844, 29873, 2525, 29888, 20322, 742, 525, 11536, 29933, 3844, 29873, 20322, 742, 525, 29896, 303, 8754, 29878, 20322, 742, 525, 29906, 299, 8754, 29878, 20322, 742, 13, 462, 418, 525, 29931, 340, 24399, 12881, 20322, 742, 525, 3338, 29931, 440, 13799, 742, 525, 29933, 3844, 29873, 13658, 29933, 493, 742, 525, 29933, 3844, 29873, 29950, 3131, 29933, 493, 742, 525, 13658, 29933, 493, 742, 13, 462, 418, 525, 29950, 3131, 29933, 493, 742, 525, 29933, 287, 8345, 4920, 29894, 3338, 742, 525, 29968, 23213, 4920, 29894, 3338, 742, 525, 29911, 327, 29934, 1516, 4920, 29894, 3338, 29881, 742, 13, 462, 418, 525, 18654, 29886, 6048, 742, 525, 29954, 279, 482, 29979, 29878, 29933, 1896, 742, 525, 29954, 279, 482, 29907, 1503, 742, 525, 29954, 279, 482, 13799, 742, 525, 29956, 2092, 2772, 384, 20322, 742, 13, 462, 418, 525, 6585, 29925, 25350, 20322, 742, 525, 2369, 15603, 29925, 25350, 742, 525, 29941, 29903, 16586, 29925, 25350, 742, 525, 11357, 29925, 25350, 742, 525, 11426, 13799, 742, 13, 462, 418, 525, 29924, 10669, 1440, 742, 525, 22638, 29903, 1025, 742, 525, 29979, 29878, 29903, 1025, 742, 525, 29903, 744, 13026, 2033, 29962, 13, 13, 1054, 555, 481, 353, 14770, 29889, 4912, 29889, 29925, 29884, 3727, 13, 29879, 1983, 29889, 842, 29898, 5657, 29918, 7052, 29922, 29896, 29889, 29900, 29897, 13, 13, 29888, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 1003, 2311, 7607, 29896, 29946, 29892, 29871, 29896, 29906, 876, 13, 572, 29873, 29889, 3257, 877, 12521, 23445, 310, 405, 25099, 5169, 3698, 411, 317, 744, 20743, 742, 343, 29922, 29896, 29892, 2159, 29922, 29896, 29947, 29897, 13, 29879, 1983, 29889, 354, 271, 1958, 29898, 29725, 29918, 1272, 29889, 29725, 3285, 6862, 29922, 5574, 29892, 1196, 2103, 29879, 29922, 29900, 29889, 29896, 29892, 13, 9651, 274, 1958, 29922, 1054, 555, 481, 29892, 1196, 2780, 543, 10921, 613, 325, 3317, 29922, 29900, 29889, 29947, 29897, 13, 13, 29937, 940, 271, 7315, 31354, 409, 370, 1398, 29871, 238, 144, 152, 238, 185, 135, 31054, 29871, 239, 170, 132, 237, 183, 131, 239, 163, 132, 239, 159, 191, 30906, 29871, 30393, 31435, 30903, 29871, 30903, 238, 141, 168, 30944, 31457, 29871, 238, 182, 131, 30970, 29871, 237, 179, 135, 29871, 31158, 237, 183, 131, 237, 183, 131, 237, 182, 135, 31054, 29871, 30890, 30944, 31457, 29871, 239, 140, 192, 237, 181, 143, 29871, 239, 152, 143, 29871, 30970, 29871, 239, 161, 139, 239, 141, 184, 31063, 30709, 29889, 13, 29937, 29871, 238, 155, 147, 30877, 29871, 238, 182, 131, 30970, 29871, 237, 179, 135, 29871, 30709, 31941, 29871, 31334, 31345, 31126, 31286, 29871, 237, 179, 147, 30811, 30944, 31081, 29871, 238, 144, 179, 29871, 31533, 31737, 31980, 31063, 30709, 29889, 13, 29937, 29871, 30890, 237, 179, 132, 31345, 29871, 239, 154, 183, 31286, 29871, 31306, 239, 156, 187, 30877, 29871, 31736, 30784, 29871, 31941, 29871, 30903, 31299, 29871, 31536, 30877, 29871, 240, 143, 143, 238, 161, 131, 239, 134, 140, 31286, 29871, 238, 160, 135, 31081, 29871, 31736, 30784, 30903, 29871, 31199, 239, 161, 136, 31063, 30709, 29889, 13, 29937, 29871, 239, 181, 174, 29871, 238, 181, 139, 239, 170, 187, 31081, 525, 11536, 29933, 3844, 29873, 20322, 29915, 239, 156, 131, 525, 29896, 303, 8754, 29878, 20322, 29915, 238, 182, 131, 30970, 30708, 29871, 237, 183, 131, 237, 182, 135, 239, 161, 136, 31063, 30709, 29889, 13, 29937, 29871, 238, 148, 147, 29871, 238, 181, 139, 239, 170, 187, 31081, 525, 29954, 279, 482, 29915, 239, 156, 131, 29871, 237, 183, 131, 238, 163, 171, 30877, 29871, 238, 182, 131, 30970, 31517, 29871, 31207, 31925, 238, 134, 136, 31063, 30709, 29889, 13, 29937, 29871, 238, 148, 147, 29871, 31378, 31327, 29871, 31962, 238, 148, 147, 29871, 238, 182, 131, 30970, 29871, 30791, 30393, 30708, 29871, 31158, 237, 183, 131, 29871, 237, 183, 131, 237, 182, 135, 30903, 29871, 238, 135, 139, 31716, 29871, 31774, 30944, 31457, 29871, 30709, 31941, 29871, 31334, 31345, 31126, 29898, 15329, 1625, 12260, 537, 29897, 29871, 31158, 240, 156, 172, 30393, 29871, 31207, 31925, 238, 133, 163, 29871, 30970, 29871, 239, 161, 139, 239, 141, 184, 31063, 30709, 29889, 13, 29937, 29871, 238, 182, 131, 30970, 30903, 29871, 237, 180, 179, 30708, 29871, 31000, 31153, 30877, 29871, 30852, 31199, 31517, 29871, 31306, 31334, 30944, 238, 178, 131, 30906, 29871, 30709, 31941, 29871, 31334, 31345, 31126, 30393, 29871, 239, 142, 167, 31306, 30906, 29871, 238, 179, 159, 239, 134, 160, 30877, 30709, 31081, 29871, 237, 181, 179, 238, 164, 163, 31286, 29871, 31940, 238, 169, 183, 29871, 30970, 29871, 239, 161, 139, 239, 141, 184, 31063, 30709, 29889, 13, 29937, 29871, 238, 155, 147, 30877, 29871, 240, 156, 152, 30918, 31435, 239, 152, 191, 240, 152, 163, 29871, 31279, 238, 185, 135, 31354, 525, 29903, 744, 13026, 29915, 239, 156, 131, 30708, 29871, 31158, 237, 183, 131, 29871, 237, 183, 131, 237, 182, 135, 239, 161, 136, 31063, 30709, 29889, 13, 29937, 525, 3338, 29931, 440, 13799, 742, 525, 11536, 29933, 3844, 29873, 20322, 29915, 238, 179, 146, 525, 3563, 497, 24399, 29915, 31354, 29871, 240, 132, 179, 29871, 237, 183, 131, 237, 182, 135, 31517, 29871, 31199, 239, 161, 136, 31063, 30709, 29889, 13, 29937, 29871, 31207, 238, 171, 187, 30811, 29871, 238, 182, 131, 30970, 239, 156, 131, 30708, 29871, 31158, 237, 183, 131, 29871, 237, 183, 131, 237, 182, 135, 31517, 29871, 31013, 31578, 240, 161, 139, 29871, 239, 152, 143, 30860, 31199, 30827, 29871, 31724, 31435, 17421, 27067, 940, 271, 7315, 31286, 29871, 240, 156, 152, 30918, 31980, 31063, 30709, 29889, 13, 2 ]
utils/indicators/cost_abat_value/calculate.py
kvanderwijst/IAMDiagnostics
0
77451
import numpy as np from utils.data.handling import set_value_from_var_column def create_columns( data, prev_meta, years=["2050", "2100"], cprices=[130.3, 1441.3], policy_scenario="diag-c80-gr5", mute=False, ): meta = prev_meta.copy() created_columns = [] ## Calculate policy cost for each model for year, cprice in zip(years, cprices): col_costs = f"Policy cost {year}" col_emiss = f"Emissions CAV {year}" col_emiss_base = f"{col_emiss} base" set_value_from_var_column( data, meta, "Policy cost variable", col_costs, year, policy_scenario ) set_value_from_var_column( data, meta, "Emissions_for_CAV", col_emiss, year, policy_scenario ) set_value_from_var_column( data, meta, "Emissions_for_CAV", col_emiss_base, year, "diag-base" ) # Make all costs positive meta[col_costs] = meta[col_costs].abs() # Cost per GDP col_per_GDP = f"{col_costs} per GDP" GDP_column = f"GDP {year} {policy_scenario}" # Check if GDP column already exists if GDP_column not in meta.columns: set_value_from_var_column( data, meta, "GDP_metric", GDP_column, year, policy_scenario ) meta[col_per_GDP] = meta[col_costs] / meta[GDP_column] # Using this information, calculate CAV col_CAV = f"CAV {year}" GHG_reduction_absolute = ( meta[col_emiss_base] - meta[col_emiss] ) / 1000 # Convert Mt to Gt # cprice = meta[f'Carbon price c80 {year}'] ## Use hardcoded c-price meta[col_CAV] = meta[col_costs] / (GHG_reduction_absolute * cprice) # CAV < 0 or CAV > 2.5 is a mistake, exclude those meta.loc[ ~meta[col_CAV].between(0, 2.5) | (meta[col_per_GDP] > 0.15) | (meta[col_costs] > 50000), [col_costs, col_per_GDP, col_CAV, col_per_GDP], ] = np.nan created_columns += [col_costs, col_emiss, col_emiss_base, col_per_GDP, col_CAV] if not mute: print(f"Created columns: {created_columns}\n") return meta
[ 1, 1053, 12655, 408, 7442, 13, 13, 3166, 3667, 29879, 29889, 1272, 29889, 3179, 1847, 1053, 731, 29918, 1767, 29918, 3166, 29918, 1707, 29918, 4914, 13, 13, 13, 1753, 1653, 29918, 13099, 29898, 13, 1678, 848, 29892, 13, 1678, 12379, 29918, 7299, 29892, 13, 1678, 2440, 29922, 3366, 29906, 29900, 29945, 29900, 613, 376, 29906, 29896, 29900, 29900, 12436, 13, 1678, 274, 558, 1575, 11759, 29896, 29941, 29900, 29889, 29941, 29892, 29871, 29896, 29946, 29946, 29896, 29889, 29941, 1402, 13, 1678, 8898, 29918, 1557, 24893, 543, 6051, 351, 29899, 29883, 29947, 29900, 29899, 629, 29945, 613, 13, 1678, 286, 1082, 29922, 8824, 29892, 13, 1125, 13, 13, 1678, 12700, 353, 12379, 29918, 7299, 29889, 8552, 580, 13, 1678, 2825, 29918, 13099, 353, 5159, 13, 13, 1678, 444, 20535, 403, 8898, 3438, 363, 1269, 1904, 13, 1678, 363, 1629, 29892, 274, 9175, 297, 14319, 29898, 6360, 29879, 29892, 274, 558, 1575, 1125, 13, 4706, 784, 29918, 18253, 29879, 353, 285, 29908, 15644, 3438, 426, 6360, 5038, 13, 4706, 784, 29918, 331, 790, 353, 285, 29908, 6026, 6847, 315, 7520, 426, 6360, 5038, 13, 4706, 784, 29918, 331, 790, 29918, 3188, 353, 285, 29908, 29912, 1054, 29918, 331, 790, 29913, 2967, 29908, 13, 4706, 731, 29918, 1767, 29918, 3166, 29918, 1707, 29918, 4914, 29898, 13, 9651, 848, 29892, 12700, 29892, 376, 15644, 3438, 2286, 613, 784, 29918, 18253, 29879, 29892, 1629, 29892, 8898, 29918, 1557, 24893, 13, 4706, 1723, 13, 4706, 731, 29918, 1767, 29918, 3166, 29918, 1707, 29918, 4914, 29898, 13, 9651, 848, 29892, 12700, 29892, 376, 6026, 6847, 29918, 1454, 29918, 5454, 29963, 613, 784, 29918, 331, 790, 29892, 1629, 29892, 8898, 29918, 1557, 24893, 13, 4706, 1723, 13, 4706, 731, 29918, 1767, 29918, 3166, 29918, 1707, 29918, 4914, 29898, 13, 9651, 848, 29892, 12700, 29892, 376, 6026, 6847, 29918, 1454, 29918, 5454, 29963, 613, 784, 29918, 331, 790, 29918, 3188, 29892, 1629, 29892, 376, 6051, 351, 29899, 3188, 29908, 13, 4706, 1723, 13, 13, 4706, 396, 8561, 599, 21544, 6374, 13, 4706, 12700, 29961, 1054, 29918, 18253, 29879, 29962, 353, 12700, 29961, 1054, 29918, 18253, 29879, 1822, 6897, 580, 13, 13, 4706, 396, 9839, 639, 402, 11191, 13, 4706, 784, 29918, 546, 29918, 29954, 11191, 353, 285, 29908, 29912, 1054, 29918, 18253, 29879, 29913, 639, 402, 11191, 29908, 13, 13, 4706, 402, 11191, 29918, 4914, 353, 285, 29908, 29954, 11191, 426, 6360, 29913, 426, 22197, 29918, 1557, 24893, 5038, 13, 4706, 396, 5399, 565, 402, 11191, 1897, 2307, 4864, 13, 4706, 565, 402, 11191, 29918, 4914, 451, 297, 12700, 29889, 13099, 29901, 13, 9651, 731, 29918, 1767, 29918, 3166, 29918, 1707, 29918, 4914, 29898, 13, 18884, 848, 29892, 12700, 29892, 376, 29954, 11191, 29918, 16414, 613, 402, 11191, 29918, 4914, 29892, 1629, 29892, 8898, 29918, 1557, 24893, 13, 9651, 1723, 13, 13, 4706, 12700, 29961, 1054, 29918, 546, 29918, 29954, 11191, 29962, 353, 12700, 29961, 1054, 29918, 18253, 29879, 29962, 847, 12700, 29961, 29954, 11191, 29918, 4914, 29962, 13, 13, 4706, 396, 5293, 445, 2472, 29892, 8147, 315, 7520, 13, 4706, 784, 29918, 5454, 29963, 353, 285, 29908, 5454, 29963, 426, 6360, 5038, 13, 4706, 402, 29950, 29954, 29918, 9313, 428, 29918, 23552, 353, 313, 13, 9651, 12700, 29961, 1054, 29918, 331, 790, 29918, 3188, 29962, 448, 12700, 29961, 1054, 29918, 331, 790, 29962, 13, 4706, 1723, 847, 29871, 29896, 29900, 29900, 29900, 29871, 396, 14806, 341, 29873, 304, 402, 29873, 13, 4706, 396, 274, 9175, 353, 12700, 29961, 29888, 29915, 8179, 6718, 8666, 274, 29947, 29900, 426, 6360, 29913, 2033, 444, 4803, 2898, 29659, 274, 29899, 9175, 13, 4706, 12700, 29961, 1054, 29918, 5454, 29963, 29962, 353, 12700, 29961, 1054, 29918, 18253, 29879, 29962, 847, 313, 29954, 29950, 29954, 29918, 9313, 428, 29918, 23552, 334, 274, 9175, 29897, 13, 13, 4706, 396, 315, 7520, 529, 29871, 29900, 470, 315, 7520, 1405, 29871, 29906, 29889, 29945, 338, 263, 10171, 29892, 19060, 1906, 13, 4706, 12700, 29889, 2029, 29961, 13, 9651, 3695, 7299, 29961, 1054, 29918, 5454, 29963, 1822, 14811, 29898, 29900, 29892, 29871, 29906, 29889, 29945, 29897, 13, 9651, 891, 313, 7299, 29961, 1054, 29918, 546, 29918, 29954, 11191, 29962, 1405, 29871, 29900, 29889, 29896, 29945, 29897, 13, 9651, 891, 313, 7299, 29961, 1054, 29918, 18253, 29879, 29962, 1405, 29871, 29945, 29900, 29900, 29900, 29900, 511, 13, 9651, 518, 1054, 29918, 18253, 29879, 29892, 784, 29918, 546, 29918, 29954, 11191, 29892, 784, 29918, 5454, 29963, 29892, 784, 29918, 546, 29918, 29954, 11191, 1402, 13, 4706, 4514, 353, 7442, 29889, 13707, 13, 13, 4706, 2825, 29918, 13099, 4619, 518, 1054, 29918, 18253, 29879, 29892, 784, 29918, 331, 790, 29892, 784, 29918, 331, 790, 29918, 3188, 29892, 784, 29918, 546, 29918, 29954, 11191, 29892, 784, 29918, 5454, 29963, 29962, 13, 13, 1678, 565, 451, 286, 1082, 29901, 13, 4706, 1596, 29898, 29888, 29908, 20399, 4341, 29901, 426, 11600, 29918, 13099, 1012, 29876, 1159, 13, 13, 1678, 736, 12700, 13, 2 ]
Day9b/Day9b.py
mathuin/advent-of-code-2017
0
152680
#!/usr/bin/python3 import sys # stream processing # streams have groups and garbage. # groups are delimited by {}. # groups can contain other groups and garbage. # garbage is delimited by <>. # garbage can't contain groups. # any character followed by ! is cancelled. # goal is to find total score for all groups. # group score = 1 + score of containing group. # step one, remove all the !. from the stream. def cancelChars(chars): for k, v in enumerate(chars): if v == '': continue if v == '!': chars[k] = '' chars[k+1] = '' return [x for x in chars if x != ''] # step two, remove all the <[^>]> from the stream. def removeGarbage(chars): trash = False removed = 0 for char in chars: if not trash and char == '<': trash = True removed -= 1 if trash and char == '>': trash = False if trash: removed += 1 return removed def countGroups(chars): groups = [] depth = 0 for k, v in enumerate(chars): if v == '{': depth += 1 if v == '}': groups.append(depth) depth -= 1 return sum(groups) # Unit tests for countGroups tt = { 'a': ('<>', 0), 'b': ('<random characters>', 17), 'c': ('<<<<>', 3), 'd': ('<{!>}>', 2), 'e': ('<!!>', 0), 'f': ('<!!!>>', 0), 'g': ('<{o"i!a,<{i<a>', 10), } for k, v in tt.items(): chars = list(v[0]) chars = cancelChars(chars) result = removeGarbage(chars) if result != v[1]: print("FAIL: input ", v[0], ": expected ", v[1], ", got ", result, sep="") # The input is not checked for sanity, just existence. stream = sys.stdin.readlines() if len(stream) == 0: print("stream missing!") sys.exit(1) chars = list(stream[0]) chars = cancelChars(chars) print(removeGarbage(chars))
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 29941, 13, 13, 5215, 10876, 13, 13, 29937, 4840, 9068, 13, 13, 29937, 20873, 505, 6471, 322, 25861, 29889, 13, 29937, 6471, 526, 628, 326, 1573, 491, 426, 1836, 13, 29937, 6471, 508, 1712, 916, 6471, 322, 25861, 29889, 13, 29937, 25861, 338, 628, 326, 1573, 491, 15271, 29889, 13, 29937, 25861, 508, 29915, 29873, 1712, 6471, 29889, 13, 29937, 738, 2931, 5643, 491, 1738, 338, 12611, 839, 29889, 13, 29937, 7306, 338, 304, 1284, 3001, 8158, 363, 599, 6471, 29889, 13, 29937, 2318, 8158, 353, 29871, 29896, 718, 8158, 310, 6943, 2318, 29889, 13, 13, 13, 29937, 4331, 697, 29892, 3349, 599, 278, 1738, 29889, 515, 278, 4840, 29889, 13, 1753, 12611, 1451, 1503, 29898, 305, 1503, 1125, 13, 1678, 363, 413, 29892, 325, 297, 26985, 29898, 305, 1503, 1125, 13, 4706, 565, 325, 1275, 525, 2396, 13, 9651, 6773, 13, 4706, 565, 325, 1275, 525, 29991, 2396, 13, 9651, 22524, 29961, 29895, 29962, 353, 6629, 13, 9651, 22524, 29961, 29895, 29974, 29896, 29962, 353, 6629, 13, 1678, 736, 518, 29916, 363, 921, 297, 22524, 565, 921, 2804, 525, 2033, 13, 13, 13, 29937, 4331, 1023, 29892, 3349, 599, 278, 529, 22896, 29958, 29962, 29958, 515, 278, 4840, 29889, 13, 1753, 3349, 29954, 279, 17807, 29898, 305, 1503, 1125, 13, 1678, 534, 1161, 353, 7700, 13, 1678, 6206, 353, 29871, 29900, 13, 13, 1678, 363, 1373, 297, 22524, 29901, 13, 4706, 565, 451, 534, 1161, 322, 1373, 1275, 12801, 2396, 13, 9651, 534, 1161, 353, 5852, 13, 9651, 6206, 22361, 29871, 29896, 13, 4706, 565, 534, 1161, 322, 1373, 1275, 525, 29958, 2396, 13, 9651, 534, 1161, 353, 7700, 13, 4706, 565, 534, 1161, 29901, 13, 9651, 6206, 4619, 29871, 29896, 13, 1678, 736, 6206, 13, 13, 13, 1753, 2302, 24020, 29898, 305, 1503, 1125, 13, 1678, 6471, 353, 5159, 13, 1678, 10809, 353, 29871, 29900, 13, 1678, 363, 413, 29892, 325, 297, 26985, 29898, 305, 1503, 1125, 13, 4706, 565, 325, 1275, 22372, 2396, 13, 9651, 10809, 4619, 29871, 29896, 13, 4706, 565, 325, 1275, 525, 29913, 2396, 13, 9651, 6471, 29889, 4397, 29898, 19488, 29897, 13, 9651, 10809, 22361, 29871, 29896, 13, 13, 1678, 736, 2533, 29898, 13155, 29897, 13, 13, 29937, 13223, 6987, 363, 2302, 24020, 13, 698, 353, 426, 13, 1678, 525, 29874, 2396, 6702, 25299, 742, 29871, 29900, 511, 13, 1678, 525, 29890, 2396, 6702, 29966, 8172, 4890, 29958, 742, 29871, 29896, 29955, 511, 13, 1678, 525, 29883, 2396, 6702, 9314, 9314, 29958, 742, 29871, 29941, 511, 13, 1678, 525, 29881, 2396, 6702, 29966, 29912, 29991, 29958, 17428, 742, 29871, 29906, 511, 13, 1678, 525, 29872, 2396, 6702, 29966, 6824, 29958, 742, 29871, 29900, 511, 13, 1678, 525, 29888, 2396, 6702, 29966, 21004, 6778, 742, 29871, 29900, 511, 13, 1678, 525, 29887, 2396, 6702, 29966, 29912, 29877, 29908, 29875, 29991, 29874, 29892, 29966, 29912, 29875, 29966, 29874, 29958, 742, 29871, 29896, 29900, 511, 13, 29913, 13, 1454, 413, 29892, 325, 297, 260, 29873, 29889, 7076, 7295, 13, 1678, 22524, 353, 1051, 29898, 29894, 29961, 29900, 2314, 13, 1678, 22524, 353, 12611, 1451, 1503, 29898, 305, 1503, 29897, 13, 1678, 1121, 353, 3349, 29954, 279, 17807, 29898, 305, 1503, 29897, 13, 1678, 565, 1121, 2804, 325, 29961, 29896, 5387, 13, 4706, 1596, 703, 4519, 6227, 29901, 1881, 9162, 325, 29961, 29900, 1402, 29242, 3806, 9162, 325, 29961, 29896, 1402, 9162, 2355, 9162, 1121, 29892, 16345, 543, 1159, 13, 13, 29937, 450, 1881, 338, 451, 7120, 363, 9753, 537, 29892, 925, 10379, 29889, 13, 5461, 353, 10876, 29889, 4172, 262, 29889, 949, 9012, 580, 13, 361, 7431, 29898, 5461, 29897, 1275, 29871, 29900, 29901, 13, 1678, 1596, 703, 5461, 4567, 29991, 1159, 13, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 305, 1503, 353, 1051, 29898, 5461, 29961, 29900, 2314, 13, 305, 1503, 353, 12611, 1451, 1503, 29898, 305, 1503, 29897, 13, 2158, 29898, 5992, 29954, 279, 17807, 29898, 305, 1503, 876, 13, 2 ]
python/modules/mysql_server.py
91-jinrong/-91_monitor
1
7779
<filename>python/modules/mysql_server.py #!/bin/env python #-*-coding:utf-8-*- import os import sys import string import time import datetime import MySQLdb class MySQL: def __int__(self,host,port,user,passwd,dbname,timeout,charset): self.host = host self.port = port self.user = user self.passwd = <PASSWORD> self.dbname = test self.timeout = timeout self.charset = charset def db_connect(self): connect=MySQLdb.connect(host=self.host,user=self.user,passwd=<PASSWORD>,port=int(self.port),connect_timeout=int(self.timeout),charset=self.charset) return connect def execute(self,sql,param): conn=MySQLdb.connect(host=self.host,user=self.user,passwd=<PASSWORD>,port=int(self.port),connect_timeout=int(self.timeout),charset=self.charset) conn.select_db(self.dbname) cursor = conn.cursor() if param <> '': cursor.execute(sql,param) else: cursor.execute(sql) conn.commit() cursor.close() conn.close() def query(self,sql): conn=MySQLdb.connect(host=self.host,user=self.user,passwd=<PASSWORD>,port=int(self.port),connect_timeout=int(self.timeout),charset=self.charset) conn.select_db(self.dbname) cursor = conn.cursor() count=cursor.execute(sql) if count == 0 : result=0 else: result=cursor.fetchall() return result cursor.close() conn.close() def get_option(self,key): conn=MySQLdb.connect(host=self.host,user=self.user,passwd=<PASSWORD>,port=int(self.port),connect_timeout=int(self.timeout),charset=self.charset) conn.select_db(self.dbname) cursor = conn.cursor() sql="select value from options where name=+'"+key+"'" count=cursor.execute(sql) if count == 0 : result=0 else: result=cursor.fetchone() return result[0] cursor.close() conn.close()
[ 1, 529, 9507, 29958, 4691, 29914, 7576, 29914, 7938, 29918, 2974, 29889, 2272, 13, 29937, 14708, 2109, 29914, 6272, 3017, 13, 29937, 29899, 29930, 29899, 29883, 3689, 29901, 9420, 29899, 29947, 29899, 29930, 29899, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 1347, 13, 5215, 931, 13, 5215, 12865, 13, 5215, 9254, 2585, 13, 13, 1990, 9254, 29901, 13, 1678, 822, 4770, 524, 12035, 1311, 29892, 3069, 29892, 637, 29892, 1792, 29892, 3364, 9970, 29892, 2585, 978, 29892, 15619, 29892, 3090, 842, 1125, 13, 4706, 1583, 29889, 3069, 353, 3495, 13, 4706, 1583, 29889, 637, 353, 2011, 13, 4706, 1583, 29889, 1792, 353, 1404, 13, 4706, 1583, 29889, 3364, 9970, 353, 529, 25711, 17013, 29958, 13, 4706, 1583, 29889, 2585, 978, 353, 1243, 13, 4706, 1583, 29889, 15619, 353, 11815, 13, 4706, 1583, 29889, 3090, 842, 353, 17425, 13, 13, 1678, 822, 4833, 29918, 6915, 29898, 1311, 1125, 13, 4706, 4511, 29922, 3421, 4176, 2585, 29889, 6915, 29898, 3069, 29922, 1311, 29889, 3069, 29892, 1792, 29922, 1311, 29889, 1792, 29892, 3364, 9970, 29922, 29966, 25711, 17013, 10202, 637, 29922, 524, 29898, 1311, 29889, 637, 511, 6915, 29918, 15619, 29922, 524, 29898, 1311, 29889, 15619, 511, 3090, 842, 29922, 1311, 29889, 3090, 842, 29897, 13, 4706, 736, 4511, 13, 13, 13, 1678, 822, 6222, 29898, 1311, 29892, 2850, 29892, 3207, 1125, 13, 4706, 11009, 29922, 3421, 4176, 2585, 29889, 6915, 29898, 3069, 29922, 1311, 29889, 3069, 29892, 1792, 29922, 1311, 29889, 1792, 29892, 3364, 9970, 29922, 29966, 25711, 17013, 10202, 637, 29922, 524, 29898, 1311, 29889, 637, 511, 6915, 29918, 15619, 29922, 524, 29898, 1311, 29889, 15619, 511, 3090, 842, 29922, 1311, 29889, 3090, 842, 29897, 13, 4706, 11009, 29889, 2622, 29918, 2585, 29898, 1311, 29889, 2585, 978, 29897, 13, 4706, 10677, 353, 11009, 29889, 18127, 580, 13, 4706, 565, 1828, 15271, 525, 2396, 13, 9651, 10677, 29889, 7978, 29898, 2850, 29892, 3207, 29897, 13, 4706, 1683, 29901, 13, 9651, 10677, 29889, 7978, 29898, 2850, 29897, 13, 4706, 11009, 29889, 15060, 580, 13, 4706, 10677, 29889, 5358, 580, 13, 4706, 11009, 29889, 5358, 580, 13, 13, 1678, 822, 2346, 29898, 1311, 29892, 2850, 1125, 13, 4706, 11009, 29922, 3421, 4176, 2585, 29889, 6915, 29898, 3069, 29922, 1311, 29889, 3069, 29892, 1792, 29922, 1311, 29889, 1792, 29892, 3364, 9970, 29922, 29966, 25711, 17013, 10202, 637, 29922, 524, 29898, 1311, 29889, 637, 511, 6915, 29918, 15619, 29922, 524, 29898, 1311, 29889, 15619, 511, 3090, 842, 29922, 1311, 29889, 3090, 842, 29897, 13, 4706, 11009, 29889, 2622, 29918, 2585, 29898, 1311, 29889, 2585, 978, 29897, 13, 4706, 10677, 353, 11009, 29889, 18127, 580, 13, 4706, 2302, 29922, 18127, 29889, 7978, 29898, 2850, 29897, 13, 4706, 565, 2302, 1275, 29871, 29900, 584, 13, 9651, 1121, 29922, 29900, 13, 4706, 1683, 29901, 13, 9651, 1121, 29922, 18127, 29889, 9155, 497, 580, 13, 4706, 736, 1121, 13, 4706, 10677, 29889, 5358, 580, 13, 4706, 11009, 29889, 5358, 580, 13, 13, 1678, 822, 679, 29918, 3385, 29898, 1311, 29892, 1989, 1125, 13, 4706, 11009, 29922, 3421, 4176, 2585, 29889, 6915, 29898, 3069, 29922, 1311, 29889, 3069, 29892, 1792, 29922, 1311, 29889, 1792, 29892, 3364, 9970, 29922, 29966, 25711, 17013, 10202, 637, 29922, 524, 29898, 1311, 29889, 637, 511, 6915, 29918, 15619, 29922, 524, 29898, 1311, 29889, 15619, 511, 3090, 842, 29922, 1311, 29889, 3090, 842, 29897, 13, 4706, 11009, 29889, 2622, 29918, 2585, 29898, 1311, 29889, 2585, 978, 29897, 13, 4706, 10677, 353, 11009, 29889, 18127, 580, 13, 4706, 4576, 543, 2622, 995, 515, 3987, 988, 1024, 29922, 29974, 11838, 29974, 1989, 13578, 11838, 13, 4706, 2302, 29922, 18127, 29889, 7978, 29898, 2850, 29897, 13, 4706, 565, 2302, 1275, 29871, 29900, 584, 13, 9651, 1121, 29922, 29900, 13, 4706, 1683, 29901, 13, 9651, 1121, 29922, 18127, 29889, 9155, 650, 580, 13, 4706, 736, 1121, 29961, 29900, 29962, 13, 4706, 10677, 29889, 5358, 580, 13, 4706, 11009, 29889, 5358, 580, 29871, 13, 2 ]
hsi/log.py
morrocoy/hsi
1
197992
# -*- coding: utf-8 -*- """ An interface module for mcx (Monte Carlo eXtreme). Created on Tue Mar 16 21:43:18 2021 @author: kpapke """ import logging class LogManager(object): """ Class to manage multiple loggers from different modules """ def __init__(self): """ Constructor. """ self.level = logging.WARNING self.consoleHandler = logging.StreamHandler() self.consoleHandler.setLevel(self.level) self.formatter = logging.Formatter( "%(asctime)s %(filename)35s: %(lineno)-4d: %(funcName)20s(): " \ "%(levelname)-7s: %(message)s") self.consoleHandler.setFormatter(self.formatter) self.loggers = {} def getLogger(self, module_name): """ Return a logger for a module. """ log = logging.getLogger(module_name) log.setLevel(self.level) log.addHandler(self.consoleHandler) self.loggers[module_name] = log return log def setLevel(self, level): """ Set the log level for all loggers that have been created. """ self.level = level self.consoleHandler.setLevel(level) for log in self.loggers.values(): log.setLevel(level) logmanager = LogManager()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 530, 5067, 3883, 363, 286, 18904, 313, 7185, 371, 15021, 321, 29990, 2484, 1004, 467, 13, 13, 20399, 373, 323, 434, 1085, 29871, 29896, 29953, 29871, 29906, 29896, 29901, 29946, 29941, 29901, 29896, 29947, 29871, 29906, 29900, 29906, 29896, 13, 13, 29992, 8921, 29901, 413, 29886, 481, 446, 13, 15945, 29908, 13, 5215, 12183, 13, 13, 13, 1990, 4522, 3260, 29898, 3318, 1125, 13, 1678, 9995, 4134, 304, 10933, 2999, 1480, 5743, 515, 1422, 10585, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 9995, 1281, 18769, 29889, 9995, 13, 4706, 1583, 29889, 5563, 353, 12183, 29889, 29956, 25614, 13, 13, 4706, 1583, 29889, 11058, 4598, 353, 12183, 29889, 3835, 4598, 580, 13, 4706, 1583, 29889, 11058, 4598, 29889, 842, 10108, 29898, 1311, 29889, 5563, 29897, 13, 13, 4706, 1583, 29889, 689, 2620, 353, 12183, 29889, 18522, 29898, 13, 9651, 11860, 29898, 294, 312, 603, 29897, 29879, 1273, 29898, 9507, 29897, 29941, 29945, 29879, 29901, 1273, 29898, 1915, 8154, 6817, 29946, 29881, 29901, 1273, 29898, 9891, 1170, 29897, 29906, 29900, 29879, 7295, 376, 320, 13, 9651, 11860, 29898, 5563, 978, 6817, 29955, 29879, 29901, 1273, 29898, 4906, 29897, 29879, 1159, 13, 4706, 1583, 29889, 11058, 4598, 29889, 842, 18522, 29898, 1311, 29889, 689, 2620, 29897, 13, 13, 4706, 1583, 29889, 1188, 5743, 353, 6571, 13, 13, 1678, 822, 679, 16363, 29898, 1311, 29892, 3883, 29918, 978, 1125, 13, 4706, 9995, 7106, 263, 17927, 363, 263, 3883, 29889, 13, 4706, 9995, 13, 4706, 1480, 353, 12183, 29889, 657, 16363, 29898, 5453, 29918, 978, 29897, 13, 4706, 1480, 29889, 842, 10108, 29898, 1311, 29889, 5563, 29897, 13, 4706, 1480, 29889, 1202, 4598, 29898, 1311, 29889, 11058, 4598, 29897, 13, 4706, 1583, 29889, 1188, 5743, 29961, 5453, 29918, 978, 29962, 353, 1480, 13, 4706, 736, 1480, 13, 13, 1678, 822, 731, 10108, 29898, 1311, 29892, 3233, 1125, 13, 4706, 9995, 3789, 278, 1480, 3233, 363, 599, 1480, 5743, 393, 505, 1063, 2825, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 5563, 353, 3233, 13, 4706, 1583, 29889, 11058, 4598, 29889, 842, 10108, 29898, 5563, 29897, 13, 4706, 363, 1480, 297, 1583, 29889, 1188, 5743, 29889, 5975, 7295, 13, 9651, 1480, 29889, 842, 10108, 29898, 5563, 29897, 13, 13, 13, 1188, 12847, 353, 4522, 3260, 580, 13, 2 ]
tests/test_timeparser.py
vgoehler/python-i3-battery-block
0
2570
<gh_stars>0 from datetime import time import pytest from i3_battery_block_vgg.timeparser import __parse_time_manually from i3_battery_block_vgg.timeparser import parse_time @pytest.mark.parametrize( "time_input, expected", [ ("12:13", time(hour=12, minute=13)), ("12:13:14", time(hour=12, minute=13, second=14)), ('00:54:00', time(hour=0, minute=54, second=0)) ] ) def test_manually_time_parsing(time_input: str, expected: time): assert __parse_time_manually(time_input) == expected, "manual time parsing has gone wrong" @pytest.mark.parametrize( "time_input, expected", [ ("12:13", time(hour=12, minute=13)), ("12:13:14", time(hour=12, minute=13, second=14)), ('00:54:00', time(hour=0, minute=54, second=0)) ] ) def test_time_parsing(time_input: str, expected: time): assert parse_time(time_input) == expected, "time parsing has gone wrong"
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 12865, 1053, 931, 13, 13, 5215, 11451, 1688, 13, 13, 3166, 474, 29941, 29918, 29890, 2620, 29891, 29918, 1271, 29918, 29894, 1505, 29889, 2230, 16680, 1053, 4770, 5510, 29918, 2230, 29918, 1171, 1474, 13, 3166, 474, 29941, 29918, 29890, 2620, 29891, 29918, 1271, 29918, 29894, 1505, 29889, 2230, 16680, 1053, 6088, 29918, 2230, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 376, 2230, 29918, 2080, 29892, 3806, 613, 13, 1678, 518, 13, 4706, 4852, 29896, 29906, 29901, 29896, 29941, 613, 931, 29898, 18721, 29922, 29896, 29906, 29892, 11015, 29922, 29896, 29941, 8243, 13, 4706, 4852, 29896, 29906, 29901, 29896, 29941, 29901, 29896, 29946, 613, 931, 29898, 18721, 29922, 29896, 29906, 29892, 11015, 29922, 29896, 29941, 29892, 1473, 29922, 29896, 29946, 8243, 13, 4706, 6702, 29900, 29900, 29901, 29945, 29946, 29901, 29900, 29900, 742, 931, 29898, 18721, 29922, 29900, 29892, 11015, 29922, 29945, 29946, 29892, 1473, 29922, 29900, 876, 13, 1678, 4514, 13, 29897, 13, 1753, 1243, 29918, 1171, 1474, 29918, 2230, 29918, 862, 2976, 29898, 2230, 29918, 2080, 29901, 851, 29892, 3806, 29901, 931, 1125, 13, 1678, 4974, 4770, 5510, 29918, 2230, 29918, 1171, 1474, 29898, 2230, 29918, 2080, 29897, 1275, 3806, 29892, 376, 11288, 931, 13755, 756, 7695, 2743, 29908, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 376, 2230, 29918, 2080, 29892, 3806, 613, 13, 1678, 518, 13, 4706, 4852, 29896, 29906, 29901, 29896, 29941, 613, 931, 29898, 18721, 29922, 29896, 29906, 29892, 11015, 29922, 29896, 29941, 8243, 13, 4706, 4852, 29896, 29906, 29901, 29896, 29941, 29901, 29896, 29946, 613, 931, 29898, 18721, 29922, 29896, 29906, 29892, 11015, 29922, 29896, 29941, 29892, 1473, 29922, 29896, 29946, 8243, 13, 4706, 6702, 29900, 29900, 29901, 29945, 29946, 29901, 29900, 29900, 742, 931, 29898, 18721, 29922, 29900, 29892, 11015, 29922, 29945, 29946, 29892, 1473, 29922, 29900, 876, 13, 1678, 4514, 13, 29897, 13, 1753, 1243, 29918, 2230, 29918, 862, 2976, 29898, 2230, 29918, 2080, 29901, 851, 29892, 3806, 29901, 931, 1125, 13, 1678, 4974, 6088, 29918, 2230, 29898, 2230, 29918, 2080, 29897, 1275, 3806, 29892, 376, 2230, 13755, 756, 7695, 2743, 29908, 13, 2 ]
tests/test_code/py/chained/chained.py
FreddyZeng/code2flow
2,248
170675
class Chain(): def __init__(self, val): self.val = val def add(self, b): self.val += b return self def sub(self, b): self.val -= b return self def mul(self, b): self.val *= b return self print(Chain(5).add(5).sub(2).mul(10))
[ 1, 770, 678, 475, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 659, 1125, 13, 4706, 1583, 29889, 791, 353, 659, 13, 13, 1678, 822, 788, 29898, 1311, 29892, 289, 1125, 13, 4706, 1583, 29889, 791, 4619, 289, 13, 4706, 736, 1583, 13, 13, 1678, 822, 1014, 29898, 1311, 29892, 289, 1125, 13, 4706, 1583, 29889, 791, 22361, 289, 13, 4706, 736, 1583, 13, 13, 1678, 822, 15065, 29898, 1311, 29892, 289, 1125, 13, 4706, 1583, 29889, 791, 334, 29922, 289, 13, 4706, 736, 1583, 13, 13, 13, 2158, 29898, 14688, 29898, 29945, 467, 1202, 29898, 29945, 467, 1491, 29898, 29906, 467, 16109, 29898, 29896, 29900, 876, 13, 2 ]
server/website/context.py
eIGato/mahjong-portal
10
76184
<reponame>eIGato/mahjong-portal from django.conf import settings from django.utils import timezone from django.utils.translation import get_language def context(request): language = get_language() return { "GOOGLE_VERIFICATION_CODE": settings.GOOGLE_VERIFICATION_CODE, "YANDEX_VERIFICATION_CODE": settings.YANDEX_VERIFICATION_CODE, "SCHEME": settings.SCHEME, "SHORT_DATE_FORMAT": language == "ru" and "d.m.Y" or "Y-m-d", "CURRENT_YEAR": timezone.now().year, }
[ 1, 529, 276, 1112, 420, 29958, 29872, 6259, 1219, 29914, 655, 29882, 29926, 549, 29899, 25089, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 13239, 1053, 29431, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 679, 29918, 11675, 13, 13, 13, 1753, 3030, 29898, 3827, 1125, 13, 1678, 4086, 353, 679, 29918, 11675, 580, 13, 13, 1678, 736, 426, 13, 4706, 376, 17080, 29949, 29954, 1307, 29918, 5348, 6545, 28541, 29918, 16524, 1115, 6055, 29889, 17080, 29949, 29954, 1307, 29918, 5348, 6545, 28541, 29918, 16524, 29892, 13, 4706, 376, 29979, 2190, 19577, 29918, 5348, 6545, 28541, 29918, 16524, 1115, 6055, 29889, 29979, 2190, 19577, 29918, 5348, 6545, 28541, 29918, 16524, 29892, 13, 4706, 376, 29903, 3210, 29923, 2303, 1115, 6055, 29889, 29903, 3210, 29923, 2303, 29892, 13, 4706, 376, 7068, 8476, 29918, 6248, 29918, 19094, 1299, 1115, 4086, 1275, 376, 582, 29908, 322, 376, 29881, 29889, 29885, 29889, 29979, 29908, 470, 376, 29979, 29899, 29885, 29899, 29881, 613, 13, 4706, 376, 22484, 29450, 29918, 29979, 26441, 1115, 29431, 29889, 3707, 2141, 6360, 29892, 13, 1678, 500, 13, 2 ]
src/pywink/test/devices/sensor_test.py
vickyg3/python-wink
0
77072
<gh_stars>0 import json import os import unittest from unittest.mock import MagicMock from pywink.api import get_devices_from_response_dict from pywink.devices import types as device_types from pywink.devices.piggy_bank import WinkPorkfolioBalanceSensor from pywink.devices.smoke_detector import WinkSmokeDetector, WinkCoDetector, WinkSmokeSeverity, WinkCoSeverity class SensorTests(unittest.TestCase): def setUp(self): super(SensorTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_capability_should_not_be_none(self): devices = get_devices_from_response_dict(self.response_dict, device_types.SENSOR_POD) for device in devices: self.assertIsNotNone(device.capability()) def test_tamper_detected_should_be_false(self): devices = get_devices_from_response_dict(self.response_dict, device_types.SENSOR_POD) for device in devices: self.assertFalse(device.tamper_detected()) def test_unit_is_valid(self): devices = get_devices_from_response_dict(self.response_dict, device_types.SENSOR_POD) for device in devices: if device.unit_type() == "boolean": self.assertIsNone(device.unit()) else: self.assertIsNotNone(device.unit()) class EggtrayTests(unittest.TestCase): def setUp(self): super(EggtrayTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_state_should_be_2(self): devices = get_devices_from_response_dict(self.response_dict, device_types.EGGTRAY) for device in devices: self.assertEqual(device.state(), 2) def test_capability_is_none(self): devices = get_devices_from_response_dict(self.response_dict, device_types.EGGTRAY) for device in devices: self.assertEqual(device.capability(), None) def test_unit_is_eggs(self): devices = get_devices_from_response_dict(self.response_dict, device_types.EGGTRAY) for device in devices: self.assertEqual(device.unit(), "eggs") class KeyTests(unittest.TestCase): def setUp(self): super(KeyTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_state_should_be_false(self): devices = get_devices_from_response_dict(self.response_dict, device_types.KEY) self.assertEqual(len(devices), 1) for device in devices: self.assertFalse(device.state()) def test_parent_id_should_not_be_none(self): devices = get_devices_from_response_dict(self.response_dict, device_types.KEY) for device in devices: self.assertIsNotNone(device.parent_id()) def test_availble_is_true(self): devices = get_devices_from_response_dict(self.response_dict, device_types.KEY) for device in devices: self.assertTrue(device.available()) def test_capability_is_activity_detected(self): devices = get_devices_from_response_dict(self.response_dict, device_types.KEY) for device in devices: self.assertEqual(device.capability(), "activity_detected") def test_unit_is_none(self): devices = get_devices_from_response_dict(self.response_dict, device_types.KEY) for device in devices: self.assertIsNone(device.unit()) class PorkfolioTests(unittest.TestCase): def setUp(self): super(PorkfolioTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_unit_is_usd(self): devices = get_devices_from_response_dict(self.response_dict, device_types.PIGGY_BANK) self.assertEqual(len(devices), 2) for device in devices: if isinstance(device, WinkPorkfolioBalanceSensor): self.assertEqual(device.unit(), "USD") def test_capability_is_balance(self): devices = get_devices_from_response_dict(self.response_dict, device_types.PIGGY_BANK) for device in devices: if isinstance(device, WinkPorkfolioBalanceSensor): self.assertEqual(device.capability(), "balance") def test_state_is_180(self): devices = get_devices_from_response_dict(self.response_dict, device_types.PIGGY_BANK) for device in devices: if isinstance(device, WinkPorkfolioBalanceSensor): self.assertEqual(device.state(), 180) def test_available_is_true(self): devices = get_devices_from_response_dict(self.response_dict, device_types.PIGGY_BANK) for device in devices: if isinstance(device, WinkPorkfolioBalanceSensor): self.assertTrue(device.available()) class GangTests(unittest.TestCase): def setUp(self): super(GangTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_unit_is_none(self): devices = get_devices_from_response_dict(self.response_dict, device_types.GANG) for device in devices: self.assertIsNone(device.unit()) class SmokeDetectorTests(unittest.TestCase): def setUp(self): super(SmokeDetectorTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_test_activated_is_false(self): devices = get_devices_from_response_dict(self.response_dict, device_types.SMOKE_DETECTOR) for device in devices: self.assertFalse(device.test_activated()) def test_unit_is_none(self): devices = get_devices_from_response_dict(self.response_dict, device_types.SMOKE_DETECTOR) for device in devices: if isinstance(device, WinkSmokeDetector): self.assertIsNone(device.unit()) self.assertEqual(device.unit_type(), "boolean") if isinstance(device, WinkCoDetector): self.assertIsNone(device.unit()) self.assertEqual(device.unit_type(), "boolean") if isinstance(device, WinkSmokeSeverity): self.assertIsNone(device.unit()) self.assertIsNone(device.unit_type()) if isinstance(device, WinkCoSeverity): self.assertIsNone(device.unit()) self.assertIsNone(device.unit_type()) class RemoteTests(unittest.TestCase): def setUp(self): super(RemoteTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_buttons_press_is_false(self): devices = get_devices_from_response_dict(self.response_dict, device_types.REMOTE) remote = devices[0] self.assertFalse(remote.button_on_pressed()) self.assertFalse(remote.button_off_pressed()) self.assertFalse(remote.button_up_pressed()) self.assertFalse(remote.button_down_pressed()) def test_unit_and_capability(self): devices = get_devices_from_response_dict(self.response_dict, device_types.REMOTE) remote = devices[0] self.assertIsNone(remote.unit()) self.assertEqual(remote.capability(), "opened") class PropaneTankTests(unittest.TestCase): def setUp(self): super(PropaneTankTests, self).setUp() self.api_interface = MagicMock() all_devices = os.listdir('{}/api_responses/'.format(os.path.dirname(__file__))) self.response_dict = {} device_list = [] for json_file in all_devices: if os.path.isfile('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)): _json_file = open('{}/api_responses/{}'.format(os.path.dirname(__file__), json_file)) device_list.append(json.load(_json_file)) _json_file.close() self.response_dict["data"] = device_list def test_unit_and_capability(self): devices = get_devices_from_response_dict(self.response_dict, device_types.PROPANE_TANK) tank = devices[0] self.assertIsNone(tank.unit()) self.assertIsNone(tank.capability())
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 4390, 13, 5215, 2897, 13, 5215, 443, 27958, 13, 13, 3166, 443, 27958, 29889, 17640, 1053, 26494, 18680, 13, 13, 3166, 282, 5693, 682, 29889, 2754, 1053, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 13, 3166, 282, 5693, 682, 29889, 3359, 1575, 1053, 4072, 408, 4742, 29918, 8768, 13, 3166, 282, 5693, 682, 29889, 3359, 1575, 29889, 29886, 335, 1927, 29918, 9157, 1053, 399, 682, 29925, 548, 25648, 22031, 749, 29903, 6073, 13, 3166, 282, 5693, 682, 29889, 3359, 1575, 29889, 3844, 6946, 29918, 4801, 3019, 1053, 399, 682, 29903, 4346, 446, 6362, 3019, 29892, 399, 682, 7967, 6362, 3019, 29892, 399, 682, 29903, 4346, 446, 29903, 1310, 537, 29892, 399, 682, 7967, 29903, 1310, 537, 13, 13, 13, 1990, 317, 6073, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29903, 6073, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 5030, 3097, 29918, 9344, 29918, 1333, 29918, 915, 29918, 9290, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 29903, 1430, 29903, 1955, 29918, 13152, 29928, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 10141, 29889, 5030, 3097, 3101, 13, 13, 1678, 822, 1243, 29918, 29873, 314, 546, 29918, 4801, 26458, 29918, 9344, 29918, 915, 29918, 4541, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 29903, 1430, 29903, 1955, 29918, 13152, 29928, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 8824, 29898, 10141, 29889, 29873, 314, 546, 29918, 4801, 26458, 3101, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 275, 29918, 3084, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 29903, 1430, 29903, 1955, 29918, 13152, 29928, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 565, 4742, 29889, 5441, 29918, 1853, 580, 1275, 376, 20054, 1115, 13, 18884, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 3101, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 10141, 29889, 5441, 3101, 13, 13, 13, 1990, 382, 1505, 29873, 764, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29923, 1505, 29873, 764, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 3859, 29918, 9344, 29918, 915, 29918, 29906, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 11787, 23799, 22800, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 3859, 3285, 29871, 29906, 29897, 13, 13, 1678, 822, 1243, 29918, 5030, 3097, 29918, 275, 29918, 9290, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 11787, 23799, 22800, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 5030, 3097, 3285, 6213, 29897, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 275, 29918, 387, 3174, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 11787, 23799, 22800, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 5441, 3285, 376, 387, 3174, 1159, 13, 13, 13, 1990, 7670, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 2558, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 3859, 29918, 9344, 29918, 915, 29918, 4541, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 10818, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 3359, 1575, 511, 29871, 29896, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 8824, 29898, 10141, 29889, 3859, 3101, 13, 13, 1678, 822, 1243, 29918, 3560, 29918, 333, 29918, 9344, 29918, 1333, 29918, 915, 29918, 9290, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 10818, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 10141, 29889, 3560, 29918, 333, 3101, 13, 13, 1678, 822, 1243, 29918, 485, 737, 569, 29918, 275, 29918, 3009, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 10818, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 5574, 29898, 10141, 29889, 16515, 3101, 13, 13, 1678, 822, 1243, 29918, 5030, 3097, 29918, 275, 29918, 10072, 29918, 4801, 26458, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 10818, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 5030, 3097, 3285, 376, 10072, 29918, 4801, 26458, 1159, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 275, 29918, 9290, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 10818, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 3101, 13, 13, 13, 1990, 349, 548, 25648, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29925, 548, 25648, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 275, 29918, 375, 29881, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 2227, 26788, 29979, 29918, 29933, 2190, 29968, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 3359, 1575, 511, 29871, 29906, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 29925, 548, 25648, 22031, 749, 29903, 6073, 1125, 13, 18884, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 5441, 3285, 376, 3308, 29928, 1159, 13, 13, 1678, 822, 1243, 29918, 5030, 3097, 29918, 275, 29918, 5521, 749, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 2227, 26788, 29979, 29918, 29933, 2190, 29968, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 29925, 548, 25648, 22031, 749, 29903, 6073, 1125, 13, 18884, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 5030, 3097, 3285, 376, 5521, 749, 1159, 13, 13, 1678, 822, 1243, 29918, 3859, 29918, 275, 29918, 29896, 29947, 29900, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 2227, 26788, 29979, 29918, 29933, 2190, 29968, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 29925, 548, 25648, 22031, 749, 29903, 6073, 1125, 13, 18884, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 3859, 3285, 29871, 29896, 29947, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 16515, 29918, 275, 29918, 3009, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 2227, 26788, 29979, 29918, 29933, 2190, 29968, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 29925, 548, 25648, 22031, 749, 29903, 6073, 1125, 13, 18884, 1583, 29889, 9294, 5574, 29898, 10141, 29889, 16515, 3101, 13, 13, 13, 1990, 26531, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29954, 574, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 275, 29918, 9290, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 29954, 19453, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 3101, 13, 13, 13, 1990, 4116, 6946, 6362, 3019, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29903, 4346, 446, 6362, 3019, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 1688, 29918, 11236, 630, 29918, 275, 29918, 4541, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 29903, 6720, 6059, 29918, 2287, 4330, 1783, 1955, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 1583, 29889, 9294, 8824, 29898, 10141, 29889, 1688, 29918, 11236, 630, 3101, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 275, 29918, 9290, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 29903, 6720, 6059, 29918, 2287, 4330, 1783, 1955, 29897, 13, 4706, 363, 4742, 297, 9224, 29901, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 29903, 4346, 446, 6362, 3019, 1125, 13, 18884, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 3101, 13, 18884, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 5441, 29918, 1853, 3285, 376, 20054, 1159, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 7967, 6362, 3019, 1125, 13, 18884, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 3101, 13, 18884, 1583, 29889, 9294, 9843, 29898, 10141, 29889, 5441, 29918, 1853, 3285, 376, 20054, 1159, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 29903, 4346, 446, 29903, 1310, 537, 1125, 13, 18884, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 3101, 13, 18884, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 29918, 1853, 3101, 13, 9651, 565, 338, 8758, 29898, 10141, 29892, 399, 682, 7967, 29903, 1310, 537, 1125, 13, 18884, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 3101, 13, 18884, 1583, 29889, 9294, 3624, 8516, 29898, 10141, 29889, 5441, 29918, 1853, 3101, 13, 13, 13, 1990, 5240, 866, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 20224, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 4187, 7453, 29918, 2139, 29918, 275, 29918, 4541, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 1525, 29924, 2891, 29923, 29897, 13, 4706, 7592, 353, 9224, 29961, 29900, 29962, 13, 4706, 1583, 29889, 9294, 8824, 29898, 16674, 29889, 3092, 29918, 265, 29918, 13120, 3101, 13, 4706, 1583, 29889, 9294, 8824, 29898, 16674, 29889, 3092, 29918, 2696, 29918, 13120, 3101, 13, 4706, 1583, 29889, 9294, 8824, 29898, 16674, 29889, 3092, 29918, 786, 29918, 13120, 3101, 13, 4706, 1583, 29889, 9294, 8824, 29898, 16674, 29889, 3092, 29918, 3204, 29918, 13120, 3101, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 392, 29918, 5030, 3097, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 1525, 29924, 2891, 29923, 29897, 13, 4706, 7592, 353, 9224, 29961, 29900, 29962, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 16674, 29889, 5441, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 16674, 29889, 5030, 3097, 3285, 376, 3150, 287, 1159, 13, 13, 13, 1990, 18264, 1662, 29911, 804, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 20420, 1662, 29911, 804, 24376, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 1583, 29889, 2754, 29918, 13248, 353, 26494, 18680, 580, 13, 4706, 599, 29918, 3359, 1575, 353, 2897, 29889, 1761, 3972, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 4961, 13, 4706, 1583, 29889, 5327, 29918, 8977, 353, 6571, 13, 4706, 4742, 29918, 1761, 353, 5159, 13, 4706, 363, 4390, 29918, 1445, 297, 599, 29918, 3359, 1575, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 22164, 13, 18884, 903, 3126, 29918, 1445, 353, 1722, 877, 29912, 6822, 2754, 29918, 26679, 267, 29914, 8875, 4286, 4830, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 4390, 29918, 1445, 876, 13, 18884, 4742, 29918, 1761, 29889, 4397, 29898, 3126, 29889, 1359, 7373, 3126, 29918, 1445, 876, 13, 18884, 903, 3126, 29918, 1445, 29889, 5358, 580, 13, 4706, 1583, 29889, 5327, 29918, 8977, 3366, 1272, 3108, 353, 4742, 29918, 1761, 13, 13, 1678, 822, 1243, 29918, 5441, 29918, 392, 29918, 5030, 3097, 29898, 1311, 1125, 13, 4706, 9224, 353, 679, 29918, 3359, 1575, 29918, 3166, 29918, 5327, 29918, 8977, 29898, 1311, 29889, 5327, 29918, 8977, 29892, 4742, 29918, 8768, 29889, 8618, 29925, 2190, 29923, 29918, 29911, 2190, 29968, 29897, 13, 4706, 23735, 353, 9224, 29961, 29900, 29962, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 29873, 804, 29889, 5441, 3101, 13, 4706, 1583, 29889, 9294, 3624, 8516, 29898, 29873, 804, 29889, 5030, 3097, 3101, 13, 2 ]
PreliminaryAnalysis/Interarrival Times/daily_rate_changes.py
alfredholmes/cryptocurrency_data_analysis
0
62255
<reponame>alfredholmes/cryptocurrency_data_analysis import classification import numpy as np import matplotlib.pyplot as plt from scipy.stats import expon, norm def main(): transactions = classification.load_transactions() orders = classification.classify_trades(transactions) interarrivals = classification.calculate_interarrival_times(orders) arrivals = np.cumsum(interarrivals) time_step = 10 * 60 * 1000 #calculating hourly rates bins = [] bin = [] time = 0 print('Processing...') for i, t in enumerate(arrivals): if t > time + time_step: jump = int(np.floor((t - time) / time_step)) time += jump * time_step bins.extend([bin + [] * (jump - 1)]) bin = [] bin.append(orders[i]) times = [] rates = [] for bin in bins: if len(bin) != 0: times.append(bin[0].start_time) ia = classification.calculate_interarrival_times(bin) loc, scale = expon.fit([i for i in ia if i > 1000]) rates.append(scale) rate_returns = [rates[i + 1] / rates[i] for i in range(len(rates) - 1)] hours = [[] for i in range(24 * 6)] for i, r in enumerate(1 / np.array(rates)): hours[i % 24 * 6].append(r) plt.plot([i for i in range(24 * 6)], [np.mean(hour) for hour in hours]) plt.show() if __name__ == '__main__': main()
[ 1, 529, 276, 1112, 420, 29958, 3131, 1127, 5391, 4467, 29914, 29883, 4641, 542, 10880, 29918, 1272, 29918, 15916, 13, 5215, 12965, 13, 13, 5215, 12655, 408, 7442, 13, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 4560, 2272, 29889, 16202, 1053, 18709, 29892, 6056, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 22160, 353, 12965, 29889, 1359, 29918, 3286, 7387, 580, 13, 1678, 11299, 353, 12965, 29889, 1990, 1598, 29918, 509, 3076, 29898, 3286, 7387, 29897, 13, 1678, 1006, 279, 15081, 29879, 353, 12965, 29889, 15807, 403, 29918, 1639, 279, 15081, 29918, 3706, 29898, 20488, 29897, 13, 13, 1678, 18517, 29879, 353, 7442, 29889, 29883, 398, 2083, 29898, 1639, 279, 15081, 29879, 29897, 13, 13, 1678, 931, 29918, 10568, 353, 29871, 29896, 29900, 334, 29871, 29953, 29900, 334, 29871, 29896, 29900, 29900, 29900, 396, 15807, 1218, 7234, 368, 19257, 13, 13, 1678, 289, 1144, 353, 5159, 13, 1678, 9016, 353, 5159, 13, 13, 1678, 931, 353, 29871, 29900, 13, 13, 1678, 1596, 877, 7032, 292, 856, 1495, 13, 13, 1678, 363, 474, 29892, 260, 297, 26985, 29898, 279, 15081, 29879, 1125, 13, 268, 12, 361, 260, 1405, 931, 718, 931, 29918, 10568, 29901, 13, 268, 12, 12, 29926, 3427, 353, 938, 29898, 9302, 29889, 14939, 3552, 29873, 448, 931, 29897, 847, 931, 29918, 10568, 876, 13, 268, 12, 12, 2230, 4619, 12500, 334, 931, 29918, 10568, 13, 13, 268, 12, 12, 29890, 1144, 29889, 21843, 4197, 2109, 718, 5159, 334, 313, 29926, 3427, 448, 29871, 29896, 29897, 2314, 13, 268, 12, 12, 2109, 353, 5159, 13, 268, 12, 2109, 29889, 4397, 29898, 20488, 29961, 29875, 2314, 13, 13, 13, 13, 1678, 3064, 353, 5159, 13, 1678, 19257, 353, 5159, 13, 1678, 363, 9016, 297, 289, 1144, 29901, 13, 4706, 565, 7431, 29898, 2109, 29897, 2804, 29871, 29900, 29901, 13, 9651, 3064, 29889, 4397, 29898, 2109, 29961, 29900, 1822, 2962, 29918, 2230, 29897, 13, 632, 423, 353, 12965, 29889, 15807, 403, 29918, 1639, 279, 15081, 29918, 3706, 29898, 2109, 29897, 13, 9651, 1180, 29892, 6287, 353, 18709, 29889, 9202, 4197, 29875, 363, 474, 297, 29871, 423, 565, 474, 1405, 29871, 29896, 29900, 29900, 29900, 2314, 13, 9651, 19257, 29889, 4397, 29898, 7052, 29897, 13, 13, 1678, 6554, 29918, 18280, 353, 518, 29878, 1078, 29961, 29875, 718, 29871, 29896, 29962, 847, 19257, 29961, 29875, 29962, 363, 474, 297, 3464, 29898, 2435, 29898, 29878, 1078, 29897, 448, 29871, 29896, 4638, 13, 13, 1678, 6199, 353, 518, 2636, 363, 474, 297, 3464, 29898, 29906, 29946, 334, 29871, 29953, 4638, 13, 13, 1678, 363, 474, 29892, 364, 297, 26985, 29898, 29896, 847, 7442, 29889, 2378, 29898, 29878, 1078, 22164, 13, 4706, 6199, 29961, 29875, 1273, 29871, 29906, 29946, 334, 29871, 29953, 1822, 4397, 29898, 29878, 29897, 13, 13, 1678, 14770, 29889, 5317, 4197, 29875, 363, 474, 297, 3464, 29898, 29906, 29946, 334, 29871, 29953, 29897, 1402, 518, 9302, 29889, 12676, 29898, 18721, 29897, 363, 7234, 297, 6199, 2314, 13, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
wearebeautiful/bin/make_bundle.py
MarcTschudin/wearebeautiful.info
0
47422
#!/usr/bin/env python import sys sys.path.append("..") import json import click import datetime import os import shutil from zipfile import ZipFile from tempfile import mkdtemp from scale_mesh import scale_mesh from wearebeautiful.bundles import validate_manifest, MAX_SCREENSHOT_SIZE from wearebeautiful import model_params as param @click.command() @click.option('--invert/--no-invert', default=False, help='Flip the normals on the STL file') @click.argument('lresolution', type=float) @click.argument('mresolution', type=float) def main(invert, lresolution, mresolution): manifest = os.path.join("/src", param.MANIFEST_FILE) surface = os.path.join("/src", param.SURFACE_FILE) solid = os.path.join("/src", param.PRINT_FILE) screenshot = os.path.join("/src", param.SCREENSHOT_FILE) try: with open(os.path.join("/src", manifest), "rb") as m: j = m.read() jmanifest = json.loads(j) except json.decoder.JSONDecodeError as err: print("Cannot parse manifest file. ", err) print("This was the content that was read:") print("%s\n" % j) sys.exit(-1) except IOError as err: print("Cannot read manifest file. IO error.", err) sys.exit(-1) err = validate_manifest(jmanifest) if err: print(err) sys.exit(-1) id = jmanifest['id'] screenshot_size = os.path.getsize(screenshot) if screenshot_size > MAX_SCREENSHOT_SIZE: print("Maximum screenshot size is %d kbytes." % (MAX_SCREENSHOT_SIZE / 1024)) sys.exit(-1) tmp_dir = mkdtemp() low_res = os.path.join(tmp_dir, "surface-low.stl") medium_res = os.path.join(tmp_dir, "surface-medium.stl") if not os.path.exists(solid): print("Cannot find solid.stl"); sys.exit(-1) if not os.path.exists(surface): print("Cannot find surface.stl"); sys.exit(-1) try: print("invert mesh", invert) scale_mesh(invert, lresolution, surface, low_res) scale_mesh(invert, mresolution, surface, medium_res) except IOError as err: print("Cannot down-scale mesh files. Error: ", err) sys.exit(-1) try: shutil.copy(solid, tmp_dir) shutil.copy(surface, tmp_dir) shutil.copy(screenshot, tmp_dir) except IOError as err: print("Cannot copy files. Error: ", err) sys.exit(-1) dest = os.path.join("/dest", "%s-%s-%s-bundle.zip" % (id, jmanifest['bodypart'], jmanifest['pose'])) with ZipFile(dest, 'w') as zip: zip.write(manifest, arcname="manifest.json") zip.write(low_res, arcname="surface-low.stl") zip.write(medium_res, arcname="surface-medium.stl") zip.write(solid, arcname="solid.stl") zip.write(surface, arcname="surface-orig.stl") zip.write(screenshot, arcname="screenshot.jpg") shutil.rmtree(tmp_dir) if __name__ == "__main__": main(); sys.exit(-1)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 4397, 703, 636, 1159, 13, 13, 5215, 4390, 13, 5215, 2828, 13, 5215, 12865, 13, 5215, 2897, 13, 5215, 528, 4422, 13, 3166, 14319, 1445, 1053, 796, 666, 2283, 13, 3166, 5694, 1445, 1053, 14690, 29881, 7382, 13, 3166, 6287, 29918, 4467, 29882, 1053, 6287, 29918, 4467, 29882, 13, 3166, 591, 598, 915, 1300, 6845, 29889, 16293, 793, 1053, 12725, 29918, 29135, 29892, 18134, 29918, 7187, 1525, 1430, 7068, 2891, 29918, 14226, 13, 3166, 591, 598, 915, 1300, 6845, 1053, 1904, 29918, 7529, 408, 1828, 13, 13, 29992, 3808, 29889, 6519, 580, 13, 29992, 3808, 29889, 3385, 877, 489, 262, 1765, 29914, 489, 1217, 29899, 262, 1765, 742, 2322, 29922, 8824, 29892, 1371, 2433, 29943, 3466, 278, 6056, 1338, 373, 278, 6850, 29931, 934, 1495, 13, 29992, 3808, 29889, 23516, 877, 29880, 9778, 918, 742, 1134, 29922, 7411, 29897, 13, 29992, 3808, 29889, 23516, 877, 29885, 9778, 918, 742, 1134, 29922, 7411, 29897, 13, 1753, 1667, 29898, 262, 1765, 29892, 301, 9778, 918, 29892, 286, 9778, 918, 1125, 13, 13, 1678, 10419, 353, 2897, 29889, 2084, 29889, 7122, 11974, 4351, 613, 1828, 29889, 27616, 6545, 29923, 1254, 29918, 7724, 29897, 13, 1678, 7101, 353, 2897, 29889, 2084, 29889, 7122, 11974, 4351, 613, 1828, 29889, 29903, 4574, 29943, 11538, 29918, 7724, 29897, 13, 1678, 7773, 353, 2897, 29889, 2084, 29889, 7122, 11974, 4351, 613, 1828, 29889, 10593, 10192, 29918, 7724, 29897, 13, 1678, 17286, 353, 2897, 29889, 2084, 29889, 7122, 11974, 4351, 613, 1828, 29889, 7187, 1525, 1430, 7068, 2891, 29918, 7724, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 11974, 4351, 613, 10419, 511, 376, 6050, 1159, 408, 286, 29901, 13, 9651, 432, 353, 286, 29889, 949, 580, 13, 9651, 432, 29135, 353, 4390, 29889, 18132, 29898, 29926, 29897, 13, 1678, 5174, 4390, 29889, 7099, 6119, 29889, 7249, 2772, 401, 2392, 408, 4589, 29901, 13, 4706, 1596, 703, 29089, 6088, 10419, 934, 29889, 9162, 4589, 29897, 13, 4706, 1596, 703, 4013, 471, 278, 2793, 393, 471, 1303, 29901, 1159, 13, 4706, 1596, 11702, 29879, 29905, 29876, 29908, 1273, 432, 29897, 29871, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 1678, 5174, 10663, 2392, 408, 4589, 29901, 13, 4706, 1596, 703, 29089, 1303, 10419, 934, 29889, 10663, 1059, 19602, 4589, 29897, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 4589, 353, 12725, 29918, 29135, 29898, 29926, 29135, 29897, 13, 1678, 565, 4589, 29901, 13, 4706, 1596, 29898, 3127, 29897, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 1178, 353, 432, 29135, 1839, 333, 2033, 13, 13, 1678, 17286, 29918, 2311, 353, 2897, 29889, 2084, 29889, 657, 2311, 29898, 29879, 24546, 8711, 29897, 13, 1678, 565, 17286, 29918, 2311, 1405, 18134, 29918, 7187, 1525, 1430, 7068, 2891, 29918, 14226, 29901, 13, 4706, 1596, 703, 7976, 12539, 17286, 2159, 338, 1273, 29881, 413, 13193, 1213, 1273, 313, 12648, 29918, 7187, 1525, 1430, 7068, 2891, 29918, 14226, 847, 29871, 29896, 29900, 29906, 29946, 876, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 13128, 29918, 3972, 353, 14690, 29881, 7382, 580, 13, 1678, 4482, 29918, 690, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7050, 29918, 3972, 29892, 376, 7610, 2161, 29899, 677, 29889, 303, 29880, 1159, 13, 1678, 18350, 29918, 690, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7050, 29918, 3972, 29892, 376, 7610, 2161, 29899, 27891, 29889, 303, 29880, 1159, 13, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 2929, 333, 1125, 13, 4706, 1596, 703, 29089, 1284, 7773, 29889, 303, 29880, 1496, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 7610, 2161, 1125, 13, 4706, 1596, 703, 29089, 1284, 7101, 29889, 303, 29880, 1496, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 1596, 703, 262, 1765, 27716, 613, 21292, 29897, 13, 4706, 6287, 29918, 4467, 29882, 29898, 262, 1765, 29892, 301, 9778, 918, 29892, 7101, 29892, 4482, 29918, 690, 29897, 13, 4706, 6287, 29918, 4467, 29882, 29898, 262, 1765, 29892, 286, 9778, 918, 29892, 7101, 29892, 18350, 29918, 690, 29897, 13, 1678, 5174, 10663, 2392, 408, 4589, 29901, 13, 4706, 1596, 703, 29089, 1623, 29899, 7052, 27716, 2066, 29889, 4829, 29901, 9162, 4589, 29897, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 528, 4422, 29889, 8552, 29898, 2929, 333, 29892, 13128, 29918, 3972, 29897, 13, 4706, 528, 4422, 29889, 8552, 29898, 7610, 2161, 29892, 13128, 29918, 3972, 29897, 13, 4706, 528, 4422, 29889, 8552, 29898, 29879, 24546, 8711, 29892, 13128, 29918, 3972, 29897, 13, 1678, 5174, 10663, 2392, 408, 4589, 29901, 13, 4706, 1596, 703, 29089, 3509, 2066, 29889, 4829, 29901, 9162, 4589, 29897, 13, 4706, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 2731, 353, 2897, 29889, 2084, 29889, 7122, 11974, 7854, 613, 11860, 29879, 19222, 29879, 19222, 29879, 29899, 16718, 29889, 7554, 29908, 1273, 313, 333, 29892, 432, 29135, 1839, 29890, 397, 1478, 442, 7464, 432, 29135, 1839, 4220, 25901, 13, 1678, 411, 796, 666, 2283, 29898, 7854, 29892, 525, 29893, 1495, 408, 14319, 29901, 13, 4706, 14319, 29889, 3539, 29898, 29135, 29892, 15232, 978, 543, 29135, 29889, 3126, 1159, 13, 4706, 14319, 29889, 3539, 29898, 677, 29918, 690, 29892, 15232, 978, 543, 7610, 2161, 29899, 677, 29889, 303, 29880, 1159, 13, 4706, 14319, 29889, 3539, 29898, 27891, 29918, 690, 29892, 15232, 978, 543, 7610, 2161, 29899, 27891, 29889, 303, 29880, 1159, 13, 4706, 14319, 29889, 3539, 29898, 2929, 333, 29892, 15232, 978, 543, 2929, 333, 29889, 303, 29880, 1159, 13, 4706, 14319, 29889, 3539, 29898, 7610, 2161, 29892, 15232, 978, 543, 7610, 2161, 29899, 12683, 29889, 303, 29880, 1159, 13, 4706, 14319, 29889, 3539, 29898, 29879, 24546, 8711, 29892, 15232, 978, 543, 29879, 24546, 8711, 29889, 6173, 1159, 13, 13, 1678, 528, 4422, 29889, 1758, 8336, 29898, 7050, 29918, 3972, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 890, 13, 1678, 10876, 29889, 13322, 6278, 29896, 29897, 13, 2 ]
easyAI/games/Reversi.py
obravocedillo/easyAI
0
172951
""" The game of Reversi. Warning: this game is not coded in an optimal way, the AI will be slow. """ import numpy as np from easyAI import TwoPlayersGame to_string = lambda a : "ABCDEFGH"[a[0]] + str(a[1]+1) to_array = lambda s : np.array(["ABCDEFGH".index(s[0]),int(s[1])-1]) class Reversi( TwoPlayersGame ): """ See the rules on http://en.wikipedia.org/wiki/Reversi Here for simplicity we suppose that the game ends when a player cannot play, but it would take just a few more lines to implement the real ending rules, by which the game ends when both players can't play. This implementation will make a slow and dumbe AI and could be sped up by adding a way of unmaking moves (method unmake_moves) and coding some parts in C (this is left as an exercise :) ) """ def __init__(self, players, board = None): self.players = players self.board = np.zeros((8,8), dtype=int) self.board[3,[3,4]] = [1,2] self.board[4,[3,4]] = [2,1] self.nplayer=1 def possible_moves(self): """ Only moves that lead to flipped pieces are allowed """ return [to_string((i,j)) for i in range(8) for j in range(8) if (self.board[i,j] == 0) and (pieces_flipped(self.board, (i,j), self.nplayer) != [])] def make_move(self, pos): """ Put the piece at position ``pos`` and flip the pieces that much be flipped """ pos= to_array(pos) flipped = pieces_flipped(self.board, pos, self.nplayer) for i,j in flipped: self.board[i,j] = self.nplayer self.board[pos[0],pos[1]] = self.nplayer def show(self): """ Prints the board in a fancy (?) way """ print('\n'+'\n'.join([' 1 2 3 4 5 6 7 8']+ ['ABCDEFGH'[k] + ' '+' '.join([['.','1','2','X'][self.board[k][i]] for i in range(8)]) for k in range(8)]+[''])) def is_over(self): """ The game is considered over when someone cannot play. That may not be the actual rule but it is simpler to code :). Of course it would be possible to implement that a player can pass if it cannot play (by adding the move 'pass')""" return self.possible_moves() == [] def scoring(self): """ In the beginning of the game (less than 32 pieces) much importance is given to placing pieces on the border. After this point, only the number of pieces of each player counts """ if np.sum(self.board==0) > 32: # less than half the board is full player = self.board==self.nplayer opponent = self.board==self.nopponent return ((player-opponent)*BOARD_SCORE).sum() else: npieces_player = np.sum(self.board==self.nplayer) npieces_opponent = np.sum(self.board==self.nopponent) return npieces_player - npieces_opponent # This board is used by the AI to give more importance to the border BOARD_SCORE = np.array( [[9,3,3,3,3,3,3,9], [3,1,1,1,1,1,1,3], [3,1,1,1,1,1,1,3], [3,1,1,1,1,1,1,3], [3,1,1,1,1,1,1,3], [3,1,1,1,1,1,1,3], [3,1,1,1,1,1,1,3], [9,3,3,3,3,3,3,9]]) DIRECTIONS = [ np.array([i,j]) for i in [-1,0,1] for j in [-1,0,1] if (i!=0 or j!=0)] def pieces_flipped(board, pos, nplayer): """ Returns a list of the positions of the pieces to be flipped if player `nplayer` places a piece on the `board` at position `pos`. This is slow and could be coded in C or Cython. """ flipped = [] for d in DIRECTIONS: ppos = pos + d streak = [] while (0<=ppos[0]<=7) and (0<=ppos[1]<=7): if board[ppos[0],ppos[1]] == 3 - nplayer: streak.append(+ppos) elif board[ppos[0],ppos[1]] == nplayer: flipped += streak break else: break ppos += d return flipped if __name__ == "__main__": from easyAI import Human_Player, AI_Player, Negamax # An example: Computer vs Computer: game = Reversi([AI_Player(Negamax(4)), AI_Player(Negamax(4))]) game.play() if game.scoring() > 0: print("player %d wins." % game.nplayer) elif game.scoring() < 0: print("player %d wins." % game.nopponent) else: print("Draw.")
[ 1, 9995, 13, 1576, 3748, 310, 830, 874, 29875, 29889, 24412, 29901, 445, 3748, 338, 451, 274, 6797, 297, 385, 14413, 13, 1582, 29892, 278, 319, 29902, 674, 367, 5232, 29889, 13, 15945, 29908, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 4780, 23869, 1053, 7803, 13454, 414, 14199, 13, 13, 517, 29918, 1807, 353, 14013, 263, 584, 376, 19658, 24405, 29954, 29950, 29908, 29961, 29874, 29961, 29900, 5262, 718, 851, 29898, 29874, 29961, 29896, 10062, 29896, 29897, 13, 517, 29918, 2378, 353, 14013, 269, 584, 7442, 29889, 2378, 29898, 3366, 19658, 24405, 29954, 29950, 1642, 2248, 29898, 29879, 29961, 29900, 11724, 524, 29898, 29879, 29961, 29896, 2314, 29899, 29896, 2314, 13, 13, 1990, 830, 874, 29875, 29898, 7803, 13454, 414, 14199, 29871, 1125, 13, 1678, 9995, 13, 1678, 2823, 278, 6865, 373, 1732, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 1123, 874, 29875, 13, 1678, 2266, 363, 23205, 591, 7755, 393, 278, 3748, 10614, 746, 263, 13, 1678, 4847, 2609, 1708, 29892, 541, 372, 723, 2125, 925, 263, 2846, 901, 3454, 304, 13, 1678, 2334, 278, 1855, 17140, 6865, 29892, 491, 607, 278, 3748, 10614, 746, 1716, 13, 1678, 10769, 508, 29915, 29873, 1708, 29889, 13, 268, 13, 1678, 910, 5314, 674, 1207, 263, 5232, 322, 270, 398, 915, 319, 29902, 322, 1033, 367, 805, 287, 13, 1678, 701, 491, 4417, 263, 982, 310, 443, 28990, 16229, 313, 5696, 443, 5675, 29918, 13529, 267, 29897, 322, 13, 1678, 14137, 777, 5633, 297, 315, 313, 1366, 338, 2175, 408, 385, 15058, 4248, 1723, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10769, 29892, 7613, 353, 6213, 1125, 13, 4706, 1583, 29889, 1456, 414, 353, 10769, 13, 4706, 1583, 29889, 3377, 353, 7442, 29889, 3298, 359, 3552, 29947, 29892, 29947, 511, 26688, 29922, 524, 29897, 13, 4706, 1583, 29889, 3377, 29961, 29941, 17094, 29941, 29892, 29946, 5262, 353, 518, 29896, 29892, 29906, 29962, 13, 4706, 1583, 29889, 3377, 29961, 29946, 17094, 29941, 29892, 29946, 5262, 353, 518, 29906, 29892, 29896, 29962, 13, 4706, 1583, 29889, 29876, 9106, 29922, 29896, 13, 13, 13, 1678, 822, 1950, 29918, 13529, 267, 29898, 1311, 1125, 13, 4706, 9995, 9333, 16229, 393, 3275, 304, 285, 492, 2986, 12785, 526, 6068, 9995, 13, 4706, 736, 518, 517, 29918, 1807, 3552, 29875, 29892, 29926, 876, 363, 474, 297, 3464, 29898, 29947, 29897, 363, 432, 297, 3464, 29898, 29947, 29897, 13, 9651, 565, 313, 1311, 29889, 3377, 29961, 29875, 29892, 29926, 29962, 1275, 29871, 29900, 29897, 13, 9651, 322, 313, 12343, 778, 29918, 20157, 2986, 29898, 1311, 29889, 3377, 29892, 313, 29875, 29892, 29926, 511, 1583, 29889, 29876, 9106, 29897, 2804, 518, 2314, 29962, 13, 13, 1678, 822, 1207, 29918, 11631, 29898, 1311, 29892, 926, 1125, 13, 4706, 9995, 12065, 278, 8424, 472, 2602, 4954, 1066, 16159, 322, 285, 3466, 278, 12785, 393, 13, 4706, 1568, 367, 285, 492, 2986, 9995, 13, 4706, 926, 29922, 304, 29918, 2378, 29898, 1066, 29897, 13, 4706, 285, 492, 2986, 353, 12785, 29918, 20157, 2986, 29898, 1311, 29889, 3377, 29892, 926, 29892, 1583, 29889, 29876, 9106, 29897, 13, 4706, 363, 474, 29892, 29926, 297, 285, 492, 2986, 29901, 13, 9651, 1583, 29889, 3377, 29961, 29875, 29892, 29926, 29962, 353, 1583, 29889, 29876, 9106, 13, 4706, 1583, 29889, 3377, 29961, 1066, 29961, 29900, 1402, 1066, 29961, 29896, 5262, 353, 1583, 29889, 29876, 9106, 13, 13, 1678, 822, 1510, 29898, 1311, 1125, 13, 4706, 9995, 1588, 9466, 278, 7613, 297, 263, 19231, 313, 7897, 982, 9995, 13, 4706, 1596, 28909, 29876, 18717, 12764, 29876, 4286, 7122, 18959, 259, 29896, 29871, 29906, 29871, 29941, 29871, 29946, 29871, 29945, 29871, 29953, 29871, 29955, 29871, 29947, 2033, 29974, 6024, 19658, 24405, 29954, 29950, 29915, 29961, 29895, 29962, 718, 13, 18884, 525, 525, 23097, 15300, 7122, 4197, 1839, 29889, 3788, 29896, 3788, 29906, 3788, 29990, 2033, 29961, 1311, 29889, 3377, 29961, 29895, 3816, 29875, 5262, 13, 18884, 363, 474, 297, 3464, 29898, 29947, 29897, 2314, 363, 413, 297, 3464, 29898, 29947, 4638, 29974, 1839, 25901, 13, 13, 1678, 822, 338, 29918, 957, 29898, 1311, 1125, 13, 4706, 9995, 450, 3748, 338, 5545, 975, 746, 4856, 2609, 1708, 29889, 2193, 13, 4706, 1122, 451, 367, 278, 3935, 5751, 541, 372, 338, 13682, 304, 775, 584, 467, 4587, 13, 4706, 3236, 372, 723, 367, 1950, 304, 2334, 393, 263, 4847, 508, 1209, 13, 4706, 565, 372, 2609, 1708, 313, 1609, 4417, 278, 4337, 525, 3364, 1495, 15945, 29908, 13, 4706, 736, 1583, 29889, 27338, 29918, 13529, 267, 580, 1275, 5159, 13, 13, 1678, 822, 26654, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 512, 278, 6763, 310, 278, 3748, 313, 2222, 1135, 29871, 29941, 29906, 12785, 29897, 1568, 13, 4706, 13500, 338, 2183, 304, 24421, 12785, 373, 278, 5139, 29889, 2860, 445, 13, 4706, 1298, 29892, 871, 278, 1353, 310, 12785, 310, 1269, 4847, 18139, 13, 4706, 9995, 13, 13, 4706, 565, 7442, 29889, 2083, 29898, 1311, 29889, 3377, 1360, 29900, 29897, 1405, 29871, 29941, 29906, 29901, 396, 3109, 1135, 4203, 278, 7613, 338, 2989, 13, 9651, 4847, 353, 1583, 29889, 3377, 1360, 1311, 29889, 29876, 9106, 13, 9651, 23995, 296, 353, 1583, 29889, 3377, 1360, 1311, 29889, 1217, 407, 265, 296, 13, 9651, 736, 5135, 9106, 29899, 9354, 265, 296, 11877, 8456, 17011, 29918, 29903, 3217, 1525, 467, 2083, 580, 13, 4706, 1683, 29901, 13, 9651, 7442, 347, 778, 29918, 9106, 353, 7442, 29889, 2083, 29898, 1311, 29889, 3377, 1360, 1311, 29889, 29876, 9106, 29897, 13, 9651, 7442, 347, 778, 29918, 9354, 265, 296, 353, 7442, 29889, 2083, 29898, 1311, 29889, 3377, 1360, 1311, 29889, 1217, 407, 265, 296, 29897, 13, 9651, 736, 29871, 7442, 347, 778, 29918, 9106, 448, 7442, 347, 778, 29918, 9354, 265, 296, 13, 13, 29937, 910, 7613, 338, 1304, 491, 278, 319, 29902, 304, 2367, 901, 13500, 304, 278, 5139, 13, 8456, 17011, 29918, 29903, 3217, 1525, 353, 7442, 29889, 2378, 29898, 5519, 29929, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29929, 1402, 13, 462, 308, 518, 29941, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29941, 1402, 13, 462, 308, 518, 29941, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29941, 1402, 13, 462, 308, 518, 29941, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29941, 1402, 13, 462, 308, 518, 29941, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29941, 1402, 13, 462, 308, 518, 29941, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29941, 1402, 13, 462, 308, 518, 29941, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29941, 1402, 13, 462, 308, 518, 29929, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29941, 29892, 29929, 24960, 13, 13, 4571, 1525, 9838, 29903, 353, 518, 7442, 29889, 2378, 4197, 29875, 29892, 29926, 2314, 363, 474, 297, 21069, 29896, 29892, 29900, 29892, 29896, 29962, 363, 432, 297, 21069, 29896, 29892, 29900, 29892, 29896, 29962, 13, 462, 1669, 565, 313, 29875, 19216, 29900, 470, 432, 19216, 29900, 4638, 13, 13, 1753, 12785, 29918, 20157, 2986, 29898, 3377, 29892, 926, 29892, 302, 9106, 1125, 13, 1678, 9995, 13, 1678, 16969, 263, 1051, 310, 278, 11909, 310, 278, 12785, 304, 367, 285, 492, 2986, 565, 13, 1678, 4847, 421, 29876, 9106, 29952, 7600, 263, 8424, 373, 278, 421, 3377, 29952, 472, 2602, 421, 1066, 1412, 13, 1678, 910, 338, 5232, 322, 1033, 367, 274, 6797, 297, 315, 470, 315, 1656, 29889, 13, 1678, 9995, 13, 13, 1678, 285, 492, 2986, 353, 5159, 13, 13, 1678, 363, 270, 297, 22471, 1525, 9838, 29903, 29901, 13, 4706, 282, 1066, 353, 926, 718, 270, 13, 4706, 12243, 557, 353, 5159, 13, 4706, 1550, 313, 29900, 14065, 407, 359, 29961, 29900, 29962, 14065, 29955, 29897, 322, 313, 29900, 14065, 407, 359, 29961, 29896, 29962, 14065, 29955, 1125, 13, 9651, 565, 7613, 29961, 407, 359, 29961, 29900, 1402, 407, 359, 29961, 29896, 5262, 1275, 29871, 29941, 448, 302, 9106, 29901, 13, 18884, 12243, 557, 29889, 4397, 29898, 29974, 407, 359, 29897, 13, 9651, 25342, 7613, 29961, 407, 359, 29961, 29900, 1402, 407, 359, 29961, 29896, 5262, 1275, 302, 9106, 29901, 13, 18884, 285, 492, 2986, 4619, 12243, 557, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 2867, 13, 9651, 282, 1066, 4619, 270, 13, 13, 1678, 736, 285, 492, 2986, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 515, 4780, 23869, 1053, 12968, 29918, 9075, 29892, 319, 29902, 29918, 9075, 29892, 12610, 314, 1165, 13, 13, 1678, 396, 530, 1342, 29901, 20972, 7186, 20972, 29901, 13, 1678, 3748, 353, 830, 874, 29875, 4197, 23869, 29918, 9075, 29898, 29940, 387, 314, 1165, 29898, 29946, 8243, 319, 29902, 29918, 9075, 29898, 29940, 387, 314, 1165, 29898, 29946, 876, 2314, 13, 1678, 3748, 29889, 1456, 580, 13, 1678, 565, 3748, 29889, 1557, 8253, 580, 1405, 29871, 29900, 29901, 13, 4706, 1596, 703, 9106, 1273, 29881, 21614, 1213, 1273, 3748, 29889, 29876, 9106, 29897, 13, 1678, 25342, 3748, 29889, 1557, 8253, 580, 529, 29871, 29900, 29901, 13, 4706, 1596, 703, 9106, 1273, 29881, 21614, 1213, 1273, 3748, 29889, 1217, 407, 265, 296, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 8537, 23157, 13, 2 ]
rdp/__init__.py
emulbreh/rdp
0
49480
from rdp.grammar import Grammar, GrammarBuilder, ignore from rdp.symbols import Terminal, repeat, Regexp, Optional, Lookahead from rdp.symbols import epsilon, flatten, drop, keep from rdp.parser import Parser from rdp.exceptions import ParseError, LeftRecursion, InvalidGrammar, TokenizeError
[ 1, 515, 364, 6099, 29889, 1393, 3034, 1053, 16878, 3034, 29892, 16878, 3034, 5627, 29892, 11455, 13, 3166, 364, 6099, 29889, 18098, 29879, 1053, 29175, 29892, 12312, 29892, 2169, 4548, 29892, 28379, 29892, 7419, 29874, 2813, 13, 3166, 364, 6099, 29889, 18098, 29879, 1053, 321, 3232, 29892, 1652, 8606, 29892, 5768, 29892, 3013, 13, 3166, 364, 6099, 29889, 16680, 1053, 1459, 643, 13, 3166, 364, 6099, 29889, 11739, 29879, 1053, 20969, 2392, 29892, 19941, 4789, 1295, 291, 29892, 21403, 29954, 2572, 3034, 29892, 25159, 675, 2392, 13, 2 ]
Voicelab/toolkits/Voicelab/MeasureFormantPositionsNode.py
FrancisTembo/VoiceLab
27
178305
from Voicelab.pipeline.Node import Node from parselmouth.praat import call from Voicelab.toolkits.Voicelab.VoicelabNode import VoicelabNode from Voicelab.toolkits.Voicelab.MeasurePitchNode import measure_pitch from scipy import stats import statistics class MeasureFormantPositionsNode(VoicelabNode): def __init__(self, *args, **kwargs): """ Args: *args: **kwargs: """ super().__init__(*args, **kwargs) self.args = { # 'Method': 'formants_praat_manual' } self.state = { "f1_mean_pf_list": [], "f2_mean_pf_list": [], "f3_mean_pf_list": [], "f4_mean_pf_list": [], #'f1_median_pf_list': [], #'f2_median_pf_list': [], #'f3_median_pf_list': [], #'f4_median_pf_list': [], } # On each file we want to calculate the formants at the glottal pulses def process(self): voice: object = self.args["voice"] # method = self.args['Method'] # pitch = self.args['Pitch'] formant_object = self.args["Formants"] pitch_floor = self.args["Pitch Floor"] pitch_ceiling = self.args["Pitch Ceiling"] pitch = measure_pitch( voice=voice, measure="cc", floor=pitch_floor, ceiling=pitch_ceiling ) point_process = call( [voice, pitch], "To PointProcess (cc)" ) # Create PointProcess object num_points = call(point_process, "Get number of points") f1_list = [] f2_list = [] f3_list = [] f4_list = [] measurement_times = [] for point in range(0, num_points): point += 1 t = call(point_process, "Get time from index", point) measurement_times.append(t) f1 = call(formant_object, "Get value at time", 1, t, "Hertz", "Linear") f2 = call(formant_object, "Get value at time", 2, t, "Hertz", "Linear") f3 = call(formant_object, "Get value at time", 3, t, "Hertz", "Linear") f4 = call(formant_object, "Get value at time", 4, t, "Hertz", "Linear") f1_list.append(f1) f2_list.append(f2) f3_list.append(f3) f4_list.append(f4) f1_list = [f1 for f1 in f1_list if str(f1) != "nan"] f2_list = [f2 for f2 in f2_list if str(f2) != "nan"] f3_list = [f3 for f3 in f3_list if str(f3) != "nan"] f4_list = [f4 for f4 in f4_list if str(f4) != "nan"] # calculate mean & median formants across pulses if len(f1_list) > 0: f1_mean_pf = sum(f1_list) / len(f1_list) # f1_median_pf = statistics.median(f1_list) else: f1_mean_pf = "N/A" f1_median_pf = "N/A" if len(f2_list) > 0: f2_mean_pf = sum(f2_list) / len(f2_list) f2_median_pf = statistics.median(f2_list) else: f2_mean_pf = "N/A" f2_median_pf = "N/A" if len(f3_list) > 0: f3_mean_pf = sum(f3_list) / len(f3_list) f3_median_pf = statistics.median(f3_list) else: f3_mean_pf = "N/A" f3_median_pf = "N/A" if len(f4_list) > 0: f4_mean_pf = sum(f4_list) / len(f4_list) f4_median_pf = statistics.median(f4_list) else: f4_mean_pf = "N/A" f4_median_pf = "N/A" results = {} # collect all means and median values, these will be needed at the end to calculate the formant positions self.state["f1_mean_pf_list"].append(f1_mean_pf) self.state["f2_mean_pf_list"].append(f2_mean_pf) self.state["f3_mean_pf_list"].append(f3_mean_pf) self.state["f4_mean_pf_list"].append(f4_mean_pf) self.state["f1_median_pf_list"].append(f1_median_pf) self.state["f2_median_pf_list"].append(f2_median_pf) self.state["f3_median_pf_list"].append(f3_median_pf) self.state["f4_median_pf_list"].append(f4_median_pf) return results # Once all of the files have been processed, we want to calculate the position across all of them def end(self, results): """ Args: results: """ f1_mean_pf_list = self.state["f1_mean_pf_list"] f2_mean_pf_list = self.state["f2_mean_pf_list"] f3_mean_pf_list = self.state["f3_mean_pf_list"] f4_mean_pf_list = self.state["f4_mean_pf_list"] f1_median_pf_list = self.state["f1_median_pf_list"] f2_median_pf_list = self.state["f2_median_pf_list"] f3_median_pf_list = self.state["f3_median_pf_list"] f4_median_pf_list = self.state["f4_median_pf_list"] formant_mean_lists = [ f1_mean_pf_list, f2_mean_pf_list, f3_mean_pf_list, f4_mean_pf_list, ] formant_median_lists = [ f1_median_pf_list, f2_median_pf_list, f3_median_pf_list, f4_median_pf_list, ] # append it to the results of all of them formant_positions = self.calculate_formant_position(formant_mean_lists) for i, result in enumerate(results): if isinstance(formant_positions, str): results[i][self]["Formant Position"] = formant_positions else: results[i][self]["Formant Position"] = float(formant_positions[i]) return results # to calcualte the formant position we need the formants at glotal pulses for each file we rans def calculate_formant_position(self, formant_mean_lists, formant_median_lists): """ Args: formant_mean_lists: formant_median_lists: """ if len(formant_mean_lists[0]) < 30: # or len(formant_medians_lists[0]) < 8: return "Not enough samples, requires at least 30" # Normality test for mean data _, p_f1_mean = stats.normaltest(formant_mean_lists[0]) _, p_f2_mean = stats.normaltest(formant_mean_lists[1]) _, p_f3_mean = stats.normaltest(formant_mean_lists[2]) _, p_f4_mean = stats.normaltest(formant_mean_lists[3]) if p_f1_mean >= 0.5 or p_f2_mean >= 0.5 or p_f3_mean >= 0.5 or p_f4_mean >= 0.5: return "formants not normally distributed" else: zf1_mean = stats.zscore(formant_mean_lists[0]) zf2_mean = stats.zscore(formant_mean_lists[1]) zf3_mean = stats.zscore(formant_mean_lists[2]) zf4_mean = stats.zscore(formant_mean_lists[3]) pf_mean = (zf1_mean + zf2_mean + zf3_mean + zf4_mean) / 4 return pf_mean # normality test for median data _, p_f1_median = stats.normaltest(formant_medians_lists[0]) _, p_f2_median = stats.normaltest(formant_medians_lists[1]) _, p_f3_median = stats.normaltest(formant_medians_lists[2]) _, p_f4_median = stats.normaltest(formant_medians_lists[3]) if ( p_f1_median >= 0.5 or p_f2_median >= 0.5 or p_f3_median >= 0.5 or p_f4_median >= 0.5 ): return "formants not normally distributed" else: zf1_median = stats.zscore(formant_medians_lists[0]) zf2_median = stats.zscore(formant_medians_lists[1]) zf3_median = stats.zscore(formant_medians_lists[2]) zf4_median = stats.zscore(formant_medians_lists[3]) pf_median = (zf1_median + zf2_median + zf3_median + zf4_median) / 4 return pf_median
[ 1, 515, 4785, 293, 295, 370, 29889, 13096, 5570, 29889, 4247, 1053, 9071, 13, 3166, 610, 2838, 21026, 29889, 29886, 336, 271, 1053, 1246, 13, 3166, 4785, 293, 295, 370, 29889, 10154, 29895, 1169, 29889, 29963, 29877, 293, 295, 370, 29889, 29963, 29877, 293, 295, 370, 4247, 1053, 4785, 293, 295, 370, 4247, 13, 3166, 4785, 293, 295, 370, 29889, 10154, 29895, 1169, 29889, 29963, 29877, 293, 295, 370, 29889, 6816, 3745, 29925, 2335, 4247, 1053, 5645, 29918, 29886, 2335, 13, 3166, 4560, 2272, 1053, 22663, 13, 5215, 13964, 13, 13, 13, 1990, 2191, 3745, 2500, 424, 9135, 2187, 4247, 29898, 29963, 29877, 293, 295, 370, 4247, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 334, 5085, 29901, 13, 9651, 3579, 19290, 29901, 13, 4706, 9995, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 4706, 1583, 29889, 5085, 353, 426, 13, 9651, 396, 525, 4062, 2396, 525, 689, 1934, 29918, 29886, 336, 271, 29918, 11288, 29915, 13, 4706, 500, 13, 13, 4706, 1583, 29889, 3859, 353, 426, 13, 9651, 376, 29888, 29896, 29918, 12676, 29918, 7810, 29918, 1761, 1115, 19997, 13, 9651, 376, 29888, 29906, 29918, 12676, 29918, 7810, 29918, 1761, 1115, 19997, 13, 9651, 376, 29888, 29941, 29918, 12676, 29918, 7810, 29918, 1761, 1115, 19997, 13, 9651, 376, 29888, 29946, 29918, 12676, 29918, 7810, 29918, 1761, 1115, 19997, 13, 9651, 396, 29915, 29888, 29896, 29918, 2168, 713, 29918, 7810, 29918, 1761, 2396, 19997, 13, 9651, 396, 29915, 29888, 29906, 29918, 2168, 713, 29918, 7810, 29918, 1761, 2396, 19997, 13, 9651, 396, 29915, 29888, 29941, 29918, 2168, 713, 29918, 7810, 29918, 1761, 2396, 19997, 13, 9651, 396, 29915, 29888, 29946, 29918, 2168, 713, 29918, 7810, 29918, 1761, 2396, 19997, 13, 4706, 500, 13, 13, 1678, 396, 1551, 1269, 934, 591, 864, 304, 8147, 278, 883, 1934, 472, 278, 3144, 1501, 284, 282, 7273, 267, 13, 1678, 822, 1889, 29898, 1311, 1125, 13, 13, 4706, 7314, 29901, 1203, 353, 1583, 29889, 5085, 3366, 14917, 3108, 13, 13, 4706, 396, 1158, 353, 1583, 29889, 5085, 1839, 4062, 2033, 13, 4706, 396, 15905, 353, 1583, 29889, 5085, 1839, 29925, 2335, 2033, 13, 4706, 883, 424, 29918, 3318, 353, 1583, 29889, 5085, 3366, 2500, 1934, 3108, 13, 13, 4706, 15905, 29918, 14939, 353, 1583, 29889, 5085, 3366, 29925, 2335, 383, 10102, 3108, 13, 4706, 15905, 29918, 346, 6504, 353, 1583, 29889, 5085, 3366, 29925, 2335, 7747, 6504, 3108, 13, 4706, 15905, 353, 5645, 29918, 29886, 2335, 29898, 13, 9651, 7314, 29922, 14917, 29892, 5645, 543, 617, 613, 11904, 29922, 29886, 2335, 29918, 14939, 29892, 2257, 6504, 29922, 29886, 2335, 29918, 346, 6504, 13, 4706, 1723, 13, 13, 4706, 1298, 29918, 5014, 353, 1246, 29898, 13, 9651, 518, 14917, 29892, 15905, 1402, 376, 1762, 8984, 7032, 313, 617, 5513, 13, 4706, 1723, 29871, 396, 6204, 8984, 7032, 1203, 13, 4706, 954, 29918, 9748, 353, 1246, 29898, 3149, 29918, 5014, 29892, 376, 2577, 1353, 310, 3291, 1159, 13, 13, 4706, 285, 29896, 29918, 1761, 353, 5159, 13, 4706, 285, 29906, 29918, 1761, 353, 5159, 13, 4706, 285, 29941, 29918, 1761, 353, 5159, 13, 4706, 285, 29946, 29918, 1761, 353, 5159, 13, 4706, 20039, 29918, 3706, 353, 5159, 13, 13, 4706, 363, 1298, 297, 3464, 29898, 29900, 29892, 954, 29918, 9748, 1125, 13, 9651, 1298, 4619, 29871, 29896, 13, 9651, 260, 353, 1246, 29898, 3149, 29918, 5014, 29892, 376, 2577, 931, 515, 2380, 613, 1298, 29897, 13, 9651, 20039, 29918, 3706, 29889, 4397, 29898, 29873, 29897, 13, 9651, 285, 29896, 353, 1246, 29898, 689, 424, 29918, 3318, 29892, 376, 2577, 995, 472, 931, 613, 29871, 29896, 29892, 260, 29892, 376, 29950, 814, 29920, 613, 376, 12697, 1159, 13, 9651, 285, 29906, 353, 1246, 29898, 689, 424, 29918, 3318, 29892, 376, 2577, 995, 472, 931, 613, 29871, 29906, 29892, 260, 29892, 376, 29950, 814, 29920, 613, 376, 12697, 1159, 13, 9651, 285, 29941, 353, 1246, 29898, 689, 424, 29918, 3318, 29892, 376, 2577, 995, 472, 931, 613, 29871, 29941, 29892, 260, 29892, 376, 29950, 814, 29920, 613, 376, 12697, 1159, 13, 9651, 285, 29946, 353, 1246, 29898, 689, 424, 29918, 3318, 29892, 376, 2577, 995, 472, 931, 613, 29871, 29946, 29892, 260, 29892, 376, 29950, 814, 29920, 613, 376, 12697, 1159, 13, 9651, 285, 29896, 29918, 1761, 29889, 4397, 29898, 29888, 29896, 29897, 13, 9651, 285, 29906, 29918, 1761, 29889, 4397, 29898, 29888, 29906, 29897, 13, 9651, 285, 29941, 29918, 1761, 29889, 4397, 29898, 29888, 29941, 29897, 13, 9651, 285, 29946, 29918, 1761, 29889, 4397, 29898, 29888, 29946, 29897, 13, 13, 4706, 285, 29896, 29918, 1761, 353, 518, 29888, 29896, 363, 285, 29896, 297, 285, 29896, 29918, 1761, 565, 851, 29898, 29888, 29896, 29897, 2804, 376, 13707, 3108, 13, 4706, 285, 29906, 29918, 1761, 353, 518, 29888, 29906, 363, 285, 29906, 297, 285, 29906, 29918, 1761, 565, 851, 29898, 29888, 29906, 29897, 2804, 376, 13707, 3108, 13, 4706, 285, 29941, 29918, 1761, 353, 518, 29888, 29941, 363, 285, 29941, 297, 285, 29941, 29918, 1761, 565, 851, 29898, 29888, 29941, 29897, 2804, 376, 13707, 3108, 13, 4706, 285, 29946, 29918, 1761, 353, 518, 29888, 29946, 363, 285, 29946, 297, 285, 29946, 29918, 1761, 565, 851, 29898, 29888, 29946, 29897, 2804, 376, 13707, 3108, 13, 13, 4706, 396, 8147, 2099, 669, 19194, 883, 1934, 4822, 282, 7273, 267, 13, 4706, 565, 7431, 29898, 29888, 29896, 29918, 1761, 29897, 1405, 29871, 29900, 29901, 13, 9651, 285, 29896, 29918, 12676, 29918, 7810, 353, 2533, 29898, 29888, 29896, 29918, 1761, 29897, 847, 7431, 29898, 29888, 29896, 29918, 1761, 29897, 13, 9651, 396, 285, 29896, 29918, 2168, 713, 29918, 7810, 353, 13964, 29889, 2168, 713, 29898, 29888, 29896, 29918, 1761, 29897, 13, 4706, 1683, 29901, 13, 9651, 285, 29896, 29918, 12676, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 9651, 285, 29896, 29918, 2168, 713, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 13, 4706, 565, 7431, 29898, 29888, 29906, 29918, 1761, 29897, 1405, 29871, 29900, 29901, 13, 9651, 285, 29906, 29918, 12676, 29918, 7810, 353, 2533, 29898, 29888, 29906, 29918, 1761, 29897, 847, 7431, 29898, 29888, 29906, 29918, 1761, 29897, 13, 9651, 285, 29906, 29918, 2168, 713, 29918, 7810, 353, 13964, 29889, 2168, 713, 29898, 29888, 29906, 29918, 1761, 29897, 13, 4706, 1683, 29901, 13, 9651, 285, 29906, 29918, 12676, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 9651, 285, 29906, 29918, 2168, 713, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 13, 4706, 565, 7431, 29898, 29888, 29941, 29918, 1761, 29897, 1405, 29871, 29900, 29901, 13, 9651, 285, 29941, 29918, 12676, 29918, 7810, 353, 2533, 29898, 29888, 29941, 29918, 1761, 29897, 847, 7431, 29898, 29888, 29941, 29918, 1761, 29897, 13, 9651, 285, 29941, 29918, 2168, 713, 29918, 7810, 353, 13964, 29889, 2168, 713, 29898, 29888, 29941, 29918, 1761, 29897, 13, 4706, 1683, 29901, 13, 9651, 285, 29941, 29918, 12676, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 9651, 285, 29941, 29918, 2168, 713, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 13, 4706, 565, 7431, 29898, 29888, 29946, 29918, 1761, 29897, 1405, 29871, 29900, 29901, 13, 9651, 285, 29946, 29918, 12676, 29918, 7810, 353, 2533, 29898, 29888, 29946, 29918, 1761, 29897, 847, 7431, 29898, 29888, 29946, 29918, 1761, 29897, 13, 9651, 285, 29946, 29918, 2168, 713, 29918, 7810, 353, 13964, 29889, 2168, 713, 29898, 29888, 29946, 29918, 1761, 29897, 13, 4706, 1683, 29901, 13, 9651, 285, 29946, 29918, 12676, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 9651, 285, 29946, 29918, 2168, 713, 29918, 7810, 353, 376, 29940, 29914, 29909, 29908, 13, 13, 4706, 2582, 353, 6571, 13, 13, 4706, 396, 6314, 599, 2794, 322, 19194, 1819, 29892, 1438, 674, 367, 4312, 472, 278, 1095, 304, 8147, 278, 883, 424, 11909, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29896, 29918, 12676, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29896, 29918, 12676, 29918, 7810, 29897, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29906, 29918, 12676, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29906, 29918, 12676, 29918, 7810, 29897, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29941, 29918, 12676, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29941, 29918, 12676, 29918, 7810, 29897, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29946, 29918, 12676, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29946, 29918, 12676, 29918, 7810, 29897, 13, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29896, 29918, 2168, 713, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29896, 29918, 2168, 713, 29918, 7810, 29897, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29906, 29918, 2168, 713, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29906, 29918, 2168, 713, 29918, 7810, 29897, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29941, 29918, 2168, 713, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29941, 29918, 2168, 713, 29918, 7810, 29897, 13, 4706, 1583, 29889, 3859, 3366, 29888, 29946, 29918, 2168, 713, 29918, 7810, 29918, 1761, 16862, 4397, 29898, 29888, 29946, 29918, 2168, 713, 29918, 7810, 29897, 13, 13, 4706, 736, 2582, 13, 13, 1678, 396, 9038, 599, 310, 278, 2066, 505, 1063, 19356, 29892, 591, 864, 304, 8147, 278, 2602, 4822, 599, 310, 963, 13, 1678, 822, 1095, 29898, 1311, 29892, 2582, 1125, 13, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 2582, 29901, 13, 4706, 9995, 13, 4706, 285, 29896, 29918, 12676, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29896, 29918, 12676, 29918, 7810, 29918, 1761, 3108, 13, 4706, 285, 29906, 29918, 12676, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29906, 29918, 12676, 29918, 7810, 29918, 1761, 3108, 13, 4706, 285, 29941, 29918, 12676, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29941, 29918, 12676, 29918, 7810, 29918, 1761, 3108, 13, 4706, 285, 29946, 29918, 12676, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29946, 29918, 12676, 29918, 7810, 29918, 1761, 3108, 13, 13, 4706, 285, 29896, 29918, 2168, 713, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29896, 29918, 2168, 713, 29918, 7810, 29918, 1761, 3108, 13, 4706, 285, 29906, 29918, 2168, 713, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29906, 29918, 2168, 713, 29918, 7810, 29918, 1761, 3108, 13, 4706, 285, 29941, 29918, 2168, 713, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29941, 29918, 2168, 713, 29918, 7810, 29918, 1761, 3108, 13, 4706, 285, 29946, 29918, 2168, 713, 29918, 7810, 29918, 1761, 353, 1583, 29889, 3859, 3366, 29888, 29946, 29918, 2168, 713, 29918, 7810, 29918, 1761, 3108, 13, 13, 4706, 883, 424, 29918, 12676, 29918, 21513, 353, 518, 13, 9651, 285, 29896, 29918, 12676, 29918, 7810, 29918, 1761, 29892, 13, 9651, 285, 29906, 29918, 12676, 29918, 7810, 29918, 1761, 29892, 13, 9651, 285, 29941, 29918, 12676, 29918, 7810, 29918, 1761, 29892, 13, 9651, 285, 29946, 29918, 12676, 29918, 7810, 29918, 1761, 29892, 13, 4706, 4514, 13, 4706, 883, 424, 29918, 2168, 713, 29918, 21513, 353, 518, 13, 9651, 285, 29896, 29918, 2168, 713, 29918, 7810, 29918, 1761, 29892, 13, 9651, 285, 29906, 29918, 2168, 713, 29918, 7810, 29918, 1761, 29892, 13, 9651, 285, 29941, 29918, 2168, 713, 29918, 7810, 29918, 1761, 29892, 13, 9651, 285, 29946, 29918, 2168, 713, 29918, 7810, 29918, 1761, 29892, 13, 4706, 4514, 13, 13, 4706, 396, 9773, 372, 304, 278, 2582, 310, 599, 310, 963, 13, 4706, 883, 424, 29918, 1066, 2187, 353, 1583, 29889, 15807, 403, 29918, 689, 424, 29918, 3283, 29898, 689, 424, 29918, 12676, 29918, 21513, 29897, 13, 4706, 363, 474, 29892, 1121, 297, 26985, 29898, 9902, 1125, 13, 9651, 565, 338, 8758, 29898, 689, 424, 29918, 1066, 2187, 29892, 851, 1125, 13, 18884, 2582, 29961, 29875, 3816, 1311, 29962, 3366, 2500, 424, 20627, 3108, 353, 883, 424, 29918, 1066, 2187, 13, 9651, 1683, 29901, 13, 18884, 2582, 29961, 29875, 3816, 1311, 29962, 3366, 2500, 424, 20627, 3108, 353, 5785, 29898, 689, 424, 29918, 1066, 2187, 29961, 29875, 2314, 13, 13, 4706, 736, 2582, 13, 13, 1678, 396, 304, 22235, 950, 371, 278, 883, 424, 2602, 591, 817, 278, 883, 1934, 472, 3144, 7288, 282, 7273, 267, 363, 1269, 934, 591, 364, 550, 13, 1678, 822, 8147, 29918, 689, 424, 29918, 3283, 29898, 1311, 29892, 883, 424, 29918, 12676, 29918, 21513, 29892, 883, 424, 29918, 2168, 713, 29918, 21513, 1125, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 883, 424, 29918, 12676, 29918, 21513, 29901, 13, 9651, 883, 424, 29918, 2168, 713, 29918, 21513, 29901, 13, 4706, 9995, 13, 4706, 565, 7431, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29900, 2314, 529, 29871, 29941, 29900, 29901, 29871, 396, 470, 7431, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29900, 2314, 529, 29871, 29947, 29901, 13, 9651, 736, 376, 3664, 3307, 11916, 29892, 6858, 472, 3203, 29871, 29941, 29900, 29908, 13, 13, 4706, 396, 21981, 537, 1243, 363, 2099, 848, 13, 4706, 17117, 282, 29918, 29888, 29896, 29918, 12676, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29900, 2314, 13, 4706, 17117, 282, 29918, 29888, 29906, 29918, 12676, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29896, 2314, 13, 4706, 17117, 282, 29918, 29888, 29941, 29918, 12676, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29906, 2314, 13, 4706, 17117, 282, 29918, 29888, 29946, 29918, 12676, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29941, 2314, 13, 4706, 565, 282, 29918, 29888, 29896, 29918, 12676, 6736, 29871, 29900, 29889, 29945, 470, 282, 29918, 29888, 29906, 29918, 12676, 6736, 29871, 29900, 29889, 29945, 470, 282, 29918, 29888, 29941, 29918, 12676, 6736, 29871, 29900, 29889, 29945, 470, 282, 29918, 29888, 29946, 29918, 12676, 6736, 29871, 29900, 29889, 29945, 29901, 13, 9651, 736, 376, 689, 1934, 451, 12891, 13235, 29908, 13, 13, 4706, 1683, 29901, 13, 9651, 503, 29888, 29896, 29918, 12676, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29900, 2314, 13, 9651, 503, 29888, 29906, 29918, 12676, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29896, 2314, 13, 9651, 503, 29888, 29941, 29918, 12676, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29906, 2314, 13, 9651, 503, 29888, 29946, 29918, 12676, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 12676, 29918, 21513, 29961, 29941, 2314, 13, 9651, 282, 29888, 29918, 12676, 353, 313, 29920, 29888, 29896, 29918, 12676, 718, 503, 29888, 29906, 29918, 12676, 718, 503, 29888, 29941, 29918, 12676, 718, 503, 29888, 29946, 29918, 12676, 29897, 847, 29871, 29946, 13, 9651, 736, 282, 29888, 29918, 12676, 13, 13, 4706, 396, 4226, 537, 1243, 363, 19194, 848, 13, 4706, 17117, 282, 29918, 29888, 29896, 29918, 2168, 713, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29900, 2314, 13, 4706, 17117, 282, 29918, 29888, 29906, 29918, 2168, 713, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29896, 2314, 13, 4706, 17117, 282, 29918, 29888, 29941, 29918, 2168, 713, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29906, 2314, 13, 4706, 17117, 282, 29918, 29888, 29946, 29918, 2168, 713, 353, 22663, 29889, 8945, 1688, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29941, 2314, 13, 13, 4706, 565, 313, 13, 9651, 282, 29918, 29888, 29896, 29918, 2168, 713, 6736, 29871, 29900, 29889, 29945, 13, 9651, 470, 282, 29918, 29888, 29906, 29918, 2168, 713, 6736, 29871, 29900, 29889, 29945, 13, 9651, 470, 282, 29918, 29888, 29941, 29918, 2168, 713, 6736, 29871, 29900, 29889, 29945, 13, 9651, 470, 282, 29918, 29888, 29946, 29918, 2168, 713, 6736, 29871, 29900, 29889, 29945, 13, 308, 1125, 13, 9651, 736, 376, 689, 1934, 451, 12891, 13235, 29908, 13, 13, 4706, 1683, 29901, 13, 9651, 503, 29888, 29896, 29918, 2168, 713, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29900, 2314, 13, 9651, 503, 29888, 29906, 29918, 2168, 713, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29896, 2314, 13, 9651, 503, 29888, 29941, 29918, 2168, 713, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29906, 2314, 13, 9651, 503, 29888, 29946, 29918, 2168, 713, 353, 22663, 29889, 29920, 13628, 29898, 689, 424, 29918, 4210, 550, 29918, 21513, 29961, 29941, 2314, 13, 13, 9651, 282, 29888, 29918, 2168, 713, 353, 313, 29920, 29888, 29896, 29918, 2168, 713, 718, 503, 29888, 29906, 29918, 2168, 713, 718, 503, 29888, 29941, 29918, 2168, 713, 718, 503, 29888, 29946, 29918, 2168, 713, 29897, 847, 29871, 29946, 13, 9651, 736, 282, 29888, 29918, 2168, 713, 13, 2 ]
astar.py
jeff012345/clue-part-duo
0
7299
<reponame>jeff012345/clue-part-duo import heapq from typing import List from definitions import RoomPosition, Position import random import sys class PriorityQueue: def __init__(self): self.elements: Array = [] def empty(self) -> bool: return len(self.elements) == 0 def put(self, item, priority: float): heapq.heappush(self.elements, (priority, random.randint(1, 9999999999999999), item)) def get(self): return heapq.heappop(self.elements)[2] def heuristic(a: Position, b: Position) -> float: if a == b: return 0 if isinstance(a, RoomPosition): if isinstance(b, RoomPosition): raise Exception("Cannot calculate heuristic between two rooms") return 1 # (1^2 + 0^2) if isinstance(b, RoomPosition): return 1 # (1^2 + 0^2) # both are Space return (a.col - b.col) ** 2 + (a.row - b.row) ** 2 def a_star_search(start: Position, goal: Position) -> List[Position]: if start is None: raise Exception("Start is None") if goal is None: raise Exception("goal is None") if start == goal: raise Exception('Start and goal are the same') frontier = PriorityQueue() frontier.put(start, 0) came_from: Dict[Position, Optional[Position]] = {} cost_so_far: Dict[Position, float] = {} came_from[start] = None cost_so_far[start] = 0 while not frontier.empty(): current: Position = frontier.get() if current == goal: break for next in current.connections: if isinstance(next, RoomPosition) and next != goal: # once you enter a room, it's a dead end continue new_cost = cost_so_far[current] + 1 if next not in cost_so_far or new_cost < cost_so_far[next]: cost_so_far[next] = new_cost priority = new_cost + heuristic(goal, next) frontier.put(next, priority) came_from[next] = current if frontier.empty(): print(str(start) + " to " + str(goal)) raise Exception('no path found') shortest_path = [] prev = goal while prev is not None: shortest_path.append(prev) prev = came_from[prev] shortest_path.reverse() return shortest_path
[ 1, 529, 276, 1112, 420, 29958, 1324, 600, 29900, 29896, 29906, 29941, 29946, 29945, 29914, 695, 434, 29899, 1595, 29899, 700, 29877, 13, 5215, 16947, 29939, 13, 3166, 19229, 1053, 2391, 13, 3166, 15848, 1053, 25114, 8003, 29892, 20627, 13, 5215, 4036, 13, 5215, 10876, 13, 13, 1990, 22096, 537, 10620, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 17664, 29901, 4398, 353, 5159, 13, 268, 13, 1678, 822, 4069, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 736, 7431, 29898, 1311, 29889, 17664, 29897, 1275, 29871, 29900, 13, 268, 13, 1678, 822, 1925, 29898, 1311, 29892, 2944, 29892, 20136, 29901, 5785, 1125, 13, 4706, 16947, 29939, 29889, 354, 932, 1878, 29898, 1311, 29889, 17664, 29892, 313, 29886, 21766, 29892, 4036, 29889, 9502, 524, 29898, 29896, 29892, 29871, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 511, 2944, 876, 13, 268, 13, 1678, 822, 679, 29898, 1311, 1125, 13, 4706, 736, 16947, 29939, 29889, 354, 932, 459, 29898, 1311, 29889, 17664, 9601, 29906, 29962, 13, 13, 1753, 540, 332, 4695, 29898, 29874, 29901, 20627, 29892, 289, 29901, 20627, 29897, 1599, 5785, 29901, 13, 1678, 565, 263, 1275, 289, 29901, 13, 4706, 736, 29871, 29900, 13, 13, 1678, 565, 338, 8758, 29898, 29874, 29892, 25114, 8003, 1125, 13, 4706, 565, 338, 8758, 29898, 29890, 29892, 25114, 8003, 1125, 13, 9651, 12020, 8960, 703, 29089, 8147, 540, 332, 4695, 1546, 1023, 19600, 1159, 13, 4706, 736, 29871, 29896, 396, 313, 29896, 29985, 29906, 718, 29871, 29900, 29985, 29906, 29897, 13, 13, 1678, 565, 338, 8758, 29898, 29890, 29892, 25114, 8003, 1125, 13, 4706, 736, 29871, 29896, 396, 313, 29896, 29985, 29906, 718, 29871, 29900, 29985, 29906, 29897, 13, 13, 1678, 396, 1716, 526, 14121, 13, 1678, 736, 313, 29874, 29889, 1054, 448, 289, 29889, 1054, 29897, 3579, 29871, 29906, 718, 313, 29874, 29889, 798, 448, 289, 29889, 798, 29897, 3579, 29871, 29906, 13, 13, 1753, 263, 29918, 8508, 29918, 4478, 29898, 2962, 29901, 20627, 29892, 7306, 29901, 20627, 29897, 1599, 2391, 29961, 8003, 5387, 13, 1678, 565, 1369, 338, 6213, 29901, 29871, 13, 4706, 12020, 8960, 703, 4763, 338, 6213, 1159, 13, 13, 1678, 565, 7306, 338, 6213, 29901, 13, 4706, 12020, 8960, 703, 28111, 338, 6213, 1159, 13, 13, 1678, 565, 1369, 1275, 7306, 29901, 13, 4706, 12020, 8960, 877, 4763, 322, 7306, 526, 278, 1021, 1495, 13, 13, 1678, 4565, 631, 353, 22096, 537, 10620, 580, 13, 1678, 4565, 631, 29889, 649, 29898, 2962, 29892, 29871, 29900, 29897, 13, 13, 1678, 2996, 29918, 3166, 29901, 360, 919, 29961, 8003, 29892, 28379, 29961, 8003, 5262, 353, 6571, 13, 1678, 3438, 29918, 578, 29918, 15641, 29901, 360, 919, 29961, 8003, 29892, 5785, 29962, 353, 6571, 13, 1678, 2996, 29918, 3166, 29961, 2962, 29962, 353, 6213, 13, 1678, 3438, 29918, 578, 29918, 15641, 29961, 2962, 29962, 353, 29871, 29900, 13, 268, 13, 1678, 1550, 451, 4565, 631, 29889, 6310, 7295, 13, 4706, 1857, 29901, 20627, 353, 4565, 631, 29889, 657, 580, 13, 308, 13, 4706, 565, 1857, 1275, 7306, 29901, 13, 9651, 2867, 13, 308, 13, 4706, 363, 2446, 297, 1857, 29889, 11958, 1953, 29901, 13, 9651, 565, 338, 8758, 29898, 4622, 29892, 25114, 8003, 29897, 322, 2446, 2804, 7306, 29901, 13, 18884, 396, 2748, 366, 3896, 263, 5716, 29892, 372, 29915, 29879, 263, 7123, 1095, 13, 18884, 6773, 13, 13, 9651, 716, 29918, 18253, 353, 3438, 29918, 578, 29918, 15641, 29961, 3784, 29962, 718, 29871, 29896, 13, 13, 9651, 565, 2446, 451, 297, 3438, 29918, 578, 29918, 15641, 470, 716, 29918, 18253, 529, 3438, 29918, 578, 29918, 15641, 29961, 4622, 5387, 13, 18884, 3438, 29918, 578, 29918, 15641, 29961, 4622, 29962, 353, 716, 29918, 18253, 13, 18884, 20136, 353, 716, 29918, 18253, 718, 540, 332, 4695, 29898, 28111, 29892, 2446, 29897, 13, 18884, 4565, 631, 29889, 649, 29898, 4622, 29892, 20136, 29897, 13, 18884, 2996, 29918, 3166, 29961, 4622, 29962, 353, 1857, 13, 268, 13, 1678, 565, 4565, 631, 29889, 6310, 7295, 13, 4706, 1596, 29898, 710, 29898, 2962, 29897, 718, 376, 304, 376, 718, 851, 29898, 28111, 876, 13, 4706, 12020, 8960, 877, 1217, 2224, 1476, 1495, 13, 13, 1678, 3273, 342, 29918, 2084, 353, 5159, 13, 1678, 12379, 353, 7306, 13, 1678, 1550, 12379, 338, 451, 6213, 29901, 13, 4706, 3273, 342, 29918, 2084, 29889, 4397, 29898, 16304, 29897, 13, 4706, 12379, 353, 2996, 29918, 3166, 29961, 16304, 29962, 13, 13, 1678, 3273, 342, 29918, 2084, 29889, 24244, 580, 13, 13, 1678, 736, 3273, 342, 29918, 2084, 13, 13, 13, 13, 2 ]
registry/migrations/versions/0df25c7758bf_add_a_tsv_for_the_instance_contents.py
jbn/quilt
0
128522
<gh_stars>0 """Add a tsv for the instance contents Revision ID: <KEY> Revises: <PASSWORD> Create Date: 2018-03-13 14:49:51.719830 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '9576b2ed4073' branch_labels = None depends_on = None def upgrade(): op.add_column('instance', sa.Column('keywords_tsv', postgresql.TSVECTOR(), nullable=True)) op.create_index('idx_keywords_tsv', 'instance', ['keywords_tsv'], unique=False, postgresql_using='gin') def downgrade(): op.drop_index('idx_keywords_tsv', table_name='instance') op.drop_column('instance', 'keywords_tsv')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 2528, 263, 260, 4501, 363, 278, 2777, 8118, 13, 13, 1123, 4924, 3553, 29901, 529, 10818, 29958, 13, 1123, 1730, 267, 29901, 529, 25711, 17013, 29958, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29896, 29947, 29899, 29900, 29941, 29899, 29896, 29941, 29871, 29896, 29946, 29901, 29946, 29929, 29901, 29945, 29896, 29889, 29955, 29896, 29929, 29947, 29941, 29900, 13, 13, 15945, 29908, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 13, 3166, 4576, 284, 305, 6764, 29889, 15321, 781, 29879, 1053, 27035, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 12801, 10818, 16299, 13, 3204, 29918, 276, 4924, 353, 525, 29929, 29945, 29955, 29953, 29890, 29906, 287, 29946, 29900, 29955, 29941, 29915, 13, 17519, 29918, 21134, 353, 6213, 13, 2716, 1975, 29918, 265, 353, 6213, 13, 13, 13, 1753, 14955, 7295, 13, 1678, 1015, 29889, 1202, 29918, 4914, 877, 8758, 742, 872, 29889, 4409, 877, 1989, 9303, 29918, 1372, 29894, 742, 27035, 29889, 29911, 7597, 13845, 1955, 3285, 1870, 519, 29922, 5574, 876, 13, 1678, 1015, 29889, 3258, 29918, 2248, 877, 13140, 29918, 1989, 9303, 29918, 1372, 29894, 742, 525, 8758, 742, 6024, 1989, 9303, 29918, 1372, 29894, 7464, 5412, 29922, 8824, 29892, 27035, 29918, 4746, 2433, 5359, 1495, 13, 13, 13, 1753, 1623, 8228, 7295, 13, 1678, 1015, 29889, 8865, 29918, 2248, 877, 13140, 29918, 1989, 9303, 29918, 1372, 29894, 742, 1591, 29918, 978, 2433, 8758, 1495, 13, 1678, 1015, 29889, 8865, 29918, 4914, 877, 8758, 742, 525, 1989, 9303, 29918, 1372, 29894, 1495, 13, 2 ]