content
stringlengths
1
1.04M
input_ids
sequencelengths
1
774k
ratio_char_token
float64
0.38
22.9
token_count
int64
1
774k
from functools import reduce from math import factorial if __name__ == '__main__': main()
[ 6738, 1257, 310, 10141, 1330, 4646, 198, 6738, 10688, 1330, 1109, 5132, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419 ]
3.166667
30
import pytest from hotel import Hotel
[ 11748, 12972, 9288, 198, 6738, 7541, 1330, 12696, 628 ]
4.333333
9
###################################################################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance # # with the License. A copy of the License is located at # # # # http://www.apache.org/licenses/LICENSE-2.0 # # # # or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES # # OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions # # and limitations under the License. # ###################################################################################################################### import os from unittest import TestCase, mock from mock import patch import botocore mock_env_variables = { "botLanguage": "English", "AWS_SDK_USER_AGENT": '{ "user_agent_extra": "AwsSolution/1234/1.6.0" }', } @patch.dict(os.environ, mock_env_variables)
[ 29113, 29113, 29113, 14468, 4242, 2235, 198, 2, 220, 15069, 6186, 13, 785, 11, 3457, 13, 393, 663, 29116, 13, 1439, 6923, 33876, 13, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 198, 2, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 11074, 921, 743, 407, 779, 428, 2393, 2845, 287, 11846, 220, 220, 220, 1303, 198, 2, 220, 351, 262, 13789, 13, 317, 4866, 286, 262, 13789, 318, 5140, 379, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 198, 2, 220, 220, 220, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 198, 2, 220, 393, 287, 262, 705, 43085, 6, 2393, 19249, 428, 2393, 13, 770, 2393, 318, 9387, 319, 281, 705, 1921, 3180, 6, 29809, 1797, 11, 42881, 34764, 11015, 1303, 198, 2, 220, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 4911, 393, 17142, 13, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 220, 220, 220, 1303, 198, 2, 220, 290, 11247, 739, 262, 13789, 13, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 198, 29113, 29113, 29113, 14468, 4242, 2235, 198, 11748, 28686, 198, 6738, 555, 715, 395, 1330, 6208, 20448, 11, 15290, 198, 6738, 15290, 1330, 8529, 198, 11748, 10214, 420, 382, 198, 198, 76, 735, 62, 24330, 62, 25641, 2977, 796, 1391, 198, 220, 220, 220, 366, 13645, 32065, 1298, 366, 15823, 1600, 198, 220, 220, 220, 366, 12298, 50, 62, 10305, 42, 62, 29904, 62, 4760, 3525, 1298, 705, 90, 366, 7220, 62, 25781, 62, 26086, 1298, 366, 32, 18504, 46344, 14, 1065, 2682, 14, 16, 13, 21, 13, 15, 1, 1782, 3256, 198, 92, 628, 198, 31, 17147, 13, 11600, 7, 418, 13, 268, 2268, 11, 15290, 62, 24330, 62, 25641, 2977, 8, 198 ]
1.902247
890
##################################################################################################### # PARETO was produced under the DOE Produced Water Application for Beneficial Reuse Environmental # Impact and Treatment Optimization (PARETO), and is copyright (c) 2021 by the software owners: The # Regents of the University of California, through Lawrence Berkeley National Laboratory, et al. All # rights reserved. # # NOTICE. This Software was developed under funding from the U.S. Department of Energy and the # U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted # for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license # in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform # publicly and display publicly, and to permit other to do so. ##################################################################################################### # Title: OPERATIONAL Produced Water Optimization Model # Notes: # - Introduced new completions-to-completions trucking arc (CCT) to account for possible flowback reuse # - Implemented a generic OPERATIONAL case study example (updated model sets, additional input data) # - Implemented an initial formulation for production tank modeling (see updated documentation) # - Implemented a corrected version of the disposal capacity constraint considering more trucking-to-disposal arcs (PKT, SKT, SKT, RKT) [June 28] # - Implemented an improved slack variable display loop [June 29] # - Implemented fresh sourcing via trucking [July 2] # - Implemented completions pad storage [July 6] # - Implemeted an equalized production tank formulation [July 7] # - Implemented changes to flowback processing [July 13] # - Implemented production tank config option [August 4] # Import from pyomo.environ import ( Var, Param, Set, ConcreteModel, Constraint, Objective, minimize, NonNegativeReals, Reals, Binary, ) from pareto.utilities.get_data import get_data from importlib import resources import pyomo.environ from pyomo.core.base.constraint import simple_constraint_rule # import gurobipy from pyomo.common.config import ConfigBlock, ConfigValue, In from enum import Enum from pareto.utilities.solvers import get_solver # create config dictionary CONFIG = ConfigBlock() CONFIG.declare( "has_pipeline_constraints", ConfigValue( default=True, domain=In([True, False]), description="build pipeline constraints", doc="""Indicates whether holdup terms should be constructed or not. **default** - True. **Valid values:** { **True** - construct pipeline constraints, **False** - do not construct pipeline constraints}""", ), ) CONFIG.declare( "production_tanks", ConfigValue( default=ProdTank.individual, domain=In(ProdTank), description="production tank type selection", doc="Type of production tank arrangement (i.e., Individual, Equalized)", ), ) # Creation of a Concrete Model
[ 29113, 29113, 29113, 4242, 2, 198, 2, 29463, 2767, 46, 373, 4635, 739, 262, 46984, 21522, 771, 5638, 15678, 329, 19899, 6652, 797, 1904, 13272, 198, 2, 17677, 290, 21415, 30011, 1634, 357, 27082, 2767, 46, 828, 290, 318, 6634, 357, 66, 8, 33448, 416, 262, 3788, 4393, 25, 383, 198, 2, 3310, 658, 286, 262, 2059, 286, 3442, 11, 832, 13914, 14727, 2351, 18643, 11, 2123, 435, 13, 1439, 198, 2, 2489, 10395, 13, 198, 2, 198, 2, 28536, 13, 770, 10442, 373, 4166, 739, 4918, 422, 262, 471, 13, 50, 13, 2732, 286, 6682, 290, 262, 198, 2, 471, 13, 50, 13, 5070, 25578, 27452, 1728, 2489, 13, 1081, 884, 11, 262, 471, 13, 50, 13, 5070, 468, 587, 7520, 198, 2, 329, 2346, 290, 1854, 7205, 319, 663, 8378, 257, 3432, 12, 929, 11, 36196, 5731, 11, 11331, 18893, 540, 11, 8688, 5964, 198, 2, 287, 262, 10442, 284, 22919, 11, 14983, 9088, 284, 262, 1171, 11, 8335, 27255, 2499, 11, 290, 1620, 198, 2, 7271, 290, 3359, 7271, 11, 290, 284, 8749, 584, 284, 466, 523, 13, 198, 29113, 29113, 29113, 4242, 2, 198, 2, 11851, 25, 43521, 29912, 21522, 771, 5638, 30011, 1634, 9104, 198, 198, 2, 11822, 25, 198, 2, 532, 16745, 649, 1224, 45240, 12, 1462, 12, 785, 37069, 507, 7779, 278, 10389, 357, 4093, 51, 8, 284, 1848, 329, 1744, 5202, 1891, 32349, 198, 2, 532, 1846, 1154, 12061, 257, 14276, 43521, 29912, 1339, 2050, 1672, 357, 43162, 2746, 5621, 11, 3224, 5128, 1366, 8, 198, 2, 532, 1846, 1154, 12061, 281, 4238, 31760, 329, 3227, 6873, 21128, 357, 3826, 6153, 10314, 8, 198, 2, 532, 1846, 1154, 12061, 257, 19267, 2196, 286, 262, 18264, 5339, 32315, 6402, 517, 7779, 278, 12, 1462, 12, 6381, 40007, 44606, 357, 40492, 51, 11, 14277, 51, 11, 14277, 51, 11, 371, 42176, 8, 685, 15749, 2579, 60, 198, 2, 532, 1846, 1154, 12061, 281, 6596, 30740, 7885, 3359, 9052, 685, 15749, 2808, 60, 198, 2, 532, 1846, 1154, 12061, 4713, 47015, 2884, 7779, 278, 685, 16157, 362, 60, 198, 2, 532, 1846, 1154, 12061, 1224, 45240, 14841, 6143, 685, 16157, 718, 60, 198, 2, 532, 1846, 1154, 4164, 276, 281, 4961, 1143, 3227, 6873, 31760, 685, 16157, 767, 60, 198, 2, 532, 1846, 1154, 12061, 2458, 284, 5202, 1891, 7587, 685, 16157, 1511, 60, 198, 2, 532, 1846, 1154, 12061, 3227, 6873, 4566, 3038, 685, 17908, 604, 60, 198, 198, 2, 17267, 198, 6738, 12972, 17902, 13, 268, 2268, 1330, 357, 198, 220, 220, 220, 12372, 11, 198, 220, 220, 220, 25139, 11, 198, 220, 220, 220, 5345, 11, 198, 220, 220, 220, 1482, 38669, 17633, 11, 198, 220, 220, 220, 1482, 2536, 2913, 11, 198, 220, 220, 220, 37092, 11, 198, 220, 220, 220, 17775, 11, 198, 220, 220, 220, 8504, 32863, 876, 3041, 874, 11, 198, 220, 220, 220, 797, 874, 11, 198, 220, 220, 220, 45755, 11, 198, 8, 198, 6738, 279, 533, 1462, 13, 315, 2410, 13, 1136, 62, 7890, 1330, 651, 62, 7890, 198, 6738, 1330, 8019, 1330, 4133, 198, 11748, 12972, 17902, 13, 268, 2268, 198, 6738, 12972, 17902, 13, 7295, 13, 8692, 13, 1102, 2536, 2913, 1330, 2829, 62, 1102, 2536, 2913, 62, 25135, 198, 198, 2, 1330, 915, 22609, 541, 88, 198, 6738, 12972, 17902, 13, 11321, 13, 11250, 1330, 17056, 12235, 11, 17056, 11395, 11, 554, 198, 6738, 33829, 1330, 2039, 388, 198, 198, 6738, 279, 533, 1462, 13, 315, 2410, 13, 34453, 690, 1330, 651, 62, 82, 14375, 628, 198, 198, 2, 2251, 4566, 22155, 198, 10943, 16254, 796, 17056, 12235, 3419, 198, 10943, 16254, 13, 32446, 533, 7, 198, 220, 220, 220, 366, 10134, 62, 79, 541, 4470, 62, 1102, 2536, 6003, 1600, 198, 220, 220, 220, 17056, 11395, 7, 198, 220, 220, 220, 220, 220, 220, 220, 4277, 28, 17821, 11, 198, 220, 220, 220, 220, 220, 220, 220, 7386, 28, 818, 26933, 17821, 11, 10352, 46570, 198, 220, 220, 220, 220, 220, 220, 220, 6764, 2625, 11249, 11523, 17778, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 2205, 2625, 15931, 5497, 16856, 1771, 1745, 929, 2846, 815, 307, 12006, 393, 407, 13, 198, 1174, 12286, 1174, 532, 6407, 13, 198, 1174, 47139, 3815, 25, 1174, 1391, 198, 1174, 17821, 1174, 532, 5678, 11523, 17778, 11, 198, 1174, 25101, 1174, 532, 466, 407, 5678, 11523, 17778, 92, 15931, 1600, 198, 220, 220, 220, 10612, 198, 8, 198, 10943, 16254, 13, 32446, 533, 7, 198, 220, 220, 220, 366, 25493, 62, 83, 2283, 1600, 198, 220, 220, 220, 17056, 11395, 7, 198, 220, 220, 220, 220, 220, 220, 220, 4277, 28, 2964, 67, 32978, 13, 43129, 11, 198, 220, 220, 220, 220, 220, 220, 220, 7386, 28, 818, 7, 2964, 67, 32978, 828, 198, 220, 220, 220, 220, 220, 220, 220, 6764, 2625, 25493, 6873, 2099, 6356, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 2205, 2625, 6030, 286, 3227, 6873, 13888, 357, 72, 13, 68, 1539, 18629, 11, 28701, 1143, 42501, 198, 220, 220, 220, 10612, 198, 8, 198, 198, 2, 21582, 286, 257, 1482, 38669, 9104, 628, 628 ]
3.639151
848
import requests from pprint import pprint import redis import json from datetime import datetime from config_snips import cluster_config if __name__ == '__main__': github = 'https://github.com/natemellendorf/tr_templates' gitlab = 'http://gitlab/root/awesome' test = get_ext_repo(gitlab) pprint(test)
[ 11748, 7007, 198, 6738, 279, 4798, 1330, 279, 4798, 198, 11748, 2266, 271, 198, 11748, 33918, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 4566, 62, 16184, 2419, 1330, 13946, 62, 11250, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 33084, 796, 705, 5450, 1378, 12567, 13, 785, 14, 77, 23900, 695, 18738, 69, 14, 2213, 62, 11498, 17041, 6, 198, 220, 220, 220, 17606, 23912, 796, 705, 4023, 1378, 18300, 23912, 14, 15763, 14, 707, 5927, 6, 198, 220, 220, 220, 1332, 796, 651, 62, 2302, 62, 260, 7501, 7, 18300, 23912, 8, 198, 220, 220, 220, 279, 4798, 7, 9288, 8, 198 ]
2.815789
114
import heterocl as hcl import numpy as np import time import os ######################################### HELPER FUNCTIONS ######################################### # Update the value function at position (i,j,k,l) # iVals: holds index values (i,j,k,l) that correspond to state values (si,sj,sk,sl) # intermeds: holds the estimated value associated with taking each action # interpV: holds the estimated value of a successor state (linear interpolation only) # gamma: discount factor # ptsEachDim: the number of grid points in each dimension of the state space # useNN: a mode flag (0: use linear interpolation, 1: use nearest neighbour) # Returns 0 if convergence has been reached # Converts state values into indeces using nearest neighbour rounding # Convert indices into state values # Sets iVals equal to (i,j,k,l) and sVals equal to the corresponding state values ######################################### VALUE ITERATION ########################################## # Main value iteration algorithm # reSweep: a convergence flag (1: continue iterating, 0: convergence reached) # epsilon: convergence criteria # maxIters: maximum number of iterations that can occur without convergence being reached # count: the number of iterations that have been performed
[ 11748, 14445, 38679, 355, 289, 565, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 640, 198, 11748, 28686, 198, 198, 29113, 7804, 2, 36255, 18973, 29397, 4177, 11053, 1303, 29113, 7804, 628, 198, 2, 10133, 262, 1988, 2163, 379, 2292, 357, 72, 11, 73, 11, 74, 11, 75, 8, 198, 2, 1312, 53, 874, 25, 220, 220, 220, 220, 220, 6622, 6376, 3815, 357, 72, 11, 73, 11, 74, 11, 75, 8, 326, 6053, 284, 1181, 3815, 357, 13396, 11, 82, 73, 11, 8135, 11, 6649, 8, 198, 2, 987, 1150, 82, 25, 220, 6622, 262, 6108, 1988, 3917, 351, 2263, 1123, 2223, 198, 2, 987, 79, 53, 25, 220, 220, 220, 6622, 262, 6108, 1988, 286, 257, 17270, 1181, 357, 29127, 39555, 341, 691, 8, 198, 2, 34236, 25, 220, 220, 220, 220, 220, 9780, 5766, 198, 2, 43344, 10871, 29271, 25, 262, 1271, 286, 10706, 2173, 287, 1123, 15793, 286, 262, 1181, 2272, 198, 2, 779, 6144, 25, 220, 220, 220, 220, 220, 257, 4235, 6056, 357, 15, 25, 779, 14174, 39555, 341, 11, 352, 25, 779, 16936, 12250, 8, 628, 198, 2, 16409, 657, 611, 40826, 468, 587, 4251, 628, 198, 2, 1482, 24040, 1181, 3815, 656, 29077, 274, 1262, 16936, 12250, 38185, 628, 198, 2, 38240, 36525, 656, 1181, 3815, 628, 198, 2, 21394, 1312, 53, 874, 4961, 284, 357, 72, 11, 73, 11, 74, 11, 75, 8, 290, 264, 53, 874, 4961, 284, 262, 11188, 1181, 3815, 628, 198, 198, 29113, 7804, 2, 26173, 8924, 314, 5781, 6234, 1303, 29113, 7804, 2, 628, 198, 2, 8774, 1988, 24415, 11862, 198, 2, 302, 40783, 538, 25, 220, 257, 40826, 6056, 357, 16, 25, 2555, 11629, 803, 11, 657, 25, 40826, 4251, 8, 198, 2, 304, 862, 33576, 25, 220, 40826, 9987, 198, 2, 3509, 40, 1010, 25, 5415, 1271, 286, 34820, 326, 460, 3051, 1231, 40826, 852, 4251, 198, 2, 954, 25, 220, 220, 220, 262, 1271, 286, 34820, 326, 423, 587, 6157, 628, 198 ]
3.966565
329
from django import template from blog.models import Category register = template.Library() def get_categories(context, order, count): """Получаю список категорий""" # categories = Category.objects.filter(published=True, parent__isnull=True).order_by(order) categories = Category.objects.filter(published=True).order_by(order) if count is not None: categories = categories[:count] return categories @register.inclusion_tag('base/tags/base_tag.html', takes_context=True) def category_list(context, order='-name', count=None, template='base/blog/categories.html'): """template tag вывода категорий""" categories = get_categories(context, order, count) return {'template': template, "category_list": categories} @register.simple_tag(takes_context=True) def for_category_list(context, count=None, order='-name'): """template tag вывода категорий без шаблона""" return get_categories(context, order, count)
[ 6738, 42625, 14208, 1330, 11055, 198, 198, 6738, 4130, 13, 27530, 1330, 21743, 198, 198, 30238, 796, 11055, 13, 23377, 3419, 628, 198, 4299, 651, 62, 66, 26129, 7, 22866, 11, 1502, 11, 954, 2599, 198, 220, 220, 220, 37227, 140, 253, 25443, 119, 35072, 141, 229, 16142, 141, 236, 220, 21727, 140, 123, 18849, 21727, 25443, 118, 12466, 118, 16142, 20375, 16843, 140, 111, 15166, 21169, 18849, 140, 117, 37811, 198, 220, 220, 220, 1303, 9376, 796, 21743, 13, 48205, 13, 24455, 7, 30271, 28, 17821, 11, 2560, 834, 271, 8423, 28, 17821, 737, 2875, 62, 1525, 7, 2875, 8, 198, 220, 220, 220, 9376, 796, 21743, 13, 48205, 13, 24455, 7, 30271, 28, 17821, 737, 2875, 62, 1525, 7, 2875, 8, 198, 220, 220, 220, 611, 954, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 9376, 796, 9376, 58, 25, 9127, 60, 198, 220, 220, 220, 1441, 9376, 628, 198, 31, 30238, 13, 259, 4717, 62, 12985, 10786, 8692, 14, 31499, 14, 8692, 62, 12985, 13, 6494, 3256, 2753, 62, 22866, 28, 17821, 8, 198, 4299, 6536, 62, 4868, 7, 22866, 11, 1502, 11639, 12, 3672, 3256, 954, 28, 14202, 11, 11055, 11639, 8692, 14, 14036, 14, 66, 26129, 13, 6494, 6, 2599, 198, 220, 220, 220, 37227, 28243, 7621, 12466, 110, 45035, 38857, 25443, 112, 16142, 12466, 118, 16142, 20375, 16843, 140, 111, 15166, 21169, 18849, 140, 117, 37811, 198, 220, 220, 220, 9376, 796, 651, 62, 66, 26129, 7, 22866, 11, 1502, 11, 954, 8, 198, 220, 220, 220, 1441, 1391, 6, 28243, 10354, 11055, 11, 366, 22872, 62, 4868, 1298, 9376, 92, 628, 198, 31, 30238, 13, 36439, 62, 12985, 7, 83, 1124, 62, 22866, 28, 17821, 8, 198, 4299, 329, 62, 22872, 62, 4868, 7, 22866, 11, 954, 28, 14202, 11, 1502, 11639, 12, 3672, 6, 2599, 198, 220, 220, 220, 37227, 28243, 7621, 12466, 110, 45035, 38857, 25443, 112, 16142, 12466, 118, 16142, 20375, 16843, 140, 111, 15166, 21169, 18849, 140, 117, 12466, 109, 16843, 140, 115, 220, 141, 230, 16142, 140, 109, 30143, 15166, 22177, 16142, 37811, 198, 220, 220, 220, 1441, 651, 62, 66, 26129, 7, 22866, 11, 1502, 11, 954, 8, 198 ]
2.614754
366
#!/usr/bin/env python3 # http://adventofcode.com/2017/day/4 import sys if __name__ == '__main__': main(sys.argv)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 2, 2638, 1378, 324, 1151, 1659, 8189, 13, 785, 14, 5539, 14, 820, 14, 19, 198, 198, 11748, 25064, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 7, 17597, 13, 853, 85, 8, 198 ]
2.236364
55
from django.contrib import admin from models import Bucketlist, Item admin.site.register(Bucketlist) admin.site.register(Item)
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 4981, 1330, 48353, 4868, 11, 9097, 198, 198, 28482, 13, 15654, 13, 30238, 7, 33, 38811, 4868, 8, 198, 28482, 13, 15654, 13, 30238, 7, 7449, 8, 198 ]
3.368421
38
# # Copyright (C) 2020 GrammaTech, Inc. # # This code is licensed under the MIT license. See the LICENSE file in # the project root for license terms. # # This project is sponsored by the Office of Naval Research, One Liberty # Center, 875 N. Randolph Street, Arlington, VA 22203 under contract # # N68335-17-C-0700. The content of the information does not necessarily # reflect the position or policy of the Government and no official # endorsement should be inferred. # import imp import setuptools __version__ = imp.load_source( "pkginfo.version", "gtirb_capstone/version.py" ).__version__ if __name__ == "__main__": with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="gtirb-capstone", version=__version__, author="Grammatech", author_email="[email protected]", description="Utilities for rewriting GTIRB with capstone and keystone", packages=setuptools.find_packages(), install_requires=[ "capstone-gt", "dataclasses ; python_version<'3.7.0'", "gtirb", "keystone-engine", ], classifiers=["Programming Language :: Python :: 3"], extras_require={ "test": [ "flake8", "isort", "pytest", "pytest-cov", "tox", "tox-wheel", "pre-commit", "mcasm", ] }, long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/grammatech/gtirb-functions", license="MIT", )
[ 2, 198, 2, 15069, 357, 34, 8, 12131, 20159, 2611, 17760, 11, 3457, 13, 198, 2, 198, 2, 770, 2438, 318, 11971, 739, 262, 17168, 5964, 13, 4091, 262, 38559, 24290, 2393, 287, 198, 2, 262, 1628, 6808, 329, 5964, 2846, 13, 198, 2, 198, 2, 770, 1628, 318, 15901, 416, 262, 4452, 286, 20818, 4992, 11, 1881, 14734, 198, 2, 3337, 11, 807, 2425, 399, 13, 39845, 3530, 11, 30379, 11, 13753, 2534, 22416, 739, 2775, 1303, 198, 2, 399, 3104, 27326, 12, 1558, 12, 34, 12, 2998, 405, 13, 220, 383, 2695, 286, 262, 1321, 857, 407, 6646, 198, 2, 4079, 262, 2292, 393, 2450, 286, 262, 5070, 290, 645, 1743, 198, 2, 17819, 815, 307, 41240, 13, 198, 2, 198, 11748, 848, 198, 11748, 900, 37623, 10141, 628, 198, 834, 9641, 834, 796, 848, 13, 2220, 62, 10459, 7, 198, 220, 220, 220, 366, 79, 74, 1655, 6513, 13, 9641, 1600, 366, 13655, 343, 65, 62, 11128, 6440, 14, 9641, 13, 9078, 1, 198, 737, 834, 9641, 834, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 351, 1280, 7203, 15675, 11682, 13, 9132, 1600, 366, 81, 4943, 355, 277, 71, 25, 198, 220, 220, 220, 220, 220, 220, 220, 890, 62, 11213, 796, 277, 71, 13, 961, 3419, 628, 220, 220, 220, 900, 37623, 10141, 13, 40406, 7, 198, 220, 220, 220, 220, 220, 220, 220, 1438, 2625, 13655, 343, 65, 12, 11128, 6440, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 2196, 28, 834, 9641, 834, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1772, 2625, 38, 859, 9830, 354, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 1772, 62, 12888, 2625, 13655, 343, 65, 31, 4546, 9830, 354, 13, 785, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 6764, 2625, 18274, 2410, 329, 49614, 7963, 4663, 33, 351, 1451, 6440, 290, 1994, 6440, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 10392, 28, 2617, 37623, 10141, 13, 19796, 62, 43789, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 2721, 62, 47911, 41888, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 11128, 6440, 12, 13655, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 19608, 330, 28958, 2162, 21015, 62, 9641, 27, 6, 18, 13, 22, 13, 15, 6, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 13655, 343, 65, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 2539, 6440, 12, 18392, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 16589, 198, 220, 220, 220, 220, 220, 220, 220, 1398, 13350, 28, 14692, 15167, 2229, 15417, 7904, 11361, 7904, 513, 33116, 198, 220, 220, 220, 220, 220, 220, 220, 33849, 62, 46115, 34758, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 9288, 1298, 685, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 47597, 23, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 271, 419, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 9078, 9288, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 9078, 9288, 12, 66, 709, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 83, 1140, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 83, 1140, 12, 22001, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 3866, 12, 41509, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 23209, 8597, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2361, 198, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 220, 220, 220, 220, 890, 62, 11213, 28, 6511, 62, 11213, 11, 198, 220, 220, 220, 220, 220, 220, 220, 890, 62, 11213, 62, 11299, 62, 4906, 2625, 5239, 14, 4102, 2902, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 19016, 2625, 5450, 1378, 12567, 13, 785, 14, 4546, 9830, 354, 14, 13655, 343, 65, 12, 12543, 2733, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 5964, 2625, 36393, 1600, 198, 220, 220, 220, 1267, 198 ]
2.223684
760
from .login import LoginView, SocialLoginView from .logout import LogoutView from .register import RegisterView, VerifyView, ActivateView from .profile import ProfileView from .change_password import ChangePasswordView from .reset_password import ResetPasswordView, ResetPasswordConfirmView, ResetPasswordCompleteView from .set_password import SetPasswordView
[ 6738, 764, 38235, 1330, 23093, 7680, 11, 5483, 47790, 7680, 198, 6738, 764, 6404, 448, 1330, 5972, 448, 7680, 198, 6738, 764, 30238, 1330, 17296, 7680, 11, 49899, 7680, 11, 33120, 7680, 198, 6738, 764, 13317, 1330, 13118, 7680, 198, 6738, 764, 3803, 62, 28712, 1330, 9794, 35215, 7680, 198, 6738, 764, 42503, 62, 28712, 1330, 30027, 35215, 7680, 11, 30027, 35215, 18546, 2533, 7680, 11, 30027, 35215, 20988, 7680, 198, 6738, 764, 2617, 62, 28712, 1330, 5345, 35215, 7680, 198 ]
4.444444
81
from django.contrib import admin from .models import Post, Comments # Register your models here. admin.site.register(Post) admin.site.register(Comments)
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 764, 27530, 1330, 2947, 11, 19502, 198, 2, 17296, 534, 4981, 994, 13, 198, 198, 28482, 13, 15654, 13, 30238, 7, 6307, 8, 198, 28482, 13, 15654, 13, 30238, 7, 23903, 8, 628 ]
3.604651
43
# Generated from UnitX.g4 by ANTLR 4.5.1 from antlr4 import * # This class defines a complete listener for a parse tree produced by UnitXParser. # Enter a parse tree produced by UnitXParser#program. # Exit a parse tree produced by UnitXParser#program. # Enter a parse tree produced by UnitXParser#typeDeclaration. # Exit a parse tree produced by UnitXParser#typeDeclaration. # Enter a parse tree produced by UnitXParser#functionDeclaration. # Exit a parse tree produced by UnitXParser#functionDeclaration. # Enter a parse tree produced by UnitXParser#formalParameters. # Exit a parse tree produced by UnitXParser#formalParameters. # Enter a parse tree produced by UnitXParser#formalParameterList. # Exit a parse tree produced by UnitXParser#formalParameterList. # Enter a parse tree produced by UnitXParser#formalParameter. # Exit a parse tree produced by UnitXParser#formalParameter. # Enter a parse tree produced by UnitXParser#block. # Exit a parse tree produced by UnitXParser#block. # Enter a parse tree produced by UnitXParser#blockStatement. # Exit a parse tree produced by UnitXParser#blockStatement. # Enter a parse tree produced by UnitXParser#statement. # Exit a parse tree produced by UnitXParser#statement. # Enter a parse tree produced by UnitXParser#repStatement. # Exit a parse tree produced by UnitXParser#repStatement. # Enter a parse tree produced by UnitXParser#ifStatement. # Exit a parse tree produced by UnitXParser#ifStatement. # Enter a parse tree produced by UnitXParser#expressionStatement. # Exit a parse tree produced by UnitXParser#expressionStatement. # Enter a parse tree produced by UnitXParser#printStatement. # Exit a parse tree produced by UnitXParser#printStatement. # Enter a parse tree produced by UnitXParser#assertStatement. # Exit a parse tree produced by UnitXParser#assertStatement. # Enter a parse tree produced by UnitXParser#dumpStatement. # Exit a parse tree produced by UnitXParser#dumpStatement. # Enter a parse tree produced by UnitXParser#borderStatement. # Exit a parse tree produced by UnitXParser#borderStatement. # Enter a parse tree produced by UnitXParser#expressionList. # Exit a parse tree produced by UnitXParser#expressionList. # Enter a parse tree produced by UnitXParser#parExpression. # Exit a parse tree produced by UnitXParser#parExpression. # Enter a parse tree produced by UnitXParser#repControl. # Exit a parse tree produced by UnitXParser#repControl. # Enter a parse tree produced by UnitXParser#endRep. # Exit a parse tree produced by UnitXParser#endRep. # Enter a parse tree produced by UnitXParser#expression. # Exit a parse tree produced by UnitXParser#expression. # Enter a parse tree produced by UnitXParser#unit. # Exit a parse tree produced by UnitXParser#unit. # Enter a parse tree produced by UnitXParser#unitSingleOrPairOperator. # Exit a parse tree produced by UnitXParser#unitSingleOrPairOperator. # Enter a parse tree produced by UnitXParser#unitOperator. # Exit a parse tree produced by UnitXParser#unitOperator. # Enter a parse tree produced by UnitXParser#primary. # Exit a parse tree produced by UnitXParser#primary. # Enter a parse tree produced by UnitXParser#literal. # Exit a parse tree produced by UnitXParser#literal. # Enter a parse tree produced by UnitXParser#string. # Exit a parse tree produced by UnitXParser#string. # Enter a parse tree produced by UnitXParser#halfString. # Exit a parse tree produced by UnitXParser#halfString. # Enter a parse tree produced by UnitXParser#number. # Exit a parse tree produced by UnitXParser#number. # Enter a parse tree produced by UnitXParser#integer. # Exit a parse tree produced by UnitXParser#integer. # Enter a parse tree produced by UnitXParser#boolean. # Exit a parse tree produced by UnitXParser#boolean. # Enter a parse tree produced by UnitXParser#none. # Exit a parse tree produced by UnitXParser#none.
[ 2, 2980, 515, 422, 11801, 55, 13, 70, 19, 416, 3537, 14990, 49, 604, 13, 20, 13, 16, 198, 6738, 1885, 14050, 19, 1330, 1635, 198, 198, 2, 770, 1398, 15738, 257, 1844, 24783, 329, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 13, 628, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 23065, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 23065, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 4906, 37835, 10186, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 4906, 37835, 10186, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 8818, 37835, 10186, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 8818, 37835, 10186, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 687, 282, 48944, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 687, 282, 48944, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 687, 282, 36301, 8053, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 687, 282, 36301, 8053, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 687, 282, 36301, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 687, 282, 36301, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 9967, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 9967, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 9967, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 9967, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 26090, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 26090, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 7856, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 7856, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 361, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 361, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 38011, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 38011, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 4798, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 4798, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 30493, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 30493, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 39455, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 39455, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20192, 48682, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20192, 48682, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 38011, 8053, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 38011, 8053, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 1845, 16870, 2234, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 1845, 16870, 2234, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 7856, 15988, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 7856, 15988, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 437, 6207, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 437, 6207, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 38011, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 38011, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20850, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20850, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20850, 28008, 5574, 47, 958, 18843, 1352, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20850, 28008, 5574, 47, 958, 18843, 1352, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20850, 18843, 1352, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 20850, 18843, 1352, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 39754, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 39754, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 18250, 1691, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 18250, 1691, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 8841, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 8841, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 13959, 10100, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 13959, 10100, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 17618, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 17618, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 41433, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 41433, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 2127, 21052, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 2127, 21052, 13, 628, 198, 220, 220, 220, 1303, 6062, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 23108, 13, 628, 220, 220, 220, 1303, 29739, 257, 21136, 5509, 4635, 416, 11801, 27481, 28198, 2, 23108, 13, 628, 198 ]
3.404858
1,235
from copy import deepcopy import cv2 as cv import numpy as np from sortedcontainers import SortedDict import vision.utils.box_utils_numpy as box_utils from wagon_tracking.transforms import ImageDownscaleTransform
[ 6738, 4866, 1330, 2769, 30073, 198, 198, 11748, 269, 85, 17, 355, 269, 85, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 23243, 3642, 50221, 1330, 311, 9741, 35, 713, 198, 198, 11748, 5761, 13, 26791, 13, 3524, 62, 26791, 62, 77, 32152, 355, 3091, 62, 26791, 198, 198, 6738, 31860, 62, 36280, 13, 7645, 23914, 1330, 7412, 8048, 9888, 41762, 628, 628, 628 ]
3.453125
64
from __future__ import annotations from collections import defaultdict from math import ceil from typing import Dict, NamedTuple from random import randint, sample if __name__ == "__main__": # g = Graph.random_generator(10, 0.2) # print(g) # print(len(g["0"].values())) for i in (0.25, 0.5, 1): g = Graph.random_generator(10, i) print(g, end="\n\n")
[ 6738, 11593, 37443, 834, 1330, 37647, 198, 6738, 17268, 1330, 4277, 11600, 198, 6738, 10688, 1330, 2906, 346, 198, 6738, 19720, 1330, 360, 713, 11, 34441, 51, 29291, 198, 6738, 4738, 1330, 43720, 600, 11, 6291, 628, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1303, 308, 796, 29681, 13, 25120, 62, 8612, 1352, 7, 940, 11, 657, 13, 17, 8, 198, 220, 220, 220, 1303, 3601, 7, 70, 8, 198, 220, 220, 220, 1303, 3601, 7, 11925, 7, 70, 14692, 15, 1, 4083, 27160, 3419, 4008, 628, 220, 220, 220, 329, 1312, 287, 357, 15, 13, 1495, 11, 657, 13, 20, 11, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 308, 796, 29681, 13, 25120, 62, 8612, 1352, 7, 940, 11, 1312, 8, 628, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 70, 11, 886, 2625, 59, 77, 59, 77, 4943, 198 ]
2.519481
154
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 30 14:04:57 2020 @author: mike_ubuntu """ from copy import deepcopy import numpy as np
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 201, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 201, 198, 37811, 201, 198, 41972, 319, 2892, 5267, 1542, 1478, 25, 3023, 25, 3553, 12131, 201, 198, 201, 198, 31, 9800, 25, 285, 522, 62, 32230, 201, 198, 37811, 201, 198, 201, 198, 6738, 4866, 1330, 2769, 30073, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 220, 220, 220, 220, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 201, 198, 201, 198, 220, 201, 198, 201, 198, 220, 220, 220, 220, 201, 198, 220, 220, 220, 220, 201 ]
1.881818
110
#!/usr/bin/env python import rospy import math from sensor_msgs.msg import Joy from geometry_msgs.msg import Twist if __name__ == '__main__': rospy.init_node('joy_twist') joy_twist = JoyTwist() rospy.spin()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 11748, 686, 2777, 88, 198, 11748, 10688, 198, 6738, 12694, 62, 907, 14542, 13, 19662, 1330, 14087, 198, 6738, 22939, 62, 907, 14542, 13, 19662, 1330, 44088, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 686, 2777, 88, 13, 15003, 62, 17440, 10786, 2633, 62, 4246, 396, 11537, 198, 220, 220, 220, 8716, 62, 4246, 396, 796, 14087, 5080, 396, 3419, 198, 220, 220, 220, 686, 2777, 88, 13, 39706, 3419, 198 ]
2.47191
89
import numpy as np if __name__ == "__main__": # Part 1. assert part1(get_data(7, 'test')) == 37, "Part 1 failed." print(f"Part 1: {part1(get_data(7, 'data')):.0f}") # Part 2. assert part2(get_data(7, 'test')) == 168, "Part 2 failed." print(f"Part 2: {part2(get_data(7, 'data')):.0f}")
[ 11748, 299, 32152, 355, 45941, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 628, 220, 220, 220, 1303, 2142, 352, 13, 198, 220, 220, 220, 6818, 636, 16, 7, 1136, 62, 7890, 7, 22, 11, 705, 9288, 6, 4008, 6624, 5214, 11, 366, 7841, 352, 4054, 526, 198, 220, 220, 220, 3601, 7, 69, 1, 7841, 352, 25, 1391, 3911, 16, 7, 1136, 62, 7890, 7, 22, 11, 705, 7890, 11537, 2599, 13, 15, 69, 92, 4943, 628, 220, 220, 220, 1303, 2142, 362, 13, 198, 220, 220, 220, 6818, 636, 17, 7, 1136, 62, 7890, 7, 22, 11, 705, 9288, 6, 4008, 6624, 23378, 11, 366, 7841, 362, 4054, 526, 198, 220, 220, 220, 3601, 7, 69, 1, 7841, 362, 25, 1391, 3911, 17, 7, 1136, 62, 7890, 7, 22, 11, 705, 7890, 11537, 2599, 13, 15, 69, 92, 4943, 198 ]
2.143836
146
"""ADS1220 example (polling ADC). Uses single shot mode and wait for data ready.""" from time import sleep from machine import Pin, SPI # type: ignore from ads1220 import ADC cs = 15 # Chip select pin drdy = 27 # Data ready pin spi = SPI(1, baudrate=10000000, # 10 MHz (try lower speed to troubleshoot) sck=Pin(14), mosi=Pin(13), miso=Pin(12), phase=1) # ADS1220 uses SPI mode 1 adc = ADC(spi, cs, drdy) def test(): """Test code.""" vref = 2.048 # Internal voltage reference res = 8388607 # ADC resolution 23 bit (2^23, assumes 1 bit polarity) adc.conversion_single_shot() # Set single shot conversion mode adc.select_channel(0) # Select channel 0 (0 to 3 ADC channels) sleep(.1) # Ensure ADC ready try: while True: adc.start_conversion() # Conversion must be started each shot reading = adc.read_wait() v = reading * vref / res print("raw: {0}, volts: {1}".format(reading, v)) sleep(3) except KeyboardInterrupt: print("\nCtrl-C pressed to exit.") finally: adc.power_down() spi.deinit() test()
[ 37811, 47149, 1065, 1238, 1672, 357, 30393, 278, 49169, 737, 198, 220, 220, 36965, 2060, 2823, 4235, 290, 4043, 329, 1366, 3492, 526, 15931, 198, 6738, 640, 1330, 3993, 198, 6738, 4572, 1330, 13727, 11, 49091, 220, 1303, 2099, 25, 8856, 198, 6738, 9011, 1065, 1238, 1330, 49169, 198, 198, 6359, 796, 1315, 220, 1303, 17869, 2922, 6757, 198, 67, 4372, 88, 796, 2681, 220, 1303, 6060, 3492, 6757, 198, 2777, 72, 796, 49091, 7, 16, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 275, 3885, 4873, 28, 16, 24598, 11, 220, 1303, 838, 19805, 357, 28311, 2793, 2866, 284, 14979, 71, 1025, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 629, 74, 28, 28348, 7, 1415, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10867, 72, 28, 28348, 7, 1485, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2984, 78, 28, 28348, 7, 1065, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7108, 28, 16, 8, 220, 1303, 44784, 1065, 1238, 3544, 49091, 4235, 352, 198, 324, 66, 796, 49169, 7, 2777, 72, 11, 50115, 11, 1553, 9892, 8, 628, 198, 4299, 1332, 33529, 198, 220, 220, 220, 37227, 14402, 2438, 526, 15931, 198, 220, 220, 220, 410, 5420, 796, 362, 13, 47202, 220, 1303, 18628, 15004, 4941, 198, 220, 220, 220, 581, 796, 807, 30460, 31980, 220, 1303, 49169, 6323, 2242, 1643, 357, 17, 61, 1954, 11, 18533, 352, 1643, 755, 6806, 8, 628, 220, 220, 220, 512, 66, 13, 1102, 9641, 62, 29762, 62, 9442, 3419, 220, 1303, 5345, 2060, 2823, 11315, 4235, 198, 220, 220, 220, 512, 66, 13, 19738, 62, 17620, 7, 15, 8, 220, 1303, 9683, 6518, 657, 357, 15, 284, 513, 49169, 9619, 8, 198, 220, 220, 220, 3993, 7, 13, 16, 8, 220, 1303, 48987, 49169, 3492, 628, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 981, 6407, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 512, 66, 13, 9688, 62, 1102, 9641, 3419, 220, 1303, 44101, 1276, 307, 2067, 1123, 2823, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3555, 796, 512, 66, 13, 961, 62, 17077, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 410, 796, 3555, 1635, 410, 5420, 1220, 581, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 1831, 25, 1391, 15, 5512, 46297, 25, 1391, 16, 92, 1911, 18982, 7, 25782, 11, 410, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3993, 7, 18, 8, 198, 220, 220, 220, 2845, 31973, 9492, 3622, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 59, 77, 40069, 12, 34, 12070, 284, 8420, 19570, 198, 220, 220, 220, 3443, 25, 198, 220, 220, 220, 220, 220, 220, 220, 512, 66, 13, 6477, 62, 2902, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 599, 72, 13, 2934, 15003, 3419, 628, 198, 9288, 3419, 198 ]
2.334638
511
# Copyright 2021 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """ Tests for tfx_addons.feast_examplegen.component. """ import pytest try: import feast except ImportError: pytest.skip("feast not available, skipping", allow_module_level=True) from tfx.v1.proto import Input from tfx_addons.feast_examplegen.component import FeastExampleGen
[ 2, 15069, 33448, 383, 309, 22854, 37535, 46665, 13, 1439, 6923, 33876, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2, 198, 2, 220, 220, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12, 17, 13, 15, 198, 2, 198, 2, 17486, 2672, 416, 9723, 1099, 393, 4987, 284, 287, 3597, 11, 3788, 198, 2, 9387, 739, 262, 13789, 318, 9387, 319, 281, 366, 1921, 3180, 1, 29809, 1797, 11, 198, 2, 42881, 34764, 11015, 6375, 7102, 49828, 11053, 3963, 15529, 509, 12115, 11, 2035, 4911, 393, 17142, 13, 198, 2, 4091, 262, 13789, 329, 262, 2176, 3303, 15030, 21627, 290, 198, 2, 11247, 739, 262, 13789, 13, 198, 2, 38093, 25609, 28, 198, 37811, 198, 51, 3558, 329, 256, 21373, 62, 39996, 13, 5036, 459, 62, 20688, 5235, 13, 42895, 13, 198, 37811, 198, 198, 11748, 12972, 9288, 198, 198, 28311, 25, 198, 220, 1330, 26951, 198, 16341, 17267, 12331, 25, 198, 220, 12972, 9288, 13, 48267, 7203, 5036, 459, 407, 1695, 11, 31017, 1600, 1249, 62, 21412, 62, 5715, 28, 17821, 8, 198, 198, 6738, 256, 21373, 13, 85, 16, 13, 1676, 1462, 1330, 23412, 198, 198, 6738, 256, 21373, 62, 39996, 13, 5036, 459, 62, 20688, 5235, 13, 42895, 1330, 42936, 16281, 13746, 628, 198 ]
3.84585
253
#!/usr/bin/env python3 # Utility functioins import sys from Crypto.Cipher import AES from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from Crypto.Signature import pss from Crypto.Hash import SHA256 import array import hashlib import hmac import os import binascii MAX_DOWNLOAD_SIZE = 0x48000 # 288K AM_SECBOOT_DEFAULT_NONSECURE_MAIN = 0x18000 # Encryption Algorithm # String constants # Authentication Algorithm FLASH_INVALID = 0xFFFFFFFF # KeyWrap Mode #****************************************************************************** # # Magic Numbers # #****************************************************************************** AM_IMAGE_MAGIC_SBL = 0xA3 AM_IMAGE_MAGIC_ICV_CHAIN = 0xAC AM_IMAGE_MAGIC_SECURE = 0xC0 AM_IMAGE_MAGIC_OEM_CHAIN = 0xCC AM_IMAGE_MAGIC_NONSECURE = 0xCB AM_IMAGE_MAGIC_INFO0 = 0xCF AM_IMAGE_MAGIC_CONTAINER = 0xC1 AM_IMAGE_MAGIC_KEYREVOKE = 0xCE AM_IMAGE_MAGIC_DOWNLOAD = 0xCD #****************************************************************************** # # Wired Message Types # #****************************************************************************** AM_SECBOOT_WIRED_MSGTYPE_HELLO = 0 AM_SECBOOT_WIRED_MSGTYPE_STATUS = 1 AM_SECBOOT_WIRED_MSGTYPE_OTADESC = 2 AM_SECBOOT_WIRED_MSGTYPE_UPDATE = 3 AM_SECBOOT_WIRED_MSGTYPE_ABORT = 4 AM_SECBOOT_WIRED_MSGTYPE_RECOVER = 5 AM_SECBOOT_WIRED_MSGTYPE_RESET = 6 AM_SECBOOT_WIRED_MSGTYPE_ACK = 7 AM_SECBOOT_WIRED_MSGTYPE_DATA = 8 #****************************************************************************** # # Wired Message ACK Status # #****************************************************************************** AM_SECBOOT_WIRED_ACK_STATUS_SUCCESS = 0 AM_SECBOOT_WIRED_ACK_STATUS_FAILURE = 1 AM_SECBOOT_WIRED_ACK_STATUS_INVALID_INFO0 = 2 AM_SECBOOT_WIRED_ACK_STATUS_CRC = 3 AM_SECBOOT_WIRED_ACK_STATUS_SEC = 4 AM_SECBOOT_WIRED_ACK_STATUS_MSG_TOO_BIG = 5 AM_SECBOOT_WIRED_ACK_STATUS_UNKNOWN_MSGTYPE = 6 AM_SECBOOT_WIRED_ACK_STATUS_INVALID_ADDR = 7 AM_SECBOOT_WIRED_ACK_STATUS_INVALID_OPERATION = 8 AM_SECBOOT_WIRED_ACK_STATUS_INVALID_PARAM = 9 AM_SECBOOT_WIRED_ACK_STATUS_SEQ = 10 AM_SECBOOT_WIRED_ACK_STATUS_TOO_MUCH_DATA = 11 #****************************************************************************** # # Definitions related to Image Headers # #****************************************************************************** AM_MAX_UART_MSG_SIZE = 8192 # 8K buffer in SBL # Max Wired Update Image header size - this includes optional sign & encryption info AM_WU_IMAGEHDR_SIZE = (16 + 384 + 48 + 16) #****************************************************************************** # # INFOSPACE related definitions # #****************************************************************************** AM_SECBOOT_INFO0_SIGN_PROGRAMMED0 = 0x48EAAD88 AM_SECBOOT_INFO0_SIGN_PROGRAMMED1 = 0xC9705737 AM_SECBOOT_INFO0_SIGN_PROGRAMMED2 = 0x0A6B8458 AM_SECBOOT_INFO0_SIGN_PROGRAMMED3 = 0xE41A9D74 AM_SECBOOT_INFO0_SIGN_UINIT0 = 0x5B75A5FA AM_SECBOOT_INFO0_SIGN_UINIT1 = 0x7B9C8674 AM_SECBOOT_INFO0_SIGN_UINIT2 = 0x869A96FE AM_SECBOOT_INFO0_SIGN_UINIT3 = 0xAEC90860 INFO0_SIZE_BYTES = (2 * 1024) INFO1_SIZE_BYTES = (6 * 1024) #****************************************************************************** # # CRC using ethernet poly, as used by Corvette hardware for validation # #****************************************************************************** #****************************************************************************** # # Pad the text to the block_size. bZeroPad determines how to handle text which # is already multiple of block_size # #****************************************************************************** #****************************************************************************** # # AES CBC encryption # #****************************************************************************** #****************************************************************************** # # AES 128 CBC encryption # #****************************************************************************** #****************************************************************************** # # SHA256 HMAC # #****************************************************************************** #****************************************************************************** # # RSA PKCS1_v1_5 sign # #****************************************************************************** #****************************************************************************** # # RSA PKCS1_v1_5 sign verification # #****************************************************************************** #****************************************************************************** # # RSA PSS signing function. # #****************************************************************************** #****************************************************************************** # # RSA PSS signature verification. # #****************************************************************************** #****************************************************************************** # # Fill one word in bytearray # #****************************************************************************** #****************************************************************************** # # Turn a 32-bit number into a series of bytes for transmission. # # This command will split a 32-bit integer into an array of bytes, ordered # LSB-first for transmission over the UART. # #****************************************************************************** #****************************************************************************** # # Extract a word from a byte array # #****************************************************************************** #****************************************************************************** # # automatically figure out the integer format (base 10 or 16) # #****************************************************************************** #****************************************************************************** # # User controllable Prints control # #****************************************************************************** # Defined print levels AM_PRINT_LEVEL_MIN = 0 AM_PRINT_LEVEL_NONE = AM_PRINT_LEVEL_MIN AM_PRINT_LEVEL_ERROR = 1 AM_PRINT_LEVEL_INFO = 2 AM_PRINT_LEVEL_VERBOSE = 4 AM_PRINT_LEVEL_DEBUG = 5 AM_PRINT_LEVEL_MAX = AM_PRINT_LEVEL_DEBUG # Global variable to control the prints AM_PRINT_VERBOSITY = AM_PRINT_LEVEL_INFO helpPrintLevel = 'Set Log Level (0: None), (1: Error), (2: INFO), (4: Verbose), (5: Debug) [Default = Info]'
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 34030, 1257, 310, 952, 1040, 198, 198, 11748, 25064, 198, 6738, 36579, 13, 34, 10803, 1330, 34329, 198, 6738, 36579, 13, 15202, 9218, 1330, 42319, 198, 6738, 36579, 13, 11712, 1300, 1330, 29673, 7902, 16, 62, 85, 16, 62, 20, 198, 6738, 36579, 13, 11712, 1300, 1330, 279, 824, 198, 6738, 36579, 13, 26257, 1330, 25630, 11645, 198, 11748, 7177, 198, 11748, 12234, 8019, 198, 11748, 289, 20285, 198, 11748, 28686, 198, 11748, 9874, 292, 979, 72, 198, 198, 22921, 62, 41925, 35613, 62, 33489, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 2780, 830, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 35419, 42, 198, 2390, 62, 23683, 8202, 2394, 62, 7206, 38865, 62, 45, 19213, 2943, 11335, 62, 5673, 1268, 220, 220, 796, 657, 87, 1507, 830, 198, 198, 2, 14711, 13168, 978, 42289, 198, 198, 2, 10903, 38491, 198, 198, 2, 48191, 978, 42289, 198, 198, 3697, 11211, 62, 1268, 23428, 2389, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 29312, 29312, 198, 198, 2, 7383, 54, 2416, 10363, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 6139, 27797, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 50, 9148, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 32, 18, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 2149, 53, 62, 3398, 29833, 220, 220, 220, 220, 220, 796, 657, 87, 2246, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 23683, 11335, 220, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 34, 15, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 46, 3620, 62, 3398, 29833, 220, 220, 220, 220, 220, 796, 657, 87, 4093, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 45, 19213, 2943, 11335, 220, 220, 220, 220, 220, 796, 657, 87, 23199, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 10778, 15, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 22495, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 10943, 30339, 1137, 220, 220, 220, 220, 220, 796, 657, 87, 34, 16, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 20373, 2200, 29516, 7336, 220, 220, 220, 220, 220, 796, 657, 87, 5222, 198, 2390, 62, 3955, 11879, 62, 45820, 2149, 62, 41925, 35613, 220, 220, 220, 220, 220, 220, 796, 657, 87, 8610, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 39721, 16000, 24897, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 13909, 3069, 46, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 657, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 35744, 2937, 220, 220, 220, 220, 220, 220, 220, 220, 796, 352, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 2394, 2885, 1546, 34, 220, 220, 220, 220, 220, 220, 220, 796, 362, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 16977, 220, 220, 220, 220, 220, 220, 220, 220, 796, 513, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 6242, 9863, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 604, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 2200, 8220, 5959, 220, 220, 220, 220, 220, 220, 220, 796, 642, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 19535, 2767, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 718, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 8120, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 767, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 5653, 38, 25216, 62, 26947, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 807, 628, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 39721, 16000, 7125, 42, 12678, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 12564, 4093, 7597, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 657, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 7708, 4146, 11335, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 352, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 1268, 23428, 2389, 62, 10778, 15, 220, 220, 220, 220, 220, 220, 220, 796, 362, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 34, 7397, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 513, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 23683, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 604, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 5653, 38, 62, 51, 6684, 62, 3483, 38, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 642, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 4944, 44706, 62, 5653, 38, 25216, 220, 220, 220, 220, 220, 796, 718, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 1268, 23428, 2389, 62, 2885, 7707, 220, 220, 220, 220, 220, 220, 220, 220, 796, 767, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 1268, 23428, 2389, 62, 31054, 6234, 220, 220, 220, 796, 807, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 1268, 23428, 2389, 62, 27082, 2390, 220, 220, 220, 220, 220, 220, 220, 796, 860, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 5188, 48, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 838, 198, 2390, 62, 23683, 8202, 2394, 62, 54, 37819, 62, 8120, 62, 35744, 2937, 62, 51, 6684, 62, 42422, 3398, 62, 26947, 220, 220, 220, 220, 220, 220, 220, 796, 1367, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 45205, 3519, 284, 7412, 7123, 364, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 2390, 62, 22921, 62, 52, 7227, 62, 5653, 38, 62, 33489, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 807, 17477, 220, 1303, 807, 42, 11876, 287, 311, 9148, 198, 2, 5436, 39721, 10133, 7412, 13639, 2546, 532, 428, 3407, 11902, 1051, 1222, 15835, 7508, 198, 2390, 62, 54, 52, 62, 3955, 11879, 39, 7707, 62, 33489, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 357, 1433, 1343, 40400, 1343, 4764, 1343, 1467, 8, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 45594, 47053, 11598, 3519, 17336, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 4805, 7730, 24115, 30733, 15, 220, 220, 796, 657, 87, 2780, 16412, 2885, 3459, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 4805, 7730, 24115, 30733, 16, 220, 220, 796, 657, 87, 34, 43587, 3553, 2718, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 4805, 7730, 24115, 30733, 17, 220, 220, 796, 657, 87, 15, 32, 21, 33, 23, 29334, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 4805, 7730, 24115, 30733, 18, 220, 220, 796, 657, 87, 36, 3901, 32, 24, 35, 4524, 198, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 52, 1268, 2043, 15, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 20, 33, 2425, 32, 20, 7708, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 52, 1268, 2043, 16, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 22, 33, 24, 34, 23, 45385, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 52, 1268, 2043, 17, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 23, 3388, 32, 4846, 15112, 198, 2390, 62, 23683, 8202, 2394, 62, 10778, 15, 62, 46224, 62, 52, 1268, 2043, 18, 220, 220, 220, 220, 220, 220, 220, 796, 657, 87, 32, 2943, 24, 2919, 1899, 198, 198, 10778, 15, 62, 33489, 62, 17513, 51, 1546, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 357, 17, 1635, 28119, 8, 198, 10778, 16, 62, 33489, 62, 17513, 51, 1546, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 796, 357, 21, 1635, 28119, 8, 628, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 45623, 1262, 28475, 3262, 7514, 11, 355, 973, 416, 49105, 6890, 329, 21201, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 15744, 262, 2420, 284, 262, 2512, 62, 7857, 13, 275, 28667, 26114, 15947, 703, 284, 5412, 2420, 543, 198, 2, 318, 1541, 3294, 286, 2512, 62, 7857, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 628, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 34329, 20244, 15835, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 34329, 13108, 20244, 15835, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 25630, 11645, 25904, 2246, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 42319, 29673, 7902, 16, 62, 85, 16, 62, 20, 1051, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 42319, 29673, 7902, 16, 62, 85, 16, 62, 20, 1051, 19637, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 42319, 350, 5432, 8415, 2163, 13, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 42319, 350, 5432, 9877, 19637, 13, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 27845, 530, 1573, 287, 416, 83, 451, 2433, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 628, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 6756, 257, 3933, 12, 2545, 1271, 656, 257, 2168, 286, 9881, 329, 11478, 13, 198, 2, 198, 2, 770, 3141, 481, 6626, 257, 3933, 12, 2545, 18253, 656, 281, 7177, 286, 9881, 11, 6149, 198, 2, 406, 16811, 12, 11085, 329, 11478, 625, 262, 471, 7227, 13, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 29677, 257, 1573, 422, 257, 18022, 7177, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 628, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 6338, 3785, 503, 262, 18253, 5794, 357, 8692, 838, 393, 1467, 8, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 198, 2, 11787, 1246, 297, 540, 12578, 82, 1630, 198, 2, 198, 2, 17174, 17174, 46068, 1174, 198, 2, 2896, 1389, 3601, 2974, 198, 2390, 62, 4805, 12394, 62, 2538, 18697, 62, 23678, 220, 220, 220, 220, 796, 657, 198, 2390, 62, 4805, 12394, 62, 2538, 18697, 62, 45, 11651, 220, 220, 220, 796, 3001, 62, 4805, 12394, 62, 2538, 18697, 62, 23678, 198, 2390, 62, 4805, 12394, 62, 2538, 18697, 62, 24908, 220, 220, 796, 352, 198, 2390, 62, 4805, 12394, 62, 2538, 18697, 62, 10778, 220, 220, 220, 796, 362, 198, 2390, 62, 4805, 12394, 62, 2538, 18697, 62, 5959, 33, 14058, 796, 604, 198, 2390, 62, 4805, 12394, 62, 2538, 18697, 62, 30531, 220, 220, 796, 642, 198, 2390, 62, 4805, 12394, 62, 2538, 18697, 62, 22921, 220, 220, 220, 220, 796, 3001, 62, 4805, 12394, 62, 2538, 18697, 62, 30531, 198, 198, 2, 8060, 7885, 284, 1630, 262, 20842, 198, 2390, 62, 4805, 12394, 62, 5959, 33, 2640, 9050, 796, 3001, 62, 4805, 12394, 62, 2538, 18697, 62, 10778, 198, 198, 16794, 18557, 4971, 796, 705, 7248, 5972, 5684, 357, 15, 25, 6045, 828, 357, 16, 25, 13047, 828, 357, 17, 25, 24890, 828, 357, 19, 25, 49973, 577, 828, 357, 20, 25, 31687, 8, 685, 19463, 796, 14151, 49946, 198 ]
3.231904
2,169
import csv import requests import socket from bs4 import BeautifulSoup import re import json with open('artists.json', 'w') as outfile: json.dump(parse_artists(), outfile) '''artist_urls = get_artist_urls() artist_array = compile_artist_profiles(artist_urls) outfile = open("./toronto-artists.csv", "wb") writer = csv.writer(outfile) writer.writerows(recipe_array)'''
[ 198, 11748, 269, 21370, 198, 11748, 7007, 198, 11748, 17802, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 11748, 302, 198, 11748, 33918, 198, 198, 4480, 1280, 10786, 433, 1023, 13, 17752, 3256, 705, 86, 11537, 355, 503, 7753, 25, 198, 220, 220, 220, 33918, 13, 39455, 7, 29572, 62, 433, 1023, 22784, 503, 7753, 8, 198, 198, 7061, 6, 49016, 62, 6371, 82, 796, 651, 62, 49016, 62, 6371, 82, 3419, 198, 49016, 62, 18747, 796, 17632, 62, 49016, 62, 5577, 2915, 7, 49016, 62, 6371, 82, 8, 198, 198, 448, 7753, 796, 1280, 7, 1911, 14, 13165, 5957, 12, 433, 1023, 13, 40664, 1600, 366, 39346, 4943, 198, 16002, 796, 269, 21370, 13, 16002, 7, 448, 7753, 8, 198, 16002, 13, 16002, 1666, 7, 29102, 431, 62, 18747, 8, 7061, 6, 628 ]
2.772059
136
from __future__ import print_function import sys import re import sqlparse from collections import namedtuple from sqlparse.sql import Comparison, Identifier, Where from .parseutils.utils import ( last_word, find_prev_keyword, parse_partial_identifier) from .parseutils.tables import extract_tables from .parseutils.ctes import isolate_query_ctes from pgspecial.main import parse_special_command PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 if PY3: string_types = str else: string_types = basestring Special = namedtuple('Special', []) Database = namedtuple('Database', []) Schema = namedtuple('Schema', ['quoted']) Schema.__new__.__defaults__ = (False,) # FromClauseItem is a table/view/function used in the FROM clause # `table_refs` contains the list of tables/... already in the statement, # used to ensure that the alias we suggest is unique FromClauseItem = namedtuple('FromClauseItem', 'schema table_refs local_tables') Table = namedtuple('Table', ['schema', 'table_refs', 'local_tables']) TableFormat = namedtuple('TableFormat', []) View = namedtuple('View', ['schema', 'table_refs']) # JoinConditions are suggested after ON, e.g. 'foo.barid = bar.barid' JoinCondition = namedtuple('JoinCondition', ['table_refs', 'parent']) # Joins are suggested after JOIN, e.g. 'foo ON foo.barid = bar.barid' Join = namedtuple('Join', ['table_refs', 'schema']) Function = namedtuple('Function', ['schema', 'table_refs', 'usage']) # For convenience, don't require the `usage` argument in Function constructor Function.__new__.__defaults__ = (None, tuple(), None) Table.__new__.__defaults__ = (None, tuple(), tuple()) View.__new__.__defaults__ = (None, tuple()) FromClauseItem.__new__.__defaults__ = (None, tuple(), tuple()) Column = namedtuple( 'Column', ['table_refs', 'require_last_table', 'local_tables', 'qualifiable', 'context'] ) Column.__new__.__defaults__ = (None, None, tuple(), False, None) Keyword = namedtuple('Keyword', ['last_token']) Keyword.__new__.__defaults__ = (None,) NamedQuery = namedtuple('NamedQuery', []) Datatype = namedtuple('Datatype', ['schema']) Alias = namedtuple('Alias', ['aliases']) Path = namedtuple('Path', []) def suggest_type(full_text, text_before_cursor): """Takes the full_text that is typed so far and also the text before the cursor to suggest completion type and scope. Returns a tuple with a type of entity ('table', 'column' etc) and a scope. A scope for a column category will be a list of tables. """ if full_text.startswith('\\i '): return (Path(),) # This is a temporary hack; the exception handling # here should be removed once sqlparse has been fixed try: stmt = SqlStatement(full_text, text_before_cursor) except (TypeError, AttributeError): return [] # Check for special commands and handle those separately if stmt.parsed: # Be careful here because trivial whitespace is parsed as a # statement, but the statement won't have a first token tok1 = stmt.parsed.token_first() if tok1 and tok1.value == '\\': text = stmt.text_before_cursor + stmt.word_before_cursor return suggest_special(text) return suggest_based_on_last_token(stmt.last_token, stmt) named_query_regex = re.compile(r'^\s*\\ns\s+[A-z0-9\-_]+\s+') def _strip_named_query(txt): """ This will strip "save named query" command in the beginning of the line: '\ns zzz SELECT * FROM abc' -> 'SELECT * FROM abc' ' \ns zzz SELECT * FROM abc' -> 'SELECT * FROM abc' """ if named_query_regex.match(txt): txt = named_query_regex.sub('', txt) return txt function_body_pattern = re.compile(r'(\$.*?\$)([\s\S]*?)\1', re.M) SPECIALS_SUGGESTION = { 'dT': Datatype, 'df': Function, 'dt': Table, 'dv': View, 'sf': Function, } def identifies(id, ref): """Returns true if string `id` matches TableReference `ref`""" return id == ref.alias or id == ref.name or ( ref.schema and (id == ref.schema + '.' + ref.name)) def _allow_join_condition(statement): """ Tests if a join condition should be suggested We need this to avoid bad suggestions when entering e.g. select * from tbl1 a join tbl2 b on a.id = <cursor> So check that the preceding token is a ON, AND, or OR keyword, instead of e.g. an equals sign. :param statement: an sqlparse.sql.Statement :return: boolean """ if not statement or not statement.tokens: return False last_tok = statement.token_prev(len(statement.tokens))[1] return last_tok.value.lower() in ('on', 'and', 'or') def _allow_join(statement): """ Tests if a join should be suggested We need this to avoid bad suggestions when entering e.g. select * from tbl1 a join tbl2 b <cursor> So check that the preceding token is a JOIN keyword :param statement: an sqlparse.sql.Statement :return: boolean """ if not statement or not statement.tokens: return False last_tok = statement.token_prev(len(statement.tokens))[1] return (last_tok.value.lower().endswith('join') and last_tok.value.lower() not in('cross join', 'natural join'))
[ 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 11748, 25064, 198, 11748, 302, 198, 11748, 44161, 29572, 198, 6738, 17268, 1330, 3706, 83, 29291, 198, 6738, 44161, 29572, 13, 25410, 1330, 34420, 11, 11440, 7483, 11, 6350, 198, 6738, 764, 29572, 26791, 13, 26791, 1330, 357, 198, 220, 220, 220, 938, 62, 4775, 11, 1064, 62, 47050, 62, 2539, 4775, 11, 21136, 62, 47172, 62, 738, 7483, 8, 198, 6738, 764, 29572, 26791, 13, 83, 2977, 1330, 7925, 62, 83, 2977, 198, 6738, 764, 29572, 26791, 13, 310, 274, 1330, 28091, 62, 22766, 62, 310, 274, 198, 6738, 23241, 20887, 13, 12417, 1330, 21136, 62, 20887, 62, 21812, 198, 198, 47, 56, 17, 796, 25064, 13, 9641, 62, 10951, 58, 15, 60, 6624, 362, 198, 47, 56, 18, 796, 25064, 13, 9641, 62, 10951, 58, 15, 60, 6624, 513, 198, 198, 361, 350, 56, 18, 25, 198, 220, 220, 220, 4731, 62, 19199, 796, 965, 198, 17772, 25, 198, 220, 220, 220, 4731, 62, 19199, 796, 1615, 395, 1806, 628, 198, 13409, 796, 3706, 83, 29291, 10786, 13409, 3256, 685, 12962, 198, 38105, 796, 3706, 83, 29291, 10786, 38105, 3256, 685, 12962, 198, 27054, 2611, 796, 3706, 83, 29291, 10786, 27054, 2611, 3256, 37250, 421, 5191, 6, 12962, 198, 27054, 2611, 13, 834, 3605, 834, 13, 834, 12286, 82, 834, 796, 357, 25101, 35751, 198, 2, 3574, 2601, 682, 7449, 318, 257, 3084, 14, 1177, 14, 8818, 973, 287, 262, 16034, 13444, 198, 2, 4600, 11487, 62, 5420, 82, 63, 4909, 262, 1351, 286, 8893, 14, 986, 1541, 287, 262, 2643, 11, 198, 2, 973, 284, 4155, 326, 262, 16144, 356, 1950, 318, 3748, 198, 4863, 2601, 682, 7449, 796, 3706, 83, 29291, 10786, 4863, 2601, 682, 7449, 3256, 705, 15952, 2611, 3084, 62, 5420, 82, 1957, 62, 83, 2977, 11537, 198, 10962, 796, 3706, 83, 29291, 10786, 10962, 3256, 37250, 15952, 2611, 3256, 705, 11487, 62, 5420, 82, 3256, 705, 12001, 62, 83, 2977, 6, 12962, 198, 10962, 26227, 796, 3706, 83, 29291, 10786, 10962, 26227, 3256, 685, 12962, 198, 7680, 796, 3706, 83, 29291, 10786, 7680, 3256, 37250, 15952, 2611, 3256, 705, 11487, 62, 5420, 82, 6, 12962, 198, 2, 15251, 25559, 1756, 389, 5220, 706, 6177, 11, 304, 13, 70, 13, 705, 21943, 13, 5657, 312, 796, 2318, 13, 5657, 312, 6, 198, 18234, 48362, 796, 3706, 83, 29291, 10786, 18234, 48362, 3256, 37250, 11487, 62, 5420, 82, 3256, 705, 8000, 6, 12962, 198, 2, 5302, 1040, 389, 5220, 706, 32357, 1268, 11, 304, 13, 70, 13, 705, 21943, 6177, 22944, 13, 5657, 312, 796, 2318, 13, 5657, 312, 6, 198, 18234, 796, 3706, 83, 29291, 10786, 18234, 3256, 37250, 11487, 62, 5420, 82, 3256, 705, 15952, 2611, 6, 12962, 198, 198, 22203, 796, 3706, 83, 29291, 10786, 22203, 3256, 37250, 15952, 2611, 3256, 705, 11487, 62, 5420, 82, 3256, 705, 26060, 6, 12962, 198, 2, 1114, 15607, 11, 836, 470, 2421, 262, 4600, 26060, 63, 4578, 287, 15553, 23772, 198, 22203, 13, 834, 3605, 834, 13, 834, 12286, 82, 834, 796, 357, 14202, 11, 46545, 22784, 6045, 8, 198, 10962, 13, 834, 3605, 834, 13, 834, 12286, 82, 834, 796, 357, 14202, 11, 46545, 22784, 46545, 28955, 198, 7680, 13, 834, 3605, 834, 13, 834, 12286, 82, 834, 796, 357, 14202, 11, 46545, 28955, 198, 4863, 2601, 682, 7449, 13, 834, 3605, 834, 13, 834, 12286, 82, 834, 796, 357, 14202, 11, 46545, 22784, 46545, 28955, 198, 198, 39470, 796, 3706, 83, 29291, 7, 198, 220, 220, 220, 705, 39470, 3256, 198, 220, 220, 220, 37250, 11487, 62, 5420, 82, 3256, 705, 46115, 62, 12957, 62, 11487, 3256, 705, 12001, 62, 83, 2977, 3256, 705, 13255, 16823, 3256, 198, 220, 220, 220, 220, 705, 22866, 20520, 198, 8, 198, 39470, 13, 834, 3605, 834, 13, 834, 12286, 82, 834, 796, 357, 14202, 11, 6045, 11, 46545, 22784, 10352, 11, 6045, 8, 198, 198, 9218, 4775, 796, 3706, 83, 29291, 10786, 9218, 4775, 3256, 37250, 12957, 62, 30001, 6, 12962, 198, 9218, 4775, 13, 834, 3605, 834, 13, 834, 12286, 82, 834, 796, 357, 14202, 35751, 198, 45, 2434, 20746, 796, 3706, 83, 29291, 10786, 45, 2434, 20746, 3256, 685, 12962, 198, 27354, 265, 2981, 796, 3706, 83, 29291, 10786, 27354, 265, 2981, 3256, 37250, 15952, 2611, 6, 12962, 198, 40489, 796, 3706, 83, 29291, 10786, 40489, 3256, 37250, 7344, 1386, 6, 12962, 198, 198, 15235, 796, 3706, 83, 29291, 10786, 15235, 3256, 685, 12962, 628, 198, 198, 4299, 1950, 62, 4906, 7, 12853, 62, 5239, 11, 2420, 62, 19052, 62, 66, 21471, 2599, 198, 220, 220, 220, 37227, 51, 1124, 262, 1336, 62, 5239, 326, 318, 25683, 523, 1290, 290, 635, 262, 2420, 878, 262, 198, 220, 220, 220, 23493, 284, 1950, 11939, 2099, 290, 8354, 13, 628, 220, 220, 220, 16409, 257, 46545, 351, 257, 2099, 286, 9312, 19203, 11487, 3256, 705, 28665, 6, 3503, 8, 290, 257, 8354, 13, 198, 220, 220, 220, 317, 8354, 329, 257, 5721, 6536, 481, 307, 257, 1351, 286, 8893, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 611, 1336, 62, 5239, 13, 9688, 2032, 342, 10786, 6852, 72, 705, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 357, 15235, 22784, 8, 628, 220, 220, 220, 1303, 770, 318, 257, 8584, 8156, 26, 262, 6631, 9041, 198, 220, 220, 220, 1303, 994, 815, 307, 4615, 1752, 44161, 29572, 468, 587, 5969, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 336, 16762, 796, 311, 13976, 48682, 7, 12853, 62, 5239, 11, 2420, 62, 19052, 62, 66, 21471, 8, 198, 220, 220, 220, 2845, 357, 6030, 12331, 11, 3460, 4163, 12331, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 17635, 628, 220, 220, 220, 1303, 6822, 329, 2041, 9729, 290, 5412, 883, 13869, 198, 220, 220, 220, 611, 336, 16762, 13, 79, 945, 276, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 1355, 8161, 994, 780, 20861, 13216, 10223, 318, 44267, 355, 257, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 2643, 11, 475, 262, 2643, 1839, 470, 423, 257, 717, 11241, 198, 220, 220, 220, 220, 220, 220, 220, 284, 74, 16, 796, 336, 16762, 13, 79, 945, 276, 13, 30001, 62, 11085, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 611, 284, 74, 16, 290, 284, 74, 16, 13, 8367, 6624, 705, 6852, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2420, 796, 336, 16762, 13, 5239, 62, 19052, 62, 66, 21471, 1343, 336, 16762, 13, 4775, 62, 19052, 62, 66, 21471, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1950, 62, 20887, 7, 5239, 8, 628, 220, 220, 220, 1441, 1950, 62, 3106, 62, 261, 62, 12957, 62, 30001, 7, 301, 16762, 13, 12957, 62, 30001, 11, 336, 16762, 8, 628, 198, 13190, 62, 22766, 62, 260, 25636, 796, 302, 13, 5589, 576, 7, 81, 6, 61, 59, 82, 9, 6852, 5907, 59, 82, 10, 58, 32, 12, 89, 15, 12, 24, 41441, 62, 48688, 59, 82, 10, 11537, 628, 198, 4299, 4808, 36311, 62, 13190, 62, 22766, 7, 14116, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 770, 481, 10283, 366, 21928, 3706, 12405, 1, 3141, 287, 262, 3726, 286, 262, 1627, 25, 198, 220, 220, 220, 705, 59, 5907, 1976, 3019, 33493, 1635, 16034, 450, 66, 6, 220, 220, 4613, 705, 46506, 1635, 16034, 450, 66, 6, 198, 220, 220, 220, 705, 220, 3467, 5907, 1976, 3019, 33493, 1635, 16034, 450, 66, 6, 4613, 705, 46506, 1635, 16034, 450, 66, 6, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 611, 3706, 62, 22766, 62, 260, 25636, 13, 15699, 7, 14116, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 256, 742, 796, 3706, 62, 22766, 62, 260, 25636, 13, 7266, 10786, 3256, 256, 742, 8, 198, 220, 220, 220, 1441, 256, 742, 628, 198, 8818, 62, 2618, 62, 33279, 796, 302, 13, 5589, 576, 7, 81, 6, 38016, 3, 15885, 30, 59, 3, 5769, 58, 59, 82, 59, 50, 60, 9, 10091, 59, 16, 3256, 302, 13, 44, 8, 628, 628, 198, 198, 48451, 12576, 50, 62, 50, 7340, 38, 6465, 2849, 796, 1391, 198, 220, 220, 220, 705, 67, 51, 10354, 16092, 265, 2981, 11, 198, 220, 220, 220, 705, 7568, 10354, 15553, 11, 198, 220, 220, 220, 705, 28664, 10354, 8655, 11, 198, 220, 220, 220, 705, 67, 85, 10354, 3582, 11, 198, 220, 220, 220, 705, 28202, 10354, 15553, 11, 198, 92, 628, 628, 198, 4299, 21079, 7, 312, 11, 1006, 2599, 198, 220, 220, 220, 37227, 35561, 2081, 611, 4731, 4600, 312, 63, 7466, 8655, 26687, 4600, 5420, 63, 37811, 628, 220, 220, 220, 1441, 4686, 6624, 1006, 13, 26011, 393, 4686, 6624, 1006, 13, 3672, 393, 357, 198, 220, 220, 220, 220, 220, 220, 220, 1006, 13, 15952, 2611, 290, 357, 312, 6624, 1006, 13, 15952, 2611, 1343, 705, 2637, 1343, 1006, 13, 3672, 4008, 628, 198, 4299, 4808, 12154, 62, 22179, 62, 31448, 7, 26090, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 30307, 611, 257, 4654, 4006, 815, 307, 5220, 628, 220, 220, 220, 775, 761, 428, 284, 3368, 2089, 11776, 618, 8218, 304, 13, 70, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2922, 1635, 422, 256, 2436, 16, 257, 4654, 256, 2436, 17, 275, 319, 257, 13, 312, 796, 1279, 66, 21471, 29, 198, 220, 220, 220, 1406, 2198, 326, 262, 18148, 11241, 318, 257, 6177, 11, 5357, 11, 393, 6375, 21179, 11, 2427, 286, 198, 220, 220, 220, 304, 13, 70, 13, 281, 21767, 1051, 13, 628, 220, 220, 220, 1058, 17143, 2643, 25, 281, 44161, 29572, 13, 25410, 13, 48682, 198, 220, 220, 220, 1058, 7783, 25, 25131, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 611, 407, 2643, 393, 407, 2643, 13, 83, 482, 641, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 628, 220, 220, 220, 938, 62, 83, 482, 796, 2643, 13, 30001, 62, 47050, 7, 11925, 7, 26090, 13, 83, 482, 641, 4008, 58, 16, 60, 198, 220, 220, 220, 1441, 938, 62, 83, 482, 13, 8367, 13, 21037, 3419, 287, 19203, 261, 3256, 705, 392, 3256, 705, 273, 11537, 628, 198, 4299, 4808, 12154, 62, 22179, 7, 26090, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 30307, 611, 257, 4654, 815, 307, 5220, 628, 220, 220, 220, 775, 761, 428, 284, 3368, 2089, 11776, 618, 8218, 304, 13, 70, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2922, 1635, 422, 256, 2436, 16, 257, 4654, 256, 2436, 17, 275, 1279, 66, 21471, 29, 198, 220, 220, 220, 1406, 2198, 326, 262, 18148, 11241, 318, 257, 32357, 1268, 21179, 628, 220, 220, 220, 1058, 17143, 2643, 25, 281, 44161, 29572, 13, 25410, 13, 48682, 198, 220, 220, 220, 1058, 7783, 25, 25131, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 611, 407, 2643, 393, 407, 2643, 13, 83, 482, 641, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 10352, 628, 220, 220, 220, 938, 62, 83, 482, 796, 2643, 13, 30001, 62, 47050, 7, 11925, 7, 26090, 13, 83, 482, 641, 4008, 58, 16, 60, 198, 220, 220, 220, 1441, 357, 12957, 62, 83, 482, 13, 8367, 13, 21037, 22446, 437, 2032, 342, 10786, 22179, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 938, 62, 83, 482, 13, 8367, 13, 21037, 3419, 407, 287, 10786, 19692, 4654, 3256, 705, 11802, 4654, 6, 4008, 198 ]
2.736733
1,922
import random from .prepare import app, db, model_repr class Answer(db.Model): ''' 使用的sql语句: ```sql CREATE TABLE `answers` ( `accept_id` int(11) NOT NULL COMMENT '接受id', `problem_id` int(11) NOT NULL COMMENT '问题id', `answer` int(11) NOT NULL DEFAULT '-1' COMMENT '具体答案的选项', PRIMARY KEY (`accept_id`,`problem_id`), KEY `problem_index` (`problem_id`), CONSTRAINT `answers_ibfk_1` FOREIGN KEY (`accept_id`) REFERENCES `accepts` (`id`) ON DELETE CASCADE, CONSTRAINT `answers_ibfk_2` FOREIGN KEY (`problem_id`) REFERENCES `problems` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ``` 属性: 基本属性 problem: 关联的问题 task: 关联的任务 ''' __tablename__ = 'answers' accept_id = db.Column('accept_id', db.Integer, db.ForeignKey( 'accepts.id', ondelete='cascade'), nullable=False, comment='接受id') problem_id = db.Column('problem_id', db.Integer, db.ForeignKey( 'problems.id', ondelete='cascade'), nullable=False, comment='问题id') # answer_id = db.Column('answer_id', db.Integer, db.ForeignKey( # 'answers.openid', ondelete='cascade'), nullable=False, comment='回答者id') # task_id = db.Column('task_id', db.Integer, db.ForeignKey( # 'tasks.id', ondelete='cascade'), nullable=False, comment='任务id') answer = db.Column('answer', db.Integer( ), nullable=False, server_default='-1', comment='具体答案的选项') accept = db.relationship('Accept', back_populates='answers') problem = db.relationship('Problem', back_populates='answers') # task = db.relationship('Task', back_populates='answers') # student = db.relationship('Student', back_populates='answers') __table_args__ = ( db.PrimaryKeyConstraint('accept_id', 'problem_id'), db.Index('problem_index', 'problem_id'), )
[ 11748, 4738, 198, 198, 6738, 764, 46012, 533, 1330, 598, 11, 20613, 11, 2746, 62, 260, 1050, 198, 198, 4871, 23998, 7, 9945, 13, 17633, 2599, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 45635, 18796, 101, 21410, 25410, 46237, 255, 20998, 98, 25, 198, 220, 220, 220, 7559, 63, 25410, 198, 220, 220, 220, 29244, 6158, 43679, 4600, 504, 86, 364, 63, 357, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 13635, 62, 312, 63, 493, 7, 1157, 8, 5626, 15697, 9440, 10979, 705, 162, 236, 98, 20998, 245, 312, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 45573, 62, 312, 63, 493, 7, 1157, 8, 5626, 15697, 9440, 10979, 705, 29785, 106, 165, 95, 246, 312, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 41484, 63, 493, 7, 1157, 8, 5626, 15697, 5550, 38865, 705, 12, 16, 6, 9440, 10979, 705, 17739, 115, 19526, 241, 163, 18433, 162, 94, 230, 21410, 34460, 231, 165, 94, 117, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 4810, 3955, 13153, 35374, 357, 63, 13635, 62, 312, 47671, 63, 45573, 62, 312, 63, 828, 198, 220, 220, 220, 220, 220, 220, 220, 35374, 4600, 45573, 62, 9630, 63, 357, 63, 45573, 62, 312, 63, 828, 198, 220, 220, 220, 220, 220, 220, 220, 7102, 2257, 3861, 12394, 4600, 504, 86, 364, 62, 571, 69, 74, 62, 16, 63, 376, 6965, 16284, 35374, 357, 63, 13635, 62, 312, 63, 8, 4526, 24302, 24181, 1546, 4600, 13635, 82, 63, 357, 63, 312, 63, 8, 6177, 5550, 2538, 9328, 35106, 34, 19266, 11, 198, 220, 220, 220, 220, 220, 220, 220, 7102, 2257, 3861, 12394, 4600, 504, 86, 364, 62, 571, 69, 74, 62, 17, 63, 376, 6965, 16284, 35374, 357, 63, 45573, 62, 312, 63, 8, 4526, 24302, 24181, 1546, 4600, 1676, 22143, 63, 357, 63, 312, 63, 8, 6177, 5550, 2538, 9328, 35106, 34, 19266, 198, 220, 220, 220, 1267, 36924, 8881, 28, 818, 3919, 11012, 5550, 38865, 5870, 27415, 2767, 28, 40477, 23, 198, 220, 220, 220, 7559, 63, 198, 220, 220, 220, 10263, 109, 252, 45250, 100, 25, 198, 220, 220, 220, 220, 220, 220, 220, 10263, 253, 118, 17312, 105, 161, 109, 252, 45250, 100, 198, 220, 220, 220, 220, 220, 220, 220, 1917, 25, 10263, 227, 111, 164, 223, 242, 21410, 29785, 106, 165, 95, 246, 198, 220, 220, 220, 220, 220, 220, 220, 4876, 25, 10263, 227, 111, 164, 223, 242, 21410, 20015, 119, 27950, 94, 198, 220, 220, 220, 705, 7061, 628, 220, 220, 220, 11593, 8658, 11925, 480, 834, 796, 705, 504, 86, 364, 6, 628, 220, 220, 220, 2453, 62, 312, 796, 20613, 13, 39470, 10786, 13635, 62, 312, 3256, 20613, 13, 46541, 11, 20613, 13, 33616, 9218, 7, 198, 220, 220, 220, 220, 220, 220, 220, 705, 13635, 82, 13, 312, 3256, 319, 33678, 11639, 66, 28966, 33809, 9242, 540, 28, 25101, 11, 2912, 11639, 162, 236, 98, 20998, 245, 312, 11537, 198, 220, 220, 220, 1917, 62, 312, 796, 20613, 13, 39470, 10786, 45573, 62, 312, 3256, 20613, 13, 46541, 11, 20613, 13, 33616, 9218, 7, 198, 220, 220, 220, 220, 220, 220, 220, 705, 1676, 22143, 13, 312, 3256, 319, 33678, 11639, 66, 28966, 33809, 9242, 540, 28, 25101, 11, 2912, 11639, 29785, 106, 165, 95, 246, 312, 11537, 198, 220, 220, 220, 1303, 3280, 62, 312, 796, 20613, 13, 39470, 10786, 41484, 62, 312, 3256, 20613, 13, 46541, 11, 20613, 13, 33616, 9218, 7, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 705, 504, 86, 364, 13, 9654, 312, 3256, 319, 33678, 11639, 66, 28966, 33809, 9242, 540, 28, 25101, 11, 2912, 11639, 32368, 252, 163, 18433, 38519, 312, 11537, 198, 220, 220, 220, 1303, 4876, 62, 312, 796, 20613, 13, 39470, 10786, 35943, 62, 312, 3256, 20613, 13, 46541, 11, 20613, 13, 33616, 9218, 7, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 705, 83, 6791, 13, 312, 3256, 319, 33678, 11639, 66, 28966, 33809, 9242, 540, 28, 25101, 11, 2912, 11639, 20015, 119, 27950, 94, 312, 11537, 198, 220, 220, 220, 3280, 796, 20613, 13, 39470, 10786, 41484, 3256, 20613, 13, 46541, 7, 198, 220, 220, 220, 10612, 9242, 540, 28, 25101, 11, 4382, 62, 12286, 11639, 12, 16, 3256, 2912, 11639, 17739, 115, 19526, 241, 163, 18433, 162, 94, 230, 21410, 34460, 231, 165, 94, 117, 11537, 628, 220, 220, 220, 2453, 796, 20613, 13, 39468, 1056, 10786, 38855, 3256, 736, 62, 12924, 15968, 11639, 504, 86, 364, 11537, 198, 220, 220, 220, 1917, 796, 20613, 13, 39468, 1056, 10786, 40781, 3256, 736, 62, 12924, 15968, 11639, 504, 86, 364, 11537, 198, 220, 220, 220, 1303, 4876, 796, 20613, 13, 39468, 1056, 10786, 25714, 3256, 736, 62, 12924, 15968, 11639, 504, 86, 364, 11537, 198, 220, 220, 220, 1303, 3710, 796, 20613, 13, 39468, 1056, 10786, 38778, 3256, 736, 62, 12924, 15968, 11639, 504, 86, 364, 11537, 628, 220, 220, 220, 11593, 11487, 62, 22046, 834, 796, 357, 198, 220, 220, 220, 220, 220, 220, 220, 20613, 13, 35170, 9218, 3103, 2536, 2913, 10786, 13635, 62, 312, 3256, 705, 45573, 62, 312, 33809, 198, 220, 220, 220, 220, 220, 220, 220, 20613, 13, 15732, 10786, 45573, 62, 9630, 3256, 705, 45573, 62, 312, 33809, 198, 220, 220, 220, 1267, 628 ]
2.114383
883
""" Clean bioenergy data from AZEL """ import os import json import itertools import geopandas as gpd import pandas as pd os.makedirs('data', exist_ok=True) projection = 'epsg:4326' name = ['pecuarios', 'forestales', 'industriales', 'urbanos'] scenario = ['E3', 'E1'] for scenario, name in itertools.product(scenario, name): # Load bioenergy shape file print ('Reading file: {}_R{}.shp'.format(scenario, name)) df = gpd.read_file('../data/interim/shapes/FBio_{0}_R{1}.shp'.format(scenario, name)) df = df[df.geometry.notnull()].to_crs({'init': projection}) # Load transmission region dictionary with open(os.path.join('../data/interim/', 'trans-regions.json'), 'r') as fp: trans_regions = json.load(fp) # Load transmission region shapefiles lz = gpd.read_file('../data/interim/shapes/Mask_T.shp') lz = lz.to_crs({'init': projection}) lz.loc[:, 'trans-region'] = (lz['ID'].astype(int) .map('{0:02}'.format) .map(trans_regions)) assert lz.crs == df.crs if not 'forestal' in name: join = gpd.sjoin(df, lz, op='within') else: join = gpd.overlay(lz, df, how='intersection') # Get specific columns for output data try: columns = ['trans-region', 'X', 'Y', 'CLASIFICAC', 'TIPO', 'PROCESO', 'GENE_GWha', 'CAPINST_MW', 'FP'] bio = join[columns].copy(); except KeyError: columns = ['trans-region', 'CLASIFICAC', 'TIPO', 'PROCESO', 'GENE_GWha', 'CAPINST_MW', 'FP'] bio = join[columns].copy(); bio['CLASIFICAC'] = bio.CLASIFICAC.map(str.lower).str.replace(' ', '_') bio['TIPO'] = bio.TIPO.map(str.lower).str.replace(' ', '_') bio['PROCESO'] = bio.PROCESO.map(str.lower).str.replace(' ', '_') if 'E3' in scenario: scenario = 'high' else: scenario = 'low' bio.loc[:, 'scenario'] = scenario bio.loc[:, 'id'] = name bio = bio.rename(columns={'X': 'lng', 'Y': 'lat', 'CLASIFICAC': 'source', 'TIPO': 'category', 'FP': 'cf', 'GENE_GWha': 'gen_GWha', 'CAPINST_MW':'cap_MW', 'PROCESO': 'fuel_type'}) print ('Saving data: {0}_{1}'.format(scenario, name)) bio.to_csv('data/bioenergy_{0}_{1}.csv'.format(scenario, name), index=False)
[ 37811, 198, 220, 220, 220, 5985, 13401, 22554, 1366, 422, 26253, 3698, 198, 37811, 198, 11748, 28686, 198, 11748, 33918, 198, 11748, 340, 861, 10141, 198, 11748, 30324, 392, 292, 355, 27809, 67, 198, 11748, 19798, 292, 355, 279, 67, 198, 198, 418, 13, 76, 4335, 17062, 10786, 7890, 3256, 2152, 62, 482, 28, 17821, 8, 198, 198, 16302, 295, 796, 705, 25386, 70, 25, 3559, 2075, 6, 198, 3672, 796, 37250, 431, 27399, 13010, 3256, 705, 29623, 2040, 3256, 705, 23213, 380, 2040, 3256, 705, 32679, 418, 20520, 198, 1416, 39055, 796, 37250, 36, 18, 3256, 705, 36, 16, 20520, 198, 198, 1640, 8883, 11, 1438, 287, 340, 861, 10141, 13, 11167, 7, 1416, 39055, 11, 1438, 2599, 198, 220, 220, 220, 1303, 8778, 13401, 22554, 5485, 2393, 198, 220, 220, 220, 3601, 19203, 36120, 2393, 25, 23884, 62, 49, 90, 27422, 1477, 79, 4458, 18982, 7, 1416, 39055, 11, 1438, 4008, 198, 220, 220, 220, 47764, 796, 27809, 67, 13, 961, 62, 7753, 10786, 40720, 7890, 14, 3849, 320, 14, 1477, 7916, 14, 26001, 952, 23330, 15, 92, 62, 49, 90, 16, 27422, 1477, 79, 4458, 18982, 7, 1416, 39055, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1438, 4008, 198, 220, 220, 220, 47764, 796, 47764, 58, 7568, 13, 469, 15748, 13, 1662, 8423, 3419, 4083, 1462, 62, 66, 3808, 15090, 6, 15003, 10354, 20128, 30072, 628, 220, 220, 220, 1303, 8778, 11478, 3814, 22155, 198, 220, 220, 220, 351, 1280, 7, 418, 13, 6978, 13, 22179, 10786, 40720, 7890, 14, 3849, 320, 14, 3256, 705, 7645, 12, 2301, 507, 13, 17752, 33809, 705, 81, 11537, 355, 277, 79, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1007, 62, 2301, 507, 796, 33918, 13, 2220, 7, 46428, 8, 628, 220, 220, 220, 1303, 8778, 11478, 3814, 5485, 16624, 198, 220, 220, 220, 300, 89, 796, 27809, 67, 13, 961, 62, 7753, 10786, 40720, 7890, 14, 3849, 320, 14, 1477, 7916, 14, 45195, 62, 51, 13, 1477, 79, 11537, 198, 220, 220, 220, 300, 89, 796, 300, 89, 13, 1462, 62, 66, 3808, 15090, 6, 15003, 10354, 20128, 30072, 198, 220, 220, 220, 300, 89, 13, 17946, 58, 45299, 705, 7645, 12, 36996, 20520, 796, 357, 75, 89, 17816, 2389, 6, 4083, 459, 2981, 7, 600, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 8899, 10786, 90, 15, 25, 2999, 92, 4458, 18982, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 764, 8899, 7, 7645, 62, 2301, 507, 4008, 198, 220, 220, 220, 6818, 300, 89, 13, 66, 3808, 6624, 47764, 13, 66, 3808, 628, 220, 220, 220, 611, 407, 705, 754, 7757, 6, 287, 1438, 25, 198, 220, 220, 220, 220, 220, 220, 220, 4654, 796, 27809, 67, 13, 82, 22179, 7, 7568, 11, 300, 89, 11, 1034, 11639, 33479, 11537, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 4654, 796, 27809, 67, 13, 2502, 10724, 7, 75, 89, 11, 47764, 11, 703, 11639, 3849, 5458, 11537, 628, 220, 220, 220, 1303, 3497, 2176, 15180, 329, 5072, 1366, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 15180, 796, 37250, 7645, 12, 36996, 3256, 705, 55, 3256, 705, 56, 3256, 705, 5097, 1921, 30643, 2246, 3256, 705, 51, 4061, 46, 3256, 705, 4805, 4503, 1546, 46, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 35353, 36, 62, 38, 1199, 64, 3256, 705, 33177, 38604, 62, 14326, 3256, 705, 5837, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 13401, 796, 4654, 58, 28665, 82, 4083, 30073, 9783, 198, 220, 220, 220, 2845, 7383, 12331, 25, 198, 220, 220, 220, 220, 220, 220, 220, 15180, 796, 37250, 7645, 12, 36996, 3256, 705, 5097, 1921, 30643, 2246, 3256, 705, 51, 4061, 46, 3256, 705, 4805, 4503, 1546, 46, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 35353, 36, 62, 38, 1199, 64, 3256, 705, 33177, 38604, 62, 14326, 3256, 705, 5837, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 13401, 796, 4654, 58, 28665, 82, 4083, 30073, 9783, 198, 220, 220, 220, 13401, 17816, 5097, 1921, 30643, 2246, 20520, 796, 13401, 13, 5097, 1921, 30643, 2246, 13, 8899, 7, 2536, 13, 21037, 737, 2536, 13, 33491, 10786, 46083, 705, 62, 11537, 198, 220, 220, 220, 13401, 17816, 51, 4061, 46, 20520, 796, 13401, 13, 51, 4061, 46, 13, 8899, 7, 2536, 13, 21037, 737, 2536, 13, 33491, 10786, 46083, 705, 62, 11537, 198, 220, 220, 220, 13401, 17816, 4805, 4503, 1546, 46, 20520, 796, 13401, 13, 4805, 4503, 1546, 46, 13, 8899, 7, 2536, 13, 21037, 737, 2536, 13, 33491, 10786, 46083, 705, 62, 11537, 198, 220, 220, 220, 611, 705, 36, 18, 6, 287, 8883, 25, 198, 220, 220, 220, 220, 220, 220, 220, 8883, 796, 705, 8929, 6, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 8883, 796, 705, 9319, 6, 198, 220, 220, 220, 13401, 13, 17946, 58, 45299, 705, 1416, 39055, 20520, 796, 8883, 198, 220, 220, 220, 13401, 13, 17946, 58, 45299, 705, 312, 20520, 796, 1438, 198, 220, 220, 220, 13401, 796, 13401, 13, 918, 480, 7, 28665, 82, 34758, 6, 55, 10354, 705, 75, 782, 3256, 705, 56, 10354, 705, 15460, 3256, 705, 5097, 1921, 30643, 2246, 10354, 705, 10459, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 51, 4061, 46, 10354, 705, 22872, 3256, 705, 5837, 10354, 705, 12993, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 35353, 36, 62, 38, 1199, 64, 10354, 705, 5235, 62, 38, 1199, 64, 3256, 705, 33177, 38604, 62, 14326, 10354, 6, 11128, 62, 14326, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 4805, 4503, 1546, 46, 10354, 705, 25802, 62, 4906, 6, 30072, 198, 220, 220, 220, 3601, 19203, 50, 2703, 1366, 25, 1391, 15, 92, 23330, 16, 92, 4458, 18982, 7, 1416, 39055, 11, 1438, 4008, 198, 220, 220, 220, 13401, 13, 1462, 62, 40664, 10786, 7890, 14, 65, 952, 22554, 23330, 15, 92, 23330, 16, 27422, 40664, 4458, 18982, 7, 1416, 39055, 11, 1438, 828, 6376, 28, 25101, 8, 198 ]
2.003236
1,236
#the table should be read T[deg][a] where a is the multiplicity of the Q def build1DCeilingTable(c): '''entry for A is max k s.t. l(A) = l(A+kP) and l(A+kQ) ''' max_deg = [0 for _ in range(c.m)] CLP = c.fill_degree_table_reverse(update, max_deg) CLQ = c.fill_degree_table_reverse(update, max_deg) return ['CLP','CLQ'], [CLP,CLQ]
[ 198, 2, 1169, 3084, 815, 307, 1100, 309, 58, 13500, 7131, 64, 60, 810, 257, 318, 262, 15082, 8467, 286, 262, 1195, 198, 4299, 1382, 16, 9697, 68, 4386, 10962, 7, 66, 2599, 198, 220, 220, 220, 705, 7061, 13000, 329, 317, 318, 3509, 479, 264, 13, 83, 13, 300, 7, 32, 8, 796, 300, 7, 32, 10, 74, 47, 8, 290, 300, 7, 32, 10, 74, 48, 8, 705, 7061, 198, 220, 220, 220, 3509, 62, 13500, 796, 685, 15, 329, 4808, 287, 2837, 7, 66, 13, 76, 15437, 198, 220, 220, 220, 7852, 47, 796, 269, 13, 20797, 62, 16863, 62, 11487, 62, 50188, 7, 19119, 11, 3509, 62, 13500, 8, 198, 220, 220, 220, 7852, 48, 796, 269, 13, 20797, 62, 16863, 62, 11487, 62, 50188, 7, 19119, 11, 3509, 62, 13500, 8, 198, 220, 220, 220, 1441, 37250, 5097, 47, 41707, 5097, 48, 6, 4357, 685, 5097, 47, 11, 5097, 48, 60, 198 ]
2.229299
157
# 1. Observe os dois métodos de exclusão listados abaixo. # # 2. Identifique a quais estruturas pertencem os métodos, respectivamente. # R: A primeira é Lista duplamente encadeada (double_linked), metodo de remoção. A segunda é Lista encadeada, metodo de remoção # # 3. Explique qual a diferença FUNDAMENTAL entre os dois métodos. # R: na lista duplamente encadeada um nodo sempre aponta para o next e um prev, pois assim a lista pode ser percorrida de qualquer direção, tanto no inicio para o fim, quanto do fim para o inicio. Já a lista ordenada, possui apenas o next, ou seja, a lista só é acessada percorrendo uma unica direção. # Método 1 # Método 2
[ 2, 352, 13, 11086, 3760, 28686, 466, 271, 285, 25125, 375, 418, 390, 10293, 28749, 1351, 22484, 450, 64, 844, 78, 13, 198, 2, 198, 2, 362, 13, 11440, 361, 2350, 257, 627, 15152, 1556, 81, 315, 17786, 22146, 594, 76, 28686, 285, 25125, 375, 418, 11, 2461, 452, 3263, 68, 13, 628, 198, 198, 2, 371, 25, 317, 6994, 8704, 38251, 7343, 64, 14184, 3263, 68, 2207, 671, 4763, 357, 23352, 62, 25614, 828, 1138, 24313, 390, 816, 78, 16175, 28749, 13, 317, 384, 70, 46535, 38251, 7343, 64, 2207, 671, 4763, 11, 1138, 24313, 390, 816, 78, 16175, 28749, 628, 198, 198, 2, 198, 2, 513, 13, 5905, 2350, 4140, 257, 288, 361, 14226, 50041, 29397, 35, 2390, 3525, 1847, 920, 260, 28686, 466, 271, 285, 25125, 375, 418, 13, 628, 198, 2, 371, 25, 12385, 1351, 64, 14184, 3263, 68, 2207, 671, 4763, 23781, 18666, 78, 5026, 3866, 2471, 756, 64, 31215, 267, 1306, 304, 23781, 8654, 11, 745, 271, 840, 320, 257, 1351, 64, 279, 1098, 1055, 583, 10215, 81, 3755, 390, 4140, 10819, 19958, 16175, 28749, 11, 256, 14723, 645, 287, 46441, 31215, 267, 277, 320, 11, 5554, 78, 466, 277, 320, 31215, 267, 287, 46441, 13, 449, 6557, 257, 1351, 64, 2760, 268, 4763, 11, 1184, 9019, 2471, 268, 292, 267, 1306, 11, 267, 84, 384, 6592, 11, 257, 1351, 64, 264, 10205, 38251, 257, 919, 4763, 583, 10215, 10920, 78, 334, 2611, 555, 3970, 19958, 16175, 28749, 13, 220, 198, 198, 2, 337, 25125, 24313, 352, 628, 198, 2, 337, 25125, 24313, 362 ]
2.561538
260
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2020 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """CSRF Middleware. The implementation is highly inspred from Django's initial implementation about CSRF protection. For more information you can see here: <https://github.com/django/django/blob/master/django/middleware/csrf.py> """ import re import secrets import string from datetime import datetime, timedelta, timezone from flask import Blueprint, abort, current_app, request from itsdangerous import BadSignature, SignatureExpired, \ TimedJSONWebSignatureSerializer from six import string_types from six.moves.urllib.parse import urlparse from .errors import RESTCSRFError REASON_NO_REFERER = "Referer checking failed - no Referer." REASON_BAD_REFERER = ( "Referer checking failed - %s does not match any trusted origins." ) REASON_NO_CSRF_COOKIE = "CSRF cookie not set." REASON_BAD_TOKEN = "CSRF token missing or incorrect." REASON_MALFORMED_REFERER = "Referer checking failed - Referer is malformed." REASON_INSECURE_REFERER = ( "Referer checking failed - Referer is insecure while host is secure." ) REASON_TOKEN_EXPIRED = "CSRF token expired. Try again." def _get_csrf_serializer(expires_in=None): """Note that this serializer is used to encode/decode the CSRF cookie. In case you change this implementation bear in mind that the token generated must be signed so as to avoid any client-side tampering. """ expires_in = expires_in or current_app.config['CSRF_TOKEN_EXPIRES_IN'] return TimedJSONWebSignatureSerializer( current_app.config.get( 'CSRF_SECRET', current_app.config.get('SECRET_KEY') or 'CHANGE_ME'), salt=current_app.config['CSRF_SECRET_SALT'], expires_in=expires_in, ) def csrf_validate(): """Check CSRF cookie against request headers.""" if request.is_secure: referer = request.referrer if referer is None: return _abort400(REASON_NO_REFERER) referer = urlparse(referer) # Make sure we have a valid URL for Referer. if '' in (referer.scheme, referer.netloc): return _abort400(REASON_MALFORMED_REFERER) # Ensure that our Referer is also secure. if not _is_referer_secure(referer): return _abort400(REASON_INSECURE_REFERER) is_hostname_allowed = referer.hostname in \ current_app.config.get('APP_ALLOWED_HOSTS') if not is_hostname_allowed: reason = REASON_BAD_REFERER % referer.geturl() return _abort400(reason) csrf_token = _get_csrf_token() if csrf_token is None: return _abort400(REASON_NO_CSRF_COOKIE) request_csrf_token = _get_submitted_csrf_token() if not request_csrf_token: _abort400(REASON_BAD_TOKEN) decoded_request_csrf_token = _decode_csrf(request_csrf_token) if csrf_token != decoded_request_csrf_token: return _abort400(REASON_BAD_TOKEN) def reset_token(): """Change the CSRF token in use for a request.""" request.csrf_cookie_needs_reset = True class CSRFTokenMiddleware(): """CSRF Token Middleware.""" def __init__(self, app=None): """Middleware initialization. :param app: An instance of :class:`flask.Flask`. """ if app: self.init_app(app) def init_app(self, app): """Initialize middleware extension. :param app: An instance of :class:`flask.Flask`. """ app.config.setdefault('CSRF_COOKIE_NAME', 'csrftoken') app.config.setdefault('CSRF_HEADER', 'X-CSRFToken') app.config.setdefault( 'CSRF_METHODS', ['POST', 'PUT', 'PATCH', 'DELETE']) app.config.setdefault('CSRF_TOKEN_LENGTH', 32) app.config.setdefault( 'CSRF_ALLOWED_CHARS', string.ascii_letters + string.digits) app.config.setdefault('CSRF_SECRET_SALT', 'invenio-csrf-token') app.config.setdefault('CSRF_FORCE_SECURE_REFERER', True) app.config.setdefault( 'CSRF_COOKIE_SAMESITE', app.config.get('SESSION_COOKIE_SAMESITE') or 'Lax') # The token last for 24 hours, but the cookie for 7 days. This allows # us to implement transparent token rotation during those 7 days. Note, # that the token is automatically rotated on login, thus you can also # change PERMANENT_SESSION_LIFETIME app.config.setdefault('CSRF_TOKEN_EXPIRES_IN', 60*60*24) # We allow usage of an expired CSRF token during this period. This way # we can rotate the CSRF token without the user getting an CSRF error. # Align with CSRF_COOKIE_MAX_AGE app.config.setdefault('CSRF_TOKEN_GRACE_PERIOD', 60*60*24*7) @app.after_request app.extensions['invenio-csrf'] = self class CSRFProtectMiddleware(CSRFTokenMiddleware): """CSRF Middleware.""" def __init__(self, app=None): """Middleware initialization. :param app: An instance of :class:`flask.Flask`. """ self._exempt_views = set() self._exempt_blueprints = set() self._before_protect_funcs = [] if app: self.init_app(app) def init_app(self, app): """Initialize middleware extension. :param app: An instance of :class:`flask.Flask`. """ super(CSRFProtectMiddleware, self).init_app(app) @app.before_request def csrf_protect(): """CSRF protect method.""" for func in self._before_protect_funcs: func() is_method_vulnerable = request.method in app.config['CSRF_METHODS'] if not is_method_vulnerable: return if request.blueprint in self._exempt_blueprints: return if hasattr(request, 'skip_csrf_check'): return view = app.view_functions.get(request.endpoint) if view: dest = '{0}.{1}'.format(view.__module__, view.__name__) if dest in self._exempt_views: return return csrf_validate() def before_csrf_protect(self, f): """Register functions to be invoked before checking csrf. The function accepts nothing as parameters. """ self._before_protect_funcs.append(f) return f def exempt(self, view): """Mark a view or blueprint to be excluded from CSRF protection.""" if isinstance(view, Blueprint): self._exempt_blueprints.add(view.name) return view if isinstance(view, string_types): view_location = view else: view_location = '.'.join((view.__module__, view.__name__)) self._exempt_views.add(view_location) return view csrf = CSRFProtectMiddleware()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 554, 574, 952, 13, 198, 2, 15069, 357, 34, 8, 12131, 327, 28778, 13, 198, 2, 198, 2, 554, 574, 952, 318, 1479, 3788, 26, 345, 460, 17678, 4163, 340, 290, 14, 273, 13096, 340, 198, 2, 739, 262, 2846, 286, 262, 17168, 13789, 26, 766, 38559, 24290, 2393, 329, 517, 3307, 13, 198, 198, 37811, 7902, 32754, 6046, 1574, 13, 198, 198, 464, 7822, 318, 4047, 1035, 28764, 422, 37770, 338, 4238, 7822, 198, 10755, 9429, 32754, 4800, 13, 1114, 517, 1321, 345, 460, 766, 994, 25, 198, 27, 5450, 1378, 12567, 13, 785, 14, 28241, 14208, 14, 28241, 14208, 14, 2436, 672, 14, 9866, 14, 28241, 14208, 14, 27171, 1574, 14, 6359, 41871, 13, 9078, 29, 198, 37811, 198, 198, 11748, 302, 198, 11748, 13141, 198, 11748, 4731, 198, 6738, 4818, 8079, 1330, 4818, 8079, 11, 28805, 12514, 11, 640, 11340, 198, 198, 6738, 42903, 1330, 39932, 11, 15614, 11, 1459, 62, 1324, 11, 2581, 198, 6738, 663, 38537, 516, 1330, 7772, 11712, 1300, 11, 34894, 3109, 6474, 11, 3467, 198, 220, 220, 220, 5045, 276, 40386, 13908, 11712, 1300, 32634, 7509, 198, 6738, 2237, 1330, 4731, 62, 19199, 198, 6738, 2237, 13, 76, 5241, 13, 333, 297, 571, 13, 29572, 1330, 19016, 29572, 198, 198, 6738, 764, 48277, 1330, 15731, 4825, 12562, 37, 12331, 198, 198, 2200, 36033, 62, 15285, 62, 2200, 24302, 1137, 796, 366, 8134, 11882, 10627, 4054, 532, 645, 6524, 11882, 526, 198, 2200, 36033, 62, 33, 2885, 62, 2200, 24302, 1137, 796, 357, 198, 220, 220, 220, 366, 8134, 11882, 10627, 4054, 532, 4064, 82, 857, 407, 2872, 597, 13467, 15587, 526, 198, 8, 198, 2200, 36033, 62, 15285, 62, 7902, 32754, 62, 34, 15308, 10008, 796, 366, 7902, 32754, 19751, 407, 900, 526, 198, 2200, 36033, 62, 33, 2885, 62, 10468, 43959, 796, 366, 7902, 32754, 11241, 4814, 393, 11491, 526, 198, 2200, 36033, 62, 42126, 21389, 1961, 62, 2200, 24302, 1137, 796, 366, 8134, 11882, 10627, 4054, 532, 6524, 11882, 318, 6428, 12214, 526, 198, 2200, 36033, 62, 20913, 2943, 11335, 62, 2200, 24302, 1137, 796, 357, 198, 220, 220, 220, 366, 8134, 11882, 10627, 4054, 532, 6524, 11882, 318, 31955, 981, 2583, 318, 5713, 526, 198, 8, 198, 2200, 36033, 62, 10468, 43959, 62, 49864, 37819, 796, 366, 7902, 32754, 11241, 21350, 13, 9993, 757, 526, 628, 198, 4299, 4808, 1136, 62, 6359, 41871, 62, 46911, 7509, 7, 11201, 2387, 62, 259, 28, 14202, 2599, 198, 220, 220, 220, 37227, 6425, 326, 428, 11389, 7509, 318, 973, 284, 37773, 14, 12501, 1098, 262, 9429, 32754, 19751, 13, 628, 220, 220, 220, 554, 1339, 345, 1487, 428, 7822, 6842, 287, 2000, 326, 262, 11241, 198, 220, 220, 220, 7560, 1276, 307, 4488, 523, 355, 284, 3368, 597, 5456, 12, 1589, 42471, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 27396, 62, 259, 796, 27396, 62, 259, 393, 1459, 62, 1324, 13, 11250, 17816, 7902, 32754, 62, 10468, 43959, 62, 49864, 4663, 1546, 62, 1268, 20520, 628, 220, 220, 220, 1441, 5045, 276, 40386, 13908, 11712, 1300, 32634, 7509, 7, 198, 220, 220, 220, 220, 220, 220, 220, 1459, 62, 1324, 13, 11250, 13, 1136, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 7902, 32754, 62, 23683, 26087, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1459, 62, 1324, 13, 11250, 13, 1136, 10786, 23683, 26087, 62, 20373, 11537, 393, 705, 3398, 27746, 62, 11682, 33809, 198, 220, 220, 220, 220, 220, 220, 220, 8268, 28, 14421, 62, 1324, 13, 11250, 17816, 7902, 32754, 62, 23683, 26087, 62, 50, 31429, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 27396, 62, 259, 28, 11201, 2387, 62, 259, 11, 198, 220, 220, 220, 1267, 628, 628, 628, 628, 628, 198, 4299, 269, 27891, 69, 62, 12102, 378, 33529, 198, 220, 220, 220, 37227, 9787, 9429, 32754, 19751, 1028, 2581, 24697, 526, 15931, 198, 220, 220, 220, 611, 2581, 13, 271, 62, 22390, 25, 198, 220, 220, 220, 220, 220, 220, 220, 6773, 81, 796, 2581, 13, 260, 2232, 11751, 628, 220, 220, 220, 220, 220, 220, 220, 611, 6773, 81, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 397, 419, 7029, 7, 2200, 36033, 62, 15285, 62, 2200, 24302, 1137, 8, 628, 220, 220, 220, 220, 220, 220, 220, 6773, 81, 796, 19016, 29572, 7, 5420, 11882, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 6889, 1654, 356, 423, 257, 4938, 10289, 329, 6524, 11882, 13, 198, 220, 220, 220, 220, 220, 220, 220, 611, 10148, 287, 357, 5420, 11882, 13, 15952, 1326, 11, 6773, 81, 13, 3262, 17946, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 397, 419, 7029, 7, 2200, 36033, 62, 42126, 21389, 1961, 62, 2200, 24302, 1137, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 48987, 326, 674, 6524, 11882, 318, 635, 5713, 13, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 4808, 271, 62, 5420, 11882, 62, 22390, 7, 5420, 11882, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 397, 419, 7029, 7, 2200, 36033, 62, 20913, 2943, 11335, 62, 2200, 24302, 1137, 8, 628, 220, 220, 220, 220, 220, 220, 220, 318, 62, 4774, 3672, 62, 40845, 796, 6773, 81, 13, 4774, 3672, 287, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1459, 62, 1324, 13, 11250, 13, 1136, 10786, 24805, 62, 7036, 3913, 1961, 62, 39, 10892, 50, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 611, 407, 318, 62, 4774, 3672, 62, 40845, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1738, 796, 4526, 36033, 62, 33, 2885, 62, 2200, 24302, 1137, 4064, 6773, 81, 13, 1136, 6371, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 397, 419, 7029, 7, 41181, 8, 628, 220, 220, 220, 269, 27891, 69, 62, 30001, 796, 4808, 1136, 62, 6359, 41871, 62, 30001, 3419, 198, 220, 220, 220, 611, 269, 27891, 69, 62, 30001, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 397, 419, 7029, 7, 2200, 36033, 62, 15285, 62, 7902, 32754, 62, 34, 15308, 10008, 8, 628, 220, 220, 220, 2581, 62, 6359, 41871, 62, 30001, 796, 4808, 1136, 62, 7266, 3291, 62, 6359, 41871, 62, 30001, 3419, 198, 220, 220, 220, 611, 407, 2581, 62, 6359, 41871, 62, 30001, 25, 198, 220, 220, 220, 220, 220, 220, 220, 4808, 397, 419, 7029, 7, 2200, 36033, 62, 33, 2885, 62, 10468, 43959, 8, 628, 220, 220, 220, 875, 9043, 62, 25927, 62, 6359, 41871, 62, 30001, 796, 4808, 12501, 1098, 62, 6359, 41871, 7, 25927, 62, 6359, 41871, 62, 30001, 8, 628, 220, 220, 220, 611, 269, 27891, 69, 62, 30001, 14512, 875, 9043, 62, 25927, 62, 6359, 41871, 62, 30001, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 397, 419, 7029, 7, 2200, 36033, 62, 33, 2885, 62, 10468, 43959, 8, 628, 198, 4299, 13259, 62, 30001, 33529, 198, 220, 220, 220, 37227, 19400, 262, 9429, 32754, 11241, 287, 779, 329, 257, 2581, 526, 15931, 198, 220, 220, 220, 2581, 13, 6359, 41871, 62, 44453, 62, 50032, 62, 42503, 796, 6407, 628, 198, 4871, 9429, 49, 9792, 4233, 34621, 1574, 33529, 198, 220, 220, 220, 37227, 7902, 32754, 29130, 6046, 1574, 526, 15931, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 598, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 34621, 1574, 37588, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 598, 25, 1052, 4554, 286, 1058, 4871, 25, 63, 2704, 2093, 13, 7414, 2093, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 611, 598, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 15003, 62, 1324, 7, 1324, 8, 628, 220, 220, 220, 825, 2315, 62, 1324, 7, 944, 11, 598, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 24243, 1096, 3504, 1574, 7552, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 598, 25, 1052, 4554, 286, 1058, 4871, 25, 63, 2704, 2093, 13, 7414, 2093, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 10786, 7902, 32754, 62, 34, 15308, 10008, 62, 20608, 3256, 705, 6359, 81, 701, 4233, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 10786, 7902, 32754, 62, 37682, 1137, 3256, 705, 55, 12, 7902, 49, 9792, 4233, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 7902, 32754, 62, 49273, 50, 3256, 37250, 32782, 3256, 705, 30076, 3256, 705, 47, 11417, 3256, 705, 7206, 2538, 9328, 6, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 10786, 7902, 32754, 62, 10468, 43959, 62, 43, 49494, 3256, 3933, 8, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 7902, 32754, 62, 7036, 3913, 1961, 62, 3398, 27415, 3256, 4731, 13, 292, 979, 72, 62, 15653, 1343, 4731, 13, 12894, 896, 8, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 10786, 7902, 32754, 62, 23683, 26087, 62, 50, 31429, 3256, 705, 259, 574, 952, 12, 6359, 41871, 12, 30001, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 10786, 7902, 32754, 62, 13775, 5222, 62, 23683, 11335, 62, 2200, 24302, 1137, 3256, 6407, 8, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 7902, 32754, 62, 34, 15308, 10008, 62, 50, 29559, 12709, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 1136, 10786, 50, 47621, 62, 34, 15308, 10008, 62, 50, 29559, 12709, 11537, 393, 705, 43, 897, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 383, 11241, 938, 329, 1987, 2250, 11, 475, 262, 19751, 329, 767, 1528, 13, 770, 3578, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 514, 284, 3494, 13245, 11241, 13179, 1141, 883, 767, 1528, 13, 5740, 11, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 326, 262, 11241, 318, 6338, 38375, 319, 17594, 11, 4145, 345, 460, 635, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 1487, 19878, 10725, 3525, 62, 50, 47621, 62, 43, 5064, 2767, 12789, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 10786, 7902, 32754, 62, 10468, 43959, 62, 49864, 4663, 1546, 62, 1268, 3256, 3126, 9, 1899, 9, 1731, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 775, 1249, 8748, 286, 281, 21350, 9429, 32754, 11241, 1141, 428, 2278, 13, 770, 835, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 356, 460, 23064, 262, 9429, 32754, 11241, 1231, 262, 2836, 1972, 281, 9429, 32754, 4049, 13, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 978, 570, 351, 9429, 32754, 62, 34, 15308, 10008, 62, 22921, 62, 11879, 198, 220, 220, 220, 220, 220, 220, 220, 598, 13, 11250, 13, 2617, 12286, 10786, 7902, 32754, 62, 10468, 43959, 62, 10761, 11598, 62, 18973, 40, 3727, 3256, 3126, 9, 1899, 9, 1731, 9, 22, 8, 628, 220, 220, 220, 220, 220, 220, 220, 2488, 1324, 13, 8499, 62, 25927, 628, 220, 220, 220, 220, 220, 220, 220, 598, 13, 2302, 5736, 17816, 259, 574, 952, 12, 6359, 41871, 20520, 796, 2116, 628, 198, 4871, 9429, 32754, 41426, 34621, 1574, 7, 7902, 49, 9792, 4233, 34621, 1574, 2599, 198, 220, 220, 220, 37227, 7902, 32754, 6046, 1574, 526, 15931, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 598, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 34621, 1574, 37588, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 598, 25, 1052, 4554, 286, 1058, 4871, 25, 63, 2704, 2093, 13, 7414, 2093, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 42679, 62, 33571, 796, 900, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 42679, 62, 17585, 17190, 796, 900, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 19052, 62, 35499, 62, 12543, 6359, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 611, 598, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 15003, 62, 1324, 7, 1324, 8, 628, 220, 220, 220, 825, 2315, 62, 1324, 7, 944, 11, 598, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 24243, 1096, 3504, 1574, 7552, 13, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 598, 25, 1052, 4554, 286, 1058, 4871, 25, 63, 2704, 2093, 13, 7414, 2093, 44646, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2208, 7, 7902, 32754, 41426, 34621, 1574, 11, 2116, 737, 15003, 62, 1324, 7, 1324, 8, 628, 220, 220, 220, 220, 220, 220, 220, 2488, 1324, 13, 19052, 62, 25927, 198, 220, 220, 220, 220, 220, 220, 220, 825, 269, 27891, 69, 62, 35499, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37227, 7902, 32754, 1805, 2446, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 25439, 287, 2116, 13557, 19052, 62, 35499, 62, 12543, 6359, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25439, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 318, 62, 24396, 62, 85, 38828, 796, 2581, 13, 24396, 287, 598, 13, 11250, 17816, 7902, 32754, 62, 49273, 50, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 407, 318, 62, 24396, 62, 85, 38828, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2581, 13, 17585, 4798, 287, 2116, 13557, 42679, 62, 17585, 17190, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 468, 35226, 7, 25927, 11, 705, 48267, 62, 6359, 41871, 62, 9122, 6, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1570, 796, 598, 13, 1177, 62, 12543, 2733, 13, 1136, 7, 25927, 13, 437, 4122, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1570, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2244, 796, 705, 90, 15, 27422, 90, 16, 92, 4458, 18982, 7, 1177, 13, 834, 21412, 834, 11, 1570, 13, 834, 3672, 834, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2244, 287, 2116, 13557, 42679, 62, 33571, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 269, 27891, 69, 62, 12102, 378, 3419, 628, 220, 220, 220, 825, 878, 62, 6359, 41871, 62, 35499, 7, 944, 11, 277, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 38804, 5499, 284, 307, 24399, 878, 10627, 269, 27891, 69, 13, 628, 220, 220, 220, 220, 220, 220, 220, 383, 2163, 18178, 2147, 355, 10007, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 19052, 62, 35499, 62, 12543, 6359, 13, 33295, 7, 69, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 277, 628, 220, 220, 220, 825, 13068, 7, 944, 11, 1570, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 9704, 257, 1570, 393, 30881, 284, 307, 15009, 422, 9429, 32754, 4800, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 611, 318, 39098, 7, 1177, 11, 39932, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 42679, 62, 17585, 17190, 13, 2860, 7, 1177, 13, 3672, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1570, 628, 220, 220, 220, 220, 220, 220, 220, 611, 318, 39098, 7, 1177, 11, 4731, 62, 19199, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1570, 62, 24886, 796, 1570, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1570, 62, 24886, 796, 705, 2637, 13, 22179, 19510, 1177, 13, 834, 21412, 834, 11, 1570, 13, 834, 3672, 834, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 42679, 62, 33571, 13, 2860, 7, 1177, 62, 24886, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1570, 628, 198, 6359, 41871, 796, 9429, 32754, 41426, 34621, 1574, 3419, 198 ]
2.362901
2,965
import pytest import unittest from unittest.mock import MagicMock from polymetis import GripperInterface import polymetis_pb2 @pytest.fixture @pytest.mark.parametrize("blocking", [True, False])
[ 11748, 12972, 9288, 198, 11748, 555, 715, 395, 198, 6738, 555, 715, 395, 13, 76, 735, 1330, 6139, 44, 735, 198, 198, 6738, 7514, 4164, 271, 1330, 20914, 2848, 39317, 198, 11748, 7514, 4164, 271, 62, 40842, 17, 628, 198, 31, 9078, 9288, 13, 69, 9602, 628, 198, 31, 9078, 9288, 13, 4102, 13, 17143, 316, 380, 2736, 7203, 41938, 1600, 685, 17821, 11, 10352, 12962, 198 ]
2.970149
67
# Generated by Django 2.2.10 on 2021-01-17 17:26 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 13, 940, 319, 33448, 12, 486, 12, 1558, 1596, 25, 2075, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.875
32
from pathlib import Path from shutil import copyfile from unittest import mock import click from click.testing import CliRunner from pixivapi import BadApiResponse, LoginError, Visibility from pixi.commands import ( _confirm_table_wipe, _get_starting_bookmark_offset, artist, auth, bookmarks, config, failed, illust, migrate, wipe, ) from pixi.database import Migration, database from pixi.errors import DownloadFailed, PixiError @mock.patch("pixi.commands.Config") @mock.patch("pixi.commands.Client") @mock.patch("pixi.commands.Config") @mock.patch("pixi.commands.Client") @mock.patch("click.edit") @mock.patch("click.edit") @mock.patch("pixi.commands.calculate_migrations_needed") @mock.patch("pixi.commands.calculate_migrations_needed") @mock.patch("pixi.commands.download_image") @mock.patch("pixi.commands.Client") @mock.patch("pixi.commands.Config") @mock.patch("pixi.commands.download_image") @mock.patch("pixi.commands.Client") @mock.patch("pixi.commands.Config") @mock.patch("pixi.commands.download_pages") @mock.patch("pixi.commands.Client") @mock.patch("pixi.commands.Config") @mock.patch("pixi.commands.download_pages") @mock.patch("pixi.commands.Client") @mock.patch("pixi.commands.Config") @mock.patch("pixi.commands.download_pages") @mock.patch("pixi.commands.Client") @mock.patch("pixi.commands.Config") @mock.patch("pixi.commands._confirm_table_wipe") @mock.patch("pixi.commands._confirm_table_wipe") @mock.patch("pixi.commands._confirm_table_wipe")
[ 6738, 3108, 8019, 1330, 10644, 198, 6738, 4423, 346, 1330, 4866, 7753, 198, 6738, 555, 715, 395, 1330, 15290, 198, 198, 11748, 3904, 198, 6738, 3904, 13, 33407, 1330, 1012, 72, 49493, 198, 6738, 279, 844, 452, 15042, 1330, 7772, 32, 14415, 31077, 11, 23093, 12331, 11, 6911, 2247, 198, 198, 6738, 279, 844, 72, 13, 9503, 1746, 1330, 357, 198, 220, 220, 220, 4808, 10414, 2533, 62, 11487, 62, 86, 3757, 11, 198, 220, 220, 220, 4808, 1136, 62, 38690, 62, 2070, 4102, 62, 28968, 11, 198, 220, 220, 220, 6802, 11, 198, 220, 220, 220, 6284, 11, 198, 220, 220, 220, 1492, 14306, 11, 198, 220, 220, 220, 4566, 11, 198, 220, 220, 220, 4054, 11, 198, 220, 220, 220, 6406, 11, 198, 220, 220, 220, 32492, 11, 198, 220, 220, 220, 19916, 11, 198, 8, 198, 6738, 279, 844, 72, 13, 48806, 1330, 36991, 11, 6831, 198, 6738, 279, 844, 72, 13, 48277, 1330, 10472, 37, 6255, 11, 21642, 72, 12331, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 16934, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 11792, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 16934, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 11792, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 12976, 13, 19312, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 12976, 13, 19312, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 9948, 3129, 378, 62, 76, 3692, 602, 62, 27938, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 9948, 3129, 378, 62, 76, 3692, 602, 62, 27938, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 15002, 62, 9060, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 11792, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 16934, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 15002, 62, 9060, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 11792, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 16934, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 15002, 62, 31126, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 11792, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 16934, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 15002, 62, 31126, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 11792, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 16934, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 15002, 62, 31126, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 11792, 4943, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13, 16934, 4943, 628, 628, 198, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13557, 10414, 2533, 62, 11487, 62, 86, 3757, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13557, 10414, 2533, 62, 11487, 62, 86, 3757, 4943, 628, 198, 31, 76, 735, 13, 17147, 7203, 79, 844, 72, 13, 9503, 1746, 13557, 10414, 2533, 62, 11487, 62, 86, 3757, 4943, 628, 198 ]
2.439873
632
import torch from torch import nn from torch import optim from vae import * from loader import * from skempi_lib import * from torch_utils import * BATCH_SIZE = 32 LR = 1e-3 if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() add_arguments(parser) args = parser.parse_args() net = VAE2(nc=24, ngf=64, ndf=64, latent_variable_size=256) net.to(device) # opt = optim.SGD(net.parameters(), lr=LR, momentum=0.9, nesterov=True) opt = ScheduledOptimizer(optim.Adam(net.parameters(), lr=LR), LR, num_iterations=200) if args.resume: if os.path.isfile(args.resume): print("=> loading checkpoint '%s'" % args.resume) checkpoint = torch.load(args.resume, map_location=lambda storage, loc: storage) init_epoch = checkpoint['epoch'] net.load_state_dict(checkpoint['net']) opt.load_state_dict(checkpoint['opt']) else: print("=> no checkpoint found at '%s'" % args.resume) num_epochs = args.num_epochs init_epoch = 0 n_iter = 0 for epoch in range(init_epoch, num_epochs): train_iter, eval_iter = 20000, 5000 loader = pdb_loader(PDB_ZIP, TRAINING_SET, train_iter, 19.9, 1.25, handle_error=handle_error) n_iter = train(net, opt, batch_generator(loader, BATCH_SIZE), train_iter, n_iter) if epoch < num_epochs - 1 and epoch % args.eval_every != 0: continue loader = pdb_loader(PDB_ZIP, VALIDATION_SET, eval_iter, 19.9, 1.25, handle_error=handle_error) loss = evaluate(net, batch_generator(loader, BATCH_SIZE), eval_iter, n_iter) print("[Epoch %d/%d] (Validation Loss: %.5f" % (epoch + 1, num_epochs, loss)) save_checkpoint({ 'lr': opt.lr, 'epoch': epoch, 'net': net.state_dict(), 'opt': opt.state_dict() }, loss, "beast", args.out_dir)
[ 11748, 28034, 198, 6738, 28034, 1330, 299, 77, 198, 6738, 28034, 1330, 6436, 198, 198, 6738, 410, 3609, 1330, 1635, 198, 6738, 40213, 1330, 1635, 198, 6738, 6146, 3149, 72, 62, 8019, 1330, 1635, 198, 6738, 28034, 62, 26791, 1330, 1635, 198, 198, 33, 11417, 62, 33489, 796, 3933, 198, 35972, 796, 352, 68, 12, 18, 628, 628, 628, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1330, 1822, 29572, 628, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 3419, 198, 220, 220, 220, 751, 62, 853, 2886, 7, 48610, 8, 198, 220, 220, 220, 26498, 796, 30751, 13, 29572, 62, 22046, 3419, 628, 220, 220, 220, 2010, 796, 13753, 36, 17, 7, 10782, 28, 1731, 11, 23370, 69, 28, 2414, 11, 299, 7568, 28, 2414, 11, 41270, 62, 45286, 62, 7857, 28, 11645, 8, 198, 220, 220, 220, 2010, 13, 1462, 7, 25202, 8, 198, 220, 220, 220, 1303, 2172, 796, 6436, 13, 38475, 35, 7, 3262, 13, 17143, 7307, 22784, 300, 81, 28, 35972, 11, 12858, 28, 15, 13, 24, 11, 299, 7834, 709, 28, 17821, 8, 198, 220, 220, 220, 2172, 796, 27774, 6309, 27871, 320, 7509, 7, 40085, 13, 23159, 7, 3262, 13, 17143, 7307, 22784, 300, 81, 28, 35972, 828, 37491, 11, 997, 62, 2676, 602, 28, 2167, 8, 628, 220, 220, 220, 611, 26498, 13, 411, 2454, 25, 198, 220, 220, 220, 220, 220, 220, 220, 611, 28686, 13, 6978, 13, 4468, 576, 7, 22046, 13, 411, 2454, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 14804, 11046, 26954, 705, 4, 82, 29653, 4064, 26498, 13, 411, 2454, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26954, 796, 28034, 13, 2220, 7, 22046, 13, 411, 2454, 11, 3975, 62, 24886, 28, 50033, 6143, 11, 1179, 25, 6143, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2315, 62, 538, 5374, 796, 26954, 17816, 538, 5374, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2010, 13, 2220, 62, 5219, 62, 11600, 7, 9122, 4122, 17816, 3262, 6, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2172, 13, 2220, 62, 5219, 62, 11600, 7, 9122, 4122, 17816, 8738, 6, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 14804, 645, 26954, 1043, 379, 705, 4, 82, 29653, 4064, 26498, 13, 411, 2454, 8, 628, 220, 220, 220, 997, 62, 538, 5374, 82, 796, 26498, 13, 22510, 62, 538, 5374, 82, 198, 220, 220, 220, 2315, 62, 538, 5374, 796, 657, 198, 220, 220, 220, 299, 62, 2676, 796, 657, 198, 220, 220, 220, 329, 36835, 287, 2837, 7, 15003, 62, 538, 5374, 11, 997, 62, 538, 5374, 82, 2599, 628, 220, 220, 220, 220, 220, 220, 220, 4512, 62, 2676, 11, 5418, 62, 2676, 796, 939, 405, 11, 23336, 198, 220, 220, 220, 220, 220, 220, 220, 40213, 796, 279, 9945, 62, 29356, 7, 5760, 33, 62, 57, 4061, 11, 29125, 1268, 2751, 62, 28480, 11, 4512, 62, 2676, 11, 678, 13, 24, 11, 352, 13, 1495, 11, 5412, 62, 18224, 28, 28144, 62, 18224, 8, 198, 220, 220, 220, 220, 220, 220, 220, 299, 62, 2676, 796, 4512, 7, 3262, 11, 2172, 11, 15458, 62, 8612, 1352, 7, 29356, 11, 347, 11417, 62, 33489, 828, 4512, 62, 2676, 11, 299, 62, 2676, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 36835, 1279, 997, 62, 538, 5374, 82, 532, 352, 290, 36835, 4064, 26498, 13, 18206, 62, 16833, 14512, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 628, 220, 220, 220, 220, 220, 220, 220, 40213, 796, 279, 9945, 62, 29356, 7, 5760, 33, 62, 57, 4061, 11, 26173, 2389, 6234, 62, 28480, 11, 5418, 62, 2676, 11, 678, 13, 24, 11, 352, 13, 1495, 11, 5412, 62, 18224, 28, 28144, 62, 18224, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2994, 796, 13446, 7, 3262, 11, 15458, 62, 8612, 1352, 7, 29356, 11, 347, 11417, 62, 33489, 828, 5418, 62, 2676, 11, 299, 62, 2676, 8, 628, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 58, 13807, 5374, 4064, 67, 14, 4, 67, 60, 357, 7762, 24765, 22014, 25, 4064, 13, 20, 69, 1, 4064, 357, 538, 5374, 1343, 352, 11, 997, 62, 538, 5374, 82, 11, 2994, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 3613, 62, 9122, 4122, 15090, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 14050, 10354, 2172, 13, 14050, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 538, 5374, 10354, 36835, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 3262, 10354, 2010, 13, 5219, 62, 11600, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 8738, 10354, 2172, 13, 5219, 62, 11600, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 8964, 2994, 11, 366, 1350, 459, 1600, 26498, 13, 448, 62, 15908, 8, 198 ]
2.215596
872
import argparse from src.client.client import ClientHelper import logging from src.data.orders_handler import load_and_process from src.data.preprocessing.orders import OrdersProcessor from src.utils.logging import log_format, log_level logging.basicConfig(format=log_format, level=log_level) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('api_key', type=str, help='Key from binance profile') parser.add_argument('api_secret', type=str, help='Secret key from binance profile') parser.add_argument('open_file', type=int, nargs='?', default=1, choices=[0,1], help='Open html report after creating') args = parser.parse_args() client_helper = ClientHelper(args.api_key, args.api_secret) orders_processor = OrdersProcessor(client_helper=client_helper) data = load_and_process(client_helper, orders_processor) print(data.shape)
[ 11748, 1822, 29572, 198, 198, 6738, 12351, 13, 16366, 13, 16366, 1330, 20985, 47429, 198, 11748, 18931, 198, 198, 6738, 12351, 13, 7890, 13, 6361, 62, 30281, 1330, 3440, 62, 392, 62, 14681, 198, 6738, 12351, 13, 7890, 13, 3866, 36948, 13, 6361, 1330, 30689, 18709, 273, 198, 6738, 12351, 13, 26791, 13, 6404, 2667, 1330, 2604, 62, 18982, 11, 2604, 62, 5715, 198, 6404, 2667, 13, 35487, 16934, 7, 18982, 28, 6404, 62, 18982, 11, 1241, 28, 6404, 62, 5715, 8, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 3419, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 15042, 62, 2539, 3256, 2099, 28, 2536, 11, 1037, 11639, 9218, 422, 9874, 590, 7034, 11537, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 15042, 62, 21078, 3256, 2099, 28, 2536, 11, 1037, 11639, 23725, 1994, 422, 9874, 590, 7034, 11537, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 10786, 9654, 62, 7753, 3256, 2099, 28, 600, 11, 299, 22046, 11639, 30, 3256, 4277, 28, 16, 11, 7747, 41888, 15, 11, 16, 4357, 1037, 11639, 11505, 27711, 989, 706, 4441, 11537, 198, 220, 220, 220, 26498, 796, 30751, 13, 29572, 62, 22046, 3419, 198, 220, 220, 220, 5456, 62, 2978, 525, 796, 20985, 47429, 7, 22046, 13, 15042, 62, 2539, 11, 26498, 13, 15042, 62, 21078, 8, 198, 220, 220, 220, 6266, 62, 41341, 796, 30689, 18709, 273, 7, 16366, 62, 2978, 525, 28, 16366, 62, 2978, 525, 8, 198, 220, 220, 220, 1366, 796, 3440, 62, 392, 62, 14681, 7, 16366, 62, 2978, 525, 11, 6266, 62, 41341, 8, 198, 220, 220, 220, 3601, 7, 7890, 13, 43358, 8, 198 ]
3.085911
291
from railroads import Track track = Track("day13-input.txt") track.run_partone() track2 = Track("day13-input.txt") track2.run_parttwo()
[ 6738, 6787, 21372, 1330, 17762, 628, 198, 11659, 796, 17762, 7203, 820, 1485, 12, 15414, 13, 14116, 4943, 198, 11659, 13, 5143, 62, 3911, 505, 3419, 198, 11659, 17, 796, 17762, 7203, 820, 1485, 12, 15414, 13, 14116, 4943, 198, 11659, 17, 13, 5143, 62, 3911, 11545, 3419, 198 ]
2.816327
49
""" Extract information about chr16 for several patients for ben """ import pandas as pd crc01_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC01\all_cpg_ratios_CRC01_chr16.dummy.pkl.zip" crc11_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC11" \ r"\all_cpg_ratios_CRC11_chr16.dummy.pkl.zip" crc13_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC13" \ r"\all_cpg_ratios_CRC13_chr16.dummy.pkl.zip" crc02_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC02" \ r"\all_cpg_ratios_CRC02_chr16.dummy.pkl.zip" crc04_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC04" \ r"\all_cpg_ratios_CRC04_chr16.dummy.pkl.zip" crc09_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC09" \ r"\all_cpg_ratios_CRC09_chr16.dummy.pkl.zip" crc10_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC10" \ r"\all_cpg_ratios_CRC10_chr16.dummy.pkl.zip" crc12_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC12" \ r"\all_cpg_ratios_CRC12_chr16.dummy.pkl.zip" crc14_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC14" \ r"\all_cpg_ratios_CRC14_chr16.dummy.pkl.zip" crc15_path = r"H:\Study\university\Computational-Biology\Year " \ r"3\Projects\proj_scwgbs\resource\cpg_format\filtered_by_bl_and_cpgi\CRC15" \ r"\all_cpg_ratios_CRC15_chr16.dummy.pkl.zip" valid_path = r"H:\Study\university\Computational-Biology\Year 3\Projects\proj_scwgbs\covariance\valid_cpg.pkl" if __name__ == '__main__': valid_data = pd.read_pickle(valid_path) valid_data = valid_data[valid_data["chromosome"] == "16"] valid_data["small_seq"] = valid_data["sequence"].str[73:77] cpg1 = valid_data[valid_data["sequence"].str.count("CG") == 1] cpg1["context"] = "other" cpg1.loc[cpg1["small_seq"].str.contains("[AT]CG[AT]", regex=True), "context"] = "WCGW" cpg1.loc[cpg1["small_seq"].str.contains("[CG]CG[CG]", regex=True), "context"] = "SCGS" only_needed = cpg1[["small_seq", "sequence", "context"]] only_needed = only_needed.transpose() only_needed.to_csv("info.csv") # crc01 = pd.read_pickle(crc01_path) # good = crc01[cpg1["location"]] # good.to_csv("crc01.csv") # # crc11 = pd.read_pickle(crc11_path) # good = crc11[cpg1["location"]] # good.to_csv("crc11.csv") # # crc13 = pd.read_pickle(crc13_path) # good = crc13[cpg1["location"]] # good.to_csv("crc13.csv") # rows = good.index.values # columns = list(good.columns.values) # data = good.values # data_added = np.vstack((data, cpg1["small_seq"])) # data_added = np.vstack((data_added, cpg1["context"])) # df = pd.DataFrame(data=data_added, index=columns + ["small_seq", "context"], columns=columns) crc02 = pd.read_pickle(crc02_path) good = crc02[cpg1["location"]] good.to_csv("crc02.csv") crc04 = pd.read_pickle(crc04_path) good = crc04[cpg1["location"]] good.to_csv("crc04.csv") crc09 = pd.read_pickle(crc09_path) good = crc09[cpg1["location"]] good.to_csv("crc09.csv") crc10 = pd.read_pickle(crc10_path) good = crc10[cpg1["location"]] good.to_csv("crc10.csv") crc12 = pd.read_pickle(crc12_path) good = crc12[cpg1["location"]] good.to_csv("crc12.csv") crc14 = pd.read_pickle(crc14_path) good = crc14[cpg1["location"]] good.to_csv("crc14.csv") crc15 = pd.read_pickle(crc15_path) good = crc15[cpg1["location"]] good.to_csv("crc15.csv")
[ 37811, 198, 11627, 974, 1321, 546, 442, 81, 1433, 329, 1811, 3871, 329, 1888, 198, 37811, 198, 198, 11748, 19798, 292, 355, 279, 67, 198, 198, 66, 6015, 486, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 486, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 486, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 66, 6015, 1157, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 1157, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 1157, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 66, 6015, 1485, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 1485, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 1485, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 198, 66, 6015, 2999, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 2999, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 2999, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 66, 6015, 3023, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 3023, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 3023, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 66, 6015, 2931, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 2931, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 2931, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 198, 66, 6015, 940, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 940, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 940, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 66, 6015, 1065, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 1065, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 1065, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 66, 6015, 1415, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 1415, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 1415, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 198, 198, 66, 6015, 1314, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 366, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 18, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 31092, 59, 66, 6024, 62, 18982, 59, 10379, 4400, 62, 1525, 62, 2436, 62, 392, 62, 66, 6024, 72, 59, 34, 7397, 1314, 1, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 374, 1, 59, 439, 62, 66, 6024, 62, 10366, 4267, 62, 34, 7397, 1314, 62, 354, 81, 1433, 13, 67, 13513, 13, 79, 41582, 13, 13344, 1, 628, 198, 12102, 62, 6978, 796, 374, 1, 39, 7479, 39841, 59, 403, 1608, 59, 5377, 1996, 864, 12, 33, 12371, 59, 17688, 513, 59, 16775, 82, 59, 1676, 73, 62, 1416, 86, 70, 1443, 59, 66, 709, 2743, 590, 59, 12102, 62, 66, 6024, 13, 79, 41582, 1, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 4938, 62, 7890, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 12102, 62, 6978, 8, 198, 220, 220, 220, 4938, 62, 7890, 796, 4938, 62, 7890, 58, 12102, 62, 7890, 14692, 28663, 418, 462, 8973, 6624, 366, 1433, 8973, 198, 220, 220, 220, 4938, 62, 7890, 14692, 17470, 62, 41068, 8973, 796, 4938, 62, 7890, 14692, 43167, 1, 4083, 2536, 58, 4790, 25, 3324, 60, 628, 220, 220, 220, 269, 6024, 16, 796, 4938, 62, 7890, 58, 12102, 62, 7890, 14692, 43167, 1, 4083, 2536, 13, 9127, 7203, 39816, 4943, 6624, 352, 60, 198, 220, 220, 220, 269, 6024, 16, 14692, 22866, 8973, 796, 366, 847, 1, 628, 220, 220, 220, 269, 6024, 16, 13, 17946, 58, 66, 6024, 16, 14692, 17470, 62, 41068, 1, 4083, 2536, 13, 3642, 1299, 7203, 58, 1404, 60, 39816, 58, 1404, 60, 1600, 40364, 28, 17821, 828, 366, 22866, 8973, 796, 366, 27353, 33191, 1, 198, 220, 220, 220, 269, 6024, 16, 13, 17946, 58, 66, 6024, 16, 14692, 17470, 62, 41068, 1, 4083, 2536, 13, 3642, 1299, 7203, 58, 39816, 60, 39816, 58, 39816, 60, 1600, 40364, 28, 17821, 828, 366, 22866, 8973, 796, 366, 6173, 14313, 1, 628, 220, 220, 220, 691, 62, 27938, 796, 269, 6024, 16, 58, 14692, 17470, 62, 41068, 1600, 366, 43167, 1600, 366, 22866, 8973, 60, 198, 220, 220, 220, 691, 62, 27938, 796, 691, 62, 27938, 13, 7645, 3455, 3419, 198, 220, 220, 220, 691, 62, 27938, 13, 1462, 62, 40664, 7203, 10951, 13, 40664, 4943, 628, 220, 220, 220, 1303, 1067, 66, 486, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 486, 62, 6978, 8, 198, 220, 220, 220, 1303, 922, 796, 1067, 66, 486, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 1303, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 486, 13, 40664, 4943, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 1067, 66, 1157, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 1157, 62, 6978, 8, 198, 220, 220, 220, 1303, 922, 796, 1067, 66, 1157, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 1303, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 1157, 13, 40664, 4943, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 1067, 66, 1485, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 1485, 62, 6978, 8, 198, 220, 220, 220, 1303, 922, 796, 1067, 66, 1485, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 1303, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 1485, 13, 40664, 4943, 628, 220, 220, 220, 1303, 15274, 796, 922, 13, 9630, 13, 27160, 198, 220, 220, 220, 1303, 15180, 796, 1351, 7, 11274, 13, 28665, 82, 13, 27160, 8, 198, 220, 220, 220, 1303, 1366, 796, 922, 13, 27160, 198, 220, 220, 220, 1303, 1366, 62, 29373, 796, 45941, 13, 85, 25558, 19510, 7890, 11, 269, 6024, 16, 14692, 17470, 62, 41068, 8973, 4008, 198, 220, 220, 220, 1303, 1366, 62, 29373, 796, 45941, 13, 85, 25558, 19510, 7890, 62, 29373, 11, 269, 6024, 16, 14692, 22866, 8973, 4008, 198, 220, 220, 220, 1303, 47764, 796, 279, 67, 13, 6601, 19778, 7, 7890, 28, 7890, 62, 29373, 11, 6376, 28, 28665, 82, 1343, 14631, 17470, 62, 41068, 1600, 366, 22866, 33116, 15180, 28, 28665, 82, 8, 628, 220, 220, 220, 1067, 66, 2999, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 2999, 62, 6978, 8, 198, 220, 220, 220, 922, 796, 1067, 66, 2999, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 2999, 13, 40664, 4943, 628, 220, 220, 220, 1067, 66, 3023, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 3023, 62, 6978, 8, 198, 220, 220, 220, 922, 796, 1067, 66, 3023, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 3023, 13, 40664, 4943, 628, 220, 220, 220, 1067, 66, 2931, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 2931, 62, 6978, 8, 198, 220, 220, 220, 922, 796, 1067, 66, 2931, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 2931, 13, 40664, 4943, 628, 220, 220, 220, 1067, 66, 940, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 940, 62, 6978, 8, 198, 220, 220, 220, 922, 796, 1067, 66, 940, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 940, 13, 40664, 4943, 628, 220, 220, 220, 1067, 66, 1065, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 1065, 62, 6978, 8, 198, 220, 220, 220, 922, 796, 1067, 66, 1065, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 1065, 13, 40664, 4943, 628, 220, 220, 220, 1067, 66, 1415, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 1415, 62, 6978, 8, 198, 220, 220, 220, 922, 796, 1067, 66, 1415, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 1415, 13, 40664, 4943, 628, 220, 220, 220, 1067, 66, 1314, 796, 279, 67, 13, 961, 62, 27729, 293, 7, 66, 6015, 1314, 62, 6978, 8, 198, 220, 220, 220, 922, 796, 1067, 66, 1314, 58, 66, 6024, 16, 14692, 24886, 8973, 60, 198, 220, 220, 220, 922, 13, 1462, 62, 40664, 7203, 66, 6015, 1314, 13, 40664, 4943, 198 ]
1.961573
2,212
from pathlib import PurePath from typing import List from setuptools import find_packages, setup version = '0.0.4' def load_requirements(path: PurePath) -> List[str]: """ Load dependencies from a requirements.txt style file, ignoring comments etc. """ res = [] with open(path) as fd: for line in fd.readlines(): while line.endswith('\n') or line.endswith('\\'): line = line[:-1] line = line.strip() if not line or line.startswith('-') or line.startswith('#'): continue res += [line] return res here = PurePath(__file__) README = open(here.with_name('README.md')).read() install_requires = load_requirements(here.with_name('requirements.txt')) test_requires = load_requirements(here.with_name('test_requirements.txt')) setup( name='eduid-queue', version=version, packages=find_packages('src'), package_dir={'': 'src'}, url='https://github.com/sunet/eduid-queue', license='BSD-2-Clause', keywords='eduid', author='Johan Lundberg', author_email='[email protected]', description='MongoDB based task queue', install_requires=install_requires, test_requires=test_requires, extras_require={'testing': [], 'client': load_requirements(here.with_name('client_requirements.txt')), }, include_package_data=True, entry_points={'console_scripts': ['run-mail-worker=eduid_queue.workers.mail:start_worker',],}, )
[ 6738, 3108, 8019, 1330, 17129, 15235, 198, 6738, 19720, 1330, 7343, 198, 198, 6738, 900, 37623, 10141, 1330, 1064, 62, 43789, 11, 9058, 198, 198, 9641, 796, 705, 15, 13, 15, 13, 19, 6, 628, 198, 4299, 3440, 62, 8897, 18883, 7, 6978, 25, 17129, 15235, 8, 4613, 7343, 58, 2536, 5974, 198, 220, 220, 220, 37227, 8778, 20086, 422, 257, 5359, 13, 14116, 3918, 2393, 11, 15482, 3651, 3503, 13, 37227, 198, 220, 220, 220, 581, 796, 17635, 198, 220, 220, 220, 351, 1280, 7, 6978, 8, 355, 277, 67, 25, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1627, 287, 277, 67, 13, 961, 6615, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 981, 1627, 13, 437, 2032, 342, 10786, 59, 77, 11537, 393, 1627, 13, 437, 2032, 342, 10786, 6852, 6, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1627, 796, 1627, 58, 21912, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1627, 796, 1627, 13, 36311, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 407, 1627, 393, 1627, 13, 9688, 2032, 342, 10786, 12, 11537, 393, 1627, 13, 9688, 2032, 342, 10786, 2, 6, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2555, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 581, 15853, 685, 1370, 60, 198, 220, 220, 220, 1441, 581, 628, 198, 1456, 796, 17129, 15235, 7, 834, 7753, 834, 8, 198, 15675, 11682, 796, 1280, 7, 1456, 13, 4480, 62, 3672, 10786, 15675, 11682, 13, 9132, 11537, 737, 961, 3419, 198, 198, 17350, 62, 47911, 796, 3440, 62, 8897, 18883, 7, 1456, 13, 4480, 62, 3672, 10786, 8897, 18883, 13, 14116, 6, 4008, 198, 9288, 62, 47911, 796, 3440, 62, 8897, 18883, 7, 1456, 13, 4480, 62, 3672, 10786, 9288, 62, 8897, 18883, 13, 14116, 6, 4008, 198, 198, 40406, 7, 198, 220, 220, 220, 1438, 11639, 15532, 312, 12, 36560, 3256, 198, 220, 220, 220, 2196, 28, 9641, 11, 198, 220, 220, 220, 10392, 28, 19796, 62, 43789, 10786, 10677, 33809, 198, 220, 220, 220, 5301, 62, 15908, 34758, 7061, 25, 705, 10677, 6, 5512, 198, 220, 220, 220, 19016, 11639, 5450, 1378, 12567, 13, 785, 14, 19155, 316, 14, 15532, 312, 12, 36560, 3256, 198, 220, 220, 220, 5964, 11639, 21800, 12, 17, 12, 2601, 682, 3256, 198, 220, 220, 220, 26286, 11639, 15532, 312, 3256, 198, 220, 220, 220, 1772, 11639, 41, 22436, 33609, 3900, 3256, 198, 220, 220, 220, 1772, 62, 12888, 11639, 37525, 3900, 31, 19155, 316, 13, 325, 3256, 198, 220, 220, 220, 6764, 11639, 44, 25162, 11012, 1912, 4876, 16834, 3256, 198, 220, 220, 220, 2721, 62, 47911, 28, 17350, 62, 47911, 11, 198, 220, 220, 220, 1332, 62, 47911, 28, 9288, 62, 47911, 11, 198, 220, 220, 220, 33849, 62, 46115, 34758, 6, 33407, 10354, 685, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 705, 16366, 10354, 3440, 62, 8897, 18883, 7, 1456, 13, 4480, 62, 3672, 10786, 16366, 62, 8897, 18883, 13, 14116, 11537, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8964, 198, 220, 220, 220, 2291, 62, 26495, 62, 7890, 28, 17821, 11, 198, 220, 220, 220, 5726, 62, 13033, 34758, 6, 41947, 62, 46521, 10354, 37250, 5143, 12, 4529, 12, 28816, 28, 15532, 312, 62, 36560, 13, 22896, 13, 4529, 25, 9688, 62, 28816, 3256, 4357, 5512, 198, 8, 198 ]
2.453659
615
from numpy.core.fromnumeric import shape import taichi as ti import numpy as np lin_iters = 20 N = 64 dt = 0.1 diff = 0.0 visc = 0.0 force = 5e5 source = 100.0 dvel = False v = ti.Vector.field(2, float, shape=(N + 2, N + 2), offset = (-1, -1)) v_prev = ti.Vector.field(2, float, shape=(N + 2, N + 2), offset = (-1, -1)) dens = ti.field(float, shape=(N + 2, N + 2), offset = (-1, -1)) dens_prev = ti.field(float, shape=(N + 2, N + 2), offset = (-1, -1)) div = ti.field(float, shape=(N + 2, N + 2), offset = (-1, -1)) p = ti.field(float, shape=(N + 2, N + 2), offset = (-1, -1)) pixels = ti.field(float, shape=(N, N)) @ti.kernel @ti.kernel @ti.func @ti.kernel @ti.kernel
[ 6738, 299, 32152, 13, 7295, 13, 6738, 77, 39223, 1330, 5485, 201, 198, 11748, 20486, 16590, 355, 46668, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 201, 198, 2815, 62, 270, 364, 796, 1160, 201, 198, 201, 198, 45, 796, 5598, 201, 198, 28664, 796, 657, 13, 16, 201, 198, 26069, 796, 657, 13, 15, 201, 198, 85, 2304, 796, 657, 13, 15, 201, 198, 3174, 796, 642, 68, 20, 201, 198, 10459, 796, 1802, 13, 15, 201, 198, 201, 198, 67, 626, 796, 10352, 201, 198, 201, 198, 85, 796, 46668, 13, 38469, 13, 3245, 7, 17, 11, 12178, 11, 5485, 16193, 45, 1343, 362, 11, 399, 1343, 362, 828, 11677, 796, 13841, 16, 11, 532, 16, 4008, 201, 198, 85, 62, 47050, 796, 46668, 13, 38469, 13, 3245, 7, 17, 11, 12178, 11, 5485, 16193, 45, 1343, 362, 11, 399, 1343, 362, 828, 11677, 796, 13841, 16, 11, 532, 16, 4008, 201, 198, 67, 641, 796, 46668, 13, 3245, 7, 22468, 11, 5485, 16193, 45, 1343, 362, 11, 399, 1343, 362, 828, 11677, 796, 13841, 16, 11, 532, 16, 4008, 201, 198, 67, 641, 62, 47050, 796, 46668, 13, 3245, 7, 22468, 11, 5485, 16193, 45, 1343, 362, 11, 399, 1343, 362, 828, 11677, 796, 13841, 16, 11, 532, 16, 4008, 201, 198, 201, 198, 7146, 796, 46668, 13, 3245, 7, 22468, 11, 5485, 16193, 45, 1343, 362, 11, 399, 1343, 362, 828, 11677, 796, 13841, 16, 11, 532, 16, 4008, 201, 198, 79, 796, 46668, 13, 3245, 7, 22468, 11, 5485, 16193, 45, 1343, 362, 11, 399, 1343, 362, 828, 11677, 796, 13841, 16, 11, 532, 16, 4008, 201, 198, 79, 14810, 796, 46668, 13, 3245, 7, 22468, 11, 5485, 16193, 45, 11, 399, 4008, 201, 198, 201, 198, 31, 20259, 13, 33885, 201, 198, 201, 198, 31, 20259, 13, 33885, 201, 198, 201, 198, 31, 20259, 13, 20786, 201, 198, 201, 198, 31, 20259, 13, 33885, 201, 198, 201, 198, 31, 20259, 13, 33885, 201 ]
2.154545
330
import sys import os os.chdir(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.path.realpath(os.pardir)) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cnap_v2.settings') import django from django.conf import settings django.setup() from base.models import AvailableZones, CurrentZone if __name__ == '__main__': if settings.CONFIG_PARAMS['cloud_environment'] == settings.GOOGLE: default_zone = settings.CONFIG_PARAMS['default_google_zone'] avail_zones_csv = settings.CONFIG_PARAMS['available_google_zones'] avail_zones = [x.strip() for x in avail_zones_csv.split(',')] for z in avail_zones: a = AvailableZones.objects.create(cloud_environment=settings.GOOGLE, zone=z) a.save() dz = AvailableZones.objects.get(zone=default_zone) c = CurrentZone.objects.create(zone=dz) c.save() else: print('Only Google-related settings have been implemented so far. Exiting.') sys.exit(1)
[ 11748, 25064, 198, 11748, 28686, 198, 198, 418, 13, 354, 15908, 7, 418, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 5305, 6978, 7, 834, 7753, 834, 22305, 198, 17597, 13, 6978, 13, 33295, 7, 418, 13, 6978, 13, 5305, 6978, 7, 418, 13, 26037, 343, 4008, 198, 418, 13, 268, 2268, 13, 2617, 12286, 10786, 35028, 1565, 11230, 62, 28480, 51, 20754, 62, 33365, 24212, 3256, 705, 31522, 499, 62, 85, 17, 13, 33692, 11537, 198, 198, 11748, 42625, 14208, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 28241, 14208, 13, 40406, 3419, 198, 198, 6738, 2779, 13, 27530, 1330, 14898, 57, 1952, 11, 9236, 26961, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 611, 6460, 13, 10943, 16254, 62, 27082, 40834, 17816, 17721, 62, 38986, 20520, 6624, 6460, 13, 38, 6684, 38, 2538, 25, 198, 220, 220, 220, 220, 220, 220, 220, 4277, 62, 11340, 796, 6460, 13, 10943, 16254, 62, 27082, 40834, 17816, 12286, 62, 13297, 62, 11340, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 29107, 62, 89, 1952, 62, 40664, 796, 6460, 13, 10943, 16254, 62, 27082, 40834, 17816, 15182, 62, 13297, 62, 89, 1952, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 29107, 62, 89, 1952, 796, 685, 87, 13, 36311, 3419, 329, 2124, 287, 29107, 62, 89, 1952, 62, 40664, 13, 35312, 7, 3256, 11537, 60, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1976, 287, 29107, 62, 89, 1952, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 257, 796, 14898, 57, 1952, 13, 48205, 13, 17953, 7, 17721, 62, 38986, 28, 33692, 13, 38, 6684, 38, 2538, 11, 6516, 28, 89, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 257, 13, 21928, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 288, 89, 796, 14898, 57, 1952, 13, 48205, 13, 1136, 7, 11340, 28, 12286, 62, 11340, 8, 198, 220, 220, 220, 220, 220, 220, 220, 269, 796, 9236, 26961, 13, 48205, 13, 17953, 7, 11340, 28, 67, 89, 8, 198, 220, 220, 220, 220, 220, 220, 220, 269, 13, 21928, 3419, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 10786, 10049, 3012, 12, 5363, 6460, 423, 587, 9177, 523, 1290, 13, 220, 1475, 1780, 2637, 8, 198, 220, 220, 220, 220, 220, 220, 220, 25064, 13, 37023, 7, 16, 8, 198 ]
2.43309
411
import torch import numpy as np, reward.utils as U from pathlib import Path from .space import Space
[ 11748, 28034, 198, 11748, 299, 32152, 355, 45941, 11, 6721, 13, 26791, 355, 471, 198, 6738, 3108, 8019, 1330, 10644, 198, 6738, 764, 13200, 1330, 4687, 628, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198 ]
3.027027
37
# -*- coding: utf-8 -*- # Generated by Django 1.11.23 on 2020-03-03 13:32 from __future__ import unicode_literals from django.db import migrations
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2980, 515, 416, 37770, 352, 13, 1157, 13, 1954, 319, 12131, 12, 3070, 12, 3070, 1511, 25, 2624, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 198 ]
2.690909
55
import tensorflow as tf from tensorflow.keras import backend as K class OrdinalMeanAbsoluteError(tf.keras.metrics.Metric): """Computes mean absolute error for ordinal labels.""" def __init__(self, name="mean_absolute_error_labels", **kwargs): """Creates a `OrdinalMeanAbsoluteError` instance.""" super().__init__(name=name, **kwargs) self.maes = self.add_weight(name='maes', initializer='zeros') self.count = self.add_weight(name='count', initializer='zeros') def update_state(self, y_true, y_pred, sample_weight=None): """Computes mean absolute error for ordinal labels. Args: y_true: Cumulatiuve logits from CondorOrdinal layer. y_pred: CondorOrdinal Encoded Labels. sample_weight (optional): Not implemented. """ # Predict the label as in Cao et al. - using cumulative probabilities cum_probs = tf.math.cumprod( tf.math.sigmoid(y_pred), axis=1) # tf.map_fn(tf.math.sigmoid, y_pred) # Calculate the labels using the style of Cao et al. above_thresh = tf.map_fn( lambda x: tf.cast( x > 0.5, tf.float32), cum_probs) # Sum across columns to estimate how many cumulative thresholds are # passed. labels_v2 = tf.reduce_sum(above_thresh, axis=1) y_true = tf.cast(tf.reduce_sum(y_true, axis=1), y_pred.dtype) # remove all dimensions of size 1 (e.g., from [[1], [2]], to [1, 2]) y_true = tf.squeeze(y_true) if sample_weight is not None: values = tf.abs(y_true - labels_v2) sample_weight = tf.cast(tf.squeeze(sample_weight), y_pred.dtype) sample_weight = tf.broadcast_to(sample_weight, values.shape) values = tf.multiply(values, sample_weight) self.maes.assign_add(tf.reduce_sum(values)) self.count.assign_add(tf.reduce_sum(sample_weight)) else: self.maes.assign_add(tf.reduce_sum(tf.abs(y_true - labels_v2))) self.count.assign_add(tf.cast(tf.size(y_true), tf.float32)) def reset_state(self): """Resets all of the metric state variables at the start of each epoch.""" self.maes.assign(0.0) self.count.assign(0.0) def get_config(self): """Returns the serializable config of the metric.""" config = {} base_config = super().get_config() return {**base_config, **config} class SparseOrdinalMeanAbsoluteError(OrdinalMeanAbsoluteError): """Computes mean absolute error for ordinal labels.""" def __init__(self, name="mean_absolute_error_labels", **kwargs): """Creates a `OrdinalMeanAbsoluteError` instance.""" super().__init__(name=name, **kwargs) def update_state(self, y_true, y_pred, sample_weight=None): """Computes mean absolute error for ordinal labels. Args: y_true: Cumulatiuve logits from CondorOrdinal layer. y_pred: CondorOrdinal Encoded Labels. sample_weight (optional): Not implemented. """ # Predict the label as in Cao et al. - using cumulative probabilities cum_probs = tf.math.cumprod( tf.math.sigmoid(y_pred), axis=1) # tf.map_fn(tf.math.sigmoid, y_pred) # Calculate the labels using the style of Cao et al. above_thresh = tf.map_fn( lambda x: tf.cast( x > 0.5, tf.float32), cum_probs) # Sum across columns to estimate how many cumulative thresholds are # passed. labels_v2 = tf.reduce_sum(above_thresh, axis=1) y_true = tf.cast(y_true, y_pred.dtype) # remove all dimensions of size 1 (e.g., from [[1], [2]], to [1, 2]) y_true = tf.squeeze(y_true) if sample_weight is not None: values = tf.abs(y_true - labels_v2) sample_weight = tf.cast(tf.squeeze(sample_weight), y_pred.dtype) sample_weight = tf.broadcast_to(sample_weight, values.shape) values = tf.multiply(values, sample_weight) self.maes.assign_add(tf.reduce_sum(values)) self.count.assign_add(tf.reduce_sum(sample_weight)) else: self.maes.assign_add(tf.reduce_sum(tf.abs(y_true - labels_v2))) self.count.assign_add(tf.cast(tf.size(y_true), tf.float32)) class OrdinalAccuracy(tf.keras.metrics.Metric): """Computes accuracy for ordinal labels (tolerance is allowed rank distance to be considered 'correct' predictions).""" def __init__(self, name=None, tolerance=0, **kwargs): """Creates a `OrdinalAccuracy` instance.""" if name is not None: super().__init__(name=name, **kwargs) else: super().__init__(name="ordinal_accuracy_tol"+str(tolerance), **kwargs) self.accs = self.add_weight(name='accs', initializer='zeros') self.count = self.add_weight(name='count', initializer='zeros') self.tolerance = tolerance def update_state(self, y_true, y_pred, sample_weight=None): """Computes accuracy for ordinal labels. Args: y_true: Cumulatiuve logits from CondorOrdinal layer. y_pred: CondorOrdinal Encoded Labels. sample_weight (optional): Not implemented. """ # Predict the label as in Cao et al. - using cumulative probabilities cum_probs = tf.math.cumprod( tf.math.sigmoid(y_pred), axis=1) # tf.map_fn(tf.math.sigmoid, y_pred) # Calculate the labels using the style of Cao et al. above_thresh = tf.map_fn( lambda x: tf.cast( x > 0.5, tf.float32), cum_probs) # Sum across columns to estimate how many cumulative thresholds are # passed. labels_v2 = tf.reduce_sum(above_thresh, axis=1) y_true = tf.cast(tf.reduce_sum(y_true, axis=1), y_pred.dtype) # remove all dimensions of size 1 (e.g., from [[1], [2]], to [1, 2]) y_true = tf.squeeze(y_true) if sample_weight is not None: values = tf.cast(tf.less_equal( tf.abs(y_true-labels_v2),tf.cast(self.tolerance,y_pred.dtype)), y_pred.dtype) sample_weight = tf.cast(tf.squeeze(sample_weight), y_pred.dtype) sample_weight = tf.broadcast_to(sample_weight, values.shape) values = tf.multiply(values, sample_weight) self.accs.assign_add(tf.reduce_sum(values)) self.count.assign_add(tf.reduce_sum(sample_weight)) else: self.accs.assign_add(tf.reduce_sum(tf.cast(tf.less_equal( tf.abs(y_true-labels_v2),tf.cast(self.tolerance,y_pred.dtype)), y_pred.dtype))) self.count.assign_add(tf.cast(tf.size(y_true), tf.float32)) def reset_state(self): """Resets all of the metric state variables at the start of each epoch.""" self.accs.assign(0.0) self.count.assign(0.0) def get_config(self): """Returns the serializable config of the metric.""" config = {'tolerance': self.tolerance} base_config = super().get_config() return {**base_config, **config} class SparseOrdinalAccuracy(OrdinalAccuracy): """Computes accuracy for ordinal labels (tolerance is allowed rank distance to be considered 'correct' predictions).""" def update_state(self, y_true, y_pred, sample_weight=None): """Computes accuracy for ordinal labels. Args: y_true: Cumulatiuve logits from CondorOrdinal layer. y_pred: CondorOrdinal Encoded Labels. sample_weight (optional): Not implemented. """ # Predict the label as in Cao et al. - using cumulative probabilities cum_probs = tf.math.cumprod( tf.math.sigmoid(y_pred), axis=1) # tf.map_fn(tf.math.sigmoid, y_pred) # Calculate the labels using the style of Cao et al. above_thresh = tf.map_fn( lambda x: tf.cast( x > 0.5, tf.float32), cum_probs) # Sum across columns to estimate how many cumulative thresholds are # passed. labels_v2 = tf.reduce_sum(above_thresh, axis=1) y_true = tf.cast(y_true, y_pred.dtype) # remove all dimensions of size 1 (e.g., from [[1], [2]], to [1, 2]) y_true = tf.squeeze(y_true) if sample_weight is not None: values = tf.cast(tf.less_equal( tf.abs(y_true-labels_v2),tf.cast(self.tolerance,y_pred.dtype)), y_pred.dtype) sample_weight = tf.cast(tf.squeeze(sample_weight), y_pred.dtype) sample_weight = tf.broadcast_to(sample_weight, values.shape) values = tf.multiply(values, sample_weight) self.accs.assign_add(tf.reduce_sum(values)) self.count.assign_add(tf.reduce_sum(sample_weight)) else: self.accs.assign_add(tf.reduce_sum(tf.cast(tf.less_equal( tf.abs(y_true-labels_v2),tf.cast(self.tolerance,y_pred.dtype)), y_pred.dtype))) self.count.assign_add(tf.cast(tf.size(y_true), tf.float32))
[ 11748, 11192, 273, 11125, 355, 48700, 198, 6738, 11192, 273, 11125, 13, 6122, 292, 1330, 30203, 355, 509, 628, 198, 4871, 14230, 1292, 5308, 272, 24849, 3552, 12331, 7, 27110, 13, 6122, 292, 13, 4164, 10466, 13, 9171, 1173, 2599, 198, 220, 220, 220, 37227, 7293, 1769, 1612, 4112, 4049, 329, 2760, 1292, 14722, 526, 15931, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1438, 2625, 32604, 62, 48546, 62, 18224, 62, 23912, 1424, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 16719, 274, 257, 4600, 35422, 1292, 5308, 272, 24849, 3552, 12331, 63, 4554, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 7, 3672, 28, 3672, 11, 12429, 46265, 22046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2611, 274, 796, 2116, 13, 2860, 62, 6551, 7, 3672, 11639, 2611, 274, 3256, 4238, 7509, 11639, 9107, 418, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 796, 2116, 13, 2860, 62, 6551, 7, 3672, 11639, 9127, 3256, 4238, 7509, 11639, 9107, 418, 11537, 628, 220, 220, 220, 825, 4296, 62, 5219, 7, 944, 11, 331, 62, 7942, 11, 331, 62, 28764, 11, 6291, 62, 6551, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 7293, 1769, 1612, 4112, 4049, 329, 2760, 1292, 14722, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 25, 27843, 377, 7246, 45177, 2604, 896, 422, 9724, 273, 35422, 1292, 7679, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 25, 9724, 273, 35422, 1292, 14711, 9043, 3498, 1424, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 357, 25968, 2599, 1892, 9177, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 49461, 262, 6167, 355, 287, 34513, 2123, 435, 13, 532, 1262, 23818, 39522, 198, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 796, 48700, 13, 11018, 13, 66, 931, 14892, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 11018, 13, 82, 17225, 1868, 7, 88, 62, 28764, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16488, 28, 16, 8, 220, 1303, 48700, 13, 8899, 62, 22184, 7, 27110, 13, 11018, 13, 82, 17225, 1868, 11, 331, 62, 28764, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 27131, 378, 262, 14722, 1262, 262, 3918, 286, 34513, 2123, 435, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2029, 62, 400, 3447, 796, 48700, 13, 8899, 62, 22184, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37456, 2124, 25, 48700, 13, 2701, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 1875, 657, 13, 20, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 22468, 2624, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 5060, 1973, 15180, 284, 8636, 703, 867, 23818, 40885, 389, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3804, 13, 198, 220, 220, 220, 220, 220, 220, 220, 14722, 62, 85, 17, 796, 48700, 13, 445, 7234, 62, 16345, 7, 29370, 62, 400, 3447, 11, 16488, 28, 16, 8, 628, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 2701, 7, 27110, 13, 445, 7234, 62, 16345, 7, 88, 62, 7942, 11, 16488, 28, 16, 828, 331, 62, 28764, 13, 67, 4906, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 4781, 477, 15225, 286, 2546, 352, 357, 68, 13, 70, 1539, 422, 16410, 16, 4357, 685, 17, 60, 4357, 284, 685, 16, 11, 362, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 16485, 1453, 2736, 7, 88, 62, 7942, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 6291, 62, 6551, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 8937, 7, 88, 62, 7942, 532, 14722, 62, 85, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 2701, 7, 27110, 13, 16485, 1453, 2736, 7, 39873, 62, 6551, 828, 331, 62, 28764, 13, 67, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 36654, 2701, 62, 1462, 7, 39873, 62, 6551, 11, 3815, 13, 43358, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 16680, 541, 306, 7, 27160, 11, 6291, 62, 6551, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2611, 274, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27160, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 39873, 62, 6551, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2611, 274, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27110, 13, 8937, 7, 88, 62, 7942, 532, 14722, 62, 85, 17, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 2701, 7, 27110, 13, 7857, 7, 88, 62, 7942, 828, 48700, 13, 22468, 2624, 4008, 628, 220, 220, 220, 825, 13259, 62, 5219, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 4965, 1039, 477, 286, 262, 18663, 1181, 9633, 379, 262, 923, 286, 1123, 36835, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2611, 274, 13, 562, 570, 7, 15, 13, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 7, 15, 13, 15, 8, 628, 220, 220, 220, 825, 651, 62, 11250, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 35561, 262, 11389, 13821, 4566, 286, 262, 18663, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 4566, 796, 23884, 198, 220, 220, 220, 220, 220, 220, 220, 2779, 62, 11250, 796, 2208, 22446, 1136, 62, 11250, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1391, 1174, 8692, 62, 11250, 11, 12429, 11250, 92, 628, 198, 4871, 1338, 17208, 35422, 1292, 5308, 272, 24849, 3552, 12331, 7, 35422, 1292, 5308, 272, 24849, 3552, 12331, 2599, 198, 220, 220, 220, 37227, 7293, 1769, 1612, 4112, 4049, 329, 2760, 1292, 14722, 526, 15931, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1438, 2625, 32604, 62, 48546, 62, 18224, 62, 23912, 1424, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 16719, 274, 257, 4600, 35422, 1292, 5308, 272, 24849, 3552, 12331, 63, 4554, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 7, 3672, 28, 3672, 11, 12429, 46265, 22046, 8, 628, 220, 220, 220, 825, 4296, 62, 5219, 7, 944, 11, 331, 62, 7942, 11, 331, 62, 28764, 11, 6291, 62, 6551, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 7293, 1769, 1612, 4112, 4049, 329, 2760, 1292, 14722, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 25, 27843, 377, 7246, 45177, 2604, 896, 422, 9724, 273, 35422, 1292, 7679, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 25, 9724, 273, 35422, 1292, 14711, 9043, 3498, 1424, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 357, 25968, 2599, 1892, 9177, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 49461, 262, 6167, 355, 287, 34513, 2123, 435, 13, 532, 1262, 23818, 39522, 198, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 796, 48700, 13, 11018, 13, 66, 931, 14892, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 11018, 13, 82, 17225, 1868, 7, 88, 62, 28764, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16488, 28, 16, 8, 220, 1303, 48700, 13, 8899, 62, 22184, 7, 27110, 13, 11018, 13, 82, 17225, 1868, 11, 331, 62, 28764, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 27131, 378, 262, 14722, 1262, 262, 3918, 286, 34513, 2123, 435, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2029, 62, 400, 3447, 796, 48700, 13, 8899, 62, 22184, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37456, 2124, 25, 48700, 13, 2701, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 1875, 657, 13, 20, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 22468, 2624, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 5060, 1973, 15180, 284, 8636, 703, 867, 23818, 40885, 389, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3804, 13, 198, 220, 220, 220, 220, 220, 220, 220, 14722, 62, 85, 17, 796, 48700, 13, 445, 7234, 62, 16345, 7, 29370, 62, 400, 3447, 11, 16488, 28, 16, 8, 628, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 2701, 7, 88, 62, 7942, 11, 331, 62, 28764, 13, 67, 4906, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 4781, 477, 15225, 286, 2546, 352, 357, 68, 13, 70, 1539, 422, 16410, 16, 4357, 685, 17, 60, 4357, 284, 685, 16, 11, 362, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 16485, 1453, 2736, 7, 88, 62, 7942, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 6291, 62, 6551, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 8937, 7, 88, 62, 7942, 532, 14722, 62, 85, 17, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 2701, 7, 27110, 13, 16485, 1453, 2736, 7, 39873, 62, 6551, 828, 331, 62, 28764, 13, 67, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 36654, 2701, 62, 1462, 7, 39873, 62, 6551, 11, 3815, 13, 43358, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 16680, 541, 306, 7, 27160, 11, 6291, 62, 6551, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2611, 274, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27160, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 39873, 62, 6551, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2611, 274, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27110, 13, 8937, 7, 88, 62, 7942, 532, 14722, 62, 85, 17, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 2701, 7, 27110, 13, 7857, 7, 88, 62, 7942, 828, 48700, 13, 22468, 2624, 4008, 198, 198, 4871, 14230, 1292, 17320, 23843, 7, 27110, 13, 6122, 292, 13, 4164, 10466, 13, 9171, 1173, 2599, 198, 220, 220, 220, 37227, 7293, 1769, 9922, 329, 2760, 1292, 14722, 357, 83, 37668, 318, 3142, 4279, 198, 220, 220, 220, 5253, 284, 307, 3177, 705, 30283, 6, 16277, 21387, 15931, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1438, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15621, 28, 15, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12429, 46265, 22046, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 16719, 274, 257, 4600, 35422, 1292, 17320, 23843, 63, 4554, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1438, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 7, 3672, 28, 3672, 11, 12429, 46265, 22046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2208, 22446, 834, 15003, 834, 7, 3672, 2625, 585, 1292, 62, 4134, 23843, 62, 83, 349, 1, 10, 2536, 7, 83, 37668, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12429, 46265, 22046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4134, 82, 796, 2116, 13, 2860, 62, 6551, 7, 3672, 11639, 4134, 82, 3256, 4238, 7509, 11639, 9107, 418, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 796, 2116, 13, 2860, 62, 6551, 7, 3672, 11639, 9127, 3256, 4238, 7509, 11639, 9107, 418, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 83, 37668, 796, 15621, 628, 220, 220, 220, 825, 4296, 62, 5219, 7, 944, 11, 331, 62, 7942, 11, 331, 62, 28764, 11, 6291, 62, 6551, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 7293, 1769, 9922, 329, 2760, 1292, 14722, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 25, 27843, 377, 7246, 45177, 2604, 896, 422, 9724, 273, 35422, 1292, 7679, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 25, 9724, 273, 35422, 1292, 14711, 9043, 3498, 1424, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 357, 25968, 2599, 1892, 9177, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 49461, 262, 6167, 355, 287, 34513, 2123, 435, 13, 532, 1262, 23818, 39522, 198, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 796, 48700, 13, 11018, 13, 66, 931, 14892, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 11018, 13, 82, 17225, 1868, 7, 88, 62, 28764, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16488, 28, 16, 8, 220, 1303, 48700, 13, 8899, 62, 22184, 7, 27110, 13, 11018, 13, 82, 17225, 1868, 11, 331, 62, 28764, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 27131, 378, 262, 14722, 1262, 262, 3918, 286, 34513, 2123, 435, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2029, 62, 400, 3447, 796, 48700, 13, 8899, 62, 22184, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37456, 2124, 25, 48700, 13, 2701, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 1875, 657, 13, 20, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 22468, 2624, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 5060, 1973, 15180, 284, 8636, 703, 867, 23818, 40885, 389, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3804, 13, 198, 220, 220, 220, 220, 220, 220, 220, 14722, 62, 85, 17, 796, 48700, 13, 445, 7234, 62, 16345, 7, 29370, 62, 400, 3447, 11, 16488, 28, 16, 8, 628, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 2701, 7, 27110, 13, 445, 7234, 62, 16345, 7, 88, 62, 7942, 11, 16488, 28, 16, 828, 331, 62, 28764, 13, 67, 4906, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 4781, 477, 15225, 286, 2546, 352, 357, 68, 13, 70, 1539, 422, 16410, 16, 4357, 685, 17, 60, 4357, 284, 685, 16, 11, 362, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 16485, 1453, 2736, 7, 88, 62, 7942, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 6291, 62, 6551, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 2701, 7, 27110, 13, 1203, 62, 40496, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 8937, 7, 88, 62, 7942, 12, 23912, 1424, 62, 85, 17, 828, 27110, 13, 2701, 7, 944, 13, 83, 37668, 11, 88, 62, 28764, 13, 67, 4906, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 13, 67, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 2701, 7, 27110, 13, 16485, 1453, 2736, 7, 39873, 62, 6551, 828, 331, 62, 28764, 13, 67, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 36654, 2701, 62, 1462, 7, 39873, 62, 6551, 11, 3815, 13, 43358, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 16680, 541, 306, 7, 27160, 11, 6291, 62, 6551, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4134, 82, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27160, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 39873, 62, 6551, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4134, 82, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27110, 13, 2701, 7, 27110, 13, 1203, 62, 40496, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 8937, 7, 88, 62, 7942, 12, 23912, 1424, 62, 85, 17, 828, 27110, 13, 2701, 7, 944, 13, 83, 37668, 11, 88, 62, 28764, 13, 67, 4906, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 13, 67, 4906, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 2701, 7, 27110, 13, 7857, 7, 88, 62, 7942, 828, 48700, 13, 22468, 2624, 4008, 628, 220, 220, 220, 825, 13259, 62, 5219, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 4965, 1039, 477, 286, 262, 18663, 1181, 9633, 379, 262, 923, 286, 1123, 36835, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4134, 82, 13, 562, 570, 7, 15, 13, 15, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 7, 15, 13, 15, 8, 628, 220, 220, 220, 825, 651, 62, 11250, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 35561, 262, 11389, 13821, 4566, 286, 262, 18663, 526, 15931, 198, 220, 220, 220, 220, 220, 220, 220, 4566, 796, 1391, 6, 83, 37668, 10354, 2116, 13, 83, 37668, 92, 198, 220, 220, 220, 220, 220, 220, 220, 2779, 62, 11250, 796, 2208, 22446, 1136, 62, 11250, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1391, 1174, 8692, 62, 11250, 11, 12429, 11250, 92, 628, 198, 4871, 1338, 17208, 35422, 1292, 17320, 23843, 7, 35422, 1292, 17320, 23843, 2599, 198, 220, 220, 220, 37227, 7293, 1769, 9922, 329, 2760, 1292, 14722, 357, 83, 37668, 318, 3142, 4279, 198, 220, 220, 220, 5253, 284, 307, 3177, 705, 30283, 6, 16277, 21387, 15931, 628, 220, 220, 220, 825, 4296, 62, 5219, 7, 944, 11, 331, 62, 7942, 11, 331, 62, 28764, 11, 6291, 62, 6551, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 7293, 1769, 9922, 329, 2760, 1292, 14722, 13, 628, 220, 220, 220, 220, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 25, 27843, 377, 7246, 45177, 2604, 896, 422, 9724, 273, 35422, 1292, 7679, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 25, 9724, 273, 35422, 1292, 14711, 9043, 3498, 1424, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 357, 25968, 2599, 1892, 9177, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 49461, 262, 6167, 355, 287, 34513, 2123, 435, 13, 532, 1262, 23818, 39522, 198, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 796, 48700, 13, 11018, 13, 66, 931, 14892, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 11018, 13, 82, 17225, 1868, 7, 88, 62, 28764, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16488, 28, 16, 8, 220, 1303, 48700, 13, 8899, 62, 22184, 7, 27110, 13, 11018, 13, 82, 17225, 1868, 11, 331, 62, 28764, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 27131, 378, 262, 14722, 1262, 262, 3918, 286, 34513, 2123, 435, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2029, 62, 400, 3447, 796, 48700, 13, 8899, 62, 22184, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 37456, 2124, 25, 48700, 13, 2701, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2124, 1875, 657, 13, 20, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 22468, 2624, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10973, 62, 1676, 1443, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 5060, 1973, 15180, 284, 8636, 703, 867, 23818, 40885, 389, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3804, 13, 198, 220, 220, 220, 220, 220, 220, 220, 14722, 62, 85, 17, 796, 48700, 13, 445, 7234, 62, 16345, 7, 29370, 62, 400, 3447, 11, 16488, 28, 16, 8, 628, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 2701, 7, 88, 62, 7942, 11, 331, 62, 28764, 13, 67, 4906, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 4781, 477, 15225, 286, 2546, 352, 357, 68, 13, 70, 1539, 422, 16410, 16, 4357, 685, 17, 60, 4357, 284, 685, 16, 11, 362, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 331, 62, 7942, 796, 48700, 13, 16485, 1453, 2736, 7, 88, 62, 7942, 8, 628, 220, 220, 220, 220, 220, 220, 220, 611, 6291, 62, 6551, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 2701, 7, 27110, 13, 1203, 62, 40496, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 8937, 7, 88, 62, 7942, 12, 23912, 1424, 62, 85, 17, 828, 27110, 13, 2701, 7, 944, 13, 83, 37668, 11, 88, 62, 28764, 13, 67, 4906, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 13, 67, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 2701, 7, 27110, 13, 16485, 1453, 2736, 7, 39873, 62, 6551, 828, 331, 62, 28764, 13, 67, 4906, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 796, 48700, 13, 36654, 2701, 62, 1462, 7, 39873, 62, 6551, 11, 3815, 13, 43358, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3815, 796, 48700, 13, 16680, 541, 306, 7, 27160, 11, 6291, 62, 6551, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4134, 82, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27160, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 39873, 62, 6551, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 4134, 82, 13, 562, 570, 62, 2860, 7, 27110, 13, 445, 7234, 62, 16345, 7, 27110, 13, 2701, 7, 27110, 13, 1203, 62, 40496, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 48700, 13, 8937, 7, 88, 62, 7942, 12, 23912, 1424, 62, 85, 17, 828, 27110, 13, 2701, 7, 944, 13, 83, 37668, 11, 88, 62, 28764, 13, 67, 4906, 36911, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 28764, 13, 67, 4906, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9127, 13, 562, 570, 62, 2860, 7, 27110, 13, 2701, 7, 27110, 13, 7857, 7, 88, 62, 7942, 828, 48700, 13, 22468, 2624, 4008, 628 ]
2.117117
4,440
#https://www.geeksforgeeks.org/puzzle-maximum-number-kings-chessboard-without-check/ if __name__ == '__main__': print(main(9,3))
[ 198, 2, 5450, 1378, 2503, 13, 469, 2573, 30293, 2573, 13, 2398, 14, 79, 9625, 12, 47033, 12, 17618, 12, 74, 654, 12, 2395, 824, 3526, 12, 19419, 12, 9122, 14, 628, 628, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 628, 220, 220, 220, 3601, 7, 12417, 7, 24, 11, 18, 4008 ]
2.431034
58
# Generated by Django 3.1.4 on 2021-01-10 21:41 from django.db import migrations
[ 2, 2980, 515, 416, 37770, 513, 13, 16, 13, 19, 319, 33448, 12, 486, 12, 940, 2310, 25, 3901, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 628 ]
2.766667
30
# coding=utf-8 import os import threading import logging import utils if utils.getSystem() == utils.System.WINDOWS: from SysTrayIcon import SysTrayIcon trayThread = None tray = None show = True def initTray(): "初始化系统托盘线程" logging.info("Start a new thread to manage system tray.") global trayThread trayThread = threading.Thread(target = runTray, daemon = True) trayThread.start() return def runTray(): "添加系统托盘" global tray if utils.getSystem() == utils.System.WINDOWS: logging.info("Init system tray for windows.") menuOptions = (("显示/隐藏", None, onOptionClicked), ("退出", None, onOptionClicked)) tray = SysTrayIcon("./icon.ico", "我的热点新闻服务器", onTrayClicked, menuOptions) tray.loop() elif utils.getSystem() == utils.System.LINUX: logging.info("System tray doesn't support linux.") elif utils.getSystem() == utils.System.MACOS: logging.info("System tray doesn't support macOS.") else: logging.info("System tray doesn't support this system.") return def removeTray(): "移除系统托盘" global tray if tray is not None: if utils.getSystem() == utils.System.WINDOWS: tray.close() tray = None return def onTrayClicked(): "托盘被点击" global show if show: utils.hideWindow() else: utils.showWindow() show = not show return def onOptionClicked(id): "托盘菜单选项被点击" if id == 0: onTrayClicked() elif id == 1: # _thread.interrupt_main() # 读取输入时好像无效 removeTray() os._exit(0) return
[ 2, 19617, 28, 40477, 12, 23, 198, 198, 11748, 28686, 198, 11748, 4704, 278, 198, 11748, 18931, 198, 11748, 3384, 4487, 198, 361, 3384, 4487, 13, 1136, 11964, 3419, 6624, 3384, 4487, 13, 11964, 13, 33207, 25, 198, 220, 220, 220, 422, 311, 893, 51, 2433, 19578, 1330, 311, 893, 51, 2433, 19578, 198, 198, 2213, 323, 16818, 796, 6045, 198, 2213, 323, 796, 6045, 198, 12860, 796, 6407, 198, 198, 4299, 2315, 51, 2433, 33529, 198, 220, 220, 220, 366, 26344, 251, 34650, 233, 44293, 244, 163, 111, 119, 163, 119, 253, 33699, 246, 33566, 246, 163, 118, 123, 163, 101, 233, 1, 198, 220, 220, 220, 18931, 13, 10951, 7203, 10434, 257, 649, 4704, 284, 6687, 1080, 26473, 19570, 198, 220, 220, 220, 3298, 26473, 16818, 198, 220, 220, 220, 26473, 16818, 796, 4704, 278, 13, 16818, 7, 16793, 796, 1057, 51, 2433, 11, 33386, 796, 6407, 8, 198, 220, 220, 220, 26473, 16818, 13, 9688, 3419, 198, 220, 220, 220, 1441, 198, 198, 4299, 1057, 51, 2433, 33529, 198, 220, 220, 220, 366, 162, 115, 119, 27950, 254, 163, 111, 119, 163, 119, 253, 33699, 246, 33566, 246, 1, 198, 220, 220, 220, 3298, 26473, 198, 220, 220, 220, 611, 3384, 4487, 13, 1136, 11964, 3419, 6624, 3384, 4487, 13, 11964, 13, 33207, 25, 198, 220, 220, 220, 220, 220, 220, 220, 18931, 13, 10951, 7203, 31768, 1080, 26473, 329, 9168, 19570, 198, 220, 220, 220, 220, 220, 220, 220, 6859, 29046, 796, 357, 7203, 23626, 122, 163, 97, 118, 14, 49694, 238, 164, 245, 237, 1600, 6045, 11, 319, 19722, 8164, 276, 828, 5855, 34460, 222, 49035, 118, 1600, 6045, 11, 319, 19722, 8164, 276, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 26473, 796, 311, 893, 51, 2433, 19578, 7, 1911, 14, 4749, 13, 3713, 1600, 366, 22755, 239, 21410, 163, 225, 255, 163, 224, 117, 23877, 108, 29785, 119, 17312, 235, 27950, 94, 161, 247, 101, 1600, 319, 51, 2433, 8164, 276, 11, 6859, 29046, 8, 198, 220, 220, 220, 220, 220, 220, 220, 26473, 13, 26268, 3419, 198, 220, 220, 220, 1288, 361, 3384, 4487, 13, 1136, 11964, 3419, 6624, 3384, 4487, 13, 11964, 13, 34509, 31235, 25, 198, 220, 220, 220, 220, 220, 220, 220, 18931, 13, 10951, 7203, 11964, 26473, 1595, 470, 1104, 32639, 19570, 198, 220, 220, 220, 1288, 361, 3384, 4487, 13, 1136, 11964, 3419, 6624, 3384, 4487, 13, 11964, 13, 44721, 2640, 25, 198, 220, 220, 220, 220, 220, 220, 220, 18931, 13, 10951, 7203, 11964, 26473, 1595, 470, 1104, 40017, 19570, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 18931, 13, 10951, 7203, 11964, 26473, 1595, 470, 1104, 428, 1080, 19570, 198, 220, 220, 220, 1441, 198, 198, 4299, 4781, 51, 2433, 33529, 198, 220, 220, 220, 366, 163, 100, 119, 165, 247, 97, 163, 111, 119, 163, 119, 253, 33699, 246, 33566, 246, 1, 198, 220, 220, 220, 3298, 26473, 198, 220, 220, 220, 611, 26473, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 611, 3384, 4487, 13, 1136, 11964, 3419, 6624, 3384, 4487, 13, 11964, 13, 33207, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 26473, 13, 19836, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 26473, 796, 6045, 198, 220, 220, 220, 1441, 198, 198, 4299, 319, 51, 2433, 8164, 276, 33529, 198, 220, 220, 220, 366, 33699, 246, 33566, 246, 164, 95, 104, 163, 224, 117, 49035, 119, 1, 198, 220, 220, 220, 3298, 905, 198, 220, 220, 220, 611, 905, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3384, 4487, 13, 24717, 27703, 3419, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3384, 4487, 13, 12860, 27703, 3419, 198, 220, 220, 220, 905, 796, 407, 905, 198, 220, 220, 220, 1441, 198, 198, 4299, 319, 19722, 8164, 276, 7, 312, 2599, 198, 220, 220, 220, 366, 33699, 246, 33566, 246, 164, 237, 250, 39355, 243, 34460, 231, 165, 94, 117, 164, 95, 104, 163, 224, 117, 49035, 119, 1, 198, 220, 220, 220, 611, 4686, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 319, 51, 2433, 8164, 276, 3419, 198, 220, 220, 220, 1288, 361, 4686, 6624, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 4808, 16663, 13, 3849, 3622, 62, 12417, 3419, 1303, 5525, 107, 119, 20998, 244, 164, 122, 241, 17739, 98, 33768, 114, 25001, 121, 161, 225, 237, 33768, 254, 46763, 230, 198, 220, 220, 220, 220, 220, 220, 220, 4781, 51, 2433, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 28686, 13557, 37023, 7, 15, 8, 198, 220, 220, 220, 1441, 198 ]
2.03949
785
# class Tree: # def __init__(self, val, left=None, right=None): # self.val = val # self.left = left # self.right = right
[ 2, 1398, 12200, 25, 198, 2, 220, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1188, 11, 1364, 28, 14202, 11, 826, 28, 14202, 2599, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 2100, 796, 1188, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9464, 796, 1364, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3506, 796, 826, 198 ]
2.041096
73
import logging from django.core.management.base import BaseCommand
[ 11748, 18931, 198, 198, 6738, 42625, 14208, 13, 7295, 13, 27604, 13, 8692, 1330, 7308, 21575, 628 ]
4.058824
17
"""Command-line interfacing workflows""" import argparse import os import sys import imp import inspect import argcomplete from . import core from . common import WorkflowError, WORKFLOW_DEFAULT_FILENAME from . import decorators from . userargument import USER_ARGS_CONTEXT from . _ui import ui from . import _util as util def open_graph(directory, graph_name, wf_filename=WORKFLOW_DEFAULT_FILENAME): """Opens an existing workflow and return the specified graph instance. Args: directory (str): A directory containg a `workflow.py` file, or a file named by the `wf_filename` argument. graph_name (str): The graph's name to open, see :func:`rflow.decorators.graph` wf_filename (str): The workflow python script. Default is `"workflow.py"`. Returns: :obj:`rflow.core.Graph`: DAG object. Raises: :obj:`rflow.common.WorkflowError`: If the graph isn't found. `FileNotFoundError`: If the directory doesn't exists or if the `workflow.py` or what passed to `wf_filename` does not exists. """ if core.exists_graph(graph_name, directory): return core.get_graph(graph_name, directory, existing=True) graph_def_list = _get_all_graph_def( os.path.abspath(directory), wf_filename) defgraph_info_list = [graph_def for graph_def in graph_def_list if graph_def.name == graph_name] if not defgraph_info_list: raise WorkflowError( "Graph not {} found on directory {}. Available ones are: {}".format( graph_name, directory, ', '.join( [deco.name for _1, _2, deco in defgraph_info_list]))) else: defgraph_info = defgraph_info_list[0] defgraph_info.function() return core.get_graph(graph_name, directory, existing=True) ACTIONS = ['run', 'touch', 'print-run', 'viz-dag', 'help', 'clean'] def main(argv=None): """Command-line auto main generator. Generates a command-line main for executing the graphs defined in the current source file. See the decorator :class:`rflow.decorators.graph` for how to define graphs. The default behavior is quit the process when an error is encountered. For example:: @srwf.graph() def workflow1(g): g.add = Add() g.add.args.a = 1 g.add.args.b = 2 g.sub = Sub(srwf.FSResource('sub.pkl')) g.sub.args.a = 8 g.sub.args.b = g.add if __name__ == '__main__': srwf.command.main() In a shell execute:: $ srwf workflow1 run sub For passing custom arguments by command-line, use the class :class:`rflow.userargument.UserArgument`. Args: args (str, optional): sys.args like command-line arguments. Returns: int: exit code. """ # pylint: disable=too-many-return-statements try: all_graphs = _get_all_graph_def(os.path.abspath(os.path.curdir), WORKFLOW_DEFAULT_FILENAME) except WorkflowError as err: print(str(err)) return 1 arg_parser = argparse.ArgumentParser( description="RFlow workflow runner", formatter_class=argparse.ArgumentDefaultsHelpFormatter) arg_parser.add_argument( 'graph', choices=[graph.name for graph in all_graphs]) arg_parser.add_argument('action', choices=ACTIONS) argcomplete.autocomplete(arg_parser) if not argv: argv = sys.argv args = arg_parser.parse_args(argv[1:3]) if int(os.environ.get("RFLOW_DEBUG", 0)) == 1: ui.complete_traceback = True abs_path = os.path.abspath('.') graph = open_graph(abs_path, args.graph) argv = argv[3:] if args.action == 'print-run': raise NotImplementedError() elif args.action == 'run': return _run_main(graph, argv) elif args.action == 'touch': return _touch_main(graph, argv) elif args.action == 'clean': return _clean_main(graph, argv) elif args.action == 'help': return _help_main(graph, argv) elif args.action == 'viz-dag': return _viz_main(graph, argv) return 1
[ 37811, 21575, 12, 1370, 9556, 4092, 670, 44041, 37811, 628, 198, 11748, 1822, 29572, 198, 11748, 28686, 198, 11748, 25064, 198, 11748, 848, 198, 11748, 10104, 198, 198, 11748, 1822, 20751, 198, 198, 6738, 764, 1330, 4755, 198, 6738, 764, 2219, 1330, 5521, 11125, 12331, 11, 30936, 3697, 3913, 62, 7206, 38865, 62, 46700, 1677, 10067, 198, 6738, 764, 1330, 11705, 2024, 198, 6738, 764, 2836, 49140, 1330, 1294, 1137, 62, 1503, 14313, 62, 10943, 32541, 198, 6738, 764, 4808, 9019, 1330, 334, 72, 198, 6738, 764, 1330, 4808, 22602, 355, 7736, 628, 628, 628, 198, 4299, 1280, 62, 34960, 7, 34945, 11, 4823, 62, 3672, 11, 266, 69, 62, 34345, 28, 33249, 3697, 3913, 62, 7206, 38865, 62, 46700, 1677, 10067, 2599, 198, 220, 220, 220, 37227, 18257, 641, 281, 4683, 30798, 290, 1441, 262, 7368, 4823, 4554, 13, 628, 220, 220, 220, 943, 14542, 25, 628, 220, 220, 220, 220, 220, 220, 220, 8619, 357, 2536, 2599, 317, 8619, 542, 64, 278, 257, 4600, 1818, 11125, 13, 9078, 63, 2393, 11, 393, 198, 220, 220, 220, 220, 220, 220, 220, 220, 257, 2393, 3706, 416, 262, 4600, 86, 69, 62, 34345, 63, 4578, 13, 628, 220, 220, 220, 220, 220, 220, 220, 4823, 62, 3672, 357, 2536, 2599, 383, 4823, 338, 1438, 284, 1280, 11, 766, 198, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 20786, 25, 63, 81, 11125, 13, 12501, 273, 2024, 13, 34960, 63, 628, 220, 220, 220, 220, 220, 220, 220, 266, 69, 62, 34345, 357, 2536, 2599, 383, 30798, 21015, 4226, 13, 15161, 318, 198, 220, 220, 220, 220, 220, 220, 220, 220, 4600, 1, 1818, 11125, 13, 9078, 1, 44646, 628, 220, 220, 220, 16409, 25, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 26801, 25, 63, 81, 11125, 13, 7295, 13, 37065, 63, 25, 360, 4760, 2134, 13, 628, 220, 220, 220, 7567, 2696, 25, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 26801, 25, 63, 81, 11125, 13, 11321, 13, 12468, 11125, 12331, 63, 25, 1002, 262, 4823, 198, 220, 220, 220, 220, 220, 220, 220, 220, 2125, 470, 1043, 13, 628, 220, 220, 220, 220, 220, 220, 220, 4600, 8979, 3673, 21077, 12331, 63, 25, 1002, 262, 8619, 1595, 470, 7160, 393, 611, 262, 198, 220, 220, 220, 220, 220, 220, 220, 220, 4600, 1818, 11125, 13, 9078, 63, 393, 644, 3804, 284, 4600, 86, 69, 62, 34345, 63, 857, 407, 198, 220, 220, 220, 220, 220, 220, 220, 220, 7160, 13, 628, 220, 220, 220, 37227, 198, 220, 220, 220, 611, 4755, 13, 1069, 1023, 62, 34960, 7, 34960, 62, 3672, 11, 8619, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4755, 13, 1136, 62, 34960, 7, 34960, 62, 3672, 11, 8619, 11, 4683, 28, 17821, 8, 628, 220, 220, 220, 4823, 62, 4299, 62, 4868, 796, 4808, 1136, 62, 439, 62, 34960, 62, 4299, 7, 198, 220, 220, 220, 220, 220, 220, 220, 28686, 13, 6978, 13, 397, 2777, 776, 7, 34945, 828, 266, 69, 62, 34345, 8, 628, 220, 220, 220, 825, 34960, 62, 10951, 62, 4868, 796, 685, 34960, 62, 4299, 329, 4823, 62, 4299, 287, 4823, 62, 4299, 62, 4868, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 4823, 62, 4299, 13, 3672, 6624, 4823, 62, 3672, 60, 628, 220, 220, 220, 611, 407, 825, 34960, 62, 10951, 62, 4868, 25, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 5521, 11125, 12331, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 37065, 407, 23884, 1043, 319, 8619, 23884, 13, 14898, 3392, 389, 25, 23884, 1911, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4823, 62, 3672, 11, 8619, 11, 46083, 45302, 22179, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 685, 12501, 78, 13, 3672, 329, 4808, 16, 11, 4808, 17, 11, 875, 78, 287, 825, 34960, 62, 10951, 62, 4868, 60, 22305, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 825, 34960, 62, 10951, 796, 825, 34960, 62, 10951, 62, 4868, 58, 15, 60, 628, 220, 220, 220, 825, 34960, 62, 10951, 13, 8818, 3419, 628, 220, 220, 220, 1441, 4755, 13, 1136, 62, 34960, 7, 34960, 62, 3672, 11, 8619, 11, 4683, 28, 17821, 8, 628, 628, 628, 198, 198, 10659, 11053, 796, 37250, 5143, 3256, 705, 29332, 3256, 705, 4798, 12, 5143, 3256, 705, 85, 528, 12, 67, 363, 3256, 705, 16794, 3256, 705, 27773, 20520, 628, 198, 4299, 1388, 7, 853, 85, 28, 14202, 2599, 198, 220, 220, 220, 37227, 21575, 12, 1370, 8295, 1388, 17301, 13, 628, 220, 220, 220, 2980, 689, 257, 3141, 12, 1370, 1388, 329, 23710, 262, 28770, 5447, 287, 198, 220, 220, 220, 262, 1459, 2723, 2393, 13, 4091, 262, 11705, 1352, 198, 220, 220, 220, 1058, 4871, 25, 63, 81, 11125, 13, 12501, 273, 2024, 13, 34960, 63, 329, 703, 284, 8160, 198, 220, 220, 220, 28770, 13, 383, 4277, 4069, 318, 11238, 262, 1429, 618, 281, 4049, 318, 198, 220, 220, 220, 12956, 13, 628, 198, 220, 220, 220, 1114, 1672, 3712, 628, 220, 220, 220, 220, 220, 220, 220, 2488, 27891, 86, 69, 13, 34960, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 825, 30798, 16, 7, 70, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 308, 13, 2860, 796, 3060, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 308, 13, 2860, 13, 22046, 13, 64, 796, 352, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 308, 13, 2860, 13, 22046, 13, 65, 796, 362, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 308, 13, 7266, 796, 3834, 7, 27891, 86, 69, 13, 10652, 26198, 10786, 7266, 13, 79, 41582, 6, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 308, 13, 7266, 13, 22046, 13, 64, 796, 807, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 308, 13, 7266, 13, 22046, 13, 65, 796, 308, 13, 2860, 628, 220, 220, 220, 220, 220, 220, 220, 611, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19677, 86, 69, 13, 21812, 13, 12417, 3419, 628, 220, 220, 220, 554, 257, 7582, 12260, 3712, 628, 220, 220, 220, 220, 220, 220, 220, 720, 19677, 86, 69, 30798, 16, 1057, 850, 628, 220, 220, 220, 1114, 6427, 2183, 7159, 416, 3141, 12, 1370, 11, 779, 262, 1398, 198, 220, 220, 220, 1058, 4871, 25, 63, 81, 11125, 13, 7220, 49140, 13, 12982, 28100, 1713, 44646, 628, 220, 220, 220, 943, 14542, 25, 628, 220, 220, 220, 220, 220, 220, 220, 26498, 357, 2536, 11, 11902, 2599, 25064, 13, 22046, 588, 3141, 12, 1370, 7159, 13, 628, 220, 220, 220, 16409, 25, 628, 220, 220, 220, 220, 220, 220, 220, 493, 25, 8420, 2438, 13, 628, 220, 220, 220, 37227, 198, 220, 220, 220, 1303, 279, 2645, 600, 25, 15560, 28, 18820, 12, 21834, 12, 7783, 12, 14269, 3196, 198, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 477, 62, 34960, 82, 796, 4808, 1136, 62, 439, 62, 34960, 62, 4299, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 418, 13, 6978, 13, 66, 2799, 343, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 30936, 3697, 3913, 62, 7206, 38865, 62, 46700, 1677, 10067, 8, 198, 220, 220, 220, 2845, 5521, 11125, 12331, 355, 11454, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 2536, 7, 8056, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 352, 628, 220, 220, 220, 1822, 62, 48610, 796, 1822, 29572, 13, 28100, 1713, 46677, 7, 198, 220, 220, 220, 220, 220, 220, 220, 6764, 2625, 49, 37535, 30798, 17490, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 1296, 1436, 62, 4871, 28, 853, 29572, 13, 28100, 1713, 7469, 13185, 22087, 8479, 1436, 8, 198, 220, 220, 220, 1822, 62, 48610, 13, 2860, 62, 49140, 7, 198, 220, 220, 220, 220, 220, 220, 220, 705, 34960, 3256, 7747, 41888, 34960, 13, 3672, 329, 4823, 287, 477, 62, 34960, 82, 12962, 198, 220, 220, 220, 1822, 62, 48610, 13, 2860, 62, 49140, 10786, 2673, 3256, 7747, 28, 10659, 11053, 8, 198, 220, 220, 220, 1822, 20751, 13, 2306, 42829, 6677, 7, 853, 62, 48610, 8, 198, 220, 220, 220, 611, 407, 1822, 85, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1822, 85, 796, 25064, 13, 853, 85, 628, 220, 220, 220, 26498, 796, 1822, 62, 48610, 13, 29572, 62, 22046, 7, 853, 85, 58, 16, 25, 18, 12962, 628, 220, 220, 220, 611, 493, 7, 418, 13, 268, 2268, 13, 1136, 7203, 49, 3697, 3913, 62, 30531, 1600, 657, 4008, 6624, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 334, 72, 13, 20751, 62, 40546, 1891, 796, 6407, 628, 220, 220, 220, 2352, 62, 6978, 796, 28686, 13, 6978, 13, 397, 2777, 776, 10786, 2637, 8, 198, 220, 220, 220, 4823, 796, 1280, 62, 34960, 7, 8937, 62, 6978, 11, 26498, 13, 34960, 8, 628, 220, 220, 220, 1822, 85, 796, 1822, 85, 58, 18, 47715, 198, 220, 220, 220, 611, 26498, 13, 2673, 6624, 705, 4798, 12, 5143, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 5298, 1892, 3546, 1154, 12061, 12331, 3419, 198, 220, 220, 220, 1288, 361, 26498, 13, 2673, 6624, 705, 5143, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 5143, 62, 12417, 7, 34960, 11, 1822, 85, 8, 198, 220, 220, 220, 1288, 361, 26498, 13, 2673, 6624, 705, 29332, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 29332, 62, 12417, 7, 34960, 11, 1822, 85, 8, 198, 220, 220, 220, 1288, 361, 26498, 13, 2673, 6624, 705, 27773, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 27773, 62, 12417, 7, 34960, 11, 1822, 85, 8, 198, 220, 220, 220, 1288, 361, 26498, 13, 2673, 6624, 705, 16794, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 16794, 62, 12417, 7, 34960, 11, 1822, 85, 8, 198, 220, 220, 220, 1288, 361, 26498, 13, 2673, 6624, 705, 85, 528, 12, 67, 363, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 4808, 85, 528, 62, 12417, 7, 34960, 11, 1822, 85, 8, 628, 220, 220, 220, 1441, 352, 198 ]
2.343819
1,812
#!/usr/bin/env python import rospy import tf import serial import numpy as np from nav_msgs.msg import Odometry from geometry_msgs.msg import Point from std_msgs.msg import Int64 global x, y, theta, v_L, v_R, v_x, v_y, omega x = 0 y = 0 theta = 0 v_L = 0 v_R = 0 v_x = 0 v_y = 0 omega = 0 pub_tf = False # Use estimate result as tf if(pub_tf): br = tf.TransformBroadcaster() if __name__ == '__main__': rospy.init_node('whel_odom_node', anonymous = False) port = rospy.get_param("~port", "/dev/ttyACM0") # default port: /dev/ttyUSB0 ard = serial.Serial(port, 9600) rospy.Timer(rospy.Duration.from_sec(0.1), read_data) # 10Hz rospy.spin()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 11748, 686, 2777, 88, 198, 11748, 48700, 198, 11748, 11389, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 6812, 62, 907, 14542, 13, 19662, 1330, 10529, 15748, 198, 6738, 22939, 62, 907, 14542, 13, 19662, 1330, 6252, 198, 6738, 14367, 62, 907, 14542, 13, 19662, 1330, 2558, 2414, 198, 20541, 2124, 11, 331, 11, 262, 8326, 11, 410, 62, 43, 11, 410, 62, 49, 11, 410, 62, 87, 11, 410, 62, 88, 11, 37615, 198, 198, 87, 796, 657, 198, 88, 796, 657, 198, 1169, 8326, 796, 657, 198, 85, 62, 43, 796, 657, 198, 85, 62, 49, 796, 657, 198, 85, 62, 87, 796, 657, 198, 85, 62, 88, 796, 657, 198, 462, 4908, 796, 657, 198, 12984, 62, 27110, 796, 10352, 1303, 5765, 8636, 1255, 355, 48700, 198, 361, 7, 12984, 62, 27110, 2599, 198, 197, 1671, 796, 48700, 13, 41762, 30507, 17970, 3419, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 197, 305, 2777, 88, 13, 15003, 62, 17440, 10786, 30613, 62, 375, 296, 62, 17440, 3256, 11614, 796, 10352, 8, 198, 197, 634, 796, 686, 2777, 88, 13, 1136, 62, 17143, 7203, 93, 634, 1600, 12813, 7959, 14, 42852, 2246, 44, 15, 4943, 1303, 4277, 2493, 25, 1220, 7959, 14, 42852, 27155, 15, 198, 197, 446, 796, 11389, 13, 32634, 7, 634, 11, 860, 8054, 8, 198, 197, 305, 2777, 88, 13, 48801, 7, 305, 2777, 88, 13, 26054, 13, 6738, 62, 2363, 7, 15, 13, 16, 828, 1100, 62, 7890, 8, 1303, 838, 7399, 198, 197, 305, 2777, 88, 13, 39706, 3419, 198 ]
2.371324
272
from nbgrader.auth import JupyterHubAuthPlugin c = get_config() c.Application.log_level = 30 c.Authenticator.plugin_class = JupyterHubAuthPlugin c.Exchange.path_includes_course = True c.Exchange.root = "/srv/nbgrader/exchange" c.ExecutePreprocessor.iopub_timeout=1800 c.ExecutePreprocessor.timeout=3600
[ 6738, 299, 65, 2164, 5067, 13, 18439, 1330, 449, 929, 88, 353, 16066, 30515, 37233, 628, 198, 66, 796, 651, 62, 11250, 3419, 198, 198, 66, 13, 23416, 13, 6404, 62, 5715, 796, 1542, 198, 198, 66, 13, 47649, 26407, 13, 33803, 62, 4871, 796, 449, 929, 88, 353, 16066, 30515, 37233, 198, 198, 66, 13, 3109, 3803, 13, 6978, 62, 42813, 62, 17319, 796, 6407, 198, 66, 13, 3109, 3803, 13, 15763, 796, 12813, 27891, 85, 14, 46803, 2164, 5067, 14, 1069, 3803, 1, 198, 198, 66, 13, 23002, 1133, 6719, 41341, 13, 14922, 549, 62, 48678, 28, 39188, 198, 66, 13, 23002, 1133, 6719, 41341, 13, 48678, 28, 2623, 405, 198 ]
2.734513
113
from iota import Iota from iota import Address, ProposedTransaction, Tag, Transaction from iota import TryteString from iota import ProposedBundle from iota.commands.extended import utils from datetime import datetime from pprint import pprint import hashlib import time import random import string
[ 6738, 1312, 4265, 1330, 314, 4265, 198, 6738, 1312, 4265, 1330, 17917, 11, 8772, 1335, 48720, 11, 17467, 11, 45389, 198, 6738, 1312, 4265, 1330, 9993, 660, 10100, 198, 6738, 1312, 4265, 1330, 8772, 1335, 33, 31249, 198, 6738, 1312, 4265, 13, 9503, 1746, 13, 2302, 1631, 1330, 3384, 4487, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 279, 4798, 1330, 279, 4798, 198, 11748, 12234, 8019, 220, 198, 11748, 640, 198, 11748, 4738, 198, 11748, 4731, 628, 628, 628, 628, 198 ]
3.710843
83
from __future__ import unicode_literals import datetime from django.contrib import admin from django.contrib.admin.options import IncorrectLookupParameters from django.contrib.admin.templatetags.admin_list import pagination from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase from django.contrib.admin.views.main import ALL_VAR, SEARCH_VAR, ChangeList from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.template import Context, Template from django.test import TestCase, override_settings from django.test.client import RequestFactory from django.utils import formats, six from .admin import ( BandAdmin, ChildAdmin, ChordsBandAdmin, CustomPaginationAdmin, CustomPaginator, DynamicListDisplayChildAdmin, DynamicListDisplayLinksChildAdmin, DynamicListFilterChildAdmin, DynamicSearchFieldsChildAdmin, FilteredChildAdmin, GroupAdmin, InvitationAdmin, NoListDisplayLinksParentAdmin, ParentAdmin, QuartetAdmin, SwallowAdmin, site as custom_site, ) from .models import ( Band, Child, ChordsBand, ChordsMusician, CustomIdUser, Event, Genre, Group, Invitation, Membership, Musician, OrderedObject, Parent, Quartet, Swallow, UnorderedObject, ) @override_settings(ROOT_URLCONF="admin_changelist.urls") @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], ROOT_URLCONF="admin_changelist.urls")
[ 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 11748, 4818, 8079, 198, 198, 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 28482, 13, 25811, 1330, 3457, 47315, 8567, 929, 48944, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 28482, 13, 11498, 489, 265, 316, 3775, 13, 28482, 62, 4868, 1330, 42208, 1883, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 28482, 13, 41989, 1330, 32053, 48767, 47477, 13908, 32103, 14402, 20448, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 28482, 13, 33571, 13, 12417, 1330, 11096, 62, 53, 1503, 11, 7946, 31315, 62, 53, 1503, 11, 9794, 8053, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, 1330, 11787, 198, 6738, 42625, 14208, 13, 7295, 13, 6371, 411, 349, 690, 1330, 9575, 198, 6738, 42625, 14208, 13, 28243, 1330, 30532, 11, 37350, 198, 6738, 42625, 14208, 13, 9288, 1330, 6208, 20448, 11, 20957, 62, 33692, 198, 6738, 42625, 14208, 13, 9288, 13, 16366, 1330, 19390, 22810, 198, 6738, 42625, 14208, 13, 26791, 1330, 17519, 11, 2237, 198, 198, 6738, 764, 28482, 1330, 357, 198, 220, 220, 220, 10243, 46787, 11, 5932, 46787, 11, 609, 3669, 31407, 46787, 11, 8562, 47, 363, 1883, 46787, 11, 198, 220, 220, 220, 8562, 47, 363, 20900, 11, 26977, 8053, 23114, 16424, 46787, 11, 198, 220, 220, 220, 26977, 8053, 23114, 31815, 16424, 46787, 11, 26977, 8053, 22417, 16424, 46787, 11, 198, 220, 220, 220, 26977, 18243, 15878, 82, 16424, 46787, 11, 7066, 4400, 16424, 46787, 11, 4912, 46787, 11, 198, 220, 220, 220, 10001, 3780, 46787, 11, 1400, 8053, 23114, 31815, 24546, 46787, 11, 16774, 46787, 11, 48748, 316, 46787, 11, 198, 220, 220, 220, 2451, 12154, 46787, 11, 2524, 355, 2183, 62, 15654, 11, 198, 8, 198, 6738, 764, 27530, 1330, 357, 198, 220, 220, 220, 10243, 11, 5932, 11, 609, 3669, 31407, 11, 609, 3669, 10694, 6749, 11, 8562, 7390, 12982, 11, 8558, 11, 5215, 260, 11, 4912, 11, 198, 220, 220, 220, 10001, 3780, 11, 37939, 11, 2629, 6749, 11, 14230, 1068, 10267, 11, 16774, 11, 48748, 316, 11, 2451, 12154, 11, 198, 220, 220, 220, 791, 24071, 10267, 11, 198, 8, 628, 198, 31, 2502, 13154, 62, 33692, 7, 13252, 2394, 62, 4261, 5639, 1340, 37, 2625, 28482, 62, 354, 8368, 396, 13, 6371, 82, 4943, 628, 198, 198, 31, 2502, 13154, 62, 33692, 7, 47924, 54, 12532, 62, 39, 11211, 4877, 28, 17816, 28241, 14208, 13, 3642, 822, 13, 18439, 13, 10134, 7084, 13, 37596, 16, 35215, 19242, 372, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15107, 2394, 62, 4261, 5639, 1340, 37, 2625, 28482, 62, 354, 8368, 396, 13, 6371, 82, 4943, 628, 198 ]
3.127155
464
""" These are emukit model wrappers that contain the specific optimization procedures we found worked well for each model. The constructor for each model takes X and Y as lists, with each entry of the list corresponding to data for a fidelity """ import logging import GPy import numpy as np from ...core.interfaces import IModel from ...model_wrappers import GPyMultiOutputWrapper from ...multi_fidelity.convert_lists_to_array import convert_xy_lists_to_arrays from ...multi_fidelity.kernels import LinearMultiFidelityKernel from ...multi_fidelity.models import GPyLinearMultiFidelityModel from ...multi_fidelity.models.non_linear_multi_fidelity_model import ( NonLinearMultiFidelityModel, make_non_linear_kernels) _log = logging.getLogger(__name__) class HighFidelityGp(IModel): """ GP at high fidelity only. The optimization is restarted from random initial points 10 times. The noise parameter is initialized at 1e-6 for the first optimization round. """ def predict(self, X): """ Predict from high fidelity """ return self.model.predict(X[:, :-1]) @property @property class LinearAutoRegressiveModel(IModel): """ Linear model, AR1 in paper. Optimized with noise fixed at 1e-6 until convergence then the noise parameter is freed and the model is optimized again """ def __init__(self, X, Y, n_restarts=10): """ :param X: List of training data at each fidelity :param Y: List of training targets at each fidelity :param n_restarts: Number of restarts during optimization of hyper-parameters """ x_train, y_train = convert_xy_lists_to_arrays(X, Y) n_dims = X[0].shape[1] kernels = [GPy.kern.RBF(n_dims, ARD=True) for _ in range(len(X))] lin_mf_kernel = LinearMultiFidelityKernel(kernels) gpy_lin_mf_model = GPyLinearMultiFidelityModel(x_train, y_train, lin_mf_kernel, n_fidelities=len(X)) gpy_lin_mf_model.mixed_noise.Gaussian_noise.fix(1e-6) gpy_lin_mf_model.mixed_noise.Gaussian_noise_1.fix(1e-6) if len(Y) == 3: gpy_lin_mf_model.mixed_noise.Gaussian_noise_2.fix(1e-6) self.model = GPyMultiOutputWrapper(gpy_lin_mf_model, len(X), n_optimization_restarts=n_restarts) self.name = 'ar1' self.n_fidelities = len(X) def predict(self, X): """ Predict from high fidelity """ return self.model.predict(X) @property @property class NonLinearAutoRegressiveModel(IModel): """ Non-linear model, NARGP in paper """ def predict(self, X): """ Predict from high fidelity """ return self.model.predict(X) @property @property
[ 37811, 198, 4711, 389, 795, 2724, 270, 2746, 7917, 11799, 326, 3994, 262, 2176, 23989, 9021, 356, 1043, 3111, 880, 329, 1123, 2746, 13, 198, 198, 464, 23772, 329, 1123, 2746, 2753, 1395, 290, 575, 355, 8341, 11, 351, 1123, 5726, 286, 262, 1351, 11188, 284, 1366, 329, 257, 37744, 198, 37811, 198, 11748, 18931, 198, 198, 11748, 14714, 88, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 2644, 7295, 13, 3849, 32186, 1330, 314, 17633, 198, 6738, 2644, 19849, 62, 29988, 11799, 1330, 14714, 88, 29800, 26410, 36918, 2848, 198, 6738, 2644, 41684, 62, 69, 23091, 13, 1102, 1851, 62, 20713, 62, 1462, 62, 18747, 1330, 10385, 62, 5431, 62, 20713, 62, 1462, 62, 3258, 592, 198, 6738, 2644, 41684, 62, 69, 23091, 13, 74, 44930, 1330, 44800, 29800, 37, 23091, 42, 7948, 198, 6738, 2644, 41684, 62, 69, 23091, 13, 27530, 1330, 14714, 88, 14993, 451, 29800, 37, 23091, 17633, 198, 6738, 2644, 41684, 62, 69, 23091, 13, 27530, 13, 13159, 62, 29127, 62, 41684, 62, 69, 23091, 62, 19849, 1330, 357, 198, 220, 220, 220, 8504, 14993, 451, 29800, 37, 23091, 17633, 11, 787, 62, 13159, 62, 29127, 62, 74, 44930, 8, 198, 198, 62, 6404, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628, 198, 4871, 3334, 37, 23091, 38, 79, 7, 3955, 375, 417, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 14714, 379, 1029, 37744, 691, 13, 628, 220, 220, 220, 383, 23989, 318, 15765, 276, 422, 4738, 4238, 2173, 838, 1661, 13, 198, 220, 220, 220, 383, 7838, 11507, 318, 23224, 379, 352, 68, 12, 21, 329, 262, 717, 23989, 2835, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 4331, 7, 944, 11, 1395, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 49461, 422, 1029, 37744, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 19849, 13, 79, 17407, 7, 55, 58, 45299, 1058, 12, 16, 12962, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 26745, 628, 198, 4871, 44800, 27722, 8081, 3314, 17633, 7, 3955, 375, 417, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 44800, 2746, 11, 5923, 16, 287, 3348, 13, 30011, 1143, 351, 7838, 5969, 379, 352, 68, 12, 21, 1566, 40826, 788, 262, 7838, 11507, 318, 13459, 198, 220, 220, 220, 290, 262, 2746, 318, 23392, 757, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1395, 11, 575, 11, 299, 62, 2118, 5889, 28, 940, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 628, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 1395, 25, 7343, 286, 3047, 1366, 379, 1123, 37744, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 575, 25, 7343, 286, 3047, 6670, 379, 1123, 37744, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 17143, 299, 62, 2118, 5889, 25, 7913, 286, 1334, 5889, 1141, 23989, 286, 8718, 12, 17143, 7307, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 62, 27432, 11, 331, 62, 27432, 796, 10385, 62, 5431, 62, 20713, 62, 1462, 62, 3258, 592, 7, 55, 11, 575, 8, 198, 220, 220, 220, 220, 220, 220, 220, 299, 62, 67, 12078, 796, 1395, 58, 15, 4083, 43358, 58, 16, 60, 198, 220, 220, 220, 220, 220, 220, 220, 50207, 796, 685, 16960, 88, 13, 74, 1142, 13, 27912, 37, 7, 77, 62, 67, 12078, 11, 5923, 35, 28, 17821, 8, 329, 4808, 287, 2837, 7, 11925, 7, 55, 4008, 60, 198, 220, 220, 220, 220, 220, 220, 220, 9493, 62, 76, 69, 62, 33885, 796, 44800, 29800, 37, 23091, 42, 7948, 7, 74, 44930, 8, 198, 220, 220, 220, 220, 220, 220, 220, 308, 9078, 62, 2815, 62, 76, 69, 62, 19849, 796, 14714, 88, 14993, 451, 29800, 37, 23091, 17633, 7, 87, 62, 27432, 11, 331, 62, 27432, 11, 9493, 62, 76, 69, 62, 33885, 11, 299, 62, 69, 5943, 871, 28, 11925, 7, 55, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 308, 9078, 62, 2815, 62, 76, 69, 62, 19849, 13, 76, 2966, 62, 3919, 786, 13, 35389, 31562, 62, 3919, 786, 13, 13049, 7, 16, 68, 12, 21, 8, 198, 220, 220, 220, 220, 220, 220, 220, 308, 9078, 62, 2815, 62, 76, 69, 62, 19849, 13, 76, 2966, 62, 3919, 786, 13, 35389, 31562, 62, 3919, 786, 62, 16, 13, 13049, 7, 16, 68, 12, 21, 8, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 56, 8, 6624, 513, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 308, 9078, 62, 2815, 62, 76, 69, 62, 19849, 13, 76, 2966, 62, 3919, 786, 13, 35389, 31562, 62, 3919, 786, 62, 17, 13, 13049, 7, 16, 68, 12, 21, 8, 628, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 19849, 796, 14714, 88, 29800, 26410, 36918, 2848, 7, 70, 9078, 62, 2815, 62, 76, 69, 62, 19849, 11, 18896, 7, 55, 828, 299, 62, 40085, 1634, 62, 2118, 5889, 28, 77, 62, 2118, 5889, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 3672, 796, 705, 283, 16, 6, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 77, 62, 69, 5943, 871, 796, 18896, 7, 55, 8, 628, 220, 220, 220, 825, 4331, 7, 944, 11, 1395, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 49461, 422, 1029, 37744, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 19849, 13, 79, 17407, 7, 55, 8, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 26745, 628, 198, 4871, 8504, 14993, 451, 27722, 8081, 3314, 17633, 7, 3955, 375, 417, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 8504, 12, 29127, 2746, 11, 399, 1503, 16960, 287, 3348, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 4331, 7, 944, 11, 1395, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 49461, 422, 1029, 37744, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 19849, 13, 79, 17407, 7, 55, 8, 628, 220, 220, 220, 2488, 26745, 628, 220, 220, 220, 2488, 26745, 198 ]
2.531622
1,091
import argparse import typing import aztk.spark from aztk_cli import log, config
[ 11748, 1822, 29572, 198, 11748, 19720, 198, 11748, 35560, 30488, 13, 2777, 668, 198, 6738, 35560, 30488, 62, 44506, 1330, 2604, 11, 4566, 628, 198 ]
3.32
25
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Copyright (c) 2019, Eurecat / UPF # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the <organization> nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @file evaluate_sht_filters.py # @author Andrés Pérez-López # @date 01/10/2019 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import numpy as np import matplotlib.pyplot as plt from masp.validate_data_types import _validate_int, _validate_ndarray_1D, \ _validate_ndarray_2D, _validate_ndarray_3D, _validate_boolean, _validate_number def evaluate_sht_filters(M_mic2sh, H_array, fs, Y_grid, w_grid=None, plot=False): """ Evaluate frequency-dependent performance of SHT filters. Parameters ---------- M_mic2sh : ndarray SHT filtering matrix produced by one of the methods included in the library. Dimension = ( (order+1)^2, nMics, nBins ). H_array : ndarray, dtype = 'complex' Modeled or measured spherical array responses in a dense grid of `nGrid` directions. Dimension = ( nBins, nMics, nGrid ). fs : int Target sampling rate. Y_grid : ndarray Spherical harmonics matrix for the `nGrid` directions of the evaluation grid. Dimension = ( nGrid, (order+1)^2 ). w_grid : ndarray, optional Vector of integration weights for the grid points. Dimension = ( nGrid ). plot : bool, optional Plot responses. Default to false. Returns ------- cSH : ndarray, dtype = 'complex' Spatial correlation coefficient, for each SHT order and frequency bin. Dimension = ( nBins, order+1 ). lSH : ndarray Level difference, for each SHT order, for each SHT order and frequency bin. Dimension = ( nBins, order+1 ). WNG : ndarray Maximum amplification of all output SH components. Dimension = ( nBins ). Raises ----- TypeError, ValueError: if method arguments mismatch in type, dimension or value. Notes ----- The SHT filters can be evaluated in terms of how ideal are the SH components that they generate. The evaluation here follows the metrics introduced in Moreau, S., Daniel, J., Bertet, S., 2006, `3D sound field recording with higher order ambisonics-objectiv measurements and validation of spherical microphone.` In Audio Engineering Society Convention 120. These are a) the spatial correlation coefficient between each ideal spherical harmonic and the reconstructed pattern, evaluated at a dense grid of directions, b) level difference between the mean spatial power of the reconstructed pattern (diffuse power) over the one from an ideal SH component. Ideally, correlaiton should be close to one, and the level difference should be close to 0dB. Additionally, the maximum amplification of all output SH components is evaluated, through the maximum eigenvalue of the filtering matrix. Due to the matrix nature of computations, the minimum valid value for `nMics` and `nGrid` is 2. """ _validate_ndarray_3D('M_mic2sh', M_mic2sh) n_sh = M_mic2sh.shape[0] order_sht = int(np.sqrt(n_sh) - 1) nMics = M_mic2sh.shape[1] _validate_number('nMics', nMics, limit=[2, np.inf]) nBins = M_mic2sh.shape[2] _validate_ndarray_3D('H_array', H_array, shape0=nBins, shape1=nMics) nGrid = H_array.shape[2] _validate_number('nGrid', nGrid, limit=[2, np.inf]) _validate_ndarray_2D('Y_grid', Y_grid, shape0=nGrid, shape1=n_sh) if w_grid is None: w_grid = 1/nGrid*np.ones(nGrid) _validate_ndarray_1D('w_grid', w_grid, size=nGrid) _validate_int('fs', fs, positive=True) if plot is not None: _validate_boolean('plot', plot) nFFT = 2 * (nBins - 1) f = np.arange(nFFT // 2 + 1) * fs / nFFT # Compute spatial correlations and integrated level difference between # ideal and reconstructed harmonics cSH = np.empty((nBins, order_sht+1), dtype='complex') lSH = np.empty((nBins, order_sht+1)) # rSH = np.empty((nBins, order_sht+1)) for kk in range(nBins): H_kk = H_array[kk,:,:] y_recon_kk = np.matmul(M_mic2sh[:,:, kk], H_kk) for n in range(order_sht+1): cSH_n = 0 # spatial correlation (mean per order) lSH_n = 0 # diffuse level difference (mean per order) # rSH_n = 0 # mean level difference (mean per order) for m in range(-n, n+1): q = np.power(n, 2) + n + m y_recon_nm = y_recon_kk[q,:].T y_ideal_nm = Y_grid[:, q] cSH_nm = np.matmul((y_recon_nm * w_grid).conj(), y_ideal_nm) / np.sqrt( np.matmul((y_recon_nm*w_grid).conj(), y_recon_nm )) cSH_n = cSH_n + cSH_nm lSH_nm = np.real(np.matmul((y_recon_nm * w_grid).conj(), y_recon_nm )) lSH_n = lSH_n + lSH_nm # rSH_nm = np.sum(np.power(np.abs(y_recon_nm - y_ideal_nm), 2) * w_grid) # rSH_n = rSH_n + rSH_nm; cSH[kk, n] = cSH_n / (2 * n + 1) lSH[kk, n] = lSH_n / (2 * n + 1) # rSH[kk, n] = rSH_n / (2 * n + 1) # Maximum noise amplification of all filters in matrix WNG = np.empty(nBins) for kk in range(nBins): # TODO: Matlab implementation warns when M matrix is complex, e.g. TEST_SCRIPTS l. 191-199 # Avoid ComplexWarning: imaginary parts appearing due to numerical precission eigM = np.real(np.linalg.eigvals(np.matmul(M_mic2sh[:,:,kk].T.conj(), M_mic2sh[:,:,kk]))) WNG[kk] = np.max(eigM) # Plots if plot: str_legend = [None]*(order_sht+1) for n in range(order_sht+1): str_legend[n] = str(n) plt.figure() plt.subplot(311) plt.semilogx(f, np.abs(cSH)) plt.grid() plt.legend(str_legend) plt.axis([50, 20000, 0, 1]) plt.title('Spatial correlation') plt.subplot(312) plt.semilogx(f, 10 * np.log10(lSH)) plt.grid() plt.legend(str_legend) plt.axis([50, 20000, -30, 10]) plt.title('Level correlation') plt.subplot(313) plt.semilogx(f, 10 * np.log10(WNG)) plt.grid() plt.xlim([50, 20000]) plt.title('Maximum amplification') plt.xlabel('Frequency (Hz)') # plt.subplot(414) # plt.semilogx(f, 10 * np.log10(rSH)) # plt.grid() # plt.xlim([50, 20000]) # plt.title('MSE') # plt.xlabel('Frequency (Hz)') plt.show() return cSH, lSH, WNG
[ 2, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 198, 2, 198, 2, 15069, 357, 66, 8, 13130, 11, 412, 495, 9246, 1220, 15958, 37, 198, 2, 1439, 2489, 10395, 13, 198, 2, 198, 2, 2297, 396, 3890, 290, 779, 287, 2723, 290, 13934, 5107, 11, 351, 393, 1231, 198, 2, 17613, 11, 389, 10431, 2810, 326, 262, 1708, 3403, 389, 1138, 25, 198, 2, 220, 220, 220, 220, 1635, 2297, 396, 2455, 507, 286, 2723, 2438, 1276, 12377, 262, 2029, 6634, 198, 2, 220, 220, 220, 220, 220, 220, 4003, 11, 428, 1351, 286, 3403, 290, 262, 1708, 37592, 13, 198, 2, 220, 220, 220, 220, 1635, 2297, 396, 2455, 507, 287, 13934, 1296, 1276, 22919, 262, 2029, 6634, 198, 2, 220, 220, 220, 220, 220, 220, 4003, 11, 428, 1351, 286, 3403, 290, 262, 1708, 37592, 287, 262, 198, 2, 220, 220, 220, 220, 220, 220, 10314, 290, 14, 273, 584, 5696, 2810, 351, 262, 6082, 13, 198, 2, 220, 220, 220, 220, 1635, 16126, 262, 1438, 286, 262, 1279, 9971, 1634, 29, 4249, 262, 198, 2, 220, 220, 220, 220, 220, 220, 3891, 286, 663, 20420, 743, 307, 973, 284, 11438, 393, 7719, 3186, 198, 2, 220, 220, 220, 220, 220, 220, 10944, 422, 428, 3788, 1231, 2176, 3161, 3194, 7170, 13, 198, 2, 198, 2, 12680, 47466, 3180, 36592, 2389, 1961, 11050, 3336, 27975, 38162, 9947, 367, 15173, 4877, 5357, 27342, 9865, 3843, 20673, 366, 1921, 3180, 1, 5357, 198, 2, 15529, 7788, 32761, 6375, 8959, 49094, 34764, 11015, 11, 47783, 2751, 11, 21728, 5626, 40880, 5390, 11, 3336, 8959, 49094, 198, 2, 34764, 11015, 3963, 34482, 3398, 1565, 5603, 25382, 5357, 376, 46144, 7473, 317, 16652, 2149, 37232, 33079, 48933, 15986, 198, 2, 13954, 48778, 1961, 13, 3268, 8005, 49261, 50163, 1279, 34, 3185, 38162, 9947, 49707, 14418, 29, 9348, 43031, 19146, 7473, 15529, 198, 2, 42242, 11, 3268, 17931, 23988, 11, 19387, 25256, 1847, 11, 38846, 11, 7788, 3620, 6489, 13153, 11, 6375, 7102, 5188, 10917, 3525, 12576, 29506, 25552, 198, 2, 357, 1268, 39149, 2751, 11, 21728, 5626, 40880, 5390, 11, 41755, 11335, 10979, 3963, 28932, 2257, 2043, 37780, 21090, 50, 6375, 49254, 26, 198, 2, 406, 18420, 3963, 23210, 11, 42865, 11, 6375, 4810, 19238, 29722, 26, 6375, 43949, 44180, 23255, 49, 8577, 24131, 8, 29630, 36, 5959, 7257, 2937, 1961, 5357, 198, 2, 6177, 15529, 3336, 15513, 3963, 43031, 25382, 11, 7655, 2767, 16879, 3268, 27342, 10659, 11, 19269, 18379, 43031, 25382, 11, 6375, 309, 9863, 198, 2, 357, 1268, 39149, 2751, 399, 7156, 43, 3528, 18310, 6375, 25401, 54, 24352, 8, 5923, 1797, 2751, 3268, 15529, 34882, 16289, 3963, 3336, 23210, 3963, 12680, 198, 2, 47466, 11, 45886, 16876, 5984, 29817, 1961, 3963, 3336, 28069, 11584, 25382, 3963, 13558, 3398, 29506, 11879, 13, 198, 2, 198, 2, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 198, 2, 198, 2, 220, 220, 2488, 7753, 220, 220, 13446, 62, 1477, 83, 62, 10379, 1010, 13, 9078, 198, 2, 220, 220, 2488, 9800, 843, 81, 20954, 350, 2634, 21107, 12, 43, 10205, 46057, 198, 2, 220, 220, 2488, 4475, 220, 220, 5534, 14, 940, 14, 23344, 198, 2, 198, 2, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303, 198, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 285, 5126, 13, 12102, 378, 62, 7890, 62, 19199, 1330, 4808, 12102, 378, 62, 600, 11, 4808, 12102, 378, 62, 358, 18747, 62, 16, 35, 11, 3467, 198, 220, 220, 220, 4808, 12102, 378, 62, 358, 18747, 62, 17, 35, 11, 4808, 12102, 378, 62, 358, 18747, 62, 18, 35, 11, 4808, 12102, 378, 62, 2127, 21052, 11, 4808, 12102, 378, 62, 17618, 628, 198, 4299, 13446, 62, 1477, 83, 62, 10379, 1010, 7, 44, 62, 9383, 17, 1477, 11, 367, 62, 18747, 11, 43458, 11, 575, 62, 25928, 11, 266, 62, 25928, 28, 14202, 11, 7110, 28, 25101, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 26439, 4985, 8373, 12, 21186, 2854, 286, 6006, 51, 16628, 13, 628, 220, 220, 220, 40117, 198, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 337, 62, 9383, 17, 1477, 1058, 299, 67, 18747, 198, 220, 220, 220, 220, 220, 220, 220, 6006, 51, 25431, 17593, 4635, 416, 530, 286, 262, 5050, 3017, 287, 262, 5888, 13, 198, 220, 220, 220, 220, 220, 220, 220, 34024, 796, 357, 357, 2875, 10, 16, 8, 61, 17, 11, 299, 44, 873, 11, 299, 33, 1040, 6739, 198, 220, 220, 220, 367, 62, 18747, 1058, 299, 67, 18747, 11, 288, 4906, 796, 705, 41887, 6, 198, 220, 220, 220, 220, 220, 220, 220, 220, 9104, 276, 393, 8630, 43180, 7177, 9109, 287, 257, 15715, 10706, 286, 4600, 77, 41339, 63, 11678, 13, 198, 220, 220, 220, 220, 220, 220, 220, 34024, 796, 357, 299, 33, 1040, 11, 299, 44, 873, 11, 299, 41339, 6739, 198, 220, 220, 220, 43458, 1058, 493, 198, 220, 220, 220, 220, 220, 220, 220, 12744, 19232, 2494, 13, 198, 220, 220, 220, 575, 62, 25928, 1058, 299, 67, 18747, 198, 220, 220, 220, 220, 220, 220, 220, 1338, 37910, 25625, 873, 17593, 329, 262, 4600, 77, 41339, 63, 11678, 286, 262, 12660, 10706, 13, 198, 220, 220, 220, 220, 220, 220, 220, 34024, 796, 357, 299, 41339, 11, 357, 2875, 10, 16, 8, 61, 17, 6739, 198, 220, 220, 220, 266, 62, 25928, 1058, 299, 67, 18747, 11, 11902, 198, 220, 220, 220, 220, 220, 220, 220, 20650, 286, 11812, 19590, 329, 262, 10706, 2173, 13, 198, 220, 220, 220, 220, 220, 220, 220, 34024, 796, 357, 299, 41339, 6739, 198, 220, 220, 220, 7110, 1058, 20512, 11, 11902, 198, 220, 220, 220, 220, 220, 220, 220, 28114, 9109, 13, 15161, 284, 3991, 13, 628, 220, 220, 220, 16409, 198, 220, 220, 220, 35656, 198, 220, 220, 220, 269, 9693, 1058, 299, 67, 18747, 11, 288, 4906, 796, 705, 41887, 6, 198, 220, 220, 220, 220, 220, 220, 220, 1338, 34961, 16096, 35381, 11, 329, 1123, 6006, 51, 1502, 290, 8373, 9874, 13, 198, 220, 220, 220, 220, 220, 220, 220, 34024, 796, 357, 299, 33, 1040, 11, 1502, 10, 16, 6739, 198, 220, 220, 220, 300, 9693, 1058, 299, 67, 18747, 198, 220, 220, 220, 220, 220, 220, 220, 5684, 3580, 11, 329, 1123, 6006, 51, 1502, 11, 329, 1123, 6006, 51, 1502, 290, 8373, 9874, 13, 198, 220, 220, 220, 220, 220, 220, 220, 34024, 796, 357, 299, 33, 1040, 11, 1502, 10, 16, 6739, 198, 220, 220, 220, 370, 10503, 1058, 299, 67, 18747, 198, 220, 220, 220, 220, 220, 220, 220, 22246, 50250, 286, 477, 5072, 6006, 6805, 13, 198, 220, 220, 220, 220, 220, 220, 220, 34024, 796, 357, 299, 33, 1040, 6739, 628, 220, 220, 220, 7567, 2696, 198, 220, 220, 220, 37404, 198, 220, 220, 220, 5994, 12331, 11, 11052, 12331, 25, 611, 2446, 7159, 46318, 287, 2099, 11, 15793, 393, 1988, 13, 628, 220, 220, 220, 11822, 198, 220, 220, 220, 37404, 198, 220, 220, 220, 383, 6006, 51, 16628, 460, 307, 16726, 287, 2846, 286, 703, 7306, 389, 262, 6006, 198, 220, 220, 220, 6805, 326, 484, 7716, 13, 383, 12660, 994, 5679, 262, 20731, 198, 220, 220, 220, 5495, 287, 628, 220, 220, 220, 220, 220, 220, 220, 3125, 559, 11, 311, 1539, 7806, 11, 449, 1539, 22108, 316, 11, 311, 1539, 4793, 11, 198, 220, 220, 220, 220, 220, 220, 220, 4600, 18, 35, 2128, 2214, 8296, 351, 2440, 1502, 4915, 1653, 873, 12, 15252, 452, 198, 220, 220, 220, 220, 220, 220, 220, 13871, 290, 21201, 286, 43180, 21822, 13, 63, 198, 220, 220, 220, 220, 220, 220, 220, 554, 13491, 14044, 7023, 11680, 7982, 13, 628, 220, 220, 220, 2312, 389, 257, 8, 262, 21739, 16096, 35381, 1022, 1123, 7306, 198, 220, 220, 220, 43180, 49239, 290, 262, 49594, 3912, 11, 16726, 379, 257, 15715, 198, 220, 220, 220, 10706, 286, 11678, 11, 275, 8, 1241, 3580, 1022, 262, 1612, 21739, 1176, 198, 220, 220, 220, 286, 262, 49594, 3912, 357, 26069, 1904, 1176, 8, 625, 262, 530, 422, 281, 7306, 198, 220, 220, 220, 6006, 7515, 13, 40067, 11, 10895, 4548, 261, 815, 307, 1969, 284, 530, 11, 290, 262, 198, 220, 220, 220, 1241, 3580, 815, 307, 1969, 284, 657, 36077, 13, 628, 220, 220, 220, 12032, 11, 262, 5415, 50250, 286, 477, 5072, 6006, 6805, 318, 198, 220, 220, 220, 16726, 11, 832, 262, 5415, 304, 9324, 8367, 286, 262, 25431, 17593, 13, 628, 220, 220, 220, 14444, 284, 262, 17593, 3450, 286, 2653, 602, 11, 198, 220, 220, 220, 262, 5288, 4938, 1988, 329, 4600, 77, 44, 873, 63, 290, 4600, 77, 41339, 63, 318, 362, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 4808, 12102, 378, 62, 358, 18747, 62, 18, 35, 10786, 44, 62, 9383, 17, 1477, 3256, 337, 62, 9383, 17, 1477, 8, 198, 220, 220, 220, 299, 62, 1477, 796, 337, 62, 9383, 17, 1477, 13, 43358, 58, 15, 60, 198, 220, 220, 220, 1502, 62, 1477, 83, 796, 493, 7, 37659, 13, 31166, 17034, 7, 77, 62, 1477, 8, 532, 352, 8, 198, 220, 220, 220, 299, 44, 873, 796, 337, 62, 9383, 17, 1477, 13, 43358, 58, 16, 60, 198, 220, 220, 220, 4808, 12102, 378, 62, 17618, 10786, 77, 44, 873, 3256, 299, 44, 873, 11, 4179, 41888, 17, 11, 45941, 13, 10745, 12962, 198, 220, 220, 220, 299, 33, 1040, 796, 337, 62, 9383, 17, 1477, 13, 43358, 58, 17, 60, 628, 220, 220, 220, 4808, 12102, 378, 62, 358, 18747, 62, 18, 35, 10786, 39, 62, 18747, 3256, 367, 62, 18747, 11, 5485, 15, 28, 77, 33, 1040, 11, 5485, 16, 28, 77, 44, 873, 8, 198, 220, 220, 220, 299, 41339, 796, 367, 62, 18747, 13, 43358, 58, 17, 60, 198, 220, 220, 220, 4808, 12102, 378, 62, 17618, 10786, 77, 41339, 3256, 299, 41339, 11, 4179, 41888, 17, 11, 45941, 13, 10745, 12962, 628, 220, 220, 220, 4808, 12102, 378, 62, 358, 18747, 62, 17, 35, 10786, 56, 62, 25928, 3256, 575, 62, 25928, 11, 5485, 15, 28, 77, 41339, 11, 5485, 16, 28, 77, 62, 1477, 8, 628, 220, 220, 220, 611, 266, 62, 25928, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 266, 62, 25928, 796, 352, 14, 77, 41339, 9, 37659, 13, 1952, 7, 77, 41339, 8, 198, 220, 220, 220, 4808, 12102, 378, 62, 358, 18747, 62, 16, 35, 10786, 86, 62, 25928, 3256, 266, 62, 25928, 11, 2546, 28, 77, 41339, 8, 628, 220, 220, 220, 4808, 12102, 378, 62, 600, 10786, 9501, 3256, 43458, 11, 3967, 28, 17821, 8, 198, 220, 220, 220, 611, 7110, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 4808, 12102, 378, 62, 2127, 21052, 10786, 29487, 3256, 7110, 8, 628, 220, 220, 220, 299, 5777, 51, 796, 362, 1635, 357, 77, 33, 1040, 532, 352, 8, 198, 220, 220, 220, 277, 796, 45941, 13, 283, 858, 7, 77, 5777, 51, 3373, 362, 1343, 352, 8, 1635, 43458, 1220, 299, 5777, 51, 628, 220, 220, 220, 1303, 3082, 1133, 21739, 35811, 290, 11521, 1241, 3580, 1022, 198, 220, 220, 220, 1303, 7306, 290, 49594, 25625, 873, 198, 220, 220, 220, 269, 9693, 796, 45941, 13, 28920, 19510, 77, 33, 1040, 11, 1502, 62, 1477, 83, 10, 16, 828, 288, 4906, 11639, 41887, 11537, 198, 220, 220, 220, 300, 9693, 796, 45941, 13, 28920, 19510, 77, 33, 1040, 11, 1502, 62, 1477, 83, 10, 16, 4008, 198, 220, 220, 220, 1303, 374, 9693, 796, 45941, 13, 28920, 19510, 77, 33, 1040, 11, 1502, 62, 1477, 83, 10, 16, 4008, 198, 220, 220, 220, 329, 479, 74, 287, 2837, 7, 77, 33, 1040, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 367, 62, 28747, 796, 367, 62, 18747, 58, 28747, 11, 45299, 47715, 198, 220, 220, 220, 220, 220, 220, 220, 331, 62, 260, 1102, 62, 28747, 796, 45941, 13, 6759, 76, 377, 7, 44, 62, 9383, 17, 1477, 58, 45299, 45299, 479, 74, 4357, 367, 62, 28747, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 299, 287, 2837, 7, 2875, 62, 1477, 83, 10, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 9693, 62, 77, 796, 657, 220, 1303, 21739, 16096, 357, 32604, 583, 1502, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 300, 9693, 62, 77, 796, 657, 220, 1303, 42864, 1241, 3580, 357, 32604, 583, 1502, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 374, 9693, 62, 77, 796, 657, 220, 1303, 1612, 1241, 3580, 357, 32604, 583, 1502, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 285, 287, 2837, 32590, 77, 11, 299, 10, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10662, 796, 45941, 13, 6477, 7, 77, 11, 362, 8, 1343, 299, 1343, 285, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 260, 1102, 62, 21533, 796, 331, 62, 260, 1102, 62, 28747, 58, 80, 11, 25, 4083, 51, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 62, 485, 282, 62, 21533, 796, 575, 62, 25928, 58, 45299, 10662, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 9693, 62, 21533, 796, 45941, 13, 6759, 76, 377, 19510, 88, 62, 260, 1102, 62, 21533, 1635, 266, 62, 25928, 737, 1102, 73, 22784, 331, 62, 485, 282, 62, 21533, 8, 1220, 45941, 13, 31166, 17034, 7, 45941, 13, 6759, 76, 377, 19510, 88, 62, 260, 1102, 62, 21533, 9, 86, 62, 25928, 737, 1102, 73, 22784, 331, 62, 260, 1102, 62, 21533, 15306, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 9693, 62, 77, 796, 269, 9693, 62, 77, 1343, 269, 9693, 62, 21533, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 300, 9693, 62, 21533, 796, 45941, 13, 5305, 7, 37659, 13, 6759, 76, 377, 19510, 88, 62, 260, 1102, 62, 21533, 1635, 266, 62, 25928, 737, 1102, 73, 22784, 331, 62, 260, 1102, 62, 21533, 15306, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 300, 9693, 62, 77, 796, 300, 9693, 62, 77, 1343, 300, 9693, 62, 21533, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 374, 9693, 62, 21533, 796, 45941, 13, 16345, 7, 37659, 13, 6477, 7, 37659, 13, 8937, 7, 88, 62, 260, 1102, 62, 21533, 532, 331, 62, 485, 282, 62, 21533, 828, 362, 8, 1635, 266, 62, 25928, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 374, 9693, 62, 77, 796, 374, 9693, 62, 77, 1343, 374, 9693, 62, 21533, 26, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 269, 9693, 58, 28747, 11, 299, 60, 796, 269, 9693, 62, 77, 1220, 357, 17, 1635, 299, 1343, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 300, 9693, 58, 28747, 11, 299, 60, 796, 300, 9693, 62, 77, 1220, 357, 17, 1635, 299, 1343, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 374, 9693, 58, 28747, 11, 299, 60, 796, 374, 9693, 62, 77, 1220, 357, 17, 1635, 299, 1343, 352, 8, 628, 220, 220, 220, 1303, 22246, 7838, 50250, 286, 477, 16628, 287, 17593, 198, 220, 220, 220, 370, 10503, 796, 45941, 13, 28920, 7, 77, 33, 1040, 8, 198, 220, 220, 220, 329, 479, 74, 287, 2837, 7, 77, 33, 1040, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 16926, 46, 25, 6550, 23912, 7822, 22145, 618, 337, 17593, 318, 3716, 11, 304, 13, 70, 13, 43001, 62, 6173, 32618, 4694, 300, 13, 31009, 12, 19104, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 24390, 19157, 20361, 25, 26726, 3354, 12655, 2233, 284, 29052, 3718, 1480, 198, 220, 220, 220, 220, 220, 220, 220, 304, 328, 44, 796, 45941, 13, 5305, 7, 37659, 13, 75, 1292, 70, 13, 68, 328, 12786, 7, 37659, 13, 6759, 76, 377, 7, 44, 62, 9383, 17, 1477, 58, 45299, 45299, 28747, 4083, 51, 13, 1102, 73, 22784, 337, 62, 9383, 17, 1477, 58, 45299, 45299, 28747, 60, 22305, 198, 220, 220, 220, 220, 220, 220, 220, 370, 10503, 58, 28747, 60, 796, 45941, 13, 9806, 7, 68, 328, 44, 8, 628, 220, 220, 220, 1303, 1345, 1747, 198, 220, 220, 220, 611, 7110, 25, 198, 220, 220, 220, 220, 220, 220, 220, 965, 62, 1455, 437, 796, 685, 14202, 60, 9, 7, 2875, 62, 1477, 83, 10, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 329, 299, 287, 2837, 7, 2875, 62, 1477, 83, 10, 16, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 965, 62, 1455, 437, 58, 77, 60, 796, 965, 7, 77, 8, 628, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 26875, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 7266, 29487, 7, 36244, 8, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 325, 25433, 519, 87, 7, 69, 11, 45941, 13, 8937, 7, 66, 9693, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 25928, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 1455, 437, 7, 2536, 62, 1455, 437, 8, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 22704, 26933, 1120, 11, 939, 405, 11, 657, 11, 352, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 7839, 10786, 4561, 34961, 16096, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 7266, 29487, 7, 27970, 8, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 325, 25433, 519, 87, 7, 69, 11, 838, 1635, 45941, 13, 6404, 940, 7, 75, 9693, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 25928, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 1455, 437, 7, 2536, 62, 1455, 437, 8, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 22704, 26933, 1120, 11, 939, 405, 11, 532, 1270, 11, 838, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 7839, 10786, 4971, 16096, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 7266, 29487, 7, 25838, 8, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 325, 25433, 519, 87, 7, 69, 11, 838, 1635, 45941, 13, 6404, 940, 7, 54, 10503, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 25928, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 87, 2475, 26933, 1120, 11, 939, 405, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 7839, 10786, 40541, 50250, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 87, 18242, 10786, 37, 28707, 357, 7399, 8, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 458, 83, 13, 7266, 29487, 7, 37309, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 458, 83, 13, 325, 25433, 519, 87, 7, 69, 11, 838, 1635, 45941, 13, 6404, 940, 7, 81, 9693, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 458, 83, 13, 25928, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 458, 83, 13, 87, 2475, 26933, 1120, 11, 939, 405, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 458, 83, 13, 7839, 10786, 44, 5188, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 458, 83, 13, 87, 18242, 10786, 37, 28707, 357, 7399, 8, 11537, 628, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 12860, 3419, 628, 220, 220, 220, 1441, 269, 9693, 11, 300, 9693, 11, 370, 10503, 198 ]
2.356299
3,469
import pandas as pd import sys import math import requests
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 25064, 198, 11748, 10688, 198, 11748, 7007 ]
3.866667
15
""" Given a linked list, find the first node of a cycle in it. 1 -> 2 -> 3 -> 4 -> 5 -> 1 => 1 A -> B -> C -> D -> E -> C => C Note: The solution is a direct implementation Floyd's cycle-finding algorithm (Floyd's Tortoise and Hare). """ def firstCyclicNode(head): """ :type head: Node :rtype: Node """ runner = walker = head while runner and runner.next: runner = runner.next.next walker = walker.next if runner is walker: break if runner is None or runner.next is None: return None walker = head while runner is not walker: runner, walker = runner.next, walker.next return runner
[ 37811, 198, 220, 220, 220, 11259, 257, 6692, 1351, 11, 1064, 262, 717, 10139, 286, 257, 6772, 287, 340, 13, 198, 220, 220, 220, 352, 4613, 362, 4613, 513, 4613, 604, 4613, 642, 4613, 352, 220, 5218, 352, 198, 220, 220, 220, 317, 4613, 347, 4613, 327, 4613, 360, 4613, 412, 4613, 327, 220, 5218, 327, 628, 220, 220, 220, 5740, 25, 383, 4610, 318, 257, 1277, 7822, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 21150, 338, 6772, 12, 41070, 11862, 357, 7414, 12192, 338, 28467, 25678, 290, 42285, 737, 198, 37811, 628, 198, 4299, 717, 20418, 565, 291, 19667, 7, 2256, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1058, 4906, 1182, 25, 19081, 198, 220, 220, 220, 1058, 81, 4906, 25, 19081, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 17490, 796, 2513, 263, 796, 1182, 198, 220, 220, 220, 981, 17490, 290, 17490, 13, 19545, 25, 198, 220, 220, 220, 220, 220, 220, 220, 17490, 796, 17490, 13, 19545, 13, 19545, 198, 220, 220, 220, 220, 220, 220, 220, 2513, 263, 796, 2513, 263, 13, 19545, 198, 220, 220, 220, 220, 220, 220, 220, 611, 17490, 318, 2513, 263, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2270, 628, 220, 220, 220, 611, 17490, 318, 6045, 393, 17490, 13, 19545, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 6045, 628, 220, 220, 220, 2513, 263, 796, 1182, 198, 220, 220, 220, 981, 17490, 318, 407, 2513, 263, 25, 198, 220, 220, 220, 220, 220, 220, 220, 17490, 11, 2513, 263, 796, 17490, 13, 19545, 11, 2513, 263, 13, 19545, 198, 220, 220, 220, 1441, 17490, 198 ]
2.489437
284
#! /usr/bin/python import serial import time import requests import datetime import thread import time bluetoothSerial = serial.Serial( "/dev/tty.HC-06-DevB", baudrate=9600 ) serverIP = "localhost" serverPort = "8080" publisherEndpoint = "/ConnectedDevices/pushdata" #"/pushdata/{ip}/{owner}/{type}/{mac}/{time}/{pin}/{value}") deviceIP = "/192.168.1.999" deviceOwner = "/SMEAN" deviceType = "/ArduinoUNO" deviceMAC = "/98:D3:31:80:38:D3" publisherEndpoint = "http://" + serverIP + ":" + serverPort + publisherEndpoint + deviceIP + deviceOwner + deviceType + deviceMAC + "/" import termios, fcntl, sys, os if __name__=='__main__': main()
[ 2, 0, 1220, 14629, 14, 8800, 14, 29412, 198, 11748, 11389, 198, 11748, 640, 198, 11748, 7007, 198, 11748, 4818, 8079, 198, 11748, 4704, 198, 11748, 640, 198, 198, 65, 2290, 16271, 32634, 796, 11389, 13, 32634, 7, 12813, 7959, 14, 42852, 13, 16045, 12, 3312, 12, 13603, 33, 1600, 275, 3885, 4873, 28, 4846, 405, 1267, 628, 198, 15388, 4061, 796, 366, 36750, 1, 198, 15388, 13924, 796, 366, 1795, 1795, 1, 198, 12984, 8191, 12915, 4122, 796, 12813, 13313, 276, 13603, 1063, 14, 14689, 7890, 1, 198, 198, 2, 1, 14, 14689, 7890, 14, 90, 541, 92, 14, 90, 18403, 92, 14, 90, 4906, 92, 14, 90, 20285, 92, 14, 90, 2435, 92, 14, 90, 11635, 92, 14, 90, 8367, 92, 4943, 198, 25202, 4061, 796, 12813, 17477, 13, 14656, 13, 16, 13, 17032, 1, 198, 25202, 42419, 796, 12813, 50, 11682, 1565, 1, 198, 25202, 6030, 796, 12813, 3163, 24493, 4944, 46, 1, 198, 25202, 44721, 796, 12813, 4089, 25, 35, 18, 25, 3132, 25, 1795, 25, 2548, 25, 35, 18, 1, 198, 198, 12984, 8191, 12915, 4122, 796, 366, 4023, 1378, 1, 1343, 4382, 4061, 1343, 366, 11097, 1343, 4382, 13924, 1343, 9991, 12915, 4122, 1343, 3335, 4061, 1343, 3335, 42419, 1343, 3335, 6030, 1343, 3335, 44721, 1343, 12813, 1, 628, 198, 198, 11748, 3381, 4267, 11, 277, 66, 429, 75, 11, 25064, 11, 28686, 628, 198, 197, 198, 197, 198, 197, 197, 198, 198, 361, 11593, 3672, 834, 855, 6, 834, 12417, 834, 10354, 198, 220, 220, 220, 220, 220, 220, 220, 1388, 3419, 198 ]
2.553846
260
#### # This sample is published as part of the blog article at www.toptal.com/blog # Visit www.toptal.com/blog and subscribe to our newsletter to read great posts #### import logging import os from concurrent.futures import ThreadPoolExecutor from functools import partial from time import time from download import setup_download_dir, get_links, download_link logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) if __name__ == '__main__': main()
[ 4242, 198, 2, 770, 6291, 318, 3199, 355, 636, 286, 262, 4130, 2708, 379, 7324, 13, 4852, 39240, 13, 785, 14, 14036, 198, 2, 16440, 7324, 13, 4852, 39240, 13, 785, 14, 14036, 290, 12383, 284, 674, 13129, 284, 1100, 1049, 6851, 198, 4242, 198, 198, 11748, 18931, 198, 11748, 28686, 198, 6738, 24580, 13, 69, 315, 942, 1330, 14122, 27201, 23002, 38409, 198, 6738, 1257, 310, 10141, 1330, 13027, 198, 6738, 640, 1330, 640, 198, 198, 6738, 4321, 1330, 9058, 62, 15002, 62, 15908, 11, 651, 62, 28751, 11, 4321, 62, 8726, 198, 198, 6404, 2667, 13, 35487, 16934, 7, 5715, 28, 6404, 2667, 13, 10778, 11, 5794, 11639, 4, 7, 292, 310, 524, 8, 82, 532, 4064, 7, 3672, 8, 82, 532, 4064, 7, 5715, 3672, 8, 82, 532, 4064, 7, 20500, 8, 82, 11537, 198, 198, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419, 198 ]
3.174419
172
from django.utils import translation from django.core.exceptions import ObjectDoesNotExist from django.conf import settings from userena import settings as userena_settings from userena.compat import SiteProfileNotAvailable from userena.utils import get_user_profile class UserenaLocaleMiddleware(object): """ Set the language by looking at the language setting in the profile. It doesn't override the cookie that is set by Django so a user can still switch languages depending if the cookie is set. """
[ 6738, 42625, 14208, 13, 26791, 1330, 11059, 198, 6738, 42625, 14208, 13, 7295, 13, 1069, 11755, 1330, 9515, 13921, 3673, 3109, 396, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 198, 6738, 779, 918, 64, 1330, 6460, 355, 779, 918, 64, 62, 33692, 198, 6738, 779, 918, 64, 13, 5589, 265, 1330, 14413, 37046, 3673, 10493, 198, 6738, 779, 918, 64, 13, 26791, 1330, 651, 62, 7220, 62, 13317, 628, 198, 4871, 5765, 918, 64, 33711, 1000, 34621, 1574, 7, 15252, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 5345, 262, 3303, 416, 2045, 379, 262, 3303, 4634, 287, 262, 7034, 13, 628, 220, 220, 220, 632, 1595, 470, 20957, 262, 19751, 326, 318, 900, 416, 37770, 523, 257, 2836, 460, 991, 198, 220, 220, 220, 5078, 8950, 6906, 611, 262, 19751, 318, 900, 13, 628, 220, 220, 220, 37227, 198 ]
3.673611
144
""" First Three Words Write a program which asks the user to enter a sentence. Print the first three words in the sentence. (Assume the user enters at least 3 words.) """ sentence = input("Enter a sentence: ") words = sentence.split() for word in words[:3]: print(word)
[ 37811, 198, 5962, 7683, 23087, 198, 198, 16594, 257, 1430, 543, 7893, 198, 1169, 2836, 284, 3802, 257, 6827, 13, 198, 18557, 262, 717, 1115, 2456, 287, 262, 6827, 13, 198, 7, 8021, 2454, 262, 2836, 14170, 379, 1551, 513, 2456, 2014, 198, 37811, 198, 198, 34086, 594, 796, 5128, 7203, 17469, 257, 6827, 25, 366, 8, 198, 198, 10879, 796, 6827, 13, 35312, 3419, 198, 198, 1640, 1573, 287, 2456, 58, 25, 18, 5974, 198, 220, 220, 220, 3601, 7, 4775, 8, 198 ]
3.309524
84
# Generated by Django 2.2.5 on 2022-03-02 12:32 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 13, 20, 319, 33160, 12, 3070, 12, 2999, 1105, 25, 2624, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
#!/usr/bin/env python3 import datetime import os import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, GObject BASEDIR = os.path.dirname(os.path.abspath(__file__)) if __name__ == '__main__': win = StopWatch() icon_path = os.path.join(BASEDIR, 'stopwatch.png') win.set_icon_from_file(icon_path) win.connect('destroy', Gtk.main_quit) win.show_all() Gtk.main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 11748, 4818, 8079, 198, 11748, 28686, 198, 198, 11748, 308, 72, 198, 12397, 13, 46115, 62, 9641, 7203, 38, 30488, 1600, 366, 18, 13, 15, 4943, 198, 6738, 308, 72, 13, 260, 1930, 37765, 1330, 402, 30488, 11, 402, 10267, 198, 198, 33, 42827, 4663, 796, 28686, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 4008, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1592, 796, 13707, 10723, 3419, 198, 220, 220, 220, 7196, 62, 6978, 796, 28686, 13, 6978, 13, 22179, 7, 33, 42827, 4663, 11, 705, 11338, 8340, 13, 11134, 11537, 198, 220, 220, 220, 1592, 13, 2617, 62, 4749, 62, 6738, 62, 7753, 7, 4749, 62, 6978, 8, 198, 220, 220, 220, 1592, 13, 8443, 10786, 41659, 3256, 402, 30488, 13, 12417, 62, 47391, 8, 198, 220, 220, 220, 1592, 13, 12860, 62, 439, 3419, 198, 220, 220, 220, 402, 30488, 13, 12417, 3419, 198 ]
2.318182
176
# Generated by Django 3.0.6 on 2021-01-10 17:55 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 513, 13, 15, 13, 21, 319, 33448, 12, 486, 12, 940, 1596, 25, 2816, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
""" Student management module """ students = [] def get_student_title_case() -> str: """ Function to return student name in title case :return: student name """ students_title_case = [] for student in students: students_title_case.append(student["name"].title()) return students_title_case def print_students_title_case() -> None: """ Function to print student name using title case """ students_title_case = get_student_title_case() print(students_title_case) def add_student(name, stud_id=999): """ Function to add a student in the list :param name: student name :param stud_id: student id """ student = {"name": name, "id": stud_id} students.append(student) print("Student count is {0}".format(len(students))) def save_file(student): """ Function to save student information to the file :param student: student info """ try: student_file = open("students.txt", "a") student_file.write(student + "\n") student_file.close() except IOError: print("Could not save") def read_file(): """ Function to read student information file """ try: student_file = open("students.txt", "r") for student in student_file.readlines(): add_student(student) student_file.close() except IOError: print("Could not read") # ADD NEW STUDENT BLOCK student_list = get_student_title_case() add_student("Prasad", "101") # ADD NEW STUDENT VIA USER INPUT AND DISPLAY THE LIST student_name = input("Enter student name : ") student_id = input("Enter student id : ") add_student(student_name, student_id) # PRINT STUDENT DETAILS print_students_title_case() # USE BELOW CODE BLOCK IF YOU WANT TO ADD NEW STUDENT IN A LOOP ADD_NEW_STUDENT_FLAG: str = "" MESSAGE = "Do you want to add new student record?? Press [Y] / [y] to continue." ADD_NEW_STUDENT_FLAG = input(MESSAGE) while ADD_NEW_STUDENT_FLAG in ("Y", "y"): student_name = input("enter student name : ") student_id = input("enter student id : ") add_student(student_name, student_id) ADD_NEW_STUDENT_FLAG = input(MESSAGE) print_students_title_case() # READ FROM File read_file() print_students_title_case() # WRITE TO FILE print("writing to file...") student_name = input("enter student name : ") student_id = input("enter student id : ") add_student(student_name, student_id) save_file(student_name)
[ 37811, 201, 198, 38778, 4542, 8265, 201, 198, 37811, 201, 198, 19149, 658, 796, 17635, 201, 198, 201, 198, 201, 198, 4299, 651, 62, 50139, 62, 7839, 62, 7442, 3419, 4613, 965, 25, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 15553, 284, 1441, 3710, 1438, 287, 3670, 1339, 201, 198, 220, 220, 220, 1058, 7783, 25, 3710, 1438, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 2444, 62, 7839, 62, 7442, 796, 17635, 201, 198, 220, 220, 220, 329, 3710, 287, 2444, 25, 201, 198, 220, 220, 220, 220, 220, 220, 220, 2444, 62, 7839, 62, 7442, 13, 33295, 7, 50139, 14692, 3672, 1, 4083, 7839, 28955, 201, 198, 220, 220, 220, 1441, 2444, 62, 7839, 62, 7442, 201, 198, 201, 198, 201, 198, 4299, 3601, 62, 19149, 658, 62, 7839, 62, 7442, 3419, 4613, 6045, 25, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 15553, 284, 3601, 3710, 1438, 1262, 3670, 1339, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 2444, 62, 7839, 62, 7442, 796, 651, 62, 50139, 62, 7839, 62, 7442, 3419, 201, 198, 220, 220, 220, 3601, 7, 19149, 658, 62, 7839, 62, 7442, 8, 201, 198, 201, 198, 201, 198, 4299, 751, 62, 50139, 7, 3672, 11, 941, 62, 312, 28, 17032, 2599, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 15553, 284, 751, 257, 3710, 287, 262, 1351, 201, 198, 220, 220, 220, 1058, 17143, 1438, 25, 3710, 1438, 201, 198, 220, 220, 220, 1058, 17143, 941, 62, 312, 25, 3710, 4686, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 3710, 796, 19779, 3672, 1298, 1438, 11, 366, 312, 1298, 941, 62, 312, 92, 201, 198, 220, 220, 220, 2444, 13, 33295, 7, 50139, 8, 201, 198, 220, 220, 220, 3601, 7203, 38778, 954, 318, 1391, 15, 92, 1911, 18982, 7, 11925, 7, 19149, 658, 22305, 201, 198, 201, 198, 201, 198, 4299, 3613, 62, 7753, 7, 50139, 2599, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 15553, 284, 3613, 3710, 1321, 284, 262, 2393, 201, 198, 220, 220, 220, 1058, 17143, 3710, 25, 3710, 7508, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 1949, 25, 201, 198, 220, 220, 220, 220, 220, 220, 220, 3710, 62, 7753, 796, 1280, 7203, 19149, 658, 13, 14116, 1600, 366, 64, 4943, 201, 198, 220, 220, 220, 220, 220, 220, 220, 3710, 62, 7753, 13, 13564, 7, 50139, 1343, 37082, 77, 4943, 201, 198, 220, 220, 220, 220, 220, 220, 220, 3710, 62, 7753, 13, 19836, 3419, 201, 198, 220, 220, 220, 2845, 24418, 12331, 25, 201, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 23722, 407, 3613, 4943, 201, 198, 201, 198, 201, 198, 4299, 1100, 62, 7753, 33529, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 15553, 284, 1100, 3710, 1321, 2393, 201, 198, 220, 220, 220, 37227, 201, 198, 220, 220, 220, 1949, 25, 201, 198, 220, 220, 220, 220, 220, 220, 220, 3710, 62, 7753, 796, 1280, 7203, 19149, 658, 13, 14116, 1600, 366, 81, 4943, 201, 198, 220, 220, 220, 220, 220, 220, 220, 329, 3710, 287, 3710, 62, 7753, 13, 961, 6615, 33529, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 751, 62, 50139, 7, 50139, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 3710, 62, 7753, 13, 19836, 3419, 201, 198, 220, 220, 220, 2845, 24418, 12331, 25, 201, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 23722, 407, 1100, 4943, 201, 198, 201, 198, 201, 198, 2, 27841, 12682, 49348, 3525, 9878, 11290, 201, 198, 50139, 62, 4868, 796, 651, 62, 50139, 62, 7839, 62, 7442, 3419, 201, 198, 2860, 62, 50139, 7203, 6836, 292, 324, 1600, 366, 8784, 4943, 201, 198, 201, 198, 2, 27841, 12682, 49348, 3525, 569, 3539, 1294, 1137, 3268, 30076, 5357, 13954, 31519, 3336, 39498, 201, 198, 50139, 62, 3672, 796, 5128, 7203, 17469, 3710, 1438, 1058, 366, 8, 201, 198, 50139, 62, 312, 796, 5128, 7203, 17469, 3710, 4686, 1058, 366, 8, 201, 198, 2860, 62, 50139, 7, 50139, 62, 3672, 11, 3710, 62, 312, 8, 201, 198, 201, 198, 2, 4810, 12394, 49348, 3525, 360, 20892, 45484, 201, 198, 4798, 62, 19149, 658, 62, 7839, 62, 7442, 3419, 201, 198, 201, 198, 2, 23210, 45339, 42714, 9878, 11290, 16876, 7013, 41300, 5390, 27841, 12682, 49348, 3525, 3268, 317, 17579, 3185, 201, 198, 29266, 62, 13965, 62, 2257, 8322, 3525, 62, 38948, 25, 965, 796, 13538, 201, 198, 44, 1546, 4090, 8264, 796, 366, 5211, 345, 765, 284, 751, 649, 3710, 1700, 3548, 4332, 685, 56, 60, 1220, 685, 88, 60, 284, 2555, 526, 201, 198, 29266, 62, 13965, 62, 2257, 8322, 3525, 62, 38948, 796, 5128, 7, 44, 1546, 4090, 8264, 8, 201, 198, 201, 198, 4514, 27841, 62, 13965, 62, 2257, 8322, 3525, 62, 38948, 287, 5855, 56, 1600, 366, 88, 1, 2599, 201, 198, 220, 220, 220, 3710, 62, 3672, 796, 5128, 7203, 9255, 3710, 1438, 1058, 366, 8, 201, 198, 220, 220, 220, 3710, 62, 312, 796, 5128, 7203, 9255, 3710, 4686, 1058, 366, 8, 201, 198, 220, 220, 220, 751, 62, 50139, 7, 50139, 62, 3672, 11, 3710, 62, 312, 8, 201, 198, 220, 220, 220, 27841, 62, 13965, 62, 2257, 8322, 3525, 62, 38948, 796, 5128, 7, 44, 1546, 4090, 8264, 8, 201, 198, 201, 198, 4798, 62, 19149, 658, 62, 7839, 62, 7442, 3419, 201, 198, 201, 198, 2, 20832, 16034, 9220, 201, 198, 961, 62, 7753, 3419, 201, 198, 4798, 62, 19149, 658, 62, 7839, 62, 7442, 3419, 201, 198, 201, 198, 2, 44423, 5390, 45811, 201, 198, 4798, 7203, 16502, 284, 2393, 9313, 8, 201, 198, 50139, 62, 3672, 796, 5128, 7203, 9255, 3710, 1438, 1058, 366, 8, 201, 198, 50139, 62, 312, 796, 5128, 7203, 9255, 3710, 4686, 1058, 366, 8, 201, 198, 2860, 62, 50139, 7, 50139, 62, 3672, 11, 3710, 62, 312, 8, 201, 198, 21928, 62, 7753, 7, 50139, 62, 3672, 8, 201, 198 ]
2.532083
1,013
import gym import numpy as np from ray.rllib.utils.annotations import PublicAPI @PublicAPI class Repeated(gym.Space): """Represents a variable-length list of child spaces. Example: self.observation_space = spaces.Repeated(spaces.Box(4,), max_len=10) --> from 0 to 10 boxes of shape (4,) See also: documentation for rllib.models.RepeatedValues, which shows how the lists are represented as batched input for ModelV2 classes. """
[ 11748, 11550, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 26842, 13, 81, 297, 571, 13, 26791, 13, 34574, 602, 1330, 5094, 17614, 628, 198, 31, 15202, 17614, 198, 4871, 30558, 515, 7, 1360, 76, 13, 14106, 2599, 198, 220, 220, 220, 37227, 6207, 6629, 257, 7885, 12, 13664, 1351, 286, 1200, 9029, 13, 628, 220, 220, 220, 17934, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 672, 3168, 341, 62, 13200, 796, 9029, 13, 47541, 515, 7, 2777, 2114, 13, 14253, 7, 19, 11, 828, 3509, 62, 11925, 28, 940, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 14610, 422, 657, 284, 838, 10559, 286, 5485, 357, 19, 35751, 628, 220, 220, 220, 4091, 635, 25, 10314, 329, 374, 297, 571, 13, 27530, 13, 47541, 515, 40161, 11, 543, 2523, 703, 198, 220, 220, 220, 220, 220, 220, 220, 262, 8341, 389, 7997, 355, 7365, 1740, 5128, 329, 9104, 53, 17, 6097, 13, 198, 220, 220, 220, 37227, 198 ]
2.822485
169
# common_features.py # Invoke on the command line like: python common_features.py pbtd # Outputs all features common to all of the given segments, to help # in rule writing. from tabulate import tabulate import csv import sys import os.path as path base_directory = path.dirname(path.dirname(path.abspath(__file__))) sys.path.append(base_directory) def load_segments(filename): '''Load a segment feature matrix from a CSV file, returning a list of dictionaries with information about each segment. ''' with open(filename, 'r') as f: return [segment for segment in csv.DictReader(f)] if __name__ == '__main__': main(sys.argv[1])
[ 2, 2219, 62, 40890, 13, 9078, 198, 2, 10001, 2088, 319, 262, 3141, 1627, 588, 25, 21015, 2219, 62, 40890, 13, 9078, 279, 65, 8671, 198, 2, 25235, 82, 477, 3033, 2219, 284, 477, 286, 262, 1813, 17894, 11, 284, 1037, 198, 2, 287, 3896, 3597, 13, 198, 198, 6738, 7400, 5039, 1330, 7400, 5039, 198, 11748, 269, 21370, 198, 11748, 25064, 198, 11748, 28686, 13, 6978, 355, 3108, 198, 198, 8692, 62, 34945, 796, 3108, 13, 15908, 3672, 7, 6978, 13, 15908, 3672, 7, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 22305, 198, 17597, 13, 6978, 13, 33295, 7, 8692, 62, 34945, 8, 628, 198, 4299, 3440, 62, 325, 11726, 7, 34345, 2599, 198, 220, 220, 220, 705, 7061, 8912, 257, 10618, 3895, 17593, 422, 257, 44189, 2393, 11, 8024, 257, 1351, 286, 198, 220, 220, 220, 48589, 3166, 351, 1321, 546, 1123, 10618, 13, 628, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 351, 1280, 7, 34345, 11, 705, 81, 11537, 355, 277, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 685, 325, 5154, 329, 10618, 287, 269, 21370, 13, 35, 713, 33634, 7, 69, 15437, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 7, 17597, 13, 853, 85, 58, 16, 12962, 198 ]
3.018182
220
#!/usr/bin/env python import time import sys # import the MUD server class from mudserver import MudServer, Event, EventType #prints to stderr VERBOSE_PRINT = False # structure defining the rooms in the game. Try adding more rooms to the game! rooms = { "Tavern": { "description": "You're in a cozy tavern warmed by an open fire.", "exits": {"outside": "Outside"}, }, "Outside": { "description": "You're standing outside a tavern. It's raining.", "exits": {"inside": "Tavern"}, } } # stores the players in the game players = {} # start the server mud = MudServer() # main game loop. We loop forever (i.e. until the program is terminated) while True: # pause for 1/5 of a second on each loop, so that we don't constantly # use 100% CPU time time.sleep(0.2) # 'update' must be called in the loop to keep the game running and give # us up-to-date information mud.update() # handle events on the server_queue while (len(mud.server_queue) > 0): event = mud.server_queue.popleft() err_print(event) id = event.id if event.type is EventType.PLAYER_JOIN: # add the new player to the dictionary, noting that they've not been # named yet. # The dictionary key is the player's id number. We set their room to # None initially until they have entered a name err_print("Player %s joined." % event.id) players[id] = { "name": None, "room": None, } #prompt the user for their name mud.send_message(id, "What is your name?") elif event.type is EventType.MESSAGE_RECEIVED: # splitting into command + params to make porting the code easier command, params = (event.message.split(" ", 1) + ["", ""])[:2] err_print(event.message) # all these elifs will be replaced with "character.parse([input])" if players[id]["name"] is None: players[id]["name"] = event.message.split(" ")[0] players[id]["room"] = "Tavern" for pid, pl in players.items(): # send each player a message to tell them about the new player mud.send_message(pid, "%s entered the game" % players[id]["name"]) mud.send_message(id, "Welcome to the game, %s. " % players[id]["name"] + "Type 'help' for a list of commands. Have fun!") # 'help' command elif command == "help": # send the player back the list of possible commands mud.send_message(id, "Commands:") mud.send_message(id, " say <message> - Says something out loud, " + "e.g. 'say Hello'") mud.send_message(id, " look - Examines the " + "surroundings, e.g. 'look'") mud.send_message(id, " go <exit> - Moves through the exit " + "specified, e.g. 'go outside'") # 'say' command elif command == "say": # go through every player in the game for pid, pl in players.items(): # if they're in the same room as the player if players[pid]["room"] == players[id]["room"]: # send them a message telling them what the player said mud.send_message(pid, "{} says: {}".format( players[id]["name"], params)) # 'look' command elif command == "look": # store the player's current room rm = rooms[players[id]["room"]] # send the player back the description of their current room mud.send_message(id, rm["description"]) playershere = [] # go through every player in the game for pid, pl in players.items(): # if they're in the same room as the player if players[pid]["room"] == players[id]["room"]: # ... and they have a name to be shown if players[pid]["name"] is not None: # add their name to the list playershere.append(players[pid]["name"]) # send player a message containing the list of players in the room mud.send_message(id, "Players here: {}".format( ", ".join(playershere))) # send player a message containing the list of exits from this room mud.send_message(id, "Exits are: {}".format( ", ".join(rm["exits"]))) # 'go' command elif command == "go": # store the exit name ex = params.lower() # store the player's current room rm = rooms[players[id]["room"]] # if the specified exit is found in the room's exits list if ex in rm["exits"]: # go through all the players in the game for pid, pl in players.items(): # if player is in the same room and isn't the player # sending the command if players[pid]["room"] == players[id]["room"] \ and pid != id: # send them a message telling them that the player # left the room mud.send_message(pid, "{} left via exit '{}'".format( players[id]["name"], ex)) # update the player's current room to the one the exit leads to players[id]["room"] = rm["exits"][ex] rm = rooms[players[id]["room"]] # go through all the players in the game for pid, pl in players.items(): # if player is in the same (new) room and isn't the player # sending the command if players[pid]["room"] == players[id]["room"] \ and pid != id: # send them a message telling them that the player # entered the room mud.send_message(pid, "{} arrived via exit '{}'".format( players[id]["name"], ex)) # send the player a message telling them where they are now mud.send_message(id, "You arrive at '{}'".format( players[id]["room"])) # the specified exit wasn't found in the current room else: # send back an 'unknown exit' message mud.send_message(id, "Unknown exit '{}'".format(ex)) # some other, unrecognised command else: # send back an 'unknown command' message mud.send_message(id, "Unknown command '{}'".format(command)) elif event.type is EventType.PLAYER_DISCONNECT: err_print("Player %s left" % event.id) #if the player has been added to the list, they must be removed if event.id in players: for pid in players: mud.send_message(pid, "%s quit the game" % players[event.id]["name"]) del(players[id])
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 11748, 640, 198, 11748, 25064, 198, 2, 1330, 262, 337, 8322, 4382, 1398, 198, 6738, 17492, 15388, 1330, 32878, 10697, 11, 8558, 11, 8558, 6030, 198, 198, 2, 17190, 284, 336, 1082, 81, 198, 198, 5959, 33, 14058, 62, 4805, 12394, 796, 10352, 628, 198, 2, 4645, 16215, 262, 9519, 287, 262, 983, 13, 9993, 4375, 517, 9519, 284, 262, 983, 0, 198, 9649, 796, 1391, 198, 220, 220, 220, 366, 38586, 933, 1298, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 366, 11213, 1298, 366, 1639, 821, 287, 257, 37438, 42488, 38794, 416, 281, 1280, 2046, 33283, 198, 220, 220, 220, 220, 220, 220, 220, 366, 1069, 896, 1298, 19779, 43435, 1298, 366, 30815, 25719, 198, 220, 220, 220, 8964, 198, 220, 220, 220, 366, 30815, 1298, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 366, 11213, 1298, 366, 1639, 821, 5055, 2354, 257, 42488, 13, 632, 338, 43079, 33283, 198, 220, 220, 220, 220, 220, 220, 220, 366, 1069, 896, 1298, 19779, 48787, 1298, 366, 38586, 933, 25719, 198, 220, 220, 220, 1782, 198, 92, 198, 198, 2, 7000, 262, 1938, 287, 262, 983, 198, 32399, 796, 23884, 198, 198, 2, 923, 262, 4382, 198, 41650, 796, 32878, 10697, 3419, 198, 198, 2, 1388, 983, 9052, 13, 775, 9052, 8097, 357, 72, 13, 68, 13, 1566, 262, 1430, 318, 23083, 8, 198, 4514, 6407, 25, 628, 220, 220, 220, 1303, 14985, 329, 352, 14, 20, 286, 257, 1218, 319, 1123, 9052, 11, 523, 326, 356, 836, 470, 7558, 198, 220, 220, 220, 1303, 779, 1802, 4, 9135, 640, 198, 220, 220, 220, 640, 13, 42832, 7, 15, 13, 17, 8, 628, 220, 220, 220, 1303, 705, 19119, 6, 1276, 307, 1444, 287, 262, 9052, 284, 1394, 262, 983, 2491, 290, 1577, 198, 220, 220, 220, 1303, 514, 510, 12, 1462, 12, 4475, 1321, 198, 220, 220, 220, 17492, 13, 19119, 3419, 628, 220, 220, 220, 1303, 5412, 2995, 319, 262, 4382, 62, 36560, 198, 220, 220, 220, 981, 357, 11925, 7, 41650, 13, 15388, 62, 36560, 8, 1875, 657, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1785, 796, 17492, 13, 15388, 62, 36560, 13, 79, 643, 701, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 11454, 62, 4798, 7, 15596, 8, 198, 220, 220, 220, 220, 220, 220, 220, 4686, 796, 1785, 13, 312, 198, 220, 220, 220, 220, 220, 220, 220, 611, 1785, 13, 4906, 318, 8558, 6030, 13, 31519, 1137, 62, 45006, 1268, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 751, 262, 649, 2137, 284, 262, 22155, 11, 10820, 326, 484, 1053, 407, 587, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3706, 1865, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 383, 22155, 1994, 318, 262, 2137, 338, 4686, 1271, 13, 775, 900, 511, 2119, 284, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 6045, 7317, 1566, 484, 423, 5982, 257, 1438, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11454, 62, 4798, 7203, 14140, 4064, 82, 5399, 526, 4064, 1785, 13, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 60, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 3672, 1298, 6045, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 366, 3823, 1298, 6045, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1782, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 16963, 457, 262, 2836, 329, 511, 1438, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 2061, 318, 534, 1438, 1701, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1785, 13, 4906, 318, 8558, 6030, 13, 44, 1546, 4090, 8264, 62, 2200, 5222, 3824, 1961, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 26021, 656, 3141, 1343, 42287, 284, 787, 2493, 278, 262, 2438, 4577, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3141, 11, 42287, 796, 357, 15596, 13, 20500, 13, 35312, 7203, 33172, 352, 8, 1343, 14631, 1600, 366, 8973, 38381, 25, 17, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11454, 62, 4798, 7, 15596, 13, 20500, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 477, 777, 1288, 361, 82, 481, 307, 6928, 351, 366, 22769, 13, 29572, 26933, 15414, 12962, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1938, 58, 312, 7131, 1, 3672, 8973, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3672, 8973, 796, 1785, 13, 20500, 13, 35312, 7203, 366, 38381, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3823, 8973, 796, 366, 38586, 933, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 46514, 11, 458, 287, 1938, 13, 23814, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 1123, 2137, 257, 3275, 284, 1560, 606, 546, 262, 649, 2137, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 35317, 11, 36521, 82, 5982, 262, 983, 1, 4064, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3672, 8973, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 14618, 284, 262, 983, 11, 4064, 82, 13, 366, 4064, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3672, 8973, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1343, 366, 6030, 705, 16794, 6, 329, 257, 1351, 286, 9729, 13, 8192, 1257, 2474, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 16794, 6, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 3141, 6624, 366, 16794, 1298, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 262, 2137, 736, 262, 1351, 286, 1744, 9729, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 6935, 1746, 25, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 220, 910, 1279, 20500, 29, 220, 532, 28628, 1223, 503, 7812, 11, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1343, 366, 68, 13, 70, 13, 705, 16706, 18435, 6, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 220, 804, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 532, 35909, 1127, 262, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1343, 366, 11793, 744, 654, 11, 304, 13, 70, 13, 705, 5460, 6, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 220, 467, 1279, 37023, 29, 220, 220, 220, 220, 220, 532, 38213, 832, 262, 8420, 366, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1343, 366, 23599, 11, 304, 13, 70, 13, 705, 2188, 2354, 6, 4943, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 16706, 6, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 3141, 6624, 366, 16706, 1298, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 467, 832, 790, 2137, 287, 262, 983, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 46514, 11, 458, 287, 1938, 13, 23814, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 611, 484, 821, 287, 262, 976, 2119, 355, 262, 2137, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1938, 58, 35317, 7131, 1, 3823, 8973, 6624, 1938, 58, 312, 7131, 1, 3823, 1, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 606, 257, 3275, 5149, 606, 644, 262, 2137, 531, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 35317, 11, 45144, 92, 1139, 25, 23884, 1911, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3672, 33116, 42287, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 5460, 6, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 3141, 6624, 366, 5460, 1298, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3650, 262, 2137, 338, 1459, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 42721, 796, 9519, 58, 32399, 58, 312, 7131, 1, 3823, 8973, 60, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 262, 2137, 736, 262, 6764, 286, 511, 1459, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 42721, 14692, 11213, 8973, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 1456, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 467, 832, 790, 2137, 287, 262, 983, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 46514, 11, 458, 287, 1938, 13, 23814, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 611, 484, 821, 287, 262, 976, 2119, 355, 262, 2137, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1938, 58, 35317, 7131, 1, 3823, 8973, 6624, 1938, 58, 312, 7131, 1, 3823, 1, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 2644, 290, 484, 423, 257, 1438, 284, 307, 3402, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1938, 58, 35317, 7131, 1, 3672, 8973, 318, 407, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 751, 511, 1438, 284, 262, 1351, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 1456, 13, 33295, 7, 32399, 58, 35317, 7131, 1, 3672, 8973, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 2137, 257, 3275, 7268, 262, 1351, 286, 1938, 287, 262, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 24860, 994, 25, 23884, 1911, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 33172, 27071, 22179, 7, 32399, 1456, 22305, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 2137, 257, 3275, 7268, 262, 1351, 286, 30151, 422, 428, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 3109, 896, 389, 25, 23884, 1911, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 33172, 27071, 22179, 7, 26224, 14692, 1069, 896, 8973, 22305, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 705, 2188, 6, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 3141, 6624, 366, 2188, 1298, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3650, 262, 8420, 1438, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 409, 796, 42287, 13, 21037, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3650, 262, 2137, 338, 1459, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 42721, 796, 9519, 58, 32399, 58, 312, 7131, 1, 3823, 8973, 60, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 611, 262, 7368, 8420, 318, 1043, 287, 262, 2119, 338, 30151, 1351, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 409, 287, 42721, 14692, 1069, 896, 1, 5974, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 467, 832, 477, 262, 1938, 287, 262, 983, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 46514, 11, 458, 287, 1938, 13, 23814, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 611, 2137, 318, 287, 262, 976, 2119, 290, 2125, 470, 262, 2137, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 7216, 262, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1938, 58, 35317, 7131, 1, 3823, 8973, 6624, 1938, 58, 312, 7131, 1, 3823, 8973, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 46514, 14512, 4686, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 606, 257, 3275, 5149, 606, 326, 262, 2137, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 1364, 262, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 35317, 11, 45144, 92, 1364, 2884, 8420, 705, 90, 92, 6, 1911, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3672, 33116, 409, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 4296, 262, 2137, 338, 1459, 2119, 284, 262, 530, 262, 8420, 5983, 284, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3823, 8973, 796, 42721, 14692, 1069, 896, 1, 7131, 1069, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 42721, 796, 9519, 58, 32399, 58, 312, 7131, 1, 3823, 8973, 60, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 467, 832, 477, 262, 1938, 287, 262, 983, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 46514, 11, 458, 287, 1938, 13, 23814, 33529, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 611, 2137, 318, 287, 262, 976, 357, 3605, 8, 2119, 290, 2125, 470, 262, 2137, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 7216, 262, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1938, 58, 35317, 7131, 1, 3823, 8973, 6624, 1938, 58, 312, 7131, 1, 3823, 8973, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 290, 46514, 14512, 4686, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 606, 257, 3275, 5149, 606, 326, 262, 2137, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 5982, 262, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 35317, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 45144, 92, 5284, 2884, 8420, 705, 90, 92, 6, 1911, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3672, 33116, 409, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 262, 2137, 257, 3275, 5149, 606, 810, 484, 389, 783, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 1639, 9240, 379, 705, 90, 92, 6, 1911, 18982, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1938, 58, 312, 7131, 1, 3823, 8973, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 262, 7368, 8420, 2492, 470, 1043, 287, 262, 1459, 2119, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 736, 281, 705, 34680, 8420, 6, 3275, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 20035, 8420, 705, 90, 92, 6, 1911, 18982, 7, 1069, 4008, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 617, 584, 11, 43483, 1417, 3141, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 3758, 736, 281, 705, 34680, 3141, 6, 3275, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 312, 11, 366, 20035, 3141, 705, 90, 92, 6, 1911, 18982, 7, 21812, 4008, 628, 198, 220, 220, 220, 220, 220, 220, 220, 1288, 361, 1785, 13, 4906, 318, 8558, 6030, 13, 31519, 1137, 62, 26288, 10943, 48842, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 11454, 62, 4798, 7203, 14140, 4064, 82, 1364, 1, 4064, 1785, 13, 312, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 361, 262, 2137, 468, 587, 2087, 284, 262, 1351, 11, 484, 1276, 307, 4615, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1785, 13, 312, 287, 1938, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 329, 46514, 287, 1938, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17492, 13, 21280, 62, 20500, 7, 35317, 11, 36521, 82, 11238, 262, 983, 1, 4064, 1938, 58, 15596, 13, 312, 7131, 1, 3672, 8973, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1619, 7, 32399, 58, 312, 12962 ]
1.928864
4,147
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from mptt.forms import MPTTAdminForm from parler.forms import TranslatableModelForm from shopit.models.flag import Flag
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 11, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 285, 457, 83, 13, 23914, 1330, 4904, 15751, 46787, 8479, 198, 6738, 1582, 1754, 13, 23914, 1330, 3602, 49009, 17633, 8479, 198, 198, 6738, 6128, 270, 13, 27530, 13, 32109, 1330, 19762, 628 ]
3.1875
64
from point import Point from rectangle import Rectangle from utils import areOverlapping
[ 6738, 966, 1330, 6252, 201, 198, 6738, 35991, 1330, 48599, 9248, 201, 198, 6738, 3384, 4487, 1330, 389, 5886, 75, 5912, 201, 198, 201, 198 ]
3.76
25
""" Created by akiselev on 2019-06-13 re.findall() The expression re.findall() returns all the non-overlapping matches of patterns in a string as a list of strings. Code >>> import re >>> re.findall(r'\w','http://www.hackerrank.com/') ['h', 't', 't', 'p', 'w', 'w', 'w', 'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k', 'c', 'o', 'm'] re.finditer() The expression re.finditer() returns an iterator yielding MatchObject instances over all non-overlapping matches for the re pattern in the string. Code >>> import re >>> re.finditer(r'\w','http://www.hackerrank.com/') <callable-iterator object at 0x0266C790> >>> map(lambda x: x.group(),re.finditer(r'\w','http://www.hackerrank.com/')) ['h', 't', 't', 'p', 'w', 'w', 'w', 'h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k', 'c', 'o', 'm'] Task You are given a string . It consists of alphanumeric characters, spaces and symbols(+,-). Your task is to find all the substrings of that contains or more vowels. Also, these substrings must lie in between consonants and should contain vowels only. Note : Vowels are defined as: AEIOU and aeiou. Consonants are defined as: QWRTYPSDFGHJKLZXCVBNM and qwrtypsdfghjklzxcvbnm. Input Format A single line of input containing string . Constraints Output Format Print the matched substrings in their order of occurrence on separate lines. If no match is found, print -1. Sample Input rabcdeefgyYhFjkIoomnpOeorteeeeet Sample Output ee Ioo Oeo eeeee """ import re x = re.compile(r'[qwrtypsdfghjklzxcvbnm]([aeiou]{2,})(?=[qwrtypsdfghjklzxcvbnm])', re.I) m = re.findall(x, input().strip()) print('\n'.join(m or ['-1']))
[ 37811, 628, 15622, 416, 47594, 786, 2768, 319, 13130, 12, 3312, 12, 1485, 198, 220, 198, 302, 13, 19796, 439, 3419, 198, 198, 464, 5408, 302, 13, 19796, 439, 3419, 5860, 477, 262, 1729, 12, 2502, 75, 5912, 7466, 286, 7572, 287, 257, 4731, 355, 257, 1351, 286, 13042, 13, 198, 10669, 198, 198, 33409, 1330, 302, 198, 33409, 302, 13, 19796, 439, 7, 81, 6, 59, 86, 41707, 4023, 1378, 2503, 13, 31153, 8056, 962, 13, 785, 14, 11537, 198, 17816, 71, 3256, 705, 83, 3256, 705, 83, 3256, 705, 79, 3256, 705, 86, 3256, 705, 86, 3256, 705, 86, 3256, 705, 71, 3256, 705, 64, 3256, 705, 66, 3256, 705, 74, 3256, 705, 68, 3256, 705, 81, 3256, 705, 81, 3256, 705, 64, 3256, 705, 77, 3256, 705, 74, 3256, 705, 66, 3256, 705, 78, 3256, 705, 76, 20520, 198, 198, 260, 13, 19796, 2676, 3419, 198, 198, 464, 5408, 302, 13, 19796, 2676, 3419, 5860, 281, 41313, 39127, 13225, 10267, 10245, 625, 477, 1729, 12, 2502, 75, 5912, 7466, 329, 262, 302, 3912, 287, 262, 4731, 13, 198, 10669, 198, 198, 33409, 1330, 302, 198, 33409, 302, 13, 19796, 2676, 7, 81, 6, 59, 86, 41707, 4023, 1378, 2503, 13, 31153, 8056, 962, 13, 785, 14, 11537, 198, 27, 13345, 540, 12, 48727, 2134, 379, 657, 87, 15, 25540, 34, 37750, 29, 198, 33409, 3975, 7, 50033, 2124, 25, 2124, 13, 8094, 22784, 260, 13, 19796, 2676, 7, 81, 6, 59, 86, 41707, 4023, 1378, 2503, 13, 31153, 8056, 962, 13, 785, 14, 6, 4008, 198, 17816, 71, 3256, 705, 83, 3256, 705, 83, 3256, 705, 79, 3256, 705, 86, 3256, 705, 86, 3256, 705, 86, 3256, 705, 71, 3256, 705, 64, 3256, 705, 66, 3256, 705, 74, 3256, 705, 68, 3256, 705, 81, 3256, 705, 81, 3256, 705, 64, 3256, 705, 77, 3256, 705, 74, 3256, 705, 66, 3256, 705, 78, 3256, 705, 76, 20520, 198, 198, 25714, 198, 1639, 389, 1813, 257, 4731, 198, 13, 632, 10874, 286, 435, 19080, 39223, 3435, 11, 9029, 290, 14354, 7, 10, 12095, 737, 198, 7120, 4876, 318, 284, 1064, 477, 262, 850, 37336, 286, 326, 4909, 393, 517, 23268, 1424, 13, 198, 7583, 11, 777, 850, 37336, 1276, 6486, 287, 1022, 198, 198, 5936, 261, 1187, 290, 815, 3994, 23268, 1424, 691, 13, 198, 198, 6425, 1058, 198, 53, 322, 1424, 389, 5447, 355, 25, 25603, 40, 2606, 290, 257, 20295, 280, 13, 198, 9444, 261, 1187, 389, 5447, 355, 25, 1195, 18564, 9936, 3705, 8068, 17511, 41, 42, 43, 40692, 33538, 15766, 44, 290, 10662, 18351, 774, 862, 7568, 456, 73, 41582, 89, 25306, 85, 9374, 76, 13, 198, 198, 20560, 18980, 198, 198, 32, 2060, 1627, 286, 5128, 7268, 4731, 198, 198, 13, 198, 198, 3103, 2536, 6003, 198, 198, 26410, 18980, 198, 198, 18557, 262, 14451, 850, 37336, 287, 511, 1502, 286, 19810, 319, 4553, 3951, 13, 198, 1532, 645, 2872, 318, 1043, 11, 3601, 532, 16, 13, 198, 198, 36674, 23412, 198, 198, 25619, 66, 2934, 891, 1360, 56, 71, 37, 73, 74, 40, 4207, 37659, 46, 68, 419, 41591, 316, 198, 198, 36674, 25235, 198, 198, 1453, 198, 40, 2238, 198, 46, 68, 78, 198, 41591, 68, 198, 198, 37811, 198, 11748, 302, 198, 87, 796, 302, 13, 5589, 576, 7, 81, 6, 58, 80, 18351, 774, 862, 7568, 456, 73, 41582, 89, 25306, 85, 9374, 76, 16151, 58, 3609, 72, 280, 60, 90, 17, 11, 92, 5769, 30, 41888, 80, 18351, 774, 862, 7568, 456, 73, 41582, 89, 25306, 85, 9374, 76, 12962, 3256, 302, 13, 40, 8, 198, 76, 796, 302, 13, 19796, 439, 7, 87, 11, 5128, 22446, 36311, 28955, 198, 4798, 10786, 59, 77, 4458, 22179, 7, 76, 393, 685, 29001, 16, 20520, 4008 ]
2.5968
625
from antlr4 import FileStream, CommonTokenStream from src.Python3Lexer import Python3Lexer from src.Python3Parser import Python3Parser from antlr4.tree.Tree import TerminalNodeImpl from antlr4.error.ErrorListener import ErrorListener import json class FileErrorListener(ErrorListener): """Class for storing errors which occured during the syntax analysis""" def walk(subtree, rule_names): """ Function for converting tree to dictionary Function takes subtree and array of names and recursively goes through each node and returns dictionary (possibly array of dictionaries back) Args: @subtree - root of subtree to be walked through @rule_names - corresponding to states rule names Returnes: dict representation of the tree """ if isinstance(subtree, TerminalNodeImpl): token = subtree.getSymbol() token_name = Python3Parser.symbolicNames[token.type] return {'Type': token_name, 'Value': token.text} else: child_nodes = [] name = rule_names[subtree.getRuleIndex()] for i in range(subtree.getChildCount()): child_nodes.append(walk(subtree.getChild(i), rule_names)) if len(child_nodes) == 1: return {name: child_nodes[0]} else: return {name: child_nodes} def lex(i_stream): """Makes lexical analysis Returns: stream of tokens """ lexer = Python3Lexer(i_stream) t_stream = CommonTokenStream(lexer) t_stream.fill() return t_stream def parse(t_stream): """Handles parsing Params: t_stream: stream of tokens to parse Returns: resulting tree error handler (with possible errors stored inside) """ py_parser = Python3Parser(t_stream) py_parser.removeErrorListeners() error_listener = FileErrorListener() py_parser.addErrorListener(error_listener) built_tree = py_parser.file_input() return built_tree, error_listener def tree_to_json(built_tree, error_listener): """Converts tree to json Params: built_tree - tree to be converted error_listener - error hadling object Returns: json, if tree was constructed without errors array of errors, otherwise """ if len(error_listener.errors) > 0: return '\n'.join(["Syntax errors were found"] + error_listener.errors) else: result = walk(built_tree, Python3Parser.ruleNames) return json.dumps(result, indent=2, ensure_ascii=False) if __name__ == '__main__': from tests.run_tests import run_tests run_tests() launch()
[ 6738, 1885, 14050, 19, 1330, 9220, 12124, 11, 8070, 30642, 12124, 198, 6738, 12351, 13, 37906, 18, 45117, 263, 1330, 11361, 18, 45117, 263, 198, 6738, 12351, 13, 37906, 18, 46677, 1330, 11361, 18, 46677, 198, 6738, 1885, 14050, 19, 13, 21048, 13, 27660, 1330, 24523, 19667, 29710, 198, 6738, 1885, 14050, 19, 13, 18224, 13, 12331, 33252, 1330, 13047, 33252, 198, 11748, 33918, 628, 198, 4871, 9220, 12331, 33252, 7, 12331, 33252, 2599, 198, 220, 220, 220, 37227, 9487, 329, 23069, 8563, 543, 1609, 1522, 1141, 262, 15582, 3781, 37811, 628, 198, 4299, 2513, 7, 7266, 21048, 11, 3896, 62, 14933, 2599, 198, 220, 220, 220, 37227, 15553, 329, 23202, 5509, 284, 22155, 198, 220, 220, 220, 220, 198, 220, 220, 220, 15553, 2753, 13284, 631, 290, 7177, 286, 3891, 290, 664, 1834, 2280, 198, 220, 220, 220, 2925, 832, 1123, 10139, 290, 5860, 22155, 220, 198, 220, 220, 220, 357, 39363, 7177, 286, 48589, 3166, 736, 8, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 7266, 21048, 532, 6808, 286, 13284, 631, 284, 307, 6807, 832, 198, 220, 220, 220, 220, 220, 220, 220, 2488, 25135, 62, 14933, 532, 11188, 284, 2585, 3896, 3891, 628, 220, 220, 220, 8229, 274, 25, 8633, 10552, 286, 262, 5509, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 611, 318, 39098, 7, 7266, 21048, 11, 24523, 19667, 29710, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 11241, 796, 13284, 631, 13, 1136, 13940, 23650, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 11241, 62, 3672, 796, 11361, 18, 46677, 13, 1837, 2022, 4160, 36690, 58, 30001, 13, 4906, 60, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 1391, 6, 6030, 10354, 11241, 62, 3672, 11, 705, 11395, 10354, 11241, 13, 5239, 92, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1200, 62, 77, 4147, 796, 17635, 198, 220, 220, 220, 220, 220, 220, 220, 1438, 796, 3896, 62, 14933, 58, 7266, 21048, 13, 1136, 31929, 15732, 3419, 60, 628, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 2837, 7, 7266, 21048, 13, 1136, 16424, 12332, 3419, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1200, 62, 77, 4147, 13, 33295, 7, 11152, 7, 7266, 21048, 13, 1136, 16424, 7, 72, 828, 3896, 62, 14933, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 9410, 62, 77, 4147, 8, 6624, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1391, 3672, 25, 1200, 62, 77, 4147, 58, 15, 48999, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1391, 3672, 25, 1200, 62, 77, 4147, 92, 628, 198, 4299, 31191, 7, 72, 62, 5532, 2599, 198, 220, 220, 220, 37227, 44, 1124, 31191, 605, 3781, 198, 220, 220, 220, 220, 198, 220, 220, 220, 16409, 25, 4269, 286, 16326, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 31191, 263, 796, 11361, 18, 45117, 263, 7, 72, 62, 5532, 8, 198, 220, 220, 220, 256, 62, 5532, 796, 8070, 30642, 12124, 7, 2588, 263, 8, 198, 220, 220, 220, 256, 62, 5532, 13, 20797, 3419, 198, 220, 220, 220, 1441, 256, 62, 5532, 628, 198, 4299, 21136, 7, 83, 62, 5532, 2599, 198, 220, 220, 220, 37227, 12885, 829, 32096, 198, 220, 220, 220, 220, 198, 220, 220, 220, 2547, 4105, 25, 198, 220, 220, 220, 220, 220, 220, 220, 256, 62, 5532, 25, 4269, 286, 16326, 284, 21136, 628, 220, 220, 220, 16409, 25, 220, 198, 220, 220, 220, 220, 220, 220, 220, 7186, 5509, 198, 220, 220, 220, 220, 220, 220, 220, 4049, 21360, 357, 4480, 1744, 8563, 8574, 2641, 8, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 12972, 62, 48610, 796, 11361, 18, 46677, 7, 83, 62, 5532, 8, 198, 220, 220, 220, 12972, 62, 48610, 13, 28956, 12331, 23061, 364, 3419, 628, 220, 220, 220, 4049, 62, 4868, 877, 796, 9220, 12331, 33252, 3419, 198, 220, 220, 220, 12972, 62, 48610, 13, 2860, 12331, 33252, 7, 18224, 62, 4868, 877, 8, 628, 220, 220, 220, 3170, 62, 21048, 796, 12972, 62, 48610, 13, 7753, 62, 15414, 3419, 628, 220, 220, 220, 1441, 3170, 62, 21048, 11, 4049, 62, 4868, 877, 628, 198, 4299, 5509, 62, 1462, 62, 17752, 7, 18780, 62, 21048, 11, 4049, 62, 4868, 877, 2599, 198, 220, 220, 220, 37227, 3103, 24040, 5509, 284, 33918, 628, 220, 220, 220, 2547, 4105, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3170, 62, 21048, 532, 5509, 284, 307, 11513, 198, 220, 220, 220, 220, 220, 220, 220, 4049, 62, 4868, 877, 532, 4049, 550, 1359, 2134, 198, 220, 220, 220, 220, 198, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 33918, 11, 611, 5509, 373, 12006, 1231, 8563, 198, 220, 220, 220, 220, 220, 220, 220, 7177, 286, 8563, 11, 4306, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 611, 18896, 7, 18224, 62, 4868, 877, 13, 48277, 8, 1875, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 705, 59, 77, 4458, 22179, 7, 14692, 13940, 41641, 8563, 547, 1043, 8973, 1343, 4049, 62, 4868, 877, 13, 48277, 8, 198, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1255, 796, 2513, 7, 18780, 62, 21048, 11, 11361, 18, 46677, 13, 25135, 36690, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 33918, 13, 67, 8142, 7, 20274, 11, 33793, 28, 17, 11, 4155, 62, 292, 979, 72, 28, 25101, 8, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 422, 5254, 13, 5143, 62, 41989, 1330, 1057, 62, 41989, 198, 220, 220, 220, 1057, 62, 41989, 3419, 198, 220, 220, 220, 4219, 3419, 198 ]
2.643644
999
from unplugged import Schema from ...plugins import DatabasePlugin
[ 6738, 555, 16875, 2004, 1330, 10011, 2611, 198, 198, 6738, 2644, 37390, 1330, 24047, 37233, 628 ]
4.3125
16
import GUI from GUI import root, tk, MyButton import ButtonClickHandler as BH from ButtonClickHandler import MainMenuButtons as M
[ 11748, 25757, 201, 198, 6738, 25757, 1330, 6808, 11, 256, 74, 11, 2011, 21864, 201, 198, 11748, 20969, 8164, 25060, 355, 347, 39, 201, 198, 6738, 20969, 8164, 25060, 1330, 8774, 23381, 1537, 27288, 355, 337, 201, 198, 201, 198 ]
3.4
40
import random from copy import deepcopy
[ 11748, 4738, 198, 6738, 4866, 1330, 2769, 30073, 628 ]
4.555556
9
import os from bottle import Bottle, response from whitenoise import WhiteNoise from ..settings import DATA_PATH api = Bottle() @api.hook('after_request') application = WhiteNoise(api) application.add_files(os.path.join(DATA_PATH, 'thumbnails'), prefix='thumbnails/') application.add_files(os.path.join(DATA_PATH, 'medias'), prefix='medias/')
[ 11748, 28686, 198, 198, 6738, 9294, 1330, 33608, 11, 2882, 198, 6738, 20542, 23397, 786, 1330, 2635, 2949, 786, 198, 198, 6738, 11485, 33692, 1330, 42865, 62, 34219, 628, 198, 15042, 796, 33608, 3419, 628, 198, 31, 15042, 13, 25480, 10786, 8499, 62, 25927, 11537, 628, 198, 31438, 796, 2635, 2949, 786, 7, 15042, 8, 198, 31438, 13, 2860, 62, 16624, 7, 418, 13, 6978, 13, 22179, 7, 26947, 62, 34219, 11, 705, 18670, 33809, 21231, 11639, 18670, 14, 11537, 198, 31438, 13, 2860, 62, 16624, 7, 418, 13, 6978, 13, 22179, 7, 26947, 62, 34219, 11, 705, 2379, 292, 33809, 21231, 11639, 2379, 292, 14, 11537, 198 ]
3.25
108
# for testing only, 'alpha' is included in the preloaded section on Codewars alpha = {'ABCDE': 1, 'FGHIJ': 2, 'KLMNO': 3, 'PQRST': 4, 'UVWXY': 5}
[ 2, 329, 4856, 691, 11, 705, 26591, 6, 318, 3017, 287, 262, 662, 14578, 2665, 319, 18720, 413, 945, 198, 26591, 796, 1391, 6, 24694, 7206, 10354, 352, 11, 705, 37, 17511, 23852, 10354, 362, 11, 705, 42, 31288, 15285, 10354, 513, 11, 705, 47, 48, 49, 2257, 10354, 604, 11, 705, 52, 30133, 34278, 10354, 642, 92, 628 ]
2.491525
59
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. ## # Module for loading and encoding Broombridge data ## import logging from qsharp.chemistry import load_broombridge, load_input_state, encode from typing import List, Tuple NumQubits = int HamiltonianTermList = Tuple[List[Tuple[List[int], List[float]]]] InputStateTerms = Tuple[int, List[Tuple[Tuple[float, float], List[int]]]] EnergyOffset = float JWEncodedData = Tuple[ NumQubits, HamiltonianTermList, InputStateTerms, EnergyOffset ] _log = logging.getLogger(__name__) def load_and_encode( file_name: str, problem_description_index: int = 0, initial_state_label: str = None ) -> JWEncodedData: """Wrapper function for loading and encoding Broombridge file into JWEncodedData-compatible format. :param file_name: Broombridge file name :type file_name: str :param problem_description_index: Index of problem description to use, defaults to 0 :type problem_description_index: int, optional :param initial_state_label: Label of initial state to use, defaults to first available label :type initial_state_label: str, optional """ broombridge_data = load_broombridge(file_name) problem = broombridge_data.problem_description[problem_description_index] if initial_state_label is None: # Pick first in list initial_state_label = problem.initial_state_suggestions[0].get("Label") _log.info(f"Using initial state label: {initial_state_label}") input_state = load_input_state(file_name, initial_state_label) ferm_hamiltonian = problem.load_fermion_hamiltonian() ( num_qubits, hamiltonian_term_list, input_state_terms, energy_offset ) = encode(ferm_hamiltonian, input_state) return ( num_qubits, hamiltonian_term_list, input_state_terms, energy_offset )
[ 2, 15069, 357, 66, 8, 5413, 10501, 13, 198, 2, 49962, 739, 262, 17168, 13789, 13, 198, 198, 2235, 198, 2, 19937, 329, 11046, 290, 21004, 2806, 296, 9458, 1366, 198, 2235, 198, 11748, 18931, 198, 6738, 10662, 48554, 13, 15245, 4592, 1330, 3440, 62, 65, 3823, 9458, 11, 3440, 62, 15414, 62, 5219, 11, 37773, 198, 6738, 19720, 1330, 7343, 11, 309, 29291, 198, 198, 33111, 48, 549, 896, 796, 493, 198, 45405, 666, 40596, 8053, 796, 309, 29291, 58, 8053, 58, 51, 29291, 58, 8053, 58, 600, 4357, 7343, 58, 22468, 11907, 11907, 198, 20560, 9012, 15156, 907, 796, 309, 29291, 58, 600, 11, 7343, 58, 51, 29291, 58, 51, 29291, 58, 22468, 11, 12178, 4357, 7343, 58, 600, 11907, 11907, 198, 28925, 34519, 796, 12178, 198, 41, 54, 27195, 9043, 6601, 796, 309, 29291, 58, 198, 220, 220, 220, 31835, 48, 549, 896, 11, 198, 220, 220, 220, 11582, 666, 40596, 8053, 11, 198, 220, 220, 220, 23412, 9012, 15156, 907, 11, 198, 220, 220, 220, 6682, 34519, 198, 60, 198, 198, 62, 6404, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628, 198, 4299, 3440, 62, 392, 62, 268, 8189, 7, 198, 220, 220, 220, 2393, 62, 3672, 25, 965, 11, 198, 220, 220, 220, 1917, 62, 11213, 62, 9630, 25, 493, 796, 657, 11, 198, 220, 220, 220, 4238, 62, 5219, 62, 18242, 25, 965, 796, 6045, 198, 8, 4613, 449, 54, 27195, 9043, 6601, 25, 198, 220, 220, 220, 37227, 36918, 2848, 2163, 329, 11046, 290, 21004, 2806, 296, 9458, 2393, 656, 198, 220, 220, 220, 449, 54, 27195, 9043, 6601, 12, 38532, 5794, 13, 628, 220, 220, 220, 1058, 17143, 2393, 62, 3672, 25, 2806, 296, 9458, 2393, 1438, 198, 220, 220, 220, 1058, 4906, 2393, 62, 3672, 25, 965, 198, 220, 220, 220, 1058, 17143, 1917, 62, 11213, 62, 9630, 25, 12901, 286, 1917, 6764, 284, 779, 11, 198, 220, 220, 220, 220, 220, 220, 220, 26235, 284, 657, 198, 220, 220, 220, 1058, 4906, 1917, 62, 11213, 62, 9630, 25, 493, 11, 11902, 198, 220, 220, 220, 1058, 17143, 4238, 62, 5219, 62, 18242, 25, 36052, 286, 4238, 1181, 284, 779, 11, 26235, 284, 198, 220, 220, 220, 220, 220, 220, 220, 717, 1695, 6167, 198, 220, 220, 220, 1058, 4906, 4238, 62, 5219, 62, 18242, 25, 965, 11, 11902, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 47085, 9458, 62, 7890, 796, 3440, 62, 65, 3823, 9458, 7, 7753, 62, 3672, 8, 198, 220, 220, 220, 1917, 796, 47085, 9458, 62, 7890, 13, 45573, 62, 11213, 58, 45573, 62, 11213, 62, 9630, 60, 628, 220, 220, 220, 611, 4238, 62, 5219, 62, 18242, 318, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 12346, 717, 287, 1351, 198, 220, 220, 220, 220, 220, 220, 220, 4238, 62, 5219, 62, 18242, 796, 1917, 13, 36733, 62, 5219, 62, 47811, 507, 58, 15, 4083, 1136, 7203, 33986, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 4808, 6404, 13, 10951, 7, 69, 1, 12814, 4238, 1181, 6167, 25, 1391, 36733, 62, 5219, 62, 18242, 92, 4943, 628, 220, 220, 220, 5128, 62, 5219, 796, 3440, 62, 15414, 62, 5219, 7, 7753, 62, 3672, 11, 4238, 62, 5219, 62, 18242, 8, 198, 220, 220, 220, 277, 7780, 62, 2763, 9044, 666, 796, 1917, 13, 2220, 62, 2232, 76, 295, 62, 2763, 9044, 666, 3419, 198, 220, 220, 220, 357, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 421, 9895, 11, 198, 220, 220, 220, 220, 220, 220, 220, 8891, 9044, 666, 62, 4354, 62, 4868, 11, 198, 220, 220, 220, 220, 220, 220, 220, 5128, 62, 5219, 62, 38707, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2568, 62, 28968, 198, 220, 220, 220, 1267, 796, 37773, 7, 2232, 76, 62, 2763, 9044, 666, 11, 5128, 62, 5219, 8, 628, 220, 220, 220, 1441, 357, 198, 220, 220, 220, 220, 220, 220, 220, 997, 62, 421, 9895, 11, 198, 220, 220, 220, 220, 220, 220, 220, 8891, 9044, 666, 62, 4354, 62, 4868, 11, 198, 220, 220, 220, 220, 220, 220, 220, 5128, 62, 5219, 62, 38707, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2568, 62, 28968, 198, 220, 220, 220, 1267, 198 ]
2.7173
711
from collections import Counter print('Number of words:', word_count('test.txt'))
[ 6738, 17268, 1330, 15034, 201, 198, 201, 198, 4798, 10786, 15057, 286, 2456, 25, 3256, 1573, 62, 9127, 10786, 9288, 13, 14116, 6, 4008, 201, 198 ]
3.307692
26
from __future__ import absolute_import from __future__ import print_function from __future__ import division import time import datetime import torch import torchreid from torchreid.engine import engine from torchreid.losses import CrossEntropyLoss, TripletLoss, HctLoss from torchreid.utils import AverageMeter, open_specified_layers, open_all_layers from torchreid import metrics class ImageTripletEngine(engine.Engine): r"""Triplet-loss engine for image-reid. Args: datamanager (DataManager): an instance of ``torchreid.data.ImageDataManager`` or ``torchreid.data.VideoDataManager``. model (nn.Module): model instance. optimizer (Optimizer): an Optimizer. margin (float, optional): margin for triplet loss. Default is 0.3. weight_t (float, optional): weight for triplet loss. Default is 1. weight_x (float, optional): weight for softmax loss. Default is 1. scheduler (LRScheduler, optional): if None, no learning rate decay will be performed. use_gpu (bool, optional): use gpu. Default is True. label_smooth (bool, optional): use label smoothing regularizer. Default is True. Examples:: import torch import torchreid datamanager = torchreid.data.ImageDataManager( root='path/to/reid-data', sources='market1501', height=256, width=128, combineall=False, batch_size=32, num_instances=4, train_sampler='RandomIdentitySampler' # this is important ) model = torchreid.models.build_model( name='resnet50', num_classes=datamanager.num_train_pids, loss='triplet' ) model = model.cuda() optimizer = torchreid.optim.build_optimizer( model, optim='adam', lr=0.0003 ) scheduler = torchreid.optim.build_lr_scheduler( optimizer, lr_scheduler='single_step', stepsize=20 ) engine = torchreid.engine.ImageTripletEngine( datamanager, model, optimizer, margin=0.3, weight_t=0.7, weight_x=1, scheduler=scheduler ) engine.run( max_epoch=60, save_dir='log/resnet50-triplet-market1501', print_freq=10 ) """
[ 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 6738, 11593, 37443, 834, 1330, 7297, 198, 198, 11748, 640, 198, 11748, 4818, 8079, 198, 198, 11748, 28034, 198, 198, 11748, 28034, 260, 312, 198, 6738, 28034, 260, 312, 13, 18392, 1330, 3113, 198, 6738, 28034, 260, 312, 13, 22462, 274, 1330, 6372, 14539, 28338, 43, 793, 11, 19817, 83, 43, 793, 11, 367, 310, 43, 793, 198, 6738, 28034, 260, 312, 13, 26791, 1330, 13475, 44, 2357, 11, 1280, 62, 23599, 62, 75, 6962, 11, 1280, 62, 439, 62, 75, 6962, 198, 6738, 28034, 260, 312, 1330, 20731, 628, 198, 4871, 7412, 14824, 37069, 13798, 7, 18392, 13, 13798, 2599, 198, 220, 220, 220, 374, 37811, 14824, 37069, 12, 22462, 3113, 329, 2939, 12, 260, 312, 13, 628, 220, 220, 220, 943, 14542, 25, 198, 220, 220, 220, 220, 220, 220, 220, 4818, 10546, 3536, 357, 6601, 13511, 2599, 281, 4554, 286, 7559, 13165, 354, 260, 312, 13, 7890, 13, 5159, 6601, 13511, 15506, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 393, 7559, 13165, 354, 260, 312, 13, 7890, 13, 10798, 6601, 13511, 15506, 13, 198, 220, 220, 220, 220, 220, 220, 220, 2746, 357, 20471, 13, 26796, 2599, 2746, 4554, 13, 198, 220, 220, 220, 220, 220, 220, 220, 6436, 7509, 357, 27871, 320, 7509, 2599, 281, 30011, 7509, 13, 198, 220, 220, 220, 220, 220, 220, 220, 10330, 357, 22468, 11, 11902, 2599, 10330, 329, 15055, 83, 2994, 13, 15161, 318, 657, 13, 18, 13, 198, 220, 220, 220, 220, 220, 220, 220, 3463, 62, 83, 357, 22468, 11, 11902, 2599, 3463, 329, 15055, 83, 2994, 13, 15161, 318, 352, 13, 198, 220, 220, 220, 220, 220, 220, 220, 3463, 62, 87, 357, 22468, 11, 11902, 2599, 3463, 329, 2705, 9806, 2994, 13, 15161, 318, 352, 13, 198, 220, 220, 220, 220, 220, 220, 220, 6038, 18173, 357, 43, 6998, 1740, 18173, 11, 11902, 2599, 611, 6045, 11, 645, 4673, 2494, 22119, 481, 307, 6157, 13, 198, 220, 220, 220, 220, 220, 220, 220, 779, 62, 46999, 357, 30388, 11, 11902, 2599, 779, 308, 19944, 13, 15161, 318, 6407, 13, 198, 220, 220, 220, 220, 220, 220, 220, 6167, 62, 5796, 5226, 357, 30388, 11, 11902, 2599, 779, 6167, 32746, 722, 3218, 7509, 13, 15161, 318, 6407, 13, 628, 220, 220, 220, 21066, 3712, 628, 220, 220, 220, 220, 220, 220, 220, 1330, 28034, 198, 220, 220, 220, 220, 220, 220, 220, 1330, 28034, 260, 312, 198, 220, 220, 220, 220, 220, 220, 220, 4818, 10546, 3536, 796, 28034, 260, 312, 13, 7890, 13, 5159, 6601, 13511, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6808, 11639, 6978, 14, 1462, 14, 260, 312, 12, 7890, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4237, 11639, 10728, 1314, 486, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6001, 28, 11645, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9647, 28, 12762, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 12082, 439, 28, 25101, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15458, 62, 7857, 28, 2624, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 997, 62, 8625, 1817, 28, 19, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4512, 62, 37687, 20053, 11639, 29531, 7390, 26858, 16305, 20053, 6, 1303, 428, 318, 1593, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 2746, 796, 28034, 260, 312, 13, 27530, 13, 11249, 62, 19849, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1438, 11639, 411, 3262, 1120, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 997, 62, 37724, 28, 19608, 10546, 3536, 13, 22510, 62, 27432, 62, 79, 2340, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2994, 11639, 28461, 37069, 6, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 2746, 796, 2746, 13, 66, 15339, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 6436, 7509, 796, 28034, 260, 312, 13, 40085, 13, 11249, 62, 40085, 7509, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2746, 11, 6436, 11639, 324, 321, 3256, 300, 81, 28, 15, 13, 830, 18, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 6038, 18173, 796, 28034, 260, 312, 13, 40085, 13, 11249, 62, 14050, 62, 1416, 704, 18173, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6436, 7509, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 300, 81, 62, 1416, 704, 18173, 11639, 29762, 62, 9662, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4831, 1096, 28, 1238, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 3113, 796, 28034, 260, 312, 13, 18392, 13, 5159, 14824, 37069, 13798, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4818, 10546, 3536, 11, 2746, 11, 6436, 7509, 11, 10330, 28, 15, 13, 18, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3463, 62, 83, 28, 15, 13, 22, 11, 3463, 62, 87, 28, 16, 11, 6038, 18173, 28, 1416, 704, 18173, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 3113, 13, 5143, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 538, 5374, 28, 1899, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3613, 62, 15908, 11639, 6404, 14, 411, 3262, 1120, 12, 28461, 37069, 12, 10728, 1314, 486, 3256, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 62, 19503, 80, 28, 940, 198, 220, 220, 220, 220, 220, 220, 220, 1267, 198, 220, 220, 220, 37227, 628 ]
2.265385
1,040
# crypto/opisthocomus-hoazin e, n = (65537, 15888457769674642859708800597310299725338251830976423740469342107745469667544014118426981955901595652146093596535042454720088489883832573612094938281276141337632202496209218136026441342435018861975571842724577501821204305185018320446993699281538507826943542962060000957702417455609633977888711896513101590291125131953317446916178315755142103529251195112400643488422928729091341969985567240235775120515891920824933965514217511971572242643456664322913133669621953247121022723513660621629349743664178128863766441389213302642916070154272811871674136669061719947615578346412919910075334517952880722801011983182804339339643) flag_enc = [65639, 65645, 65632, 65638, 65658, 65653, 65609, 65584, 65650, 65630, 65640, 65634, 65586, 65630, 65634, 65651, 65586, 65589, 65644, 65630, 65640, 65588, 65630, 65618, 65646, 65630, 65607, 65651, 65646, 65627, 65586, 65647, 65630, 65640, 65571, 65612, 65630, 65649, 65651, 65586, 65653, 65621, 65656, 65630, 65618, 65652, 65651, 65636, 65630, 65640, 65621, 65574, 65650, 65630, 65589, 65634, 65653, 65652, 65632, 65584, 65645, 65656, 65630, 65635, 65586, 65647, 65605, 65640, 65647, 65606, 65630, 65644, 65624, 65630, 65588, 65649, 65585, 65614, 65647, 65660] enc_map = {x ^ e % n: chr(x) for x in range(30,255)} print(''.join([enc_map[c] for c in flag_enc]))
[ 2, 21473, 14, 404, 396, 71, 42829, 385, 12, 8873, 1031, 259, 198, 198, 68, 11, 299, 796, 357, 35916, 2718, 11, 1315, 28011, 2231, 3324, 3388, 3134, 44578, 2078, 3270, 2154, 3459, 405, 3270, 4790, 940, 1959, 5607, 1495, 28460, 1495, 1507, 1270, 5607, 2414, 24693, 26429, 3388, 2682, 21536, 3324, 34229, 3388, 2791, 2425, 2598, 28645, 1157, 5705, 2075, 4089, 1129, 38605, 486, 35124, 2996, 22291, 31751, 30743, 2996, 14877, 19, 22995, 2857, 2167, 3459, 35890, 3459, 2548, 26582, 49150, 1065, 2931, 2920, 2548, 2078, 1065, 4304, 1415, 1485, 32128, 2624, 1238, 1731, 4846, 1238, 5892, 1507, 1485, 1899, 2075, 2598, 19880, 1731, 2327, 486, 44980, 38449, 3553, 22883, 1983, 1731, 3553, 2425, 486, 6469, 1065, 3023, 22515, 21652, 486, 5999, 1238, 27260, 2079, 2623, 2079, 2078, 1314, 2548, 1120, 3695, 2075, 5824, 2327, 11785, 21, 22136, 2388, 24, 3553, 2154, 1731, 1558, 30505, 1899, 4846, 29626, 3324, 3459, 5774, 1157, 4531, 2996, 1485, 8784, 36993, 33551, 11623, 1485, 22186, 2091, 1558, 2598, 3388, 1433, 1558, 5999, 1314, 38172, 1415, 21536, 2327, 1959, 1495, 16315, 4349, 1065, 7029, 2414, 2682, 40353, 23539, 27800, 1959, 2931, 19880, 25272, 34808, 2816, 3134, 16102, 1954, 3553, 2425, 1065, 2713, 1314, 4531, 1129, 21315, 21626, 2091, 4846, 2816, 23726, 1558, 4349, 24991, 1314, 4761, 1731, 2075, 3559, 2231, 2791, 41813, 23539, 1485, 1485, 2623, 3388, 5237, 1129, 4310, 23753, 1065, 940, 24403, 22370, 20809, 1899, 5237, 1433, 1959, 27371, 4524, 2623, 2414, 23188, 1065, 44980, 32128, 29173, 1485, 4531, 26427, 1270, 2075, 11785, 1433, 2998, 486, 4051, 1983, 2078, 1157, 5774, 1433, 4524, 1485, 2791, 3388, 3312, 1558, 19104, 35435, 1314, 38907, 2682, 2414, 18741, 19104, 3064, 2425, 2091, 2231, 1558, 3865, 2078, 36928, 23815, 486, 486, 29279, 1507, 21033, 19, 29626, 29626, 41813, 8, 198, 32109, 62, 12685, 796, 685, 37466, 2670, 11, 718, 3980, 2231, 11, 718, 3980, 2624, 11, 718, 3980, 2548, 11, 6135, 38431, 11, 6135, 46435, 11, 6135, 31751, 11, 45021, 5705, 11, 718, 3980, 1120, 11, 718, 3980, 1270, 11, 718, 3980, 1821, 11, 718, 3980, 2682, 11, 45021, 4521, 11, 718, 3980, 1270, 11, 718, 3980, 2682, 11, 6135, 40639, 11, 45021, 4521, 11, 45021, 4531, 11, 6135, 29173, 11, 718, 3980, 1270, 11, 718, 3980, 1821, 11, 45021, 3459, 11, 718, 3980, 1270, 11, 718, 3980, 1507, 11, 6135, 27720, 11, 718, 3980, 1270, 11, 6135, 31980, 11, 6135, 40639, 11, 6135, 27720, 11, 718, 3980, 1983, 11, 45021, 4521, 11, 6135, 33981, 11, 718, 3980, 1270, 11, 718, 3980, 1821, 11, 45021, 4869, 11, 718, 3980, 1065, 11, 718, 3980, 1270, 11, 6135, 33300, 11, 6135, 40639, 11, 45021, 4521, 11, 6135, 46435, 11, 718, 3980, 2481, 11, 6135, 37466, 11, 718, 3980, 1270, 11, 718, 3980, 1507, 11, 6135, 43193, 11, 6135, 40639, 11, 718, 3980, 2623, 11, 718, 3980, 1270, 11, 718, 3980, 1821, 11, 718, 3980, 2481, 11, 45021, 4524, 11, 718, 3980, 1120, 11, 718, 3980, 1270, 11, 45021, 4531, 11, 718, 3980, 2682, 11, 6135, 46435, 11, 6135, 43193, 11, 718, 3980, 2624, 11, 45021, 5705, 11, 718, 3980, 2231, 11, 6135, 37466, 11, 718, 3980, 1270, 11, 718, 3980, 2327, 11, 45021, 4521, 11, 6135, 33981, 11, 6135, 32417, 11, 718, 3980, 1821, 11, 6135, 33981, 11, 6135, 33206, 11, 718, 3980, 1270, 11, 6135, 29173, 11, 718, 3980, 1731, 11, 718, 3980, 1270, 11, 45021, 3459, 11, 6135, 33300, 11, 45021, 5332, 11, 718, 3980, 1415, 11, 6135, 33981, 11, 718, 3980, 1899, 60, 198, 12685, 62, 8899, 796, 1391, 87, 10563, 304, 4064, 299, 25, 442, 81, 7, 87, 8, 329, 2124, 287, 2837, 7, 1270, 11, 13381, 38165, 198, 4798, 10786, 4458, 22179, 26933, 12685, 62, 8899, 58, 66, 60, 329, 269, 287, 6056, 62, 12685, 60, 4008 ]
2.139423
624
a,b,A,B,l=list(map(int, input().split())), list(map(int, input().split())),0,0,0 for i in range(10): (A,B,l) = (A+3,B,1) if a[i]>b[i] else (A,B+3,2) if a[i]<b[i] else (A+1,B+1,l) print('{} {}\n{}'.format(A,B, 'A' if A>B or (A==B and l==1) else 'B' if A<B or (A==B and l==2) else 'D'))
[ 64, 11, 65, 11, 32, 11, 33, 11, 75, 28, 4868, 7, 8899, 7, 600, 11, 5128, 22446, 35312, 28955, 828, 1351, 7, 8899, 7, 600, 11, 5128, 22446, 35312, 28955, 828, 15, 11, 15, 11, 15, 198, 1640, 1312, 287, 2837, 7, 940, 2599, 357, 32, 11, 33, 11, 75, 8, 796, 357, 32, 10, 18, 11, 33, 11, 16, 8, 611, 257, 58, 72, 60, 29, 65, 58, 72, 60, 2073, 357, 32, 11, 33, 10, 18, 11, 17, 8, 611, 257, 58, 72, 60, 27, 65, 58, 72, 60, 2073, 357, 32, 10, 16, 11, 33, 10, 16, 11, 75, 8, 198, 4798, 10786, 90, 92, 23884, 59, 77, 90, 92, 4458, 18982, 7, 32, 11, 33, 11, 705, 32, 6, 611, 317, 29, 33, 393, 357, 32, 855, 33, 290, 300, 855, 16, 8, 2073, 705, 33, 6, 611, 317, 27, 33, 393, 357, 32, 855, 33, 290, 300, 855, 17, 8, 2073, 705, 35, 6, 4008 ]
1.763975
161
# -*- coding: utf-8 -*-
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198 ]
1.434783
23
#!/usr/bin/env python # MiTuner_socket_server.py -- Python 2.7 socket server to be used with MiTuner Bridge # Copyright 2018 Microsemi Inc. All rights reserved. #Licensed under the MIT License. See LICENSE.txt in the project root for license information. from os.path import dirname, realpath, isfile import argparse import sys import struct import socket sys.path.append(dirname(realpath(__file__)) + "/../../vproc_sdk/libs") from hbi import * from tw_firmware_converter import GetFirmwareBinFileB from hbi_load_firmware import LoadFirmware, SaveFirmwareToFlash, InitFlash, EraseFlash, SaveConfigToFlash, IsFirmwareRunning, LoadFirmwareFromFlash # Port for the socket (random) PORT = 5678 BUFFER_SZ = 2048 HEADER_SZ = 6 # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** # **************************************************************************** if __name__ == "__main__": parser = argparse.ArgumentParser(description = "Raspberry Pi socket server for MiTuner V1.0.0") parser.add_argument("-d", "--debug", help = "debug level 0: none, 1: in, 2: out, 3: in/out", type = int, default = 0) # Parse the input arguments args = parser.parse_args() # Init the HBI driver cfg = hbi_dev_cfg_t(); handle = HBI_open(cfg) try: # Create a socket and listen on port 'PORT' s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('', PORT)) s.listen(1) # Accept connections from outside print("Socket created on port %d, waiting for a connection" % PORT) while True: clientsocket, address = s.accept() print("Incoming connection from: %s" % address[0]) message = "" waitType = "header" while True: buff = clientsocket.recv(BUFFER_SZ).decode() if (buff == ""): print("Connection closed by the client (%s)" % address[0]) break else: message += buff if ((waitType == "header") and (len(message) >= HEADER_SZ)): header = message[0: HEADER_SZ] message = message[HEADER_SZ:] cmdLen = int(header[2: 6], 16) waitType = "cmd" if ((waitType == "cmd") and (len(message) >= cmdLen)): cmd = message[0: cmdLen] message = message[cmdLen:] if (args.debug & 1): print("header = %s, cmd = %s" % (header, cmd)) answer = ParseCmd(handle, header, cmd) if (args.debug & 2): print("\t" + answer) clientsocket.send(answer.encode()) waitType = "header" clientsocket.close() except: print("Server shut down") # Close the Socket s.close() # Close HBI driver HBI_close(handle)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 2, 13756, 51, 38886, 62, 44971, 62, 15388, 13, 9078, 220, 1377, 220, 11361, 362, 13, 22, 17802, 4382, 284, 307, 973, 351, 13756, 51, 38886, 10290, 198, 198, 2, 15069, 2864, 4527, 325, 11632, 3457, 13, 1439, 2489, 10395, 13, 198, 2, 26656, 15385, 739, 262, 17168, 13789, 13, 4091, 38559, 24290, 13, 14116, 287, 262, 1628, 6808, 329, 5964, 1321, 13, 198, 198, 6738, 28686, 13, 6978, 1330, 26672, 3672, 11, 1103, 6978, 11, 318, 7753, 198, 11748, 1822, 29572, 198, 11748, 25064, 198, 11748, 2878, 198, 11748, 17802, 198, 17597, 13, 6978, 13, 33295, 7, 15908, 3672, 7, 5305, 6978, 7, 834, 7753, 834, 4008, 1343, 12813, 40720, 40720, 85, 36942, 62, 21282, 74, 14, 8019, 82, 4943, 198, 6738, 289, 8482, 1330, 1635, 198, 6738, 665, 62, 69, 2533, 1574, 62, 1102, 332, 353, 1330, 3497, 37, 2533, 1574, 33, 259, 8979, 33, 198, 6738, 289, 8482, 62, 2220, 62, 69, 2533, 1574, 1330, 8778, 37, 2533, 1574, 11, 12793, 37, 2533, 1574, 2514, 30670, 11, 44707, 30670, 11, 5256, 589, 30670, 11, 12793, 16934, 2514, 30670, 11, 1148, 37, 2533, 1574, 28768, 11, 8778, 37, 2533, 1574, 4863, 30670, 198, 198, 2, 4347, 329, 262, 17802, 357, 25120, 8, 198, 15490, 796, 642, 30924, 198, 19499, 45746, 62, 50, 57, 796, 36117, 198, 37682, 1137, 62, 50, 57, 796, 718, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 198, 2, 41906, 17174, 46068, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 30751, 796, 1822, 29572, 13, 28100, 1713, 46677, 7, 11213, 796, 366, 49, 17653, 13993, 17802, 4382, 329, 13756, 51, 38886, 569, 16, 13, 15, 13, 15, 4943, 198, 220, 220, 220, 30751, 13, 2860, 62, 49140, 7203, 12, 67, 1600, 366, 438, 24442, 1600, 1037, 796, 366, 24442, 1241, 657, 25, 4844, 11, 352, 25, 287, 11, 362, 25, 503, 11, 513, 25, 287, 14, 448, 1600, 2099, 796, 493, 11, 4277, 796, 657, 8, 628, 220, 220, 220, 1303, 2547, 325, 262, 5128, 7159, 198, 220, 220, 220, 26498, 796, 30751, 13, 29572, 62, 22046, 3419, 628, 220, 220, 220, 1303, 44707, 262, 367, 3483, 4639, 198, 220, 220, 220, 30218, 70, 796, 289, 8482, 62, 7959, 62, 37581, 62, 83, 9783, 198, 220, 220, 220, 5412, 796, 367, 3483, 62, 9654, 7, 37581, 8, 628, 220, 220, 220, 1949, 25, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 13610, 257, 17802, 290, 6004, 319, 2493, 705, 15490, 6, 198, 220, 220, 220, 220, 220, 220, 220, 264, 796, 17802, 13, 44971, 7, 44971, 13, 8579, 62, 1268, 2767, 11, 17802, 13, 50, 11290, 62, 2257, 32235, 8, 198, 220, 220, 220, 220, 220, 220, 220, 264, 13, 21653, 7, 10786, 3256, 350, 9863, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 264, 13, 4868, 268, 7, 16, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 21699, 8787, 422, 2354, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 39105, 2727, 319, 2493, 4064, 67, 11, 4953, 329, 257, 4637, 1, 4064, 350, 9863, 8, 198, 220, 220, 220, 220, 220, 220, 220, 981, 6407, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7534, 5459, 11, 2209, 796, 264, 13, 13635, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 818, 4976, 4637, 422, 25, 4064, 82, 1, 4064, 2209, 58, 15, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3275, 796, 13538, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4043, 6030, 796, 366, 25677, 1, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 981, 6407, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6940, 796, 7534, 5459, 13, 8344, 85, 7, 19499, 45746, 62, 50, 57, 737, 12501, 1098, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 357, 36873, 6624, 13538, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 32048, 4838, 416, 262, 5456, 37633, 82, 16725, 4064, 2209, 58, 15, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2270, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3275, 15853, 6940, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 14808, 17077, 6030, 6624, 366, 25677, 4943, 290, 357, 11925, 7, 20500, 8, 18189, 39837, 1137, 62, 50, 57, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13639, 796, 3275, 58, 15, 25, 39837, 1137, 62, 50, 57, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3275, 796, 3275, 58, 37682, 1137, 62, 50, 57, 47715, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 23991, 30659, 796, 493, 7, 25677, 58, 17, 25, 718, 4357, 1467, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4043, 6030, 796, 366, 28758, 1, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 14808, 17077, 6030, 6624, 366, 28758, 4943, 290, 357, 11925, 7, 20500, 8, 18189, 23991, 30659, 8, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 23991, 796, 3275, 58, 15, 25, 23991, 30659, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3275, 796, 3275, 58, 28758, 30659, 47715, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 357, 22046, 13, 24442, 1222, 352, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 25677, 796, 4064, 82, 11, 23991, 796, 4064, 82, 1, 4064, 357, 25677, 11, 23991, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3280, 796, 2547, 325, 40109, 7, 28144, 11, 13639, 11, 23991, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 357, 22046, 13, 24442, 1222, 362, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 59, 83, 1, 1343, 3280, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7534, 5459, 13, 21280, 7, 41484, 13, 268, 8189, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4043, 6030, 796, 366, 25677, 1, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7534, 5459, 13, 19836, 3419, 628, 220, 220, 220, 2845, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 10697, 4423, 866, 4943, 628, 220, 220, 220, 1303, 13872, 262, 47068, 198, 220, 220, 220, 264, 13, 19836, 3419, 628, 220, 220, 220, 1303, 13872, 367, 3483, 4639, 198, 220, 220, 220, 367, 3483, 62, 19836, 7, 28144, 8, 198 ]
2.61779
1,439
import tensorflow as tf from .tf import TFDataset class TFCIFAR10(TFDataset): """`TFCIFAR10` class. Represents a CIFAR10 dataset class for TensorFlow. """ TF_MODULE = tf.keras.datasets.cifar10 DATASET_SIZE = {"train": 50000, "test": 10000} INPUT_SHAPE = (32, 32, 3) N_CLASSES = 10
[ 11748, 11192, 273, 11125, 355, 48700, 198, 198, 6738, 764, 27110, 1330, 24958, 27354, 292, 316, 628, 198, 4871, 309, 4851, 5064, 1503, 940, 7, 10234, 27354, 292, 316, 2599, 198, 220, 220, 220, 37227, 63, 51, 4851, 5064, 1503, 940, 63, 1398, 13, 628, 220, 220, 220, 1432, 6629, 257, 327, 5064, 1503, 940, 27039, 1398, 329, 309, 22854, 37535, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 24958, 62, 33365, 24212, 796, 48700, 13, 6122, 292, 13, 19608, 292, 1039, 13, 66, 361, 283, 940, 198, 220, 220, 220, 360, 1404, 1921, 2767, 62, 33489, 796, 19779, 27432, 1298, 642, 2388, 11, 366, 9288, 1298, 33028, 92, 198, 220, 220, 220, 3268, 30076, 62, 9693, 45721, 796, 357, 2624, 11, 3933, 11, 513, 8, 198, 220, 220, 220, 399, 62, 31631, 1546, 796, 838, 198 ]
2.258993
139
#!/usr/bin/env python # File name: name.py import sys import json import os import rsa import struct import json from block import * from controlblock import * base = [str(x) for x in range(10)] + [chr(x) for x in range(ord('A'), ord('A') + 6)] if __name__ == '__main__': print 'Signing Tool for the new Secure Boot validation. Version: 1.01' print ' This tool is to generate valid Configuration/Regional Blocks base on given DISK raw image' print ' Usage(windows platform): python27 signing.py config.json' print ' See the details in .json files' if len(sys.argv) != 2 : sys.exit(-1) SigningObjects = [] NewRegionBlock = [None,None,None,None] ConfigData = {} ConfigFile = sys.argv[1] with open(ConfigFile) as inputFile: ConfigData = json.load(inputFile) inputFile.close() pass ConfigData['Jobs'].sort(object_compare) print ConfigData['InputFile'] ''' Extract raw data from each section. ''' with open( ConfigData['InputFile'] , 'rb') as diskFile: TargetFileSize = os.path.getsize( ConfigData['InputFile'] ) fileContent = diskFile.read(TargetFileSize) diskFile.close() fileContent = bytearray(fileContent) MBR = fileContent[0:512] Partition1LBA, = struct.unpack("<I", fileContent[0x1C6:0x1C6+4] ) if Partition1LBA != 0: if Partition1LBA > 0x800 : print "Warning!!! The size of MBR+Booloader exceeds 2048 sectors." MBR = fileContent[0:Partition1LBA*512] MBR_obj = PartitionBlock(MBR, 0) MBR_obj.SetRawData(MBR) SigningObjects.append(MBR_obj) for dataElement in ConfigData['Jobs']: if dataElement['RegionID'] == 1: #MBR NewRegionBlock[0] = RegionBlock(int(dataElement['RegionID']), int(dataElement['HashingType']), dataElement['PrivateKeyFile']) NewRegionBlock[0].SigningRegionalData(MBR_obj.GetRawData()) with open(dataElement['OutputRawFile'], 'wb+') as OutputFile: OutputFile.write(MBR_obj.GetRawData()) OutputFile.close() for dataElement in ConfigData['Jobs']: if dataElement['RegionID'] != 1: PartIndex = dataElement['RegionID']-2 PartitionEntity = fileContent[0x1C6+0x10*PartIndex:0x1C6+0x10*PartIndex+8] PartitionLBA, PartitionSize = struct.unpack("<II", PartitionEntity ) if PartitionLBA == 0 or PartitionSize == 0: print "Error!!! The config does not match to the structure in MBR." sys.exit(-1) Part_Objs = PartitionBlock(PartitionEntity, 1) RawData = fileContent[Part_Objs.GetLBAStarting()*512: Part_Objs.GetLBAStarting()*512 + Part_Objs.GetSize()*512 ] Part_Objs.SetRawData(RawData) SigningObjects.append(Part_Objs) i = dataElement['RegionID']-1 NewRegionBlock[i] = RegionBlock(int(dataElement['RegionID']), int(dataElement['HashingType']), dataElement['PrivateKeyFile']) NewRegionBlock[i].SigningRegionalData(Part_Objs.GetRawData()) with open(dataElement['OutputRawFile'], 'wb+') as OutputFile: OutputFile.write(Part_Objs.GetRawData()) OutputFile.close() pass with open(ConfigData['OutputConfigBlock'], 'wb+') as OutputFile: OutputFile.write(fileContent) CB = ControlBlock(int(ConfigData['Version']), 3, ConfigData['PrivateKeyFile'], int(ConfigData['HashingType'])) # version, NumberOfRegions, CtrlPrivateKey, HashType for rb in NewRegionBlock: CB.add_region_block(rb) OutputFile.write(CB.GetRawData()) OutputFile.close() with open(ConfigData['OutputRawPubkey'], 'wb+') as PubRawFile: PubRawFile.write(CB.Get_Raw_Public_Key()) PubRawFile.close() pass else: print 'I am being imported from another module.'
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 9220, 1438, 25, 1438, 13, 9078, 198, 11748, 25064, 198, 11748, 33918, 198, 11748, 28686, 198, 11748, 374, 11400, 198, 11748, 2878, 198, 11748, 33918, 198, 6738, 2512, 1330, 1635, 198, 6738, 1630, 9967, 1330, 1635, 198, 198, 8692, 796, 685, 2536, 7, 87, 8, 329, 2124, 287, 2837, 7, 940, 15437, 1343, 685, 354, 81, 7, 87, 8, 329, 2124, 287, 2837, 7, 585, 10786, 32, 33809, 2760, 10786, 32, 11537, 1343, 718, 15437, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 3601, 705, 11712, 278, 16984, 329, 262, 649, 26707, 18892, 21201, 13, 10628, 25, 352, 13, 486, 6, 198, 220, 220, 220, 3601, 705, 220, 220, 220, 770, 2891, 318, 284, 7716, 4938, 28373, 14, 8081, 1538, 35111, 2779, 319, 1813, 13954, 42, 8246, 2939, 6, 198, 220, 220, 220, 3601, 705, 220, 220, 220, 29566, 7, 28457, 3859, 2599, 21015, 1983, 8415, 13, 9078, 4566, 13, 17752, 6, 198, 220, 220, 220, 3601, 705, 220, 220, 220, 4091, 262, 3307, 287, 764, 17752, 3696, 6, 628, 220, 220, 220, 611, 18896, 7, 17597, 13, 853, 85, 8, 14512, 362, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 25064, 13, 37023, 32590, 16, 8, 628, 220, 220, 220, 5865, 278, 10267, 82, 796, 17635, 198, 220, 220, 220, 968, 47371, 12235, 796, 685, 14202, 11, 14202, 11, 14202, 11, 14202, 60, 628, 220, 220, 220, 17056, 6601, 796, 23884, 198, 220, 220, 220, 17056, 8979, 796, 25064, 13, 853, 85, 58, 16, 60, 628, 220, 220, 220, 351, 1280, 7, 16934, 8979, 8, 355, 5128, 8979, 25, 198, 220, 220, 220, 220, 220, 220, 220, 17056, 6601, 796, 33918, 13, 2220, 7, 15414, 8979, 8, 198, 220, 220, 220, 220, 220, 220, 220, 5128, 8979, 13, 19836, 3419, 198, 220, 220, 220, 1208, 198, 220, 220, 220, 220, 198, 220, 220, 220, 17056, 6601, 17816, 41, 8158, 6, 4083, 30619, 7, 15252, 62, 5589, 533, 8, 628, 220, 220, 220, 3601, 17056, 6601, 17816, 20560, 8979, 20520, 628, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 220, 220, 220, 220, 29677, 8246, 1366, 422, 1123, 2665, 13, 198, 220, 220, 220, 705, 7061, 198, 220, 220, 220, 351, 1280, 7, 17056, 6601, 17816, 20560, 8979, 20520, 837, 705, 26145, 11537, 355, 11898, 8979, 25, 198, 220, 220, 220, 220, 220, 220, 220, 12744, 8979, 10699, 796, 28686, 13, 6978, 13, 11407, 1096, 7, 17056, 6601, 17816, 20560, 8979, 20520, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 2393, 19746, 796, 11898, 8979, 13, 961, 7, 21745, 8979, 10699, 8, 198, 220, 220, 220, 220, 220, 220, 220, 11898, 8979, 13, 19836, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 2393, 19746, 796, 416, 83, 451, 2433, 7, 7753, 19746, 8, 198, 220, 220, 220, 220, 220, 220, 220, 10771, 49, 796, 2393, 19746, 58, 15, 25, 25836, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 2142, 653, 16, 43, 4339, 11, 796, 2878, 13, 403, 8002, 7203, 27, 40, 1600, 2393, 19746, 58, 15, 87, 16, 34, 21, 25, 15, 87, 16, 34, 21, 10, 19, 60, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 611, 2142, 653, 16, 43, 4339, 14512, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2142, 653, 16, 43, 4339, 1875, 657, 87, 7410, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 366, 20361, 10185, 383, 2546, 286, 10771, 49, 10, 33, 970, 1170, 263, 21695, 36117, 16020, 526, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10771, 49, 796, 2393, 19746, 58, 15, 25, 7841, 653, 16, 43, 4339, 9, 25836, 60, 628, 220, 220, 220, 220, 220, 220, 220, 10771, 49, 62, 26801, 796, 2142, 653, 12235, 7, 10744, 49, 11, 657, 8, 198, 220, 220, 220, 220, 220, 220, 220, 10771, 49, 62, 26801, 13, 7248, 27369, 6601, 7, 10744, 49, 8, 198, 220, 220, 220, 220, 220, 220, 220, 5865, 278, 10267, 82, 13, 33295, 7, 10744, 49, 62, 26801, 8, 628, 220, 220, 220, 220, 220, 220, 220, 329, 1366, 20180, 287, 17056, 6601, 17816, 41, 8158, 6, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1366, 20180, 17816, 47371, 2389, 20520, 6624, 352, 25, 220, 220, 220, 1303, 10744, 49, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 968, 47371, 12235, 58, 15, 60, 796, 17718, 12235, 7, 600, 7, 7890, 20180, 17816, 47371, 2389, 20520, 828, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 493, 7, 7890, 20180, 17816, 39, 2140, 6030, 20520, 828, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1366, 20180, 17816, 29067, 9218, 8979, 6, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 968, 47371, 12235, 58, 15, 4083, 11712, 278, 8081, 1538, 6601, 7, 10744, 49, 62, 26801, 13, 3855, 27369, 6601, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 351, 1280, 7, 7890, 20180, 17816, 26410, 27369, 8979, 6, 4357, 705, 39346, 10, 11537, 355, 25235, 8979, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25235, 8979, 13, 13564, 7, 10744, 49, 62, 26801, 13, 3855, 27369, 6601, 28955, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25235, 8979, 13, 19836, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1366, 20180, 287, 17056, 6601, 17816, 41, 8158, 6, 5974, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 1366, 20180, 17816, 47371, 2389, 20520, 14512, 352, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2142, 15732, 796, 1366, 20180, 17816, 47371, 2389, 20520, 12, 17, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2142, 653, 32398, 796, 2393, 19746, 58, 15, 87, 16, 34, 21, 10, 15, 87, 940, 9, 7841, 15732, 25, 15, 87, 16, 34, 21, 10, 15, 87, 940, 9, 7841, 15732, 10, 23, 60, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2142, 653, 43, 4339, 11, 2142, 653, 10699, 796, 2878, 13, 403, 8002, 7203, 27, 3978, 1600, 2142, 653, 32398, 1267, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 611, 2142, 653, 43, 4339, 6624, 657, 393, 2142, 653, 10699, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 366, 12331, 10185, 383, 4566, 857, 407, 2872, 284, 262, 4645, 287, 10771, 49, 526, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25064, 13, 37023, 32590, 16, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2142, 62, 5944, 8457, 796, 2142, 653, 12235, 7, 7841, 653, 32398, 11, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16089, 6601, 796, 2393, 19746, 58, 7841, 62, 5944, 8457, 13, 3855, 43, 4339, 22851, 3419, 9, 25836, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2142, 62, 5944, 8457, 13, 3855, 43, 4339, 22851, 3419, 9, 25836, 1343, 2142, 62, 5944, 8457, 13, 3855, 10699, 3419, 9, 25836, 2361, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2142, 62, 5944, 8457, 13, 7248, 27369, 6601, 7, 27369, 6601, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 5865, 278, 10267, 82, 13, 33295, 7, 7841, 62, 5944, 8457, 8, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1312, 796, 1366, 20180, 17816, 47371, 2389, 20520, 12, 16, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 968, 47371, 12235, 58, 72, 60, 796, 17718, 12235, 7, 600, 7, 7890, 20180, 17816, 47371, 2389, 20520, 828, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 493, 7, 7890, 20180, 17816, 39, 2140, 6030, 20520, 828, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1366, 20180, 17816, 29067, 9218, 8979, 6, 12962, 628, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 968, 47371, 12235, 58, 72, 4083, 11712, 278, 8081, 1538, 6601, 7, 7841, 62, 5944, 8457, 13, 3855, 27369, 6601, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 351, 1280, 7, 7890, 20180, 17816, 26410, 27369, 8979, 6, 4357, 705, 39346, 10, 11537, 355, 25235, 8979, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25235, 8979, 13, 13564, 7, 7841, 62, 5944, 8457, 13, 3855, 27369, 6601, 28955, 220, 220, 220, 220, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 25235, 8979, 13, 19836, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1208, 628, 220, 220, 220, 351, 1280, 7, 16934, 6601, 17816, 26410, 16934, 12235, 6, 4357, 705, 39346, 10, 11537, 355, 25235, 8979, 25, 198, 220, 220, 220, 220, 220, 220, 220, 25235, 8979, 13, 13564, 7, 7753, 19746, 8, 198, 220, 220, 220, 220, 220, 220, 220, 10078, 796, 6779, 12235, 7, 600, 7, 16934, 6601, 17816, 14815, 20520, 828, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 513, 11, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17056, 6601, 17816, 29067, 9218, 8979, 6, 4357, 220, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 493, 7, 16934, 6601, 17816, 39, 2140, 6030, 20520, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 2196, 11, 7913, 5189, 8081, 507, 11, 19212, 29067, 9218, 11, 21059, 6030, 198, 220, 220, 220, 220, 220, 220, 220, 329, 374, 65, 287, 968, 47371, 12235, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 10078, 13, 2860, 62, 36996, 62, 9967, 7, 26145, 8, 628, 220, 220, 220, 220, 220, 220, 220, 25235, 8979, 13, 13564, 7, 23199, 13, 3855, 27369, 6601, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 25235, 8979, 13, 19836, 3419, 628, 220, 220, 220, 220, 220, 220, 220, 351, 1280, 7, 16934, 6601, 17816, 26410, 27369, 14876, 2539, 6, 4357, 705, 39346, 10, 11537, 355, 8525, 27369, 8979, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8525, 27369, 8979, 13, 13564, 7, 23199, 13, 3855, 62, 27369, 62, 15202, 62, 9218, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8525, 27369, 8979, 13, 19836, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 1208, 198, 17772, 25, 198, 220, 220, 220, 3601, 705, 40, 716, 852, 17392, 422, 1194, 8265, 2637, 198 ]
2.003538
2,261
#! /usr/bin/python # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import cgi import json import logging import os import subprocess import sys import tempfile import time _SRC_DIR = os.path.abspath(os.path.join( os.path.dirname(__file__), '..', '..', '..')) sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'catapult', 'devil')) from devil.android import device_utils from devil.android.sdk import intent sys.path.append(os.path.join(_SRC_DIR, 'build', 'android')) import devil_chromium from pylib import constants import activity_lens import clovis_constants import content_classification_lens import controller import device_setup import frame_load_lens import loading_graph_view import loading_graph_view_visualization import loading_trace import options import request_dependencies_lens import request_track import xvfb_helper # TODO(mattcary): logging.info isn't that useful, as the whole (tools) world # uses logging info; we need to introduce logging modules to get finer-grained # output. For now we just do logging.warning. OPTIONS = options.OPTIONS def _LoadPage(device, url): """Load a page on chrome on our device. Args: device: an AdbWrapper for the device on which to load the page. url: url as a string to load. """ load_intent = intent.Intent( package=OPTIONS.ChromePackage().package, activity=OPTIONS.ChromePackage().activity, data=url) logging.warning('Loading ' + url) device.StartActivity(load_intent, blocking=True) def _GetPrefetchHtml(graph_view, name=None): """Generate prefetch page for the resources in resource graph. Args: graph_view: (LoadingGraphView) name: optional string used in the generated page. Returns: HTML as a string containing all the link rel=prefetch directives necessary for prefetching the given ResourceGraph. """ if name: title = 'Prefetch for ' + cgi.escape(name) else: title = 'Generated prefetch page' output = [] output.append("""<!DOCTYPE html> <html> <head> <title>%s</title> """ % title) for node in graph_view.deps_graph.graph.Nodes(): output.append('<link rel="prefetch" href="%s">\n' % node.request.url) output.append("""</head> <body>%s</body> </html> """ % title) return '\n'.join(output) def _LogRequests(url, clear_cache_override=None): """Logs requests for a web page. Args: url: url to log as string. clear_cache_override: if not None, set clear_cache different from OPTIONS. Returns: JSON dict of logged information (ie, a dict that describes JSON). """ xvfb_process = None if OPTIONS.local: chrome_ctl = controller.LocalChromeController() if OPTIONS.headless: xvfb_process = xvfb_helper.LaunchXvfb() chrome_ctl.SetChromeEnvOverride(xvfb_helper.GetChromeEnvironment()) else: chrome_ctl = controller.RemoteChromeController( device_setup.GetFirstDevice()) clear_cache = (clear_cache_override if clear_cache_override is not None else OPTIONS.clear_cache) if OPTIONS.emulate_device: chrome_ctl.SetDeviceEmulation(OPTIONS.emulate_device) if OPTIONS.emulate_network: chrome_ctl.SetNetworkEmulation(OPTIONS.emulate_network) try: with chrome_ctl.Open() as connection: if clear_cache: connection.ClearCache() trace = loading_trace.LoadingTrace.RecordUrlNavigation( url, connection, chrome_ctl.ChromeMetadata(), categories=clovis_constants.DEFAULT_CATEGORIES) except controller.ChromeControllerError as e: e.Dump(sys.stderr) raise if xvfb_process: xvfb_process.terminate() return trace.ToJsonDict() def _FullFetch(url, json_output, prefetch): """Do a full fetch with optional prefetching.""" if not url.startswith('http') and not url.startswith('file'): url = 'http://' + url logging.warning('Cold fetch') cold_data = _LogRequests(url) assert cold_data, 'Cold fetch failed to produce data. Check your phone.' if prefetch: assert not OPTIONS.local logging.warning('Generating prefetch') prefetch_html = _GetPrefetchHtml(_ProcessJsonTrace(cold_data), name=url) tmp = tempfile.NamedTemporaryFile() tmp.write(prefetch_html) tmp.flush() # We hope that the tmpfile name is unique enough for the device. target = os.path.join('/sdcard/Download', os.path.basename(tmp.name)) device = device_setup.GetFirstDevice() device.adb.Push(tmp.name, target) logging.warning('Pushed prefetch %s to device at %s' % (tmp.name, target)) _LoadPage(device, 'file://' + target) time.sleep(OPTIONS.prefetch_delay_seconds) logging.warning('Warm fetch') warm_data = _LogRequests(url, clear_cache_override=False) with open(json_output, 'w') as f: json.dump(warm_data, f) logging.warning('Wrote ' + json_output) with open(json_output + '.cold', 'w') as f: json.dump(cold_data, f) logging.warning('Wrote ' + json_output + '.cold') else: with open(json_output, 'w') as f: json.dump(cold_data, f) logging.warning('Wrote ' + json_output) COMMAND_MAP = { 'png': DoPng, 'prefetch_setup': DoPrefetchSetup, 'log_requests': DoLogRequests, 'longpole': DoLongPole, 'nodecost': DoNodeCost, 'cost': DoCost, 'fetch': DoFetch, } if __name__ == '__main__': main()
[ 2, 0, 1220, 14629, 14, 8800, 14, 29412, 198, 2, 15069, 1853, 383, 18255, 1505, 46665, 13, 1439, 2489, 10395, 13, 198, 2, 5765, 286, 428, 2723, 2438, 318, 21825, 416, 257, 347, 10305, 12, 7635, 5964, 326, 460, 307, 198, 2, 1043, 287, 262, 38559, 24290, 2393, 13, 198, 198, 11748, 1822, 29572, 198, 11748, 269, 12397, 198, 11748, 33918, 198, 11748, 18931, 198, 11748, 28686, 198, 11748, 850, 14681, 198, 11748, 25064, 198, 11748, 20218, 7753, 198, 11748, 640, 198, 198, 62, 50, 7397, 62, 34720, 796, 28686, 13, 6978, 13, 397, 2777, 776, 7, 418, 13, 6978, 13, 22179, 7, 198, 220, 220, 220, 28686, 13, 6978, 13, 15908, 3672, 7, 834, 7753, 834, 828, 705, 492, 3256, 705, 492, 3256, 705, 492, 6, 4008, 198, 198, 17597, 13, 6978, 13, 33295, 7, 418, 13, 6978, 13, 22179, 28264, 50, 7397, 62, 34720, 11, 705, 17089, 62, 10608, 3256, 705, 9246, 41387, 3256, 705, 7959, 346, 6, 4008, 198, 6738, 17118, 13, 19411, 1330, 3335, 62, 26791, 198, 6738, 17118, 13, 19411, 13, 21282, 74, 1330, 6824, 198, 198, 17597, 13, 6978, 13, 33295, 7, 418, 13, 6978, 13, 22179, 28264, 50, 7397, 62, 34720, 11, 705, 11249, 3256, 705, 19411, 6, 4008, 198, 11748, 17118, 62, 28663, 1505, 198, 6738, 279, 2645, 571, 1330, 38491, 198, 198, 11748, 3842, 62, 75, 641, 198, 11748, 537, 709, 271, 62, 9979, 1187, 198, 11748, 2695, 62, 4871, 2649, 62, 75, 641, 198, 11748, 10444, 198, 11748, 3335, 62, 40406, 198, 11748, 5739, 62, 2220, 62, 75, 641, 198, 11748, 11046, 62, 34960, 62, 1177, 198, 11748, 11046, 62, 34960, 62, 1177, 62, 41464, 1634, 198, 11748, 11046, 62, 40546, 198, 11748, 3689, 198, 11748, 2581, 62, 45841, 3976, 62, 75, 641, 198, 11748, 2581, 62, 11659, 198, 11748, 2124, 85, 21855, 62, 2978, 525, 198, 198, 2, 16926, 46, 7, 76, 1078, 66, 560, 2599, 18931, 13, 10951, 2125, 470, 326, 4465, 11, 355, 262, 2187, 357, 31391, 8, 995, 198, 2, 3544, 18931, 7508, 26, 356, 761, 284, 10400, 18931, 13103, 284, 651, 38575, 12, 2164, 1328, 198, 2, 5072, 13, 1114, 783, 356, 655, 466, 18931, 13, 43917, 13, 628, 198, 3185, 51, 11053, 796, 3689, 13, 3185, 51, 11053, 628, 198, 4299, 4808, 8912, 9876, 7, 25202, 11, 19016, 2599, 198, 220, 37227, 8912, 257, 2443, 319, 32030, 319, 674, 3335, 13, 628, 220, 943, 14542, 25, 198, 220, 220, 220, 3335, 25, 281, 1215, 65, 36918, 2848, 329, 262, 3335, 319, 543, 284, 3440, 262, 2443, 13, 198, 220, 220, 220, 19016, 25, 19016, 355, 257, 4731, 284, 3440, 13, 198, 220, 37227, 198, 220, 3440, 62, 48536, 796, 6824, 13, 5317, 298, 7, 198, 220, 220, 220, 220, 220, 5301, 28, 3185, 51, 11053, 13, 1925, 5998, 27813, 22446, 26495, 11, 198, 220, 220, 220, 220, 220, 3842, 28, 3185, 51, 11053, 13, 1925, 5998, 27813, 22446, 21797, 11, 198, 220, 220, 220, 220, 220, 1366, 28, 6371, 8, 198, 220, 18931, 13, 43917, 10786, 19031, 705, 1343, 19016, 8, 198, 220, 3335, 13, 10434, 16516, 7, 2220, 62, 48536, 11, 12013, 28, 17821, 8, 628, 198, 4299, 4808, 3855, 36698, 7569, 39, 20369, 7, 34960, 62, 1177, 11, 1438, 28, 14202, 2599, 198, 220, 37227, 8645, 378, 7694, 7569, 2443, 329, 262, 4133, 287, 8271, 4823, 13, 628, 220, 943, 14542, 25, 198, 220, 220, 220, 4823, 62, 1177, 25, 357, 19031, 37065, 7680, 8, 198, 220, 220, 220, 1438, 25, 11902, 4731, 973, 287, 262, 7560, 2443, 13, 628, 220, 16409, 25, 198, 220, 220, 220, 11532, 355, 257, 4731, 7268, 477, 262, 2792, 823, 28, 3866, 69, 7569, 34819, 3306, 198, 220, 220, 220, 329, 7694, 7569, 278, 262, 1813, 20857, 37065, 13, 198, 220, 37227, 198, 220, 611, 1438, 25, 198, 220, 220, 220, 3670, 796, 705, 36698, 7569, 329, 705, 1343, 269, 12397, 13, 41915, 7, 3672, 8, 198, 220, 2073, 25, 198, 220, 220, 220, 3670, 796, 705, 8645, 515, 7694, 7569, 2443, 6, 198, 220, 5072, 796, 17635, 198, 220, 5072, 13, 33295, 7203, 15931, 27, 0, 18227, 4177, 56, 11401, 27711, 29, 198, 27, 6494, 29, 198, 27, 2256, 29, 198, 27, 7839, 29, 4, 82, 3556, 7839, 29, 198, 37811, 4064, 3670, 8, 198, 220, 329, 10139, 287, 4823, 62, 1177, 13, 10378, 82, 62, 34960, 13, 34960, 13, 45, 4147, 33529, 198, 220, 220, 220, 5072, 13, 33295, 10786, 27, 8726, 823, 2625, 3866, 69, 7569, 1, 13291, 2625, 4, 82, 5320, 59, 77, 6, 4064, 10139, 13, 25927, 13, 6371, 8, 198, 220, 5072, 13, 33295, 7203, 15931, 3556, 2256, 29, 198, 27, 2618, 29, 4, 82, 3556, 2618, 29, 198, 3556, 6494, 29, 198, 220, 37227, 4064, 3670, 8, 198, 220, 1441, 705, 59, 77, 4458, 22179, 7, 22915, 8, 628, 198, 4299, 4808, 11187, 16844, 3558, 7, 6371, 11, 1598, 62, 23870, 62, 2502, 13154, 28, 14202, 2599, 198, 220, 37227, 11187, 82, 7007, 329, 257, 3992, 2443, 13, 628, 220, 943, 14542, 25, 198, 220, 220, 220, 19016, 25, 19016, 284, 2604, 355, 4731, 13, 198, 220, 220, 220, 1598, 62, 23870, 62, 2502, 13154, 25, 611, 407, 6045, 11, 900, 1598, 62, 23870, 1180, 422, 39852, 11053, 13, 628, 220, 16409, 25, 198, 220, 220, 220, 19449, 8633, 286, 18832, 1321, 357, 494, 11, 257, 8633, 326, 8477, 19449, 737, 198, 220, 37227, 198, 220, 2124, 85, 21855, 62, 14681, 796, 6045, 198, 220, 611, 39852, 11053, 13, 12001, 25, 198, 220, 220, 220, 32030, 62, 34168, 796, 10444, 13, 14565, 1925, 5998, 22130, 3419, 198, 220, 220, 220, 611, 39852, 11053, 13, 2256, 1203, 25, 198, 220, 220, 220, 220, 220, 2124, 85, 21855, 62, 14681, 796, 220, 2124, 85, 21855, 62, 2978, 525, 13, 38296, 55, 85, 21855, 3419, 198, 220, 220, 220, 220, 220, 32030, 62, 34168, 13, 7248, 1925, 5998, 4834, 85, 37961, 7, 87, 85, 21855, 62, 2978, 525, 13, 3855, 1925, 5998, 31441, 28955, 198, 220, 2073, 25, 198, 220, 220, 220, 32030, 62, 34168, 796, 10444, 13, 36510, 1925, 5998, 22130, 7, 198, 220, 220, 220, 220, 220, 220, 220, 3335, 62, 40406, 13, 3855, 5962, 24728, 28955, 628, 220, 1598, 62, 23870, 796, 357, 20063, 62, 23870, 62, 2502, 13154, 611, 1598, 62, 23870, 62, 2502, 13154, 318, 407, 6045, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2073, 39852, 11053, 13, 20063, 62, 23870, 8, 198, 220, 611, 39852, 11053, 13, 368, 5039, 62, 25202, 25, 198, 220, 220, 220, 32030, 62, 34168, 13, 7248, 24728, 10161, 1741, 7, 3185, 51, 11053, 13, 368, 5039, 62, 25202, 8, 198, 220, 611, 39852, 11053, 13, 368, 5039, 62, 27349, 25, 198, 220, 220, 220, 32030, 62, 34168, 13, 7248, 26245, 10161, 1741, 7, 3185, 51, 11053, 13, 368, 5039, 62, 27349, 8, 198, 220, 1949, 25, 198, 220, 220, 220, 351, 32030, 62, 34168, 13, 11505, 3419, 355, 4637, 25, 198, 220, 220, 220, 220, 220, 611, 1598, 62, 23870, 25, 198, 220, 220, 220, 220, 220, 220, 220, 4637, 13, 19856, 30562, 3419, 198, 220, 220, 220, 220, 220, 12854, 796, 11046, 62, 40546, 13, 19031, 2898, 558, 13, 23739, 28165, 30575, 7065, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19016, 11, 4637, 11, 32030, 62, 34168, 13, 1925, 5998, 9171, 14706, 22784, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 9376, 28, 565, 709, 271, 62, 9979, 1187, 13, 7206, 38865, 62, 34, 6158, 38, 1581, 11015, 8, 198, 220, 2845, 10444, 13, 1925, 5998, 22130, 12331, 355, 304, 25, 198, 220, 220, 220, 304, 13, 35, 931, 7, 17597, 13, 301, 1082, 81, 8, 198, 220, 220, 220, 5298, 628, 220, 611, 2124, 85, 21855, 62, 14681, 25, 198, 220, 220, 220, 2124, 85, 21855, 62, 14681, 13, 23705, 378, 3419, 628, 220, 1441, 12854, 13, 2514, 41, 1559, 35, 713, 3419, 628, 198, 4299, 4808, 13295, 37, 7569, 7, 6371, 11, 33918, 62, 22915, 11, 7694, 7569, 2599, 198, 220, 37227, 5211, 257, 1336, 21207, 351, 11902, 7694, 7569, 278, 526, 15931, 198, 220, 611, 407, 19016, 13, 9688, 2032, 342, 10786, 4023, 11537, 290, 407, 19016, 13, 9688, 2032, 342, 10786, 7753, 6, 2599, 198, 220, 220, 220, 19016, 796, 705, 4023, 1378, 6, 1343, 19016, 198, 220, 18931, 13, 43917, 10786, 34312, 21207, 11537, 198, 220, 4692, 62, 7890, 796, 4808, 11187, 16844, 3558, 7, 6371, 8, 198, 220, 6818, 4692, 62, 7890, 11, 705, 34312, 21207, 4054, 284, 4439, 1366, 13, 6822, 534, 3072, 2637, 198, 220, 611, 7694, 7569, 25, 198, 220, 220, 220, 6818, 407, 39852, 11053, 13, 12001, 198, 220, 220, 220, 18931, 13, 43917, 10786, 8645, 803, 7694, 7569, 11537, 198, 220, 220, 220, 7694, 7569, 62, 6494, 796, 4808, 3855, 36698, 7569, 39, 20369, 28264, 18709, 41, 1559, 2898, 558, 7, 36673, 62, 7890, 828, 1438, 28, 6371, 8, 198, 220, 220, 220, 45218, 796, 20218, 7753, 13, 45, 2434, 12966, 5551, 8979, 3419, 198, 220, 220, 220, 45218, 13, 13564, 7, 3866, 69, 7569, 62, 6494, 8, 198, 220, 220, 220, 45218, 13, 25925, 3419, 198, 220, 220, 220, 1303, 775, 2911, 326, 262, 45218, 7753, 1438, 318, 3748, 1576, 329, 262, 3335, 13, 198, 220, 220, 220, 2496, 796, 28686, 13, 6978, 13, 22179, 10786, 14, 21282, 9517, 14, 10002, 3256, 28686, 13, 6978, 13, 12093, 12453, 7, 22065, 13, 3672, 4008, 198, 220, 220, 220, 3335, 796, 3335, 62, 40406, 13, 3855, 5962, 24728, 3419, 198, 220, 220, 220, 3335, 13, 324, 65, 13, 49222, 7, 22065, 13, 3672, 11, 2496, 8, 198, 220, 220, 220, 18931, 13, 43917, 10786, 47, 7474, 7694, 7569, 4064, 82, 284, 3335, 379, 4064, 82, 6, 4064, 357, 22065, 13, 3672, 11, 2496, 4008, 198, 220, 220, 220, 4808, 8912, 9876, 7, 25202, 11, 705, 7753, 1378, 6, 1343, 2496, 8, 198, 220, 220, 220, 640, 13, 42832, 7, 3185, 51, 11053, 13, 3866, 69, 7569, 62, 40850, 62, 43012, 8, 198, 220, 220, 220, 18931, 13, 43917, 10786, 54, 1670, 21207, 11537, 198, 220, 220, 220, 5814, 62, 7890, 796, 4808, 11187, 16844, 3558, 7, 6371, 11, 1598, 62, 23870, 62, 2502, 13154, 28, 25101, 8, 198, 220, 220, 220, 351, 1280, 7, 17752, 62, 22915, 11, 705, 86, 11537, 355, 277, 25, 198, 220, 220, 220, 220, 220, 33918, 13, 39455, 7, 31975, 62, 7890, 11, 277, 8, 198, 220, 220, 220, 18931, 13, 43917, 10786, 54, 2519, 705, 1343, 33918, 62, 22915, 8, 198, 220, 220, 220, 351, 1280, 7, 17752, 62, 22915, 1343, 45302, 36673, 3256, 705, 86, 11537, 355, 277, 25, 198, 220, 220, 220, 220, 220, 33918, 13, 39455, 7, 36673, 62, 7890, 11, 277, 8, 198, 220, 220, 220, 18931, 13, 43917, 10786, 54, 2519, 705, 1343, 33918, 62, 22915, 1343, 45302, 36673, 11537, 198, 220, 2073, 25, 198, 220, 220, 220, 351, 1280, 7, 17752, 62, 22915, 11, 705, 86, 11537, 355, 277, 25, 198, 220, 220, 220, 220, 220, 33918, 13, 39455, 7, 36673, 62, 7890, 11, 277, 8, 198, 220, 220, 220, 18931, 13, 43917, 10786, 54, 2519, 705, 1343, 33918, 62, 22915, 8, 628, 628, 628, 628, 628, 628, 198, 9858, 44, 6981, 62, 33767, 796, 1391, 198, 220, 220, 220, 705, 11134, 10354, 2141, 47, 782, 11, 198, 220, 220, 220, 705, 3866, 69, 7569, 62, 40406, 10354, 2141, 36698, 7569, 40786, 11, 198, 220, 220, 220, 705, 6404, 62, 8897, 3558, 10354, 2141, 11187, 16844, 3558, 11, 198, 220, 220, 220, 705, 6511, 36869, 10354, 2141, 14617, 47, 2305, 11, 198, 220, 220, 220, 705, 77, 375, 721, 455, 10354, 2141, 19667, 13729, 11, 198, 220, 220, 220, 705, 15805, 10354, 2141, 13729, 11, 198, 220, 220, 220, 705, 69, 7569, 10354, 2141, 37, 7569, 11, 198, 92, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 1388, 3419, 198 ]
2.744456
1,984
import random class NaiveResourceManager(object): r""" Overview: the naive resource manager Interface: __init__, assign_collector, assign_learner, update """ def __init__(self) -> None: r""" Overview: init the resouce manager """ self._worker_type = ['collector', 'learner'] self._resource_info = {k: {} for k in self._worker_type} def assign_collector(self, collector_task: dict) -> dict: r""" Overview: assign the collector_task randomly and return the resouce info Arguments: - collector_task (:obj:`dict`): the collector task to assign """ available_collector_list = list(self._resource_info['collector'].keys()) if len(available_collector_list) > 0: selected_collector = random.sample(available_collector_list, 1)[0] info = self._resource_info['collector'].pop(selected_collector) return {'collector_id': selected_collector, 'resource_info': info} else: return None def assign_learner(self, learner_task: dict) -> dict: r""" Overview: assign the learner_task randomly and return the resouce info Arguments: - learner_task (:obj:`dict`): the learner task to assign """ available_learner_list = list(self._resource_info['learner'].keys()) if len(available_learner_list) > 0: selected_learner = random.sample(available_learner_list, 1)[0] info = self._resource_info['learner'].pop(selected_learner) return {'learner_id': selected_learner, 'resource_info': info} else: return None def update(self, name: str, worker_id: str, resource_info: dict) -> None: r""" Overview: update the reource info """ assert name in self._worker_type, "invalid worker_type: {}".format(name) self._resource_info[name][worker_id] = resource_info
[ 11748, 4738, 628, 198, 4871, 11013, 425, 26198, 13511, 7, 15252, 2599, 198, 220, 220, 220, 374, 37811, 198, 220, 220, 220, 28578, 25, 198, 220, 220, 220, 220, 220, 220, 220, 262, 24354, 8271, 4706, 198, 220, 220, 220, 26491, 25, 198, 220, 220, 220, 220, 220, 220, 220, 11593, 15003, 834, 11, 8333, 62, 33327, 273, 11, 8333, 62, 3238, 1008, 11, 4296, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 8, 4613, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 374, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 28578, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2315, 262, 581, 280, 344, 4706, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 28816, 62, 4906, 796, 37250, 33327, 273, 3256, 705, 3238, 1008, 20520, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 31092, 62, 10951, 796, 1391, 74, 25, 23884, 329, 479, 287, 2116, 13557, 28816, 62, 4906, 92, 628, 220, 220, 220, 825, 8333, 62, 33327, 273, 7, 944, 11, 22967, 62, 35943, 25, 8633, 8, 4613, 8633, 25, 198, 220, 220, 220, 220, 220, 220, 220, 374, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 28578, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8333, 262, 22967, 62, 35943, 15456, 290, 1441, 262, 581, 280, 344, 7508, 198, 220, 220, 220, 220, 220, 220, 220, 20559, 2886, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 532, 22967, 62, 35943, 357, 25, 26801, 25, 63, 11600, 63, 2599, 262, 22967, 4876, 284, 8333, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1695, 62, 33327, 273, 62, 4868, 796, 1351, 7, 944, 13557, 31092, 62, 10951, 17816, 33327, 273, 6, 4083, 13083, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 15182, 62, 33327, 273, 62, 4868, 8, 1875, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6163, 62, 33327, 273, 796, 4738, 13, 39873, 7, 15182, 62, 33327, 273, 62, 4868, 11, 352, 38381, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7508, 796, 2116, 13557, 31092, 62, 10951, 17816, 33327, 273, 6, 4083, 12924, 7, 34213, 62, 33327, 273, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1391, 6, 33327, 273, 62, 312, 10354, 6163, 62, 33327, 273, 11, 705, 31092, 62, 10951, 10354, 7508, 92, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6045, 628, 220, 220, 220, 825, 8333, 62, 3238, 1008, 7, 944, 11, 22454, 1008, 62, 35943, 25, 8633, 8, 4613, 8633, 25, 198, 220, 220, 220, 220, 220, 220, 220, 374, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 28578, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8333, 262, 22454, 1008, 62, 35943, 15456, 290, 1441, 262, 581, 280, 344, 7508, 198, 220, 220, 220, 220, 220, 220, 220, 20559, 2886, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 532, 22454, 1008, 62, 35943, 357, 25, 26801, 25, 63, 11600, 63, 2599, 262, 22454, 1008, 4876, 284, 8333, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1695, 62, 3238, 1008, 62, 4868, 796, 1351, 7, 944, 13557, 31092, 62, 10951, 17816, 3238, 1008, 6, 4083, 13083, 28955, 198, 220, 220, 220, 220, 220, 220, 220, 611, 18896, 7, 15182, 62, 3238, 1008, 62, 4868, 8, 1875, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6163, 62, 3238, 1008, 796, 4738, 13, 39873, 7, 15182, 62, 3238, 1008, 62, 4868, 11, 352, 38381, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7508, 796, 2116, 13557, 31092, 62, 10951, 17816, 3238, 1008, 6, 4083, 12924, 7, 34213, 62, 3238, 1008, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 1391, 6, 3238, 1008, 62, 312, 10354, 6163, 62, 3238, 1008, 11, 705, 31092, 62, 10951, 10354, 7508, 92, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1441, 6045, 628, 220, 220, 220, 825, 4296, 7, 944, 11, 1438, 25, 965, 11, 8383, 62, 312, 25, 965, 11, 8271, 62, 10951, 25, 8633, 8, 4613, 6045, 25, 198, 220, 220, 220, 220, 220, 220, 220, 374, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 28578, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4296, 262, 302, 1668, 7508, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 6818, 1438, 287, 2116, 13557, 28816, 62, 4906, 11, 366, 259, 12102, 8383, 62, 4906, 25, 23884, 1911, 18982, 7, 3672, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13557, 31092, 62, 10951, 58, 3672, 7131, 28816, 62, 312, 60, 796, 8271, 62, 10951, 198 ]
2.314415
881
from rest_framework import serializers from .models import Ml_test #from .models import Account, Teleconference_transcribe from rest_framework import filters # class Teleconference_transcribeSerializer(serializers.HyperlinkedModelSerializer): # class Meta: # model = Teleconference_transcribe # fields = ['filename', 'transcription', 'transcription_baseline']
[ 6738, 1334, 62, 30604, 1330, 11389, 11341, 198, 6738, 764, 27530, 1330, 337, 75, 62, 9288, 198, 2, 6738, 764, 27530, 1330, 10781, 11, 14318, 41124, 62, 7645, 66, 4892, 198, 198, 6738, 1334, 62, 30604, 1330, 16628, 628, 198, 2, 1398, 14318, 41124, 62, 7645, 66, 4892, 32634, 7509, 7, 46911, 11341, 13, 38197, 25614, 17633, 32634, 7509, 2599, 198, 2, 220, 220, 220, 220, 1398, 30277, 25, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 2746, 796, 14318, 41124, 62, 7645, 66, 4892, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 7032, 796, 37250, 34345, 3256, 705, 7645, 6820, 3256, 705, 7645, 6820, 62, 12093, 4470, 20520 ]
3.380531
113
from tkinter import * from tkinter import filedialog from tkinter.ttk import * import os import xlrd import xlsxwriter root = Tk() root.title("CivilCon") root.iconbitmap("CC.ico") root.geometry("500x500") e = CivilCon(root) root.mainloop()
[ 6738, 256, 74, 3849, 1330, 1635, 201, 198, 6738, 256, 74, 3849, 1330, 5717, 498, 519, 201, 198, 6738, 256, 74, 3849, 13, 926, 74, 1330, 1635, 201, 198, 11748, 28686, 201, 198, 11748, 2124, 75, 4372, 201, 198, 11748, 2124, 7278, 87, 16002, 201, 198, 201, 198, 15763, 796, 309, 74, 3419, 201, 198, 15763, 13, 7839, 7203, 32610, 3103, 4943, 201, 198, 15763, 13, 4749, 2545, 8899, 7203, 4093, 13, 3713, 4943, 201, 198, 15763, 13, 469, 15748, 7203, 4059, 87, 4059, 4943, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 201, 198, 68, 796, 7511, 3103, 7, 15763, 8, 201, 198, 201, 198, 15763, 13, 12417, 26268, 3419, 201, 198 ]
2.247934
121
#!/usr/bin/env python3 # Copyright (C) 2016-2019 Semtech (International) AG. All rights reserved. # # This file is subject to the terms and conditions defined in file 'LICENSE', # which is part of this source code package. import os import shlex import sys import re import yaml from typing import Callable,Dict,List,Optional,Set,Tuple from typing import cast from argparse import Namespace as NS # type alias from cc import CommandCollection if __name__ == '__main__': ServiceTool().run()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 2, 15069, 357, 34, 8, 1584, 12, 23344, 12449, 13670, 357, 24274, 8, 13077, 13, 1439, 2489, 10395, 13, 198, 2, 198, 2, 770, 2393, 318, 2426, 284, 262, 2846, 290, 3403, 5447, 287, 2393, 705, 43, 2149, 24290, 3256, 198, 2, 543, 318, 636, 286, 428, 2723, 2438, 5301, 13, 198, 198, 11748, 28686, 198, 11748, 427, 2588, 198, 11748, 25064, 198, 11748, 302, 198, 11748, 331, 43695, 198, 198, 6738, 19720, 1330, 4889, 540, 11, 35, 713, 11, 8053, 11, 30719, 11, 7248, 11, 51, 29291, 198, 6738, 19720, 1330, 3350, 198, 6738, 1822, 29572, 1330, 28531, 10223, 355, 10896, 1303, 2099, 16144, 198, 198, 6738, 36624, 1330, 9455, 36307, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 4809, 25391, 22446, 5143, 3419, 198 ]
3.448276
145
import numpy as np import tensorflow as tf from tensorflow.keras import layers import matplotlib.pyplot as plt import math from tensorflow.keras.models import load_model from matplotlib import animation from env_predict import * from buffer import * from model import * from noise import * dt = 0.4 v = 1.0 ve = 1.2 #Dimension of State Space for single agent dim_agent_state = 5 num_agents = 3 #Dimension of State Space dim_state = dim_agent_state*num_agents #Number of Episodes num_episodes = 3000 #Number of Steps num_steps = 400 std_dev = 0.2 ou_noise = OUActionNoise(mean=np.zeros(1), std_deviation=float(std_dev) * np.ones(1)) ac_models = [] cr_models = [] target_ac = [] target_cr = [] path = 'C:/Users/HP/Desktop/desktop_folders/MS_Project_Codes/maddpg/maddpg_models/' for i in range(num_agents): ac_models.append(load_model(path + 'actor'+str(i)+'.h5')) cr_models.append(load_model(path + 'critic'+str(i)+'.h5')) target_ac.append(load_model(path + 'target_actor'+str(i)+'.h5')) target_cr.append(load_model(path + 'target_critic'+str(i)+'.h5')) ep_reward_list = [] # To store average reward history of last few episodes avg_reward_list = [] ag1_reward_list = [] ag2_reward_list = [] ev_reward_list = [] # Takes about 20 min to train for ep in range(1): env = environment() prev_state = env.initial_obs() episodic_reward = 0 ag1_reward = 0 ag2_reward = 0 ev_reward = 0 xp1 = [] yp1 = [] xp2 = [] yp2 = [] xce = [] yce = [] #while True: for i in range(400): tf_prev_state = tf.expand_dims(tf.convert_to_tensor(prev_state), 0) actions = [] for j, model in enumerate(ac_models): action = policy(tf_prev_state[:,5*j:5*(j+1)], ou_noise, model) actions.append(float(action[0])) # Recieve state and reward from environment. #new_state, sys_state, ev_state = transition(prev_state, sys_state, actions, ev_state) new_state = env.step(actions) rewards = reward(new_state) #buffer.record((prev_state, actions, rewards, new_state)) episodic_reward += sum(rewards) ag1_reward += rewards[0] ag2_reward += rewards[1] ev_reward += rewards[2] '''buffer.learn(ac_models, cr_models, target_ac, target_cr) update_target(tau, ac_models, cr_models, target_ac, target_cr)''' prev_state = new_state xp1.append(env.p1_rx) yp1.append(env.p1_ry) xp2.append(env.p2_rx) yp2.append(env.p2_ry) xce.append(env.e_rx) yce.append(env.e_ry) d_p1_e = L(env.p1_rx, env.p1_ry, env.e_rx, env.e_ry) d_p2_e = L(env.p2_rx, env.p2_ry, env.e_rx, env.e_ry) if d_p1_e < 0.4 or d_p2_e < 0.4: env = environment() prev_state = env.initial_obs() print("Captured") #break xc1 = [env.e_rx] yc1 = [env.e_ry] ep_reward_list.append(episodic_reward) ag1_reward_list.append(ag1_reward) ag2_reward_list.append(ag2_reward) ev_reward_list.append(ev_reward) # Mean of last 40 episodes avg_reward = np.mean(ep_reward_list[-40:]) print("Trajectory plot will be generated") avg_reward_list.append(avg_reward) plt.plot(xp1,yp1) plt.plot(xp2,yp2) plt.plot(xce,yce) plt.plot(xc1,yc1,'.') plt.plot(xp1[-1],yp1[-1],'*') plt.plot(xp2[-1],yp2[-1],'*') plt.show() print("Trajectory Animation will be generated") # Creating animation of the complete episode during execution # First set up the figure, the axis, and the plot element we want to animate fig = plt.figure() ax = plt.axes(xlim=(-1, 11), ylim=(-1, 11)) line, = ax.plot([], [], 'go') line1, = ax.plot([], [], 'go') line2, = ax.plot([], [], 'ro') # initialization function: plot the background of each frame # animation function. This is called sequentially # call the animator. blit=True means only re-draw the parts that have changed. anim = animation.FuncAnimation(fig, animate, init_func=init, frames=600, interval=1, blit=True) # save the animation as an mp4. This requires ffmpeg or mencoder to be # installed. The extra_args ensure that the x264 codec is used, so that # the video can be embedded in html5. You may need to adjust this for # your system: for more information, see # http://matplotlib.sourceforge.net/api/animation_api.html anim.save('basic_animation.mp4', fps=20, extra_args=['-vcodec', 'libx264']) # Plotting graph # Episodes versus Avg. Rewards plt.show()
[ 11748, 299, 32152, 355, 45941, 201, 198, 11748, 11192, 273, 11125, 355, 48700, 201, 198, 6738, 11192, 273, 11125, 13, 6122, 292, 1330, 11685, 201, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 201, 198, 11748, 10688, 201, 198, 6738, 11192, 273, 11125, 13, 6122, 292, 13, 27530, 1330, 3440, 62, 19849, 201, 198, 6738, 2603, 29487, 8019, 1330, 11034, 201, 198, 6738, 17365, 62, 79, 17407, 1330, 1635, 201, 198, 6738, 11876, 1330, 1635, 201, 198, 6738, 2746, 1330, 1635, 201, 198, 6738, 7838, 1330, 1635, 201, 198, 201, 198, 28664, 796, 657, 13, 19, 201, 198, 201, 198, 85, 796, 352, 13, 15, 201, 198, 303, 796, 352, 13, 17, 201, 198, 201, 198, 2, 29271, 3004, 286, 1812, 4687, 329, 2060, 5797, 201, 198, 27740, 62, 25781, 62, 5219, 796, 642, 201, 198, 201, 198, 22510, 62, 49638, 796, 513, 201, 198, 201, 198, 2, 29271, 3004, 286, 1812, 4687, 201, 198, 27740, 62, 5219, 796, 5391, 62, 25781, 62, 5219, 9, 22510, 62, 49638, 201, 198, 201, 198, 2, 15057, 286, 4551, 8052, 201, 198, 22510, 62, 538, 8052, 796, 20343, 201, 198, 201, 198, 2, 15057, 286, 32144, 201, 198, 22510, 62, 20214, 796, 7337, 201, 198, 201, 198, 201, 198, 19282, 62, 7959, 796, 657, 13, 17, 201, 198, 280, 62, 3919, 786, 796, 47070, 12502, 2949, 786, 7, 32604, 28, 37659, 13, 9107, 418, 7, 16, 828, 14367, 62, 7959, 3920, 28, 22468, 7, 19282, 62, 7959, 8, 1635, 45941, 13, 1952, 7, 16, 4008, 201, 198, 201, 198, 330, 62, 27530, 796, 17635, 201, 198, 6098, 62, 27530, 796, 17635, 201, 198, 16793, 62, 330, 796, 17635, 201, 198, 16793, 62, 6098, 796, 17635, 201, 198, 201, 198, 6978, 796, 705, 34, 14079, 14490, 14, 14082, 14, 36881, 14, 41375, 62, 11379, 364, 14, 5653, 62, 16775, 62, 34, 4147, 14, 76, 2860, 6024, 14, 76, 2860, 6024, 62, 27530, 14, 6, 201, 198, 201, 198, 1640, 1312, 287, 2837, 7, 22510, 62, 49638, 2599, 201, 198, 220, 936, 62, 27530, 13, 33295, 7, 2220, 62, 19849, 7, 6978, 1343, 705, 11218, 6, 10, 2536, 7, 72, 47762, 4458, 71, 20, 6, 4008, 220, 201, 198, 220, 1067, 62, 27530, 13, 33295, 7, 2220, 62, 19849, 7, 6978, 1343, 705, 22213, 291, 6, 10, 2536, 7, 72, 47762, 4458, 71, 20, 6, 4008, 201, 198, 201, 198, 220, 2496, 62, 330, 13, 33295, 7, 2220, 62, 19849, 7, 6978, 1343, 705, 16793, 62, 11218, 6, 10, 2536, 7, 72, 47762, 4458, 71, 20, 6, 4008, 201, 198, 220, 2496, 62, 6098, 13, 33295, 7, 2220, 62, 19849, 7, 6978, 1343, 705, 16793, 62, 22213, 291, 6, 10, 2536, 7, 72, 47762, 4458, 71, 20, 6, 4008, 201, 198, 201, 198, 201, 198, 201, 198, 201, 198, 538, 62, 260, 904, 62, 4868, 796, 17635, 201, 198, 2, 1675, 3650, 2811, 6721, 2106, 286, 938, 1178, 8640, 201, 198, 615, 70, 62, 260, 904, 62, 4868, 796, 17635, 201, 198, 201, 198, 363, 16, 62, 260, 904, 62, 4868, 796, 17635, 201, 198, 363, 17, 62, 260, 904, 62, 4868, 796, 17635, 201, 198, 1990, 62, 260, 904, 62, 4868, 796, 17635, 201, 198, 201, 198, 2, 33687, 546, 1160, 949, 284, 4512, 201, 198, 1640, 2462, 287, 2837, 7, 16, 2599, 201, 198, 201, 198, 220, 220, 220, 17365, 796, 2858, 3419, 201, 198, 220, 220, 220, 8654, 62, 5219, 796, 17365, 13, 36733, 62, 8158, 3419, 201, 198, 201, 198, 220, 220, 220, 220, 201, 198, 220, 220, 220, 48177, 29512, 62, 260, 904, 796, 657, 201, 198, 220, 220, 220, 556, 16, 62, 260, 904, 796, 657, 201, 198, 220, 220, 220, 556, 17, 62, 260, 904, 796, 657, 201, 198, 220, 220, 220, 819, 62, 260, 904, 796, 657, 201, 198, 220, 220, 220, 220, 201, 198, 220, 220, 220, 36470, 16, 796, 17635, 201, 198, 220, 220, 220, 331, 79, 16, 796, 17635, 201, 198, 220, 220, 220, 36470, 17, 796, 17635, 201, 198, 220, 220, 220, 331, 79, 17, 796, 17635, 201, 198, 220, 220, 220, 2124, 344, 796, 17635, 201, 198, 220, 220, 220, 331, 344, 796, 17635, 201, 198, 201, 198, 220, 220, 220, 220, 201, 198, 220, 220, 220, 1303, 4514, 6407, 25, 201, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 7029, 2599, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 201, 198, 220, 220, 220, 220, 220, 220, 220, 48700, 62, 47050, 62, 5219, 796, 48700, 13, 11201, 392, 62, 67, 12078, 7, 27110, 13, 1102, 1851, 62, 1462, 62, 83, 22854, 7, 47050, 62, 5219, 828, 657, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 4028, 796, 17635, 201, 198, 220, 220, 220, 220, 220, 220, 220, 329, 474, 11, 2746, 287, 27056, 378, 7, 330, 62, 27530, 2599, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 2223, 796, 2450, 7, 27110, 62, 47050, 62, 5219, 58, 45299, 20, 9, 73, 25, 20, 9, 7, 73, 10, 16, 8, 4357, 267, 84, 62, 3919, 786, 11, 2746, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 4028, 13, 33295, 7, 22468, 7, 2673, 58, 15, 60, 4008, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3311, 12311, 1181, 290, 6721, 422, 2858, 13, 201, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 3605, 62, 5219, 11, 25064, 62, 5219, 11, 819, 62, 5219, 796, 6801, 7, 47050, 62, 5219, 11, 25064, 62, 5219, 11, 4028, 11, 819, 62, 5219, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 649, 62, 5219, 796, 17365, 13, 9662, 7, 4658, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 11530, 796, 6721, 7, 3605, 62, 5219, 8, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 1303, 22252, 13, 22105, 19510, 47050, 62, 5219, 11, 4028, 11, 11530, 11, 649, 62, 5219, 4008, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 201, 198, 220, 220, 220, 220, 220, 220, 220, 48177, 29512, 62, 260, 904, 15853, 2160, 7, 260, 2017, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 556, 16, 62, 260, 904, 15853, 11530, 58, 15, 60, 201, 198, 220, 220, 220, 220, 220, 220, 220, 556, 17, 62, 260, 904, 15853, 11530, 58, 16, 60, 201, 198, 220, 220, 220, 220, 220, 220, 220, 819, 62, 260, 904, 15853, 11530, 58, 17, 60, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 705, 7061, 22252, 13, 35720, 7, 330, 62, 27530, 11, 1067, 62, 27530, 11, 2496, 62, 330, 11, 2496, 62, 6098, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 4296, 62, 16793, 7, 83, 559, 11, 936, 62, 27530, 11, 1067, 62, 27530, 11, 2496, 62, 330, 11, 2496, 62, 6098, 8, 7061, 6, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 8654, 62, 5219, 796, 649, 62, 5219, 201, 198, 220, 220, 220, 220, 220, 220, 220, 36470, 16, 13, 33295, 7, 24330, 13, 79, 16, 62, 40914, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 331, 79, 16, 13, 33295, 7, 24330, 13, 79, 16, 62, 563, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 36470, 17, 13, 33295, 7, 24330, 13, 79, 17, 62, 40914, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 331, 79, 17, 13, 33295, 7, 24330, 13, 79, 17, 62, 563, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 201, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 344, 13, 33295, 7, 24330, 13, 68, 62, 40914, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 331, 344, 13, 33295, 7, 24330, 13, 68, 62, 563, 8, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 288, 62, 79, 16, 62, 68, 796, 406, 7, 24330, 13, 79, 16, 62, 40914, 11, 17365, 13, 79, 16, 62, 563, 11, 17365, 13, 68, 62, 40914, 11, 17365, 13, 68, 62, 563, 8, 201, 198, 220, 220, 220, 220, 220, 220, 220, 288, 62, 79, 17, 62, 68, 796, 406, 7, 24330, 13, 79, 17, 62, 40914, 11, 17365, 13, 79, 17, 62, 563, 11, 17365, 13, 68, 62, 40914, 11, 17365, 13, 68, 62, 563, 8, 201, 198, 201, 198, 220, 220, 220, 220, 220, 220, 220, 611, 288, 62, 79, 16, 62, 68, 1279, 657, 13, 19, 393, 288, 62, 79, 17, 62, 68, 1279, 657, 13, 19, 25, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 17365, 796, 2858, 3419, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8654, 62, 5219, 796, 17365, 13, 36733, 62, 8158, 3419, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 19209, 1522, 4943, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 9032, 201, 198, 201, 198, 220, 220, 220, 220, 201, 198, 201, 198, 201, 198, 220, 220, 220, 2124, 66, 16, 796, 685, 24330, 13, 68, 62, 40914, 60, 201, 198, 220, 220, 220, 331, 66, 16, 796, 685, 24330, 13, 68, 62, 563, 60, 201, 198, 201, 198, 220, 220, 220, 2462, 62, 260, 904, 62, 4868, 13, 33295, 7, 538, 271, 29512, 62, 260, 904, 8, 201, 198, 220, 220, 220, 556, 16, 62, 260, 904, 62, 4868, 13, 33295, 7, 363, 16, 62, 260, 904, 8, 201, 198, 220, 220, 220, 556, 17, 62, 260, 904, 62, 4868, 13, 33295, 7, 363, 17, 62, 260, 904, 8, 201, 198, 220, 220, 220, 819, 62, 260, 904, 62, 4868, 13, 33295, 7, 1990, 62, 260, 904, 8, 201, 198, 201, 198, 220, 220, 220, 1303, 22728, 286, 938, 2319, 8640, 201, 198, 220, 220, 220, 42781, 62, 260, 904, 796, 45941, 13, 32604, 7, 538, 62, 260, 904, 62, 4868, 58, 12, 1821, 25, 12962, 201, 198, 220, 220, 220, 3601, 7203, 15721, 752, 652, 7110, 481, 307, 7560, 4943, 201, 198, 220, 220, 220, 42781, 62, 260, 904, 62, 4868, 13, 33295, 7, 615, 70, 62, 260, 904, 8, 201, 198, 220, 220, 220, 458, 83, 13, 29487, 7, 42372, 16, 11, 4464, 16, 8, 201, 198, 220, 220, 220, 458, 83, 13, 29487, 7, 42372, 17, 11, 4464, 17, 8, 201, 198, 220, 220, 220, 458, 83, 13, 29487, 7, 87, 344, 11, 88, 344, 8, 201, 198, 220, 220, 220, 458, 83, 13, 29487, 7, 25306, 16, 11, 88, 66, 16, 4032, 2637, 8, 220, 201, 198, 220, 220, 220, 458, 83, 13, 29487, 7, 42372, 16, 58, 12, 16, 4357, 4464, 16, 58, 12, 16, 60, 4032, 9, 11537, 201, 198, 220, 220, 220, 458, 83, 13, 29487, 7, 42372, 17, 58, 12, 16, 4357, 4464, 17, 58, 12, 16, 60, 4032, 9, 11537, 201, 198, 201, 198, 489, 83, 13, 12860, 3419, 201, 198, 220, 220, 220, 220, 201, 198, 4798, 7203, 15721, 752, 652, 23535, 481, 307, 7560, 4943, 201, 198, 2, 30481, 11034, 286, 262, 1844, 4471, 1141, 9706, 201, 198, 2, 3274, 900, 510, 262, 3785, 11, 262, 16488, 11, 290, 262, 7110, 5002, 356, 765, 284, 43828, 201, 198, 5647, 796, 458, 83, 13, 26875, 3419, 201, 198, 897, 796, 458, 83, 13, 897, 274, 7, 87, 2475, 16193, 12, 16, 11, 1367, 828, 331, 2475, 16193, 12, 16, 11, 1367, 4008, 201, 198, 1370, 11, 796, 7877, 13, 29487, 26933, 4357, 685, 4357, 705, 2188, 11537, 201, 198, 1370, 16, 11, 796, 7877, 13, 29487, 26933, 4357, 685, 4357, 705, 2188, 11537, 201, 198, 1370, 17, 11, 796, 7877, 13, 29487, 26933, 4357, 685, 4357, 705, 305, 11537, 201, 198, 201, 198, 2, 37588, 2163, 25, 7110, 262, 4469, 286, 1123, 5739, 201, 198, 201, 198, 2, 11034, 2163, 13, 220, 770, 318, 1444, 4726, 3746, 201, 198, 201, 198, 2, 869, 262, 2355, 1352, 13, 220, 698, 270, 28, 17821, 1724, 691, 302, 12, 19334, 262, 3354, 326, 423, 3421, 13, 201, 198, 11227, 796, 11034, 13, 37, 19524, 39520, 7, 5647, 11, 43828, 11, 2315, 62, 20786, 28, 15003, 11, 201, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13431, 28, 8054, 11, 16654, 28, 16, 11, 698, 270, 28, 17821, 8, 201, 198, 201, 198, 2, 3613, 262, 11034, 355, 281, 29034, 19, 13, 220, 770, 4433, 31246, 43913, 393, 1450, 66, 12342, 284, 307, 201, 198, 2, 6589, 13, 220, 383, 3131, 62, 22046, 4155, 326, 262, 2124, 18897, 40481, 318, 973, 11, 523, 326, 201, 198, 2, 262, 2008, 460, 307, 14553, 287, 27711, 20, 13, 220, 921, 743, 761, 284, 4532, 428, 329, 201, 198, 2, 534, 1080, 25, 329, 517, 1321, 11, 766, 201, 198, 2, 2638, 1378, 6759, 29487, 8019, 13, 10459, 30293, 13, 3262, 14, 15042, 14, 11227, 341, 62, 15042, 13, 6494, 201, 198, 11227, 13, 21928, 10786, 35487, 62, 11227, 341, 13, 3149, 19, 3256, 32977, 28, 1238, 11, 3131, 62, 22046, 28, 17816, 12, 85, 19815, 721, 3256, 705, 8019, 87, 18897, 6, 12962, 201, 198, 201, 198, 2, 28114, 889, 4823, 201, 198, 2, 4551, 8052, 9051, 33455, 13, 27964, 201, 198, 201, 198, 489, 83, 13, 12860, 3419, 201, 198 ]
2.13092
2,238
from ostinato.pages.views import PageView from django.views.generic.detail import DetailView from django.views.generic.dates import DateDetailView from ostinato.pages.models import Page from blog.models import Entry
[ 6738, 23619, 259, 5549, 13, 31126, 13, 33571, 1330, 7873, 7680, 198, 6738, 42625, 14208, 13, 33571, 13, 41357, 13, 49170, 1330, 42585, 7680, 198, 6738, 42625, 14208, 13, 33571, 13, 41357, 13, 19581, 1330, 7536, 11242, 603, 7680, 198, 198, 6738, 23619, 259, 5549, 13, 31126, 13, 27530, 1330, 7873, 198, 6738, 4130, 13, 27530, 1330, 21617, 628, 628, 198 ]
3.622951
61
"""Load article sample (1%) into spreadsheet for manual content analysis""" import pandas as pd import utils from question_1.is_about_climate_change_sql_statement import is_about_climate_change_sql_statement import os.path if __name__ == "__main__": main()
[ 37811, 8912, 2708, 6291, 357, 16, 4407, 656, 30117, 329, 10107, 2695, 3781, 37811, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 3384, 4487, 198, 6738, 1808, 62, 16, 13, 271, 62, 10755, 62, 42570, 62, 3803, 62, 25410, 62, 26090, 1330, 318, 62, 10755, 62, 42570, 62, 3803, 62, 25410, 62, 26090, 198, 11748, 28686, 13, 6978, 628, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1388, 3419, 198 ]
3.341772
79
import numpy from srxraylib.plot.gol import plot import scipy.constants as codata import xraylib if __name__ == "__main__": do_calculate_spectrum = True diamond_thickness_in_mm = 0.8 outfile = "spectrumE.dat" rho = 1.848 if do_calculate_spectrum: energy, flux = create_spectrum() energy, flux = diamond_filter(energy, flux, diamond_thickness_in_mm=diamond_thickness_in_mm) f = open(outfile, "w") for i in range(energy.size): f.write("%g %g\n" % (energy[i], flux[i])) f.close() print("File %s written to disk." % outfile) energy_for_pescao, flux_for_pescao = remove_points_for_pescao(energy, flux) f = open("spectrumEF.dat", "w") for i in range(energy_for_pescao.size): f.write("%g %g\n" % (energy_for_pescao[i], flux_for_pescao[i])) f.close() print("File %s written to disk." % "spectrumEF.dat") else: # just read file with spectrum a = numpy.loadtxt(outfile) energy = a[:,0] flux = a[:,1] spectral_power = flux * 1e3 * codata.e estep = (energy[1] - energy[0]) integrated_power = (spectral_power.sum() * estep) print("integrated power", integrated_power) print("volumetric power", integrated_power / (0.8**2)) # # NIST data # nist = nist_be() print(nist.shape) nist_interpolated = 10 ** numpy.interp(numpy.log10(energy), numpy.log10(1e6 * nist[:,0]), numpy.log10(rho * nist[:,2])) # plot(1e6 * nist[:, 0], nist[:, 1], # 1e6 * nist[:, 0], nist[:, 2], # energy, nist_interpolated/rho, xlog=1, ylog=1, # xtitle="Photon energy [eV]", ytitle="[cm2/g]") # # xraylib data # XRL_MU = numpy.zeros_like(energy) XRL_MU_E = numpy.zeros_like(energy) for i in range(energy.size): XRL_MU[i] = rho * xraylib.CS_Total(xraylib.SymbolToAtomicNumber("Be"), 1e-3*energy[i]) XRL_MU_E[i] = rho * xraylib.CS_Energy(xraylib.SymbolToAtomicNumber("Be"), 1e-3*energy[i]) plot( 1e-3 * energy, XRL_MU, 1e-3 * energy, XRL_MU_E, 1e-3 * energy, nist_interpolated, xlog=0, ylog=1, legend=["mu","mu_e","nist_e"], xtitle="Photon energy [keV]", ytitle="mu [cm^-1]") # # loop on thicknesses # THICKNESS_MM = numpy.concatenate( (numpy.linspace(0,1,100),numpy.linspace(1,10,50))) VOLUMETRIC_ABSORBED_POWER = numpy.zeros_like(THICKNESS_MM) VOLUMETRIC_ABSORBED_POWER_E = numpy.zeros_like(THICKNESS_MM) VOLUMETRIC_ABSORBED_POWER_NIST = numpy.zeros_like(THICKNESS_MM) for i, thickness_mm in enumerate(THICKNESS_MM): thickness_mm = THICKNESS_MM[i] absorbed_fraction = 1.0 - numpy.exp(-XRL_MU * thickness_mm * 1e-1) absorbed_fraction_e = 1.0 - numpy.exp(-XRL_MU_E * thickness_mm * 1e-1) absorbed_fraction_nist = 1.0 - numpy.exp(-nist_interpolated * thickness_mm * 1e-1) # plot(energy, absorbed_fraction, energy, absorbed_fraction_e) absorbed_power = (flux * absorbed_fraction * codata.e * 1e3).sum() * estep volumetric_absorbed_power = absorbed_power / (0.8 * 0.8 * thickness_mm) absorbed_power_e = (flux * absorbed_fraction_e * codata.e * 1e3).sum() * estep volumetric_absorbed_power_e = absorbed_power_e / (0.8 * 0.8 * thickness_mm) absorbed_power_nist = (flux * absorbed_fraction_nist * codata.e * 1e3).sum() * estep volumetric_absorbed_power_nist = absorbed_power_nist / (0.8 * 0.8 * thickness_mm) VOLUMETRIC_ABSORBED_POWER[i] = volumetric_absorbed_power VOLUMETRIC_ABSORBED_POWER_E[i] = volumetric_absorbed_power_e VOLUMETRIC_ABSORBED_POWER_NIST[i] = volumetric_absorbed_power_nist print(integrated_power, absorbed_power, volumetric_absorbed_power) print(integrated_power, absorbed_power_e, volumetric_absorbed_power_e) # # load pescao results and make final plot # pescao = numpy.loadtxt("pescao_0p8.dat", skiprows=2) plot(THICKNESS_MM, VOLUMETRIC_ABSORBED_POWER, THICKNESS_MM, VOLUMETRIC_ABSORBED_POWER_E, THICKNESS_MM, VOLUMETRIC_ABSORBED_POWER_NIST, pescao[:,0], pescao[:,1]/(pescao[:,0] * 0.8 * 0.8), xtitle="Depth [mm]", ytitle="Volumetric absorption [W/mm3]", title="diamond window thickness = %g mm" % diamond_thickness_in_mm, legend=["mu","mu_e","nist_e","Monte Carlo"])
[ 11748, 299, 32152, 198, 6738, 19677, 87, 2433, 8019, 13, 29487, 13, 70, 349, 1330, 7110, 198, 11748, 629, 541, 88, 13, 9979, 1187, 355, 14873, 1045, 198, 11748, 2124, 2433, 8019, 628, 628, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 466, 62, 9948, 3129, 378, 62, 4443, 6582, 796, 6407, 198, 220, 220, 220, 15291, 62, 400, 624, 1108, 62, 259, 62, 3020, 796, 657, 13, 23, 628, 198, 220, 220, 220, 503, 7753, 796, 366, 4443, 6582, 36, 13, 19608, 1, 198, 220, 220, 220, 374, 8873, 796, 352, 13, 23, 2780, 628, 220, 220, 220, 611, 466, 62, 9948, 3129, 378, 62, 4443, 6582, 25, 198, 220, 220, 220, 220, 220, 220, 220, 2568, 11, 28462, 796, 2251, 62, 4443, 6582, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 2568, 11, 28462, 796, 15291, 62, 24455, 7, 22554, 11, 28462, 11, 15291, 62, 400, 624, 1108, 62, 259, 62, 3020, 28, 67, 8446, 62, 400, 624, 1108, 62, 259, 62, 3020, 8, 198, 220, 220, 220, 220, 220, 220, 220, 277, 796, 1280, 7, 448, 7753, 11, 366, 86, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 2837, 7, 22554, 13, 7857, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 4, 70, 220, 4064, 70, 59, 77, 1, 4064, 357, 22554, 58, 72, 4357, 28462, 58, 72, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 277, 13, 19836, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 8979, 4064, 82, 3194, 284, 11898, 526, 4064, 503, 7753, 8, 628, 220, 220, 220, 220, 220, 220, 220, 2568, 62, 1640, 62, 79, 3798, 5488, 11, 28462, 62, 1640, 62, 79, 3798, 5488, 796, 4781, 62, 13033, 62, 1640, 62, 79, 3798, 5488, 7, 22554, 11, 28462, 8, 198, 220, 220, 220, 220, 220, 220, 220, 277, 796, 1280, 7203, 4443, 6582, 25425, 13, 19608, 1600, 366, 86, 4943, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 2837, 7, 22554, 62, 1640, 62, 79, 3798, 5488, 13, 7857, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 277, 13, 13564, 7203, 4, 70, 220, 4064, 70, 59, 77, 1, 4064, 357, 22554, 62, 1640, 62, 79, 3798, 5488, 58, 72, 4357, 28462, 62, 1640, 62, 79, 3798, 5488, 58, 72, 60, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 277, 13, 19836, 3419, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7203, 8979, 4064, 82, 3194, 284, 11898, 526, 4064, 366, 4443, 6582, 25425, 13, 19608, 4943, 628, 220, 220, 220, 2073, 25, 1303, 655, 1100, 2393, 351, 10958, 198, 220, 220, 220, 220, 220, 220, 220, 257, 796, 299, 32152, 13, 2220, 14116, 7, 448, 7753, 8, 198, 220, 220, 220, 220, 220, 220, 220, 2568, 796, 257, 58, 45299, 15, 60, 198, 220, 220, 220, 220, 220, 220, 220, 28462, 796, 257, 58, 45299, 16, 60, 628, 198, 220, 220, 220, 37410, 62, 6477, 796, 28462, 1635, 352, 68, 18, 1635, 14873, 1045, 13, 68, 198, 220, 220, 220, 1556, 538, 796, 357, 22554, 58, 16, 60, 532, 2568, 58, 15, 12962, 198, 220, 220, 220, 11521, 62, 6477, 796, 357, 4443, 1373, 62, 6477, 13, 16345, 3419, 1635, 1556, 538, 8, 198, 220, 220, 220, 3601, 7203, 18908, 4111, 1176, 1600, 11521, 62, 6477, 8, 198, 220, 220, 220, 3601, 7203, 10396, 388, 19482, 1176, 1600, 11521, 62, 6477, 1220, 357, 15, 13, 23, 1174, 17, 4008, 628, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 399, 8808, 1366, 198, 220, 220, 220, 1303, 628, 220, 220, 220, 299, 396, 796, 299, 396, 62, 1350, 3419, 198, 220, 220, 220, 3601, 7, 77, 396, 13, 43358, 8, 198, 220, 220, 220, 299, 396, 62, 3849, 16104, 515, 796, 838, 12429, 299, 32152, 13, 3849, 79, 7, 77, 32152, 13, 6404, 940, 7, 22554, 828, 299, 32152, 13, 6404, 940, 7, 16, 68, 21, 1635, 299, 396, 58, 45299, 15, 46570, 299, 32152, 13, 6404, 940, 7, 81, 8873, 1635, 299, 396, 58, 45299, 17, 60, 4008, 198, 220, 220, 220, 1303, 7110, 7, 16, 68, 21, 1635, 299, 396, 58, 45299, 657, 4357, 299, 396, 58, 45299, 352, 4357, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 352, 68, 21, 1635, 299, 396, 58, 45299, 657, 4357, 299, 396, 58, 45299, 362, 4357, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 2568, 11, 299, 396, 62, 3849, 16104, 515, 14, 81, 8873, 11, 2124, 6404, 28, 16, 11, 331, 6404, 28, 16, 11, 198, 220, 220, 220, 1303, 220, 220, 220, 220, 220, 220, 742, 2578, 2625, 2725, 18970, 2568, 685, 68, 53, 60, 1600, 331, 7839, 2625, 58, 11215, 17, 14, 70, 60, 4943, 628, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 2124, 2433, 8019, 1366, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1395, 7836, 62, 42422, 796, 299, 32152, 13, 9107, 418, 62, 2339, 7, 22554, 8, 198, 220, 220, 220, 1395, 7836, 62, 42422, 62, 36, 796, 299, 32152, 13, 9107, 418, 62, 2339, 7, 22554, 8, 628, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 22554, 13, 7857, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 1395, 7836, 62, 42422, 58, 72, 60, 796, 374, 8873, 1635, 2124, 2433, 8019, 13, 7902, 62, 14957, 7, 87, 2433, 8019, 13, 13940, 23650, 2514, 2953, 10179, 15057, 7203, 3856, 12340, 352, 68, 12, 18, 9, 22554, 58, 72, 12962, 198, 220, 220, 220, 220, 220, 220, 220, 1395, 7836, 62, 42422, 62, 36, 58, 72, 60, 796, 374, 8873, 1635, 2124, 2433, 8019, 13, 7902, 62, 28925, 7, 87, 2433, 8019, 13, 13940, 23650, 2514, 2953, 10179, 15057, 7203, 3856, 12340, 352, 68, 12, 18, 9, 22554, 58, 72, 12962, 628, 220, 220, 220, 7110, 7, 198, 220, 220, 220, 220, 220, 220, 220, 352, 68, 12, 18, 1635, 2568, 11, 1395, 7836, 62, 42422, 11, 198, 220, 220, 220, 220, 220, 220, 220, 352, 68, 12, 18, 1635, 2568, 11, 1395, 7836, 62, 42422, 62, 36, 11, 198, 220, 220, 220, 220, 220, 220, 220, 352, 68, 12, 18, 1635, 2568, 11, 299, 396, 62, 3849, 16104, 515, 11, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 6404, 28, 15, 11, 331, 6404, 28, 16, 11, 8177, 28, 14692, 30300, 2430, 30300, 62, 68, 2430, 77, 396, 62, 68, 33116, 198, 220, 220, 220, 220, 220, 220, 220, 220, 742, 2578, 2625, 2725, 18970, 2568, 685, 365, 53, 60, 1600, 331, 7839, 2625, 30300, 685, 11215, 61, 12, 16, 60, 4943, 628, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 9052, 319, 20735, 274, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 2320, 11860, 31097, 62, 12038, 796, 299, 32152, 13, 1102, 9246, 268, 378, 7, 357, 77, 32152, 13, 21602, 10223, 7, 15, 11, 16, 11, 3064, 828, 77, 32152, 13, 21602, 10223, 7, 16, 11, 940, 11, 1120, 22305, 628, 220, 220, 220, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 796, 299, 32152, 13, 9107, 418, 62, 2339, 7, 4221, 11860, 31097, 62, 12038, 8, 198, 220, 220, 220, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 62, 36, 796, 299, 32152, 13, 9107, 418, 62, 2339, 7, 4221, 11860, 31097, 62, 12038, 8, 198, 220, 220, 220, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 62, 45, 8808, 796, 299, 32152, 13, 9107, 418, 62, 2339, 7, 4221, 11860, 31097, 62, 12038, 8, 628, 220, 220, 220, 329, 1312, 11, 20735, 62, 3020, 287, 27056, 378, 7, 4221, 11860, 31097, 62, 12038, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 20735, 62, 3020, 796, 2320, 11860, 31097, 62, 12038, 58, 72, 60, 198, 220, 220, 220, 220, 220, 220, 220, 19233, 62, 69, 7861, 796, 352, 13, 15, 532, 299, 32152, 13, 11201, 32590, 55, 7836, 62, 42422, 1635, 20735, 62, 3020, 1635, 352, 68, 12, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 19233, 62, 69, 7861, 62, 68, 796, 352, 13, 15, 532, 299, 32152, 13, 11201, 32590, 55, 7836, 62, 42422, 62, 36, 1635, 20735, 62, 3020, 1635, 352, 68, 12, 16, 8, 198, 220, 220, 220, 220, 220, 220, 220, 19233, 62, 69, 7861, 62, 77, 396, 796, 352, 13, 15, 532, 299, 32152, 13, 11201, 32590, 77, 396, 62, 3849, 16104, 515, 1635, 20735, 62, 3020, 1635, 352, 68, 12, 16, 8, 628, 220, 220, 220, 220, 220, 220, 220, 1303, 7110, 7, 22554, 11, 19233, 62, 69, 7861, 11, 2568, 11, 19233, 62, 69, 7861, 62, 68, 8, 628, 220, 220, 220, 220, 220, 220, 220, 19233, 62, 6477, 796, 357, 69, 22564, 1635, 19233, 62, 69, 7861, 1635, 14873, 1045, 13, 68, 1635, 352, 68, 18, 737, 16345, 3419, 1635, 1556, 538, 198, 220, 220, 220, 220, 220, 220, 220, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 796, 19233, 62, 6477, 1220, 357, 15, 13, 23, 1635, 657, 13, 23, 1635, 20735, 62, 3020, 8, 628, 220, 220, 220, 220, 220, 220, 220, 19233, 62, 6477, 62, 68, 796, 357, 69, 22564, 1635, 19233, 62, 69, 7861, 62, 68, 1635, 14873, 1045, 13, 68, 1635, 352, 68, 18, 737, 16345, 3419, 1635, 1556, 538, 198, 220, 220, 220, 220, 220, 220, 220, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 62, 68, 796, 19233, 62, 6477, 62, 68, 1220, 357, 15, 13, 23, 1635, 657, 13, 23, 1635, 20735, 62, 3020, 8, 628, 220, 220, 220, 220, 220, 220, 220, 19233, 62, 6477, 62, 77, 396, 796, 357, 69, 22564, 1635, 19233, 62, 69, 7861, 62, 77, 396, 1635, 14873, 1045, 13, 68, 1635, 352, 68, 18, 737, 16345, 3419, 1635, 1556, 538, 198, 220, 220, 220, 220, 220, 220, 220, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 62, 77, 396, 796, 19233, 62, 6477, 62, 77, 396, 1220, 357, 15, 13, 23, 1635, 657, 13, 23, 1635, 20735, 62, 3020, 8, 628, 220, 220, 220, 220, 220, 220, 220, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 58, 72, 60, 796, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 198, 220, 220, 220, 220, 220, 220, 220, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 62, 36, 58, 72, 60, 796, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 62, 68, 198, 220, 220, 220, 220, 220, 220, 220, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 62, 45, 8808, 58, 72, 60, 796, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 62, 77, 396, 628, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 18908, 4111, 62, 6477, 11, 19233, 62, 6477, 11, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 8, 198, 220, 220, 220, 220, 220, 220, 220, 3601, 7, 18908, 4111, 62, 6477, 11, 19233, 62, 6477, 62, 68, 11, 2322, 388, 19482, 62, 46303, 3077, 62, 6477, 62, 68, 8, 628, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 1303, 3440, 279, 3798, 5488, 2482, 290, 787, 2457, 7110, 198, 220, 220, 220, 1303, 198, 220, 220, 220, 279, 3798, 5488, 796, 299, 32152, 13, 2220, 14116, 7203, 79, 3798, 5488, 62, 15, 79, 23, 13, 19608, 1600, 14267, 8516, 28, 17, 8, 628, 220, 220, 220, 7110, 7, 4221, 11860, 31097, 62, 12038, 11, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 2320, 11860, 31097, 62, 12038, 11, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 62, 36, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 2320, 11860, 31097, 62, 12038, 11, 38570, 5883, 2767, 41132, 62, 32, 4462, 1581, 33, 1961, 62, 47, 36048, 62, 45, 8808, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 279, 3798, 5488, 58, 45299, 15, 4357, 279, 3798, 5488, 58, 45299, 16, 60, 29006, 79, 3798, 5488, 58, 45299, 15, 60, 1635, 657, 13, 23, 1635, 657, 13, 23, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 742, 2578, 2625, 48791, 685, 3020, 60, 1600, 331, 7839, 2625, 16598, 388, 19482, 24774, 685, 54, 14, 3020, 18, 60, 1600, 198, 220, 220, 220, 220, 220, 220, 220, 220, 3670, 2625, 67, 8446, 4324, 20735, 796, 4064, 70, 8085, 1, 4064, 15291, 62, 400, 624, 1108, 62, 259, 62, 3020, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 8177, 28, 14692, 30300, 2430, 30300, 62, 68, 2430, 77, 396, 62, 68, 2430, 9069, 660, 40089, 8973, 8, 198 ]
2.0726
2,135
import random import html from functools import cached_property from wyr.console import Console
[ 11748, 4738, 198, 11748, 27711, 198, 6738, 1257, 310, 10141, 1330, 39986, 62, 26745, 198, 6738, 266, 2417, 13, 41947, 1330, 24371, 628, 628 ]
4.125
24
import requests import math import pandas as pd from datetime import datetime from datetime import timedelta import requests interval = 1 symbol = 'XBTUSD' # get data from timestamp_from = 1514761200 # till timestamp_now = 1536530400 max_back_time = 0 max_bars = 10080 max_bars_time = ((interval * 60) * max_bars) time_to_iterate = timestamp_now - timestamp_from baseURI = "https://www.bitmex.com/api/v1" endpoint = "/trade/bucketed" time_ago = datetime.now() - timedelta(minutes=150) request = requests.get(baseURI + endpoint, params={'binSize': '1m', 'symbol': 'XBTUSD', 'count': 750, 'startTime': time_ago}) print("data: start:", datetime.fromtimestamp(timestamp_from), "end:", datetime.fromtimestamp(timestamp_now)) data_frames = [] for x in range(int(math.ceil(time_to_iterate / max_bars_time))): if x > 0: if (max_back_time - max_bars_time) > timestamp_from: max_back_time, timestamp_now = (max_back_time - max_bars_time), max_back_time else: max_back_time, timestamp_now = timestamp_from, max_back_time elif x == 0: if time_to_iterate < max_bars_time: max_back_time = timestamp_from else: max_back_time = timestamp_now - max_bars_time print("SPLIT TIMING", "start:", datetime.fromtimestamp(max_back_time), "end:", datetime.fromtimestamp(timestamp_now)) r = requests.get('https://www.bitmex.com/api/udf/history?symbol={}&resolution={}&from={}&to={}'.format(symbol, interval, max_back_time, timestamp_now)).json() data = { 'Date': r['t'], 'Open': r['o'], 'High': r['o'], 'Low': r['o'], 'Close': r['c'], 'Adj Close': r['o'], 'Volume': r['v'] } columns = ['Date', 'Open', 'High', 'Low', 'Close', 'Adj Close', 'Volume'] df = pd.DataFrame(data, columns=columns) df['Date'] = pd.to_datetime(df['Date'], unit='s') data_frames.append(df) print(pd.concat(data_frames))
[ 11748, 7007, 198, 11748, 10688, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 4818, 8079, 1330, 28805, 12514, 198, 198, 11748, 7007, 198, 3849, 2100, 796, 352, 198, 1837, 23650, 796, 705, 55, 19313, 29072, 6, 198, 2, 651, 1366, 422, 198, 16514, 27823, 62, 6738, 796, 1315, 1415, 4304, 27550, 198, 2, 10597, 198, 16514, 27823, 62, 2197, 796, 1315, 24760, 1270, 7029, 628, 198, 9806, 62, 1891, 62, 2435, 796, 657, 198, 9806, 62, 34046, 796, 1802, 1795, 198, 9806, 62, 34046, 62, 2435, 796, 14808, 3849, 2100, 1635, 3126, 8, 1635, 3509, 62, 34046, 8, 198, 2435, 62, 1462, 62, 2676, 378, 796, 41033, 62, 2197, 532, 41033, 62, 6738, 198, 198, 8692, 47269, 796, 366, 5450, 1378, 2503, 13, 2545, 76, 1069, 13, 785, 14, 15042, 14, 85, 16, 1, 198, 437, 4122, 796, 12813, 25351, 14, 27041, 316, 276, 1, 198, 2435, 62, 3839, 796, 4818, 8079, 13, 2197, 3419, 532, 28805, 12514, 7, 1084, 1769, 28, 8628, 8, 198, 25927, 796, 7007, 13, 1136, 7, 8692, 47269, 1343, 36123, 11, 42287, 34758, 6, 8800, 10699, 10354, 705, 16, 76, 3256, 705, 1837, 23650, 10354, 705, 55, 19313, 29072, 3256, 705, 9127, 10354, 19683, 11, 705, 9688, 7575, 10354, 640, 62, 3839, 30072, 198, 198, 4798, 7203, 7890, 25, 923, 25, 1600, 4818, 8079, 13, 6738, 16514, 27823, 7, 16514, 27823, 62, 6738, 828, 366, 437, 25, 1600, 4818, 8079, 13, 6738, 16514, 27823, 7, 16514, 27823, 62, 2197, 4008, 198, 198, 7890, 62, 37805, 796, 17635, 198, 198, 1640, 2124, 287, 2837, 7, 600, 7, 11018, 13, 344, 346, 7, 2435, 62, 1462, 62, 2676, 378, 1220, 3509, 62, 34046, 62, 2435, 4008, 2599, 198, 220, 220, 220, 611, 2124, 1875, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 611, 357, 9806, 62, 1891, 62, 2435, 532, 3509, 62, 34046, 62, 2435, 8, 1875, 41033, 62, 6738, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 1891, 62, 2435, 11, 41033, 62, 2197, 796, 357, 9806, 62, 1891, 62, 2435, 532, 3509, 62, 34046, 62, 2435, 828, 3509, 62, 1891, 62, 2435, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 1891, 62, 2435, 11, 41033, 62, 2197, 796, 41033, 62, 6738, 11, 3509, 62, 1891, 62, 2435, 628, 220, 220, 220, 1288, 361, 2124, 6624, 657, 25, 198, 220, 220, 220, 220, 220, 220, 220, 611, 640, 62, 1462, 62, 2676, 378, 1279, 3509, 62, 34046, 62, 2435, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 1891, 62, 2435, 796, 41033, 62, 6738, 198, 220, 220, 220, 220, 220, 220, 220, 2073, 25, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3509, 62, 1891, 62, 2435, 796, 41033, 62, 2197, 532, 3509, 62, 34046, 62, 2435, 628, 220, 220, 220, 3601, 7203, 4303, 43, 2043, 31742, 2751, 1600, 366, 9688, 25, 1600, 4818, 8079, 13, 6738, 16514, 27823, 7, 9806, 62, 1891, 62, 2435, 828, 366, 437, 25, 1600, 4818, 8079, 13, 6738, 16514, 27823, 7, 16514, 27823, 62, 2197, 4008, 198, 220, 220, 220, 374, 796, 7007, 13, 1136, 10786, 5450, 1378, 2503, 13, 2545, 76, 1069, 13, 785, 14, 15042, 14, 463, 69, 14, 23569, 30, 1837, 23650, 34758, 92, 5, 29268, 34758, 92, 5, 6738, 34758, 92, 5, 1462, 34758, 92, 4458, 18982, 7, 1837, 23650, 11, 16654, 11, 3509, 62, 1891, 62, 2435, 11, 41033, 62, 2197, 29720, 17752, 3419, 628, 220, 220, 220, 1366, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 705, 10430, 10354, 374, 17816, 83, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 11505, 10354, 374, 17816, 78, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 11922, 10354, 374, 17816, 78, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 20535, 10354, 374, 17816, 78, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 26125, 10354, 374, 17816, 66, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 2782, 73, 13872, 10354, 374, 17816, 78, 6, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 705, 31715, 10354, 374, 17816, 85, 20520, 198, 220, 220, 220, 1782, 628, 220, 220, 220, 15180, 796, 37250, 10430, 3256, 705, 11505, 3256, 705, 11922, 3256, 705, 20535, 3256, 705, 26125, 3256, 705, 2782, 73, 13872, 3256, 705, 31715, 20520, 628, 220, 220, 220, 47764, 796, 279, 67, 13, 6601, 19778, 7, 7890, 11, 15180, 28, 28665, 82, 8, 198, 220, 220, 220, 47764, 17816, 10430, 20520, 796, 279, 67, 13, 1462, 62, 19608, 8079, 7, 7568, 17816, 10430, 6, 4357, 4326, 11639, 82, 11537, 198, 220, 220, 220, 1366, 62, 37805, 13, 33295, 7, 7568, 8, 198, 198, 4798, 7, 30094, 13, 1102, 9246, 7, 7890, 62, 37805, 4008, 198 ]
2.361111
828
# Generated by Django 3.2.6 on 2021-08-05 22:52 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 513, 13, 17, 13, 21, 319, 33448, 12, 2919, 12, 2713, 2534, 25, 4309, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
# -*- coding: utf-8 -*- # A Variational Autoencoder trained on the MNIST dataset. import tensorflow as tf import keras import numpy as np import matplotlib.pyplot as plt from keras.layers import Input, Dense, Lambda, InputLayer, concatenate from keras.models import Model, Sequential from keras import backend as K from keras.datasets import mnist from keras.utils import np_utils # Variational Lower Bound def vlb_binomial(x, x_decoded_mean, t_mean, t_log_var): """Returns the value of Variational Lower Bound The inputs are tf.Tensor x: (batch_size x number_of_pixels) matrix with one image per row with zeros and ones x_decoded_mean: (batch_size x number_of_pixels) mean of the distribution p(x | t), real numbers from 0 to 1 t_mean: (batch_size x latent_dim) mean vector of the (normal) distribution q(t | x) t_log_var: (batch_size x latent_dim) logarithm of the variance vector of the (normal) distribution q(t | x) Returns: A tf.Tensor with one element (averaged across the batch), VLB """ klterm=0.5*K.sum(-1-t_log_var+K.square(t_mean)+K.exp(t_log_var),axis=1)#batch_size reconst=K.sum(K.binary_crossentropy(x,x_decoded_mean),axis=1) return K.mean(klterm+reconst) # Sampling from the distribution # q(t | x) = N(t_mean, exp(t_log_var)) # with reparametrization trick. def sampling(args): """Returns sample from a distribution N(args[0], diag(args[1])) The sample should be computed with reparametrization trick. The inputs are tf.Tensor args[0]: (batch_size x latent_dim) mean of the desired distribution args[1]: (batch_size x latent_dim) logarithm of the variance vector of the desired distribution Returns: A tf.Tensor of size (batch_size x latent_dim), the samples. """ t_mean, t_log_var = args output = tf.random_normal(t_mean.get_shape()) output = output * tf.exp(0.5 * t_log_var) + t_mean return output if __name__ == '__main__': # Start tf session so we can run code. sess = tf.InteractiveSession() # Connect keras to the created session. K.set_session(sess) batch_size = 100 original_dim = 784 # Number of pixels in MNIST images. latent_dim = 100 # d, dimensionality of the latent code t. intermediate_dim = 256 # Size of the hidden layer. epochs = 20 x = Input(batch_shape=(batch_size, original_dim)) encoder = create_encoder(original_dim) get_t_mean = Lambda(lambda h: h[:, :latent_dim]) get_t_log_var = Lambda(lambda h: h[:, latent_dim:]) h = encoder(x) t_mean = get_t_mean(h) t_log_var = get_t_log_var(h) t = Lambda(sampling)([t_mean, t_log_var]) decoder = create_decoder(latent_dim) x_decoded_mean = decoder(t) loss = vlb_binomial(x, x_decoded_mean, t_mean, t_log_var) vae = Model(x, x_decoded_mean) # Keras will provide input (x) and output (x_decoded_mean) to the function that # should construct loss, but since our function also depends on other # things (e.g. t_means), it is easier to build the loss in advance and pass # a function that always returns it. vae.compile(optimizer=keras.optimizers.RMSprop(lr=0.001), loss=lambda x, y: loss) # Load and prepare the data # train the VAE on MNIST digits (x_train, y_train), (x_test, y_test) = mnist.load_data() # One hot encoding. y_train = np_utils.to_categorical(y_train) y_test = np_utils.to_categorical(y_test) x_train = x_train.astype('float32') / 255. x_test = x_test.astype('float32') / 255. x_train = x_train.reshape((len(x_train), np.prod(x_train.shape[1:]))) x_test = x_test.reshape((len(x_test), np.prod(x_test.shape[1:]))) # Training the model hist = vae.fit(x=x_train, y=x_train, shuffle=True, epochs=epochs, batch_size=batch_size, validation_data=(x_test, x_test), verbose=2) # Visualize reconstructions for train and validation data fig = plt.figure(figsize=(10, 10)) for fid_idx, (data, title) in enumerate( zip([x_train, x_test], ['Train', 'Validation'])): n = 10 # figure with 10 x 2 digits digit_size = 28 figure = np.zeros((digit_size * n, digit_size * 2)) decoded = sess.run(x_decoded_mean, feed_dict={x: data[:batch_size, :]}) for i in range(10): figure[i * digit_size: (i + 1) * digit_size, :digit_size] = data[i, :].reshape(digit_size, digit_size) figure[i * digit_size: (i + 1) * digit_size, digit_size:] = decoded[i, :].reshape(digit_size, digit_size) ax = fig.add_subplot(1, 2, fid_idx + 1) ax.imshow(figure, cmap='Greys_r') ax.set_title(title) ax.axis('off') plt.show() # Hallucinating new data # generate new samples of images from your trained VAE n_samples = 10 # To pass automatic grading please use at least 2 samples here. # sampled_im_mean is a tf.Tensor of size 10 x 784 with 10 random # images sampled from the vae model. sampled_im_mean = decoder(tf.random_normal((n_samples,latent_dim))) sampled_im_mean_np = sess.run(sampled_im_mean) # Show the sampled images. plt.figure() for i in range(n_samples): ax = plt.subplot(n_samples // 5 + 1, 5, i + 1) plt.imshow(sampled_im_mean_np[i, :].reshape(28, 28), cmap='gray') ax.axis('off') plt.show() # Conditional VAE # Implement CVAE model # One-hot labels placeholder. x = Input(batch_shape=(batch_size, original_dim)) label = Input(batch_shape=(batch_size, 10)) cond_encoder = create_encoder(original_dim+10) cond_h = cond_encoder(concatenate([x, label])) cond_t_mean = get_t_mean(cond_h) # Mean of the latent code (without label) for cvae model. cond_t_log_var = get_t_log_var(cond_h) # Logarithm of the variance of the latent code (without label) for cvae model. cond_t = Lambda(sampling)([cond_t_mean, cond_t_log_var]) cond_decoder = create_decoder(latent_dim+10) cond_x_decoded_mean = cond_decoder(concatenate([cond_t, label])) # Final output of the cvae model. # Define the loss and the model conditional_loss = vlb_binomial(x, cond_x_decoded_mean, cond_t_mean, cond_t_log_var) cvae = Model([x, label], cond_x_decoded_mean) cvae.compile(optimizer=keras.optimizers.RMSprop(lr=0.001), loss=lambda x, y: conditional_loss) # Train the model hist = cvae.fit(x=[x_train, y_train], y=x_train, shuffle=True, epochs=epochs, batch_size=batch_size, validation_data=([x_test, y_test], x_test), verbose=2) # Visualize reconstructions for train and validation data fig = plt.figure(figsize=(10, 10)) for fid_idx, (x_data, y_data, title) in enumerate( zip([x_train, x_test], [y_train, y_test], ['Train', 'Validation'])): n = 10 # figure with 10 x 2 digits digit_size = 28 figure = np.zeros((digit_size * n, digit_size * 2)) decoded = sess.run(cond_x_decoded_mean, feed_dict={x: x_data[:batch_size, :], label: y_data[:batch_size, :]}) for i in range(10): figure[i * digit_size: (i + 1) * digit_size, :digit_size] = x_data[i, :].reshape(digit_size, digit_size) figure[i * digit_size: (i + 1) * digit_size, digit_size:] = decoded[i, :].reshape(digit_size, digit_size) ax = fig.add_subplot(1, 2, fid_idx + 1) ax.imshow(figure, cmap='Greys_r') ax.set_title(title) ax.axis('off') plt.show() # Conditionally hallucinate data # Prepare one hot labels of form # 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 ... # to sample five zeros, five ones, etc curr_labels = np.eye(10) curr_labels = np.repeat(curr_labels, 5, axis=0) # Its shape is 50 x 10. # cond_sampled_im_mean is a tf.Tensor of size 50 x 784 with 5 random zeros, # then 5 random ones, etc sampled from the cvae model. cond_sampled_im_mean = cond_decoder(concatenate([tf.random_normal((50,latent_dim)), tf.convert_to_tensor(curr_labels, dtype=tf.float32)])) cond_sampled_im_mean_np = sess.run(cond_sampled_im_mean) # Show the sampled images. plt.figure(figsize=(10, 10)) global_idx = 0 for digit in range(10): for _ in range(5): ax = plt.subplot(10, 5, global_idx + 1) plt.imshow(cond_sampled_im_mean_np[global_idx, :].reshape(28, 28), cmap='gray') ax.axis('off') global_idx += 1 plt.show()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 317, 15965, 864, 5231, 6571, 66, 12342, 8776, 319, 262, 29060, 8808, 27039, 13, 198, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 11748, 41927, 292, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 41927, 292, 13, 75, 6962, 1330, 23412, 11, 360, 1072, 11, 21114, 6814, 11, 23412, 49925, 11, 1673, 36686, 378, 198, 6738, 41927, 292, 13, 27530, 1330, 9104, 11, 24604, 1843, 198, 6738, 41927, 292, 1330, 30203, 355, 509, 198, 6738, 41927, 292, 13, 19608, 292, 1039, 1330, 285, 77, 396, 198, 6738, 41927, 292, 13, 26791, 1330, 45941, 62, 26791, 198, 198, 2, 15965, 864, 16048, 30149, 198, 4299, 410, 23160, 62, 8800, 49070, 7, 87, 11, 2124, 62, 12501, 9043, 62, 32604, 11, 256, 62, 32604, 11, 256, 62, 6404, 62, 7785, 2599, 198, 220, 220, 220, 37227, 35561, 262, 1988, 286, 15965, 864, 16048, 30149, 198, 220, 220, 220, 220, 198, 220, 220, 220, 383, 17311, 389, 48700, 13, 51, 22854, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 25, 357, 43501, 62, 7857, 2124, 1271, 62, 1659, 62, 79, 14810, 8, 17593, 351, 530, 2939, 583, 5752, 351, 1976, 27498, 290, 3392, 198, 220, 220, 220, 220, 220, 220, 220, 2124, 62, 12501, 9043, 62, 32604, 25, 357, 43501, 62, 7857, 2124, 1271, 62, 1659, 62, 79, 14810, 8, 1612, 286, 262, 6082, 279, 7, 87, 930, 256, 828, 1103, 3146, 422, 657, 284, 352, 198, 220, 220, 220, 220, 220, 220, 220, 256, 62, 32604, 25, 357, 43501, 62, 7857, 2124, 41270, 62, 27740, 8, 1612, 15879, 286, 262, 357, 11265, 8, 6082, 10662, 7, 83, 930, 2124, 8, 198, 220, 220, 220, 220, 220, 220, 220, 256, 62, 6404, 62, 7785, 25, 357, 43501, 62, 7857, 2124, 41270, 62, 27740, 8, 2604, 283, 342, 76, 286, 262, 24198, 15879, 286, 262, 357, 11265, 8, 6082, 10662, 7, 83, 930, 2124, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 317, 48700, 13, 51, 22854, 351, 530, 5002, 357, 8770, 1886, 1973, 262, 15458, 828, 569, 30501, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 479, 75, 4354, 28, 15, 13, 20, 9, 42, 13, 16345, 32590, 16, 12, 83, 62, 6404, 62, 7785, 10, 42, 13, 23415, 7, 83, 62, 32604, 47762, 42, 13, 11201, 7, 83, 62, 6404, 62, 7785, 828, 22704, 28, 16, 8, 2, 43501, 62, 7857, 198, 220, 220, 220, 8195, 301, 28, 42, 13, 16345, 7, 42, 13, 39491, 62, 19692, 298, 28338, 7, 87, 11, 87, 62, 12501, 9043, 62, 32604, 828, 22704, 28, 16, 8, 198, 220, 220, 220, 1441, 509, 13, 32604, 7, 41582, 4354, 10, 260, 9979, 8, 628, 198, 198, 2, 3409, 11347, 422, 262, 6082, 220, 198, 2, 220, 220, 220, 220, 10662, 7, 83, 930, 2124, 8, 796, 399, 7, 83, 62, 32604, 11, 1033, 7, 83, 62, 6404, 62, 7785, 4008, 198, 2, 351, 1128, 41158, 316, 47847, 341, 6908, 13, 198, 4299, 19232, 7, 22046, 2599, 198, 220, 220, 220, 37227, 35561, 6291, 422, 257, 6082, 399, 7, 22046, 58, 15, 4357, 2566, 363, 7, 22046, 58, 16, 60, 4008, 198, 220, 220, 220, 220, 198, 220, 220, 220, 383, 6291, 815, 307, 29231, 351, 1128, 41158, 316, 47847, 341, 6908, 13, 198, 220, 220, 220, 220, 198, 220, 220, 220, 383, 17311, 389, 48700, 13, 51, 22854, 198, 220, 220, 220, 220, 220, 220, 220, 26498, 58, 15, 5974, 357, 43501, 62, 7857, 2124, 41270, 62, 27740, 8, 1612, 286, 262, 10348, 6082, 198, 220, 220, 220, 220, 220, 220, 220, 26498, 58, 16, 5974, 357, 43501, 62, 7857, 2124, 41270, 62, 27740, 8, 2604, 283, 342, 76, 286, 262, 24198, 15879, 286, 262, 10348, 6082, 198, 220, 220, 220, 220, 198, 220, 220, 220, 16409, 25, 198, 220, 220, 220, 220, 220, 220, 220, 317, 48700, 13, 51, 22854, 286, 2546, 357, 43501, 62, 7857, 2124, 41270, 62, 27740, 828, 262, 8405, 13, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 256, 62, 32604, 11, 256, 62, 6404, 62, 7785, 796, 26498, 198, 220, 220, 220, 5072, 796, 48700, 13, 25120, 62, 11265, 7, 83, 62, 32604, 13, 1136, 62, 43358, 28955, 198, 220, 220, 220, 5072, 796, 5072, 1635, 48700, 13, 11201, 7, 15, 13, 20, 1635, 256, 62, 6404, 62, 7785, 8, 1343, 256, 62, 32604, 198, 220, 220, 220, 1441, 5072, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1303, 7253, 48700, 6246, 523, 356, 460, 1057, 2438, 13, 198, 220, 220, 220, 264, 408, 796, 48700, 13, 9492, 5275, 36044, 3419, 198, 220, 220, 220, 1303, 8113, 41927, 292, 284, 262, 2727, 6246, 13, 198, 220, 220, 220, 509, 13, 2617, 62, 29891, 7, 82, 408, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 15458, 62, 7857, 796, 1802, 198, 220, 220, 220, 2656, 62, 27740, 796, 767, 5705, 1303, 7913, 286, 17848, 287, 29060, 8808, 4263, 13, 198, 220, 220, 220, 41270, 62, 27740, 796, 1802, 1303, 288, 11, 15793, 1483, 286, 262, 41270, 2438, 256, 13, 198, 220, 220, 220, 19898, 62, 27740, 796, 17759, 1303, 12849, 286, 262, 7104, 7679, 13, 198, 220, 220, 220, 36835, 82, 796, 1160, 198, 220, 220, 220, 220, 198, 220, 220, 220, 2124, 796, 23412, 7, 43501, 62, 43358, 16193, 43501, 62, 7857, 11, 2656, 62, 27740, 4008, 198, 220, 220, 220, 220, 198, 220, 220, 220, 2207, 12342, 796, 2251, 62, 12685, 12342, 7, 14986, 62, 27740, 8, 628, 220, 220, 220, 651, 62, 83, 62, 32604, 796, 21114, 6814, 7, 50033, 289, 25, 289, 58, 45299, 1058, 15460, 298, 62, 27740, 12962, 198, 220, 220, 220, 651, 62, 83, 62, 6404, 62, 7785, 796, 21114, 6814, 7, 50033, 289, 25, 289, 58, 45299, 41270, 62, 27740, 25, 12962, 198, 220, 220, 220, 289, 796, 2207, 12342, 7, 87, 8, 198, 220, 220, 220, 256, 62, 32604, 796, 651, 62, 83, 62, 32604, 7, 71, 8, 198, 220, 220, 220, 256, 62, 6404, 62, 7785, 796, 651, 62, 83, 62, 6404, 62, 7785, 7, 71, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 256, 796, 21114, 6814, 7, 37687, 11347, 5769, 58, 83, 62, 32604, 11, 256, 62, 6404, 62, 7785, 12962, 198, 220, 220, 220, 220, 198, 220, 220, 220, 875, 12342, 796, 2251, 62, 12501, 12342, 7, 15460, 298, 62, 27740, 8, 198, 220, 220, 220, 2124, 62, 12501, 9043, 62, 32604, 796, 875, 12342, 7, 83, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 2994, 796, 410, 23160, 62, 8800, 49070, 7, 87, 11, 2124, 62, 12501, 9043, 62, 32604, 11, 256, 62, 32604, 11, 256, 62, 6404, 62, 7785, 8, 198, 220, 220, 220, 410, 3609, 796, 9104, 7, 87, 11, 2124, 62, 12501, 9043, 62, 32604, 8, 198, 220, 220, 220, 1303, 17337, 292, 481, 2148, 5128, 357, 87, 8, 290, 5072, 357, 87, 62, 12501, 9043, 62, 32604, 8, 284, 262, 2163, 326, 198, 220, 220, 220, 1303, 815, 5678, 2994, 11, 475, 1201, 674, 2163, 635, 8338, 319, 584, 198, 220, 220, 220, 1303, 1243, 357, 68, 13, 70, 13, 256, 62, 1326, 504, 828, 340, 318, 4577, 284, 1382, 262, 2994, 287, 5963, 290, 1208, 198, 220, 220, 220, 1303, 257, 2163, 326, 1464, 5860, 340, 13, 198, 220, 220, 220, 410, 3609, 13, 5589, 576, 7, 40085, 7509, 28, 6122, 292, 13, 40085, 11341, 13, 49, 5653, 22930, 7, 14050, 28, 15, 13, 8298, 828, 2994, 28, 50033, 2124, 11, 331, 25, 2994, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 8778, 290, 8335, 262, 1366, 198, 220, 220, 220, 1303, 4512, 262, 13753, 36, 319, 29060, 8808, 19561, 198, 220, 220, 220, 357, 87, 62, 27432, 11, 331, 62, 27432, 828, 357, 87, 62, 9288, 11, 331, 62, 9288, 8, 796, 285, 77, 396, 13, 2220, 62, 7890, 3419, 198, 220, 220, 220, 1303, 1881, 3024, 21004, 13, 198, 220, 220, 220, 331, 62, 27432, 796, 45941, 62, 26791, 13, 1462, 62, 66, 2397, 12409, 7, 88, 62, 27432, 8, 198, 220, 220, 220, 331, 62, 9288, 796, 45941, 62, 26791, 13, 1462, 62, 66, 2397, 12409, 7, 88, 62, 9288, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 2124, 62, 27432, 796, 2124, 62, 27432, 13, 459, 2981, 10786, 22468, 2624, 11537, 1220, 14280, 13, 198, 220, 220, 220, 2124, 62, 9288, 796, 2124, 62, 9288, 13, 459, 2981, 10786, 22468, 2624, 11537, 1220, 14280, 13, 198, 220, 220, 220, 2124, 62, 27432, 796, 2124, 62, 27432, 13, 3447, 1758, 19510, 11925, 7, 87, 62, 27432, 828, 45941, 13, 1676, 67, 7, 87, 62, 27432, 13, 43358, 58, 16, 47715, 22305, 198, 220, 220, 220, 2124, 62, 9288, 796, 2124, 62, 9288, 13, 3447, 1758, 19510, 11925, 7, 87, 62, 9288, 828, 45941, 13, 1676, 67, 7, 87, 62, 9288, 13, 43358, 58, 16, 47715, 22305, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 13614, 262, 2746, 198, 220, 220, 220, 1554, 796, 410, 3609, 13, 11147, 7, 87, 28, 87, 62, 27432, 11, 331, 28, 87, 62, 27432, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 36273, 28, 17821, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 36835, 82, 28, 538, 5374, 82, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15458, 62, 7857, 28, 43501, 62, 7857, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 21201, 62, 7890, 16193, 87, 62, 9288, 11, 2124, 62, 9288, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15942, 577, 28, 17, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 15612, 1096, 31081, 507, 329, 4512, 290, 21201, 1366, 198, 220, 220, 220, 2336, 796, 458, 83, 13, 26875, 7, 5647, 7857, 16193, 940, 11, 838, 4008, 198, 220, 220, 220, 329, 49909, 62, 312, 87, 11, 357, 7890, 11, 3670, 8, 287, 27056, 378, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19974, 26933, 87, 62, 27432, 11, 2124, 62, 9288, 4357, 37250, 44077, 3256, 705, 7762, 24765, 6, 12962, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 299, 796, 838, 220, 1303, 3785, 351, 838, 2124, 362, 19561, 198, 220, 220, 220, 220, 220, 220, 220, 16839, 62, 7857, 796, 2579, 198, 220, 220, 220, 220, 220, 220, 220, 3785, 796, 45941, 13, 9107, 418, 19510, 27003, 62, 7857, 1635, 299, 11, 16839, 62, 7857, 1635, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 875, 9043, 796, 264, 408, 13, 5143, 7, 87, 62, 12501, 9043, 62, 32604, 11, 3745, 62, 11600, 34758, 87, 25, 1366, 58, 25, 43501, 62, 7857, 11, 1058, 60, 30072, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 2837, 7, 940, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3785, 58, 72, 1635, 16839, 62, 7857, 25, 357, 72, 1343, 352, 8, 1635, 16839, 62, 7857, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 27003, 62, 7857, 60, 796, 1366, 58, 72, 11, 1058, 4083, 3447, 1758, 7, 27003, 62, 7857, 11, 16839, 62, 7857, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3785, 58, 72, 1635, 16839, 62, 7857, 25, 357, 72, 1343, 352, 8, 1635, 16839, 62, 7857, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16839, 62, 7857, 47715, 796, 875, 9043, 58, 72, 11, 1058, 4083, 3447, 1758, 7, 27003, 62, 7857, 11, 16839, 62, 7857, 8, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 796, 2336, 13, 2860, 62, 7266, 29487, 7, 16, 11, 362, 11, 49909, 62, 312, 87, 1343, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 320, 12860, 7, 26875, 11, 269, 8899, 11639, 43887, 893, 62, 81, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 2617, 62, 7839, 7, 7839, 8, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 22704, 10786, 2364, 11537, 198, 220, 220, 220, 458, 83, 13, 12860, 3419, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 4789, 1229, 6010, 649, 1366, 198, 220, 220, 220, 1303, 7716, 649, 8405, 286, 4263, 422, 534, 8776, 13753, 36, 198, 220, 220, 220, 299, 62, 82, 12629, 796, 838, 220, 1303, 1675, 1208, 11353, 43165, 3387, 779, 379, 1551, 362, 8405, 994, 13, 198, 220, 220, 220, 1303, 35846, 62, 320, 62, 32604, 318, 257, 48700, 13, 51, 22854, 286, 2546, 838, 2124, 767, 5705, 351, 838, 4738, 198, 220, 220, 220, 1303, 4263, 35846, 422, 262, 410, 3609, 2746, 13, 198, 220, 220, 220, 35846, 62, 320, 62, 32604, 796, 875, 12342, 7, 27110, 13, 25120, 62, 11265, 19510, 77, 62, 82, 12629, 11, 15460, 298, 62, 27740, 22305, 198, 220, 220, 220, 220, 198, 220, 220, 220, 35846, 62, 320, 62, 32604, 62, 37659, 796, 264, 408, 13, 5143, 7, 37687, 10137, 62, 320, 62, 32604, 8, 198, 220, 220, 220, 1303, 5438, 262, 35846, 4263, 13, 198, 220, 220, 220, 458, 83, 13, 26875, 3419, 198, 220, 220, 220, 329, 1312, 287, 2837, 7, 77, 62, 82, 12629, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 796, 458, 83, 13, 7266, 29487, 7, 77, 62, 82, 12629, 3373, 642, 1343, 352, 11, 642, 11, 1312, 1343, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 320, 12860, 7, 37687, 10137, 62, 320, 62, 32604, 62, 37659, 58, 72, 11, 1058, 4083, 3447, 1758, 7, 2078, 11, 2579, 828, 269, 8899, 11639, 44605, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 22704, 10786, 2364, 11537, 198, 220, 220, 220, 458, 83, 13, 12860, 3419, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 9724, 1859, 13753, 36, 198, 220, 220, 220, 1303, 48282, 327, 11731, 36, 2746, 198, 220, 220, 220, 1303, 1881, 12, 8940, 14722, 46076, 13, 198, 220, 220, 220, 2124, 796, 23412, 7, 43501, 62, 43358, 16193, 43501, 62, 7857, 11, 2656, 62, 27740, 4008, 198, 220, 220, 220, 6167, 796, 23412, 7, 43501, 62, 43358, 16193, 43501, 62, 7857, 11, 838, 4008, 198, 220, 220, 220, 1779, 62, 12685, 12342, 796, 2251, 62, 12685, 12342, 7, 14986, 62, 27740, 10, 940, 8, 198, 220, 220, 220, 1779, 62, 71, 796, 1779, 62, 12685, 12342, 7, 1102, 9246, 268, 378, 26933, 87, 11, 6167, 60, 4008, 198, 220, 220, 220, 1779, 62, 83, 62, 32604, 796, 220, 651, 62, 83, 62, 32604, 7, 17561, 62, 71, 8, 1303, 22728, 286, 262, 41270, 2438, 357, 19419, 6167, 8, 329, 269, 33353, 2746, 13, 198, 220, 220, 220, 1779, 62, 83, 62, 6404, 62, 7785, 796, 651, 62, 83, 62, 6404, 62, 7785, 7, 17561, 62, 71, 8, 1303, 5972, 283, 342, 76, 286, 262, 24198, 286, 262, 41270, 2438, 357, 19419, 6167, 8, 329, 269, 33353, 2746, 13, 198, 220, 220, 220, 1779, 62, 83, 796, 21114, 6814, 7, 37687, 11347, 5769, 58, 17561, 62, 83, 62, 32604, 11, 1779, 62, 83, 62, 6404, 62, 7785, 12962, 198, 220, 220, 220, 1779, 62, 12501, 12342, 796, 2251, 62, 12501, 12342, 7, 15460, 298, 62, 27740, 10, 940, 8, 198, 220, 220, 220, 1779, 62, 87, 62, 12501, 9043, 62, 32604, 796, 1779, 62, 12501, 12342, 7, 1102, 9246, 268, 378, 26933, 17561, 62, 83, 11, 6167, 60, 4008, 1303, 8125, 5072, 286, 262, 269, 33353, 2746, 13, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 2896, 500, 262, 2994, 290, 262, 2746, 198, 220, 220, 220, 26340, 62, 22462, 796, 410, 23160, 62, 8800, 49070, 7, 87, 11, 1779, 62, 87, 62, 12501, 9043, 62, 32604, 11, 1779, 62, 83, 62, 32604, 11, 1779, 62, 83, 62, 6404, 62, 7785, 8, 198, 220, 220, 220, 269, 33353, 796, 9104, 26933, 87, 11, 6167, 4357, 1779, 62, 87, 62, 12501, 9043, 62, 32604, 8, 198, 220, 220, 220, 269, 33353, 13, 5589, 576, 7, 40085, 7509, 28, 6122, 292, 13, 40085, 11341, 13, 49, 5653, 22930, 7, 14050, 28, 15, 13, 8298, 828, 2994, 28, 50033, 2124, 11, 331, 25, 26340, 62, 22462, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 16835, 262, 2746, 198, 220, 220, 220, 1554, 796, 269, 33353, 13, 11147, 7, 87, 41888, 87, 62, 27432, 11, 331, 62, 27432, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 331, 28, 87, 62, 27432, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 36273, 28, 17821, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 36835, 82, 28, 538, 5374, 82, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15458, 62, 7857, 28, 43501, 62, 7857, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 21201, 62, 7890, 16193, 58, 87, 62, 9288, 11, 331, 62, 9288, 4357, 2124, 62, 9288, 828, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 15942, 577, 28, 17, 8, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 15612, 1096, 31081, 507, 329, 4512, 290, 21201, 1366, 198, 220, 220, 220, 2336, 796, 458, 83, 13, 26875, 7, 5647, 7857, 16193, 940, 11, 838, 4008, 198, 220, 220, 220, 329, 49909, 62, 312, 87, 11, 357, 87, 62, 7890, 11, 331, 62, 7890, 11, 3670, 8, 287, 27056, 378, 7, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 19974, 26933, 87, 62, 27432, 11, 2124, 62, 9288, 4357, 685, 88, 62, 27432, 11, 331, 62, 9288, 4357, 37250, 44077, 3256, 705, 7762, 24765, 6, 12962, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 299, 796, 838, 220, 1303, 3785, 351, 838, 2124, 362, 19561, 198, 220, 220, 220, 220, 220, 220, 220, 16839, 62, 7857, 796, 2579, 198, 220, 220, 220, 220, 220, 220, 220, 3785, 796, 45941, 13, 9107, 418, 19510, 27003, 62, 7857, 1635, 299, 11, 16839, 62, 7857, 1635, 362, 4008, 198, 220, 220, 220, 220, 220, 220, 220, 875, 9043, 796, 264, 408, 13, 5143, 7, 17561, 62, 87, 62, 12501, 9043, 62, 32604, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3745, 62, 11600, 34758, 87, 25, 2124, 62, 7890, 58, 25, 43501, 62, 7857, 11, 1058, 4357, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6167, 25, 331, 62, 7890, 58, 25, 43501, 62, 7857, 11, 1058, 60, 30072, 198, 220, 220, 220, 220, 220, 220, 220, 329, 1312, 287, 2837, 7, 940, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3785, 58, 72, 1635, 16839, 62, 7857, 25, 357, 72, 1343, 352, 8, 1635, 16839, 62, 7857, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1058, 27003, 62, 7857, 60, 796, 2124, 62, 7890, 58, 72, 11, 1058, 4083, 3447, 1758, 7, 27003, 62, 7857, 11, 16839, 62, 7857, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3785, 58, 72, 1635, 16839, 62, 7857, 25, 357, 72, 1343, 352, 8, 1635, 16839, 62, 7857, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16839, 62, 7857, 47715, 796, 875, 9043, 58, 72, 11, 1058, 4083, 3447, 1758, 7, 27003, 62, 7857, 11, 16839, 62, 7857, 8, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 796, 2336, 13, 2860, 62, 7266, 29487, 7, 16, 11, 362, 11, 49909, 62, 312, 87, 1343, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 320, 12860, 7, 26875, 11, 269, 8899, 11639, 43887, 893, 62, 81, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 2617, 62, 7839, 7, 7839, 8, 198, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 22704, 10786, 2364, 11537, 198, 220, 220, 220, 458, 83, 13, 12860, 3419, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1303, 9724, 8736, 23251, 4559, 1366, 198, 220, 220, 220, 1303, 43426, 530, 3024, 14722, 286, 1296, 198, 220, 220, 220, 1303, 220, 220, 657, 657, 657, 657, 657, 352, 352, 352, 352, 352, 362, 362, 362, 362, 362, 2644, 198, 220, 220, 220, 1303, 284, 6291, 1936, 1976, 27498, 11, 1936, 3392, 11, 3503, 198, 220, 220, 220, 1090, 81, 62, 23912, 1424, 796, 45941, 13, 25379, 7, 940, 8, 198, 220, 220, 220, 1090, 81, 62, 23912, 1424, 796, 45941, 13, 44754, 7, 22019, 81, 62, 23912, 1424, 11, 642, 11, 16488, 28, 15, 8, 220, 1303, 6363, 5485, 318, 2026, 2124, 838, 13, 198, 220, 220, 220, 1303, 1779, 62, 37687, 10137, 62, 320, 62, 32604, 318, 257, 48700, 13, 51, 22854, 286, 2546, 2026, 2124, 767, 5705, 351, 642, 4738, 1976, 27498, 11, 198, 220, 220, 220, 1303, 788, 642, 4738, 3392, 11, 3503, 35846, 422, 262, 269, 33353, 2746, 13, 198, 220, 220, 220, 1779, 62, 37687, 10137, 62, 320, 62, 32604, 796, 1779, 62, 12501, 12342, 7, 1102, 9246, 268, 378, 26933, 27110, 13, 25120, 62, 11265, 19510, 1120, 11, 15460, 298, 62, 27740, 36911, 48700, 13, 1102, 1851, 62, 1462, 62, 83, 22854, 7, 22019, 81, 62, 23912, 1424, 11, 288, 4906, 28, 27110, 13, 22468, 2624, 15437, 4008, 198, 220, 220, 220, 220, 198, 220, 220, 220, 1779, 62, 37687, 10137, 62, 320, 62, 32604, 62, 37659, 796, 264, 408, 13, 5143, 7, 17561, 62, 37687, 10137, 62, 320, 62, 32604, 8, 198, 220, 220, 220, 1303, 5438, 262, 35846, 4263, 13, 198, 220, 220, 220, 458, 83, 13, 26875, 7, 5647, 7857, 16193, 940, 11, 838, 4008, 198, 220, 220, 220, 3298, 62, 312, 87, 796, 657, 198, 220, 220, 220, 329, 16839, 287, 2837, 7, 940, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 329, 4808, 287, 2837, 7, 20, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7877, 796, 458, 83, 13, 7266, 29487, 7, 940, 11, 642, 11, 3298, 62, 312, 87, 1343, 352, 8, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 458, 83, 13, 320, 12860, 7, 17561, 62, 37687, 10137, 62, 320, 62, 32604, 62, 37659, 58, 20541, 62, 312, 87, 11, 1058, 4083, 3447, 1758, 7, 2078, 11, 2579, 828, 269, 8899, 11639, 44605, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 7877, 13, 22704, 10786, 2364, 11537, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 3298, 62, 312, 87, 15853, 352, 198, 220, 220, 220, 458, 83, 13, 12860, 3419 ]
2.21573
4,005
from .beta_calibration import _BetaCal, _BetaAMCal, _BetaABCal from sklearn.base import BaseEstimator, RegressorMixin class BetaCalibration(BaseEstimator, RegressorMixin): """Wrapper class for the three Beta regression models introduced in Kull, M., Silva Filho, T.M. and Flach, P. Beta calibration: a well-founded and easily implemented improvement on logistic calibration for binary classifiers. AISTATS 2017. Parameters ---------- parameters : string Determines which parameters will be calculated by the model. Possible values are: "abm" (default), "am" and "ab" Attributes ---------- calibrator_ : Internal calibrator object. The type depends on the value of parameters. """ def fit(self, X, y, sample_weight=None): """Fit the model using X, y as training data. Parameters ---------- X : array-like, shape (n_samples,) Training data. y : array-like, shape (n_samples,) Training target. sample_weight : array-like, shape = [n_samples] or None Sample weights. If None, then samples are equally weighted. Currently, no sample weighting is done by the models. Returns ------- self : object Returns an instance of self. """ self.calibrator_.fit(X, y, sample_weight) return self def predict(self, S): """Predict new values. Parameters ---------- S : array-like, shape (n_samples,) Data to predict from. Returns ------- : array, shape (n_samples,) The predicted values. """ return self.calibrator_.predict(S)
[ 6738, 764, 31361, 62, 9948, 571, 1358, 1330, 4808, 43303, 9771, 11, 4808, 43303, 2390, 9771, 11, 4808, 43303, 24694, 282, 198, 6738, 1341, 35720, 13, 8692, 1330, 7308, 22362, 320, 1352, 11, 3310, 44292, 35608, 259, 628, 198, 4871, 17993, 9771, 571, 1358, 7, 14881, 22362, 320, 1352, 11, 3310, 44292, 35608, 259, 2599, 198, 220, 220, 220, 37227, 36918, 2848, 1398, 329, 262, 1115, 17993, 20683, 4981, 5495, 287, 220, 198, 220, 220, 220, 509, 724, 11, 337, 1539, 23720, 7066, 8873, 11, 309, 13, 44, 13, 290, 1610, 620, 11, 350, 13, 17993, 36537, 25, 257, 880, 12, 27060, 220, 198, 220, 220, 220, 290, 3538, 9177, 9025, 319, 2604, 2569, 36537, 329, 13934, 220, 220, 198, 220, 220, 220, 1398, 13350, 13, 317, 8808, 33586, 2177, 13, 628, 220, 220, 220, 40117, 198, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 10007, 1058, 4731, 198, 220, 220, 220, 220, 220, 220, 220, 360, 13221, 274, 543, 10007, 481, 307, 10488, 416, 262, 2746, 13, 33671, 198, 220, 220, 220, 220, 220, 220, 220, 3815, 389, 25, 366, 397, 76, 1, 357, 12286, 828, 366, 321, 1, 290, 366, 397, 1, 628, 220, 220, 220, 49213, 198, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 33801, 1352, 62, 1058, 198, 220, 220, 220, 220, 220, 220, 220, 18628, 33801, 1352, 2134, 13, 383, 2099, 8338, 319, 262, 1988, 286, 10007, 13, 198, 220, 220, 220, 37227, 628, 220, 220, 220, 825, 4197, 7, 944, 11, 1395, 11, 331, 11, 6291, 62, 6551, 28, 14202, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 31805, 262, 2746, 1262, 1395, 11, 331, 355, 3047, 1366, 13, 628, 220, 220, 220, 220, 220, 220, 220, 40117, 198, 220, 220, 220, 220, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 220, 220, 220, 220, 1395, 1058, 7177, 12, 2339, 11, 5485, 357, 77, 62, 82, 12629, 35751, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13614, 1366, 13, 628, 220, 220, 220, 220, 220, 220, 220, 331, 1058, 7177, 12, 2339, 11, 5485, 357, 77, 62, 82, 12629, 35751, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 13614, 2496, 13, 628, 220, 220, 220, 220, 220, 220, 220, 6291, 62, 6551, 1058, 7177, 12, 2339, 11, 5485, 796, 685, 77, 62, 82, 12629, 60, 393, 6045, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 27565, 19590, 13, 1002, 6045, 11, 788, 8405, 389, 8603, 26356, 13, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16888, 11, 645, 6291, 3463, 278, 318, 1760, 416, 262, 4981, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 198, 220, 220, 220, 220, 220, 220, 220, 35656, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 1058, 2134, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 16409, 281, 4554, 286, 2116, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 2116, 13, 9948, 2889, 1352, 44807, 11147, 7, 55, 11, 331, 11, 6291, 62, 6551, 8, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 628, 220, 220, 220, 825, 4331, 7, 944, 11, 311, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 47, 17407, 649, 3815, 13, 628, 220, 220, 220, 220, 220, 220, 220, 40117, 198, 220, 220, 220, 220, 220, 220, 220, 24200, 438, 198, 220, 220, 220, 220, 220, 220, 220, 311, 1058, 7177, 12, 2339, 11, 5485, 357, 77, 62, 82, 12629, 35751, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 6060, 284, 4331, 422, 13, 628, 220, 220, 220, 220, 220, 220, 220, 16409, 198, 220, 220, 220, 220, 220, 220, 220, 35656, 198, 220, 220, 220, 220, 220, 220, 220, 1058, 7177, 11, 5485, 357, 77, 62, 82, 12629, 35751, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 383, 11001, 3815, 13, 198, 220, 220, 220, 220, 220, 220, 220, 37227, 198, 220, 220, 220, 220, 220, 220, 220, 1441, 2116, 13, 9948, 2889, 1352, 44807, 79, 17407, 7, 50, 8, 198 ]
2.505007
699
import numpy as np from feature_cost_model.action_cost import ActionCost
[ 11748, 299, 32152, 355, 45941, 198, 198, 6738, 3895, 62, 15805, 62, 19849, 13, 2673, 62, 15805, 1330, 7561, 13729, 628, 628, 198 ]
3.391304
23