max_stars_repo_path
stringlengths
4
237
max_stars_repo_name
stringlengths
6
117
max_stars_count
int64
0
95.2k
id
stringlengths
1
7
content
stringlengths
12
593k
input_ids
sequencelengths
7
549k
chexpert/ema.py
PJansson/Chexpert
0
198403
<reponame>PJansson/Chexpert # Credits: https://github.com/Alibaba-MIIL/ASL from copy import deepcopy import torch from torch import nn class ModelEMA(nn.Module): def __init__(self, model, decay=0.9995, device=None): super().__init__() self.module = deepcopy(model) self.module.eval() self.decay = decay self.device = device if self.device is not None: self.module.to(device=device) def _update(self, model, update_fn): with torch.no_grad(): for ema_v, model_v in zip( self.module.state_dict().values(), model.state_dict().values() ): if self.device is not None: model_v = model_v.to(device=self.device) ema_v.copy_(update_fn(ema_v, model_v)) def update(self, model): self._update( model, update_fn=lambda e, m: self.decay * e + (1.0 - self.decay) * m ) def set(self, model): self._update(model, update_fn=lambda e, m: m)
[ 1, 529, 276, 1112, 420, 29958, 29925, 29967, 550, 1100, 29914, 29907, 20970, 10700, 13, 29937, 24596, 1169, 29901, 2045, 597, 3292, 29889, 510, 29914, 29909, 1982, 5363, 29899, 29924, 2687, 29931, 29914, 3289, 29931, 13, 13, 3166, 3509, 1053, 6483, 8552, 13, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 1053, 302, 29876, 13, 13, 13, 1990, 8125, 26862, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1904, 29892, 20228, 29922, 29900, 29889, 29929, 29929, 29929, 29945, 29892, 4742, 29922, 8516, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 5453, 353, 6483, 8552, 29898, 4299, 29897, 13, 4706, 1583, 29889, 5453, 29889, 14513, 580, 13, 4706, 1583, 29889, 7099, 388, 353, 20228, 13, 4706, 1583, 29889, 10141, 353, 4742, 13, 4706, 565, 1583, 29889, 10141, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 5453, 29889, 517, 29898, 10141, 29922, 10141, 29897, 13, 13, 1678, 822, 903, 5504, 29898, 1311, 29892, 1904, 29892, 2767, 29918, 9144, 1125, 13, 4706, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 9651, 363, 321, 655, 29918, 29894, 29892, 1904, 29918, 29894, 297, 14319, 29898, 13, 18884, 1583, 29889, 5453, 29889, 3859, 29918, 8977, 2141, 5975, 3285, 1904, 29889, 3859, 29918, 8977, 2141, 5975, 580, 13, 632, 1125, 13, 18884, 565, 1583, 29889, 10141, 338, 451, 6213, 29901, 13, 462, 1678, 1904, 29918, 29894, 353, 1904, 29918, 29894, 29889, 517, 29898, 10141, 29922, 1311, 29889, 10141, 29897, 13, 18884, 321, 655, 29918, 29894, 29889, 8552, 23538, 5504, 29918, 9144, 29898, 2603, 29918, 29894, 29892, 1904, 29918, 29894, 876, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 1904, 1125, 13, 4706, 1583, 3032, 5504, 29898, 13, 9651, 1904, 29892, 2767, 29918, 9144, 29922, 2892, 321, 29892, 286, 29901, 1583, 29889, 7099, 388, 334, 321, 718, 313, 29896, 29889, 29900, 448, 1583, 29889, 7099, 388, 29897, 334, 286, 13, 4706, 1723, 13, 13, 1678, 822, 731, 29898, 1311, 29892, 1904, 1125, 13, 4706, 1583, 3032, 5504, 29898, 4299, 29892, 2767, 29918, 9144, 29922, 2892, 321, 29892, 286, 29901, 286, 29897, 13, 2 ]
custom_components/kweather_air365/__init__.py
KuddLim/KWeatherAir365
0
99408
<filename>custom_components/kweather_air365/__init__.py """KWeather Air365 Sensor"""
[ 1, 529, 9507, 29958, 6341, 29918, 14036, 29914, 29895, 705, 1624, 29918, 1466, 29941, 29953, 29945, 29914, 1649, 2344, 26914, 2272, 13, 15945, 29908, 29968, 4806, 1624, 5593, 29941, 29953, 29945, 317, 6073, 15945, 29908, 2 ]
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings/base.py
drgarcia1986/cookiecutter-muffin
3
28346
import os STATIC_FOLDERS = ( '{{cookiecutter.repo_name}}/common/static', '{{cookiecutter.repo_name}}/users/static', ) # Muffin Plugins PLUGINS = ( 'muffin_jinja2', 'muffin_peewee', 'muffin_session', ) # Plugins configurations SESSION_SECRET = 'SecretHere' SESSION_LOGIN_URL = '/users/signin/' JINJA2_TEMPLATE_FOLDERS = ( '{{cookiecutter.repo_name}}/common/templates', '{{cookiecutter.repo_name}}/public/templates', '{{cookiecutter.repo_name}}/users/templates' ) PEEWEE_CONNECTION = os.environ.get('DATABASE_URL', 'sqlite:///{{cookiecutter.repo_name}}.sqlite')
[ 1, 1053, 2897, 13, 13, 17816, 2965, 29918, 29943, 5607, 8032, 29903, 353, 313, 13, 1678, 525, 6224, 15108, 21199, 6463, 29889, 20095, 29918, 978, 930, 29914, 9435, 29914, 7959, 742, 13, 1678, 525, 6224, 15108, 21199, 6463, 29889, 20095, 29918, 978, 930, 29914, 7193, 29914, 7959, 742, 13, 29897, 13, 13, 29937, 341, 3096, 262, 1858, 8385, 13, 7390, 23338, 1177, 29903, 353, 313, 13, 1678, 525, 2589, 600, 262, 29918, 28789, 1764, 29906, 742, 13, 1678, 525, 2589, 600, 262, 29918, 412, 29872, 705, 29872, 742, 13, 1678, 525, 2589, 600, 262, 29918, 7924, 742, 13, 29897, 13, 13, 13, 29937, 1858, 8385, 22920, 13, 17493, 29918, 1660, 22245, 29911, 353, 525, 28459, 10605, 29915, 13, 17493, 29918, 14480, 1177, 29918, 4219, 353, 8207, 7193, 29914, 4530, 262, 22208, 13, 13, 29967, 1177, 29967, 29909, 29906, 29918, 4330, 3580, 29931, 3040, 29918, 29943, 5607, 8032, 29903, 353, 313, 13, 1678, 525, 6224, 15108, 21199, 6463, 29889, 20095, 29918, 978, 930, 29914, 9435, 29914, 20943, 742, 13, 1678, 525, 6224, 15108, 21199, 6463, 29889, 20095, 29918, 978, 930, 29914, 3597, 29914, 20943, 742, 13, 1678, 525, 6224, 15108, 21199, 6463, 29889, 20095, 29918, 978, 930, 29914, 7193, 29914, 20943, 29915, 13, 29897, 13, 13, 4162, 29923, 8851, 29923, 29918, 6007, 8186, 9838, 353, 2897, 29889, 21813, 29889, 657, 877, 25832, 27982, 29918, 4219, 742, 525, 22793, 597, 29914, 6224, 15108, 21199, 6463, 29889, 20095, 29918, 978, 27243, 22793, 1495, 13, 2 ]
tracker.py
AImotion-Autonomous-Vehicles/AirSimTracking
0
47263
from .coordinates import Coordinates from typing import List import csv import pandas as pd class Tracker: @staticmethod def load(csv_path: str): airsim_results = pd.read_csv(csv_path, encoding='utf-8') tracker = Tracker() for index, row in airsim_results.iterrows(): coordinates = Coordinates(row['x'], row['y']) tracker.update_coordinates(coordinates) return tracker _initial_coordinates: Coordinates _coordinates: List[Coordinates] def __init__(self, initial_coordinates: Coordinates = Coordinates(0.0,0.0)) -> None: self._initial_coordinates = initial_coordinates self._coordinates = [Coordinates(0.0,0.0)] def update_coordinates(self, coordinates: Coordinates) -> None: coordinates.x -= self._initial_coordinates.x coordinates.y -= self._initial_coordinates.y if coordinates == self.__get_last_coordinates(): return self._coordinates.append(coordinates) def __get_last_coordinates(self): return self._coordinates[len(self._coordinates)-1] def get_coordinates(self) -> List[Coordinates]: return self._coordinates def save_coordinates(self, path: str) -> None: with open(path,'w') as csv_file: fieldnames = ['x', 'y', 'timestamp'] writer = csv.DictWriter(csv_file, fieldnames=fieldnames, lineterminator = '\n') writer.writeheader() for coordinate in self._coordinates: writer.writerow({ 'x': str(coordinate.x), 'y': str(coordinate.y), 'timestamp': str(coordinate.timestamp) })
[ 1, 515, 869, 1111, 24266, 1053, 3189, 24266, 13, 3166, 19229, 1053, 2391, 13, 5215, 11799, 13, 5215, 11701, 408, 10518, 13, 13, 1990, 3201, 4937, 29901, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2254, 29898, 7638, 29918, 2084, 29901, 851, 1125, 13, 4706, 4799, 3601, 29918, 9902, 353, 10518, 29889, 949, 29918, 7638, 29898, 7638, 29918, 2084, 29892, 8025, 2433, 9420, 29899, 29947, 1495, 13, 13, 4706, 1020, 4937, 353, 3201, 4937, 580, 13, 4706, 363, 2380, 29892, 1948, 297, 4799, 3601, 29918, 9902, 29889, 1524, 5727, 7295, 13, 9651, 10350, 353, 3189, 24266, 29898, 798, 1839, 29916, 7464, 1948, 1839, 29891, 11287, 13, 9651, 1020, 4937, 29889, 5504, 29918, 1111, 24266, 29898, 1111, 24266, 29897, 13, 13, 4706, 736, 1020, 4937, 13, 13, 1678, 903, 11228, 29918, 1111, 24266, 29901, 3189, 24266, 13, 1678, 903, 1111, 24266, 29901, 2391, 29961, 7967, 24266, 29962, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2847, 29918, 1111, 24266, 29901, 3189, 24266, 353, 3189, 24266, 29898, 29900, 29889, 29900, 29892, 29900, 29889, 29900, 876, 1599, 6213, 29901, 13, 4706, 1583, 3032, 11228, 29918, 1111, 24266, 353, 2847, 29918, 1111, 24266, 13, 4706, 1583, 3032, 1111, 24266, 353, 518, 7967, 24266, 29898, 29900, 29889, 29900, 29892, 29900, 29889, 29900, 4638, 13, 13, 1678, 822, 2767, 29918, 1111, 24266, 29898, 1311, 29892, 10350, 29901, 3189, 24266, 29897, 1599, 6213, 29901, 13, 4706, 10350, 29889, 29916, 22361, 1583, 3032, 11228, 29918, 1111, 24266, 29889, 29916, 13, 4706, 10350, 29889, 29891, 22361, 1583, 3032, 11228, 29918, 1111, 24266, 29889, 29891, 13, 13, 4706, 565, 10350, 1275, 1583, 17255, 657, 29918, 4230, 29918, 1111, 24266, 7295, 13, 9651, 736, 13, 13, 4706, 1583, 3032, 1111, 24266, 29889, 4397, 29898, 1111, 24266, 29897, 13, 13, 1678, 822, 4770, 657, 29918, 4230, 29918, 1111, 24266, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1111, 24266, 29961, 2435, 29898, 1311, 3032, 1111, 24266, 6817, 29896, 29962, 13, 13, 1678, 822, 679, 29918, 1111, 24266, 29898, 1311, 29897, 1599, 2391, 29961, 7967, 24266, 5387, 13, 4706, 736, 1583, 3032, 1111, 24266, 13, 13, 1678, 822, 4078, 29918, 1111, 24266, 29898, 1311, 29892, 2224, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 411, 1722, 29898, 2084, 5501, 29893, 1495, 408, 11799, 29918, 1445, 29901, 13, 9651, 1746, 7039, 353, 6024, 29916, 742, 525, 29891, 742, 525, 16394, 2033, 13, 9651, 9227, 353, 11799, 29889, 21533, 10507, 29898, 7638, 29918, 1445, 29892, 1746, 7039, 29922, 2671, 7039, 29892, 6276, 300, 837, 262, 1061, 353, 11297, 29876, 1495, 13, 9651, 9227, 29889, 3539, 6672, 580, 13, 13, 9651, 363, 14821, 297, 1583, 3032, 1111, 24266, 29901, 13, 18884, 9227, 29889, 13236, 340, 3319, 13, 462, 1678, 525, 29916, 2396, 851, 29898, 29302, 29889, 29916, 511, 13, 462, 1678, 525, 29891, 2396, 851, 29898, 29302, 29889, 29891, 511, 13, 462, 1678, 525, 16394, 2396, 851, 29898, 29302, 29889, 16394, 29897, 13, 18884, 5615, 13, 2 ]
MCTS.py
alexandre-lavoie/MCTS
0
179405
import random from typing import Generic, TypeVar State = TypeVar('State') Action = TypeVar('Action') class Monte_Carlo_Tree(Generic[State]): class Node(Generic[State, Action]): def __init__(self, state: State, action: Action=None, parent=None): self.score = 0 self.state = state self.action = action self.parent = parent self.children = [] def update(self, result): self.score += result def __str__(self): return self.__repr__() def __repr__(self): return str(self.state) + str(self.action) + str(self.score) def __init__(self, init_state: State, player: object, simulate_step: lambda state, player, state_constraints: (Node, int), init_action: Action=None): self.root = Monte_Carlo_Tree.Node(init_state, init_action) self.player = player self.simulate_step = simulate_step def update(self, state: State): """ Updates tree to current state. If the state already exist, simply change root else create new node. """ for child in self.root.children: if child.state == state: self.root = child break else: self.root = Monte_Carlo_Tree.Node(state) def search(self, node: Node=None): """ Searches tree using Monte Carlo Tree Search. """ if node == None: node = self.root for _ in range(100): next_node, next_state = self.expand(self.select(node)) node.children.append(next_node) next_node.parent = node if next_state == 0: last_node, last_state = self.simulate(next_node) self.backpropagate(last_node, last_state) def current_state(self) -> State: """ Returns the current state of the tree. """ return self.root.state def best_action(self) -> Action: """ Returns the next best action from the root node and updates the root node. """ self.search() node = self.best_node() self.root = node return node.action def best_node(self, node: Node=None) -> Node: """ Returns the best child node relative to current node. """ if node == None: node = self.root if len(node.children) == 0: return node else: return max(node.children, key=lambda child: child.score) def select(self, node: Node=None) -> Node: """ Selects the next best node to expand on the tree. """ if node == None: node = self.root if len(node.children) == 0: return node return self.select(node.children[0]) def expand(self, node: Node=None) -> (Node, int): """ Expands a node considering current node child constraints. """ if node == None: node = self.root next_state = self.simulate_step(node.state, self.player, [child.state for child in node.children]) return next_state def simulate(self, node: Node=None) -> (Node, int): """ Simulates current node using simulate_step until completion. Returns final node. """ if node == None: node = self.root next_node, state = self.simulate_step(node.state, self.player) next_node.parent = node node.children.append(next_node) if state == 0: return self.simulate(next_node) else: return (next_node, state) def backpropagate(self, node: Node, result = None): """ Backpropagates the result from the current node to the parent nodes. """ if node != None: if result == None: result = node.score else: node.update(result) self.backpropagate(node.parent, result)
[ 1, 1053, 4036, 13, 3166, 19229, 1053, 3251, 293, 29892, 5167, 9037, 13, 13, 2792, 353, 5167, 9037, 877, 2792, 1495, 13, 4276, 353, 5167, 9037, 877, 4276, 1495, 13, 13, 1990, 11240, 29918, 8179, 417, 29918, 9643, 29898, 15809, 29961, 2792, 29962, 1125, 13, 1678, 770, 9071, 29898, 15809, 29961, 2792, 29892, 9123, 29962, 1125, 13, 4706, 822, 4770, 2344, 12035, 1311, 29892, 2106, 29901, 4306, 29892, 3158, 29901, 9123, 29922, 8516, 29892, 3847, 29922, 8516, 1125, 13, 9651, 1583, 29889, 13628, 353, 29871, 29900, 13, 9651, 1583, 29889, 3859, 353, 2106, 13, 9651, 1583, 29889, 2467, 353, 3158, 13, 9651, 1583, 29889, 3560, 353, 3847, 13, 9651, 1583, 29889, 11991, 353, 5159, 13, 308, 13, 4706, 822, 2767, 29898, 1311, 29892, 1121, 1125, 13, 9651, 1583, 29889, 13628, 4619, 1121, 13, 308, 13, 4706, 822, 4770, 710, 12035, 1311, 1125, 13, 9651, 736, 1583, 17255, 276, 558, 1649, 580, 13, 13, 4706, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 9651, 736, 851, 29898, 1311, 29889, 3859, 29897, 718, 851, 29898, 1311, 29889, 2467, 29897, 718, 851, 29898, 1311, 29889, 13628, 29897, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2069, 29918, 3859, 29901, 4306, 29892, 4847, 29901, 1203, 29892, 29611, 29918, 10568, 29901, 14013, 2106, 29892, 4847, 29892, 2106, 29918, 13646, 29879, 29901, 313, 4247, 29892, 938, 511, 2069, 29918, 2467, 29901, 9123, 29922, 8516, 1125, 13, 4706, 1583, 29889, 4632, 353, 11240, 29918, 8179, 417, 29918, 9643, 29889, 4247, 29898, 2344, 29918, 3859, 29892, 2069, 29918, 2467, 29897, 13, 4706, 1583, 29889, 9106, 353, 4847, 13, 4706, 1583, 29889, 3601, 5987, 29918, 10568, 353, 29611, 29918, 10568, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 2106, 29901, 4306, 1125, 13, 4706, 9995, 5020, 15190, 5447, 304, 1857, 2106, 29889, 960, 278, 2106, 2307, 1863, 29892, 3763, 1735, 3876, 1683, 1653, 716, 2943, 29889, 9995, 13, 13, 4706, 363, 2278, 297, 1583, 29889, 4632, 29889, 11991, 29901, 13, 9651, 565, 2278, 29889, 3859, 1275, 2106, 29901, 13, 18884, 1583, 29889, 4632, 353, 2278, 13, 18884, 2867, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 4632, 353, 11240, 29918, 8179, 417, 29918, 9643, 29889, 4247, 29898, 3859, 29897, 13, 13, 1678, 822, 2740, 29898, 1311, 29892, 2943, 29901, 9071, 29922, 8516, 1125, 13, 4706, 9995, 11856, 267, 5447, 773, 11240, 15021, 15472, 11856, 29889, 9995, 13, 13, 4706, 565, 2943, 1275, 6213, 29901, 13, 9651, 2943, 353, 1583, 29889, 4632, 13, 13, 4706, 363, 903, 297, 3464, 29898, 29896, 29900, 29900, 1125, 13, 9651, 2446, 29918, 3177, 29892, 2446, 29918, 3859, 353, 1583, 29889, 18837, 29898, 1311, 29889, 2622, 29898, 3177, 876, 29871, 13, 13, 9651, 2943, 29889, 11991, 29889, 4397, 29898, 4622, 29918, 3177, 29897, 13, 9651, 2446, 29918, 3177, 29889, 3560, 353, 2943, 13, 13, 9651, 565, 2446, 29918, 3859, 1275, 29871, 29900, 29901, 13, 18884, 1833, 29918, 3177, 29892, 1833, 29918, 3859, 353, 1583, 29889, 3601, 5987, 29898, 4622, 29918, 3177, 29897, 13, 18884, 1583, 29889, 1627, 7728, 351, 403, 29898, 4230, 29918, 3177, 29892, 1833, 29918, 3859, 29897, 13, 268, 13, 1678, 822, 1857, 29918, 3859, 29898, 1311, 29897, 1599, 4306, 29901, 13, 4706, 9995, 16969, 278, 1857, 2106, 310, 278, 5447, 29889, 9995, 13, 4706, 736, 1583, 29889, 4632, 29889, 3859, 13, 13, 1678, 822, 1900, 29918, 2467, 29898, 1311, 29897, 1599, 9123, 29901, 13, 4706, 9995, 16969, 278, 2446, 1900, 3158, 515, 278, 3876, 2943, 322, 11217, 278, 3876, 2943, 29889, 9995, 13, 13, 4706, 1583, 29889, 4478, 580, 13, 4706, 2943, 353, 1583, 29889, 13318, 29918, 3177, 580, 13, 13, 4706, 1583, 29889, 4632, 353, 2943, 13, 13, 4706, 736, 2943, 29889, 2467, 13, 13, 1678, 822, 1900, 29918, 3177, 29898, 1311, 29892, 2943, 29901, 9071, 29922, 8516, 29897, 1599, 9071, 29901, 13, 4706, 9995, 16969, 278, 1900, 2278, 2943, 6198, 304, 1857, 2943, 29889, 9995, 13, 13, 4706, 565, 2943, 1275, 6213, 29901, 13, 9651, 2943, 353, 1583, 29889, 4632, 13, 13, 4706, 565, 7431, 29898, 3177, 29889, 11991, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 2943, 13, 4706, 1683, 29901, 13, 9651, 736, 4236, 29898, 3177, 29889, 11991, 29892, 1820, 29922, 2892, 2278, 29901, 2278, 29889, 13628, 29897, 13, 13, 1678, 822, 1831, 29898, 1311, 29892, 2943, 29901, 9071, 29922, 8516, 29897, 1599, 9071, 29901, 13, 4706, 9995, 7605, 29879, 278, 2446, 1900, 2943, 304, 7985, 373, 278, 5447, 29889, 9995, 13, 13, 4706, 565, 2943, 1275, 6213, 29901, 13, 9651, 2943, 353, 1583, 29889, 4632, 13, 13, 4706, 565, 7431, 29898, 3177, 29889, 11991, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 2943, 13, 308, 13, 4706, 736, 1583, 29889, 2622, 29898, 3177, 29889, 11991, 29961, 29900, 2314, 13, 308, 13, 1678, 822, 7985, 29898, 1311, 29892, 2943, 29901, 9071, 29922, 8516, 29897, 1599, 313, 4247, 29892, 938, 1125, 13, 4706, 9995, 12027, 4167, 263, 2943, 13858, 1857, 2943, 2278, 11938, 29889, 9995, 13, 13, 4706, 565, 2943, 1275, 6213, 29901, 13, 9651, 2943, 353, 1583, 29889, 4632, 13, 13, 4706, 2446, 29918, 3859, 353, 1583, 29889, 3601, 5987, 29918, 10568, 29898, 3177, 29889, 3859, 29892, 1583, 29889, 9106, 29892, 518, 5145, 29889, 3859, 363, 2278, 297, 2943, 29889, 11991, 2314, 13, 13, 4706, 736, 2446, 29918, 3859, 13, 13, 1678, 822, 29611, 29898, 1311, 29892, 2943, 29901, 9071, 29922, 8516, 29897, 1599, 313, 4247, 29892, 938, 1125, 13, 4706, 9995, 3439, 352, 1078, 1857, 2943, 773, 29611, 29918, 10568, 2745, 13285, 29889, 16969, 2186, 2943, 29889, 9995, 13, 13, 4706, 565, 2943, 1275, 6213, 29901, 13, 9651, 2943, 353, 1583, 29889, 4632, 13, 308, 13, 4706, 2446, 29918, 3177, 29892, 2106, 353, 1583, 29889, 3601, 5987, 29918, 10568, 29898, 3177, 29889, 3859, 29892, 1583, 29889, 9106, 29897, 13, 13, 4706, 2446, 29918, 3177, 29889, 3560, 353, 2943, 13, 13, 4706, 2943, 29889, 11991, 29889, 4397, 29898, 4622, 29918, 3177, 29897, 13, 13, 4706, 565, 2106, 1275, 29871, 29900, 29901, 13, 9651, 736, 1583, 29889, 3601, 5987, 29898, 4622, 29918, 3177, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 313, 4622, 29918, 3177, 29892, 2106, 29897, 13, 268, 13, 1678, 822, 1250, 7728, 351, 403, 29898, 1311, 29892, 2943, 29901, 9071, 29892, 1121, 353, 6213, 1125, 13, 4706, 9995, 7437, 7728, 351, 1078, 278, 1121, 515, 278, 1857, 2943, 304, 278, 3847, 7573, 29889, 29871, 9995, 13, 13, 4706, 565, 2943, 2804, 6213, 29901, 13, 9651, 565, 1121, 1275, 6213, 29901, 13, 18884, 1121, 353, 2943, 29889, 13628, 13, 9651, 1683, 29901, 13, 18884, 2943, 29889, 5504, 29898, 2914, 29897, 13, 13, 9651, 1583, 29889, 1627, 7728, 351, 403, 29898, 3177, 29889, 3560, 29892, 1121, 29897, 2 ]
U8-optics.py
mahnooranjum/Clustering_MachineLearning
0
67578
<gh_stars>0 ############################################################################## # <NAME> # References: # Official Documentation ############################################################################## # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset # iloc gets data via numerical indexes # .values converts from python dataframe to numpy object dataset = pd.read_csv('Moons.csv') X = dataset.iloc[0:1000, 1:3].values y = dataset.iloc[0:1000, 3].values plt.scatter(X[:,0], X[:,1]) plt.show() from sklearn.cluster import OPTICS model = OPTICS(min_cluster_size = 0.3) y_pred = model.fit_predict(X) # Visualising the clusters clusters = np.unique(y_pred) for cluster in clusters: # get row indexes for samples with this cluster row_idx = np.where(y_pred == cluster) plt.scatter(X[row_idx, 0], X[row_idx, 1]) plt.show()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 1678, 529, 5813, 29958, 13, 29937, 1678, 28318, 29901, 13, 29937, 4706, 10564, 10854, 362, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 16032, 292, 278, 9562, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 11701, 408, 10518, 13, 13, 29937, 16032, 292, 278, 8783, 13, 29937, 980, 542, 4947, 848, 3025, 16259, 18111, 13, 29937, 869, 5975, 29436, 515, 3017, 12205, 304, 12655, 1203, 13, 24713, 353, 10518, 29889, 949, 29918, 7638, 877, 22638, 787, 29889, 7638, 1495, 13, 29990, 353, 8783, 29889, 309, 542, 29961, 29900, 29901, 29896, 29900, 29900, 29900, 29892, 29871, 29896, 29901, 29941, 1822, 5975, 13, 29891, 353, 8783, 29889, 309, 542, 29961, 29900, 29901, 29896, 29900, 29900, 29900, 29892, 29871, 29941, 1822, 5975, 13, 572, 29873, 29889, 1557, 2620, 29898, 29990, 7503, 29892, 29900, 1402, 1060, 7503, 29892, 29896, 2314, 13, 572, 29873, 29889, 4294, 580, 13, 13, 3166, 2071, 19668, 29889, 19594, 1053, 6418, 29911, 2965, 29903, 13, 4299, 353, 6418, 29911, 2965, 29903, 29898, 1195, 29918, 19594, 29918, 2311, 353, 29871, 29900, 29889, 29941, 29897, 13, 29891, 29918, 11965, 353, 1904, 29889, 9202, 29918, 27711, 29898, 29990, 29897, 13, 29937, 9249, 5921, 278, 24554, 13, 695, 504, 414, 353, 7442, 29889, 13092, 29898, 29891, 29918, 11965, 29897, 13, 1454, 9867, 297, 24554, 29901, 13, 12, 29937, 679, 1948, 18111, 363, 11916, 411, 445, 9867, 13, 12, 798, 29918, 13140, 353, 7442, 29889, 3062, 29898, 29891, 29918, 11965, 1275, 9867, 29897, 13, 12, 572, 29873, 29889, 1557, 2620, 29898, 29990, 29961, 798, 29918, 13140, 29892, 29871, 29900, 1402, 1060, 29961, 798, 29918, 13140, 29892, 29871, 29896, 2314, 13, 13, 572, 29873, 29889, 4294, 580, 13, 13, 2 ]
tests/test_temporary_package.py
Thom1729/package_util
0
52961
from unittest import TestCase from sublime_lib import ResourcePath from package_util import TemporaryPackage class TestTemporaryPackage(TestCase): def test_temporary_package_name(self): expected_resource_path = ResourcePath('Packages/TemporaryPackageTest') expected_file_path = expected_resource_path.file_path() name = 'TemporaryPackageTest' with TemporaryPackage(name) as path: self.assertEquals(path.name, name) self.assertEquals(path, expected_resource_path) self.assertTrue(expected_file_path.is_dir()) self.assertFalse(expected_file_path.exists()) def test_temporary_package_prefix_suffix(self): prefix = 'TemporaryPackage' suffix = 'Test' with TemporaryPackage(prefix=prefix, suffix=suffix) as path: self.assertTrue(path.name.startswith(prefix)) self.assertTrue(path.name.endswith(suffix)) def test_temporary_package_arguments_error(self): with self.assertRaises(ValueError): TemporaryPackage('TemporaryPackageTest', prefix='foo') with self.assertRaises(ValueError): TemporaryPackage('TemporaryPackageTest', suffix='foo') def test_temporary_package_exclusive(self): with TemporaryPackage('TemporaryPackageTest'): with self.assertRaises(FileExistsError): with TemporaryPackage('TemporaryPackageTest'): pass
[ 1, 515, 443, 27958, 1053, 4321, 8259, 13, 13, 3166, 1014, 28046, 29918, 1982, 1053, 18981, 2605, 13, 3166, 3577, 29918, 4422, 1053, 6789, 1971, 653, 14459, 13, 13, 13, 1990, 4321, 5776, 1971, 653, 14459, 29898, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 1356, 1971, 653, 29918, 5113, 29918, 978, 29898, 1311, 1125, 13, 4706, 3806, 29918, 10314, 29918, 2084, 353, 18981, 2605, 877, 16638, 1179, 29914, 5776, 1971, 653, 14459, 3057, 1495, 13, 4706, 3806, 29918, 1445, 29918, 2084, 353, 3806, 29918, 10314, 29918, 2084, 29889, 1445, 29918, 2084, 580, 13, 13, 4706, 1024, 353, 525, 5776, 1971, 653, 14459, 3057, 29915, 13, 4706, 411, 6789, 1971, 653, 14459, 29898, 978, 29897, 408, 2224, 29901, 13, 9651, 1583, 29889, 9294, 14776, 29898, 2084, 29889, 978, 29892, 1024, 29897, 13, 9651, 1583, 29889, 9294, 14776, 29898, 2084, 29892, 3806, 29918, 10314, 29918, 2084, 29897, 13, 9651, 1583, 29889, 9294, 5574, 29898, 9684, 29918, 1445, 29918, 2084, 29889, 275, 29918, 3972, 3101, 13, 13, 4706, 1583, 29889, 9294, 8824, 29898, 9684, 29918, 1445, 29918, 2084, 29889, 9933, 3101, 13, 13, 1678, 822, 1243, 29918, 1356, 1971, 653, 29918, 5113, 29918, 13506, 29918, 2146, 600, 861, 29898, 1311, 1125, 13, 4706, 10944, 353, 525, 5776, 1971, 653, 14459, 29915, 13, 4706, 25557, 353, 525, 3057, 29915, 13, 4706, 411, 6789, 1971, 653, 14459, 29898, 13506, 29922, 13506, 29892, 25557, 29922, 2146, 600, 861, 29897, 408, 2224, 29901, 13, 9651, 1583, 29889, 9294, 5574, 29898, 2084, 29889, 978, 29889, 27382, 2541, 29898, 13506, 876, 13, 9651, 1583, 29889, 9294, 5574, 29898, 2084, 29889, 978, 29889, 1975, 2541, 29898, 2146, 600, 861, 876, 13, 13, 1678, 822, 1243, 29918, 1356, 1971, 653, 29918, 5113, 29918, 25699, 29918, 2704, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 6789, 1971, 653, 14459, 877, 5776, 1971, 653, 14459, 3057, 742, 10944, 2433, 5431, 1495, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 6789, 1971, 653, 14459, 877, 5776, 1971, 653, 14459, 3057, 742, 25557, 2433, 5431, 1495, 13, 13, 1678, 822, 1243, 29918, 1356, 1971, 653, 29918, 5113, 29918, 735, 7009, 573, 29898, 1311, 1125, 13, 4706, 411, 6789, 1971, 653, 14459, 877, 5776, 1971, 653, 14459, 3057, 29374, 13, 9651, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2283, 24217, 2392, 1125, 13, 18884, 411, 6789, 1971, 653, 14459, 877, 5776, 1971, 653, 14459, 3057, 29374, 13, 462, 1678, 1209, 13, 2 ]
tests/common.py
joshuagl/in-toto
1
130245
#!/usr/bin/env python """ <Program Name> common.py <Author> <NAME> <<EMAIL>> <Started> Feb 6, 2018 <Copyright> See LICENSE for licensing information. <Purpose> Common code for in-toto unittests, import like so: `import tests.common` Tests importing this module, should be run from the project root, e.g.: `python tests/test_in_toto_run.py` or using the aggregator script (preferred way): `python tests/runtests.py`. """ import os import sys import inspect import unittest if sys.version_info >= (3, 3): from unittest.mock import patch # pylint: disable=no-name-in-module,import-error else: from mock import patch # pylint: disable=import-error def run_with_portable_scripts(decorated): print("patching...") scripts_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "scripts") print("scripts are located in {}".format(scripts_path)) @patch.dict(os.environ, {"PATH": "{};{}".format(scripts_path, os.environ['PATH'])}) class Patched(decorated): pass return Patched class CliTestCase(unittest.TestCase): """TestCase subclass providing a test helper that patches sys.argv with passed arguments and asserts a SystemExit with a return code equal to the passed status argument. Subclasses of CliTestCase require a class variable that stores the main function of the cli tool to test as staticmethod, e.g.: ``` import tests.common from in_toto.in_toto_run import main as in_toto_run_main class TestInTotoRunTool(tests.common.CliTestCase): cli_main_func = staticmethod(in_toto_run_main) ... ``` """ cli_main_func = None def __init__(self, *args, **kwargs): """Constructor that checks for the presence of a callable cli_main_func class variable. And stores the filename of the module containing that function, to be used as first argument when patching sys.argv in self.assert_cli_sys_exit. """ if not callable(self.cli_main_func): raise Exception("Subclasses of `CliTestCase` need to assign the main" " function of the cli tool to test using `staticmethod()`: {}" .format(self.__class__.__name__)) file_path = inspect.getmodule(self.cli_main_func).__file__ self.file_name = os.path.basename(file_path) super(CliTestCase, self).__init__(*args, **kwargs) def assert_cli_sys_exit(self, cli_args, status): """Test helper to mock command line call and assert return value. The passed args does not need to contain the command line tool's name. This is assessed from `self.cli_main_func` """ with patch.object(sys, "argv", [self.file_name] + cli_args), self.assertRaises(SystemExit) as raise_ctx: self.cli_main_func() # pylint: disable=not-callable self.assertEqual(raise_ctx.exception.code, status)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 29966, 9283, 4408, 29958, 13, 29871, 3619, 29889, 2272, 13, 13, 29966, 13720, 29958, 13, 29871, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 13, 29966, 4763, 287, 29958, 13, 29871, 26319, 29871, 29953, 29892, 29871, 29906, 29900, 29896, 29947, 13, 13, 29966, 11882, 1266, 29958, 13, 29871, 2823, 365, 2965, 1430, 1660, 363, 7794, 575, 292, 2472, 29889, 13, 13, 29966, 29925, 332, 4220, 29958, 13, 29871, 13103, 775, 363, 297, 29899, 29873, 3747, 443, 986, 9197, 29892, 1053, 763, 577, 29901, 13, 29871, 421, 5215, 6987, 29889, 9435, 29952, 13, 13, 29871, 4321, 29879, 28348, 445, 3883, 29892, 881, 367, 1065, 515, 278, 2060, 3876, 29892, 321, 29889, 29887, 4898, 13, 29871, 421, 4691, 6987, 29914, 1688, 29918, 262, 29918, 29873, 3747, 29918, 3389, 29889, 2272, 29952, 13, 29871, 470, 773, 278, 11404, 1061, 2471, 313, 1457, 14373, 982, 1125, 13, 29871, 421, 4691, 6987, 29914, 29878, 1657, 9197, 29889, 2272, 1412, 13, 13, 15945, 29908, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 16096, 13, 13, 5215, 443, 27958, 13, 361, 10876, 29889, 3259, 29918, 3888, 6736, 313, 29941, 29892, 29871, 29941, 1125, 13, 29871, 515, 443, 27958, 29889, 17640, 1053, 13261, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 978, 29899, 262, 29899, 5453, 29892, 5215, 29899, 2704, 13, 2870, 29901, 13, 29871, 515, 11187, 1053, 13261, 396, 282, 2904, 524, 29901, 11262, 29922, 5215, 29899, 2704, 13, 13, 13, 1753, 1065, 29918, 2541, 29918, 637, 519, 29918, 16713, 29898, 19557, 630, 1125, 13, 13, 29871, 1596, 703, 5041, 292, 856, 1159, 13, 29871, 12078, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 8243, 376, 16713, 1159, 13, 29871, 1596, 703, 16713, 526, 5982, 297, 6571, 1642, 4830, 29898, 16713, 29918, 2084, 876, 13, 29871, 732, 5041, 29889, 8977, 29898, 359, 29889, 21813, 29892, 8853, 10145, 1115, 29850, 3400, 8875, 1642, 4830, 29898, 16713, 29918, 2084, 29892, 2897, 29889, 21813, 1839, 10145, 11287, 1800, 13, 29871, 770, 349, 905, 287, 29898, 19557, 630, 1125, 13, 1678, 1209, 13, 13, 29871, 736, 349, 905, 287, 13, 13, 13, 13, 1990, 315, 492, 3057, 8259, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 29871, 9995, 3057, 8259, 19481, 13138, 263, 1243, 16876, 393, 13261, 267, 10876, 29889, 19218, 411, 13, 29871, 4502, 6273, 322, 408, 643, 1372, 263, 2184, 24365, 411, 263, 736, 775, 5186, 13, 29871, 304, 278, 4502, 4660, 2980, 29889, 13, 13, 29871, 3323, 13203, 310, 315, 492, 3057, 8259, 1996, 263, 770, 2286, 393, 14422, 278, 1667, 13, 29871, 740, 310, 278, 9335, 5780, 304, 1243, 408, 2294, 5696, 29892, 321, 29889, 29887, 4898, 13, 13, 29871, 7521, 13, 29871, 1053, 6987, 29889, 9435, 13, 29871, 515, 297, 29918, 29873, 3747, 29889, 262, 29918, 29873, 3747, 29918, 3389, 1053, 1667, 408, 297, 29918, 29873, 3747, 29918, 3389, 29918, 3396, 13, 13, 29871, 770, 4321, 797, 29911, 3747, 6558, 12229, 29898, 21150, 29889, 9435, 29889, 29907, 492, 3057, 8259, 1125, 13, 1678, 9335, 29918, 3396, 29918, 9891, 353, 2294, 5696, 29898, 262, 29918, 29873, 3747, 29918, 3389, 29918, 3396, 29897, 13, 1678, 2023, 13, 13, 29871, 7521, 13, 29871, 9995, 13, 29871, 9335, 29918, 3396, 29918, 9891, 353, 6213, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 9995, 23770, 393, 12747, 363, 278, 10122, 310, 263, 1246, 519, 9335, 29918, 3396, 29918, 9891, 13, 1678, 770, 2286, 29889, 1126, 14422, 278, 10422, 310, 278, 3883, 6943, 393, 13, 1678, 740, 29892, 304, 367, 1304, 408, 937, 2980, 746, 13261, 292, 10876, 29889, 19218, 297, 13, 1678, 1583, 29889, 9294, 29918, 11303, 29918, 9675, 29918, 13322, 29889, 13, 1678, 9995, 13, 1678, 565, 451, 1246, 519, 29898, 1311, 29889, 11303, 29918, 3396, 29918, 9891, 1125, 13, 418, 12020, 8960, 703, 4035, 13203, 310, 421, 29907, 492, 3057, 8259, 29952, 817, 304, 3566, 278, 1667, 29908, 13, 3986, 376, 740, 310, 278, 9335, 5780, 304, 1243, 773, 421, 7959, 5696, 2555, 29901, 426, 5038, 13, 3986, 869, 4830, 29898, 1311, 17255, 1990, 1649, 17255, 978, 1649, 876, 13, 13, 1678, 934, 29918, 2084, 353, 16096, 29889, 657, 5453, 29898, 1311, 29889, 11303, 29918, 3396, 29918, 9891, 467, 1649, 1445, 1649, 13, 1678, 1583, 29889, 1445, 29918, 978, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 1445, 29918, 2084, 29897, 13, 13, 1678, 2428, 29898, 29907, 492, 3057, 8259, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 13, 29871, 822, 4974, 29918, 11303, 29918, 9675, 29918, 13322, 29898, 1311, 29892, 9335, 29918, 5085, 29892, 4660, 1125, 13, 1678, 9995, 3057, 16876, 304, 11187, 1899, 1196, 1246, 322, 4974, 736, 995, 29889, 13, 1678, 450, 4502, 6389, 947, 451, 817, 304, 1712, 278, 1899, 1196, 5780, 29915, 29879, 1024, 29889, 13, 1678, 910, 338, 1223, 11517, 515, 29871, 421, 1311, 29889, 11303, 29918, 3396, 29918, 9891, 29952, 13, 1678, 9995, 13, 1678, 411, 13261, 29889, 3318, 29898, 9675, 29892, 376, 19218, 613, 518, 1311, 29889, 1445, 29918, 978, 29962, 13, 4706, 718, 9335, 29918, 5085, 511, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 29897, 408, 12020, 29918, 13073, 29901, 13, 418, 1583, 29889, 11303, 29918, 3396, 29918, 9891, 580, 396, 282, 2904, 524, 29901, 11262, 29922, 1333, 29899, 4804, 519, 13, 13, 1678, 1583, 29889, 9294, 9843, 29898, 22692, 29918, 13073, 29889, 11739, 29889, 401, 29892, 4660, 29897, 13, 2 ]
brownies/LANL/toACE/energyAngular.py
brown170/fudge
14
1605028
# <<BEGIN-copyright>> # Copyright 2021, Lawrence Livermore National Security, LLC. # See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: BSD-3-Clause # <<END-copyright>> """ This module adds the method toACE to the classes in the fudge.productData.distributions.energyAngularMC module. """ from xData import standards as standardsModule from fudge.productData.distributions import energyAngularMC as energyAngularMCModule def toACE( self, label, offset, weight, **kwargs ) : header = [ 0, 61, offset + len( weight ) + 4 ] + weight energyData = self.energy.data energyAngularData = self.energyAngular.data INTE = -1 interpolation = energyData.interpolation if( interpolation == standardsModule.interpolation.flatToken ) : INTE = 1 elif( interpolation == standardsModule.interpolation.linlinToken ) : INTE = 2 if( INTE == -1 ) : raise Exception( 'Interpolation "%s" not supported for incident energy' % interpolation ) if( energyData.interpolationQualifier == standardsModule.interpolation.unitBaseToken ) : INTE += 20 INTT = -1 interpolation = energyData[0].interpolation if( interpolation == standardsModule.interpolation.flatToken ) : INTT = 1 elif( interpolation == standardsModule.interpolation.linlinToken ) : INTT = 2 if( INTT == -1 ) : raise Exception( 'Interpolation "%s" not supported for outgoing energy' % interpolation ) NE = len( energyData ) e_ins = [] Ls = [] EpData = [] offset += len( header ) + 3 + 1 + 2 * NE + 1 # header length plus NR, NE, Es, Ls, (1-based). for i1, _EpData in enumerate( energyData ) : e_ins.append( _EpData.outerDomainValue ) Ls.append( offset + len( EpData ) ) LCs = [] muPData = [] NP = len( _EpData ) offset_LC = Ls[-1] + 1 + 4 * NP + 1 for i2, _muData in enumerate( energyAngularData[i1] ) : LCs.append( offset_LC ) mus = _muData.xs.values.values interpolation = { standardsModule.interpolation.flatToken : 1, standardsModule.interpolation.linlinToken : 2 }[_muData.interpolation] muData = [ interpolation, len( mus ) ] + mus + _muData.pdf.values.values + _muData.cdf.values.values offset_LC += len( muData ) muPData += muData EpData += [ INTT, NP ] + _EpData.xs.values.values + _EpData.pdf.values.values + _EpData.cdf.values.values + LCs + muPData return( header + [ 1, NE, INTE, NE ] + e_ins + Ls + EpData ) energyAngularMCModule.form.toACE = toACE
[ 1, 396, 3532, 29933, 17958, 29899, 8552, 1266, 6778, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 29892, 19520, 22469, 5514, 3086, 14223, 29892, 365, 12182, 29889, 13, 29937, 2823, 278, 2246, 29899, 5563, 315, 4590, 29979, 22789, 3912, 934, 363, 4902, 29889, 13, 29937, 29871, 13, 29937, 10937, 29928, 29990, 29899, 29931, 293, 1947, 29899, 12889, 29901, 350, 7230, 29899, 29941, 29899, 20216, 1509, 13, 29937, 3532, 11794, 29899, 8552, 1266, 6778, 13, 13, 15945, 29908, 13, 4013, 3883, 12778, 278, 1158, 304, 11538, 304, 278, 4413, 297, 278, 285, 566, 479, 29889, 4704, 1469, 29889, 27691, 29879, 29889, 27548, 9928, 1070, 12513, 3883, 29889, 13, 15945, 29908, 13, 13, 3166, 921, 1469, 1053, 20801, 408, 20801, 7355, 13, 13, 3166, 285, 566, 479, 29889, 4704, 1469, 29889, 27691, 29879, 1053, 5864, 9928, 1070, 12513, 408, 5864, 9928, 1070, 12513, 7355, 13, 13, 1753, 304, 11538, 29898, 1583, 29892, 3858, 29892, 9210, 29892, 7688, 29892, 3579, 19290, 1723, 584, 13, 13, 1678, 4839, 353, 518, 29871, 29900, 29892, 29871, 29953, 29896, 29892, 9210, 718, 7431, 29898, 7688, 1723, 718, 29871, 29946, 4514, 718, 7688, 13, 13, 1678, 5864, 1469, 353, 1583, 29889, 27548, 29889, 1272, 13, 1678, 5864, 9928, 1070, 1469, 353, 1583, 29889, 27548, 9928, 1070, 29889, 1272, 13, 13, 1678, 2672, 4330, 353, 448, 29896, 13, 1678, 29694, 353, 5864, 1469, 29889, 1639, 3733, 362, 13, 1678, 565, 29898, 29694, 1275, 20801, 7355, 29889, 1639, 3733, 362, 29889, 20620, 6066, 1723, 584, 13, 4706, 2672, 4330, 353, 29871, 29896, 13, 1678, 25342, 29898, 29694, 1275, 20801, 7355, 29889, 1639, 3733, 362, 29889, 1915, 1915, 6066, 1723, 584, 13, 4706, 2672, 4330, 353, 29871, 29906, 13, 1678, 565, 29898, 2672, 4330, 1275, 448, 29896, 1723, 584, 12020, 8960, 29898, 525, 4074, 3733, 362, 11860, 29879, 29908, 451, 6969, 363, 15134, 5864, 29915, 1273, 29694, 1723, 13, 1678, 565, 29898, 5864, 1469, 29889, 1639, 3733, 362, 24399, 3709, 1275, 20801, 7355, 29889, 1639, 3733, 362, 29889, 5441, 5160, 6066, 1723, 584, 2672, 4330, 4619, 29871, 29906, 29900, 13, 13, 1678, 19578, 29911, 353, 448, 29896, 13, 1678, 29694, 353, 5864, 1469, 29961, 29900, 1822, 1639, 3733, 362, 13, 1678, 565, 29898, 29694, 1275, 20801, 7355, 29889, 1639, 3733, 362, 29889, 20620, 6066, 1723, 584, 13, 4706, 19578, 29911, 353, 29871, 29896, 13, 1678, 25342, 29898, 29694, 1275, 20801, 7355, 29889, 1639, 3733, 362, 29889, 1915, 1915, 6066, 1723, 584, 13, 4706, 19578, 29911, 353, 29871, 29906, 13, 1678, 565, 29898, 19578, 29911, 1275, 448, 29896, 1723, 584, 12020, 8960, 29898, 525, 4074, 3733, 362, 11860, 29879, 29908, 451, 6969, 363, 714, 17696, 5864, 29915, 1273, 29694, 1723, 13, 13, 1678, 14693, 353, 7431, 29898, 5864, 1469, 1723, 13, 1678, 321, 29918, 1144, 353, 5159, 13, 1678, 365, 29879, 353, 5159, 13, 1678, 14055, 1469, 353, 5159, 13, 1678, 9210, 4619, 7431, 29898, 4839, 1723, 718, 29871, 29941, 718, 29871, 29896, 718, 29871, 29906, 334, 14693, 718, 29871, 29896, 4706, 396, 4839, 3309, 2298, 27759, 29892, 14693, 29892, 3423, 29892, 365, 29879, 29892, 313, 29896, 29899, 6707, 467, 13, 1678, 363, 474, 29896, 29892, 903, 29923, 29886, 1469, 297, 26985, 29898, 5864, 1469, 1723, 584, 13, 4706, 321, 29918, 1144, 29889, 4397, 29898, 903, 29923, 29886, 1469, 29889, 5561, 15951, 1917, 29871, 1723, 13, 4706, 365, 29879, 29889, 4397, 29898, 9210, 718, 7431, 29898, 14055, 1469, 1723, 1723, 13, 13, 4706, 365, 29907, 29879, 353, 5159, 13, 4706, 3887, 29925, 1469, 353, 5159, 13, 4706, 405, 29925, 353, 7431, 29898, 903, 29923, 29886, 1469, 1723, 13, 4706, 9210, 29918, 12182, 353, 365, 29879, 14352, 29896, 29962, 718, 29871, 29896, 718, 29871, 29946, 334, 405, 29925, 718, 29871, 29896, 13, 4706, 363, 474, 29906, 29892, 903, 2589, 1469, 297, 26985, 29898, 5864, 9928, 1070, 1469, 29961, 29875, 29896, 29962, 1723, 584, 13, 9651, 365, 29907, 29879, 29889, 4397, 29898, 9210, 29918, 12182, 1723, 13, 9651, 2301, 353, 903, 2589, 1469, 29889, 10351, 29889, 5975, 29889, 5975, 13, 9651, 29694, 353, 426, 20801, 7355, 29889, 1639, 3733, 362, 29889, 20620, 6066, 584, 29871, 29896, 29892, 20801, 7355, 29889, 1639, 3733, 362, 29889, 1915, 1915, 6066, 584, 29871, 29906, 500, 28513, 2589, 1469, 29889, 1639, 3733, 362, 29962, 13, 9651, 3887, 1469, 353, 518, 29694, 29892, 7431, 29898, 2301, 1723, 4514, 718, 2301, 718, 903, 2589, 1469, 29889, 5140, 29889, 5975, 29889, 5975, 718, 903, 2589, 1469, 29889, 29883, 2176, 29889, 5975, 29889, 5975, 13, 9651, 9210, 29918, 12182, 4619, 7431, 29898, 3887, 1469, 1723, 13, 9651, 3887, 29925, 1469, 4619, 3887, 1469, 13, 4706, 14055, 1469, 4619, 518, 19578, 29911, 29892, 405, 29925, 4514, 718, 903, 29923, 29886, 1469, 29889, 10351, 29889, 5975, 29889, 5975, 718, 903, 29923, 29886, 1469, 29889, 5140, 29889, 5975, 29889, 5975, 718, 903, 29923, 29886, 1469, 29889, 29883, 2176, 29889, 5975, 29889, 5975, 718, 365, 29907, 29879, 718, 3887, 29925, 1469, 13, 13, 1678, 736, 29898, 4839, 718, 518, 29871, 29896, 29892, 14693, 29892, 2672, 4330, 29892, 14693, 4514, 718, 321, 29918, 1144, 718, 365, 29879, 718, 14055, 1469, 1723, 13, 13, 27548, 9928, 1070, 12513, 7355, 29889, 689, 29889, 517, 11538, 353, 304, 11538, 13, 2 ]
chat/user.py
gdw439/python
1
97341
<gh_stars>1-10 import sys import time import socket import pymysql import threading import PyQt5.QtCore import PyQt5.QtGui from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * #addr = ('172.16.17.32', 3300) addr = ('127.0.0.1', 3300) class Login(QDialog): # 登录窗口 def __init__(self): super().__init__() self.setFixedSize(420, 240) self.setWindowFlags(Qt.FramelessWindowHint) palette1 = QPalette() palette1.setBrush(self.backgroundRole(), QBrush(QPixmap('login.png'))) self.setPalette(palette1) self.headlab = QLabel(self) self.nameldt = QLineEdit(self) self.keysldt = QLineEdit(self) self.logbtn = QPushButton('登录', self) self.regbtn = QPushButton('注册', self) self.headlab.setPixmap(QPixmap('logo.png')) # 排列控件 self.headlab.move(130, 50) self.logbtn.move(105, 200) self.regbtn.move(245, 200) self.nameldt.move(105, 120) self.keysldt.move(105, 160) self.logbtn.setFixedSize(70, 27) self.regbtn.setFixedSize(70, 27) self.nameldt.setFixedSize(210, 27) self.keysldt.setFixedSize(210, 27) self.nameldt.setPlaceholderText('你的昵称') self.keysldt.setPlaceholderText('你的密码') self.keysldt.setEchoMode(QLineEdit.Password) self.show() # 登录数据检查 def formatcheck(self): name = self.nameldt.text() keyword = self.keysldt.text() if name == '': print('请输入用户名') return False elif keyword == '': print('请输入密码') return False else: return True def mousePressEvent(self, event): self.last = event.globalPos() def mouseMoveEvent(self, event): dot = event.globalPos() dx = dot.x() - self.last.x() dy = dot.y() - self.last.y() self.last = dot self.move(self.x() + dx, self.y() + dy) def mouseReleaseEvent(self, event): dot = event.globalPos() dx = dot.x() - self.last.x() dy = dot.y() - self.last.y() self.move(self.x() + dx, self.y() + dy) class Box(QWidget): # 构建窗口 row = 0 listnum = {} def __init__(self): super().__init__() self.BoxInit() def flushmessage(self): word = self.oute.text() self.oute.clear() # 显示在信息主面板 self.inte.setAlignment(Qt.AlignRight) self.inte.setTextColor(Qt.gray) self.inte.insertPlainText(':我\n') self.inte.setTextColor(Qt.blue) self.inte.insertPlainText(word + ' ' * 4 + '\n') def showmessage(self, name, mess): # ? 光标问题处理 self.inte.setAlignment(Qt.AlignLeft) self.inte.setTextColor(Qt.gray) self.inte.insertPlainText(name + ':\n') self.inte.setTextColor(Qt.red) self.inte.insertPlainText(' ' * 4 + mess + '\n') def flushlist(self, namelist): for name in namelist: self.listnum[name] = self.row self.row += 1 self.lit.addItems(namelist) def addlist(self, name): self.lit.addItem(name) self.listnum[name] = self.row self.row += 1 def sublist(self, name): self.lit.takeItem(self.listnum[name]) self.listnum.pop(name) self.row -= 1 def BoxInit(self): self.resize(500, 300) self.setFixedSize(self.width(), self.height()) self.setWindowTitle('Vortex') self.sendbtn = QPushButton() self.sendbtn.setText('发送') self.lab = QLabel() self.lab.setText('在线好友') self.lit = QListWidget() self.lit.setFixedSize(100, 250) self.inte = QTextEdit() self.oute = QLineEdit() grid = QGridLayout() grid.addWidget(self.lab, 0, 0, 1, 1) grid.addWidget(self.lit, 1, 0, 9, 1) grid.addWidget(self.inte, 1, 1, 8, 2) grid.addWidget(self.oute, 9, 1, 1, 1) grid.addWidget(self.sendbtn, 9, 2, 1, 1) self.setLayout(grid) qr = self.frameGeometry() cp = QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) self.move(qr.topLeft()) class Chat: myname = '' user_list = [] def __init__(self): self.box = Box() self.login = Login() self.login.logbtn.clicked.connect(self.loginemit) self.login.regbtn.clicked.connect(self.registeremit) self.sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) t = threading.Thread(target=self.hostlink) t.start() # 连接服务器 def hostlink(self): self.login.logbtn.setDisabled(True) self.login.regbtn.setDisabled(True) while True: try: self.sk.connect(addr) break except: time.sleep(1) print('再次尝试连接') print("已连接服务器") self.login.logbtn.setDisabled(False) self.login.regbtn.setDisabled(False) def hostchat(self): while True: data = self.sk.recv(1024).decode('utf-8') # 删除好友列表 if data.find('$$DEL:') != -1: name = data.split(':')[1] self.box.sublist(name) # 添加好友列表 elif data.find('$$ADD:') != -1: name = data.split(':')[1] self.box.addlist(name) # 接收好友信息 else: time.sleep(0.5) name = data.split('$')[1] mess = data.split('$')[2] self.box.showmessage(name, mess) # 执行登录命令 def loginemit(self): if self.login.formatcheck(): name = self.login.nameldt.text() keyword = self.login.keysldt.text() if self.loginhost(name, keyword) == True: print('登录成功') self.myname = name self.login.close() self.box.show() self.box.sendbtn.clicked.connect(self.emitmessage) self.box.flushlist(self.user_list) else: print('输入格式错误') # 执行注册命令 def registeremit(self): if self.login.formatcheck(): name = self.login.nameldt.text() keyword = self.login.keysldt.text() if self.registeruser(name, keyword) == True: self.myname = name print('登录成功') self.login.close() self.box.show() self.box.sendbtn.clicked.connect(self.emitmessage) self.box.flushlist(self.user_list) else: print('输入格式错误') # 执行发送命令 def emitmessage(self): word = self.box.oute.text() self.box.flushmessage() name = self.box.lit.currentItem().text() if name != None: data = name + '$' + self.myname + '$' + word self.sk.send(data.encode('utf-8')) # 登录服务器时发送数据 def loginhost(self, name, keyword): data = '$$INFO,' + name + ',' + keyword + ',' + 'Login' self.sk.send(data.encode('utf-8')) try: data = self.sk.recv(1024).decode('utf-8') if data == '$$USERAT': print('存在用户冲突') return False elif data == '$$UNREG': print('该用户未注册') return False elif data == '$$KEYERR': print('密码不匹配') return False elif data == '$$LIST': print('正在接收名单') while True: data = self.sk.recv(1024).decode('utf-8') if data == '$$END': print('接收完毕') t = threading.Thread(target=self.hostchat) t.start() return True break print(data) self.user_list.append(data) else: print('无意义数据') except: print('回应异常') return False # 注册时发送给服务器 def registeruser(self, name, keyword): data = '$$INFO,' + name + ',' + keyword + ',' + 'Regis' self.sk.send(data.encode('utf-8')) try: data = self.sk.recv(1024).decode('utf-8') if data == '$$USERAT': print('注册失败') return False elif data == '$$LIST': print('正在接收名单') while True: data = self.sk.recv(1024).decode('utf-8') if data == '$$END': print('接收完毕') return True break print(data) self.user_list.append(data) except: print('等待回应异常') return False # 主函数 if __name__ == '__main__': app = QApplication(sys.argv) m = Chat() sys.exit(app.exec_())
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 10876, 30004, 13, 5215, 931, 30004, 13, 5215, 9909, 30004, 13, 5215, 282, 962, 952, 1519, 30004, 13, 5215, 3244, 292, 30004, 13, 5215, 10772, 17303, 29945, 29889, 17303, 9203, 30004, 13, 5215, 10772, 17303, 29945, 29889, 17303, 28707, 30004, 13, 3166, 10772, 17303, 29945, 29889, 17303, 28707, 1053, 334, 30004, 13, 3166, 10772, 17303, 29945, 29889, 17303, 9203, 1053, 334, 30004, 13, 3166, 10772, 17303, 29945, 29889, 17303, 8801, 29879, 1053, 334, 30004, 13, 30004, 13, 29937, 10030, 353, 6702, 29896, 29955, 29906, 29889, 29896, 29953, 29889, 29896, 29955, 29889, 29941, 29906, 742, 29871, 29941, 29941, 29900, 29900, 8443, 13, 10030, 353, 6702, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 29871, 29941, 29941, 29900, 29900, 8443, 13, 30004, 13, 30004, 13, 1990, 19130, 29898, 29984, 7647, 1125, 30004, 13, 1678, 396, 29871, 31451, 31283, 234, 173, 154, 30856, 30004, 13, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 30004, 13, 4706, 2428, 2141, 1649, 2344, 1649, 26471, 13, 4706, 1583, 29889, 842, 26262, 3505, 29898, 29946, 29906, 29900, 29892, 29871, 29906, 29946, 29900, 8443, 13, 4706, 1583, 29889, 842, 5907, 15675, 29898, 17303, 29889, 29943, 2572, 6393, 5907, 28016, 8443, 13, 4706, 282, 26456, 29896, 353, 660, 29925, 26456, 26471, 13, 4706, 282, 26456, 29896, 29889, 842, 27680, 29898, 1311, 29889, 7042, 16727, 3285, 660, 27680, 29898, 29984, 29925, 861, 1958, 877, 7507, 29889, 2732, 29915, 4961, 30004, 13, 4706, 1583, 29889, 842, 29925, 26456, 29898, 29886, 26456, 29896, 8443, 13, 30004, 13, 4706, 1583, 29889, 2813, 8205, 353, 660, 4775, 29898, 1311, 8443, 13, 4706, 1583, 29889, 8588, 2495, 29873, 353, 660, 3542, 6103, 29898, 1311, 8443, 13, 4706, 1583, 29889, 8149, 430, 29873, 353, 660, 3542, 6103, 29898, 1311, 8443, 13, 4706, 1583, 29889, 1188, 7290, 353, 660, 27031, 3125, 877, 31451, 31283, 742, 1583, 8443, 13, 4706, 1583, 29889, 1727, 7290, 353, 660, 27031, 3125, 877, 31368, 232, 137, 143, 742, 1583, 8443, 13, 4706, 1583, 29889, 2813, 8205, 29889, 842, 29925, 861, 1958, 29898, 29984, 29925, 861, 1958, 877, 14569, 29889, 2732, 8785, 30004, 13, 30004, 13, 4706, 396, 29871, 233, 145, 149, 31025, 31617, 30631, 30004, 13, 4706, 1583, 29889, 2813, 8205, 29889, 11631, 29898, 29896, 29941, 29900, 29892, 29871, 29945, 29900, 8443, 13, 4706, 1583, 29889, 1188, 7290, 29889, 11631, 29898, 29896, 29900, 29945, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 1727, 7290, 29889, 11631, 29898, 29906, 29946, 29945, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 8588, 2495, 29873, 29889, 11631, 29898, 29896, 29900, 29945, 29892, 29871, 29896, 29906, 29900, 8443, 13, 4706, 1583, 29889, 8149, 430, 29873, 29889, 11631, 29898, 29896, 29900, 29945, 29892, 29871, 29896, 29953, 29900, 8443, 13, 4706, 1583, 29889, 1188, 7290, 29889, 842, 26262, 3505, 29898, 29955, 29900, 29892, 29871, 29906, 29955, 8443, 13, 4706, 1583, 29889, 1727, 7290, 29889, 842, 26262, 3505, 29898, 29955, 29900, 29892, 29871, 29906, 29955, 8443, 13, 4706, 1583, 29889, 8588, 2495, 29873, 29889, 842, 26262, 3505, 29898, 29906, 29896, 29900, 29892, 29871, 29906, 29955, 8443, 13, 4706, 1583, 29889, 8149, 430, 29873, 29889, 842, 26262, 3505, 29898, 29906, 29896, 29900, 29892, 29871, 29906, 29955, 8443, 13, 30004, 13, 4706, 1583, 29889, 8588, 2495, 29873, 29889, 842, 22150, 7694, 1626, 877, 30919, 30210, 233, 155, 184, 31685, 1495, 30004, 13, 4706, 1583, 29889, 8149, 430, 29873, 29889, 842, 22150, 7694, 1626, 877, 30919, 30210, 31461, 31183, 1495, 30004, 13, 4706, 1583, 29889, 8149, 430, 29873, 29889, 842, 29923, 1859, 6818, 29898, 2239, 457, 6103, 29889, 10048, 8443, 13, 4706, 1583, 29889, 4294, 26471, 13, 30004, 13, 1678, 396, 29871, 31451, 31283, 30354, 30763, 233, 166, 131, 31213, 30004, 13, 1678, 822, 883, 905, 29872, 384, 29898, 1311, 1125, 30004, 13, 4706, 1024, 353, 1583, 29889, 8588, 2495, 29873, 29889, 726, 26471, 13, 4706, 13553, 353, 1583, 29889, 8149, 430, 29873, 29889, 726, 26471, 13, 4706, 565, 1024, 1275, 525, 2396, 30004, 13, 9651, 1596, 877, 31088, 31573, 30752, 30406, 31229, 30548, 1495, 30004, 13, 9651, 736, 7700, 30004, 13, 4706, 25342, 13553, 1275, 525, 2396, 30004, 13, 9651, 1596, 877, 31088, 31573, 30752, 31461, 31183, 1495, 30004, 13, 9651, 736, 7700, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 736, 5852, 30004, 13, 30004, 13, 1678, 822, 9495, 10923, 2624, 29898, 1311, 29892, 1741, 1125, 30004, 13, 4706, 1583, 29889, 4230, 353, 1741, 29889, 10945, 9135, 26471, 13, 30004, 13, 1678, 822, 9495, 16619, 2624, 29898, 1311, 29892, 1741, 1125, 30004, 13, 4706, 8329, 353, 1741, 29889, 10945, 9135, 26471, 13, 4706, 15414, 353, 8329, 29889, 29916, 580, 448, 1583, 29889, 4230, 29889, 29916, 26471, 13, 4706, 13475, 353, 8329, 29889, 29891, 580, 448, 1583, 29889, 4230, 29889, 29891, 26471, 13, 4706, 1583, 29889, 4230, 353, 8329, 30004, 13, 4706, 1583, 29889, 11631, 29898, 1311, 29889, 29916, 580, 718, 15414, 29892, 1583, 29889, 29891, 580, 718, 13475, 8443, 13, 30004, 13, 1678, 822, 9495, 19729, 2624, 29898, 1311, 29892, 1741, 1125, 30004, 13, 4706, 8329, 353, 1741, 29889, 10945, 9135, 26471, 13, 4706, 15414, 353, 8329, 29889, 29916, 580, 448, 1583, 29889, 4230, 29889, 29916, 26471, 13, 4706, 13475, 353, 8329, 29889, 29891, 580, 448, 1583, 29889, 4230, 29889, 29891, 26471, 13, 4706, 1583, 29889, 11631, 29898, 1311, 29889, 29916, 580, 718, 15414, 29892, 1583, 29889, 29891, 580, 718, 13475, 8443, 13, 30004, 13, 30004, 13, 1990, 11773, 29898, 29984, 8801, 1125, 30004, 13, 1678, 396, 29871, 31901, 30886, 234, 173, 154, 30856, 30004, 13, 1678, 1948, 353, 29871, 29900, 30004, 13, 1678, 1051, 1949, 353, 6571, 30004, 13, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 30004, 13, 4706, 2428, 2141, 1649, 2344, 1649, 26471, 13, 4706, 1583, 29889, 3313, 6644, 26471, 13, 30004, 13, 1678, 822, 28371, 4906, 29898, 1311, 1125, 30004, 13, 4706, 1734, 353, 1583, 29889, 2663, 29889, 726, 26471, 13, 4706, 1583, 29889, 2663, 29889, 8551, 26471, 13, 4706, 396, 29871, 31542, 30858, 30505, 30689, 31021, 30888, 30806, 233, 160, 194, 30004, 13, 4706, 1583, 29889, 6693, 29889, 842, 14658, 29898, 17303, 29889, 2499, 647, 7341, 8443, 13, 4706, 1583, 29889, 6693, 29889, 12038, 3306, 29898, 17303, 29889, 21012, 8443, 13, 4706, 1583, 29889, 6693, 29889, 7851, 29925, 7420, 1626, 877, 29901, 30672, 29905, 29876, 1495, 30004, 13, 4706, 1583, 29889, 6693, 29889, 12038, 3306, 29898, 17303, 29889, 9539, 8443, 13, 4706, 1583, 29889, 6693, 29889, 7851, 29925, 7420, 1626, 29898, 1742, 718, 525, 525, 334, 29871, 29946, 718, 11297, 29876, 1495, 30004, 13, 30004, 13, 1678, 822, 1510, 4906, 29898, 1311, 29892, 1024, 29892, 4473, 1125, 30004, 13, 4706, 396, 1577, 29871, 30867, 31062, 31658, 31596, 31548, 30687, 30004, 13, 4706, 1583, 29889, 6693, 29889, 842, 14658, 29898, 17303, 29889, 2499, 647, 8091, 8443, 13, 4706, 1583, 29889, 6693, 29889, 12038, 3306, 29898, 17303, 29889, 21012, 8443, 13, 4706, 1583, 29889, 6693, 29889, 7851, 29925, 7420, 1626, 29898, 978, 718, 525, 3583, 29876, 1495, 30004, 13, 4706, 1583, 29889, 6693, 29889, 12038, 3306, 29898, 17303, 29889, 1127, 8443, 13, 4706, 1583, 29889, 6693, 29889, 7851, 29925, 7420, 1626, 877, 525, 334, 29871, 29946, 718, 4473, 718, 11297, 29876, 1495, 30004, 13, 30004, 13, 1678, 822, 28371, 1761, 29898, 1311, 29892, 6869, 295, 391, 1125, 30004, 13, 4706, 363, 1024, 297, 6869, 295, 391, 29901, 30004, 13, 9651, 1583, 29889, 1761, 1949, 29961, 978, 29962, 353, 1583, 29889, 798, 30004, 13, 9651, 1583, 29889, 798, 4619, 29871, 29896, 30004, 13, 4706, 1583, 29889, 19411, 29889, 1202, 6913, 29898, 8588, 295, 391, 8443, 13, 30004, 13, 1678, 822, 788, 1761, 29898, 1311, 29892, 1024, 1125, 30004, 13, 4706, 1583, 29889, 19411, 29889, 1202, 2001, 29898, 978, 8443, 13, 4706, 1583, 29889, 1761, 1949, 29961, 978, 29962, 353, 1583, 29889, 798, 30004, 13, 4706, 1583, 29889, 798, 4619, 29871, 29896, 30004, 13, 30004, 13, 1678, 822, 1014, 1761, 29898, 1311, 29892, 1024, 1125, 30004, 13, 4706, 1583, 29889, 19411, 29889, 19730, 2001, 29898, 1311, 29889, 1761, 1949, 29961, 978, 2314, 30004, 13, 4706, 1583, 29889, 1761, 1949, 29889, 7323, 29898, 978, 8443, 13, 4706, 1583, 29889, 798, 22361, 29871, 29896, 30004, 13, 30004, 13, 1678, 822, 11773, 6644, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 21476, 29898, 29945, 29900, 29900, 29892, 29871, 29941, 29900, 29900, 8443, 13, 4706, 1583, 29889, 842, 26262, 3505, 29898, 1311, 29889, 2103, 3285, 1583, 29889, 3545, 3101, 30004, 13, 4706, 1583, 29889, 842, 5907, 7030, 877, 14147, 4776, 1495, 30004, 13, 30004, 13, 4706, 1583, 29889, 6717, 7290, 353, 660, 27031, 3125, 26471, 13, 4706, 1583, 29889, 6717, 7290, 29889, 12038, 877, 30910, 31545, 1495, 30004, 13, 4706, 1583, 29889, 8205, 353, 660, 4775, 26471, 13, 4706, 1583, 29889, 8205, 29889, 12038, 877, 30505, 31532, 31076, 31373, 1495, 30004, 13, 4706, 1583, 29889, 19411, 353, 660, 1293, 8801, 26471, 13, 4706, 1583, 29889, 19411, 29889, 842, 26262, 3505, 29898, 29896, 29900, 29900, 29892, 29871, 29906, 29945, 29900, 8443, 13, 4706, 1583, 29889, 6693, 353, 660, 1626, 6103, 26471, 13, 4706, 1583, 29889, 2663, 353, 660, 3542, 6103, 26471, 13, 4706, 6856, 353, 660, 5756, 3453, 26471, 13, 30004, 13, 4706, 6856, 29889, 1202, 8801, 29898, 1311, 29889, 8205, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 8443, 13, 4706, 6856, 29889, 1202, 8801, 29898, 1311, 29889, 19411, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29929, 29892, 29871, 29896, 8443, 13, 4706, 6856, 29889, 1202, 8801, 29898, 1311, 29889, 6693, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29947, 29892, 29871, 29906, 8443, 13, 4706, 6856, 29889, 1202, 8801, 29898, 1311, 29889, 2663, 29892, 29871, 29929, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 8443, 13, 4706, 6856, 29889, 1202, 8801, 29898, 1311, 29889, 6717, 7290, 29892, 29871, 29929, 29892, 29871, 29906, 29892, 29871, 29896, 29892, 29871, 29896, 8443, 13, 4706, 1583, 29889, 842, 3453, 29898, 7720, 8443, 13, 30004, 13, 4706, 3855, 29878, 353, 1583, 29889, 2557, 7999, 7843, 26471, 13, 4706, 21447, 353, 660, 17600, 8801, 2141, 16515, 7999, 7843, 2141, 5064, 26471, 13, 4706, 3855, 29878, 29889, 11631, 13409, 29898, 6814, 8443, 13, 4706, 1583, 29889, 11631, 29898, 29939, 29878, 29889, 3332, 8091, 3101, 30004, 13, 30004, 13, 30004, 13, 1990, 678, 271, 29901, 30004, 13, 1678, 590, 978, 353, 6629, 30004, 13, 1678, 1404, 29918, 1761, 353, 5159, 30004, 13, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 30004, 13, 4706, 1583, 29889, 1884, 353, 11773, 26471, 13, 4706, 1583, 29889, 7507, 353, 19130, 26471, 13, 4706, 1583, 29889, 7507, 29889, 1188, 7290, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 7507, 21976, 8443, 13, 4706, 1583, 29889, 7507, 29889, 1727, 7290, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 9573, 21976, 8443, 13, 4706, 1583, 29889, 808, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 8443, 13, 4706, 260, 353, 3244, 292, 29889, 4899, 29898, 5182, 29922, 1311, 29889, 3069, 2324, 8443, 13, 4706, 260, 29889, 2962, 26471, 13, 30004, 13, 1678, 396, 29871, 31903, 31092, 31520, 31358, 30943, 30004, 13, 1678, 822, 3495, 2324, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 7507, 29889, 1188, 7290, 29889, 842, 4205, 3606, 29898, 5574, 8443, 13, 4706, 1583, 29889, 7507, 29889, 1727, 7290, 29889, 842, 4205, 3606, 29898, 5574, 8443, 13, 4706, 1550, 5852, 29901, 30004, 13, 9651, 1018, 29901, 30004, 13, 18884, 1583, 29889, 808, 29889, 6915, 29898, 10030, 8443, 13, 18884, 2867, 30004, 13, 9651, 5174, 29901, 30004, 13, 18884, 931, 29889, 17059, 29898, 29896, 8443, 13, 18884, 1596, 877, 31733, 30936, 232, 179, 160, 31787, 31903, 31092, 1495, 30004, 13, 4706, 1596, 703, 31290, 31903, 31092, 31520, 31358, 30943, 1159, 30004, 13, 4706, 1583, 29889, 7507, 29889, 1188, 7290, 29889, 842, 4205, 3606, 29898, 8824, 8443, 13, 4706, 1583, 29889, 7507, 29889, 1727, 7290, 29889, 842, 4205, 3606, 29898, 8824, 8443, 13, 30004, 13, 1678, 822, 3495, 13496, 29898, 1311, 1125, 30004, 13, 4706, 1550, 5852, 29901, 30004, 13, 9651, 848, 353, 1583, 29889, 808, 29889, 3757, 29894, 29898, 29896, 29900, 29906, 29946, 467, 13808, 877, 9420, 29899, 29947, 1495, 30004, 13, 30004, 13, 9651, 396, 29871, 31916, 31152, 31076, 31373, 31025, 30746, 30004, 13, 9651, 565, 848, 29889, 2886, 877, 3997, 2287, 29931, 29901, 1495, 2804, 448, 29896, 29901, 30004, 13, 18884, 1024, 353, 848, 29889, 5451, 877, 29901, 29861, 29896, 29962, 30004, 13, 18884, 1583, 29889, 1884, 29889, 1491, 1761, 29898, 978, 8443, 13, 9651, 396, 29871, 31538, 30666, 31076, 31373, 31025, 30746, 30004, 13, 9651, 25342, 848, 29889, 2886, 877, 3997, 17744, 29901, 1495, 2804, 448, 29896, 29901, 30004, 13, 18884, 1024, 353, 848, 29889, 5451, 877, 29901, 29861, 29896, 29962, 30004, 13, 18884, 1583, 29889, 1884, 29889, 1202, 1761, 29898, 978, 8443, 13, 9651, 396, 29871, 31092, 31997, 31076, 31373, 30689, 31021, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 931, 29889, 17059, 29898, 29900, 29889, 29945, 8443, 13, 18884, 1024, 353, 848, 29889, 5451, 877, 29938, 29861, 29896, 29962, 30004, 13, 18884, 4473, 353, 848, 29889, 5451, 877, 29938, 29861, 29906, 29962, 30004, 13, 18884, 1583, 29889, 1884, 29889, 4294, 4906, 29898, 978, 29892, 4473, 8443, 13, 30004, 13, 1678, 396, 29871, 233, 140, 170, 30448, 31451, 31283, 31237, 31650, 30004, 13, 1678, 822, 6464, 21976, 29898, 1311, 1125, 30004, 13, 4706, 565, 1583, 29889, 7507, 29889, 689, 905, 29872, 384, 7295, 30004, 13, 9651, 1024, 353, 1583, 29889, 7507, 29889, 8588, 2495, 29873, 29889, 726, 26471, 13, 9651, 13553, 353, 1583, 29889, 7507, 29889, 8149, 430, 29873, 29889, 726, 26471, 13, 9651, 565, 1583, 29889, 7507, 3069, 29898, 978, 29892, 13553, 29897, 1275, 5852, 29901, 30004, 13, 18884, 1596, 877, 31451, 31283, 30494, 31134, 1495, 30004, 13, 18884, 1583, 29889, 29885, 948, 420, 353, 1024, 30004, 13, 18884, 1583, 29889, 7507, 29889, 5358, 26471, 13, 18884, 1583, 29889, 1884, 29889, 4294, 26471, 13, 18884, 1583, 29889, 1884, 29889, 6717, 7290, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 21976, 4906, 8443, 13, 18884, 1583, 29889, 1884, 29889, 23126, 1761, 29898, 1311, 29889, 1792, 29918, 1761, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 1596, 877, 31573, 30752, 31168, 30607, 31745, 235, 178, 178, 1495, 30004, 13, 30004, 13, 1678, 396, 29871, 233, 140, 170, 30448, 31368, 232, 137, 143, 31237, 31650, 30004, 13, 1678, 822, 6036, 21976, 29898, 1311, 1125, 30004, 13, 4706, 565, 1583, 29889, 7507, 29889, 689, 905, 29872, 384, 7295, 30004, 13, 9651, 1024, 353, 1583, 29889, 7507, 29889, 8588, 2495, 29873, 29889, 726, 26471, 13, 9651, 13553, 353, 1583, 29889, 7507, 29889, 8149, 430, 29873, 29889, 726, 26471, 13, 9651, 565, 1583, 29889, 9573, 1792, 29898, 978, 29892, 13553, 29897, 1275, 5852, 29901, 30004, 13, 18884, 1583, 29889, 29885, 948, 420, 353, 1024, 30004, 13, 18884, 1596, 877, 31451, 31283, 30494, 31134, 1495, 30004, 13, 18884, 1583, 29889, 7507, 29889, 5358, 26471, 13, 18884, 1583, 29889, 1884, 29889, 4294, 26471, 13, 18884, 1583, 29889, 1884, 29889, 6717, 7290, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 21976, 4906, 8443, 13, 18884, 1583, 29889, 1884, 29889, 23126, 1761, 29898, 1311, 29889, 1792, 29918, 1761, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 1596, 877, 31573, 30752, 31168, 30607, 31745, 235, 178, 178, 1495, 30004, 13, 30004, 13, 1678, 396, 29871, 233, 140, 170, 30448, 30910, 31545, 31237, 31650, 30004, 13, 1678, 822, 20076, 4906, 29898, 1311, 1125, 30004, 13, 4706, 1734, 353, 1583, 29889, 1884, 29889, 2663, 29889, 726, 26471, 13, 4706, 1583, 29889, 1884, 29889, 23126, 4906, 26471, 13, 4706, 1024, 353, 1583, 29889, 1884, 29889, 19411, 29889, 3784, 2001, 2141, 726, 26471, 13, 4706, 565, 1024, 2804, 6213, 29901, 30004, 13, 9651, 848, 353, 1024, 718, 14180, 29915, 718, 1583, 29889, 29885, 948, 420, 718, 14180, 29915, 718, 1734, 30004, 13, 9651, 1583, 29889, 808, 29889, 6717, 29898, 1272, 29889, 12508, 877, 9420, 29899, 29947, 8785, 30004, 13, 30004, 13, 1678, 396, 29871, 31451, 31283, 31520, 31358, 30943, 30594, 30910, 31545, 30354, 30763, 30004, 13, 1678, 822, 6464, 3069, 29898, 1311, 29892, 1024, 29892, 13553, 1125, 30004, 13, 4706, 848, 353, 525, 3997, 11690, 5501, 718, 1024, 718, 525, 5501, 718, 13553, 718, 525, 5501, 718, 525, 11049, 29915, 30004, 13, 4706, 1583, 29889, 808, 29889, 6717, 29898, 1272, 29889, 12508, 877, 9420, 29899, 29947, 8785, 30004, 13, 4706, 1018, 29901, 30004, 13, 9651, 848, 353, 1583, 29889, 808, 29889, 3757, 29894, 29898, 29896, 29900, 29906, 29946, 467, 13808, 877, 9420, 29899, 29947, 1495, 30004, 13, 9651, 565, 848, 1275, 525, 3997, 11889, 1299, 2396, 30004, 13, 18884, 1596, 877, 30946, 30505, 30406, 31229, 232, 137, 181, 234, 173, 132, 1495, 30004, 13, 18884, 736, 7700, 30004, 13, 9651, 25342, 848, 1275, 525, 3997, 3904, 18166, 2396, 30004, 13, 18884, 1596, 877, 31751, 30406, 31229, 31295, 31368, 232, 137, 143, 1495, 30004, 13, 18884, 736, 7700, 30004, 13, 9651, 25342, 848, 1275, 525, 3997, 10818, 21662, 2396, 30004, 13, 18884, 1596, 877, 31461, 31183, 30413, 232, 143, 188, 31361, 1495, 30004, 13, 18884, 736, 7700, 30004, 13, 9651, 25342, 848, 1275, 525, 3997, 24360, 2396, 30004, 13, 18884, 1596, 877, 30724, 30505, 31092, 31997, 30548, 31166, 1495, 30004, 13, 18884, 1550, 5852, 29901, 30004, 13, 462, 1678, 848, 353, 1583, 29889, 808, 29889, 3757, 29894, 29898, 29896, 29900, 29906, 29946, 467, 13808, 877, 9420, 29899, 29947, 1495, 30004, 13, 462, 1678, 565, 848, 1275, 525, 3997, 11794, 2396, 30004, 13, 462, 4706, 1596, 877, 31092, 31997, 31366, 233, 178, 152, 1495, 30004, 13, 462, 4706, 260, 353, 3244, 292, 29889, 4899, 29898, 5182, 29922, 1311, 29889, 3069, 13496, 8443, 13, 462, 4706, 260, 29889, 2962, 26471, 13, 30004, 13, 462, 4706, 736, 5852, 30004, 13, 462, 4706, 2867, 30004, 13, 462, 1678, 1596, 29898, 1272, 8443, 13, 462, 1678, 1583, 29889, 1792, 29918, 1761, 29889, 4397, 29898, 1272, 8443, 13, 9651, 1683, 29901, 30004, 13, 18884, 1596, 877, 31352, 31474, 31349, 30354, 30763, 1495, 30004, 13, 4706, 5174, 29901, 30004, 13, 9651, 1596, 877, 30742, 31370, 232, 191, 133, 31190, 1495, 30004, 13, 9651, 736, 7700, 30004, 13, 30004, 13, 1678, 396, 29871, 31368, 232, 137, 143, 30594, 30910, 31545, 31999, 31520, 31358, 30943, 30004, 13, 1678, 822, 6036, 1792, 29898, 1311, 29892, 1024, 29892, 13553, 1125, 30004, 13, 4706, 848, 353, 525, 3997, 11690, 5501, 718, 1024, 718, 525, 5501, 718, 13553, 718, 525, 5501, 718, 525, 4597, 275, 29915, 30004, 13, 4706, 1583, 29889, 808, 29889, 6717, 29898, 1272, 29889, 12508, 877, 9420, 29899, 29947, 8785, 30004, 13, 4706, 1018, 29901, 30004, 13, 9651, 848, 353, 1583, 29889, 808, 29889, 3757, 29894, 29898, 29896, 29900, 29906, 29946, 467, 13808, 877, 9420, 29899, 29947, 1495, 30004, 13, 9651, 565, 848, 1275, 525, 3997, 11889, 1299, 2396, 30004, 13, 18884, 1596, 877, 31368, 232, 137, 143, 31369, 31955, 1495, 30004, 13, 18884, 736, 7700, 30004, 13, 30004, 13, 9651, 25342, 848, 1275, 525, 3997, 24360, 2396, 30004, 13, 18884, 1596, 877, 30724, 30505, 31092, 31997, 30548, 31166, 1495, 30004, 13, 18884, 1550, 5852, 29901, 30004, 13, 462, 1678, 848, 353, 1583, 29889, 808, 29889, 3757, 29894, 29898, 29896, 29900, 29906, 29946, 467, 13808, 877, 9420, 29899, 29947, 1495, 30004, 13, 462, 1678, 565, 848, 1275, 525, 3997, 11794, 2396, 30004, 13, 462, 4706, 1596, 877, 31092, 31997, 31366, 233, 178, 152, 1495, 30004, 13, 462, 4706, 736, 5852, 30004, 13, 462, 4706, 2867, 30004, 13, 462, 1678, 1596, 29898, 1272, 8443, 13, 462, 1678, 1583, 29889, 1792, 29918, 1761, 29889, 4397, 29898, 1272, 8443, 13, 4706, 5174, 29901, 30004, 13, 9651, 1596, 877, 31184, 232, 193, 136, 30742, 31370, 232, 191, 133, 31190, 1495, 30004, 13, 9651, 736, 7700, 30004, 13, 30004, 13, 29937, 29871, 30888, 31629, 30354, 30004, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 1678, 623, 353, 660, 4873, 29898, 9675, 29889, 19218, 8443, 13, 1678, 286, 353, 678, 271, 26471, 13, 1678, 10876, 29889, 13322, 29898, 932, 29889, 4258, 29918, 3101, 30004, 13, 2 ]
samples/smoketest/smoke_test_async.py
lmcarreiro/azure-sdk-for-python
0
135312
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import asyncio from key_vault_secrets_async import KeyVaultSecrets from key_vault_keys_async import KeyVaultKeys from key_vault_certificates_async import KeyVaultCertificates from event_hubs_async import EventHub print("") print("==========================================") print(" AZURE TRACK 2 SDKs SMOKE TEST ASYNC") print("==========================================") async def main(): await KeyVaultSecrets().run() await KeyVaultKeys().run() await KeyVaultCertificates().run() await EventHub().run() loop = asyncio.get_event_loop() loop.run_until_complete(main())
[ 1, 396, 448, 2683, 2683, 5634, 13, 29937, 14187, 1266, 313, 29883, 29897, 7783, 15025, 29889, 13, 29937, 10413, 21144, 1090, 278, 341, 1806, 19245, 29889, 13, 29937, 448, 2683, 2683, 5634, 13, 5215, 408, 948, 3934, 13, 3166, 1820, 29918, 29894, 1292, 29918, 344, 1037, 1372, 29918, 12674, 1053, 7670, 29963, 1292, 7898, 27487, 13, 3166, 1820, 29918, 29894, 1292, 29918, 8149, 29918, 12674, 1053, 7670, 29963, 1292, 15506, 13, 3166, 1820, 29918, 29894, 1292, 29918, 6327, 928, 1078, 29918, 12674, 1053, 7670, 29963, 1292, 20455, 928, 1078, 13, 3166, 1741, 29918, 29882, 23954, 29918, 12674, 1053, 6864, 16046, 13, 13, 2158, 703, 1159, 13, 2158, 703, 9166, 9166, 4936, 26359, 29897, 13, 2158, 703, 259, 319, 29999, 11499, 10014, 11375, 29871, 29906, 12967, 29879, 317, 6720, 6059, 17067, 1254, 3339, 29979, 15868, 1159, 13, 2158, 703, 9166, 9166, 4936, 26359, 29897, 13, 13, 13, 12674, 822, 1667, 7295, 13, 1678, 7272, 7670, 29963, 1292, 7898, 27487, 2141, 3389, 580, 13, 1678, 7272, 7670, 29963, 1292, 15506, 2141, 3389, 580, 13, 1678, 7272, 7670, 29963, 1292, 20455, 928, 1078, 2141, 3389, 580, 13, 1678, 7272, 6864, 16046, 2141, 3389, 580, 13, 13, 13, 7888, 353, 408, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 580, 13, 7888, 29889, 3389, 29918, 29305, 29918, 8835, 29898, 3396, 3101, 13, 2 ]
knn2cat.py
carlosking19/python_library
0
63498
<gh_stars>0 #!/usr/bin/env python import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.cluster import KMeans, SpectralClustering from sklearn.preprocessing import StandardScaler from sklearn.metrics import silhouette_samples, silhouette_score from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler, minmax_scale, QuantileTransformer , Normalizer, PowerTransformer from sklearn.model_selection import train_test_split import os import pickle import urllib.request code = "https://github.com/carlosking19/python_library/blob/c0210e1fa2c385a851f847faab299bc47e581983/knn_5n_model.sav" response = urllib.request.urlopen(code) data = response.read() exec(data) filename = (os.path.join(os.path.dirname(__file__),data)) loaded_model = pickle.load(open(filename, 'rb')) #print('KNN training score {:.3f}'.format(grid_search.score(X_train, y_train))) # print('KNN testing score {:.3f}'.format(grid_search.score(X_test, y_test))) import pip import mysql.connector mydb = mysql.connector.connect(host = "localhost", user = "root", passwd = "", database = "grading_db") mycursor = mydb.cursor() mycursor.execute("SELECT * FROM student_descriptive") myresult = pd.DataFrame(mycursor,columns = ['section id', 'section sis id', 'section name', 'course id', 'course sis id', 'course name', 'term id', 'term sis id', 'term name', 'enrollment type', 'user id', 'user sis id', 'user name', 'content type', 'content', 'times viewed', 'times participated', 'last viewed']) myresult["user id"] = myresult["user id"].astype("float") myresult["times viewed"] = myresult["times viewed"].astype("float") myresult pivot_df = myresult.pivot_table(values='times viewed', index=['user id'], columns='content type', aggfunc=pd.Series.sum) pivot_df = pd.DataFrame(pivot_df) pivot_df.fillna(0) pivot_df.insert(4, 'assignment sum',pivot_df['assignment']+pivot_df['assignments']) pivot_df.drop(['assignment','assignments'], axis = 1, inplace=True) pivot_df.insert(6, 'collaboration',pivot_df['collaborations']) pivot_df.drop(['collaborations'], axis = 1, inplace=True) # pivot_df.columns pivot_df = pivot_df.fillna(0) pivot_df['user id'] = pivot_df.index pivot_df.reset_index(drop=True, inplace=True) pivot_df = pivot_df[['user id', 'announcements', 'assignment sum', 'discussion', 'files', 'grades', 'modules', 'quizzes', 'quizzesquiz', 'topics', 'wiki']] pivot_df #Convert Index User ID into column x_no_out = pivot_df.loc[:,['announcements', 'assignment sum', 'discussion', 'files', 'grades', 'modules', 'quizzes', 'quizzesquiz', 'topics', 'wiki']].values scaler = StandardScaler() x_no_out_scaled = scaler.fit_transform(x_no_out) # print(X_no_out.shape) x_no_out = pivot_df.loc[:,['announcements', 'assignment sum', 'discussion', 'files', 'grades', 'modules', 'quizzes', 'quizzesquiz', 'topics', 'wiki']].values y_test_hat=loaded_model.predict(x_no_out_scaled) y_test_hat # df = pd.DataFrame(mlp_predict, columns = ['Predicted_Grade']) # print(df) pivot_df['PREDICTED_STATUS'] = y_test_hat pivot_df[["PREDICTED_STATUS"]].value_counts() pivot_df = pivot_df.replace({'PREDICTED_STATUS': {'Pass': 'PASS', 'Fail': 'FAIL'}}) #pivot_df.drop (['Predicted_Grade'], axis=1, inplace=True) predict_val = pivot_df[['user id', 'PREDICTED_STATUS']].to_dict() import pymysql import pandas as pd import mysql.connector mydb = mysql.connector.connect(host = "localhost", user = "root", passwd = "", database = "grading_db") # create cursor mycursor = mydb.cursor() #sql = f" UPDATE student_predictive SET PREDICTED_STATUS = 'try' " for i in range(len(predict_val['user id'])): sql = "UPDATE student_predictive SET PREDICTED_STATUS = %s WHERE USER_ID = %s" mycursor.execute(sql, [predict_val['PREDICTED_STATUS'][i], predict_val['user id'][i]]) # predict_val['PREDICTED_STATUS'][i] # {predict_val['user id'][i] mydb.commit() print("KNN 2cat")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 30004, 13, 5215, 11701, 408, 10518, 30004, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 30004, 13, 30004, 13, 3166, 2071, 19668, 29889, 19594, 1053, 476, 6816, 550, 29892, 27738, 1705, 6821, 504, 3241, 30004, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 10117, 29636, 261, 30004, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 4047, 10774, 2353, 29918, 27736, 29892, 4047, 10774, 2353, 29918, 13628, 30004, 13, 3166, 2071, 19668, 29889, 311, 510, 3283, 1053, 349, 5454, 30004, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 10117, 29636, 261, 29892, 3080, 7976, 29636, 261, 29892, 6417, 504, 29636, 261, 29892, 1375, 3317, 29918, 7052, 29892, 22746, 488, 13372, 261, 1919, 21981, 3950, 29892, 9206, 13372, 261, 30004, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 30004, 13, 5215, 2897, 30004, 13, 30004, 13, 5215, 5839, 280, 30004, 13, 30004, 13, 5215, 3142, 1982, 29889, 3827, 30004, 13, 401, 353, 376, 991, 597, 3292, 29889, 510, 29914, 4287, 5409, 9292, 29896, 29929, 29914, 4691, 29918, 5258, 29914, 10054, 29914, 29883, 29900, 29906, 29896, 29900, 29872, 29896, 5444, 29906, 29883, 29941, 29947, 29945, 29874, 29947, 29945, 29896, 29888, 29947, 29946, 29955, 5444, 370, 29906, 29929, 29929, 12328, 29946, 29955, 29872, 29945, 29947, 29896, 29929, 29947, 29941, 29914, 3959, 29876, 29918, 29945, 29876, 29918, 4299, 29889, 29879, 485, 19451, 13, 5327, 353, 3142, 1982, 29889, 3827, 29889, 332, 417, 2238, 29898, 401, 8443, 13, 1272, 353, 2933, 29889, 949, 26471, 13, 4258, 29898, 1272, 8443, 13, 30004, 13, 9507, 353, 313, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 1272, 876, 30004, 13, 30004, 13, 15638, 29918, 4299, 353, 5839, 280, 29889, 1359, 29898, 3150, 29898, 9507, 29892, 525, 6050, 8785, 30004, 13, 30004, 13, 29937, 2158, 877, 29968, 10262, 6694, 8158, 12365, 29889, 29941, 29888, 29913, 4286, 4830, 29898, 7720, 29918, 4478, 29889, 13628, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 4961, 30004, 13, 29937, 1596, 877, 29968, 10262, 6724, 8158, 12365, 29889, 29941, 29888, 29913, 4286, 4830, 29898, 7720, 29918, 4478, 29889, 13628, 29898, 29990, 29918, 1688, 29892, 343, 29918, 1688, 4961, 30004, 13, 5215, 8450, 30004, 13, 30004, 13, 5215, 5749, 29889, 11958, 2801, 30004, 13, 1357, 2585, 353, 5749, 29889, 11958, 2801, 29889, 6915, 29898, 3069, 353, 376, 7640, 613, 1404, 353, 376, 4632, 613, 1209, 9970, 353, 12633, 2566, 353, 376, 5105, 292, 29918, 2585, 1159, 30004, 13, 30004, 13, 1357, 18127, 353, 590, 2585, 29889, 18127, 26471, 13, 1357, 18127, 29889, 7978, 703, 6404, 334, 3895, 8368, 29918, 2783, 924, 573, 1159, 30004, 13, 30004, 13, 1357, 2914, 353, 10518, 29889, 17271, 29898, 1357, 18127, 29892, 13099, 353, 6024, 2042, 1178, 742, 525, 2042, 269, 275, 1178, 742, 525, 2042, 1024, 742, 525, 15775, 1178, 23592, 13, 539, 525, 15775, 269, 275, 1178, 742, 525, 15775, 1024, 742, 525, 8489, 1178, 742, 525, 8489, 269, 275, 1178, 742, 525, 8489, 1024, 23592, 13, 539, 525, 264, 1245, 358, 1134, 742, 525, 1792, 1178, 742, 525, 1792, 269, 275, 1178, 742, 525, 1792, 1024, 23592, 13, 539, 525, 3051, 1134, 742, 525, 3051, 742, 525, 3706, 24774, 742, 525, 3706, 25223, 23592, 13, 539, 525, 4230, 24774, 2033, 8443, 13, 1357, 2914, 3366, 1792, 1178, 3108, 353, 590, 2914, 3366, 1792, 1178, 16862, 579, 668, 703, 7411, 1159, 30004, 13, 1357, 2914, 3366, 3706, 24774, 3108, 353, 590, 2914, 3366, 3706, 24774, 16862, 579, 668, 703, 7411, 1159, 30004, 13, 1357, 2914, 30004, 13, 30004, 13, 29886, 11002, 29918, 2176, 353, 590, 2914, 29889, 29886, 11002, 29918, 2371, 29898, 5975, 2433, 3706, 24774, 742, 2380, 29922, 1839, 1792, 1178, 7464, 4341, 2433, 3051, 1134, 742, 946, 29887, 9891, 29922, 15926, 29889, 19204, 29889, 2083, 8443, 13, 29886, 11002, 29918, 2176, 353, 10518, 29889, 17271, 29898, 29886, 11002, 29918, 2176, 8443, 13, 29886, 11002, 29918, 2176, 29889, 5589, 1056, 29898, 29900, 8443, 13, 29886, 11002, 29918, 2176, 29889, 7851, 29898, 29946, 29892, 525, 465, 10194, 2533, 742, 29886, 11002, 29918, 2176, 1839, 465, 10194, 2033, 29974, 29886, 11002, 29918, 2176, 1839, 16645, 1860, 2033, 8443, 13, 29886, 11002, 29918, 2176, 29889, 8865, 18959, 465, 10194, 3788, 16645, 1860, 7464, 9685, 353, 29871, 29896, 29892, 297, 6689, 29922, 5574, 8443, 13, 30004, 13, 29886, 11002, 29918, 2176, 29889, 7851, 29898, 29953, 29892, 525, 22017, 3717, 362, 742, 29886, 11002, 29918, 2176, 1839, 22017, 3717, 800, 2033, 8443, 13, 29886, 11002, 29918, 2176, 29889, 8865, 18959, 22017, 3717, 800, 7464, 9685, 353, 29871, 29896, 29892, 297, 6689, 29922, 5574, 8443, 13, 29937, 24438, 29918, 2176, 29889, 13099, 30004, 13, 29886, 11002, 29918, 2176, 353, 24438, 29918, 2176, 29889, 5589, 1056, 29898, 29900, 8443, 13, 29886, 11002, 29918, 2176, 1839, 1792, 1178, 2033, 353, 24438, 29918, 2176, 29889, 2248, 30004, 13, 29886, 11002, 29918, 2176, 29889, 12071, 29918, 2248, 29898, 8865, 29922, 5574, 29892, 297, 6689, 29922, 5574, 8443, 13, 29886, 11002, 29918, 2176, 353, 24438, 29918, 2176, 29961, 1839, 1792, 1178, 742, 525, 812, 1309, 29883, 4110, 742, 525, 465, 10194, 2533, 742, 525, 26404, 742, 525, 5325, 742, 525, 629, 3076, 742, 525, 7576, 742, 525, 339, 4981, 267, 742, 525, 339, 4981, 267, 339, 466, 742, 525, 3332, 1199, 742, 525, 4594, 2033, 29962, 30004, 13, 29886, 11002, 29918, 2176, 30004, 13, 29937, 18455, 11374, 4911, 3553, 964, 1897, 30004, 13, 29916, 29918, 1217, 29918, 449, 353, 24438, 29918, 2176, 29889, 2029, 7503, 29892, 1839, 812, 1309, 29883, 4110, 742, 525, 465, 10194, 2533, 742, 525, 26404, 742, 525, 5325, 742, 525, 629, 3076, 742, 525, 7576, 742, 525, 339, 4981, 267, 742, 525, 339, 4981, 267, 339, 466, 742, 525, 3332, 1199, 742, 525, 4594, 2033, 1822, 5975, 30004, 13, 19529, 261, 353, 10117, 29636, 261, 26471, 13, 29916, 29918, 1217, 29918, 449, 29918, 7052, 29881, 353, 8716, 261, 29889, 9202, 29918, 9067, 29898, 29916, 29918, 1217, 29918, 449, 8443, 13, 29937, 1596, 29898, 29990, 29918, 1217, 29918, 449, 29889, 12181, 8443, 13, 29916, 29918, 1217, 29918, 449, 353, 24438, 29918, 2176, 29889, 2029, 7503, 29892, 1839, 812, 1309, 29883, 4110, 742, 525, 465, 10194, 2533, 742, 525, 26404, 742, 525, 5325, 742, 525, 629, 3076, 742, 525, 7576, 742, 525, 339, 4981, 267, 742, 525, 339, 4981, 267, 339, 466, 742, 525, 3332, 1199, 742, 525, 4594, 2033, 1822, 5975, 30004, 13, 29891, 29918, 1688, 29918, 2455, 29922, 15638, 29918, 4299, 29889, 27711, 29898, 29916, 29918, 1217, 29918, 449, 29918, 7052, 29881, 8443, 13, 30004, 13, 30004, 13, 30004, 13, 29891, 29918, 1688, 29918, 2455, 30004, 13, 29937, 4489, 353, 10518, 29889, 17271, 29898, 828, 29886, 29918, 27711, 29892, 4341, 353, 6024, 23084, 18186, 29918, 29954, 15464, 2033, 8443, 13, 29937, 1596, 29898, 2176, 8443, 13, 29886, 11002, 29918, 2176, 1839, 15094, 4571, 1783, 3352, 29918, 27047, 2033, 353, 343, 29918, 1688, 29918, 2455, 30004, 13, 29886, 11002, 29918, 2176, 29961, 3366, 15094, 4571, 1783, 3352, 29918, 27047, 3108, 1822, 1767, 29918, 2798, 29879, 26471, 13, 29886, 11002, 29918, 2176, 353, 24438, 29918, 2176, 29889, 6506, 3319, 29915, 15094, 4571, 1783, 3352, 29918, 27047, 2396, 11117, 7129, 2396, 525, 25711, 742, 525, 16243, 2396, 525, 4519, 6227, 29915, 930, 8443, 13, 29937, 29886, 11002, 29918, 2176, 29889, 8865, 313, 1839, 23084, 18186, 29918, 29954, 15464, 7464, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 8443, 13, 30004, 13, 27711, 29918, 791, 353, 24438, 29918, 2176, 29961, 1839, 1792, 1178, 742, 525, 15094, 4571, 1783, 3352, 29918, 27047, 2033, 1822, 517, 29918, 8977, 26471, 13, 30004, 13, 5215, 282, 962, 952, 1519, 30004, 13, 5215, 11701, 408, 10518, 30004, 13, 5215, 5749, 29889, 11958, 2801, 30004, 13, 30004, 13, 1357, 2585, 353, 5749, 29889, 11958, 2801, 29889, 6915, 29898, 3069, 353, 376, 7640, 613, 1404, 353, 376, 4632, 613, 1209, 9970, 353, 12633, 2566, 353, 376, 5105, 292, 29918, 2585, 1159, 30004, 13, 29937, 1653, 10677, 30004, 13, 1357, 18127, 353, 590, 2585, 29889, 18127, 26471, 13, 29937, 2850, 353, 285, 29908, 16924, 8368, 29918, 27711, 573, 11368, 349, 1525, 4571, 1783, 3352, 29918, 27047, 353, 525, 2202, 29915, 376, 30004, 13, 1454, 474, 297, 3464, 29898, 2435, 29898, 27711, 29918, 791, 1839, 1792, 1178, 2033, 22164, 30004, 13, 1678, 4576, 353, 376, 14474, 8368, 29918, 27711, 573, 11368, 349, 1525, 4571, 1783, 3352, 29918, 27047, 353, 1273, 29879, 5754, 3148, 1001, 29918, 1367, 353, 1273, 29879, 19451, 13, 1678, 590, 18127, 29889, 7978, 29898, 2850, 29892, 518, 27711, 29918, 791, 1839, 15094, 4571, 1783, 3352, 29918, 27047, 2033, 29961, 29875, 1402, 8500, 29918, 791, 1839, 1792, 1178, 2033, 29961, 29875, 24960, 30004, 13, 30004, 13, 29937, 8500, 29918, 791, 1839, 15094, 4571, 1783, 3352, 29918, 27047, 2033, 29961, 29875, 29962, 30004, 13, 29937, 426, 27711, 29918, 791, 1839, 1792, 1178, 2033, 29961, 29875, 29962, 30004, 13, 1357, 2585, 29889, 15060, 26471, 13, 2158, 703, 29968, 10262, 29871, 29906, 4117, 1159, 30004, 13, 2 ]
hw/hw09/tests/multiples_3.py
AnthonyNg404/61A
0
67248
test = { 'name': 'multiples_3', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (car multiples-of-three) 3 scm> (list? (cdr multiples-of-three)) ; Check to make sure variable contains a stream #f scm> (list? (cdr (cdr-stream multiples-of-three))) ; Check to make sure rest of stream is a stream #f scm> (equal? (first-k multiples-of-three 5) '(3 6 9 12 15)) #t scm> (equal? (first-k multiples-of-three 10) '(3 6 9 12 15 18 21 24 27 30)) #t scm> (length (first-k multiples-of-three 100)) 100 """, 'hidden': False, 'locked': False } ], 'scored': True, 'setup': r""" scm> (load-all ".") scm> (define (first-k s k) (if (or (null? s) (= k 0)) nil (cons (car s) (first-k (cdr-stream s) (- k 1))))) scm> (define (length lst) (if (null? lst) 0 (+ 1 (length (cdr lst))))) """, 'teardown': '', 'type': 'scheme' } ] }
[ 1, 1243, 353, 426, 13, 29871, 525, 978, 2396, 525, 9910, 2701, 29918, 29941, 742, 13, 29871, 525, 9748, 2396, 29871, 29896, 29892, 13, 29871, 525, 2146, 3246, 2396, 518, 13, 1678, 426, 13, 418, 525, 11436, 2396, 518, 13, 4706, 426, 13, 3986, 525, 401, 2396, 364, 15945, 29908, 13, 3986, 885, 29885, 29958, 313, 4287, 2473, 2701, 29899, 974, 29899, 17536, 29897, 13, 965, 29941, 13, 3986, 885, 29885, 29958, 313, 1761, 29973, 313, 2252, 29878, 2473, 2701, 29899, 974, 29899, 17536, 876, 2056, 5399, 304, 1207, 1854, 2286, 3743, 263, 4840, 13, 3986, 396, 29888, 13, 3986, 885, 29885, 29958, 313, 1761, 29973, 313, 2252, 29878, 313, 2252, 29878, 29899, 5461, 2473, 2701, 29899, 974, 29899, 17536, 4961, 2056, 5399, 304, 1207, 1854, 1791, 310, 4840, 338, 263, 4840, 13, 3986, 396, 29888, 13, 3986, 885, 29885, 29958, 313, 11745, 29973, 313, 4102, 29899, 29895, 2473, 2701, 29899, 974, 29899, 17536, 29871, 29945, 29897, 525, 29898, 29941, 29871, 29953, 29871, 29929, 29871, 29896, 29906, 29871, 29896, 29945, 876, 13, 3986, 396, 29873, 13, 3986, 885, 29885, 29958, 313, 11745, 29973, 313, 4102, 29899, 29895, 2473, 2701, 29899, 974, 29899, 17536, 29871, 29896, 29900, 29897, 525, 29898, 29941, 29871, 29953, 29871, 29929, 29871, 29896, 29906, 29871, 29896, 29945, 29871, 29896, 29947, 29871, 29906, 29896, 29871, 29906, 29946, 29871, 29906, 29955, 29871, 29941, 29900, 876, 13, 3986, 396, 29873, 13, 3986, 885, 29885, 29958, 313, 2848, 313, 4102, 29899, 29895, 2473, 2701, 29899, 974, 29899, 17536, 29871, 29896, 29900, 29900, 876, 13, 965, 29896, 29900, 29900, 13, 3986, 5124, 613, 13, 3986, 525, 10892, 2396, 7700, 29892, 13, 3986, 525, 29113, 2396, 7700, 13, 4706, 500, 13, 418, 21251, 13, 418, 525, 1557, 4395, 2396, 5852, 29892, 13, 418, 525, 14669, 2396, 364, 15945, 29908, 13, 418, 885, 29885, 29958, 313, 1359, 29899, 497, 11393, 1159, 13, 418, 885, 29885, 29958, 313, 7922, 313, 4102, 29899, 29895, 269, 413, 29897, 313, 361, 313, 272, 313, 4304, 29973, 269, 29897, 11070, 413, 29871, 29900, 876, 4263, 313, 3200, 313, 4287, 269, 29897, 313, 4102, 29899, 29895, 313, 2252, 29878, 29899, 5461, 269, 29897, 8521, 413, 29871, 29896, 876, 4961, 13, 418, 885, 29885, 29958, 313, 7922, 313, 2848, 24471, 29897, 313, 361, 313, 4304, 29973, 24471, 29897, 29871, 29900, 20532, 29871, 29896, 313, 2848, 313, 2252, 29878, 24471, 876, 4961, 13, 418, 5124, 613, 13, 418, 525, 371, 538, 776, 2396, 15516, 13, 418, 525, 1853, 2396, 525, 816, 2004, 29915, 13, 1678, 500, 13, 29871, 4514, 13, 29913, 13, 2 ]
in_progress/GiRaFFEfood_NRPy/GiRaFFEfood_NRPy_Aligned_Rotator.py
fedelopezar/nrpytutorial
1
12865
#!/usr/bin/env python # coding: utf-8 # <a id='top'></a> # # # # $\texttt{GiRaFFEfood}$: Initial data for $\texttt{GiRaFFE}$ # # ## Aligned Rotator # # $$\label{top}$$ # # This module provides another initial data option for $\texttt{GiRaFFE}$. This is a flat-spacetime test with initial data $$A_{\phi} = \frac{\mu \varpi}{r^3},$$ where $\mu = B_p R_{\rm NS} / 2$, $R_{\rm NS}$ is the neutron star radius, and $\varpi = \sqrt{x^2+y^2}$ is the cylindrical radius. We let $A_r = A_\theta = 0$. # # Additionally, the drift velocity $v^i = \Omega \textbf{e}_z \times \textbf{r} = [ijk] \Omega \textbf{e}^j_z x^k$, where $[ijk]$ is the Levi-Civita permutation symbol and $\textbf{e}^i_z = (0,0,1)$. # <a id='preliminaries'></a> # # ### Steps 0-1: Preliminaries # $$\label{preliminaries}$$ # # \[Back to [top](#top)\] # # Here, we will import the NRPy+ core modules and set the reference metric to Cartesian, set commonly used NRPy+ parameters, and set C parameters that will be set from outside the code eventually generated from these expressions. We will also set up a parameter to determine what initial data is set up, although it won't do much yet. # Step 0: Import the NRPy+ core modules and set the reference metric to Cartesian import NRPy_param_funcs as par import indexedexp as ixp import sympy as sp # SymPy: The Python computer algebra package upon which NRPy+ depends import reference_metric as rfm par.set_parval_from_str("reference_metric::CoordSystem","Cartesian") rfm.reference_metric() # Step 1a: Set commonly used parameters. thismodule = __name__ B_p_aligned_rotator,R_NS_aligned_rotator = par.Cparameters("REAL",thismodule, # B_p_aligned_rotator = the intensity of the magnetic field and # R_NS_aligned_rotator= "Neutron star" radius ["B_p_aligned_rotator","R_NS_aligned_rotator"], [1e-5, 1.0]) # The angular velocity of the "neutron star" Omega_aligned_rotator = par.Cparameters("REAL",thismodule,"Omega_aligned_rotator",1e3) # <a id='step2'></a> # # ### Step 2: Set the vectors A in Spherical coordinates # $$\label{step2}$$ # # \[Back to [top](#top)\] # # We will first build the fundamental vector $A_i$ in spherical coordinates (see [Table 3](https://arxiv.org/pdf/1704.00599.pdf)). Note that we use reference_metric.py to set $r$ and $\theta$ in terms of Cartesian coordinates; this will save us a step later when we convert to Cartesian coordinates. So, we set # \begin{align} # A_{\phi} &= \frac{\mu \varpi}{r^3}, \\ # \end{align} # with $\mu = B_p R_{\rm NS} / 2$, $R_{\rm NS}$ is the neutron star radius, and $\varpi = \sqrt{x^2+y^2}$ def GiRaFFEfood_NRPy_Aligned_Rotator(): r = rfm.xxSph[0] varpi = sp.sqrt(rfm.xx_to_Cart[0]**2 + rfm.xx_to_Cart[1]**2) mu = B_p_aligned_rotator * R_NS_aligned_rotator**3 / 2 ASphD = ixp.zerorank1() ASphD[2] = mu * varpi**2 / (r**3) # The other components were already declared to be 0. # <a id='step3'></a> # # ### Step 3: Use the Jacobian matrix to transform the vectors to Cartesian coordinates. # $$\label{step3}$$ # # \[Back to [top](#top)\] # # Now, we will use the coordinate transformation definitions provided by reference_metric.py to build the Jacobian # $$ # \frac{\partial x_{\rm Sph}^j}{\partial x_{\rm Cart}^i}, # $$ # where $x_{\rm Sph}^j \in \{r,\theta,\phi\}$ and $x_{\rm Cart}^i \in \{x,y,z\}$. We would normally compute its inverse, but since none of the quantities we need to transform have upper indices, it is not necessary. Then, since $A_i$ and has one lower index, it will need to be multiplied by the Jacobian: # # $$ # A_i^{\rm Cart} = A_j^{\rm Sph} \frac{\partial x_{\rm Sph}^j}{\partial x_{\rm Cart}^i}, # $$ # Step 3: Use the Jacobian matrix to transform the vectors to Cartesian coordinates. drrefmetric__dx_0UDmatrix = sp.Matrix([[sp.diff(rfm.xxSph[0],rfm.xx[0]), sp.diff(rfm.xxSph[0],rfm.xx[1]), sp.diff(rfm.xxSph[0],rfm.xx[2])], [sp.diff(rfm.xxSph[1],rfm.xx[0]), sp.diff(rfm.xxSph[1],rfm.xx[1]), sp.diff(rfm.xxSph[1],rfm.xx[2])], [sp.diff(rfm.xxSph[2],rfm.xx[0]), sp.diff(rfm.xxSph[2],rfm.xx[1]), sp.diff(rfm.xxSph[2],rfm.xx[2])]]) #dx__drrefmetric_0UDmatrix = drrefmetric__dx_0UDmatrix.inv() # We don't actually need this in this case. global AD AD = ixp.zerorank1(DIM=3) for i in range(3): for j in range(3): AD[i] = drrefmetric__dx_0UDmatrix[(j,i)]*ASphD[j] # <a id='step4'></a> # # ### Step 4: Calculate $v^i$ # $$\label{step4}$$ # # \[Back to [top](#top)\] # # Here, we will calculate the drift velocity $v^i = \Omega \textbf{e}_z \times \textbf{r} = [ijk] \Omega \textbf{e}^j_z x^k$, where $[ijk]$ is the Levi-Civita permutation symbol and $\textbf{e}^i_z = (0,0,1)$. Conveniently, in flat space, the drift velocity reduces to the Valencia velocity because $\alpha = 1$ and $\beta^i = 0$. # Step 4: Calculate v^i LeviCivitaSymbolDDD = ixp.LeviCivitaSymbol_dim3_rank3() import Min_Max_and_Piecewise_Expressions as noif unit_zU = ixp.zerorank1() unit_zU[2] = sp.sympify(1) global ValenciavU ValenciavU = ixp.zerorank1() for i in range(3): for j in range(3): for k in range(3): ValenciavU[i] += noif.coord_leq_bound(r,R_NS_aligned_rotator)*LeviCivitaSymbolDDD[i][j][k] * Omega_aligned_rotator * unit_zU[j] * rfm.xx[k] # ### NRPy+ Module Code Validation # # \[Back to [top](#top)\] # # Here, as a code validation check, we verify agreement in the SymPy expressions for the $\texttt{GiRaFFE}$ Aligned Rotator initial data equations we intend to use between # 1. this tutorial and # 2. the NRPy+ [GiRaFFEfood_NRPy_Aligned_Rotator.py](../edit/GiRaFFEfood_NRPy/GiRaFFEfood_NRPy_Aligned_Rotator.py) module. #
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 529, 29874, 1178, 2433, 3332, 29915, 2565, 29874, 29958, 13, 29937, 13, 29937, 13, 29937, 396, 779, 16266, 29912, 26074, 29934, 29874, 4198, 29923, 1181, 397, 1042, 29901, 17250, 848, 363, 779, 16266, 29912, 26074, 29934, 29874, 4198, 29923, 1042, 13, 29937, 13, 29937, 444, 838, 12961, 9664, 1061, 13, 29937, 13, 29937, 6118, 1643, 29912, 3332, 9458, 13, 29937, 13, 29937, 910, 3883, 8128, 1790, 2847, 848, 2984, 363, 779, 16266, 29912, 26074, 29934, 29874, 4198, 29923, 4311, 910, 338, 263, 12151, 29899, 1028, 562, 5410, 1243, 411, 2847, 848, 2046, 29909, 1665, 2876, 29913, 353, 320, 1154, 741, 2589, 320, 1707, 1631, 1157, 29878, 29985, 29941, 1118, 3997, 988, 29871, 779, 2589, 353, 350, 29918, 29886, 390, 1665, 1758, 3865, 29913, 847, 29871, 29906, 1628, 395, 29934, 1665, 1758, 3865, 1042, 338, 278, 11553, 1617, 5810, 11855, 29892, 322, 779, 1707, 1631, 353, 320, 3676, 29912, 29916, 29985, 29906, 29974, 29891, 29985, 29906, 1042, 338, 278, 20396, 513, 16888, 11855, 29889, 1334, 1235, 395, 29909, 29918, 29878, 353, 319, 3187, 3416, 353, 29871, 29900, 1504, 13, 29937, 13, 29937, 19814, 29892, 278, 4192, 2027, 12885, 395, 29894, 29985, 29875, 353, 320, 5981, 320, 4534, 29912, 29872, 2403, 29920, 320, 3706, 320, 4534, 29912, 29878, 29913, 353, 518, 13535, 29962, 320, 5981, 320, 4534, 29912, 29872, 2137, 29926, 29918, 29920, 921, 29985, 29895, 1628, 988, 11970, 13535, 9341, 338, 278, 951, 1403, 29899, 29907, 440, 2028, 20005, 362, 5829, 322, 779, 4534, 29912, 29872, 2137, 29875, 29918, 29920, 353, 313, 29900, 29892, 29900, 29892, 29896, 4935, 13, 13, 29937, 529, 29874, 1178, 2433, 1457, 2576, 262, 4314, 29915, 2565, 29874, 29958, 13, 29937, 13, 29937, 835, 2443, 567, 29871, 29900, 29899, 29896, 29901, 4721, 2576, 262, 4314, 13, 29937, 6118, 1643, 29912, 1457, 2576, 262, 4314, 9458, 13, 29937, 13, 29937, 5539, 5841, 304, 518, 3332, 10514, 3332, 2144, 29962, 13, 29937, 13, 29937, 2266, 29892, 591, 674, 1053, 278, 27759, 19737, 29974, 7136, 10585, 322, 731, 278, 3407, 12714, 304, 12370, 18970, 29892, 731, 15574, 1304, 27759, 19737, 29974, 4128, 29892, 322, 731, 315, 4128, 393, 674, 367, 731, 515, 5377, 278, 775, 10201, 5759, 515, 1438, 12241, 29889, 1334, 674, 884, 731, 701, 263, 3443, 304, 8161, 825, 2847, 848, 338, 731, 701, 29892, 5998, 372, 2113, 29915, 29873, 437, 1568, 3447, 29889, 13, 13, 13, 29937, 16696, 29871, 29900, 29901, 16032, 278, 27759, 19737, 29974, 7136, 10585, 322, 731, 278, 3407, 12714, 304, 12370, 18970, 13, 5215, 27759, 19737, 29918, 3207, 29918, 7692, 2395, 408, 610, 13, 5215, 27541, 4548, 408, 474, 26330, 13, 5215, 5016, 2272, 408, 805, 1669, 396, 10667, 19737, 29901, 450, 5132, 6601, 9623, 3577, 2501, 607, 27759, 19737, 29974, 7111, 13, 5215, 3407, 29918, 16414, 408, 364, 24826, 13, 862, 29889, 842, 29918, 862, 791, 29918, 3166, 29918, 710, 703, 5679, 29918, 16414, 1057, 7967, 536, 3924, 3284, 25233, 18970, 1159, 13, 9600, 29885, 29889, 5679, 29918, 16414, 580, 13, 13, 29937, 16696, 29871, 29896, 29874, 29901, 3789, 15574, 1304, 4128, 29889, 13, 1366, 5453, 353, 4770, 978, 1649, 13, 13, 29933, 29918, 29886, 29918, 13671, 29918, 5450, 1061, 29892, 29934, 29918, 3059, 29918, 13671, 29918, 5450, 1061, 353, 610, 29889, 29907, 16744, 703, 1525, 1964, 613, 1366, 5453, 29892, 13, 462, 462, 462, 965, 396, 350, 29918, 29886, 29918, 13671, 29918, 5450, 1061, 353, 278, 26171, 310, 278, 15611, 1746, 322, 13, 462, 462, 462, 965, 396, 390, 29918, 3059, 29918, 13671, 29918, 5450, 1061, 29922, 376, 8139, 329, 1617, 5810, 29908, 11855, 13, 462, 462, 462, 965, 6796, 29933, 29918, 29886, 29918, 13671, 29918, 5450, 1061, 3284, 29934, 29918, 3059, 29918, 13671, 29918, 5450, 1061, 12436, 13, 462, 462, 462, 965, 518, 29896, 29872, 29899, 29945, 29892, 29871, 29896, 29889, 29900, 2314, 13, 13, 29937, 450, 6401, 12885, 310, 278, 376, 17821, 1617, 5810, 29908, 13, 5981, 29918, 13671, 29918, 5450, 1061, 353, 610, 29889, 29907, 16744, 703, 1525, 1964, 613, 1366, 5453, 1699, 5981, 29918, 13671, 29918, 5450, 1061, 613, 29896, 29872, 29941, 29897, 13, 13, 29937, 529, 29874, 1178, 2433, 10568, 29906, 29915, 2565, 29874, 29958, 13, 29937, 13, 29937, 835, 16696, 29871, 29906, 29901, 3789, 278, 12047, 319, 297, 317, 8096, 936, 10350, 13, 29937, 6118, 1643, 29912, 10568, 29906, 9458, 13, 29937, 13, 29937, 5539, 5841, 304, 518, 3332, 10514, 3332, 2144, 29962, 13, 29937, 13, 29937, 1334, 674, 937, 2048, 278, 15281, 4608, 395, 29909, 29918, 29875, 29938, 297, 26903, 936, 10350, 313, 4149, 518, 3562, 29871, 29941, 850, 991, 597, 279, 26560, 29889, 990, 29914, 5140, 29914, 29896, 29955, 29900, 29946, 29889, 29900, 29900, 29945, 29929, 29929, 29889, 5140, 8106, 3940, 393, 591, 671, 3407, 29918, 16414, 29889, 2272, 304, 731, 395, 29878, 29938, 322, 779, 3416, 29938, 297, 4958, 310, 12370, 18970, 10350, 29936, 445, 674, 4078, 502, 263, 4331, 2678, 746, 591, 3588, 304, 12370, 18970, 10350, 29889, 1105, 29892, 591, 731, 13, 29937, 320, 463, 29912, 2520, 29913, 13, 29937, 319, 1665, 2876, 29913, 7878, 320, 1154, 741, 2589, 320, 1707, 1631, 1157, 29878, 29985, 29941, 1118, 2474, 13, 29937, 320, 355, 29912, 2520, 29913, 13, 29937, 411, 779, 2589, 353, 350, 29918, 29886, 390, 1665, 1758, 3865, 29913, 847, 29871, 29906, 1628, 395, 29934, 1665, 1758, 3865, 1042, 338, 278, 11553, 1617, 5810, 11855, 29892, 322, 779, 1707, 1631, 353, 320, 3676, 29912, 29916, 29985, 29906, 29974, 29891, 29985, 29906, 1042, 13, 13, 1753, 4406, 29934, 29874, 4198, 29923, 1181, 397, 29918, 16514, 19737, 29918, 2499, 12961, 29918, 21281, 1061, 7295, 13, 1678, 364, 268, 353, 364, 24826, 29889, 4419, 29903, 561, 29961, 29900, 29962, 13, 1678, 722, 1631, 353, 805, 29889, 3676, 29898, 9600, 29885, 29889, 4419, 29918, 517, 29918, 25233, 29961, 29900, 29962, 1068, 29906, 718, 364, 24826, 29889, 4419, 29918, 517, 29918, 25233, 29961, 29896, 29962, 1068, 29906, 29897, 13, 13, 1678, 3887, 353, 350, 29918, 29886, 29918, 13671, 29918, 5450, 1061, 334, 390, 29918, 3059, 29918, 13671, 29918, 5450, 1061, 1068, 29941, 847, 29871, 29906, 13, 13, 1678, 3339, 561, 29928, 353, 474, 26330, 29889, 3298, 272, 804, 29896, 580, 13, 13, 1678, 3339, 561, 29928, 29961, 29906, 29962, 353, 3887, 334, 722, 1631, 1068, 29906, 847, 313, 29878, 1068, 29941, 29897, 396, 450, 916, 7117, 892, 2307, 8052, 304, 367, 29871, 29900, 29889, 13, 13, 13, 1678, 396, 529, 29874, 1178, 2433, 10568, 29941, 29915, 2565, 29874, 29958, 13, 1678, 396, 13, 1678, 396, 835, 16696, 29871, 29941, 29901, 4803, 278, 10968, 713, 4636, 304, 4327, 278, 12047, 304, 12370, 18970, 10350, 29889, 13, 1678, 396, 6118, 1643, 29912, 10568, 29941, 9458, 13, 1678, 396, 13, 1678, 396, 5539, 5841, 304, 518, 3332, 10514, 3332, 2144, 29962, 13, 1678, 396, 13, 1678, 396, 2567, 29892, 591, 674, 671, 278, 14821, 13852, 15848, 4944, 491, 3407, 29918, 16414, 29889, 2272, 304, 2048, 278, 10968, 713, 13, 1678, 396, 2046, 13, 1678, 396, 320, 1154, 741, 3846, 921, 1665, 1758, 317, 561, 2137, 29926, 3331, 3846, 921, 1665, 1758, 12370, 2137, 29875, 1118, 13, 1678, 396, 2046, 13, 1678, 396, 988, 395, 29916, 1665, 1758, 317, 561, 2137, 29926, 320, 262, 9991, 29878, 2053, 3416, 2053, 2876, 11854, 322, 395, 29916, 1665, 1758, 12370, 2137, 29875, 320, 262, 9991, 29916, 29892, 29891, 29892, 29920, 23699, 1334, 723, 12891, 10272, 967, 16402, 29892, 541, 1951, 5642, 310, 278, 26855, 591, 817, 304, 4327, 505, 7568, 16285, 29892, 372, 338, 451, 5181, 29889, 1987, 29892, 1951, 395, 29909, 29918, 29875, 29938, 322, 756, 697, 5224, 2380, 29892, 372, 674, 817, 304, 367, 6674, 2957, 491, 278, 10968, 713, 29901, 13, 1678, 396, 13, 1678, 396, 2046, 13, 1678, 396, 319, 29918, 29875, 3311, 1758, 12370, 29913, 353, 319, 29918, 29926, 3311, 1758, 317, 561, 29913, 320, 1154, 741, 3846, 921, 1665, 1758, 317, 561, 2137, 29926, 3331, 3846, 921, 1665, 1758, 12370, 2137, 29875, 1118, 13, 1678, 396, 2046, 13, 13, 13, 1678, 396, 16696, 29871, 29941, 29901, 4803, 278, 10968, 713, 4636, 304, 4327, 278, 12047, 304, 12370, 18970, 10350, 29889, 13, 1678, 4192, 999, 16414, 1649, 8235, 29918, 29900, 15789, 5344, 353, 805, 29889, 14609, 4197, 29961, 1028, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29900, 1402, 9600, 29885, 29889, 4419, 29961, 29900, 11724, 805, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29900, 1402, 9600, 29885, 29889, 4419, 29961, 29896, 11724, 805, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29900, 1402, 9600, 29885, 29889, 4419, 29961, 29906, 2314, 1402, 13, 462, 462, 965, 518, 1028, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29896, 1402, 9600, 29885, 29889, 4419, 29961, 29900, 11724, 805, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29896, 1402, 9600, 29885, 29889, 4419, 29961, 29896, 11724, 805, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29896, 1402, 9600, 29885, 29889, 4419, 29961, 29906, 2314, 1402, 13, 462, 462, 965, 518, 1028, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29906, 1402, 9600, 29885, 29889, 4419, 29961, 29900, 11724, 805, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29906, 1402, 9600, 29885, 29889, 4419, 29961, 29896, 11724, 805, 29889, 12765, 29898, 9600, 29885, 29889, 4419, 29903, 561, 29961, 29906, 1402, 9600, 29885, 29889, 4419, 29961, 29906, 2314, 24960, 13, 1678, 396, 8235, 1649, 7707, 999, 16414, 29918, 29900, 15789, 5344, 353, 4192, 999, 16414, 1649, 8235, 29918, 29900, 15789, 5344, 29889, 11569, 580, 396, 1334, 1016, 29915, 29873, 2869, 817, 445, 297, 445, 1206, 29889, 13, 13, 1678, 5534, 11033, 13, 1678, 11033, 353, 474, 26330, 29889, 3298, 272, 804, 29896, 29898, 4571, 29924, 29922, 29941, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 4706, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 9651, 11033, 29961, 29875, 29962, 353, 4192, 999, 16414, 1649, 8235, 29918, 29900, 15789, 5344, 15625, 29926, 29892, 29875, 4638, 29930, 3289, 561, 29928, 29961, 29926, 29962, 13, 13, 13, 1678, 396, 529, 29874, 1178, 2433, 10568, 29946, 29915, 2565, 29874, 29958, 13, 1678, 396, 13, 1678, 396, 835, 16696, 29871, 29946, 29901, 20535, 403, 395, 29894, 29985, 29875, 29938, 13, 1678, 396, 6118, 1643, 29912, 10568, 29946, 9458, 13, 1678, 396, 13, 1678, 396, 5539, 5841, 304, 518, 3332, 10514, 3332, 2144, 29962, 13, 1678, 396, 13, 1678, 396, 2266, 29892, 591, 674, 8147, 278, 4192, 2027, 12885, 395, 29894, 29985, 29875, 353, 320, 5981, 320, 4534, 29912, 29872, 2403, 29920, 320, 3706, 320, 4534, 29912, 29878, 29913, 353, 518, 13535, 29962, 320, 5981, 320, 4534, 29912, 29872, 2137, 29926, 29918, 29920, 921, 29985, 29895, 1628, 988, 11970, 13535, 9341, 338, 278, 951, 1403, 29899, 29907, 440, 2028, 20005, 362, 5829, 322, 779, 4534, 29912, 29872, 2137, 29875, 29918, 29920, 353, 313, 29900, 29892, 29900, 29892, 29896, 4935, 1281, 854, 993, 368, 29892, 297, 12151, 2913, 29892, 278, 4192, 2027, 12885, 26830, 304, 278, 2630, 5760, 12885, 1363, 779, 2312, 353, 29871, 29896, 29938, 322, 779, 3571, 29985, 29875, 353, 29871, 29900, 1504, 13, 13, 13, 1678, 396, 16696, 29871, 29946, 29901, 20535, 403, 325, 29985, 29875, 13, 1678, 951, 1403, 29907, 440, 2028, 14730, 7858, 29928, 353, 474, 26330, 29889, 3226, 1403, 29907, 440, 2028, 14730, 29918, 6229, 29941, 29918, 10003, 29941, 580, 13, 13, 1678, 1053, 3080, 29918, 7976, 29918, 392, 29918, 29925, 347, 346, 3538, 29918, 27404, 1080, 408, 694, 361, 13, 13, 1678, 5190, 29918, 29920, 29965, 353, 474, 26330, 29889, 3298, 272, 804, 29896, 580, 13, 1678, 5190, 29918, 29920, 29965, 29961, 29906, 29962, 353, 805, 29889, 11967, 29886, 1598, 29898, 29896, 29897, 13, 13, 1678, 5534, 2630, 5760, 29894, 29965, 13, 1678, 2630, 5760, 29894, 29965, 353, 474, 26330, 29889, 3298, 272, 804, 29896, 580, 13, 1678, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 4706, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 9651, 363, 413, 297, 3464, 29898, 29941, 1125, 13, 18884, 2630, 5760, 29894, 29965, 29961, 29875, 29962, 4619, 694, 361, 29889, 1111, 536, 29918, 3797, 29918, 9917, 29898, 29878, 29892, 29934, 29918, 3059, 29918, 13671, 29918, 5450, 1061, 11877, 3226, 1403, 29907, 440, 2028, 14730, 7858, 29928, 29961, 29875, 3816, 29926, 3816, 29895, 29962, 334, 13352, 2442, 29918, 13671, 29918, 5450, 1061, 334, 5190, 29918, 29920, 29965, 29961, 29926, 29962, 334, 364, 24826, 29889, 4419, 29961, 29895, 29962, 13, 13, 13, 1678, 396, 835, 27759, 19737, 29974, 15591, 5920, 15758, 362, 13, 1678, 396, 13, 1678, 396, 5539, 5841, 304, 518, 3332, 10514, 3332, 2144, 29962, 13, 1678, 396, 13, 1678, 396, 2266, 29892, 408, 263, 775, 8845, 1423, 29892, 591, 11539, 17327, 297, 278, 10667, 19737, 12241, 363, 278, 779, 16266, 29912, 26074, 29934, 29874, 4198, 29923, 1042, 838, 12961, 9664, 1061, 2847, 848, 10693, 29871, 591, 24042, 304, 671, 1546, 13, 1678, 396, 29871, 29896, 29889, 445, 9673, 322, 13, 1678, 396, 29871, 29906, 29889, 278, 27759, 19737, 29974, 518, 26074, 29934, 29874, 4198, 29923, 1181, 397, 29918, 16514, 19737, 29918, 2499, 12961, 29918, 21281, 1061, 29889, 2272, 850, 6995, 5628, 29914, 26074, 29934, 29874, 4198, 29923, 1181, 397, 29918, 16514, 19737, 29914, 26074, 29934, 29874, 4198, 29923, 1181, 397, 29918, 16514, 19737, 29918, 2499, 12961, 29918, 21281, 1061, 29889, 2272, 29897, 3883, 29889, 13, 1678, 396, 13, 13, 13, 13, 13, 2 ]
farm/__init__.py
ViktorAlm/FARM
2
68126
import logging import torch.multiprocessing as mp logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO, ) # reduce verbosity from transformers library logging.getLogger('transformers.configuration_utils').setLevel(logging.WARNING) # https://pytorch.org/docs/stable/multiprocessing.html#sharing-strategies if "file_descriptor" in mp.get_all_sharing_strategies(): import resource mp.set_sharing_strategy("file_descriptor") rlimit = resource.getrlimit(resource.RLIMIT_NOFILE) # seting soft limit to hard limit (=rlimit[1]) minus a small amount to be safe resource.setrlimit(resource.RLIMIT_NOFILE, (rlimit[1]-512, rlimit[1]))
[ 1, 1053, 12183, 13, 13, 5215, 4842, 305, 29889, 18056, 307, 985, 292, 408, 22326, 13, 13, 21027, 29889, 16121, 3991, 29898, 13, 1678, 3402, 543, 29995, 29898, 294, 312, 603, 29897, 29879, 448, 1273, 29898, 5563, 978, 29897, 29879, 448, 1273, 29898, 978, 29897, 29879, 448, 259, 1273, 29898, 4906, 29897, 29879, 613, 13, 1678, 2635, 23479, 543, 29995, 29885, 22584, 29881, 22584, 29979, 1273, 29950, 16664, 29924, 16664, 29903, 613, 13, 1678, 3233, 29922, 21027, 29889, 11690, 29892, 13, 29897, 13, 13, 29937, 10032, 9750, 359, 537, 515, 4327, 414, 3489, 13, 21027, 29889, 657, 16363, 877, 9067, 414, 29889, 13305, 29918, 13239, 2824, 842, 10108, 29898, 21027, 29889, 29956, 25614, 29897, 13, 13, 29937, 2045, 597, 2272, 7345, 305, 29889, 990, 29914, 2640, 29914, 13844, 29914, 18056, 307, 985, 292, 29889, 1420, 29937, 845, 4362, 29899, 710, 1845, 583, 13, 361, 376, 1445, 29918, 2783, 11709, 29908, 297, 22326, 29889, 657, 29918, 497, 29918, 845, 4362, 29918, 710, 1845, 583, 7295, 13, 1678, 1053, 6503, 13, 13, 1678, 22326, 29889, 842, 29918, 845, 4362, 29918, 710, 8963, 703, 1445, 29918, 2783, 11709, 1159, 13, 13, 1678, 364, 13400, 353, 6503, 29889, 657, 2096, 13083, 29898, 10314, 29889, 2241, 7833, 1806, 29918, 6632, 7724, 29897, 13, 1678, 396, 731, 292, 4964, 4046, 304, 2898, 4046, 11070, 2096, 13083, 29961, 29896, 2314, 26134, 263, 2319, 5253, 304, 367, 9109, 13, 1678, 6503, 29889, 842, 2096, 13083, 29898, 10314, 29889, 2241, 7833, 1806, 29918, 6632, 7724, 29892, 313, 2096, 13083, 29961, 29896, 29962, 29899, 29945, 29896, 29906, 29892, 364, 13400, 29961, 29896, 12622, 13, 2 ]
misago/misago/users/migrations/0003_bans_version_tracker.py
vascoalramos/misago-deployment
2
1604943
<filename>misago/misago/users/migrations/0003_bans_version_tracker.py<gh_stars>1-10 from django.db import migrations class Migration(migrations.Migration): """Migration superseded by 0016""" dependencies = [ ("misago_users", "0002_users_settings"), ("misago_core", "0001_initial"), ] operations = []
[ 1, 529, 9507, 29958, 26737, 4425, 29914, 26737, 4425, 29914, 7193, 29914, 26983, 800, 29914, 29900, 29900, 29900, 29941, 29918, 29890, 550, 29918, 3259, 29918, 3018, 4937, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 1678, 9995, 29924, 16783, 480, 6774, 19226, 491, 29871, 29900, 29900, 29896, 29953, 15945, 29908, 13, 13, 1678, 9962, 353, 518, 13, 4706, 4852, 26737, 4425, 29918, 7193, 613, 376, 29900, 29900, 29900, 29906, 29918, 7193, 29918, 11027, 4968, 13, 4706, 4852, 26737, 4425, 29918, 3221, 613, 376, 29900, 29900, 29900, 29896, 29918, 11228, 4968, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 5159, 13, 2 ]
notebooks/sports/interactive.py
callysto/lesson-plans
2
123756
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 30 2021 @author: TinaL5, adapted from lisacao, <NAME>. """ # libraries import random ################################ TEXT ENCODING def soccer(text): # blocked out grey with emoji rvr = "\033[1;35m ⚽️ : \033[1;0m" + text + "\033[1;0m" return rvr def task(text, check = False): # light blue with emoji option if check == True: blu = "\033[1;36m" + "✅ " + text + "\033[1;0m" return blu else: blu = "\033[1;36m" + text + "\033[1;0m" return blu def bedazzle(text): # purple with randomized emoji sparkle = [" 🌟 ", " 🎉 ", " 🥳 ", " 🤩 ", " 🏆 ", " 😎 "] prl = "\033[1;35m" + random.choice(sparkle) + text + "\033[1;0m" return prl def normal(text): # plain black nrl = "\033[1;0m" + text + "\033[1;0m" return nrl def code(text): # bright green grn = "\033[1;32m" + text + "\033[1;0m" return grn def tryagain(text, exclaim = True): # red with default emoji if exclaim == False: red = "\033[1;31m" + text + "\033[1;0m" return red else: red = "\033[1;31m" + "❗️ " + text + "\033[1;0m" return red # positive feedback for correct answers def correct_answer(): # random positive reinforcement compliment = ["Amazing work!", "Nice job!", "Right on!", "You're out of this world!", "Great stuff!", "You rock!", "I wish I were this good!", "Correct!", "That was great!", "You're picking up on this really well!"] nice = print(bedazzle(random.choice(compliment))) return nice ################################ CHALLENGE 1 # Question 1 def challenge1(): # interpretation of scatter plots print(soccer(" Go back and look at the scatter plot Relationship between average ball possession (%) and total goals. The data points further from the trend line seem to tell a different story.\n"), task("Hover over the data points to find the team with average ball possession of 44% and 16 total goals. ", check = True)) def Q1a(): # Monchengladbach total goals ans1 = str(input(normal("The team is: "))) if ans1 == "Monchengladbach": correct_answer() else: print(tryagain(" Make sure to locate ball possession on the x-axis and total goals on the y-axis."),tryagain(" The team name starts with an M.", exclaim = False)) Q1a() #execute Q1a() ################################ CHALLENGE 2 # Question 2 def challenge2(): # interpretation of scatter plots print(soccer(" Go back and look at the scatter plot Relationship between average ball possession (%) and goal difference by team. Let's try to gain more insight into Monchengladbach who ties second with total goals of 16.\n"), task("Hover over the data points to determine Monchengladbach's goal difference. ", check = True)) def Q2a(): # Monchengladbach goal difference ans1 = str(input(normal("Monchengladbach's goal difference is: "))) if ans1 == "7": correct_answer() else: print(tryagain(" Make sure to locate average ball possession of 44% on the x-axis.", exclaim = False)) Q2a() #execute Q2a() ################################ CHALLENGE 3 # Question 3 def challenge3(): # interpretation of scatter plots print(soccer(" Looking at the scatter plot Relationship between average ball possession (%) and goal difference by team, try to find the team with the second lowest average ball possession of 41%, total goals of 10, and a goal difference of 7.\n"), task("Hover over the data points to locate the team. ", check = True)) def Q3a(): # Porto ans1 = str(input(normal("The team is: "))) if ans1 == "Porto": correct_answer() print('Porto only had 3 goals scored against them with their opponents possessing the ball 56% of the time and they were able to score 10 goals!') else: print(tryagain(" Make sure to locate average ball possession of 41% on the x-axis and goal difference of 7 on the y-axis. The team's name starts with a P.", exclaim = False)) Q3a() #execute Q3a()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 373, 323, 434, 1085, 29871, 29941, 29900, 29871, 29906, 29900, 29906, 29896, 13, 13, 29992, 8921, 29901, 323, 1099, 29931, 29945, 29892, 23430, 515, 301, 275, 562, 6241, 29892, 529, 5813, 15513, 13, 15945, 29908, 13, 13, 29937, 9562, 13, 5215, 4036, 13, 13, 13383, 13383, 323, 12194, 12524, 3217, 29928, 4214, 13, 13, 1753, 269, 11953, 29898, 726, 1125, 396, 24370, 714, 18345, 411, 953, 29877, 2397, 13, 1678, 364, 13416, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29945, 29885, 29871, 229, 157, 192, 30598, 584, 320, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 1678, 736, 364, 13416, 13, 13, 1753, 3414, 29898, 726, 29892, 1423, 353, 7700, 1125, 396, 3578, 7254, 411, 953, 29877, 2397, 2984, 13, 1678, 565, 1423, 1275, 5852, 29901, 13, 4706, 1999, 29884, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29953, 29885, 29908, 718, 376, 31681, 376, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 4706, 736, 1999, 29884, 13, 1678, 1683, 29901, 13, 4706, 1999, 29884, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29953, 29885, 29908, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 4706, 736, 1999, 29884, 13, 13, 1753, 6592, 7511, 280, 29898, 726, 1125, 396, 3708, 552, 411, 4036, 1891, 29871, 953, 29877, 2397, 29871, 13, 268, 16267, 280, 353, 6796, 29871, 243, 162, 143, 162, 9162, 376, 29871, 243, 162, 145, 140, 9162, 376, 29871, 243, 162, 168, 182, 9162, 376, 29871, 243, 162, 167, 172, 9162, 376, 29871, 243, 162, 146, 137, 9162, 376, 29871, 243, 162, 155, 145, 376, 29962, 13, 268, 544, 29880, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29945, 29885, 29908, 718, 4036, 29889, 16957, 29898, 12597, 280, 29897, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 268, 736, 544, 29880, 13, 1678, 13, 1753, 4226, 29898, 726, 1125, 396, 8656, 4628, 29871, 13, 268, 302, 2096, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 268, 736, 302, 2096, 13, 29871, 13, 1753, 775, 29898, 726, 1125, 396, 11785, 7933, 29871, 13, 268, 867, 29876, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29906, 29885, 29908, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 268, 736, 867, 29876, 13, 29871, 13, 1753, 1018, 351, 475, 29898, 726, 29892, 5566, 8342, 353, 5852, 1125, 396, 2654, 411, 2322, 953, 29877, 2397, 29871, 13, 1678, 565, 5566, 8342, 1275, 7700, 29901, 13, 4706, 2654, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29896, 29885, 29908, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 4706, 736, 2654, 13, 1678, 1683, 29901, 13, 4706, 2654, 353, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29941, 29896, 29885, 29908, 718, 376, 229, 160, 154, 30598, 376, 718, 1426, 718, 6634, 29900, 29941, 29941, 29961, 29896, 29936, 29900, 29885, 29908, 13, 4706, 736, 2654, 13, 13, 29937, 6374, 16705, 363, 1959, 6089, 13, 1753, 1959, 29918, 12011, 7295, 396, 4036, 6374, 15561, 1454, 13561, 13, 1678, 13162, 2073, 353, 6796, 29909, 16986, 292, 664, 29991, 613, 376, 29940, 625, 4982, 29991, 613, 376, 7341, 373, 29991, 613, 376, 3492, 29915, 276, 714, 310, 445, 3186, 29991, 613, 376, 25120, 271, 6433, 29991, 613, 376, 3492, 7679, 29991, 613, 376, 29902, 6398, 306, 892, 445, 1781, 29991, 613, 376, 12521, 1621, 29991, 613, 376, 7058, 471, 2107, 29991, 613, 376, 3492, 29915, 276, 5839, 292, 701, 373, 445, 2289, 1532, 29991, 3108, 13, 1678, 7575, 353, 1596, 29898, 2580, 7511, 280, 29898, 8172, 29889, 16957, 29898, 510, 572, 2073, 4961, 13, 1678, 736, 7575, 29871, 13, 13, 13, 13383, 13383, 5868, 1964, 1307, 29940, 1692, 29871, 29896, 13, 13, 29937, 894, 29871, 29896, 29871, 13, 1753, 18766, 29896, 7295, 396, 19854, 310, 14801, 24580, 13, 1678, 1596, 29898, 29879, 11953, 703, 2921, 1250, 322, 1106, 472, 278, 14801, 6492, 6376, 800, 4034, 1546, 6588, 8287, 17715, 313, 10997, 322, 3001, 14433, 29889, 450, 848, 3291, 4340, 515, 278, 534, 355, 1196, 2833, 304, 2649, 263, 1422, 5828, 7790, 29876, 4968, 3414, 703, 29950, 957, 975, 278, 848, 3291, 304, 1284, 278, 3815, 411, 6588, 8287, 17715, 310, 29871, 29946, 29946, 29995, 322, 29871, 29896, 29953, 3001, 14433, 29889, 9162, 1423, 353, 5852, 876, 13, 1678, 822, 660, 29896, 29874, 7295, 396, 2598, 305, 996, 4528, 6740, 3001, 14433, 13, 4706, 6063, 29896, 353, 851, 29898, 2080, 29898, 8945, 703, 1576, 3815, 338, 29901, 376, 4961, 13, 4706, 565, 6063, 29896, 1275, 376, 7185, 305, 996, 4528, 6740, 1115, 13, 9651, 1959, 29918, 12011, 580, 13, 4706, 1683, 29901, 29871, 13, 9651, 1596, 29898, 2202, 351, 475, 703, 8561, 1854, 304, 26694, 8287, 17715, 373, 278, 921, 29899, 8990, 322, 3001, 14433, 373, 278, 343, 29899, 8990, 1213, 511, 2202, 351, 475, 703, 450, 3815, 1024, 8665, 411, 385, 341, 19602, 5566, 8342, 353, 7700, 876, 13, 9651, 660, 29896, 29874, 580, 13, 13, 1678, 396, 7978, 13, 1678, 660, 29896, 29874, 580, 13, 632, 13, 13383, 13383, 5868, 1964, 1307, 29940, 1692, 29871, 29906, 13, 13, 29937, 894, 29871, 29906, 29871, 13, 1753, 18766, 29906, 7295, 396, 19854, 310, 14801, 24580, 13, 1678, 1596, 29898, 29879, 11953, 703, 2921, 1250, 322, 1106, 472, 278, 14801, 6492, 6376, 800, 4034, 1546, 6588, 8287, 17715, 313, 10997, 322, 7306, 4328, 491, 3815, 29889, 2803, 29915, 29879, 1018, 304, 11581, 901, 25483, 964, 2598, 305, 996, 4528, 6740, 1058, 260, 583, 1473, 411, 3001, 14433, 310, 29871, 29896, 29953, 7790, 29876, 4968, 3414, 703, 29950, 957, 975, 278, 848, 3291, 304, 8161, 2598, 305, 996, 4528, 6740, 29915, 29879, 7306, 4328, 29889, 9162, 1423, 353, 5852, 876, 13, 1678, 822, 660, 29906, 29874, 7295, 396, 2598, 305, 996, 4528, 6740, 7306, 4328, 13, 4706, 6063, 29896, 353, 851, 29898, 2080, 29898, 8945, 703, 7185, 305, 996, 4528, 6740, 29915, 29879, 7306, 4328, 338, 29901, 376, 4961, 13, 4706, 565, 6063, 29896, 1275, 376, 29955, 1115, 13, 9651, 1959, 29918, 12011, 580, 13, 4706, 1683, 29901, 29871, 13, 9651, 1596, 29898, 2202, 351, 475, 703, 8561, 1854, 304, 26694, 6588, 8287, 17715, 310, 29871, 29946, 29946, 29995, 373, 278, 921, 29899, 8990, 19602, 5566, 8342, 353, 7700, 876, 13, 9651, 660, 29906, 29874, 580, 13, 632, 13, 1678, 396, 7978, 13, 1678, 660, 29906, 29874, 580, 9651, 13, 632, 13, 632, 13, 13383, 13383, 5868, 1964, 1307, 29940, 1692, 29871, 29941, 13, 13, 29937, 894, 29871, 29941, 29871, 13, 1753, 18766, 29941, 7295, 396, 19854, 310, 14801, 24580, 13, 1678, 1596, 29898, 29879, 11953, 703, 21223, 472, 278, 14801, 6492, 6376, 800, 4034, 1546, 6588, 8287, 17715, 313, 10997, 322, 7306, 4328, 491, 3815, 29892, 1018, 304, 1284, 278, 3815, 411, 278, 1473, 19604, 6588, 8287, 17715, 310, 29871, 29946, 29896, 13667, 3001, 14433, 310, 29871, 29896, 29900, 29892, 322, 263, 7306, 4328, 310, 29871, 29955, 7790, 29876, 4968, 3414, 703, 29950, 957, 975, 278, 848, 3291, 304, 26694, 278, 3815, 29889, 9162, 1423, 353, 5852, 876, 13, 1678, 822, 660, 29941, 29874, 7295, 396, 24804, 13, 4706, 6063, 29896, 353, 851, 29898, 2080, 29898, 8945, 703, 1576, 3815, 338, 29901, 376, 4961, 13, 4706, 565, 6063, 29896, 1275, 376, 2290, 29877, 1115, 13, 9651, 1959, 29918, 12011, 580, 13, 9651, 1596, 877, 2290, 29877, 871, 750, 29871, 29941, 14433, 15569, 2750, 963, 411, 1009, 23995, 1237, 22592, 292, 278, 8287, 29871, 29945, 29953, 29995, 310, 278, 931, 322, 896, 892, 2221, 304, 8158, 29871, 29896, 29900, 14433, 29991, 1495, 13, 4706, 1683, 29901, 29871, 13, 9651, 1596, 29898, 2202, 351, 475, 703, 8561, 1854, 304, 26694, 6588, 8287, 17715, 310, 29871, 29946, 29896, 29995, 373, 278, 921, 29899, 8990, 322, 7306, 4328, 310, 29871, 29955, 373, 278, 343, 29899, 8990, 29889, 450, 3815, 29915, 29879, 1024, 8665, 411, 263, 349, 19602, 5566, 8342, 353, 7700, 876, 13, 9651, 660, 29941, 29874, 580, 13, 632, 13, 1678, 396, 7978, 13, 1678, 660, 29941, 29874, 580, 29871, 2 ]
stocks/__init__.py
xBlynd/FlameCogs
0
99092
<filename>stocks/__init__.py from .stocks import Stocks def setup(bot): bot.add_cog(Stocks(bot))
[ 1, 529, 9507, 29958, 17712, 29879, 29914, 1649, 2344, 26914, 2272, 13, 3166, 869, 17712, 29879, 1053, 6639, 4684, 13, 13, 1753, 6230, 29898, 7451, 1125, 13, 12, 7451, 29889, 1202, 29918, 29883, 468, 29898, 20754, 4684, 29898, 7451, 876, 13, 2 ]
models/tot_metrics.py
GU-DataLab/fairness-and-missing-values
0
114270
<gh_stars>0 # pred is the list of predicted labels, sensitive is the list of labels for sensitive attribute # unprotected_vals is the label for unprotected group. e.g. 1 means unprivilege, 0 means privilege # positive_pred is the favorable result in prediction task. e.g. get approved for a loan def DIbinary(pred,sensitive,unprotected_vals,positive_pred): unprotected_positive = 0.0 unprotected_negative = 0.0 protected_positive = 0.0 protected_negative = 0.0 for i in range(0, len(pred)): protected_val = sensitive[i] predicted_val = pred[i] # when someone is in unprotected group if protected_val in unprotected_vals: if int(predicted_val) == int(positive_pred): unprotected_positive += 1 else: unprotected_negative += 1 # the person is in protected group ie male = 0 else: if int(predicted_val) == int(positive_pred): protected_positive += 1 else: protected_negative += 1 protected_pos_percent = 0.0 if protected_positive + protected_negative > 0: protected_pos_percent = protected_positive / (protected_positive + protected_negative) unprotected_pos_percent = 0.0 if unprotected_positive + unprotected_negative > 0: unprotected_pos_percent = unprotected_positive / \ (unprotected_positive + unprotected_negative) return unprotected_pos_percent, protected_pos_percent def CV(pred,sensitive,unprotected_vals,positive_pred): protected_pos_percent, unprotected_pos_percent = DIbinary(pred, sensitive, unprotected_vals,positive_pred) cv = unprotected_pos_percent -protected_pos_percent return 1 - cv # acutal is the list of actual labels, pred is the list of predicted labels. # sensitive is the column of sensitive attribute, target_group is s in S = s # positive_pred is the favorable result in prediction task. e.g. get approved for a loan def calibration_pos(actual,pred,sensitive,target_group,positive_pred): tot_pred_pos = 0 act_pos = 0 for act, pred_val, sens in zip(actual, pred,sensitive): # the case S != s if sens != target_group: continue else: # Yhat = 1 if pred_val == positive_pred: tot_pred_pos += 1 # the case both Yhat = 1 and Y = 1 if act == positive_pred: act_pos +=1 if act_pos == 0 and tot_pred_pos ==0: return 1 if tot_pred_pos == 0: return 0 return act_pos/tot_pred_pos from sklearn.metrics import confusion_matrix # acutal is the list of actual labels, pred is the list of predicted labels. # positive_pred is the favorable result in prediction task. e.g. get approved for a loan def TNR(actual,pred,positive_pred): classes = list(set(actual)) matrix = confusion_matrix(actual, pred, labels=classes) TN = 0.0 allN = 0.0 for i in range(0, len(classes)): trueval = classes[i] if trueval == positive_pred: continue for j in range(0, len(classes)): allN += matrix[i][j] predval = classes[j] if trueval == predval: TN += matrix[i][j] if allN == 0.0: return 1.0 return TN / allN from sklearn.metrics import recall_score # acutal is the list of actual labels, pred is the list of predicted labels. # positive_pred is the favorable result in prediction task. e.g. get approved for a loan def TPR(actual,pred,positive_pred): return recall_score(actual,pred,pos_label = positive_pred,average = 'binary') # acutal is the list of actual labels, pred is the list of predicted labels. # positive_pred is the favorable result in prediction task. e.g. get approved for a loan def get_BCR(actual,pred,positive_pred): tpr_val = TPR(actual,pred,positive_pred) tnr_val = TNR(actual,pred,positive_pred) bcr = (tpr_val + tnr_val) / 2.0 return bcr
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 4450, 338, 278, 1051, 310, 25383, 11073, 29892, 20502, 338, 278, 1051, 310, 11073, 363, 20502, 5352, 13, 29937, 443, 24681, 29918, 791, 29879, 338, 278, 3858, 363, 443, 24681, 2318, 29889, 321, 29889, 29887, 29889, 29871, 29896, 2794, 443, 22534, 488, 479, 29892, 29871, 29900, 2794, 14828, 479, 13, 29937, 6374, 29918, 11965, 338, 278, 7853, 519, 1121, 297, 18988, 3414, 29889, 321, 29889, 29887, 29889, 679, 23454, 363, 263, 24806, 13, 1753, 22471, 19541, 29898, 11965, 29892, 23149, 3321, 29892, 348, 24681, 29918, 791, 29879, 29892, 1066, 3321, 29918, 11965, 1125, 13, 1678, 443, 24681, 29918, 1066, 3321, 353, 29871, 29900, 29889, 29900, 13, 1678, 443, 24681, 29918, 22198, 353, 29871, 29900, 29889, 29900, 13, 1678, 6364, 29918, 1066, 3321, 353, 29871, 29900, 29889, 29900, 13, 1678, 6364, 29918, 22198, 353, 29871, 29900, 29889, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 11965, 22164, 13, 4706, 6364, 29918, 791, 353, 20502, 29961, 29875, 29962, 13, 4706, 25383, 29918, 791, 353, 4450, 29961, 29875, 29962, 13, 4706, 396, 746, 4856, 338, 297, 443, 24681, 2318, 13, 4706, 565, 6364, 29918, 791, 297, 443, 24681, 29918, 791, 29879, 29901, 13, 9651, 565, 938, 29898, 11965, 18186, 29918, 791, 29897, 1275, 938, 29898, 1066, 3321, 29918, 11965, 1125, 13, 18884, 443, 24681, 29918, 1066, 3321, 4619, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 443, 24681, 29918, 22198, 4619, 29871, 29896, 13, 4706, 396, 278, 2022, 338, 297, 6364, 2318, 19282, 14263, 353, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 565, 938, 29898, 11965, 18186, 29918, 791, 29897, 1275, 938, 29898, 1066, 3321, 29918, 11965, 1125, 13, 18884, 6364, 29918, 1066, 3321, 4619, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 6364, 29918, 22198, 4619, 29871, 29896, 13, 1678, 6364, 29918, 1066, 29918, 25376, 353, 29871, 29900, 29889, 29900, 13, 1678, 565, 6364, 29918, 1066, 3321, 718, 6364, 29918, 22198, 1405, 29871, 29900, 29901, 13, 4706, 6364, 29918, 1066, 29918, 25376, 353, 6364, 29918, 1066, 3321, 847, 313, 24681, 29918, 1066, 3321, 718, 6364, 29918, 22198, 29897, 13, 1678, 443, 24681, 29918, 1066, 29918, 25376, 353, 29871, 29900, 29889, 29900, 13, 1678, 565, 443, 24681, 29918, 1066, 3321, 718, 443, 24681, 29918, 22198, 1405, 29871, 29900, 29901, 13, 4706, 443, 24681, 29918, 1066, 29918, 25376, 353, 443, 24681, 29918, 1066, 3321, 847, 29871, 320, 13, 9651, 313, 348, 24681, 29918, 1066, 3321, 718, 443, 24681, 29918, 22198, 29897, 13, 1678, 736, 443, 24681, 29918, 1066, 29918, 25376, 29892, 6364, 29918, 1066, 29918, 25376, 13, 13, 13, 13, 1753, 25778, 29898, 11965, 29892, 23149, 3321, 29892, 348, 24681, 29918, 791, 29879, 29892, 1066, 3321, 29918, 11965, 1125, 13, 1678, 6364, 29918, 1066, 29918, 25376, 29892, 443, 24681, 29918, 1066, 29918, 25376, 353, 22471, 19541, 29898, 11965, 29892, 20502, 29892, 443, 24681, 29918, 791, 29879, 29892, 1066, 3321, 29918, 11965, 29897, 13, 1678, 13850, 353, 443, 24681, 29918, 1066, 29918, 25376, 448, 24681, 29918, 1066, 29918, 25376, 13, 1678, 736, 29871, 29896, 448, 13850, 13, 13, 29937, 1274, 329, 284, 338, 278, 1051, 310, 3935, 11073, 29892, 4450, 338, 278, 1051, 310, 25383, 11073, 29889, 13, 29937, 20502, 338, 278, 1897, 310, 20502, 5352, 29892, 3646, 29918, 2972, 338, 269, 297, 317, 353, 269, 13, 29937, 6374, 29918, 11965, 338, 278, 7853, 519, 1121, 297, 18988, 3414, 29889, 321, 29889, 29887, 29889, 679, 23454, 363, 263, 24806, 13, 1753, 1208, 26218, 29918, 1066, 29898, 19304, 29892, 11965, 29892, 23149, 3321, 29892, 5182, 29918, 2972, 29892, 1066, 3321, 29918, 11965, 1125, 13, 1678, 2025, 29918, 11965, 29918, 1066, 353, 29871, 29900, 13, 1678, 1044, 29918, 1066, 353, 29871, 29900, 13, 1678, 363, 1044, 29892, 4450, 29918, 791, 29892, 4771, 297, 14319, 29898, 19304, 29892, 4450, 29892, 23149, 3321, 1125, 13, 4706, 396, 278, 1206, 317, 2804, 269, 13, 308, 565, 4771, 2804, 3646, 29918, 2972, 29901, 13, 632, 6773, 13, 308, 1683, 29901, 13, 632, 396, 612, 2455, 353, 29871, 29896, 13, 632, 565, 4450, 29918, 791, 1275, 6374, 29918, 11965, 29901, 13, 462, 2025, 29918, 11965, 29918, 1066, 4619, 29871, 29896, 13, 462, 396, 278, 1206, 1716, 612, 2455, 353, 29871, 29896, 322, 612, 353, 29871, 29896, 13, 462, 565, 1044, 1275, 6374, 29918, 11965, 29901, 13, 462, 268, 1044, 29918, 1066, 4619, 29896, 13, 1678, 565, 1044, 29918, 1066, 1275, 29871, 29900, 322, 2025, 29918, 11965, 29918, 1066, 1275, 29900, 29901, 13, 4706, 736, 29871, 29896, 13, 1678, 565, 2025, 29918, 11965, 29918, 1066, 1275, 29871, 29900, 29901, 13, 4706, 736, 29871, 29900, 13, 1678, 736, 1044, 29918, 1066, 29914, 4260, 29918, 11965, 29918, 1066, 13, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 14679, 29918, 5344, 13, 13, 29937, 1274, 329, 284, 338, 278, 1051, 310, 3935, 11073, 29892, 4450, 338, 278, 1051, 310, 25383, 11073, 29889, 13, 29937, 6374, 29918, 11965, 338, 278, 7853, 519, 1121, 297, 18988, 3414, 29889, 321, 29889, 29887, 29889, 679, 23454, 363, 263, 24806, 13, 1753, 323, 16514, 29898, 19304, 29892, 11965, 29892, 1066, 3321, 29918, 11965, 1125, 13, 1678, 4413, 353, 1051, 29898, 842, 29898, 19304, 876, 13, 1678, 4636, 353, 14679, 29918, 5344, 29898, 19304, 29892, 4450, 29892, 11073, 29922, 13203, 29897, 13, 1678, 323, 29940, 353, 29871, 29900, 29889, 29900, 13, 1678, 599, 29940, 353, 29871, 29900, 29889, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 13203, 22164, 13, 4706, 1565, 791, 353, 4413, 29961, 29875, 29962, 13, 4706, 565, 1565, 791, 1275, 6374, 29918, 11965, 29901, 13, 9651, 6773, 13, 4706, 363, 432, 297, 3464, 29898, 29900, 29892, 7431, 29898, 13203, 22164, 13, 9651, 599, 29940, 4619, 4636, 29961, 29875, 3816, 29926, 29962, 13, 9651, 4450, 791, 353, 4413, 29961, 29926, 29962, 13, 9651, 565, 1565, 791, 1275, 4450, 791, 29901, 13, 18884, 323, 29940, 4619, 4636, 29961, 29875, 3816, 29926, 29962, 13, 1678, 565, 599, 29940, 1275, 29871, 29900, 29889, 29900, 29901, 13, 4706, 736, 29871, 29896, 29889, 29900, 13, 1678, 736, 323, 29940, 847, 599, 29940, 13, 13, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 17386, 29918, 13628, 13, 29937, 1274, 329, 284, 338, 278, 1051, 310, 3935, 11073, 29892, 4450, 338, 278, 1051, 310, 25383, 11073, 29889, 13, 29937, 6374, 29918, 11965, 338, 278, 7853, 519, 1121, 297, 18988, 3414, 29889, 321, 29889, 29887, 29889, 679, 23454, 363, 263, 24806, 13, 1753, 323, 10593, 29898, 19304, 29892, 11965, 29892, 1066, 3321, 29918, 11965, 1125, 13, 1678, 736, 17386, 29918, 13628, 29898, 19304, 29892, 11965, 29892, 1066, 29918, 1643, 353, 6374, 29918, 11965, 29892, 12483, 482, 353, 525, 19541, 1495, 13, 13, 13, 29937, 1274, 329, 284, 338, 278, 1051, 310, 3935, 11073, 29892, 4450, 338, 278, 1051, 310, 25383, 11073, 29889, 13, 29937, 6374, 29918, 11965, 338, 278, 7853, 519, 1121, 297, 18988, 3414, 29889, 321, 29889, 29887, 29889, 679, 23454, 363, 263, 24806, 13, 1753, 679, 29918, 5371, 29934, 29898, 19304, 29892, 11965, 29892, 1066, 3321, 29918, 11965, 1125, 13, 1678, 260, 558, 29918, 791, 353, 323, 10593, 29898, 19304, 29892, 11965, 29892, 1066, 3321, 29918, 11965, 29897, 13, 1678, 260, 22230, 29918, 791, 353, 323, 16514, 29898, 19304, 29892, 11965, 29892, 1066, 3321, 29918, 11965, 29897, 13, 1678, 289, 7283, 353, 313, 29873, 558, 29918, 791, 718, 260, 22230, 29918, 791, 29897, 847, 29871, 29906, 29889, 29900, 13, 1678, 736, 289, 7283, 13, 2 ]
ceilometer/notifier.py
aristanetworks/ceilometer
2
70387
<reponame>aristanetworks/ceilometer # # Copyright 2013 eNovance # # Author: <NAME> <<EMAIL>> # # 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 stevedore import extension from ceilometer.openstack.common import context as req_context from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log as logging from ceilometer import pipeline from ceilometer import transformer LOG = logging.getLogger(__name__) _notification_manager = None _pipeline_manager = None def _load_notification_manager(): global _notification_manager, _pipeline_manager namespace = 'ceilometer.notification' LOG.debug(_('loading notification handlers from %s'), namespace) _notification_manager = extension.ExtensionManager( namespace=namespace, invoke_on_load=True, invoke_args=(_pipeline_manager, ) ) if not list(_notification_manager): LOG.warning(_('Failed to load any notification handlers for %s'), namespace) def _load_pipeline_manager(): global _pipeline_manager _pipeline_manager = pipeline.setup_pipeline( transformer.TransformerExtensionManager( 'ceilometer.transformer', ), ) def notify(context, message): """Sends a notification as a meter using Ceilometer pipelines.""" if not _pipeline_manager: _load_pipeline_manager() if not _notification_manager: _load_notification_manager() _notification_manager.map_method( 'to_samples_and_publish', context=context or req_context.get_admin_context(), notification=message)
[ 1, 529, 276, 1112, 420, 29958, 279, 9777, 2647, 29879, 29914, 27696, 8328, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29941, 321, 25363, 749, 13, 29937, 13, 29937, 13361, 29901, 529, 5813, 29958, 3532, 26862, 6227, 6778, 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, 418, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 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, 1886, 1490, 487, 1053, 6081, 13, 13, 3166, 2257, 309, 8328, 29889, 3150, 1429, 29889, 9435, 1053, 3030, 408, 12428, 29918, 4703, 13, 3166, 2257, 309, 8328, 29889, 3150, 1429, 29889, 9435, 29889, 657, 726, 13239, 1053, 903, 13, 3166, 2257, 309, 8328, 29889, 3150, 1429, 29889, 9435, 1053, 1480, 408, 12183, 13, 3166, 2257, 309, 8328, 1053, 16439, 13, 3166, 2257, 309, 8328, 1053, 4327, 261, 13, 13, 13, 14480, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 29918, 24671, 29918, 12847, 353, 6213, 13, 29918, 13096, 5570, 29918, 12847, 353, 6213, 13, 13, 13, 1753, 903, 1359, 29918, 24671, 29918, 12847, 7295, 13, 1678, 5534, 903, 24671, 29918, 12847, 29892, 903, 13096, 5570, 29918, 12847, 13, 13, 1678, 7397, 353, 525, 27696, 8328, 29889, 24671, 29915, 13, 13, 1678, 25401, 29889, 8382, 7373, 877, 13234, 12519, 25795, 515, 1273, 29879, 5477, 7397, 29897, 13, 13, 1678, 903, 24671, 29918, 12847, 353, 6081, 29889, 17657, 3260, 29898, 13, 4706, 7397, 29922, 22377, 29892, 13, 4706, 15928, 29918, 265, 29918, 1359, 29922, 5574, 29892, 13, 4706, 15928, 29918, 5085, 29922, 7373, 13096, 5570, 29918, 12847, 29892, 1723, 13, 1678, 1723, 13, 13, 1678, 565, 451, 1051, 7373, 24671, 29918, 12847, 1125, 13, 4706, 25401, 29889, 27392, 7373, 877, 17776, 304, 2254, 738, 12519, 25795, 363, 1273, 29879, 5477, 13, 462, 1678, 7397, 29897, 13, 13, 13, 1753, 903, 1359, 29918, 13096, 5570, 29918, 12847, 7295, 13, 1678, 5534, 903, 13096, 5570, 29918, 12847, 13, 13, 1678, 903, 13096, 5570, 29918, 12847, 353, 16439, 29889, 14669, 29918, 13096, 5570, 29898, 13, 4706, 4327, 261, 29889, 13372, 261, 17657, 3260, 29898, 13, 9651, 525, 27696, 8328, 29889, 9067, 261, 742, 13, 4706, 10353, 13, 1678, 1723, 13, 13, 13, 1753, 26051, 29898, 4703, 29892, 2643, 1125, 13, 1678, 9995, 29903, 1975, 263, 12519, 408, 263, 11134, 773, 7747, 309, 8328, 8450, 24210, 1213, 15945, 13, 1678, 565, 451, 903, 13096, 5570, 29918, 12847, 29901, 13, 4706, 903, 1359, 29918, 13096, 5570, 29918, 12847, 580, 13, 1678, 565, 451, 903, 24671, 29918, 12847, 29901, 13, 4706, 903, 1359, 29918, 24671, 29918, 12847, 580, 13, 1678, 903, 24671, 29918, 12847, 29889, 1958, 29918, 5696, 29898, 13, 4706, 525, 517, 29918, 27736, 29918, 392, 29918, 23679, 742, 13, 4706, 3030, 29922, 4703, 470, 12428, 29918, 4703, 29889, 657, 29918, 6406, 29918, 4703, 3285, 13, 4706, 12519, 29922, 4906, 29897, 13, 2 ]
mongomail/main.py
terrabitz/MongoMail
0
41314
""" This file is for initializing the uWSGI application. It defines a post-fork command in order to avoid an issue in uWSGI that prevents MongoEngine from lazily creating mongo connections """ from uwsgidecorators import postfork from mongomail.rest_app import app, db, connection @postfork def init_db(): db.init_app(app) print("initializing db") if not connection.get_api_keys(): print("No Key found") key = connection.generate_api_key() print("Generated key: " + key)
[ 1, 9995, 13, 4013, 934, 338, 363, 2847, 5281, 278, 318, 7811, 29954, 29902, 2280, 29889, 739, 17645, 263, 1400, 29899, 29888, 548, 1899, 297, 13, 2098, 304, 4772, 385, 2228, 297, 318, 7811, 29954, 29902, 393, 28057, 18294, 12412, 515, 425, 29920, 2354, 4969, 13, 29885, 7443, 12368, 13, 15945, 29908, 13, 13, 3166, 318, 29893, 5311, 680, 2616, 4097, 1053, 1400, 29888, 548, 13, 3166, 286, 549, 290, 737, 29889, 5060, 29918, 932, 1053, 623, 29892, 4833, 29892, 3957, 13, 13, 13, 29992, 2490, 29888, 548, 13, 1753, 2069, 29918, 2585, 7295, 13, 1678, 4833, 29889, 2344, 29918, 932, 29898, 932, 29897, 13, 1678, 1596, 703, 11228, 5281, 4833, 1159, 13, 1678, 565, 451, 3957, 29889, 657, 29918, 2754, 29918, 8149, 7295, 13, 4706, 1596, 703, 3782, 7670, 1476, 1159, 13, 4706, 1820, 353, 3957, 29889, 17158, 29918, 2754, 29918, 1989, 580, 13, 4706, 1596, 703, 24565, 1820, 29901, 376, 718, 1820, 29897, 13, 2 ]
opt.py
ArmandB/RITnet
0
40678
from pprint import pprint import argparse def parse_args(): parser = argparse.ArgumentParser() # Data input settings parser.add_argument('--dataset', type=str, default='Semantic_Segmentation_Dataset/', help='name of dataset') # Optimization: General parser.add_argument('--bs', type=int, default = 8 ) parser.add_argument('--epochs', type=int,help='Number of epochs',default= 250) parser.add_argument('--workers', type=int,help='Number of workers',default=4) parser.add_argument('--model', help='model name',default='densenet') parser.add_argument('--evalsplit', help='eval spolit',default='val') parser.add_argument('--lr', type=float,default= 1e-3,help='Learning rate') parser.add_argument('--save', help='save folder name',default='0try') parser.add_argument('--seed', type=int, default=1111, help='random seed') parser.add_argument('--load', type=str, default='best_model.pkl', help='load checkpoint file name') parser.add_argument('--resume', action='store_true', help='resume train from load chkpoint') parser.add_argument('--test', action='store_true', help='test only') parser.add_argument('--savemodel',action='store_true',help='checkpoint save the model') parser.add_argument('--testrun', action='store_true', help='test run with few dataset') parser.add_argument('--expname', type=str, default='info', help='extra explanation of the method') parser.add_argument('--useGPU', type=str, default=True, help='Set it as False if GPU is unavailable') # parse args = parser.parse_args() opt = vars(args) pprint('parsed input parameters:') pprint(opt) return args if __name__ == '__main__': opt = parse_args() print('opt[\'dataset\'] is ', opt.dataset)
[ 1, 515, 282, 2158, 1053, 282, 2158, 13, 5215, 1852, 5510, 13, 13, 1753, 6088, 29918, 5085, 7295, 13, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 396, 3630, 1881, 6055, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 24713, 742, 1134, 29922, 710, 29892, 2322, 2433, 28516, 7716, 29918, 17669, 358, 362, 29918, 16390, 24541, 29914, 742, 1371, 2433, 978, 310, 8783, 1495, 13, 1678, 396, 20693, 326, 2133, 29901, 4593, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 5824, 742, 1134, 29922, 524, 29892, 2322, 353, 29871, 29947, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1022, 2878, 29879, 742, 1134, 29922, 524, 29892, 8477, 2433, 4557, 310, 21502, 12168, 742, 4381, 29922, 29871, 29906, 29945, 29900, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1287, 414, 742, 1134, 29922, 524, 29892, 8477, 2433, 4557, 310, 17162, 742, 4381, 29922, 29946, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4299, 742, 1371, 2433, 4299, 1024, 742, 4381, 2433, 29881, 14762, 300, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 14513, 5451, 742, 1371, 2433, 14513, 805, 27298, 742, 4381, 2433, 791, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29212, 742, 1134, 29922, 7411, 29892, 4381, 29922, 29871, 29896, 29872, 29899, 29941, 29892, 8477, 2433, 29931, 799, 1076, 6554, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 7620, 742, 1371, 2433, 7620, 4138, 1024, 742, 4381, 2433, 29900, 2202, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 26776, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29896, 29896, 29896, 29892, 1371, 2433, 8172, 16717, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1359, 742, 1134, 29922, 710, 29892, 2322, 2433, 13318, 29918, 4299, 29889, 29886, 6321, 742, 1371, 2433, 1359, 1423, 3149, 934, 1024, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 690, 2017, 742, 29871, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 690, 2017, 7945, 515, 2254, 521, 29895, 3149, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1688, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 1688, 871, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29879, 485, 331, 27224, 742, 2467, 2433, 8899, 29918, 3009, 742, 8477, 2433, 3198, 3149, 4078, 278, 1904, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1688, 3389, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 1688, 1065, 411, 2846, 8783, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4548, 978, 742, 1134, 29922, 710, 29892, 2322, 2433, 3888, 742, 1371, 2433, 17833, 8252, 310, 278, 1158, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1509, 29954, 7056, 742, 1134, 29922, 710, 29892, 2322, 29922, 5574, 29892, 1371, 2433, 2697, 372, 408, 7700, 565, 22796, 338, 443, 16515, 1495, 13, 1678, 13, 1678, 396, 6088, 29871, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 3523, 353, 24987, 29898, 5085, 29897, 13, 1678, 282, 2158, 877, 862, 8485, 1881, 4128, 29901, 1495, 13, 1678, 282, 2158, 29898, 3670, 29897, 13, 1678, 736, 6389, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 13, 1678, 3523, 353, 6088, 29918, 5085, 580, 13, 1678, 1596, 877, 3670, 7110, 29915, 24713, 29905, 2033, 338, 13420, 3523, 29889, 24713, 29897, 13, 13, 13, 13, 13, 2 ]
common/inputs/custom_reader.py
bhneo/FMRouting
0
102134
import os import tensorflow_datasets as tfds import tensorflow as tf import numpy as np from common.inputs.data_input import DataInfo bxs_m2 = [[1, 1], [1, -1], [-1, 1], [-1, -1]] def parse_multi_mnist1(serialized_example): """ Data parsing function. """ features = tf.io.parse_single_example(serialized_example, features={ 'height': tf.io.FixedLenFeature([], tf.int64), 'width': tf.io.FixedLenFeature([], tf.int64), 'depth': tf.io.FixedLenFeature([], tf.int64), 'label_1': tf.io.FixedLenFeature([], tf.int64), 'label_2': tf.io.FixedLenFeature([], tf.int64), 'image_raw_1': tf.io.FixedLenFeature([], tf.string), 'image_raw_2': tf.io.FixedLenFeature([], tf.string), 'merged_raw': tf.io.FixedLenFeature([], tf.string), }) # Decode 3 images image_raw_1 = tf.io.decode_raw(features['image_raw_1'], tf.uint8) image_raw_1 = tf.reshape(image_raw_1, shape=[36, 36, 1]) image_raw_2 = tf.io.decode_raw(features['image_raw_2'], tf.uint8) image_raw_2 = tf.reshape(image_raw_2, shape=[36, 36, 1]) merged_raw = tf.io.decode_raw(features['merged_raw'], tf.uint8) merged_raw = tf.reshape(merged_raw, shape=[36, 36, 1]) # Convert from [0, 255] -> [-0.5, 0.5] floats. image_raw_1 = tf.cast(image_raw_1, tf.float32) * (1. / 255) image_raw_2 = tf.cast(image_raw_2, tf.float32) * (1. / 255) merged_raw = tf.cast(merged_raw, tf.float32) * (1. / 255) # Convert label from a scalar uint8 tensor to an int32 scalar. label_1 = tf.one_hot(tf.cast(features['label_1'], tf.int32), 10) label_2 = tf.one_hot(tf.cast(features['label_2'], tf.int32), 10) label = label_1 + label_2 features = {'images': merged_raw, 'labels': label, 'recons_label': label_1, 'recons_image': image_raw_1, 'spare_label': label_2, 'spare_image': image_raw_2} return features def parse_multi_mnist(serialized_example): """ Data parsing function. """ features = tf.io.parse_single_example(serialized_example, features={ 'height': tf.io.FixedLenFeature([], tf.int64), 'width': tf.io.FixedLenFeature([], tf.int64), 'depth': tf.io.FixedLenFeature([], tf.int64), 'label_1': tf.io.FixedLenFeature([], tf.int64), 'label_2': tf.io.FixedLenFeature([], tf.int64), 'image_raw_1': tf.io.FixedLenFeature([], tf.string), 'image_raw_2': tf.io.FixedLenFeature([], tf.string), # 'merged_raw': tf.io.FixedLenFeature([], tf.string), }) # Decode 3 images image_raw_1 = tf.io.decode_raw(features['image_raw_1'], tf.uint8) image_raw_1 = tf.reshape(image_raw_1, shape=[36, 36, 1]) image_raw_2 = tf.io.decode_raw(features['image_raw_2'], tf.uint8) image_raw_2 = tf.reshape(image_raw_2, shape=[36, 36, 1]) merged_raw = tf.add(tf.cast(image_raw_1, tf.int32), tf.cast(image_raw_2, tf.int32)) merged_raw = tf.minimum(merged_raw, 255) # Convert from [0, 255] -> [-0.5, 0.5] floats. image_raw_1 = tf.cast(image_raw_1, tf.float32) * (1. / 255) image_raw_2 = tf.cast(image_raw_2, tf.float32) * (1. / 255) merged_raw = tf.cast(merged_raw, tf.float32) * (1. / 255) # Convert label from a scalar uint8 tensor to an int32 scalar. label_1 = tf.one_hot(tf.cast(features['label_1'], tf.int32), 10) label_2 = tf.one_hot(tf.cast(features['label_2'], tf.int32), 10) label = label_1 + label_2 features = {'images': merged_raw, 'labels': label, 'recons_label': label_1, 'recons_image': image_raw_1, 'spare_label': label_2, 'spare_image': image_raw_2} return features def parse_aff_mnist(serialized_example): """ Data parsing function. """ features = tf.io.parse_single_example(serialized_example, features={'image': tf.io.FixedLenFeature([], tf.string), 'label': tf.io.FixedLenFeature([], tf.int64), 'height': tf.io.FixedLenFeature([], tf.int64), 'width': tf.io.FixedLenFeature([], tf.int64), 'depth': tf.io.FixedLenFeature([], tf.int64)}) image = tf.io.decode_raw(features['image'], tf.uint8) image = tf.reshape(image, shape=[40, 40, 1]) image = tf.cast(image, tf.float32) * (1. / 255) label = tf.cast(features['label'], tf.int32) label = tf.one_hot(label, 10) return image, label def build_parse(dataset): if dataset == 'aff_mnist': return parse_aff_mnist elif dataset == 'shift_mnist': return parse_aff_mnist elif dataset == 'multi_mnist': return parse_multi_mnist elif dataset == 'multi_mnist1': return parse_multi_mnist1 def get_dataset(name, data_path): if name == 'aff_mnist':# 1920000/320000 train_files = os.path.join(data_path, "train_affnist.tfrecord") test_files = os.path.join(data_path, "test_affnist.tfrecord") train_parse_fun = build_parse('aff_mnist') test_parse_fun = build_parse('aff_mnist') info = DataInfo(tfds.features.FeaturesDict({'image': tfds.features.Image(shape=(40, 40, 1)), 'label': tfds.features.ClassLabel(num_classes=10)}), {'train_examples': 1920000, 'test_examples': 320000}) elif name == 'shift_mnist':# 10140000/1690000 train_files = os.path.join(data_path, "train_6shifted_mnist.tfrecord") test_files = os.path.join(data_path, "test_6shifted_mnist.tfrecord") train_parse_fun = build_parse('shift_mnist') test_parse_fun = build_parse('shift_mnist') info = DataInfo(tfds.features.FeaturesDict({'image': tfds.features.Image(shape=(40, 40, 1)), 'label': tfds.features.ClassLabel(num_classes=10)}), {'train_examples': 10140000, 'test_examples': 1690000}) # elif name == 'multi_mnist':# 6000000/1000000 # train_files = [os.path.join(data_path, 'train', "multitrain_6shifted_mnist.tfrecords-0000{}-of-00060".format(i)) for i # in range(10)] + [os.path.join(data_path, 'train', "multitrain_6shifted_mnist.tfrecords-000{}-of-00060".format(i)) for i # in range(10, 60)] # test_files = [os.path.join(data_path, 'test', "multitest_6shifted_mnist.tfrecords-0000{}-of-00010".format(i)) for i in range(10)] # train_parse_fun = build_parse('multi_mnist') # test_parse_fun = build_parse('multi_mnist') # info = DataInfo(tfds.features.FeaturesDict({'image': tfds.features.Image(shape=(36, 36, 1)), # 'label': tfds.features.ClassLabel(num_classes=10)}), # {'train_examples': 6000000, # 'test_examples': 1000000}) elif name == 'multi_mnist':# 599999/100000 train_files = [os.path.join(data_path, "multitrain_6shifted_mnist.tfrecords-0000{}-of-00006".format(i)) for i in range(6)] test_files = [os.path.join(data_path, "multitest_6shifted_mnist.tfrecords-00000-of-00001")] train_parse_fun = build_parse('multi_mnist1') test_parse_fun = build_parse('multi_mnist1') info = DataInfo(tfds.features.FeaturesDict({'image': tfds.features.Image(shape=(36, 36, 1)), 'label': tfds.features.ClassLabel(num_classes=10)}), {'train_examples': 599999, 'test_examples': 100000}) else: raise Exception('dataset note support!') train = tf.data.TFRecordDataset(train_files) test = tf.data.TFRecordDataset(test_files) return train, test, train_parse_fun, test_parse_fun, info def build_dataset(name, data_dir='data', batch_size=128, buffer_size=50000): data_path = os.path.join(data_dir, name) train, test, train_parse_fun, test_parse_fun, info = get_dataset(name, data_path) if buffer_size > 0: train = train.shuffle(buffer_size=buffer_size) train = train.map(train_parse_fun, num_parallel_calls=tf.data.experimental.AUTOTUNE)\ .batch(batch_size)\ .prefetch(tf.data.experimental.AUTOTUNE) test = test.map(test_parse_fun, num_parallel_calls=tf.data.experimental.AUTOTUNE)\ .batch(batch_size)\ .prefetch(tf.data.experimental.AUTOTUNE) return train, test, info def count_data(name): train, test, _ = build_dataset(name, '') train_num = 0 for image, label in train: train_num += image.shape[0] test_num = 0 for image, label in test: test_num += image.shape[0] print('train num:', train_num) print('test num:', test_num) def count_multi_mnist(): train, test, _ = build_dataset('multi_mnist', '') train_num = 0 for feature in train: train_num += feature['images'].shape[0] test_num = 0 for feature in test: test_num += feature['images'].shape[0] print('train num:', train_num) print('test num:', test_num) def view_data(name, img_stand=False): train, test, _ = build_dataset(name, '') for image, label in train: if not img_stand: image /= 255. out_image(image, label) break for image, label in test: if not img_stand: image /= 255. out_image(image, label) break def view_multi_mnist(img_stand=False): train, test, _ = build_dataset('multi_mnist', '') for features in train: image = features['images'] label = features['labels'] recons_label = features['recons_label'] recons_image = features['recons_image'] spare_label = features['spare_label'] spare_image = features['spare_image'] image_final = tf.concat([recons_image, spare_image, image], axis=2) if not img_stand: image_final /= 255. out_image(image_final, label) break def out_image(images, labels): import matplotlib.pyplot as plt plt.figure() for i in range(16): plt.subplot(4, 4, i+1) plt.title(tf.argmax(labels[i]).numpy()) image = images[i, :, :, :] if image.shape[-1] == 1: image = np.squeeze(image, -1) plt.imshow(image, cmap='gray') else: plt.imshow(image) plt.subplots_adjust(hspace=0.5) plt.show() if __name__ == "__main__": # view_data('aff_mnist') # count_data('shift_mnist') # view_multi_mnist() count_multi_mnist()
[ 1, 1053, 2897, 13, 5215, 26110, 29918, 14538, 1691, 408, 15886, 6289, 13, 5215, 26110, 408, 15886, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 3619, 29889, 2080, 29879, 29889, 1272, 29918, 2080, 1053, 3630, 3401, 13, 13, 13, 29890, 10351, 29918, 29885, 29906, 353, 5519, 29896, 29892, 29871, 29896, 1402, 518, 29896, 29892, 448, 29896, 1402, 21069, 29896, 29892, 29871, 29896, 1402, 21069, 29896, 29892, 448, 29896, 5262, 13, 13, 13, 1753, 6088, 29918, 9910, 29918, 23521, 391, 29896, 29898, 15550, 1891, 29918, 4773, 1125, 13, 1678, 9995, 3630, 13755, 740, 29889, 13, 1678, 9995, 13, 1678, 5680, 353, 15886, 29889, 601, 29889, 5510, 29918, 14369, 29918, 4773, 29898, 15550, 1891, 29918, 4773, 29892, 13, 462, 462, 3986, 5680, 3790, 13, 462, 462, 795, 525, 3545, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 2103, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 19488, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 1643, 29918, 29896, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 1643, 29918, 29906, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 3027, 29918, 1610, 29918, 29896, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 1807, 511, 13, 462, 462, 795, 525, 3027, 29918, 1610, 29918, 29906, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 1807, 511, 13, 462, 462, 795, 525, 1050, 3192, 29918, 1610, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 1807, 511, 13, 462, 462, 3986, 5615, 13, 1678, 396, 897, 401, 29871, 29941, 4558, 13, 1678, 1967, 29918, 1610, 29918, 29896, 353, 15886, 29889, 601, 29889, 13808, 29918, 1610, 29898, 22100, 1839, 3027, 29918, 1610, 29918, 29896, 7464, 15886, 29889, 13470, 29947, 29897, 13, 1678, 1967, 29918, 1610, 29918, 29896, 353, 15886, 29889, 690, 14443, 29898, 3027, 29918, 1610, 29918, 29896, 29892, 8267, 11759, 29941, 29953, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 2314, 13, 1678, 1967, 29918, 1610, 29918, 29906, 353, 15886, 29889, 601, 29889, 13808, 29918, 1610, 29898, 22100, 1839, 3027, 29918, 1610, 29918, 29906, 7464, 15886, 29889, 13470, 29947, 29897, 13, 1678, 1967, 29918, 1610, 29918, 29906, 353, 15886, 29889, 690, 14443, 29898, 3027, 29918, 1610, 29918, 29906, 29892, 8267, 11759, 29941, 29953, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 2314, 13, 1678, 19412, 29918, 1610, 353, 15886, 29889, 601, 29889, 13808, 29918, 1610, 29898, 22100, 1839, 1050, 3192, 29918, 1610, 7464, 15886, 29889, 13470, 29947, 29897, 13, 1678, 19412, 29918, 1610, 353, 15886, 29889, 690, 14443, 29898, 1050, 3192, 29918, 1610, 29892, 8267, 11759, 29941, 29953, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 2314, 13, 13, 1678, 396, 14806, 515, 518, 29900, 29892, 29871, 29906, 29945, 29945, 29962, 1599, 21069, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29945, 29962, 5685, 1446, 29889, 13, 1678, 1967, 29918, 1610, 29918, 29896, 353, 15886, 29889, 4384, 29898, 3027, 29918, 1610, 29918, 29896, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 334, 313, 29896, 29889, 847, 29871, 29906, 29945, 29945, 29897, 13, 1678, 1967, 29918, 1610, 29918, 29906, 353, 15886, 29889, 4384, 29898, 3027, 29918, 1610, 29918, 29906, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 334, 313, 29896, 29889, 847, 29871, 29906, 29945, 29945, 29897, 13, 1678, 19412, 29918, 1610, 353, 15886, 29889, 4384, 29898, 1050, 3192, 29918, 1610, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 334, 313, 29896, 29889, 847, 29871, 29906, 29945, 29945, 29897, 13, 13, 1678, 396, 14806, 3858, 515, 263, 17336, 13122, 29947, 12489, 304, 385, 938, 29941, 29906, 17336, 29889, 13, 1678, 3858, 29918, 29896, 353, 15886, 29889, 650, 29918, 8711, 29898, 13264, 29889, 4384, 29898, 22100, 1839, 1643, 29918, 29896, 7464, 15886, 29889, 524, 29941, 29906, 511, 29871, 29896, 29900, 29897, 13, 1678, 3858, 29918, 29906, 353, 15886, 29889, 650, 29918, 8711, 29898, 13264, 29889, 4384, 29898, 22100, 1839, 1643, 29918, 29906, 7464, 15886, 29889, 524, 29941, 29906, 511, 29871, 29896, 29900, 29897, 13, 13, 1678, 3858, 353, 3858, 29918, 29896, 718, 3858, 29918, 29906, 13, 1678, 5680, 353, 11117, 8346, 2396, 19412, 29918, 1610, 29892, 13, 18884, 525, 21134, 2396, 3858, 29892, 13, 18884, 525, 276, 3200, 29918, 1643, 2396, 3858, 29918, 29896, 29892, 13, 18884, 525, 276, 3200, 29918, 3027, 2396, 1967, 29918, 1610, 29918, 29896, 29892, 13, 18884, 525, 1028, 598, 29918, 1643, 2396, 3858, 29918, 29906, 29892, 13, 18884, 525, 1028, 598, 29918, 3027, 2396, 1967, 29918, 1610, 29918, 29906, 29913, 13, 1678, 736, 5680, 13, 13, 13, 1753, 6088, 29918, 9910, 29918, 23521, 391, 29898, 15550, 1891, 29918, 4773, 1125, 13, 1678, 9995, 3630, 13755, 740, 29889, 13, 1678, 9995, 13, 1678, 5680, 353, 15886, 29889, 601, 29889, 5510, 29918, 14369, 29918, 4773, 29898, 15550, 1891, 29918, 4773, 29892, 13, 462, 462, 3986, 5680, 3790, 13, 462, 462, 795, 525, 3545, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 2103, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 19488, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 1643, 29918, 29896, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 1643, 29918, 29906, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 795, 525, 3027, 29918, 1610, 29918, 29896, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 1807, 511, 13, 462, 462, 795, 525, 3027, 29918, 1610, 29918, 29906, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 1807, 511, 13, 462, 462, 795, 396, 525, 1050, 3192, 29918, 1610, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 1807, 511, 13, 462, 462, 3986, 5615, 13, 1678, 396, 897, 401, 29871, 29941, 4558, 13, 1678, 1967, 29918, 1610, 29918, 29896, 353, 15886, 29889, 601, 29889, 13808, 29918, 1610, 29898, 22100, 1839, 3027, 29918, 1610, 29918, 29896, 7464, 15886, 29889, 13470, 29947, 29897, 13, 1678, 1967, 29918, 1610, 29918, 29896, 353, 15886, 29889, 690, 14443, 29898, 3027, 29918, 1610, 29918, 29896, 29892, 8267, 11759, 29941, 29953, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 2314, 13, 1678, 1967, 29918, 1610, 29918, 29906, 353, 15886, 29889, 601, 29889, 13808, 29918, 1610, 29898, 22100, 1839, 3027, 29918, 1610, 29918, 29906, 7464, 15886, 29889, 13470, 29947, 29897, 13, 1678, 1967, 29918, 1610, 29918, 29906, 353, 15886, 29889, 690, 14443, 29898, 3027, 29918, 1610, 29918, 29906, 29892, 8267, 11759, 29941, 29953, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 2314, 13, 1678, 19412, 29918, 1610, 353, 15886, 29889, 1202, 29898, 13264, 29889, 4384, 29898, 3027, 29918, 1610, 29918, 29896, 29892, 15886, 29889, 524, 29941, 29906, 511, 15886, 29889, 4384, 29898, 3027, 29918, 1610, 29918, 29906, 29892, 15886, 29889, 524, 29941, 29906, 876, 13, 1678, 19412, 29918, 1610, 353, 15886, 29889, 1195, 12539, 29898, 1050, 3192, 29918, 1610, 29892, 29871, 29906, 29945, 29945, 29897, 13, 13, 1678, 396, 14806, 515, 518, 29900, 29892, 29871, 29906, 29945, 29945, 29962, 1599, 21069, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29945, 29962, 5685, 1446, 29889, 13, 1678, 1967, 29918, 1610, 29918, 29896, 353, 15886, 29889, 4384, 29898, 3027, 29918, 1610, 29918, 29896, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 334, 313, 29896, 29889, 847, 29871, 29906, 29945, 29945, 29897, 13, 1678, 1967, 29918, 1610, 29918, 29906, 353, 15886, 29889, 4384, 29898, 3027, 29918, 1610, 29918, 29906, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 334, 313, 29896, 29889, 847, 29871, 29906, 29945, 29945, 29897, 13, 1678, 19412, 29918, 1610, 353, 15886, 29889, 4384, 29898, 1050, 3192, 29918, 1610, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 334, 313, 29896, 29889, 847, 29871, 29906, 29945, 29945, 29897, 13, 13, 1678, 396, 14806, 3858, 515, 263, 17336, 13122, 29947, 12489, 304, 385, 938, 29941, 29906, 17336, 29889, 13, 1678, 3858, 29918, 29896, 353, 15886, 29889, 650, 29918, 8711, 29898, 13264, 29889, 4384, 29898, 22100, 1839, 1643, 29918, 29896, 7464, 15886, 29889, 524, 29941, 29906, 511, 29871, 29896, 29900, 29897, 13, 1678, 3858, 29918, 29906, 353, 15886, 29889, 650, 29918, 8711, 29898, 13264, 29889, 4384, 29898, 22100, 1839, 1643, 29918, 29906, 7464, 15886, 29889, 524, 29941, 29906, 511, 29871, 29896, 29900, 29897, 13, 13, 1678, 3858, 353, 3858, 29918, 29896, 718, 3858, 29918, 29906, 13, 1678, 5680, 353, 11117, 8346, 2396, 19412, 29918, 1610, 29892, 13, 18884, 525, 21134, 2396, 3858, 29892, 13, 18884, 525, 276, 3200, 29918, 1643, 2396, 3858, 29918, 29896, 29892, 13, 18884, 525, 276, 3200, 29918, 3027, 2396, 1967, 29918, 1610, 29918, 29896, 29892, 13, 18884, 525, 1028, 598, 29918, 1643, 2396, 3858, 29918, 29906, 29892, 13, 18884, 525, 1028, 598, 29918, 3027, 2396, 1967, 29918, 1610, 29918, 29906, 29913, 13, 1678, 736, 5680, 13, 13, 13, 1753, 6088, 29918, 3470, 29918, 23521, 391, 29898, 15550, 1891, 29918, 4773, 1125, 13, 1678, 9995, 3630, 13755, 740, 29889, 13, 1678, 9995, 13, 1678, 5680, 353, 15886, 29889, 601, 29889, 5510, 29918, 14369, 29918, 4773, 29898, 15550, 1891, 29918, 4773, 29892, 13, 462, 462, 3986, 5680, 3790, 29915, 3027, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 1807, 511, 13, 462, 462, 462, 1678, 525, 1643, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 462, 1678, 525, 3545, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 462, 1678, 525, 2103, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 511, 13, 462, 462, 462, 1678, 525, 19488, 2396, 15886, 29889, 601, 29889, 26262, 21515, 19132, 4197, 1402, 15886, 29889, 524, 29953, 29946, 26972, 13, 1678, 1967, 353, 15886, 29889, 601, 29889, 13808, 29918, 1610, 29898, 22100, 1839, 3027, 7464, 15886, 29889, 13470, 29947, 29897, 13, 1678, 1967, 353, 15886, 29889, 690, 14443, 29898, 3027, 29892, 8267, 11759, 29946, 29900, 29892, 29871, 29946, 29900, 29892, 29871, 29896, 2314, 13, 1678, 1967, 353, 15886, 29889, 4384, 29898, 3027, 29892, 15886, 29889, 7411, 29941, 29906, 29897, 334, 313, 29896, 29889, 847, 29871, 29906, 29945, 29945, 29897, 13, 1678, 3858, 353, 15886, 29889, 4384, 29898, 22100, 1839, 1643, 7464, 15886, 29889, 524, 29941, 29906, 29897, 13, 1678, 3858, 353, 15886, 29889, 650, 29918, 8711, 29898, 1643, 29892, 29871, 29896, 29900, 29897, 13, 1678, 736, 1967, 29892, 3858, 13, 13, 13, 1753, 2048, 29918, 5510, 29898, 24713, 1125, 13, 1678, 565, 8783, 1275, 525, 3470, 29918, 23521, 391, 2396, 13, 4706, 736, 6088, 29918, 3470, 29918, 23521, 391, 13, 1678, 25342, 8783, 1275, 525, 10889, 29918, 23521, 391, 2396, 13, 4706, 736, 6088, 29918, 3470, 29918, 23521, 391, 13, 1678, 25342, 8783, 1275, 525, 9910, 29918, 23521, 391, 2396, 13, 4706, 736, 6088, 29918, 9910, 29918, 23521, 391, 13, 1678, 25342, 8783, 1275, 525, 9910, 29918, 23521, 391, 29896, 2396, 13, 4706, 736, 6088, 29918, 9910, 29918, 23521, 391, 29896, 13, 13, 13, 1753, 679, 29918, 24713, 29898, 978, 29892, 848, 29918, 2084, 1125, 13, 1678, 565, 1024, 1275, 525, 3470, 29918, 23521, 391, 2396, 29937, 29871, 29896, 29929, 29906, 29900, 29900, 29900, 29900, 29914, 29941, 29906, 29900, 29900, 29900, 29900, 13, 4706, 7945, 29918, 5325, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 376, 14968, 29918, 3470, 29876, 391, 29889, 13264, 11651, 1159, 13, 4706, 1243, 29918, 5325, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 376, 1688, 29918, 3470, 29876, 391, 29889, 13264, 11651, 1159, 13, 4706, 7945, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 3470, 29918, 23521, 391, 1495, 13, 4706, 1243, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 3470, 29918, 23521, 391, 1495, 13, 4706, 5235, 353, 3630, 3401, 29898, 13264, 6289, 29889, 22100, 29889, 8263, 3698, 21533, 3319, 29915, 3027, 2396, 15886, 6289, 29889, 22100, 29889, 2940, 29898, 12181, 7607, 29946, 29900, 29892, 29871, 29946, 29900, 29892, 29871, 29896, 8243, 13, 462, 462, 462, 1678, 525, 1643, 2396, 15886, 6289, 29889, 22100, 29889, 2385, 4775, 29898, 1949, 29918, 13203, 29922, 29896, 29900, 2915, 511, 13, 462, 4706, 11117, 14968, 29918, 19057, 2396, 29871, 29896, 29929, 29906, 29900, 29900, 29900, 29900, 29892, 13, 462, 308, 525, 1688, 29918, 19057, 2396, 29871, 29941, 29906, 29900, 29900, 29900, 29900, 1800, 13, 1678, 25342, 1024, 1275, 525, 10889, 29918, 23521, 391, 2396, 29937, 29871, 29896, 29900, 29896, 29946, 29900, 29900, 29900, 29900, 29914, 29896, 29953, 29929, 29900, 29900, 29900, 29900, 13, 4706, 7945, 29918, 5325, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 376, 14968, 29918, 29953, 10889, 287, 29918, 23521, 391, 29889, 13264, 11651, 1159, 13, 4706, 1243, 29918, 5325, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 376, 1688, 29918, 29953, 10889, 287, 29918, 23521, 391, 29889, 13264, 11651, 1159, 13, 4706, 7945, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 10889, 29918, 23521, 391, 1495, 13, 4706, 1243, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 10889, 29918, 23521, 391, 1495, 13, 4706, 5235, 353, 3630, 3401, 29898, 13264, 6289, 29889, 22100, 29889, 8263, 3698, 21533, 3319, 29915, 3027, 2396, 15886, 6289, 29889, 22100, 29889, 2940, 29898, 12181, 7607, 29946, 29900, 29892, 29871, 29946, 29900, 29892, 29871, 29896, 8243, 13, 462, 462, 462, 1678, 525, 1643, 2396, 15886, 6289, 29889, 22100, 29889, 2385, 4775, 29898, 1949, 29918, 13203, 29922, 29896, 29900, 2915, 511, 13, 462, 4706, 11117, 14968, 29918, 19057, 2396, 29871, 29896, 29900, 29896, 29946, 29900, 29900, 29900, 29900, 29892, 13, 462, 308, 525, 1688, 29918, 19057, 2396, 29871, 29896, 29953, 29929, 29900, 29900, 29900, 29900, 1800, 13, 1678, 396, 25342, 1024, 1275, 525, 9910, 29918, 23521, 391, 2396, 29937, 29871, 29953, 29900, 29900, 29900, 29900, 29900, 29900, 29914, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 13, 1678, 396, 268, 7945, 29918, 5325, 353, 518, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 525, 14968, 742, 376, 4713, 277, 6038, 29918, 29953, 10889, 287, 29918, 23521, 391, 29889, 13264, 3757, 4339, 29899, 29900, 29900, 29900, 29900, 29912, 7402, 974, 29899, 29900, 29900, 29900, 29953, 29900, 1642, 4830, 29898, 29875, 876, 363, 474, 13, 1678, 396, 462, 1678, 297, 3464, 29898, 29896, 29900, 4638, 718, 518, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 525, 14968, 742, 376, 4713, 277, 6038, 29918, 29953, 10889, 287, 29918, 23521, 391, 29889, 13264, 3757, 4339, 29899, 29900, 29900, 29900, 29912, 7402, 974, 29899, 29900, 29900, 29900, 29953, 29900, 1642, 4830, 29898, 29875, 876, 363, 474, 13, 1678, 396, 462, 1678, 297, 3464, 29898, 29896, 29900, 29892, 29871, 29953, 29900, 4638, 13, 1678, 396, 268, 1243, 29918, 5325, 353, 518, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 525, 1688, 742, 376, 4713, 277, 342, 29918, 29953, 10889, 287, 29918, 23521, 391, 29889, 13264, 3757, 4339, 29899, 29900, 29900, 29900, 29900, 29912, 7402, 974, 29899, 29900, 29900, 29900, 29896, 29900, 1642, 4830, 29898, 29875, 876, 363, 474, 297, 3464, 29898, 29896, 29900, 4638, 13, 1678, 396, 268, 7945, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 9910, 29918, 23521, 391, 1495, 13, 1678, 396, 268, 1243, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 9910, 29918, 23521, 391, 1495, 13, 1678, 396, 268, 5235, 353, 3630, 3401, 29898, 13264, 6289, 29889, 22100, 29889, 8263, 3698, 21533, 3319, 29915, 3027, 2396, 15886, 6289, 29889, 22100, 29889, 2940, 29898, 12181, 7607, 29941, 29953, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 8243, 13, 1678, 396, 462, 462, 462, 525, 1643, 2396, 15886, 6289, 29889, 22100, 29889, 2385, 4775, 29898, 1949, 29918, 13203, 29922, 29896, 29900, 2915, 511, 13, 1678, 396, 462, 268, 11117, 14968, 29918, 19057, 2396, 29871, 29953, 29900, 29900, 29900, 29900, 29900, 29900, 29892, 13, 1678, 396, 462, 418, 525, 1688, 29918, 19057, 2396, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 1800, 13, 1678, 25342, 1024, 1275, 525, 9910, 29918, 23521, 391, 2396, 29937, 29871, 29945, 29929, 29929, 29929, 29929, 29929, 29914, 29896, 29900, 29900, 29900, 29900, 29900, 13, 4706, 7945, 29918, 5325, 353, 518, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 376, 4713, 277, 6038, 29918, 29953, 10889, 287, 29918, 23521, 391, 29889, 13264, 3757, 4339, 29899, 29900, 29900, 29900, 29900, 29912, 7402, 974, 29899, 29900, 29900, 29900, 29900, 29953, 1642, 4830, 29898, 29875, 876, 363, 474, 13, 462, 539, 297, 3464, 29898, 29953, 4638, 13, 4706, 1243, 29918, 5325, 353, 518, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 376, 4713, 277, 342, 29918, 29953, 10889, 287, 29918, 23521, 391, 29889, 13264, 3757, 4339, 29899, 29900, 29900, 29900, 29900, 29900, 29899, 974, 29899, 29900, 29900, 29900, 29900, 29896, 13531, 13, 4706, 7945, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 9910, 29918, 23521, 391, 29896, 1495, 13, 4706, 1243, 29918, 5510, 29918, 7692, 353, 2048, 29918, 5510, 877, 9910, 29918, 23521, 391, 29896, 1495, 13, 4706, 5235, 353, 3630, 3401, 29898, 13264, 6289, 29889, 22100, 29889, 8263, 3698, 21533, 3319, 29915, 3027, 2396, 15886, 6289, 29889, 22100, 29889, 2940, 29898, 12181, 7607, 29941, 29953, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 8243, 13, 462, 462, 462, 1678, 525, 1643, 2396, 15886, 6289, 29889, 22100, 29889, 2385, 4775, 29898, 1949, 29918, 13203, 29922, 29896, 29900, 2915, 511, 13, 462, 4706, 11117, 14968, 29918, 19057, 2396, 29871, 29945, 29929, 29929, 29929, 29929, 29929, 29892, 13, 462, 308, 525, 1688, 29918, 19057, 2396, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 1800, 13, 1678, 1683, 29901, 13, 4706, 12020, 8960, 877, 24713, 4443, 2304, 29991, 1495, 13, 13, 1678, 7945, 353, 15886, 29889, 1272, 29889, 8969, 9182, 16390, 24541, 29898, 14968, 29918, 5325, 29897, 13, 1678, 1243, 353, 15886, 29889, 1272, 29889, 8969, 9182, 16390, 24541, 29898, 1688, 29918, 5325, 29897, 13, 13, 1678, 736, 7945, 29892, 1243, 29892, 7945, 29918, 5510, 29918, 7692, 29892, 1243, 29918, 5510, 29918, 7692, 29892, 5235, 13, 13, 13, 1753, 2048, 29918, 24713, 29898, 978, 29892, 848, 29918, 3972, 2433, 1272, 742, 9853, 29918, 2311, 29922, 29896, 29906, 29947, 29892, 6835, 29918, 2311, 29922, 29945, 29900, 29900, 29900, 29900, 1125, 13, 1678, 848, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 3972, 29892, 1024, 29897, 13, 1678, 7945, 29892, 1243, 29892, 7945, 29918, 5510, 29918, 7692, 29892, 1243, 29918, 5510, 29918, 7692, 29892, 5235, 353, 679, 29918, 24713, 29898, 978, 29892, 848, 29918, 2084, 29897, 13, 13, 1678, 565, 6835, 29918, 2311, 1405, 29871, 29900, 29901, 13, 4706, 7945, 353, 7945, 29889, 845, 21897, 29898, 9040, 29918, 2311, 29922, 9040, 29918, 2311, 29897, 13, 13, 1678, 7945, 353, 7945, 29889, 1958, 29898, 14968, 29918, 5510, 29918, 7692, 29892, 13, 462, 418, 954, 29918, 23482, 29918, 29883, 4293, 29922, 13264, 29889, 1272, 29889, 735, 27910, 29889, 20656, 2891, 3904, 29923, 2144, 13, 4706, 869, 16175, 29898, 16175, 29918, 2311, 2144, 13, 4706, 869, 29886, 999, 3486, 29898, 13264, 29889, 1272, 29889, 735, 27910, 29889, 20656, 2891, 3904, 29923, 29897, 13, 1678, 1243, 353, 1243, 29889, 1958, 29898, 1688, 29918, 5510, 29918, 7692, 29892, 13, 462, 1678, 954, 29918, 23482, 29918, 29883, 4293, 29922, 13264, 29889, 1272, 29889, 735, 27910, 29889, 20656, 2891, 3904, 29923, 2144, 13, 4706, 869, 16175, 29898, 16175, 29918, 2311, 2144, 13, 4706, 869, 29886, 999, 3486, 29898, 13264, 29889, 1272, 29889, 735, 27910, 29889, 20656, 2891, 3904, 29923, 29897, 13, 13, 1678, 736, 7945, 29892, 1243, 29892, 5235, 13, 13, 13, 1753, 2302, 29918, 1272, 29898, 978, 1125, 13, 1678, 7945, 29892, 1243, 29892, 903, 353, 2048, 29918, 24713, 29898, 978, 29892, 27255, 13, 1678, 7945, 29918, 1949, 353, 29871, 29900, 13, 1678, 363, 1967, 29892, 3858, 297, 7945, 29901, 13, 4706, 7945, 29918, 1949, 4619, 1967, 29889, 12181, 29961, 29900, 29962, 13, 13, 1678, 1243, 29918, 1949, 353, 29871, 29900, 13, 1678, 363, 1967, 29892, 3858, 297, 1243, 29901, 13, 4706, 1243, 29918, 1949, 4619, 1967, 29889, 12181, 29961, 29900, 29962, 13, 13, 1678, 1596, 877, 14968, 954, 29901, 742, 7945, 29918, 1949, 29897, 13, 1678, 1596, 877, 1688, 954, 29901, 742, 1243, 29918, 1949, 29897, 13, 13, 13, 1753, 2302, 29918, 9910, 29918, 23521, 391, 7295, 13, 1678, 7945, 29892, 1243, 29892, 903, 353, 2048, 29918, 24713, 877, 9910, 29918, 23521, 391, 742, 27255, 13, 1678, 7945, 29918, 1949, 353, 29871, 29900, 13, 1678, 363, 4682, 297, 7945, 29901, 13, 4706, 7945, 29918, 1949, 4619, 4682, 1839, 8346, 13359, 12181, 29961, 29900, 29962, 13, 13, 1678, 1243, 29918, 1949, 353, 29871, 29900, 13, 1678, 363, 4682, 297, 1243, 29901, 13, 4706, 1243, 29918, 1949, 4619, 4682, 1839, 8346, 13359, 12181, 29961, 29900, 29962, 13, 13, 1678, 1596, 877, 14968, 954, 29901, 742, 7945, 29918, 1949, 29897, 13, 1678, 1596, 877, 1688, 954, 29901, 742, 1243, 29918, 1949, 29897, 13, 13, 13, 1753, 1776, 29918, 1272, 29898, 978, 29892, 10153, 29918, 1689, 29922, 8824, 1125, 13, 1678, 7945, 29892, 1243, 29892, 903, 353, 2048, 29918, 24713, 29898, 978, 29892, 27255, 13, 1678, 363, 1967, 29892, 3858, 297, 7945, 29901, 13, 4706, 565, 451, 10153, 29918, 1689, 29901, 13, 9651, 1967, 847, 29922, 29871, 29906, 29945, 29945, 29889, 13, 4706, 714, 29918, 3027, 29898, 3027, 29892, 3858, 29897, 13, 4706, 2867, 13, 13, 1678, 363, 1967, 29892, 3858, 297, 1243, 29901, 13, 4706, 565, 451, 10153, 29918, 1689, 29901, 13, 9651, 1967, 847, 29922, 29871, 29906, 29945, 29945, 29889, 13, 4706, 714, 29918, 3027, 29898, 3027, 29892, 3858, 29897, 13, 4706, 2867, 13, 13, 13, 1753, 1776, 29918, 9910, 29918, 23521, 391, 29898, 2492, 29918, 1689, 29922, 8824, 1125, 13, 1678, 7945, 29892, 1243, 29892, 903, 353, 2048, 29918, 24713, 877, 9910, 29918, 23521, 391, 742, 27255, 13, 1678, 363, 5680, 297, 7945, 29901, 13, 4706, 1967, 353, 5680, 1839, 8346, 2033, 13, 4706, 3858, 353, 5680, 1839, 21134, 2033, 13, 4706, 337, 3200, 29918, 1643, 353, 5680, 1839, 276, 3200, 29918, 1643, 2033, 13, 4706, 337, 3200, 29918, 3027, 353, 5680, 1839, 276, 3200, 29918, 3027, 2033, 13, 4706, 29337, 29918, 1643, 353, 5680, 1839, 1028, 598, 29918, 1643, 2033, 13, 4706, 29337, 29918, 3027, 353, 5680, 1839, 1028, 598, 29918, 3027, 2033, 13, 13, 4706, 1967, 29918, 8394, 353, 15886, 29889, 17685, 4197, 276, 3200, 29918, 3027, 29892, 29337, 29918, 3027, 29892, 1967, 1402, 9685, 29922, 29906, 29897, 13, 4706, 565, 451, 10153, 29918, 1689, 29901, 13, 9651, 1967, 29918, 8394, 847, 29922, 29871, 29906, 29945, 29945, 29889, 13, 4706, 714, 29918, 3027, 29898, 3027, 29918, 8394, 29892, 3858, 29897, 13, 4706, 2867, 13, 13, 13, 1753, 714, 29918, 3027, 29898, 8346, 29892, 11073, 1125, 13, 1678, 1053, 22889, 29889, 2272, 5317, 408, 14770, 13, 1678, 14770, 29889, 4532, 580, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29953, 1125, 13, 4706, 14770, 29889, 1491, 5317, 29898, 29946, 29892, 29871, 29946, 29892, 474, 29974, 29896, 29897, 13, 4706, 14770, 29889, 3257, 29898, 13264, 29889, 1191, 3317, 29898, 21134, 29961, 29875, 14664, 23749, 3101, 13, 4706, 1967, 353, 4558, 29961, 29875, 29892, 584, 29892, 584, 29892, 584, 29962, 13, 4706, 565, 1967, 29889, 12181, 14352, 29896, 29962, 1275, 29871, 29896, 29901, 13, 9651, 1967, 353, 7442, 29889, 29879, 802, 29872, 911, 29898, 3027, 29892, 448, 29896, 29897, 13, 9651, 14770, 29889, 326, 4294, 29898, 3027, 29892, 274, 1958, 2433, 21012, 1495, 13, 4706, 1683, 29901, 13, 9651, 14770, 29889, 326, 4294, 29898, 3027, 29897, 13, 1678, 14770, 29889, 1491, 26762, 29918, 328, 5143, 29898, 14158, 29922, 29900, 29889, 29945, 29897, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 1776, 29918, 1272, 877, 3470, 29918, 23521, 391, 1495, 13, 1678, 396, 2302, 29918, 1272, 877, 10889, 29918, 23521, 391, 1495, 13, 1678, 396, 1776, 29918, 9910, 29918, 23521, 391, 580, 13, 1678, 2302, 29918, 9910, 29918, 23521, 391, 580, 13, 2 ]
tests/test_add_option_backtrace.py
ponponon/loguru
11,391
13505
<reponame>ponponon/loguru<gh_stars>1000+ from loguru import logger # See "test_catch_exceptions.py" for extended testing def test_backtrace(writer): logger.add(writer, format="{message}", backtrace=True) try: 1 / 0 except Exception: logger.exception("") result_with = writer.read().strip() logger.remove() writer.clear() logger.add(writer, format="{message}", backtrace=False) try: 1 / 0 except Exception: logger.exception("") result_without = writer.read().strip() assert len(result_with.splitlines()) > len(result_without.splitlines())
[ 1, 529, 276, 1112, 420, 29958, 1112, 1112, 265, 29914, 1188, 20144, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29900, 29974, 13, 3166, 1480, 20144, 1053, 17927, 13, 13, 29937, 2823, 376, 1688, 29918, 12510, 29918, 11739, 29879, 29889, 2272, 29908, 363, 10410, 6724, 13, 13, 13, 1753, 1243, 29918, 1627, 15003, 29898, 13236, 1125, 13, 1678, 17927, 29889, 1202, 29898, 13236, 29892, 3402, 10724, 4906, 17671, 1250, 15003, 29922, 5574, 29897, 13, 1678, 1018, 29901, 13, 308, 29896, 847, 29871, 29900, 13, 1678, 5174, 8960, 29901, 13, 4706, 17927, 29889, 11739, 703, 1159, 13, 1678, 1121, 29918, 2541, 353, 9227, 29889, 949, 2141, 17010, 580, 13, 13, 1678, 17927, 29889, 5992, 580, 13, 1678, 9227, 29889, 8551, 580, 13, 13, 1678, 17927, 29889, 1202, 29898, 13236, 29892, 3402, 10724, 4906, 17671, 1250, 15003, 29922, 8824, 29897, 13, 1678, 1018, 29901, 13, 308, 29896, 847, 29871, 29900, 13, 1678, 5174, 8960, 29901, 13, 4706, 17927, 29889, 11739, 703, 1159, 13, 1678, 1121, 29918, 14037, 353, 9227, 29889, 949, 2141, 17010, 580, 13, 13, 1678, 4974, 7431, 29898, 2914, 29918, 2541, 29889, 5451, 9012, 3101, 1405, 7431, 29898, 2914, 29918, 14037, 29889, 5451, 9012, 3101, 13, 2 ]
trump_net/spec/persons.py
iandennismiller/trump-net
0
1613410
# -*- coding: utf-8 -*- # trump-net (c) <NAME> from situation import Person donald_trump = Person.create(name="<NAME>") donald_trump_jr = Person.create(name="<NAME>, Jr.") fred_trump = Person.create(name="<NAME>") fred_trump_jr = Person.create(name="<NAME>ump, Jr.") ivana_trump = Person.create(name="<NAME>") ivanka_trump = Person.create(name="<NAME>") eric_trump = Person.create(name="<NAME>") tiffany_trump = Person.create(name="<NAME>") barron_trump = Person.create(name="<NAME>") marla_maples = Person.create(name="<NAME>") melania_trump = Person.create(name="<NAME>") jared_kushner = Person.create(name="<NAME>") charles_kushner = Person.create(name="<NAME>") paul_manafort = Person.create(name="<NAME>") steve_bannon = Person.create(name="<NAME>") roger_stone = Person.create(name="<NAME>") kelly_anne_conway = Person.create(name="<NAME>") robert_mercer = Person.create(name="<NAME>") rebekah_mercer = Person.create(name="<NAME>") natalia_veselnetskaya = Person.create(name="<NAME>") milo_yiannopoulos = Person.create(name="<NAME>") dmitry_rybolovlev = Person.create(name="<NAME>") artem_chaika = Person.create(name="<NAME>") igor_chaika = Person.create(name="<NAME>") yuri_chaika = Person.create(name="<NAME>") rob_goldstone = Person.create(name="<NAME>") aras_agalrov = Person.create(name="<NAME>") emin_agalrov = Person.create(name="<NAME>") dana_rohrbacher = Person.create(name="<NAME>")
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 534, 3427, 29899, 1212, 313, 29883, 29897, 529, 5813, 29958, 13, 13, 3166, 6434, 1053, 5196, 13, 13, 13, 9176, 2741, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 9176, 2741, 29918, 509, 3427, 29918, 29926, 29878, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 10202, 13843, 23157, 13, 18447, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 18447, 29918, 509, 3427, 29918, 29926, 29878, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 3427, 29892, 13843, 23157, 13, 440, 1648, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 440, 18330, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 261, 293, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 29873, 2593, 1384, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 1646, 1617, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 3034, 433, 29918, 1958, 793, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 12873, 4807, 29918, 509, 3427, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 29926, 1965, 29918, 29895, 1878, 1089, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 3090, 793, 29918, 29895, 1878, 1089, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 3274, 352, 29918, 1171, 2142, 441, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 1655, 345, 29918, 29890, 23453, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 307, 914, 29918, 12734, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 10265, 368, 29918, 11276, 29918, 535, 1582, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 307, 2151, 29918, 1050, 2265, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 276, 16863, 801, 29918, 1050, 2265, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 29876, 2075, 423, 29918, 1960, 295, 1212, 808, 9010, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 29885, 7820, 29918, 29891, 713, 29876, 459, 5059, 359, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 29881, 2415, 719, 29918, 719, 2095, 586, 2608, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 442, 331, 29918, 5815, 4106, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 335, 272, 29918, 5815, 4106, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 29891, 5338, 29918, 5815, 4106, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 13716, 29918, 29887, 1025, 12734, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 279, 294, 29918, 351, 284, 10139, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 331, 262, 29918, 351, 284, 10139, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 29881, 1648, 29918, 307, 1092, 6740, 261, 353, 5196, 29889, 3258, 29898, 978, 543, 29966, 5813, 29958, 1159, 13, 2 ]
interview/leet/445_Add_Two_Numbers_II_stack.py
eroicaleo/LearningPython
1
182305
#!/usr/bin/env python3 # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None from linklist import * class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ import collections stack1, stack2 = collections.deque(), collections.deque() while l1: stack1.append(l1.val) l1 = l1.next while l2: stack2.append(l2.val) l2 = l2.next add1, head = 0, None while stack1 or stack2: val1 = stack1.pop() if stack1 else 0 val2 = stack2.pop() if stack2 else 0 summmation = (val1+val2+add1) node = ListNode(summmation%10) add1 = summmation//10 head, node.next = node, head if add1: node = ListNode(add1) head, node.next = node, head return head sol = Solution() l1 = linkListBuilder('[7,2,4,3]') l2 = linkListBuilder('[5,6,4]') l1 = linkListBuilder('[1]') l2 = linkListBuilder('[9,9]') traverse(l1) traverse(l2) traverse(sol.addTwoNumbers(l1, l2))
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 29937, 21940, 363, 1809, 368, 29899, 2324, 287, 1051, 29889, 13, 29937, 770, 2391, 4247, 29898, 3318, 1125, 13, 29937, 268, 822, 4770, 2344, 12035, 1311, 29892, 921, 1125, 13, 29937, 308, 1583, 29889, 791, 353, 921, 13, 29937, 308, 1583, 29889, 4622, 353, 6213, 13, 13, 3166, 1544, 1761, 1053, 334, 13, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 788, 13985, 29478, 29898, 1311, 29892, 301, 29896, 29892, 301, 29906, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 301, 29896, 29901, 2391, 4247, 13, 4706, 584, 1853, 301, 29906, 29901, 2391, 4247, 13, 4706, 584, 29878, 1853, 29901, 2391, 4247, 13, 4706, 9995, 13, 4706, 1053, 16250, 13, 4706, 5096, 29896, 29892, 5096, 29906, 353, 16250, 29889, 311, 802, 3285, 16250, 29889, 311, 802, 580, 13, 4706, 1550, 301, 29896, 29901, 13, 9651, 5096, 29896, 29889, 4397, 29898, 29880, 29896, 29889, 791, 29897, 13, 9651, 301, 29896, 353, 301, 29896, 29889, 4622, 13, 4706, 1550, 301, 29906, 29901, 13, 9651, 5096, 29906, 29889, 4397, 29898, 29880, 29906, 29889, 791, 29897, 13, 9651, 301, 29906, 353, 301, 29906, 29889, 4622, 13, 4706, 788, 29896, 29892, 2343, 353, 29871, 29900, 29892, 6213, 13, 4706, 1550, 5096, 29896, 470, 5096, 29906, 29901, 13, 9651, 659, 29896, 353, 5096, 29896, 29889, 7323, 580, 565, 5096, 29896, 1683, 29871, 29900, 13, 9651, 659, 29906, 353, 5096, 29906, 29889, 7323, 580, 565, 5096, 29906, 1683, 29871, 29900, 13, 9651, 2533, 4317, 362, 353, 313, 791, 29896, 29974, 791, 29906, 29974, 1202, 29896, 29897, 13, 9651, 2943, 353, 2391, 4247, 29898, 2083, 4317, 362, 29995, 29896, 29900, 29897, 13, 9651, 788, 29896, 353, 2533, 4317, 362, 458, 29896, 29900, 13, 9651, 2343, 29892, 2943, 29889, 4622, 353, 2943, 29892, 2343, 13, 4706, 565, 788, 29896, 29901, 13, 9651, 2943, 353, 2391, 4247, 29898, 1202, 29896, 29897, 13, 9651, 2343, 29892, 2943, 29889, 4622, 353, 2943, 29892, 2343, 13, 4706, 736, 2343, 13, 13, 2929, 353, 24380, 580, 13, 29880, 29896, 353, 1544, 1293, 5627, 877, 29961, 29955, 29892, 29906, 29892, 29946, 29892, 29941, 29962, 1495, 13, 29880, 29906, 353, 1544, 1293, 5627, 877, 29961, 29945, 29892, 29953, 29892, 29946, 29962, 1495, 13, 29880, 29896, 353, 1544, 1293, 5627, 877, 29961, 29896, 29962, 1495, 13, 29880, 29906, 353, 1544, 1293, 5627, 877, 29961, 29929, 29892, 29929, 29962, 1495, 13, 3018, 3901, 29898, 29880, 29896, 29897, 13, 3018, 3901, 29898, 29880, 29906, 29897, 13, 3018, 3901, 29898, 2929, 29889, 1202, 13985, 29478, 29898, 29880, 29896, 29892, 301, 29906, 876, 13, 2 ]
veniq/patterns/classic_setter/classic_setter.py
lyriccoder/veniq
23
169510
from typing import List from veniq.ast_framework import ASTNodeType, AST from veniq.ast_framework.ast_node import ASTNode class ClassicSetter: """ The method's name starts with set. There are attributes assigning in the method. Also, asserts are ignored. """ suitable_nodes: List[ASTNodeType] = [ ASTNodeType.ASSERT_STATEMENT, ASTNodeType.STATEMENT_EXPRESSION, ] def _check_body_nodes(self, check_setter_body: List[ASTNode]) -> bool: """ Check whether nodes are agree with the following types (in self.suitable_nodes) or not. """ for node in check_setter_body: if node.node_type not in self.suitable_nodes: return False return True def value(self, ast: AST) -> List[int]: lines: List[int] = [] for node in ast.get_proxy_nodes(ASTNodeType.METHOD_DECLARATION): method_name = node.name if node.return_type is None and method_name.startswith('set') and \ self._check_body_nodes(node.body): lines.append(node.line) return sorted(lines)
[ 1, 515, 19229, 1053, 2391, 13, 3166, 6003, 29875, 29939, 29889, 579, 29918, 4468, 1053, 319, 1254, 4247, 1542, 29892, 319, 1254, 13, 3166, 6003, 29875, 29939, 29889, 579, 29918, 4468, 29889, 579, 29918, 3177, 1053, 319, 1254, 4247, 13, 13, 13, 1990, 24300, 22304, 29901, 13, 1678, 9995, 13, 1678, 450, 1158, 29915, 29879, 1024, 8665, 411, 731, 29889, 1670, 526, 8393, 13, 1678, 23188, 297, 278, 1158, 29889, 3115, 29892, 408, 643, 1372, 526, 17262, 29889, 13, 1678, 9995, 13, 1678, 13907, 29918, 18010, 29901, 2391, 29961, 28938, 4247, 1542, 29962, 353, 518, 13, 4706, 319, 1254, 4247, 1542, 29889, 22933, 20161, 29918, 19713, 13780, 29892, 13, 4706, 319, 1254, 4247, 1542, 29889, 19713, 13780, 29918, 5746, 15094, 13507, 29892, 13, 1678, 4514, 13, 13, 1678, 822, 903, 3198, 29918, 2587, 29918, 18010, 29898, 1311, 29892, 1423, 29918, 842, 357, 29918, 2587, 29901, 2391, 29961, 28938, 4247, 2314, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 5399, 3692, 7573, 526, 8661, 411, 278, 1494, 4072, 13, 4706, 313, 262, 1583, 29889, 2146, 8270, 29918, 18010, 29897, 470, 451, 29889, 13, 4706, 9995, 13, 4706, 363, 2943, 297, 1423, 29918, 842, 357, 29918, 2587, 29901, 13, 9651, 565, 2943, 29889, 3177, 29918, 1853, 451, 297, 1583, 29889, 2146, 8270, 29918, 18010, 29901, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 995, 29898, 1311, 29892, 8717, 29901, 319, 1254, 29897, 1599, 2391, 29961, 524, 5387, 13, 4706, 3454, 29901, 2391, 29961, 524, 29962, 353, 5159, 13, 4706, 363, 2943, 297, 8717, 29889, 657, 29918, 14701, 29918, 18010, 29898, 28938, 4247, 1542, 29889, 2303, 4690, 13668, 29918, 2287, 6154, 1718, 8098, 1125, 13, 9651, 1158, 29918, 978, 353, 2943, 29889, 978, 13, 9651, 565, 2943, 29889, 2457, 29918, 1853, 338, 6213, 322, 1158, 29918, 978, 29889, 27382, 2541, 877, 842, 1495, 322, 320, 13, 462, 1678, 1583, 3032, 3198, 29918, 2587, 29918, 18010, 29898, 3177, 29889, 2587, 1125, 13, 18884, 3454, 29889, 4397, 29898, 3177, 29889, 1220, 29897, 13, 4706, 736, 12705, 29898, 9012, 29897, 13, 2 ]
BOJ2559.py
INYEONGKIM/BOJ
2
91821
n,k=map(int,input().split());a=[int(i) for i in input().split()];m=sum(a[:k]);s=m for i in range(k,n): s+=(a[i]-a[i-k]) if s>m:m=s print(m)
[ 1, 302, 29892, 29895, 29922, 1958, 29898, 524, 29892, 2080, 2141, 5451, 3310, 29874, 11759, 524, 29898, 29875, 29897, 363, 474, 297, 1881, 2141, 5451, 580, 1385, 29885, 29922, 2083, 29898, 29874, 7503, 29895, 5691, 29879, 29922, 29885, 13, 1454, 474, 297, 3464, 29898, 29895, 29892, 29876, 1125, 13, 1678, 269, 29974, 7607, 29874, 29961, 29875, 29962, 29899, 29874, 29961, 29875, 29899, 29895, 2314, 13, 1678, 565, 269, 29958, 29885, 29901, 29885, 29922, 29879, 13, 2158, 29898, 29885, 29897, 13, 2 ]
test/test_cartesian.py
hwazni/discopy
205
117
from pytest import raises from discopy.cartesian import * def test_Box_repr(): f = Box('f', 1, 2, lambda x: (x, x)) assert "Box('f', 1, 2" in repr(f) def test_Function_str(): f = Function(2, 1, lambda x, y: x + y) assert 'Function(dom=2, cod=1,' in str(f) def test_Function_call(): f = Swap(2, 1) values = (2, 3) with raises(TypeError) as err: f(*values) assert str(err.value) == messages.expected_input_length(f, values) def test_Function_then(): f, g = Function(2, 1, lambda x, y: x + y), Function(1, 1, lambda x: x + 1) assert Function.id(2).then(*(f, g))(20, 21) == 42 def test_Function_then_err(): f = Function(2, 1, lambda x, y: x + y) g = (lambda x: x, ) with raises(TypeError) as err: f >> g assert str(err.value) == messages.type_err(Function, g) g = Function.id(2) with raises(AxiomError) as err: f >> g assert str(err.value) == messages.does_not_compose(f, g) def test_Function_tensor(): assert Function.id(3)(1, 2, 3)\ == Function.id(0).tensor(*(3 * [Function.id(1)]))(1, 2, 3) def test_Function_tensor_err(): f = Function(2, 1, lambda x, y: x + y) g = (lambda x: x, ) with raises(TypeError) as err: f @ g assert str(err.value) == messages.type_err(Function, g)
[ 1, 515, 11451, 1688, 1053, 1153, 4637, 13, 3166, 2313, 2270, 29889, 13823, 18970, 1053, 334, 13, 13, 13, 1753, 1243, 29918, 3313, 29918, 276, 558, 7295, 13, 1678, 285, 353, 11773, 877, 29888, 742, 29871, 29896, 29892, 29871, 29906, 29892, 14013, 921, 29901, 313, 29916, 29892, 921, 876, 13, 1678, 4974, 376, 3313, 877, 29888, 742, 29871, 29896, 29892, 29871, 29906, 29908, 297, 2062, 29898, 29888, 29897, 13, 13, 13, 1753, 1243, 29918, 6678, 29918, 710, 7295, 13, 1678, 285, 353, 6680, 29898, 29906, 29892, 29871, 29896, 29892, 14013, 921, 29892, 343, 29901, 921, 718, 343, 29897, 13, 1678, 4974, 525, 6678, 29898, 3129, 29922, 29906, 29892, 15234, 29922, 29896, 5501, 297, 851, 29898, 29888, 29897, 13, 13, 13, 1753, 1243, 29918, 6678, 29918, 4804, 7295, 13, 1678, 285, 353, 3925, 481, 29898, 29906, 29892, 29871, 29896, 29897, 13, 1678, 1819, 353, 313, 29906, 29892, 29871, 29941, 29897, 13, 1678, 411, 1153, 4637, 29898, 1542, 2392, 29897, 408, 4589, 29901, 13, 4706, 285, 10456, 5975, 29897, 13, 1678, 4974, 851, 29898, 3127, 29889, 1767, 29897, 1275, 7191, 29889, 9684, 29918, 2080, 29918, 2848, 29898, 29888, 29892, 1819, 29897, 13, 13, 13, 1753, 1243, 29918, 6678, 29918, 6098, 7295, 13, 1678, 285, 29892, 330, 353, 6680, 29898, 29906, 29892, 29871, 29896, 29892, 14013, 921, 29892, 343, 29901, 921, 718, 343, 511, 6680, 29898, 29896, 29892, 29871, 29896, 29892, 14013, 921, 29901, 921, 718, 29871, 29896, 29897, 13, 1678, 4974, 6680, 29889, 333, 29898, 29906, 467, 6098, 10456, 29898, 29888, 29892, 330, 876, 29898, 29906, 29900, 29892, 29871, 29906, 29896, 29897, 1275, 29871, 29946, 29906, 13, 13, 13, 1753, 1243, 29918, 6678, 29918, 6098, 29918, 3127, 7295, 13, 1678, 285, 353, 6680, 29898, 29906, 29892, 29871, 29896, 29892, 14013, 921, 29892, 343, 29901, 921, 718, 343, 29897, 13, 1678, 330, 353, 313, 2892, 921, 29901, 921, 29892, 1723, 13, 1678, 411, 1153, 4637, 29898, 1542, 2392, 29897, 408, 4589, 29901, 13, 4706, 285, 5099, 330, 13, 1678, 4974, 851, 29898, 3127, 29889, 1767, 29897, 1275, 7191, 29889, 1853, 29918, 3127, 29898, 6678, 29892, 330, 29897, 13, 1678, 330, 353, 6680, 29889, 333, 29898, 29906, 29897, 13, 1678, 411, 1153, 4637, 29898, 29909, 5389, 290, 2392, 29897, 408, 4589, 29901, 13, 4706, 285, 5099, 330, 13, 1678, 4974, 851, 29898, 3127, 29889, 1767, 29897, 1275, 7191, 29889, 13221, 29918, 1333, 29918, 19438, 29898, 29888, 29892, 330, 29897, 13, 13, 13, 1753, 1243, 29918, 6678, 29918, 20158, 7295, 13, 1678, 4974, 6680, 29889, 333, 29898, 29941, 5033, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 2144, 13, 4706, 1275, 6680, 29889, 333, 29898, 29900, 467, 20158, 10456, 29898, 29941, 334, 518, 6678, 29889, 333, 29898, 29896, 4638, 876, 29898, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29897, 13, 13, 13, 1753, 1243, 29918, 6678, 29918, 20158, 29918, 3127, 7295, 13, 1678, 285, 353, 6680, 29898, 29906, 29892, 29871, 29896, 29892, 14013, 921, 29892, 343, 29901, 921, 718, 343, 29897, 13, 1678, 330, 353, 313, 2892, 921, 29901, 921, 29892, 1723, 13, 1678, 411, 1153, 4637, 29898, 1542, 2392, 29897, 408, 4589, 29901, 13, 4706, 285, 732, 330, 13, 1678, 4974, 851, 29898, 3127, 29889, 1767, 29897, 1275, 7191, 29889, 1853, 29918, 3127, 29898, 6678, 29892, 330, 29897, 13, 2 ]
src/Testing/ZopeTestCase/__init__.py
tseaver/Zope-RFA
2
13378
<filename>src/Testing/ZopeTestCase/__init__.py ############################################################################## # # Copyright (c) 2005 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Names exported by the ZopeTestCase package """ import ZopeLite as Zope2 import utils import layer from ZopeLite import hasProduct from ZopeLite import installProduct from ZopeLite import hasPackage from ZopeLite import installPackage from ZopeLite import _print from ZopeTestCase import folder_name from ZopeTestCase import user_name from ZopeTestCase import user_password from ZopeTestCase import user_role from ZopeTestCase import standard_permissions from ZopeTestCase import ZopeTestCase from ZopeTestCase import FunctionalTestCase from PortalTestCase import portal_name from PortalTestCase import PortalTestCase from sandbox import Sandboxed from functional import Functional from base import TestCase from base import app from base import close from warnhook import WarningsHook from unittest import main from zopedoctest import ZopeDocTestSuite from zopedoctest import ZopeDocFileSuite from zopedoctest import FunctionalDocTestSuite from zopedoctest import FunctionalDocFileSuite import zopedoctest as doctest import transaction import placeless Zope = Zope2
[ 1, 529, 9507, 29958, 4351, 29914, 3057, 292, 29914, 29999, 2300, 3057, 8259, 29914, 1649, 2344, 26914, 2272, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29900, 29945, 796, 2300, 10606, 322, 2866, 1091, 29560, 29889, 13, 29937, 13, 29937, 910, 7047, 338, 4967, 304, 278, 1326, 12112, 310, 278, 796, 2300, 5236, 19245, 29892, 13, 29937, 10079, 29871, 29906, 29889, 29896, 313, 29999, 7390, 467, 29871, 319, 3509, 310, 278, 796, 7390, 881, 10259, 1384, 445, 4978, 29889, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 29908, 5300, 13764, 29979, 5300, 15149, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 13, 29937, 399, 1718, 29934, 13566, 29059, 319, 1525, 28657, 13875, 8890, 29928, 29892, 2672, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 7495, 29892, 6093, 306, 3580, 5265, 3352, 13, 29937, 399, 1718, 29934, 13566, 29059, 8079, 323, 1806, 1307, 29892, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 319, 12739, 25580, 2672, 15860, 1177, 1692, 13780, 29892, 5300, 383, 1806, 8186, 1799, 13, 29937, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 13, 29937, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 15945, 29908, 8659, 5609, 287, 491, 278, 796, 2300, 3057, 8259, 3577, 13, 15945, 29908, 13, 13, 5215, 796, 2300, 29931, 568, 408, 796, 2300, 29906, 13, 5215, 3667, 29879, 13, 5215, 7546, 13, 13, 3166, 796, 2300, 29931, 568, 1053, 756, 7566, 13, 3166, 796, 2300, 29931, 568, 1053, 2601, 7566, 13, 3166, 796, 2300, 29931, 568, 1053, 756, 14459, 13, 3166, 796, 2300, 29931, 568, 1053, 2601, 14459, 13, 3166, 796, 2300, 29931, 568, 1053, 903, 2158, 13, 13, 3166, 796, 2300, 3057, 8259, 1053, 4138, 29918, 978, 13, 3166, 796, 2300, 3057, 8259, 1053, 1404, 29918, 978, 13, 3166, 796, 2300, 3057, 8259, 1053, 1404, 29918, 5630, 13, 3166, 796, 2300, 3057, 8259, 1053, 1404, 29918, 12154, 13, 3166, 796, 2300, 3057, 8259, 1053, 3918, 29918, 17858, 6847, 13, 3166, 796, 2300, 3057, 8259, 1053, 796, 2300, 3057, 8259, 13, 3166, 796, 2300, 3057, 8259, 1053, 6680, 284, 3057, 8259, 13, 13, 3166, 28612, 3057, 8259, 1053, 25792, 29918, 978, 13, 3166, 28612, 3057, 8259, 1053, 28612, 3057, 8259, 13, 13, 3166, 11982, 1884, 1053, 8564, 1884, 287, 13, 3166, 13303, 1053, 6680, 284, 13, 13, 3166, 2967, 1053, 4321, 8259, 13, 3166, 2967, 1053, 623, 13, 3166, 2967, 1053, 3802, 13, 13, 3166, 29383, 20849, 1053, 399, 2753, 886, 29950, 2550, 13, 3166, 443, 27958, 1053, 1667, 13, 13, 3166, 503, 28605, 20082, 342, 1053, 796, 2300, 14526, 3057, 5091, 568, 13, 3166, 503, 28605, 20082, 342, 1053, 796, 2300, 14526, 2283, 5091, 568, 13, 3166, 503, 28605, 20082, 342, 1053, 6680, 284, 14526, 3057, 5091, 568, 13, 3166, 503, 28605, 20082, 342, 1053, 6680, 284, 14526, 2283, 5091, 568, 13, 13, 5215, 503, 28605, 20082, 342, 408, 437, 312, 342, 13, 5215, 10804, 13, 5215, 2174, 2242, 404, 13, 13, 29999, 2300, 353, 796, 2300, 29906, 13, 13, 2 ]
custom_components/waste_collection_schedule/waste_collection_schedule/wizard/stadtreinigung_hamburg.py
UBS-P/hacs_waste_collection_schedule
142
13112
#!/usr/bin/env python3 from html.parser import HTMLParser import inquirer import requests # Parser for HTML input class InputParser(HTMLParser): def __init__(self, input_name): super().__init__() self._input_name = input_name self._value = None @property def value(self): return self._value def handle_starttag(self, tag, attrs): if tag == "input": for attr in attrs: if attr[0] == "name" and attr[1] == self._input_name: for attr2 in attrs: if attr2[0] == "value": self._value = attr2[1] break break # Parser for HTML option list class OptionParser(HTMLParser): def __init__(self, select_name): super().__init__() self._select_name = select_name self._within_select = False self._within_option = False self._option_name = "" self._option_value = "-1" self._choices = [] @property def choices(self): return self._choices def handle_starttag(self, tag, attrs): if tag == "select": for attr in attrs: if attr[0] == "name" and attr[1] == self._select_name: self._within_select = True break elif tag == "option" and self._within_select: self._within_option = True for attr in attrs: if attr[0] == "value": self._option_value = attr[1] def handle_endtag(self, tag): if tag == "select": self._within_select = False elif tag == "option": if ( self._within_select and self._within_option and len(self._option_name) > 0 and self._option_value != "" ): self._choices.append((self._option_name, self._option_value)) self._within_option = False self._option_name = "" self._option_value = "-1" def handle_data(self, data): if self._within_option: self._option_name += data def main(): # search for street questions = [ inquirer.Text("strasse", message="Enter search string for street"), # inquirer.Text("hausnummer", message="Enter search string for house number"), ] answers = inquirer.prompt(questions) answers["hausnummer"] = "" answers["bestaetigung"] = "true" answers["mode"] = "search" r = requests.post( "https://www.stadtreinigung.hamburg/privatkunden/abfuhrkalender/index.html", data=answers, ) # search for street input_parser = InputParser(input_name="asId") input_parser.feed(r.text) if input_parser.value is not None: answers["asId"] = input_parser.value else: # query returned a list of streets parser = OptionParser(select_name="asId") parser.feed(r.text) questions = [ inquirer.List("asId", choices=parser.choices, message="Select street") ] answers.update(inquirer.prompt(questions)) # search for building number r = requests.post( "https://www.stadtreinigung.hamburg/privatkunden/abfuhrkalender/index.html", data=answers, ) # parser HTML option list parser = OptionParser(select_name="hnId") parser.feed(r.text) if len(parser.choices) == 0: answers["hnId"] = "" else: questions = [ inquirer.List("hnId", choices=parser.choices, message="Select house number") ] answers.update(inquirer.prompt(questions)) print("Copy the following statements into your configuration.yaml:\n") print("# waste_collection_schedule source configuration") print("waste_collection_schedule:") print(" sources:") print(" - name: stadtreinigung_hamburg") print(" args:") print(f" asId: {answers['asId']}") print(f" hnId: {answers['hnId']}") if __name__ == "__main__": main()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 3166, 3472, 29889, 16680, 1053, 4544, 11726, 13, 13, 5215, 25501, 381, 261, 13, 5215, 7274, 13, 13, 13, 29937, 1459, 643, 363, 4544, 1881, 13, 1990, 10567, 11726, 29898, 7020, 11726, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 978, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 3032, 2080, 29918, 978, 353, 1881, 29918, 978, 13, 4706, 1583, 3032, 1767, 353, 6213, 13, 13, 1678, 732, 6799, 13, 1678, 822, 995, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1767, 13, 13, 1678, 822, 4386, 29918, 2962, 4039, 29898, 1311, 29892, 4055, 29892, 12421, 29879, 1125, 13, 4706, 565, 4055, 1275, 376, 2080, 1115, 13, 9651, 363, 12421, 297, 12421, 29879, 29901, 13, 18884, 565, 12421, 29961, 29900, 29962, 1275, 376, 978, 29908, 322, 12421, 29961, 29896, 29962, 1275, 1583, 3032, 2080, 29918, 978, 29901, 13, 462, 1678, 363, 12421, 29906, 297, 12421, 29879, 29901, 13, 462, 4706, 565, 12421, 29906, 29961, 29900, 29962, 1275, 376, 1767, 1115, 13, 462, 9651, 1583, 3032, 1767, 353, 12421, 29906, 29961, 29896, 29962, 13, 462, 9651, 2867, 13, 462, 1678, 2867, 13, 13, 13, 29937, 1459, 643, 363, 4544, 2984, 1051, 13, 1990, 10831, 11726, 29898, 7020, 11726, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1831, 29918, 978, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 3032, 2622, 29918, 978, 353, 1831, 29918, 978, 13, 4706, 1583, 3032, 2541, 262, 29918, 2622, 353, 7700, 13, 4706, 1583, 3032, 2541, 262, 29918, 3385, 353, 7700, 13, 4706, 1583, 3032, 3385, 29918, 978, 353, 5124, 13, 4706, 1583, 3032, 3385, 29918, 1767, 353, 11663, 29896, 29908, 13, 4706, 1583, 3032, 1859, 1575, 353, 5159, 13, 13, 1678, 732, 6799, 13, 1678, 822, 19995, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1859, 1575, 13, 13, 1678, 822, 4386, 29918, 2962, 4039, 29898, 1311, 29892, 4055, 29892, 12421, 29879, 1125, 13, 4706, 565, 4055, 1275, 376, 2622, 1115, 13, 9651, 363, 12421, 297, 12421, 29879, 29901, 13, 18884, 565, 12421, 29961, 29900, 29962, 1275, 376, 978, 29908, 322, 12421, 29961, 29896, 29962, 1275, 1583, 3032, 2622, 29918, 978, 29901, 13, 462, 1678, 1583, 3032, 2541, 262, 29918, 2622, 353, 5852, 13, 462, 1678, 2867, 13, 4706, 25342, 4055, 1275, 376, 3385, 29908, 322, 1583, 3032, 2541, 262, 29918, 2622, 29901, 13, 9651, 1583, 3032, 2541, 262, 29918, 3385, 353, 5852, 13, 9651, 363, 12421, 297, 12421, 29879, 29901, 13, 18884, 565, 12421, 29961, 29900, 29962, 1275, 376, 1767, 1115, 13, 462, 1678, 1583, 3032, 3385, 29918, 1767, 353, 12421, 29961, 29896, 29962, 13, 13, 1678, 822, 4386, 29918, 355, 4039, 29898, 1311, 29892, 4055, 1125, 13, 4706, 565, 4055, 1275, 376, 2622, 1115, 13, 9651, 1583, 3032, 2541, 262, 29918, 2622, 353, 7700, 13, 4706, 25342, 4055, 1275, 376, 3385, 1115, 13, 9651, 565, 313, 13, 18884, 1583, 3032, 2541, 262, 29918, 2622, 13, 18884, 322, 1583, 3032, 2541, 262, 29918, 3385, 13, 18884, 322, 7431, 29898, 1311, 3032, 3385, 29918, 978, 29897, 1405, 29871, 29900, 13, 18884, 322, 1583, 3032, 3385, 29918, 1767, 2804, 5124, 13, 632, 1125, 13, 18884, 1583, 3032, 1859, 1575, 29889, 4397, 3552, 1311, 3032, 3385, 29918, 978, 29892, 1583, 3032, 3385, 29918, 1767, 876, 13, 9651, 1583, 3032, 2541, 262, 29918, 3385, 353, 7700, 13, 9651, 1583, 3032, 3385, 29918, 978, 353, 5124, 13, 9651, 1583, 3032, 3385, 29918, 1767, 353, 11663, 29896, 29908, 13, 13, 1678, 822, 4386, 29918, 1272, 29898, 1311, 29892, 848, 1125, 13, 4706, 565, 1583, 3032, 2541, 262, 29918, 3385, 29901, 13, 9651, 1583, 3032, 3385, 29918, 978, 4619, 848, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 396, 2740, 363, 11952, 13, 1678, 5155, 353, 518, 13, 4706, 25501, 381, 261, 29889, 1626, 703, 710, 5793, 613, 2643, 543, 10399, 2740, 1347, 363, 11952, 4968, 13, 4706, 396, 4706, 25501, 381, 261, 29889, 1626, 703, 6208, 1949, 1050, 613, 2643, 543, 10399, 2740, 1347, 363, 3699, 1353, 4968, 13, 1678, 4514, 13, 1678, 6089, 353, 25501, 381, 261, 29889, 14032, 415, 29898, 2619, 29897, 13, 13, 1678, 6089, 3366, 6208, 1949, 1050, 3108, 353, 5124, 13, 1678, 6089, 3366, 29890, 4405, 300, 11841, 3108, 353, 376, 3009, 29908, 13, 1678, 6089, 3366, 8513, 3108, 353, 376, 4478, 29908, 13, 13, 1678, 364, 353, 7274, 29889, 2490, 29898, 13, 4706, 376, 991, 597, 1636, 29889, 17569, 2484, 262, 11841, 29889, 29882, 1117, 2007, 29914, 22534, 271, 29895, 9784, 29914, 370, 21154, 1092, 11311, 1581, 29914, 2248, 29889, 1420, 613, 13, 4706, 848, 29922, 550, 17538, 29892, 13, 1678, 1723, 13, 13, 1678, 396, 2740, 363, 11952, 13, 1678, 1881, 29918, 16680, 353, 10567, 11726, 29898, 2080, 29918, 978, 543, 294, 1204, 1159, 13, 1678, 1881, 29918, 16680, 29889, 18798, 29898, 29878, 29889, 726, 29897, 13, 13, 1678, 565, 1881, 29918, 16680, 29889, 1767, 338, 451, 6213, 29901, 13, 4706, 6089, 3366, 294, 1204, 3108, 353, 1881, 29918, 16680, 29889, 1767, 13, 1678, 1683, 29901, 13, 4706, 396, 2346, 4133, 263, 1051, 310, 19756, 13, 4706, 13812, 353, 10831, 11726, 29898, 2622, 29918, 978, 543, 294, 1204, 1159, 13, 4706, 13812, 29889, 18798, 29898, 29878, 29889, 726, 29897, 13, 13, 4706, 5155, 353, 518, 13, 9651, 25501, 381, 261, 29889, 1293, 703, 294, 1204, 613, 19995, 29922, 16680, 29889, 1859, 1575, 29892, 2643, 543, 3549, 11952, 1159, 13, 4706, 4514, 13, 4706, 6089, 29889, 5504, 29898, 262, 339, 381, 261, 29889, 14032, 415, 29898, 2619, 876, 13, 13, 1678, 396, 2740, 363, 5214, 1353, 13, 1678, 364, 353, 7274, 29889, 2490, 29898, 13, 4706, 376, 991, 597, 1636, 29889, 17569, 2484, 262, 11841, 29889, 29882, 1117, 2007, 29914, 22534, 271, 29895, 9784, 29914, 370, 21154, 1092, 11311, 1581, 29914, 2248, 29889, 1420, 613, 13, 4706, 848, 29922, 550, 17538, 29892, 13, 1678, 1723, 13, 13, 1678, 396, 13812, 4544, 2984, 1051, 13, 1678, 13812, 353, 10831, 11726, 29898, 2622, 29918, 978, 543, 3123, 1204, 1159, 13, 1678, 13812, 29889, 18798, 29898, 29878, 29889, 726, 29897, 13, 13, 1678, 565, 7431, 29898, 16680, 29889, 1859, 1575, 29897, 1275, 29871, 29900, 29901, 13, 4706, 6089, 3366, 3123, 1204, 3108, 353, 5124, 13, 1678, 1683, 29901, 13, 4706, 5155, 353, 518, 13, 9651, 25501, 381, 261, 29889, 1293, 703, 3123, 1204, 613, 19995, 29922, 16680, 29889, 1859, 1575, 29892, 2643, 543, 3549, 3699, 1353, 1159, 13, 4706, 4514, 13, 4706, 6089, 29889, 5504, 29898, 262, 339, 381, 261, 29889, 14032, 415, 29898, 2619, 876, 13, 13, 1678, 1596, 703, 11882, 278, 1494, 9506, 964, 596, 5285, 29889, 25162, 3583, 29876, 1159, 13, 1678, 1596, 14822, 19863, 29918, 10855, 29918, 816, 11272, 2752, 5285, 1159, 13, 1678, 1596, 703, 29893, 4350, 29918, 10855, 29918, 816, 11272, 29901, 1159, 13, 1678, 1596, 703, 29871, 8974, 29901, 1159, 13, 1678, 1596, 703, 1678, 448, 1024, 29901, 10728, 2484, 262, 11841, 29918, 29882, 1117, 2007, 1159, 13, 1678, 1596, 703, 418, 6389, 29901, 1159, 13, 1678, 1596, 29898, 29888, 29908, 4706, 408, 1204, 29901, 426, 550, 17538, 1839, 294, 1204, 2033, 27195, 13, 1678, 1596, 29898, 29888, 29908, 4706, 298, 29876, 1204, 29901, 426, 550, 17538, 1839, 3123, 1204, 2033, 27195, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
lib/tagnews/crimetype/tag.py
jherzberg/article-tagging
44
158495
<filename>lib/tagnews/crimetype/tag.py<gh_stars>10-100 import os import pickle import glob import time import pandas as pd # not used explicitly, but this needs to be imported like this # for unpickling to work. from ..utils.model_helpers import LemmaTokenizer # noqa """ Contains the CrimeTags class that allows tagging of articles. """ MODEL_LOCATION = os.path.join(os.path.split(__file__)[0], 'models', 'binary_stemmed_logistic') TAGS = ['OEMC', 'CPD', 'SAO', 'CCCC', 'CCJ', 'CCSP', 'CPUB', 'IDOC', 'DOMV', 'SEXA', 'POLB', 'POLM', 'GUNV', 'GLBTQ', 'JUVE', 'REEN', 'VIOL', 'BEAT', 'PROB', 'PARL', 'CPLY', 'DRUG', 'CPS', 'GANG', 'ILSP', 'HOMI', 'IPRA', 'CPBD', 'IMMG', 'ENVI', 'UNSPC', 'ILSC', 'ARSN', 'BURG', 'DUI', 'FRUD', 'ROBB', 'TASR'] def load_model(location=MODEL_LOCATION): """ Load a model from the given folder `location`. There should be at least one file named model-TIME.pkl and a file named vectorizer-TIME.pkl inside the folder. The files with the most recent timestamp are loaded. """ models = glob.glob(os.path.join(location, 'model*.pkl')) if not models: raise RuntimeError(('No models to load. Run' ' "python -m tagnews.crimetype.models.' 'binary_stemmed_logistic.save_model"')) model = models.pop() while models: model_time = time.strptime(model[-19:-4], '%Y%m%d-%H%M%S') new_model_time = time.strptime(models[0][-19:-4], '%Y%m%d-%H%M%S') if model_time < new_model_time: model = models[0] models = models[1:] with open(model, 'rb') as f: clf = pickle.load(f) with open(os.path.join(location, 'vectorizer-' + model[-19:-4] + '.pkl'), 'rb') as f: vectorizer = pickle.load(f) return clf, vectorizer class CrimeTags(): """ CrimeTags let you tag articles. Neat! """ def __init__(self, model_directory=MODEL_LOCATION, clf=None, vectorizer=None): """ Load a model from the given `model_directory`. See `load_model` for more information. Alternatively, the classifier and vectorizer can be provided. If one is provided, then both must be provided. """ if clf is None and vectorizer is None: self.clf, self.vectorizer = load_model(model_directory) elif clf is None or vectorizer is None: raise ValueError(('clf and vectorizer must both be None,' ' or both be not None')) else: self.clf, self.vectorizer = clf, vectorizer def tagtext_proba(self, text): """ Compute the probability each tag applies to the given text. inputs: text: A python string. returns: pred_proba: A pandas series indexed by the tag name. """ x = self.vectorizer.transform([text]) y_hat = self.clf.predict_proba(x) preds = pd.DataFrame(y_hat) preds.columns = TAGS preds = preds.T.iloc[:, 0].sort_values(ascending=False) return preds def tagtext(self, text, prob_thresh=0.5): """ Tag a string with labels. inputs: text: A python string. prob_thresh: The threshold on probability at which point the tag will be applied. returns: preds: A list of tags that have > prob_thresh probability according to the model. """ preds = self.tagtext_proba(text) return preds[preds > prob_thresh].index.values.tolist() def relevant_proba(self, text): """ Outputs the probability that the given text is relevant. This probability is computed naively as the maximum of the probabilities each tag applies to the text. A more nuanced method would compute a joint probability. inputs: text: A python string. returns: relevant_proba: Probability the text is relevant. """ return max(self.tagtext_proba(text)) def relevant(self, text, prob_thresh=0.05): """ Determines whether given text is relevant or not. Relevance is defined as whether any tag has more than prob_thresh chance of applying to the text according to the model. inputs: text: A python string. prob_thresh: The threshold on probability that determines relevance. If no tags have >= prob_thresh of applying to the text, then the text is not relevant. returns: relevant: Boolean. Is the text "relevant"? """ return len(self.tagtext(text, prob_thresh)) > 0 def get_contributions(self, text): """ Rank the words in the text by their contribution to each category. This function assumes that clf has an attribute `coef_` and that vectorizer has an attribute `inverse_transform`. inputs: text: A python string. returns: contributions: Pandas panel keyed off [category, word]. Example: >>> s = 'This is an article about drugs and gangs.' >>> s += ' Written by the amazing <NAME>.' >>> p = tagger.get_contributions(s) >>> p['DRUG'].sort_values('weight', ascending=False) weight drug 5.549870 copyright 0.366905 gang 0.194773 this 0.124590 an -0.004484 article -0.052026 is -0.085534 about -0.154800 kevin -0.219028 rose -0.238296 and -0.316201 . -0.853208 """ p = {} vec = self.vectorizer.transform([text]) vec_inv = self.vectorizer.inverse_transform(vec) for i, tag in enumerate(TAGS): p[tag] = pd.DataFrame( index=vec_inv, data={'weight': self.clf.coef_[i, vec.nonzero()[1]]} ) return pd.Panel(p)
[ 1, 529, 9507, 29958, 1982, 29914, 4039, 15753, 29914, 29883, 5632, 300, 668, 29914, 4039, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 2897, 13, 5215, 5839, 280, 13, 5215, 13149, 13, 5215, 931, 13, 5215, 11701, 408, 10518, 13, 13, 29937, 451, 1304, 9479, 29892, 541, 445, 4225, 304, 367, 19673, 763, 445, 13, 29937, 363, 443, 23945, 1847, 304, 664, 29889, 13, 3166, 6317, 13239, 29889, 4299, 29918, 3952, 6774, 1053, 11894, 6066, 3950, 396, 694, 25621, 13, 13, 15945, 29908, 13, 21409, 278, 29682, 28089, 770, 393, 6511, 4055, 3460, 310, 7456, 29889, 13, 15945, 29908, 13, 13, 20387, 29931, 29918, 16652, 8098, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 5451, 22168, 1445, 1649, 9601, 29900, 1402, 13, 462, 795, 525, 9794, 742, 13, 462, 795, 525, 19541, 29918, 303, 331, 2168, 29918, 1188, 4695, 1495, 13, 13, 6040, 10749, 353, 6024, 29949, 29923, 12513, 742, 525, 6271, 29928, 742, 525, 8132, 29949, 742, 525, 4174, 4174, 742, 525, 4174, 29967, 742, 525, 4174, 5550, 742, 13, 4706, 525, 6271, 7466, 742, 525, 1367, 20166, 742, 525, 22141, 29963, 742, 525, 1660, 29990, 29909, 742, 525, 29925, 5607, 29933, 742, 525, 29925, 5607, 29924, 742, 13, 4706, 525, 29954, 3904, 29963, 742, 525, 7239, 29933, 29911, 29984, 742, 525, 29967, 29965, 12064, 742, 525, 1525, 1430, 742, 525, 18118, 5607, 742, 525, 15349, 1299, 742, 13, 4706, 525, 8618, 29933, 742, 525, 16320, 29931, 742, 525, 6271, 16786, 742, 525, 8353, 23338, 742, 525, 6271, 29903, 742, 525, 29954, 19453, 742, 525, 6227, 5550, 742, 13, 4706, 525, 29950, 6488, 29902, 742, 525, 5690, 4717, 742, 525, 6271, 29121, 742, 525, 29902, 7428, 29954, 742, 525, 1430, 18118, 742, 525, 29965, 3059, 9026, 742, 13, 4706, 525, 6227, 7187, 742, 525, 1718, 19296, 742, 525, 29933, 4574, 29954, 742, 525, 29928, 3120, 742, 525, 15860, 15789, 742, 525, 1672, 14388, 742, 525, 29911, 3289, 29934, 2033, 13, 13, 13, 1753, 2254, 29918, 4299, 29898, 5479, 29922, 20387, 29931, 29918, 16652, 8098, 1125, 13, 1678, 9995, 13, 1678, 16012, 263, 1904, 515, 278, 2183, 4138, 421, 5479, 1412, 13, 1678, 1670, 881, 367, 472, 3203, 697, 934, 4257, 1904, 29899, 15307, 29889, 29886, 6321, 322, 13, 1678, 263, 934, 4257, 4608, 3950, 29899, 15307, 29889, 29886, 6321, 2768, 278, 4138, 29889, 13, 13, 1678, 450, 2066, 411, 278, 1556, 7786, 14334, 526, 7500, 29889, 13, 1678, 9995, 13, 1678, 4733, 353, 13149, 29889, 23705, 29898, 359, 29889, 2084, 29889, 7122, 29898, 5479, 29892, 525, 4299, 10521, 29886, 6321, 8785, 13, 1678, 565, 451, 4733, 29901, 13, 4706, 12020, 24875, 2392, 29898, 877, 3782, 4733, 304, 2254, 29889, 7525, 29915, 13, 462, 9651, 525, 376, 4691, 448, 29885, 4055, 15753, 29889, 29883, 5632, 300, 668, 29889, 9794, 6169, 13, 462, 9651, 525, 19541, 29918, 303, 331, 2168, 29918, 1188, 4695, 29889, 7620, 29918, 4299, 29908, 8785, 13, 1678, 1904, 353, 4733, 29889, 7323, 580, 13, 1678, 1550, 4733, 29901, 13, 4706, 1904, 29918, 2230, 353, 931, 29889, 710, 415, 603, 29898, 4299, 14352, 29896, 29929, 13018, 29946, 1402, 14210, 29979, 29995, 29885, 29995, 29881, 19222, 29950, 29995, 29924, 29995, 29903, 1495, 13, 4706, 716, 29918, 4299, 29918, 2230, 353, 931, 29889, 710, 415, 603, 29898, 9794, 29961, 29900, 3816, 29899, 29896, 29929, 13018, 29946, 1402, 14210, 29979, 29995, 29885, 29995, 29881, 19222, 29950, 29995, 29924, 29995, 29903, 1495, 13, 4706, 565, 1904, 29918, 2230, 529, 716, 29918, 4299, 29918, 2230, 29901, 13, 9651, 1904, 353, 4733, 29961, 29900, 29962, 13, 4706, 4733, 353, 4733, 29961, 29896, 17531, 13, 13, 1678, 411, 1722, 29898, 4299, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 4706, 1067, 29888, 353, 5839, 280, 29889, 1359, 29898, 29888, 29897, 13, 13, 1678, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 5479, 29892, 525, 8111, 3950, 29899, 29915, 718, 1904, 14352, 29896, 29929, 13018, 29946, 29962, 718, 15300, 29886, 6321, 5477, 13, 795, 525, 6050, 1495, 408, 285, 29901, 13, 4706, 4608, 3950, 353, 5839, 280, 29889, 1359, 29898, 29888, 29897, 13, 13, 1678, 736, 1067, 29888, 29892, 4608, 3950, 13, 13, 13, 1990, 29682, 28089, 7295, 13, 1678, 9995, 13, 1678, 29682, 28089, 1235, 366, 4055, 7456, 29889, 2448, 271, 29991, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 1904, 29918, 12322, 29922, 20387, 29931, 29918, 16652, 8098, 29892, 13, 462, 1067, 29888, 29922, 8516, 29892, 13, 462, 4608, 3950, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 16012, 263, 1904, 515, 278, 2183, 421, 4299, 29918, 12322, 1412, 13, 4706, 2823, 421, 1359, 29918, 4299, 29952, 363, 901, 2472, 29889, 13, 13, 4706, 20360, 29892, 278, 770, 3709, 322, 4608, 3950, 508, 367, 13, 4706, 4944, 29889, 960, 697, 338, 4944, 29892, 769, 1716, 1818, 367, 4944, 29889, 13, 4706, 9995, 13, 4706, 565, 1067, 29888, 338, 6213, 322, 4608, 3950, 338, 6213, 29901, 13, 9651, 1583, 29889, 695, 29888, 29892, 1583, 29889, 8111, 3950, 353, 2254, 29918, 4299, 29898, 4299, 29918, 12322, 29897, 13, 4706, 25342, 1067, 29888, 338, 6213, 470, 4608, 3950, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 29898, 877, 695, 29888, 322, 4608, 3950, 1818, 1716, 367, 6213, 5501, 13, 462, 795, 525, 470, 1716, 367, 451, 6213, 8785, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 695, 29888, 29892, 1583, 29889, 8111, 3950, 353, 1067, 29888, 29892, 4608, 3950, 13, 13, 1678, 822, 4055, 726, 29918, 771, 2291, 29898, 1311, 29892, 1426, 1125, 13, 4706, 9995, 13, 4706, 11796, 29872, 278, 6976, 1269, 4055, 16058, 304, 278, 2183, 1426, 29889, 13, 13, 4706, 10970, 29901, 13, 9651, 1426, 29901, 319, 3017, 1347, 29889, 13, 4706, 3639, 29901, 13, 9651, 4450, 29918, 771, 2291, 29901, 319, 11701, 3652, 27541, 491, 278, 4055, 1024, 29889, 13, 4706, 9995, 13, 4706, 921, 353, 1583, 29889, 8111, 3950, 29889, 9067, 4197, 726, 2314, 13, 4706, 343, 29918, 2455, 353, 1583, 29889, 695, 29888, 29889, 27711, 29918, 771, 2291, 29898, 29916, 29897, 13, 4706, 4450, 29879, 353, 10518, 29889, 17271, 29898, 29891, 29918, 2455, 29897, 13, 4706, 4450, 29879, 29889, 13099, 353, 323, 10051, 29903, 13, 4706, 4450, 29879, 353, 4450, 29879, 29889, 29911, 29889, 309, 542, 7503, 29892, 29871, 29900, 1822, 6605, 29918, 5975, 29898, 6151, 2548, 29922, 8824, 29897, 13, 4706, 736, 4450, 29879, 13, 13, 1678, 822, 4055, 726, 29898, 1311, 29892, 1426, 29892, 2070, 29918, 386, 3781, 29922, 29900, 29889, 29945, 1125, 13, 4706, 9995, 13, 4706, 10522, 263, 1347, 411, 11073, 29889, 13, 13, 4706, 10970, 29901, 13, 9651, 1426, 29901, 319, 3017, 1347, 29889, 13, 9651, 2070, 29918, 386, 3781, 29901, 450, 16897, 373, 6976, 472, 607, 1298, 13, 18884, 278, 4055, 674, 367, 7436, 29889, 13, 4706, 3639, 29901, 13, 9651, 4450, 29879, 29901, 319, 1051, 310, 8282, 393, 505, 1405, 2070, 29918, 386, 3781, 6976, 13, 18884, 5034, 304, 278, 1904, 29889, 13, 4706, 9995, 13, 4706, 4450, 29879, 353, 1583, 29889, 4039, 726, 29918, 771, 2291, 29898, 726, 29897, 13, 4706, 736, 4450, 29879, 29961, 11965, 29879, 1405, 2070, 29918, 386, 3781, 1822, 2248, 29889, 5975, 29889, 25027, 391, 580, 13, 13, 1678, 822, 8018, 29918, 771, 2291, 29898, 1311, 29892, 1426, 1125, 13, 4706, 9995, 13, 4706, 10604, 29879, 278, 6976, 393, 278, 2183, 1426, 338, 8018, 29889, 13, 4706, 910, 6976, 338, 15712, 1055, 3598, 408, 278, 7472, 310, 13, 4706, 278, 2070, 11614, 1269, 4055, 16058, 304, 278, 1426, 29889, 13, 13, 4706, 319, 901, 4948, 8362, 1158, 723, 10272, 263, 14002, 6976, 29889, 13, 13, 4706, 10970, 29901, 13, 9651, 1426, 29901, 319, 3017, 1347, 29889, 13, 13, 4706, 3639, 29901, 13, 9651, 8018, 29918, 771, 2291, 29901, 1019, 29890, 3097, 278, 1426, 338, 8018, 29889, 13, 4706, 9995, 13, 4706, 736, 4236, 29898, 1311, 29889, 4039, 726, 29918, 771, 2291, 29898, 726, 876, 13, 13, 1678, 822, 8018, 29898, 1311, 29892, 1426, 29892, 2070, 29918, 386, 3781, 29922, 29900, 29889, 29900, 29945, 1125, 13, 4706, 9995, 13, 4706, 5953, 837, 1475, 3692, 2183, 1426, 338, 8018, 470, 451, 29889, 830, 2608, 749, 13, 4706, 338, 3342, 408, 3692, 738, 4055, 756, 901, 1135, 2070, 29918, 386, 3781, 13, 4706, 8825, 310, 15399, 304, 278, 1426, 5034, 304, 278, 1904, 29889, 13, 13, 4706, 10970, 29901, 13, 9651, 1426, 29901, 319, 3017, 1347, 29889, 13, 9651, 2070, 29918, 386, 3781, 29901, 450, 16897, 373, 6976, 393, 13, 18884, 3683, 1475, 29527, 749, 29889, 960, 694, 8282, 505, 6736, 13, 18884, 2070, 29918, 386, 3781, 310, 15399, 304, 278, 1426, 29892, 769, 13, 18884, 278, 1426, 338, 451, 8018, 29889, 13, 4706, 3639, 29901, 13, 9651, 8018, 29901, 11185, 29889, 1317, 278, 1426, 376, 276, 6591, 8652, 13, 4706, 9995, 13, 4706, 736, 7431, 29898, 1311, 29889, 4039, 726, 29898, 726, 29892, 2070, 29918, 386, 3781, 876, 1405, 29871, 29900, 13, 13, 1678, 822, 679, 29918, 1285, 3224, 29879, 29898, 1311, 29892, 1426, 1125, 13, 4706, 9995, 13, 4706, 22125, 278, 3838, 297, 278, 1426, 491, 1009, 11896, 304, 1269, 13, 4706, 7663, 29889, 910, 740, 15894, 393, 1067, 29888, 756, 385, 5352, 13, 4706, 421, 1111, 1389, 29918, 29952, 322, 393, 4608, 3950, 756, 385, 5352, 13, 4706, 421, 262, 3901, 29918, 9067, 1412, 13, 13, 4706, 10970, 29901, 13, 9651, 1426, 29901, 319, 3017, 1347, 29889, 13, 4706, 3639, 29901, 13, 9651, 20706, 29901, 349, 7086, 9451, 1820, 287, 1283, 518, 7320, 29892, 1734, 1822, 13, 13, 4706, 8741, 29901, 13, 4706, 8653, 269, 353, 525, 4013, 338, 385, 4274, 1048, 5883, 3174, 322, 20676, 29879, 6169, 13, 4706, 8653, 269, 4619, 525, 16849, 841, 491, 278, 21863, 292, 529, 5813, 29958, 6169, 13, 4706, 8653, 282, 353, 4055, 914, 29889, 657, 29918, 1285, 3224, 29879, 29898, 29879, 29897, 13, 4706, 8653, 282, 1839, 8353, 23338, 13359, 6605, 29918, 5975, 877, 7915, 742, 12066, 2548, 29922, 8824, 29897, 13, 462, 268, 7688, 13, 4706, 15721, 4706, 29945, 29889, 29945, 29946, 29929, 29947, 29955, 29900, 13, 4706, 3509, 1266, 259, 29900, 29889, 29941, 29953, 29953, 29929, 29900, 29945, 13, 4706, 20676, 4706, 29900, 29889, 29896, 29929, 29946, 29955, 29955, 29941, 13, 4706, 445, 4706, 29900, 29889, 29896, 29906, 29946, 29945, 29929, 29900, 13, 4706, 385, 4706, 448, 29900, 29889, 29900, 29900, 29946, 29946, 29947, 29946, 13, 4706, 4274, 259, 448, 29900, 29889, 29900, 29945, 29906, 29900, 29906, 29953, 13, 4706, 338, 4706, 448, 29900, 29889, 29900, 29947, 29945, 29945, 29941, 29946, 13, 4706, 1048, 268, 448, 29900, 29889, 29896, 29945, 29946, 29947, 29900, 29900, 13, 4706, 1589, 3845, 268, 448, 29900, 29889, 29906, 29896, 29929, 29900, 29906, 29947, 13, 4706, 11492, 418, 448, 29900, 29889, 29906, 29941, 29947, 29906, 29929, 29953, 13, 4706, 322, 539, 448, 29900, 29889, 29941, 29896, 29953, 29906, 29900, 29896, 13, 4706, 869, 308, 448, 29900, 29889, 29947, 29945, 29941, 29906, 29900, 29947, 13, 4706, 9995, 13, 4706, 282, 353, 6571, 13, 4706, 9649, 353, 1583, 29889, 8111, 3950, 29889, 9067, 4197, 726, 2314, 13, 4706, 9649, 29918, 11569, 353, 1583, 29889, 8111, 3950, 29889, 262, 3901, 29918, 9067, 29898, 2003, 29897, 13, 4706, 363, 474, 29892, 4055, 297, 26985, 29898, 6040, 10749, 1125, 13, 9651, 282, 29961, 4039, 29962, 353, 10518, 29889, 17271, 29898, 13, 18884, 2380, 29922, 2003, 29918, 11569, 29892, 13, 18884, 848, 3790, 29915, 7915, 2396, 1583, 29889, 695, 29888, 29889, 1111, 1389, 29918, 29961, 29875, 29892, 9649, 29889, 5464, 9171, 580, 29961, 29896, 5262, 29913, 13, 9651, 1723, 13, 4706, 736, 10518, 29889, 7490, 29898, 29886, 29897, 13, 2 ]
FeiZhai/feizhaipro/apps/news/migrations/0007_auto_20181031_1327.py
FSen0/FeiZhai
0
192520
# Generated by Django 2.0.6 on 2018-10-31 05:27 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('news', '0006_auto_20181030_0943'), ] operations = [ migrations.RemoveField( model_name='comment', name='create_time', ), migrations.RemoveField( model_name='comment', name='is_delete', ), migrations.RemoveField( model_name='comment', name='update_time', ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29900, 29889, 29953, 373, 29871, 29906, 29900, 29896, 29947, 29899, 29896, 29900, 29899, 29941, 29896, 29871, 29900, 29945, 29901, 29906, 29955, 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, 15753, 742, 525, 29900, 29900, 29900, 29953, 29918, 6921, 29918, 29906, 29900, 29896, 29947, 29896, 29900, 29941, 29900, 29918, 29900, 29929, 29946, 29941, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 9342, 742, 13, 9651, 1024, 2433, 3258, 29918, 2230, 742, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 9342, 742, 13, 9651, 1024, 2433, 275, 29918, 8143, 742, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 9342, 742, 13, 9651, 1024, 2433, 5504, 29918, 2230, 742, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
Differential Equation Parameter Estimate/testrun1/fitting_post_processing.py
etjoa003/incipy
0
71620
import param_estimate as pe import matplotlib.pyplot as plt import numpy as np import time import pickle filename = 'fitting_data' save_data_series = [1,2,3] for j in save_data_series: pkl_file = open(filename+'_'+str(j)+'.par', 'rb') SAVE_DATA = None SAVE_DATA = pickle.load(pkl_file) pkl_file.close() fig = plt.figure(j) ax = None ax2 = None ax = fig.add_subplot(211) # ------------------- EXPT DATA ---------------------------------= Xr, Yr = pe.load_data(plot_data=0) ax.scatter(Xr,Yr,3,marker="x",c="g") # ------------------- DATA FROM OPTIMIZATION --------------------- color_scheme = np.linspace(0,1,len(SAVE_DATA)) for i in range(len(SAVE_DATA)): data_store = SAVE_DATA[i] n_set = data_store["n_set"] t_set = data_store["t_set"] p = data_store["p"] mse_list = data_store["mse_list"] print(" i = ", i) print(" p = ", p ) if i==0: this_label = "init curve" else: this_label = str(i) ax.plot(t_set,n_set, color=(1-color_scheme[i],0,color_scheme[i]), label=this_label) if i ==0: this_title = "initial G,k1,k2,k3 = " + str(p) plt.title(this_title) ax2 = fig.add_subplot(212) ax2.plot(range(len(mse_list)),mse_list) ax.legend() ax.set_xlabel("t") ax.set_ylabel("n") ax2.set_xlabel("i") ax2.set_ylabel("MSE") plt.show() print("\nClosing Post-Processing Program...")
[ 1, 1053, 1828, 29918, 342, 6490, 408, 1236, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 12655, 408, 7442, 13, 5215, 931, 13, 5215, 5839, 280, 13, 13, 9507, 353, 525, 29888, 5367, 29918, 1272, 29915, 13, 7620, 29918, 1272, 29918, 13757, 353, 518, 29896, 29892, 29906, 29892, 29941, 29962, 13, 13, 1454, 432, 297, 4078, 29918, 1272, 29918, 13757, 29901, 13, 12, 29886, 6321, 29918, 1445, 353, 1722, 29898, 9507, 29974, 15972, 18717, 710, 29898, 29926, 7240, 4286, 862, 742, 525, 6050, 1495, 13, 12, 29903, 7520, 29923, 29918, 14573, 353, 6213, 13, 12, 29903, 7520, 29923, 29918, 14573, 353, 5839, 280, 29889, 1359, 29898, 29886, 6321, 29918, 1445, 29897, 13, 12, 29886, 6321, 29918, 1445, 29889, 5358, 580, 13, 13, 13, 12, 1003, 353, 14770, 29889, 4532, 29898, 29926, 29897, 13, 12, 1165, 353, 6213, 13, 12, 1165, 29906, 353, 6213, 13, 12, 1165, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29906, 29896, 29896, 29897, 13, 13, 12, 29937, 448, 2683, 489, 8528, 7982, 360, 8254, 448, 2683, 2683, 29922, 13, 12, 29990, 29878, 29892, 612, 29878, 353, 1236, 29889, 1359, 29918, 1272, 29898, 5317, 29918, 1272, 29922, 29900, 29897, 13, 12, 1165, 29889, 1557, 2620, 29898, 29990, 29878, 29892, 29979, 29878, 29892, 29941, 29892, 22976, 543, 29916, 613, 29883, 543, 29887, 1159, 13, 13, 12, 29937, 448, 2683, 489, 360, 8254, 3895, 6418, 29911, 7833, 26664, 8098, 448, 2683, 807, 13, 12, 2780, 29918, 816, 2004, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29892, 29896, 29892, 2435, 29898, 29903, 7520, 29923, 29918, 14573, 876, 13, 12, 1454, 474, 297, 3464, 29898, 2435, 29898, 29903, 7520, 29923, 29918, 14573, 22164, 13, 12, 12, 1272, 29918, 8899, 353, 317, 7520, 29923, 29918, 14573, 29961, 29875, 29962, 13, 12, 12, 29876, 29918, 842, 353, 848, 29918, 8899, 3366, 29876, 29918, 842, 3108, 13, 12, 12, 29873, 29918, 842, 353, 848, 29918, 8899, 3366, 29873, 29918, 842, 3108, 13, 12, 12, 29886, 353, 848, 29918, 8899, 3366, 29886, 3108, 13, 12, 12, 29885, 344, 29918, 1761, 353, 848, 29918, 8899, 3366, 29885, 344, 29918, 1761, 3108, 13, 12, 12, 2158, 703, 474, 353, 9162, 474, 29897, 13, 12, 12, 2158, 703, 259, 282, 353, 9162, 282, 1723, 13, 12, 12, 361, 474, 1360, 29900, 29901, 13, 12, 12, 12, 1366, 29918, 1643, 353, 376, 2344, 11672, 29908, 29871, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 1366, 29918, 1643, 353, 851, 29898, 29875, 29897, 13, 12, 12, 1165, 29889, 5317, 29898, 29873, 29918, 842, 29892, 29876, 29918, 842, 29892, 2927, 7607, 29896, 29899, 2780, 29918, 816, 2004, 29961, 29875, 1402, 29900, 29892, 2780, 29918, 816, 2004, 29961, 29875, 11724, 3858, 29922, 1366, 29918, 1643, 29897, 13, 12, 12, 361, 474, 1275, 29900, 29901, 13, 12, 12, 12, 1366, 29918, 3257, 353, 376, 11228, 402, 29892, 29895, 29896, 29892, 29895, 29906, 29892, 29895, 29941, 353, 376, 718, 851, 29898, 29886, 29897, 13, 12, 13, 12, 572, 29873, 29889, 3257, 29898, 1366, 29918, 3257, 29897, 13, 12, 1165, 29906, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29906, 29896, 29906, 29897, 13, 12, 1165, 29906, 29889, 5317, 29898, 3881, 29898, 2435, 29898, 29885, 344, 29918, 1761, 8243, 29885, 344, 29918, 1761, 29897, 13, 12, 1165, 29889, 26172, 580, 13, 12, 1165, 29889, 842, 29918, 29916, 1643, 703, 29873, 1159, 13, 12, 1165, 29889, 842, 29918, 29891, 1643, 703, 29876, 1159, 13, 12, 1165, 29906, 29889, 842, 29918, 29916, 1643, 703, 29875, 1159, 13, 12, 1165, 29906, 29889, 842, 29918, 29891, 1643, 703, 29924, 1660, 1159, 13, 572, 29873, 29889, 4294, 580, 12, 13, 13, 2158, 14182, 29876, 29907, 5409, 292, 4918, 29899, 7032, 292, 7835, 856, 1159, 2 ]
SmallTool/Web/UDPClient.py
ASC8384/-
8
141354
from socket import * import time serverName = '127.0.0.1' serverPort = 12345 clientSocket = socket(AF_INET, SOCK_DGRAM) now = 0 while(1): message = input('Input lowercase sentence>\n') message = message.encode('utf-8') clientSocket.sendto(message, (serverName, serverPort)) modifiedMessage, serverAddress = clientSocket.recvfrom(2048) sec = time.time_ns() now += 1 print('Time(ns): {}'.format(sec)) print('No.{} is {}'.format(now, modifiedMessage.decode()), end = "\n\n")
[ 1, 515, 9909, 1053, 334, 13, 5215, 931, 13, 13, 2974, 1170, 353, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29915, 13, 2974, 2290, 353, 29871, 29896, 29906, 29941, 29946, 29945, 13, 4645, 11373, 353, 9909, 29898, 5098, 29918, 1177, 2544, 29892, 7791, 7077, 29918, 29928, 29954, 25058, 29897, 13, 13, 3707, 353, 29871, 29900, 13, 8000, 29898, 29896, 1125, 13, 1678, 2643, 353, 1881, 877, 4290, 5224, 4878, 10541, 14247, 29876, 1495, 13, 1678, 2643, 353, 2643, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 1678, 3132, 11373, 29889, 6717, 517, 29898, 4906, 29892, 313, 2974, 1170, 29892, 1923, 2290, 876, 13, 1678, 9120, 3728, 29892, 1923, 7061, 353, 3132, 11373, 29889, 3757, 29894, 3166, 29898, 29906, 29900, 29946, 29947, 29897, 13, 1678, 5226, 353, 931, 29889, 2230, 29918, 1983, 580, 13, 1678, 1286, 4619, 29871, 29896, 13, 1678, 1596, 877, 2481, 29898, 1983, 1125, 6571, 4286, 4830, 29898, 3471, 876, 13, 1678, 1596, 877, 3782, 29889, 8875, 338, 6571, 4286, 4830, 29898, 3707, 29892, 9120, 3728, 29889, 13808, 25739, 1095, 353, 6634, 29876, 29905, 29876, 1159, 13, 2 ]
config.py
weingxing/Netease-View
2
1604426
headers = { 'host': 'music.163.com', 'Referer': 'http://music.163.com/search/', 'User-Agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36') } # 浏览器抓包 cookies = { 'iuqxldmzr': '32', '_ntes_nnid': '47a31c044187ff48f995fc10e593b78b,1615971340579', '_ntes_nuid': '47a31c044187ff48f995fc10e593b78b', 'NMTID': '00OYwPk3p1J102uyEFbguri5i7SpswAAAF4P2Xuaw', 'WM_TID': 'LKnniVnKnBNAAFERBVJ7Kf9ziZMa+E+n', 'JSESSIONID-WYYY': 'Um92Sp7WbAwPE\K8ffeNQA/SFd9Yqnbsv0GaCNPUTJh2D+ZH8VTbDZa6GD+UBW/jmVDRUj5Wexduo8kWx5KWj7AT5qjdFdXvVvz+\+6QexXUZWMMCYltXG2EQF+7zgEoDMEF9jqinoQpU3fv2Qxh46\3v774Toshdvqn6MJA/cRTV9SW:1617175277426; WNMCID=luvhfq.1617173477749.01.0', 'WEVNSM': '1.0.0', 'WM_NI': 'nKY3Kf28ifAQL425HXspkWwFGYc+t7gHoz1rLtJqw+3v2+F1dTdjVFbBMTAchIM4uY8V/9SHbnMVO+SVOYiF5JmKlP3+ToCLWHIvf4MeR1t25XGbho7FL0ehVvFQgZaYMjI=', 'WM_NIKE': '<KEY>', 'MUSIC_U': '<KEY>', '__csrf': '805b6f08367a5e62dc131d88f653b51e', 'ntes_kaola_ad': '1' } mongodb_url = 'mongodb://localhost:27017/' # db_name = 'netease' db_name = 'netease2' col = 'ballad'
[ 1, 9066, 353, 426, 13, 1678, 525, 3069, 2396, 525, 23596, 29889, 29896, 29953, 29941, 29889, 510, 742, 13, 1678, 525, 1123, 571, 261, 2396, 525, 1124, 597, 23596, 29889, 29896, 29953, 29941, 29889, 510, 29914, 4478, 29914, 742, 13, 1678, 525, 2659, 29899, 19661, 2396, 13, 4706, 6702, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 7685, 405, 29911, 29871, 29896, 29900, 29889, 29900, 29936, 8892, 29953, 29946, 29936, 921, 29953, 29946, 29897, 12113, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 29915, 13, 308, 525, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10228, 29914, 29953, 29941, 29889, 29900, 29889, 29941, 29906, 29941, 29929, 29889, 29896, 29941, 29906, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 1495, 13, 29913, 13, 13, 29937, 29871, 233, 184, 146, 235, 170, 139, 30943, 233, 141, 150, 31473, 13, 15108, 583, 353, 426, 13, 1678, 525, 5871, 29939, 29916, 430, 29885, 29920, 29878, 2396, 525, 29941, 29906, 742, 13, 1678, 22868, 593, 267, 29918, 15755, 333, 2396, 525, 29946, 29955, 29874, 29941, 29896, 29883, 29900, 29946, 29946, 29896, 29947, 29955, 600, 29946, 29947, 29888, 29929, 29929, 29945, 13801, 29896, 29900, 29872, 29945, 29929, 29941, 29890, 29955, 29947, 29890, 29892, 29896, 29953, 29896, 29945, 29929, 29955, 29896, 29941, 29946, 29900, 29945, 29955, 29929, 742, 13, 1678, 22868, 593, 267, 29918, 3433, 333, 2396, 525, 29946, 29955, 29874, 29941, 29896, 29883, 29900, 29946, 29946, 29896, 29947, 29955, 600, 29946, 29947, 29888, 29929, 29929, 29945, 13801, 29896, 29900, 29872, 29945, 29929, 29941, 29890, 29955, 29947, 29890, 742, 13, 1678, 525, 29940, 11490, 1367, 2396, 525, 29900, 29900, 29949, 29979, 29893, 29925, 29895, 29941, 29886, 29896, 29967, 29896, 29900, 29906, 8631, 29638, 16264, 5338, 29945, 29875, 29955, 29903, 567, 29893, 6344, 5098, 29946, 29925, 29906, 29990, 29884, 1450, 742, 13, 1678, 525, 26735, 29918, 29911, 1367, 2396, 525, 29931, 29968, 29876, 1240, 29963, 29876, 29968, 29876, 29933, 3521, 5098, 1001, 29933, 29963, 29967, 29955, 29968, 29888, 29929, 2526, 29999, 21870, 29974, 29923, 29974, 29876, 742, 13, 1678, 525, 29967, 17493, 1367, 29899, 29956, 14995, 29979, 2396, 525, 29965, 29885, 29929, 29906, 5592, 29955, 29956, 29890, 29909, 29893, 4162, 29905, 29968, 29947, 17615, 29940, 29984, 29909, 29914, 20322, 29881, 29929, 29979, 29939, 9877, 4501, 29900, 29954, 29874, 13778, 12336, 29967, 29882, 29906, 29928, 29974, 29999, 29950, 29947, 29963, 29911, 29890, 29928, 29999, 29874, 29953, 29954, 29928, 29974, 7466, 29956, 29914, 21231, 29963, 8353, 29965, 29926, 29945, 29956, 735, 700, 29877, 29947, 29895, 29956, 29916, 29945, 29968, 29956, 29926, 29955, 1299, 29945, 29939, 26012, 29943, 29881, 29990, 29894, 29963, 29894, 29920, 3124, 29974, 29953, 29984, 735, 29990, 29965, 29999, 29956, 7428, 29907, 29979, 1896, 29990, 29954, 29906, 28879, 29943, 29974, 29955, 29920, 29887, 29923, 29877, 29928, 2303, 29943, 29929, 28695, 1789, 29984, 29886, 29965, 29941, 29888, 29894, 29906, 29984, 29916, 29882, 29946, 29953, 29905, 29941, 29894, 29955, 29955, 29946, 29911, 10578, 29881, 29894, 29939, 29876, 29953, 29924, 29967, 29909, 29914, 29883, 29934, 8050, 29929, 23066, 29901, 29896, 29953, 29896, 29955, 29896, 29955, 29945, 29906, 29955, 29955, 29946, 29906, 29953, 29936, 399, 29940, 12513, 1367, 29922, 29880, 4090, 29882, 29888, 29939, 29889, 29896, 29953, 29896, 29955, 29896, 29955, 29941, 29946, 29955, 29955, 29955, 29946, 29929, 29889, 29900, 29896, 29889, 29900, 742, 13, 1678, 525, 8851, 29963, 3059, 29924, 2396, 525, 29896, 29889, 29900, 29889, 29900, 742, 13, 1678, 525, 26735, 29918, 12916, 2396, 525, 29876, 29968, 29979, 29941, 29968, 29888, 29906, 29947, 361, 29909, 2239, 29946, 29906, 29945, 29950, 29990, 1028, 29895, 29956, 29893, 29943, 29954, 29979, 29883, 29974, 29873, 29955, 29887, 29950, 2112, 29896, 29878, 29931, 29873, 29967, 29939, 29893, 29974, 29941, 29894, 29906, 29974, 29943, 29896, 29881, 29911, 19776, 24460, 29890, 29933, 29924, 6040, 305, 7833, 29946, 29884, 29979, 29947, 29963, 29914, 29929, 7068, 11197, 29924, 24898, 29974, 7597, 29949, 29979, 29875, 29943, 29945, 29967, 29885, 29968, 29880, 29925, 29941, 29974, 1762, 6154, 29956, 17628, 29894, 29888, 29946, 6816, 29934, 29896, 29873, 29906, 29945, 29990, 29954, 29890, 1251, 29955, 10536, 29900, 14797, 29963, 29894, 29943, 29984, 29887, 29999, 29874, 29979, 29924, 29926, 29902, 29922, 742, 13, 1678, 525, 26735, 29918, 12916, 6059, 2396, 12801, 10818, 29958, 742, 13, 1678, 525, 29924, 3308, 2965, 29918, 29965, 2396, 12801, 10818, 29958, 742, 13, 1678, 525, 1649, 2395, 9600, 2396, 525, 29947, 29900, 29945, 29890, 29953, 29888, 29900, 29947, 29941, 29953, 29955, 29874, 29945, 29872, 29953, 29906, 13891, 29896, 29941, 29896, 29881, 29947, 29947, 29888, 29953, 29945, 29941, 29890, 29945, 29896, 29872, 742, 13, 1678, 525, 593, 267, 29918, 1335, 2963, 29918, 328, 2396, 525, 29896, 29915, 13, 29913, 13, 13, 23264, 29918, 2271, 353, 525, 23264, 597, 7640, 29901, 29906, 29955, 29900, 29896, 29955, 22208, 13, 29937, 4833, 29918, 978, 353, 525, 18977, 559, 29915, 13, 2585, 29918, 978, 353, 525, 18977, 559, 29906, 29915, 13, 1054, 353, 525, 2135, 328, 29915, 13, 2 ]
tests/pyexp_tests.py
nguyentu1602/pyexp
0
162242
from nose.tools import * import pyexp def setup(): print("Setup.") def teardown(): print("Tear down.") def test_basic(): print("Ran.")
[ 1, 515, 26414, 29889, 8504, 1053, 334, 13, 5215, 11451, 4548, 13, 13, 1753, 6230, 7295, 13, 1678, 1596, 703, 26947, 23157, 13, 13, 1753, 734, 538, 776, 7295, 13, 1678, 1596, 703, 29911, 799, 1623, 23157, 13, 13, 1753, 1243, 29918, 16121, 7295, 13, 1678, 1596, 703, 29934, 273, 23157, 13, 2 ]
tests/benchmarks/benchmark_indiv.py
qanastek/EasyMCDM
4
162262
<gh_stars>1-10 import time import matplotlib.pyplot as plt from EasyMCDM.models.Electre import Electre from EasyMCDM.models.Promethee import Promethee from EasyMCDM.models.Pareto import Pareto from EasyMCDM.models.WeightedSum import WeightedSum from EasyMCDM.models.Irmo import Irmo data = {} indexes = [ 0, 1, 2, 3, 4, 5, 6 ] weights = [0.14,0.14,0.14,0.14,0.14,0.14,0.14] prefs = ["min","max","min","min","min","max","min"] vetoes = [45, 29, 550, 6, 4.5, 4.5, 4.5] indifference_threshold = 0.6 preference_thresholds = [20, 10, 200, 4, 2, 2, 7] paddings = [] promethee_values = [] electre_values = [] weighted_values = [] pareto_values = [] nbindiv=2500 for i in range(10,nbindiv,100): print(i) paddings.append(i) for j in range(i,i+100): data["item_" + str(j)] = [4.0, 5.0, 18.0, 39.6, 6.0, 378.0, 31.2] w = WeightedSum(data=data, verbose=False) pa = Pareto(data=data, verbose=False) pr = Promethee(data=data, verbose=False) e = Electre(data=data, verbose=False) start = time.time() re = e.solve(weights, prefs, vetoes, indifference_threshold, preference_thresholds) electre_values.append(time.time() - start) start = time.time() rpr = pr.solve(weights=weights, prefs=prefs) promethee_values.append(time.time() - start) start = time.time() rpa = pa.solve(indexes=indexes, prefs=prefs) pareto_values.append(time.time() - start) start = time.time() rw = w.solve(pref_indexes=indexes, prefs=prefs, weights=weights, target='min') weighted_values.append(time.time() - start) plt.plot(paddings, promethee_values, label="promethee") plt.plot(paddings, electre_values, label="electre") plt.plot(paddings, weighted_values, label="weighted") plt.plot(paddings, pareto_values, label="pareto") plt.legend() plt.savefig("benchmark_nb_indiv.png") plt.close()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 931, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 3166, 382, 8995, 29924, 6530, 29924, 29889, 9794, 29889, 29923, 781, 276, 1053, 10513, 276, 13, 3166, 382, 8995, 29924, 6530, 29924, 29889, 9794, 29889, 18571, 23043, 29872, 1053, 9705, 23043, 29872, 13, 3166, 382, 8995, 29924, 6530, 29924, 29889, 9794, 29889, 29925, 598, 517, 1053, 349, 598, 517, 13, 3166, 382, 8995, 29924, 6530, 29924, 29889, 9794, 29889, 22676, 287, 11139, 1053, 1334, 523, 287, 11139, 13, 3166, 382, 8995, 29924, 6530, 29924, 29889, 9794, 29889, 29902, 1758, 29877, 1053, 306, 1758, 29877, 13, 13, 1272, 353, 6571, 13, 2248, 267, 353, 518, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 4514, 13, 705, 5861, 353, 518, 29900, 29889, 29896, 29946, 29892, 29900, 29889, 29896, 29946, 29892, 29900, 29889, 29896, 29946, 29892, 29900, 29889, 29896, 29946, 29892, 29900, 29889, 29896, 29946, 29892, 29900, 29889, 29896, 29946, 29892, 29900, 29889, 29896, 29946, 29962, 13, 29886, 24539, 353, 6796, 1195, 3284, 3317, 3284, 1195, 3284, 1195, 3284, 1195, 3284, 3317, 3284, 1195, 3108, 13, 5990, 29877, 267, 353, 518, 29946, 29945, 29892, 29871, 29906, 29929, 29892, 29871, 29945, 29945, 29900, 29892, 29871, 29953, 29892, 29871, 29946, 29889, 29945, 29892, 29871, 29946, 29889, 29945, 29892, 29871, 29946, 29889, 29945, 29962, 13, 513, 17678, 29918, 386, 12268, 353, 29871, 29900, 29889, 29953, 13, 1457, 1659, 29918, 386, 3781, 3361, 353, 518, 29906, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29946, 29892, 29871, 29906, 29892, 29871, 29906, 29892, 29871, 29955, 29962, 13, 13, 29886, 1202, 886, 353, 5159, 13, 14032, 23043, 29872, 29918, 5975, 353, 5159, 13, 15436, 276, 29918, 5975, 353, 5159, 13, 7915, 287, 29918, 5975, 353, 5159, 13, 29886, 598, 517, 29918, 5975, 353, 5159, 13, 13, 29876, 5355, 440, 29922, 29906, 29945, 29900, 29900, 13, 1454, 474, 297, 3464, 29898, 29896, 29900, 29892, 29876, 5355, 440, 29892, 29896, 29900, 29900, 1125, 13, 1678, 1596, 29898, 29875, 29897, 13, 13, 1678, 282, 1202, 886, 29889, 4397, 29898, 29875, 29897, 13, 1678, 363, 432, 297, 3464, 29898, 29875, 29892, 29875, 29974, 29896, 29900, 29900, 1125, 13, 4706, 848, 3366, 667, 27508, 718, 851, 29898, 29926, 4638, 353, 518, 29946, 29889, 29900, 29892, 29871, 29945, 29889, 29900, 29892, 29871, 29896, 29947, 29889, 29900, 29892, 29871, 29941, 29929, 29889, 29953, 29892, 29871, 29953, 29889, 29900, 29892, 29871, 29941, 29955, 29947, 29889, 29900, 29892, 29871, 29941, 29896, 29889, 29906, 29962, 13, 13, 1678, 281, 353, 1334, 523, 287, 11139, 29898, 1272, 29922, 1272, 29892, 26952, 29922, 8824, 29897, 13, 1678, 3300, 353, 349, 598, 517, 29898, 1272, 29922, 1272, 29892, 26952, 29922, 8824, 29897, 13, 1678, 544, 353, 9705, 23043, 29872, 29898, 1272, 29922, 1272, 29892, 26952, 29922, 8824, 29897, 13, 1678, 321, 353, 10513, 276, 29898, 1272, 29922, 1272, 29892, 26952, 29922, 8824, 29897, 13, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 337, 353, 321, 29889, 2929, 345, 29898, 705, 5861, 29892, 758, 5847, 29892, 325, 10896, 267, 29892, 1399, 17678, 29918, 386, 12268, 29892, 24583, 29918, 386, 3781, 3361, 29897, 13, 1678, 3546, 276, 29918, 5975, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 1369, 29897, 13, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 364, 558, 353, 544, 29889, 2929, 345, 29898, 705, 5861, 29922, 705, 5861, 29892, 758, 5847, 29922, 29886, 24539, 29897, 13, 1678, 2504, 23043, 29872, 29918, 5975, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 1369, 29897, 13, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 364, 3274, 353, 3300, 29889, 2929, 345, 29898, 2248, 267, 29922, 2248, 267, 29892, 758, 5847, 29922, 29886, 24539, 29897, 13, 1678, 9541, 517, 29918, 5975, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 1369, 29897, 13, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 364, 29893, 353, 281, 29889, 2929, 345, 29898, 29886, 999, 29918, 2248, 267, 29922, 2248, 267, 29892, 758, 5847, 29922, 29886, 24539, 29892, 18177, 29922, 705, 5861, 29892, 3646, 2433, 1195, 1495, 13, 1678, 7688, 287, 29918, 5975, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 1369, 29897, 13, 13, 572, 29873, 29889, 5317, 29898, 29886, 1202, 886, 29892, 2504, 23043, 29872, 29918, 5975, 29892, 3858, 543, 14032, 23043, 29872, 1159, 13, 572, 29873, 29889, 5317, 29898, 29886, 1202, 886, 29892, 3546, 276, 29918, 5975, 29892, 3858, 543, 15436, 276, 1159, 13, 572, 29873, 29889, 5317, 29898, 29886, 1202, 886, 29892, 7688, 287, 29918, 5975, 29892, 3858, 543, 7915, 287, 1159, 13, 572, 29873, 29889, 5317, 29898, 29886, 1202, 886, 29892, 9541, 517, 29918, 5975, 29892, 3858, 543, 29886, 598, 517, 1159, 13, 572, 29873, 29889, 26172, 580, 13, 572, 29873, 29889, 7620, 1003, 703, 1785, 16580, 29918, 9877, 29918, 513, 440, 29889, 2732, 1159, 13, 572, 29873, 29889, 5358, 580, 13, 2 ]
yezdi/parser/parser.py
ragsagar/yezdi
1
3887
from yezdi.lexer.token import TokenType from yezdi.parser.ast import Program, Statement, Participant, Title, LineStatement class Parser: def __init__(self, lexer): self.lexer = lexer self.current_token = None self.peek_token = None self.next_token() self.next_token() self.participants = {} def next_token(self): self.current_token, self.peek_token = self.peek_token, self.lexer.next_token() def parse_program(self): program = Program() while self.current_token.type != TokenType.EOF: statement = self.parse_statement() if statement: program.statements.append(statement) self.next_token() return program def parse_statement(self): if self.current_token.type == TokenType.IDENTIFIER: return self.parse_line_statement() elif self.current_token.type == TokenType.TITLE: return self.parse_title() return None def parse_line_statement(self): participant_literal = self.current_token.literal if not self.peek_token.type in [TokenType.SOLID_LINE, TokenType.DASHED_LINE]: return None self.next_token() participant = Participant(participant_literal) line = LineStatement(self.current_token.type) line.set_source(participant) if not self.expect_peek(TokenType.IDENTIFIER): return None target = Participant(self.current_token.literal) line.set_target(target) if not self.expect_peek(TokenType.COLON): return None if self.expect_peek(TokenType.IDENTIFIER): line.set_info(self.current_token.literal) if self.peek_token.type not in [TokenType.NEWLINE, TokenType.EOF]: return None statement = Statement(line) return statement def get_participant(self, value): if value in self.participants: return self.participants[value] else: participant = Participant(value) self.participants[value] = participant return participant def expect_peek(self, token_type): if self.peek_token.type == token_type: self.next_token() return True else: return False def parse_title(self): if not self.expect_peek(TokenType.IDENTIFIER): return None title = Title(self.current_token.literal) return Statement(title) class ParserError(Exception): pass
[ 1, 515, 343, 6096, 6051, 29889, 2506, 261, 29889, 6979, 1053, 25159, 1542, 13, 3166, 343, 6096, 6051, 29889, 16680, 29889, 579, 1053, 7835, 29892, 6666, 882, 29892, 3455, 12654, 424, 29892, 18527, 29892, 7407, 14473, 13, 13, 13, 1990, 1459, 643, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19566, 261, 1125, 13, 4706, 1583, 29889, 2506, 261, 353, 19566, 261, 13, 4706, 1583, 29889, 3784, 29918, 6979, 353, 6213, 13, 4706, 1583, 29889, 412, 1416, 29918, 6979, 353, 6213, 13, 4706, 1583, 29889, 4622, 29918, 6979, 580, 13, 4706, 1583, 29889, 4622, 29918, 6979, 580, 13, 4706, 1583, 29889, 1595, 12654, 1934, 353, 6571, 13, 13, 1678, 822, 2446, 29918, 6979, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3784, 29918, 6979, 29892, 1583, 29889, 412, 1416, 29918, 6979, 353, 1583, 29889, 412, 1416, 29918, 6979, 29892, 1583, 29889, 2506, 261, 29889, 4622, 29918, 6979, 580, 13, 13, 1678, 822, 6088, 29918, 8860, 29898, 1311, 1125, 13, 4706, 1824, 353, 7835, 580, 13, 4706, 1550, 1583, 29889, 3784, 29918, 6979, 29889, 1853, 2804, 25159, 1542, 29889, 29923, 9800, 29901, 13, 9651, 3229, 353, 1583, 29889, 5510, 29918, 20788, 580, 13, 9651, 565, 3229, 29901, 13, 18884, 1824, 29889, 6112, 4110, 29889, 4397, 29898, 20788, 29897, 13, 9651, 1583, 29889, 4622, 29918, 6979, 580, 13, 4706, 736, 1824, 13, 13, 1678, 822, 6088, 29918, 20788, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 3784, 29918, 6979, 29889, 1853, 1275, 25159, 1542, 29889, 1367, 3919, 29902, 3738, 1001, 29901, 13, 9651, 736, 1583, 29889, 5510, 29918, 1220, 29918, 20788, 580, 13, 4706, 25342, 1583, 29889, 3784, 29918, 6979, 29889, 1853, 1275, 25159, 1542, 29889, 29911, 1806, 1307, 29901, 13, 9651, 736, 1583, 29889, 5510, 29918, 3257, 580, 13, 4706, 736, 6213, 13, 13, 1678, 822, 6088, 29918, 1220, 29918, 20788, 29898, 1311, 1125, 13, 4706, 5221, 424, 29918, 20889, 284, 353, 1583, 29889, 3784, 29918, 6979, 29889, 20889, 284, 13, 13, 4706, 565, 451, 1583, 29889, 412, 1416, 29918, 6979, 29889, 1853, 297, 518, 6066, 1542, 29889, 29903, 5607, 1367, 29918, 18521, 29892, 25159, 1542, 29889, 29928, 24943, 3352, 29918, 18521, 5387, 13, 9651, 736, 6213, 13, 4706, 1583, 29889, 4622, 29918, 6979, 580, 13, 13, 4706, 5221, 424, 353, 3455, 12654, 424, 29898, 1595, 12654, 424, 29918, 20889, 284, 29897, 13, 4706, 1196, 353, 7407, 14473, 29898, 1311, 29889, 3784, 29918, 6979, 29889, 1853, 29897, 13, 4706, 1196, 29889, 842, 29918, 4993, 29898, 1595, 12654, 424, 29897, 13, 4706, 565, 451, 1583, 29889, 17854, 29918, 412, 1416, 29898, 6066, 1542, 29889, 1367, 3919, 29902, 3738, 1001, 1125, 13, 9651, 736, 6213, 13, 4706, 3646, 353, 3455, 12654, 424, 29898, 1311, 29889, 3784, 29918, 6979, 29889, 20889, 284, 29897, 13, 4706, 1196, 29889, 842, 29918, 5182, 29898, 5182, 29897, 13, 4706, 565, 451, 1583, 29889, 17854, 29918, 412, 1416, 29898, 6066, 1542, 29889, 15032, 1164, 1125, 13, 9651, 736, 6213, 13, 4706, 565, 1583, 29889, 17854, 29918, 412, 1416, 29898, 6066, 1542, 29889, 1367, 3919, 29902, 3738, 1001, 1125, 13, 9651, 1196, 29889, 842, 29918, 3888, 29898, 1311, 29889, 3784, 29918, 6979, 29889, 20889, 284, 29897, 13, 4706, 565, 1583, 29889, 412, 1416, 29918, 6979, 29889, 1853, 451, 297, 518, 6066, 1542, 29889, 28577, 18521, 29892, 25159, 1542, 29889, 29923, 9800, 5387, 13, 9651, 736, 6213, 13, 4706, 3229, 353, 6666, 882, 29898, 1220, 29897, 13, 4706, 736, 3229, 13, 13, 1678, 822, 679, 29918, 1595, 12654, 424, 29898, 1311, 29892, 995, 1125, 13, 4706, 565, 995, 297, 1583, 29889, 1595, 12654, 1934, 29901, 13, 9651, 736, 1583, 29889, 1595, 12654, 1934, 29961, 1767, 29962, 13, 4706, 1683, 29901, 13, 9651, 5221, 424, 353, 3455, 12654, 424, 29898, 1767, 29897, 13, 9651, 1583, 29889, 1595, 12654, 1934, 29961, 1767, 29962, 353, 5221, 424, 13, 4706, 736, 5221, 424, 13, 13, 1678, 822, 2149, 29918, 412, 1416, 29898, 1311, 29892, 5993, 29918, 1853, 1125, 13, 4706, 565, 1583, 29889, 412, 1416, 29918, 6979, 29889, 1853, 1275, 5993, 29918, 1853, 29901, 13, 9651, 1583, 29889, 4622, 29918, 6979, 580, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 13, 1678, 822, 6088, 29918, 3257, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 29889, 17854, 29918, 412, 1416, 29898, 6066, 1542, 29889, 1367, 3919, 29902, 3738, 1001, 1125, 13, 9651, 736, 6213, 13, 4706, 3611, 353, 18527, 29898, 1311, 29889, 3784, 29918, 6979, 29889, 20889, 284, 29897, 13, 4706, 736, 6666, 882, 29898, 3257, 29897, 13, 13, 13, 1990, 1459, 643, 2392, 29898, 2451, 1125, 13, 1678, 1209, 13, 2 ]
fetch_data.py
Kartones/pcgw-game-engines
0
111471
import csv from datetime import datetime import json from operator import itemgetter from typing import cast, Dict, List, Tuple from urllib.parse import quote_plus import requests class FetchPCGWData: USER_AGENT = "PCGW-Game-Engines/0.2 (https://github.com/kartones/pcgw-game-engines)" CSV_SEPARATOR = "," CSV_QUOTE_CHAR = "\"" PAGE_SIZE = 500 ENGINE_PREFIX = "Engine:" GAMES_CSV_HEADER_ROW = ["title", "engine", "release_date"] # bad data ENGINE_OUTLIERS = ["129401"] @classmethod def fetch_game_engines_list_to_csv(cls, list_output_filename: str) -> None: count = 0 # must be json engines_list_url = "https://www.pcgamingwiki.com/w/api.php?action=query&generator=categorymembers&gcmlimit={limit}&format=json&gcmtitle=Category:Engines".format( # NOQA: E501 limit=cls.PAGE_SIZE ) headers = { "User-Agent": cls.USER_AGENT } response = requests.get(engines_list_url, headers=headers) engines_json = json.loads(response.text)["query"]["pages"] with open(list_output_filename, "w", newline="") as csv_file_handle: csv_writer = csv.writer(csv_file_handle, delimiter=cls.CSV_SEPARATOR, quotechar=cls.CSV_QUOTE_CHAR, quoting=csv.QUOTE_ALL) csv_writer.writerow(["id", "title"]) for key in (engines_json.keys() - cls.ENGINE_OUTLIERS): csv_writer.writerow([engines_json[key]["pageid"], engines_json[key]["title"].lstrip(cls.ENGINE_PREFIX)]) count += 1 print("> Read {} engines ".format(count)) print("> Written data to '{}'".format(list_output_filename)) @classmethod def fetch_games(cls, engines_list_filename: str, games_output_filename: str) -> None: count = 0 games = [] # type: List[Tuple[str, str, str]] engines = cls._load_engines_from_csv(engines_list_filename) # Note: as saves each game of a certain engine, engines without games automatically filtered out for engine in engines: engine_games = data._fetch_games_per_engine(engine) games += engine_games print("> Read {count} games with engine '{engine}'".format(count=len(engine_games), engine=engine)) with open(games_output_filename, "w", newline="") as csv_file_handle: csv_writer = csv.writer(csv_file_handle, delimiter=cls.CSV_SEPARATOR, quotechar=cls.CSV_QUOTE_CHAR, quoting=csv.QUOTE_ALL) csv_writer.writerow(cls.GAMES_CSV_HEADER_ROW) for game in games: csv_writer.writerow(game) count += 1 print("> Read {} games".format(count)) print("> Written data to '{}'".format(games_output_filename)) @classmethod def generalize_game_engines(cls, games_list_filename: str, generalized_games_output_filename: str) -> None: count = 0 engine_mapping = cls._combined_engine_versions_map() games = cls._load_games_from_csv(games_list_filename) generalized_games = [( game[0], engine_mapping[game[1]] if game[1] in engine_mapping else game[1], game[2], ) for game in games] # to ease human reading generalized_games = sorted(generalized_games, key=itemgetter(1, 0)) with open(generalized_games_output_filename, "w", newline="") as csv_file_handle: csv_writer = csv.writer(csv_file_handle, delimiter=cls.CSV_SEPARATOR, quotechar=cls.CSV_QUOTE_CHAR, quoting=csv.QUOTE_ALL) csv_writer.writerow(cls.GAMES_CSV_HEADER_ROW) for game in generalized_games: csv_writer.writerow(game) count += 1 print("> Checked {} games".format(count)) print("> Written data to '{}'".format(generalized_games_output_filename)) @staticmethod def _combined_engine_versions_map() -> Dict[str, str]: return { "CryEngine V": "CryEngine", "CryEngine (4th generation)": "CryEngine", "CryEngine 2": "CryEngine", "CryEngine 3": "CryEngine", "Id Tech 1": "Id Tech", "Id Tech 2": "Id Tech", "Id Tech 3": "Id Tech", "Id Tech 4": "Id Tech", "Id Tech 5": "Id Tech", "Id Tech 6": "Id Tech", "Id Tech 7": "Id Tech", "Quake engine": "Id Tech", "QuakeWorld": "Id Tech", "Frostbite 1.5": "Frostbite", "Frostbite 2": "Frostbite", "Frostbite 3": "Frostbite", "SAGE 2.0": "SAGE", "Unreal Engine 1": "Unreal Engine", "Unreal Engine 2": "Unreal Engine", "Unreal Engine 2.5": "Unreal Engine", "Unreal Engine 3": "Unreal Engine", "Unreal Engine 4": "Unreal Engine", "Unreal Engine 5": "Unreal Engine", "Gamebryo (TES Engine)": "Gamebryo", "GEM 2": "GEM", "GEM 3": "GEM", "AGL 2": "AGL", "AGL 3": "AGL", "AGL 4": "AGL", "The Sims 2 Engine": "The Sims Engine", "The Sims 3 Engine": "The Sims Engine", "Glacier 2": "Glacier", "Avalanche Engine 3.0": "Avalanche Engine", "Avalanche Engine 2.0": "Avalanche Engine", "Ptero Engine II": "Ptero Engine", "Ptero Engine III": "Ptero Engine", "Refractor 2": "Refractor", "Construct Classic": "Construct", "Construct 2": "Construct", "Construct 3": "Construct", "Photex2": "Photex", "Dunia 2": "Dunia", "Source 2": "Source", "Vicious Engine 2": "Vicious Engine", "KiriKiri Z": "KiriKiri", } @classmethod def _load_games_from_csv(cls, games_list_filename: str) -> List[Tuple[str, str, str]]: games = [] # type: List[Tuple[str, str, str]] with open(games_list_filename, newline="") as csv_file_handle: csv_reader = csv.reader(csv_file_handle, delimiter=cls.CSV_SEPARATOR, quotechar=cls.CSV_QUOTE_CHAR) for index, row in enumerate(csv_reader): if (index == 0): continue games.append(cast(Tuple[str, str, str], tuple(row))) return games @classmethod def _load_engines_from_csv(cls, engines_list_filename: str) -> List[str]: engines = [] # type: List[str] with open(engines_list_filename, newline="") as csv_file_handle: csv_reader = csv.reader(csv_file_handle, delimiter=cls.CSV_SEPARATOR, quotechar=cls.CSV_QUOTE_CHAR) for index, row in enumerate(csv_reader): if (index == 0): continue engines.append(row[1]) return engines @classmethod def _fetch_games_per_engine_page(cls, engine_title: str, offset: int) -> List[Tuple[str, str, str]]: # could be csv also, but we want to filter data export_format = "json" # [[Category:Games]] [[Uses engine::Engine:id Tech 2]] games_per_engine_url = "https://www.pcgamingwiki.com/w/index.php?title=Special:Ask&q=[[Category%3AGames]]+[[Uses+engine%3A%3AEngine%3A{engine}]]&po=%3FRelease+date%23ISO%7C%2Border%3Dasc%7C%2Blimit%3D1%0D%0A&p=format%3D{format}&limit={limit}&offset={offset}".format( # NOQA: E501 engine=quote_plus(engine_title), format=export_format, limit=cls.PAGE_SIZE, offset=max(offset, 0) ) headers = { "User-Agent": cls.USER_AGENT } response = requests.get(games_per_engine_url, headers=headers) if response.text: games_json = json.loads(response.text)["results"] else: games_json = {} games = [] # type: List[Tuple[str, str, str]] for key in games_json.keys(): release_date = games_json[key]["printouts"]["Release date"] games.append( (games_json[key]["fulltext"], engine_title, datetime.fromtimestamp(int(release_date[0]["timestamp"])).strftime("%Y") if release_date else "") ) return games @classmethod def _fetch_games_per_engine(cls, title: str) -> List[Tuple[str, str, str]]: games = [] # type: List[Tuple[str, str, str]] offset = 0 keep_reading = True while keep_reading: games_page = cls._fetch_games_per_engine_page(title, offset) games += games_page offset += cls.PAGE_SIZE keep_reading = len(games_page) == cls.PAGE_SIZE return games if __name__ == "__main__": engines_csv = "engines_list.csv" games_csv = "games.csv" generalized_games_csv = "games_generalized.csv" data = FetchPCGWData() data.fetch_game_engines_list_to_csv(engines_csv) data.fetch_games(engines_csv, games_csv) data.generalize_game_engines(games_csv, generalized_games_csv)
[ 1, 1053, 11799, 13, 3166, 12865, 1053, 12865, 13, 5215, 4390, 13, 3166, 5455, 1053, 2944, 657, 357, 13, 3166, 19229, 1053, 4320, 29892, 360, 919, 29892, 2391, 29892, 12603, 552, 13, 3166, 3142, 1982, 29889, 5510, 1053, 14978, 29918, 11242, 13, 13, 5215, 7274, 13, 13, 13, 1990, 383, 3486, 9026, 29954, 29956, 1469, 29901, 13, 13, 1678, 3148, 1001, 29918, 10051, 3919, 353, 376, 9026, 29954, 29956, 29899, 14199, 29899, 8100, 1475, 29914, 29900, 29889, 29906, 313, 991, 597, 3292, 29889, 510, 29914, 29895, 442, 2873, 29914, 6739, 29887, 29893, 29899, 11802, 29899, 996, 1475, 5513, 13, 1678, 16874, 29918, 1660, 16320, 1299, 1955, 353, 28796, 13, 1678, 16874, 29918, 13356, 2891, 29923, 29918, 11282, 353, 376, 5931, 29908, 13, 13, 1678, 349, 10461, 29918, 14226, 353, 29871, 29945, 29900, 29900, 13, 13, 1678, 382, 9312, 8895, 29918, 15094, 25634, 353, 376, 12412, 6160, 13, 13, 1678, 402, 25797, 29903, 29918, 29907, 7597, 29918, 23252, 1001, 29918, 25180, 353, 6796, 3257, 613, 376, 10599, 613, 376, 14096, 29918, 1256, 3108, 13, 13, 1678, 396, 4319, 848, 13, 1678, 382, 9312, 8895, 29918, 12015, 5265, 23598, 353, 6796, 29896, 29906, 29929, 29946, 29900, 29896, 3108, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 6699, 29918, 11802, 29918, 996, 1475, 29918, 1761, 29918, 517, 29918, 7638, 29898, 25932, 29892, 1051, 29918, 4905, 29918, 9507, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 2302, 353, 29871, 29900, 13, 4706, 396, 1818, 367, 4390, 13, 4706, 24000, 29918, 1761, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 6739, 29887, 11500, 4594, 29889, 510, 29914, 29893, 29914, 2754, 29889, 1961, 29973, 2467, 29922, 1972, 29987, 27959, 29922, 7320, 28109, 29987, 27354, 828, 13083, 3790, 13400, 15704, 4830, 29922, 3126, 29987, 29887, 4912, 3257, 29922, 10900, 29901, 8100, 1475, 1642, 4830, 29898, 29871, 396, 11698, 29984, 29909, 29901, 382, 29945, 29900, 29896, 13, 9651, 4046, 29922, 25932, 29889, 7228, 1692, 29918, 14226, 13, 4706, 1723, 13, 4706, 9066, 353, 426, 13, 9651, 376, 2659, 29899, 19661, 1115, 1067, 29879, 29889, 11889, 29918, 10051, 3919, 13, 4706, 500, 13, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 996, 1475, 29918, 1761, 29918, 2271, 29892, 9066, 29922, 13662, 29897, 13, 4706, 24000, 29918, 3126, 353, 4390, 29889, 18132, 29898, 5327, 29889, 726, 29897, 3366, 1972, 3108, 3366, 12292, 3108, 13, 13, 4706, 411, 1722, 29898, 1761, 29918, 4905, 29918, 9507, 29892, 376, 29893, 613, 25899, 543, 1159, 408, 11799, 29918, 1445, 29918, 8411, 29901, 13, 9651, 11799, 29918, 13236, 353, 11799, 29889, 13236, 29898, 7638, 29918, 1445, 29918, 8411, 29892, 28552, 29922, 25932, 29889, 29907, 7597, 29918, 1660, 16320, 1299, 1955, 29892, 14978, 3090, 29922, 25932, 29889, 29907, 7597, 29918, 13356, 2891, 29923, 29918, 11282, 29892, 13, 462, 462, 1678, 439, 11427, 29922, 7638, 29889, 13356, 2891, 29923, 29918, 9818, 29897, 13, 9651, 11799, 29918, 13236, 29889, 13236, 340, 29898, 3366, 333, 613, 376, 3257, 20068, 13, 13, 9651, 363, 1820, 297, 313, 996, 1475, 29918, 3126, 29889, 8149, 580, 448, 1067, 29879, 29889, 1430, 29954, 8895, 29918, 12015, 5265, 23598, 1125, 13, 18884, 11799, 29918, 13236, 29889, 13236, 340, 4197, 996, 1475, 29918, 3126, 29961, 1989, 29962, 3366, 3488, 333, 12436, 24000, 29918, 3126, 29961, 1989, 29962, 3366, 3257, 16862, 29880, 17010, 29898, 25932, 29889, 1430, 29954, 8895, 29918, 15094, 25634, 29897, 2314, 13, 18884, 2302, 4619, 29871, 29896, 13, 13, 4706, 1596, 703, 29958, 7523, 6571, 24000, 11393, 4830, 29898, 2798, 876, 13, 4706, 1596, 703, 29958, 16849, 841, 848, 304, 525, 8875, 29915, 1642, 4830, 29898, 1761, 29918, 4905, 29918, 9507, 876, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 6699, 29918, 29887, 1280, 29898, 25932, 29892, 24000, 29918, 1761, 29918, 9507, 29901, 851, 29892, 8090, 29918, 4905, 29918, 9507, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 2302, 353, 29871, 29900, 13, 4706, 8090, 353, 5159, 29871, 396, 1134, 29901, 2391, 29961, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 5262, 13, 13, 4706, 24000, 353, 1067, 29879, 3032, 1359, 29918, 996, 1475, 29918, 3166, 29918, 7638, 29898, 996, 1475, 29918, 1761, 29918, 9507, 29897, 13, 13, 4706, 396, 3940, 29901, 408, 27401, 1269, 3748, 310, 263, 3058, 6012, 29892, 24000, 1728, 8090, 6336, 22289, 714, 13, 4706, 363, 6012, 297, 24000, 29901, 13, 9651, 6012, 29918, 29887, 1280, 353, 848, 3032, 9155, 29918, 29887, 1280, 29918, 546, 29918, 10599, 29898, 10599, 29897, 13, 9651, 8090, 4619, 6012, 29918, 29887, 1280, 13, 9651, 1596, 703, 29958, 7523, 426, 2798, 29913, 8090, 411, 6012, 22372, 10599, 10162, 1642, 4830, 29898, 2798, 29922, 2435, 29898, 10599, 29918, 29887, 1280, 511, 6012, 29922, 10599, 876, 13, 13, 4706, 411, 1722, 29898, 29887, 1280, 29918, 4905, 29918, 9507, 29892, 376, 29893, 613, 25899, 543, 1159, 408, 11799, 29918, 1445, 29918, 8411, 29901, 13, 9651, 11799, 29918, 13236, 353, 11799, 29889, 13236, 29898, 7638, 29918, 1445, 29918, 8411, 29892, 28552, 29922, 25932, 29889, 29907, 7597, 29918, 1660, 16320, 1299, 1955, 29892, 14978, 3090, 29922, 25932, 29889, 29907, 7597, 29918, 13356, 2891, 29923, 29918, 11282, 29892, 13, 462, 462, 1678, 439, 11427, 29922, 7638, 29889, 13356, 2891, 29923, 29918, 9818, 29897, 13, 9651, 11799, 29918, 13236, 29889, 13236, 340, 29898, 25932, 29889, 12739, 2303, 29903, 29918, 29907, 7597, 29918, 23252, 1001, 29918, 25180, 29897, 13, 13, 9651, 363, 3748, 297, 8090, 29901, 13, 18884, 11799, 29918, 13236, 29889, 13236, 340, 29898, 11802, 29897, 13, 18884, 2302, 4619, 29871, 29896, 13, 13, 4706, 1596, 703, 29958, 7523, 6571, 8090, 1642, 4830, 29898, 2798, 876, 13, 4706, 1596, 703, 29958, 16849, 841, 848, 304, 525, 8875, 29915, 1642, 4830, 29898, 29887, 1280, 29918, 4905, 29918, 9507, 876, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2498, 675, 29918, 11802, 29918, 996, 1475, 29898, 25932, 29892, 8090, 29918, 1761, 29918, 9507, 29901, 851, 29892, 28803, 29918, 29887, 1280, 29918, 4905, 29918, 9507, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 2302, 353, 29871, 29900, 13, 4706, 6012, 29918, 20698, 353, 1067, 29879, 3032, 17743, 1312, 29918, 10599, 29918, 26100, 29918, 1958, 580, 13, 13, 4706, 8090, 353, 1067, 29879, 3032, 1359, 29918, 29887, 1280, 29918, 3166, 29918, 7638, 29898, 29887, 1280, 29918, 1761, 29918, 9507, 29897, 13, 13, 4706, 28803, 29918, 29887, 1280, 353, 17288, 13, 18884, 3748, 29961, 29900, 1402, 13, 18884, 6012, 29918, 20698, 29961, 11802, 29961, 29896, 5262, 565, 3748, 29961, 29896, 29962, 297, 6012, 29918, 20698, 1683, 3748, 29961, 29896, 1402, 13, 18884, 3748, 29961, 29906, 1402, 13, 9651, 1723, 363, 3748, 297, 8090, 29962, 13, 4706, 396, 304, 16326, 5199, 5183, 13, 4706, 28803, 29918, 29887, 1280, 353, 12705, 29898, 17492, 1891, 29918, 29887, 1280, 29892, 1820, 29922, 667, 657, 357, 29898, 29896, 29892, 29871, 29900, 876, 13, 13, 4706, 411, 1722, 29898, 17492, 1891, 29918, 29887, 1280, 29918, 4905, 29918, 9507, 29892, 376, 29893, 613, 25899, 543, 1159, 408, 11799, 29918, 1445, 29918, 8411, 29901, 13, 9651, 11799, 29918, 13236, 353, 11799, 29889, 13236, 29898, 7638, 29918, 1445, 29918, 8411, 29892, 28552, 29922, 25932, 29889, 29907, 7597, 29918, 1660, 16320, 1299, 1955, 29892, 14978, 3090, 29922, 25932, 29889, 29907, 7597, 29918, 13356, 2891, 29923, 29918, 11282, 29892, 13, 462, 462, 1678, 439, 11427, 29922, 7638, 29889, 13356, 2891, 29923, 29918, 9818, 29897, 13, 9651, 11799, 29918, 13236, 29889, 13236, 340, 29898, 25932, 29889, 12739, 2303, 29903, 29918, 29907, 7597, 29918, 23252, 1001, 29918, 25180, 29897, 13, 13, 9651, 363, 3748, 297, 28803, 29918, 29887, 1280, 29901, 13, 18884, 11799, 29918, 13236, 29889, 13236, 340, 29898, 11802, 29897, 13, 18884, 2302, 4619, 29871, 29896, 13, 13, 4706, 1596, 703, 29958, 5399, 287, 6571, 8090, 1642, 4830, 29898, 2798, 876, 13, 4706, 1596, 703, 29958, 16849, 841, 848, 304, 525, 8875, 29915, 1642, 4830, 29898, 17492, 1891, 29918, 29887, 1280, 29918, 4905, 29918, 9507, 876, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 17743, 1312, 29918, 10599, 29918, 26100, 29918, 1958, 580, 1599, 360, 919, 29961, 710, 29892, 851, 5387, 13, 4706, 736, 426, 13, 9651, 376, 29907, 719, 12412, 478, 1115, 376, 29907, 719, 12412, 613, 13, 9651, 376, 29907, 719, 12412, 313, 29946, 386, 12623, 29897, 1115, 376, 29907, 719, 12412, 613, 13, 9651, 376, 29907, 719, 12412, 29871, 29906, 1115, 376, 29907, 719, 12412, 613, 13, 9651, 376, 29907, 719, 12412, 29871, 29941, 1115, 376, 29907, 719, 12412, 613, 13, 9651, 376, 1204, 1920, 305, 29871, 29896, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 1204, 1920, 305, 29871, 29906, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 1204, 1920, 305, 29871, 29941, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 1204, 1920, 305, 29871, 29946, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 1204, 1920, 305, 29871, 29945, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 1204, 1920, 305, 29871, 29953, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 1204, 1920, 305, 29871, 29955, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 2182, 1296, 6012, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 2182, 1296, 14058, 1115, 376, 1204, 1920, 305, 613, 13, 9651, 376, 29943, 17627, 29890, 568, 29871, 29896, 29889, 29945, 1115, 376, 29943, 17627, 29890, 568, 613, 13, 9651, 376, 29943, 17627, 29890, 568, 29871, 29906, 1115, 376, 29943, 17627, 29890, 568, 613, 13, 9651, 376, 29943, 17627, 29890, 568, 29871, 29941, 1115, 376, 29943, 17627, 29890, 568, 613, 13, 9651, 376, 8132, 1692, 29871, 29906, 29889, 29900, 1115, 376, 8132, 1692, 613, 13, 9651, 376, 2525, 6370, 10863, 29871, 29896, 1115, 376, 2525, 6370, 10863, 613, 13, 9651, 376, 2525, 6370, 10863, 29871, 29906, 1115, 376, 2525, 6370, 10863, 613, 13, 9651, 376, 2525, 6370, 10863, 29871, 29906, 29889, 29945, 1115, 376, 2525, 6370, 10863, 613, 13, 9651, 376, 2525, 6370, 10863, 29871, 29941, 1115, 376, 2525, 6370, 10863, 613, 13, 9651, 376, 2525, 6370, 10863, 29871, 29946, 1115, 376, 2525, 6370, 10863, 613, 13, 9651, 376, 2525, 6370, 10863, 29871, 29945, 1115, 376, 2525, 6370, 10863, 613, 13, 9651, 376, 14199, 29890, 719, 29877, 313, 29911, 2890, 10863, 29897, 1115, 376, 14199, 29890, 719, 29877, 613, 13, 9651, 376, 1692, 29924, 29871, 29906, 1115, 376, 1692, 29924, 613, 13, 9651, 376, 1692, 29924, 29871, 29941, 1115, 376, 1692, 29924, 613, 13, 9651, 376, 29909, 7239, 29871, 29906, 1115, 376, 29909, 7239, 613, 13, 9651, 376, 29909, 7239, 29871, 29941, 1115, 376, 29909, 7239, 613, 13, 9651, 376, 29909, 7239, 29871, 29946, 1115, 376, 29909, 7239, 613, 13, 9651, 376, 1576, 3439, 29879, 29871, 29906, 10863, 1115, 376, 1576, 3439, 29879, 10863, 613, 13, 9651, 376, 1576, 3439, 29879, 29871, 29941, 10863, 1115, 376, 1576, 3439, 29879, 10863, 613, 13, 9651, 376, 29954, 433, 13241, 29871, 29906, 1115, 376, 29954, 433, 13241, 613, 13, 9651, 376, 29909, 791, 20372, 10863, 29871, 29941, 29889, 29900, 1115, 376, 29909, 791, 20372, 10863, 613, 13, 9651, 376, 29909, 791, 20372, 10863, 29871, 29906, 29889, 29900, 1115, 376, 29909, 791, 20372, 10863, 613, 13, 9651, 376, 29925, 24175, 10863, 1944, 1115, 376, 29925, 24175, 10863, 613, 13, 9651, 376, 29925, 24175, 10863, 4786, 1115, 376, 29925, 24175, 10863, 613, 13, 9651, 376, 5620, 28891, 29871, 29906, 1115, 376, 5620, 28891, 613, 13, 9651, 376, 1168, 4984, 24300, 1115, 376, 1168, 4984, 613, 13, 9651, 376, 1168, 4984, 29871, 29906, 1115, 376, 1168, 4984, 613, 13, 9651, 376, 1168, 4984, 29871, 29941, 1115, 376, 1168, 4984, 613, 13, 9651, 376, 4819, 327, 735, 29906, 1115, 376, 4819, 327, 735, 613, 13, 9651, 376, 29928, 348, 423, 29871, 29906, 1115, 376, 29928, 348, 423, 613, 13, 9651, 376, 4435, 29871, 29906, 1115, 376, 4435, 613, 13, 9651, 376, 29963, 14803, 10863, 29871, 29906, 1115, 376, 29963, 14803, 10863, 613, 13, 9651, 376, 29968, 12737, 29968, 12737, 796, 1115, 376, 29968, 12737, 29968, 12737, 613, 13, 4706, 500, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 903, 1359, 29918, 29887, 1280, 29918, 3166, 29918, 7638, 29898, 25932, 29892, 8090, 29918, 1761, 29918, 9507, 29901, 851, 29897, 1599, 2391, 29961, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 5262, 29901, 13, 4706, 8090, 353, 5159, 29871, 396, 1134, 29901, 2391, 29961, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 5262, 13, 13, 4706, 411, 1722, 29898, 29887, 1280, 29918, 1761, 29918, 9507, 29892, 25899, 543, 1159, 408, 11799, 29918, 1445, 29918, 8411, 29901, 13, 9651, 11799, 29918, 16950, 353, 11799, 29889, 16950, 29898, 7638, 29918, 1445, 29918, 8411, 29892, 28552, 29922, 25932, 29889, 29907, 7597, 29918, 1660, 16320, 1299, 1955, 29892, 14978, 3090, 29922, 25932, 29889, 29907, 7597, 29918, 13356, 2891, 29923, 29918, 11282, 29897, 13, 9651, 363, 2380, 29892, 1948, 297, 26985, 29898, 7638, 29918, 16950, 1125, 13, 18884, 565, 313, 2248, 1275, 29871, 29900, 1125, 13, 462, 1678, 6773, 13, 18884, 8090, 29889, 4397, 29898, 4384, 29898, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 1402, 18761, 29898, 798, 4961, 13, 13, 4706, 736, 8090, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 903, 1359, 29918, 996, 1475, 29918, 3166, 29918, 7638, 29898, 25932, 29892, 24000, 29918, 1761, 29918, 9507, 29901, 851, 29897, 1599, 2391, 29961, 710, 5387, 13, 4706, 24000, 353, 5159, 29871, 396, 1134, 29901, 2391, 29961, 710, 29962, 13, 13, 4706, 411, 1722, 29898, 996, 1475, 29918, 1761, 29918, 9507, 29892, 25899, 543, 1159, 408, 11799, 29918, 1445, 29918, 8411, 29901, 13, 9651, 11799, 29918, 16950, 353, 11799, 29889, 16950, 29898, 7638, 29918, 1445, 29918, 8411, 29892, 28552, 29922, 25932, 29889, 29907, 7597, 29918, 1660, 16320, 1299, 1955, 29892, 14978, 3090, 29922, 25932, 29889, 29907, 7597, 29918, 13356, 2891, 29923, 29918, 11282, 29897, 13, 9651, 363, 2380, 29892, 1948, 297, 26985, 29898, 7638, 29918, 16950, 1125, 13, 18884, 565, 313, 2248, 1275, 29871, 29900, 1125, 13, 462, 1678, 6773, 13, 18884, 24000, 29889, 4397, 29898, 798, 29961, 29896, 2314, 13, 13, 4706, 736, 24000, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 903, 9155, 29918, 29887, 1280, 29918, 546, 29918, 10599, 29918, 3488, 29898, 25932, 29892, 6012, 29918, 3257, 29901, 851, 29892, 9210, 29901, 938, 29897, 1599, 2391, 29961, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 5262, 29901, 13, 4706, 396, 1033, 367, 11799, 884, 29892, 541, 591, 864, 304, 4175, 848, 13, 4706, 5609, 29918, 4830, 353, 376, 3126, 29908, 13, 13, 4706, 396, 5519, 10900, 29901, 29954, 1280, 5262, 5519, 15922, 267, 6012, 1057, 12412, 29901, 333, 1920, 305, 29871, 29906, 5262, 13, 4706, 8090, 29918, 546, 29918, 10599, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 6739, 29887, 11500, 4594, 29889, 510, 29914, 29893, 29914, 2248, 29889, 1961, 29973, 3257, 29922, 24780, 29901, 29909, 808, 29987, 29939, 29922, 8999, 10900, 29995, 29941, 10051, 1280, 5262, 29974, 8999, 15922, 267, 29974, 10599, 29995, 29941, 29909, 29995, 29941, 29909, 12412, 29995, 29941, 29909, 29912, 10599, 29913, 5262, 29987, 1129, 16328, 29941, 29943, 19729, 29974, 1256, 29995, 29906, 29941, 29096, 29995, 29955, 29907, 29995, 29906, 17025, 29995, 29941, 29928, 6151, 29995, 29955, 29907, 29995, 29906, 29933, 13400, 29995, 29941, 29928, 29896, 29995, 29900, 29928, 29995, 29900, 29909, 29987, 29886, 29922, 4830, 29995, 29941, 29928, 29912, 4830, 15704, 13400, 3790, 13400, 15704, 10289, 3790, 10289, 29913, 1642, 4830, 29898, 29871, 396, 11698, 29984, 29909, 29901, 382, 29945, 29900, 29896, 13, 9651, 6012, 29922, 1396, 29918, 11242, 29898, 10599, 29918, 3257, 511, 3402, 29922, 15843, 29918, 4830, 29892, 4046, 29922, 25932, 29889, 7228, 1692, 29918, 14226, 29892, 9210, 29922, 3317, 29898, 10289, 29892, 29871, 29900, 29897, 13, 4706, 1723, 13, 4706, 9066, 353, 426, 13, 9651, 376, 2659, 29899, 19661, 1115, 1067, 29879, 29889, 11889, 29918, 10051, 3919, 13, 4706, 500, 13, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 29887, 1280, 29918, 546, 29918, 10599, 29918, 2271, 29892, 9066, 29922, 13662, 29897, 13, 4706, 565, 2933, 29889, 726, 29901, 13, 9651, 8090, 29918, 3126, 353, 4390, 29889, 18132, 29898, 5327, 29889, 726, 29897, 3366, 9902, 3108, 13, 4706, 1683, 29901, 13, 9651, 8090, 29918, 3126, 353, 6571, 13, 13, 4706, 8090, 353, 5159, 29871, 396, 1134, 29901, 2391, 29961, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 5262, 13, 13, 4706, 363, 1820, 297, 8090, 29918, 3126, 29889, 8149, 7295, 13, 9651, 6507, 29918, 1256, 353, 8090, 29918, 3126, 29961, 1989, 29962, 3366, 2158, 17718, 3108, 3366, 19729, 2635, 3108, 13, 13, 9651, 8090, 29889, 4397, 29898, 13, 18884, 313, 29887, 1280, 29918, 3126, 29961, 1989, 29962, 3366, 8159, 726, 12436, 13, 462, 6012, 29918, 3257, 29892, 13, 462, 12865, 29889, 3166, 16394, 29898, 524, 29898, 14096, 29918, 1256, 29961, 29900, 29962, 3366, 16394, 20068, 467, 710, 615, 603, 11702, 29979, 1159, 565, 6507, 29918, 1256, 1683, 20569, 13, 9651, 1723, 13, 13, 4706, 736, 8090, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 903, 9155, 29918, 29887, 1280, 29918, 546, 29918, 10599, 29898, 25932, 29892, 3611, 29901, 851, 29897, 1599, 2391, 29961, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 5262, 29901, 13, 4706, 8090, 353, 5159, 29871, 396, 1134, 29901, 2391, 29961, 23215, 552, 29961, 710, 29892, 851, 29892, 851, 5262, 13, 13, 4706, 9210, 353, 29871, 29900, 13, 4706, 3013, 29918, 19715, 353, 5852, 13, 4706, 1550, 3013, 29918, 19715, 29901, 13, 9651, 8090, 29918, 3488, 353, 1067, 29879, 3032, 9155, 29918, 29887, 1280, 29918, 546, 29918, 10599, 29918, 3488, 29898, 3257, 29892, 9210, 29897, 13, 9651, 8090, 4619, 8090, 29918, 3488, 13, 9651, 9210, 4619, 1067, 29879, 29889, 7228, 1692, 29918, 14226, 13, 9651, 3013, 29918, 19715, 353, 7431, 29898, 29887, 1280, 29918, 3488, 29897, 1275, 1067, 29879, 29889, 7228, 1692, 29918, 14226, 13, 13, 4706, 736, 8090, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 24000, 29918, 7638, 353, 376, 996, 1475, 29918, 1761, 29889, 7638, 29908, 13, 1678, 8090, 29918, 7638, 353, 376, 29887, 1280, 29889, 7638, 29908, 13, 1678, 28803, 29918, 29887, 1280, 29918, 7638, 353, 376, 29887, 1280, 29918, 17492, 1891, 29889, 7638, 29908, 13, 13, 1678, 848, 353, 383, 3486, 9026, 29954, 29956, 1469, 580, 13, 13, 1678, 848, 29889, 9155, 29918, 11802, 29918, 996, 1475, 29918, 1761, 29918, 517, 29918, 7638, 29898, 996, 1475, 29918, 7638, 29897, 13, 13, 1678, 848, 29889, 9155, 29918, 29887, 1280, 29898, 996, 1475, 29918, 7638, 29892, 8090, 29918, 7638, 29897, 13, 13, 1678, 848, 29889, 17492, 675, 29918, 11802, 29918, 996, 1475, 29898, 29887, 1280, 29918, 7638, 29892, 28803, 29918, 29887, 1280, 29918, 7638, 29897, 13, 2 ]
core/migrations/0008_auto_20200212_1114.py
StateArchivesOfNorthCarolina/ratom_server
1
74311
<gh_stars>1-10 # Generated by Django 2.2.10 on 2020-02-12 16:14 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0007_auto_20200206_0844'), ] operations = [ migrations.RenameField( model_name='historicalmessageaudit', old_name='restrictions', new_name='restriction', ), migrations.RenameField( model_name='messageaudit', old_name='restrictions', new_name='restriction', ), ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29896, 29900, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29900, 29906, 29899, 29896, 29906, 29871, 29896, 29953, 29901, 29896, 29946, 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, 3221, 742, 525, 29900, 29900, 29900, 29955, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29900, 29906, 29900, 29953, 29918, 29900, 29947, 29946, 29946, 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, 16211, 936, 4906, 15052, 277, 742, 13, 9651, 2030, 29918, 978, 2433, 5060, 4146, 1080, 742, 13, 9651, 716, 29918, 978, 2433, 5060, 19902, 742, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 29934, 3871, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 4906, 15052, 277, 742, 13, 9651, 2030, 29918, 978, 2433, 5060, 4146, 1080, 742, 13, 9651, 716, 29918, 978, 2433, 5060, 19902, 742, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
notebooks/tests/test_requirements.py
jagin/opencv-notebooks
6
98659
import cv2 import matplotlib import jupyter def test_opencv_version(): assert cv2.__version__ == '3.4.5' def test_matplotlib_version(): assert matplotlib.__version__ == '3.0.2' def test_jupyter_version(): assert jupyter.__version__ == '1.0.0'
[ 1, 1053, 13850, 29906, 13, 5215, 22889, 13, 5215, 432, 786, 25547, 13, 13, 1753, 1243, 29918, 3150, 11023, 29918, 3259, 7295, 13, 1678, 4974, 13850, 29906, 17255, 3259, 1649, 1275, 525, 29941, 29889, 29946, 29889, 29945, 29915, 13, 13, 1753, 1243, 29918, 2922, 17357, 29918, 3259, 7295, 13, 1678, 4974, 22889, 17255, 3259, 1649, 1275, 525, 29941, 29889, 29900, 29889, 29906, 29915, 13, 13, 1753, 1243, 29918, 29926, 786, 25547, 29918, 3259, 7295, 13, 1678, 4974, 432, 786, 25547, 17255, 3259, 1649, 1275, 525, 29896, 29889, 29900, 29889, 29900, 29915, 2 ]
tests/classes/simple_wordbook.py
Jesse-Yung/jsonclasses
50
79153
<filename>tests/classes/simple_wordbook.py from __future__ import annotations from typing import Optional from jsonclasses import jsonclass, types @jsonclass class SimpleWordbook: name: Optional[str] words: list[str] = types.nonnull.listof(str)
[ 1, 529, 9507, 29958, 21150, 29914, 13203, 29914, 12857, 29918, 1742, 2909, 29889, 2272, 13, 3166, 4770, 29888, 9130, 1649, 1053, 25495, 13, 3166, 19229, 1053, 28379, 13, 3166, 4390, 13203, 1053, 4390, 1990, 29892, 4072, 13, 13, 13, 29992, 3126, 1990, 13, 1990, 12545, 14463, 2909, 29901, 13, 1678, 1024, 29901, 28379, 29961, 710, 29962, 13, 1678, 3838, 29901, 1051, 29961, 710, 29962, 353, 4072, 29889, 29876, 3409, 913, 29889, 1761, 974, 29898, 710, 29897, 13, 2 ]
thinc/shims/__init__.py
justindujardin/thinc
0
192770
<filename>thinc/shims/__init__.py<gh_stars>0 from .shim import Shim from .pytorch import PyTorchShim from .tensorflow import keras_model_fns, TensorFlowShim, maybe_handshake_model from .mxnet import MXNetShim
[ 1, 529, 9507, 29958, 386, 3742, 29914, 845, 9893, 29914, 1649, 2344, 26914, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 869, 845, 326, 1053, 1383, 326, 13, 3166, 869, 2272, 7345, 305, 1053, 10772, 29911, 25350, 2713, 326, 13, 3166, 869, 29056, 1053, 13023, 294, 29918, 4299, 29918, 29888, 1983, 29892, 323, 6073, 17907, 2713, 326, 29892, 5505, 29918, 3179, 845, 1296, 29918, 4299, 13, 3166, 869, 16838, 1212, 1053, 341, 29990, 6779, 2713, 326, 13, 2 ]
opendatatools/hedgefund/simu_agent.py
jjcc/OpenData
1,179
44821
from opendatatools.common import RestAgent, md5 from progressbar import ProgressBar import json import pandas as pd import io import hashlib import time index_map = { 'Barclay_Hedge_Fund_Index' : 'ghsndx', 'Convertible_Arbitrage_Index' : 'ghsca', 'Distressed_Securities_Index' : 'ghsds', 'Emerging_Markets_Index' : 'ghsem', 'Equity_Long_Bias_Index' : 'ghselb', 'Equity_Long_Short_Index' : 'ghsels', 'Equity_Market_Neutral_Index' : 'ghsemn', 'European_Equities_Index' : 'ghsee', 'Event_Driven_Index' : 'ghsed', 'Fixed_Income_Arbitrage_Index' : 'ghsfia', 'Fund_of_Funds_Index' : 'ghsfof', 'Global_Macro_Index' : 'ghsmc', 'Healthcare_&_Biotechnology_Index': 'ghsbio', 'Merger_Arbitrage_Index' : 'ghsma', 'Multi_Strategy_Index' : 'ghsms', 'Pacific_Rim_Equities_Index' : 'ghspre', 'Technology_Index' : 'ghstec', } class SimuAgent(RestAgent): def __init__(self): RestAgent.__init__(self) self.user_info = None self.df_fundlist = None self.cookies = None def login(self, username, password): url = 'https://passport.simuwang.com/index.php?m=Passport&c=auth&a=login&type=login&name=%s&pass=%s&reme=1&rn=1' % (username, password) self.add_headers({'Referer': 'https://dc.simuwang.com/'}) response = self.do_request(url) if response is None: return None, '登录失败' jsonobj = json.loads(response) suc = jsonobj['suc'] msg = jsonobj['msg'] if suc != 1: return None, msg self.cookies = self.get_cookies() self.user_info = jsonobj['data'] return self.user_info, msg def prepare_cookies(self, url): response = self.do_request(url, None) if response is not None: cookies = self.get_cookies() return cookies else: return None def _get_rz_token(self, time): mk = time * 158995555893 mtoken = md5(md5(str(mk))) + '.' + str(time) return mtoken def _get_fund_list_page(self, page_no): url = 'https://dc.simuwang.com/ranking/get?page=%s&condition=fund_type:1,6,4,3,8,2;ret:9;rating_year:1;istiered:0;company_type:1;sort_name:profit_col2;sort_asc:desc;keyword:' % page_no response = self.do_request(url) if response is None: return None, '获取数据失败', None jsonobj = json.loads(response) code = jsonobj['code'] msg = jsonobj['msg'] if code != 1000: return None, msg, None df = pd.DataFrame(jsonobj['data']) pageinfo = jsonobj['pager'] return df, '', pageinfo def load_data(self): page_no = 1 df_list = [] df, msg, pageinfo = self._get_fund_list_page(page_no) if df is None: return None, msg df_list.append(df) page_count = pageinfo['pagecount'] process_bar = ProgressBar().start(max_value=page_count) page_no = page_no + 1 while page_no <= page_count: df, msg, pageinfo = self._get_fund_list_page(page_no) if df is None: return None, msg df_list.append(df) process_bar.update(page_no) page_no = page_no + 1 self.df_fundlist = pd.concat(df_list) return self.df_fundlist, '' def get_fund_list(self): if self.df_fundlist is None: return None, '请先加载数据 load_data' return self.df_fundlist, '' def _get_sign(self, url, params): str = url for k,v in params.items(): str = str + k + params[k] sha1 = hashlib.sha1() sha1.update(str.encode('utf8')) sign = sha1.hexdigest() return sign def _get_token(self, fund_id): sign = self._get_sign('https://dc.simuwang.com/Api/getToken', {'id' : fund_id}) url = 'https://dc.simuwang.com/Api/getToken?id=%s&sign=%s' % (fund_id, sign) self.add_headers({'Referer': 'https://dc.simuwang.com/'}) response = self.do_request(url) if response is None: return None, '获取数据失败' jsonobj = json.loads(response) code = jsonobj['code'] msg = jsonobj['message'] if code != 1000 : return code, msg self.cookies.update(self.get_cookies()) salt = jsonobj['data'] muid = self.user_info['userid'] #str = 'id%smuid%spage%s%s' % (fund_id, muid, page_no, salt) str = '%s%s' % (fund_id, salt) sha1 = hashlib.sha1() sha1.update(str.encode('utf8')) token = sha1.hexdigest() return token, '' def _get_fund_nav_page(self, fund_id, page_no): muid = self.user_info['userid'] token, msg = self._get_token(fund_id) if token is None: return None, '获取token失败: ' + msg, '' url = 'https://dc.simuwang.com/fund/getNavList.html' self.add_headers({'Referer': 'https://dc.simuwang.com/product/%s.html' % fund_id}) data = { 'id' : fund_id, 'muid' : muid, 'page' : str(page_no), 'token': token, } response = self.do_request(url, param=data, cookies=self.cookies, encoding="utf8") if response is None: return None, '获取数据失败', '' jsonobj = json.loads(response) code = jsonobj['code'] msg = jsonobj['msg'] if code != 1000 : return code, msg, '' df = pd.DataFrame(jsonobj['data']) pageinfo = jsonobj['pager'] return df, '', pageinfo def _bit_encrypt(self, str, key): cryText = '' keyLen = len(key) strLen = len(str) for i in range(strLen): k = i % keyLen cryText = cryText + chr(ord(str[i]) - k) return cryText def _bit_encrypt2(self, str, key): cryText = '' keyLen = len(key) strLen = len(str) for i in range(strLen): k = i % keyLen cryText = cryText + chr(ord(str[i]) ^ ord(key[k])) return cryText def _decrypt_data(self, str, func, key): # return self._bit_encrypt(str, 'cd0a8bee4c6b2f8a91ad5538dde2eb34') # return self._bit_encrypt(str, '937ab03370497f2b4e8d0599ad25c44c') # return self._bit_encrypt(str, '083975ce19392492bbccff21a52f1ace') return func(str, key) def _get_decrypt_info(self, fund_id): url = 'https://dc.simuwang.com/product/%s.html' % fund_id response = self.do_request(url, param=None, cookies=self.cookies, encoding="utf8") if response is None: return None, '获取数据失败', '' if "String.fromCharCode(str.charCodeAt(i) - k)" in response: decrypt_func = self._bit_encrypt else: decrypt_func = self._bit_encrypt2 if response.find("return xOrEncrypt(str, ")> 0: tag = "return xOrEncrypt(str, " else: tag = "return bitEncrypt(str, " pos = response.index(tag) + len(tag) + 1 key = response[pos:pos+32] return decrypt_func, key def get_fund_nav(self, fund_id, time_elapse = 0): if self.user_info is None: return None, '请先登录' page_no = 1 df_list = [] df, msg, pageinfo = self._get_fund_nav_page(fund_id, page_no) if df is None: return None, msg df_list.append(df) page_count = pageinfo['pagecount'] page_no = page_no + 1 while page_no <= page_count: try_times = 1 while try_times <= 3: df, msg, pageinfo = self._get_fund_nav_page(fund_id, page_no) if df is None: if try_times > 3: return None, msg else: try_times = try_times + 1 continue else: df_list.append(df) break page_no = page_no + 1 if time_elapse > 0: time.sleep(time_elapse) df_nav = pd.concat(df_list) df_nav.drop('c', axis=1, inplace=True) df_nav.rename(columns={'d': 'date', 'n': 'nav', 'cn' : 'accu_nav', 'cnw' : 'accu_nav_w'}, inplace=True) # 这个网站搞了太多的小坑 func, key = self._get_decrypt_info(fund_id) df_nav['nav'] = df_nav['nav'].apply(lambda x : self._decrypt_data(x, func, key)) df_nav['accu_nav'] = df_nav['accu_nav'].apply(lambda x : self._decrypt_data(x, func, key)) df_nav['accu_nav_w'] = df_nav['accu_nav_w'].apply(lambda x : self._decrypt_data(x, func, key)) #df_nav['nav'] = df_nav['nav'] - df_nav.index * 0.01 - 0.01 #df_nav['accu_nav'] = df_nav['accu_nav'].apply(lambda x: float(x) - 0.01) #df_nav['accu_nav_w'] = df_nav['accu_nav_w'].apply(lambda x: float(x) - 0.02) return df_nav, '' class BarclayAgent(RestAgent): def __init__(self): RestAgent.__init__(self) self.add_headers({'Referer': 'https://www.barclayhedge.com/research/indices/ghs/Equity_Long_Short_Index.html'}) self.add_headers({'Content - Type': 'application / x - www - form - urlencoded'}) def get_data(self, index): prog_cod = index_map[index] url = "https://www.barclayhedge.com/cgi-bin/barclay_stats/ghsndx.cgi" param = { 'dump': 'excel', 'prog_cod': prog_cod, } response = self.do_request(url, param=param, method='POST', type='binary') if response is not None: excel = pd.ExcelFile(io.BytesIO(response)) df = excel.parse('Sheet1').dropna(how='all').copy().reset_index().drop(0) df.columns = ['year', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'YTD'] df = df.set_index('year') return df, '' return None, "获取数据失败"
[ 1, 515, 1015, 355, 271, 1219, 3775, 29889, 9435, 1053, 11654, 19661, 29892, 22821, 29945, 13, 3166, 6728, 1646, 1053, 20018, 4297, 13, 5215, 4390, 13, 5215, 11701, 408, 10518, 13, 5215, 12013, 13, 5215, 6608, 1982, 13, 5215, 931, 13, 13, 2248, 29918, 1958, 353, 426, 13, 1678, 525, 4297, 695, 388, 29918, 29950, 12864, 29918, 29943, 870, 29918, 3220, 29915, 418, 584, 525, 29887, 9499, 299, 29916, 742, 13, 1678, 525, 18455, 1821, 29918, 1433, 2966, 6617, 29918, 3220, 29915, 259, 584, 525, 29887, 9499, 1113, 742, 13, 1678, 525, 13398, 1253, 287, 29918, 7898, 332, 1907, 29918, 3220, 29915, 259, 584, 525, 12443, 4928, 29879, 742, 13, 1678, 525, 29923, 1050, 3460, 29918, 9802, 1691, 29918, 3220, 29915, 4706, 584, 525, 29887, 9499, 331, 742, 13, 1678, 525, 6108, 537, 29918, 8208, 29918, 29933, 3173, 29918, 3220, 29915, 4706, 584, 525, 12443, 2838, 29890, 742, 13, 1678, 525, 6108, 537, 29918, 8208, 29918, 21322, 29918, 3220, 29915, 539, 584, 525, 29887, 9499, 1379, 742, 13, 1678, 525, 6108, 537, 29918, 9802, 300, 29918, 8139, 329, 1705, 29918, 3220, 29915, 259, 584, 525, 29887, 9499, 331, 29876, 742, 13, 1678, 525, 15654, 273, 29918, 6108, 1907, 29918, 3220, 29915, 539, 584, 525, 12443, 4149, 742, 13, 1678, 525, 2624, 29918, 29928, 374, 854, 29918, 3220, 29915, 9651, 584, 525, 12443, 8485, 742, 13, 1678, 525, 26262, 29918, 797, 2763, 29918, 1433, 2966, 6617, 29918, 3220, 29915, 29871, 584, 525, 12443, 4668, 423, 742, 13, 1678, 525, 29943, 870, 29918, 974, 29918, 29943, 870, 29879, 29918, 3220, 29915, 965, 584, 525, 12443, 4668, 974, 742, 13, 1678, 525, 12756, 29918, 15735, 307, 29918, 3220, 29915, 9651, 584, 525, 12443, 3844, 29883, 742, 13, 1678, 525, 3868, 4298, 18020, 29918, 29987, 29918, 20517, 866, 3049, 3002, 29918, 3220, 2396, 525, 29887, 9499, 24840, 742, 13, 1678, 525, 15836, 914, 29918, 1433, 2966, 6617, 29918, 3220, 29915, 4706, 584, 525, 29887, 9499, 655, 742, 13, 1678, 525, 15329, 29918, 26910, 29918, 3220, 29915, 3986, 584, 525, 29887, 9499, 1516, 742, 13, 1678, 525, 29925, 562, 928, 29918, 29934, 326, 29918, 6108, 1907, 29918, 3220, 29915, 1678, 584, 525, 12443, 17703, 742, 13, 1678, 525, 7141, 3049, 3002, 29918, 3220, 29915, 795, 584, 525, 12443, 303, 687, 742, 13, 29913, 13, 13, 13, 1990, 3439, 29884, 19661, 29898, 15078, 19661, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 11654, 19661, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 1792, 29918, 3888, 353, 6213, 13, 4706, 1583, 29889, 2176, 29918, 27159, 1761, 353, 6213, 13, 4706, 1583, 29889, 15108, 583, 353, 6213, 13, 13, 1678, 822, 6464, 29898, 1311, 29892, 8952, 29892, 4800, 1125, 13, 4706, 3142, 353, 525, 991, 597, 3364, 637, 29889, 3601, 7262, 574, 29889, 510, 29914, 2248, 29889, 1961, 29973, 29885, 29922, 7129, 637, 29987, 29883, 29922, 5150, 29987, 29874, 29922, 7507, 29987, 1853, 29922, 7507, 29987, 978, 16328, 29879, 29987, 3364, 16328, 29879, 29987, 10291, 29922, 29896, 29987, 27539, 29922, 29896, 29915, 1273, 313, 6786, 29892, 4800, 29897, 13, 4706, 1583, 29889, 1202, 29918, 13662, 3319, 29915, 1123, 571, 261, 2396, 525, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 22208, 1800, 13, 4706, 2933, 353, 1583, 29889, 1867, 29918, 3827, 29898, 2271, 29897, 13, 4706, 565, 2933, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31451, 31283, 31369, 31955, 29915, 13, 13, 4706, 4390, 5415, 353, 4390, 29889, 18132, 29898, 5327, 29897, 13, 4706, 8630, 353, 4390, 5415, 1839, 29879, 1682, 2033, 13, 4706, 10191, 353, 4390, 5415, 1839, 7645, 2033, 13, 13, 4706, 565, 8630, 2804, 29871, 29896, 29901, 13, 9651, 736, 6213, 29892, 10191, 13, 13, 4706, 1583, 29889, 15108, 583, 353, 1583, 29889, 657, 29918, 15108, 583, 580, 13, 13, 4706, 1583, 29889, 1792, 29918, 3888, 353, 4390, 5415, 1839, 1272, 2033, 13, 4706, 736, 1583, 29889, 1792, 29918, 3888, 29892, 10191, 13, 13, 1678, 822, 19012, 29918, 15108, 583, 29898, 1311, 29892, 3142, 1125, 13, 4706, 2933, 353, 1583, 29889, 1867, 29918, 3827, 29898, 2271, 29892, 6213, 29897, 13, 4706, 565, 2933, 338, 451, 6213, 29901, 13, 9651, 21046, 353, 1583, 29889, 657, 29918, 15108, 583, 580, 13, 9651, 736, 21046, 13, 4706, 1683, 29901, 13, 9651, 736, 6213, 13, 13, 1678, 822, 903, 657, 29918, 11987, 29918, 6979, 29898, 1311, 29892, 931, 1125, 13, 4706, 14690, 353, 931, 334, 29871, 29896, 29945, 29947, 29929, 29929, 29945, 29945, 29945, 29945, 29947, 29929, 29941, 13, 4706, 286, 6979, 353, 22821, 29945, 29898, 3487, 29945, 29898, 710, 29898, 11256, 4961, 718, 525, 6169, 718, 851, 29898, 2230, 29897, 13, 4706, 736, 286, 6979, 13, 13, 1678, 822, 903, 657, 29918, 27159, 29918, 1761, 29918, 3488, 29898, 1311, 29892, 1813, 29918, 1217, 1125, 13, 4706, 3142, 353, 525, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 29914, 661, 9292, 29914, 657, 29973, 3488, 16328, 29879, 29987, 16122, 29922, 27159, 29918, 1853, 29901, 29896, 29892, 29953, 29892, 29946, 29892, 29941, 29892, 29947, 29892, 29906, 29936, 2267, 29901, 29929, 29936, 29741, 29918, 6360, 29901, 29896, 29936, 391, 631, 287, 29901, 29900, 29936, 14518, 29918, 1853, 29901, 29896, 29936, 6605, 29918, 978, 29901, 771, 9202, 29918, 1054, 29906, 29936, 6605, 29918, 6151, 29901, 14273, 29936, 26766, 11283, 1273, 1813, 29918, 1217, 13, 4706, 2933, 353, 1583, 29889, 1867, 29918, 3827, 29898, 2271, 29897, 13, 13, 4706, 565, 2933, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31024, 30683, 30354, 30763, 31369, 31955, 742, 6213, 13, 13, 4706, 4390, 5415, 353, 4390, 29889, 18132, 29898, 5327, 29897, 13, 13, 4706, 775, 353, 4390, 5415, 1839, 401, 2033, 13, 4706, 10191, 29871, 353, 4390, 5415, 1839, 7645, 2033, 13, 13, 4706, 565, 775, 2804, 29871, 29896, 29900, 29900, 29900, 29901, 13, 9651, 736, 6213, 29892, 10191, 29892, 6213, 13, 13, 4706, 4489, 353, 10518, 29889, 17271, 29898, 3126, 5415, 1839, 1272, 11287, 13, 4706, 1813, 3888, 353, 4390, 5415, 1839, 29886, 1875, 2033, 13, 4706, 736, 4489, 29892, 15516, 1813, 3888, 13, 13, 1678, 822, 2254, 29918, 1272, 29898, 1311, 1125, 13, 4706, 1813, 29918, 1217, 353, 29871, 29896, 13, 4706, 4489, 29918, 1761, 353, 5159, 13, 4706, 4489, 29892, 10191, 29892, 1813, 3888, 353, 1583, 3032, 657, 29918, 27159, 29918, 1761, 29918, 3488, 29898, 3488, 29918, 1217, 29897, 13, 4706, 565, 4489, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 10191, 13, 13, 4706, 4489, 29918, 1761, 29889, 4397, 29898, 2176, 29897, 13, 4706, 1813, 29918, 2798, 353, 1813, 3888, 1839, 3488, 2798, 2033, 13, 4706, 1889, 29918, 1646, 353, 20018, 4297, 2141, 2962, 29898, 3317, 29918, 1767, 29922, 3488, 29918, 2798, 29897, 13, 13, 4706, 1813, 29918, 1217, 353, 1813, 29918, 1217, 718, 29871, 29896, 13, 4706, 1550, 1813, 29918, 1217, 5277, 1813, 29918, 2798, 29901, 13, 9651, 4489, 29892, 10191, 29892, 1813, 3888, 353, 1583, 3032, 657, 29918, 27159, 29918, 1761, 29918, 3488, 29898, 3488, 29918, 1217, 29897, 13, 9651, 565, 4489, 338, 6213, 29901, 13, 18884, 736, 6213, 29892, 10191, 13, 9651, 4489, 29918, 1761, 29889, 4397, 29898, 2176, 29897, 13, 9651, 1889, 29918, 1646, 29889, 5504, 29898, 3488, 29918, 1217, 29897, 13, 9651, 1813, 29918, 1217, 353, 1813, 29918, 1217, 718, 29871, 29896, 13, 13, 4706, 1583, 29889, 2176, 29918, 27159, 1761, 353, 10518, 29889, 17685, 29898, 2176, 29918, 1761, 29897, 13, 4706, 736, 1583, 29889, 2176, 29918, 27159, 1761, 29892, 6629, 13, 13, 1678, 822, 679, 29918, 27159, 29918, 1761, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 2176, 29918, 27159, 1761, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31088, 31244, 30666, 31526, 30354, 30763, 2254, 29918, 1272, 29915, 13, 13, 4706, 736, 1583, 29889, 2176, 29918, 27159, 1761, 29892, 6629, 13, 13, 1678, 822, 903, 657, 29918, 4530, 29898, 1311, 29892, 3142, 29892, 8636, 1125, 13, 4706, 851, 353, 3142, 13, 4706, 363, 413, 29892, 29894, 297, 8636, 29889, 7076, 7295, 13, 9651, 851, 353, 851, 718, 413, 718, 8636, 29961, 29895, 29962, 13, 13, 4706, 528, 29874, 29896, 353, 6608, 1982, 29889, 17051, 29896, 580, 13, 4706, 528, 29874, 29896, 29889, 5504, 29898, 710, 29889, 12508, 877, 9420, 29947, 8785, 13, 4706, 1804, 353, 528, 29874, 29896, 29889, 20970, 7501, 342, 580, 13, 13, 4706, 736, 1804, 13, 13, 1678, 822, 903, 657, 29918, 6979, 29898, 1311, 29892, 5220, 29918, 333, 1125, 13, 4706, 1804, 353, 1583, 3032, 657, 29918, 4530, 877, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 29914, 11713, 29914, 657, 6066, 742, 11117, 333, 29915, 584, 5220, 29918, 333, 1800, 13, 4706, 3142, 353, 525, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 29914, 11713, 29914, 657, 6066, 29973, 333, 16328, 29879, 29987, 4530, 16328, 29879, 29915, 1273, 313, 27159, 29918, 333, 29892, 1804, 29897, 13, 4706, 1583, 29889, 1202, 29918, 13662, 3319, 29915, 1123, 571, 261, 2396, 525, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 22208, 1800, 13, 4706, 2933, 353, 1583, 29889, 1867, 29918, 3827, 29898, 2271, 29897, 13, 4706, 565, 2933, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31024, 30683, 30354, 30763, 31369, 31955, 29915, 13, 13, 4706, 4390, 5415, 353, 4390, 29889, 18132, 29898, 5327, 29897, 13, 4706, 775, 353, 4390, 5415, 1839, 401, 2033, 13, 4706, 10191, 29871, 353, 4390, 5415, 1839, 4906, 2033, 13, 13, 4706, 565, 775, 2804, 29871, 29896, 29900, 29900, 29900, 584, 13, 9651, 736, 775, 29892, 10191, 13, 13, 4706, 1583, 29889, 15108, 583, 29889, 5504, 29898, 1311, 29889, 657, 29918, 15108, 583, 3101, 13, 13, 4706, 15795, 353, 4390, 5415, 1839, 1272, 2033, 13, 13, 4706, 3887, 333, 353, 1583, 29889, 1792, 29918, 3888, 1839, 1792, 333, 2033, 13, 4706, 396, 710, 353, 525, 333, 29995, 29879, 2589, 333, 29995, 1028, 482, 29995, 29879, 29995, 29879, 29915, 1273, 313, 27159, 29918, 333, 29892, 3887, 333, 29892, 1813, 29918, 1217, 29892, 15795, 29897, 13, 4706, 851, 353, 14210, 29879, 29995, 29879, 29915, 1273, 313, 27159, 29918, 333, 29892, 15795, 29897, 13, 4706, 528, 29874, 29896, 353, 6608, 1982, 29889, 17051, 29896, 580, 13, 4706, 528, 29874, 29896, 29889, 5504, 29898, 710, 29889, 12508, 877, 9420, 29947, 8785, 13, 4706, 5993, 353, 528, 29874, 29896, 29889, 20970, 7501, 342, 580, 13, 13, 4706, 736, 5993, 29892, 6629, 13, 13, 1678, 822, 903, 657, 29918, 27159, 29918, 6654, 29918, 3488, 29898, 1311, 29892, 5220, 29918, 333, 29892, 1813, 29918, 1217, 1125, 13, 4706, 3887, 333, 353, 1583, 29889, 1792, 29918, 3888, 1839, 1792, 333, 2033, 13, 4706, 5993, 29892, 10191, 353, 1583, 3032, 657, 29918, 6979, 29898, 27159, 29918, 333, 29897, 13, 4706, 565, 5993, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31024, 30683, 6979, 31369, 31955, 29901, 525, 718, 10191, 29892, 6629, 13, 13, 4706, 3142, 353, 525, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 29914, 27159, 29914, 657, 22107, 1293, 29889, 1420, 29915, 13, 4706, 1583, 29889, 1202, 29918, 13662, 3319, 29915, 1123, 571, 261, 2396, 525, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 29914, 4704, 22584, 29879, 29889, 1420, 29915, 1273, 5220, 29918, 333, 1800, 13, 4706, 848, 353, 426, 13, 9651, 525, 333, 29915, 259, 584, 5220, 29918, 333, 29892, 13, 9651, 525, 2589, 333, 29915, 584, 3887, 333, 29892, 13, 9651, 525, 3488, 29915, 584, 851, 29898, 3488, 29918, 1217, 511, 13, 9651, 525, 6979, 2396, 5993, 29892, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 1867, 29918, 3827, 29898, 2271, 29892, 1828, 29922, 1272, 29892, 21046, 29922, 1311, 29889, 15108, 583, 29892, 8025, 543, 9420, 29947, 1159, 13, 4706, 565, 2933, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31024, 30683, 30354, 30763, 31369, 31955, 742, 6629, 13, 13, 4706, 4390, 5415, 353, 4390, 29889, 18132, 29898, 5327, 29897, 13, 4706, 775, 353, 4390, 5415, 1839, 401, 2033, 13, 4706, 10191, 29871, 353, 4390, 5415, 1839, 7645, 2033, 13, 13, 4706, 565, 775, 2804, 29871, 29896, 29900, 29900, 29900, 584, 13, 9651, 736, 775, 29892, 10191, 29892, 6629, 13, 13, 4706, 4489, 353, 10518, 29889, 17271, 29898, 3126, 5415, 1839, 1272, 11287, 13, 4706, 1813, 3888, 353, 4390, 5415, 1839, 29886, 1875, 2033, 13, 4706, 736, 4489, 29892, 15516, 1813, 3888, 13, 13, 1678, 822, 903, 2966, 29918, 3977, 4641, 29898, 1311, 29892, 851, 29892, 1820, 1125, 13, 4706, 10901, 1626, 353, 6629, 13, 4706, 1820, 21515, 353, 7431, 29898, 1989, 29897, 13, 4706, 851, 21515, 353, 7431, 29898, 710, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 710, 21515, 1125, 13, 9651, 413, 353, 474, 1273, 1820, 21515, 13, 9651, 10901, 1626, 353, 10901, 1626, 718, 18460, 29898, 536, 29898, 710, 29961, 29875, 2314, 448, 413, 29897, 13, 13, 4706, 736, 10901, 1626, 13, 13, 1678, 822, 903, 2966, 29918, 3977, 4641, 29906, 29898, 1311, 29892, 851, 29892, 1820, 1125, 13, 4706, 10901, 1626, 353, 6629, 13, 4706, 1820, 21515, 353, 7431, 29898, 1989, 29897, 13, 4706, 851, 21515, 353, 7431, 29898, 710, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 710, 21515, 1125, 13, 9651, 413, 353, 474, 1273, 1820, 21515, 13, 9651, 10901, 1626, 353, 10901, 1626, 718, 18460, 29898, 536, 29898, 710, 29961, 29875, 2314, 6228, 4356, 29898, 1989, 29961, 29895, 12622, 13, 13, 4706, 736, 10901, 1626, 13, 13, 1678, 822, 903, 7099, 4641, 29918, 1272, 29898, 1311, 29892, 851, 29892, 3653, 29892, 1820, 1125, 13, 4706, 396, 736, 1583, 3032, 2966, 29918, 3977, 4641, 29898, 710, 29892, 525, 2252, 29900, 29874, 29947, 915, 29872, 29946, 29883, 29953, 29890, 29906, 29888, 29947, 29874, 29929, 29896, 328, 29945, 29945, 29941, 29947, 29881, 311, 29906, 774, 29941, 29946, 1495, 13, 4706, 396, 736, 1583, 3032, 2966, 29918, 3977, 4641, 29898, 710, 29892, 525, 29929, 29941, 29955, 370, 29900, 29941, 29941, 29955, 29900, 29946, 29929, 29955, 29888, 29906, 29890, 29946, 29872, 29947, 29881, 29900, 29945, 29929, 29929, 328, 29906, 29945, 29883, 29946, 29946, 29883, 1495, 13, 4706, 396, 736, 1583, 3032, 2966, 29918, 3977, 4641, 29898, 710, 29892, 525, 29900, 29947, 29941, 29929, 29955, 29945, 346, 29896, 29929, 29941, 29929, 29906, 29946, 29929, 29906, 1327, 617, 600, 29906, 29896, 29874, 29945, 29906, 29888, 29896, 815, 1495, 13, 4706, 736, 3653, 29898, 710, 29892, 1820, 29897, 13, 13, 1678, 822, 903, 657, 29918, 7099, 4641, 29918, 3888, 29898, 1311, 29892, 5220, 29918, 333, 1125, 13, 4706, 3142, 353, 525, 991, 597, 13891, 29889, 3601, 7262, 574, 29889, 510, 29914, 4704, 22584, 29879, 29889, 1420, 29915, 1273, 5220, 29918, 333, 13, 4706, 2933, 353, 1583, 29889, 1867, 29918, 3827, 29898, 2271, 29892, 1828, 29922, 8516, 29892, 21046, 29922, 1311, 29889, 15108, 583, 29892, 8025, 543, 9420, 29947, 1159, 13, 4706, 565, 2933, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31024, 30683, 30354, 30763, 31369, 31955, 742, 6629, 13, 13, 4706, 565, 376, 1231, 29889, 3166, 5914, 3399, 29898, 710, 29889, 3090, 3399, 4178, 29898, 29875, 29897, 448, 413, 5513, 297, 2933, 29901, 13, 9651, 1602, 4641, 29918, 9891, 353, 1583, 3032, 2966, 29918, 3977, 4641, 13, 4706, 1683, 29901, 13, 9651, 1602, 4641, 29918, 9891, 353, 1583, 3032, 2966, 29918, 3977, 4641, 29906, 13, 13, 4706, 565, 2933, 29889, 2886, 703, 2457, 921, 2816, 8566, 4641, 29898, 710, 29892, 376, 15410, 29871, 29900, 29901, 13, 9651, 4055, 353, 376, 2457, 921, 2816, 8566, 4641, 29898, 710, 29892, 376, 13, 4706, 1683, 29901, 13, 9651, 4055, 353, 376, 2457, 2586, 8566, 4641, 29898, 710, 29892, 376, 13, 4706, 926, 353, 2933, 29889, 2248, 29898, 4039, 29897, 718, 7431, 29898, 4039, 29897, 718, 29871, 29896, 13, 4706, 1820, 353, 2933, 29961, 1066, 29901, 1066, 29974, 29941, 29906, 29962, 13, 4706, 736, 1602, 4641, 29918, 9891, 29892, 1820, 13, 13, 1678, 822, 679, 29918, 27159, 29918, 6654, 29898, 1311, 29892, 5220, 29918, 333, 29892, 931, 29918, 295, 481, 344, 353, 29871, 29900, 1125, 13, 13, 4706, 565, 1583, 29889, 1792, 29918, 3888, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 525, 31088, 31244, 31451, 31283, 29915, 13, 13, 4706, 1813, 29918, 1217, 353, 29871, 29896, 13, 4706, 4489, 29918, 1761, 353, 5159, 13, 4706, 4489, 29892, 10191, 29892, 1813, 3888, 353, 1583, 3032, 657, 29918, 27159, 29918, 6654, 29918, 3488, 29898, 27159, 29918, 333, 29892, 1813, 29918, 1217, 29897, 13, 4706, 565, 4489, 338, 6213, 29901, 13, 9651, 736, 6213, 29892, 10191, 13, 13, 4706, 4489, 29918, 1761, 29889, 4397, 29898, 2176, 29897, 13, 4706, 1813, 29918, 2798, 353, 1813, 3888, 1839, 3488, 2798, 2033, 13, 13, 4706, 1813, 29918, 1217, 353, 1813, 29918, 1217, 718, 29871, 29896, 13, 4706, 1550, 1813, 29918, 1217, 5277, 1813, 29918, 2798, 29901, 13, 9651, 1018, 29918, 3706, 353, 29871, 29896, 13, 9651, 1550, 1018, 29918, 3706, 5277, 29871, 29941, 29901, 13, 18884, 4489, 29892, 10191, 29892, 1813, 3888, 353, 1583, 3032, 657, 29918, 27159, 29918, 6654, 29918, 3488, 29898, 27159, 29918, 333, 29892, 1813, 29918, 1217, 29897, 13, 18884, 565, 4489, 338, 6213, 29901, 13, 462, 1678, 565, 29871, 1018, 29918, 3706, 1405, 29871, 29941, 29901, 13, 462, 4706, 736, 6213, 29892, 10191, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1018, 29918, 3706, 353, 1018, 29918, 3706, 718, 29871, 29896, 13, 462, 4706, 6773, 13, 18884, 1683, 29901, 13, 462, 1678, 4489, 29918, 1761, 29889, 4397, 29898, 2176, 29897, 13, 462, 1678, 2867, 13, 9651, 1813, 29918, 1217, 353, 1813, 29918, 1217, 718, 29871, 29896, 13, 9651, 565, 931, 29918, 295, 481, 344, 1405, 29871, 29900, 29901, 13, 18884, 931, 29889, 17059, 29898, 2230, 29918, 295, 481, 344, 29897, 13, 13, 4706, 4489, 29918, 6654, 353, 10518, 29889, 17685, 29898, 2176, 29918, 1761, 29897, 13, 4706, 4489, 29918, 6654, 29889, 8865, 877, 29883, 742, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 29897, 13, 4706, 4489, 29918, 6654, 29889, 1267, 420, 29898, 13099, 3790, 29915, 29881, 2396, 525, 1256, 742, 525, 29876, 2396, 525, 6654, 742, 525, 18038, 29915, 584, 525, 562, 4979, 29918, 6654, 742, 525, 18038, 29893, 29915, 584, 525, 562, 4979, 29918, 6654, 29918, 29893, 16675, 297, 6689, 29922, 5574, 29897, 13, 13, 4706, 396, 29871, 30810, 30502, 31222, 31433, 233, 147, 161, 30743, 30654, 30923, 30210, 30446, 232, 160, 148, 13, 4706, 3653, 29892, 1820, 353, 1583, 3032, 657, 29918, 7099, 4641, 29918, 3888, 29898, 27159, 29918, 333, 29897, 13, 4706, 4489, 29918, 6654, 1839, 6654, 2033, 308, 353, 4489, 29918, 6654, 1839, 6654, 13359, 7302, 29898, 2892, 921, 584, 1583, 3032, 7099, 4641, 29918, 1272, 29898, 29916, 29892, 3653, 29892, 1820, 876, 13, 4706, 4489, 29918, 6654, 1839, 562, 4979, 29918, 6654, 2033, 259, 353, 4489, 29918, 6654, 1839, 562, 4979, 29918, 6654, 13359, 7302, 29898, 2892, 921, 584, 1583, 3032, 7099, 4641, 29918, 1272, 29898, 29916, 29892, 3653, 29892, 1820, 876, 13, 4706, 4489, 29918, 6654, 1839, 562, 4979, 29918, 6654, 29918, 29893, 2033, 353, 4489, 29918, 6654, 1839, 562, 4979, 29918, 6654, 29918, 29893, 13359, 7302, 29898, 2892, 921, 584, 1583, 3032, 7099, 4641, 29918, 1272, 29898, 29916, 29892, 3653, 29892, 1820, 876, 13, 4706, 396, 2176, 29918, 6654, 1839, 6654, 2033, 353, 4489, 29918, 6654, 1839, 6654, 2033, 448, 4489, 29918, 6654, 29889, 2248, 334, 29871, 29900, 29889, 29900, 29896, 448, 29871, 29900, 29889, 29900, 29896, 13, 4706, 396, 2176, 29918, 6654, 1839, 562, 4979, 29918, 6654, 2033, 353, 4489, 29918, 6654, 1839, 562, 4979, 29918, 6654, 13359, 7302, 29898, 2892, 921, 29901, 5785, 29898, 29916, 29897, 448, 29871, 29900, 29889, 29900, 29896, 29897, 13, 4706, 396, 2176, 29918, 6654, 1839, 562, 4979, 29918, 6654, 29918, 29893, 2033, 353, 4489, 29918, 6654, 1839, 562, 4979, 29918, 6654, 29918, 29893, 13359, 7302, 29898, 2892, 921, 29901, 5785, 29898, 29916, 29897, 448, 29871, 29900, 29889, 29900, 29906, 29897, 13, 13, 4706, 736, 4489, 29918, 6654, 29892, 6629, 13, 13, 1990, 2261, 695, 388, 19661, 29898, 15078, 19661, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 11654, 19661, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 1202, 29918, 13662, 3319, 29915, 1123, 571, 261, 2396, 525, 991, 597, 1636, 29889, 1646, 695, 388, 29882, 12864, 29889, 510, 29914, 690, 2842, 29914, 513, 1575, 29914, 29887, 9499, 29914, 6108, 537, 29918, 8208, 29918, 21322, 29918, 3220, 29889, 1420, 29915, 1800, 13, 4706, 1583, 29889, 1202, 29918, 13662, 3319, 29915, 3916, 448, 5167, 2396, 525, 6214, 847, 921, 448, 7821, 448, 883, 448, 3142, 26716, 29915, 1800, 13, 13, 1678, 822, 679, 29918, 1272, 29898, 1311, 29892, 2380, 1125, 13, 4706, 410, 29887, 29918, 19284, 353, 2380, 29918, 1958, 29961, 2248, 29962, 13, 4706, 3142, 353, 376, 991, 597, 1636, 29889, 1646, 695, 388, 29882, 12864, 29889, 510, 29914, 20006, 29899, 2109, 29914, 1646, 695, 388, 29918, 16202, 29914, 29887, 9499, 299, 29916, 29889, 20006, 29908, 13, 4706, 1828, 353, 426, 13, 9651, 525, 15070, 2396, 525, 24633, 742, 13, 9651, 525, 29097, 29918, 19284, 2396, 410, 29887, 29918, 19284, 29892, 13, 9651, 500, 13, 4706, 2933, 353, 1583, 29889, 1867, 29918, 3827, 29898, 2271, 29892, 1828, 29922, 3207, 29892, 1158, 2433, 5438, 742, 1134, 2433, 19541, 1495, 13, 4706, 565, 2933, 338, 451, 6213, 29901, 13, 9651, 10616, 353, 10518, 29889, 22926, 2283, 29898, 601, 29889, 11207, 5971, 29898, 5327, 876, 13, 9651, 4489, 353, 10616, 29889, 5510, 877, 10654, 29896, 2824, 8865, 1056, 29898, 3525, 2433, 497, 2824, 8552, 2141, 12071, 29918, 2248, 2141, 8865, 29898, 29900, 29897, 13, 9651, 4489, 29889, 13099, 353, 6024, 6360, 742, 525, 26626, 742, 525, 29943, 774, 742, 525, 7083, 742, 525, 29909, 558, 742, 525, 12703, 742, 525, 29967, 348, 742, 525, 27501, 742, 525, 29909, 688, 742, 525, 29903, 1022, 742, 525, 25375, 742, 525, 25363, 742, 525, 6185, 742, 525, 29979, 24495, 2033, 13, 9651, 4489, 353, 4489, 29889, 842, 29918, 2248, 877, 6360, 1495, 13, 9651, 736, 4489, 29892, 6629, 13, 13, 4706, 736, 6213, 29892, 376, 31024, 30683, 30354, 30763, 31369, 31955, 29908, 2 ]
glue-codes/kitefast/preprocessor/src/main_set.py
OpenFAST/KiteFAST
6
184957
<reponame>OpenFAST/KiteFAST # # Copyright 2018 National Renewable Energy Laboratory # # 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 .iohandler import Output class MainSet(): def __init__(self, simulation_type, mip_reference_frame, components): self.simulation_type = simulation_type self.mip_reference_frame = mip_reference_frame if self.simulation_type < 3: self.fuselage = components[0] self.starboard_wing = components[1] self.port_wing = components[2] self.vstab = components[3] self.starboard_hstab = components[4] self.port_hstab = components[5] self.starboard_pylons = components[6] # this is [Pylon] self.port_pylons = components[7] # this is [Pylon] self.starboard_rotors = components[8] # this is [Rotor] self.port_rotors = components[9] # this is [Rotor] if self.simulation_type > 1: self.platform = components[-1] def export_set_file(self, output_directory): output = Output("{}/KiteMain.set".format(output_directory)) output.write_line("# This file sets the reference id's and counters") output.write_empty_line() output.write_line("# *** Reference ***") output.write_empty_line() output.write_line("set: integer mip_rf = 10;") output.write_line("{}".format(self.mip_reference_frame)) output.write_empty_line() if self.simulation_type < 3: output.write_line("# *** Fuselage ***") output.write_line("set: integer {}_root_node = {};".format(self.fuselage.component_name, self.fuselage.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(self.fuselage.component_name, self.fuselage.node_count)) output.write_line("set: integer {}_body_count = {};".format(self.fuselage.component_name, self.fuselage.body_count)) output.write_line("set: integer {}_beam_count = {};".format(self.fuselage.component_name, self.fuselage.beam_count)) output.write_empty_line() output.write_line("# *** Wing ***") output.write_line("set: integer {}_root_node = {};".format(self.starboard_wing.component_name, self.starboard_wing.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(self.starboard_wing.component_name, self.starboard_wing.node_count)) output.write_line("set: integer {}_body_count = {};".format(self.starboard_wing.component_name, self.starboard_wing.body_count)) output.write_line("set: integer {}_beam_count = {};".format(self.starboard_wing.component_name, self.starboard_wing.beam_count)) output.write_empty_line() output.write_line("set: integer {}_root_node = {};".format(self.port_wing.component_name, self.port_wing.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(self.port_wing.component_name, self.port_wing.node_count)) output.write_line("set: integer {}_body_count = {};".format(self.port_wing.component_name, self.port_wing.body_count)) output.write_line("set: integer {}_beam_count = {};".format(self.port_wing.component_name, self.port_wing.beam_count)) output.write_empty_line() output.write_line("# *** Horizontal Stabilizer ***") output.write_line("set: integer {}_root_node = {};".format(self.starboard_hstab.component_name, self.starboard_hstab.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(self.starboard_hstab.component_name, self.starboard_hstab.node_count)) output.write_line("set: integer {}_body_count = {};".format(self.starboard_hstab.component_name, self.starboard_hstab.body_count)) output.write_line("set: integer {}_beam_count = {};".format(self.starboard_hstab.component_name, self.starboard_hstab.beam_count)) output.write_empty_line() output.write_line("set: integer {}_root_node = {};".format(self.port_hstab.component_name, self.port_hstab.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(self.port_hstab.component_name, self.port_hstab.node_count)) output.write_line("set: integer {}_body_count = {};".format(self.port_hstab.component_name, self.port_hstab.body_count)) output.write_line("set: integer {}_beam_count = {};".format(self.port_hstab.component_name, self.port_hstab.beam_count)) output.write_empty_line() output.write_line("# *** Vertical Stabilizer ***") output.write_line("set: integer {}_root_node = {};".format(self.vstab.component_name, self.vstab.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(self.vstab.component_name, self.vstab.node_count)) output.write_line("set: integer {}_body_count = {};".format(self.vstab.component_name, self.vstab.body_count)) output.write_line("set: integer {}_beam_count = {};".format(self.vstab.component_name, self.vstab.beam_count)) output.write_empty_line() output.write_line("# *** Pylons ***") for pylon in self.starboard_pylons: output.write_line("set: integer {}_root_node = {};".format(pylon.component_name, pylon.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(pylon.component_name, pylon.node_count)) output.write_line("set: integer {}_body_count = {};".format(pylon.component_name, pylon.body_count)) output.write_line("set: integer {}_beam_count = {};".format(pylon.component_name, pylon.beam_count)) for pylon in self.port_pylons: output.write_line("set: integer {}_root_node = {};".format(pylon.component_name, pylon.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(pylon.component_name, pylon.node_count)) output.write_line("set: integer {}_body_count = {};".format(pylon.component_name, pylon.body_count)) output.write_line("set: integer {}_beam_count = {};".format(pylon.component_name, pylon.beam_count)) output.write_empty_line() output.write_line("# *** Rotors ***") for component in self.starboard_rotors + self.port_rotors: output.write_line("set: integer {}_reference_frame = {};".format(component.component_name, component.mbdyn_ref_index)) output.write_line("set: integer {}_root_node = {};".format(component.component_name, component.mbdyn_ref_index)) output.write_line("set: integer {}_node_count = {};".format(component.component_name, component.node_count)) if self.simulation_type > 1: output.write_line("# *** Platform ***") output.write_line("set: integer {}_root_node = {};".format(self.platform.component_name, self.platform.mbdyn_ref_index)) output.write_empty_line() output.write_line("# Initialize variables for reuse later") output.write_line("set: integer current_beam = 0;") output.write_line("set: real twist1 = 0.0;") output.write_line("set: real twist2 = 0.0;") output.write_line("set: integer beam_node1 = 0;") output.write_line("set: integer beam_node2 = 0;") output.write_line("set: integer beam_node3 = 0;") output.write_line("set: real k1_11 = 0.0;") output.write_line("set: real k1_12 = 0.0;") output.write_line("set: real k1_13 = 0.0;") output.write_line("set: real k1_14 = 0.0;") output.write_line("set: real k1_15 = 0.0;") output.write_line("set: real k1_16 = 0.0;") output.write_line("set: real k1_22 = 0.0;") output.write_line("set: real k1_23 = 0.0;") output.write_line("set: real k1_24 = 0.0;") output.write_line("set: real k1_25 = 0.0;") output.write_line("set: real k1_26 = 0.0;") output.write_line("set: real k1_33 = 0.0;") output.write_line("set: real k1_34 = 0.0;") output.write_line("set: real k1_35 = 0.0;") output.write_line("set: real k1_36 = 0.0;") output.write_line("set: real k1_44 = 0.0;") output.write_line("set: real k1_45 = 0.0;") output.write_line("set: real k1_46 = 0.0;") output.write_line("set: real k1_55 = 0.0;") output.write_line("set: real k1_56 = 0.0;") output.write_line("set: real k1_66 = 0.0;") output.write_line("set: real k2_11 = 0.0;") output.write_line("set: real k2_12 = 0.0;") output.write_line("set: real k2_13 = 0.0;") output.write_line("set: real k2_14 = 0.0;") output.write_line("set: real k2_15 = 0.0;") output.write_line("set: real k2_16 = 0.0;") output.write_line("set: real k2_22 = 0.0;") output.write_line("set: real k2_23 = 0.0;") output.write_line("set: real k2_24 = 0.0;") output.write_line("set: real k2_25 = 0.0;") output.write_line("set: real k2_26 = 0.0;") output.write_line("set: real k2_33 = 0.0;") output.write_line("set: real k2_34 = 0.0;") output.write_line("set: real k2_35 = 0.0;") output.write_line("set: real k2_36 = 0.0;") output.write_line("set: real k2_44 = 0.0;") output.write_line("set: real k2_45 = 0.0;") output.write_line("set: real k2_46 = 0.0;") output.write_line("set: real k2_55 = 0.0;") output.write_line("set: real k2_56 = 0.0;") output.write_line("set: real k2_66 = 0.0;") output.end()
[ 1, 529, 276, 1112, 420, 29958, 6585, 4519, 1254, 29914, 29968, 568, 4519, 1254, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29947, 3086, 7493, 809, 519, 24836, 16715, 7606, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 13, 3166, 869, 601, 13789, 1053, 10604, 13, 13, 13, 1990, 4241, 2697, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 17402, 29918, 1853, 29892, 13, 462, 286, 666, 29918, 5679, 29918, 2557, 29892, 13, 462, 7117, 1125, 13, 13, 4706, 1583, 29889, 3601, 2785, 29918, 1853, 353, 17402, 29918, 1853, 13, 13, 4706, 1583, 29889, 29885, 666, 29918, 5679, 29918, 2557, 353, 286, 666, 29918, 5679, 29918, 2557, 13, 13, 4706, 565, 1583, 29889, 3601, 2785, 29918, 1853, 529, 29871, 29941, 29901, 13, 9651, 1583, 29889, 29888, 375, 295, 482, 353, 7117, 29961, 29900, 29962, 13, 9651, 1583, 29889, 8508, 3377, 29918, 16958, 353, 7117, 29961, 29896, 29962, 13, 9651, 1583, 29889, 637, 29918, 16958, 353, 7117, 29961, 29906, 29962, 13, 9651, 1583, 29889, 29894, 29256, 353, 7117, 29961, 29941, 29962, 13, 9651, 1583, 29889, 8508, 3377, 29918, 29882, 29256, 353, 7117, 29961, 29946, 29962, 13, 9651, 1583, 29889, 637, 29918, 29882, 29256, 353, 7117, 29961, 29945, 29962, 13, 9651, 1583, 29889, 8508, 3377, 29918, 2272, 29880, 787, 353, 7117, 29961, 29953, 29962, 29871, 396, 445, 338, 518, 29925, 2904, 265, 29962, 13, 9651, 1583, 29889, 637, 29918, 2272, 29880, 787, 353, 7117, 29961, 29955, 29962, 539, 396, 445, 338, 518, 29925, 2904, 265, 29962, 13, 9651, 1583, 29889, 8508, 3377, 29918, 5450, 943, 353, 7117, 29961, 29947, 29962, 29871, 396, 445, 338, 518, 21281, 272, 29962, 13, 9651, 1583, 29889, 637, 29918, 5450, 943, 353, 7117, 29961, 29929, 29962, 539, 396, 445, 338, 518, 21281, 272, 29962, 13, 13, 4706, 565, 1583, 29889, 3601, 2785, 29918, 1853, 1405, 29871, 29896, 29901, 13, 9651, 1583, 29889, 12120, 353, 7117, 14352, 29896, 29962, 13, 13, 1678, 822, 5609, 29918, 842, 29918, 1445, 29898, 1311, 29892, 1962, 29918, 12322, 1125, 13, 13, 4706, 1962, 353, 10604, 703, 29912, 6822, 29968, 568, 6330, 29889, 842, 1642, 4830, 29898, 4905, 29918, 12322, 876, 13, 13, 4706, 1962, 29889, 3539, 29918, 1220, 14822, 910, 934, 6166, 278, 3407, 1178, 29915, 29879, 322, 2613, 2153, 1159, 13, 4706, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 4706, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 12105, 18610, 1159, 13, 4706, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 286, 666, 29918, 9600, 353, 29871, 29896, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 8875, 1642, 4830, 29898, 1311, 29889, 29885, 666, 29918, 5679, 29918, 2557, 876, 13, 4706, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 4706, 565, 1583, 29889, 3601, 2785, 29918, 1853, 529, 29871, 29941, 29901, 13, 9651, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 383, 375, 295, 482, 18610, 1159, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29888, 375, 295, 482, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29888, 375, 295, 482, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29888, 375, 295, 482, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29888, 375, 295, 482, 29889, 3177, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29888, 375, 295, 482, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29888, 375, 295, 482, 29889, 2587, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29888, 375, 295, 482, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29888, 375, 295, 482, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 9651, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 27792, 18610, 1159, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 16958, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 16958, 29889, 3177, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 16958, 29889, 2587, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 16958, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 16958, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 16958, 29889, 3177, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 16958, 29889, 2587, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 16958, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 16958, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 9651, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 6912, 7731, 624, 4427, 3950, 18610, 1159, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 3177, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 2587, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 8508, 3377, 29918, 29882, 29256, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 29882, 29256, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 29882, 29256, 29889, 3177, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 29882, 29256, 29889, 2587, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 637, 29918, 29882, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 637, 29918, 29882, 29256, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 9651, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 11198, 936, 624, 4427, 3950, 18610, 1159, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29894, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29894, 29256, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29894, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29894, 29256, 29889, 3177, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29894, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29894, 29256, 29889, 2587, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 1311, 29889, 29894, 29256, 29889, 9700, 29918, 978, 29892, 1583, 29889, 29894, 29256, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 9651, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 349, 2904, 787, 18610, 1159, 13, 9651, 363, 282, 2904, 265, 297, 1583, 29889, 8508, 3377, 29918, 2272, 29880, 787, 29901, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 3177, 29918, 2798, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 2587, 29918, 2798, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 363, 282, 2904, 265, 297, 1583, 29889, 637, 29918, 2272, 29880, 787, 29901, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 3177, 29918, 2798, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 2587, 29918, 2798, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 2587, 29918, 2798, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 915, 314, 29918, 2798, 353, 15739, 1642, 4830, 29898, 2272, 12957, 29889, 9700, 29918, 978, 29892, 282, 2904, 265, 29889, 915, 314, 29918, 2798, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 9651, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 9664, 943, 18610, 1159, 13, 9651, 363, 4163, 297, 1583, 29889, 8508, 3377, 29918, 5450, 943, 718, 1583, 29889, 637, 29918, 5450, 943, 29901, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 5679, 29918, 2557, 353, 15739, 1642, 4830, 29898, 9700, 29889, 9700, 29918, 978, 29892, 4163, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 9700, 29889, 9700, 29918, 978, 29892, 4163, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 18884, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 3177, 29918, 2798, 353, 15739, 1642, 4830, 29898, 9700, 29889, 9700, 29918, 978, 29892, 4163, 29889, 3177, 29918, 2798, 876, 13, 4706, 565, 1583, 29889, 3601, 2785, 29918, 1853, 1405, 29871, 29896, 29901, 13, 9651, 1962, 29889, 3539, 29918, 1220, 14822, 18610, 28096, 18610, 1159, 13, 9651, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 426, 2403, 4632, 29918, 3177, 353, 15739, 1642, 4830, 29898, 1311, 29889, 12120, 29889, 9700, 29918, 978, 29892, 1583, 29889, 12120, 29889, 29885, 6448, 948, 29918, 999, 29918, 2248, 876, 13, 9651, 1962, 29889, 3539, 29918, 6310, 29918, 1220, 580, 13, 4706, 1962, 29889, 3539, 29918, 1220, 14822, 25455, 3651, 363, 24270, 2678, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 1857, 29918, 915, 314, 353, 29871, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 3252, 391, 29896, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 3252, 391, 29906, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 22913, 29918, 3177, 29896, 353, 29871, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 22913, 29918, 3177, 29906, 353, 29871, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 6043, 22913, 29918, 3177, 29941, 353, 29871, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29896, 29896, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29896, 29906, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29896, 29941, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29896, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29896, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29896, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29906, 29906, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29906, 29941, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29906, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29906, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29906, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29941, 29941, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29941, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29941, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29941, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29946, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29946, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29946, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29945, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29945, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29896, 29918, 29953, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29896, 29896, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29896, 29906, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29896, 29941, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29896, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29896, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29896, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29906, 29906, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29906, 29941, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29906, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29906, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29906, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29941, 29941, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29941, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29941, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29941, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29946, 29946, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29946, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29946, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29945, 29945, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29945, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 3539, 29918, 1220, 703, 842, 29901, 1855, 413, 29906, 29918, 29953, 29953, 353, 29871, 29900, 29889, 29900, 29936, 1159, 13, 4706, 1962, 29889, 355, 580, 13, 2 ]
code/reset.py
e4rthdog/raspberrypi-msfs-panel
0
92087
from pyky040 import pyky040 from gpiozero import * from time import sleep from RPLCD.i2c import CharLCD lcd=CharLCD(i2c_expander='PCF8574', address=0x27, port=1, cols=16, rows=2, dotsize=8, charmap='A02', auto_linebreaks=True, backlight_enabled=True) gled1=LED(21) gled2=LED(16) gled3=LED(25) rled1=LED(20) rled2=LED(12) rled3=LED(24) gled1.off() gled2.off() gled3.off() rled1.off() rled2.off() rled3.off() lcd.backlight_enabled=False lcd.clear()
[ 1, 515, 11451, 3459, 29900, 29946, 29900, 1053, 11451, 3459, 29900, 29946, 29900, 13, 3166, 330, 16168, 9171, 1053, 334, 13, 3166, 931, 1053, 8709, 13, 3166, 390, 7390, 6530, 29889, 29875, 29906, 29883, 1053, 2896, 29931, 6530, 13, 13, 29880, 2252, 29922, 5914, 29931, 6530, 29898, 29875, 29906, 29883, 29918, 4548, 3825, 2433, 9026, 29943, 29947, 29945, 29955, 29946, 742, 3211, 29922, 29900, 29916, 29906, 29955, 29892, 2011, 29922, 29896, 29892, 13, 795, 28730, 29922, 29896, 29953, 29892, 4206, 29922, 29906, 29892, 270, 1862, 675, 29922, 29947, 29892, 13, 795, 1373, 1958, 2433, 29909, 29900, 29906, 742, 13, 795, 4469, 29918, 1220, 8690, 29879, 29922, 5574, 29892, 13, 795, 1250, 4366, 29918, 17590, 29922, 5574, 29897, 13, 29887, 839, 29896, 29922, 20566, 29898, 29906, 29896, 29897, 13, 29887, 839, 29906, 29922, 20566, 29898, 29896, 29953, 29897, 13, 29887, 839, 29941, 29922, 20566, 29898, 29906, 29945, 29897, 13, 29878, 839, 29896, 29922, 20566, 29898, 29906, 29900, 29897, 13, 29878, 839, 29906, 29922, 20566, 29898, 29896, 29906, 29897, 13, 29878, 839, 29941, 29922, 20566, 29898, 29906, 29946, 29897, 13, 13, 29887, 839, 29896, 29889, 2696, 580, 13, 29887, 839, 29906, 29889, 2696, 580, 13, 29887, 839, 29941, 29889, 2696, 580, 13, 29878, 839, 29896, 29889, 2696, 580, 13, 29878, 839, 29906, 29889, 2696, 580, 13, 29878, 839, 29941, 29889, 2696, 580, 13, 29880, 2252, 29889, 1627, 4366, 29918, 17590, 29922, 8824, 13, 29880, 2252, 29889, 8551, 580, 2 ]
SRTTimeShifter.py
Colin-Fredericks/hx-xml
1
98615
import sys import os import argparse import re from glob import glob instructions = """ To use: python3 SRTTimeShifter.py filename seconds (options) Takes the given subtitle file or files, in SRT format, and shifts the times in each by the given number of seconds. For time, use decimals, not frames (e.g. 2.5 seconds). You can use negative times to shift backwards, if there's enough padding at the start of the file. Valid options: -o Overwrite. Overwrites the old file rather than making a new one. -h Help. Print this message. Last update: March 15th 2018 """ # Converts from miliseconds to hh:mm:ss,msec format def msecToHMS(time): # Make sure it's an integer. time = int(float(time)) # Downconvert through hours. SRTs don't handle days. msec = time % 1000 time -= msec seconds = (time // 1000) % 60 time -= seconds * 1000 minutes = (time // 60 // 1000) % 60 time -= minutes * 60 * 1000 hours = (time // 1000 // 3600) % 24 # Make sure we get enough zeroes. if int(msec) == 0: msec = "000" elif int(msec) < 10: msec = "00" + str(msec) elif int(msec) < 100: msec = "0" + str(msec) if int(seconds) == 0: seconds = "00" elif int(seconds) < 10: seconds = "0" + str(seconds) if int(minutes) == 0: minutes = "00" elif int(minutes) < 10: minutes = "0" + str(minutes) if int(hours) == 0: hours = "00" elif int(hours) < 10: hours = "0" + str(hours) # Send back a string return str(hours) + ":" + str(minutes) + ":" + str(seconds) + "," + str(msec) # Converts from hh:mm:ss,msec format to miliseconds def HMSTomsec(timestring): # Get hours, minutes, and seconds as individual strings hours, minutes, seconds = timestring.split(":") # Convert the comma in seconds to a decimal seconds = seconds.replace(",", ".") # Convert times to numbers hours = int(hours) minutes = int(minutes) seconds = float(seconds) # Convert everything to miliseconds and add them all up msec = int(seconds * 1000) + minutes * 60000 + hours * 3600000 # Send back an integer return msec # Opens our input and output files. def openFiles(name, seconds, args): completed = False print(name) # Open the existing SRT file. with open(name, "r") as inputFile: # Open a new file to work with. newname = name + ".new" with open(newname, "w") as outputFile: # With the files open, shift the times. completed = shiftTimes(inputFile, outputFile, name, seconds, args) # If we fail, we shouldn't leave a random file lying around. if not completed: os.remove(newname) return completed, newname # If we got here, we couldn't open the file I guess. return False, "error.srt" # Gets a list of dicts with all the entries from our original SRT file def getSRTEntries(inFile): SRTEntries = [] lastLine = "" twoBack = "" # Loop down the file, storing lines, until you find 'numbers --> numbers' for index, line in enumerate(inFile): entryData = {} if re.search("\d\d --> \d\d", line): # The line before that is the index. try: entryData["index"] = int(lastLine) except ValueError: # A missing blank line can cause this problem. # Go one back to fix it. line = lastLine lastLine = twoBack # That line is the timecode. Store it in miliseconds. entryData["start"] = HMSTomsec(line.split(" --> ")[0]) entryData["end"] = HMSTomsec(line.split(" --> ")[1]) # Watch out for the end of the file. try: # The next line is text1, and the one after is text2 or maybe blank. entryData["text1"] = str(inFile.readline()) # If text1 is blank, move on. if entryData["text1"].strip() == "": entryData["text2"] = "" SRTEntries.append(entryData) continue entryData["text2"] = str(inFile.readline()) except StopIteration: pass # Once we've gotten our info, add it to the list. SRTEntries.append(entryData) twoBack = lastLine lastLine = line return SRTEntries # Writes a standard SRT entry into our output files. def writeEntry(outFile, entry, index): outFile.write(str(index) + "\n") outFile.write( str(msecToHMS(entry["start"])) + " --> " + str(msecToHMS(entry["end"])) + "\n" ) outFile.write(str(entry["text1"])) if "".join(entry["text2"].split()) != "": outFile.write(str(entry["text2"])) outFile.write("\n") # The core loop that calls the important stuff. def shiftTimes(inFile, outFile, name, seconds, args): # Get a list of all the entries. SRTEntries = getSRTEntries(inFile) removeEntry = False blankEntry = None # Go through the list and adjust times. for i, entry in enumerate(SRTEntries): # If we're going positive: if seconds > 0 and i == 0: # If there's already a blank 'padding' entry, extend it. if entry["text1"].strip() == "": entry["start"] = 0 entry["end"] += seconds * 1000 # If not, add a blank entry at 0. else: blankEntry = { "start": 0, "end": SRTEntries[i]["start"] + seconds * 1000, "index": 0, "text1": "", "text2": "", } # Adjust the existing first entry. entry["start"] += seconds * 1000 entry["end"] += seconds * 1000 # If we're going negative: elif seconds < 0 and i == 0: # Check to see if we can shrink the first entry enough. # If we have enough time, shrink the first entry back. # If not, stop and throw an error message. # print('start: ' + str(entry['start']/1000.0)) # print('end: ' + str(entry['end']/1000.0)) # print(entry['start'] > abs(seconds*1000)) # print(entry['end'] > abs(seconds*1000)) # If the first entry starts at or after our time, we're all good. if entry["start"] > abs(seconds * 1000): entry["start"] += seconds * 1000 entry["end"] += seconds * 1000 elif entry["end"] == abs(seconds * 1000): removeEntry = True # We might still be good if our first entry is blank. We can shrink it back. elif entry["end"] > abs(seconds * 1000) and entry["text1"].strip() == "": entry["end"] += seconds * 1000 # But if not, we can't change this file. else: print( "Cannot shift " + name + ". First subtitle is before " + str(-seconds) + " seconds." ) return False if i > 0: entry["start"] += seconds * 1000 entry["end"] += seconds * 1000 if blankEntry: SRTEntries.insert(0, blankEntry) if removeEntry: del SRTEntries[0] # Write the file. for i, entry in enumerate(SRTEntries): writeEntry(outFile, entry, i) return True # Takes in arguments and runs the shifter on each file. def SRTTimeShifter(args): # Handle arguments and flags parser = argparse.ArgumentParser(usage=instructions, add_help=False) parser.add_argument("--help", "-h", action="store_true") parser.add_argument("-o", action="store_true") parser.add_argument("file_names", nargs="*") parser.add_argument("seconds", action="store") args = parser.parse_args(args) # Replace arguments with wildcards with their expansion. # If a string does not contain a wildcard, glob will return it as is. # Mostly important if we run this on Windows systems. file_names = list() for arg in args.file_names: file_names += glob(arg) # If "seconds" is not a number, it's probably in the wrong place. try: seconds = float(args.seconds) except ValueError: # Probably fed arguments in wrong order. sys.exit(instructions) # If the filenames don't exist, say so and quit. if file_names == []: sys.exit("No file or directory found by that name.") if args.help: sys.exit(instructions) fileCount = 0 # If we're not shifting anything, just return. if seconds == 0: print("Zero second shift - no files changed.") return False # Convert every file we're passed. for name in file_names: # Make sure single files exist. if not os.path.exists(name): print("File or directory not found: " + name) return # If it's just a file... if os.path.isfile(name): # Make sure this is an srt file (just check extension) if name.lower().endswith(".srt"): # Open that file and shift the times in that file completed, newname = openFiles(name, seconds, args) if completed: # If we're not copying files, clean up the original. if args.o: os.remove(name) else: os.rename(name, name + ".old") os.rename(newname, name) fileCount += 1 # Finish by saying how many files we shifted. if fileCount > 0: plFiles = "file" if fileCount == 1 else "files" plSeconds = "second" if seconds == 1 else "seconds" print( "Shifted " + str(fileCount) + " " + plFiles + " by " + str(seconds) + " " + plSeconds + "." ) if __name__ == "__main__": # This won't be run when the file is imported SRTTimeShifter(sys.argv)
[ 1, 1053, 10876, 13, 5215, 2897, 13, 5215, 1852, 5510, 13, 5215, 337, 13, 3166, 13149, 1053, 13149, 13, 13, 2611, 582, 1953, 353, 9995, 13, 1762, 671, 29901, 13, 4691, 29941, 317, 13079, 2481, 2713, 361, 357, 29889, 2272, 10422, 6923, 313, 6768, 29897, 13, 13, 29911, 6926, 278, 2183, 1014, 3257, 934, 470, 2066, 29892, 297, 317, 13079, 3402, 29892, 13, 392, 528, 17741, 278, 3064, 297, 1269, 491, 278, 2183, 1353, 310, 6923, 29889, 13, 13, 2831, 931, 29892, 671, 1602, 326, 1338, 29892, 451, 16608, 313, 29872, 29889, 29887, 29889, 29871, 29906, 29889, 29945, 6923, 467, 13, 3492, 508, 671, 8178, 3064, 304, 9500, 28953, 29892, 565, 727, 29915, 29879, 3307, 13, 12791, 472, 278, 1369, 310, 278, 934, 29889, 13, 13, 7211, 3987, 29901, 13, 29871, 448, 29877, 6811, 3539, 29889, 6811, 8231, 267, 278, 2030, 934, 3265, 1135, 3907, 263, 716, 697, 29889, 13, 29871, 448, 29882, 22305, 29889, 13905, 445, 2643, 29889, 13, 13, 8897, 2767, 29901, 4779, 29871, 29896, 29945, 386, 29871, 29906, 29900, 29896, 29947, 13, 15945, 29908, 13, 13, 29937, 1281, 369, 1372, 515, 2316, 21462, 304, 298, 29882, 29901, 4317, 29901, 893, 29892, 29885, 3471, 3402, 13, 1753, 286, 3471, 1762, 29950, 4345, 29898, 2230, 1125, 13, 1678, 396, 8561, 1854, 372, 29915, 29879, 385, 6043, 29889, 13, 1678, 931, 353, 938, 29898, 7411, 29898, 2230, 876, 13, 13, 1678, 396, 9943, 13441, 1549, 6199, 29889, 317, 13079, 29879, 1016, 29915, 29873, 4386, 3841, 29889, 13, 1678, 286, 3471, 353, 931, 1273, 29871, 29896, 29900, 29900, 29900, 13, 1678, 931, 22361, 286, 3471, 13, 1678, 6923, 353, 313, 2230, 849, 29871, 29896, 29900, 29900, 29900, 29897, 1273, 29871, 29953, 29900, 13, 1678, 931, 22361, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 1678, 6233, 353, 313, 2230, 849, 29871, 29953, 29900, 849, 29871, 29896, 29900, 29900, 29900, 29897, 1273, 29871, 29953, 29900, 13, 1678, 931, 22361, 6233, 334, 29871, 29953, 29900, 334, 29871, 29896, 29900, 29900, 29900, 13, 1678, 6199, 353, 313, 2230, 849, 29871, 29896, 29900, 29900, 29900, 849, 29871, 29941, 29953, 29900, 29900, 29897, 1273, 29871, 29906, 29946, 13, 13, 1678, 396, 8561, 1854, 591, 679, 3307, 5225, 267, 29889, 13, 1678, 565, 938, 29898, 29885, 3471, 29897, 1275, 29871, 29900, 29901, 13, 4706, 286, 3471, 353, 376, 29900, 29900, 29900, 29908, 13, 1678, 25342, 938, 29898, 29885, 3471, 29897, 529, 29871, 29896, 29900, 29901, 13, 4706, 286, 3471, 353, 376, 29900, 29900, 29908, 718, 851, 29898, 29885, 3471, 29897, 13, 1678, 25342, 938, 29898, 29885, 3471, 29897, 529, 29871, 29896, 29900, 29900, 29901, 13, 4706, 286, 3471, 353, 376, 29900, 29908, 718, 851, 29898, 29885, 3471, 29897, 13, 1678, 565, 938, 29898, 23128, 29897, 1275, 29871, 29900, 29901, 13, 4706, 6923, 353, 376, 29900, 29900, 29908, 13, 1678, 25342, 938, 29898, 23128, 29897, 529, 29871, 29896, 29900, 29901, 13, 4706, 6923, 353, 376, 29900, 29908, 718, 851, 29898, 23128, 29897, 13, 1678, 565, 938, 29898, 1195, 2667, 29897, 1275, 29871, 29900, 29901, 13, 4706, 6233, 353, 376, 29900, 29900, 29908, 13, 1678, 25342, 938, 29898, 1195, 2667, 29897, 529, 29871, 29896, 29900, 29901, 13, 4706, 6233, 353, 376, 29900, 29908, 718, 851, 29898, 1195, 2667, 29897, 13, 1678, 565, 938, 29898, 29882, 2470, 29897, 1275, 29871, 29900, 29901, 13, 4706, 6199, 353, 376, 29900, 29900, 29908, 13, 1678, 25342, 938, 29898, 29882, 2470, 29897, 529, 29871, 29896, 29900, 29901, 13, 4706, 6199, 353, 376, 29900, 29908, 718, 851, 29898, 29882, 2470, 29897, 13, 13, 1678, 396, 15076, 1250, 263, 1347, 13, 1678, 736, 851, 29898, 29882, 2470, 29897, 718, 376, 6160, 718, 851, 29898, 1195, 2667, 29897, 718, 376, 6160, 718, 851, 29898, 23128, 29897, 718, 28796, 718, 851, 29898, 29885, 3471, 29897, 13, 13, 13, 29937, 1281, 369, 1372, 515, 298, 29882, 29901, 4317, 29901, 893, 29892, 29885, 3471, 3402, 304, 2316, 21462, 13, 1753, 379, 29924, 1254, 290, 3471, 29898, 9346, 342, 5393, 1125, 13, 1678, 396, 3617, 6199, 29892, 6233, 29892, 322, 6923, 408, 5375, 6031, 13, 1678, 6199, 29892, 6233, 29892, 6923, 353, 5335, 342, 5393, 29889, 5451, 703, 29901, 1159, 13, 13, 1678, 396, 14806, 278, 16694, 297, 6923, 304, 263, 13677, 13, 1678, 6923, 353, 6923, 29889, 6506, 28165, 613, 11393, 1159, 13, 13, 1678, 396, 14806, 3064, 304, 3694, 13, 1678, 6199, 353, 938, 29898, 29882, 2470, 29897, 13, 1678, 6233, 353, 938, 29898, 1195, 2667, 29897, 13, 1678, 6923, 353, 5785, 29898, 23128, 29897, 13, 13, 1678, 396, 14806, 4129, 304, 2316, 21462, 322, 788, 963, 599, 701, 13, 1678, 286, 3471, 353, 938, 29898, 23128, 334, 29871, 29896, 29900, 29900, 29900, 29897, 718, 6233, 334, 29871, 29953, 29900, 29900, 29900, 29900, 718, 6199, 334, 29871, 29941, 29953, 29900, 29900, 29900, 29900, 29900, 13, 13, 1678, 396, 15076, 1250, 385, 6043, 13, 1678, 736, 286, 3471, 13, 13, 13, 29937, 6461, 575, 1749, 1881, 322, 1962, 2066, 29889, 13, 1753, 1722, 10547, 29898, 978, 29892, 6923, 29892, 6389, 1125, 13, 1678, 8676, 353, 7700, 13, 1678, 1596, 29898, 978, 29897, 13, 13, 1678, 396, 4673, 278, 5923, 317, 13079, 934, 29889, 13, 1678, 411, 1722, 29898, 978, 29892, 376, 29878, 1159, 408, 1881, 2283, 29901, 13, 4706, 396, 4673, 263, 716, 934, 304, 664, 411, 29889, 13, 4706, 716, 978, 353, 1024, 718, 11393, 1482, 29908, 13, 4706, 411, 1722, 29898, 1482, 978, 29892, 376, 29893, 1159, 408, 1962, 2283, 29901, 13, 9651, 396, 2973, 278, 2066, 1722, 29892, 9500, 278, 3064, 29889, 13, 9651, 8676, 353, 9500, 29164, 29898, 2080, 2283, 29892, 1962, 2283, 29892, 1024, 29892, 6923, 29892, 6389, 29897, 13, 13, 4706, 396, 960, 591, 4418, 29892, 591, 9273, 29915, 29873, 5967, 263, 4036, 934, 19214, 2820, 29889, 13, 4706, 565, 451, 8676, 29901, 13, 9651, 2897, 29889, 5992, 29898, 1482, 978, 29897, 13, 4706, 736, 8676, 29892, 716, 978, 13, 13, 1678, 396, 960, 591, 2355, 1244, 29892, 591, 8496, 29915, 29873, 1722, 278, 934, 306, 4140, 29889, 13, 1678, 736, 7700, 29892, 376, 2704, 29889, 29879, 2273, 29908, 13, 13, 13, 29937, 402, 1691, 263, 1051, 310, 9657, 29879, 411, 599, 278, 9976, 515, 1749, 2441, 317, 13079, 934, 13, 1753, 679, 14098, 4330, 593, 2722, 29898, 262, 2283, 1125, 13, 13, 1678, 21020, 4330, 593, 2722, 353, 5159, 13, 1678, 1833, 3542, 353, 5124, 13, 1678, 1023, 5841, 353, 5124, 13, 13, 1678, 396, 21493, 1623, 278, 934, 29892, 15446, 3454, 29892, 2745, 366, 1284, 525, 20326, 6660, 3694, 29915, 13, 1678, 363, 2380, 29892, 1196, 297, 26985, 29898, 262, 2283, 1125, 13, 4706, 6251, 1469, 353, 6571, 13, 13, 4706, 565, 337, 29889, 4478, 14182, 29881, 29905, 29881, 6660, 320, 29881, 29905, 29881, 613, 1196, 1125, 13, 9651, 396, 450, 1196, 1434, 393, 338, 278, 2380, 29889, 13, 9651, 1018, 29901, 13, 18884, 6251, 1469, 3366, 2248, 3108, 353, 938, 29898, 4230, 3542, 29897, 13, 9651, 5174, 7865, 2392, 29901, 13, 18884, 396, 319, 4567, 9654, 1196, 508, 4556, 445, 1108, 29889, 13, 18884, 396, 2921, 697, 1250, 304, 2329, 372, 29889, 13, 18884, 1196, 353, 1833, 3542, 13, 18884, 1833, 3542, 353, 1023, 5841, 13, 13, 9651, 396, 2193, 1196, 338, 278, 931, 401, 29889, 14491, 372, 297, 2316, 21462, 29889, 13, 9651, 6251, 1469, 3366, 2962, 3108, 353, 379, 29924, 1254, 290, 3471, 29898, 1220, 29889, 5451, 703, 6660, 376, 9601, 29900, 2314, 13, 9651, 6251, 1469, 3366, 355, 3108, 353, 379, 29924, 1254, 290, 3471, 29898, 1220, 29889, 5451, 703, 6660, 376, 9601, 29896, 2314, 13, 9651, 396, 24274, 714, 363, 278, 1095, 310, 278, 934, 29889, 13, 9651, 1018, 29901, 13, 18884, 396, 450, 2446, 1196, 338, 1426, 29896, 29892, 322, 278, 697, 1156, 338, 1426, 29906, 470, 5505, 9654, 29889, 13, 18884, 6251, 1469, 3366, 726, 29896, 3108, 353, 851, 29898, 262, 2283, 29889, 949, 1220, 3101, 13, 18884, 396, 960, 1426, 29896, 338, 9654, 29892, 4337, 373, 29889, 13, 18884, 565, 6251, 1469, 3366, 726, 29896, 16862, 17010, 580, 1275, 376, 1115, 13, 462, 1678, 6251, 1469, 3366, 726, 29906, 3108, 353, 5124, 13, 462, 1678, 21020, 4330, 593, 2722, 29889, 4397, 29898, 8269, 1469, 29897, 13, 462, 1678, 6773, 13, 18884, 6251, 1469, 3366, 726, 29906, 3108, 353, 851, 29898, 262, 2283, 29889, 949, 1220, 3101, 13, 9651, 5174, 22303, 13463, 362, 29901, 13, 18884, 1209, 13, 13, 9651, 396, 9038, 591, 29915, 345, 2355, 841, 1749, 5235, 29892, 788, 372, 304, 278, 1051, 29889, 13, 9651, 21020, 4330, 593, 2722, 29889, 4397, 29898, 8269, 1469, 29897, 13, 13, 4706, 1023, 5841, 353, 1833, 3542, 13, 4706, 1833, 3542, 353, 1196, 13, 13, 1678, 736, 21020, 4330, 593, 2722, 13, 13, 13, 29937, 16849, 267, 263, 3918, 317, 13079, 6251, 964, 1749, 1962, 2066, 29889, 13, 1753, 2436, 9634, 29898, 449, 2283, 29892, 6251, 29892, 2380, 1125, 13, 1678, 714, 2283, 29889, 3539, 29898, 710, 29898, 2248, 29897, 718, 6634, 29876, 1159, 13, 1678, 714, 2283, 29889, 3539, 29898, 13, 4706, 851, 29898, 29885, 3471, 1762, 29950, 4345, 29898, 8269, 3366, 2962, 3108, 876, 718, 376, 6660, 376, 718, 851, 29898, 29885, 3471, 1762, 29950, 4345, 29898, 8269, 3366, 355, 3108, 876, 718, 6634, 29876, 29908, 13, 1678, 1723, 13, 1678, 714, 2283, 29889, 3539, 29898, 710, 29898, 8269, 3366, 726, 29896, 3108, 876, 13, 1678, 565, 376, 1642, 7122, 29898, 8269, 3366, 726, 29906, 16862, 5451, 3101, 2804, 376, 1115, 13, 4706, 714, 2283, 29889, 3539, 29898, 710, 29898, 8269, 3366, 726, 29906, 3108, 876, 13, 1678, 714, 2283, 29889, 3539, 14182, 29876, 1159, 13, 13, 13, 29937, 450, 7136, 2425, 393, 5717, 278, 4100, 6433, 29889, 13, 1753, 9500, 29164, 29898, 262, 2283, 29892, 714, 2283, 29892, 1024, 29892, 6923, 29892, 6389, 1125, 13, 13, 1678, 396, 3617, 263, 1051, 310, 599, 278, 9976, 29889, 13, 1678, 21020, 4330, 593, 2722, 353, 679, 14098, 4330, 593, 2722, 29898, 262, 2283, 29897, 13, 13, 1678, 3349, 9634, 353, 7700, 13, 1678, 9654, 9634, 353, 6213, 13, 13, 1678, 396, 2921, 1549, 278, 1051, 322, 10365, 3064, 29889, 13, 1678, 363, 474, 29892, 6251, 297, 26985, 29898, 14098, 4330, 593, 2722, 1125, 13, 13, 4706, 396, 960, 591, 29915, 276, 2675, 6374, 29901, 13, 4706, 565, 6923, 1405, 29871, 29900, 322, 474, 1275, 29871, 29900, 29901, 13, 13, 9651, 396, 960, 727, 29915, 29879, 2307, 263, 9654, 525, 12791, 29915, 6251, 29892, 10985, 372, 29889, 13, 9651, 565, 6251, 3366, 726, 29896, 16862, 17010, 580, 1275, 376, 1115, 13, 18884, 6251, 3366, 2962, 3108, 353, 29871, 29900, 13, 18884, 6251, 3366, 355, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 9651, 396, 960, 451, 29892, 788, 263, 9654, 6251, 472, 29871, 29900, 29889, 13, 9651, 1683, 29901, 13, 18884, 9654, 9634, 353, 426, 13, 462, 1678, 376, 2962, 1115, 29871, 29900, 29892, 13, 462, 1678, 376, 355, 1115, 21020, 4330, 593, 2722, 29961, 29875, 29962, 3366, 2962, 3108, 718, 6923, 334, 29871, 29896, 29900, 29900, 29900, 29892, 13, 462, 1678, 376, 2248, 1115, 29871, 29900, 29892, 13, 462, 1678, 376, 726, 29896, 1115, 12633, 13, 462, 1678, 376, 726, 29906, 1115, 12633, 13, 18884, 500, 13, 13, 18884, 396, 2087, 5143, 278, 5923, 937, 6251, 29889, 13, 18884, 6251, 3366, 2962, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 18884, 6251, 3366, 355, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 13, 4706, 396, 960, 591, 29915, 276, 2675, 8178, 29901, 13, 4706, 25342, 6923, 529, 29871, 29900, 322, 474, 1275, 29871, 29900, 29901, 13, 9651, 396, 5399, 304, 1074, 565, 591, 508, 14653, 682, 278, 937, 6251, 3307, 29889, 13, 9651, 396, 960, 591, 505, 3307, 931, 29892, 14653, 682, 278, 937, 6251, 1250, 29889, 13, 9651, 396, 960, 451, 29892, 5040, 322, 3183, 385, 1059, 2643, 29889, 13, 9651, 396, 1596, 877, 2962, 29901, 525, 718, 851, 29898, 8269, 1839, 2962, 2033, 29914, 29896, 29900, 29900, 29900, 29889, 29900, 876, 13, 9651, 396, 1596, 877, 355, 29901, 525, 718, 851, 29898, 8269, 1839, 355, 2033, 29914, 29896, 29900, 29900, 29900, 29889, 29900, 876, 13, 9651, 396, 1596, 29898, 8269, 1839, 2962, 2033, 1405, 6425, 29898, 23128, 29930, 29896, 29900, 29900, 29900, 876, 13, 9651, 396, 1596, 29898, 8269, 1839, 355, 2033, 1405, 6425, 29898, 23128, 29930, 29896, 29900, 29900, 29900, 876, 13, 13, 9651, 396, 960, 278, 937, 6251, 8665, 472, 470, 1156, 1749, 931, 29892, 591, 29915, 276, 599, 1781, 29889, 13, 9651, 565, 6251, 3366, 2962, 3108, 1405, 6425, 29898, 23128, 334, 29871, 29896, 29900, 29900, 29900, 1125, 13, 18884, 6251, 3366, 2962, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 18884, 6251, 3366, 355, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 9651, 25342, 6251, 3366, 355, 3108, 1275, 6425, 29898, 23128, 334, 29871, 29896, 29900, 29900, 29900, 1125, 13, 18884, 3349, 9634, 353, 5852, 13, 9651, 396, 1334, 1795, 1603, 367, 1781, 565, 1749, 937, 6251, 338, 9654, 29889, 1334, 508, 14653, 682, 372, 1250, 29889, 13, 9651, 25342, 6251, 3366, 355, 3108, 1405, 6425, 29898, 23128, 334, 29871, 29896, 29900, 29900, 29900, 29897, 322, 6251, 3366, 726, 29896, 16862, 17010, 580, 1275, 376, 1115, 13, 18884, 6251, 3366, 355, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 9651, 396, 1205, 565, 451, 29892, 591, 508, 29915, 29873, 1735, 445, 934, 29889, 13, 9651, 1683, 29901, 13, 18884, 1596, 29898, 13, 462, 1678, 376, 29089, 9500, 376, 13, 462, 1678, 718, 1024, 13, 462, 1678, 718, 11393, 3824, 1014, 3257, 338, 1434, 376, 13, 462, 1678, 718, 851, 6278, 23128, 29897, 13, 462, 1678, 718, 376, 6923, 1213, 13, 18884, 1723, 13, 18884, 736, 7700, 13, 13, 4706, 565, 474, 1405, 29871, 29900, 29901, 13, 9651, 6251, 3366, 2962, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 9651, 6251, 3366, 355, 3108, 4619, 6923, 334, 29871, 29896, 29900, 29900, 29900, 13, 13, 1678, 565, 9654, 9634, 29901, 13, 4706, 21020, 4330, 593, 2722, 29889, 7851, 29898, 29900, 29892, 9654, 9634, 29897, 13, 1678, 565, 3349, 9634, 29901, 13, 4706, 628, 21020, 4330, 593, 2722, 29961, 29900, 29962, 13, 13, 1678, 396, 14350, 278, 934, 29889, 13, 1678, 363, 474, 29892, 6251, 297, 26985, 29898, 14098, 4330, 593, 2722, 1125, 13, 4706, 2436, 9634, 29898, 449, 2283, 29892, 6251, 29892, 474, 29897, 13, 13, 1678, 736, 5852, 13, 13, 13, 29937, 323, 6926, 297, 6273, 322, 6057, 278, 528, 361, 357, 373, 1269, 934, 29889, 13, 1753, 317, 13079, 2481, 2713, 361, 357, 29898, 5085, 1125, 13, 13, 1678, 396, 29273, 6273, 322, 13449, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 21125, 29922, 2611, 582, 1953, 29892, 788, 29918, 8477, 29922, 8824, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 8477, 613, 11663, 29882, 613, 3158, 543, 8899, 29918, 3009, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 29899, 29877, 613, 3158, 543, 8899, 29918, 3009, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 1445, 29918, 7039, 613, 302, 5085, 543, 29930, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 23128, 613, 3158, 543, 8899, 1159, 13, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 29898, 5085, 29897, 13, 13, 1678, 396, 22108, 6273, 411, 8775, 28160, 411, 1009, 13184, 29889, 13, 1678, 396, 960, 263, 1347, 947, 451, 1712, 263, 8775, 7543, 29892, 13149, 674, 736, 372, 408, 338, 29889, 13, 1678, 396, 7849, 368, 4100, 565, 591, 1065, 445, 373, 3852, 6757, 29889, 13, 1678, 934, 29918, 7039, 353, 1051, 580, 13, 1678, 363, 1852, 297, 6389, 29889, 1445, 29918, 7039, 29901, 13, 4706, 934, 29918, 7039, 4619, 13149, 29898, 1191, 29897, 13, 13, 1678, 396, 960, 376, 23128, 29908, 338, 451, 263, 1353, 29892, 372, 29915, 29879, 3117, 297, 278, 2743, 2058, 29889, 13, 1678, 1018, 29901, 13, 4706, 6923, 353, 5785, 29898, 5085, 29889, 23128, 29897, 13, 1678, 5174, 7865, 2392, 29901, 13, 4706, 396, 21606, 21242, 6273, 297, 2743, 1797, 29889, 13, 4706, 10876, 29889, 13322, 29898, 2611, 582, 1953, 29897, 13, 13, 1678, 396, 960, 278, 977, 264, 1280, 1016, 29915, 29873, 1863, 29892, 1827, 577, 322, 23283, 29889, 13, 1678, 565, 934, 29918, 7039, 1275, 5159, 29901, 13, 4706, 10876, 29889, 13322, 703, 3782, 934, 470, 3884, 1476, 491, 393, 1024, 23157, 13, 13, 1678, 565, 6389, 29889, 8477, 29901, 13, 4706, 10876, 29889, 13322, 29898, 2611, 582, 1953, 29897, 13, 13, 1678, 934, 3981, 353, 29871, 29900, 13, 13, 1678, 396, 960, 591, 29915, 276, 451, 528, 24377, 3099, 29892, 925, 736, 29889, 13, 1678, 565, 6923, 1275, 29871, 29900, 29901, 13, 4706, 1596, 703, 24214, 1473, 9500, 448, 694, 2066, 3939, 23157, 13, 4706, 736, 7700, 13, 13, 1678, 396, 14806, 1432, 934, 591, 29915, 276, 4502, 29889, 13, 1678, 363, 1024, 297, 934, 29918, 7039, 29901, 13, 4706, 396, 8561, 1854, 2323, 2066, 1863, 29889, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 978, 1125, 13, 9651, 1596, 703, 2283, 470, 3884, 451, 1476, 29901, 376, 718, 1024, 29897, 13, 9651, 736, 13, 13, 4706, 396, 960, 372, 29915, 29879, 925, 263, 934, 856, 13, 4706, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 978, 1125, 13, 9651, 396, 8561, 1854, 445, 338, 385, 269, 2273, 934, 313, 5143, 1423, 6081, 29897, 13, 9651, 565, 1024, 29889, 13609, 2141, 1975, 2541, 17350, 29879, 2273, 29908, 1125, 13, 18884, 396, 4673, 393, 934, 322, 9500, 278, 3064, 297, 393, 934, 13, 18884, 8676, 29892, 716, 978, 353, 1722, 10547, 29898, 978, 29892, 6923, 29892, 6389, 29897, 13, 18884, 565, 8676, 29901, 13, 462, 1678, 396, 960, 591, 29915, 276, 451, 17596, 2066, 29892, 5941, 701, 278, 2441, 29889, 13, 462, 1678, 565, 6389, 29889, 29877, 29901, 13, 462, 4706, 2897, 29889, 5992, 29898, 978, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 2897, 29889, 1267, 420, 29898, 978, 29892, 1024, 718, 11393, 1025, 1159, 13, 462, 1678, 2897, 29889, 1267, 420, 29898, 1482, 978, 29892, 1024, 29897, 13, 462, 1678, 934, 3981, 4619, 29871, 29896, 13, 13, 1678, 396, 4231, 728, 491, 5934, 920, 1784, 2066, 591, 9500, 287, 29889, 13, 1678, 565, 934, 3981, 1405, 29871, 29900, 29901, 13, 4706, 715, 10547, 353, 376, 1445, 29908, 565, 934, 3981, 1275, 29871, 29896, 1683, 376, 5325, 29908, 13, 4706, 715, 27535, 353, 376, 7496, 29908, 565, 6923, 1275, 29871, 29896, 1683, 376, 23128, 29908, 13, 4706, 1596, 29898, 13, 9651, 376, 29657, 287, 376, 13, 9651, 718, 851, 29898, 1445, 3981, 29897, 13, 9651, 718, 376, 376, 13, 9651, 718, 715, 10547, 13, 9651, 718, 376, 491, 376, 13, 9651, 718, 851, 29898, 23128, 29897, 13, 9651, 718, 376, 376, 13, 9651, 718, 715, 27535, 13, 9651, 718, 376, 1213, 13, 4706, 1723, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 910, 2113, 29915, 29873, 367, 1065, 746, 278, 934, 338, 19673, 13, 1678, 317, 13079, 2481, 2713, 361, 357, 29898, 9675, 29889, 19218, 29897, 13, 2 ]
vignettes/brute-force-interaction.py
koaning/sushigo
3
92220
import sushigo import itertools as it import random POSSIBLE_CARDS = list(set([str(_) for _ in sushigo.deck.StandardDeck()])) class CustomPlayer(sushigo.player.Player): def __init__(self, order, name=None): super(CustomPlayer, self).__init__() self.name = 'custom-player' if name: self.name = name self.order = order if any([(_ not in order) for _ in POSSIBLE_CARDS]): raise ValueError("forgot card type in OrderedPlayer init") def act(self, reward, observation=None, action_space=None): if not action_space: raise ValueError("player received an empty set of actions") # the player can get a notion of possible cards, give them an order order = {j: i for i, j in enumerate(self.order)} # the action space consists of objects now, which we may need to string-sort ordered_actions = sorted(action_space, key = lambda _: order[str(_)]) return ordered_actions[-1] def simulate(order, n_games = 10): """ This function simulates a game, assuming a player uses certain order. """ res = [] for _ in range(n_games): p1 = sushigo.player.Player(name="p1") p2 = CustomPlayer(name="custom", order = order) players = [p1,p2] game = sushigo.game.Game(players, deck=sushigo.deck.StandardDeck()) game.simulate_game() res.append(game.did_player_win("custom")) return sum(res) def allow(perm): """ This function acts as a predicate for allowed permutations. """ # leaves us with 1108800/39916800 permutations order = {j: i for i, j in enumerate([str(_) for _ in perm])} if order['NigiriCard("egg")'] > order['NigiriCard("salmon")']: return False if order['NigiriCard("salmon")'] > order['NigiriCard("squid")']: return False if order['MakiCard("2")'] > order['MakiCard("3")']: return False if order['MakiCard("1")'] > order['MakiCard("2")']: return False return True def rand_iterable(iter, prob=0.001, max_i = 100): """ Randomly selects some items in the iterable. """ i = 0 while i<max_i: if random.random() < prob: yield next(iter) allowed_perms = (_ for _ in it.permutations(POSSIBLE_CARDS) if allow(_)) # if you want to sample, you can uncomment this line. allowed_perms = rand_iterable(_ for _ in it.permutations(POSSIBLE_CARDS) if allow(_)) print("This will run for a while because brute force is stupid.") for permutation in allowed_perms: if not allow(permutation): continue n = 20 order = {j: i for i, j in enumerate([str(_) for _ in permutation])} score = simulate(order, n) print("card order:{}\nnumber of wins:{}/{}".format(permutation, score, n))
[ 1, 1053, 269, 1878, 5973, 13, 5215, 4256, 8504, 408, 372, 13, 5215, 4036, 13, 13, 13152, 1799, 8979, 1307, 29918, 29907, 1718, 8452, 353, 1051, 29898, 842, 4197, 710, 7373, 29897, 363, 903, 297, 269, 1878, 5973, 29889, 16565, 29889, 15449, 2772, 384, 580, 12622, 13, 13, 1990, 8701, 9075, 29898, 29879, 1878, 5973, 29889, 9106, 29889, 9075, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1797, 29892, 1024, 29922, 8516, 1125, 13, 4706, 2428, 29898, 7281, 9075, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 978, 353, 525, 6341, 29899, 9106, 29915, 13, 4706, 565, 1024, 29901, 13, 9651, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 2098, 353, 1797, 13, 4706, 565, 738, 4197, 7373, 451, 297, 1797, 29897, 363, 903, 297, 21521, 1799, 8979, 1307, 29918, 29907, 1718, 8452, 29962, 1125, 13, 9651, 12020, 7865, 2392, 703, 29888, 990, 327, 5881, 1134, 297, 8170, 287, 9075, 2069, 1159, 13, 13, 1678, 822, 1044, 29898, 1311, 29892, 20751, 29892, 15500, 29922, 8516, 29892, 3158, 29918, 3493, 29922, 8516, 1125, 13, 4706, 565, 451, 3158, 29918, 3493, 29901, 13, 9651, 12020, 7865, 2392, 703, 9106, 4520, 385, 4069, 731, 310, 8820, 1159, 13, 13, 4706, 396, 278, 4847, 508, 679, 263, 17837, 310, 1950, 15889, 29892, 2367, 963, 385, 1797, 13, 4706, 1797, 353, 426, 29926, 29901, 474, 363, 474, 29892, 432, 297, 26985, 29898, 1311, 29889, 2098, 2915, 13, 4706, 396, 278, 3158, 2913, 11624, 310, 3618, 1286, 29892, 607, 591, 1122, 817, 304, 1347, 29899, 6605, 13, 4706, 10372, 29918, 7387, 353, 12705, 29898, 2467, 29918, 3493, 29892, 1820, 353, 14013, 903, 29901, 1797, 29961, 710, 7373, 29897, 2314, 13, 13, 4706, 736, 10372, 29918, 7387, 14352, 29896, 29962, 13, 13, 13, 1753, 29611, 29898, 2098, 29892, 302, 29918, 29887, 1280, 353, 29871, 29896, 29900, 1125, 13, 1678, 9995, 13, 1678, 910, 740, 1027, 352, 1078, 263, 3748, 29892, 10241, 263, 4847, 3913, 3058, 1797, 29889, 13, 1678, 9995, 13, 1678, 620, 353, 5159, 13, 1678, 363, 903, 297, 3464, 29898, 29876, 29918, 29887, 1280, 1125, 13, 4706, 282, 29896, 353, 269, 1878, 5973, 29889, 9106, 29889, 9075, 29898, 978, 543, 29886, 29896, 1159, 13, 4706, 282, 29906, 353, 8701, 9075, 29898, 978, 543, 6341, 613, 1797, 353, 1797, 29897, 13, 4706, 10769, 353, 518, 29886, 29896, 29892, 29886, 29906, 29962, 13, 4706, 3748, 353, 269, 1878, 5973, 29889, 11802, 29889, 14199, 29898, 1456, 414, 29892, 19810, 29922, 29879, 1878, 5973, 29889, 16565, 29889, 15449, 2772, 384, 3101, 13, 4706, 3748, 29889, 3601, 5987, 29918, 11802, 580, 13, 4706, 620, 29889, 4397, 29898, 11802, 29889, 18361, 29918, 9106, 29918, 5080, 703, 6341, 5783, 13, 1678, 736, 2533, 29898, 690, 29897, 13, 13, 1753, 2758, 29898, 17858, 1125, 13, 1678, 9995, 13, 1678, 910, 740, 14741, 408, 263, 24384, 363, 6068, 20005, 800, 29889, 13, 1678, 9995, 13, 1678, 396, 11308, 502, 411, 29871, 29896, 29896, 29900, 29947, 29947, 29900, 29900, 29914, 29941, 29929, 29929, 29896, 29953, 29947, 29900, 29900, 20005, 800, 13, 1678, 1797, 353, 426, 29926, 29901, 474, 363, 474, 29892, 432, 297, 26985, 4197, 710, 7373, 29897, 363, 903, 297, 3635, 2314, 29913, 13, 1678, 565, 1797, 1839, 29940, 10091, 374, 13200, 703, 387, 29887, 1159, 2033, 1405, 1797, 1839, 29940, 10091, 374, 13200, 703, 19585, 3712, 1159, 2033, 29901, 13, 4706, 736, 7700, 13, 1678, 565, 1797, 1839, 29940, 10091, 374, 13200, 703, 19585, 3712, 1159, 2033, 1405, 1797, 1839, 29940, 10091, 374, 13200, 703, 26613, 333, 1159, 2033, 29901, 13, 4706, 736, 7700, 13, 1678, 565, 1797, 1839, 29924, 9940, 13200, 703, 29906, 1159, 2033, 1405, 1797, 1839, 29924, 9940, 13200, 703, 29941, 1159, 2033, 29901, 13, 4706, 736, 7700, 13, 1678, 565, 1797, 1839, 29924, 9940, 13200, 703, 29896, 1159, 2033, 1405, 1797, 1839, 29924, 9940, 13200, 703, 29906, 1159, 2033, 29901, 13, 4706, 736, 7700, 13, 1678, 736, 5852, 13, 13, 1753, 20088, 29918, 1524, 519, 29898, 1524, 29892, 2070, 29922, 29900, 29889, 29900, 29900, 29896, 29892, 4236, 29918, 29875, 353, 29871, 29896, 29900, 29900, 1125, 13, 1678, 9995, 13, 1678, 16968, 368, 27778, 777, 4452, 297, 278, 4256, 519, 29889, 29871, 13, 1678, 9995, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 474, 29966, 3317, 29918, 29875, 29901, 13, 4706, 565, 4036, 29889, 8172, 580, 529, 2070, 29901, 13, 9651, 7709, 2446, 29898, 1524, 29897, 13, 13, 24622, 29918, 546, 1516, 353, 9423, 363, 903, 297, 372, 29889, 546, 6149, 800, 29898, 13152, 1799, 8979, 1307, 29918, 29907, 1718, 8452, 29897, 565, 2758, 7373, 876, 13, 29937, 565, 366, 864, 304, 4559, 29892, 366, 508, 443, 9342, 445, 1196, 29889, 13, 24622, 29918, 546, 1516, 353, 20088, 29918, 1524, 519, 7373, 363, 903, 297, 372, 29889, 546, 6149, 800, 29898, 13152, 1799, 8979, 1307, 29918, 29907, 1718, 8452, 29897, 565, 2758, 7373, 876, 13, 13, 2158, 703, 4013, 674, 1065, 363, 263, 1550, 1363, 1506, 1082, 4889, 338, 20239, 23157, 13, 1454, 20005, 362, 297, 6068, 29918, 546, 1516, 29901, 13, 1678, 565, 451, 2758, 29898, 546, 6149, 362, 1125, 13, 4706, 6773, 13, 1678, 302, 353, 29871, 29906, 29900, 13, 1678, 1797, 353, 426, 29926, 29901, 474, 363, 474, 29892, 432, 297, 26985, 4197, 710, 7373, 29897, 363, 903, 297, 20005, 362, 2314, 29913, 13, 1678, 8158, 353, 29611, 29898, 2098, 29892, 302, 29897, 13, 1678, 1596, 703, 7543, 1797, 26254, 1012, 29876, 4537, 310, 21614, 26254, 6822, 8875, 1642, 4830, 29898, 546, 6149, 362, 29892, 8158, 29892, 302, 876, 13, 2 ]
spikeforest2/experimental/__init__.py
michaeljohnclancy/spikeforest2
26
55205
from ._sort import sort
[ 1, 515, 869, 29918, 6605, 1053, 2656, 2 ]
logger.py
vjdw/piper
0
188451
<reponame>vjdw/piper class Logger: def __init__(self, filepath): self.filepath = filepath def write(self, msg): with open(self.filepath, "a") as logfile: logfile.write("{}\n".format(msg))
[ 1, 529, 276, 1112, 420, 29958, 29894, 26012, 29893, 29914, 1631, 546, 13, 1990, 28468, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 2084, 1125, 13, 4706, 1583, 29889, 1445, 2084, 353, 934, 2084, 13, 13, 1678, 822, 2436, 29898, 1311, 29892, 10191, 1125, 13, 4706, 411, 1722, 29898, 1311, 29889, 1445, 2084, 29892, 376, 29874, 1159, 408, 1480, 1445, 29901, 13, 965, 1480, 1445, 29889, 3539, 703, 29912, 1012, 29876, 1642, 4830, 29898, 7645, 876, 13, 2 ]
mesostat/visualization/mpl_timescale_bar.py
HelmchenLabSoftware/mesostat-dev
0
105081
<gh_stars>0 import numpy as np from matplotlib.patches import Rectangle from mesostat.visualization.mpl_colors import base_colors_rgb def add_timescale_bar(fig, tNames, tPosts, tNow, colorscheme='tableau', colorNow='red', fontsize=14): """ :param fig: Existing figure. May have multiple subplots (intended) :param tNames: Names of time intervals :param tPosts: Time at which each time interval ends :param tNow: Specific current time to be marked on the timebar :param colorscheme: Color scheme name from which the time interval colors will be sampled :param colorNow: Color of the marker for the current time :param fontsize: Font size of the timebar labels :return: Nothing Produces a timescale bar, namely, a set of consecutive labeled rectangles denoting different time intervals. Attaches the timescale bar at the bottom of existing figure. Intended use is to mark the timeframe of a video, when multiple consecutive figures of the same shape are produced. """ # Get size of the original image in inches wSrcInch, hSrcInch = fig.get_size_inches() # Postulate size of the timebar in inches wTrgInch = wSrcInch # Currently, width of timebar will be equal to the full figure width hTrgInch = 0.3 # Currently, height of the timebar is fixed # Find size of the timebar in pixels wTrgPix = wTrgInch * fig.dpi hTrgPix = hTrgInch * fig.dpi # Find size of the timebar relative to the original image wRel = wTrgInch / wSrcInch hRel = hTrgInch / hSrcInch # Add a new axis just below the existing figure # Note: Positions and sizes must be specified relative to the original figure for this function # Note: timebar is shifted down exactly by its height. In theory it should overlap with original image, in practice # it does not, there is some extra margin introduced by matplotlib somewhere ax = fig.add_axes([0, -hRel, wRel, hRel]) _make_time_legend(ax, tNames, tPosts, wTrgPix, hTrgPix, tNow, colorscheme=colorscheme, colorNow=colorNow, fontsize=fontsize) def _make_time_legend(ax, tNames, tPosts, wPix, hPix, tNow, colorscheme='tableau', colorNow='red', fontsize=14): """ :param ax: Axis where to plot the timebar :param tNames: Names of time intervals :param tPosts: Time at which each time interval ends :param wPix: Width of timebar in pixels :param hPix: Height of timebar in pixels :param tNow: Specific current time to be marked on the timebar :param colorscheme: Color scheme name from which the time interval colors will be sampled :param colorNow: Color of the marker for the current time :param fontsize: Font size of the timebar labels :return: Nothing Auxiliary procedure for add_timescale_bar to actually produce the timebar """ nBars = len(tNames) epsTime2Pix = wPix / tPosts[-1] # Rescale timeposts from time to timebar width. Add 0-timepost at the beginning tPostsPix = np.hstack([[0], tPosts]) * epsTime2Pix # Rescale current time to timebar width tNowPix = tNow * epsTime2Pix # Get color palette to sample rectangles # basecolors = list(base_colors_rgb(key=colorscheme).values()) basecolors = base_colors_rgb(key=colorscheme) # Plot all rectangles for i in range(nBars): bar = Rectangle((tPostsPix[i], 0), tPostsPix[i + 1] - tPostsPix[i], hPix, facecolor=basecolors[i], alpha=0.5) ax.add_patch(bar) # Label each rectangle. Each label is centered with respect to its rectangle. ax.text((tPostsPix[i] + tPostsPix[i + 1]) // 2, hPix // 2, tNames[i], fontsize=fontsize, ha='center', va='center') ax.axvline(x=tNowPix, color=colorNow) ax.set_axis_off() ax.autoscale()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12655, 408, 7442, 13, 3166, 22889, 29889, 5041, 267, 1053, 22914, 2521, 13, 13, 3166, 4883, 520, 271, 29889, 20119, 2133, 29889, 29885, 572, 29918, 27703, 1053, 2967, 29918, 27703, 29918, 23973, 13, 13, 13, 1753, 788, 29918, 3706, 29883, 744, 29918, 1646, 29898, 1003, 29892, 260, 8659, 29892, 260, 6747, 29879, 29892, 260, 10454, 29892, 2927, 816, 2004, 2433, 2371, 585, 742, 2927, 10454, 2433, 1127, 742, 4079, 2311, 29922, 29896, 29946, 1125, 13, 1678, 9995, 13, 1678, 584, 3207, 2537, 29901, 3986, 1222, 15423, 4377, 29889, 2610, 505, 2999, 1014, 26762, 313, 524, 2760, 29897, 13, 1678, 584, 3207, 260, 8659, 29901, 539, 14706, 310, 931, 18747, 13, 1678, 584, 3207, 260, 6747, 29879, 29901, 539, 5974, 472, 607, 1269, 931, 7292, 10614, 13, 1678, 584, 3207, 260, 10454, 29901, 308, 21220, 1857, 931, 304, 367, 10902, 373, 278, 931, 1646, 13, 1678, 584, 3207, 2927, 816, 2004, 29901, 29871, 9159, 11380, 1024, 515, 607, 278, 931, 7292, 11955, 674, 367, 4559, 29881, 13, 1678, 584, 3207, 2927, 10454, 29901, 268, 9159, 310, 278, 17456, 363, 278, 1857, 931, 13, 1678, 584, 3207, 4079, 2311, 29901, 268, 10928, 2159, 310, 278, 931, 1646, 11073, 13, 1678, 584, 2457, 29901, 632, 9531, 13, 13, 1678, 7138, 778, 263, 3064, 29883, 744, 2594, 29892, 18451, 29892, 263, 731, 310, 18942, 301, 24025, 7705, 19536, 972, 11427, 1422, 931, 18747, 29889, 13, 1678, 6212, 14520, 278, 3064, 29883, 744, 2594, 472, 278, 5970, 310, 5923, 4377, 29889, 3159, 2760, 671, 338, 304, 2791, 278, 931, 2557, 310, 263, 4863, 29892, 746, 13, 1678, 2999, 18942, 13994, 310, 278, 1021, 8267, 526, 7371, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 3617, 2159, 310, 278, 2441, 1967, 297, 22831, 13, 1678, 281, 29903, 2214, 797, 305, 29892, 298, 29903, 2214, 797, 305, 353, 2537, 29889, 657, 29918, 2311, 29918, 262, 6609, 580, 13, 13, 1678, 396, 4918, 5987, 2159, 310, 278, 931, 1646, 297, 22831, 13, 1678, 281, 2308, 29887, 797, 305, 353, 281, 29903, 2214, 797, 305, 259, 396, 15447, 29892, 2920, 310, 931, 1646, 674, 367, 5186, 304, 278, 2989, 4377, 2920, 13, 1678, 298, 2308, 29887, 797, 305, 353, 29871, 29900, 29889, 29941, 4706, 396, 15447, 29892, 3171, 310, 278, 931, 1646, 338, 4343, 13, 13, 1678, 396, 10987, 2159, 310, 278, 931, 1646, 297, 17036, 13, 1678, 281, 2308, 29887, 29925, 861, 353, 281, 2308, 29887, 797, 305, 334, 2537, 29889, 29881, 1631, 13, 1678, 298, 2308, 29887, 29925, 861, 353, 298, 2308, 29887, 797, 305, 334, 2537, 29889, 29881, 1631, 13, 13, 1678, 396, 10987, 2159, 310, 278, 931, 1646, 6198, 304, 278, 2441, 1967, 13, 1678, 281, 9662, 353, 281, 2308, 29887, 797, 305, 847, 281, 29903, 2214, 797, 305, 13, 1678, 298, 9662, 353, 298, 2308, 29887, 797, 305, 847, 298, 29903, 2214, 797, 305, 13, 13, 1678, 396, 3462, 263, 716, 9685, 925, 2400, 278, 5923, 4377, 13, 1678, 396, 3940, 29901, 10321, 2187, 322, 15786, 1818, 367, 6790, 6198, 304, 278, 2441, 4377, 363, 445, 740, 13, 1678, 396, 3940, 29901, 931, 1646, 338, 9500, 287, 1623, 3721, 491, 967, 3171, 29889, 512, 6368, 372, 881, 25457, 411, 2441, 1967, 29892, 297, 6944, 13, 1678, 396, 259, 372, 947, 451, 29892, 727, 338, 777, 4805, 5906, 9129, 491, 22889, 9051, 13, 1678, 4853, 353, 2537, 29889, 1202, 29918, 1165, 267, 4197, 29900, 29892, 448, 29882, 9662, 29892, 281, 9662, 29892, 298, 9662, 2314, 13, 1678, 903, 5675, 29918, 2230, 29918, 26172, 29898, 1165, 29892, 260, 8659, 29892, 260, 6747, 29879, 29892, 281, 2308, 29887, 29925, 861, 29892, 298, 2308, 29887, 29925, 861, 29892, 260, 10454, 29892, 13, 462, 418, 2927, 816, 2004, 29922, 2780, 816, 2004, 29892, 2927, 10454, 29922, 2780, 10454, 29892, 4079, 2311, 29922, 5657, 2311, 29897, 13, 13, 13, 1753, 903, 5675, 29918, 2230, 29918, 26172, 29898, 1165, 29892, 260, 8659, 29892, 260, 6747, 29879, 29892, 281, 29925, 861, 29892, 298, 29925, 861, 29892, 260, 10454, 29892, 2927, 816, 2004, 2433, 2371, 585, 742, 2927, 10454, 2433, 1127, 742, 4079, 2311, 29922, 29896, 29946, 1125, 13, 1678, 9995, 13, 1678, 584, 3207, 4853, 29901, 965, 319, 11497, 988, 304, 6492, 278, 931, 1646, 13, 1678, 584, 3207, 260, 8659, 29901, 539, 14706, 310, 931, 18747, 13, 1678, 584, 3207, 260, 6747, 29879, 29901, 539, 5974, 472, 607, 1269, 931, 7292, 10614, 13, 1678, 584, 3207, 281, 29925, 861, 29901, 308, 21485, 310, 931, 1646, 297, 17036, 13, 1678, 584, 3207, 298, 29925, 861, 29901, 308, 22907, 310, 931, 1646, 297, 17036, 13, 1678, 584, 3207, 260, 10454, 29901, 308, 21220, 1857, 931, 304, 367, 10902, 373, 278, 931, 1646, 13, 1678, 584, 3207, 2927, 816, 2004, 29901, 29871, 9159, 11380, 1024, 515, 607, 278, 931, 7292, 11955, 674, 367, 4559, 29881, 13, 1678, 584, 3207, 2927, 10454, 29901, 268, 9159, 310, 278, 17456, 363, 278, 1857, 931, 13, 1678, 584, 3207, 4079, 2311, 29901, 268, 10928, 2159, 310, 278, 931, 1646, 11073, 13, 1678, 584, 2457, 29901, 632, 9531, 13, 13, 1678, 319, 1314, 2638, 653, 8792, 363, 788, 29918, 3706, 29883, 744, 29918, 1646, 304, 2869, 7738, 278, 931, 1646, 13, 1678, 9995, 13, 13, 1678, 302, 29933, 1503, 353, 7431, 29898, 29873, 8659, 29897, 13, 1678, 321, 567, 2481, 29906, 29925, 861, 353, 281, 29925, 861, 847, 260, 6747, 29879, 14352, 29896, 29962, 13, 13, 1678, 396, 2538, 29883, 744, 931, 14080, 515, 931, 304, 931, 1646, 2920, 29889, 3462, 29871, 29900, 29899, 2230, 2490, 472, 278, 6763, 13, 1678, 260, 6747, 29879, 29925, 861, 353, 7442, 29889, 29882, 1429, 4197, 29961, 29900, 1402, 260, 6747, 29879, 2314, 334, 321, 567, 2481, 29906, 29925, 861, 13, 13, 1678, 396, 2538, 29883, 744, 1857, 931, 304, 931, 1646, 2920, 13, 1678, 260, 10454, 29925, 861, 353, 260, 10454, 334, 321, 567, 2481, 29906, 29925, 861, 13, 13, 1678, 396, 3617, 2927, 282, 26456, 304, 4559, 7705, 19536, 13, 1678, 396, 2967, 27703, 353, 1051, 29898, 3188, 29918, 27703, 29918, 23973, 29898, 1989, 29922, 2780, 816, 2004, 467, 5975, 3101, 13, 1678, 2967, 27703, 353, 2967, 29918, 27703, 29918, 23973, 29898, 1989, 29922, 2780, 816, 2004, 29897, 13, 13, 1678, 396, 18399, 599, 7705, 19536, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 29933, 1503, 1125, 13, 4706, 2594, 353, 22914, 2521, 3552, 29873, 6747, 29879, 29925, 861, 29961, 29875, 1402, 29871, 29900, 511, 260, 6747, 29879, 29925, 861, 29961, 29875, 718, 29871, 29896, 29962, 448, 260, 6747, 29879, 29925, 861, 29961, 29875, 1402, 298, 29925, 861, 29892, 3700, 2780, 29922, 3188, 27703, 29961, 29875, 1402, 15595, 29922, 29900, 29889, 29945, 29897, 13, 4706, 4853, 29889, 1202, 29918, 5041, 29898, 1646, 29897, 13, 13, 4706, 396, 15796, 1269, 16701, 29889, 7806, 3858, 338, 24764, 411, 3390, 304, 967, 16701, 29889, 13, 4706, 4853, 29889, 726, 3552, 29873, 6747, 29879, 29925, 861, 29961, 29875, 29962, 718, 260, 6747, 29879, 29925, 861, 29961, 29875, 718, 29871, 29896, 2314, 849, 29871, 29906, 29892, 298, 29925, 861, 849, 29871, 29906, 29892, 260, 8659, 29961, 29875, 1402, 13, 18884, 4079, 2311, 29922, 5657, 2311, 29892, 447, 2433, 5064, 742, 2947, 2433, 5064, 1495, 13, 13, 1678, 4853, 29889, 1165, 29894, 1220, 29898, 29916, 29922, 29873, 10454, 29925, 861, 29892, 2927, 29922, 2780, 10454, 29897, 13, 1678, 4853, 29889, 842, 29918, 8990, 29918, 2696, 580, 13, 1678, 4853, 29889, 1300, 14174, 744, 580, 13, 2 ]
data/compute_budget.py
minorchange/co2_monitor_hd
0
100009
import os, sys import datetime from dateutil.relativedelta import relativedelta from data.read_data import read_budget def get_remaining_paris_budget(df): assert "co2_kt_total" in df.columns budget_start_year, budget_start_value_kt = read_budget() s_total = df["co2_kt_total"].dropna() s_measured_since_budgetstart = s_total[s_total.index >= budget_start_year] measured_co2kt_since_budgetstart = s_measured_since_budgetstart.sum() last_measured_year = s_total.index.max() latest_emissions_ktperyear = s_total[last_measured_year] assert latest_emissions_ktperyear > -1 assert latest_emissions_ktperyear < 3000 seconds_per_year = 60 * 60 * 24 * 365.25 latest_emissions_ktpersecond = latest_emissions_ktperyear / seconds_per_year last_measured_year_since_before_budgetstart = max( last_measured_year, budget_start_year - 1 ) last_measured_second = datetime.datetime.strptime( f"{last_measured_year_since_before_budgetstart}-12-31 23:59:59", "%Y-%m-%d %H:%M:%S", ) now = datetime.datetime.now() seconds_since_last_measured_second = (now - last_measured_second).total_seconds() estimated_emissions_kt = ( latest_emissions_ktpersecond * seconds_since_last_measured_second ) total_emissions_kt = measured_co2kt_since_budgetstart + estimated_emissions_kt remaining_budget_kt = budget_start_value_kt - total_emissions_kt remaining_seconds = remaining_budget_kt / latest_emissions_ktpersecond when_budget_is_depleted = now + relativedelta(seconds=+remaining_seconds) return remaining_budget_kt, when_budget_is_depleted if __name__ == "__main__": from read_data import read_emissions df_emissions = read_emissions() remaining_budget_kt, when_budget_is_depleted = get_remaining_paris_budget( df_emissions, trend ) print(total_emissions_kt) print(remaining_budget_kt) print(remaining_budget_kt.year)
[ 1, 1053, 2897, 29892, 10876, 13, 5215, 12865, 13, 3166, 2635, 4422, 29889, 2674, 1926, 287, 2554, 1053, 14215, 287, 2554, 13, 3166, 848, 29889, 949, 29918, 1272, 1053, 1303, 29918, 15841, 657, 13, 13, 13, 1753, 679, 29918, 1745, 17225, 29918, 862, 275, 29918, 15841, 657, 29898, 2176, 1125, 13, 13, 1678, 4974, 376, 1111, 29906, 29918, 1193, 29918, 7827, 29908, 297, 4489, 29889, 13099, 13, 13, 1678, 23562, 29918, 2962, 29918, 6360, 29892, 23562, 29918, 2962, 29918, 1767, 29918, 1193, 353, 1303, 29918, 15841, 657, 580, 13, 13, 1678, 269, 29918, 7827, 353, 4489, 3366, 1111, 29906, 29918, 1193, 29918, 7827, 16862, 8865, 1056, 580, 13, 13, 1678, 269, 29918, 1004, 294, 2955, 29918, 16076, 29918, 15841, 657, 2962, 353, 269, 29918, 7827, 29961, 29879, 29918, 7827, 29889, 2248, 6736, 23562, 29918, 2962, 29918, 6360, 29962, 13, 1678, 17005, 29918, 1111, 29906, 1193, 29918, 16076, 29918, 15841, 657, 2962, 353, 269, 29918, 1004, 294, 2955, 29918, 16076, 29918, 15841, 657, 2962, 29889, 2083, 580, 13, 13, 1678, 1833, 29918, 1004, 294, 2955, 29918, 6360, 353, 269, 29918, 7827, 29889, 2248, 29889, 3317, 580, 13, 1678, 9281, 29918, 331, 6847, 29918, 1193, 546, 6360, 353, 269, 29918, 7827, 29961, 4230, 29918, 1004, 294, 2955, 29918, 6360, 29962, 13, 1678, 4974, 9281, 29918, 331, 6847, 29918, 1193, 546, 6360, 1405, 448, 29896, 13, 1678, 4974, 9281, 29918, 331, 6847, 29918, 1193, 546, 6360, 529, 29871, 29941, 29900, 29900, 29900, 13, 13, 1678, 6923, 29918, 546, 29918, 6360, 353, 29871, 29953, 29900, 334, 29871, 29953, 29900, 334, 29871, 29906, 29946, 334, 29871, 29941, 29953, 29945, 29889, 29906, 29945, 13, 1678, 9281, 29918, 331, 6847, 29918, 1193, 546, 7496, 353, 9281, 29918, 331, 6847, 29918, 1193, 546, 6360, 847, 6923, 29918, 546, 29918, 6360, 13, 13, 1678, 1833, 29918, 1004, 294, 2955, 29918, 6360, 29918, 16076, 29918, 11083, 29918, 15841, 657, 2962, 353, 4236, 29898, 13, 4706, 1833, 29918, 1004, 294, 2955, 29918, 6360, 29892, 23562, 29918, 2962, 29918, 6360, 448, 29871, 29896, 13, 1678, 1723, 13, 1678, 1833, 29918, 1004, 294, 2955, 29918, 7496, 353, 12865, 29889, 12673, 29889, 710, 415, 603, 29898, 13, 4706, 285, 29908, 29912, 4230, 29918, 1004, 294, 2955, 29918, 6360, 29918, 16076, 29918, 11083, 29918, 15841, 657, 2962, 7402, 29896, 29906, 29899, 29941, 29896, 29871, 29906, 29941, 29901, 29945, 29929, 29901, 29945, 29929, 613, 13, 4706, 11860, 29979, 19222, 29885, 19222, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 613, 13, 1678, 1723, 13, 13, 1678, 1286, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 1678, 6923, 29918, 16076, 29918, 4230, 29918, 1004, 294, 2955, 29918, 7496, 353, 313, 3707, 448, 1833, 29918, 1004, 294, 2955, 29918, 7496, 467, 7827, 29918, 23128, 580, 13, 13, 1678, 15899, 29918, 331, 6847, 29918, 1193, 353, 313, 13, 4706, 9281, 29918, 331, 6847, 29918, 1193, 546, 7496, 334, 6923, 29918, 16076, 29918, 4230, 29918, 1004, 294, 2955, 29918, 7496, 13, 1678, 1723, 13, 1678, 3001, 29918, 331, 6847, 29918, 1193, 353, 17005, 29918, 1111, 29906, 1193, 29918, 16076, 29918, 15841, 657, 2962, 718, 15899, 29918, 331, 6847, 29918, 1193, 13, 13, 1678, 9886, 29918, 15841, 657, 29918, 1193, 353, 23562, 29918, 2962, 29918, 1767, 29918, 1193, 448, 3001, 29918, 331, 6847, 29918, 1193, 13, 1678, 9886, 29918, 23128, 353, 9886, 29918, 15841, 657, 29918, 1193, 847, 9281, 29918, 331, 6847, 29918, 1193, 546, 7496, 13, 13, 1678, 746, 29918, 15841, 657, 29918, 275, 29918, 311, 552, 9446, 353, 1286, 718, 14215, 287, 2554, 29898, 23128, 29922, 29974, 1745, 17225, 29918, 23128, 29897, 13, 1678, 736, 9886, 29918, 15841, 657, 29918, 1193, 29892, 746, 29918, 15841, 657, 29918, 275, 29918, 311, 552, 9446, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 515, 1303, 29918, 1272, 1053, 1303, 29918, 331, 6847, 13, 13, 1678, 4489, 29918, 331, 6847, 353, 1303, 29918, 331, 6847, 580, 13, 1678, 9886, 29918, 15841, 657, 29918, 1193, 29892, 746, 29918, 15841, 657, 29918, 275, 29918, 311, 552, 9446, 353, 679, 29918, 1745, 17225, 29918, 862, 275, 29918, 15841, 657, 29898, 13, 4706, 4489, 29918, 331, 6847, 29892, 534, 355, 13, 1678, 1723, 13, 13, 1678, 1596, 29898, 7827, 29918, 331, 6847, 29918, 1193, 29897, 13, 1678, 1596, 29898, 1745, 17225, 29918, 15841, 657, 29918, 1193, 29897, 13, 1678, 1596, 29898, 1745, 17225, 29918, 15841, 657, 29918, 1193, 29889, 6360, 29897, 13, 2 ]
loris/requests/meta_request.py
jpstroop/loris-redux
7
81833
# # This helps us not have to pass so many things (caches, resolvers, # transcoders...) around by letting us set class properties on the IIIFRequest # at startup. Here's a basic example of how this pattern works: # # >>> class MyMeta(type): # Note we subclass type, not object # ... _something = None # ... def _get_something(self): # ... return self._something # ... def _set_something(self, value): # ... self._something = value # ... something = property(_get_something, _set_something) # ... # >>> class MyFoo(metaclass=MyMeta): # ... pass # >>> print(MyFoo.something) # None # >>> MyFoo.something = 'bar' # >>> MyFoo.something # 'bar' # class MetaRequest(type): _compliance = None _info_cache = None _extractors = None _app_configs = None _transcoders = None _resolvers = None def _get_compliance(self): return self._compliance def _set_compliance(self, compliance): self._compliance = compliance compliance = property(_get_compliance, _set_compliance) def _get_info_cache(self): return self._info_cache def _set_info_cache(self, info_cache): self._info_cache = info_cache info_cache = property(_get_info_cache, _set_info_cache) def _get_extractors(self): return self._extractors def _set_extractors(self, extractors): self._extractors = extractors extractors = property(_get_extractors, _set_extractors) def _get_app_configs(self): return self._app_configs def _set_app_configs(self, app_configs): self._app_configs = app_configs app_configs = property(_get_app_configs, _set_app_configs) def _get_transcoders(self): return self._transcoders def _set_transcoders(self, transcoders): self._transcoders = transcoders transcoders = property(_get_transcoders, _set_transcoders) def _get_resolvers(self): return self._resolvers def _set_resolvers(self, resolvers): self._resolvers = resolvers resolvers = property(_get_resolvers, _set_resolvers)
[ 1, 396, 13, 29937, 910, 6911, 502, 451, 505, 304, 1209, 577, 1784, 2712, 313, 29883, 14520, 29892, 3770, 874, 29892, 13, 29937, 1301, 19284, 414, 11410, 2820, 491, 27697, 502, 731, 770, 4426, 373, 278, 4786, 29943, 3089, 13, 29937, 472, 20234, 29889, 2266, 29915, 29879, 263, 6996, 1342, 310, 920, 445, 4766, 1736, 29901, 13, 29937, 13, 29937, 8653, 770, 1619, 19346, 29898, 1853, 1125, 396, 3940, 591, 19481, 1134, 29892, 451, 1203, 13, 29937, 2023, 268, 903, 14481, 353, 6213, 13, 29937, 2023, 268, 822, 903, 657, 29918, 14481, 29898, 1311, 1125, 13, 29937, 2023, 308, 736, 1583, 3032, 14481, 13, 29937, 2023, 268, 822, 903, 842, 29918, 14481, 29898, 1311, 29892, 995, 1125, 13, 29937, 2023, 308, 1583, 3032, 14481, 353, 995, 13, 29937, 2023, 268, 1554, 353, 2875, 7373, 657, 29918, 14481, 29892, 903, 842, 29918, 14481, 29897, 13, 29937, 2023, 13, 29937, 8653, 770, 1619, 14016, 29898, 2527, 562, 605, 29922, 3421, 19346, 1125, 13, 29937, 2023, 268, 1209, 13, 29937, 8653, 1596, 29898, 3421, 14016, 29889, 14481, 29897, 13, 29937, 6213, 13, 29937, 8653, 1619, 14016, 29889, 14481, 353, 525, 1646, 29915, 13, 29937, 8653, 1619, 14016, 29889, 14481, 13, 29937, 525, 1646, 29915, 13, 29937, 13, 13, 13, 1990, 20553, 3089, 29898, 1853, 1125, 13, 13, 1678, 903, 2388, 13036, 353, 6213, 13, 1678, 903, 3888, 29918, 8173, 353, 6213, 13, 1678, 903, 21111, 943, 353, 6213, 13, 1678, 903, 932, 29918, 2917, 29879, 353, 6213, 13, 1678, 903, 3286, 19284, 414, 353, 6213, 13, 1678, 903, 9778, 874, 353, 6213, 13, 13, 1678, 822, 903, 657, 29918, 2388, 13036, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 2388, 13036, 13, 13, 1678, 822, 903, 842, 29918, 2388, 13036, 29898, 1311, 29892, 752, 13036, 1125, 13, 4706, 1583, 3032, 2388, 13036, 353, 752, 13036, 13, 13, 1678, 752, 13036, 353, 2875, 7373, 657, 29918, 2388, 13036, 29892, 903, 842, 29918, 2388, 13036, 29897, 13, 13, 1678, 822, 903, 657, 29918, 3888, 29918, 8173, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 3888, 29918, 8173, 13, 13, 1678, 822, 903, 842, 29918, 3888, 29918, 8173, 29898, 1311, 29892, 5235, 29918, 8173, 1125, 13, 4706, 1583, 3032, 3888, 29918, 8173, 353, 5235, 29918, 8173, 13, 13, 1678, 5235, 29918, 8173, 353, 2875, 7373, 657, 29918, 3888, 29918, 8173, 29892, 903, 842, 29918, 3888, 29918, 8173, 29897, 13, 13, 1678, 822, 903, 657, 29918, 21111, 943, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 21111, 943, 13, 13, 1678, 822, 903, 842, 29918, 21111, 943, 29898, 1311, 29892, 6597, 943, 1125, 13, 4706, 1583, 3032, 21111, 943, 353, 6597, 943, 13, 13, 1678, 6597, 943, 353, 2875, 7373, 657, 29918, 21111, 943, 29892, 903, 842, 29918, 21111, 943, 29897, 13, 13, 1678, 822, 903, 657, 29918, 932, 29918, 2917, 29879, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 932, 29918, 2917, 29879, 13, 13, 1678, 822, 903, 842, 29918, 932, 29918, 2917, 29879, 29898, 1311, 29892, 623, 29918, 2917, 29879, 1125, 13, 4706, 1583, 3032, 932, 29918, 2917, 29879, 353, 623, 29918, 2917, 29879, 13, 13, 1678, 623, 29918, 2917, 29879, 353, 2875, 7373, 657, 29918, 932, 29918, 2917, 29879, 29892, 903, 842, 29918, 932, 29918, 2917, 29879, 29897, 13, 13, 1678, 822, 903, 657, 29918, 3286, 19284, 414, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 3286, 19284, 414, 13, 13, 1678, 822, 903, 842, 29918, 3286, 19284, 414, 29898, 1311, 29892, 1301, 19284, 414, 1125, 13, 4706, 1583, 3032, 3286, 19284, 414, 353, 1301, 19284, 414, 13, 13, 1678, 1301, 19284, 414, 353, 2875, 7373, 657, 29918, 3286, 19284, 414, 29892, 903, 842, 29918, 3286, 19284, 414, 29897, 13, 13, 1678, 822, 903, 657, 29918, 9778, 874, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 9778, 874, 13, 13, 1678, 822, 903, 842, 29918, 9778, 874, 29898, 1311, 29892, 3770, 874, 1125, 13, 4706, 1583, 3032, 9778, 874, 353, 3770, 874, 13, 13, 1678, 3770, 874, 353, 2875, 7373, 657, 29918, 9778, 874, 29892, 903, 842, 29918, 9778, 874, 29897, 13, 2 ]
src/core/ServerBase.py
PyDO-Team/PyDO-Old
1
149670
import sys from direct.showbase.ShowBase import ShowBase from direct.directnotify import DirectNotifyGlobal from panda3d.core import UniqueIdAllocator from src.util.LogManager import LogManager from src.dclass.DCManager import DCManager from src.core.ConnectionManager import ConnectionManager from src.message.MessageManager import MessageManager from src.distributed.DistributedObjectManager import DistributedObjectManager from src.interest.InterestManager import InterestManager class ServerBase(ShowBase): notify = DirectNotifyGlobal.directNotify.newCategory("ServerBase") serverVersion = 'pcsv1.0.34.31' def __init__(self): ShowBase.__init__(self) self.activeConnections = {} maxChannels = self.config.GetInt('max-channel-id', 1000000) self.channelAllocator = UniqueIdAllocator(0, 0+maxChannels-1) self.configManager = None self.logManager = LogManager() self.dcManager = DCManager() self.dcManager.readDCFile() self.notify.warning(str(self.dcManager.dclassesByName)) self.connectionManager = ConnectionManager() self.messageManager = MessageManager() self.doManager = DistributedObjectManager() self.interestManager = InterestManager()
[ 1, 1053, 10876, 13, 3166, 1513, 29889, 4294, 3188, 29889, 8964, 5160, 1053, 7704, 5160, 13, 3166, 1513, 29889, 11851, 25140, 1053, 8797, 3664, 1598, 12756, 13, 3166, 282, 5863, 29941, 29881, 29889, 3221, 1053, 853, 1387, 1204, 2499, 2029, 1061, 13, 13, 3166, 4765, 29889, 4422, 29889, 3403, 3260, 1053, 4522, 3260, 13, 3166, 4765, 29889, 29881, 1990, 29889, 12696, 3260, 1053, 13681, 3260, 13, 3166, 4765, 29889, 3221, 29889, 5350, 3260, 1053, 15160, 3260, 13, 3166, 4765, 29889, 4906, 29889, 3728, 3260, 1053, 7777, 3260, 13, 3166, 4765, 29889, 5721, 7541, 29889, 13398, 7541, 2061, 3260, 1053, 6652, 7541, 2061, 3260, 13, 3166, 4765, 29889, 1639, 342, 29889, 4074, 342, 3260, 1053, 23829, 3260, 13, 13, 13, 1990, 5656, 5160, 29898, 8964, 5160, 1125, 13, 1678, 26051, 353, 8797, 3664, 1598, 12756, 29889, 11851, 3664, 1598, 29889, 1482, 10900, 703, 6004, 5160, 1159, 13, 1678, 1923, 6594, 353, 525, 29886, 7638, 29896, 29889, 29900, 29889, 29941, 29946, 29889, 29941, 29896, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 7704, 5160, 17255, 2344, 12035, 1311, 29897, 13, 13, 4706, 1583, 29889, 4925, 20971, 1953, 353, 6571, 13, 13, 4706, 4236, 1451, 12629, 353, 1583, 29889, 2917, 29889, 2577, 2928, 877, 3317, 29899, 12719, 29899, 333, 742, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29897, 13, 4706, 1583, 29889, 12719, 2499, 2029, 1061, 353, 853, 1387, 1204, 2499, 2029, 1061, 29898, 29900, 29892, 29871, 29900, 29974, 3317, 1451, 12629, 29899, 29896, 29897, 13, 13, 4706, 1583, 29889, 2917, 3260, 353, 6213, 13, 13, 4706, 1583, 29889, 1188, 3260, 353, 4522, 3260, 580, 13, 4706, 1583, 29889, 13891, 3260, 353, 13681, 3260, 580, 13, 4706, 1583, 29889, 13891, 3260, 29889, 949, 12696, 2283, 580, 13, 4706, 1583, 29889, 25140, 29889, 27392, 29898, 710, 29898, 1311, 29889, 13891, 3260, 29889, 29881, 13203, 2059, 1170, 876, 13, 4706, 1583, 29889, 9965, 3260, 353, 15160, 3260, 580, 13, 4706, 1583, 29889, 4906, 3260, 353, 7777, 3260, 580, 13, 4706, 1583, 29889, 1867, 3260, 353, 6652, 7541, 2061, 3260, 580, 13, 4706, 1583, 29889, 1639, 342, 3260, 353, 23829, 3260, 580, 2 ]
source/db/Entry.py
RobinSatterthwaite/BirdTable
0
92285
from typing import Any import pyodbc as odbc from .Property import Property class Entry(object): def __init__(self, table_name: str): self._delete = False self._tableName = table_name self._primaryKey = Property("pk") self.properties = [self._primaryKey] @property def primaryKey(self) -> int: return self._primaryKey.value def delete(self) -> None: self._delete = True def _commitInsert(self, cursor: odbc.Cursor) -> None: prop_names = "" prop_value_tags = "" prop_values = [] for prop in self.properties: if prop.value != None: if prop_names != "": prop_names += "," prop_value_tags += "," prop_names += prop.name prop_value_tags += "?" prop_values.append(prop.value) cursor.execute("INSERT INTO {0} ({1}) VALUES ({2})" .format(self._tableName, prop_names, prop_value_tags), prop_values) cursor.commit() cursor.execute("SELECT LAST_INSERT_ID()") self._primaryKey.value = cursor.fetchone()[0] def _executeUpdate(self, cursor: odbc.Cursor) -> None: prop_sets = "" prop_values = [] for prop in self.properties: if prop.updated: if prop_sets != "": prop_sets += "," prop_sets += "{0}=?".format(prop.name) prop_values.append(prop.value) if len(prop_values) > 0: prop_values.append(self.primaryKey) cursor.execute("UPDATE {0} SET {1} WHERE pk=?" .format(self._tableName, prop_sets), prop_values) def _executeDelete(self, cursor: odbc.Cursor) -> None: cursor.execute("DELETE FROM {0} WHERE pk=?" .format(self._tableName), self.primaryKey) def _finaliseCommit(self) -> None: self._delete = False for prop in self.properties: prop.finaliseCommit() def rollback(self) -> None: self._delete = False for prop in self.properties: prop.rollback()
[ 1, 29871, 13, 3166, 19229, 1053, 3139, 13, 5215, 11451, 10396, 29883, 408, 2413, 12328, 13, 13, 3166, 869, 4854, 1053, 9079, 13, 13, 13, 1990, 28236, 29898, 3318, 1125, 13, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 1591, 29918, 978, 29901, 851, 1125, 13, 12, 12, 1311, 3032, 8143, 353, 7700, 13, 12, 12, 1311, 3032, 2371, 1170, 353, 1591, 29918, 978, 13, 12, 12, 1311, 3032, 16072, 2558, 353, 9079, 703, 20571, 1159, 13, 12, 12, 1311, 29889, 11330, 353, 518, 1311, 3032, 16072, 2558, 29962, 13, 13, 13, 12, 29992, 6799, 13, 12, 1753, 7601, 2558, 29898, 1311, 29897, 1599, 938, 29901, 13, 12, 12, 2457, 1583, 3032, 16072, 2558, 29889, 1767, 13, 13, 13, 12, 1753, 5217, 29898, 1311, 29897, 1599, 6213, 29901, 13, 12, 12, 1311, 3032, 8143, 353, 5852, 13, 13, 13, 12, 1753, 903, 15060, 17491, 29898, 1311, 29892, 10677, 29901, 2413, 12328, 29889, 19890, 29897, 1599, 6213, 29901, 13, 12, 12, 7728, 29918, 7039, 353, 5124, 13, 12, 12, 7728, 29918, 1767, 29918, 11338, 353, 5124, 13, 12, 12, 7728, 29918, 5975, 353, 5159, 13, 12, 12, 1454, 3107, 297, 1583, 29889, 11330, 29901, 13, 12, 12, 12, 361, 3107, 29889, 1767, 2804, 6213, 29901, 13, 12, 12, 12, 12, 361, 3107, 29918, 7039, 2804, 376, 1115, 13, 12, 12, 12, 12, 12, 7728, 29918, 7039, 4619, 28796, 13, 12, 12, 12, 12, 12, 7728, 29918, 1767, 29918, 11338, 4619, 28796, 13, 12, 12, 12, 12, 7728, 29918, 7039, 4619, 3107, 29889, 978, 13, 12, 12, 12, 12, 7728, 29918, 1767, 29918, 11338, 4619, 376, 3026, 13, 12, 12, 12, 12, 7728, 29918, 5975, 29889, 4397, 29898, 7728, 29889, 1767, 29897, 13, 13, 12, 12, 18127, 29889, 7978, 703, 19460, 11646, 426, 29900, 29913, 21313, 29896, 1800, 15673, 21313, 29906, 1800, 29908, 13, 12, 12, 12, 1669, 869, 4830, 29898, 1311, 3032, 2371, 1170, 29892, 3107, 29918, 7039, 29892, 3107, 29918, 1767, 29918, 11338, 511, 3107, 29918, 5975, 29897, 13, 12, 12, 18127, 29889, 15060, 580, 13, 12, 12, 18127, 29889, 7978, 703, 6404, 17900, 1254, 29918, 19460, 29918, 1367, 580, 1159, 13, 12, 12, 1311, 3032, 16072, 2558, 29889, 1767, 353, 10677, 29889, 9155, 650, 580, 29961, 29900, 29962, 13, 13, 13, 12, 1753, 903, 7978, 6422, 29898, 1311, 29892, 10677, 29901, 2413, 12328, 29889, 19890, 29897, 1599, 6213, 29901, 13, 12, 12, 7728, 29918, 7224, 353, 5124, 13, 12, 12, 7728, 29918, 5975, 353, 5159, 13, 12, 12, 1454, 3107, 297, 1583, 29889, 11330, 29901, 13, 12, 12, 12, 361, 3107, 29889, 21402, 29901, 13, 12, 12, 12, 12, 361, 3107, 29918, 7224, 2804, 376, 1115, 13, 12, 12, 12, 12, 12, 7728, 29918, 7224, 4619, 28796, 13, 12, 12, 12, 12, 7728, 29918, 7224, 4619, 29850, 29900, 5369, 29973, 1642, 4830, 29898, 7728, 29889, 978, 29897, 13, 12, 12, 12, 12, 7728, 29918, 5975, 29889, 4397, 29898, 7728, 29889, 1767, 29897, 13, 13, 12, 12, 361, 7431, 29898, 7728, 29918, 5975, 29897, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 7728, 29918, 5975, 29889, 4397, 29898, 1311, 29889, 16072, 2558, 29897, 13, 13, 12, 12, 12, 18127, 29889, 7978, 703, 14474, 426, 29900, 29913, 11368, 426, 29896, 29913, 5754, 282, 29895, 29922, 3026, 13, 12, 12, 12, 12, 1669, 869, 4830, 29898, 1311, 3032, 2371, 1170, 29892, 3107, 29918, 7224, 511, 3107, 29918, 5975, 29897, 13, 13, 13, 12, 1753, 903, 7978, 12498, 29898, 1311, 29892, 10677, 29901, 2413, 12328, 29889, 19890, 29897, 1599, 6213, 29901, 13, 12, 12, 18127, 29889, 7978, 703, 2287, 18476, 3895, 426, 29900, 29913, 5754, 282, 29895, 29922, 3026, 13, 12, 12, 12, 12, 632, 869, 4830, 29898, 1311, 3032, 2371, 1170, 511, 1583, 29889, 16072, 2558, 29897, 13, 13, 13, 12, 1753, 903, 8394, 895, 1523, 2415, 29898, 1311, 29897, 1599, 6213, 29901, 13, 12, 12, 1311, 3032, 8143, 353, 7700, 13, 12, 12, 1454, 3107, 297, 1583, 29889, 11330, 29901, 13, 12, 12, 12, 7728, 29889, 8394, 895, 1523, 2415, 580, 13, 13, 13, 12, 1753, 9679, 1627, 29898, 1311, 29897, 1599, 6213, 29901, 13, 12, 12, 1311, 3032, 8143, 353, 7700, 13, 12, 12, 1454, 3107, 297, 1583, 29889, 11330, 29901, 13, 12, 12, 12, 7728, 29889, 1245, 1627, 580, 13, 12, 12, 12, 2 ]
mrq/redishelpers.py
fredstro/mrq
745
100624
from future.builtins import range from .utils import memoize from . import context def redis_key(name, *args): prefix = context.get_current_config()["redis_prefix"] if name == "known_subqueues": return "%s:ksq:%s" % (prefix, args[0].root_id) elif name == "queue": return "%s:q:%s" % (prefix, args[0].id) elif name == "started_jobs": return "%s:s:started" % prefix elif name == "paused_queues": return "%s:s:paused" % prefix elif name == "notify": return "%s:notify:%s" % (prefix, args[0].root_id) @memoize def redis_zaddbyscore(): """ Increments multiple keys in a sorted set & returns them """ return context.connections.redis.register_script(""" local zset = KEYS[1] local min = ARGV[1] local max = ARGV[2] local offset = ARGV[3] local count = ARGV[4] local score = ARGV[5] local data = redis.call('zrangebyscore', zset, min, max, 'LIMIT', offset, count) for i, member in pairs(data) do redis.call('zadd', zset, score, member) end return data """) @memoize def redis_zpopbyscore(): """ Pops multiple keys by score """ return context.connections.redis.register_script(""" local zset = KEYS[1] local min = ARGV[1] local max = ARGV[2] local offset = ARGV[3] local count = ARGV[4] local data = redis.call('zrangebyscore', zset, min, max, 'LIMIT', offset, count) if #data > 0 then redis.call('zremrangebyrank', zset, 0, #data - 1) end return data """) @memoize def redis_lpopsafe(): """ Safe version of LPOP that also adds the key in a "started" zset """ return context.connections.redis.register_script(""" local key = KEYS[1] local zset_started = KEYS[2] local count = ARGV[1] local now = ARGV[2] local left = ARGV[3] local data = {} local current = nil for i=1, count do if left == '1' then current = redis.call('lpop', key) else current = redis.call('rpop', key) end if current == false then return data end data[i] = current redis.call('zadd', zset_started, now, current) end return data """) def redis_group_command(command, cnt, redis_key): with context.connections.redis.pipeline(transaction=False) as pipe: for _ in range(cnt): getattr(pipe, command)(redis_key) return [x for x in pipe.execute() if x]
[ 1, 515, 5434, 29889, 16145, 1144, 1053, 3464, 13, 3166, 869, 13239, 1053, 2626, 29877, 675, 13, 3166, 869, 1053, 3030, 13, 13, 13, 1753, 29825, 29918, 1989, 29898, 978, 29892, 334, 5085, 1125, 13, 29871, 10944, 353, 3030, 29889, 657, 29918, 3784, 29918, 2917, 580, 3366, 1127, 275, 29918, 13506, 3108, 13, 29871, 565, 1024, 1275, 376, 5203, 29918, 1491, 802, 1041, 1115, 13, 1678, 736, 11860, 29879, 29901, 2039, 29939, 16664, 29879, 29908, 1273, 313, 13506, 29892, 6389, 29961, 29900, 1822, 4632, 29918, 333, 29897, 13, 29871, 25342, 1024, 1275, 376, 9990, 1115, 13, 268, 736, 11860, 29879, 29901, 29939, 16664, 29879, 29908, 1273, 313, 13506, 29892, 6389, 29961, 29900, 1822, 333, 29897, 13, 29871, 25342, 1024, 1275, 376, 2962, 287, 29918, 9057, 29879, 1115, 13, 1678, 736, 11860, 29879, 29901, 29879, 29901, 2962, 287, 29908, 1273, 10944, 13, 29871, 25342, 1024, 1275, 376, 29886, 15244, 29918, 802, 1041, 1115, 13, 1678, 736, 11860, 29879, 29901, 29879, 29901, 29886, 15244, 29908, 1273, 10944, 13, 29871, 25342, 1024, 1275, 376, 25140, 1115, 13, 268, 736, 11860, 29879, 29901, 25140, 16664, 29879, 29908, 1273, 313, 13506, 29892, 6389, 29961, 29900, 1822, 4632, 29918, 333, 29897, 13, 13, 13, 29992, 6954, 29877, 675, 13, 1753, 29825, 29918, 29920, 1202, 29890, 952, 3221, 7295, 13, 1678, 9995, 512, 1037, 1860, 2999, 6611, 297, 263, 12705, 731, 669, 3639, 963, 9995, 13, 13, 1678, 736, 3030, 29889, 11958, 1953, 29889, 1127, 275, 29889, 9573, 29918, 2154, 703, 15945, 13, 2997, 503, 842, 353, 14636, 29903, 29961, 29896, 29962, 13, 2997, 1375, 353, 9033, 22928, 29961, 29896, 29962, 13, 2997, 4236, 353, 9033, 22928, 29961, 29906, 29962, 13, 2997, 9210, 353, 9033, 22928, 29961, 29941, 29962, 13, 2997, 2302, 353, 9033, 22928, 29961, 29946, 29962, 13, 2997, 8158, 353, 9033, 22928, 29961, 29945, 29962, 13, 13, 2997, 848, 353, 29825, 29889, 4804, 877, 29920, 3881, 29890, 952, 3221, 742, 503, 842, 29892, 1375, 29892, 4236, 29892, 525, 5265, 26349, 742, 9210, 29892, 2302, 29897, 13, 1454, 474, 29892, 4509, 297, 11000, 29898, 1272, 29897, 437, 13, 29871, 29825, 29889, 4804, 877, 29920, 1202, 742, 503, 842, 29892, 8158, 29892, 4509, 29897, 13, 355, 13, 13, 2457, 848, 13, 29871, 5124, 1159, 13, 13, 13, 29992, 6954, 29877, 675, 13, 1753, 29825, 29918, 29920, 7323, 29890, 952, 3221, 7295, 13, 1678, 9995, 349, 3554, 2999, 6611, 491, 8158, 9995, 13, 13, 1678, 736, 3030, 29889, 11958, 1953, 29889, 1127, 275, 29889, 9573, 29918, 2154, 703, 15945, 13, 2997, 503, 842, 353, 14636, 29903, 29961, 29896, 29962, 13, 2997, 1375, 353, 9033, 22928, 29961, 29896, 29962, 13, 2997, 4236, 353, 9033, 22928, 29961, 29906, 29962, 13, 2997, 9210, 353, 9033, 22928, 29961, 29941, 29962, 13, 2997, 2302, 353, 9033, 22928, 29961, 29946, 29962, 13, 13, 2997, 848, 353, 29825, 29889, 4804, 877, 29920, 3881, 29890, 952, 3221, 742, 503, 842, 29892, 1375, 29892, 4236, 29892, 525, 5265, 26349, 742, 9210, 29892, 2302, 29897, 13, 361, 396, 1272, 1405, 29871, 29900, 769, 13, 29871, 29825, 29889, 4804, 877, 29920, 1745, 3881, 1609, 10003, 742, 503, 842, 29892, 29871, 29900, 29892, 396, 1272, 448, 29871, 29896, 29897, 13, 355, 13, 13, 2457, 848, 13, 29871, 5124, 1159, 13, 13, 13, 29992, 6954, 29877, 675, 13, 1753, 29825, 29918, 22833, 3554, 29874, 1725, 7295, 13, 1678, 9995, 5701, 1725, 1873, 310, 23671, 4590, 393, 884, 12778, 278, 1820, 297, 263, 376, 2962, 287, 29908, 503, 842, 9995, 13, 13, 1678, 736, 3030, 29889, 11958, 1953, 29889, 1127, 275, 29889, 9573, 29918, 2154, 703, 15945, 13, 2997, 1820, 353, 14636, 29903, 29961, 29896, 29962, 13, 2997, 503, 842, 29918, 2962, 287, 353, 14636, 29903, 29961, 29906, 29962, 13, 2997, 2302, 353, 9033, 22928, 29961, 29896, 29962, 13, 2997, 1286, 353, 9033, 22928, 29961, 29906, 29962, 13, 2997, 2175, 353, 9033, 22928, 29961, 29941, 29962, 13, 2997, 848, 353, 6571, 13, 2997, 1857, 353, 4263, 13, 13, 1454, 474, 29922, 29896, 29892, 2302, 437, 13, 29871, 565, 2175, 1275, 525, 29896, 29915, 769, 13, 1678, 1857, 353, 29825, 29889, 4804, 877, 29880, 7323, 742, 1820, 29897, 13, 29871, 1683, 13, 1678, 1857, 353, 29825, 29889, 4804, 877, 29878, 7323, 742, 1820, 29897, 13, 29871, 1095, 13, 29871, 565, 1857, 1275, 2089, 769, 13, 1678, 736, 848, 13, 29871, 1095, 13, 29871, 848, 29961, 29875, 29962, 353, 1857, 13, 29871, 29825, 29889, 4804, 877, 29920, 1202, 742, 503, 842, 29918, 2962, 287, 29892, 1286, 29892, 1857, 29897, 13, 355, 13, 13, 2457, 848, 13, 15945, 1159, 13, 13, 13, 1753, 29825, 29918, 2972, 29918, 6519, 29898, 6519, 29892, 274, 593, 29892, 29825, 29918, 1989, 1125, 13, 1678, 411, 3030, 29889, 11958, 1953, 29889, 1127, 275, 29889, 13096, 5570, 29898, 20736, 29922, 8824, 29897, 408, 14282, 29901, 13, 4706, 363, 903, 297, 3464, 29898, 20047, 1125, 13, 9651, 679, 5552, 29898, 17760, 29892, 1899, 5033, 1127, 275, 29918, 1989, 29897, 13, 4706, 736, 518, 29916, 363, 921, 297, 14282, 29889, 7978, 580, 565, 921, 29962, 13, 2 ]
Torneo/apps/equipo/migrations/0001_initial.py
Estuardiaz2611/Djangotuto2
0
125078
<reponame>Estuardiaz2611/Djangotuto2 # Generated by Django 2.2.6 on 2019-10-02 17:34 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('liga', '0001_initial'), ] operations = [ migrations.CreateModel( name='Equipo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nombre_equipo', models.CharField(max_length=50)), ('siglas', models.CharField(max_length=5)), ('jugadores', models.IntegerField()), ('encargado', models.CharField(max_length=50)), ('telefono', models.CharField(max_length=9)), ('liga', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='liga.Liga')), ], ), ]
[ 1, 529, 276, 1112, 420, 29958, 12787, 29884, 538, 423, 29920, 29906, 29953, 29896, 29896, 29914, 29928, 29926, 574, 327, 3066, 29906, 13, 29937, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29953, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29900, 29899, 29900, 29906, 29871, 29896, 29955, 29901, 29941, 29946, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 5215, 9557, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 2847, 353, 5852, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 10381, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 6108, 22955, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 12300, 3073, 29898, 6921, 29918, 11600, 29922, 5574, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 29892, 26952, 29918, 978, 2433, 1367, 1495, 511, 13, 18884, 6702, 11522, 1030, 29918, 1686, 22955, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29945, 29900, 8243, 13, 18884, 6702, 18816, 3333, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29945, 8243, 13, 18884, 6702, 29926, 688, 7447, 742, 4733, 29889, 7798, 3073, 25739, 13, 18884, 6702, 3977, 1191, 912, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29945, 29900, 8243, 13, 18884, 6702, 15494, 29888, 3231, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29929, 8243, 13, 18884, 6702, 10381, 742, 4733, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 2433, 10381, 29889, 29931, 4324, 1495, 511, 13, 9651, 21251, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
xero_python/finance/models/problem_type.py
dupski/xero-python
0
171205
<gh_stars>0 # coding: utf-8 """ Xero Finance API The Finance API is a collection of endpoints which customers can use in the course of a loan application, which may assist lenders to gain the confidence they need to provide capital. # noqa: E501 Contact: <EMAIL> Generated by: https://openapi-generator.tech """ import re # noqa: F401 from enum import Enum class ProblemType(Enum): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. allowed enum values """ NOTSET = "NotSet" BANK_ACCOUNT_NOT_FOUND = "bank-account-not-found" INTERNAL_ERROR = "internal-error" INVALID_APPLICATION = "invalid-application" INVALID_REQUEST = "invalid-request" ORGANISATION_NOT_FOUND = "organisation-not-found" ORGANISATION_OFFLINE = "organisation-offline" REQUEST_TIMEOUT = "request-timeout" SERVICE_UNAVAILABLE = "service-unavailable" UNAUTHORIZED = "unauthorized"
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 15945, 29908, 13, 1678, 1060, 1489, 4231, 749, 3450, 13, 13, 1678, 450, 4231, 749, 3450, 338, 263, 4333, 310, 1095, 9748, 607, 20330, 508, 671, 297, 278, 3236, 310, 263, 24806, 2280, 29892, 607, 1122, 6985, 301, 21043, 304, 11581, 278, 16420, 896, 817, 304, 3867, 7483, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 13, 1678, 22387, 29901, 529, 26862, 6227, 29958, 13, 1678, 3251, 630, 491, 29901, 2045, 597, 3150, 2754, 29899, 27959, 29889, 11345, 13, 15945, 29908, 13, 13, 13, 5215, 337, 29871, 396, 694, 25621, 29901, 383, 29946, 29900, 29896, 13, 13, 3166, 14115, 1053, 1174, 398, 13, 13, 13, 1990, 11583, 1542, 29898, 16854, 1125, 13, 1678, 9995, 12256, 29923, 29901, 910, 770, 338, 4469, 5759, 491, 4673, 8787, 3251, 1061, 29889, 13, 1678, 9897, 29901, 2045, 597, 3150, 2754, 29899, 27959, 29889, 11345, 13, 13, 1678, 1938, 451, 3863, 278, 770, 7522, 29889, 13, 13, 1678, 6068, 14115, 1819, 13, 1678, 9995, 13, 13, 1678, 6058, 10490, 353, 376, 3664, 2697, 29908, 13, 1678, 350, 2190, 29968, 29918, 2477, 18736, 29918, 12256, 29918, 5800, 18783, 353, 376, 9157, 29899, 10149, 29899, 1333, 29899, 11940, 29908, 13, 1678, 2672, 4945, 29940, 1964, 29918, 11432, 353, 376, 7564, 29899, 2704, 29908, 13, 1678, 2672, 26707, 29918, 3301, 7390, 28541, 353, 376, 20965, 29899, 6214, 29908, 13, 1678, 2672, 26707, 29918, 16244, 353, 376, 20965, 29899, 3827, 29908, 13, 1678, 6323, 29954, 2190, 3235, 8098, 29918, 12256, 29918, 5800, 18783, 353, 376, 22481, 29899, 1333, 29899, 11940, 29908, 13, 1678, 6323, 29954, 2190, 3235, 8098, 29918, 27681, 18521, 353, 376, 22481, 29899, 2696, 1220, 29908, 13, 1678, 5195, 14130, 29918, 15307, 12015, 353, 376, 3827, 29899, 15619, 29908, 13, 1678, 26996, 19059, 29918, 29965, 3521, 20449, 6227, 6181, 353, 376, 5509, 29899, 348, 16515, 29908, 13, 1678, 501, 3521, 2692, 29950, 1955, 26664, 3352, 353, 376, 348, 8921, 1891, 29908, 13, 2 ]
scripts/printer.py
WIGGITYWHAT/Island_MST
0
88976
<gh_stars>0 """Define a function that prints a progress bar of percent p completion.""" import sys def print_progress(a, b): """Print a progress bar with %p finished.""" p = float(a) / b toolbar_len = 50 num_done = int(toolbar_len*p) num_remain = toolbar_len - num_done sys.stdout.flush() sys.stdout.write("\r[{}{}] %{} {}/{}".format("="*num_done, " "*num_remain, int(p*100), a, b))
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 3206, 457, 263, 740, 393, 14677, 263, 6728, 2594, 310, 10151, 282, 13285, 1213, 15945, 13, 5215, 10876, 13, 13, 13, 1753, 1596, 29918, 18035, 29898, 29874, 29892, 289, 1125, 13, 1678, 9995, 11816, 263, 6728, 2594, 411, 1273, 29886, 7743, 1213, 15945, 13, 1678, 282, 353, 5785, 29898, 29874, 29897, 847, 289, 13, 1678, 29840, 29918, 2435, 353, 29871, 29945, 29900, 13, 1678, 954, 29918, 15091, 353, 938, 29898, 10154, 1646, 29918, 2435, 29930, 29886, 29897, 13, 1678, 954, 29918, 1745, 475, 353, 29840, 29918, 2435, 448, 954, 29918, 15091, 13, 13, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 1678, 10876, 29889, 25393, 29889, 3539, 14182, 29878, 19660, 1157, 6525, 1273, 8875, 6571, 29914, 8875, 1642, 4830, 703, 543, 29930, 1949, 29918, 15091, 29892, 13, 462, 268, 376, 26345, 1949, 29918, 1745, 475, 29892, 938, 29898, 29886, 29930, 29896, 29900, 29900, 511, 263, 29892, 289, 876, 13, 2 ]
code/src/main.py
ChaofWang/AWSRN
162
35359
<filename>code/src/main.py<gh_stars>100-1000 import torch import utility import data import model import loss from option import args from trainer import Trainer def print_network(net): num_params = 0 for param in net.parameters(): num_params += param.numel() print(net) print('Total number of parameters: %d' % num_params) def print_setting(net, args): print('init this train:') print_network(net) print('training model:', args.model) print('scale:', args.scale) print('resume from ', args.resume) print('output patch size', args.patch_size) print('model setting: n_resblocks:', args.n_resblocks, 'n_feats:', args.n_feats, 'block_feats:', args.block_feats) print('optimization setting: ', args.optimizer) print('total epochs:', args.epochs) print('lr:', args.lr, 'lr_decay at:', args.decay_type, 'decay gamma:', args.gamma) print('train loss:', args.loss) print('save_name:', args.save) torch.manual_seed(args.seed) checkpoint = utility.checkpoint(args) if checkpoint.ok: loader = data.Data(args) model = model.Model(args, checkpoint) print_setting(model, args) loss = loss.Loss(args, checkpoint) if not args.test_only else None t = Trainer(args, loader, model, loss, checkpoint) while not t.terminate(): t.train() t.test() checkpoint.done()
[ 1, 529, 9507, 29958, 401, 29914, 4351, 29914, 3396, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 5215, 4842, 305, 13, 13, 5215, 19725, 13, 5215, 848, 13, 5215, 1904, 13, 5215, 6410, 13, 3166, 2984, 1053, 6389, 13, 3166, 1020, 4983, 1053, 3201, 4983, 13, 13, 1753, 1596, 29918, 11618, 29898, 1212, 1125, 13, 1678, 954, 29918, 7529, 353, 29871, 29900, 13, 1678, 363, 1828, 297, 7787, 29889, 16744, 7295, 13, 4706, 954, 29918, 7529, 4619, 1828, 29889, 1949, 295, 580, 13, 1678, 1596, 29898, 1212, 29897, 13, 1678, 1596, 877, 11536, 1353, 310, 4128, 29901, 1273, 29881, 29915, 1273, 954, 29918, 7529, 29897, 13, 13, 13, 1753, 1596, 29918, 26740, 29898, 1212, 29892, 6389, 1125, 13, 268, 1596, 877, 2344, 445, 7945, 29901, 1495, 13, 268, 1596, 29918, 11618, 29898, 1212, 29897, 13, 268, 1596, 877, 26495, 1904, 29901, 742, 6389, 29889, 4299, 29897, 13, 268, 1596, 877, 7052, 29901, 742, 6389, 29889, 7052, 29897, 13, 268, 1596, 877, 690, 2017, 515, 13420, 6389, 29889, 690, 2017, 29897, 13, 268, 1596, 877, 4905, 13261, 2159, 742, 6389, 29889, 5041, 29918, 2311, 29897, 13, 268, 1596, 877, 4299, 4444, 29901, 302, 29918, 690, 1271, 29879, 29901, 742, 6389, 29889, 29876, 29918, 690, 1271, 29879, 29892, 13, 4706, 525, 29876, 29918, 1725, 1446, 29901, 742, 6389, 29889, 29876, 29918, 1725, 1446, 29892, 525, 1271, 29918, 1725, 1446, 29901, 742, 6389, 29889, 1271, 29918, 1725, 1446, 29897, 13, 268, 1596, 877, 20640, 2133, 4444, 29901, 13420, 6389, 29889, 20640, 3950, 29897, 13, 268, 1596, 877, 7827, 21502, 12168, 29901, 742, 6389, 29889, 1022, 2878, 29879, 29897, 13, 268, 1596, 877, 29212, 29901, 742, 6389, 29889, 29212, 29892, 525, 29212, 29918, 7099, 388, 472, 29901, 742, 6389, 29889, 7099, 388, 29918, 1853, 29892, 525, 7099, 388, 330, 2735, 29901, 742, 6389, 29889, 4283, 29897, 13, 268, 1596, 877, 14968, 6410, 29901, 742, 6389, 29889, 6758, 29897, 13, 268, 1596, 877, 7620, 29918, 978, 29901, 742, 6389, 29889, 7620, 29897, 13, 13, 7345, 305, 29889, 11288, 29918, 26776, 29898, 5085, 29889, 26776, 29897, 13, 3198, 3149, 353, 19725, 29889, 3198, 3149, 29898, 5085, 29897, 13, 13, 361, 1423, 3149, 29889, 554, 29901, 13, 1678, 23466, 353, 848, 29889, 1469, 29898, 5085, 29897, 13, 1678, 1904, 353, 1904, 29889, 3195, 29898, 5085, 29892, 1423, 3149, 29897, 13, 1678, 1596, 29918, 26740, 29898, 4299, 29892, 6389, 29897, 13, 1678, 6410, 353, 6410, 29889, 29931, 2209, 29898, 5085, 29892, 1423, 3149, 29897, 565, 451, 6389, 29889, 1688, 29918, 6194, 1683, 6213, 13, 1678, 260, 353, 3201, 4983, 29898, 5085, 29892, 23466, 29892, 1904, 29892, 6410, 29892, 1423, 3149, 29897, 13, 1678, 1550, 451, 260, 29889, 18821, 403, 7295, 13, 4706, 260, 29889, 14968, 580, 13, 4706, 260, 29889, 1688, 580, 13, 13, 1678, 1423, 3149, 29889, 15091, 580, 13, 13, 2 ]
tests/test_cif_io.py
dkratzert/FinalCif
13
142169
import unittest from pathlib import Path from cif.cif_file_io import CifContainer from tests.test_utils import current_file_path class CifFileCRCTestCase(unittest.TestCase): def setUp(self) -> None: current_file_path() self.cif = CifContainer(Path('tests/examples/1979688.cif')) def test_calc_crc(self): self.assertEqual(20714, self.cif.calc_checksum(self.cif['_shelx_hkl_file'])) class CifFileCRClargerTestCase(unittest.TestCase): def setUp(self) -> None: current_file_path() self.cif = CifContainer(Path('test-data/DK_Zucker2_0m.cif')) def test_calc_crc(self): self.assertEqual(26780, self.cif.calc_checksum(self.cif['_shelx_hkl_file'])) class CifFileTestCase(unittest.TestCase): def setUp(self) -> None: current_file_path() self.cif = CifContainer(Path('tests/examples/1979688.cif')) def test_calc_crc(self): self.assertEqual(3583, self.cif.calc_checksum('hello world')) def test_res_crc(self): self.assertEqual(17612, self.cif.res_checksum_calcd) def test_hkl_crc(self): self.assertEqual(20714, self.cif.hkl_checksum_calcd) def test_res_crc_without_res(self): self.assertEqual(0, CifContainer(Path('test-data/1000006.cif')).res_checksum_calcd) def test_get_unknown_value_from_key(self): self.assertEqual('', self.cif['_chemical_melting_point']) def test_get_known_value_from_key(self): self.assertEqual('702.70', self.cif['_chemical_formula_weight']) def test_get_spgr(self): self.assertEqual('P 21 21 2', self.cif.space_group) def test_symmops(self): self.assertEqual(['x, y, z', '-x, -y, z', '-x+1/2, y+1/2, -z', 'x+1/2, -y+1/2, -z'], self.cif.symmops) def test_symmops_from_spgr(self): self.assertEqual(['x,y,z', '-x,-y,z', 'x+1/2,-y+1/2,-z', '-x+1/2,y+1/2,-z'], self.cif.symmops_from_spgr) def test_centrosymm(self): self.assertEqual(False, self.cif.is_centrosymm) c = CifContainer(Path('test-data/DK_ML7-66-final.cif')) self.assertEqual(True, c.is_centrosymm) def test_ishydrogen(self): self.assertEqual(True, self.cif.ishydrogen('H18a')) self.assertEqual(True, self.cif.ishydrogen('H18A')) self.assertEqual(False, self.cif.ishydrogen('C2')) self.assertEqual(False, self.cif.ishydrogen('c2')) def test_cell(self): expected = [round(x, 8) for x in (19.678, 37.02290000000001, 4.772, 90.0, 90.0, 90.0, 3476.576780226401)] actual = [round(y, 8) for y in self.cif.cell] self.assertEqual(expected, actual) def test_natoms(self): self.assertEqual(94, self.cif.natoms()) self.assertEqual(52, self.cif.natoms(without_h=True)) def test_checksum_tests(self): self.assertEqual(True, self.cif.test_hkl_checksum()) self.assertEqual(True, self.cif.test_res_checksum()) def test_checksum_test_without_checksum(self): self.assertEqual(True, CifContainer('test-data/1000006.cif').test_res_checksum()) self.assertEqual(True, CifContainer('test-data/1000006.cif').test_hkl_checksum()) if __name__ == '__main__': unittest.main()
[ 1, 1053, 443, 27958, 13, 3166, 2224, 1982, 1053, 10802, 13, 13, 3166, 274, 361, 29889, 29883, 361, 29918, 1445, 29918, 601, 1053, 315, 361, 7895, 13, 3166, 6987, 29889, 1688, 29918, 13239, 1053, 1857, 29918, 1445, 29918, 2084, 13, 13, 13, 1990, 315, 361, 2283, 11341, 1783, 342, 8259, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1857, 29918, 1445, 29918, 2084, 580, 13, 4706, 1583, 29889, 29883, 361, 353, 315, 361, 7895, 29898, 2605, 877, 21150, 29914, 19057, 29914, 29896, 29929, 29955, 29929, 29953, 29947, 29947, 29889, 29883, 361, 8785, 13, 13, 1678, 822, 1243, 29918, 28667, 29918, 29883, 2214, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29906, 29900, 29955, 29896, 29946, 29892, 1583, 29889, 29883, 361, 29889, 28667, 29918, 3198, 2083, 29898, 1311, 29889, 29883, 361, 1839, 29918, 845, 295, 29916, 29918, 29882, 6321, 29918, 1445, 25901, 13, 13, 13, 1990, 315, 361, 2283, 29907, 10363, 4675, 914, 3057, 8259, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1857, 29918, 1445, 29918, 2084, 580, 13, 4706, 1583, 29889, 29883, 361, 353, 315, 361, 7895, 29898, 2605, 877, 1688, 29899, 1272, 29914, 17359, 29918, 29999, 29583, 29906, 29918, 29900, 29885, 29889, 29883, 361, 8785, 13, 13, 1678, 822, 1243, 29918, 28667, 29918, 29883, 2214, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29906, 29953, 29955, 29947, 29900, 29892, 1583, 29889, 29883, 361, 29889, 28667, 29918, 3198, 2083, 29898, 1311, 29889, 29883, 361, 1839, 29918, 845, 295, 29916, 29918, 29882, 6321, 29918, 1445, 25901, 13, 13, 13, 1990, 315, 361, 2283, 3057, 8259, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1857, 29918, 1445, 29918, 2084, 580, 13, 4706, 1583, 29889, 29883, 361, 353, 315, 361, 7895, 29898, 2605, 877, 21150, 29914, 19057, 29914, 29896, 29929, 29955, 29929, 29953, 29947, 29947, 29889, 29883, 361, 8785, 13, 13, 1678, 822, 1243, 29918, 28667, 29918, 29883, 2214, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29941, 29945, 29947, 29941, 29892, 1583, 29889, 29883, 361, 29889, 28667, 29918, 3198, 2083, 877, 12199, 3186, 8785, 13, 13, 1678, 822, 1243, 29918, 690, 29918, 29883, 2214, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29896, 29955, 29953, 29896, 29906, 29892, 1583, 29889, 29883, 361, 29889, 690, 29918, 3198, 2083, 29918, 1052, 2252, 29897, 13, 13, 1678, 822, 1243, 29918, 29882, 6321, 29918, 29883, 2214, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29906, 29900, 29955, 29896, 29946, 29892, 1583, 29889, 29883, 361, 29889, 29882, 6321, 29918, 3198, 2083, 29918, 1052, 2252, 29897, 13, 13, 1678, 822, 1243, 29918, 690, 29918, 29883, 2214, 29918, 14037, 29918, 690, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 315, 361, 7895, 29898, 2605, 877, 1688, 29899, 1272, 29914, 29896, 29900, 29900, 29900, 29900, 29900, 29953, 29889, 29883, 361, 1495, 467, 690, 29918, 3198, 2083, 29918, 1052, 2252, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 26690, 29918, 1767, 29918, 3166, 29918, 1989, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 742, 1583, 29889, 29883, 361, 1839, 29918, 14969, 936, 29918, 12873, 1259, 29918, 3149, 11287, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 5203, 29918, 1767, 29918, 3166, 29918, 1989, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29955, 29900, 29906, 29889, 29955, 29900, 742, 1583, 29889, 29883, 361, 1839, 29918, 14969, 936, 29918, 689, 2497, 29918, 7915, 11287, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 1028, 629, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29925, 29871, 29906, 29896, 29871, 29906, 29896, 29871, 29906, 742, 1583, 29889, 29883, 361, 29889, 3493, 29918, 2972, 29897, 13, 13, 1678, 822, 1243, 29918, 11967, 29885, 3554, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 18959, 29916, 29892, 343, 29892, 503, 742, 17411, 29916, 29892, 448, 29891, 29892, 503, 742, 17411, 29916, 29974, 29896, 29914, 29906, 29892, 343, 29974, 29896, 29914, 29906, 29892, 448, 29920, 742, 525, 29916, 29974, 29896, 29914, 29906, 29892, 448, 29891, 29974, 29896, 29914, 29906, 29892, 448, 29920, 7464, 1583, 29889, 29883, 361, 29889, 11967, 29885, 3554, 29897, 13, 13, 1678, 822, 1243, 29918, 11967, 29885, 3554, 29918, 3166, 29918, 1028, 629, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 18959, 29916, 29892, 29891, 29892, 29920, 742, 17411, 29916, 6653, 29891, 29892, 29920, 742, 525, 29916, 29974, 29896, 29914, 29906, 6653, 29891, 29974, 29896, 29914, 29906, 6653, 29920, 742, 17411, 29916, 29974, 29896, 29914, 29906, 29892, 29891, 29974, 29896, 29914, 29906, 6653, 29920, 7464, 1583, 29889, 29883, 361, 29889, 11967, 29885, 3554, 29918, 3166, 29918, 1028, 629, 29897, 13, 13, 1678, 822, 1243, 29918, 1760, 1883, 962, 29885, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 8824, 29892, 1583, 29889, 29883, 361, 29889, 275, 29918, 1760, 1883, 962, 29885, 29897, 13, 4706, 274, 353, 315, 361, 7895, 29898, 2605, 877, 1688, 29899, 1272, 29914, 17359, 29918, 1988, 29955, 29899, 29953, 29953, 29899, 8394, 29889, 29883, 361, 8785, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5574, 29892, 274, 29889, 275, 29918, 1760, 1883, 962, 29885, 29897, 13, 13, 1678, 822, 1243, 29918, 728, 11279, 1885, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5574, 29892, 1583, 29889, 29883, 361, 29889, 728, 11279, 1885, 877, 29950, 29896, 29947, 29874, 8785, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5574, 29892, 1583, 29889, 29883, 361, 29889, 728, 11279, 1885, 877, 29950, 29896, 29947, 29909, 8785, 13, 4706, 1583, 29889, 9294, 9843, 29898, 8824, 29892, 1583, 29889, 29883, 361, 29889, 728, 11279, 1885, 877, 29907, 29906, 8785, 13, 4706, 1583, 29889, 9294, 9843, 29898, 8824, 29892, 1583, 29889, 29883, 361, 29889, 728, 11279, 1885, 877, 29883, 29906, 8785, 13, 13, 1678, 822, 1243, 29918, 3729, 29898, 1311, 1125, 13, 4706, 3806, 353, 518, 14486, 29898, 29916, 29892, 29871, 29947, 29897, 363, 921, 297, 313, 29896, 29929, 29889, 29953, 29955, 29947, 29892, 29871, 29941, 29955, 29889, 29900, 29906, 29906, 29929, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29896, 29892, 29871, 29946, 29889, 29955, 29955, 29906, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 29871, 29941, 29946, 29955, 29953, 29889, 29945, 29955, 29953, 29955, 29947, 29900, 29906, 29906, 29953, 29946, 29900, 29896, 4638, 13, 4706, 3935, 353, 518, 14486, 29898, 29891, 29892, 29871, 29947, 29897, 363, 343, 297, 1583, 29889, 29883, 361, 29889, 3729, 29962, 13, 4706, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29897, 13, 13, 1678, 822, 1243, 29918, 8924, 4835, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29929, 29946, 29892, 1583, 29889, 29883, 361, 29889, 8924, 4835, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29945, 29906, 29892, 1583, 29889, 29883, 361, 29889, 8924, 4835, 29898, 14037, 29918, 29882, 29922, 5574, 876, 13, 13, 1678, 822, 1243, 29918, 3198, 2083, 29918, 21150, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5574, 29892, 1583, 29889, 29883, 361, 29889, 1688, 29918, 29882, 6321, 29918, 3198, 2083, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5574, 29892, 1583, 29889, 29883, 361, 29889, 1688, 29918, 690, 29918, 3198, 2083, 3101, 13, 13, 1678, 822, 1243, 29918, 3198, 2083, 29918, 1688, 29918, 14037, 29918, 3198, 2083, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5574, 29892, 315, 361, 7895, 877, 1688, 29899, 1272, 29914, 29896, 29900, 29900, 29900, 29900, 29900, 29953, 29889, 29883, 361, 2824, 1688, 29918, 690, 29918, 3198, 2083, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5574, 29892, 315, 361, 7895, 877, 1688, 29899, 1272, 29914, 29896, 29900, 29900, 29900, 29900, 29900, 29953, 29889, 29883, 361, 2824, 1688, 29918, 29882, 6321, 29918, 3198, 2083, 3101, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
mvt/datasets/detection2ds/__init__.py
JackMing1986/MultipleVsiualTasks
2
196826
<reponame>JackMing1986/MultipleVsiualTasks from .det_base import DetBaseDataset from .voc import VOCDataset from .coco import CocoDataset from .det_retail import DetRetailDataset from .det_retail_one import DetRetailOneDataset __all__ = [ "DetBaseDataset", "VOCDataset", "CocoDataset", "DetRetailDataset", "DetRetailOneDataset", ]
[ 1, 529, 276, 1112, 420, 29958, 27006, 29924, 292, 29896, 29929, 29947, 29953, 29914, 15329, 552, 29963, 1039, 950, 26249, 13, 3166, 869, 4801, 29918, 3188, 1053, 5953, 5160, 16390, 24541, 13, 3166, 869, 29894, 542, 1053, 478, 29949, 6530, 271, 24541, 13, 3166, 869, 29883, 6235, 1053, 315, 6235, 16390, 24541, 13, 3166, 869, 4801, 29918, 2267, 737, 1053, 5953, 8015, 737, 16390, 24541, 13, 3166, 869, 4801, 29918, 2267, 737, 29918, 650, 1053, 5953, 8015, 737, 6716, 16390, 24541, 13, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 376, 6362, 5160, 16390, 24541, 613, 13, 1678, 376, 24898, 6530, 271, 24541, 613, 13, 1678, 376, 29907, 6235, 16390, 24541, 613, 13, 1678, 376, 6362, 8015, 737, 16390, 24541, 613, 13, 1678, 376, 6362, 8015, 737, 6716, 16390, 24541, 613, 13, 29962, 13, 2 ]
config.py
Maziar110/nostratheus
1
180036
# This dictionary is to define metrics that we should extract data from and then # their exposed name as predicted metric metrics = { 'actual_metric_name1': 'actual_metric_name1_predict', 'actual_metric_name2': 'actual_metric_name2_predict' } # prom_url = 'http://localhost/' expose_port = 8000 # interval in days interval = 30 # chunk size in hour chunk_size = 24
[ 1, 396, 910, 8600, 338, 304, 4529, 21556, 393, 591, 881, 6597, 848, 515, 322, 769, 13, 29937, 1678, 1009, 19884, 1024, 408, 25383, 12714, 13, 2527, 10817, 353, 426, 13, 1678, 525, 19304, 29918, 16414, 29918, 978, 29896, 2396, 525, 19304, 29918, 16414, 29918, 978, 29896, 29918, 27711, 742, 13, 1678, 525, 19304, 29918, 16414, 29918, 978, 29906, 2396, 525, 19304, 29918, 16414, 29918, 978, 29906, 29918, 27711, 29915, 13, 29913, 13, 29937, 13, 14032, 29918, 2271, 353, 525, 1124, 597, 7640, 22208, 13, 735, 4220, 29918, 637, 353, 29871, 29947, 29900, 29900, 29900, 13, 29937, 7292, 297, 3841, 13, 19207, 353, 29871, 29941, 29900, 13, 29937, 19875, 2159, 297, 7234, 13, 29812, 29918, 2311, 353, 29871, 29906, 29946, 2 ]
train/train.py
sjtu-tcloud/Tiny-OFA
0
38863
<reponame>sjtu-tcloud/Tiny-OFA import argparse import torch.distributed as dist import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler import test # import test.py to get mAP after each epoch from models import * from utils.dataset import * from utils.utils import * from mymodel import * wdir = 'weights' + os.sep # weights dir last = wdir + 'last.pt' best = wdir + 'best.pt' test_best = wdir + 'test_best.pt' results_file = 'results.txt' # Hyperparameters (results68: 59.9 [email protected] yolov3-spp-416) https://github.com/ultralytics/yolov3/issues/310 hyp = {'giou': 3.54, # giou loss gain 'cls': 37.4, # cls loss gain 'cls_pw': 1.0, # cls BCELoss positive_weight 'obj': 64.3, # obj loss gain (*=img_size/320 if img_size != 320) 'obj_pw': 1.0, # obj BCELoss positive_weight 'iou_t': 0.225, # iou training threshold 'lr0': 0.01, # initial learning rate (SGD=5E-3, Adam=5E-4) 'lrf': -4., # final LambdaLR learning rate = lr0 * (10 ** lrf) 'momentum': 0.937, # SGD momentum 'weight_decay': 0.000484, # optimizer weight decay 'fl_gamma': 0.5, # focal loss gamma 'hsv_h': 0.0138, # image HSV-Hue augmentation (fraction) 'hsv_s': 0.678, # image HSV-Saturation augmentation (fraction) 'hsv_v': 0.36, # image HSV-Value augmentation (fraction) 'degrees': 1.98, # image rotation (+/- deg) 'translate': 0.05, # image translation (+/- fraction) 'scale': 0.05, # image scale (+/- gain) 'shear': 0.641} # image shear (+/- deg) # Overwrite hyp with hyp*.txt (optional) f = glob.glob('hyp*.txt') if f: print('Using %s' % f[0]) for k, v in zip(hyp.keys(), np.loadtxt(f[0])): hyp[k] = v def train(): cfg = opt.cfg data = opt.data img_size, img_size_test = opt.img_size if len(opt.img_size) == 2 else opt.img_size * 2 # train, test sizes epochs = opt.epochs # 500200 batches at bs 64, 117263 images = 273 epochs batch_size = opt.batch_size accumulate = opt.accumulate # effective bs = batch_size * accumulate = 16 * 4 = 64 weights = opt.weights # initial training weights # Initialize init_seeds() if opt.multi_scale: img_sz_min = round(img_size / 32 / 1.5) img_sz_max = round(img_size / 32* 1.5) img_size = img_sz_max * 32 # initiate with maximum multi_scale size print('Using multi-scale %g - %g' % (img_sz_min * 32, img_size)) # Configure run # data_dict = parse_data_cfg(data) train_path = '../data/data_training' test_path = '../data/data_test' nc = 1 # Remove previous results for f in glob.glob('*_batch*.png') + glob.glob(results_file): os.remove(f) # Initialize model # model = Darknet(cfg, arc=opt.arc).to(device) # model = UltraNetFloat640().to(device) # model = TempNet().to(device) # model = TempNetDW().to(device) # model = TempNetQua().to(device) # model = SqueezeNetQua().to(device) # model = UltraNet().to(device) model = TinyUltraNet().to(device) # Optimizer pg0, pg1, pg2 = [], [], [] # optimizer parameter groups for k, v in dict(model.named_parameters()).items(): if '.bias' in k: pg2 += [v] # biases elif 'Conv2d.weight' in k: pg1 += [v] # apply weight_decay else: pg0 += [v] # all else if opt.adam: # hyp['lr0'] *= 0.1 # reduce lr (i.e. SGD=5E-3, Adam=5E-4) optimizer = optim.Adam(pg0, lr=hyp['lr0']) # optimizer = AdaBound(pg0, lr=hyp['lr0'], final_lr=0.1) else: optimizer = optim.SGD(pg0, lr=hyp['lr0'], momentum=hyp['momentum'], nesterov=True) optimizer.add_param_group({'params': pg1, 'weight_decay': hyp['weight_decay']}) # add pg1 with weight_decay optimizer.add_param_group({'params': pg2}) # add pg2 (biases) optimizer.param_groups[2]['lr'] *= 2.0 # bias lr del pg0, pg1, pg2 start_epoch = 0 best_fitness = 0.0 test_best_iou = 0.0 # attempt_download(weights) # 加载权重 if weights.endswith('.pt'): # pytorch format # possible weights are '*.pt', 'yolov3-spp.pt', 'yolov3-tiny.pt' etc. chkpt = torch.load(weights, map_location=device) # load model try: chkpt['model'] = {k: v for k, v in chkpt['model'].items() if model.state_dict()[k].numel() == v.numel()} model.load_state_dict(chkpt['model'], strict=False) except KeyError as e: s = "%s is not compatible with %s. Specify --weights '' or specify a --cfg compatible with %s. " % (opt.weights, opt.cfg, opt.weights) raise KeyError(s) from e # load optimizer if chkpt['optimizer'] is not None: optimizer.load_state_dict(chkpt['optimizer']) best_fitness = chkpt['best_fitness'] # load results if chkpt.get('training_results') is not None: with open(results_file, 'w') as file: file.write(chkpt['training_results']) # write results.txt start_epoch = chkpt['epoch'] + 1 del chkpt elif len(weights) > 0: # darknet format # possible weights are '*.weights', 'yolov3-tiny.conv.15', 'darknet53.conv.74' etc. load_darknet_weights(model, weights) # Scheduler https://github.com/ultralytics/yolov3/issues/238 # lf = lambda x: 1 - x / epochs # linear ramp to zero # lf = lambda x: 10 ** (hyp['lrf'] * x / epochs) # exp ramp # lf = lambda x: 1 - 10 ** (hyp['lrf'] * (1 - x / epochs)) # inverse exp ramp lf = lambda x: (1 + math.cos(x * math.pi / epochs)) / 2 * 0.99 + 0.01 # cosine https://arxiv.org/pdf/1812.01187.pdf scheduler = lr_scheduler.LambdaLR(optimizer, lr_lambda=lf) # scheduler = lr_scheduler.MultiStepLR(optimizer, milestones=[round(epochs * x) for x in [0.8, 0.9]], gamma=0.1) scheduler.last_epoch = start_epoch # # Plot lr schedule # y = [] # for _ in range(epochs): # scheduler.step() # y.append(optimizer.param_groups[0]['lr']) # plt.plot(y, '.-', label='LambdaLR') # plt.xlabel('epoch') # plt.ylabel('LR') # plt.tight_layout() # plt.savefig('LR.png', dpi=300) # Initialize distributed training if device.type != 'cpu' and torch.cuda.device_count() > 1 and torch.distributed.is_available(): dist.init_process_group(backend='nccl', # 'distributed backend' init_method='tcp://127.0.0.1:9999', # distributed training init method world_size=1, # number of nodes for distributed training rank=0) # distributed training node rank model = torch.nn.parallel.DistributedDataParallel(model, find_unused_parameters=True) model.yolo_layers = model.module.yolo_layers # move yolo layer indices to top level # Dataset dataset = LoadImagesAndLabels(train_path, img_size, batch_size, augment=True, hyp=hyp, # augmentation hyperparameters rect=opt.rect, # rectangular training cache_images=opt.cache_images, single_cls=opt.single_cls) # Dataloader batch_size = min(batch_size, len(dataset)) nw = min([os.cpu_count(), batch_size if batch_size > 1 else 0, 8]) # number of workers dataloader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, num_workers=nw, shuffle=not opt.rect, # Shuffle=True unless rectangular training is used pin_memory=True, collate_fn=dataset.collate_fn) # Testloader testloader = torch.utils.data.DataLoader(LoadImagesAndLabels(test_path, img_size_test, batch_size * 2, hyp=hyp, rect=False, cache_images=opt.cache_images, single_cls=opt.single_cls), batch_size=batch_size * 2, num_workers=nw, pin_memory=True, collate_fn=dataset.collate_fn) # Start training nb = len(dataloader) prebias = start_epoch == 0 model.nc = nc # attach number of classes to model model.arc = opt.arc # attach yolo architecture model.hyp = hyp # attach hyperparameters to model model.class_weights = labels_to_class_weights(dataset.labels, nc).to(device) # attach class weights maps = np.zeros(nc) # mAP per class # torch.autograd.set_detect_anomaly(True) results = (0, 0, 0, 0, 0, 0, 0) # 'P', 'R', 'mAP', 'F1', 'val GIoU', 'val Objectness', 'val Classification' t0 = time.time() torch_utils.model_info(model, report='summary') # 'full' or 'summary' print('Using %g dataloader workers' % nw) print('Starting training for %g epochs...' % epochs) for epoch in range(start_epoch, epochs): # epoch ------------------------------------------------------------------ model.train() model.gr = 1 - (1 + math.cos(min(epoch * 2, epochs) * math.pi / epochs)) / 2 # GIoU <-> 1.0 loss ratio # Prebias if prebias: ne = max(round(30 / nb), 3) # number of prebias epochs ps = np.interp(epoch, [0, ne], [0.1, hyp['lr0'] * 2]), \ np.interp(epoch, [0, ne], [0.9, hyp['momentum']]) # prebias settings (lr=0.1, momentum=0.9) if epoch == ne: # print_model_biases(model) prebias = False # Bias optimizer settings optimizer.param_groups[2]['lr'] = ps[0] if optimizer.param_groups[2].get('momentum') is not None: # for SGD but not Adam optimizer.param_groups[2]['momentum'] = ps[1] mloss = torch.zeros(4).to(device) # mean losses print(('\n' + '%10s' * 8) % ('Epoch', 'gpu_mem', 'GIoU', 'obj', 'cls', 'total', 'targets', 'img_size')) pbar = tqdm(enumerate(dataloader), total=nb) # progress bar for i, (imgs, targets, paths, _) in pbar: # batch ------------------------------------------------------------- ni = i + nb * epoch # number integrated batches (since train start) imgs = imgs.to(device).float() / 255.0 # uint8 to float32, 0 - 255 to 0.0 - 1.0 targets = targets.to(device) # Plot images with bounding boxes if ni < 1: f = 'train_batch%g.png' % i # filename plot_images(imgs=imgs, targets=targets, paths=paths, fname=f) if tb_writer: tb_writer.add_image(f, cv2.imread(f)[:, :, ::-1], dataformats='HWC') # Multi-Scale training if opt.multi_scale: if ni / accumulate % 1 == 0: # adjust img_size (67% - 150%) every 1 batch img_size = random.randrange(img_sz_min, img_sz_max + 1) * 32 sf = img_size / max(imgs.shape[2:]) # scale factor if sf != 1: ns = [math.ceil(x * sf / 32.) * 32 for x in imgs.shape[2:]] # new shape (stretched to 16-multiple) imgs = F.interpolate(imgs, size=ns, mode='bilinear', align_corners=False) # Run model pred = model(imgs) # Compute loss loss, loss_items = compute_loss(pred, targets, model) if not torch.isfinite(loss): print('WARNING: non-finite loss, ending training ', loss_items) return results # Scale loss by nominal batch_size of 64 loss *= batch_size / 64 loss.backward() # Optimize accumulated gradient if ni % accumulate == 0: optimizer.step() optimizer.zero_grad() # Print batch results mloss = (mloss * i + loss_items) / (i + 1) # update mean losses mem = '%.3gG' % (torch.cuda.memory_cached() / 1E9 if torch.cuda.is_available() else 0) # (GB) s = ('%10s' * 2 + '%10.3g' * 6) % ('%g/%g' % (epoch, epochs - 1), mem, *mloss, len(targets), img_size) pbar.set_description(s) # end batch ------------------------------------------------------------------------------------------------ # Update scheduler scheduler.step() # Process epoch results final_epoch = epoch + 1 == epochs if not opt.notest or final_epoch: # Calculate mAP is_coco = any([x in data for x in ['coco.data', 'coco2014.data', 'coco2017.data']]) and model.nc == 80 results = test.test(cfg, data, batch_size=batch_size * 2, img_size=img_size_test, model=model, conf_thres=0.001, # 0.001 if opt.evolve or (final_epoch and is_coco) else 0.01, iou_thres=0.6, save_json=final_epoch and is_coco, single_cls=opt.single_cls, dataloader=testloader) # Write epoch results with open(results_file, 'a') as f: f.write(s + '%10.3g' * len(results) % results + '\n') # P, R, mAP, F1, test_losses=(GIoU, obj, cls) if len(opt.name) and opt.bucket: os.system('gsutil cp results.txt gs://%s/results/results%s.txt' % (opt.bucket, opt.name)) # Write Tensorboard results if tb_writer: x = list(mloss) + list(results) titles = ['GIoU', 'Objectness', 'Classification', 'Train loss', 'iou', 'loss', 'Giou loss', 'obj loss'] for xi, title in zip(x, titles): tb_writer.add_scalar(title, xi, epoch) # Update best mAP fi = fitness(np.array(results).reshape(1, -1)) # fitness_i = weighted combination of [P, R, mAP, F1] if fi > best_fitness: best_fitness = fi test_iou = results[0] if test_iou > test_best_iou: test_best_iou = test_iou # Save training results save = (not opt.nosave) or (final_epoch and not opt.evolve) if save: with open(results_file, 'r') as f: # Create checkpoint chkpt = {'epoch': epoch, 'best_fitness': best_fitness, 'training_results': f.read(), 'model': model.module.state_dict() if type( model) is nn.parallel.DistributedDataParallel else model.state_dict(), 'optimizer': None if final_epoch else optimizer.state_dict()} # Save last checkpoint torch.save(chkpt, last) # Save best checkpoint if best_fitness == fi: torch.save(chkpt, best) if test_iou == test_best_iou: torch.save(chkpt, test_best) # Save backup every 10 epochs (optional) # if epoch > 0 and epoch % 10 == 0: # torch.save(chkpt, wdir + 'backup%g.pt' % epoch) # Delete checkpoint del chkpt # end epoch ---------------------------------------------------------------------------------------------------- # end training n = opt.name if len(n): n = '_' + n if not n.isnumeric() else n fresults, flast, fbest = 'results%s.txt' % n, 'last%s.pt' % n, 'best%s.pt' % n os.rename('results.txt', fresults) os.rename(wdir + 'last.pt', wdir + flast) if os.path.exists(wdir + 'last.pt') else None os.rename(wdir + 'best.pt', wdir + fbest) if os.path.exists(wdir + 'best.pt') else None if opt.bucket: # save to cloud os.system('gsutil cp %s gs://%s/results' % (fresults, opt.bucket)) os.system('gsutil cp %s gs://%s/weights' % (wdir + flast, opt.bucket)) # os.system('gsutil cp %s gs://%s/weights' % (wdir + fbest, opt.bucket)) if not opt.evolve: plot_results() # save as results.png print('%g epochs completed in %.3f hours.\n' % (epoch - start_epoch + 1, (time.time() - t0) / 3600)) dist.destroy_process_group() if torch.cuda.device_count() > 1 else None torch.cuda.empty_cache() return results if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--epochs', type=int, default=500) # 500200 batches at bs 16, 117263 COCO images = 273 epochs parser.add_argument('--batch-size', type=int, default=16) # effective bs = batch_size * accumulate = 16 * 4 = 64 parser.add_argument('--accumulate', type=int, default=4, help='batches to accumulate before optimizing') parser.add_argument('--cfg', type=str, default='cfg/yolov3-tiny-1cls_1.cfg', help='*.cfg path') parser.add_argument('--data', type=str, default='data/coco2017.data', help='*.data path') parser.add_argument('--multi-scale', action='store_true', help='adjust (67% - 150%) img_size every 10 batches') parser.add_argument('--img-size', nargs='+', type=int, default=[320], help='train and test image-sizes') parser.add_argument('--rect', action='store_true', help='rectangular training') parser.add_argument('--resume', action='store_true', help='resume training from last.pt') parser.add_argument('--nosave', action='store_true', help='only save final checkpoint') parser.add_argument('--notest', action='store_true', help='only test final epoch') parser.add_argument('--evolve', action='store_true', help='evolve hyperparameters') parser.add_argument('--bucket', type=str, default='', help='gsutil bucket') parser.add_argument('--cache-images', action='store_true', help='cache images for faster training') parser.add_argument('--weights', type=str, default='', help='initial weights path') parser.add_argument('--arc', type=str, default='default', help='yolo architecture') # default, uCE, uBCE parser.add_argument('--name', default='', help='renames results.txt to results_name.txt if supplied') parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1 or cpu)') parser.add_argument('--adam', action='store_true', help='use adam optimizer') parser.add_argument('--single-cls', action='store_true', help='train as single-class dataset') parser.add_argument('--var', type=float, help='debug variable') opt = parser.parse_args() opt.weights = last if opt.resume else opt.weights print(opt) device = torch_utils.select_device(opt.device, batch_size=opt.batch_size) # scale hyp['obj'] by img_size (evolved at 320) # hyp['obj'] *= opt.img_size[0] / 320. tb_writer = None if not opt.evolve: # Train normally try: # Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/ from torch.utils.tensorboard import SummaryWriter tb_writer = SummaryWriter() except: pass train() # train normally else: # Evolve hyperparameters (optional) opt.notest, opt.nosave = True, True # only test/save final epoch if opt.bucket: os.system('gsutil cp gs://%s/evolve.txt .' % opt.bucket) # download evolve.txt if exists for _ in range(1): # generations to evolve if os.path.exists('evolve.txt'): # if evolve.txt exists: select best hyps and mutate # Select parent(s) parent = 'single' # parent selection method: 'single' or 'weighted' x = np.loadtxt('evolve.txt', ndmin=2) n = min(5, len(x)) # number of previous results to consider x = x[np.argsort(-fitness(x))][:n] # top n mutations w = fitness(x) - fitness(x).min() # weights if parent == 'single' or len(x) == 1: # x = x[random.randint(0, n - 1)] # random selection x = x[random.choices(range(n), weights=w)[0]] # weighted selection elif parent == 'weighted': x = (x * w.reshape(n, 1)).sum(0) / w.sum() # weighted combination # Mutate method, mp, s = 3, 0.9, 0.2 # method, mutation probability, sigma npr = np.random npr.seed(int(time.time())) g = np.array([1, 1, 1, 1, 1, 1, 1, 0, .1, 1, 0, 1, 1, 1, 1, 1, 1, 1]) # gains ng = len(g) if method == 1: v = (npr.randn(ng) * npr.random() * g * s + 1) ** 2.0 elif method == 2: v = (npr.randn(ng) * npr.random(ng) * g * s + 1) ** 2.0 elif method == 3: v = np.ones(ng) while all(v == 1): # mutate until a change occurs (prevent duplicates) # v = (g * (npr.random(ng) < mp) * npr.randn(ng) * s + 1) ** 2.0 v = (g * (npr.random(ng) < mp) * npr.randn(ng) * npr.random() * s + 1).clip(0.3, 3.0) for i, k in enumerate(hyp.keys()): # plt.hist(v.ravel(), 300) hyp[k] = x[i + 7] * v[i] # mutate # Clip to limits keys = ['lr0', 'iou_t', 'momentum', 'weight_decay', 'hsv_s', 'hsv_v', 'translate', 'scale', 'fl_gamma'] limits = [(1e-5, 1e-2), (0.00, 0.70), (0.60, 0.98), (0, 0.001), (0, .9), (0, .9), (0, .9), (0, .9), (0, 3)] for k, v in zip(keys, limits): hyp[k] = np.clip(hyp[k], v[0], v[1]) # Train mutation results = train() # Write mutation results print_mutation(hyp, results, opt.bucket) # Plot results # plot_evolution_results(hyp)
[ 1, 529, 276, 1112, 420, 29958, 29879, 29926, 9161, 29899, 29873, 9274, 29914, 29911, 4901, 29899, 29949, 4519, 13, 5215, 1852, 5510, 13, 13, 5215, 4842, 305, 29889, 5721, 7541, 408, 1320, 13, 5215, 4842, 305, 29889, 20640, 408, 5994, 13, 5215, 4842, 305, 29889, 20640, 29889, 29212, 29918, 816, 14952, 408, 301, 29878, 29918, 816, 14952, 13, 13, 5215, 1243, 29871, 396, 1053, 1243, 29889, 2272, 304, 679, 286, 3301, 1156, 1269, 21502, 305, 13, 3166, 4733, 1053, 334, 13, 3166, 3667, 29879, 29889, 24713, 1053, 334, 13, 3166, 3667, 29879, 29889, 13239, 1053, 334, 13, 13, 3166, 590, 4299, 1053, 334, 13, 13, 29893, 3972, 353, 525, 705, 5861, 29915, 718, 2897, 29889, 19570, 29871, 396, 18177, 4516, 13, 4230, 353, 281, 3972, 718, 525, 4230, 29889, 415, 29915, 13, 13318, 353, 281, 3972, 718, 525, 13318, 29889, 415, 29915, 13, 1688, 29918, 13318, 353, 281, 3972, 718, 525, 1688, 29918, 13318, 29889, 415, 29915, 13, 9902, 29918, 1445, 353, 525, 9902, 29889, 3945, 29915, 13, 13, 29937, 26078, 16744, 313, 9902, 29953, 29947, 29901, 29871, 29945, 29929, 29889, 29929, 286, 3301, 29992, 29900, 29889, 29945, 343, 324, 586, 29941, 29899, 29879, 407, 29899, 29946, 29896, 29953, 29897, 2045, 597, 3292, 29889, 510, 29914, 499, 1705, 22026, 29914, 29891, 324, 586, 29941, 29914, 12175, 29914, 29941, 29896, 29900, 13, 13, 29882, 1478, 353, 11117, 3146, 283, 2396, 29871, 29941, 29889, 29945, 29946, 29892, 29871, 396, 4005, 283, 6410, 11581, 13, 539, 525, 25932, 2396, 29871, 29941, 29955, 29889, 29946, 29892, 29871, 396, 1067, 29879, 6410, 11581, 13, 539, 525, 25932, 29918, 29886, 29893, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 396, 1067, 29879, 350, 4741, 29931, 2209, 6374, 29918, 7915, 13, 539, 525, 5415, 2396, 29871, 29953, 29946, 29889, 29941, 29892, 29871, 396, 5446, 6410, 11581, 3070, 29922, 2492, 29918, 2311, 29914, 29941, 29906, 29900, 565, 10153, 29918, 2311, 2804, 29871, 29941, 29906, 29900, 29897, 13, 539, 525, 5415, 29918, 29886, 29893, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 396, 5446, 350, 4741, 29931, 2209, 6374, 29918, 7915, 13, 539, 525, 29875, 283, 29918, 29873, 2396, 29871, 29900, 29889, 29906, 29906, 29945, 29892, 29871, 396, 474, 283, 6694, 16897, 13, 539, 525, 29212, 29900, 2396, 29871, 29900, 29889, 29900, 29896, 29892, 29871, 396, 2847, 6509, 6554, 313, 26016, 29928, 29922, 29945, 29923, 29899, 29941, 29892, 11783, 29922, 29945, 29923, 29899, 29946, 29897, 13, 539, 525, 29880, 9600, 2396, 448, 29946, 1696, 29871, 396, 2186, 365, 2269, 29519, 6509, 6554, 353, 301, 29878, 29900, 334, 313, 29896, 29900, 3579, 301, 9600, 29897, 13, 539, 525, 29885, 2932, 398, 2396, 29871, 29900, 29889, 29929, 29941, 29955, 29892, 29871, 396, 317, 29954, 29928, 19399, 13, 539, 525, 7915, 29918, 7099, 388, 2396, 29871, 29900, 29889, 29900, 29900, 29900, 29946, 29947, 29946, 29892, 29871, 396, 5994, 3950, 7688, 20228, 13, 539, 525, 1579, 29918, 4283, 2396, 29871, 29900, 29889, 29945, 29892, 29871, 396, 12789, 284, 6410, 330, 2735, 13, 539, 525, 29882, 4501, 29918, 29882, 2396, 29871, 29900, 29889, 29900, 29896, 29941, 29947, 29892, 29871, 396, 1967, 379, 7597, 29899, 29950, 434, 18765, 362, 313, 29888, 13857, 29897, 13, 539, 525, 29882, 4501, 29918, 29879, 2396, 29871, 29900, 29889, 29953, 29955, 29947, 29892, 29871, 396, 1967, 379, 7597, 29899, 29903, 1337, 362, 18765, 362, 313, 29888, 13857, 29897, 13, 539, 525, 29882, 4501, 29918, 29894, 2396, 29871, 29900, 29889, 29941, 29953, 29892, 29871, 396, 1967, 379, 7597, 29899, 1917, 18765, 362, 313, 29888, 13857, 29897, 13, 539, 525, 311, 7979, 267, 2396, 29871, 29896, 29889, 29929, 29947, 29892, 29871, 396, 1967, 13733, 20532, 24028, 3587, 29897, 13, 539, 525, 21652, 2396, 29871, 29900, 29889, 29900, 29945, 29892, 29871, 396, 1967, 13962, 20532, 24028, 15958, 29897, 13, 539, 525, 7052, 2396, 29871, 29900, 29889, 29900, 29945, 29892, 29871, 396, 1967, 6287, 20532, 24028, 11581, 29897, 13, 539, 525, 11360, 279, 2396, 29871, 29900, 29889, 29953, 29946, 29896, 29913, 29871, 396, 1967, 1183, 279, 20532, 24028, 3587, 29897, 13, 13, 29937, 6811, 3539, 10163, 411, 10163, 10521, 3945, 313, 25253, 29897, 13, 29888, 353, 13149, 29889, 23705, 877, 29882, 1478, 10521, 3945, 1495, 13, 361, 285, 29901, 13, 1678, 1596, 877, 15156, 1273, 29879, 29915, 1273, 285, 29961, 29900, 2314, 13, 1678, 363, 413, 29892, 325, 297, 14319, 29898, 29882, 1478, 29889, 8149, 3285, 7442, 29889, 1359, 3945, 29898, 29888, 29961, 29900, 12622, 29901, 13, 4706, 10163, 29961, 29895, 29962, 353, 325, 13, 13, 13, 1753, 7945, 7295, 13, 1678, 274, 16434, 353, 3523, 29889, 16859, 13, 1678, 848, 353, 3523, 29889, 1272, 13, 1678, 10153, 29918, 2311, 29892, 10153, 29918, 2311, 29918, 1688, 353, 3523, 29889, 2492, 29918, 2311, 565, 7431, 29898, 3670, 29889, 2492, 29918, 2311, 29897, 1275, 29871, 29906, 1683, 3523, 29889, 2492, 29918, 2311, 334, 29871, 29906, 29871, 396, 7945, 29892, 1243, 15786, 13, 1678, 21502, 12168, 353, 3523, 29889, 1022, 2878, 29879, 29871, 396, 29871, 29945, 29900, 29900, 29906, 29900, 29900, 9853, 267, 472, 24512, 29871, 29953, 29946, 29892, 29871, 29896, 29896, 29955, 29906, 29953, 29941, 4558, 353, 29871, 29906, 29955, 29941, 21502, 12168, 13, 1678, 9853, 29918, 2311, 353, 3523, 29889, 16175, 29918, 2311, 13, 1678, 18414, 5987, 353, 3523, 29889, 5753, 398, 5987, 29871, 396, 11828, 24512, 353, 9853, 29918, 2311, 334, 18414, 5987, 353, 29871, 29896, 29953, 334, 29871, 29946, 353, 29871, 29953, 29946, 13, 1678, 18177, 353, 3523, 29889, 705, 5861, 29871, 396, 2847, 6694, 18177, 13, 13, 1678, 396, 25455, 13, 1678, 2069, 29918, 344, 5779, 580, 13, 1678, 565, 3523, 29889, 9910, 29918, 7052, 29901, 13, 4706, 10153, 29918, 3616, 29918, 1195, 353, 4513, 29898, 2492, 29918, 2311, 847, 29871, 29941, 29906, 847, 29871, 29896, 29889, 29945, 29897, 13, 4706, 10153, 29918, 3616, 29918, 3317, 353, 4513, 29898, 2492, 29918, 2311, 847, 29871, 29941, 29906, 29930, 29871, 29896, 29889, 29945, 29897, 13, 4706, 10153, 29918, 2311, 353, 10153, 29918, 3616, 29918, 3317, 334, 29871, 29941, 29906, 29871, 396, 14511, 403, 411, 7472, 2473, 29918, 7052, 2159, 13, 4706, 1596, 877, 15156, 2473, 29899, 7052, 1273, 29887, 448, 1273, 29887, 29915, 1273, 313, 2492, 29918, 3616, 29918, 1195, 334, 29871, 29941, 29906, 29892, 10153, 29918, 2311, 876, 13, 13, 1678, 396, 1281, 4532, 1065, 13, 1678, 396, 848, 29918, 8977, 353, 6088, 29918, 1272, 29918, 16859, 29898, 1272, 29897, 13, 1678, 7945, 29918, 2084, 353, 525, 6995, 1272, 29914, 1272, 29918, 26495, 29915, 13, 1678, 1243, 29918, 2084, 353, 525, 6995, 1272, 29914, 1272, 29918, 1688, 29915, 13, 1678, 302, 29883, 353, 29871, 29896, 29871, 13, 13, 1678, 396, 15154, 3517, 2582, 13, 1678, 363, 285, 297, 13149, 29889, 23705, 877, 29930, 29918, 16175, 10521, 2732, 1495, 718, 13149, 29889, 23705, 29898, 9902, 29918, 1445, 1125, 13, 4706, 2897, 29889, 5992, 29898, 29888, 29897, 13, 13, 1678, 396, 25455, 1904, 13, 1678, 396, 1904, 353, 15317, 1212, 29898, 16859, 29892, 15232, 29922, 3670, 29889, 5666, 467, 517, 29898, 10141, 29897, 13, 1678, 396, 1904, 353, 18514, 336, 6779, 11031, 29953, 29946, 29900, 2141, 517, 29898, 10141, 29897, 13, 1678, 396, 1904, 353, 21121, 6779, 2141, 517, 29898, 10141, 29897, 13, 1678, 396, 1904, 353, 21121, 6779, 29928, 29956, 2141, 517, 29898, 10141, 29897, 13, 1678, 396, 1904, 353, 21121, 6779, 2182, 29874, 2141, 517, 29898, 10141, 29897, 13, 1678, 396, 1904, 353, 317, 802, 29872, 911, 6779, 2182, 29874, 2141, 517, 29898, 10141, 29897, 13, 1678, 396, 1904, 353, 18514, 336, 6779, 2141, 517, 29898, 10141, 29897, 13, 1678, 1904, 353, 323, 4901, 29965, 1896, 336, 6779, 2141, 517, 29898, 10141, 29897, 13, 13, 1678, 396, 20693, 326, 3950, 13, 1678, 23822, 29900, 29892, 23822, 29896, 29892, 23822, 29906, 353, 19997, 19997, 5159, 29871, 396, 5994, 3950, 3443, 6471, 13, 1678, 363, 413, 29892, 325, 297, 9657, 29898, 4299, 29889, 17514, 29918, 16744, 16655, 7076, 7295, 13, 4706, 565, 15300, 29890, 3173, 29915, 297, 413, 29901, 13, 9651, 23822, 29906, 4619, 518, 29894, 29962, 29871, 396, 4768, 2129, 13, 4706, 25342, 525, 1168, 29894, 29906, 29881, 29889, 7915, 29915, 297, 413, 29901, 13, 9651, 23822, 29896, 4619, 518, 29894, 29962, 29871, 396, 3394, 7688, 29918, 7099, 388, 13, 4706, 1683, 29901, 13, 9651, 23822, 29900, 4619, 518, 29894, 29962, 29871, 396, 599, 1683, 13, 13, 1678, 565, 3523, 29889, 328, 314, 29901, 13, 4706, 396, 10163, 1839, 29212, 29900, 2033, 334, 29922, 29871, 29900, 29889, 29896, 29871, 396, 10032, 301, 29878, 313, 29875, 29889, 29872, 29889, 317, 29954, 29928, 29922, 29945, 29923, 29899, 29941, 29892, 11783, 29922, 29945, 29923, 29899, 29946, 29897, 13, 4706, 5994, 3950, 353, 5994, 29889, 3253, 314, 29898, 4061, 29900, 29892, 301, 29878, 29922, 29882, 1478, 1839, 29212, 29900, 11287, 13, 4706, 396, 5994, 3950, 353, 23255, 17109, 29898, 4061, 29900, 29892, 301, 29878, 29922, 29882, 1478, 1839, 29212, 29900, 7464, 2186, 29918, 29212, 29922, 29900, 29889, 29896, 29897, 13, 1678, 1683, 29901, 13, 4706, 5994, 3950, 353, 5994, 29889, 26016, 29928, 29898, 4061, 29900, 29892, 301, 29878, 29922, 29882, 1478, 1839, 29212, 29900, 7464, 19399, 29922, 29882, 1478, 1839, 29885, 2932, 398, 7464, 302, 4156, 586, 29922, 5574, 29897, 13, 1678, 5994, 3950, 29889, 1202, 29918, 3207, 29918, 2972, 3319, 29915, 7529, 2396, 23822, 29896, 29892, 525, 7915, 29918, 7099, 388, 2396, 10163, 1839, 7915, 29918, 7099, 388, 2033, 1800, 29871, 396, 788, 23822, 29896, 411, 7688, 29918, 7099, 388, 13, 1678, 5994, 3950, 29889, 1202, 29918, 3207, 29918, 2972, 3319, 29915, 7529, 2396, 23822, 29906, 1800, 29871, 396, 788, 23822, 29906, 313, 5365, 2129, 29897, 13, 1678, 5994, 3950, 29889, 3207, 29918, 13155, 29961, 29906, 22322, 29212, 2033, 334, 29922, 29871, 29906, 29889, 29900, 29871, 396, 24003, 301, 29878, 13, 1678, 628, 23822, 29900, 29892, 23822, 29896, 29892, 23822, 29906, 13, 13, 1678, 1369, 29918, 1022, 2878, 353, 29871, 29900, 13, 1678, 1900, 29918, 9202, 2264, 353, 29871, 29900, 29889, 29900, 13, 1678, 1243, 29918, 13318, 29918, 29875, 283, 353, 29871, 29900, 29889, 29900, 13, 13, 1678, 396, 4218, 29918, 10382, 29898, 705, 5861, 29897, 13, 1678, 396, 29871, 30666, 31526, 233, 160, 134, 30908, 13, 1678, 565, 18177, 29889, 1975, 2541, 12839, 415, 29374, 29871, 396, 282, 3637, 25350, 3402, 13, 4706, 396, 1950, 18177, 526, 525, 10521, 415, 742, 525, 29891, 324, 586, 29941, 29899, 29879, 407, 29889, 415, 742, 525, 29891, 324, 586, 29941, 29899, 25649, 29889, 415, 29915, 2992, 29889, 13, 4706, 521, 29895, 415, 353, 4842, 305, 29889, 1359, 29898, 705, 5861, 29892, 2910, 29918, 5479, 29922, 10141, 29897, 13, 13, 4706, 396, 2254, 1904, 13, 4706, 1018, 29901, 13, 9651, 521, 29895, 415, 1839, 4299, 2033, 353, 426, 29895, 29901, 325, 363, 413, 29892, 325, 297, 521, 29895, 415, 1839, 4299, 13359, 7076, 580, 565, 1904, 29889, 3859, 29918, 8977, 580, 29961, 29895, 1822, 1949, 295, 580, 1275, 325, 29889, 1949, 295, 28296, 13, 9651, 1904, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 29570, 415, 1839, 4299, 7464, 9406, 29922, 8824, 29897, 13, 4706, 5174, 7670, 2392, 408, 321, 29901, 13, 9651, 269, 353, 11860, 29879, 338, 451, 15878, 411, 1273, 29879, 29889, 12048, 1598, 1192, 705, 5861, 6629, 470, 6084, 263, 1192, 16859, 15878, 411, 1273, 29879, 29889, 376, 1273, 313, 3670, 29889, 705, 5861, 29892, 3523, 29889, 16859, 29892, 3523, 29889, 705, 5861, 29897, 13, 9651, 12020, 7670, 2392, 29898, 29879, 29897, 515, 321, 13, 13, 4706, 396, 2254, 5994, 3950, 13, 4706, 565, 521, 29895, 415, 1839, 20640, 3950, 2033, 338, 451, 6213, 29901, 13, 9651, 5994, 3950, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 29570, 415, 1839, 20640, 3950, 11287, 13, 9651, 1900, 29918, 9202, 2264, 353, 521, 29895, 415, 1839, 13318, 29918, 9202, 2264, 2033, 13, 13, 4706, 396, 2254, 2582, 13, 4706, 565, 521, 29895, 415, 29889, 657, 877, 26495, 29918, 9902, 1495, 338, 451, 6213, 29901, 13, 9651, 411, 1722, 29898, 9902, 29918, 1445, 29892, 525, 29893, 1495, 408, 934, 29901, 13, 18884, 934, 29889, 3539, 29898, 29570, 415, 1839, 26495, 29918, 9902, 11287, 29871, 396, 2436, 2582, 29889, 3945, 13, 13, 4706, 1369, 29918, 1022, 2878, 353, 521, 29895, 415, 1839, 1022, 2878, 2033, 718, 29871, 29896, 13, 4706, 628, 521, 29895, 415, 13, 13, 1678, 25342, 7431, 29898, 705, 5861, 29897, 1405, 29871, 29900, 29901, 29871, 396, 6501, 1212, 3402, 13, 4706, 396, 1950, 18177, 526, 525, 10521, 705, 5861, 742, 525, 29891, 324, 586, 29941, 29899, 25649, 29889, 20580, 29889, 29896, 29945, 742, 29871, 525, 26031, 1212, 29945, 29941, 29889, 20580, 29889, 29955, 29946, 29915, 2992, 29889, 13, 4706, 2254, 29918, 26031, 1212, 29918, 705, 5861, 29898, 4299, 29892, 18177, 29897, 13, 13, 1678, 396, 1102, 14952, 2045, 597, 3292, 29889, 510, 29914, 499, 1705, 22026, 29914, 29891, 324, 586, 29941, 29914, 12175, 29914, 29906, 29941, 29947, 13, 1678, 396, 301, 29888, 353, 14013, 921, 29901, 29871, 29896, 448, 921, 847, 21502, 12168, 29871, 396, 5608, 364, 1160, 304, 5225, 13, 1678, 396, 301, 29888, 353, 14013, 921, 29901, 29871, 29896, 29900, 3579, 313, 29882, 1478, 1839, 29880, 9600, 2033, 334, 921, 847, 21502, 12168, 29897, 29871, 396, 1518, 364, 1160, 13, 1678, 396, 301, 29888, 353, 14013, 921, 29901, 29871, 29896, 448, 29871, 29896, 29900, 3579, 313, 29882, 1478, 1839, 29880, 9600, 2033, 334, 313, 29896, 448, 921, 847, 21502, 12168, 876, 29871, 396, 16402, 1518, 364, 1160, 13, 1678, 301, 29888, 353, 14013, 921, 29901, 313, 29896, 718, 5844, 29889, 3944, 29898, 29916, 334, 5844, 29889, 1631, 847, 21502, 12168, 876, 847, 29871, 29906, 334, 29871, 29900, 29889, 29929, 29929, 718, 29871, 29900, 29889, 29900, 29896, 29871, 396, 6776, 457, 2045, 597, 279, 26560, 29889, 990, 29914, 5140, 29914, 29896, 29947, 29896, 29906, 29889, 29900, 29896, 29896, 29947, 29955, 29889, 5140, 13, 1678, 1364, 14952, 353, 301, 29878, 29918, 816, 14952, 29889, 9099, 29519, 29898, 20640, 3950, 29892, 301, 29878, 29918, 2892, 29922, 29880, 29888, 29897, 13, 1678, 396, 1364, 14952, 353, 301, 29878, 29918, 816, 14952, 29889, 15329, 14448, 29519, 29898, 20640, 3950, 29892, 2316, 342, 2873, 11759, 14486, 29898, 1022, 2878, 29879, 334, 921, 29897, 363, 921, 297, 518, 29900, 29889, 29947, 29892, 29871, 29900, 29889, 29929, 20526, 330, 2735, 29922, 29900, 29889, 29896, 29897, 13, 1678, 1364, 14952, 29889, 4230, 29918, 1022, 2878, 353, 1369, 29918, 1022, 2878, 13, 13, 1678, 396, 396, 18399, 301, 29878, 20410, 13, 1678, 396, 343, 353, 5159, 13, 1678, 396, 363, 903, 297, 3464, 29898, 1022, 2878, 29879, 1125, 13, 1678, 396, 268, 1364, 14952, 29889, 10568, 580, 13, 1678, 396, 268, 343, 29889, 4397, 29898, 20640, 3950, 29889, 3207, 29918, 13155, 29961, 29900, 22322, 29212, 11287, 13, 1678, 396, 14770, 29889, 5317, 29898, 29891, 29892, 525, 9229, 742, 3858, 2433, 9099, 29519, 1495, 13, 1678, 396, 14770, 29889, 29916, 1643, 877, 1022, 2878, 1495, 13, 1678, 396, 14770, 29889, 29891, 1643, 877, 29519, 1495, 13, 1678, 396, 14770, 29889, 29873, 523, 29918, 2680, 580, 13, 1678, 396, 14770, 29889, 7620, 1003, 877, 29519, 29889, 2732, 742, 270, 1631, 29922, 29941, 29900, 29900, 29897, 13, 13, 1678, 396, 25455, 13235, 6694, 13, 1678, 565, 4742, 29889, 1853, 2804, 525, 21970, 29915, 322, 4842, 305, 29889, 29883, 6191, 29889, 10141, 29918, 2798, 580, 1405, 29871, 29896, 322, 4842, 305, 29889, 5721, 7541, 29889, 275, 29918, 16515, 7295, 13, 4706, 1320, 29889, 2344, 29918, 5014, 29918, 2972, 29898, 27852, 2433, 29876, 617, 29880, 742, 29871, 396, 525, 5721, 7541, 14998, 29915, 13, 462, 18884, 2069, 29918, 5696, 2433, 23981, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29901, 29929, 29929, 29929, 29929, 742, 29871, 396, 13235, 6694, 2069, 1158, 13, 462, 18884, 3186, 29918, 2311, 29922, 29896, 29892, 29871, 396, 1353, 310, 7573, 363, 13235, 6694, 13, 462, 18884, 7115, 29922, 29900, 29897, 29871, 396, 13235, 6694, 2943, 7115, 13, 4706, 1904, 353, 4842, 305, 29889, 15755, 29889, 23482, 29889, 13398, 7541, 1469, 2177, 6553, 29898, 4299, 29892, 1284, 29918, 348, 3880, 29918, 16744, 29922, 5574, 29897, 13, 4706, 1904, 29889, 29891, 3543, 29918, 29277, 353, 1904, 29889, 5453, 29889, 29891, 3543, 29918, 29277, 29871, 396, 4337, 343, 3543, 7546, 16285, 304, 2246, 3233, 13, 13, 1678, 396, 13373, 24541, 13, 1678, 8783, 353, 16012, 20163, 2855, 4775, 29879, 29898, 14968, 29918, 2084, 29892, 10153, 29918, 2311, 29892, 9853, 29918, 2311, 29892, 13, 462, 462, 29871, 18765, 29922, 5574, 29892, 13, 462, 462, 29871, 10163, 29922, 29882, 1478, 29892, 29871, 396, 18765, 362, 11266, 16744, 13, 462, 462, 29871, 7705, 29922, 3670, 29889, 1621, 29892, 29871, 396, 7705, 6825, 6694, 13, 462, 462, 29871, 7090, 29918, 8346, 29922, 3670, 29889, 8173, 29918, 8346, 29892, 13, 462, 462, 29871, 2323, 29918, 25932, 29922, 3670, 29889, 14369, 29918, 25932, 29897, 13, 13, 1678, 396, 360, 2075, 29877, 1664, 13, 1678, 9853, 29918, 2311, 353, 1375, 29898, 16175, 29918, 2311, 29892, 7431, 29898, 24713, 876, 13, 1678, 302, 29893, 353, 1375, 4197, 359, 29889, 21970, 29918, 2798, 3285, 9853, 29918, 2311, 565, 9853, 29918, 2311, 1405, 29871, 29896, 1683, 29871, 29900, 29892, 29871, 29947, 2314, 29871, 396, 1353, 310, 17162, 13, 1678, 1418, 7003, 1664, 353, 4842, 305, 29889, 13239, 29889, 1272, 29889, 1469, 10036, 29898, 24713, 29892, 13, 462, 462, 632, 9853, 29918, 2311, 29922, 16175, 29918, 2311, 29892, 13, 462, 462, 632, 954, 29918, 1287, 414, 29922, 29876, 29893, 29892, 13, 462, 462, 632, 528, 21897, 29922, 1333, 3523, 29889, 1621, 29892, 29871, 396, 1383, 21897, 29922, 5574, 6521, 7705, 6825, 6694, 338, 1304, 13, 462, 462, 632, 12534, 29918, 14834, 29922, 5574, 29892, 13, 462, 462, 632, 5321, 403, 29918, 9144, 29922, 24713, 29889, 1054, 9632, 29918, 9144, 29897, 13, 13, 1678, 396, 4321, 12657, 13, 1678, 1243, 12657, 353, 4842, 305, 29889, 13239, 29889, 1272, 29889, 1469, 10036, 29898, 5896, 20163, 2855, 4775, 29879, 29898, 1688, 29918, 2084, 29892, 10153, 29918, 2311, 29918, 1688, 29892, 9853, 29918, 2311, 334, 29871, 29906, 29892, 13, 462, 462, 462, 462, 10163, 29922, 29882, 1478, 29892, 13, 462, 462, 462, 462, 7705, 29922, 8824, 29892, 13, 462, 462, 462, 462, 7090, 29918, 8346, 29922, 3670, 29889, 8173, 29918, 8346, 29892, 13, 462, 462, 462, 462, 2323, 29918, 25932, 29922, 3670, 29889, 14369, 29918, 25932, 511, 13, 462, 462, 632, 9853, 29918, 2311, 29922, 16175, 29918, 2311, 334, 29871, 29906, 29892, 13, 462, 462, 632, 954, 29918, 1287, 414, 29922, 29876, 29893, 29892, 13, 462, 462, 632, 12534, 29918, 14834, 29922, 5574, 29892, 13, 462, 462, 632, 5321, 403, 29918, 9144, 29922, 24713, 29889, 1054, 9632, 29918, 9144, 29897, 13, 13, 1678, 396, 7370, 6694, 13, 1678, 302, 29890, 353, 7431, 29898, 29881, 2075, 29877, 1664, 29897, 13, 1678, 758, 29890, 3173, 353, 1369, 29918, 1022, 2878, 1275, 29871, 29900, 13, 1678, 1904, 29889, 17608, 353, 302, 29883, 29871, 396, 10641, 1353, 310, 4413, 304, 1904, 13, 1678, 1904, 29889, 5666, 353, 3523, 29889, 5666, 29871, 396, 10641, 343, 3543, 11258, 13, 1678, 1904, 29889, 29882, 1478, 353, 10163, 29871, 396, 10641, 11266, 16744, 304, 1904, 13, 1678, 1904, 29889, 1990, 29918, 705, 5861, 353, 11073, 29918, 517, 29918, 1990, 29918, 705, 5861, 29898, 24713, 29889, 21134, 29892, 302, 29883, 467, 517, 29898, 10141, 29897, 29871, 396, 10641, 770, 18177, 13, 1678, 11053, 353, 7442, 29889, 3298, 359, 29898, 17608, 29897, 29871, 396, 286, 3301, 639, 770, 13, 1678, 396, 4842, 305, 29889, 1300, 468, 3665, 29889, 842, 29918, 4801, 522, 29918, 273, 290, 14997, 29898, 5574, 29897, 13, 1678, 2582, 353, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 29871, 396, 525, 29925, 742, 525, 29934, 742, 525, 29885, 3301, 742, 525, 29943, 29896, 742, 525, 791, 402, 29902, 29877, 29965, 742, 525, 791, 4669, 2264, 742, 525, 791, 23236, 29915, 13, 1678, 260, 29900, 353, 931, 29889, 2230, 580, 13, 1678, 4842, 305, 29918, 13239, 29889, 4299, 29918, 3888, 29898, 4299, 29892, 3461, 2433, 7727, 1495, 29871, 396, 525, 8159, 29915, 470, 525, 7727, 29915, 13, 1678, 1596, 877, 15156, 1273, 29887, 1418, 7003, 1664, 17162, 29915, 1273, 302, 29893, 29897, 13, 1678, 1596, 877, 4763, 292, 6694, 363, 1273, 29887, 21502, 12168, 856, 29915, 1273, 21502, 12168, 29897, 13, 1678, 363, 21502, 305, 297, 3464, 29898, 2962, 29918, 1022, 2878, 29892, 21502, 12168, 1125, 29871, 396, 21502, 305, 448, 2683, 2683, 2683, 2683, 29899, 13, 4706, 1904, 29889, 14968, 580, 13, 4706, 1904, 29889, 629, 353, 29871, 29896, 448, 313, 29896, 718, 5844, 29889, 3944, 29898, 1195, 29898, 1022, 2878, 334, 29871, 29906, 29892, 21502, 12168, 29897, 334, 5844, 29889, 1631, 847, 21502, 12168, 876, 847, 29871, 29906, 29871, 396, 402, 29902, 29877, 29965, 529, 976, 29871, 29896, 29889, 29900, 6410, 11959, 13, 13, 4706, 396, 4721, 29890, 3173, 13, 4706, 565, 758, 29890, 3173, 29901, 13, 9651, 452, 353, 4236, 29898, 14486, 29898, 29941, 29900, 847, 302, 29890, 511, 29871, 29941, 29897, 29871, 396, 1353, 310, 758, 29890, 3173, 21502, 12168, 13, 9651, 6529, 353, 7442, 29889, 1639, 29886, 29898, 1022, 2878, 29892, 518, 29900, 29892, 452, 1402, 518, 29900, 29889, 29896, 29892, 10163, 1839, 29212, 29900, 2033, 334, 29871, 29906, 11724, 320, 13, 462, 7442, 29889, 1639, 29886, 29898, 1022, 2878, 29892, 518, 29900, 29892, 452, 1402, 518, 29900, 29889, 29929, 29892, 10163, 1839, 29885, 2932, 398, 2033, 2314, 29871, 396, 758, 29890, 3173, 6055, 313, 29212, 29922, 29900, 29889, 29896, 29892, 19399, 29922, 29900, 29889, 29929, 29897, 13, 9651, 565, 21502, 305, 1275, 452, 29901, 13, 18884, 396, 1596, 29918, 4299, 29918, 5365, 2129, 29898, 4299, 29897, 13, 18884, 758, 29890, 3173, 353, 7700, 13, 13, 9651, 396, 350, 3173, 5994, 3950, 6055, 13, 9651, 5994, 3950, 29889, 3207, 29918, 13155, 29961, 29906, 22322, 29212, 2033, 353, 6529, 29961, 29900, 29962, 13, 9651, 565, 5994, 3950, 29889, 3207, 29918, 13155, 29961, 29906, 1822, 657, 877, 29885, 2932, 398, 1495, 338, 451, 6213, 29901, 29871, 396, 363, 317, 29954, 29928, 541, 451, 11783, 13, 18884, 5994, 3950, 29889, 3207, 29918, 13155, 29961, 29906, 22322, 29885, 2932, 398, 2033, 353, 6529, 29961, 29896, 29962, 13, 13, 4706, 286, 6758, 353, 4842, 305, 29889, 3298, 359, 29898, 29946, 467, 517, 29898, 10141, 29897, 29871, 396, 2099, 28495, 13, 4706, 1596, 29898, 28909, 29876, 29915, 718, 14210, 29896, 29900, 29879, 29915, 334, 29871, 29947, 29897, 1273, 6702, 29923, 1129, 305, 742, 525, 29887, 3746, 29918, 6954, 742, 525, 29954, 29902, 29877, 29965, 742, 525, 5415, 742, 525, 25932, 742, 525, 7827, 742, 525, 5182, 29879, 742, 525, 2492, 29918, 2311, 8785, 13, 4706, 282, 1646, 353, 260, 29939, 18933, 29898, 15172, 29898, 29881, 2075, 29877, 1664, 511, 3001, 29922, 9877, 29897, 29871, 396, 6728, 2594, 13, 4706, 363, 474, 29892, 313, 2492, 29879, 29892, 22525, 29892, 10898, 29892, 24459, 297, 282, 1646, 29901, 29871, 396, 9853, 448, 2683, 2683, 2683, 9072, 13, 9651, 6836, 353, 474, 718, 302, 29890, 334, 21502, 305, 29871, 396, 1353, 23387, 9853, 267, 313, 16076, 7945, 1369, 29897, 13, 9651, 527, 3174, 353, 527, 3174, 29889, 517, 29898, 10141, 467, 7411, 580, 847, 29871, 29906, 29945, 29945, 29889, 29900, 29871, 396, 13122, 29947, 304, 5785, 29941, 29906, 29892, 29871, 29900, 448, 29871, 29906, 29945, 29945, 304, 29871, 29900, 29889, 29900, 448, 29871, 29896, 29889, 29900, 13, 9651, 22525, 353, 22525, 29889, 517, 29898, 10141, 29897, 13, 13, 9651, 396, 18399, 4558, 411, 3216, 292, 16273, 13, 9651, 565, 6836, 529, 29871, 29896, 29901, 13, 18884, 285, 353, 525, 14968, 29918, 16175, 29995, 29887, 29889, 2732, 29915, 1273, 474, 29871, 396, 10422, 13, 18884, 6492, 29918, 8346, 29898, 2492, 29879, 29922, 2492, 29879, 29892, 22525, 29922, 5182, 29879, 29892, 10898, 29922, 24772, 29892, 285, 978, 29922, 29888, 29897, 13, 18884, 565, 260, 29890, 29918, 13236, 29901, 13, 462, 1678, 260, 29890, 29918, 13236, 29889, 1202, 29918, 3027, 29898, 29888, 29892, 13850, 29906, 29889, 326, 949, 29898, 29888, 29897, 7503, 29892, 584, 29892, 4761, 29899, 29896, 1402, 848, 689, 1446, 2433, 29950, 29956, 29907, 1495, 13, 13, 9651, 396, 14974, 29899, 17185, 6694, 13, 9651, 565, 3523, 29889, 9910, 29918, 7052, 29901, 13, 18884, 565, 6836, 847, 18414, 5987, 1273, 29871, 29896, 1275, 29871, 29900, 29901, 29871, 396, 29871, 10365, 10153, 29918, 2311, 313, 29953, 29955, 29995, 448, 29871, 29896, 29945, 29900, 10997, 1432, 29871, 29896, 9853, 13, 462, 1678, 10153, 29918, 2311, 353, 4036, 29889, 9502, 3881, 29898, 2492, 29918, 3616, 29918, 1195, 29892, 10153, 29918, 3616, 29918, 3317, 718, 29871, 29896, 29897, 334, 29871, 29941, 29906, 13, 18884, 18668, 353, 10153, 29918, 2311, 847, 4236, 29898, 2492, 29879, 29889, 12181, 29961, 29906, 29901, 2314, 29871, 396, 6287, 7329, 13, 18884, 565, 18668, 2804, 29871, 29896, 29901, 13, 462, 1678, 17534, 353, 518, 755, 29889, 27696, 29898, 29916, 334, 18668, 847, 29871, 29941, 29906, 1846, 334, 29871, 29941, 29906, 363, 921, 297, 527, 3174, 29889, 12181, 29961, 29906, 29901, 5262, 29871, 396, 716, 8267, 313, 303, 10301, 287, 304, 29871, 29896, 29953, 29899, 20787, 29897, 13, 462, 1678, 527, 3174, 353, 383, 29889, 1639, 3733, 403, 29898, 2492, 29879, 29892, 2159, 29922, 1983, 29892, 4464, 2433, 18152, 457, 279, 742, 7595, 29918, 29883, 1398, 414, 29922, 8824, 29897, 13, 13, 9651, 396, 7525, 1904, 13, 9651, 4450, 353, 1904, 29898, 2492, 29879, 29897, 13, 13, 9651, 396, 11796, 29872, 6410, 13, 9651, 6410, 29892, 6410, 29918, 7076, 353, 10272, 29918, 6758, 29898, 11965, 29892, 22525, 29892, 1904, 29897, 13, 9651, 565, 451, 4842, 305, 29889, 4492, 262, 568, 29898, 6758, 1125, 13, 18884, 1596, 877, 29956, 25614, 29901, 1661, 29899, 18925, 6410, 29892, 17140, 6694, 13420, 6410, 29918, 7076, 29897, 13, 18884, 736, 2582, 13, 13, 9651, 396, 2522, 744, 6410, 491, 2245, 979, 9853, 29918, 2311, 310, 29871, 29953, 29946, 13, 9651, 6410, 334, 29922, 9853, 29918, 2311, 847, 29871, 29953, 29946, 13, 13, 632, 13, 9651, 6410, 29889, 1627, 1328, 580, 13, 13, 9651, 396, 20693, 326, 675, 18414, 7964, 16030, 13, 9651, 565, 6836, 1273, 18414, 5987, 1275, 29871, 29900, 29901, 13, 18884, 5994, 3950, 29889, 10568, 580, 13, 18884, 5994, 3950, 29889, 9171, 29918, 5105, 580, 13, 13, 9651, 396, 13905, 9853, 2582, 13, 9651, 286, 6758, 353, 313, 828, 2209, 334, 474, 718, 6410, 29918, 7076, 29897, 847, 313, 29875, 718, 29871, 29896, 29897, 29871, 396, 2767, 2099, 28495, 13, 9651, 2626, 353, 14210, 29889, 29941, 29887, 29954, 29915, 1273, 313, 7345, 305, 29889, 29883, 6191, 29889, 14834, 29918, 29883, 3791, 580, 847, 29871, 29896, 29923, 29929, 565, 4842, 305, 29889, 29883, 6191, 29889, 275, 29918, 16515, 580, 1683, 29871, 29900, 29897, 29871, 396, 313, 7210, 29897, 13, 9651, 269, 353, 6702, 29995, 29896, 29900, 29879, 29915, 334, 29871, 29906, 718, 14210, 29896, 29900, 29889, 29941, 29887, 29915, 334, 29871, 29953, 29897, 1273, 6702, 29995, 29887, 22584, 29887, 29915, 1273, 313, 1022, 2878, 29892, 21502, 12168, 448, 29871, 29896, 511, 2626, 29892, 334, 828, 2209, 29892, 7431, 29898, 5182, 29879, 511, 10153, 29918, 2311, 29897, 13, 9651, 282, 1646, 29889, 842, 29918, 8216, 29898, 29879, 29897, 13, 13, 9651, 396, 1095, 9853, 448, 2683, 2683, 2683, 2683, 2683, 9072, 5634, 13, 13, 4706, 396, 10318, 1364, 14952, 13, 4706, 1364, 14952, 29889, 10568, 580, 13, 13, 4706, 396, 10554, 21502, 305, 2582, 13, 4706, 2186, 29918, 1022, 2878, 353, 21502, 305, 718, 29871, 29896, 1275, 21502, 12168, 13, 4706, 565, 451, 3523, 29889, 1333, 342, 470, 2186, 29918, 1022, 2878, 29901, 29871, 396, 20535, 403, 286, 3301, 13, 9651, 338, 29918, 29883, 6235, 353, 738, 4197, 29916, 297, 848, 363, 921, 297, 6024, 29883, 6235, 29889, 1272, 742, 525, 29883, 6235, 29906, 29900, 29896, 29946, 29889, 1272, 742, 525, 29883, 6235, 29906, 29900, 29896, 29955, 29889, 1272, 2033, 2314, 322, 1904, 29889, 17608, 1275, 29871, 29947, 29900, 13, 9651, 2582, 353, 1243, 29889, 1688, 29898, 16859, 29892, 13, 462, 18884, 848, 29892, 13, 462, 18884, 9853, 29918, 2311, 29922, 16175, 29918, 2311, 334, 29871, 29906, 29892, 13, 462, 18884, 10153, 29918, 2311, 29922, 2492, 29918, 2311, 29918, 1688, 29892, 13, 462, 18884, 1904, 29922, 4299, 29892, 13, 462, 18884, 1970, 29918, 386, 690, 29922, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 396, 29871, 29900, 29889, 29900, 29900, 29896, 565, 3523, 29889, 29872, 1555, 345, 470, 313, 8394, 29918, 1022, 2878, 322, 338, 29918, 29883, 6235, 29897, 1683, 29871, 29900, 29889, 29900, 29896, 29892, 13, 462, 18884, 474, 283, 29918, 386, 690, 29922, 29900, 29889, 29953, 29892, 13, 462, 18884, 4078, 29918, 3126, 29922, 8394, 29918, 1022, 2878, 322, 338, 29918, 29883, 6235, 29892, 13, 462, 18884, 2323, 29918, 25932, 29922, 3670, 29889, 14369, 29918, 25932, 29892, 13, 462, 18884, 1418, 7003, 1664, 29922, 1688, 12657, 29897, 13, 13, 4706, 396, 14350, 21502, 305, 2582, 13, 4706, 411, 1722, 29898, 9902, 29918, 1445, 29892, 525, 29874, 1495, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 29879, 718, 14210, 29896, 29900, 29889, 29941, 29887, 29915, 334, 7431, 29898, 9902, 29897, 1273, 2582, 718, 11297, 29876, 1495, 29871, 396, 349, 29892, 390, 29892, 286, 3301, 29892, 383, 29896, 29892, 1243, 29918, 6758, 267, 7607, 29954, 29902, 29877, 29965, 29892, 5446, 29892, 1067, 29879, 29897, 13, 4706, 565, 7431, 29898, 3670, 29889, 978, 29897, 322, 3523, 29889, 21454, 29901, 13, 9651, 2897, 29889, 5205, 877, 3174, 4422, 21447, 2582, 29889, 3945, 330, 29879, 597, 29995, 29879, 29914, 9902, 29914, 9902, 29995, 29879, 29889, 3945, 29915, 1273, 313, 3670, 29889, 21454, 29892, 3523, 29889, 978, 876, 13, 13, 4706, 396, 14350, 323, 6073, 3377, 2582, 13, 4706, 565, 260, 29890, 29918, 13236, 29901, 13, 9651, 921, 353, 1051, 29898, 828, 2209, 29897, 718, 1051, 29898, 9902, 29897, 13, 9651, 17735, 353, 6024, 29954, 29902, 29877, 29965, 742, 525, 2061, 2264, 742, 525, 2385, 2450, 742, 525, 5323, 262, 6410, 742, 13, 462, 418, 525, 29875, 283, 742, 525, 6758, 742, 525, 26074, 283, 6410, 742, 525, 5415, 6410, 2033, 13, 9651, 363, 921, 29875, 29892, 3611, 297, 14319, 29898, 29916, 29892, 17735, 1125, 13, 18884, 260, 29890, 29918, 13236, 29889, 1202, 29918, 19529, 279, 29898, 3257, 29892, 921, 29875, 29892, 21502, 305, 29897, 13, 13, 4706, 396, 10318, 1900, 286, 3301, 13, 4706, 5713, 353, 6216, 2264, 29898, 9302, 29889, 2378, 29898, 9902, 467, 690, 14443, 29898, 29896, 29892, 448, 29896, 876, 29871, 396, 6216, 2264, 29918, 29875, 353, 7688, 287, 10296, 310, 518, 29925, 29892, 390, 29892, 286, 3301, 29892, 383, 29896, 29962, 13, 4706, 565, 5713, 1405, 1900, 29918, 9202, 2264, 29901, 13, 9651, 1900, 29918, 9202, 2264, 353, 5713, 13, 308, 13, 4706, 1243, 29918, 29875, 283, 353, 2582, 29961, 29900, 29962, 13, 4706, 565, 1243, 29918, 29875, 283, 1405, 1243, 29918, 13318, 29918, 29875, 283, 29901, 13, 9651, 1243, 29918, 13318, 29918, 29875, 283, 353, 1243, 29918, 29875, 283, 13, 13, 4706, 396, 16913, 6694, 2582, 13, 4706, 4078, 353, 313, 1333, 3523, 29889, 17639, 1351, 29897, 470, 313, 8394, 29918, 1022, 2878, 322, 451, 3523, 29889, 29872, 1555, 345, 29897, 13, 4706, 565, 4078, 29901, 13, 9651, 411, 1722, 29898, 9902, 29918, 1445, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 18884, 396, 6204, 1423, 3149, 13, 18884, 521, 29895, 415, 353, 11117, 1022, 2878, 2396, 21502, 305, 29892, 13, 462, 308, 525, 13318, 29918, 9202, 2264, 2396, 1900, 29918, 9202, 2264, 29892, 13, 462, 308, 525, 26495, 29918, 9902, 2396, 285, 29889, 949, 3285, 13, 462, 308, 525, 4299, 2396, 1904, 29889, 5453, 29889, 3859, 29918, 8977, 580, 565, 1134, 29898, 13, 462, 632, 1904, 29897, 338, 302, 29876, 29889, 23482, 29889, 13398, 7541, 1469, 2177, 6553, 1683, 1904, 29889, 3859, 29918, 8977, 3285, 13, 462, 308, 525, 20640, 3950, 2396, 6213, 565, 2186, 29918, 1022, 2878, 1683, 5994, 3950, 29889, 3859, 29918, 8977, 28296, 13, 13, 9651, 396, 16913, 1833, 1423, 3149, 13, 9651, 4842, 305, 29889, 7620, 29898, 29570, 415, 29892, 1833, 29897, 13, 13, 9651, 396, 16913, 1900, 1423, 3149, 13, 9651, 565, 1900, 29918, 9202, 2264, 1275, 5713, 29901, 13, 18884, 4842, 305, 29889, 7620, 29898, 29570, 415, 29892, 1900, 29897, 13, 632, 13, 9651, 565, 1243, 29918, 29875, 283, 1275, 1243, 29918, 13318, 29918, 29875, 283, 29901, 13, 18884, 4842, 305, 29889, 7620, 29898, 29570, 415, 29892, 1243, 29918, 13318, 29897, 13, 13, 9651, 396, 16913, 16199, 1432, 29871, 29896, 29900, 21502, 12168, 313, 25253, 29897, 13, 9651, 396, 565, 21502, 305, 1405, 29871, 29900, 322, 21502, 305, 1273, 29871, 29896, 29900, 1275, 29871, 29900, 29901, 13, 9651, 396, 268, 4842, 305, 29889, 7620, 29898, 29570, 415, 29892, 281, 3972, 718, 525, 1627, 786, 29995, 29887, 29889, 415, 29915, 1273, 21502, 305, 29897, 13, 13, 9651, 396, 21267, 1423, 3149, 13, 9651, 628, 521, 29895, 415, 13, 13, 4706, 396, 1095, 21502, 305, 448, 2683, 2683, 2683, 2683, 2683, 2683, 5634, 13, 13, 1678, 396, 1095, 6694, 13, 1678, 302, 353, 3523, 29889, 978, 13, 1678, 565, 7431, 29898, 29876, 1125, 13, 4706, 302, 353, 22868, 29915, 718, 302, 565, 451, 302, 29889, 275, 21574, 580, 1683, 302, 13, 4706, 285, 9902, 29892, 1652, 579, 29892, 285, 13318, 353, 525, 9902, 29995, 29879, 29889, 3945, 29915, 1273, 302, 29892, 525, 4230, 29995, 29879, 29889, 415, 29915, 1273, 302, 29892, 525, 13318, 29995, 29879, 29889, 415, 29915, 1273, 302, 13, 4706, 2897, 29889, 1267, 420, 877, 9902, 29889, 3945, 742, 285, 9902, 29897, 13, 4706, 2897, 29889, 1267, 420, 29898, 29893, 3972, 718, 525, 4230, 29889, 415, 742, 281, 3972, 718, 1652, 579, 29897, 565, 2897, 29889, 2084, 29889, 9933, 29898, 29893, 3972, 718, 525, 4230, 29889, 415, 1495, 1683, 6213, 13, 4706, 2897, 29889, 1267, 420, 29898, 29893, 3972, 718, 525, 13318, 29889, 415, 742, 281, 3972, 718, 285, 13318, 29897, 565, 2897, 29889, 2084, 29889, 9933, 29898, 29893, 3972, 718, 525, 13318, 29889, 415, 1495, 1683, 6213, 13, 4706, 565, 3523, 29889, 21454, 29901, 29871, 396, 4078, 304, 9570, 13, 9651, 2897, 29889, 5205, 877, 3174, 4422, 21447, 1273, 29879, 330, 29879, 597, 29995, 29879, 29914, 9902, 29915, 1273, 313, 29888, 9902, 29892, 3523, 29889, 21454, 876, 13, 9651, 2897, 29889, 5205, 877, 3174, 4422, 21447, 1273, 29879, 330, 29879, 597, 29995, 29879, 29914, 705, 5861, 29915, 1273, 313, 29893, 3972, 718, 1652, 579, 29892, 3523, 29889, 21454, 876, 13, 9651, 396, 2897, 29889, 5205, 877, 3174, 4422, 21447, 1273, 29879, 330, 29879, 597, 29995, 29879, 29914, 705, 5861, 29915, 1273, 313, 29893, 3972, 718, 285, 13318, 29892, 3523, 29889, 21454, 876, 13, 13, 1678, 565, 451, 3523, 29889, 29872, 1555, 345, 29901, 13, 4706, 6492, 29918, 9902, 580, 29871, 396, 4078, 408, 2582, 29889, 2732, 13, 1678, 1596, 877, 29995, 29887, 21502, 12168, 8676, 297, 18695, 29941, 29888, 6199, 7790, 29876, 29915, 1273, 313, 1022, 2878, 448, 1369, 29918, 1022, 2878, 718, 29871, 29896, 29892, 313, 2230, 29889, 2230, 580, 448, 260, 29900, 29897, 847, 29871, 29941, 29953, 29900, 29900, 876, 13, 1678, 1320, 29889, 20524, 29918, 5014, 29918, 2972, 580, 565, 4842, 305, 29889, 29883, 6191, 29889, 10141, 29918, 2798, 580, 1405, 29871, 29896, 1683, 6213, 13, 1678, 4842, 305, 29889, 29883, 6191, 29889, 6310, 29918, 8173, 580, 13, 13, 1678, 736, 2582, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1022, 2878, 29879, 742, 1134, 29922, 524, 29892, 2322, 29922, 29945, 29900, 29900, 29897, 29871, 396, 29871, 29945, 29900, 29900, 29906, 29900, 29900, 9853, 267, 472, 24512, 29871, 29896, 29953, 29892, 29871, 29896, 29896, 29955, 29906, 29953, 29941, 4810, 3217, 4558, 353, 29871, 29906, 29955, 29941, 21502, 12168, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16175, 29899, 2311, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29953, 29897, 29871, 396, 11828, 24512, 353, 9853, 29918, 2311, 334, 18414, 5987, 353, 29871, 29896, 29953, 334, 29871, 29946, 353, 29871, 29953, 29946, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 5753, 398, 5987, 742, 1134, 29922, 524, 29892, 2322, 29922, 29946, 29892, 1371, 2433, 16175, 267, 304, 18414, 5987, 1434, 5994, 5281, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16859, 742, 1134, 29922, 710, 29892, 2322, 2433, 16859, 29914, 29891, 324, 586, 29941, 29899, 25649, 29899, 29896, 25932, 29918, 29896, 29889, 16859, 742, 1371, 2433, 10521, 16859, 2224, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1272, 742, 1134, 29922, 710, 29892, 2322, 2433, 1272, 29914, 29883, 6235, 29906, 29900, 29896, 29955, 29889, 1272, 742, 1371, 2433, 10521, 1272, 2224, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 9910, 29899, 7052, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 328, 5143, 313, 29953, 29955, 29995, 448, 29871, 29896, 29945, 29900, 10997, 10153, 29918, 2311, 1432, 29871, 29896, 29900, 9853, 267, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2492, 29899, 2311, 742, 302, 5085, 2433, 29974, 742, 1134, 29922, 524, 29892, 2322, 11759, 29941, 29906, 29900, 1402, 1371, 2433, 14968, 322, 1243, 1967, 29899, 29879, 7093, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1621, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 1621, 6825, 6694, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 690, 2017, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 690, 2017, 6694, 515, 1833, 29889, 415, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 17639, 1351, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 6194, 4078, 2186, 1423, 3149, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1333, 342, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 6194, 1243, 2186, 21502, 305, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29872, 1555, 345, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 29872, 1555, 345, 11266, 16744, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 21454, 742, 1134, 29922, 710, 29892, 2322, 2433, 742, 1371, 2433, 3174, 4422, 20968, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 8173, 29899, 8346, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 8173, 4558, 363, 8473, 6694, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 705, 5861, 742, 1134, 29922, 710, 29892, 2322, 2433, 742, 1371, 2433, 11228, 18177, 2224, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 5666, 742, 1134, 29922, 710, 29892, 2322, 2433, 4381, 742, 1371, 2433, 29891, 3543, 11258, 1495, 29871, 396, 2322, 29892, 318, 4741, 29892, 318, 29933, 4741, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 978, 742, 2322, 2433, 742, 1371, 2433, 1267, 1280, 2582, 29889, 3945, 304, 2582, 29918, 978, 29889, 3945, 565, 19056, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 10141, 742, 2322, 2433, 742, 1371, 2433, 10141, 1178, 313, 29875, 29889, 29872, 29889, 29871, 29900, 470, 29871, 29900, 29892, 29896, 470, 26403, 29897, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 328, 314, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 1509, 594, 314, 5994, 3950, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 14369, 29899, 25932, 742, 3158, 2433, 8899, 29918, 3009, 742, 1371, 2433, 14968, 408, 2323, 29899, 1990, 8783, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1707, 742, 1134, 29922, 7411, 29892, 1371, 2433, 8382, 2286, 1495, 13, 1678, 3523, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 3523, 29889, 705, 5861, 353, 1833, 565, 3523, 29889, 690, 2017, 1683, 3523, 29889, 705, 5861, 13, 1678, 1596, 29898, 3670, 29897, 13, 1678, 4742, 353, 4842, 305, 29918, 13239, 29889, 2622, 29918, 10141, 29898, 3670, 29889, 10141, 29892, 9853, 29918, 2311, 29922, 3670, 29889, 16175, 29918, 2311, 29897, 13, 1678, 396, 6287, 10163, 1839, 5415, 2033, 491, 10153, 29918, 2311, 313, 29872, 1555, 1490, 472, 29871, 29941, 29906, 29900, 29897, 13, 1678, 396, 10163, 1839, 5415, 2033, 334, 29922, 3523, 29889, 2492, 29918, 2311, 29961, 29900, 29962, 847, 29871, 29941, 29906, 29900, 29889, 13, 13, 1678, 260, 29890, 29918, 13236, 353, 6213, 13, 1678, 565, 451, 3523, 29889, 29872, 1555, 345, 29901, 29871, 396, 28186, 12891, 13, 4706, 1018, 29901, 13, 9651, 396, 7370, 323, 6073, 3377, 411, 376, 20158, 3377, 1192, 1188, 3972, 29922, 3389, 29879, 613, 1776, 472, 1732, 597, 7640, 29901, 29953, 29900, 29900, 29953, 29914, 13, 9651, 515, 4842, 305, 29889, 13239, 29889, 20158, 3377, 1053, 6991, 5219, 10507, 13, 13, 9651, 260, 29890, 29918, 13236, 353, 6991, 5219, 10507, 580, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 13, 4706, 7945, 580, 29871, 396, 7945, 12891, 13, 13, 1678, 1683, 29901, 29871, 396, 382, 1555, 345, 11266, 16744, 313, 25253, 29897, 13, 4706, 3523, 29889, 1333, 342, 29892, 3523, 29889, 17639, 1351, 353, 5852, 29892, 5852, 29871, 396, 871, 1243, 29914, 7620, 2186, 21502, 305, 13, 4706, 565, 3523, 29889, 21454, 29901, 13, 9651, 2897, 29889, 5205, 877, 3174, 4422, 21447, 330, 29879, 597, 29995, 29879, 29914, 29872, 1555, 345, 29889, 3945, 869, 29915, 1273, 3523, 29889, 21454, 29897, 29871, 396, 5142, 15220, 345, 29889, 3945, 565, 4864, 13, 13, 4706, 363, 903, 297, 3464, 29898, 29896, 1125, 29871, 396, 1176, 800, 304, 15220, 345, 13, 9651, 565, 2897, 29889, 2084, 29889, 9933, 877, 29872, 1555, 345, 29889, 3945, 29374, 29871, 396, 565, 15220, 345, 29889, 3945, 4864, 29901, 1831, 1900, 7498, 567, 322, 5478, 403, 13, 18884, 396, 7605, 3847, 29898, 29879, 29897, 13, 18884, 3847, 353, 525, 14369, 29915, 29871, 396, 3847, 9262, 1158, 29901, 525, 14369, 29915, 470, 525, 7915, 287, 29915, 13, 18884, 921, 353, 7442, 29889, 1359, 3945, 877, 29872, 1555, 345, 29889, 3945, 742, 29871, 299, 1195, 29922, 29906, 29897, 13, 18884, 302, 353, 1375, 29898, 29945, 29892, 7431, 29898, 29916, 876, 29871, 396, 1353, 310, 3517, 2582, 304, 2050, 13, 18884, 921, 353, 921, 29961, 9302, 29889, 5085, 441, 6278, 9202, 2264, 29898, 29916, 876, 3816, 29901, 29876, 29962, 29871, 396, 2246, 302, 5478, 800, 13, 18884, 281, 353, 6216, 2264, 29898, 29916, 29897, 448, 6216, 2264, 29898, 29916, 467, 1195, 580, 29871, 396, 18177, 13, 18884, 565, 3847, 1275, 525, 14369, 29915, 470, 7431, 29898, 29916, 29897, 1275, 29871, 29896, 29901, 13, 462, 1678, 396, 921, 353, 921, 29961, 8172, 29889, 9502, 524, 29898, 29900, 29892, 302, 448, 29871, 29896, 4638, 29871, 396, 4036, 9262, 13, 462, 1678, 921, 353, 921, 29961, 8172, 29889, 1859, 1575, 29898, 3881, 29898, 29876, 511, 18177, 29922, 29893, 9601, 29900, 5262, 29871, 396, 7688, 287, 9262, 13, 18884, 25342, 3847, 1275, 525, 7915, 287, 2396, 13, 462, 1678, 921, 353, 313, 29916, 334, 281, 29889, 690, 14443, 29898, 29876, 29892, 29871, 29896, 8106, 2083, 29898, 29900, 29897, 847, 281, 29889, 2083, 580, 29871, 396, 7688, 287, 10296, 13, 13, 18884, 396, 20749, 403, 13, 18884, 1158, 29892, 22326, 29892, 269, 353, 29871, 29941, 29892, 29871, 29900, 29889, 29929, 29892, 29871, 29900, 29889, 29906, 29871, 396, 1158, 29892, 5478, 362, 6976, 29892, 269, 2934, 13, 18884, 302, 558, 353, 7442, 29889, 8172, 13, 18884, 302, 558, 29889, 26776, 29898, 524, 29898, 2230, 29889, 2230, 22130, 13, 18884, 330, 353, 7442, 29889, 2378, 4197, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 869, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 2314, 29871, 396, 330, 2708, 13, 18884, 8736, 353, 7431, 29898, 29887, 29897, 13, 18884, 565, 1158, 1275, 29871, 29896, 29901, 13, 462, 1678, 325, 353, 313, 29876, 558, 29889, 9502, 29876, 29898, 865, 29897, 334, 302, 558, 29889, 8172, 580, 334, 330, 334, 269, 718, 29871, 29896, 29897, 3579, 29871, 29906, 29889, 29900, 13, 18884, 25342, 1158, 1275, 29871, 29906, 29901, 13, 462, 1678, 325, 353, 313, 29876, 558, 29889, 9502, 29876, 29898, 865, 29897, 334, 302, 558, 29889, 8172, 29898, 865, 29897, 334, 330, 334, 269, 718, 29871, 29896, 29897, 3579, 29871, 29906, 29889, 29900, 13, 18884, 25342, 1158, 1275, 29871, 29941, 29901, 13, 462, 1678, 325, 353, 7442, 29889, 2873, 29898, 865, 29897, 13, 462, 1678, 1550, 599, 29898, 29894, 1275, 29871, 29896, 1125, 29871, 396, 5478, 403, 2745, 263, 1735, 10008, 313, 18921, 20955, 29897, 13, 462, 4706, 396, 325, 353, 313, 29887, 334, 313, 29876, 558, 29889, 8172, 29898, 865, 29897, 529, 22326, 29897, 334, 302, 558, 29889, 9502, 29876, 29898, 865, 29897, 334, 269, 718, 29871, 29896, 29897, 3579, 29871, 29906, 29889, 29900, 13, 462, 4706, 325, 353, 313, 29887, 334, 313, 29876, 558, 29889, 8172, 29898, 865, 29897, 529, 22326, 29897, 334, 302, 558, 29889, 9502, 29876, 29898, 865, 29897, 334, 302, 558, 29889, 8172, 580, 334, 269, 718, 29871, 29896, 467, 24049, 29898, 29900, 29889, 29941, 29892, 29871, 29941, 29889, 29900, 29897, 13, 18884, 363, 474, 29892, 413, 297, 26985, 29898, 29882, 1478, 29889, 8149, 580, 1125, 29871, 396, 14770, 29889, 29882, 391, 29898, 29894, 29889, 336, 955, 3285, 29871, 29941, 29900, 29900, 29897, 13, 462, 1678, 10163, 29961, 29895, 29962, 353, 921, 29961, 29875, 718, 29871, 29955, 29962, 334, 325, 29961, 29875, 29962, 29871, 396, 5478, 403, 13, 13, 9651, 396, 315, 3466, 304, 13071, 13, 9651, 6611, 353, 6024, 29212, 29900, 742, 525, 29875, 283, 29918, 29873, 742, 525, 29885, 2932, 398, 742, 525, 7915, 29918, 7099, 388, 742, 525, 29882, 4501, 29918, 29879, 742, 525, 29882, 4501, 29918, 29894, 742, 525, 21652, 742, 525, 7052, 742, 525, 1579, 29918, 4283, 2033, 13, 9651, 13071, 353, 17288, 29896, 29872, 29899, 29945, 29892, 29871, 29896, 29872, 29899, 29906, 511, 313, 29900, 29889, 29900, 29900, 29892, 29871, 29900, 29889, 29955, 29900, 511, 313, 29900, 29889, 29953, 29900, 29892, 29871, 29900, 29889, 29929, 29947, 511, 313, 29900, 29892, 29871, 29900, 29889, 29900, 29900, 29896, 511, 313, 29900, 29892, 869, 29929, 511, 313, 29900, 29892, 869, 29929, 511, 313, 29900, 29892, 869, 29929, 511, 313, 29900, 29892, 869, 29929, 511, 313, 29900, 29892, 29871, 29941, 4638, 13, 9651, 363, 413, 29892, 325, 297, 14319, 29898, 8149, 29892, 13071, 1125, 13, 18884, 10163, 29961, 29895, 29962, 353, 7442, 29889, 24049, 29898, 29882, 1478, 29961, 29895, 1402, 325, 29961, 29900, 1402, 325, 29961, 29896, 2314, 13, 13, 9651, 396, 28186, 5478, 362, 13, 9651, 2582, 353, 7945, 580, 13, 13, 9651, 396, 14350, 5478, 362, 2582, 13, 9651, 1596, 29918, 6149, 362, 29898, 29882, 1478, 29892, 2582, 29892, 3523, 29889, 21454, 29897, 13, 13, 9651, 396, 18399, 2582, 13, 9651, 396, 6492, 29918, 29872, 4068, 29918, 9902, 29898, 29882, 1478, 29897, 13, 2 ]
app/models/dbmodel.py
hashtrip/api
1
77269
from datetime import datetime from typing import Optional from pydantic import BaseModel, Field from bson import ObjectId from .util import ObjID class DateTimeModelMixin(BaseModel): created_at: Optional[datetime] = Field(None, alias="createdAt") updated_at: Optional[datetime] = Field(None, alias="updatedAt") class DBModelMixin(DateTimeModelMixin): id: Optional[ObjID] = Field(None, alias="_id") class Config: allow_population_by_field_name = True json_encoders = { ObjectId: lambda x: str(x), }
[ 1, 515, 12865, 1053, 12865, 13, 3166, 19229, 1053, 28379, 13, 13, 3166, 282, 2941, 7716, 1053, 7399, 3195, 29892, 8989, 13, 3166, 289, 1100, 1053, 4669, 1204, 13, 3166, 869, 4422, 1053, 4250, 29926, 1367, 13, 13, 13, 1990, 12315, 3195, 29924, 861, 262, 29898, 5160, 3195, 1125, 13, 1678, 2825, 29918, 271, 29901, 28379, 29961, 12673, 29962, 353, 8989, 29898, 8516, 29892, 13995, 543, 11600, 4178, 1159, 13, 1678, 4784, 29918, 271, 29901, 28379, 29961, 12673, 29962, 353, 8989, 29898, 8516, 29892, 13995, 543, 21402, 4178, 1159, 13, 13, 13, 1990, 6535, 3195, 29924, 861, 262, 29898, 11384, 3195, 29924, 861, 262, 1125, 13, 1678, 1178, 29901, 28379, 29961, 9930, 1367, 29962, 353, 8989, 29898, 8516, 29892, 13995, 543, 29918, 333, 1159, 13, 13, 1678, 770, 12782, 29901, 13, 4706, 2758, 29918, 7323, 2785, 29918, 1609, 29918, 2671, 29918, 978, 353, 5852, 13, 4706, 4390, 29918, 3977, 397, 414, 353, 426, 13, 9651, 4669, 1204, 29901, 14013, 921, 29901, 851, 29898, 29916, 511, 13, 4706, 500, 13, 2 ]
validate.py
saravanabalagi/vae_collection
0
128473
<gh_stars>0 from experiment import VAEXperiment import argparse import yaml from utils import get_model_module import torch import torch.backends.cudnn as cudnn import pytorch_lightning as pl from pytorch_lightning.loggers import TestTubeLogger import numpy as np import os parser = argparse.ArgumentParser() parser.add_argument('ckpt_path', help='path to checkpoint file') args = parser.parse_args() ckpt_path = args.ckpt_path exp_path = os.path.dirname(os.path.dirname(ckpt_path)) # load config with open(os.path.join(exp_path, 'config.yaml'), 'r') as file: try: config = yaml.safe_load(file) except yaml.YAMLError as exc: print(exc) tt_logger = TestTubeLogger( save_dir=config['logging_params']['save_dir'], name=config['logging_params']['name'], debug=False, create_git_tag=False, ) # For reproducibility torch.manual_seed(config['logging_params']['manual_seed']) np.random.seed(config['logging_params']['manual_seed']) cudnn.deterministic = True cudnn.benchmark = False model_module = get_model_module(exp_path, config) model = model_module(**config['model_params']) experiment = VAEXperiment.load_from_checkpoint(ckpt_path, vae_model=model, params=config) trainer = pl.Trainer(default_root_dir=f"{tt_logger.save_dir}", logger=tt_logger, **config['trainer_params']) trainer.validate(experiment)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 7639, 1053, 478, 29909, 5746, 15362, 13, 5215, 1852, 5510, 13, 5215, 343, 8807, 13, 3166, 3667, 29879, 1053, 679, 29918, 4299, 29918, 5453, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 1627, 1975, 29889, 29883, 566, 15755, 408, 274, 566, 15755, 13, 5215, 282, 3637, 25350, 29918, 4366, 1076, 408, 715, 13, 3166, 282, 3637, 25350, 29918, 4366, 1076, 29889, 1188, 5743, 1053, 4321, 13425, 16363, 13, 5215, 12655, 408, 7442, 13, 5215, 2897, 13, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 16680, 29889, 1202, 29918, 23516, 877, 384, 415, 29918, 2084, 742, 1371, 2433, 2084, 304, 1423, 3149, 934, 1495, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 384, 415, 29918, 2084, 353, 6389, 29889, 384, 415, 29918, 2084, 13, 4548, 29918, 2084, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 29898, 384, 415, 29918, 2084, 876, 13, 13, 29937, 2254, 2295, 13, 2541, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4548, 29918, 2084, 29892, 525, 2917, 29889, 25162, 5477, 525, 29878, 1495, 408, 934, 29901, 13, 1678, 1018, 29901, 13, 4706, 2295, 353, 343, 8807, 29889, 11177, 29918, 1359, 29898, 1445, 29897, 13, 1678, 5174, 343, 8807, 29889, 29979, 5194, 1307, 24616, 408, 5566, 29901, 13, 4706, 1596, 29898, 735, 29883, 29897, 13, 13, 698, 29918, 21707, 353, 4321, 13425, 16363, 29898, 13, 1678, 4078, 29918, 3972, 29922, 2917, 1839, 21027, 29918, 7529, 16215, 7620, 29918, 3972, 7464, 13, 1678, 1024, 29922, 2917, 1839, 21027, 29918, 7529, 16215, 978, 7464, 13, 1678, 4744, 29922, 8824, 29892, 13, 1678, 1653, 29918, 5559, 29918, 4039, 29922, 8824, 29892, 13, 29897, 13, 13, 29937, 1152, 9483, 455, 29890, 1793, 13, 7345, 305, 29889, 11288, 29918, 26776, 29898, 2917, 1839, 21027, 29918, 7529, 16215, 11288, 29918, 26776, 11287, 13, 9302, 29889, 8172, 29889, 26776, 29898, 2917, 1839, 21027, 29918, 7529, 16215, 11288, 29918, 26776, 11287, 13, 29883, 566, 15755, 29889, 4801, 837, 262, 4695, 353, 5852, 13, 29883, 566, 15755, 29889, 1785, 16580, 353, 7700, 13, 13, 4299, 29918, 5453, 353, 679, 29918, 4299, 29918, 5453, 29898, 4548, 29918, 2084, 29892, 2295, 29897, 13, 4299, 353, 1904, 29918, 5453, 29898, 1068, 2917, 1839, 4299, 29918, 7529, 11287, 13, 735, 15362, 353, 478, 29909, 5746, 15362, 29889, 1359, 29918, 3166, 29918, 3198, 3149, 29898, 384, 415, 29918, 2084, 29892, 2947, 29872, 29918, 4299, 29922, 4299, 29892, 8636, 29922, 2917, 29897, 13, 13, 3018, 4983, 353, 715, 29889, 5323, 4983, 29898, 4381, 29918, 4632, 29918, 3972, 29922, 29888, 29908, 29912, 698, 29918, 21707, 29889, 7620, 29918, 3972, 17671, 13, 462, 17927, 29922, 698, 29918, 21707, 29892, 13, 462, 3579, 2917, 1839, 3018, 4983, 29918, 7529, 11287, 13, 3018, 4983, 29889, 15480, 29898, 735, 15362, 29897, 13, 2 ]
post/api/views.py
agiledesign2/drf-blog-post
0
96961
<gh_stars>0 from django.contrib.auth.models import User from django.shortcuts import get_object_or_404 from rest_framework import generics, permissions from rest_framework import viewsets from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.reverse import reverse #from rest_framework.filters import SearchFilter, OrderingFilter from django.db.models import F from .permissions import IsOwnerOrReadOnly from post.models import Post from .serializers import * from .pagination import * class PostList(generics.ListCreateAPIView): queryset = Post.objects.all() permission_classes = (permissions.IsAuthenticatedOrReadOnly, permissions.IsAdminUser) serializer_class = PostListSerializer name = 'post' filter_fields = ( 'title', ) search_fields = ( '^title', ) ordering_fields = ( 'title', ) def get_queryset(self): if self.request.user.is_staff: return Post.objects.all() else: return Post.objects.published() def get_serializer_class(self): if self.request.method == 'POST': return PostCreateSerializer else: return PostListSerializer def list(self, request): #super.(PostList, self).list() # Note the use of `get_queryset()` instead of `self.queryset` queryset = self.get_queryset() context={'request': request} serializer = PostListSerializer(queryset, many=True, context=context) return Response(serializer.data) def perform_create(self, serializer): serializer.save(author=self.request.user) class PostDetail(generics.RetrieveUpdateDestroyAPIView): queryset = Post.objects.all() permission_classes = (permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly) serializer_class = PostDetailSerializer lookup_field = 'slug' name = 'post-detail' filter_fields = ( 'title', ) search_fields = ( '^title', ) ordering_fields = ( 'title', ) def get_serializer_class(self): if self.request.method == 'PUT': return PostCreateSerializer else: return PostListSerializer def retrieve(self, request, *args, **kwargs): instance = self.get_object() Post.objects.filter(pk=instance.id).update(views_count=F('views_count') + 1) instance.refresh_from_db() serializer = self.get_serializer(instance) return Response(serializer.data) """ class UserViewSet(viewsets.ReadOnlyModelViewSet): queryset = User.objects.all() serializer_class = UserSerializer filter_backends = [SearchFilter, OrderingFilter] search_fields = ["username"] pagination_class = UserPageNumberPagination """
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 13, 3166, 1791, 29918, 4468, 1053, 1176, 1199, 29892, 11239, 13, 3166, 1791, 29918, 4468, 1053, 1776, 7224, 13, 3166, 1791, 29918, 4468, 29889, 19557, 4097, 1053, 7882, 29918, 1493, 13, 3166, 1791, 29918, 4468, 29889, 5327, 1053, 13291, 13, 3166, 1791, 29918, 4468, 29889, 24244, 1053, 11837, 13, 29937, 3166, 1791, 29918, 4468, 29889, 26705, 1053, 11856, 5072, 29892, 8170, 292, 5072, 13, 3166, 9557, 29889, 2585, 29889, 9794, 1053, 383, 13, 3166, 869, 17858, 6847, 1053, 1317, 28213, 2816, 6359, 11730, 13, 3166, 1400, 29889, 9794, 1053, 4918, 13, 3166, 869, 15550, 19427, 1053, 334, 13, 3166, 869, 13573, 3381, 1053, 334, 13, 13, 1990, 4918, 1293, 29898, 4738, 1199, 29889, 1293, 4391, 8787, 1043, 1125, 13, 1678, 2346, 842, 353, 4918, 29889, 12650, 29889, 497, 580, 13, 1678, 10751, 29918, 13203, 353, 313, 17858, 6847, 29889, 3624, 6444, 4173, 630, 2816, 6359, 11730, 29892, 11239, 29889, 3624, 12754, 2659, 29897, 13, 1678, 7797, 3950, 29918, 1990, 353, 4918, 1293, 17679, 13, 1678, 1024, 353, 525, 2490, 29915, 13, 1678, 4175, 29918, 9621, 353, 313, 13, 4706, 525, 3257, 742, 13, 1678, 1723, 13, 1678, 2740, 29918, 9621, 353, 313, 13, 4706, 525, 29985, 3257, 742, 13, 1678, 1723, 13, 1678, 20520, 29918, 9621, 353, 313, 13, 4706, 525, 3257, 742, 13, 1678, 1723, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 3827, 29889, 1792, 29889, 275, 29918, 303, 3470, 29901, 13, 9651, 736, 4918, 29889, 12650, 29889, 497, 580, 13, 4706, 1683, 29901, 13, 9651, 736, 4918, 29889, 12650, 29889, 5467, 3726, 580, 13, 13, 1678, 822, 679, 29918, 15550, 3950, 29918, 1990, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 3827, 29889, 5696, 1275, 525, 5438, 2396, 13, 9651, 736, 4918, 4391, 17679, 13, 4706, 1683, 29901, 13, 9651, 736, 4918, 1293, 17679, 13, 13, 1678, 822, 1051, 29898, 1311, 29892, 2009, 1125, 13, 4706, 396, 9136, 14030, 6747, 1293, 29892, 1583, 467, 1761, 580, 13, 4706, 396, 3940, 278, 671, 310, 421, 657, 29918, 1972, 842, 2555, 2012, 310, 421, 1311, 29889, 1972, 842, 29952, 13, 4706, 2346, 842, 353, 1583, 29889, 657, 29918, 1972, 842, 580, 13, 4706, 3030, 3790, 29915, 3827, 2396, 2009, 29913, 13, 4706, 7797, 3950, 353, 4918, 1293, 17679, 29898, 1972, 842, 29892, 1784, 29922, 5574, 29892, 3030, 29922, 4703, 29897, 13, 4706, 736, 13291, 29898, 15550, 3950, 29889, 1272, 29897, 13, 13, 1678, 822, 2189, 29918, 3258, 29898, 1311, 29892, 7797, 3950, 1125, 13, 4706, 7797, 3950, 29889, 7620, 29898, 8921, 29922, 1311, 29889, 3827, 29889, 1792, 29897, 13, 13, 13, 1990, 4918, 16570, 29898, 4738, 1199, 29889, 8015, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 1125, 13, 1678, 2346, 842, 353, 4918, 29889, 12650, 29889, 497, 580, 13, 1678, 10751, 29918, 13203, 353, 313, 17858, 6847, 29889, 3624, 6444, 4173, 630, 2816, 6359, 11730, 29892, 1317, 28213, 2816, 6359, 11730, 29897, 13, 1678, 7797, 3950, 29918, 1990, 353, 4918, 16570, 17679, 13, 1678, 16280, 29918, 2671, 353, 525, 29517, 29915, 13, 1678, 1024, 353, 525, 2490, 29899, 16432, 29915, 13, 1678, 4175, 29918, 9621, 353, 313, 13, 4706, 525, 3257, 742, 13, 1678, 1723, 13, 1678, 2740, 29918, 9621, 353, 313, 13, 4706, 525, 29985, 3257, 742, 13, 1678, 1723, 13, 1678, 20520, 29918, 9621, 353, 313, 13, 4706, 525, 3257, 742, 13, 1678, 1723, 13, 13, 1678, 822, 679, 29918, 15550, 3950, 29918, 1990, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 3827, 29889, 5696, 1275, 525, 12336, 2396, 13, 9651, 736, 4918, 4391, 17679, 13, 4706, 1683, 29901, 13, 9651, 736, 4918, 1293, 17679, 13, 13, 1678, 822, 10563, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2777, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 4918, 29889, 12650, 29889, 4572, 29898, 20571, 29922, 8758, 29889, 333, 467, 5504, 29898, 7406, 29918, 2798, 29922, 29943, 877, 7406, 29918, 2798, 1495, 718, 29871, 29896, 29897, 13, 4706, 2777, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 8758, 29897, 13, 4706, 736, 13291, 29898, 15550, 3950, 29889, 1272, 29897, 13, 13, 15945, 29908, 13, 1990, 4911, 1043, 2697, 29898, 1493, 7224, 29889, 6359, 11730, 3195, 1043, 2697, 1125, 13, 1678, 2346, 842, 353, 4911, 29889, 12650, 29889, 497, 580, 13, 1678, 7797, 3950, 29918, 1990, 353, 4911, 17679, 13, 13, 1678, 4175, 29918, 1627, 1975, 353, 518, 7974, 5072, 29892, 8170, 292, 5072, 29962, 13, 1678, 2740, 29918, 9621, 353, 6796, 6786, 3108, 13, 13, 1678, 10203, 3381, 29918, 1990, 353, 4911, 5074, 4557, 29925, 351, 3381, 13, 15945, 29908, 2 ]
tests/test_line.py
themiwi/ggplot
1,133
118617
<gh_stars>1000+ from ggplot import * import pandas as pd import numpy as np import random x = np.arange(100) random.shuffle(x) df = pd.DataFrame({ 'x': x, 'y': np.arange(100) }) print ggplot(df, aes(x='x', y='y')) + geom_line() print ggplot(df, aes(x='x', y='y')) + geom_path()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29900, 29974, 13, 3166, 25662, 1053, 334, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 5215, 4036, 13, 13, 29916, 353, 7442, 29889, 279, 927, 29898, 29896, 29900, 29900, 29897, 13, 8172, 29889, 845, 21897, 29898, 29916, 29897, 13, 13, 2176, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 29916, 2396, 921, 29892, 13, 1678, 525, 29891, 2396, 7442, 29889, 279, 927, 29898, 29896, 29900, 29900, 29897, 13, 1800, 13, 13, 2158, 25662, 29898, 2176, 29892, 263, 267, 29898, 29916, 2433, 29916, 742, 343, 2433, 29891, 8785, 718, 23216, 29918, 1220, 580, 13, 2158, 25662, 29898, 2176, 29892, 263, 267, 29898, 29916, 2433, 29916, 742, 343, 2433, 29891, 8785, 718, 23216, 29918, 2084, 580, 13, 2 ]
modules/templates/WACOP/config.py
mswdresden/AsylumEden
1
22018
# -*- coding: utf-8 -*- from collections import OrderedDict from gluon import current from gluon.storage import Storage def config(settings): """ Template for WA-COP + CAD Cloud Integration """ T = current.T # ========================================================================= # System Settings # settings.base.system_name = T("Sahana: Washington Common Operating Picture (WA-COP)") settings.base.system_name_short = T("Sahana") # Prepop default settings.base.prepopulate += ("WACOP", "default/users", "WACOP/Demo") # Theme (folder to use for views/layout.html) settings.base.theme = "WACOP" settings.ui.social_buttons = True # ------------------------------------------------------------------------- # Self-Registration and User Profile # # Users can self-register settings.security.self_registration = False # Users need to verify their email settings.auth.registration_requires_verification = True # Users need to be approved settings.auth.registration_requires_approval = True settings.auth.registration_requests_organisation = True settings.auth.registration_organisation_required = True # Approval emails get sent to all admins settings.mail.approver = "ADMIN" settings.auth.registration_link_user_to = {"staff": T("Staff")} settings.auth.registration_link_user_to_default = ["staff"] settings.auth.registration_roles = {"organisation_id": ["USER"], } settings.auth.show_utc_offset = False settings.auth.show_link = False # ------------------------------------------------------------------------- # Security Policy # settings.security.policy = 7 # Apply Controller, Function and Table ACLs settings.security.map = True # ------------------------------------------------------------------------- # L10n (Localization) settings # settings.L10n.languages = OrderedDict([ ("en", "English"), ("es", "Español"), ]) # Default Language settings.L10n.default_language = "en" # Default timezone for users settings.L10n.utc_offset = "-0800" # Unsortable 'pretty' date format settings.L10n.date_format = "%b %d %Y" # Number formats (defaults to ISO 31-0) # Decimal separator for numbers (defaults to ,) settings.L10n.decimal_separator = "." # Thousands separator for numbers (defaults to space) settings.L10n.thousands_separator = "," # Default Country Code for telephone numbers settings.L10n.default_country_code = 1 # Enable this to change the label for 'Mobile Phone' settings.ui.label_mobile_phone = "Cell Phone" # Enable this to change the label for 'Postcode' settings.ui.label_postcode = "ZIP Code" settings.msg.require_international_phone_numbers = False # PDF to Letter settings.base.paper_size = T("Letter") # Uncomment this to Translate CMS Series Names # - we want this on when running s3translate but off in normal usage as we use the English names to lookup icons in render_posts #settings.L10n.translate_cms_series = True # Uncomment this to Translate Location Names #settings.L10n.translate_gis_location = True # Has scalability issues, but should be OK with our number of records settings.search.dates_auto_range = True # ------------------------------------------------------------------------- # GIS settings # # Restrict the Location Selector to just certain countries settings.gis.countries = ("US",) # Levels for the LocationSelector levels = ("L1", "L2", "L3") # Uncomment to pass Addresses imported from CSV to a Geocoder to try and automate Lat/Lon #settings.gis.geocode_imported_addresses = "google" # Until we add support to S3LocationSelector to set dropdowns from LatLons settings.gis.check_within_parent_boundaries = False # GeoNames username settings.gis.geonames_username = "mcop" # Uncomment to hide Layer Properties tool #settings.gis.layer_properties = False # Uncomment to display the Map Legend as a floating DIV settings.gis.legend = "float" # Uncomment to prevent showing LatLon in Location Represents settings.gis.location_represent_address_only = "icon" # Resources which can be directly added to the main map settings.gis.poi_create_resources = None # ------------------------------------------------------------------------- # Modules # settings.modules = OrderedDict([ # Core modules which shouldn't be disabled ("default", Storage( name_nice = "Home", restricted = False, # Use ACLs to control access to this module access = None, # All Users (inc Anonymous) can see this module in the default menu & access the controller module_type = None # This item is not shown in the menu )), ("admin", Storage( name_nice = "Administration", #description = "Site Administration", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu & access the controller module_type = None # This item is handled separately for the menu )), ("appadmin", Storage( name_nice = "Administration", #description = "Site Administration", restricted = True, module_type = None # No Menu )), # ("errors", Storage( # name_nice = "Ticket Viewer", # #description = "Needed for Breadcrumbs", # restricted = False, # module_type = None # No Menu # )), ("sync", Storage( name_nice = "Synchronization", #description = "Synchronization", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu & access the controller module_type = None # This item is handled separately for the menu )), #("translate", Storage( # name_nice = "Translation Functionality", # #description = "Selective translation of strings based on module.", # module_type = None, #)), ("gis", Storage( name_nice = "Map", #description = "Situation Awareness & Geospatial Analysis", restricted = True, module_type = 1, # 1st item in the menu )), ("pr", Storage( name_nice = "Persons", description = "Central point to record details on People", restricted = True, access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) module_type = None )), ("org", Storage( name_nice = "Organizations", #description = 'Lists "who is doing what & where". Allows relief agencies to coordinate their activities', restricted = True, module_type = 10 )), # All modules below here should be possible to disable safely ("hrm", Storage( name_nice = "Contacts", #description = "Human Resources Management", restricted = True, module_type = None, )), ("cms", Storage( name_nice = "Content Management", restricted = True, module_type = 10, )), ("event", Storage( name_nice = "Events", restricted = True, module_type = 2, )), ("fire", Storage( name_nice = "Fire", restricted = True, module_type = None, )), ("police", Storage( name_nice = "Police", restricted = True, module_type = None, )), ("project", Storage( name_nice = "Tasks", restricted = True, module_type = None, )), ("doc", Storage( name_nice = "Documents", #description = "A library of digital resources, such as photos, documents and reports", restricted = True, module_type = None, )), ("stats", Storage( name_nice = "Statistics", restricted = True, module_type = None )), ]) # ------------------------------------------------------------------------- # CMS Content Management # settings.cms.bookmarks = True settings.cms.richtext = True settings.cms.show_tags = True # ------------------------------------------------------------------------- def cms_post_onaccept(form): """ Handle Tags in Create / Update forms """ post_id = form.vars.id db = current.db s3db = current.s3db ttable = s3db.cms_tag ltable = s3db.cms_tag_post # Delete all existing tags for this post db(ltable.post_id == post_id).delete() # Add these tags tags = current.request.post_vars.get("tags") if not tags: return tags = tags.split(",") tag_ids = db(ttable.name.belongs(tags)).select(ttable.id, ttable.name).as_dict(key="name") for tag in tags: row = tag_ids.get("tag") if row: tag_id = row.get("id") else: tag_id = ttable.insert(name=tag) ltable.insert(post_id = post_id, tag_id = tag_id, ) # ------------------------------------------------------------------------- def customise_cms_post_resource(r, tablename): db = current.db s3db = current.s3db table = s3db.cms_post table.priority.readable = table.priority.writable = True table.series_id.readable = table.series_id.writable = True table.status_id.readable = table.status_id.writable = True method = r.method if method in ("create", "update"): # Custom Form from s3 import S3SQLCustomForm, S3SQLInlineComponent crud_fields = [(T("Type"), "series_id"), (T("Priority"), "priority"), (T("Status"), "status_id"), (T("Title"), "title"), (T("Text"), "body"), (T("Location"), "location_id"), # Tags are added client-side S3SQLInlineComponent("document", name = "file", label = T("Files"), fields = [("", "file"), #"comments", ], ), ] if r.tablename != "event_incident": if r.tablename == "event_event": from gluon import IS_EMPTY_OR from s3 import IS_ONE_OF itable = s3db.event_incident query = (itable.event_id == r.id) & \ (itable.closed == False) & \ (itable.deleted == False) set = db(query) f = s3db.event_post.incident_id f.requires = IS_EMPTY_OR( IS_ONE_OF(set, "event_incident.id", f.represent, orderby="event_incident.name", sort=True)) crud_fields.insert(0, S3SQLInlineComponent("incident_post", fields = [("", "incident_id")], label = T("Incident"), multiple = False, )) crud_form = S3SQLCustomForm(*crud_fields ) # Client support for Tags appname = r.application s3 = current.response.s3 scripts_append = s3.scripts.append if s3.debug: scripts_append("/%s/static/scripts/tag-it.js" % appname) else: scripts_append("/%s/static/scripts/tag-it.min.js" % appname) scripts_append("/%s/static/themes/WACOP/js/update_tags.js" % appname) if method == "create": s3.jquery_ready.append('''wacop_update_tags("")''') elif method == "update": ttable = s3db.cms_tag ltable = s3db.cms_tag_post if r.tablename == "cms_post": post_id = r.id else: post_id = r.component.id query = (ltable.post_id == post_id) & \ (ltable.tag_id == ttable.id) tags = db(query).select(ttable.name) tags = [tag.name for tag in tags] tags = ",".join(tags) s3.jquery_ready.append('''wacop_update_tags("%s")''' % tags) # Processing Tags default = s3db.get_config(tablename, "onaccept") if isinstance(default, list): onaccept = default onaccept.append(cms_post_onaccept) else: onaccept = [default, cms_post_onaccept] s3db.configure(tablename, crud_form = crud_form, onaccept = onaccept, ) elif method in ("custom", "datalist", "filter"): # dataList configuration from templates.WACOP.controllers import cms_post_list_layout s3 = current.response.s3 s3.dl_no_header = True s3db.configure(tablename, list_fields = ["series_id", "priority", "status_id", "date", "title", "body", "created_by", "tag.name", "document.file", "comment.id", #"comment.body", # Extra fields come in unsorted, so can't match up to records #"comment.created_by", #"comment.created_on", ], list_layout = cms_post_list_layout, # Default #orderby = "cms_post.date desc", ) if method in ("custom", "filter"): # Filter Widgets from s3 import S3DateFilter, \ S3LocationFilter, \ S3OptionsFilter, \ S3TextFilter if method == "filter": # Apply filter_vars get_vars = r.get_vars for k, v in get_vars.iteritems(): # We only expect a maximum of 1 of these, no need to append from s3 import FS s3.filter = (FS(k) == v) date_filter = S3DateFilter("date", # If we introduce an end_date on Posts: #["date", "end_date"], label = "", #hide_time = True, slider = True, clear_text = "X", ) date_filter.input_labels = {"ge": "Start Time/Date", "le": "End Time/Date"} from templates.WACOP.controllers import text_filter_formstyle filter_widgets = [S3TextFilter(["body", ], formstyle = text_filter_formstyle, label = T("Search"), _placeholder = T("Enter search term…"), ), S3OptionsFilter("series_id", label = "", noneSelectedText = "Type", # T() added in widget no_opts = "", ), S3OptionsFilter("priority", label = "", noneSelectedText = "Priority", # T() added in widget no_opts = "", ), S3OptionsFilter("status_id", label = "", noneSelectedText = "Status", # T() added in widget no_opts = "", ), S3OptionsFilter("created_by$organisation_id", label = "", noneSelectedText = "Source", # T() added in widget no_opts = "", ), S3OptionsFilter("tag_post.tag_id", label = "", noneSelectedText = "Tag", # T() added in widget no_opts = "", ), date_filter, ] if r.tablename == "event_event" or \ (method == "filter" and get_vars.get("event_post.event_id")): # Event Profile filter_widgets.insert(1, S3OptionsFilter("incident_post.incident_id", label = "", noneSelectedText = "Incident", # T() added in widget no_opts = "", )) user = current.auth.user if user: filter_widgets.insert(1, S3OptionsFilter("bookmark.user_id", label = "", options = {"*": T("All"), user.id: T("My Bookmarks"), }, cols = 2, multiple = False, table = False, )) s3db.configure(tablename, filter_widgets = filter_widgets, ) settings.customise_cms_post_resource = customise_cms_post_resource # ------------------------------------------------------------------------- # Event/Incident Management # settings.event.incident_teams_tab = "Units" # Uncomment to preserve linked Incidents when an Event is deleted settings.event.cascade_delete_incidents = False # ------------------------------------------------------------------------- def customise_event_event_resource(r, tablename): from gluon import A, URL from s3 import s3_fieldmethod db = current.db s3db = current.s3db # Virtual Fields etable = s3db.event_event #append = etable._virtual_methods.append def event_name(row): return A(row["event_event.name"], _href = URL(c="event", f="event", args=[row["event_event.id"], "custom"], extension = "", # ensure no .aadata ), ) #append(Field.Method("name_click", event_name)) etable.name_click = s3_fieldmethod("name_click", event_name, # over-ride the default represent of s3_unicode to prevent HTML being rendered too early represent = lambda v: v, ) def event_status(row): if row["event_event.exercise"]: status = T("Testing") elif not row["event_event.end_date"]: status = T("Open") else: status = T("Closed") return status #append(Field.Method("status", event_status)) etable.status = s3_fieldmethod("status", event_status) itable = s3db.event_incident def event_incidents(row): query = (itable.event_id == row["event_event.id"]) & \ (itable.deleted == False) incidents = db(query).count() return incidents #append(Field.Method("incidents", event_incidents)) etable.incidents = s3_fieldmethod("incidents", event_incidents) ertable = s3db.event_team def event_resources(row): query = (ertable.event_id == row["event_event.id"]) & \ (ertable.deleted == False) resources = db(query).count() return resources #append(Field.Method("resources", event_resources)) etable.resources = s3_fieldmethod("resources", event_resources) ettable = s3db.event_tag ttable = s3db.cms_tag def event_tags(row): query = (ettable.event_id == row["event_event.id"]) & \ (ettable.deleted == False) & \ (ettable.tag_id == ttable.id) tags = db(query).select(ttable.name) if tags: tags = [t.name for t in tags] tags = ", ".join(tags) return tags else: return current.messages["NONE"] #append(Field.Method("tags", event_tags)) etable.tags = s3_fieldmethod("tags", event_tags) list_fields = [(T("Name"), "name_click"), (T("Status"), "status"), (T("Zero Hour"), "start_date"), (T("Closed"), "end_date"), (T("City"), "location.location_id.L3"), (T("State"), "location.location_id.L1"), (T("Tags"), "tags"), (T("Incidents"), "incidents"), (T("Resources"), "resources"), ] s3db.configure(tablename, extra_fields = ("name", "end_date", "exercise", ), list_fields = list_fields, orderby = "event_event.name", ) settings.customise_event_event_resource = customise_event_event_resource # ------------------------------------------------------------------------- def customise_event_event_controller(**attr): s3db = current.s3db s3 = current.response.s3 # Modify Components s3db.add_components("event_event", # Events have just a single Location event_event_location = {"joinby": "event_id", "multiple": False, }, # Incidents are linked to Events, not created from them # - not a link table though, so can't change the actuation #event_incident = {"joinby": "event_id", # }, ) # Custom Browse from templates.WACOP.controllers import event_Browse, event_Profile set_method = s3db.set_method set_method("event", "event", method = "browse", action = event_Browse) # Custom Profile set_method("event", "event", method = "custom", action = event_Profile) # Custom prep standard_prep = s3.prep def custom_prep(r): # Call standard postp if callable(standard_prep): result = standard_prep(r) cname = r.component_name if not cname: f = s3db.event_event.event_type_id f.readable = f.writable = False elif cname == "task": from gluon import IS_EMPTY_OR from s3 import IS_ONE_OF, S3SQLCustomForm, S3SQLInlineComponent itable = s3db.event_incident query = (itable.event_id == r.id) & \ (itable.closed == False) & \ (itable.deleted == False) set = current.db(query) f = s3db.event_task.incident_id f.requires = IS_EMPTY_OR( IS_ONE_OF(set, "event_incident.id", f.represent, orderby="event_incident.name", sort=True)) crud_form = S3SQLCustomForm( S3SQLInlineComponent("incident", fields = [("", "incident_id")], label = T("Incident"), multiple = False, filterby = dict(field = "event_id", options = r.id, ) ), "name", "description", "source", "priority", "pe_id", "date_due", "status", "comments", ) r.component.configure(crud_form = crud_form, ) elif r.representation == "popup" and r.get_vars.get("view"): # Popups for lists in Parent Event of Incident Screen or Event Profile header # No Title since this is on the Popup s3.crud_strings["event_event"].title_display = "" # No create button & Tweak list_fields if cname == "incident": list_fields = ["date", "name", "incident_type_id", ] elif cname == "group": list_fields = ["incident_id", "group_id", "status_id", ] elif cname == "post": list_fields = ["date", "series_id", "priority", "status_id", "body", ] else: # Shouldn't get here but want to avoid crashes list_fields = [] r.component.configure(insertable = False, list_fields = list_fields, ) return True s3.prep = custom_prep # Custom rheader tabs attr = dict(attr) attr["rheader"] = wacop_event_rheader return attr settings.customise_event_event_controller = customise_event_event_controller # ------------------------------------------------------------------------- def customise_event_incident_resource(r, tablename): from gluon import A, URL from s3 import s3_fieldmethod s3db = current.s3db # Virtual Fields itable = s3db.event_incident #append = itable._virtual_methods.append def incident_name(row): return A(row["event_incident.name"], _href = URL(c="event", f="incident", args=[row["event_incident.id"], "custom"], extension = "", # ensure no .aadata ), ) #append(Field.Method("name_click", incident_name)) itable.name_click = s3_fieldmethod("name_click", incident_name, # over-ride the default represent of s3_unicode to prevent HTML being rendered too early represent = lambda v: v, ) def incident_status(row): if row["event_incident.exercise"]: status = T("Testing") elif not row["event_incident.end_date"]: status = T("Open") else: status = T("Closed") return status #append(Field.Method("status", incident_status)) itable.status = s3_fieldmethod("status", incident_status) if r.method == "browse" or r.get_vars.get("browse"): # Incident Browse db = current.db ertable = s3db.event_team def incident_resources(row): query = (ertable.event_id == row["event_incident.id"]) & \ (ertable.deleted == False) resources = db(query).count() return resources #append(Field.Method("resources", incident_resources)) itable.resources = s3_fieldmethod("resources", incident_resources) ettable = s3db.event_tag ttable = s3db.cms_tag def incident_tags(row): query = (ettable.incident_id == row["event_incident.id"]) & \ (ettable.deleted == False) & \ (ettable.tag_id == ttable.id) tags = db(query).select(ttable.name) if tags: tags = [t.name for t in tags] tags = ", ".join(tags) return tags else: return current.messages["NONE"] #append(Field.Method("tags", incident_tags)) itable.tags = s3_fieldmethod("tags", incident_tags) list_fields = [(T("Name"), "name_click"), (T("Status"), "status"), (T("Type"), "incident_type_id"), (T("Zero Hour"), "date"), (T("Closed"), "end_date"), (T("City"), "location.location_id.L3"), (T("State"), "location.location_id.L1"), (T("Tags"), "tags"), (T("Resources"), "resources"), (T("Event"), "event_id"), ] else: # Homepage or Event Profile list_fields = [(T("Name"), "name_click"), (T("Status"), "status"), (T("Type"), "incident_type_id"), "location_id", (T("Start"), "date"), ] s3db.configure(tablename, extra_fields = ("name", "end_date", "exercise", ), list_fields = list_fields, orderby = "event_incident.name", ) settings.customise_event_incident_resource = customise_event_incident_resource # ------------------------------------------------------------------------- def customise_event_incident_controller(**attr): s3db = current.s3db response = current.response s3 = response.s3 # Load normal model to be able to override configuration table = s3db.event_incident table.event_id.readable = table.event_id.writable = True # Custom Browse from templates.WACOP.controllers import incident_Browse, incident_Profile set_method = s3db.set_method set_method("event", "incident", method = "browse", action = incident_Browse) # Custom Profile set_method("event", "incident", method = "custom", action = incident_Profile) #s3.crud_strings["event_incident"].title_list = T("Browse Incidents") # Custom prep standard_prep = s3.prep def custom_prep(r): # Call standard postp if callable(standard_prep): result = standard_prep(r) if r.method == "assign": current.menu.main = "" elif r.component_name == "task": from s3 import S3SQLCustomForm crud_form = S3SQLCustomForm("name", "description", "source", "priority", "pe_id", "date_due", "status", "comments", ) r.component.configure(crud_form = crud_form, ) elif r.representation == "popup": if not r.component: if r.get_vars.get("set_event"): # Popup just used to link to Event #s3.crud_strings["event_incident"].title_update = T("Add to Event") from s3 import S3SQLCustomForm crud_form = S3SQLCustomForm("event_id", ) s3db.configure("event_incident", crud_form = crud_form, ) #elif r.component_name == "post": # from s3 import S3SQLCustomForm # crud_form = S3SQLCustomForm("body", # ) # s3db.configure("cms_post", # crud_form = crud_form, # ) return True s3.prep = custom_prep # Custom postp standard_postp = s3.postp def custom_postp(r, output): # Call standard postp if callable(standard_postp): output = standard_postp(r, output) if r.interactive and isinstance(output, dict): if r.method == "assign": # No Top Menu current.menu.main = "" # Custom View to waste less space inside popup import os response.view = os.path.join(r.folder, "modules", "templates", "WACOP", "views", "assign.html") #elif r.component_name == "post": # # Add Tags - no, do client-side # output["form"].append() #else: # # Summary or Profile pages # # Additional styles # s3.external_stylesheets += ["https://cdn.knightlab.com/libs/timeline3/latest/css/timeline.css", # "https://fonts.googleapis.com/css?family=Merriweather:400,700|Source+Sans+Pro:400,700", # ] #if r.method == "summary": # # Open the Custom profile page instead of the normal one # from gluon import URL # from s3 import S3CRUD # custom_url = URL(args = ["[id]", "custom"]) # S3CRUD.action_buttons(r, # read_url=custom_url, # update_url=custom_url) # # System-wide Alert # from templates.WACOP.controllers import custom_WACOP # custom = custom_WACOP() # output["system_wide"] = custom._system_wide_html() return output s3.postp = custom_postp # Custom rheader tabs #attr = dict(attr) #attr["rheader"] = wacop_event_rheader attr["rheader"] = None # No sidebar menu current.menu.options = None return attr settings.customise_event_incident_controller = customise_event_incident_controller # ------------------------------------------------------------------------- def customise_event_human_resource_resource(r, tablename): from gluon import A, URL from s3 import s3_fieldmethod s3db = current.s3db # Virtual Fields # Always used from either the Event or Incident context f = r.function record_id = r.id ehrtable = s3db.event_human_resource hr_represent = ehrtable.human_resource_id.represent def hr_name(row): hr_id = row["event_human_resource.human_resource_id"] return A(hr_represent(hr_id), _href = URL(c="event", f=f, args=[record_id, "human_resource", hr_id, "profile"], ), ) ehrtable.name_click = s3_fieldmethod("name_click", hr_name, # over-ride the default represent of s3_unicode to prevent HTML being rendered too early # @ToDo: Bulk lookups represent = lambda v: v, ) s3db.configure(tablename, #crud_form = crud_form, extra_fields = ("human_resource_id", ), list_fields = [(T("Name"), "name_click"), (T("Title"), "human_resource_id$job_title_id"), "human_resource_id$organisation_id", (T("Email"), "human_resource_id$person_id$email.value"), (T("Phone"), "human_resource_id$person_id$phone.value"), "status", (T("Notes"), "comments"), ], orderby = "event_human_resource.human_resource_id", ) settings.customise_event_human_resource_resource = customise_event_human_resource_resource # ------------------------------------------------------------------------- def customise_event_organisation_resource(r, tablename): from gluon import A, URL from s3 import s3_fieldmethod s3db = current.s3db # Virtual Fields # Always used from either the Event or Incident context f = r.function record_id = r.id eotable = s3db.event_organisation org_represent = eotable.organisation_id.represent def org_name(row): organisation_id = row["event_organisation.organisation_id"] return A(org_represent(organisation_id), _href = URL(c="event", f=f, args=[record_id, "organisation", organisation_id, "profile"], ), ) eotable.name_click = s3_fieldmethod("name_click", org_name, # over-ride the default represent of s3_unicode to prevent HTML being rendered too early # @ToDo: Bulk lookups represent = lambda v: v, ) s3db.configure(tablename, #crud_form = crud_form, extra_fields = ("organisation_id", ), list_fields = [(T("Name"), "name_click"), "status", "comments", ], orderby = "event_organisation.organisation_id", ) settings.customise_event_organisation_resource = customise_event_organisation_resource # ------------------------------------------------------------------------- def customise_event_team_resource(r, tablename): from gluon import A, URL from s3 import s3_fieldmethod, S3SQLCustomForm s3db = current.s3db ertable = s3db.event_team #sertable.group_id.label = T("Resource") # Form # @ToDo: Have both Team & Event_Team in 1 form crud_form = S3SQLCustomForm("incident_id", "group_id", "status_id", ) # Virtual Fields # Always used from either the Event or Incident context f = r.function record_id = r.id group_represent = ertable.group_id.represent def team_name(row): group_id = row["event_team.group_id"] return A(group_represent(group_id), _href = URL(c="event", f=f, args=[record_id, "group", group_id, "profile"], extension = "", # ensure no .aadata ), ) ertable.name_click = s3_fieldmethod("name_click", team_name, # over-ride the default represent of s3_unicode to prevent HTML being rendered too early # @ToDo: Bulk lookups represent = lambda v: v, ) s3db.configure(tablename, crud_form = crud_form, extra_fields = ("group_id", ), list_fields = [(T("Name"), "name_click"), "status_id", ], orderby = "pr_group.name", ) settings.customise_event_team_resource = customise_event_team_resource # ------------------------------------------------------------------------- def customise_pr_group_resource(r, tablename): s3db = current.s3db current.response.s3.crud_strings[tablename] = Storage( label_create = T("Create Resource"), title_display = T("Resource Details"), title_list = T("Resources"), title_update = T("Edit Resource"), label_list_button = T("List Resources"), label_delete_button = T("Delete Resource"), msg_record_created = T("Resource added"), msg_record_modified = T("Resource updated"), msg_record_deleted = T("Resource deleted"), msg_list_empty = T("No Resources currently registered")) field = s3db.pr_group.status_id field.readable = field.writable = True from s3 import S3SQLCustomForm crud_form = S3SQLCustomForm((T("Name"), "name"), "status_id", "comments", ) list_fields = [(T("Name"), "name"), "status_id", "comments", ] s3db.configure(tablename, crud_form = crud_form, list_fields = list_fields, ) settings.customise_pr_group_resource = customise_pr_group_resource # ------------------------------------------------------------------------- def customise_pr_person_controller(**attr): # Custom Profile from templates.WACOP.controllers import person_Dashboard current.s3db.set_method("pr", "person", method = "dashboard", action = person_Dashboard) # No sidebar menu current.menu.options = None return attr settings.customise_pr_person_controller = customise_pr_person_controller # ------------------------------------------------------------------------- def customise_project_task_resource(r, tablename): from gluon import A, URL from s3 import s3_fieldmethod s3db = current.s3db # Virtual Fields # Always used from either the Event or Incident context f = r.function record_id = r.id def task_name(row): return A(row["project_task.name"], _href = URL(c="event", f=f, args=[record_id, "task", row["project_task.id"], "profile"], ), ) s3db.project_task.name_click = s3_fieldmethod("name_click", task_name, # over-ride the default represent of s3_unicode to prevent HTML being rendered too early represent = lambda v: v, ) s3db.configure(tablename, #crud_form = crud_form, extra_fields = ("name", ), list_fields = ["status", (T("Description"), "name_click"), (T("Created"), "created_on"), (T("Due"), "date_due"), ], orderby = "project_task.date_due", ) settings.customise_project_task_resource = customise_project_task_resource # ============================================================================= def wacop_event_rheader(r, tabs=[]): """ EVENT custom resource headers """ if r.representation != "html": # Resource headers only used in interactive views return None from s3 import s3_rheader_resource, S3ResourceHeader tablename, record = s3_rheader_resource(r) if tablename != r.tablename: resource = current.s3db.resource(tablename, id=record.id) else: resource = r.resource rheader = None rheader_fields = [] if record: T = current.T if tablename == "event_event": if not tabs: tabs = [(T("Event Details"), None), (T("Incidents"), "incident"), (T("Units"), "group"), (T("Tasks"), "task"), (T("Updates"), "post"), ] rheader_fields = [["name"], ["start_date"], ["comments"], ] elif tablename == "event_incident": if not tabs: tabs = [(T("Incident Details"), None), (T("Units"), "group"), (T("Tasks"), "task"), (T("Updates"), "post"), ] rheader_fields = [["name"], ["date"], ["comments"], ] rheader = S3ResourceHeader(rheader_fields, tabs)(r, table=resource.table, record=record, ) return rheader # END =========================================================================
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 13, 3166, 3144, 29884, 265, 1053, 1857, 13, 3166, 3144, 29884, 265, 29889, 12925, 1053, 26162, 13, 13, 1753, 2295, 29898, 11027, 1125, 13, 1678, 9995, 13, 4706, 25663, 363, 399, 29909, 29899, 3217, 29925, 718, 315, 3035, 14293, 17100, 362, 13, 1678, 9995, 13, 13, 1678, 323, 353, 1857, 29889, 29911, 13, 13, 1678, 396, 1275, 9166, 9166, 9166, 9166, 2751, 25512, 13, 1678, 396, 2184, 19215, 13, 1678, 396, 13, 1678, 6055, 29889, 3188, 29889, 5205, 29918, 978, 353, 323, 703, 29903, 801, 1648, 29901, 7660, 13103, 6607, 1218, 28908, 313, 12982, 29899, 3217, 29925, 25760, 13, 1678, 6055, 29889, 3188, 29889, 5205, 29918, 978, 29918, 12759, 353, 323, 703, 29903, 801, 1648, 1159, 13, 13, 1678, 396, 349, 3445, 459, 2322, 13, 1678, 6055, 29889, 3188, 29889, 1457, 7323, 5987, 4619, 4852, 29956, 2477, 4590, 613, 376, 4381, 29914, 7193, 613, 376, 29956, 2477, 4590, 29914, 23444, 1159, 13, 13, 1678, 396, 498, 2004, 313, 12083, 304, 671, 363, 8386, 29914, 2680, 29889, 1420, 29897, 13, 1678, 6055, 29889, 3188, 29889, 18193, 353, 376, 29956, 2477, 4590, 29908, 13, 13, 1678, 6055, 29889, 1481, 29889, 24911, 29918, 4187, 7453, 353, 5852, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 396, 21782, 29899, 4597, 8306, 322, 4911, 20802, 13, 1678, 396, 13, 1678, 396, 23861, 508, 1583, 29899, 9573, 13, 1678, 6055, 29889, 8926, 29889, 1311, 29918, 1727, 8306, 353, 7700, 13, 1678, 396, 23861, 817, 304, 11539, 1009, 4876, 13, 1678, 6055, 29889, 5150, 29889, 1727, 8306, 29918, 276, 339, 2658, 29918, 369, 2450, 353, 5852, 13, 1678, 396, 23861, 817, 304, 367, 23454, 13, 1678, 6055, 29889, 5150, 29889, 1727, 8306, 29918, 276, 339, 2658, 29918, 9961, 791, 353, 5852, 13, 1678, 6055, 29889, 5150, 29889, 1727, 8306, 29918, 24830, 29918, 22481, 353, 5852, 13, 1678, 6055, 29889, 5150, 29889, 1727, 8306, 29918, 22481, 29918, 12403, 353, 5852, 13, 13, 1678, 396, 28268, 791, 24609, 679, 2665, 304, 599, 7336, 1144, 13, 1678, 6055, 29889, 2549, 29889, 9961, 369, 353, 376, 3035, 16173, 29908, 13, 13, 1678, 6055, 29889, 5150, 29889, 1727, 8306, 29918, 2324, 29918, 1792, 29918, 517, 353, 8853, 303, 3470, 1115, 323, 703, 855, 3470, 1159, 29913, 13, 1678, 6055, 29889, 5150, 29889, 1727, 8306, 29918, 2324, 29918, 1792, 29918, 517, 29918, 4381, 353, 6796, 303, 3470, 3108, 13, 1678, 6055, 29889, 5150, 29889, 1727, 8306, 29918, 307, 793, 353, 8853, 22481, 29918, 333, 1115, 6796, 11889, 12436, 13, 462, 462, 4706, 500, 13, 13, 1678, 6055, 29889, 5150, 29889, 4294, 29918, 329, 29883, 29918, 10289, 353, 7700, 13, 1678, 6055, 29889, 5150, 29889, 4294, 29918, 2324, 353, 7700, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 396, 14223, 25219, 13, 1678, 396, 13, 1678, 6055, 29889, 8926, 29889, 22197, 353, 29871, 29955, 396, 2401, 368, 15830, 29892, 6680, 322, 6137, 319, 6154, 29879, 13, 1678, 6055, 29889, 8926, 29889, 1958, 353, 5852, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 396, 365, 29896, 29900, 29876, 313, 7717, 2133, 29897, 6055, 13, 1678, 396, 13, 1678, 6055, 29889, 29931, 29896, 29900, 29876, 29889, 29880, 8737, 353, 8170, 287, 21533, 4197, 13, 4706, 4852, 264, 613, 376, 24636, 4968, 13, 4706, 4852, 267, 613, 376, 15784, 5259, 324, 4968, 13, 268, 2314, 13, 1678, 396, 13109, 17088, 13, 1678, 6055, 29889, 29931, 29896, 29900, 29876, 29889, 4381, 29918, 11675, 353, 376, 264, 29908, 13, 1678, 396, 13109, 29431, 363, 4160, 13, 1678, 6055, 29889, 29931, 29896, 29900, 29876, 29889, 329, 29883, 29918, 10289, 353, 11663, 29900, 29947, 29900, 29900, 29908, 13, 1678, 396, 853, 6605, 519, 525, 1457, 4349, 29915, 2635, 3402, 13, 1678, 6055, 29889, 29931, 29896, 29900, 29876, 29889, 1256, 29918, 4830, 353, 11860, 29890, 1273, 29881, 1273, 29979, 29908, 13, 1678, 396, 9681, 21971, 313, 4381, 29879, 304, 17723, 29871, 29941, 29896, 29899, 29900, 29897, 13, 1678, 396, 3826, 3039, 28128, 363, 3694, 313, 4381, 29879, 304, 1919, 29897, 13, 1678, 6055, 29889, 29931, 29896, 29900, 29876, 29889, 7099, 3039, 29918, 344, 17954, 353, 376, 1213, 13, 1678, 396, 498, 681, 4167, 28128, 363, 3694, 313, 4381, 29879, 304, 2913, 29897, 13, 1678, 6055, 29889, 29931, 29896, 29900, 29876, 29889, 386, 681, 4167, 29918, 344, 17954, 353, 28796, 13, 1678, 396, 13109, 15456, 5920, 363, 4382, 6710, 3694, 13, 1678, 6055, 29889, 29931, 29896, 29900, 29876, 29889, 4381, 29918, 13509, 29918, 401, 353, 29871, 29896, 13, 1678, 396, 1174, 519, 445, 304, 1735, 278, 3858, 363, 525, 29295, 24323, 29915, 13, 1678, 6055, 29889, 1481, 29889, 1643, 29918, 16769, 29918, 6710, 353, 376, 4617, 24323, 29908, 13, 1678, 396, 1174, 519, 445, 304, 1735, 278, 3858, 363, 525, 6747, 401, 29915, 13, 1678, 6055, 29889, 1481, 29889, 1643, 29918, 2490, 401, 353, 376, 29999, 5690, 5920, 29908, 13, 13, 1678, 6055, 29889, 7645, 29889, 12277, 29918, 14168, 1288, 29918, 6710, 29918, 20326, 353, 7700, 13, 1678, 396, 11328, 304, 2803, 357, 13, 1678, 6055, 29889, 3188, 29889, 19773, 29918, 2311, 353, 323, 703, 12024, 357, 1159, 13, 13, 1678, 396, 853, 9342, 445, 304, 4103, 9632, 315, 4345, 10488, 14706, 13, 1678, 396, 448, 591, 864, 445, 373, 746, 2734, 269, 29941, 21652, 541, 1283, 297, 4226, 8744, 408, 591, 671, 278, 4223, 2983, 304, 16280, 27673, 297, 4050, 29918, 14080, 13, 1678, 396, 11027, 29889, 29931, 29896, 29900, 29876, 29889, 21652, 29918, 29883, 1516, 29918, 13757, 353, 5852, 13, 1678, 396, 853, 9342, 445, 304, 4103, 9632, 17015, 14706, 13, 1678, 396, 11027, 29889, 29931, 29896, 29900, 29876, 29889, 21652, 29918, 29887, 275, 29918, 5479, 353, 5852, 13, 13, 1678, 396, 11699, 8716, 3097, 5626, 29892, 541, 881, 367, 9280, 411, 1749, 1353, 310, 6475, 13, 1678, 6055, 29889, 4478, 29889, 15190, 29918, 6921, 29918, 3881, 353, 5852, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 396, 402, 3235, 6055, 13, 1678, 396, 13, 1678, 396, 11654, 4146, 278, 17015, 7605, 272, 304, 925, 3058, 10916, 13, 1678, 6055, 29889, 29887, 275, 29889, 2798, 2722, 353, 4852, 3308, 613, 29897, 13, 1678, 396, 21597, 29879, 363, 278, 17015, 10378, 13, 1678, 11174, 353, 4852, 29931, 29896, 613, 376, 29931, 29906, 613, 376, 29931, 29941, 1159, 13, 13, 1678, 396, 853, 9342, 304, 1209, 16428, 267, 19673, 515, 16874, 304, 263, 1879, 542, 6119, 304, 1018, 322, 3345, 403, 7053, 29914, 29931, 265, 13, 1678, 396, 11027, 29889, 29887, 275, 29889, 24756, 401, 29918, 5215, 287, 29918, 7328, 267, 353, 376, 3608, 29908, 13, 13, 1678, 396, 28609, 591, 788, 2304, 304, 317, 29941, 6508, 10378, 304, 731, 14687, 29879, 515, 7053, 29931, 787, 13, 1678, 6055, 29889, 29887, 275, 29889, 3198, 29918, 2541, 262, 29918, 3560, 29918, 9917, 4314, 353, 7700, 13, 1678, 396, 1879, 29877, 8659, 8952, 13, 1678, 6055, 29889, 29887, 275, 29889, 25339, 1280, 29918, 6786, 353, 376, 29885, 9708, 29908, 13, 1678, 396, 853, 9342, 304, 9563, 365, 2747, 21582, 5780, 13, 1678, 396, 11027, 29889, 29887, 275, 29889, 13148, 29918, 11330, 353, 7700, 13, 1678, 396, 853, 9342, 304, 2479, 278, 7315, 5682, 355, 408, 263, 16526, 360, 5667, 13, 1678, 6055, 29889, 29887, 275, 29889, 26172, 353, 376, 7411, 29908, 13, 1678, 396, 853, 9342, 304, 5557, 6445, 7053, 29931, 265, 297, 17015, 830, 4569, 1237, 13, 1678, 6055, 29889, 29887, 275, 29889, 5479, 29918, 276, 6338, 29918, 7328, 29918, 6194, 353, 376, 4144, 29908, 13, 1678, 396, 27562, 607, 508, 367, 4153, 2715, 304, 278, 1667, 2910, 13, 1678, 6055, 29889, 29887, 275, 29889, 1129, 29875, 29918, 3258, 29918, 13237, 353, 6213, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 396, 3382, 2540, 13, 1678, 396, 13, 1678, 6055, 29889, 7576, 353, 8170, 287, 21533, 4197, 13, 4706, 396, 10239, 10585, 607, 9273, 29915, 29873, 367, 12708, 13, 4706, 4852, 4381, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 11184, 613, 13, 9651, 22078, 353, 7700, 29892, 396, 4803, 319, 6154, 29879, 304, 2761, 2130, 304, 445, 3883, 13, 9651, 2130, 353, 6213, 29892, 418, 396, 2178, 23861, 313, 3742, 530, 11428, 29897, 508, 1074, 445, 3883, 297, 278, 2322, 6143, 669, 2130, 278, 4701, 13, 9651, 3883, 29918, 1853, 353, 6213, 29871, 396, 910, 2944, 338, 451, 4318, 297, 278, 6143, 13, 4706, 1723, 511, 13, 4706, 4852, 6406, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 12754, 8306, 613, 13, 9651, 396, 8216, 353, 376, 17033, 23303, 613, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 2130, 353, 376, 29989, 29896, 29989, 613, 268, 396, 9333, 24510, 4097, 508, 1074, 445, 3883, 297, 278, 2322, 6143, 669, 2130, 278, 4701, 13, 9651, 3883, 29918, 1853, 353, 6213, 29871, 396, 910, 2944, 338, 16459, 16949, 363, 278, 6143, 13, 4706, 1723, 511, 13, 4706, 4852, 932, 6406, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 12754, 8306, 613, 13, 9651, 396, 8216, 353, 376, 17033, 23303, 613, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 3883, 29918, 1853, 353, 6213, 29871, 396, 1939, 20019, 13, 4706, 1723, 511, 13, 1678, 396, 1678, 4852, 12523, 613, 26162, 29898, 13, 1678, 396, 4706, 1024, 29918, 16533, 353, 376, 29911, 8522, 478, 15580, 613, 13, 1678, 396, 4706, 396, 8216, 353, 376, 8139, 19226, 363, 350, 949, 7283, 3774, 29879, 613, 13, 1678, 396, 4706, 22078, 353, 7700, 29892, 13, 1678, 396, 4706, 3883, 29918, 1853, 353, 6213, 29871, 396, 1939, 20019, 13, 1678, 396, 1678, 1723, 511, 13, 539, 4852, 16593, 613, 26162, 29898, 13, 965, 1024, 29918, 16533, 353, 376, 29903, 9524, 2133, 613, 13, 965, 396, 8216, 353, 376, 29903, 9524, 2133, 613, 13, 965, 22078, 353, 5852, 29892, 13, 965, 2130, 353, 376, 29989, 29896, 29989, 613, 268, 396, 9333, 24510, 4097, 508, 1074, 445, 3883, 297, 278, 2322, 6143, 669, 2130, 278, 4701, 13, 965, 3883, 29918, 1853, 353, 6213, 29871, 396, 910, 2944, 338, 16459, 16949, 363, 278, 6143, 13, 539, 1723, 511, 13, 4706, 396, 703, 21652, 613, 26162, 29898, 13, 4706, 396, 1678, 1024, 29918, 16533, 353, 376, 4300, 18411, 6680, 2877, 613, 13, 4706, 396, 1678, 396, 8216, 353, 376, 3549, 573, 13962, 310, 6031, 2729, 373, 3883, 19602, 13, 4706, 396, 1678, 3883, 29918, 1853, 353, 6213, 29892, 13, 4706, 396, 8243, 13, 4706, 4852, 29887, 275, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 3388, 613, 13, 9651, 396, 8216, 353, 376, 29903, 1981, 362, 319, 4495, 18543, 669, 1879, 4705, 15238, 24352, 613, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 3883, 29918, 1853, 353, 29871, 29896, 29892, 268, 396, 29871, 29896, 303, 2944, 297, 278, 6143, 13, 4706, 1723, 511, 13, 4706, 4852, 558, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 15136, 787, 613, 13, 9651, 6139, 353, 376, 23369, 1705, 1298, 304, 2407, 4902, 373, 11647, 613, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 2130, 353, 376, 29989, 29896, 29989, 613, 268, 396, 9333, 24510, 4097, 508, 1074, 445, 3883, 297, 278, 2322, 6143, 313, 5943, 304, 4701, 338, 1950, 304, 599, 1603, 29897, 13, 9651, 3883, 29918, 1853, 353, 6213, 13, 4706, 1723, 511, 13, 4706, 4852, 990, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 27356, 17063, 613, 13, 9651, 396, 8216, 353, 525, 1293, 29879, 376, 15970, 338, 2599, 825, 669, 988, 1642, 2178, 1242, 18892, 946, 15942, 304, 14821, 1009, 14188, 742, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 3883, 29918, 1853, 353, 29871, 29896, 29900, 13, 4706, 1723, 511, 13, 4706, 396, 2178, 10585, 2400, 1244, 881, 367, 1950, 304, 11262, 23511, 13, 4706, 4852, 1092, 29885, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 13443, 29879, 613, 13, 9651, 396, 8216, 353, 376, 29950, 7889, 27562, 15057, 613, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 3883, 29918, 1853, 353, 6213, 29892, 13, 4706, 1723, 511, 13, 4706, 4852, 29883, 1516, 613, 26162, 29898, 13, 18884, 1024, 29918, 16533, 353, 376, 3916, 15057, 613, 13, 18884, 22078, 353, 5852, 29892, 13, 18884, 3883, 29918, 1853, 353, 29871, 29896, 29900, 29892, 13, 9651, 1723, 511, 13, 4706, 4852, 3696, 613, 26162, 29898, 13, 18884, 1024, 29918, 16533, 353, 376, 13634, 613, 13, 18884, 22078, 353, 5852, 29892, 13, 18884, 3883, 29918, 1853, 353, 29871, 29906, 29892, 13, 9651, 1723, 511, 13, 4706, 4852, 8696, 613, 26162, 29898, 13, 18884, 1024, 29918, 16533, 353, 376, 18654, 613, 13, 18884, 22078, 353, 5852, 29892, 13, 18884, 3883, 29918, 1853, 353, 6213, 29892, 13, 9651, 1723, 511, 13, 4706, 4852, 3733, 625, 613, 26162, 29898, 13, 18884, 1024, 29918, 16533, 353, 376, 7713, 625, 613, 13, 18884, 22078, 353, 5852, 29892, 13, 18884, 3883, 29918, 1853, 353, 6213, 29892, 13, 9651, 1723, 511, 13, 4706, 4852, 4836, 613, 26162, 29898, 13, 18884, 1024, 29918, 16533, 353, 376, 26249, 613, 13, 18884, 22078, 353, 5852, 29892, 13, 18884, 3883, 29918, 1853, 353, 6213, 29892, 13, 9651, 1723, 511, 13, 4706, 4852, 1514, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 20128, 613, 13, 9651, 396, 8216, 353, 376, 29909, 3489, 310, 13436, 7788, 29892, 1316, 408, 20612, 29892, 10701, 322, 13676, 613, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 3883, 29918, 1853, 353, 6213, 29892, 13, 4706, 1723, 511, 13, 4706, 4852, 16202, 613, 26162, 29898, 13, 9651, 1024, 29918, 16533, 353, 376, 9513, 6765, 613, 13, 9651, 22078, 353, 5852, 29892, 13, 9651, 3883, 29918, 1853, 353, 6213, 13, 4706, 1723, 511, 13, 268, 2314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 396, 315, 4345, 10576, 15057, 13, 1678, 396, 13, 1678, 6055, 29889, 29883, 1516, 29889, 2909, 22848, 353, 5852, 13, 1678, 6055, 29889, 29883, 1516, 29889, 4018, 726, 353, 5852, 13, 1678, 6055, 29889, 29883, 1516, 29889, 4294, 29918, 11338, 353, 5852, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 274, 1516, 29918, 2490, 29918, 265, 16044, 29898, 689, 1125, 13, 4706, 9995, 13, 9651, 29273, 917, 297, 6204, 847, 10318, 7190, 13, 4706, 9995, 13, 13, 4706, 1400, 29918, 333, 353, 883, 29889, 16908, 29889, 333, 13, 13, 4706, 4833, 353, 1857, 29889, 2585, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 4706, 260, 2371, 353, 269, 29941, 2585, 29889, 29883, 1516, 29918, 4039, 13, 4706, 301, 2371, 353, 269, 29941, 2585, 29889, 29883, 1516, 29918, 4039, 29918, 2490, 13, 13, 4706, 396, 21267, 599, 5923, 8282, 363, 445, 1400, 13, 4706, 4833, 29898, 1896, 519, 29889, 2490, 29918, 333, 1275, 1400, 29918, 333, 467, 8143, 580, 13, 13, 4706, 396, 3462, 1438, 8282, 13, 4706, 8282, 353, 1857, 29889, 3827, 29889, 2490, 29918, 16908, 29889, 657, 703, 11338, 1159, 13, 4706, 565, 451, 8282, 29901, 13, 9651, 736, 13, 13, 4706, 8282, 353, 8282, 29889, 5451, 28165, 1159, 13, 4706, 4055, 29918, 4841, 353, 4833, 29898, 698, 519, 29889, 978, 29889, 6596, 24733, 29898, 11338, 8106, 2622, 29898, 698, 519, 29889, 333, 29892, 13, 462, 462, 462, 539, 260, 2371, 29889, 978, 467, 294, 29918, 8977, 29898, 1989, 543, 978, 1159, 13, 4706, 363, 4055, 297, 8282, 29901, 13, 9651, 1948, 353, 4055, 29918, 4841, 29889, 657, 703, 4039, 1159, 13, 9651, 565, 1948, 29901, 13, 18884, 4055, 29918, 333, 353, 1948, 29889, 657, 703, 333, 1159, 13, 9651, 1683, 29901, 13, 18884, 4055, 29918, 333, 353, 260, 2371, 29889, 7851, 29898, 978, 29922, 4039, 29897, 13, 9651, 301, 2371, 29889, 7851, 29898, 2490, 29918, 333, 353, 1400, 29918, 333, 29892, 13, 462, 3986, 4055, 29918, 333, 353, 4055, 29918, 333, 29892, 13, 462, 3986, 1723, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 29883, 1516, 29918, 2490, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 4833, 353, 1857, 29889, 2585, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 4706, 1591, 353, 269, 29941, 2585, 29889, 29883, 1516, 29918, 2490, 462, 539, 13, 4706, 1591, 29889, 29886, 21766, 29889, 949, 519, 353, 1591, 29889, 29886, 21766, 29889, 8231, 519, 353, 5852, 13, 4706, 1591, 29889, 13757, 29918, 333, 29889, 949, 519, 353, 1591, 29889, 13757, 29918, 333, 29889, 8231, 519, 353, 5852, 13, 4706, 1591, 29889, 4882, 29918, 333, 29889, 949, 519, 353, 1591, 29889, 4882, 29918, 333, 29889, 8231, 519, 353, 5852, 13, 13, 4706, 1158, 353, 364, 29889, 5696, 13, 4706, 565, 1158, 297, 4852, 3258, 613, 376, 5504, 29908, 1125, 13, 9651, 396, 8701, 3812, 13, 9651, 515, 269, 29941, 1053, 317, 29941, 4176, 7281, 2500, 29892, 317, 29941, 4176, 797, 1220, 5308, 13, 13, 9651, 2181, 566, 29918, 9621, 353, 17288, 29911, 703, 1542, 4968, 376, 13757, 29918, 333, 4968, 13, 462, 965, 313, 29911, 703, 29925, 21766, 4968, 376, 29886, 21766, 4968, 13, 462, 965, 313, 29911, 703, 5709, 4968, 376, 4882, 29918, 333, 4968, 13, 462, 965, 313, 29911, 703, 7030, 4968, 376, 3257, 4968, 13, 462, 965, 313, 29911, 703, 1626, 4968, 376, 2587, 4968, 13, 462, 965, 313, 29911, 703, 6508, 4968, 376, 5479, 29918, 333, 4968, 13, 462, 965, 396, 917, 526, 2715, 3132, 29899, 2975, 13, 462, 965, 317, 29941, 4176, 797, 1220, 5308, 703, 3225, 613, 13, 462, 462, 18884, 1024, 353, 376, 1445, 613, 13, 462, 462, 18884, 3858, 353, 323, 703, 10547, 4968, 13, 462, 462, 18884, 4235, 353, 518, 703, 613, 376, 1445, 4968, 13, 462, 462, 462, 3986, 396, 29908, 21032, 613, 13, 462, 462, 462, 3986, 21251, 13, 462, 462, 18884, 10353, 13, 462, 965, 4514, 13, 13, 9651, 565, 364, 29889, 3891, 2435, 420, 2804, 376, 3696, 29918, 3742, 1693, 1115, 13, 18884, 565, 364, 29889, 3891, 2435, 420, 1275, 376, 3696, 29918, 3696, 1115, 13, 462, 1678, 515, 3144, 29884, 265, 1053, 8519, 29918, 29923, 3580, 15631, 29918, 1955, 13, 462, 1678, 515, 269, 29941, 1053, 8519, 29918, 12413, 29918, 9800, 13, 462, 1678, 372, 519, 353, 269, 29941, 2585, 29889, 3696, 29918, 3742, 1693, 13, 462, 1678, 2346, 353, 313, 8270, 29889, 3696, 29918, 333, 1275, 364, 29889, 333, 29897, 669, 320, 13, 462, 9651, 313, 8270, 29889, 15603, 1275, 7700, 29897, 669, 320, 13, 462, 9651, 313, 8270, 29889, 311, 22742, 1275, 7700, 29897, 13, 462, 1678, 731, 353, 4833, 29898, 1972, 29897, 13, 462, 1678, 285, 353, 269, 29941, 2585, 29889, 3696, 29918, 2490, 29889, 3742, 1693, 29918, 333, 13, 462, 1678, 285, 29889, 276, 339, 2658, 353, 8519, 29918, 29923, 3580, 15631, 29918, 1955, 29898, 13, 462, 462, 1678, 8519, 29918, 12413, 29918, 9800, 29898, 842, 29892, 376, 3696, 29918, 3742, 1693, 29889, 333, 613, 13, 462, 462, 795, 285, 29889, 276, 6338, 29892, 13, 462, 462, 795, 1797, 1609, 543, 3696, 29918, 3742, 1693, 29889, 978, 613, 13, 462, 462, 795, 2656, 29922, 5574, 876, 13, 18884, 2181, 566, 29918, 9621, 29889, 7851, 29898, 29900, 29892, 317, 29941, 4176, 797, 1220, 5308, 703, 3742, 1693, 29918, 2490, 613, 13, 462, 462, 462, 965, 4235, 353, 518, 703, 613, 376, 3742, 1693, 29918, 333, 1159, 1402, 13, 462, 462, 462, 965, 3858, 353, 323, 703, 797, 29883, 1693, 4968, 13, 462, 462, 462, 965, 2999, 353, 7700, 29892, 13, 462, 462, 462, 9651, 876, 13, 13, 9651, 2181, 566, 29918, 689, 353, 317, 29941, 4176, 7281, 2500, 10456, 7283, 566, 29918, 9621, 13, 462, 462, 4706, 1723, 13, 13, 9651, 396, 12477, 2304, 363, 917, 13, 9651, 623, 978, 353, 364, 29889, 6214, 13, 9651, 269, 29941, 353, 1857, 29889, 5327, 29889, 29879, 29941, 13, 9651, 12078, 29918, 4397, 353, 269, 29941, 29889, 16713, 29889, 4397, 13, 9651, 565, 269, 29941, 29889, 8382, 29901, 13, 18884, 12078, 29918, 4397, 11974, 29995, 29879, 29914, 7959, 29914, 16713, 29914, 4039, 29899, 277, 29889, 1315, 29908, 1273, 623, 978, 29897, 13, 9651, 1683, 29901, 13, 18884, 12078, 29918, 4397, 11974, 29995, 29879, 29914, 7959, 29914, 16713, 29914, 4039, 29899, 277, 29889, 1195, 29889, 1315, 29908, 1273, 623, 978, 29897, 13, 9651, 12078, 29918, 4397, 11974, 29995, 29879, 29914, 7959, 29914, 386, 13826, 29914, 29956, 2477, 4590, 29914, 1315, 29914, 5504, 29918, 11338, 29889, 1315, 29908, 1273, 623, 978, 29897, 13, 9651, 565, 1158, 1275, 376, 3258, 1115, 13, 18884, 269, 29941, 29889, 5880, 29918, 2040, 29889, 4397, 877, 4907, 29893, 562, 459, 29918, 5504, 29918, 11338, 703, 1159, 4907, 1495, 13, 9651, 25342, 1158, 1275, 376, 5504, 1115, 13, 18884, 260, 2371, 353, 269, 29941, 2585, 29889, 29883, 1516, 29918, 4039, 13, 18884, 301, 2371, 353, 269, 29941, 2585, 29889, 29883, 1516, 29918, 4039, 29918, 2490, 13, 18884, 565, 364, 29889, 3891, 2435, 420, 1275, 376, 29883, 1516, 29918, 2490, 1115, 13, 462, 1678, 1400, 29918, 333, 353, 364, 29889, 333, 13, 18884, 1683, 29901, 13, 462, 1678, 1400, 29918, 333, 353, 364, 29889, 9700, 29889, 333, 13, 18884, 2346, 353, 313, 1896, 519, 29889, 2490, 29918, 333, 1275, 1400, 29918, 333, 29897, 669, 320, 13, 462, 4706, 313, 1896, 519, 29889, 4039, 29918, 333, 1275, 260, 2371, 29889, 333, 29897, 13, 18884, 8282, 353, 4833, 29898, 1972, 467, 2622, 29898, 698, 519, 29889, 978, 29897, 13, 18884, 8282, 353, 518, 4039, 29889, 978, 363, 4055, 297, 8282, 29962, 13, 18884, 8282, 353, 9162, 1642, 7122, 29898, 11338, 29897, 13, 18884, 269, 29941, 29889, 5880, 29918, 2040, 29889, 4397, 877, 4907, 29893, 562, 459, 29918, 5504, 29918, 11338, 11702, 29879, 1159, 12008, 1273, 8282, 29897, 13, 13, 9651, 396, 10554, 292, 917, 13, 9651, 2322, 353, 269, 29941, 2585, 29889, 657, 29918, 2917, 29898, 3891, 2435, 420, 29892, 376, 265, 16044, 1159, 13, 9651, 565, 338, 8758, 29898, 4381, 29892, 1051, 1125, 13, 18884, 373, 16044, 353, 2322, 13, 18884, 373, 16044, 29889, 4397, 29898, 29883, 1516, 29918, 2490, 29918, 265, 16044, 29897, 13, 9651, 1683, 29901, 13, 18884, 373, 16044, 353, 518, 4381, 29892, 274, 1516, 29918, 2490, 29918, 265, 16044, 29962, 13, 13, 9651, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 965, 2181, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 965, 373, 16044, 353, 373, 16044, 29892, 13, 462, 965, 1723, 13, 13, 4706, 25342, 1158, 297, 4852, 6341, 613, 376, 29881, 2075, 391, 613, 376, 4572, 29908, 1125, 13, 9651, 396, 848, 1293, 5285, 13, 9651, 515, 17475, 29889, 29956, 2477, 4590, 29889, 1285, 11897, 1053, 274, 1516, 29918, 2490, 29918, 1761, 29918, 2680, 13, 13, 9651, 269, 29941, 353, 1857, 29889, 5327, 29889, 29879, 29941, 13, 9651, 269, 29941, 29889, 11671, 29918, 1217, 29918, 6672, 353, 5852, 13, 13, 9651, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 965, 1051, 29918, 9621, 353, 6796, 13757, 29918, 333, 613, 13, 462, 462, 3986, 376, 29886, 21766, 613, 13, 462, 462, 3986, 376, 4882, 29918, 333, 613, 13, 462, 462, 3986, 376, 1256, 613, 13, 462, 462, 3986, 376, 3257, 613, 13, 462, 462, 3986, 376, 2587, 613, 13, 462, 462, 3986, 376, 11600, 29918, 1609, 613, 13, 462, 462, 3986, 376, 4039, 29889, 978, 613, 13, 462, 462, 3986, 376, 3225, 29889, 1445, 613, 13, 462, 462, 3986, 376, 9342, 29889, 333, 613, 13, 462, 462, 3986, 396, 29908, 9342, 29889, 2587, 613, 396, 7338, 336, 4235, 2041, 297, 443, 24582, 29892, 577, 508, 29915, 29873, 1993, 701, 304, 6475, 13, 462, 462, 3986, 396, 29908, 9342, 29889, 11600, 29918, 1609, 613, 13, 462, 462, 3986, 396, 29908, 9342, 29889, 11600, 29918, 265, 613, 13, 462, 462, 3986, 21251, 13, 462, 965, 1051, 29918, 2680, 353, 274, 1516, 29918, 2490, 29918, 1761, 29918, 2680, 29892, 13, 462, 965, 396, 13109, 13, 462, 965, 396, 2098, 1609, 353, 376, 29883, 1516, 29918, 2490, 29889, 1256, 5153, 613, 13, 462, 965, 1723, 13, 13, 9651, 565, 1158, 297, 4852, 6341, 613, 376, 4572, 29908, 1125, 13, 18884, 396, 19916, 27080, 29879, 13, 18884, 515, 269, 29941, 1053, 317, 29941, 2539, 5072, 29892, 320, 13, 462, 1669, 317, 29941, 6508, 5072, 29892, 320, 13, 462, 1669, 317, 29941, 5856, 5072, 29892, 320, 13, 462, 1669, 317, 29941, 1626, 5072, 13, 13, 18884, 565, 1158, 1275, 376, 4572, 1115, 13, 462, 1678, 396, 2401, 368, 4175, 29918, 16908, 13, 462, 1678, 679, 29918, 16908, 353, 364, 29889, 657, 29918, 16908, 13, 462, 1678, 363, 413, 29892, 325, 297, 679, 29918, 16908, 29889, 1524, 7076, 7295, 13, 462, 4706, 396, 1334, 871, 2149, 263, 7472, 310, 29871, 29896, 310, 1438, 29892, 694, 817, 304, 9773, 13, 462, 4706, 515, 269, 29941, 1053, 383, 29903, 13, 462, 4706, 269, 29941, 29889, 4572, 353, 313, 9998, 29898, 29895, 29897, 1275, 325, 29897, 13, 13, 18884, 2635, 29918, 4572, 353, 317, 29941, 2539, 5072, 703, 1256, 613, 13, 462, 462, 965, 396, 960, 591, 14944, 385, 1095, 29918, 1256, 373, 4918, 29879, 29901, 13, 462, 462, 965, 396, 3366, 1256, 613, 376, 355, 29918, 1256, 12436, 13, 462, 462, 965, 3858, 353, 12633, 13, 462, 462, 965, 396, 11458, 29918, 2230, 353, 5852, 29892, 13, 462, 462, 965, 23889, 353, 5852, 29892, 13, 462, 462, 965, 2821, 29918, 726, 353, 376, 29990, 613, 13, 462, 462, 965, 1723, 13, 18884, 2635, 29918, 4572, 29889, 2080, 29918, 21134, 353, 8853, 479, 1115, 376, 4763, 5974, 29914, 2539, 613, 376, 280, 1115, 376, 5044, 5974, 29914, 2539, 9092, 13, 13, 18884, 515, 17475, 29889, 29956, 2477, 4590, 29889, 1285, 11897, 1053, 1426, 29918, 4572, 29918, 689, 3293, 13, 13, 18884, 4175, 29918, 8030, 29879, 353, 518, 29903, 29941, 1626, 5072, 29898, 3366, 2587, 613, 13, 462, 462, 18884, 21251, 13, 462, 462, 1669, 883, 3293, 353, 1426, 29918, 4572, 29918, 689, 3293, 29892, 13, 462, 462, 1669, 3858, 353, 323, 703, 7974, 4968, 13, 462, 462, 1669, 903, 27074, 353, 323, 703, 10399, 2740, 1840, 30098, 4968, 13, 462, 462, 1669, 10353, 13, 462, 462, 29871, 317, 29941, 5856, 5072, 703, 13757, 29918, 333, 613, 13, 462, 462, 462, 29871, 3858, 353, 12633, 13, 462, 462, 462, 29871, 5642, 8592, 1626, 353, 376, 1542, 613, 396, 323, 580, 2715, 297, 11109, 13, 462, 462, 462, 29871, 694, 29918, 25707, 353, 12633, 13, 462, 462, 462, 29871, 10353, 13, 462, 462, 29871, 317, 29941, 5856, 5072, 703, 29886, 21766, 613, 13, 462, 462, 462, 29871, 3858, 353, 12633, 13, 462, 462, 462, 29871, 5642, 8592, 1626, 353, 376, 29925, 21766, 613, 396, 323, 580, 2715, 297, 11109, 13, 462, 462, 462, 29871, 694, 29918, 25707, 353, 12633, 13, 462, 462, 462, 29871, 10353, 13, 462, 462, 29871, 317, 29941, 5856, 5072, 703, 4882, 29918, 333, 613, 13, 462, 462, 462, 29871, 3858, 353, 12633, 13, 462, 462, 462, 29871, 5642, 8592, 1626, 353, 376, 5709, 613, 396, 323, 580, 2715, 297, 11109, 13, 462, 462, 462, 29871, 694, 29918, 25707, 353, 12633, 13, 462, 462, 462, 29871, 10353, 13, 462, 462, 29871, 317, 29941, 5856, 5072, 703, 11600, 29918, 1609, 29938, 22481, 29918, 333, 613, 13, 462, 462, 462, 29871, 3858, 353, 12633, 13, 462, 462, 462, 29871, 5642, 8592, 1626, 353, 376, 4435, 613, 396, 323, 580, 2715, 297, 11109, 13, 462, 462, 462, 29871, 694, 29918, 25707, 353, 12633, 13, 462, 462, 462, 29871, 10353, 13, 462, 462, 29871, 317, 29941, 5856, 5072, 703, 4039, 29918, 2490, 29889, 4039, 29918, 333, 613, 13, 462, 462, 462, 29871, 3858, 353, 12633, 13, 462, 462, 462, 29871, 5642, 8592, 1626, 353, 376, 8176, 613, 396, 323, 580, 2715, 297, 11109, 13, 462, 462, 462, 29871, 694, 29918, 25707, 353, 12633, 13, 462, 462, 462, 29871, 10353, 13, 462, 462, 29871, 2635, 29918, 4572, 29892, 13, 462, 462, 29871, 4514, 13, 18884, 565, 364, 29889, 3891, 2435, 420, 1275, 376, 3696, 29918, 3696, 29908, 470, 320, 13, 462, 259, 313, 5696, 1275, 376, 4572, 29908, 322, 679, 29918, 16908, 29889, 657, 703, 3696, 29918, 2490, 29889, 3696, 29918, 333, 5783, 29901, 13, 462, 1678, 396, 6864, 20802, 13, 462, 1678, 4175, 29918, 8030, 29879, 29889, 7851, 29898, 29896, 29892, 317, 29941, 5856, 5072, 703, 3742, 1693, 29918, 2490, 29889, 3742, 1693, 29918, 333, 613, 13, 462, 462, 462, 632, 3858, 353, 12633, 13, 462, 462, 462, 632, 5642, 8592, 1626, 353, 376, 797, 29883, 1693, 613, 396, 323, 580, 2715, 297, 11109, 13, 462, 462, 462, 632, 694, 29918, 25707, 353, 12633, 13, 462, 462, 462, 795, 876, 13, 13, 18884, 1404, 353, 1857, 29889, 5150, 29889, 1792, 13, 18884, 565, 1404, 29901, 13, 462, 1678, 4175, 29918, 8030, 29879, 29889, 7851, 29898, 29896, 29892, 317, 29941, 5856, 5072, 703, 2909, 3502, 29889, 1792, 29918, 333, 613, 13, 462, 462, 462, 632, 3858, 353, 12633, 13, 462, 462, 462, 632, 3987, 353, 8853, 29930, 1115, 323, 703, 3596, 4968, 13, 462, 462, 462, 462, 4706, 1404, 29889, 333, 29901, 323, 703, 3421, 6726, 22848, 4968, 13, 462, 462, 462, 462, 4706, 2981, 13, 462, 462, 462, 632, 28730, 353, 29871, 29906, 29892, 13, 462, 462, 462, 632, 2999, 353, 7700, 29892, 13, 462, 462, 462, 632, 1591, 353, 7700, 29892, 13, 462, 462, 462, 795, 876, 13, 13, 18884, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 1669, 4175, 29918, 8030, 29879, 353, 4175, 29918, 8030, 29879, 29892, 13, 462, 1669, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 29883, 1516, 29918, 2490, 29918, 10314, 353, 2888, 895, 29918, 29883, 1516, 29918, 2490, 29918, 10314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 396, 6864, 29914, 797, 29883, 1693, 15057, 13, 1678, 396, 13, 1678, 6055, 29889, 3696, 29889, 3742, 1693, 29918, 371, 2232, 29918, 3891, 353, 376, 2525, 1169, 29908, 13, 1678, 396, 853, 9342, 304, 19905, 9024, 9266, 16719, 746, 385, 6864, 338, 11132, 13, 1678, 6055, 29889, 3696, 29889, 9398, 6332, 29918, 8143, 29918, 3742, 16719, 353, 7700, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 3696, 29918, 3696, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 515, 3144, 29884, 265, 1053, 319, 29892, 3988, 13, 4706, 515, 269, 29941, 1053, 269, 29941, 29918, 2671, 5696, 13, 13, 4706, 4833, 353, 1857, 29889, 2585, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 13, 4706, 396, 19181, 8989, 29879, 13, 4706, 634, 519, 353, 269, 29941, 2585, 29889, 3696, 29918, 3696, 13, 4706, 396, 4397, 353, 634, 519, 3032, 18714, 29918, 23515, 29889, 4397, 13, 13, 4706, 822, 1741, 29918, 978, 29898, 798, 1125, 13, 9651, 736, 319, 29898, 798, 3366, 3696, 29918, 3696, 29889, 978, 12436, 13, 462, 268, 903, 12653, 353, 3988, 29898, 29883, 543, 3696, 613, 285, 543, 3696, 613, 13, 462, 462, 6389, 11759, 798, 3366, 3696, 29918, 3696, 29889, 333, 12436, 376, 6341, 12436, 13, 462, 462, 6081, 353, 12633, 396, 9801, 694, 869, 29874, 7221, 13, 462, 462, 10353, 13, 462, 268, 1723, 13, 4706, 396, 4397, 29898, 3073, 29889, 4062, 703, 978, 29918, 3808, 613, 1741, 29918, 978, 876, 13, 4706, 634, 519, 29889, 978, 29918, 3808, 353, 269, 29941, 29918, 2671, 5696, 703, 978, 29918, 3808, 613, 13, 462, 462, 965, 1741, 29918, 978, 29892, 13, 462, 462, 965, 396, 975, 29899, 2426, 278, 2322, 2755, 310, 269, 29941, 29918, 2523, 356, 304, 5557, 4544, 1641, 13751, 2086, 4688, 13, 462, 462, 965, 2755, 353, 14013, 325, 29901, 325, 29892, 13, 462, 462, 965, 1723, 13, 13, 4706, 822, 1741, 29918, 4882, 29898, 798, 1125, 13, 9651, 565, 1948, 3366, 3696, 29918, 3696, 29889, 735, 6269, 895, 3108, 29901, 13, 18884, 4660, 353, 323, 703, 3057, 292, 1159, 13, 9651, 25342, 451, 1948, 3366, 3696, 29918, 3696, 29889, 355, 29918, 1256, 3108, 29901, 13, 18884, 4660, 353, 323, 703, 6585, 1159, 13, 9651, 1683, 29901, 13, 18884, 4660, 353, 323, 703, 6821, 2662, 1159, 13, 9651, 736, 4660, 13, 4706, 396, 4397, 29898, 3073, 29889, 4062, 703, 4882, 613, 1741, 29918, 4882, 876, 13, 4706, 634, 519, 29889, 4882, 353, 269, 29941, 29918, 2671, 5696, 703, 4882, 613, 1741, 29918, 4882, 29897, 13, 13, 4706, 372, 519, 353, 269, 29941, 2585, 29889, 3696, 29918, 3742, 1693, 13, 4706, 822, 1741, 29918, 3742, 16719, 29898, 798, 1125, 13, 9651, 2346, 353, 313, 8270, 29889, 3696, 29918, 333, 1275, 1948, 3366, 3696, 29918, 3696, 29889, 333, 20068, 669, 320, 13, 462, 1678, 313, 8270, 29889, 311, 22742, 1275, 7700, 29897, 13, 9651, 5528, 16719, 353, 4833, 29898, 1972, 467, 2798, 580, 13, 9651, 736, 5528, 16719, 13, 4706, 396, 4397, 29898, 3073, 29889, 4062, 703, 3742, 16719, 613, 1741, 29918, 3742, 16719, 876, 13, 4706, 634, 519, 29889, 3742, 16719, 353, 269, 29941, 29918, 2671, 5696, 703, 3742, 16719, 613, 1741, 29918, 3742, 16719, 29897, 13, 13, 4706, 604, 2371, 353, 269, 29941, 2585, 29889, 3696, 29918, 14318, 13, 4706, 822, 1741, 29918, 13237, 29898, 798, 1125, 13, 9651, 2346, 353, 313, 814, 519, 29889, 3696, 29918, 333, 1275, 1948, 3366, 3696, 29918, 3696, 29889, 333, 20068, 669, 320, 13, 462, 1678, 313, 814, 519, 29889, 311, 22742, 1275, 7700, 29897, 13, 9651, 7788, 353, 4833, 29898, 1972, 467, 2798, 580, 13, 9651, 736, 7788, 13, 4706, 396, 4397, 29898, 3073, 29889, 4062, 703, 13237, 613, 1741, 29918, 13237, 876, 13, 4706, 634, 519, 29889, 13237, 353, 269, 29941, 29918, 2671, 5696, 703, 13237, 613, 1741, 29918, 13237, 29897, 13, 13, 4706, 634, 2371, 353, 269, 29941, 2585, 29889, 3696, 29918, 4039, 13, 4706, 260, 2371, 353, 269, 29941, 2585, 29889, 29883, 1516, 29918, 4039, 13, 4706, 822, 1741, 29918, 11338, 29898, 798, 1125, 13, 9651, 2346, 353, 313, 1803, 519, 29889, 3696, 29918, 333, 1275, 1948, 3366, 3696, 29918, 3696, 29889, 333, 20068, 669, 320, 13, 462, 1678, 313, 1803, 519, 29889, 311, 22742, 1275, 7700, 29897, 669, 320, 13, 462, 1678, 313, 1803, 519, 29889, 4039, 29918, 333, 1275, 260, 2371, 29889, 333, 29897, 13, 9651, 8282, 353, 4833, 29898, 1972, 467, 2622, 29898, 698, 519, 29889, 978, 29897, 13, 9651, 565, 8282, 29901, 13, 18884, 8282, 353, 518, 29873, 29889, 978, 363, 260, 297, 8282, 29962, 13, 18884, 8282, 353, 9162, 11393, 7122, 29898, 11338, 29897, 13, 18884, 736, 8282, 13, 9651, 1683, 29901, 13, 18884, 736, 1857, 29889, 19158, 3366, 29940, 12413, 3108, 13, 4706, 396, 4397, 29898, 3073, 29889, 4062, 703, 11338, 613, 1741, 29918, 11338, 876, 13, 4706, 634, 519, 29889, 11338, 353, 269, 29941, 29918, 2671, 5696, 703, 11338, 613, 1741, 29918, 11338, 29897, 13, 13, 4706, 1051, 29918, 9621, 353, 17288, 29911, 703, 1170, 4968, 376, 978, 29918, 3808, 4968, 13, 462, 539, 313, 29911, 703, 5709, 4968, 376, 4882, 4968, 13, 462, 539, 313, 29911, 703, 24214, 379, 473, 4968, 376, 2962, 29918, 1256, 4968, 13, 462, 539, 313, 29911, 703, 6821, 2662, 4968, 376, 355, 29918, 1256, 4968, 13, 462, 539, 313, 29911, 703, 16885, 4968, 376, 5479, 29889, 5479, 29918, 333, 29889, 29931, 29941, 4968, 13, 462, 539, 313, 29911, 703, 2792, 4968, 376, 5479, 29889, 5479, 29918, 333, 29889, 29931, 29896, 4968, 13, 462, 539, 313, 29911, 703, 28089, 4968, 376, 11338, 4968, 13, 462, 539, 313, 29911, 703, 797, 29883, 16719, 4968, 376, 3742, 16719, 4968, 13, 462, 539, 313, 29911, 703, 13770, 4968, 376, 13237, 4968, 13, 462, 539, 4514, 13, 13, 4706, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 539, 4805, 29918, 9621, 353, 4852, 978, 613, 13, 462, 462, 539, 376, 355, 29918, 1256, 613, 13, 462, 462, 539, 376, 735, 6269, 895, 613, 13, 462, 462, 539, 10353, 13, 462, 539, 1051, 29918, 9621, 353, 1051, 29918, 9621, 29892, 13, 462, 539, 1797, 1609, 353, 376, 3696, 29918, 3696, 29889, 978, 613, 13, 462, 539, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 3696, 29918, 3696, 29918, 10314, 353, 2888, 895, 29918, 3696, 29918, 3696, 29918, 10314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 3696, 29918, 3696, 29918, 8299, 29898, 1068, 5552, 1125, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 4706, 269, 29941, 353, 1857, 29889, 5327, 29889, 29879, 29941, 13, 13, 4706, 396, 3382, 1598, 422, 9340, 13, 4706, 269, 29941, 2585, 29889, 1202, 29918, 14036, 703, 3696, 29918, 3696, 613, 13, 462, 9651, 396, 28488, 505, 925, 263, 2323, 17015, 13, 462, 9651, 1741, 29918, 3696, 29918, 5479, 353, 8853, 7122, 1609, 1115, 376, 3696, 29918, 333, 613, 13, 462, 462, 462, 1678, 376, 20787, 1115, 7700, 29892, 13, 462, 462, 462, 1678, 2981, 13, 462, 9651, 396, 9266, 16719, 526, 9024, 304, 28488, 29892, 451, 2825, 515, 963, 13, 462, 9651, 396, 448, 451, 263, 1544, 1591, 2466, 29892, 577, 508, 29915, 29873, 1735, 278, 20331, 362, 13, 462, 9651, 396, 3696, 29918, 3742, 1693, 353, 8853, 7122, 1609, 1115, 376, 3696, 29918, 333, 613, 13, 462, 9651, 396, 462, 29871, 2981, 13, 462, 9651, 1723, 13, 13, 4706, 396, 8701, 22415, 344, 13, 4706, 515, 17475, 29889, 29956, 2477, 4590, 29889, 1285, 11897, 1053, 1741, 29918, 29933, 798, 344, 29892, 1741, 29918, 13909, 13, 4706, 731, 29918, 5696, 353, 269, 29941, 2585, 29889, 842, 29918, 5696, 13, 4706, 731, 29918, 5696, 703, 3696, 613, 376, 3696, 613, 13, 462, 259, 1158, 353, 376, 23721, 344, 613, 13, 462, 259, 3158, 353, 1741, 29918, 29933, 798, 344, 29897, 13, 13, 4706, 396, 8701, 20802, 13, 4706, 731, 29918, 5696, 703, 3696, 613, 376, 3696, 613, 13, 462, 259, 1158, 353, 376, 6341, 613, 13, 462, 259, 3158, 353, 1741, 29918, 13909, 29897, 13, 13, 4706, 396, 8701, 8273, 13, 4706, 3918, 29918, 15287, 353, 269, 29941, 29889, 15287, 13, 4706, 822, 2888, 29918, 15287, 29898, 29878, 1125, 13, 9651, 396, 8251, 3918, 1400, 29886, 13, 9651, 565, 1246, 519, 29898, 15770, 29918, 15287, 1125, 13, 18884, 1121, 353, 3918, 29918, 15287, 29898, 29878, 29897, 13, 13, 9651, 274, 978, 353, 364, 29889, 9700, 29918, 978, 13, 9651, 565, 451, 274, 978, 29901, 13, 18884, 285, 353, 269, 29941, 2585, 29889, 3696, 29918, 3696, 29889, 3696, 29918, 1853, 29918, 333, 13, 18884, 285, 29889, 949, 519, 353, 285, 29889, 8231, 519, 353, 7700, 13, 13, 9651, 25342, 274, 978, 1275, 376, 7662, 1115, 13, 18884, 515, 3144, 29884, 265, 1053, 8519, 29918, 29923, 3580, 15631, 29918, 1955, 13, 18884, 515, 269, 29941, 1053, 8519, 29918, 12413, 29918, 9800, 29892, 317, 29941, 4176, 7281, 2500, 29892, 317, 29941, 4176, 797, 1220, 5308, 13, 18884, 372, 519, 353, 269, 29941, 2585, 29889, 3696, 29918, 3742, 1693, 13, 18884, 2346, 353, 313, 8270, 29889, 3696, 29918, 333, 1275, 364, 29889, 333, 29897, 669, 320, 13, 462, 4706, 313, 8270, 29889, 15603, 1275, 7700, 29897, 669, 320, 13, 462, 4706, 313, 8270, 29889, 311, 22742, 1275, 7700, 29897, 13, 18884, 731, 353, 1857, 29889, 2585, 29898, 1972, 29897, 13, 18884, 285, 353, 269, 29941, 2585, 29889, 3696, 29918, 7662, 29889, 3742, 1693, 29918, 333, 13, 18884, 285, 29889, 276, 339, 2658, 353, 8519, 29918, 29923, 3580, 15631, 29918, 1955, 29898, 13, 462, 18884, 8519, 29918, 12413, 29918, 9800, 29898, 842, 29892, 376, 3696, 29918, 3742, 1693, 29889, 333, 613, 13, 462, 462, 3986, 285, 29889, 276, 6338, 29892, 13, 462, 462, 3986, 1797, 1609, 543, 3696, 29918, 3742, 1693, 29889, 978, 613, 13, 462, 462, 3986, 2656, 29922, 5574, 876, 13, 18884, 2181, 566, 29918, 689, 353, 317, 29941, 4176, 7281, 2500, 29898, 13, 462, 1678, 317, 29941, 4176, 797, 1220, 5308, 703, 3742, 1693, 613, 13, 462, 462, 308, 4235, 353, 518, 703, 613, 376, 3742, 1693, 29918, 333, 1159, 1402, 13, 462, 462, 308, 3858, 353, 323, 703, 797, 29883, 1693, 4968, 13, 462, 462, 308, 2999, 353, 7700, 29892, 13, 462, 462, 308, 4175, 1609, 353, 9657, 29898, 2671, 353, 376, 3696, 29918, 333, 613, 13, 462, 462, 462, 308, 3987, 353, 364, 29889, 333, 29892, 13, 462, 462, 462, 308, 1723, 13, 462, 462, 308, 10353, 13, 462, 1678, 376, 978, 613, 13, 462, 1678, 376, 8216, 613, 13, 462, 1678, 376, 4993, 613, 13, 462, 1678, 376, 29886, 21766, 613, 13, 462, 1678, 376, 412, 29918, 333, 613, 13, 462, 1678, 376, 1256, 29918, 29123, 613, 13, 462, 1678, 376, 4882, 613, 13, 462, 1678, 376, 21032, 613, 13, 462, 1678, 1723, 13, 18884, 364, 29889, 9700, 29889, 17591, 29898, 7283, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 462, 418, 1723, 13, 462, 13, 9651, 25342, 364, 29889, 276, 26081, 1275, 376, 7323, 786, 29908, 322, 364, 29889, 657, 29918, 16908, 29889, 657, 703, 1493, 29908, 1125, 13, 18884, 396, 6977, 14340, 363, 8857, 297, 22280, 6864, 310, 9266, 1693, 22666, 470, 6864, 20802, 4839, 13, 18884, 396, 1939, 18527, 1951, 445, 338, 373, 278, 6977, 786, 13, 18884, 269, 29941, 29889, 7283, 566, 29918, 19651, 3366, 3696, 29918, 3696, 16862, 3257, 29918, 4990, 353, 5124, 13, 18884, 396, 1939, 1653, 2826, 669, 323, 25129, 1051, 29918, 9621, 13, 18884, 565, 274, 978, 1275, 376, 3742, 1693, 1115, 13, 462, 1678, 1051, 29918, 9621, 353, 6796, 1256, 613, 13, 462, 462, 259, 376, 978, 613, 13, 462, 462, 259, 376, 3742, 1693, 29918, 1853, 29918, 333, 613, 13, 462, 462, 259, 4514, 13, 18884, 25342, 274, 978, 1275, 376, 2972, 1115, 13, 462, 1678, 1051, 29918, 9621, 353, 6796, 3742, 1693, 29918, 333, 613, 13, 462, 462, 259, 376, 2972, 29918, 333, 613, 13, 462, 462, 259, 376, 4882, 29918, 333, 613, 13, 462, 462, 259, 4514, 13, 18884, 25342, 274, 978, 1275, 376, 2490, 1115, 13, 462, 1678, 1051, 29918, 9621, 353, 6796, 1256, 613, 13, 462, 462, 259, 376, 13757, 29918, 333, 613, 13, 462, 462, 259, 376, 29886, 21766, 613, 13, 462, 462, 259, 376, 4882, 29918, 333, 613, 13, 462, 462, 259, 376, 2587, 613, 13, 462, 462, 259, 4514, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 10575, 29876, 29915, 29873, 679, 1244, 541, 864, 304, 4772, 21985, 13, 462, 1678, 1051, 29918, 9621, 353, 5159, 13, 18884, 364, 29889, 9700, 29889, 17591, 29898, 7851, 519, 353, 7700, 29892, 13, 462, 462, 418, 1051, 29918, 9621, 353, 1051, 29918, 9621, 29892, 13, 462, 462, 418, 1723, 13, 13, 9651, 736, 5852, 13, 4706, 269, 29941, 29889, 15287, 353, 2888, 29918, 15287, 13, 13, 4706, 396, 8701, 364, 6672, 18859, 13, 4706, 12421, 353, 9657, 29898, 5552, 29897, 13, 4706, 12421, 3366, 29878, 6672, 3108, 353, 281, 562, 459, 29918, 3696, 29918, 29878, 6672, 13, 13, 4706, 736, 12421, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 3696, 29918, 3696, 29918, 8299, 353, 2888, 895, 29918, 3696, 29918, 3696, 29918, 8299, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 3696, 29918, 3742, 1693, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 515, 3144, 29884, 265, 1053, 319, 29892, 3988, 13, 4706, 515, 269, 29941, 1053, 269, 29941, 29918, 2671, 5696, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 13, 4706, 396, 19181, 8989, 29879, 13, 4706, 372, 519, 353, 269, 29941, 2585, 29889, 3696, 29918, 3742, 1693, 13, 4706, 396, 4397, 353, 372, 519, 3032, 18714, 29918, 23515, 29889, 4397, 13, 13, 4706, 822, 15134, 29918, 978, 29898, 798, 1125, 13, 9651, 736, 319, 29898, 798, 3366, 3696, 29918, 3742, 1693, 29889, 978, 12436, 13, 462, 268, 903, 12653, 353, 3988, 29898, 29883, 543, 3696, 613, 285, 543, 3742, 1693, 613, 13, 462, 462, 6389, 11759, 798, 3366, 3696, 29918, 3742, 1693, 29889, 333, 12436, 376, 6341, 12436, 13, 462, 462, 6081, 353, 12633, 396, 9801, 694, 869, 29874, 7221, 13, 462, 462, 10353, 13, 462, 268, 1723, 13, 4706, 396, 4397, 29898, 3073, 29889, 4062, 703, 978, 29918, 3808, 613, 15134, 29918, 978, 876, 13, 4706, 372, 519, 29889, 978, 29918, 3808, 353, 269, 29941, 29918, 2671, 5696, 703, 978, 29918, 3808, 613, 13, 462, 462, 965, 15134, 29918, 978, 29892, 13, 462, 462, 965, 396, 975, 29899, 2426, 278, 2322, 2755, 310, 269, 29941, 29918, 2523, 356, 304, 5557, 4544, 1641, 13751, 2086, 4688, 13, 462, 462, 965, 2755, 353, 14013, 325, 29901, 325, 29892, 13, 462, 462, 965, 1723, 13, 13, 4706, 822, 15134, 29918, 4882, 29898, 798, 1125, 13, 9651, 565, 1948, 3366, 3696, 29918, 3742, 1693, 29889, 735, 6269, 895, 3108, 29901, 13, 18884, 4660, 353, 323, 703, 3057, 292, 1159, 13, 9651, 25342, 451, 1948, 3366, 3696, 29918, 3742, 1693, 29889, 355, 29918, 1256, 3108, 29901, 13, 18884, 4660, 353, 323, 703, 6585, 1159, 13, 9651, 1683, 29901, 13, 18884, 4660, 353, 323, 703, 6821, 2662, 1159, 13, 9651, 736, 4660, 13, 4706, 396, 4397, 29898, 3073, 29889, 4062, 703, 4882, 613, 15134, 29918, 4882, 876, 13, 4706, 372, 519, 29889, 4882, 353, 269, 29941, 29918, 2671, 5696, 703, 4882, 613, 15134, 29918, 4882, 29897, 13, 13, 4706, 565, 364, 29889, 5696, 1275, 376, 23721, 344, 29908, 470, 364, 29889, 657, 29918, 16908, 29889, 657, 703, 23721, 344, 29908, 1125, 13, 9651, 396, 9266, 1693, 22415, 344, 13, 9651, 4833, 353, 1857, 29889, 2585, 13, 9651, 604, 2371, 353, 269, 29941, 2585, 29889, 3696, 29918, 14318, 13, 9651, 822, 15134, 29918, 13237, 29898, 798, 1125, 13, 18884, 2346, 353, 313, 814, 519, 29889, 3696, 29918, 333, 1275, 1948, 3366, 3696, 29918, 3742, 1693, 29889, 333, 20068, 669, 320, 13, 462, 4706, 313, 814, 519, 29889, 311, 22742, 1275, 7700, 29897, 13, 18884, 7788, 353, 4833, 29898, 1972, 467, 2798, 580, 13, 18884, 736, 7788, 13, 9651, 396, 4397, 29898, 3073, 29889, 4062, 703, 13237, 613, 15134, 29918, 13237, 876, 13, 9651, 372, 519, 29889, 13237, 353, 269, 29941, 29918, 2671, 5696, 703, 13237, 613, 15134, 29918, 13237, 29897, 13, 13, 9651, 634, 2371, 353, 269, 29941, 2585, 29889, 3696, 29918, 4039, 13, 9651, 260, 2371, 353, 269, 29941, 2585, 29889, 29883, 1516, 29918, 4039, 13, 9651, 822, 15134, 29918, 11338, 29898, 798, 1125, 13, 18884, 2346, 353, 313, 1803, 519, 29889, 3742, 1693, 29918, 333, 1275, 1948, 3366, 3696, 29918, 3742, 1693, 29889, 333, 20068, 669, 320, 13, 462, 4706, 313, 1803, 519, 29889, 311, 22742, 1275, 7700, 29897, 669, 320, 13, 462, 4706, 313, 1803, 519, 29889, 4039, 29918, 333, 1275, 260, 2371, 29889, 333, 29897, 13, 18884, 8282, 353, 4833, 29898, 1972, 467, 2622, 29898, 698, 519, 29889, 978, 29897, 13, 18884, 565, 8282, 29901, 13, 462, 1678, 8282, 353, 518, 29873, 29889, 978, 363, 260, 297, 8282, 29962, 13, 462, 1678, 8282, 353, 9162, 11393, 7122, 29898, 11338, 29897, 13, 462, 1678, 736, 8282, 13, 18884, 1683, 29901, 13, 462, 1678, 736, 1857, 29889, 19158, 3366, 29940, 12413, 3108, 13, 9651, 396, 4397, 29898, 3073, 29889, 4062, 703, 11338, 613, 15134, 29918, 11338, 876, 13, 9651, 372, 519, 29889, 11338, 353, 269, 29941, 29918, 2671, 5696, 703, 11338, 613, 15134, 29918, 11338, 29897, 13, 13, 9651, 1051, 29918, 9621, 353, 17288, 29911, 703, 1170, 4968, 376, 978, 29918, 3808, 4968, 13, 462, 965, 313, 29911, 703, 5709, 4968, 376, 4882, 4968, 13, 462, 965, 313, 29911, 703, 1542, 4968, 376, 3742, 1693, 29918, 1853, 29918, 333, 4968, 13, 462, 965, 313, 29911, 703, 24214, 379, 473, 4968, 376, 1256, 4968, 13, 462, 965, 313, 29911, 703, 6821, 2662, 4968, 376, 355, 29918, 1256, 4968, 13, 462, 965, 313, 29911, 703, 16885, 4968, 376, 5479, 29889, 5479, 29918, 333, 29889, 29931, 29941, 4968, 13, 462, 965, 313, 29911, 703, 2792, 4968, 376, 5479, 29889, 5479, 29918, 333, 29889, 29931, 29896, 4968, 13, 462, 965, 313, 29911, 703, 28089, 4968, 376, 11338, 4968, 13, 462, 965, 313, 29911, 703, 13770, 4968, 376, 13237, 4968, 13, 462, 965, 313, 29911, 703, 2624, 4968, 376, 3696, 29918, 333, 4968, 13, 462, 965, 4514, 13, 4706, 1683, 29901, 13, 9651, 396, 8778, 3488, 470, 6864, 20802, 13, 9651, 1051, 29918, 9621, 353, 17288, 29911, 703, 1170, 4968, 376, 978, 29918, 3808, 4968, 13, 462, 965, 313, 29911, 703, 5709, 4968, 376, 4882, 4968, 13, 462, 965, 313, 29911, 703, 1542, 4968, 376, 3742, 1693, 29918, 1853, 29918, 333, 4968, 13, 462, 965, 376, 5479, 29918, 333, 613, 13, 462, 965, 313, 29911, 703, 4763, 4968, 376, 1256, 4968, 13, 462, 965, 4514, 13, 13, 4706, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 539, 4805, 29918, 9621, 353, 4852, 978, 613, 13, 462, 462, 539, 376, 355, 29918, 1256, 613, 13, 462, 462, 539, 376, 735, 6269, 895, 613, 13, 462, 462, 539, 10353, 13, 462, 539, 1051, 29918, 9621, 353, 1051, 29918, 9621, 29892, 13, 462, 539, 1797, 1609, 353, 376, 3696, 29918, 3742, 1693, 29889, 978, 613, 13, 462, 539, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 3696, 29918, 3742, 1693, 29918, 10314, 353, 2888, 895, 29918, 3696, 29918, 3742, 1693, 29918, 10314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 3696, 29918, 3742, 1693, 29918, 8299, 29898, 1068, 5552, 1125, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 4706, 2933, 353, 1857, 29889, 5327, 13, 4706, 269, 29941, 353, 2933, 29889, 29879, 29941, 13, 13, 4706, 396, 16012, 4226, 1904, 304, 367, 2221, 304, 5712, 5285, 13, 4706, 1591, 353, 269, 29941, 2585, 29889, 3696, 29918, 3742, 1693, 13, 13, 4706, 1591, 29889, 3696, 29918, 333, 29889, 949, 519, 353, 1591, 29889, 3696, 29918, 333, 29889, 8231, 519, 353, 5852, 13, 13, 4706, 396, 8701, 22415, 344, 13, 4706, 515, 17475, 29889, 29956, 2477, 4590, 29889, 1285, 11897, 1053, 15134, 29918, 29933, 798, 344, 29892, 15134, 29918, 13909, 13, 4706, 731, 29918, 5696, 353, 269, 29941, 2585, 29889, 842, 29918, 5696, 13, 4706, 731, 29918, 5696, 703, 3696, 613, 376, 3742, 1693, 613, 13, 462, 259, 1158, 353, 376, 23721, 344, 613, 13, 462, 259, 3158, 353, 15134, 29918, 29933, 798, 344, 29897, 13, 13, 4706, 396, 8701, 20802, 13, 4706, 731, 29918, 5696, 703, 3696, 613, 376, 3742, 1693, 613, 13, 462, 259, 1158, 353, 376, 6341, 613, 13, 462, 259, 3158, 353, 15134, 29918, 13909, 29897, 13, 13, 4706, 396, 29879, 29941, 29889, 7283, 566, 29918, 19651, 3366, 3696, 29918, 3742, 1693, 16862, 3257, 29918, 1761, 353, 29871, 323, 703, 29933, 798, 344, 9266, 16719, 1159, 13, 13, 4706, 396, 8701, 8273, 13, 4706, 3918, 29918, 15287, 353, 269, 29941, 29889, 15287, 13, 4706, 822, 2888, 29918, 15287, 29898, 29878, 1125, 13, 9651, 396, 8251, 3918, 1400, 29886, 13, 9651, 565, 1246, 519, 29898, 15770, 29918, 15287, 1125, 13, 18884, 1121, 353, 3918, 29918, 15287, 29898, 29878, 29897, 13, 13, 9651, 565, 364, 29889, 5696, 1275, 376, 16645, 1115, 13, 18884, 1857, 29889, 6510, 29889, 3396, 353, 5124, 13, 13, 9651, 25342, 364, 29889, 9700, 29918, 978, 1275, 376, 7662, 1115, 13, 18884, 515, 269, 29941, 1053, 317, 29941, 4176, 7281, 2500, 13, 18884, 2181, 566, 29918, 689, 353, 317, 29941, 4176, 7281, 2500, 703, 978, 613, 13, 462, 462, 9651, 376, 8216, 613, 13, 462, 462, 9651, 376, 4993, 613, 13, 462, 462, 9651, 376, 29886, 21766, 613, 13, 462, 462, 9651, 376, 412, 29918, 333, 613, 13, 462, 462, 9651, 376, 1256, 29918, 29123, 613, 13, 462, 462, 9651, 376, 4882, 613, 13, 462, 462, 9651, 376, 21032, 613, 13, 462, 462, 9651, 1723, 13, 18884, 364, 29889, 9700, 29889, 17591, 29898, 7283, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 462, 418, 1723, 13, 13, 9651, 25342, 364, 29889, 276, 26081, 1275, 376, 7323, 786, 1115, 13, 18884, 565, 451, 364, 29889, 9700, 29901, 13, 462, 1678, 565, 364, 29889, 657, 29918, 16908, 29889, 657, 703, 842, 29918, 3696, 29908, 1125, 13, 462, 4706, 396, 6977, 786, 925, 1304, 304, 1544, 304, 6864, 13, 462, 4706, 396, 29879, 29941, 29889, 7283, 566, 29918, 19651, 3366, 3696, 29918, 3742, 1693, 16862, 3257, 29918, 5504, 353, 29871, 323, 703, 2528, 304, 6864, 1159, 13, 462, 4706, 515, 269, 29941, 1053, 317, 29941, 4176, 7281, 2500, 13, 462, 4706, 2181, 566, 29918, 689, 353, 317, 29941, 4176, 7281, 2500, 703, 3696, 29918, 333, 613, 13, 462, 462, 462, 1678, 1723, 13, 462, 4706, 269, 29941, 2585, 29889, 17591, 703, 3696, 29918, 3742, 1693, 613, 13, 462, 462, 539, 2181, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 462, 539, 1723, 13, 18884, 396, 23681, 364, 29889, 9700, 29918, 978, 1275, 376, 2490, 1115, 13, 18884, 396, 1678, 515, 269, 29941, 1053, 317, 29941, 4176, 7281, 2500, 13, 13, 18884, 396, 1678, 2181, 566, 29918, 689, 353, 317, 29941, 4176, 7281, 2500, 703, 2587, 613, 13, 18884, 396, 462, 18884, 1723, 13, 13, 18884, 396, 1678, 269, 29941, 2585, 29889, 17591, 703, 29883, 1516, 29918, 2490, 613, 13, 18884, 396, 462, 259, 2181, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 18884, 396, 462, 259, 1723, 13, 13, 9651, 736, 5852, 13, 4706, 269, 29941, 29889, 15287, 353, 2888, 29918, 15287, 13, 13, 4706, 396, 8701, 1400, 29886, 13, 4706, 3918, 29918, 2490, 29886, 353, 269, 29941, 29889, 2490, 29886, 13, 4706, 822, 2888, 29918, 2490, 29886, 29898, 29878, 29892, 1962, 1125, 13, 9651, 396, 8251, 3918, 1400, 29886, 13, 9651, 565, 1246, 519, 29898, 15770, 29918, 2490, 29886, 1125, 13, 18884, 1962, 353, 3918, 29918, 2490, 29886, 29898, 29878, 29892, 1962, 29897, 13, 13, 9651, 565, 364, 29889, 1639, 4925, 322, 338, 8758, 29898, 4905, 29892, 9657, 1125, 13, 18884, 565, 364, 29889, 5696, 1275, 376, 16645, 1115, 13, 462, 1678, 396, 1939, 7488, 20019, 13, 462, 1678, 1857, 29889, 6510, 29889, 3396, 353, 5124, 13, 462, 1678, 396, 8701, 4533, 304, 19863, 3109, 2913, 2768, 18218, 13, 462, 1678, 1053, 2897, 13, 462, 1678, 2933, 29889, 1493, 353, 2897, 29889, 2084, 29889, 7122, 29898, 29878, 29889, 12083, 29892, 13, 462, 462, 462, 376, 7576, 613, 376, 20943, 613, 13, 462, 462, 462, 376, 29956, 2477, 4590, 613, 376, 7406, 613, 13, 462, 462, 462, 376, 16645, 29889, 1420, 1159, 13, 18884, 396, 23681, 364, 29889, 9700, 29918, 978, 1275, 376, 2490, 1115, 13, 18884, 396, 1678, 396, 3462, 917, 448, 694, 29892, 437, 3132, 29899, 2975, 13, 18884, 396, 1678, 1962, 3366, 689, 16862, 4397, 580, 13, 13, 18884, 396, 2870, 29901, 13, 18884, 396, 1678, 396, 6991, 5219, 470, 20802, 6515, 13, 18884, 396, 1678, 396, 3462, 3245, 11949, 13, 18884, 396, 1678, 269, 29941, 29889, 23176, 29918, 9783, 354, 1691, 4619, 6796, 991, 597, 13687, 29889, 3959, 523, 8205, 29889, 510, 29914, 10254, 29914, 9346, 5570, 29941, 29914, 12333, 29914, 4268, 29914, 9346, 5570, 29889, 4268, 613, 13, 18884, 396, 462, 18884, 376, 991, 597, 28586, 29889, 15947, 29889, 510, 29914, 4268, 29973, 11922, 29922, 15836, 374, 705, 1624, 29901, 29946, 29900, 29900, 29892, 29955, 29900, 29900, 29989, 4435, 29974, 29903, 550, 29974, 1184, 29901, 29946, 29900, 29900, 29892, 29955, 29900, 29900, 613, 13, 18884, 396, 462, 18884, 4514, 13, 13, 462, 1678, 396, 361, 364, 29889, 5696, 1275, 376, 7727, 1115, 13, 462, 1678, 396, 1678, 396, 4673, 278, 8701, 8722, 1813, 2012, 310, 278, 4226, 697, 13, 462, 1678, 396, 1678, 515, 3144, 29884, 265, 1053, 3988, 13, 462, 1678, 396, 1678, 515, 269, 29941, 1053, 317, 29941, 11341, 15789, 13, 462, 1678, 396, 1678, 2888, 29918, 2271, 353, 3988, 29898, 5085, 353, 6796, 29961, 333, 29962, 613, 376, 6341, 20068, 13, 462, 1678, 396, 1678, 317, 29941, 11341, 15789, 29889, 2467, 29918, 4187, 7453, 29898, 29878, 29892, 13, 462, 1678, 396, 462, 3986, 1303, 29918, 2271, 29922, 6341, 29918, 2271, 29892, 13, 462, 1678, 396, 462, 3986, 2767, 29918, 2271, 29922, 6341, 29918, 2271, 29897, 13, 13, 1669, 396, 268, 396, 2184, 29899, 8157, 28861, 13, 1669, 396, 268, 515, 17475, 29889, 29956, 2477, 4590, 29889, 1285, 11897, 1053, 2888, 29918, 29956, 2477, 4590, 13, 1669, 396, 268, 2888, 353, 2888, 29918, 29956, 2477, 4590, 580, 13, 1669, 396, 268, 1962, 3366, 5205, 29918, 8157, 3108, 353, 2888, 3032, 5205, 29918, 8157, 29918, 1420, 580, 13, 13, 9651, 736, 1962, 13, 4706, 269, 29941, 29889, 2490, 29886, 353, 2888, 29918, 2490, 29886, 13, 13, 4706, 396, 8701, 364, 6672, 18859, 13, 4706, 396, 5552, 353, 9657, 29898, 5552, 29897, 13, 4706, 396, 5552, 3366, 29878, 6672, 3108, 353, 281, 562, 459, 29918, 3696, 29918, 29878, 6672, 13, 4706, 12421, 3366, 29878, 6672, 3108, 353, 6213, 13, 13, 4706, 396, 1939, 2625, 1646, 6143, 13, 4706, 1857, 29889, 6510, 29889, 6768, 353, 6213, 13, 13, 4706, 736, 12421, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 3696, 29918, 3742, 1693, 29918, 8299, 353, 2888, 895, 29918, 3696, 29918, 3742, 1693, 29918, 8299, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 3696, 29918, 26029, 29918, 10314, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 515, 3144, 29884, 265, 1053, 319, 29892, 3988, 13, 4706, 515, 269, 29941, 1053, 269, 29941, 29918, 2671, 5696, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 13, 4706, 396, 19181, 8989, 29879, 13, 4706, 396, 29849, 1304, 515, 2845, 278, 6864, 470, 9266, 1693, 3030, 13, 4706, 285, 353, 364, 29889, 2220, 13, 4706, 2407, 29918, 333, 353, 364, 29889, 333, 13, 4706, 321, 1092, 2371, 353, 269, 29941, 2585, 29889, 3696, 29918, 26029, 29918, 10314, 13, 4706, 22157, 29918, 276, 6338, 353, 321, 1092, 2371, 29889, 26029, 29918, 10314, 29918, 333, 29889, 276, 6338, 13, 4706, 822, 22157, 29918, 978, 29898, 798, 1125, 13, 9651, 22157, 29918, 333, 353, 1948, 3366, 3696, 29918, 26029, 29918, 10314, 29889, 26029, 29918, 10314, 29918, 333, 3108, 13, 9651, 736, 319, 29898, 1092, 29918, 276, 6338, 29898, 1092, 29918, 333, 511, 13, 462, 268, 903, 12653, 353, 3988, 29898, 29883, 543, 3696, 613, 285, 29922, 29888, 29892, 13, 462, 462, 6389, 11759, 11651, 29918, 333, 29892, 376, 26029, 29918, 10314, 613, 22157, 29918, 333, 29892, 376, 10185, 12436, 13, 462, 462, 10353, 13, 462, 268, 1723, 13, 4706, 321, 1092, 2371, 29889, 978, 29918, 3808, 353, 269, 29941, 29918, 2671, 5696, 703, 978, 29918, 3808, 613, 13, 462, 462, 632, 22157, 29918, 978, 29892, 13, 462, 462, 632, 396, 975, 29899, 2426, 278, 2322, 2755, 310, 269, 29941, 29918, 2523, 356, 304, 5557, 4544, 1641, 13751, 2086, 4688, 13, 462, 462, 632, 396, 732, 1762, 6132, 29901, 8313, 29895, 1106, 14340, 13, 462, 462, 632, 2755, 353, 14013, 325, 29901, 325, 29892, 13, 462, 462, 632, 1723, 13, 13, 4706, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 539, 396, 7283, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 539, 4805, 29918, 9621, 353, 4852, 26029, 29918, 10314, 29918, 333, 613, 13, 462, 462, 539, 10353, 13, 462, 539, 1051, 29918, 9621, 353, 17288, 29911, 703, 1170, 4968, 376, 978, 29918, 3808, 4968, 13, 462, 462, 418, 313, 29911, 703, 7030, 4968, 376, 26029, 29918, 10314, 29918, 333, 29938, 9057, 29918, 3257, 29918, 333, 4968, 13, 462, 462, 418, 376, 26029, 29918, 10314, 29918, 333, 29938, 22481, 29918, 333, 613, 13, 462, 462, 418, 313, 29911, 703, 9823, 4968, 376, 26029, 29918, 10314, 29918, 333, 29938, 10532, 29918, 333, 29938, 5269, 29889, 1767, 4968, 13, 462, 462, 418, 313, 29911, 703, 9861, 4968, 376, 26029, 29918, 10314, 29918, 333, 29938, 10532, 29918, 333, 29938, 6710, 29889, 1767, 4968, 13, 462, 462, 418, 376, 4882, 613, 13, 462, 462, 418, 313, 29911, 703, 3664, 267, 4968, 376, 21032, 4968, 13, 462, 462, 418, 21251, 13, 462, 539, 1797, 1609, 353, 376, 3696, 29918, 26029, 29918, 10314, 29889, 26029, 29918, 10314, 29918, 333, 613, 13, 462, 539, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 3696, 29918, 26029, 29918, 10314, 29918, 10314, 353, 2888, 895, 29918, 3696, 29918, 26029, 29918, 10314, 29918, 10314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 3696, 29918, 22481, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 515, 3144, 29884, 265, 1053, 319, 29892, 3988, 13, 4706, 515, 269, 29941, 1053, 269, 29941, 29918, 2671, 5696, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 13, 4706, 396, 19181, 8989, 29879, 13, 4706, 396, 29849, 1304, 515, 2845, 278, 6864, 470, 9266, 1693, 3030, 13, 4706, 285, 353, 364, 29889, 2220, 13, 4706, 2407, 29918, 333, 353, 364, 29889, 333, 13, 4706, 321, 327, 519, 353, 269, 29941, 2585, 29889, 3696, 29918, 22481, 13, 4706, 1638, 29918, 276, 6338, 353, 321, 327, 519, 29889, 22481, 29918, 333, 29889, 276, 6338, 13, 4706, 822, 1638, 29918, 978, 29898, 798, 1125, 13, 9651, 24788, 29918, 333, 353, 1948, 3366, 3696, 29918, 22481, 29889, 22481, 29918, 333, 3108, 13, 9651, 736, 319, 29898, 990, 29918, 276, 6338, 29898, 22481, 29918, 333, 511, 13, 462, 268, 903, 12653, 353, 3988, 29898, 29883, 543, 3696, 613, 285, 29922, 29888, 29892, 13, 462, 462, 6389, 11759, 11651, 29918, 333, 29892, 376, 22481, 613, 24788, 29918, 333, 29892, 376, 10185, 12436, 13, 462, 462, 10353, 13, 462, 268, 1723, 13, 4706, 321, 327, 519, 29889, 978, 29918, 3808, 353, 269, 29941, 29918, 2671, 5696, 703, 978, 29918, 3808, 613, 13, 462, 462, 9651, 1638, 29918, 978, 29892, 13, 462, 462, 9651, 396, 975, 29899, 2426, 278, 2322, 2755, 310, 269, 29941, 29918, 2523, 356, 304, 5557, 4544, 1641, 13751, 2086, 4688, 13, 462, 462, 9651, 396, 732, 1762, 6132, 29901, 8313, 29895, 1106, 14340, 13, 462, 462, 9651, 2755, 353, 14013, 325, 29901, 325, 29892, 13, 462, 462, 9651, 1723, 13, 13, 4706, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 539, 396, 7283, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 539, 4805, 29918, 9621, 353, 4852, 22481, 29918, 333, 613, 13, 462, 462, 539, 10353, 13, 462, 539, 1051, 29918, 9621, 353, 17288, 29911, 703, 1170, 4968, 376, 978, 29918, 3808, 4968, 13, 462, 462, 418, 376, 4882, 613, 13, 462, 462, 418, 376, 21032, 613, 13, 462, 462, 418, 21251, 13, 462, 539, 1797, 1609, 353, 376, 3696, 29918, 22481, 29889, 22481, 29918, 333, 613, 13, 462, 539, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 3696, 29918, 22481, 29918, 10314, 353, 2888, 895, 29918, 3696, 29918, 22481, 29918, 10314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 3696, 29918, 14318, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 515, 3144, 29884, 265, 1053, 319, 29892, 3988, 13, 4706, 515, 269, 29941, 1053, 269, 29941, 29918, 2671, 5696, 29892, 317, 29941, 4176, 7281, 2500, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 4706, 604, 2371, 353, 269, 29941, 2585, 29889, 3696, 29918, 14318, 13, 13, 4706, 396, 1940, 519, 29889, 2972, 29918, 333, 29889, 1643, 353, 323, 703, 6848, 1159, 13, 13, 4706, 396, 3812, 13, 4706, 396, 732, 1762, 6132, 29901, 6975, 1716, 8583, 669, 6864, 29918, 19409, 297, 29871, 29896, 883, 13, 4706, 2181, 566, 29918, 689, 353, 317, 29941, 4176, 7281, 2500, 703, 3742, 1693, 29918, 333, 613, 13, 462, 462, 1678, 376, 2972, 29918, 333, 613, 13, 462, 462, 1678, 376, 4882, 29918, 333, 613, 13, 462, 462, 1678, 1723, 13, 13, 4706, 396, 19181, 8989, 29879, 13, 4706, 396, 29849, 1304, 515, 2845, 278, 6864, 470, 9266, 1693, 3030, 13, 4706, 285, 353, 364, 29889, 2220, 13, 4706, 2407, 29918, 333, 353, 364, 29889, 333, 13, 4706, 2318, 29918, 276, 6338, 353, 604, 2371, 29889, 2972, 29918, 333, 29889, 276, 6338, 13, 4706, 822, 3815, 29918, 978, 29898, 798, 1125, 13, 9651, 2318, 29918, 333, 353, 1948, 3366, 3696, 29918, 14318, 29889, 2972, 29918, 333, 3108, 13, 9651, 736, 319, 29898, 2972, 29918, 276, 6338, 29898, 2972, 29918, 333, 511, 13, 462, 268, 903, 12653, 353, 3988, 29898, 29883, 543, 3696, 613, 285, 29922, 29888, 29892, 13, 462, 462, 6389, 11759, 11651, 29918, 333, 29892, 376, 2972, 613, 2318, 29918, 333, 29892, 376, 10185, 12436, 13, 462, 462, 6081, 353, 12633, 396, 9801, 694, 869, 29874, 7221, 13, 462, 462, 10353, 13, 462, 268, 1723, 13, 4706, 604, 2371, 29889, 978, 29918, 3808, 353, 269, 29941, 29918, 2671, 5696, 703, 978, 29918, 3808, 613, 13, 462, 462, 9651, 3815, 29918, 978, 29892, 13, 462, 462, 9651, 396, 975, 29899, 2426, 278, 2322, 2755, 310, 269, 29941, 29918, 2523, 356, 304, 5557, 4544, 1641, 13751, 2086, 4688, 13, 462, 462, 9651, 396, 732, 1762, 6132, 29901, 8313, 29895, 1106, 14340, 13, 462, 462, 9651, 2755, 353, 14013, 325, 29901, 325, 29892, 13, 462, 462, 9651, 1723, 13, 13, 4706, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 539, 2181, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 539, 4805, 29918, 9621, 353, 4852, 2972, 29918, 333, 613, 13, 462, 462, 539, 10353, 13, 462, 539, 1051, 29918, 9621, 353, 17288, 29911, 703, 1170, 4968, 376, 978, 29918, 3808, 4968, 13, 462, 462, 418, 376, 4882, 29918, 333, 613, 13, 462, 462, 418, 21251, 13, 462, 539, 1797, 1609, 353, 376, 558, 29918, 2972, 29889, 978, 613, 13, 462, 539, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 3696, 29918, 14318, 29918, 10314, 353, 2888, 895, 29918, 3696, 29918, 14318, 29918, 10314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 558, 29918, 2972, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 13, 4706, 1857, 29889, 5327, 29889, 29879, 29941, 29889, 7283, 566, 29918, 19651, 29961, 3891, 2435, 420, 29962, 353, 26162, 29898, 13, 9651, 3858, 29918, 3258, 353, 323, 703, 4391, 18981, 4968, 13, 9651, 3611, 29918, 4990, 353, 323, 703, 6848, 25577, 4968, 13, 9651, 3611, 29918, 1761, 353, 323, 703, 13770, 4968, 13, 9651, 3611, 29918, 5504, 353, 323, 703, 6103, 18981, 4968, 13, 9651, 3858, 29918, 1761, 29918, 3092, 353, 323, 703, 1293, 27562, 4968, 13, 9651, 3858, 29918, 8143, 29918, 3092, 353, 323, 703, 12498, 18981, 4968, 13, 9651, 10191, 29918, 11651, 29918, 11600, 353, 323, 703, 6848, 2715, 4968, 13, 9651, 10191, 29918, 11651, 29918, 1545, 2164, 353, 323, 703, 6848, 4784, 4968, 13, 9651, 10191, 29918, 11651, 29918, 311, 22742, 353, 323, 703, 6848, 11132, 4968, 13, 9651, 10191, 29918, 1761, 29918, 6310, 353, 323, 703, 3782, 27562, 5279, 15443, 5783, 13, 13, 4706, 1746, 353, 269, 29941, 2585, 29889, 558, 29918, 2972, 29889, 4882, 29918, 333, 13, 4706, 1746, 29889, 949, 519, 353, 1746, 29889, 8231, 519, 353, 5852, 13, 13, 4706, 515, 269, 29941, 1053, 317, 29941, 4176, 7281, 2500, 13, 4706, 2181, 566, 29918, 689, 353, 317, 29941, 4176, 7281, 2500, 3552, 29911, 703, 1170, 4968, 376, 978, 4968, 13, 462, 462, 1678, 376, 4882, 29918, 333, 613, 13, 462, 462, 1678, 376, 21032, 613, 13, 462, 462, 1678, 1723, 13, 13, 4706, 1051, 29918, 9621, 353, 17288, 29911, 703, 1170, 4968, 376, 978, 4968, 13, 462, 539, 376, 4882, 29918, 333, 613, 13, 462, 539, 376, 21032, 613, 13, 462, 539, 4514, 13, 13, 4706, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 539, 2181, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 539, 1051, 29918, 9621, 353, 1051, 29918, 9621, 29892, 13, 462, 539, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 558, 29918, 2972, 29918, 10314, 353, 2888, 895, 29918, 558, 29918, 2972, 29918, 10314, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 558, 29918, 10532, 29918, 8299, 29898, 1068, 5552, 1125, 13, 13, 4706, 396, 8701, 20802, 13, 4706, 515, 17475, 29889, 29956, 2477, 4590, 29889, 1285, 11897, 1053, 2022, 29918, 29928, 1161, 3377, 13, 4706, 1857, 29889, 29879, 29941, 2585, 29889, 842, 29918, 5696, 703, 558, 613, 376, 10532, 613, 13, 462, 18884, 1158, 353, 376, 14592, 3377, 613, 13, 462, 18884, 3158, 353, 2022, 29918, 29928, 1161, 3377, 29897, 13, 13, 4706, 396, 1939, 2625, 1646, 6143, 13, 4706, 1857, 29889, 6510, 29889, 6768, 353, 6213, 13, 13, 4706, 736, 12421, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 558, 29918, 10532, 29918, 8299, 353, 2888, 895, 29918, 558, 29918, 10532, 29918, 8299, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 13, 1678, 822, 2888, 895, 29918, 4836, 29918, 7662, 29918, 10314, 29898, 29878, 29892, 4434, 2435, 420, 1125, 13, 13, 4706, 515, 3144, 29884, 265, 1053, 319, 29892, 3988, 13, 4706, 515, 269, 29941, 1053, 269, 29941, 29918, 2671, 5696, 13, 13, 4706, 269, 29941, 2585, 353, 1857, 29889, 29879, 29941, 2585, 13, 13, 4706, 396, 19181, 8989, 29879, 13, 4706, 396, 29849, 1304, 515, 2845, 278, 6864, 470, 9266, 1693, 3030, 13, 4706, 285, 353, 364, 29889, 2220, 13, 4706, 2407, 29918, 333, 353, 364, 29889, 333, 13, 4706, 822, 3414, 29918, 978, 29898, 798, 1125, 13, 9651, 736, 319, 29898, 798, 3366, 4836, 29918, 7662, 29889, 978, 12436, 13, 462, 268, 903, 12653, 353, 3988, 29898, 29883, 543, 3696, 613, 285, 29922, 29888, 29892, 13, 462, 462, 6389, 11759, 11651, 29918, 333, 29892, 376, 7662, 613, 1948, 3366, 4836, 29918, 7662, 29889, 333, 12436, 376, 10185, 12436, 13, 462, 462, 10353, 13, 462, 268, 1723, 13, 4706, 269, 29941, 2585, 29889, 4836, 29918, 7662, 29889, 978, 29918, 3808, 353, 269, 29941, 29918, 2671, 5696, 703, 978, 29918, 3808, 613, 13, 462, 462, 462, 418, 3414, 29918, 978, 29892, 13, 462, 462, 462, 418, 396, 975, 29899, 2426, 278, 2322, 2755, 310, 269, 29941, 29918, 2523, 356, 304, 5557, 4544, 1641, 13751, 2086, 4688, 13, 462, 462, 462, 418, 2755, 353, 14013, 325, 29901, 325, 29892, 13, 462, 462, 462, 418, 1723, 13, 13, 4706, 269, 29941, 2585, 29889, 17591, 29898, 3891, 2435, 420, 29892, 13, 462, 539, 396, 7283, 566, 29918, 689, 353, 2181, 566, 29918, 689, 29892, 13, 462, 539, 4805, 29918, 9621, 353, 4852, 978, 613, 13, 462, 462, 539, 10353, 13, 462, 539, 1051, 29918, 9621, 353, 6796, 4882, 613, 13, 462, 462, 418, 313, 29911, 703, 9868, 4968, 376, 978, 29918, 3808, 4968, 13, 462, 462, 418, 313, 29911, 703, 20399, 4968, 376, 11600, 29918, 265, 4968, 13, 462, 462, 418, 313, 29911, 703, 29928, 434, 4968, 376, 1256, 29918, 29123, 4968, 13, 462, 462, 418, 21251, 13, 462, 539, 1797, 1609, 353, 376, 4836, 29918, 7662, 29889, 1256, 29918, 29123, 613, 13, 462, 539, 1723, 13, 13, 1678, 6055, 29889, 6341, 895, 29918, 4836, 29918, 7662, 29918, 10314, 353, 2888, 895, 29918, 4836, 29918, 7662, 29918, 10314, 13, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 25512, 13, 1753, 281, 562, 459, 29918, 3696, 29918, 29878, 6672, 29898, 29878, 29892, 18859, 29922, 2636, 1125, 13, 1678, 9995, 382, 29963, 3919, 2888, 6503, 9066, 9995, 13, 13, 1678, 565, 364, 29889, 276, 26081, 2804, 376, 1420, 1115, 13, 4706, 396, 18981, 9066, 871, 1304, 297, 28923, 8386, 13, 4706, 736, 6213, 13, 13, 1678, 515, 269, 29941, 1053, 269, 29941, 29918, 29878, 6672, 29918, 10314, 29892, 317, 29941, 6848, 7850, 13, 13, 1678, 4434, 2435, 420, 29892, 2407, 353, 269, 29941, 29918, 29878, 6672, 29918, 10314, 29898, 29878, 29897, 13, 1678, 565, 4434, 2435, 420, 2804, 364, 29889, 3891, 2435, 420, 29901, 13, 4706, 6503, 353, 1857, 29889, 29879, 29941, 2585, 29889, 10314, 29898, 3891, 2435, 420, 29892, 1178, 29922, 11651, 29889, 333, 29897, 13, 1678, 1683, 29901, 13, 4706, 6503, 353, 364, 29889, 10314, 13, 13, 1678, 364, 6672, 353, 6213, 13, 1678, 364, 6672, 29918, 9621, 353, 5159, 13, 13, 1678, 565, 2407, 29901, 13, 4706, 323, 353, 1857, 29889, 29911, 13, 13, 4706, 565, 4434, 2435, 420, 1275, 376, 3696, 29918, 3696, 1115, 13, 13, 9651, 565, 451, 18859, 29901, 13, 18884, 18859, 353, 17288, 29911, 703, 2624, 25577, 4968, 6213, 511, 13, 462, 4706, 313, 29911, 703, 797, 29883, 16719, 4968, 376, 3742, 1693, 4968, 13, 462, 4706, 313, 29911, 703, 2525, 1169, 4968, 376, 2972, 4968, 13, 462, 4706, 313, 29911, 703, 26249, 4968, 376, 7662, 4968, 13, 462, 4706, 313, 29911, 703, 3373, 15190, 4968, 376, 2490, 4968, 13, 462, 4706, 4514, 13, 13, 9651, 364, 6672, 29918, 9621, 353, 518, 3366, 978, 12436, 13, 462, 795, 6796, 2962, 29918, 1256, 12436, 13, 462, 795, 6796, 21032, 12436, 13, 462, 795, 4514, 13, 13, 4706, 25342, 4434, 2435, 420, 1275, 376, 3696, 29918, 3742, 1693, 1115, 13, 13, 9651, 565, 451, 18859, 29901, 13, 18884, 18859, 353, 17288, 29911, 703, 797, 29883, 1693, 25577, 4968, 6213, 511, 13, 462, 4706, 313, 29911, 703, 2525, 1169, 4968, 376, 2972, 4968, 13, 462, 4706, 313, 29911, 703, 26249, 4968, 376, 7662, 4968, 13, 462, 4706, 313, 29911, 703, 3373, 15190, 4968, 376, 2490, 4968, 13, 462, 4706, 4514, 13, 13, 9651, 364, 6672, 29918, 9621, 353, 518, 3366, 978, 12436, 13, 462, 795, 6796, 1256, 12436, 13, 462, 795, 6796, 21032, 12436, 13, 462, 795, 4514, 13, 13, 4706, 364, 6672, 353, 317, 29941, 6848, 7850, 29898, 29878, 6672, 29918, 9621, 29892, 18859, 5033, 29878, 29892, 13, 462, 462, 462, 308, 1591, 29922, 10314, 29889, 2371, 29892, 13, 462, 462, 462, 308, 2407, 29922, 11651, 29892, 13, 462, 462, 462, 308, 1723, 13, 1678, 736, 364, 6672, 13, 13, 29937, 11056, 1275, 9166, 9166, 9166, 9166, 2751, 25512, 13, 2 ]
SNACC_Mapper/trend_node.py
emariwileslee/SNACC
0
97369
# -*- coding: utf-8 -*- """ Created on Wed Apr 7 09:58:55 2021 @author: emari """ import numpy as np import pandas as pd class node(): def __init__(self): self.parent_node = "" self.child_connections = [np.array([],dtype=object),np.array([],dtype=object),np.array([],dtype=object),np.array([],dtype=object),np.array([],dtype=object)] self.username = "" self.connection_type = "" self.bio = "" self.captions = [] self.total_likes = 0 self.total_followers = 0 self.total_following = 0 self.post_date = "" self.root_post_url = "" self.profile_img_url = "" #This is selector for profile image ##react-root > section > main > div > header > div > div > span > img def printNode(self): print("parent node: ",self.parent_node) print("username: ",self.username) print("connection_type: ",self.connection_type) print("total_likes: ",self.total_likes) print("total_followers: ",self.total_followers) print("total_following: ",self.total_following) class nodeClassifier(): def __init__(self,output_location): self.node_list = [] self.output_location = output_location self.node_df = pd.DataFrame(columns=["parent_node","username","connection_type","bio","captions","total_likes","total_followers","total_following","profile_img_url","root_post_url"]) def addNode(self,node):#(self,parent_node,username,connection_type): #nodeBuffer = [parent_node,username,connection_type] nodeBuffer = [node.parent_node,node.username,node.connection_type,node.bio,'foo',node.total_likes,node.total_followers,node.total_following,node.profile_img_url,node.root_post_url] self.node_df = self.node_df.append(pd.Series(nodeBuffer,index=self.node_df.columns),ignore_index=True) self.node_list.append(node) #self.exportNode(node) #print(self.node_df) def printNetwork(self): print(self.node_df) #assume that the parent_node has already been added #add the child node to the db #find the parent node #create the connection from the "parent" to the username def exportNetwork(self): self.node_df.to_csv(self.output_location+"\output.csv",index=False)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 373, 15050, 319, 558, 259, 29955, 29871, 29900, 29929, 29901, 29945, 29947, 29901, 29945, 29945, 29871, 29906, 29900, 29906, 29896, 13, 13, 29992, 8921, 29901, 953, 1306, 13, 15945, 29908, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 13, 13, 1990, 2943, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 3560, 29918, 3177, 353, 5124, 13, 4706, 1583, 29889, 5145, 29918, 11958, 1953, 353, 518, 9302, 29889, 2378, 4197, 1402, 29881, 1853, 29922, 3318, 511, 9302, 29889, 2378, 4197, 1402, 29881, 1853, 29922, 3318, 511, 9302, 29889, 2378, 4197, 1402, 29881, 1853, 29922, 3318, 511, 9302, 29889, 2378, 4197, 1402, 29881, 1853, 29922, 3318, 511, 9302, 29889, 2378, 4197, 1402, 29881, 1853, 29922, 3318, 4638, 13, 4706, 1583, 29889, 6786, 353, 5124, 13, 4706, 1583, 29889, 9965, 29918, 1853, 353, 5124, 13, 4706, 1583, 29889, 24840, 353, 5124, 13, 4706, 1583, 29889, 1113, 1980, 353, 5159, 13, 4706, 1583, 29889, 7827, 29918, 5081, 267, 353, 29871, 29900, 13, 4706, 1583, 29889, 7827, 29918, 23031, 414, 353, 29871, 29900, 13, 4706, 1583, 29889, 7827, 29918, 23031, 292, 353, 29871, 29900, 13, 4706, 1583, 29889, 2490, 29918, 1256, 353, 5124, 13, 4706, 1583, 29889, 4632, 29918, 2490, 29918, 2271, 353, 5124, 13, 4706, 1583, 29889, 10185, 29918, 2492, 29918, 2271, 353, 5124, 13, 4706, 396, 4013, 338, 11764, 363, 8722, 1967, 13, 4706, 444, 8423, 29899, 4632, 1405, 4004, 1405, 1667, 1405, 1933, 1405, 4839, 1405, 1933, 1405, 1933, 1405, 10638, 1405, 10153, 13, 268, 13, 1678, 822, 1596, 4247, 29898, 1311, 1125, 13, 4706, 1596, 703, 3560, 2943, 29901, 9162, 1311, 29889, 3560, 29918, 3177, 29897, 13, 4706, 1596, 703, 6786, 29901, 9162, 1311, 29889, 6786, 29897, 13, 4706, 1596, 703, 9965, 29918, 1853, 29901, 9162, 1311, 29889, 9965, 29918, 1853, 29897, 13, 4706, 1596, 703, 7827, 29918, 5081, 267, 29901, 9162, 1311, 29889, 7827, 29918, 5081, 267, 29897, 13, 4706, 1596, 703, 7827, 29918, 23031, 414, 29901, 9162, 1311, 29889, 7827, 29918, 23031, 414, 29897, 13, 4706, 1596, 703, 7827, 29918, 23031, 292, 29901, 9162, 1311, 29889, 7827, 29918, 23031, 292, 29897, 13, 308, 13, 1990, 2943, 2385, 3709, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4905, 29918, 5479, 1125, 13, 4706, 1583, 29889, 3177, 29918, 1761, 353, 5159, 13, 4706, 1583, 29889, 4905, 29918, 5479, 353, 1962, 29918, 5479, 13, 4706, 1583, 29889, 3177, 29918, 2176, 353, 10518, 29889, 17271, 29898, 13099, 29922, 3366, 3560, 29918, 3177, 3284, 6786, 3284, 9965, 29918, 1853, 3284, 24840, 3284, 1113, 1980, 3284, 7827, 29918, 5081, 267, 3284, 7827, 29918, 23031, 414, 3284, 7827, 29918, 23031, 292, 3284, 10185, 29918, 2492, 29918, 2271, 3284, 4632, 29918, 2490, 29918, 2271, 20068, 13, 308, 13, 13, 13, 1678, 822, 788, 4247, 29898, 1311, 29892, 3177, 1125, 29937, 29898, 1311, 29892, 3560, 29918, 3177, 29892, 6786, 29892, 9965, 29918, 1853, 1125, 13, 4706, 396, 3177, 7701, 353, 518, 3560, 29918, 3177, 29892, 6786, 29892, 9965, 29918, 1853, 29962, 13, 4706, 2943, 7701, 353, 518, 3177, 29889, 3560, 29918, 3177, 29892, 3177, 29889, 6786, 29892, 3177, 29889, 9965, 29918, 1853, 29892, 3177, 29889, 24840, 5501, 5431, 742, 3177, 29889, 7827, 29918, 5081, 267, 29892, 3177, 29889, 7827, 29918, 23031, 414, 29892, 3177, 29889, 7827, 29918, 23031, 292, 29892, 3177, 29889, 10185, 29918, 2492, 29918, 2271, 29892, 3177, 29889, 4632, 29918, 2490, 29918, 2271, 29962, 13, 4706, 1583, 29889, 3177, 29918, 2176, 353, 1583, 29889, 3177, 29918, 2176, 29889, 4397, 29898, 15926, 29889, 19204, 29898, 3177, 7701, 29892, 2248, 29922, 1311, 29889, 3177, 29918, 2176, 29889, 13099, 511, 17281, 29918, 2248, 29922, 5574, 29897, 13, 4706, 1583, 29889, 3177, 29918, 1761, 29889, 4397, 29898, 3177, 29897, 13, 4706, 396, 1311, 29889, 15843, 4247, 29898, 3177, 29897, 13, 4706, 396, 2158, 29898, 1311, 29889, 3177, 29918, 2176, 29897, 13, 308, 13, 1678, 822, 1596, 13724, 29898, 1311, 1125, 13, 4706, 1596, 29898, 1311, 29889, 3177, 29918, 2176, 29897, 13, 4706, 396, 465, 2017, 393, 278, 3847, 29918, 3177, 756, 2307, 1063, 2715, 13, 4706, 396, 1202, 278, 2278, 2943, 304, 278, 4833, 29871, 13, 13, 4706, 396, 2886, 278, 3847, 2943, 29871, 13, 4706, 396, 3258, 278, 3957, 515, 278, 376, 3560, 29908, 304, 278, 8952, 29871, 13, 308, 13, 268, 13, 308, 13, 13, 13, 1678, 822, 5609, 13724, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3177, 29918, 2176, 29889, 517, 29918, 7638, 29898, 1311, 29889, 4905, 29918, 5479, 13578, 29905, 4905, 29889, 7638, 613, 2248, 29922, 8824, 29897, 2 ]
test users/tcp_service_test.py
Tapawingo/FreeTakServer
27
124667
import unittest from test import support import socket import test_data import time from lxml import etree import uuid import asyncio from common_testing_tools import TCPClient class TCPServiceTests(unittest.TestCase): def setUp(self): """ setup method to establish two sockets. this method is run prior to any other tests running and will create the basic sockets required for further testing. """ self.client_socket_a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.client_socket_b = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def test_old_clientinformation_sent(self): """ this method tests that most recent geo information is shared upon connection of new client test procedure: client A conn -> FTS client A send geo update -> FTS client B conn -> FTS client B <-updated client A geo Information FTS """ client_a_object = TCPClient(ip='127.0.0.1', port=15777) # establish client A connection time.sleep(1) cot = test_data.TestCoTClient(uid= client_a_object.clientObj.uid).generate_cot() client_a_object.send_specific_data(cot=cot) client_b_object = TCPClient(ip='127.0.0.1', port=15777) data = client_b_object.receive_specific_data(10000) self.assertIn(cot, data) def test_clientinformation_is_not_sent_issue(self): """ this method tests that client data is not resent after disconnections test procedure: client A conn-> FTS client A clientinfo-> FTS client A close-> FTS client B conn-> FTS client B clientinfo-> FTS client B <-otherclientinfo FTS client B otherclientinfo != clientAinfo client B close-> FTS """ client_a_object = self.connect_client_to_server(sock = self.client_socket_a, ip = '127.0.0.1', port = 15777, uid = '245397c8-69f7-4f68-979e-685ff7ee1451') # establish client A connection time.sleep(1) self.client_socket_a.close() time.sleep(5) # if this delay is reduced the test fails as FTS doesn't have time to process the changes client_b_object = self.connect_client_to_server(sock = self.client_socket_b, ip = '127.0.0.1', port = 15777) # establish client B connection time.sleep(1) # receive data and assert client_a_data not in resent data start = time.time() delay = 3 # 10 second delay while time.time() < start+delay: data = b'' self.client_socket_b.settimeout(0.1) while b'</event>' not in data: try: data += self.client_socket_b.recv(1) except socket.timeout: break if data == b'': break cot = etree.fromstring(data) self.assertNotEqual(client_a_object.uid, cot.get('uid')) self.client_socket_b.close() # disconnect final socket def test_simple_client_connection(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(('127.0.0.1', 15777)) client_object = test_data.TestCoTClient() sock.send(client_object.generate_cot()) sock.close() def connect_client_to_server(self, sock: socket.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM), ip: str = '127.0.0.1', port: int = 15777, uid: str = str(uuid.uuid4())) -> test_data.TestCoTClient: """this method is used to connect a client to the server and send a basic connection message """ sock.connect((ip, port)) client_object = test_data.TestCoTClient(uid=uid) sock.send(client_object.generate_cot()) return client_object if __name__ == '__main__': unittest.main()
[ 1, 1053, 443, 27958, 13, 3166, 1243, 1053, 2304, 13, 5215, 9909, 13, 5215, 1243, 29918, 1272, 13, 5215, 931, 13, 3166, 301, 3134, 1053, 634, 929, 13, 5215, 318, 5416, 13, 5215, 408, 948, 3934, 13, 3166, 3619, 29918, 13424, 29918, 8504, 1053, 19374, 4032, 13, 13, 1990, 19374, 3170, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 9995, 6230, 1158, 304, 10127, 1023, 577, 9737, 29889, 13, 13, 4706, 445, 1158, 338, 1065, 7536, 304, 738, 916, 6987, 2734, 322, 674, 1653, 278, 6996, 577, 9737, 13, 4706, 3734, 363, 4340, 6724, 29889, 13, 13, 4706, 9995, 13, 4706, 1583, 29889, 4645, 29918, 11514, 29918, 29874, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 29897, 13, 4706, 1583, 29889, 4645, 29918, 11514, 29918, 29890, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 29897, 13, 13, 1678, 822, 1243, 29918, 1025, 29918, 4645, 19678, 29918, 18616, 29898, 1311, 1125, 13, 4706, 9995, 445, 1158, 6987, 393, 1556, 7786, 1737, 29877, 2472, 338, 7258, 2501, 3957, 310, 716, 3132, 13, 13, 4706, 1243, 8792, 29901, 13, 4706, 3132, 319, 11009, 1599, 383, 9375, 13, 4706, 3132, 319, 3638, 1737, 29877, 2767, 1599, 383, 9375, 13, 4706, 3132, 350, 11009, 1599, 383, 9375, 13, 4706, 3132, 350, 3705, 21402, 3132, 319, 1737, 29877, 10343, 383, 9375, 13, 4706, 9995, 13, 4706, 3132, 29918, 29874, 29918, 3318, 353, 19374, 4032, 29898, 666, 2433, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 2011, 29922, 29896, 29945, 29955, 29955, 29955, 29897, 396, 10127, 3132, 319, 3957, 13, 4706, 931, 29889, 17059, 29898, 29896, 29897, 13, 4706, 20118, 353, 1243, 29918, 1272, 29889, 3057, 7967, 29911, 4032, 29898, 5416, 29922, 3132, 29918, 29874, 29918, 3318, 29889, 4645, 9930, 29889, 5416, 467, 17158, 29918, 26235, 580, 13, 4706, 3132, 29918, 29874, 29918, 3318, 29889, 6717, 29918, 14940, 29918, 1272, 29898, 26235, 29922, 26235, 29897, 13, 4706, 3132, 29918, 29890, 29918, 3318, 353, 19374, 4032, 29898, 666, 2433, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 2011, 29922, 29896, 29945, 29955, 29955, 29955, 29897, 13, 4706, 848, 353, 3132, 29918, 29890, 29918, 3318, 29889, 13556, 573, 29918, 14940, 29918, 1272, 29898, 29896, 29900, 29900, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 797, 29898, 26235, 29892, 848, 29897, 13, 13, 1678, 822, 1243, 29918, 4645, 19678, 29918, 275, 29918, 1333, 29918, 18616, 29918, 15118, 29898, 1311, 1125, 13, 4706, 9995, 445, 1158, 6987, 393, 3132, 848, 338, 451, 620, 296, 1156, 766, 11958, 1953, 13, 13, 4706, 1243, 8792, 29901, 13, 4706, 3132, 319, 11009, 976, 383, 9375, 13, 4706, 3132, 319, 3132, 3888, 976, 383, 9375, 13, 4706, 3132, 319, 3802, 976, 383, 9375, 13, 13, 4706, 3132, 350, 11009, 976, 383, 9375, 13, 4706, 3132, 350, 3132, 3888, 976, 383, 9375, 13, 4706, 3132, 350, 3705, 1228, 4645, 3888, 383, 9375, 13, 4706, 3132, 350, 916, 4645, 3888, 2804, 3132, 29909, 3888, 13, 4706, 3132, 350, 3802, 976, 383, 9375, 13, 4706, 9995, 13, 13, 4706, 3132, 29918, 29874, 29918, 3318, 353, 1583, 29889, 6915, 29918, 4645, 29918, 517, 29918, 2974, 29898, 21852, 353, 1583, 29889, 4645, 29918, 11514, 29918, 29874, 29892, 10377, 353, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 2011, 353, 29871, 29896, 29945, 29955, 29955, 29955, 29892, 318, 333, 353, 525, 29906, 29946, 29945, 29941, 29929, 29955, 29883, 29947, 29899, 29953, 29929, 29888, 29955, 29899, 29946, 29888, 29953, 29947, 29899, 29929, 29955, 29929, 29872, 29899, 29953, 29947, 29945, 600, 29955, 3905, 29896, 29946, 29945, 29896, 1495, 29871, 396, 10127, 3132, 319, 3957, 13, 4706, 931, 29889, 17059, 29898, 29896, 29897, 13, 4706, 1583, 29889, 4645, 29918, 11514, 29918, 29874, 29889, 5358, 580, 13, 13, 4706, 931, 29889, 17059, 29898, 29945, 29897, 29871, 396, 565, 445, 9055, 338, 12212, 278, 1243, 8465, 408, 383, 9375, 1838, 29915, 29873, 505, 931, 304, 1889, 278, 3620, 13, 4706, 3132, 29918, 29890, 29918, 3318, 353, 1583, 29889, 6915, 29918, 4645, 29918, 517, 29918, 2974, 29898, 21852, 353, 1583, 29889, 4645, 29918, 11514, 29918, 29890, 29892, 10377, 353, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 2011, 353, 29871, 29896, 29945, 29955, 29955, 29955, 29897, 29871, 396, 10127, 3132, 350, 3957, 13, 4706, 931, 29889, 17059, 29898, 29896, 29897, 13, 4706, 396, 7150, 848, 322, 4974, 3132, 29918, 29874, 29918, 1272, 451, 297, 620, 296, 848, 13, 4706, 1369, 353, 931, 29889, 2230, 580, 13, 4706, 9055, 353, 29871, 29941, 29871, 396, 29871, 29896, 29900, 1473, 9055, 13, 4706, 1550, 931, 29889, 2230, 580, 529, 1369, 29974, 18829, 29901, 13, 9651, 848, 353, 289, 4907, 13, 9651, 1583, 29889, 4645, 29918, 11514, 29918, 29890, 29889, 842, 15619, 29898, 29900, 29889, 29896, 29897, 13, 9651, 1550, 289, 29915, 829, 3696, 16299, 451, 297, 848, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 848, 4619, 1583, 29889, 4645, 29918, 11514, 29918, 29890, 29889, 3757, 29894, 29898, 29896, 29897, 13, 18884, 5174, 9909, 29889, 15619, 29901, 13, 462, 1678, 2867, 13, 9651, 565, 848, 1275, 289, 29915, 2396, 13, 18884, 2867, 13, 9651, 20118, 353, 634, 929, 29889, 3166, 1807, 29898, 1272, 29897, 13, 9651, 1583, 29889, 9294, 3664, 9843, 29898, 4645, 29918, 29874, 29918, 3318, 29889, 5416, 29892, 20118, 29889, 657, 877, 5416, 8785, 13, 13, 4706, 1583, 29889, 4645, 29918, 11514, 29918, 29890, 29889, 5358, 580, 29871, 396, 766, 6915, 2186, 9909, 13, 13, 1678, 822, 1243, 29918, 12857, 29918, 4645, 29918, 9965, 29898, 1311, 1125, 13, 4706, 577, 384, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 29897, 13, 4706, 577, 384, 29889, 6915, 29898, 877, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 29871, 29896, 29945, 29955, 29955, 29955, 876, 13, 4706, 3132, 29918, 3318, 353, 1243, 29918, 1272, 29889, 3057, 7967, 29911, 4032, 580, 13, 4706, 577, 384, 29889, 6717, 29898, 4645, 29918, 3318, 29889, 17158, 29918, 26235, 3101, 13, 4706, 577, 384, 29889, 5358, 580, 13, 1678, 822, 4511, 29918, 4645, 29918, 517, 29918, 2974, 29898, 1311, 29892, 577, 384, 29901, 9909, 29889, 11514, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 511, 10377, 29901, 851, 353, 525, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 742, 2011, 29901, 938, 353, 29871, 29896, 29945, 29955, 29955, 29955, 29892, 318, 333, 29901, 851, 353, 851, 29898, 25118, 29889, 25118, 29946, 22130, 1599, 1243, 29918, 1272, 29889, 3057, 7967, 29911, 4032, 29901, 13, 4706, 9995, 1366, 1158, 338, 1304, 304, 4511, 263, 3132, 304, 278, 1923, 322, 3638, 263, 6996, 3957, 2643, 13, 4706, 9995, 13, 4706, 577, 384, 29889, 6915, 3552, 666, 29892, 2011, 876, 13, 4706, 3132, 29918, 3318, 353, 1243, 29918, 1272, 29889, 3057, 7967, 29911, 4032, 29898, 5416, 29922, 5416, 29897, 13, 4706, 577, 384, 29889, 6717, 29898, 4645, 29918, 3318, 29889, 17158, 29918, 26235, 3101, 13, 4706, 736, 3132, 29918, 3318, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
program/tests/integration_tests_output/graph/graph.py
alienbri/audaces-perps
0
20814
<filename>program/tests/integration_tests_output/graph/graph.py import yaml import matplotlib.pyplot as plt import math from jsonmerge import merge from datetime import datetime import plotly as ply import pandas as pd import plotly.express as px TRANSFORM = False PLOT_MEMORY = True NB_INSTRUCTIONS = 1000 f_value_props = { # [Color, MinOffset, MaxOffset] "total_collateral": ["", 0, 1], "total_fee_balance": ["", 0, 1], "rebalancing_funds": ["#99cc99", 0, 0.5], # # "rebalanced_v_coin": ["", 0, 1], "v_coin_amount": ["", 0, 1], "v_pc_amount": ["", 0, 1], "open_shorts_v_coin": ["", 0, 1], "open_longs_v_coin": ["", 0, 1], # "insurance_fund": ["#808080", 0.2, 1.2], "market_price": ["#008080", 0.5, 1.5], "oracle_price": ["#99cc99", 0.5, 1.5], "equilibrium_price": ["#ff8000", 0.5, 1], # # "signer_nonce", # "market_symbol", # "oracle_address", # "admin_address", # "vault_address", # "quote_decimals", # "coin_decimals", # "total_user_balances", # "last_funding_timestamp", # "last_recording_timestamp", # "funding_samples_offset", # "funding_samples", # "funding_history_offset", # "funding_history", # "funding_balancing_factors", # "number_of_instances", } m_value_props = { "gc_list_lengths", "page_full_ratios", "longs_depths", "shorts_depths" } market_state_line_header = "INFO - MarketDataPoint" date_time = datetime.now().strftime("%d-%m-%Y_%H-%M-%S") infile = open("../log/output.log") outfile = open( "../log/formatted_output_{}.log".format(date_time), "a") market_data_json = [] for line in infile: if (market_state_line_header in line) or ("DEBUG - Program" in line) or ("DEBUG - tx error:" in line) or ("INFO - Tree:" in line) or ("INFO - Initial Conditions:" in line) or ("INFO - Seed for this run:" in line): outfile.write(line) if market_state_line_header in line: market_state_datapoint_str = line[len( market_state_line_header):].replace("Instance", "").replace("PageInfo", "") # Stripping header line_json = yaml.load(market_state_datapoint_str) market_data_json.append(line_json) # Extract market_data = {} value_names = list(f_value_props.keys()) for key in market_data_json[0]: if key in value_names: market_data[key] = [data_point[key] for data_point in market_data_json] # Normalize if TRANSFORM: max_per_value = [max(market_data[key]) for key in value_names] min_per_value = [min(market_data[key]) for key in value_names] max_per_value[value_names.index( "market_price")] = max_per_value[value_names.index("oracle_price")] min_per_value[value_names.index( "market_price")] = min_per_value[value_names.index("oracle_price")] scaled_market_data = [[((1 - f_value_props[value_names[i]][1]) * (data_value_point - min_per_value[i]) / abs((max_per_value[i] / f_value_props[value_names[i]][2]) - min_per_value[i])) + f_value_props[value_names[i]][1] for data_value_point in market_data[value_names[i]]] for i in range(len(value_names))] else: max_per_value = [max(market_data[key]) for key in value_names] total_max = max(max_per_value) scaling_factors = [int(round(math.log10(total_max / value_max))) if value_max != 0 else 1 for value_max in max_per_value] scaled_market_data = [[(10 ** scaling_factors[i]) * data_value_point for data_value_point in market_data[value_names[i]]] for i in range(len(value_names))] # Plotting if PLOT_MEMORY: nb_lines = min(len(market_data_json), NB_INSTRUCTIONS) df = pd.DataFrame(market_data_json) print(df.columns) print(df.shape) df["shorts_depths"] = [k[0] for k in df["shorts_depths"]] df["longs_depths"] = [k[0] for k in df["longs_depths"]] df["gc_list_lengths"] = [k[0] for k in df["gc_list_lengths"]] for k in range(len(df["page_full_ratios"][0][0])): df[f"page_{k}_full_ratio"] = [l[0][k] for l in df["page_full_ratios"]] df.drop("page_full_ratios", axis=1) df = df.stack().reset_index() print(df) fig = px.line(df, x="level_0", y=0, color="level_1") fig.show() # print([len(m["page_full_ratios"]) for m in market_data_json]) page_full_ratios = [ market_data_json[i]["page_full_ratios"][0] for i in range(nb_lines)] longs_depths = [ market_data_json[i]["longs_depths"] for i in range(nb_lines) ] shorts_depths = [ market_data_json[i]["shorts_depths"] for i in range(nb_lines) ] for k in range(len(market_data_json[0]["page_full_ratios"][0])): plt.plot([page_full_ratios[i][k] for i in range(nb_lines)], label=( "page_full_ratios for page " + str(k))) plt.plot() gc_list_lenghts = [ market_data_json[i]["gc_list_lengths"][0] for i in range(nb_lines)] # TODO Mult instances # plt.plot([gc_list_lenghts[i] for i in range(nb_lines)], label=( # "gc_list_length")) plt.plot(longs_depths, label=("longs_depths")) plt.plot(shorts_depths, label=("shorts_depths")) elif TRANSFORM: for (i, key) in enumerate(value_names): if f_value_props[key][0] != "": plt.plot(scaled_market_data[i][:NB_INSTRUCTIONS], label=( key + " x1e"), color=f_value_props[key][0]) else: plt.plot(scaled_market_data[i][:NB_INSTRUCTIONS], label=( key + " x1e")) else: for (i, key) in enumerate(value_names): if f_value_props[key][0] != "": plt.plot(scaled_market_data[i], label=( key + " x1e" + str(scaling_factors[i])), color=f_value_props[key][0]) else: plt.plot(scaled_market_data[i], label=( key + " x1e")) plt.legend(prop={'size': 15}) plt.show() # block=False) # plt.savefig("../log/graph_{}.png".format(date_time), dpi=440) # gc_list_lengths: [0], page_full_ratios: [[], [0.0, 0.0, 0.0, 0.0, 0.0]]
[ 1, 529, 9507, 29958, 8860, 29914, 21150, 29914, 27925, 29918, 21150, 29918, 4905, 29914, 4262, 29914, 4262, 29889, 2272, 13, 5215, 343, 8807, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 5844, 13, 3166, 4390, 14634, 1053, 10366, 13, 3166, 12865, 1053, 12865, 13, 5215, 6492, 368, 408, 282, 368, 13, 5215, 11701, 408, 10518, 13, 5215, 6492, 368, 29889, 17073, 408, 282, 29916, 13, 13, 26813, 29903, 19094, 353, 7700, 13, 7390, 2891, 29918, 2303, 29924, 18929, 353, 5852, 13, 23189, 29918, 1177, 10810, 29965, 9838, 29903, 353, 29871, 29896, 29900, 29900, 29900, 13, 13, 29888, 29918, 1767, 29918, 11030, 353, 426, 13, 1678, 396, 518, 3306, 29892, 3080, 10302, 29892, 5918, 10302, 29962, 13, 1678, 376, 7827, 29918, 22017, 1008, 284, 1115, 6796, 613, 29871, 29900, 29892, 29871, 29896, 1402, 13, 1678, 376, 7827, 29918, 1725, 29872, 29918, 5521, 749, 1115, 6796, 613, 29871, 29900, 29892, 29871, 29896, 1402, 13, 1678, 376, 276, 5521, 19985, 29918, 27159, 29879, 1115, 6796, 29937, 29929, 29929, 617, 29929, 29929, 613, 29871, 29900, 29892, 29871, 29900, 29889, 29945, 1402, 29871, 396, 13, 1678, 396, 376, 276, 5521, 8362, 29918, 29894, 29918, 1111, 262, 1115, 6796, 613, 29871, 29900, 29892, 29871, 29896, 1402, 13, 1678, 376, 29894, 29918, 1111, 262, 29918, 14506, 1115, 6796, 613, 29871, 29900, 29892, 29871, 29896, 1402, 13, 1678, 376, 29894, 29918, 6739, 29918, 14506, 1115, 6796, 613, 29871, 29900, 29892, 29871, 29896, 1402, 13, 1678, 376, 3150, 29918, 12759, 29879, 29918, 29894, 29918, 1111, 262, 1115, 6796, 613, 29871, 29900, 29892, 29871, 29896, 1402, 13, 1678, 376, 3150, 29918, 5426, 29879, 29918, 29894, 29918, 1111, 262, 1115, 6796, 613, 29871, 29900, 29892, 29871, 29896, 1402, 1678, 396, 13, 1678, 376, 1144, 18541, 29918, 27159, 1115, 6796, 29937, 29947, 29900, 29947, 29900, 29947, 29900, 613, 29871, 29900, 29889, 29906, 29892, 29871, 29896, 29889, 29906, 1402, 13, 1678, 376, 28549, 29918, 9175, 1115, 6796, 29937, 29900, 29900, 29947, 29900, 29947, 29900, 613, 29871, 29900, 29889, 29945, 29892, 29871, 29896, 29889, 29945, 1402, 13, 1678, 376, 11347, 29918, 9175, 1115, 6796, 29937, 29929, 29929, 617, 29929, 29929, 613, 29871, 29900, 29889, 29945, 29892, 29871, 29896, 29889, 29945, 1402, 13, 1678, 376, 1686, 15943, 16241, 29918, 9175, 1115, 6796, 29937, 600, 29947, 29900, 29900, 29900, 613, 29871, 29900, 29889, 29945, 29892, 29871, 29896, 1402, 29871, 396, 13, 13, 1678, 396, 376, 4530, 261, 29918, 5464, 346, 613, 13, 1678, 396, 376, 28549, 29918, 18098, 613, 13, 1678, 396, 376, 11347, 29918, 7328, 613, 13, 1678, 396, 376, 6406, 29918, 7328, 613, 13, 1678, 396, 376, 29894, 1292, 29918, 7328, 613, 13, 1678, 396, 376, 1396, 29918, 7099, 326, 1338, 613, 13, 1678, 396, 376, 1111, 262, 29918, 7099, 326, 1338, 613, 13, 1678, 396, 376, 7827, 29918, 1792, 29918, 5521, 2925, 613, 13, 1678, 396, 376, 4230, 29918, 27159, 292, 29918, 16394, 613, 13, 1678, 396, 376, 4230, 29918, 3757, 3278, 29918, 16394, 613, 13, 1678, 396, 376, 27159, 292, 29918, 27736, 29918, 10289, 613, 13, 1678, 396, 376, 27159, 292, 29918, 27736, 613, 13, 1678, 396, 376, 27159, 292, 29918, 18434, 29918, 10289, 613, 13, 1678, 396, 376, 27159, 292, 29918, 18434, 613, 13, 1678, 396, 376, 27159, 292, 29918, 5521, 19985, 29918, 17028, 943, 613, 13, 1678, 396, 376, 4537, 29918, 974, 29918, 2611, 2925, 613, 13, 29913, 13, 13, 29885, 29918, 1767, 29918, 11030, 353, 426, 13, 1678, 376, 27354, 29918, 1761, 29918, 2848, 29879, 613, 13, 1678, 376, 3488, 29918, 8159, 29918, 29878, 2219, 359, 613, 13, 1678, 376, 5426, 29879, 29918, 19488, 29879, 613, 13, 1678, 376, 12759, 29879, 29918, 19488, 29879, 29908, 13, 29913, 13, 13, 13, 28549, 29918, 3859, 29918, 1220, 29918, 6672, 353, 376, 11690, 448, 28794, 1469, 5228, 29908, 13, 13, 1256, 29918, 2230, 353, 12865, 29889, 3707, 2141, 710, 615, 603, 11702, 29881, 19222, 29885, 19222, 29979, 29918, 29995, 29950, 19222, 29924, 19222, 29903, 1159, 13, 262, 1445, 353, 1722, 703, 6995, 1188, 29914, 4905, 29889, 1188, 1159, 13, 449, 1445, 353, 1722, 29898, 13, 1678, 376, 6995, 1188, 29914, 689, 19667, 29918, 4905, 648, 1836, 1188, 1642, 4830, 29898, 1256, 29918, 2230, 511, 376, 29874, 1159, 13, 28549, 29918, 1272, 29918, 3126, 353, 5159, 13, 1454, 1196, 297, 297, 1445, 29901, 13, 1678, 565, 313, 28549, 29918, 3859, 29918, 1220, 29918, 6672, 297, 1196, 29897, 470, 4852, 18525, 448, 7835, 29908, 297, 1196, 29897, 470, 4852, 18525, 448, 25568, 1059, 6160, 297, 1196, 29897, 470, 4852, 11690, 448, 15472, 6160, 297, 1196, 29897, 470, 4852, 11690, 448, 17250, 11790, 2187, 6160, 297, 1196, 29897, 470, 4852, 11690, 448, 922, 287, 363, 445, 1065, 6160, 297, 1196, 1125, 13, 4706, 714, 1445, 29889, 3539, 29898, 1220, 29897, 13, 1678, 565, 9999, 29918, 3859, 29918, 1220, 29918, 6672, 297, 1196, 29901, 13, 4706, 9999, 29918, 3859, 29918, 4130, 481, 2461, 29918, 710, 353, 1196, 29961, 2435, 29898, 13, 9651, 9999, 29918, 3859, 29918, 1220, 29918, 6672, 1125, 1822, 6506, 703, 4998, 613, 376, 2564, 6506, 703, 5074, 3401, 613, 20569, 29871, 396, 624, 374, 3262, 4839, 13, 4706, 1196, 29918, 3126, 353, 343, 8807, 29889, 1359, 29898, 28549, 29918, 3859, 29918, 4130, 481, 2461, 29918, 710, 29897, 13, 4706, 9999, 29918, 1272, 29918, 3126, 29889, 4397, 29898, 1220, 29918, 3126, 29897, 13, 13, 29937, 7338, 1461, 13, 28549, 29918, 1272, 353, 6571, 13, 1767, 29918, 7039, 353, 1051, 29898, 29888, 29918, 1767, 29918, 11030, 29889, 8149, 3101, 13, 1454, 1820, 297, 9999, 29918, 1272, 29918, 3126, 29961, 29900, 5387, 13, 1678, 565, 1820, 297, 995, 29918, 7039, 29901, 13, 4706, 9999, 29918, 1272, 29961, 1989, 29962, 353, 518, 1272, 29918, 3149, 29961, 1989, 29962, 363, 848, 29918, 3149, 297, 9999, 29918, 1272, 29918, 3126, 29962, 13, 13, 29937, 21981, 675, 13, 361, 10014, 2190, 29903, 19094, 29901, 13, 1678, 4236, 29918, 546, 29918, 1767, 353, 518, 3317, 29898, 28549, 29918, 1272, 29961, 1989, 2314, 363, 1820, 297, 995, 29918, 7039, 29962, 13, 1678, 1375, 29918, 546, 29918, 1767, 353, 518, 1195, 29898, 28549, 29918, 1272, 29961, 1989, 2314, 363, 1820, 297, 995, 29918, 7039, 29962, 13, 1678, 4236, 29918, 546, 29918, 1767, 29961, 1767, 29918, 7039, 29889, 2248, 29898, 13, 4706, 376, 28549, 29918, 9175, 13531, 353, 4236, 29918, 546, 29918, 1767, 29961, 1767, 29918, 7039, 29889, 2248, 703, 11347, 29918, 9175, 13531, 13, 1678, 1375, 29918, 546, 29918, 1767, 29961, 1767, 29918, 7039, 29889, 2248, 29898, 13, 4706, 376, 28549, 29918, 9175, 13531, 353, 1375, 29918, 546, 29918, 1767, 29961, 1767, 29918, 7039, 29889, 2248, 703, 11347, 29918, 9175, 13531, 13, 1678, 6287, 29881, 29918, 28549, 29918, 1272, 353, 5519, 3552, 29896, 448, 285, 29918, 1767, 29918, 11030, 29961, 1767, 29918, 7039, 29961, 29875, 29962, 3816, 29896, 2314, 334, 313, 1272, 29918, 1767, 29918, 3149, 448, 1375, 29918, 546, 29918, 1767, 29961, 29875, 2314, 847, 6425, 3552, 3317, 29918, 546, 29918, 1767, 29961, 29875, 29962, 847, 285, 29918, 1767, 29918, 11030, 29961, 1767, 29918, 7039, 29961, 29875, 29962, 3816, 29906, 2314, 448, 1375, 29918, 546, 29918, 1767, 29961, 29875, 12622, 718, 285, 29918, 1767, 29918, 11030, 29961, 1767, 29918, 7039, 29961, 29875, 29962, 3816, 29896, 29962, 363, 848, 29918, 1767, 29918, 3149, 297, 9999, 29918, 1272, 29961, 1767, 29918, 7039, 29961, 29875, 5262, 29962, 13, 462, 3986, 363, 474, 297, 3464, 29898, 2435, 29898, 1767, 29918, 7039, 28166, 13, 13, 2870, 29901, 13, 1678, 4236, 29918, 546, 29918, 1767, 353, 518, 3317, 29898, 28549, 29918, 1272, 29961, 1989, 2314, 363, 1820, 297, 995, 29918, 7039, 29962, 13, 1678, 3001, 29918, 3317, 353, 4236, 29898, 3317, 29918, 546, 29918, 1767, 29897, 13, 1678, 21640, 29918, 17028, 943, 353, 518, 524, 29898, 14486, 29898, 755, 29889, 1188, 29896, 29900, 29898, 7827, 29918, 3317, 847, 995, 29918, 3317, 4961, 13, 462, 539, 565, 995, 29918, 3317, 2804, 29871, 29900, 1683, 29871, 29896, 363, 995, 29918, 3317, 297, 4236, 29918, 546, 29918, 1767, 29962, 13, 1678, 6287, 29881, 29918, 28549, 29918, 1272, 353, 5519, 29898, 29896, 29900, 3579, 21640, 29918, 17028, 943, 29961, 29875, 2314, 334, 848, 29918, 1767, 29918, 3149, 363, 848, 29918, 1767, 29918, 3149, 297, 9999, 29918, 1272, 29961, 1767, 29918, 7039, 29961, 29875, 5262, 29962, 13, 462, 3986, 363, 474, 297, 3464, 29898, 2435, 29898, 1767, 29918, 7039, 28166, 13, 13, 13, 29937, 18399, 1259, 13, 361, 16507, 2891, 29918, 2303, 29924, 18929, 29901, 13, 1678, 302, 29890, 29918, 9012, 353, 1375, 29898, 2435, 29898, 28549, 29918, 1272, 29918, 3126, 511, 405, 29933, 29918, 1177, 10810, 29965, 9838, 29903, 29897, 13, 1678, 4489, 353, 10518, 29889, 17271, 29898, 28549, 29918, 1272, 29918, 3126, 29897, 13, 1678, 1596, 29898, 2176, 29889, 13099, 29897, 13, 1678, 1596, 29898, 2176, 29889, 12181, 29897, 13, 1678, 4489, 3366, 12759, 29879, 29918, 19488, 29879, 3108, 353, 518, 29895, 29961, 29900, 29962, 363, 413, 297, 4489, 3366, 12759, 29879, 29918, 19488, 29879, 3108, 29962, 13, 1678, 4489, 3366, 5426, 29879, 29918, 19488, 29879, 3108, 353, 518, 29895, 29961, 29900, 29962, 363, 413, 297, 4489, 3366, 5426, 29879, 29918, 19488, 29879, 3108, 29962, 13, 1678, 4489, 3366, 27354, 29918, 1761, 29918, 2848, 29879, 3108, 353, 518, 29895, 29961, 29900, 29962, 363, 413, 297, 4489, 3366, 27354, 29918, 1761, 29918, 2848, 29879, 3108, 29962, 13, 1678, 363, 413, 297, 3464, 29898, 2435, 29898, 2176, 3366, 3488, 29918, 8159, 29918, 29878, 2219, 359, 3108, 29961, 29900, 3816, 29900, 12622, 29901, 13, 4706, 4489, 29961, 29888, 29908, 3488, 648, 29895, 2403, 8159, 29918, 3605, 601, 3108, 353, 518, 29880, 29961, 29900, 3816, 29895, 29962, 363, 301, 297, 4489, 3366, 3488, 29918, 8159, 29918, 29878, 2219, 359, 3108, 29962, 13, 1678, 4489, 29889, 8865, 703, 3488, 29918, 8159, 29918, 29878, 2219, 359, 613, 9685, 29922, 29896, 29897, 13, 1678, 4489, 353, 4489, 29889, 1429, 2141, 12071, 29918, 2248, 580, 13, 1678, 1596, 29898, 2176, 29897, 13, 13, 1678, 2537, 353, 282, 29916, 29889, 1220, 29898, 2176, 29892, 921, 543, 5563, 29918, 29900, 613, 343, 29922, 29900, 29892, 2927, 543, 5563, 29918, 29896, 1159, 13, 1678, 2537, 29889, 4294, 580, 13, 13, 1678, 396, 1596, 4197, 2435, 29898, 29885, 3366, 3488, 29918, 8159, 29918, 29878, 2219, 359, 20068, 363, 286, 297, 9999, 29918, 1272, 29918, 3126, 2314, 13, 1678, 1813, 29918, 8159, 29918, 29878, 2219, 359, 353, 518, 13, 4706, 9999, 29918, 1272, 29918, 3126, 29961, 29875, 29962, 3366, 3488, 29918, 8159, 29918, 29878, 2219, 359, 3108, 29961, 29900, 29962, 363, 474, 297, 3464, 29898, 9877, 29918, 9012, 4638, 13, 1678, 1472, 29879, 29918, 19488, 29879, 353, 518, 13, 4706, 9999, 29918, 1272, 29918, 3126, 29961, 29875, 29962, 3366, 5426, 29879, 29918, 19488, 29879, 3108, 363, 474, 297, 3464, 29898, 9877, 29918, 9012, 29897, 13, 1678, 4514, 13, 1678, 3273, 29879, 29918, 19488, 29879, 353, 518, 13, 4706, 9999, 29918, 1272, 29918, 3126, 29961, 29875, 29962, 3366, 12759, 29879, 29918, 19488, 29879, 3108, 363, 474, 297, 3464, 29898, 9877, 29918, 9012, 29897, 13, 1678, 4514, 13, 13, 1678, 363, 413, 297, 3464, 29898, 2435, 29898, 28549, 29918, 1272, 29918, 3126, 29961, 29900, 29962, 3366, 3488, 29918, 8159, 29918, 29878, 2219, 359, 3108, 29961, 29900, 12622, 29901, 13, 4706, 14770, 29889, 5317, 4197, 3488, 29918, 8159, 29918, 29878, 2219, 359, 29961, 29875, 3816, 29895, 29962, 363, 474, 297, 3464, 29898, 9877, 29918, 9012, 29897, 1402, 3858, 7607, 13, 9651, 376, 3488, 29918, 8159, 29918, 29878, 2219, 359, 363, 1813, 376, 718, 851, 29898, 29895, 4961, 13, 4706, 14770, 29889, 5317, 580, 13, 1678, 330, 29883, 29918, 1761, 29918, 29880, 996, 400, 29879, 353, 518, 13, 4706, 9999, 29918, 1272, 29918, 3126, 29961, 29875, 29962, 3366, 27354, 29918, 1761, 29918, 2848, 29879, 3108, 29961, 29900, 29962, 363, 474, 297, 3464, 29898, 9877, 29918, 9012, 4638, 29871, 396, 14402, 9683, 8871, 13, 1678, 396, 14770, 29889, 5317, 4197, 27354, 29918, 1761, 29918, 29880, 996, 400, 29879, 29961, 29875, 29962, 363, 474, 297, 3464, 29898, 9877, 29918, 9012, 29897, 1402, 3858, 7607, 13, 1678, 396, 268, 376, 27354, 29918, 1761, 29918, 2848, 5783, 13, 1678, 14770, 29889, 5317, 29898, 5426, 29879, 29918, 19488, 29879, 29892, 3858, 29922, 703, 5426, 29879, 29918, 19488, 29879, 5783, 13, 1678, 14770, 29889, 5317, 29898, 12759, 29879, 29918, 19488, 29879, 29892, 3858, 29922, 703, 12759, 29879, 29918, 19488, 29879, 5783, 13, 23681, 10014, 2190, 29903, 19094, 29901, 13, 1678, 363, 313, 29875, 29892, 1820, 29897, 297, 26985, 29898, 1767, 29918, 7039, 1125, 13, 4706, 565, 285, 29918, 1767, 29918, 11030, 29961, 1989, 3816, 29900, 29962, 2804, 376, 1115, 13, 9651, 14770, 29889, 5317, 29898, 7052, 29881, 29918, 28549, 29918, 1272, 29961, 29875, 3816, 29901, 23189, 29918, 1177, 10810, 29965, 9838, 29903, 1402, 3858, 7607, 13, 18884, 1820, 718, 376, 921, 29896, 29872, 4968, 2927, 29922, 29888, 29918, 1767, 29918, 11030, 29961, 1989, 3816, 29900, 2314, 13, 4706, 1683, 29901, 13, 9651, 14770, 29889, 5317, 29898, 7052, 29881, 29918, 28549, 29918, 1272, 29961, 29875, 3816, 29901, 23189, 29918, 1177, 10810, 29965, 9838, 29903, 1402, 3858, 7607, 13, 18884, 1820, 718, 376, 921, 29896, 29872, 5783, 13, 2870, 29901, 13, 1678, 363, 313, 29875, 29892, 1820, 29897, 297, 26985, 29898, 1767, 29918, 7039, 1125, 13, 4706, 565, 285, 29918, 1767, 29918, 11030, 29961, 1989, 3816, 29900, 29962, 2804, 376, 1115, 13, 9651, 14770, 29889, 5317, 29898, 7052, 29881, 29918, 28549, 29918, 1272, 29961, 29875, 1402, 3858, 7607, 13, 18884, 1820, 718, 376, 921, 29896, 29872, 29908, 718, 851, 29898, 19529, 292, 29918, 17028, 943, 29961, 29875, 2314, 511, 2927, 29922, 29888, 29918, 1767, 29918, 11030, 29961, 1989, 3816, 29900, 2314, 13, 4706, 1683, 29901, 13, 9651, 14770, 29889, 5317, 29898, 7052, 29881, 29918, 28549, 29918, 1272, 29961, 29875, 1402, 3858, 7607, 13, 18884, 1820, 718, 376, 921, 29896, 29872, 5783, 13, 13, 13, 572, 29873, 29889, 26172, 29898, 7728, 3790, 29915, 2311, 2396, 29871, 29896, 29945, 1800, 13, 572, 29873, 29889, 4294, 580, 29871, 396, 2908, 29922, 8824, 29897, 13, 29937, 14770, 29889, 7620, 1003, 703, 6995, 1188, 29914, 4262, 648, 1836, 2732, 1642, 4830, 29898, 1256, 29918, 2230, 511, 270, 1631, 29922, 29946, 29946, 29900, 29897, 13, 13, 29937, 29871, 330, 29883, 29918, 1761, 29918, 2848, 29879, 29901, 518, 29900, 1402, 1813, 29918, 8159, 29918, 29878, 2219, 359, 29901, 5519, 1402, 518, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 5262, 13, 2 ]
larc/templates/common.py
lowlandresearch/larc
0
58341
<gh_stars>0 import re from pathlib import Path import calendar import jinja2 import toolz.curried as _ from .. import common as __ from .. import logging from .. import images from .. import markdown log = logging.new_log(__name__) @_.curry def find_files(start, filename): start_path = Path(start).resolve() log.info(f'Finding image {filename}') if Path(start_path, filename).exists(): path = Path(start_path, filename) log.info(f' found: {path}') return [path] file_re = re.compile( filename.lower().replace('.', '\\.').replace('*', '.*') ) log.info(f' searching with re: {file_re.pattern}') paths = _.pipe( __.walk(start_path), filter(lambda p: file_re.search(p.name.lower())), _.partial(sorted, key=lambda p: p.name), tuple, ) if not paths: log.error( f'Could not find any filenames meeting the search string' f' "{filename}" looking in directory: {start_path}' ) return paths def pluralize(number, singular='', plural='s'): if number == 1: return singular return plural def md_to_html(text): return markdown.markdown(text) def long_date(text): import datetime import dateutil.parser try: if isinstance(text, datetime.datetime): dt = text else: dt = dateutil.parser.parse(text) return dt.strftime('%B %d, %Y') except ValueError as error: log.error( 'Error in long_date:\n' f'error: {error}\n' f'for text: {repr(text)}\n' 'exception:', exc_info=True ) def year(text): return _.pipe( text, __.maybe_dt, __.deref('year'), ) def month(text): return _.pipe( text, __.maybe_dt, __.deref('month'), lambda m: calendar.month_name[m], ) def add_filters(env: jinja2.Environment): env.filters['pluralize'] = pluralize env.filters['md_to_html'] = md_to_html env.filters['long_date'] = long_date env.filters['year'] = year env.filters['month'] = month env.filters['b64encode'] = __.b64encode_str return env @_.curry def make_figure(im_type, filename, caption, images, *, style: dict = None): style = _.pipe( _.pipe( style.items(), __.vmap(lambda k, v: f"{k}: {v}"), ';'.join, ), 'style="{}"'.format, ) if style else '' figure = {'type': im_type, 'filename': Path(filename).name, 'search': filename, 'caption': caption, 'images': images, 'style': style} return get_env().get_template('figure.html.j2').render(figure=figure) @_.curry def figure_function(im_type, bytes_function, caption, filename, start='.', *, style: dict = None): return _.pipe( filename, find_files(start), map(bytes_function), map(__.b64encode_str), tuple, make_figure(im_type, filename, caption, style=style), ) png = figure_function('png', images.common.png_bytes) jpeg = figure_function('jpeg', images.common.jpeg_bytes) def table(data): return get_env().get_template('table.html.j2').render(data=data) def add_functions(env: jinja2.Environment): env.globals['png'] = png env.globals['jpeg'] = jpeg env.globals['table'] = table return env get_env = _.compose_left( jinja2.Environment, add_filters, add_functions, )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 337, 13, 3166, 2224, 1982, 1053, 10802, 13, 5215, 17684, 13, 13, 5215, 432, 262, 1764, 29906, 13, 5215, 5780, 29920, 29889, 2764, 1255, 408, 903, 13, 13, 3166, 6317, 1053, 3619, 408, 4770, 13, 3166, 6317, 1053, 12183, 13, 3166, 6317, 1053, 4558, 13, 3166, 6317, 1053, 2791, 3204, 13, 13, 1188, 353, 12183, 29889, 1482, 29918, 1188, 22168, 978, 1649, 29897, 13, 13, 29992, 5396, 2764, 719, 13, 1753, 1284, 29918, 5325, 29898, 2962, 29892, 10422, 1125, 13, 1678, 1369, 29918, 2084, 353, 10802, 29898, 2962, 467, 17863, 580, 13, 13, 1678, 1480, 29889, 3888, 29898, 29888, 29915, 29943, 4015, 1967, 426, 9507, 29913, 1495, 13, 1678, 565, 10802, 29898, 2962, 29918, 2084, 29892, 10422, 467, 9933, 7295, 13, 4706, 2224, 353, 10802, 29898, 2962, 29918, 2084, 29892, 10422, 29897, 13, 4706, 1480, 29889, 3888, 29898, 29888, 29915, 259, 1476, 29901, 426, 2084, 29913, 1495, 13, 4706, 736, 518, 2084, 29962, 13, 13, 1678, 934, 29918, 276, 353, 337, 29889, 12198, 29898, 13, 4706, 10422, 29889, 13609, 2141, 6506, 12839, 742, 525, 1966, 29889, 2824, 6506, 877, 29930, 742, 525, 5575, 1495, 13, 1678, 1723, 13, 1678, 1480, 29889, 3888, 29898, 29888, 29915, 259, 11975, 411, 337, 29901, 426, 1445, 29918, 276, 29889, 11037, 29913, 1495, 13, 13, 1678, 10898, 353, 903, 29889, 17760, 29898, 13, 4706, 4770, 29889, 20919, 29898, 2962, 29918, 2084, 511, 13, 4706, 4175, 29898, 2892, 282, 29901, 934, 29918, 276, 29889, 4478, 29898, 29886, 29889, 978, 29889, 13609, 3101, 511, 13, 4706, 903, 29889, 3846, 29898, 24582, 29892, 1820, 29922, 2892, 282, 29901, 282, 29889, 978, 511, 13, 4706, 18761, 29892, 13, 1678, 1723, 13, 1678, 565, 451, 10898, 29901, 13, 4706, 1480, 29889, 2704, 29898, 13, 9651, 285, 29915, 23323, 451, 1284, 738, 977, 264, 1280, 11781, 278, 2740, 1347, 29915, 13, 9651, 285, 29915, 29850, 9507, 5038, 3063, 297, 3884, 29901, 426, 2962, 29918, 2084, 10162, 13, 4706, 1723, 13, 1678, 736, 10898, 13, 13, 1753, 715, 3631, 675, 29898, 4537, 29892, 13512, 2433, 742, 715, 3631, 2433, 29879, 29374, 13, 1678, 565, 1353, 1275, 29871, 29896, 29901, 13, 4706, 736, 13512, 13, 1678, 736, 715, 3631, 13, 13, 1753, 22821, 29918, 517, 29918, 1420, 29898, 726, 1125, 13, 1678, 736, 2791, 3204, 29889, 3502, 3204, 29898, 726, 29897, 13, 13, 1753, 1472, 29918, 1256, 29898, 726, 1125, 13, 1678, 1053, 12865, 13, 1678, 1053, 2635, 4422, 29889, 16680, 13, 1678, 1018, 29901, 13, 4706, 565, 338, 8758, 29898, 726, 29892, 12865, 29889, 12673, 1125, 13, 9651, 11636, 353, 1426, 13, 4706, 1683, 29901, 13, 9651, 11636, 353, 2635, 4422, 29889, 16680, 29889, 5510, 29898, 726, 29897, 13, 4706, 736, 11636, 29889, 710, 615, 603, 877, 29995, 29933, 1273, 29881, 29892, 1273, 29979, 1495, 13, 1678, 5174, 7865, 2392, 408, 1059, 29901, 13, 4706, 1480, 29889, 2704, 29898, 13, 9651, 525, 2392, 297, 1472, 29918, 1256, 3583, 29876, 29915, 13, 9651, 285, 29915, 2704, 29901, 426, 2704, 1012, 29876, 29915, 13, 9651, 285, 29915, 1454, 1426, 29901, 426, 276, 558, 29898, 726, 11383, 29876, 29915, 13, 9651, 525, 11739, 29901, 742, 5566, 29918, 3888, 29922, 5574, 13, 4706, 1723, 13, 13, 1753, 1629, 29898, 726, 1125, 13, 1678, 736, 903, 29889, 17760, 29898, 13, 4706, 1426, 29892, 13, 4706, 4770, 29889, 26026, 29918, 6008, 29892, 13, 4706, 4770, 29889, 29881, 406, 29888, 877, 6360, 5477, 13, 1678, 1723, 13, 13, 1753, 4098, 29898, 726, 1125, 13, 1678, 736, 903, 29889, 17760, 29898, 13, 4706, 1426, 29892, 13, 4706, 4770, 29889, 26026, 29918, 6008, 29892, 13, 4706, 4770, 29889, 29881, 406, 29888, 877, 10874, 5477, 13, 4706, 14013, 286, 29901, 17684, 29889, 10874, 29918, 978, 29961, 29885, 1402, 13, 1678, 1723, 13, 13, 1753, 788, 29918, 26705, 29898, 6272, 29901, 432, 262, 1764, 29906, 29889, 18649, 1125, 13, 1678, 8829, 29889, 26705, 1839, 572, 3631, 675, 2033, 353, 715, 3631, 675, 13, 1678, 8829, 29889, 26705, 1839, 3487, 29918, 517, 29918, 1420, 2033, 353, 22821, 29918, 517, 29918, 1420, 13, 1678, 8829, 29889, 26705, 1839, 5426, 29918, 1256, 2033, 353, 1472, 29918, 1256, 13, 1678, 8829, 29889, 26705, 1839, 6360, 2033, 353, 1629, 13, 1678, 8829, 29889, 26705, 1839, 10874, 2033, 353, 4098, 13, 1678, 8829, 29889, 26705, 1839, 29890, 29953, 29946, 12508, 2033, 353, 4770, 29889, 29890, 29953, 29946, 12508, 29918, 710, 13, 1678, 736, 8829, 13, 13, 29992, 5396, 2764, 719, 13, 1753, 1207, 29918, 4532, 29898, 326, 29918, 1853, 29892, 10422, 29892, 5777, 683, 29892, 4558, 29892, 334, 29892, 3114, 29901, 9657, 353, 6213, 1125, 13, 1678, 3114, 353, 903, 29889, 17760, 29898, 13, 4706, 903, 29889, 17760, 29898, 13, 9651, 3114, 29889, 7076, 3285, 13, 9651, 4770, 29889, 29894, 1958, 29898, 2892, 413, 29892, 325, 29901, 285, 29908, 29912, 29895, 6177, 426, 29894, 29913, 4968, 13, 9651, 21921, 4286, 7122, 29892, 13, 4706, 10353, 13, 4706, 525, 3293, 10724, 5038, 4286, 4830, 29892, 13, 1678, 1723, 565, 3114, 1683, 6629, 13, 1678, 4377, 353, 11117, 1853, 2396, 527, 29918, 1853, 29892, 525, 9507, 2396, 10802, 29898, 9507, 467, 978, 29892, 13, 795, 525, 4478, 2396, 10422, 29892, 525, 6671, 2396, 5777, 683, 29892, 13, 795, 525, 8346, 2396, 4558, 29892, 525, 3293, 2396, 3114, 29913, 13, 1678, 736, 679, 29918, 6272, 2141, 657, 29918, 6886, 877, 4532, 29889, 1420, 29889, 29926, 29906, 2824, 9482, 29898, 4532, 29922, 4532, 29897, 13, 13, 29992, 5396, 2764, 719, 13, 1753, 4377, 29918, 2220, 29898, 326, 29918, 1853, 29892, 6262, 29918, 2220, 29892, 5777, 683, 29892, 10422, 29892, 1369, 2433, 29889, 742, 13, 462, 1678, 334, 29892, 3114, 29901, 9657, 353, 6213, 1125, 13, 1678, 736, 903, 29889, 17760, 29898, 13, 4706, 10422, 29892, 13, 4706, 1284, 29918, 5325, 29898, 2962, 511, 13, 4706, 2910, 29898, 13193, 29918, 2220, 511, 13, 4706, 2910, 22168, 29889, 29890, 29953, 29946, 12508, 29918, 710, 511, 13, 4706, 18761, 29892, 13, 4706, 1207, 29918, 4532, 29898, 326, 29918, 1853, 29892, 10422, 29892, 5777, 683, 29892, 3114, 29922, 3293, 511, 13, 1678, 1723, 13, 13, 2732, 353, 4377, 29918, 2220, 877, 2732, 742, 4558, 29889, 9435, 29889, 2732, 29918, 13193, 29897, 13, 26568, 353, 4377, 29918, 2220, 877, 26568, 742, 4558, 29889, 9435, 29889, 26568, 29918, 13193, 29897, 13, 13, 1753, 1591, 29898, 1272, 1125, 13, 1678, 736, 679, 29918, 6272, 2141, 657, 29918, 6886, 877, 2371, 29889, 1420, 29889, 29926, 29906, 2824, 9482, 29898, 1272, 29922, 1272, 29897, 13, 13, 1753, 788, 29918, 12171, 29898, 6272, 29901, 432, 262, 1764, 29906, 29889, 18649, 1125, 13, 1678, 8829, 29889, 23705, 1338, 1839, 2732, 2033, 353, 282, 865, 13, 1678, 8829, 29889, 23705, 1338, 1839, 26568, 2033, 353, 432, 29886, 387, 13, 1678, 8829, 29889, 23705, 1338, 1839, 2371, 2033, 353, 1591, 13, 1678, 736, 8829, 13, 13, 657, 29918, 6272, 353, 903, 29889, 19438, 29918, 1563, 29898, 13, 1678, 432, 262, 1764, 29906, 29889, 18649, 29892, 13, 1678, 788, 29918, 26705, 29892, 13, 1678, 788, 29918, 12171, 29892, 13, 29897, 13, 2 ]
models/ACT/__init__.py
for-ai/ACT
18
149687
<reponame>for-ai/ACT __all__ = ["act"] from .act import *
[ 1, 529, 276, 1112, 420, 29958, 1454, 29899, 1794, 29914, 17923, 13, 1649, 497, 1649, 353, 6796, 627, 3108, 13, 13, 3166, 869, 627, 1053, 334, 13, 2 ]
setup.py
Willd14469/cj8-patient-panthers
1
17420
import sys from setuptools import setup required_packages = ["boombox", "Pillow", "PyYAML", "rich"] win_packages = ["keyboard"] unix_packages = ["pynput"] WIN = "win32" LINUX = "linux" MACOS = "darwin" if sys.platform == WIN: required_packages += win_packages elif sys.platform in (LINUX, MACOS): required_packages += unix_packages setup( name="pantheras_box", version="0.1.0", packages=[ "pantheras_box", "pantheras_box.story", "pantheras_box.sounds", "pantheras_box.backend", "pantheras_box.frontend", "pantheras_box.keyboard_handlers", ], url="", license="MIT", author="<NAME>", author_email="", description="Pantheras box TUI game.", install_requires=required_packages, entry_points={ "console_scripts": [ "pantheras-box = pantheras_box.run:run_game", ], }, package_data={"": ["**/*.txt", "**/*.yaml", "**/*.png", "**/*.wav"]}, include_package_data=True, )
[ 1, 1053, 10876, 13, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 12403, 29918, 8318, 353, 6796, 833, 290, 1884, 613, 376, 29925, 453, 340, 613, 376, 19737, 29979, 23956, 613, 376, 4018, 3108, 13, 13, 5080, 29918, 8318, 353, 6796, 1989, 3377, 3108, 13, 24538, 29918, 8318, 353, 6796, 29886, 948, 649, 3108, 13, 13, 25152, 353, 376, 5080, 29941, 29906, 29908, 13, 23714, 29965, 29990, 353, 376, 9389, 29908, 13, 1529, 3217, 29903, 353, 376, 16702, 5080, 29908, 13, 361, 10876, 29889, 12120, 1275, 399, 1177, 29901, 13, 1678, 3734, 29918, 8318, 4619, 5401, 29918, 8318, 13, 23681, 10876, 29889, 12120, 297, 313, 23714, 29965, 29990, 29892, 26750, 3267, 1125, 13, 1678, 3734, 29918, 8318, 4619, 28167, 29918, 8318, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 8357, 721, 294, 29918, 1884, 613, 13, 1678, 1873, 543, 29900, 29889, 29896, 29889, 29900, 613, 13, 1678, 9741, 11759, 13, 4706, 376, 8357, 721, 294, 29918, 1884, 613, 13, 4706, 376, 8357, 721, 294, 29918, 1884, 29889, 24098, 613, 13, 4706, 376, 8357, 721, 294, 29918, 1884, 29889, 29879, 3885, 613, 13, 4706, 376, 8357, 721, 294, 29918, 1884, 29889, 27852, 613, 13, 4706, 376, 8357, 721, 294, 29918, 1884, 29889, 8862, 355, 613, 13, 4706, 376, 8357, 721, 294, 29918, 1884, 29889, 1989, 3377, 29918, 3179, 9306, 613, 13, 1678, 21251, 13, 1678, 3142, 543, 613, 13, 1678, 19405, 543, 26349, 613, 13, 1678, 4148, 543, 29966, 5813, 28341, 13, 1678, 4148, 29918, 5269, 543, 613, 13, 1678, 6139, 543, 23684, 721, 294, 3800, 323, 3120, 3748, 19602, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 12403, 29918, 8318, 29892, 13, 1678, 6251, 29918, 9748, 3790, 13, 4706, 376, 11058, 29918, 16713, 1115, 518, 13, 9651, 376, 8357, 721, 294, 29899, 1884, 353, 7243, 721, 294, 29918, 1884, 29889, 3389, 29901, 3389, 29918, 11802, 613, 13, 4706, 21251, 13, 1678, 2981, 13, 1678, 3577, 29918, 1272, 3790, 29908, 1115, 6796, 1068, 5515, 29889, 3945, 613, 376, 1068, 5515, 29889, 25162, 613, 376, 1068, 5515, 29889, 2732, 613, 376, 1068, 5515, 29889, 29893, 485, 3108, 1118, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 29897, 13, 2 ]
src/dataset.py
hrkz/SubgridTransportNN
5
183141
<filename>src/dataset.py import torch import numpy as np import h5py import matplotlib import matplotlib.pyplot as plt import glob plt.rcParams.update({'mathtext.fontset':'cm'}) class SubgridDataset(torch.utils.data.Dataset): def __init__(self, device, path, samples, size, x, y, established=0): self.device = device self.path = path self.samples = samples - established self.size = size self.established = established self.x = x self.y = y self.inputs = torch.zeros(self.samples, len(x), size, size, size, dtype=torch.float32) self.labels = torch.zeros(self.samples, len(y), size, size, size, dtype=torch.float32) for i, f in enumerate(x): for j, c in enumerate(sorted(glob.glob(path + f + '_*'))): if j < established: # dynamic not established continue elif j >= samples: break # transform p = j - established file = h5py.File(c, 'r') dset = file[f] self.inputs[p][i] = torch.from_numpy(dset[()]) for i, f in enumerate(y): for j, c in enumerate(sorted(glob.glob(path + f + '_*'))): if j < established: # dynamic not established continue elif j >= samples: break # transform p = j - established #to_pytorch(self.labels[p][i], f, c) file = h5py.File(c, 'r') dset = file[f] self.labels[p][i] = torch.from_numpy(dset[()]) def plot(self, ylabels, plot_samples=5, slice=5): features_inputs = self.inputs.shape[1] features_labels = self.labels.shape[1] features = features_inputs + features_labels fig, ax = plt.subplots( nrows=features, ncols=plot_samples + 1, figsize=(plot_samples * 2.5, features * 2.5), constrained_layout=True, gridspec_kw={"width_ratios": np.append(np.repeat(1, plot_samples), 0.05)} ) fig.suptitle(r'Cut in dataset throughout the simulation of $\mathcal{S}$') max_input, _ = self.inputs[:,:,slice].flatten(start_dim=2).max(2)[0].max(0) min_input, _ = self.inputs[:,:,slice].flatten(start_dim=2).min(2)[0].min(0) max_label, _ = self.labels[:,:,slice].flatten(start_dim=2).max(2)[0].max(0) min_label, _ = self.labels[:,:,slice].flatten(start_dim=2).min(2)[0].min(0) for j in range(plot_samples): sample = int( (j) * ((self.samples - 1) / (plot_samples - 1) )) off = len(self.x) for i, f in enumerate(self.x): c = ax[i, j].contourf(self.inputs[sample][i][slice], 100, cmap='bwr', vmin=min_input[i], vmax=max_input[i]) if j < 1: # add label ax[i, j].set_ylabel(ylabels[i], fontsize=20.0) fig.colorbar(c, cax=ax[i, plot_samples]) for i, f in enumerate(self.y): l = ax[i + off, j].contourf(self.labels[sample][i][slice], 100, cmap='bwr', vmin=min_label[0], vmax=max_label[0]) if j < 1: # add label ax[i + off, j].set_ylabel(ylabels[i + off], fontsize=20.0) fig.colorbar(l, cax=ax[i + off, plot_samples]) ax[i + off, j].set_xlabel(r'$\mathcal{S}_{' + str((self.established + sample + 1) * 500) + r'}$', fontsize=20.0) #fig.savefig('dataset.png') def __len__(self): return self.samples def __getitem__(self, idx): if torch.is_tensor(idx): idx = idx.tolist() inputs = self.inputs[idx] labels = self.labels[idx] return (inputs.to(self.device), labels.to(self.device))
[ 1, 529, 9507, 29958, 4351, 29914, 24713, 29889, 2272, 13, 5215, 4842, 305, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 298, 29945, 2272, 13, 13, 5215, 22889, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 5215, 13149, 13, 13, 572, 29873, 29889, 2214, 9629, 29889, 5504, 3319, 29915, 755, 726, 29889, 5657, 842, 22099, 4912, 29915, 1800, 13, 13, 1990, 3323, 7720, 16390, 24541, 29898, 7345, 305, 29889, 13239, 29889, 1272, 29889, 16390, 24541, 1125, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 4742, 29892, 2224, 29892, 11916, 29892, 2159, 29892, 921, 29892, 343, 29892, 7841, 29922, 29900, 1125, 13, 1678, 1583, 29889, 10141, 353, 4742, 13, 1678, 1583, 29889, 2084, 353, 2224, 13, 1678, 1583, 29889, 27736, 353, 11916, 448, 7841, 13, 1678, 1583, 29889, 2311, 353, 2159, 13, 1678, 1583, 29889, 342, 370, 3726, 353, 7841, 13, 1678, 1583, 29889, 29916, 353, 921, 13, 1678, 1583, 29889, 29891, 353, 343, 13, 1678, 1583, 29889, 2080, 29879, 353, 4842, 305, 29889, 3298, 359, 29898, 1311, 29889, 27736, 29892, 7431, 29898, 29916, 511, 2159, 29892, 2159, 29892, 2159, 29892, 26688, 29922, 7345, 305, 29889, 7411, 29941, 29906, 29897, 13, 1678, 1583, 29889, 21134, 353, 4842, 305, 29889, 3298, 359, 29898, 1311, 29889, 27736, 29892, 7431, 29898, 29891, 511, 2159, 29892, 2159, 29892, 2159, 29892, 26688, 29922, 7345, 305, 29889, 7411, 29941, 29906, 29897, 13, 13, 1678, 363, 474, 29892, 285, 297, 26985, 29898, 29916, 1125, 13, 418, 363, 432, 29892, 274, 297, 26985, 29898, 24582, 29898, 23705, 29889, 23705, 29898, 2084, 718, 285, 718, 22868, 29930, 8785, 1125, 13, 4706, 565, 432, 529, 7841, 29901, 13, 3986, 396, 7343, 451, 7841, 13, 3986, 6773, 13, 4706, 25342, 432, 6736, 11916, 29901, 13, 3986, 2867, 13, 13, 4706, 396, 4327, 13, 4706, 282, 353, 432, 448, 7841, 13, 4706, 934, 353, 298, 29945, 2272, 29889, 2283, 29898, 29883, 29892, 525, 29878, 1495, 13, 4706, 270, 842, 353, 934, 29961, 29888, 29962, 13, 4706, 1583, 29889, 2080, 29879, 29961, 29886, 3816, 29875, 29962, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 29881, 842, 29961, 580, 2314, 13, 13, 1678, 363, 474, 29892, 285, 297, 26985, 29898, 29891, 1125, 13, 418, 363, 432, 29892, 274, 297, 26985, 29898, 24582, 29898, 23705, 29889, 23705, 29898, 2084, 718, 285, 718, 22868, 29930, 8785, 1125, 13, 4706, 565, 432, 529, 7841, 29901, 13, 3986, 396, 7343, 451, 7841, 13, 3986, 6773, 13, 4706, 25342, 432, 6736, 11916, 29901, 13, 3986, 2867, 13, 13, 4706, 396, 4327, 13, 4706, 282, 353, 432, 448, 7841, 13, 4706, 396, 517, 29918, 2272, 7345, 305, 29898, 1311, 29889, 21134, 29961, 29886, 3816, 29875, 1402, 285, 29892, 274, 29897, 13, 4706, 934, 353, 298, 29945, 2272, 29889, 2283, 29898, 29883, 29892, 525, 29878, 1495, 13, 4706, 270, 842, 353, 934, 29961, 29888, 29962, 13, 4706, 1583, 29889, 21134, 29961, 29886, 3816, 29875, 29962, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 29881, 842, 29961, 580, 2314, 13, 13, 29871, 822, 6492, 29898, 1311, 29892, 343, 21134, 29892, 6492, 29918, 27736, 29922, 29945, 29892, 22780, 29922, 29945, 1125, 13, 1678, 5680, 29918, 2080, 29879, 353, 1583, 29889, 2080, 29879, 29889, 12181, 29961, 29896, 29962, 13, 1678, 5680, 29918, 21134, 353, 1583, 29889, 21134, 29889, 12181, 29961, 29896, 29962, 13, 1678, 5680, 353, 5680, 29918, 2080, 29879, 718, 5680, 29918, 21134, 13, 1678, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 13, 418, 302, 5727, 29922, 22100, 29892, 13, 418, 302, 22724, 29922, 5317, 29918, 27736, 718, 29871, 29896, 29892, 13, 418, 2537, 2311, 7607, 5317, 29918, 27736, 334, 29871, 29906, 29889, 29945, 29892, 5680, 334, 29871, 29906, 29889, 29945, 511, 13, 418, 1040, 22042, 29918, 2680, 29922, 5574, 29892, 13, 418, 867, 4841, 3135, 29918, 11022, 3790, 29908, 2103, 29918, 29878, 2219, 359, 1115, 7442, 29889, 4397, 29898, 9302, 29889, 14358, 29898, 29896, 29892, 6492, 29918, 27736, 511, 29871, 29900, 29889, 29900, 29945, 2915, 13, 1678, 1723, 13, 1678, 2537, 29889, 2146, 415, 1740, 29898, 29878, 29915, 29907, 329, 297, 8783, 10106, 278, 17402, 310, 779, 1942, 29912, 29903, 1042, 1495, 13, 13, 1678, 4236, 29918, 2080, 29892, 903, 353, 1583, 29889, 2080, 29879, 7503, 29892, 29901, 29892, 18337, 1822, 1579, 8606, 29898, 2962, 29918, 6229, 29922, 29906, 467, 3317, 29898, 29906, 9601, 29900, 1822, 3317, 29898, 29900, 29897, 13, 1678, 1375, 29918, 2080, 29892, 903, 353, 1583, 29889, 2080, 29879, 7503, 29892, 29901, 29892, 18337, 1822, 1579, 8606, 29898, 2962, 29918, 6229, 29922, 29906, 467, 1195, 29898, 29906, 9601, 29900, 1822, 1195, 29898, 29900, 29897, 13, 1678, 4236, 29918, 1643, 29892, 903, 353, 1583, 29889, 21134, 7503, 29892, 29901, 29892, 18337, 1822, 1579, 8606, 29898, 2962, 29918, 6229, 29922, 29906, 467, 3317, 29898, 29906, 9601, 29900, 1822, 3317, 29898, 29900, 29897, 13, 1678, 1375, 29918, 1643, 29892, 903, 353, 1583, 29889, 21134, 7503, 29892, 29901, 29892, 18337, 1822, 1579, 8606, 29898, 2962, 29918, 6229, 29922, 29906, 467, 1195, 29898, 29906, 9601, 29900, 1822, 1195, 29898, 29900, 29897, 13, 1678, 363, 432, 297, 3464, 29898, 5317, 29918, 27736, 1125, 13, 418, 4559, 353, 938, 29898, 13, 4706, 313, 29926, 29897, 334, 29871, 13, 4706, 5135, 1311, 29889, 27736, 448, 29871, 29896, 29897, 847, 29871, 13, 4706, 313, 5317, 29918, 27736, 448, 29871, 29896, 29897, 29871, 876, 13, 13, 418, 1283, 353, 7431, 29898, 1311, 29889, 29916, 29897, 13, 418, 363, 474, 29892, 285, 297, 26985, 29898, 1311, 29889, 29916, 1125, 13, 4706, 274, 353, 4853, 29961, 29875, 29892, 432, 1822, 1285, 473, 29888, 29898, 1311, 29889, 2080, 29879, 29961, 11249, 3816, 29875, 3816, 18337, 1402, 29871, 29896, 29900, 29900, 29892, 274, 1958, 2433, 29890, 15866, 742, 325, 1195, 29922, 1195, 29918, 2080, 29961, 29875, 1402, 325, 3317, 29922, 3317, 29918, 2080, 29961, 29875, 2314, 13, 4706, 565, 432, 529, 29871, 29896, 29901, 13, 3986, 396, 788, 3858, 13, 3986, 4853, 29961, 29875, 29892, 432, 1822, 842, 29918, 29891, 1643, 29898, 29891, 21134, 29961, 29875, 1402, 4079, 2311, 29922, 29906, 29900, 29889, 29900, 29897, 13, 3986, 2537, 29889, 2780, 1646, 29898, 29883, 29892, 274, 1165, 29922, 1165, 29961, 29875, 29892, 6492, 29918, 27736, 2314, 13, 418, 363, 474, 29892, 285, 297, 26985, 29898, 1311, 29889, 29891, 1125, 13, 4706, 301, 353, 4853, 29961, 29875, 718, 1283, 29892, 432, 1822, 1285, 473, 29888, 29898, 1311, 29889, 21134, 29961, 11249, 3816, 29875, 3816, 18337, 1402, 29871, 29896, 29900, 29900, 29892, 274, 1958, 2433, 29890, 15866, 742, 325, 1195, 29922, 1195, 29918, 1643, 29961, 29900, 1402, 325, 3317, 29922, 3317, 29918, 1643, 29961, 29900, 2314, 13, 4706, 565, 432, 529, 29871, 29896, 29901, 13, 3986, 396, 788, 3858, 13, 3986, 4853, 29961, 29875, 718, 1283, 29892, 432, 1822, 842, 29918, 29891, 1643, 29898, 29891, 21134, 29961, 29875, 718, 1283, 1402, 4079, 2311, 29922, 29906, 29900, 29889, 29900, 29897, 13, 3986, 2537, 29889, 2780, 1646, 29898, 29880, 29892, 274, 1165, 29922, 1165, 29961, 29875, 718, 1283, 29892, 6492, 29918, 27736, 2314, 13, 418, 4853, 29961, 29875, 718, 1283, 29892, 432, 1822, 842, 29918, 29916, 1643, 29898, 29878, 29915, 4535, 1942, 29912, 29903, 3227, 29915, 718, 851, 3552, 1311, 29889, 342, 370, 3726, 718, 4559, 718, 29871, 29896, 29897, 334, 29871, 29945, 29900, 29900, 29897, 718, 364, 29915, 1042, 742, 4079, 2311, 29922, 29906, 29900, 29889, 29900, 29897, 13, 1678, 396, 1003, 29889, 7620, 1003, 877, 24713, 29889, 2732, 1495, 13, 13, 29871, 822, 4770, 2435, 12035, 1311, 1125, 13, 1678, 736, 1583, 29889, 27736, 13, 13, 29871, 822, 4770, 657, 667, 12035, 1311, 29892, 22645, 1125, 13, 1678, 565, 4842, 305, 29889, 275, 29918, 20158, 29898, 13140, 1125, 13, 418, 22645, 353, 22645, 29889, 25027, 391, 580, 13, 13, 1678, 10970, 353, 1583, 29889, 2080, 29879, 29961, 13140, 29962, 13, 1678, 11073, 353, 1583, 29889, 21134, 29961, 13140, 29962, 13, 13, 1678, 736, 313, 2080, 29879, 29889, 517, 29898, 1311, 29889, 10141, 511, 11073, 29889, 517, 29898, 1311, 29889, 10141, 876, 13, 2 ]
tf_quant_finance/volatility/black_scholes.py
0xflotus/tf-quant-finance
2
156770
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://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. """Black Scholes prices of a batch of European options.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import tensorflow_probability as tfp def option_price(forwards, strikes, volatilities, expiries, discount_factors=None, is_call_options=None, dtype=None, name=None): """Computes the Black Scholes price for a batch of European options. ## References: [1] Hull, <NAME>., Options, Futures and Other Derivatives. Pearson, 2018. [2] Wikipedia contributors. Black-Scholes model. Available at: https://en.wikipedia.org/w/index.php?title=Black%E2%80%93Scholes_model Args: forwards: A real `Tensor` of any shape. The current forward prices to expiry. strikes: A real `Tensor` of the same shape and dtype as `forwards`. The strikes of the options to be priced. volatilities: A real `Tensor` of same shape and dtype as `forwards`. The volatility to expiry. expiries: A real `Tensor` of same shape and dtype as `forwards`. The expiry for each option. The units should be such that `expiry * volatility**2` is dimensionless. discount_factors: A real `Tensor` of same shape and dtype as the `forwards`. The discount factors to expiry (i.e. e^(-rT)). If not specified, no discounting is applied (i.e. the undiscounted option price is returned). Default value: None, interpreted as discount factors = 1. is_call_options: A boolean `Tensor` of a shape compatible with `forwards`. Indicates whether to compute the price of a call (if True) or a put (if False). If not supplied, it is assumed that every element is a call. dtype: Optional `tf.DType`. If supplied, the dtype to be used for conversion of any supplied non-`Tensor` arguments to `Tensor`. Default value: None which maps to the default dtype inferred by TensorFlow (float32). name: str. The name for the ops created by this function. Default value: None which is mapped to the default name `option_price`. Returns: option_prices: A `Tensor` of the same shape as `forwards`. The Black Scholes price of the options. #### Examples ```python forwards = np.array([1.0, 2.0, 3.0, 4.0, 5.0]) strikes = np.array([3.0, 3.0, 3.0, 3.0, 3.0]) volatilities = np.array([0.0001, 102.0, 2.0, 0.1, 0.4]) expiries = 1.0 computed_prices = option_price( forwards, strikes, volatilities, expiries, dtype=tf.float64) # Expected print output of computed prices: # [ 0. 2. 2.04806848 1.00020297 2.07303131] ``` """ with tf.compat.v1.name_scope( name, default_name='option_price', values=[ forwards, strikes, volatilities, expiries, discount_factors, is_call_options ]): forwards = tf.convert_to_tensor(forwards, dtype=dtype, name='forwards') strikes = tf.convert_to_tensor(strikes, dtype=dtype, name='strikes') volatilities = tf.convert_to_tensor( volatilities, dtype=dtype, name='volatilities') expiries = tf.convert_to_tensor(expiries, dtype=dtype, name='expiries') if discount_factors is None: discount_factors = 1 discount_factors = tf.convert_to_tensor( discount_factors, dtype=dtype, name='discount_factors') normal = tfp.distributions.Normal( loc=tf.zeros([], dtype=forwards.dtype), scale=1) sqrt_var = volatilities * tf.math.sqrt(expiries) d1 = (tf.math.log(forwards / strikes) + sqrt_var * sqrt_var / 2) / sqrt_var d2 = d1 - sqrt_var undiscounted_calls = forwards * normal.cdf(d1) - strikes * normal.cdf(d2) if is_call_options is None: return discount_factors * undiscounted_calls undiscounted_forward = forwards - strikes undiscounted_puts = undiscounted_calls - undiscounted_forward return discount_factors * tf.where(is_call_options, undiscounted_calls, undiscounted_puts) def binary_price(forwards, strikes, volatilities, expiries, discount_factors=None, is_call_options=None, dtype=None, name=None): """Computes the Black Scholes price for a batch of European binary options. The binary call (resp. put) option priced here is that which pays off a unit of cash if the underlying asset has a value greater (resp. smaller) than the strike price at expiry. Hence the binary option price is the discounted probability that the asset will end up higher (resp. lower) than the strike price at expiry. ## References: [1] <NAME>., Options, Futures and Other Derivatives. Pearson, 2018. [2] Wikipedia contributors. Binary option. Available at: https://en.wikipedia.org/w/index.php?title=Binary_option Args: forwards: A real `Tensor` of any shape. The current forward prices to expiry. strikes: A real `Tensor` of the same shape and dtype as `forwards`. The strikes of the options to be priced. volatilities: A real `Tensor` of same shape and dtype as `forwards`. The volatility to expiry. expiries: A real `Tensor` of same shape and dtype as `forwards`. The expiry for each option. The units should be such that `expiry * volatility**2` is dimensionless. discount_factors: A real `Tensor` of same shape and dtype as the `forwards`. The discount factors to expiry (i.e. e^(-rT)). If not specified, no discounting is applied (i.e. the undiscounted option price is returned). Default value: None, interpreted as discount factors = 1. is_call_options: A boolean `Tensor` of a shape compatible with `forwards`. Indicates whether to compute the price of a call (if True) or a put (if False). If not supplied, it is assumed that every element is a call. dtype: Optional `tf.DType`. If supplied, the dtype to be used for conversion of any supplied non-`Tensor` arguments to `Tensor`. Default value: None which maps to the default dtype inferred by TensorFlow (float32). name: str. The name for the ops created by this function. Default value: None which is mapped to the default name `binary_price`. Returns: option_prices: A `Tensor` of the same shape as `forwards`. The Black Scholes price of the binary options with unit of cash payoff. #### Examples ```python forwards = np.array([1.0, 2.0, 3.0, 4.0, 5.0]) strikes = np.array([3.0, 3.0, 3.0, 3.0, 3.0]) volatilities = np.array([0.0001, 102.0, 2.0, 0.1, 0.4]) expiries = 1.0 prices = binary_price(forwards, strikes, volatilities, expiries, dtype=tf.float64) # Expected print output of prices: # [0. 0. 0.15865525 0.99764937 0.85927418] ``` """ with tf.compat.v1.name_scope( name, default_name='binary_price', values=[ forwards, strikes, volatilities, expiries, discount_factors, is_call_options ]): forwards = tf.convert_to_tensor(forwards, dtype=dtype, name='forwards') strikes = tf.convert_to_tensor(strikes, dtype=dtype, name='strikes') volatilities = tf.convert_to_tensor( volatilities, dtype=dtype, name='volatilities') expiries = tf.convert_to_tensor(expiries, dtype=dtype, name='expiries') if is_call_options is None: is_call_options = True if discount_factors is None: discount_factors = 1 discount_factors = tf.convert_to_tensor( discount_factors, dtype=dtype, name='discount_factors') sqrt_var = volatilities * tf.math.sqrt(expiries) d2 = (tf.math.log(forwards / strikes) - sqrt_var * sqrt_var / 2) / sqrt_var one = tf.ones_like(forwards) d2_signs = tf.where(is_call_options, one, -one) normal = tfp.distributions.Normal( loc=tf.zeros([], dtype=forwards.dtype), scale=1) return discount_factors * normal.cdf(d2_signs * d2)
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 5087, 365, 12182, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 2045, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 15945, 29908, 18700, 1102, 6544, 26094, 310, 263, 9853, 310, 7824, 3987, 1213, 15945, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 26110, 408, 15886, 13, 5215, 26110, 29918, 22795, 3097, 408, 15886, 29886, 13, 13, 13, 1753, 2984, 29918, 9175, 29898, 1454, 2935, 29892, 13, 462, 19492, 267, 29892, 13, 462, 1700, 271, 9770, 29892, 13, 462, 1518, 29875, 2722, 29892, 13, 462, 2313, 792, 29918, 17028, 943, 29922, 8516, 29892, 13, 462, 338, 29918, 4804, 29918, 6768, 29922, 8516, 29892, 13, 462, 26688, 29922, 8516, 29892, 13, 462, 1024, 29922, 8516, 1125, 13, 29871, 9995, 20606, 267, 278, 6054, 1102, 6544, 8666, 363, 263, 9853, 310, 7824, 3987, 29889, 13, 13, 29871, 444, 28318, 29901, 13, 29871, 518, 29896, 29962, 379, 913, 29892, 529, 5813, 29958, 1696, 25186, 29892, 20582, 1973, 322, 5901, 2452, 440, 5056, 29889, 21265, 1100, 29892, 29871, 29906, 29900, 29896, 29947, 29889, 13, 29871, 518, 29906, 29962, 14109, 17737, 29560, 29889, 6054, 29899, 4504, 6544, 1904, 29889, 7740, 3106, 472, 29901, 13, 1678, 2045, 597, 264, 29889, 6011, 29889, 990, 29914, 29893, 29914, 2248, 29889, 1961, 29973, 3257, 29922, 18700, 29995, 29923, 29906, 29995, 29947, 29900, 29995, 29929, 29941, 4504, 6544, 29918, 4299, 13, 13, 29871, 826, 3174, 29901, 13, 1678, 363, 2935, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 738, 8267, 29889, 450, 1857, 6375, 26094, 304, 13, 418, 1518, 16129, 29889, 13, 1678, 19492, 267, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 278, 1021, 8267, 322, 26688, 408, 421, 1454, 2935, 1412, 450, 13, 418, 19492, 267, 310, 278, 3987, 304, 367, 544, 7612, 29889, 13, 1678, 1700, 271, 9770, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 1021, 8267, 322, 26688, 408, 421, 1454, 2935, 1412, 450, 13, 418, 1700, 271, 1793, 304, 1518, 16129, 29889, 13, 1678, 1518, 29875, 2722, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 1021, 8267, 322, 26688, 408, 421, 1454, 2935, 1412, 450, 1518, 16129, 13, 418, 363, 1269, 2984, 29889, 450, 10340, 881, 367, 1316, 393, 421, 4548, 16129, 334, 1700, 271, 1793, 1068, 29906, 29952, 338, 13, 418, 9927, 2222, 29889, 13, 1678, 2313, 792, 29918, 17028, 943, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 1021, 8267, 322, 26688, 408, 278, 421, 1454, 2935, 1412, 13, 418, 450, 2313, 792, 13879, 304, 1518, 16129, 313, 29875, 29889, 29872, 29889, 321, 29985, 6278, 29878, 29911, 8106, 960, 451, 6790, 29892, 694, 13, 418, 2313, 792, 292, 338, 7436, 313, 29875, 29889, 29872, 29889, 278, 563, 275, 2798, 287, 2984, 8666, 338, 4133, 467, 13, 418, 13109, 995, 29901, 6213, 29892, 21551, 408, 2313, 792, 13879, 353, 29871, 29896, 29889, 13, 1678, 338, 29918, 4804, 29918, 6768, 29901, 319, 7223, 421, 29911, 6073, 29952, 310, 263, 8267, 15878, 411, 421, 1454, 2935, 1412, 13, 418, 1894, 293, 1078, 3692, 304, 10272, 278, 8666, 310, 263, 1246, 313, 361, 5852, 29897, 470, 263, 1925, 313, 361, 13, 418, 7700, 467, 960, 451, 19056, 29892, 372, 338, 12023, 393, 1432, 1543, 338, 263, 1246, 29889, 13, 1678, 26688, 29901, 28379, 421, 13264, 29889, 29928, 1542, 1412, 960, 19056, 29892, 278, 26688, 304, 367, 1304, 363, 11301, 13, 418, 310, 738, 19056, 1661, 29899, 29952, 29911, 6073, 29952, 6273, 304, 421, 29911, 6073, 1412, 13, 418, 13109, 995, 29901, 6213, 607, 11053, 304, 278, 2322, 26688, 10115, 1127, 491, 323, 6073, 17907, 13, 418, 313, 7411, 29941, 29906, 467, 13, 1678, 1024, 29901, 851, 29889, 450, 1024, 363, 278, 288, 567, 2825, 491, 445, 740, 29889, 13, 418, 13109, 995, 29901, 6213, 607, 338, 20545, 304, 278, 2322, 1024, 421, 3385, 29918, 9175, 1412, 13, 13, 29871, 16969, 29901, 13, 1678, 2984, 29918, 558, 1575, 29901, 319, 421, 29911, 6073, 29952, 310, 278, 1021, 8267, 408, 421, 1454, 2935, 1412, 450, 6054, 13, 1678, 1102, 6544, 8666, 310, 278, 3987, 29889, 13, 13, 13, 29871, 3191, 1222, 9422, 13, 29871, 7521, 4691, 13, 29871, 363, 2935, 353, 7442, 29889, 2378, 4197, 29896, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29946, 29889, 29900, 29892, 29871, 29945, 29889, 29900, 2314, 13, 29871, 19492, 267, 353, 7442, 29889, 2378, 4197, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 2314, 13, 29871, 1700, 271, 9770, 353, 7442, 29889, 2378, 4197, 29900, 29889, 29900, 29900, 29900, 29896, 29892, 29871, 29896, 29900, 29906, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29892, 29871, 29900, 29889, 29896, 29892, 29871, 29900, 29889, 29946, 2314, 13, 29871, 1518, 29875, 2722, 353, 29871, 29896, 29889, 29900, 13, 29871, 15712, 29918, 558, 1575, 353, 2984, 29918, 9175, 29898, 13, 418, 363, 2935, 29892, 13, 418, 19492, 267, 29892, 13, 418, 1700, 271, 9770, 29892, 13, 418, 1518, 29875, 2722, 29892, 13, 418, 26688, 29922, 13264, 29889, 7411, 29953, 29946, 29897, 13, 29871, 396, 1222, 6021, 1596, 1962, 310, 15712, 26094, 29901, 13, 29871, 396, 518, 29871, 29900, 29889, 965, 29906, 29889, 965, 29906, 29889, 29900, 29946, 29947, 29900, 29953, 29947, 29946, 29947, 259, 29896, 29889, 29900, 29900, 29900, 29906, 29900, 29906, 29929, 29955, 259, 29906, 29889, 29900, 29955, 29941, 29900, 29941, 29896, 29941, 29896, 29962, 13, 29871, 7521, 13, 29871, 9995, 13, 29871, 411, 15886, 29889, 12667, 29889, 29894, 29896, 29889, 978, 29918, 6078, 29898, 13, 418, 1024, 29892, 13, 418, 2322, 29918, 978, 2433, 3385, 29918, 9175, 742, 13, 418, 1819, 11759, 13, 3986, 363, 2935, 29892, 19492, 267, 29892, 1700, 271, 9770, 29892, 1518, 29875, 2722, 29892, 2313, 792, 29918, 17028, 943, 29892, 13, 3986, 338, 29918, 4804, 29918, 6768, 13, 418, 4514, 1125, 13, 1678, 363, 2935, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 1454, 2935, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 1454, 2935, 1495, 13, 1678, 19492, 267, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 303, 5357, 267, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 303, 5357, 267, 1495, 13, 1678, 1700, 271, 9770, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 1700, 271, 9770, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 1555, 271, 9770, 1495, 13, 1678, 1518, 29875, 2722, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 735, 1631, 2722, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 735, 1631, 2722, 1495, 13, 1678, 565, 2313, 792, 29918, 17028, 943, 338, 6213, 29901, 13, 418, 2313, 792, 29918, 17028, 943, 353, 29871, 29896, 13, 1678, 2313, 792, 29918, 17028, 943, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 2313, 792, 29918, 17028, 943, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 2218, 2798, 29918, 17028, 943, 1495, 13, 1678, 4226, 353, 15886, 29886, 29889, 27691, 29879, 29889, 19077, 29898, 13, 4706, 1180, 29922, 13264, 29889, 3298, 359, 4197, 1402, 26688, 29922, 1454, 2935, 29889, 29881, 1853, 511, 6287, 29922, 29896, 29897, 13, 1678, 18074, 2273, 29918, 1707, 353, 1700, 271, 9770, 334, 15886, 29889, 755, 29889, 3676, 29898, 735, 1631, 2722, 29897, 13, 1678, 270, 29896, 353, 313, 13264, 29889, 755, 29889, 1188, 29898, 1454, 2935, 847, 19492, 267, 29897, 718, 18074, 2273, 29918, 1707, 334, 18074, 2273, 29918, 1707, 847, 29871, 29906, 29897, 847, 18074, 2273, 29918, 1707, 13, 1678, 270, 29906, 353, 270, 29896, 448, 18074, 2273, 29918, 1707, 13, 1678, 563, 275, 2798, 287, 29918, 29883, 4293, 353, 363, 2935, 334, 4226, 29889, 29883, 2176, 29898, 29881, 29896, 29897, 448, 19492, 267, 334, 4226, 29889, 29883, 2176, 29898, 29881, 29906, 29897, 13, 1678, 565, 338, 29918, 4804, 29918, 6768, 338, 6213, 29901, 13, 418, 736, 2313, 792, 29918, 17028, 943, 334, 563, 275, 2798, 287, 29918, 29883, 4293, 13, 1678, 563, 275, 2798, 287, 29918, 11333, 353, 363, 2935, 448, 19492, 267, 13, 1678, 563, 275, 2798, 287, 29918, 649, 29879, 353, 563, 275, 2798, 287, 29918, 29883, 4293, 448, 563, 275, 2798, 287, 29918, 11333, 13, 1678, 736, 2313, 792, 29918, 17028, 943, 334, 15886, 29889, 3062, 29898, 275, 29918, 4804, 29918, 6768, 29892, 563, 275, 2798, 287, 29918, 29883, 4293, 29892, 13, 462, 462, 539, 563, 275, 2798, 287, 29918, 649, 29879, 29897, 13, 13, 13, 1753, 7581, 29918, 9175, 29898, 1454, 2935, 29892, 13, 462, 19492, 267, 29892, 13, 462, 1700, 271, 9770, 29892, 13, 462, 1518, 29875, 2722, 29892, 13, 462, 2313, 792, 29918, 17028, 943, 29922, 8516, 29892, 13, 462, 338, 29918, 4804, 29918, 6768, 29922, 8516, 29892, 13, 462, 26688, 29922, 8516, 29892, 13, 462, 1024, 29922, 8516, 1125, 13, 29871, 9995, 20606, 267, 278, 6054, 1102, 6544, 8666, 363, 263, 9853, 310, 7824, 7581, 3987, 29889, 13, 13, 29871, 450, 7581, 1246, 313, 13713, 29889, 1925, 29897, 2984, 544, 7612, 1244, 338, 393, 607, 9744, 1283, 263, 5190, 13, 29871, 310, 274, 1161, 565, 278, 14407, 24342, 756, 263, 995, 7621, 313, 13713, 29889, 7968, 29897, 1135, 278, 13, 29871, 21283, 8666, 472, 1518, 16129, 29889, 10133, 278, 7581, 2984, 8666, 338, 278, 2313, 792, 287, 13, 29871, 6976, 393, 278, 24342, 674, 1095, 701, 6133, 313, 13713, 29889, 5224, 29897, 1135, 278, 13, 29871, 21283, 8666, 472, 1518, 16129, 29889, 13, 13, 29871, 444, 28318, 29901, 13, 29871, 518, 29896, 29962, 529, 5813, 29958, 1696, 25186, 29892, 20582, 1973, 322, 5901, 2452, 440, 5056, 29889, 21265, 1100, 29892, 29871, 29906, 29900, 29896, 29947, 29889, 13, 29871, 518, 29906, 29962, 14109, 17737, 29560, 29889, 29479, 2984, 29889, 7740, 3106, 472, 29901, 13, 29871, 2045, 597, 264, 29889, 6011, 29889, 990, 29914, 29893, 29914, 2248, 29889, 1961, 29973, 3257, 29922, 25196, 29918, 3385, 13, 13, 29871, 826, 3174, 29901, 13, 1678, 363, 2935, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 738, 8267, 29889, 450, 1857, 6375, 26094, 304, 13, 418, 1518, 16129, 29889, 13, 1678, 19492, 267, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 278, 1021, 8267, 322, 26688, 408, 421, 1454, 2935, 1412, 450, 13, 418, 19492, 267, 310, 278, 3987, 304, 367, 544, 7612, 29889, 13, 1678, 1700, 271, 9770, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 1021, 8267, 322, 26688, 408, 421, 1454, 2935, 1412, 450, 13, 418, 1700, 271, 1793, 304, 1518, 16129, 29889, 13, 1678, 1518, 29875, 2722, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 1021, 8267, 322, 26688, 408, 421, 1454, 2935, 1412, 450, 1518, 16129, 13, 418, 363, 1269, 2984, 29889, 450, 10340, 881, 367, 1316, 393, 421, 4548, 16129, 334, 1700, 271, 1793, 1068, 29906, 29952, 338, 13, 418, 9927, 2222, 29889, 13, 1678, 2313, 792, 29918, 17028, 943, 29901, 319, 1855, 421, 29911, 6073, 29952, 310, 1021, 8267, 322, 26688, 408, 278, 421, 1454, 2935, 1412, 13, 418, 450, 2313, 792, 13879, 304, 1518, 16129, 313, 29875, 29889, 29872, 29889, 321, 29985, 6278, 29878, 29911, 8106, 960, 451, 6790, 29892, 694, 13, 418, 2313, 792, 292, 338, 7436, 313, 29875, 29889, 29872, 29889, 278, 563, 275, 2798, 287, 2984, 8666, 338, 4133, 467, 13, 418, 13109, 995, 29901, 6213, 29892, 21551, 408, 2313, 792, 13879, 353, 29871, 29896, 29889, 13, 1678, 338, 29918, 4804, 29918, 6768, 29901, 319, 7223, 421, 29911, 6073, 29952, 310, 263, 8267, 15878, 411, 421, 1454, 2935, 1412, 13, 418, 1894, 293, 1078, 3692, 304, 10272, 278, 8666, 310, 263, 1246, 313, 361, 5852, 29897, 470, 263, 1925, 313, 361, 13, 418, 7700, 467, 960, 451, 19056, 29892, 372, 338, 12023, 393, 1432, 1543, 338, 263, 1246, 29889, 13, 1678, 26688, 29901, 28379, 421, 13264, 29889, 29928, 1542, 1412, 960, 19056, 29892, 278, 26688, 304, 367, 1304, 363, 11301, 13, 418, 310, 738, 19056, 1661, 29899, 29952, 29911, 6073, 29952, 6273, 304, 421, 29911, 6073, 1412, 13, 418, 13109, 995, 29901, 6213, 607, 11053, 304, 278, 2322, 26688, 10115, 1127, 491, 323, 6073, 17907, 13, 4706, 313, 7411, 29941, 29906, 467, 13, 1678, 1024, 29901, 851, 29889, 450, 1024, 363, 278, 288, 567, 2825, 491, 445, 740, 29889, 13, 418, 13109, 995, 29901, 6213, 607, 338, 20545, 304, 278, 2322, 1024, 421, 19541, 29918, 9175, 1412, 13, 13, 29871, 16969, 29901, 13, 1678, 2984, 29918, 558, 1575, 29901, 319, 421, 29911, 6073, 29952, 310, 278, 1021, 8267, 408, 421, 1454, 2935, 1412, 450, 6054, 13, 1678, 1102, 6544, 8666, 310, 278, 7581, 3987, 411, 5190, 310, 274, 1161, 5146, 2696, 29889, 13, 13, 29871, 3191, 1222, 9422, 13, 29871, 7521, 4691, 13, 29871, 363, 2935, 353, 7442, 29889, 2378, 4197, 29896, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29946, 29889, 29900, 29892, 29871, 29945, 29889, 29900, 2314, 13, 29871, 19492, 267, 353, 7442, 29889, 2378, 4197, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 2314, 13, 29871, 1700, 271, 9770, 353, 7442, 29889, 2378, 4197, 29900, 29889, 29900, 29900, 29900, 29896, 29892, 29871, 29896, 29900, 29906, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29892, 29871, 29900, 29889, 29896, 29892, 29871, 29900, 29889, 29946, 2314, 13, 29871, 1518, 29875, 2722, 353, 29871, 29896, 29889, 29900, 13, 29871, 26094, 353, 7581, 29918, 9175, 29898, 1454, 2935, 29892, 19492, 267, 29892, 1700, 271, 9770, 29892, 1518, 29875, 2722, 29892, 13, 462, 1669, 26688, 29922, 13264, 29889, 7411, 29953, 29946, 29897, 13, 29871, 396, 1222, 6021, 1596, 1962, 310, 26094, 29901, 13, 29871, 396, 518, 29900, 29889, 3986, 29900, 29889, 3986, 29900, 29889, 29896, 29945, 29947, 29953, 29945, 29945, 29906, 29945, 29871, 29900, 29889, 29929, 29929, 29955, 29953, 29946, 29929, 29941, 29955, 29871, 29900, 29889, 29947, 29945, 29929, 29906, 29955, 29946, 29896, 29947, 29962, 13, 29871, 7521, 13, 29871, 9995, 13, 29871, 411, 15886, 29889, 12667, 29889, 29894, 29896, 29889, 978, 29918, 6078, 29898, 13, 418, 1024, 29892, 13, 418, 2322, 29918, 978, 2433, 19541, 29918, 9175, 742, 13, 418, 1819, 11759, 13, 3986, 363, 2935, 29892, 19492, 267, 29892, 1700, 271, 9770, 29892, 1518, 29875, 2722, 29892, 2313, 792, 29918, 17028, 943, 29892, 13, 3986, 338, 29918, 4804, 29918, 6768, 13, 418, 4514, 1125, 13, 1678, 363, 2935, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 1454, 2935, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 1454, 2935, 1495, 13, 1678, 19492, 267, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 303, 5357, 267, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 303, 5357, 267, 1495, 13, 1678, 1700, 271, 9770, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 1700, 271, 9770, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 1555, 271, 9770, 1495, 13, 1678, 1518, 29875, 2722, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 735, 1631, 2722, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 735, 1631, 2722, 1495, 13, 1678, 565, 338, 29918, 4804, 29918, 6768, 338, 6213, 29901, 13, 418, 338, 29918, 4804, 29918, 6768, 353, 5852, 13, 1678, 565, 2313, 792, 29918, 17028, 943, 338, 6213, 29901, 13, 418, 2313, 792, 29918, 17028, 943, 353, 29871, 29896, 13, 1678, 2313, 792, 29918, 17028, 943, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 2313, 792, 29918, 17028, 943, 29892, 26688, 29922, 29881, 1853, 29892, 1024, 2433, 2218, 2798, 29918, 17028, 943, 1495, 13, 1678, 18074, 2273, 29918, 1707, 353, 1700, 271, 9770, 334, 15886, 29889, 755, 29889, 3676, 29898, 735, 1631, 2722, 29897, 13, 1678, 270, 29906, 353, 313, 13264, 29889, 755, 29889, 1188, 29898, 1454, 2935, 847, 19492, 267, 29897, 448, 18074, 2273, 29918, 1707, 334, 18074, 2273, 29918, 1707, 847, 29871, 29906, 29897, 847, 18074, 2273, 29918, 1707, 13, 1678, 697, 353, 15886, 29889, 2873, 29918, 4561, 29898, 1454, 2935, 29897, 13, 1678, 270, 29906, 29918, 4530, 29879, 353, 15886, 29889, 3062, 29898, 275, 29918, 4804, 29918, 6768, 29892, 697, 29892, 448, 650, 29897, 13, 1678, 4226, 353, 15886, 29886, 29889, 27691, 29879, 29889, 19077, 29898, 13, 4706, 1180, 29922, 13264, 29889, 3298, 359, 4197, 1402, 26688, 29922, 1454, 2935, 29889, 29881, 1853, 511, 6287, 29922, 29896, 29897, 13, 1678, 736, 2313, 792, 29918, 17028, 943, 334, 4226, 29889, 29883, 2176, 29898, 29881, 29906, 29918, 4530, 29879, 334, 270, 29906, 29897, 13, 2 ]
tests/test_index_db.py
tos-kamiya/d2vg
3
1611616
<filename>tests/test_index_db.py from typing import * import unittest import contextlib from itertools import zip_longest import os import tempfile import numpy as np from d2vg import index_db @contextlib.contextmanager def back_to_curdir(): curdir = os.getcwd() try: yield finally: os.chdir(curdir) def touch(file_name: str): with open(file_name, "w") as outp: print("", end="", file=outp) class IndexDbTest(unittest.TestCase): def test_has(self): pos_vecs: List[index_db.PosVec] = [ (0, 1, np.array([2, 3], dtype=np.float32)), (1, 2, np.array([3, 4], dtype=np.float32)), ] with tempfile.TemporaryDirectory() as tempdir: with back_to_curdir(): os.chdir(tempdir) file_a = os.path.join("a") touch(file_a) file_index_db = "index_db" db = index_db.open(file_index_db, 1) self.assertFalse(db.has(file_a)) db.store(file_a, pos_vecs) self.assertTrue(db.has(file_a)) # path is normalized, so './a' is same as 'a' dot_file_a = os.path.join(os.curdir, file_a) self.assertTrue(db.has(dot_file_a)) # file name with absolute path is not stored abs_file_a = os.path.abspath(file_a) self.assertFalse(db.has(abs_file_a)) def test_lookup(self): pos_vecs: List[index_db.PosVec] = [ (0, 1, np.array([2, 3], dtype=np.float32)), (1, 2, np.array([3, 4], dtype=np.float32)), ] with tempfile.TemporaryDirectory() as tempdir: with back_to_curdir(): os.chdir(tempdir) file_a = os.path.join("a") touch(file_a) file_index_db = "index_db" db = index_db.open(file_index_db, 1) db.store(file_a, pos_vecs) self.assertTrue(db.has(file_a)) act = db.lookup(file_a) for a, e in zip_longest(act, pos_vecs): self.assertEqual(a[0], e[0]) self.assertEqual(a[1], e[1]) for a2i, e2i in zip_longest(a[2], e[2]): self.assertEqual(a2i, e2i) if __name__ == "__main__": unittest.main()
[ 1, 529, 9507, 29958, 21150, 29914, 1688, 29918, 2248, 29918, 2585, 29889, 2272, 13, 3166, 19229, 1053, 334, 13, 13, 5215, 443, 27958, 13, 13, 5215, 3030, 1982, 13, 3166, 4256, 8504, 1053, 14319, 29918, 5426, 342, 13, 5215, 2897, 13, 5215, 5694, 1445, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 270, 29906, 29894, 29887, 1053, 2380, 29918, 2585, 13, 13, 13, 29992, 4703, 1982, 29889, 4703, 12847, 13, 1753, 1250, 29918, 517, 29918, 2764, 3972, 7295, 13, 1678, 3151, 3972, 353, 2897, 29889, 657, 29883, 9970, 580, 13, 1678, 1018, 29901, 13, 4706, 7709, 13, 1678, 7146, 29901, 13, 4706, 2897, 29889, 305, 3972, 29898, 2764, 3972, 29897, 13, 13, 13, 1753, 6023, 29898, 1445, 29918, 978, 29901, 851, 1125, 13, 1678, 411, 1722, 29898, 1445, 29918, 978, 29892, 376, 29893, 1159, 408, 714, 29886, 29901, 13, 4706, 1596, 703, 613, 1095, 543, 613, 934, 29922, 449, 29886, 29897, 13, 13, 13, 1990, 11374, 10234, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 5349, 29898, 1311, 1125, 13, 4706, 926, 29918, 2003, 29879, 29901, 2391, 29961, 2248, 29918, 2585, 29889, 9135, 25987, 29962, 353, 518, 13, 9651, 313, 29900, 29892, 29871, 29896, 29892, 7442, 29889, 2378, 4197, 29906, 29892, 29871, 29941, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 8243, 13, 9651, 313, 29896, 29892, 29871, 29906, 29892, 7442, 29889, 2378, 4197, 29941, 29892, 29871, 29946, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 8243, 13, 4706, 4514, 13, 4706, 411, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 408, 5694, 3972, 29901, 13, 9651, 411, 1250, 29918, 517, 29918, 2764, 3972, 7295, 13, 18884, 2897, 29889, 305, 3972, 29898, 7382, 3972, 29897, 13, 18884, 934, 29918, 29874, 353, 2897, 29889, 2084, 29889, 7122, 703, 29874, 1159, 13, 18884, 6023, 29898, 1445, 29918, 29874, 29897, 13, 13, 18884, 934, 29918, 2248, 29918, 2585, 353, 376, 2248, 29918, 2585, 29908, 13, 18884, 4833, 353, 2380, 29918, 2585, 29889, 3150, 29898, 1445, 29918, 2248, 29918, 2585, 29892, 29871, 29896, 29897, 13, 13, 18884, 1583, 29889, 9294, 8824, 29898, 2585, 29889, 5349, 29898, 1445, 29918, 29874, 876, 13, 13, 18884, 4833, 29889, 8899, 29898, 1445, 29918, 29874, 29892, 926, 29918, 2003, 29879, 29897, 13, 18884, 1583, 29889, 9294, 5574, 29898, 2585, 29889, 5349, 29898, 1445, 29918, 29874, 876, 13, 13, 18884, 396, 2224, 338, 4226, 1891, 29892, 577, 19283, 29874, 29915, 338, 1021, 408, 525, 29874, 29915, 13, 18884, 8329, 29918, 1445, 29918, 29874, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2764, 3972, 29892, 934, 29918, 29874, 29897, 13, 18884, 1583, 29889, 9294, 5574, 29898, 2585, 29889, 5349, 29898, 6333, 29918, 1445, 29918, 29874, 876, 13, 13, 18884, 396, 934, 1024, 411, 8380, 2224, 338, 451, 6087, 13, 18884, 6425, 29918, 1445, 29918, 29874, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 1445, 29918, 29874, 29897, 13, 18884, 1583, 29889, 9294, 8824, 29898, 2585, 29889, 5349, 29898, 6897, 29918, 1445, 29918, 29874, 876, 13, 13, 1678, 822, 1243, 29918, 20401, 29898, 1311, 1125, 13, 4706, 926, 29918, 2003, 29879, 29901, 2391, 29961, 2248, 29918, 2585, 29889, 9135, 25987, 29962, 353, 518, 13, 9651, 313, 29900, 29892, 29871, 29896, 29892, 7442, 29889, 2378, 4197, 29906, 29892, 29871, 29941, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 8243, 13, 9651, 313, 29896, 29892, 29871, 29906, 29892, 7442, 29889, 2378, 4197, 29941, 29892, 29871, 29946, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 8243, 13, 4706, 4514, 13, 4706, 411, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 408, 5694, 3972, 29901, 13, 9651, 411, 1250, 29918, 517, 29918, 2764, 3972, 7295, 13, 18884, 2897, 29889, 305, 3972, 29898, 7382, 3972, 29897, 13, 18884, 934, 29918, 29874, 353, 2897, 29889, 2084, 29889, 7122, 703, 29874, 1159, 13, 18884, 6023, 29898, 1445, 29918, 29874, 29897, 13, 13, 18884, 934, 29918, 2248, 29918, 2585, 353, 376, 2248, 29918, 2585, 29908, 13, 18884, 4833, 353, 2380, 29918, 2585, 29889, 3150, 29898, 1445, 29918, 2248, 29918, 2585, 29892, 29871, 29896, 29897, 13, 13, 18884, 4833, 29889, 8899, 29898, 1445, 29918, 29874, 29892, 926, 29918, 2003, 29879, 29897, 13, 18884, 1583, 29889, 9294, 5574, 29898, 2585, 29889, 5349, 29898, 1445, 29918, 29874, 876, 13, 13, 18884, 1044, 353, 4833, 29889, 20401, 29898, 1445, 29918, 29874, 29897, 13, 18884, 363, 263, 29892, 321, 297, 14319, 29918, 5426, 342, 29898, 627, 29892, 926, 29918, 2003, 29879, 1125, 13, 462, 1678, 1583, 29889, 9294, 9843, 29898, 29874, 29961, 29900, 1402, 321, 29961, 29900, 2314, 13, 462, 1678, 1583, 29889, 9294, 9843, 29898, 29874, 29961, 29896, 1402, 321, 29961, 29896, 2314, 13, 462, 1678, 363, 263, 29906, 29875, 29892, 321, 29906, 29875, 297, 14319, 29918, 5426, 342, 29898, 29874, 29961, 29906, 1402, 321, 29961, 29906, 29962, 1125, 13, 462, 4706, 1583, 29889, 9294, 9843, 29898, 29874, 29906, 29875, 29892, 321, 29906, 29875, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
pyz3r/exceptions.py
mgius/pyz3r
0
37416
<filename>pyz3r/exceptions.py class alttprException(Exception): pass class alttprFailedToRetrieve(Exception): pass class alttprFailedToGenerate(Exception): pass
[ 1, 529, 9507, 29958, 2272, 29920, 29941, 29878, 29914, 11739, 29879, 29889, 2272, 13, 1990, 394, 698, 558, 2451, 29898, 2451, 1125, 30004, 13, 1678, 1209, 30004, 13, 30004, 13, 30004, 13, 1990, 394, 698, 558, 17776, 1762, 8015, 29878, 2418, 29898, 2451, 1125, 30004, 13, 1678, 1209, 30004, 13, 30004, 13, 30004, 13, 1990, 394, 698, 558, 17776, 1762, 5631, 403, 29898, 2451, 1125, 30004, 13, 1678, 1209, 30004, 13, 2 ]
tests/core_symbol.py
cubetrain/CubeTrain
0
46385
<gh_stars>0 CORE_SYMBOL='SEAT'
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3217, 1525, 29918, 14816, 9486, 5607, 2433, 1660, 1299, 29915, 30004, 13, 2 ]
dog.py
AmjadNoor/ReconDog
1
62436
<gh_stars>1-10 #!/usr/bin/env python3 import sys import requests import argparse from core.hq import hq from core.extractor import extractor from core.colors import white, green, end, red, yellow, run parser = argparse.ArgumentParser() parser.add_argument('-t', help='target', dest='target') parser.add_argument('-c', help='choice', dest='choice') parser.add_argument('--domains', help='stdin type: domain', dest='domains', action='store_true') parser.add_argument('--ips', help='stdin type: ip', dest='ips', action='store_true') args = parser.parse_args() ips = args.ips target = args.target choice = args.choice domains = args.domains data = False if ips or domains: data = sys.stdin.readlines() arged = False if target and choice: arged = True if sys.version_info < (3, 0): input = raw_input def banner(): print ('''%s _____ ____ | __ |___ ___ ___ ___ %s|\_/|%s | \ ___ ___ | -| -_| _| . | | %s|. .|%s | | | . | . | |__|__|___|___|___|_|_| %s \_/ %s |____/|___|_ | |___| v2.0%s''' % (white, red, white, red, white, red, white, end)) def menu(): print(''' %s1.%s Censys %s2.%s NS lookup %s3.%s Port scan %s4.%s Detect CMS %s5.%s Whois lookup %s6.%s Detect honeypot %s7.%s Find subdomains %s8.%s Reverse IP lookup %s9.%s Detect technologies %s0.%s All''' % (white, end, white, end, white, end, white, end, white, end, white, end, white, end, white, end, white, end, white, end)) def dog(choice, target): if not args.target: banner() if arged: hq(choice, target) else: while True: menu() result = False choice = input('\033[1;91m>>\033[0m ') hq(choice) if data: kind = 'domain' if ips: kind = 'ip' targets = extractor(data, kind) if choice: for target in targets: print ('%s %s' % (run, target)) hq(choice, target) print (red + ('-' * 60) + end) else: for target in targets: sys.stdout.write(target + '\n') else: try: dog(choice, target) except KeyboardInterrupt: quit('')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 5215, 10876, 13, 5215, 7274, 13, 5215, 1852, 5510, 13, 13, 3166, 7136, 29889, 29882, 29939, 1053, 298, 29939, 13, 3166, 7136, 29889, 21111, 272, 1053, 6597, 272, 13, 3166, 7136, 29889, 27703, 1053, 4796, 29892, 7933, 29892, 1095, 29892, 2654, 29892, 13328, 29892, 1065, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29873, 742, 1371, 2433, 5182, 742, 2731, 2433, 5182, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29883, 742, 1371, 2433, 16957, 742, 2731, 2433, 16957, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 3129, 2708, 742, 1371, 2433, 4172, 262, 1134, 29901, 5354, 742, 2731, 2433, 3129, 2708, 742, 3158, 2433, 8899, 29918, 3009, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 4512, 742, 1371, 2433, 4172, 262, 1134, 29901, 10377, 742, 2731, 2433, 4512, 742, 3158, 2433, 8899, 29918, 3009, 1495, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 4512, 353, 6389, 29889, 4512, 13, 5182, 353, 6389, 29889, 5182, 13, 16957, 353, 6389, 29889, 16957, 13, 3129, 2708, 353, 6389, 29889, 3129, 2708, 13, 13, 1272, 353, 7700, 13, 361, 474, 567, 470, 21904, 29901, 13, 1678, 848, 353, 10876, 29889, 4172, 262, 29889, 949, 9012, 580, 13, 13, 1191, 287, 353, 7700, 13, 361, 3646, 322, 7348, 29901, 13, 1678, 1852, 287, 353, 5852, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 529, 313, 29941, 29892, 29871, 29900, 1125, 13, 1678, 1881, 353, 10650, 29918, 2080, 13, 13, 13, 1753, 289, 7310, 7295, 13, 1678, 1596, 313, 12008, 29995, 29879, 13, 903, 7652, 462, 308, 903, 22359, 13, 29989, 4770, 29871, 891, 22359, 903, 1649, 903, 1649, 903, 1649, 29871, 1273, 29879, 4295, 29918, 29914, 29989, 29995, 29879, 891, 1678, 320, 903, 1649, 903, 1649, 13, 29989, 1678, 448, 29989, 448, 29918, 29989, 29871, 903, 29989, 869, 891, 259, 891, 1273, 29879, 29989, 29889, 869, 29989, 29995, 29879, 891, 29871, 891, 29871, 891, 869, 891, 869, 891, 13, 29989, 1649, 29989, 1649, 29989, 22359, 29989, 22359, 29989, 22359, 29989, 29918, 29989, 29918, 29989, 1273, 29879, 320, 29918, 29914, 1273, 29879, 891, 7652, 29914, 29989, 22359, 29989, 29918, 29871, 891, 13, 462, 462, 4706, 891, 22359, 29989, 325, 29906, 29889, 29900, 29995, 29879, 12008, 1273, 313, 10921, 29892, 2654, 29892, 4796, 29892, 2654, 29892, 4796, 29892, 2654, 29892, 4796, 29892, 1095, 876, 13, 13, 13, 1753, 6143, 7295, 13, 1678, 1596, 877, 4907, 13, 29995, 29879, 29896, 29889, 29995, 29879, 315, 575, 952, 13, 29995, 29879, 29906, 29889, 29995, 29879, 3865, 16280, 13, 29995, 29879, 29941, 29889, 29995, 29879, 3371, 12812, 13, 29995, 29879, 29946, 29889, 29995, 29879, 5953, 522, 315, 4345, 13, 29995, 29879, 29945, 29889, 29995, 29879, 806, 11505, 16280, 13, 29995, 29879, 29953, 29889, 29995, 29879, 5953, 522, 298, 650, 1478, 327, 13, 29995, 29879, 29955, 29889, 29995, 29879, 10987, 1014, 3129, 2708, 13, 29995, 29879, 29947, 29889, 29995, 29879, 830, 3901, 5641, 16280, 13, 29995, 29879, 29929, 29889, 29995, 29879, 5953, 522, 5722, 11763, 13, 29995, 29879, 29900, 29889, 29995, 29879, 2178, 12008, 1273, 313, 10921, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 29892, 4796, 29892, 1095, 876, 13, 13, 13, 1753, 11203, 29898, 16957, 29892, 3646, 1125, 13, 1678, 565, 451, 6389, 29889, 5182, 29901, 13, 4706, 289, 7310, 580, 13, 1678, 565, 1852, 287, 29901, 13, 4706, 298, 29939, 29898, 16957, 29892, 3646, 29897, 13, 1678, 1683, 29901, 13, 4706, 1550, 5852, 29901, 13, 9651, 6143, 580, 13, 9651, 1121, 353, 7700, 13, 9651, 7348, 353, 1881, 28909, 29900, 29941, 29941, 29961, 29896, 29936, 29929, 29896, 29885, 6778, 29905, 29900, 29941, 29941, 29961, 29900, 29885, 25710, 13, 9651, 298, 29939, 29898, 16957, 29897, 13, 13, 13, 361, 848, 29901, 13, 1678, 2924, 353, 525, 7247, 29915, 13, 1678, 565, 474, 567, 29901, 13, 4706, 2924, 353, 525, 666, 29915, 13, 1678, 22525, 353, 6597, 272, 29898, 1272, 29892, 2924, 29897, 13, 1678, 565, 7348, 29901, 13, 4706, 363, 3646, 297, 22525, 29901, 13, 9651, 1596, 6702, 29995, 29879, 1273, 29879, 29915, 1273, 313, 3389, 29892, 3646, 876, 13, 9651, 298, 29939, 29898, 16957, 29892, 3646, 29897, 13, 9651, 1596, 313, 1127, 718, 6702, 29899, 29915, 334, 29871, 29953, 29900, 29897, 718, 1095, 29897, 13, 1678, 1683, 29901, 13, 4706, 363, 3646, 297, 22525, 29901, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 5182, 718, 11297, 29876, 1495, 13, 2870, 29901, 13, 1678, 1018, 29901, 13, 4706, 11203, 29898, 16957, 29892, 3646, 29897, 13, 1678, 5174, 7670, 3377, 4074, 6685, 29901, 13, 4706, 23283, 877, 1495, 13, 2 ]
examples/plugin_log_task_usage/setup.py
kinow/miniwdl
2
122223
<reponame>kinow/miniwdl from setuptools import setup setup( name='miniwdl_log_task_usage', version='0.0.1', description='miniwdl task plugin to log container cpu+mem usage', author='<NAME>', py_modules=["miniwdl_log_task_usage"], python_requires='>=3.6', setup_requires=['reentry'], reentry_register=True, entry_points={ 'miniwdl.plugin.task': ['log_task_usage = miniwdl_log_task_usage:main'], } )
[ 1, 529, 276, 1112, 420, 29958, 9089, 340, 29914, 1195, 9429, 11671, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 1195, 9429, 11671, 29918, 1188, 29918, 7662, 29918, 21125, 742, 13, 1678, 1873, 2433, 29900, 29889, 29900, 29889, 29896, 742, 13, 1678, 6139, 2433, 1195, 9429, 11671, 3414, 7079, 304, 1480, 5639, 26403, 29974, 6954, 8744, 742, 13, 1678, 4148, 2433, 29966, 5813, 29958, 742, 13, 1678, 11451, 29918, 7576, 29922, 3366, 1195, 9429, 11671, 29918, 1188, 29918, 7662, 29918, 21125, 12436, 13, 1678, 3017, 29918, 276, 339, 2658, 2433, 18572, 29941, 29889, 29953, 742, 13, 1678, 6230, 29918, 276, 339, 2658, 29922, 1839, 276, 8269, 7464, 13, 1678, 337, 8269, 29918, 9573, 29922, 5574, 29892, 13, 1678, 6251, 29918, 9748, 3790, 13, 4706, 525, 1195, 9429, 11671, 29889, 8582, 29889, 7662, 2396, 6024, 1188, 29918, 7662, 29918, 21125, 353, 1375, 9429, 11671, 29918, 1188, 29918, 7662, 29918, 21125, 29901, 3396, 7464, 13, 1678, 500, 13, 29897, 13, 2 ]
tests/test_machine.py
learnitall/foremanlite
0
131900
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Test components of foremanlite.machine The tests in here are pretty basic and non-exhaustive. Could use more work to get truly full coverage. """ import re import typing as t import pytest from hypothesis import given from hypothesis import strategies as st from foremanlite.machine import ( Arch, Mac, Machine, MachineGroup, MachineGroupSet, MachineSelector, SelectorMatchStr, get_uuid, ) from .conftest import machine_strategy, two_unique_machines_strategy class TestMachine: """Test functionality of foremanlite.machine.Machine""" @staticmethod @given(st.sampled_from([a.value for a in Arch])) def test_str_arch_gets_cased_to_enum(arch_str: str): """Test the Arch attr gets casted to enum, even if str given.""" assert isinstance(arch_str, str) # quick sanity check machine = Machine( name="name", mac=Mac("mac"), provision=True, arch=arch_str, ) assert isinstance(machine.arch, Arch) assert machine.arch.value == arch_str assert machine.arch == Arch(arch_str) @staticmethod @given(two_unique_machines_strategy()) def test_hash_is_different_for_two_different_machines( machines: t.Tuple[Machine, Machine] ): """Test the hash of a machine is unique to all its attrs.""" machine_one, machine_two = machines assert hash(machine_one) != hash(machine_two) for key, value in machine_one.dict().items(): setattr(machine_two, key, value) assert hash(machine_one) == hash(machine_two) @staticmethod @given(two_unique_machines_strategy()) def test_hash_is_different_than_uuid(machines: t.Tuple[Machine, Machine]): """ Test that the hash of a machine is distinct from its uuid. uuid is based off of mac and arch only, hash is based off of all attributes. """ machine_one, machine_two = machines hash_one = hash(machine_one) uuid_one = get_uuid(machine=machine_one) machine_one.provision = machine_two.provision machine_one.name = machine_two.name assert hash(machine_one) != hash_one assert get_uuid(machine=machine_one) == uuid_one class TestGetUUID: """Test functionality of foremanlite.machine.get_uuid""" @staticmethod @given(machine_strategy()) def test_get_uuid_returns_same_if_machine_or_arch_and_mac( machine: Machine, ): """Test get_uuid returns same uuid for all kwarg options.""" assert get_uuid(machine=machine) == get_uuid( mac=machine.mac, arch=machine.arch ) @staticmethod @given(two_unique_machines_strategy()) def test_get_uuid_keys_off_of_arch_and_mac( machines: t.Tuple[Machine, Machine] ): """Test get_uuid returns same uuid for same arch and mac.""" machine_one, machine_two = machines assert get_uuid(machine=machine_one) != get_uuid(machine=machine_two) machine_two.arch = machine_one.arch machine_two.mac = machine_one.mac assert get_uuid(machine=machine_one) == get_uuid(machine=machine_two) class TestMachineSelector: """Test functionality of foremanlite.machine.MachineSelector.""" @staticmethod @given(two_unique_machines_strategy()) def test_exact_machine_selector_matches_attributes_exactly( machines: t.Tuple[Machine, Machine] ): """Test exact MachineSelector matches Machines by exact attributes.""" machine_one, machine_two = machines for key, value in machine_one.dict().items(): selector = MachineSelector(type="exact", attr=key, val=value) assert selector.matches(machine_one) assert not selector.matches(machine_two) @staticmethod @given(two_unique_machines_strategy()) def test_regex_machine_selector_matches_attributes_with_regex_str( machines: t.Tuple[Machine, Machine] ): """Test regex MachineSelector matches Machines with regex strings.""" machine_one, machine_two = machines for key, value in machine_one.dict().items(): if isinstance(value, Arch): value = value.value value = str(value) selector = MachineSelector( type="regex", attr=key, val=f"^{re.escape(value)}$" ) assert selector.matches(machine_one) assert not selector.matches(machine_two) class TestSelectorMatchStr: """Test functionality of foremanlite.machine.SelectorMatchStr.""" @staticmethod @given(st.text(alphabet=st.characters(blacklist_characters=["{", "}"]))) def test_test_method_raises_value_error_on_bad_template_output( bad_jinja_str: str, ): """Check that test raises ValueError on bad template output.""" with pytest.raises(ValueError): assert SelectorMatchStr(exp=bad_jinja_str).test({}) @staticmethod @given(st.booleans()) def test_test_method_is_not_case_sensitive(bool_val: bool): """Check that test is not case sensitive to expected boolean output""" bool_val_str = str(bool_val) checks = [ bool_val_str.upper(), bool_val_str.capitalize(), bool_val_str.lower(), bool_val_str.swapcase(), ] for check in checks: assert SelectorMatchStr(exp=check).test({}) == bool_val @staticmethod @given(st.from_regex(re.compile(r"^\s*\{\}\s*$"))) def test_test_method_is_not_sensitive_to_whitespace(bool_val_str: str): """Check that test is not sensitive to whitespace surrounding output""" for expected in [True, False]: exp = bool_val_str.format(str(expected)) assert SelectorMatchStr(exp=exp).test({}) == expected @staticmethod @given( bool_vals=st.lists(st.booleans(), min_size=4, max_size=4), machines=two_unique_machines_strategy(), ) def test_test_method_can_substitute_in_names_and_eval_exp( bool_vals: t.List[bool], machines: t.Tuple[Machine, Machine], monkeypatch, ): """Check that test can substitute selector results into an exp.""" # Don't know how to dynamically generate these, # so just use a hardcoded one exp = ( "{% if (name and provision) or arch or mac %} true " "{% else %} false {% endif %}" ) selector_results = dict( zip(["name", "provision", "arch", "mac"], bool_vals) ) def mock_test(_, selector_values: t.Dict[str, bool]): """Mock test method to check expected input""" assert selector_values == selector_results monkeypatch.setattr(SelectorMatchStr, "test", mock_test) selectors = [] machine_one, machine_two = machines for selector_name, bool_val in selector_results.items(): selector = MachineSelector( type="exact", name=selector_name, attr=selector_name, val=getattr( machine_one if bool_val else machine_two, selector_name ), ) selectors.append(selector) SelectorMatchStr(exp=exp).apply(machine_one, selectors) class TestMachineGroupSet: """Test functionality of foremanlite.machine.MachineGroupSet""" @staticmethod @given(two_unique_machines_strategy()) def test_filter_returns_correct_set_of_group_membership( machines: t.Tuple[Machine, Machine] ): """Test filter returns the groups a machine is a part of.""" machine_one, machine_two = machines machine_one_attrs = machine_one.dict().items() machine_two_attrs = machine_two.dict().items() both_attrs = [*machine_one_attrs, *machine_two_attrs] groups = [ MachineGroup( name="group_one", selectors=[ MachineSelector(type="exact", attr=attr, val=val) for attr, val in machine_one_attrs ], ), MachineGroup( name="group_two", selectors=[ MachineSelector(type="exact", attr=attr, val=val) for attr, val in machine_two_attrs ], ), MachineGroup( name="group_three", selectors=[ MachineSelector( name=str(i), type="exact", attr=attr, val=val ) for i, (attr, val) in enumerate(both_attrs) ], # will not match since these are all and-ed together match_str=SelectorMatchStr( exp="{% if " + " and ".join(map(str, range(len(both_attrs)))) + "%} True {% else %} False {% endif %}" ), ), ] machine_group_set = MachineGroupSet(groups=groups) one_groups = machine_group_set.filter(machine_one) two_groups = machine_group_set.filter(machine_two) assert len(one_groups) == 1 assert len(two_groups) == 1 assert one_groups[0].name == "group_one" assert two_groups[0].name == "group_two"
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 3057, 7117, 310, 363, 11422, 29880, 568, 29889, 23523, 13, 13, 1576, 6987, 297, 1244, 526, 5051, 6996, 322, 1661, 29899, 735, 2350, 504, 573, 29889, 13, 23323, 671, 901, 664, 304, 679, 19781, 2989, 23746, 29889, 13, 15945, 29908, 13, 5215, 337, 13, 5215, 19229, 408, 260, 13, 13, 5215, 11451, 1688, 13, 3166, 20051, 1053, 2183, 13, 3166, 20051, 1053, 16650, 583, 408, 380, 13, 13, 3166, 363, 11422, 29880, 568, 29889, 23523, 1053, 313, 13, 1678, 2595, 29892, 13, 1678, 4326, 29892, 13, 1678, 6189, 29892, 13, 1678, 6189, 4782, 29892, 13, 1678, 6189, 4782, 2697, 29892, 13, 1678, 6189, 10378, 29892, 13, 1678, 7605, 272, 9652, 5015, 29892, 13, 1678, 679, 29918, 25118, 29892, 13, 29897, 13, 13, 3166, 869, 535, 615, 342, 1053, 4933, 29918, 710, 8963, 29892, 1023, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 13, 13, 13, 1990, 4321, 29076, 29901, 13, 1678, 9995, 3057, 9863, 310, 363, 11422, 29880, 568, 29889, 23523, 29889, 29076, 15945, 29908, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 303, 29889, 11249, 29881, 29918, 3166, 4197, 29874, 29889, 1767, 363, 263, 297, 2595, 12622, 13, 1678, 822, 1243, 29918, 710, 29918, 1279, 29918, 20078, 29918, 29883, 1463, 29918, 517, 29918, 18605, 29898, 1279, 29918, 710, 29901, 851, 1125, 13, 4706, 9995, 3057, 278, 2595, 12421, 4947, 4320, 287, 304, 14115, 29892, 1584, 565, 851, 2183, 1213, 15945, 13, 13, 4706, 4974, 338, 8758, 29898, 1279, 29918, 710, 29892, 851, 29897, 29871, 396, 4996, 9753, 537, 1423, 13, 4706, 4933, 353, 6189, 29898, 13, 9651, 1024, 543, 978, 613, 13, 9651, 5825, 29922, 15735, 703, 8628, 4968, 13, 9651, 25161, 29922, 5574, 29892, 13, 9651, 3190, 29922, 1279, 29918, 710, 29892, 13, 4706, 1723, 13, 4706, 4974, 338, 8758, 29898, 23523, 29889, 1279, 29892, 2595, 29897, 13, 4706, 4974, 4933, 29889, 1279, 29889, 1767, 1275, 3190, 29918, 710, 13, 4706, 4974, 4933, 29889, 1279, 1275, 2595, 29898, 1279, 29918, 710, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 10184, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 3101, 13, 1678, 822, 1243, 29918, 8568, 29918, 275, 29918, 29881, 15622, 29918, 1454, 29918, 10184, 29918, 29881, 15622, 29918, 29885, 496, 1475, 29898, 13, 4706, 14884, 29901, 260, 29889, 23215, 552, 29961, 29076, 29892, 6189, 29962, 13, 268, 1125, 13, 4706, 9995, 3057, 278, 6608, 310, 263, 4933, 338, 5412, 304, 599, 967, 12421, 29879, 1213, 15945, 13, 13, 4706, 4933, 29918, 650, 29892, 4933, 29918, 10184, 353, 14884, 13, 4706, 4974, 6608, 29898, 23523, 29918, 650, 29897, 2804, 6608, 29898, 23523, 29918, 10184, 29897, 13, 4706, 363, 1820, 29892, 995, 297, 4933, 29918, 650, 29889, 8977, 2141, 7076, 7295, 13, 9651, 731, 5552, 29898, 23523, 29918, 10184, 29892, 1820, 29892, 995, 29897, 13, 4706, 4974, 6608, 29898, 23523, 29918, 650, 29897, 1275, 6608, 29898, 23523, 29918, 10184, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 10184, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 3101, 13, 1678, 822, 1243, 29918, 8568, 29918, 275, 29918, 29881, 15622, 29918, 27603, 29918, 25118, 29898, 29885, 496, 1475, 29901, 260, 29889, 23215, 552, 29961, 29076, 29892, 6189, 29962, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 6608, 310, 263, 4933, 338, 8359, 515, 967, 318, 5416, 29889, 13, 13, 4706, 318, 5416, 338, 2729, 1283, 310, 5825, 322, 3190, 871, 29892, 6608, 338, 2729, 1283, 310, 13, 4706, 599, 8393, 29889, 13, 4706, 9995, 13, 13, 4706, 4933, 29918, 650, 29892, 4933, 29918, 10184, 353, 14884, 13, 4706, 6608, 29918, 650, 353, 6608, 29898, 23523, 29918, 650, 29897, 13, 4706, 318, 5416, 29918, 650, 353, 679, 29918, 25118, 29898, 23523, 29922, 23523, 29918, 650, 29897, 13, 4706, 4933, 29918, 650, 29889, 771, 4924, 353, 4933, 29918, 10184, 29889, 771, 4924, 13, 4706, 4933, 29918, 650, 29889, 978, 353, 4933, 29918, 10184, 29889, 978, 13, 13, 4706, 4974, 6608, 29898, 23523, 29918, 650, 29897, 2804, 6608, 29918, 650, 13, 4706, 4974, 679, 29918, 25118, 29898, 23523, 29922, 23523, 29918, 650, 29897, 1275, 318, 5416, 29918, 650, 13, 13, 13, 1990, 4321, 2577, 29965, 11150, 29901, 13, 1678, 9995, 3057, 9863, 310, 363, 11422, 29880, 568, 29889, 23523, 29889, 657, 29918, 25118, 15945, 29908, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 23523, 29918, 710, 8963, 3101, 13, 1678, 822, 1243, 29918, 657, 29918, 25118, 29918, 18280, 29918, 17642, 29918, 361, 29918, 23523, 29918, 272, 29918, 1279, 29918, 392, 29918, 8628, 29898, 13, 4706, 4933, 29901, 6189, 29892, 13, 268, 1125, 13, 4706, 9995, 3057, 679, 29918, 25118, 3639, 1021, 318, 5416, 363, 599, 9049, 1191, 3987, 1213, 15945, 13, 13, 4706, 4974, 679, 29918, 25118, 29898, 23523, 29922, 23523, 29897, 1275, 679, 29918, 25118, 29898, 13, 9651, 5825, 29922, 23523, 29889, 8628, 29892, 3190, 29922, 23523, 29889, 1279, 13, 4706, 1723, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 10184, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 3101, 13, 1678, 822, 1243, 29918, 657, 29918, 25118, 29918, 8149, 29918, 2696, 29918, 974, 29918, 1279, 29918, 392, 29918, 8628, 29898, 13, 4706, 14884, 29901, 260, 29889, 23215, 552, 29961, 29076, 29892, 6189, 29962, 13, 268, 1125, 13, 4706, 9995, 3057, 679, 29918, 25118, 3639, 1021, 318, 5416, 363, 1021, 3190, 322, 5825, 1213, 15945, 13, 13, 4706, 4933, 29918, 650, 29892, 4933, 29918, 10184, 353, 14884, 13, 4706, 4974, 679, 29918, 25118, 29898, 23523, 29922, 23523, 29918, 650, 29897, 2804, 679, 29918, 25118, 29898, 23523, 29922, 23523, 29918, 10184, 29897, 13, 4706, 4933, 29918, 10184, 29889, 1279, 353, 4933, 29918, 650, 29889, 1279, 13, 4706, 4933, 29918, 10184, 29889, 8628, 353, 4933, 29918, 650, 29889, 8628, 13, 4706, 4974, 679, 29918, 25118, 29898, 23523, 29922, 23523, 29918, 650, 29897, 1275, 679, 29918, 25118, 29898, 23523, 29922, 23523, 29918, 10184, 29897, 13, 13, 13, 1990, 4321, 29076, 10378, 29901, 13, 1678, 9995, 3057, 9863, 310, 363, 11422, 29880, 568, 29889, 23523, 29889, 29076, 10378, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 10184, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 3101, 13, 1678, 822, 1243, 29918, 735, 627, 29918, 23523, 29918, 14357, 29918, 20317, 29918, 15697, 29918, 735, 23617, 29898, 13, 4706, 14884, 29901, 260, 29889, 23215, 552, 29961, 29076, 29892, 6189, 29962, 13, 268, 1125, 13, 4706, 9995, 3057, 2684, 6189, 10378, 7087, 17197, 1475, 491, 2684, 8393, 1213, 15945, 13, 13, 4706, 4933, 29918, 650, 29892, 4933, 29918, 10184, 353, 14884, 13, 4706, 363, 1820, 29892, 995, 297, 4933, 29918, 650, 29889, 8977, 2141, 7076, 7295, 13, 9651, 11764, 353, 6189, 10378, 29898, 1853, 543, 735, 627, 613, 12421, 29922, 1989, 29892, 659, 29922, 1767, 29897, 13, 9651, 4974, 11764, 29889, 20317, 29898, 23523, 29918, 650, 29897, 13, 9651, 4974, 451, 11764, 29889, 20317, 29898, 23523, 29918, 10184, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 10184, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 3101, 13, 1678, 822, 1243, 29918, 13087, 29918, 23523, 29918, 14357, 29918, 20317, 29918, 15697, 29918, 2541, 29918, 13087, 29918, 710, 29898, 13, 4706, 14884, 29901, 260, 29889, 23215, 552, 29961, 29076, 29892, 6189, 29962, 13, 268, 1125, 13, 4706, 9995, 3057, 6528, 6189, 10378, 7087, 17197, 1475, 411, 6528, 6031, 1213, 15945, 13, 13, 4706, 4933, 29918, 650, 29892, 4933, 29918, 10184, 353, 14884, 13, 4706, 363, 1820, 29892, 995, 297, 4933, 29918, 650, 29889, 8977, 2141, 7076, 7295, 13, 9651, 565, 338, 8758, 29898, 1767, 29892, 2595, 1125, 13, 18884, 995, 353, 995, 29889, 1767, 13, 9651, 995, 353, 851, 29898, 1767, 29897, 13, 9651, 11764, 353, 6189, 10378, 29898, 13, 18884, 1134, 543, 13087, 613, 12421, 29922, 1989, 29892, 659, 29922, 29888, 29908, 998, 276, 29889, 21587, 29898, 1767, 15604, 29908, 13, 9651, 1723, 13, 9651, 4974, 11764, 29889, 20317, 29898, 23523, 29918, 650, 29897, 13, 9651, 4974, 451, 11764, 29889, 20317, 29898, 23523, 29918, 10184, 29897, 13, 13, 13, 1990, 4321, 10378, 9652, 5015, 29901, 13, 1678, 9995, 3057, 9863, 310, 363, 11422, 29880, 568, 29889, 23523, 29889, 10378, 9652, 5015, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 303, 29889, 726, 29898, 284, 17416, 29922, 303, 29889, 3090, 21706, 29898, 8517, 1761, 29918, 3090, 21706, 29922, 3366, 29912, 613, 376, 29913, 3108, 4961, 13, 1678, 822, 1243, 29918, 1688, 29918, 5696, 29918, 336, 4637, 29918, 1767, 29918, 2704, 29918, 265, 29918, 12313, 29918, 6886, 29918, 4905, 29898, 13, 4706, 4319, 29918, 28789, 1764, 29918, 710, 29901, 851, 29892, 13, 268, 1125, 13, 4706, 9995, 5596, 393, 1243, 1153, 4637, 7865, 2392, 373, 4319, 4472, 1962, 1213, 15945, 13, 13, 4706, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 1125, 13, 9651, 4974, 7605, 272, 9652, 5015, 29898, 4548, 29922, 12313, 29918, 28789, 1764, 29918, 710, 467, 1688, 3319, 1800, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 303, 29889, 833, 1772, 550, 3101, 13, 1678, 822, 1243, 29918, 1688, 29918, 5696, 29918, 275, 29918, 1333, 29918, 4878, 29918, 23149, 3321, 29898, 11227, 29918, 791, 29901, 6120, 1125, 13, 4706, 9995, 5596, 393, 1243, 338, 451, 1206, 20502, 304, 3806, 7223, 1962, 15945, 29908, 13, 13, 4706, 6120, 29918, 791, 29918, 710, 353, 851, 29898, 11227, 29918, 791, 29897, 13, 4706, 12747, 353, 518, 13, 9651, 6120, 29918, 791, 29918, 710, 29889, 21064, 3285, 13, 9651, 6120, 29918, 791, 29918, 710, 29889, 5030, 2410, 675, 3285, 13, 9651, 6120, 29918, 791, 29918, 710, 29889, 13609, 3285, 13, 9651, 6120, 29918, 791, 29918, 710, 29889, 26276, 4878, 3285, 13, 4706, 4514, 13, 4706, 363, 1423, 297, 12747, 29901, 13, 9651, 4974, 7605, 272, 9652, 5015, 29898, 4548, 29922, 3198, 467, 1688, 3319, 1800, 1275, 6120, 29918, 791, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 303, 29889, 3166, 29918, 13087, 29898, 276, 29889, 12198, 29898, 29878, 29908, 3823, 29879, 17710, 741, 1012, 29879, 29394, 29908, 4961, 13, 1678, 822, 1243, 29918, 1688, 29918, 5696, 29918, 275, 29918, 1333, 29918, 23149, 3321, 29918, 517, 29918, 1332, 3246, 3535, 29898, 11227, 29918, 791, 29918, 710, 29901, 851, 1125, 13, 4706, 9995, 5596, 393, 1243, 338, 451, 20502, 304, 24358, 18830, 1962, 15945, 29908, 13, 13, 4706, 363, 3806, 297, 518, 5574, 29892, 7700, 5387, 13, 9651, 1518, 353, 6120, 29918, 791, 29918, 710, 29889, 4830, 29898, 710, 29898, 9684, 876, 13, 9651, 4974, 7605, 272, 9652, 5015, 29898, 4548, 29922, 4548, 467, 1688, 3319, 1800, 1275, 3806, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 13, 4706, 6120, 29918, 791, 29879, 29922, 303, 29889, 21513, 29898, 303, 29889, 833, 1772, 550, 3285, 1375, 29918, 2311, 29922, 29946, 29892, 4236, 29918, 2311, 29922, 29946, 511, 13, 4706, 14884, 29922, 10184, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 3285, 13, 1678, 1723, 13, 1678, 822, 1243, 29918, 1688, 29918, 5696, 29918, 3068, 29918, 22492, 12356, 29918, 262, 29918, 7039, 29918, 392, 29918, 14513, 29918, 4548, 29898, 13, 4706, 6120, 29918, 791, 29879, 29901, 260, 29889, 1293, 29961, 11227, 1402, 13, 4706, 14884, 29901, 260, 29889, 23215, 552, 29961, 29076, 29892, 6189, 1402, 13, 4706, 1601, 446, 1478, 905, 29892, 13, 268, 1125, 13, 4706, 9995, 5596, 393, 1243, 508, 23764, 11764, 2582, 964, 385, 1518, 1213, 15945, 13, 13, 4706, 396, 3872, 29915, 29873, 1073, 920, 304, 11200, 5706, 1438, 29892, 13, 4706, 396, 577, 925, 671, 263, 2898, 29659, 697, 13, 4706, 1518, 353, 313, 13, 9651, 376, 18255, 565, 313, 978, 322, 25161, 29897, 470, 3190, 470, 5825, 15493, 1565, 376, 13, 9651, 376, 18255, 1683, 15493, 2089, 18674, 1095, 361, 1273, 5038, 13, 4706, 1723, 13, 4706, 11764, 29918, 9902, 353, 9657, 29898, 13, 9651, 14319, 29898, 3366, 978, 613, 376, 771, 4924, 613, 376, 1279, 613, 376, 8628, 12436, 6120, 29918, 791, 29879, 29897, 13, 4706, 1723, 13, 13, 4706, 822, 11187, 29918, 1688, 29898, 3383, 11764, 29918, 5975, 29901, 260, 29889, 21533, 29961, 710, 29892, 6120, 29962, 1125, 13, 9651, 9995, 18680, 1243, 1158, 304, 1423, 3806, 1881, 15945, 29908, 13, 9651, 4974, 11764, 29918, 5975, 1275, 11764, 29918, 9902, 13, 13, 4706, 1601, 446, 1478, 905, 29889, 842, 5552, 29898, 10378, 9652, 5015, 29892, 376, 1688, 613, 11187, 29918, 1688, 29897, 13, 13, 4706, 1831, 943, 353, 5159, 13, 4706, 4933, 29918, 650, 29892, 4933, 29918, 10184, 353, 14884, 13, 4706, 363, 11764, 29918, 978, 29892, 6120, 29918, 791, 297, 11764, 29918, 9902, 29889, 7076, 7295, 13, 9651, 11764, 353, 6189, 10378, 29898, 13, 18884, 1134, 543, 735, 627, 613, 13, 18884, 1024, 29922, 14357, 29918, 978, 29892, 13, 18884, 12421, 29922, 14357, 29918, 978, 29892, 13, 18884, 659, 29922, 657, 5552, 29898, 13, 462, 1678, 4933, 29918, 650, 565, 6120, 29918, 791, 1683, 4933, 29918, 10184, 29892, 11764, 29918, 978, 13, 18884, 10353, 13, 9651, 1723, 13, 9651, 1831, 943, 29889, 4397, 29898, 14357, 29897, 13, 13, 4706, 7605, 272, 9652, 5015, 29898, 4548, 29922, 4548, 467, 7302, 29898, 23523, 29918, 650, 29892, 1831, 943, 29897, 13, 13, 13, 1990, 4321, 29076, 4782, 2697, 29901, 13, 1678, 9995, 3057, 9863, 310, 363, 11422, 29880, 568, 29889, 23523, 29889, 29076, 4782, 2697, 15945, 29908, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 29887, 5428, 29898, 10184, 29918, 13092, 29918, 29885, 496, 1475, 29918, 710, 8963, 3101, 13, 1678, 822, 1243, 29918, 4572, 29918, 18280, 29918, 15728, 29918, 842, 29918, 974, 29918, 2972, 29918, 29885, 1590, 10475, 29898, 13, 4706, 14884, 29901, 260, 29889, 23215, 552, 29961, 29076, 29892, 6189, 29962, 13, 268, 1125, 13, 4706, 9995, 3057, 4175, 3639, 278, 6471, 263, 4933, 338, 263, 760, 310, 1213, 15945, 13, 13, 4706, 4933, 29918, 650, 29892, 4933, 29918, 10184, 353, 14884, 13, 4706, 4933, 29918, 650, 29918, 5552, 29879, 353, 4933, 29918, 650, 29889, 8977, 2141, 7076, 580, 13, 4706, 4933, 29918, 10184, 29918, 5552, 29879, 353, 4933, 29918, 10184, 29889, 8977, 2141, 7076, 580, 13, 4706, 1716, 29918, 5552, 29879, 353, 518, 29930, 23523, 29918, 650, 29918, 5552, 29879, 29892, 334, 23523, 29918, 10184, 29918, 5552, 29879, 29962, 13, 4706, 6471, 353, 518, 13, 9651, 6189, 4782, 29898, 13, 18884, 1024, 543, 2972, 29918, 650, 613, 13, 18884, 1831, 943, 11759, 13, 462, 1678, 6189, 10378, 29898, 1853, 543, 735, 627, 613, 12421, 29922, 5552, 29892, 659, 29922, 791, 29897, 13, 462, 1678, 363, 12421, 29892, 659, 297, 4933, 29918, 650, 29918, 5552, 29879, 13, 18884, 21251, 13, 9651, 10353, 13, 9651, 6189, 4782, 29898, 13, 18884, 1024, 543, 2972, 29918, 10184, 613, 13, 18884, 1831, 943, 11759, 13, 462, 1678, 6189, 10378, 29898, 1853, 543, 735, 627, 613, 12421, 29922, 5552, 29892, 659, 29922, 791, 29897, 13, 462, 1678, 363, 12421, 29892, 659, 297, 4933, 29918, 10184, 29918, 5552, 29879, 13, 18884, 21251, 13, 9651, 10353, 13, 9651, 6189, 4782, 29898, 13, 18884, 1024, 543, 2972, 29918, 17536, 613, 13, 18884, 1831, 943, 11759, 13, 462, 1678, 6189, 10378, 29898, 13, 462, 4706, 1024, 29922, 710, 29898, 29875, 511, 1134, 543, 735, 627, 613, 12421, 29922, 5552, 29892, 659, 29922, 791, 13, 462, 1678, 1723, 13, 462, 1678, 363, 474, 29892, 313, 5552, 29892, 659, 29897, 297, 26985, 29898, 20313, 29918, 5552, 29879, 29897, 13, 18884, 21251, 13, 18884, 396, 674, 451, 1993, 1951, 1438, 526, 599, 322, 29899, 287, 4208, 13, 18884, 1993, 29918, 710, 29922, 10378, 9652, 5015, 29898, 13, 462, 1678, 1518, 10724, 29995, 565, 376, 13, 462, 1678, 718, 376, 322, 11393, 7122, 29898, 1958, 29898, 710, 29892, 3464, 29898, 2435, 29898, 20313, 29918, 5552, 29879, 13697, 13, 462, 1678, 718, 11860, 29913, 5852, 18674, 1683, 15493, 7700, 18674, 1095, 361, 1273, 5038, 13, 18884, 10353, 13, 9651, 10353, 13, 4706, 4514, 13, 4706, 4933, 29918, 2972, 29918, 842, 353, 6189, 4782, 2697, 29898, 13155, 29922, 13155, 29897, 13, 4706, 697, 29918, 13155, 353, 4933, 29918, 2972, 29918, 842, 29889, 4572, 29898, 23523, 29918, 650, 29897, 13, 4706, 1023, 29918, 13155, 353, 4933, 29918, 2972, 29918, 842, 29889, 4572, 29898, 23523, 29918, 10184, 29897, 13, 4706, 4974, 7431, 29898, 650, 29918, 13155, 29897, 1275, 29871, 29896, 13, 4706, 4974, 7431, 29898, 10184, 29918, 13155, 29897, 1275, 29871, 29896, 13, 4706, 4974, 697, 29918, 13155, 29961, 29900, 1822, 978, 1275, 376, 2972, 29918, 650, 29908, 13, 4706, 4974, 1023, 29918, 13155, 29961, 29900, 1822, 978, 1275, 376, 2972, 29918, 10184, 29908, 13, 2 ]
solutions/solution165.py
Satily/leetcode_python_solution
3
174011
from itertools import zip_longest class Solution: def compareVersion(self, version1: str, version2: str) -> int: for v1n, v2n in zip_longest(map(int, version1.split('.')), map(int, version2.split('.')), fillvalue=0): if v1n > v2n: return 1 elif v1n < v2n: return -1 return 0 if __name__ == '__main__': print(Solution().compareVersion(version1="1.01", version2="1.001")) print(Solution().compareVersion(version1="1.0", version2="1.0.0")) print(Solution().compareVersion(version1="0.1", version2="1.1")) print(Solution().compareVersion(version1="1.0.1", version2="1")) print(Solution().compareVersion(version1="7.5.2.4", version2="7.5.3"))
[ 1, 515, 4256, 8504, 1053, 14319, 29918, 5426, 342, 30004, 13, 30004, 13, 30004, 13, 1990, 24380, 29901, 30004, 13, 1678, 822, 7252, 6594, 29898, 1311, 29892, 1873, 29896, 29901, 851, 29892, 1873, 29906, 29901, 851, 29897, 1599, 938, 29901, 30004, 13, 4706, 363, 325, 29896, 29876, 29892, 325, 29906, 29876, 297, 14319, 29918, 5426, 342, 29898, 1958, 29898, 524, 29892, 1873, 29896, 29889, 5451, 12839, 1495, 511, 2910, 29898, 524, 29892, 1873, 29906, 29889, 5451, 12839, 1495, 511, 5445, 1767, 29922, 29900, 1125, 30004, 13, 9651, 565, 325, 29896, 29876, 1405, 325, 29906, 29876, 29901, 30004, 13, 18884, 736, 29871, 29896, 30004, 13, 9651, 25342, 325, 29896, 29876, 529, 325, 29906, 29876, 29901, 30004, 13, 18884, 736, 448, 29896, 30004, 13, 4706, 736, 29871, 29900, 30004, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 1678, 1596, 29898, 13296, 918, 2141, 18307, 6594, 29898, 3259, 29896, 543, 29896, 29889, 29900, 29896, 613, 1873, 29906, 543, 29896, 29889, 29900, 29900, 29896, 5783, 30004, 13, 1678, 1596, 29898, 13296, 918, 2141, 18307, 6594, 29898, 3259, 29896, 543, 29896, 29889, 29900, 613, 1873, 29906, 543, 29896, 29889, 29900, 29889, 29900, 5783, 30004, 13, 1678, 1596, 29898, 13296, 918, 2141, 18307, 6594, 29898, 3259, 29896, 543, 29900, 29889, 29896, 613, 1873, 29906, 543, 29896, 29889, 29896, 5783, 30004, 13, 1678, 1596, 29898, 13296, 918, 2141, 18307, 6594, 29898, 3259, 29896, 543, 29896, 29889, 29900, 29889, 29896, 613, 1873, 29906, 543, 29896, 5783, 30004, 13, 1678, 1596, 29898, 13296, 918, 2141, 18307, 6594, 29898, 3259, 29896, 543, 29955, 29889, 29945, 29889, 29906, 29889, 29946, 613, 1873, 29906, 543, 29955, 29889, 29945, 29889, 29941, 5783, 30004, 13, 2 ]
bzl/opam.bzl
obazl/orocksdb
0
54666
PACKAGES = { "ctypes": ["0.17.1", ["ctypes.foreign"]], "ctypes-foreign": ["0.4.0"], # WARNING: requires libffi-dev } opam = struct( version = "2.0", switches = { "mina-0.1.0": struct( default = True, compiler = "4.07.1", packages = PACKAGES ), "4.07.1": struct( compiler = "4.07.1", packages = PACKAGES ) } )
[ 1, 349, 11375, 10461, 29903, 353, 426, 13, 1678, 376, 312, 7384, 1115, 6796, 29900, 29889, 29896, 29955, 29889, 29896, 613, 6796, 312, 7384, 29889, 1079, 647, 3108, 1402, 13, 1678, 376, 312, 7384, 29899, 1079, 647, 1115, 6796, 29900, 29889, 29946, 29889, 29900, 12436, 396, 399, 25614, 29901, 6858, 4303, 600, 29875, 29899, 3359, 13, 29913, 13, 13, 459, 314, 353, 2281, 29898, 13, 1678, 1873, 353, 376, 29906, 29889, 29900, 613, 13, 1678, 4607, 267, 29871, 353, 426, 13, 4706, 376, 13257, 29899, 29900, 29889, 29896, 29889, 29900, 1115, 2281, 29898, 13, 9651, 2322, 29871, 353, 5852, 29892, 13, 9651, 6516, 353, 376, 29946, 29889, 29900, 29955, 29889, 29896, 613, 13, 9651, 9741, 353, 349, 11375, 10461, 29903, 13, 4706, 10353, 13, 4706, 376, 29946, 29889, 29900, 29955, 29889, 29896, 1115, 2281, 29898, 13, 9651, 6516, 353, 376, 29946, 29889, 29900, 29955, 29889, 29896, 613, 13, 9651, 9741, 353, 349, 11375, 10461, 29903, 13, 4706, 1723, 13, 1678, 500, 13, 29897, 13, 13, 2 ]
question_bank/find-majority-element-lcci/find-majority-element-lcci.py
yatengLG/leetcode-python
9
126055
# -*- coding: utf-8 -*- # @Author : LG """ 执行用时:48 ms, 在所有 Python3 提交中击败了83.86% 的用户 内存消耗:14.8 MB, 在所有 Python3 提交中击败了62.52% 解题思路: 对拼消耗,摩尔投票 时间复杂度为 O(N),空间复杂度为 O(1) 不同数字一一对拼消耗,如果有剩余,则存在主要元素(人数最多,且,人数在一半以上) 具体实现见代码注释 """ class Solution: def majorityElement(self, nums: List[int]) -> int: n = len(nums) major = nums[0] # 记录当前元素 count = 0 # 当前元素的出现次数统计 for i in range(n): if nums[i] == major: # 如果与当前元素相同,则次数+1 count += 1 else: # 不同,则对拼消耗,次数减一 count -= 1 if count == 0 and i < n-1: # 如果当前元素被消耗殆尽,当前元素指向下一个元素 major = nums[i+1] if count > 0: # 如果当前元素的统计次数大于0,则存在主要元素 return major else: # 否则,不存在 return -1
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 732, 13720, 29871, 584, 365, 29954, 13, 13, 15945, 29908, 13, 233, 140, 170, 30448, 30406, 30594, 30383, 29946, 29947, 10887, 29892, 29871, 30505, 30744, 30417, 5132, 29941, 29871, 31302, 31398, 30275, 31768, 31955, 30743, 29947, 29941, 29889, 29947, 29953, 29995, 29871, 30210, 30406, 31229, 13, 30728, 30946, 31276, 235, 131, 154, 30383, 29896, 29946, 29889, 29947, 13232, 29892, 29871, 30505, 30744, 30417, 5132, 29941, 29871, 31302, 31398, 30275, 31768, 31955, 30743, 29953, 29906, 29889, 29945, 29906, 29995, 13, 13, 31201, 31596, 31579, 30874, 30383, 13, 268, 30783, 233, 142, 191, 31276, 235, 131, 154, 30214, 233, 148, 172, 31814, 233, 141, 152, 234, 168, 171, 13, 268, 30594, 31016, 31810, 233, 160, 133, 30898, 30573, 438, 29898, 29940, 29897, 30214, 30816, 31016, 31810, 233, 160, 133, 30898, 30573, 438, 29898, 29896, 29897, 13, 268, 30413, 30980, 30354, 30578, 30287, 30287, 30783, 233, 142, 191, 31276, 235, 131, 154, 30214, 30847, 30801, 30417, 232, 140, 172, 231, 192, 156, 30214, 31403, 30946, 30505, 30888, 30698, 30824, 31605, 29898, 30313, 30354, 30878, 30923, 30214, 231, 187, 151, 30214, 30313, 30354, 30505, 30287, 232, 144, 141, 30651, 30429, 29897, 13, 268, 232, 136, 186, 30988, 31195, 31424, 235, 170, 132, 30690, 31183, 31368, 236, 138, 141, 13, 15945, 29908, 13, 1990, 24380, 29901, 13, 1678, 822, 13638, 2642, 29898, 1311, 29892, 954, 29879, 29901, 2391, 29961, 524, 2314, 1599, 938, 29901, 13, 4706, 302, 353, 7431, 29898, 1949, 29879, 29897, 13, 4706, 4655, 353, 954, 29879, 29961, 29900, 29962, 396, 29871, 31410, 31283, 30948, 30658, 30824, 31605, 13, 4706, 2302, 353, 29871, 29900, 259, 396, 29871, 30948, 30658, 30824, 31605, 30210, 30544, 31424, 30936, 30354, 31675, 31466, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 9651, 565, 954, 29879, 29961, 29875, 29962, 1275, 4655, 29901, 1678, 396, 29871, 30847, 30801, 31267, 30948, 30658, 30824, 31605, 30990, 30980, 30214, 31403, 30936, 30354, 29974, 29896, 13, 18884, 2302, 4619, 29871, 29896, 13, 9651, 1683, 29901, 259, 396, 29871, 30413, 30980, 30214, 31403, 30783, 233, 142, 191, 31276, 235, 131, 154, 30214, 30936, 30354, 232, 138, 146, 30287, 13, 18884, 2302, 22361, 29871, 29896, 13, 9651, 565, 2302, 1275, 29871, 29900, 322, 474, 529, 302, 29899, 29896, 29901, 29871, 396, 29871, 30847, 30801, 30948, 30658, 30824, 31605, 31407, 31276, 235, 131, 154, 233, 177, 137, 232, 179, 192, 30214, 30948, 30658, 30824, 31605, 31084, 31331, 30557, 30287, 30502, 30824, 31605, 13, 18884, 4655, 353, 954, 29879, 29961, 29875, 29974, 29896, 29962, 13, 13, 4706, 565, 2302, 1405, 29871, 29900, 29901, 259, 396, 29871, 30847, 30801, 30948, 30658, 30824, 31605, 30210, 31675, 31466, 30936, 30354, 30257, 30909, 29900, 30214, 31403, 30946, 30505, 30888, 30698, 30824, 31605, 13, 9651, 736, 4655, 13, 4706, 1683, 29901, 539, 396, 29871, 31191, 31403, 30214, 30413, 30946, 30505, 13, 9651, 736, 448, 29896, 2 ]
Happy vs Sad Face Classification/happy_vs_sad.py
DhruvAwasthi/ModelsCollection
2
170353
<reponame>DhruvAwasthi/ModelsCollection #!/usr/bin/env python # coding: utf-8 # Below is code with a link to a happy or sad dataset which contains 80 images, 40 happy and 40 sad. # Create a convolutional neural network that trains to 100% accuracy on these images, which cancels training upon hitting training accuracy of >.999 # # Hint -- it will work best with 3 convolutional layers. # In[1]: import tensorflow as tf import os import zipfile from os import path, getcwd, chdir get_ipython().system('wget --no-check-certificate "https://storage.googleapis.com/laurencemoroney-blog.appspot.com/happy-or-sad.zip" -O "/tmp/happy-or-sad.zip"') zip_ref = zipfile.ZipFile("/tmp/happy-or-sad.zip", 'r') zip_ref.extractall("/tmp/h-or-s") zip_ref.close() # In[18]: def train_happy_sad_model(): DESIRED_ACCURACY = 0.999 class myCallback(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, log={}): if (log.get('acc')>DESIRED_ACCURACY): print("\nAccuracy achieved {:.1f}% so cancelling training.".format(DESIRED_ACCURACY)) self.model.stop_training = True callbacks = myCallback() model = tf.keras.models.Sequential([ tf.keras.layers.Conv2D(8, (3, 3), activation='relu', input_shape=(150, 150, 3)), tf.keras.layers.MaxPooling2D(2, 2), tf.keras.layers.Conv2D(4, (3, 3), activation='relu'), tf.keras.layers.MaxPooling2D(2, 2), tf.keras.layers.Conv2D(4, (3, 3), activation='relu'), tf.keras.layers.MaxPooling2D(2, 2), tf.keras.layers.Flatten(), tf.keras.layers.Dense(8, activation='relu'), tf.keras.layers.Dense(1, activation='sigmoid') ]) model.summary() from tensorflow.keras.optimizers import RMSprop model.compile(optimizer=RMSprop(lr=0.001), loss='binary_crossentropy', metrics=['accuracy']) from tensorflow.keras.preprocessing.image import ImageDataGenerator train_datagen = ImageDataGenerator(rescale=1./255) # Please use a target_size of 150 X 150. train_generator = train_datagen.flow_from_directory( '/tmp/h-or-s', target_size=(150, 150), batch_size=128, class_mode='binary') history = model.fit_generator(train_generator, steps_per_epoch=8, epochs=15, verbose=1, callbacks=[callbacks]) # model fitting return history.history['acc'][-1] # In[19]: train_happy_sad_model()
[ 1, 529, 276, 1112, 420, 29958, 29928, 29882, 582, 29894, 29909, 11102, 386, 29875, 29914, 23785, 7196, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 13866, 338, 775, 411, 263, 1544, 304, 263, 9796, 470, 14610, 8783, 607, 3743, 29871, 29947, 29900, 4558, 29892, 29871, 29946, 29900, 9796, 322, 29871, 29946, 29900, 14610, 29889, 29871, 13, 29937, 6204, 263, 26851, 284, 19677, 3564, 393, 22983, 304, 29871, 29896, 29900, 29900, 29995, 13600, 373, 1438, 4558, 29892, 29871, 607, 508, 29883, 1379, 6694, 2501, 29425, 6694, 13600, 310, 1405, 29889, 29929, 29929, 29929, 13, 29937, 29871, 13, 29937, 379, 524, 1192, 372, 674, 664, 1900, 411, 29871, 29941, 26851, 284, 15359, 29889, 13, 13, 29937, 512, 29961, 29896, 5387, 13, 13, 13, 5215, 26110, 408, 15886, 13, 5215, 2897, 13, 5215, 14319, 1445, 13, 3166, 2897, 1053, 2224, 29892, 679, 29883, 9970, 29892, 521, 3972, 13, 13, 657, 29918, 666, 1656, 2141, 5205, 877, 29893, 657, 1192, 1217, 29899, 3198, 29899, 6327, 8021, 268, 376, 991, 597, 12925, 29889, 15947, 29889, 510, 29914, 433, 332, 3977, 28927, 4992, 29899, 7312, 29889, 932, 17500, 29889, 510, 29914, 29882, 14862, 29899, 272, 29899, 29879, 328, 29889, 7554, 29908, 268, 448, 29949, 5591, 7050, 29914, 29882, 14862, 29899, 272, 29899, 29879, 328, 29889, 7554, 29908, 1495, 13, 13, 7554, 29918, 999, 353, 14319, 1445, 29889, 26264, 2283, 11974, 7050, 29914, 29882, 14862, 29899, 272, 29899, 29879, 328, 29889, 7554, 613, 525, 29878, 1495, 13, 7554, 29918, 999, 29889, 21111, 497, 11974, 7050, 29914, 29882, 29899, 272, 29899, 29879, 1159, 13, 7554, 29918, 999, 29889, 5358, 580, 13, 13, 13, 29937, 512, 29961, 29896, 29947, 5387, 13, 13, 13, 1753, 7945, 29918, 29882, 14862, 29918, 29879, 328, 29918, 4299, 7295, 13, 1678, 18539, 29902, 19386, 29918, 2477, 22484, 2477, 29979, 353, 29871, 29900, 29889, 29929, 29929, 29929, 13, 13, 1678, 770, 590, 10717, 29898, 13264, 29889, 3946, 294, 29889, 14035, 29879, 29889, 10717, 1125, 13, 4706, 822, 373, 29918, 1022, 2878, 29918, 355, 29898, 1311, 29892, 21502, 305, 29892, 1480, 3790, 29913, 1125, 13, 9651, 565, 313, 1188, 29889, 657, 877, 5753, 1495, 29958, 2287, 5425, 19386, 29918, 2477, 22484, 2477, 29979, 1125, 13, 18884, 1596, 14182, 29876, 7504, 332, 4135, 14363, 12365, 29889, 29896, 29888, 10560, 577, 508, 3729, 292, 6694, 1213, 29889, 4830, 29898, 2287, 5425, 19386, 29918, 2477, 22484, 2477, 29979, 876, 13, 18884, 1583, 29889, 4299, 29889, 9847, 29918, 26495, 353, 5852, 13, 13, 1678, 6939, 29879, 353, 590, 10717, 580, 13, 268, 13, 1678, 1904, 353, 15886, 29889, 3946, 294, 29889, 9794, 29889, 16941, 2556, 4197, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 1168, 29894, 29906, 29928, 29898, 29947, 29892, 313, 29941, 29892, 29871, 29941, 511, 26229, 2433, 2674, 29884, 742, 1881, 29918, 12181, 7607, 29896, 29945, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29941, 8243, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 7976, 11426, 292, 29906, 29928, 29898, 29906, 29892, 29871, 29906, 511, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 1168, 29894, 29906, 29928, 29898, 29946, 29892, 313, 29941, 29892, 29871, 29941, 511, 26229, 2433, 2674, 29884, 5477, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 7976, 11426, 292, 29906, 29928, 29898, 29906, 29892, 29871, 29906, 511, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 1168, 29894, 29906, 29928, 29898, 29946, 29892, 313, 29941, 29892, 29871, 29941, 511, 26229, 2433, 2674, 29884, 5477, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 7976, 11426, 292, 29906, 29928, 29898, 29906, 29892, 29871, 29906, 511, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 29943, 5066, 841, 3285, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 29928, 1947, 29898, 29947, 29892, 26229, 2433, 2674, 29884, 5477, 13, 4706, 15886, 29889, 3946, 294, 29889, 29277, 29889, 29928, 1947, 29898, 29896, 29892, 26229, 2433, 18816, 29885, 3398, 1495, 13, 268, 2314, 13, 268, 13, 1678, 1904, 29889, 7727, 580, 13, 268, 13, 1678, 515, 26110, 29889, 3946, 294, 29889, 20640, 19427, 1053, 390, 4345, 7728, 13, 13, 1678, 1904, 29889, 12198, 29898, 20640, 3950, 29922, 29934, 4345, 7728, 29898, 29212, 29922, 29900, 29889, 29900, 29900, 29896, 511, 6410, 2433, 19541, 29918, 19128, 296, 14441, 742, 21556, 29922, 1839, 562, 2764, 4135, 11287, 13, 308, 13, 13, 1678, 515, 26110, 29889, 3946, 294, 29889, 1457, 19170, 29889, 3027, 1053, 7084, 1469, 21575, 13, 13, 1678, 7945, 29918, 4130, 5370, 353, 7084, 1469, 21575, 29898, 690, 29883, 744, 29922, 29896, 6904, 29906, 29945, 29945, 29897, 13, 13, 1678, 396, 3529, 671, 263, 3646, 29918, 2311, 310, 29871, 29896, 29945, 29900, 1060, 29871, 29896, 29945, 29900, 29889, 13, 1678, 7945, 29918, 27959, 353, 7945, 29918, 4130, 5370, 29889, 1731, 29918, 3166, 29918, 12322, 29898, 13, 4706, 8207, 7050, 29914, 29882, 29899, 272, 29899, 29879, 742, 13, 4706, 3646, 29918, 2311, 7607, 29896, 29945, 29900, 29892, 29871, 29896, 29945, 29900, 511, 13, 4706, 9853, 29918, 2311, 29922, 29896, 29906, 29947, 29892, 13, 4706, 770, 29918, 8513, 2433, 19541, 1495, 13, 13, 1678, 4955, 353, 1904, 29889, 9202, 29918, 27959, 29898, 14968, 29918, 27959, 29892, 6576, 29918, 546, 29918, 1022, 2878, 29922, 29947, 29892, 21502, 12168, 29922, 29896, 29945, 29892, 26952, 29922, 29896, 29892, 6939, 29879, 11759, 14035, 29879, 2314, 13, 1678, 396, 1904, 28221, 13, 1678, 736, 4955, 29889, 18434, 1839, 5753, 2033, 14352, 29896, 29962, 13, 13, 13, 29937, 512, 29961, 29896, 29929, 5387, 13, 13, 13, 14968, 29918, 29882, 14862, 29918, 29879, 328, 29918, 4299, 580, 13, 13, 2 ]
ncbi/patric_add_taxonomy.py
johned0/EdwardsLab
0
29416
""" Add the taxonomy to the patric metadata file """ import os import sys import argparse from taxon import get_taxonomy_db, get_taxonomy c = get_taxonomy_db() if __name__ == '__main__': parser = argparse.ArgumentParser(description="Append taxonomy to the patric metadata file. This adds it at column 67") parser.add_argument('-f', help='patric metadata file', required=True) parser.add_argument('-o', help='output file', required=True) parser.add_argument('-c', help='taxonomy ID column', required=True, type=int) parser.add_argument('-t', help='taxonomy directory (or we will use default)') parser.add_argument('-v', help='verbose output', action="store_true") args = parser.parse_args() want = ['superkingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species'] # read the file once to figure out the longest line maxp=0 with open(args.f, 'r', encoding='utf-8') as f: for l in f: p = l.strip().split("\t") if len(p) > maxp: maxp = len(p) with open(args.o, 'w', encoding='utf-8') as out: with open(args.f, 'r', encoding='utf-8') as f: for l in f: p = l.strip().split("\t") while (len(p) < maxp): p.append("") if l.startswith("genome_id"): out.write("{}\t{}\n".format(l.strip(), "\t".join(want))) continue tid = p[args.c] level = {} t, n = get_taxonomy(tid, c) while t and t.parent > 1 and t.parent != 131567: # 131567 is cellular organisms if t.rank in want: level[t.rank] = n.scientific_name t, n = get_taxonomy(t.parent, c) for w in want: if w in level: p.append(level[w]) else: p.append("") out.write("\t".join(map(str, p))) out.write("\n")
[ 1, 9995, 13, 2528, 278, 8818, 21926, 304, 278, 2373, 2200, 15562, 934, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 1852, 5510, 13, 3166, 8818, 265, 1053, 679, 29918, 20725, 21926, 29918, 2585, 29892, 679, 29918, 20725, 21926, 13, 13, 29883, 353, 679, 29918, 20725, 21926, 29918, 2585, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 543, 18277, 8818, 21926, 304, 278, 2373, 2200, 15562, 934, 29889, 910, 12778, 372, 472, 1897, 29871, 29953, 29955, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29888, 742, 1371, 2433, 5031, 2200, 15562, 934, 742, 3734, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29877, 742, 1371, 2433, 4905, 934, 742, 3734, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29883, 742, 1371, 2433, 20725, 21926, 3553, 1897, 742, 3734, 29922, 5574, 29892, 1134, 29922, 524, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29873, 742, 1371, 2433, 20725, 21926, 3884, 313, 272, 591, 674, 671, 2322, 29897, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29894, 742, 1371, 2433, 369, 15828, 1962, 742, 3158, 543, 8899, 29918, 3009, 1159, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 864, 353, 6024, 9136, 9292, 3129, 742, 525, 561, 2904, 398, 742, 525, 1990, 742, 525, 2098, 742, 525, 11922, 742, 525, 1885, 375, 742, 525, 24091, 2033, 13, 13, 1678, 396, 1303, 278, 934, 2748, 304, 4377, 714, 278, 27217, 1196, 13, 1678, 4236, 29886, 29922, 29900, 13, 1678, 411, 1722, 29898, 5085, 29889, 29888, 29892, 525, 29878, 742, 8025, 2433, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 4706, 363, 301, 297, 285, 29901, 13, 9651, 282, 353, 301, 29889, 17010, 2141, 5451, 14182, 29873, 1159, 13, 9651, 565, 7431, 29898, 29886, 29897, 1405, 4236, 29886, 29901, 13, 18884, 4236, 29886, 353, 7431, 29898, 29886, 29897, 13, 13, 1678, 411, 1722, 29898, 5085, 29889, 29877, 29892, 525, 29893, 742, 8025, 2433, 9420, 29899, 29947, 1495, 408, 714, 29901, 29871, 13, 4706, 411, 1722, 29898, 5085, 29889, 29888, 29892, 525, 29878, 742, 8025, 2433, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 9651, 363, 301, 297, 285, 29901, 13, 18884, 282, 353, 301, 29889, 17010, 2141, 5451, 14182, 29873, 1159, 13, 18884, 1550, 313, 2435, 29898, 29886, 29897, 529, 4236, 29886, 1125, 13, 462, 1678, 282, 29889, 4397, 703, 1159, 13, 13, 18884, 565, 301, 29889, 27382, 2541, 703, 1885, 608, 29918, 333, 29908, 1125, 13, 462, 1678, 714, 29889, 3539, 703, 29912, 1012, 29873, 29912, 1012, 29876, 1642, 4830, 29898, 29880, 29889, 17010, 3285, 6634, 29873, 1642, 7122, 29898, 29893, 424, 4961, 13, 462, 1678, 6773, 13, 13, 18884, 10668, 353, 282, 29961, 5085, 29889, 29883, 29962, 13, 13, 18884, 3233, 353, 6571, 13, 13, 18884, 260, 29892, 302, 353, 679, 29918, 20725, 21926, 29898, 17681, 29892, 274, 29897, 13, 13, 18884, 1550, 260, 322, 260, 29889, 3560, 1405, 29871, 29896, 322, 260, 29889, 3560, 2804, 29871, 29896, 29941, 29896, 29945, 29953, 29955, 29901, 13, 462, 1678, 396, 29871, 29896, 29941, 29896, 29945, 29953, 29955, 338, 3038, 1070, 2894, 12903, 13, 462, 1678, 565, 260, 29889, 10003, 297, 864, 29901, 13, 462, 4706, 3233, 29961, 29873, 29889, 10003, 29962, 353, 302, 29889, 29879, 15566, 928, 29918, 978, 13, 462, 1678, 260, 29892, 302, 353, 679, 29918, 20725, 21926, 29898, 29873, 29889, 3560, 29892, 274, 29897, 13, 13, 18884, 363, 281, 297, 864, 29901, 13, 462, 1678, 565, 281, 297, 3233, 29901, 13, 462, 4706, 282, 29889, 4397, 29898, 5563, 29961, 29893, 2314, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 282, 29889, 4397, 703, 1159, 13, 13, 18884, 714, 29889, 3539, 14182, 29873, 1642, 7122, 29898, 1958, 29898, 710, 29892, 282, 4961, 13, 18884, 714, 29889, 3539, 14182, 29876, 1159, 13, 2 ]
test/unittests/chemical/building_blocks/aminoacids.py
Alexhuszagh/XLDiscoverer
0
31328
<filename>test/unittests/chemical/building_blocks/aminoacids.py ''' Unittests/Chemical/Building_Blocks/aminoacids _____________________________________________ Unit tests for aminoacid lookups. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' # load modules/submodules import unittest from xldlib.chemical.building_blocks import aminoacids # CASES # ----- class AminoAcidTest(unittest.TestCase): '''Test aminoacid lookups''' def test_mixed_case(self): '''Test mixed-case lookups produce the same object''' lower = aminoacids.AMINOACIDS['a'] upper = aminoacids.AMINOACIDS['A'] self.assertEquals(id(lower), id(upper)) self.assertEquals(lower, upper) assert 'a' in aminoacids.AMINOACIDS assert 'A' in aminoacids.AMINOACIDS # TESTS # ----- def add_tests(suite): '''Add tests to the unittest suite''' suite.addTest(AminoAcidTest('test_mixed_case'))
[ 1, 529, 9507, 29958, 1688, 29914, 348, 986, 9197, 29914, 14969, 936, 29914, 25237, 29918, 1271, 29879, 29914, 314, 1789, 562, 4841, 29889, 2272, 13, 12008, 13, 1678, 853, 986, 9197, 29914, 1451, 331, 936, 29914, 8893, 292, 29918, 7445, 29879, 29914, 314, 1789, 562, 4841, 13, 1678, 903, 27097, 27097, 14365, 7652, 13, 13, 1678, 13223, 6987, 363, 626, 1789, 562, 333, 1106, 14340, 29889, 13, 13, 1678, 584, 8552, 1266, 29901, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 450, 2169, 1237, 310, 278, 3014, 310, 8046, 29889, 13, 1678, 584, 506, 1947, 29901, 15143, 402, 7390, 29892, 1074, 7794, 11259, 29914, 29954, 11601, 402, 7390, 29894, 29941, 29889, 3945, 363, 901, 4902, 29889, 13, 12008, 13, 13, 29937, 2254, 10585, 29914, 1491, 7576, 13, 5215, 443, 27958, 13, 13, 3166, 921, 430, 1982, 29889, 14969, 936, 29889, 25237, 29918, 1271, 29879, 1053, 626, 1789, 562, 4841, 13, 13, 13, 29937, 29134, 29903, 13, 29937, 448, 807, 13, 13, 13, 1990, 319, 1195, 29877, 10644, 333, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 14550, 3057, 626, 1789, 562, 333, 1106, 14340, 12008, 13, 13, 1678, 822, 1243, 29918, 29885, 11925, 29918, 4878, 29898, 1311, 1125, 13, 4706, 14550, 3057, 12849, 29899, 4878, 1106, 14340, 7738, 278, 1021, 1203, 12008, 13, 13, 4706, 5224, 353, 626, 1789, 562, 4841, 29889, 5194, 1177, 29949, 2477, 1367, 29903, 1839, 29874, 2033, 13, 4706, 7568, 353, 626, 1789, 562, 4841, 29889, 5194, 1177, 29949, 2477, 1367, 29903, 1839, 29909, 2033, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 333, 29898, 13609, 511, 1178, 29898, 21064, 876, 13, 4706, 1583, 29889, 9294, 14776, 29898, 13609, 29892, 7568, 29897, 13, 13, 4706, 4974, 525, 29874, 29915, 297, 626, 1789, 562, 4841, 29889, 5194, 1177, 29949, 2477, 1367, 29903, 13, 4706, 4974, 525, 29909, 29915, 297, 626, 1789, 562, 4841, 29889, 5194, 1177, 29949, 2477, 1367, 29903, 13, 13, 13, 29937, 17067, 1254, 29903, 13, 29937, 448, 807, 13, 13, 13, 1753, 788, 29918, 21150, 29898, 13495, 1125, 13, 1678, 14550, 2528, 6987, 304, 278, 443, 27958, 9460, 12008, 13, 13, 1678, 9460, 29889, 1202, 3057, 29898, 29909, 1195, 29877, 10644, 333, 3057, 877, 1688, 29918, 29885, 11925, 29918, 4878, 8785, 13, 2 ]
students/K33402/Beresnev_Andrey/practical2.1/django_project_beresnev/project_first_app/urls.py
agentofknowledge/ITMO_ICT_WebDevelopment_2020-2021
4
58521
from django.urls import path from . import views urlpatterns = [ path('owner/<int:owner_id>', views.index), ]
[ 1, 515, 9557, 29889, 26045, 1053, 2224, 13, 3166, 869, 1053, 8386, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 2224, 877, 20348, 29914, 29966, 524, 29901, 20348, 29918, 333, 29958, 742, 8386, 29889, 2248, 511, 13, 29962, 13, 2 ]
pyroomacoustics/experimental/tests/test_deconvolution.py
HemaZ/pyroomacoustics
1
12796
<filename>pyroomacoustics/experimental/tests/test_deconvolution.py<gh_stars>1-10 from unittest import TestCase import numpy as np from scipy.signal import fftconvolve import pyroomacoustics as pra # fix seed for repeatability np.random.seed(0) h_len = 30 x_len = 1000 SNR = 1000. # decibels h_lp = np.fft.irfft(np.ones(5), n=h_len) h_rand = np.random.randn(h_len) h_hann = pra.hann(h_len, flag='symmetric') x = np.random.randn(x_len) noise = np.random.randn(x_len + h_len - 1) def generate_signals(SNR, x, h, noise): ''' run convolution ''' # noise standard deviation sigma_noise = 10**(-SNR / 20.) y = fftconvolve(x, h) y += sigma_noise * noise return y, sigma_noise class TestDeconvolution(TestCase): def test_deconvolve_hann_noiseless(self): h = h_hann h_len = h_hann.shape[0] SNR = 1000. tol = 1e-7 y, sigma_noise = generate_signals(SNR, x, h, noise) h_hat = pra.experimental.deconvolve(y, x, length=h_len) rmse = np.sqrt(np.linalg.norm(h_hat - h)**2 / h_len) print('rmse=', rmse, '(tol=', tol, ')') self.assertTrue(rmse < tol) def test_wiener_deconvolve_hann_noiseless(self): h = h_hann h_len = h_hann.shape[0] SNR = 1000. tol = 1e-7 y, sigma_noise = generate_signals(SNR, x, h, noise) h_hat = pra.experimental.wiener_deconvolve(y, x, length=h_len, noise_variance=sigma_noise**2) rmse = np.sqrt(np.linalg.norm(h_hat - h)**2 / h_len) print('rmse=', rmse, '(tol=', tol, ')') self.assertTrue(rmse < tol) if __name__ == '__main__': import matplotlib.pyplot as plt h = h_hann y, sigma_noise = generate_signals(SNR, x, h, noise) h_hat1 = pra.experimental.deconvolve(y, x, length=h_len) res1 = np.linalg.norm(y - fftconvolve(x, h_hat1))**2 / y.shape[0] mse1 = np.linalg.norm(h_hat1 - h)**2 / h_len h_hat2 = pra.experimental.wiener_deconvolve(y, x, length=h_len, noise_variance=sigma_noise**2, let_n_points=15) res2 = np.linalg.norm(y - fftconvolve(x, h_hat2))**2 / y.shape[0] mse2 = np.linalg.norm(h_hat2 - h)**2 / h_len print('MSE naive: rmse=', np.sqrt(mse1), ' res=', pra.dB(res1, power=True)) print('MSE Wiener: rmse=', np.sqrt(mse2), ' res=', pra.dB(res1, power=True)) plt.plot(h) plt.plot(h_hat1) plt.plot(h_hat2) plt.legend(['Original', 'Naive', 'Wiener']) plt.show()
[ 1, 529, 9507, 29958, 2272, 8345, 562, 18291, 1199, 29914, 735, 27910, 29914, 21150, 29914, 1688, 29918, 311, 535, 4068, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 5215, 12655, 408, 7442, 13, 3166, 4560, 2272, 29889, 25436, 1053, 285, 615, 535, 1555, 345, 13, 13, 5215, 11451, 8345, 562, 18291, 1199, 408, 7213, 13, 13, 29937, 2329, 16717, 363, 12312, 3097, 13, 9302, 29889, 8172, 29889, 26776, 29898, 29900, 29897, 13, 13, 29882, 29918, 2435, 353, 29871, 29941, 29900, 13, 29916, 29918, 2435, 353, 29871, 29896, 29900, 29900, 29900, 13, 29903, 16514, 353, 29871, 29896, 29900, 29900, 29900, 29889, 29871, 396, 316, 455, 29890, 1379, 13, 13, 29882, 29918, 22833, 353, 7442, 29889, 600, 29873, 29889, 381, 600, 29873, 29898, 9302, 29889, 2873, 29898, 29945, 511, 302, 29922, 29882, 29918, 2435, 29897, 13, 29882, 29918, 9502, 353, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 29882, 29918, 2435, 29897, 13, 29882, 29918, 29882, 812, 353, 7213, 29889, 29882, 812, 29898, 29882, 29918, 2435, 29892, 7353, 2433, 11967, 16414, 1495, 13, 13, 29916, 353, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 29916, 29918, 2435, 29897, 13, 1217, 895, 353, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 29916, 29918, 2435, 718, 298, 29918, 2435, 448, 29871, 29896, 29897, 13, 13, 1753, 5706, 29918, 4530, 1338, 29898, 29903, 16514, 29892, 921, 29892, 298, 29892, 11462, 1125, 13, 1678, 14550, 1065, 26851, 14550, 13, 13, 1678, 396, 11462, 3918, 29522, 13, 1678, 269, 2934, 29918, 1217, 895, 353, 29871, 29896, 29900, 1068, 6278, 29903, 16514, 847, 29871, 29906, 29900, 1846, 13, 13, 1678, 343, 353, 285, 615, 535, 1555, 345, 29898, 29916, 29892, 298, 29897, 29871, 13, 1678, 343, 4619, 269, 2934, 29918, 1217, 895, 334, 11462, 13, 13, 1678, 736, 343, 29892, 269, 2934, 29918, 1217, 895, 13, 13, 1990, 4321, 2772, 535, 4068, 29898, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 311, 535, 1555, 345, 29918, 29882, 812, 29918, 1217, 275, 6393, 29898, 1311, 1125, 13, 13, 4706, 298, 353, 298, 29918, 29882, 812, 13, 4706, 298, 29918, 2435, 353, 298, 29918, 29882, 812, 29889, 12181, 29961, 29900, 29962, 13, 4706, 317, 16514, 353, 29871, 29896, 29900, 29900, 29900, 29889, 13, 4706, 304, 29880, 353, 29871, 29896, 29872, 29899, 29955, 13, 13, 4706, 343, 29892, 269, 2934, 29918, 1217, 895, 353, 5706, 29918, 4530, 1338, 29898, 29903, 16514, 29892, 921, 29892, 298, 29892, 11462, 29897, 13, 13, 4706, 298, 29918, 2455, 353, 7213, 29889, 735, 27910, 29889, 311, 535, 1555, 345, 29898, 29891, 29892, 921, 29892, 3309, 29922, 29882, 29918, 2435, 29897, 13, 4706, 20241, 344, 353, 7442, 29889, 3676, 29898, 9302, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29882, 29918, 2455, 448, 298, 29897, 1068, 29906, 847, 298, 29918, 2435, 29897, 13, 13, 4706, 1596, 877, 1758, 344, 29922, 742, 20241, 344, 29892, 525, 29898, 25027, 29922, 742, 304, 29880, 29892, 25710, 1495, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1758, 344, 529, 304, 29880, 29897, 13, 13, 1678, 822, 1243, 29918, 4353, 759, 29918, 311, 535, 1555, 345, 29918, 29882, 812, 29918, 1217, 275, 6393, 29898, 1311, 1125, 13, 13, 4706, 298, 353, 298, 29918, 29882, 812, 13, 4706, 298, 29918, 2435, 353, 298, 29918, 29882, 812, 29889, 12181, 29961, 29900, 29962, 13, 4706, 317, 16514, 353, 29871, 29896, 29900, 29900, 29900, 29889, 13, 4706, 304, 29880, 353, 29871, 29896, 29872, 29899, 29955, 13, 13, 4706, 343, 29892, 269, 2934, 29918, 1217, 895, 353, 5706, 29918, 4530, 1338, 29898, 29903, 16514, 29892, 921, 29892, 298, 29892, 11462, 29897, 13, 13, 4706, 298, 29918, 2455, 353, 7213, 29889, 735, 27910, 29889, 4353, 759, 29918, 311, 535, 1555, 345, 29898, 29891, 29892, 921, 29892, 3309, 29922, 29882, 29918, 2435, 29892, 11462, 29918, 1707, 8837, 29922, 3754, 29918, 1217, 895, 1068, 29906, 29897, 13, 4706, 20241, 344, 353, 7442, 29889, 3676, 29898, 9302, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29882, 29918, 2455, 448, 298, 29897, 1068, 29906, 847, 298, 29918, 2435, 29897, 13, 13, 4706, 1596, 877, 1758, 344, 29922, 742, 20241, 344, 29892, 525, 29898, 25027, 29922, 742, 304, 29880, 29892, 25710, 1495, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1758, 344, 529, 304, 29880, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 13, 1678, 1053, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 1678, 298, 353, 298, 29918, 29882, 812, 13, 1678, 343, 29892, 269, 2934, 29918, 1217, 895, 353, 5706, 29918, 4530, 1338, 29898, 29903, 16514, 29892, 921, 29892, 298, 29892, 11462, 29897, 13, 13, 1678, 298, 29918, 2455, 29896, 353, 7213, 29889, 735, 27910, 29889, 311, 535, 1555, 345, 29898, 29891, 29892, 921, 29892, 3309, 29922, 29882, 29918, 2435, 29897, 13, 1678, 620, 29896, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29891, 448, 285, 615, 535, 1555, 345, 29898, 29916, 29892, 298, 29918, 2455, 29896, 876, 1068, 29906, 847, 343, 29889, 12181, 29961, 29900, 29962, 13, 1678, 286, 344, 29896, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29882, 29918, 2455, 29896, 448, 298, 29897, 1068, 29906, 847, 298, 29918, 2435, 13, 13, 1678, 298, 29918, 2455, 29906, 353, 7213, 29889, 735, 27910, 29889, 4353, 759, 29918, 311, 535, 1555, 345, 29898, 29891, 29892, 921, 29892, 3309, 29922, 29882, 29918, 2435, 29892, 11462, 29918, 1707, 8837, 29922, 3754, 29918, 1217, 895, 1068, 29906, 29892, 1235, 29918, 29876, 29918, 9748, 29922, 29896, 29945, 29897, 13, 1678, 620, 29906, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29891, 448, 285, 615, 535, 1555, 345, 29898, 29916, 29892, 298, 29918, 2455, 29906, 876, 1068, 29906, 847, 343, 29889, 12181, 29961, 29900, 29962, 13, 1678, 286, 344, 29906, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29882, 29918, 2455, 29906, 448, 298, 29897, 1068, 29906, 847, 298, 29918, 2435, 13, 13, 1678, 1596, 877, 29924, 1660, 1055, 573, 29901, 20241, 344, 29922, 742, 7442, 29889, 3676, 29898, 29885, 344, 29896, 511, 525, 620, 29922, 742, 7213, 29889, 29881, 29933, 29898, 690, 29896, 29892, 3081, 29922, 5574, 876, 13, 1678, 1596, 877, 29924, 1660, 27301, 29901, 20241, 344, 29922, 742, 7442, 29889, 3676, 29898, 29885, 344, 29906, 511, 525, 620, 29922, 742, 7213, 29889, 29881, 29933, 29898, 690, 29896, 29892, 3081, 29922, 5574, 876, 13, 13, 1678, 14770, 29889, 5317, 29898, 29882, 29897, 13, 1678, 14770, 29889, 5317, 29898, 29882, 29918, 2455, 29896, 29897, 13, 1678, 14770, 29889, 5317, 29898, 29882, 29918, 2455, 29906, 29897, 13, 1678, 14770, 29889, 26172, 18959, 26036, 742, 525, 13695, 573, 742, 525, 29956, 29875, 759, 11287, 13, 1678, 14770, 29889, 4294, 580, 13, 2 ]
src/django_perf_rec/settings.py
adamchainz/django-perf-rec
147
28167
import sys from typing import Any from django.conf import settings if sys.version_info >= (3, 8): from typing import Literal ModeType = Literal["once", "none", "all"] else: ModeType = str class Settings: defaults = {"HIDE_COLUMNS": True, "MODE": "once"} def get_setting(self, key: str) -> Any: try: return settings.PERF_REC[key] except (AttributeError, KeyError): return self.defaults.get(key, None) @property def HIDE_COLUMNS(self) -> bool: return self.get_setting("HIDE_COLUMNS") @property def MODE(self) -> ModeType: return self.get_setting("MODE") perf_rec_settings = Settings()
[ 1, 1053, 10876, 13, 3166, 19229, 1053, 3139, 13, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 6736, 313, 29941, 29892, 29871, 29947, 1125, 13, 1678, 515, 19229, 1053, 5449, 284, 13, 13, 1678, 21864, 1542, 353, 5449, 284, 3366, 10646, 613, 376, 9290, 613, 376, 497, 3108, 13, 2870, 29901, 13, 1678, 21864, 1542, 353, 851, 13, 13, 13, 1990, 19215, 29901, 13, 13, 1678, 21274, 353, 8853, 29950, 22027, 29918, 15032, 5005, 3059, 1115, 5852, 29892, 376, 20387, 1115, 376, 10646, 9092, 13, 13, 1678, 822, 679, 29918, 26740, 29898, 1311, 29892, 1820, 29901, 851, 29897, 1599, 3139, 29901, 13, 4706, 1018, 29901, 13, 9651, 736, 6055, 29889, 13171, 29943, 29918, 1525, 29907, 29961, 1989, 29962, 13, 4706, 5174, 313, 6708, 2392, 29892, 7670, 2392, 1125, 13, 9651, 736, 1583, 29889, 4381, 29879, 29889, 657, 29898, 1989, 29892, 6213, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 379, 22027, 29918, 15032, 5005, 3059, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 736, 1583, 29889, 657, 29918, 26740, 703, 29950, 22027, 29918, 15032, 5005, 3059, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 822, 16999, 2287, 29898, 1311, 29897, 1599, 21864, 1542, 29901, 13, 4706, 736, 1583, 29889, 657, 29918, 26740, 703, 20387, 1159, 13, 13, 13, 546, 29888, 29918, 3757, 29918, 11027, 353, 19215, 580, 13, 2 ]
build/lib/ruleset/ripper.py
ts01174755/wittgenstein
64
147060
<filename>build/lib/ruleset/ripper.py """ Implementation of the RIPPERk algorithm for growing classification rulesets. See https://www.let.rug.nl/nerbonne/teach/learning/cohen95fast.pdf """ # Author: <NAME> <<EMAIL>> # License: MIT import pandas as pd import copy import math import warnings from ruleset import base from .base import Cond, Rule, Ruleset from .base import rnd, fit_bins, bin_transform, score_accuracy class RIPPER: """ Class for generating ruleset classification models. See Cohen (1995): https://www.let.rug.nl/nerbonne/teach/learning/cohen95fast.pdf """ def __init__(self, k=2, prune_size=.33, dl_allowance=64, verbosity=0): """ Creates a new RIPPER object. args: k (optional): number of RIPPERk optimization iterations (default=2) prune_size (optional): proportion of training set to be used for pruning (defailt=.33) dl_allowance (optional): terminate Ruleset grow phase early if a Ruleset description length is encountered that is more than this amount above the lowest description length so far encountered. (default=64 bits) verbosity (optional): output information about the training process (default=0) 1: Show results of each major phase 2: Show Ruleset grow/optimization steps 3: Show Ruleset grow/optimization calculations 4: Show Rule grow/prune steps 5: Show Rule grow/prune calculations """ self.prune_size = prune_size self.dl_allowance = dl_allowance self.k = k self.verbosity = verbosity def __str__(self): """ Returns string representation of a RIPPER object. """ fitstr = f'with fit ruleset' if hasattr(self,'ruleset_') else '(unfit)' return f'<RIPPER object {fitstr} (k={self.k}, prune_size={self.prune_size}, dl_allowance={self.dl_allowance})>' __repr__ = __str__ def fit(self, df, y=None, class_feat=None, pos_class=None, n_discretize_bins=None, random_state=None): """ Fit a Ruleset model using a training DataFrame. args: df <DataFrame>: categorical training dataset y: <iterable>: class labels corresponding to df rows. Parameter y or class_feat (see next) must be provided. class_feat: column name of class feature (Use if class feature is still in df.) pos_class (optional): name of positive class. If not provided, defaults to class of first training example. n_discretize_bins (optional): try to fit apparent numeric attributes into n_discretize_bins discrete bins. Pass None to disable auto-discretization and treat values as categorical. (default=None) random_state: (optional) random state to allow for repeatable results """ ################ # Stage 0: Setup ################ # Set up trainset, set class feature name, and set pos class name df, self.class_feat, self.pos_class = base.trainset_classfeat_posclass(df, y=y, class_feat=class_feat, pos_class=pos_class) # Precalculate rule df lookup #self._set_theory_dl_lookup(df, verbosity=self.verbosity) # Anything to discretize? numeric_feats = base.find_numeric_feats(df, min_unique=n_discretize_bins, ignore_feats=[self.class_feat]) if numeric_feats: if n_discretize_bins is not None: if self.verbosity==1: print(f'binning data...\n') elif self.verbosity>=2: print(f'binning features {numeric_feats}...') self.bin_transformer_ = fit_bins(df, n_bins=n_discretize_bins, output=False, ignore_feats=[self.class_feat], verbosity=self.verbosity) binned_df = bin_transform(df, self.bin_transformer_) else: n_unique_values = sum([len(u) for u in [df[f].unique() for f in numeric_feats]]) warnings.warn(f'Optional param n_discretize_bins=None, but there are apparent numeric features: {numeric_feats}. \n Treating {n_unique_values} numeric values as nominal', RuntimeWarning) binned_df=None else: binned_df=None # Split df into pos, neg classes pos_df, neg_df = base.pos_neg_split(df, self.class_feat, self.pos_class) if binned_df is None else base.pos_neg_split(binned_df, self.class_feat, self.pos_class) pos_df = pos_df.drop(self.class_feat,axis=1) neg_df = neg_df.drop(self.class_feat,axis=1) # Collect possible conds self._set_possible_conds(df) ############################### # Stage 1: Grow initial Ruleset ############################### self.ruleset_ = Ruleset() self.ruleset_ = self._grow_ruleset(pos_df, neg_df, prune_size=self.prune_size, dl_allowance=self.dl_allowance, random_state=random_state) if self.verbosity >= 1: print() print('GREW INITIAL RULESET:') self.ruleset_.out_pretty() print() ########################### # Stage 2: Optimize Ruleset ########################### for iter in range(self.k): # Create new but reproducible random_state (if applicable) iter_random_state = random_state+100 if random_state is not None else None # Run optimization iteration if self.verbosity>=1: print(f'optimization run {iter+1} of {self.k}') newset = self._optimize_ruleset(self.ruleset_, pos_df, neg_df, prune_size=self.prune_size, random_state=iter_random_state) if self.verbosity>=1: print() print('OPTIMIZED RULESET:') if self.verbosity>=2: print(f'iteration {iter+1} of {self.k}\n modified rules {[i for i in range(len(self.ruleset_.rules)) if self.ruleset_.rules[i]!= newset.rules[i]]}') newset.out_pretty() print() self.ruleset_ = newset ############################################# # Stage 3: Cover any last remaining positives ############################################# pos_remaining, neg_remaining = base.pos_neg_split(df, self.class_feat, self.pos_class) pos_remaining = pos_remaining.drop(self.class_feat,axis=1) neg_remaining = neg_remaining.drop(self.class_feat,axis=1) pos_remaining, neg_remaining = base.rm_covered(self.ruleset_, pos_remaining, neg_remaining) if len(pos_remaining)>=1: if self.verbosity>=2: print(f'{len(pos_remaining)} pos left. Growing final rules...') newset = self._grow_ruleset(pos_remaining, neg_remaining, initial_ruleset=self.ruleset_, prune_size=self.prune_size, dl_allowance=self.dl_allowance, random_state=random_state) if self.verbosity>=1: print('GREW FINAL RULES') newset.out_pretty() print() self.ruleset_ = newset else: if self.verbosity>=1: print('All pos covered\n') ################################################# # Stage 4: Remove any rules that don't improve dl ################################################# if self.verbosity>=2: print('Optimizing dl...') mdl_subset, _ = _rs_total_bits(self.ruleset_, self.ruleset_.possible_conds, pos_df, neg_df, bestsubset_dl=True, ret_bestsubset=True, verbosity=self.verbosity) self.ruleset_ = mdl_subset if self.verbosity>=1: print('FINAL RULESET:') self.ruleset_.out_pretty() print() def predict(self, X_df, give_reasons=False): """ Predict classes of data using a RIPPER-fit model. args: X_df <DataFrame>: examples to make predictions on. give_reasons (optional) <bool>: whether to provide reasons for each prediction made. returns: list of <bool> values corresponding to examples. True indicates positive predicted class; False non-positive class. If give_reasons is True, returns a tuple that contains the above list of predictions and a list of the corresponding reasons for each prediction; for each positive prediction, gives a list of all the covering Rules, for negative predictions, an empty list. """ if not hasattr(self, 'ruleset_'): raise AttributeError('You should fit a RIPPER object before making predictions with it.') else: return self.ruleset_.predict(X_df, give_reasons=give_reasons) def score(self, X, y, score_function=score_accuracy): """ Test performance of a RIPPER-fit model. X: <DataFrame> of independent attributes y: <DataFrame> or <iterable> of matching dependent target values score_function (optional): function that takes two parameters: actuals <iterable<bool>>, predictions <iterable<bool>>, containing class values. (default=accuracy) this parameter is intended to be compatible with sklearn's scoring functions: https://scikit-learn.org/stable/modules/model_evaluation.html#classification-metrics """ predictions = self.predict(X) if type(y)==pd.core.frame.DataFrame: actuals = [yi==self.pos_class for yi in y.tolist()] else: actuals = [yi==self.pos_class for yi in y] return score_function(actuals, predictions) def _set_theory_dl_lookup(self, df, size=15, verbosity=0): """ Precalculate rule theory dls for various-sized rules. """ self.dl_dict = {} temp = Ruleset() temp._set_possible_conds(df, df) possible_conds = temp.possible_conds for n in range(1, size+1): rule = Rule([Cond('_','_')]*n) dl = _r_theory_bits(rule, possible_conds, bits_dict=None, verbosity=verbosity) self.dl_dict[n] = dl if verbosity>=2: print(f'updated dl for rule size {n}: {dl}') def _grow_ruleset(self, pos_df, neg_df, prune_size, dl_allowance, initial_ruleset=None, random_state=None): """ Grow a Ruleset with pruning. """ pos_remaining = pos_df.copy() neg_remaining = neg_df.copy() if initial_ruleset is None: ruleset = Ruleset() ruleset._set_possible_conds(pos_df, neg_df) else: ruleset = copy.deepcopy(initial_ruleset) ruleset_dl = None mdl = None # Minimum encountered description length (in bits) dl_diff = 0 if self.verbosity>=2: print('growing ruleset...') print() while len(pos_remaining) > 0 and dl_diff <= self.dl_allowance: # Grow-prune split remaining uncovered examples pos_growset, pos_pruneset = base.df_shuffled_split(pos_remaining, (1-prune_size), random_state=random_state) neg_growset, neg_pruneset = base.df_shuffled_split(neg_remaining, (1-prune_size), random_state=random_state) if self.verbosity>=2: print(f'pos_growset {len(pos_growset)} pos_pruneset {len(pos_pruneset)}') print(f'neg_growset {len(neg_growset)} neg_pruneset {len(neg_pruneset)}') if len(pos_growset)==0: break # Probably safe, but a little dicey to only check pos_growset. # Grow Rule grown_rule = base.grow_rule(pos_growset, neg_growset, ruleset.possible_conds, verbosity=self.verbosity) if grown_rule.isempty(): break # Generated an empty rule b/c no good conds exist # Prune Rule pruned_rule = base.prune_rule(grown_rule, _RIPPER_growphase_prune_metric, pos_pruneset, neg_pruneset, verbosity=self.verbosity) # Add rule; calculate new description length ruleset.add(pruned_rule) # Unlike IREP, IREP*/RIPPER stopping condition is inclusive: "After each rule is added, the total description length of the rule set and examples is computed." if self.verbosity>=2: print(f"updated ruleset: {ruleset.truncstr(direction='right')}") print() if ruleset_dl is None: # First Rule to be added rule_dl = _r_theory_bits(pruned_rule, ruleset.possible_conds, verbosity=self.verbosity) theory_dl = rule_dl data_dl = _exceptions_bits(ruleset, pos_df, neg_df, verbosity=self.verbosity) ruleset_dl = theory_dl + data_dl mdl = ruleset_dl else: rule_dl = _r_theory_bits(pruned_rule, ruleset.possible_conds, verbosity=self.verbosity) theory_dl += rule_dl data_dl = _exceptions_bits(ruleset, pos_df, neg_df, verbosity=self.verbosity) ruleset_dl = theory_dl + data_dl dl_diff = ruleset_dl - mdl if self.verbosity>=3: print(f'rule dl: {rnd(rule_dl)}') print(f'updated theory dl: {rnd(theory_dl)}') print(f'exceptions: {rnd(data_dl)}') print(f'total dl: {rnd(ruleset_dl)}') if dl_diff<=self.dl_allowance: print(f'mdl {rnd(mdl)} (diff {rnd(dl_diff)} <= {rnd(self.dl_allowance)})') else: print(f'mdl {rnd(mdl)} dl-halt: diff {rnd(dl_diff)} exceeds allowance ({rnd(self.dl_allowance)})') mdl = ruleset_dl if ruleset_dl<mdl else mdl # Remove covered examples pos_remaining, neg_remaining = base.rm_covered(pruned_rule, pos_remaining, neg_remaining) if self.verbosity>=3: print(f'examples remaining: {len(pos_remaining)} pos, {len(neg_remaining)} neg') print() return ruleset def _optimize_ruleset(self, ruleset, pos_df, neg_df, prune_size, random_state=None): """ Optimization phase. """ if self.verbosity>=2: print('optimizing ruleset...') print() pos_remaining = pos_df.copy() neg_remaining = neg_df.copy() original_ruleset = copy.deepcopy(ruleset) if self.verbosity>=4: print('calculate original ruleset potential dl...') original_dl = _rs_total_bits(original_ruleset, original_ruleset.possible_conds, pos_df, neg_df, bestsubset_dl=True, verbosity=self.verbosity) if self.verbosity>=3: print(f'original ruleset potential dl: {rnd(original_dl)}') print() new_ruleset = copy.deepcopy(ruleset) for i, rule in enumerate(original_ruleset.rules): pos_growset, pos_pruneset = base.df_shuffled_split(pos_remaining, (1-prune_size), random_state=random_state) neg_growset, neg_pruneset = base.df_shuffled_split(neg_remaining, (1-prune_size), random_state=random_state) if len(pos_growset) == 0: break # Possible where optimization run > 1 # Create alternative rules if self.verbosity>=4: print(f'creating replacement for {i} of {len(original_ruleset.rules)}: {ruleset.rules[i]}') g_replacement = base.grow_rule(pos_growset, neg_growset, original_ruleset.possible_conds, initial_rule=Rule(), verbosity=self.verbosity) replacement_ruleset = Ruleset(base.i_replaced(original_ruleset.rules, i, g_replacement)) pr_replacement = base.prune_rule(g_replacement, _RIPPER_optimization_prune_metric, pos_pruneset, neg_pruneset, eval_index_on_ruleset=(i,replacement_ruleset), verbosity=self.verbosity) replacement_ruleset = Ruleset(base.i_replaced(original_ruleset.rules, i, pr_replacement)) if self.verbosity>=3: print(f'grew replacement {g_replacement}') print(f'pruned replacement is {pr_replacement}') if self.verbosity>=3: print(f'creating revision for {i} of {len(original_ruleset.rules)}: {ruleset.rules[i]}') g_revision = base.grow_rule(pos_growset, neg_growset, original_ruleset.possible_conds, initial_rule=ruleset.rules[i], verbosity=self.verbosity) revision_ruleset = Ruleset(base.i_replaced(original_ruleset.rules, i, g_revision)) pr_revision = base.prune_rule(g_revision, _RIPPER_optimization_prune_metric, pos_pruneset, neg_pruneset, eval_index_on_ruleset=(i,revision_ruleset), verbosity=self.verbosity) revision_ruleset = Ruleset(base.i_replaced(original_ruleset.rules, i, pr_revision)) if self.verbosity>=3: print(f'grew revision {g_replacement}') print(f'pruned revision is {pr_replacement}') print() # Calculate alternative Rulesets' respective lowest potential dls to identify the best version if self.verbosity>=3: print(f'calculate potential dl for ds with replacement {pr_replacement}') replacement_dl = _rs_total_bits(replacement_ruleset, original_ruleset.possible_conds, pos_df, neg_df, bestsubset_dl=True, verbosity=self.verbosity)\ if pr_replacement!=rule else original_dl if self.verbosity>=3: print(f'calculate potential dl for ds with revision {pr_revision}') revision_dl = _rs_total_bits(revision_ruleset, original_ruleset.possible_conds, pos_df, neg_df, bestsubset_dl=True, verbosity=self.verbosity)\ if pr_revision!=rule else original_dl best_rule = [rule, pr_replacement, pr_revision][base.argmin([original_dl, replacement_dl, revision_dl])] if self.verbosity>=2: print(f'\nrule {i+1} of {len(original_ruleset.rules)}') rep_str = pr_replacement.__str__() if pr_replacement!=rule else 'unchanged' rev_str = pr_revision.__str__() if pr_revision!=rule else 'unchanged' best_str = best_rule.__str__() if best_rule!=rule else 'unchanged' if self.verbosity==2: print(f'original: {rule}') print(f'replacement: {rep_str}') print(f'revision: {rev_str}') print(f'*best: {best_str}') print() else: print(f'original: {rule}) | {rnd(original_dl)} bits') print(f'replacement: {rep_str} | {rnd(replacement_dl)} bits') print(f'revision: {rev_str} | {rnd(revision_dl)} bits') print(f'*best: {best_str} | {rnd(min([replacement_dl, revision_dl, original_dl]))} bits') print() new_ruleset.rules[i] = best_rule # Remove covered examples pos_remaining, neg_remaining = base.rm_covered(rule, pos_remaining, neg_remaining) if self.verbosity>=3: print(f'examples remaining: {len(pos_remaining)} pos, {len(neg_remaining)} neg') print() # If there are no pos data remaining to train optimization (could happen if optimization run >1), keep remaining rules the same if len(pos_remaining)==0: break return new_ruleset def _set_possible_conds(self, df): self.possible_conds = [] for feat in df.columns.values: for val in df[feat].unique(): self.possible_conds.append(Cond(feat, val)) #### HELPER Class ##### class RulesetStats: # This class is not used in the current implementation but could come in handy for future optimization # by storing and retreiving calculations that may be repeated. # Haven't incorporated it because there are bigger fish to fry, optimization-wise. def __init__(self): self.subset_dls = [] self.ruleset = Ruleset() self.dl = 0 def update(self, ruleset, possible_conds, pos_df, neg_df, verbosity=0): # Find first mismatching rule index # If there is no mismatch, return # If there is a mismatch, update self.ruleset and wipe subsequent dls index = 0 while index < len(self.ruleset) and \ index < len(ruleset) and \ self.ruleset[index] == ruleset[index]: index += 1 if index == len(ruleset) and index == len(self.ruleset): if verbosity>=4: print(f'not updating stats -- no ruleset change found') return if verbosity>=4: print(f'updating stats from index {index}') self.ruleset.rules[index:] = ruleset[index:] self.subset_dls = self.subset_dls[:index] # Beginning with index, update subset dls for i in range(index, len(ruleset)): rule = ruleset[i] subset = Ruleset(ruleset.rules[:i+1]) subset_dl = _rs_total_bits(subset, possible_conds, pos_df, neg_df, verbosity=verbosity) self.subset_dls.append(subset_dl) self.dl = self.subset_dls[-1] def dl_change(self, index): return self.subset_dls[index] - self.subset_dls[index-1] def potential_dl_stats(self, possible_conds, pos_df, neg_df, ret_ruleset=True, ret_dl=False, verbosity=0): if not any((ret_ruleset, ret_dl)): raise ValueError('method dl_pruned_ruleset called without any return values specified') tempStats = copy.deepcopy(self) i = len(tempStats.ruleset) - 1 while i > 0: if tempStats.dl_change(i) > 0: if verbosity>=4: print(f'rule {i} raised dl -- removing') tempStats.update(Ruleset(tempStats.ruleset[:i]+tempStats.ruleset[i+1:]), possible_conds, pos_df, neg_df) if verbosity>=4: print(f'new ruleset is {tempStats.ruleset}') i -= 1 return tempStats ################################### ##### RIPPER-specific Metrics ##### ################################### def _RIPPER_growphase_prune_metric(rule, pos_pruneset, neg_pruneset): """ RIPPER/IREP* prune metric. Returns the prune value of a candidate Rule. Cohen's formula is (p-n) / (p+n). Unclear from the paper how they handle divzero (where p+n=0), so I Laplaced it. Weka's solution was to modify the formula to (p+1)/(p+n+2), but the (non-NaN) values I got appeared closer to those of the original formula. """ # I imagine Weka's is 1/2 because that's closer to a 50-50 class distribution? p = rule.num_covered(pos_pruneset) n = rule.num_covered(neg_pruneset) return (p - n + 1) / (p + n + 1) def _RIPPER_optimization_prune_metric(rule, pos_pruneset, neg_pruneset): return base.accuracy(rule, pos_pruneset, neg_pruneset) def _r_theory_bits(rule, possible_conds, bits_dict=None, verbosity=0): """ Returns description length (in bits) for a single Rule. """ if hasattr(rule, 'dl'): return rule.dl else: if type(rule) != Rule: raise TypeError(f'param rule in _r_theory_bits should be type Rule') k = len(rule.conds) # Number of rule conditions n = len(possible_conds) # Number of possible conditions pr = k/n S = k*math.log2(1/pr) + (n-k)*math.log2((1/(1-pr))) # S(n, k, pr) K = math.log2(k) # Number bits need to send integer k rule_dl = 0.5*(K + S) # Divide by 2 a la Quinlan. Cohen: "to adjust for possible redundency in attributes" if verbosity>=5: print(f'rule theory bits| {rule} k {k} n {n} pr {rnd(pr)}: {rnd(rule_dl)} bits') #rule.dl = rule_dl return rule_dl def _rs_theory_bits(ruleset, possible_conds, pos_df, neg_df, verbosity=0): """ Returns theory description length (in bits) for a Ruleset. """ if type(ruleset) != Ruleset: raise TypeError(f'param ruleset in _rs_theory_bits should be type Ruleset') """ Returns sum of theory bits for each Rule in ruleset """ total = 0 for rule in ruleset.rules: total += _r_theory_bits(rule, possible_conds, verbosity=verbosity) #total += rule_bits(rule, possible_conds, rem_pos, rem_neg, verbosity=verbosity) #rem_pos, rem_neg = base.rm_covered(rule, rem_pos, rem_neg) if verbosity>=5: print(f'ruleset theory bits| {rnd(total)}') #ruleset.dl = total return total def _exceptions_bits(ruleset, pos_df, neg_df, verbosity=0): """ Returns description length (in bits) for exceptions to a Ruleset's coverage. """ if type(ruleset) != Ruleset: raise TypeError(f'to avoid double-counting, _exceptions_bits should calculate exceptions over entire set of rules with type Ruleset') N = len(pos_df) + len(neg_df) # Total number of examples p = ruleset.num_covered(pos_df) + ruleset.num_covered(neg_df) # Total number of examples classified as positive = total covered fp = ruleset.num_covered(neg_df) # Number false positives = negatives covered by the ruleset fn = len(pos_df) - ruleset.num_covered(pos_df) # Number false negatives = positives not covered by the ruleset exceptions_dl = math.log2(base.nCr(p,fp)) + math.log2(base.nCr((N-p),fn)) if verbosity>=5: print(f'exceptions_bits| {ruleset.truncstr()}: \n N {N} p {p} fp {fp} fn {fn}: exceptions_bits {rnd(exceptions_dl)}') return exceptions_dl def _rs_total_bits(ruleset, possible_conds, pos_df, neg_df, bestsubset_dl=False, ret_bestsubset=False, verbosity=0): """ Returns total description length (in bits) of ruleset -- the sum of its theory dl and exceptions dl. bestsubset_dl (optional, <bool>): whether to return estimated minimum possible dl were all rules that increase dl to be removed ret_bestsubset (optional): whether to return the best subset that was found. Return format will be (<Ruleset>,dl). """ # The RIPPER paper is brief and unclear w/r how to evaluate a ruleset for best potential dl. # 1) Do you reevaluate already-visited rules or evaluate each rule independently of one another? # Weka's source code comments that you are not supposed to, and that this is "bizarre." # Perhaps not recursing so -- and getting a possibly sub-optimal mdl -- could be viewed as a greedy time-saver? # After all, this is supposed to be an iterative algorithm, it could optimize more times with future k's, # and it's not like we're performing an exhaustive search of every possible combination anyways. # 2) In what order are you supposed to evaluate? FIFO or LIFO? # Footnote 7 suggests optimization is done FIFO; the previous page suggests IREP* final dl reduction is done LIFO; # and context suggests dl reduction should be performed the same way both times. # I chose to greedy for #1, and FIFO for #2 but may choose differently in a future version if it seems more appropriate. # In any case, RIPPER's strong performance on the test sets vs. RandomForest suggests it may not matter all that much. if type(ruleset) != Ruleset: raise TypeError(f'param ruleset in _rs_total_bits should be type Ruleset') if ret_bestsubset and not bestsubset_dl: raise ValueError(f'bestsubset_dl must be True in order to return bestsubset_dl') if not bestsubset_dl: theory_bits = _rs_theory_bits(ruleset, possible_conds, pos_df, neg_df, verbosity=verbosity) data_bits = _exceptions_bits(ruleset, pos_df, neg_df, verbosity=verbosity) if verbosity>=3: print(f'total ruleset bits | {rnd(theory_bits + data_bits)}') return theory_bits + data_bits else: # Collect the dl of each subset subset_dls = [] theory_dl = 0 if verbosity>=5: print(f'find best potential dl for {ruleset}:') for i, rule in enumerate(ruleset.rules): # Separating theory and exceptions dls in this way means you don't have to recalculate theory each time subset = Ruleset(ruleset.rules[:i+1]) rule_theory_dl = _r_theory_bits(rule, possible_conds, verbosity=verbosity) theory_dl += rule_theory_dl exceptions_dl = _exceptions_bits(subset, pos_df, neg_df, verbosity=verbosity) subset_dls.append(theory_dl + exceptions_dl) if verbosity>=5: print(f'subset 0-{i} | dl: {rnd(subset_dls[i])}') # Build up the best Ruleset and calculate the mdl mdl_ruleset = Ruleset() for i, rule, in enumerate(ruleset.rules): if i==0 or subset_dls[i] <= subset_dls[i-1]: # Rule i does not worsen the dl mdl_ruleset.add(rule) if verbosity>=5: print(f'subset dls: {[(i,rnd(dl)) for i,dl in enumerate(subset_dls)]}') print(f'best potential ruleset: {mdl_ruleset}') mdl = _rs_total_bits(mdl_ruleset, possible_conds, pos_df, neg_df, bestsubset_dl=False, verbosity=0) # About to print value below if verbosity>=5: print(f'best potential dl was {rnd(mdl)}') print() if not ret_bestsubset: return mdl else: return (mdl_ruleset, mdl)
[ 1, 529, 9507, 29958, 4282, 29914, 1982, 29914, 19238, 300, 29914, 374, 2496, 29889, 2272, 13, 15945, 29908, 13, 1888, 14607, 310, 278, 390, 5690, 13171, 29895, 5687, 363, 15678, 12965, 6865, 1691, 29889, 13, 13393, 2045, 597, 1636, 29889, 1026, 29889, 11124, 29889, 12938, 29914, 1089, 6718, 484, 29914, 371, 496, 29914, 21891, 29914, 1111, 3169, 29929, 29945, 11255, 29889, 5140, 13, 15945, 29908, 13, 13, 29937, 13361, 29901, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 19245, 29901, 341, 1806, 13, 13, 5215, 11701, 408, 10518, 13, 5215, 3509, 13, 5215, 5844, 13, 5215, 18116, 13, 13, 3166, 6865, 300, 1053, 2967, 13, 3166, 869, 3188, 1053, 11790, 29892, 27308, 29892, 390, 2540, 300, 13, 3166, 869, 3188, 1053, 364, 299, 29892, 6216, 29918, 29890, 1144, 29892, 9016, 29918, 9067, 29892, 8158, 29918, 562, 2764, 4135, 13, 13, 1990, 390, 5690, 13171, 29901, 13, 1678, 9995, 4134, 363, 14655, 6865, 300, 12965, 4733, 29889, 13, 4706, 2823, 315, 14899, 313, 29896, 29929, 29929, 29945, 1125, 2045, 597, 1636, 29889, 1026, 29889, 11124, 29889, 12938, 29914, 1089, 6718, 484, 29914, 371, 496, 29914, 21891, 29914, 1111, 3169, 29929, 29945, 11255, 29889, 5140, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 413, 29922, 29906, 29892, 544, 1540, 29918, 2311, 21098, 29941, 29941, 29892, 270, 29880, 29918, 9536, 749, 29922, 29953, 29946, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 4706, 9995, 6760, 1078, 263, 716, 390, 5690, 13171, 1203, 29889, 13, 13, 9651, 6389, 29901, 13, 18884, 413, 313, 25253, 1125, 9651, 1353, 310, 390, 5690, 13171, 29895, 13883, 24372, 313, 4381, 29922, 29906, 29897, 13, 18884, 544, 1540, 29918, 2311, 313, 25253, 1125, 259, 18618, 310, 6694, 731, 304, 367, 1304, 363, 544, 27964, 313, 1753, 737, 29873, 21098, 29941, 29941, 29897, 13, 18884, 270, 29880, 29918, 9536, 749, 313, 25253, 1125, 29504, 390, 2540, 300, 6548, 8576, 4688, 565, 263, 390, 2540, 300, 6139, 3309, 338, 18169, 13, 462, 462, 9651, 393, 338, 901, 1135, 445, 5253, 2038, 278, 19604, 6139, 3309, 577, 2215, 18169, 29889, 13, 462, 462, 9651, 313, 4381, 29922, 29953, 29946, 9978, 29897, 13, 18884, 9750, 359, 537, 313, 25253, 1125, 1678, 1962, 2472, 1048, 278, 6694, 1889, 313, 4381, 29922, 29900, 29897, 13, 462, 462, 9651, 29896, 29901, 7704, 2582, 310, 1269, 4655, 8576, 13, 462, 462, 9651, 29906, 29901, 7704, 390, 2540, 300, 6548, 29914, 20640, 2133, 6576, 13, 462, 462, 9651, 29941, 29901, 7704, 390, 2540, 300, 6548, 29914, 20640, 2133, 17203, 13, 462, 462, 9651, 29946, 29901, 7704, 27308, 6548, 29914, 558, 1540, 6576, 13, 462, 462, 9651, 29945, 29901, 7704, 27308, 6548, 29914, 558, 1540, 17203, 13, 4706, 9995, 13, 4706, 1583, 29889, 558, 1540, 29918, 2311, 353, 544, 1540, 29918, 2311, 13, 4706, 1583, 29889, 11671, 29918, 9536, 749, 353, 270, 29880, 29918, 9536, 749, 13, 4706, 1583, 29889, 29895, 353, 413, 13, 4706, 1583, 29889, 18248, 359, 537, 353, 9750, 359, 537, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 9995, 16969, 1347, 8954, 310, 263, 390, 5690, 13171, 1203, 29889, 9995, 13, 4706, 6216, 710, 353, 285, 29915, 2541, 6216, 6865, 300, 29915, 565, 756, 5552, 29898, 1311, 5501, 19238, 300, 29918, 1495, 1683, 525, 29898, 348, 9202, 16029, 13, 4706, 736, 285, 29915, 29966, 3960, 29925, 13171, 1203, 426, 9202, 710, 29913, 313, 29895, 3790, 1311, 29889, 29895, 1118, 544, 1540, 29918, 2311, 3790, 1311, 29889, 558, 1540, 29918, 2311, 1118, 270, 29880, 29918, 9536, 749, 3790, 1311, 29889, 11671, 29918, 9536, 749, 1800, 16299, 13, 1678, 4770, 276, 558, 1649, 353, 4770, 710, 1649, 13, 13, 1678, 822, 6216, 29898, 1311, 29892, 4489, 29892, 343, 29922, 8516, 29892, 770, 29918, 1725, 271, 29922, 8516, 29892, 926, 29918, 1990, 29922, 8516, 29892, 302, 29918, 2218, 4838, 675, 29918, 29890, 1144, 29922, 8516, 29892, 4036, 29918, 3859, 29922, 8516, 1125, 13, 4706, 9995, 383, 277, 263, 390, 2540, 300, 1904, 773, 263, 6694, 3630, 4308, 29889, 13, 13, 9651, 6389, 29901, 13, 18884, 4489, 529, 17271, 23917, 11608, 936, 6694, 8783, 13, 18884, 343, 29901, 529, 1524, 519, 23917, 770, 11073, 6590, 304, 4489, 4206, 29889, 24953, 343, 470, 770, 29918, 1725, 271, 313, 4149, 2446, 29897, 1818, 367, 4944, 29889, 13, 18884, 770, 29918, 1725, 271, 29901, 1897, 1024, 310, 770, 4682, 313, 11403, 565, 770, 4682, 338, 1603, 297, 4489, 1846, 13, 13, 18884, 926, 29918, 1990, 313, 25253, 1125, 1024, 310, 6374, 770, 29889, 960, 451, 4944, 29892, 21274, 304, 770, 310, 937, 6694, 1342, 29889, 13, 18884, 302, 29918, 2218, 4838, 675, 29918, 29890, 1144, 313, 25253, 1125, 1018, 304, 6216, 20295, 16985, 8393, 964, 302, 29918, 2218, 4838, 675, 29918, 29890, 1144, 19554, 289, 1144, 29889, 13, 462, 462, 795, 6978, 6213, 304, 11262, 4469, 29899, 2218, 4838, 2133, 322, 7539, 1819, 408, 11608, 936, 29889, 313, 4381, 29922, 8516, 29897, 13, 18884, 4036, 29918, 3859, 29901, 313, 25253, 29897, 4036, 2106, 304, 2758, 363, 12312, 519, 2582, 13, 4706, 9995, 13, 13, 4706, 835, 7346, 4136, 29937, 13, 4706, 396, 24906, 29871, 29900, 29901, 3789, 786, 13, 4706, 835, 7346, 4136, 29937, 13, 13, 4706, 396, 3789, 701, 7945, 842, 29892, 731, 770, 4682, 1024, 29892, 322, 731, 926, 770, 1024, 13, 4706, 4489, 29892, 1583, 29889, 1990, 29918, 1725, 271, 29892, 1583, 29889, 1066, 29918, 1990, 353, 2967, 29889, 14968, 842, 29918, 1990, 1725, 271, 29918, 1066, 1990, 29898, 2176, 29892, 343, 29922, 29891, 29892, 770, 29918, 1725, 271, 29922, 1990, 29918, 1725, 271, 29892, 926, 29918, 1990, 29922, 1066, 29918, 1990, 29897, 13, 13, 4706, 396, 4721, 15807, 403, 5751, 4489, 16280, 13, 4706, 396, 1311, 3032, 842, 29918, 14138, 29918, 11671, 29918, 20401, 29898, 2176, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 13, 4706, 396, 530, 1541, 292, 304, 766, 4838, 675, 29973, 13, 4706, 16985, 29918, 1725, 1446, 353, 2967, 29889, 2886, 29918, 21574, 29918, 1725, 1446, 29898, 2176, 29892, 1375, 29918, 13092, 29922, 29876, 29918, 2218, 4838, 675, 29918, 29890, 1144, 29892, 11455, 29918, 1725, 1446, 11759, 1311, 29889, 1990, 29918, 1725, 271, 2314, 13, 4706, 565, 16985, 29918, 1725, 1446, 29901, 13, 9651, 565, 302, 29918, 2218, 4838, 675, 29918, 29890, 1144, 338, 451, 6213, 29901, 13, 18884, 565, 1583, 29889, 18248, 359, 537, 1360, 29896, 29901, 13, 462, 1678, 1596, 29898, 29888, 29915, 2109, 1076, 848, 856, 29905, 29876, 1495, 13, 18884, 25342, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 13, 462, 1678, 1596, 29898, 29888, 29915, 2109, 1076, 5680, 426, 21574, 29918, 1725, 1446, 29913, 856, 1495, 13, 18884, 1583, 29889, 2109, 29918, 9067, 261, 29918, 353, 6216, 29918, 29890, 1144, 29898, 2176, 29892, 302, 29918, 29890, 1144, 29922, 29876, 29918, 2218, 4838, 675, 29918, 29890, 1144, 29892, 1962, 29922, 8824, 29892, 11455, 29918, 1725, 1446, 11759, 1311, 29889, 1990, 29918, 1725, 271, 1402, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 18884, 289, 27464, 29918, 2176, 353, 9016, 29918, 9067, 29898, 2176, 29892, 1583, 29889, 2109, 29918, 9067, 261, 19925, 13, 9651, 1683, 29901, 13, 18884, 302, 29918, 13092, 29918, 5975, 353, 2533, 4197, 2435, 29898, 29884, 29897, 363, 318, 297, 518, 2176, 29961, 29888, 1822, 13092, 580, 363, 285, 297, 16985, 29918, 1725, 1446, 24960, 13, 18884, 18116, 29889, 25442, 29898, 29888, 29915, 27636, 1828, 302, 29918, 2218, 4838, 675, 29918, 29890, 1144, 29922, 8516, 29892, 541, 727, 526, 20295, 16985, 5680, 29901, 426, 21574, 29918, 1725, 1446, 1836, 320, 29876, 6479, 1218, 426, 29876, 29918, 13092, 29918, 5975, 29913, 16985, 1819, 408, 2245, 979, 742, 24875, 22709, 29897, 13, 18884, 289, 27464, 29918, 2176, 29922, 8516, 13, 4706, 1683, 29901, 13, 9651, 289, 27464, 29918, 2176, 29922, 8516, 13, 13, 4706, 396, 26178, 4489, 964, 926, 29892, 3480, 4413, 13, 4706, 926, 29918, 2176, 29892, 3480, 29918, 2176, 353, 2967, 29889, 1066, 29918, 10052, 29918, 5451, 29898, 2176, 29892, 1583, 29889, 1990, 29918, 1725, 271, 29892, 1583, 29889, 1066, 29918, 1990, 29897, 565, 289, 27464, 29918, 2176, 338, 6213, 1683, 2967, 29889, 1066, 29918, 10052, 29918, 5451, 29898, 2109, 9571, 29918, 2176, 29892, 1583, 29889, 1990, 29918, 1725, 271, 29892, 1583, 29889, 1066, 29918, 1990, 29897, 13, 4706, 926, 29918, 2176, 353, 926, 29918, 2176, 29889, 8865, 29898, 1311, 29889, 1990, 29918, 1725, 271, 29892, 8990, 29922, 29896, 29897, 13, 4706, 3480, 29918, 2176, 353, 3480, 29918, 2176, 29889, 8865, 29898, 1311, 29889, 1990, 29918, 1725, 271, 29892, 8990, 29922, 29896, 29897, 13, 13, 4706, 396, 24930, 1950, 2148, 29879, 13, 4706, 1583, 3032, 842, 29918, 27338, 29918, 1116, 29879, 29898, 2176, 29897, 13, 13, 4706, 835, 13383, 7346, 4136, 13, 4706, 396, 24906, 29871, 29896, 29901, 402, 798, 2847, 390, 2540, 300, 13, 4706, 835, 13383, 7346, 4136, 13, 13, 4706, 1583, 29889, 19238, 300, 29918, 353, 390, 2540, 300, 580, 13, 4706, 1583, 29889, 19238, 300, 29918, 353, 1583, 3032, 29887, 798, 29918, 19238, 300, 29898, 1066, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 13, 9651, 544, 1540, 29918, 2311, 29922, 1311, 29889, 558, 1540, 29918, 2311, 29892, 270, 29880, 29918, 9536, 749, 29922, 1311, 29889, 11671, 29918, 9536, 749, 29892, 13, 9651, 4036, 29918, 3859, 29922, 8172, 29918, 3859, 29897, 13, 4706, 565, 1583, 29889, 18248, 359, 537, 6736, 29871, 29896, 29901, 13, 9651, 1596, 580, 13, 9651, 1596, 877, 29954, 1525, 29956, 2672, 1806, 25758, 390, 29965, 1307, 10490, 29901, 1495, 13, 9651, 1583, 29889, 19238, 300, 5396, 449, 29918, 1457, 4349, 580, 13, 9651, 1596, 580, 13, 13, 4706, 835, 13383, 7346, 13, 4706, 396, 24906, 29871, 29906, 29901, 20693, 326, 675, 390, 2540, 300, 13, 4706, 835, 13383, 7346, 13, 13, 4706, 363, 4256, 297, 3464, 29898, 1311, 29889, 29895, 1125, 13, 9651, 396, 6204, 716, 541, 9483, 15520, 4036, 29918, 3859, 313, 361, 22903, 29897, 13, 9651, 4256, 29918, 8172, 29918, 3859, 353, 4036, 29918, 3859, 29974, 29896, 29900, 29900, 565, 4036, 29918, 3859, 338, 451, 6213, 1683, 6213, 13, 9651, 396, 7525, 13883, 12541, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29896, 29901, 1596, 29898, 29888, 29915, 20640, 2133, 1065, 426, 1524, 29974, 29896, 29913, 310, 426, 1311, 29889, 29895, 29913, 1495, 13, 9651, 716, 842, 353, 1583, 3032, 20640, 675, 29918, 19238, 300, 29898, 1311, 29889, 19238, 300, 3383, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 544, 1540, 29918, 2311, 29922, 1311, 29889, 558, 1540, 29918, 2311, 29892, 4036, 29918, 3859, 29922, 1524, 29918, 8172, 29918, 3859, 29897, 13, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29896, 29901, 13, 18884, 1596, 580, 13, 18884, 1596, 877, 14094, 7833, 26664, 3352, 390, 29965, 1307, 10490, 29901, 1495, 13, 18884, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 1596, 29898, 29888, 29915, 1524, 362, 426, 1524, 29974, 29896, 29913, 310, 426, 1311, 29889, 29895, 1012, 29876, 9120, 6865, 426, 29961, 29875, 363, 474, 297, 3464, 29898, 2435, 29898, 1311, 29889, 19238, 300, 5396, 19238, 876, 565, 1583, 29889, 19238, 300, 5396, 19238, 29961, 29875, 29962, 19216, 716, 842, 29889, 19238, 29961, 29875, 5262, 29913, 1495, 13, 18884, 716, 842, 29889, 449, 29918, 1457, 4349, 580, 13, 18884, 1596, 580, 13, 9651, 1583, 29889, 19238, 300, 29918, 353, 716, 842, 13, 13, 4706, 835, 13383, 13383, 7346, 2277, 13, 4706, 396, 24906, 29871, 29941, 29901, 26428, 738, 1833, 9886, 13686, 3145, 13, 4706, 835, 13383, 13383, 7346, 2277, 13, 13, 4706, 926, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 353, 2967, 29889, 1066, 29918, 10052, 29918, 5451, 29898, 2176, 29892, 1583, 29889, 1990, 29918, 1725, 271, 29892, 1583, 29889, 1066, 29918, 1990, 29897, 13, 4706, 926, 29918, 1745, 17225, 353, 926, 29918, 1745, 17225, 29889, 8865, 29898, 1311, 29889, 1990, 29918, 1725, 271, 29892, 8990, 29922, 29896, 29897, 13, 4706, 3480, 29918, 1745, 17225, 353, 3480, 29918, 1745, 17225, 29889, 8865, 29898, 1311, 29889, 1990, 29918, 1725, 271, 29892, 8990, 29922, 29896, 29897, 13, 4706, 926, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 353, 2967, 29889, 1758, 29918, 11911, 287, 29898, 1311, 29889, 19238, 300, 3383, 926, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 29897, 13, 4706, 565, 7431, 29898, 1066, 29918, 1745, 17225, 15410, 29922, 29896, 29901, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 13, 18884, 1596, 29898, 29888, 29915, 29912, 2435, 29898, 1066, 29918, 1745, 17225, 2915, 926, 2175, 29889, 402, 798, 292, 2186, 6865, 856, 1495, 13, 9651, 716, 842, 353, 1583, 3032, 29887, 798, 29918, 19238, 300, 29898, 1066, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 29892, 2847, 29918, 19238, 300, 29922, 1311, 29889, 19238, 300, 3383, 13, 18884, 544, 1540, 29918, 2311, 29922, 1311, 29889, 558, 1540, 29918, 2311, 29892, 270, 29880, 29918, 9536, 749, 29922, 1311, 29889, 11671, 29918, 9536, 749, 29892, 13, 18884, 4036, 29918, 3859, 29922, 8172, 29918, 3859, 29897, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29896, 29901, 13, 18884, 1596, 877, 29954, 1525, 29956, 383, 1177, 1964, 390, 29965, 17101, 1495, 13, 18884, 716, 842, 29889, 449, 29918, 1457, 4349, 580, 13, 18884, 1596, 580, 13, 9651, 1583, 29889, 19238, 300, 29918, 353, 716, 842, 13, 4706, 1683, 29901, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29896, 29901, 1596, 877, 3596, 926, 10664, 29905, 29876, 1495, 13, 13, 4706, 835, 13383, 13383, 7346, 4136, 2277, 13, 4706, 396, 24906, 29871, 29946, 29901, 15154, 738, 6865, 393, 1016, 29915, 29873, 11157, 270, 29880, 13, 4706, 835, 13383, 13383, 7346, 4136, 2277, 13, 13, 4706, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 1596, 877, 20624, 326, 5281, 270, 29880, 856, 1495, 13, 4706, 286, 11671, 29918, 6484, 29892, 903, 353, 903, 2288, 29918, 7827, 29918, 14836, 29898, 1311, 29889, 19238, 300, 3383, 1583, 29889, 19238, 300, 5396, 27338, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 13, 462, 462, 4706, 1900, 6484, 29918, 11671, 29922, 5574, 29892, 3240, 29918, 13318, 6484, 29922, 5574, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 4706, 1583, 29889, 19238, 300, 29918, 353, 286, 11671, 29918, 6484, 13, 4706, 565, 1583, 29889, 18248, 359, 537, 18572, 29896, 29901, 13, 9651, 1596, 877, 29943, 1177, 1964, 390, 29965, 1307, 10490, 29901, 1495, 13, 9651, 1583, 29889, 19238, 300, 5396, 449, 29918, 1457, 4349, 580, 13, 9651, 1596, 580, 13, 13, 1678, 822, 8500, 29898, 1311, 29892, 1060, 29918, 2176, 29892, 2367, 29918, 276, 7040, 29922, 8824, 1125, 13, 4706, 9995, 21099, 919, 4413, 310, 848, 773, 263, 390, 5690, 13171, 29899, 9202, 1904, 29889, 13, 13, 9651, 6389, 29901, 13, 18884, 1060, 29918, 2176, 529, 17271, 23917, 6455, 304, 1207, 27303, 373, 29889, 13, 13, 18884, 2367, 29918, 276, 7040, 313, 25253, 29897, 529, 11227, 23917, 3692, 304, 3867, 9590, 363, 1269, 18988, 1754, 29889, 13, 13, 9651, 3639, 29901, 13, 18884, 1051, 310, 529, 11227, 29958, 1819, 6590, 304, 6455, 29889, 5852, 14088, 6374, 25383, 770, 29936, 7700, 1661, 29899, 1066, 3321, 770, 29889, 13, 13, 18884, 960, 2367, 29918, 276, 7040, 338, 5852, 29892, 3639, 263, 18761, 393, 3743, 278, 2038, 1051, 310, 27303, 13, 462, 1678, 322, 263, 1051, 310, 278, 6590, 9590, 363, 1269, 18988, 29936, 13, 462, 1678, 363, 1269, 6374, 18988, 29892, 4076, 263, 1051, 310, 599, 278, 21653, 390, 2540, 29892, 363, 8178, 27303, 29892, 385, 4069, 1051, 29889, 13, 4706, 9995, 13, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 19238, 300, 29918, 29374, 13, 9651, 12020, 23833, 2392, 877, 3492, 881, 6216, 263, 390, 5690, 13171, 1203, 1434, 3907, 27303, 411, 372, 29889, 1495, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 19238, 300, 5396, 27711, 29898, 29990, 29918, 2176, 29892, 2367, 29918, 276, 7040, 29922, 29887, 573, 29918, 276, 7040, 29897, 13, 13, 1678, 822, 8158, 29898, 1311, 29892, 1060, 29892, 343, 29892, 8158, 29918, 2220, 29922, 13628, 29918, 562, 2764, 4135, 1125, 13, 4706, 9995, 4321, 4180, 310, 263, 390, 5690, 13171, 29899, 9202, 1904, 29889, 13, 13, 9651, 1060, 29901, 529, 17271, 29958, 310, 7417, 8393, 13, 9651, 343, 29901, 529, 17271, 29958, 470, 529, 1524, 519, 29958, 310, 9686, 14278, 3646, 1819, 13, 13, 9651, 8158, 29918, 2220, 313, 25253, 1125, 740, 393, 4893, 1023, 4128, 29901, 3935, 29879, 529, 1524, 519, 29966, 11227, 6778, 29892, 27303, 529, 1524, 519, 29966, 11227, 6778, 29892, 13, 462, 462, 539, 6943, 770, 1819, 29889, 313, 4381, 29922, 562, 2764, 4135, 29897, 13, 462, 462, 539, 445, 3443, 338, 9146, 304, 367, 15878, 411, 2071, 19668, 29915, 29879, 26654, 3168, 29901, 13, 462, 462, 539, 2045, 597, 26167, 7354, 29899, 19668, 29889, 990, 29914, 13844, 29914, 7576, 29914, 4299, 29918, 24219, 362, 29889, 1420, 29937, 1990, 2450, 29899, 2527, 10817, 13, 4706, 9995, 13, 13, 4706, 27303, 353, 1583, 29889, 27711, 29898, 29990, 29897, 13, 4706, 565, 1134, 29898, 29891, 29897, 1360, 15926, 29889, 3221, 29889, 2557, 29889, 17271, 29901, 13, 9651, 3935, 29879, 353, 518, 25675, 1360, 1311, 29889, 1066, 29918, 1990, 363, 343, 29875, 297, 343, 29889, 25027, 391, 580, 29962, 13, 4706, 1683, 29901, 13, 9651, 3935, 29879, 353, 518, 25675, 1360, 1311, 29889, 1066, 29918, 1990, 363, 343, 29875, 297, 343, 29962, 13, 4706, 736, 8158, 29918, 2220, 29898, 19304, 29879, 29892, 27303, 29897, 13, 13, 1678, 822, 903, 842, 29918, 14138, 29918, 11671, 29918, 20401, 29898, 1311, 29892, 4489, 29892, 2159, 29922, 29896, 29945, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 4706, 9995, 4721, 15807, 403, 5751, 6368, 270, 3137, 363, 5164, 29899, 29879, 1891, 6865, 29889, 9995, 13, 13, 4706, 1583, 29889, 11671, 29918, 8977, 353, 6571, 13, 13, 4706, 5694, 353, 390, 2540, 300, 580, 13, 4706, 5694, 3032, 842, 29918, 27338, 29918, 1116, 29879, 29898, 2176, 29892, 4489, 29897, 13, 4706, 1950, 29918, 1116, 29879, 353, 5694, 29889, 27338, 29918, 1116, 29879, 13, 13, 4706, 363, 302, 297, 3464, 29898, 29896, 29892, 2159, 29974, 29896, 1125, 13, 9651, 5751, 353, 27308, 4197, 10983, 877, 29918, 3788, 29918, 1495, 14178, 29876, 29897, 13, 9651, 270, 29880, 353, 903, 29878, 29918, 14138, 29918, 14836, 29898, 7491, 29892, 1950, 29918, 1116, 29879, 29892, 9978, 29918, 8977, 29922, 8516, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 9651, 1583, 29889, 11671, 29918, 8977, 29961, 29876, 29962, 353, 270, 29880, 13, 9651, 565, 9750, 359, 537, 18572, 29906, 29901, 13, 18884, 1596, 29898, 29888, 29915, 21402, 270, 29880, 363, 5751, 2159, 426, 29876, 6177, 426, 11671, 29913, 1495, 13, 13, 1678, 822, 903, 29887, 798, 29918, 19238, 300, 29898, 1311, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 544, 1540, 29918, 2311, 29892, 270, 29880, 29918, 9536, 749, 29892, 2847, 29918, 19238, 300, 29922, 8516, 29892, 4036, 29918, 3859, 29922, 8516, 1125, 13, 4706, 9995, 402, 798, 263, 390, 2540, 300, 411, 544, 27964, 29889, 9995, 13, 4706, 926, 29918, 1745, 17225, 353, 926, 29918, 2176, 29889, 8552, 580, 13, 4706, 3480, 29918, 1745, 17225, 353, 3480, 29918, 2176, 29889, 8552, 580, 13, 13, 4706, 565, 2847, 29918, 19238, 300, 338, 6213, 29901, 13, 9651, 6865, 300, 353, 390, 2540, 300, 580, 13, 9651, 6865, 300, 3032, 842, 29918, 27338, 29918, 1116, 29879, 29898, 1066, 29918, 2176, 29892, 3480, 29918, 2176, 29897, 13, 4706, 1683, 29901, 13, 9651, 6865, 300, 353, 3509, 29889, 24535, 8552, 29898, 11228, 29918, 19238, 300, 29897, 13, 13, 4706, 6865, 300, 29918, 11671, 353, 6213, 13, 4706, 286, 11671, 353, 6213, 418, 396, 3080, 12539, 18169, 6139, 3309, 313, 262, 9978, 29897, 13, 4706, 270, 29880, 29918, 12765, 353, 29871, 29900, 13, 4706, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 13, 9651, 1596, 877, 29887, 798, 292, 6865, 300, 856, 1495, 13, 9651, 1596, 580, 13, 4706, 1550, 7431, 29898, 1066, 29918, 1745, 17225, 29897, 1405, 29871, 29900, 322, 270, 29880, 29918, 12765, 5277, 1583, 29889, 11671, 29918, 9536, 749, 29901, 13, 9651, 396, 402, 798, 29899, 558, 1540, 6219, 9886, 443, 11911, 287, 6455, 13, 9651, 926, 29918, 29887, 798, 842, 29892, 926, 29918, 558, 7844, 300, 353, 2967, 29889, 2176, 29918, 845, 3096, 839, 29918, 5451, 29898, 1066, 29918, 1745, 17225, 29892, 313, 29896, 29899, 558, 1540, 29918, 2311, 511, 4036, 29918, 3859, 29922, 8172, 29918, 3859, 29897, 13, 9651, 3480, 29918, 29887, 798, 842, 29892, 3480, 29918, 558, 7844, 300, 353, 2967, 29889, 2176, 29918, 845, 3096, 839, 29918, 5451, 29898, 10052, 29918, 1745, 17225, 29892, 313, 29896, 29899, 558, 1540, 29918, 2311, 511, 4036, 29918, 3859, 29922, 8172, 29918, 3859, 29897, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 13, 18884, 1596, 29898, 29888, 29915, 1066, 29918, 29887, 798, 842, 426, 2435, 29898, 1066, 29918, 29887, 798, 842, 2915, 926, 29918, 558, 7844, 300, 426, 2435, 29898, 1066, 29918, 558, 7844, 300, 2915, 1495, 13, 18884, 1596, 29898, 29888, 29915, 10052, 29918, 29887, 798, 842, 426, 2435, 29898, 10052, 29918, 29887, 798, 842, 2915, 3480, 29918, 558, 7844, 300, 426, 2435, 29898, 10052, 29918, 558, 7844, 300, 2915, 1495, 13, 9651, 565, 7431, 29898, 1066, 29918, 29887, 798, 842, 29897, 1360, 29900, 29901, 2867, 396, 21606, 9109, 29892, 541, 263, 2217, 17629, 29891, 304, 871, 1423, 926, 29918, 29887, 798, 842, 29889, 13, 13, 9651, 396, 402, 798, 27308, 13, 9651, 21633, 29918, 7491, 353, 2967, 29889, 29887, 798, 29918, 7491, 29898, 1066, 29918, 29887, 798, 842, 29892, 3480, 29918, 29887, 798, 842, 29892, 6865, 300, 29889, 27338, 29918, 1116, 29879, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 9651, 565, 21633, 29918, 7491, 29889, 275, 6310, 7295, 2867, 396, 3251, 630, 385, 4069, 5751, 289, 29914, 29883, 694, 1781, 2148, 29879, 1863, 13, 13, 9651, 396, 1588, 1540, 27308, 13, 9651, 544, 348, 287, 29918, 7491, 353, 2967, 29889, 558, 1540, 29918, 7491, 29898, 29887, 4708, 29918, 7491, 29892, 903, 3960, 29925, 13171, 29918, 29887, 798, 21646, 29918, 558, 1540, 29918, 16414, 29892, 926, 29918, 558, 7844, 300, 29892, 3480, 29918, 558, 7844, 300, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 13, 9651, 396, 3462, 5751, 29936, 8147, 716, 6139, 3309, 13, 9651, 6865, 300, 29889, 1202, 29898, 558, 348, 287, 29918, 7491, 29897, 396, 853, 4561, 306, 1525, 29925, 29892, 306, 1525, 29925, 3877, 3960, 29925, 13171, 25480, 4195, 338, 20978, 573, 29901, 376, 13555, 1269, 5751, 338, 2715, 29892, 278, 3001, 6139, 3309, 310, 278, 5751, 731, 322, 6455, 338, 15712, 1213, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 13, 18884, 1596, 29898, 29888, 29908, 21402, 6865, 300, 29901, 426, 19238, 300, 29889, 509, 4661, 710, 29898, 20845, 2433, 1266, 1495, 27195, 13, 18884, 1596, 580, 13, 13, 9651, 565, 6865, 300, 29918, 11671, 338, 6213, 29901, 259, 396, 3824, 27308, 304, 367, 2715, 13, 18884, 5751, 29918, 11671, 353, 903, 29878, 29918, 14138, 29918, 14836, 29898, 558, 348, 287, 29918, 7491, 29892, 6865, 300, 29889, 27338, 29918, 1116, 29879, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 18884, 6368, 29918, 11671, 353, 5751, 29918, 11671, 13, 18884, 848, 29918, 11671, 353, 903, 11739, 29879, 29918, 14836, 29898, 19238, 300, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 18884, 6865, 300, 29918, 11671, 353, 6368, 29918, 11671, 718, 848, 29918, 11671, 13, 18884, 286, 11671, 353, 6865, 300, 29918, 11671, 13, 9651, 1683, 29901, 13, 18884, 5751, 29918, 11671, 353, 903, 29878, 29918, 14138, 29918, 14836, 29898, 558, 348, 287, 29918, 7491, 29892, 6865, 300, 29889, 27338, 29918, 1116, 29879, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 18884, 6368, 29918, 11671, 4619, 5751, 29918, 11671, 13, 18884, 848, 29918, 11671, 353, 903, 11739, 29879, 29918, 14836, 29898, 19238, 300, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 18884, 6865, 300, 29918, 11671, 353, 6368, 29918, 11671, 718, 848, 29918, 11671, 13, 18884, 270, 29880, 29918, 12765, 353, 6865, 300, 29918, 11671, 448, 286, 11671, 13, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 13, 18884, 1596, 29898, 29888, 29915, 7491, 270, 29880, 29901, 426, 29878, 299, 29898, 7491, 29918, 11671, 2915, 1495, 13, 18884, 1596, 29898, 29888, 29915, 21402, 6368, 270, 29880, 29901, 426, 29878, 299, 29898, 14138, 29918, 11671, 2915, 1495, 13, 18884, 1596, 29898, 29888, 29915, 11739, 29879, 29901, 426, 29878, 299, 29898, 1272, 29918, 11671, 2915, 1495, 13, 18884, 1596, 29898, 29888, 29915, 7827, 270, 29880, 29901, 426, 29878, 299, 29898, 19238, 300, 29918, 11671, 2915, 1495, 13, 18884, 565, 270, 29880, 29918, 12765, 14065, 1311, 29889, 11671, 29918, 9536, 749, 29901, 13, 462, 1678, 1596, 29898, 29888, 29915, 3487, 29880, 426, 29878, 299, 29898, 3487, 29880, 2915, 313, 12765, 426, 29878, 299, 29898, 11671, 29918, 12765, 2915, 5277, 426, 29878, 299, 29898, 1311, 29889, 11671, 29918, 9536, 749, 26972, 1495, 13, 18884, 1683, 29901, 13, 462, 1678, 1596, 29898, 29888, 29915, 3487, 29880, 426, 29878, 299, 29898, 3487, 29880, 2915, 270, 29880, 29899, 10647, 29901, 2923, 426, 29878, 299, 29898, 11671, 29918, 12765, 2915, 13461, 29879, 2758, 749, 21313, 29878, 299, 29898, 1311, 29889, 11671, 29918, 9536, 749, 26972, 1495, 13, 13, 9651, 286, 11671, 353, 6865, 300, 29918, 11671, 565, 6865, 300, 29918, 11671, 29966, 3487, 29880, 1683, 286, 11671, 13, 13, 9651, 396, 15154, 10664, 6455, 13, 9651, 926, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 353, 2967, 29889, 1758, 29918, 11911, 287, 29898, 558, 348, 287, 29918, 7491, 29892, 926, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 29897, 13, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 13, 18884, 1596, 29898, 29888, 29915, 19057, 9886, 29901, 426, 2435, 29898, 1066, 29918, 1745, 17225, 2915, 926, 29892, 426, 2435, 29898, 10052, 29918, 1745, 17225, 2915, 3480, 1495, 13, 18884, 1596, 580, 13, 4706, 736, 6865, 300, 13, 13, 1678, 822, 903, 20640, 675, 29918, 19238, 300, 29898, 1311, 29892, 6865, 300, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 544, 1540, 29918, 2311, 29892, 4036, 29918, 3859, 29922, 8516, 1125, 13, 4706, 9995, 20693, 326, 2133, 8576, 29889, 9995, 13, 13, 4706, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 13, 9651, 1596, 877, 20640, 5281, 6865, 300, 856, 1495, 13, 9651, 1596, 580, 13, 13, 4706, 926, 29918, 1745, 17225, 353, 926, 29918, 2176, 29889, 8552, 580, 13, 4706, 3480, 29918, 1745, 17225, 353, 3480, 29918, 2176, 29889, 8552, 580, 13, 4706, 2441, 29918, 19238, 300, 353, 3509, 29889, 24535, 8552, 29898, 19238, 300, 29897, 13, 4706, 565, 1583, 29889, 18248, 359, 537, 18572, 29946, 29901, 1596, 877, 15807, 403, 2441, 6865, 300, 7037, 270, 29880, 856, 1495, 13, 4706, 2441, 29918, 11671, 353, 903, 2288, 29918, 7827, 29918, 14836, 29898, 13492, 29918, 19238, 300, 29892, 2441, 29918, 19238, 300, 29889, 27338, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 1900, 6484, 29918, 11671, 29922, 5574, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 4706, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 13, 9651, 1596, 29898, 29888, 29915, 13492, 6865, 300, 7037, 270, 29880, 29901, 426, 29878, 299, 29898, 13492, 29918, 11671, 2915, 1495, 13, 9651, 1596, 580, 13, 4706, 716, 29918, 19238, 300, 353, 3509, 29889, 24535, 8552, 29898, 19238, 300, 29897, 13, 13, 4706, 363, 474, 29892, 5751, 297, 26985, 29898, 13492, 29918, 19238, 300, 29889, 19238, 1125, 13, 9651, 926, 29918, 29887, 798, 842, 29892, 926, 29918, 558, 7844, 300, 353, 2967, 29889, 2176, 29918, 845, 3096, 839, 29918, 5451, 29898, 1066, 29918, 1745, 17225, 29892, 313, 29896, 29899, 558, 1540, 29918, 2311, 511, 4036, 29918, 3859, 29922, 8172, 29918, 3859, 29897, 13, 9651, 3480, 29918, 29887, 798, 842, 29892, 3480, 29918, 558, 7844, 300, 353, 2967, 29889, 2176, 29918, 845, 3096, 839, 29918, 5451, 29898, 10052, 29918, 1745, 17225, 29892, 313, 29896, 29899, 558, 1540, 29918, 2311, 511, 4036, 29918, 3859, 29922, 8172, 29918, 3859, 29897, 13, 9651, 565, 7431, 29898, 1066, 29918, 29887, 798, 842, 29897, 1275, 29871, 29900, 29901, 2867, 396, 20049, 988, 13883, 1065, 1405, 29871, 29896, 13, 13, 9651, 396, 6204, 8671, 6865, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29946, 29901, 1596, 29898, 29888, 29915, 1037, 1218, 16920, 363, 426, 29875, 29913, 310, 426, 2435, 29898, 13492, 29918, 19238, 300, 29889, 19238, 2915, 29901, 426, 19238, 300, 29889, 19238, 29961, 29875, 12258, 1495, 13, 9651, 330, 29918, 3445, 9552, 353, 2967, 29889, 29887, 798, 29918, 7491, 29898, 1066, 29918, 29887, 798, 842, 29892, 3480, 29918, 29887, 798, 842, 29892, 2441, 29918, 19238, 300, 29889, 27338, 29918, 1116, 29879, 29892, 2847, 29918, 7491, 29922, 10740, 3285, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 9651, 16920, 29918, 19238, 300, 353, 390, 2540, 300, 29898, 3188, 29889, 29875, 29918, 3445, 433, 1133, 29898, 13492, 29918, 19238, 300, 29889, 19238, 29892, 474, 29892, 330, 29918, 3445, 9552, 876, 13, 9651, 544, 29918, 3445, 9552, 353, 2967, 29889, 558, 1540, 29918, 7491, 29898, 29887, 29918, 3445, 9552, 29892, 903, 3960, 29925, 13171, 29918, 20640, 2133, 29918, 558, 1540, 29918, 16414, 29892, 926, 29918, 558, 7844, 300, 29892, 3480, 29918, 558, 7844, 300, 29892, 19745, 29918, 2248, 29918, 265, 29918, 19238, 300, 7607, 29875, 29892, 3445, 9552, 29918, 19238, 300, 511, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 9651, 16920, 29918, 19238, 300, 353, 390, 2540, 300, 29898, 3188, 29889, 29875, 29918, 3445, 433, 1133, 29898, 13492, 29918, 19238, 300, 29889, 19238, 29892, 474, 29892, 544, 29918, 3445, 9552, 876, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 13, 18884, 1596, 29898, 29888, 29915, 29887, 3973, 16920, 426, 29887, 29918, 3445, 9552, 29913, 1495, 13, 18884, 1596, 29898, 29888, 29915, 558, 348, 287, 16920, 338, 426, 558, 29918, 3445, 9552, 29913, 1495, 13, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 1596, 29898, 29888, 29915, 1037, 1218, 26554, 363, 426, 29875, 29913, 310, 426, 2435, 29898, 13492, 29918, 19238, 300, 29889, 19238, 2915, 29901, 426, 19238, 300, 29889, 19238, 29961, 29875, 12258, 1495, 13, 9651, 330, 29918, 276, 4924, 353, 2967, 29889, 29887, 798, 29918, 7491, 29898, 1066, 29918, 29887, 798, 842, 29892, 3480, 29918, 29887, 798, 842, 29892, 2441, 29918, 19238, 300, 29889, 27338, 29918, 1116, 29879, 29892, 2847, 29918, 7491, 29922, 19238, 300, 29889, 19238, 29961, 29875, 1402, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 9651, 26554, 29918, 19238, 300, 353, 390, 2540, 300, 29898, 3188, 29889, 29875, 29918, 3445, 433, 1133, 29898, 13492, 29918, 19238, 300, 29889, 19238, 29892, 474, 29892, 330, 29918, 276, 4924, 876, 13, 9651, 544, 29918, 276, 4924, 353, 2967, 29889, 558, 1540, 29918, 7491, 29898, 29887, 29918, 276, 4924, 29892, 903, 3960, 29925, 13171, 29918, 20640, 2133, 29918, 558, 1540, 29918, 16414, 29892, 926, 29918, 558, 7844, 300, 29892, 3480, 29918, 558, 7844, 300, 29892, 19745, 29918, 2248, 29918, 265, 29918, 19238, 300, 7607, 29875, 29892, 276, 4924, 29918, 19238, 300, 511, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 29897, 13, 9651, 26554, 29918, 19238, 300, 353, 390, 2540, 300, 29898, 3188, 29889, 29875, 29918, 3445, 433, 1133, 29898, 13492, 29918, 19238, 300, 29889, 19238, 29892, 474, 29892, 544, 29918, 276, 4924, 876, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 13, 18884, 1596, 29898, 29888, 29915, 29887, 3973, 26554, 426, 29887, 29918, 3445, 9552, 29913, 1495, 13, 18884, 1596, 29898, 29888, 29915, 558, 348, 287, 26554, 338, 426, 558, 29918, 3445, 9552, 29913, 1495, 13, 18884, 1596, 580, 13, 13, 9651, 396, 20535, 403, 8671, 390, 2540, 1691, 29915, 18067, 19604, 7037, 270, 3137, 304, 12439, 278, 1900, 1873, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 1596, 29898, 29888, 29915, 15807, 403, 7037, 270, 29880, 363, 18031, 411, 16920, 426, 558, 29918, 3445, 9552, 29913, 1495, 13, 9651, 16920, 29918, 11671, 353, 903, 2288, 29918, 7827, 29918, 14836, 29898, 3445, 9552, 29918, 19238, 300, 29892, 2441, 29918, 19238, 300, 29889, 27338, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 1900, 6484, 29918, 11671, 29922, 5574, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 2144, 13, 462, 632, 565, 544, 29918, 3445, 9552, 19216, 7491, 1683, 2441, 29918, 11671, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 1596, 29898, 29888, 29915, 15807, 403, 7037, 270, 29880, 363, 18031, 411, 26554, 426, 558, 29918, 276, 4924, 29913, 1495, 13, 9651, 26554, 29918, 11671, 353, 903, 2288, 29918, 7827, 29918, 14836, 29898, 276, 4924, 29918, 19238, 300, 29892, 2441, 29918, 19238, 300, 29889, 27338, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 1900, 6484, 29918, 11671, 29922, 5574, 29892, 9750, 359, 537, 29922, 1311, 29889, 18248, 359, 537, 2144, 13, 462, 3986, 565, 544, 29918, 276, 4924, 19216, 7491, 1683, 2441, 29918, 11671, 13, 9651, 1900, 29918, 7491, 353, 518, 7491, 29892, 544, 29918, 3445, 9552, 29892, 544, 29918, 276, 4924, 3816, 3188, 29889, 1191, 1195, 4197, 13492, 29918, 11671, 29892, 16920, 29918, 11671, 29892, 26554, 29918, 11671, 2314, 29962, 13, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29906, 29901, 13, 18884, 1596, 29898, 29888, 12764, 29876, 7491, 426, 29875, 29974, 29896, 29913, 310, 426, 2435, 29898, 13492, 29918, 19238, 300, 29889, 19238, 2915, 1495, 13, 18884, 1634, 29918, 710, 353, 544, 29918, 3445, 9552, 17255, 710, 1649, 580, 565, 544, 29918, 3445, 9552, 19216, 7491, 1683, 525, 3322, 4618, 29915, 13, 18884, 6664, 29918, 710, 353, 544, 29918, 276, 4924, 17255, 710, 1649, 580, 565, 544, 29918, 276, 4924, 19216, 7491, 1683, 525, 3322, 4618, 29915, 13, 18884, 1900, 29918, 710, 353, 1900, 29918, 7491, 17255, 710, 1649, 580, 565, 1900, 29918, 7491, 19216, 7491, 1683, 525, 3322, 4618, 29915, 13, 18884, 565, 1583, 29889, 18248, 359, 537, 1360, 29906, 29901, 13, 462, 1678, 1596, 29898, 29888, 29915, 13492, 29901, 426, 7491, 29913, 1495, 13, 462, 1678, 1596, 29898, 29888, 29915, 3445, 9552, 29901, 426, 3445, 29918, 710, 29913, 1495, 13, 462, 1678, 1596, 29898, 29888, 29915, 276, 4924, 29901, 426, 13478, 29918, 710, 29913, 1495, 13, 462, 1678, 1596, 29898, 29888, 29915, 29930, 13318, 29901, 426, 13318, 29918, 710, 29913, 1495, 13, 462, 1678, 1596, 580, 13, 18884, 1683, 29901, 13, 462, 1678, 1596, 29898, 29888, 29915, 13492, 29901, 426, 7491, 1800, 891, 426, 29878, 299, 29898, 13492, 29918, 11671, 2915, 9978, 1495, 13, 462, 1678, 1596, 29898, 29888, 29915, 3445, 9552, 29901, 426, 3445, 29918, 710, 29913, 891, 426, 29878, 299, 29898, 3445, 9552, 29918, 11671, 2915, 9978, 1495, 13, 462, 1678, 1596, 29898, 29888, 29915, 276, 4924, 29901, 426, 13478, 29918, 710, 29913, 891, 426, 29878, 299, 29898, 276, 4924, 29918, 11671, 2915, 9978, 1495, 13, 462, 1678, 1596, 29898, 29888, 29915, 29930, 13318, 29901, 426, 13318, 29918, 710, 29913, 891, 426, 29878, 299, 29898, 1195, 4197, 3445, 9552, 29918, 11671, 29892, 26554, 29918, 11671, 29892, 2441, 29918, 11671, 12622, 29913, 9978, 1495, 13, 462, 1678, 1596, 580, 13, 9651, 716, 29918, 19238, 300, 29889, 19238, 29961, 29875, 29962, 353, 1900, 29918, 7491, 13, 13, 9651, 396, 15154, 10664, 6455, 13, 9651, 926, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 353, 2967, 29889, 1758, 29918, 11911, 287, 29898, 7491, 29892, 926, 29918, 1745, 17225, 29892, 3480, 29918, 1745, 17225, 29897, 13, 9651, 565, 1583, 29889, 18248, 359, 537, 18572, 29941, 29901, 13, 18884, 1596, 29898, 29888, 29915, 19057, 9886, 29901, 426, 2435, 29898, 1066, 29918, 1745, 17225, 2915, 926, 29892, 426, 2435, 29898, 10052, 29918, 1745, 17225, 2915, 3480, 1495, 13, 18884, 1596, 580, 13, 13, 9651, 396, 960, 727, 526, 694, 926, 848, 9886, 304, 7945, 13883, 313, 26680, 3799, 565, 13883, 1065, 1405, 29896, 511, 3013, 9886, 6865, 278, 1021, 13, 9651, 565, 7431, 29898, 1066, 29918, 1745, 17225, 29897, 1360, 29900, 29901, 2867, 13, 13, 4706, 736, 716, 29918, 19238, 300, 13, 13, 1678, 822, 903, 842, 29918, 27338, 29918, 1116, 29879, 29898, 1311, 29892, 4489, 1125, 13, 4706, 1583, 29889, 27338, 29918, 1116, 29879, 353, 5159, 13, 4706, 363, 1238, 271, 297, 4489, 29889, 13099, 29889, 5975, 29901, 13, 9651, 363, 659, 297, 4489, 29961, 1725, 271, 1822, 13092, 7295, 13, 18884, 1583, 29889, 27338, 29918, 1116, 29879, 29889, 4397, 29898, 10983, 29898, 1725, 271, 29892, 659, 876, 13, 13, 4136, 379, 6670, 13171, 4134, 16101, 13, 13, 1990, 390, 2540, 300, 25060, 29901, 13, 1678, 396, 910, 770, 338, 451, 1304, 297, 278, 1857, 5314, 541, 1033, 2041, 297, 1361, 29891, 363, 5434, 13883, 13, 1678, 396, 491, 15446, 322, 22162, 4357, 17203, 393, 1122, 367, 10324, 29889, 29871, 13, 1678, 396, 379, 3496, 29915, 29873, 11039, 630, 372, 1363, 727, 526, 16600, 9427, 304, 285, 719, 29892, 13883, 29899, 3538, 29889, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 6484, 29918, 29881, 3137, 353, 5159, 13, 4706, 1583, 29889, 19238, 300, 353, 390, 2540, 300, 580, 13, 4706, 1583, 29889, 11671, 353, 29871, 29900, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 6865, 300, 29892, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 13, 4706, 396, 10987, 937, 29635, 292, 5751, 2380, 13, 4706, 396, 960, 727, 338, 694, 29635, 29892, 736, 13, 4706, 396, 960, 727, 338, 263, 29635, 29892, 2767, 1583, 29889, 19238, 300, 322, 281, 15705, 15352, 270, 3137, 13, 4706, 2380, 353, 29871, 29900, 13, 4706, 1550, 2380, 529, 7431, 29898, 1311, 29889, 19238, 300, 29897, 322, 320, 13, 795, 2380, 529, 7431, 29898, 19238, 300, 29897, 322, 320, 13, 795, 1583, 29889, 19238, 300, 29961, 2248, 29962, 1275, 6865, 300, 29961, 2248, 5387, 13, 9651, 2380, 4619, 29871, 29896, 13, 4706, 565, 2380, 1275, 7431, 29898, 19238, 300, 29897, 322, 2380, 1275, 7431, 29898, 1311, 29889, 19238, 300, 1125, 13, 9651, 565, 9750, 359, 537, 18572, 29946, 29901, 1596, 29898, 29888, 29915, 1333, 13271, 22663, 1192, 694, 6865, 300, 1735, 1476, 1495, 13, 9651, 736, 13, 4706, 565, 9750, 359, 537, 18572, 29946, 29901, 1596, 29898, 29888, 29915, 786, 26747, 22663, 515, 2380, 426, 2248, 29913, 1495, 13, 4706, 1583, 29889, 19238, 300, 29889, 19238, 29961, 2248, 17531, 353, 6865, 300, 29961, 2248, 17531, 13, 4706, 1583, 29889, 6484, 29918, 29881, 3137, 353, 1583, 29889, 6484, 29918, 29881, 3137, 7503, 2248, 29962, 13, 13, 4706, 396, 14893, 1076, 411, 2380, 29892, 2767, 11306, 270, 3137, 13, 4706, 363, 474, 297, 3464, 29898, 2248, 29892, 7431, 29898, 19238, 300, 22164, 13, 9651, 5751, 353, 6865, 300, 29961, 29875, 29962, 13, 9651, 11306, 353, 390, 2540, 300, 29898, 19238, 300, 29889, 19238, 7503, 29875, 29974, 29896, 2314, 13, 9651, 11306, 29918, 11671, 353, 903, 2288, 29918, 7827, 29918, 14836, 29898, 6484, 29892, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 9651, 1583, 29889, 6484, 29918, 29881, 3137, 29889, 4397, 29898, 6484, 29918, 11671, 29897, 13, 13, 4706, 1583, 29889, 11671, 353, 1583, 29889, 6484, 29918, 29881, 3137, 14352, 29896, 29962, 13, 13, 1678, 822, 270, 29880, 29918, 3167, 29898, 1311, 29892, 2380, 1125, 13, 4706, 736, 1583, 29889, 6484, 29918, 29881, 3137, 29961, 2248, 29962, 448, 1583, 29889, 6484, 29918, 29881, 3137, 29961, 2248, 29899, 29896, 29962, 13, 13, 1678, 822, 7037, 29918, 11671, 29918, 16202, 29898, 1311, 29892, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 13, 462, 3986, 3240, 29918, 19238, 300, 29922, 5574, 29892, 3240, 29918, 11671, 29922, 8824, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 4706, 565, 451, 738, 3552, 2267, 29918, 19238, 300, 29892, 3240, 29918, 11671, 22164, 13, 9651, 12020, 7865, 2392, 877, 5696, 270, 29880, 29918, 558, 348, 287, 29918, 19238, 300, 2000, 1728, 738, 736, 1819, 6790, 1495, 13, 13, 4706, 5694, 25060, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29897, 13, 4706, 474, 353, 7431, 29898, 7382, 25060, 29889, 19238, 300, 29897, 448, 29871, 29896, 13, 4706, 1550, 474, 1405, 29871, 29900, 29901, 13, 9651, 565, 5694, 25060, 29889, 11671, 29918, 3167, 29898, 29875, 29897, 1405, 29871, 29900, 29901, 13, 18884, 565, 9750, 359, 537, 18572, 29946, 29901, 1596, 29898, 29888, 29915, 7491, 426, 29875, 29913, 10425, 270, 29880, 1192, 11077, 1495, 13, 18884, 5694, 25060, 29889, 5504, 29898, 29934, 2540, 300, 29898, 7382, 25060, 29889, 19238, 300, 7503, 29875, 10062, 7382, 25060, 29889, 19238, 300, 29961, 29875, 29974, 29896, 29901, 11724, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29897, 13, 18884, 565, 9750, 359, 537, 18572, 29946, 29901, 1596, 29898, 29888, 29915, 1482, 6865, 300, 338, 426, 7382, 25060, 29889, 19238, 300, 29913, 1495, 13, 9651, 474, 22361, 29871, 29896, 13, 13, 4706, 736, 5694, 25060, 13, 13, 13, 13383, 13383, 2277, 29937, 13, 4136, 29937, 390, 5690, 13171, 29899, 14940, 4737, 10817, 16101, 13, 13383, 13383, 2277, 29937, 13, 13, 1753, 903, 3960, 29925, 13171, 29918, 29887, 798, 21646, 29918, 558, 1540, 29918, 16414, 29898, 7491, 29892, 926, 29918, 558, 7844, 300, 29892, 3480, 29918, 558, 7844, 300, 1125, 13, 1678, 9995, 390, 5690, 13171, 29914, 29902, 1525, 29925, 29930, 544, 1540, 12714, 29889, 13, 4706, 16969, 278, 544, 1540, 995, 310, 263, 14020, 27308, 29889, 13, 13, 4706, 315, 14899, 29915, 29879, 7063, 338, 313, 29886, 29899, 29876, 29897, 847, 313, 29886, 29974, 29876, 467, 13, 4706, 853, 8551, 515, 278, 5650, 920, 896, 4386, 1933, 9171, 313, 3062, 282, 29974, 29876, 29922, 29900, 511, 577, 306, 20298, 433, 1133, 372, 29889, 13, 4706, 1334, 1335, 29915, 29879, 1650, 471, 304, 6623, 278, 7063, 304, 313, 29886, 29974, 29896, 6802, 29898, 29886, 29974, 29876, 29974, 29906, 511, 541, 278, 313, 5464, 29899, 19377, 29897, 1819, 306, 2355, 7470, 17649, 304, 1906, 310, 278, 2441, 7063, 29889, 13, 1678, 9995, 13, 1678, 396, 306, 14034, 1334, 1335, 29915, 29879, 338, 29871, 29896, 29914, 29906, 1363, 393, 29915, 29879, 17649, 304, 263, 29871, 29945, 29900, 29899, 29945, 29900, 770, 4978, 29973, 13, 1678, 282, 353, 5751, 29889, 1949, 29918, 11911, 287, 29898, 1066, 29918, 558, 7844, 300, 29897, 13, 1678, 302, 353, 5751, 29889, 1949, 29918, 11911, 287, 29898, 10052, 29918, 558, 7844, 300, 29897, 13, 1678, 736, 313, 29886, 448, 302, 718, 29871, 29896, 29897, 847, 313, 29886, 718, 302, 718, 29871, 29896, 29897, 13, 13, 1753, 903, 3960, 29925, 13171, 29918, 20640, 2133, 29918, 558, 1540, 29918, 16414, 29898, 7491, 29892, 926, 29918, 558, 7844, 300, 29892, 3480, 29918, 558, 7844, 300, 1125, 13, 1678, 736, 2967, 29889, 562, 2764, 4135, 29898, 7491, 29892, 926, 29918, 558, 7844, 300, 29892, 3480, 29918, 558, 7844, 300, 29897, 13, 13, 1753, 903, 29878, 29918, 14138, 29918, 14836, 29898, 7491, 29892, 1950, 29918, 1116, 29879, 29892, 9978, 29918, 8977, 29922, 8516, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 1678, 9995, 16969, 6139, 3309, 313, 262, 9978, 29897, 363, 263, 2323, 27308, 29889, 9995, 13, 13, 1678, 565, 756, 5552, 29898, 7491, 29892, 525, 11671, 29374, 13, 4706, 736, 5751, 29889, 11671, 13, 1678, 1683, 29901, 13, 4706, 565, 1134, 29898, 7491, 29897, 2804, 27308, 29901, 13, 9651, 12020, 20948, 29898, 29888, 29915, 3207, 5751, 297, 903, 29878, 29918, 14138, 29918, 14836, 881, 367, 1134, 27308, 1495, 13, 4706, 413, 353, 7431, 29898, 7491, 29889, 1116, 29879, 29897, 462, 462, 396, 9681, 310, 5751, 5855, 13, 4706, 302, 353, 7431, 29898, 27338, 29918, 1116, 29879, 29897, 462, 632, 396, 9681, 310, 1950, 5855, 13, 4706, 544, 353, 413, 29914, 29876, 13, 13, 4706, 317, 353, 413, 29930, 755, 29889, 1188, 29906, 29898, 29896, 29914, 558, 29897, 718, 313, 29876, 29899, 29895, 11877, 755, 29889, 1188, 29906, 3552, 29896, 14571, 29896, 29899, 558, 4961, 29871, 396, 317, 29898, 29876, 29892, 413, 29892, 544, 29897, 13, 4706, 476, 353, 5844, 29889, 1188, 29906, 29898, 29895, 29897, 462, 462, 268, 396, 9681, 9978, 817, 304, 3638, 6043, 413, 13, 4706, 5751, 29918, 11671, 353, 29871, 29900, 29889, 29945, 16395, 29968, 718, 317, 29897, 462, 18884, 396, 4910, 680, 491, 29871, 29906, 263, 425, 751, 262, 6468, 29889, 315, 14899, 29901, 376, 517, 10365, 363, 1950, 22275, 3819, 297, 8393, 29908, 13, 4706, 565, 9750, 359, 537, 18572, 29945, 29901, 1596, 29898, 29888, 29915, 7491, 6368, 9978, 29989, 426, 7491, 29913, 413, 426, 29895, 29913, 302, 426, 29876, 29913, 544, 426, 29878, 299, 29898, 558, 2915, 29901, 426, 29878, 299, 29898, 7491, 29918, 11671, 2915, 9978, 1495, 13, 13, 4706, 396, 7491, 29889, 11671, 353, 5751, 29918, 11671, 13, 4706, 736, 5751, 29918, 11671, 13, 13, 1753, 903, 2288, 29918, 14138, 29918, 14836, 29898, 19238, 300, 29892, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 1678, 9995, 16969, 6368, 6139, 3309, 313, 262, 9978, 29897, 363, 263, 390, 2540, 300, 29889, 9995, 13, 13, 1678, 565, 1134, 29898, 19238, 300, 29897, 2804, 390, 2540, 300, 29901, 13, 4706, 12020, 20948, 29898, 29888, 29915, 3207, 6865, 300, 297, 903, 2288, 29918, 14138, 29918, 14836, 881, 367, 1134, 390, 2540, 300, 1495, 13, 1678, 9995, 16969, 2533, 310, 6368, 9978, 363, 1269, 27308, 297, 6865, 300, 9995, 13, 1678, 3001, 353, 29871, 29900, 13, 1678, 363, 5751, 297, 6865, 300, 29889, 19238, 29901, 13, 4706, 3001, 4619, 903, 29878, 29918, 14138, 29918, 14836, 29898, 7491, 29892, 1950, 29918, 1116, 29879, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 4706, 396, 7827, 4619, 5751, 29918, 14836, 29898, 7491, 29892, 1950, 29918, 1116, 29879, 29892, 1083, 29918, 1066, 29892, 1083, 29918, 10052, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 4706, 396, 1745, 29918, 1066, 29892, 1083, 29918, 10052, 353, 2967, 29889, 1758, 29918, 11911, 287, 29898, 7491, 29892, 1083, 29918, 1066, 29892, 1083, 29918, 10052, 29897, 13, 1678, 565, 9750, 359, 537, 18572, 29945, 29901, 1596, 29898, 29888, 29915, 19238, 300, 6368, 9978, 29989, 426, 29878, 299, 29898, 7827, 2915, 1495, 13, 13, 1678, 396, 19238, 300, 29889, 11671, 353, 3001, 13, 1678, 736, 3001, 13, 13, 1753, 903, 11739, 29879, 29918, 14836, 29898, 19238, 300, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 1678, 9995, 16969, 6139, 3309, 313, 262, 9978, 29897, 363, 15283, 304, 263, 390, 2540, 300, 29915, 29879, 23746, 29889, 9995, 13, 13, 1678, 565, 1134, 29898, 19238, 300, 29897, 2804, 390, 2540, 300, 29901, 13, 4706, 12020, 20948, 29898, 29888, 29915, 517, 4772, 3765, 29899, 2798, 292, 29892, 903, 11739, 29879, 29918, 14836, 881, 8147, 15283, 975, 4152, 731, 310, 6865, 411, 1134, 390, 2540, 300, 1495, 13, 1678, 405, 353, 7431, 29898, 1066, 29918, 2176, 29897, 718, 7431, 29898, 10052, 29918, 2176, 29897, 462, 462, 396, 14990, 1353, 310, 6455, 13, 1678, 282, 353, 6865, 300, 29889, 1949, 29918, 11911, 287, 29898, 1066, 29918, 2176, 29897, 718, 6865, 300, 29889, 1949, 29918, 11911, 287, 29898, 10052, 29918, 2176, 29897, 396, 14990, 1353, 310, 6455, 770, 2164, 408, 6374, 353, 3001, 10664, 13, 1678, 285, 29886, 353, 6865, 300, 29889, 1949, 29918, 11911, 287, 29898, 10052, 29918, 2176, 29897, 462, 795, 396, 9681, 2089, 13686, 3145, 353, 3480, 5056, 10664, 491, 278, 6865, 300, 13, 1678, 7876, 353, 7431, 29898, 1066, 29918, 2176, 29897, 448, 6865, 300, 29889, 1949, 29918, 11911, 287, 29898, 1066, 29918, 2176, 29897, 18884, 396, 9681, 2089, 3480, 5056, 353, 13686, 3145, 451, 10664, 491, 278, 6865, 300, 13, 1678, 15283, 29918, 11671, 353, 5844, 29889, 1188, 29906, 29898, 3188, 29889, 29876, 20647, 29898, 29886, 29892, 18091, 876, 718, 5844, 29889, 1188, 29906, 29898, 3188, 29889, 29876, 20647, 3552, 29940, 29899, 29886, 511, 9144, 876, 13, 1678, 565, 9750, 359, 537, 18572, 29945, 29901, 1596, 29898, 29888, 29915, 11739, 29879, 29918, 14836, 29989, 426, 19238, 300, 29889, 509, 4661, 710, 580, 6177, 320, 29876, 405, 426, 29940, 29913, 282, 426, 29886, 29913, 285, 29886, 426, 18091, 29913, 7876, 426, 9144, 6177, 15283, 29918, 14836, 426, 29878, 299, 29898, 11739, 29879, 29918, 11671, 2915, 1495, 13, 13, 1678, 736, 15283, 29918, 11671, 13, 13, 1753, 903, 2288, 29918, 7827, 29918, 14836, 29898, 19238, 300, 29892, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 1900, 6484, 29918, 11671, 29922, 8824, 29892, 3240, 29918, 13318, 6484, 29922, 8824, 29892, 9750, 359, 537, 29922, 29900, 1125, 13, 1678, 9995, 16969, 3001, 6139, 3309, 313, 262, 9978, 29897, 310, 6865, 300, 1192, 278, 2533, 310, 967, 6368, 270, 29880, 322, 15283, 270, 29880, 29889, 13, 13, 4706, 1900, 6484, 29918, 11671, 313, 25253, 29892, 529, 11227, 29958, 1125, 3692, 304, 736, 15899, 9212, 1950, 270, 29880, 892, 599, 6865, 393, 7910, 270, 29880, 304, 367, 6206, 13, 4706, 3240, 29918, 13318, 6484, 313, 25253, 1125, 3692, 304, 736, 278, 1900, 11306, 393, 471, 1476, 29889, 7106, 3402, 674, 367, 313, 29966, 29934, 2540, 300, 10202, 11671, 467, 13, 1678, 9995, 13, 13, 1678, 396, 450, 390, 5690, 13171, 5650, 338, 11473, 322, 20871, 281, 29914, 29878, 920, 304, 14707, 263, 6865, 300, 363, 1900, 7037, 270, 29880, 29889, 13, 13, 1678, 396, 29871, 29896, 29897, 1938, 366, 337, 24219, 403, 2307, 29899, 1730, 1573, 6865, 470, 14707, 1269, 5751, 25499, 310, 697, 1790, 29973, 13, 1678, 396, 1334, 1335, 29915, 29879, 2752, 775, 6589, 393, 366, 526, 451, 7424, 304, 29892, 322, 393, 445, 338, 376, 29890, 15356, 276, 1213, 13, 1678, 396, 11637, 451, 8304, 292, 577, 1192, 322, 2805, 263, 10075, 1014, 29899, 3670, 3039, 286, 11671, 1192, 1033, 367, 24774, 408, 263, 1395, 7584, 931, 29899, 4977, 369, 29973, 13, 1678, 396, 2860, 599, 29892, 445, 338, 7424, 304, 367, 385, 4256, 1230, 5687, 29892, 372, 1033, 24656, 901, 3064, 411, 5434, 413, 29915, 29879, 29892, 13, 1678, 396, 322, 372, 29915, 29879, 451, 763, 591, 29915, 276, 15859, 385, 27096, 573, 2740, 310, 1432, 1950, 10296, 738, 1994, 29889, 13, 13, 1678, 396, 29871, 29906, 29897, 512, 825, 1797, 526, 366, 7424, 304, 14707, 29973, 9338, 5800, 470, 17705, 5800, 29973, 13, 1678, 396, 7527, 6812, 29871, 29955, 14661, 13883, 338, 2309, 9338, 5800, 29936, 278, 3517, 1813, 14661, 306, 1525, 29925, 29930, 2186, 270, 29880, 20376, 338, 2309, 17705, 5800, 29936, 13, 1678, 396, 322, 3030, 14661, 270, 29880, 20376, 881, 367, 8560, 278, 1021, 982, 1716, 3064, 29889, 13, 13, 1678, 396, 306, 12784, 304, 1395, 7584, 363, 396, 29896, 29892, 322, 9338, 5800, 363, 396, 29906, 541, 1122, 6755, 17587, 297, 263, 5434, 1873, 565, 372, 2444, 901, 8210, 29889, 13, 1678, 396, 512, 738, 1206, 29892, 390, 5690, 13171, 29915, 29879, 4549, 4180, 373, 278, 1243, 6166, 7186, 29889, 16968, 2831, 342, 14661, 372, 1122, 451, 4383, 599, 393, 1568, 29889, 13, 13, 1678, 565, 1134, 29898, 19238, 300, 29897, 2804, 390, 2540, 300, 29901, 13, 4706, 12020, 20948, 29898, 29888, 29915, 3207, 6865, 300, 297, 903, 2288, 29918, 7827, 29918, 14836, 881, 367, 1134, 390, 2540, 300, 1495, 13, 1678, 565, 3240, 29918, 13318, 6484, 322, 451, 1900, 6484, 29918, 11671, 29901, 13, 4706, 12020, 7865, 2392, 29898, 29888, 29915, 13318, 6484, 29918, 11671, 1818, 367, 5852, 297, 1797, 304, 736, 1900, 6484, 29918, 11671, 1495, 13, 13, 1678, 565, 451, 1900, 6484, 29918, 11671, 29901, 13, 4706, 6368, 29918, 14836, 353, 903, 2288, 29918, 14138, 29918, 14836, 29898, 19238, 300, 29892, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 4706, 848, 29918, 14836, 353, 903, 11739, 29879, 29918, 14836, 29898, 19238, 300, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 4706, 565, 9750, 359, 537, 18572, 29941, 29901, 1596, 29898, 29888, 29915, 7827, 6865, 300, 9978, 891, 426, 29878, 299, 29898, 14138, 29918, 14836, 718, 848, 29918, 14836, 2915, 1495, 13, 4706, 736, 6368, 29918, 14836, 718, 848, 29918, 14836, 13, 1678, 1683, 29901, 13, 4706, 396, 24930, 278, 270, 29880, 310, 1269, 11306, 13, 4706, 11306, 29918, 29881, 3137, 353, 5159, 13, 4706, 6368, 29918, 11671, 353, 29871, 29900, 13, 4706, 565, 9750, 359, 537, 18572, 29945, 29901, 1596, 29898, 29888, 29915, 2886, 1900, 7037, 270, 29880, 363, 426, 19238, 300, 6177, 1495, 13, 4706, 363, 474, 29892, 5751, 297, 26985, 29898, 19238, 300, 29889, 19238, 1125, 396, 922, 862, 1218, 6368, 322, 15283, 270, 3137, 297, 445, 982, 2794, 366, 1016, 29915, 29873, 505, 304, 337, 15807, 403, 6368, 1269, 931, 13, 9651, 11306, 353, 390, 2540, 300, 29898, 19238, 300, 29889, 19238, 7503, 29875, 29974, 29896, 2314, 13, 9651, 5751, 29918, 14138, 29918, 11671, 353, 903, 29878, 29918, 14138, 29918, 14836, 29898, 7491, 29892, 1950, 29918, 1116, 29879, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 9651, 6368, 29918, 11671, 4619, 5751, 29918, 14138, 29918, 11671, 13, 9651, 15283, 29918, 11671, 353, 903, 11739, 29879, 29918, 14836, 29898, 6484, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 9750, 359, 537, 29922, 18248, 359, 537, 29897, 13, 9651, 11306, 29918, 29881, 3137, 29889, 4397, 29898, 14138, 29918, 11671, 718, 15283, 29918, 11671, 29897, 13, 9651, 565, 9750, 359, 537, 18572, 29945, 29901, 1596, 29898, 29888, 29915, 6484, 29871, 29900, 29899, 29912, 29875, 29913, 891, 270, 29880, 29901, 426, 29878, 299, 29898, 6484, 29918, 29881, 3137, 29961, 29875, 2314, 29913, 1495, 13, 13, 4706, 396, 8878, 701, 278, 1900, 390, 2540, 300, 322, 8147, 278, 286, 11671, 13, 4706, 286, 11671, 29918, 19238, 300, 353, 390, 2540, 300, 580, 13, 4706, 363, 474, 29892, 5751, 29892, 297, 26985, 29898, 19238, 300, 29889, 19238, 1125, 13, 9651, 565, 474, 1360, 29900, 470, 11306, 29918, 29881, 3137, 29961, 29875, 29962, 5277, 11306, 29918, 29881, 3137, 29961, 29875, 29899, 29896, 5387, 396, 27308, 474, 947, 451, 281, 943, 264, 278, 270, 29880, 13, 18884, 286, 11671, 29918, 19238, 300, 29889, 1202, 29898, 7491, 29897, 13, 4706, 565, 9750, 359, 537, 18572, 29945, 29901, 13, 9651, 1596, 29898, 29888, 29915, 6484, 270, 3137, 29901, 426, 15625, 29875, 29892, 29878, 299, 29898, 11671, 876, 363, 474, 29892, 11671, 297, 26985, 29898, 6484, 29918, 29881, 3137, 4638, 29913, 1495, 13, 9651, 1596, 29898, 29888, 29915, 13318, 7037, 6865, 300, 29901, 426, 3487, 29880, 29918, 19238, 300, 29913, 1495, 13, 4706, 286, 11671, 353, 903, 2288, 29918, 7827, 29918, 14836, 29898, 3487, 29880, 29918, 19238, 300, 29892, 1950, 29918, 1116, 29879, 29892, 926, 29918, 2176, 29892, 3480, 29918, 2176, 29892, 1900, 6484, 29918, 11671, 29922, 8824, 29892, 9750, 359, 537, 29922, 29900, 29897, 396, 13611, 304, 1596, 995, 2400, 13, 4706, 565, 9750, 359, 537, 18572, 29945, 29901, 13, 9651, 1596, 29898, 29888, 29915, 13318, 7037, 270, 29880, 471, 426, 29878, 299, 29898, 3487, 29880, 2915, 1495, 13, 9651, 1596, 580, 13, 4706, 565, 451, 3240, 29918, 13318, 6484, 29901, 13, 9651, 736, 286, 11671, 13, 4706, 1683, 29901, 13, 9651, 736, 313, 3487, 29880, 29918, 19238, 300, 29892, 286, 11671, 29897, 13, 2 ]
cmdb/dao.py
bopopescu/dbsupport
2
105045
# -*- coding: UTF-8 -*- import pymysql pymysql.install_as_MySQLdb() import MySQLdb from django.db import connection class cmdbDao(object): def getDbInstanceList(self, search_key, offset, limit): cursor = connection.cursor() if search_key == "" or search_key is None: sql = "select ch.id, ch.intranet_ip_addr, cdi.* from cmdb_db_instance cdi inner join cmdb_host ch on cdi.host = ch.id limit %d, %d" % (offset, limit) else: sql = "select * from cmdb_db_instance cdi inner join cmdb_host ch on cdi.host = ch.id where limit %d, %d" % (offset, limit) cursor.execute(sql) result = cursor.fetchall() return result
[ 1, 396, 448, 29930, 29899, 14137, 29901, 18351, 29899, 29947, 448, 29930, 29899, 29871, 13, 13, 5215, 282, 962, 952, 1519, 13, 29886, 962, 952, 1519, 29889, 6252, 29918, 294, 29918, 3421, 4176, 2585, 580, 13, 13, 5215, 9254, 2585, 13, 13, 3166, 9557, 29889, 2585, 1053, 3957, 13, 13, 1990, 7477, 2585, 29928, 6241, 29898, 3318, 1125, 13, 13, 1678, 822, 679, 10234, 4998, 1293, 29898, 1311, 29892, 2740, 29918, 1989, 29892, 9210, 29892, 4046, 1125, 13, 4706, 10677, 353, 3957, 29889, 18127, 580, 13, 4706, 565, 2740, 29918, 1989, 1275, 5124, 470, 2740, 29918, 1989, 338, 6213, 29901, 13, 9651, 4576, 353, 376, 2622, 521, 29889, 333, 29892, 521, 29889, 262, 509, 273, 300, 29918, 666, 29918, 10030, 29892, 274, 6051, 5575, 515, 7477, 2585, 29918, 2585, 29918, 8758, 274, 6051, 6426, 5988, 7477, 2585, 29918, 3069, 521, 373, 274, 6051, 29889, 3069, 353, 521, 29889, 333, 4046, 1273, 29881, 29892, 1273, 29881, 29908, 1273, 313, 10289, 29892, 4046, 29897, 13, 4706, 1683, 29901, 13, 9651, 4576, 353, 376, 2622, 334, 515, 7477, 2585, 29918, 2585, 29918, 8758, 274, 6051, 6426, 5988, 7477, 2585, 29918, 3069, 521, 373, 274, 6051, 29889, 3069, 353, 521, 29889, 333, 988, 4046, 1273, 29881, 29892, 1273, 29881, 29908, 1273, 313, 10289, 29892, 4046, 29897, 13, 4706, 10677, 29889, 7978, 29898, 2850, 29897, 13, 4706, 1121, 353, 10677, 29889, 9155, 497, 580, 13, 4706, 736, 1121, 13, 2 ]
EX 11/GUI.py
Fallinqqq/ITP-100-01-Course-Projects
0
172810
<filename>EX 11/GUI.py linz = '---' * 30 # This is the Procedual way of creating a GUI '''import tkinter def main(): #creates the main window main_window = tkinter.Tk() # Enters the Tkinter main loop tkinter.mainloop() # Calls the main function main() print(linz)''' linz = '---' * 30 # This is the Module way of creating a GUI """import tkinter class MYHGUI: def init(self): self.main_window = tkinter.Tk() tkinter.mainloop() my_gui = MYHGUI()""" print(linz) # ---------------------------------------------------
[ 1, 529, 9507, 29958, 5746, 29871, 29896, 29896, 29914, 29954, 3120, 29889, 2272, 13, 1915, 29920, 353, 525, 5634, 29915, 334, 29871, 29941, 29900, 13, 29937, 910, 338, 278, 1019, 1133, 950, 982, 310, 4969, 263, 14839, 13, 12008, 5215, 18883, 1639, 13, 1753, 1667, 7295, 13, 1678, 396, 1037, 1078, 278, 1667, 3474, 13, 1678, 1667, 29918, 7165, 353, 18883, 1639, 29889, 29911, 29895, 580, 13, 13, 1678, 396, 1174, 2153, 278, 323, 29895, 1639, 1667, 2425, 13, 1678, 18883, 1639, 29889, 3396, 7888, 580, 13, 13, 29937, 315, 4293, 278, 1667, 740, 13, 3396, 580, 13, 2158, 29898, 1915, 29920, 29897, 12008, 13, 13, 13, 1915, 29920, 353, 525, 5634, 29915, 334, 29871, 29941, 29900, 13, 29937, 910, 338, 278, 15591, 982, 310, 4969, 263, 14839, 13, 15945, 29908, 5215, 18883, 1639, 13, 13, 1990, 19519, 29950, 29954, 3120, 29901, 13, 1678, 822, 2069, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3396, 29918, 7165, 353, 18883, 1639, 29889, 29911, 29895, 580, 13, 4706, 18883, 1639, 29889, 3396, 7888, 580, 13, 13, 1357, 29918, 23569, 353, 19519, 29950, 29954, 3120, 580, 15945, 29908, 13, 2158, 29898, 1915, 29920, 29897, 13, 29937, 448, 2683, 2683, 2683, 489, 13, 13, 2 ]
TTBenchmark/check_benchmark.py
yuqil725/benchmark_lib
0
8856
def check_difference(): pass def update_benchmark(): pass
[ 1, 822, 1423, 29918, 29881, 17678, 7295, 13, 1678, 1209, 13, 13, 13, 1753, 2767, 29918, 1785, 16580, 7295, 13, 1678, 1209, 13, 2 ]
grortir/externals/__init__.py
wojtekPi/grortir
0
72849
<filename>grortir/externals/__init__.py<gh_stars>0 """Package contains modified external modules.""" # pylint: skip-file
[ 1, 529, 9507, 29958, 629, 441, 381, 29914, 735, 725, 1338, 29914, 1649, 2344, 26914, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 14459, 3743, 9120, 7029, 10585, 1213, 15945, 13, 29937, 282, 2904, 524, 29901, 14383, 29899, 1445, 13, 2 ]
onmt/modules/Samplers.py
d-ataman/lmm
9
159604
from __future__ import division import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn.utils.rnn import pack_padded_sequence as pack from torch.nn.utils.rnn import pad_packed_sequence as unpack import onmt from onmt.Utils import aeq import torch.distributions as tdist class ReparametrisationSampler(nn.Module): """ Reparametrization Sampler for the Variational Autoencoder. Args: num_latent_vars: The number of latent variables latent_dim: dimension of the latent variable vector hidden_sze: number of hidden units at each layer num_affixes: number of hidden layers in the inference network """ def __init__(self, num_vars=1, latent_dim, hidden_size, num_affixes): self.num_vars = num_vars self.latent_dim = latent_dim self.hidden_size = hidden_size self.num_affixes = num_affixes super(ReparametrisationSampler, self).__init__() def get_reparametrisation_sampler(self, num_vars=1, latent_dim, hidden_size, num_affixes): """ Method for calling the sampler. Right now only the Diagonal Gaussian distribution is supported. """ return DiagonalGaussianSampler(num_vars, latent_dim, hidden_size, num_affixes) class DiagonalGaussianSampler(ReparametrisationSampler): """ The inference network based on MLP to learn the parameters of a diagonal Gaussian distribution and predict samples from it given an input. """ def __init__(self, latent_dim, hidden_size): super(DiagonalGaussianSampler, self).__init__() self.latent_dim = latent_dim self.hidden_size = hidden_size self.mu = nn.ModuleList(nn.Linear(self.hidden_size, self.hidden_size, bias=True), torch.nn.ReLU(), nn.Linear(self.hidden_size, self.latent_dim, bias=True)) self.sigma = nn.ModuleList(nn.Linear(self.hidden_size, self.hidden_size, bias=True), torch.nn.ReLU(), nn.Linear(self.hidden_size, self.latent_dim, bias=True)) def sample_value(self, mean, variance): """ Produce a sample from the inferred Gaussian distribution. :param mean: The mean of the Gaussian. :param scale: The scale parameter of this Gaussian. :return: A random Gaussian vector. """ N = tdist.Normal(torch.tensor([0.0]), torch.tensor([1.0])) e = N.sample(sample_shape=self.latent_dim) return mean + variance * e def forward(self, X): """ Method for passing the input to the inference network """ mean = self.mu(X) variance = self.sigma(X) z = sample_value(self, mean, variance) return z
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8542, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 13, 3166, 4842, 305, 29889, 1300, 468, 3665, 1053, 28736, 13, 3166, 4842, 305, 29889, 15755, 29889, 13239, 29889, 29878, 15755, 1053, 4870, 29918, 29886, 23959, 29918, 16506, 408, 4870, 13, 3166, 4842, 305, 29889, 15755, 29889, 13239, 29889, 29878, 15755, 1053, 17132, 29918, 4058, 287, 29918, 16506, 408, 443, 4058, 13, 13, 5215, 373, 4378, 13, 3166, 373, 4378, 29889, 12177, 1053, 263, 1837, 13, 5215, 4842, 305, 29889, 27691, 29879, 408, 260, 5721, 13, 13, 1990, 830, 3207, 300, 3780, 362, 22966, 20069, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 13, 1678, 830, 3207, 300, 7485, 362, 3685, 20069, 363, 278, 9586, 1288, 11133, 3977, 6119, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 1678, 954, 29918, 5066, 296, 29918, 16908, 29901, 450, 1353, 310, 3405, 296, 3651, 13, 1678, 3405, 296, 29918, 6229, 29901, 9927, 310, 278, 3405, 296, 2286, 4608, 13, 1678, 7934, 29918, 29879, 911, 29901, 1353, 310, 7934, 10340, 472, 1269, 7546, 13, 1678, 954, 29918, 3470, 861, 267, 29901, 1353, 310, 7934, 15359, 297, 278, 27262, 3564, 29871, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 954, 29918, 16908, 29922, 29896, 29892, 3405, 296, 29918, 6229, 29892, 7934, 29918, 2311, 29892, 954, 29918, 3470, 861, 267, 1125, 13, 4706, 1583, 29889, 1949, 29918, 16908, 353, 954, 29918, 16908, 13, 4706, 1583, 29889, 5066, 296, 29918, 6229, 353, 3405, 296, 29918, 6229, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 3470, 861, 267, 353, 954, 29918, 3470, 861, 267, 13, 4706, 2428, 29898, 1123, 3207, 300, 3780, 362, 22966, 20069, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 13, 1678, 822, 679, 29918, 276, 3207, 300, 3780, 362, 29918, 13445, 20069, 29898, 1311, 29892, 954, 29918, 16908, 29922, 29896, 29892, 3405, 296, 29918, 6229, 29892, 7934, 29918, 2311, 29892, 954, 29918, 3470, 861, 267, 1125, 13, 4706, 9995, 13, 4706, 8108, 363, 5432, 278, 3514, 20069, 29889, 13, 4706, 10428, 1286, 871, 278, 4671, 351, 7177, 22477, 4978, 338, 6969, 29889, 13, 4706, 9995, 13, 4706, 736, 4671, 351, 7177, 29954, 17019, 22966, 20069, 29898, 1949, 29918, 16908, 29892, 3405, 296, 29918, 6229, 29892, 7934, 29918, 2311, 29892, 954, 29918, 3470, 861, 267, 29897, 13, 13, 13, 1990, 4671, 351, 7177, 29954, 17019, 22966, 20069, 29898, 1123, 3207, 300, 3780, 362, 22966, 20069, 1125, 13, 1678, 9995, 13, 1678, 450, 27262, 3564, 2729, 373, 341, 13208, 304, 5110, 278, 4128, 310, 263, 19640, 29871, 13, 1678, 22477, 4978, 322, 8500, 11916, 515, 372, 2183, 385, 1881, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3405, 296, 29918, 6229, 29892, 7934, 29918, 2311, 1125, 13, 4706, 2428, 29898, 12130, 351, 7177, 29954, 17019, 22966, 20069, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 1678, 1583, 29889, 5066, 296, 29918, 6229, 353, 3405, 296, 29918, 6229, 13, 1678, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 13, 13, 1678, 1583, 29889, 2589, 353, 302, 29876, 29889, 7355, 1293, 29898, 15755, 29889, 12697, 29898, 1311, 29889, 10892, 29918, 2311, 29892, 1583, 29889, 10892, 29918, 2311, 29892, 24003, 29922, 5574, 511, 13, 462, 462, 965, 4842, 305, 29889, 15755, 29889, 1123, 29931, 29965, 3285, 13, 462, 462, 965, 302, 29876, 29889, 12697, 29898, 1311, 29889, 10892, 29918, 2311, 29892, 1583, 29889, 5066, 296, 29918, 6229, 29892, 24003, 29922, 5574, 876, 13, 13, 1678, 1583, 29889, 3754, 353, 302, 29876, 29889, 7355, 1293, 29898, 15755, 29889, 12697, 29898, 1311, 29889, 10892, 29918, 2311, 29892, 1583, 29889, 10892, 29918, 2311, 29892, 24003, 29922, 5574, 511, 13, 462, 462, 965, 4842, 305, 29889, 15755, 29889, 1123, 29931, 29965, 3285, 13, 462, 462, 965, 302, 29876, 29889, 12697, 29898, 1311, 29889, 10892, 29918, 2311, 29892, 1583, 29889, 5066, 296, 29918, 6229, 29892, 24003, 29922, 5574, 876, 13, 13, 1678, 822, 4559, 29918, 1767, 29898, 1311, 29892, 2099, 29892, 20162, 1125, 13, 4706, 9995, 13, 4706, 7138, 346, 263, 4559, 515, 278, 10115, 1127, 22477, 4978, 29889, 13, 4706, 584, 3207, 2099, 29901, 450, 2099, 310, 278, 22477, 29889, 13, 4706, 584, 3207, 6287, 29901, 450, 6287, 3443, 310, 445, 22477, 29889, 13, 4706, 584, 2457, 29901, 319, 4036, 22477, 4608, 29889, 13, 4706, 9995, 13, 13, 4706, 405, 353, 260, 5721, 29889, 19077, 29898, 7345, 305, 29889, 20158, 4197, 29900, 29889, 29900, 11724, 4842, 305, 29889, 20158, 4197, 29896, 29889, 29900, 12622, 13, 4706, 321, 353, 405, 29889, 11249, 29898, 11249, 29918, 12181, 29922, 1311, 29889, 5066, 296, 29918, 6229, 29897, 13, 4706, 736, 2099, 718, 20162, 334, 321, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 1060, 1125, 13, 1678, 9995, 13, 1678, 8108, 363, 6819, 278, 1881, 304, 278, 27262, 3564, 13, 1678, 9995, 13, 4706, 2099, 353, 1583, 29889, 2589, 29898, 29990, 29897, 13, 4706, 20162, 353, 1583, 29889, 3754, 29898, 29990, 29897, 13, 4706, 503, 353, 4559, 29918, 1767, 29898, 1311, 29892, 2099, 29892, 20162, 29897, 13, 4706, 736, 503, 13, 13, 13, 2 ]
aibox/utils.py
Aakash-kaushik/aibox
0
83293
# from https://gist.github.com/yashbonde/62df9d16858a43775c22a6af00a8d707 import os import io from PIL import Image def fetch(url): # efficient loading of URLS import os, tempfile, hashlib, requests fp = os.path.join(tempfile.gettempdir(), hashlib.md5(url.encode("utf-8")).hexdigest()) if os.path.isfile(fp) and os.stat(fp).st_size > 0: with open(fp, "rb") as f: dat = f.read() else: dat = requests.get(url).content with open(fp + ".tmp", "wb") as f: f.write(dat) os.rename(fp + ".tmp", fp) return dat def get_image(file_path_or_url): if os.path.exists(file_path_or_url): return Image.open(file_path_or_url) else: return Image.open(io.BytesIO(fetch(file_path_or_url))) def folder(x): # get the folder of this file path import os return os.path.split(os.path.abspath(x))[0]
[ 1, 396, 515, 2045, 597, 29887, 391, 29889, 3292, 29889, 510, 29914, 29891, 1161, 6718, 311, 29914, 29953, 29906, 2176, 29929, 29881, 29896, 29953, 29947, 29945, 29947, 29874, 29946, 29941, 29955, 29955, 29945, 29883, 29906, 29906, 29874, 29953, 2142, 29900, 29900, 29874, 29947, 29881, 29955, 29900, 29955, 13, 13, 5215, 2897, 13, 5215, 12013, 13, 3166, 349, 6227, 1053, 7084, 13, 13, 13, 1753, 6699, 29898, 2271, 1125, 13, 1678, 396, 8543, 8363, 310, 3988, 29903, 13, 1678, 1053, 2897, 29892, 5694, 1445, 29892, 6608, 1982, 29892, 7274, 13, 13, 1678, 285, 29886, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7382, 1445, 29889, 657, 7382, 3972, 3285, 6608, 1982, 29889, 3487, 29945, 29898, 2271, 29889, 12508, 703, 9420, 29899, 29947, 1159, 467, 20970, 7501, 342, 3101, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 18091, 29897, 322, 2897, 29889, 6112, 29898, 18091, 467, 303, 29918, 2311, 1405, 29871, 29900, 29901, 13, 4706, 411, 1722, 29898, 18091, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 9651, 1418, 353, 285, 29889, 949, 580, 13, 1678, 1683, 29901, 13, 4706, 1418, 353, 7274, 29889, 657, 29898, 2271, 467, 3051, 13, 4706, 411, 1722, 29898, 18091, 718, 11393, 7050, 613, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 4130, 29897, 13, 4706, 2897, 29889, 1267, 420, 29898, 18091, 718, 11393, 7050, 613, 285, 29886, 29897, 13, 1678, 736, 1418, 13, 13, 13, 1753, 679, 29918, 3027, 29898, 1445, 29918, 2084, 29918, 272, 29918, 2271, 1125, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 29898, 1445, 29918, 2084, 29918, 272, 29918, 2271, 1125, 13, 4706, 736, 7084, 29889, 3150, 29898, 1445, 29918, 2084, 29918, 272, 29918, 2271, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 7084, 29889, 3150, 29898, 601, 29889, 11207, 5971, 29898, 9155, 29898, 1445, 29918, 2084, 29918, 272, 29918, 2271, 4961, 13, 13, 13, 1753, 4138, 29898, 29916, 1125, 13, 1678, 396, 679, 278, 4138, 310, 445, 934, 2224, 13, 1678, 1053, 2897, 13, 13, 1678, 736, 2897, 29889, 2084, 29889, 5451, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 29916, 876, 29961, 29900, 29962, 13, 2 ]