max_stars_repo_path
stringlengths
4
237
max_stars_repo_name
stringlengths
6
117
max_stars_count
int64
0
95.2k
id
stringlengths
1
7
content
stringlengths
12
593k
input_ids
sequencelengths
7
549k
sdk/python/pulumi_azure_native/relay/v20170401/_inputs.py
pulumi-bot/pulumi-azure-native
31
64732
<filename>sdk/python/pulumi_azure_native/relay/v20170401/_inputs.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from ._enums import * __all__ = [ 'SkuArgs', ] @pulumi.input_type class SkuArgs: def __init__(__self__, *, name: pulumi.Input['SkuName'], tier: Optional[pulumi.Input['SkuTier']] = None): """ SKU of the namespace. :param pulumi.Input['SkuName'] name: Name of this SKU. :param pulumi.Input['SkuTier'] tier: The tier of this SKU. """ pulumi.set(__self__, "name", name) if tier is not None: pulumi.set(__self__, "tier", tier) @property @pulumi.getter def name(self) -> pulumi.Input['SkuName']: """ Name of this SKU. """ return pulumi.get(self, "name") @name.setter def name(self, value: pulumi.Input['SkuName']): pulumi.set(self, "name", value) @property @pulumi.getter def tier(self) -> Optional[pulumi.Input['SkuTier']]: """ The tier of this SKU. """ return pulumi.get(self, "tier") @tier.setter def tier(self, value: Optional[pulumi.Input['SkuTier']]): pulumi.set(self, "tier", value)
[ 1, 529, 9507, 29958, 15348, 29914, 4691, 29914, 29886, 352, 15547, 29918, 17688, 29918, 11487, 29914, 2674, 388, 29914, 29894, 29906, 29900, 29896, 29955, 29900, 29946, 29900, 29896, 19891, 2080, 29879, 29889, 2272, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 29937, 18610, 399, 25614, 29901, 445, 934, 471, 5759, 491, 278, 27477, 15547, 12967, 3251, 1061, 29889, 18610, 13, 29937, 18610, 1938, 451, 3863, 491, 1361, 6521, 366, 29915, 276, 3058, 366, 1073, 825, 366, 526, 2599, 29991, 18610, 13, 13, 5215, 18116, 13, 5215, 9505, 15547, 13, 5215, 9505, 15547, 29889, 15634, 13, 3166, 19229, 1053, 3139, 29892, 341, 20304, 29892, 28379, 29892, 922, 3910, 29892, 7761, 13, 3166, 2023, 1053, 903, 4422, 1907, 29892, 903, 24051, 13, 3166, 869, 29918, 264, 6762, 1053, 334, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 29903, 2120, 7883, 742, 13, 29962, 13, 13, 29992, 29886, 352, 15547, 29889, 2080, 29918, 1853, 13, 1990, 317, 2120, 7883, 29901, 13, 1678, 822, 4770, 2344, 12035, 1649, 1311, 1649, 29892, 334, 29892, 13, 462, 1024, 29901, 9505, 15547, 29889, 4290, 1839, 29903, 2120, 1170, 7464, 13, 462, 26485, 29901, 28379, 29961, 29886, 352, 15547, 29889, 4290, 1839, 29903, 2120, 29911, 631, 2033, 29962, 353, 6213, 1125, 13, 4706, 9995, 13, 4706, 18581, 29965, 310, 278, 7397, 29889, 13, 4706, 584, 3207, 9505, 15547, 29889, 4290, 1839, 29903, 2120, 1170, 2033, 1024, 29901, 4408, 310, 445, 18581, 29965, 29889, 13, 4706, 584, 3207, 9505, 15547, 29889, 4290, 1839, 29903, 2120, 29911, 631, 2033, 26485, 29901, 450, 26485, 310, 445, 18581, 29965, 29889, 13, 4706, 9995, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 978, 613, 1024, 29897, 13, 4706, 565, 26485, 338, 451, 6213, 29901, 13, 9651, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 29873, 631, 613, 26485, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 13, 1678, 822, 1024, 29898, 1311, 29897, 1599, 9505, 15547, 29889, 4290, 1839, 29903, 2120, 1170, 2033, 29901, 13, 4706, 9995, 13, 4706, 4408, 310, 445, 18581, 29965, 29889, 13, 4706, 9995, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 978, 1159, 13, 13, 1678, 732, 978, 29889, 842, 357, 13, 1678, 822, 1024, 29898, 1311, 29892, 995, 29901, 9505, 15547, 29889, 4290, 1839, 29903, 2120, 1170, 2033, 1125, 13, 4706, 9505, 15547, 29889, 842, 29898, 1311, 29892, 376, 978, 613, 995, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 13, 1678, 822, 26485, 29898, 1311, 29897, 1599, 28379, 29961, 29886, 352, 15547, 29889, 4290, 1839, 29903, 2120, 29911, 631, 2033, 5387, 13, 4706, 9995, 13, 4706, 450, 26485, 310, 445, 18581, 29965, 29889, 13, 4706, 9995, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 29873, 631, 1159, 13, 13, 1678, 732, 29873, 631, 29889, 842, 357, 13, 1678, 822, 26485, 29898, 1311, 29892, 995, 29901, 28379, 29961, 29886, 352, 15547, 29889, 4290, 1839, 29903, 2120, 29911, 631, 2033, 29962, 1125, 13, 4706, 9505, 15547, 29889, 842, 29898, 1311, 29892, 376, 29873, 631, 613, 995, 29897, 13, 13, 13, 2 ]
parameter_prediction/models/mlp.py
mdenil/parameter_prediction
7
113210
import theano.tensor as T from pylearn2.models import mlp from pylearn2.space import VectorSpace from pylearn2.utils import sharedX from pylearn2.utils import safe_zip from pylearn2.linear.matrixmul import MatrixMul from collections import OrderedDict class MLP(mlp.MLP): def inv_prop(self, state_above): self.layers[-1].output_space.validate(state_above) state_from_above = self.layers[-1].inv_prop(state_above) layer_above = self.layers[-1] for layer in reversed(self.layers[:-1]): desired_space = layer_above.input_space state_from_above = layer.inv_prop( desired_space.format_as(state_from_above, layer.output_space)) layer_above = layer return state_from_above @property def output_space(self): return self.layers[-1].output_space def get_weight_decay(self, coeff): return sum(layer.get_weight_decay(coeff) for layer in self.layers) def get_l1_weight_decay(self, coeff): return sum(layer.get_l1_weight_decay(coeff) for layer in self.layers) class VectorSpaceConverter(mlp.Layer): def __init__(self, layer_name): self.layer_name = layer_name self._params = [] def set_input_space(self, space): self.input_space = space self.output_space = VectorSpace(space.get_total_dimension()) def fprop(self, state_below): return self.input_space.format_as(state_below, self.output_space) def inv_prop(self, state_above): return self.output_space.format_as(state_above, self.input_space) def get_weight_decay(self, coeff): return 0.0 def get_l1_weight_decay(self, coeff): return 0.0 class CompositeLayer(mlp.CompositeLayer): @property def dim(self): return sum(layer.dim for layer in self.layers) def get_input_space(self): input_space = self.layers[0].get_input_space() assert all(input_space == layer.get_input_space() for layer in self.layers) return input_space def inv_prop(self, state_above): if not isinstance(state_above, tuple): expected_space = VectorSpace(self.output_space.get_total_dimension()) state_above = expected_space.format_as(state_above, self.output_space) self.output_space.validate(state_above) return tuple(layer.inv_prop(state) for layer,state in safe_zip(self.layers, state_above)) class PretrainedLayer(mlp.PretrainedLayer): def fprop(self, *args, **kwargs): return self.layer_content.fprop(*args, **kwargs) def inv_prop(self, state_above): return self.layer_content.inv_prop(state_above) def get_weight_decay(self, coeff): return self.layer_content.get_weight_decay(coeff) def get_l1_weight_decay(self, coeff): return self.layer_content.get_weight_decay(coeff) class ReversableLayerMixin(object): def inv_prop(self, state_above): self.output_space.validate(state_above) return self.transformer.lmul_T(state_above) class Sigmoid(mlp.Sigmoid, ReversableLayerMixin): pass class RectifiedLinear(mlp.RectifiedLinear, ReversableLayerMixin): pass class SubsampledDictionaryLayer(mlp.Layer, ReversableLayerMixin): def __init__(self, dim, layer_name, dictionary): self.dim = dim self.layer_name = layer_name self.dictionary = dictionary def fprop(self, state_below): self.input_space.validate(state_below) if self.requires_reformat: state_below = self.input_space.format_as(state_below, self.desired_space) z = self.transformer.lmul(state_below) return z def set_input_space(self, space): self.input_space = space if isinstance(space, VectorSpace): self.requires_reformat = False self.input_dim = space.dim else: self.requires_reformat = True self.input_dim = space.get_total_dimension() self.desired_space = VectorSpace(self.input_dim) self.output_space = VectorSpace(self.dim) self.rng = self.mlp.rng # sanity checking assert self.dictionary.input_dim == self.input_dim assert self.dictionary.size >= self.dim indices = self.rng.permutation(self.dictionary.size) indices = indices[:self.dim] indices.sort() W = self.dictionary.get_subdictionary(indices) # dictionary atoms are stored in rows but transformers expect them to # be in columns. W = sharedX(W.T) W.name = self.layer_name + "_W" self.transformer = MatrixMul(W) # This is a static layer, there is no cost, no parameters, no updates, etc, etc def get_params(self): return [] def cost(self, Y, Y_hat): return 0.0 def cost_from_cost_matrix(self, cost_matrix): return 0.0 def cost_matrix(self, Y, Y_hat): return T.zeros_like(Y) def get_weight_decay(self, coeff): return 0.0 def get_l1_weight_decay(self, coeff): return 0.0
[ 1, 1053, 278, 1562, 29889, 20158, 408, 323, 13, 3166, 282, 1508, 2753, 29906, 29889, 9794, 1053, 286, 22833, 13, 3166, 282, 1508, 2753, 29906, 29889, 3493, 1053, 16510, 14936, 13, 3166, 282, 1508, 2753, 29906, 29889, 13239, 1053, 7258, 29990, 13, 3166, 282, 1508, 2753, 29906, 29889, 13239, 1053, 9109, 29918, 7554, 13, 3166, 282, 1508, 2753, 29906, 29889, 10660, 29889, 5344, 16109, 1053, 22513, 29924, 352, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 13, 1990, 341, 13208, 29898, 828, 29886, 29889, 1988, 29925, 1125, 13, 1678, 822, 2437, 29918, 7728, 29898, 1311, 29892, 2106, 29918, 27215, 1125, 13, 4706, 1583, 29889, 29277, 14352, 29896, 1822, 4905, 29918, 3493, 29889, 15480, 29898, 3859, 29918, 27215, 29897, 13, 13, 4706, 2106, 29918, 3166, 29918, 27215, 353, 1583, 29889, 29277, 14352, 29896, 1822, 11569, 29918, 7728, 29898, 3859, 29918, 27215, 29897, 13, 4706, 7546, 29918, 27215, 353, 1583, 29889, 29277, 14352, 29896, 29962, 13, 4706, 363, 7546, 297, 18764, 287, 29898, 1311, 29889, 29277, 7503, 29899, 29896, 29962, 1125, 13, 9651, 7429, 29918, 3493, 353, 7546, 29918, 27215, 29889, 2080, 29918, 3493, 13, 13, 9651, 2106, 29918, 3166, 29918, 27215, 353, 7546, 29889, 11569, 29918, 7728, 29898, 13, 462, 1678, 7429, 29918, 3493, 29889, 4830, 29918, 294, 29898, 3859, 29918, 3166, 29918, 27215, 29892, 7546, 29889, 4905, 29918, 3493, 876, 13, 13, 9651, 7546, 29918, 27215, 353, 7546, 13, 13, 4706, 736, 2106, 29918, 3166, 29918, 27215, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1962, 29918, 3493, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 29277, 14352, 29896, 1822, 4905, 29918, 3493, 13, 13, 1678, 822, 679, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 2533, 29898, 13148, 29889, 657, 29918, 7915, 29918, 7099, 388, 29898, 1111, 12352, 29897, 363, 7546, 297, 1583, 29889, 29277, 29897, 13, 13, 1678, 822, 679, 29918, 29880, 29896, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 2533, 29898, 13148, 29889, 657, 29918, 29880, 29896, 29918, 7915, 29918, 7099, 388, 29898, 1111, 12352, 29897, 363, 7546, 297, 1583, 29889, 29277, 29897, 13, 13, 1990, 16510, 14936, 18545, 29898, 828, 29886, 29889, 14420, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7546, 29918, 978, 1125, 13, 4706, 1583, 29889, 13148, 29918, 978, 353, 7546, 29918, 978, 13, 4706, 1583, 3032, 7529, 353, 5159, 13, 13, 1678, 822, 731, 29918, 2080, 29918, 3493, 29898, 1311, 29892, 2913, 1125, 13, 4706, 1583, 29889, 2080, 29918, 3493, 353, 2913, 13, 4706, 1583, 29889, 4905, 29918, 3493, 353, 16510, 14936, 29898, 3493, 29889, 657, 29918, 7827, 29918, 6229, 2673, 3101, 13, 13, 1678, 822, 285, 7728, 29898, 1311, 29892, 2106, 29918, 22503, 1125, 13, 4706, 736, 1583, 29889, 2080, 29918, 3493, 29889, 4830, 29918, 294, 29898, 3859, 29918, 22503, 29892, 1583, 29889, 4905, 29918, 3493, 29897, 13, 13, 1678, 822, 2437, 29918, 7728, 29898, 1311, 29892, 2106, 29918, 27215, 1125, 13, 4706, 736, 1583, 29889, 4905, 29918, 3493, 29889, 4830, 29918, 294, 29898, 3859, 29918, 27215, 29892, 1583, 29889, 2080, 29918, 3493, 29897, 13, 13, 1678, 822, 679, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 29871, 29900, 29889, 29900, 13, 13, 1678, 822, 679, 29918, 29880, 29896, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 29871, 29900, 29889, 29900, 13, 13, 1990, 24497, 568, 14420, 29898, 828, 29886, 29889, 1523, 1066, 568, 14420, 1125, 13, 1678, 732, 6799, 13, 1678, 822, 3964, 29898, 1311, 1125, 13, 4706, 736, 2533, 29898, 13148, 29889, 6229, 363, 7546, 297, 1583, 29889, 29277, 29897, 13, 13, 1678, 822, 679, 29918, 2080, 29918, 3493, 29898, 1311, 1125, 13, 4706, 1881, 29918, 3493, 353, 1583, 29889, 29277, 29961, 29900, 1822, 657, 29918, 2080, 29918, 3493, 580, 13, 4706, 4974, 599, 29898, 2080, 29918, 3493, 1275, 7546, 29889, 657, 29918, 2080, 29918, 3493, 580, 363, 7546, 297, 1583, 29889, 29277, 29897, 13, 4706, 736, 1881, 29918, 3493, 13, 13, 1678, 822, 2437, 29918, 7728, 29898, 1311, 29892, 2106, 29918, 27215, 1125, 13, 4706, 565, 451, 338, 8758, 29898, 3859, 29918, 27215, 29892, 18761, 1125, 13, 9651, 3806, 29918, 3493, 353, 16510, 14936, 29898, 1311, 29889, 4905, 29918, 3493, 29889, 657, 29918, 7827, 29918, 6229, 2673, 3101, 13, 9651, 2106, 29918, 27215, 353, 3806, 29918, 3493, 29889, 4830, 29918, 294, 29898, 3859, 29918, 27215, 29892, 1583, 29889, 4905, 29918, 3493, 29897, 13, 13, 4706, 1583, 29889, 4905, 29918, 3493, 29889, 15480, 29898, 3859, 29918, 27215, 29897, 13, 4706, 736, 18761, 29898, 13148, 29889, 11569, 29918, 7728, 29898, 3859, 29897, 363, 7546, 29892, 3859, 297, 9109, 29918, 7554, 29898, 1311, 29889, 29277, 29892, 2106, 29918, 27215, 876, 13, 13, 1990, 349, 2267, 22042, 14420, 29898, 828, 29886, 29889, 29925, 2267, 22042, 14420, 1125, 13, 1678, 822, 285, 7728, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 736, 1583, 29889, 13148, 29918, 3051, 29889, 29888, 7728, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 2437, 29918, 7728, 29898, 1311, 29892, 2106, 29918, 27215, 1125, 13, 4706, 736, 1583, 29889, 13148, 29918, 3051, 29889, 11569, 29918, 7728, 29898, 3859, 29918, 27215, 29897, 13, 13, 1678, 822, 679, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 1583, 29889, 13148, 29918, 3051, 29889, 657, 29918, 7915, 29918, 7099, 388, 29898, 1111, 12352, 29897, 13, 13, 1678, 822, 679, 29918, 29880, 29896, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 1583, 29889, 13148, 29918, 3051, 29889, 657, 29918, 7915, 29918, 7099, 388, 29898, 1111, 12352, 29897, 13, 13, 1990, 830, 874, 519, 14420, 29924, 861, 262, 29898, 3318, 1125, 13, 1678, 822, 2437, 29918, 7728, 29898, 1311, 29892, 2106, 29918, 27215, 1125, 13, 4706, 1583, 29889, 4905, 29918, 3493, 29889, 15480, 29898, 3859, 29918, 27215, 29897, 13, 4706, 736, 1583, 29889, 9067, 261, 29889, 29880, 16109, 29918, 29911, 29898, 3859, 29918, 27215, 29897, 13, 13, 1990, 15861, 29885, 3398, 29898, 828, 29886, 29889, 29903, 335, 29885, 3398, 29892, 830, 874, 519, 14420, 29924, 861, 262, 1125, 13, 1678, 1209, 13, 13, 1990, 22914, 2164, 12697, 29898, 828, 29886, 29889, 7364, 2164, 12697, 29892, 830, 874, 519, 14420, 29924, 861, 262, 1125, 13, 1678, 1209, 13, 13, 1990, 3323, 11249, 29881, 11513, 14420, 29898, 828, 29886, 29889, 14420, 29892, 830, 874, 519, 14420, 29924, 861, 262, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3964, 29892, 7546, 29918, 978, 29892, 8600, 1125, 13, 4706, 1583, 29889, 6229, 353, 3964, 13, 4706, 1583, 29889, 13148, 29918, 978, 353, 7546, 29918, 978, 13, 4706, 1583, 29889, 27126, 353, 8600, 13, 13, 1678, 822, 285, 7728, 29898, 1311, 29892, 2106, 29918, 22503, 1125, 13, 4706, 1583, 29889, 2080, 29918, 3493, 29889, 15480, 29898, 3859, 29918, 22503, 29897, 13, 13, 4706, 565, 1583, 29889, 276, 339, 2658, 29918, 276, 4830, 29901, 13, 9651, 2106, 29918, 22503, 353, 1583, 29889, 2080, 29918, 3493, 29889, 4830, 29918, 294, 29898, 3859, 29918, 22503, 29892, 1583, 29889, 2783, 2859, 29918, 3493, 29897, 13, 13, 4706, 503, 353, 1583, 29889, 9067, 261, 29889, 29880, 16109, 29898, 3859, 29918, 22503, 29897, 13, 13, 4706, 736, 503, 13, 13, 1678, 822, 731, 29918, 2080, 29918, 3493, 29898, 1311, 29892, 2913, 1125, 13, 4706, 1583, 29889, 2080, 29918, 3493, 353, 2913, 13, 13, 4706, 565, 338, 8758, 29898, 3493, 29892, 16510, 14936, 1125, 13, 9651, 1583, 29889, 276, 339, 2658, 29918, 276, 4830, 353, 7700, 13, 9651, 1583, 29889, 2080, 29918, 6229, 353, 2913, 29889, 6229, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 276, 339, 2658, 29918, 276, 4830, 353, 5852, 13, 9651, 1583, 29889, 2080, 29918, 6229, 353, 2913, 29889, 657, 29918, 7827, 29918, 6229, 2673, 580, 13, 9651, 1583, 29889, 2783, 2859, 29918, 3493, 353, 16510, 14936, 29898, 1311, 29889, 2080, 29918, 6229, 29897, 13, 13, 4706, 1583, 29889, 4905, 29918, 3493, 353, 16510, 14936, 29898, 1311, 29889, 6229, 29897, 13, 13, 4706, 1583, 29889, 29878, 865, 353, 1583, 29889, 828, 29886, 29889, 29878, 865, 13, 13, 4706, 396, 9753, 537, 8454, 13, 4706, 4974, 1583, 29889, 27126, 29889, 2080, 29918, 6229, 1275, 1583, 29889, 2080, 29918, 6229, 13, 4706, 4974, 1583, 29889, 27126, 29889, 2311, 6736, 1583, 29889, 6229, 13, 13, 4706, 16285, 353, 1583, 29889, 29878, 865, 29889, 546, 6149, 362, 29898, 1311, 29889, 27126, 29889, 2311, 29897, 13, 4706, 16285, 353, 16285, 7503, 1311, 29889, 6229, 29962, 13, 4706, 16285, 29889, 6605, 580, 13, 13, 4706, 399, 353, 1583, 29889, 27126, 29889, 657, 29918, 1491, 27126, 29898, 513, 1575, 29897, 13, 13, 4706, 396, 8600, 28422, 526, 6087, 297, 4206, 541, 4327, 414, 2149, 963, 304, 13, 4706, 396, 367, 297, 4341, 29889, 13, 4706, 399, 353, 7258, 29990, 29898, 29956, 29889, 29911, 29897, 13, 4706, 399, 29889, 978, 353, 1583, 29889, 13148, 29918, 978, 718, 11119, 29956, 29908, 13, 4706, 1583, 29889, 9067, 261, 353, 22513, 29924, 352, 29898, 29956, 29897, 13, 13, 1678, 396, 910, 338, 263, 2294, 7546, 29892, 727, 338, 694, 3438, 29892, 694, 4128, 29892, 694, 11217, 29892, 2992, 29892, 2992, 13, 1678, 822, 679, 29918, 7529, 29898, 1311, 1125, 13, 4706, 736, 5159, 13, 13, 1678, 822, 3438, 29898, 1311, 29892, 612, 29892, 612, 29918, 2455, 1125, 13, 4706, 736, 29871, 29900, 29889, 29900, 13, 13, 1678, 822, 3438, 29918, 3166, 29918, 18253, 29918, 5344, 29898, 1311, 29892, 3438, 29918, 5344, 1125, 13, 4706, 736, 29871, 29900, 29889, 29900, 13, 13, 1678, 822, 3438, 29918, 5344, 29898, 1311, 29892, 612, 29892, 612, 29918, 2455, 1125, 13, 4706, 736, 323, 29889, 3298, 359, 29918, 4561, 29898, 29979, 29897, 13, 13, 1678, 822, 679, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 29871, 29900, 29889, 29900, 13, 13, 1678, 822, 679, 29918, 29880, 29896, 29918, 7915, 29918, 7099, 388, 29898, 1311, 29892, 1302, 12352, 1125, 13, 4706, 736, 29871, 29900, 29889, 29900, 13, 2 ]
tests/pydevtest/test_iput_options.py
cyverse/irods
0
161159
import os import re import sys if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest import configuration from resource_suite import ResourceBase import lib class Test_iPut_Options(ResourceBase, unittest.TestCase): def setUp(self): super(Test_iPut_Options, self).setUp() def tearDown(self): super(Test_iPut_Options, self).tearDown() def test_iput_options(self): self.admin.assert_icommand('ichmod read ' + self.user0.username + ' ' + self.admin.session_collection) self.admin.assert_icommand('ichmod read ' + self.user1.username + ' ' + self.admin.session_collection) zero_filepath = os.path.join(self.admin.local_session_dir, 'zero') lib.touch(zero_filepath) self.admin.assert_icommand('iput --metadata "a;v;u;a0;v0" --acl "read ' + self.user0.username + ';' + 'write ' + self.user1.username + ';" -- ' + zero_filepath) self.admin.assert_icommand('imeta ls -d zero', 'STDOUT', '(attribute: *a0?\nvalue: *v0?\nunits: *u?(\n-+ *\n)?){2}', use_regex=True) self.admin.assert_icommand('iget -- ' + self.admin.session_collection + '/zero ' + self.admin.local_session_dir + '/newzero') self.user0.assert_icommand('iget -- ' + self.admin.session_collection + '/zero ' + self.user0.local_session_dir + '/newzero') filepath = os.path.join(self.admin.local_session_dir, 'file') lib.make_file(filepath, 1) self.admin.assert_icommand('iput --metadata "a;v;u;a2;v2" --acl "read ' + self.user0.username + ';' + 'write ' + self.user1.username + ';" -- ' + filepath) self.admin.assert_icommand('imeta ls -d file', 'STDOUT', '(attribute: *a2?\nvalue: *v2?\nunits: *u?(\n-+ *\n)?){2}', use_regex=True) self.admin.assert_icommand('ils -l', 'STDOUT') self.admin.assert_icommand('iget -- ' + self.admin.session_collection + '/file ' + self.admin.local_session_dir + '/newfile') self.user0.assert_icommand('iget -- ' + self.admin.session_collection + '/file ' + self.user0.local_session_dir + '/newfile') new_filepath = os.path.join(self.user1.local_session_dir, 'file') # skip the end until the iput -f of unowned files is resolved lib.make_file(new_filepath, 2) self.admin.assert_icommand('iput -f -- ' + filepath + ' ' + self.admin.session_collection + '/file') self.user1.assert_icommand('iput -f -- ' + new_filepath + ' ' + self.admin.session_collection + '/file')
[ 1, 1053, 2897, 13, 5215, 337, 13, 5215, 10876, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 529, 313, 29906, 29892, 29871, 29955, 1125, 13, 1678, 1053, 443, 27958, 29906, 408, 443, 27958, 13, 2870, 29901, 13, 1678, 1053, 443, 27958, 13, 13, 5215, 5285, 13, 3166, 6503, 29918, 13495, 1053, 18981, 5160, 13, 5215, 4303, 13, 13, 13, 1990, 4321, 29918, 29875, 22908, 29918, 5856, 29898, 6848, 5160, 29892, 443, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 3057, 29918, 29875, 22908, 29918, 5856, 29892, 1583, 467, 842, 3373, 580, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 2428, 29898, 3057, 29918, 29875, 22908, 29918, 5856, 29892, 1583, 467, 371, 279, 6767, 580, 13, 13, 1678, 822, 1243, 29918, 29875, 649, 29918, 6768, 29898, 1311, 1125, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 436, 1545, 1303, 525, 718, 1583, 29889, 1792, 29900, 29889, 6786, 718, 525, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 436, 1545, 1303, 525, 718, 1583, 29889, 1792, 29896, 29889, 6786, 718, 525, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 29897, 13, 4706, 5225, 29918, 1445, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 6406, 29889, 2997, 29918, 7924, 29918, 3972, 29892, 525, 9171, 1495, 13, 4706, 4303, 29889, 16747, 29898, 9171, 29918, 1445, 2084, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 29875, 649, 1192, 19635, 376, 29874, 29936, 29894, 29936, 29884, 29936, 29874, 29900, 29936, 29894, 29900, 29908, 1192, 562, 29880, 376, 949, 525, 718, 1583, 29889, 1792, 29900, 29889, 6786, 718, 21921, 29915, 13, 462, 462, 259, 718, 525, 3539, 525, 718, 1583, 29889, 1792, 29896, 29889, 6786, 718, 525, 15458, 1192, 525, 718, 5225, 29918, 1445, 2084, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 326, 1187, 19375, 448, 29881, 5225, 742, 525, 1254, 3970, 2692, 742, 13, 462, 462, 259, 525, 29898, 12715, 29901, 334, 29874, 29900, 29973, 29905, 29876, 1767, 29901, 334, 29894, 29900, 29973, 29905, 29876, 348, 1169, 29901, 334, 29884, 29973, 1194, 29876, 11793, 334, 29905, 29876, 6877, 2597, 29906, 29913, 742, 671, 29918, 13087, 29922, 5574, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 335, 300, 1192, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 718, 8207, 9171, 525, 718, 1583, 29889, 6406, 29889, 2997, 29918, 7924, 29918, 3972, 718, 8207, 1482, 9171, 1495, 13, 4706, 1583, 29889, 1792, 29900, 29889, 9294, 29918, 293, 3011, 392, 877, 335, 300, 1192, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 718, 8207, 9171, 525, 718, 1583, 29889, 1792, 29900, 29889, 2997, 29918, 7924, 29918, 3972, 718, 8207, 1482, 9171, 1495, 13, 4706, 934, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 6406, 29889, 2997, 29918, 7924, 29918, 3972, 29892, 525, 1445, 1495, 13, 4706, 4303, 29889, 5675, 29918, 1445, 29898, 1445, 2084, 29892, 29871, 29896, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 29875, 649, 1192, 19635, 376, 29874, 29936, 29894, 29936, 29884, 29936, 29874, 29906, 29936, 29894, 29906, 29908, 1192, 562, 29880, 376, 949, 525, 718, 1583, 29889, 1792, 29900, 29889, 6786, 718, 21921, 29915, 13, 462, 462, 259, 718, 525, 3539, 525, 718, 1583, 29889, 1792, 29896, 29889, 6786, 718, 525, 15458, 1192, 525, 718, 934, 2084, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 326, 1187, 19375, 448, 29881, 934, 742, 525, 1254, 3970, 2692, 742, 13, 462, 462, 259, 525, 29898, 12715, 29901, 334, 29874, 29906, 29973, 29905, 29876, 1767, 29901, 334, 29894, 29906, 29973, 29905, 29876, 348, 1169, 29901, 334, 29884, 29973, 1194, 29876, 11793, 334, 29905, 29876, 6877, 2597, 29906, 29913, 742, 671, 29918, 13087, 29922, 5574, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 2719, 448, 29880, 742, 525, 1254, 3970, 2692, 1495, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 335, 300, 1192, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 718, 8207, 1445, 525, 718, 1583, 29889, 6406, 29889, 2997, 29918, 7924, 29918, 3972, 718, 8207, 1482, 1445, 1495, 13, 4706, 1583, 29889, 1792, 29900, 29889, 9294, 29918, 293, 3011, 392, 877, 335, 300, 1192, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 718, 8207, 1445, 525, 718, 1583, 29889, 1792, 29900, 29889, 2997, 29918, 7924, 29918, 3972, 718, 8207, 1482, 1445, 1495, 13, 4706, 716, 29918, 1445, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 1792, 29896, 29889, 2997, 29918, 7924, 29918, 3972, 29892, 525, 1445, 1495, 13, 4706, 396, 14383, 278, 1095, 2745, 278, 474, 649, 448, 29888, 310, 443, 26689, 2066, 338, 11527, 13, 4706, 4303, 29889, 5675, 29918, 1445, 29898, 1482, 29918, 1445, 2084, 29892, 29871, 29906, 29897, 13, 4706, 1583, 29889, 6406, 29889, 9294, 29918, 293, 3011, 392, 877, 29875, 649, 448, 29888, 1192, 525, 718, 934, 2084, 718, 525, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 718, 8207, 1445, 1495, 13, 4706, 1583, 29889, 1792, 29896, 29889, 9294, 29918, 293, 3011, 392, 877, 29875, 649, 448, 29888, 1192, 525, 718, 716, 29918, 1445, 2084, 718, 525, 525, 718, 1583, 29889, 6406, 29889, 7924, 29918, 10855, 718, 8207, 1445, 1495, 13, 2 ]
crawler_her_sel_old.py
OliverWisn/mishmash_tao
0
111297
# crawler_her_sel.py # -*- coding: utf-8 -*- import time from selenium.webdriver import Firefox from selenium.webdriver.firefox.options import Options from bs4 import BeautifulSoup options = Options() options.add_argument("--headless") driver = Firefox(options=options) driver.get("https://www.flashscore.com/") # Wait for page to fully render time.sleep(5) pageSource = driver.page_source bsObj = BeautifulSoup(pageSource, "html.parser") games = bsObj.find_all("div", {"class":\ "event__participant event__participant--home"}) # print(len(games)) for game in games: print(game.get_text()) driver.quit()
[ 1, 396, 29349, 1358, 29918, 2276, 29918, 2838, 29889, 2272, 30004, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 30004, 13, 5215, 931, 30004, 13, 30004, 13, 3166, 18866, 29889, 29813, 1053, 14418, 30004, 13, 3166, 18866, 29889, 29813, 29889, 8696, 8944, 29889, 6768, 1053, 25186, 30004, 13, 3166, 24512, 29946, 1053, 25685, 29903, 1132, 30004, 13, 30004, 13, 6768, 353, 25186, 26471, 13, 6768, 29889, 1202, 29918, 23516, 703, 489, 2813, 2222, 1159, 30004, 13, 9465, 353, 14418, 29898, 6768, 29922, 6768, 8443, 13, 9465, 29889, 657, 703, 991, 597, 1636, 29889, 28041, 13628, 29889, 510, 29914, 1159, 30004, 13, 29937, 20340, 363, 1813, 304, 8072, 4050, 30004, 13, 2230, 29889, 17059, 29898, 29945, 8443, 13, 3488, 4435, 353, 7156, 29889, 3488, 29918, 4993, 30004, 13, 5824, 9930, 353, 25685, 29903, 1132, 29898, 3488, 4435, 29892, 376, 1420, 29889, 16680, 1159, 30004, 13, 29887, 1280, 353, 24512, 9930, 29889, 2886, 29918, 497, 703, 4563, 613, 8853, 1990, 1115, 29905, 30004, 13, 1678, 376, 3696, 1649, 1595, 12654, 424, 1741, 1649, 1595, 12654, 424, 489, 5184, 29908, 1800, 30004, 13, 29937, 1596, 29898, 2435, 29898, 29887, 1280, 876, 30004, 13, 30004, 13, 1454, 3748, 297, 8090, 29901, 30004, 13, 1678, 1596, 29898, 11802, 29889, 657, 29918, 726, 3101, 30004, 13, 30004, 13, 9465, 29889, 28358, 580, 2 ]
meter/connector/master.py
anbo225/docklet
273
123606
<reponame>anbo225/docklet<gh_stars>100-1000 #!/usr/bin/python3 import socket, select, errno, threading, os class master_connector: tcp_port = 1727 max_minions = 256 conn = {} epoll_fd = select.epoll() def establish_vswitch(ovsname): os.system('ovs-vsctl del-br ovs-%s >/dev/null 2>&1' % ovsname) os.system('ovs-vsctl add-br ovs-%s' % ovsname) os.system('brctl addif ovs-bridge ovs-%s >/dev/null 2>&1' % ovsname) os.system('ip link set ovs-system up') os.system('ip link set ovs-%s up' % ovsname) def build_gre_conn(ovsname, ipaddr): name = ipaddr.replace('.','_') os.system('ovs-vsctl add-port ovs-%s gre-%s -- set interface gre-%s type=gre options:remote_ip=%s 2>/dev/null' % (ovsname, name, name, ipaddr)) def break_gre_conn(ovsname, ipaddr): name = ipaddr.replace('.','_') os.system('ovs-vsctl del-port ovs-%s gre-%s 2>/dev/null' % (ovsname, name)) def close_connection(fd): master_connector.epoll_fd.unregister(fd) master_connector.conn[fd][0].close() addr = master_connector.conn[fd][1] master_connector.conn.pop(fd) master_connector.break_gre_conn('master', addr) def do_message_response(input_buffer): assert(input_buffer == b'ack') return b'ack' def start(): thread = threading.Thread(target = master_connector.run_forever, args = []) thread.setDaemon(True) thread.start() return thread def run_forever(): listen_fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) listen_fd.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) listen_fd.bind(('', master_connector.tcp_port)) listen_fd.listen(master_connector.max_minions) master_connector.epoll_fd.register(listen_fd.fileno(), select.EPOLLIN) datalist = {} master_connector.establish_vswitch('master') try: while True: epoll_list = master_connector.epoll_fd.poll() for fd, events in epoll_list: if fd == listen_fd.fileno(): fileno, addr = listen_fd.accept() fileno.setblocking(0) master_connector.epoll_fd.register(fileno.fileno(), select.EPOLLIN | select.EPOLLET) master_connector.conn[fileno.fileno()] = (fileno, addr[0]) master_connector.build_gre_conn('master', addr[0]) elif select.EPOLLIN & events: datas = b'' while True: try: data = master_connector.conn[fd][0].recv(10) if not data and not datas: master_connector.close_connection(fd) break else: datas += data except socket.error as msg: if msg.errno == errno.EAGAIN: try: datalist[fd] = master_connector.do_message_response(datas) master_connector.epoll_fd.modify(fd, select.EPOLLET | select.EPOLLOUT) except: master_connector.close_connection(fd) else: master_connector.close_connection(fd) break elif select.EPOLLOUT & events: sendLen = 0 while True: sendLen += master_connector.conn[fd][0].send(datalist[fd][sendLen:]) if sendLen == len(datalist[fd]): break master_connector.epoll_fd.modify(fd, select.EPOLLIN | select.EPOLLET) elif select.EPOLLHUP & events: master_connector.close_connection(fd) else: continue finally: os.system('ovs-vsctl del-br ovs-master >/dev/null 2>&1')
[ 1, 529, 276, 1112, 420, 29958, 273, 833, 29906, 29906, 29945, 29914, 29881, 1698, 1026, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 29941, 13, 13, 5215, 9909, 29892, 1831, 29892, 4589, 1217, 29892, 3244, 292, 29892, 2897, 13, 13, 1990, 5835, 29918, 11958, 2801, 29901, 13, 12, 13, 12, 23981, 29918, 637, 353, 29871, 29896, 29955, 29906, 29955, 13, 12, 3317, 29918, 1195, 1080, 353, 29871, 29906, 29945, 29953, 13, 12, 13, 12, 13082, 353, 6571, 13, 12, 1022, 3028, 29918, 11512, 353, 1831, 29889, 1022, 3028, 580, 13, 12, 13, 12, 1753, 10127, 29918, 29894, 15123, 29898, 586, 29879, 978, 1125, 13, 12, 12, 359, 29889, 5205, 877, 586, 29879, 29899, 4270, 16948, 628, 29899, 1182, 288, 4270, 19222, 29879, 1405, 29914, 3359, 29914, 4304, 29871, 29906, 19250, 29896, 29915, 1273, 288, 4270, 978, 29897, 13, 12, 12, 359, 29889, 5205, 877, 586, 29879, 29899, 4270, 16948, 788, 29899, 1182, 288, 4270, 19222, 29879, 29915, 1273, 288, 4270, 978, 29897, 13, 12, 12, 359, 29889, 5205, 877, 1182, 16948, 788, 361, 288, 4270, 29899, 18419, 288, 4270, 19222, 29879, 1405, 29914, 3359, 29914, 4304, 29871, 29906, 19250, 29896, 29915, 1273, 288, 4270, 978, 29897, 13, 12, 12, 359, 29889, 5205, 877, 666, 1544, 731, 288, 4270, 29899, 5205, 701, 1495, 13, 12, 12, 359, 29889, 5205, 877, 666, 1544, 731, 288, 4270, 19222, 29879, 701, 29915, 1273, 288, 4270, 978, 29897, 13, 12, 13, 12, 1753, 2048, 29918, 7979, 29918, 13082, 29898, 586, 29879, 978, 29892, 10377, 10030, 1125, 13, 12, 12, 978, 353, 10377, 10030, 29889, 6506, 12839, 3788, 29918, 1495, 13, 12, 12, 359, 29889, 5205, 877, 586, 29879, 29899, 4270, 16948, 788, 29899, 637, 288, 4270, 19222, 29879, 1395, 19222, 29879, 1192, 731, 5067, 1395, 19222, 29879, 1134, 29922, 7979, 3987, 29901, 16674, 29918, 666, 16328, 29879, 29871, 29906, 20690, 3359, 29914, 4304, 29915, 1273, 313, 586, 29879, 978, 29892, 1024, 29892, 1024, 29892, 10377, 10030, 876, 13, 12, 13, 12, 1753, 2867, 29918, 7979, 29918, 13082, 29898, 586, 29879, 978, 29892, 10377, 10030, 1125, 13, 12, 12, 978, 353, 10377, 10030, 29889, 6506, 12839, 3788, 29918, 1495, 13, 12, 12, 359, 29889, 5205, 877, 586, 29879, 29899, 4270, 16948, 628, 29899, 637, 288, 4270, 19222, 29879, 1395, 19222, 29879, 29871, 29906, 20690, 3359, 29914, 4304, 29915, 1273, 313, 586, 29879, 978, 29892, 1024, 876, 13, 12, 13, 12, 1753, 3802, 29918, 9965, 29898, 11512, 1125, 13, 12, 12, 6207, 29918, 11958, 2801, 29889, 1022, 3028, 29918, 11512, 29889, 348, 9573, 29898, 11512, 29897, 13, 12, 12, 6207, 29918, 11958, 2801, 29889, 13082, 29961, 11512, 3816, 29900, 1822, 5358, 580, 13, 12, 12, 10030, 353, 5835, 29918, 11958, 2801, 29889, 13082, 29961, 11512, 3816, 29896, 29962, 13, 12, 12, 6207, 29918, 11958, 2801, 29889, 13082, 29889, 7323, 29898, 11512, 29897, 13, 12, 12, 6207, 29918, 11958, 2801, 29889, 8690, 29918, 7979, 29918, 13082, 877, 6207, 742, 28915, 29897, 13, 13, 12, 1753, 437, 29918, 4906, 29918, 5327, 29898, 2080, 29918, 9040, 1125, 13, 12, 12, 9294, 29898, 2080, 29918, 9040, 1275, 289, 29915, 547, 1495, 13, 12, 12, 2457, 289, 29915, 547, 29915, 13, 12, 13, 12, 1753, 1369, 7295, 13, 12, 12, 7097, 353, 3244, 292, 29889, 4899, 29898, 5182, 353, 5835, 29918, 11958, 2801, 29889, 3389, 29918, 1079, 369, 29892, 6389, 353, 518, 2314, 13, 12, 12, 7097, 29889, 842, 27838, 9857, 29898, 5574, 29897, 13, 12, 12, 7097, 29889, 2962, 580, 13, 12, 12, 2457, 3244, 13, 12, 13, 12, 1753, 1065, 29918, 1079, 369, 7295, 13, 12, 12, 20631, 29918, 11512, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 29892, 29871, 29900, 29897, 13, 12, 12, 20631, 29918, 11512, 29889, 842, 21852, 3670, 29898, 11514, 29889, 29903, 5607, 29918, 6156, 7077, 2544, 29892, 9909, 29889, 6156, 29918, 1525, 17171, 3035, 8353, 29892, 29871, 29896, 29897, 13, 12, 12, 20631, 29918, 11512, 29889, 5355, 29898, 877, 742, 5835, 29918, 11958, 2801, 29889, 23981, 29918, 637, 876, 13, 12, 12, 20631, 29918, 11512, 29889, 20631, 29898, 6207, 29918, 11958, 2801, 29889, 3317, 29918, 1195, 1080, 29897, 13, 12, 12, 13, 12, 12, 6207, 29918, 11958, 2801, 29889, 1022, 3028, 29918, 11512, 29889, 9573, 29898, 20631, 29918, 11512, 29889, 1777, 8154, 3285, 1831, 29889, 29923, 13152, 2208, 1177, 29897, 13, 12, 12, 13, 12, 12, 29881, 2075, 391, 353, 6571, 13, 12, 12, 13, 12, 12, 6207, 29918, 11958, 2801, 29889, 342, 370, 1674, 29918, 29894, 15123, 877, 6207, 1495, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 8000, 5852, 29901, 13, 12, 12, 12, 12, 1022, 3028, 29918, 1761, 353, 5835, 29918, 11958, 2801, 29889, 1022, 3028, 29918, 11512, 29889, 29886, 3028, 580, 13, 12, 12, 12, 12, 1454, 285, 29881, 29892, 4959, 297, 9358, 3028, 29918, 1761, 29901, 13, 12, 12, 12, 12, 12, 361, 285, 29881, 1275, 11621, 29918, 11512, 29889, 1777, 8154, 7295, 13, 12, 12, 12, 12, 12, 12, 1777, 8154, 29892, 28915, 353, 11621, 29918, 11512, 29889, 16044, 580, 13, 12, 12, 12, 12, 12, 12, 1777, 8154, 29889, 842, 1271, 292, 29898, 29900, 29897, 13, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 1022, 3028, 29918, 11512, 29889, 9573, 29898, 1777, 8154, 29889, 1777, 8154, 3285, 1831, 29889, 29923, 13152, 2208, 1177, 891, 1831, 29889, 15488, 5607, 1307, 29911, 29897, 13, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 13082, 29961, 1777, 8154, 29889, 1777, 8154, 580, 29962, 353, 313, 1777, 8154, 29892, 28915, 29961, 29900, 2314, 13, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 4282, 29918, 7979, 29918, 13082, 877, 6207, 742, 28915, 29961, 29900, 2314, 13, 12, 12, 12, 12, 12, 23681, 1831, 29889, 29923, 13152, 2208, 1177, 669, 4959, 29901, 13, 12, 12, 12, 12, 12, 12, 14538, 353, 289, 4907, 13, 12, 12, 12, 12, 12, 12, 8000, 5852, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 1272, 353, 5835, 29918, 11958, 2801, 29889, 13082, 29961, 11512, 3816, 29900, 1822, 3757, 29894, 29898, 29896, 29900, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 12, 361, 451, 848, 322, 451, 6155, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 5358, 29918, 9965, 29898, 11512, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 8690, 13, 12, 12, 12, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14538, 4619, 848, 13, 12, 12, 12, 12, 12, 12, 12, 19499, 9909, 29889, 2704, 408, 10191, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 361, 10191, 29889, 3127, 1217, 1275, 4589, 1217, 29889, 29923, 10051, 29909, 1177, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 29881, 2075, 391, 29961, 11512, 29962, 353, 5835, 29918, 11958, 2801, 29889, 1867, 29918, 4906, 29918, 5327, 29898, 14538, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 1022, 3028, 29918, 11512, 29889, 1545, 1598, 29898, 11512, 29892, 1831, 29889, 15488, 5607, 1307, 29911, 891, 1831, 29889, 29923, 13152, 2208, 12015, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 19499, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 5358, 29918, 9965, 29898, 11512, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 5358, 29918, 9965, 29898, 11512, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 12, 8690, 13, 12, 12, 12, 12, 12, 23681, 1831, 29889, 29923, 13152, 2208, 12015, 669, 4959, 29901, 13, 12, 12, 12, 12, 12, 12, 6717, 21515, 353, 29871, 29900, 13, 12, 12, 12, 12, 12, 12, 8000, 5852, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 6717, 21515, 4619, 5835, 29918, 11958, 2801, 29889, 13082, 29961, 11512, 3816, 29900, 1822, 6717, 29898, 29881, 2075, 391, 29961, 11512, 3816, 6717, 21515, 29901, 2314, 13, 12, 12, 12, 12, 12, 12, 12, 361, 3638, 21515, 1275, 7431, 29898, 29881, 2075, 391, 29961, 11512, 29962, 1125, 13, 12, 12, 12, 12, 12, 12, 12, 12, 8690, 13, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 1022, 3028, 29918, 11512, 29889, 1545, 1598, 29898, 11512, 29892, 1831, 29889, 29923, 13152, 2208, 1177, 891, 1831, 29889, 15488, 5607, 1307, 29911, 29897, 13, 12, 12, 12, 12, 12, 23681, 1831, 29889, 29923, 13152, 2208, 29950, 4897, 669, 4959, 29901, 13, 12, 12, 12, 12, 12, 12, 6207, 29918, 11958, 2801, 29889, 5358, 29918, 9965, 29898, 11512, 29897, 13, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 19878, 13, 12, 12, 4951, 635, 29901, 13, 12, 12, 12, 359, 29889, 5205, 877, 586, 29879, 29899, 4270, 16948, 628, 29899, 1182, 288, 4270, 29899, 6207, 1405, 29914, 3359, 29914, 4304, 29871, 29906, 19250, 29896, 1495, 13, 12, 12, 13, 2 ]
server/routines/urls.py
IvanGelo1/thesis-project
2
1602190
<reponame>IvanGelo1/thesis-project<filename>server/routines/urls.py<gh_stars>1-10 from django.urls import path, include from .views import RoutinesView urlpatterns = [ path('api/routines/getAll', RoutinesView.as_view()), ]
[ 1, 529, 276, 1112, 420, 29958, 29902, 3703, 29954, 7078, 29896, 29914, 26533, 29899, 4836, 29966, 9507, 29958, 2974, 29914, 14608, 1475, 29914, 26045, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 9557, 29889, 26045, 1053, 2224, 29892, 3160, 13, 3166, 869, 7406, 1053, 20829, 1475, 1043, 13, 13, 2271, 11037, 29879, 353, 518, 13, 29871, 2224, 877, 2754, 29914, 14608, 1475, 29914, 657, 3596, 742, 20829, 1475, 1043, 29889, 294, 29918, 1493, 25739, 13, 29962, 2 ]
cloudentries/fusioncompute/lifecycles/fc_rest_client/storage/volumes.py
CloudChef/CloudEntries
0
50233
# Copyright (c) 2021 Qianyun, Inc. All rights reserved. from ..common import FusionComputeBase from cloudify import ctx class VolumesClient(FusionComputeBase): IDENTIFIER = 'volumes' def list(self, urn, limit=100, offset=0): uri_prefix = '/'.join([self.urn2uri(urn), self.IDENTIFIER]) pagination = "limit={limit}&offset={offset}".format(limit=limit, offset=offset) uri = "?".join([uri_prefix, pagination]) return self.rest_client.get(uri) def create(self, urn, config): uri = "/".join([self.urn2uri(urn), self.IDENTIFIER]) return self.rest_client.post(uri, data=config) def delete(self, urn, is_format=0): uri_perfix = self.urn2uri(urn) pagination = "isFormat={}".format(is_format) uri = "?".join([uri_perfix, pagination]) return self.rest_client.delete(uri) def expandvol(self, urn, config): action = '/action/expandvol' server_uri = self.urn2uri(urn) uri = server_uri + action ctx.logger.info('uri: {}, data: {}'.format(uri, config)) return self.rest_client.post(uri, data=config)
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29896, 660, 713, 29891, 348, 29892, 9266, 29889, 2178, 10462, 21676, 29889, 13, 13, 3166, 6317, 9435, 1053, 383, 3958, 20606, 29872, 5160, 13, 3166, 9570, 1598, 1053, 12893, 13, 13, 13, 1990, 3684, 9351, 4032, 29898, 29943, 3958, 20606, 29872, 5160, 1125, 13, 1678, 3553, 3919, 29902, 3738, 1001, 353, 525, 1555, 9351, 29915, 13, 13, 1678, 822, 1051, 29898, 1311, 29892, 5065, 29876, 29892, 4046, 29922, 29896, 29900, 29900, 29892, 9210, 29922, 29900, 1125, 13, 4706, 21333, 29918, 13506, 353, 8207, 4286, 7122, 4197, 1311, 29889, 595, 29906, 5338, 29898, 595, 511, 1583, 29889, 1367, 3919, 29902, 3738, 1001, 2314, 13, 4706, 10203, 3381, 353, 376, 13400, 3790, 13400, 15704, 10289, 3790, 10289, 29913, 1642, 4830, 29898, 13400, 29922, 13400, 29892, 9210, 29922, 10289, 29897, 13, 4706, 21333, 353, 376, 29973, 1642, 7122, 4197, 5338, 29918, 13506, 29892, 10203, 3381, 2314, 13, 4706, 736, 1583, 29889, 5060, 29918, 4645, 29889, 657, 29898, 5338, 29897, 13, 13, 1678, 822, 1653, 29898, 1311, 29892, 5065, 29876, 29892, 2295, 1125, 13, 4706, 21333, 353, 5591, 1642, 7122, 4197, 1311, 29889, 595, 29906, 5338, 29898, 595, 511, 1583, 29889, 1367, 3919, 29902, 3738, 1001, 2314, 13, 4706, 736, 1583, 29889, 5060, 29918, 4645, 29889, 2490, 29898, 5338, 29892, 848, 29922, 2917, 29897, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 5065, 29876, 29892, 338, 29918, 4830, 29922, 29900, 1125, 13, 4706, 21333, 29918, 546, 5878, 353, 1583, 29889, 595, 29906, 5338, 29898, 595, 29897, 13, 4706, 10203, 3381, 353, 376, 275, 5809, 3790, 29913, 1642, 4830, 29898, 275, 29918, 4830, 29897, 13, 4706, 21333, 353, 376, 29973, 1642, 7122, 4197, 5338, 29918, 546, 5878, 29892, 10203, 3381, 2314, 13, 4706, 736, 1583, 29889, 5060, 29918, 4645, 29889, 8143, 29898, 5338, 29897, 13, 13, 1678, 822, 7985, 1555, 29898, 1311, 29892, 5065, 29876, 29892, 2295, 1125, 13, 4706, 3158, 353, 8207, 2467, 29914, 18837, 1555, 29915, 13, 4706, 1923, 29918, 5338, 353, 1583, 29889, 595, 29906, 5338, 29898, 595, 29897, 13, 4706, 21333, 353, 1923, 29918, 5338, 718, 3158, 13, 4706, 12893, 29889, 21707, 29889, 3888, 877, 5338, 29901, 24335, 848, 29901, 6571, 4286, 4830, 29898, 5338, 29892, 2295, 876, 13, 4706, 736, 1583, 29889, 5060, 29918, 4645, 29889, 2490, 29898, 5338, 29892, 848, 29922, 2917, 29897, 13, 2 ]
python/ccxt/tprexchange.py
ThePeoplesReserve/ccxt
0
40574
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError from ccxt.base.errors import BadRequest from ccxt.base.errors import BadSymbol from ccxt.base.errors import InvalidOrder from ccxt.base.decimal_to_precision import SIGNIFICANT_DIGITS import json import sys from datetime import datetime class tprexchange(Exchange): def describe(self): return self.deep_extend(super(tprexchange, self).describe(), { 'id': 'tprexchange', 'name': 'TPR Exchange', # 'countries': ['US'], # 'rateLimit': 500, 'version': 'v1', 'certified': False, 'has': { 'loadMarkets': True, 'cancelAllOrders': False, 'cancelOrder': True, 'cancelOrders': False, 'CORS': False, 'createDepositAddress': False, 'createLimitOrder': False, 'createMarketOrder': False, 'createOrder': True, 'deposit': False, 'editOrder': 'emulated', 'fetchBalance': True, 'fetchBidsAsks': False, 'fetchClosedOrders': True, 'fetchCurrencies': True, 'fetchDepositAddress': False, 'fetchDeposits': False, 'fetchFundingFees': False, 'fetchL2OrderBook': False, 'fetchLedger': False, 'fetchMarkets': True, 'fetchMyTrades': True, 'fetchOHLCV': True, 'fetchOpenOrders': True, 'fetchOrder': True, 'fetchOrderBook': True, 'fetchOrderBooks': False, 'fetchOrders': True, 'fetchOrderTrades': False, 'fetchStatus': True, 'fetchTicker': True, 'fetchTickers': True, 'fetchTime': False, 'fetchTrades': True, 'fetchTradingFee': False, 'fetchTradingFees': False, 'fetchTradingLimits': False, 'fetchTransactions': False, 'fetchWithdrawals': False, 'privateAPI': True, 'publicAPI': False, 'signIn': True, 'withdraw': False, 'getMarketPrice': True, }, 'timeframes': { '1m': '1', '1h': '60', '1d': '1440', '1w': '10080', '1mn': '43200', }, 'urls': { 'logo': '', 'api': '{hostname}', 'www': '', 'doc': '', 'fees': '', 'referral': '', }, 'api': { 'private': { 'get': [ ], 'post': [ 'ucenter/api-login', 'ucenter/member/balance', 'market/symbol-thumb', 'market/coins-info', 'market/symbol-info', 'exchange/order/add', 'exchange/order/find', 'exchange/order/all', 'exchange/order/apicancel', 'exchange/order/trades', 'exchange/order/my-trades', 'exchange/exchange-coin/base-symbol', ], 'delete': [ ], }, 'feed': { 'get': [ ], }, }, 'fees': { 'trading': { }, }, 'requiredCredentials': { 'apiKey': True, 'secret': True, 'uid': False, }, 'precisionMode': SIGNIFICANT_DIGITS, 'options': { 'createMarketBuyOrderRequiresPrice': False, }, 'exceptions': { 'exact': { 'Invalid cost': InvalidOrder, # {"message":"Invalid cost","_links":{"self":{"href":"/orders","templated":false}}} 'Invalid order ID': InvalidOrder, # {"message":"Invalid order ID","_links":{"self":{"href":"/orders/4a151805-d594-4a96-9d64-e3984f2441f7","templated":false}}} 'Invalid market !': BadSymbol, # {"message":"Invalid market !","_links":{"self":{"href":"/markets/300/order-book","templated":false}}} }, 'broad': { 'Failed to convert argument': BadRequest, }, }, }) def parse_ticker(self, response): if len(response) == 0: return [] symbol = response[0].get('symbol') high = 0 bidVolume = 0 askVolume = 0 vwap = 0 vwapCost = 0 vwapVolume = 0 open_ = 'None' close = 0 last = close previousClose = 'None' change = 'None' percentage = 'None' average = 'None' baseVolume = 0 quoteVolume = 0 time = 0 lastDayTime = int((datetime.now().timestamp() - 86400) * 1000) currentTimestamp = int(datetime.now().timestamp() * 1000) currentDatetime = str(datetime.fromtimestamp(currentTimestamp * 0.001)) low = response[0].get('price') bid = 0 ask = sys.maxsize openSellOrdersCount = 0 for order in response: price = order.get('price') amount = order.get('amount') timestamp = order.get('timestamp') if high < price: high = price if low > price: low = price if order.get('status') == 'open': if order.get('side') == 'buy': if bid < price: bid = price if bidVolume < amount: bidVolume = amount if order.get('status') == 'open': if order.get('side') == 'sell': openSellOrdersCount += 1 if ask > price: ask = price if askVolume < amount: askVolume = amount if order.get('info').get('status') == 'COMPLETED': vwapCost += price * amount vwapVolume += amount if time < timestamp: time = timestamp close = price if timestamp > lastDayTime: quoteVolume += amount baseVolume += price if vwapVolume != 0: vwap = vwapCost / vwapVolume if openSellOrdersCount == 0: ask = 0 last = close result = { 'symbol': symbol, 'info': response, 'timestamp': currentTimestamp, 'datetime': currentDatetime, 'high': high, 'low': low, 'bid': bid, 'bidVolume': bidVolume, 'ask': ask, 'askVolume': askVolume, 'vwap': vwap, 'open': open_, 'close': close, 'last': last, 'previousClose': previousClose, 'change': change, 'percentage': percentage, 'average': average, 'baseVolume': baseVolume, 'quoteVolume': quoteVolume, } return result def fetch_ticker(self, symbol, since=None, limit=None): response = self.fetch_orders(symbol, since, limit) # Response example: # { # 'symbol': 'BTC/USDT', # 'info': [...], # 'timestamp': 1615386851976, # 'datetime': '2021-03-10 16:34:11.976000', # 'high': 50.0, # 'low': 1.0, # 'bid': 30.0, # 'bidVolume': 15.0, # 'ask': 40.0, # 'askVolume': 25.0, # 'vwap': 11.0, # 'open': 'None', # 'close': 20.0, # 'last': 20.0, # 'previousClose': 'None', # 'change': 'None', # 'percentage': 'None', # 'average': 'None', # 'baseVolume': 60.0, # 'quoteVolume': 30.0 # } return self.parse_ticker(response) def fetch_tickers(self, since=None, limit=None): # Response example: # [ # { # 'symbol': 'BTC/USDT', # 'info': [...], # 'timestamp': 1615386851976, # 'datetime': '2021-03-10 16:34:11.976000', # 'high': 50.0, # 'low': 1.0, # 'bid': 30.0, # 'bidVolume': 15.0, # 'ask': 40.0, # 'askVolume': 25.0, # 'vwap': 11.0, # 'open': 'None', # 'close': 20.0, # 'last': 20.0, # 'previousClose': 'None', # 'change': 'None', # 'percentage': 'None', # 'average': 'None', # 'baseVolume': 60.0, # 'quoteVolume': 30.0 # }, # ... # ] result = [] symbols = self.fetch_markets() for symblol in symbols: response = self.fetch_orders(symblol.get('symbol'), since, limit) ticker = self.parse_ticker(response) if len(ticker) != 0: result.append(ticker) return result def fetch_order_book(self, symbol, limit, since=0): # Response example: # { # 'bids': # [ # [20.0, 10.0, 'E161538482263642'], // [price, amount, orderId] # [30.0, 15.0, 'E161538482271646'] # ], # 'asks': # [ # [40.0, 20.0, 'E161538482278825'], # [50.0, 25.0, 'E161538482286085'] # ], # 'timestamp': 1615390711695, # 'datetime': '2021-03-10 17:38:31.695000', # 'nonce': 1615390711695 # } orders = self.fetch_open_orders(symbol, since, limit) bids = [] asks = [] for order in orders: temp = [] temp.append(order.get('price')) temp.append(order.get('amount')) temp.append(order.get('id')) if order.get('side') == 'buy': bids.append(temp) else: asks.append(temp) currentTimestamp = int(datetime.now().timestamp() * 1000) currentDatetime = str(datetime.fromtimestamp(currentTimestamp * 0.001)) result = { 'bids': bids, 'asks': asks, 'timestamp': currentTimestamp, 'datetime': currentDatetime, 'nonce': currentTimestamp, } return result def parse_markets(self, response): listData = [] for value in response: tmp = { "id": value.get("coinSymbol"), "symbol": value.get("symbol"), "base": value.get("coinSymbol"), "quote": value.get("baseSymbol"), "baseId": value.get("coinSymbol"), "quoteId": value.get("baseSymbol"), "type": value.get("publishType"), "active": value.get("enable"), "precision": { "amount": value.get("coinScale"), "price": value.get("baseCoinScale"), }, "limits": { "amount": {"min": value.get("minVolume"), "max": value.get("maxVolume")}, "price": {"min": value.get("minSellPrice"), "max": value.get("maxBuyPrice")}, "cost": {"min": value.get("minVolume") * value.get("minSellPrice"), "max": value.get("maxVolume") * value.get("maxBuyPrice")}, }, "taker": value.get("fee"), "maker": value.get("fee"), "info": value, } listData.append(tmp) return listData def add_frame(self, timeFrameStart, timeFrameEnd, timeframe, highestPrice, lowestPrice, amount, result, openPrice, closePrice): frame = [] frame.append(timeFrameStart) frame.append(openPrice) frame.append(highestPrice) frame.append(lowestPrice) frame.append(closePrice) frame.append(amount) result.append(frame) def parse_ohlcv(self, response, since, timeframe): highestPrice = 0 lowestPrice = sys.maxsize price = 0 amount = 0 timeFrameStart = since timeFrameEnd = int((since * 0.001 + timeframe) * 1000) result = [] i = 0 orders = response.get('content') isOpenPrice = True openPrice = 0 closePrice = 0 while i < len(orders): if isOpenPrice == True: openPrice = orders[i].get('price') isOpenPrice = False time = orders[i].get('time') if time >= timeFrameStart and time <= timeFrameEnd: price = orders[i].get('price') closePrice = price if highestPrice < price: highestPrice = price if lowestPrice > price: lowestPrice = price amount += orders[i].get('amount') i += 1 if i == len(orders): self.add_frame(timeFrameStart, timeFrameEnd, timeframe, highestPrice, lowestPrice, amount, result, openPrice, closePrice) else: if lowestPrice == sys.maxsize: lowestPrice = 0 openPrice = 0 closePrice = 0 i -= 1 self.add_frame(timeFrameStart, timeFrameEnd, timeframe, highestPrice, lowestPrice, amount, result, openPrice, closePrice) timeFrameStart = timeFrameEnd + 1 timeFrameEnd = int((timeFrameEnd * 0.001 + timeframe) * 1000) amount = 0 highestPrice = 0 lowestPrice = sys.maxsize isOpenPrice = True i += 1 return result # timeframe variants: # 1m (one minute); # 1h (one hour); # 1d (one day - 24 hours) # 1w (one week - 7 days) # 1mn (one mounth - 30 days) def fetch_ohlcv(self, symbol, timeframe=None, since=0, limit=None, params={}): # Response example: # [ # [ # 1504541580000, // UTC timestamp in milliseconds, integer # 4235.4, // (O)pen price, float # 4240.6, // (H)ighest price, float # 4230.0, // (L)owest price, float # 4230.7, // (C)losing price, float # 37.72941911 // (V)olume (in terms of the base currency), float # ], # ... # ] inputDataCheck = False for frame in self.timeframes: if frame == timeframe: inputDataCheck = True break if inputDataCheck == False: return {'error': 'Incorrect timeframe'} tFrame = int(self.timeframes.get(timeframe)) * 60 default_order_amount_limit = 100 params['status'] = 'COMPLETED' if 'page' in params: params['pageNo'] = self.safe_string(params, 'page') else: params['pageNo'] = 0 if since is None: since = 0 if limit is None: limit = default_order_amount_limit request = { 'symbol': symbol, 'since': since, 'pageSize': limit, } fullRequest = self.extend(request, params) response = self.privatePostExchangeOrderAll(fullRequest) return self.parse_ohlcv(response, since, tFrame) def fetch_markets(self, symbol=''): request = { 'symbol': symbol, } response = self.privatePostMarketSymbolInfo(request) return self.parse_markets(response) # RETURN EXAMPLE: # [ # { # 'id': 'BTC', # 'symbol': 'BTC/USDT', # 'base': 'BTC', # 'quote': 'USDT', # 'baseId': 'BTC', # 'quoteId': 'USDT', # 'type': 'NONE', # 'active': 1, # 'precision': { 'amount': 2, 'price': 2 }, # 'limits': # { # 'amount': { 'min': 0.0, 'max': 0.0 }, # 'price': { 'min': 0.0, 'max': 0.0 }, # 'cost': { 'min': 0.0, 'max': 0.0 } # }, # 'taker': 0.001, # 'maker': 0.001, # 'info': {backend response} # }, # ... # ] def load_markets(self, reload=False, symbol=''): if not reload: if self.markets: if not self.markets_by_id: return self.set_markets(self.markets) return self.markets currencies = None if self.has['fetchCurrencies']: currencies = self.fetch_currencies() markets = self.fetch_markets(symbol) return self.set_markets(markets, currencies) def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): # Check existance of authentication token # Just use empy one in case of an application is not signed in yet authToken = '' if 'token' in self.options: authToken = self.options['token'] # Get URL url = self.implode_params(self.urls['api'], {'hostname': self.hostname}) + '/' + path # Calculate body and content type depending on method type: GET or POST keys = list(params.keys()) keysLength = len(keys) # In case of body is still not assigned just make it empty string if body is None: body = '' # Prepare line for hashing # This hash sum is checked on backend side to verify API user # POST params should not be added as body query = method + ' /' + path + ' ' + self.urlencode(params) + ' ' + authToken + '\n' + body signed = self.hmac(self.encode(query), self.encode(self.secret)) contentType = None if method == 'POST': contentType = 'application/x-www-form-urlencoded' if keysLength > 0: body = self.urlencode(params) else: if keysLength > 0: url += '?' + self.urlencode(params) headers = { 'x-auth-sign': signed, 'x-auth-token': authToken, } if authToken != '': headers['access-auth-token'] = authToken if contentType is not None: headers['Content-Type'] = contentType return {'url': url, 'method': method, 'body': body, 'headers': headers} def sign_in(self, params={}): params = { 'key': self.key, 'token': self.token, } response = self.privatePostUcenterApiLogin(params) loginData = response['data'] self.options['token'] = self.safe_string(loginData, 'token') memberId = self.safe_string(loginData, 'id') return memberId def fetch_status(self): # Responce examples: # {'status': 'ok'} # or # {'status': 'shutdown', 'reason': 'ExchangeNotAvailable'} # or # {'status': 'shutdown', 'reason': 'Unknown reason'} result = False try: response = self.privatePostExchangeExchangeCoinBaseSymbol() for field in response.items(): if field[0] == 'message': if field[1] == 'SUCCESS': result = True if result is True: return {"status": "ok"} else: return {"status": "shutdown", "reason": "ExchangeNotAvailable"} except: reason = str(sys.exc_info()[0]) if reason.find('ExchangeNotAvailable') != -1: return {"status": "shutdown", "reason": "ExchangeNotAvailable"} else: return {"status": "shutdown", "reason": "Unknown reason"} def parse_currencies(self, response): listData = [] for value in response: tmp = { 'id': value.get('name'), 'code': value.get('name').upper(), 'name': value.get('name'), 'active': bool(value.get('status')), 'fee': 0.005, 'precision': 0, 'limits': { 'amount': { 'min': 'None', 'max': 'None', }, 'price': { 'min': 'None', 'max': 'None', }, 'cost': { 'min': 'None', 'max': 'None', }, 'withdraw': { 'min': value.get('minWithdrawAmount'), 'max': value.get('maxWithdrawAmount'), }, }, 'info': value } listData.append(tmp) return listData def fetch_currencies(self): # Responce example #[ # { # 'id': 'BTC', # 'code': 'BTC', # 'name': 'BTC', # 'active': True, # 'fee': 0.001, # 'precision': 0, # 'limits': // TPR exchange has no restrictions # { # 'amount': # { # 'min': 'None', # 'max': 'None' # }, # 'price': # { # 'min': 'None', # 'max': 'None' # }, # 'cost': # { # 'min': 'None', # 'max': 'None' # }, # 'withdraw': # { # 'min': 1.0, # 'max': 5000.0 # } # }, # 'info': { }, # }, # ... #] try: response = self.privatePostMarketCoinsInfo() return self.parse_currencies(response) except: reason = str(sys.exc_info()[0]) if reason.find('ExchangeNotAvailable') != -1: return {"Error": "ExchangeNotAvailable"} else: return {"Error": "Unknown reason"} def fetch_order(self, id, symbol=None, params={}): request = { 'orderId': id, } response = self.privatePostExchangeOrderFind(request) return self.parse_order(response) def parse_order(self, order, market=None): # { # 'orderId':'E161183624377614', # 'memberId':2, # 'type':'LIMIT_PRICE', # 'amount':1000.0, # 'symbol':'BCH/USDT', # 'tradedAmount':1000.0, # 'turnover':1080.0, # 'coinSymbol':'BCH', # 'baseSymbol':'USDT', # 'status':'COMPLETED', # 'latestTradeTimestamp':1611836256242, # 'direction':'SELL', # 'price':1.0, # 'time':1611836243776, # 'completedTime':1611836256242, # }, if not order: return None type = 'market' if order['type'] == 'LIMIT_PRICE': type = 'limit' side = order['direction'].lower() remaining = order['amount'] - order['tradedAmount'] status = order['status'] if status == 'COMPLETED': status = 'closed' elif status == 'TRADING' or status == 'PAUSED' or status == 'RESERVED': status = 'open' else: status = 'canceled' cost = order['tradedAmount'] * order['price'] result = { 'info': order, 'id': order['orderId'], 'clientOrderId': order['memberId'], 'timestamp': order['time'], 'datetime': self.iso8601(order['time']), 'latestTradeTimestamp': order['latestTradeTimestamp'], 'symbol': order['symbol'], 'type': type, 'timeInForce': None, 'postOnly': None, 'side': side, 'price': order['price'], 'stopPrice': None, 'cost': cost, 'average': None, 'amount': order['amount'], 'filled': order['tradedAmount'], 'remaining': remaining, 'status': status, 'fee': None, 'trades': None, } return result def create_order(self, symbol, type, side, amount, price=None, params={}): params['symbol'] = symbol params['price'] = price params['amount'] = amount if side == 'buy': params['direction'] = 'BUY' else: params['direction'] = 'SELL' if type == 'market': params['type'] = 'MARKET_PRICE' else: params['type'] = 'LIMIT_PRICE' params['useDiscount'] = '0' response = self.privatePostExchangeOrderAdd(params) orderId = self.safe_string(response, 'data') return self.fetch_order(orderId) def cancel_order(self, id, symbol=None, params={}): request = { 'orderId': id, } response = self.privatePostExchangeOrderApicancel(self.extend(request, params)) return self.parse_order(response['data']) def fetch_orders(self, symbol=None, since=None, limit=None, params={}): # Request structure # { # 'symbol': Parameter from method arguments # 'since': Timestamp of first order in list in Unix epoch format # 'limit': Response list size # 'memberId': May be set in params. May be not set # 'status': one of TRADING COMPLETED CANCELED OVERTIMED. May be set in params # 'page': for pagination. In self case limit is size of every page. May be set in params # } default_order_amount_limit = 10000 if 'page' in params: params['pageNo'] = self.safe_string(params, 'page') else: params['pageNo'] = 0 if symbol is None: symbol = '' if since is None: since = 0 if limit is None: limit = default_order_amount_limit request = { 'symbol': symbol, 'since': since, 'pageSize': limit, } fullRequest = self.extend(request, params) response = self.privatePostExchangeOrderAll(fullRequest) # { # 'content': [ # { # 'orderId':'E161183624377614', # 'memberId':2, # 'type':'LIMIT_PRICE', # 'amount':1000.0, # 'symbol':'BCH/USDT', # 'tradedAmount':1000.0, # 'turnover':1080.0, # 'coinSymbol':'BCH', # 'baseSymbol':'USDT', # 'status':'COMPLETED', # 'direction':'SELL', # 'price':1.0, # 'time':1611836243776, # 'completedTime':1611836256242, # }, # ... # ], # 'totalElements':41, # 'totalPages':3, # 'last':False, # 'size':20, # 'number':1, # 'first':False, # 'numberOfElements':20, # 'sort': [ # { # 'direction':'DESC', # 'property':'time', # 'ignoreCase':False, # 'nullHandling':'NATIVE', # 'ascending':False, # 'descending':True, # } # ] # } return self.parse_orders(response['content']) def fetch_open_orders(self, symbol=None, since=None, limit=None, params={}): # Request structure # { # 'symbol': Parameter from method arguments # 'since': Timestamp of first order in list in Unix epoch format # 'limit': Response list size # 'memberId': May be set in params. May be not set # 'status': one of TRADING COMPLETED CANCELED OVERTIMED. May be set in params # 'page': for pagination. In self case limit is size of every page. May be set in params # } default_order_amount_limit = 20 if 'page' in params: params['pageNo'] = self.safe_string(params, 'page') else: params['pageNo'] = 0 if symbol is None: symbol = '' if since is None: since = 0 if limit is None: limit = default_order_amount_limit request = { 'symbol': symbol, 'since': since, 'pageSize': limit, } fullRequest = self.extend(request, params) response = self.privatePostExchangeOrderAll(fullRequest) # { # 'content': [ # { # 'orderId':'E161183624377614', # 'memberId':2, # 'type':'LIMIT_PRICE', # 'amount':1000.0, # 'symbol':'BCH/USDT', # 'tradedAmount':1000.0, # 'turnover':1080.0, # 'coinSymbol':'BCH', # 'baseSymbol':'USDT', # 'status':'COMPLETED', # 'direction':'SELL', # 'price':1.0, # 'time':1611836243776, # 'completedTime':1611836256242, # }, # ... # ], # 'totalElements':41, # 'totalPages':3, # 'last':False, # 'size':20, # 'number':1, # 'first':False, # 'numberOfElements':20, # 'sort': [ # { # 'direction':'DESC', # 'property':'time', # 'ignoreCase':False, # 'nullHandling':'NATIVE', # 'ascending':False, # 'descending':True, # } # ] # } return self.parse_orders(response['content']) def fetch_closed_orders(self, symbol=None, since=None, limit=None, params={}): # Request structure # { # 'symbol': Parameter from method arguments # 'since': Timestamp of first order in list in Unix epoch format # 'limit': Response list size # 'memberId': May be set in params. May be not set # 'status': one of TRADING COMPLETED CANCELED OVERTIMED. May be set in params # 'page': for pagination. In self case limit is size of every page. May be set in params # } default_order_amount_limit = 20 params['status'] = 'CANCELED' if 'page' in params: params['pageNo'] = self.safe_string(params, 'page') else: params['pageNo'] = 0 if symbol is None: symbol = '' if since is None: since = 0 if limit is None: limit = default_order_amount_limit request = { 'symbol': symbol, 'since': since, 'pageSize': limit, } fullRequest = self.extend(request, params) response = self.privatePostExchangeOrderAll(fullRequest) # { # 'content': [ # { # 'orderId':'E161183624377614', # 'memberId':2, # 'type':'LIMIT_PRICE', # 'amount':1000.0, # 'symbol':'BCH/USDT', # 'tradedAmount':1000.0, # 'turnover':1080.0, # 'coinSymbol':'BCH', # 'baseSymbol':'USDT', # 'status':'COMPLETED', # 'direction':'SELL', # 'price':1.0, # 'time':1611836243776, # 'completedTime':1611836256242, # }, # ... # ], # 'totalElements':41, # 'totalPages':3, # 'last':False, # 'size':20, # 'number':1, # 'first':False, # 'numberOfElements':20, # 'sort': [ # { # 'direction':'DESC', # 'property':'time', # 'ignoreCase':False, # 'nullHandling':'NATIVE', # 'ascending':False, # 'descending':True, # } # ] # } return self.parse_orders(response['content']) # If call without params the function returns balance of current user def fetch_balance(self, uid='-1', params={}): params = { 'uid': uid } try: response = self.privatePostUcenterMemberBalance(params) except Exception as e: return e return self.parse_balance(response) def parse_balance(self, response): data = json.loads(json.dumps(response)) if data['message'] == 'SUCCESS': result = { "free":{}, "used":{}, "total":{}} for row in data['data']['balances']: result['free'].update({row['coinName']:row['free']}) result['used'].update({row['coinName']:row['used']}) result['total'].update({row['coinName']:row['total']}) result.update({row['coinName']:{'free':row['free'], 'used':row['used'], 'total':row['total']}}) return result # Returns int or None def get_market_price(self, symbol): response = self.privatePostMarketSymbolThumb() for i in response: if i.get('symbol') == symbol: return i.get('close') def fetch_trades(self, orderId, since, pageNo=None, pageSize=None): # Responce example: # [ # { # 'info': { backend response }, # 'id': 'E161460499516968', # 'timestamp': 1614605187661, # 'datetime': '2021-03-01 15:26:27.661000', # 'symbol': 'BTC/USDT', # 'order': 'E161460499516968', # 'type': 'LIMIT_PRICE', # 'side': 'SELL', # 'takerOrMaker': 'None', (Have no this information inside TPR exchange) # 'price': 1.0, # 'amount': 1.0, # 'cost': 1.0, # 'fee': # { # 'cost': 0.005, # 'currency': 'BTC', # 'rate': 'None' (Have no this information inside TPR exchange) # } # } # ] if pageNo is None: pageNo = 0 if pageSize is None: pageSize = 100 request = { 'orderId': orderId, 'since': since, 'pageNo': pageNo, 'pageSize': pageSize } return self.parse_trade(self.privatePostExchangeOrderTrades(request)) def parse_trade(self, response): trades = [] content = response.get('content') for exchangeTrade in content: timestamp = exchangeTrade.get('time') datetime_ = str(datetime.fromtimestamp(int(timestamp) * 0.001)) price = exchangeTrade.get('price') amount = exchangeTrade.get('amount') cost = price * amount tmp = { 'info': exchangeTrade, 'id': exchangeTrade.get('orderId'), 'timestamp': timestamp, 'datetime': datetime_, 'symbol': exchangeTrade.get('symbol'), 'order': exchangeTrade.get('orderId'), 'type': exchangeTrade.get('type'), 'side': exchangeTrade.get('direction'), 'takerOrMaker': 'None', 'price': price, 'amount': amount, 'cost': cost, 'fee': { 'cost': exchangeTrade.get('fee'), 'currency': exchangeTrade.get('coinSymbol'), 'rate': 'None', } } trades.append(tmp) return trades def parse_my_trades(self, response): listData = [] for value in response: ExchangeOrder = response.get(value) id_ = ExchangeOrder.get('orderId') timestamp = ExchangeOrder.get('time') datetime_ = str(datetime.fromtimestamp(int(timestamp) * 0.001)) price = ExchangeOrder.get('price') amount = ExchangeOrder.get('amount') cost = price * amount tmp = { 'info': response.get(value), 'id': id_, 'timestamp': timestamp, 'datetime': datetime_, 'symbol': ExchangeOrder.get('symbol'), 'order': id_, 'type': ExchangeOrder.get('type'), 'side': ExchangeOrder.get('direction'), 'takerOrMaker': 'None', 'price': price, 'amount': amount, 'cost': cost, 'fee': { 'cost': ExchangeOrder.get('fee'), 'currency': ExchangeOrder.get('coinSymbol'), 'rate': 'None', } } listData.append(tmp) return listData def fetch_my_trades(self, pageNo=None, pageSize=None): # Responce example: # [ # { # 'info': { backend response }, # 'id': 'E161460499516968', # 'timestamp': 1614605187661, # 'datetime': '2021-03-01 15:26:27.661000', # 'symbol': 'BTC/USDT', # 'order': 'E161460499516968', # 'type': 'LIMIT_PRICE', # 'side': 'SELL', # 'takerOrMaker': 'None', (Have no this information inside TPR exchange) # 'price': 1.0, # 'amount': 1.0, # 'cost': 1.0, # 'fee': # { # 'cost': 0.001, # 'currency': 'BTC', # 'rate': 'None' (Have no this information inside TPR exchange) # } # }, # { ... }, # ] if pageNo is None: pageNo = 0 if pageSize is None: pageSize = 100 request = { 'orderId': '', 'pageNo': pageNo, 'pageSize': pageSize } return self.parse_my_trades(self.privatePostExchangeOrderMyTrades(request)) def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody): if response is None: return # fallback to default error handler if httpCode == 200: if 'code' in response: if response['code'] == 0: return else: return # { # "message": "Error text in case when HTTP code is not 200", # ... # } message = self.safe_string(response, 'message') if message is not None: feedback = self.id + ' ' + body self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback) self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback) raise ExchangeError(feedback) # unknown message
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 349, 14063, 11662, 6058, 11488, 3446, 3235, 24080, 29892, 13315, 8519, 402, 1430, 1001, 3040, 29928, 5300, 399, 24071, 20700, 438, 5348, 9980, 1806, 29911, 1430, 29901, 13, 29937, 2045, 597, 3292, 29889, 510, 29914, 617, 486, 29914, 617, 486, 29914, 10054, 29914, 6207, 29914, 22412, 3960, 29933, 2692, 4214, 29889, 3487, 29937, 3525, 29899, 517, 29899, 1285, 2666, 29899, 401, 13, 13, 3166, 21759, 486, 29889, 3188, 29889, 6543, 1053, 24004, 13, 3166, 21759, 486, 29889, 3188, 29889, 12523, 1053, 24004, 2392, 13, 3166, 21759, 486, 29889, 3188, 29889, 12523, 1053, 9178, 3089, 13, 3166, 21759, 486, 29889, 3188, 29889, 12523, 1053, 9178, 14730, 13, 3166, 21759, 486, 29889, 3188, 29889, 12523, 1053, 21403, 7514, 13, 3166, 21759, 486, 29889, 3188, 29889, 7099, 3039, 29918, 517, 29918, 17990, 2459, 1053, 317, 17298, 6545, 2965, 13566, 29918, 4571, 29954, 1806, 29903, 13, 13, 5215, 4390, 13, 5215, 10876, 13, 3166, 12865, 1053, 12865, 13, 13, 13, 1990, 260, 1457, 29916, 3167, 29898, 1252, 3167, 1125, 13, 13, 1678, 822, 8453, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 24535, 29918, 21843, 29898, 9136, 29898, 29873, 1457, 29916, 3167, 29892, 1583, 467, 2783, 29581, 3285, 426, 13, 9651, 525, 333, 2396, 525, 29873, 1457, 29916, 3167, 742, 13, 9651, 525, 978, 2396, 525, 3557, 29934, 24004, 742, 13, 9651, 396, 525, 2798, 2722, 2396, 6024, 3308, 7464, 13, 9651, 396, 525, 10492, 24445, 2396, 29871, 29945, 29900, 29900, 29892, 13, 9651, 525, 3259, 2396, 525, 29894, 29896, 742, 13, 9651, 525, 6327, 2164, 2396, 7700, 29892, 13, 9651, 525, 5349, 2396, 426, 13, 18884, 525, 1359, 9802, 1691, 2396, 5852, 29892, 13, 18884, 525, 20713, 3596, 2816, 8623, 2396, 7700, 29892, 13, 18884, 525, 20713, 7514, 2396, 5852, 29892, 13, 18884, 525, 20713, 2816, 8623, 2396, 7700, 29892, 13, 18884, 525, 29907, 24125, 2396, 7700, 29892, 13, 18884, 525, 3258, 8498, 359, 277, 7061, 2396, 7700, 29892, 13, 18884, 525, 3258, 24445, 7514, 2396, 7700, 29892, 13, 18884, 525, 3258, 9802, 300, 7514, 2396, 7700, 29892, 13, 18884, 525, 3258, 7514, 2396, 5852, 29892, 13, 18884, 525, 311, 1066, 277, 2396, 7700, 29892, 13, 18884, 525, 5628, 7514, 2396, 525, 331, 7964, 742, 13, 18884, 525, 9155, 22031, 749, 2396, 5852, 29892, 13, 18884, 525, 9155, 29933, 4841, 29909, 808, 29879, 2396, 7700, 29892, 13, 18884, 525, 9155, 6821, 2662, 2816, 8623, 2396, 5852, 29892, 13, 18884, 525, 9155, 29907, 1038, 15942, 2396, 5852, 29892, 13, 18884, 525, 9155, 8498, 359, 277, 7061, 2396, 7700, 29892, 13, 18884, 525, 9155, 8498, 359, 1169, 2396, 7700, 29892, 13, 18884, 525, 9155, 29943, 870, 292, 8263, 267, 2396, 7700, 29892, 13, 18884, 525, 9155, 29931, 29906, 7514, 10967, 2396, 7700, 29892, 13, 18884, 525, 9155, 29931, 287, 914, 2396, 7700, 29892, 13, 18884, 525, 9155, 9802, 1691, 2396, 5852, 29892, 13, 18884, 525, 9155, 3421, 2308, 3076, 2396, 5852, 29892, 13, 18884, 525, 9155, 23170, 12182, 29963, 2396, 5852, 29892, 13, 18884, 525, 9155, 6585, 2816, 8623, 2396, 5852, 29892, 13, 18884, 525, 9155, 7514, 2396, 5852, 29892, 13, 18884, 525, 9155, 7514, 10967, 2396, 5852, 29892, 13, 18884, 525, 9155, 7514, 10967, 29879, 2396, 7700, 29892, 13, 18884, 525, 9155, 2816, 8623, 2396, 5852, 29892, 13, 18884, 525, 9155, 7514, 2308, 3076, 2396, 7700, 29892, 13, 18884, 525, 9155, 5709, 2396, 5852, 29892, 13, 18884, 525, 9155, 29911, 6541, 2396, 5852, 29892, 13, 18884, 525, 9155, 29911, 860, 414, 2396, 5852, 29892, 13, 18884, 525, 9155, 2481, 2396, 7700, 29892, 13, 18884, 525, 9155, 2308, 3076, 2396, 5852, 29892, 13, 18884, 525, 9155, 2308, 9382, 29943, 3905, 2396, 7700, 29892, 13, 18884, 525, 9155, 2308, 9382, 8263, 267, 2396, 7700, 29892, 13, 18884, 525, 9155, 2308, 9382, 29931, 326, 1169, 2396, 7700, 29892, 13, 18884, 525, 9155, 4300, 7387, 2396, 7700, 29892, 13, 18884, 525, 9155, 3047, 4012, 1338, 2396, 7700, 29892, 13, 18884, 525, 9053, 8787, 2396, 5852, 29892, 13, 18884, 525, 3597, 8787, 2396, 7700, 29892, 13, 18884, 525, 4530, 797, 2396, 5852, 29892, 13, 18884, 525, 2541, 4012, 2396, 7700, 29892, 13, 18884, 525, 657, 9802, 300, 13026, 2396, 5852, 29892, 13, 9651, 2981, 13, 9651, 525, 2230, 19935, 2396, 426, 13, 18884, 525, 29896, 29885, 2396, 525, 29896, 742, 13, 18884, 525, 29896, 29882, 2396, 525, 29953, 29900, 742, 13, 18884, 525, 29896, 29881, 2396, 525, 29896, 29946, 29946, 29900, 742, 13, 18884, 525, 29896, 29893, 2396, 525, 29896, 29900, 29900, 29947, 29900, 742, 13, 18884, 525, 29896, 23521, 2396, 525, 29946, 29941, 29906, 29900, 29900, 742, 13, 9651, 2981, 13, 9651, 525, 26045, 2396, 426, 13, 18884, 525, 14569, 2396, 15516, 13, 18884, 525, 2754, 2396, 22372, 28988, 29913, 742, 13, 18884, 525, 1636, 2396, 15516, 13, 18884, 525, 1514, 2396, 15516, 13, 18884, 525, 1725, 267, 2396, 15516, 13, 18884, 525, 20275, 1705, 2396, 15516, 13, 9651, 2981, 13, 9651, 525, 2754, 2396, 426, 13, 18884, 525, 9053, 2396, 426, 13, 462, 1678, 525, 657, 2396, 518, 13, 462, 1678, 21251, 13, 462, 1678, 525, 2490, 2396, 518, 13, 462, 4706, 525, 1682, 5893, 29914, 2754, 29899, 7507, 742, 13, 462, 4706, 525, 1682, 5893, 29914, 14242, 29914, 5521, 749, 742, 13, 462, 4706, 525, 28549, 29914, 18098, 29899, 386, 3774, 742, 13, 462, 4706, 525, 28549, 29914, 1111, 1144, 29899, 3888, 742, 13, 462, 4706, 525, 28549, 29914, 18098, 29899, 3888, 742, 13, 462, 4706, 525, 6543, 29914, 2098, 29914, 1202, 742, 13, 462, 4706, 525, 6543, 29914, 2098, 29914, 2886, 742, 13, 462, 4706, 525, 6543, 29914, 2098, 29914, 497, 742, 13, 462, 4706, 525, 6543, 29914, 2098, 29914, 481, 2185, 2242, 742, 13, 462, 4706, 525, 6543, 29914, 2098, 29914, 509, 3076, 742, 13, 462, 4706, 525, 6543, 29914, 2098, 29914, 1357, 29899, 509, 3076, 742, 13, 462, 4706, 525, 6543, 29914, 6543, 29899, 1111, 262, 29914, 3188, 29899, 18098, 742, 13, 462, 1678, 21251, 13, 462, 1678, 525, 8143, 2396, 518, 13, 462, 1678, 21251, 13, 18884, 2981, 13, 18884, 525, 18798, 2396, 426, 13, 462, 1678, 525, 657, 2396, 518, 13, 462, 1678, 21251, 13, 18884, 2981, 13, 9651, 2981, 13, 9651, 525, 1725, 267, 2396, 426, 13, 18884, 525, 509, 9382, 2396, 426, 13, 18884, 2981, 13, 9651, 2981, 13, 9651, 525, 12403, 28037, 2396, 426, 13, 18884, 525, 2754, 2558, 2396, 5852, 29892, 13, 18884, 525, 19024, 2396, 5852, 29892, 13, 18884, 525, 5416, 2396, 7700, 29892, 13, 9651, 2981, 13, 9651, 525, 17990, 2459, 6818, 2396, 317, 17298, 6545, 2965, 13566, 29918, 4571, 29954, 1806, 29903, 29892, 13, 9651, 525, 6768, 2396, 426, 13, 18884, 525, 3258, 9802, 300, 3727, 29891, 7514, 1123, 339, 2658, 13026, 2396, 7700, 29892, 13, 9651, 2981, 13, 9651, 525, 11739, 29879, 2396, 426, 13, 18884, 525, 735, 627, 2396, 426, 13, 462, 1678, 525, 13919, 3438, 2396, 21403, 7514, 29892, 29871, 396, 8853, 4906, 4710, 13919, 3438, 3284, 29918, 4965, 28819, 1311, 28819, 12653, 4710, 29914, 20488, 3284, 1356, 572, 630, 1115, 4541, 12499, 13, 462, 1678, 525, 13919, 1797, 3553, 2396, 21403, 7514, 29892, 29871, 396, 8853, 4906, 4710, 13919, 1797, 3553, 3284, 29918, 4965, 28819, 1311, 28819, 12653, 4710, 29914, 20488, 29914, 29946, 29874, 29896, 29945, 29896, 29947, 29900, 29945, 29899, 29881, 29945, 29929, 29946, 29899, 29946, 29874, 29929, 29953, 29899, 29929, 29881, 29953, 29946, 29899, 29872, 29941, 29929, 29947, 29946, 29888, 29906, 29946, 29946, 29896, 29888, 29955, 3284, 1356, 572, 630, 1115, 4541, 12499, 13, 462, 1678, 525, 13919, 9999, 1738, 2396, 9178, 14730, 29892, 29871, 396, 8853, 4906, 4710, 13919, 9999, 1738, 3284, 29918, 4965, 28819, 1311, 28819, 12653, 4710, 29914, 3502, 1691, 29914, 29941, 29900, 29900, 29914, 2098, 29899, 2909, 3284, 1356, 572, 630, 1115, 4541, 12499, 13, 18884, 2981, 13, 18884, 525, 6729, 328, 2396, 426, 13, 462, 1678, 525, 17776, 304, 3588, 2980, 2396, 9178, 3089, 29892, 13, 18884, 2981, 13, 9651, 2981, 13, 4706, 5615, 13, 13, 1678, 822, 6088, 29918, 29873, 6541, 29898, 1311, 29892, 2933, 1125, 13, 4706, 565, 7431, 29898, 5327, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 5159, 13, 4706, 5829, 353, 2933, 29961, 29900, 1822, 657, 877, 18098, 1495, 13, 4706, 1880, 353, 29871, 29900, 13, 4706, 21000, 24679, 353, 29871, 29900, 13, 4706, 2244, 24679, 353, 29871, 29900, 13, 4706, 325, 29893, 481, 353, 29871, 29900, 13, 4706, 325, 29893, 481, 25733, 353, 29871, 29900, 13, 4706, 325, 29893, 481, 24679, 353, 29871, 29900, 13, 4706, 1722, 29918, 353, 525, 8516, 29915, 13, 4706, 3802, 353, 29871, 29900, 13, 4706, 1833, 353, 3802, 13, 4706, 3517, 11123, 353, 525, 8516, 29915, 13, 4706, 1735, 353, 525, 8516, 29915, 29871, 13, 4706, 19649, 353, 525, 8516, 29915, 29871, 13, 4706, 6588, 353, 525, 8516, 29915, 13, 4706, 2967, 24679, 353, 29871, 29900, 13, 4706, 14978, 24679, 353, 29871, 29900, 13, 4706, 931, 353, 29871, 29900, 13, 4706, 1833, 12742, 2481, 353, 938, 3552, 12673, 29889, 3707, 2141, 16394, 580, 448, 29871, 29947, 29953, 29946, 29900, 29900, 29897, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 1857, 27939, 353, 938, 29898, 12673, 29889, 3707, 2141, 16394, 580, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 1857, 16390, 5410, 353, 851, 29898, 12673, 29889, 3166, 16394, 29898, 3784, 27939, 334, 29871, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 4482, 353, 2933, 29961, 29900, 1822, 657, 877, 9175, 1495, 13, 4706, 21000, 353, 29871, 29900, 13, 4706, 2244, 353, 10876, 29889, 3317, 2311, 13, 4706, 1722, 29903, 514, 2816, 8623, 3981, 353, 29871, 29900, 13, 13, 4706, 363, 1797, 297, 2933, 29901, 13, 13, 9651, 8666, 353, 1797, 29889, 657, 877, 9175, 1495, 13, 9651, 5253, 353, 1797, 29889, 657, 877, 14506, 1495, 13, 9651, 14334, 353, 1797, 29889, 657, 877, 16394, 1495, 13, 13, 9651, 565, 1880, 529, 8666, 29901, 13, 18884, 1880, 353, 8666, 13, 9651, 565, 4482, 1405, 8666, 29901, 13, 18884, 4482, 353, 8666, 13, 632, 13, 9651, 565, 1797, 29889, 657, 877, 4882, 1495, 1275, 525, 3150, 2396, 13, 18884, 565, 1797, 29889, 657, 877, 2975, 1495, 1275, 525, 2423, 29891, 2396, 13, 462, 1678, 565, 21000, 529, 8666, 29901, 13, 462, 4706, 21000, 353, 8666, 13, 462, 1678, 565, 21000, 24679, 529, 5253, 29901, 13, 462, 4706, 21000, 24679, 353, 5253, 13, 13, 9651, 565, 1797, 29889, 657, 877, 4882, 1495, 1275, 525, 3150, 2396, 13, 18884, 565, 1797, 29889, 657, 877, 2975, 1495, 1275, 525, 29879, 514, 2396, 13, 462, 1678, 1722, 29903, 514, 2816, 8623, 3981, 4619, 29871, 29896, 13, 462, 1678, 565, 2244, 1405, 8666, 29901, 13, 462, 4706, 2244, 353, 8666, 13, 462, 1678, 565, 2244, 24679, 529, 5253, 29901, 13, 462, 4706, 2244, 24679, 353, 5253, 13, 13, 9651, 565, 1797, 29889, 657, 877, 3888, 2824, 657, 877, 4882, 1495, 1275, 525, 21514, 1307, 29911, 3352, 2396, 13, 18884, 325, 29893, 481, 25733, 4619, 8666, 334, 5253, 13, 18884, 325, 29893, 481, 24679, 4619, 5253, 13, 18884, 565, 931, 529, 14334, 29901, 13, 462, 1678, 931, 353, 14334, 13, 462, 1678, 3802, 353, 8666, 13, 18884, 565, 14334, 1405, 1833, 12742, 2481, 29901, 13, 462, 1678, 14978, 24679, 4619, 5253, 13, 462, 1678, 2967, 24679, 4619, 8666, 13, 13, 4706, 565, 325, 29893, 481, 24679, 2804, 29871, 29900, 29901, 13, 9651, 325, 29893, 481, 353, 325, 29893, 481, 25733, 847, 325, 29893, 481, 24679, 13, 4706, 565, 1722, 29903, 514, 2816, 8623, 3981, 1275, 29871, 29900, 29901, 13, 9651, 2244, 353, 29871, 29900, 13, 4706, 1833, 353, 3802, 13, 13, 4706, 1121, 353, 426, 13, 9651, 525, 18098, 2396, 4706, 5829, 29892, 13, 9651, 525, 3888, 2396, 3986, 2933, 29892, 13, 9651, 525, 16394, 2396, 268, 1857, 27939, 29892, 13, 9651, 525, 12673, 2396, 418, 1857, 16390, 5410, 29892, 13, 9651, 525, 9812, 2396, 3986, 1880, 29892, 13, 9651, 525, 677, 2396, 965, 4482, 29892, 13, 9651, 525, 23883, 2396, 965, 21000, 29892, 13, 9651, 525, 23883, 24679, 2396, 268, 21000, 24679, 29892, 13, 9651, 525, 1278, 2396, 965, 2244, 29892, 13, 9651, 525, 1278, 24679, 2396, 268, 2244, 24679, 29892, 13, 9651, 525, 29894, 29893, 481, 2396, 3986, 325, 29893, 481, 29892, 13, 9651, 525, 3150, 2396, 3986, 1722, 3383, 13, 9651, 525, 5358, 2396, 308, 3802, 29892, 13, 9651, 525, 4230, 2396, 3986, 1833, 29892, 13, 9651, 525, 24957, 11123, 2396, 3517, 11123, 29892, 13, 9651, 525, 3167, 2396, 4706, 1735, 29892, 13, 9651, 525, 25376, 482, 2396, 1678, 19649, 29892, 13, 9651, 525, 12483, 482, 2396, 539, 6588, 29892, 13, 9651, 525, 3188, 24679, 2396, 1678, 2967, 24679, 29892, 13, 9651, 525, 1396, 24679, 2396, 259, 14978, 24679, 29892, 13, 9651, 500, 13, 4706, 736, 1121, 13, 13, 1678, 822, 6699, 29918, 29873, 6541, 29898, 1311, 29892, 5829, 29892, 1951, 29922, 8516, 29892, 4046, 29922, 8516, 1125, 13, 4706, 2933, 353, 1583, 29889, 9155, 29918, 20488, 29898, 18098, 29892, 1951, 29892, 4046, 29897, 13, 4706, 396, 13291, 1342, 29901, 13, 4706, 396, 426, 13, 4706, 396, 268, 525, 18098, 2396, 525, 29933, 9472, 29914, 3308, 12972, 742, 29871, 13, 4706, 396, 268, 525, 3888, 2396, 518, 856, 1402, 29871, 13, 4706, 396, 268, 525, 16394, 2396, 29871, 29896, 29953, 29896, 29945, 29941, 29947, 29953, 29947, 29945, 29896, 29929, 29955, 29953, 29892, 29871, 13, 4706, 396, 268, 525, 12673, 2396, 525, 29906, 29900, 29906, 29896, 29899, 29900, 29941, 29899, 29896, 29900, 29871, 29896, 29953, 29901, 29941, 29946, 29901, 29896, 29896, 29889, 29929, 29955, 29953, 29900, 29900, 29900, 742, 29871, 13, 4706, 396, 268, 525, 9812, 2396, 29871, 29945, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 677, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 23883, 2396, 29871, 29941, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 23883, 24679, 2396, 29871, 29896, 29945, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 1278, 2396, 29871, 29946, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 1278, 24679, 2396, 29871, 29906, 29945, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 29894, 29893, 481, 2396, 29871, 29896, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 3150, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 268, 525, 5358, 2396, 29871, 29906, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 4230, 2396, 29871, 29906, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 24957, 11123, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 268, 525, 3167, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 268, 525, 25376, 482, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 268, 525, 12483, 482, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 268, 525, 3188, 24679, 2396, 29871, 29953, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 268, 525, 1396, 24679, 2396, 29871, 29941, 29900, 29889, 29900, 13, 4706, 396, 500, 13, 4706, 736, 1583, 29889, 5510, 29918, 29873, 6541, 29898, 5327, 29897, 13, 13, 1678, 822, 6699, 29918, 24667, 414, 29898, 1311, 29892, 1951, 29922, 8516, 29892, 4046, 29922, 8516, 1125, 13, 4706, 396, 13291, 1342, 29901, 13, 4706, 396, 518, 13, 4706, 396, 268, 426, 13, 4706, 396, 308, 525, 18098, 2396, 525, 29933, 9472, 29914, 3308, 12972, 742, 29871, 13, 4706, 396, 308, 525, 3888, 2396, 518, 856, 1402, 29871, 13, 4706, 396, 308, 525, 16394, 2396, 29871, 29896, 29953, 29896, 29945, 29941, 29947, 29953, 29947, 29945, 29896, 29929, 29955, 29953, 29892, 29871, 13, 4706, 396, 308, 525, 12673, 2396, 525, 29906, 29900, 29906, 29896, 29899, 29900, 29941, 29899, 29896, 29900, 29871, 29896, 29953, 29901, 29941, 29946, 29901, 29896, 29896, 29889, 29929, 29955, 29953, 29900, 29900, 29900, 742, 29871, 13, 4706, 396, 308, 525, 9812, 2396, 29871, 29945, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 677, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 23883, 2396, 29871, 29941, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 23883, 24679, 2396, 29871, 29896, 29945, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 1278, 2396, 29871, 29946, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 1278, 24679, 2396, 29871, 29906, 29945, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 29894, 29893, 481, 2396, 29871, 29896, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 3150, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 308, 525, 5358, 2396, 29871, 29906, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 4230, 2396, 29871, 29906, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 24957, 11123, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 308, 525, 3167, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 308, 525, 25376, 482, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 308, 525, 12483, 482, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 308, 525, 3188, 24679, 2396, 29871, 29953, 29900, 29889, 29900, 29892, 29871, 13, 4706, 396, 308, 525, 1396, 24679, 2396, 29871, 29941, 29900, 29889, 29900, 13, 4706, 396, 268, 2981, 29871, 13, 4706, 396, 268, 2023, 13, 4706, 396, 4514, 13, 4706, 1121, 353, 5159, 13, 4706, 15072, 353, 1583, 29889, 9155, 29918, 3502, 1691, 580, 13, 4706, 363, 5016, 2204, 324, 297, 15072, 29901, 13, 9651, 2933, 353, 1583, 29889, 9155, 29918, 20488, 29898, 11967, 2204, 324, 29889, 657, 877, 18098, 5477, 1951, 29892, 4046, 29897, 13, 9651, 260, 6541, 353, 1583, 29889, 5510, 29918, 29873, 6541, 29898, 5327, 29897, 13, 9651, 565, 7431, 29898, 29873, 6541, 29897, 2804, 29871, 29900, 29901, 13, 18884, 1121, 29889, 4397, 29898, 29873, 6541, 29897, 13, 4706, 736, 1121, 13, 13, 1678, 822, 6699, 29918, 2098, 29918, 2909, 29898, 1311, 29892, 5829, 29892, 4046, 29892, 1951, 29922, 29900, 1125, 13, 4706, 396, 13291, 1342, 29901, 13, 4706, 396, 426, 13, 4706, 396, 268, 525, 29890, 4841, 2396, 29871, 13, 4706, 396, 268, 518, 13, 4706, 396, 4706, 518, 29906, 29900, 29889, 29900, 29892, 29871, 29896, 29900, 29889, 29900, 29892, 525, 29923, 29896, 29953, 29896, 29945, 29941, 29947, 29946, 29947, 29906, 29906, 29953, 29941, 29953, 29946, 29906, 7464, 259, 849, 518, 9175, 29892, 5253, 29892, 1797, 1204, 29962, 13, 4706, 396, 308, 518, 29941, 29900, 29889, 29900, 29892, 29871, 29896, 29945, 29889, 29900, 29892, 525, 29923, 29896, 29953, 29896, 29945, 29941, 29947, 29946, 29947, 29906, 29906, 29955, 29896, 29953, 29946, 29953, 2033, 13, 4706, 396, 268, 21251, 29871, 13, 4706, 396, 268, 525, 1278, 29879, 2396, 29871, 13, 4706, 396, 268, 518, 13, 4706, 396, 308, 518, 29946, 29900, 29889, 29900, 29892, 29871, 29906, 29900, 29889, 29900, 29892, 525, 29923, 29896, 29953, 29896, 29945, 29941, 29947, 29946, 29947, 29906, 29906, 29955, 29947, 29947, 29906, 29945, 7464, 29871, 13, 4706, 396, 308, 518, 29945, 29900, 29889, 29900, 29892, 29871, 29906, 29945, 29889, 29900, 29892, 525, 29923, 29896, 29953, 29896, 29945, 29941, 29947, 29946, 29947, 29906, 29906, 29947, 29953, 29900, 29947, 29945, 2033, 13, 4706, 396, 268, 21251, 29871, 13, 4706, 396, 268, 525, 16394, 2396, 29871, 29896, 29953, 29896, 29945, 29941, 29929, 29900, 29955, 29896, 29896, 29953, 29929, 29945, 29892, 29871, 13, 4706, 396, 268, 525, 12673, 2396, 525, 29906, 29900, 29906, 29896, 29899, 29900, 29941, 29899, 29896, 29900, 29871, 29896, 29955, 29901, 29941, 29947, 29901, 29941, 29896, 29889, 29953, 29929, 29945, 29900, 29900, 29900, 742, 29871, 13, 4706, 396, 268, 525, 5464, 346, 2396, 29871, 29896, 29953, 29896, 29945, 29941, 29929, 29900, 29955, 29896, 29896, 29953, 29929, 29945, 13, 4706, 396, 500, 13, 4706, 11299, 353, 1583, 29889, 9155, 29918, 3150, 29918, 20488, 29898, 18098, 29892, 1951, 29892, 4046, 29897, 13, 4706, 289, 4841, 353, 5159, 13, 4706, 19514, 353, 5159, 13, 4706, 363, 1797, 297, 11299, 29901, 13, 9651, 5694, 353, 5159, 13, 9651, 5694, 29889, 4397, 29898, 2098, 29889, 657, 877, 9175, 8785, 13, 9651, 5694, 29889, 4397, 29898, 2098, 29889, 657, 877, 14506, 8785, 13, 9651, 5694, 29889, 4397, 29898, 2098, 29889, 657, 877, 333, 8785, 13, 9651, 565, 1797, 29889, 657, 877, 2975, 1495, 1275, 525, 2423, 29891, 2396, 13, 18884, 289, 4841, 29889, 4397, 29898, 7382, 29897, 13, 9651, 1683, 29901, 13, 18884, 19514, 29889, 4397, 29898, 7382, 29897, 13, 13, 4706, 1857, 27939, 353, 938, 29898, 12673, 29889, 3707, 2141, 16394, 580, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 1857, 16390, 5410, 353, 851, 29898, 12673, 29889, 3166, 16394, 29898, 3784, 27939, 334, 29871, 29900, 29889, 29900, 29900, 29896, 876, 13, 13, 4706, 1121, 353, 426, 13, 9651, 525, 29890, 4841, 2396, 289, 4841, 29892, 13, 9651, 525, 1278, 29879, 2396, 19514, 29892, 13, 9651, 525, 16394, 2396, 1857, 27939, 29892, 13, 9651, 525, 12673, 2396, 1857, 16390, 5410, 29892, 13, 9651, 525, 5464, 346, 2396, 1857, 27939, 29892, 13, 4706, 500, 13, 4706, 736, 1121, 13, 13, 1678, 822, 6088, 29918, 3502, 1691, 29898, 1311, 29892, 2933, 1125, 13, 4706, 1051, 1469, 353, 5159, 13, 4706, 363, 995, 297, 2933, 29901, 13, 9651, 13128, 353, 426, 13, 9651, 376, 333, 1115, 995, 29889, 657, 703, 1111, 262, 14730, 4968, 13, 9651, 376, 18098, 1115, 995, 29889, 657, 703, 18098, 4968, 13, 9651, 376, 3188, 1115, 995, 29889, 657, 703, 1111, 262, 14730, 4968, 13, 9651, 376, 1396, 1115, 995, 29889, 657, 703, 3188, 14730, 4968, 13, 9651, 376, 3188, 1204, 1115, 995, 29889, 657, 703, 1111, 262, 14730, 4968, 13, 9651, 376, 1396, 1204, 1115, 995, 29889, 657, 703, 3188, 14730, 4968, 13, 9651, 376, 1853, 1115, 995, 29889, 657, 703, 23679, 1542, 4968, 13, 9651, 376, 4925, 1115, 995, 29889, 657, 703, 12007, 4968, 13, 9651, 376, 17990, 2459, 1115, 426, 13, 18884, 376, 14506, 1115, 995, 29889, 657, 703, 1111, 262, 17185, 4968, 13, 18884, 376, 9175, 1115, 995, 29889, 657, 703, 3188, 7967, 262, 17185, 4968, 13, 18884, 2981, 13, 9651, 376, 12514, 1115, 426, 13, 18884, 376, 14506, 1115, 8853, 1195, 1115, 995, 29889, 657, 703, 1195, 24679, 4968, 376, 3317, 1115, 995, 29889, 657, 703, 3317, 24679, 1159, 1118, 13, 18884, 376, 9175, 1115, 8853, 1195, 1115, 995, 29889, 657, 703, 1195, 29903, 514, 13026, 4968, 376, 3317, 1115, 995, 29889, 657, 703, 3317, 3727, 29891, 13026, 1159, 1118, 13, 18884, 376, 18253, 1115, 8853, 1195, 1115, 995, 29889, 657, 703, 1195, 24679, 1159, 334, 995, 29889, 657, 703, 1195, 29903, 514, 13026, 4968, 376, 3317, 1115, 995, 29889, 657, 703, 3317, 24679, 1159, 334, 995, 29889, 657, 703, 3317, 3727, 29891, 13026, 1159, 1118, 13, 18884, 2981, 13, 9651, 376, 29873, 5790, 1115, 995, 29889, 657, 703, 1725, 29872, 4968, 13, 9651, 376, 28107, 1115, 995, 29889, 657, 703, 1725, 29872, 4968, 13, 9651, 376, 3888, 1115, 995, 29892, 13, 9651, 500, 13, 9651, 1051, 1469, 29889, 4397, 29898, 7050, 29897, 13, 4706, 736, 1051, 1469, 13, 13, 1678, 822, 788, 29918, 2557, 29898, 1311, 29892, 931, 4308, 4763, 29892, 931, 4308, 5044, 29892, 931, 2557, 29892, 9939, 13026, 29892, 19604, 13026, 29892, 5253, 29892, 1121, 29892, 1722, 13026, 29892, 3802, 13026, 1125, 13, 4706, 3515, 353, 5159, 13, 4706, 3515, 29889, 4397, 29898, 2230, 4308, 4763, 29897, 13, 4706, 3515, 29889, 4397, 29898, 3150, 13026, 29897, 13, 4706, 3515, 29889, 4397, 29898, 9812, 342, 13026, 29897, 13, 4706, 3515, 29889, 4397, 29898, 677, 342, 13026, 29897, 13, 4706, 3515, 29889, 4397, 29898, 5358, 13026, 29897, 13, 4706, 3515, 29889, 4397, 29898, 14506, 29897, 13, 4706, 1121, 29889, 4397, 29898, 2557, 29897, 13, 13, 1678, 822, 6088, 29918, 10330, 11023, 29898, 1311, 29892, 2933, 29892, 1951, 29892, 931, 2557, 1125, 13, 4706, 9939, 13026, 353, 29871, 29900, 13, 4706, 19604, 13026, 353, 10876, 29889, 3317, 2311, 13, 4706, 8666, 353, 29871, 29900, 13, 4706, 5253, 353, 29871, 29900, 13, 4706, 931, 4308, 4763, 353, 1951, 13, 4706, 931, 4308, 5044, 353, 938, 3552, 16076, 334, 29871, 29900, 29889, 29900, 29900, 29896, 718, 931, 2557, 29897, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 1121, 353, 5159, 13, 4706, 474, 353, 29871, 29900, 13, 4706, 11299, 353, 2933, 29889, 657, 877, 3051, 1495, 13, 4706, 338, 6585, 13026, 353, 5852, 13, 4706, 1722, 13026, 353, 29871, 29900, 13, 4706, 3802, 13026, 353, 29871, 29900, 13, 13, 4706, 1550, 474, 529, 7431, 29898, 20488, 1125, 13, 9651, 565, 338, 6585, 13026, 1275, 5852, 29901, 13, 18884, 1722, 13026, 353, 11299, 29961, 29875, 1822, 657, 877, 9175, 1495, 13, 18884, 338, 6585, 13026, 353, 7700, 13, 9651, 931, 353, 11299, 29961, 29875, 1822, 657, 877, 2230, 1495, 13, 9651, 565, 931, 6736, 931, 4308, 4763, 322, 931, 5277, 931, 4308, 5044, 29901, 13, 18884, 8666, 353, 11299, 29961, 29875, 1822, 657, 877, 9175, 1495, 13, 18884, 3802, 13026, 353, 8666, 13, 18884, 565, 9939, 13026, 529, 8666, 29901, 13, 462, 1678, 9939, 13026, 353, 8666, 13, 18884, 565, 19604, 13026, 1405, 8666, 29901, 13, 462, 1678, 19604, 13026, 353, 8666, 13, 18884, 5253, 4619, 11299, 29961, 29875, 1822, 657, 877, 14506, 1495, 13, 18884, 474, 4619, 29871, 29896, 13, 18884, 565, 474, 1275, 7431, 29898, 20488, 1125, 13, 462, 1678, 1583, 29889, 1202, 29918, 2557, 29898, 2230, 4308, 4763, 29892, 931, 4308, 5044, 29892, 931, 2557, 29892, 9939, 13026, 29892, 19604, 13026, 29892, 5253, 29892, 1121, 29892, 1722, 13026, 29892, 3802, 13026, 29897, 13, 9651, 1683, 29901, 13, 18884, 565, 19604, 13026, 1275, 10876, 29889, 3317, 2311, 29901, 13, 462, 1678, 19604, 13026, 353, 29871, 29900, 13, 462, 1678, 1722, 13026, 353, 29871, 29900, 13, 462, 1678, 3802, 13026, 353, 29871, 29900, 13, 462, 1678, 474, 22361, 29871, 29896, 13, 18884, 1583, 29889, 1202, 29918, 2557, 29898, 2230, 4308, 4763, 29892, 931, 4308, 5044, 29892, 931, 2557, 29892, 9939, 13026, 29892, 19604, 13026, 29892, 5253, 29892, 1121, 29892, 1722, 13026, 29892, 3802, 13026, 29897, 13, 18884, 931, 4308, 4763, 353, 931, 4308, 5044, 718, 29871, 29896, 13, 18884, 931, 4308, 5044, 353, 938, 3552, 2230, 4308, 5044, 334, 29871, 29900, 29889, 29900, 29900, 29896, 718, 931, 2557, 29897, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 18884, 5253, 353, 29871, 29900, 13, 18884, 9939, 13026, 353, 29871, 29900, 13, 18884, 19604, 13026, 353, 10876, 29889, 3317, 2311, 13, 18884, 338, 6585, 13026, 353, 5852, 13, 18884, 474, 4619, 29871, 29896, 13, 13, 4706, 736, 1121, 13, 13, 1678, 396, 931, 2557, 29161, 29901, 29871, 13, 1678, 396, 29871, 29896, 29885, 313, 650, 11015, 416, 13, 1678, 396, 29871, 29896, 29882, 313, 650, 7234, 416, 13, 1678, 396, 29871, 29896, 29881, 313, 650, 2462, 448, 29871, 29906, 29946, 6199, 29897, 13, 1678, 396, 29871, 29896, 29893, 313, 650, 4723, 448, 29871, 29955, 3841, 29897, 13, 1678, 396, 29871, 29896, 23521, 313, 650, 286, 1309, 386, 448, 29871, 29941, 29900, 3841, 29897, 13, 1678, 822, 6699, 29918, 10330, 11023, 29898, 1311, 29892, 5829, 29892, 931, 2557, 29922, 8516, 29892, 1951, 29922, 29900, 29892, 4046, 29922, 8516, 29892, 8636, 3790, 29913, 1125, 13, 4706, 396, 13291, 1342, 29901, 13, 4706, 396, 518, 13, 4706, 396, 268, 518, 13, 4706, 396, 3986, 29896, 29945, 29900, 29946, 29945, 29946, 29896, 29945, 29947, 29900, 29900, 29900, 29900, 29892, 849, 17998, 14334, 297, 3533, 21462, 29892, 6043, 13, 4706, 396, 3986, 29946, 29906, 29941, 29945, 29889, 29946, 29892, 4706, 849, 313, 29949, 29897, 2238, 8666, 29892, 5785, 13, 4706, 396, 3986, 29946, 29906, 29946, 29900, 29889, 29953, 29892, 4706, 849, 313, 29950, 29897, 1141, 342, 8666, 29892, 5785, 13, 4706, 396, 3986, 29946, 29906, 29941, 29900, 29889, 29900, 29892, 4706, 849, 313, 29931, 29897, 340, 342, 8666, 29892, 5785, 13, 4706, 396, 3986, 29946, 29906, 29941, 29900, 29889, 29955, 29892, 4706, 849, 313, 29907, 29897, 5409, 292, 8666, 29892, 5785, 13, 4706, 396, 3986, 29941, 29955, 29889, 29955, 29906, 29929, 29946, 29896, 29929, 29896, 29896, 1678, 849, 313, 29963, 29897, 324, 2017, 313, 262, 4958, 310, 278, 2967, 27550, 511, 5785, 13, 4706, 396, 268, 21251, 13, 4706, 396, 268, 2023, 13, 4706, 396, 4514, 13, 4706, 1881, 1469, 5596, 353, 7700, 13, 13, 4706, 363, 3515, 297, 1583, 29889, 2230, 19935, 29901, 13, 9651, 565, 3515, 1275, 931, 2557, 29901, 13, 18884, 1881, 1469, 5596, 353, 5852, 13, 18884, 2867, 13, 308, 13, 4706, 565, 1881, 1469, 5596, 1275, 7700, 29901, 13, 9651, 736, 11117, 2704, 2396, 525, 797, 15728, 931, 2557, 10827, 13, 13, 4706, 260, 4308, 353, 938, 29898, 1311, 29889, 2230, 19935, 29889, 657, 29898, 2230, 2557, 876, 334, 29871, 29953, 29900, 13, 13, 4706, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 353, 29871, 29896, 29900, 29900, 13, 4706, 8636, 1839, 4882, 2033, 353, 525, 21514, 1307, 29911, 3352, 29915, 13, 4706, 565, 525, 3488, 29915, 297, 8636, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 1583, 29889, 11177, 29918, 1807, 29898, 7529, 29892, 525, 3488, 1495, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 29871, 29900, 13, 13, 4706, 565, 1951, 338, 6213, 29901, 13, 9651, 1951, 353, 29871, 29900, 13, 4706, 565, 4046, 338, 6213, 29901, 13, 9651, 4046, 353, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 13, 308, 13, 4706, 2009, 353, 426, 13, 9651, 525, 18098, 2396, 5829, 29892, 13, 9651, 525, 16076, 2396, 1951, 29892, 13, 9651, 525, 3488, 3505, 2396, 4046, 29892, 13, 4706, 500, 13, 4706, 2989, 3089, 353, 1583, 29889, 21843, 29898, 3827, 29892, 8636, 29897, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 7514, 3596, 29898, 8159, 3089, 29897, 13, 4706, 736, 1583, 29889, 5510, 29918, 10330, 11023, 29898, 5327, 29892, 1951, 29892, 260, 4308, 29897, 13, 308, 13, 1678, 822, 6699, 29918, 3502, 1691, 29898, 1311, 29892, 5829, 2433, 29374, 13, 4706, 2009, 353, 426, 13, 9651, 525, 18098, 2396, 5829, 29892, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 9802, 300, 14730, 3401, 29898, 3827, 29897, 13, 4706, 736, 1583, 29889, 5510, 29918, 3502, 1691, 29898, 5327, 29897, 13, 4706, 396, 28081, 24015, 8528, 19297, 1307, 29901, 13, 4706, 396, 518, 13, 4706, 396, 268, 426, 13, 4706, 396, 308, 525, 333, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 308, 525, 18098, 2396, 525, 29933, 9472, 29914, 3308, 12972, 742, 29871, 13, 4706, 396, 308, 525, 3188, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 308, 525, 1396, 2396, 525, 3308, 12972, 742, 29871, 13, 4706, 396, 308, 525, 3188, 1204, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 308, 525, 1396, 1204, 2396, 525, 3308, 12972, 742, 29871, 13, 4706, 396, 308, 525, 1853, 2396, 525, 29940, 12413, 742, 29871, 13, 4706, 396, 308, 525, 4925, 2396, 29871, 29896, 29892, 29871, 13, 4706, 396, 308, 525, 17990, 2459, 2396, 426, 525, 14506, 2396, 29871, 29906, 29892, 525, 9175, 2396, 29871, 29906, 2981, 29871, 13, 4706, 396, 308, 525, 12514, 2396, 29871, 13, 4706, 396, 308, 426, 13, 4706, 396, 632, 525, 14506, 2396, 426, 525, 1195, 2396, 29871, 29900, 29889, 29900, 29892, 525, 3317, 2396, 29871, 29900, 29889, 29900, 2981, 29871, 13, 4706, 396, 632, 525, 9175, 2396, 426, 525, 1195, 2396, 29871, 29900, 29889, 29900, 29892, 525, 3317, 2396, 29871, 29900, 29889, 29900, 2981, 29871, 13, 4706, 396, 632, 525, 18253, 2396, 426, 525, 1195, 2396, 29871, 29900, 29889, 29900, 29892, 525, 3317, 2396, 29871, 29900, 29889, 29900, 500, 13, 4706, 396, 308, 2981, 29871, 13, 4706, 396, 308, 525, 29873, 5790, 2396, 29871, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 13, 4706, 396, 308, 525, 28107, 2396, 29871, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 13, 4706, 396, 308, 525, 3888, 2396, 426, 27852, 2933, 29913, 13, 4706, 396, 268, 2981, 13, 4706, 396, 268, 2023, 13, 4706, 396, 4514, 13, 13, 1678, 822, 2254, 29918, 3502, 1691, 29898, 1311, 29892, 19763, 29922, 8824, 29892, 5829, 2433, 29374, 13, 4706, 565, 451, 19763, 29901, 13, 9651, 565, 1583, 29889, 3502, 1691, 29901, 13, 18884, 565, 451, 1583, 29889, 3502, 1691, 29918, 1609, 29918, 333, 29901, 13, 462, 1678, 736, 1583, 29889, 842, 29918, 3502, 1691, 29898, 1311, 29889, 3502, 1691, 29897, 13, 18884, 736, 1583, 29889, 3502, 1691, 13, 4706, 16256, 15942, 353, 6213, 13, 4706, 565, 1583, 29889, 5349, 1839, 9155, 29907, 1038, 15942, 2033, 29901, 13, 9651, 16256, 15942, 353, 1583, 29889, 9155, 29918, 21962, 15942, 580, 13, 4706, 2791, 1691, 353, 1583, 29889, 9155, 29918, 3502, 1691, 29898, 18098, 29897, 13, 4706, 736, 1583, 29889, 842, 29918, 3502, 1691, 29898, 3502, 1691, 29892, 16256, 15942, 29897, 13, 13, 1678, 822, 1804, 29898, 1311, 29892, 2224, 29892, 7882, 2433, 3597, 742, 1158, 2433, 7194, 742, 8636, 3790, 1118, 9066, 29922, 8516, 29892, 3573, 29922, 8516, 1125, 13, 4706, 396, 5399, 1863, 749, 310, 10760, 5993, 13, 4706, 396, 3387, 671, 953, 2272, 697, 297, 1206, 310, 385, 2280, 338, 451, 8794, 297, 3447, 13, 4706, 4817, 6066, 353, 6629, 13, 4706, 565, 525, 6979, 29915, 297, 1583, 29889, 6768, 29901, 13, 9651, 4817, 6066, 353, 1583, 29889, 6768, 1839, 6979, 2033, 13, 4706, 396, 3617, 3988, 13, 4706, 3142, 353, 1583, 29889, 13699, 356, 29918, 7529, 29898, 1311, 29889, 26045, 1839, 2754, 7464, 11117, 28988, 2396, 1583, 29889, 28988, 1800, 718, 8207, 29915, 718, 2224, 13, 4706, 396, 20535, 403, 3573, 322, 2793, 1134, 8679, 373, 1158, 1134, 29901, 12354, 470, 11971, 13, 4706, 6611, 353, 1051, 29898, 7529, 29889, 8149, 3101, 13, 4706, 6611, 6513, 353, 7431, 29898, 8149, 29897, 13, 4706, 396, 512, 1206, 310, 3573, 338, 1603, 451, 9859, 925, 1207, 372, 4069, 1347, 13, 4706, 565, 3573, 338, 6213, 29901, 13, 9651, 3573, 353, 6629, 13, 4706, 396, 349, 3445, 598, 1196, 363, 756, 2790, 13, 4706, 396, 910, 6608, 2533, 338, 7120, 373, 14998, 2625, 304, 11539, 3450, 1404, 13, 4706, 396, 11971, 8636, 881, 451, 367, 2715, 408, 3573, 13, 4706, 2346, 353, 1158, 718, 525, 847, 29915, 718, 2224, 718, 525, 525, 718, 1583, 29889, 2271, 12508, 29898, 7529, 29897, 718, 525, 525, 718, 4817, 6066, 718, 11297, 29876, 29915, 718, 3573, 13, 4706, 8794, 353, 1583, 29889, 7184, 562, 29898, 1311, 29889, 12508, 29898, 1972, 511, 1583, 29889, 12508, 29898, 1311, 29889, 19024, 876, 13, 4706, 2793, 1542, 353, 6213, 13, 4706, 565, 1158, 1275, 525, 5438, 2396, 13, 9651, 2793, 1542, 353, 525, 6214, 29914, 29916, 29899, 1636, 29899, 689, 29899, 2271, 26716, 29915, 13, 9651, 565, 6611, 6513, 1405, 29871, 29900, 29901, 13, 18884, 3573, 353, 1583, 29889, 2271, 12508, 29898, 7529, 29897, 13, 4706, 1683, 29901, 13, 9651, 565, 6611, 6513, 1405, 29871, 29900, 29901, 13, 18884, 3142, 4619, 525, 17901, 718, 1583, 29889, 2271, 12508, 29898, 7529, 29897, 13, 4706, 9066, 353, 426, 13, 9651, 525, 29916, 29899, 5150, 29899, 4530, 2396, 8794, 29892, 13, 9651, 525, 29916, 29899, 5150, 29899, 6979, 2396, 4817, 6066, 29892, 13, 4706, 500, 13, 4706, 565, 4817, 6066, 2804, 525, 2396, 13, 9651, 9066, 1839, 5943, 29899, 5150, 29899, 6979, 2033, 353, 4817, 6066, 13, 4706, 565, 2793, 1542, 338, 451, 6213, 29901, 13, 9651, 9066, 1839, 3916, 29899, 1542, 2033, 353, 2793, 1542, 13, 4706, 736, 11117, 2271, 2396, 3142, 29892, 525, 5696, 2396, 1158, 29892, 525, 2587, 2396, 3573, 29892, 525, 13662, 2396, 9066, 29913, 13, 13, 1678, 822, 1804, 29918, 262, 29898, 1311, 29892, 8636, 3790, 29913, 1125, 13, 4706, 8636, 353, 426, 13, 9651, 525, 1989, 2396, 1583, 29889, 1989, 29892, 13, 9651, 525, 6979, 2396, 1583, 29889, 6979, 29892, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 29965, 5064, 11713, 11049, 29898, 7529, 29897, 13, 4706, 6464, 1469, 353, 2933, 1839, 1272, 2033, 13, 4706, 1583, 29889, 6768, 1839, 6979, 2033, 353, 1583, 29889, 11177, 29918, 1807, 29898, 7507, 1469, 29892, 525, 6979, 1495, 13, 4706, 4509, 1204, 353, 1583, 29889, 11177, 29918, 1807, 29898, 7507, 1469, 29892, 525, 333, 1495, 13, 4706, 736, 4509, 1204, 13, 13, 1678, 822, 6699, 29918, 4882, 29898, 1311, 1125, 13, 4706, 396, 2538, 1112, 346, 6455, 29901, 13, 4706, 396, 11117, 4882, 2396, 525, 554, 10827, 13, 4706, 396, 470, 13, 4706, 396, 11117, 4882, 2396, 525, 845, 329, 3204, 742, 525, 23147, 2396, 525, 1252, 3167, 3664, 27635, 10827, 13, 4706, 396, 470, 13, 4706, 396, 11117, 4882, 2396, 525, 845, 329, 3204, 742, 525, 23147, 2396, 525, 14148, 2769, 10827, 13, 4706, 1121, 353, 7700, 13, 4706, 1018, 29901, 13, 9651, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 1252, 3167, 7967, 262, 5160, 14730, 580, 13, 9651, 363, 1746, 297, 2933, 29889, 7076, 7295, 13, 18884, 565, 1746, 29961, 29900, 29962, 1275, 525, 4906, 2396, 13, 462, 1678, 565, 1746, 29961, 29896, 29962, 1275, 525, 14605, 26925, 2396, 13, 462, 4706, 1121, 353, 5852, 13, 9651, 565, 1121, 338, 5852, 29901, 13, 18884, 736, 8853, 4882, 1115, 376, 554, 9092, 13, 9651, 1683, 29901, 13, 18884, 736, 8853, 4882, 1115, 376, 845, 329, 3204, 613, 376, 23147, 1115, 376, 1252, 3167, 3664, 27635, 9092, 13, 4706, 5174, 29901, 13, 9651, 2769, 353, 851, 29898, 9675, 29889, 735, 29883, 29918, 3888, 580, 29961, 29900, 2314, 13, 9651, 565, 2769, 29889, 2886, 877, 1252, 3167, 3664, 27635, 1495, 2804, 448, 29896, 29901, 13, 18884, 736, 8853, 4882, 1115, 376, 845, 329, 3204, 613, 376, 23147, 1115, 376, 1252, 3167, 3664, 27635, 9092, 13, 9651, 1683, 29901, 13, 18884, 736, 8853, 4882, 1115, 376, 845, 329, 3204, 613, 376, 23147, 1115, 376, 14148, 2769, 9092, 13, 13, 1678, 822, 6088, 29918, 21962, 15942, 29898, 1311, 29892, 2933, 1125, 13, 4706, 1051, 1469, 353, 5159, 13, 4706, 363, 995, 297, 2933, 29901, 13, 9651, 13128, 353, 426, 13, 9651, 525, 333, 2396, 995, 29889, 657, 877, 978, 5477, 13, 9651, 525, 401, 2396, 995, 29889, 657, 877, 978, 2824, 21064, 3285, 13, 9651, 525, 978, 2396, 995, 29889, 657, 877, 978, 5477, 13, 9651, 525, 4925, 2396, 6120, 29898, 1767, 29889, 657, 877, 4882, 1495, 511, 13, 9651, 525, 1725, 29872, 2396, 29871, 29900, 29889, 29900, 29900, 29945, 29892, 13, 9651, 525, 17990, 2459, 2396, 29871, 29900, 29892, 13, 9651, 525, 12514, 2396, 13, 9651, 426, 13, 18884, 525, 14506, 2396, 13, 18884, 426, 13, 462, 1678, 525, 1195, 2396, 525, 8516, 742, 13, 462, 1678, 525, 3317, 2396, 525, 8516, 742, 13, 18884, 2981, 13, 18884, 525, 9175, 2396, 268, 13, 18884, 426, 13, 462, 1678, 525, 1195, 2396, 525, 8516, 742, 13, 462, 1678, 525, 3317, 2396, 525, 8516, 742, 13, 18884, 2981, 29871, 13, 18884, 525, 18253, 2396, 418, 13, 18884, 426, 13, 462, 1678, 525, 1195, 2396, 525, 8516, 742, 13, 462, 1678, 525, 3317, 2396, 525, 8516, 742, 13, 18884, 2981, 13, 18884, 525, 2541, 4012, 2396, 13, 18884, 426, 13, 462, 1678, 525, 1195, 2396, 995, 29889, 657, 877, 1195, 3047, 4012, 18087, 5477, 13, 462, 1678, 525, 3317, 2396, 995, 29889, 657, 877, 3317, 3047, 4012, 18087, 5477, 13, 18884, 2981, 13, 9651, 2981, 13, 9651, 525, 3888, 2396, 995, 13, 9651, 500, 13, 9651, 1051, 1469, 29889, 4397, 29898, 7050, 29897, 13, 4706, 736, 1051, 1469, 13, 13, 1678, 822, 6699, 29918, 21962, 15942, 29898, 1311, 1125, 13, 4706, 396, 2538, 1112, 346, 1342, 13, 4706, 14330, 13, 4706, 396, 1678, 426, 13, 4706, 396, 4706, 525, 333, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 4706, 525, 401, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 4706, 525, 978, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 4706, 525, 4925, 2396, 5852, 29892, 29871, 13, 4706, 396, 4706, 525, 1725, 29872, 2396, 29871, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 13, 4706, 396, 4706, 525, 17990, 2459, 2396, 29871, 29900, 29892, 29871, 13, 4706, 396, 4706, 525, 12514, 2396, 849, 323, 10593, 14523, 756, 694, 25091, 13, 4706, 396, 4706, 426, 13, 4706, 396, 9651, 525, 14506, 2396, 29871, 13, 4706, 396, 9651, 426, 13, 4706, 396, 18884, 525, 1195, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 18884, 525, 3317, 2396, 525, 8516, 29915, 13, 4706, 396, 9651, 2981, 29871, 13, 4706, 396, 9651, 525, 9175, 2396, 29871, 13, 4706, 396, 9651, 426, 13, 4706, 396, 18884, 525, 1195, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 18884, 525, 3317, 2396, 525, 8516, 29915, 13, 4706, 396, 9651, 2981, 29871, 13, 4706, 396, 9651, 525, 18253, 2396, 29871, 13, 4706, 396, 9651, 426, 13, 4706, 396, 18884, 525, 1195, 2396, 525, 8516, 742, 29871, 13, 4706, 396, 18884, 525, 3317, 2396, 525, 8516, 29915, 13, 4706, 396, 9651, 2981, 29871, 13, 4706, 396, 9651, 525, 2541, 4012, 2396, 29871, 13, 4706, 396, 9651, 426, 13, 4706, 396, 18884, 525, 1195, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 18884, 525, 3317, 2396, 29871, 29945, 29900, 29900, 29900, 29889, 29900, 13, 4706, 396, 9651, 500, 13, 4706, 396, 4706, 2981, 29871, 13, 4706, 396, 4706, 525, 3888, 2396, 426, 2981, 29871, 13, 4706, 396, 1678, 2981, 13, 4706, 396, 1678, 2023, 13, 4706, 396, 29962, 13, 4706, 1018, 29901, 13, 9651, 2933, 353, 1583, 29889, 9053, 6747, 9802, 300, 7967, 1144, 3401, 580, 13, 9651, 736, 1583, 29889, 5510, 29918, 21962, 15942, 29898, 5327, 29897, 13, 4706, 5174, 29901, 13, 9651, 2769, 353, 851, 29898, 9675, 29889, 735, 29883, 29918, 3888, 580, 29961, 29900, 2314, 13, 9651, 565, 2769, 29889, 2886, 877, 1252, 3167, 3664, 27635, 1495, 2804, 448, 29896, 29901, 13, 18884, 736, 8853, 2392, 1115, 376, 1252, 3167, 3664, 27635, 9092, 13, 9651, 1683, 29901, 13, 18884, 736, 8853, 2392, 1115, 376, 14148, 2769, 9092, 13, 13, 1678, 822, 6699, 29918, 2098, 29898, 1311, 29892, 1178, 29892, 5829, 29922, 8516, 29892, 8636, 3790, 29913, 1125, 13, 4706, 2009, 353, 426, 13, 9651, 525, 2098, 1204, 2396, 1178, 29892, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 7514, 12542, 29898, 3827, 29897, 13, 4706, 736, 1583, 29889, 5510, 29918, 2098, 29898, 5327, 29897, 13, 13, 1678, 822, 6088, 29918, 2098, 29898, 1311, 29892, 1797, 29892, 9999, 29922, 8516, 1125, 13, 4706, 396, 426, 13, 4706, 396, 259, 525, 2098, 1204, 22099, 29923, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29896, 29946, 742, 13, 4706, 396, 259, 525, 14242, 1204, 2396, 29906, 29892, 13, 4706, 396, 259, 525, 1853, 22099, 5265, 26349, 29918, 10593, 12107, 742, 13, 4706, 396, 259, 525, 14506, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 259, 525, 18098, 22099, 29933, 3210, 29914, 3308, 12972, 742, 13, 4706, 396, 259, 525, 509, 11932, 18087, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 259, 525, 685, 957, 2396, 29896, 29900, 29947, 29900, 29889, 29900, 29892, 13, 4706, 396, 259, 525, 1111, 262, 14730, 22099, 29933, 3210, 742, 13, 4706, 396, 259, 525, 3188, 14730, 22099, 3308, 12972, 742, 13, 4706, 396, 259, 525, 4882, 22099, 21514, 1307, 29911, 3352, 742, 13, 4706, 396, 259, 525, 12333, 5323, 311, 27939, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29945, 29953, 29906, 29946, 29906, 29892, 13, 4706, 396, 259, 525, 20845, 22099, 1660, 2208, 742, 13, 4706, 396, 259, 525, 9175, 2396, 29896, 29889, 29900, 29892, 13, 4706, 396, 259, 525, 2230, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29892, 13, 4706, 396, 259, 525, 5729, 9446, 2481, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29945, 29953, 29906, 29946, 29906, 29892, 13, 4706, 396, 2981, 13, 4706, 565, 451, 1797, 29901, 13, 9651, 736, 6213, 13, 4706, 1134, 353, 525, 28549, 29915, 13, 4706, 565, 1797, 1839, 1853, 2033, 1275, 525, 5265, 26349, 29918, 10593, 12107, 2396, 13, 9651, 1134, 353, 525, 13400, 29915, 13, 4706, 2625, 353, 1797, 1839, 20845, 13359, 13609, 580, 13, 4706, 9886, 353, 1797, 1839, 14506, 2033, 448, 1797, 1839, 509, 11932, 18087, 2033, 13, 4706, 4660, 353, 1797, 1839, 4882, 2033, 13, 4706, 565, 4660, 1275, 525, 21514, 1307, 29911, 3352, 2396, 13, 9651, 4660, 353, 525, 15603, 29915, 13, 4706, 25342, 4660, 1275, 525, 5659, 3035, 4214, 29915, 470, 4660, 1275, 525, 7228, 17171, 29928, 29915, 470, 4660, 1275, 525, 1525, 6304, 29963, 3352, 2396, 13, 9651, 4660, 353, 525, 3150, 29915, 13, 4706, 1683, 29901, 13, 9651, 4660, 353, 525, 29883, 749, 839, 29915, 13, 4706, 3438, 353, 1797, 1839, 509, 11932, 18087, 2033, 334, 1797, 1839, 9175, 2033, 13, 4706, 1121, 353, 426, 13, 9651, 525, 3888, 2396, 1797, 29892, 13, 9651, 525, 333, 2396, 1797, 1839, 2098, 1204, 7464, 13, 9651, 525, 4645, 7514, 1204, 2396, 1797, 1839, 14242, 1204, 7464, 13, 9651, 525, 16394, 2396, 1797, 1839, 2230, 7464, 13, 9651, 525, 12673, 2396, 1583, 29889, 10718, 29947, 29953, 29900, 29896, 29898, 2098, 1839, 2230, 2033, 511, 13, 9651, 525, 12333, 5323, 311, 27939, 2396, 1797, 1839, 12333, 5323, 311, 27939, 7464, 13, 9651, 525, 18098, 2396, 1797, 1839, 18098, 7464, 13, 9651, 525, 1853, 2396, 1134, 29892, 13, 9651, 525, 2230, 797, 2831, 346, 2396, 6213, 29892, 13, 9651, 525, 2490, 11730, 2396, 6213, 29892, 13, 9651, 525, 2975, 2396, 2625, 29892, 13, 9651, 525, 9175, 2396, 1797, 1839, 9175, 7464, 13, 9651, 525, 9847, 13026, 2396, 6213, 29892, 13, 9651, 525, 18253, 2396, 3438, 29892, 13, 9651, 525, 12483, 482, 2396, 6213, 29892, 13, 9651, 525, 14506, 2396, 1797, 1839, 14506, 7464, 13, 9651, 525, 26940, 2396, 1797, 1839, 509, 11932, 18087, 7464, 13, 9651, 525, 1745, 17225, 2396, 9886, 29892, 13, 9651, 525, 4882, 2396, 4660, 29892, 13, 9651, 525, 1725, 29872, 2396, 6213, 29892, 13, 9651, 525, 509, 3076, 2396, 6213, 29892, 13, 4706, 500, 13, 4706, 736, 1121, 13, 13, 1678, 822, 1653, 29918, 2098, 29898, 1311, 29892, 5829, 29892, 1134, 29892, 2625, 29892, 5253, 29892, 8666, 29922, 8516, 29892, 8636, 3790, 29913, 1125, 13, 4706, 8636, 1839, 18098, 2033, 353, 5829, 13, 4706, 8636, 1839, 9175, 2033, 353, 8666, 13, 4706, 8636, 1839, 14506, 2033, 353, 5253, 13, 4706, 565, 2625, 1275, 525, 2423, 29891, 2396, 13, 9651, 8636, 1839, 20845, 2033, 353, 525, 7838, 29979, 29915, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 20845, 2033, 353, 525, 1660, 2208, 29915, 13, 4706, 565, 1134, 1275, 525, 28549, 2396, 13, 9651, 8636, 1839, 1853, 2033, 353, 525, 1529, 29934, 29968, 2544, 29918, 10593, 12107, 29915, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 1853, 2033, 353, 525, 5265, 26349, 29918, 10593, 12107, 29915, 13, 4706, 8636, 1839, 1509, 4205, 2798, 2033, 353, 525, 29900, 29915, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 7514, 2528, 29898, 7529, 29897, 13, 4706, 1797, 1204, 353, 1583, 29889, 11177, 29918, 1807, 29898, 5327, 29892, 525, 1272, 1495, 13, 4706, 736, 1583, 29889, 9155, 29918, 2098, 29898, 2098, 1204, 29897, 13, 13, 1678, 822, 12611, 29918, 2098, 29898, 1311, 29892, 1178, 29892, 5829, 29922, 8516, 29892, 8636, 3790, 29913, 1125, 13, 4706, 2009, 353, 426, 13, 9651, 525, 2098, 1204, 2396, 1178, 29892, 13, 4706, 500, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 7514, 17396, 2185, 2242, 29898, 1311, 29889, 21843, 29898, 3827, 29892, 8636, 876, 13, 4706, 736, 1583, 29889, 5510, 29918, 2098, 29898, 5327, 1839, 1272, 11287, 13, 13, 1678, 822, 6699, 29918, 20488, 29898, 1311, 29892, 5829, 29922, 8516, 29892, 1951, 29922, 8516, 29892, 4046, 29922, 8516, 29892, 8636, 3790, 29913, 1125, 13, 4706, 396, 10729, 3829, 13, 4706, 396, 426, 13, 4706, 396, 259, 525, 18098, 2396, 24953, 515, 1158, 6273, 13, 4706, 396, 259, 525, 16076, 2396, 7870, 7416, 310, 937, 1797, 297, 1051, 297, 26663, 21502, 305, 3402, 13, 4706, 396, 259, 525, 13400, 2396, 13291, 1051, 2159, 13, 4706, 396, 259, 525, 14242, 1204, 2396, 2610, 367, 731, 297, 8636, 29889, 2610, 367, 451, 731, 13, 4706, 396, 259, 525, 4882, 2396, 697, 310, 10014, 3035, 4214, 4810, 3580, 1307, 29911, 3352, 315, 23219, 20566, 438, 5348, 15307, 29928, 29889, 2610, 367, 731, 297, 8636, 13, 4706, 396, 259, 525, 3488, 2396, 363, 10203, 3381, 29889, 512, 1583, 1206, 4046, 338, 2159, 310, 1432, 1813, 29889, 2610, 367, 731, 297, 8636, 13, 4706, 396, 500, 13, 4706, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 353, 29871, 29896, 29900, 29900, 29900, 29900, 13, 4706, 565, 525, 3488, 29915, 297, 8636, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 1583, 29889, 11177, 29918, 1807, 29898, 7529, 29892, 525, 3488, 1495, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 29871, 29900, 13, 4706, 565, 5829, 338, 6213, 29901, 13, 9651, 5829, 353, 6629, 13, 4706, 565, 1951, 338, 6213, 29901, 13, 9651, 1951, 353, 29871, 29900, 13, 4706, 565, 4046, 338, 6213, 29901, 13, 9651, 4046, 353, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 13, 13, 4706, 2009, 353, 426, 13, 9651, 525, 18098, 2396, 5829, 29892, 13, 9651, 525, 16076, 2396, 1951, 29892, 13, 9651, 525, 3488, 3505, 2396, 4046, 29892, 13, 4706, 500, 13, 13, 4706, 2989, 3089, 353, 1583, 29889, 21843, 29898, 3827, 29892, 8636, 29897, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 7514, 3596, 29898, 8159, 3089, 29897, 13, 4706, 396, 426, 13, 4706, 396, 268, 525, 3051, 2396, 518, 13, 4706, 396, 308, 426, 13, 4706, 396, 632, 525, 2098, 1204, 22099, 29923, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29896, 29946, 742, 13, 4706, 396, 632, 525, 14242, 1204, 2396, 29906, 29892, 13, 4706, 396, 632, 525, 1853, 22099, 5265, 26349, 29918, 10593, 12107, 742, 13, 4706, 396, 632, 525, 14506, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 18098, 22099, 29933, 3210, 29914, 3308, 12972, 742, 13, 4706, 396, 632, 525, 509, 11932, 18087, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 685, 957, 2396, 29896, 29900, 29947, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 1111, 262, 14730, 22099, 29933, 3210, 742, 13, 4706, 396, 632, 525, 3188, 14730, 22099, 3308, 12972, 742, 13, 4706, 396, 632, 525, 4882, 22099, 21514, 1307, 29911, 3352, 742, 13, 4706, 396, 632, 525, 20845, 22099, 1660, 2208, 742, 13, 4706, 396, 632, 525, 9175, 2396, 29896, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 2230, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29892, 13, 4706, 396, 632, 525, 5729, 9446, 2481, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29945, 29953, 29906, 29946, 29906, 29892, 13, 4706, 396, 308, 2981, 13, 4706, 396, 308, 2023, 13, 4706, 396, 268, 21251, 13, 4706, 396, 268, 525, 7827, 18868, 2396, 29946, 29896, 29892, 13, 4706, 396, 268, 525, 7827, 27514, 2396, 29941, 29892, 13, 4706, 396, 268, 525, 4230, 2396, 8824, 29892, 13, 4706, 396, 268, 525, 2311, 2396, 29906, 29900, 29892, 13, 4706, 396, 268, 525, 4537, 2396, 29896, 29892, 13, 4706, 396, 268, 525, 4102, 2396, 8824, 29892, 13, 4706, 396, 268, 525, 4537, 2776, 18868, 2396, 29906, 29900, 29892, 13, 4706, 396, 268, 525, 6605, 2396, 518, 13, 4706, 396, 308, 426, 13, 4706, 396, 632, 525, 20845, 22099, 2287, 7187, 742, 13, 4706, 396, 632, 525, 6799, 22099, 2230, 742, 13, 4706, 396, 632, 525, 17281, 8259, 2396, 8824, 29892, 13, 4706, 396, 632, 525, 4304, 3481, 1847, 22099, 29940, 1299, 18474, 742, 13, 4706, 396, 632, 525, 6151, 2548, 2396, 8824, 29892, 13, 4706, 396, 632, 525, 14273, 2548, 2396, 5574, 29892, 13, 4706, 396, 308, 500, 13, 4706, 396, 268, 4514, 13, 4706, 396, 500, 13, 4706, 736, 1583, 29889, 5510, 29918, 20488, 29898, 5327, 1839, 3051, 11287, 13, 13, 1678, 822, 6699, 29918, 3150, 29918, 20488, 29898, 1311, 29892, 5829, 29922, 8516, 29892, 1951, 29922, 8516, 29892, 4046, 29922, 8516, 29892, 8636, 3790, 29913, 1125, 13, 4706, 396, 10729, 3829, 13, 4706, 396, 426, 13, 4706, 396, 259, 525, 18098, 2396, 24953, 515, 1158, 6273, 13, 4706, 396, 259, 525, 16076, 2396, 7870, 7416, 310, 937, 1797, 297, 1051, 297, 26663, 21502, 305, 3402, 13, 4706, 396, 259, 525, 13400, 2396, 13291, 1051, 2159, 13, 4706, 396, 259, 525, 14242, 1204, 2396, 2610, 367, 731, 297, 8636, 29889, 2610, 367, 451, 731, 13, 4706, 396, 259, 525, 4882, 2396, 697, 310, 10014, 3035, 4214, 4810, 3580, 1307, 29911, 3352, 315, 23219, 20566, 438, 5348, 15307, 29928, 29889, 2610, 367, 731, 297, 8636, 13, 4706, 396, 259, 525, 3488, 2396, 363, 10203, 3381, 29889, 512, 1583, 1206, 4046, 338, 2159, 310, 1432, 1813, 29889, 2610, 367, 731, 297, 8636, 13, 4706, 396, 500, 13, 4706, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 353, 29871, 29906, 29900, 13, 4706, 565, 525, 3488, 29915, 297, 8636, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 1583, 29889, 11177, 29918, 1807, 29898, 7529, 29892, 525, 3488, 1495, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 29871, 29900, 13, 13, 4706, 565, 5829, 338, 6213, 29901, 13, 9651, 5829, 353, 6629, 13, 4706, 565, 1951, 338, 6213, 29901, 13, 9651, 1951, 353, 29871, 29900, 13, 4706, 565, 4046, 338, 6213, 29901, 13, 9651, 4046, 353, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 13, 308, 13, 4706, 2009, 353, 426, 13, 9651, 525, 18098, 2396, 5829, 29892, 13, 9651, 525, 16076, 2396, 1951, 29892, 13, 9651, 525, 3488, 3505, 2396, 4046, 29892, 13, 4706, 500, 13, 4706, 2989, 3089, 353, 1583, 29889, 21843, 29898, 3827, 29892, 8636, 29897, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 7514, 3596, 29898, 8159, 3089, 29897, 13, 4706, 396, 426, 13, 4706, 396, 268, 525, 3051, 2396, 518, 13, 4706, 396, 308, 426, 13, 4706, 396, 632, 525, 2098, 1204, 22099, 29923, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29896, 29946, 742, 13, 4706, 396, 632, 525, 14242, 1204, 2396, 29906, 29892, 13, 4706, 396, 632, 525, 1853, 22099, 5265, 26349, 29918, 10593, 12107, 742, 13, 4706, 396, 632, 525, 14506, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 18098, 22099, 29933, 3210, 29914, 3308, 12972, 742, 13, 4706, 396, 632, 525, 509, 11932, 18087, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 685, 957, 2396, 29896, 29900, 29947, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 1111, 262, 14730, 22099, 29933, 3210, 742, 13, 4706, 396, 632, 525, 3188, 14730, 22099, 3308, 12972, 742, 13, 4706, 396, 632, 525, 4882, 22099, 21514, 1307, 29911, 3352, 742, 13, 4706, 396, 632, 525, 20845, 22099, 1660, 2208, 742, 13, 4706, 396, 632, 525, 9175, 2396, 29896, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 2230, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29892, 13, 4706, 396, 632, 525, 5729, 9446, 2481, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29945, 29953, 29906, 29946, 29906, 29892, 13, 4706, 396, 308, 2981, 13, 4706, 396, 308, 2023, 13, 4706, 396, 268, 21251, 13, 4706, 396, 268, 525, 7827, 18868, 2396, 29946, 29896, 29892, 13, 4706, 396, 268, 525, 7827, 27514, 2396, 29941, 29892, 13, 4706, 396, 268, 525, 4230, 2396, 8824, 29892, 13, 4706, 396, 268, 525, 2311, 2396, 29906, 29900, 29892, 13, 4706, 396, 268, 525, 4537, 2396, 29896, 29892, 13, 4706, 396, 268, 525, 4102, 2396, 8824, 29892, 13, 4706, 396, 268, 525, 4537, 2776, 18868, 2396, 29906, 29900, 29892, 13, 4706, 396, 268, 525, 6605, 2396, 518, 13, 4706, 396, 308, 426, 13, 4706, 396, 632, 525, 20845, 22099, 2287, 7187, 742, 13, 4706, 396, 632, 525, 6799, 22099, 2230, 742, 13, 4706, 396, 632, 525, 17281, 8259, 2396, 8824, 29892, 13, 4706, 396, 632, 525, 4304, 3481, 1847, 22099, 29940, 1299, 18474, 742, 13, 4706, 396, 632, 525, 6151, 2548, 2396, 8824, 29892, 13, 4706, 396, 632, 525, 14273, 2548, 2396, 5574, 29892, 13, 4706, 396, 308, 500, 13, 4706, 396, 268, 4514, 13, 4706, 396, 500, 13, 4706, 736, 1583, 29889, 5510, 29918, 20488, 29898, 5327, 1839, 3051, 11287, 13, 13, 1678, 822, 6699, 29918, 15603, 29918, 20488, 29898, 1311, 29892, 5829, 29922, 8516, 29892, 1951, 29922, 8516, 29892, 4046, 29922, 8516, 29892, 8636, 3790, 29913, 1125, 13, 4706, 396, 10729, 3829, 13, 4706, 396, 426, 13, 4706, 396, 259, 525, 18098, 2396, 24953, 515, 1158, 6273, 13, 4706, 396, 259, 525, 16076, 2396, 7870, 7416, 310, 937, 1797, 297, 1051, 297, 26663, 21502, 305, 3402, 13, 4706, 396, 259, 525, 13400, 2396, 13291, 1051, 2159, 13, 4706, 396, 259, 525, 14242, 1204, 2396, 2610, 367, 731, 297, 8636, 29889, 2610, 367, 451, 731, 13, 4706, 396, 259, 525, 4882, 2396, 697, 310, 10014, 3035, 4214, 4810, 3580, 1307, 29911, 3352, 315, 23219, 20566, 438, 5348, 15307, 29928, 29889, 2610, 367, 731, 297, 8636, 13, 4706, 396, 259, 525, 3488, 2396, 363, 10203, 3381, 29889, 512, 1583, 1206, 4046, 338, 2159, 310, 1432, 1813, 29889, 2610, 367, 731, 297, 8636, 13, 4706, 396, 500, 13, 4706, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 353, 29871, 29906, 29900, 13, 4706, 8636, 1839, 4882, 2033, 353, 525, 29907, 23219, 20566, 29915, 13, 4706, 565, 525, 3488, 29915, 297, 8636, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 1583, 29889, 11177, 29918, 1807, 29898, 7529, 29892, 525, 3488, 1495, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 3488, 3782, 2033, 353, 29871, 29900, 13, 13, 4706, 565, 5829, 338, 6213, 29901, 13, 9651, 5829, 353, 6629, 13, 4706, 565, 1951, 338, 6213, 29901, 13, 9651, 1951, 353, 29871, 29900, 13, 4706, 565, 4046, 338, 6213, 29901, 13, 9651, 4046, 353, 2322, 29918, 2098, 29918, 14506, 29918, 13400, 13, 308, 13, 4706, 2009, 353, 426, 13, 9651, 525, 18098, 2396, 5829, 29892, 13, 9651, 525, 16076, 2396, 1951, 29892, 13, 9651, 525, 3488, 3505, 2396, 4046, 29892, 13, 4706, 500, 13, 4706, 2989, 3089, 353, 1583, 29889, 21843, 29898, 3827, 29892, 8636, 29897, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 1252, 3167, 7514, 3596, 29898, 8159, 3089, 29897, 13, 4706, 396, 426, 13, 4706, 396, 268, 525, 3051, 2396, 518, 13, 4706, 396, 308, 426, 13, 4706, 396, 632, 525, 2098, 1204, 22099, 29923, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29896, 29946, 742, 13, 4706, 396, 632, 525, 14242, 1204, 2396, 29906, 29892, 13, 4706, 396, 632, 525, 1853, 22099, 5265, 26349, 29918, 10593, 12107, 742, 13, 4706, 396, 632, 525, 14506, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 18098, 22099, 29933, 3210, 29914, 3308, 12972, 742, 13, 4706, 396, 632, 525, 509, 11932, 18087, 2396, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 685, 957, 2396, 29896, 29900, 29947, 29900, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 1111, 262, 14730, 22099, 29933, 3210, 742, 13, 4706, 396, 632, 525, 3188, 14730, 22099, 3308, 12972, 742, 13, 4706, 396, 632, 525, 4882, 22099, 21514, 1307, 29911, 3352, 742, 13, 4706, 396, 632, 525, 20845, 22099, 1660, 2208, 742, 13, 4706, 396, 632, 525, 9175, 2396, 29896, 29889, 29900, 29892, 13, 4706, 396, 632, 525, 2230, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29946, 29941, 29955, 29955, 29953, 29892, 13, 4706, 396, 632, 525, 5729, 9446, 2481, 2396, 29896, 29953, 29896, 29896, 29947, 29941, 29953, 29906, 29945, 29953, 29906, 29946, 29906, 29892, 13, 4706, 396, 308, 2981, 13, 4706, 396, 308, 2023, 13, 4706, 396, 268, 21251, 13, 4706, 396, 268, 525, 7827, 18868, 2396, 29946, 29896, 29892, 13, 4706, 396, 268, 525, 7827, 27514, 2396, 29941, 29892, 13, 4706, 396, 268, 525, 4230, 2396, 8824, 29892, 13, 4706, 396, 268, 525, 2311, 2396, 29906, 29900, 29892, 13, 4706, 396, 268, 525, 4537, 2396, 29896, 29892, 13, 4706, 396, 268, 525, 4102, 2396, 8824, 29892, 13, 4706, 396, 268, 525, 4537, 2776, 18868, 2396, 29906, 29900, 29892, 13, 4706, 396, 268, 525, 6605, 2396, 518, 13, 4706, 396, 308, 426, 13, 4706, 396, 632, 525, 20845, 22099, 2287, 7187, 742, 13, 4706, 396, 632, 525, 6799, 22099, 2230, 742, 13, 4706, 396, 632, 525, 17281, 8259, 2396, 8824, 29892, 13, 4706, 396, 632, 525, 4304, 3481, 1847, 22099, 29940, 1299, 18474, 742, 13, 4706, 396, 632, 525, 6151, 2548, 2396, 8824, 29892, 13, 4706, 396, 632, 525, 14273, 2548, 2396, 5574, 29892, 13, 4706, 396, 308, 500, 13, 4706, 396, 268, 4514, 13, 4706, 396, 500, 13, 4706, 736, 1583, 29889, 5510, 29918, 20488, 29898, 5327, 1839, 3051, 11287, 13, 13, 1678, 396, 960, 1246, 1728, 8636, 278, 740, 3639, 17346, 310, 1857, 1404, 13, 1678, 822, 6699, 29918, 5521, 749, 29898, 1311, 29892, 318, 333, 2433, 29899, 29896, 742, 8636, 3790, 29913, 1125, 13, 4706, 8636, 353, 426, 13, 9651, 525, 5416, 2396, 318, 333, 13, 4706, 500, 13, 4706, 1018, 29901, 13, 9651, 2933, 353, 1583, 29889, 9053, 6747, 29965, 5064, 13404, 22031, 749, 29898, 7529, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 736, 321, 13, 4706, 736, 1583, 29889, 5510, 29918, 5521, 749, 29898, 5327, 29897, 13, 13, 1678, 822, 6088, 29918, 5521, 749, 29898, 1311, 29892, 2933, 1125, 13, 4706, 848, 353, 4390, 29889, 18132, 29898, 3126, 29889, 29881, 17204, 29898, 5327, 876, 13, 4706, 565, 848, 1839, 4906, 2033, 1275, 525, 14605, 26925, 2396, 13, 9651, 1121, 353, 426, 376, 9021, 1115, 29912, 1118, 376, 3880, 1115, 29912, 1118, 376, 7827, 1115, 29912, 930, 13, 9651, 363, 1948, 297, 848, 1839, 1272, 16215, 5521, 2925, 2033, 29901, 13, 18884, 1121, 1839, 9021, 13359, 5504, 3319, 798, 1839, 1111, 262, 1170, 2033, 29901, 798, 1839, 9021, 2033, 1800, 13, 18884, 1121, 1839, 3880, 13359, 5504, 3319, 798, 1839, 1111, 262, 1170, 2033, 29901, 798, 1839, 3880, 2033, 1800, 13, 18884, 1121, 1839, 7827, 13359, 5504, 3319, 798, 1839, 1111, 262, 1170, 2033, 29901, 798, 1839, 7827, 2033, 1800, 13, 18884, 1121, 29889, 5504, 3319, 798, 1839, 1111, 262, 1170, 2033, 29901, 10998, 9021, 2396, 798, 1839, 9021, 7464, 525, 3880, 2396, 798, 1839, 3880, 7464, 525, 7827, 2396, 798, 1839, 7827, 2033, 24289, 13, 9651, 736, 1121, 13, 13, 1678, 396, 16969, 938, 470, 6213, 13, 1678, 822, 679, 29918, 28549, 29918, 9175, 29898, 1311, 29892, 5829, 1125, 13, 13, 4706, 2933, 353, 1583, 29889, 9053, 6747, 9802, 300, 14730, 1349, 3774, 580, 13, 4706, 363, 474, 297, 2933, 29901, 13, 9651, 565, 474, 29889, 657, 877, 18098, 1495, 1275, 5829, 29901, 13, 18884, 736, 474, 29889, 657, 877, 5358, 1495, 13, 13, 1678, 822, 6699, 29918, 509, 3076, 29898, 1311, 29892, 1797, 1204, 29892, 1951, 29892, 1813, 3782, 29922, 8516, 29892, 1813, 3505, 29922, 8516, 1125, 13, 4706, 396, 2538, 1112, 346, 1342, 29901, 13, 4706, 396, 518, 13, 4706, 396, 1678, 426, 13, 4706, 396, 539, 525, 3888, 2396, 426, 14998, 2933, 2981, 29871, 13, 4706, 396, 539, 525, 333, 2396, 525, 29923, 29896, 29953, 29896, 29946, 29953, 29900, 29946, 29929, 29929, 29945, 29896, 29953, 29929, 29953, 29947, 742, 29871, 13, 4706, 396, 539, 525, 16394, 2396, 29871, 29896, 29953, 29896, 29946, 29953, 29900, 29945, 29896, 29947, 29955, 29953, 29953, 29896, 29892, 29871, 13, 4706, 396, 539, 525, 12673, 2396, 525, 29906, 29900, 29906, 29896, 29899, 29900, 29941, 29899, 29900, 29896, 29871, 29896, 29945, 29901, 29906, 29953, 29901, 29906, 29955, 29889, 29953, 29953, 29896, 29900, 29900, 29900, 742, 29871, 13, 4706, 396, 539, 525, 18098, 2396, 525, 29933, 9472, 29914, 3308, 12972, 742, 29871, 13, 4706, 396, 539, 525, 2098, 2396, 525, 29923, 29896, 29953, 29896, 29946, 29953, 29900, 29946, 29929, 29929, 29945, 29896, 29953, 29929, 29953, 29947, 742, 29871, 13, 4706, 396, 539, 525, 1853, 2396, 525, 5265, 26349, 29918, 10593, 12107, 742, 29871, 13, 4706, 396, 539, 525, 2975, 2396, 525, 1660, 2208, 742, 29871, 13, 4706, 396, 539, 525, 29873, 5790, 2816, 29924, 5790, 2396, 525, 8516, 742, 313, 25559, 694, 445, 2472, 2768, 323, 10593, 14523, 29897, 13, 4706, 396, 539, 525, 9175, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 539, 525, 14506, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 539, 525, 18253, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 539, 525, 1725, 29872, 2396, 29871, 13, 4706, 396, 539, 426, 13, 4706, 396, 965, 525, 18253, 2396, 29871, 29900, 29889, 29900, 29900, 29945, 29892, 29871, 13, 4706, 396, 965, 525, 26095, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 965, 525, 10492, 2396, 525, 8516, 29915, 313, 25559, 694, 445, 2472, 2768, 323, 10593, 14523, 29897, 13, 4706, 396, 539, 500, 13, 4706, 396, 1678, 500, 13, 4706, 396, 4514, 13, 13, 4706, 565, 1813, 3782, 338, 6213, 29901, 13, 9651, 1813, 3782, 353, 29871, 29900, 13, 308, 13, 4706, 565, 1813, 3505, 338, 6213, 29901, 13, 9651, 1813, 3505, 353, 29871, 29896, 29900, 29900, 13, 13, 4706, 2009, 353, 426, 525, 2098, 1204, 2396, 1797, 1204, 29892, 13, 462, 1678, 525, 16076, 2396, 1951, 29892, 13, 462, 1678, 525, 3488, 3782, 2396, 1813, 3782, 29892, 13, 462, 1678, 525, 3488, 3505, 2396, 1813, 3505, 500, 13, 4706, 736, 1583, 29889, 5510, 29918, 3018, 311, 29898, 1311, 29889, 9053, 6747, 1252, 3167, 7514, 2308, 3076, 29898, 3827, 876, 13, 13, 1678, 822, 6088, 29918, 3018, 311, 29898, 1311, 29892, 2933, 1125, 13, 4706, 534, 3076, 353, 5159, 13, 4706, 2793, 353, 2933, 29889, 657, 877, 3051, 1495, 13, 4706, 363, 14523, 5323, 311, 297, 2793, 29901, 13, 9651, 14334, 353, 14523, 5323, 311, 29889, 657, 877, 2230, 1495, 13, 9651, 12865, 29918, 353, 851, 29898, 12673, 29889, 3166, 16394, 29898, 524, 29898, 16394, 29897, 334, 29871, 29900, 29889, 29900, 29900, 29896, 876, 13, 9651, 8666, 353, 14523, 5323, 311, 29889, 657, 877, 9175, 1495, 13, 9651, 5253, 353, 14523, 5323, 311, 29889, 657, 877, 14506, 1495, 13, 9651, 3438, 353, 8666, 334, 5253, 13, 13, 9651, 13128, 353, 426, 13, 18884, 525, 3888, 2396, 14523, 5323, 311, 29892, 13, 18884, 525, 333, 2396, 14523, 5323, 311, 29889, 657, 877, 2098, 1204, 5477, 13, 18884, 525, 16394, 2396, 14334, 29892, 13, 18884, 525, 12673, 2396, 12865, 3383, 13, 18884, 525, 18098, 2396, 14523, 5323, 311, 29889, 657, 877, 18098, 5477, 13, 18884, 525, 2098, 2396, 14523, 5323, 311, 29889, 657, 877, 2098, 1204, 5477, 13, 18884, 525, 1853, 2396, 14523, 5323, 311, 29889, 657, 877, 1853, 5477, 13, 18884, 525, 2975, 2396, 14523, 5323, 311, 29889, 657, 877, 20845, 5477, 13, 18884, 525, 29873, 5790, 2816, 29924, 5790, 2396, 525, 8516, 742, 13, 18884, 525, 9175, 2396, 8666, 29892, 13, 18884, 525, 14506, 2396, 5253, 29892, 13, 18884, 525, 18253, 2396, 3438, 29892, 13, 18884, 525, 1725, 29872, 2396, 13, 18884, 426, 13, 462, 1678, 525, 18253, 2396, 14523, 5323, 311, 29889, 657, 877, 1725, 29872, 5477, 13, 462, 1678, 525, 26095, 2396, 14523, 5323, 311, 29889, 657, 877, 1111, 262, 14730, 5477, 13, 462, 1678, 525, 10492, 2396, 525, 8516, 742, 13, 18884, 500, 13, 9651, 500, 13, 9651, 534, 3076, 29889, 4397, 29898, 7050, 29897, 13, 4706, 736, 534, 3076, 13, 13, 1678, 822, 6088, 29918, 1357, 29918, 509, 3076, 29898, 1311, 29892, 2933, 1125, 13, 4706, 1051, 1469, 353, 5159, 13, 4706, 363, 995, 297, 2933, 29901, 13, 9651, 24004, 7514, 353, 2933, 29889, 657, 29898, 1767, 29897, 13, 9651, 1178, 29918, 353, 24004, 7514, 29889, 657, 877, 2098, 1204, 1495, 13, 9651, 14334, 353, 24004, 7514, 29889, 657, 877, 2230, 1495, 13, 9651, 12865, 29918, 353, 851, 29898, 12673, 29889, 3166, 16394, 29898, 524, 29898, 16394, 29897, 334, 29871, 29900, 29889, 29900, 29900, 29896, 876, 13, 9651, 8666, 353, 24004, 7514, 29889, 657, 877, 9175, 1495, 13, 9651, 5253, 353, 24004, 7514, 29889, 657, 877, 14506, 1495, 13, 9651, 3438, 353, 8666, 334, 5253, 13, 13, 9651, 13128, 353, 426, 13, 18884, 525, 3888, 2396, 2933, 29889, 657, 29898, 1767, 511, 13, 18884, 525, 333, 2396, 1178, 3383, 13, 18884, 525, 16394, 2396, 14334, 29892, 13, 18884, 525, 12673, 2396, 12865, 3383, 13, 18884, 525, 18098, 2396, 24004, 7514, 29889, 657, 877, 18098, 5477, 13, 18884, 525, 2098, 2396, 1178, 3383, 13, 18884, 525, 1853, 2396, 24004, 7514, 29889, 657, 877, 1853, 5477, 13, 18884, 525, 2975, 2396, 24004, 7514, 29889, 657, 877, 20845, 5477, 13, 18884, 525, 29873, 5790, 2816, 29924, 5790, 2396, 525, 8516, 742, 13, 18884, 525, 9175, 2396, 8666, 29892, 13, 18884, 525, 14506, 2396, 5253, 29892, 13, 18884, 525, 18253, 2396, 3438, 29892, 13, 18884, 525, 1725, 29872, 2396, 13, 18884, 426, 13, 462, 1678, 525, 18253, 2396, 24004, 7514, 29889, 657, 877, 1725, 29872, 5477, 13, 462, 1678, 525, 26095, 2396, 24004, 7514, 29889, 657, 877, 1111, 262, 14730, 5477, 13, 462, 1678, 525, 10492, 2396, 525, 8516, 742, 13, 18884, 500, 13, 18884, 500, 13, 9651, 1051, 1469, 29889, 4397, 29898, 7050, 29897, 13, 4706, 736, 1051, 1469, 13, 13, 1678, 822, 6699, 29918, 1357, 29918, 509, 3076, 29898, 1311, 29892, 1813, 3782, 29922, 8516, 29892, 1813, 3505, 29922, 8516, 1125, 13, 4706, 396, 2538, 1112, 346, 1342, 29901, 13, 4706, 396, 518, 13, 4706, 396, 1678, 426, 13, 4706, 396, 539, 525, 3888, 2396, 426, 14998, 2933, 2981, 29871, 13, 4706, 396, 539, 525, 333, 2396, 525, 29923, 29896, 29953, 29896, 29946, 29953, 29900, 29946, 29929, 29929, 29945, 29896, 29953, 29929, 29953, 29947, 742, 29871, 13, 4706, 396, 539, 525, 16394, 2396, 29871, 29896, 29953, 29896, 29946, 29953, 29900, 29945, 29896, 29947, 29955, 29953, 29953, 29896, 29892, 29871, 13, 4706, 396, 539, 525, 12673, 2396, 525, 29906, 29900, 29906, 29896, 29899, 29900, 29941, 29899, 29900, 29896, 29871, 29896, 29945, 29901, 29906, 29953, 29901, 29906, 29955, 29889, 29953, 29953, 29896, 29900, 29900, 29900, 742, 29871, 13, 4706, 396, 539, 525, 18098, 2396, 525, 29933, 9472, 29914, 3308, 12972, 742, 29871, 13, 4706, 396, 539, 525, 2098, 2396, 525, 29923, 29896, 29953, 29896, 29946, 29953, 29900, 29946, 29929, 29929, 29945, 29896, 29953, 29929, 29953, 29947, 742, 29871, 13, 4706, 396, 539, 525, 1853, 2396, 525, 5265, 26349, 29918, 10593, 12107, 742, 29871, 13, 4706, 396, 539, 525, 2975, 2396, 525, 1660, 2208, 742, 29871, 13, 4706, 396, 539, 525, 29873, 5790, 2816, 29924, 5790, 2396, 525, 8516, 742, 313, 25559, 694, 445, 2472, 2768, 323, 10593, 14523, 29897, 13, 4706, 396, 539, 525, 9175, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 539, 525, 14506, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 539, 525, 18253, 2396, 29871, 29896, 29889, 29900, 29892, 29871, 13, 4706, 396, 539, 525, 1725, 29872, 2396, 29871, 13, 4706, 396, 539, 426, 13, 4706, 396, 965, 525, 18253, 2396, 29871, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 13, 4706, 396, 965, 525, 26095, 2396, 525, 29933, 9472, 742, 29871, 13, 4706, 396, 965, 525, 10492, 2396, 525, 8516, 29915, 29871, 313, 25559, 694, 445, 2472, 2768, 323, 10593, 14523, 29897, 13, 4706, 396, 539, 500, 13, 4706, 396, 1678, 2981, 29871, 13, 4706, 396, 1678, 426, 2023, 2981, 13, 4706, 396, 4514, 13, 13, 4706, 565, 1813, 3782, 338, 6213, 29901, 13, 9651, 1813, 3782, 353, 29871, 29900, 13, 308, 13, 4706, 565, 1813, 3505, 338, 6213, 29901, 13, 9651, 1813, 3505, 353, 29871, 29896, 29900, 29900, 13, 13, 4706, 2009, 353, 426, 525, 2098, 1204, 2396, 15516, 13, 462, 1678, 525, 3488, 3782, 2396, 1813, 3782, 29892, 13, 462, 1678, 525, 3488, 3505, 2396, 1813, 3505, 500, 13, 4706, 736, 1583, 29889, 5510, 29918, 1357, 29918, 509, 3076, 29898, 1311, 29889, 9053, 6747, 1252, 3167, 7514, 3421, 2308, 3076, 29898, 3827, 876, 13, 13, 1678, 822, 4386, 29918, 12523, 29898, 1311, 29892, 1732, 3399, 29892, 2769, 29892, 3142, 29892, 1158, 29892, 9066, 29892, 3573, 29892, 2933, 29892, 2009, 18163, 29892, 2009, 8434, 1125, 13, 4706, 565, 2933, 338, 6213, 29901, 13, 9651, 736, 29871, 396, 6416, 1627, 304, 2322, 1059, 7834, 13, 4706, 565, 1732, 3399, 1275, 29871, 29906, 29900, 29900, 29901, 13, 9651, 565, 525, 401, 29915, 297, 2933, 29901, 13, 18884, 565, 2933, 1839, 401, 2033, 1275, 29871, 29900, 29901, 13, 462, 1678, 736, 13, 9651, 1683, 29901, 13, 18884, 736, 13, 4706, 396, 426, 13, 4706, 396, 268, 376, 4906, 1115, 376, 2392, 1426, 297, 1206, 746, 7331, 775, 338, 451, 29871, 29906, 29900, 29900, 613, 13, 4706, 396, 268, 2023, 13, 4706, 396, 500, 13, 4706, 2643, 353, 1583, 29889, 11177, 29918, 1807, 29898, 5327, 29892, 525, 4906, 1495, 13, 4706, 565, 2643, 338, 451, 6213, 29901, 13, 9651, 16705, 353, 1583, 29889, 333, 718, 525, 525, 718, 3573, 13, 9651, 1583, 29889, 20539, 29918, 735, 23617, 29918, 4352, 287, 29918, 11739, 29898, 1311, 29889, 11739, 29879, 1839, 735, 627, 7464, 2643, 29892, 16705, 29897, 13, 9651, 1583, 29889, 20539, 29918, 6729, 328, 368, 29918, 4352, 287, 29918, 11739, 29898, 1311, 29889, 11739, 29879, 1839, 6729, 328, 7464, 2643, 29892, 16705, 29897, 13, 9651, 12020, 24004, 2392, 29898, 18798, 1627, 29897, 29871, 396, 9815, 2643, 13, 2 ]
raw_data_euzi.py
thiagolcmelo/benchmark
0
113750
<reponame>thiagolcmelo/benchmark<gh_stars>0 # coding: utf-8 # In[37]: import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.spatial.distance import cdist from sklearn.preprocessing import StandardScaler plt.rcParams['figure.figsize'] = 14, 8 # In[76]: n = 6 files = np.load('res_numeric_iter.npz') res_numeric_iter = files['arr_0'] files = np.load('res_numeric_time.npz') res_numeric_time = files['arr_0'] # In[10]: # for j in range(n): # chebyshev = [] # for res in res_numeric_iter: # chebyshev.append(res['chebyshev'][j]) # plt.semilogy([i * 1e5 for i in range(1,11)], chebyshev, label='Chebyshev_state_%d' % j) for j in range(n): chebyshev = [] for res in res_numeric_time: chebyshev.append(res['chebyshev'][j]) plt.semilogy([60 * i for i in range(1,6)], chebyshev, label='sqeuclidian_state_%d' % j) plt.legend() plt.show() # In[73]: res_iterations = [] for j in range(n): precisions = [] chebyshev = [] seuclidean = [] sqeuclidean = [] for res in res_numeric_iter: precisions.append(res['precisions'][j]) chebyshev.append(res['chebyshev'][j]) seuclidean.append(res['seuclidean'][j]) sqeuclidean.append(res['sqeuclidean'][j]) iterations = [i * 1e5 for i in range(1,11)] for i, it in enumerate(iterations): res_iterations.append({ 'state': j, 'iterations': it, 'eigenvalue_precision': precisions[i], 'eigenstate_chebyshev': chebyshev[i], 'eigenstate_seuclidean': seuclidean[i], 'eigenstate_sqeuclidean': sqeuclidean[i], }) res_iterations = pd.DataFrame(res_iterations) for j in range(6): j_es = res_iterations.loc[res_iterations['state'] == j] plt.semilogy(j_es['iterations'], j_es['eigenstate_sqeuclidean'], label='state_%d' % j) plt.legend() plt.show() chebyshev = res_iterations.pivot(index='iterations', columns='state', values='eigenstate_chebyshev').reset_index(level=0) sqeuclidean = res_iterations.pivot(index='iterations', columns='state', values='eigenstate_sqeuclidean').reset_index(level=0) chebyshev.to_csv('oscilador_harmonica_quantico_por_iteracoes_chebyshev.csv', index=False) sqeuclidean.to_csv('oscilador_harmonica_quantico_por_iteracoes_sqeuclidean.csv', index=False) # In[77]: res_timers = [] for j in range(n): precisions = [] chebyshev = [] seuclidean = [] sqeuclidean = [] for res in res_numeric_time: precisions.append(res['precisions'][j]) chebyshev.append(res['chebyshev'][j]) seuclidean.append(res['seuclidean'][j]) sqeuclidean.append(res['sqeuclidean'][j]) timers = [60 * i for i in range(1,6)] for i, tim in enumerate(timers): res_timers.append({ 'state': j, 'time': tim, 'eigenvalue_precision': precisions[i], 'eigenstate_chebyshev': chebyshev[i], 'eigenstate_seuclidean': seuclidean[i], 'eigenstate_sqeuclidean': sqeuclidean[i], }) res_timers = pd.DataFrame(res_timers) for j in range(6): j_es = res_timers.loc[res_timers['state'] == j] plt.semilogy(j_es['time'], j_es['eigenstate_sqeuclidean'], label='state_%d' % j) plt.legend() plt.show() chebyshev = res_timers.pivot(index='time', columns='state', values='eigenstate_chebyshev').reset_index(level=0) sqeuclidean = res_timers.pivot(index='time', columns='state', values='eigenstate_sqeuclidean').reset_index(level=0) chebyshev.to_csv('oscilador_harmonica_quantico_por_tempo_chebyshev.csv', index=False) sqeuclidean.to_csv('oscilador_harmonica_quantico_por_tempo_sqeuclidean.csv', index=False)
[ 1, 529, 276, 1112, 420, 29958, 386, 29875, 351, 324, 4912, 7078, 29914, 1785, 16580, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 512, 29961, 29941, 29955, 5387, 13, 13, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 4560, 2272, 29889, 1028, 15238, 29889, 19244, 1053, 274, 5721, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 10117, 29636, 261, 13, 572, 29873, 29889, 2214, 9629, 1839, 4532, 29889, 1003, 2311, 2033, 353, 29871, 29896, 29946, 29892, 29871, 29947, 13, 13, 13, 29937, 512, 29961, 29955, 29953, 5387, 13, 13, 13, 29876, 353, 29871, 29953, 13, 5325, 353, 7442, 29889, 1359, 877, 690, 29918, 21574, 29918, 1524, 29889, 9302, 29920, 1495, 13, 690, 29918, 21574, 29918, 1524, 353, 2066, 1839, 2749, 29918, 29900, 2033, 13, 5325, 353, 7442, 29889, 1359, 877, 690, 29918, 21574, 29918, 2230, 29889, 9302, 29920, 1495, 13, 690, 29918, 21574, 29918, 2230, 353, 2066, 1839, 2749, 29918, 29900, 2033, 13, 13, 13, 29937, 512, 29961, 29896, 29900, 5387, 13, 13, 13, 29937, 363, 432, 297, 3464, 29898, 29876, 1125, 13, 29937, 268, 923, 29890, 952, 354, 29894, 353, 5159, 13, 29937, 268, 363, 620, 297, 620, 29918, 21574, 29918, 1524, 29901, 13, 29937, 308, 923, 29890, 952, 354, 29894, 29889, 4397, 29898, 690, 1839, 305, 774, 952, 354, 29894, 2033, 29961, 29926, 2314, 13, 29937, 268, 14770, 29889, 12846, 309, 6933, 4197, 29875, 334, 29871, 29896, 29872, 29945, 363, 474, 297, 3464, 29898, 29896, 29892, 29896, 29896, 29897, 1402, 923, 29890, 952, 354, 29894, 29892, 3858, 2433, 29907, 25842, 952, 354, 29894, 29918, 3859, 29918, 29995, 29881, 29915, 1273, 432, 29897, 13, 13, 1454, 432, 297, 3464, 29898, 29876, 1125, 13, 1678, 923, 29890, 952, 354, 29894, 353, 5159, 13, 1678, 363, 620, 297, 620, 29918, 21574, 29918, 2230, 29901, 13, 4706, 923, 29890, 952, 354, 29894, 29889, 4397, 29898, 690, 1839, 305, 774, 952, 354, 29894, 2033, 29961, 29926, 2314, 13, 1678, 14770, 29889, 12846, 309, 6933, 4197, 29953, 29900, 334, 474, 363, 474, 297, 3464, 29898, 29896, 29892, 29953, 29897, 1402, 923, 29890, 952, 354, 29894, 29892, 3858, 2433, 3044, 12932, 695, 333, 713, 29918, 3859, 29918, 29995, 29881, 29915, 1273, 432, 29897, 13, 572, 29873, 29889, 26172, 580, 13, 572, 29873, 29889, 4294, 580, 13, 13, 13, 29937, 512, 29961, 29955, 29941, 5387, 13, 13, 13, 690, 29918, 1524, 800, 353, 5159, 13, 1454, 432, 297, 3464, 29898, 29876, 1125, 13, 1678, 12132, 1080, 353, 5159, 13, 1678, 923, 29890, 952, 354, 29894, 353, 5159, 13, 1678, 409, 27511, 353, 5159, 13, 1678, 18074, 29872, 27511, 353, 5159, 13, 1678, 363, 620, 297, 620, 29918, 21574, 29918, 1524, 29901, 13, 4706, 12132, 1080, 29889, 4397, 29898, 690, 1839, 1457, 3476, 1080, 2033, 29961, 29926, 2314, 13, 4706, 923, 29890, 952, 354, 29894, 29889, 4397, 29898, 690, 1839, 305, 774, 952, 354, 29894, 2033, 29961, 29926, 2314, 13, 4706, 409, 27511, 29889, 4397, 29898, 690, 1839, 344, 27511, 2033, 29961, 29926, 2314, 13, 4706, 18074, 29872, 27511, 29889, 4397, 29898, 690, 1839, 3044, 29872, 27511, 2033, 29961, 29926, 2314, 13, 1678, 24372, 353, 518, 29875, 334, 29871, 29896, 29872, 29945, 363, 474, 297, 3464, 29898, 29896, 29892, 29896, 29896, 4638, 13, 1678, 363, 474, 29892, 372, 297, 26985, 29898, 1524, 800, 1125, 13, 4706, 620, 29918, 1524, 800, 29889, 4397, 3319, 13, 9651, 525, 3859, 2396, 432, 29892, 13, 9651, 525, 1524, 800, 2396, 372, 29892, 13, 9651, 525, 29872, 2101, 1767, 29918, 17990, 2459, 2396, 12132, 1080, 29961, 29875, 1402, 13, 9651, 525, 29872, 2101, 3859, 29918, 305, 774, 952, 354, 29894, 2396, 923, 29890, 952, 354, 29894, 29961, 29875, 1402, 13, 9651, 525, 29872, 2101, 3859, 29918, 344, 27511, 2396, 409, 27511, 29961, 29875, 1402, 13, 9651, 525, 29872, 2101, 3859, 29918, 3044, 29872, 27511, 2396, 18074, 29872, 27511, 29961, 29875, 1402, 13, 4706, 5615, 13, 690, 29918, 1524, 800, 353, 10518, 29889, 17271, 29898, 690, 29918, 1524, 800, 29897, 13, 1454, 432, 297, 3464, 29898, 29953, 1125, 13, 1678, 432, 29918, 267, 353, 620, 29918, 1524, 800, 29889, 2029, 29961, 690, 29918, 1524, 800, 1839, 3859, 2033, 1275, 432, 29962, 13, 1678, 14770, 29889, 12846, 309, 6933, 29898, 29926, 29918, 267, 1839, 1524, 800, 7464, 432, 29918, 267, 1839, 29872, 2101, 3859, 29918, 3044, 29872, 27511, 7464, 3858, 2433, 3859, 29918, 29995, 29881, 29915, 1273, 432, 29897, 13, 572, 29873, 29889, 26172, 580, 13, 572, 29873, 29889, 4294, 580, 13, 305, 774, 952, 354, 29894, 353, 620, 29918, 1524, 800, 29889, 29886, 11002, 29898, 2248, 2433, 1524, 800, 742, 4341, 2433, 3859, 742, 1819, 2433, 29872, 2101, 3859, 29918, 305, 774, 952, 354, 29894, 2824, 12071, 29918, 2248, 29898, 5563, 29922, 29900, 29897, 13, 3044, 29872, 27511, 353, 620, 29918, 1524, 800, 29889, 29886, 11002, 29898, 2248, 2433, 1524, 800, 742, 4341, 2433, 3859, 742, 1819, 2433, 29872, 2101, 3859, 29918, 3044, 29872, 27511, 2824, 12071, 29918, 2248, 29898, 5563, 29922, 29900, 29897, 13, 305, 774, 952, 354, 29894, 29889, 517, 29918, 7638, 877, 359, 5553, 3136, 29918, 23024, 26082, 29918, 12150, 1417, 29918, 1971, 29918, 1524, 11216, 267, 29918, 305, 774, 952, 354, 29894, 29889, 7638, 742, 2380, 29922, 8824, 29897, 13, 3044, 29872, 27511, 29889, 517, 29918, 7638, 877, 359, 5553, 3136, 29918, 23024, 26082, 29918, 12150, 1417, 29918, 1971, 29918, 1524, 11216, 267, 29918, 3044, 29872, 27511, 29889, 7638, 742, 2380, 29922, 8824, 29897, 13, 13, 13, 29937, 512, 29961, 29955, 29955, 5387, 13, 13, 13, 690, 29918, 9346, 414, 353, 5159, 13, 1454, 432, 297, 3464, 29898, 29876, 1125, 13, 1678, 12132, 1080, 353, 5159, 13, 1678, 923, 29890, 952, 354, 29894, 353, 5159, 13, 1678, 409, 27511, 353, 5159, 13, 1678, 18074, 29872, 27511, 353, 5159, 13, 1678, 363, 620, 297, 620, 29918, 21574, 29918, 2230, 29901, 13, 4706, 12132, 1080, 29889, 4397, 29898, 690, 1839, 1457, 3476, 1080, 2033, 29961, 29926, 2314, 13, 4706, 923, 29890, 952, 354, 29894, 29889, 4397, 29898, 690, 1839, 305, 774, 952, 354, 29894, 2033, 29961, 29926, 2314, 13, 4706, 409, 27511, 29889, 4397, 29898, 690, 1839, 344, 27511, 2033, 29961, 29926, 2314, 13, 4706, 18074, 29872, 27511, 29889, 4397, 29898, 690, 1839, 3044, 29872, 27511, 2033, 29961, 29926, 2314, 13, 1678, 5335, 414, 353, 518, 29953, 29900, 334, 474, 363, 474, 297, 3464, 29898, 29896, 29892, 29953, 4638, 13, 1678, 363, 474, 29892, 5335, 297, 26985, 29898, 9346, 414, 1125, 13, 4706, 620, 29918, 9346, 414, 29889, 4397, 3319, 13, 9651, 525, 3859, 2396, 432, 29892, 13, 9651, 525, 2230, 2396, 5335, 29892, 13, 9651, 525, 29872, 2101, 1767, 29918, 17990, 2459, 2396, 12132, 1080, 29961, 29875, 1402, 13, 9651, 525, 29872, 2101, 3859, 29918, 305, 774, 952, 354, 29894, 2396, 923, 29890, 952, 354, 29894, 29961, 29875, 1402, 13, 9651, 525, 29872, 2101, 3859, 29918, 344, 27511, 2396, 409, 27511, 29961, 29875, 1402, 13, 9651, 525, 29872, 2101, 3859, 29918, 3044, 29872, 27511, 2396, 18074, 29872, 27511, 29961, 29875, 1402, 13, 4706, 5615, 13, 690, 29918, 9346, 414, 353, 10518, 29889, 17271, 29898, 690, 29918, 9346, 414, 29897, 13, 1454, 432, 297, 3464, 29898, 29953, 1125, 13, 1678, 432, 29918, 267, 353, 620, 29918, 9346, 414, 29889, 2029, 29961, 690, 29918, 9346, 414, 1839, 3859, 2033, 1275, 432, 29962, 13, 1678, 14770, 29889, 12846, 309, 6933, 29898, 29926, 29918, 267, 1839, 2230, 7464, 432, 29918, 267, 1839, 29872, 2101, 3859, 29918, 3044, 29872, 27511, 7464, 3858, 2433, 3859, 29918, 29995, 29881, 29915, 1273, 432, 29897, 13, 572, 29873, 29889, 26172, 580, 13, 572, 29873, 29889, 4294, 580, 13, 305, 774, 952, 354, 29894, 353, 620, 29918, 9346, 414, 29889, 29886, 11002, 29898, 2248, 2433, 2230, 742, 4341, 2433, 3859, 742, 1819, 2433, 29872, 2101, 3859, 29918, 305, 774, 952, 354, 29894, 2824, 12071, 29918, 2248, 29898, 5563, 29922, 29900, 29897, 13, 3044, 29872, 27511, 353, 620, 29918, 9346, 414, 29889, 29886, 11002, 29898, 2248, 2433, 2230, 742, 4341, 2433, 3859, 742, 1819, 2433, 29872, 2101, 3859, 29918, 3044, 29872, 27511, 2824, 12071, 29918, 2248, 29898, 5563, 29922, 29900, 29897, 13, 305, 774, 952, 354, 29894, 29889, 517, 29918, 7638, 877, 359, 5553, 3136, 29918, 23024, 26082, 29918, 12150, 1417, 29918, 1971, 29918, 1356, 1129, 29918, 305, 774, 952, 354, 29894, 29889, 7638, 742, 2380, 29922, 8824, 29897, 13, 3044, 29872, 27511, 29889, 517, 29918, 7638, 877, 359, 5553, 3136, 29918, 23024, 26082, 29918, 12150, 1417, 29918, 1971, 29918, 1356, 1129, 29918, 3044, 29872, 27511, 29889, 7638, 742, 2380, 29922, 8824, 29897, 13, 13, 2 ]
common/responses.py
mungujn/pick-a-seat-backend-py
0
112306
<filename>common/responses.py<gh_stars>0 from flask import jsonify import common.logger as log def respondInternalServerError(message='Internal server error', error=None): '''Returns an object which flask will parse and transform into a 500 response''' log.info('Responding internal server error') log.info('*'.center(20, '-')) if error is not None: print(error) return (jsonify({ 'code': 500, 'message': message }), 500) def respondBadRequest(message='Invalid data sent'): '''Returns an object which flask will parse and transform into a 400 response''' log.info('Responding bad request') log.info('*'.center(20, '-')) return (jsonify({ 'code': 400, 'message': message }), 400) def respondUnauthorized(message): '''Returns an object which flask will parse and transform into a 401 response''' log.info('Responding unauthorized') log.info('*'.center(20, '-')) return (jsonify({ 'code': 401, 'message': message }), 401) def respondCreated(data): '''Returns an object which flask will parse and transform into a 201 response''' log.info('Responding created') log.info('*'.center(20, '-')) return (jsonify(data), 201) def respondOk(data): '''Returns an object which flask will parse and transform into a 200 response''' log.info('Responding OK') log.info('*'.center(20, '-')) return (jsonify({ 'code': 200, 'message': data }), 200) def respondWithData(data): '''Returns an object which flask will parse and transform into a 200 response . This response json will be of the form { 'code': 200, 'key_1': 'value_1', 'key_n': 'value_n' } ''' log.info('Responding with data') log.info('*'.center(20, '-')) t = {'code': 200} data = {**t, **data} return (jsonify(data), 200)
[ 1, 529, 9507, 29958, 9435, 29914, 26679, 267, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 29784, 1053, 4390, 1598, 13, 5215, 3619, 29889, 21707, 408, 1480, 13, 13, 13, 1753, 10049, 16491, 6004, 2392, 29898, 4906, 2433, 16491, 1923, 1059, 742, 1059, 29922, 8516, 1125, 13, 1678, 14550, 11609, 29879, 385, 1203, 607, 29784, 674, 6088, 322, 4327, 964, 263, 29871, 29945, 29900, 29900, 2933, 12008, 13, 1678, 1480, 29889, 3888, 877, 1666, 2818, 292, 7463, 1923, 1059, 1495, 13, 1678, 1480, 29889, 3888, 877, 29930, 4286, 5064, 29898, 29906, 29900, 29892, 17411, 8785, 13, 1678, 565, 1059, 338, 451, 6213, 29901, 13, 4706, 1596, 29898, 2704, 29897, 13, 1678, 736, 313, 3126, 1598, 3319, 13, 4706, 525, 401, 2396, 29871, 29945, 29900, 29900, 29892, 13, 4706, 525, 4906, 2396, 2643, 13, 1678, 500, 511, 29871, 29945, 29900, 29900, 29897, 13, 13, 13, 1753, 10049, 22050, 3089, 29898, 4906, 2433, 13919, 848, 2665, 29374, 13, 1678, 14550, 11609, 29879, 385, 1203, 607, 29784, 674, 6088, 322, 4327, 964, 263, 29871, 29946, 29900, 29900, 2933, 12008, 13, 1678, 1480, 29889, 3888, 877, 1666, 2818, 292, 4319, 2009, 1495, 13, 1678, 1480, 29889, 3888, 877, 29930, 4286, 5064, 29898, 29906, 29900, 29892, 17411, 8785, 13, 1678, 736, 313, 3126, 1598, 3319, 13, 4706, 525, 401, 2396, 29871, 29946, 29900, 29900, 29892, 13, 4706, 525, 4906, 2396, 2643, 13, 1678, 500, 511, 29871, 29946, 29900, 29900, 29897, 13, 13, 13, 1753, 10049, 29965, 1056, 329, 2015, 1891, 29898, 4906, 1125, 13, 1678, 14550, 11609, 29879, 385, 1203, 607, 29784, 674, 6088, 322, 4327, 964, 263, 29871, 29946, 29900, 29896, 2933, 12008, 13, 1678, 1480, 29889, 3888, 877, 1666, 2818, 292, 1185, 329, 2015, 1891, 1495, 13, 1678, 1480, 29889, 3888, 877, 29930, 4286, 5064, 29898, 29906, 29900, 29892, 17411, 8785, 13, 1678, 736, 313, 3126, 1598, 3319, 13, 4706, 525, 401, 2396, 29871, 29946, 29900, 29896, 29892, 13, 4706, 525, 4906, 2396, 2643, 13, 1678, 500, 511, 29871, 29946, 29900, 29896, 29897, 13, 13, 13, 1753, 10049, 20399, 29898, 1272, 1125, 13, 1678, 14550, 11609, 29879, 385, 1203, 607, 29784, 674, 6088, 322, 4327, 964, 263, 29871, 29906, 29900, 29896, 2933, 12008, 13, 1678, 1480, 29889, 3888, 877, 1666, 2818, 292, 2825, 1495, 13, 1678, 1480, 29889, 3888, 877, 29930, 4286, 5064, 29898, 29906, 29900, 29892, 17411, 8785, 13, 1678, 736, 313, 3126, 1598, 29898, 1272, 511, 29871, 29906, 29900, 29896, 29897, 13, 13, 13, 1753, 10049, 20434, 29898, 1272, 1125, 13, 1678, 14550, 11609, 29879, 385, 1203, 607, 29784, 674, 6088, 322, 4327, 964, 263, 29871, 29906, 29900, 29900, 2933, 12008, 13, 1678, 1480, 29889, 3888, 877, 1666, 2818, 292, 9280, 1495, 13, 1678, 1480, 29889, 3888, 877, 29930, 4286, 5064, 29898, 29906, 29900, 29892, 17411, 8785, 13, 1678, 736, 313, 3126, 1598, 3319, 13, 4706, 525, 401, 2396, 29871, 29906, 29900, 29900, 29892, 13, 4706, 525, 4906, 2396, 848, 13, 1678, 500, 511, 29871, 29906, 29900, 29900, 29897, 13, 13, 13, 1753, 10049, 3047, 1469, 29898, 1272, 1125, 13, 1678, 14550, 11609, 29879, 385, 1203, 607, 29784, 674, 6088, 322, 4327, 964, 263, 29871, 29906, 29900, 29900, 2933, 13, 1678, 869, 910, 2933, 4390, 674, 367, 310, 278, 883, 29871, 13, 1678, 426, 13, 4706, 525, 401, 2396, 29871, 29906, 29900, 29900, 29892, 13, 4706, 525, 1989, 29918, 29896, 2396, 525, 1767, 29918, 29896, 742, 13, 4706, 525, 1989, 29918, 29876, 2396, 525, 1767, 29918, 29876, 29915, 13, 1678, 500, 13, 1678, 14550, 13, 1678, 1480, 29889, 3888, 877, 1666, 2818, 292, 411, 848, 1495, 13, 1678, 1480, 29889, 3888, 877, 29930, 4286, 5064, 29898, 29906, 29900, 29892, 17411, 8785, 13, 1678, 260, 353, 11117, 401, 2396, 29871, 29906, 29900, 29900, 29913, 13, 1678, 848, 353, 426, 1068, 29873, 29892, 3579, 1272, 29913, 13, 1678, 736, 313, 3126, 1598, 29898, 1272, 511, 29871, 29906, 29900, 29900, 29897, 13, 2 ]
test_nn.py
eric93/sceneparsing
0
194985
import run import scipy.misc import matplotlib.pyplot as plt import numpy as np im = scipy.misc.imread("sampleData/images/ADE_val_00000003.jpg") ima = scipy.misc.imread("sampleData/annotations/ADE_val_00000003.png") imnn = run.run_nn(im) #imnn = run.run_nn_full(im) print np.sum(imnn == ima),"/",len(ima) * len(ima[0]) plt.subplot(2,1,1) run.display_annotation(imnn) plt.subplot(2,1,2) run.display_annotation(ima - 1) plt.show()
[ 1, 1053, 1065, 13, 5215, 4560, 2272, 29889, 29885, 10669, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 12655, 408, 7442, 13, 13, 326, 353, 4560, 2272, 29889, 29885, 10669, 29889, 326, 949, 703, 11249, 1469, 29914, 8346, 29914, 29909, 2287, 29918, 791, 29918, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29941, 29889, 6173, 1159, 13, 2946, 353, 4560, 2272, 29889, 29885, 10669, 29889, 326, 949, 703, 11249, 1469, 29914, 6735, 800, 29914, 29909, 2287, 29918, 791, 29918, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29941, 29889, 2732, 1159, 13, 13, 326, 15755, 353, 1065, 29889, 3389, 29918, 15755, 29898, 326, 29897, 13, 13, 29937, 326, 15755, 353, 1065, 29889, 3389, 29918, 15755, 29918, 8159, 29898, 326, 29897, 13, 13, 2158, 7442, 29889, 2083, 29898, 326, 15755, 1275, 527, 29874, 511, 23901, 613, 2435, 29898, 2946, 29897, 334, 7431, 29898, 2946, 29961, 29900, 2314, 13, 13, 572, 29873, 29889, 1491, 5317, 29898, 29906, 29892, 29896, 29892, 29896, 29897, 13, 3389, 29889, 4990, 29918, 18317, 29898, 326, 15755, 29897, 13, 13, 572, 29873, 29889, 1491, 5317, 29898, 29906, 29892, 29896, 29892, 29906, 29897, 13, 3389, 29889, 4990, 29918, 18317, 29898, 2946, 448, 29871, 29896, 29897, 13, 13, 572, 29873, 29889, 4294, 580, 13, 13, 2 ]
ShotgunORM/SgScriptFields.py
TheThirdFloor/python-shotgunorm
19
157126
<filename>ShotgunORM/SgScriptFields.py # Copyright (c) 2013, <NAME> - NFXPlugins # 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 NFXPlugins 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 NFXPLUGINS 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. # __all__ = [ 'SgScriptFieldCheckbox', 'SgScriptFieldColor', 'SgScriptFieldColor2', 'SgScriptFieldDate', 'SgScriptFieldDateTime', 'SgScriptFieldEntity', 'SgScriptFieldEntityMulti', 'SgScriptFieldFloat', 'SgScriptFieldInt', 'SgScriptFieldSelectionList', 'SgScriptFieldTagList', 'SgScriptFieldText' ] # Python imports import types # This module imports import ShotgunORM class SgScriptFieldCheckbox(ShotgunORM.SgScriptField): ''' Script engine checkbox field class. ''' def __eq__(self, value): if value != None: try: value = bool(value) except: raise TypeError('expected a bool, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if value != None: try: value = bool(value) except: raise TypeError('expected a bool, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } class SgScriptFieldColor(ShotgunORM.SgScriptField): ''' Script engine color field class. ''' def __eq__(self, value): if value != None: if isinstance(value, str): pass elif isinstance(value, (list, tuple)): if len(value) != 3: raise ValueError('list requires exactly 3 elements') value = '%s,%s,%s' % tuple(value) else: raise TypeError('expected a str or list of ints, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, types.NoneType): if isinstance(value, str): pass elif isinstance(value, (list, tuple)): if len(value) != 3: raise ValueError('list requires exactly 3 elements') value = '%s,%s,%s' % tuple(value) else: raise TypeError('expected a str or list of ints, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } class SgScriptFieldColor2(SgScriptFieldColor): ''' Script engine color2 field class. ''' pass class SgScriptFieldDate(ShotgunORM.SgScriptField): ''' Script engine date field class. ''' def __eq__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def __lt__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'less_than', 'neop': None } def __gt__(self, value): if not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'greater_than', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): if not all(isinstance(x, (datetime.datetime, str)) for x in value): raise TypeError('expected (datetime, str, None) in list') elif not isinstance(value, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def between(self, a, b): if not isinstance(a, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) if not isinstance(b, (datetime.datetime, str, types.NoneType)): raise TypeError('expected (datetime, str, None), got %s' % type(value).__name__) return { 'value': [a, b], 'op': 'between', 'neop': 'not_between' } def in_day(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_day', 'neop': None } def in_last(self, n, t): if not t in ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR']: raise ValueError('invalid time spec "%s", valid %s' % (t, ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR'])) try: n = int(n) except: raise TypeError('expected an int, got %s' % type(n).__name__) return { 'value': [n, t], 'op': 'in_last', 'neop': 'not_in_last' } def in_month(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_month', 'neop': None } def in_next(self, n, t): if not t in ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR']: raise ValueError('invalid time spec "%s", valid %s' % (t, ['HOUR','DAY', 'WEEK', 'MONTH', 'YEAR'])) try: n = int(n) except: raise TypeError('expected an int, got %s' % type(n).__name__) return { 'value': [n, t], 'op': 'in_next', 'neop': 'not_in_next' } def in_week(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_week', 'neop': None } def in_year(self, value): try: value = int(n) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in_calendar_year', 'neop': None } class SgScriptFieldDateTime(SgScriptFieldDate): ''' Script engine datetime field class. ''' pass class SgScriptFieldEntity(ShotgunORM.SgScriptField): ''' Script engine entity field class. ''' def _in(self, value): if isinstance(value, (list, tuple)): if not all(isinstance(x, (ShotgunORM.SgEntity, dict)) for x in value): raise TypeError('expected (ShotgunORM.SgEntity, dict, list in list') tmp = [] for i in value: try: tmp.append(i.toEntityFieldData()) except AttributeError: tmp.append(i) value = tmp elif isinstance(value, ShotgunORM.SgEntity): value = [value.toEntityFieldData()] elif isinstance(value, dict): value = [value] else: raise TypeError('expected (ShotgunORM.SgEntity, dict, list), got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def __eq__(self, value): if isinstance(value, (dict, types.NoneType)): pass elif isinstance(value, ShotgunORM.SgEntity): value = value.toEntityFieldData() else: raise TypeError('expected a (ShotgunORM.SgEntity, dict, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if isinstance(value, (dict, types.NoneType)): pass elif isinstance(value, ShotgunORM.SgEntity): value = value.toEntityFieldData() else: raise TypeError('expected a (ShotgunORM.SgEntity, dict, None), got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def name_contains(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'name_contains', 'neop': 'name_not_contains' } def name_is(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'name_is', 'neop': None } def type(self, value): if value != None: if isinstance(value, ShotgunORM.SgEntity): value = value.type elif not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'type_is', 'neop': 'type_is_not' } class SgScriptFieldEntityMulti(SgScriptFieldEntity): ''' Script engine entity-multi field class. ''' def name_is(self, value): raise RuntimeError('function not supported') class SgScriptFieldFloat(ShotgunORM.SgScriptField): ''' Script engine float field class. ''' def __eq__(self, value): if value != None: try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if value != None: try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def __lt__(self, value): try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'less_than', 'neop': None } def __gt__(self, value): try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'greater_than', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): tmp = [] try: for i in value: tmp.append(float(i)) except: raise TypeError('expected a list of floats, %s' % value) value = tmp else: try: value = float(value) except: raise TypeError('expected a float, got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def between(self, a, b): try: a = float(a) except: raise TypeError('expected a float, got %s' % type(a).__name__) try: b = float(b) except: raise TypeError('expected a float, got %s' % type(b).__name__) return { 'value': [a, b], 'op': 'between', 'neop': 'not_between' } class SgScriptFieldInt(ShotgunORM.SgScriptField): ''' Script engine int field class. ''' def __eq__(self, value): if value != None: try: value = int(value) except: raise TypeError('expected a int, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if value != None: try: value = int(value) except: raise TypeError('expected a int, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def __lt__(self, value): try: value = int(value) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'less_than', 'neop': None } def __gt__(self, value): try: value = int(value) except: raise TypeError('expected an int, got %s' % type(value).__name__) return { 'value': value, 'op': 'greater_than', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): tmp = [] try: for i in value: tmp.append(int(i)) except: raise TypeError('expected a list of int, %s' % value) value = tmp else: try: value = int(value) except: raise TypeError('expected a int, got %s' % type(value).__name__) return { 'value': value, 'op': 'in', 'neop': 'not_in' } def between(self, a, b): try: a = int(a) except: raise TypeError('expected a int, got %s' % type(a).__name__) try: b = int(b) except: raise TypeError('expected a int, got %s' % type(b).__name__) return { 'value': [a, b], 'op': 'between', 'neop': 'not_between' } class SgScriptFieldText(ShotgunORM.SgScriptField): ''' Script engine text field class. ''' def __eq__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def _in(self, value): if isinstance(value, (list, tuple)): if not all(isinstance(x, str) for x in value): raise TypeError('expected a list of strings') return { 'value': value, 'op': 'in', 'neop': 'not_in' } def contains(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'contains', 'neop': 'not_contains' } def endswith(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'ends_with', 'neop': None } def startswith(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'starts_with', 'neop': None } class SgScriptFieldSelectionList(SgScriptFieldText): ''' Script engine selection list field class. ''' pass class SgScriptFieldTagList(ShotgunORM.SgScriptField): ''' Script engine tag list field class. ''' def __eq__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is', 'neop': None } def __ne__(self, value): if not isinstance(value, (str, types.NoneType)): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'is_not', 'neop': None } def name_contains(self, value): if not isinstance(value, str): raise TypeError('expected a str, got %s' % type(value).__name__) return { 'value': value, 'op': 'name_contains', 'neop': 'name_not_contains' }
[ 1, 529, 9507, 29958, 2713, 327, 28798, 12054, 29914, 29903, 29887, 4081, 14256, 29889, 2272, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29941, 29892, 529, 5813, 29958, 448, 405, 26753, 3247, 8385, 13, 29937, 2178, 10462, 21676, 29889, 13, 29937, 13, 29937, 4367, 391, 3224, 322, 671, 297, 2752, 322, 7581, 7190, 29892, 411, 470, 1728, 13, 29937, 21733, 29892, 526, 21905, 4944, 393, 278, 1494, 5855, 526, 1539, 29901, 13, 29937, 268, 334, 4367, 391, 3224, 29879, 310, 2752, 775, 1818, 11551, 278, 2038, 3509, 1266, 13, 29937, 539, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 29889, 13, 29937, 268, 334, 4367, 391, 3224, 29879, 297, 7581, 883, 1818, 18532, 278, 2038, 3509, 1266, 13, 29937, 539, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 297, 278, 13, 29937, 539, 5106, 322, 29914, 272, 916, 17279, 4944, 411, 278, 4978, 29889, 13, 29937, 268, 334, 2448, 2121, 278, 1024, 310, 278, 405, 26753, 3247, 8385, 3643, 278, 2983, 310, 967, 17737, 29560, 13, 29937, 539, 1122, 367, 1304, 304, 1095, 272, 344, 470, 27391, 9316, 10723, 515, 445, 7047, 13, 29937, 539, 1728, 2702, 7536, 3971, 10751, 29889, 13, 29937, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6770, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 5300, 8707, 29911, 3960, 29933, 2692, 24125, 376, 3289, 8519, 29908, 5300, 13, 29937, 13764, 29979, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 29892, 2672, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 7495, 29892, 6093, 306, 3580, 5265, 3352, 13, 29937, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 5300, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 319, 1525, 13, 29937, 28657, 13875, 8890, 29928, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 405, 26753, 7390, 23338, 1177, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 13, 29937, 22471, 26282, 29892, 2672, 4571, 26282, 29892, 2672, 29907, 1367, 3919, 1964, 29892, 317, 4162, 8426, 1964, 29892, 8528, 29923, 3580, 29931, 19926, 29892, 6323, 8707, 1660, 13356, 3919, 25758, 21330, 1529, 1692, 29903, 13, 29937, 313, 1177, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 7495, 29892, 13756, 29907, 11499, 13780, 8079, 27092, 1254, 1806, 26027, 21947, 29949, 8452, 6323, 26996, 29963, 2965, 2890, 29936, 13, 29937, 11247, 1799, 8079, 501, 1660, 29892, 360, 8254, 29892, 6323, 13756, 29943, 1806, 29903, 29936, 6323, 350, 3308, 8895, 1799, 2672, 4945, 29934, 4897, 29911, 2725, 29897, 29832, 8851, 5348, 12766, 17171, 29928, 5300, 13, 29937, 6732, 13764, 29979, 6093, 18929, 8079, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 8707, 29911, 4717, 1783, 29892, 6850, 3960, 1783, 17705, 2882, 6227, 11937, 29892, 6323, 323, 8476, 13, 29937, 313, 1177, 6154, 15789, 4214, 405, 11787, 5265, 24647, 4741, 6323, 438, 29911, 4448, 22119, 1660, 29897, 9033, 3235, 4214, 2672, 13764, 29979, 399, 29909, 29979, 19474, 8079, 6093, 501, 1660, 8079, 3446, 3235, 13, 29937, 7791, 7818, 12982, 1525, 29892, 382, 29963, 1430, 10762, 11033, 18118, 1660, 29928, 8079, 6093, 21521, 1799, 8979, 6227, 11937, 8079, 20134, 3210, 21330, 1529, 1692, 29889, 13, 29937, 13, 13, 1649, 497, 1649, 353, 518, 13, 29871, 525, 29903, 29887, 4081, 3073, 5596, 1884, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 3306, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 3306, 29906, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 2539, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 11384, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 6691, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 6691, 15329, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 11031, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 2928, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 15097, 1293, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 8176, 1293, 742, 13, 29871, 525, 29903, 29887, 4081, 3073, 1626, 29915, 13, 29962, 13, 13, 29937, 5132, 24802, 13, 5215, 4072, 13, 13, 29937, 910, 3883, 24802, 13, 5215, 1383, 327, 28798, 12054, 13, 13, 1990, 317, 29887, 4081, 3073, 5596, 1884, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 12527, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 6120, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 6120, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 6120, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 6120, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 1990, 317, 29887, 4081, 3073, 3306, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 2927, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 565, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 4706, 1209, 13, 418, 25342, 338, 8758, 29898, 1767, 29892, 313, 1761, 29892, 18761, 22164, 13, 4706, 565, 7431, 29898, 1767, 29897, 2804, 29871, 29941, 29901, 13, 3986, 12020, 7865, 2392, 877, 1761, 6858, 3721, 29871, 29941, 3161, 1495, 13, 13, 4706, 995, 353, 14210, 29879, 24163, 29879, 24163, 29879, 29915, 1273, 18761, 29898, 1767, 29897, 13, 418, 1683, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 851, 470, 1051, 310, 938, 29879, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 4072, 29889, 8516, 1542, 1125, 13, 418, 565, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 4706, 1209, 13, 418, 25342, 338, 8758, 29898, 1767, 29892, 313, 1761, 29892, 18761, 22164, 13, 4706, 565, 7431, 29898, 1767, 29897, 2804, 29871, 29941, 29901, 13, 3986, 12020, 7865, 2392, 877, 1761, 6858, 3721, 29871, 29941, 3161, 1495, 13, 13, 4706, 995, 353, 14210, 29879, 24163, 29879, 24163, 29879, 29915, 1273, 18761, 29898, 1767, 29897, 13, 418, 1683, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 851, 470, 1051, 310, 938, 29879, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 1990, 317, 29887, 4081, 3073, 3306, 29906, 29898, 29903, 29887, 4081, 3073, 3306, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 2927, 29906, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 1209, 13, 13, 1990, 317, 29887, 4081, 3073, 2539, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 2635, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 12673, 29889, 12673, 29892, 851, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 12673, 29889, 12673, 29892, 851, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 1896, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 12673, 29889, 12673, 29892, 851, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 2222, 29918, 27603, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 4141, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 12673, 29889, 12673, 29892, 851, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 7979, 1008, 29918, 27603, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 903, 262, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 1761, 29892, 18761, 22164, 13, 418, 565, 451, 599, 29898, 275, 8758, 29898, 29916, 29892, 313, 12673, 29889, 12673, 29892, 851, 876, 363, 921, 297, 995, 1125, 13, 4706, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 29897, 297, 1051, 1495, 13, 1678, 25342, 451, 338, 8758, 29898, 1767, 29892, 313, 12673, 29889, 12673, 29892, 851, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 262, 29915, 13, 1678, 500, 13, 13, 29871, 822, 1546, 29898, 1311, 29892, 263, 29892, 289, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 29874, 29892, 313, 12673, 29889, 12673, 29892, 851, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 565, 451, 338, 8758, 29898, 29890, 29892, 313, 12673, 29889, 12673, 29892, 851, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 313, 12673, 29892, 851, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 518, 29874, 29892, 289, 1402, 13, 418, 525, 459, 2396, 525, 14811, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 14811, 29915, 13, 1678, 500, 13, 13, 29871, 822, 297, 29918, 3250, 29898, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 938, 29898, 29876, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 29918, 23392, 29918, 3250, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 297, 29918, 4230, 29898, 1311, 29892, 302, 29892, 260, 1125, 13, 1678, 565, 451, 260, 297, 6024, 8187, 4574, 3788, 28658, 742, 525, 8851, 29923, 29968, 742, 525, 22877, 4690, 742, 525, 29979, 26441, 2033, 29901, 13, 418, 12020, 7865, 2392, 877, 20965, 931, 1580, 11860, 29879, 613, 2854, 1273, 29879, 29915, 1273, 313, 29873, 29892, 6024, 8187, 4574, 3788, 28658, 742, 525, 8851, 29923, 29968, 742, 525, 22877, 4690, 742, 525, 29979, 26441, 25901, 13, 13, 1678, 1018, 29901, 13, 418, 302, 353, 938, 29898, 29876, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 29876, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 518, 29876, 29892, 260, 1402, 13, 418, 525, 459, 2396, 525, 262, 29918, 4230, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 262, 29918, 4230, 29915, 13, 1678, 500, 13, 13, 29871, 822, 297, 29918, 10874, 29898, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 938, 29898, 29876, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 29918, 23392, 29918, 10874, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 297, 29918, 4622, 29898, 1311, 29892, 302, 29892, 260, 1125, 13, 1678, 565, 451, 260, 297, 6024, 8187, 4574, 3788, 28658, 742, 525, 8851, 29923, 29968, 742, 525, 22877, 4690, 742, 525, 29979, 26441, 2033, 29901, 13, 418, 12020, 7865, 2392, 877, 20965, 931, 1580, 11860, 29879, 613, 2854, 1273, 29879, 29915, 1273, 313, 29873, 29892, 6024, 8187, 4574, 3788, 28658, 742, 525, 8851, 29923, 29968, 742, 525, 22877, 4690, 742, 525, 29979, 26441, 25901, 13, 13, 1678, 1018, 29901, 13, 418, 302, 353, 938, 29898, 29876, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 29876, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 518, 29876, 29892, 260, 1402, 13, 418, 525, 459, 2396, 525, 262, 29918, 4622, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 262, 29918, 4622, 29915, 13, 1678, 500, 13, 13, 29871, 822, 297, 29918, 18448, 29898, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 938, 29898, 29876, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 29918, 23392, 29918, 18448, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 297, 29918, 6360, 29898, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 938, 29898, 29876, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 29918, 23392, 29918, 6360, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 1990, 317, 29887, 4081, 3073, 11384, 29898, 29903, 29887, 4081, 3073, 2539, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 12865, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 1209, 13, 13, 1990, 317, 29887, 4081, 3073, 6691, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 7855, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 903, 262, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 1761, 29892, 18761, 22164, 13, 418, 565, 451, 599, 29898, 275, 8758, 29898, 29916, 29892, 313, 2713, 327, 28798, 12054, 29889, 29903, 29887, 6691, 29892, 9657, 876, 363, 921, 297, 995, 1125, 13, 4706, 12020, 20948, 877, 9684, 313, 2713, 327, 28798, 12054, 29889, 29903, 29887, 6691, 29892, 9657, 29892, 1051, 297, 1051, 1495, 13, 13, 418, 13128, 353, 5159, 13, 13, 418, 363, 474, 297, 995, 29901, 13, 4706, 1018, 29901, 13, 3986, 13128, 29889, 4397, 29898, 29875, 29889, 517, 6691, 3073, 1469, 3101, 13, 4706, 5174, 23833, 2392, 29901, 13, 3986, 13128, 29889, 4397, 29898, 29875, 29897, 13, 13, 418, 995, 353, 13128, 13, 1678, 25342, 338, 8758, 29898, 1767, 29892, 1383, 327, 28798, 12054, 29889, 29903, 29887, 6691, 1125, 13, 418, 995, 353, 518, 1767, 29889, 517, 6691, 3073, 1469, 580, 29962, 13, 1678, 25342, 338, 8758, 29898, 1767, 29892, 9657, 1125, 13, 418, 995, 353, 518, 1767, 29962, 13, 1678, 1683, 29901, 13, 418, 12020, 20948, 877, 9684, 313, 2713, 327, 28798, 12054, 29889, 29903, 29887, 6691, 29892, 9657, 29892, 1051, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 262, 29915, 13, 1678, 500, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 8977, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 1209, 13, 1678, 25342, 338, 8758, 29898, 1767, 29892, 1383, 327, 28798, 12054, 29889, 29903, 29887, 6691, 1125, 13, 418, 995, 353, 995, 29889, 517, 6691, 3073, 1469, 580, 13, 1678, 1683, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 313, 2713, 327, 28798, 12054, 29889, 29903, 29887, 6691, 29892, 9657, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 8977, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 1209, 13, 1678, 25342, 338, 8758, 29898, 1767, 29892, 1383, 327, 28798, 12054, 29889, 29903, 29887, 6691, 1125, 13, 418, 995, 353, 995, 29889, 517, 6691, 3073, 1469, 580, 13, 1678, 1683, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 313, 2713, 327, 28798, 12054, 29889, 29903, 29887, 6691, 29892, 9657, 29892, 6213, 511, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 1024, 29918, 11516, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 978, 29918, 11516, 742, 13, 418, 525, 484, 459, 2396, 525, 978, 29918, 1333, 29918, 11516, 29915, 13, 1678, 500, 13, 13, 29871, 822, 1024, 29918, 275, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 978, 29918, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 1134, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 565, 338, 8758, 29898, 1767, 29892, 1383, 327, 28798, 12054, 29889, 29903, 29887, 6691, 1125, 13, 4706, 995, 353, 995, 29889, 1853, 13, 418, 25342, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 4706, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 1853, 29918, 275, 742, 13, 418, 525, 484, 459, 2396, 525, 1853, 29918, 275, 29918, 1333, 29915, 13, 1678, 500, 13, 13, 1990, 317, 29887, 4081, 3073, 6691, 15329, 29898, 29903, 29887, 4081, 3073, 6691, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 7855, 29899, 9910, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 1024, 29918, 275, 29898, 1311, 29892, 995, 1125, 13, 1678, 12020, 24875, 2392, 877, 2220, 451, 6969, 1495, 13, 13, 1990, 317, 29887, 4081, 3073, 11031, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 5785, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 5785, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 5785, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 5785, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 5785, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 1896, 12035, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 5785, 29898, 1767, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 5785, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 2222, 29918, 27603, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 4141, 12035, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 5785, 29898, 1767, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 5785, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 7979, 1008, 29918, 27603, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 903, 262, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 1761, 29892, 18761, 22164, 13, 418, 13128, 353, 5159, 13, 13, 418, 1018, 29901, 13, 4706, 363, 474, 297, 995, 29901, 13, 3986, 13128, 29889, 4397, 29898, 7411, 29898, 29875, 876, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 1051, 310, 5685, 1446, 29892, 1273, 29879, 29915, 1273, 995, 29897, 13, 13, 418, 995, 353, 13128, 13, 1678, 1683, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 5785, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 5785, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 262, 29915, 13, 1678, 500, 13, 13, 29871, 822, 1546, 29898, 1311, 29892, 263, 29892, 289, 1125, 13, 1678, 1018, 29901, 13, 418, 263, 353, 5785, 29898, 29874, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 5785, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 29874, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 1018, 29901, 13, 418, 289, 353, 5785, 29898, 29890, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 5785, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 29890, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 518, 29874, 29892, 289, 1402, 13, 418, 525, 459, 2396, 525, 14811, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 14811, 29915, 13, 1678, 500, 13, 13, 1990, 317, 29887, 4081, 3073, 2928, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 938, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 938, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 995, 2804, 6213, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 938, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 1896, 12035, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 938, 29898, 1767, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 2222, 29918, 27603, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 4141, 12035, 1311, 29892, 995, 1125, 13, 1678, 1018, 29901, 13, 418, 995, 353, 938, 29898, 1767, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 385, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 7979, 1008, 29918, 27603, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 903, 262, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 1761, 29892, 18761, 22164, 13, 418, 13128, 353, 5159, 13, 13, 418, 1018, 29901, 13, 4706, 363, 474, 297, 995, 29901, 13, 3986, 13128, 29889, 4397, 29898, 524, 29898, 29875, 876, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 1051, 310, 938, 29892, 1273, 29879, 29915, 1273, 995, 29897, 13, 13, 418, 995, 353, 13128, 13, 1678, 1683, 29901, 13, 418, 1018, 29901, 13, 4706, 995, 353, 938, 29898, 1767, 29897, 13, 418, 5174, 29901, 13, 4706, 12020, 20948, 877, 9684, 263, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 262, 29915, 13, 1678, 500, 13, 13, 29871, 822, 1546, 29898, 1311, 29892, 263, 29892, 289, 1125, 13, 1678, 1018, 29901, 13, 418, 263, 353, 938, 29898, 29874, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 29874, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 1018, 29901, 13, 418, 289, 353, 938, 29898, 29890, 29897, 13, 1678, 5174, 29901, 13, 418, 12020, 20948, 877, 9684, 263, 938, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 29890, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 518, 29874, 29892, 289, 1402, 13, 418, 525, 459, 2396, 525, 14811, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 14811, 29915, 13, 1678, 500, 13, 13, 1990, 317, 29887, 4081, 3073, 1626, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 1426, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 710, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 710, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 903, 262, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 338, 8758, 29898, 1767, 29892, 313, 1761, 29892, 18761, 22164, 13, 418, 565, 451, 599, 29898, 275, 8758, 29898, 29916, 29892, 851, 29897, 363, 921, 297, 995, 1125, 13, 4706, 12020, 20948, 877, 9684, 263, 1051, 310, 6031, 1495, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 262, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 262, 29915, 13, 1678, 500, 13, 13, 29871, 822, 3743, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 11516, 742, 13, 418, 525, 484, 459, 2396, 525, 1333, 29918, 11516, 29915, 13, 1678, 500, 13, 13, 29871, 822, 10614, 2541, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 1975, 29918, 2541, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 8665, 2541, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 27382, 29918, 2541, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 1990, 317, 29887, 4081, 3073, 15097, 1293, 29898, 29903, 29887, 4081, 3073, 1626, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 9262, 1051, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 1209, 13, 13, 1990, 317, 29887, 4081, 3073, 8176, 1293, 29898, 2713, 327, 28798, 12054, 29889, 29903, 29887, 4081, 3073, 1125, 13, 29871, 14550, 13, 29871, 14415, 6012, 4055, 1051, 1746, 770, 29889, 13, 29871, 14550, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 710, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 4770, 484, 12035, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 313, 710, 29892, 4072, 29889, 8516, 1542, 22164, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 275, 29918, 1333, 742, 13, 418, 525, 484, 459, 2396, 6213, 13, 1678, 500, 13, 13, 29871, 822, 1024, 29918, 11516, 29898, 1311, 29892, 995, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 1767, 29892, 851, 1125, 13, 418, 12020, 20948, 877, 9684, 263, 851, 29892, 2355, 1273, 29879, 29915, 1273, 1134, 29898, 1767, 467, 1649, 978, 1649, 29897, 13, 13, 1678, 736, 426, 13, 418, 525, 1767, 2396, 995, 29892, 13, 418, 525, 459, 2396, 525, 978, 29918, 11516, 742, 13, 418, 525, 484, 459, 2396, 525, 978, 29918, 1333, 29918, 11516, 29915, 13, 1678, 500, 13, 2 ]
PONG_GAME.py
espr3so/Python
0
43687
<filename>PONG_GAME.py<gh_stars>0 # Pong Game in Codeskulptor import simpleguitk as simplegui import random WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 PAD_WIDTH = 8 PAD_HEIGHT = 80 HALF_PAD_WIDTH = PAD_WIDTH / 2 HALF_PAD_HEIGHT = PAD_HEIGHT / 2 LEFT = False RIGHT = True score1 = 0 score2 = 0 paddle1_pos = 0 paddle2_pos = 0 paddle1_vel = 0 paddle2_vel = 0 def spawn_ball(direction): global ball_pos, ball_vel # these are vectors stored as lists ball_pos = [WIDTH/2 , HEIGHT/2] if direction == RIGHT: ball_vel = [ random.randrange(120, 240)/60, random.randrange(60, 180)/60] elif direction == LEFT: ball_vel = [ -random.randrange(120, 240)/60, random.randrange(60, 180)/60] def reset(): global ball_pos, score1, score2 ball_pos = [WIDTH/2 , HEIGHT/2] score1 = 0 score2 = 0 def new_game(): global paddle1_pos, paddle2_pos, paddle1_vel, paddle2_vel global score1, score2 reset() spawn_ball(RIGHT) def draw(canvas): global paddle1_pos, paddle2_pos, ball_pos, ball_vel,paddle1_vel, paddle2_vel, BALL_RADIUS global score1, score2 canvas.draw_line([WIDTH / 2, 0],[WIDTH / 2, HEIGHT], 1, "White") canvas.draw_line([PAD_WIDTH, 0],[PAD_WIDTH, HEIGHT], 1, "White") canvas.draw_line([WIDTH - PAD_WIDTH, 0],[WIDTH - PAD_WIDTH, HEIGHT], 1, "White") ball_pos[0] += ball_vel[0] ball_pos[1] += ball_vel[1] if ball_pos[0] <= BALL_RADIUS + PAD_WIDTH or ball_pos[0] >= WIDTH - BALL_RADIUS - PAD_WIDTH: ball_vel[0] = -ball_vel[0] elif ball_pos[1] <= BALL_RADIUS + PAD_WIDTH or ball_pos[1] >= HEIGHT - BALL_RADIUS - PAD_WIDTH: ball_vel[1] = -ball_vel[1] canvas.draw_circle( ball_pos ,BALL_RADIUS , 1, "White","White") paddle1_pos += paddle1_vel paddle2_pos += paddle2_vel if paddle1_pos <= -HEIGHT/2 + PAD_HEIGHT/2 : paddle1_pos = -HEIGHT/2 + PAD_HEIGHT/2 elif paddle1_pos >= HEIGHT/2 -PAD_HEIGHT/2: paddle1_pos = HEIGHT/2 - PAD_HEIGHT/2 if paddle2_pos <= -HEIGHT/2 + PAD_HEIGHT/2 : paddle2_pos = -HEIGHT/2 + PAD_HEIGHT/2 elif paddle2_pos >= HEIGHT/2 -PAD_HEIGHT/2: paddle2_pos = HEIGHT/2 - PAD_HEIGHT/2 canvas.draw_line([PAD_WIDTH/2, paddle1_pos + HEIGHT/2 - PAD_HEIGHT/2] ,[ PAD_WIDTH/2, paddle1_pos + PAD_HEIGHT/2 + HEIGHT/2] , 10, "White") canvas.draw_line([WIDTH - PAD_WIDTH/2, paddle2_pos + HEIGHT/2 - PAD_HEIGHT/2] ,[WIDTH - PAD_WIDTH/2, PAD_HEIGHT/2 + paddle2_pos + HEIGHT/2] , 10, "White") if (ball_pos[1] <= (paddle1_pos + HEIGHT/2 - PAD_HEIGHT/2) or ball_pos[1] >= (paddle1_pos + PAD_HEIGHT/2 + HEIGHT/2)) and ball_pos[0] == (PAD_WIDTH + BALL_RADIUS): score2 += 1 else : pass if (ball_pos[1] <= (paddle2_pos + HEIGHT/2 - PAD_HEIGHT/2) or ball_pos[1] >= (paddle2_pos + PAD_HEIGHT/2 + HEIGHT/2)) and ball_pos[0] == (WIDTH - PAD_WIDTH - BALL_RADIUS): score1 += 1 else: pass canvas.draw_text( str(score1) , (250,30) , 40 , "White") canvas.draw_text( str(score2) , (330,30) , 40 , "White") def keydown(key): global paddle1_vel, paddle2_vel if key == simplegui.KEY_MAP["down"]: paddle1_vel = 2 elif key == simplegui.KEY_MAP["up"]: paddle1_vel = -2 if key == simplegui.KEY_MAP["w"]: paddle2_vel = -2 elif key == simplegui.KEY_MAP["s"]: paddle2_vel = 2 def keyup(key): global paddle1_vel, paddle2_vel if key == simplegui.KEY_MAP["down"] or key == simplegui.KEY_MAP["up"]: paddle1_vel = 0 if key == simplegui.KEY_MAP["w"] or key == simplegui.KEY_MAP["s"]: paddle2_vel = 0 frame = simplegui.create_frame("Pong", WIDTH, HEIGHT) frame.set_draw_handler(draw) frame.set_keydown_handler(keydown) frame.set_keyup_handler(keyup) frame.add_button("Restart",reset) new_game() print() frame.start()
[ 1, 529, 9507, 29958, 29925, 20614, 29918, 12739, 2303, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 349, 549, 8448, 297, 315, 2631, 29895, 14185, 272, 13, 13, 5215, 2560, 2543, 277, 29895, 408, 2560, 23569, 13, 5215, 4036, 13, 13, 22574, 353, 29871, 29953, 29900, 29900, 13, 9606, 22530, 353, 29871, 29946, 29900, 29900, 4706, 13, 29933, 9818, 29918, 29934, 3035, 29902, 3308, 353, 29871, 29906, 29900, 13, 29925, 3035, 29918, 22574, 353, 29871, 29947, 13, 29925, 3035, 29918, 9606, 22530, 353, 29871, 29947, 29900, 13, 29950, 1964, 29943, 29918, 29925, 3035, 29918, 22574, 353, 349, 3035, 29918, 22574, 847, 29871, 29906, 13, 29950, 1964, 29943, 29918, 29925, 3035, 29918, 9606, 22530, 353, 349, 3035, 29918, 9606, 22530, 847, 29871, 29906, 13, 28024, 353, 7700, 13, 22789, 3912, 353, 5852, 13, 13628, 29896, 353, 29871, 29900, 13, 13628, 29906, 353, 29871, 29900, 13, 29886, 22352, 29896, 29918, 1066, 353, 29871, 29900, 13, 29886, 22352, 29906, 29918, 1066, 353, 29871, 29900, 13, 29886, 22352, 29896, 29918, 955, 353, 29871, 29900, 13, 29886, 22352, 29906, 29918, 955, 353, 29871, 29900, 13, 13, 1753, 29178, 29918, 2135, 29898, 20845, 1125, 13, 1678, 5534, 8287, 29918, 1066, 29892, 8287, 29918, 955, 396, 1438, 526, 12047, 6087, 408, 8857, 13, 1678, 8287, 29918, 1066, 353, 518, 22574, 29914, 29906, 1919, 17714, 22530, 29914, 29906, 29962, 13, 1678, 565, 5305, 1275, 390, 22530, 29901, 13, 4706, 8287, 29918, 955, 353, 518, 4036, 29889, 9502, 3881, 29898, 29896, 29906, 29900, 29892, 29871, 29906, 29946, 29900, 6802, 29953, 29900, 29892, 4036, 29889, 9502, 3881, 29898, 29953, 29900, 29892, 29871, 29896, 29947, 29900, 6802, 29953, 29900, 29962, 13, 1678, 25342, 5305, 1275, 19246, 29901, 13, 4706, 8287, 29918, 955, 353, 518, 448, 8172, 29889, 9502, 3881, 29898, 29896, 29906, 29900, 29892, 29871, 29906, 29946, 29900, 6802, 29953, 29900, 29892, 4036, 29889, 9502, 3881, 29898, 29953, 29900, 29892, 29871, 29896, 29947, 29900, 6802, 29953, 29900, 29962, 13, 13, 1753, 10092, 7295, 13, 1678, 5534, 8287, 29918, 1066, 29892, 8158, 29896, 29892, 8158, 29906, 13, 1678, 8287, 29918, 1066, 353, 518, 22574, 29914, 29906, 1919, 17714, 22530, 29914, 29906, 29962, 13, 1678, 8158, 29896, 353, 29871, 29900, 13, 1678, 8158, 29906, 353, 29871, 29900, 13, 308, 13, 1753, 716, 29918, 11802, 7295, 13, 1678, 5534, 282, 22352, 29896, 29918, 1066, 29892, 282, 22352, 29906, 29918, 1066, 29892, 282, 22352, 29896, 29918, 955, 29892, 282, 22352, 29906, 29918, 955, 259, 13, 1678, 5534, 8158, 29896, 29892, 8158, 29906, 29871, 13, 1678, 10092, 580, 13, 1678, 29178, 29918, 2135, 29898, 22789, 3912, 29897, 13, 13, 1753, 4216, 29898, 15257, 1125, 13, 1678, 5534, 282, 22352, 29896, 29918, 1066, 29892, 282, 22352, 29906, 29918, 1066, 29892, 8287, 29918, 1066, 29892, 8287, 29918, 955, 29892, 29886, 22352, 29896, 29918, 955, 29892, 282, 22352, 29906, 29918, 955, 29892, 350, 9818, 29918, 29934, 3035, 29902, 3308, 13, 1678, 5534, 8158, 29896, 29892, 8158, 29906, 13, 268, 13, 1678, 10508, 29889, 4012, 29918, 1220, 4197, 22574, 847, 29871, 29906, 29892, 29871, 29900, 16272, 22574, 847, 29871, 29906, 29892, 17714, 22530, 1402, 29871, 29896, 29892, 376, 21823, 1159, 13, 1678, 10508, 29889, 4012, 29918, 1220, 4197, 29925, 3035, 29918, 22574, 29892, 29871, 29900, 16272, 29925, 3035, 29918, 22574, 29892, 17714, 22530, 1402, 29871, 29896, 29892, 376, 21823, 1159, 13, 1678, 10508, 29889, 4012, 29918, 1220, 4197, 22574, 448, 349, 3035, 29918, 22574, 29892, 29871, 29900, 16272, 22574, 448, 349, 3035, 29918, 22574, 29892, 17714, 22530, 1402, 29871, 29896, 29892, 376, 21823, 1159, 13, 308, 13, 1678, 8287, 29918, 1066, 29961, 29900, 29962, 4619, 8287, 29918, 955, 29961, 29900, 29962, 13, 1678, 8287, 29918, 1066, 29961, 29896, 29962, 4619, 8287, 29918, 955, 29961, 29896, 29962, 13, 268, 13, 1678, 565, 8287, 29918, 1066, 29961, 29900, 29962, 5277, 350, 9818, 29918, 29934, 3035, 29902, 3308, 718, 349, 3035, 29918, 22574, 470, 8287, 29918, 1066, 29961, 29900, 29962, 6736, 399, 1367, 4690, 448, 350, 9818, 29918, 29934, 3035, 29902, 3308, 448, 349, 3035, 29918, 22574, 29901, 13, 4706, 8287, 29918, 955, 29961, 29900, 29962, 353, 448, 2135, 29918, 955, 29961, 29900, 29962, 13, 1678, 25342, 8287, 29918, 1066, 29961, 29896, 29962, 5277, 350, 9818, 29918, 29934, 3035, 29902, 3308, 718, 349, 3035, 29918, 22574, 470, 8287, 29918, 1066, 29961, 29896, 29962, 6736, 17714, 22530, 448, 350, 9818, 29918, 29934, 3035, 29902, 3308, 448, 349, 3035, 29918, 22574, 29901, 13, 4706, 8287, 29918, 955, 29961, 29896, 29962, 353, 448, 2135, 29918, 955, 29961, 29896, 29962, 13, 632, 13, 1678, 10508, 29889, 4012, 29918, 16622, 29898, 8287, 29918, 1066, 1919, 29933, 9818, 29918, 29934, 3035, 29902, 3308, 1919, 29871, 29896, 29892, 376, 21823, 3284, 21823, 1159, 13, 268, 13, 1678, 282, 22352, 29896, 29918, 1066, 4619, 282, 22352, 29896, 29918, 955, 13, 1678, 282, 22352, 29906, 29918, 1066, 4619, 282, 22352, 29906, 29918, 955, 13, 268, 13, 1678, 565, 282, 22352, 29896, 29918, 1066, 5277, 448, 9606, 22530, 29914, 29906, 718, 349, 3035, 29918, 9606, 22530, 29914, 29906, 584, 13, 4706, 282, 22352, 29896, 29918, 1066, 353, 448, 9606, 22530, 29914, 29906, 718, 349, 3035, 29918, 9606, 22530, 29914, 29906, 29871, 13, 1678, 25342, 282, 22352, 29896, 29918, 1066, 6736, 17714, 22530, 29914, 29906, 448, 29925, 3035, 29918, 9606, 22530, 29914, 29906, 29901, 13, 4706, 282, 22352, 29896, 29918, 1066, 353, 17714, 22530, 29914, 29906, 448, 349, 3035, 29918, 9606, 22530, 29914, 29906, 13, 308, 13, 1678, 565, 282, 22352, 29906, 29918, 1066, 5277, 448, 9606, 22530, 29914, 29906, 718, 349, 3035, 29918, 9606, 22530, 29914, 29906, 584, 13, 4706, 282, 22352, 29906, 29918, 1066, 353, 448, 9606, 22530, 29914, 29906, 718, 349, 3035, 29918, 9606, 22530, 29914, 29906, 29871, 13, 1678, 25342, 282, 22352, 29906, 29918, 1066, 6736, 17714, 22530, 29914, 29906, 448, 29925, 3035, 29918, 9606, 22530, 29914, 29906, 29901, 13, 4706, 282, 22352, 29906, 29918, 1066, 353, 17714, 22530, 29914, 29906, 448, 349, 3035, 29918, 9606, 22530, 29914, 29906, 13, 268, 13, 1678, 10508, 29889, 4012, 29918, 1220, 4197, 29925, 3035, 29918, 22574, 29914, 29906, 29892, 282, 22352, 29896, 29918, 1066, 718, 17714, 22530, 29914, 29906, 448, 349, 3035, 29918, 9606, 22530, 29914, 29906, 29962, 1919, 29961, 349, 3035, 29918, 22574, 29914, 29906, 29892, 282, 22352, 29896, 29918, 1066, 718, 349, 3035, 29918, 9606, 22530, 29914, 29906, 718, 17714, 22530, 29914, 29906, 29962, 1919, 29871, 29896, 29900, 29892, 376, 21823, 1159, 13, 1678, 10508, 29889, 4012, 29918, 1220, 4197, 22574, 448, 349, 3035, 29918, 22574, 29914, 29906, 29892, 282, 22352, 29906, 29918, 1066, 718, 17714, 22530, 29914, 29906, 448, 349, 3035, 29918, 9606, 22530, 29914, 29906, 29962, 1919, 29961, 22574, 448, 349, 3035, 29918, 22574, 29914, 29906, 29892, 349, 3035, 29918, 9606, 22530, 29914, 29906, 718, 282, 22352, 29906, 29918, 1066, 718, 17714, 22530, 29914, 29906, 29962, 1919, 29871, 29896, 29900, 29892, 376, 21823, 1159, 13, 268, 13, 1678, 565, 313, 2135, 29918, 1066, 29961, 29896, 29962, 5277, 313, 29886, 22352, 29896, 29918, 1066, 718, 17714, 22530, 29914, 29906, 448, 349, 3035, 29918, 9606, 22530, 29914, 29906, 29897, 470, 8287, 29918, 1066, 29961, 29896, 29962, 6736, 313, 29886, 22352, 29896, 29918, 1066, 718, 349, 3035, 29918, 9606, 22530, 29914, 29906, 718, 17714, 22530, 29914, 29906, 876, 322, 8287, 29918, 1066, 29961, 29900, 29962, 1275, 313, 29925, 3035, 29918, 22574, 718, 350, 9818, 29918, 29934, 3035, 29902, 3308, 1125, 13, 4706, 8158, 29906, 4619, 29871, 29896, 13, 1678, 1683, 584, 13, 4706, 1209, 13, 308, 13, 1678, 565, 313, 2135, 29918, 1066, 29961, 29896, 29962, 5277, 313, 29886, 22352, 29906, 29918, 1066, 718, 17714, 22530, 29914, 29906, 448, 349, 3035, 29918, 9606, 22530, 29914, 29906, 29897, 470, 8287, 29918, 1066, 29961, 29896, 29962, 6736, 313, 29886, 22352, 29906, 29918, 1066, 718, 349, 3035, 29918, 9606, 22530, 29914, 29906, 718, 17714, 22530, 29914, 29906, 876, 322, 8287, 29918, 1066, 29961, 29900, 29962, 1275, 313, 22574, 448, 349, 3035, 29918, 22574, 448, 350, 9818, 29918, 29934, 3035, 29902, 3308, 1125, 13, 4706, 8158, 29896, 4619, 29871, 29896, 13, 1678, 1683, 29901, 13, 4706, 1209, 13, 1678, 13, 1678, 10508, 29889, 4012, 29918, 726, 29898, 851, 29898, 13628, 29896, 29897, 1919, 313, 29906, 29945, 29900, 29892, 29941, 29900, 29897, 1919, 29871, 29946, 29900, 1919, 376, 21823, 1159, 13, 1678, 10508, 29889, 4012, 29918, 726, 29898, 851, 29898, 13628, 29906, 29897, 1919, 313, 29941, 29941, 29900, 29892, 29941, 29900, 29897, 1919, 29871, 29946, 29900, 1919, 376, 21823, 1159, 13, 1678, 13, 268, 13, 1753, 1820, 3204, 29898, 1989, 1125, 13, 1678, 5534, 282, 22352, 29896, 29918, 955, 29892, 282, 22352, 29906, 29918, 955, 29871, 13, 1678, 565, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 3204, 3108, 29901, 13, 4706, 282, 22352, 29896, 29918, 955, 353, 29871, 29906, 29871, 13, 1678, 25342, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 786, 3108, 29901, 13, 4706, 282, 22352, 29896, 29918, 955, 353, 448, 29906, 13, 268, 13, 1678, 565, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 29893, 3108, 29901, 29871, 13, 4706, 282, 22352, 29906, 29918, 955, 353, 448, 29906, 13, 1678, 25342, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 29879, 3108, 29901, 13, 4706, 282, 22352, 29906, 29918, 955, 353, 29871, 29906, 13, 259, 13, 1753, 1820, 786, 29898, 1989, 1125, 13, 1678, 5534, 282, 22352, 29896, 29918, 955, 29892, 282, 22352, 29906, 29918, 955, 13, 1678, 565, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 3204, 3108, 470, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 786, 3108, 29901, 13, 4706, 282, 22352, 29896, 29918, 955, 353, 29871, 29900, 13, 1678, 565, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 29893, 3108, 470, 1820, 1275, 2560, 23569, 29889, 10818, 29918, 23827, 3366, 29879, 3108, 29901, 13, 4706, 282, 22352, 29906, 29918, 955, 353, 29871, 29900, 13, 308, 13, 2557, 353, 2560, 23569, 29889, 3258, 29918, 2557, 703, 29925, 549, 613, 399, 1367, 4690, 29892, 17714, 22530, 29897, 13, 2557, 29889, 842, 29918, 4012, 29918, 13789, 29898, 4012, 29897, 13, 2557, 29889, 842, 29918, 1989, 3204, 29918, 13789, 29898, 1989, 3204, 29897, 13, 2557, 29889, 842, 29918, 1989, 786, 29918, 13789, 29898, 1989, 786, 29897, 13, 2557, 29889, 1202, 29918, 3092, 703, 15078, 442, 613, 12071, 29897, 13, 13, 1482, 29918, 11802, 580, 13, 2158, 580, 13, 2557, 29889, 2962, 580, 13, 2 ]
files/metacentrum.py
crocs-muni/rtt-deployment
2
1613738
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import logging import os import time import hashlib import subprocess import sys logger = logging.getLogger(__name__) JOB_TEMPLATE = """#!/bin/bash # set a handler to clean the SCRATCHDIR once finished trap "clean_scratch" TERM EXIT export HMDIR="{{{STORAGE_ROOT}}}" export BASEDR="$HMDIR/rtt_worker" export HOME=$HMDIR export RTT_PARALLEL={{{RTT_PARALLEL}}} mkdir -p `dirname {{{LOG_ERR}}}` 2>/dev/null mkdir -p `dirname {{{LOG_OUT}}}` 2>/dev/null cd $HMDIR . $HMDIR/pyenv-brno3.sh pyenv local 3.7.1 cd "${BASEDR}" # set -o pipefail stdbuf -eL $HMDIR/.pyenv/versions/3.7.1/bin/python \\ ./run_jobs.py $BASEDR/backend.ini \\ --forwarded-mysql 1 \\ --deactivate 1 \\ --name {{{NAME}}} \\ --id {{{ID}}} \\ --location 'metacentrum' \\ --longterm 0 \\ --all-time 1 \\ --run-time {{{RUN_TIME}}} \\ --job-time {{{JOB_TIME}}} \\ --pbspro \\ --data-to-scratch {{{OTHER_PARAMS}}} \\ 2> {{{LOG_ERR}}} > {{{LOG_OUT}}} RES=$? # Copy logs back to FS [[ -n "${SCRATCHDIR}" ]] && cp {{{LOG_ERR}}} {{{PERM_LOG_ERR}}} [[ -n "${SCRATCHDIR}" ]] && cp {{{LOG_OUT}}} {{{PERM_LOG_OUT}}} exit $RES """ """ --clean-cache 1 \\ --clean-logs 1 \\ x """ class JobGenerator: def __init__(self): self.args = None def work(self): if not self.args.job_dir: raise ValueError('Empty job dir') user = self.args.user if not user: user = os.getenv('PBS_O_LOGNAME', None) if not user: user = os.getenv('USER', None) if not user: raise ValueError('Could not determine user') storage_path = self.args.storage_full if not storage_path: storage_path = '/storage/%s/home/%s' % (self.args.storage, user) os.makedirs(self.args.job_dir, exist_ok=True) if self.args.log_dir: os.makedirs(self.args.log_dir, exist_ok=True) log_dir = self.args.log_dir if self.args.log_dir else self.args.job_dir # Generating jobs files = [] batch_id = int(time.time()) for idx in range(self.args.num): workid_base = 'rttw-%s-%04d' % (batch_id, idx) worker_id = hashlib.md5(workid_base.encode()).hexdigest() worker_name = 'meta:%s:%04d:%s' % (batch_id, idx, worker_id[:8]) worker_file_base = '%s-%s' % (workid_base, worker_id[:8]) perm_log_err = os.path.abspath(os.path.join(log_dir, 'loge-%s.log' % worker_file_base)) perm_log_out = os.path.abspath(os.path.join(log_dir, 'logo-%s.log' % worker_file_base)) log_err = os.path.join('${SCRATCHDIR}', 'loge-%s.log' % worker_file_base) if self.args.scratch else perm_log_err log_out = os.path.join('${SCRATCHDIR}', 'logo-%s.log' % worker_file_base) if self.args.scratch else perm_log_out other_params = "" if idx + 1 == self.args.num and self.args.cleanup_last: other_params = " --cleanup-only 1 --clean-cache 1 --clean-log 1 " job_data = JOB_TEMPLATE job_data = job_data.replace('{{{STORAGE_ROOT}}}', storage_path) job_data = job_data.replace('{{{NAME}}}', worker_name) job_data = job_data.replace('{{{ID}}}', worker_id) job_data = job_data.replace('{{{RUN_TIME}}}', '%s' % (60*60*self.args.hr_job - 60*5)) job_data = job_data.replace('{{{JOB_TIME}}}', '%s' % self.args.test_time) job_data = job_data.replace('{{{PERM_LOG_ERR}}}', perm_log_err) job_data = job_data.replace('{{{PERM_LOG_OUT}}}', perm_log_out) job_data = job_data.replace('{{{LOG_ERR}}}', log_err) job_data = job_data.replace('{{{LOG_OUT}}}', log_out) job_data = job_data.replace('{{{RTT_PARALLEL}}}', '%s' % (max(1, self.args.qsub_ncpu - self.args.qsub_ncpu_mgmt))) job_data = job_data.replace('{{{OTHER_PARAMS}}}', '%s' % (other_params)) if '{{{' in job_data: raise ValueError('Missed placeholder') job_file = os.path.join(self.args.job_dir, '%s.sh' % worker_file_base) with open(os.open(job_file, os.O_CREAT | os.O_WRONLY, 0o700), 'w') as fh: fh.write(job_data) files.append(os.path.abspath(job_file)) logger.debug('Generated file %s' % job_file) enqueue_path = os.path.join(self.args.job_dir, 'enqueue-meta-%s.sh' % int(time.time())) with open(os.open(enqueue_path, os.O_CREAT | os.O_WRONLY, 0o700), 'w') as fh: fh.write('#!/bin/bash\n\n') qsub_args = [] if self.args.brno: qsub_args.append('brno=True') if self.args.cluster: qsub_args.append('cl_%s=True' % self.args.cluster) if self.args.scratch: qsub_args.append('scratch_local=%smb' % self.args.scratch_size) if self.args.qsub_debian9: qsub_args.append('debian9=True') if self.args.qsub_args: qsub_args.append(self.args.qsub_args) walltime = '%02d:00:00' % self.args.hr_job nprocs = self.args.qsub_ncpu qsub_args = ':'.join(qsub_args) qsub_args = (':%s' % qsub_args) if qsub_args != '' else '' for fn in files: fh.write('qsub -l select=1:ncpus=%s:mem=%sgb%s -l walltime=%s %s \n' % (nprocs, self.args.qsub_ram, qsub_args, walltime, fn)) if self.args.enqueue: logger.info('Enqueueing...') p = subprocess.Popen(enqueue_path, stdout=sys.stdout, stderr=sys.stderr, shell=True) p.wait() def main(self): logger.debug('App started') parser = argparse.ArgumentParser(description='PBSpro job generator for RTT workers') parser.add_argument('--debug', dest='debug', action='store_const', const=True, help='enables debug mode') parser.add_argument('--verbose', dest='verbose', action='store_const', const=True, help='enables verbose mode') # # Testbed related options # parser.add_argument('--job-dir', dest='job_dir', default=None, help='Directory to put job files to') parser.add_argument('--log-dir', dest='log_dir', default=None, help='Directory to put log files to') parser.add_argument('--brno', dest='brno', action='store_const', const=True, default=False, help='qsub: Enqueue on Brno clusters') parser.add_argument('--debian9', dest='qsub_debian9', action='store_const', const=True, default=False, help='qsub: Use debian9 machines') parser.add_argument('--cluster', dest='cluster', default=None, help='qsub: Enqueue on specific cluster name, e.g., brno, elixir') parser.add_argument('--qsub-ncpu', dest='qsub_ncpu', default=2, type=int, help='qsub: Number of processors to allocate for a job') parser.add_argument('--qsub-ncpu-mgmt', dest='qsub_ncpu_mgmt', default=1, type=int, help='qsub: Number of processors to allocate for management job (1 or 0)') parser.add_argument('--qsub-ram', dest='qsub_ram', default=4, type=int, help='qsub: RAM to allocate in GB') parser.add_argument('--qsub-args', dest='qsub_args', default='', help='qsub: Additional arguments') parser.add_argument('--test-time', dest='test_time', default=60*60, type=int, help='Number of seconds the single test will run (max)') parser.add_argument('--hr-job', dest='hr_job', default=24, type=int, help='Job time to allocate in hours') parser.add_argument('--num', dest='num', default=1, type=int, help='Number of jobs to generate') parser.add_argument('--scratch', dest='scratch', default=1, type=int, help='Disable scratch by setting to 0') parser.add_argument('--scratch-size', dest='scratch_size', default=500, type=int, help='Scratch size in MB') parser.add_argument('--user', dest='user', default=None, help='User running under, overrides system default') parser.add_argument('--storage', dest='storage', default='brno3-cerit', help='Cluster with the storage') parser.add_argument('--storage-full', dest='storage_full', help='Full path to the storage root') parser.add_argument('--enqueue', dest='enqueue', action='store_const', const=True, default=False, help='Enqueues the generated batch via qsub after job finishes') parser.add_argument('--cleanup-last', dest='cleanup_last', default=1, type=int, help='The last job just cleans up the cache') self.args = parser.parse_args() self.work() def main(): jg = JobGenerator() jg.main() if __name__ == "__main__": import coloredlogs coloredlogs.CHROOT_FILES = [] coloredlogs.install(level=logging.DEBUG, use_chroot=False) main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 5215, 1852, 5510, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 931, 13, 5215, 6608, 1982, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 29967, 14824, 29918, 4330, 3580, 29931, 3040, 353, 9995, 29937, 14708, 2109, 29914, 13067, 13, 13, 29937, 731, 263, 7834, 304, 5941, 278, 317, 11341, 14789, 9464, 2748, 7743, 13, 29873, 2390, 376, 14941, 29918, 10526, 905, 29908, 323, 1001, 29924, 8528, 1806, 13, 13, 15843, 379, 29924, 9464, 543, 6224, 29912, 1254, 1955, 10461, 29918, 21289, 930, 5038, 13, 15843, 350, 8127, 8353, 18965, 29950, 29924, 9464, 29914, 29878, 698, 29918, 24602, 29908, 13, 15843, 29832, 2303, 6080, 29950, 29924, 9464, 13, 15843, 390, 19988, 29918, 16320, 1964, 1307, 29931, 3790, 6224, 13079, 29911, 29918, 16320, 1964, 1307, 29931, 12499, 13, 13, 11256, 3972, 448, 29886, 421, 25721, 426, 6224, 14480, 29918, 21662, 930, 10114, 29871, 29906, 20690, 3359, 29914, 4304, 13, 11256, 3972, 448, 29886, 421, 25721, 426, 6224, 14480, 29918, 12015, 930, 10114, 29871, 29906, 20690, 3359, 29914, 4304, 13, 13, 2252, 395, 29950, 29924, 9464, 13, 29889, 395, 29950, 29924, 9464, 29914, 2272, 6272, 29899, 1182, 1217, 29941, 29889, 845, 13, 2272, 6272, 1887, 29871, 29941, 29889, 29955, 29889, 29896, 13, 13, 2252, 11568, 25416, 8353, 5038, 13, 29937, 731, 448, 29877, 14282, 14057, 13, 303, 2585, 1137, 448, 29872, 29931, 395, 29950, 29924, 9464, 6294, 2272, 6272, 29914, 26100, 29914, 29941, 29889, 29955, 29889, 29896, 29914, 2109, 29914, 4691, 2474, 13, 29871, 11431, 3389, 29918, 9057, 29879, 29889, 2272, 395, 25416, 8353, 29914, 27852, 29889, 2172, 2474, 13, 29871, 1192, 11333, 287, 29899, 7938, 29871, 29896, 2474, 13, 29871, 1192, 311, 11236, 403, 29871, 29896, 2474, 13, 29871, 1192, 978, 426, 6224, 5813, 12499, 2474, 13, 29871, 1192, 333, 426, 6224, 1367, 12499, 2474, 13, 29871, 1192, 5479, 525, 2527, 16648, 5848, 29915, 2474, 13, 29871, 1192, 5426, 8489, 29871, 29900, 2474, 13, 29871, 1192, 497, 29899, 2230, 29871, 29896, 2474, 13, 29871, 1192, 3389, 29899, 2230, 426, 6224, 29934, 3904, 29918, 15307, 12499, 2474, 13, 29871, 1192, 9057, 29899, 2230, 426, 6224, 29967, 14824, 29918, 15307, 12499, 2474, 13, 29871, 1192, 29886, 5824, 771, 2474, 13, 29871, 1192, 1272, 29899, 517, 29899, 10526, 905, 426, 6224, 2891, 4448, 29918, 16320, 29909, 4345, 12499, 2474, 13, 259, 29906, 29958, 426, 6224, 14480, 29918, 21662, 12499, 1405, 426, 6224, 14480, 29918, 12015, 12499, 13, 15989, 6080, 29973, 13, 13, 29937, 14187, 10748, 1250, 304, 383, 29903, 13, 8999, 448, 29876, 11568, 7187, 29934, 14789, 9464, 5038, 29588, 2607, 21447, 426, 6224, 14480, 29918, 21662, 12499, 426, 6224, 13171, 29924, 29918, 14480, 29918, 21662, 12499, 13, 8999, 448, 29876, 11568, 7187, 29934, 14789, 9464, 5038, 29588, 2607, 21447, 426, 6224, 14480, 29918, 12015, 12499, 426, 6224, 13171, 29924, 29918, 14480, 29918, 12015, 12499, 13, 13322, 395, 15989, 13, 15945, 29908, 13, 13, 15945, 29908, 13, 29871, 1192, 14941, 29899, 8173, 29871, 29896, 2474, 13, 29871, 1192, 14941, 29899, 20756, 29871, 29896, 2474, 13, 29871, 921, 13, 15945, 29908, 13, 13, 13, 1990, 17163, 21575, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 5085, 353, 6213, 13, 13, 1678, 822, 664, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 29889, 5085, 29889, 9057, 29918, 3972, 29901, 13, 9651, 12020, 7865, 2392, 877, 8915, 4982, 4516, 1495, 13, 13, 4706, 1404, 353, 1583, 29889, 5085, 29889, 1792, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 1404, 353, 2897, 29889, 657, 6272, 877, 29925, 9851, 29918, 29949, 29918, 14480, 5813, 742, 6213, 29897, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 1404, 353, 2897, 29889, 657, 6272, 877, 11889, 742, 6213, 29897, 13, 4706, 565, 451, 1404, 29901, 13, 9651, 12020, 7865, 2392, 877, 23323, 451, 8161, 1404, 1495, 13, 13, 4706, 8635, 29918, 2084, 353, 1583, 29889, 5085, 29889, 12925, 29918, 8159, 13, 4706, 565, 451, 8635, 29918, 2084, 29901, 13, 9651, 8635, 29918, 2084, 353, 8207, 12925, 22584, 29879, 29914, 5184, 22584, 29879, 29915, 1273, 313, 1311, 29889, 5085, 29889, 12925, 29892, 1404, 29897, 13, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 1311, 29889, 5085, 29889, 9057, 29918, 3972, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 1188, 29918, 3972, 29901, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 1311, 29889, 5085, 29889, 1188, 29918, 3972, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 4706, 1480, 29918, 3972, 353, 1583, 29889, 5085, 29889, 1188, 29918, 3972, 565, 1583, 29889, 5085, 29889, 1188, 29918, 3972, 1683, 1583, 29889, 5085, 29889, 9057, 29918, 3972, 13, 13, 4706, 396, 3251, 1218, 17643, 13, 4706, 2066, 353, 5159, 13, 4706, 9853, 29918, 333, 353, 938, 29898, 2230, 29889, 2230, 3101, 13, 4706, 363, 22645, 297, 3464, 29898, 1311, 29889, 5085, 29889, 1949, 1125, 13, 9651, 664, 333, 29918, 3188, 353, 525, 29878, 698, 29893, 19222, 29879, 19222, 29900, 29946, 29881, 29915, 1273, 313, 16175, 29918, 333, 29892, 22645, 29897, 13, 9651, 15645, 29918, 333, 353, 6608, 1982, 29889, 3487, 29945, 29898, 1287, 333, 29918, 3188, 29889, 12508, 16655, 20970, 7501, 342, 580, 13, 9651, 15645, 29918, 978, 353, 525, 7299, 16664, 29879, 16664, 29900, 29946, 29881, 16664, 29879, 29915, 1273, 313, 16175, 29918, 333, 29892, 22645, 29892, 15645, 29918, 333, 7503, 29947, 2314, 13, 9651, 15645, 29918, 1445, 29918, 3188, 353, 14210, 29879, 19222, 29879, 29915, 1273, 313, 1287, 333, 29918, 3188, 29892, 15645, 29918, 333, 7503, 29947, 2314, 13, 9651, 3635, 29918, 1188, 29918, 3127, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29892, 525, 417, 479, 19222, 29879, 29889, 1188, 29915, 1273, 15645, 29918, 1445, 29918, 3188, 876, 13, 9651, 3635, 29918, 1188, 29918, 449, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29892, 525, 14569, 19222, 29879, 29889, 1188, 29915, 1273, 15645, 29918, 1445, 29918, 3188, 876, 13, 9651, 1480, 29918, 3127, 353, 2897, 29889, 2084, 29889, 7122, 877, 5303, 7187, 29934, 14789, 9464, 29913, 742, 525, 417, 479, 19222, 29879, 29889, 1188, 29915, 1273, 15645, 29918, 1445, 29918, 3188, 29897, 565, 1583, 29889, 5085, 29889, 10526, 905, 1683, 3635, 29918, 1188, 29918, 3127, 13, 9651, 1480, 29918, 449, 353, 2897, 29889, 2084, 29889, 7122, 877, 5303, 7187, 29934, 14789, 9464, 29913, 742, 525, 14569, 19222, 29879, 29889, 1188, 29915, 1273, 15645, 29918, 1445, 29918, 3188, 29897, 565, 1583, 29889, 5085, 29889, 10526, 905, 1683, 3635, 29918, 1188, 29918, 449, 13, 9651, 916, 29918, 7529, 353, 5124, 13, 9651, 565, 22645, 718, 29871, 29896, 1275, 1583, 29889, 5085, 29889, 1949, 322, 1583, 29889, 5085, 29889, 14941, 786, 29918, 4230, 29901, 13, 18884, 916, 29918, 7529, 353, 376, 1192, 14941, 786, 29899, 6194, 29871, 29896, 29871, 1192, 14941, 29899, 8173, 29871, 29896, 1192, 14941, 29899, 1188, 29871, 29896, 376, 13, 13, 9651, 4982, 29918, 1272, 353, 435, 14824, 29918, 4330, 3580, 29931, 3040, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 1254, 1955, 10461, 29918, 21289, 12499, 742, 8635, 29918, 2084, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 5813, 12499, 742, 15645, 29918, 978, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 1367, 12499, 742, 15645, 29918, 333, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 29934, 3904, 29918, 15307, 12499, 742, 14210, 29879, 29915, 1273, 313, 29953, 29900, 29930, 29953, 29900, 29930, 1311, 29889, 5085, 29889, 1092, 29918, 9057, 448, 29871, 29953, 29900, 29930, 29945, 876, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 29967, 14824, 29918, 15307, 12499, 742, 14210, 29879, 29915, 1273, 1583, 29889, 5085, 29889, 1688, 29918, 2230, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 13171, 29924, 29918, 14480, 29918, 21662, 12499, 742, 3635, 29918, 1188, 29918, 3127, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 13171, 29924, 29918, 14480, 29918, 12015, 12499, 742, 3635, 29918, 1188, 29918, 449, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 14480, 29918, 21662, 12499, 742, 1480, 29918, 3127, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 14480, 29918, 12015, 12499, 742, 1480, 29918, 449, 29897, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 13079, 29911, 29918, 16320, 1964, 1307, 29931, 12499, 742, 14210, 29879, 29915, 1273, 313, 3317, 29898, 29896, 29892, 1583, 29889, 5085, 29889, 29939, 1491, 29918, 17608, 3746, 448, 1583, 29889, 5085, 29889, 29939, 1491, 29918, 17608, 3746, 29918, 29885, 29887, 4378, 4961, 13, 9651, 4982, 29918, 1272, 353, 4982, 29918, 1272, 29889, 6506, 877, 6224, 29912, 2891, 4448, 29918, 16320, 29909, 4345, 12499, 742, 14210, 29879, 29915, 1273, 313, 1228, 29918, 7529, 876, 13, 13, 9651, 565, 525, 6224, 10998, 297, 4982, 29918, 1272, 29901, 13, 18884, 12020, 7865, 2392, 877, 18552, 287, 12983, 1495, 13, 13, 9651, 4982, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 5085, 29889, 9057, 29918, 3972, 29892, 14210, 29879, 29889, 845, 29915, 1273, 15645, 29918, 1445, 29918, 3188, 29897, 13, 9651, 411, 1722, 29898, 359, 29889, 3150, 29898, 9057, 29918, 1445, 29892, 2897, 29889, 29949, 29918, 22245, 1299, 891, 2897, 29889, 29949, 29918, 9980, 1164, 16786, 29892, 29871, 29900, 29877, 29955, 29900, 29900, 511, 525, 29893, 1495, 408, 285, 29882, 29901, 13, 18884, 285, 29882, 29889, 3539, 29898, 9057, 29918, 1272, 29897, 13, 13, 9651, 2066, 29889, 4397, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 9057, 29918, 1445, 876, 13, 9651, 17927, 29889, 8382, 877, 24565, 934, 1273, 29879, 29915, 1273, 4982, 29918, 1445, 29897, 13, 13, 4706, 427, 9990, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 5085, 29889, 9057, 29918, 3972, 29892, 525, 264, 9990, 29899, 7299, 19222, 29879, 29889, 845, 29915, 1273, 938, 29898, 2230, 29889, 2230, 22130, 13, 4706, 411, 1722, 29898, 359, 29889, 3150, 29898, 264, 9990, 29918, 2084, 29892, 2897, 29889, 29949, 29918, 22245, 1299, 891, 2897, 29889, 29949, 29918, 9980, 1164, 16786, 29892, 29871, 29900, 29877, 29955, 29900, 29900, 511, 525, 29893, 1495, 408, 285, 29882, 29901, 13, 9651, 285, 29882, 29889, 3539, 14237, 14708, 2109, 29914, 13067, 29905, 29876, 29905, 29876, 1495, 13, 9651, 3855, 1491, 29918, 5085, 353, 5159, 13, 9651, 565, 1583, 29889, 5085, 29889, 1182, 1217, 29901, 13, 18884, 3855, 1491, 29918, 5085, 29889, 4397, 877, 1182, 1217, 29922, 5574, 1495, 13, 9651, 565, 1583, 29889, 5085, 29889, 19594, 29901, 13, 18884, 3855, 1491, 29918, 5085, 29889, 4397, 877, 695, 29918, 29995, 29879, 29922, 5574, 29915, 1273, 1583, 29889, 5085, 29889, 19594, 29897, 13, 9651, 565, 1583, 29889, 5085, 29889, 10526, 905, 29901, 13, 18884, 3855, 1491, 29918, 5085, 29889, 4397, 877, 10526, 905, 29918, 2997, 16328, 3844, 29890, 29915, 1273, 1583, 29889, 5085, 29889, 10526, 905, 29918, 2311, 29897, 13, 9651, 565, 1583, 29889, 5085, 29889, 29939, 1491, 29918, 16529, 713, 29929, 29901, 13, 18884, 3855, 1491, 29918, 5085, 29889, 4397, 877, 16529, 713, 29929, 29922, 5574, 1495, 13, 9651, 565, 1583, 29889, 5085, 29889, 29939, 1491, 29918, 5085, 29901, 13, 18884, 3855, 1491, 29918, 5085, 29889, 4397, 29898, 1311, 29889, 5085, 29889, 29939, 1491, 29918, 5085, 29897, 13, 13, 9651, 10090, 2230, 353, 14210, 29900, 29906, 29881, 29901, 29900, 29900, 29901, 29900, 29900, 29915, 1273, 1583, 29889, 5085, 29889, 1092, 29918, 9057, 13, 9651, 302, 771, 2395, 353, 1583, 29889, 5085, 29889, 29939, 1491, 29918, 17608, 3746, 13, 9651, 3855, 1491, 29918, 5085, 353, 525, 29901, 4286, 7122, 29898, 29939, 1491, 29918, 5085, 29897, 13, 9651, 3855, 1491, 29918, 5085, 353, 313, 2396, 29995, 29879, 29915, 1273, 3855, 1491, 29918, 5085, 29897, 565, 3855, 1491, 29918, 5085, 2804, 6629, 1683, 6629, 13, 9651, 363, 7876, 297, 2066, 29901, 13, 18884, 285, 29882, 29889, 3539, 877, 29939, 1491, 448, 29880, 1831, 29922, 29896, 29901, 29876, 6814, 375, 16328, 29879, 29901, 6954, 16328, 5311, 29890, 29995, 29879, 448, 29880, 10090, 2230, 16328, 29879, 1273, 29879, 320, 29876, 29915, 13, 462, 308, 1273, 313, 29876, 771, 2395, 29892, 1583, 29889, 5085, 29889, 29939, 1491, 29918, 2572, 29892, 3855, 1491, 29918, 5085, 29892, 10090, 2230, 29892, 7876, 876, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 264, 9990, 29901, 13, 9651, 17927, 29889, 3888, 877, 2369, 9990, 292, 856, 1495, 13, 9651, 282, 353, 1014, 5014, 29889, 29925, 3150, 29898, 264, 9990, 29918, 2084, 29892, 27591, 29922, 9675, 29889, 25393, 29892, 380, 20405, 29922, 9675, 29889, 303, 20405, 29892, 6473, 29922, 5574, 29897, 13, 9651, 282, 29889, 10685, 580, 13, 13, 1678, 822, 1667, 29898, 1311, 1125, 13, 4706, 17927, 29889, 8382, 877, 2052, 4687, 1495, 13, 13, 4706, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 29925, 9851, 771, 4982, 15299, 363, 390, 19988, 17162, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 8382, 742, 2731, 2433, 8382, 742, 3158, 2433, 8899, 29918, 3075, 742, 1040, 29922, 5574, 29892, 13, 462, 9651, 1371, 2433, 264, 1849, 4744, 4464, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 369, 15828, 742, 2731, 2433, 369, 15828, 742, 3158, 2433, 8899, 29918, 3075, 742, 1040, 29922, 5574, 29892, 13, 462, 9651, 1371, 2433, 264, 1849, 26952, 4464, 1495, 13, 13, 4706, 396, 13, 4706, 396, 4321, 2580, 4475, 3987, 13, 4706, 396, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 9057, 29899, 3972, 742, 2731, 2433, 9057, 29918, 3972, 742, 2322, 29922, 8516, 29892, 13, 462, 9651, 1371, 2433, 9882, 304, 1925, 4982, 2066, 304, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1188, 29899, 3972, 742, 2731, 2433, 1188, 29918, 3972, 742, 2322, 29922, 8516, 29892, 13, 462, 9651, 1371, 2433, 9882, 304, 1925, 1480, 2066, 304, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1182, 1217, 742, 2731, 2433, 1182, 1217, 742, 3158, 2433, 8899, 29918, 3075, 742, 1040, 29922, 5574, 29892, 2322, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 29939, 1491, 29901, 1174, 9990, 373, 1771, 1217, 24554, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 16529, 713, 29929, 742, 2731, 2433, 29939, 1491, 29918, 16529, 713, 29929, 742, 3158, 2433, 8899, 29918, 3075, 742, 1040, 29922, 5574, 29892, 2322, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 29939, 1491, 29901, 4803, 2553, 713, 29929, 14884, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 19594, 742, 2731, 2433, 19594, 742, 2322, 29922, 8516, 29892, 13, 462, 9651, 1371, 2433, 29939, 1491, 29901, 1174, 9990, 373, 2702, 9867, 1024, 29892, 321, 29889, 29887, 1696, 1506, 1217, 29892, 560, 861, 381, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 29939, 1491, 29899, 17608, 3746, 742, 2731, 2433, 29939, 1491, 29918, 17608, 3746, 742, 2322, 29922, 29906, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 29939, 1491, 29901, 29871, 9681, 310, 1889, 943, 304, 23632, 363, 263, 4982, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 29939, 1491, 29899, 17608, 3746, 29899, 29885, 29887, 4378, 742, 2731, 2433, 29939, 1491, 29918, 17608, 3746, 29918, 29885, 29887, 4378, 742, 2322, 29922, 29896, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 29939, 1491, 29901, 29871, 9681, 310, 1889, 943, 304, 23632, 363, 10643, 4982, 313, 29896, 470, 29871, 29900, 29897, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 29939, 1491, 29899, 2572, 742, 2731, 2433, 29939, 1491, 29918, 2572, 742, 2322, 29922, 29946, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 29939, 1491, 29901, 29871, 18113, 304, 23632, 297, 19289, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 29939, 1491, 29899, 5085, 742, 2731, 2433, 29939, 1491, 29918, 5085, 742, 2322, 2433, 742, 13, 462, 9651, 1371, 2433, 29939, 1491, 29901, 29871, 3462, 3245, 6273, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1688, 29899, 2230, 742, 2731, 2433, 1688, 29918, 2230, 742, 2322, 29922, 29953, 29900, 29930, 29953, 29900, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 4557, 310, 6923, 278, 2323, 1243, 674, 1065, 313, 3317, 29897, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1092, 29899, 9057, 742, 2731, 2433, 1092, 29918, 9057, 742, 2322, 29922, 29906, 29946, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 11947, 931, 304, 23632, 297, 6199, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1949, 742, 2731, 2433, 1949, 742, 2322, 29922, 29896, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 4557, 310, 17643, 304, 5706, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 10526, 905, 742, 2731, 2433, 10526, 905, 742, 2322, 29922, 29896, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 4205, 519, 22728, 491, 4444, 304, 29871, 29900, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 10526, 905, 29899, 2311, 742, 2731, 2433, 10526, 905, 29918, 2311, 742, 2322, 29922, 29945, 29900, 29900, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 4421, 29878, 905, 2159, 297, 13232, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1792, 742, 2731, 2433, 1792, 742, 2322, 29922, 8516, 29892, 13, 462, 9651, 1371, 2433, 2659, 2734, 1090, 29892, 975, 24040, 1788, 2322, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 12925, 742, 2731, 2433, 12925, 742, 2322, 2433, 1182, 1217, 29941, 29899, 2265, 277, 742, 13, 462, 9651, 1371, 2433, 6821, 5402, 411, 278, 8635, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 12925, 29899, 8159, 742, 2731, 2433, 12925, 29918, 8159, 742, 13, 462, 9651, 1371, 2433, 13658, 2224, 304, 278, 8635, 3876, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 264, 9990, 742, 2731, 2433, 264, 9990, 742, 3158, 2433, 8899, 29918, 3075, 742, 1040, 29922, 5574, 29892, 2322, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 2369, 802, 1041, 278, 5759, 9853, 3025, 3855, 1491, 1156, 4982, 8341, 267, 1495, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 14941, 786, 29899, 4230, 742, 2731, 2433, 14941, 786, 29918, 4230, 742, 2322, 29922, 29896, 29892, 1134, 29922, 524, 29892, 13, 462, 9651, 1371, 2433, 1576, 1833, 4982, 925, 4531, 550, 701, 278, 7090, 1495, 13, 13, 4706, 1583, 29889, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 4706, 1583, 29889, 1287, 580, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 432, 29887, 353, 17163, 21575, 580, 13, 1678, 432, 29887, 29889, 3396, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 28684, 20756, 13, 1678, 28684, 20756, 29889, 3210, 21289, 29918, 24483, 353, 5159, 13, 1678, 28684, 20756, 29889, 6252, 29898, 5563, 29922, 21027, 29889, 18525, 29892, 671, 29918, 305, 4632, 29922, 8824, 29897, 13, 1678, 1667, 580, 13, 2 ]
accounts/models.py
connorpekovic/djangox
0
1608861
<reponame>connorpekovic/djangox import uuid from django.contrib.auth.models import AbstractUser from django.db import models # User ID needs to be UUID class CustomUser(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) def __str__(self): return self.email
[ 1, 529, 276, 1112, 420, 29958, 13082, 272, 412, 9756, 293, 29914, 19776, 574, 2251, 13, 5215, 318, 5416, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 25513, 2659, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 13, 29937, 4911, 3553, 4225, 304, 367, 501, 11150, 13, 1990, 8701, 2659, 29898, 9118, 2659, 1125, 13, 1678, 1178, 353, 4733, 29889, 29965, 11150, 3073, 29898, 16072, 29918, 1989, 29922, 5574, 29892, 13, 462, 3986, 2322, 29922, 25118, 29889, 25118, 29946, 29892, 13, 462, 3986, 3863, 519, 29922, 8824, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 5269, 2 ]
ros/env_measurement_module/scripts/run_env_measurement.py
MikhailBertrand/AN-BME280-IG
0
197106
#!/usr/bin/env python # -*- coding: utf-8 -*- import rospy from std_msgs.msg import String, Float32 from env_measurement_module.BME280 import BME280 class EnvMeasurement(object): """ Use AN-301 for measuring environment information """ def __init__(self): self.__device = BME280() self.__temperature_pub = rospy.Publisher( 'env_measurement/temperature', Float32, queue_size=10) self.__humidity_pub = rospy.Publisher( 'env_measurement/humidity', Float32, queue_size=10) self.__pressure_pub = rospy.Publisher( 'env_measurement/pressure', Float32, queue_size=10) self.__di_pub = rospy.Publisher( 'env_measurement/discomfort_index', Float32, queue_size=10) self.__dl_pub = rospy.Publisher( 'env_measurement/discomfort_level', String, queue_size=10) def main_loop(self): """ Main measurement loop """ while not rospy.is_shutdown(): self.__device.read_data() self.__temperature_pub.publish(self.__device.temperature) self.__humidity_pub.publish(self.__device.var_h) self.__pressure_pub.publish(self.__device.pressure) self.__di_pub.publish(self.__device.DI) rospy.logdebug('Temperature: {}'.format(self.__device.temperature)) rospy.logdebug('Humidity: {}'.format(self.__device.var_h)) rospy.logdebug('Pressure: {}'.format(self.__device.pressure)) rospy.logdebug('Discomfort Index: {}'.format(self.__device.DI)) rospy.sleep(1) if __name__ == '__main__': rospy.init_node('env_measurement') ENV = EnvMeasurement() ENV.main_loop() rospy.spin()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 696, 1028, 29891, 13, 3166, 3659, 29918, 1516, 3174, 29889, 7645, 1053, 1714, 29892, 27842, 29941, 29906, 13, 3166, 8829, 29918, 26658, 358, 29918, 5453, 29889, 29933, 2303, 29906, 29947, 29900, 1053, 350, 2303, 29906, 29947, 29900, 13, 13, 13, 1990, 1174, 29894, 6816, 3745, 358, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 4803, 13764, 29899, 29941, 29900, 29896, 363, 7540, 3864, 5177, 2472, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 17255, 10141, 353, 350, 2303, 29906, 29947, 29900, 580, 13, 4706, 1583, 17255, 12863, 1535, 29918, 5467, 353, 696, 1028, 29891, 29889, 21076, 1674, 261, 29898, 13, 9651, 525, 6272, 29918, 26658, 358, 29914, 12863, 1535, 742, 27842, 29941, 29906, 29892, 9521, 29918, 2311, 29922, 29896, 29900, 29897, 13, 4706, 1583, 17255, 16063, 333, 537, 29918, 5467, 353, 696, 1028, 29891, 29889, 21076, 1674, 261, 29898, 13, 9651, 525, 6272, 29918, 26658, 358, 29914, 16063, 333, 537, 742, 27842, 29941, 29906, 29892, 9521, 29918, 2311, 29922, 29896, 29900, 29897, 13, 4706, 1583, 17255, 2139, 545, 29918, 5467, 353, 696, 1028, 29891, 29889, 21076, 1674, 261, 29898, 13, 9651, 525, 6272, 29918, 26658, 358, 29914, 2139, 545, 742, 27842, 29941, 29906, 29892, 9521, 29918, 2311, 29922, 29896, 29900, 29897, 13, 4706, 1583, 17255, 6051, 29918, 5467, 353, 696, 1028, 29891, 29889, 21076, 1674, 261, 29898, 13, 9651, 525, 6272, 29918, 26658, 358, 29914, 2218, 510, 3921, 29918, 2248, 742, 27842, 29941, 29906, 29892, 9521, 29918, 2311, 29922, 29896, 29900, 29897, 13, 4706, 1583, 17255, 11671, 29918, 5467, 353, 696, 1028, 29891, 29889, 21076, 1674, 261, 29898, 13, 9651, 525, 6272, 29918, 26658, 358, 29914, 2218, 510, 3921, 29918, 5563, 742, 1714, 29892, 9521, 29918, 2311, 29922, 29896, 29900, 29897, 13, 13, 1678, 822, 1667, 29918, 7888, 29898, 1311, 1125, 13, 4706, 9995, 4241, 20039, 2425, 9995, 13, 4706, 1550, 451, 696, 1028, 29891, 29889, 275, 29918, 845, 329, 3204, 7295, 13, 9651, 1583, 17255, 10141, 29889, 949, 29918, 1272, 580, 13, 9651, 1583, 17255, 12863, 1535, 29918, 5467, 29889, 23679, 29898, 1311, 17255, 10141, 29889, 12863, 1535, 29897, 13, 9651, 1583, 17255, 16063, 333, 537, 29918, 5467, 29889, 23679, 29898, 1311, 17255, 10141, 29889, 1707, 29918, 29882, 29897, 13, 9651, 1583, 17255, 2139, 545, 29918, 5467, 29889, 23679, 29898, 1311, 17255, 10141, 29889, 2139, 545, 29897, 13, 9651, 1583, 17255, 6051, 29918, 5467, 29889, 23679, 29898, 1311, 17255, 10141, 29889, 4571, 29897, 13, 9651, 696, 1028, 29891, 29889, 1188, 8382, 877, 5776, 546, 1535, 29901, 6571, 4286, 4830, 29898, 1311, 17255, 10141, 29889, 12863, 1535, 876, 13, 9651, 696, 1028, 29891, 29889, 1188, 8382, 877, 29950, 398, 333, 537, 29901, 6571, 4286, 4830, 29898, 1311, 17255, 10141, 29889, 1707, 29918, 29882, 876, 13, 9651, 696, 1028, 29891, 29889, 1188, 8382, 877, 10923, 545, 29901, 6571, 4286, 4830, 29898, 1311, 17255, 10141, 29889, 2139, 545, 876, 13, 9651, 696, 1028, 29891, 29889, 1188, 8382, 877, 4205, 510, 3921, 11374, 29901, 6571, 4286, 4830, 29898, 1311, 17255, 10141, 29889, 4571, 876, 13, 9651, 696, 1028, 29891, 29889, 17059, 29898, 29896, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 696, 1028, 29891, 29889, 2344, 29918, 3177, 877, 6272, 29918, 26658, 358, 1495, 13, 1678, 12524, 29963, 353, 1174, 29894, 6816, 3745, 358, 580, 13, 1678, 12524, 29963, 29889, 3396, 29918, 7888, 580, 13, 1678, 696, 1028, 29891, 29889, 1028, 262, 580, 13, 2 ]
src/data/make_dataset.py
chorus12/TimeSeriesWorkshop
1
1605754
# -*- coding: utf-8 -*- import pandas as pd from pathlib import Path import os from datetime import datetime import sys def main(): """ Runs data processing scripts to turn raw data from (../raw) into cleaned data ready to be analyzed (saved in ../processed). """ df = pd.read_csv(os.path.join(project_dir, 'data/raw/bike_sharing_demand.csv'), parse_dates=['datetime']) # adding date column with just the date df['date'] = df['datetime'].apply(lambda x: pd.to_datetime(datetime.date(x))) # filter only data from march df_march = df[df['date'].isin(pd.date_range(start='2012-03-01', end='2012-03-31'))] df_march.drop('date', axis=1, inplace=True) # write file to standard output df_march.to_csv(sys.stdout, sep='\t', index=False) if __name__ == '__main__': # not used in this stub but often useful for finding various files project_dir = Path(__file__).resolve().parents[2] # find .env automagically by walking up directories until it's found, then # load up the .env entries as environment variables main()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 11701, 408, 10518, 13, 3166, 2224, 1982, 1053, 10802, 13, 5215, 2897, 13, 3166, 12865, 1053, 12865, 13, 5215, 10876, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 9995, 390, 6948, 848, 9068, 12078, 304, 2507, 10650, 848, 515, 313, 6995, 1610, 29897, 964, 13, 4706, 5941, 287, 848, 7960, 304, 367, 29537, 287, 313, 17314, 297, 29772, 5014, 287, 467, 13, 1678, 9995, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4836, 29918, 3972, 29892, 525, 1272, 29914, 1610, 29914, 5365, 446, 29918, 845, 4362, 29918, 2310, 392, 29889, 7638, 5477, 13, 4706, 6088, 29918, 15190, 29922, 1839, 12673, 11287, 13, 29937, 4417, 2635, 1897, 411, 925, 278, 2635, 13, 1678, 4489, 1839, 1256, 2033, 353, 4489, 1839, 12673, 13359, 7302, 29898, 2892, 921, 29901, 10518, 29889, 517, 29918, 12673, 29898, 12673, 29889, 1256, 29898, 29916, 4961, 13, 29937, 4175, 871, 848, 515, 8575, 13, 1678, 4489, 29918, 29885, 1279, 353, 4489, 29961, 2176, 1839, 1256, 13359, 275, 262, 29898, 15926, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29906, 29900, 29896, 29906, 29899, 29900, 29941, 29899, 29900, 29896, 742, 1095, 2433, 29906, 29900, 29896, 29906, 29899, 29900, 29941, 29899, 29941, 29896, 8785, 29962, 13, 1678, 4489, 29918, 29885, 1279, 29889, 8865, 877, 1256, 742, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 29897, 13, 29937, 2436, 934, 304, 3918, 1962, 13, 1678, 4489, 29918, 29885, 1279, 29889, 517, 29918, 7638, 29898, 9675, 29889, 25393, 29892, 16345, 2433, 29905, 29873, 742, 2380, 29922, 8824, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 451, 1304, 297, 445, 19281, 541, 4049, 5407, 363, 9138, 5164, 2066, 13, 1678, 2060, 29918, 3972, 353, 10802, 22168, 1445, 1649, 467, 17863, 2141, 862, 1237, 29961, 29906, 29962, 13, 13, 1678, 396, 1284, 869, 6272, 3345, 351, 1711, 491, 22049, 701, 17525, 2745, 372, 29915, 29879, 1476, 29892, 769, 13, 1678, 396, 2254, 701, 278, 869, 6272, 9976, 408, 5177, 3651, 13, 13, 1678, 1667, 580, 13, 2 ]
FOP.py
LagSeeN/thai-ads-filter
32
175359
#!/usr/bin/env python3 """ FOP Filter Orderer and Preener Copyright (C) 2011 Michael This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.""" # FOP version number VERSION = 3.9 # Import the key modules import collections, filecmp, os, re, subprocess, sys import argparse ap = argparse.ArgumentParser() ap.add_argument("--dir", "-d", nargs="+", help="Set directories", default=None) ap.add_argument( "--commit", "-c", help="Enable commit mode", action="store_true", default=False ) arg = ap.parse_args() # Check the version of Python for language compatibility and subprocess.check_output() MAJORREQUIRED = 3 MINORREQUIRED = 2 if sys.version_info < (MAJORREQUIRED, MINORREQUIRED): raise RuntimeError( "FOP requires Python {reqmajor}.{reqminor} or greater, but Python {ismajor}.{isminor} is being used to run this program.".format( reqmajor=MAJORREQUIRED, reqminor=MINORREQUIRED, ismajor=sys.version_info.major, isminor=sys.version_info.minor, ) ) # Import a module only available in Python 3 from urllib.parse import urlparse # Compile regular expressions to match important filter parts (derived from Wladimir Palant's Adblock Plus source code) ELEMENTDOMAINPATTERN = re.compile(r"^([^\/\*\|\@\"\!]*?)#\@?#") FILTERDOMAINPATTERN = re.compile(r"(?:\$|\,)domain\=([^\,\s]+)$") ELEMENTPATTERN = re.compile(r"^([^\/\*\|\@\"\!]*?)(#\@?#?\+?)([^{}]+)$") OPTIONPATTERN = re.compile( r"^(.*)\$(~?[\w\-]+(?:=[^,\s]+)?(?:,~?[\w\-]+(?:=[^,\s]+)?)*)$" ) # Compile regular expressions that match element tags and pseudo classes and strings and tree selectors; "@" indicates either the beginning or the end of a selector SELECTORPATTERN = re.compile( r"(?<=[\s\[@])([a-zA-Z]*[A-Z][a-zA-Z0-9]*)((?=([\[\]\^\*\$=:@#\.]))|(?=(\s(?:[+>~]|\*|[a-zA-Z][a-zA-Z0-9]*[\[:@\s#\.]|[#\.][a-zA-Z][a-zA-Z0-9]*))))" ) PSEUDOPATTERN = re.compile(r"(\:[a-zA-Z\-]*[A-Z][a-zA-Z\-]*)(?=([\(\:\@\s]))") REMOVALPATTERN = re.compile(r"((?<=([>+~,]\s))|(?<=(@|\s|,)))(\*)(?=([#\.\[\:]))") ATTRIBUTEVALUEPATTERN = re.compile( r"^([^\'\"\\]|\\.)*(\"(?:[^\"\\]|\\.)*\"|\'(?:[^\'\\]|\\.)*\')|\*" ) TREESELECTOR = re.compile(r"(\\.|[^\+\>\~\\\ \t])\s*([\+\>\~\ \t])\s*(\D)") UNICODESELECTOR = re.compile(r"\\[0-9a-fA-F]{1,6}\s[a-zA-Z]*[A-Z]") # Compile a regular expression that describes a completely blank line BLANKPATTERN = re.compile(r"^\s*$") # Compile a regular expression that validates commit comments COMMITPATTERN = re.compile(r"^(A|M|P)\:\s(\((.+)\)\s)?(.*)$") # List the files that should not be sorted, either because they have a special sorting system or because they are not filter files IGNORE = ("output", "output_filters", "requirements.txt", "templates", "node_modules") # List all uBO options (excepting domain, which is handled separately), as of version 1.21.9b7 # https://github.com/gorhill/uBlock/wiki/Resources-Library # Support for AdGuard's empty and mp4 filter https://github.com/gorhill/uBlock/releases/tag/1.22.0 KNOWNOPTIONS = ( "collapse", "csp", "document", "elemhide", "font", "genericblock", "generichide", "specifichide", "image", "match-case", "object", "media", "object-subrequest", "other", "ping", "popup", "script", "stylesheet", "subdocument", "third-party", "first-party", "1p", "3p", "inline-script", "xhr", "websocket", "webrtc", "xmlhttprequest", "important", "redirect=googletagmanager_gtm.js", "redirect=google-analytics_ga.js", "redirect=google-analytics_analytics.js", "redirect=googletagservices_gpt.js", "redirect=google-analytics_cx_api.js", "redirect=googlesyndication_adsbygoogle.js", "redirect=doubleclick_instream_ad_status.js", "redirect=ampproject_v0.js", "redirect=noop.js", "redirect=noop.html", "redirect=noop.txt", "redirect=noop-0.1s.mp3", "redirect=noop-1s.mp4", "redirect=1x1.gif", "redirect=2x2.png", "redirect=3x2.png", "redirect=32x32.png", "redirect-rule=googletagmanager_gtm.js", "redirect-rule=google-analytics_ga.js", "redirect-rule=google-analytics_analytics.js", "redirect-rule=googletagservices_gpt.js", "redirect-rule=google-analytics_cx_api.js", "redirect-rule=googlesyndication_adsbygoogle.js", "redirect-rule=doubleclick_instream_ad_status.js", "redirect-rule=ampproject_v0.js", "redirect-rule=noop.js", "redirect-rule=noop.html", "redirect-rule=noop.txt", "redirect-rule=noop-0.1s.mp3", "redirect-rule=noop-1s.mp4", "redirect-rule=1x1.gif", "redirect-rule=2x2.png", "redirect-rule=3x2.png", "redirect-rule=32x32.png", "empty", "mp4", "ehide", "ghide", "shide", ) # List the supported revision control system commands REPODEF = collections.namedtuple( "repodef", "name, directory, locationoption, repodirectoryoption, checkchanges, difference, commit, pull, push", ) GIT = REPODEF( ["git"], "./.git/", "--work-tree=", "--git-dir=", ["status", "-s", "--untracked-files=no"], ["diff"], ["commit", "-a", "-m"], ["pull"], ["push"], ) HG = REPODEF( ["hg"], "./.hg/", "-R", None, ["stat", "-q"], ["diff"], ["commit", "-m"], ["pull"], ["push"], ) REPOTYPES = (GIT, HG) def start(): """ Print a greeting message and run FOP in the directories specified via the command line, or the current working directory if no arguments have been passed.""" greeting = "FOP (Filter Orderer and Preener) version {version}".format( version=VERSION ) characters = len(str(greeting)) print("=" * characters) print(greeting) print("=" * characters) # Convert the directory names to absolute references and visit each unique location places = arg.dir if places: places = [os.path.abspath(place) for place in places] for place in sorted(set(places)): main(place) print() else: main(os.getcwd()) def main(location): """ Find and sort all the files in a given directory, committing changes to a repository if one exists.""" # Check that the directory exists, otherwise return if not os.path.isdir(location): print("{location} does not exist or is not a folder.".format(location=location)) return # Set the repository type based on hidden directories repository = None for repotype in REPOTYPES: if os.path.isdir(os.path.join(location, repotype.directory)): repository = repotype break # If this is a repository, record the initial changes; if this fails, give up trying to use the repository if repository: try: basecommand = repository.name if repository.locationoption.endswith("="): basecommand.append( "{locationoption}{location}".format( locationoption=repository.locationoption, location=location ) ) else: basecommand.extend([repository.locationoption, location]) if repository.repodirectoryoption: if repository.repodirectoryoption.endswith("="): basecommand.append( "{repodirectoryoption}{location}".format( repodirectoryoption=repository.repodirectoryoption, location=os.path.normpath( os.path.join(location, repository.directory) ), ) ) else: basecommand.extend([repository.repodirectoryoption, location]) command = basecommand + repository.checkchanges originaldifference = True if subprocess.check_output(command) else False except (subprocess.CalledProcessError, OSError): print( 'The command "{command}" was unable to run; FOP will therefore not attempt to use the repository tools. On Windows, this may be an indication that you do not have sufficient privileges to run FOP - the exact reason why is unknown. Please also ensure that your revision control system is installed correctly and understood by FOP.'.format( command=" ".join(command) ) ) repository = None # Work through the directory and any subdirectories, ignoring hidden directories print( "\nPrimary location: {folder}".format( folder=os.path.join(os.path.abspath(location), "") ) ) for path, directories, files in os.walk(location): for direct in directories[:]: if direct.startswith(".") or direct in IGNORE: directories.remove(direct) print( "Current directory: {folder}".format( folder=os.path.join(os.path.abspath(path), "") ) ) directories.sort() for filename in sorted(files): address = os.path.join(path, filename) extension = os.path.splitext(filename)[1] # Sort all text files that are not blacklisted if extension == ".txt" and filename not in IGNORE: fopsort(address) # Delete unnecessary backups and temporary files if extension == ".orig" or extension == ".temp": try: os.remove(address) except (IOError, OSError): # Ignore errors resulting from deleting files, as they likely indicate that the file has already been deleted pass # If in a repository, offer to commit any changes if repository and arg.commit: commit(repository, basecommand, originaldifference) def fopsort(filename): """ Sort the sections of the file and save any modifications.""" temporaryfile = "{filename}.temp".format(filename=filename) CHECKLINES = 10 section = [] lineschecked = 1 filterlines = elementlines = 0 # Read in the input and output files concurrently to allow filters to be saved as soon as they are finished with with open(filename, "r", encoding="utf-8", newline="\n") as inputfile, open( temporaryfile, "w", encoding="utf-8", newline="\n" ) as outputfile: # Combines domains for (further) identical rules def combinefilters(uncombinedFilters, DOMAINPATTERN, domainseparator): combinedFilters = [] for i in range(len(uncombinedFilters)): domains1 = re.search(DOMAINPATTERN, uncombinedFilters[i]) if i + 1 < len(uncombinedFilters) and domains1: domains2 = re.search(DOMAINPATTERN, uncombinedFilters[i + 1]) domain1str = domains1.group(1) if ( not domains1 or i + 1 == len(uncombinedFilters) or not domains2 or len(domain1str) == 0 or len(domains2.group(1)) == 0 ): # last filter or filter didn't match regex or no domains combinedFilters.append(uncombinedFilters[i]) else: domain2str = domains2.group(1) if domains1.group(0).replace( domain1str, domain2str, 1 ) != domains2.group(0): # non-identical filters shouldn't be combined combinedFilters.append(uncombinedFilters[i]) elif re.sub(DOMAINPATTERN, "", uncombinedFilters[i]) == re.sub( DOMAINPATTERN, "", uncombinedFilters[i + 1] ): # identical filters. Try to combine them... newDomains = "{d1}{sep}{d2}".format( d1=domain1str, sep=domainseparator, d2=domain2str ) newDomains = domainseparator.join( sorted( set(newDomains.split(domainseparator)), key=lambda domain: domain.strip("~"), ) ) if ( domain1str.count("~") != domain1str.count(domainseparator) + 1 ) != ( domain2str.count("~") != domain2str.count(domainseparator) + 1 ): # do not combine rules containing included domains with rules containing only excluded domains combinedFilters.append(uncombinedFilters[i]) else: # either both contain one or more included domains, or both contain only excluded domains domainssubstitute = domains1.group(0).replace( domain1str, newDomains, 1 ) uncombinedFilters[i + 1] = re.sub( DOMAINPATTERN, domainssubstitute, uncombinedFilters[i] ) else: # non-identical filters shouldn't be combined combinedFilters.append(uncombinedFilters[i]) return combinedFilters # Writes the filter lines to the file def writefilters(): if elementlines > filterlines: uncombinedFilters = sorted( set(section), key=lambda rule: re.sub(ELEMENTDOMAINPATTERN, "", rule), ) outputfile.write( "{filters}\n".format( filters="\n".join( combinefilters(uncombinedFilters, ELEMENTDOMAINPATTERN, ",") ) ) ) else: uncombinedFilters = sorted(set(section), key=str.lower) outputfile.write( "{filters}\n".format( filters="\n".join( combinefilters(uncombinedFilters, FILTERDOMAINPATTERN, "|") ) ) ) for line in inputfile: line = line.strip() if not re.match(BLANKPATTERN, line): # Include comments verbatim and, if applicable, sort the preceding section of filters and save them in the new version of the file if ( line[0] == "!" or line[:8] == "%include" or line[0] == "[" and line[-1] == "]" ): if section: writefilters() section = [] lineschecked = 1 filterlines = elementlines = 0 outputfile.write("{line}\n".format(line=line)) else: # Convert inject:script to +js line = line.replace("##script:inject", "##+js") # Neaten up filters and, if necessary, check their type for the sorting algorithm elementparts = re.match(ELEMENTPATTERN, line) if elementparts: domains = elementparts.group(1).lower() if lineschecked <= CHECKLINES: elementlines += 1 lineschecked += 1 line = elementtidy( domains, elementparts.group(2), elementparts.group(3) ) else: if lineschecked <= CHECKLINES: filterlines += 1 lineschecked += 1 line = filtertidy(line) # Add the filter to the section section.append(line) # At the end of the file, sort and save any remaining filters if section: writefilters() # Replace the existing file with the new one only if alterations have been made if not filecmp.cmp(temporaryfile, filename): # Check the operating system and, if it is Windows, delete the old file to avoid an exception (it is not possible to rename files to names already in use on this operating system) if os.name == "nt": os.remove(filename) os.rename(temporaryfile, filename) print("Sorted: {filename}".format(filename=os.path.abspath(filename))) else: os.remove(temporaryfile) def filtertidy(filterin): """ Sort the options of blocking filters and make the filter text lower case if applicable.""" optionsplit = re.match(OPTIONPATTERN, filterin) if not optionsplit: # Remove unnecessary asterisks from filters without any options and return them return removeunnecessarywildcards(filterin) else: # If applicable, separate and sort the filter options in addition to the filter text filtertext = removeunnecessarywildcards(optionsplit.group(1)) optionlist = optionsplit.group(2).lower().replace("_", "-").split(",") domainlist = [] removeentries = [] for option in optionlist: # Detect and separate domain options if option[0:7] == "domain=": domainlist.extend(option[7:].split("|")) removeentries.append(option) elif option.strip("~") not in KNOWNOPTIONS: print( 'Warning: The option "{option}" used on the filter "{problemfilter}" is not recognised by FOP'.format( option=option, problemfilter=filterin ) ) # Sort all options other than domain alphabetically # For identical options, the inverse always follows the non-inverse option ($image,~image instead of $~image,image) optionlist = sorted( set(filter(lambda option: option not in removeentries, optionlist)), key=lambda option: (option[1:] + "~") if option[0] == "~" else option, ) # If applicable, sort domain restrictions and append them to the list of options if domainlist: optionlist.append( "domain={domainlist}".format( domainlist="|".join( sorted(set(domainlist), key=lambda domain: domain.strip("~")) ) ) ) # Return the full filter return "{filtertext}${options}".format( filtertext=filtertext, options=",".join(optionlist) ) def elementtidy(domains, separator, selector): """ Sort the domains of element hiding rules, remove unnecessary tags and make the relevant sections of the rule lower case.""" # Order domain names alphabetically, ignoring exceptions if "," in domains: domains = ",".join( sorted(set(domains.split(",")), key=lambda domain: domain.strip("~")) ) # Mark the beginning and end of the selector with "@" selector = "@{selector}@".format(selector=selector) each = re.finditer # Make sure we don't match items in strings (e.g., don't touch Width in ##[style="height:1px; Width: 123px;"]) selectorwithoutstrings = selector selectoronlystrings = "" while True: stringmatch = re.match(ATTRIBUTEVALUEPATTERN, selectorwithoutstrings) if stringmatch == None: break selectorwithoutstrings = selectorwithoutstrings.replace( "{before}{stringpart}".format( before=stringmatch.group(1), stringpart=stringmatch.group(2) ), "{before}".format(before=stringmatch.group(1)), 1, ) selectoronlystrings = "{old}{new}".format( old=selectoronlystrings, new=stringmatch.group(2) ) # Clean up tree selectors for tree in each(TREESELECTOR, selector): if ( tree.group(0) in selectoronlystrings or not tree.group(0) in selectorwithoutstrings ): continue replaceby = " {g2} ".format(g2=tree.group(2)) if replaceby == " ": replaceby = " " selector = selector.replace( tree.group(0), "{g1}{replaceby}{g3}".format( g1=tree.group(1), replaceby=replaceby, g3=tree.group(3) ), 1, ) # Remove unnecessary tags for untag in each(REMOVALPATTERN, selector): untagname = untag.group(4) if untagname in selectoronlystrings or not untagname in selectorwithoutstrings: continue bc = untag.group(2) if bc == None: bc = untag.group(3) ac = untag.group(5) selector = selector.replace( "{before}{untag}{after}".format(before=bc, untag=untagname, after=ac), "{before}{after}".format(before=bc, after=ac), 1, ) # Make the remaining tags lower case wherever possible for tag in each(SELECTORPATTERN, selector): tagname = tag.group(1) if tagname in selectoronlystrings or not tagname in selectorwithoutstrings: continue if re.search(UNICODESELECTOR, selectorwithoutstrings) != None: break ac = tag.group(3) if ac == None: ac = tag.group(4) selector = selector.replace( "{tag}{after}".format(tag=tagname, after=ac), "{tag}{after}".format(tag=tagname.lower(), after=ac), 1, ) # Make pseudo classes lower case where possible for pseudo in each(PSEUDOPATTERN, selector): pseudoclass = pseudo.group(1) if ( pseudoclass in selectoronlystrings or not pseudoclass in selectorwithoutstrings ): continue ac = pseudo.group(3) selector = selector.replace( "{pclass}{after}".format(pclass=pseudoclass, after=ac), "{pclass}{after}".format(pclass=pseudoclass.lower(), after=ac), 1, ) # Remove the markers from the beginning and end of the selector and return the complete rule return "{domain}{separator}{selector}".format( domain=domains, separator=separator, selector=selector[1:-1] ) def commit(repository, basecommand, userchanges): """ Commit changes to a repository using the commands provided.""" difference = subprocess.check_output(basecommand + repository.difference) if not difference: print("\nNo changes have been recorded by the repository.") return print("\nThe following changes have been recorded by the repository:") try: print(difference.decode("utf-8")) except UnicodeEncodeError: print( "\nERROR: DIFF CONTAINED UNKNOWN CHARACTER(S). Showing unformatted diff instead:\n" ) print(difference) try: # Persistently request a suitable comment while True: comment = input("Please enter a valid commit comment or quit:\n") if checkcomment(comment, userchanges): break # Allow users to abort the commit process if they do not approve of the changes except (KeyboardInterrupt, SystemExit): print("\nCommit aborted.") return print('Comment "{comment}" accepted.'.format(comment=comment)) try: # Commit the changes command = basecommand + repository.commit + [comment] subprocess.Popen(command).communicate() print("\nConnecting to server. Please enter your password if required.") # Update the server repository as required by the revision control system for command in repository[7:]: command = basecommand + command subprocess.Popen(command).communicate() print() except (subprocess.CalledProcessError): print('Unexpected error with the command "{command}".'.format(command=command)) raise subprocess.CalledProcessError("Aborting FOP.") except (OSError): print('Unexpected error with the command "{command}".'.format(command=command)) raise OSError("Aborting FOP.") print("Completed commit process successfully.") def isglobalelement(domains): """ Check whether all domains are negations.""" for domain in domains.split(","): if domain and not domain.startswith("~"): return False return True def removeunnecessarywildcards(filtertext): # Where possible, remove unnecessary wildcards from the beginnings and ends of blocking filters. whitelist = False hadStar = False if filtertext[0:2] == "@@": whitelist = True filtertext = filtertext[2:] while ( len(filtertext) > 1 and filtertext[0] == "" and not filtertext[1] == "|" and not filtertext[1] == "!" ): filtertext = filtertext[1:] hadStar = True while len(filtertext) > 1 and filtertext[-1] == "" and not filtertext[-2] == "|": filtertext = filtertext[:-1] hadStar = True if hadStar and filtertext[0] == "/" and filtertext[-1] == "/": filtertext = "{filtertext}*".format(filtertext=filtertext) if filtertext == "": filtertext = "" if whitelist: filtertext = "@@{filtertext}".format(filtertext=filtertext) return filtertext def checkcomment(comment, changed): """ Check the commit comment and return True if the comment is acceptable and False if it is not.""" sections = re.match(COMMITPATTERN, comment) if sections == None: print( 'The comment "{comment}" is not in the recognised format.'.format( comment=comment ) ) else: indicator = sections.group(1) if indicator == "M": # Allow modification comments to have practically any format return True elif indicator == "A" or indicator == "P": if not changed: print( "You have indicated that you have added or removed a rule, but no changes were initially noted by the repository." ) else: address = sections.group(4) if not validurl(address): print('Unrecognised address "{address}".'.format(address=address)) else: # The user has changed the subscription and has written a suitable comment message with a valid address return True print() return False def validurl(url): """ Check that an address has a scheme (e.g. http), a domain name (e.g. example.com) and a path (e.g. /), or relates to the internal about system.""" addresspart = urlparse(url) if addresspart.scheme and addresspart.netloc and addresspart.path: return True elif addresspart.scheme == "about": return True else: return False if __name__ == "__main__": start()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 15945, 29908, 383, 4590, 13, 1678, 19916, 8170, 261, 322, 4721, 759, 13, 1678, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29896, 5765, 13, 13, 1678, 910, 1824, 338, 3889, 7047, 29901, 366, 508, 2654, 391, 2666, 372, 322, 29914, 272, 6623, 13, 1678, 372, 1090, 278, 4958, 310, 278, 15143, 4593, 5236, 19245, 408, 6369, 491, 13, 1678, 278, 12362, 18540, 10606, 29892, 2845, 1873, 29871, 29941, 310, 278, 19245, 29892, 470, 13, 1678, 313, 271, 596, 2984, 29897, 738, 2678, 1873, 29889, 13, 13, 1678, 910, 1824, 338, 13235, 297, 278, 4966, 393, 372, 674, 367, 5407, 29892, 13, 1678, 541, 399, 1806, 8187, 2692, 13764, 29979, 399, 1718, 29934, 13566, 29979, 29936, 1728, 1584, 278, 2411, 2957, 1370, 21867, 29891, 310, 13, 1678, 341, 1001, 3210, 13566, 2882, 6227, 11937, 470, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 2823, 278, 13, 1678, 15143, 4593, 5236, 19245, 363, 901, 4902, 29889, 13, 13, 1678, 887, 881, 505, 4520, 263, 3509, 310, 278, 15143, 4593, 5236, 19245, 13, 1678, 3412, 411, 445, 1824, 29889, 960, 451, 29892, 1074, 529, 1124, 597, 1636, 29889, 18713, 29889, 990, 29914, 506, 11259, 3779, 1213, 15945, 13, 29937, 383, 4590, 1873, 1353, 13, 16358, 353, 29871, 29941, 29889, 29929, 13, 13, 29937, 16032, 278, 1820, 10585, 13, 5215, 16250, 29892, 934, 21058, 29892, 2897, 29892, 337, 29892, 1014, 5014, 29892, 10876, 13, 5215, 1852, 5510, 13, 13, 481, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 481, 29889, 1202, 29918, 23516, 703, 489, 3972, 613, 11663, 29881, 613, 302, 5085, 543, 29974, 613, 1371, 543, 2697, 17525, 613, 2322, 29922, 8516, 29897, 13, 481, 29889, 1202, 29918, 23516, 29898, 13, 1678, 376, 489, 15060, 613, 11663, 29883, 613, 1371, 543, 20701, 9063, 4464, 613, 3158, 543, 8899, 29918, 3009, 613, 2322, 29922, 8824, 13, 29897, 13, 1191, 353, 3095, 29889, 5510, 29918, 5085, 580, 13, 13, 29937, 5399, 278, 1873, 310, 5132, 363, 4086, 24521, 322, 1014, 5014, 29889, 3198, 29918, 4905, 580, 13, 1529, 29967, 1955, 1525, 29984, 3120, 19386, 353, 29871, 29941, 13, 16173, 1955, 1525, 29984, 3120, 19386, 353, 29871, 29906, 13, 361, 10876, 29889, 3259, 29918, 3888, 529, 313, 1529, 29967, 1955, 1525, 29984, 3120, 19386, 29892, 341, 1177, 1955, 1525, 29984, 3120, 19386, 1125, 13, 1678, 12020, 24875, 2392, 29898, 13, 4706, 376, 29943, 4590, 6858, 5132, 426, 7971, 21355, 1836, 29912, 7971, 1195, 272, 29913, 470, 7621, 29892, 541, 5132, 426, 275, 21355, 1836, 29912, 275, 1195, 272, 29913, 338, 1641, 1304, 304, 1065, 445, 1824, 1213, 29889, 4830, 29898, 13, 9651, 12428, 21355, 29922, 1529, 29967, 1955, 1525, 29984, 3120, 19386, 29892, 13, 9651, 12428, 1195, 272, 29922, 16173, 1955, 1525, 29984, 3120, 19386, 29892, 13, 9651, 338, 21355, 29922, 9675, 29889, 3259, 29918, 3888, 29889, 21355, 29892, 13, 9651, 338, 1195, 272, 29922, 9675, 29889, 3259, 29918, 3888, 29889, 1195, 272, 29892, 13, 4706, 1723, 13, 1678, 1723, 13, 13, 29937, 16032, 263, 3883, 871, 3625, 297, 5132, 29871, 29941, 13, 3166, 3142, 1982, 29889, 5510, 1053, 3142, 5510, 13, 13, 29937, 3831, 488, 4943, 12241, 304, 1993, 4100, 4175, 5633, 313, 672, 2347, 515, 399, 4528, 17216, 3793, 424, 29915, 29879, 2087, 1271, 15113, 2752, 775, 29897, 13, 29923, 1307, 13780, 3970, 29032, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 29878, 29908, 29985, 4197, 3823, 7998, 17710, 4295, 29992, 5931, 29905, 29991, 14178, 7897, 29937, 29905, 29992, 29973, 29937, 1159, 13, 3738, 29931, 4945, 3970, 29032, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 29878, 29908, 10780, 3583, 29938, 4295, 29892, 29897, 7247, 29905, 29922, 4197, 3823, 2053, 29879, 10062, 1262, 1159, 13, 29923, 1307, 29924, 1430, 3557, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 29878, 29908, 29985, 4197, 3823, 7998, 17710, 4295, 29992, 5931, 29905, 29991, 14178, 29973, 5033, 29937, 29905, 29992, 29973, 29937, 29973, 29905, 29974, 7897, 4197, 998, 6525, 29974, 1262, 1159, 13, 14094, 2725, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 13, 1678, 364, 29908, 23733, 5575, 2144, 12330, 30022, 29973, 7110, 29893, 29905, 29899, 10062, 10780, 9361, 22896, 2053, 29879, 10062, 6877, 10780, 29901, 29892, 30022, 29973, 7110, 29893, 29905, 29899, 10062, 10780, 9361, 22896, 2053, 29879, 10062, 6877, 11877, 1262, 29908, 13, 29897, 13, 13, 29937, 3831, 488, 4943, 12241, 393, 1993, 1543, 8282, 322, 17381, 4413, 322, 6031, 322, 5447, 1831, 943, 29936, 376, 5507, 14088, 2845, 278, 6763, 470, 278, 1095, 310, 263, 11764, 13, 6404, 1955, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 13, 1678, 364, 29908, 10780, 14065, 7110, 29879, 29905, 17548, 2314, 4197, 29874, 29899, 25265, 29899, 29999, 14178, 29961, 29909, 29899, 29999, 3816, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29962, 7528, 3552, 29973, 29922, 4197, 29905, 7110, 10725, 3823, 17710, 29938, 29922, 26984, 29937, 29905, 5586, 876, 29989, 10780, 29922, 1194, 29879, 10780, 10834, 29974, 29958, 30022, 29962, 4295, 29930, 29989, 29961, 29874, 29899, 25265, 29899, 29999, 3816, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 14178, 7110, 7503, 29992, 29905, 29879, 29937, 29905, 5586, 29989, 29961, 29937, 23301, 3816, 29874, 29899, 25265, 29899, 29999, 3816, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 14178, 13697, 29908, 13, 29897, 13, 29925, 1660, 29965, 3970, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 29878, 29908, 1194, 10834, 29874, 29899, 25265, 29899, 29999, 29905, 29899, 14178, 29961, 29909, 29899, 29999, 3816, 29874, 29899, 25265, 29899, 29999, 29905, 29899, 14178, 5033, 29973, 29922, 4197, 29905, 1194, 3583, 29992, 29905, 29879, 12622, 1159, 13, 1525, 6720, 8932, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 29878, 29908, 3552, 29973, 14065, 4197, 29958, 29974, 30022, 29892, 10725, 29879, 876, 29989, 10780, 29966, 7607, 29992, 4295, 29879, 29989, 29892, 4961, 1194, 29930, 5033, 29973, 29922, 4197, 29937, 29905, 7790, 7110, 29901, 12622, 1159, 13, 1299, 29911, 3960, 29933, 26027, 19143, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 13, 1678, 364, 29908, 29985, 4197, 3823, 29915, 5931, 1966, 29962, 29989, 1966, 1846, 29930, 1194, 29908, 10780, 10834, 3823, 29908, 1966, 29962, 29989, 1966, 1846, 29930, 5931, 4295, 29915, 10780, 10834, 3823, 29915, 1966, 29962, 29989, 1966, 1846, 17710, 1495, 4295, 20605, 13, 29897, 13, 29911, 21661, 6404, 1955, 353, 337, 29889, 12198, 29898, 29878, 29908, 1194, 23301, 29989, 29961, 3823, 3124, 14247, 30022, 1966, 29905, 320, 29873, 29962, 2144, 29879, 29930, 4197, 29905, 3124, 14247, 2651, 320, 29873, 29962, 2144, 29879, 29930, 1194, 29928, 25760, 13, 3904, 2965, 29949, 2287, 6404, 1955, 353, 337, 29889, 12198, 29898, 29878, 29908, 1966, 29961, 29900, 29899, 29929, 29874, 29899, 29888, 29909, 29899, 29943, 3199, 29896, 29892, 29953, 1012, 29879, 29961, 29874, 29899, 25265, 29899, 29999, 14178, 29961, 29909, 29899, 29999, 29962, 1159, 13, 13, 29937, 3831, 488, 263, 4943, 4603, 393, 16612, 263, 6446, 9654, 1196, 13, 13367, 2190, 29968, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 29878, 29908, 3823, 29879, 29394, 1159, 13, 13, 29937, 3831, 488, 263, 4943, 4603, 393, 2854, 1078, 9063, 6589, 13, 3217, 7428, 1806, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 29898, 29878, 29908, 23733, 29909, 29989, 29924, 29989, 29925, 2144, 3583, 29879, 1194, 3552, 29889, 29974, 2144, 2144, 29879, 6877, 28104, 1262, 1159, 13, 13, 29937, 2391, 278, 2066, 393, 881, 451, 367, 12705, 29892, 2845, 1363, 896, 505, 263, 4266, 16548, 1788, 470, 1363, 896, 526, 451, 4175, 2066, 13, 6259, 6632, 1525, 353, 4852, 4905, 613, 376, 4905, 29918, 26705, 613, 376, 12277, 1860, 29889, 3945, 613, 376, 20943, 613, 376, 3177, 29918, 7576, 1159, 13, 13, 29937, 2391, 599, 318, 8456, 3987, 313, 19499, 292, 5354, 29892, 607, 338, 16459, 16949, 511, 408, 310, 1873, 29871, 29896, 29889, 29906, 29896, 29889, 29929, 29890, 29955, 13, 29937, 2045, 597, 3292, 29889, 510, 29914, 21208, 29131, 29914, 29884, 7445, 29914, 4594, 29914, 13770, 29899, 12284, 13, 29937, 18601, 363, 2087, 9485, 538, 29915, 29879, 4069, 322, 22326, 29946, 4175, 2045, 597, 3292, 29889, 510, 29914, 21208, 29131, 29914, 29884, 7445, 29914, 276, 17836, 29914, 4039, 29914, 29896, 29889, 29906, 29906, 29889, 29900, 13, 29968, 6632, 16048, 14094, 27946, 353, 313, 13, 1678, 376, 27756, 613, 13, 1678, 376, 29883, 1028, 613, 13, 1678, 376, 3225, 613, 13, 1678, 376, 20461, 11458, 613, 13, 1678, 376, 5657, 613, 13, 1678, 376, 19206, 1271, 613, 13, 1678, 376, 4738, 436, 680, 613, 13, 1678, 376, 6550, 361, 436, 680, 613, 13, 1678, 376, 3027, 613, 13, 1678, 376, 4352, 29899, 4878, 613, 13, 1678, 376, 3318, 613, 13, 1678, 376, 9799, 613, 13, 1678, 376, 3318, 29899, 1491, 3827, 613, 13, 1678, 376, 1228, 613, 13, 1678, 376, 15702, 613, 13, 1678, 376, 7323, 786, 613, 13, 1678, 376, 2154, 613, 13, 1678, 376, 13558, 613, 13, 1678, 376, 1491, 3225, 613, 13, 1678, 376, 22585, 29899, 22633, 613, 13, 1678, 376, 4102, 29899, 22633, 613, 13, 1678, 376, 29896, 29886, 613, 13, 1678, 376, 29941, 29886, 613, 13, 1678, 376, 14764, 29899, 2154, 613, 13, 1678, 376, 29916, 1092, 613, 13, 1678, 376, 2676, 11514, 613, 13, 1678, 376, 705, 1182, 14246, 613, 13, 1678, 376, 3134, 1124, 3827, 613, 13, 1678, 376, 17001, 613, 13, 1678, 376, 17886, 29922, 1484, 468, 1026, 351, 12847, 29918, 4141, 29885, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 3608, 29899, 7054, 22026, 29918, 3249, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 3608, 29899, 7054, 22026, 29918, 7054, 22026, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 1484, 468, 1026, 351, 9916, 29918, 29887, 415, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 3608, 29899, 7054, 22026, 29918, 18904, 29918, 2754, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 1484, 468, 793, 29891, 299, 293, 362, 29918, 7925, 1609, 3608, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 8896, 3808, 29918, 2611, 1633, 29918, 328, 29918, 4882, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 314, 407, 307, 622, 29918, 29894, 29900, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 1217, 459, 29889, 1315, 613, 13, 1678, 376, 17886, 29922, 1217, 459, 29889, 1420, 613, 13, 1678, 376, 17886, 29922, 1217, 459, 29889, 3945, 613, 13, 1678, 376, 17886, 29922, 1217, 459, 29899, 29900, 29889, 29896, 29879, 29889, 1526, 29941, 613, 13, 1678, 376, 17886, 29922, 1217, 459, 29899, 29896, 29879, 29889, 1526, 29946, 613, 13, 1678, 376, 17886, 29922, 29896, 29916, 29896, 29889, 18660, 613, 13, 1678, 376, 17886, 29922, 29906, 29916, 29906, 29889, 2732, 613, 13, 1678, 376, 17886, 29922, 29941, 29916, 29906, 29889, 2732, 613, 13, 1678, 376, 17886, 29922, 29941, 29906, 29916, 29941, 29906, 29889, 2732, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1484, 468, 1026, 351, 12847, 29918, 4141, 29885, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 3608, 29899, 7054, 22026, 29918, 3249, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 3608, 29899, 7054, 22026, 29918, 7054, 22026, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1484, 468, 1026, 351, 9916, 29918, 29887, 415, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 3608, 29899, 7054, 22026, 29918, 18904, 29918, 2754, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1484, 468, 793, 29891, 299, 293, 362, 29918, 7925, 1609, 3608, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 8896, 3808, 29918, 2611, 1633, 29918, 328, 29918, 4882, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 314, 407, 307, 622, 29918, 29894, 29900, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1217, 459, 29889, 1315, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1217, 459, 29889, 1420, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1217, 459, 29889, 3945, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1217, 459, 29899, 29900, 29889, 29896, 29879, 29889, 1526, 29941, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 1217, 459, 29899, 29896, 29879, 29889, 1526, 29946, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 29896, 29916, 29896, 29889, 18660, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 29906, 29916, 29906, 29889, 2732, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 29941, 29916, 29906, 29889, 2732, 613, 13, 1678, 376, 17886, 29899, 7491, 29922, 29941, 29906, 29916, 29941, 29906, 29889, 2732, 613, 13, 1678, 376, 6310, 613, 13, 1678, 376, 1526, 29946, 613, 13, 1678, 376, 29872, 11458, 613, 13, 1678, 376, 29887, 11458, 613, 13, 1678, 376, 845, 680, 613, 13, 29897, 13, 13, 29937, 2391, 278, 6969, 26554, 2761, 1788, 8260, 13, 1525, 13152, 24405, 353, 16250, 29889, 17514, 23583, 29898, 13, 1678, 376, 3445, 356, 29888, 613, 13, 1678, 376, 978, 29892, 3884, 29892, 4423, 3385, 29892, 1634, 397, 5554, 3385, 29892, 1423, 25990, 29892, 4328, 29892, 9063, 29892, 8206, 29892, 5503, 613, 13, 29897, 13, 29954, 1806, 353, 5195, 13152, 24405, 29898, 13, 1678, 6796, 5559, 12436, 13, 1678, 11393, 6294, 5559, 29914, 613, 13, 1678, 376, 489, 1287, 29899, 8336, 543, 29892, 13, 1678, 376, 489, 5559, 29899, 3972, 543, 29892, 13, 1678, 6796, 4882, 613, 11663, 29879, 613, 376, 489, 1657, 22282, 287, 29899, 5325, 29922, 1217, 12436, 13, 1678, 6796, 12765, 12436, 13, 1678, 6796, 15060, 613, 11663, 29874, 613, 11663, 29885, 12436, 13, 1678, 6796, 26746, 12436, 13, 1678, 6796, 5910, 12436, 13, 29897, 13, 29950, 29954, 353, 5195, 13152, 24405, 29898, 13, 1678, 6796, 29882, 29887, 12436, 13, 1678, 11393, 6294, 29882, 29887, 29914, 613, 13, 1678, 11663, 29934, 613, 13, 1678, 6213, 29892, 13, 1678, 6796, 6112, 613, 11663, 29939, 12436, 13, 1678, 6796, 12765, 12436, 13, 1678, 6796, 15060, 613, 11663, 29885, 12436, 13, 1678, 6796, 26746, 12436, 13, 1678, 6796, 5910, 12436, 13, 29897, 13, 1525, 29925, 2891, 29979, 29925, 2890, 353, 313, 29954, 1806, 29892, 379, 29954, 29897, 13, 13, 13, 1753, 1369, 7295, 13, 1678, 9995, 13905, 263, 1395, 15133, 2643, 322, 1065, 383, 4590, 297, 278, 17525, 13, 1678, 6790, 3025, 278, 1899, 1196, 29892, 470, 278, 1857, 1985, 3884, 565, 13, 1678, 694, 6273, 505, 1063, 4502, 1213, 15945, 13, 1678, 1395, 15133, 353, 376, 29943, 4590, 313, 5072, 8170, 261, 322, 4721, 759, 29897, 1873, 426, 3259, 29913, 1642, 4830, 29898, 13, 4706, 1873, 29922, 16358, 13, 1678, 1723, 13, 1678, 4890, 353, 7431, 29898, 710, 29898, 29887, 4521, 292, 876, 13, 1678, 1596, 703, 543, 334, 4890, 29897, 13, 1678, 1596, 29898, 29887, 4521, 292, 29897, 13, 1678, 1596, 703, 543, 334, 4890, 29897, 13, 13, 1678, 396, 14806, 278, 3884, 2983, 304, 8380, 9282, 322, 6493, 1269, 5412, 4423, 13, 1678, 7600, 353, 1852, 29889, 3972, 13, 1678, 565, 7600, 29901, 13, 4706, 7600, 353, 518, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 6689, 29897, 363, 2058, 297, 7600, 29962, 13, 4706, 363, 2058, 297, 12705, 29898, 842, 29898, 29886, 6048, 22164, 13, 9651, 1667, 29898, 6689, 29897, 13, 9651, 1596, 580, 13, 1678, 1683, 29901, 13, 4706, 1667, 29898, 359, 29889, 657, 29883, 9970, 3101, 13, 13, 13, 1753, 1667, 29898, 5479, 1125, 13, 1678, 9995, 10987, 322, 2656, 599, 278, 2066, 297, 263, 2183, 3884, 29892, 844, 5367, 13, 1678, 3620, 304, 263, 9810, 565, 697, 4864, 1213, 15945, 13, 1678, 396, 5399, 393, 278, 3884, 4864, 29892, 6467, 736, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 5479, 1125, 13, 4706, 1596, 703, 29912, 5479, 29913, 947, 451, 1863, 470, 338, 451, 263, 4138, 1213, 29889, 4830, 29898, 5479, 29922, 5479, 876, 13, 4706, 736, 13, 13, 1678, 396, 3789, 278, 9810, 1134, 2729, 373, 7934, 17525, 13, 1678, 9810, 353, 6213, 13, 1678, 363, 1634, 327, 668, 297, 5195, 29925, 2891, 29979, 29925, 2890, 29901, 13, 4706, 565, 2897, 29889, 2084, 29889, 275, 3972, 29898, 359, 29889, 2084, 29889, 7122, 29898, 5479, 29892, 1634, 327, 668, 29889, 12322, 22164, 13, 9651, 9810, 353, 1634, 327, 668, 13, 9651, 2867, 13, 1678, 396, 960, 445, 338, 263, 9810, 29892, 2407, 278, 2847, 3620, 29936, 565, 445, 8465, 29892, 2367, 701, 1811, 304, 671, 278, 9810, 13, 1678, 565, 9810, 29901, 13, 4706, 1018, 29901, 13, 9651, 2967, 6519, 353, 9810, 29889, 978, 13, 9651, 565, 9810, 29889, 5479, 3385, 29889, 1975, 2541, 703, 543, 1125, 13, 18884, 2967, 6519, 29889, 4397, 29898, 13, 462, 1678, 29850, 5479, 3385, 1157, 5479, 29913, 1642, 4830, 29898, 13, 462, 4706, 4423, 3385, 29922, 19033, 29889, 5479, 3385, 29892, 4423, 29922, 5479, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 2967, 6519, 29889, 21843, 4197, 19033, 29889, 5479, 3385, 29892, 4423, 2314, 13, 9651, 565, 9810, 29889, 3445, 397, 5554, 3385, 29901, 13, 18884, 565, 9810, 29889, 3445, 397, 5554, 3385, 29889, 1975, 2541, 703, 543, 1125, 13, 462, 1678, 2967, 6519, 29889, 4397, 29898, 13, 462, 4706, 29850, 3445, 397, 5554, 3385, 1157, 5479, 29913, 1642, 4830, 29898, 13, 462, 9651, 1634, 397, 5554, 3385, 29922, 19033, 29889, 3445, 397, 5554, 3385, 29892, 13, 462, 9651, 4423, 29922, 359, 29889, 2084, 29889, 12324, 2084, 29898, 13, 462, 18884, 2897, 29889, 2084, 29889, 7122, 29898, 5479, 29892, 9810, 29889, 12322, 29897, 13, 462, 9651, 10353, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 1683, 29901, 13, 462, 1678, 2967, 6519, 29889, 21843, 4197, 19033, 29889, 3445, 397, 5554, 3385, 29892, 4423, 2314, 13, 9651, 1899, 353, 2967, 6519, 718, 9810, 29889, 3198, 25990, 13, 9651, 2441, 29881, 17678, 353, 5852, 565, 1014, 5014, 29889, 3198, 29918, 4905, 29898, 6519, 29897, 1683, 7700, 13, 4706, 5174, 313, 1491, 5014, 29889, 29907, 4212, 7032, 2392, 29892, 438, 29173, 1125, 13, 9651, 1596, 29898, 13, 18884, 525, 1576, 1899, 29850, 6519, 5038, 471, 9368, 304, 1065, 29936, 383, 4590, 674, 5480, 451, 4218, 304, 671, 278, 9810, 8492, 29889, 1551, 3852, 29892, 445, 1122, 367, 385, 4221, 362, 393, 366, 437, 451, 505, 8002, 28091, 304, 1065, 383, 4590, 448, 278, 2684, 2769, 2020, 338, 9815, 29889, 3529, 884, 9801, 393, 596, 26554, 2761, 1788, 338, 5130, 5149, 322, 11098, 491, 383, 4590, 29889, 4286, 4830, 29898, 13, 462, 1678, 1899, 543, 11393, 7122, 29898, 6519, 29897, 13, 18884, 1723, 13, 9651, 1723, 13, 9651, 9810, 353, 6213, 13, 13, 1678, 396, 5244, 1549, 278, 3884, 322, 738, 1014, 11851, 3842, 29892, 5330, 8253, 7934, 17525, 13, 1678, 1596, 29898, 13, 4706, 6634, 29876, 26666, 4423, 29901, 426, 12083, 29913, 1642, 4830, 29898, 13, 9651, 4138, 29922, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 5479, 511, 20569, 13, 4706, 1723, 13, 1678, 1723, 13, 1678, 363, 2224, 29892, 17525, 29892, 2066, 297, 2897, 29889, 20919, 29898, 5479, 1125, 13, 4706, 363, 1513, 297, 17525, 7503, 5387, 13, 9651, 565, 1513, 29889, 27382, 2541, 17350, 1159, 470, 1513, 297, 306, 29954, 6632, 1525, 29901, 13, 18884, 17525, 29889, 5992, 29898, 11851, 29897, 13, 4706, 1596, 29898, 13, 9651, 376, 7583, 3884, 29901, 426, 12083, 29913, 1642, 4830, 29898, 13, 18884, 4138, 29922, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 2084, 511, 20569, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 17525, 29889, 6605, 580, 13, 4706, 363, 10422, 297, 12705, 29898, 5325, 1125, 13, 9651, 3211, 353, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 10422, 29897, 13, 9651, 6081, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 9507, 9601, 29896, 29962, 13, 9651, 396, 20025, 599, 1426, 2066, 393, 526, 451, 4628, 1761, 287, 13, 9651, 565, 6081, 1275, 11393, 3945, 29908, 322, 10422, 451, 297, 306, 29954, 6632, 1525, 29901, 13, 18884, 285, 3554, 441, 29898, 7328, 29897, 13, 9651, 396, 21267, 19039, 1250, 14340, 322, 13201, 2066, 13, 9651, 565, 6081, 1275, 11393, 12683, 29908, 470, 6081, 1275, 11393, 7382, 1115, 13, 18884, 1018, 29901, 13, 462, 1678, 2897, 29889, 5992, 29898, 7328, 29897, 13, 18884, 5174, 313, 5971, 2392, 29892, 438, 29173, 1125, 13, 462, 1678, 396, 18076, 487, 4436, 9819, 515, 21228, 2066, 29892, 408, 896, 5517, 12266, 393, 278, 934, 756, 2307, 1063, 11132, 13, 462, 1678, 1209, 13, 13, 1678, 396, 960, 297, 263, 9810, 29892, 5957, 304, 9063, 738, 3620, 13, 1678, 565, 9810, 322, 1852, 29889, 15060, 29901, 13, 4706, 9063, 29898, 19033, 29892, 2967, 6519, 29892, 2441, 29881, 17678, 29897, 13, 13, 13, 1753, 285, 3554, 441, 29898, 9507, 1125, 13, 1678, 9995, 20025, 278, 13926, 310, 278, 934, 322, 4078, 738, 26278, 1213, 15945, 13, 1678, 13201, 1445, 353, 29850, 9507, 1836, 7382, 1642, 4830, 29898, 9507, 29922, 9507, 29897, 13, 1678, 23557, 23714, 2890, 353, 29871, 29896, 29900, 13, 1678, 4004, 353, 5159, 13, 1678, 3454, 11238, 353, 29871, 29896, 13, 1678, 4175, 9012, 353, 1543, 9012, 353, 29871, 29900, 13, 13, 1678, 396, 7523, 297, 278, 1881, 322, 1962, 2066, 21984, 368, 304, 2758, 18094, 304, 367, 7160, 408, 4720, 408, 896, 526, 7743, 411, 13, 1678, 411, 1722, 29898, 9507, 29892, 376, 29878, 613, 8025, 543, 9420, 29899, 29947, 613, 25899, 543, 29905, 29876, 1159, 408, 1881, 1445, 29892, 1722, 29898, 13, 4706, 13201, 1445, 29892, 376, 29893, 613, 8025, 543, 9420, 29899, 29947, 613, 25899, 543, 29905, 29876, 29908, 13, 1678, 1723, 408, 1962, 1445, 29901, 13, 13, 4706, 396, 422, 29890, 1475, 21904, 363, 313, 22613, 721, 29897, 13557, 6865, 13, 4706, 822, 14405, 26705, 29898, 348, 17743, 1312, 3434, 2153, 29892, 11662, 29032, 29925, 1299, 4945, 29940, 29892, 5354, 344, 17954, 1125, 13, 9651, 12420, 3434, 2153, 353, 5159, 13, 9651, 363, 474, 297, 3464, 29898, 2435, 29898, 348, 17743, 1312, 3434, 2153, 22164, 13, 18884, 21904, 29896, 353, 337, 29889, 4478, 29898, 3970, 29032, 29925, 1299, 4945, 29940, 29892, 443, 17743, 1312, 3434, 2153, 29961, 29875, 2314, 13, 18884, 565, 474, 718, 29871, 29896, 529, 7431, 29898, 348, 17743, 1312, 3434, 2153, 29897, 322, 21904, 29896, 29901, 13, 462, 1678, 21904, 29906, 353, 337, 29889, 4478, 29898, 3970, 29032, 29925, 1299, 4945, 29940, 29892, 443, 17743, 1312, 3434, 2153, 29961, 29875, 718, 29871, 29896, 2314, 13, 462, 1678, 5354, 29896, 710, 353, 21904, 29896, 29889, 2972, 29898, 29896, 29897, 13, 13, 18884, 565, 313, 13, 462, 1678, 451, 21904, 29896, 13, 462, 1678, 470, 474, 718, 29871, 29896, 1275, 7431, 29898, 348, 17743, 1312, 3434, 2153, 29897, 13, 462, 1678, 470, 451, 21904, 29906, 13, 462, 1678, 470, 7431, 29898, 7247, 29896, 710, 29897, 1275, 29871, 29900, 13, 462, 1678, 470, 7431, 29898, 3129, 2708, 29906, 29889, 2972, 29898, 29896, 876, 1275, 29871, 29900, 13, 462, 1125, 13, 462, 1678, 396, 1833, 4175, 470, 4175, 3282, 29915, 29873, 1993, 6528, 470, 694, 21904, 13, 462, 1678, 12420, 3434, 2153, 29889, 4397, 29898, 348, 17743, 1312, 3434, 2153, 29961, 29875, 2314, 13, 18884, 1683, 29901, 13, 462, 1678, 5354, 29906, 710, 353, 21904, 29906, 29889, 2972, 29898, 29896, 29897, 13, 462, 1678, 565, 21904, 29896, 29889, 2972, 29898, 29900, 467, 6506, 29898, 13, 462, 4706, 5354, 29896, 710, 29892, 5354, 29906, 710, 29892, 29871, 29896, 13, 462, 1678, 1723, 2804, 21904, 29906, 29889, 2972, 29898, 29900, 1125, 13, 462, 4706, 396, 1661, 29899, 1693, 936, 18094, 9273, 29915, 29873, 367, 12420, 13, 462, 4706, 12420, 3434, 2153, 29889, 4397, 29898, 348, 17743, 1312, 3434, 2153, 29961, 29875, 2314, 13, 462, 1678, 25342, 337, 29889, 1491, 29898, 3970, 29032, 29925, 1299, 4945, 29940, 29892, 12633, 443, 17743, 1312, 3434, 2153, 29961, 29875, 2314, 1275, 337, 29889, 1491, 29898, 13, 462, 4706, 11662, 29032, 29925, 1299, 4945, 29940, 29892, 12633, 443, 17743, 1312, 3434, 2153, 29961, 29875, 718, 29871, 29896, 29962, 13, 462, 268, 1125, 13, 462, 4706, 396, 13557, 18094, 29889, 3967, 304, 14405, 963, 856, 13, 462, 4706, 716, 11096, 2708, 353, 29850, 29881, 29896, 1157, 19570, 1157, 29881, 29906, 29913, 1642, 4830, 29898, 13, 462, 9651, 270, 29896, 29922, 7247, 29896, 710, 29892, 16345, 29922, 7247, 344, 17954, 29892, 270, 29906, 29922, 7247, 29906, 710, 13, 462, 4706, 1723, 13, 462, 4706, 716, 11096, 2708, 353, 5354, 344, 17954, 29889, 7122, 29898, 13, 462, 9651, 12705, 29898, 13, 462, 18884, 731, 29898, 1482, 11096, 2708, 29889, 5451, 29898, 7247, 344, 17954, 8243, 13, 462, 18884, 1820, 29922, 2892, 5354, 29901, 5354, 29889, 17010, 703, 30022, 4968, 13, 462, 9651, 1723, 13, 462, 4706, 1723, 13, 462, 4706, 565, 313, 13, 462, 9651, 5354, 29896, 710, 29889, 2798, 703, 30022, 1159, 13, 462, 9651, 2804, 5354, 29896, 710, 29889, 2798, 29898, 7247, 344, 17954, 29897, 718, 29871, 29896, 13, 462, 4706, 1723, 2804, 313, 13, 462, 9651, 5354, 29906, 710, 29889, 2798, 703, 30022, 1159, 13, 462, 9651, 2804, 5354, 29906, 710, 29889, 2798, 29898, 7247, 344, 17954, 29897, 718, 29871, 29896, 13, 462, 308, 1125, 13, 462, 9651, 396, 437, 451, 14405, 6865, 6943, 5134, 21904, 411, 6865, 6943, 871, 429, 13347, 21904, 13, 462, 9651, 12420, 3434, 2153, 29889, 4397, 29898, 348, 17743, 1312, 3434, 2153, 29961, 29875, 2314, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 396, 2845, 1716, 1712, 697, 470, 901, 5134, 21904, 29892, 470, 1716, 1712, 871, 429, 13347, 21904, 13, 462, 9651, 5354, 893, 431, 303, 12356, 353, 21904, 29896, 29889, 2972, 29898, 29900, 467, 6506, 29898, 13, 462, 18884, 5354, 29896, 710, 29892, 716, 11096, 2708, 29892, 29871, 29896, 13, 462, 9651, 1723, 13, 462, 9651, 443, 17743, 1312, 3434, 2153, 29961, 29875, 718, 29871, 29896, 29962, 353, 337, 29889, 1491, 29898, 13, 462, 18884, 11662, 29032, 29925, 1299, 4945, 29940, 29892, 5354, 893, 431, 303, 12356, 29892, 443, 17743, 1312, 3434, 2153, 29961, 29875, 29962, 13, 462, 9651, 1723, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 396, 1661, 29899, 1693, 936, 18094, 9273, 29915, 29873, 367, 12420, 13, 462, 4706, 12420, 3434, 2153, 29889, 4397, 29898, 348, 17743, 1312, 3434, 2153, 29961, 29875, 2314, 13, 9651, 736, 12420, 3434, 2153, 13, 13, 4706, 396, 16849, 267, 278, 4175, 3454, 304, 278, 934, 13, 4706, 822, 2436, 26705, 7295, 13, 9651, 565, 1543, 9012, 1405, 4175, 9012, 29901, 13, 18884, 443, 17743, 1312, 3434, 2153, 353, 12705, 29898, 13, 462, 1678, 731, 29898, 2042, 511, 13, 462, 1678, 1820, 29922, 2892, 5751, 29901, 337, 29889, 1491, 29898, 29923, 1307, 13780, 3970, 29032, 29925, 1299, 4945, 29940, 29892, 12633, 5751, 511, 13, 18884, 1723, 13, 18884, 1962, 1445, 29889, 3539, 29898, 13, 462, 1678, 29850, 26705, 1012, 29876, 1642, 4830, 29898, 13, 462, 4706, 18094, 543, 29905, 29876, 1642, 7122, 29898, 13, 462, 9651, 14405, 26705, 29898, 348, 17743, 1312, 3434, 2153, 29892, 382, 1307, 13780, 3970, 29032, 29925, 1299, 4945, 29940, 29892, 9162, 1159, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 443, 17743, 1312, 3434, 2153, 353, 12705, 29898, 842, 29898, 2042, 511, 1820, 29922, 710, 29889, 13609, 29897, 13, 18884, 1962, 1445, 29889, 3539, 29898, 13, 462, 1678, 29850, 26705, 1012, 29876, 1642, 4830, 29898, 13, 462, 4706, 18094, 543, 29905, 29876, 1642, 7122, 29898, 13, 462, 9651, 14405, 26705, 29898, 348, 17743, 1312, 3434, 2153, 29892, 383, 6227, 4945, 3970, 29032, 29925, 1299, 4945, 29940, 29892, 376, 29989, 1159, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 13, 4706, 363, 1196, 297, 1881, 1445, 29901, 13, 9651, 1196, 353, 1196, 29889, 17010, 580, 13, 9651, 565, 451, 337, 29889, 4352, 29898, 13367, 2190, 29968, 29925, 1299, 4945, 29940, 29892, 1196, 1125, 13, 18884, 396, 512, 2325, 6589, 9750, 271, 326, 322, 29892, 565, 22903, 29892, 2656, 278, 26328, 4004, 310, 18094, 322, 4078, 963, 297, 278, 716, 1873, 310, 278, 934, 13, 18884, 565, 313, 13, 462, 1678, 1196, 29961, 29900, 29962, 1275, 376, 3850, 13, 462, 1678, 470, 1196, 7503, 29947, 29962, 1275, 11860, 2856, 29908, 13, 462, 1678, 470, 1196, 29961, 29900, 29962, 1275, 376, 3366, 13, 462, 1678, 322, 1196, 14352, 29896, 29962, 1275, 376, 18017, 13, 462, 1125, 13, 462, 1678, 565, 4004, 29901, 13, 462, 4706, 2436, 26705, 580, 13, 462, 4706, 4004, 353, 5159, 13, 462, 4706, 3454, 11238, 353, 29871, 29896, 13, 462, 4706, 4175, 9012, 353, 1543, 9012, 353, 29871, 29900, 13, 462, 1678, 1962, 1445, 29889, 3539, 703, 29912, 1220, 1012, 29876, 1642, 4830, 29898, 1220, 29922, 1220, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 14806, 11658, 29901, 2154, 304, 718, 1315, 13, 462, 1678, 1196, 353, 1196, 29889, 6506, 703, 2277, 2154, 29901, 21920, 613, 376, 2277, 29974, 1315, 1159, 13, 462, 1678, 396, 2448, 2579, 701, 18094, 322, 29892, 565, 5181, 29892, 1423, 1009, 1134, 363, 278, 16548, 5687, 13, 462, 1678, 1543, 20895, 353, 337, 29889, 4352, 29898, 29923, 1307, 29924, 1430, 3557, 1299, 4945, 29940, 29892, 1196, 29897, 13, 462, 1678, 565, 1543, 20895, 29901, 13, 462, 4706, 21904, 353, 1543, 20895, 29889, 2972, 29898, 29896, 467, 13609, 580, 13, 462, 4706, 565, 3454, 11238, 5277, 23557, 23714, 2890, 29901, 13, 462, 9651, 1543, 9012, 4619, 29871, 29896, 13, 462, 9651, 3454, 11238, 4619, 29871, 29896, 13, 462, 4706, 1196, 353, 1543, 17681, 29891, 29898, 13, 462, 9651, 21904, 29892, 1543, 20895, 29889, 2972, 29898, 29906, 511, 1543, 20895, 29889, 2972, 29898, 29941, 29897, 13, 462, 4706, 1723, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 565, 3454, 11238, 5277, 23557, 23714, 2890, 29901, 13, 462, 9651, 4175, 9012, 4619, 29871, 29896, 13, 462, 9651, 3454, 11238, 4619, 29871, 29896, 13, 462, 4706, 1196, 353, 4175, 17681, 29891, 29898, 1220, 29897, 13, 462, 1678, 396, 3462, 278, 4175, 304, 278, 4004, 13, 462, 1678, 4004, 29889, 4397, 29898, 1220, 29897, 13, 4706, 396, 2180, 278, 1095, 310, 278, 934, 29892, 2656, 322, 4078, 738, 9886, 18094, 13, 4706, 565, 4004, 29901, 13, 9651, 2436, 26705, 580, 13, 13, 1678, 396, 22108, 278, 5923, 934, 411, 278, 716, 697, 871, 565, 10551, 800, 505, 1063, 1754, 13, 1678, 565, 451, 934, 21058, 29889, 21058, 29898, 1356, 1971, 653, 1445, 29892, 10422, 1125, 13, 4706, 396, 5399, 278, 13598, 1788, 322, 29892, 565, 372, 338, 3852, 29892, 5217, 278, 2030, 934, 304, 4772, 385, 3682, 313, 277, 338, 451, 1950, 304, 19508, 2066, 304, 2983, 2307, 297, 671, 373, 445, 13598, 1788, 29897, 13, 4706, 565, 2897, 29889, 978, 1275, 376, 593, 1115, 13, 9651, 2897, 29889, 5992, 29898, 9507, 29897, 13, 4706, 2897, 29889, 1267, 420, 29898, 1356, 1971, 653, 1445, 29892, 10422, 29897, 13, 4706, 1596, 703, 13685, 287, 29901, 426, 9507, 29913, 1642, 4830, 29898, 9507, 29922, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 9507, 4961, 13, 1678, 1683, 29901, 13, 4706, 2897, 29889, 5992, 29898, 1356, 1971, 653, 1445, 29897, 13, 13, 13, 1753, 4175, 17681, 29891, 29898, 4572, 262, 1125, 13, 1678, 9995, 20025, 278, 3987, 310, 23473, 18094, 322, 1207, 278, 4175, 1426, 13, 1678, 5224, 1206, 565, 22903, 1213, 15945, 13, 1678, 3987, 2830, 353, 337, 29889, 4352, 29898, 14094, 2725, 29925, 1299, 4945, 29940, 29892, 4175, 262, 29897, 13, 13, 1678, 565, 451, 3987, 2830, 29901, 13, 4706, 396, 15154, 19039, 263, 2475, 275, 2039, 515, 18094, 1728, 738, 3987, 322, 736, 963, 13, 4706, 736, 3349, 348, 15107, 653, 29893, 789, 28160, 29898, 4572, 262, 29897, 13, 1678, 1683, 29901, 13, 4706, 396, 960, 22903, 29892, 5004, 322, 2656, 278, 4175, 3987, 297, 6124, 304, 278, 4175, 1426, 13, 4706, 4175, 726, 353, 3349, 348, 15107, 653, 29893, 789, 28160, 29898, 6768, 2830, 29889, 2972, 29898, 29896, 876, 13, 4706, 2984, 1761, 353, 3987, 2830, 29889, 2972, 29898, 29906, 467, 13609, 2141, 6506, 703, 29918, 613, 11663, 2564, 5451, 28165, 1159, 13, 13, 4706, 5354, 1761, 353, 5159, 13, 4706, 3349, 26586, 353, 5159, 13, 4706, 363, 2984, 297, 2984, 1761, 29901, 13, 9651, 396, 5953, 522, 322, 5004, 5354, 3987, 13, 9651, 565, 2984, 29961, 29900, 29901, 29955, 29962, 1275, 376, 7247, 543, 29901, 13, 18884, 5354, 1761, 29889, 21843, 29898, 3385, 29961, 29955, 29901, 1822, 5451, 703, 29989, 5783, 13, 18884, 3349, 26586, 29889, 4397, 29898, 3385, 29897, 13, 9651, 25342, 2984, 29889, 17010, 703, 30022, 1159, 451, 297, 476, 6632, 16048, 14094, 27946, 29901, 13, 18884, 1596, 29898, 13, 462, 1678, 525, 22709, 29901, 450, 2984, 29850, 3385, 5038, 1304, 373, 278, 4175, 29850, 17199, 4572, 5038, 338, 451, 5936, 3368, 491, 383, 4590, 4286, 4830, 29898, 13, 462, 4706, 2984, 29922, 3385, 29892, 1108, 4572, 29922, 4572, 262, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 4706, 396, 20025, 599, 3987, 916, 1135, 5354, 22968, 1711, 13, 4706, 396, 1152, 13557, 3987, 29892, 278, 16402, 2337, 4477, 278, 1661, 29899, 262, 3901, 2984, 3255, 3027, 29892, 30022, 3027, 2012, 310, 395, 30022, 3027, 29892, 3027, 29897, 13, 4706, 2984, 1761, 353, 12705, 29898, 13, 9651, 731, 29898, 4572, 29898, 2892, 2984, 29901, 2984, 451, 297, 3349, 26586, 29892, 2984, 1761, 8243, 13, 9651, 1820, 29922, 2892, 2984, 29901, 313, 3385, 29961, 29896, 17531, 718, 376, 30022, 1159, 565, 2984, 29961, 29900, 29962, 1275, 376, 30022, 29908, 1683, 2984, 29892, 13, 4706, 1723, 13, 4706, 396, 960, 22903, 29892, 2656, 5354, 25091, 322, 9773, 963, 304, 278, 1051, 310, 3987, 13, 4706, 565, 5354, 1761, 29901, 13, 9651, 2984, 1761, 29889, 4397, 29898, 13, 18884, 376, 7247, 3790, 7247, 1761, 29913, 1642, 4830, 29898, 13, 462, 1678, 5354, 1761, 543, 29989, 1642, 7122, 29898, 13, 462, 4706, 12705, 29898, 842, 29898, 7247, 1761, 511, 1820, 29922, 2892, 5354, 29901, 5354, 29889, 17010, 703, 30022, 5783, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 9651, 1723, 13, 13, 4706, 396, 7106, 278, 2989, 4175, 13, 4706, 736, 29850, 4572, 726, 1042, 29912, 6768, 29913, 1642, 4830, 29898, 13, 9651, 4175, 726, 29922, 4572, 726, 29892, 3987, 543, 29892, 1642, 7122, 29898, 3385, 1761, 29897, 13, 4706, 1723, 13, 13, 13, 1753, 1543, 17681, 29891, 29898, 3129, 2708, 29892, 28128, 29892, 11764, 1125, 13, 1678, 9995, 20025, 278, 21904, 310, 1543, 25508, 6865, 29892, 3349, 19039, 13, 1678, 8282, 322, 1207, 278, 8018, 13926, 310, 278, 5751, 5224, 1206, 1213, 15945, 13, 1678, 396, 8170, 5354, 2983, 22968, 1711, 29892, 5330, 8253, 15283, 13, 1678, 565, 28796, 297, 21904, 29901, 13, 4706, 21904, 353, 9162, 1642, 7122, 29898, 13, 9651, 12705, 29898, 842, 29898, 3129, 2708, 29889, 5451, 28165, 1159, 511, 1820, 29922, 2892, 5354, 29901, 5354, 29889, 17010, 703, 30022, 5783, 13, 4706, 1723, 13, 1678, 396, 4485, 278, 6763, 322, 1095, 310, 278, 11764, 411, 376, 5507, 13, 1678, 11764, 353, 17962, 29912, 14357, 29913, 29992, 1642, 4830, 29898, 14357, 29922, 14357, 29897, 13, 1678, 1269, 353, 337, 29889, 2886, 1524, 13, 1678, 396, 8561, 1854, 591, 1016, 29915, 29873, 1993, 4452, 297, 6031, 313, 29872, 29889, 29887, 1696, 1016, 29915, 29873, 6023, 21485, 297, 444, 29961, 3293, 543, 3545, 29901, 29896, 1756, 29936, 21485, 29901, 29871, 29896, 29906, 29941, 1756, 15458, 2314, 13, 1678, 11764, 14037, 19651, 353, 11764, 13, 1678, 11764, 6194, 19651, 353, 5124, 13, 1678, 1550, 5852, 29901, 13, 4706, 1347, 4352, 353, 337, 29889, 4352, 29898, 1299, 29911, 3960, 29933, 26027, 19143, 29925, 1299, 4945, 29940, 29892, 11764, 14037, 19651, 29897, 13, 4706, 565, 1347, 4352, 1275, 6213, 29901, 13, 9651, 2867, 13, 4706, 11764, 14037, 19651, 353, 11764, 14037, 19651, 29889, 6506, 29898, 13, 9651, 29850, 11083, 1157, 1807, 1595, 29913, 1642, 4830, 29898, 13, 18884, 1434, 29922, 1807, 4352, 29889, 2972, 29898, 29896, 511, 1347, 1595, 29922, 1807, 4352, 29889, 2972, 29898, 29906, 29897, 13, 9651, 10353, 13, 9651, 29850, 11083, 29913, 1642, 4830, 29898, 11083, 29922, 1807, 4352, 29889, 2972, 29898, 29896, 8243, 13, 632, 29896, 29892, 13, 4706, 1723, 13, 4706, 11764, 6194, 19651, 353, 29850, 1025, 1157, 1482, 29913, 1642, 4830, 29898, 13, 9651, 2030, 29922, 14357, 6194, 19651, 29892, 716, 29922, 1807, 4352, 29889, 2972, 29898, 29906, 29897, 13, 4706, 1723, 13, 1678, 396, 315, 14044, 701, 5447, 1831, 943, 13, 1678, 363, 5447, 297, 1269, 29898, 29911, 21661, 6404, 1955, 29892, 11764, 1125, 13, 4706, 565, 313, 13, 9651, 5447, 29889, 2972, 29898, 29900, 29897, 297, 11764, 6194, 19651, 13, 9651, 470, 451, 5447, 29889, 2972, 29898, 29900, 29897, 297, 11764, 14037, 19651, 13, 308, 1125, 13, 9651, 6773, 13, 4706, 5191, 1609, 353, 376, 426, 29887, 29906, 29913, 11393, 4830, 29898, 29887, 29906, 29922, 8336, 29889, 2972, 29898, 29906, 876, 13, 4706, 565, 5191, 1609, 1275, 376, 259, 29242, 13, 9651, 5191, 1609, 353, 376, 376, 13, 4706, 11764, 353, 11764, 29889, 6506, 29898, 13, 9651, 5447, 29889, 2972, 29898, 29900, 511, 13, 9651, 29850, 29887, 29896, 1157, 6506, 1609, 1157, 29887, 29941, 29913, 1642, 4830, 29898, 13, 18884, 330, 29896, 29922, 8336, 29889, 2972, 29898, 29896, 511, 5191, 1609, 29922, 6506, 1609, 29892, 330, 29941, 29922, 8336, 29889, 2972, 29898, 29941, 29897, 13, 9651, 10353, 13, 632, 29896, 29892, 13, 4706, 1723, 13, 1678, 396, 15154, 19039, 8282, 13, 1678, 363, 443, 4039, 297, 1269, 29898, 1525, 6720, 8932, 29925, 1299, 4945, 29940, 29892, 11764, 1125, 13, 4706, 443, 4039, 978, 353, 443, 4039, 29889, 2972, 29898, 29946, 29897, 13, 4706, 565, 443, 4039, 978, 297, 11764, 6194, 19651, 470, 451, 443, 4039, 978, 297, 11764, 14037, 19651, 29901, 13, 9651, 6773, 13, 4706, 289, 29883, 353, 443, 4039, 29889, 2972, 29898, 29906, 29897, 13, 4706, 565, 289, 29883, 1275, 6213, 29901, 13, 9651, 289, 29883, 353, 443, 4039, 29889, 2972, 29898, 29941, 29897, 13, 4706, 1274, 353, 443, 4039, 29889, 2972, 29898, 29945, 29897, 13, 4706, 11764, 353, 11764, 29889, 6506, 29898, 13, 9651, 29850, 11083, 1157, 1657, 351, 1157, 7045, 29913, 1642, 4830, 29898, 11083, 29922, 12328, 29892, 443, 4039, 29922, 1657, 351, 978, 29892, 1156, 29922, 562, 511, 13, 9651, 29850, 11083, 1157, 7045, 29913, 1642, 4830, 29898, 11083, 29922, 12328, 29892, 1156, 29922, 562, 511, 13, 632, 29896, 29892, 13, 4706, 1723, 13, 1678, 396, 8561, 278, 9886, 8282, 5224, 1206, 29693, 1950, 13, 1678, 363, 4055, 297, 1269, 29898, 6404, 1955, 29925, 1299, 4945, 29940, 29892, 11764, 1125, 13, 4706, 4055, 978, 353, 4055, 29889, 2972, 29898, 29896, 29897, 13, 4706, 565, 4055, 978, 297, 11764, 6194, 19651, 470, 451, 4055, 978, 297, 11764, 14037, 19651, 29901, 13, 9651, 6773, 13, 4706, 565, 337, 29889, 4478, 29898, 3904, 2965, 29949, 2287, 6404, 1955, 29892, 11764, 14037, 19651, 29897, 2804, 6213, 29901, 13, 9651, 2867, 13, 4706, 1274, 353, 4055, 29889, 2972, 29898, 29941, 29897, 13, 4706, 565, 1274, 1275, 6213, 29901, 13, 9651, 1274, 353, 4055, 29889, 2972, 29898, 29946, 29897, 13, 4706, 11764, 353, 11764, 29889, 6506, 29898, 13, 9651, 29850, 4039, 1157, 7045, 29913, 1642, 4830, 29898, 4039, 29922, 4039, 978, 29892, 1156, 29922, 562, 511, 13, 9651, 29850, 4039, 1157, 7045, 29913, 1642, 4830, 29898, 4039, 29922, 4039, 978, 29889, 13609, 3285, 1156, 29922, 562, 511, 13, 632, 29896, 29892, 13, 4706, 1723, 13, 1678, 396, 8561, 17381, 4413, 5224, 1206, 988, 1950, 13, 1678, 363, 17381, 297, 1269, 29898, 29925, 1660, 29965, 3970, 29925, 1299, 4945, 29940, 29892, 11764, 1125, 13, 4706, 19923, 542, 605, 353, 17381, 29889, 2972, 29898, 29896, 29897, 13, 4706, 565, 313, 13, 9651, 19923, 542, 605, 297, 11764, 6194, 19651, 13, 9651, 470, 451, 19923, 542, 605, 297, 11764, 14037, 19651, 13, 308, 1125, 13, 9651, 6773, 13, 4706, 1274, 353, 17381, 29889, 2972, 29898, 29941, 29897, 13, 4706, 11764, 353, 11764, 29889, 6506, 29898, 13, 9651, 29850, 29886, 1990, 1157, 7045, 29913, 1642, 4830, 29898, 29886, 1990, 29922, 27358, 566, 542, 605, 29892, 1156, 29922, 562, 511, 13, 9651, 29850, 29886, 1990, 1157, 7045, 29913, 1642, 4830, 29898, 29886, 1990, 29922, 27358, 566, 542, 605, 29889, 13609, 3285, 1156, 29922, 562, 511, 13, 632, 29896, 29892, 13, 4706, 1723, 13, 1678, 396, 15154, 278, 29320, 515, 278, 6763, 322, 1095, 310, 278, 11764, 322, 736, 278, 4866, 5751, 13, 1678, 736, 29850, 7247, 1157, 344, 17954, 1157, 14357, 29913, 1642, 4830, 29898, 13, 4706, 5354, 29922, 3129, 2708, 29892, 28128, 29922, 344, 17954, 29892, 11764, 29922, 14357, 29961, 29896, 13018, 29896, 29962, 13, 1678, 1723, 13, 13, 13, 1753, 9063, 29898, 19033, 29892, 2967, 6519, 29892, 1404, 25990, 1125, 13, 1678, 9995, 1876, 277, 3620, 304, 263, 9810, 773, 278, 8260, 4944, 1213, 15945, 13, 1678, 4328, 353, 1014, 5014, 29889, 3198, 29918, 4905, 29898, 3188, 6519, 718, 9810, 29889, 29881, 17678, 29897, 13, 1678, 565, 451, 4328, 29901, 13, 4706, 1596, 14182, 29876, 3782, 3620, 505, 1063, 10478, 491, 278, 9810, 23157, 13, 4706, 736, 13, 1678, 1596, 14182, 29876, 1576, 1494, 3620, 505, 1063, 10478, 491, 278, 9810, 29901, 1159, 13, 1678, 1018, 29901, 13, 4706, 1596, 29898, 29881, 17678, 29889, 13808, 703, 9420, 29899, 29947, 5783, 13, 1678, 5174, 23862, 2369, 401, 2392, 29901, 13, 4706, 1596, 29898, 13, 9651, 6634, 29876, 11432, 29901, 22471, 4198, 8707, 6040, 1177, 3352, 8291, 29968, 6632, 16048, 26871, 17923, 1001, 29898, 29903, 467, 7704, 292, 443, 689, 19667, 2923, 2012, 3583, 29876, 29908, 13, 4706, 1723, 13, 4706, 1596, 29898, 29881, 17678, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 396, 9034, 391, 2705, 2009, 263, 13907, 3440, 13, 4706, 1550, 5852, 29901, 13, 9651, 3440, 353, 1881, 703, 12148, 3896, 263, 2854, 9063, 3440, 470, 23283, 3583, 29876, 1159, 13, 9651, 565, 1423, 9342, 29898, 9342, 29892, 1404, 25990, 1125, 13, 18884, 2867, 13, 1678, 396, 29408, 4160, 304, 27450, 278, 9063, 1889, 565, 896, 437, 451, 2134, 345, 310, 278, 3620, 13, 1678, 5174, 313, 2558, 3377, 4074, 6685, 29892, 2184, 24365, 1125, 13, 4706, 1596, 14182, 29876, 1523, 2415, 633, 18054, 23157, 13, 4706, 736, 13, 13, 1678, 1596, 877, 20001, 29850, 9342, 5038, 9259, 29889, 4286, 4830, 29898, 9342, 29922, 9342, 876, 13, 1678, 1018, 29901, 13, 4706, 396, 1876, 277, 278, 3620, 13, 4706, 1899, 353, 2967, 6519, 718, 9810, 29889, 15060, 718, 518, 9342, 29962, 13, 4706, 1014, 5014, 29889, 29925, 3150, 29898, 6519, 467, 27820, 403, 580, 13, 4706, 1596, 14182, 29876, 17918, 292, 304, 1923, 29889, 3529, 3896, 596, 4800, 565, 3734, 23157, 13, 4706, 396, 10318, 278, 1923, 9810, 408, 3734, 491, 278, 26554, 2761, 1788, 13, 4706, 363, 1899, 297, 9810, 29961, 29955, 29901, 5387, 13, 9651, 1899, 353, 2967, 6519, 718, 1899, 13, 9651, 1014, 5014, 29889, 29925, 3150, 29898, 6519, 467, 27820, 403, 580, 13, 9651, 1596, 580, 13, 1678, 5174, 313, 1491, 5014, 29889, 29907, 4212, 7032, 2392, 1125, 13, 4706, 1596, 877, 29965, 13996, 6021, 1059, 411, 278, 1899, 29850, 6519, 29913, 1642, 4286, 4830, 29898, 6519, 29922, 6519, 876, 13, 4706, 12020, 1014, 5014, 29889, 29907, 4212, 7032, 2392, 703, 4920, 441, 292, 383, 4590, 23157, 13, 1678, 5174, 313, 29949, 29173, 1125, 13, 4706, 1596, 877, 29965, 13996, 6021, 1059, 411, 278, 1899, 29850, 6519, 29913, 1642, 4286, 4830, 29898, 6519, 29922, 6519, 876, 13, 4706, 12020, 438, 29173, 703, 4920, 441, 292, 383, 4590, 23157, 13, 1678, 1596, 703, 26010, 9063, 1889, 8472, 23157, 13, 13, 13, 1753, 338, 23705, 744, 944, 29898, 3129, 2708, 1125, 13, 1678, 9995, 5399, 3692, 599, 21904, 526, 3480, 800, 1213, 15945, 13, 1678, 363, 5354, 297, 21904, 29889, 5451, 29898, 3284, 1125, 13, 4706, 565, 5354, 322, 451, 5354, 29889, 27382, 2541, 703, 30022, 29908, 1125, 13, 9651, 736, 7700, 13, 1678, 736, 5852, 13, 13, 13, 1753, 3349, 348, 15107, 653, 29893, 789, 28160, 29898, 4572, 726, 1125, 13, 1678, 396, 6804, 1950, 29892, 3349, 19039, 8775, 28160, 515, 278, 1812, 2559, 886, 322, 10614, 310, 23473, 18094, 29889, 13, 1678, 377, 7454, 391, 353, 7700, 13, 1678, 750, 16213, 353, 7700, 13, 1678, 565, 4175, 726, 29961, 29900, 29901, 29906, 29962, 1275, 17962, 29992, 1115, 13, 4706, 377, 7454, 391, 353, 5852, 13, 4706, 4175, 726, 353, 4175, 726, 29961, 29906, 17531, 13, 1678, 1550, 313, 13, 4706, 7431, 29898, 4572, 726, 29897, 1405, 29871, 29896, 13, 4706, 322, 4175, 726, 29961, 29900, 29962, 1275, 5124, 13, 4706, 322, 451, 4175, 726, 29961, 29896, 29962, 1275, 376, 29989, 29908, 13, 4706, 322, 451, 4175, 726, 29961, 29896, 29962, 1275, 376, 3850, 13, 268, 1125, 13, 4706, 4175, 726, 353, 4175, 726, 29961, 29896, 17531, 13, 4706, 750, 16213, 353, 5852, 13, 1678, 1550, 7431, 29898, 4572, 726, 29897, 1405, 29871, 29896, 322, 4175, 726, 14352, 29896, 29962, 1275, 5124, 322, 451, 4175, 726, 14352, 29906, 29962, 1275, 376, 29989, 1115, 13, 4706, 4175, 726, 353, 4175, 726, 7503, 29899, 29896, 29962, 13, 4706, 750, 16213, 353, 5852, 13, 1678, 565, 750, 16213, 322, 4175, 726, 29961, 29900, 29962, 1275, 5591, 29908, 322, 4175, 726, 14352, 29896, 29962, 1275, 5591, 1115, 13, 4706, 4175, 726, 353, 29850, 4572, 726, 29913, 29930, 1642, 4830, 29898, 4572, 726, 29922, 4572, 726, 29897, 13, 1678, 565, 4175, 726, 1275, 376, 1115, 13, 4706, 4175, 726, 353, 5124, 13, 1678, 565, 377, 7454, 391, 29901, 13, 4706, 4175, 726, 353, 17962, 28312, 4572, 726, 29913, 1642, 4830, 29898, 4572, 726, 29922, 4572, 726, 29897, 13, 1678, 736, 4175, 726, 13, 13, 13, 1753, 1423, 9342, 29898, 9342, 29892, 3939, 1125, 13, 1678, 9995, 5399, 278, 9063, 3440, 322, 736, 5852, 565, 278, 3440, 338, 13, 1678, 22691, 322, 7700, 565, 372, 338, 451, 1213, 15945, 13, 1678, 13926, 353, 337, 29889, 4352, 29898, 3217, 7428, 1806, 29925, 1299, 4945, 29940, 29892, 3440, 29897, 13, 1678, 565, 13926, 1275, 6213, 29901, 13, 4706, 1596, 29898, 13, 9651, 525, 1576, 3440, 29850, 9342, 5038, 338, 451, 297, 278, 5936, 3368, 3402, 29889, 4286, 4830, 29898, 13, 18884, 3440, 29922, 9342, 13, 9651, 1723, 13, 4706, 1723, 13, 1678, 1683, 29901, 13, 4706, 27717, 353, 13926, 29889, 2972, 29898, 29896, 29897, 13, 4706, 565, 27717, 1275, 376, 29924, 1115, 13, 9651, 396, 29408, 21733, 6589, 304, 505, 4120, 1711, 738, 3402, 13, 9651, 736, 5852, 13, 4706, 25342, 27717, 1275, 376, 29909, 29908, 470, 27717, 1275, 376, 29925, 1115, 13, 9651, 565, 451, 3939, 29901, 13, 18884, 1596, 29898, 13, 462, 1678, 376, 3492, 505, 18694, 393, 366, 505, 2715, 470, 6206, 263, 5751, 29892, 541, 694, 3620, 892, 12919, 11682, 491, 278, 9810, 1213, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 3211, 353, 13926, 29889, 2972, 29898, 29946, 29897, 13, 18884, 565, 451, 2854, 2271, 29898, 7328, 1125, 13, 462, 1678, 1596, 877, 2525, 29423, 3368, 3211, 29850, 7328, 29913, 1642, 4286, 4830, 29898, 7328, 29922, 7328, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 450, 1404, 756, 3939, 278, 25691, 322, 756, 3971, 263, 13907, 3440, 2643, 411, 263, 2854, 3211, 13, 462, 1678, 736, 5852, 13, 1678, 1596, 580, 13, 1678, 736, 7700, 13, 13, 13, 1753, 2854, 2271, 29898, 2271, 1125, 13, 1678, 9995, 5399, 393, 385, 3211, 756, 263, 11380, 313, 29872, 29889, 29887, 29889, 1732, 511, 263, 5354, 1024, 13, 1678, 313, 29872, 29889, 29887, 29889, 1342, 29889, 510, 29897, 322, 263, 2224, 313, 29872, 29889, 29887, 29889, 847, 511, 470, 1104, 1078, 304, 278, 7463, 13, 1678, 1048, 1788, 1213, 15945, 13, 1678, 3211, 1595, 353, 3142, 5510, 29898, 2271, 29897, 13, 1678, 565, 3211, 1595, 29889, 816, 2004, 322, 3211, 1595, 29889, 1212, 2029, 322, 3211, 1595, 29889, 2084, 29901, 13, 4706, 736, 5852, 13, 1678, 25342, 3211, 1595, 29889, 816, 2004, 1275, 376, 12717, 1115, 13, 4706, 736, 5852, 13, 1678, 1683, 29901, 13, 4706, 736, 7700, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1369, 580, 13, 2 ]
dispatch/flags.py
harrybrwn/dispatch
0
133038
<gh_stars>0 import sys from typing import Dict, Optional from collections.abc import Iterable from dataclasses import is_dataclass from .exceptions import DeveloperException from ._meta import _FunctionMeta, _GroupMeta, _CliMeta class Option: __slots__ = ('name', 'type', 'shorthand', 'help', '_value', 'hidden', '_default', 'has_default', 'f_len', 'hide_default') def __init__(self, name, typ, *, shorthand: str = None, help: str = None, value=None, hidden=False, has_default=False, hide_default=False): self.name = name self.type = typ if typ is not None else bool self.shorthand = shorthand self.help = help or '' self.value = value # will infer and set the type self.hidden = hidden self._default = value self.has_default = has_default or value is not None self.hide_default = hide_default self.f_len = len(self.name) # len(name) is temp, will be set when formatting if self.shorthand == 'h' and self.name != 'help': raise DeveloperException( "cannot use 'h' as shorthand (reserved for --help)") def __format__(self, spec: str): name_spec = f'<{self.f_len}' prefix = '' if spec: if '<' in spec: name_spec = '<' + spec[spec.index('<') + 1] elif '>' in spec: name_spec = '>' + spec[spec.index('>') + 1] if '+' in spec: prefix = ' ' * int(spec[spec.index('+')+1]) if self.shorthand: short = f'-{self.shorthand}, ' else: short = ' ' * 4 return '{0}{short}--{name:{1}}{help}{default}'.format( prefix, name_spec, short=short, name=self.name.replace('_', '-'), help=self.help, default=self.show_default(), ) def __repr__(self): return "{}('{}', {})".format( self.__class__.__name__, str(self).strip(), self.type) def __str__(self): if self.shorthand: return '-{}, --{}'.format(self.shorthand, self.name) else: return ' --{}'.format(self.name) @property def value(self): return self._value @value.setter def value(self, val): self._value = val if val is not None: self.type = val.__class__ def show_default(self) -> str: if self.has_default and not self.hide_default and self.value: if self.help: return f' (default: {self.value!r})' else: return f'default: {self.value!r}' return '' def setval(self, val): ''' setval is meant to be used to set the value of the flag from the cli input and convert it to the flag's type. setval should also work when the flag.type is a compound type annotation (see typing package). This function is basically a rich type convertion. Any flag types that are part of the typing package will be converted to the python type it represents. Another feature of the is function is allowing an option to take more complex arguments such as lists or dictionaries. ''' # TODO: type checking does not work if the annotation is an abstract # base class. (collections.abc.Sequence etc..) if not isinstance(val, str) or self.type is str: # if val is not a string then the type has already been converted # if the type is a string, we dont need to convert it self._value = val else: if _is_iterable(self.type): val = val.strip('[]{}').split(',') if _from_typing_module(self.type): if len(self.type.__args__) == 1: inner = self.type.__args__[0] self._value = self.type.__origin__([inner(v) for v in val]) elif len(self.type.__args__) == 2: key_tp, val_tp = self.type.__args__ vals = [] for vl in val: k, v = vl.split(':') pair = key_tp(k), val_tp(v) vals.append(pair) self._value = self.type.__origin__(vals) else: self._value = self.type(val) def _getnull(self): '''_getnull will return a null value given the flag's type. If there is a default value, that will be returned. ''' if self.has_default: return self._default try: return self.type() except TypeError: # if the constructory needs an argument # then we cant do much so return None return None def _reset(self): self._value = self._getnull() class FlagSet: '''A Set of cli Flags''' DEFAULT_HELP_FLAG = Option('help', bool, shorthand='h', help='Get help.') MIN_FMT_LEN = 3 __slots__ = ('_flags', '_flagnames', '_shorthands') def __init__(self, *, names: tuple = None, defaults: dict = None, docs: dict = None, types: dict = None, shorthands: dict = None, hidden: set = set(), **kwrgs): ''' Create a FlagSet names: `list` of flag names, use only the fullnames defaults: `dict` of default flag values docs: `dict` of default flag help text types: `dict` of type annotations shorthands: `dict` of flag shorthands. Give it in the format {<flagname>: <shorthand>} but know that the copy stored in the flag set will also store flagnames in the format {<shorthand>: <flagname>}. hidden: `set` of the flagnames that will be hidden from the help text of the FlagSet. hidden_defaults: `set` of flags that should not show their defauts ''' self._flags: Dict[str, Option] = {} self._flagnames = names or () self._shorthands = shorthands or dict() types = types or dict() defaults = defaults or dict() docs = docs or dict() hidden_defaults = kwrgs.pop('hidden_defaults', set()) cmd_meta: Optional[_CliMeta] = kwrgs.pop('__command_meta__') if cmd_meta: if not isinstance(cmd_meta, _CliMeta): raise TypeError('__command_meta__ should inherit from _meta._CliMeta') for key, val in cmd_meta.flagdocs.items(): self._shorthands[key] = val.get('shorthand') docs[key] = val.get('doc') types.update(cmd_meta.annotations()) defaults.update(cmd_meta.defaults()) for name in self._flagnames: opt = Option( name, types.get(name, bool), shorthand=self._shorthands.get(name), help=docs.get(name, ''), value=defaults.get(name), hidden=name in hidden, hide_default=name in hidden_defaults, ) self[name] = opt @property def format_len(self) -> int: fmt_len = max([len(f.name) for f in self.visible_flags()]) return fmt_len + self.MIN_FMT_LEN @property def help(self) -> str: fmt = ' {0:<{1}}' lngth = self.format_len return '\n'.join(fmt.format(f, lngth) for f in self.visible_flags()) def __str__(self): return str(self._flags) def __len__(self): return len(self._flags) def __getitem__(self, key) -> Option: if len(key) == 1 and key in self._shorthands: key = self._shorthands[key] return self._flags[key] def __setitem__(self, key: str, flag: Option): self._flags[key] = flag if flag.shorthand: self._shorthands[flag.shorthand] = key def __delitem__(self, key): if len(key) == 1: key = self._shorthands.pop(key) del self._flags[key] def __contains__(self, key) -> bool: return key in self._flags or key in self._shorthands def __iter__(self): return iter(self._flags) def items(self): yield from self._flags.items() def values(self): yield from self._flags.values() def update(self, fset=None): if not isinstance(fset, FlagSet): raise TypeError( 'must update {0} with a {0}'.format(self.__class__.__name__)) self._flags.update(fset._flags) self._shorthands.update(fset._shorthands) def get(self, key: str, default=None) -> Option: try: return self[key] except KeyError: return default def visible_flags(self): yield from ( flag for flag in self._flags.values() if not flag.hidden ) yield self.DEFAULT_HELP_FLAG def _from_typing_module(t) -> bool: if hasattr(t, '__module__'): mod = t.__module__ import typing return sys.modules[mod] == typing return False def _is_iterable(t) -> bool: if _from_typing_module(t): return issubclass(t.__origin__, Iterable) return isinstance(t, Iterable) or issubclass(t, Iterable)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 10876, 13, 3166, 19229, 1053, 360, 919, 29892, 28379, 13, 3166, 16250, 29889, 10736, 1053, 20504, 519, 13, 3166, 848, 13203, 1053, 338, 29918, 1272, 1990, 13, 13, 3166, 869, 11739, 29879, 1053, 10682, 261, 2451, 13, 3166, 869, 29918, 7299, 1053, 903, 6678, 19346, 29892, 903, 4782, 19346, 29892, 903, 29907, 492, 19346, 13, 13, 13, 1990, 10831, 29901, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 6702, 978, 742, 525, 1853, 742, 525, 845, 2072, 392, 742, 525, 8477, 742, 22868, 1767, 742, 13, 462, 525, 10892, 742, 22868, 4381, 742, 525, 5349, 29918, 4381, 742, 525, 29888, 29918, 2435, 742, 525, 11458, 29918, 4381, 1495, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 2393, 29892, 334, 29892, 13, 462, 528, 2072, 392, 29901, 851, 353, 6213, 29892, 1371, 29901, 851, 353, 6213, 29892, 995, 29922, 8516, 29892, 13, 462, 7934, 29922, 8824, 29892, 756, 29918, 4381, 29922, 8824, 29892, 9563, 29918, 4381, 29922, 8824, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 1853, 353, 2393, 565, 2393, 338, 451, 6213, 1683, 6120, 13, 13, 4706, 1583, 29889, 845, 2072, 392, 353, 528, 2072, 392, 13, 4706, 1583, 29889, 8477, 353, 1371, 470, 6629, 13, 4706, 1583, 29889, 1767, 353, 995, 29871, 396, 674, 10115, 322, 731, 278, 1134, 13, 13, 4706, 1583, 29889, 10892, 353, 7934, 13, 4706, 1583, 3032, 4381, 353, 995, 13, 4706, 1583, 29889, 5349, 29918, 4381, 353, 756, 29918, 4381, 470, 995, 338, 451, 6213, 13, 4706, 1583, 29889, 11458, 29918, 4381, 353, 9563, 29918, 4381, 13, 4706, 1583, 29889, 29888, 29918, 2435, 353, 7431, 29898, 1311, 29889, 978, 29897, 29871, 396, 7431, 29898, 978, 29897, 338, 5694, 29892, 674, 367, 731, 746, 15998, 13, 13, 4706, 565, 1583, 29889, 845, 2072, 392, 1275, 525, 29882, 29915, 322, 1583, 29889, 978, 2804, 525, 8477, 2396, 13, 9651, 12020, 10682, 261, 2451, 29898, 13, 18884, 376, 29883, 6735, 671, 525, 29882, 29915, 408, 528, 2072, 392, 313, 690, 9841, 363, 1192, 8477, 25760, 13, 13, 1678, 822, 4770, 4830, 12035, 1311, 29892, 1580, 29901, 851, 1125, 13, 4706, 1024, 29918, 6550, 353, 285, 29915, 29966, 29912, 1311, 29889, 29888, 29918, 2435, 10162, 13, 4706, 10944, 353, 6629, 13, 4706, 565, 1580, 29901, 13, 9651, 565, 12801, 29915, 297, 1580, 29901, 13, 18884, 1024, 29918, 6550, 353, 12801, 29915, 718, 1580, 29961, 6550, 29889, 2248, 877, 29966, 1495, 718, 29871, 29896, 29962, 13, 9651, 25342, 525, 16299, 297, 1580, 29901, 13, 18884, 1024, 29918, 6550, 353, 525, 16299, 718, 1580, 29961, 6550, 29889, 2248, 877, 29958, 1495, 718, 29871, 29896, 29962, 13, 9651, 565, 525, 23097, 297, 1580, 29901, 13, 18884, 10944, 353, 525, 525, 334, 938, 29898, 6550, 29961, 6550, 29889, 2248, 877, 29974, 1495, 29974, 29896, 2314, 13, 13, 4706, 565, 1583, 29889, 845, 2072, 392, 29901, 13, 9651, 3273, 353, 285, 28560, 29912, 1311, 29889, 845, 2072, 392, 1118, 525, 13, 4706, 1683, 29901, 13, 9651, 3273, 353, 525, 525, 334, 29871, 29946, 13, 13, 4706, 736, 22372, 29900, 1157, 12759, 29913, 489, 29912, 978, 26254, 29896, 7585, 8477, 1157, 4381, 29913, 4286, 4830, 29898, 13, 9651, 10944, 29892, 1024, 29918, 6550, 29892, 3273, 29922, 12759, 29892, 13, 9651, 1024, 29922, 1311, 29889, 978, 29889, 6506, 877, 29918, 742, 17411, 5477, 13, 9651, 1371, 29922, 1311, 29889, 8477, 29892, 13, 9651, 2322, 29922, 1311, 29889, 4294, 29918, 4381, 3285, 13, 4706, 1723, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 376, 8875, 877, 8875, 742, 426, 1800, 1642, 4830, 29898, 13, 9651, 1583, 17255, 1990, 1649, 17255, 978, 1649, 29892, 851, 29898, 1311, 467, 17010, 3285, 1583, 29889, 1853, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 565, 1583, 29889, 845, 2072, 392, 29901, 13, 9651, 736, 17411, 29912, 1118, 1192, 8875, 4286, 4830, 29898, 1311, 29889, 845, 2072, 392, 29892, 1583, 29889, 978, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 525, 268, 1192, 8875, 4286, 4830, 29898, 1311, 29889, 978, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 995, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1767, 13, 13, 1678, 732, 1767, 29889, 842, 357, 13, 1678, 822, 995, 29898, 1311, 29892, 659, 1125, 13, 4706, 1583, 3032, 1767, 353, 659, 13, 4706, 565, 659, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 1853, 353, 659, 17255, 1990, 1649, 13, 13, 1678, 822, 1510, 29918, 4381, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 565, 1583, 29889, 5349, 29918, 4381, 322, 451, 1583, 29889, 11458, 29918, 4381, 322, 1583, 29889, 1767, 29901, 13, 9651, 565, 1583, 29889, 8477, 29901, 13, 18884, 736, 285, 29915, 313, 4381, 29901, 426, 1311, 29889, 1767, 29991, 29878, 1800, 29915, 13, 9651, 1683, 29901, 13, 18884, 736, 285, 29915, 4381, 29901, 426, 1311, 29889, 1767, 29991, 29878, 10162, 13, 4706, 736, 6629, 13, 13, 1678, 822, 731, 791, 29898, 1311, 29892, 659, 1125, 13, 4706, 14550, 13, 4706, 731, 791, 338, 6839, 304, 367, 1304, 304, 731, 278, 995, 310, 278, 7353, 515, 278, 13, 4706, 9335, 1881, 322, 3588, 372, 304, 278, 7353, 29915, 29879, 1134, 29889, 731, 791, 881, 884, 664, 13, 4706, 746, 278, 7353, 29889, 1853, 338, 263, 752, 618, 1134, 17195, 313, 4149, 19229, 3577, 467, 13, 13, 4706, 910, 740, 338, 8830, 263, 8261, 1134, 3588, 291, 29889, 3139, 7353, 4072, 393, 13, 4706, 526, 760, 310, 278, 19229, 3577, 674, 367, 11543, 304, 278, 3017, 1134, 372, 13, 4706, 11524, 29889, 13, 13, 4706, 7280, 4682, 310, 278, 338, 740, 338, 14372, 385, 2984, 304, 2125, 901, 13, 4706, 4280, 6273, 1316, 408, 8857, 470, 21503, 4314, 29889, 13, 4706, 14550, 13, 4706, 396, 14402, 29901, 1134, 8454, 947, 451, 664, 565, 278, 17195, 338, 385, 9846, 13, 4706, 396, 539, 2967, 770, 29889, 313, 29027, 29889, 10736, 29889, 20529, 2992, 636, 29897, 13, 13, 4706, 565, 451, 338, 8758, 29898, 791, 29892, 851, 29897, 470, 1583, 29889, 1853, 338, 851, 29901, 13, 9651, 396, 565, 659, 338, 451, 263, 1347, 769, 278, 1134, 756, 2307, 1063, 11543, 13, 9651, 396, 565, 278, 1134, 338, 263, 1347, 29892, 591, 4555, 817, 304, 3588, 372, 13, 9651, 1583, 3032, 1767, 353, 659, 13, 4706, 1683, 29901, 13, 9651, 565, 903, 275, 29918, 1524, 519, 29898, 1311, 29889, 1853, 1125, 13, 18884, 659, 353, 659, 29889, 17010, 877, 2636, 8875, 2824, 5451, 29317, 1495, 13, 13, 9651, 565, 903, 3166, 29918, 1017, 15702, 29918, 5453, 29898, 1311, 29889, 1853, 1125, 13, 18884, 565, 7431, 29898, 1311, 29889, 1853, 17255, 5085, 1649, 29897, 1275, 29871, 29896, 29901, 13, 462, 1678, 6426, 353, 1583, 29889, 1853, 17255, 5085, 1649, 29961, 29900, 29962, 13, 462, 1678, 1583, 3032, 1767, 353, 1583, 29889, 1853, 17255, 12574, 1649, 4197, 3993, 29898, 29894, 29897, 363, 325, 297, 659, 2314, 13, 18884, 25342, 7431, 29898, 1311, 29889, 1853, 17255, 5085, 1649, 29897, 1275, 29871, 29906, 29901, 13, 462, 1678, 1820, 29918, 9392, 29892, 659, 29918, 9392, 353, 1583, 29889, 1853, 17255, 5085, 1649, 13, 462, 1678, 659, 29879, 353, 5159, 13, 462, 1678, 363, 14204, 297, 659, 29901, 13, 462, 4706, 413, 29892, 325, 353, 14204, 29889, 5451, 877, 29901, 1495, 13, 462, 4706, 5101, 353, 1820, 29918, 9392, 29898, 29895, 511, 659, 29918, 9392, 29898, 29894, 29897, 13, 462, 4706, 659, 29879, 29889, 4397, 29898, 18784, 29897, 13, 462, 1678, 1583, 3032, 1767, 353, 1583, 29889, 1853, 17255, 12574, 12035, 791, 29879, 29897, 13, 9651, 1683, 29901, 13, 18884, 1583, 3032, 1767, 353, 1583, 29889, 1853, 29898, 791, 29897, 13, 13, 1678, 822, 903, 657, 4304, 29898, 1311, 1125, 13, 4706, 14550, 29918, 657, 4304, 674, 736, 263, 1870, 995, 2183, 278, 7353, 29915, 29879, 1134, 29889, 13, 4706, 960, 727, 338, 263, 2322, 995, 29892, 393, 674, 367, 4133, 29889, 13, 4706, 14550, 13, 4706, 565, 1583, 29889, 5349, 29918, 4381, 29901, 13, 9651, 736, 1583, 3032, 4381, 13, 13, 4706, 1018, 29901, 13, 9651, 736, 1583, 29889, 1853, 580, 13, 4706, 5174, 20948, 29901, 13, 9651, 396, 565, 278, 3386, 706, 4225, 385, 2980, 13, 9651, 396, 769, 591, 5107, 437, 1568, 577, 736, 6213, 13, 9651, 736, 6213, 13, 13, 1678, 822, 903, 12071, 29898, 1311, 1125, 13, 4706, 1583, 3032, 1767, 353, 1583, 3032, 657, 4304, 580, 13, 13, 13, 1990, 28697, 2697, 29901, 13, 1678, 14550, 29909, 3789, 310, 9335, 2379, 810, 12008, 13, 13, 1678, 22236, 29918, 29950, 6670, 29925, 29918, 26516, 353, 10831, 877, 8477, 742, 6120, 29892, 528, 2072, 392, 2433, 29882, 742, 1371, 2433, 2577, 1371, 29889, 1495, 13, 1678, 341, 1177, 29918, 29943, 11490, 29918, 1307, 29940, 353, 29871, 29941, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 6702, 29918, 15764, 742, 22868, 1579, 4211, 1280, 742, 22868, 845, 2072, 4167, 1495, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 29892, 2983, 29901, 18761, 353, 6213, 29892, 21274, 29901, 9657, 353, 6213, 29892, 13, 462, 10561, 29901, 9657, 353, 6213, 29892, 4072, 29901, 9657, 353, 6213, 29892, 13, 462, 528, 2072, 4167, 29901, 9657, 353, 6213, 29892, 7934, 29901, 731, 353, 731, 3285, 3579, 11022, 29878, 3174, 1125, 13, 4706, 14550, 13, 4706, 6204, 263, 28697, 2697, 13, 13, 9651, 2983, 29901, 418, 421, 1761, 29952, 310, 7353, 2983, 29892, 671, 871, 278, 2989, 7039, 13, 9651, 21274, 29901, 259, 421, 8977, 29952, 310, 2322, 7353, 1819, 13, 9651, 10561, 29901, 539, 421, 8977, 29952, 310, 2322, 7353, 1371, 1426, 13, 9651, 4072, 29901, 418, 421, 8977, 29952, 310, 1134, 25495, 13, 9651, 528, 2072, 4167, 29901, 421, 8977, 29952, 310, 7353, 528, 2072, 4167, 29889, 25538, 372, 297, 278, 3402, 13, 18884, 426, 29966, 15581, 978, 23917, 529, 845, 2072, 392, 29958, 29913, 541, 1073, 393, 278, 3509, 6087, 297, 278, 13, 18884, 7353, 731, 674, 884, 3787, 1652, 4211, 1280, 297, 278, 3402, 13, 18884, 426, 29966, 845, 2072, 392, 23917, 529, 15581, 978, 29958, 1836, 13, 9651, 7934, 29901, 421, 842, 29952, 310, 278, 1652, 4211, 1280, 393, 674, 367, 7934, 515, 278, 1371, 13, 18884, 1426, 310, 278, 28697, 2697, 29889, 13, 9651, 7934, 29918, 4381, 29879, 29901, 421, 842, 29952, 310, 13449, 393, 881, 451, 1510, 1009, 822, 1300, 29879, 13, 4706, 14550, 13, 4706, 1583, 3032, 15764, 29901, 360, 919, 29961, 710, 29892, 10831, 29962, 353, 6571, 13, 4706, 1583, 3032, 1579, 4211, 1280, 353, 2983, 470, 3861, 13, 4706, 1583, 3032, 845, 2072, 4167, 353, 528, 2072, 4167, 470, 9657, 580, 13, 13, 4706, 4072, 353, 4072, 470, 9657, 580, 13, 4706, 21274, 353, 21274, 470, 9657, 580, 13, 4706, 10561, 353, 10561, 470, 9657, 580, 13, 4706, 7934, 29918, 4381, 29879, 353, 9049, 29878, 3174, 29889, 7323, 877, 10892, 29918, 4381, 29879, 742, 731, 3101, 13, 13, 4706, 9920, 29918, 7299, 29901, 28379, 28513, 29907, 492, 19346, 29962, 353, 9049, 29878, 3174, 29889, 7323, 877, 1649, 6519, 29918, 7299, 1649, 1495, 13, 4706, 565, 9920, 29918, 7299, 29901, 13, 9651, 565, 451, 338, 8758, 29898, 9006, 29918, 7299, 29892, 903, 29907, 492, 19346, 1125, 13, 18884, 12020, 20948, 877, 1649, 6519, 29918, 7299, 1649, 881, 13125, 515, 903, 7299, 3032, 29907, 492, 19346, 1495, 13, 13, 9651, 363, 1820, 29892, 659, 297, 9920, 29918, 7299, 29889, 15581, 2640, 29889, 7076, 7295, 13, 18884, 1583, 3032, 845, 2072, 4167, 29961, 1989, 29962, 353, 659, 29889, 657, 877, 845, 2072, 392, 1495, 13, 18884, 10561, 29961, 1989, 29962, 353, 659, 29889, 657, 877, 1514, 1495, 13, 9651, 4072, 29889, 5504, 29898, 9006, 29918, 7299, 29889, 6735, 800, 3101, 13, 9651, 21274, 29889, 5504, 29898, 9006, 29918, 7299, 29889, 4381, 29879, 3101, 13, 13, 4706, 363, 1024, 297, 1583, 3032, 1579, 4211, 1280, 29901, 13, 9651, 3523, 353, 10831, 29898, 13, 18884, 1024, 29892, 4072, 29889, 657, 29898, 978, 29892, 6120, 511, 13, 18884, 528, 2072, 392, 29922, 1311, 3032, 845, 2072, 4167, 29889, 657, 29898, 978, 511, 13, 18884, 1371, 29922, 2640, 29889, 657, 29898, 978, 29892, 525, 5477, 13, 18884, 995, 29922, 4381, 29879, 29889, 657, 29898, 978, 511, 13, 18884, 7934, 29922, 978, 297, 7934, 29892, 13, 18884, 9563, 29918, 4381, 29922, 978, 297, 7934, 29918, 4381, 29879, 29892, 13, 9651, 1723, 13, 9651, 1583, 29961, 978, 29962, 353, 3523, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3402, 29918, 2435, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 19200, 29918, 2435, 353, 4236, 4197, 2435, 29898, 29888, 29889, 978, 29897, 363, 285, 297, 1583, 29889, 12872, 29918, 15764, 580, 2314, 13, 4706, 736, 19200, 29918, 2435, 718, 1583, 29889, 16173, 29918, 29943, 11490, 29918, 1307, 29940, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1371, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 19200, 353, 525, 1678, 426, 29900, 29901, 29966, 29912, 29896, 930, 29915, 13, 4706, 301, 865, 386, 353, 1583, 29889, 4830, 29918, 2435, 13, 4706, 736, 11297, 29876, 4286, 7122, 29898, 23479, 29889, 4830, 29898, 29888, 29892, 301, 865, 386, 29897, 363, 285, 297, 1583, 29889, 12872, 29918, 15764, 3101, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 851, 29898, 1311, 3032, 15764, 29897, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 3032, 15764, 29897, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 1820, 29897, 1599, 10831, 29901, 13, 4706, 565, 7431, 29898, 1989, 29897, 1275, 29871, 29896, 322, 1820, 297, 1583, 3032, 845, 2072, 4167, 29901, 13, 9651, 1820, 353, 1583, 3032, 845, 2072, 4167, 29961, 1989, 29962, 13, 4706, 736, 1583, 3032, 15764, 29961, 1989, 29962, 13, 13, 1678, 822, 4770, 842, 667, 12035, 1311, 29892, 1820, 29901, 851, 29892, 7353, 29901, 10831, 1125, 13, 4706, 1583, 3032, 15764, 29961, 1989, 29962, 353, 7353, 13, 4706, 565, 7353, 29889, 845, 2072, 392, 29901, 13, 9651, 1583, 3032, 845, 2072, 4167, 29961, 15581, 29889, 845, 2072, 392, 29962, 353, 1820, 13, 13, 1678, 822, 4770, 6144, 667, 12035, 1311, 29892, 1820, 1125, 13, 4706, 565, 7431, 29898, 1989, 29897, 1275, 29871, 29896, 29901, 13, 9651, 1820, 353, 1583, 3032, 845, 2072, 4167, 29889, 7323, 29898, 1989, 29897, 13, 4706, 628, 1583, 3032, 15764, 29961, 1989, 29962, 13, 13, 1678, 822, 4770, 11516, 12035, 1311, 29892, 1820, 29897, 1599, 6120, 29901, 13, 4706, 736, 1820, 297, 1583, 3032, 15764, 470, 1820, 297, 1583, 3032, 845, 2072, 4167, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 736, 4256, 29898, 1311, 3032, 15764, 29897, 13, 13, 1678, 822, 4452, 29898, 1311, 1125, 13, 4706, 7709, 515, 1583, 3032, 15764, 29889, 7076, 580, 13, 13, 1678, 822, 1819, 29898, 1311, 1125, 13, 4706, 7709, 515, 1583, 3032, 15764, 29889, 5975, 580, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 285, 842, 29922, 8516, 1125, 13, 4706, 565, 451, 338, 8758, 29898, 29888, 842, 29892, 28697, 2697, 1125, 13, 9651, 12020, 20948, 29898, 13, 18884, 525, 21969, 2767, 426, 29900, 29913, 411, 263, 426, 29900, 29913, 4286, 4830, 29898, 1311, 17255, 1990, 1649, 17255, 978, 1649, 876, 13, 4706, 1583, 3032, 15764, 29889, 5504, 29898, 29888, 842, 3032, 15764, 29897, 13, 4706, 1583, 3032, 845, 2072, 4167, 29889, 5504, 29898, 29888, 842, 3032, 845, 2072, 4167, 29897, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 1820, 29901, 851, 29892, 2322, 29922, 8516, 29897, 1599, 10831, 29901, 13, 4706, 1018, 29901, 13, 9651, 736, 1583, 29961, 1989, 29962, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 736, 2322, 13, 13, 1678, 822, 7962, 29918, 15764, 29898, 1311, 1125, 13, 4706, 7709, 515, 313, 13, 9651, 7353, 363, 7353, 297, 1583, 3032, 15764, 29889, 5975, 580, 13, 9651, 565, 451, 7353, 29889, 10892, 13, 4706, 1723, 13, 4706, 7709, 1583, 29889, 23397, 29918, 29950, 6670, 29925, 29918, 26516, 13, 13, 13, 1753, 903, 3166, 29918, 1017, 15702, 29918, 5453, 29898, 29873, 29897, 1599, 6120, 29901, 13, 1678, 565, 756, 5552, 29898, 29873, 29892, 525, 1649, 5453, 1649, 29374, 13, 4706, 878, 353, 260, 17255, 5453, 1649, 13, 4706, 1053, 19229, 13, 4706, 736, 10876, 29889, 7576, 29961, 1545, 29962, 1275, 19229, 13, 1678, 736, 7700, 13, 13, 13, 1753, 903, 275, 29918, 1524, 519, 29898, 29873, 29897, 1599, 6120, 29901, 13, 1678, 565, 903, 3166, 29918, 1017, 15702, 29918, 5453, 29898, 29873, 1125, 13, 4706, 736, 338, 1491, 1990, 29898, 29873, 17255, 12574, 1649, 29892, 20504, 519, 29897, 13, 1678, 736, 338, 8758, 29898, 29873, 29892, 20504, 519, 29897, 470, 338, 1491, 1990, 29898, 29873, 29892, 20504, 519, 29897, 13, 2 ]
django_blog/blog/models.py
lidysun/test1
0
37694
# -*- coding: utf-8 -*- from __future__ import unicode_literals from time import timezone from django.db import models # Create your models here. class UserInfo(models.Model): user= models.CharField(max_length = 30) pwd = models.CharField(max_length = 30) # class Publisher(models.Model): # name = models.CharField(max_length=30) # address = models.CharField(max_length=50) # website = models.URLField() # class Author(models.Model): # email = models.EmailField() # first_name = models.CharField(max_length = 30) # last_name = models.CharField(max_length = 30) # class Book(models.Model): # title = models.CharField(max_length = 150) # authors = models.ManyToManyField(Author) # publisher = models.ForeignKey(Publisher) class DoubanMovie(models.Model): name = models.CharField(max_length = 200) info = models.CharField(max_length = 10000) rating = models.CharField(max_length = 20) num = models.CharField(max_length = 50) quote = models.CharField(max_length = 150) img_url = models.CharField(max_length = 300)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 30004, 13, 3166, 931, 1053, 29431, 30004, 13, 3166, 9557, 29889, 2585, 1053, 4733, 30004, 13, 30004, 13, 29937, 6204, 596, 4733, 1244, 22993, 13, 1990, 4911, 3401, 29898, 9794, 29889, 3195, 1125, 30004, 13, 12, 1792, 29922, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29941, 29900, 8443, 13, 12, 29886, 9970, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29941, 29900, 8443, 13, 30004, 13, 29937, 770, 12904, 261, 29898, 9794, 29889, 3195, 1125, 30004, 13, 29937, 29871, 12, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29941, 29900, 8443, 13, 29937, 29871, 12, 7328, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29945, 29900, 8443, 13, 29937, 29871, 12, 22942, 353, 4733, 29889, 4219, 3073, 26471, 13, 30004, 13, 29937, 770, 13361, 29898, 9794, 29889, 3195, 1125, 30004, 13, 29937, 29871, 12, 5269, 353, 4733, 29889, 9823, 3073, 26471, 13, 29937, 29871, 12, 4102, 29918, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29941, 29900, 8443, 13, 29937, 29871, 12, 4230, 29918, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29941, 29900, 8443, 13, 30004, 13, 29937, 770, 6726, 29898, 9794, 29889, 3195, 1125, 30004, 13, 29937, 29871, 12, 3257, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29896, 29945, 29900, 8443, 13, 29937, 29871, 12, 5150, 943, 353, 4733, 29889, 14804, 1762, 14804, 3073, 29898, 13720, 8443, 13, 29937, 29871, 12, 23679, 261, 353, 4733, 29889, 27755, 2558, 29898, 21076, 1674, 261, 8443, 13, 30004, 13, 1990, 19176, 2571, 18749, 29898, 9794, 29889, 3195, 1125, 30004, 13, 12, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29906, 29900, 29900, 8443, 13, 12, 3888, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29896, 29900, 29900, 29900, 29900, 8443, 13, 12, 29741, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29906, 29900, 8443, 13, 12, 1949, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29945, 29900, 8443, 13, 12, 1396, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29896, 29945, 29900, 8443, 13, 12, 2492, 29918, 2271, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 353, 29871, 29941, 29900, 29900, 8443, 13, 30004, 13, 2 ]
runtests.py
humantech/django-ext_fields
2
177529
#!/usr/bin/env python import os import sys import django from django.conf import settings from django.utils.functional import empty from django.test.utils import get_runner if __name__ == "__main__": def run_tests(subtest): test_module = 'tests.' + subtest os.environ['DJANGO_SETTINGS_MODULE'] = test_module + '.settings' django.setup() TestRunner = get_runner(settings) test_runner = TestRunner() failures = test_runner.run_tests([test_module]) return bool(failures) subtest = sys.argv[1] if len(sys.argv) > 1 else os.environ.get('SUBTEST') ret = run_tests(subtest) sys.exit(ret)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 5215, 2897, 13, 5215, 10876, 13, 13, 5215, 9557, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 13239, 29889, 2220, 284, 1053, 4069, 13, 3166, 9557, 29889, 1688, 29889, 13239, 1053, 679, 29918, 27492, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 822, 1065, 29918, 21150, 29898, 1491, 1688, 1125, 13, 13, 4706, 1243, 29918, 5453, 353, 525, 21150, 6169, 718, 1014, 1688, 13, 4706, 2897, 29889, 21813, 1839, 29928, 29967, 2190, 17080, 29918, 10490, 29911, 4214, 29903, 29918, 6720, 14849, 1307, 2033, 353, 1243, 29918, 5453, 718, 15300, 11027, 29915, 13, 4706, 9557, 29889, 14669, 580, 13, 4706, 4321, 16802, 353, 679, 29918, 27492, 29898, 11027, 29897, 13, 4706, 1243, 29918, 27492, 353, 4321, 16802, 580, 13, 4706, 4418, 1973, 353, 1243, 29918, 27492, 29889, 3389, 29918, 21150, 4197, 1688, 29918, 5453, 2314, 13, 4706, 736, 6120, 29898, 14057, 1973, 29897, 13, 13, 13, 1678, 1014, 1688, 353, 10876, 29889, 19218, 29961, 29896, 29962, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29896, 1683, 2897, 29889, 21813, 29889, 657, 877, 20633, 18267, 1495, 13, 1678, 3240, 353, 1065, 29918, 21150, 29898, 1491, 1688, 29897, 13, 1678, 10876, 29889, 13322, 29898, 2267, 29897, 13, 13, 2 ]
sthima/todo/tests/test_models.py
bratomes/work-at-sthima
0
1601204
from django.test import TestCase from django.contrib.auth.models import User from model_mommy import mommy from todo.models import Task class TaskTest(TestCase): """ Test case of Task model """ def setUp(self): """ Set up all the tests """ self.user = mommy.make(User) self.task = mommy.make(Task) def test_string_representation(self): """ Test if the __str__ method returns the description of a task """ self.assertEqual(str(self.task), self.task.description)
[ 1, 515, 9557, 29889, 1688, 1053, 4321, 8259, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 13, 3166, 1904, 29918, 29885, 290, 1357, 1053, 16823, 1357, 13, 13, 3166, 10481, 29889, 9794, 1053, 9330, 13, 13, 13, 1990, 9330, 3057, 29898, 3057, 8259, 1125, 13, 1678, 9995, 13, 1678, 4321, 1206, 310, 9330, 1904, 13, 1678, 9995, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3789, 701, 599, 278, 6987, 13, 4706, 9995, 13, 4706, 1583, 29889, 1792, 353, 16823, 1357, 29889, 5675, 29898, 2659, 29897, 13, 4706, 1583, 29889, 7662, 353, 16823, 1357, 29889, 5675, 29898, 5398, 29897, 13, 13, 1678, 822, 1243, 29918, 1807, 29918, 276, 26081, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 565, 278, 4770, 710, 1649, 1158, 3639, 278, 6139, 310, 263, 3414, 13, 4706, 9995, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 1311, 29889, 7662, 511, 1583, 29889, 7662, 29889, 8216, 29897, 13, 2 ]
jojo/jojo.py
ExtremeTea/Coffee
0
168592
from discord.ext import commands import random import discord class jojo: def __init__(self, bot): self.bot = bot @commands.command(pass_context=True) async def jojo(self, context, member: discord.Member): """Give someone <NAME>!""" author = context.message.author.mention mention = member.mention jojo = "**{0} got a reference by {1}!**" choices = ['https://i.imgur.com/XJhnSv5.gif', 'https://i.imgur.com/3xhoZg8.gif', 'https://i.imgur.com/D7SqDBP.gif', 'https://i.imgur.com/dUAc1jw.gif', 'https://i.imgur.com/W7OsiYW.gif'] image = random.choice(choices) embed = discord.Embed(description=jojo.format(mention, author), colour=discord.Colour.blue()) embed.set_image(url=image) await self.bot.say(embed=embed) def setup(bot): n = jojo(bot) bot.add_cog(n)
[ 1, 515, 2313, 536, 29889, 1062, 1053, 8260, 30004, 13, 5215, 4036, 30004, 13, 5215, 2313, 536, 30004, 13, 30004, 13, 1990, 2958, 2212, 29901, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9225, 1125, 30004, 13, 4706, 1583, 29889, 7451, 353, 9225, 30004, 13, 30004, 13, 1678, 732, 26381, 29889, 6519, 29898, 3364, 29918, 4703, 29922, 5574, 8443, 13, 1678, 7465, 822, 2958, 2212, 29898, 1311, 29892, 3030, 29892, 4509, 29901, 2313, 536, 29889, 13404, 1125, 30004, 13, 4706, 9995, 29954, 573, 4856, 529, 5813, 29958, 3850, 15945, 30004, 13, 4706, 4148, 353, 3030, 29889, 4906, 29889, 8921, 29889, 358, 291, 30004, 13, 4706, 3585, 353, 4509, 29889, 358, 291, 30004, 13, 30004, 13, 4706, 2958, 2212, 353, 376, 1068, 29912, 29900, 29913, 2355, 263, 3407, 491, 426, 29896, 29913, 29991, 1068, 19451, 13, 30004, 13, 4706, 19995, 353, 6024, 991, 597, 29875, 29889, 3320, 29889, 510, 29914, 29990, 29967, 3123, 29903, 29894, 29945, 29889, 18660, 742, 525, 991, 597, 29875, 29889, 3320, 29889, 510, 29914, 29941, 29916, 1251, 29999, 29887, 29947, 29889, 18660, 742, 525, 991, 597, 29875, 29889, 3320, 29889, 510, 29914, 29928, 29955, 29903, 29939, 4051, 29925, 29889, 18660, 742, 525, 991, 597, 29875, 29889, 3320, 29889, 510, 29914, 29881, 29965, 10644, 29896, 29926, 29893, 29889, 18660, 742, 525, 991, 597, 29875, 29889, 3320, 29889, 510, 29914, 29956, 29955, 29949, 1039, 29979, 29956, 29889, 18660, 2033, 30004, 13, 30004, 13, 4706, 1967, 353, 4036, 29889, 16957, 29898, 1859, 1575, 8443, 13, 30004, 13, 4706, 8297, 353, 2313, 536, 29889, 6026, 2580, 29898, 8216, 29922, 2212, 2212, 29889, 4830, 29898, 358, 291, 29892, 4148, 511, 12384, 29922, 2218, 16090, 29889, 1625, 473, 29889, 9539, 3101, 30004, 13, 4706, 8297, 29889, 842, 29918, 3027, 29898, 2271, 29922, 3027, 8443, 13, 30004, 13, 4706, 7272, 1583, 29889, 7451, 29889, 20834, 29898, 17987, 29922, 17987, 8443, 13, 30004, 13, 1753, 6230, 29898, 7451, 1125, 30004, 13, 1678, 302, 353, 2958, 2212, 29898, 7451, 8443, 13, 1678, 9225, 29889, 1202, 29918, 29883, 468, 29898, 29876, 8443, 13, 2 ]
api/utils/input/__init__.py
mmangione/alcali
306
53422
from shlex import split import json class RawCommand: def __init__(self, command, client="local", posix=True, inline=False): # TODO: check shlex.quote, raw string, etc.. if inline: self.command = split(command, posix=posix) else: self.command = split(command, posix=posix)[1:] self.options = {"expr_form": "glob"} self.client = client def parse(self): args = self.command if args[0].startswith("--client"): self.client = args[0].split("=")[1] args.pop(0) low = {"client": self.client} if self.client.startswith("local"): if len(args) < 2: return "Command or target not specified" # Batch option low["batch"] = None if self.client == "local_batch": batch_index = None for index, arg in enumerate(args): if arg in ["-b", "--batch", "--batch-size"]: low["batch"] = args[index + 1] batch_index = index if batch_index: args.pop(batch_index) args.pop(batch_index) # Timeout option timeout_index = None for index, arg in enumerate(args): if arg in ["-t", "--timeout"]: low["timeout"] = int(args[index + 1]) timeout_index = index if timeout_index: args.pop(timeout_index) args.pop(timeout_index) # take care of targeting. target_dict = { "pcre": ["-E", "--pcre"], "list": ["-L", "--list"], "grain": ["-G", "--grain"], "grain_pcre": ["--grain-pcre"], "pillar": ["-I", "--pillar"], "pillar_pcre": ["--pillar-pcre"], "range": ["-R", "--range"], "compound": ["-C", "--compound"], "nodegroup": ["-N", "--nodegroup"], } for key, value in target_dict.items(): if args[0] in value: self.options["expr_form"] = key args.pop(0) low["tgt_type"] = self.options["expr_form"] low["tgt"] = args.pop(0) low["fun"] = args.pop(0) low["arg"] = args elif self.client.startswith("runner") or self.client.startswith("wheel"): low["fun"] = args.pop(0) for arg in args: if "=" in arg: key, value = arg.split("=", 1) try: low[key] = json.loads(value) except json.JSONDecodeError: low[key] = value else: low.setdefault("arg", []).append(arg) else: # This should never happen return "Client not implemented: {0}".format(self.client) return [low]
[ 1, 515, 528, 2506, 1053, 6219, 13, 5215, 4390, 13, 13, 13, 1990, 22038, 6255, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1899, 29892, 3132, 543, 2997, 613, 926, 861, 29922, 5574, 29892, 10583, 29922, 8824, 1125, 13, 4706, 396, 14402, 29901, 1423, 528, 2506, 29889, 1396, 29892, 10650, 1347, 29892, 2992, 636, 13, 4706, 565, 10583, 29901, 13, 9651, 1583, 29889, 6519, 353, 6219, 29898, 6519, 29892, 926, 861, 29922, 1066, 861, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 6519, 353, 6219, 29898, 6519, 29892, 926, 861, 29922, 1066, 861, 9601, 29896, 17531, 13, 4706, 1583, 29889, 6768, 353, 8853, 13338, 29918, 689, 1115, 376, 23705, 9092, 13, 4706, 1583, 29889, 4645, 353, 3132, 13, 13, 1678, 822, 6088, 29898, 1311, 1125, 13, 4706, 6389, 353, 1583, 29889, 6519, 13, 13, 4706, 565, 6389, 29961, 29900, 1822, 27382, 2541, 703, 489, 4645, 29908, 1125, 13, 9651, 1583, 29889, 4645, 353, 6389, 29961, 29900, 1822, 5451, 703, 543, 9601, 29896, 29962, 13, 9651, 6389, 29889, 7323, 29898, 29900, 29897, 13, 13, 4706, 4482, 353, 8853, 4645, 1115, 1583, 29889, 4645, 29913, 13, 13, 4706, 565, 1583, 29889, 4645, 29889, 27382, 2541, 703, 2997, 29908, 1125, 13, 9651, 565, 7431, 29898, 5085, 29897, 529, 29871, 29906, 29901, 13, 18884, 736, 376, 6255, 470, 3646, 451, 6790, 29908, 13, 13, 9651, 396, 350, 905, 2984, 13, 9651, 4482, 3366, 16175, 3108, 353, 6213, 13, 9651, 565, 1583, 29889, 4645, 1275, 376, 2997, 29918, 16175, 1115, 13, 18884, 9853, 29918, 2248, 353, 6213, 13, 18884, 363, 2380, 29892, 1852, 297, 26985, 29898, 5085, 1125, 13, 462, 1678, 565, 1852, 297, 6796, 29899, 29890, 613, 376, 489, 16175, 613, 376, 489, 16175, 29899, 2311, 3108, 29901, 13, 462, 4706, 4482, 3366, 16175, 3108, 353, 6389, 29961, 2248, 718, 29871, 29896, 29962, 13, 462, 4706, 9853, 29918, 2248, 353, 2380, 13, 18884, 565, 9853, 29918, 2248, 29901, 13, 462, 1678, 6389, 29889, 7323, 29898, 16175, 29918, 2248, 29897, 13, 462, 1678, 6389, 29889, 7323, 29898, 16175, 29918, 2248, 29897, 13, 9651, 396, 5974, 449, 2984, 13, 9651, 11815, 29918, 2248, 353, 6213, 13, 9651, 363, 2380, 29892, 1852, 297, 26985, 29898, 5085, 1125, 13, 18884, 565, 1852, 297, 6796, 29899, 29873, 613, 376, 489, 15619, 3108, 29901, 13, 462, 1678, 4482, 3366, 15619, 3108, 353, 938, 29898, 5085, 29961, 2248, 718, 29871, 29896, 2314, 13, 462, 1678, 11815, 29918, 2248, 353, 2380, 13, 9651, 565, 11815, 29918, 2248, 29901, 13, 18884, 6389, 29889, 7323, 29898, 15619, 29918, 2248, 29897, 13, 18884, 6389, 29889, 7323, 29898, 15619, 29918, 2248, 29897, 13, 13, 9651, 396, 2125, 2562, 310, 3646, 292, 29889, 13, 9651, 3646, 29918, 8977, 353, 426, 13, 18884, 376, 29886, 1037, 1115, 6796, 29899, 29923, 613, 376, 489, 29886, 1037, 12436, 13, 18884, 376, 1761, 1115, 6796, 29899, 29931, 613, 376, 489, 1761, 12436, 13, 18884, 376, 3874, 262, 1115, 6796, 29899, 29954, 613, 376, 489, 3874, 262, 12436, 13, 18884, 376, 3874, 262, 29918, 29886, 1037, 1115, 6796, 489, 3874, 262, 29899, 29886, 1037, 12436, 13, 18884, 376, 29886, 453, 279, 1115, 6796, 29899, 29902, 613, 376, 489, 29886, 453, 279, 12436, 13, 18884, 376, 29886, 453, 279, 29918, 29886, 1037, 1115, 6796, 489, 29886, 453, 279, 29899, 29886, 1037, 12436, 13, 18884, 376, 3881, 1115, 6796, 29899, 29934, 613, 376, 489, 3881, 12436, 13, 18884, 376, 2388, 618, 1115, 6796, 29899, 29907, 613, 376, 489, 2388, 618, 12436, 13, 18884, 376, 3177, 2972, 1115, 6796, 29899, 29940, 613, 376, 489, 3177, 2972, 12436, 13, 9651, 500, 13, 9651, 363, 1820, 29892, 995, 297, 3646, 29918, 8977, 29889, 7076, 7295, 13, 18884, 565, 6389, 29961, 29900, 29962, 297, 995, 29901, 13, 462, 1678, 1583, 29889, 6768, 3366, 13338, 29918, 689, 3108, 353, 1820, 13, 462, 1678, 6389, 29889, 7323, 29898, 29900, 29897, 13, 13, 9651, 4482, 3366, 29873, 4141, 29918, 1853, 3108, 353, 1583, 29889, 6768, 3366, 13338, 29918, 689, 3108, 13, 9651, 4482, 3366, 29873, 4141, 3108, 353, 6389, 29889, 7323, 29898, 29900, 29897, 13, 9651, 4482, 3366, 7692, 3108, 353, 6389, 29889, 7323, 29898, 29900, 29897, 13, 9651, 4482, 3366, 1191, 3108, 353, 6389, 13, 13, 4706, 25342, 1583, 29889, 4645, 29889, 27382, 2541, 703, 27492, 1159, 470, 1583, 29889, 4645, 29889, 27382, 2541, 703, 29893, 10552, 29908, 1125, 13, 9651, 4482, 3366, 7692, 3108, 353, 6389, 29889, 7323, 29898, 29900, 29897, 13, 9651, 363, 1852, 297, 6389, 29901, 13, 18884, 565, 376, 543, 297, 1852, 29901, 13, 462, 1678, 1820, 29892, 995, 353, 1852, 29889, 5451, 703, 543, 29892, 29871, 29896, 29897, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 4482, 29961, 1989, 29962, 353, 4390, 29889, 18132, 29898, 1767, 29897, 13, 462, 1678, 5174, 4390, 29889, 7249, 2772, 401, 2392, 29901, 13, 462, 4706, 4482, 29961, 1989, 29962, 353, 995, 13, 18884, 1683, 29901, 13, 462, 1678, 4482, 29889, 842, 4381, 703, 1191, 613, 5159, 467, 4397, 29898, 1191, 29897, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 910, 881, 2360, 3799, 13, 9651, 736, 376, 4032, 451, 8762, 29901, 426, 29900, 29913, 1642, 4830, 29898, 1311, 29889, 4645, 29897, 13, 13, 4706, 736, 518, 677, 29962, 13, 2 ]
aiida_vasp/workchains/verify.py
muhrin/aiida-vasp
0
38088
""" Verify workchain. ----------------- Indented to be used to verify a calculation, perform corrections in inputs files and restart depending on physical principles etc. E.g. issues that are outside the Calculators awereness, or not currently checked in it. This workchain does currently nothing. """ # pylint: disable=attribute-defined-outside-init from aiida.common.extendeddicts import AttributeDict from aiida.engine import WorkChain, while_, append_ from aiida.plugins import WorkflowFactory from aiida_vasp.utils.aiida_utils import get_data_class, get_data_node from aiida_vasp.utils.workchains import prepare_process_inputs, compose_exit_code class VerifyWorkChain(WorkChain): """Verify the calculations based on basic principles from physics, chemistry and material science.""" _verbose = False _next_workchain_string = 'vasp.vasp' _next_workchain = WorkflowFactory(_next_workchain_string) @classmethod def define(cls, spec): super(VerifyWorkChain, cls).define(spec) spec.expose_inputs(cls._next_workchain) spec.input('verify.max_iterations', valid_type=get_data_class('int'), required=False, default=get_data_node('int', 1), help=""" The maximum number of iterations to perform. """) spec.exit_code(0, 'NO_ERROR', message='the sun is shining') spec.exit_code(420, 'ERROR_NO_CALLED_WORKCHAIN', message='no called workchain detected') spec.exit_code(500, 'ERROR_UNKNOWN', message='unknown error detected in the verify workchain') spec.outline( cls.initialize, while_(cls.run_next_workchains)( cls.init_next_workchain, cls.run_next_workchain, cls.verify_next_workchain ), cls.finalize ) # yapf: disable spec.expose_outputs(cls._next_workchain) def initialize(self): """Initialize.""" self._init_context() self._init_inputs() def _init_context(self): """Initialize context variables that are used during the logical flow.""" self.ctx.exit_code = self.exit_codes.ERROR_UNKNOWN # pylint: disable=no-member self.ctx.is_finished = False self.ctx.iteration = 0 self.ctx.inputs = AttributeDict() def _init_inputs(self): """Initialize inputs.""" try: self._verbose = self.inputs.verbose.value self.ctx.inputs.verbose = self.inputs.verbose except AttributeError: pass def run_next_workchains(self): """ Return whether a new calculation should be run. This is the case as long as the last calculation has not finished successfully and the maximum number of restarts has not yet been exceeded. """ return not self.ctx.is_finished and self.ctx.iteration <= self.inputs.verify.max_iterations.value def init_next_workchain(self): """Initialize the next workchain.""" self.ctx.iteration += 1 try: self.ctx.inputs except AttributeError: raise ValueError('No input dictionary was defined in self.ctx.inputs') # Add exposed inputs self.ctx.inputs.update(self.exposed_inputs(self._next_workchain)) # Make sure we do not have any floating dict (convert to Dict) self.ctx.inputs = prepare_process_inputs(self.ctx.inputs) def run_next_workchain(self): """Run the next workchain.""" inputs = self.ctx.inputs running = self.submit(self._next_workchain, **inputs) self.report('launching {}<{}> iteration #{}'.format(self._next_workchain.__name__, running.pk, self.ctx.iteration)) return self.to_context(workchains=append_(running)) def verify_next_workchain(self): """ Correct for unexpected physics/chemistry/material science behavior. Here we should correct all things that voids what we expect from physics/chemistry/material science. I.e. things that cannot be corrected for at the calculation level (simple restarts etc.). """ # Currently only set to finished on first go. self.ctx.is_finished = True try: workchain = self.ctx.workchains[-1] except IndexError: self.report('There is no {} in the called workchain list.'.format(self._next_workchain.__name__)) return self.exit_codes.ERROR_NO_CALLED_WORKCHAIN # pylint: disable=no-member # Inherit exit status from last workchain (supposed to be # successfull) next_workchain_exit_status = workchain.exit_status next_workchain_exit_message = workchain.exit_message if not next_workchain_exit_status: self.ctx.exit_code = self.exit_codes.NO_ERROR # pylint: disable=no-member else: self.ctx.exit_code = compose_exit_code(next_workchain_exit_status, next_workchain_exit_message) self.report('The called {}<{}> returned a non-zero exit status. ' 'The exit status {} is inherited'.format(workchain.__class__.__name__, workchain.pk, self.ctx.exit_code)) return self.ctx.exit_code def finalize(self): """Finalize the workchain.""" workchain = self.ctx.workchains[-1] self.out_many(self.exposed_outputs(workchain, self._next_workchain))
[ 1, 9995, 13, 6565, 1598, 664, 14153, 29889, 13, 13, 2683, 29899, 13, 2568, 14927, 304, 367, 1304, 304, 11539, 263, 13944, 29892, 2189, 14515, 1953, 297, 10970, 2066, 322, 13, 5060, 442, 8679, 373, 9128, 18671, 2992, 29889, 382, 29889, 29887, 29889, 5626, 393, 526, 5377, 278, 20535, 4097, 263, 556, 18543, 29892, 13, 272, 451, 5279, 7120, 297, 372, 29889, 910, 664, 14153, 947, 5279, 3078, 29889, 13, 15945, 29908, 13, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 12715, 29899, 12119, 29899, 449, 2975, 29899, 2344, 13, 3166, 7468, 1458, 29889, 9435, 29889, 1062, 2760, 8977, 29879, 1053, 23833, 21533, 13, 3166, 7468, 1458, 29889, 10599, 1053, 5244, 14688, 29892, 1550, 3383, 9773, 29918, 13, 3166, 7468, 1458, 29889, 12800, 1053, 5244, 1731, 5126, 13, 3166, 7468, 1458, 29918, 4428, 29886, 29889, 13239, 29889, 1794, 1458, 29918, 13239, 1053, 679, 29918, 1272, 29918, 1990, 29892, 679, 29918, 1272, 29918, 3177, 13, 3166, 7468, 1458, 29918, 4428, 29886, 29889, 13239, 29889, 1287, 305, 2708, 1053, 19012, 29918, 5014, 29918, 2080, 29879, 29892, 27435, 29918, 13322, 29918, 401, 13, 13, 13, 1990, 1798, 1598, 5531, 14688, 29898, 5531, 14688, 1125, 13, 1678, 9995, 6565, 1598, 278, 17203, 2729, 373, 6996, 18671, 515, 17558, 29892, 8950, 6020, 322, 5518, 10466, 1213, 15945, 13, 13, 1678, 903, 369, 15828, 353, 7700, 13, 1678, 903, 4622, 29918, 1287, 14153, 29918, 1807, 353, 525, 4428, 29886, 29889, 4428, 29886, 29915, 13, 1678, 903, 4622, 29918, 1287, 14153, 353, 5244, 1731, 5126, 7373, 4622, 29918, 1287, 14153, 29918, 1807, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4529, 29898, 25932, 29892, 1580, 1125, 13, 4706, 2428, 29898, 6565, 1598, 5531, 14688, 29892, 1067, 29879, 467, 7922, 29898, 6550, 29897, 13, 4706, 1580, 29889, 735, 4220, 29918, 2080, 29879, 29898, 25932, 3032, 4622, 29918, 1287, 14153, 29897, 13, 4706, 1580, 29889, 2080, 877, 27902, 29889, 3317, 29918, 1524, 800, 742, 13, 462, 259, 2854, 29918, 1853, 29922, 657, 29918, 1272, 29918, 1990, 877, 524, 5477, 13, 462, 259, 3734, 29922, 8824, 29892, 13, 462, 259, 2322, 29922, 657, 29918, 1272, 29918, 3177, 877, 524, 742, 29871, 29896, 511, 13, 462, 259, 1371, 13776, 29908, 13, 462, 259, 450, 7472, 1353, 310, 24372, 304, 2189, 29889, 13, 462, 259, 5124, 1159, 13, 4706, 1580, 29889, 13322, 29918, 401, 29898, 29900, 29892, 525, 6632, 29918, 11432, 742, 2643, 2433, 1552, 6575, 338, 528, 2827, 1495, 13, 4706, 1580, 29889, 13322, 29918, 401, 29898, 29946, 29906, 29900, 29892, 525, 11432, 29918, 6632, 29918, 29907, 1964, 20566, 29918, 11686, 29968, 3210, 29909, 1177, 742, 2643, 2433, 1217, 2000, 664, 14153, 17809, 1495, 13, 4706, 1580, 29889, 13322, 29918, 401, 29898, 29945, 29900, 29900, 29892, 525, 11432, 29918, 3904, 29968, 6632, 16048, 742, 2643, 2433, 26690, 1059, 17809, 297, 278, 11539, 664, 14153, 1495, 13, 4706, 1580, 29889, 449, 1220, 29898, 13, 9651, 1067, 29879, 29889, 24926, 29892, 13, 9651, 1550, 23538, 25932, 29889, 3389, 29918, 4622, 29918, 1287, 305, 2708, 5033, 13, 18884, 1067, 29879, 29889, 2344, 29918, 4622, 29918, 1287, 14153, 29892, 13, 18884, 1067, 29879, 29889, 3389, 29918, 4622, 29918, 1287, 14153, 29892, 13, 18884, 1067, 29879, 29889, 27902, 29918, 4622, 29918, 1287, 14153, 13, 9651, 10353, 13, 9651, 1067, 29879, 29889, 8394, 675, 13, 4706, 1723, 29871, 396, 343, 481, 29888, 29901, 11262, 13, 13, 4706, 1580, 29889, 735, 4220, 29918, 4905, 29879, 29898, 25932, 3032, 4622, 29918, 1287, 14153, 29897, 13, 13, 1678, 822, 11905, 29898, 1311, 1125, 13, 4706, 9995, 6644, 6646, 1213, 15945, 13, 4706, 1583, 3032, 2344, 29918, 4703, 580, 13, 4706, 1583, 3032, 2344, 29918, 2080, 29879, 580, 13, 13, 1678, 822, 903, 2344, 29918, 4703, 29898, 1311, 1125, 13, 4706, 9995, 6644, 6646, 3030, 3651, 393, 526, 1304, 2645, 278, 16667, 4972, 1213, 15945, 13, 4706, 1583, 29889, 13073, 29889, 13322, 29918, 401, 353, 1583, 29889, 13322, 29918, 18137, 29889, 11432, 29918, 3904, 29968, 6632, 16048, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 14242, 13, 4706, 1583, 29889, 13073, 29889, 275, 29918, 4951, 3276, 353, 7700, 13, 4706, 1583, 29889, 13073, 29889, 1524, 362, 353, 29871, 29900, 13, 4706, 1583, 29889, 13073, 29889, 2080, 29879, 353, 23833, 21533, 580, 13, 13, 1678, 822, 903, 2344, 29918, 2080, 29879, 29898, 1311, 1125, 13, 4706, 9995, 6644, 6646, 10970, 1213, 15945, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 369, 15828, 353, 1583, 29889, 2080, 29879, 29889, 369, 15828, 29889, 1767, 13, 9651, 1583, 29889, 13073, 29889, 2080, 29879, 29889, 369, 15828, 353, 1583, 29889, 2080, 29879, 29889, 369, 15828, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 1209, 13, 13, 1678, 822, 1065, 29918, 4622, 29918, 1287, 305, 2708, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 7106, 3692, 263, 716, 13944, 881, 367, 1065, 29889, 13, 13, 4706, 910, 338, 278, 1206, 408, 1472, 408, 278, 1833, 13944, 756, 451, 7743, 8472, 322, 278, 7472, 1353, 310, 1791, 5708, 13, 4706, 756, 451, 3447, 1063, 13461, 287, 29889, 13, 4706, 9995, 13, 4706, 736, 451, 1583, 29889, 13073, 29889, 275, 29918, 4951, 3276, 322, 1583, 29889, 13073, 29889, 1524, 362, 5277, 1583, 29889, 2080, 29879, 29889, 27902, 29889, 3317, 29918, 1524, 800, 29889, 1767, 13, 13, 1678, 822, 2069, 29918, 4622, 29918, 1287, 14153, 29898, 1311, 1125, 13, 4706, 9995, 6644, 6646, 278, 2446, 664, 14153, 1213, 15945, 13, 13, 4706, 1583, 29889, 13073, 29889, 1524, 362, 4619, 29871, 29896, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 13073, 29889, 2080, 29879, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 12020, 7865, 2392, 877, 3782, 1881, 8600, 471, 3342, 297, 1583, 29889, 13073, 29889, 2080, 29879, 1495, 13, 13, 4706, 396, 3462, 19884, 10970, 13, 4706, 1583, 29889, 13073, 29889, 2080, 29879, 29889, 5504, 29898, 1311, 29889, 735, 4752, 29918, 2080, 29879, 29898, 1311, 3032, 4622, 29918, 1287, 14153, 876, 13, 13, 4706, 396, 8561, 1854, 591, 437, 451, 505, 738, 16526, 9657, 313, 13441, 304, 360, 919, 29897, 13, 4706, 1583, 29889, 13073, 29889, 2080, 29879, 353, 19012, 29918, 5014, 29918, 2080, 29879, 29898, 1311, 29889, 13073, 29889, 2080, 29879, 29897, 13, 13, 1678, 822, 1065, 29918, 4622, 29918, 1287, 14153, 29898, 1311, 1125, 13, 4706, 9995, 6558, 278, 2446, 664, 14153, 1213, 15945, 13, 4706, 10970, 353, 1583, 29889, 13073, 29889, 2080, 29879, 13, 4706, 2734, 353, 1583, 29889, 7892, 29898, 1311, 3032, 4622, 29918, 1287, 14153, 29892, 3579, 2080, 29879, 29897, 13, 13, 4706, 1583, 29889, 12276, 877, 15343, 292, 6571, 29966, 8875, 29958, 12541, 396, 8875, 4286, 4830, 29898, 1311, 3032, 4622, 29918, 1287, 14153, 17255, 978, 1649, 29892, 2734, 29889, 20571, 29892, 1583, 29889, 13073, 29889, 1524, 362, 876, 13, 4706, 736, 1583, 29889, 517, 29918, 4703, 29898, 1287, 305, 2708, 29922, 4397, 23538, 21094, 876, 13, 13, 1678, 822, 11539, 29918, 4622, 29918, 1287, 14153, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 28518, 363, 15668, 17558, 29914, 14969, 6020, 29914, 15388, 10466, 6030, 29889, 13, 13, 4706, 2266, 591, 881, 1959, 599, 2712, 393, 1780, 29879, 825, 591, 2149, 515, 13, 4706, 17558, 29914, 14969, 6020, 29914, 15388, 10466, 29889, 306, 29889, 29872, 29889, 2712, 393, 2609, 367, 24114, 363, 472, 278, 13, 4706, 13944, 3233, 313, 12857, 1791, 5708, 2992, 6250, 13, 4706, 9995, 13, 13, 4706, 396, 15447, 871, 731, 304, 7743, 373, 937, 748, 29889, 13, 4706, 1583, 29889, 13073, 29889, 275, 29918, 4951, 3276, 353, 5852, 13, 13, 4706, 1018, 29901, 13, 9651, 664, 14153, 353, 1583, 29889, 13073, 29889, 1287, 305, 2708, 14352, 29896, 29962, 13, 4706, 5174, 11374, 2392, 29901, 13, 9651, 1583, 29889, 12276, 877, 8439, 338, 694, 6571, 297, 278, 2000, 664, 14153, 1051, 29889, 4286, 4830, 29898, 1311, 3032, 4622, 29918, 1287, 14153, 17255, 978, 1649, 876, 13, 9651, 736, 1583, 29889, 13322, 29918, 18137, 29889, 11432, 29918, 6632, 29918, 29907, 1964, 20566, 29918, 11686, 29968, 3210, 29909, 1177, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 14242, 13, 13, 4706, 396, 512, 27069, 6876, 4660, 515, 1833, 664, 14153, 313, 19303, 2662, 304, 367, 13, 4706, 396, 2551, 8159, 29897, 13, 4706, 2446, 29918, 1287, 14153, 29918, 13322, 29918, 4882, 353, 664, 14153, 29889, 13322, 29918, 4882, 13, 4706, 2446, 29918, 1287, 14153, 29918, 13322, 29918, 4906, 353, 664, 14153, 29889, 13322, 29918, 4906, 13, 4706, 565, 451, 2446, 29918, 1287, 14153, 29918, 13322, 29918, 4882, 29901, 13, 9651, 1583, 29889, 13073, 29889, 13322, 29918, 401, 353, 1583, 29889, 13322, 29918, 18137, 29889, 6632, 29918, 11432, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 14242, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 13073, 29889, 13322, 29918, 401, 353, 27435, 29918, 13322, 29918, 401, 29898, 4622, 29918, 1287, 14153, 29918, 13322, 29918, 4882, 29892, 2446, 29918, 1287, 14153, 29918, 13322, 29918, 4906, 29897, 13, 9651, 1583, 29889, 12276, 877, 1576, 2000, 6571, 29966, 8875, 29958, 4133, 263, 1661, 29899, 9171, 6876, 4660, 29889, 525, 13, 462, 4706, 525, 1576, 6876, 4660, 6571, 338, 23878, 4286, 4830, 29898, 1287, 14153, 17255, 1990, 1649, 17255, 978, 1649, 29892, 664, 14153, 29889, 20571, 29892, 1583, 29889, 13073, 29889, 13322, 29918, 401, 876, 13, 13, 4706, 736, 1583, 29889, 13073, 29889, 13322, 29918, 401, 13, 13, 1678, 822, 2186, 675, 29898, 1311, 1125, 13, 4706, 9995, 15790, 675, 278, 664, 14153, 1213, 15945, 13, 4706, 664, 14153, 353, 1583, 29889, 13073, 29889, 1287, 305, 2708, 14352, 29896, 29962, 13, 4706, 1583, 29889, 449, 29918, 13011, 29898, 1311, 29889, 735, 4752, 29918, 4905, 29879, 29898, 1287, 14153, 29892, 1583, 3032, 4622, 29918, 1287, 14153, 876, 13, 2 ]
search/linear/linear_rawan.py
ra1ski/python-data-structures-and-algorithms
0
188153
<filename>search/linear/linear_rawan.py # Linear search algorithm # @ra1ski def linear_search(item, _list): index = None for idx, val in enumerate(_list): if val == item: index = idx break return index if __name__ == '__main__': _list = ['chrome', 'firefox', 'opera', 'ie', 'netscape'] item = input('Type browser name:') foundIndex = linear_search(item, _list) if foundIndex is not None: print('Item is in the list. Index: %d. Iterations: %d' % (foundIndex, foundIndex)) else: _list.append(item) print('Item is not in the list, but we appened it for you', _list)
[ 1, 529, 9507, 29958, 4478, 29914, 10660, 29914, 10660, 29918, 1610, 273, 29889, 2272, 13, 29937, 22985, 2740, 5687, 13, 29937, 732, 336, 29896, 2574, 13, 13, 13, 1753, 5608, 29918, 4478, 29898, 667, 29892, 903, 1761, 1125, 13, 1678, 2380, 353, 6213, 13, 13, 1678, 363, 22645, 29892, 659, 297, 26985, 7373, 1761, 1125, 13, 4706, 565, 659, 1275, 2944, 29901, 13, 9651, 2380, 353, 22645, 13, 9651, 2867, 13, 13, 1678, 736, 2380, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 903, 1761, 353, 6024, 18114, 742, 525, 8696, 8944, 742, 525, 22984, 742, 525, 347, 742, 525, 1212, 29879, 5738, 2033, 13, 1678, 2944, 353, 1881, 877, 1542, 4714, 1024, 29901, 1495, 13, 1678, 1476, 3220, 353, 5608, 29918, 4478, 29898, 667, 29892, 903, 1761, 29897, 13, 13, 1678, 565, 1476, 3220, 338, 451, 6213, 29901, 13, 4706, 1596, 877, 2001, 338, 297, 278, 1051, 29889, 11374, 29901, 1273, 29881, 29889, 20504, 800, 29901, 1273, 29881, 29915, 1273, 313, 11940, 3220, 29892, 1476, 3220, 876, 13, 1678, 1683, 29901, 13, 4706, 903, 1761, 29889, 4397, 29898, 667, 29897, 13, 4706, 1596, 877, 2001, 338, 451, 297, 278, 1051, 29892, 541, 591, 623, 6419, 372, 363, 366, 742, 903, 1761, 29897, 13, 2 ]
custom_components/sleep_as_android/const.py
Antoni-Czaplicki/HA-SleepAsAndroid
0
198439
<filename>custom_components/sleep_as_android/const.py import voluptuous as vol DOMAIN = "sleep_as_android" DEVICE_MACRO: str = "%%%device%%%" DEFAULT_NAME = "SleepAsAndroid" DEFAULT_TOPIC_TEMPLATE = "SleepAsAndroid/%s" % DEVICE_MACRO DEFAULT_QOS = 0
[ 1, 529, 9507, 29958, 6341, 29918, 14036, 29914, 17059, 29918, 294, 29918, 2843, 29914, 3075, 29889, 2272, 13, 5215, 1700, 21245, 17269, 408, 1700, 13, 13, 3970, 29032, 353, 376, 17059, 29918, 294, 29918, 2843, 29908, 13, 2287, 19059, 29918, 1529, 29907, 1672, 29901, 851, 353, 376, 7686, 29995, 10141, 7686, 23577, 13, 13, 23397, 29918, 5813, 353, 376, 29903, 5436, 2887, 8136, 29908, 13, 23397, 29918, 4986, 2227, 29907, 29918, 4330, 3580, 29931, 3040, 353, 376, 29903, 5436, 2887, 8136, 22584, 29879, 29908, 1273, 5012, 19059, 29918, 1529, 29907, 1672, 13, 23397, 29918, 29984, 3267, 353, 29871, 29900, 13, 2 ]
atcoder/corp/code-festival-2017-qualc_a.py
knuu/competitive-programming
1
151812
<filename>atcoder/corp/code-festival-2017-qualc_a.py def main() -> None: S = input() print("Yes" if "AC" in [S[i:i+2] for i in range(len(S)-1)] else "No") if __name__ == '__main__': main()
[ 1, 529, 9507, 29958, 271, 29883, 6119, 29914, 2616, 29886, 29914, 401, 29899, 29888, 6074, 29899, 29906, 29900, 29896, 29955, 29899, 15380, 29883, 29918, 29874, 29889, 2272, 13, 1753, 1667, 580, 1599, 6213, 29901, 13, 1678, 317, 353, 1881, 580, 13, 1678, 1596, 703, 8241, 29908, 565, 376, 2477, 29908, 297, 518, 29903, 29961, 29875, 29901, 29875, 29974, 29906, 29962, 363, 474, 297, 3464, 29898, 2435, 29898, 29903, 6817, 29896, 4638, 1683, 376, 3782, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
mars/dataframe/datasource/date_range.py
haijohn/mars
1
194386
<reponame>haijohn/mars # Copyright 1999-2020 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from datetime import datetime, date, time import numpy as np import pandas as pd from pandas.tseries.frequencies import to_offset from pandas.tseries.offsets import Tick from pandas._libs.tslibs import timezones from ... import opcodes as OperandDef from ...config import options from ...core import OutputType from ...serialization.serializables import AnyField, Int64Field, BoolField, StringField from ...tensor.utils import decide_chunk_sizes from ..operands import DataFrameOperand, DataFrameOperandMixin from ..utils import parse_index try: from pandas._libs.tslib import normalize_date except ImportError: # pragma: no cover def normalize_date(dt): # from pandas/_libs/tslibs/conversion.pyx if isinstance(dt, datetime): if isinstance(dt, pd.Timestamp): return dt.replace(hour=0, minute=0, second=0, microsecond=0, nanosecond=0) else: return dt.replace(hour=0, minute=0, second=0, microsecond=0) elif isinstance(dt, date): return datetime(dt.year, dt.month, dt.day) else: raise TypeError(f'Unrecognized type: {type(dt)}') class DataFrameDateRange(DataFrameOperand, DataFrameOperandMixin): _op_type_ = OperandDef.DATE_RANGE _start = AnyField('start') _end = AnyField('end') _periods = Int64Field('periods') _freq = AnyField('freq') _tz = AnyField('tz') _normalize = BoolField('normalize') _name = StringField('name') _closed = StringField('closed') def __init__(self, start=None, end=None, periods=None, freq=None, tz=None, normalize=None, name=None, closed=None, output_types=None, **kw): super().__init__(_start=start, _end=end, _periods=periods, _freq=freq, _tz=tz, _normalize=normalize, _name=name, _closed=closed, _output_types=output_types, **kw) if self.output_types is None: self.output_types = [OutputType.index] @property def start(self): return self._start @property def end(self): return self._end @property def periods(self): return self._periods @property def freq(self): return self._freq @property def tz(self): return self._tz @property def normalize(self): return self._normalize @property def name(self): return self._name @property def closed(self): return self._closed def __call__(self, shape, chunk_size=None): dtype = pd.Index([self._start]).dtype index_value = parse_index(pd.Index([], dtype=dtype), self._start, self._end, self._periods, self._tz) # gen index value info index_value.value._min_val = self._start index_value.value._min_val_close = True index_value.value._max_val = self._end index_value.value._max_val_close = True index_value.value._is_unique = True index_value.value._is_monotonic_increasing = True index_value.value._freq = self._freq return self.new_index(None, shape=shape, dtype=dtype, index_value=index_value, name=self._name, raw_chunk_size=chunk_size, freq=self._freq) @classmethod def tile(cls, op): out = op.outputs[0] start = op.start end = op.end freq = op.freq periods = op.periods closed = op.closed chunk_length = out.extra_params.raw_chunk_size or options.chunk_size chunk_length = decide_chunk_sizes(out.shape, chunk_length, out.dtype.itemsize)[0] if closed == 'right': # if left not close, add one more for the first chunk chunk_length = (chunk_length[0] + 1,) + chunk_length[1:] if freq is None: if periods > 1: freq = (end - op.start) / (periods - 1) else: freq = end - start out_chunks = [] cum_nsplit = [0] + np.cumsum(chunk_length).tolist() for i, chunk_size in enumerate(chunk_length): chunk_op = op.copy().reset_key() chunk_op._periods = chunk_size if closed != 'right' or i > 0: chunk_op._closed = None chunk_i_start = cum_nsplit[i] if chunk_i_start > 0: chunk_start = chunk_op._start = start + freq * chunk_i_start else: chunk_start = chunk_op._start = start chunk_end = chunk_op._end = chunk_start + (chunk_size - 1) * freq # gen chunk index_value chunk_index_value = parse_index(out.index_value.to_pandas(), i, out) chunk_index_value.value._min_val = chunk_start chunk_index_value.value._min_val_close = True chunk_index_value.value._max_val = chunk_end chunk_index_value.value._max_val_close = True chunk_index_value.value._is_unique = True chunk_index_value.value._is_monotonic_increasing = True size = chunk_size - 1 if i == 0 and closed == 'right' else chunk_size out_chunk = chunk_op.new_chunk(None, shape=(size,), index=(i,), dtype=out.dtype, index_value=chunk_index_value, name=out.name) out_chunks.append(out_chunk) new_op = op.copy() params = out.params params['chunks'] = out_chunks params['nsplits'] = (tuple(c.shape[0] for c in out_chunks),) return new_op.new_indexes(None, kws=[params]) @classmethod def execute(cls, ctx, op): start, end, periods = op.start, op.end, op.periods freq = op.freq if freq is not None: end = None ctx[op.outputs[0].key] = pd.date_range( start=start, end=end, periods=periods, freq=freq, tz=op.tz, normalize=op.normalize, name=op.name, closed=op.closed) _midnight = time(0, 0) def _maybe_normalize_endpoints(start, end, normalize): # pragma: no cover _normalized = True if start is not None: if normalize: start = normalize_date(start) _normalized = True else: _normalized = _normalized and start.time() == _midnight if end is not None: if normalize: end = normalize_date(end) _normalized = True else: _normalized = _normalized and end.time() == _midnight return start, end, _normalized def _infer_tz_from_endpoints(start, end, tz): # pragma: no cover """ If a timezone is not explicitly given via `tz`, see if one can be inferred from the `start` and `end` endpoints. If more than one of these inputs provides a timezone, require that they all agree. Parameters ---------- start : Timestamp end : Timestamp tz : tzinfo or None Returns ------- tz : tzinfo or None Raises ------ TypeError : if start and end timezones do not agree """ try: inferred_tz = timezones.infer_tzinfo(start, end) except AssertionError: # infer_tzinfo raises AssertionError if passed mismatched timezones raise TypeError( "Start and end cannot both be tz-aware with different timezones" ) inferred_tz = timezones.maybe_get_tz(inferred_tz) tz = timezones.maybe_get_tz(tz) if tz is not None and inferred_tz is not None: if not timezones.tz_compare(inferred_tz, tz): raise AssertionError("Inferred time zone not equal to passed time zone") elif inferred_tz is not None: tz = inferred_tz return tz def _maybe_localize_point(ts, is_none, is_not_none, freq, tz, ambiguous, nonexistent): # pragma: no cover """ Localize a start or end Timestamp to the timezone of the corresponding start or end Timestamp Parameters ---------- ts : start or end Timestamp to potentially localize is_none : argument that should be None is_not_none : argument that should not be None freq : Tick, DateOffset, or None tz : str, timezone object or None ambiguous: str, localization behavior for ambiguous times nonexistent: str, localization behavior for nonexistent times Returns ------- ts : Timestamp """ # Make sure start and end are timezone localized if: # 1) freq = a Timedelta-like frequency (Tick) # 2) freq = None i.e. generating a linspaced range if is_none is None and is_not_none is not None: # Note: We can't ambiguous='infer' a singular ambiguous time; however, # we have historically defaulted ambiguous=False ambiguous = ambiguous if ambiguous != "infer" else False localize_args = {"ambiguous": ambiguous, "nonexistent": nonexistent, "tz": None} if isinstance(freq, Tick) or freq is None: localize_args["tz"] = tz ts = ts.tz_localize(**localize_args) return ts def date_range(start=None, end=None, periods=None, freq=None, tz=None, normalize=False, name=None, closed=None, chunk_size=None, **kwargs): """ Return a fixed frequency DatetimeIndex. Parameters ---------- start : str or datetime-like, optional Left bound for generating dates. end : str or datetime-like, optional Right bound for generating dates. periods : int, optional Number of periods to generate. freq : str or DateOffset, default 'D' Frequency strings can have multiples, e.g. '5H'. See :ref:`here <timeseries.offset_aliases>` for a list of frequency aliases. tz : str or tzinfo, optional Time zone name for returning localized DatetimeIndex, for example 'Asia/Hong_Kong'. By default, the resulting DatetimeIndex is timezone-naive. normalize : bool, default False Normalize start/end dates to midnight before generating date range. name : str, default None Name of the resulting DatetimeIndex. closed : {None, 'left', 'right'}, optional Make the interval closed with respect to the given frequency to the 'left', 'right', or both sides (None, the default). **kwargs For compatibility. Has no effect on the result. Returns ------- rng : DatetimeIndex See Also -------- DatetimeIndex : An immutable container for datetimes. timedelta_range : Return a fixed frequency TimedeltaIndex. period_range : Return a fixed frequency PeriodIndex. interval_range : Return a fixed frequency IntervalIndex. Notes ----- Of the four parameters ``start``, ``end``, ``periods``, and ``freq``, exactly three must be specified. If ``freq`` is omitted, the resulting ``DatetimeIndex`` will have ``periods`` linearly spaced elements between ``start`` and ``end`` (closed on both sides). To learn more about the frequency strings, please see `this link <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__. Examples -------- **Specifying the values** The next four examples generate the same `DatetimeIndex`, but vary the combination of `start`, `end` and `periods`. Specify `start` and `end`, with the default daily frequency. >>> import mars.dataframe as md >>> md.date_range(start='1/1/2018', end='1/08/2018').execute() DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'], dtype='datetime64[ns]', freq='D') Specify `start` and `periods`, the number of periods (days). >>> md.date_range(start='1/1/2018', periods=8).execute() DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'], dtype='datetime64[ns]', freq='D') Specify `end` and `periods`, the number of periods (days). >>> md.date_range(end='1/1/2018', periods=8).execute() DatetimeIndex(['2017-12-25', '2017-12-26', '2017-12-27', '2017-12-28', '2017-12-29', '2017-12-30', '2017-12-31', '2018-01-01'], dtype='datetime64[ns]', freq='D') Specify `start`, `end`, and `periods`; the frequency is generated automatically (linearly spaced). >>> md.date_range(start='2018-04-24', end='2018-04-27', periods=3).execute() DatetimeIndex(['2018-04-24 00:00:00', '2018-04-25 12:00:00', '2018-04-27 00:00:00'], dtype='datetime64[ns]', freq=None) **Other Parameters** Changed the `freq` (frequency) to ``'M'`` (month end frequency). >>> md.date_range(start='1/1/2018', periods=5, freq='M').execute() DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31', '2018-04-30', '2018-05-31'], dtype='datetime64[ns]', freq='M') Multiples are allowed >>> md.date_range(start='1/1/2018', periods=5, freq='3M').execute() DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31', '2019-01-31'], dtype='datetime64[ns]', freq='3M') `freq` can also be specified as an Offset object. >>> md.date_range(start='1/1/2018', periods=5, freq=md.offsets.MonthEnd(3)).execute() DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31', '2019-01-31'], dtype='datetime64[ns]', freq='3M') Specify `tz` to set the timezone. >>> md.date_range(start='1/1/2018', periods=5, tz='Asia/Tokyo').execute() DatetimeIndex(['2018-01-01 00:00:00+09:00', '2018-01-02 00:00:00+09:00', '2018-01-03 00:00:00+09:00', '2018-01-04 00:00:00+09:00', '2018-01-05 00:00:00+09:00'], dtype='datetime64[ns, Asia/Tokyo]', freq='D') `closed` controls whether to include `start` and `end` that are on the boundary. The default includes boundary points on either end. >>> md.date_range(start='2017-01-01', end='2017-01-04', closed=None).execute() DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03', '2017-01-04'], dtype='datetime64[ns]', freq='D') Use ``closed='left'`` to exclude `end` if it falls on the boundary. >>> md.date_range(start='2017-01-01', end='2017-01-04', closed='left').execute() DatetimeIndex(['2017-01-01', '2017-01-02', '2017-01-03'], dtype='datetime64[ns]', freq='D') Use ``closed='right'`` to exclude `start` if it falls on the boundary. >>> md.date_range(start='2017-01-01', end='2017-01-04', closed='right').execute() DatetimeIndex(['2017-01-02', '2017-01-03', '2017-01-04'], dtype='datetime64[ns]', freq='D') """ # validate periods if isinstance(periods, (float, np.floating)): periods = int(periods) if periods is not None and not isinstance(periods, (int, np.integer)): raise TypeError(f'periods must be a number, got {periods}') if freq is None and any(arg is None for arg in [periods, start, end]): freq = 'D' if sum(arg is not None for arg in [start, end, periods, freq]) != 3: raise ValueError('Of the four parameters: start, end, periods, ' 'and freq, exactly three must be specified') freq = to_offset(freq) if start is not None: start = pd.Timestamp(start) if end is not None: end = pd.Timestamp(end) if start is pd.NaT or end is pd.NaT: raise ValueError('Neither `start` nor `end` can be NaT') start, end, _ = _maybe_normalize_endpoints(start, end, normalize) tz = _infer_tz_from_endpoints(start, end, tz) if start is None and end is not None: # start is None and end is not None # adjust end first end = pd.date_range(end=end, periods=1, freq=freq)[0] size = periods start = end - (periods - 1) * freq if closed == 'left': size -= 1 elif closed == 'right': # when start is None, closed == 'left' would not take effect # thus just ignore closed = None elif end is None: # end is None # adjust start first start = pd.date_range(start=start, periods=1, freq=freq)[0] size = periods end = start + (periods - 1) * freq if closed == 'right': size -= 1 elif closed == 'left': # when end is None, closed == 'left' would not take effect # thus just ignore closed = None else: if periods is None: periods = size = int((end - start) / freq + 1) else: size = periods if closed is not None: size -= 1 shape = (size,) op = DataFrameDateRange(start=start, end=end, periods=periods, freq=freq, tz=tz, normalize=normalize, closed=closed, name=name, **kwargs) return op(shape, chunk_size=chunk_size)
[ 1, 529, 276, 1112, 420, 29958, 2350, 823, 6547, 29914, 29885, 1503, 13, 29937, 14187, 1266, 29871, 29896, 29929, 29929, 29929, 29899, 29906, 29900, 29906, 29900, 319, 1982, 5363, 6431, 21771, 292, 19806, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 418, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 3166, 12865, 1053, 12865, 29892, 2635, 29892, 931, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 3166, 11701, 29889, 29873, 13757, 29889, 10745, 339, 15942, 1053, 304, 29918, 10289, 13, 3166, 11701, 29889, 29873, 13757, 29889, 2696, 7224, 1053, 323, 860, 13, 3166, 11701, 3032, 10254, 29889, 1372, 10254, 1053, 931, 29920, 2873, 13, 13, 3166, 2023, 1053, 1015, 18137, 408, 6607, 392, 3206, 13, 3166, 2023, 2917, 1053, 3987, 13, 3166, 2023, 3221, 1053, 10604, 1542, 13, 3166, 2023, 15550, 2133, 29889, 15550, 466, 1849, 1053, 3139, 3073, 29892, 3159, 29953, 29946, 3073, 29892, 18912, 3073, 29892, 1714, 3073, 13, 3166, 2023, 20158, 29889, 13239, 1053, 11097, 29918, 29812, 29918, 29879, 7093, 13, 3166, 6317, 3372, 4167, 1053, 3630, 4308, 7094, 392, 29892, 3630, 4308, 7094, 392, 29924, 861, 262, 13, 3166, 6317, 13239, 1053, 6088, 29918, 2248, 13, 13, 2202, 29901, 13, 1678, 515, 11701, 3032, 10254, 29889, 1372, 1982, 1053, 4226, 675, 29918, 1256, 13, 19499, 16032, 2392, 29901, 29871, 396, 282, 23929, 29901, 694, 4612, 13, 1678, 822, 4226, 675, 29918, 1256, 29898, 6008, 1125, 29871, 396, 515, 11701, 19891, 10254, 29914, 1372, 10254, 29914, 535, 3259, 29889, 2272, 29916, 13, 4706, 565, 338, 8758, 29898, 6008, 29892, 12865, 1125, 13, 9651, 565, 338, 8758, 29898, 6008, 29892, 10518, 29889, 27939, 1125, 13, 18884, 736, 11636, 29889, 6506, 29898, 18721, 29922, 29900, 29892, 11015, 29922, 29900, 29892, 1473, 29922, 29900, 29892, 9200, 7496, 29922, 29900, 29892, 13, 462, 462, 29871, 23432, 852, 1116, 29922, 29900, 29897, 13, 9651, 1683, 29901, 13, 18884, 736, 11636, 29889, 6506, 29898, 18721, 29922, 29900, 29892, 11015, 29922, 29900, 29892, 1473, 29922, 29900, 29892, 9200, 7496, 29922, 29900, 29897, 13, 4706, 25342, 338, 8758, 29898, 6008, 29892, 2635, 1125, 13, 9651, 736, 12865, 29898, 6008, 29889, 6360, 29892, 11636, 29889, 10874, 29892, 11636, 29889, 3250, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 20948, 29898, 29888, 29915, 2525, 29423, 1891, 1134, 29901, 426, 1853, 29898, 6008, 2915, 1495, 13, 13, 13, 1990, 3630, 4308, 2539, 6069, 29898, 17271, 7094, 392, 29892, 3630, 4308, 7094, 392, 29924, 861, 262, 1125, 13, 1678, 903, 459, 29918, 1853, 29918, 353, 6607, 392, 3206, 29889, 6248, 29918, 29934, 24336, 13, 13, 1678, 903, 2962, 353, 3139, 3073, 877, 2962, 1495, 13, 1678, 903, 355, 353, 3139, 3073, 877, 355, 1495, 13, 1678, 903, 19145, 29879, 353, 3159, 29953, 29946, 3073, 877, 19145, 29879, 1495, 13, 1678, 903, 29888, 7971, 353, 3139, 3073, 877, 29888, 7971, 1495, 13, 1678, 903, 17559, 353, 3139, 3073, 877, 17559, 1495, 13, 1678, 903, 8945, 675, 353, 18912, 3073, 877, 8945, 675, 1495, 13, 1678, 903, 978, 353, 1714, 3073, 877, 978, 1495, 13, 1678, 903, 15603, 353, 1714, 3073, 877, 15603, 1495, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1369, 29922, 8516, 29892, 1095, 29922, 8516, 29892, 23704, 29922, 8516, 29892, 13, 462, 3005, 29939, 29922, 8516, 29892, 260, 29920, 29922, 8516, 29892, 4226, 675, 29922, 8516, 29892, 1024, 29922, 8516, 29892, 13, 462, 5764, 29922, 8516, 29892, 1962, 29918, 8768, 29922, 8516, 29892, 3579, 11022, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 7373, 2962, 29922, 2962, 29892, 903, 355, 29922, 355, 29892, 903, 19145, 29879, 29922, 19145, 29879, 29892, 13, 462, 308, 903, 29888, 7971, 29922, 29888, 7971, 29892, 903, 17559, 29922, 17559, 29892, 903, 8945, 675, 29922, 8945, 675, 29892, 13, 462, 308, 903, 978, 29922, 978, 29892, 903, 15603, 29922, 15603, 29892, 13, 462, 308, 903, 4905, 29918, 8768, 29922, 4905, 29918, 8768, 29892, 3579, 11022, 29897, 13, 4706, 565, 1583, 29889, 4905, 29918, 8768, 338, 6213, 29901, 13, 9651, 1583, 29889, 4905, 29918, 8768, 353, 518, 6466, 1542, 29889, 2248, 29962, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1369, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 2962, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1095, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 355, 13, 13, 1678, 732, 6799, 13, 1678, 822, 23704, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 19145, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3005, 29939, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 29888, 7971, 13, 13, 1678, 732, 6799, 13, 1678, 822, 260, 29920, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 17559, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4226, 675, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 8945, 675, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1024, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 978, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5764, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 15603, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 8267, 29892, 19875, 29918, 2311, 29922, 8516, 1125, 13, 4706, 26688, 353, 10518, 29889, 3220, 4197, 1311, 3032, 2962, 14664, 29881, 1853, 13, 4706, 2380, 29918, 1767, 353, 6088, 29918, 2248, 29898, 15926, 29889, 3220, 4197, 1402, 26688, 29922, 29881, 1853, 511, 13, 462, 462, 29871, 1583, 3032, 2962, 29892, 1583, 3032, 355, 29892, 1583, 3032, 19145, 29879, 29892, 13, 462, 462, 29871, 1583, 3032, 17559, 29897, 13, 4706, 396, 2531, 2380, 995, 5235, 13, 4706, 2380, 29918, 1767, 29889, 1767, 3032, 1195, 29918, 791, 353, 1583, 3032, 2962, 13, 4706, 2380, 29918, 1767, 29889, 1767, 3032, 1195, 29918, 791, 29918, 5358, 353, 5852, 13, 4706, 2380, 29918, 1767, 29889, 1767, 3032, 3317, 29918, 791, 353, 1583, 3032, 355, 13, 4706, 2380, 29918, 1767, 29889, 1767, 3032, 3317, 29918, 791, 29918, 5358, 353, 5852, 13, 4706, 2380, 29918, 1767, 29889, 1767, 3032, 275, 29918, 13092, 353, 5852, 13, 4706, 2380, 29918, 1767, 29889, 1767, 3032, 275, 29918, 3712, 327, 8927, 29918, 262, 1037, 5832, 353, 5852, 13, 4706, 2380, 29918, 1767, 29889, 1767, 3032, 29888, 7971, 353, 1583, 3032, 29888, 7971, 13, 4706, 736, 1583, 29889, 1482, 29918, 2248, 29898, 8516, 29892, 8267, 29922, 12181, 29892, 26688, 29922, 29881, 1853, 29892, 13, 462, 795, 2380, 29918, 1767, 29922, 2248, 29918, 1767, 29892, 1024, 29922, 1311, 3032, 978, 29892, 13, 462, 795, 10650, 29918, 29812, 29918, 2311, 29922, 29812, 29918, 2311, 29892, 3005, 29939, 29922, 1311, 3032, 29888, 7971, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 25900, 29898, 25932, 29892, 1015, 1125, 13, 4706, 714, 353, 1015, 29889, 4905, 29879, 29961, 29900, 29962, 13, 4706, 1369, 353, 1015, 29889, 2962, 13, 4706, 1095, 353, 1015, 29889, 355, 13, 4706, 3005, 29939, 353, 1015, 29889, 29888, 7971, 13, 4706, 23704, 353, 1015, 29889, 19145, 29879, 13, 4706, 5764, 353, 1015, 29889, 15603, 13, 13, 4706, 19875, 29918, 2848, 353, 714, 29889, 17833, 29918, 7529, 29889, 1610, 29918, 29812, 29918, 2311, 470, 3987, 29889, 29812, 29918, 2311, 13, 4706, 19875, 29918, 2848, 353, 11097, 29918, 29812, 29918, 29879, 7093, 29898, 449, 29889, 12181, 29892, 19875, 29918, 2848, 29892, 714, 29889, 29881, 1853, 29889, 667, 2311, 9601, 29900, 29962, 13, 13, 4706, 565, 5764, 1275, 525, 1266, 2396, 13, 9651, 396, 565, 2175, 451, 3802, 29892, 788, 697, 901, 363, 278, 937, 19875, 13, 9651, 19875, 29918, 2848, 353, 313, 29812, 29918, 2848, 29961, 29900, 29962, 718, 29871, 29896, 29892, 29897, 718, 19875, 29918, 2848, 29961, 29896, 17531, 13, 13, 4706, 565, 3005, 29939, 338, 6213, 29901, 13, 9651, 565, 23704, 1405, 29871, 29896, 29901, 13, 18884, 3005, 29939, 353, 313, 355, 448, 1015, 29889, 2962, 29897, 847, 313, 19145, 29879, 448, 29871, 29896, 29897, 13, 9651, 1683, 29901, 13, 18884, 3005, 29939, 353, 1095, 448, 1369, 13, 13, 4706, 714, 29918, 305, 18801, 353, 5159, 13, 4706, 13299, 29918, 1983, 2830, 353, 518, 29900, 29962, 718, 7442, 29889, 29883, 398, 2083, 29898, 29812, 29918, 2848, 467, 25027, 391, 580, 13, 4706, 363, 474, 29892, 19875, 29918, 2311, 297, 26985, 29898, 29812, 29918, 2848, 1125, 13, 9651, 19875, 29918, 459, 353, 1015, 29889, 8552, 2141, 12071, 29918, 1989, 580, 13, 9651, 19875, 29918, 459, 3032, 19145, 29879, 353, 19875, 29918, 2311, 13, 9651, 565, 5764, 2804, 525, 1266, 29915, 470, 474, 1405, 29871, 29900, 29901, 13, 18884, 19875, 29918, 459, 3032, 15603, 353, 6213, 13, 9651, 19875, 29918, 29875, 29918, 2962, 353, 13299, 29918, 1983, 2830, 29961, 29875, 29962, 13, 9651, 565, 19875, 29918, 29875, 29918, 2962, 1405, 29871, 29900, 29901, 13, 18884, 19875, 29918, 2962, 353, 19875, 29918, 459, 3032, 2962, 353, 1369, 718, 3005, 29939, 334, 19875, 29918, 29875, 29918, 2962, 13, 9651, 1683, 29901, 13, 18884, 19875, 29918, 2962, 353, 19875, 29918, 459, 3032, 2962, 353, 1369, 13, 9651, 19875, 29918, 355, 353, 19875, 29918, 459, 3032, 355, 353, 19875, 29918, 2962, 718, 313, 29812, 29918, 2311, 448, 29871, 29896, 29897, 334, 3005, 29939, 13, 13, 9651, 396, 2531, 19875, 2380, 29918, 1767, 13, 9651, 19875, 29918, 2248, 29918, 1767, 353, 6088, 29918, 2248, 29898, 449, 29889, 2248, 29918, 1767, 29889, 517, 29918, 15112, 3285, 474, 29892, 714, 29897, 13, 9651, 19875, 29918, 2248, 29918, 1767, 29889, 1767, 3032, 1195, 29918, 791, 353, 19875, 29918, 2962, 13, 9651, 19875, 29918, 2248, 29918, 1767, 29889, 1767, 3032, 1195, 29918, 791, 29918, 5358, 353, 5852, 13, 9651, 19875, 29918, 2248, 29918, 1767, 29889, 1767, 3032, 3317, 29918, 791, 353, 19875, 29918, 355, 13, 9651, 19875, 29918, 2248, 29918, 1767, 29889, 1767, 3032, 3317, 29918, 791, 29918, 5358, 353, 5852, 13, 9651, 19875, 29918, 2248, 29918, 1767, 29889, 1767, 3032, 275, 29918, 13092, 353, 5852, 13, 9651, 19875, 29918, 2248, 29918, 1767, 29889, 1767, 3032, 275, 29918, 3712, 327, 8927, 29918, 262, 1037, 5832, 353, 5852, 13, 13, 9651, 2159, 353, 19875, 29918, 2311, 448, 29871, 29896, 565, 474, 1275, 29871, 29900, 322, 5764, 1275, 525, 1266, 29915, 1683, 19875, 29918, 2311, 13, 9651, 714, 29918, 29812, 353, 19875, 29918, 459, 29889, 1482, 29918, 29812, 29898, 8516, 29892, 8267, 7607, 2311, 29892, 511, 13, 462, 462, 965, 2380, 7607, 29875, 29892, 511, 26688, 29922, 449, 29889, 29881, 1853, 29892, 13, 462, 462, 965, 2380, 29918, 1767, 29922, 29812, 29918, 2248, 29918, 1767, 29892, 13, 462, 462, 965, 1024, 29922, 449, 29889, 978, 29897, 13, 9651, 714, 29918, 305, 18801, 29889, 4397, 29898, 449, 29918, 29812, 29897, 13, 13, 4706, 716, 29918, 459, 353, 1015, 29889, 8552, 580, 13, 4706, 8636, 353, 714, 29889, 7529, 13, 4706, 8636, 1839, 305, 18801, 2033, 353, 714, 29918, 305, 18801, 13, 4706, 8636, 1839, 1983, 572, 1169, 2033, 353, 313, 23583, 29898, 29883, 29889, 12181, 29961, 29900, 29962, 363, 274, 297, 714, 29918, 305, 18801, 511, 29897, 13, 4706, 736, 716, 29918, 459, 29889, 1482, 29918, 2248, 267, 29898, 8516, 29892, 413, 5652, 11759, 7529, 2314, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 6222, 29898, 25932, 29892, 12893, 29892, 1015, 1125, 13, 4706, 1369, 29892, 1095, 29892, 23704, 353, 1015, 29889, 2962, 29892, 1015, 29889, 355, 29892, 1015, 29889, 19145, 29879, 13, 4706, 3005, 29939, 353, 1015, 29889, 29888, 7971, 13, 4706, 565, 3005, 29939, 338, 451, 6213, 29901, 13, 9651, 1095, 353, 6213, 13, 4706, 12893, 29961, 459, 29889, 4905, 29879, 29961, 29900, 1822, 1989, 29962, 353, 10518, 29889, 1256, 29918, 3881, 29898, 13, 9651, 1369, 29922, 2962, 29892, 1095, 29922, 355, 29892, 23704, 29922, 19145, 29879, 29892, 3005, 29939, 29922, 29888, 7971, 29892, 13, 9651, 260, 29920, 29922, 459, 29889, 17559, 29892, 4226, 675, 29922, 459, 29889, 8945, 675, 29892, 1024, 29922, 459, 29889, 978, 29892, 13, 9651, 5764, 29922, 459, 29889, 15603, 29897, 13, 13, 13, 29918, 6563, 11147, 353, 931, 29898, 29900, 29892, 29871, 29900, 29897, 13, 13, 13, 1753, 903, 26026, 29918, 8945, 675, 29918, 355, 9748, 29898, 2962, 29892, 1095, 29892, 4226, 675, 1125, 29871, 396, 282, 23929, 29901, 694, 4612, 13, 1678, 903, 8945, 1891, 353, 5852, 13, 13, 1678, 565, 1369, 338, 451, 6213, 29901, 13, 4706, 565, 4226, 675, 29901, 13, 9651, 1369, 353, 4226, 675, 29918, 1256, 29898, 2962, 29897, 13, 9651, 903, 8945, 1891, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 903, 8945, 1891, 353, 903, 8945, 1891, 322, 1369, 29889, 2230, 580, 1275, 903, 6563, 11147, 13, 13, 1678, 565, 1095, 338, 451, 6213, 29901, 13, 4706, 565, 4226, 675, 29901, 13, 9651, 1095, 353, 4226, 675, 29918, 1256, 29898, 355, 29897, 13, 9651, 903, 8945, 1891, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 903, 8945, 1891, 353, 903, 8945, 1891, 322, 1095, 29889, 2230, 580, 1275, 903, 6563, 11147, 13, 13, 1678, 736, 1369, 29892, 1095, 29892, 903, 8945, 1891, 13, 13, 13, 1753, 903, 262, 571, 29918, 17559, 29918, 3166, 29918, 355, 9748, 29898, 2962, 29892, 1095, 29892, 260, 29920, 1125, 29871, 396, 282, 23929, 29901, 694, 4612, 13, 1678, 9995, 13, 1678, 960, 263, 29431, 338, 451, 9479, 2183, 3025, 421, 17559, 1673, 1074, 565, 697, 508, 13, 1678, 367, 10115, 1127, 515, 278, 421, 2962, 29952, 322, 421, 355, 29952, 1095, 9748, 29889, 29871, 960, 901, 1135, 697, 13, 1678, 310, 1438, 10970, 8128, 263, 29431, 29892, 1996, 393, 896, 599, 8661, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1369, 584, 7870, 7416, 13, 1678, 1095, 584, 7870, 7416, 13, 1678, 260, 29920, 584, 260, 29920, 3888, 470, 6213, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 260, 29920, 584, 260, 29920, 3888, 470, 6213, 13, 13, 1678, 390, 1759, 267, 13, 1678, 448, 23648, 13, 1678, 20948, 584, 565, 1369, 322, 1095, 931, 29920, 2873, 437, 451, 8661, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 4706, 10115, 1127, 29918, 17559, 353, 931, 29920, 2873, 29889, 262, 571, 29918, 17559, 3888, 29898, 2962, 29892, 1095, 29897, 13, 1678, 5174, 16499, 291, 2392, 29901, 13, 4706, 396, 10115, 29918, 17559, 3888, 1153, 4637, 16499, 291, 2392, 565, 4502, 29635, 287, 931, 29920, 2873, 13, 4706, 12020, 20948, 29898, 13, 9651, 376, 4763, 322, 1095, 2609, 1716, 367, 260, 29920, 29899, 28327, 411, 1422, 931, 29920, 2873, 29908, 13, 4706, 1723, 13, 13, 1678, 10115, 1127, 29918, 17559, 353, 931, 29920, 2873, 29889, 26026, 29918, 657, 29918, 17559, 29898, 262, 14373, 29918, 17559, 29897, 13, 1678, 260, 29920, 353, 931, 29920, 2873, 29889, 26026, 29918, 657, 29918, 17559, 29898, 17559, 29897, 13, 13, 1678, 565, 260, 29920, 338, 451, 6213, 322, 10115, 1127, 29918, 17559, 338, 451, 6213, 29901, 13, 4706, 565, 451, 931, 29920, 2873, 29889, 17559, 29918, 18307, 29898, 262, 14373, 29918, 17559, 29892, 260, 29920, 1125, 13, 9651, 12020, 16499, 291, 2392, 703, 797, 14373, 931, 10640, 451, 5186, 304, 4502, 931, 10640, 1159, 13, 13, 1678, 25342, 10115, 1127, 29918, 17559, 338, 451, 6213, 29901, 13, 4706, 260, 29920, 353, 10115, 1127, 29918, 17559, 13, 13, 1678, 736, 260, 29920, 13, 13, 13, 1753, 903, 26026, 29918, 2997, 675, 29918, 3149, 29898, 1372, 29892, 338, 29918, 9290, 29892, 338, 29918, 1333, 29918, 9290, 29892, 3005, 29939, 29892, 260, 29920, 29892, 22363, 681, 29892, 5642, 29916, 9696, 1125, 29871, 396, 282, 23929, 29901, 694, 4612, 13, 1678, 9995, 13, 1678, 9959, 675, 263, 1369, 470, 1095, 7870, 7416, 304, 278, 29431, 310, 278, 6590, 13, 1678, 1369, 470, 1095, 7870, 7416, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 18696, 584, 1369, 470, 1095, 7870, 7416, 304, 19998, 1887, 675, 13, 1678, 338, 29918, 9290, 584, 2980, 393, 881, 367, 6213, 13, 1678, 338, 29918, 1333, 29918, 9290, 584, 2980, 393, 881, 451, 367, 6213, 13, 1678, 3005, 29939, 584, 323, 860, 29892, 4712, 10302, 29892, 470, 6213, 13, 1678, 260, 29920, 584, 851, 29892, 29431, 1203, 470, 6213, 13, 1678, 22363, 681, 29901, 851, 29892, 1887, 2133, 6030, 363, 22363, 681, 3064, 13, 1678, 5642, 29916, 9696, 29901, 851, 29892, 1887, 2133, 6030, 363, 5642, 29916, 9696, 3064, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 18696, 584, 7870, 7416, 13, 1678, 9995, 13, 1678, 396, 8561, 1854, 1369, 322, 1095, 526, 29431, 1887, 1891, 565, 29901, 13, 1678, 396, 29871, 29896, 29897, 3005, 29939, 353, 263, 7870, 287, 2554, 29899, 4561, 10868, 313, 29911, 860, 29897, 13, 1678, 396, 29871, 29906, 29897, 3005, 29939, 353, 6213, 474, 29889, 29872, 29889, 14655, 263, 6276, 1028, 562, 287, 3464, 13, 1678, 565, 338, 29918, 9290, 338, 6213, 322, 338, 29918, 1333, 29918, 9290, 338, 451, 6213, 29901, 13, 4706, 396, 3940, 29901, 1334, 508, 29915, 29873, 22363, 681, 2433, 262, 571, 29915, 263, 13512, 22363, 681, 931, 29936, 3138, 29892, 13, 4706, 396, 591, 505, 3603, 1711, 2322, 287, 22363, 681, 29922, 8824, 13, 4706, 22363, 681, 353, 22363, 681, 565, 22363, 681, 2804, 376, 262, 571, 29908, 1683, 7700, 13, 4706, 1887, 675, 29918, 5085, 353, 8853, 14727, 681, 1115, 22363, 681, 29892, 376, 9290, 29916, 9696, 1115, 5642, 29916, 9696, 29892, 376, 17559, 1115, 6213, 29913, 13, 4706, 565, 338, 8758, 29898, 29888, 7971, 29892, 323, 860, 29897, 470, 3005, 29939, 338, 6213, 29901, 13, 9651, 1887, 675, 29918, 5085, 3366, 17559, 3108, 353, 260, 29920, 13, 4706, 18696, 353, 18696, 29889, 17559, 29918, 2997, 675, 29898, 1068, 2997, 675, 29918, 5085, 29897, 13, 1678, 736, 18696, 13, 13, 13, 1753, 2635, 29918, 3881, 29898, 2962, 29922, 8516, 29892, 1095, 29922, 8516, 29892, 23704, 29922, 8516, 29892, 3005, 29939, 29922, 8516, 29892, 260, 29920, 29922, 8516, 29892, 13, 1669, 4226, 675, 29922, 8824, 29892, 1024, 29922, 8516, 29892, 5764, 29922, 8516, 29892, 19875, 29918, 2311, 29922, 8516, 29892, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 7106, 263, 4343, 10868, 13373, 5410, 3220, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1369, 584, 851, 470, 12865, 29899, 4561, 29892, 13136, 13, 4706, 19941, 3216, 363, 14655, 10116, 29889, 13, 1678, 1095, 584, 851, 470, 12865, 29899, 4561, 29892, 13136, 13, 4706, 10428, 3216, 363, 14655, 10116, 29889, 13, 1678, 23704, 584, 938, 29892, 13136, 13, 4706, 9681, 310, 23704, 304, 5706, 29889, 13, 1678, 3005, 29939, 584, 851, 470, 4712, 10302, 29892, 2322, 525, 29928, 29915, 13, 4706, 3878, 23860, 6031, 508, 505, 2473, 2701, 29892, 321, 29889, 29887, 29889, 525, 29945, 29950, 4286, 2823, 13, 4706, 584, 999, 18078, 4150, 529, 3706, 6358, 29889, 10289, 29918, 2606, 2129, 13885, 363, 263, 1051, 310, 13, 4706, 10868, 14430, 2129, 29889, 13, 1678, 260, 29920, 584, 851, 470, 260, 29920, 3888, 29892, 13136, 13, 4706, 5974, 10640, 1024, 363, 7863, 1887, 1891, 13373, 5410, 3220, 29892, 363, 1342, 13, 4706, 525, 2887, 423, 29914, 29950, 549, 29918, 29968, 549, 4286, 2648, 2322, 29892, 278, 9819, 13373, 5410, 3220, 338, 13, 4706, 29431, 29899, 1056, 573, 29889, 13, 1678, 4226, 675, 584, 6120, 29892, 2322, 7700, 13, 4706, 21981, 675, 1369, 29914, 355, 10116, 304, 7145, 11147, 1434, 14655, 2635, 3464, 29889, 13, 1678, 1024, 584, 851, 29892, 2322, 6213, 13, 4706, 4408, 310, 278, 9819, 13373, 5410, 3220, 29889, 13, 1678, 5764, 584, 426, 8516, 29892, 525, 1563, 742, 525, 1266, 16675, 13136, 13, 4706, 8561, 278, 7292, 5764, 411, 3390, 304, 278, 2183, 10868, 304, 13, 4706, 278, 525, 1563, 742, 525, 1266, 742, 470, 1716, 11192, 313, 8516, 29892, 278, 2322, 467, 13, 1678, 3579, 19290, 13, 4706, 1152, 24521, 29889, 11699, 694, 2779, 373, 278, 1121, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 364, 865, 584, 13373, 5410, 3220, 13, 13, 1678, 2823, 3115, 13, 1678, 448, 26589, 13, 1678, 13373, 5410, 3220, 584, 530, 5198, 9246, 5639, 363, 1418, 300, 1355, 29889, 13, 1678, 5335, 287, 2554, 29918, 3881, 584, 7106, 263, 4343, 10868, 7870, 287, 2554, 3220, 29889, 13, 1678, 3785, 29918, 3881, 584, 7106, 263, 4343, 10868, 29498, 3220, 29889, 13, 1678, 7292, 29918, 3881, 584, 7106, 263, 4343, 10868, 4124, 791, 3220, 29889, 13, 13, 1678, 8695, 13, 1678, 448, 807, 13, 1678, 4587, 278, 3023, 4128, 4954, 2962, 29952, 1673, 4954, 355, 29952, 1673, 4954, 19145, 29879, 29952, 1673, 322, 4954, 29888, 7971, 29952, 1673, 13, 1678, 3721, 2211, 1818, 367, 6790, 29889, 960, 4954, 29888, 7971, 16159, 338, 25811, 29892, 278, 9819, 13, 1678, 4954, 16390, 5410, 3220, 16159, 674, 505, 4954, 19145, 29879, 16159, 5608, 368, 26325, 287, 3161, 1546, 13, 1678, 4954, 2962, 16159, 322, 4954, 355, 16159, 313, 15603, 373, 1716, 11192, 467, 13, 13, 1678, 1763, 5110, 901, 1048, 278, 10868, 6031, 29892, 3113, 1074, 421, 1366, 1544, 13, 1678, 529, 991, 597, 15112, 29889, 2272, 1272, 29889, 990, 29914, 15112, 29899, 2640, 29914, 13844, 29914, 1792, 29918, 13075, 29914, 3706, 6358, 29889, 1420, 29937, 10289, 29899, 2606, 2129, 13885, 26914, 13, 13, 1678, 1222, 9422, 13, 1678, 448, 26589, 13, 1678, 3579, 10299, 9215, 278, 1819, 1068, 13, 13, 1678, 450, 2446, 3023, 6455, 5706, 278, 1021, 421, 16390, 5410, 3220, 1673, 541, 13100, 13, 1678, 278, 10296, 310, 421, 2962, 1673, 421, 355, 29952, 322, 421, 19145, 29879, 1412, 13, 13, 1678, 12048, 1598, 421, 2962, 29952, 322, 421, 355, 1673, 411, 278, 2322, 14218, 10868, 29889, 13, 1678, 8653, 1053, 7438, 29889, 1272, 2557, 408, 22821, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29947, 742, 1095, 2433, 29896, 29914, 29900, 29947, 29914, 29906, 29900, 29896, 29947, 2824, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29906, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29941, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29946, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29945, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29953, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29955, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29947, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29928, 1495, 13, 13, 1678, 12048, 1598, 421, 2962, 29952, 322, 421, 19145, 29879, 1673, 278, 1353, 310, 23704, 313, 16700, 467, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29947, 742, 23704, 29922, 29947, 467, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29906, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29941, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29946, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29945, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29953, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29955, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29947, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29928, 1495, 13, 13, 1678, 12048, 1598, 421, 355, 29952, 322, 421, 19145, 29879, 1673, 278, 1353, 310, 23704, 313, 16700, 467, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 355, 2433, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29947, 742, 23704, 29922, 29947, 467, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29906, 29945, 742, 525, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29906, 29953, 742, 525, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29906, 29955, 742, 525, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29906, 29947, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29906, 29929, 742, 525, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29941, 29900, 742, 525, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29941, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29896, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29928, 1495, 13, 13, 1678, 12048, 1598, 421, 2962, 1673, 421, 355, 1673, 322, 421, 19145, 29879, 21966, 278, 10868, 338, 5759, 13, 1678, 6336, 313, 10660, 368, 26325, 287, 467, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29906, 29946, 742, 1095, 2433, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29906, 29955, 742, 23704, 29922, 29941, 467, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29906, 29946, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29906, 29945, 29871, 29896, 29906, 29901, 29900, 29900, 29901, 29900, 29900, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29906, 29955, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 29922, 8516, 29897, 13, 13, 1678, 3579, 16107, 12662, 2699, 1068, 13, 13, 1678, 678, 4618, 278, 421, 29888, 7971, 29952, 313, 10745, 23860, 29897, 304, 4954, 29915, 29924, 11120, 29952, 313, 10874, 1095, 10868, 467, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29947, 742, 23704, 29922, 29945, 29892, 3005, 29939, 2433, 29924, 2824, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29941, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29906, 29899, 29906, 29947, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29941, 29899, 29941, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29941, 29900, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29945, 29899, 29941, 29896, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29924, 1495, 13, 13, 1678, 14974, 2701, 526, 6068, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29947, 742, 23704, 29922, 29945, 29892, 3005, 29939, 2433, 29941, 29924, 2824, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29941, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29941, 29900, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29955, 29899, 29941, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29896, 29900, 29899, 29941, 29896, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29929, 29899, 29900, 29896, 29899, 29941, 29896, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29941, 29924, 1495, 13, 13, 1678, 421, 29888, 7971, 29952, 508, 884, 367, 6790, 408, 385, 5947, 842, 1203, 29889, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29947, 742, 23704, 29922, 29945, 29892, 3005, 29939, 29922, 3487, 29889, 2696, 7224, 29889, 13953, 5044, 29898, 29941, 8106, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29941, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29941, 29900, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29955, 29899, 29941, 29896, 742, 525, 29906, 29900, 29896, 29947, 29899, 29896, 29900, 29899, 29941, 29896, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29929, 29899, 29900, 29896, 29899, 29941, 29896, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29941, 29924, 1495, 13, 13, 1678, 12048, 1598, 421, 17559, 29952, 304, 731, 278, 29431, 29889, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29947, 742, 23704, 29922, 29945, 29892, 260, 29920, 2433, 2887, 423, 29914, 29911, 554, 9029, 2824, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29896, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 29974, 29900, 29929, 29901, 29900, 29900, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29906, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 29974, 29900, 29929, 29901, 29900, 29900, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29941, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 29974, 29900, 29929, 29901, 29900, 29900, 742, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29946, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 29974, 29900, 29929, 29901, 29900, 29900, 742, 13, 462, 259, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29896, 29899, 29900, 29945, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 29974, 29900, 29929, 29901, 29900, 29900, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29892, 14325, 29914, 29911, 554, 9029, 29962, 742, 3005, 29939, 2433, 29928, 1495, 13, 13, 1678, 421, 15603, 29952, 11761, 3692, 304, 3160, 421, 2962, 29952, 322, 421, 355, 29952, 393, 526, 373, 278, 13, 1678, 10452, 29889, 450, 2322, 7805, 10452, 3291, 373, 2845, 1095, 29889, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29896, 742, 1095, 2433, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29946, 742, 5764, 29922, 8516, 467, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29896, 742, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29906, 742, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29941, 742, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29946, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29928, 1495, 13, 13, 1678, 4803, 4954, 15603, 2433, 1563, 11120, 29952, 304, 19060, 421, 355, 29952, 565, 372, 20074, 373, 278, 10452, 29889, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29896, 742, 1095, 2433, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29946, 742, 5764, 2433, 1563, 2824, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29896, 742, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29906, 742, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29941, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29928, 1495, 13, 13, 1678, 4803, 4954, 15603, 2433, 1266, 11120, 29952, 304, 19060, 421, 2962, 29952, 565, 372, 20074, 373, 278, 10452, 29889, 13, 13, 1678, 8653, 22821, 29889, 1256, 29918, 3881, 29898, 2962, 2433, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29896, 742, 1095, 2433, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29946, 742, 5764, 2433, 1266, 2824, 7978, 580, 13, 1678, 13373, 5410, 3220, 18959, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29906, 742, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29941, 742, 525, 29906, 29900, 29896, 29955, 29899, 29900, 29896, 29899, 29900, 29946, 7464, 13, 462, 29871, 26688, 2433, 12673, 29953, 29946, 29961, 1983, 29962, 742, 3005, 29939, 2433, 29928, 1495, 13, 1678, 9995, 13, 1678, 396, 12725, 23704, 13, 1678, 565, 338, 8758, 29898, 19145, 29879, 29892, 313, 7411, 29892, 7442, 29889, 29888, 417, 1218, 22164, 13, 4706, 23704, 353, 938, 29898, 19145, 29879, 29897, 13, 1678, 565, 23704, 338, 451, 6213, 322, 451, 338, 8758, 29898, 19145, 29879, 29892, 313, 524, 29892, 7442, 29889, 16031, 22164, 13, 4706, 12020, 20948, 29898, 29888, 29915, 19145, 29879, 1818, 367, 263, 1353, 29892, 2355, 426, 19145, 29879, 29913, 1495, 13, 13, 1678, 565, 3005, 29939, 338, 6213, 322, 738, 29898, 1191, 338, 6213, 363, 1852, 297, 518, 19145, 29879, 29892, 1369, 29892, 1095, 29962, 1125, 13, 4706, 3005, 29939, 353, 525, 29928, 29915, 13, 1678, 565, 2533, 29898, 1191, 338, 451, 6213, 363, 1852, 297, 518, 2962, 29892, 1095, 29892, 23704, 29892, 3005, 29939, 2314, 2804, 29871, 29941, 29901, 13, 4706, 12020, 7865, 2392, 877, 2776, 278, 3023, 4128, 29901, 1369, 29892, 1095, 29892, 23704, 29892, 525, 13, 462, 308, 525, 392, 3005, 29939, 29892, 3721, 2211, 1818, 367, 6790, 1495, 13, 1678, 3005, 29939, 353, 304, 29918, 10289, 29898, 29888, 7971, 29897, 13, 13, 1678, 565, 1369, 338, 451, 6213, 29901, 13, 4706, 1369, 353, 10518, 29889, 27939, 29898, 2962, 29897, 13, 13, 1678, 565, 1095, 338, 451, 6213, 29901, 13, 4706, 1095, 353, 10518, 29889, 27939, 29898, 355, 29897, 13, 13, 1678, 565, 1369, 338, 10518, 29889, 13695, 29911, 470, 1095, 338, 10518, 29889, 13695, 29911, 29901, 13, 4706, 12020, 7865, 2392, 877, 8139, 2121, 421, 2962, 29952, 3643, 421, 355, 29952, 508, 367, 4465, 29911, 1495, 13, 13, 1678, 1369, 29892, 1095, 29892, 903, 353, 903, 26026, 29918, 8945, 675, 29918, 355, 9748, 29898, 2962, 29892, 1095, 29892, 4226, 675, 29897, 13, 1678, 260, 29920, 353, 903, 262, 571, 29918, 17559, 29918, 3166, 29918, 355, 9748, 29898, 2962, 29892, 1095, 29892, 260, 29920, 29897, 13, 13, 1678, 565, 1369, 338, 6213, 322, 1095, 338, 451, 6213, 29901, 13, 4706, 396, 1369, 338, 6213, 322, 1095, 338, 451, 6213, 13, 4706, 396, 10365, 1095, 937, 13, 4706, 1095, 353, 10518, 29889, 1256, 29918, 3881, 29898, 355, 29922, 355, 29892, 23704, 29922, 29896, 29892, 3005, 29939, 29922, 29888, 7971, 9601, 29900, 29962, 13, 4706, 2159, 353, 23704, 13, 4706, 1369, 353, 1095, 448, 313, 19145, 29879, 448, 29871, 29896, 29897, 334, 3005, 29939, 13, 4706, 565, 5764, 1275, 525, 1563, 2396, 13, 9651, 2159, 22361, 29871, 29896, 13, 4706, 25342, 5764, 1275, 525, 1266, 2396, 13, 9651, 396, 746, 1369, 338, 6213, 29892, 5764, 1275, 525, 1563, 29915, 723, 451, 2125, 2779, 13, 9651, 396, 4550, 925, 11455, 13, 9651, 5764, 353, 6213, 13, 1678, 25342, 1095, 338, 6213, 29901, 13, 4706, 396, 1095, 338, 6213, 13, 4706, 396, 10365, 1369, 937, 13, 4706, 1369, 353, 10518, 29889, 1256, 29918, 3881, 29898, 2962, 29922, 2962, 29892, 23704, 29922, 29896, 29892, 3005, 29939, 29922, 29888, 7971, 9601, 29900, 29962, 13, 4706, 2159, 353, 23704, 13, 4706, 1095, 353, 1369, 718, 313, 19145, 29879, 448, 29871, 29896, 29897, 334, 3005, 29939, 13, 4706, 565, 5764, 1275, 525, 1266, 2396, 13, 9651, 2159, 22361, 29871, 29896, 13, 4706, 25342, 5764, 1275, 525, 1563, 2396, 13, 9651, 396, 746, 1095, 338, 6213, 29892, 5764, 1275, 525, 1563, 29915, 723, 451, 2125, 2779, 13, 9651, 396, 4550, 925, 11455, 13, 9651, 5764, 353, 6213, 13, 1678, 1683, 29901, 13, 4706, 565, 23704, 338, 6213, 29901, 13, 9651, 23704, 353, 2159, 353, 938, 3552, 355, 448, 1369, 29897, 847, 3005, 29939, 718, 29871, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 2159, 353, 23704, 13, 4706, 565, 5764, 338, 451, 6213, 29901, 13, 9651, 2159, 22361, 29871, 29896, 13, 13, 1678, 8267, 353, 313, 2311, 29892, 29897, 13, 1678, 1015, 353, 3630, 4308, 2539, 6069, 29898, 2962, 29922, 2962, 29892, 1095, 29922, 355, 29892, 23704, 29922, 19145, 29879, 29892, 13, 462, 9651, 3005, 29939, 29922, 29888, 7971, 29892, 260, 29920, 29922, 17559, 29892, 4226, 675, 29922, 8945, 675, 29892, 13, 462, 9651, 5764, 29922, 15603, 29892, 1024, 29922, 978, 29892, 3579, 19290, 29897, 13, 1678, 736, 1015, 29898, 12181, 29892, 19875, 29918, 2311, 29922, 29812, 29918, 2311, 29897, 13, 2 ]
python_concurrency/simulationExample_multiprocessing.py
karthik/berkeley
106
165292
import numpy as np import time from multiprocessing import Pool, cpu_count import sys sys.path.append('..') from numpyVectorization.motion_gauss import simulateParticles_loop # How do we pass multiple arguments via pool? Use wrapper functions! Note: # lambda functions will NOT work for this purpose def wrapper_fun(args): return simulateParticles_loop(*args) if __name__ == "__main__": num_particles = 100000 num_steps = 100 num_cpus = cpu_count() # Determine how many particles to run on each worker num_particles_per_core = int(num_particles / num_cpus) # # input arrays # inArys = [np.zeros((num_particles_per_core, num_steps)) for i in range(num_cpus)] # for ary in inArys: print ary.shape # Set up our pool p = Pool(num_cpus) # Make our arguments args = [(num_particles_per_core, num_steps, False)] * num_cpus # from itertools import izip, repeat # args = izip(repeat(num_particles_per_core, num_cpus), repeat(num_steps, num_cpus), repeat(False, num_cpus)) # Send the wrapper function and the iterable args to map tic = time.time() # Start time of code running result = p.map_async(wrapper_fun, args) # Get the result when it's ready poolresult = result.get() toc = time.time() p.close() p.join() print "%.5f sec to compute %s particles" %((toc-tic), num_particles)
[ 1, 1053, 12655, 408, 7442, 13, 5215, 931, 13, 3166, 6674, 307, 985, 292, 1053, 28625, 29892, 26403, 29918, 2798, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 4397, 877, 636, 1495, 13, 3166, 12655, 12877, 2133, 29889, 29885, 8194, 29918, 29887, 11214, 1053, 29611, 7439, 4027, 29918, 7888, 13, 13, 29937, 1128, 437, 591, 1209, 2999, 6273, 3025, 11565, 29973, 4803, 14476, 3168, 29991, 3940, 29901, 29871, 13, 29937, 14013, 3168, 674, 6058, 664, 363, 445, 6437, 13, 1753, 14476, 29918, 7692, 29898, 5085, 1125, 13, 1678, 736, 29611, 7439, 4027, 29918, 7888, 10456, 5085, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29871, 954, 29918, 1595, 4027, 353, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 13, 29871, 954, 29918, 24530, 353, 29871, 29896, 29900, 29900, 13, 29871, 954, 29918, 6814, 375, 353, 26403, 29918, 2798, 580, 13, 29871, 396, 5953, 837, 457, 920, 1784, 17105, 304, 1065, 373, 1269, 15645, 13, 29871, 954, 29918, 1595, 4027, 29918, 546, 29918, 3221, 353, 938, 29898, 1949, 29918, 1595, 4027, 847, 954, 29918, 6814, 375, 29897, 13, 13, 29937, 29871, 396, 1881, 7049, 13, 29937, 29871, 297, 29909, 18450, 353, 518, 9302, 29889, 3298, 359, 3552, 1949, 29918, 1595, 4027, 29918, 546, 29918, 3221, 29892, 954, 29918, 24530, 876, 363, 474, 297, 3464, 29898, 1949, 29918, 6814, 375, 4638, 13, 29937, 29871, 363, 564, 29891, 297, 297, 29909, 18450, 29901, 1596, 564, 29891, 29889, 12181, 13, 259, 13, 29871, 396, 3789, 701, 1749, 11565, 13, 29871, 282, 353, 28625, 29898, 1949, 29918, 6814, 375, 29897, 13, 259, 13, 29871, 396, 8561, 1749, 6273, 13, 29871, 6389, 353, 17288, 1949, 29918, 1595, 4027, 29918, 546, 29918, 3221, 29892, 954, 29918, 24530, 29892, 7700, 4638, 334, 954, 29918, 6814, 375, 13, 29937, 29871, 515, 4256, 8504, 1053, 5951, 666, 29892, 12312, 13, 29937, 29871, 6389, 353, 5951, 666, 29898, 14358, 29898, 1949, 29918, 1595, 4027, 29918, 546, 29918, 3221, 29892, 954, 29918, 6814, 375, 511, 12312, 29898, 1949, 29918, 24530, 29892, 954, 29918, 6814, 375, 511, 12312, 29898, 8824, 29892, 954, 29918, 6814, 375, 876, 13, 29871, 396, 15076, 278, 14476, 740, 322, 278, 4256, 519, 6389, 304, 2910, 13, 29871, 260, 293, 353, 931, 29889, 2230, 580, 396, 7370, 931, 310, 775, 2734, 13, 29871, 1121, 353, 282, 29889, 1958, 29918, 12674, 29898, 17699, 29918, 7692, 29892, 6389, 29897, 13, 29871, 396, 3617, 278, 1121, 746, 372, 29915, 29879, 7960, 13, 29871, 11565, 2914, 353, 1121, 29889, 657, 580, 13, 29871, 304, 29883, 353, 931, 29889, 2230, 580, 13, 29871, 282, 29889, 5358, 580, 13, 29871, 282, 29889, 7122, 580, 13, 29871, 1596, 11860, 29889, 29945, 29888, 5226, 304, 10272, 1273, 29879, 17105, 29908, 1273, 3552, 517, 29883, 29899, 29873, 293, 511, 954, 29918, 1595, 4027, 29897, 13, 13, 2 ]
vnegmas/backend/src/nnegmas/my_factory_managers.py
YueNing/vnegmas
3
135794
<gh_stars>1-10 import itertools # from negmas.helpers import ConfigReader, LoggerMixin import logging from abc import ABC, abstractmethod from collections import defaultdict from negmas import (AgentMechanismInterface, Breach, Contract, MechanismState, Negotiator, RenegotiationRequest, UtilityFunction) from negmas.apps.scml import DoNothingFactoryManager, FactoryManager from negmas.apps.scml.awi import SCMLAWI, _ShadowSCMLAWI from negmas.apps.scml.common import (CFP, INVALID_UTILITY, Factory, FinancialReport, Loan, ProductionFailure, SCMLAgreement) from negmas.apps.scml.consumers import (ConsumptionProfile, ScheduleDrivenConsumer) from negmas.apps.scml.schedulers import (GreedyScheduler, ScheduleInfo, Scheduler) from negmas.apps.scml.simulators import (FactorySimulator, FastFactorySimulator, storage_as_array, temporary_transaction) from negmas.common import NamedObject from negmas.events import Notification from negmas.helpers import get_class from negmas.outcomes import Issue, Outcome from negmas.utilities import UtilityValue, normalize from .my_mechanism import AspirationNegotiator if True: from typing import ( Dict, Iterable, Any, Callable, Collection, Type, List, Optional, Union, ) class MyFactoryManager(DoNothingFactoryManager): """My factory manager""" def on_production_failure(self, failures: List[ProductionFailure]) -> None: """ On Production FailureCalled when there is a production failure due to lack of inputs or funds. """ # for failure in failures: # self.awi.logdebug(f'production failure id: {failure.line} missing_inputs: {failure.missing_inputs} \ # missing_money: {failure.missing_money} missing_space: {failure.missing_space}') pass def confirm_loan(self, loan: Loan, bankrupt_if_rejected: bool) -> bool: # self.awi.logdebug(f'loan: {Loan}, Bankrupt_if_rejected:{bankrupt_if_rejected}') return bankrupt_if_rejected def confirm_contract_execution(self, contract: Contract) -> bool: # self.awi.logdebug(f'contract:{contract}') # import random # control_probability_factor = 0.1 # random return true confirm contract execution # def decision(probability): # return random.random() < probability # if decision(control_probability_factor): # return True # return False return True def set_renegotiation_agenda( self, contract: Contract, breaches: List[Breach] ) -> Optional[RenegotiationRequest]: # self.awi.logdebug(f'Contract set renegotiation agenda {contract}') # self.awi.logdebug(f'breaches set renegotiation agenda {breaches}') # total_breach_levels = defaultdict(int) # for breach in breaches: # total_breach_levels[breach.perpetrator] += breach.level # for perpetrator,total_breach_level in total_breach_levels.items(): # : Total breach Level # if total_breach_level > 0.5: # return None # else: # self.awi.logdebug(f'return new renegotiation request, publischer {self.id} total breach level of perpetrator {perpetrator} is {total_breach_level}') # if 'cfp' in contract.annotation: # renegotiationrequest = RenegotiationRequest(publisher=f'{self.id}', issues=contract.issues, annotation=contract.annotation) # return renegotiationrequest # return None return None def respond_to_renegotiation_request( self, contract: Contract, breaches: List[Breach], agenda: RenegotiationRequest ) -> Optional[Negotiator]: # total_breach_levels = defaultdict(int) # for breach in breaches: # total_breach_levels[breach.perpetrator] += breach.level # for perpetrator, total_breach_level in total_breach_levels.items(): # if total_breach_level > 0.5: # self.awi.logdebug(f'return new negotiator for renegotiation request None ') # return None # else: # name = self.name + '*' + perpetrator # self.awi.logdebug(f'return new negotiator for renegotiation request negotiator name {name} perpetrator {perpetrator} ') # if 'cfp' in contract.annotation: # neg = self.negotiator_type(name=name, **self.negotiator_params) # neg.utility_function = normalize(self.ufun_factory(self, contract.annotation), # outcomes=contract.annotation['cfp'].outcomes, infeasible_cutoff=0) # return neg # return None return None def __init__( self, log_file_name=None, screen_log=False, name=None, simulator_type: Union[str, Type[FactorySimulator]] = FastFactorySimulator, scheduler_type: Union[str, Type[Scheduler]] = GreedyScheduler, scheduler_params: Optional[Dict[str, Any]] = None, optimism: float = 0.0, negotiator_type: Union[ str, Type[Negotiator] ] = "vnegmas.backend.src.nnegmas.my_mechanism.MyTestNegotiator", negotiator_params: Optional[Dict[str, Any]] = None, n_retrials=5, use_consumer=True, reactive=True, sign_only_guaranteed_contracts=False, riskiness=0.0, max_insurance_premium: float = 0.1, ): super().__init__(name=name, simulator_type=simulator_type) # LoggerMixin.__init__(self, file_name=log_file_name) self.negotiator_type = get_class(negotiator_type, scope=globals()) self.negotiator_params = ( negotiator_params if negotiator_params is not None else {} ) self.optimism = optimism self.ufun_factory: Union[ Type[NegotiatorUtility], Callable[[Any, Any], NegotiatorUtility] ] if optimism < 1e-6: self.ufun_factory = PessimisticNegotiatorUtility elif optimism > 1 - 1e-6: self.ufun_factory = OptimisticNegotiatorUtility else: self.ufun_factory: NegotiatorUtility = lambda agent, annotation: AveragingNegotiatorUtility( agent=agent, annotation=annotation, optimism=self.optimism ) self.max_insurance_premium = max_insurance_premium self.n_retrials = n_retrials self.n_neg_trials: Dict[str, int] = defaultdict(int) self.consumer = None self.use_consumer = use_consumer self.reactive = reactive self.sign_only_guaranteed_contracts = sign_only_guaranteed_contracts self.contract_schedules: Dict[str, ScheduleInfo] = {} self.riskiness = riskiness self.negotiation_margin = int(round(n_retrials * max(0.0, 1.0 - riskiness))) self.scheduler_type: Type[Scheduler] = get_class( scheduler_type, scope=globals() ) self.scheduler: Scheduler = None self.scheduler_params: Dict[ str, Any ] = scheduler_params if scheduler_params is not None else {} def total_utility(self, contracts: Collection[Contract] = ()) -> float: """Calculates the total utility for the agent of a collection of contracts""" if self.scheduler is None: raise ValueError("Cannot calculate total utility without a scheduler") min_concluded_at = self.awi.current_step min_sign_at = min_concluded_at + self.awi.default_signing_delay with temporary_transaction(self.scheduler): schedule = self.scheduler.schedule( contracts=contracts, assume_no_further_negotiations=False, ensure_storage_for=self.transportation_delay, start_at=min_sign_at, ) if not schedule.valid: return INVALID_UTILITY return schedule.final_balance def init(self): if self.use_consumer: # @todo add the parameters of the consumption profile as parameters of the greedy factory manager # TODO:1 Initialize a greedy scheduler and a consumer agent for managing need acquisition for production self.consumer: ScheduleDrivenConsumer = ScheduleDrivenConsumer( profiles=dict( zip( self.consuming.keys(), ( ConsumptionProfile(schedule=[_] * self.awi.n_steps) for _ in itertools.repeat(0) ), ) ), consumption_horizon=self.awi.n_steps, immediate_cfp_update=True, name=self.name, ) # self.logdebug(f'{self.consuming}') self.consumer.id = self.id self.consumer.awi = self.awi self.consumer.init_() self.scheduler = self.scheduler_type( manager_id=self.id, awi=self.awi, max_insurance_premium=self.max_insurance_premium, **self.scheduler_params, ) self.scheduler.init( simulator=self.simulator, products=self.products, processes=self.processes, producing=self.producing, profiles=self.compiled_profiles, ) def respond_to_negotiation_request( self, cfp: "CFP", partner: str ) -> Optional[Negotiator]: if self.awi.is_bankrupt(partner): return None if self.use_consumer: return self.consumer.respond_to_negotiation_request( cfp=cfp, partner=partner ) else: name = self.name + "*" + partner neg = self.negotiator_type( name=self.name + "*" + partner, **self.negotiator_params ) self.awi.logdebug(f"respond to negotiation request neg name {name}") neg.utility_function = normalize( self.ufun_factory(self, self._create_annotation(cfp=cfp)), outcomes=cfp.outcomes, infeasible_cutoff=0, ) return neg def on_negotiation_success( self, contract: Contract, mechanism: AgentMechanismInterface ): if self.use_consumer: self.consumer.on_negotiation_success(contract, mechanism) def on_negotiation_failure( self, partners: List[str], annotation: Dict[str, Any], mechanism: AgentMechanismInterface, state: MechanismState, ) -> None: # TODO8: if the factory manage was not the publisher of the cfp, and leading to this negotionation, it can retry negotiation up to 5 times per cfp with the same utility function if self.use_consumer: self.consumer.on_negotiation_failure(partners, annotation, mechanism, state) cfp = annotation["cfp"] thiscfp = self.awi.bb_query(section="cfps", query=cfp.id, query_keys=True) if ( cfp.publisher != self.id and thiscfp is not None and len(thiscfp) > 0 and self.n_neg_trials[cfp.id] < self.n_retrials ): self.awi.logdebug(f"Renegotiating {self.n_neg_trials[cfp.id]} on {cfp}") self.on_new_cfp(cfp=annotation["cfp"]) def _execute_schedule(self, schedule: ScheduleInfo, contract: Contract) -> None: # TODO: what is exactly mean of factory simulator is not defined if self.simulator is None: raise ValueError("No factory simulator is defined") awi: SCMLAWI = self.awi total = contract.agreement["unit_price"] * contract.agreement["quantity"] product = contract.annotation["cfp"].product # TODO: For buyer use consumer if contract.annotation["buyer"] == self.id: self.simulator.buy( product=product, quantity=contract.agreement["quantity"], price=total, t=contract.agreement["time"], ) if total <= 0 or self.max_insurance_premium < 0.0 or contract is None: return premium = awi.evaluate_insurance(contract=contract) if premium is None: return relative_premium = premium / total if relative_premium <= self.max_insurance_premium: awi.buy_insurance(contract=contract) self.simulator.pay(premium, self.awi.current_step) return # I am a seller # TODO: factory manager as seller self.simulator.sell( product=product, quantity=contract.agreement["quantity"], price=total, t=contract.agreement["time"], ) for job in schedule.jobs: if job.action == "run": awi.schedule_job(job, contract=contract) elif job.action == "stop": awi.stop_production( line=job.line, step=job.time, contract=contract, override=job.override, ) else: awi.schedule_job(job, contract=contract) self.simulator.schedule(job=job, override=False) for need in schedule.needs: if need.quantity_to_buy <= 0: continue product_id = need.product # self.simulator.reserve(product=product_id, quantity=need.quantity_to_buy, t=need.step) if self.use_consumer: self.consumer.profiles[product_id].schedule[ need.step ] += need.quantity_to_buy self.consumer.register_product_cfps( p=product_id, t=need.step, profile=self.consumer.profiles[product_id], ) continue product = self.products[product_id] if product.catalog_price is None: price_range = (0.0, 100.0) else: price_range = (0.5, 1.5 * product.catalog_price) # @todo check this. This error is raised sometimes if need.step < awi.current_step: continue # raise ValueError(f'need {need} at {need.step} while running at step {awi.current_step}') time = ( need.step if self.max_storage is not None else (awi.current_step, need.step) ) cfp = CFP( is_buy=True, publisher=self.id, product=product_id, time=time, unit_price=price_range, quantity=(1, int(1.1 * need.quantity_to_buy)), ) awi.register_cfp(cfp) def sign_contract(self, contract: Contract): if any(self.awi.is_bankrupt(partner) for partner in contract.partners): return None signature = self.id with temporary_transaction(self.scheduler): schedule = self.scheduler.schedule( assume_no_further_negotiations=False, contracts=[contract], ensure_storage_for=self.transportation_delay, start_at=self.awi.current_step + 1, ) if self.sign_only_guaranteed_contracts and ( not schedule.valid or len(schedule.needs) > 1 ): self.awi.logdebug( f"{self.name} refused to sign contract {contract.id} because it cannot be scheduled" ) return None # if schedule.final_balance <= self.simulator.final_balance: # self.awi.logdebug(f'{self.name} refused to sign contract {contract.id} because it is not expected ' # f'to lead to profit') # return None if schedule.valid: profit = schedule.final_balance - self.simulator.final_balance self.awi.logdebug( f"{self.name} singing contract {contract.id} expecting " f'{-profit if profit < 0 else profit} {"loss" if profit < 0 else "profit"}' ) else: self.awi.logdebug( f"{self.name} singing contract {contract.id} expecting breach" ) return None self.contract_schedules[contract.id] = schedule return signature def on_contract_signed(self, contract: Contract): if contract.annotation["buyer"] == self.id and self.use_consumer: self.consumer.on_contract_signed(contract) schedule = self.contract_schedules[contract.id] if schedule is not None and schedule.valid: self._execute_schedule(schedule=schedule, contract=contract) if contract.annotation["buyer"] != self.id or not self.use_consumer: for negotiation in self._running_negotiations.values(): self.notify( negotiation.negotiator, Notification(type="ufun_modified", data=None), ) def _process_buy_cfp(self, cfp: "CFP") -> None: # TODO5: Condition1: use the awi interface to check the bank situation of publisher, if is bankrupt, then ignore this specical cfp if self.awi.is_bankrupt(cfp.publisher): return None # TODO5: total insufficient funds breaches above 10, can not except agreement, directly ignore this cfp # TODO5.1: what is self.simulator??? if self.simulator is None or not self.can_expect_agreement( cfp=cfp, margin=self.negotiation_margin ): return # TODO5: Conidtion2: if the factory can not producte the product of this cfp, then ignore this cfp # TODO5.1 :requires securing input products in less than one step if not self.can_produce(cfp=cfp): return # TODO5: satisfy all the condition, then process this buy cfp, request **negotiation** if self.negotiator_type == AspirationNegotiator: # TODO5.1: what is the mean of assume_normalized, why when use AspirationNegotiator, set this paramters to True neg = self.negotiator_type( assume_normalized=True, name=self.name + ">" + cfp.publisher ) else: neg = self.negotiator_type(name=self.name + ">" + cfp.publisher) self.request_negotiation( negotiator=neg, cfp=cfp, ufun=normalize( self.ufun_factory(self, self._create_annotation(cfp=cfp)), outcomes=cfp.outcomes, infeasible_cutoff=-1500, ), ) def _process_sell_cfp(self, cfp: "CFP"): if self.awi.is_bankrupt(cfp.publisher): return None # TODO6: greedy factory manager just publiches "buy" cpfs for acquiring production needs, as use conumer, then calls the internal consumer object to handle production needs acquisition # TODO6.1: what's the different between use conumser and internal consumer or just the same object(checked the same object, as consumer agent) if self.use_consumer: self.consumer.on_new_cfp(cfp=cfp) def on_new_cfp(self, cfp: "CFP") -> None: if not self.reactive: return # TODO4: (1). processing the buy cfps, check in the producing of factory wether has the relativ production # TODO4: (2). processing the sell cfps, check in the consuming of factory wether has the selection or not if cfp.satisfies( query={"is_buy": True, "products": list(self.producing.keys())} ): self._process_buy_cfp(cfp) if cfp.satisfies( query={"is_buy": False, "products": list(self.consuming.keys())} ): self._process_sell_cfp(cfp) def step(self): # TODO2: consumer agent for managing need acquisition for production if self.use_consumer: self.consumer.step() if self.reactive: return # 0. remove all my CFPs # self.awi.bb_remove(section='cfps', query={'publisher': self}) # respond to interesting CFPs # todo: should check time and sort products by interest etc # TODO3: respond to buy CFPS if have the buy cfps, then call the function _process_buy_cfp(cfp) cfps = self.awi.bb_query( section="cfps", query={"products": self.producing.keys(), "is_buy": True} ) if cfps is None: return for cfp in cfps.values(): self._process_buy_cfp(cfp) def can_produce(self, cfp: CFP, assume_no_further_negotiations=False) -> bool: """Whether or not we can produce the required item in time""" # TODO7: determinate wether can produce the required item in time # TODO7.1: the product of cfp not in producing keys return can not produce if cfp.product not in self.producing.keys(): return False # TODO7: use SCMLAgreement to check agreement = SCMLAgreement( time=cfp.max_time, unit_price=cfp.max_unit_price, quantity=cfp.min_quantity ) min_concluded_at = self.awi.current_step + 1 - int(self.immediate_negotiations) min_sign_at = min_concluded_at + self.awi.default_signing_delay if cfp.max_time < min_sign_at + 1: # 1 is minimum time to produce the product return False with temporary_transaction(self.scheduler): schedule = self.scheduler.schedule( contracts=[ Contract( partners=[self.id, cfp.publisher], agreement=agreement, annotation=self._create_annotation(cfp=cfp), issues=cfp.issues, signed_at=min_sign_at, concluded_at=min_concluded_at, ) ], ensure_storage_for=self.transportation_delay, assume_no_further_negotiations=assume_no_further_negotiations, start_at=min_sign_at, ) return schedule.valid and self.can_secure_needs( schedule=schedule, step=self.awi.current_step ) def can_secure_needs(self, schedule: ScheduleInfo, step: int): """ Finds if it is possible in principle to arrange these needs at the given time. Args: schedule: step: Returns: """ needs = schedule.needs if len(needs) < 1: return True for need in needs: if need.quantity_to_buy > 0 and need.step < step + 1 - int( self.immediate_negotiations ): # @todo check this return False return True class TestFactory(DoNothingFactoryManager): """ Test Factory For self defined negotiation negotiator""" class NegotiatorUtility(UtilityFunction): """The utility function of a negotiator.""" def __init__( self, agent: MyFactoryManager, annotation: Dict[str, Any], name: Optional[str] = None, ): if name is None: name = ( agent.name + "*" + "*".join(_ for _ in annotation["partners"] if _ != agent.id) ) super().__init__(name=name) self.agent = agent self.annotation = annotation def _contracts(self, agreements: Iterable[SCMLAgreement]) -> Collection[Contract]: """Converts agreements/outcomes into contracts""" if self.ami is None: raise ValueError("No annotation is stored (No mechanism info)") annotation = self.ami.annotation return [ Contract( partners=annotation["partners"], agreement=a, annotation=annotation, issues=self.ami.issues, ) for a in agreements ] def _contract(self, agreement: SCMLAgreement) -> Contract: """Converts an agreement/outcome into a contract""" annotation = self.annotation return Contract( partners=annotation["partners"], agreement=agreement, annotation=annotation, issues=annotation["cfp"].issues, ) def _free_sale(self, agreement: SCMLAgreement) -> bool: return ( self.annotation["seller"] == self.agent.id and agreement["unit_price"] < 1e-6 ) def __call__(self, outcome: Outcome) -> Optional[UtilityValue]: if isinstance(outcome, dict): return self.call(agreement=SCMLAgreement(**outcome)) if isinstance(outcome, SCMLAgreement): return self.call(agreement=outcome) raise ValueError(f"Outcome: {outcome} cannot be converted to an SCMLAgreement") @abstractmethod def call(self, agreement: SCMLAgreement) -> Optional[UtilityValue]: """Called to evaluate a agreement""" def xml(self, issues: List[Issue]) -> str: return "NegotiatorUtility has not xml representation" class PessimisticNegotiatorUtility(NegotiatorUtility): """The utility function of a negotiator that assumes other negotiations currently open will fail.""" def call(self, agreement: SCMLAgreement) -> Optional[UtilityValue]: """An offer will be a tuple of one value which in turn will be a list of contracts""" if self._free_sale(agreement): return INVALID_UTILITY # contracts = self.agent.contracts # hypothetical = list(contracts) # hypothetical.append(self._contract(agreement)) hypothetical = [self._contract(agreement)] base_util = self.agent.simulator.final_balance hypothetical = self.agent.total_utility(hypothetical) if hypothetical < 0: return INVALID_UTILITY return hypothetical - base_util class OptimisticNegotiatorUtility(NegotiatorUtility): """The utility function of a negotiator that assumes other negotiations currently open will succeed.""" def call(self, agreement: SCMLAgreement) -> Optional[UtilityValue]: if self._free_sale(agreement): return INVALID_UTILITY # contracts = self.agent.contracts # hypothetical = list(contracts) # hypothetical.append(self._contract(agreement)) hypothetical = [self._contract(agreement)] for negotiation in self.agent.running_negotiations: # type: ignore negotiator = negotiation.negotiator current_offer = negotiator.my_last_proposal if current_offer is not None: hypothetical.append(self._contract(current_offer)) base_util = self.agent.simulator.final_balance hypothetical = self.agent.total_utility(list(hypothetical)) if hypothetical < 0: return INVALID_UTILITY return hypothetical - base_util class AveragingNegotiatorUtility(NegotiatorUtility): """A utility function that combines optimistic and pessimistic evaluators linearly using adjustable weight""" def __init__( self, agent: MyFactoryManager, annotation: Dict[str, Any], name: Optional[str] = None, optimism: float = 0.5, ): NamedObject.__init__(self=self, name=name) self.optimism = optimism self.optimistic = OptimisticNegotiatorUtility( agent=agent, annotation=annotation ) self.pessimistic = PessimisticNegotiatorUtility( agent=agent, annotation=annotation ) def call(self, agreement: SCMLAgreement) -> Optional[UtilityValue]: if self._free_sale(agreement): return INVALID_UTILITY opt, pess = self.optimistic(agreement), self.pessimistic(agreement) if opt is None or pess is None: return None return self.optimism * opt + (1 - self.optimism) * pess
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 4256, 8504, 13, 29937, 515, 3480, 8247, 29889, 3952, 6774, 1053, 12782, 6982, 29892, 28468, 29924, 861, 262, 13, 5215, 12183, 13, 3166, 25638, 1053, 16417, 29892, 9846, 5696, 13, 3166, 16250, 1053, 2322, 8977, 13, 13, 3166, 3480, 8247, 1053, 313, 19661, 6816, 5083, 1608, 10448, 29892, 5826, 496, 29892, 2866, 1461, 29892, 27439, 1608, 2792, 29892, 13, 462, 1678, 12610, 15297, 1061, 29892, 7493, 387, 327, 11685, 3089, 29892, 22310, 537, 6678, 29897, 13, 3166, 3480, 8247, 29889, 13371, 29889, 1557, 828, 1053, 1938, 26521, 5126, 3260, 29892, 27561, 3260, 13, 3166, 3480, 8247, 29889, 13371, 29889, 1557, 828, 29889, 1450, 29875, 1053, 12314, 1988, 29909, 22119, 29892, 903, 2713, 6986, 7187, 1988, 29909, 22119, 13, 3166, 3480, 8247, 29889, 13371, 29889, 1557, 828, 29889, 9435, 1053, 313, 9207, 29925, 29892, 2672, 26707, 29918, 2692, 6227, 11937, 29892, 27561, 29892, 13, 462, 462, 268, 4231, 273, 1455, 13020, 29892, 4309, 273, 29892, 19561, 24155, 29892, 13, 462, 462, 268, 12314, 1988, 29909, 7979, 882, 29897, 13, 3166, 3480, 8247, 29889, 13371, 29889, 1557, 828, 29889, 25978, 414, 1053, 313, 13696, 28069, 13909, 29892, 13, 462, 462, 4706, 1102, 11272, 29928, 374, 854, 13696, 4680, 29897, 13, 3166, 3480, 8247, 29889, 13371, 29889, 1557, 828, 29889, 816, 287, 352, 414, 1053, 313, 25120, 7584, 4504, 14952, 29892, 1102, 11272, 3401, 29892, 13, 462, 462, 308, 1102, 14952, 29897, 13, 3166, 3480, 8247, 29889, 13371, 29889, 1557, 828, 29889, 3601, 352, 4097, 1053, 313, 5126, 8942, 9183, 29892, 13, 462, 462, 308, 23786, 5126, 8942, 9183, 29892, 13, 462, 462, 308, 8635, 29918, 294, 29918, 2378, 29892, 13, 462, 462, 308, 13201, 29918, 20736, 29897, 13, 3166, 3480, 8247, 29889, 9435, 1053, 405, 2795, 2061, 13, 3166, 3480, 8247, 29889, 13604, 1053, 28578, 13, 3166, 3480, 8247, 29889, 3952, 6774, 1053, 679, 29918, 1990, 13, 3166, 3480, 8247, 29889, 449, 26807, 1053, 26246, 29892, 4451, 2763, 13, 3166, 3480, 8247, 29889, 4422, 1907, 1053, 22310, 537, 1917, 29892, 4226, 675, 13, 13, 3166, 869, 1357, 29918, 1004, 5083, 1608, 1053, 26562, 12232, 29940, 387, 15297, 1061, 13, 13, 361, 5852, 29901, 13, 1678, 515, 19229, 1053, 313, 13, 4706, 360, 919, 29892, 13, 4706, 20504, 519, 29892, 13, 4706, 3139, 29892, 13, 4706, 8251, 519, 29892, 13, 4706, 14348, 29892, 13, 4706, 5167, 29892, 13, 4706, 2391, 29892, 13, 4706, 28379, 29892, 13, 4706, 7761, 29892, 13, 1678, 1723, 13, 13, 13, 1990, 1619, 5126, 3260, 29898, 6132, 26521, 5126, 3260, 1125, 13, 1678, 9995, 3421, 12529, 8455, 15945, 29908, 13, 13, 1678, 822, 373, 29918, 24601, 29918, 14057, 545, 29898, 1311, 29892, 4418, 1973, 29901, 2391, 29961, 23665, 428, 24155, 2314, 1599, 6213, 29901, 13, 4706, 9995, 13, 9651, 1551, 19561, 29098, 545, 29907, 4212, 746, 727, 338, 263, 5802, 10672, 2861, 304, 10225, 310, 10970, 470, 29199, 29889, 13, 4706, 9995, 13, 4706, 396, 363, 10672, 297, 4418, 1973, 29901, 13, 4706, 396, 268, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 24601, 10672, 1178, 29901, 426, 14057, 545, 29889, 1220, 29913, 4567, 29918, 2080, 29879, 29901, 426, 14057, 545, 29889, 27259, 29918, 2080, 29879, 29913, 320, 13, 4706, 396, 462, 4567, 29918, 29885, 4992, 29901, 426, 14057, 545, 29889, 27259, 29918, 29885, 4992, 29913, 4567, 29918, 3493, 29901, 426, 14057, 545, 29889, 27259, 29918, 3493, 29913, 1495, 13, 13, 4706, 1209, 13, 13, 1678, 822, 9659, 29918, 417, 273, 29898, 1311, 29892, 24806, 29901, 4309, 273, 29892, 9124, 6685, 29918, 361, 29918, 276, 622, 287, 29901, 6120, 29897, 1599, 6120, 29901, 13, 4706, 396, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 417, 273, 29901, 426, 3410, 273, 1118, 10253, 6685, 29918, 361, 29918, 276, 622, 287, 26254, 9157, 6685, 29918, 361, 29918, 276, 622, 287, 29913, 1495, 13, 4706, 736, 9124, 6685, 29918, 361, 29918, 276, 622, 287, 13, 13, 1678, 822, 9659, 29918, 1285, 1461, 29918, 22256, 29898, 1311, 29892, 8078, 29901, 2866, 1461, 29897, 1599, 6120, 29901, 13, 4706, 396, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 1285, 1461, 26254, 1285, 1461, 29913, 1495, 13, 4706, 396, 1053, 4036, 13, 4706, 396, 2761, 29918, 22795, 3097, 29918, 19790, 353, 29871, 29900, 29889, 29896, 13, 4706, 396, 29871, 4036, 736, 1565, 9659, 8078, 8225, 13, 4706, 396, 822, 10608, 29898, 22795, 3097, 1125, 13, 4706, 396, 268, 736, 4036, 29889, 8172, 580, 529, 6976, 13, 4706, 396, 565, 10608, 29898, 6451, 29918, 22795, 3097, 29918, 19790, 1125, 13, 4706, 396, 268, 736, 5852, 13, 4706, 396, 736, 7700, 13, 4706, 736, 5852, 13, 13, 1678, 822, 731, 29918, 1267, 387, 327, 11685, 29918, 351, 8395, 29898, 13, 4706, 1583, 29892, 8078, 29901, 2866, 1461, 29892, 2078, 14520, 29901, 2391, 29961, 20130, 496, 29962, 13, 1678, 1723, 1599, 28379, 29961, 29934, 264, 387, 327, 11685, 3089, 5387, 13, 4706, 396, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 21263, 731, 4325, 387, 327, 11685, 946, 8395, 426, 1285, 1461, 29913, 1495, 13, 4706, 396, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 1030, 14520, 731, 4325, 387, 327, 11685, 946, 8395, 426, 1030, 14520, 29913, 1495, 13, 4706, 396, 3001, 29918, 1030, 496, 29918, 5563, 29879, 353, 2322, 8977, 29898, 524, 29897, 13, 4706, 396, 363, 2078, 496, 297, 2078, 14520, 29901, 13, 4706, 396, 268, 3001, 29918, 1030, 496, 29918, 5563, 29879, 29961, 1030, 496, 29889, 546, 10963, 29878, 1061, 29962, 4619, 2078, 496, 29889, 5563, 13, 4706, 396, 363, 25722, 29878, 1061, 29892, 7827, 29918, 1030, 496, 29918, 5563, 297, 3001, 29918, 1030, 496, 29918, 5563, 29879, 29889, 7076, 7295, 13, 4706, 396, 268, 584, 14990, 2078, 496, 21597, 13, 4706, 396, 268, 565, 3001, 29918, 1030, 496, 29918, 5563, 1405, 29871, 29900, 29889, 29945, 29901, 13, 4706, 396, 308, 736, 6213, 13, 4706, 396, 268, 1683, 29901, 13, 4706, 396, 308, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 2457, 29871, 716, 4325, 387, 327, 11685, 2009, 29892, 2529, 29880, 3208, 426, 1311, 29889, 333, 29913, 3001, 2078, 496, 3233, 310, 25722, 29878, 1061, 426, 546, 10963, 29878, 1061, 29913, 338, 426, 7827, 29918, 1030, 496, 29918, 5563, 29913, 1495, 13, 4706, 396, 308, 565, 525, 6854, 29886, 29915, 297, 8078, 29889, 18317, 29901, 13, 4706, 396, 632, 4325, 387, 327, 11685, 3827, 353, 7493, 387, 327, 11685, 3089, 29898, 23679, 261, 29922, 29888, 29915, 29912, 1311, 29889, 333, 29913, 742, 5626, 29922, 1285, 1461, 29889, 12175, 29892, 17195, 29922, 1285, 1461, 29889, 18317, 29897, 13, 4706, 396, 632, 736, 4325, 387, 327, 11685, 3827, 13, 4706, 396, 308, 736, 6213, 13, 4706, 736, 6213, 13, 13, 1678, 822, 10049, 29918, 517, 29918, 1267, 387, 327, 11685, 29918, 3827, 29898, 13, 4706, 1583, 29892, 8078, 29901, 2866, 1461, 29892, 2078, 14520, 29901, 2391, 29961, 20130, 496, 1402, 946, 8395, 29901, 7493, 387, 327, 11685, 3089, 13, 1678, 1723, 1599, 28379, 29961, 29940, 387, 15297, 1061, 5387, 13, 4706, 396, 3001, 29918, 1030, 496, 29918, 5563, 29879, 353, 2322, 8977, 29898, 524, 29897, 13, 4706, 396, 363, 2078, 496, 297, 2078, 14520, 29901, 13, 4706, 396, 268, 3001, 29918, 1030, 496, 29918, 5563, 29879, 29961, 1030, 496, 29889, 546, 10963, 29878, 1061, 29962, 4619, 2078, 496, 29889, 5563, 13, 4706, 396, 363, 25722, 29878, 1061, 29892, 3001, 29918, 1030, 496, 29918, 5563, 297, 3001, 29918, 1030, 496, 29918, 5563, 29879, 29889, 7076, 7295, 13, 4706, 396, 268, 565, 3001, 29918, 1030, 496, 29918, 5563, 1405, 29871, 29900, 29889, 29945, 29901, 13, 4706, 396, 308, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 2457, 716, 27214, 1061, 363, 4325, 387, 327, 11685, 2009, 6213, 25710, 13, 4706, 396, 308, 736, 6213, 13, 4706, 396, 268, 1683, 29901, 13, 4706, 396, 308, 1024, 353, 1583, 29889, 978, 718, 525, 29930, 29915, 718, 25722, 29878, 1061, 13, 4706, 396, 308, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 2457, 716, 27214, 1061, 363, 4325, 387, 327, 11685, 2009, 27214, 1061, 1024, 426, 978, 29913, 25722, 29878, 1061, 426, 546, 10963, 29878, 1061, 29913, 25710, 13, 4706, 396, 308, 565, 525, 6854, 29886, 29915, 297, 8078, 29889, 18317, 29901, 13, 4706, 396, 632, 3480, 353, 1583, 29889, 10052, 15297, 1061, 29918, 1853, 29898, 978, 29922, 978, 29892, 3579, 1311, 29889, 10052, 15297, 1061, 29918, 7529, 29897, 13, 4706, 396, 632, 3480, 29889, 329, 1793, 29918, 2220, 353, 4226, 675, 29898, 1311, 29889, 1137, 348, 29918, 14399, 29898, 1311, 29892, 8078, 29889, 18317, 511, 13, 4706, 396, 462, 462, 632, 714, 26807, 29922, 1285, 1461, 29889, 18317, 1839, 6854, 29886, 13359, 449, 26807, 29892, 297, 1725, 294, 1821, 29918, 7582, 2696, 29922, 29900, 29897, 13, 4706, 396, 632, 736, 3480, 13, 4706, 396, 308, 736, 6213, 13, 4706, 736, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 1480, 29918, 1445, 29918, 978, 29922, 8516, 29892, 13, 4706, 4315, 29918, 1188, 29922, 8824, 29892, 13, 4706, 1024, 29922, 8516, 29892, 13, 4706, 1027, 9183, 29918, 1853, 29901, 7761, 29961, 710, 29892, 5167, 29961, 5126, 8942, 9183, 5262, 353, 23786, 5126, 8942, 9183, 29892, 13, 4706, 1364, 14952, 29918, 1853, 29901, 7761, 29961, 710, 29892, 5167, 29961, 4504, 14952, 5262, 353, 4122, 7584, 4504, 14952, 29892, 13, 4706, 1364, 14952, 29918, 7529, 29901, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 353, 6213, 29892, 13, 4706, 5994, 1608, 29901, 5785, 353, 29871, 29900, 29889, 29900, 29892, 13, 4706, 27214, 1061, 29918, 1853, 29901, 7761, 29961, 13, 9651, 851, 29892, 5167, 29961, 29940, 387, 15297, 1061, 29962, 13, 4706, 4514, 353, 376, 29894, 10052, 8247, 29889, 27852, 29889, 4351, 29889, 29876, 10052, 8247, 29889, 1357, 29918, 1004, 5083, 1608, 29889, 3421, 3057, 29940, 387, 15297, 1061, 613, 13, 4706, 27214, 1061, 29918, 7529, 29901, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 353, 6213, 29892, 13, 4706, 302, 29918, 2267, 374, 1338, 29922, 29945, 29892, 13, 4706, 671, 29918, 25978, 261, 29922, 5574, 29892, 13, 4706, 337, 4925, 29922, 5574, 29892, 13, 4706, 1804, 29918, 6194, 29918, 2543, 9519, 287, 29918, 1285, 1461, 29879, 29922, 8824, 29892, 13, 4706, 12045, 3335, 29922, 29900, 29889, 29900, 29892, 13, 4706, 4236, 29918, 1144, 18541, 29918, 1457, 29885, 1974, 29901, 5785, 353, 29871, 29900, 29889, 29896, 29892, 13, 268, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29922, 978, 29892, 1027, 9183, 29918, 1853, 29922, 3601, 9183, 29918, 1853, 29897, 13, 4706, 396, 28468, 29924, 861, 262, 17255, 2344, 12035, 1311, 29892, 934, 29918, 978, 29922, 1188, 29918, 1445, 29918, 978, 29897, 13, 4706, 1583, 29889, 10052, 15297, 1061, 29918, 1853, 353, 679, 29918, 1990, 29898, 10052, 15297, 1061, 29918, 1853, 29892, 6874, 29922, 23705, 1338, 3101, 13, 4706, 1583, 29889, 10052, 15297, 1061, 29918, 7529, 353, 313, 13, 9651, 27214, 1061, 29918, 7529, 565, 27214, 1061, 29918, 7529, 338, 451, 6213, 1683, 6571, 13, 4706, 1723, 13, 4706, 1583, 29889, 20640, 1608, 353, 5994, 1608, 13, 4706, 1583, 29889, 1137, 348, 29918, 14399, 29901, 7761, 29961, 13, 9651, 5167, 29961, 29940, 387, 15297, 1061, 7270, 537, 1402, 8251, 519, 8999, 10773, 29892, 3139, 1402, 12610, 15297, 1061, 7270, 537, 29962, 13, 4706, 4514, 13, 4706, 565, 5994, 1608, 529, 29871, 29896, 29872, 29899, 29953, 29901, 13, 9651, 1583, 29889, 1137, 348, 29918, 14399, 353, 349, 404, 326, 4695, 29940, 387, 15297, 1061, 7270, 537, 13, 4706, 25342, 5994, 1608, 1405, 29871, 29896, 448, 29871, 29896, 29872, 29899, 29953, 29901, 13, 9651, 1583, 29889, 1137, 348, 29918, 14399, 353, 20693, 326, 4695, 29940, 387, 15297, 1061, 7270, 537, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1137, 348, 29918, 14399, 29901, 12610, 15297, 1061, 7270, 537, 353, 14013, 10823, 29892, 17195, 29901, 319, 369, 6751, 29940, 387, 15297, 1061, 7270, 537, 29898, 13, 18884, 10823, 29922, 14748, 29892, 17195, 29922, 18317, 29892, 5994, 1608, 29922, 1311, 29889, 20640, 1608, 13, 9651, 1723, 13, 4706, 1583, 29889, 3317, 29918, 1144, 18541, 29918, 1457, 29885, 1974, 353, 4236, 29918, 1144, 18541, 29918, 1457, 29885, 1974, 13, 4706, 1583, 29889, 29876, 29918, 2267, 374, 1338, 353, 302, 29918, 2267, 374, 1338, 13, 4706, 1583, 29889, 29876, 29918, 10052, 29918, 3626, 1338, 29901, 360, 919, 29961, 710, 29892, 938, 29962, 353, 2322, 8977, 29898, 524, 29897, 13, 4706, 1583, 29889, 25978, 261, 353, 6213, 13, 4706, 1583, 29889, 1509, 29918, 25978, 261, 353, 671, 29918, 25978, 261, 13, 4706, 1583, 29889, 276, 4925, 353, 337, 4925, 13, 4706, 1583, 29889, 4530, 29918, 6194, 29918, 2543, 9519, 287, 29918, 1285, 1461, 29879, 353, 1804, 29918, 6194, 29918, 2543, 9519, 287, 29918, 1285, 1461, 29879, 13, 4706, 1583, 29889, 1285, 1461, 29918, 816, 287, 2540, 29901, 360, 919, 29961, 710, 29892, 1102, 11272, 3401, 29962, 353, 6571, 13, 4706, 1583, 29889, 3780, 29895, 3335, 353, 12045, 3335, 13, 4706, 1583, 29889, 10052, 327, 11685, 29918, 9264, 353, 938, 29898, 14486, 29898, 29876, 29918, 2267, 374, 1338, 334, 4236, 29898, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 448, 12045, 3335, 4961, 13, 4706, 1583, 29889, 816, 14952, 29918, 1853, 29901, 5167, 29961, 4504, 14952, 29962, 353, 679, 29918, 1990, 29898, 13, 9651, 1364, 14952, 29918, 1853, 29892, 6874, 29922, 23705, 1338, 580, 13, 4706, 1723, 13, 4706, 1583, 29889, 816, 14952, 29901, 1102, 14952, 353, 6213, 13, 4706, 1583, 29889, 816, 14952, 29918, 7529, 29901, 360, 919, 29961, 13, 9651, 851, 29892, 3139, 13, 4706, 4514, 353, 1364, 14952, 29918, 7529, 565, 1364, 14952, 29918, 7529, 338, 451, 6213, 1683, 6571, 13, 13, 1678, 822, 3001, 29918, 329, 1793, 29898, 1311, 29892, 8078, 29879, 29901, 14348, 29961, 21263, 29962, 353, 313, 876, 1599, 5785, 29901, 13, 4706, 9995, 27065, 1078, 278, 3001, 19725, 363, 278, 10823, 310, 263, 4333, 310, 8078, 29879, 15945, 29908, 13, 4706, 565, 1583, 29889, 816, 14952, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 703, 29089, 8147, 3001, 19725, 1728, 263, 1364, 14952, 1159, 13, 4706, 1375, 29918, 535, 13347, 29918, 271, 353, 1583, 29889, 1450, 29875, 29889, 3784, 29918, 10568, 13, 4706, 1375, 29918, 4530, 29918, 271, 353, 1375, 29918, 535, 13347, 29918, 271, 718, 1583, 29889, 1450, 29875, 29889, 4381, 29918, 4530, 292, 29918, 18829, 13, 4706, 411, 13201, 29918, 20736, 29898, 1311, 29889, 816, 14952, 1125, 13, 9651, 20410, 353, 1583, 29889, 816, 14952, 29889, 816, 11272, 29898, 13, 18884, 8078, 29879, 29922, 1285, 1461, 29879, 29892, 13, 18884, 5251, 29918, 1217, 29918, 22613, 721, 29918, 10052, 15297, 800, 29922, 8824, 29892, 13, 18884, 9801, 29918, 12925, 29918, 1454, 29922, 1311, 29889, 27882, 362, 29918, 18829, 29892, 13, 18884, 1369, 29918, 271, 29922, 1195, 29918, 4530, 29918, 271, 29892, 13, 9651, 1723, 13, 4706, 565, 451, 20410, 29889, 3084, 29901, 13, 9651, 736, 2672, 26707, 29918, 2692, 6227, 11937, 13, 4706, 736, 20410, 29889, 8394, 29918, 5521, 749, 13, 13, 1678, 822, 2069, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 396, 732, 29873, 8144, 788, 278, 4128, 310, 278, 27430, 8722, 408, 4128, 310, 278, 1395, 7584, 12529, 8455, 13, 9651, 396, 29871, 14402, 29901, 29896, 29871, 25455, 263, 1395, 7584, 1364, 14952, 322, 263, 21691, 10823, 363, 767, 6751, 817, 1274, 23493, 363, 5802, 13, 9651, 1583, 29889, 25978, 261, 29901, 1102, 11272, 29928, 374, 854, 13696, 4680, 353, 1102, 11272, 29928, 374, 854, 13696, 4680, 29898, 13, 18884, 28723, 29922, 8977, 29898, 13, 462, 1678, 14319, 29898, 13, 462, 4706, 1583, 29889, 25978, 292, 29889, 8149, 3285, 13, 462, 4706, 313, 13, 462, 9651, 2138, 28069, 13909, 29898, 816, 11272, 11759, 29918, 29962, 334, 1583, 29889, 1450, 29875, 29889, 29876, 29918, 24530, 29897, 13, 462, 9651, 363, 903, 297, 4256, 8504, 29889, 14358, 29898, 29900, 29897, 13, 462, 4706, 10353, 13, 462, 1678, 1723, 13, 18884, 10353, 13, 18884, 27430, 29918, 2015, 18162, 29922, 1311, 29889, 1450, 29875, 29889, 29876, 29918, 24530, 29892, 13, 18884, 16800, 29918, 6854, 29886, 29918, 5504, 29922, 5574, 29892, 13, 18884, 1024, 29922, 1311, 29889, 978, 29892, 13, 9651, 1723, 13, 9651, 396, 1583, 29889, 1188, 8382, 29898, 29888, 29915, 29912, 1311, 29889, 25978, 292, 29913, 1495, 13, 9651, 1583, 29889, 25978, 261, 29889, 333, 353, 1583, 29889, 333, 13, 9651, 1583, 29889, 25978, 261, 29889, 1450, 29875, 353, 1583, 29889, 1450, 29875, 13, 9651, 1583, 29889, 25978, 261, 29889, 2344, 29918, 580, 13, 4706, 1583, 29889, 816, 14952, 353, 1583, 29889, 816, 14952, 29918, 1853, 29898, 13, 9651, 8455, 29918, 333, 29922, 1311, 29889, 333, 29892, 13, 9651, 3773, 29875, 29922, 1311, 29889, 1450, 29875, 29892, 13, 9651, 4236, 29918, 1144, 18541, 29918, 1457, 29885, 1974, 29922, 1311, 29889, 3317, 29918, 1144, 18541, 29918, 1457, 29885, 1974, 29892, 13, 9651, 3579, 1311, 29889, 816, 14952, 29918, 7529, 29892, 13, 4706, 1723, 13, 4706, 1583, 29889, 816, 14952, 29889, 2344, 29898, 13, 9651, 1027, 9183, 29922, 1311, 29889, 3601, 9183, 29892, 13, 9651, 9316, 29922, 1311, 29889, 14456, 29892, 13, 9651, 10174, 29922, 1311, 29889, 5014, 267, 29892, 13, 9651, 20811, 29922, 1311, 29889, 5498, 3277, 29892, 13, 9651, 28723, 29922, 1311, 29889, 2388, 2356, 29918, 771, 5325, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 10049, 29918, 517, 29918, 10052, 327, 11685, 29918, 3827, 29898, 13, 4706, 1583, 29892, 274, 18091, 29901, 376, 9207, 29925, 613, 18096, 29901, 851, 13, 1678, 1723, 1599, 28379, 29961, 29940, 387, 15297, 1061, 5387, 13, 4706, 565, 1583, 29889, 1450, 29875, 29889, 275, 29918, 9157, 6685, 29898, 1595, 1089, 1125, 13, 9651, 736, 6213, 13, 4706, 565, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 736, 1583, 29889, 25978, 261, 29889, 3636, 29918, 517, 29918, 10052, 327, 11685, 29918, 3827, 29898, 13, 18884, 274, 18091, 29922, 6854, 29886, 29892, 18096, 29922, 1595, 1089, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 1024, 353, 1583, 29889, 978, 718, 376, 20605, 718, 18096, 13, 9651, 3480, 353, 1583, 29889, 10052, 15297, 1061, 29918, 1853, 29898, 13, 18884, 1024, 29922, 1311, 29889, 978, 718, 376, 20605, 718, 18096, 29892, 3579, 1311, 29889, 10052, 15297, 1061, 29918, 7529, 13, 9651, 1723, 13, 9651, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29908, 3636, 304, 3480, 327, 11685, 2009, 3480, 1024, 426, 978, 27195, 13, 9651, 3480, 29889, 329, 1793, 29918, 2220, 353, 4226, 675, 29898, 13, 18884, 1583, 29889, 1137, 348, 29918, 14399, 29898, 1311, 29892, 1583, 3032, 3258, 29918, 18317, 29898, 6854, 29886, 29922, 6854, 29886, 8243, 13, 18884, 714, 26807, 29922, 6854, 29886, 29889, 449, 26807, 29892, 13, 18884, 297, 1725, 294, 1821, 29918, 7582, 2696, 29922, 29900, 29892, 13, 9651, 1723, 13, 9651, 736, 3480, 13, 13, 1678, 822, 373, 29918, 10052, 327, 11685, 29918, 8698, 29898, 13, 4706, 1583, 29892, 8078, 29901, 2866, 1461, 29892, 13336, 29901, 28330, 6816, 5083, 1608, 10448, 13, 268, 1125, 13, 4706, 565, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 1583, 29889, 25978, 261, 29889, 265, 29918, 10052, 327, 11685, 29918, 8698, 29898, 1285, 1461, 29892, 13336, 29897, 13, 13, 1678, 822, 373, 29918, 10052, 327, 11685, 29918, 14057, 545, 29898, 13, 4706, 1583, 29892, 13, 4706, 22056, 29901, 2391, 29961, 710, 1402, 13, 4706, 17195, 29901, 360, 919, 29961, 710, 29892, 3139, 1402, 13, 4706, 13336, 29901, 28330, 6816, 5083, 1608, 10448, 29892, 13, 4706, 2106, 29901, 27439, 1608, 2792, 29892, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 396, 14402, 29947, 29901, 565, 278, 12529, 10933, 471, 451, 278, 9805, 261, 310, 278, 274, 18091, 29892, 322, 8236, 304, 445, 3480, 8194, 362, 29892, 372, 508, 337, 2202, 3480, 327, 11685, 701, 304, 29871, 29945, 3064, 639, 274, 18091, 411, 278, 1021, 19725, 740, 13, 4706, 565, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 1583, 29889, 25978, 261, 29889, 265, 29918, 10052, 327, 11685, 29918, 14057, 545, 29898, 1595, 8397, 29892, 17195, 29892, 13336, 29892, 2106, 29897, 13, 4706, 274, 18091, 353, 17195, 3366, 6854, 29886, 3108, 13, 4706, 445, 6854, 29886, 353, 1583, 29889, 1450, 29875, 29889, 1327, 29918, 1972, 29898, 2042, 543, 6854, 567, 613, 2346, 29922, 6854, 29886, 29889, 333, 29892, 2346, 29918, 8149, 29922, 5574, 29897, 13, 4706, 565, 313, 13, 9651, 274, 18091, 29889, 23679, 261, 2804, 1583, 29889, 333, 13, 9651, 322, 445, 6854, 29886, 338, 451, 6213, 13, 9651, 322, 7431, 29898, 1366, 6854, 29886, 29897, 1405, 29871, 29900, 13, 9651, 322, 1583, 29889, 29876, 29918, 10052, 29918, 3626, 1338, 29961, 6854, 29886, 29889, 333, 29962, 529, 1583, 29889, 29876, 29918, 2267, 374, 1338, 13, 308, 1125, 13, 9651, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29908, 29934, 264, 387, 15297, 1218, 426, 1311, 29889, 29876, 29918, 10052, 29918, 3626, 1338, 29961, 6854, 29886, 29889, 333, 12258, 373, 426, 6854, 29886, 27195, 13, 9651, 1583, 29889, 265, 29918, 1482, 29918, 6854, 29886, 29898, 6854, 29886, 29922, 18317, 3366, 6854, 29886, 20068, 13, 13, 1678, 822, 903, 7978, 29918, 816, 11272, 29898, 1311, 29892, 20410, 29901, 1102, 11272, 3401, 29892, 8078, 29901, 2866, 1461, 29897, 1599, 6213, 29901, 13, 4706, 396, 14402, 29901, 825, 338, 3721, 2099, 310, 12529, 1027, 9183, 338, 451, 3342, 13, 4706, 565, 1583, 29889, 3601, 9183, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 703, 3782, 12529, 1027, 9183, 338, 3342, 1159, 13, 4706, 3773, 29875, 29901, 12314, 1988, 29909, 22119, 353, 1583, 29889, 1450, 29875, 13, 4706, 3001, 353, 8078, 29889, 351, 276, 882, 3366, 5441, 29918, 9175, 3108, 334, 8078, 29889, 351, 276, 882, 3366, 22640, 3108, 13, 4706, 3234, 353, 8078, 29889, 18317, 3366, 6854, 29886, 16862, 4704, 13, 4706, 396, 14402, 29901, 1152, 1321, 7598, 671, 21691, 13, 4706, 565, 8078, 29889, 18317, 3366, 2423, 7598, 3108, 1275, 1583, 29889, 333, 29901, 13, 9651, 1583, 29889, 3601, 9183, 29889, 2423, 29891, 29898, 13, 18884, 3234, 29922, 4704, 29892, 13, 18884, 14728, 29922, 1285, 1461, 29889, 351, 276, 882, 3366, 22640, 12436, 13, 18884, 8666, 29922, 7827, 29892, 13, 18884, 260, 29922, 1285, 1461, 29889, 351, 276, 882, 3366, 2230, 12436, 13, 9651, 1723, 13, 9651, 565, 3001, 5277, 29871, 29900, 470, 1583, 29889, 3317, 29918, 1144, 18541, 29918, 1457, 29885, 1974, 529, 29871, 29900, 29889, 29900, 470, 8078, 338, 6213, 29901, 13, 18884, 736, 13, 9651, 5188, 1974, 353, 3773, 29875, 29889, 24219, 403, 29918, 1144, 18541, 29898, 1285, 1461, 29922, 1285, 1461, 29897, 13, 9651, 565, 5188, 1974, 338, 6213, 29901, 13, 18884, 736, 13, 9651, 6198, 29918, 1457, 29885, 1974, 353, 5188, 1974, 847, 3001, 13, 9651, 565, 6198, 29918, 1457, 29885, 1974, 5277, 1583, 29889, 3317, 29918, 1144, 18541, 29918, 1457, 29885, 1974, 29901, 13, 18884, 3773, 29875, 29889, 2423, 29891, 29918, 1144, 18541, 29898, 1285, 1461, 29922, 1285, 1461, 29897, 13, 18884, 1583, 29889, 3601, 9183, 29889, 10472, 29898, 1457, 29885, 1974, 29892, 1583, 29889, 1450, 29875, 29889, 3784, 29918, 10568, 29897, 13, 9651, 736, 13, 4706, 396, 306, 626, 263, 269, 4539, 13, 4706, 396, 14402, 29901, 12529, 8455, 408, 269, 4539, 13, 4706, 1583, 29889, 3601, 9183, 29889, 29879, 514, 29898, 13, 9651, 3234, 29922, 4704, 29892, 13, 9651, 14728, 29922, 1285, 1461, 29889, 351, 276, 882, 3366, 22640, 12436, 13, 9651, 8666, 29922, 7827, 29892, 13, 9651, 260, 29922, 1285, 1461, 29889, 351, 276, 882, 3366, 2230, 12436, 13, 4706, 1723, 13, 4706, 363, 4982, 297, 20410, 29889, 9057, 29879, 29901, 13, 9651, 565, 4982, 29889, 2467, 1275, 376, 3389, 1115, 13, 18884, 3773, 29875, 29889, 816, 11272, 29918, 9057, 29898, 9057, 29892, 8078, 29922, 1285, 1461, 29897, 13, 9651, 25342, 4982, 29889, 2467, 1275, 376, 9847, 1115, 13, 18884, 3773, 29875, 29889, 9847, 29918, 24601, 29898, 13, 462, 1678, 1196, 29922, 9057, 29889, 1220, 29892, 13, 462, 1678, 4331, 29922, 9057, 29889, 2230, 29892, 13, 462, 1678, 8078, 29922, 1285, 1461, 29892, 13, 462, 1678, 5712, 29922, 9057, 29889, 15752, 29892, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 3773, 29875, 29889, 816, 11272, 29918, 9057, 29898, 9057, 29892, 8078, 29922, 1285, 1461, 29897, 13, 9651, 1583, 29889, 3601, 9183, 29889, 816, 11272, 29898, 9057, 29922, 9057, 29892, 5712, 29922, 8824, 29897, 13, 4706, 363, 817, 297, 20410, 29889, 484, 5779, 29901, 13, 9651, 565, 817, 29889, 22640, 29918, 517, 29918, 2423, 29891, 5277, 29871, 29900, 29901, 13, 18884, 6773, 13, 9651, 3234, 29918, 333, 353, 817, 29889, 4704, 13, 9651, 396, 1583, 29889, 3601, 9183, 29889, 690, 7143, 29898, 4704, 29922, 4704, 29918, 333, 29892, 14728, 29922, 26180, 29889, 22640, 29918, 517, 29918, 2423, 29891, 29892, 260, 29922, 26180, 29889, 10568, 29897, 13, 9651, 565, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 18884, 1583, 29889, 25978, 261, 29889, 771, 5325, 29961, 4704, 29918, 333, 1822, 816, 11272, 29961, 13, 462, 1678, 817, 29889, 10568, 13, 18884, 4514, 4619, 817, 29889, 22640, 29918, 517, 29918, 2423, 29891, 13, 18884, 1583, 29889, 25978, 261, 29889, 9573, 29918, 4704, 29918, 6854, 567, 29898, 13, 462, 1678, 282, 29922, 4704, 29918, 333, 29892, 13, 462, 1678, 260, 29922, 26180, 29889, 10568, 29892, 13, 462, 1678, 8722, 29922, 1311, 29889, 25978, 261, 29889, 771, 5325, 29961, 4704, 29918, 333, 1402, 13, 18884, 1723, 13, 18884, 6773, 13, 9651, 3234, 353, 1583, 29889, 14456, 29961, 4704, 29918, 333, 29962, 13, 9651, 565, 3234, 29889, 28045, 29918, 9175, 338, 6213, 29901, 13, 18884, 8666, 29918, 3881, 353, 313, 29900, 29889, 29900, 29892, 29871, 29896, 29900, 29900, 29889, 29900, 29897, 13, 9651, 1683, 29901, 13, 18884, 8666, 29918, 3881, 353, 313, 29900, 29889, 29945, 29892, 29871, 29896, 29889, 29945, 334, 3234, 29889, 28045, 29918, 9175, 29897, 13, 9651, 396, 732, 29873, 8144, 1423, 445, 29889, 910, 1059, 338, 10425, 6041, 13, 9651, 565, 817, 29889, 10568, 529, 3773, 29875, 29889, 3784, 29918, 10568, 29901, 13, 18884, 6773, 13, 18884, 396, 12020, 7865, 2392, 29898, 29888, 29915, 26180, 426, 26180, 29913, 472, 426, 26180, 29889, 10568, 29913, 1550, 2734, 472, 4331, 426, 1450, 29875, 29889, 3784, 29918, 10568, 29913, 1495, 13, 9651, 931, 353, 313, 13, 18884, 817, 29889, 10568, 13, 18884, 565, 1583, 29889, 3317, 29918, 12925, 338, 451, 6213, 13, 18884, 1683, 313, 1450, 29875, 29889, 3784, 29918, 10568, 29892, 817, 29889, 10568, 29897, 13, 9651, 1723, 13, 9651, 274, 18091, 353, 17861, 29925, 29898, 13, 18884, 338, 29918, 2423, 29891, 29922, 5574, 29892, 13, 18884, 9805, 261, 29922, 1311, 29889, 333, 29892, 13, 18884, 3234, 29922, 4704, 29918, 333, 29892, 13, 18884, 931, 29922, 2230, 29892, 13, 18884, 5190, 29918, 9175, 29922, 9175, 29918, 3881, 29892, 13, 18884, 14728, 7607, 29896, 29892, 938, 29898, 29896, 29889, 29896, 334, 817, 29889, 22640, 29918, 517, 29918, 2423, 29891, 8243, 13, 9651, 1723, 13, 9651, 3773, 29875, 29889, 9573, 29918, 6854, 29886, 29898, 6854, 29886, 29897, 13, 13, 1678, 822, 1804, 29918, 1285, 1461, 29898, 1311, 29892, 8078, 29901, 2866, 1461, 1125, 13, 4706, 565, 738, 29898, 1311, 29889, 1450, 29875, 29889, 275, 29918, 9157, 6685, 29898, 1595, 1089, 29897, 363, 18096, 297, 8078, 29889, 1595, 8397, 1125, 13, 9651, 736, 6213, 13, 4706, 12608, 353, 1583, 29889, 333, 13, 4706, 411, 13201, 29918, 20736, 29898, 1311, 29889, 816, 14952, 1125, 13, 9651, 20410, 353, 1583, 29889, 816, 14952, 29889, 816, 11272, 29898, 13, 18884, 5251, 29918, 1217, 29918, 22613, 721, 29918, 10052, 15297, 800, 29922, 8824, 29892, 13, 18884, 8078, 29879, 11759, 1285, 1461, 1402, 13, 18884, 9801, 29918, 12925, 29918, 1454, 29922, 1311, 29889, 27882, 362, 29918, 18829, 29892, 13, 18884, 1369, 29918, 271, 29922, 1311, 29889, 1450, 29875, 29889, 3784, 29918, 10568, 718, 29871, 29896, 29892, 13, 9651, 1723, 13, 13, 4706, 565, 1583, 29889, 4530, 29918, 6194, 29918, 2543, 9519, 287, 29918, 1285, 1461, 29879, 322, 313, 13, 9651, 451, 20410, 29889, 3084, 470, 7431, 29898, 816, 11272, 29889, 484, 5779, 29897, 1405, 29871, 29896, 13, 308, 1125, 13, 9651, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 13, 18884, 285, 29908, 29912, 1311, 29889, 978, 29913, 15964, 304, 1804, 8078, 426, 1285, 1461, 29889, 333, 29913, 1363, 372, 2609, 367, 21467, 29908, 13, 9651, 1723, 13, 9651, 736, 6213, 13, 4706, 396, 565, 20410, 29889, 8394, 29918, 5521, 749, 5277, 1583, 29889, 3601, 9183, 29889, 8394, 29918, 5521, 749, 29901, 13, 4706, 396, 268, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 29888, 29915, 29912, 1311, 29889, 978, 29913, 15964, 304, 1804, 8078, 426, 1285, 1461, 29889, 333, 29913, 1363, 372, 338, 451, 3806, 525, 13, 4706, 396, 462, 539, 285, 29915, 517, 3275, 304, 21665, 1495, 13, 4706, 396, 268, 736, 6213, 13, 4706, 565, 20410, 29889, 3084, 29901, 13, 9651, 21665, 353, 20410, 29889, 8394, 29918, 5521, 749, 448, 1583, 29889, 3601, 9183, 29889, 8394, 29918, 5521, 749, 13, 9651, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 13, 18884, 285, 29908, 29912, 1311, 29889, 978, 29913, 23623, 8078, 426, 1285, 1461, 29889, 333, 29913, 16120, 376, 13, 18884, 285, 29915, 8499, 771, 9202, 565, 21665, 529, 29871, 29900, 1683, 21665, 29913, 8853, 6758, 29908, 565, 21665, 529, 29871, 29900, 1683, 376, 771, 9202, 9092, 29915, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1450, 29875, 29889, 1188, 8382, 29898, 13, 18884, 285, 29908, 29912, 1311, 29889, 978, 29913, 23623, 8078, 426, 1285, 1461, 29889, 333, 29913, 16120, 2078, 496, 29908, 13, 9651, 1723, 13, 9651, 736, 6213, 13, 13, 4706, 1583, 29889, 1285, 1461, 29918, 816, 287, 2540, 29961, 1285, 1461, 29889, 333, 29962, 353, 20410, 13, 4706, 736, 12608, 13, 13, 1678, 822, 373, 29918, 1285, 1461, 29918, 7433, 29898, 1311, 29892, 8078, 29901, 2866, 1461, 1125, 13, 4706, 565, 8078, 29889, 18317, 3366, 2423, 7598, 3108, 1275, 1583, 29889, 333, 322, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 1583, 29889, 25978, 261, 29889, 265, 29918, 1285, 1461, 29918, 7433, 29898, 1285, 1461, 29897, 13, 4706, 20410, 353, 1583, 29889, 1285, 1461, 29918, 816, 287, 2540, 29961, 1285, 1461, 29889, 333, 29962, 13, 4706, 565, 20410, 338, 451, 6213, 322, 20410, 29889, 3084, 29901, 13, 9651, 1583, 3032, 7978, 29918, 816, 11272, 29898, 816, 11272, 29922, 816, 11272, 29892, 8078, 29922, 1285, 1461, 29897, 13, 4706, 565, 8078, 29889, 18317, 3366, 2423, 7598, 3108, 2804, 1583, 29889, 333, 470, 451, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 363, 3480, 327, 11685, 297, 1583, 3032, 21094, 29918, 10052, 15297, 800, 29889, 5975, 7295, 13, 18884, 1583, 29889, 25140, 29898, 13, 462, 1678, 3480, 327, 11685, 29889, 10052, 15297, 1061, 29892, 13, 462, 1678, 28578, 29898, 1853, 543, 1137, 348, 29918, 1545, 2164, 613, 848, 29922, 8516, 511, 13, 18884, 1723, 13, 13, 1678, 822, 903, 5014, 29918, 2423, 29891, 29918, 6854, 29886, 29898, 1311, 29892, 274, 18091, 29901, 376, 9207, 29925, 1159, 1599, 6213, 29901, 13, 4706, 396, 14402, 29945, 29901, 11790, 654, 29896, 29901, 671, 278, 3773, 29875, 5067, 304, 1423, 278, 9124, 6434, 310, 9805, 261, 29892, 565, 338, 9124, 6685, 29892, 769, 11455, 445, 1580, 936, 274, 18091, 13, 4706, 565, 1583, 29889, 1450, 29875, 29889, 275, 29918, 9157, 6685, 29898, 6854, 29886, 29889, 23679, 261, 1125, 13, 9651, 736, 6213, 13, 4706, 396, 14402, 29945, 29901, 3001, 1663, 29884, 4543, 29199, 2078, 14520, 2038, 29871, 29896, 29900, 29892, 29871, 508, 451, 5174, 17327, 29892, 4153, 11455, 445, 274, 18091, 13, 4706, 396, 14402, 29945, 29889, 29896, 29901, 825, 338, 1583, 29889, 3601, 9183, 28772, 13, 4706, 565, 1583, 29889, 3601, 9183, 338, 6213, 470, 451, 1583, 29889, 3068, 29918, 17854, 29918, 351, 276, 882, 29898, 13, 9651, 274, 18091, 29922, 6854, 29886, 29892, 5906, 29922, 1311, 29889, 10052, 327, 11685, 29918, 9264, 13, 308, 1125, 13, 9651, 736, 13, 4706, 396, 14402, 29945, 29901, 1281, 333, 12757, 29906, 29901, 565, 278, 12529, 508, 451, 3234, 29872, 278, 29871, 3234, 310, 445, 274, 18091, 29892, 769, 11455, 445, 274, 18091, 13, 4706, 396, 14402, 29945, 29889, 29896, 584, 276, 339, 2658, 409, 2764, 292, 1881, 9316, 297, 3109, 1135, 697, 4331, 13, 4706, 565, 451, 1583, 29889, 3068, 29918, 5498, 346, 29898, 6854, 29886, 29922, 6854, 29886, 1125, 13, 9651, 736, 13, 4706, 396, 14402, 29945, 29901, 15523, 599, 278, 4195, 29892, 769, 1889, 445, 15649, 274, 18091, 29892, 2009, 3579, 10052, 327, 11685, 1068, 13, 4706, 565, 1583, 29889, 10052, 15297, 1061, 29918, 1853, 1275, 26562, 12232, 29940, 387, 15297, 1061, 29901, 13, 9651, 396, 14402, 29945, 29889, 29896, 29901, 825, 338, 278, 2099, 310, 5251, 29918, 8945, 1891, 29892, 2020, 746, 671, 26562, 12232, 29940, 387, 15297, 1061, 29892, 731, 445, 1828, 2153, 304, 5852, 13, 9651, 3480, 353, 1583, 29889, 10052, 15297, 1061, 29918, 1853, 29898, 13, 18884, 5251, 29918, 8945, 1891, 29922, 5574, 29892, 1024, 29922, 1311, 29889, 978, 718, 376, 11903, 718, 274, 18091, 29889, 23679, 261, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 3480, 353, 1583, 29889, 10052, 15297, 1061, 29918, 1853, 29898, 978, 29922, 1311, 29889, 978, 718, 376, 11903, 718, 274, 18091, 29889, 23679, 261, 29897, 13, 4706, 1583, 29889, 3827, 29918, 10052, 327, 11685, 29898, 13, 9651, 27214, 1061, 29922, 10052, 29892, 13, 9651, 274, 18091, 29922, 6854, 29886, 29892, 13, 9651, 318, 7692, 29922, 8945, 675, 29898, 13, 18884, 1583, 29889, 1137, 348, 29918, 14399, 29898, 1311, 29892, 1583, 3032, 3258, 29918, 18317, 29898, 6854, 29886, 29922, 6854, 29886, 8243, 13, 18884, 714, 26807, 29922, 6854, 29886, 29889, 449, 26807, 29892, 13, 18884, 297, 1725, 294, 1821, 29918, 7582, 2696, 10457, 29896, 29945, 29900, 29900, 29892, 13, 9651, 10353, 13, 4706, 1723, 13, 13, 1678, 822, 903, 5014, 29918, 29879, 514, 29918, 6854, 29886, 29898, 1311, 29892, 274, 18091, 29901, 376, 9207, 29925, 29908, 1125, 13, 4706, 565, 1583, 29889, 1450, 29875, 29889, 275, 29918, 9157, 6685, 29898, 6854, 29886, 29889, 23679, 261, 1125, 13, 9651, 736, 6213, 13, 4706, 396, 14402, 29953, 29901, 1395, 7584, 12529, 8455, 925, 2529, 20048, 376, 2423, 29891, 29908, 21447, 5847, 363, 10695, 8491, 5802, 4225, 29892, 408, 671, 378, 4680, 29892, 769, 5717, 278, 7463, 21691, 1203, 304, 4386, 5802, 4225, 1274, 23493, 13, 4706, 396, 14402, 29953, 29889, 29896, 29901, 825, 29915, 29879, 278, 1422, 1546, 671, 378, 398, 643, 322, 7463, 21691, 470, 925, 278, 1021, 1203, 29898, 11238, 278, 1021, 1203, 29892, 408, 21691, 10823, 29897, 13, 4706, 565, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 1583, 29889, 25978, 261, 29889, 265, 29918, 1482, 29918, 6854, 29886, 29898, 6854, 29886, 29922, 6854, 29886, 29897, 13, 13, 1678, 822, 373, 29918, 1482, 29918, 6854, 29886, 29898, 1311, 29892, 274, 18091, 29901, 376, 9207, 29925, 1159, 1599, 6213, 29901, 13, 4706, 565, 451, 1583, 29889, 276, 4925, 29901, 13, 9651, 736, 13, 4706, 396, 14402, 29946, 29901, 313, 29896, 467, 9068, 278, 15649, 274, 29888, 567, 29892, 1423, 297, 278, 20811, 310, 12529, 281, 1979, 756, 278, 14215, 5802, 13, 4706, 396, 14402, 29946, 29901, 313, 29906, 467, 9068, 278, 19417, 274, 29888, 567, 29892, 1423, 297, 278, 1136, 9929, 310, 12529, 281, 1979, 756, 278, 9262, 470, 451, 13, 4706, 565, 274, 18091, 29889, 29879, 27685, 583, 29898, 13, 9651, 2346, 3790, 29908, 275, 29918, 2423, 29891, 1115, 5852, 29892, 376, 14456, 1115, 1051, 29898, 1311, 29889, 5498, 3277, 29889, 8149, 580, 2915, 13, 308, 1125, 13, 9651, 1583, 3032, 5014, 29918, 2423, 29891, 29918, 6854, 29886, 29898, 6854, 29886, 29897, 13, 4706, 565, 274, 18091, 29889, 29879, 27685, 583, 29898, 13, 9651, 2346, 3790, 29908, 275, 29918, 2423, 29891, 1115, 7700, 29892, 376, 14456, 1115, 1051, 29898, 1311, 29889, 25978, 292, 29889, 8149, 580, 2915, 13, 308, 1125, 13, 9651, 1583, 3032, 5014, 29918, 29879, 514, 29918, 6854, 29886, 29898, 6854, 29886, 29897, 13, 13, 1678, 822, 4331, 29898, 1311, 1125, 13, 4706, 396, 14402, 29906, 29901, 29871, 21691, 10823, 363, 767, 6751, 817, 1274, 23493, 363, 5802, 13, 4706, 565, 1583, 29889, 1509, 29918, 25978, 261, 29901, 13, 9651, 1583, 29889, 25978, 261, 29889, 10568, 580, 13, 4706, 565, 1583, 29889, 276, 4925, 29901, 13, 9651, 736, 13, 4706, 396, 29871, 29900, 29889, 3349, 599, 590, 17861, 29925, 29879, 13, 4706, 396, 1583, 29889, 1450, 29875, 29889, 1327, 29918, 5992, 29898, 2042, 2433, 6854, 567, 742, 2346, 3790, 29915, 23679, 261, 2396, 1583, 1800, 13, 13, 4706, 396, 10049, 304, 8031, 17861, 29925, 29879, 13, 4706, 396, 10481, 29901, 881, 1423, 931, 322, 2656, 9316, 491, 4066, 2992, 13, 4706, 396, 14402, 29941, 29901, 10049, 304, 15649, 17861, 7024, 565, 505, 278, 15649, 274, 29888, 567, 29892, 769, 1246, 278, 740, 903, 5014, 29918, 2423, 29891, 29918, 6854, 29886, 29898, 6854, 29886, 29897, 13, 4706, 274, 29888, 567, 353, 1583, 29889, 1450, 29875, 29889, 1327, 29918, 1972, 29898, 13, 9651, 4004, 543, 6854, 567, 613, 2346, 3790, 29908, 14456, 1115, 1583, 29889, 5498, 3277, 29889, 8149, 3285, 376, 275, 29918, 2423, 29891, 1115, 5852, 29913, 13, 4706, 1723, 13, 4706, 565, 274, 29888, 567, 338, 6213, 29901, 13, 9651, 736, 13, 4706, 363, 274, 18091, 297, 274, 29888, 567, 29889, 5975, 7295, 13, 9651, 1583, 3032, 5014, 29918, 2423, 29891, 29918, 6854, 29886, 29898, 6854, 29886, 29897, 13, 13, 1678, 822, 508, 29918, 5498, 346, 29898, 1311, 29892, 274, 18091, 29901, 17861, 29925, 29892, 5251, 29918, 1217, 29918, 22613, 721, 29918, 10052, 15297, 800, 29922, 8824, 29897, 1599, 6120, 29901, 13, 4706, 9995, 8809, 1979, 470, 451, 591, 508, 7738, 278, 3734, 2944, 297, 931, 15945, 29908, 13, 4706, 396, 14402, 29955, 29901, 11806, 403, 29871, 281, 1979, 508, 7738, 278, 3734, 2944, 297, 931, 13, 4706, 396, 14402, 29955, 29889, 29896, 29901, 278, 3234, 310, 274, 18091, 451, 297, 20811, 6611, 736, 508, 451, 7738, 13, 4706, 565, 274, 18091, 29889, 4704, 451, 297, 1583, 29889, 5498, 3277, 29889, 8149, 7295, 13, 9651, 736, 7700, 13, 4706, 396, 14402, 29955, 29901, 671, 12314, 1988, 29909, 7979, 882, 304, 1423, 13, 4706, 17327, 353, 12314, 1988, 29909, 7979, 882, 29898, 13, 9651, 931, 29922, 6854, 29886, 29889, 3317, 29918, 2230, 29892, 5190, 29918, 9175, 29922, 6854, 29886, 29889, 3317, 29918, 5441, 29918, 9175, 29892, 14728, 29922, 6854, 29886, 29889, 1195, 29918, 22640, 13, 4706, 1723, 13, 4706, 1375, 29918, 535, 13347, 29918, 271, 353, 1583, 29889, 1450, 29875, 29889, 3784, 29918, 10568, 718, 29871, 29896, 448, 938, 29898, 1311, 29889, 326, 13847, 29918, 10052, 15297, 800, 29897, 13, 4706, 1375, 29918, 4530, 29918, 271, 353, 1375, 29918, 535, 13347, 29918, 271, 718, 1583, 29889, 1450, 29875, 29889, 4381, 29918, 4530, 292, 29918, 18829, 13, 4706, 565, 274, 18091, 29889, 3317, 29918, 2230, 529, 1375, 29918, 4530, 29918, 271, 718, 29871, 29896, 29901, 29871, 396, 29871, 29896, 338, 9212, 931, 304, 7738, 278, 3234, 13, 9651, 736, 7700, 13, 4706, 411, 13201, 29918, 20736, 29898, 1311, 29889, 816, 14952, 1125, 13, 9651, 20410, 353, 1583, 29889, 816, 14952, 29889, 816, 11272, 29898, 13, 18884, 8078, 29879, 11759, 13, 462, 1678, 2866, 1461, 29898, 13, 462, 4706, 22056, 11759, 1311, 29889, 333, 29892, 274, 18091, 29889, 23679, 261, 1402, 13, 462, 4706, 17327, 29922, 351, 276, 882, 29892, 13, 462, 4706, 17195, 29922, 1311, 3032, 3258, 29918, 18317, 29898, 6854, 29886, 29922, 6854, 29886, 511, 13, 462, 4706, 5626, 29922, 6854, 29886, 29889, 12175, 29892, 13, 462, 4706, 8794, 29918, 271, 29922, 1195, 29918, 4530, 29918, 271, 29892, 13, 462, 4706, 22834, 29918, 271, 29922, 1195, 29918, 535, 13347, 29918, 271, 29892, 13, 462, 1678, 1723, 13, 18884, 21251, 13, 18884, 9801, 29918, 12925, 29918, 1454, 29922, 1311, 29889, 27882, 362, 29918, 18829, 29892, 13, 18884, 5251, 29918, 1217, 29918, 22613, 721, 29918, 10052, 15297, 800, 29922, 465, 2017, 29918, 1217, 29918, 22613, 721, 29918, 10052, 15297, 800, 29892, 13, 18884, 1369, 29918, 271, 29922, 1195, 29918, 4530, 29918, 271, 29892, 13, 9651, 1723, 13, 4706, 736, 20410, 29889, 3084, 322, 1583, 29889, 3068, 29918, 24216, 29918, 484, 5779, 29898, 13, 9651, 20410, 29922, 816, 11272, 29892, 4331, 29922, 1311, 29889, 1450, 29875, 29889, 3784, 29918, 10568, 13, 4706, 1723, 13, 13, 1678, 822, 508, 29918, 24216, 29918, 484, 5779, 29898, 1311, 29892, 20410, 29901, 1102, 11272, 3401, 29892, 4331, 29901, 938, 1125, 13, 4706, 9995, 13, 4706, 10987, 29879, 565, 372, 338, 1950, 297, 12502, 304, 564, 3881, 1438, 4225, 472, 278, 2183, 931, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 20410, 29901, 13, 9651, 4331, 29901, 13, 13, 4706, 16969, 29901, 13, 13, 4706, 9995, 13, 4706, 4225, 353, 20410, 29889, 484, 5779, 13, 4706, 565, 7431, 29898, 484, 5779, 29897, 529, 29871, 29896, 29901, 13, 9651, 736, 5852, 13, 4706, 363, 817, 297, 4225, 29901, 13, 9651, 565, 817, 29889, 22640, 29918, 517, 29918, 2423, 29891, 1405, 29871, 29900, 322, 817, 29889, 10568, 529, 4331, 718, 29871, 29896, 448, 938, 29898, 13, 18884, 1583, 29889, 326, 13847, 29918, 10052, 15297, 800, 13, 632, 1125, 29871, 396, 732, 29873, 8144, 1423, 445, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 13, 13, 1990, 4321, 5126, 29898, 6132, 26521, 5126, 3260, 1125, 13, 1678, 9995, 4321, 27561, 1152, 1583, 3342, 3480, 327, 11685, 27214, 1061, 15945, 29908, 13, 13, 13, 1990, 12610, 15297, 1061, 7270, 537, 29898, 7270, 537, 6678, 1125, 13, 1678, 9995, 1576, 19725, 740, 310, 263, 27214, 1061, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 10823, 29901, 1619, 5126, 3260, 29892, 13, 4706, 17195, 29901, 360, 919, 29961, 710, 29892, 3139, 1402, 13, 4706, 1024, 29901, 28379, 29961, 710, 29962, 353, 6213, 29892, 13, 268, 1125, 13, 4706, 565, 1024, 338, 6213, 29901, 13, 9651, 1024, 353, 313, 13, 18884, 10823, 29889, 978, 13, 18884, 718, 376, 20605, 13, 18884, 718, 26345, 1642, 7122, 7373, 363, 903, 297, 17195, 3366, 1595, 8397, 3108, 565, 903, 2804, 10823, 29889, 333, 29897, 13, 9651, 1723, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29922, 978, 29897, 13, 4706, 1583, 29889, 14748, 353, 10823, 13, 4706, 1583, 29889, 18317, 353, 17195, 13, 13, 1678, 822, 903, 1285, 1461, 29879, 29898, 1311, 29892, 8571, 4110, 29901, 20504, 519, 29961, 7187, 1988, 29909, 7979, 882, 2314, 1599, 14348, 29961, 21263, 5387, 13, 4706, 9995, 1168, 369, 1372, 8571, 4110, 29914, 449, 26807, 964, 8078, 29879, 15945, 29908, 13, 4706, 565, 1583, 29889, 4479, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 703, 3782, 17195, 338, 6087, 313, 3782, 13336, 5235, 25760, 13, 4706, 17195, 353, 1583, 29889, 4479, 29889, 18317, 13, 4706, 736, 518, 13, 9651, 2866, 1461, 29898, 13, 18884, 22056, 29922, 18317, 3366, 1595, 8397, 12436, 13, 18884, 17327, 29922, 29874, 29892, 13, 18884, 17195, 29922, 18317, 29892, 13, 18884, 5626, 29922, 1311, 29889, 4479, 29889, 12175, 29892, 13, 9651, 1723, 13, 9651, 363, 263, 297, 8571, 4110, 13, 4706, 4514, 13, 13, 1678, 822, 903, 1285, 1461, 29898, 1311, 29892, 17327, 29901, 12314, 1988, 29909, 7979, 882, 29897, 1599, 2866, 1461, 29901, 13, 4706, 9995, 1168, 369, 1372, 385, 17327, 29914, 449, 2763, 964, 263, 8078, 15945, 29908, 13, 4706, 17195, 353, 1583, 29889, 18317, 13, 4706, 736, 2866, 1461, 29898, 13, 9651, 22056, 29922, 18317, 3366, 1595, 8397, 12436, 13, 9651, 17327, 29922, 351, 276, 882, 29892, 13, 9651, 17195, 29922, 18317, 29892, 13, 9651, 5626, 29922, 18317, 3366, 6854, 29886, 16862, 12175, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 903, 9021, 29918, 29879, 744, 29898, 1311, 29892, 17327, 29901, 12314, 1988, 29909, 7979, 882, 29897, 1599, 6120, 29901, 13, 4706, 736, 313, 13, 9651, 1583, 29889, 18317, 3366, 29879, 4539, 3108, 1275, 1583, 29889, 14748, 29889, 333, 13, 9651, 322, 17327, 3366, 5441, 29918, 9175, 3108, 529, 29871, 29896, 29872, 29899, 29953, 13, 4706, 1723, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 21957, 29901, 4451, 2763, 29897, 1599, 28379, 29961, 7270, 537, 1917, 5387, 13, 4706, 565, 338, 8758, 29898, 449, 2763, 29892, 9657, 1125, 13, 9651, 736, 1583, 29889, 4804, 29898, 351, 276, 882, 29922, 7187, 1988, 29909, 7979, 882, 29898, 1068, 449, 2763, 876, 13, 4706, 565, 338, 8758, 29898, 449, 2763, 29892, 12314, 1988, 29909, 7979, 882, 1125, 13, 9651, 736, 1583, 29889, 4804, 29898, 351, 276, 882, 29922, 449, 2763, 29897, 13, 4706, 12020, 7865, 2392, 29898, 29888, 29908, 3744, 2763, 29901, 426, 449, 2763, 29913, 2609, 367, 11543, 304, 385, 12314, 1988, 29909, 7979, 882, 1159, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 1246, 29898, 1311, 29892, 17327, 29901, 12314, 1988, 29909, 7979, 882, 29897, 1599, 28379, 29961, 7270, 537, 1917, 5387, 13, 4706, 9995, 29907, 4212, 304, 14707, 263, 17327, 15945, 29908, 13, 13, 1678, 822, 4903, 29898, 1311, 29892, 5626, 29901, 2391, 29961, 29902, 893, 434, 2314, 1599, 851, 29901, 13, 4706, 736, 376, 29940, 387, 15297, 1061, 7270, 537, 756, 451, 4903, 8954, 29908, 13, 13, 13, 1990, 349, 404, 326, 4695, 29940, 387, 15297, 1061, 7270, 537, 29898, 29940, 387, 15297, 1061, 7270, 537, 1125, 13, 1678, 9995, 1576, 19725, 740, 310, 263, 27214, 1061, 393, 15894, 916, 27214, 800, 5279, 1722, 674, 4418, 1213, 15945, 13, 13, 1678, 822, 1246, 29898, 1311, 29892, 17327, 29901, 12314, 1988, 29909, 7979, 882, 29897, 1599, 28379, 29961, 7270, 537, 1917, 5387, 13, 4706, 9995, 2744, 5957, 674, 367, 263, 18761, 310, 697, 995, 607, 297, 2507, 674, 367, 263, 1051, 310, 8078, 29879, 15945, 29908, 13, 4706, 565, 1583, 3032, 9021, 29918, 29879, 744, 29898, 351, 276, 882, 1125, 13, 9651, 736, 2672, 26707, 29918, 2692, 6227, 11937, 13, 4706, 396, 8078, 29879, 353, 1583, 29889, 14748, 29889, 1285, 1461, 29879, 13, 4706, 396, 13752, 300, 936, 353, 1051, 29898, 1285, 1461, 29879, 29897, 13, 4706, 396, 13752, 300, 936, 29889, 4397, 29898, 1311, 3032, 1285, 1461, 29898, 351, 276, 882, 876, 13, 4706, 13752, 300, 936, 353, 518, 1311, 3032, 1285, 1461, 29898, 351, 276, 882, 4638, 13, 4706, 2967, 29918, 4422, 353, 1583, 29889, 14748, 29889, 3601, 9183, 29889, 8394, 29918, 5521, 749, 13, 4706, 13752, 300, 936, 353, 1583, 29889, 14748, 29889, 7827, 29918, 329, 1793, 29898, 29882, 1478, 720, 300, 936, 29897, 13, 4706, 565, 13752, 300, 936, 529, 29871, 29900, 29901, 13, 9651, 736, 2672, 26707, 29918, 2692, 6227, 11937, 13, 4706, 736, 13752, 300, 936, 448, 2967, 29918, 4422, 13, 13, 13, 1990, 20693, 326, 4695, 29940, 387, 15297, 1061, 7270, 537, 29898, 29940, 387, 15297, 1061, 7270, 537, 1125, 13, 1678, 9995, 1576, 19725, 740, 310, 263, 27214, 1061, 393, 15894, 916, 27214, 800, 5279, 1722, 674, 9269, 1213, 15945, 13, 13, 1678, 822, 1246, 29898, 1311, 29892, 17327, 29901, 12314, 1988, 29909, 7979, 882, 29897, 1599, 28379, 29961, 7270, 537, 1917, 5387, 13, 4706, 565, 1583, 3032, 9021, 29918, 29879, 744, 29898, 351, 276, 882, 1125, 13, 9651, 736, 2672, 26707, 29918, 2692, 6227, 11937, 13, 4706, 396, 8078, 29879, 353, 1583, 29889, 14748, 29889, 1285, 1461, 29879, 13, 4706, 396, 13752, 300, 936, 353, 1051, 29898, 1285, 1461, 29879, 29897, 13, 4706, 396, 13752, 300, 936, 29889, 4397, 29898, 1311, 3032, 1285, 1461, 29898, 351, 276, 882, 876, 13, 4706, 13752, 300, 936, 353, 518, 1311, 3032, 1285, 1461, 29898, 351, 276, 882, 4638, 13, 4706, 363, 3480, 327, 11685, 297, 1583, 29889, 14748, 29889, 21094, 29918, 10052, 15297, 800, 29901, 29871, 396, 1134, 29901, 11455, 13, 9651, 27214, 1061, 353, 3480, 327, 11685, 29889, 10052, 15297, 1061, 13, 9651, 1857, 29918, 974, 571, 353, 27214, 1061, 29889, 1357, 29918, 4230, 29918, 771, 1066, 284, 13, 9651, 565, 1857, 29918, 974, 571, 338, 451, 6213, 29901, 13, 18884, 13752, 300, 936, 29889, 4397, 29898, 1311, 3032, 1285, 1461, 29898, 3784, 29918, 974, 571, 876, 13, 4706, 2967, 29918, 4422, 353, 1583, 29889, 14748, 29889, 3601, 9183, 29889, 8394, 29918, 5521, 749, 13, 4706, 13752, 300, 936, 353, 1583, 29889, 14748, 29889, 7827, 29918, 329, 1793, 29898, 1761, 29898, 29882, 1478, 720, 300, 936, 876, 13, 4706, 565, 13752, 300, 936, 529, 29871, 29900, 29901, 13, 9651, 736, 2672, 26707, 29918, 2692, 6227, 11937, 13, 4706, 736, 13752, 300, 936, 448, 2967, 29918, 4422, 13, 13, 13, 1990, 319, 369, 6751, 29940, 387, 15297, 1061, 7270, 537, 29898, 29940, 387, 15297, 1061, 7270, 537, 1125, 13, 1678, 9995, 29909, 19725, 740, 393, 4145, 1475, 5994, 4695, 322, 282, 404, 326, 4695, 6161, 4097, 5608, 368, 773, 10365, 519, 7688, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 10823, 29901, 1619, 5126, 3260, 29892, 13, 4706, 17195, 29901, 360, 919, 29961, 710, 29892, 3139, 1402, 13, 4706, 1024, 29901, 28379, 29961, 710, 29962, 353, 6213, 29892, 13, 4706, 5994, 1608, 29901, 5785, 353, 29871, 29900, 29889, 29945, 29892, 13, 268, 1125, 13, 4706, 405, 2795, 2061, 17255, 2344, 12035, 1311, 29922, 1311, 29892, 1024, 29922, 978, 29897, 13, 4706, 1583, 29889, 20640, 1608, 353, 5994, 1608, 13, 4706, 1583, 29889, 20640, 4695, 353, 20693, 326, 4695, 29940, 387, 15297, 1061, 7270, 537, 29898, 13, 9651, 10823, 29922, 14748, 29892, 17195, 29922, 18317, 13, 4706, 1723, 13, 4706, 1583, 29889, 29886, 404, 326, 4695, 353, 349, 404, 326, 4695, 29940, 387, 15297, 1061, 7270, 537, 29898, 13, 9651, 10823, 29922, 14748, 29892, 17195, 29922, 18317, 13, 4706, 1723, 13, 13, 1678, 822, 1246, 29898, 1311, 29892, 17327, 29901, 12314, 1988, 29909, 7979, 882, 29897, 1599, 28379, 29961, 7270, 537, 1917, 5387, 13, 4706, 565, 1583, 3032, 9021, 29918, 29879, 744, 29898, 351, 276, 882, 1125, 13, 9651, 736, 2672, 26707, 29918, 2692, 6227, 11937, 13, 4706, 3523, 29892, 282, 404, 353, 1583, 29889, 20640, 4695, 29898, 351, 276, 882, 511, 1583, 29889, 29886, 404, 326, 4695, 29898, 351, 276, 882, 29897, 13, 4706, 565, 3523, 338, 6213, 470, 282, 404, 338, 6213, 29901, 13, 9651, 736, 6213, 13, 4706, 736, 1583, 29889, 20640, 1608, 334, 3523, 718, 313, 29896, 448, 1583, 29889, 20640, 1608, 29897, 334, 282, 404, 13, 2 ]
ocd_backend/models/definitions/person.py
aolieman/open-raadsinformatie
0
182919
"""The classes in this person module are derived from and described by: http://www.w3.org/ns/person# """ import foaf from ocd_backend.models.definitions import Opengov, Schema, Foaf, Rdfs, \ Dcterms, Bio, Vcard, Person as PersonNS, Meeting from ocd_backend.models.properties import StringProperty, URLProperty, DateTimeProperty, \ Relation class Person(PersonNS, foaf.Agent): biography = StringProperty(Bio, 'biography') contact_details = Relation(Opengov, 'contactDetail') alternative_name = StringProperty(Dcterms, 'alternative') family_name = StringProperty(Foaf, 'familyName') gender = StringProperty(Foaf, 'gender') given_name = StringProperty(Foaf, 'givenName') additional_name = StringProperty(Schema, 'additionalName') home_location = StringProperty(Schema, 'homeLocation') honorific_prefix = StringProperty(Schema, 'honorificPrefix') honorific_suffix = StringProperty(Schema, 'honorificSuffix') nickname = StringProperty(Vcard, 'nickname') initials = StringProperty(Meeting, 'initials') name = StringProperty(Foaf, 'name') national_identity = StringProperty(Opengov, 'nationalIdentity') summary = StringProperty(Bio, 'olb') other_names = StringProperty(Opengov, 'otherName') links = URLProperty(Rdfs, 'seeAlso') birth_place = StringProperty(Schema, 'birthPlace') birth_date = DateTimeProperty(Schema, 'birthDate') death_date = DateTimeProperty(Schema, 'deathDate') email = StringProperty(Schema, 'email') image = Relation(Schema, 'image') phone = StringProperty(Schema, 'telephone')
[ 1, 9995, 1576, 4413, 297, 445, 2022, 3883, 526, 10723, 515, 322, 5439, 491, 29901, 13, 1124, 597, 1636, 29889, 29893, 29941, 29889, 990, 29914, 1983, 29914, 10532, 29937, 13, 15945, 29908, 13, 13, 5215, 1701, 2142, 13, 3166, 288, 2252, 29918, 27852, 29889, 9794, 29889, 25476, 2187, 1053, 6461, 996, 586, 29892, 1102, 2603, 29892, 28532, 2142, 29892, 390, 29069, 29892, 320, 13, 1678, 360, 312, 837, 29879, 29892, 21184, 29892, 478, 7543, 29892, 5196, 408, 5196, 3059, 29892, 2191, 15133, 13, 3166, 288, 2252, 29918, 27852, 29889, 9794, 29889, 11330, 1053, 1714, 4854, 29892, 3988, 4854, 29892, 12315, 4854, 29892, 320, 13, 1678, 6376, 362, 13, 13, 13, 1990, 5196, 29898, 7435, 3059, 29892, 1701, 2142, 29889, 19661, 1125, 13, 1678, 4768, 5275, 353, 1714, 4854, 29898, 29933, 601, 29892, 525, 5365, 5275, 1495, 13, 1678, 6958, 29918, 14144, 353, 6376, 362, 29898, 11746, 996, 586, 29892, 525, 12346, 16570, 1495, 13, 1678, 8671, 29918, 978, 353, 1714, 4854, 29898, 29928, 312, 837, 29879, 29892, 525, 26123, 1230, 1495, 13, 1678, 3942, 29918, 978, 353, 1714, 4854, 29898, 29943, 29877, 2142, 29892, 525, 11922, 1170, 1495, 13, 1678, 23346, 353, 1714, 4854, 29898, 29943, 29877, 2142, 29892, 525, 26098, 1495, 13, 1678, 2183, 29918, 978, 353, 1714, 4854, 29898, 29943, 29877, 2142, 29892, 525, 29887, 5428, 1170, 1495, 13, 1678, 5684, 29918, 978, 353, 1714, 4854, 29898, 12763, 29892, 525, 1202, 3245, 1170, 1495, 13, 1678, 3271, 29918, 5479, 353, 1714, 4854, 29898, 12763, 29892, 525, 5184, 6508, 1495, 13, 1678, 10657, 928, 29918, 13506, 353, 1714, 4854, 29898, 12763, 29892, 525, 27305, 272, 928, 23095, 1495, 13, 1678, 10657, 928, 29918, 2146, 600, 861, 353, 1714, 4854, 29898, 12763, 29892, 525, 27305, 272, 928, 29903, 3096, 861, 1495, 13, 1678, 25985, 978, 353, 1714, 4854, 29898, 29963, 7543, 29892, 525, 19254, 978, 1495, 13, 1678, 2847, 29879, 353, 1714, 4854, 29898, 6816, 15133, 29892, 525, 11228, 29879, 1495, 13, 1678, 1024, 353, 1714, 4854, 29898, 29943, 29877, 2142, 29892, 525, 978, 1495, 13, 1678, 4797, 29918, 22350, 353, 1714, 4854, 29898, 11746, 996, 586, 29892, 525, 29876, 1288, 18415, 1495, 13, 1678, 15837, 353, 1714, 4854, 29898, 29933, 601, 29892, 525, 324, 29890, 1495, 13, 1678, 916, 29918, 7039, 353, 1714, 4854, 29898, 11746, 996, 586, 29892, 525, 1228, 1170, 1495, 13, 1678, 2988, 353, 3988, 4854, 29898, 29934, 29069, 29892, 525, 4149, 17351, 1495, 13, 1678, 12060, 29918, 6689, 353, 1714, 4854, 29898, 12763, 29892, 525, 29890, 7515, 22150, 1495, 13, 1678, 12060, 29918, 1256, 353, 12315, 4854, 29898, 12763, 29892, 525, 29890, 7515, 2539, 1495, 13, 1678, 4892, 29918, 1256, 353, 12315, 4854, 29898, 12763, 29892, 525, 311, 493, 2539, 1495, 13, 1678, 4876, 353, 1714, 4854, 29898, 12763, 29892, 525, 5269, 1495, 13, 1678, 1967, 353, 6376, 362, 29898, 12763, 29892, 525, 3027, 1495, 13, 1678, 9008, 353, 1714, 4854, 29898, 12763, 29892, 525, 15494, 6710, 1495, 13, 2 ]
ofa/imagenet_codebase/utils/pytorch_modules.py
twice154/ofa-pytorch
9
149841
# Once for All: Train One Network and Specialize it for Efficient Deployment # <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # International Conference on Learning Representations (ICLR), 2020. from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F def make_divisible(v, divisor, min_val=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be seen here: https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet.py :param v: :param divisor: :param min_val: :return: """ if min_val is None: min_val = divisor new_v = max(min_val, int(v + divisor / 2) // divisor * divisor) # Make sure that round down does not go down by more than 10%. if new_v < 0.9 * v: new_v += divisor return new_v def build_activation(act_func, inplace=True, upscale_factor=2): if act_func == 'relu': return nn.ReLU(inplace=inplace) elif act_func == 'relu6': return nn.ReLU6(inplace=inplace) elif act_func == 'tanh': return nn.Tanh() elif act_func == 'sigmoid': return nn.Sigmoid() elif act_func == 'h_swish': return Hswish(inplace=inplace) elif act_func == 'h_sigmoid': return Hsigmoid(inplace=inplace) elif act_func == 'prelu': return nn.PReLU(inplace=inplace) elif act_func == 'lrelu': return nn.LeakyReLU(0.1, inplace=inplace) elif act_func == 'pixelshuffle': return build_pixelshuffle(upscale_factor=2) elif act_func == 'pixelshuffle+relu': return nn.Sequential( build_pixelshuffle(upscale_factor=upscale_factor), nn.ReLU(inplace=inplace) ) elif act_func == 'pixelshuffle+relu6': return nn.Sequential( build_pixelshuffle(upscale_factor=upscale_factor), nn.ReLU6(inplace=inplace) ) elif act_func == 'pixelshuffle+prelu': return nn.Sequential( build_pixelshuffle(upscale_factor=upscale_factor), nn.PReLU(inplace=inplace) ) elif act_func == 'pixelshuffle+lrelu': return nn.Sequential( build_pixelshuffle(upscale_factor=upscale_factor), nn.LeakyReLU(0.1, inplace=inplace) ) elif act_func == 'pixelunshuffle': return build_pixelunshuffle(downscale_factor=2) elif act_func == 'pixelunshuffle+relu': return nn.Sequential( build_pixelunshuffle(downscale_factor=upscale_factor), nn.ReLU(inplace=inplace) ) elif act_func == 'pixelunshuffle+relu6': return nn.Sequential( build_pixelunshuffle(downscale_factor=upscale_factor), nn.ReLU6(inplace=inplace) ) elif act_func == 'pixelunshuffle+prelu': return nn.Sequential( build_pixelunshuffle(downscale_factor=upscale_factor), nn.PReLU(inplace=inplace) ) elif act_func == 'pixelunshuffle+lrelu': return nn.Sequential( build_pixelunshuffle(downscale_factor=upscale_factor), nn.LeakyReLU(0.1, inplace=inplace) ) elif act_func is None: return None else: raise ValueError('do not support: %s' % act_func) def build_pixelshuffle(upscale_factor=2): return nn.PixelShuffle(upscale_factor=upscale_factor) def build_pixelunshuffle(downscale_factor=2): return PixelUnshuffle(downscale_factor=downscale_factor) class ShuffleLayer(nn.Module): def __init__(self, groups): super(ShuffleLayer, self).__init__() self.groups = groups def forward(self, x): batchsize, num_channels, height, width = x.size() channels_per_group = num_channels // self.groups # reshape x = x.view(batchsize, self.groups, channels_per_group, height, width) x = torch.transpose(x, 1, 2).contiguous() # flatten x = x.view(batchsize, -1, height, width) return x class Hswish(nn.Module): def __init__(self, inplace=True): super(Hswish, self).__init__() self.inplace = inplace def forward(self, x): return x * F.relu6(x + 3., inplace=self.inplace) / 6. class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(x + 3., inplace=self.inplace) / 6. class SEModule(nn.Module): REDUCTION = 4 def __init__(self, channel): super(SEModule, self).__init__() self.channel = channel self.reduction = SEModule.REDUCTION num_mid = make_divisible(self.channel // self.reduction, divisor=8) self.fc = nn.Sequential(OrderedDict([ ('reduce', nn.Conv2d(self.channel, num_mid, 1, 1, 0, bias=True)), ('relu', nn.ReLU(inplace=True)), ('expand', nn.Conv2d(num_mid, self.channel, 1, 1, 0, bias=True)), ('h_sigmoid', Hsigmoid(inplace=True)), ])) def forward(self, x): y = x.mean(3, keepdim=True).mean(2, keepdim=True) y = self.fc(y) return x * y # import torch # import torch.nn as nn # import torch.nn.functional as F def pixel_unshuffle(input, downscale_factor): ''' input: batchSize * c * k*w * k*h kdownscale_factor: k batchSize * c * k*w * k*h -> batchSize * k*k*c * w * h ''' c = input.shape[1] kernel = torch.zeros(size=[downscale_factor * downscale_factor * c, 1, downscale_factor, downscale_factor], device=input.device) for y in range(downscale_factor): for x in range(downscale_factor): kernel[x + y * downscale_factor::downscale_factor*downscale_factor, 0, y, x] = 1 return F.conv2d(input, kernel, stride=downscale_factor, groups=c) class PixelUnshuffle(nn.Module): def __init__(self, downscale_factor): super(PixelUnshuffle, self).__init__() self.downscale_factor = downscale_factor def forward(self, input): ''' input: batchSize * c * k*w * k*h kdownscale_factor: k batchSize * c * k*w * k*h -> batchSize * k*k*c * w * h ''' return pixel_unshuffle(input, self.downscale_factor)
[ 1, 396, 9038, 363, 2178, 29901, 28186, 3118, 8527, 322, 12630, 675, 372, 363, 382, 4543, 10034, 22812, 13, 29937, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 29958, 13, 29937, 4623, 16377, 373, 29257, 16314, 800, 313, 2965, 29519, 511, 29871, 29906, 29900, 29906, 29900, 29889, 13, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 13, 13, 1753, 1207, 29918, 4563, 275, 1821, 29898, 29894, 29892, 8572, 272, 29892, 1375, 29918, 791, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 910, 740, 338, 4586, 515, 278, 2441, 15886, 13761, 29889, 13, 1678, 739, 5662, 1973, 393, 599, 15359, 505, 263, 8242, 1353, 393, 338, 8572, 1821, 491, 29871, 29947, 13, 1678, 739, 508, 367, 3595, 1244, 29901, 13, 1678, 2045, 597, 3292, 29889, 510, 29914, 29056, 29914, 9794, 29914, 10054, 29914, 6207, 29914, 690, 2842, 29914, 2536, 326, 29914, 1212, 29879, 29914, 29885, 12213, 264, 300, 29914, 29885, 12213, 264, 300, 29889, 2272, 13, 1678, 584, 3207, 325, 29901, 13, 1678, 584, 3207, 8572, 272, 29901, 13, 1678, 584, 3207, 1375, 29918, 791, 29901, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 565, 1375, 29918, 791, 338, 6213, 29901, 13, 4706, 1375, 29918, 791, 353, 8572, 272, 13, 1678, 716, 29918, 29894, 353, 4236, 29898, 1195, 29918, 791, 29892, 938, 29898, 29894, 718, 8572, 272, 847, 29871, 29906, 29897, 849, 8572, 272, 334, 8572, 272, 29897, 13, 1678, 396, 8561, 1854, 393, 4513, 1623, 947, 451, 748, 1623, 491, 901, 1135, 29871, 29896, 29900, 15543, 13, 1678, 565, 716, 29918, 29894, 529, 29871, 29900, 29889, 29929, 334, 325, 29901, 13, 4706, 716, 29918, 29894, 4619, 8572, 272, 13, 1678, 736, 716, 29918, 29894, 13, 13, 13, 1753, 2048, 29918, 11236, 362, 29898, 627, 29918, 9891, 29892, 297, 6689, 29922, 5574, 29892, 24081, 29883, 744, 29918, 19790, 29922, 29906, 1125, 13, 1678, 565, 1044, 29918, 9891, 1275, 525, 2674, 29884, 2396, 13, 4706, 736, 302, 29876, 29889, 1123, 29931, 29965, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 2674, 29884, 29953, 2396, 13, 4706, 736, 302, 29876, 29889, 1123, 29931, 29965, 29953, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 13161, 29882, 2396, 13, 4706, 736, 302, 29876, 29889, 29911, 27731, 580, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 18816, 29885, 3398, 2396, 13, 4706, 736, 302, 29876, 29889, 29903, 335, 29885, 3398, 580, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29882, 29918, 2774, 728, 2396, 13, 4706, 736, 379, 2774, 728, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29882, 29918, 18816, 29885, 3398, 2396, 13, 4706, 736, 379, 18816, 29885, 3398, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 1457, 6092, 2396, 13, 4706, 736, 302, 29876, 29889, 29925, 1123, 29931, 29965, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29880, 2674, 29884, 2396, 13, 4706, 736, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 29898, 29900, 29889, 29896, 29892, 297, 6689, 29922, 262, 6689, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 845, 21897, 2396, 13, 4706, 736, 2048, 29918, 29886, 15711, 845, 21897, 29898, 14340, 29883, 744, 29918, 19790, 29922, 29906, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 845, 21897, 29974, 2674, 29884, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 845, 21897, 29898, 14340, 29883, 744, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 1123, 29931, 29965, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 845, 21897, 29974, 2674, 29884, 29953, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 845, 21897, 29898, 14340, 29883, 744, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 1123, 29931, 29965, 29953, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 845, 21897, 29974, 1457, 6092, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 845, 21897, 29898, 14340, 29883, 744, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 29925, 1123, 29931, 29965, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 845, 21897, 29974, 29880, 2674, 29884, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 845, 21897, 29898, 14340, 29883, 744, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 29898, 29900, 29889, 29896, 29892, 297, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 348, 845, 21897, 2396, 13, 4706, 736, 2048, 29918, 29886, 15711, 348, 845, 21897, 29898, 3204, 7052, 29918, 19790, 29922, 29906, 29897, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 348, 845, 21897, 29974, 2674, 29884, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 348, 845, 21897, 29898, 3204, 7052, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 1123, 29931, 29965, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 348, 845, 21897, 29974, 2674, 29884, 29953, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 348, 845, 21897, 29898, 3204, 7052, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 1123, 29931, 29965, 29953, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 348, 845, 21897, 29974, 1457, 6092, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 348, 845, 21897, 29898, 3204, 7052, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 29925, 1123, 29931, 29965, 29898, 262, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 1275, 525, 29886, 15711, 348, 845, 21897, 29974, 29880, 2674, 29884, 2396, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 2048, 29918, 29886, 15711, 348, 845, 21897, 29898, 3204, 7052, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 511, 13, 9651, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 29898, 29900, 29889, 29896, 29892, 297, 6689, 29922, 262, 6689, 29897, 13, 4706, 1723, 13, 1678, 25342, 1044, 29918, 9891, 338, 6213, 29901, 13, 4706, 736, 6213, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 1867, 451, 2304, 29901, 1273, 29879, 29915, 1273, 1044, 29918, 9891, 29897, 13, 13, 13, 1753, 2048, 29918, 29886, 15711, 845, 21897, 29898, 14340, 29883, 744, 29918, 19790, 29922, 29906, 1125, 13, 1678, 736, 302, 29876, 29889, 29637, 2713, 21897, 29898, 14340, 29883, 744, 29918, 19790, 29922, 14340, 29883, 744, 29918, 19790, 29897, 13, 13, 13, 1753, 2048, 29918, 29886, 15711, 348, 845, 21897, 29898, 3204, 7052, 29918, 19790, 29922, 29906, 1125, 13, 1678, 736, 349, 15711, 2525, 845, 21897, 29898, 3204, 7052, 29918, 19790, 29922, 3204, 7052, 29918, 19790, 29897, 13, 268, 13, 13, 1990, 1383, 21897, 14420, 29898, 15755, 29889, 7355, 1125, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6471, 1125, 13, 4706, 2428, 29898, 2713, 21897, 14420, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 13155, 353, 6471, 13, 268, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 9853, 2311, 29892, 954, 29918, 305, 12629, 29892, 3171, 29892, 2920, 353, 921, 29889, 2311, 580, 13, 4706, 18196, 29918, 546, 29918, 2972, 353, 954, 29918, 305, 12629, 849, 1583, 29889, 13155, 13, 4706, 396, 620, 14443, 13, 4706, 921, 353, 921, 29889, 1493, 29898, 16175, 2311, 29892, 1583, 29889, 13155, 29892, 18196, 29918, 546, 29918, 2972, 29892, 3171, 29892, 2920, 29897, 13, 4706, 921, 353, 4842, 305, 29889, 3286, 4220, 29898, 29916, 29892, 29871, 29896, 29892, 29871, 29906, 467, 1285, 5526, 681, 580, 13, 4706, 396, 1652, 8606, 13, 4706, 921, 353, 921, 29889, 1493, 29898, 16175, 2311, 29892, 448, 29896, 29892, 3171, 29892, 2920, 29897, 13, 4706, 736, 921, 13, 13, 13, 1990, 379, 2774, 728, 29898, 15755, 29889, 7355, 1125, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 297, 6689, 29922, 5574, 1125, 13, 4706, 2428, 29898, 29950, 2774, 728, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 262, 6689, 353, 297, 6689, 13, 268, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 921, 334, 383, 29889, 2674, 29884, 29953, 29898, 29916, 718, 29871, 29941, 1696, 297, 6689, 29922, 1311, 29889, 262, 6689, 29897, 847, 29871, 29953, 29889, 13, 13, 13, 1990, 379, 18816, 29885, 3398, 29898, 15755, 29889, 7355, 1125, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 297, 6689, 29922, 5574, 1125, 13, 4706, 2428, 29898, 29950, 18816, 29885, 3398, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 262, 6689, 353, 297, 6689, 13, 268, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 383, 29889, 2674, 29884, 29953, 29898, 29916, 718, 29871, 29941, 1696, 297, 6689, 29922, 1311, 29889, 262, 6689, 29897, 847, 29871, 29953, 29889, 13, 13, 13, 1990, 3725, 7355, 29898, 15755, 29889, 7355, 1125, 13, 1678, 390, 3352, 29965, 9838, 353, 29871, 29946, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8242, 1125, 13, 4706, 2428, 29898, 1660, 7355, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 308, 13, 4706, 1583, 29889, 12719, 353, 8242, 13, 4706, 1583, 29889, 9313, 428, 353, 3725, 7355, 29889, 1525, 14849, 9838, 13, 13, 4706, 954, 29918, 6563, 353, 1207, 29918, 4563, 275, 1821, 29898, 1311, 29889, 12719, 849, 1583, 29889, 9313, 428, 29892, 8572, 272, 29922, 29947, 29897, 13, 308, 13, 4706, 1583, 29889, 13801, 353, 302, 29876, 29889, 16941, 2556, 29898, 7514, 287, 21533, 4197, 13, 9651, 6702, 17469, 742, 302, 29876, 29889, 1168, 29894, 29906, 29881, 29898, 1311, 29889, 12719, 29892, 954, 29918, 6563, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 24003, 29922, 5574, 8243, 13, 9651, 6702, 2674, 29884, 742, 302, 29876, 29889, 1123, 29931, 29965, 29898, 262, 6689, 29922, 5574, 8243, 13, 9651, 6702, 18837, 742, 302, 29876, 29889, 1168, 29894, 29906, 29881, 29898, 1949, 29918, 6563, 29892, 1583, 29889, 12719, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 24003, 29922, 5574, 8243, 13, 9651, 6702, 29882, 29918, 18816, 29885, 3398, 742, 379, 18816, 29885, 3398, 29898, 262, 6689, 29922, 5574, 8243, 13, 4706, 4514, 876, 13, 268, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 343, 353, 921, 29889, 12676, 29898, 29941, 29892, 3013, 6229, 29922, 5574, 467, 12676, 29898, 29906, 29892, 3013, 6229, 29922, 5574, 29897, 13, 4706, 343, 353, 1583, 29889, 13801, 29898, 29891, 29897, 13, 4706, 736, 921, 334, 343, 13, 13, 13, 29937, 1053, 4842, 305, 13, 29937, 1053, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 29937, 1053, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 13, 13, 1753, 15526, 29918, 348, 845, 21897, 29898, 2080, 29892, 1623, 7052, 29918, 19790, 1125, 13, 1678, 14550, 13, 1678, 1881, 29901, 9853, 3505, 334, 274, 334, 413, 29930, 29893, 334, 413, 29930, 29882, 13, 1678, 413, 3204, 7052, 29918, 19790, 29901, 413, 13, 1678, 9853, 3505, 334, 274, 334, 413, 29930, 29893, 334, 413, 29930, 29882, 1599, 9853, 3505, 334, 413, 29930, 29895, 29930, 29883, 334, 281, 334, 298, 13, 1678, 14550, 13, 1678, 274, 353, 1881, 29889, 12181, 29961, 29896, 29962, 13, 13, 1678, 8466, 353, 4842, 305, 29889, 3298, 359, 29898, 2311, 11759, 3204, 7052, 29918, 19790, 334, 1623, 7052, 29918, 19790, 334, 274, 29892, 13, 462, 18884, 29896, 29892, 1623, 7052, 29918, 19790, 29892, 1623, 7052, 29918, 19790, 1402, 13, 462, 308, 4742, 29922, 2080, 29889, 10141, 29897, 13, 1678, 363, 343, 297, 3464, 29898, 3204, 7052, 29918, 19790, 1125, 13, 4706, 363, 921, 297, 3464, 29898, 3204, 7052, 29918, 19790, 1125, 13, 9651, 8466, 29961, 29916, 718, 343, 334, 1623, 7052, 29918, 19790, 1057, 3204, 7052, 29918, 19790, 29930, 3204, 7052, 29918, 19790, 29892, 29871, 29900, 29892, 343, 29892, 921, 29962, 353, 29871, 29896, 13, 1678, 736, 383, 29889, 20580, 29906, 29881, 29898, 2080, 29892, 8466, 29892, 380, 2426, 29922, 3204, 7052, 29918, 19790, 29892, 6471, 29922, 29883, 29897, 13, 13, 1990, 349, 15711, 2525, 845, 21897, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1623, 7052, 29918, 19790, 1125, 13, 4706, 2428, 29898, 29637, 2525, 845, 21897, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 3204, 7052, 29918, 19790, 353, 1623, 7052, 29918, 19790, 13, 1678, 822, 6375, 29898, 1311, 29892, 1881, 1125, 13, 4706, 14550, 13, 4706, 1881, 29901, 9853, 3505, 334, 274, 334, 413, 29930, 29893, 334, 413, 29930, 29882, 13, 4706, 413, 3204, 7052, 29918, 19790, 29901, 413, 13, 4706, 9853, 3505, 334, 274, 334, 413, 29930, 29893, 334, 413, 29930, 29882, 1599, 9853, 3505, 334, 413, 29930, 29895, 29930, 29883, 334, 281, 334, 298, 13, 4706, 14550, 13, 13, 4706, 736, 15526, 29918, 348, 845, 21897, 29898, 2080, 29892, 1583, 29889, 3204, 7052, 29918, 19790, 29897, 2 ]
vunit/com/codec_vhdl_package.py
nordicneurolab/vunit
1
71488
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (c) 2014-2020, <NAME> <EMAIL> """ Module containing the CodecVHDLPackage class. """ from string import Template from vunit.vhdl_parser import VHDLPackage from vunit.vhdl_parser import remove_comments from vunit.com.codec_vhdl_enumeration_type import CodecVHDLEnumerationType from vunit.com.codec_vhdl_array_type import CodecVHDLArrayType from vunit.com.codec_vhdl_record_type import CodecVHDLRecordType class CodecVHDLPackage(VHDLPackage): """Class derived from VHDLPackage to provide codec generator functionality for the data types definied in the package.""" def __init__(self, identifier, enumeration_types, record_types, array_types): super(CodecVHDLPackage, self).__init__( identifier, enumeration_types, record_types, array_types ) self._template = None @classmethod def parse(cls, code): """ Return a new VHDLPackage instance for a single package found within the code """ code = remove_comments(code).lower() return cls( cls._package_start_re.match(code).group("id"), list(CodecVHDLEnumerationType.find(code)), list(CodecVHDLRecordType.find(code)), list(CodecVHDLArrayType.find(code)), ) @classmethod def find_named_package(cls, code, name): """Find and return the named package in the code (if it exists)""" for package in cls.find(code): if package.identifier == name: return package return None def generate_codecs_and_support_functions(self): """Generate codecs and communication support functions for the data types defined in self.""" self._template = PackageCodecTemplate() declarations = "" definitions = "" # Record ( new_declarations, new_definitions, ) = self._generate_record_codec_and_to_string_functions() declarations += new_declarations definitions += new_definitions new_declarations, new_definitions = self._generate_msg_type_encoders() declarations += new_declarations definitions += new_definitions new_declarations, new_definitions = self._generate_get_functions() declarations += new_declarations definitions += new_definitions # Enumerations ( all_msg_types_enumeration_type, msg_type_enumeration_types, ) = self._create_enumeration_of_all_msg_types() if all_msg_types_enumeration_type is not None: declarations += self._template.all_msg_types_enumeration_type_declaration.substitute( identifier=all_msg_types_enumeration_type.identifier, literals=", ".join(all_msg_types_enumeration_type.literals), ) if all_msg_types_enumeration_type is not None: declarations += self._template.get_msg_type_declaration.substitute( type=all_msg_types_enumeration_type.identifier ) definitions += self._template.get_msg_type_definition.substitute( type=all_msg_types_enumeration_type.identifier ) ( new_declarations, new_definitions, ) = self._generate_enumeration_codec_and_to_string_functions( all_msg_types_enumeration_type, msg_type_enumeration_types ) declarations += new_declarations definitions += new_definitions # Arrays ( new_declarations, new_definitions, ) = self._generate_array_codec_and_to_string_functions() declarations += new_declarations definitions += new_definitions return declarations, definitions def _generate_record_codec_and_to_string_functions(self): """Generate codecs and to_string functions for all record data types.""" declarations = "" definitions = "" for record in self.record_types: ( new_declarations, new_definitions, ) = record.generate_codecs_and_support_functions() declarations += new_declarations definitions += new_definitions return declarations, definitions def _generate_array_codec_and_to_string_functions(self): """Generate codecs and to_string functions for all array data types.""" declarations = "" definitions = """ -- Helper function to make tests pass GHDL v0.37 function get_encoded_length ( constant vec: string ) return integer is begin return vec'length; end; """ for array in self.array_types: ( new_declarations, new_definitions, ) = array.generate_codecs_and_support_functions() declarations += new_declarations definitions += new_definitions return declarations, definitions def _create_enumeration_of_all_msg_types(self): """Create an enumeration type containing all valid message types. These message types are collected from records with a msg_type element which has an enumerated data type.""" msg_type_enumeration_types = [] for record in self.record_types: if record.elements[0].identifier_list[0] == "msg_type": msg_type_enumeration_types.append( record.elements[0].subtype_indication.code ) msg_type_enumeration_literals = [] for enum in self.enumeration_types: if enum.identifier in msg_type_enumeration_types: for literal in enum.literals: if literal in msg_type_enumeration_literals: raise RuntimeError( "Different msg_type enumerations may not have the same literals" ) msg_type_enumeration_literals.append(literal) if msg_type_enumeration_literals: all_msg_types_enumeration_type = CodecVHDLEnumerationType( self.identifier + "_msg_type_t", msg_type_enumeration_literals ) else: all_msg_types_enumeration_type = None return all_msg_types_enumeration_type, msg_type_enumeration_types def _generate_enumeration_codec_and_to_string_functions( self, all_msg_types_enumeration_type, msg_type_enumeration_types ): """Generate codecs and to_string functions for all enumeration data types.""" declarations = "" definitions = "" enumeration_offset = 0 for enum in self.enumeration_types + ( [all_msg_types_enumeration_type] if all_msg_types_enumeration_type is not None else [] ): if enum.identifier in msg_type_enumeration_types: offset = enumeration_offset enumeration_offset += len(enum.literals) else: offset = 0 ( new_declarations, new_definitions, ) = enum.generate_codecs_and_support_functions(offset) declarations += new_declarations definitions += new_definitions return declarations, definitions def _generate_msg_type_encoders(self): # pylint: disable=too-many-locals """Generate message type encoders for records with the initial element = msg_type. An encoder is generated for each value of the enumeration data type for msg_type. For example, if the record has two message types, read and write, and two other fields, addr and data, then two encoders, read(addr, data) and write(addr, data) will be generated. These are shorthands for encode((<read or write>, addr, data))""" declarations = "" definitions = "" enumeration_types = {} for enum in self.enumeration_types: enumeration_types[enum.identifier] = enum.literals msg_type_record_types = self._get_records_with_an_initial_msg_type_element() for record in msg_type_record_types: msg_type_values = enumeration_types.get( record.elements[0].subtype_indication.type_mark ) if msg_type_values is None: continue for value in msg_type_values: parameter_list = [] parameter_type_list = [] encoding_list = [] for element in record.elements: for identifier in element.identifier_list: if identifier != "msg_type": parameter_list.append( " constant %s : %s" % (identifier, element.subtype_indication.code) ) parameter_type_list.append( element.subtype_indication.type_mark ) encoding_list.append("encode(%s)" % identifier) else: encoding_list.append( "encode(%s'(%s))" % (element.subtype_indication.code, value) ) if parameter_list == []: parameter_part = "" alias_signature = value + "[return string];" else: parameter_part = " (\n" + ";\n".join(parameter_list) + ")" alias_signature = ( value + "[" + ", ".join(parameter_type_list) + " return string];" ) encodings = " & ".join(encoding_list) declarations += self._template.msg_type_record_codec_declaration.substitute( name=value, parameter_part=parameter_part, alias_signature=alias_signature, alias_name=value + "_msg", ) definitions += self._template.msg_type_record_codec_definition.substitute( name=value, parameter_part=parameter_part, num_of_encodings=len(encoding_list), encodings=encodings, ) return declarations, definitions def _generate_get_functions(self): """Generate a get function which will return the message type for records""" declarations = "" definitions = "" msg_type_record_types = self._get_records_with_an_initial_msg_type_element() msg_type_types = [] for record in msg_type_record_types: msg_type_type = record.elements[0].subtype_indication.code if msg_type_type not in msg_type_types: msg_type_types.append(msg_type_type) declarations += self._template.get_specific_msg_type_declaration.substitute( type=msg_type_type ) definitions += self._template.get_specific_msg_type_definition.substitute( type=msg_type_type ) return declarations, definitions def _get_records_with_an_initial_msg_type_element(self): """Find all record types starting with a msg_type element""" msg_type_record_types = [] for record in self.record_types: if record.elements[0].identifier_list[0] == "msg_type": msg_type_record_types.append(record) return msg_type_record_types class PackageCodecTemplate(object): """This class contains package codec templates.""" msg_type_record_codec_declaration = Template( """\ function $name$parameter_part return string; alias $alias_name is $alias_signature """ ) get_specific_msg_type_declaration = Template( """\ function get_$type ( constant code : string) return $type; """ ) all_msg_types_enumeration_type_declaration = Template( """\ type $identifier is ($literals); """ ) get_msg_type_declaration = Template( """\ function get_msg_type ( constant code : string) return $type; """ ) msg_type_record_codec_definition = Template( """\ function $name$parameter_part return string is begin return $encodings; end function $name; """ ) get_specific_msg_type_definition = Template( """\ function get_$type ( constant code : string) return $type is begin return decode(code); end; """ ) get_msg_type_definition = Template( """\ function get_msg_type ( constant code : string) return $type is begin return decode(code); end; """ )
[ 1, 396, 910, 7562, 5920, 3812, 338, 4967, 304, 278, 4958, 310, 278, 18129, 2911, 5236, 13, 29937, 19245, 29892, 325, 29889, 29871, 29906, 29889, 29900, 29889, 960, 263, 3509, 310, 278, 341, 7390, 471, 451, 13235, 411, 445, 934, 29892, 13, 29937, 887, 508, 4017, 697, 472, 1732, 597, 13025, 29889, 990, 29914, 3580, 29931, 29914, 29906, 29889, 29900, 6294, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29946, 29899, 29906, 29900, 29906, 29900, 29892, 529, 5813, 29958, 529, 26862, 6227, 29958, 13, 13, 15945, 29908, 13, 7355, 6943, 278, 5920, 29883, 29963, 26124, 13208, 2229, 770, 29889, 13, 15945, 29908, 13, 3166, 1347, 1053, 25663, 13, 3166, 325, 5441, 29889, 29894, 29882, 11671, 29918, 16680, 1053, 478, 26124, 13208, 2229, 13, 3166, 325, 5441, 29889, 29894, 29882, 11671, 29918, 16680, 1053, 3349, 29918, 21032, 13, 3166, 325, 5441, 29889, 510, 29889, 401, 29883, 29918, 29894, 29882, 11671, 29918, 264, 4680, 362, 29918, 1853, 1053, 5920, 29883, 29963, 26124, 1307, 8058, 362, 1542, 13, 3166, 325, 5441, 29889, 510, 29889, 401, 29883, 29918, 29894, 29882, 11671, 29918, 2378, 29918, 1853, 1053, 5920, 29883, 29963, 29950, 19558, 2588, 1542, 13, 3166, 325, 5441, 29889, 510, 29889, 401, 29883, 29918, 29894, 29882, 11671, 29918, 11651, 29918, 1853, 1053, 5920, 29883, 29963, 29950, 19558, 9182, 1542, 13, 13, 13, 1990, 5920, 29883, 29963, 26124, 13208, 2229, 29898, 29963, 26124, 13208, 2229, 1125, 13, 1678, 9995, 2385, 10723, 515, 478, 26124, 13208, 2229, 304, 3867, 775, 29883, 15299, 9863, 363, 278, 848, 4072, 7403, 1000, 13, 1678, 297, 278, 3577, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 15882, 29892, 22447, 362, 29918, 8768, 29892, 2407, 29918, 8768, 29892, 1409, 29918, 8768, 1125, 13, 4706, 2428, 29898, 3399, 29883, 29963, 26124, 13208, 2229, 29892, 1583, 467, 1649, 2344, 12035, 13, 9651, 15882, 29892, 22447, 362, 29918, 8768, 29892, 2407, 29918, 8768, 29892, 1409, 29918, 8768, 13, 4706, 1723, 13, 4706, 1583, 3032, 6886, 353, 6213, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 6088, 29898, 25932, 29892, 775, 1125, 13, 4706, 9995, 13, 4706, 7106, 263, 716, 478, 26124, 13208, 2229, 2777, 363, 263, 2323, 3577, 1476, 2629, 278, 775, 13, 4706, 9995, 13, 4706, 775, 353, 3349, 29918, 21032, 29898, 401, 467, 13609, 580, 13, 4706, 736, 1067, 29879, 29898, 13, 9651, 1067, 29879, 3032, 5113, 29918, 2962, 29918, 276, 29889, 4352, 29898, 401, 467, 2972, 703, 333, 4968, 13, 9651, 1051, 29898, 3399, 29883, 29963, 26124, 1307, 8058, 362, 1542, 29889, 2886, 29898, 401, 8243, 13, 9651, 1051, 29898, 3399, 29883, 29963, 29950, 19558, 9182, 1542, 29889, 2886, 29898, 401, 8243, 13, 9651, 1051, 29898, 3399, 29883, 29963, 29950, 19558, 2588, 1542, 29889, 2886, 29898, 401, 8243, 13, 4706, 1723, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1284, 29918, 17514, 29918, 5113, 29898, 25932, 29892, 775, 29892, 1024, 1125, 13, 4706, 9995, 12542, 322, 736, 278, 4257, 3577, 297, 278, 775, 313, 361, 372, 4864, 5513, 15945, 13, 13, 4706, 363, 3577, 297, 1067, 29879, 29889, 2886, 29898, 401, 1125, 13, 9651, 565, 3577, 29889, 25378, 1275, 1024, 29901, 13, 18884, 736, 3577, 13, 13, 4706, 736, 6213, 13, 13, 1678, 822, 5706, 29918, 401, 2395, 29918, 392, 29918, 5924, 29918, 12171, 29898, 1311, 1125, 13, 4706, 9995, 5631, 403, 775, 2395, 322, 12084, 2304, 3168, 363, 278, 848, 4072, 3342, 297, 1583, 1213, 15945, 13, 13, 4706, 1583, 3032, 6886, 353, 22029, 3399, 29883, 6733, 580, 13, 13, 4706, 28721, 353, 5124, 13, 4706, 15848, 353, 5124, 13, 13, 4706, 396, 14164, 13, 4706, 313, 13, 9651, 716, 29918, 311, 16544, 800, 29892, 13, 9651, 716, 29918, 25476, 2187, 29892, 13, 4706, 1723, 353, 1583, 3032, 17158, 29918, 11651, 29918, 401, 29883, 29918, 392, 29918, 517, 29918, 1807, 29918, 12171, 580, 13, 4706, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 4706, 15848, 4619, 716, 29918, 25476, 2187, 13, 13, 4706, 716, 29918, 311, 16544, 800, 29892, 716, 29918, 25476, 2187, 353, 1583, 3032, 17158, 29918, 7645, 29918, 1853, 29918, 3977, 397, 414, 580, 13, 4706, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 4706, 15848, 4619, 716, 29918, 25476, 2187, 13, 13, 4706, 716, 29918, 311, 16544, 800, 29892, 716, 29918, 25476, 2187, 353, 1583, 3032, 17158, 29918, 657, 29918, 12171, 580, 13, 4706, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 4706, 15848, 4619, 716, 29918, 25476, 2187, 13, 13, 4706, 396, 1174, 4680, 800, 13, 4706, 313, 13, 9651, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29892, 13, 9651, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 29892, 13, 4706, 1723, 353, 1583, 3032, 3258, 29918, 264, 4680, 362, 29918, 974, 29918, 497, 29918, 7645, 29918, 8768, 580, 13, 4706, 565, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 338, 451, 6213, 29901, 13, 9651, 28721, 4619, 1583, 3032, 6886, 29889, 497, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29918, 311, 16544, 362, 29889, 22492, 12356, 29898, 13, 18884, 15882, 29922, 497, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29889, 25378, 29892, 13, 18884, 4631, 1338, 543, 29892, 11393, 7122, 29898, 497, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29889, 20889, 1338, 511, 13, 9651, 1723, 13, 13, 4706, 565, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 338, 451, 6213, 29901, 13, 9651, 28721, 4619, 1583, 3032, 6886, 29889, 657, 29918, 7645, 29918, 1853, 29918, 311, 16544, 362, 29889, 22492, 12356, 29898, 13, 18884, 1134, 29922, 497, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29889, 25378, 13, 9651, 1723, 13, 9651, 15848, 4619, 1583, 3032, 6886, 29889, 657, 29918, 7645, 29918, 1853, 29918, 16553, 29889, 22492, 12356, 29898, 13, 18884, 1134, 29922, 497, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29889, 25378, 13, 9651, 1723, 13, 13, 4706, 313, 13, 9651, 716, 29918, 311, 16544, 800, 29892, 13, 9651, 716, 29918, 25476, 2187, 29892, 13, 4706, 1723, 353, 1583, 3032, 17158, 29918, 264, 4680, 362, 29918, 401, 29883, 29918, 392, 29918, 517, 29918, 1807, 29918, 12171, 29898, 13, 9651, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29892, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 13, 4706, 1723, 13, 4706, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 4706, 15848, 4619, 716, 29918, 25476, 2187, 13, 13, 4706, 396, 4398, 29879, 13, 4706, 313, 13, 9651, 716, 29918, 311, 16544, 800, 29892, 13, 9651, 716, 29918, 25476, 2187, 29892, 13, 4706, 1723, 353, 1583, 3032, 17158, 29918, 2378, 29918, 401, 29883, 29918, 392, 29918, 517, 29918, 1807, 29918, 12171, 580, 13, 4706, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 4706, 15848, 4619, 716, 29918, 25476, 2187, 13, 13, 4706, 736, 28721, 29892, 15848, 13, 13, 1678, 822, 903, 17158, 29918, 11651, 29918, 401, 29883, 29918, 392, 29918, 517, 29918, 1807, 29918, 12171, 29898, 1311, 1125, 13, 4706, 9995, 5631, 403, 775, 2395, 322, 304, 29918, 1807, 3168, 363, 599, 2407, 848, 4072, 1213, 15945, 13, 13, 4706, 28721, 353, 5124, 13, 4706, 15848, 353, 5124, 13, 4706, 363, 2407, 297, 1583, 29889, 11651, 29918, 8768, 29901, 13, 9651, 313, 13, 18884, 716, 29918, 311, 16544, 800, 29892, 13, 18884, 716, 29918, 25476, 2187, 29892, 13, 9651, 1723, 353, 2407, 29889, 17158, 29918, 401, 2395, 29918, 392, 29918, 5924, 29918, 12171, 580, 13, 9651, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 9651, 15848, 4619, 716, 29918, 25476, 2187, 13, 4706, 736, 28721, 29892, 15848, 13, 13, 1678, 822, 903, 17158, 29918, 2378, 29918, 401, 29883, 29918, 392, 29918, 517, 29918, 1807, 29918, 12171, 29898, 1311, 1125, 13, 4706, 9995, 5631, 403, 775, 2395, 322, 304, 29918, 1807, 3168, 363, 599, 1409, 848, 4072, 1213, 15945, 13, 13, 4706, 28721, 353, 5124, 13, 4706, 15848, 353, 9995, 13, 29871, 1192, 6162, 546, 740, 304, 1207, 6987, 1209, 402, 29950, 19558, 325, 29900, 29889, 29941, 29955, 13, 29871, 740, 679, 29918, 26716, 29918, 2848, 313, 4868, 9649, 29901, 1347, 1723, 736, 6043, 338, 13, 29871, 3380, 736, 9649, 29915, 2848, 29936, 1095, 29936, 13, 13, 15945, 29908, 13, 4706, 363, 1409, 297, 1583, 29889, 2378, 29918, 8768, 29901, 13, 9651, 313, 13, 18884, 716, 29918, 311, 16544, 800, 29892, 13, 18884, 716, 29918, 25476, 2187, 29892, 13, 9651, 1723, 353, 1409, 29889, 17158, 29918, 401, 2395, 29918, 392, 29918, 5924, 29918, 12171, 580, 13, 9651, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 9651, 15848, 4619, 716, 29918, 25476, 2187, 13, 13, 4706, 736, 28721, 29892, 15848, 13, 13, 1678, 822, 903, 3258, 29918, 264, 4680, 362, 29918, 974, 29918, 497, 29918, 7645, 29918, 8768, 29898, 1311, 1125, 13, 4706, 9995, 4391, 385, 22447, 362, 1134, 6943, 599, 2854, 2643, 4072, 29889, 4525, 2643, 4072, 526, 16531, 515, 13, 4706, 6475, 411, 263, 10191, 29918, 1853, 1543, 607, 756, 385, 22447, 630, 848, 1134, 1213, 15945, 13, 13, 4706, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 353, 5159, 13, 4706, 363, 2407, 297, 1583, 29889, 11651, 29918, 8768, 29901, 13, 9651, 565, 2407, 29889, 17664, 29961, 29900, 1822, 25378, 29918, 1761, 29961, 29900, 29962, 1275, 376, 7645, 29918, 1853, 1115, 13, 18884, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 29889, 4397, 29898, 13, 462, 1678, 2407, 29889, 17664, 29961, 29900, 1822, 1491, 1853, 29918, 513, 293, 362, 29889, 401, 13, 18884, 1723, 13, 13, 4706, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 20889, 1338, 353, 5159, 13, 4706, 363, 14115, 297, 1583, 29889, 264, 4680, 362, 29918, 8768, 29901, 13, 9651, 565, 14115, 29889, 25378, 297, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 29901, 13, 18884, 363, 16333, 297, 14115, 29889, 20889, 1338, 29901, 13, 462, 1678, 565, 16333, 297, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 20889, 1338, 29901, 13, 462, 4706, 12020, 24875, 2392, 29898, 13, 462, 9651, 376, 29928, 15622, 10191, 29918, 1853, 22447, 800, 1122, 451, 505, 278, 1021, 4631, 1338, 29908, 13, 462, 4706, 1723, 13, 13, 462, 1678, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 20889, 1338, 29889, 4397, 29898, 20889, 284, 29897, 13, 13, 4706, 565, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 20889, 1338, 29901, 13, 9651, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 353, 5920, 29883, 29963, 26124, 1307, 8058, 362, 1542, 29898, 13, 18884, 1583, 29889, 25378, 718, 11119, 7645, 29918, 1853, 29918, 29873, 613, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 20889, 1338, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 353, 6213, 13, 13, 4706, 736, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29892, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 13, 13, 1678, 822, 903, 17158, 29918, 264, 4680, 362, 29918, 401, 29883, 29918, 392, 29918, 517, 29918, 1807, 29918, 12171, 29898, 13, 4706, 1583, 29892, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29892, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 13, 268, 1125, 13, 4706, 9995, 5631, 403, 775, 2395, 322, 304, 29918, 1807, 3168, 363, 599, 22447, 362, 848, 4072, 1213, 15945, 13, 13, 4706, 28721, 353, 5124, 13, 4706, 15848, 353, 5124, 13, 4706, 22447, 362, 29918, 10289, 353, 29871, 29900, 13, 4706, 363, 14115, 297, 1583, 29889, 264, 4680, 362, 29918, 8768, 718, 313, 13, 9651, 518, 497, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29962, 13, 9651, 565, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 338, 451, 6213, 13, 9651, 1683, 5159, 13, 308, 1125, 13, 13, 9651, 565, 14115, 29889, 25378, 297, 10191, 29918, 1853, 29918, 264, 4680, 362, 29918, 8768, 29901, 13, 18884, 9210, 353, 22447, 362, 29918, 10289, 13, 18884, 22447, 362, 29918, 10289, 4619, 7431, 29898, 18605, 29889, 20889, 1338, 29897, 13, 9651, 1683, 29901, 13, 18884, 9210, 353, 29871, 29900, 13, 13, 9651, 313, 13, 18884, 716, 29918, 311, 16544, 800, 29892, 13, 18884, 716, 29918, 25476, 2187, 29892, 13, 9651, 1723, 353, 14115, 29889, 17158, 29918, 401, 2395, 29918, 392, 29918, 5924, 29918, 12171, 29898, 10289, 29897, 13, 9651, 28721, 4619, 716, 29918, 311, 16544, 800, 13, 9651, 15848, 4619, 716, 29918, 25476, 2187, 13, 13, 4706, 736, 28721, 29892, 15848, 13, 13, 1678, 822, 903, 17158, 29918, 7645, 29918, 1853, 29918, 3977, 397, 414, 29898, 1311, 1125, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 2997, 29879, 13, 4706, 9995, 5631, 403, 2643, 1134, 2094, 397, 414, 363, 6475, 411, 278, 2847, 1543, 353, 10191, 29918, 1853, 29889, 530, 2094, 6119, 338, 13, 4706, 5759, 363, 1269, 995, 310, 278, 22447, 362, 848, 1134, 363, 10191, 29918, 1853, 29889, 1152, 1342, 29892, 565, 278, 2407, 13, 4706, 756, 1023, 2643, 4072, 29892, 1303, 322, 2436, 29892, 322, 1023, 916, 4235, 29892, 28915, 322, 848, 29892, 769, 1023, 2094, 397, 414, 29892, 13, 4706, 1303, 29898, 10030, 29892, 848, 29897, 322, 2436, 29898, 10030, 29892, 848, 29897, 674, 367, 5759, 29889, 4525, 526, 528, 2072, 4167, 363, 13, 4706, 19750, 3552, 29966, 949, 470, 2436, 10202, 28915, 29892, 848, 876, 15945, 29908, 13, 13, 4706, 28721, 353, 5124, 13, 4706, 15848, 353, 5124, 13, 13, 4706, 22447, 362, 29918, 8768, 353, 6571, 13, 4706, 363, 14115, 297, 1583, 29889, 264, 4680, 362, 29918, 8768, 29901, 13, 9651, 22447, 362, 29918, 8768, 29961, 18605, 29889, 25378, 29962, 353, 14115, 29889, 20889, 1338, 13, 13, 4706, 10191, 29918, 1853, 29918, 11651, 29918, 8768, 353, 1583, 3032, 657, 29918, 3757, 4339, 29918, 2541, 29918, 273, 29918, 11228, 29918, 7645, 29918, 1853, 29918, 5029, 580, 13, 13, 4706, 363, 2407, 297, 10191, 29918, 1853, 29918, 11651, 29918, 8768, 29901, 13, 9651, 10191, 29918, 1853, 29918, 5975, 353, 22447, 362, 29918, 8768, 29889, 657, 29898, 13, 18884, 2407, 29889, 17664, 29961, 29900, 1822, 1491, 1853, 29918, 513, 293, 362, 29889, 1853, 29918, 3502, 13, 9651, 1723, 13, 13, 9651, 565, 10191, 29918, 1853, 29918, 5975, 338, 6213, 29901, 13, 18884, 6773, 13, 13, 9651, 363, 995, 297, 10191, 29918, 1853, 29918, 5975, 29901, 13, 18884, 3443, 29918, 1761, 353, 5159, 13, 18884, 3443, 29918, 1853, 29918, 1761, 353, 5159, 13, 18884, 8025, 29918, 1761, 353, 5159, 13, 18884, 363, 1543, 297, 2407, 29889, 17664, 29901, 13, 462, 1678, 363, 15882, 297, 1543, 29889, 25378, 29918, 1761, 29901, 13, 462, 4706, 565, 15882, 2804, 376, 7645, 29918, 1853, 1115, 13, 462, 9651, 3443, 29918, 1761, 29889, 4397, 29898, 13, 462, 18884, 376, 1678, 4868, 1273, 29879, 584, 1273, 29879, 29908, 13, 462, 18884, 1273, 313, 25378, 29892, 1543, 29889, 1491, 1853, 29918, 513, 293, 362, 29889, 401, 29897, 13, 462, 9651, 1723, 13, 462, 9651, 3443, 29918, 1853, 29918, 1761, 29889, 4397, 29898, 13, 462, 18884, 1543, 29889, 1491, 1853, 29918, 513, 293, 362, 29889, 1853, 29918, 3502, 13, 462, 9651, 1723, 13, 462, 9651, 8025, 29918, 1761, 29889, 4397, 703, 12508, 29414, 29879, 5513, 1273, 15882, 29897, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 8025, 29918, 1761, 29889, 4397, 29898, 13, 462, 18884, 376, 12508, 29414, 29879, 12215, 29995, 29879, 876, 29908, 13, 462, 18884, 1273, 313, 5029, 29889, 1491, 1853, 29918, 513, 293, 362, 29889, 401, 29892, 995, 29897, 13, 462, 9651, 1723, 13, 13, 18884, 565, 3443, 29918, 1761, 1275, 5159, 29901, 13, 462, 1678, 3443, 29918, 1595, 353, 5124, 13, 462, 1678, 13995, 29918, 4530, 1535, 353, 995, 718, 14704, 2457, 1347, 1385, 29908, 13, 18884, 1683, 29901, 13, 462, 1678, 3443, 29918, 1595, 353, 376, 3441, 29876, 29908, 718, 376, 10436, 29876, 1642, 7122, 29898, 15501, 29918, 1761, 29897, 718, 376, 5513, 13, 462, 1678, 13995, 29918, 4530, 1535, 353, 313, 13, 462, 4706, 995, 13, 462, 4706, 718, 376, 3366, 13, 462, 4706, 718, 9162, 11393, 7122, 29898, 15501, 29918, 1853, 29918, 1761, 29897, 13, 462, 4706, 718, 376, 736, 1347, 1385, 29908, 13, 462, 1678, 1723, 13, 13, 18884, 2094, 397, 886, 353, 376, 669, 11393, 7122, 29898, 22331, 29918, 1761, 29897, 13, 13, 18884, 28721, 4619, 1583, 3032, 6886, 29889, 7645, 29918, 1853, 29918, 11651, 29918, 401, 29883, 29918, 311, 16544, 362, 29889, 22492, 12356, 29898, 13, 462, 1678, 1024, 29922, 1767, 29892, 13, 462, 1678, 3443, 29918, 1595, 29922, 15501, 29918, 1595, 29892, 13, 462, 1678, 13995, 29918, 4530, 1535, 29922, 19973, 29918, 4530, 1535, 29892, 13, 462, 1678, 13995, 29918, 978, 29922, 1767, 718, 11119, 7645, 613, 13, 18884, 1723, 13, 18884, 15848, 4619, 1583, 3032, 6886, 29889, 7645, 29918, 1853, 29918, 11651, 29918, 401, 29883, 29918, 16553, 29889, 22492, 12356, 29898, 13, 462, 1678, 1024, 29922, 1767, 29892, 13, 462, 1678, 3443, 29918, 1595, 29922, 15501, 29918, 1595, 29892, 13, 462, 1678, 954, 29918, 974, 29918, 3977, 397, 886, 29922, 2435, 29898, 22331, 29918, 1761, 511, 13, 462, 1678, 2094, 397, 886, 29922, 3977, 397, 886, 29892, 13, 18884, 1723, 13, 13, 4706, 736, 28721, 29892, 15848, 13, 13, 1678, 822, 903, 17158, 29918, 657, 29918, 12171, 29898, 1311, 1125, 13, 4706, 9995, 5631, 403, 263, 679, 740, 607, 674, 736, 278, 2643, 1134, 363, 6475, 15945, 29908, 13, 13, 4706, 28721, 353, 5124, 13, 4706, 15848, 353, 5124, 13, 13, 4706, 10191, 29918, 1853, 29918, 11651, 29918, 8768, 353, 1583, 3032, 657, 29918, 3757, 4339, 29918, 2541, 29918, 273, 29918, 11228, 29918, 7645, 29918, 1853, 29918, 5029, 580, 13, 4706, 10191, 29918, 1853, 29918, 8768, 353, 5159, 13, 4706, 363, 2407, 297, 10191, 29918, 1853, 29918, 11651, 29918, 8768, 29901, 13, 9651, 10191, 29918, 1853, 29918, 1853, 353, 2407, 29889, 17664, 29961, 29900, 1822, 1491, 1853, 29918, 513, 293, 362, 29889, 401, 13, 9651, 565, 10191, 29918, 1853, 29918, 1853, 451, 297, 10191, 29918, 1853, 29918, 8768, 29901, 13, 18884, 10191, 29918, 1853, 29918, 8768, 29889, 4397, 29898, 7645, 29918, 1853, 29918, 1853, 29897, 13, 18884, 28721, 4619, 1583, 3032, 6886, 29889, 657, 29918, 14940, 29918, 7645, 29918, 1853, 29918, 311, 16544, 362, 29889, 22492, 12356, 29898, 13, 462, 1678, 1134, 29922, 7645, 29918, 1853, 29918, 1853, 13, 18884, 1723, 13, 18884, 15848, 4619, 1583, 3032, 6886, 29889, 657, 29918, 14940, 29918, 7645, 29918, 1853, 29918, 16553, 29889, 22492, 12356, 29898, 13, 462, 1678, 1134, 29922, 7645, 29918, 1853, 29918, 1853, 13, 18884, 1723, 13, 13, 4706, 736, 28721, 29892, 15848, 13, 13, 1678, 822, 903, 657, 29918, 3757, 4339, 29918, 2541, 29918, 273, 29918, 11228, 29918, 7645, 29918, 1853, 29918, 5029, 29898, 1311, 1125, 13, 4706, 9995, 12542, 599, 2407, 4072, 6257, 411, 263, 10191, 29918, 1853, 1543, 15945, 29908, 13, 13, 4706, 10191, 29918, 1853, 29918, 11651, 29918, 8768, 353, 5159, 13, 4706, 363, 2407, 297, 1583, 29889, 11651, 29918, 8768, 29901, 13, 9651, 565, 2407, 29889, 17664, 29961, 29900, 1822, 25378, 29918, 1761, 29961, 29900, 29962, 1275, 376, 7645, 29918, 1853, 1115, 13, 18884, 10191, 29918, 1853, 29918, 11651, 29918, 8768, 29889, 4397, 29898, 11651, 29897, 13, 13, 4706, 736, 10191, 29918, 1853, 29918, 11651, 29918, 8768, 13, 13, 13, 1990, 22029, 3399, 29883, 6733, 29898, 3318, 1125, 13, 1678, 9995, 4013, 770, 3743, 3577, 775, 29883, 17475, 1213, 15945, 13, 13, 1678, 10191, 29918, 1853, 29918, 11651, 29918, 401, 29883, 29918, 311, 16544, 362, 353, 25663, 29898, 13, 4706, 9995, 29905, 13, 29871, 740, 395, 978, 29938, 15501, 29918, 1595, 13, 1678, 736, 1347, 29936, 13, 29871, 13995, 395, 19973, 29918, 978, 338, 395, 19973, 29918, 4530, 1535, 13, 13, 15945, 29908, 13, 1678, 1723, 13, 13, 1678, 679, 29918, 14940, 29918, 7645, 29918, 1853, 29918, 311, 16544, 362, 353, 25663, 29898, 13, 4706, 9995, 29905, 13, 29871, 740, 679, 29918, 29938, 1853, 313, 13, 1678, 4868, 775, 584, 1347, 29897, 13, 1678, 736, 395, 1853, 29936, 13, 13, 15945, 29908, 13, 1678, 1723, 13, 13, 1678, 599, 29918, 7645, 29918, 8768, 29918, 264, 4680, 362, 29918, 1853, 29918, 311, 16544, 362, 353, 25663, 29898, 13, 4706, 9995, 29905, 13, 29871, 1134, 395, 25378, 338, 3255, 20889, 1338, 416, 13, 15945, 29908, 13, 1678, 1723, 13, 13, 1678, 679, 29918, 7645, 29918, 1853, 29918, 311, 16544, 362, 353, 25663, 29898, 13, 4706, 9995, 29905, 13, 29871, 740, 679, 29918, 7645, 29918, 1853, 313, 13, 1678, 4868, 775, 584, 1347, 29897, 13, 1678, 736, 395, 1853, 29936, 13, 13, 15945, 29908, 13, 1678, 1723, 13, 13, 1678, 10191, 29918, 1853, 29918, 11651, 29918, 401, 29883, 29918, 16553, 353, 25663, 29898, 13, 4706, 9995, 29905, 13, 29871, 740, 395, 978, 29938, 15501, 29918, 1595, 13, 1678, 736, 1347, 338, 13, 29871, 3380, 13, 1678, 736, 395, 3977, 397, 886, 29936, 13, 29871, 1095, 740, 395, 978, 29936, 13, 13, 15945, 29908, 13, 1678, 1723, 13, 13, 1678, 679, 29918, 14940, 29918, 7645, 29918, 1853, 29918, 16553, 353, 25663, 29898, 13, 4706, 9995, 29905, 13, 29871, 740, 679, 29918, 29938, 1853, 313, 13, 1678, 4868, 775, 584, 1347, 29897, 13, 1678, 736, 395, 1853, 338, 13, 29871, 3380, 13, 1678, 736, 21822, 29898, 401, 416, 13, 29871, 1095, 29936, 13, 13, 15945, 29908, 13, 1678, 1723, 13, 13, 1678, 679, 29918, 7645, 29918, 1853, 29918, 16553, 353, 25663, 29898, 13, 4706, 9995, 29905, 13, 29871, 740, 679, 29918, 7645, 29918, 1853, 313, 13, 1678, 4868, 775, 584, 1347, 29897, 13, 1678, 736, 395, 1853, 338, 13, 29871, 3380, 13, 1678, 736, 21822, 29898, 401, 416, 13, 29871, 1095, 29936, 13, 13, 15945, 29908, 13, 1678, 1723, 13, 2 ]
pyga/candidate_factory/bit_string.py
Eyjafjallajokull/pyga
0
141669
from .candidate_factory import CandidateFactory from ..candidate import Candidate class BitStringFactory(CandidateFactory): """ Generates candidates with data represented by fixed-length binary strings. :param random: Random number generator :param size: int length of strings to generate """ def __init__(self, random, size): super().__init__(random) self.size = size def create_candidate(self): """ Creates Candidate instance and randomly generates its bit string data. :return: Candidate """ candidate = Candidate() candidate.data = ''.join([str(round(self.random.float())) for _ in range(self.size)]) return candidate
[ 1, 515, 869, 29883, 5380, 403, 29918, 14399, 1053, 315, 5380, 403, 5126, 13, 3166, 6317, 29883, 5380, 403, 1053, 315, 5380, 403, 13, 13, 13, 1990, 18531, 1231, 5126, 29898, 29907, 5380, 403, 5126, 1125, 13, 1678, 9995, 13, 1678, 3251, 1078, 21669, 411, 848, 9875, 491, 4343, 29899, 2848, 7581, 6031, 29889, 13, 13, 1678, 584, 3207, 4036, 29901, 16968, 1353, 15299, 13, 1678, 584, 3207, 2159, 29901, 938, 3309, 310, 6031, 304, 5706, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4036, 29892, 2159, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 8172, 29897, 13, 4706, 1583, 29889, 2311, 353, 2159, 13, 13, 1678, 822, 1653, 29918, 29883, 5380, 403, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 6760, 1078, 315, 5380, 403, 2777, 322, 20459, 16785, 967, 2586, 1347, 848, 29889, 13, 13, 4706, 584, 2457, 29901, 315, 5380, 403, 13, 4706, 9995, 13, 4706, 14020, 353, 315, 5380, 403, 580, 13, 4706, 14020, 29889, 1272, 353, 525, 4286, 7122, 4197, 710, 29898, 14486, 29898, 1311, 29889, 8172, 29889, 7411, 22130, 363, 903, 297, 3464, 29898, 1311, 29889, 2311, 29897, 2314, 13, 4706, 736, 14020, 13, 2 ]
src/WatchDbg/core/watch.py
Tekiter/WatchDBG-IDA
42
181990
from WatchDbg.common import EventHandler NEXT_ID = 0 def get_next_id(): global NEXT_ID ret = NEXT_ID NEXT_ID += 1 return ret class WatchListItem(): nextid = 0 def __init__(self, address, wtype): self.address = address self.type = wtype self.name = "" self._id = get_next_id() @property def id(self): return self._id class WatchList: def __init__(self): self._watches = [] self.on_change = EventHandler() def __iter__(self): return iter(self._watches) def __len__(self): return len(self._watches) def add(self, address, name, type): item = WatchListItem(address, type) item.name = name self._watches.append(item) self.on_change.notify() return item.id def clear(self): self._watches = [] self.on_change.notify() def exists(self, address): i = self._indexByAddress(address) return i != None def delete(self, address): i = self._indexByAddress(address) if i != None: item = self._watches.pop(i) self.on_change.notify() return item return None def get(self, address): idx = self._indexByAddress(address) if idx != None: return self._watches[idx] return None def _indexByAddress(self, address): for idx, watch in enumerate(self._watches): if watch.address == address: return idx return None
[ 1, 515, 24274, 10234, 29887, 29889, 9435, 1053, 6864, 4598, 13, 13, 29940, 12194, 29918, 1367, 353, 29871, 29900, 13, 13, 13, 1753, 679, 29918, 4622, 29918, 333, 7295, 13, 1678, 5534, 405, 12194, 29918, 1367, 13, 1678, 3240, 353, 405, 12194, 29918, 1367, 13, 1678, 405, 12194, 29918, 1367, 4619, 29871, 29896, 13, 1678, 736, 3240, 13, 13, 13, 1990, 24274, 27490, 7295, 13, 1678, 2446, 333, 353, 29871, 29900, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3211, 29892, 281, 1853, 1125, 13, 4706, 1583, 29889, 7328, 353, 3211, 13, 4706, 1583, 29889, 1853, 353, 281, 1853, 13, 4706, 1583, 29889, 978, 353, 5124, 13, 4706, 1583, 3032, 333, 353, 679, 29918, 4622, 29918, 333, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1178, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 333, 13, 13, 13, 1990, 24274, 1293, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 3032, 12344, 267, 353, 5159, 13, 4706, 1583, 29889, 265, 29918, 3167, 353, 6864, 4598, 580, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 736, 4256, 29898, 1311, 3032, 12344, 267, 29897, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 3032, 12344, 267, 29897, 13, 13, 1678, 822, 788, 29898, 1311, 29892, 3211, 29892, 1024, 29892, 1134, 1125, 13, 4706, 2944, 353, 24274, 27490, 29898, 7328, 29892, 1134, 29897, 13, 4706, 2944, 29889, 978, 353, 1024, 13, 13, 4706, 1583, 3032, 12344, 267, 29889, 4397, 29898, 667, 29897, 13, 4706, 1583, 29889, 265, 29918, 3167, 29889, 25140, 580, 13, 4706, 736, 2944, 29889, 333, 13, 13, 1678, 822, 2821, 29898, 1311, 1125, 13, 4706, 1583, 3032, 12344, 267, 353, 5159, 13, 4706, 1583, 29889, 265, 29918, 3167, 29889, 25140, 580, 13, 13, 1678, 822, 4864, 29898, 1311, 29892, 3211, 1125, 13, 4706, 474, 353, 1583, 3032, 2248, 2059, 7061, 29898, 7328, 29897, 13, 4706, 736, 474, 2804, 6213, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 3211, 1125, 13, 4706, 474, 353, 1583, 3032, 2248, 2059, 7061, 29898, 7328, 29897, 13, 4706, 565, 474, 2804, 6213, 29901, 13, 9651, 2944, 353, 1583, 3032, 12344, 267, 29889, 7323, 29898, 29875, 29897, 13, 9651, 1583, 29889, 265, 29918, 3167, 29889, 25140, 580, 13, 9651, 736, 2944, 13, 4706, 736, 6213, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 3211, 1125, 13, 4706, 22645, 353, 1583, 3032, 2248, 2059, 7061, 29898, 7328, 29897, 13, 4706, 565, 22645, 2804, 6213, 29901, 13, 9651, 736, 1583, 3032, 12344, 267, 29961, 13140, 29962, 13, 4706, 736, 6213, 13, 13, 1678, 822, 903, 2248, 2059, 7061, 29898, 1311, 29892, 3211, 1125, 13, 4706, 363, 22645, 29892, 6505, 297, 26985, 29898, 1311, 3032, 12344, 267, 1125, 13, 9651, 565, 6505, 29889, 7328, 1275, 3211, 29901, 13, 18884, 736, 22645, 13, 4706, 736, 6213, 13, 2 ]
renishawWiRE/wdfReader.py
lovaulonze/py-wdf-reader
3
123398
# Renishaw wdf Raman spectroscopy file reader # Code inspired by Henderson, Alex DOI:10.5281/zenodo.495477 from __future__ import print_function import struct import numpy import io from .types import LenType, DataType, MeasurementType from .types import ScanType, UnitType, DataType from .types import Offsets, ExifTags from .utils import convert_wl, convert_attr_name from sys import stderr try: import PIL from PIL import Image from PIL.TiffImagePlugin import IFDRational except ImportError: PIL = None class WDFReader(object): """Reader for Renishaw(TM) WiRE Raman spectroscopy files (.wdf format) The wdf file format is separated into several DataBlocks, with starting 4-char strings such as (incomplete list): `WDF1`: File header for information `DATA`: Spectra data `XLST`: Data for X-axis of data, usually the Raman shift or wavelength `YLST`: Data for Y-axis of data, possibly not important `WMAP`: Information for mapping, e.g. StreamLine or StreamLineHR mapping `MAP `: Mapping information(?) `ORGN`: Data for stage origin `TEXT`: Annotation text etc `WXDA`: ? TODO `WXDM`: ? TODO `ZLDC`: ? TODO `BKXL`: ? TODO `WXCS`: ? TODO `WXIS`: ? TODO `WHTL`: Whilte light image Following the block name, there are two indicators: Block uid: int32 Block size: int64 Args: file_name (file) : File object for the wdf file Attributes: title (str) : Title of measurement username (str) : Username application_name (str) : Default WiRE application_version (int,) * 4 : Version number, e.g. [4, 4, 0, 6602] measurement_type (int) : Type of measurement 0=unknown, 1=single, 2=multi, 3=mapping scan_type (int) : Scan of type, see values in scan_types laser_wavenumber (float32) : Wavenumber in cm^-1 count (int) : Numbers of experiments (same type), can be smaller than capacity spectral_units (int) : Unit of spectra, see unit_types xlist_type (int) : See unit_types xlist_unit (int) : See unit_types xlist_length (int): Size for the xlist xdata (numpy.array): x-axis data ylist_type (int): Same as xlist_type ylist_unit (int): Same as xlist_unit ylist_length (int): Same as xlist_length ydata (numpy.array): y-data, possibly not used point_per_spectrum (int): Should be identical to xlist_length data_origin_count (int) : Number of rows in data origin list capacity (int) : Max number of spectra accumulation_count (int) : Single or multiple measurements block_info (dict) : Info block at least with following keys DATA, XLST, YLST, ORGN # TODO types? """ def __init__(self, file_name, debug=False): try: self.file_obj = open(str(file_name), "rb") except IOError: raise IOError("File {0} does noe exist!".format(file_name)) # Initialize the properties for the wdfReader class self.title = "" self.username = "" self.measurement_type = None self.scan_type = None self.laser_length = None self.count = None self.spectral_unit = None self.xlist_type = None self.xlist_unit = None self.ylist_type = None self.ylist_unit = None self.point_per_spectrum = None self.data_origin_count = None self.capacity = None self.application_name = "" self.application_version = [None]*4 self.xlist_length = 0 self.ylist_length = 0 self.accumulation_count = None self.block_info = {} # each key has value (uid, offset, size) self.is_completed = False self.debug = debug # Parse the header section in the wdf file self.__locate_all_blocks() # Parse individual blocks self.__treat_block_data("WDF1") self.__treat_block_data("DATA") self.__treat_block_data("XLST") self.__treat_block_data("YLST") self.__treat_block_data("ORGN") self.__treat_block_data("WMAP") self.__treat_block_data("WHTL") # Reshape spectra after reading mapping information self.__reshape_spectra() # self._parse_wmap() # Finally print the information if self.debug: print(("File Metadata").center(80, "="), file=stderr) self.print_info(file=stderr) print("=" * 80, file=stderr) def close(self): self.file_obj.close() if hasattr(self, "img"): self.img.close() def __get_type_string(self, attr, data_type): """Get the enumerated-data_type as string """ val = getattr(self, attr) # No error checking if data_type is None: return val else: return data_type(val).name def __read_type(self, type, size=1): """ Unpack struct data for certain type """ if type in ["int16", "int32", "int64", "float", "double"]: if size > 1: raise NotImplementedError( "Does not support read number type with size >1") # unpack into unsigned values fmt_out = LenType["s_" + type].value fmt_in = LenType["l_" + type].value return struct.unpack(fmt_out, self.file_obj.read(fmt_in * size))[0] elif type == "utf8": # Read utf8 string with determined size block return self.file_obj.read(size).decode("utf8").replace("\x00", "") else: raise ValueError("Unknown data length format!") def __locate_single_block(self, pos): """Get block information starting at pos """ self.file_obj.seek(pos) block_name = self.file_obj.read(0x4).decode("ascii") if len(block_name) < 4: raise EOFError block_uid = self.__read_type("int32") block_size = self.__read_type("int64") return block_name, block_uid, block_size def __locate_all_blocks(self): """Get information for all data blocks and store them inside self.block_info """ curpos = 0 finished = False while not finished: try: block_name, block_uid, block_size = self.__locate_single_block( curpos) self.block_info[block_name] = (block_uid, curpos, block_size) curpos += block_size except (EOFError, UnicodeDecodeError): finished = True def __treat_block_data(self, block_name): """Get data according to specific block name """ if block_name not in self.block_info.keys(): if self.debug: print("Block name {0} not present in current measurement". format(block_name), file=stderr) return # parse individual blocks with names actions = { "WDF1": ("_parse_header", ()), "DATA": ("_parse_spectra", ()), "XLST": ("_parse_xylist", ("X")), "YLST": ("_parse_xylist", ("Y")), "ORGN": ("_parse_orgin_list", ()), "WMAP": ("_parse_wmap", ()), "WHTL": ("_parse_img", ()), } func_name, val = actions[block_name] getattr(self, func_name)(*val) # The method for reading the info in the file header def _parse_header(self): """Solve block WDF1 """ self.file_obj.seek(0) # return to the head # Must make the conversion under python3 block_ID = self.file_obj.read(Offsets.block_id).decode("ascii") block_UID = self.__read_type("int32") block_len = self.__read_type("int64") # First block must be "WDF1" if (block_ID != "WDF1") \ or (block_UID != 0 and block_UID != 1) \ or (block_len != Offsets.data_block): raise ValueError("The wdf file format is incorrect!") # TODO what are the digits in between? # The keys from the header self.file_obj.seek(Offsets.measurement_info) # space self.point_per_spectrum = self.__read_type("int32") self.capacity = self.__read_type("int64") self.count = self.__read_type("int64") # If count < capacity, this measurement is not completed self.is_completed = (self.count == self.capacity) self.accumulation_count = self.__read_type("int32") self.ylist_length = self.__read_type("int32") self.xlist_length = self.__read_type("int32") self.data_origin_count = self.__read_type("int32") self.application_name = self.__read_type("utf8", 24) # Must be "WiRE" for i in range(4): self.application_version[i] = self.__read_type("int16") self.scan_type = ScanType(self.__read_type("int32")) self.measurement_type = MeasurementType(self.__read_type("int32")) # For the units self.file_obj.seek(Offsets.spectral_info) self.spectral_unit = UnitType(self.__read_type("int32")) self.laser_length = convert_wl(self.__read_type("float")) # in nm # Username and title self.file_obj.seek(Offsets.file_info) self.username = self.__read_type("utf8", Offsets.usr_name - Offsets.file_info) self.title = self.__read_type("utf8", Offsets.data_block - Offsets.usr_name) def _parse_xylist(self, dir): """Get information from XLST or YLST blocks """ if not dir.upper() in ["X", "Y"]: raise ValueError("Direction argument `dir` must be X or Y!") name = dir.upper() + "LST" uid, pos, size = self.block_info[name] offset = Offsets.block_data self.file_obj.seek(pos + offset) setattr(self, "{0}list_type".format(dir.lower()), DataType(self.__read_type("int32"))) setattr(self, "{0}list_unit".format(dir.lower()), UnitType(self.__read_type("int32"))) size = getattr(self, "{0}list_length".format(dir.lower())) if size == 0: # Possibly not started raise ValueError("{0}-List possibly not initialized!". format(dir.upper())) # self.file_obj.seek(pos + offset) data = numpy.fromfile(self.file_obj, dtype="float32", count=size) setattr(self, "{0}data".format(dir.lower()), data) return def _parse_spectra(self, start=0, end=-1): """Get information from DATA block """ if end == -1: # take all spectra end = self.count - 1 if (start not in range(self.count)) or (end not in range(self.count)): raise ValueError("Wrong start and end indices of spectra!") if start > end: raise ValueError("Start cannot be larger than end!") # Determine start position uid, pos, size = self.block_info["DATA"] pos_start = pos + Offsets.block_data + LenType["l_float"].value * \ start * self.point_per_spectrum n_row = end - start + 1 self.file_obj.seek(pos_start) spectra_data = numpy.fromfile( self.file_obj, dtype="float32", count=n_row * self.point_per_spectrum) # if len(spectra_data.shape) > 1: # The spectra is only 1D array # spectra_data = spectra_data.reshape( # n_row, spectra_data.size // n_row) self.spectra = spectra_data return def _parse_orgin_list(self): """Get information from OriginList Set the following attributes: `self.origin_list_header`: 2D-array `self.origin_list`: origin list """ # First confirm origin list type uid, pos, size = self.block_info["ORGN"] self.origin_list_header = [[None, ] * 5 for i in range(self.data_origin_count)] # All possible to have x y and z positions! self.xpos = numpy.zeros(self.count) self.ypos = numpy.zeros(self.count) self.zpos = numpy.zeros(self.count) list_increment = Offsets.origin_increment + \ LenType.l_double.value * self.capacity curpos = pos + Offsets.origin_info for i in range(self.data_origin_count): self.file_obj.seek(curpos) p1 = self.__read_type("int32") p2 = self.__read_type("int32") s = self.__read_type("utf8", 0x10) # First index: is the list x, or y pos? self.origin_list_header[i][0] = (p1 >> 31 & 0b1) == 1 # Second: Data type of the row self.origin_list_header[i][1] = DataType(p1 & ~(0b1 << 31)) # Third: Unit self.origin_list_header[i][2] = UnitType(p2) # Fourth: annotation self.origin_list_header[i][3] = s # Last: the actual data # array = numpy.empty(self.count) # Time appears to be recorded as int64 in 100 nanosecond intervals # Possibly using the .NET DateTime epoch # Reference does not appear to be Unix Epoch time # Set time[0] = 0 until timestamp reference can be determined # Resulting array will have unit of `FileTime` in seconds if self.origin_list_header[i][1] == DataType.Time: array = numpy.array([self.__read_type("int64") for i in range(self.count)]) / 1e7 array = array - array[0] else: array = numpy.array([self.__read_type("double") for i in range(self.count)]) self.origin_list_header[i][4] = array # Set self.xpos or self.ypos if self.origin_list_header[i][1] == DataType.Spatial_X: self.xpos = array self.xpos_unit = self.origin_list_header[i][2] elif self.origin_list_header[i][1] == DataType.Spatial_Y: self.ypos = array self.ypos_unit = self.origin_list_header[i][2] elif self.origin_list_header[i][1] == DataType.Spatial_Z: self.zpos = array self.zpos_unit = self.origin_list_header[i][2] else: pass curpos += list_increment def _parse_wmap(self): """Get information about mapping in StreamLine and StreamLineHR """ try: uid, pos, size = self.block_info["WMAP"] except KeyError: if self.debug: print(("Current measurement does not" " contain mapping information!"), file=stderr) return self.file_obj.seek(pos + Offsets.wmap_origin) x_start = self.__read_type("float") if not numpy.isclose(x_start, self.xpos[0], rtol=1e-4): raise ValueError("WMAP Xpos is not same as in ORGN!") y_start = self.__read_type("float") if not numpy.isclose(y_start, self.ypos[0], rtol=1e-4): raise ValueError("WMAP Ypos is not same as in ORGN!") unknown1 = self.__read_type("float") x_pad = self.__read_type("float") y_pad = self.__read_type("float") unknown2 = self.__read_type("float") spectra_w = self.__read_type("int32") spectra_h = self.__read_type("int32") # Determine if the xy-grid spacing is same as in x_pad and y_pad if (len(self.xpos) > 1) and (len(self.ypos) > 1): xdist = numpy.abs(self.xpos - self.xpos[0]) ydist = numpy.abs(self.ypos - self.ypos[0]) xdist = xdist[numpy.nonzero(xdist)] ydist = ydist[numpy.nonzero(ydist)] # Get minimal non-zero padding in the grid try: x_pad_grid = numpy.min(xdist) except ValueError: x_pad_grid = 0 try: y_pad_grid = numpy.min(ydist) except ValueError: y_pad_grid = 0 self.map_shape = (spectra_w, spectra_h) self.map_info = dict(x_start=x_start, y_start=y_start, x_pad=x_pad, y_pad=y_pad, x_span=spectra_w * x_pad, y_span=spectra_h * y_pad, x_unit=self.xpos_unit, y_unit=self.ypos_unit) def _parse_img(self): """Extract the white-light JPEG image The size of while-light image is coded in its EXIF Use PIL to parse the EXIF information """ try: uid, pos, size = self.block_info["WHTL"] except KeyError: if self.debug: print("The wdf file does not contain an image", file=stderr) return # Read the bytes. `self.img` is a wrapped IO object mimicking a file self.file_obj.seek(pos + Offsets.jpeg_header) img_bytes = self.file_obj.read(size - Offsets.jpeg_header) self.img = io.BytesIO(img_bytes) # Handle image dimension if PIL is present if PIL is not None: pil_img = Image.open(self.img) # Weird missing header keys when Pillow >= 8.2.0. # see https://pillow.readthedocs.io/en/stable/releasenotes/8.2.0.html#image-getexif-exif-and-gps-ifd # Use fall-back _getexif method instead exif_header = dict(pil_img._getexif()) try: # Get the width and height of image w_ = exif_header[ExifTags.FocalPlaneXResolution] h_ = exif_header[ExifTags.FocalPlaneYResolution] x_org_, y_org_ = exif_header[ExifTags.FocalPlaneXYOrigins] def rational2float(v): """ Pillow<7.2.0 returns tuple, Pillow>=7.2.0 returns IFDRational """ if not isinstance(v, IFDRational): return v[0] / v[1] return float(v) w_, h_ = rational2float(w_), rational2float(h_) x_org_, y_org_ = rational2float(x_org_), rational2float(y_org_) # The dimensions (width, height) # with unit `img_dimension_unit` self.img_dimensions = numpy.array([w_, h_]) # Origin of image is at upper right corner self.img_origins = numpy.array([x_org_, y_org_]) # Default is microns (5) self.img_dimension_unit = UnitType( exif_header[ExifTags.FocalPlaneResolutionUnit]) # Give the box for cropping # Following the PIL manual # (left, upper, right, lower) self.img_cropbox = self.__calc_crop_box() except KeyError: if self.debug: print(("Some keys in white light image header" " cannot be read!"), file=stderr) return def __calc_crop_box(self): """Helper function to calculate crop box """ def _proportion(x, minmax, pixels): """Get proportional pixels""" min, max = minmax return int(pixels * (x - min) / (max - min)) pil_img = PIL.Image.open(self.img) w_, h_ = self.img_dimensions x0_, y0_ = self.img_origins pw = pil_img.width ph = pil_img.height map_xl = self.xpos.min() map_xr = self.xpos.max() map_yt = self.ypos.min() map_yb = self.ypos.max() left = _proportion(map_xl, (x0_, x0_ + w_), pw) right = _proportion(map_xr, (x0_, x0_ + w_), pw) top = _proportion(map_yt, (y0_, y0_ + h_), ph) bottom = _proportion(map_yb, (y0_, y0_ + h_), ph) return (left, top, right, bottom) def __reshape_spectra(self): """Reshape spectra into w * h * self.point_per_spectrum """ if not self.is_completed: if self.debug: print(("The measurement is not completed, " "will try to reshape spectra into count * pps."), file=stderr) try: self.spectra = numpy.reshape(self.spectra, (self.count, self.point_per_spectrum)) except ValueError: if self.debug: print("Reshaping spectra array failed. Please check.", file=stderr) return elif hasattr(self, "map_shape"): # Is a mapping spectra_w, spectra_h = self.map_shape if spectra_w * spectra_h != self.count: if self.debug: print(("Mapping information from WMAP not" " corresponding to ORGN! " "Will not reshape the spectra"), file=stderr) return elif spectra_w * spectra_h * self.point_per_spectrum \ != len(self.spectra): if self.debug: print(("Mapping information from WMAP" " not corresponding to DATA! " "Will not reshape the spectra"), file=stderr) return else: # Should be h rows * w columns. numpy.ndarray is row first # Reshape to 3D matrix when doing 2D mapping if (spectra_h > 1) and (spectra_w > 1): self.spectra = numpy.reshape(self.spectra, (spectra_h, spectra_w, self.point_per_spectrum)) # otherwise it is a line scan else: self.spectra = numpy.reshape(self.spectra, (self.count, self.point_per_spectrum)) # For any other type of measurement, reshape into (counts, point_per_spectrum) # example: series scan elif self.count > 1: self.spectra = numpy.reshape(self.spectra, (self.count, self.point_per_spectrum)) else: return def print_info(self, **params): """Print information of the wdf file """ s = [] s.append(u"{0:>24s}:\t{1}".format("Title", self.title)) s.append(u"{0:>17s} version:\t{1}.{2}.{3}.{4}". format(self.application_name, *self.application_version)) s.append(u"{0:>24s}:\t{1} nm".format("Laser Wavelength", self.laser_length)) for a in ("count", "capacity", "point_per_spectrum", "scan_type", "measurement_type", "spectral_unit", "xlist_unit", "xlist_length", "ylist_unit", "ylist_length", "xpos_unit", "ypos_unit"): sname = convert_attr_name(a) # Use explicit string conversion to replace try: val = str(getattr(self, a)) except AttributeError: continue s.append("{0:>24s}:\t{1}".format(sname, val)) text = u"\n".join(s) print(text, **params) if __name__ == '__main__': raise NotImplementedError("Please dont run this module as a script!")
[ 1, 396, 7493, 728, 1450, 281, 2176, 8292, 273, 6683, 307, 1557, 2270, 934, 9591, 13, 29937, 5920, 20603, 491, 17973, 1330, 29892, 4827, 11662, 29902, 29901, 29896, 29900, 29889, 29945, 29906, 29947, 29896, 29914, 2256, 8144, 29889, 29946, 29929, 29945, 29946, 29955, 29955, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 5215, 2281, 13, 5215, 12655, 13, 5215, 12013, 13, 3166, 869, 8768, 1053, 16206, 1542, 29892, 3630, 1542, 29892, 2191, 3745, 358, 1542, 13, 3166, 869, 8768, 1053, 2522, 273, 1542, 29892, 13223, 1542, 29892, 3630, 1542, 13, 3166, 869, 8768, 1053, 5947, 7224, 29892, 1222, 361, 28089, 13, 3166, 869, 13239, 1053, 3588, 29918, 29893, 29880, 29892, 3588, 29918, 5552, 29918, 978, 13, 3166, 10876, 1053, 380, 20405, 13, 2202, 29901, 13, 1678, 1053, 349, 6227, 13, 1678, 515, 349, 6227, 1053, 7084, 13, 1678, 515, 349, 6227, 29889, 29911, 2593, 2940, 16288, 1053, 10762, 8353, 1288, 13, 19499, 16032, 2392, 29901, 13, 1678, 349, 6227, 353, 6213, 13, 13, 13, 1990, 399, 4037, 6982, 29898, 3318, 1125, 13, 1678, 9995, 6982, 363, 7493, 728, 1450, 29898, 23081, 29897, 14570, 1525, 8292, 273, 6683, 307, 1557, 2270, 2066, 14544, 29893, 2176, 3402, 29897, 13, 13, 1678, 450, 281, 2176, 934, 3402, 338, 13055, 964, 3196, 3630, 7445, 29879, 29892, 411, 6257, 29871, 29946, 29899, 3090, 29871, 13, 1678, 6031, 1316, 408, 313, 262, 8835, 1051, 1125, 13, 1678, 421, 29956, 4037, 29896, 6998, 3497, 4839, 363, 2472, 13, 1678, 421, 14573, 6998, 27738, 336, 848, 13, 1678, 421, 29990, 29931, 1254, 6998, 3630, 363, 1060, 29899, 8990, 310, 848, 29892, 5491, 278, 8292, 273, 9500, 470, 281, 6447, 1477, 13, 1678, 421, 29979, 29931, 1254, 6998, 3630, 363, 612, 29899, 8990, 310, 848, 29892, 10075, 451, 4100, 13, 1678, 421, 29956, 23827, 6998, 10343, 363, 10417, 29892, 321, 29889, 29887, 29889, 13763, 3542, 470, 13763, 3542, 20938, 10417, 13, 1678, 421, 23827, 22507, 341, 20304, 2472, 29898, 7897, 13, 1678, 421, 1955, 20728, 6998, 3630, 363, 7408, 3978, 13, 1678, 421, 16975, 6998, 530, 16666, 1426, 2992, 13, 1678, 421, 29956, 29990, 7698, 6998, 1577, 14402, 13, 1678, 421, 29956, 29990, 23560, 6998, 1577, 14402, 13, 1678, 421, 29999, 10249, 29907, 6998, 1577, 14402, 13, 1678, 421, 29933, 29968, 29990, 29931, 6998, 1577, 14402, 13, 1678, 421, 29956, 29990, 9295, 6998, 1577, 14402, 13, 1678, 421, 29956, 29990, 3235, 6998, 1577, 14402, 13, 1678, 421, 29956, 3912, 29931, 6998, 806, 309, 371, 3578, 1967, 13, 13, 1678, 12206, 278, 2908, 1024, 29892, 727, 526, 1023, 4221, 4097, 29901, 13, 1678, 15658, 318, 333, 29901, 938, 29941, 29906, 13, 1678, 15658, 2159, 29901, 938, 29953, 29946, 13, 13, 1678, 826, 3174, 29901, 13, 1678, 934, 29918, 978, 313, 1445, 29897, 584, 3497, 1203, 363, 278, 281, 2176, 934, 13, 13, 1678, 6212, 5026, 29901, 13, 1678, 3611, 313, 710, 29897, 584, 18527, 310, 20039, 13, 1678, 8952, 313, 710, 29897, 584, 4911, 978, 13, 1678, 2280, 29918, 978, 313, 710, 29897, 584, 13109, 14570, 1525, 13, 1678, 2280, 29918, 3259, 313, 524, 29892, 29897, 334, 29871, 29946, 584, 10079, 1353, 29892, 321, 29889, 29887, 29889, 518, 29946, 29892, 29871, 29946, 29892, 29871, 29900, 29892, 29871, 29953, 29953, 29900, 29906, 29962, 13, 1678, 20039, 29918, 1853, 313, 524, 29897, 584, 5167, 310, 20039, 13, 462, 795, 29900, 29922, 26690, 29892, 29871, 29896, 29922, 14369, 29892, 29871, 29906, 29922, 9910, 29892, 29871, 29941, 29922, 20698, 29871, 13, 1678, 12812, 29918, 1853, 313, 524, 29897, 584, 2522, 273, 310, 1134, 29892, 1074, 1819, 297, 12812, 29918, 8768, 13, 1678, 1869, 261, 29918, 29893, 3496, 2807, 313, 7411, 29941, 29906, 29897, 584, 399, 3496, 2807, 297, 7477, 21583, 29896, 13, 1678, 2302, 313, 524, 29897, 584, 11848, 2596, 310, 15729, 313, 17642, 1134, 511, 508, 367, 7968, 1135, 13284, 13, 1678, 23161, 29918, 348, 1169, 313, 524, 29897, 584, 13223, 310, 6683, 336, 29892, 1074, 5190, 29918, 8768, 13, 1678, 921, 1761, 29918, 1853, 313, 524, 29897, 584, 2823, 5190, 29918, 8768, 13, 1678, 921, 1761, 29918, 5441, 313, 524, 29897, 584, 2823, 5190, 29918, 8768, 13, 1678, 921, 1761, 29918, 2848, 313, 524, 1125, 21179, 363, 278, 921, 1761, 13, 1678, 921, 1272, 313, 23749, 29889, 2378, 1125, 921, 29899, 8990, 848, 13, 1678, 343, 1761, 29918, 1853, 313, 524, 1125, 19491, 408, 921, 1761, 29918, 1853, 13, 1678, 343, 1761, 29918, 5441, 313, 524, 1125, 19491, 408, 921, 1761, 29918, 5441, 13, 1678, 343, 1761, 29918, 2848, 313, 524, 1125, 19491, 408, 921, 1761, 29918, 2848, 13, 1678, 343, 1272, 313, 23749, 29889, 2378, 1125, 343, 29899, 1272, 29892, 10075, 451, 1304, 13, 1678, 1298, 29918, 546, 29918, 21494, 5848, 313, 524, 1125, 10575, 367, 13557, 304, 921, 1761, 29918, 2848, 13, 1678, 848, 29918, 12574, 29918, 2798, 313, 524, 29897, 584, 9681, 310, 4206, 297, 848, 3978, 1051, 13, 1678, 13284, 313, 524, 29897, 584, 5918, 1353, 310, 6683, 336, 13, 1678, 18414, 2785, 29918, 2798, 313, 524, 29897, 584, 16740, 470, 2999, 20398, 13, 1678, 2908, 29918, 3888, 313, 8977, 29897, 584, 22140, 2908, 472, 3203, 411, 1494, 6611, 13, 462, 4706, 360, 8254, 29892, 1060, 29931, 1254, 29892, 612, 29931, 1254, 29892, 6323, 20728, 13, 462, 4706, 396, 14402, 4072, 29973, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 29918, 978, 29892, 4744, 29922, 8824, 1125, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 1445, 29918, 5415, 353, 1722, 29898, 710, 29898, 1445, 29918, 978, 511, 376, 6050, 1159, 13, 4706, 5174, 10663, 2392, 29901, 13, 9651, 12020, 10663, 2392, 703, 2283, 426, 29900, 29913, 947, 694, 29872, 1863, 29991, 1642, 4830, 29898, 1445, 29918, 978, 876, 13, 4706, 396, 25455, 278, 4426, 363, 278, 281, 2176, 6982, 770, 13, 4706, 1583, 29889, 3257, 353, 5124, 13, 4706, 1583, 29889, 6786, 353, 5124, 13, 4706, 1583, 29889, 26658, 358, 29918, 1853, 353, 6213, 13, 4706, 1583, 29889, 16192, 29918, 1853, 353, 6213, 13, 4706, 1583, 29889, 3333, 261, 29918, 2848, 353, 6213, 13, 4706, 1583, 29889, 2798, 353, 6213, 13, 4706, 1583, 29889, 21494, 1705, 29918, 5441, 353, 6213, 13, 4706, 1583, 29889, 29916, 1761, 29918, 1853, 353, 6213, 13, 4706, 1583, 29889, 29916, 1761, 29918, 5441, 353, 6213, 13, 4706, 1583, 29889, 29891, 1761, 29918, 1853, 353, 6213, 13, 4706, 1583, 29889, 29891, 1761, 29918, 5441, 353, 6213, 13, 4706, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 353, 6213, 13, 4706, 1583, 29889, 1272, 29918, 12574, 29918, 2798, 353, 6213, 13, 4706, 1583, 29889, 5030, 5946, 353, 6213, 13, 4706, 1583, 29889, 6214, 29918, 978, 353, 5124, 13, 4706, 1583, 29889, 6214, 29918, 3259, 353, 518, 8516, 14178, 29946, 13, 4706, 1583, 29889, 29916, 1761, 29918, 2848, 353, 29871, 29900, 13, 4706, 1583, 29889, 29891, 1761, 29918, 2848, 353, 29871, 29900, 13, 4706, 1583, 29889, 5753, 398, 2785, 29918, 2798, 353, 6213, 13, 4706, 1583, 29889, 1271, 29918, 3888, 353, 6571, 1678, 396, 1269, 1820, 756, 995, 313, 5416, 29892, 9210, 29892, 2159, 29897, 13, 4706, 1583, 29889, 275, 29918, 5729, 9446, 353, 7700, 13, 4706, 1583, 29889, 8382, 353, 4744, 13, 4706, 396, 20969, 278, 4839, 4004, 297, 278, 281, 2176, 934, 13, 4706, 1583, 17255, 2029, 403, 29918, 497, 29918, 1271, 29879, 580, 13, 4706, 396, 20969, 5375, 10930, 13, 4706, 1583, 17255, 2484, 271, 29918, 1271, 29918, 1272, 703, 29956, 4037, 29896, 1159, 13, 4706, 1583, 17255, 2484, 271, 29918, 1271, 29918, 1272, 703, 14573, 1159, 13, 4706, 1583, 17255, 2484, 271, 29918, 1271, 29918, 1272, 703, 29990, 29931, 1254, 1159, 13, 4706, 1583, 17255, 2484, 271, 29918, 1271, 29918, 1272, 703, 29979, 29931, 1254, 1159, 13, 4706, 1583, 17255, 2484, 271, 29918, 1271, 29918, 1272, 703, 1955, 20728, 1159, 13, 4706, 1583, 17255, 2484, 271, 29918, 1271, 29918, 1272, 703, 29956, 23827, 1159, 13, 4706, 1583, 17255, 2484, 271, 29918, 1271, 29918, 1272, 703, 29956, 3912, 29931, 1159, 13, 13, 4706, 396, 2538, 14443, 6683, 336, 1156, 5183, 10417, 2472, 13, 4706, 1583, 17255, 690, 14443, 29918, 21494, 336, 580, 13, 4706, 396, 1583, 3032, 5510, 29918, 29893, 1958, 580, 13, 13, 4706, 396, 9788, 1596, 278, 2472, 13, 4706, 565, 1583, 29889, 8382, 29901, 13, 9651, 1596, 29898, 703, 2283, 4737, 7221, 2564, 5064, 29898, 29947, 29900, 29892, 376, 543, 511, 13, 462, 29871, 934, 29922, 303, 20405, 29897, 13, 9651, 1583, 29889, 2158, 29918, 3888, 29898, 1445, 29922, 303, 20405, 29897, 13, 9651, 1596, 703, 543, 334, 29871, 29947, 29900, 29892, 934, 29922, 303, 20405, 29897, 13, 13, 1678, 822, 3802, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 5358, 580, 13, 4706, 565, 756, 5552, 29898, 1311, 29892, 376, 2492, 29908, 1125, 13, 9651, 1583, 29889, 2492, 29889, 5358, 580, 13, 13, 1678, 822, 4770, 657, 29918, 1853, 29918, 1807, 29898, 1311, 29892, 12421, 29892, 848, 29918, 1853, 1125, 13, 4706, 9995, 2577, 278, 22447, 630, 29899, 1272, 29918, 1853, 408, 1347, 13, 4706, 9995, 13, 4706, 659, 353, 679, 5552, 29898, 1311, 29892, 12421, 29897, 29871, 396, 1939, 1059, 8454, 13, 4706, 565, 848, 29918, 1853, 338, 6213, 29901, 13, 9651, 736, 659, 13, 4706, 1683, 29901, 13, 9651, 736, 848, 29918, 1853, 29898, 791, 467, 978, 13, 13, 1678, 822, 4770, 949, 29918, 1853, 29898, 1311, 29892, 1134, 29892, 2159, 29922, 29896, 1125, 13, 4706, 9995, 853, 4058, 2281, 848, 363, 3058, 1134, 13, 4706, 9995, 13, 4706, 565, 1134, 297, 6796, 524, 29896, 29953, 613, 376, 524, 29941, 29906, 613, 376, 524, 29953, 29946, 613, 376, 7411, 613, 376, 8896, 3108, 29901, 13, 9651, 565, 2159, 1405, 29871, 29896, 29901, 13, 18884, 12020, 2216, 1888, 2037, 287, 2392, 29898, 13, 462, 1678, 376, 25125, 451, 2304, 1303, 1353, 1134, 411, 2159, 1405, 29896, 1159, 13, 9651, 396, 443, 4058, 964, 12780, 1819, 13, 9651, 19200, 29918, 449, 353, 16206, 1542, 3366, 29879, 27508, 718, 1134, 1822, 1767, 13, 9651, 19200, 29918, 262, 353, 16206, 1542, 3366, 29880, 27508, 718, 1134, 1822, 1767, 13, 9651, 736, 2281, 29889, 348, 4058, 29898, 23479, 29918, 449, 29892, 1583, 29889, 1445, 29918, 5415, 29889, 949, 29898, 23479, 29918, 262, 334, 2159, 876, 29961, 29900, 29962, 13, 4706, 25342, 1134, 1275, 376, 9420, 29947, 1115, 13, 9651, 396, 7523, 23616, 29947, 1347, 411, 10087, 2159, 2908, 13, 9651, 736, 1583, 29889, 1445, 29918, 5415, 29889, 949, 29898, 2311, 467, 13808, 703, 9420, 29947, 2564, 6506, 14182, 29916, 29900, 29900, 613, 20569, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 703, 14148, 848, 3309, 3402, 29991, 1159, 13, 13, 1678, 822, 4770, 2029, 403, 29918, 14369, 29918, 1271, 29898, 1311, 29892, 926, 1125, 13, 4706, 9995, 2577, 2908, 2472, 6257, 472, 926, 13, 4706, 9995, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 1066, 29897, 13, 4706, 2908, 29918, 978, 353, 1583, 29889, 1445, 29918, 5415, 29889, 949, 29898, 29900, 29916, 29946, 467, 13808, 703, 294, 18869, 1159, 13, 4706, 565, 7431, 29898, 1271, 29918, 978, 29897, 529, 29871, 29946, 29901, 13, 9651, 12020, 382, 9800, 2392, 13, 4706, 2908, 29918, 5416, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 2908, 29918, 2311, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29953, 29946, 1159, 13, 4706, 736, 2908, 29918, 978, 29892, 2908, 29918, 5416, 29892, 2908, 29918, 2311, 13, 13, 1678, 822, 4770, 2029, 403, 29918, 497, 29918, 1271, 29879, 29898, 1311, 1125, 13, 4706, 9995, 2577, 2472, 363, 599, 848, 10930, 322, 3787, 963, 2768, 1583, 29889, 1271, 29918, 3888, 13, 4706, 9995, 13, 4706, 3151, 1066, 353, 29871, 29900, 13, 4706, 7743, 353, 7700, 13, 4706, 1550, 451, 7743, 29901, 13, 9651, 1018, 29901, 13, 18884, 2908, 29918, 978, 29892, 2908, 29918, 5416, 29892, 2908, 29918, 2311, 353, 1583, 17255, 2029, 403, 29918, 14369, 29918, 1271, 29898, 13, 462, 1678, 3151, 1066, 29897, 13, 18884, 1583, 29889, 1271, 29918, 3888, 29961, 1271, 29918, 978, 29962, 353, 313, 1271, 29918, 5416, 29892, 3151, 1066, 29892, 2908, 29918, 2311, 29897, 13, 18884, 3151, 1066, 4619, 2908, 29918, 2311, 13, 9651, 5174, 313, 29923, 9800, 2392, 29892, 23862, 2772, 401, 2392, 1125, 13, 18884, 7743, 353, 5852, 13, 13, 1678, 822, 4770, 2484, 271, 29918, 1271, 29918, 1272, 29898, 1311, 29892, 2908, 29918, 978, 1125, 13, 4706, 9995, 2577, 848, 5034, 304, 2702, 2908, 1024, 13, 4706, 9995, 13, 4706, 565, 2908, 29918, 978, 451, 297, 1583, 29889, 1271, 29918, 3888, 29889, 8149, 7295, 13, 9651, 565, 1583, 29889, 8382, 29901, 13, 18884, 1596, 703, 7445, 1024, 426, 29900, 29913, 451, 2198, 297, 1857, 20039, 1642, 13, 462, 418, 3402, 29898, 1271, 29918, 978, 511, 934, 29922, 303, 20405, 29897, 13, 9651, 736, 13, 4706, 396, 6088, 5375, 10930, 411, 2983, 13, 4706, 8820, 353, 426, 13, 9651, 376, 29956, 4037, 29896, 1115, 4852, 29918, 5510, 29918, 6672, 613, 3861, 511, 13, 9651, 376, 14573, 1115, 4852, 29918, 5510, 29918, 21494, 336, 613, 3861, 511, 13, 9651, 376, 29990, 29931, 1254, 1115, 4852, 29918, 5510, 29918, 3594, 1761, 613, 4852, 29990, 1159, 511, 13, 9651, 376, 29979, 29931, 1254, 1115, 4852, 29918, 5510, 29918, 3594, 1761, 613, 4852, 29979, 1159, 511, 13, 9651, 376, 1955, 20728, 1115, 4852, 29918, 5510, 29918, 990, 262, 29918, 1761, 613, 3861, 511, 13, 9651, 376, 29956, 23827, 1115, 4852, 29918, 5510, 29918, 29893, 1958, 613, 3861, 511, 13, 9651, 376, 29956, 3912, 29931, 1115, 4852, 29918, 5510, 29918, 2492, 613, 3861, 511, 13, 4706, 500, 13, 4706, 3653, 29918, 978, 29892, 659, 353, 8820, 29961, 1271, 29918, 978, 29962, 13, 4706, 679, 5552, 29898, 1311, 29892, 3653, 29918, 978, 5033, 29930, 791, 29897, 13, 13, 1678, 396, 450, 1158, 363, 5183, 278, 5235, 297, 278, 934, 4839, 13, 13, 1678, 822, 903, 5510, 29918, 6672, 29898, 1311, 1125, 13, 4706, 9995, 13296, 345, 2908, 399, 4037, 29896, 13, 4706, 9995, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 29900, 29897, 259, 396, 736, 304, 278, 2343, 13, 4706, 396, 19928, 1207, 278, 11301, 1090, 3017, 29941, 13, 4706, 2908, 29918, 1367, 353, 1583, 29889, 1445, 29918, 5415, 29889, 949, 29898, 6880, 7224, 29889, 1271, 29918, 333, 467, 13808, 703, 294, 18869, 1159, 13, 4706, 2908, 29918, 11150, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 2908, 29918, 2435, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29953, 29946, 1159, 13, 4706, 396, 3824, 2908, 1818, 367, 376, 29956, 4037, 29896, 29908, 13, 4706, 565, 313, 1271, 29918, 1367, 2804, 376, 29956, 4037, 29896, 1159, 320, 13, 965, 470, 313, 1271, 29918, 11150, 2804, 29871, 29900, 322, 2908, 29918, 11150, 2804, 29871, 29896, 29897, 320, 13, 965, 470, 313, 1271, 29918, 2435, 2804, 5947, 7224, 29889, 1272, 29918, 1271, 1125, 13, 9651, 12020, 7865, 2392, 703, 1576, 281, 2176, 934, 3402, 338, 10240, 29991, 1159, 13, 4706, 396, 14402, 825, 526, 278, 13340, 297, 1546, 29973, 13, 13, 4706, 396, 450, 6611, 515, 278, 4839, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 6880, 7224, 29889, 26658, 358, 29918, 3888, 29897, 29871, 396, 2913, 13, 4706, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 1583, 29889, 5030, 5946, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29953, 29946, 1159, 13, 4706, 1583, 29889, 2798, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29953, 29946, 1159, 13, 4706, 396, 960, 2302, 529, 13284, 29892, 445, 20039, 338, 451, 8676, 13, 4706, 1583, 29889, 275, 29918, 5729, 9446, 353, 313, 1311, 29889, 2798, 1275, 1583, 29889, 5030, 5946, 29897, 13, 4706, 1583, 29889, 5753, 398, 2785, 29918, 2798, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 1583, 29889, 29891, 1761, 29918, 2848, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 1583, 29889, 29916, 1761, 29918, 2848, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 1583, 29889, 1272, 29918, 12574, 29918, 2798, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 1583, 29889, 6214, 29918, 978, 353, 1583, 17255, 949, 29918, 1853, 703, 9420, 29947, 613, 29871, 29906, 29946, 29897, 29871, 396, 19928, 367, 376, 29956, 29875, 1525, 29908, 13, 4706, 363, 474, 297, 3464, 29898, 29946, 1125, 13, 9651, 1583, 29889, 6214, 29918, 3259, 29961, 29875, 29962, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29896, 29953, 1159, 13, 4706, 1583, 29889, 16192, 29918, 1853, 353, 2522, 273, 1542, 29898, 1311, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 5783, 13, 4706, 1583, 29889, 26658, 358, 29918, 1853, 353, 2191, 3745, 358, 1542, 29898, 1311, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 5783, 13, 4706, 396, 1152, 278, 10340, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 6880, 7224, 29889, 21494, 1705, 29918, 3888, 29897, 13, 4706, 1583, 29889, 21494, 1705, 29918, 5441, 353, 13223, 1542, 29898, 1311, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 5783, 13, 4706, 1583, 29889, 3333, 261, 29918, 2848, 353, 3588, 29918, 29893, 29880, 29898, 1311, 17255, 949, 29918, 1853, 703, 7411, 5783, 29871, 396, 297, 302, 29885, 13, 4706, 396, 4911, 978, 322, 3611, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 6880, 7224, 29889, 1445, 29918, 3888, 29897, 13, 4706, 1583, 29889, 6786, 353, 1583, 17255, 949, 29918, 1853, 703, 9420, 29947, 613, 13, 462, 462, 308, 5947, 7224, 29889, 4855, 29918, 978, 448, 13, 462, 462, 308, 5947, 7224, 29889, 1445, 29918, 3888, 29897, 13, 4706, 1583, 29889, 3257, 353, 1583, 17255, 949, 29918, 1853, 703, 9420, 29947, 613, 13, 462, 462, 418, 5947, 7224, 29889, 1272, 29918, 1271, 448, 13, 462, 462, 418, 5947, 7224, 29889, 4855, 29918, 978, 29897, 13, 13, 1678, 822, 903, 5510, 29918, 3594, 1761, 29898, 1311, 29892, 4516, 1125, 13, 4706, 9995, 2577, 2472, 515, 1060, 29931, 1254, 470, 612, 29931, 1254, 10930, 13, 4706, 9995, 13, 4706, 565, 451, 4516, 29889, 21064, 580, 297, 6796, 29990, 613, 376, 29979, 3108, 29901, 13, 9651, 12020, 7865, 2392, 703, 21602, 2980, 421, 3972, 29952, 1818, 367, 1060, 470, 612, 29991, 1159, 13, 4706, 1024, 353, 4516, 29889, 21064, 580, 718, 376, 29931, 1254, 29908, 13, 4706, 318, 333, 29892, 926, 29892, 2159, 353, 1583, 29889, 1271, 29918, 3888, 29961, 978, 29962, 13, 4706, 9210, 353, 5947, 7224, 29889, 1271, 29918, 1272, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 1066, 718, 9210, 29897, 13, 4706, 731, 5552, 29898, 1311, 29892, 29850, 29900, 29913, 1761, 29918, 1853, 1642, 4830, 29898, 3972, 29889, 13609, 25739, 13, 18884, 3630, 1542, 29898, 1311, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 29908, 4961, 13, 4706, 731, 5552, 29898, 1311, 29892, 29850, 29900, 29913, 1761, 29918, 5441, 1642, 4830, 29898, 3972, 29889, 13609, 25739, 13, 18884, 13223, 1542, 29898, 1311, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 29908, 4961, 13, 4706, 2159, 353, 679, 5552, 29898, 1311, 29892, 29850, 29900, 29913, 1761, 29918, 2848, 1642, 4830, 29898, 3972, 29889, 13609, 22130, 13, 4706, 565, 2159, 1275, 29871, 29900, 29901, 965, 396, 29863, 14981, 451, 4687, 13, 9651, 12020, 7865, 2392, 703, 29912, 29900, 7402, 1293, 10075, 451, 16601, 29991, 1642, 13, 462, 632, 3402, 29898, 3972, 29889, 21064, 22130, 13, 13, 4706, 396, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 1066, 718, 9210, 29897, 13, 4706, 848, 353, 12655, 29889, 3166, 1445, 29898, 1311, 29889, 1445, 29918, 5415, 29892, 26688, 543, 7411, 29941, 29906, 613, 2302, 29922, 2311, 29897, 13, 4706, 731, 5552, 29898, 1311, 29892, 29850, 29900, 29913, 1272, 1642, 4830, 29898, 3972, 29889, 13609, 25739, 848, 29897, 13, 4706, 736, 13, 13, 1678, 822, 903, 5510, 29918, 21494, 336, 29898, 1311, 29892, 1369, 29922, 29900, 29892, 1095, 10457, 29896, 1125, 13, 4706, 9995, 2577, 2472, 515, 360, 8254, 2908, 13, 4706, 9995, 13, 4706, 565, 1095, 1275, 448, 29896, 29901, 965, 396, 2125, 599, 6683, 336, 13, 9651, 1095, 353, 1583, 29889, 2798, 448, 29871, 29896, 13, 4706, 565, 313, 2962, 451, 297, 3464, 29898, 1311, 29889, 2798, 876, 470, 313, 355, 451, 297, 3464, 29898, 1311, 29889, 2798, 22164, 13, 9651, 12020, 7865, 2392, 703, 29956, 29373, 1369, 322, 1095, 16285, 310, 6683, 336, 29991, 1159, 13, 4706, 565, 1369, 1405, 1095, 29901, 13, 9651, 12020, 7865, 2392, 703, 4763, 2609, 367, 7200, 1135, 1095, 29991, 1159, 13, 13, 4706, 396, 5953, 837, 457, 1369, 2602, 13, 4706, 318, 333, 29892, 926, 29892, 2159, 353, 1583, 29889, 1271, 29918, 3888, 3366, 14573, 3108, 13, 4706, 926, 29918, 2962, 353, 926, 718, 5947, 7224, 29889, 1271, 29918, 1272, 718, 16206, 1542, 3366, 29880, 29918, 7411, 16862, 1767, 334, 320, 13, 9651, 1369, 334, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 13, 4706, 302, 29918, 798, 353, 1095, 448, 1369, 718, 29871, 29896, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 1066, 29918, 2962, 29897, 13, 4706, 6683, 336, 29918, 1272, 353, 12655, 29889, 3166, 1445, 29898, 13, 9651, 1583, 29889, 1445, 29918, 5415, 29892, 26688, 543, 7411, 29941, 29906, 613, 13, 9651, 2302, 29922, 29876, 29918, 798, 334, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 29897, 13, 4706, 396, 565, 7431, 29898, 21494, 336, 29918, 1272, 29889, 12181, 29897, 1405, 29871, 29896, 29901, 13, 4706, 396, 450, 6683, 336, 338, 871, 29871, 29896, 29928, 1409, 13, 4706, 396, 6683, 336, 29918, 1272, 353, 6683, 336, 29918, 1272, 29889, 690, 14443, 29898, 13, 4706, 396, 302, 29918, 798, 29892, 6683, 336, 29918, 1272, 29889, 2311, 849, 302, 29918, 798, 29897, 13, 4706, 1583, 29889, 21494, 336, 353, 6683, 336, 29918, 1272, 13, 4706, 736, 13, 13, 1678, 822, 903, 5510, 29918, 990, 262, 29918, 1761, 29898, 1311, 1125, 13, 4706, 9995, 2577, 2472, 515, 22118, 1293, 13, 4706, 3789, 278, 1494, 8393, 29901, 13, 4706, 421, 1311, 29889, 12574, 29918, 1761, 29918, 6672, 6998, 29871, 29906, 29928, 29899, 2378, 13, 4706, 421, 1311, 29889, 12574, 29918, 1761, 6998, 3978, 1051, 13, 4706, 9995, 13, 4706, 396, 3824, 9659, 3978, 1051, 1134, 13, 4706, 318, 333, 29892, 926, 29892, 2159, 353, 1583, 29889, 1271, 29918, 3888, 3366, 1955, 20728, 3108, 13, 4706, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 353, 5519, 8516, 29892, 4514, 334, 29871, 29945, 13, 462, 462, 259, 363, 474, 297, 3464, 29898, 1311, 29889, 1272, 29918, 12574, 29918, 2798, 4638, 13, 4706, 396, 2178, 1950, 304, 505, 921, 343, 322, 503, 11909, 29991, 13, 4706, 1583, 29889, 29916, 1066, 353, 12655, 29889, 3298, 359, 29898, 1311, 29889, 2798, 29897, 13, 4706, 1583, 29889, 29891, 1066, 353, 12655, 29889, 3298, 359, 29898, 1311, 29889, 2798, 29897, 13, 4706, 1583, 29889, 29920, 1066, 353, 12655, 29889, 3298, 359, 29898, 1311, 29889, 2798, 29897, 13, 4706, 1051, 29918, 25629, 353, 5947, 7224, 29889, 12574, 29918, 25629, 718, 320, 13, 9651, 16206, 1542, 29889, 29880, 29918, 8896, 29889, 1767, 334, 1583, 29889, 5030, 5946, 13, 4706, 3151, 1066, 353, 926, 718, 5947, 7224, 29889, 12574, 29918, 3888, 13, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 1272, 29918, 12574, 29918, 2798, 1125, 13, 9651, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 2764, 1066, 29897, 13, 9651, 282, 29896, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 9651, 282, 29906, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 9651, 269, 353, 1583, 17255, 949, 29918, 1853, 703, 9420, 29947, 613, 29871, 29900, 29916, 29896, 29900, 29897, 13, 9651, 396, 3824, 2380, 29901, 338, 278, 1051, 921, 29892, 470, 343, 926, 29973, 13, 9651, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29900, 29962, 353, 313, 29886, 29896, 5099, 29871, 29941, 29896, 669, 29871, 29900, 29890, 29896, 29897, 1275, 29871, 29896, 13, 9651, 396, 6440, 29901, 3630, 1134, 310, 278, 1948, 13, 9651, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29896, 29962, 353, 3630, 1542, 29898, 29886, 29896, 669, 3695, 29898, 29900, 29890, 29896, 3532, 29871, 29941, 29896, 876, 13, 9651, 396, 18008, 29901, 13223, 13, 9651, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29906, 29962, 353, 13223, 1542, 29898, 29886, 29906, 29897, 13, 9651, 396, 12458, 386, 29901, 17195, 13, 9651, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29941, 29962, 353, 269, 13, 9651, 396, 9208, 29901, 278, 3935, 848, 13, 9651, 396, 1409, 353, 12655, 29889, 6310, 29898, 1311, 29889, 2798, 29897, 13, 632, 13, 9651, 396, 5974, 5692, 304, 367, 10478, 408, 938, 29953, 29946, 297, 29871, 29896, 29900, 29900, 23432, 852, 1116, 18747, 13, 9651, 396, 29863, 14981, 773, 278, 869, 6006, 12315, 21502, 305, 13, 9651, 396, 12105, 947, 451, 2615, 304, 367, 29871, 26663, 382, 1129, 305, 931, 259, 13, 9651, 396, 3789, 931, 29961, 29900, 29962, 353, 29871, 29900, 2745, 14334, 3407, 508, 367, 10087, 13, 9651, 396, 7867, 292, 1409, 674, 505, 5190, 310, 421, 2283, 2481, 29952, 297, 6923, 13, 9651, 565, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29896, 29962, 1275, 3630, 1542, 29889, 2481, 29901, 795, 13, 18884, 1409, 353, 12655, 29889, 2378, 4197, 1311, 17255, 949, 29918, 1853, 703, 524, 29953, 29946, 1159, 13, 462, 462, 363, 474, 297, 3464, 29898, 1311, 29889, 2798, 29897, 2314, 847, 29871, 29896, 29872, 29955, 13, 18884, 1409, 353, 1409, 448, 1409, 29961, 29900, 29962, 13, 9651, 1683, 29901, 29871, 13, 18884, 1409, 353, 12655, 29889, 2378, 4197, 1311, 17255, 949, 29918, 1853, 703, 8896, 1159, 13, 462, 462, 363, 474, 297, 3464, 29898, 1311, 29889, 2798, 29897, 2314, 13, 462, 13, 9651, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29946, 29962, 353, 1409, 13, 9651, 396, 3789, 1583, 29889, 29916, 1066, 470, 1583, 29889, 29891, 1066, 13, 9651, 565, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29896, 29962, 1275, 3630, 1542, 29889, 29903, 5031, 616, 29918, 29990, 29901, 13, 18884, 1583, 29889, 29916, 1066, 353, 1409, 13, 18884, 1583, 29889, 29916, 1066, 29918, 5441, 353, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29906, 29962, 13, 9651, 25342, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29896, 29962, 1275, 3630, 1542, 29889, 29903, 5031, 616, 29918, 29979, 29901, 13, 18884, 1583, 29889, 29891, 1066, 353, 1409, 13, 18884, 1583, 29889, 29891, 1066, 29918, 5441, 353, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29906, 29962, 13, 9651, 25342, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29896, 29962, 1275, 3630, 1542, 29889, 29903, 5031, 616, 29918, 29999, 29901, 13, 18884, 1583, 29889, 29920, 1066, 353, 1409, 13, 18884, 1583, 29889, 29920, 1066, 29918, 5441, 353, 1583, 29889, 12574, 29918, 1761, 29918, 6672, 29961, 29875, 3816, 29906, 29962, 13, 9651, 1683, 29901, 13, 18884, 1209, 13, 9651, 3151, 1066, 4619, 1051, 29918, 25629, 13, 13, 1678, 822, 903, 5510, 29918, 29893, 1958, 29898, 1311, 1125, 13, 4706, 9995, 2577, 2472, 1048, 10417, 297, 13763, 3542, 322, 13763, 3542, 20938, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 318, 333, 29892, 926, 29892, 2159, 353, 1583, 29889, 1271, 29918, 3888, 3366, 29956, 23827, 3108, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 565, 1583, 29889, 8382, 29901, 13, 18884, 1596, 29898, 703, 7583, 20039, 947, 451, 29908, 13, 462, 539, 376, 1712, 10417, 2472, 3850, 511, 13, 462, 418, 934, 29922, 303, 20405, 29897, 13, 9651, 736, 13, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 1066, 718, 5947, 7224, 29889, 29893, 1958, 29918, 12574, 29897, 13, 4706, 921, 29918, 2962, 353, 1583, 17255, 949, 29918, 1853, 703, 7411, 1159, 13, 4706, 565, 451, 12655, 29889, 275, 5358, 29898, 29916, 29918, 2962, 29892, 1583, 29889, 29916, 1066, 29961, 29900, 1402, 364, 25027, 29922, 29896, 29872, 29899, 29946, 1125, 13, 9651, 12020, 7865, 2392, 703, 29956, 23827, 1060, 1066, 338, 451, 1021, 408, 297, 6323, 20728, 29991, 1159, 13, 4706, 343, 29918, 2962, 353, 1583, 17255, 949, 29918, 1853, 703, 7411, 1159, 13, 4706, 565, 451, 12655, 29889, 275, 5358, 29898, 29891, 29918, 2962, 29892, 1583, 29889, 29891, 1066, 29961, 29900, 1402, 364, 25027, 29922, 29896, 29872, 29899, 29946, 1125, 13, 9651, 12020, 7865, 2392, 703, 29956, 23827, 612, 1066, 338, 451, 1021, 408, 297, 6323, 20728, 29991, 1159, 13, 4706, 9815, 29896, 353, 1583, 17255, 949, 29918, 1853, 703, 7411, 1159, 13, 4706, 921, 29918, 8305, 353, 1583, 17255, 949, 29918, 1853, 703, 7411, 1159, 13, 4706, 343, 29918, 8305, 353, 1583, 17255, 949, 29918, 1853, 703, 7411, 1159, 13, 4706, 9815, 29906, 353, 1583, 17255, 949, 29918, 1853, 703, 7411, 1159, 13, 4706, 6683, 336, 29918, 29893, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 4706, 6683, 336, 29918, 29882, 353, 1583, 17255, 949, 29918, 1853, 703, 524, 29941, 29906, 1159, 13, 13, 4706, 396, 5953, 837, 457, 565, 278, 921, 29891, 29899, 7720, 29250, 338, 1021, 408, 297, 921, 29918, 8305, 322, 343, 29918, 8305, 13, 4706, 565, 313, 2435, 29898, 1311, 29889, 29916, 1066, 29897, 1405, 29871, 29896, 29897, 322, 313, 2435, 29898, 1311, 29889, 29891, 1066, 29897, 1405, 29871, 29896, 1125, 13, 9651, 921, 5721, 353, 12655, 29889, 6897, 29898, 1311, 29889, 29916, 1066, 448, 1583, 29889, 29916, 1066, 29961, 29900, 2314, 13, 9651, 343, 5721, 353, 12655, 29889, 6897, 29898, 1311, 29889, 29891, 1066, 448, 1583, 29889, 29891, 1066, 29961, 29900, 2314, 13, 9651, 921, 5721, 353, 921, 5721, 29961, 23749, 29889, 5464, 9171, 29898, 29916, 5721, 4638, 13, 9651, 343, 5721, 353, 343, 5721, 29961, 23749, 29889, 5464, 9171, 29898, 2941, 391, 4638, 13, 9651, 396, 3617, 13114, 1661, 29899, 9171, 7164, 297, 278, 6856, 13, 9651, 1018, 29901, 13, 18884, 921, 29918, 8305, 29918, 7720, 353, 12655, 29889, 1195, 29898, 29916, 5721, 29897, 13, 9651, 5174, 7865, 2392, 29901, 13, 18884, 921, 29918, 8305, 29918, 7720, 353, 29871, 29900, 13, 13, 9651, 1018, 29901, 13, 18884, 343, 29918, 8305, 29918, 7720, 353, 12655, 29889, 1195, 29898, 2941, 391, 29897, 13, 9651, 5174, 7865, 2392, 29901, 13, 18884, 343, 29918, 8305, 29918, 7720, 353, 29871, 29900, 13, 13, 4706, 1583, 29889, 1958, 29918, 12181, 353, 313, 21494, 336, 29918, 29893, 29892, 6683, 336, 29918, 29882, 29897, 13, 4706, 1583, 29889, 1958, 29918, 3888, 353, 9657, 29898, 29916, 29918, 2962, 29922, 29916, 29918, 2962, 29892, 13, 462, 632, 343, 29918, 2962, 29922, 29891, 29918, 2962, 29892, 13, 462, 632, 921, 29918, 8305, 29922, 29916, 29918, 8305, 29892, 13, 462, 632, 343, 29918, 8305, 29922, 29891, 29918, 8305, 29892, 13, 462, 632, 921, 29918, 9653, 29922, 21494, 336, 29918, 29893, 334, 921, 29918, 8305, 29892, 13, 462, 632, 343, 29918, 9653, 29922, 21494, 336, 29918, 29882, 334, 343, 29918, 8305, 29892, 13, 462, 632, 921, 29918, 5441, 29922, 1311, 29889, 29916, 1066, 29918, 5441, 29892, 13, 462, 632, 343, 29918, 5441, 29922, 1311, 29889, 29891, 1066, 29918, 5441, 29897, 13, 13, 1678, 822, 903, 5510, 29918, 2492, 29898, 1311, 1125, 13, 4706, 9995, 5647, 1461, 278, 4796, 29899, 4366, 435, 4162, 29954, 1967, 13, 965, 450, 2159, 310, 1550, 29899, 4366, 1967, 338, 274, 6797, 297, 967, 8528, 6545, 13, 965, 4803, 349, 6227, 304, 6088, 278, 8528, 6545, 2472, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 318, 333, 29892, 926, 29892, 2159, 353, 1583, 29889, 1271, 29918, 3888, 3366, 29956, 3912, 29931, 3108, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 565, 1583, 29889, 8382, 29901, 13, 18884, 1596, 703, 1576, 281, 2176, 934, 947, 451, 1712, 385, 1967, 613, 13, 462, 418, 934, 29922, 303, 20405, 29897, 13, 9651, 736, 13, 13, 4706, 396, 7523, 278, 6262, 29889, 421, 1311, 29889, 2492, 29952, 338, 263, 21021, 10663, 1203, 286, 326, 860, 292, 263, 934, 13, 4706, 1583, 29889, 1445, 29918, 5415, 29889, 344, 1416, 29898, 1066, 718, 5947, 7224, 29889, 26568, 29918, 6672, 29897, 13, 4706, 10153, 29918, 13193, 353, 1583, 29889, 1445, 29918, 5415, 29889, 949, 29898, 2311, 448, 5947, 7224, 29889, 26568, 29918, 6672, 29897, 13, 4706, 1583, 29889, 2492, 353, 12013, 29889, 11207, 5971, 29898, 2492, 29918, 13193, 29897, 13, 4706, 396, 29273, 1967, 9927, 565, 349, 6227, 338, 2198, 13, 4706, 565, 349, 6227, 338, 451, 6213, 29901, 13, 9651, 8230, 29918, 2492, 353, 7084, 29889, 3150, 29898, 1311, 29889, 2492, 29897, 13, 9651, 396, 1334, 1823, 4567, 4839, 6611, 746, 349, 453, 340, 6736, 29871, 29947, 29889, 29906, 29889, 29900, 29889, 13, 9651, 396, 1074, 2045, 597, 29886, 453, 340, 29889, 949, 386, 287, 12332, 29889, 601, 29914, 264, 29914, 13844, 29914, 276, 280, 294, 264, 4769, 29914, 29947, 29889, 29906, 29889, 29900, 29889, 1420, 29937, 3027, 29899, 657, 735, 361, 29899, 735, 361, 29899, 392, 29899, 29887, 567, 29899, 361, 29881, 13, 9651, 396, 4803, 6416, 29899, 1627, 903, 657, 735, 361, 1158, 2012, 13, 9651, 429, 361, 29918, 6672, 353, 9657, 29898, 29886, 309, 29918, 2492, 3032, 657, 735, 361, 3101, 13, 9651, 1018, 29901, 13, 18884, 396, 3617, 278, 2920, 322, 3171, 310, 1967, 13, 18884, 281, 29918, 353, 429, 361, 29918, 6672, 29961, 1252, 361, 28089, 29889, 29943, 18642, 3247, 1662, 29990, 12375, 918, 29962, 13, 18884, 298, 29918, 353, 429, 361, 29918, 6672, 29961, 1252, 361, 28089, 29889, 29943, 18642, 3247, 1662, 29979, 12375, 918, 29962, 13, 18884, 921, 29918, 990, 3383, 343, 29918, 990, 29918, 353, 429, 361, 29918, 6672, 29961, 1252, 361, 28089, 29889, 29943, 18642, 3247, 1662, 18454, 2816, 335, 1144, 29962, 13, 13, 18884, 822, 17903, 29906, 7411, 29898, 29894, 1125, 13, 462, 1678, 9995, 349, 453, 340, 29966, 29955, 29889, 29906, 29889, 29900, 3639, 18761, 29892, 349, 453, 340, 18572, 29955, 29889, 29906, 29889, 29900, 3639, 10762, 8353, 1288, 9995, 13, 462, 1678, 565, 451, 338, 8758, 29898, 29894, 29892, 10762, 8353, 1288, 1125, 13, 462, 4706, 736, 325, 29961, 29900, 29962, 847, 325, 29961, 29896, 29962, 13, 462, 1678, 736, 5785, 29898, 29894, 29897, 13, 13, 18884, 281, 3383, 298, 29918, 353, 17903, 29906, 7411, 29898, 29893, 29918, 511, 17903, 29906, 7411, 29898, 29882, 19925, 13, 18884, 921, 29918, 990, 3383, 343, 29918, 990, 29918, 353, 17903, 29906, 7411, 29898, 29916, 29918, 990, 29918, 511, 17903, 29906, 7411, 29898, 29891, 29918, 990, 19925, 13, 13, 18884, 396, 450, 13391, 313, 2103, 29892, 3171, 29897, 13, 18884, 396, 411, 5190, 421, 2492, 29918, 6229, 2673, 29918, 5441, 29952, 13, 18884, 1583, 29889, 2492, 29918, 6229, 5580, 353, 12655, 29889, 2378, 4197, 29893, 3383, 13, 462, 462, 462, 259, 298, 29918, 2314, 13, 18884, 396, 22118, 310, 1967, 338, 472, 7568, 1492, 11155, 13, 18884, 1583, 29889, 2492, 29918, 12683, 1144, 353, 12655, 29889, 2378, 4197, 29916, 29918, 990, 3383, 13, 462, 462, 18884, 343, 29918, 990, 29918, 2314, 13, 18884, 396, 13109, 338, 20710, 12628, 313, 29945, 29897, 13, 18884, 1583, 29889, 2492, 29918, 6229, 2673, 29918, 5441, 353, 13223, 1542, 29898, 13, 462, 1678, 429, 361, 29918, 6672, 29961, 1252, 361, 28089, 29889, 29943, 18642, 3247, 1662, 12375, 918, 8325, 2314, 13, 18884, 396, 25538, 278, 3800, 363, 8182, 3262, 13, 18884, 396, 12206, 278, 349, 6227, 12219, 13, 18884, 396, 313, 1563, 29892, 7568, 29892, 1492, 29892, 5224, 29897, 13, 18884, 1583, 29889, 2492, 29918, 29883, 1336, 1884, 353, 1583, 17255, 28667, 29918, 29883, 1336, 29918, 1884, 580, 13, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 565, 1583, 29889, 8382, 29901, 13, 462, 1678, 1596, 29898, 703, 9526, 6611, 297, 4796, 3578, 1967, 4839, 29908, 13, 462, 965, 376, 2609, 367, 1303, 3850, 511, 13, 462, 3986, 934, 29922, 303, 20405, 29897, 13, 4706, 736, 13, 13, 1678, 822, 4770, 28667, 29918, 29883, 1336, 29918, 1884, 29898, 1311, 1125, 13, 4706, 9995, 10739, 740, 304, 8147, 274, 1336, 3800, 13, 4706, 9995, 13, 4706, 822, 903, 771, 637, 291, 29898, 29916, 29892, 1375, 3317, 29892, 17036, 1125, 13, 9651, 9995, 2577, 29839, 17036, 15945, 29908, 13, 9651, 1375, 29892, 4236, 353, 1375, 3317, 13, 9651, 736, 938, 29898, 29886, 861, 1379, 334, 313, 29916, 448, 1375, 29897, 847, 313, 3317, 448, 1375, 876, 13, 13, 4706, 8230, 29918, 2492, 353, 349, 6227, 29889, 2940, 29889, 3150, 29898, 1311, 29889, 2492, 29897, 13, 4706, 281, 3383, 298, 29918, 353, 1583, 29889, 2492, 29918, 6229, 5580, 13, 4706, 921, 29900, 3383, 343, 29900, 29918, 353, 1583, 29889, 2492, 29918, 12683, 1144, 13, 4706, 282, 29893, 353, 8230, 29918, 2492, 29889, 2103, 13, 4706, 1374, 353, 8230, 29918, 2492, 29889, 3545, 13, 4706, 2910, 29918, 15524, 353, 1583, 29889, 29916, 1066, 29889, 1195, 580, 13, 4706, 2910, 29918, 29916, 29878, 353, 1583, 29889, 29916, 1066, 29889, 3317, 580, 13, 4706, 2910, 29918, 3637, 353, 1583, 29889, 29891, 1066, 29889, 1195, 580, 13, 4706, 2910, 29918, 29891, 29890, 353, 1583, 29889, 29891, 1066, 29889, 3317, 580, 13, 4706, 2175, 353, 903, 771, 637, 291, 29898, 1958, 29918, 15524, 29892, 313, 29916, 29900, 3383, 921, 29900, 29918, 718, 281, 29918, 511, 282, 29893, 29897, 13, 4706, 1492, 353, 903, 771, 637, 291, 29898, 1958, 29918, 29916, 29878, 29892, 313, 29916, 29900, 3383, 921, 29900, 29918, 718, 281, 29918, 511, 282, 29893, 29897, 13, 4706, 2246, 353, 903, 771, 637, 291, 29898, 1958, 29918, 3637, 29892, 313, 29891, 29900, 3383, 343, 29900, 29918, 718, 298, 29918, 511, 1374, 29897, 13, 4706, 5970, 353, 903, 771, 637, 291, 29898, 1958, 29918, 29891, 29890, 29892, 313, 29891, 29900, 3383, 343, 29900, 29918, 718, 298, 29918, 511, 1374, 29897, 13, 4706, 736, 313, 1563, 29892, 2246, 29892, 1492, 29892, 5970, 29897, 13, 13, 1678, 822, 4770, 690, 14443, 29918, 21494, 336, 29898, 1311, 1125, 13, 4706, 9995, 1666, 14443, 6683, 336, 964, 281, 334, 298, 334, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 275, 29918, 5729, 9446, 29901, 13, 9651, 565, 1583, 29889, 8382, 29901, 13, 18884, 1596, 29898, 703, 1576, 20039, 338, 451, 8676, 29892, 376, 13, 462, 539, 376, 14043, 1018, 304, 620, 14443, 6683, 336, 964, 2302, 334, 282, 567, 1213, 511, 13, 462, 418, 934, 29922, 303, 20405, 29897, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 21494, 336, 353, 12655, 29889, 690, 14443, 29898, 1311, 29889, 21494, 336, 29892, 13, 462, 462, 632, 313, 1311, 29889, 2798, 29892, 13, 462, 462, 795, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 876, 13, 9651, 5174, 7865, 2392, 29901, 13, 18884, 565, 1583, 29889, 8382, 29901, 13, 462, 1678, 1596, 703, 1666, 29882, 21430, 6683, 336, 1409, 5229, 29889, 3529, 1423, 19602, 13, 462, 3986, 934, 29922, 303, 20405, 29897, 13, 9651, 736, 13, 4706, 25342, 756, 5552, 29898, 1311, 29892, 376, 1958, 29918, 12181, 29908, 1125, 13, 9651, 396, 1317, 263, 10417, 13, 9651, 6683, 336, 29918, 29893, 29892, 6683, 336, 29918, 29882, 353, 1583, 29889, 1958, 29918, 12181, 13, 9651, 565, 6683, 336, 29918, 29893, 334, 6683, 336, 29918, 29882, 2804, 1583, 29889, 2798, 29901, 13, 18884, 565, 1583, 29889, 8382, 29901, 13, 462, 1678, 1596, 29898, 703, 15845, 2472, 515, 399, 23827, 451, 29908, 13, 462, 965, 376, 6590, 304, 6323, 20728, 29991, 376, 13, 462, 965, 376, 12984, 451, 620, 14443, 278, 6683, 336, 4968, 13, 462, 3986, 934, 29922, 303, 20405, 29897, 13, 18884, 736, 13, 9651, 25342, 6683, 336, 29918, 29893, 334, 6683, 336, 29918, 29882, 334, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 320, 13, 462, 1678, 2804, 7431, 29898, 1311, 29889, 21494, 336, 1125, 13, 18884, 565, 1583, 29889, 8382, 29901, 13, 462, 1678, 1596, 29898, 703, 15845, 2472, 515, 399, 23827, 29908, 13, 462, 965, 376, 451, 6590, 304, 360, 8254, 29991, 376, 13, 462, 965, 376, 12984, 451, 620, 14443, 278, 6683, 336, 4968, 13, 462, 3986, 934, 29922, 303, 20405, 29897, 13, 18884, 736, 13, 9651, 1683, 29901, 13, 18884, 396, 10575, 367, 298, 4206, 334, 281, 4341, 29889, 12655, 29889, 299, 2378, 338, 1948, 937, 13, 18884, 396, 2538, 14443, 304, 29871, 29941, 29928, 4636, 746, 2599, 29871, 29906, 29928, 10417, 13, 18884, 565, 313, 21494, 336, 29918, 29882, 1405, 29871, 29896, 29897, 322, 313, 21494, 336, 29918, 29893, 1405, 29871, 29896, 1125, 13, 462, 1678, 1583, 29889, 21494, 336, 353, 12655, 29889, 690, 14443, 29898, 1311, 29889, 21494, 336, 29892, 13, 462, 462, 462, 313, 21494, 336, 29918, 29882, 29892, 6683, 336, 29918, 29893, 29892, 13, 462, 462, 462, 29871, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 876, 13, 18884, 396, 6467, 372, 338, 263, 1196, 12812, 13, 18884, 1683, 29901, 13, 462, 1678, 1583, 29889, 21494, 336, 353, 12655, 29889, 690, 14443, 29898, 1311, 29889, 21494, 336, 29892, 13, 462, 462, 462, 313, 1311, 29889, 2798, 29892, 13, 462, 462, 462, 29871, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 876, 13, 4706, 396, 1152, 738, 916, 1134, 310, 20039, 29892, 620, 14443, 964, 313, 2798, 29879, 29892, 1298, 29918, 546, 29918, 21494, 5848, 29897, 13, 4706, 396, 1342, 29901, 3652, 12812, 13, 4706, 25342, 1583, 29889, 2798, 1405, 29871, 29896, 29901, 13, 9651, 1583, 29889, 21494, 336, 353, 12655, 29889, 690, 14443, 29898, 1311, 29889, 21494, 336, 29892, 13, 462, 462, 308, 313, 1311, 29889, 2798, 29892, 13, 462, 462, 3986, 1583, 29889, 3149, 29918, 546, 29918, 21494, 5848, 876, 13, 4706, 1683, 29901, 13, 9651, 736, 13, 13, 1678, 822, 1596, 29918, 3888, 29898, 1311, 29892, 3579, 7529, 1125, 13, 4706, 9995, 11816, 2472, 310, 278, 281, 2176, 934, 13, 4706, 9995, 13, 4706, 269, 353, 5159, 13, 4706, 269, 29889, 4397, 29898, 29884, 29908, 29912, 29900, 29901, 29958, 29906, 29946, 29879, 29913, 3583, 29873, 29912, 29896, 29913, 1642, 4830, 703, 7030, 613, 1583, 29889, 3257, 876, 13, 4706, 269, 29889, 4397, 29898, 29884, 29908, 29912, 29900, 29901, 29958, 29896, 29955, 29879, 29913, 1873, 3583, 29873, 29912, 29896, 1836, 29912, 29906, 1836, 29912, 29941, 1836, 29912, 29946, 29913, 1642, 13, 462, 3402, 29898, 1311, 29889, 6214, 29918, 978, 29892, 13, 462, 4706, 334, 1311, 29889, 6214, 29918, 3259, 876, 13, 13, 4706, 269, 29889, 4397, 29898, 29884, 29908, 29912, 29900, 29901, 29958, 29906, 29946, 29879, 29913, 3583, 29873, 29912, 29896, 29913, 302, 29885, 1642, 4830, 703, 29931, 29440, 399, 6447, 1477, 613, 13, 462, 462, 9651, 1583, 29889, 3333, 261, 29918, 2848, 876, 13, 4706, 363, 263, 297, 4852, 2798, 613, 376, 5030, 5946, 613, 376, 3149, 29918, 546, 29918, 21494, 5848, 613, 13, 462, 29871, 376, 16192, 29918, 1853, 613, 376, 26658, 358, 29918, 1853, 613, 13, 462, 29871, 376, 21494, 1705, 29918, 5441, 613, 13, 462, 29871, 376, 29916, 1761, 29918, 5441, 613, 376, 29916, 1761, 29918, 2848, 613, 13, 462, 29871, 376, 29891, 1761, 29918, 5441, 613, 376, 29891, 1761, 29918, 2848, 613, 13, 462, 29871, 376, 29916, 1066, 29918, 5441, 613, 376, 29891, 1066, 29918, 5441, 29908, 1125, 13, 9651, 269, 978, 353, 3588, 29918, 5552, 29918, 978, 29898, 29874, 29897, 13, 9651, 396, 4803, 6261, 1347, 11301, 304, 5191, 13, 9651, 1018, 29901, 13, 18884, 659, 353, 851, 29898, 657, 5552, 29898, 1311, 29892, 263, 876, 13, 9651, 5174, 23833, 2392, 29901, 13, 18884, 6773, 13, 9651, 269, 29889, 4397, 703, 29912, 29900, 29901, 29958, 29906, 29946, 29879, 29913, 3583, 29873, 29912, 29896, 29913, 1642, 4830, 29898, 29879, 978, 29892, 659, 876, 13, 4706, 1426, 353, 318, 26732, 29876, 1642, 7122, 29898, 29879, 29897, 13, 4706, 1596, 29898, 726, 29892, 3579, 7529, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 12020, 2216, 1888, 2037, 287, 2392, 703, 12148, 4555, 1065, 445, 3883, 408, 263, 2471, 29991, 1159, 13, 2 ]
meiduo_mall/apps/orders/urls.py
MarioKarting/Django_meiduo_project
0
19716
# !/usr/bin/env python # _*_ coding:utf-8 _*_ from django.conf.urls import url from . import views urlpatterns = [ # 1. 结算订单 orders/settlement/ url(r'^orders/settlement/$', views.OrdersSettlementView.as_view(), name='settlement'), # 2. orders/commit/ 提交订单 url(r'^orders/commit/$', views.OrdersCommitView.as_view(), name='commit'), # 3. 订单成功 -- orders/success/ url(r'^orders/success/$', views.OrdersSuccessView.as_view(), name='sucess'), ]
[ 1, 396, 1738, 29914, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 903, 29930, 29918, 14137, 29901, 9420, 29899, 29947, 903, 29930, 29918, 13, 13, 13, 3166, 9557, 29889, 5527, 29889, 26045, 1053, 3142, 13, 13, 3166, 869, 1053, 8386, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 396, 268, 29896, 29889, 29871, 31320, 31565, 235, 177, 165, 31166, 29871, 11299, 29914, 9915, 944, 29914, 13, 1678, 3142, 29898, 29878, 29915, 29985, 20488, 29914, 9915, 944, 13346, 742, 8386, 29889, 2816, 8623, 29903, 1803, 944, 1043, 29889, 294, 29918, 1493, 3285, 1024, 2433, 9915, 944, 5477, 13, 13, 1678, 396, 29871, 29906, 29889, 11299, 29914, 15060, 29914, 29871, 31302, 31398, 235, 177, 165, 31166, 13, 1678, 3142, 29898, 29878, 29915, 29985, 20488, 29914, 15060, 13346, 742, 8386, 29889, 2816, 8623, 1523, 2415, 1043, 29889, 294, 29918, 1493, 3285, 1024, 2433, 15060, 5477, 13, 13, 1678, 396, 29871, 29941, 29889, 29871, 235, 177, 165, 31166, 30494, 31134, 1192, 11299, 29914, 8698, 29914, 13, 1678, 3142, 29898, 29878, 29915, 29985, 20488, 29914, 8698, 13346, 742, 8386, 29889, 2816, 8623, 14191, 1043, 29889, 294, 29918, 1493, 3285, 1024, 2433, 2146, 985, 5477, 13, 13, 13, 29962, 13, 2 ]
MAX40080/src/torque_test_stand/src/torque_tester.py
MilosRasic98/Orbweaver-Rover
1
36369
<reponame>MilosRasic98/Orbweaver-Rover #!/usr/bin/env python3 import rospy import serial from std_msgs.msg import Float32 tt_arduino = serial.Serial("/dev/ttyUSB0", 9600) rospy.init_node('torque_test_stand', anonymous = False) pub = rospy.Publisher('/test_equipment/measured_torque', Float32, queue_size=10) r = rospy.Rate(10) print('Torque Test Stand Node Started!') while not rospy.is_shutdown(): raw_data = str(tt_arduino.readline()) extracted_data = raw_data[2:raw_data.find('\\r')] converted_data = float(extracted_data) pub.publish(converted_data) r.sleep()
[ 1, 529, 276, 1112, 420, 29958, 29316, 359, 29934, 294, 293, 29929, 29947, 29914, 2816, 29890, 705, 12483, 29899, 29934, 957, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 5215, 696, 1028, 29891, 13, 5215, 7797, 13, 3166, 3659, 29918, 1516, 3174, 29889, 7645, 1053, 27842, 29941, 29906, 13, 13, 698, 29918, 538, 29884, 1789, 353, 7797, 29889, 9125, 11974, 3359, 29914, 4349, 29965, 1744, 29900, 613, 29871, 29929, 29953, 29900, 29900, 29897, 13, 13, 307, 1028, 29891, 29889, 2344, 29918, 3177, 877, 7345, 802, 29918, 1688, 29918, 1689, 742, 21560, 353, 7700, 29897, 13, 5467, 353, 696, 1028, 29891, 29889, 21076, 1674, 261, 11219, 1688, 29918, 1686, 666, 358, 29914, 1004, 294, 2955, 29918, 7345, 802, 742, 27842, 29941, 29906, 29892, 9521, 29918, 2311, 29922, 29896, 29900, 29897, 13, 29878, 353, 696, 1028, 29891, 29889, 19907, 29898, 29896, 29900, 29897, 13, 13, 2158, 877, 29911, 272, 802, 4321, 6679, 9071, 7370, 287, 29991, 1495, 13, 13, 8000, 451, 696, 1028, 29891, 29889, 275, 29918, 845, 329, 3204, 7295, 13, 1678, 10650, 29918, 1272, 4706, 353, 851, 29898, 698, 29918, 538, 29884, 1789, 29889, 949, 1220, 3101, 13, 1678, 23892, 29918, 1272, 29871, 353, 10650, 29918, 1272, 29961, 29906, 29901, 1610, 29918, 1272, 29889, 2886, 877, 1966, 29878, 1495, 29962, 13, 1678, 11543, 29918, 1272, 29871, 353, 5785, 29898, 21111, 287, 29918, 1272, 29897, 13, 1678, 2529, 29889, 23679, 29898, 13441, 287, 29918, 1272, 29897, 13, 1678, 364, 29889, 17059, 580, 2 ]
solution/10828(스택).py
OMEGA-Y/Baekjoon-sol
0
119204
import sys input = sys.stdin.readline N = int(input()) stack = [] for _ in range(N): data = list(input().strip().split()) if data[0] == 'push': stack.append(data[1]) elif data[0] == 'top': if stack: print(stack[-1]) else: print(-1) elif data[0] == 'size': print(len(stack)) elif data[0] == 'pop': if stack: m = stack.pop() print(m) else: print(-1) else: if stack: print(0) else: print(1)
[ 1, 1053, 10876, 13, 2080, 353, 10876, 29889, 4172, 262, 29889, 949, 1220, 13, 13, 29940, 353, 938, 29898, 2080, 3101, 13, 1429, 353, 5159, 13, 13, 1454, 903, 297, 3464, 29898, 29940, 1125, 13, 1678, 848, 353, 1051, 29898, 2080, 2141, 17010, 2141, 5451, 3101, 13, 1678, 565, 848, 29961, 29900, 29962, 1275, 525, 5910, 2396, 13, 4706, 5096, 29889, 4397, 29898, 1272, 29961, 29896, 2314, 13, 1678, 25342, 848, 29961, 29900, 29962, 1275, 525, 3332, 2396, 13, 4706, 565, 5096, 29901, 13, 9651, 1596, 29898, 1429, 14352, 29896, 2314, 13, 4706, 1683, 29901, 13, 9651, 1596, 6278, 29896, 29897, 13, 1678, 25342, 848, 29961, 29900, 29962, 1275, 525, 2311, 2396, 13, 4706, 1596, 29898, 2435, 29898, 1429, 876, 13, 1678, 25342, 848, 29961, 29900, 29962, 1275, 525, 7323, 2396, 13, 4706, 565, 5096, 29901, 13, 9651, 286, 353, 5096, 29889, 7323, 580, 13, 9651, 1596, 29898, 29885, 29897, 13, 4706, 1683, 29901, 13, 9651, 1596, 6278, 29896, 29897, 13, 1678, 1683, 29901, 13, 4706, 565, 5096, 29901, 13, 9651, 1596, 29898, 29900, 29897, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 29896, 29897, 2 ]
tests/framework/test_bmi_var_units.py
mwtoews/pymt
38
173649
<gh_stars>10-100 import pytest import numpy as np from gimli import IncompatibleUnitsError, UnitNameError from numpy.testing import assert_array_equal from pymt.framework.bmi_bridge import BmiTimeInterpolator, GridMapperMixIn, _BmiCap class SimpleBmi: def get_output_var_names(self): return ("elevation",) def get_var_grid(self, name): return 0 def get_var_units(self, name): return "m" def get_var_type(self, name): return "float" def get_var_location(self, name): return "node" def get_var_nbytes(self, name): return self.get_var_itemsize(name) * 4 def get_var_itemsize(self, name): return np.dtype("float").itemsize def get_value(self, name, out): out[:] = [1, 2, 3, 4] def get_grid_node_count(self, grid): return 4 class Bmi(GridMapperMixIn, _BmiCap, BmiTimeInterpolator): _cls = SimpleBmi def test_value_wrap(): """Test wrapping BMI time methods.""" bmi = Bmi() assert bmi.var_units("elevation") == "m" assert_array_equal(bmi.get_value("elevation"), [1, 2, 3, 4]) def test_unit_conversion(): """Test wrapping BMI time methods.""" bmi = Bmi() assert_array_equal(bmi.get_value("elevation", units=None), [1.0, 2.0, 3.0, 4.0]) assert_array_equal(bmi.get_value("elevation", units="m"), [1.0, 2.0, 3.0, 4.0]) assert_array_equal( bmi.get_value("elevation", units="km"), [0.001, 0.002, 0.003, 0.004] ) assert_array_equal( bmi.get_value("elevation", units="m2 km-1"), [1000.0, 2000.0, 3000.0, 4000.0] ) def test_incompatible_units(): """Test wrapping BMI time methods.""" bmi = Bmi() with pytest.raises(IncompatibleUnitsError): bmi.get_value("elevation", units="kg") def test_bad_units(): """Test wrapping BMI time methods.""" bmi = Bmi() with pytest.raises(UnitNameError): bmi.get_value("elevation", units="not_real_units")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 11451, 1688, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 330, 326, 492, 1053, 512, 23712, 2525, 1169, 2392, 29892, 13223, 1170, 2392, 13, 3166, 12655, 29889, 13424, 1053, 4974, 29918, 2378, 29918, 11745, 13, 13, 3166, 282, 962, 29873, 29889, 4468, 29889, 29890, 2460, 29918, 18419, 1053, 350, 2460, 2481, 4074, 3733, 1061, 29892, 11657, 19968, 29924, 861, 797, 29892, 903, 29933, 2460, 12415, 13, 13, 13, 1990, 12545, 29933, 2460, 29901, 13, 1678, 822, 679, 29918, 4905, 29918, 1707, 29918, 7039, 29898, 1311, 1125, 13, 4706, 736, 4852, 29872, 2608, 362, 613, 29897, 13, 13, 1678, 822, 679, 29918, 1707, 29918, 7720, 29898, 1311, 29892, 1024, 1125, 13, 4706, 736, 29871, 29900, 13, 13, 1678, 822, 679, 29918, 1707, 29918, 348, 1169, 29898, 1311, 29892, 1024, 1125, 13, 4706, 736, 376, 29885, 29908, 13, 13, 1678, 822, 679, 29918, 1707, 29918, 1853, 29898, 1311, 29892, 1024, 1125, 13, 4706, 736, 376, 7411, 29908, 13, 13, 1678, 822, 679, 29918, 1707, 29918, 5479, 29898, 1311, 29892, 1024, 1125, 13, 4706, 736, 376, 3177, 29908, 13, 13, 1678, 822, 679, 29918, 1707, 29918, 29876, 13193, 29898, 1311, 29892, 1024, 1125, 13, 4706, 736, 1583, 29889, 657, 29918, 1707, 29918, 667, 2311, 29898, 978, 29897, 334, 29871, 29946, 13, 13, 1678, 822, 679, 29918, 1707, 29918, 667, 2311, 29898, 1311, 29892, 1024, 1125, 13, 4706, 736, 7442, 29889, 29881, 1853, 703, 7411, 2564, 667, 2311, 13, 13, 1678, 822, 679, 29918, 1767, 29898, 1311, 29892, 1024, 29892, 714, 1125, 13, 4706, 714, 7503, 29962, 353, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29962, 13, 13, 1678, 822, 679, 29918, 7720, 29918, 3177, 29918, 2798, 29898, 1311, 29892, 6856, 1125, 13, 4706, 736, 29871, 29946, 13, 13, 13, 1990, 350, 2460, 29898, 5756, 19968, 29924, 861, 797, 29892, 903, 29933, 2460, 12415, 29892, 350, 2460, 2481, 4074, 3733, 1061, 1125, 13, 1678, 903, 25932, 353, 12545, 29933, 2460, 13, 13, 13, 1753, 1243, 29918, 1767, 29918, 6312, 7295, 13, 1678, 9995, 3057, 28489, 350, 10403, 931, 3519, 1213, 15945, 13, 1678, 289, 2460, 353, 350, 2460, 580, 13, 13, 1678, 4974, 289, 2460, 29889, 1707, 29918, 348, 1169, 703, 29872, 2608, 362, 1159, 1275, 376, 29885, 29908, 13, 1678, 4974, 29918, 2378, 29918, 11745, 29898, 29890, 2460, 29889, 657, 29918, 1767, 703, 29872, 2608, 362, 4968, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 2314, 13, 13, 13, 1753, 1243, 29918, 5441, 29918, 535, 3259, 7295, 13, 1678, 9995, 3057, 28489, 350, 10403, 931, 3519, 1213, 15945, 13, 1678, 289, 2460, 353, 350, 2460, 580, 13, 13, 1678, 4974, 29918, 2378, 29918, 11745, 29898, 29890, 2460, 29889, 657, 29918, 1767, 703, 29872, 2608, 362, 613, 10340, 29922, 8516, 511, 518, 29896, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29946, 29889, 29900, 2314, 13, 1678, 4974, 29918, 2378, 29918, 11745, 29898, 29890, 2460, 29889, 657, 29918, 1767, 703, 29872, 2608, 362, 613, 10340, 543, 29885, 4968, 518, 29896, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29946, 29889, 29900, 2314, 13, 1678, 4974, 29918, 2378, 29918, 11745, 29898, 13, 4706, 289, 2460, 29889, 657, 29918, 1767, 703, 29872, 2608, 362, 613, 10340, 543, 8848, 4968, 518, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 29900, 29889, 29900, 29900, 29906, 29892, 29871, 29900, 29889, 29900, 29900, 29941, 29892, 29871, 29900, 29889, 29900, 29900, 29946, 29962, 13, 1678, 1723, 13, 1678, 4974, 29918, 2378, 29918, 11745, 29898, 13, 4706, 289, 2460, 29889, 657, 29918, 1767, 703, 29872, 2608, 362, 613, 10340, 543, 29885, 29906, 2383, 29899, 29896, 4968, 518, 29896, 29900, 29900, 29900, 29889, 29900, 29892, 29871, 29906, 29900, 29900, 29900, 29889, 29900, 29892, 29871, 29941, 29900, 29900, 29900, 29889, 29900, 29892, 29871, 29946, 29900, 29900, 29900, 29889, 29900, 29962, 13, 1678, 1723, 13, 13, 13, 1753, 1243, 29918, 262, 23712, 29918, 348, 1169, 7295, 13, 1678, 9995, 3057, 28489, 350, 10403, 931, 3519, 1213, 15945, 13, 1678, 289, 2460, 353, 350, 2460, 580, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 797, 23712, 2525, 1169, 2392, 1125, 13, 4706, 289, 2460, 29889, 657, 29918, 1767, 703, 29872, 2608, 362, 613, 10340, 543, 9415, 1159, 13, 13, 13, 1753, 1243, 29918, 12313, 29918, 348, 1169, 7295, 13, 1678, 9995, 3057, 28489, 350, 10403, 931, 3519, 1213, 15945, 13, 1678, 289, 2460, 353, 350, 2460, 580, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 8325, 1170, 2392, 1125, 13, 4706, 289, 2460, 29889, 657, 29918, 1767, 703, 29872, 2608, 362, 613, 10340, 543, 1333, 29918, 6370, 29918, 348, 1169, 1159, 13, 2 ]
api_blog/serializers.py
poya-kob/BiaBegard
0
52571
from rest_framework.serializers import HyperlinkedModelSerializer, ModelSerializer from rest_framework import serializers from .models import Blog, BlogCategory, Comments class CategorySerializer(ModelSerializer): class Meta: model = BlogCategory exclude = ['id'] class BlogListSerializer(HyperlinkedModelSerializer): category = CategorySerializer() class Meta: model = Blog exclude = ['active', 'text'] class CommentsSerializer(HyperlinkedModelSerializer): user = serializers.StringRelatedField() # blog = serializers.StringRelatedField() class Meta: model = Comments fields = "__all__" class BlogDetailSerializer(ModelSerializer): comment = CommentsSerializer(many=True) class Meta: model = Blog exclude = ['active', 'category']
[ 1, 515, 1791, 29918, 4468, 29889, 15550, 19427, 1053, 26078, 2324, 287, 3195, 17679, 29892, 8125, 17679, 13, 3166, 1791, 29918, 4468, 1053, 7797, 19427, 13, 13, 3166, 869, 9794, 1053, 350, 1188, 29892, 350, 1188, 10900, 29892, 461, 29879, 13, 13, 13, 1990, 17943, 17679, 29898, 3195, 17679, 1125, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 350, 1188, 10900, 13, 4706, 19060, 353, 6024, 333, 2033, 13, 13, 13, 1990, 350, 1188, 1293, 17679, 29898, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 7663, 353, 17943, 17679, 580, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 350, 1188, 13, 4706, 19060, 353, 6024, 4925, 742, 525, 726, 2033, 13, 13, 13, 1990, 461, 29879, 17679, 29898, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 1404, 353, 7797, 19427, 29889, 1231, 9662, 630, 3073, 580, 13, 1678, 396, 12618, 353, 7797, 19427, 29889, 1231, 9662, 630, 3073, 580, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 461, 29879, 13, 4706, 4235, 353, 376, 1649, 497, 1649, 29908, 13, 13, 13, 1990, 350, 1188, 16570, 17679, 29898, 3195, 17679, 1125, 13, 1678, 3440, 353, 461, 29879, 17679, 29898, 13011, 29922, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 350, 1188, 13, 4706, 19060, 353, 6024, 4925, 742, 525, 7320, 2033, 13, 2 ]
tesseract.py
Swarnava-Sadhukhan/Vehicle-Reg.-Details-using-Number-Plate
0
166638
from PIL import Image import pytesseract pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe" image = Image.open(your_image) image_to_text = pytesseract.image_to_string(image, lang='eng') print(image_to_text)
[ 1, 515, 349, 6227, 1053, 7084, 13, 5215, 282, 3637, 16136, 627, 13, 13, 2272, 29873, 16136, 627, 29889, 2272, 29873, 16136, 627, 29889, 29873, 16136, 627, 29918, 9006, 353, 364, 29908, 29907, 3583, 9283, 12745, 29905, 29911, 16136, 627, 29899, 29949, 11341, 29905, 29873, 16136, 627, 29889, 8097, 29908, 13, 3027, 353, 7084, 29889, 3150, 29898, 8066, 29918, 3027, 29897, 13, 3027, 29918, 517, 29918, 726, 353, 282, 3637, 16136, 627, 29889, 3027, 29918, 517, 29918, 1807, 29898, 3027, 29892, 6361, 2433, 996, 1495, 13, 2158, 29898, 3027, 29918, 517, 29918, 726, 29897, 13, 2 ]
test.py
Mrphase/transformer
0
86945
# -*- coding: utf-8 -*- #/usr/bin/python2 ''' Feb. 2019 by <NAME>. <EMAIL>. https://www.github.com/kyubyong/transformer Inference ''' import os os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # 这一行注释掉就是使用cpu,不注释就是使用gpu import tensorflow as tf from data_load import get_batch from model import Transformer from hparams import Hparams from utils import get_hypotheses, calc_bleu, postprocess, load_hparams import logging logging.basicConfig(level=logging.INFO) logging.info("# hparams") hparams = Hparams() parser = hparams.parser hp = parser.parse_args() load_hparams(hp, hp.ckpt) logging.info("# Prepare test batches") test_batches, num_test_batches, num_test_samples = get_batch(hp.test1, hp.test1, 1000, 1000, hp.vocab, hp.test_batch_size, shuffle=False) iter = tf.data.Iterator.from_structure(test_batches.output_types, test_batches.output_shapes) xs, ys = iter.get_next() test_init_op = iter.make_initializer(test_batches) logging.info("# Load model") m = Transformer(hp) y_hat, _ = m.eval(xs, ys) logging.info("# Session") #config = tf.ConfigProto(log_device_placement=True, allow_soft_placement=True) with tf.Session() as sess: ckpt_ = tf.train.latest_checkpoint(hp.ckpt) ckpt = hp.ckpt if ckpt_ is None else ckpt_ # None: ckpt is a file. otherwise dir. saver = tf.train.Saver() # saver.restore(sess, ckpt) # 有问题??????? sess.run(test_init_op) logging.info("# get hypotheses") hypotheses = get_hypotheses(num_test_batches, num_test_samples, sess, y_hat, m.idx2token) logging.info("# write results") model_output = ckpt.split("/")[-1] if not os.path.exists(hp.testdir): os.makedirs(hp.testdir) translation = os.path.join(hp.testdir, model_output) with open(translation, 'w',encoding='UTF-8') as fout: fout.write("\n".join(hypotheses)) calc_bleu(hp.test2, translation)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 29914, 4855, 29914, 2109, 29914, 4691, 29906, 13, 12008, 13, 29943, 774, 29889, 29871, 29906, 29900, 29896, 29929, 491, 529, 5813, 15513, 13, 29966, 26862, 6227, 15513, 13, 991, 597, 1636, 29889, 3292, 29889, 510, 29914, 3459, 4471, 549, 29914, 9067, 261, 13, 13, 797, 1659, 13, 12008, 13, 13, 5215, 2897, 13, 359, 29889, 21813, 3366, 29907, 29965, 7698, 29918, 28607, 8979, 1307, 29918, 2287, 29963, 2965, 2890, 3108, 353, 11663, 29896, 29908, 396, 29871, 30810, 30287, 30448, 31368, 236, 138, 141, 233, 145, 140, 31238, 30392, 30785, 30406, 21970, 30214, 30413, 31368, 236, 138, 141, 31238, 30392, 30785, 30406, 29887, 3746, 13, 13, 5215, 26110, 408, 15886, 13, 13, 3166, 848, 29918, 1359, 1053, 679, 29918, 16175, 13, 3166, 1904, 1053, 4103, 24784, 13, 3166, 298, 7529, 1053, 379, 7529, 13, 3166, 3667, 29879, 1053, 679, 29918, 29882, 1478, 720, 21523, 29892, 22235, 29918, 569, 29884, 29892, 1400, 5014, 29892, 2254, 29918, 29882, 7529, 13, 5215, 12183, 13, 13, 21027, 29889, 16121, 3991, 29898, 5563, 29922, 21027, 29889, 11690, 29897, 13, 13, 21027, 29889, 3888, 14822, 298, 7529, 1159, 13, 29882, 7529, 353, 379, 7529, 580, 13, 16680, 353, 298, 7529, 29889, 16680, 13, 28887, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1359, 29918, 29882, 7529, 29898, 28887, 29892, 298, 29886, 29889, 384, 415, 29897, 13, 13, 21027, 29889, 3888, 14822, 349, 3445, 598, 1243, 9853, 267, 1159, 13, 1688, 29918, 16175, 267, 29892, 954, 29918, 1688, 29918, 16175, 267, 29892, 954, 29918, 1688, 29918, 27736, 29871, 353, 679, 29918, 16175, 29898, 28887, 29889, 1688, 29896, 29892, 298, 29886, 29889, 1688, 29896, 29892, 13, 462, 462, 1669, 29896, 29900, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29900, 29892, 13, 462, 462, 795, 298, 29886, 29889, 29894, 542, 370, 29892, 298, 29886, 29889, 1688, 29918, 16175, 29918, 2311, 29892, 13, 462, 462, 795, 528, 21897, 29922, 8824, 29897, 13, 1524, 353, 15886, 29889, 1272, 29889, 20277, 29889, 3166, 29918, 23905, 29898, 1688, 29918, 16175, 267, 29889, 4905, 29918, 8768, 29892, 1243, 29918, 16175, 267, 29889, 4905, 29918, 845, 11603, 29897, 13, 10351, 29892, 343, 29879, 353, 4256, 29889, 657, 29918, 4622, 580, 13, 13, 1688, 29918, 2344, 29918, 459, 353, 4256, 29889, 5675, 29918, 11228, 3950, 29898, 1688, 29918, 16175, 267, 29897, 13, 13, 21027, 29889, 3888, 14822, 16012, 1904, 1159, 13, 29885, 353, 4103, 24784, 29898, 28887, 29897, 13, 29891, 29918, 2455, 29892, 903, 353, 286, 29889, 14513, 29898, 10351, 29892, 343, 29879, 29897, 13, 13, 21027, 29889, 3888, 14822, 16441, 1159, 13, 29937, 2917, 353, 15886, 29889, 3991, 1184, 517, 29898, 1188, 29918, 10141, 29918, 29886, 9552, 29922, 5574, 29892, 2758, 29918, 2695, 29918, 29886, 9552, 29922, 5574, 29897, 13, 2541, 15886, 29889, 7317, 580, 408, 27937, 29901, 13, 1678, 274, 29895, 415, 29918, 353, 15886, 29889, 14968, 29889, 12333, 29918, 3198, 3149, 29898, 28887, 29889, 384, 415, 29897, 13, 1678, 274, 29895, 415, 353, 298, 29886, 29889, 384, 415, 565, 274, 29895, 415, 29918, 338, 6213, 1683, 274, 29895, 415, 29918, 396, 6213, 29901, 274, 29895, 415, 338, 263, 934, 29889, 6467, 4516, 29889, 13, 1678, 872, 369, 353, 15886, 29889, 14968, 29889, 29903, 12483, 580, 13, 13, 1678, 396, 872, 369, 29889, 5060, 487, 29898, 29879, 404, 29892, 274, 29895, 415, 29897, 29871, 396, 29871, 30417, 31658, 31596, 30882, 30882, 30882, 30882, 30882, 30882, 30882, 13, 13, 1678, 27937, 29889, 3389, 29898, 1688, 29918, 2344, 29918, 459, 29897, 13, 13, 1678, 12183, 29889, 3888, 14822, 679, 13752, 21523, 1159, 13, 1678, 13752, 21523, 353, 679, 29918, 29882, 1478, 720, 21523, 29898, 1949, 29918, 1688, 29918, 16175, 267, 29892, 954, 29918, 1688, 29918, 27736, 29892, 27937, 29892, 343, 29918, 2455, 29892, 286, 29889, 13140, 29906, 6979, 29897, 13, 13, 1678, 12183, 29889, 3888, 14822, 2436, 2582, 1159, 13, 1678, 1904, 29918, 4905, 353, 274, 29895, 415, 29889, 5451, 11974, 1159, 14352, 29896, 29962, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 28887, 29889, 1688, 3972, 1125, 2897, 29889, 29885, 12535, 12935, 29898, 28887, 29889, 1688, 3972, 29897, 13, 1678, 13962, 353, 2897, 29889, 2084, 29889, 7122, 29898, 28887, 29889, 1688, 3972, 29892, 1904, 29918, 4905, 29897, 13, 1678, 411, 1722, 29898, 3286, 18411, 29892, 525, 29893, 742, 22331, 2433, 10496, 29899, 29947, 1495, 408, 285, 449, 29901, 13, 4706, 285, 449, 29889, 3539, 14182, 29876, 1642, 7122, 29898, 29882, 1478, 720, 21523, 876, 13, 13, 1678, 22235, 29918, 569, 29884, 29898, 28887, 29889, 1688, 29906, 29892, 13962, 29897, 13, 13, 2 ]
xcx_interface/route/menu_r.py
linjingheng-dev/python_service
8
55635
from django.urls import path from xcx_interface.controller.menu.menu_msg import getMenuList urlpatterns = [ # 获取菜单列表 path('getMenuList', getMenuList, name='getMenuList') ]
[ 1, 515, 9557, 29889, 26045, 1053, 2224, 13, 3166, 921, 18904, 29918, 13248, 29889, 8299, 29889, 6510, 29889, 6510, 29918, 7645, 1053, 679, 6823, 1293, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 396, 29871, 31024, 30683, 31854, 31166, 31025, 30746, 13, 1678, 2224, 877, 657, 6823, 1293, 742, 679, 6823, 1293, 29892, 1024, 2433, 657, 6823, 1293, 1495, 13, 29962, 13, 2 ]
config.py
mpsiva89/protean
0
83918
<gh_stars>0 import os from protean.utils import ( CommandProcessing, EventProcessing, IdentityStrategy, IdentityType, ) class Config: DEBUG = True # Parse domain directory and autoload domain modules AUTOLOAD_DOMAIN = True # A secret key for this particular Protean installation. Used in secret-key # hashing algorithms. SECRET_KEY = os.environ.get( "SECRET_KEY", "secret-key-that-is-not-so-secret", ) # Flag indicates that we are testing TESTING = False # Database Configuration DATABASES = { "default": {"PROVIDER": "protean.adapters.repository.memory.MemoryProvider"}, "postgresql": { "PROVIDER": "protean.adapters.repository.sqlalchemy.SAProvider", "DATABASE_URI": os.getenv( "DATABASE_URL", "postgresql://postgres:postgres@localhost:5432/postgres", ), "SCHEMA": os.getenv("POSTGRES_SCHEMA", "public"), }, "sqlite": { "PROVIDER": "protean.adapters.repository.sqlalchemy.SAProvider", "DATABASE_URI": "sqlite:///test.db", }, "elasticsearch": { "PROVIDER": "protean.adapters.repository.elasticsearch.ESProvider", "DATABASE_URI": {"hosts": os.getenv("ES_URI", "localhost").split(",")}, "USE_SSL": os.environ.get("ES_USE_SSL", "false").lower() == "true", "VERIFY_CERTS": ( os.environ.get("ES_VERIFY_CERTS", "false").lower() == "true" ), # default false "NAMESPACE_PREFIX": os.environ.get("ES_NAMESPACE_PREFIX", "dev"), "SETTINGS": {}, }, } EVENT_STORE = { "PROVIDER": "protean.adapters.event_store.memory.MemoryEventStore", } # MessageDB EventStore Configuration # EVENT_STORE = { # "PROVIDER": "protean.adapters.event_store.message_db.MessageDBStore", # "DATABASE_URI": "postgresql://message_store@localhost:5433/message_store", # } BROKERS = { "default": {"PROVIDER": "protean.adapters.broker.memory_broker.MemoryBroker"}, "redis": { "PROVIDER": "protean.adapters.broker.redis.RedisBroker", "URI": f'{os.getenv("CACHE_URL","redis://127.0.0.1:6379")}/0', "IS_ASYNC": True, }, "celery": { "PROVIDER": "protean.adapters.broker.celery.CeleryBroker", "URI": os.environ.get("BROKER_URI") or "redis://127.0.0.1:6379/2", "IS_ASYNC": ( os.environ.get("BROKER_IS_ASYNC", "True") in ["True", "true"] ), # True by default }, } CACHES = { "default": { "PROVIDER": "protean.adapters.cache.memory.MemoryCache", "TTL": 300, }, "redis": { "PROVIDER": "protean.adapters.cache.redis.RedisCache", "URI": f'{os.getenv("CACHE_URL","redis://127.0.0.1:6379")}/2', "TTL": 300, }, } # Identity strategy to use when persisting Entities/Aggregates. # # Options: # # * IdentityStrategy.UUID: Default option, and preferred. Identity is a UUID and generated during `build` time. # Persisted along with other details into the data store. # * IdentityStrategy.DATABASE: Let the database generate unique identity during persistence # * IdentityStrategy.FUNCTION: Special function that returns a unique identifier IDENTITY_STRATEGY = IdentityStrategy.UUID.value IDENTITY_TYPE = IdentityType.UUID.value EVENT_PROCESSING = EventProcessing.ASYNC.value COMMAND_PROCESSING = CommandProcessing.SYNC.value LOGGING_CONFIG = { "version": 1, "disable_existing_loggers": False, "formatters": { "console": { "format": "%(asctime)s %(name)-12s %(levelname)-8s %(message)s", }, }, "handlers": { "console": { "level": "INFO", "class": "logging.StreamHandler", "formatter": "console", }, }, "loggers": { "protean": {"handlers": ["console"], "level": "INFO"}, }, } class TestingConfig(Config): TESTING = True class DevelopmentConfig(Config): pass class ProductionConfig(Config): DEBUG = False
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 13, 3166, 3279, 273, 29889, 13239, 1053, 313, 13, 1678, 10516, 7032, 292, 29892, 13, 1678, 6864, 7032, 292, 29892, 13, 1678, 27486, 26910, 29892, 13, 1678, 27486, 1542, 29892, 13, 29897, 13, 13, 13, 1990, 12782, 29901, 13, 1678, 21681, 353, 5852, 13, 13, 1678, 396, 20969, 5354, 3884, 322, 1120, 3543, 328, 5354, 10585, 13, 1678, 26524, 29949, 29428, 29918, 3970, 29032, 353, 5852, 13, 13, 1678, 396, 319, 7035, 1820, 363, 445, 3153, 14409, 273, 11161, 29889, 501, 8485, 297, 7035, 29899, 1989, 13, 1678, 396, 756, 2790, 14009, 29889, 13, 1678, 3725, 22245, 29911, 29918, 10818, 353, 2897, 29889, 21813, 29889, 657, 29898, 13, 4706, 376, 1660, 22245, 29911, 29918, 10818, 613, 13, 4706, 376, 19024, 29899, 1989, 29899, 5747, 29899, 275, 29899, 1333, 29899, 578, 29899, 19024, 613, 13, 1678, 1723, 13, 13, 1678, 396, 28697, 14088, 393, 591, 526, 6724, 13, 1678, 17067, 1254, 4214, 353, 7700, 13, 13, 1678, 396, 5470, 20999, 13, 1678, 27640, 27982, 29903, 353, 426, 13, 4706, 376, 4381, 1115, 8853, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 19033, 29889, 14834, 29889, 16015, 6980, 10758, 13, 4706, 376, 29272, 1115, 426, 13, 9651, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 19033, 29889, 2850, 284, 305, 6764, 29889, 8132, 6980, 613, 13, 9651, 376, 25832, 27982, 29918, 15551, 1115, 2897, 29889, 657, 6272, 29898, 13, 18884, 376, 25832, 27982, 29918, 4219, 613, 13, 18884, 376, 29272, 597, 2490, 7201, 29901, 2490, 7201, 29992, 7640, 29901, 29945, 29946, 29941, 29906, 29914, 2490, 7201, 613, 13, 9651, 10353, 13, 9651, 376, 29903, 3210, 26862, 1115, 2897, 29889, 657, 6272, 703, 5438, 29954, 15989, 29918, 29903, 3210, 26862, 613, 376, 3597, 4968, 13, 4706, 2981, 13, 4706, 376, 22793, 1115, 426, 13, 9651, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 19033, 29889, 2850, 284, 305, 6764, 29889, 8132, 6980, 613, 13, 9651, 376, 25832, 27982, 29918, 15551, 1115, 376, 22793, 597, 29914, 1688, 29889, 2585, 613, 13, 4706, 2981, 13, 4706, 376, 295, 20291, 1115, 426, 13, 9651, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 19033, 29889, 295, 20291, 29889, 2890, 6980, 613, 13, 9651, 376, 25832, 27982, 29918, 15551, 1115, 8853, 23525, 1115, 2897, 29889, 657, 6272, 703, 2890, 29918, 15551, 613, 376, 7640, 2564, 5451, 28165, 1159, 1118, 13, 9651, 376, 17171, 29918, 18641, 1115, 2897, 29889, 21813, 29889, 657, 703, 2890, 29918, 17171, 29918, 18641, 613, 376, 4541, 2564, 13609, 580, 1275, 376, 3009, 613, 13, 9651, 376, 5348, 6545, 29979, 29918, 29907, 1001, 9375, 1115, 313, 13, 18884, 2897, 29889, 21813, 29889, 657, 703, 2890, 29918, 5348, 6545, 29979, 29918, 29907, 1001, 9375, 613, 376, 4541, 2564, 13609, 580, 1275, 376, 3009, 29908, 13, 9651, 10353, 29871, 396, 2322, 2089, 13, 9651, 376, 5813, 5550, 11538, 29918, 15094, 25634, 1115, 2897, 29889, 21813, 29889, 657, 703, 2890, 29918, 5813, 5550, 11538, 29918, 15094, 25634, 613, 376, 3359, 4968, 13, 9651, 376, 10490, 29911, 4214, 29903, 1115, 24335, 13, 4706, 2981, 13, 1678, 500, 13, 13, 1678, 382, 29963, 3919, 29918, 1254, 29949, 1525, 353, 426, 13, 4706, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 3696, 29918, 8899, 29889, 14834, 29889, 16015, 2624, 9044, 613, 13, 1678, 500, 13, 13, 1678, 396, 7777, 4051, 6864, 9044, 20999, 13, 1678, 396, 382, 29963, 3919, 29918, 1254, 29949, 1525, 353, 426, 13, 1678, 396, 268, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 3696, 29918, 8899, 29889, 4906, 29918, 2585, 29889, 3728, 4051, 9044, 613, 13, 1678, 396, 268, 376, 25832, 27982, 29918, 15551, 1115, 376, 29272, 597, 4906, 29918, 8899, 29992, 7640, 29901, 29945, 29946, 29941, 29941, 29914, 4906, 29918, 8899, 613, 13, 1678, 396, 500, 13, 13, 1678, 350, 1672, 29968, 23598, 353, 426, 13, 4706, 376, 4381, 1115, 8853, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 6729, 3946, 29889, 14834, 29918, 6729, 3946, 29889, 16015, 29857, 3946, 10758, 13, 4706, 376, 1127, 275, 1115, 426, 13, 9651, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 6729, 3946, 29889, 1127, 275, 29889, 9039, 275, 29857, 3946, 613, 13, 9651, 376, 15551, 1115, 285, 29915, 29912, 359, 29889, 657, 6272, 703, 29907, 2477, 9606, 29918, 4219, 3284, 1127, 275, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29901, 29953, 29941, 29955, 29929, 1159, 6822, 29900, 742, 13, 9651, 376, 3235, 29918, 3289, 29979, 15868, 1115, 5852, 29892, 13, 4706, 2981, 13, 4706, 376, 2242, 708, 1115, 426, 13, 9651, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 6729, 3946, 29889, 2242, 708, 29889, 29907, 295, 708, 29857, 3946, 613, 13, 9651, 376, 15551, 1115, 2897, 29889, 21813, 29889, 657, 703, 29933, 1672, 29968, 1001, 29918, 15551, 1159, 470, 376, 1127, 275, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29901, 29953, 29941, 29955, 29929, 29914, 29906, 613, 13, 9651, 376, 3235, 29918, 3289, 29979, 15868, 1115, 313, 13, 18884, 2897, 29889, 21813, 29889, 657, 703, 29933, 1672, 29968, 1001, 29918, 3235, 29918, 3289, 29979, 15868, 613, 376, 5574, 1159, 297, 6796, 5574, 613, 376, 3009, 3108, 13, 9651, 10353, 29871, 396, 5852, 491, 2322, 13, 4706, 2981, 13, 1678, 500, 13, 13, 1678, 315, 2477, 29950, 2890, 353, 426, 13, 4706, 376, 4381, 1115, 426, 13, 9651, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 8173, 29889, 14834, 29889, 16015, 10408, 613, 13, 9651, 376, 29911, 14632, 1115, 29871, 29941, 29900, 29900, 29892, 13, 4706, 2981, 13, 4706, 376, 1127, 275, 1115, 426, 13, 9651, 376, 8618, 13044, 1001, 1115, 376, 14676, 273, 29889, 328, 481, 2153, 29889, 8173, 29889, 1127, 275, 29889, 9039, 275, 10408, 613, 13, 9651, 376, 15551, 1115, 285, 29915, 29912, 359, 29889, 657, 6272, 703, 29907, 2477, 9606, 29918, 4219, 3284, 1127, 275, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29901, 29953, 29941, 29955, 29929, 1159, 6822, 29906, 742, 13, 9651, 376, 29911, 14632, 1115, 29871, 29941, 29900, 29900, 29892, 13, 4706, 2981, 13, 1678, 500, 13, 13, 1678, 396, 27486, 13705, 304, 671, 746, 3736, 15423, 4284, 1907, 29914, 29909, 26127, 1078, 29889, 13, 1678, 396, 13, 1678, 396, 25186, 29901, 13, 1678, 396, 13, 1678, 396, 259, 334, 27486, 26910, 29889, 29965, 11150, 29901, 13109, 2984, 29892, 322, 16389, 29889, 27486, 338, 263, 501, 11150, 322, 5759, 2645, 421, 4282, 29952, 931, 29889, 13, 1678, 396, 539, 9034, 12652, 3412, 411, 916, 4902, 964, 278, 848, 3787, 29889, 13, 1678, 396, 259, 334, 27486, 26910, 29889, 25832, 27982, 29901, 2803, 278, 2566, 5706, 5412, 10110, 2645, 3736, 11416, 13, 1678, 396, 259, 334, 27486, 26910, 29889, 29943, 28700, 29901, 12630, 740, 393, 3639, 263, 5412, 15882, 13, 1678, 3553, 3919, 11937, 29918, 10810, 3040, 29954, 29979, 353, 27486, 26910, 29889, 29965, 11150, 29889, 1767, 13, 1678, 3553, 3919, 11937, 29918, 11116, 353, 27486, 1542, 29889, 29965, 11150, 29889, 1767, 13, 13, 1678, 382, 29963, 3919, 29918, 8618, 23524, 4214, 353, 6864, 7032, 292, 29889, 3289, 29979, 15868, 29889, 1767, 13, 1678, 23353, 1529, 2797, 29918, 8618, 23524, 4214, 353, 10516, 7032, 292, 29889, 14816, 15868, 29889, 1767, 13, 13, 1678, 25401, 29954, 4214, 29918, 25903, 353, 426, 13, 4706, 376, 3259, 1115, 29871, 29896, 29892, 13, 4706, 376, 20472, 29918, 735, 15423, 29918, 1188, 5743, 1115, 7700, 29892, 13, 4706, 376, 4830, 2153, 1115, 426, 13, 9651, 376, 11058, 1115, 426, 13, 18884, 376, 4830, 1115, 11860, 29898, 294, 312, 603, 29897, 29879, 1273, 29898, 978, 6817, 29896, 29906, 29879, 1273, 29898, 5563, 978, 6817, 29947, 29879, 1273, 29898, 4906, 29897, 29879, 613, 13, 9651, 2981, 13, 4706, 2981, 13, 4706, 376, 3179, 9306, 1115, 426, 13, 9651, 376, 11058, 1115, 426, 13, 18884, 376, 5563, 1115, 376, 11690, 613, 13, 18884, 376, 1990, 1115, 376, 21027, 29889, 3835, 4598, 613, 13, 18884, 376, 689, 2620, 1115, 376, 11058, 613, 13, 9651, 2981, 13, 4706, 2981, 13, 4706, 376, 1188, 5743, 1115, 426, 13, 9651, 376, 14676, 273, 1115, 8853, 3179, 9306, 1115, 6796, 11058, 12436, 376, 5563, 1115, 376, 11690, 10758, 13, 4706, 2981, 13, 1678, 500, 13, 13, 13, 1990, 4321, 292, 3991, 29898, 3991, 1125, 13, 1678, 17067, 1254, 4214, 353, 5852, 13, 13, 13, 1990, 14650, 3991, 29898, 3991, 1125, 13, 1678, 1209, 13, 13, 13, 1990, 19561, 3991, 29898, 3991, 1125, 13, 1678, 21681, 353, 7700, 13, 2 ]
prediction.py
NII-Kobayashi/Linear_Regression
0
87098
<reponame>NII-Kobayashi/Linear_Regression # Author: <NAME> # # For license information, see LICENSE.txt """ Function for predicting the number of retweets in a future period References ---------- .. *<NAME>, ICWSM, pp. 191-200, 2016; <NAME>, Communication of the ACM 53, pp.80-88, 2010; Zhao et al., KDD, pp. 1513-1522, 2015*. """ from functions import * import math def event_prediction(alpha, var, r_t): """ predict the total number of retweets :param alpha: a parameter of linear regression (alpha) :param var: a parameter of linear regression (variance) :param r_t: the total number of tweet at the observation time :return: predicted number of retweets """ if isinstance(alpha, float): r_est = r_t * (math.exp(alpha + (var / 2.0))) return r_est else: r_est = [r_t * (math.exp(alpha[i] + (var[i] / 2.0))) for i in range(len(alpha))] return r_est
[ 1, 529, 276, 1112, 420, 29958, 29940, 2687, 29899, 29968, 711, 388, 18321, 29914, 12697, 29918, 4597, 23881, 13, 29937, 13361, 29901, 529, 5813, 29958, 13, 29937, 13, 29937, 1152, 19405, 2472, 29892, 1074, 365, 2965, 1430, 1660, 29889, 3945, 13, 13, 15945, 29908, 13, 6678, 363, 8500, 292, 278, 1353, 310, 3240, 705, 1691, 297, 263, 5434, 3785, 13, 13, 1123, 10662, 13, 28400, 13, 636, 334, 29966, 5813, 10202, 18340, 7811, 29924, 29892, 6499, 29889, 29871, 29896, 29929, 29896, 29899, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29896, 29953, 29936, 529, 5813, 10202, 22365, 362, 310, 278, 14614, 29924, 29871, 29945, 29941, 29892, 6499, 29889, 29947, 29900, 29899, 29947, 29947, 29892, 29871, 29906, 29900, 29896, 29900, 29936, 796, 2350, 29877, 634, 394, 1696, 476, 7858, 29892, 6499, 29889, 29871, 29896, 29945, 29896, 29941, 29899, 29896, 29945, 29906, 29906, 29892, 29871, 29906, 29900, 29896, 29945, 10521, 13, 15945, 29908, 13, 13, 3166, 3168, 1053, 334, 13, 5215, 5844, 13, 13, 13, 1753, 1741, 29918, 11965, 2463, 29898, 2312, 29892, 722, 29892, 364, 29918, 29873, 1125, 13, 1678, 9995, 13, 268, 8500, 278, 3001, 1353, 310, 3240, 705, 1691, 13, 1678, 584, 3207, 15595, 29901, 263, 3443, 310, 5608, 17855, 313, 2312, 29897, 13, 1678, 584, 3207, 722, 29901, 29871, 263, 3443, 310, 5608, 17855, 313, 1707, 8837, 29897, 13, 1678, 584, 3207, 364, 29918, 29873, 29901, 278, 3001, 1353, 310, 7780, 300, 472, 278, 15500, 931, 13, 1678, 584, 2457, 29901, 25383, 1353, 310, 3240, 705, 1691, 13, 1678, 9995, 13, 13, 1678, 565, 338, 8758, 29898, 2312, 29892, 5785, 1125, 13, 4706, 364, 29918, 342, 353, 364, 29918, 29873, 334, 313, 755, 29889, 4548, 29898, 2312, 718, 313, 1707, 847, 29871, 29906, 29889, 29900, 4961, 13, 4706, 736, 364, 29918, 342, 13, 1678, 1683, 29901, 13, 4706, 364, 29918, 342, 353, 518, 29878, 29918, 29873, 334, 313, 755, 29889, 4548, 29898, 2312, 29961, 29875, 29962, 718, 313, 1707, 29961, 29875, 29962, 847, 29871, 29906, 29889, 29900, 4961, 363, 474, 297, 3464, 29898, 2435, 29898, 2312, 28166, 13, 4706, 736, 364, 29918, 342, 13, 2 ]
runesanalyzer/data.py
clemsciences/runes-analyzer
5
96840
<reponame>clemsciences/runes-analyzer<filename>runesanalyzer/data.py """ Sources: - Viking Language 1 by <NAME> 2013 Unicode: 16A0–16FF Swedish runic inscriptions http://runes.verbix.com/index.html http://runes.verbix.com/vikingage/Uppland.html """ import json from runesanalyzer.runes import RunicAlphabetName, Rune, Transcriber __author__ = ["<NAME> <<EMAIL>>", ] # ᚠ ᚢ ᚦ ᚨ ᚲ ᚱ ᚷ ᚹ ᚼ ᚾ ᛁ ᛃ ᛇ ᛈ ᛉ ᛊ ᛏ ᛒ ᛖ ᛗ ᛚ ᛜ ᛟ ᛞ ELDER_FUTHARK = [ Rune(RunicAlphabetName.elder_futhark, "\u16A0", "f", "f", "fehu"), Rune(RunicAlphabetName.elder_futhark, "\u16A2", "u", "u", "uruz"), Rune(RunicAlphabetName.elder_futhark, "\u16A6", "θ", "þ", "þuriaz"), Rune(RunicAlphabetName.elder_futhark, "\u16A8", "a", "a", "ansuz"), Rune(RunicAlphabetName.elder_futhark, "\u16B1", "r", "r", "raido"), Rune(RunicAlphabetName.elder_futhark, "\u16B2", "k", "k", "kaunan"), Rune(RunicAlphabetName.elder_futhark, "\u16B7", "g", "g", "gyfu"), Rune(RunicAlphabetName.elder_futhark, "\u16B9", "w", "w", "wynn"), Rune(RunicAlphabetName.elder_futhark, "\u16BA", "h", "h", "haglaz"), Rune(RunicAlphabetName.elder_futhark, "\u16BE", "n", "n", "naudiz"), Rune(RunicAlphabetName.elder_futhark, "\u16C1", "i", "i", "isaz"), Rune(RunicAlphabetName.elder_futhark, "\u16C3", "j", "j", "jeran"), Rune(RunicAlphabetName.elder_futhark, "\u16C7", "æ", "E", "eiwaz"), Rune(RunicAlphabetName.elder_futhark, "\u16C8", "p", "p", "peorð"), Rune(RunicAlphabetName.elder_futhark, "\u16C9", "ʀ", "R", "algiz"), Rune(RunicAlphabetName.elder_futhark, "\u16CA", "s", "s", "sowilo"), Rune(RunicAlphabetName.elder_futhark, "\u16CF", "t", "t", "tiwaz"), Rune(RunicAlphabetName.elder_futhark, "\u16D2", "b", "b", "berkanan"), Rune(RunicAlphabetName.elder_futhark, "\u16D6", "e", "e", "ehwaz"), Rune(RunicAlphabetName.elder_futhark, "\u16D7", "m", "m", "mannaz"), Rune(RunicAlphabetName.elder_futhark, "\u16DA", "l", "l", "laguz"), Rune(RunicAlphabetName.elder_futhark, "\u16DC", "ŋ", "ng", "ingwaz"), Rune(RunicAlphabetName.elder_futhark, "\u16DF", "ø", "œ", "odal"), Rune(RunicAlphabetName.elder_futhark, "\u16DE", "d", "d", "dagaz"), ] # ᚠ ᚢ ᚦ ᚭ ᚱ ᚴ ᚼ ᚾ ᛁ ᛅ ᛋ ᛏ ᛒ ᛖ ᛘ ᛚ ᛦ YOUNGER_FUTHARK = [ Rune(RunicAlphabetName.younger_futhark, "\u16A0", "f", "f", "fehu"), Rune(RunicAlphabetName.younger_futhark, "\u16A2", "u", "u", "uruz"), Rune(RunicAlphabetName.younger_futhark, "\u16A6", "θ", "þ", "þuriaz"), Rune(RunicAlphabetName.younger_futhark, "\u16AD", "a", "a", "ansuz"), Rune(RunicAlphabetName.younger_futhark, "\u16B1", "r", "r", "raido"), Rune(RunicAlphabetName.younger_futhark, "\u16B4", "k", "k", "kaunan"), Rune(RunicAlphabetName.younger_futhark, "\u16BC", "h", "h", "haglaz"), Rune(RunicAlphabetName.younger_futhark, "\u16BE", "n", "n", "naudiz"), Rune(RunicAlphabetName.younger_futhark, "\u16C1", "i", "i", "isaz"), Rune(RunicAlphabetName.younger_futhark, "\u16C5", "a", "a", "jeran"), Rune(RunicAlphabetName.younger_futhark, "\u16CB", "s", "s", "sowilo"), Rune(RunicAlphabetName.younger_futhark, "\u16CF", "t", "t", "tiwaz"), Rune(RunicAlphabetName.younger_futhark, "\u16D2", "b", "b", "berkanan"), Rune(RunicAlphabetName.younger_futhark, "\u16D6", "e", "e", "ehwaz"), Rune(RunicAlphabetName.younger_futhark, "\u16D8", "m", "m", "mannaz"), # also \u16D9 Rune(RunicAlphabetName.younger_futhark, "\u16DA", "l", "l", "laguz"), Rune(RunicAlphabetName.younger_futhark, "\u16E6", "r", "R", "algiz") ] # ᚠ ᚢ ᚦ ᚭ ᚱ ᚴ ᚽ ᚿ ᛁ ᛅ ᛌ ᛐ ᛓ ᛖ ᛙ ᛚ ᛧ SHORT_TWIG_YOUNGER_FUTHARK = [ Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16A0", "f", "f", "fehu"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16A2", "u", "u", "uruz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16A6", "θ", "þ", "þuriaz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16AD", "a", "a", "ansuz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16B1", "r", "r", "raido"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16B4", "k", "k", "kaunan"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16BD", "h", "h", "haglaz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16BF", "n", "n", "naudiz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16C1", "i", "i", "isaz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16C5", "a", "a", "jeran"), # not good Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16CC", "s", "s", "sowilo"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16D0", "t", "t", "tiwaz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16D3", "b", "b", "berkanan"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16D6", "e", "e", "ehwaz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16D9", "m", "m", "mannaz"), # also \u16D9 Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16DA", "l", "l", "laguz"), Rune(RunicAlphabetName.short_twig_younger_futhark, "\u16E7", "r", "R", "algiz"), ] # https://fr.wikipedia.org/wiki/Petite_pierre_de_Jelling little_jelling_stone = "᛬ᚴᚢᚱᛘᛦ᛬ᚴᚢᚾᚢᚴᛦ᛬ᚴ(ᛅᚱ)ᚦᛁ᛬ᚴᚢᛒᛚ᛬ᚦᚢᛋᛁ᛬ᛅ(ᚠᛏ)᛬ᚦᚢᚱᚢᛁ᛬ᚴᚢᚾᚢ᛬ᛋᛁᚾᛅ᛬ᛏᛅᚾᛘᛅᚱᚴᛅᛦ᛬ᛒᚢᛏ᛬" big_jelling_stone = "ᚼᛅᚱᛅᛚᛏᚱ᛬ᚴᚢᚾᚢᚴᛦ᛬ᛒᛅᚦ᛬ᚴᛅᚢᚱᚢᛅ ᚴᚢᛒᛚ᛬ᚦᛅᚢᛋᛁ᛬ᛅᚠᛏ᛬ᚴᚢᚱᛘ ᚠᛅᚦᚢᚱ ᛋᛁᚾ ᛅᚢᚴ ᛅᚠᛏ᛬ᚦᚭᚢᚱᚢᛁ᛬ᛘᚢᚦᚢᚱ᛬ᛋᛁᚾᛅ᛬ᛋᛅ " \ "ᚼᛅᚱᛅᛚᛏᚱ(᛬)ᛁᛅᛋ᛬ᛋᚭᛦ᛫ᚢᛅᚾ᛫ᛏᛅᚾᛘᛅᚢᚱᚴ\nᛅᛚᛅ᛫ᛅᚢᚴ᛫ᚾᚢᚱᚢᛁᚴ\n᛫ᛅᚢᚴ᛫ᛏ(ᛅ)ᚾᛁ(᛫ᚴᛅᚱᚦᛁ᛫)ᚴᚱᛁᛋᛏᚾᚭ" ramsund_runestone = "ᛋᛁᚱᚦ᛬ᚴᛁᛅᚱᚦᛁ᛬ᛒᚢᚦ᛬ᚦᚭᛋᛁ᛬ᛘᚢᚦᛁᛦ᛬ᛅᛚᚱᛁᚴᛋ᛬ᛏᚢᛏᛁᛦ᛬ᚢᚱᛘᛋ᛬ᚠᚢᚱ᛬ᛋᛅᛚᚢ᛬ᚼᛅᛚᚢ᛬ᚼᚢᛚᛘᚴᛁᚱᛋ᛬ᚠᛅᚦᚢᚱ᛬ᛋᚢᚴᚱᚢᚦᛅᚱ᛬ᛒᚢᛅᛏᛅ᛬ᛋᛁᛋ" # The Ed (Boulder) Inscription from Uppland, Sweden # http://runes.verbix.com/vikingage/Uppland.html ed_inscription = "ᚱᛅᚼᚾᚢᛅᛚᛏᚱ ᛫ ᛚᛁᛏ ᛫ ᚱᛁᛋᛏᛅ ᛫ ᚱᚢᚾᛅᚱ ᛫ ᚽᚡᛦ ᛫ ᚡᛅᛋᛏᚢᛁ ᛫ ᛘᚬᚦᚢᚱ ᛫ ᛋᛁᚾᛅ ᛫ ᚬᚾᚽᛘᛋ ᛫ ᛏᚬᛏᛦ ᛫ ᛏᚬ ᛁ ᛫ " \ "ᛅᛁᚦᛁ ᛫ ᚴᚢᚦ ᚼᛁᛅᛚᛒᛁ ᛫ ᛅᚾᛏ ᛫ ᚼᚽᚾᛅ ᛫ " \ "§B ᚱᚢᚾᛅ ᛫ ᚱᛁᛋᛏᛅ ᛫ ᛚᛁᛏ ᛫ ᚱᛅᚼᚾᚢᛅᛚᛏᚱ ᛫ ᚼᚢᛅᚱ ᛅ × ᚵᚱᛁᚴᛚᛅᚾᛏᛁ ᛫ ᚢᛅᛋ ᛫ ᛚᛁᛋ ᛫ ᚡᚬᚱᚢᚾᚴᛁ ᛫" # https://en.wikipedia.org/wiki/Uppland_Runic_Inscription_448 u448 = "ᚴᚢᛚ᛫ᛅᚢᚴ᛫ᛒᛁᚢᚱᚾ᛫ᛚᛁᛏᚢ᛫ᚱᛅᛁᛋᛅ᛫ᛋᛏᛅᛁᚾ᛫ᛂᚠᛏᛁᛦ᛫ᚦᚢᚱᛋᛏᛅᛁᚾ᛫ᚠᛅᚦᚢᚱ" # https://en.wikipedia.org/wiki/Uppland_Runic_Inscription_92 u92 = "ᚴᚾᚢᛏᚱ ' ᛁ ᚢᛁᚴ'ᚼᚢᛋᚢᛘ ' ᛚᛁᛏ ' ᛋᛏᛅᛁᚾ ' ᚱᛁᛏᛅ ' ᚢᚴ ' ᛒᚱᚬ ' ᚴᛁᚱᛅ ᛫ ᛁᚡᛏᛁᛦ ' ᚡᛅᚦᚢᚱ ᚢᚴ ᛫ ᛘᚬᚦᚬᚱ ᛫ ᚢᚴ ᛫" \ " ᛒᚱᚤᚦᚱ ᛫ ᛋᛁᚾᛅ ᛫ ᚢᚴ ᛫ ᛋᚢᛋᛏᚢᚱ" sweden_runic_inscription_filename = "sweden_runes.json" def read_sweden_runes(): with open(sweden_runic_inscription_filename, "r") as f: return json.load(f) if __name__ == "__main__": print(" ".join(Rune.display_runes(ELDER_FUTHARK))) print(" ".join(Rune.display_runes(YOUNGER_FUTHARK))) print(" ".join(Rune.display_runes(SHORT_TWIG_YOUNGER_FUTHARK))) # https://sv.wikipedia.org/wiki/Upplands_runinskrifter_937 inscription = "ᚦᛁᛅᚴᚾ᛫ᛅᚢᚴ᛫ᚴᚢᚾᛅᚱ᛫ᚱᛅᛁᛋᛏᚢ᛫ᛋᛏᛅᛁᚾᛅ ᛅᚠᛏᛁᛦ᛫ᚢᛅᚱ᛫ᛒᚱᚢᚦᚢᚱ᛫ᛋᛁᚾ" print(inscription) print(Transcriber.transcribe(inscription, YOUNGER_FUTHARK)) print(little_jelling_stone) print(Transcriber.transcribe(little_jelling_stone, YOUNGER_FUTHARK)) print(big_jelling_stone) print(Transcriber.transcribe(big_jelling_stone, YOUNGER_FUTHARK)) print(ramsund_runestone) print(Transcriber.transcribe(ramsund_runestone, YOUNGER_FUTHARK))
[ 1, 529, 276, 1112, 420, 29958, 2841, 1516, 455, 2063, 29914, 3389, 267, 29899, 24209, 3298, 29966, 9507, 29958, 3389, 267, 24209, 3298, 29914, 1272, 29889, 2272, 13, 15945, 29908, 13, 29903, 2863, 29901, 13, 29899, 18503, 292, 17088, 29871, 29896, 491, 529, 5813, 29958, 29871, 29906, 29900, 29896, 29941, 13, 13, 13, 2525, 12858, 29901, 29871, 29896, 29953, 29909, 29900, 29994, 29896, 29953, 4198, 13, 29903, 8734, 728, 1065, 293, 1663, 699, 1980, 13, 1124, 597, 3389, 267, 29889, 18248, 861, 29889, 510, 29914, 2248, 29889, 1420, 13, 1124, 597, 3389, 267, 29889, 18248, 861, 29889, 510, 29914, 17064, 292, 482, 29914, 29965, 407, 1049, 29889, 1420, 13, 13, 15945, 29908, 13, 5215, 4390, 13, 3166, 1065, 267, 24209, 3298, 29889, 3389, 267, 1053, 390, 2523, 2499, 17416, 1170, 29892, 390, 1540, 29892, 4103, 699, 495, 13, 13, 1649, 8921, 1649, 353, 6796, 29966, 5813, 29958, 3532, 26862, 6227, 6778, 613, 4514, 13, 13, 13, 29937, 29871, 228, 157, 163, 29871, 228, 157, 165, 29871, 228, 157, 169, 29871, 228, 157, 171, 29871, 228, 157, 181, 29871, 228, 157, 180, 29871, 228, 157, 186, 29871, 228, 157, 188, 29871, 228, 157, 191, 29871, 228, 157, 193, 29871, 228, 158, 132, 29871, 228, 158, 134, 29871, 228, 158, 138, 29871, 228, 158, 139, 29871, 228, 158, 140, 29871, 228, 158, 141, 29871, 228, 158, 146, 29871, 228, 158, 149, 29871, 228, 158, 153, 29871, 228, 158, 154, 29871, 228, 158, 157, 29871, 228, 158, 159, 29871, 228, 158, 162, 29871, 228, 158, 161, 13, 6670, 8032, 29918, 29943, 2692, 29950, 1718, 29968, 353, 518, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29900, 613, 376, 29888, 613, 376, 29888, 613, 376, 1725, 6905, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29906, 613, 376, 29884, 613, 376, 29884, 613, 376, 332, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29953, 613, 376, 30209, 613, 376, 30340, 613, 376, 30340, 26607, 29920, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29947, 613, 376, 29874, 613, 376, 29874, 613, 376, 550, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29896, 613, 376, 29878, 613, 376, 29878, 613, 376, 336, 1941, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29906, 613, 376, 29895, 613, 376, 29895, 613, 376, 1335, 348, 273, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29955, 613, 376, 29887, 613, 376, 29887, 613, 376, 1927, 21154, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29929, 613, 376, 29893, 613, 376, 29893, 613, 376, 29893, 948, 29876, 4968, 13, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 5688, 613, 376, 29882, 613, 376, 29882, 613, 376, 29882, 351, 21051, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 15349, 613, 376, 29876, 613, 376, 29876, 613, 376, 1056, 566, 466, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29896, 613, 376, 29875, 613, 376, 29875, 613, 376, 275, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29941, 613, 376, 29926, 613, 376, 29926, 613, 376, 6846, 273, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29955, 613, 376, 30078, 613, 376, 29923, 613, 376, 29872, 9429, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29947, 613, 376, 29886, 613, 376, 29886, 613, 376, 412, 272, 30189, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29929, 613, 376, 31167, 613, 376, 29934, 613, 376, 9564, 466, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 5454, 613, 376, 29879, 613, 376, 29879, 613, 376, 29879, 340, 7820, 4968, 13, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 9207, 613, 376, 29873, 613, 376, 29873, 613, 376, 2034, 29893, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29906, 613, 376, 29890, 613, 376, 29890, 613, 376, 495, 11052, 273, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29953, 613, 376, 29872, 613, 376, 29872, 613, 376, 14797, 29893, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29955, 613, 376, 29885, 613, 376, 29885, 613, 376, 4403, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 7698, 613, 376, 29880, 613, 376, 29880, 613, 376, 3110, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 12696, 613, 376, 30519, 613, 376, 865, 613, 376, 292, 29893, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 4037, 613, 376, 30077, 613, 376, 30106, 613, 376, 397, 284, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 295, 672, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 2287, 613, 376, 29881, 613, 376, 29881, 613, 376, 24157, 834, 4968, 13, 29962, 13, 13, 13, 29937, 29871, 228, 157, 163, 29871, 228, 157, 165, 29871, 228, 157, 169, 29871, 228, 157, 176, 29871, 228, 157, 180, 29871, 228, 157, 183, 29871, 228, 157, 191, 29871, 228, 157, 193, 29871, 228, 158, 132, 29871, 228, 158, 136, 29871, 228, 158, 142, 29871, 228, 158, 146, 29871, 228, 158, 149, 29871, 228, 158, 153, 29871, 228, 158, 155, 29871, 228, 158, 157, 29871, 228, 158, 169, 13, 29979, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 353, 518, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29900, 613, 376, 29888, 613, 376, 29888, 613, 376, 1725, 6905, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29906, 613, 376, 29884, 613, 376, 29884, 613, 376, 332, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29953, 613, 376, 30209, 613, 376, 30340, 613, 376, 30340, 26607, 29920, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 3035, 613, 376, 29874, 613, 376, 29874, 613, 376, 550, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29896, 613, 376, 29878, 613, 376, 29878, 613, 376, 336, 1941, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29946, 613, 376, 29895, 613, 376, 29895, 613, 376, 1335, 348, 273, 4968, 13, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 5371, 613, 376, 29882, 613, 376, 29882, 613, 376, 29882, 351, 21051, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 15349, 613, 376, 29876, 613, 376, 29876, 613, 376, 1056, 566, 466, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29896, 613, 376, 29875, 613, 376, 29875, 613, 376, 275, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29945, 613, 376, 29874, 613, 376, 29874, 613, 376, 6846, 273, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 21685, 613, 376, 29879, 613, 376, 29879, 613, 376, 29879, 340, 7820, 4968, 13, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 9207, 613, 376, 29873, 613, 376, 29873, 613, 376, 2034, 29893, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29906, 613, 376, 29890, 613, 376, 29890, 613, 376, 495, 11052, 273, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29953, 613, 376, 29872, 613, 376, 29872, 613, 376, 14797, 29893, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29947, 613, 376, 29885, 613, 376, 29885, 613, 376, 4403, 834, 4968, 29871, 396, 884, 320, 29884, 29896, 29953, 29928, 29929, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 7698, 613, 376, 29880, 613, 376, 29880, 613, 376, 3110, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29923, 29953, 613, 376, 29878, 613, 376, 29934, 613, 376, 9564, 466, 1159, 13, 29962, 13, 13, 13, 29937, 29871, 228, 157, 163, 29871, 228, 157, 165, 29871, 228, 157, 169, 29871, 228, 157, 176, 29871, 228, 157, 180, 29871, 228, 157, 183, 29871, 228, 157, 192, 29871, 228, 157, 194, 29871, 228, 158, 132, 29871, 228, 158, 136, 29871, 228, 158, 143, 29871, 228, 158, 147, 29871, 228, 158, 150, 29871, 228, 158, 153, 29871, 228, 158, 156, 29871, 228, 158, 157, 29871, 228, 158, 170, 13, 7068, 8476, 29918, 16240, 6259, 29918, 29979, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 353, 518, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29900, 613, 376, 29888, 613, 376, 29888, 613, 376, 1725, 6905, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29906, 613, 376, 29884, 613, 376, 29884, 613, 376, 332, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29909, 29953, 613, 376, 30209, 613, 376, 30340, 613, 376, 30340, 26607, 29920, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 3035, 613, 376, 29874, 613, 376, 29874, 613, 376, 550, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29896, 613, 376, 29878, 613, 376, 29878, 613, 376, 336, 1941, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29933, 29946, 613, 376, 29895, 613, 376, 29895, 613, 376, 1335, 348, 273, 4968, 13, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29121, 613, 376, 29882, 613, 376, 29882, 613, 376, 29882, 351, 21051, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 28062, 613, 376, 29876, 613, 376, 29876, 613, 376, 1056, 566, 466, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29896, 613, 376, 29875, 613, 376, 29875, 613, 376, 275, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29907, 29945, 613, 376, 29874, 613, 376, 29874, 613, 376, 6846, 273, 4968, 29871, 396, 451, 1781, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 4174, 613, 376, 29879, 613, 376, 29879, 613, 376, 29879, 340, 7820, 4968, 13, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29900, 613, 376, 29873, 613, 376, 29873, 613, 376, 2034, 29893, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29941, 613, 376, 29890, 613, 376, 29890, 613, 376, 495, 11052, 273, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29953, 613, 376, 29872, 613, 376, 29872, 613, 376, 14797, 29893, 834, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29928, 29929, 613, 376, 29885, 613, 376, 29885, 613, 376, 4403, 834, 4968, 29871, 396, 884, 320, 29884, 29896, 29953, 29928, 29929, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 7698, 613, 376, 29880, 613, 376, 29880, 613, 376, 3110, 3365, 4968, 13, 1678, 390, 1540, 29898, 29934, 2523, 2499, 17416, 1170, 29889, 12759, 29918, 7516, 335, 29918, 6293, 865, 261, 29918, 29888, 2806, 935, 29892, 6634, 29884, 29896, 29953, 29923, 29955, 613, 376, 29878, 613, 376, 29934, 613, 376, 9564, 466, 4968, 13, 29962, 13, 13, 13, 29937, 2045, 597, 1341, 29889, 6011, 29889, 990, 29914, 4594, 29914, 29925, 300, 568, 29918, 29886, 6349, 29918, 311, 29918, 29967, 7807, 13, 29880, 1992, 29918, 29926, 7807, 29918, 12734, 353, 376, 228, 158, 175, 228, 157, 183, 228, 157, 165, 228, 157, 180, 228, 158, 155, 228, 158, 169, 228, 158, 175, 228, 157, 183, 228, 157, 165, 228, 157, 193, 228, 157, 165, 228, 157, 183, 228, 158, 169, 228, 158, 175, 228, 157, 183, 29898, 228, 158, 136, 228, 157, 180, 29897, 228, 157, 169, 228, 158, 132, 228, 158, 175, 228, 157, 183, 228, 157, 165, 228, 158, 149, 228, 158, 157, 228, 158, 175, 228, 157, 169, 228, 157, 165, 228, 158, 142, 228, 158, 132, 228, 158, 175, 228, 158, 136, 29898, 228, 157, 163, 228, 158, 146, 29897, 228, 158, 175, 228, 157, 169, 228, 157, 165, 228, 157, 180, 228, 157, 165, 228, 158, 132, 228, 158, 175, 228, 157, 183, 228, 157, 165, 228, 157, 193, 228, 157, 165, 228, 158, 175, 228, 158, 142, 228, 158, 132, 228, 157, 193, 228, 158, 136, 228, 158, 175, 228, 158, 146, 228, 158, 136, 228, 157, 193, 228, 158, 155, 228, 158, 136, 228, 157, 180, 228, 157, 183, 228, 158, 136, 228, 158, 169, 228, 158, 175, 228, 158, 149, 228, 157, 165, 228, 158, 146, 228, 158, 175, 29908, 13, 3752, 29918, 29926, 7807, 29918, 12734, 353, 376, 228, 157, 191, 228, 158, 136, 228, 157, 180, 228, 158, 136, 228, 158, 157, 228, 158, 146, 228, 157, 180, 228, 158, 175, 228, 157, 183, 228, 157, 165, 228, 157, 193, 228, 157, 165, 228, 157, 183, 228, 158, 169, 228, 158, 175, 228, 158, 149, 228, 158, 136, 228, 157, 169, 228, 158, 175, 228, 157, 183, 228, 158, 136, 228, 157, 165, 228, 157, 180, 228, 157, 165, 228, 158, 136, 29871, 228, 157, 183, 228, 157, 165, 228, 158, 149, 228, 158, 157, 228, 158, 175, 228, 157, 169, 228, 158, 136, 228, 157, 165, 228, 158, 142, 228, 158, 132, 228, 158, 175, 228, 158, 136, 228, 157, 163, 228, 158, 146, 228, 158, 175, 228, 157, 183, 228, 157, 165, 228, 157, 180, 228, 158, 155, 29871, 228, 157, 163, 228, 158, 136, 228, 157, 169, 228, 157, 165, 228, 157, 180, 29871, 228, 158, 142, 228, 158, 132, 228, 157, 193, 29871, 228, 158, 136, 228, 157, 165, 228, 157, 183, 29871, 228, 158, 136, 228, 157, 163, 228, 158, 146, 228, 158, 175, 228, 157, 169, 228, 157, 176, 228, 157, 165, 228, 157, 180, 228, 157, 165, 228, 158, 132, 228, 158, 175, 228, 158, 155, 228, 157, 165, 228, 157, 169, 228, 157, 165, 228, 157, 180, 228, 158, 175, 228, 158, 142, 228, 158, 132, 228, 157, 193, 228, 158, 136, 228, 158, 175, 228, 158, 142, 228, 158, 136, 376, 320, 13, 462, 1678, 376, 228, 157, 191, 228, 158, 136, 228, 157, 180, 228, 158, 136, 228, 158, 157, 228, 158, 146, 228, 157, 180, 29898, 228, 158, 175, 29897, 228, 158, 132, 228, 158, 136, 228, 158, 142, 228, 158, 175, 228, 158, 142, 228, 157, 176, 228, 158, 169, 228, 158, 174, 228, 157, 165, 228, 158, 136, 228, 157, 193, 228, 158, 174, 228, 158, 146, 228, 158, 136, 228, 157, 193, 228, 158, 155, 228, 158, 136, 228, 157, 165, 228, 157, 180, 228, 157, 183, 29905, 29876, 228, 158, 136, 228, 158, 157, 228, 158, 136, 228, 158, 174, 228, 158, 136, 228, 157, 165, 228, 157, 183, 228, 158, 174, 228, 157, 193, 228, 157, 165, 228, 157, 180, 228, 157, 165, 228, 158, 132, 228, 157, 183, 29905, 29876, 228, 158, 174, 228, 158, 136, 228, 157, 165, 228, 157, 183, 228, 158, 174, 228, 158, 146, 29898, 228, 158, 136, 29897, 228, 157, 193, 228, 158, 132, 29898, 228, 158, 174, 228, 157, 183, 228, 158, 136, 228, 157, 180, 228, 157, 169, 228, 158, 132, 228, 158, 174, 29897, 228, 157, 183, 228, 157, 180, 228, 158, 132, 228, 158, 142, 228, 158, 146, 228, 157, 193, 228, 157, 176, 29908, 13, 13, 25402, 870, 29918, 3389, 27744, 353, 376, 228, 158, 142, 228, 158, 132, 228, 157, 180, 228, 157, 169, 228, 158, 175, 228, 157, 183, 228, 158, 132, 228, 158, 136, 228, 157, 180, 228, 157, 169, 228, 158, 132, 228, 158, 175, 228, 158, 149, 228, 157, 165, 228, 157, 169, 228, 158, 175, 228, 157, 169, 228, 157, 176, 228, 158, 142, 228, 158, 132, 228, 158, 175, 228, 158, 155, 228, 157, 165, 228, 157, 169, 228, 158, 132, 228, 158, 169, 228, 158, 175, 228, 158, 136, 228, 158, 157, 228, 157, 180, 228, 158, 132, 228, 157, 183, 228, 158, 142, 228, 158, 175, 228, 158, 146, 228, 157, 165, 228, 158, 146, 228, 158, 132, 228, 158, 169, 228, 158, 175, 228, 157, 165, 228, 157, 180, 228, 158, 155, 228, 158, 142, 228, 158, 175, 228, 157, 163, 228, 157, 165, 228, 157, 180, 228, 158, 175, 228, 158, 142, 228, 158, 136, 228, 158, 157, 228, 157, 165, 228, 158, 175, 228, 157, 191, 228, 158, 136, 228, 158, 157, 228, 157, 165, 228, 158, 175, 228, 157, 191, 228, 157, 165, 228, 158, 157, 228, 158, 155, 228, 157, 183, 228, 158, 132, 228, 157, 180, 228, 158, 142, 228, 158, 175, 228, 157, 163, 228, 158, 136, 228, 157, 169, 228, 157, 165, 228, 157, 180, 228, 158, 175, 228, 158, 142, 228, 157, 165, 228, 157, 183, 228, 157, 180, 228, 157, 165, 228, 157, 169, 228, 158, 136, 228, 157, 180, 228, 158, 175, 228, 158, 149, 228, 157, 165, 228, 158, 136, 228, 158, 146, 228, 158, 136, 228, 158, 175, 228, 158, 142, 228, 158, 132, 228, 158, 142, 29908, 13, 13, 29937, 450, 2155, 313, 29933, 483, 261, 29897, 13377, 3395, 515, 501, 407, 1049, 29892, 24506, 13, 29937, 1732, 597, 3389, 267, 29889, 18248, 861, 29889, 510, 29914, 17064, 292, 482, 29914, 29965, 407, 1049, 29889, 1420, 13, 287, 29918, 1144, 3395, 353, 376, 228, 157, 180, 228, 158, 136, 228, 157, 191, 228, 157, 193, 228, 157, 165, 228, 158, 136, 228, 158, 157, 228, 158, 146, 228, 157, 180, 29871, 228, 158, 174, 29871, 228, 158, 157, 228, 158, 132, 228, 158, 146, 29871, 228, 158, 174, 29871, 228, 157, 180, 228, 158, 132, 228, 158, 142, 228, 158, 146, 228, 158, 136, 29871, 228, 158, 174, 29871, 228, 157, 180, 228, 157, 165, 228, 157, 193, 228, 158, 136, 228, 157, 180, 29871, 228, 158, 174, 29871, 228, 157, 192, 228, 157, 164, 228, 158, 169, 29871, 228, 158, 174, 29871, 228, 157, 164, 228, 158, 136, 228, 158, 142, 228, 158, 146, 228, 157, 165, 228, 158, 132, 29871, 228, 158, 174, 29871, 228, 158, 155, 228, 157, 175, 228, 157, 169, 228, 157, 165, 228, 157, 180, 29871, 228, 158, 174, 29871, 228, 158, 142, 228, 158, 132, 228, 157, 193, 228, 158, 136, 29871, 228, 158, 174, 29871, 228, 157, 175, 228, 157, 193, 228, 157, 192, 228, 158, 155, 228, 158, 142, 29871, 228, 158, 174, 29871, 228, 158, 146, 228, 157, 175, 228, 158, 146, 228, 158, 169, 29871, 228, 158, 174, 29871, 228, 158, 146, 228, 157, 175, 29871, 228, 158, 132, 29871, 228, 158, 174, 376, 320, 13, 462, 376, 228, 158, 136, 228, 158, 132, 228, 157, 169, 228, 158, 132, 29871, 228, 158, 174, 29871, 228, 157, 183, 228, 157, 165, 228, 157, 169, 29871, 228, 157, 191, 228, 158, 132, 228, 158, 136, 228, 158, 157, 228, 158, 149, 228, 158, 132, 29871, 228, 158, 174, 29871, 228, 158, 136, 228, 157, 193, 228, 158, 146, 29871, 228, 158, 174, 29871, 228, 157, 191, 228, 157, 192, 228, 157, 193, 228, 158, 136, 29871, 228, 158, 174, 376, 320, 13, 462, 376, 30152, 29933, 29871, 228, 157, 180, 228, 157, 165, 228, 157, 193, 228, 158, 136, 29871, 228, 158, 174, 29871, 228, 157, 180, 228, 158, 132, 228, 158, 142, 228, 158, 146, 228, 158, 136, 29871, 228, 158, 174, 29871, 228, 158, 157, 228, 158, 132, 228, 158, 146, 29871, 228, 158, 174, 29871, 228, 157, 180, 228, 158, 136, 228, 157, 191, 228, 157, 193, 228, 157, 165, 228, 158, 136, 228, 158, 157, 228, 158, 146, 228, 157, 180, 29871, 228, 158, 174, 29871, 228, 157, 191, 228, 157, 165, 228, 158, 136, 228, 157, 180, 29871, 228, 158, 136, 13105, 29871, 228, 157, 184, 228, 157, 180, 228, 158, 132, 228, 157, 183, 228, 158, 157, 228, 158, 136, 228, 157, 193, 228, 158, 146, 228, 158, 132, 29871, 228, 158, 174, 29871, 228, 157, 165, 228, 158, 136, 228, 158, 142, 29871, 228, 158, 174, 29871, 228, 158, 157, 228, 158, 132, 228, 158, 142, 29871, 228, 158, 174, 29871, 228, 157, 164, 228, 157, 175, 228, 157, 180, 228, 157, 165, 228, 157, 193, 228, 157, 183, 228, 158, 132, 29871, 228, 158, 174, 29908, 13, 13, 29937, 2045, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 29965, 407, 1049, 29918, 29934, 2523, 29918, 797, 22371, 29918, 29946, 29946, 29947, 13, 29884, 29946, 29946, 29947, 353, 376, 228, 157, 183, 228, 157, 165, 228, 158, 157, 228, 158, 174, 228, 158, 136, 228, 157, 165, 228, 157, 183, 228, 158, 174, 228, 158, 149, 228, 158, 132, 228, 157, 165, 228, 157, 180, 228, 157, 193, 228, 158, 174, 228, 158, 157, 228, 158, 132, 228, 158, 146, 228, 157, 165, 228, 158, 174, 228, 157, 180, 228, 158, 136, 228, 158, 132, 228, 158, 142, 228, 158, 136, 228, 158, 174, 228, 158, 142, 228, 158, 146, 228, 158, 136, 228, 158, 132, 228, 157, 193, 228, 158, 174, 228, 158, 133, 228, 157, 163, 228, 158, 146, 228, 158, 132, 228, 158, 169, 228, 158, 174, 228, 157, 169, 228, 157, 165, 228, 157, 180, 228, 158, 142, 228, 158, 146, 228, 158, 136, 228, 158, 132, 228, 157, 193, 228, 158, 174, 228, 157, 163, 228, 158, 136, 228, 157, 169, 228, 157, 165, 228, 157, 180, 29908, 13, 13, 13, 29937, 2045, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 29965, 407, 1049, 29918, 29934, 2523, 29918, 797, 22371, 29918, 29929, 29906, 13, 29884, 29929, 29906, 353, 376, 228, 157, 183, 228, 157, 193, 228, 157, 165, 228, 158, 146, 228, 157, 180, 525, 29871, 228, 158, 132, 29871, 228, 157, 165, 228, 158, 132, 228, 157, 183, 29915, 228, 157, 191, 228, 157, 165, 228, 158, 142, 228, 157, 165, 228, 158, 155, 525, 29871, 228, 158, 157, 228, 158, 132, 228, 158, 146, 525, 29871, 228, 158, 142, 228, 158, 146, 228, 158, 136, 228, 158, 132, 228, 157, 193, 525, 29871, 228, 157, 180, 228, 158, 132, 228, 158, 146, 228, 158, 136, 525, 29871, 228, 157, 165, 228, 157, 183, 525, 29871, 228, 158, 149, 228, 157, 180, 228, 157, 175, 525, 29871, 228, 157, 183, 228, 158, 132, 228, 157, 180, 228, 158, 136, 29871, 228, 158, 174, 29871, 228, 158, 132, 228, 157, 164, 228, 158, 146, 228, 158, 132, 228, 158, 169, 525, 29871, 228, 157, 164, 228, 158, 136, 228, 157, 169, 228, 157, 165, 228, 157, 180, 29871, 228, 157, 165, 228, 157, 183, 29871, 228, 158, 174, 29871, 228, 158, 155, 228, 157, 175, 228, 157, 169, 228, 157, 175, 228, 157, 180, 29871, 228, 158, 174, 29871, 228, 157, 165, 228, 157, 183, 29871, 228, 158, 174, 29908, 320, 13, 418, 376, 29871, 228, 158, 149, 228, 157, 180, 228, 157, 167, 228, 157, 169, 228, 157, 180, 29871, 228, 158, 174, 29871, 228, 158, 142, 228, 158, 132, 228, 157, 193, 228, 158, 136, 29871, 228, 158, 174, 29871, 228, 157, 165, 228, 157, 183, 29871, 228, 158, 174, 29871, 228, 158, 142, 228, 157, 165, 228, 158, 142, 228, 158, 146, 228, 157, 165, 228, 157, 180, 29908, 13, 13, 13, 2774, 6424, 29918, 29878, 2523, 29918, 1144, 3395, 29918, 9507, 353, 376, 2774, 6424, 29918, 3389, 267, 29889, 3126, 29908, 13, 13, 13, 1753, 1303, 29918, 2774, 6424, 29918, 3389, 267, 7295, 13, 1678, 411, 1722, 29898, 2774, 6424, 29918, 29878, 2523, 29918, 1144, 3395, 29918, 9507, 29892, 376, 29878, 1159, 408, 285, 29901, 13, 4706, 736, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1596, 703, 11393, 7122, 29898, 29934, 1540, 29889, 4990, 29918, 3389, 267, 29898, 6670, 8032, 29918, 29943, 2692, 29950, 1718, 29968, 4961, 13, 1678, 1596, 703, 11393, 7122, 29898, 29934, 1540, 29889, 4990, 29918, 3389, 267, 29898, 29979, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 4961, 13, 1678, 1596, 703, 11393, 7122, 29898, 29934, 1540, 29889, 4990, 29918, 3389, 267, 29898, 7068, 8476, 29918, 16240, 6259, 29918, 29979, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 4961, 13, 13, 1678, 396, 2045, 597, 4501, 29889, 6011, 29889, 990, 29914, 4594, 29914, 29965, 407, 5252, 29918, 3389, 262, 808, 9710, 357, 29918, 29929, 29941, 29955, 13, 1678, 1663, 3395, 353, 376, 228, 157, 169, 228, 158, 132, 228, 158, 136, 228, 157, 183, 228, 157, 193, 228, 158, 174, 228, 158, 136, 228, 157, 165, 228, 157, 183, 228, 158, 174, 228, 157, 183, 228, 157, 165, 228, 157, 193, 228, 158, 136, 228, 157, 180, 228, 158, 174, 228, 157, 180, 228, 158, 136, 228, 158, 132, 228, 158, 142, 228, 158, 146, 228, 157, 165, 228, 158, 174, 228, 158, 142, 228, 158, 146, 228, 158, 136, 228, 158, 132, 228, 157, 193, 228, 158, 136, 29871, 228, 158, 136, 228, 157, 163, 228, 158, 146, 228, 158, 132, 228, 158, 169, 228, 158, 174, 228, 157, 165, 228, 158, 136, 228, 157, 180, 228, 158, 174, 228, 158, 149, 228, 157, 180, 228, 157, 165, 228, 157, 169, 228, 157, 165, 228, 157, 180, 228, 158, 174, 228, 158, 142, 228, 158, 132, 228, 157, 193, 29908, 13, 1678, 1596, 29898, 1144, 3395, 29897, 13, 1678, 1596, 29898, 4300, 699, 495, 29889, 3286, 29581, 29898, 1144, 3395, 29892, 612, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 876, 13, 1678, 1596, 29898, 29880, 1992, 29918, 29926, 7807, 29918, 12734, 29897, 13, 1678, 1596, 29898, 4300, 699, 495, 29889, 3286, 29581, 29898, 29880, 1992, 29918, 29926, 7807, 29918, 12734, 29892, 612, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 876, 13, 1678, 1596, 29898, 3752, 29918, 29926, 7807, 29918, 12734, 29897, 13, 1678, 1596, 29898, 4300, 699, 495, 29889, 3286, 29581, 29898, 3752, 29918, 29926, 7807, 29918, 12734, 29892, 612, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 876, 13, 1678, 1596, 29898, 25402, 870, 29918, 3389, 27744, 29897, 13, 1678, 1596, 29898, 4300, 699, 495, 29889, 3286, 29581, 29898, 25402, 870, 29918, 3389, 27744, 29892, 612, 29949, 3904, 17070, 29918, 29943, 2692, 29950, 1718, 29968, 876, 13, 2 ]
window_resize.py
manya1712/eye-care
0
148195
import pyautogui as pag alert = 0 class changes(): def __init__(self): self.last = 35 def change(i, obj): last = obj.last if i > 0 and i < 31: if last > 0 and last < 31: pass else: pag.hotkey('ctrl', '-') elif i > 30 and i < 51: if last > 30 and last < 51: pass else: if last > 0 and last < 31: pag.hotkey('ctrl', '+') else: pag.hotkey('ctrl', '-') elif i > 50: if last > 50: pass else: pag.hotkey('ctrl', '+') obj.last = int(i) return # def main(): # obj = changes() # while True: # success, img = cap.read() # img, faces = detector.findFaceMesh(img, draw=False) # if faces: # face = faces[0] # left_pupil = face[145] # right_pupil = face[374] # w, _info, _image = detector.findDistance( # left_pupil, right_pupil, img) # W = 6.3 # f = 600 # D = W*f/w # cvzone.putTextRect( # img, f'Distance {int(D)} cm', (face[10][0]-100, face[10][1]-20), 2, 3) # change(i=int(D), obj=obj) # cv2.imshow("Image", img) # cv2.waitKey(1) # main()
[ 1, 29871, 13, 5215, 11451, 1300, 468, 1481, 408, 10203, 13, 13, 12888, 353, 29871, 29900, 13, 13, 13, 1990, 3620, 7295, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 4230, 353, 29871, 29941, 29945, 13, 13, 13, 1753, 1735, 29898, 29875, 29892, 5446, 1125, 13, 1678, 1833, 353, 5446, 29889, 4230, 13, 1678, 565, 474, 1405, 29871, 29900, 322, 474, 529, 29871, 29941, 29896, 29901, 13, 4706, 565, 1833, 1405, 29871, 29900, 322, 1833, 529, 29871, 29941, 29896, 29901, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 10203, 29889, 8711, 1989, 877, 24220, 742, 17411, 1495, 13, 13, 1678, 25342, 474, 1405, 29871, 29941, 29900, 322, 474, 529, 29871, 29945, 29896, 29901, 13, 4706, 565, 1833, 1405, 29871, 29941, 29900, 322, 1833, 529, 29871, 29945, 29896, 29901, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 565, 1833, 1405, 29871, 29900, 322, 1833, 529, 29871, 29941, 29896, 29901, 13, 18884, 10203, 29889, 8711, 1989, 877, 24220, 742, 525, 29974, 1495, 13, 9651, 1683, 29901, 13, 18884, 10203, 29889, 8711, 1989, 877, 24220, 742, 17411, 1495, 13, 13, 1678, 25342, 474, 1405, 29871, 29945, 29900, 29901, 13, 4706, 565, 1833, 1405, 29871, 29945, 29900, 29901, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 10203, 29889, 8711, 1989, 877, 24220, 742, 525, 29974, 1495, 13, 13, 1678, 5446, 29889, 4230, 353, 938, 29898, 29875, 29897, 13, 1678, 736, 13, 13, 13, 29937, 822, 1667, 7295, 13, 29937, 268, 5446, 353, 3620, 580, 13, 29937, 268, 1550, 5852, 29901, 13, 29937, 308, 2551, 29892, 10153, 353, 2117, 29889, 949, 580, 13, 29937, 308, 10153, 29892, 17240, 353, 1439, 3019, 29889, 2886, 23360, 29924, 12094, 29898, 2492, 29892, 4216, 29922, 8824, 29897, 13, 13, 29937, 308, 565, 17240, 29901, 13, 29937, 632, 3700, 353, 17240, 29961, 29900, 29962, 13, 13, 29937, 632, 2175, 29918, 29886, 786, 309, 353, 3700, 29961, 29896, 29946, 29945, 29962, 13, 29937, 632, 1492, 29918, 29886, 786, 309, 353, 3700, 29961, 29941, 29955, 29946, 29962, 13, 13, 29937, 632, 281, 29892, 903, 3888, 29892, 903, 3027, 353, 1439, 3019, 29889, 2886, 27469, 29898, 13, 29937, 462, 2175, 29918, 29886, 786, 309, 29892, 1492, 29918, 29886, 786, 309, 29892, 10153, 29897, 13, 13, 29937, 632, 399, 353, 29871, 29953, 29889, 29941, 13, 13, 29937, 632, 285, 353, 29871, 29953, 29900, 29900, 13, 29937, 632, 360, 353, 399, 29930, 29888, 29914, 29893, 13, 13, 29937, 632, 13850, 8028, 29889, 649, 1626, 7364, 29898, 13, 29937, 462, 10153, 29892, 285, 29915, 27469, 426, 524, 29898, 29928, 2915, 7477, 742, 313, 2161, 29961, 29896, 29900, 3816, 29900, 29962, 29899, 29896, 29900, 29900, 29892, 3700, 29961, 29896, 29900, 3816, 29896, 29962, 29899, 29906, 29900, 511, 29871, 29906, 29892, 29871, 29941, 29897, 13, 13, 29937, 632, 1735, 29898, 29875, 29922, 524, 29898, 29928, 511, 5446, 29922, 5415, 29897, 13, 13, 29937, 308, 13850, 29906, 29889, 326, 4294, 703, 2940, 613, 10153, 29897, 13, 29937, 308, 13850, 29906, 29889, 10685, 2558, 29898, 29896, 29897, 13, 13, 13, 29937, 1667, 580, 13, 2 ]
restAPI/serializers.py
GarlandQ/project-2-photoshare-api
0
99915
<filename>restAPI/serializers.py from rest_framework import serializers from users.models import Profile from feed.models import Post, Comment from django.shortcuts import get_object_or_404 class ProfileSerializer(serializers.HyperlinkedModelSerializer): url = serializers.HyperlinkedIdentityField( view_name="profile-detail", read_only=True ) user = serializers.CharField(source="user.username", read_only=True) class Meta: model = Profile fields = ["id", "user", "image", "bio", "url"] class CommentSerializer(serializers.HyperlinkedModelSerializer): user = serializers.CharField(source="user.username", read_only=True) class Meta: model = Comment fields = ["user", "comment", "comment_date"] read_only_fields = ["comment_date"] class PostUserSerializer(serializers.HyperlinkedModelSerializer): url = serializers.HyperlinkedIdentityField( view_name="profile-detail", read_only=True ) user = serializers.CharField(source="user.username") class Meta: model = Profile fields = ["id", "user", "url"] class PostSerializer(serializers.HyperlinkedModelSerializer): user = PostUserSerializer(source="user.profile", read_only=True) comments = CommentSerializer(many=True, read_only=True) url = serializers.HyperlinkedIdentityField(view_name="post-detail", read_only=True) class Meta: model = Post fields = [ "id", "user", "picture", "date_posted", "comments", "description", "url", ] read_only_fields = ["date_posted"] class PostDetailSerializer(serializers.HyperlinkedModelSerializer): user = PostUserSerializer(source="user.profile", read_only=True) comments = CommentSerializer(many=True, read_only=True) url = serializers.HyperlinkedIdentityField(view_name="post-detail", read_only=True) class Meta: model = Post fields = [ "id", "user", "picture", "date_posted", "comments", "description", "url", ] read_only_fields = ["picture", "date_posted"]
[ 1, 529, 9507, 29958, 5060, 8787, 29914, 15550, 19427, 29889, 2272, 13, 3166, 1791, 29918, 4468, 1053, 7797, 19427, 13, 3166, 4160, 29889, 9794, 1053, 20802, 13, 3166, 8343, 29889, 9794, 1053, 4918, 29892, 461, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 13, 13, 13, 1990, 20802, 17679, 29898, 15550, 19427, 29889, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 3142, 353, 7797, 19427, 29889, 26322, 546, 2324, 287, 18415, 3073, 29898, 13, 4706, 1776, 29918, 978, 543, 10185, 29899, 16432, 613, 1303, 29918, 6194, 29922, 5574, 13, 1678, 1723, 13, 13, 1678, 1404, 353, 7797, 19427, 29889, 27890, 29898, 4993, 543, 1792, 29889, 6786, 613, 1303, 29918, 6194, 29922, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 20802, 13, 4706, 4235, 353, 6796, 333, 613, 376, 1792, 613, 376, 3027, 613, 376, 24840, 613, 376, 2271, 3108, 13, 13, 13, 1990, 461, 17679, 29898, 15550, 19427, 29889, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 1404, 353, 7797, 19427, 29889, 27890, 29898, 4993, 543, 1792, 29889, 6786, 613, 1303, 29918, 6194, 29922, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 461, 13, 4706, 4235, 353, 6796, 1792, 613, 376, 9342, 613, 376, 9342, 29918, 1256, 3108, 13, 4706, 1303, 29918, 6194, 29918, 9621, 353, 6796, 9342, 29918, 1256, 3108, 13, 13, 13, 1990, 4918, 2659, 17679, 29898, 15550, 19427, 29889, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 3142, 353, 7797, 19427, 29889, 26322, 546, 2324, 287, 18415, 3073, 29898, 13, 4706, 1776, 29918, 978, 543, 10185, 29899, 16432, 613, 1303, 29918, 6194, 29922, 5574, 13, 1678, 1723, 13, 13, 1678, 1404, 353, 7797, 19427, 29889, 27890, 29898, 4993, 543, 1792, 29889, 6786, 1159, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 20802, 13, 4706, 4235, 353, 6796, 333, 613, 376, 1792, 613, 376, 2271, 3108, 13, 13, 13, 1990, 4918, 17679, 29898, 15550, 19427, 29889, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 1404, 353, 4918, 2659, 17679, 29898, 4993, 543, 1792, 29889, 10185, 613, 1303, 29918, 6194, 29922, 5574, 29897, 13, 1678, 6589, 353, 461, 17679, 29898, 13011, 29922, 5574, 29892, 1303, 29918, 6194, 29922, 5574, 29897, 13, 13, 1678, 3142, 353, 7797, 19427, 29889, 26322, 546, 2324, 287, 18415, 3073, 29898, 1493, 29918, 978, 543, 2490, 29899, 16432, 613, 1303, 29918, 6194, 29922, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 4918, 13, 4706, 4235, 353, 518, 13, 9651, 376, 333, 613, 13, 9651, 376, 1792, 613, 13, 9651, 376, 12095, 613, 13, 9651, 376, 1256, 29918, 2490, 287, 613, 13, 9651, 376, 21032, 613, 13, 9651, 376, 8216, 613, 13, 9651, 376, 2271, 613, 13, 4706, 4514, 13, 4706, 1303, 29918, 6194, 29918, 9621, 353, 6796, 1256, 29918, 2490, 287, 3108, 13, 13, 13, 1990, 4918, 16570, 17679, 29898, 15550, 19427, 29889, 26322, 546, 2324, 287, 3195, 17679, 1125, 13, 1678, 1404, 353, 4918, 2659, 17679, 29898, 4993, 543, 1792, 29889, 10185, 613, 1303, 29918, 6194, 29922, 5574, 29897, 13, 1678, 6589, 353, 461, 17679, 29898, 13011, 29922, 5574, 29892, 1303, 29918, 6194, 29922, 5574, 29897, 13, 13, 1678, 3142, 353, 7797, 19427, 29889, 26322, 546, 2324, 287, 18415, 3073, 29898, 1493, 29918, 978, 543, 2490, 29899, 16432, 613, 1303, 29918, 6194, 29922, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 4918, 13, 4706, 4235, 353, 518, 13, 9651, 376, 333, 613, 13, 9651, 376, 1792, 613, 13, 9651, 376, 12095, 613, 13, 9651, 376, 1256, 29918, 2490, 287, 613, 13, 9651, 376, 21032, 613, 13, 9651, 376, 8216, 613, 13, 9651, 376, 2271, 613, 13, 4706, 4514, 13, 4706, 1303, 29918, 6194, 29918, 9621, 353, 6796, 12095, 613, 376, 1256, 29918, 2490, 287, 3108, 13, 2 ]
finances/migrations/0002_auto_20210119_1120.py
ericmuh/recruitment-system
2
63858
# Generated by Django 3.1.5 on 2021-01-19 08:20 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('finances', '0001_initial'), ('home', '0001_initial'), ] operations = [ migrations.AddField( model_name='payment', name='client', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='home.client'), ), migrations.AddField( model_name='payment', name='fee', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='finances.fee', verbose_name='Payment For'), ), migrations.AddField( model_name='payment', name='user', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Added By'), ), migrations.AddField( model_name='fee', name='job', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='home.job'), ), migrations.AddField( model_name='expense', name='user', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Entered By'), ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29941, 29889, 29896, 29889, 29945, 373, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29896, 29929, 29871, 29900, 29947, 29901, 29906, 29900, 13, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 5215, 9557, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 2847, 353, 5852, 13, 13, 1678, 9962, 353, 518, 13, 4706, 9725, 800, 29889, 2774, 932, 519, 29918, 10836, 29898, 11027, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 511, 13, 4706, 6702, 4951, 2925, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 4706, 6702, 5184, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 27825, 742, 13, 9651, 1024, 2433, 4645, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 265, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 2433, 5184, 29889, 4645, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 27825, 742, 13, 9651, 1024, 2433, 1725, 29872, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 10490, 29918, 10074, 29892, 304, 2433, 4951, 2925, 29889, 1725, 29872, 742, 26952, 29918, 978, 2433, 15467, 358, 1152, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 27825, 742, 13, 9651, 1024, 2433, 1792, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 265, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 29922, 11027, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 29892, 26952, 29918, 978, 2433, 2528, 287, 2648, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 1725, 29872, 742, 13, 9651, 1024, 2433, 9057, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 10490, 29918, 10074, 29892, 304, 2433, 5184, 29889, 9057, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 4548, 1947, 742, 13, 9651, 1024, 2433, 1792, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 265, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 29922, 11027, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 29892, 26952, 29918, 978, 2433, 10399, 287, 2648, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
src/__init__.py
chompomonim/python-graphql-example
0
34856
from sanic import Sanic from sanic.response import json, text from sanic_graphql import GraphQLView from api import schema, setup app = Sanic() @app.route("/") async def root(request): return text("Welcome! Call me via POST with graphql query in body.") @app.route("/", methods=['POST']) async def post_root(request): result = schema.execute(request.json['query']) return json(result.data) app.add_route(GraphQLView.as_view(schema=schema, graphiql=True), '/graphql') if __name__ == "__main__": setup() app.run(host="0.0.0.0", port=4000)
[ 1, 515, 9753, 293, 1053, 3087, 293, 13, 3166, 9753, 293, 29889, 5327, 1053, 4390, 29892, 1426, 13, 3166, 9753, 293, 29918, 4262, 1519, 1053, 12367, 2239, 1043, 13, 13, 3166, 7882, 1053, 10938, 29892, 6230, 13, 13, 932, 353, 3087, 293, 580, 13, 13, 29992, 932, 29889, 13134, 11974, 1159, 13, 12674, 822, 3876, 29898, 3827, 1125, 13, 1678, 736, 1426, 703, 28862, 2763, 29991, 8251, 592, 3025, 11971, 411, 3983, 1519, 2346, 297, 3573, 23157, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 613, 3519, 29922, 1839, 5438, 11287, 13, 12674, 822, 1400, 29918, 4632, 29898, 3827, 1125, 13, 1678, 1121, 353, 10938, 29889, 7978, 29898, 3827, 29889, 3126, 1839, 1972, 11287, 13, 1678, 736, 4390, 29898, 2914, 29889, 1272, 29897, 13, 13, 13, 932, 29889, 1202, 29918, 13134, 29898, 9527, 2239, 1043, 29889, 294, 29918, 1493, 29898, 11010, 29922, 11010, 29892, 3983, 29875, 1519, 29922, 5574, 511, 8207, 4262, 1519, 1495, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6230, 580, 13, 1678, 623, 29889, 3389, 29898, 3069, 543, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 613, 2011, 29922, 29946, 29900, 29900, 29900, 29897, 13, 2 ]
multilstm_tensorpack/tensorpack/dataflow/dataset/ilsvrc.py
neale/A4C
1
1615864
<filename>multilstm_tensorpack/tensorpack/dataflow/dataset/ilsvrc.py #!/usr/bin/env python # -*- coding: utf-8 -*- # File: ilsvrc.py # Author: <NAME> <<EMAIL>> import os import tarfile import cv2 import six import numpy as np import xml.etree.ElementTree as ET from ...utils import logger from ...utils.loadcaffe import get_caffe_pb from ...utils.fs import mkdir_p, download, get_dataset_path from ...utils.timer import timed_operation from ..base import RNGDataFlow __all__ = ['ILSVRCMeta', 'ILSVRC12'] CAFFE_ILSVRC12_URL = "http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz" class ILSVRCMeta(object): """ Provide methods to access metadata for ILSVRC dataset. """ def __init__(self, dir=None): if dir is None: dir = get_dataset_path('ilsvrc_metadata') self.dir = dir mkdir_p(self.dir) self.caffepb = get_caffe_pb() f = os.path.join(self.dir, 'synsets.txt') if not os.path.isfile(f): self._download_caffe_meta() def get_synset_words_1000(self): """ Returns: dict: {cls_number: cls_name} """ fname = os.path.join(self.dir, 'synset_words.txt') assert os.path.isfile(fname) lines = [x.strip() for x in open(fname).readlines()] return dict(enumerate(lines)) def get_synset_1000(self): """ Returns: dict: {cls_number: synset_id} """ fname = os.path.join(self.dir, 'synsets.txt') assert os.path.isfile(fname) lines = [x.strip() for x in open(fname).readlines()] return dict(enumerate(lines)) def _download_caffe_meta(self): fpath = download(CAFFE_ILSVRC12_URL, self.dir) tarfile.open(fpath, 'r:gz').extractall(self.dir) def get_image_list(self, name): """ Args: name (str): 'train' or 'val' or 'test' Returns: list: list of (image filename, label) """ assert name in ['train', 'val', 'test'] fname = os.path.join(self.dir, name + '.txt') assert os.path.isfile(fname) with open(fname) as f: ret = [] for line in f.readlines(): name, cls = line.strip().split() ret.append((name, int(cls))) assert len(ret) return ret def get_per_pixel_mean(self, size=None): """ Args: size (tuple): image size in (h, w). Defaults to (256, 256). Returns: np.ndarray: per-pixel mean of shape (h, w, 3 (BGR)) in range [0, 255]. """ obj = self.caffepb.BlobProto() mean_file = os.path.join(self.dir, 'imagenet_mean.binaryproto') with open(mean_file, 'rb') as f: obj.ParseFromString(f.read()) arr = np.array(obj.data).reshape((3, 256, 256)).astype('float32') arr = np.transpose(arr, [1, 2, 0]) if size is not None: arr = cv2.resize(arr, size[::-1]) return arr class ILSVRC12(RNGDataFlow): """ Produces uint8 ILSVRC12 images of shape [h, w, 3(BGR)], and a label between [0, 999], and optionally a bounding box of [xmin, ymin, xmax, ymax]. """ def __init__(self, dir, name, meta_dir=None, shuffle=None, dir_structure='original', include_bb=False): """ Args: dir (str): A directory containing a subdir named ``name``, where the original ``ILSVRC12_img_{name}.tar`` gets decompressed. name (str): 'train' or 'val' or 'test'. shuffle (bool): shuffle the dataset. Defaults to True if name=='train'. dir_structure (str): The dir structure of 'val' and 'test' directory. If is 'original', it expects the original decompressed directory, which only has list of image files (as below). If set to 'train', it expects the same two-level directory structure simlar to 'train/'. include_bb (bool): Include the bounding box. Maybe useful in training. Examples: When `dir_structure=='original'`, `dir` should have the following structure: .. code-block:: none dir/ train/ n02134418/ n02134418_198.JPEG ... ... val/ ILSVRC2012_val_00000001.JPEG ... test/ ILSVRC2012_test_00000001.JPEG ... With ILSVRC12_img_*.tar, you can use the following command to build the above structure: .. code-block:: none mkdir val && tar xvf ILSVRC12_img_val.tar -C val mkdir test && tar xvf ILSVRC12_img_test.tar -C test mkdir train && tar xvf ILSVRC12_img_train.tar -C train && cd train find -type f -name '*.tar' | parallel -P 10 'echo {} && mkdir -p {/.} && tar xf {} -C {/.}' """ assert name in ['train', 'test', 'val'], name assert os.path.isdir(dir), dir self.full_dir = os.path.join(dir, name) self.name = name assert os.path.isdir(self.full_dir), self.full_dir if shuffle is None: shuffle = name == 'train' self.shuffle = shuffle meta = ILSVRCMeta(meta_dir) self.imglist = meta.get_image_list(name) self.dir_structure = dir_structure self.synset = meta.get_synset_1000() if include_bb: bbdir = os.path.join(dir, 'bbox') if not \ isinstance(include_bb, six.string_types) else include_bb assert name == 'train', 'Bounding box only available for training' self.bblist = ILSVRC12.get_training_bbox(bbdir, self.imglist) self.include_bb = include_bb def size(self): return len(self.imglist) def get_data(self): idxs = np.arange(len(self.imglist)) add_label_to_fname = (self.name != 'train' and self.dir_structure != 'original') if self.shuffle: self.rng.shuffle(idxs) for k in idxs: fname, label = self.imglist[k] if add_label_to_fname: fname = os.path.join(self.full_dir, self.synset[label], fname) else: fname = os.path.join(self.full_dir, fname) im = cv2.imread(fname.strip(), cv2.IMREAD_COLOR) assert im is not None, fname if im.ndim == 2: im = np.expand_dims(im, 2).repeat(3, 2) if self.include_bb: bb = self.bblist[k] if bb is None: bb = [0, 0, im.shape[1] - 1, im.shape[0] - 1] yield [im, label, bb] else: yield [im, label] @staticmethod def get_training_bbox(bbox_dir, imglist): ret = [] def parse_bbox(fname): root = ET.parse(fname).getroot() size = root.find('size').getchildren() size = map(int, [size[0].text, size[1].text]) box = root.find('object').find('bndbox').getchildren() box = map(lambda x: float(x.text), box) # box[0] /= size[0] # box[1] /= size[1] # box[2] /= size[0] # box[3] /= size[1] return np.asarray(box, dtype='float32') with timed_operation('Loading Bounding Boxes ...'): cnt = 0 import tqdm for k in tqdm.trange(len(imglist)): fname = imglist[k][0] fname = fname[:-4] + 'xml' fname = os.path.join(bbox_dir, fname) try: ret.append(parse_bbox(fname)) cnt += 1 except KeyboardInterrupt: raise except: ret.append(None) logger.info("{}/{} images have bounding box.".format(cnt, len(imglist))) return ret if __name__ == '__main__': meta = ILSVRCMeta() # print(meta.get_synset_words_1000()) ds = ILSVRC12('/home/wyx/data/fake_ilsvrc/', 'train', include_bb=True, shuffle=False) ds.reset_state() for k in ds.get_data(): from IPython import embed embed() break
[ 1, 529, 9507, 29958, 4713, 16613, 29885, 29918, 20158, 4058, 29914, 20158, 4058, 29914, 1272, 1731, 29914, 24713, 29914, 2719, 29894, 2214, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 3497, 29901, 980, 4501, 2214, 29889, 2272, 13, 29937, 13361, 29901, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 5215, 2897, 13, 5215, 9913, 1445, 13, 5215, 13850, 29906, 13, 5215, 4832, 13, 5215, 12655, 408, 7442, 13, 5215, 4903, 29889, 300, 929, 29889, 2642, 9643, 408, 382, 29911, 13, 13, 3166, 2023, 13239, 1053, 17927, 13, 3166, 2023, 13239, 29889, 1359, 1113, 17615, 1053, 679, 29918, 1113, 17615, 29918, 24381, 13, 3166, 2023, 13239, 29889, 5847, 1053, 29356, 29918, 29886, 29892, 5142, 29892, 679, 29918, 24713, 29918, 2084, 13, 3166, 2023, 13239, 29889, 20404, 1053, 5335, 287, 29918, 16453, 13, 3166, 6317, 3188, 1053, 390, 9312, 1469, 17907, 13, 13, 1649, 497, 1649, 353, 6024, 6227, 7597, 10363, 19346, 742, 525, 6227, 7597, 10363, 29896, 29906, 2033, 13, 13, 5454, 4198, 29923, 29918, 6227, 7597, 10363, 29896, 29906, 29918, 4219, 353, 376, 1124, 597, 11671, 29889, 1113, 17615, 29889, 495, 27279, 4924, 29889, 990, 29914, 1113, 17615, 29918, 2719, 29894, 2214, 29896, 29906, 29889, 12637, 29889, 18828, 29908, 13, 13, 13, 1990, 17674, 7597, 10363, 19346, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 9133, 680, 3519, 304, 2130, 15562, 363, 17674, 7597, 10363, 8783, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4516, 29922, 8516, 1125, 13, 4706, 565, 4516, 338, 6213, 29901, 13, 9651, 4516, 353, 679, 29918, 24713, 29918, 2084, 877, 2719, 29894, 2214, 29918, 19635, 1495, 13, 4706, 1583, 29889, 3972, 353, 4516, 13, 4706, 29356, 29918, 29886, 29898, 1311, 29889, 3972, 29897, 13, 4706, 1583, 29889, 1113, 600, 1022, 29890, 353, 679, 29918, 1113, 17615, 29918, 24381, 580, 13, 4706, 285, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 3972, 29892, 525, 19274, 7224, 29889, 3945, 1495, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 275, 1445, 29898, 29888, 1125, 13, 9651, 1583, 3032, 10382, 29918, 1113, 17615, 29918, 7299, 580, 13, 13, 1678, 822, 679, 29918, 19274, 842, 29918, 9303, 29918, 29896, 29900, 29900, 29900, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 16969, 29901, 13, 9651, 9657, 29901, 426, 25932, 29918, 4537, 29901, 1067, 29879, 29918, 978, 29913, 13, 4706, 9995, 13, 4706, 285, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 3972, 29892, 525, 19274, 842, 29918, 9303, 29889, 3945, 1495, 13, 4706, 4974, 2897, 29889, 2084, 29889, 275, 1445, 29898, 29888, 978, 29897, 13, 4706, 3454, 353, 518, 29916, 29889, 17010, 580, 363, 921, 297, 1722, 29898, 29888, 978, 467, 949, 9012, 580, 29962, 13, 4706, 736, 9657, 29898, 15172, 29898, 9012, 876, 13, 13, 1678, 822, 679, 29918, 19274, 842, 29918, 29896, 29900, 29900, 29900, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 16969, 29901, 13, 9651, 9657, 29901, 426, 25932, 29918, 4537, 29901, 5222, 842, 29918, 333, 29913, 13, 4706, 9995, 13, 4706, 285, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 3972, 29892, 525, 19274, 7224, 29889, 3945, 1495, 13, 4706, 4974, 2897, 29889, 2084, 29889, 275, 1445, 29898, 29888, 978, 29897, 13, 4706, 3454, 353, 518, 29916, 29889, 17010, 580, 363, 921, 297, 1722, 29898, 29888, 978, 467, 949, 9012, 580, 29962, 13, 4706, 736, 9657, 29898, 15172, 29898, 9012, 876, 13, 13, 1678, 822, 903, 10382, 29918, 1113, 17615, 29918, 7299, 29898, 1311, 1125, 13, 4706, 285, 2084, 353, 5142, 29898, 5454, 4198, 29923, 29918, 6227, 7597, 10363, 29896, 29906, 29918, 4219, 29892, 1583, 29889, 3972, 29897, 13, 4706, 9913, 1445, 29889, 3150, 29898, 29888, 2084, 29892, 525, 29878, 29901, 18828, 2824, 21111, 497, 29898, 1311, 29889, 3972, 29897, 13, 13, 1678, 822, 679, 29918, 3027, 29918, 1761, 29898, 1311, 29892, 1024, 1125, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 1024, 313, 710, 1125, 525, 14968, 29915, 470, 525, 791, 29915, 470, 525, 1688, 29915, 13, 4706, 16969, 29901, 13, 9651, 1051, 29901, 1051, 310, 313, 3027, 10422, 29892, 3858, 29897, 13, 4706, 9995, 13, 4706, 4974, 1024, 297, 6024, 14968, 742, 525, 791, 742, 525, 1688, 2033, 13, 4706, 285, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 3972, 29892, 1024, 718, 15300, 3945, 1495, 13, 4706, 4974, 2897, 29889, 2084, 29889, 275, 1445, 29898, 29888, 978, 29897, 13, 4706, 411, 1722, 29898, 29888, 978, 29897, 408, 285, 29901, 13, 9651, 3240, 353, 5159, 13, 9651, 363, 1196, 297, 285, 29889, 949, 9012, 7295, 13, 18884, 1024, 29892, 1067, 29879, 353, 1196, 29889, 17010, 2141, 5451, 580, 13, 18884, 3240, 29889, 4397, 3552, 978, 29892, 938, 29898, 25932, 4961, 13, 4706, 4974, 7431, 29898, 2267, 29897, 13, 4706, 736, 3240, 13, 13, 1678, 822, 679, 29918, 546, 29918, 29886, 15711, 29918, 12676, 29898, 1311, 29892, 2159, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 2159, 313, 23583, 1125, 1967, 2159, 297, 313, 29882, 29892, 281, 467, 13109, 29879, 304, 313, 29906, 29945, 29953, 29892, 29871, 29906, 29945, 29953, 467, 13, 4706, 16969, 29901, 13, 9651, 7442, 29889, 299, 2378, 29901, 639, 29899, 29886, 15711, 2099, 310, 8267, 313, 29882, 29892, 281, 29892, 29871, 29941, 313, 29933, 14345, 876, 297, 3464, 518, 29900, 29892, 29871, 29906, 29945, 29945, 1822, 13, 4706, 9995, 13, 4706, 5446, 353, 1583, 29889, 1113, 600, 1022, 29890, 29889, 29933, 2127, 1184, 517, 580, 13, 13, 4706, 2099, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 3972, 29892, 525, 326, 5370, 300, 29918, 12676, 29889, 19541, 17529, 1495, 13, 4706, 411, 1722, 29898, 12676, 29918, 1445, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 9651, 5446, 29889, 12914, 4591, 1231, 29898, 29888, 29889, 949, 3101, 13, 4706, 3948, 353, 7442, 29889, 2378, 29898, 5415, 29889, 1272, 467, 690, 14443, 3552, 29941, 29892, 29871, 29906, 29945, 29953, 29892, 29871, 29906, 29945, 29953, 8106, 579, 668, 877, 7411, 29941, 29906, 1495, 13, 4706, 3948, 353, 7442, 29889, 3286, 4220, 29898, 2749, 29892, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29900, 2314, 13, 4706, 565, 2159, 338, 451, 6213, 29901, 13, 9651, 3948, 353, 13850, 29906, 29889, 21476, 29898, 2749, 29892, 2159, 29961, 1057, 29899, 29896, 2314, 13, 4706, 736, 3948, 13, 13, 13, 1990, 17674, 7597, 10363, 29896, 29906, 29898, 29934, 9312, 1469, 17907, 1125, 13, 1678, 9995, 13, 1678, 7138, 778, 13122, 29947, 17674, 7597, 10363, 29896, 29906, 4558, 310, 8267, 518, 29882, 29892, 281, 29892, 29871, 29941, 29898, 29933, 14345, 29897, 1402, 322, 263, 3858, 1546, 518, 29900, 29892, 29871, 29929, 29929, 29929, 1402, 13, 1678, 322, 2984, 635, 263, 3216, 292, 3800, 310, 518, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 1822, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4516, 29892, 1024, 29892, 12700, 29918, 3972, 29922, 8516, 29892, 528, 21897, 29922, 8516, 29892, 13, 462, 4516, 29918, 23905, 2433, 13492, 742, 3160, 29918, 1327, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 4516, 313, 710, 1125, 319, 3884, 6943, 263, 1014, 3972, 4257, 4954, 978, 29952, 1673, 988, 278, 13, 18884, 2441, 4954, 6227, 7597, 10363, 29896, 29906, 29918, 2492, 648, 978, 1836, 12637, 16159, 4947, 17753, 13120, 29889, 13, 9651, 1024, 313, 710, 1125, 525, 14968, 29915, 470, 525, 791, 29915, 470, 525, 1688, 4286, 13, 9651, 528, 21897, 313, 11227, 1125, 528, 21897, 278, 8783, 29889, 13, 18884, 13109, 29879, 304, 5852, 565, 1024, 1360, 29915, 14968, 4286, 13, 9651, 4516, 29918, 23905, 313, 710, 1125, 450, 4516, 3829, 310, 525, 791, 29915, 322, 525, 1688, 29915, 3884, 29889, 13, 18884, 960, 338, 525, 13492, 742, 372, 23347, 278, 2441, 17753, 13120, 13, 18884, 3884, 29892, 607, 871, 756, 1051, 310, 1967, 2066, 313, 294, 2400, 467, 13, 18884, 960, 731, 304, 525, 14968, 742, 372, 23347, 278, 1021, 1023, 29899, 5563, 13, 18884, 3884, 3829, 1027, 4675, 304, 525, 14968, 29914, 4286, 13, 9651, 3160, 29918, 1327, 313, 11227, 1125, 512, 2325, 278, 3216, 292, 3800, 29889, 7198, 5407, 297, 6694, 29889, 13, 13, 4706, 1222, 9422, 29901, 13, 13, 4706, 1932, 421, 3972, 29918, 23905, 1360, 29915, 13492, 29915, 1673, 421, 3972, 29952, 881, 505, 278, 1494, 3829, 29901, 13, 13, 4706, 6317, 775, 29899, 1271, 1057, 5642, 13, 13, 9651, 4516, 29914, 13, 795, 7945, 29914, 13, 18884, 302, 29900, 29906, 29896, 29941, 29946, 29946, 29896, 29947, 29914, 13, 462, 29871, 302, 29900, 29906, 29896, 29941, 29946, 29946, 29896, 29947, 29918, 29896, 29929, 29947, 29889, 29967, 4162, 29954, 13, 462, 29871, 2023, 13, 18884, 2023, 13, 795, 659, 29914, 13, 18884, 17674, 7597, 10363, 29906, 29900, 29896, 29906, 29918, 791, 29918, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29967, 4162, 29954, 13, 18884, 2023, 13, 795, 1243, 29914, 13, 18884, 17674, 7597, 10363, 29906, 29900, 29896, 29906, 29918, 1688, 29918, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29896, 29889, 29967, 4162, 29954, 13, 18884, 2023, 13, 13, 4706, 2973, 17674, 7597, 10363, 29896, 29906, 29918, 2492, 29918, 10521, 12637, 29892, 366, 508, 671, 278, 1494, 13, 4706, 1899, 304, 2048, 278, 2038, 3829, 29901, 13, 13, 4706, 6317, 775, 29899, 1271, 1057, 5642, 13, 13, 9651, 29356, 659, 2607, 9913, 921, 29894, 29888, 17674, 7597, 10363, 29896, 29906, 29918, 2492, 29918, 791, 29889, 12637, 448, 29907, 659, 13, 9651, 29356, 1243, 2607, 9913, 921, 29894, 29888, 17674, 7597, 10363, 29896, 29906, 29918, 2492, 29918, 1688, 29889, 12637, 448, 29907, 1243, 13, 9651, 29356, 7945, 2607, 9913, 921, 29894, 29888, 17674, 7597, 10363, 29896, 29906, 29918, 2492, 29918, 14968, 29889, 12637, 448, 29907, 7945, 2607, 14965, 7945, 13, 9651, 1284, 448, 1853, 285, 448, 978, 525, 10521, 12637, 29915, 891, 8943, 448, 29925, 29871, 29896, 29900, 525, 8057, 6571, 2607, 29356, 448, 29886, 426, 29914, 5003, 2607, 9913, 921, 29888, 6571, 448, 29907, 426, 29914, 5003, 29915, 13, 4706, 9995, 13, 4706, 4974, 1024, 297, 6024, 14968, 742, 525, 1688, 742, 525, 791, 7464, 1024, 13, 4706, 4974, 2897, 29889, 2084, 29889, 275, 3972, 29898, 3972, 511, 4516, 13, 4706, 1583, 29889, 8159, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3972, 29892, 1024, 29897, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 4974, 2897, 29889, 2084, 29889, 275, 3972, 29898, 1311, 29889, 8159, 29918, 3972, 511, 1583, 29889, 8159, 29918, 3972, 13, 4706, 565, 528, 21897, 338, 6213, 29901, 13, 9651, 528, 21897, 353, 1024, 1275, 525, 14968, 29915, 13, 4706, 1583, 29889, 845, 21897, 353, 528, 21897, 13, 4706, 12700, 353, 17674, 7597, 10363, 19346, 29898, 7299, 29918, 3972, 29897, 13, 4706, 1583, 29889, 2492, 1761, 353, 12700, 29889, 657, 29918, 3027, 29918, 1761, 29898, 978, 29897, 13, 4706, 1583, 29889, 3972, 29918, 23905, 353, 4516, 29918, 23905, 13, 4706, 1583, 29889, 19274, 842, 353, 12700, 29889, 657, 29918, 19274, 842, 29918, 29896, 29900, 29900, 29900, 580, 13, 13, 4706, 565, 3160, 29918, 1327, 29901, 13, 9651, 289, 29890, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3972, 29892, 525, 29890, 1884, 1495, 565, 451, 320, 13, 18884, 338, 8758, 29898, 2856, 29918, 1327, 29892, 4832, 29889, 1807, 29918, 8768, 29897, 1683, 3160, 29918, 1327, 13, 9651, 4974, 1024, 1275, 525, 14968, 742, 525, 29933, 12449, 3800, 871, 3625, 363, 6694, 29915, 13, 9651, 1583, 29889, 1327, 1761, 353, 17674, 7597, 10363, 29896, 29906, 29889, 657, 29918, 26495, 29918, 29890, 1884, 29898, 1327, 3972, 29892, 1583, 29889, 2492, 1761, 29897, 13, 4706, 1583, 29889, 2856, 29918, 1327, 353, 3160, 29918, 1327, 13, 13, 1678, 822, 2159, 29898, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 29889, 2492, 1761, 29897, 13, 13, 1678, 822, 679, 29918, 1272, 29898, 1311, 1125, 13, 4706, 1178, 10351, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 1311, 29889, 2492, 1761, 876, 13, 4706, 788, 29918, 1643, 29918, 517, 29918, 29888, 978, 353, 313, 1311, 29889, 978, 2804, 525, 14968, 29915, 322, 1583, 29889, 3972, 29918, 23905, 2804, 525, 13492, 1495, 13, 4706, 565, 1583, 29889, 845, 21897, 29901, 13, 9651, 1583, 29889, 29878, 865, 29889, 845, 21897, 29898, 333, 10351, 29897, 13, 4706, 363, 413, 297, 1178, 10351, 29901, 13, 9651, 285, 978, 29892, 3858, 353, 1583, 29889, 2492, 1761, 29961, 29895, 29962, 13, 9651, 565, 788, 29918, 1643, 29918, 517, 29918, 29888, 978, 29901, 13, 18884, 285, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 8159, 29918, 3972, 29892, 1583, 29889, 19274, 842, 29961, 1643, 1402, 285, 978, 29897, 13, 9651, 1683, 29901, 13, 18884, 285, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 8159, 29918, 3972, 29892, 285, 978, 29897, 13, 9651, 527, 353, 13850, 29906, 29889, 326, 949, 29898, 29888, 978, 29889, 17010, 3285, 13850, 29906, 29889, 7833, 16310, 29918, 15032, 1955, 29897, 13, 9651, 4974, 527, 338, 451, 6213, 29892, 285, 978, 13, 9651, 565, 527, 29889, 299, 326, 1275, 29871, 29906, 29901, 13, 18884, 527, 353, 7442, 29889, 18837, 29918, 6229, 29879, 29898, 326, 29892, 29871, 29906, 467, 14358, 29898, 29941, 29892, 29871, 29906, 29897, 13, 9651, 565, 1583, 29889, 2856, 29918, 1327, 29901, 13, 18884, 289, 29890, 353, 1583, 29889, 1327, 1761, 29961, 29895, 29962, 13, 18884, 565, 289, 29890, 338, 6213, 29901, 13, 462, 1678, 289, 29890, 353, 518, 29900, 29892, 29871, 29900, 29892, 527, 29889, 12181, 29961, 29896, 29962, 448, 29871, 29896, 29892, 527, 29889, 12181, 29961, 29900, 29962, 448, 29871, 29896, 29962, 13, 18884, 7709, 518, 326, 29892, 3858, 29892, 289, 29890, 29962, 13, 9651, 1683, 29901, 13, 18884, 7709, 518, 326, 29892, 3858, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 26495, 29918, 29890, 1884, 29898, 29890, 1884, 29918, 3972, 29892, 10153, 1761, 1125, 13, 4706, 3240, 353, 5159, 13, 13, 4706, 822, 6088, 29918, 29890, 1884, 29898, 29888, 978, 1125, 13, 9651, 3876, 353, 382, 29911, 29889, 5510, 29898, 29888, 978, 467, 657, 4632, 580, 13, 9651, 2159, 353, 3876, 29889, 2886, 877, 2311, 2824, 657, 11991, 580, 13, 9651, 2159, 353, 2910, 29898, 524, 29892, 518, 2311, 29961, 29900, 1822, 726, 29892, 2159, 29961, 29896, 1822, 726, 2314, 13, 13, 9651, 3800, 353, 3876, 29889, 2886, 877, 3318, 2824, 2886, 877, 29890, 299, 1884, 2824, 657, 11991, 580, 13, 9651, 3800, 353, 2910, 29898, 2892, 921, 29901, 5785, 29898, 29916, 29889, 726, 511, 3800, 29897, 13, 9651, 396, 3800, 29961, 29900, 29962, 847, 29922, 2159, 29961, 29900, 29962, 13, 9651, 396, 3800, 29961, 29896, 29962, 847, 29922, 2159, 29961, 29896, 29962, 13, 9651, 396, 3800, 29961, 29906, 29962, 847, 29922, 2159, 29961, 29900, 29962, 13, 9651, 396, 3800, 29961, 29941, 29962, 847, 29922, 2159, 29961, 29896, 29962, 13, 9651, 736, 7442, 29889, 294, 2378, 29898, 1884, 29892, 26688, 2433, 7411, 29941, 29906, 1495, 13, 13, 4706, 411, 5335, 287, 29918, 16453, 877, 23456, 350, 12449, 1952, 9100, 2023, 29374, 13, 9651, 274, 593, 353, 29871, 29900, 13, 9651, 1053, 260, 29939, 18933, 13, 9651, 363, 413, 297, 260, 29939, 18933, 29889, 509, 927, 29898, 2435, 29898, 2492, 1761, 22164, 13, 18884, 285, 978, 353, 10153, 1761, 29961, 29895, 3816, 29900, 29962, 13, 18884, 285, 978, 353, 285, 978, 7503, 29899, 29946, 29962, 718, 525, 3134, 29915, 13, 18884, 285, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 29890, 1884, 29918, 3972, 29892, 285, 978, 29897, 13, 18884, 1018, 29901, 13, 462, 1678, 3240, 29889, 4397, 29898, 5510, 29918, 29890, 1884, 29898, 29888, 978, 876, 13, 462, 1678, 274, 593, 4619, 29871, 29896, 13, 18884, 5174, 7670, 3377, 4074, 6685, 29901, 13, 462, 1678, 12020, 13, 18884, 5174, 29901, 13, 462, 1678, 3240, 29889, 4397, 29898, 8516, 29897, 13, 9651, 17927, 29889, 3888, 703, 29912, 6822, 8875, 4558, 505, 3216, 292, 3800, 1213, 29889, 4830, 29898, 20047, 29892, 7431, 29898, 2492, 1761, 4961, 13, 4706, 736, 3240, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 12700, 353, 17674, 7597, 10363, 19346, 580, 13, 1678, 396, 1596, 29898, 7299, 29889, 657, 29918, 19274, 842, 29918, 9303, 29918, 29896, 29900, 29900, 29900, 3101, 13, 13, 1678, 18031, 353, 17674, 7597, 10363, 29896, 29906, 11219, 5184, 29914, 12822, 29916, 29914, 1272, 29914, 29888, 1296, 29918, 2719, 29894, 2214, 29914, 742, 525, 14968, 742, 3160, 29918, 1327, 29922, 5574, 29892, 13, 462, 29871, 528, 21897, 29922, 8824, 29897, 13, 1678, 18031, 29889, 12071, 29918, 3859, 580, 13, 13, 1678, 363, 413, 297, 18031, 29889, 657, 29918, 1272, 7295, 13, 4706, 515, 5641, 1656, 1053, 8297, 13, 4706, 8297, 580, 13, 4706, 2867, 13, 2 ]
metafilter/webserve.py
exhuma/metafilter
0
68424
<reponame>exhuma/metafilter from flask import ( Flask, g, render_template, request, redirect, make_response, url_for, jsonify) from metafilter.model import Node, Query, Session, Tag, set_dsn from metafilter.model import queries, nodes, tags as tag_model import logging LOG = logging.getLogger(__name__) app = Flask(__name__) class FlaskConfig(object): DEBUG = True SECRET_KEY = '<KEY>' app.config.from_object(FlaskConfig()) @app.before_request def before_request(): g.sess = Session() @app.after_request def after_request(response): g.sess.commit() g.sess.close() return response @app.route('/query') @app.route('/query/<path:query>') def query(query="root"): result = nodes.subdirs(g.sess, query) if not result: result = [] result += nodes.from_incremental_query(g.sess, query) try: result = result.order_by([ Node.mimetype != 'other/directory', Node.uri]) except Exception, exc: LOG.info(exc) if request.values.get('format', '') == 'json': return jsonify(dict( result=[{'download_url': url_for('download', path=_.path)} for _ in result] )) return render_template("entries.html", entries=result, query=query) @app.route('/tags') def tags(): tags = tag_model.tag_counts(g.sess) return render_template("tags.html", tags=tags.execute()) @app.route('/delete_from_disk/<path>') def delete_from_disk(path): nodes.delete_from_disk(g.sess, path) return redirect(request.referrer) @app.route('/thumbnail/<path>') def thumbnail(path): import Image from cStringIO import StringIO node = nodes.by_path(g.sess, path) try: im = Image.open(node.uri) im.thumbnail((128, 128), Image.ANTIALIAS) tmp = StringIO() im.save(tmp, "JPEG") response = make_response(tmp.getvalue()) response.headers['Content-Type'] = 'image/jpeg' return response except Exception, exc: return str(exc) @app.route('/download/<path>') def download(path): node = nodes.by_path(g.sess, path) data = open(node.uri, 'rb').read() if request.values.get('format', '') == 'json': return jsonify( data=data.encode('base64') ) response = make_response(data) response.headers['Content-Type'] = node.mimetype return response @app.route('/set_rating', methods=["POST"]) def set_rating(): from metafilter.model.nodes import set_rating set_rating(request.form["path"], int(request.form['value'])) return "OK" @app.route('/tag_all', methods=["POST"]) def tag_all(): node_qry = nodes.from_incremental_query(g.sess, request.form["query"]) tags = [] for tagname in request.form['tags'].split(','): tagname = tagname.strip() tag = Tag.find(g.sess, tagname) if not tag: tag = Tag(tagname) tags.append(tag) for node in node_qry: if node.is_dir(): continue node.tags.extend(tags) return redirect(url_for('query', query=request.form['query'])) @app.route('/new_query', methods=["POST"]) def new_query(): qry = Query(request.form['query']) g.sess.add(qry) return redirect(request.referrer) @app.route("/") def list_queries(): qry = g.sess.query(Query) qry = qry.order_by(Query.query) return render_template("queries.html", saved_queries=qry) @app.route("/save_query", methods=["POST"]) def save_query(): old_query = request.form['id'] new_query = request.form['value'] queries.update( g.sess, old_query, new_query ) return new_query @app.route("/save_tags", methods=["POST"]) def save_tags(): uri = request.form['id'] tags_value = request.form['value'] tags = [x.strip() for x in tags_value.split(',')] nodes.set_tags( g.sess, uri, tags ) return ', '.join(tags) @app.route("/delete_query/<query>") def delete_query(query): queries.delete( g.sess, query ) return "OK" @app.route("/duplicates") def duplicates(): return render_template("duplicates.html", duplicates=nodes.duplicates(g.sess)) @app.route("/acknowledge_duplicate/<md5>") def acknowledge_duplicate(md5): nodes.acknowledge_duplicate(g.sess, md5) return redirect(url_for('duplicates')) @app.route("/view/<path:query>/<int:index>") def view(query, index=0): result = nodes.subdirs(g.sess, query) if not result: result = [] result += nodes.from_incremental_query(g.sess, query) result = filter(lambda x: x.mimetype != 'other/directory', result) try: result = result.order_by([ Node.mimetype != 'other/directory', Node.uri]) except Exception, exc: LOG.info(exc) return render_template("view.html", node=result[index], query=query, index=index, ) @app.route("/file_uri/<path:query>/<int:index>") def file_uri(query, index): """ Retrieve the file URI for the given query on the given index """ result = nodes.subdirs(g.sess, query) if not result: result = [] result += nodes.from_incremental_query(g.sess, query) result = filter(lambda x: x.mimetype in ( 'image/jpeg', 'image/png', 'image/jpg'), result) try: result = result.order_by( [Node.mimetype != 'other/directory', Node.uri ] ) except Exception, exc: LOG.info(exc) if index > len(result)-1: return jsonify(dict( url = None )) return jsonify(dict( url = url_for('download', path=result[index].path) )) @app.route("/fullscreen/<path:query>") def fullscreen(query): """ Displays an entry in a fullscreen view """ return render_template("fullscreen.html", query = query, ) if __name__ == "__main__": app.debug = True logging.basicConfig(level=logging.DEBUG) set_dsn("postgresql://filemeta:filemeta@localhost:5432/filemeta") app.run(host="0.0.0.0", port=8181, threaded=True)
[ 1, 529, 276, 1112, 420, 29958, 735, 29882, 10859, 29914, 7299, 4572, 13, 3166, 29784, 1053, 313, 13, 4706, 2379, 1278, 29892, 13, 4706, 330, 29892, 13, 4706, 4050, 29918, 6886, 29892, 13, 4706, 2009, 29892, 13, 4706, 6684, 29892, 13, 4706, 1207, 29918, 5327, 29892, 13, 4706, 3142, 29918, 1454, 29892, 13, 4706, 4390, 1598, 29897, 13, 3166, 12700, 4572, 29889, 4299, 1053, 9071, 29892, 13641, 29892, 16441, 29892, 10522, 29892, 731, 29918, 6289, 29876, 13, 3166, 12700, 4572, 29889, 4299, 1053, 9365, 29892, 7573, 29892, 8282, 408, 4055, 29918, 4299, 13, 5215, 12183, 13, 13, 14480, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 13, 1990, 2379, 1278, 3991, 29898, 3318, 1125, 13, 1678, 21681, 353, 5852, 13, 1678, 3725, 22245, 29911, 29918, 10818, 353, 12801, 10818, 16299, 13, 13, 932, 29889, 2917, 29889, 3166, 29918, 3318, 29898, 8754, 1278, 3991, 3101, 13, 13, 29992, 932, 29889, 11083, 29918, 3827, 13, 1753, 1434, 29918, 3827, 7295, 13, 1678, 330, 29889, 29879, 404, 353, 16441, 580, 13, 13, 29992, 932, 29889, 7045, 29918, 3827, 13, 1753, 1156, 29918, 3827, 29898, 5327, 1125, 13, 1678, 330, 29889, 29879, 404, 29889, 15060, 580, 13, 1678, 330, 29889, 29879, 404, 29889, 5358, 580, 13, 1678, 736, 2933, 13, 13, 29992, 932, 29889, 13134, 11219, 1972, 1495, 13, 29992, 932, 29889, 13134, 11219, 1972, 29914, 29966, 2084, 29901, 1972, 29958, 1495, 13, 1753, 2346, 29898, 1972, 543, 4632, 29908, 1125, 13, 1678, 1121, 353, 7573, 29889, 1491, 3972, 29879, 29898, 29887, 29889, 29879, 404, 29892, 2346, 29897, 13, 1678, 565, 451, 1121, 29901, 13, 4706, 1121, 353, 5159, 13, 13, 1678, 1121, 4619, 7573, 29889, 3166, 29918, 25629, 284, 29918, 1972, 29898, 29887, 29889, 29879, 404, 29892, 2346, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 1121, 353, 1121, 29889, 2098, 29918, 1609, 4197, 13, 9651, 9071, 29889, 29885, 17528, 668, 2804, 525, 1228, 29914, 12322, 742, 13, 9651, 9071, 29889, 5338, 2314, 13, 1678, 5174, 8960, 29892, 5566, 29901, 13, 4706, 25401, 29889, 3888, 29898, 735, 29883, 29897, 13, 13, 1678, 565, 2009, 29889, 5975, 29889, 657, 877, 4830, 742, 27255, 1275, 525, 3126, 2396, 13, 4706, 736, 4390, 1598, 29898, 8977, 29898, 13, 9651, 1121, 11759, 10998, 10382, 29918, 2271, 2396, 3142, 29918, 1454, 877, 10382, 742, 2224, 29922, 5396, 2084, 2915, 363, 903, 297, 1121, 29962, 13, 632, 876, 13, 13, 1678, 736, 4050, 29918, 6886, 703, 26586, 29889, 1420, 613, 9976, 29922, 2914, 29892, 2346, 29922, 1972, 29897, 13, 13, 29992, 932, 29889, 13134, 11219, 11338, 1495, 13, 1753, 8282, 7295, 13, 1678, 8282, 353, 4055, 29918, 4299, 29889, 4039, 29918, 2798, 29879, 29898, 29887, 29889, 29879, 404, 29897, 13, 1678, 736, 4050, 29918, 6886, 703, 11338, 29889, 1420, 613, 8282, 29922, 11338, 29889, 7978, 3101, 13, 13, 29992, 932, 29889, 13134, 11219, 8143, 29918, 3166, 29918, 20960, 29914, 29966, 2084, 29958, 1495, 13, 1753, 5217, 29918, 3166, 29918, 20960, 29898, 2084, 1125, 13, 1678, 7573, 29889, 8143, 29918, 3166, 29918, 20960, 29898, 29887, 29889, 29879, 404, 29892, 2224, 29897, 13, 1678, 736, 6684, 29898, 3827, 29889, 276, 3735, 29897, 13, 13, 29992, 932, 29889, 13134, 11219, 386, 21145, 29914, 29966, 2084, 29958, 1495, 13, 1753, 266, 21145, 29898, 2084, 1125, 13, 1678, 1053, 7084, 13, 1678, 515, 274, 1231, 5971, 1053, 1714, 5971, 13, 1678, 2943, 353, 7573, 29889, 1609, 29918, 2084, 29898, 29887, 29889, 29879, 404, 29892, 2224, 29897, 13, 1678, 1018, 29901, 13, 4706, 527, 353, 7084, 29889, 3150, 29898, 3177, 29889, 5338, 29897, 13, 4706, 527, 29889, 386, 21145, 3552, 29896, 29906, 29947, 29892, 29871, 29896, 29906, 29947, 511, 7084, 29889, 13566, 25758, 29902, 3289, 29897, 13, 4706, 13128, 353, 1714, 5971, 580, 13, 4706, 527, 29889, 7620, 29898, 7050, 29892, 376, 29967, 4162, 29954, 1159, 13, 4706, 2933, 353, 1207, 29918, 5327, 29898, 7050, 29889, 657, 1767, 3101, 13, 4706, 2933, 29889, 13662, 1839, 3916, 29899, 1542, 2033, 353, 525, 3027, 29914, 26568, 29915, 13, 4706, 736, 2933, 13, 1678, 5174, 8960, 29892, 5566, 29901, 13, 4706, 736, 851, 29898, 735, 29883, 29897, 13, 13, 29992, 932, 29889, 13134, 11219, 10382, 29914, 29966, 2084, 29958, 1495, 13, 1753, 5142, 29898, 2084, 1125, 13, 1678, 2943, 353, 7573, 29889, 1609, 29918, 2084, 29898, 29887, 29889, 29879, 404, 29892, 2224, 29897, 13, 1678, 848, 353, 1722, 29898, 3177, 29889, 5338, 29892, 525, 6050, 2824, 949, 580, 13, 1678, 565, 2009, 29889, 5975, 29889, 657, 877, 4830, 742, 27255, 1275, 525, 3126, 2396, 13, 4706, 736, 4390, 1598, 29898, 13, 18884, 848, 29922, 1272, 29889, 12508, 877, 3188, 29953, 29946, 1495, 13, 18884, 1723, 13, 13, 1678, 2933, 353, 1207, 29918, 5327, 29898, 1272, 29897, 13, 1678, 2933, 29889, 13662, 1839, 3916, 29899, 1542, 2033, 353, 2943, 29889, 29885, 17528, 668, 13, 1678, 736, 2933, 13, 13, 29992, 932, 29889, 13134, 11219, 842, 29918, 29741, 742, 3519, 29922, 3366, 5438, 20068, 13, 1753, 731, 29918, 29741, 7295, 13, 1678, 515, 12700, 4572, 29889, 4299, 29889, 18010, 1053, 731, 29918, 29741, 13, 1678, 731, 29918, 29741, 29898, 3827, 29889, 689, 3366, 2084, 12436, 938, 29898, 3827, 29889, 689, 1839, 1767, 25901, 13, 1678, 736, 376, 8949, 29908, 13, 13, 29992, 932, 29889, 13134, 11219, 4039, 29918, 497, 742, 3519, 29922, 3366, 5438, 20068, 13, 1753, 4055, 29918, 497, 7295, 13, 1678, 2943, 29918, 29939, 719, 353, 7573, 29889, 3166, 29918, 25629, 284, 29918, 1972, 29898, 29887, 29889, 29879, 404, 29892, 2009, 29889, 689, 3366, 1972, 20068, 13, 1678, 8282, 353, 5159, 13, 1678, 363, 4055, 978, 297, 2009, 29889, 689, 1839, 11338, 13359, 5451, 29898, 3788, 1125, 13, 4706, 4055, 978, 353, 4055, 978, 29889, 17010, 580, 13, 4706, 4055, 353, 10522, 29889, 2886, 29898, 29887, 29889, 29879, 404, 29892, 4055, 978, 29897, 13, 4706, 565, 451, 4055, 29901, 13, 9651, 4055, 353, 10522, 29898, 4039, 978, 29897, 13, 4706, 8282, 29889, 4397, 29898, 4039, 29897, 13, 13, 1678, 363, 2943, 297, 2943, 29918, 29939, 719, 29901, 13, 4706, 565, 2943, 29889, 275, 29918, 3972, 7295, 13, 9651, 6773, 13, 4706, 2943, 29889, 11338, 29889, 21843, 29898, 11338, 29897, 13, 13, 1678, 736, 6684, 29898, 2271, 29918, 1454, 877, 1972, 742, 2346, 29922, 3827, 29889, 689, 1839, 1972, 25901, 13, 13, 29992, 932, 29889, 13134, 11219, 1482, 29918, 1972, 742, 3519, 29922, 3366, 5438, 20068, 13, 1753, 716, 29918, 1972, 7295, 13, 1678, 3855, 719, 353, 13641, 29898, 3827, 29889, 689, 1839, 1972, 11287, 13, 1678, 330, 29889, 29879, 404, 29889, 1202, 29898, 29939, 719, 29897, 13, 1678, 736, 6684, 29898, 3827, 29889, 276, 3735, 29897, 13, 13, 29992, 932, 29889, 13134, 11974, 1159, 13, 1753, 1051, 29918, 339, 6358, 7295, 13, 1678, 3855, 719, 353, 330, 29889, 29879, 404, 29889, 1972, 29898, 3010, 29897, 13, 1678, 3855, 719, 353, 3855, 719, 29889, 2098, 29918, 1609, 29898, 3010, 29889, 1972, 29897, 13, 13, 1678, 736, 4050, 29918, 6886, 703, 339, 6358, 29889, 1420, 613, 7160, 29918, 339, 6358, 29922, 29939, 719, 29897, 13, 13, 29992, 932, 29889, 13134, 11974, 7620, 29918, 1972, 613, 3519, 29922, 3366, 5438, 20068, 13, 1753, 4078, 29918, 1972, 7295, 13, 1678, 2030, 29918, 1972, 353, 2009, 29889, 689, 1839, 333, 2033, 13, 1678, 716, 29918, 1972, 353, 2009, 29889, 689, 1839, 1767, 2033, 13, 1678, 9365, 29889, 5504, 29898, 330, 29889, 29879, 404, 29892, 2030, 29918, 1972, 29892, 716, 29918, 1972, 1723, 13, 1678, 736, 716, 29918, 1972, 13, 13, 29992, 932, 29889, 13134, 11974, 7620, 29918, 11338, 613, 3519, 29922, 3366, 5438, 20068, 13, 1753, 4078, 29918, 11338, 7295, 13, 1678, 21333, 353, 2009, 29889, 689, 1839, 333, 2033, 13, 1678, 8282, 29918, 1767, 353, 2009, 29889, 689, 1839, 1767, 2033, 13, 1678, 8282, 353, 518, 29916, 29889, 17010, 580, 363, 921, 297, 8282, 29918, 1767, 29889, 5451, 29317, 1495, 29962, 13, 1678, 7573, 29889, 842, 29918, 11338, 29898, 330, 29889, 29879, 404, 29892, 21333, 29892, 8282, 1723, 13, 1678, 736, 13420, 15300, 7122, 29898, 11338, 29897, 13, 13, 29992, 932, 29889, 13134, 11974, 8143, 29918, 1972, 29914, 29966, 1972, 29958, 1159, 13, 1753, 5217, 29918, 1972, 29898, 1972, 1125, 13, 1678, 9365, 29889, 8143, 29898, 330, 29889, 29879, 404, 29892, 2346, 1723, 13, 1678, 736, 376, 8949, 29908, 13, 13, 29992, 932, 29889, 13134, 11974, 20908, 15815, 1159, 13, 1753, 20955, 7295, 13, 1678, 736, 4050, 29918, 6886, 703, 20908, 15815, 29889, 1420, 613, 13, 9651, 20955, 29922, 18010, 29889, 20908, 15815, 29898, 29887, 29889, 29879, 404, 876, 13, 13, 29992, 932, 29889, 13134, 11974, 547, 3707, 5485, 29918, 20908, 5926, 29914, 29966, 3487, 29945, 29958, 1159, 13, 1753, 18145, 5485, 29918, 20908, 5926, 29898, 3487, 29945, 1125, 13, 1678, 7573, 29889, 547, 3707, 5485, 29918, 20908, 5926, 29898, 29887, 29889, 29879, 404, 29892, 22821, 29945, 29897, 13, 1678, 736, 6684, 29898, 2271, 29918, 1454, 877, 20908, 15815, 8785, 13, 13, 29992, 932, 29889, 13134, 11974, 1493, 29914, 29966, 2084, 29901, 1972, 20690, 29966, 524, 29901, 2248, 29958, 1159, 13, 1753, 1776, 29898, 1972, 29892, 2380, 29922, 29900, 1125, 13, 1678, 1121, 353, 7573, 29889, 1491, 3972, 29879, 29898, 29887, 29889, 29879, 404, 29892, 2346, 29897, 13, 1678, 565, 451, 1121, 29901, 13, 4706, 1121, 353, 5159, 13, 1678, 1121, 4619, 7573, 29889, 3166, 29918, 25629, 284, 29918, 1972, 29898, 29887, 29889, 29879, 404, 29892, 2346, 29897, 13, 1678, 1121, 353, 4175, 29898, 2892, 921, 29901, 921, 29889, 29885, 17528, 668, 2804, 525, 1228, 29914, 12322, 742, 1121, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 1121, 353, 1121, 29889, 2098, 29918, 1609, 4197, 13, 9651, 9071, 29889, 29885, 17528, 668, 2804, 525, 1228, 29914, 12322, 742, 13, 9651, 9071, 29889, 5338, 2314, 13, 1678, 5174, 8960, 29892, 5566, 29901, 13, 4706, 25401, 29889, 3888, 29898, 735, 29883, 29897, 13, 13, 1678, 736, 4050, 29918, 6886, 703, 1493, 29889, 1420, 613, 13, 9651, 2943, 29922, 2914, 29961, 2248, 1402, 13, 9651, 2346, 29922, 1972, 29892, 13, 9651, 2380, 29922, 2248, 29892, 13, 9651, 1723, 13, 13, 29992, 932, 29889, 13134, 11974, 1445, 29918, 5338, 29914, 29966, 2084, 29901, 1972, 20690, 29966, 524, 29901, 2248, 29958, 1159, 13, 1753, 934, 29918, 5338, 29898, 1972, 29892, 2380, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 278, 934, 23539, 363, 278, 2183, 2346, 373, 278, 2183, 2380, 13, 1678, 9995, 13, 1678, 1121, 353, 7573, 29889, 1491, 3972, 29879, 29898, 29887, 29889, 29879, 404, 29892, 2346, 29897, 13, 1678, 565, 451, 1121, 29901, 13, 4706, 1121, 353, 5159, 13, 1678, 1121, 4619, 7573, 29889, 3166, 29918, 25629, 284, 29918, 1972, 29898, 29887, 29889, 29879, 404, 29892, 2346, 29897, 13, 1678, 1121, 353, 4175, 29898, 2892, 921, 29901, 921, 29889, 29885, 17528, 668, 297, 313, 13, 4706, 525, 3027, 29914, 26568, 742, 13, 4706, 525, 3027, 29914, 2732, 742, 13, 4706, 525, 3027, 29914, 6173, 5477, 1121, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 1121, 353, 1121, 29889, 2098, 29918, 1609, 29898, 518, 4247, 29889, 29885, 17528, 668, 2804, 525, 1228, 29914, 12322, 742, 9071, 29889, 5338, 4514, 1723, 13, 1678, 5174, 8960, 29892, 5566, 29901, 13, 4706, 25401, 29889, 3888, 29898, 735, 29883, 29897, 13, 13, 1678, 565, 2380, 1405, 7431, 29898, 2914, 6817, 29896, 29901, 13, 4706, 736, 4390, 1598, 29898, 8977, 29898, 13, 9651, 3142, 353, 6213, 13, 632, 876, 13, 13, 1678, 736, 4390, 1598, 29898, 8977, 29898, 13, 4706, 3142, 353, 3142, 29918, 1454, 877, 10382, 742, 2224, 29922, 2914, 29961, 2248, 1822, 2084, 29897, 13, 308, 876, 13, 13, 29992, 932, 29889, 13134, 11974, 8159, 10525, 29914, 29966, 2084, 29901, 1972, 29958, 1159, 13, 1753, 2989, 10525, 29898, 1972, 1125, 13, 1678, 9995, 13, 1678, 3295, 12922, 385, 6251, 297, 263, 2989, 10525, 1776, 13, 1678, 9995, 13, 13, 1678, 736, 4050, 29918, 6886, 703, 8159, 10525, 29889, 1420, 613, 13, 9651, 2346, 353, 2346, 29892, 13, 9651, 1723, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 623, 29889, 8382, 353, 5852, 13, 1678, 12183, 29889, 16121, 3991, 29898, 5563, 29922, 21027, 29889, 18525, 29897, 13, 1678, 731, 29918, 6289, 29876, 703, 29272, 597, 1445, 7299, 29901, 1445, 7299, 29992, 7640, 29901, 29945, 29946, 29941, 29906, 29914, 1445, 7299, 1159, 13, 1678, 623, 29889, 3389, 29898, 3069, 543, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 613, 2011, 29922, 29947, 29896, 29947, 29896, 29892, 3244, 287, 29922, 5574, 29897, 13, 2 ]
src/datasets/transformer_name_replacer.py
elangovana/large-scale-ptm-ppi
1
101018
<gh_stars>1-10 import logging from typing import List, Dict class TransformerNameReplacer: """ Replaces named entity mentions in text with custom names """ @property def _logger(self): return logging.getLogger(__name__) def __call__(self, text: str, entities: List[Dict]) -> str: """ Replaces named entity mentions in text with custom names :param text: The text to replace :param entities: A list of dictionary. The dictionary should contain the keys shown below [{"charOffset": 62 , "len": 4 , "replacement": "Protein1" }] :return: The replaced string """ pos_sorted_entities = sorted(entities, key=lambda x: int(x["charOffset"])) adjustment_pos = 0 previous_data_pos, previous_data_len = -1, -1 last_replacement_end_position = 0 replaced_text = text for entity_detail in pos_sorted_entities: s_orig_pos = int(entity_detail["charOffset"]) s_pos = s_orig_pos + adjustment_pos entity_len = entity_detail["len"] e_pos = s_pos + int(entity_len) if s_orig_pos <= (previous_data_pos+previous_data_len): self._logger.info( "Skip: The position {} overlaps with previous data pos {} including len {} \n{} \n{}".format( s_orig_pos, previous_data_pos, previous_data_len, text, pos_sorted_entities )) continue else: assert s_pos >= last_replacement_end_position, "Something has gone wrong..Start position {} is <= last_replacement_end_position {}, \n{}, \n{} \n{}" \ .format(s_pos, last_replacement_end_position, text, pos_sorted_entities, s_orig_pos) replaced_substring = replaced_text[:s_pos] + entity_detail["replacement"] replaced_text = replaced_substring + replaced_text[e_pos:] previous_data_pos, previous_data_len = s_orig_pos, entity_len adjustment_pos += len(entity_detail["replacement"]) - (e_pos - s_pos) last_replacement_end_position = len(replaced_substring) return replaced_text
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 12183, 13, 3166, 19229, 1053, 2391, 29892, 360, 919, 13, 13, 13, 1990, 4103, 24784, 1170, 5612, 433, 2265, 29901, 13, 1678, 9995, 13, 1678, 10088, 6048, 4257, 7855, 26649, 297, 1426, 411, 2888, 2983, 13, 1678, 9995, 13, 13, 1678, 732, 6799, 13, 1678, 822, 903, 21707, 29898, 1311, 1125, 13, 4706, 736, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 1426, 29901, 851, 29892, 16212, 29901, 2391, 29961, 21533, 2314, 1599, 851, 29901, 13, 4706, 9995, 13, 4706, 10088, 6048, 4257, 7855, 26649, 297, 1426, 411, 2888, 2983, 13, 4706, 584, 3207, 1426, 29901, 450, 1426, 304, 5191, 13, 4706, 584, 3207, 16212, 29901, 319, 1051, 310, 8600, 29889, 450, 8600, 881, 1712, 278, 6611, 4318, 2400, 13, 462, 308, 518, 6377, 3090, 10302, 1115, 29871, 29953, 29906, 13, 462, 4706, 1919, 376, 2435, 1115, 29871, 29946, 13, 462, 4706, 1919, 376, 3445, 9552, 1115, 376, 1184, 371, 262, 29896, 29908, 13, 462, 268, 500, 29962, 13, 4706, 584, 2457, 29901, 450, 8611, 1347, 13, 4706, 9995, 13, 4706, 926, 29918, 24582, 29918, 296, 1907, 353, 12705, 29898, 296, 1907, 29892, 1820, 29922, 2892, 921, 29901, 938, 29898, 29916, 3366, 3090, 10302, 3108, 876, 13, 13, 13, 13, 4706, 10365, 358, 29918, 1066, 353, 29871, 29900, 13, 4706, 3517, 29918, 1272, 29918, 1066, 29892, 3517, 29918, 1272, 29918, 2435, 353, 448, 29896, 29892, 448, 29896, 13, 4706, 1833, 29918, 3445, 9552, 29918, 355, 29918, 3283, 353, 29871, 29900, 13, 13, 4706, 8611, 29918, 726, 353, 1426, 13, 4706, 363, 7855, 29918, 16432, 297, 926, 29918, 24582, 29918, 296, 1907, 29901, 13, 13, 9651, 269, 29918, 12683, 29918, 1066, 353, 938, 29898, 10041, 29918, 16432, 3366, 3090, 10302, 20068, 13, 9651, 269, 29918, 1066, 353, 269, 29918, 12683, 29918, 1066, 718, 10365, 358, 29918, 1066, 13, 9651, 7855, 29918, 2435, 353, 7855, 29918, 16432, 3366, 2435, 3108, 13, 9651, 321, 29918, 1066, 353, 269, 29918, 1066, 718, 938, 29898, 10041, 29918, 2435, 29897, 13, 13, 9651, 565, 269, 29918, 12683, 29918, 1066, 29871, 5277, 313, 24957, 29918, 1272, 29918, 1066, 29974, 24957, 29918, 1272, 29918, 2435, 1125, 13, 18884, 1583, 3032, 21707, 29889, 3888, 29898, 13, 462, 1678, 376, 15797, 666, 29901, 450, 2602, 6571, 975, 14128, 411, 3517, 848, 926, 6571, 3704, 7431, 6571, 320, 29876, 8875, 320, 29876, 8875, 1642, 4830, 29898, 13, 462, 4706, 269, 29918, 12683, 29918, 1066, 29892, 13, 462, 4706, 3517, 29918, 1272, 29918, 1066, 29892, 13, 462, 4706, 3517, 29918, 1272, 29918, 2435, 29892, 13, 462, 4706, 1426, 29892, 13, 462, 4706, 926, 29918, 24582, 29918, 296, 1907, 13, 462, 268, 876, 13, 18884, 6773, 13, 9651, 1683, 29901, 13, 18884, 4974, 269, 29918, 1066, 6736, 1833, 29918, 3445, 9552, 29918, 355, 29918, 3283, 29892, 376, 16804, 756, 7695, 2743, 636, 4763, 2602, 6571, 338, 5277, 1833, 29918, 3445, 9552, 29918, 355, 29918, 3283, 24335, 320, 29876, 29912, 1118, 320, 29876, 8875, 320, 29876, 29912, 5038, 320, 13, 462, 1678, 869, 4830, 29898, 29879, 29918, 1066, 29892, 1833, 29918, 3445, 9552, 29918, 355, 29918, 3283, 29892, 1426, 29892, 13, 462, 9651, 926, 29918, 24582, 29918, 296, 1907, 29892, 269, 29918, 12683, 29918, 1066, 29897, 13, 13, 9651, 8611, 29918, 20363, 353, 8611, 29918, 726, 7503, 29879, 29918, 1066, 29962, 718, 7855, 29918, 16432, 3366, 3445, 9552, 3108, 13, 9651, 8611, 29918, 726, 353, 8611, 29918, 20363, 718, 8611, 29918, 726, 29961, 29872, 29918, 1066, 17531, 13, 9651, 3517, 29918, 1272, 29918, 1066, 29892, 3517, 29918, 1272, 29918, 2435, 353, 269, 29918, 12683, 29918, 1066, 29892, 7855, 29918, 2435, 13, 13, 9651, 10365, 358, 29918, 1066, 4619, 7431, 29898, 10041, 29918, 16432, 3366, 3445, 9552, 20068, 448, 313, 29872, 29918, 1066, 448, 269, 29918, 1066, 29897, 13, 13, 9651, 1833, 29918, 3445, 9552, 29918, 355, 29918, 3283, 353, 7431, 29898, 3445, 433, 1133, 29918, 20363, 29897, 13, 13, 4706, 736, 8611, 29918, 726, 13, 2 ]
main.py
KuanS/DL_template
0
55831
from utils.initLog import initLog def main_function(): logger = initLog('dev', '/home/kuan/DL_template') logger.critical('CRITICAL') logger.fatal('FATAL') logger.error('ERROR') logger.warning('WARNING') logger.info('INFO') logger.debug('DEBUG') if __name__ == '__main__': main_function()
[ 1, 515, 3667, 29879, 29889, 2344, 3403, 1053, 2069, 3403, 13, 13, 13, 1753, 1667, 29918, 2220, 7295, 13, 29871, 17927, 353, 2069, 3403, 877, 3359, 742, 8207, 5184, 29914, 2120, 273, 29914, 19558, 29918, 6886, 1495, 13, 13, 29871, 17927, 29889, 9695, 936, 877, 11341, 1806, 2965, 1964, 1495, 13, 29871, 17927, 29889, 29888, 2075, 877, 29943, 1299, 1964, 1495, 13, 29871, 17927, 29889, 2704, 877, 11432, 1495, 13, 29871, 17927, 29889, 27392, 877, 29956, 25614, 1495, 13, 29871, 17927, 29889, 3888, 877, 11690, 1495, 13, 29871, 17927, 29889, 8382, 877, 18525, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 29871, 1667, 29918, 2220, 580, 13, 2 ]
resseg/parcellation.py
fepegar/resseg
3
107667
from pathlib import Path import numpy as np import pandas as pd import nibabel as nib import matplotlib.pyplot as plt import matplotlib.ticker as mtick color_tables_dir = Path(__file__).parent class Parcellation: def __init__(self, parcellation_path): self.parcellation_path = Path(parcellation_path) self._label_map = None @property def label_map(self): if self._label_map is None: label_map_nii = nib.load(self.parcellation_path) self._label_map = label_map_nii.get_data().astype(np.uint16) return self._label_map def get_resected_structures(self, resection_seg_path, ignore=None): if ignore is None: ignore = [] resected_dict = self.get_resected_labels_and_counts(resection_seg_path) structures = [] for resected_number, num_voxels_resected in resected_dict.items(): structure_name = self.color_table.get_structure_from_label_number( resected_number) ignore_this = False for substring_to_ignore in ignore: if substring_to_ignore in structure_name: ignore_this = True break if ignore_this: continue num_voxels_parcellation = np.count_nonzero( self.label_map == resected_number) ratio = num_voxels_resected / num_voxels_parcellation structures.append(( structure_name, num_voxels_resected, ratio, )) return list(zip(*structures)) def get_resected_labels_and_counts(self, resection_seg_path): mask_nii = nib.load(resection_seg_path) mask = mask_nii.get_data() > 0 masked_values = self.label_map[mask] unique, counts = np.unique(masked_values, return_counts=True) resected_dict = dict(zip(unique, counts)) return resected_dict def print_percentage_of_resected_structures(self, resection_seg_path, hide_zeros=True): structures, voxels, ratios = self.get_resected_structures( resection_seg_path) sort_by_ratio = np.argsort(ratios) print('Percentage of each resected structure:') for idx in reversed(sort_by_ratio): ratio = ratios[idx] structure = structures[idx] percentage = int(ratio * 100) if percentage == 0 and hide_zeros: continue structure_pretty = structure.replace('-', ' ') print(f'{percentage:3}% of {structure_pretty}') print() sort_by_voxels = np.argsort(voxels) total_voxels = sum(voxels) print('The resection volume is composed of:') for idx in reversed(sort_by_voxels): ratio = voxels[idx] / total_voxels structure = structures[idx] percentage = int(ratio * 100) if percentage == 0 and hide_zeros: continue structure_pretty = structure.replace('-', ' ') print(f'{percentage:3}% is {structure_pretty}') def plot_pie( self, resection_seg_path, title=None, show=True, pct_threshold=2, output_path=None, ignore=None, ): names, voxels, _ = self.get_resected_structures( resection_seg_path, ignore=ignore) colors = [ self.color_table.get_color_from_structure_name(name) for name in names ] fig, ax = plt.subplots() sort_by_voxels = np.argsort(voxels)[::-1] # descending order voxels = np.array(voxels)[sort_by_voxels] percentages = (voxels / voxels.sum()) * 100 names = np.array(names)[sort_by_voxels] colors = np.array(colors)[sort_by_voxels] # Hide some values def my_autopct(pct): return f'{int(pct)}%' if pct > pct_threshold else '' labels = names[:] for i, pct in enumerate(percentages): if pct <= pct_threshold: labels[i] = '' ax.pie( percentages, labels=labels, colors=colors, shadow=False, autopct=my_autopct, pctdistance=0.7, ) if title is not None: ax.set_title(title) plt.tight_layout() if output_path is not None: fig.savefig(output_path, dpi=400) if show: plt.show() return fig def plot_bars( self, resection_seg_path, title=None, show=True, output_path=None, ignore=None, ): names, _, ratios = self.get_resected_structures( resection_seg_path, ignore=ignore) colors = [ self.color_table.get_color_from_structure_name(name) for name in names ] fig, ax = plt.subplots() sort_by_ratios = np.argsort(ratios) ratios = np.array(ratios)[sort_by_ratios] percentages = ratios * 100 names = np.array(names)[sort_by_ratios] colors = np.array(colors)[sort_by_ratios] y_pos = np.arange(len(names)) ax.barh( y_pos, percentages, align='center', color=colors, tick_label=names, ) ax.set_axisbelow(True) # https://stackoverflow.com/a/39039520 ax.grid() ax.set_xlim((0, 105)) ax.xaxis.set_major_formatter(mtick.PercentFormatter()) if title is not None: ax.set_title(title) plt.tight_layout() if output_path is not None: fig.savefig(output_path, dpi=400) if show: plt.show() return fig def is_valid_number(self, number): return self.color_table.is_valid_number(number) class GIFParcellation(Parcellation): def __init__(self, parcellation_path): Parcellation.__init__(self, parcellation_path) self.color_table = GIFColorTable() class FreeSurferParcellation(Parcellation): def __init__(self, parcellation_path): Parcellation.__init__(self, parcellation_path) self.color_table = FreeSurferColorTable() class ColorTable: def __init__(self): self.fieldnames = ( 'structure', 'red', 'green', 'blue', 'alpha', ) def get_value_from_label_number(self, label_number, key): try: value = self._data_frame.loc[label_number][key] except KeyError: value = f'[Unkown label: {label_number}]' return value def get_row_from_structure_name(self, name): mask = self._data_frame['structure'] == name row = self._data_frame.loc[mask] return row def get_value_from_structure_name(self, name, key): row = self.get_row_from_structure_name(name) value = row[key] return value def get_structure_from_label_number(self, label_number): return self.get_value_from_label_number(label_number, 'structure') def get_color_from_structure_name(self, name): row = self.get_row_from_structure_name(name) if row.empty: color = 0, 0, 0 else: color = [row[c].values for c in ('red', 'green', 'blue')] color = np.hstack(color) color = np.array(color) / 255 return color def is_valid_number(self, number): return number in self._data_frame.index class GIFColorTable(ColorTable): def __init__(self): ColorTable.__init__(self) self.color_table_path = color_tables_dir / 'BrainAnatomyLabelsV3_0.txt' self._data_frame = self.read_color_table() def read_color_table(self): df = pd.read_csv( self.color_table_path, index_col=0, names=self.fieldnames, sep=r'\s+', # there is a double space in the file ) return df class FreeSurferColorTable(ColorTable): def __init__(self): ColorTable.__init__(self) self.color_table_path = color_tables_dir / 'FreeSurferLabels.ctbl' self._data_frame = self.read_color_table() def read_color_table(self): df = pd.read_csv( self.color_table_path, index_col=0, names=self.fieldnames, sep=r'\s+', skiprows=2, ) return df
[ 1, 515, 2224, 1982, 1053, 10802, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 302, 747, 1107, 408, 302, 747, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 22889, 29889, 29873, 6541, 408, 286, 24667, 13, 13, 13, 2780, 29918, 24051, 29918, 3972, 353, 10802, 22168, 1445, 1649, 467, 3560, 13, 13, 13, 1990, 1459, 22603, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 610, 22603, 29918, 2084, 1125, 13, 4706, 1583, 29889, 862, 22603, 29918, 2084, 353, 10802, 29898, 862, 22603, 29918, 2084, 29897, 13, 4706, 1583, 3032, 1643, 29918, 1958, 353, 6213, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3858, 29918, 1958, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 1643, 29918, 1958, 338, 6213, 29901, 13, 9651, 3858, 29918, 1958, 29918, 1240, 29875, 353, 302, 747, 29889, 1359, 29898, 1311, 29889, 862, 22603, 29918, 2084, 29897, 13, 9651, 1583, 3032, 1643, 29918, 1958, 353, 3858, 29918, 1958, 29918, 1240, 29875, 29889, 657, 29918, 1272, 2141, 579, 668, 29898, 9302, 29889, 13470, 29896, 29953, 29897, 13, 4706, 736, 1583, 3032, 1643, 29918, 1958, 13, 13, 1678, 822, 679, 29918, 690, 26458, 29918, 4984, 1973, 29898, 1311, 29892, 620, 9739, 29918, 10199, 29918, 2084, 29892, 11455, 29922, 8516, 1125, 13, 4706, 565, 11455, 338, 6213, 29901, 13, 9651, 11455, 353, 5159, 13, 4706, 620, 26458, 29918, 8977, 353, 1583, 29889, 657, 29918, 690, 26458, 29918, 21134, 29918, 392, 29918, 2798, 29879, 29898, 690, 9739, 29918, 10199, 29918, 2084, 29897, 13, 4706, 12286, 353, 5159, 13, 4706, 363, 620, 26458, 29918, 4537, 29892, 954, 29918, 1365, 29916, 1379, 29918, 690, 26458, 297, 620, 26458, 29918, 8977, 29889, 7076, 7295, 13, 9651, 3829, 29918, 978, 353, 1583, 29889, 2780, 29918, 2371, 29889, 657, 29918, 23905, 29918, 3166, 29918, 1643, 29918, 4537, 29898, 13, 18884, 620, 26458, 29918, 4537, 29897, 13, 9651, 11455, 29918, 1366, 353, 7700, 13, 9651, 363, 28228, 29918, 517, 29918, 17281, 297, 11455, 29901, 13, 18884, 565, 28228, 29918, 517, 29918, 17281, 297, 3829, 29918, 978, 29901, 13, 462, 1678, 11455, 29918, 1366, 353, 5852, 13, 462, 1678, 2867, 13, 9651, 565, 11455, 29918, 1366, 29901, 13, 18884, 6773, 13, 9651, 954, 29918, 1365, 29916, 1379, 29918, 862, 22603, 353, 7442, 29889, 2798, 29918, 5464, 9171, 29898, 13, 18884, 1583, 29889, 1643, 29918, 1958, 1275, 620, 26458, 29918, 4537, 29897, 13, 9651, 11959, 353, 954, 29918, 1365, 29916, 1379, 29918, 690, 26458, 847, 954, 29918, 1365, 29916, 1379, 29918, 862, 22603, 13, 9651, 12286, 29889, 4397, 3552, 13, 18884, 3829, 29918, 978, 29892, 13, 18884, 954, 29918, 1365, 29916, 1379, 29918, 690, 26458, 29892, 13, 18884, 11959, 29892, 13, 632, 876, 13, 4706, 736, 1051, 29898, 7554, 10456, 4984, 1973, 876, 13, 13, 1678, 822, 679, 29918, 690, 26458, 29918, 21134, 29918, 392, 29918, 2798, 29879, 29898, 1311, 29892, 620, 9739, 29918, 10199, 29918, 2084, 1125, 13, 4706, 11105, 29918, 1240, 29875, 353, 302, 747, 29889, 1359, 29898, 690, 9739, 29918, 10199, 29918, 2084, 29897, 13, 4706, 11105, 353, 11105, 29918, 1240, 29875, 29889, 657, 29918, 1272, 580, 1405, 29871, 29900, 13, 4706, 11105, 287, 29918, 5975, 353, 1583, 29889, 1643, 29918, 1958, 29961, 13168, 29962, 13, 13, 4706, 5412, 29892, 18139, 353, 7442, 29889, 13092, 29898, 13168, 287, 29918, 5975, 29892, 736, 29918, 2798, 29879, 29922, 5574, 29897, 13, 4706, 620, 26458, 29918, 8977, 353, 9657, 29898, 7554, 29898, 13092, 29892, 18139, 876, 13, 4706, 736, 620, 26458, 29918, 8977, 13, 13, 1678, 822, 1596, 29918, 25376, 482, 29918, 974, 29918, 690, 26458, 29918, 4984, 1973, 29898, 1311, 29892, 13, 462, 462, 18884, 620, 9739, 29918, 10199, 29918, 2084, 29892, 13, 462, 462, 18884, 9563, 29918, 3298, 359, 29922, 5574, 1125, 13, 4706, 12286, 29892, 992, 29916, 1379, 29892, 364, 2219, 359, 353, 1583, 29889, 657, 29918, 690, 26458, 29918, 4984, 1973, 29898, 13, 9651, 620, 9739, 29918, 10199, 29918, 2084, 29897, 13, 4706, 2656, 29918, 1609, 29918, 3605, 601, 353, 7442, 29889, 5085, 441, 29898, 29878, 2219, 359, 29897, 13, 4706, 1596, 877, 27933, 482, 310, 1269, 620, 26458, 3829, 29901, 1495, 13, 4706, 363, 22645, 297, 18764, 287, 29898, 6605, 29918, 1609, 29918, 3605, 601, 1125, 13, 9651, 11959, 353, 364, 2219, 359, 29961, 13140, 29962, 13, 9651, 3829, 353, 12286, 29961, 13140, 29962, 13, 9651, 19649, 353, 938, 29898, 3605, 601, 334, 29871, 29896, 29900, 29900, 29897, 13, 9651, 565, 19649, 1275, 29871, 29900, 322, 9563, 29918, 3298, 359, 29901, 13, 18884, 6773, 13, 9651, 3829, 29918, 1457, 4349, 353, 3829, 29889, 6506, 877, 29899, 742, 525, 25710, 13, 9651, 1596, 29898, 29888, 29915, 29912, 25376, 482, 29901, 29941, 10560, 310, 426, 23905, 29918, 1457, 4349, 29913, 1495, 13, 4706, 1596, 580, 13, 13, 4706, 2656, 29918, 1609, 29918, 1365, 29916, 1379, 353, 7442, 29889, 5085, 441, 29898, 1365, 29916, 1379, 29897, 13, 4706, 3001, 29918, 1365, 29916, 1379, 353, 2533, 29898, 1365, 29916, 1379, 29897, 13, 4706, 1596, 877, 1576, 620, 9739, 7977, 338, 13725, 310, 29901, 1495, 13, 4706, 363, 22645, 297, 18764, 287, 29898, 6605, 29918, 1609, 29918, 1365, 29916, 1379, 1125, 13, 9651, 11959, 353, 992, 29916, 1379, 29961, 13140, 29962, 847, 3001, 29918, 1365, 29916, 1379, 13, 9651, 3829, 353, 12286, 29961, 13140, 29962, 13, 9651, 19649, 353, 938, 29898, 3605, 601, 334, 29871, 29896, 29900, 29900, 29897, 13, 9651, 565, 19649, 1275, 29871, 29900, 322, 9563, 29918, 3298, 359, 29901, 13, 18884, 6773, 13, 9651, 3829, 29918, 1457, 4349, 353, 3829, 29889, 6506, 877, 29899, 742, 525, 25710, 13, 9651, 1596, 29898, 29888, 29915, 29912, 25376, 482, 29901, 29941, 10560, 338, 426, 23905, 29918, 1457, 4349, 29913, 1495, 13, 13, 1678, 822, 6492, 29918, 12343, 29898, 13, 9651, 1583, 29892, 13, 9651, 620, 9739, 29918, 10199, 29918, 2084, 29892, 13, 9651, 3611, 29922, 8516, 29892, 13, 9651, 1510, 29922, 5574, 29892, 13, 9651, 282, 312, 29918, 386, 12268, 29922, 29906, 29892, 13, 9651, 1962, 29918, 2084, 29922, 8516, 29892, 13, 9651, 11455, 29922, 8516, 29892, 13, 632, 1125, 13, 4706, 2983, 29892, 992, 29916, 1379, 29892, 903, 353, 1583, 29889, 657, 29918, 690, 26458, 29918, 4984, 1973, 29898, 13, 9651, 620, 9739, 29918, 10199, 29918, 2084, 29892, 11455, 29922, 17281, 29897, 13, 4706, 11955, 353, 518, 13, 9651, 1583, 29889, 2780, 29918, 2371, 29889, 657, 29918, 2780, 29918, 3166, 29918, 23905, 29918, 978, 29898, 978, 29897, 13, 9651, 363, 1024, 297, 2983, 13, 4706, 4514, 13, 4706, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 4706, 2656, 29918, 1609, 29918, 1365, 29916, 1379, 353, 7442, 29889, 5085, 441, 29898, 1365, 29916, 1379, 9601, 1057, 29899, 29896, 29962, 29871, 396, 5153, 2548, 1797, 13, 4706, 992, 29916, 1379, 353, 7442, 29889, 2378, 29898, 1365, 29916, 1379, 9601, 6605, 29918, 1609, 29918, 1365, 29916, 1379, 29962, 13, 4706, 10151, 1179, 353, 313, 1365, 29916, 1379, 847, 992, 29916, 1379, 29889, 2083, 3101, 334, 29871, 29896, 29900, 29900, 13, 4706, 2983, 353, 7442, 29889, 2378, 29898, 7039, 9601, 6605, 29918, 1609, 29918, 1365, 29916, 1379, 29962, 13, 4706, 11955, 353, 7442, 29889, 2378, 29898, 27703, 9601, 6605, 29918, 1609, 29918, 1365, 29916, 1379, 29962, 13, 13, 4706, 396, 379, 680, 777, 1819, 13, 4706, 822, 590, 29918, 1300, 459, 312, 29898, 29886, 312, 1125, 13, 9651, 736, 285, 29915, 29912, 524, 29898, 29886, 312, 2915, 29001, 565, 282, 312, 1405, 282, 312, 29918, 386, 12268, 1683, 6629, 13, 13, 4706, 11073, 353, 2983, 7503, 29962, 13, 4706, 363, 474, 29892, 282, 312, 297, 26985, 29898, 25376, 1179, 1125, 13, 9651, 565, 282, 312, 5277, 282, 312, 29918, 386, 12268, 29901, 13, 18884, 11073, 29961, 29875, 29962, 353, 6629, 13, 13, 4706, 4853, 29889, 12343, 29898, 13, 9651, 10151, 1179, 29892, 13, 9651, 11073, 29922, 21134, 29892, 13, 9651, 11955, 29922, 27703, 29892, 13, 9651, 15504, 29922, 8824, 29892, 13, 9651, 1120, 459, 312, 29922, 1357, 29918, 1300, 459, 312, 29892, 13, 9651, 282, 312, 19244, 29922, 29900, 29889, 29955, 29892, 13, 4706, 1723, 13, 4706, 565, 3611, 338, 451, 6213, 29901, 13, 9651, 4853, 29889, 842, 29918, 3257, 29898, 3257, 29897, 13, 4706, 14770, 29889, 29873, 523, 29918, 2680, 580, 13, 4706, 565, 1962, 29918, 2084, 338, 451, 6213, 29901, 13, 9651, 2537, 29889, 7620, 1003, 29898, 4905, 29918, 2084, 29892, 270, 1631, 29922, 29946, 29900, 29900, 29897, 13, 4706, 565, 1510, 29901, 13, 9651, 14770, 29889, 4294, 580, 13, 4706, 736, 2537, 13, 13, 1678, 822, 6492, 29918, 28408, 29898, 13, 9651, 1583, 29892, 13, 9651, 620, 9739, 29918, 10199, 29918, 2084, 29892, 13, 9651, 3611, 29922, 8516, 29892, 13, 9651, 1510, 29922, 5574, 29892, 13, 9651, 1962, 29918, 2084, 29922, 8516, 29892, 13, 9651, 11455, 29922, 8516, 29892, 13, 632, 1125, 13, 4706, 2983, 29892, 17117, 364, 2219, 359, 353, 1583, 29889, 657, 29918, 690, 26458, 29918, 4984, 1973, 29898, 13, 9651, 620, 9739, 29918, 10199, 29918, 2084, 29892, 11455, 29922, 17281, 29897, 13, 13, 4706, 11955, 353, 518, 13, 9651, 1583, 29889, 2780, 29918, 2371, 29889, 657, 29918, 2780, 29918, 3166, 29918, 23905, 29918, 978, 29898, 978, 29897, 13, 9651, 363, 1024, 297, 2983, 13, 4706, 4514, 13, 4706, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 4706, 2656, 29918, 1609, 29918, 29878, 2219, 359, 353, 7442, 29889, 5085, 441, 29898, 29878, 2219, 359, 29897, 13, 4706, 364, 2219, 359, 353, 7442, 29889, 2378, 29898, 29878, 2219, 359, 9601, 6605, 29918, 1609, 29918, 29878, 2219, 359, 29962, 13, 4706, 10151, 1179, 353, 364, 2219, 359, 334, 29871, 29896, 29900, 29900, 13, 4706, 2983, 353, 7442, 29889, 2378, 29898, 7039, 9601, 6605, 29918, 1609, 29918, 29878, 2219, 359, 29962, 13, 4706, 11955, 353, 7442, 29889, 2378, 29898, 27703, 9601, 6605, 29918, 1609, 29918, 29878, 2219, 359, 29962, 13, 13, 4706, 343, 29918, 1066, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 7039, 876, 13, 4706, 4853, 29889, 1646, 29882, 29898, 13, 9651, 343, 29918, 1066, 29892, 13, 9651, 10151, 1179, 29892, 13, 9651, 7595, 2433, 5064, 742, 13, 9651, 2927, 29922, 27703, 29892, 13, 9651, 16892, 29918, 1643, 29922, 7039, 29892, 13, 4706, 1723, 13, 4706, 4853, 29889, 842, 29918, 8990, 22503, 29898, 5574, 29897, 29871, 396, 2045, 597, 2417, 29889, 510, 29914, 29874, 29914, 29941, 29929, 29900, 29941, 29929, 29945, 29906, 29900, 13, 4706, 4853, 29889, 7720, 580, 13, 4706, 4853, 29889, 842, 29918, 29916, 2576, 3552, 29900, 29892, 29871, 29896, 29900, 29945, 876, 13, 4706, 4853, 29889, 29916, 8990, 29889, 842, 29918, 21355, 29918, 689, 2620, 29898, 4378, 860, 29889, 27933, 18522, 3101, 13, 13, 4706, 565, 3611, 338, 451, 6213, 29901, 13, 9651, 4853, 29889, 842, 29918, 3257, 29898, 3257, 29897, 13, 13, 4706, 14770, 29889, 29873, 523, 29918, 2680, 580, 13, 4706, 565, 1962, 29918, 2084, 338, 451, 6213, 29901, 13, 9651, 2537, 29889, 7620, 1003, 29898, 4905, 29918, 2084, 29892, 270, 1631, 29922, 29946, 29900, 29900, 29897, 13, 4706, 565, 1510, 29901, 13, 9651, 14770, 29889, 4294, 580, 13, 4706, 736, 2537, 13, 13, 1678, 822, 338, 29918, 3084, 29918, 4537, 29898, 1311, 29892, 1353, 1125, 13, 4706, 736, 1583, 29889, 2780, 29918, 2371, 29889, 275, 29918, 3084, 29918, 4537, 29898, 4537, 29897, 13, 13, 13, 1990, 402, 6545, 2177, 22603, 29898, 2177, 22603, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 610, 22603, 29918, 2084, 1125, 13, 4706, 1459, 22603, 17255, 2344, 12035, 1311, 29892, 610, 22603, 29918, 2084, 29897, 13, 4706, 1583, 29889, 2780, 29918, 2371, 353, 402, 6545, 3306, 3562, 580, 13, 13, 13, 1990, 12362, 18498, 571, 2177, 22603, 29898, 2177, 22603, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 610, 22603, 29918, 2084, 1125, 13, 4706, 1459, 22603, 17255, 2344, 12035, 1311, 29892, 610, 22603, 29918, 2084, 29897, 13, 4706, 1583, 29889, 2780, 29918, 2371, 353, 12362, 18498, 571, 3306, 3562, 580, 13, 13, 13, 1990, 9159, 3562, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 2671, 7039, 353, 313, 13, 9651, 525, 23905, 742, 13, 9651, 525, 1127, 742, 13, 9651, 525, 12692, 742, 13, 9651, 525, 9539, 742, 13, 9651, 525, 2312, 742, 13, 4706, 1723, 13, 13, 1678, 822, 679, 29918, 1767, 29918, 3166, 29918, 1643, 29918, 4537, 29898, 1311, 29892, 3858, 29918, 4537, 29892, 1820, 1125, 13, 4706, 1018, 29901, 13, 9651, 995, 353, 1583, 3032, 1272, 29918, 2557, 29889, 2029, 29961, 1643, 29918, 4537, 3816, 1989, 29962, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 995, 353, 285, 29915, 29961, 2525, 29895, 776, 3858, 29901, 426, 1643, 29918, 4537, 6525, 29915, 13, 4706, 736, 995, 13, 13, 1678, 822, 679, 29918, 798, 29918, 3166, 29918, 23905, 29918, 978, 29898, 1311, 29892, 1024, 1125, 13, 4706, 11105, 353, 1583, 3032, 1272, 29918, 2557, 1839, 23905, 2033, 1275, 1024, 13, 4706, 1948, 353, 1583, 3032, 1272, 29918, 2557, 29889, 2029, 29961, 13168, 29962, 13, 4706, 736, 1948, 13, 13, 1678, 822, 679, 29918, 1767, 29918, 3166, 29918, 23905, 29918, 978, 29898, 1311, 29892, 1024, 29892, 1820, 1125, 13, 4706, 1948, 353, 1583, 29889, 657, 29918, 798, 29918, 3166, 29918, 23905, 29918, 978, 29898, 978, 29897, 13, 4706, 995, 353, 1948, 29961, 1989, 29962, 13, 4706, 736, 995, 13, 13, 1678, 822, 679, 29918, 23905, 29918, 3166, 29918, 1643, 29918, 4537, 29898, 1311, 29892, 3858, 29918, 4537, 1125, 13, 4706, 736, 1583, 29889, 657, 29918, 1767, 29918, 3166, 29918, 1643, 29918, 4537, 29898, 1643, 29918, 4537, 29892, 525, 23905, 1495, 13, 13, 1678, 822, 679, 29918, 2780, 29918, 3166, 29918, 23905, 29918, 978, 29898, 1311, 29892, 1024, 1125, 13, 4706, 1948, 353, 1583, 29889, 657, 29918, 798, 29918, 3166, 29918, 23905, 29918, 978, 29898, 978, 29897, 13, 4706, 565, 1948, 29889, 6310, 29901, 13, 9651, 2927, 353, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 2927, 353, 518, 798, 29961, 29883, 1822, 5975, 363, 274, 297, 6702, 1127, 742, 525, 12692, 742, 525, 9539, 1495, 29962, 13, 9651, 2927, 353, 7442, 29889, 29882, 1429, 29898, 2780, 29897, 13, 9651, 2927, 353, 7442, 29889, 2378, 29898, 2780, 29897, 847, 29871, 29906, 29945, 29945, 13, 4706, 736, 2927, 13, 13, 1678, 822, 338, 29918, 3084, 29918, 4537, 29898, 1311, 29892, 1353, 1125, 13, 4706, 736, 1353, 297, 1583, 3032, 1272, 29918, 2557, 29889, 2248, 13, 13, 13, 1990, 402, 6545, 3306, 3562, 29898, 3306, 3562, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 9159, 3562, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 2780, 29918, 2371, 29918, 2084, 353, 2927, 29918, 24051, 29918, 3972, 847, 525, 22097, 2744, 8678, 29891, 4775, 29879, 29963, 29941, 29918, 29900, 29889, 3945, 29915, 13, 4706, 1583, 3032, 1272, 29918, 2557, 353, 1583, 29889, 949, 29918, 2780, 29918, 2371, 580, 13, 13, 1678, 822, 1303, 29918, 2780, 29918, 2371, 29898, 1311, 1125, 13, 4706, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 13, 9651, 1583, 29889, 2780, 29918, 2371, 29918, 2084, 29892, 13, 9651, 2380, 29918, 1054, 29922, 29900, 29892, 13, 9651, 2983, 29922, 1311, 29889, 2671, 7039, 29892, 13, 9651, 16345, 29922, 29878, 12764, 29879, 29974, 742, 29871, 396, 727, 338, 263, 3765, 2913, 297, 278, 934, 13, 4706, 1723, 13, 4706, 736, 4489, 13, 13, 13, 1990, 12362, 18498, 571, 3306, 3562, 29898, 3306, 3562, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 9159, 3562, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 2780, 29918, 2371, 29918, 2084, 353, 2927, 29918, 24051, 29918, 3972, 847, 525, 20475, 18498, 571, 4775, 29879, 29889, 312, 2204, 29915, 13, 4706, 1583, 3032, 1272, 29918, 2557, 353, 1583, 29889, 949, 29918, 2780, 29918, 2371, 580, 13, 13, 1678, 822, 1303, 29918, 2780, 29918, 2371, 29898, 1311, 1125, 13, 4706, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 13, 9651, 1583, 29889, 2780, 29918, 2371, 29918, 2084, 29892, 13, 9651, 2380, 29918, 1054, 29922, 29900, 29892, 13, 9651, 2983, 29922, 1311, 29889, 2671, 7039, 29892, 13, 9651, 16345, 29922, 29878, 12764, 29879, 29974, 742, 13, 9651, 14383, 5727, 29922, 29906, 29892, 13, 4706, 1723, 13, 4706, 736, 4489, 13, 2 ]
tilecloud/store/redis.py
wendymhelson/tilecloud
0
87660
from __future__ import absolute_import import logging import os import socket from c2cwsgiutils import stats import redis.sentinel from tilecloud import TileStore from tilecloud.store.queue import decode_message, encode_message STREAM_GROUP = "tilecloud" CONSUMER_NAME = socket.gethostname() + "-" + str(os.getpid()) logger = logging.getLogger(__name__) class RedisTileStore(TileStore): """ Redis queue. """ def __init__( self, url=None, name="tilecloud", stop_if_empty=True, timeout=5, pending_timeout=5 * 60, max_retries=5, max_errors_age=24 * 3600, max_errors_nb=100, sentinels=None, service_name="mymaster", sentinel_kwargs=None, connection_kwargs=None, **kwargs, ): super().__init__(**kwargs) connection_kwargs = connection_kwargs or {} if sentinels is not None: sentinel = redis.sentinel.Sentinel( sentinels, sentinel_kwargs=sentinel_kwargs, **connection_kwargs ) self._master = sentinel.master_for(service_name) self._slave = sentinel.slave_for(service_name) else: self._master = redis.Redis.from_url(url, **connection_kwargs) self._slave = self._master self._stop_if_empty = stop_if_empty self._timeout_ms = int(timeout * 1000) self._pending_timeout_ms = int(pending_timeout * 1000) self._max_retries = max_retries self._max_errors_age = max_errors_age self._max_errors_nb = max_errors_nb if not name.startswith("queue_"): name = "queue_" + name self._name_str = name self._name = name.encode("utf-8") self._errors_name = self._name + b"_errors" try: self._master.xgroup_create(name=self._name, groupname=STREAM_GROUP, id="0-0", mkstream=True) except redis.ResponseError as e: if "BUSYGROUP" not in str(e): raise def __contains__(self, tile): return False @staticmethod def get_one(tile): return tile def list(self): count = 0 while True: queues = self._master.xreadgroup( groupname=STREAM_GROUP, consumername=CONSUMER_NAME, streams={self._name: ">"}, count=1, block=round(self._timeout_ms), ) if not queues: queues = self._claim_olds() if queues is None: stats.set_gauge(["redis", self._name_str, "nb_messages"], 0) stats.set_gauge(["redis", self._name_str, "pending"], 0) if queues is None and self._stop_if_empty: break if queues: for redis_message in queues: queue_name, queue_messages = redis_message assert queue_name == self._name for message in queue_messages: id_, body = message try: tile = decode_message(body[b"message"], from_redis=True, sqs_message=id_) yield tile except Exception: logger.warning("Failed decoding the Redis message", exc_info=True) stats.increment_counter(["redis", self._name_str, "decode_error"]) count += 1 if count % 10 == 0: stats.set_gauge( ["redis", self._name_str, "nb_messages"], self._slave.xlen(name=self._name) ) pending = self._slave.xpending(self._name, STREAM_GROUP) stats.set_gauge(["redis", self._name_str, "pending"], pending["pending"]) def put_one(self, tile): try: self._master.xadd(name=self._name, fields={"message": encode_message(tile)}) except Exception as e: logger.warning("Failed sending Redis message", exc_info=True) tile.error = e def put(self, tiles): for tile in tiles: self.put_one(tile) yield tile def delete_one(self, tile): # Once consumed from redis, we don't have to delete the tile from the queue. assert hasattr(tile, "from_redis") assert hasattr(tile, "sqs_message") assert tile.from_redis is True self._master.xack(self._name, STREAM_GROUP, tile.sqs_message) self._master.xdel(self._name, tile.sqs_message) return tile def delete_all(self): """ Used only by tests """ self._master.xtrim(name=self._name, maxlen=0) # xtrim doesn't empty the group claims. So we have to delete and re-create groups self._master.xgroup_destroy(name=self._name, groupname=STREAM_GROUP) self._master.xgroup_create(name=self._name, groupname=STREAM_GROUP, id="0-0", mkstream=True) self._master.xtrim(name=self._errors_name, maxlen=0) def _claim_olds(self): pendings = self._master.xpending_range( name=self._name, groupname=STREAM_GROUP, min="-", max="+", count=10 ) if not pendings: # None means there is nothing pending at all return None to_steal = [] to_drop = [] for pending in pendings: if int(pending["time_since_delivered"]) >= self._pending_timeout_ms: id_ = pending["message_id"] nb_retries = int(pending["times_delivered"]) if nb_retries < self._max_retries: logger.info( "A message has been pending for too long. Stealing it (retry #%d): %s", nb_retries, id_, ) to_steal.append(id_) else: logger.warning( "A message has been pending for too long and retried too many times. Dropping it: %s", id_, ) to_drop.append(id_) if to_drop: drop_messages = self._master.xclaim( name=self._name, groupname=STREAM_GROUP, consumername=CONSUMER_NAME, min_idle_time=self._pending_timeout_ms, message_ids=to_drop, ) drop_ids = [drop_message[0] for drop_message in drop_messages] self._master.xack(self._name, STREAM_GROUP, *drop_ids) self._master.xdel(self._name, *drop_ids) for _, drop_message in drop_messages: tile = decode_message(drop_message[b"message"]) self._master.xadd( name=self._errors_name, fields=dict(tilecoord=str(tile.tilecoord)), maxlen=self._max_errors_nb, ) stats.increment_counter(["redis", self._name_str, "dropped"], len(to_drop)) if to_steal: messages = self._master.xclaim( name=self._name, groupname=STREAM_GROUP, consumername=CONSUMER_NAME, min_idle_time=self._pending_timeout_ms, message_ids=to_steal, ) stats.increment_counter(["redis", self._name_str, "stolen"], len(to_steal)) return [[self._name, messages]] else: # Empty means there are pending jobs, but they are not old enough to be stolen return [] def get_status(self): """ Returns a map of stats """ nb_messages = self._slave.xlen(self._name) pending = self._slave.xpending(self._name, STREAM_GROUP) tiles_in_error = self._get_errors() stats.set_gauge(["redis", self._name_str, "nb_messages"], nb_messages) return { "Approximate number of tiles to generate": nb_messages, "Approximate number of generating tiles": pending["pending"], "Tiles in error": ", ".join(tiles_in_error), } def _get_errors(self): now, now_us = self._slave.time() old_timestamp = (now - self._max_errors_age) * 1000 + now_us / 1000 errors = self._slave.xrange(name=self._errors_name) tiles_in_error = set() old_errors = [] for error_id, error_message in errors: timestamp = int(error_id.decode().split("-")[0]) if timestamp <= old_timestamp: old_errors.append(error_id) else: tiles_in_error.add(error_message[b"tilecoord"].decode()) if old_errors: logger.info("Deleting %d old errors", len(old_errors)) self._master.xdel(self._errors_name, *old_errors) return tiles_in_error
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 9909, 13, 13, 3166, 274, 29906, 29883, 5652, 3146, 13239, 1053, 22663, 13, 5215, 29825, 29889, 29879, 15440, 295, 13, 13, 3166, 25900, 9274, 1053, 323, 488, 9044, 13, 3166, 25900, 9274, 29889, 8899, 29889, 9990, 1053, 21822, 29918, 4906, 29892, 19750, 29918, 4906, 13, 13, 1254, 1525, 5194, 29918, 26284, 353, 376, 29873, 488, 9274, 29908, 13, 6007, 25021, 1001, 29918, 5813, 353, 9909, 29889, 29887, 621, 520, 978, 580, 718, 11663, 29908, 718, 851, 29898, 359, 29889, 657, 5935, 3101, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 4367, 275, 29911, 488, 9044, 29898, 29911, 488, 9044, 1125, 13, 1678, 9995, 13, 1678, 4367, 275, 9521, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 3142, 29922, 8516, 29892, 13, 4706, 1024, 543, 29873, 488, 9274, 613, 13, 4706, 5040, 29918, 361, 29918, 6310, 29922, 5574, 29892, 13, 4706, 11815, 29922, 29945, 29892, 13, 4706, 28235, 29918, 15619, 29922, 29945, 334, 29871, 29953, 29900, 29892, 13, 4706, 4236, 29918, 2267, 2722, 29922, 29945, 29892, 13, 4706, 4236, 29918, 12523, 29918, 482, 29922, 29906, 29946, 334, 29871, 29941, 29953, 29900, 29900, 29892, 13, 4706, 4236, 29918, 12523, 29918, 9877, 29922, 29896, 29900, 29900, 29892, 13, 4706, 2665, 262, 1379, 29922, 8516, 29892, 13, 4706, 2669, 29918, 978, 543, 29885, 962, 1901, 613, 13, 4706, 2665, 262, 295, 29918, 19290, 29922, 8516, 29892, 13, 4706, 3957, 29918, 19290, 29922, 8516, 29892, 13, 4706, 3579, 19290, 29892, 13, 268, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 13, 4706, 3957, 29918, 19290, 353, 3957, 29918, 19290, 470, 6571, 13, 13, 4706, 565, 2665, 262, 1379, 338, 451, 6213, 29901, 13, 9651, 2665, 262, 295, 353, 29825, 29889, 29879, 15440, 295, 29889, 29903, 15440, 295, 29898, 13, 18884, 2665, 262, 1379, 29892, 2665, 262, 295, 29918, 19290, 29922, 29879, 15440, 295, 29918, 19290, 29892, 3579, 9965, 29918, 19290, 13, 9651, 1723, 13, 9651, 1583, 3032, 6207, 353, 2665, 262, 295, 29889, 6207, 29918, 1454, 29898, 5509, 29918, 978, 29897, 13, 9651, 1583, 3032, 29879, 18398, 353, 2665, 262, 295, 29889, 29879, 18398, 29918, 1454, 29898, 5509, 29918, 978, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 6207, 353, 29825, 29889, 9039, 275, 29889, 3166, 29918, 2271, 29898, 2271, 29892, 3579, 9965, 29918, 19290, 29897, 13, 9651, 1583, 3032, 29879, 18398, 353, 1583, 3032, 6207, 13, 13, 4706, 1583, 3032, 9847, 29918, 361, 29918, 6310, 353, 5040, 29918, 361, 29918, 6310, 13, 4706, 1583, 3032, 15619, 29918, 1516, 353, 938, 29898, 15619, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 1583, 3032, 29886, 2548, 29918, 15619, 29918, 1516, 353, 938, 29898, 29886, 2548, 29918, 15619, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 1583, 3032, 3317, 29918, 2267, 2722, 353, 4236, 29918, 2267, 2722, 13, 4706, 1583, 3032, 3317, 29918, 12523, 29918, 482, 353, 4236, 29918, 12523, 29918, 482, 13, 4706, 1583, 3032, 3317, 29918, 12523, 29918, 9877, 353, 4236, 29918, 12523, 29918, 9877, 13, 4706, 565, 451, 1024, 29889, 27382, 2541, 703, 9990, 27508, 1125, 13, 9651, 1024, 353, 376, 9990, 27508, 718, 1024, 13, 4706, 1583, 3032, 978, 29918, 710, 353, 1024, 13, 4706, 1583, 3032, 978, 353, 1024, 29889, 12508, 703, 9420, 29899, 29947, 1159, 13, 4706, 1583, 3032, 12523, 29918, 978, 353, 1583, 3032, 978, 718, 289, 29908, 29918, 12523, 29908, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 6207, 29889, 29916, 2972, 29918, 3258, 29898, 978, 29922, 1311, 3032, 978, 29892, 2318, 978, 29922, 1254, 1525, 5194, 29918, 26284, 29892, 1178, 543, 29900, 29899, 29900, 613, 14690, 5461, 29922, 5574, 29897, 13, 4706, 5174, 29825, 29889, 5103, 2392, 408, 321, 29901, 13, 9651, 565, 376, 29933, 3308, 29979, 26284, 29908, 451, 297, 851, 29898, 29872, 1125, 13, 18884, 12020, 13, 13, 1678, 822, 4770, 11516, 12035, 1311, 29892, 25900, 1125, 13, 4706, 736, 7700, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 650, 29898, 29873, 488, 1125, 13, 4706, 736, 25900, 13, 13, 1678, 822, 1051, 29898, 1311, 1125, 13, 4706, 2302, 353, 29871, 29900, 13, 4706, 1550, 5852, 29901, 13, 9651, 712, 1041, 353, 1583, 3032, 6207, 29889, 29916, 949, 2972, 29898, 13, 18884, 2318, 978, 29922, 1254, 1525, 5194, 29918, 26284, 29892, 13, 18884, 11233, 4510, 29922, 6007, 25021, 1001, 29918, 5813, 29892, 13, 18884, 20873, 3790, 1311, 3032, 978, 29901, 376, 29958, 10758, 13, 18884, 2302, 29922, 29896, 29892, 13, 18884, 2908, 29922, 14486, 29898, 1311, 3032, 15619, 29918, 1516, 511, 13, 9651, 1723, 13, 13, 9651, 565, 451, 712, 1041, 29901, 13, 18884, 712, 1041, 353, 1583, 3032, 29883, 8342, 29918, 3361, 580, 13, 18884, 565, 712, 1041, 338, 6213, 29901, 13, 462, 1678, 22663, 29889, 842, 29918, 29887, 585, 479, 29898, 3366, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 9877, 29918, 19158, 12436, 29871, 29900, 29897, 13, 462, 1678, 22663, 29889, 842, 29918, 29887, 585, 479, 29898, 3366, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 29886, 2548, 12436, 29871, 29900, 29897, 13, 18884, 565, 712, 1041, 338, 6213, 322, 1583, 3032, 9847, 29918, 361, 29918, 6310, 29901, 13, 462, 1678, 2867, 13, 9651, 565, 712, 1041, 29901, 13, 18884, 363, 29825, 29918, 4906, 297, 712, 1041, 29901, 13, 462, 1678, 9521, 29918, 978, 29892, 9521, 29918, 19158, 353, 29825, 29918, 4906, 13, 462, 1678, 4974, 9521, 29918, 978, 1275, 1583, 3032, 978, 13, 462, 1678, 363, 2643, 297, 9521, 29918, 19158, 29901, 13, 462, 4706, 1178, 3383, 3573, 353, 2643, 13, 462, 4706, 1018, 29901, 13, 462, 9651, 25900, 353, 21822, 29918, 4906, 29898, 2587, 29961, 29890, 29908, 4906, 12436, 515, 29918, 1127, 275, 29922, 5574, 29892, 18074, 29879, 29918, 4906, 29922, 333, 19925, 13, 462, 9651, 7709, 25900, 13, 462, 4706, 5174, 8960, 29901, 13, 462, 9651, 17927, 29889, 27392, 703, 17776, 1602, 3689, 278, 4367, 275, 2643, 613, 5566, 29918, 3888, 29922, 5574, 29897, 13, 462, 9651, 22663, 29889, 25629, 29918, 11808, 29898, 3366, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 13808, 29918, 2704, 20068, 13, 462, 4706, 2302, 4619, 29871, 29896, 13, 13, 18884, 565, 2302, 1273, 29871, 29896, 29900, 1275, 29871, 29900, 29901, 13, 462, 1678, 22663, 29889, 842, 29918, 29887, 585, 479, 29898, 13, 462, 4706, 6796, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 9877, 29918, 19158, 12436, 1583, 3032, 29879, 18398, 29889, 29916, 2435, 29898, 978, 29922, 1311, 3032, 978, 29897, 13, 462, 1678, 1723, 13, 462, 1678, 28235, 353, 1583, 3032, 29879, 18398, 29889, 26330, 2548, 29898, 1311, 3032, 978, 29892, 6850, 1525, 5194, 29918, 26284, 29897, 13, 462, 1678, 22663, 29889, 842, 29918, 29887, 585, 479, 29898, 3366, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 29886, 2548, 12436, 28235, 3366, 29886, 2548, 20068, 13, 13, 1678, 822, 1925, 29918, 650, 29898, 1311, 29892, 25900, 1125, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 6207, 29889, 29916, 1202, 29898, 978, 29922, 1311, 3032, 978, 29892, 4235, 3790, 29908, 4906, 1115, 19750, 29918, 4906, 29898, 29873, 488, 26972, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 17927, 29889, 27392, 703, 17776, 9348, 4367, 275, 2643, 613, 5566, 29918, 3888, 29922, 5574, 29897, 13, 9651, 25900, 29889, 2704, 353, 321, 13, 13, 1678, 822, 1925, 29898, 1311, 29892, 260, 5475, 1125, 13, 4706, 363, 25900, 297, 260, 5475, 29901, 13, 9651, 1583, 29889, 649, 29918, 650, 29898, 29873, 488, 29897, 13, 9651, 7709, 25900, 13, 13, 1678, 822, 5217, 29918, 650, 29898, 1311, 29892, 25900, 1125, 13, 4706, 396, 9038, 11233, 287, 515, 29825, 29892, 591, 1016, 29915, 29873, 505, 304, 5217, 278, 25900, 515, 278, 9521, 29889, 13, 4706, 4974, 756, 5552, 29898, 29873, 488, 29892, 376, 3166, 29918, 1127, 275, 1159, 13, 4706, 4974, 756, 5552, 29898, 29873, 488, 29892, 376, 3044, 29879, 29918, 4906, 1159, 13, 4706, 4974, 25900, 29889, 3166, 29918, 1127, 275, 338, 5852, 13, 4706, 1583, 3032, 6207, 29889, 29916, 547, 29898, 1311, 3032, 978, 29892, 6850, 1525, 5194, 29918, 26284, 29892, 25900, 29889, 3044, 29879, 29918, 4906, 29897, 13, 4706, 1583, 3032, 6207, 29889, 29916, 6144, 29898, 1311, 3032, 978, 29892, 25900, 29889, 3044, 29879, 29918, 4906, 29897, 13, 4706, 736, 25900, 13, 13, 1678, 822, 5217, 29918, 497, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 501, 8485, 871, 491, 6987, 13, 4706, 9995, 13, 4706, 1583, 3032, 6207, 29889, 486, 5632, 29898, 978, 29922, 1311, 3032, 978, 29892, 4236, 2435, 29922, 29900, 29897, 13, 4706, 396, 29871, 486, 5632, 1838, 29915, 29873, 4069, 278, 2318, 16726, 29889, 1105, 591, 505, 304, 5217, 322, 337, 29899, 3258, 6471, 13, 4706, 1583, 3032, 6207, 29889, 29916, 2972, 29918, 20524, 29898, 978, 29922, 1311, 3032, 978, 29892, 2318, 978, 29922, 1254, 1525, 5194, 29918, 26284, 29897, 13, 4706, 1583, 3032, 6207, 29889, 29916, 2972, 29918, 3258, 29898, 978, 29922, 1311, 3032, 978, 29892, 2318, 978, 29922, 1254, 1525, 5194, 29918, 26284, 29892, 1178, 543, 29900, 29899, 29900, 613, 14690, 5461, 29922, 5574, 29897, 13, 4706, 1583, 3032, 6207, 29889, 486, 5632, 29898, 978, 29922, 1311, 3032, 12523, 29918, 978, 29892, 4236, 2435, 29922, 29900, 29897, 13, 13, 1678, 822, 903, 29883, 8342, 29918, 3361, 29898, 1311, 1125, 13, 4706, 282, 355, 886, 353, 1583, 3032, 6207, 29889, 26330, 2548, 29918, 3881, 29898, 13, 9651, 1024, 29922, 1311, 3032, 978, 29892, 2318, 978, 29922, 1254, 1525, 5194, 29918, 26284, 29892, 1375, 543, 29899, 613, 4236, 543, 29974, 613, 2302, 29922, 29896, 29900, 13, 4706, 1723, 13, 4706, 565, 451, 282, 355, 886, 29901, 13, 9651, 396, 6213, 2794, 727, 338, 3078, 28235, 472, 599, 13, 9651, 736, 6213, 13, 4706, 304, 29918, 1655, 284, 353, 5159, 13, 4706, 304, 29918, 8865, 353, 5159, 13, 4706, 363, 28235, 297, 282, 355, 886, 29901, 13, 9651, 565, 938, 29898, 29886, 2548, 3366, 2230, 29918, 16076, 29918, 6144, 2147, 287, 20068, 6736, 1583, 3032, 29886, 2548, 29918, 15619, 29918, 1516, 29901, 13, 18884, 1178, 29918, 353, 28235, 3366, 4906, 29918, 333, 3108, 13, 18884, 302, 29890, 29918, 2267, 2722, 353, 938, 29898, 29886, 2548, 3366, 3706, 29918, 6144, 2147, 287, 20068, 13, 18884, 565, 302, 29890, 29918, 2267, 2722, 529, 1583, 3032, 3317, 29918, 2267, 2722, 29901, 13, 462, 1678, 17927, 29889, 3888, 29898, 13, 462, 4706, 376, 29909, 2643, 756, 1063, 28235, 363, 2086, 1472, 29889, 2443, 12818, 372, 313, 276, 2202, 396, 29995, 29881, 1125, 1273, 29879, 613, 13, 462, 4706, 302, 29890, 29918, 2267, 2722, 29892, 13, 462, 4706, 1178, 3383, 13, 462, 1678, 1723, 13, 462, 1678, 304, 29918, 1655, 284, 29889, 4397, 29898, 333, 19925, 13, 18884, 1683, 29901, 13, 462, 1678, 17927, 29889, 27392, 29898, 13, 462, 4706, 376, 29909, 2643, 756, 1063, 28235, 363, 2086, 1472, 322, 3240, 1255, 2086, 1784, 3064, 29889, 22938, 3262, 372, 29901, 1273, 29879, 613, 13, 462, 4706, 1178, 3383, 13, 462, 1678, 1723, 13, 462, 1678, 304, 29918, 8865, 29889, 4397, 29898, 333, 19925, 13, 13, 4706, 565, 304, 29918, 8865, 29901, 13, 9651, 5768, 29918, 19158, 353, 1583, 3032, 6207, 29889, 21791, 8342, 29898, 13, 18884, 1024, 29922, 1311, 3032, 978, 29892, 13, 18884, 2318, 978, 29922, 1254, 1525, 5194, 29918, 26284, 29892, 13, 18884, 11233, 4510, 29922, 6007, 25021, 1001, 29918, 5813, 29892, 13, 18884, 1375, 29918, 333, 280, 29918, 2230, 29922, 1311, 3032, 29886, 2548, 29918, 15619, 29918, 1516, 29892, 13, 18884, 2643, 29918, 4841, 29922, 517, 29918, 8865, 29892, 13, 9651, 1723, 13, 9651, 5768, 29918, 4841, 353, 518, 8865, 29918, 4906, 29961, 29900, 29962, 363, 5768, 29918, 4906, 297, 5768, 29918, 19158, 29962, 13, 9651, 1583, 3032, 6207, 29889, 29916, 547, 29898, 1311, 3032, 978, 29892, 6850, 1525, 5194, 29918, 26284, 29892, 334, 8865, 29918, 4841, 29897, 13, 9651, 1583, 3032, 6207, 29889, 29916, 6144, 29898, 1311, 3032, 978, 29892, 334, 8865, 29918, 4841, 29897, 13, 9651, 363, 17117, 5768, 29918, 4906, 297, 5768, 29918, 19158, 29901, 13, 18884, 25900, 353, 21822, 29918, 4906, 29898, 8865, 29918, 4906, 29961, 29890, 29908, 4906, 20068, 13, 18884, 1583, 3032, 6207, 29889, 29916, 1202, 29898, 13, 462, 1678, 1024, 29922, 1311, 3032, 12523, 29918, 978, 29892, 13, 462, 1678, 4235, 29922, 8977, 29898, 29873, 488, 1111, 536, 29922, 710, 29898, 29873, 488, 29889, 29873, 488, 1111, 536, 8243, 13, 462, 1678, 4236, 2435, 29922, 1311, 3032, 3317, 29918, 12523, 29918, 9877, 29892, 13, 18884, 1723, 13, 9651, 22663, 29889, 25629, 29918, 11808, 29898, 3366, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 26419, 2986, 12436, 7431, 29898, 517, 29918, 8865, 876, 13, 13, 4706, 565, 304, 29918, 1655, 284, 29901, 13, 9651, 7191, 353, 1583, 3032, 6207, 29889, 21791, 8342, 29898, 13, 18884, 1024, 29922, 1311, 3032, 978, 29892, 13, 18884, 2318, 978, 29922, 1254, 1525, 5194, 29918, 26284, 29892, 13, 18884, 11233, 4510, 29922, 6007, 25021, 1001, 29918, 5813, 29892, 13, 18884, 1375, 29918, 333, 280, 29918, 2230, 29922, 1311, 3032, 29886, 2548, 29918, 15619, 29918, 1516, 29892, 13, 18884, 2643, 29918, 4841, 29922, 517, 29918, 1655, 284, 29892, 13, 9651, 1723, 13, 9651, 22663, 29889, 25629, 29918, 11808, 29898, 3366, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 303, 18975, 12436, 7431, 29898, 517, 29918, 1655, 284, 876, 13, 9651, 736, 5519, 1311, 3032, 978, 29892, 7191, 5262, 13, 4706, 1683, 29901, 13, 9651, 396, 2812, 2349, 2794, 727, 526, 28235, 17643, 29892, 541, 896, 526, 451, 2030, 3307, 304, 367, 380, 18975, 13, 9651, 736, 5159, 13, 13, 1678, 822, 679, 29918, 4882, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 16969, 263, 2910, 310, 22663, 13, 4706, 9995, 13, 4706, 302, 29890, 29918, 19158, 353, 1583, 3032, 29879, 18398, 29889, 29916, 2435, 29898, 1311, 3032, 978, 29897, 13, 4706, 28235, 353, 1583, 3032, 29879, 18398, 29889, 26330, 2548, 29898, 1311, 3032, 978, 29892, 6850, 1525, 5194, 29918, 26284, 29897, 13, 4706, 260, 5475, 29918, 262, 29918, 2704, 353, 1583, 3032, 657, 29918, 12523, 580, 13, 13, 4706, 22663, 29889, 842, 29918, 29887, 585, 479, 29898, 3366, 1127, 275, 613, 1583, 3032, 978, 29918, 710, 29892, 376, 9877, 29918, 19158, 12436, 302, 29890, 29918, 19158, 29897, 13, 4706, 736, 426, 13, 9651, 376, 2052, 307, 2657, 403, 1353, 310, 260, 5475, 304, 5706, 1115, 302, 29890, 29918, 19158, 29892, 13, 9651, 376, 2052, 307, 2657, 403, 1353, 310, 14655, 260, 5475, 1115, 28235, 3366, 29886, 2548, 12436, 13, 9651, 376, 29911, 5475, 297, 1059, 1115, 9162, 11393, 7122, 29898, 1376, 267, 29918, 262, 29918, 2704, 511, 13, 4706, 500, 13, 13, 1678, 822, 903, 657, 29918, 12523, 29898, 1311, 1125, 13, 4706, 1286, 29892, 1286, 29918, 375, 353, 1583, 3032, 29879, 18398, 29889, 2230, 580, 13, 4706, 2030, 29918, 16394, 353, 313, 3707, 448, 1583, 3032, 3317, 29918, 12523, 29918, 482, 29897, 334, 29871, 29896, 29900, 29900, 29900, 718, 1286, 29918, 375, 847, 29871, 29896, 29900, 29900, 29900, 13, 13, 4706, 4436, 353, 1583, 3032, 29879, 18398, 29889, 29916, 3881, 29898, 978, 29922, 1311, 3032, 12523, 29918, 978, 29897, 13, 4706, 260, 5475, 29918, 262, 29918, 2704, 353, 731, 580, 13, 4706, 2030, 29918, 12523, 353, 5159, 13, 4706, 363, 1059, 29918, 333, 29892, 1059, 29918, 4906, 297, 4436, 29901, 13, 9651, 14334, 353, 938, 29898, 2704, 29918, 333, 29889, 13808, 2141, 5451, 703, 29899, 1159, 29961, 29900, 2314, 13, 9651, 565, 14334, 5277, 2030, 29918, 16394, 29901, 13, 18884, 2030, 29918, 12523, 29889, 4397, 29898, 2704, 29918, 333, 29897, 13, 9651, 1683, 29901, 13, 18884, 260, 5475, 29918, 262, 29918, 2704, 29889, 1202, 29898, 2704, 29918, 4906, 29961, 29890, 29908, 29873, 488, 1111, 536, 16862, 13808, 3101, 13, 4706, 565, 2030, 29918, 12523, 29901, 13, 9651, 17927, 29889, 3888, 703, 2772, 1026, 292, 1273, 29881, 2030, 4436, 613, 7431, 29898, 1025, 29918, 12523, 876, 13, 9651, 1583, 3032, 6207, 29889, 29916, 6144, 29898, 1311, 3032, 12523, 29918, 978, 29892, 334, 1025, 29918, 12523, 29897, 13, 4706, 736, 260, 5475, 29918, 262, 29918, 2704, 13, 2 ]
src/app/domains/user.py
hap0n/employee-management-system
0
148238
from dataclasses import dataclass from enum import Enum from typing import Optional class Role(str, Enum): user = "user" hr = "hr" admin = "admin" @dataclass class User: username: str password_hash: str id: Optional[int] = None role: Role = Role.user
[ 1, 515, 848, 13203, 1053, 848, 1990, 13, 3166, 14115, 1053, 1174, 398, 13, 3166, 19229, 1053, 28379, 13, 13, 13, 1990, 1528, 280, 29898, 710, 29892, 1174, 398, 1125, 13, 1678, 1404, 353, 376, 1792, 29908, 13, 1678, 22157, 353, 376, 1092, 29908, 13, 1678, 4113, 353, 376, 6406, 29908, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4911, 29901, 13, 1678, 8952, 29901, 851, 13, 1678, 4800, 29918, 8568, 29901, 851, 13, 1678, 1178, 29901, 28379, 29961, 524, 29962, 353, 6213, 13, 1678, 6297, 29901, 1528, 280, 353, 1528, 280, 29889, 1792, 13, 2 ]
tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py
pozdnyakov/chromium-crosswalk
0
142845
# Copyright (c) 2012 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. """Finds desktop browsers that can be controlled by telemetry.""" import logging import os import subprocess import sys from telemetry.core import browser from telemetry.core import possible_browser from telemetry.core import profile_types from telemetry.core.chrome import desktop_browser_backend from telemetry.core.platform import linux_platform_backend from telemetry.core.platform import mac_platform_backend from telemetry.core.platform import win_platform_backend ALL_BROWSER_TYPES = ','.join([ 'exact', 'release', 'debug', 'canary', 'content-shell-debug', 'content-shell-release', 'system']) class PossibleDesktopBrowser(possible_browser.PossibleBrowser): """A desktop browser that can be controlled.""" def __init__(self, browser_type, options, executable, is_content_shell): super(PossibleDesktopBrowser, self).__init__(browser_type, options) self._local_executable = executable self._is_content_shell = is_content_shell def __repr__(self): return 'PossibleDesktopBrowser(browser_type=%s)' % self.browser_type # Constructs a browser. # Returns a touple of the form: (browser, backend) def _CreateBrowserInternal(self, delete_profile_dir_after_run): backend = desktop_browser_backend.DesktopBrowserBackend( self._options, self._local_executable, self._is_content_shell, delete_profile_dir_after_run=delete_profile_dir_after_run) if sys.platform.startswith('linux'): p = linux_platform_backend.LinuxPlatformBackend() elif sys.platform == 'darwin': p = mac_platform_backend.MacPlatformBackend() elif sys.platform == 'win32': p = win_platform_backend.WinPlatformBackend() else: raise NotImplementedError() b = browser.Browser(backend, p) backend.SetBrowser(b) return (b, backend) def Create(self): # If a dirty profile is needed, instantiate an initial browser object and # use that to create a dirty profile. creator_class = profile_types.GetProfileCreator(self.options.profile_type) if creator_class: logging.info( 'Creating a dirty profile of type: %s', self.options.profile_type) (b, backend) = \ self._CreateBrowserInternal(delete_profile_dir_after_run=False) with b as b: creator = creator_class(b) creator.CreateProfile() dirty_profile_dir = backend.profile_directory logging.info( "Dirty profile created succesfully in '%s'", dirty_profile_dir) # Now create another browser to run tests on using the dirty profile # we just created. (b, backend) = \ self._CreateBrowserInternal(delete_profile_dir_after_run=True) backend.SetProfileDirectory(dirty_profile_dir) else: (b, backend) = \ self._CreateBrowserInternal(delete_profile_dir_after_run=True) return b def SupportsOptions(self, options): if (len(options.extensions_to_load) != 0) and self._is_content_shell: return False return True def FindAllAvailableBrowsers(options): """Finds all the desktop browsers available on this machine.""" browsers = [] has_display = True if (sys.platform.startswith('linux') and os.getenv('DISPLAY') == None): has_display = False # Add the explicit browser executable if given. if options.browser_executable: normalized_executable = os.path.expanduser(options.browser_executable) if os.path.exists(normalized_executable): browsers.append(PossibleDesktopBrowser('exact', options, normalized_executable, False)) else: logging.warning('%s specified by browser_executable does not exist', normalized_executable) # Look for a browser in the standard chrome build locations. if options.chrome_root: chrome_root = options.chrome_root else: chrome_root = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..') if sys.platform == 'darwin': chromium_app_name = 'Chromium.app/Contents/MacOS/Chromium' content_shell_app_name = 'Content Shell.app/Contents/MacOS/Content Shell' elif sys.platform.startswith('linux'): chromium_app_name = 'chrome' content_shell_app_name = 'content_shell' elif sys.platform.startswith('win'): chromium_app_name = 'chrome.exe' content_shell_app_name = 'content_shell.exe' else: raise Exception('Platform not recognized') build_dirs = ['build', 'out', 'sconsbuild', 'xcodebuild'] def AddIfFound(browser_type, type_dir, app_name, content_shell): for build_dir in build_dirs: app = os.path.join(chrome_root, build_dir, type_dir, app_name) if os.path.exists(app): browsers.append(PossibleDesktopBrowser(browser_type, options, app, content_shell)) return True return False # Add local builds AddIfFound('debug', 'Debug', chromium_app_name, False) AddIfFound('content-shell-debug', 'Debug', content_shell_app_name, True) AddIfFound('release', 'Release', chromium_app_name, False) AddIfFound('content-shell-release', 'Release', content_shell_app_name, True) # Mac-specific options. if sys.platform == 'darwin': mac_canary = ('/Applications/Google Chrome Canary.app/' 'Contents/MacOS/Google Chrome Canary') mac_system = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' if os.path.exists(mac_canary): browsers.append(PossibleDesktopBrowser('canary', options, mac_canary, False)) if os.path.exists(mac_system): browsers.append(PossibleDesktopBrowser('system', options, mac_system, False)) # Linux specific options. if sys.platform.startswith('linux'): # Look for a google-chrome instance. found = False try: with open(os.devnull, 'w') as devnull: found = subprocess.call(['google-chrome', '--version'], stdout=devnull, stderr=devnull) == 0 except OSError: pass if found: browsers.append( PossibleDesktopBrowser('system', options, 'google-chrome', False)) # Win32-specific options. if sys.platform.startswith('win'): system_path = os.path.join('Google', 'Chrome', 'Application') canary_path = os.path.join('Google', 'Chrome SxS', 'Application') win_search_paths = [os.getenv('PROGRAMFILES(X86)'), os.getenv('PROGRAMFILES'), os.getenv('LOCALAPPDATA')] for path in win_search_paths: if not path: continue if AddIfFound('canary', os.path.join(path, canary_path), chromium_app_name, False): break for path in win_search_paths: if not path: continue if AddIfFound('system', os.path.join(path, system_path), chromium_app_name, False): break if len(browsers) and not has_display: logging.warning( 'Found (%s), but you do not have a DISPLAY environment set.' % ','.join([b.browser_type for b in browsers])) return [] return browsers
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29906, 450, 678, 456, 1974, 13189, 943, 29889, 2178, 10462, 21676, 29889, 13, 29937, 4803, 310, 445, 2752, 775, 338, 4095, 287, 491, 263, 350, 7230, 29899, 3293, 19405, 393, 508, 367, 13, 29937, 1476, 297, 278, 365, 2965, 1430, 1660, 934, 29889, 13, 15945, 29908, 12542, 29879, 14616, 14376, 393, 508, 367, 20704, 491, 734, 2409, 27184, 1213, 15945, 13, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 13, 3166, 734, 2409, 27184, 29889, 3221, 1053, 4714, 13, 3166, 734, 2409, 27184, 29889, 3221, 1053, 1950, 29918, 15965, 13, 3166, 734, 2409, 27184, 29889, 3221, 1053, 8722, 29918, 8768, 13, 3166, 734, 2409, 27184, 29889, 3221, 29889, 18114, 1053, 14616, 29918, 15965, 29918, 27852, 13, 3166, 734, 2409, 27184, 29889, 3221, 29889, 12120, 1053, 10542, 29918, 12120, 29918, 27852, 13, 3166, 734, 2409, 27184, 29889, 3221, 29889, 12120, 1053, 5825, 29918, 12120, 29918, 27852, 13, 3166, 734, 2409, 27184, 29889, 3221, 29889, 12120, 1053, 5401, 29918, 12120, 29918, 27852, 13, 13, 9818, 29918, 29933, 25180, 6304, 29918, 15631, 29925, 2890, 353, 13420, 4286, 7122, 4197, 13, 1678, 525, 735, 627, 742, 13, 1678, 525, 14096, 742, 13, 1678, 525, 8382, 742, 13, 1678, 525, 3068, 653, 742, 13, 1678, 525, 3051, 29899, 15903, 29899, 8382, 742, 13, 1678, 525, 3051, 29899, 15903, 29899, 14096, 742, 13, 1678, 525, 5205, 11287, 13, 13, 1990, 20049, 17600, 21537, 29898, 27338, 29918, 15965, 29889, 9135, 1687, 21537, 1125, 13, 29871, 9995, 29909, 14616, 4714, 393, 508, 367, 20704, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 4714, 29918, 1853, 29892, 3987, 29892, 16813, 29892, 338, 29918, 3051, 29918, 15903, 1125, 13, 1678, 2428, 29898, 9135, 1687, 17600, 21537, 29892, 1583, 467, 1649, 2344, 12035, 15965, 29918, 1853, 29892, 3987, 29897, 13, 1678, 1583, 3032, 2997, 29918, 4258, 9246, 353, 16813, 13, 1678, 1583, 3032, 275, 29918, 3051, 29918, 15903, 353, 338, 29918, 3051, 29918, 15903, 13, 13, 29871, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 1678, 736, 525, 9135, 1687, 17600, 21537, 29898, 15965, 29918, 1853, 16328, 29879, 16029, 1273, 1583, 29889, 15965, 29918, 1853, 13, 13, 29871, 396, 1281, 4984, 29879, 263, 4714, 29889, 13, 29871, 396, 16969, 263, 11943, 552, 310, 278, 883, 29901, 313, 15965, 29892, 14998, 29897, 13, 29871, 822, 903, 4391, 21537, 16491, 29898, 1311, 29892, 5217, 29918, 10185, 29918, 3972, 29918, 7045, 29918, 3389, 1125, 13, 1678, 14998, 353, 14616, 29918, 15965, 29918, 27852, 29889, 17600, 21537, 5841, 355, 29898, 13, 4706, 1583, 3032, 6768, 29892, 1583, 3032, 2997, 29918, 4258, 9246, 29892, 1583, 3032, 275, 29918, 3051, 29918, 15903, 29892, 13, 4706, 5217, 29918, 10185, 29918, 3972, 29918, 7045, 29918, 3389, 29922, 8143, 29918, 10185, 29918, 3972, 29918, 7045, 29918, 3389, 29897, 13, 1678, 565, 10876, 29889, 12120, 29889, 27382, 2541, 877, 9389, 29374, 13, 418, 282, 353, 10542, 29918, 12120, 29918, 27852, 29889, 24085, 21889, 5841, 355, 580, 13, 1678, 25342, 10876, 29889, 12120, 1275, 525, 16702, 5080, 2396, 13, 418, 282, 353, 5825, 29918, 12120, 29918, 27852, 29889, 15735, 21889, 5841, 355, 580, 13, 1678, 25342, 10876, 29889, 12120, 1275, 525, 5080, 29941, 29906, 2396, 13, 418, 282, 353, 5401, 29918, 12120, 29918, 27852, 29889, 17734, 21889, 5841, 355, 580, 13, 1678, 1683, 29901, 13, 418, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 1678, 289, 353, 4714, 29889, 21537, 29898, 27852, 29892, 282, 29897, 13, 1678, 14998, 29889, 2697, 21537, 29898, 29890, 29897, 13, 1678, 736, 313, 29890, 29892, 14998, 29897, 13, 13, 29871, 822, 6204, 29898, 1311, 1125, 13, 1678, 396, 960, 263, 26616, 8722, 338, 4312, 29892, 25112, 385, 2847, 4714, 1203, 322, 13, 1678, 396, 671, 393, 304, 1653, 263, 26616, 8722, 29889, 13, 1678, 907, 1061, 29918, 1990, 353, 8722, 29918, 8768, 29889, 2577, 13909, 9832, 1061, 29898, 1311, 29889, 6768, 29889, 10185, 29918, 1853, 29897, 13, 1678, 565, 907, 1061, 29918, 1990, 29901, 13, 418, 12183, 29889, 3888, 29898, 13, 3986, 525, 9832, 1218, 263, 26616, 8722, 310, 1134, 29901, 1273, 29879, 742, 1583, 29889, 6768, 29889, 10185, 29918, 1853, 29897, 13, 418, 313, 29890, 29892, 14998, 29897, 353, 320, 13, 3986, 1583, 3032, 4391, 21537, 16491, 29898, 8143, 29918, 10185, 29918, 3972, 29918, 7045, 29918, 3389, 29922, 8824, 29897, 13, 418, 411, 289, 408, 289, 29901, 13, 4706, 907, 1061, 353, 907, 1061, 29918, 1990, 29898, 29890, 29897, 13, 4706, 907, 1061, 29889, 4391, 13909, 580, 13, 4706, 26616, 29918, 10185, 29918, 3972, 353, 14998, 29889, 10185, 29918, 12322, 13, 4706, 12183, 29889, 3888, 29898, 13, 9651, 376, 9170, 1017, 8722, 2825, 8348, 267, 3730, 297, 14210, 29879, 29915, 613, 26616, 29918, 10185, 29918, 3972, 29897, 13, 13, 418, 396, 2567, 1653, 1790, 4714, 304, 1065, 6987, 373, 773, 278, 26616, 8722, 13, 418, 396, 591, 925, 2825, 29889, 13, 418, 313, 29890, 29892, 14998, 29897, 353, 320, 13, 3986, 1583, 3032, 4391, 21537, 16491, 29898, 8143, 29918, 10185, 29918, 3972, 29918, 7045, 29918, 3389, 29922, 5574, 29897, 13, 418, 14998, 29889, 2697, 13909, 9882, 29898, 3972, 1017, 29918, 10185, 29918, 3972, 29897, 13, 1678, 1683, 29901, 13, 418, 313, 29890, 29892, 14998, 29897, 353, 320, 13, 3986, 1583, 3032, 4391, 21537, 16491, 29898, 8143, 29918, 10185, 29918, 3972, 29918, 7045, 29918, 3389, 29922, 5574, 29897, 13, 1678, 736, 289, 13, 13, 29871, 822, 18601, 29879, 5856, 29898, 1311, 29892, 3987, 1125, 13, 1678, 565, 313, 2435, 29898, 6768, 29889, 24299, 29918, 517, 29918, 1359, 29897, 2804, 29871, 29900, 29897, 322, 1583, 3032, 275, 29918, 3051, 29918, 15903, 29901, 13, 418, 736, 7700, 13, 1678, 736, 5852, 13, 13, 1753, 10987, 3596, 27635, 29933, 798, 4253, 29898, 6768, 1125, 13, 29871, 9995, 12542, 29879, 599, 278, 14616, 14376, 3625, 373, 445, 4933, 1213, 15945, 13, 29871, 14376, 353, 5159, 13, 13, 29871, 756, 29918, 4990, 353, 5852, 13, 29871, 565, 313, 9675, 29889, 12120, 29889, 27382, 2541, 877, 9389, 1495, 322, 13, 418, 2897, 29889, 657, 6272, 877, 23711, 29925, 18799, 1495, 1275, 6213, 1125, 13, 1678, 756, 29918, 4990, 353, 7700, 13, 13, 29871, 396, 3462, 278, 6261, 4714, 16813, 565, 2183, 29889, 13, 29871, 565, 3987, 29889, 15965, 29918, 4258, 9246, 29901, 13, 1678, 4226, 1891, 29918, 4258, 9246, 353, 2897, 29889, 2084, 29889, 18837, 1792, 29898, 6768, 29889, 15965, 29918, 4258, 9246, 29897, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 29898, 8945, 1891, 29918, 4258, 9246, 1125, 13, 418, 14376, 29889, 4397, 29898, 9135, 1687, 17600, 21537, 877, 735, 627, 742, 3987, 29892, 13, 462, 462, 632, 4226, 1891, 29918, 4258, 9246, 29892, 7700, 876, 13, 1678, 1683, 29901, 13, 418, 12183, 29889, 27392, 877, 29995, 29879, 6790, 491, 4714, 29918, 4258, 9246, 947, 451, 1863, 742, 13, 462, 418, 4226, 1891, 29918, 4258, 9246, 29897, 13, 13, 29871, 396, 7419, 363, 263, 4714, 297, 278, 3918, 16735, 2048, 14354, 29889, 13, 29871, 565, 3987, 29889, 18114, 29918, 4632, 29901, 13, 1678, 16735, 29918, 4632, 353, 3987, 29889, 18114, 29918, 4632, 13, 29871, 1683, 29901, 13, 1678, 16735, 29918, 4632, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 13, 462, 1669, 525, 636, 742, 525, 636, 742, 525, 636, 742, 525, 636, 742, 525, 636, 1495, 13, 13, 29871, 565, 10876, 29889, 12120, 1275, 525, 16702, 5080, 2396, 13, 1678, 25173, 1974, 29918, 932, 29918, 978, 353, 525, 1451, 456, 1974, 29889, 932, 29914, 21002, 29914, 15735, 3267, 29914, 1451, 456, 1974, 29915, 13, 1678, 2793, 29918, 15903, 29918, 932, 29918, 978, 353, 525, 3916, 1383, 514, 29889, 932, 29914, 21002, 29914, 15735, 3267, 29914, 3916, 1383, 514, 29915, 13, 29871, 25342, 10876, 29889, 12120, 29889, 27382, 2541, 877, 9389, 29374, 13, 1678, 25173, 1974, 29918, 932, 29918, 978, 353, 525, 18114, 29915, 13, 1678, 2793, 29918, 15903, 29918, 932, 29918, 978, 353, 525, 3051, 29918, 15903, 29915, 13, 29871, 25342, 10876, 29889, 12120, 29889, 27382, 2541, 877, 5080, 29374, 13, 1678, 25173, 1974, 29918, 932, 29918, 978, 353, 525, 18114, 29889, 8097, 29915, 13, 1678, 2793, 29918, 15903, 29918, 932, 29918, 978, 353, 525, 3051, 29918, 15903, 29889, 8097, 29915, 13, 29871, 1683, 29901, 13, 1678, 12020, 8960, 877, 21889, 451, 14831, 1495, 13, 13, 29871, 2048, 29918, 3972, 29879, 353, 6024, 4282, 742, 13, 18884, 525, 449, 742, 13, 18884, 525, 29879, 3200, 4282, 742, 13, 18884, 525, 29916, 401, 4282, 2033, 13, 13, 29871, 822, 3462, 3644, 9692, 29898, 15965, 29918, 1853, 29892, 1134, 29918, 3972, 29892, 623, 29918, 978, 29892, 2793, 29918, 15903, 1125, 13, 1678, 363, 2048, 29918, 3972, 297, 2048, 29918, 3972, 29879, 29901, 13, 418, 623, 353, 2897, 29889, 2084, 29889, 7122, 29898, 18114, 29918, 4632, 29892, 2048, 29918, 3972, 29892, 1134, 29918, 3972, 29892, 623, 29918, 978, 29897, 13, 418, 565, 2897, 29889, 2084, 29889, 9933, 29898, 932, 1125, 13, 4706, 14376, 29889, 4397, 29898, 9135, 1687, 17600, 21537, 29898, 15965, 29918, 1853, 29892, 3987, 29892, 13, 462, 462, 1669, 623, 29892, 2793, 29918, 15903, 876, 13, 4706, 736, 5852, 13, 1678, 736, 7700, 13, 13, 29871, 396, 3462, 1887, 23315, 13, 29871, 3462, 3644, 9692, 877, 8382, 742, 525, 11862, 742, 25173, 1974, 29918, 932, 29918, 978, 29892, 7700, 29897, 13, 29871, 3462, 3644, 9692, 877, 3051, 29899, 15903, 29899, 8382, 742, 525, 11862, 742, 2793, 29918, 15903, 29918, 932, 29918, 978, 29892, 5852, 29897, 13, 29871, 3462, 3644, 9692, 877, 14096, 742, 525, 19729, 742, 25173, 1974, 29918, 932, 29918, 978, 29892, 7700, 29897, 13, 29871, 3462, 3644, 9692, 877, 3051, 29899, 15903, 29899, 14096, 742, 525, 19729, 742, 2793, 29918, 15903, 29918, 932, 29918, 978, 29892, 5852, 29897, 13, 13, 29871, 396, 4326, 29899, 14940, 3987, 29889, 13, 29871, 565, 10876, 29889, 12120, 1275, 525, 16702, 5080, 2396, 13, 1678, 5825, 29918, 3068, 653, 353, 6702, 29914, 2052, 5795, 29914, 14207, 10228, 1815, 653, 29889, 932, 22208, 13, 462, 525, 21002, 29914, 15735, 3267, 29914, 14207, 10228, 1815, 653, 1495, 13, 1678, 5825, 29918, 5205, 353, 8207, 2052, 5795, 29914, 14207, 10228, 29889, 932, 29914, 21002, 29914, 15735, 3267, 29914, 14207, 10228, 29915, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 29898, 8628, 29918, 3068, 653, 1125, 13, 418, 14376, 29889, 4397, 29898, 9135, 1687, 17600, 21537, 877, 3068, 653, 742, 3987, 29892, 13, 462, 462, 632, 5825, 29918, 3068, 653, 29892, 7700, 876, 13, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 29898, 8628, 29918, 5205, 1125, 13, 418, 14376, 29889, 4397, 29898, 9135, 1687, 17600, 21537, 877, 5205, 742, 3987, 29892, 13, 462, 462, 632, 5825, 29918, 5205, 29892, 7700, 876, 13, 13, 29871, 396, 8074, 2702, 3987, 29889, 13, 29871, 565, 10876, 29889, 12120, 29889, 27382, 2541, 877, 9389, 29374, 13, 1678, 396, 7419, 363, 263, 5386, 29899, 18114, 2777, 29889, 13, 1678, 1476, 353, 7700, 13, 1678, 1018, 29901, 13, 418, 411, 1722, 29898, 359, 29889, 3359, 4304, 29892, 525, 29893, 1495, 408, 2906, 4304, 29901, 13, 4706, 1476, 353, 1014, 5014, 29889, 4804, 18959, 3608, 29899, 18114, 742, 525, 489, 3259, 7464, 13, 462, 18884, 27591, 29922, 3359, 4304, 29892, 380, 20405, 29922, 3359, 4304, 29897, 1275, 29871, 29900, 13, 1678, 5174, 438, 29173, 29901, 13, 418, 1209, 13, 1678, 565, 1476, 29901, 13, 418, 14376, 29889, 4397, 29898, 13, 3986, 20049, 17600, 21537, 877, 5205, 742, 3987, 29892, 525, 3608, 29899, 18114, 742, 7700, 876, 13, 13, 29871, 396, 8892, 29941, 29906, 29899, 14940, 3987, 29889, 13, 29871, 565, 10876, 29889, 12120, 29889, 27382, 2541, 877, 5080, 29374, 13, 1678, 1788, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 877, 14207, 742, 525, 1451, 4871, 742, 525, 4873, 1495, 13, 1678, 508, 653, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 877, 14207, 742, 525, 1451, 4871, 317, 29916, 29903, 742, 525, 4873, 1495, 13, 13, 1678, 5401, 29918, 4478, 29918, 24772, 353, 518, 359, 29889, 657, 6272, 877, 8618, 29954, 25058, 24483, 29898, 29990, 29947, 29953, 29897, 5477, 13, 462, 4706, 2897, 29889, 657, 6272, 877, 8618, 29954, 25058, 24483, 5477, 13, 462, 4706, 2897, 29889, 657, 6272, 877, 16652, 1964, 20576, 14573, 1495, 29962, 13, 13, 1678, 363, 2224, 297, 5401, 29918, 4478, 29918, 24772, 29901, 13, 418, 565, 451, 2224, 29901, 13, 4706, 6773, 13, 418, 565, 3462, 3644, 9692, 877, 3068, 653, 742, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 508, 653, 29918, 2084, 511, 13, 462, 1678, 25173, 1974, 29918, 932, 29918, 978, 29892, 7700, 1125, 13, 4706, 2867, 13, 13, 1678, 363, 2224, 297, 5401, 29918, 4478, 29918, 24772, 29901, 13, 418, 565, 451, 2224, 29901, 13, 4706, 6773, 13, 418, 565, 3462, 3644, 9692, 877, 5205, 742, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 1788, 29918, 2084, 511, 13, 462, 1678, 25173, 1974, 29918, 932, 29918, 978, 29892, 7700, 1125, 13, 4706, 2867, 13, 13, 29871, 565, 7431, 29898, 23721, 4253, 29897, 322, 451, 756, 29918, 4990, 29901, 13, 1678, 12183, 29889, 27392, 29898, 13, 418, 525, 9692, 313, 29995, 29879, 511, 541, 366, 437, 451, 505, 263, 28657, 29925, 18799, 5177, 731, 6169, 1273, 13, 418, 13420, 4286, 7122, 4197, 29890, 29889, 15965, 29918, 1853, 363, 289, 297, 14376, 12622, 13, 1678, 736, 5159, 13, 13, 29871, 736, 14376, 13, 2 ]
leetcode/python/medium/p017_letterCombinations.py
kefirzhang/algorithms
0
149190
class Solution: key_map = { "1": [""], "2": ['a', 'b', 'c'], "3": ['d', 'e', 'f'], "4": ['g', 'h', 'i'], "5": ['j', 'k', 'l'], "6": ['m', 'n', 'o'], "7": ['p', 'q', 'r', 's'], "8": ['t', 'u', 'v'], "9": ['w', 'x', 'y', 'z'] } def letterCombinations(self, digits): s_l = [] # 存储的list for i in digits: # 遍历字符 p_l = [] for j in self.key_map.get(i): # 获取对应的map 根上一层是一层的 if len(s_l) == 0: p_l.append(j) continue for k in s_l: p_l.append(k + j) s_l = p_l return s_l slu = Solution() print(slu.letterCombinations("23"))
[ 1, 770, 24380, 29901, 13, 1678, 1820, 29918, 1958, 353, 426, 13, 4706, 376, 29896, 1115, 6796, 12436, 13, 4706, 376, 29906, 1115, 6024, 29874, 742, 525, 29890, 742, 525, 29883, 7464, 13, 4706, 376, 29941, 1115, 6024, 29881, 742, 525, 29872, 742, 525, 29888, 7464, 13, 4706, 376, 29946, 1115, 6024, 29887, 742, 525, 29882, 742, 525, 29875, 7464, 13, 4706, 376, 29945, 1115, 6024, 29926, 742, 525, 29895, 742, 525, 29880, 7464, 13, 4706, 376, 29953, 1115, 6024, 29885, 742, 525, 29876, 742, 525, 29877, 7464, 13, 4706, 376, 29955, 1115, 6024, 29886, 742, 525, 29939, 742, 525, 29878, 742, 525, 29879, 7464, 13, 4706, 376, 29947, 1115, 6024, 29873, 742, 525, 29884, 742, 525, 29894, 7464, 13, 4706, 376, 29929, 1115, 6024, 29893, 742, 525, 29916, 742, 525, 29891, 742, 525, 29920, 2033, 13, 1678, 500, 13, 13, 1678, 822, 5497, 1523, 2109, 800, 29898, 1311, 29892, 13340, 1125, 13, 4706, 269, 29918, 29880, 353, 5159, 29871, 396, 29871, 30946, 232, 133, 171, 30210, 1761, 13, 4706, 363, 474, 297, 13340, 29901, 29871, 396, 29871, 236, 132, 144, 232, 145, 137, 30578, 31277, 13, 9651, 282, 29918, 29880, 353, 5159, 13, 9651, 363, 432, 297, 1583, 29889, 1989, 29918, 1958, 29889, 657, 29898, 29875, 1125, 29871, 396, 29871, 31024, 30683, 30783, 31370, 30210, 1958, 29871, 31393, 30429, 30287, 232, 180, 133, 30392, 30287, 232, 180, 133, 30210, 13, 18884, 565, 7431, 29898, 29879, 29918, 29880, 29897, 1275, 29871, 29900, 29901, 13, 462, 1678, 282, 29918, 29880, 29889, 4397, 29898, 29926, 29897, 13, 462, 1678, 6773, 13, 18884, 363, 413, 297, 269, 29918, 29880, 29901, 13, 462, 1678, 282, 29918, 29880, 29889, 4397, 29898, 29895, 718, 432, 29897, 13, 13, 9651, 269, 29918, 29880, 353, 282, 29918, 29880, 13, 4706, 736, 269, 29918, 29880, 13, 13, 13, 2536, 29884, 353, 24380, 580, 13, 2158, 29898, 2536, 29884, 29889, 15670, 1523, 2109, 800, 703, 29906, 29941, 5783, 13, 2 ]
dom/metadata.py
Starwort/domgen
0
37316
import functools from .base_classes import Container, Void class BaseURL(Void): """The HTML `<base>` element specifies the base URL to use for *all* relative URLs in a document. There can be only one `<base>` element in a document. """ __slots__ = () tag = "base" Base = BaseURL class ExternalResourceLink(Void): """The HTML External Resource Link element (`<link>`) specifies relationships between the current document and an external resource. This element is most commonly used to link to stylesheets, but is also used to establish site icons (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things. """ __slots__ = () tag = "link" Link = ExternalResourceLink ExternalStyleSheet = functools.partial(ExternalResourceLink, rel="stylesheet") class Meta(Void): """The HTML `<meta>` element represents metadata that cannot be represented by other HTML meta-related elements, like `<base>`, `<link>`, `<script>`, `<style>` or `<title>`. """ __slots__ = () tag = "meta" class Style(Container): """The HTML `<style>` element contains style information for a document, or part of a document. """ __slots__ = () tag = "style" class Title(Container): """The HTML Title element (`<title>`) defines the document's title that is shown in a browser's title bar or a page's tab. """ __slots__ = () tag = "title"
[ 1, 1053, 2090, 312, 8789, 13, 13, 3166, 869, 3188, 29918, 13203, 1053, 21679, 29892, 29434, 13, 13, 13, 1990, 7399, 4219, 29898, 29963, 3398, 1125, 13, 1678, 9995, 1576, 4544, 14935, 3188, 13885, 1543, 1580, 11057, 278, 2967, 3988, 304, 671, 363, 334, 497, 29930, 13, 1678, 6198, 24295, 297, 263, 1842, 29889, 1670, 508, 367, 871, 697, 14935, 3188, 13885, 1543, 297, 263, 13, 1678, 1842, 29889, 13, 1678, 9995, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 3861, 13, 1678, 4055, 353, 376, 3188, 29908, 13, 13, 13, 5160, 353, 7399, 4219, 13, 13, 13, 1990, 3985, 6848, 6595, 29898, 29963, 3398, 1125, 13, 1678, 9995, 1576, 4544, 3985, 18981, 6645, 1543, 6695, 29966, 2324, 29958, 6348, 1580, 11057, 13, 1678, 21702, 1546, 278, 1857, 1842, 322, 385, 7029, 6503, 29889, 13, 1678, 910, 1543, 338, 1556, 15574, 1304, 304, 1544, 304, 11949, 354, 1691, 29892, 541, 338, 13, 1678, 884, 1304, 304, 10127, 3268, 27673, 313, 20313, 376, 29888, 485, 4144, 29908, 3114, 27673, 322, 13, 1678, 27673, 363, 278, 3271, 4315, 322, 11446, 373, 10426, 9224, 29897, 4249, 916, 13, 1678, 2712, 29889, 13, 1678, 9995, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 3861, 13, 1678, 4055, 353, 376, 2324, 29908, 13, 13, 13, 6595, 353, 3985, 6848, 6595, 13, 13, 25865, 5568, 10654, 353, 2090, 312, 8789, 29889, 3846, 29898, 25865, 6848, 6595, 29892, 1104, 543, 13558, 1159, 13, 13, 13, 1990, 20553, 29898, 29963, 3398, 1125, 13, 1678, 9995, 1576, 4544, 14935, 7299, 13885, 1543, 11524, 15562, 393, 2609, 367, 13, 1678, 9875, 491, 916, 4544, 12700, 29899, 12817, 3161, 29892, 763, 14935, 3188, 29958, 1673, 13, 1678, 14935, 2324, 29958, 1673, 14935, 2154, 29958, 1673, 14935, 3293, 13885, 470, 14935, 3257, 29958, 1412, 13, 1678, 9995, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 3861, 13, 1678, 4055, 353, 376, 7299, 29908, 13, 13, 13, 1990, 22135, 29898, 7895, 1125, 13, 1678, 9995, 1576, 4544, 14935, 3293, 13885, 1543, 3743, 3114, 2472, 363, 263, 13, 1678, 1842, 29892, 470, 760, 310, 263, 1842, 29889, 13, 1678, 9995, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 3861, 13, 1678, 4055, 353, 376, 3293, 29908, 13, 13, 13, 1990, 18527, 29898, 7895, 1125, 13, 1678, 9995, 1576, 4544, 18527, 1543, 6695, 29966, 3257, 29958, 6348, 17645, 278, 1842, 29915, 29879, 3611, 13, 1678, 393, 338, 4318, 297, 263, 4714, 29915, 29879, 3611, 2594, 470, 263, 1813, 29915, 29879, 4434, 29889, 13, 1678, 9995, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 3861, 13, 1678, 4055, 353, 376, 3257, 29908, 13, 2 ]
parse.py
tochilkinva/parse_and_save_xlsx
0
132858
<reponame>tochilkinva/parse_and_save_xlsx<gh_stars>0 import re from bs4 import BeautifulSoup from selenium import webdriver URL_HH = '''https://hh.ru/search/vacancy?area=1&fromSearchLine =true&st=searchVacancy&text=Python+junior&from=suggest_post''' def get_page(url): """Получаем HTML одной страницы с указанного url""" try: browser = init_browser() browser.get(url) required_html = browser.page_source browser.quit() return required_html except Exception as e: raise Exception( f'Не удалось получить данные: {e}') def get_vacancies(url): """Получаем HTML с нескольких страниц с указанного url и парсим возвращаем вакансии""" try: browser = init_browser() browser.get(url) required_html = browser.page_source vacancies = parse_vacancies(required_html) next_page = get_next_page_or_none(required_html) if next_page is not None: next_page = f'https:/hh.ru{next_page}' loop_breaker = 20 while True: loop_breaker -= 1 if loop_breaker <= 0: break browser.get(next_page) new_required_html = browser.page_source vacancies = {**vacancies, **parse_vacancies(new_required_html)} next_page = get_next_page_or_none(new_required_html) if next_page is not None: next_page = f'https:/hh.ru{next_page}' else: break browser.quit() return vacancies except Exception as e: raise Exception( f'Не удалось получить данные: {e}') def init_browser(): """Настраиваем и запускаем браузер""" options = webdriver.ChromeOptions() options.add_argument('headless') options.add_argument('--ignore-certificate-errors') options.add_argument('--ignore-ssl-errors') return webdriver.Chrome(chrome_options=options) def get_next_page_or_none(required_html): """Получаем ссылку на следующую страницу или None""" try: data = BeautifulSoup(required_html, features='html.parser') next_page = data.find('a', {"data-qa": "pager-next"}) if next_page is None: return None return next_page.get('href') except Exception as e: raise Exception( f'Не удалось получить следующую страницу: {e}') def parse_vacancies(raw_text): """Парсим вакансии""" try: data = BeautifulSoup(raw_text, features='html.parser') vacancies = data.find_all('div', class_='vacancy-serp-item') all_vacancies = {} for vacancy in vacancies: vacancy_name = vacancy.find('a', class_='bloko-link') if vacancy_name is not None: vacancy_name = vacancy_name.text else: vacancy_name = None vacancy_salary = vacancy.find('span', {"data-qa": "vacancy-serp__vacancy-compensation"}) if vacancy_salary is not None: vacancy_salary = vacancy_salary.text vacancy_salary = vacancy_salary.replace('\u202f', '') else: vacancy_salary = None vacancy_employer = vacancy.find('a', {"data-qa": "vacancy-serp__vacancy-employer"}) if vacancy_employer is not None: vacancy_employer = vacancy_employer.text vacancy_employer = vacancy_employer.replace('\xa0', ' ') else: vacancy_employer = None vacancy_responsibility = vacancy.find('div', {"data-qa": "vacancy-serp__vacancy_snippet_responsibility"}) if vacancy_responsibility is not None: vacancy_responsibility = vacancy_responsibility.text else: vacancy_responsibility = None vacancy_requirement = vacancy.find('div', {"data-qa": "vacancy-serp__vacancy_snippet_requirement"}) if vacancy_requirement is not None: vacancy_requirement = vacancy_requirement.text else: vacancy_requirement = None vacancy_date = vacancy.find('span', class_='vacancy-serp-item__publication-date vacancy-serp-item__publication-date_short').text vacancy_id = vacancy.find('a', class_='bloko-button bloko-button_primary bloko-button_small bloko-button_rounded').get('href') vacancy_id = int(re.sub(r'\D*', '', vacancy_id)) vacancy_link = f'https://hh.ru/vacancy/{vacancy_id}' all_vacancies[vacancy_id] = { 'Название': str(vacancy_name), 'Зарплата': str(vacancy_salary), 'Дата': str(vacancy_date), 'Работодатель': str(vacancy_employer), 'Обязанности': str(vacancy_responsibility), 'Требования': str(vacancy_requirement), 'Cсылка': str(vacancy_link) } return all_vacancies except Exception as e: raise Exception( f'Не удалось распарсить вакансии: {e}') if __name__ == '__main__': # html = get_page(URL_HH) # vacancies = parse_vacancies(html) vacancies = get_vacancies(URL_HH) print(len(vacancies))
[ 1, 529, 276, 1112, 420, 29958, 517, 305, 309, 9089, 1564, 29914, 5510, 29918, 392, 29918, 7620, 29918, 20267, 29916, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 337, 13, 13, 3166, 24512, 29946, 1053, 25685, 29903, 1132, 13, 3166, 18866, 1053, 1856, 9465, 13, 13, 4219, 29918, 27590, 353, 14550, 991, 597, 25446, 29889, 582, 29914, 4478, 29914, 29894, 562, 6906, 29973, 6203, 29922, 29896, 29987, 3166, 7974, 3542, 13, 29922, 3009, 29987, 303, 29922, 4478, 29963, 562, 6906, 29987, 726, 29922, 11980, 29974, 29926, 348, 1611, 29987, 3166, 29922, 29879, 688, 7118, 29918, 2490, 12008, 13, 13, 13, 1753, 679, 29918, 3488, 29898, 2271, 1125, 13, 1678, 9995, 20093, 1844, 1282, 3098, 4544, 25816, 8440, 25213, 531, 863, 642, 9661, 1868, 3142, 15945, 29908, 13, 1678, 1018, 29901, 13, 4706, 4714, 353, 2069, 29918, 15965, 580, 13, 4706, 4714, 29889, 657, 29898, 2271, 29897, 13, 4706, 3734, 29918, 1420, 353, 4714, 29889, 3488, 29918, 4993, 13, 4706, 4714, 29889, 28358, 580, 13, 4706, 736, 3734, 29918, 1420, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 12020, 8960, 29898, 13, 9651, 285, 29915, 30029, 29919, 19871, 8641, 12052, 1413, 11650, 3029, 29901, 426, 29872, 29913, 1495, 13, 13, 13, 1753, 679, 29918, 29894, 562, 273, 2478, 29898, 2271, 1125, 13, 1678, 9995, 20093, 1844, 1282, 3098, 4544, 531, 15587, 693, 5736, 8440, 7947, 531, 863, 642, 9661, 1868, 3142, 13, 29917, 7596, 1325, 29959, 6849, 18524, 4826, 3098, 8935, 6244, 29369, 15945, 29908, 13, 1678, 1018, 29901, 13, 4706, 4714, 353, 2069, 29918, 15965, 580, 13, 4706, 4714, 29889, 657, 29898, 2271, 29897, 13, 4706, 3734, 29918, 1420, 353, 4714, 29889, 3488, 29918, 4993, 13, 4706, 11757, 273, 2478, 353, 6088, 29918, 29894, 562, 273, 2478, 29898, 12403, 29918, 1420, 29897, 13, 4706, 2446, 29918, 3488, 353, 679, 29918, 4622, 29918, 3488, 29918, 272, 29918, 9290, 29898, 12403, 29918, 1420, 29897, 13, 13, 4706, 565, 2446, 29918, 3488, 338, 451, 6213, 29901, 13, 9651, 2446, 29918, 3488, 353, 285, 29915, 991, 8419, 25446, 29889, 582, 29912, 4622, 29918, 3488, 10162, 13, 9651, 2425, 29918, 1030, 5790, 353, 29871, 29906, 29900, 13, 9651, 1550, 5852, 29901, 13, 18884, 2425, 29918, 1030, 5790, 22361, 29871, 29896, 13, 18884, 565, 2425, 29918, 1030, 5790, 5277, 29871, 29900, 29901, 13, 462, 1678, 2867, 13, 18884, 4714, 29889, 657, 29898, 4622, 29918, 3488, 29897, 13, 18884, 716, 29918, 12403, 29918, 1420, 353, 4714, 29889, 3488, 29918, 4993, 13, 18884, 11757, 273, 2478, 353, 426, 1068, 29894, 562, 273, 2478, 29892, 3579, 5510, 29918, 29894, 562, 273, 2478, 29898, 1482, 29918, 12403, 29918, 1420, 2915, 13, 18884, 2446, 29918, 3488, 353, 679, 29918, 4622, 29918, 3488, 29918, 272, 29918, 9290, 29898, 1482, 29918, 12403, 29918, 1420, 29897, 13, 18884, 565, 2446, 29918, 3488, 338, 451, 6213, 29901, 13, 462, 1678, 2446, 29918, 3488, 353, 285, 29915, 991, 8419, 25446, 29889, 582, 29912, 4622, 29918, 3488, 10162, 13, 18884, 1683, 29901, 13, 462, 1678, 2867, 13, 13, 4706, 4714, 29889, 28358, 580, 13, 4706, 736, 11757, 273, 2478, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 12020, 8960, 29898, 13, 9651, 285, 29915, 30029, 29919, 19871, 8641, 12052, 1413, 11650, 3029, 29901, 426, 29872, 29913, 1495, 13, 13, 13, 1753, 2069, 29918, 15965, 7295, 13, 1678, 9995, 19193, 5242, 29917, 846, 3098, 606, 1077, 2968, 2494, 3098, 12224, 29960, 13690, 15945, 29908, 13, 1678, 3987, 353, 1856, 9465, 29889, 1451, 4871, 5856, 580, 13, 1678, 3987, 29889, 1202, 29918, 23516, 877, 2813, 2222, 1495, 13, 1678, 3987, 29889, 1202, 29918, 23516, 877, 489, 17281, 29899, 6327, 8021, 29899, 12523, 1495, 13, 1678, 3987, 29889, 1202, 29918, 23516, 877, 489, 17281, 29899, 16265, 29899, 12523, 1495, 13, 1678, 736, 1856, 9465, 29889, 1451, 4871, 29898, 18114, 29918, 6768, 29922, 6768, 29897, 13, 13, 13, 1753, 679, 29918, 4622, 29918, 3488, 29918, 272, 29918, 9290, 29898, 12403, 29918, 1420, 1125, 13, 1678, 9995, 20093, 1844, 1282, 3098, 531, 5551, 29944, 1382, 665, 19139, 30005, 16556, 30005, 8440, 7947, 29960, 7082, 6213, 15945, 29908, 13, 1678, 1018, 29901, 13, 4706, 848, 353, 25685, 29903, 1132, 29898, 12403, 29918, 1420, 29892, 5680, 2433, 1420, 29889, 16680, 1495, 13, 4706, 2446, 29918, 3488, 353, 848, 29889, 2886, 877, 29874, 742, 8853, 1272, 29899, 25621, 1115, 376, 29886, 1875, 29899, 4622, 29908, 1800, 13, 4706, 565, 2446, 29918, 3488, 338, 6213, 29901, 13, 9651, 736, 6213, 13, 4706, 736, 2446, 29918, 3488, 29889, 657, 877, 12653, 1495, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 12020, 8960, 29898, 13, 9651, 285, 29915, 30029, 29919, 19871, 8641, 12052, 1413, 19139, 30005, 16556, 30005, 8440, 7947, 29960, 29901, 426, 29872, 29913, 1495, 13, 13, 13, 1753, 6088, 29918, 29894, 562, 273, 2478, 29898, 1610, 29918, 726, 1125, 13, 1678, 9995, 30013, 1515, 1325, 29959, 8935, 6244, 29369, 15945, 29908, 13, 1678, 1018, 29901, 13, 4706, 848, 353, 25685, 29903, 1132, 29898, 1610, 29918, 726, 29892, 5680, 2433, 1420, 29889, 16680, 1495, 13, 4706, 11757, 273, 2478, 353, 848, 29889, 2886, 29918, 497, 877, 4563, 742, 770, 29918, 2433, 29894, 562, 6906, 29899, 643, 29886, 29899, 667, 1495, 13, 4706, 599, 29918, 29894, 562, 273, 2478, 353, 6571, 13, 4706, 363, 11757, 6906, 297, 11757, 273, 2478, 29901, 13, 9651, 11757, 6906, 29918, 978, 353, 11757, 6906, 29889, 2886, 877, 29874, 742, 770, 29918, 2433, 14073, 2901, 29899, 2324, 1495, 13, 9651, 565, 11757, 6906, 29918, 978, 338, 451, 6213, 29901, 13, 18884, 11757, 6906, 29918, 978, 353, 11757, 6906, 29918, 978, 29889, 726, 13, 9651, 1683, 29901, 13, 18884, 11757, 6906, 29918, 978, 353, 6213, 13, 13, 9651, 11757, 6906, 29918, 19585, 653, 353, 11757, 6906, 29889, 2886, 877, 9653, 742, 8853, 1272, 29899, 25621, 1115, 376, 29894, 562, 6906, 29899, 643, 29886, 1649, 29894, 562, 6906, 29899, 2388, 575, 362, 29908, 1800, 13, 9651, 565, 11757, 6906, 29918, 19585, 653, 338, 451, 6213, 29901, 13, 18884, 11757, 6906, 29918, 19585, 653, 353, 11757, 6906, 29918, 19585, 653, 29889, 726, 13, 18884, 11757, 6906, 29918, 19585, 653, 353, 11757, 6906, 29918, 19585, 653, 29889, 6506, 28909, 29884, 29906, 29900, 29906, 29888, 742, 27255, 13, 9651, 1683, 29901, 13, 18884, 11757, 6906, 29918, 19585, 653, 353, 6213, 13, 13, 9651, 11757, 6906, 29918, 3451, 2376, 261, 353, 11757, 6906, 29889, 2886, 877, 29874, 742, 8853, 1272, 29899, 25621, 1115, 376, 29894, 562, 6906, 29899, 643, 29886, 1649, 29894, 562, 6906, 29899, 3451, 2376, 261, 29908, 1800, 13, 9651, 565, 11757, 6906, 29918, 3451, 2376, 261, 338, 451, 6213, 29901, 13, 18884, 11757, 6906, 29918, 3451, 2376, 261, 353, 11757, 6906, 29918, 3451, 2376, 261, 29889, 726, 13, 18884, 11757, 6906, 29918, 3451, 2376, 261, 353, 11757, 6906, 29918, 3451, 2376, 261, 29889, 6506, 28909, 17367, 29900, 742, 525, 25710, 13, 9651, 1683, 29901, 13, 18884, 11757, 6906, 29918, 3451, 2376, 261, 353, 6213, 13, 13, 9651, 11757, 6906, 29918, 26679, 4127, 353, 11757, 6906, 29889, 2886, 877, 4563, 742, 8853, 1272, 29899, 25621, 1115, 376, 29894, 562, 6906, 29899, 643, 29886, 1649, 29894, 562, 6906, 29918, 29879, 1240, 7988, 29918, 26679, 4127, 29908, 1800, 13, 9651, 565, 11757, 6906, 29918, 26679, 4127, 338, 451, 6213, 29901, 13, 18884, 11757, 6906, 29918, 26679, 4127, 353, 11757, 6906, 29918, 26679, 4127, 29889, 726, 13, 9651, 1683, 29901, 13, 18884, 11757, 6906, 29918, 26679, 4127, 353, 6213, 13, 13, 9651, 11757, 6906, 29918, 12277, 358, 353, 11757, 6906, 29889, 2886, 877, 4563, 742, 8853, 1272, 29899, 25621, 1115, 376, 29894, 562, 6906, 29899, 643, 29886, 1649, 29894, 562, 6906, 29918, 29879, 1240, 7988, 29918, 12277, 358, 29908, 1800, 13, 9651, 565, 11757, 6906, 29918, 12277, 358, 338, 451, 6213, 29901, 13, 18884, 11757, 6906, 29918, 12277, 358, 353, 11757, 6906, 29918, 12277, 358, 29889, 726, 13, 9651, 1683, 29901, 13, 18884, 11757, 6906, 29918, 12277, 358, 353, 6213, 13, 13, 9651, 11757, 6906, 29918, 1256, 353, 11757, 6906, 29889, 2886, 877, 9653, 742, 13, 462, 462, 4706, 770, 29918, 2433, 29894, 562, 6906, 29899, 643, 29886, 29899, 667, 1649, 3597, 362, 29899, 1256, 11757, 6906, 29899, 643, 29886, 29899, 667, 1649, 3597, 362, 29899, 1256, 29918, 12759, 2824, 726, 13, 13, 9651, 11757, 6906, 29918, 333, 353, 11757, 6906, 29889, 2886, 877, 29874, 742, 13, 462, 462, 418, 770, 29918, 2433, 14073, 2901, 29899, 3092, 6668, 2901, 29899, 3092, 29918, 16072, 6668, 2901, 29899, 3092, 29918, 9278, 6668, 2901, 29899, 3092, 29918, 29878, 7261, 2824, 657, 877, 12653, 1495, 13, 9651, 11757, 6906, 29918, 333, 353, 938, 29898, 276, 29889, 1491, 29898, 29878, 12764, 29928, 29930, 742, 15516, 11757, 6906, 29918, 333, 876, 13, 13, 9651, 11757, 6906, 29918, 2324, 353, 285, 29915, 991, 597, 25446, 29889, 582, 29914, 29894, 562, 6906, 19248, 29894, 562, 6906, 29918, 333, 10162, 13, 13, 9651, 599, 29918, 29894, 562, 273, 2478, 29961, 29894, 562, 6906, 29918, 333, 29962, 353, 426, 13, 18884, 525, 19193, 7617, 1755, 2396, 851, 29898, 29894, 562, 6906, 29918, 978, 511, 13, 18884, 525, 30060, 1515, 18478, 676, 2396, 851, 29898, 29894, 562, 6906, 29918, 19585, 653, 511, 13, 18884, 525, 30032, 29910, 676, 2396, 851, 29898, 29894, 562, 6906, 29918, 1256, 511, 13, 18884, 525, 30027, 29910, 1782, 702, 840, 2584, 2396, 851, 29898, 29894, 562, 6906, 29918, 3451, 2376, 261, 511, 13, 18884, 525, 30038, 20884, 9661, 5395, 2396, 851, 29898, 29894, 562, 6906, 29918, 26679, 4127, 511, 13, 18884, 525, 30041, 587, 29975, 1263, 1587, 2396, 851, 29898, 29894, 562, 6906, 29918, 12277, 358, 511, 13, 18884, 525, 29907, 5551, 16166, 2396, 851, 29898, 29894, 562, 6906, 29918, 2324, 29897, 13, 9651, 500, 13, 4706, 736, 599, 29918, 29894, 562, 273, 2478, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 12020, 8960, 29898, 13, 9651, 285, 29915, 30029, 29919, 19871, 8641, 7421, 11396, 1325, 1413, 8935, 6244, 29369, 29901, 426, 29872, 29913, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 3472, 353, 679, 29918, 3488, 29898, 4219, 29918, 27590, 29897, 13, 1678, 396, 11757, 273, 2478, 353, 6088, 29918, 29894, 562, 273, 2478, 29898, 1420, 29897, 13, 1678, 11757, 273, 2478, 353, 679, 29918, 29894, 562, 273, 2478, 29898, 4219, 29918, 27590, 29897, 13, 1678, 1596, 29898, 2435, 29898, 29894, 562, 273, 2478, 876, 13, 2 ]
src/egl/generate/gen_egl_dispatch.py
thermasol/mesa3d
0
136938
<gh_stars>0 #!/usr/bin/env python # (C) Copyright 2016, NVIDIA CORPORATION. # All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # on the rights to use, copy, modify, merge, publish, distribute, sub # license, and/or sell copies of the Software, and to permit persons to whom # the Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL # IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # # Authors: # <NAME> <<EMAIL>> """ Generates dispatch functions for EGL. The list of functions and arguments is read from the Khronos's XML files, with additional information defined in the module eglFunctionList. """ import argparse import collections import eglFunctionList import sys import textwrap import os NEWAPI = os.path.join(os.path.dirname(__file__), "..", "..", "mapi", "new") sys.path.insert(0, NEWAPI) import genCommon def main(): parser = argparse.ArgumentParser() parser.add_argument("target", choices=("header", "source"), help="Whether to build the source or header file.") parser.add_argument("xml_files", nargs="+", help="The XML files with the EGL function lists.") args = parser.parse_args() xmlFunctions = genCommon.getFunctions(args.xml_files) xmlByName = dict((f.name, f) for f in xmlFunctions) functions = [] for (name, eglFunc) in eglFunctionList.EGL_FUNCTIONS: func = xmlByName[name] eglFunc = fixupEglFunc(func, eglFunc) functions.append((func, eglFunc)) # Sort the function list by name. functions = sorted(functions, key=lambda f: f[0].name) if args.target == "header": text = generateHeader(functions) elif args.target == "source": text = generateSource(functions) sys.stdout.write(text) def fixupEglFunc(func, eglFunc): result = dict(eglFunc) if result.get("prefix") is None: result["prefix"] = "" if result.get("extension") is not None: text = "defined(" + result["extension"] + ")" result["extension"] = text if result["method"] in ("none", "custom"): return result if result["method"] not in ("display", "device", "current"): raise ValueError("Invalid dispatch method %r for function %r" % (result["method"], func.name)) if func.hasReturn(): if result.get("retval") is None: result["retval"] = getDefaultReturnValue(func.rt) return result def generateHeader(functions): text = textwrap.dedent(r""" #ifndef G_EGLDISPATCH_STUBS_H #define G_EGLDISPATCH_STUBS_H #ifdef __cplusplus extern "C" { #endif #include <EGL/egl.h> #include <EGL/eglext.h> #include "glvnd/libeglabi.h" """.lstrip("\n")) text += "enum {\n" for (func, eglFunc) in functions: text += generateGuardBegin(func, eglFunc) text += " __EGL_DISPATCH_" + func.name + ",\n" text += generateGuardEnd(func, eglFunc) text += " __EGL_DISPATCH_COUNT\n" text += "};\n" for (func, eglFunc) in functions: if eglFunc["inheader"]: text += generateGuardBegin(func, eglFunc) text += "{f.rt} EGLAPIENTRY {ex[prefix]}{f.name}({f.decArgs});\n".format(f=func, ex=eglFunc) text += generateGuardEnd(func, eglFunc) text += textwrap.dedent(r""" #ifdef __cplusplus } #endif #endif // G_EGLDISPATCH_STUBS_H """) return text def generateSource(functions): # First, sort the function list by name. text = "" text += '#include "egldispatchstubs.h"\n' text += '#include "g_egldispatchstubs.h"\n' text += "\n" for (func, eglFunc) in functions: if eglFunc["method"] not in ("custom", "none"): text += generateGuardBegin(func, eglFunc) text += generateDispatchFunc(func, eglFunc) text += generateGuardEnd(func, eglFunc) text += "\n" text += "const char * const __EGL_DISPATCH_FUNC_NAMES[__EGL_DISPATCH_COUNT + 1] = {\n" for (func, eglFunc) in functions: text += generateGuardBegin(func, eglFunc) text += ' "' + func.name + '",\n' text += generateGuardEnd(func, eglFunc) text += " NULL\n" text += "};\n" text += "const __eglMustCastToProperFunctionPointerType __EGL_DISPATCH_FUNCS[__EGL_DISPATCH_COUNT + 1] = {\n" for (func, eglFunc) in functions: text += generateGuardBegin(func, eglFunc) if eglFunc["method"] != "none": text += " (__eglMustCastToProperFunctionPointerType) " + eglFunc.get("prefix", "") + func.name + ",\n" else: text += " NULL, // " + func.name + "\n" text += generateGuardEnd(func, eglFunc) text += " NULL\n" text += "};\n" return text def generateGuardBegin(func, eglFunc): ext = eglFunc.get("extension") if ext is not None: return "#if " + ext + "\n" else: return "" def generateGuardEnd(func, eglFunc): if eglFunc.get("extension") is not None: return "#endif\n" else: return "" def generateDispatchFunc(func, eglFunc): text = "" if eglFunc.get("static"): text += "static " elif eglFunc.get("public"): text += "PUBLIC " text += textwrap.dedent( r""" {f.rt} EGLAPIENTRY {ef[prefix]}{f.name}({f.decArgs}) {{ typedef {f.rt} EGLAPIENTRY (* _pfn_{f.name})({f.decArgs}); """).lstrip("\n").format(f=func, ef=eglFunc) if func.hasReturn(): text += " {f.rt} _ret = {ef[retval]};\n".format(f=func, ef=eglFunc) text += " _pfn_{f.name} _ptr_{f.name} = (_pfn_{f.name}) ".format(f=func) if eglFunc["method"] == "current": text += "__eglDispatchFetchByCurrent(__EGL_DISPATCH_{f.name});\n".format(f=func) elif eglFunc["method"] in ("display", "device"): if eglFunc["method"] == "display": lookupFunc = "__eglDispatchFetchByDisplay" lookupType = "EGLDisplay" else: assert eglFunc["method"] == "device" lookupFunc = "__eglDispatchFetchByDevice" lookupType = "EGLDeviceEXT" lookupArg = None for arg in func.args: if arg.type == lookupType: lookupArg = arg.name break if lookupArg is None: raise ValueError("Can't find %s argument for function %s" % (lookupType, func.name,)) text += "{lookupFunc}({lookupArg}, __EGL_DISPATCH_{f.name});\n".format( f=func, lookupFunc=lookupFunc, lookupArg=lookupArg) else: raise ValueError("Unknown dispatch method: %r" % (eglFunc["method"],)) text += " if(_ptr_{f.name} != NULL) {{\n".format(f=func) text += " " if func.hasReturn(): text += "_ret = " text += "_ptr_{f.name}({f.callArgs});\n".format(f=func) text += " }\n" if func.hasReturn(): text += " return _ret;\n" text += "}\n" return text def getDefaultReturnValue(typename): if typename.endswith("*"): return "NULL" elif typename == "EGLDisplay": return "EGL_NO_DISPLAY" elif typename == "EGLContext": return "EGL_NO_CONTEXT" elif typename == "EGLSurface": return "EGL_NO_SURFACE" elif typename == "EGLBoolean": return "EGL_FALSE"; return "0" if __name__ == "__main__": main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 29937, 313, 29907, 29897, 14187, 1266, 29871, 29906, 29900, 29896, 29953, 29892, 405, 13044, 10764, 315, 1955, 29925, 1955, 8098, 29889, 13, 29937, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 20894, 2333, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 13, 29937, 3509, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 13, 29937, 304, 5376, 297, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 13, 29937, 373, 278, 10462, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 1014, 13, 29937, 19405, 29892, 322, 29914, 272, 19417, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 13, 29937, 278, 18540, 338, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 29937, 13, 29937, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 313, 18271, 278, 2446, 13, 29937, 14880, 29897, 4091, 367, 5134, 297, 599, 14591, 470, 23228, 2011, 1080, 310, 278, 13, 29937, 18540, 29889, 13, 29937, 13, 29937, 6093, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 29937, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 13, 29937, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 29899, 1177, 15860, 1177, 1692, 13780, 29889, 29871, 2672, 11698, 382, 29963, 3919, 24972, 9818, 13, 29937, 27955, 5300, 29914, 1955, 306, 9375, 317, 4897, 29925, 5265, 23598, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 13, 29937, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 13, 29937, 3895, 29892, 19474, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 13, 29937, 2672, 6093, 7791, 7818, 12982, 1525, 29889, 13, 29937, 13, 29937, 13189, 943, 29901, 13, 29937, 1678, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 13, 15945, 29908, 13, 5631, 1078, 13916, 3168, 363, 382, 7239, 29889, 13, 13, 1576, 1051, 310, 3168, 322, 6273, 338, 1303, 515, 278, 476, 1092, 265, 359, 29915, 29879, 6560, 2066, 29892, 411, 13, 1202, 3245, 2472, 3342, 297, 278, 3883, 321, 3820, 6678, 1293, 29889, 13, 15945, 29908, 13, 13, 5215, 1852, 5510, 13, 5215, 16250, 13, 5215, 321, 3820, 6678, 1293, 13, 5215, 10876, 13, 5215, 1426, 6312, 13, 13, 5215, 2897, 13, 28577, 8787, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 376, 636, 613, 376, 636, 613, 376, 1958, 29875, 613, 376, 1482, 1159, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 29091, 8787, 29897, 13, 5215, 2531, 18877, 13, 13, 1753, 1667, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 5182, 613, 19995, 29922, 703, 6672, 613, 376, 4993, 4968, 13, 9651, 1371, 543, 8809, 1979, 304, 2048, 278, 2752, 470, 4839, 934, 23157, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 3134, 29918, 5325, 613, 302, 5085, 543, 29974, 613, 1371, 543, 1576, 6560, 2066, 411, 278, 382, 7239, 740, 8857, 23157, 13, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 4903, 6678, 29879, 353, 2531, 18877, 29889, 657, 6678, 29879, 29898, 5085, 29889, 3134, 29918, 5325, 29897, 13, 1678, 4903, 2059, 1170, 353, 9657, 3552, 29888, 29889, 978, 29892, 285, 29897, 363, 285, 297, 4903, 6678, 29879, 29897, 13, 1678, 3168, 353, 5159, 13, 1678, 363, 313, 978, 29892, 321, 3820, 14400, 29897, 297, 321, 3820, 6678, 1293, 29889, 29923, 7239, 29918, 29943, 28700, 29903, 29901, 13, 4706, 3653, 353, 4903, 2059, 1170, 29961, 978, 29962, 13, 4706, 321, 3820, 14400, 353, 2329, 786, 29923, 3820, 14400, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 4706, 3168, 29889, 4397, 3552, 9891, 29892, 321, 3820, 14400, 876, 13, 13, 1678, 396, 20025, 278, 740, 1051, 491, 1024, 29889, 13, 1678, 3168, 353, 12705, 29898, 12171, 29892, 1820, 29922, 2892, 285, 29901, 285, 29961, 29900, 1822, 978, 29897, 13, 13, 1678, 565, 6389, 29889, 5182, 1275, 376, 6672, 1115, 13, 4706, 1426, 353, 5706, 7850, 29898, 12171, 29897, 13, 1678, 25342, 6389, 29889, 5182, 1275, 376, 4993, 1115, 13, 4706, 1426, 353, 5706, 4435, 29898, 12171, 29897, 13, 1678, 10876, 29889, 25393, 29889, 3539, 29898, 726, 29897, 13, 13, 1753, 2329, 786, 29923, 3820, 14400, 29898, 9891, 29892, 321, 3820, 14400, 1125, 13, 1678, 1121, 353, 9657, 29898, 387, 29880, 14400, 29897, 13, 1678, 565, 1121, 29889, 657, 703, 13506, 1159, 338, 6213, 29901, 13, 4706, 1121, 3366, 13506, 3108, 353, 5124, 13, 13, 1678, 565, 1121, 29889, 657, 703, 17588, 1159, 338, 451, 6213, 29901, 13, 4706, 1426, 353, 376, 12119, 703, 718, 1121, 3366, 17588, 3108, 718, 376, 5513, 13, 4706, 1121, 3366, 17588, 3108, 353, 1426, 13, 13, 1678, 565, 1121, 3366, 5696, 3108, 297, 4852, 9290, 613, 376, 6341, 29908, 1125, 13, 4706, 736, 1121, 13, 13, 1678, 565, 1121, 3366, 5696, 3108, 451, 297, 4852, 4990, 613, 376, 10141, 613, 376, 3784, 29908, 1125, 13, 4706, 12020, 7865, 2392, 703, 13919, 13916, 1158, 1273, 29878, 363, 740, 1273, 29878, 29908, 1273, 313, 2914, 3366, 5696, 12436, 3653, 29889, 978, 876, 13, 13, 1678, 565, 3653, 29889, 5349, 11609, 7295, 13, 4706, 565, 1121, 29889, 657, 703, 2267, 791, 1159, 338, 6213, 29901, 13, 9651, 1121, 3366, 2267, 791, 3108, 353, 679, 4592, 11609, 1917, 29898, 9891, 29889, 2273, 29897, 13, 13, 1678, 736, 1121, 13, 13, 1753, 5706, 7850, 29898, 12171, 1125, 13, 1678, 1426, 353, 1426, 6312, 29889, 7176, 296, 29898, 29878, 15945, 29908, 13, 1678, 396, 361, 299, 1389, 402, 29918, 29923, 7239, 23711, 29925, 14789, 29918, 1254, 7466, 29903, 29918, 29950, 13, 1678, 396, 7922, 402, 29918, 29923, 7239, 23711, 29925, 14789, 29918, 1254, 7466, 29903, 29918, 29950, 13, 13, 1678, 396, 361, 1753, 4770, 29883, 11242, 11242, 13, 1678, 3622, 376, 29907, 29908, 426, 13, 1678, 396, 15224, 13, 13, 1678, 396, 2856, 529, 29923, 7239, 29914, 387, 29880, 29889, 29882, 29958, 13, 1678, 396, 2856, 529, 29923, 7239, 29914, 387, 280, 486, 29889, 29882, 29958, 13, 1678, 396, 2856, 376, 3820, 29894, 299, 29914, 1982, 387, 8205, 29875, 29889, 29882, 29908, 13, 13, 1678, 5124, 1642, 29880, 17010, 14182, 29876, 5783, 13, 13, 1678, 1426, 4619, 376, 18605, 2802, 29876, 29908, 13, 1678, 363, 313, 9891, 29892, 321, 3820, 14400, 29897, 297, 3168, 29901, 13, 4706, 1426, 4619, 5706, 9485, 538, 17946, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 4706, 1426, 4619, 376, 1678, 4770, 29923, 7239, 29918, 23711, 29925, 14789, 27508, 718, 3653, 29889, 978, 718, 376, 2053, 29876, 29908, 13, 4706, 1426, 4619, 5706, 9485, 538, 5044, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 1678, 1426, 4619, 376, 1678, 4770, 29923, 7239, 29918, 23711, 29925, 14789, 29918, 18736, 29905, 29876, 29908, 13, 1678, 1426, 4619, 376, 3400, 29905, 29876, 29908, 13, 13, 1678, 363, 313, 9891, 29892, 321, 3820, 14400, 29897, 297, 3168, 29901, 13, 4706, 565, 321, 3820, 14400, 3366, 262, 6672, 3108, 29901, 13, 9651, 1426, 4619, 5706, 9485, 538, 17946, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 9651, 1426, 4619, 29850, 29888, 29889, 2273, 29913, 382, 29954, 4375, 2227, 3919, 13207, 426, 735, 29961, 13506, 29962, 1157, 29888, 29889, 978, 2119, 29912, 29888, 29889, 7099, 7883, 3680, 29905, 29876, 1642, 4830, 29898, 29888, 29922, 9891, 29892, 429, 29922, 387, 29880, 14400, 29897, 13, 9651, 1426, 4619, 5706, 9485, 538, 5044, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 13, 1678, 1426, 4619, 1426, 6312, 29889, 7176, 296, 29898, 29878, 15945, 29908, 13, 1678, 396, 361, 1753, 4770, 29883, 11242, 11242, 13, 1678, 500, 13, 1678, 396, 15224, 13, 1678, 396, 15224, 849, 402, 29918, 29923, 7239, 23711, 29925, 14789, 29918, 1254, 7466, 29903, 29918, 29950, 13, 1678, 5124, 1159, 13, 1678, 736, 1426, 13, 13, 1753, 5706, 4435, 29898, 12171, 1125, 13, 1678, 396, 3824, 29892, 2656, 278, 740, 1051, 491, 1024, 29889, 13, 1678, 1426, 353, 5124, 13, 1678, 1426, 4619, 16321, 2856, 376, 387, 430, 275, 5041, 303, 23954, 29889, 29882, 26732, 29876, 29915, 13, 1678, 1426, 4619, 16321, 2856, 376, 29887, 29918, 387, 430, 275, 5041, 303, 23954, 29889, 29882, 26732, 29876, 29915, 13, 1678, 1426, 4619, 6634, 29876, 29908, 13, 13, 1678, 363, 313, 9891, 29892, 321, 3820, 14400, 29897, 297, 3168, 29901, 13, 4706, 565, 321, 3820, 14400, 3366, 5696, 3108, 451, 297, 4852, 6341, 613, 376, 9290, 29908, 1125, 13, 9651, 1426, 4619, 5706, 9485, 538, 17946, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 9651, 1426, 4619, 5706, 14777, 14400, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 9651, 1426, 4619, 5706, 9485, 538, 5044, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 13, 1678, 1426, 4619, 6634, 29876, 29908, 13, 1678, 1426, 4619, 376, 3075, 1373, 334, 1040, 4770, 29923, 7239, 29918, 23711, 29925, 14789, 29918, 29943, 3904, 29907, 29918, 5813, 29903, 29961, 1649, 29923, 7239, 29918, 23711, 29925, 14789, 29918, 18736, 718, 29871, 29896, 29962, 353, 2802, 29876, 29908, 13, 1678, 363, 313, 9891, 29892, 321, 3820, 14400, 29897, 297, 3168, 29901, 13, 4706, 1426, 4619, 5706, 9485, 538, 17946, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 4706, 1426, 4619, 525, 1678, 13577, 718, 3653, 29889, 978, 718, 525, 613, 29905, 29876, 29915, 13, 4706, 1426, 4619, 5706, 9485, 538, 5044, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 1678, 1426, 4619, 376, 1678, 4265, 29905, 29876, 29908, 13, 1678, 1426, 4619, 376, 3400, 29905, 29876, 29908, 13, 13, 1678, 1426, 4619, 376, 3075, 4770, 387, 29880, 29924, 504, 15738, 1762, 1184, 546, 6678, 14516, 1542, 4770, 29923, 7239, 29918, 23711, 29925, 14789, 29918, 29943, 3904, 9295, 29961, 1649, 29923, 7239, 29918, 23711, 29925, 14789, 29918, 18736, 718, 29871, 29896, 29962, 353, 2802, 29876, 29908, 13, 1678, 363, 313, 9891, 29892, 321, 3820, 14400, 29897, 297, 3168, 29901, 13, 4706, 1426, 4619, 5706, 9485, 538, 17946, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 4706, 565, 321, 3820, 14400, 3366, 5696, 3108, 2804, 376, 9290, 1115, 13, 9651, 1426, 4619, 376, 1678, 313, 1649, 387, 29880, 29924, 504, 15738, 1762, 1184, 546, 6678, 14516, 1542, 29897, 376, 718, 321, 3820, 14400, 29889, 657, 703, 13506, 613, 20569, 718, 3653, 29889, 978, 718, 376, 2053, 29876, 29908, 13, 4706, 1683, 29901, 13, 9651, 1426, 4619, 376, 1678, 4265, 29892, 849, 376, 718, 3653, 29889, 978, 718, 6634, 29876, 29908, 13, 4706, 1426, 4619, 5706, 9485, 538, 5044, 29898, 9891, 29892, 321, 3820, 14400, 29897, 13, 1678, 1426, 4619, 376, 1678, 4265, 29905, 29876, 29908, 13, 1678, 1426, 4619, 376, 3400, 29905, 29876, 29908, 13, 13, 1678, 736, 1426, 13, 13, 1753, 5706, 9485, 538, 17946, 29898, 9891, 29892, 321, 3820, 14400, 1125, 13, 1678, 1294, 353, 321, 3820, 14400, 29889, 657, 703, 17588, 1159, 13, 1678, 565, 1294, 338, 451, 6213, 29901, 13, 4706, 736, 12305, 361, 376, 718, 1294, 718, 6634, 29876, 29908, 13, 1678, 1683, 29901, 13, 4706, 736, 5124, 13, 13, 1753, 5706, 9485, 538, 5044, 29898, 9891, 29892, 321, 3820, 14400, 1125, 13, 1678, 565, 321, 3820, 14400, 29889, 657, 703, 17588, 1159, 338, 451, 6213, 29901, 13, 4706, 736, 12305, 15224, 29905, 29876, 29908, 13, 1678, 1683, 29901, 13, 4706, 736, 5124, 13, 13, 1753, 5706, 14777, 14400, 29898, 9891, 29892, 321, 3820, 14400, 1125, 13, 1678, 1426, 353, 5124, 13, 13, 1678, 565, 321, 3820, 14400, 29889, 657, 703, 7959, 29908, 1125, 13, 4706, 1426, 4619, 376, 7959, 376, 13, 1678, 25342, 321, 3820, 14400, 29889, 657, 703, 3597, 29908, 1125, 13, 4706, 1426, 4619, 376, 7056, 13367, 2965, 376, 13, 1678, 1426, 4619, 1426, 6312, 29889, 7176, 296, 29898, 13, 1678, 364, 15945, 29908, 13, 1678, 426, 29888, 29889, 2273, 29913, 382, 29954, 4375, 2227, 3919, 13207, 426, 1389, 29961, 13506, 29962, 1157, 29888, 29889, 978, 2119, 29912, 29888, 29889, 7099, 7883, 1800, 13, 1678, 8620, 13, 4706, 21787, 426, 29888, 29889, 2273, 29913, 382, 29954, 4375, 2227, 3919, 13207, 3070, 903, 7810, 29876, 648, 29888, 29889, 978, 1800, 3319, 29888, 29889, 7099, 7883, 3680, 13, 1678, 5124, 2564, 29880, 17010, 14182, 29876, 2564, 4830, 29898, 29888, 29922, 9891, 29892, 321, 29888, 29922, 387, 29880, 14400, 29897, 13, 13, 1678, 565, 3653, 29889, 5349, 11609, 7295, 13, 4706, 1426, 4619, 376, 1678, 426, 29888, 29889, 2273, 29913, 903, 2267, 353, 426, 1389, 29961, 2267, 791, 29962, 3400, 29905, 29876, 1642, 4830, 29898, 29888, 29922, 9891, 29892, 321, 29888, 29922, 387, 29880, 14400, 29897, 13, 13, 1678, 1426, 4619, 376, 1678, 903, 7810, 29876, 648, 29888, 29889, 978, 29913, 903, 7414, 648, 29888, 29889, 978, 29913, 353, 9423, 7810, 29876, 648, 29888, 29889, 978, 1800, 11393, 4830, 29898, 29888, 29922, 9891, 29897, 13, 1678, 565, 321, 3820, 14400, 3366, 5696, 3108, 1275, 376, 3784, 1115, 13, 4706, 1426, 4619, 376, 1649, 387, 29880, 14777, 20927, 2059, 7583, 22168, 29923, 7239, 29918, 23711, 29925, 14789, 648, 29888, 29889, 978, 3680, 29905, 29876, 1642, 4830, 29898, 29888, 29922, 9891, 29897, 13, 13, 1678, 25342, 321, 3820, 14400, 3366, 5696, 3108, 297, 4852, 4990, 613, 376, 10141, 29908, 1125, 13, 4706, 565, 321, 3820, 14400, 3366, 5696, 3108, 1275, 376, 4990, 1115, 13, 9651, 16280, 14400, 353, 376, 1649, 387, 29880, 14777, 20927, 2059, 9323, 29908, 13, 9651, 16280, 1542, 353, 376, 29923, 7239, 9323, 29908, 13, 4706, 1683, 29901, 13, 9651, 4974, 321, 3820, 14400, 3366, 5696, 3108, 1275, 376, 10141, 29908, 13, 9651, 16280, 14400, 353, 376, 1649, 387, 29880, 14777, 20927, 2059, 11501, 29908, 13, 9651, 16280, 1542, 353, 376, 29923, 7239, 11501, 12194, 29908, 13, 13, 4706, 16280, 8559, 353, 6213, 13, 4706, 363, 1852, 297, 3653, 29889, 5085, 29901, 13, 9651, 565, 1852, 29889, 1853, 1275, 16280, 1542, 29901, 13, 18884, 16280, 8559, 353, 1852, 29889, 978, 13, 18884, 2867, 13, 4706, 565, 16280, 8559, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 703, 6028, 29915, 29873, 1284, 1273, 29879, 2980, 363, 740, 1273, 29879, 29908, 1273, 313, 20401, 1542, 29892, 3653, 29889, 978, 29892, 876, 13, 13, 4706, 1426, 4619, 29850, 20401, 14400, 2119, 29912, 20401, 8559, 1118, 4770, 29923, 7239, 29918, 23711, 29925, 14789, 648, 29888, 29889, 978, 3680, 29905, 29876, 1642, 4830, 29898, 13, 18884, 285, 29922, 9891, 29892, 16280, 14400, 29922, 20401, 14400, 29892, 16280, 8559, 29922, 20401, 8559, 29897, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 703, 14148, 13916, 1158, 29901, 1273, 29878, 29908, 1273, 313, 387, 29880, 14400, 3366, 5696, 12436, 876, 13, 13, 1678, 1426, 4619, 376, 1678, 565, 7373, 7414, 648, 29888, 29889, 978, 29913, 2804, 4265, 29897, 426, 741, 29876, 1642, 4830, 29898, 29888, 29922, 9891, 29897, 13, 1678, 1426, 4619, 376, 4706, 376, 13, 1678, 565, 3653, 29889, 5349, 11609, 7295, 13, 4706, 1426, 4619, 11119, 2267, 353, 376, 13, 1678, 1426, 4619, 11119, 7414, 648, 29888, 29889, 978, 2119, 29912, 29888, 29889, 4804, 7883, 3680, 29905, 29876, 1642, 4830, 29898, 29888, 29922, 9891, 29897, 13, 1678, 1426, 4619, 376, 1678, 17704, 29876, 29908, 13, 13, 1678, 565, 3653, 29889, 5349, 11609, 7295, 13, 4706, 1426, 4619, 376, 1678, 736, 903, 2267, 10436, 29876, 29908, 13, 1678, 1426, 4619, 376, 1012, 29876, 29908, 13, 1678, 736, 1426, 13, 13, 1753, 679, 4592, 11609, 1917, 29898, 22646, 1125, 13, 1678, 565, 2393, 3871, 29889, 1975, 2541, 703, 20605, 1125, 13, 4706, 736, 376, 10074, 29908, 13, 1678, 25342, 2393, 3871, 1275, 376, 29923, 7239, 9323, 1115, 13, 4706, 736, 376, 29923, 7239, 29918, 6632, 29918, 23711, 29925, 18799, 29908, 13, 1678, 25342, 2393, 3871, 1275, 376, 29923, 7239, 2677, 1115, 13, 4706, 736, 376, 29923, 7239, 29918, 6632, 29918, 6007, 16975, 29908, 13, 1678, 25342, 2393, 3871, 1275, 376, 29923, 7239, 18498, 2161, 1115, 13, 4706, 736, 376, 29923, 7239, 29918, 6632, 29918, 29903, 4574, 29943, 11538, 29908, 13, 1678, 25342, 2393, 3871, 1275, 376, 29923, 7239, 18146, 1115, 13, 4706, 736, 376, 29923, 7239, 29918, 25717, 1769, 13, 13, 1678, 736, 376, 29900, 29908, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 13, 2 ]
Chapter02/computation_graph.py
PacktPublishing/Caffe2-Quick-Start-Guide
8
58885
<reponame>PacktPublishing/Caffe2-Quick-Start-Guide<filename>Chapter02/computation_graph.py #!/usr/bin/env python2 """Create a network that perfoms some mathematical operations. Run inference on this network.""" from caffe2.python import workspace, model_helper import numpy as np # Initialize Caffe2 workspace.GlobalInit(["caffe2",]) # Initialize a model with the name "Math model" model = model_helper.ModelHelper("Math model") # Add a matrix multiplication operator to the model. # This operator takes blobs "A" and "B" as inputs and produces blob "C" as output. model.net.MatMul(["A", "B"], "C") # Add a Sigmoid operator to the model. # This operator takes blob "C" as input and produces blob "D" as output. model.net.Sigmoid("C", "D") # Add a Softmax operator to the model. # This operator takes blob "D" as input and produces blob "E" as output. model.net.Softmax("D", "E", axis=0) # Create input A, a 3x3 matrix initialized with some values A = np.linspace(-0.4, 0.4, num=9, dtype=np.float32).reshape(3, 3) # Create input B, a 3x1 matrix initialized with some values B = np.linspace(0.01, 0.03, num=3, dtype=np.float32).reshape(3, 1) # Feed A and B to the Caffe2 workspace as blobs. # Provide names "A" and "B" for these blobs. workspace.FeedBlob("A", A) workspace.FeedBlob("B", B) # Run the network inside the Caffe2 workspace. workspace.RunNetOnce(model.net) # Extract blob "E" from the workspace. E = workspace.FetchBlob("E") # Print inputs A and B and final output E print "A:", A print "B:", B print "E:", E
[ 1, 529, 276, 1112, 420, 29958, 16638, 29873, 21076, 1674, 292, 29914, 29907, 3470, 29872, 29906, 29899, 2182, 860, 29899, 4763, 29899, 9485, 680, 29966, 9507, 29958, 1451, 3314, 29900, 29906, 29914, 12097, 362, 29918, 4262, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29906, 13, 13, 15945, 29908, 4391, 263, 3564, 393, 23895, 4835, 777, 19475, 6931, 29889, 13, 6558, 27262, 373, 445, 3564, 1213, 15945, 13, 13, 3166, 274, 3470, 29872, 29906, 29889, 4691, 1053, 664, 3493, 29892, 1904, 29918, 20907, 13, 5215, 12655, 408, 7442, 13, 13, 29937, 25455, 315, 3470, 29872, 29906, 13, 1287, 3493, 29889, 12756, 6644, 29898, 3366, 1113, 17615, 29906, 613, 2314, 13, 13, 29937, 25455, 263, 1904, 411, 278, 1024, 376, 11309, 1904, 29908, 13, 4299, 353, 1904, 29918, 20907, 29889, 3195, 10739, 703, 11309, 1904, 1159, 13, 13, 29937, 3462, 263, 4636, 21666, 5455, 304, 278, 1904, 29889, 13, 29937, 910, 5455, 4893, 23755, 29879, 376, 29909, 29908, 322, 376, 29933, 29908, 408, 10970, 322, 13880, 23755, 376, 29907, 29908, 408, 1962, 29889, 13, 4299, 29889, 1212, 29889, 9782, 29924, 352, 29898, 3366, 29909, 613, 376, 29933, 12436, 376, 29907, 1159, 13, 13, 29937, 3462, 263, 15861, 29885, 3398, 5455, 304, 278, 1904, 29889, 13, 29937, 910, 5455, 4893, 23755, 376, 29907, 29908, 408, 1881, 322, 13880, 23755, 376, 29928, 29908, 408, 1962, 29889, 13, 4299, 29889, 1212, 29889, 29903, 335, 29885, 3398, 703, 29907, 613, 376, 29928, 1159, 13, 13, 29937, 3462, 263, 1105, 615, 3317, 5455, 304, 278, 1904, 29889, 13, 29937, 910, 5455, 4893, 23755, 376, 29928, 29908, 408, 1881, 322, 13880, 23755, 376, 29923, 29908, 408, 1962, 29889, 13, 4299, 29889, 1212, 29889, 6295, 615, 3317, 703, 29928, 613, 376, 29923, 613, 9685, 29922, 29900, 29897, 13, 13, 29937, 6204, 1881, 319, 29892, 263, 29871, 29941, 29916, 29941, 4636, 16601, 411, 777, 1819, 13, 29909, 353, 7442, 29889, 1915, 3493, 6278, 29900, 29889, 29946, 29892, 29871, 29900, 29889, 29946, 29892, 954, 29922, 29929, 29892, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 467, 690, 14443, 29898, 29941, 29892, 29871, 29941, 29897, 13, 13, 29937, 6204, 1881, 350, 29892, 263, 29871, 29941, 29916, 29896, 4636, 16601, 411, 777, 1819, 13, 29933, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29889, 29900, 29896, 29892, 29871, 29900, 29889, 29900, 29941, 29892, 954, 29922, 29941, 29892, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 467, 690, 14443, 29898, 29941, 29892, 29871, 29896, 29897, 13, 13, 29937, 5169, 287, 319, 322, 350, 304, 278, 315, 3470, 29872, 29906, 664, 3493, 408, 23755, 29879, 29889, 13, 29937, 9133, 680, 2983, 376, 29909, 29908, 322, 376, 29933, 29908, 363, 1438, 23755, 29879, 29889, 13, 1287, 3493, 29889, 29737, 29933, 2127, 703, 29909, 613, 319, 29897, 13, 1287, 3493, 29889, 29737, 29933, 2127, 703, 29933, 613, 350, 29897, 13, 13, 29937, 7525, 278, 3564, 2768, 278, 315, 3470, 29872, 29906, 664, 3493, 29889, 13, 1287, 3493, 29889, 6558, 6779, 26222, 29898, 4299, 29889, 1212, 29897, 13, 13, 29937, 7338, 1461, 23755, 376, 29923, 29908, 515, 278, 664, 3493, 29889, 13, 29923, 353, 664, 3493, 29889, 20927, 29933, 2127, 703, 29923, 1159, 13, 13, 29937, 13905, 10970, 319, 322, 350, 322, 2186, 1962, 382, 13, 2158, 376, 29909, 29901, 613, 319, 13, 2158, 376, 29933, 29901, 613, 350, 13, 2158, 376, 29923, 29901, 613, 382, 13, 2 ]
DSA/backtracking/totalNQueens.py
lance-lh/Data-Structures-and-Algorithms
1
1616321
''' The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return the number of distinct solutions to the n-queens puzzle. Example: Input: 4 Output: 2 Explanation: There are two distinct solutions to the 4-queens puzzle as shown below. [ [".Q..", // Solution 1 "...Q", "Q...", "..Q."], ["..Q.", // Solution 2 "Q...", "...Q", ".Q.."] ] ''' ''' class Solution: def totalNQueens(self, n): # :param n: int # :return: int res = [] self.dfs([-1] * n, 0, [], res) return len(res) def dfs(self, nums, index, path, res): if index == len(nums): res.append(path) return for i in range(len(nums)): nums[index] = i if self.Isvalid(nums, index): tmp = '.' * len(nums) self.dfs(nums, index + 1, path + [tmp[:i] + 'Q' + tmp[i + 1:]], res) def Isvalid(self, nums, n): for i in range(n): if abs(nums[i] - nums[n]) == n - i or nums[i] == nums[n]: return False return True ''' # use global self.res to record result # remove res and path from dfs paras class Solution: def totalNQueens(self, n): ''' :param n: int :return: int ''' self.res = 0 self.dfs([-1]*n,0) return self.res def dfs(self,nums,index): if index == len(nums): self.res += 1 return for i in range(len(nums)): nums[index] = i if self.Isvalid(nums,index): self.dfs(nums,index+1) def Isvalid(self,nums,n): for i in range(n): if abs(nums[i]-nums[n]) == n - i or nums[i] == nums[n]: return False return True # test if __name__ == 'main': n = 4 print(Solution().totalNQueens(n))
[ 1, 14550, 13, 1576, 302, 29899, 802, 575, 20285, 280, 338, 278, 1108, 310, 24421, 302, 712, 575, 373, 385, 302, 30122, 29876, 521, 404, 3377, 13, 14565, 393, 694, 1023, 712, 575, 5337, 1269, 916, 29889, 13, 13, 29954, 5428, 385, 6043, 302, 29892, 736, 278, 1353, 310, 8359, 6851, 304, 278, 302, 29899, 802, 575, 20285, 280, 29889, 13, 13, 14023, 29901, 13, 13, 4290, 29901, 29871, 29946, 13, 6466, 29901, 29871, 29906, 13, 1252, 9018, 362, 29901, 1670, 526, 1023, 8359, 6851, 304, 278, 29871, 29946, 29899, 802, 575, 20285, 280, 408, 4318, 2400, 29889, 13, 1678, 518, 13, 268, 518, 1642, 29984, 636, 613, 29871, 849, 24380, 29871, 29896, 13, 418, 29804, 29984, 613, 13, 418, 376, 29984, 856, 613, 13, 418, 376, 636, 29984, 1213, 1402, 13, 13, 268, 6796, 636, 29984, 19602, 29871, 849, 24380, 29871, 29906, 13, 418, 376, 29984, 856, 613, 13, 418, 29804, 29984, 613, 13, 418, 11393, 29984, 636, 3108, 13, 1678, 4514, 13, 12008, 13, 13, 12008, 13, 1990, 24380, 29901, 13, 1678, 822, 3001, 29940, 8654, 575, 29898, 1311, 29892, 302, 1125, 13, 13, 4706, 396, 584, 3207, 302, 29901, 938, 13, 4706, 396, 584, 2457, 29901, 938, 13, 13, 4706, 620, 353, 5159, 13, 4706, 1583, 29889, 29069, 4197, 29899, 29896, 29962, 334, 302, 29892, 29871, 29900, 29892, 19997, 620, 29897, 13, 4706, 736, 7431, 29898, 690, 29897, 13, 13, 1678, 822, 4489, 29879, 29898, 1311, 29892, 954, 29879, 29892, 2380, 29892, 2224, 29892, 620, 1125, 13, 4706, 565, 2380, 1275, 7431, 29898, 1949, 29879, 1125, 13, 9651, 620, 29889, 4397, 29898, 2084, 29897, 13, 9651, 736, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 1949, 29879, 22164, 13, 9651, 954, 29879, 29961, 2248, 29962, 353, 474, 13, 9651, 565, 1583, 29889, 3624, 3084, 29898, 1949, 29879, 29892, 2380, 1125, 13, 18884, 13128, 353, 525, 6169, 334, 7431, 29898, 1949, 29879, 29897, 13, 18884, 1583, 29889, 29069, 29898, 1949, 29879, 29892, 2380, 718, 29871, 29896, 29892, 2224, 718, 518, 7050, 7503, 29875, 29962, 718, 525, 29984, 29915, 718, 13128, 29961, 29875, 718, 29871, 29896, 17531, 1402, 620, 29897, 13, 13, 1678, 822, 1317, 3084, 29898, 1311, 29892, 954, 29879, 29892, 302, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 9651, 565, 6425, 29898, 1949, 29879, 29961, 29875, 29962, 448, 954, 29879, 29961, 29876, 2314, 1275, 302, 448, 474, 470, 954, 29879, 29961, 29875, 29962, 1275, 954, 29879, 29961, 29876, 5387, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 12008, 13, 29937, 671, 5534, 1583, 29889, 690, 304, 2407, 1121, 13, 29937, 3349, 620, 322, 2224, 515, 4489, 29879, 610, 294, 13, 1990, 24380, 29901, 13, 1678, 822, 3001, 29940, 8654, 575, 29898, 1311, 29892, 302, 1125, 13, 4706, 14550, 13, 4706, 584, 3207, 302, 29901, 938, 13, 4706, 584, 2457, 29901, 938, 13, 4706, 14550, 13, 4706, 1583, 29889, 690, 353, 29871, 29900, 13, 4706, 1583, 29889, 29069, 4197, 29899, 29896, 14178, 29876, 29892, 29900, 29897, 13, 4706, 736, 1583, 29889, 690, 13, 1678, 822, 4489, 29879, 29898, 1311, 29892, 1949, 29879, 29892, 2248, 1125, 13, 4706, 565, 2380, 1275, 7431, 29898, 1949, 29879, 1125, 13, 9651, 1583, 29889, 690, 4619, 29871, 29896, 13, 9651, 736, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 1949, 29879, 22164, 13, 9651, 954, 29879, 29961, 2248, 29962, 353, 474, 13, 9651, 565, 1583, 29889, 3624, 3084, 29898, 1949, 29879, 29892, 2248, 1125, 13, 18884, 1583, 29889, 29069, 29898, 1949, 29879, 29892, 2248, 29974, 29896, 29897, 13, 13, 1678, 822, 1317, 3084, 29898, 1311, 29892, 1949, 29879, 29892, 29876, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 9651, 565, 6425, 29898, 1949, 29879, 29961, 29875, 29962, 29899, 1949, 29879, 29961, 29876, 2314, 1275, 302, 448, 474, 470, 954, 29879, 29961, 29875, 29962, 1275, 954, 29879, 29961, 29876, 5387, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 13, 29937, 1243, 13, 361, 4770, 978, 1649, 1275, 525, 3396, 2396, 13, 1678, 302, 353, 29871, 29946, 13, 1678, 1596, 29898, 13296, 918, 2141, 7827, 29940, 8654, 575, 29898, 29876, 876, 2 ]
tests/quality/service_catalog/test_service_catalog.py
opentelekomcloud-infra/test-scenarios
1
113740
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import pytest import os #from tests.quality import base from openstack import exceptions import influxdb testdata = [ ('antiddos'), ('as'), ('asv1'), ('cce'), ('ccev2.0'), ('ces'), ('cesv1'), ('cesv1'), ('compute'), ('csbs'), ('css'), ('cts'), ('ctsv2'), ('data-protect'), ('database'), ('dcaas'), ('dcs'), ('dcsv1'), ('ddsv3'), ('deh'), ('dis'), ('disv2'), ('dms'), ('dmsv1'), ('dns'), ('dws'), ('dwsv1'), ('ecs'), ('elb'), ('elbv1'), ('evs'), ('identity'), ('image'), ('kms'), ('kmsv1'), ('lts'), ('mrs'), ('mrsv1'), ('nat'), ('network'), ('object-store'), ('orchestration'), ('plas'), ('rds'), ('rdsv3'), ('sdrs'), ('sharev2'), ('sfsturbo'), ('smn'), ('smnv2'), ('swr'), ('tms'), ('vbs'), ('vbsv2'), ('volume'), ('volumev2'), ('volumev3'), ('vpc'), ('vpc2.0'), ('vpcep'), ('waf'), ('wks'), ('workspace'), ] class TestServiceCatalog: @pytest.fixture(scope='module') def influx_client(self): host = os.environ.get('INFLUXDB_HOST', 'localhost') port = int(os.environ.get('INFLUXDB_PORT', 8080)) user = os.environ.get('INFLUXDB_USER') password = os.environ.get('INFLUXDB_PASSWORD') database = os.environ.get('INFLUXDB_DATABASE', 'default') influx = None if host and port and user and password: influx = influxdb.InfluxDBClient( host, port, user, password, database, ssl=True) return influx def get_catalog(self, conn): return conn.config.get_service_catalog().catalog def convert_catalog(self, catalog): cat = {} for rec in catalog: entry_type = rec.get('type') cat[entry_type] = rec return cat def test_validate_catalog_structure(self, conn, influx_client, token_catalog): """Verify catalog structure""" cat = {} for rec in token_catalog: entry_type = rec.get('type') if entry_type in cat: valid = False else: valid = True self.write_result(influx_client, entry_type, 'single_in_catalog', not valid) cat[entry_type] = rec self.write_result(influx_client, None, 'catalog_valid', not valid) assert valid, "Service catalog is valid" @pytest.fixture(scope='module') def token_catalog(self, conn): return self.get_catalog(conn) @pytest.fixture(scope='module') def normalized_catalog(self, conn, token_catalog): return self.convert_catalog(token_catalog) @pytest.mark.parametrize('service_type', testdata) def test_service_available_in_region( self, conn, influx_client, normalized_catalog, service_type): match = {} regions = [x.id for x in conn.identity.regions()] srv = normalized_catalog.get(service_type, {}) if not srv: self.write_result(influx_client, service_type, 'service_in_catalog', True) # assert srv, "Service present in the catalog" if srv: for ep in srv['endpoints']: for reg in regions: if ep['region_id'] == reg: match[reg] = True failed = False if len(match.keys()) != len(regions): failed = True self.write_result(influx_client, service_type, 'endpoint_present_in_region', failed) assert not failed, \ "Service known in all regions" else: self.write_result(influx_client, service_type, 'endpoint_present_in_region', True) def write_result(self, influx_client, service, check, failed): if influx_client: fields = dict( service=service, failed=1 if failed else 0, succeeded=0 if failed else 1 ) influx_client.write_points([ dict( measurement='scmon', fields=fields, tags=dict( service_type=service, check=check, status='failed' if failed else 'succeeded' ) ) ])
[ 1, 396, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 13, 29937, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 887, 1122, 4017, 13, 29937, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 418, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 13, 29937, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 13, 29937, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1090, 278, 19245, 29889, 13, 5215, 11451, 1688, 13, 5215, 2897, 13, 29937, 3166, 6987, 29889, 29567, 1053, 2967, 13, 13, 3166, 1722, 1429, 1053, 15283, 13, 13, 5215, 4414, 1314, 2585, 13, 13, 13, 1688, 1272, 353, 518, 13, 1678, 6702, 424, 2205, 359, 5477, 13, 1678, 6702, 294, 5477, 13, 1678, 6702, 294, 29894, 29896, 5477, 13, 1678, 6702, 29883, 346, 5477, 13, 1678, 6702, 29883, 346, 29894, 29906, 29889, 29900, 5477, 13, 1678, 6702, 778, 5477, 13, 1678, 6702, 778, 29894, 29896, 5477, 13, 1678, 6702, 778, 29894, 29896, 5477, 13, 1678, 6702, 26017, 5477, 13, 1678, 6702, 2395, 5824, 5477, 13, 1678, 6702, 4268, 5477, 13, 1678, 6702, 312, 29879, 5477, 13, 1678, 6702, 312, 4501, 29906, 5477, 13, 1678, 6702, 1272, 29899, 14676, 312, 5477, 13, 1678, 6702, 9803, 5477, 13, 1678, 6702, 29881, 1113, 294, 5477, 13, 1678, 6702, 29881, 2395, 5477, 13, 1678, 6702, 29881, 7638, 29896, 5477, 13, 1678, 6702, 1289, 4501, 29941, 5477, 13, 1678, 6702, 311, 29882, 5477, 13, 1678, 6702, 2218, 5477, 13, 1678, 6702, 2218, 29894, 29906, 5477, 13, 1678, 6702, 29881, 1516, 5477, 13, 1678, 6702, 29881, 1516, 29894, 29896, 5477, 13, 1678, 6702, 29881, 1983, 5477, 13, 1678, 6702, 29881, 5652, 5477, 13, 1678, 6702, 28012, 4501, 29896, 5477, 13, 1678, 6702, 687, 29879, 5477, 13, 1678, 6702, 295, 29890, 5477, 13, 1678, 6702, 295, 29890, 29894, 29896, 5477, 13, 1678, 6702, 29872, 4270, 5477, 13, 1678, 6702, 22350, 5477, 13, 1678, 6702, 3027, 5477, 13, 1678, 6702, 29895, 1516, 5477, 13, 1678, 6702, 29895, 1516, 29894, 29896, 5477, 13, 1678, 6702, 29880, 1372, 5477, 13, 1678, 6702, 29885, 2288, 5477, 13, 1678, 6702, 29885, 2288, 29894, 29896, 5477, 13, 1678, 6702, 8924, 5477, 13, 1678, 6702, 11618, 5477, 13, 1678, 6702, 3318, 29899, 8899, 5477, 13, 1678, 6702, 25350, 16444, 362, 5477, 13, 1678, 6702, 572, 294, 5477, 13, 1678, 6702, 5499, 29879, 5477, 13, 1678, 6702, 5499, 4501, 29941, 5477, 13, 1678, 6702, 4928, 2288, 5477, 13, 1678, 6702, 13653, 29894, 29906, 5477, 13, 1678, 6702, 4668, 303, 332, 833, 5477, 13, 1678, 6702, 3844, 29876, 5477, 13, 1678, 6702, 3844, 29876, 29894, 29906, 5477, 13, 1678, 6702, 2774, 29878, 5477, 13, 1678, 6702, 29873, 1516, 5477, 13, 1678, 6702, 29894, 5824, 5477, 13, 1678, 6702, 24666, 4501, 29906, 5477, 13, 1678, 6702, 24623, 5477, 13, 1678, 6702, 24623, 29894, 29906, 5477, 13, 1678, 6702, 24623, 29894, 29941, 5477, 13, 1678, 6702, 29894, 6739, 5477, 13, 1678, 6702, 29894, 6739, 29906, 29889, 29900, 5477, 13, 1678, 6702, 29894, 29886, 13300, 5477, 13, 1678, 6702, 29893, 2142, 5477, 13, 1678, 6702, 29893, 2039, 5477, 13, 1678, 6702, 1287, 3493, 5477, 13, 29962, 13, 13, 13, 1990, 4321, 3170, 29907, 3968, 29901, 13, 13, 1678, 732, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 5453, 1495, 13, 1678, 822, 4414, 1314, 29918, 4645, 29898, 1311, 1125, 13, 4706, 3495, 353, 2897, 29889, 21813, 29889, 657, 877, 1177, 10536, 29965, 29990, 4051, 29918, 20832, 742, 525, 7640, 1495, 13, 4706, 2011, 353, 938, 29898, 359, 29889, 21813, 29889, 657, 877, 1177, 10536, 29965, 29990, 4051, 29918, 15082, 742, 29871, 29947, 29900, 29947, 29900, 876, 13, 4706, 1404, 353, 2897, 29889, 21813, 29889, 657, 877, 1177, 10536, 29965, 29990, 4051, 29918, 11889, 1495, 13, 4706, 4800, 353, 2897, 29889, 21813, 29889, 657, 877, 1177, 10536, 29965, 29990, 4051, 29918, 25711, 17013, 1495, 13, 4706, 2566, 353, 2897, 29889, 21813, 29889, 657, 877, 1177, 10536, 29965, 29990, 4051, 29918, 25832, 27982, 742, 525, 4381, 1495, 13, 4706, 4414, 1314, 353, 6213, 13, 4706, 565, 3495, 322, 2011, 322, 1404, 322, 4800, 29901, 13, 9651, 4414, 1314, 353, 4414, 1314, 2585, 29889, 15403, 1314, 4051, 4032, 29898, 13, 18884, 3495, 29892, 2011, 29892, 1404, 29892, 4800, 29892, 2566, 29892, 13, 18884, 24250, 29922, 5574, 29897, 13, 4706, 736, 4414, 1314, 13, 13, 1678, 822, 679, 29918, 28045, 29898, 1311, 29892, 11009, 1125, 13, 539, 736, 11009, 29889, 2917, 29889, 657, 29918, 5509, 29918, 28045, 2141, 28045, 13, 13, 1678, 822, 3588, 29918, 28045, 29898, 1311, 29892, 16653, 1125, 13, 4706, 6635, 353, 6571, 13, 4706, 363, 1162, 297, 16653, 29901, 13, 9651, 6251, 29918, 1853, 353, 1162, 29889, 657, 877, 1853, 1495, 13, 9651, 6635, 29961, 8269, 29918, 1853, 29962, 353, 1162, 13, 4706, 736, 6635, 13, 13, 1678, 822, 1243, 29918, 15480, 29918, 28045, 29918, 23905, 29898, 1311, 29892, 11009, 29892, 4414, 1314, 29918, 4645, 29892, 5993, 29918, 28045, 1125, 13, 4706, 9995, 6565, 1598, 16653, 3829, 15945, 29908, 13, 4706, 6635, 353, 6571, 13, 4706, 363, 1162, 297, 5993, 29918, 28045, 29901, 13, 9651, 6251, 29918, 1853, 353, 1162, 29889, 657, 877, 1853, 1495, 13, 9651, 565, 6251, 29918, 1853, 297, 6635, 29901, 13, 18884, 2854, 353, 7700, 13, 9651, 1683, 29901, 13, 18884, 2854, 353, 5852, 13, 9651, 1583, 29889, 3539, 29918, 2914, 29898, 13453, 1314, 29918, 4645, 29892, 6251, 29918, 1853, 29892, 13, 462, 795, 525, 14369, 29918, 262, 29918, 28045, 742, 451, 2854, 29897, 13, 9651, 6635, 29961, 8269, 29918, 1853, 29962, 353, 1162, 13, 4706, 1583, 29889, 3539, 29918, 2914, 29898, 13453, 1314, 29918, 4645, 29892, 6213, 29892, 13, 462, 3986, 525, 28045, 29918, 3084, 742, 451, 2854, 29897, 13, 4706, 4974, 2854, 29892, 376, 3170, 16653, 338, 2854, 29908, 13, 13, 1678, 732, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 5453, 1495, 13, 1678, 822, 5993, 29918, 28045, 29898, 1311, 29892, 11009, 1125, 13, 4706, 736, 1583, 29889, 657, 29918, 28045, 29898, 13082, 29897, 13, 13, 1678, 732, 2272, 1688, 29889, 7241, 15546, 29898, 6078, 2433, 5453, 1495, 13, 1678, 822, 4226, 1891, 29918, 28045, 29898, 1311, 29892, 11009, 29892, 5993, 29918, 28045, 1125, 13, 4706, 736, 1583, 29889, 13441, 29918, 28045, 29898, 6979, 29918, 28045, 29897, 13, 13, 1678, 732, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 877, 5509, 29918, 1853, 742, 1243, 1272, 29897, 13, 1678, 822, 1243, 29918, 5509, 29918, 16515, 29918, 262, 29918, 12803, 29898, 13, 9651, 1583, 29892, 11009, 29892, 4414, 1314, 29918, 4645, 29892, 4226, 1891, 29918, 28045, 29892, 13, 9651, 2669, 29918, 1853, 1125, 13, 4706, 1993, 353, 6571, 13, 4706, 12786, 353, 518, 29916, 29889, 333, 363, 921, 297, 11009, 29889, 22350, 29889, 1727, 1080, 580, 29962, 13, 4706, 269, 15291, 353, 4226, 1891, 29918, 28045, 29889, 657, 29898, 5509, 29918, 1853, 29892, 426, 1800, 13, 4706, 565, 451, 269, 15291, 29901, 13, 9651, 1583, 29889, 3539, 29918, 2914, 29898, 13453, 1314, 29918, 4645, 29892, 2669, 29918, 1853, 29892, 13, 462, 795, 525, 5509, 29918, 262, 29918, 28045, 742, 5852, 29897, 13, 29937, 4706, 4974, 269, 15291, 29892, 376, 3170, 2198, 297, 278, 16653, 29908, 13, 4706, 565, 269, 15291, 29901, 13, 9651, 363, 9358, 297, 269, 15291, 1839, 355, 9748, 2033, 29901, 13, 18884, 363, 1072, 297, 12786, 29901, 13, 462, 259, 565, 9358, 1839, 12803, 29918, 333, 2033, 1275, 1072, 29901, 13, 462, 4706, 1993, 29961, 1727, 29962, 353, 5852, 13, 9651, 5229, 353, 7700, 13, 9651, 565, 7431, 29898, 4352, 29889, 8149, 3101, 2804, 7431, 29898, 1727, 1080, 1125, 13, 18884, 5229, 353, 5852, 13, 9651, 1583, 29889, 3539, 29918, 2914, 29898, 13453, 1314, 29918, 4645, 29892, 2669, 29918, 1853, 29892, 13, 462, 795, 525, 29734, 29918, 6338, 29918, 262, 29918, 12803, 742, 5229, 29897, 13, 9651, 4974, 451, 5229, 29892, 320, 13, 462, 259, 376, 3170, 2998, 297, 599, 12786, 29908, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 3539, 29918, 2914, 29898, 13453, 1314, 29918, 4645, 29892, 2669, 29918, 1853, 29892, 13, 462, 795, 525, 29734, 29918, 6338, 29918, 262, 29918, 12803, 742, 5852, 29897, 13, 13, 1678, 822, 2436, 29918, 2914, 29898, 1311, 29892, 4414, 1314, 29918, 4645, 29892, 2669, 29892, 1423, 29892, 5229, 1125, 13, 4706, 565, 4414, 1314, 29918, 4645, 29901, 13, 9651, 4235, 353, 9657, 29898, 13, 18884, 2669, 29922, 5509, 29892, 13, 18884, 5229, 29922, 29896, 565, 5229, 1683, 29871, 29900, 29892, 13, 18884, 14792, 29922, 29900, 565, 5229, 1683, 29871, 29896, 13, 9651, 1723, 13, 9651, 4414, 1314, 29918, 4645, 29889, 3539, 29918, 9748, 4197, 13, 18884, 9657, 29898, 13, 462, 1678, 20039, 2433, 1557, 3712, 742, 13, 462, 1678, 4235, 29922, 9621, 29892, 13, 462, 1678, 8282, 29922, 8977, 29898, 13, 462, 4706, 2669, 29918, 1853, 29922, 5509, 29892, 13, 462, 4706, 1423, 29922, 3198, 29892, 13, 462, 4706, 4660, 2433, 26061, 29915, 565, 5229, 1683, 525, 29879, 1682, 3947, 287, 29915, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 632, 2314, 13, 13, 2 ]
aiolookin/__init__.py
bachya/aiolookin
0
8420
"""Define the aiolookin package.""" from .device import async_get_device # noqa
[ 1, 9995, 3206, 457, 278, 7468, 324, 2550, 262, 3577, 1213, 15945, 13, 3166, 869, 10141, 1053, 7465, 29918, 657, 29918, 10141, 29871, 396, 694, 25621, 13, 2 ]
appconf/forms.py
flixgithub/adminset
0
1600767
#! /usr/bin/env python # -*- coding: utf-8 -*- from django import forms from django.forms.widgets import * from .models import Product, Project, AppOwner, AuthInfo, Product_Detail class AuthInfoForm(forms.ModelForm): class Meta: model = AuthInfo exclude = ("id",) widgets = { 'dis_name': TextInput(attrs={'class': 'form-control', 'style': 'width:450px;'}), 'username': TextInput(attrs={'class': 'form-control', 'style': 'width:450px;'}), 'password': TextInput(attrs={'class': 'form-control', 'type': 'password', 'style': 'width:450px'}), 'private_key': TextInput(attrs={'class': 'form-control', 'style': 'width:450px;'}), 'memo': TextInput(attrs={'class': 'form-control', 'style': 'width:450px;'}), } class AppOwnerForm(forms.ModelForm): class Meta: model = AppOwner exclude = ("id",) widgets = { 'name': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), 'phone': TextInput(attrs={'class': 'form-control','style': 'width:450px'}), 'qq': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), 'weChat': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), } class ProductForm(forms.ModelForm): class Meta: model = Product exclude = ("id",) widgets = { 'name': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), 'description': Textarea(attrs={'class': 'form-control','style': 'width:450px; height:100px'}), 'owner': Select(attrs={'class': 'form-control','style': 'width:450px;'}), } class Product_Detail_Form(forms.ModelForm): class Meta: model = Product_Detail exclude = ("id",) widgets = { 'app_name': TextInput(attrs={'class': 'form-control', 'style': 'width:450px;'}), 'ip_address': TextInput(attrs={'class': 'form-control', 'style': 'width:450px;'}), 'app_port': TextInput(attrs={'class': 'form-control', 'style': 'width:450px;'}), 'env': Select(choices=(('cloud_dev','cloud_dev'),('cloud_qa','cloud_qa'),('cloud_pp','cloud_pp'),('cloud_prd','cloud_prd'), ('psa_dev','psa_dev'),('psa_qa','psa_qa'), ('psa_pp','psa_pp'), ('psa_prd','psa_prd'), ('fd_dev','fd_dev'), ('fd_qa','fd_qa'), ('fd_pp','fd_pp'), ('fd_prd','fd_prd'), ('gz_dev','gz_dev'), ('gz_qa','gz_qa'), ('gz_pp','gz_pp'), ('gz_prd','gz_prd'), ('wl_dev','wl_dev'), ('wl_qa','wl_qa'), ('wl_pp','wl_pp'), ('wl_prd','wl_prd'), ), attrs={'class': 'form-control', 'style': 'width:450px;'}), 'deploy_method': Select(choices=(('war','war'),('jar','jar'),('container','container'),('shell','shell'),('na','n/a')), attrs={'class': 'form-control', 'style': 'width:450px;'}), } class ProjectForm(forms.ModelForm): class Meta: model = Project exclude = ("id",) widgets = { 'name': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), 'description': Textarea(attrs={'class': 'form-control','style': 'width:450px; height:100px'}), 'language_type': Select(attrs={'class': 'form-control','style': 'width:450px;'}), 'app_type': Select(attrs={'class': 'form-control','style': 'width:450px;'}), 'server_type': Select(attrs={'class': 'form-control','style': 'width:450px;'}), 'app_arch': Select(attrs={'class': 'form-control','style': 'width:450px;'}), 'appPath': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), 'source_type': Select(attrs={'class': 'form-control','style': 'width:450px;'}), 'source_address': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), 'configPath': TextInput(attrs={'class': 'form-control','style': 'width:450px;'}), 'product': Select(attrs={'class': 'form-control','style': 'width:450px;'}), 'owner': Select(attrs={'class': 'form-control','style': 'width:450px;'}), 'serverList': forms.SelectMultiple(attrs={'class': 'form-control', 'size':'10', 'multiple': 'multiple'}), }
[ 1, 396, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 9557, 1053, 7190, 13, 3166, 9557, 29889, 9514, 29889, 8030, 29879, 1053, 334, 13, 3166, 869, 9794, 1053, 10969, 29892, 8010, 29892, 2401, 28213, 29892, 13189, 3401, 29892, 10969, 29918, 16570, 13, 13, 13, 1990, 13189, 3401, 2500, 29898, 9514, 29889, 3195, 2500, 1125, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 13189, 3401, 13, 4706, 19060, 353, 4852, 333, 613, 29897, 13, 4706, 11109, 29879, 353, 426, 13, 9651, 525, 2218, 29918, 978, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 6786, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 5630, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 1853, 2396, 525, 5630, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29915, 9594, 13, 9651, 525, 9053, 29918, 1989, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 6954, 29877, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 4706, 500, 13, 13, 13, 1990, 2401, 28213, 2500, 29898, 9514, 29889, 3195, 2500, 1125, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 2401, 28213, 13, 4706, 19060, 353, 4852, 333, 613, 29897, 13, 4706, 11109, 29879, 353, 426, 13, 9651, 525, 978, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 6710, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29915, 9594, 13, 9651, 525, 24349, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 705, 1451, 271, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 4706, 500, 13, 13, 13, 1990, 10969, 2500, 29898, 9514, 29889, 3195, 2500, 1125, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 10969, 13, 4706, 19060, 353, 4852, 333, 613, 29897, 13, 4706, 11109, 29879, 353, 426, 13, 9651, 525, 978, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 8216, 2396, 3992, 6203, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 3171, 29901, 29896, 29900, 29900, 1756, 29915, 9594, 13, 9651, 525, 20348, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 4706, 500, 13, 13, 13, 1990, 10969, 29918, 16570, 29918, 2500, 29898, 9514, 29889, 3195, 2500, 1125, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 10969, 29918, 16570, 13, 4706, 19060, 353, 4852, 333, 613, 29897, 13, 4706, 11109, 29879, 353, 426, 13, 9651, 525, 932, 29918, 978, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 666, 29918, 7328, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 932, 29918, 637, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 6272, 2396, 7605, 29898, 1859, 1575, 7607, 877, 9274, 29918, 3359, 3788, 9274, 29918, 3359, 5477, 877, 9274, 29918, 25621, 3788, 9274, 29918, 25621, 5477, 877, 9274, 29918, 407, 3788, 9274, 29918, 407, 5477, 877, 9274, 29918, 558, 29881, 3788, 9274, 29918, 558, 29881, 5477, 13, 462, 462, 259, 6702, 567, 29874, 29918, 3359, 3788, 567, 29874, 29918, 3359, 5477, 877, 567, 29874, 29918, 25621, 3788, 567, 29874, 29918, 25621, 5477, 6702, 567, 29874, 29918, 407, 3788, 567, 29874, 29918, 407, 5477, 6702, 567, 29874, 29918, 558, 29881, 3788, 567, 29874, 29918, 558, 29881, 5477, 13, 462, 462, 259, 6702, 11512, 29918, 3359, 3788, 11512, 29918, 3359, 5477, 6702, 11512, 29918, 25621, 3788, 11512, 29918, 25621, 5477, 6702, 11512, 29918, 407, 3788, 11512, 29918, 407, 5477, 6702, 11512, 29918, 558, 29881, 3788, 11512, 29918, 558, 29881, 5477, 13, 462, 462, 259, 6702, 18828, 29918, 3359, 3788, 18828, 29918, 3359, 5477, 6702, 18828, 29918, 25621, 3788, 18828, 29918, 25621, 5477, 6702, 18828, 29918, 407, 3788, 18828, 29918, 407, 5477, 6702, 18828, 29918, 558, 29881, 3788, 18828, 29918, 558, 29881, 5477, 13, 462, 462, 259, 6702, 29893, 29880, 29918, 3359, 3788, 29893, 29880, 29918, 3359, 5477, 6702, 29893, 29880, 29918, 25621, 3788, 29893, 29880, 29918, 25621, 5477, 6702, 29893, 29880, 29918, 407, 3788, 29893, 29880, 29918, 407, 5477, 6702, 29893, 29880, 29918, 558, 29881, 3788, 29893, 29880, 29918, 558, 29881, 5477, 13, 462, 462, 259, 10353, 13, 462, 3986, 12421, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 16519, 29918, 5696, 2396, 7605, 29898, 1859, 1575, 7607, 877, 4495, 3788, 4495, 5477, 877, 4758, 3788, 4758, 5477, 877, 7611, 3788, 7611, 5477, 877, 15903, 3788, 15903, 5477, 877, 1056, 3788, 29876, 29914, 29874, 1495, 511, 13, 462, 462, 1678, 12421, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 4706, 500, 13, 13, 13, 1990, 8010, 2500, 29898, 9514, 29889, 3195, 2500, 1125, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 8010, 13, 4706, 19060, 353, 4852, 333, 613, 29897, 13, 13, 4706, 11109, 29879, 353, 426, 13, 9651, 525, 978, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 8216, 2396, 3992, 6203, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 3171, 29901, 29896, 29900, 29900, 1756, 29915, 9594, 13, 9651, 525, 11675, 29918, 1853, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 932, 29918, 1853, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 2974, 29918, 1853, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 932, 29918, 1279, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 932, 2605, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 4993, 29918, 1853, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 4993, 29918, 7328, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 2917, 2605, 2396, 3992, 4290, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 4704, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 20348, 2396, 7605, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 3788, 3293, 2396, 525, 2103, 29901, 29946, 29945, 29900, 1756, 29936, 29915, 9594, 13, 9651, 525, 2974, 1293, 2396, 7190, 29889, 3549, 15329, 552, 29898, 5552, 29879, 3790, 29915, 1990, 2396, 525, 689, 29899, 6451, 742, 525, 2311, 22099, 29896, 29900, 742, 525, 20787, 2396, 525, 20787, 29915, 9594, 13, 4706, 500, 13, 2 ]
src/bbdata/endpoint/output/objects.py
big-building-data/bbdata-python
0
11421
import requests from bbdata.config import output_api_url from bbdata.util import handle_response class Objects: base_path = "/objects" auth = None def __init__(self, auth): self.auth = auth def get_all(self, tags=None, search=None, page=None, per_page=None, writable=False): """ Get the list of accessible objects. GET /objects https://bbdata.daplab.ch/api/#objects_get """ params = { "tags": tags, "search": search, "page": page, "perPage": per_page, "writable": writable, } url = output_api_url + self.base_path r = requests.get(url, params, headers=self.auth.headers) return handle_response(r.status_code, r.json()) def put(self, name, unit_symbol, owner, description=None): """ Create a new object. PUT /objects https://bbdata.daplab.ch/api/#objects_put """ json = { "name": name, "description": description, "unitSymbol": unit_symbol, 'owner': owner } url = output_api_url + self.base_path r = requests.put(url, json=json, headers=self.auth.headers) return handle_response(r.status_code, r.json()) def get(self, object_id): """ Get an object. GET /objects/{objectIs} https://bbdata.daplab.ch/api/#objects__objectid__get """ url = output_api_url + self.base_path + "/" + str(object_id) r = requests.get(url, headers=self.auth.headers) # return ObjectResponse(r.json()) return handle_response(r.status_code, r.json()) def post(self, object_id, data): """ Edit the name and/or the description of the object. Only the properties appearing in the body will be modified. POST /objects/{objectId} https://bbdata.daplab.ch/api/#objects__objectid__post """ # TODO The data to send isn't define in the API Docs url = output_api_url + self.base_path + "/" + str(object_id) r = requests.post(url, data, headers=self.auth.headers) return handle_response(r.status_code, r.json()) def delete(self, object_id): """ Delete the object with the given id POST /objects/{objectId} https://bbdata.daplab.ch/api/#objects__objectid__delete """ # TODO This method is in the Postman profile but isn't in the docs url = output_api_url + self.base_path + "/" + str(object_id) r = requests.delete(url, headers=self.auth.headers) return handle_response(r.status_code, r.json()) def post_disable(self, object_id): """ Disable this object. All associated tokens will be removed. POST /objects/{objectId}/disable https://bbdata.daplab.ch/api/#objects__objectid__disable_post """ url = output_api_url + self.base_path + "/" + str(object_id) \ + "/disable" r = requests.post(url, headers=self.auth.headers) return handle_response(r.status_code, True) def post_enable(self, object_id): """ Enable this object. POST /objects/{objectId}/enable https://bbdata.daplab.ch/api/#objects__objectid__enable_post """ url = output_api_url + self.base_path + "/" + str(object_id) \ + "/enable" r = requests.post(url, headers=self.auth.headers) return handle_response(r.status_code, True) def get_tokens(self, object_id, description=None): """ Get the list of tokens for the object. A token is used to submit new measures (see input-api). An optional description can be passed in the body (max 65 characters). GET /objects/{objectId}/tokens https://bbdata.daplab.ch/api/#objects__objectid__tokens_get """ # TODO The API docs says it's possible to pass an optional description # but it looks like it's a mistake for a GET request... url = output_api_url + self.base_path + "/" + str(object_id) \ + "/tokens" json = { "description": description } r = requests.get(url, json, headers=self.auth.headers) return handle_response(r.status_code, r.json()) def put_tokens(self, object_id): """ Generate a new secured token. PUT /objects/{objectId}/tokens https://bbdata.daplab.ch/api/#objects__objectid__tokens_put """ # TODO The optional description should probably be added in this # method url = output_api_url + self.base_path + "/" + str(object_id) \ + "/tokens" r = requests.put(url, headers=self.auth.headers) return handle_response(r.status_code, r.json()) def post_tokens(self, object_id, description): """ Edit the token's description. POST /objects/{objectId}/tokens https://bbdata.daplab.ch/api/#objects__objectid__tokens_post """ url = output_api_url + self.base_path + "/" + str(object_id) \ + "/tokens" json = { "description": description } r = requests.post(url, json=json, headers=self.auth.headers) return handle_response(r.status_code, r.json()) def delete_tokens(self, object_id, token_id): """ Revoke a token. DELETE /objects/{objectId}/tokens https://bbdata.daplab.ch/api/#objects__objectid__tokens_delete """ url = output_api_url + self.base_path + "/" + str(object_id) \ + "/tokens" params = { "tokenId": token_id } r = requests.delete(url, params=params, headers=self.auth.headers) return handle_response(r.status_code, True) def put_tags(self, object_id, tags): """ Add tags to the object. PUT /objects/{objectId}/tags https://bbdata.daplab.ch/api/#objects__objectid__tags_put """ url = output_api_url + self.base_path + "/" + str(object_id) \ + "/tags" params = { "tags": tags } r = requests.put(url, params=params, headers=self.auth.headers) return handle_response(r.status_code, True) def delete_tags(self, object_id, tags): """ Remove tags. DELETE /objects/{objectId}/tags https://bbdata.daplab.ch/api/#objects__objectid__tags_delete """ url = output_api_url + self.base_path + "/" + str(object_id) \ + "/tags" params = { "tags": tags } r = requests.put(url, params=params, headers=self.auth.headers) return handle_response(r.status_code, True) def get_comments(self, object_id): """ Get all comments attached to this object. Use the /comments endpoint for more actions. GET /objects/{objectId}/comments https://bbdata.daplab.ch/api/#objects__objectid__comments_get """ url = output_api_url + self.base_path + "/" + str(object_id) \ + "/comments" r = requests.get(url, headers=self.auth.headers) return handle_response(r.status_code, r.json())
[ 1, 1053, 7274, 13, 3166, 289, 29890, 1272, 29889, 2917, 1053, 1962, 29918, 2754, 29918, 2271, 13, 3166, 289, 29890, 1272, 29889, 4422, 1053, 4386, 29918, 5327, 13, 13, 13, 1990, 4669, 29879, 29901, 13, 13, 1678, 2967, 29918, 2084, 353, 5591, 12650, 29908, 13, 1678, 4817, 353, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4817, 1125, 13, 4706, 1583, 29889, 5150, 353, 4817, 13, 13, 1678, 822, 679, 29918, 497, 29898, 1311, 29892, 8282, 29922, 8516, 29892, 2740, 29922, 8516, 29892, 1813, 29922, 8516, 29892, 639, 29918, 3488, 29922, 8516, 29892, 13, 18884, 2044, 519, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 1051, 310, 15579, 3618, 29889, 13, 13, 4706, 12354, 847, 12650, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 29918, 657, 13, 4706, 9995, 13, 4706, 8636, 353, 426, 13, 9651, 376, 11338, 1115, 8282, 29892, 13, 9651, 376, 4478, 1115, 2740, 29892, 13, 9651, 376, 3488, 1115, 1813, 29892, 13, 9651, 376, 546, 5074, 1115, 639, 29918, 3488, 29892, 13, 9651, 376, 8231, 519, 1115, 2044, 519, 29892, 13, 4706, 500, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 13, 4706, 364, 353, 7274, 29889, 657, 29898, 2271, 29892, 8636, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 1925, 29898, 1311, 29892, 1024, 29892, 5190, 29918, 18098, 29892, 12271, 29892, 6139, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 6204, 263, 716, 1203, 29889, 13, 13, 4706, 349, 2692, 847, 12650, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 29918, 649, 13, 4706, 9995, 13, 4706, 4390, 353, 426, 13, 9651, 376, 978, 1115, 1024, 29892, 13, 9651, 376, 8216, 1115, 6139, 29892, 13, 9651, 376, 5441, 14730, 1115, 5190, 29918, 18098, 29892, 13, 9651, 525, 20348, 2396, 12271, 13, 4706, 500, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 13, 4706, 364, 353, 7274, 29889, 649, 29898, 2271, 29892, 4390, 29922, 3126, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 1203, 29918, 333, 1125, 13, 4706, 9995, 13, 4706, 3617, 385, 1203, 29889, 13, 13, 4706, 12354, 847, 12650, 19248, 3318, 3624, 29913, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 657, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 13, 4706, 364, 353, 7274, 29889, 657, 29898, 2271, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 396, 736, 4669, 5103, 29898, 29878, 29889, 3126, 3101, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 1400, 29898, 1311, 29892, 1203, 29918, 333, 29892, 848, 1125, 13, 4706, 9995, 13, 4706, 7641, 278, 1024, 322, 29914, 272, 278, 6139, 310, 278, 1203, 29889, 13, 4706, 9333, 278, 4426, 21534, 297, 278, 3573, 674, 367, 9120, 29889, 13, 13, 4706, 11971, 847, 12650, 19248, 3318, 1204, 29913, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 2490, 13, 4706, 9995, 13, 4706, 396, 14402, 450, 848, 304, 3638, 3508, 29915, 29873, 4529, 297, 278, 3450, 360, 12332, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 13, 4706, 364, 353, 7274, 29889, 2490, 29898, 2271, 29892, 848, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 1203, 29918, 333, 1125, 13, 4706, 9995, 13, 4706, 21267, 278, 1203, 411, 278, 2183, 1178, 13, 13, 4706, 11971, 847, 12650, 19248, 3318, 1204, 29913, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 8143, 13, 4706, 9995, 13, 4706, 396, 14402, 910, 1158, 338, 297, 278, 4918, 1171, 8722, 541, 3508, 29915, 29873, 297, 278, 10561, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 13, 4706, 364, 353, 7274, 29889, 8143, 29898, 2271, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 1400, 29918, 20472, 29898, 1311, 29892, 1203, 29918, 333, 1125, 13, 4706, 9995, 13, 4706, 3295, 519, 445, 1203, 29889, 2178, 6942, 18897, 674, 367, 6206, 29889, 13, 13, 4706, 11971, 847, 12650, 19248, 3318, 1204, 6822, 20472, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 20472, 29918, 2490, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 20472, 29908, 13, 4706, 364, 353, 7274, 29889, 2490, 29898, 2271, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 5852, 29897, 13, 13, 1678, 822, 1400, 29918, 12007, 29898, 1311, 29892, 1203, 29918, 333, 1125, 13, 4706, 9995, 13, 4706, 1174, 519, 445, 1203, 29889, 13, 13, 4706, 11971, 847, 12650, 19248, 3318, 1204, 6822, 12007, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 12007, 29918, 2490, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 12007, 29908, 13, 4706, 364, 353, 7274, 29889, 2490, 29898, 2271, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 5852, 29897, 13, 13, 1678, 822, 679, 29918, 517, 12360, 29898, 1311, 29892, 1203, 29918, 333, 29892, 6139, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 1051, 310, 18897, 363, 278, 1203, 29889, 319, 5993, 338, 1304, 304, 9752, 716, 13, 4706, 15366, 313, 4149, 1881, 29899, 2754, 467, 13, 13, 4706, 530, 13136, 6139, 508, 367, 4502, 297, 278, 13, 4706, 3573, 313, 3317, 29871, 29953, 29945, 4890, 467, 13, 13, 4706, 12354, 847, 12650, 19248, 3318, 1204, 6822, 517, 12360, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 517, 12360, 29918, 657, 13, 4706, 9995, 13, 4706, 396, 14402, 450, 3450, 10561, 4083, 372, 29915, 29879, 1950, 304, 1209, 385, 13136, 6139, 13, 4706, 396, 259, 541, 372, 3430, 763, 372, 29915, 29879, 263, 10171, 363, 263, 12354, 2009, 856, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 517, 12360, 29908, 13, 4706, 4390, 353, 426, 13, 9651, 376, 8216, 1115, 6139, 13, 4706, 500, 13, 4706, 364, 353, 7274, 29889, 657, 29898, 2271, 29892, 4390, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 1925, 29918, 517, 12360, 29898, 1311, 29892, 1203, 29918, 333, 1125, 13, 4706, 9995, 13, 4706, 3251, 403, 263, 716, 26130, 5993, 29889, 13, 13, 4706, 349, 2692, 847, 12650, 19248, 3318, 1204, 6822, 517, 12360, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 517, 12360, 29918, 649, 13, 4706, 9995, 13, 4706, 396, 14402, 450, 13136, 6139, 881, 3117, 367, 2715, 297, 445, 13, 4706, 396, 29871, 1158, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 517, 12360, 29908, 13, 4706, 364, 353, 7274, 29889, 649, 29898, 2271, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 1400, 29918, 517, 12360, 29898, 1311, 29892, 1203, 29918, 333, 29892, 6139, 1125, 13, 4706, 9995, 13, 4706, 7641, 278, 5993, 29915, 29879, 6139, 29889, 13, 13, 4706, 11971, 847, 12650, 19248, 3318, 1204, 6822, 517, 12360, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 517, 12360, 29918, 2490, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 517, 12360, 29908, 13, 4706, 4390, 353, 426, 13, 9651, 376, 8216, 1115, 6139, 13, 4706, 500, 13, 4706, 364, 353, 7274, 29889, 2490, 29898, 2271, 29892, 4390, 29922, 3126, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 13, 1678, 822, 5217, 29918, 517, 12360, 29898, 1311, 29892, 1203, 29918, 333, 29892, 5993, 29918, 333, 1125, 13, 4706, 9995, 13, 4706, 830, 5744, 263, 5993, 29889, 13, 13, 4706, 5012, 18476, 847, 12650, 19248, 3318, 1204, 6822, 517, 12360, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 517, 12360, 29918, 8143, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 517, 12360, 29908, 13, 4706, 8636, 353, 426, 13, 9651, 376, 6979, 1204, 1115, 5993, 29918, 333, 13, 4706, 500, 13, 4706, 364, 353, 7274, 29889, 8143, 29898, 2271, 29892, 8636, 29922, 7529, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 5852, 29897, 13, 13, 1678, 822, 1925, 29918, 11338, 29898, 1311, 29892, 1203, 29918, 333, 29892, 8282, 1125, 13, 4706, 9995, 13, 4706, 3462, 8282, 304, 278, 1203, 29889, 13, 13, 4706, 349, 2692, 847, 12650, 19248, 3318, 1204, 6822, 11338, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 11338, 29918, 649, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 11338, 29908, 13, 4706, 8636, 353, 426, 13, 9651, 376, 11338, 1115, 8282, 13, 4706, 500, 13, 4706, 364, 353, 7274, 29889, 649, 29898, 2271, 29892, 8636, 29922, 7529, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 5852, 29897, 13, 13, 1678, 822, 5217, 29918, 11338, 29898, 1311, 29892, 1203, 29918, 333, 29892, 8282, 1125, 13, 4706, 9995, 13, 4706, 15154, 8282, 29889, 13, 13, 4706, 5012, 18476, 847, 12650, 19248, 3318, 1204, 6822, 11338, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 11338, 29918, 8143, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 11338, 29908, 13, 4706, 8636, 353, 426, 13, 9651, 376, 11338, 1115, 8282, 13, 4706, 500, 13, 4706, 364, 353, 7274, 29889, 649, 29898, 2271, 29892, 8636, 29922, 7529, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 5852, 29897, 13, 13, 1678, 822, 679, 29918, 21032, 29898, 1311, 29892, 1203, 29918, 333, 1125, 13, 4706, 9995, 13, 4706, 3617, 599, 6589, 10959, 304, 445, 1203, 29889, 4803, 278, 847, 21032, 16248, 13, 4706, 363, 901, 8820, 29889, 13, 13, 4706, 12354, 847, 12650, 19248, 3318, 1204, 6822, 21032, 13, 4706, 2045, 597, 1327, 1272, 29889, 29881, 481, 8205, 29889, 305, 29914, 2754, 8484, 12650, 1649, 3318, 333, 1649, 21032, 29918, 657, 13, 4706, 9995, 13, 4706, 3142, 353, 1962, 29918, 2754, 29918, 2271, 718, 1583, 29889, 3188, 29918, 2084, 718, 5591, 29908, 718, 851, 29898, 3318, 29918, 333, 29897, 320, 13, 9651, 718, 5591, 21032, 29908, 13, 4706, 364, 353, 7274, 29889, 657, 29898, 2271, 29892, 9066, 29922, 1311, 29889, 5150, 29889, 13662, 29897, 13, 4706, 736, 4386, 29918, 5327, 29898, 29878, 29889, 4882, 29918, 401, 29892, 364, 29889, 3126, 3101, 13, 2 ]
src/config/settings.py
d3dmenu/crypto-master
0
120566
<gh_stars>0 import os import sys import environ env = environ.Env() # API Coin market cap API_KEY = env.str('API_KEY', '6cf06008-f1d3-45b2-9555-3ff76eec016e') # Base url path data forex realtime scraping urls = { 'forex-market': 'https://scanner.tradingview.com/forex/scan', 'coin-market-all': 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest', # get all crypto coin 'coin-market': 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest' # specific check quote coin } # Line Developer LINE_API = env.str('LINE_API', 'https://api.line.me/v2/bot/message/reply') CHANNEL_SECRET = env.str('CHANNEL_SECRET', '<KEY>') CHANNEL_ACCESS_TOKEN = env.str('CHANNEL_ACCESS_TOKEN', '<KEY> # Settings delay for request api DELAY_REQUEST = env.int('DELAY_REQUEST', 60) DELAY_FOREX = env.int('DELAY_FOREX', 5) # Load task from csv DATABASE = env.str('DATABASE', 'schedules.csv') # Forex currency list CURRENCY = [ 'AUDCHF', 'AUDGBP', 'AUDNZD', 'CADCHF', 'CADJPY', 'CHFJPY', 'EURCHF', 'EURNZD', 'GBPCHF', 'NZDCAD', 'NZDCHF', 'NZDJPY', 'NZDUSD', 'USDCAD', 'USDCHF', 'USDJPY', 'AUDCAD', 'AUDJPY', 'AUDUSD', 'EURAUD', 'EURCAD', 'EURBGP', 'EURJPY', 'EURUSD', 'GBPAUD', 'GBPCAD', 'GBPJPY', 'USDJPY', 'NZDUSD' ] # Firebase SDK SCHEDULES_COLLECTION = env.str('SCHEDULES_COLLECTION', 'schedules') # Customize Message from python # Because the delivery of messages in dialogflow is a little delayed, python is utilized instead. CUSTOM_MESSAGE = [ 'ระบบกำลังประมวล รอสักครู่ครับ', 'กรุณารอสักครู่ ระบบใช้เวลาไม่เกิน 1 นาที', 'ระบบกำลังประมวลผลคู่เงินทุก Timeframe ใช้เวลาไม่เกิน 1 นาทีครับ', 'รอสักครู่ครับ กำลังวิเคราะห์คู่เงิน เมื่อพร้อมแล้วจะส่งลิสต์ข้อมูลให้ครับ', 'กรุณารอสักครู่ ระบบใช้เวลา 1 นาที ในการวิเคราะห์คู่เงินที่มี Volume เทรดสูงมาให้ท่านอยู่', 'กรุณารอสักครู่ ระบบกำลังประมวลผลคู่เงิน', 'ได้ครับ รอระบบประมวลผลสักครู่นะครับ' ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 5215, 10876, 13, 13, 5215, 12471, 13, 13, 6272, 353, 12471, 29889, 21745, 580, 13, 13, 29937, 3450, 3189, 262, 9999, 2117, 13, 8787, 29918, 10818, 353, 8829, 29889, 710, 877, 8787, 29918, 10818, 742, 525, 29953, 6854, 29900, 29953, 29900, 29900, 29947, 29899, 29888, 29896, 29881, 29941, 29899, 29946, 29945, 29890, 29906, 29899, 29929, 29945, 29945, 29945, 29899, 29941, 600, 29955, 29953, 29872, 687, 29900, 29896, 29953, 29872, 1495, 13, 13, 29937, 7399, 3142, 2224, 848, 363, 735, 1855, 2230, 885, 2390, 292, 13, 26045, 353, 426, 13, 1678, 525, 1079, 29916, 29899, 28549, 2396, 525, 991, 597, 1557, 7310, 29889, 509, 9382, 1493, 29889, 510, 29914, 1079, 29916, 29914, 16192, 742, 13, 1678, 525, 1111, 262, 29899, 28549, 29899, 497, 2396, 525, 991, 597, 771, 29899, 2754, 29889, 1111, 262, 28549, 5030, 29889, 510, 29914, 29894, 29896, 29914, 29883, 4641, 542, 10880, 29914, 1761, 886, 29914, 12333, 742, 29871, 396, 679, 599, 274, 17929, 19480, 13, 1678, 525, 1111, 262, 29899, 28549, 2396, 525, 991, 597, 771, 29899, 2754, 29889, 1111, 262, 28549, 5030, 29889, 510, 29914, 29894, 29896, 29914, 29883, 4641, 542, 10880, 29914, 339, 4769, 29914, 12333, 29915, 29871, 396, 2702, 1423, 14978, 19480, 13, 29913, 13, 13, 29937, 7407, 10682, 261, 13, 18521, 29918, 8787, 353, 8829, 29889, 710, 877, 18521, 29918, 8787, 742, 525, 991, 597, 2754, 29889, 1220, 29889, 1004, 29914, 29894, 29906, 29914, 7451, 29914, 4906, 29914, 3445, 368, 1495, 13, 3210, 2190, 29940, 6670, 29918, 1660, 22245, 29911, 353, 8829, 29889, 710, 877, 3210, 2190, 29940, 6670, 29918, 1660, 22245, 29911, 742, 12801, 10818, 29958, 1495, 13, 3210, 2190, 29940, 6670, 29918, 2477, 23524, 29918, 4986, 29968, 1430, 353, 8829, 29889, 710, 877, 3210, 2190, 29940, 6670, 29918, 2477, 23524, 29918, 4986, 29968, 1430, 742, 13, 462, 1669, 12801, 10818, 29958, 13, 13, 29937, 19215, 9055, 363, 2009, 7882, 13, 2287, 18799, 29918, 16244, 353, 8829, 29889, 524, 877, 2287, 18799, 29918, 16244, 742, 29871, 29953, 29900, 29897, 13, 2287, 18799, 29918, 5800, 1525, 29990, 353, 8829, 29889, 524, 877, 2287, 18799, 29918, 5800, 1525, 29990, 742, 29871, 29945, 29897, 13, 29937, 16012, 3414, 515, 11799, 13, 25832, 27982, 353, 8829, 29889, 710, 877, 25832, 27982, 742, 525, 816, 287, 2540, 29889, 7638, 1495, 13, 13, 29937, 28297, 29916, 27550, 1051, 13, 13, 22484, 29934, 1430, 29907, 29979, 353, 518, 13, 1678, 525, 29909, 15789, 3210, 29943, 742, 525, 29909, 15789, 7210, 29925, 742, 525, 29909, 15789, 29940, 29999, 29928, 742, 525, 29907, 3035, 3210, 29943, 742, 525, 29907, 3035, 29967, 20055, 742, 525, 3210, 29943, 29967, 20055, 742, 525, 29923, 4574, 3210, 29943, 742, 525, 29923, 24015, 29999, 29928, 742, 13, 1678, 525, 7210, 29925, 3210, 29943, 742, 525, 29940, 29999, 12696, 3035, 742, 525, 29940, 29999, 29928, 3210, 29943, 742, 525, 29940, 29999, 29928, 29967, 20055, 742, 525, 29940, 29999, 29928, 3308, 29928, 742, 525, 3308, 12696, 3035, 742, 525, 3308, 29928, 3210, 29943, 742, 525, 3308, 29928, 29967, 20055, 742, 13, 1678, 525, 25951, 12696, 3035, 742, 525, 29909, 15789, 29967, 20055, 742, 525, 29909, 15789, 3308, 29928, 742, 525, 29923, 4574, 29909, 15789, 742, 525, 29923, 4574, 29907, 3035, 742, 525, 29923, 4574, 29933, 19903, 742, 525, 29923, 4574, 29967, 20055, 742, 525, 29923, 4574, 3308, 29928, 742, 13, 1678, 525, 7210, 7228, 15789, 742, 525, 7210, 9026, 3035, 742, 525, 7210, 29925, 29967, 20055, 742, 525, 3308, 29928, 29967, 20055, 742, 525, 29940, 29999, 29928, 3308, 29928, 29915, 13, 29962, 13, 13, 29937, 17731, 12967, 13, 29903, 3210, 3352, 29965, 17101, 29918, 15032, 3281, 2725, 353, 8829, 29889, 710, 877, 29903, 3210, 3352, 29965, 17101, 29918, 15032, 3281, 2725, 742, 525, 816, 287, 2540, 1495, 13, 13, 13, 29937, 8701, 675, 7777, 515, 3017, 13, 29937, 7311, 278, 28289, 310, 7191, 297, 7928, 1731, 338, 263, 2217, 29801, 29892, 3017, 338, 3667, 1891, 2012, 29889, 13, 29907, 17321, 6488, 29918, 2303, 1799, 10461, 353, 518, 13, 1678, 525, 30297, 30823, 30526, 30526, 30425, 30747, 30496, 30510, 30398, 31010, 30297, 30823, 30501, 30492, 30496, 29871, 30297, 30351, 30547, 30510, 30425, 30759, 30297, 31396, 30543, 30759, 30297, 30510, 30526, 742, 525, 30425, 30297, 30803, 31796, 30289, 30297, 30351, 30547, 30510, 30425, 30759, 30297, 31396, 30543, 29871, 30297, 30823, 30526, 30526, 227, 188, 134, 30913, 30652, 30401, 30492, 30496, 30289, 31252, 30501, 30543, 30401, 30425, 30507, 30348, 29871, 29896, 29871, 30348, 30289, 30595, 30691, 742, 525, 30297, 30823, 30526, 30526, 30425, 30747, 30496, 30510, 30398, 31010, 30297, 30823, 30501, 30492, 30496, 227, 187, 159, 30496, 30759, 31396, 30543, 30401, 30398, 30507, 30348, 30595, 30803, 30425, 5974, 2557, 29871, 227, 188, 134, 30913, 30652, 30401, 30492, 30496, 30289, 31252, 30501, 30543, 30401, 30425, 30507, 30348, 29871, 29896, 29871, 30348, 30289, 30595, 30691, 30759, 30297, 30510, 30526, 742, 13, 1678, 525, 30297, 30351, 30547, 30510, 30425, 30759, 30297, 31396, 30543, 30759, 30297, 30510, 30526, 29871, 30425, 30747, 30496, 30510, 30398, 30492, 30507, 30401, 30759, 30297, 30289, 30823, 30663, 30779, 30759, 31396, 30543, 30401, 30398, 30507, 30348, 29871, 30401, 30501, 31422, 30543, 30351, 30727, 30297, 30652, 30351, 30501, 31073, 30496, 30652, 30492, 30991, 30823, 30547, 30543, 30398, 30496, 30507, 30547, 30618, 30779, 31310, 30652, 30351, 30501, 31396, 30496, 227, 188, 134, 30663, 30652, 30759, 30297, 30510, 30526, 742, 525, 30425, 30297, 30803, 31796, 30289, 30297, 30351, 30547, 30510, 30425, 30759, 30297, 31396, 30543, 29871, 30297, 30823, 30526, 30526, 227, 188, 134, 30913, 30652, 30401, 30492, 30496, 30289, 29871, 29896, 29871, 30348, 30289, 30595, 30691, 29871, 227, 188, 134, 30348, 30425, 30289, 30297, 30492, 30507, 30401, 30759, 30297, 30289, 30823, 30663, 30779, 30759, 31396, 30543, 30401, 30398, 30507, 30348, 30595, 30691, 30543, 30501, 30691, 16934, 29871, 30401, 30595, 30297, 30718, 30547, 31396, 30398, 30501, 30289, 227, 188, 134, 30663, 30652, 30595, 30543, 30289, 30348, 30351, 30549, 31396, 30543, 742, 13, 1678, 525, 30425, 30297, 30803, 31796, 30289, 30297, 30351, 30547, 30510, 30425, 30759, 30297, 31396, 30543, 29871, 30297, 30823, 30526, 30526, 30425, 30747, 30496, 30510, 30398, 31010, 30297, 30823, 30501, 30492, 30496, 227, 187, 159, 30496, 30759, 31396, 30543, 30401, 30398, 30507, 30348, 742, 525, 31252, 30718, 30652, 30759, 30297, 30510, 30526, 29871, 30297, 30351, 30297, 30823, 30526, 30526, 31010, 30297, 30823, 30501, 30492, 30496, 227, 187, 159, 30496, 30547, 30510, 30425, 30759, 30297, 31396, 30543, 30348, 30823, 30759, 30297, 30510, 30526, 29915, 13, 29962, 13, 2 ]
apps/plugins/__init__.py
jiangyx3915/-graph-bed
10
108103
<gh_stars>1-10 #!/usr/bin/python # -*- coding: utf-8 -*- """ __author__= 'jiangyixin' __time__ = 2019/2/25 22:11 """ from .smms import SmPlugin
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 1649, 8921, 1649, 29922, 525, 2397, 574, 29891, 861, 262, 29915, 13, 1649, 2230, 1649, 353, 29871, 29906, 29900, 29896, 29929, 29914, 29906, 29914, 29906, 29945, 29871, 29906, 29906, 29901, 29896, 29896, 13, 15945, 29908, 13, 3166, 869, 3844, 1516, 1053, 4116, 16288, 13, 2 ]
tests/validation_suite/automation_framework/work_order_submit/work_order_submit_utility.py
manojsalunke85/avalon0.6_automaiton
0
123973
<reponame>manojsalunke85/avalon0.6_automaiton # Copyright 2019 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pytest import time import json import logging from error_code.error_status import SignatureStatus from automation_framework.utilities.workflow import submit_request from automation_framework.utilities.workflow import validate_response_code from automation_framework.work_order_submit.work_order_submit_params \ import WorkOrderSubmit import crypto_utils.crypto_utility as enclave_helper import crypto_utils.signature as signature logger = logging.getLogger(__name__) def submit_work_order(input_request, request_mode, tamper, output_json_file_name, uri_client, worker_obj, request_method, private_key, err_cd): """ Function to submit work order Read input request from string or object and submit request. Uses WorkOrderSubmit class definition to initialize work order object. Triggers submit_request, validate_response_code, Returns - error code, input_json_str1, response, submiting_time, worker_obj, sig_obj, encrypted_session_key. """ response = {} if err_cd == 0: # -------------------------------------------------------------------- logger.info("------ Testing WorkOrderSubmit ------") if request_mode == "object": input_work_order = json.loads(input_request.to_string()) else: # create work order request wo_obj = WorkOrderSubmit() wo_obj.add_json_values(input_request, worker_obj, private_key, tamper) input_work_order = wo_obj.compute_signature(tamper) logger.info('Compute Signature complete \n') input_json_str1 = json.loads(input_work_order) response = submit_request(uri_client, input_json_str1, output_json_file_name) err_cd = validate_response_code(response) else: logger.info('ERROR: No Worker Retrieved from system.\ Unable to proceed to submit work order.') response_tup = (err_cd, input_json_str1, response, wo_obj.session_key, wo_obj.session_iv, wo_obj.get_encrypted_session_key()) return response_tup def verify_work_order_signature(response, worker_obj): verify_key = worker_obj.verification_key try: verify_obj = signature.ClientSignature() sig_bool = verify_obj.verify_signature(response, verify_key) if sig_bool is SignatureStatus.PASSED: err_cd = 0 logger.info('Success: Work Order Signature Verified.') else: err_cd = 1 logger.info('ERROR: Work Order Signature Verification Failed') except Exception: err_cd = 1 logger.error('ERROR: Failed to analyze Signature Verification') return err_cd def decrypt_work_order_response(response, session_key, session_iv): decrypted_data = "" try: decrypted_data = enclave_helper.decrypted_response(response, session_key, session_iv) err_cd = 0 logger.info('Success: Work Order Response Decrypted.\n\n') except Exception: err_cd = 1 logger.info('ERROR: Work Order Response Decryption Failed') return err_cd, decrypted_data
[ 1, 529, 276, 1112, 420, 29958, 1171, 29877, 1315, 284, 348, 446, 29947, 29945, 29914, 7712, 265, 29900, 29889, 29953, 29918, 17405, 1249, 265, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 18555, 15025, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 5215, 11451, 1688, 13, 5215, 931, 13, 5215, 4390, 13, 5215, 12183, 13, 13, 3166, 1059, 29918, 401, 29889, 2704, 29918, 4882, 1053, 9954, 1535, 5709, 13, 3166, 3345, 362, 29918, 4468, 29889, 4422, 1907, 29889, 1287, 1731, 1053, 9752, 29918, 3827, 13, 3166, 3345, 362, 29918, 4468, 29889, 4422, 1907, 29889, 1287, 1731, 1053, 12725, 29918, 5327, 29918, 401, 13, 3166, 3345, 362, 29918, 4468, 29889, 1287, 29918, 2098, 29918, 7892, 29889, 1287, 29918, 2098, 29918, 7892, 29918, 7529, 320, 13, 1678, 1053, 5244, 7514, 16228, 13, 5215, 274, 17929, 29918, 13239, 29889, 29883, 17929, 29918, 329, 1793, 408, 2094, 18398, 29918, 20907, 13, 5215, 274, 17929, 29918, 13239, 29889, 4530, 1535, 408, 12608, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 9752, 29918, 1287, 29918, 2098, 29898, 2080, 29918, 3827, 29892, 2009, 29918, 8513, 29892, 21308, 546, 29892, 13, 462, 418, 1962, 29918, 3126, 29918, 1445, 29918, 978, 29892, 13, 462, 418, 21333, 29918, 4645, 29892, 15645, 29918, 5415, 29892, 13, 462, 418, 2009, 29918, 5696, 29892, 2024, 29918, 1989, 29892, 4589, 29918, 2252, 1125, 13, 1678, 9995, 6680, 304, 9752, 664, 1797, 13, 4706, 7523, 1881, 2009, 515, 1347, 470, 1203, 322, 9752, 2009, 29889, 13, 4706, 10783, 267, 5244, 7514, 16228, 770, 5023, 304, 11905, 664, 1797, 1203, 29889, 13, 4706, 1605, 335, 5743, 9752, 29918, 3827, 29892, 12725, 29918, 5327, 29918, 401, 29892, 13, 4706, 16969, 448, 1059, 775, 29892, 1881, 29918, 3126, 29918, 710, 29896, 29892, 2933, 29892, 9752, 292, 29918, 2230, 29892, 13, 4706, 15645, 29918, 5415, 29892, 4365, 29918, 5415, 29892, 23220, 29918, 7924, 29918, 1989, 29889, 9995, 13, 13, 1678, 2933, 353, 6571, 13, 13, 1678, 565, 4589, 29918, 2252, 1275, 29871, 29900, 29901, 13, 4706, 396, 448, 2683, 2683, 2683, 2683, 5634, 13, 4706, 17927, 29889, 3888, 703, 22158, 4321, 292, 5244, 7514, 16228, 448, 23648, 1159, 13, 13, 4706, 565, 2009, 29918, 8513, 1275, 376, 3318, 1115, 13, 9651, 1881, 29918, 1287, 29918, 2098, 353, 4390, 29889, 18132, 29898, 2080, 29918, 3827, 29889, 517, 29918, 1807, 3101, 13, 4706, 1683, 29901, 13, 9651, 396, 1653, 664, 1797, 2009, 13, 9651, 8879, 29918, 5415, 353, 5244, 7514, 16228, 580, 13, 9651, 8879, 29918, 5415, 29889, 1202, 29918, 3126, 29918, 5975, 29898, 2080, 29918, 3827, 29892, 15645, 29918, 5415, 29892, 2024, 29918, 1989, 29892, 13, 462, 462, 259, 21308, 546, 29897, 13, 9651, 1881, 29918, 1287, 29918, 2098, 353, 8879, 29918, 5415, 29889, 26017, 29918, 4530, 1535, 29898, 29873, 314, 546, 29897, 13, 9651, 17927, 29889, 3888, 877, 20606, 29872, 9954, 1535, 4866, 320, 29876, 1495, 13, 13, 4706, 1881, 29918, 3126, 29918, 710, 29896, 353, 4390, 29889, 18132, 29898, 2080, 29918, 1287, 29918, 2098, 29897, 13, 4706, 2933, 353, 9752, 29918, 3827, 29898, 5338, 29918, 4645, 29892, 1881, 29918, 3126, 29918, 710, 29896, 29892, 13, 462, 462, 29871, 1962, 29918, 3126, 29918, 1445, 29918, 978, 29897, 13, 4706, 4589, 29918, 2252, 353, 12725, 29918, 5327, 29918, 401, 29898, 5327, 29897, 13, 13, 1678, 1683, 29901, 13, 4706, 17927, 29889, 3888, 877, 11432, 29901, 1939, 5244, 261, 25427, 515, 1788, 7790, 13, 462, 259, 20065, 304, 8469, 304, 9752, 664, 1797, 29889, 1495, 13, 13, 1678, 2933, 29918, 29873, 786, 353, 313, 3127, 29918, 2252, 29892, 1881, 29918, 3126, 29918, 710, 29896, 29892, 2933, 29892, 13, 462, 1678, 8879, 29918, 5415, 29889, 7924, 29918, 1989, 29892, 8879, 29918, 5415, 29889, 7924, 29918, 440, 29892, 13, 462, 1678, 8879, 29918, 5415, 29889, 657, 29918, 3977, 14740, 29918, 7924, 29918, 1989, 3101, 13, 13, 1678, 736, 2933, 29918, 29873, 786, 13, 13, 13, 1753, 11539, 29918, 1287, 29918, 2098, 29918, 4530, 1535, 29898, 5327, 29892, 15645, 29918, 5415, 1125, 13, 1678, 11539, 29918, 1989, 353, 15645, 29918, 5415, 29889, 369, 2450, 29918, 1989, 13, 13, 1678, 1018, 29901, 13, 4706, 11539, 29918, 5415, 353, 12608, 29889, 4032, 10140, 1535, 580, 13, 4706, 4365, 29918, 11227, 353, 11539, 29918, 5415, 29889, 27902, 29918, 4530, 1535, 29898, 5327, 29892, 11539, 29918, 1989, 29897, 13, 13, 4706, 565, 4365, 29918, 11227, 338, 9954, 1535, 5709, 29889, 29925, 3289, 1660, 29928, 29901, 13, 9651, 4589, 29918, 2252, 353, 29871, 29900, 13, 9651, 17927, 29889, 3888, 877, 14191, 29901, 5244, 8170, 9954, 1535, 1798, 2164, 29889, 1495, 13, 4706, 1683, 29901, 13, 9651, 4589, 29918, 2252, 353, 29871, 29896, 13, 9651, 17927, 29889, 3888, 877, 11432, 29901, 5244, 8170, 9954, 1535, 1798, 2450, 18390, 1495, 13, 1678, 5174, 8960, 29901, 13, 4706, 4589, 29918, 2252, 353, 29871, 29896, 13, 4706, 17927, 29889, 2704, 877, 11432, 29901, 18390, 304, 27599, 9954, 1535, 1798, 2450, 1495, 13, 13, 1678, 736, 4589, 29918, 2252, 13, 13, 13, 1753, 1602, 4641, 29918, 1287, 29918, 2098, 29918, 5327, 29898, 5327, 29892, 4867, 29918, 1989, 29892, 4867, 29918, 440, 1125, 13, 1678, 1602, 14740, 29918, 1272, 353, 5124, 13, 1678, 1018, 29901, 13, 4706, 1602, 14740, 29918, 1272, 353, 2094, 18398, 29918, 20907, 29889, 7099, 14740, 29918, 5327, 29898, 5327, 29892, 13, 462, 462, 462, 965, 4867, 29918, 1989, 29892, 13, 462, 462, 462, 965, 4867, 29918, 440, 29897, 13, 4706, 4589, 29918, 2252, 353, 29871, 29900, 13, 4706, 17927, 29889, 3888, 877, 14191, 29901, 5244, 8170, 13291, 3826, 14740, 7790, 29876, 29905, 29876, 1495, 13, 1678, 5174, 8960, 29901, 13, 4706, 4589, 29918, 2252, 353, 29871, 29896, 13, 4706, 17927, 29889, 3888, 877, 11432, 29901, 5244, 8170, 13291, 3826, 14272, 18390, 1495, 13, 13, 1678, 736, 4589, 29918, 2252, 29892, 1602, 14740, 29918, 1272, 13, 2 ]
tests/app/timeout_test.py
paraguz1/voila
0
161055
import pytest import os @pytest.fixture def voila_notebook(notebook_directory): return os.path.join(notebook_directory, 'sleep.ipynb') @pytest.fixture def voila_args_extra(): return ['--VoilaExecutePreprocessor.timeout=1', '--KernelManager.shutdown_wait_time=0.1'] @pytest.mark.gen_test def test_timeout(http_client, base_url): response = yield http_client.fetch(base_url) html_text = response.body.decode('utf-8') assert 'Cell execution timed out' in html_text
[ 1, 1053, 11451, 1688, 13, 13, 5215, 2897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 992, 4233, 29918, 1333, 19273, 29898, 1333, 19273, 29918, 12322, 1125, 13, 1678, 736, 2897, 29889, 2084, 29889, 7122, 29898, 1333, 19273, 29918, 12322, 29892, 525, 17059, 29889, 666, 948, 29890, 1495, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 992, 4233, 29918, 5085, 29918, 17833, 7295, 13, 1678, 736, 6024, 489, 29963, 29877, 4233, 12296, 6572, 26482, 29889, 15619, 29922, 29896, 742, 525, 489, 29968, 5851, 3260, 29889, 845, 329, 3204, 29918, 10685, 29918, 2230, 29922, 29900, 29889, 29896, 2033, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 1885, 29918, 1688, 13, 1753, 1243, 29918, 15619, 29898, 1124, 29918, 4645, 29892, 2967, 29918, 2271, 1125, 13, 1678, 2933, 353, 7709, 1732, 29918, 4645, 29889, 9155, 29898, 3188, 29918, 2271, 29897, 13, 1678, 3472, 29918, 726, 353, 2933, 29889, 2587, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 1678, 4974, 525, 4617, 8225, 5335, 287, 714, 29915, 297, 3472, 29918, 726, 13, 2 ]
windows_packages_gpu/torch/nn/intrinsic/qat/modules/linear_relu.py
codeproject/DeepStack
353
8207
from __future__ import absolute_import, division, print_function, unicode_literals import torch.nn.qat as nnqat import torch.nn.intrinsic import torch.nn.functional as F class LinearReLU(nnqat.Linear): r""" A LinearReLU module fused from Linear and ReLU modules, attached with FakeQuantize modules for output activation and weight, used in quantization aware training. We adopt the same interface as :class:`torch.nn.Linear`. Similar to `torch.nn.intrinsic.LinearReLU`, with FakeQuantize modules initialized to default. Attributes: activation_post_process: fake quant module for output activation weight: fake quant module for weight Examples:: >>> m = nn.qat.LinearReLU(20, 30) >>> input = torch.randn(128, 20) >>> output = m(input) >>> print(output.size()) torch.Size([128, 30]) """ _FLOAT_MODULE = torch.nn.intrinsic.LinearReLU def __init__(self, in_features, out_features, bias=True, qconfig=None): super(LinearReLU, self).__init__(in_features, out_features, bias, qconfig) def forward(self, input): return self.activation_post_process(F.relu( F.linear(input, self.weight_fake_quant(self.weight), self.bias))) @classmethod def from_float(cls, mod, qconfig=None): return super(LinearReLU, cls).from_float(mod, qconfig)
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 8542, 29892, 1596, 29918, 2220, 29892, 29104, 29918, 20889, 1338, 30004, 13, 5215, 4842, 305, 29889, 15755, 29889, 29939, 271, 408, 302, 29876, 29939, 271, 30004, 13, 5215, 4842, 305, 29889, 15755, 29889, 262, 509, 28594, 30004, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 30004, 13, 30004, 13, 1990, 22985, 1123, 29931, 29965, 29898, 15755, 29939, 271, 29889, 12697, 1125, 30004, 13, 1678, 364, 15945, 19451, 13, 1678, 319, 22985, 1123, 29931, 29965, 3883, 285, 3880, 515, 22985, 322, 830, 29931, 29965, 10585, 29892, 10959, 411, 30004, 13, 1678, 383, 1296, 22930, 675, 10585, 363, 1962, 26229, 322, 7688, 29892, 1304, 297, 30004, 13, 1678, 4323, 2133, 9543, 6694, 22993, 13, 30004, 13, 1678, 1334, 9332, 278, 1021, 5067, 408, 584, 1990, 18078, 7345, 305, 29889, 15755, 29889, 12697, 1412, 30004, 13, 30004, 13, 1678, 13999, 304, 421, 7345, 305, 29889, 15755, 29889, 262, 509, 28594, 29889, 12697, 1123, 29931, 29965, 1673, 411, 383, 1296, 22930, 675, 10585, 16601, 304, 30004, 13, 1678, 2322, 22993, 13, 30004, 13, 1678, 6212, 5026, 29901, 30004, 13, 4706, 26229, 29918, 2490, 29918, 5014, 29901, 25713, 4323, 3883, 363, 1962, 26229, 30004, 13, 4706, 7688, 29901, 25713, 4323, 3883, 363, 7688, 30004, 13, 30004, 13, 1678, 1222, 9422, 1057, 30004, 13, 30004, 13, 4706, 8653, 286, 353, 302, 29876, 29889, 29939, 271, 29889, 12697, 1123, 29931, 29965, 29898, 29906, 29900, 29892, 29871, 29941, 29900, 8443, 13, 4706, 8653, 1881, 353, 4842, 305, 29889, 9502, 29876, 29898, 29896, 29906, 29947, 29892, 29871, 29906, 29900, 8443, 13, 4706, 8653, 1962, 353, 286, 29898, 2080, 8443, 13, 4706, 8653, 1596, 29898, 4905, 29889, 2311, 3101, 30004, 13, 4706, 4842, 305, 29889, 3505, 4197, 29896, 29906, 29947, 29892, 29871, 29941, 29900, 2314, 30004, 13, 1678, 9995, 30004, 13, 1678, 903, 29943, 3927, 1299, 29918, 6720, 14849, 1307, 353, 4842, 305, 29889, 15755, 29889, 262, 509, 28594, 29889, 12697, 1123, 29931, 29965, 30004, 13, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 297, 29918, 22100, 29892, 714, 29918, 22100, 29892, 24003, 29922, 5574, 11167, 13, 462, 3855, 2917, 29922, 8516, 1125, 30004, 13, 4706, 2428, 29898, 12697, 1123, 29931, 29965, 29892, 1583, 467, 1649, 2344, 12035, 262, 29918, 22100, 29892, 714, 29918, 22100, 29892, 24003, 29892, 3855, 2917, 8443, 13, 30004, 13, 1678, 822, 6375, 29898, 1311, 29892, 1881, 1125, 30004, 13, 4706, 736, 1583, 29889, 11236, 362, 29918, 2490, 29918, 5014, 29898, 29943, 29889, 2674, 29884, 29898, 30004, 13, 9651, 383, 29889, 10660, 29898, 2080, 29892, 1583, 29889, 7915, 29918, 29888, 1296, 29918, 12150, 29898, 1311, 29889, 7915, 511, 1583, 29889, 29890, 3173, 4961, 30004, 13, 30004, 13, 1678, 732, 1990, 5696, 30004, 13, 1678, 822, 515, 29918, 7411, 29898, 25932, 29892, 878, 29892, 3855, 2917, 29922, 8516, 1125, 30004, 13, 4706, 736, 2428, 29898, 12697, 1123, 29931, 29965, 29892, 1067, 29879, 467, 3166, 29918, 7411, 29898, 1545, 29892, 3855, 2917, 8443, 13, 2 ]
src/model/gmf.py
AmazingDD/IF4RecSys
2
161324
import torch from tools.engine import Engine from tools.config import use_cuda class GMF(torch.nn.Module): def __init__(self, config): super(GMF, self).__init__() self.num_users = config['num_users'] self.num_items = config['num_items'] self.latent_dim = config['latent_dim'] self.embedding_user = torch.nn.Embedding(num_embeddings=self.num_users, embedding_dim=self.latent_dim) self.embedding_item = torch.nn.Embedding(num_embeddings=self.num_items, embedding_dim=self.latent_dim) self.affine_output = torch.nn.Linear(in_features=self.latent_dim, out_features=1) self.logistic = torch.nn.Sigmoid() def forward(self, user_indices, item_indices): user_embedding = self.embedding_user(user_indices) item_embedding = self.embedding_item(item_indices) element_product = torch.mul(user_embedding, item_embedding) logits = self.affine_output(element_product) rating = self.logistic(logits) return rating def init_weight(self): pass class GMFEngine(Engine): '''Engine for training & evaluating GMF model''' def __init__(self, config): self.model = GMF(config) if config['use_cuda'] is True: use_cuda(True, config['device_id']) self.model.cuda() super(GMFEngine, self).__init__(config)
[ 1, 1053, 4842, 305, 13, 3166, 8492, 29889, 10599, 1053, 10863, 13, 3166, 8492, 29889, 2917, 1053, 671, 29918, 29883, 6191, 13, 13, 1990, 402, 29924, 29943, 29898, 7345, 305, 29889, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 1125, 13, 4706, 2428, 29898, 21576, 29943, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 1949, 29918, 7193, 353, 2295, 1839, 1949, 29918, 7193, 2033, 13, 4706, 1583, 29889, 1949, 29918, 7076, 353, 2295, 1839, 1949, 29918, 7076, 2033, 13, 4706, 1583, 29889, 5066, 296, 29918, 6229, 353, 2295, 1839, 5066, 296, 29918, 6229, 2033, 13, 13, 4706, 1583, 29889, 17987, 8497, 29918, 1792, 353, 4842, 305, 29889, 15755, 29889, 6026, 2580, 8497, 29898, 1949, 29918, 17987, 29881, 886, 29922, 1311, 29889, 1949, 29918, 7193, 29892, 23655, 29918, 6229, 29922, 1311, 29889, 5066, 296, 29918, 6229, 29897, 13, 4706, 1583, 29889, 17987, 8497, 29918, 667, 353, 4842, 305, 29889, 15755, 29889, 6026, 2580, 8497, 29898, 1949, 29918, 17987, 29881, 886, 29922, 1311, 29889, 1949, 29918, 7076, 29892, 23655, 29918, 6229, 29922, 1311, 29889, 5066, 296, 29918, 6229, 29897, 13, 13, 4706, 1583, 29889, 3470, 457, 29918, 4905, 353, 4842, 305, 29889, 15755, 29889, 12697, 29898, 262, 29918, 22100, 29922, 1311, 29889, 5066, 296, 29918, 6229, 29892, 714, 29918, 22100, 29922, 29896, 29897, 13, 4706, 1583, 29889, 1188, 4695, 353, 4842, 305, 29889, 15755, 29889, 29903, 335, 29885, 3398, 580, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 1404, 29918, 513, 1575, 29892, 2944, 29918, 513, 1575, 1125, 13, 4706, 1404, 29918, 17987, 8497, 353, 1583, 29889, 17987, 8497, 29918, 1792, 29898, 1792, 29918, 513, 1575, 29897, 13, 4706, 2944, 29918, 17987, 8497, 353, 1583, 29889, 17987, 8497, 29918, 667, 29898, 667, 29918, 513, 1575, 29897, 13, 4706, 1543, 29918, 4704, 353, 4842, 305, 29889, 16109, 29898, 1792, 29918, 17987, 8497, 29892, 2944, 29918, 17987, 8497, 29897, 13, 4706, 1480, 1169, 353, 1583, 29889, 3470, 457, 29918, 4905, 29898, 5029, 29918, 4704, 29897, 13, 4706, 21700, 353, 1583, 29889, 1188, 4695, 29898, 1188, 1169, 29897, 13, 308, 13, 4706, 736, 21700, 13, 13, 1678, 822, 2069, 29918, 7915, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1990, 402, 29924, 29943, 12412, 29898, 12412, 1125, 13, 1678, 14550, 12412, 363, 6694, 669, 6161, 1218, 402, 29924, 29943, 1904, 12008, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 1125, 13, 4706, 1583, 29889, 4299, 353, 402, 29924, 29943, 29898, 2917, 29897, 13, 4706, 565, 2295, 1839, 1509, 29918, 29883, 6191, 2033, 338, 5852, 29901, 13, 9651, 671, 29918, 29883, 6191, 29898, 5574, 29892, 2295, 1839, 10141, 29918, 333, 11287, 13, 9651, 1583, 29889, 4299, 29889, 29883, 6191, 580, 13, 4706, 2428, 29898, 21576, 29943, 12412, 29892, 1583, 467, 1649, 2344, 12035, 2917, 29897, 13, 2 ]
tool/plugins/database/__init__.py
eherr/motion_preprocessing_tool
10
63547
<reponame>eherr/motion_preprocessing_tool import os import json from tool.plugins.database.constants import DB_URL from tool.core.editor_window import EditorWindow from tool.core.application_manager import ApplicationManager from tool.constants import CONFIG_FILE if os.path.isfile(CONFIG_FILE): from tool.plugins.database.constants import set_constants_from_file set_constants_from_file(CONFIG_FILE) from tool.plugins.database.gui import MotionDBBrowserDialog, GraphTableViewDialog, UploadMotionDialog, LoginDialog, SynchronizeSkeletonsWithDBDialog from tool.plugins.database.session_manager import SessionManager from anim_utils.utilities.db_interface import replace_motion_in_db EditorWindow.add_plugin_object("session_manager", SessionManager) EditorWindow.add_plugin_object("motion_db_browser_dialog", None) def open_motion_db_browser(): """ https://stackoverflow.com/questions/38309803/pyqt-non-modal-dialog-always-modal """ if EditorWindow.instance.motion_db_browser_dialog is None: EditorWindow.instance.motion_db_browser_dialog = MotionDBBrowserDialog(ApplicationManager.instance.scene, parent=EditorWindow.instance) else: EditorWindow.instance.motion_db_browser_dialog.raise_() EditorWindow.instance.motion_db_browser_dialog.activateWindow() def synchronize_skeletons_from_db(): synchronize_skeletons = SynchronizeSkeletonsWithDBDialog() synchronize_skeletons.exec_() def load_graph_from_db(): dialog = GraphTableViewDialog(ApplicationManager.instance.scene) dialog.exec_() def upload_motions_to_db(): controller_list = [] node_ids = EditorWindow.instance.getSelectedSceneObjects() for node_id in node_ids: o = ApplicationManager.instance.scene.getObject(node_id) if "animation_controller" in o._components: controller_list.append(o._components["animation_controller"]) if len(controller_list) > 0: dialog = UploadMotionDialog(controller_list) dialog.exec_() if dialog.success: print("success") def login_to_server(): login_dialog = LoginDialog() login_dialog.exec_() if login_dialog.success: user = login_dialog.user password = <PASSWORD>_dialog.password EditorWindow.instance.session_manager.login(user, password) actions = [ {"text": "Login", "function": login_to_server}, {"text": "Open Motion DB Browser", "function": open_motion_db_browser}, {"text": "Open Graph Browser", "function" : load_graph_from_db}, {"text": "Upload Selected Motions", "function": upload_motions_to_db}, {"text": "Synchronize Skeleton Definitions", "function": synchronize_skeletons_from_db} ] EditorWindow.add_menu("Database", actions) def create_section_dict_from_annotation(annotations): motion_sections = dict() for label, sections in annotations.items(): motion_sections[label] = [] for sub_section in sections: sub_section.sort() section_dict = dict() section_dict["start_idx"] = sub_section[0] section_dict["end_idx"] = sub_section[-1] motion_sections[label].append(section_dict) return motion_sections def upload_motion_to_db(widget): node_id = widget._controller.scene_object.node_id if "data_base_ids" in widget._controller.scene_object.scene.internal_vars and node_id in widget._controller.scene_object.scene.internal_vars["data_base_ids"]: collection, motion_id, is_processed = widget._controller.scene_object.scene.internal_vars["data_base_ids"][node_id] bvh_name = widget._controller.scene_object.name motion_data = widget._controller.get_json_data() skeleton_model_name = str(widget.skeletonModelComboBox.currentText()) print("replace motion clip with id",motion_id, "and name", bvh_name, collection,is_processed) meta_info = dict() if len(widget._controller._motion._semantic_annotation) >0: meta_info["sections"] = create_section_dict_from_annotation(widget._controller._motion._semantic_annotation) if is_processed and widget._controller._motion._time_function is not None: meta_info["time_function"] = widget._controller._motion._time_function else: is_processed = False if len(meta_info) > 0: meta_info_str = json.dumps(meta_info) else: meta_info_str = "" replace_motion_in_db(DB_URL, motion_id, bvh_name, motion_data, collection, skeleton_model_name, meta_info_str, is_processed, session=EditorWindow.instance.session) else: dialog = UploadMotionDialog([widget._controller]) dialog.exec_() if dialog.success: print("success") EditorWindow.add_widget_button("animation_player", "UpdateMotionInDB", upload_motion_to_db)
[ 1, 529, 276, 1112, 420, 29958, 29872, 21205, 29914, 29885, 8194, 29918, 1457, 19170, 29918, 10154, 13, 5215, 2897, 13, 5215, 4390, 13, 3166, 5780, 29889, 12800, 29889, 9803, 29889, 3075, 1934, 1053, 6535, 29918, 4219, 13, 3166, 5780, 29889, 3221, 29889, 15204, 29918, 7165, 1053, 14059, 5907, 13, 3166, 5780, 29889, 3221, 29889, 6214, 29918, 12847, 1053, 8427, 3260, 13, 3166, 5780, 29889, 3075, 1934, 1053, 8707, 18667, 29918, 7724, 13, 361, 2897, 29889, 2084, 29889, 275, 1445, 29898, 25903, 29918, 7724, 1125, 13, 1678, 515, 5780, 29889, 12800, 29889, 9803, 29889, 3075, 1934, 1053, 731, 29918, 3075, 1934, 29918, 3166, 29918, 1445, 13, 1678, 731, 29918, 3075, 1934, 29918, 3166, 29918, 1445, 29898, 25903, 29918, 7724, 29897, 13, 13, 3166, 5780, 29889, 12800, 29889, 9803, 29889, 23569, 1053, 7142, 291, 4051, 21537, 7647, 29892, 12367, 3562, 1043, 7647, 29892, 5020, 1359, 29924, 8194, 7647, 29892, 19130, 7647, 29892, 317, 9524, 675, 29903, 446, 1026, 787, 3047, 4051, 7647, 13, 3166, 5780, 29889, 12800, 29889, 9803, 29889, 7924, 29918, 12847, 1053, 16441, 3260, 13, 3166, 3778, 29918, 13239, 29889, 4422, 1907, 29889, 2585, 29918, 13248, 1053, 5191, 29918, 29885, 8194, 29918, 262, 29918, 2585, 13, 13, 15280, 5907, 29889, 1202, 29918, 8582, 29918, 3318, 703, 7924, 29918, 12847, 613, 16441, 3260, 29897, 13, 15280, 5907, 29889, 1202, 29918, 8582, 29918, 3318, 703, 29885, 8194, 29918, 2585, 29918, 15965, 29918, 15901, 613, 6213, 29897, 13, 13, 1753, 1722, 29918, 29885, 8194, 29918, 2585, 29918, 15965, 7295, 13, 1678, 9995, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29941, 29947, 29941, 29900, 29929, 29947, 29900, 29941, 29914, 2272, 17915, 29899, 5464, 29899, 15601, 29899, 15901, 29899, 21936, 29899, 15601, 9995, 13, 1678, 565, 14059, 5907, 29889, 8758, 29889, 29885, 8194, 29918, 2585, 29918, 15965, 29918, 15901, 338, 6213, 29901, 13, 4706, 14059, 5907, 29889, 8758, 29889, 29885, 8194, 29918, 2585, 29918, 15965, 29918, 15901, 353, 7142, 291, 4051, 21537, 7647, 29898, 4873, 3260, 29889, 8758, 29889, 24645, 29892, 3847, 29922, 15280, 5907, 29889, 8758, 29897, 13, 1678, 1683, 29901, 13, 4706, 14059, 5907, 29889, 8758, 29889, 29885, 8194, 29918, 2585, 29918, 15965, 29918, 15901, 29889, 22692, 29918, 580, 13, 4706, 14059, 5907, 29889, 8758, 29889, 29885, 8194, 29918, 2585, 29918, 15965, 29918, 15901, 29889, 11236, 403, 5907, 580, 13, 13, 1753, 12231, 675, 29918, 26050, 1026, 787, 29918, 3166, 29918, 2585, 7295, 13, 1678, 12231, 675, 29918, 26050, 1026, 787, 353, 317, 9524, 675, 29903, 446, 1026, 787, 3047, 4051, 7647, 580, 13, 1678, 12231, 675, 29918, 26050, 1026, 787, 29889, 4258, 29918, 580, 13, 13, 1753, 2254, 29918, 4262, 29918, 3166, 29918, 2585, 7295, 13, 1678, 7928, 353, 12367, 3562, 1043, 7647, 29898, 4873, 3260, 29889, 8758, 29889, 24645, 29897, 13, 1678, 7928, 29889, 4258, 29918, 580, 13, 268, 13, 1753, 6441, 29918, 14817, 1080, 29918, 517, 29918, 2585, 7295, 13, 1678, 4701, 29918, 1761, 353, 5159, 13, 1678, 2943, 29918, 4841, 353, 14059, 5907, 29889, 8758, 29889, 657, 8592, 23472, 12724, 580, 13, 1678, 363, 2943, 29918, 333, 297, 2943, 29918, 4841, 29901, 13, 4706, 288, 353, 8427, 3260, 29889, 8758, 29889, 24645, 29889, 657, 2061, 29898, 3177, 29918, 333, 29897, 13, 4706, 565, 376, 18962, 29918, 8299, 29908, 297, 288, 3032, 14036, 29901, 13, 9651, 4701, 29918, 1761, 29889, 4397, 29898, 29877, 3032, 14036, 3366, 18962, 29918, 8299, 20068, 13, 1678, 565, 7431, 29898, 8299, 29918, 1761, 29897, 1405, 29871, 29900, 29901, 13, 4706, 7928, 353, 5020, 1359, 29924, 8194, 7647, 29898, 8299, 29918, 1761, 29897, 13, 4706, 7928, 29889, 4258, 29918, 580, 13, 4706, 565, 7928, 29889, 8698, 29901, 13, 9651, 1596, 703, 8698, 1159, 13, 13, 1753, 6464, 29918, 517, 29918, 2974, 7295, 13, 1678, 6464, 29918, 15901, 353, 19130, 7647, 580, 13, 1678, 6464, 29918, 15901, 29889, 4258, 29918, 580, 13, 1678, 565, 6464, 29918, 15901, 29889, 8698, 29901, 13, 4706, 1404, 353, 6464, 29918, 15901, 29889, 1792, 13, 4706, 4800, 353, 529, 25711, 17013, 29958, 29918, 15901, 29889, 5630, 13, 4706, 14059, 5907, 29889, 8758, 29889, 7924, 29918, 12847, 29889, 7507, 29898, 1792, 29892, 4800, 29897, 13, 13, 13, 7387, 353, 518, 8853, 726, 1115, 376, 11049, 613, 29871, 376, 2220, 1115, 6464, 29918, 517, 29918, 2974, 1118, 13, 9651, 8853, 726, 1115, 376, 6585, 7142, 291, 6535, 27088, 613, 376, 2220, 1115, 1722, 29918, 29885, 8194, 29918, 2585, 29918, 15965, 1118, 13, 9651, 8853, 726, 1115, 376, 6585, 12367, 27088, 613, 376, 2220, 29908, 584, 2254, 29918, 4262, 29918, 3166, 29918, 2585, 1118, 13, 9651, 8853, 726, 1115, 376, 17553, 22012, 7142, 1080, 613, 376, 2220, 1115, 6441, 29918, 14817, 1080, 29918, 517, 29918, 2585, 1118, 13, 9651, 8853, 726, 1115, 376, 29903, 9524, 675, 317, 446, 11285, 897, 4951, 2187, 613, 376, 2220, 1115, 12231, 675, 29918, 26050, 1026, 787, 29918, 3166, 29918, 2585, 29913, 13, 4706, 4514, 13, 15280, 5907, 29889, 1202, 29918, 6510, 703, 9112, 613, 8820, 29897, 13, 29871, 13, 1753, 1653, 29918, 2042, 29918, 8977, 29918, 3166, 29918, 18317, 29898, 6735, 800, 1125, 13, 1678, 10884, 29918, 27117, 353, 9657, 580, 13, 1678, 363, 3858, 29892, 13926, 297, 25495, 29889, 7076, 7295, 13, 4706, 10884, 29918, 27117, 29961, 1643, 29962, 353, 5159, 13, 4706, 363, 1014, 29918, 2042, 297, 13926, 29901, 13, 9651, 1014, 29918, 2042, 29889, 6605, 580, 13, 9651, 4004, 29918, 8977, 353, 9657, 580, 13, 9651, 4004, 29918, 8977, 3366, 2962, 29918, 13140, 3108, 353, 1014, 29918, 2042, 29961, 29900, 29962, 13, 9651, 4004, 29918, 8977, 3366, 355, 29918, 13140, 3108, 353, 1014, 29918, 2042, 14352, 29896, 29962, 13, 9651, 10884, 29918, 27117, 29961, 1643, 1822, 4397, 29898, 2042, 29918, 8977, 29897, 13, 1678, 736, 10884, 29918, 27117, 13, 13, 1753, 6441, 29918, 29885, 8194, 29918, 517, 29918, 2585, 29898, 8030, 1125, 13, 1678, 2943, 29918, 333, 353, 11109, 3032, 8299, 29889, 24645, 29918, 3318, 29889, 3177, 29918, 333, 13, 1678, 565, 376, 1272, 29918, 3188, 29918, 4841, 29908, 297, 11109, 3032, 8299, 29889, 24645, 29918, 3318, 29889, 24645, 29889, 7564, 29918, 16908, 322, 2943, 29918, 333, 297, 11109, 3032, 8299, 29889, 24645, 29918, 3318, 29889, 24645, 29889, 7564, 29918, 16908, 3366, 1272, 29918, 3188, 29918, 4841, 3108, 29901, 13, 4706, 4333, 29892, 10884, 29918, 333, 29892, 338, 29918, 5014, 287, 353, 11109, 3032, 8299, 29889, 24645, 29918, 3318, 29889, 24645, 29889, 7564, 29918, 16908, 3366, 1272, 29918, 3188, 29918, 4841, 3108, 29961, 3177, 29918, 333, 29962, 13, 4706, 289, 29894, 29882, 29918, 978, 353, 11109, 3032, 8299, 29889, 24645, 29918, 3318, 29889, 978, 13, 4706, 10884, 29918, 1272, 353, 11109, 3032, 8299, 29889, 657, 29918, 3126, 29918, 1272, 580, 13, 4706, 18109, 11285, 29918, 4299, 29918, 978, 353, 851, 29898, 8030, 29889, 26050, 11285, 3195, 26628, 29889, 3784, 1626, 3101, 13, 4706, 1596, 703, 6506, 10884, 20102, 411, 1178, 613, 29885, 8194, 29918, 333, 29892, 376, 392, 1024, 613, 289, 29894, 29882, 29918, 978, 29892, 4333, 29892, 275, 29918, 5014, 287, 29897, 13, 4706, 12700, 29918, 3888, 353, 9657, 580, 13, 4706, 565, 7431, 29898, 8030, 3032, 8299, 3032, 29885, 8194, 3032, 12846, 7716, 29918, 18317, 29897, 1405, 29900, 29901, 13, 9651, 12700, 29918, 3888, 3366, 27117, 3108, 353, 1653, 29918, 2042, 29918, 8977, 29918, 3166, 29918, 18317, 29898, 8030, 3032, 8299, 3032, 29885, 8194, 3032, 12846, 7716, 29918, 18317, 29897, 13, 4706, 565, 338, 29918, 5014, 287, 322, 11109, 3032, 8299, 3032, 29885, 8194, 3032, 2230, 29918, 2220, 338, 451, 6213, 29901, 13, 9651, 12700, 29918, 3888, 3366, 2230, 29918, 2220, 3108, 353, 11109, 3032, 8299, 3032, 29885, 8194, 3032, 2230, 29918, 2220, 13, 4706, 1683, 29901, 13, 9651, 338, 29918, 5014, 287, 353, 7700, 13, 4706, 565, 7431, 29898, 7299, 29918, 3888, 29897, 1405, 29871, 29900, 29901, 13, 9651, 12700, 29918, 3888, 29918, 710, 353, 4390, 29889, 29881, 17204, 29898, 7299, 29918, 3888, 29897, 13, 4706, 1683, 29901, 13, 9651, 12700, 29918, 3888, 29918, 710, 353, 5124, 13, 4706, 5191, 29918, 29885, 8194, 29918, 262, 29918, 2585, 29898, 4051, 29918, 4219, 29892, 10884, 29918, 333, 29892, 289, 29894, 29882, 29918, 978, 29892, 10884, 29918, 1272, 29892, 4333, 29892, 18109, 11285, 29918, 4299, 29918, 978, 29892, 12700, 29918, 3888, 29918, 710, 29892, 338, 29918, 5014, 287, 29892, 4867, 29922, 15280, 5907, 29889, 8758, 29889, 7924, 29897, 13, 13, 1678, 1683, 29901, 13, 4706, 7928, 353, 5020, 1359, 29924, 8194, 7647, 4197, 8030, 3032, 8299, 2314, 13, 4706, 7928, 29889, 4258, 29918, 580, 13, 4706, 565, 7928, 29889, 8698, 29901, 13, 9651, 1596, 703, 8698, 1159, 13, 13, 15280, 5907, 29889, 1202, 29918, 8030, 29918, 3092, 703, 18962, 29918, 9106, 613, 376, 6422, 29924, 8194, 797, 4051, 613, 6441, 29918, 29885, 8194, 29918, 517, 29918, 2585, 29897, 13, 2 ]
src/Record.py
Progitiel/Slideways
0
163248
<reponame>Progitiel/Slideways<filename>src/Record.py import numpy as np import time import os from Config import * class Record(): def __init__(self, app): """Initialise les données d'un enregistrement""" self.app = app self.recording = False self.allBoards = None self.currentBoards = self.__initData() self.fileName = time.strftime("%d-%m-%Y %Hh%Mm%Ss", time.localtime()) def __initData(self): """Plateau initial""" ml = [-1 for x in range(BOARD_SIZE-1)] ca = [0 for l in range(BOARD_SIZE)] mr = [-1 for x in range(BOARD_SIZE-1)] return np.array([[ml + ca + mr for l in range(BOARD_SIZE)]], dtype=int) def startRecord(self): """Démarre l'enregistrement""" self.recording = True def isRecording(self): """Enregistre ?""" return self.recording def newGame(self): """Initialise une nouvelle partie""" if self.allBoards is None: self.allBoards = [np.array(self.currentBoards, dtype=int)] else: self.allBoards.append(self.currentBoards) self.currentBoards = self.__initData() def addBoard(self, newData): """Ajoute un plateau""" self.currentBoards = np.append(self.currentBoards, [newData], axis=0) if self.recording: self.__save() def getCurrentBoard(self): """Donne tout les plateaux de la partie en cours""" return self.currentBoards def close(self): """Arrête l'enregistrement""" self.newGame() self.__save() def __save(self): """Enregistre les données""" playerMode = self.app.playerMode playerNames = self.app.getPlayerName() path = os.getcwd() + '\\Replay' fullPath = path + "\\" + self.fileName if not os.path.isdir(path): try: os.mkdir(path) except Exception as e: pass if os.path.exists(fullPath + '.slideways'): try: os.remove(fullPath + '.slideways') except Exception as e: pass np.save(fullPath, [playerMode, playerNames, self.allBoards]) os.rename(fullPath + ".npy", "Replay\\" + self.fileName + '.slideways')
[ 1, 529, 276, 1112, 420, 29958, 1184, 5559, 709, 29914, 29903, 7459, 1994, 29966, 9507, 29958, 4351, 29914, 9182, 29889, 2272, 13, 5215, 12655, 408, 7442, 13, 5215, 931, 13, 5215, 2897, 13, 13, 3166, 12782, 1053, 334, 13, 13, 1990, 14164, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 623, 1125, 13, 4706, 9995, 15514, 895, 966, 21880, 270, 29915, 348, 427, 1727, 22715, 358, 15945, 29908, 13, 13, 4706, 1583, 29889, 932, 353, 623, 13, 4706, 1583, 29889, 3757, 3278, 353, 7700, 13, 4706, 1583, 29889, 497, 8431, 3163, 353, 6213, 13, 4706, 1583, 29889, 3784, 8431, 3163, 353, 1583, 17255, 2344, 1469, 580, 13, 4706, 1583, 29889, 28926, 353, 931, 29889, 710, 615, 603, 11702, 29881, 19222, 29885, 19222, 29979, 1273, 29950, 29882, 29995, 29924, 29885, 29995, 29903, 29879, 613, 931, 29889, 2997, 2230, 3101, 13, 13, 1678, 822, 4770, 2344, 1469, 29898, 1311, 1125, 13, 4706, 9995, 3247, 403, 585, 2847, 15945, 29908, 13, 13, 4706, 286, 29880, 353, 21069, 29896, 363, 921, 297, 3464, 29898, 8456, 17011, 29918, 14226, 29899, 29896, 4638, 13, 4706, 5777, 353, 518, 29900, 363, 301, 297, 3464, 29898, 8456, 17011, 29918, 14226, 4638, 13, 4706, 286, 29878, 353, 21069, 29896, 363, 921, 297, 3464, 29898, 8456, 17011, 29918, 14226, 29899, 29896, 4638, 13, 13, 4706, 736, 7442, 29889, 2378, 4197, 29961, 828, 718, 5777, 718, 286, 29878, 363, 301, 297, 3464, 29898, 8456, 17011, 29918, 14226, 4638, 1402, 26688, 29922, 524, 29897, 13, 13, 1678, 822, 1369, 9182, 29898, 1311, 1125, 13, 4706, 9995, 29928, 2249, 279, 276, 301, 29915, 264, 1727, 22715, 358, 15945, 29908, 13, 13, 4706, 1583, 29889, 3757, 3278, 353, 5852, 13, 13, 1678, 822, 338, 4789, 3278, 29898, 1311, 1125, 13, 4706, 9995, 2369, 1727, 22715, 1577, 15945, 29908, 13, 13, 4706, 736, 1583, 29889, 3757, 3278, 13, 13, 1678, 822, 716, 14199, 29898, 1311, 1125, 13, 4706, 9995, 15514, 895, 1597, 15217, 8691, 15945, 29908, 13, 13, 4706, 565, 1583, 29889, 497, 8431, 3163, 338, 6213, 29901, 13, 9651, 1583, 29889, 497, 8431, 3163, 353, 518, 9302, 29889, 2378, 29898, 1311, 29889, 3784, 8431, 3163, 29892, 26688, 29922, 524, 4638, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 497, 8431, 3163, 29889, 4397, 29898, 1311, 29889, 3784, 8431, 3163, 29897, 13, 13, 4706, 1583, 29889, 3784, 8431, 3163, 353, 1583, 17255, 2344, 1469, 580, 13, 13, 1678, 822, 788, 28397, 29898, 1311, 29892, 716, 1469, 1125, 13, 4706, 9995, 29909, 29926, 2663, 443, 15284, 585, 15945, 29908, 13, 13, 4706, 1583, 29889, 3784, 8431, 3163, 353, 7442, 29889, 4397, 29898, 1311, 29889, 3784, 8431, 3163, 29892, 518, 1482, 1469, 1402, 9685, 29922, 29900, 29897, 13, 4706, 565, 1583, 29889, 3757, 3278, 29901, 13, 9651, 1583, 17255, 7620, 580, 13, 13, 1678, 822, 679, 7583, 28397, 29898, 1311, 1125, 13, 4706, 9995, 29928, 7293, 5646, 966, 15284, 2993, 316, 425, 8691, 427, 9587, 15945, 29908, 13, 13, 4706, 736, 1583, 29889, 3784, 8431, 3163, 13, 13, 1678, 822, 3802, 29898, 1311, 1125, 13, 4706, 9995, 16401, 9061, 301, 29915, 264, 1727, 22715, 358, 15945, 29908, 13, 13, 4706, 1583, 29889, 1482, 14199, 580, 13, 4706, 1583, 17255, 7620, 580, 13, 13, 1678, 822, 4770, 7620, 29898, 1311, 1125, 13, 4706, 9995, 2369, 1727, 22715, 966, 21880, 15945, 29908, 13, 308, 13, 4706, 4847, 6818, 353, 1583, 29889, 932, 29889, 9106, 6818, 13, 4706, 4847, 8659, 353, 1583, 29889, 932, 29889, 657, 9075, 1170, 580, 13, 4706, 2224, 353, 2897, 29889, 657, 29883, 9970, 580, 718, 525, 1966, 1123, 1456, 29915, 13, 4706, 2989, 2605, 353, 2224, 718, 376, 1966, 29908, 718, 1583, 29889, 28926, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 2084, 1125, 13, 9651, 1018, 29901, 13, 18884, 2897, 29889, 11256, 3972, 29898, 2084, 29897, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1209, 13, 13, 4706, 565, 2897, 29889, 2084, 29889, 9933, 29898, 8159, 2605, 718, 15300, 19265, 1994, 29374, 13, 9651, 1018, 29901, 13, 18884, 2897, 29889, 5992, 29898, 8159, 2605, 718, 15300, 19265, 1994, 1495, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1209, 13, 13, 4706, 7442, 29889, 7620, 29898, 8159, 2605, 29892, 518, 9106, 6818, 29892, 4847, 8659, 29892, 1583, 29889, 497, 8431, 3163, 2314, 13, 4706, 2897, 29889, 1267, 420, 29898, 8159, 2605, 718, 11393, 29876, 2272, 613, 376, 1123, 1456, 1966, 29908, 718, 1583, 29889, 28926, 718, 15300, 19265, 1994, 1495, 13, 2 ]
scripts/view/view_image.py
fdesjardins/surface-estimation-and-image-relighting
9
93599
<gh_stars>1-10 import os import sys import numpy as np from OpenGL.arrays import vbo from OpenGL.arrays import ArrayDatatype as ADT from OpenGL.GL.ARB.vertex_buffer_object import * from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * from scipy.spatial import Delaunay from Image import open def initFunc(): initGL() def initData(): global rP #load texture im = open(sys.argv[1]) try: ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBA", 0, -1) except SystemError: ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBX", 0, -1) rP.texID = glGenTextures(1) glBindTexture(GL_TEXTURE_2D, rP.texID) glPixelStorei(GL_UNPACK_ALIGNMENT,1) glTexImage2D( GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image ) texl,text,texr,texb = 0.0,1.0,1.0,0.0 left,top,right,bottom = -1.0,1.0,1.0,-1.0 vtxs = np.array([ (left,top,0.0), (right,top,0.0), (right,bottom,0.0), (left,bottom,0.0) ],'f') triang = Delaunay(vtxs[:,0:2]) interleaved = np.array([ texl,text, left,top,0.0, texr,text, right,top,0.0, texr,texb, right,bottom,0.0, texl,text, left,top,0.0, texr,texb, right,bottom,0.0, texl,texb, left,bottom,0.0, ],'f') print interleaved norms = np.array([(0.0,0.0,1.0) for _ in vtxs], dtype=np.float32) rP.points = vbo.VBO(interleaved) rP.indices = np.array(triang.vertices, dtype=np.ubyte).flatten() #print len(vtxs),len(rP.indices) rP.normals = vbo.VBO(norms) rP.cnt = len(vtxs) zero = (0,0,0,0) one = (1,1,1,1) lpos = (0,0,1,0) def initGL(): glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0) glColor3f(1.0, 1.0, 1.0) glPointSize(1.0) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LESS) glShadeModel(GL_SMOOTH) glEnable(GL_NORMALIZE) glEnable(GL_COLOR_MATERIAL) glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glLightfv(GL_LIGHT0, GL_AMBIENT, zero) glLightfv(GL_LIGHT0, GL_DIFFUSE, one) glLightfv(GL_LIGHT0, GL_SPECULAR, one) glLightfv(GL_LIGHT0, GL_POSITION, lpos) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0, 1.0, .1, 100.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() gluLookAt(0.0,0.0,1.0, 0.0,0.0,0.0, 0.0,0.0,1.0) def displayFunc1(): global rP glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() #glTranslatef(0.0, 0.0, -3.0) glPushMatrix() #glRotatef(rP.rVec[0], 1,0,0) #glRotatef(rP.rVec[1], 0,1,0) #glRotatef(rP.rVec[2], 0,0,1) #glTranslatef(rP.tVec[0], rP.tVec[1], rP.tVec[2]) #glScalef(rP.sVec[0], rP.sVec[1], rP.sVec[2]) glTranslatef(rP.tVec[0], rP.tVec[1], rP.tVec[2]) glRotatef(rP.rVec[0], 1,0,0) glRotatef(rP.rVec[1], 0,1,0) glRotatef(rP.rVec[2], 0,0,1) try: glEnable(GL_TEXTURE_2D) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL) glBindTexture(GL_TEXTURE_2D, rP.texID) rP.points.bind() try: glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_TEXTURE_COORD_ARRAY_EXT) glEnableClientState(GL_TEXTURE_COORD_ARRAY) glTexCoordPointer(2, GL_FLOAT, 20, rP.points) glVertexPointer(3, GL_FLOAT, 20, rP.points+8) #glVertexPointerf(rP.points) glDrawArrays(GL_TRIANGLES, 0, rP.cnt*2) finally: glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_TEXTURE_COORD_ARRAY) glDisableClientState(GL_TEXTURE_COORD_ARRAY_EXT) finally: #rP.normals.unbind() rP.points.unbind() glDisable(GL_TEXTURE_2D) glPopMatrix() glutSwapBuffers() def displayFunc2(): global rP glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() #glTranslatef(0.0, 0.0, -3.0) glPushMatrix() #glRotatef(rP.rVec[0], 1,0,0) #glRotatef(rP.rVec[1], 0,1,0) #glRotatef(rP.rVec[2], 0,0,1) #glTranslatef(rP.tVec[0], rP.tVec[1], rP.tVec[2]) #glScalef(rP.sVec[0], rP.sVec[1], rP.sVec[2]) glTranslatef(rP.tVec[0], rP.tVec[1], rP.tVec[2]) glRotatef(rP.rVec[0], 1,0,0) glRotatef(rP.rVec[1], 0,1,0) glRotatef(rP.rVec[2], 0,0,1) try: #glEnable(GL_TEXTURE_2D) #glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) #glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) #glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL) #glBindTexture(GL_TEXTURE_2D, rP.texID) rP.points.bind() try: glEnableClientState(GL_VERTEX_ARRAY) #glEnableClientState(GL_TEXTURE_COORD_ARRAY_EXT) #glEnableClientState(GL_TEXTURE_COORD_ARRAY) #glTexCoordPointer(2, GL_FLOAT, 20, rP.points) glVertexPointer(3, GL_FLOAT, 20, rP.points+8) #glVertexPointerf(rP.points) glDrawArrays(GL_TRIANGLES, 0, rP.cnt) finally: glDisableClientState(GL_VERTEX_ARRAY) #glDisableClientState(GL_TEXTURE_COORD_ARRAY) #glDisableClientState(GL_TEXTURE_COORD_ARRAY_EXT) finally: #rP.normals.unbind() rP.points.unbind() #glDisable(GL_TEXTURE_2D) glPopMatrix() glutSwapBuffers() class renderParam(object): def __init__(self): self.mouseButton = None self.tVec = [0, 0, 0] self.rVec = [0, 0, 0] self.sVec = [1, 1, 1] self.points = None self.indices = None self.cnt = 0 def reset(self): self.mouseButton = None self.tVec = [0, 0, 0] self.rVec = [0, 0, 0] self.sVec = [1, 1, 1] self.points = None self.indices = None self.cnt = 0 rP = renderParam() oldMousePos = [0, 0] def mouseButton(button, mode, x, y): global rP, oldMousePos if mode == GLUT_DOWN: rP.mouseButton = button else: rP.mouseButton = None oldMousePos[0], oldMousePos[1] = x, y glutPostRedisplay( ) def mouseMotion(x, y): global rP, oldMousePos deltaX = x - oldMousePos[ 0 ] deltaY = y - oldMousePos[ 1 ] if rP.mouseButton == GLUT_LEFT_BUTTON: factor = 0.005 rP.tVec[0] += deltaX * factor rP.tVec[1] -= deltaY * factor oldMousePos[0], oldMousePos[1] = x, y if rP.mouseButton == GLUT_RIGHT_BUTTON: factor = 0.1 rP.rVec[0] += deltaY * factor rP.rVec[1] += deltaX * factor oldMousePos[0], oldMousePos[1] = x, y if rP.mouseButton == GLUT_MIDDLE_BUTTON: factor = 0.01 rP.tVec[2] += deltaY * factor oldMousePos[0], oldMousePos[1] = x, y glutPostRedisplay( ) def registerCallbacks(): glutMouseFunc(mouseButton) glutMotionFunc(mouseMotion) def main(): glutInit() glutInitWindowSize(400,400) glutInitDisplayMode(GLUT_DOUBLE| GLUT_RGBA | GLUT_DEPTH) glutCreateWindow("Scatter1") initFunc() initData() glutDisplayFunc(displayFunc1) registerCallbacks() #glutCreateWindow("Scatter2") #initFunc() #glutDisplayFunc(displayFunc2) #registerCallbacks() glutMainLoop() if __name__ == '__main__': main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 12655, 408, 7442, 13, 3166, 29508, 29889, 2378, 29879, 1053, 325, 833, 13, 3166, 29508, 29889, 2378, 29879, 1053, 4398, 16390, 23179, 408, 11033, 29911, 13, 3166, 29508, 29889, 7239, 29889, 1718, 29933, 29889, 369, 4776, 29918, 9040, 29918, 3318, 1053, 334, 13, 3166, 29508, 29889, 7239, 1053, 334, 13, 3166, 29508, 29889, 7239, 2692, 1053, 334, 13, 3166, 29508, 29889, 7239, 29965, 1053, 334, 13, 3166, 4560, 2272, 29889, 1028, 15238, 1053, 360, 3100, 348, 388, 13, 3166, 7084, 1053, 1722, 13, 29871, 13, 1753, 2069, 14400, 7295, 13, 259, 2069, 7239, 580, 13, 13, 1753, 2069, 1469, 7295, 13, 1678, 5534, 364, 29925, 13, 268, 13, 1678, 396, 1359, 18459, 13, 1678, 527, 353, 1722, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 13, 1678, 1018, 29901, 13, 4706, 474, 29916, 29892, 474, 29891, 29892, 1967, 353, 527, 29889, 2311, 29961, 29900, 1402, 527, 29889, 2311, 29961, 29896, 1402, 527, 29889, 517, 1807, 703, 1610, 613, 376, 29934, 29954, 5688, 613, 29871, 29900, 29892, 448, 29896, 29897, 13, 1678, 5174, 2184, 2392, 29901, 13, 4706, 474, 29916, 29892, 474, 29891, 29892, 1967, 353, 527, 29889, 2311, 29961, 29900, 1402, 527, 29889, 2311, 29961, 29896, 1402, 527, 29889, 517, 1807, 703, 1610, 613, 376, 28212, 29990, 613, 29871, 29900, 29892, 448, 29896, 29897, 13, 268, 13, 1678, 364, 29925, 29889, 4776, 1367, 353, 3144, 15462, 1626, 1973, 29898, 29896, 29897, 13, 1678, 3144, 15708, 21898, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 364, 29925, 29889, 4776, 1367, 29897, 13, 1678, 3144, 29637, 9044, 29875, 29898, 7239, 29918, 3904, 29925, 11375, 29918, 1964, 17298, 13780, 29892, 29896, 29897, 13, 1678, 3144, 26887, 2940, 29906, 29928, 29898, 13, 4706, 12729, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 29871, 29900, 29892, 29871, 29941, 29892, 474, 29916, 29892, 474, 29891, 29892, 29871, 29900, 29892, 13, 4706, 12729, 29918, 29934, 29954, 5688, 29892, 12729, 29918, 29965, 3059, 17298, 3352, 29918, 22716, 4330, 29892, 1967, 13, 1678, 1723, 13, 13, 1678, 734, 15524, 29892, 726, 29892, 4776, 29878, 29892, 4776, 29890, 353, 29871, 29900, 29889, 29900, 29892, 29896, 29889, 29900, 29892, 29896, 29889, 29900, 29892, 29900, 29889, 29900, 13, 1678, 2175, 29892, 3332, 29892, 1266, 29892, 8968, 353, 448, 29896, 29889, 29900, 29892, 29896, 29889, 29900, 29892, 29896, 29889, 29900, 6653, 29896, 29889, 29900, 13, 268, 13, 1678, 325, 7508, 29879, 353, 7442, 29889, 2378, 4197, 13, 4706, 313, 1563, 29892, 3332, 29892, 29900, 29889, 29900, 511, 13, 4706, 313, 1266, 29892, 3332, 29892, 29900, 29889, 29900, 511, 13, 4706, 313, 1266, 29892, 8968, 29892, 29900, 29889, 29900, 511, 13, 4706, 313, 1563, 29892, 8968, 29892, 29900, 29889, 29900, 29897, 13, 1678, 21251, 29915, 29888, 1495, 13, 1678, 3367, 574, 353, 360, 3100, 348, 388, 29898, 29894, 7508, 29879, 7503, 29892, 29900, 29901, 29906, 2314, 13, 268, 13, 1678, 1006, 280, 10511, 353, 7442, 29889, 2378, 4197, 13, 4706, 734, 15524, 29892, 726, 29892, 2175, 29892, 3332, 29892, 29900, 29889, 29900, 29892, 13, 4706, 19696, 29878, 29892, 726, 29892, 1492, 29892, 3332, 29892, 29900, 29889, 29900, 29892, 13, 4706, 19696, 29878, 29892, 4776, 29890, 29892, 1492, 29892, 8968, 29892, 29900, 29889, 29900, 29892, 13, 4706, 734, 15524, 29892, 726, 29892, 2175, 29892, 3332, 29892, 29900, 29889, 29900, 29892, 13, 4706, 19696, 29878, 29892, 4776, 29890, 29892, 1492, 29892, 8968, 29892, 29900, 29889, 29900, 29892, 13, 4706, 734, 15524, 29892, 4776, 29890, 29892, 2175, 29892, 8968, 29892, 29900, 29889, 29900, 29892, 13, 1678, 21251, 29915, 29888, 1495, 13, 268, 13, 1678, 1596, 1006, 280, 10511, 13, 268, 13, 1678, 6056, 29879, 353, 7442, 29889, 2378, 4197, 29898, 29900, 29889, 29900, 29892, 29900, 29889, 29900, 29892, 29896, 29889, 29900, 29897, 363, 903, 297, 325, 7508, 29879, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 364, 29925, 29889, 9748, 353, 325, 833, 29889, 29963, 8456, 29898, 1639, 280, 10511, 29897, 13, 1678, 364, 29925, 29889, 513, 1575, 353, 7442, 29889, 2378, 29898, 3626, 574, 29889, 1765, 1575, 29892, 26688, 29922, 9302, 29889, 4471, 371, 467, 1579, 8606, 580, 13, 1678, 396, 2158, 7431, 29898, 29894, 7508, 29879, 511, 2435, 29898, 29878, 29925, 29889, 513, 1575, 29897, 13, 268, 13, 1678, 364, 29925, 29889, 12324, 1338, 353, 325, 833, 29889, 29963, 8456, 29898, 12324, 29879, 29897, 13, 1678, 364, 29925, 29889, 20047, 353, 7431, 29898, 29894, 7508, 29879, 29897, 13, 13, 9171, 353, 313, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29897, 13, 650, 353, 313, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29897, 13, 29880, 1066, 353, 313, 29900, 29892, 29900, 29892, 29896, 29892, 29900, 29897, 13, 1753, 2069, 7239, 7295, 13, 1678, 3144, 18759, 3306, 29898, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29897, 13, 1678, 3144, 18759, 8498, 386, 29898, 29896, 29889, 29900, 29897, 259, 13, 1678, 3144, 3306, 29941, 29888, 29898, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29897, 13, 1678, 3144, 5228, 3505, 29898, 29896, 29889, 29900, 29897, 13, 268, 13, 1678, 3144, 20701, 29898, 7239, 29918, 2287, 29925, 4690, 29918, 18267, 29897, 13, 1678, 3144, 8498, 386, 14400, 29898, 7239, 29918, 1307, 1799, 29897, 13, 1678, 3144, 2713, 1943, 3195, 29898, 7239, 29918, 29903, 6720, 2891, 29950, 29897, 13, 1678, 3144, 20701, 29898, 7239, 29918, 29940, 1955, 1529, 5265, 10721, 29897, 13, 1678, 3144, 20701, 29898, 7239, 29918, 15032, 1955, 29918, 29924, 1299, 1001, 25758, 29897, 13, 1678, 3144, 3306, 24095, 29898, 7239, 29918, 15860, 1164, 29911, 29918, 9468, 29918, 29933, 11375, 29892, 12729, 29918, 5194, 12809, 3919, 29918, 9468, 29918, 4571, 4198, 17171, 29897, 13, 268, 13, 1678, 3144, 20701, 29898, 7239, 29918, 5265, 29954, 3912, 4214, 29897, 13, 1678, 3144, 20701, 29898, 7239, 29918, 5265, 29954, 3912, 29900, 29897, 13, 1678, 3144, 20769, 29888, 29894, 29898, 7239, 29918, 5265, 29954, 3912, 29900, 29892, 12729, 29918, 5194, 12809, 3919, 29892, 5225, 29897, 13, 1678, 3144, 20769, 29888, 29894, 29898, 7239, 29918, 5265, 29954, 3912, 29900, 29892, 12729, 29918, 4571, 4198, 17171, 29892, 697, 29897, 13, 1678, 3144, 20769, 29888, 29894, 29898, 7239, 29918, 5265, 29954, 3912, 29900, 29892, 12729, 29918, 29903, 4162, 29907, 13309, 1718, 29892, 697, 29897, 13, 1678, 3144, 20769, 29888, 29894, 29898, 7239, 29918, 5265, 29954, 3912, 29900, 29892, 12729, 29918, 24815, 22122, 29892, 301, 1066, 29897, 13, 268, 13, 1678, 3144, 14609, 6818, 29898, 7239, 29918, 8618, 29967, 29923, 9838, 29897, 13, 1678, 3144, 5896, 18415, 580, 13, 1678, 3144, 29884, 15136, 12645, 29898, 29946, 29945, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29892, 869, 29896, 29892, 29871, 29896, 29900, 29900, 29889, 29900, 29897, 13, 1678, 3144, 14609, 6818, 29898, 7239, 29918, 20387, 29931, 29963, 8673, 29956, 29897, 13, 1678, 3144, 5896, 18415, 580, 13, 1678, 3144, 29884, 14959, 4178, 29898, 29900, 29889, 29900, 29892, 29900, 29889, 29900, 29892, 29896, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29900, 29889, 29900, 29892, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29900, 29889, 29900, 29892, 29896, 29889, 29900, 29897, 13, 13, 1753, 2479, 14400, 29896, 7295, 13, 1678, 5534, 364, 29925, 13, 1678, 3144, 18759, 29898, 7239, 29918, 15032, 1955, 29918, 7838, 28483, 29918, 22698, 891, 12729, 29918, 2287, 29925, 4690, 29918, 7838, 28483, 29918, 22698, 29897, 13, 1678, 3144, 5896, 18415, 580, 13, 13, 1678, 396, 3820, 4300, 9632, 29888, 29898, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 448, 29941, 29889, 29900, 29897, 13, 13, 1678, 3144, 27031, 14609, 580, 13, 268, 13, 1678, 396, 3820, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29900, 1402, 29871, 29896, 29892, 29900, 29892, 29900, 29897, 13, 1678, 396, 3820, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29896, 1402, 29871, 29900, 29892, 29896, 29892, 29900, 29897, 13, 1678, 396, 3820, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29906, 1402, 29871, 29900, 29892, 29900, 29892, 29896, 29897, 13, 1678, 396, 3820, 4300, 9632, 29888, 29898, 29878, 29925, 29889, 29873, 25987, 29961, 29900, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29896, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29906, 2314, 268, 13, 1678, 396, 3820, 17185, 29888, 29898, 29878, 29925, 29889, 29879, 25987, 29961, 29900, 1402, 364, 29925, 29889, 29879, 25987, 29961, 29896, 1402, 364, 29925, 29889, 29879, 25987, 29961, 29906, 2314, 13, 268, 13, 1678, 3144, 4300, 9632, 29888, 29898, 29878, 29925, 29889, 29873, 25987, 29961, 29900, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29896, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29906, 2314, 259, 13, 1678, 3144, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29900, 1402, 29871, 29896, 29892, 29900, 29892, 29900, 29897, 13, 1678, 3144, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29896, 1402, 29871, 29900, 29892, 29896, 29892, 29900, 29897, 13, 1678, 3144, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29906, 1402, 29871, 29900, 29892, 29900, 29892, 29896, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 3144, 20701, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29897, 13, 4706, 3144, 26887, 9329, 29875, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 12729, 29918, 16975, 11499, 29918, 1529, 29954, 29918, 3738, 29931, 4945, 29892, 12729, 29918, 8186, 29909, 1525, 1254, 29897, 13, 4706, 3144, 26887, 9329, 29875, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 12729, 29918, 16975, 11499, 29918, 16173, 29918, 3738, 29931, 4945, 29892, 12729, 29918, 8186, 29909, 1525, 1254, 29897, 13, 4706, 3144, 26887, 21745, 29888, 29898, 7239, 29918, 16975, 11499, 29918, 25838, 29892, 12729, 29918, 16975, 11499, 29918, 25838, 29918, 20387, 29892, 12729, 29918, 2287, 29907, 1964, 29897, 13, 4706, 3144, 15708, 21898, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 364, 29925, 29889, 4776, 1367, 29897, 13, 308, 13, 4706, 364, 29925, 29889, 9748, 29889, 5355, 580, 13, 4706, 1018, 29901, 13, 9651, 3144, 20701, 4032, 2792, 29898, 7239, 29918, 5348, 4330, 29990, 29918, 1718, 22800, 29897, 13, 9651, 3144, 20701, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29918, 12194, 29897, 13, 9651, 3144, 20701, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29897, 13, 9651, 3144, 26887, 7967, 536, 14516, 29898, 29906, 29892, 12729, 29918, 29943, 3927, 1299, 29892, 29871, 29906, 29900, 29892, 364, 29925, 29889, 9748, 29897, 13, 9651, 3144, 22479, 14516, 29898, 29941, 29892, 12729, 29918, 29943, 3927, 1299, 29892, 29871, 29906, 29900, 29892, 364, 29925, 29889, 9748, 29974, 29947, 29897, 13, 9651, 396, 3820, 22479, 14516, 29888, 29898, 29878, 29925, 29889, 9748, 29897, 13, 9651, 3144, 8537, 2588, 29879, 29898, 7239, 29918, 29911, 3960, 19453, 17101, 29892, 29871, 29900, 29892, 364, 29925, 29889, 20047, 29930, 29906, 29897, 13, 4706, 7146, 29901, 13, 9651, 3144, 4205, 519, 4032, 2792, 29898, 7239, 29918, 5348, 4330, 29990, 29918, 1718, 22800, 29897, 13, 9651, 3144, 4205, 519, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29897, 13, 9651, 3144, 4205, 519, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29918, 12194, 29897, 13, 1678, 7146, 29901, 13, 4706, 396, 29878, 29925, 29889, 12324, 1338, 29889, 348, 5355, 580, 13, 4706, 364, 29925, 29889, 9748, 29889, 348, 5355, 580, 13, 4706, 3144, 4205, 519, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29897, 13, 308, 13, 1678, 3144, 12310, 14609, 580, 13, 268, 13, 1678, 3144, 329, 10840, 481, 29933, 3096, 414, 580, 13, 13, 1753, 2479, 14400, 29906, 7295, 13, 1678, 5534, 364, 29925, 13, 1678, 3144, 18759, 29898, 7239, 29918, 15032, 1955, 29918, 7838, 28483, 29918, 22698, 891, 12729, 29918, 2287, 29925, 4690, 29918, 7838, 28483, 29918, 22698, 29897, 13, 1678, 3144, 5896, 18415, 580, 13, 268, 13, 4706, 396, 3820, 4300, 9632, 29888, 29898, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 448, 29941, 29889, 29900, 29897, 13, 13, 1678, 3144, 27031, 14609, 580, 13, 268, 13, 1678, 396, 3820, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29900, 1402, 29871, 29896, 29892, 29900, 29892, 29900, 29897, 13, 1678, 396, 3820, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29896, 1402, 29871, 29900, 29892, 29896, 29892, 29900, 29897, 13, 1678, 396, 3820, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29906, 1402, 29871, 29900, 29892, 29900, 29892, 29896, 29897, 13, 1678, 396, 3820, 4300, 9632, 29888, 29898, 29878, 29925, 29889, 29873, 25987, 29961, 29900, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29896, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29906, 2314, 268, 13, 1678, 396, 3820, 17185, 29888, 29898, 29878, 29925, 29889, 29879, 25987, 29961, 29900, 1402, 364, 29925, 29889, 29879, 25987, 29961, 29896, 1402, 364, 29925, 29889, 29879, 25987, 29961, 29906, 2314, 13, 268, 13, 1678, 3144, 4300, 9632, 29888, 29898, 29878, 29925, 29889, 29873, 25987, 29961, 29900, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29896, 1402, 364, 29925, 29889, 29873, 25987, 29961, 29906, 2314, 259, 13, 1678, 3144, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29900, 1402, 29871, 29896, 29892, 29900, 29892, 29900, 29897, 13, 1678, 3144, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29896, 1402, 29871, 29900, 29892, 29896, 29892, 29900, 29897, 13, 1678, 3144, 21281, 403, 29888, 29898, 29878, 29925, 29889, 29878, 25987, 29961, 29906, 1402, 29871, 29900, 29892, 29900, 29892, 29896, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 396, 3820, 20701, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29897, 13, 4706, 396, 3820, 26887, 9329, 29875, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 12729, 29918, 16975, 11499, 29918, 1529, 29954, 29918, 3738, 29931, 4945, 29892, 12729, 29918, 8186, 29909, 1525, 1254, 29897, 13, 4706, 396, 3820, 26887, 9329, 29875, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 12729, 29918, 16975, 11499, 29918, 16173, 29918, 3738, 29931, 4945, 29892, 12729, 29918, 8186, 29909, 1525, 1254, 29897, 13, 4706, 396, 3820, 26887, 21745, 29888, 29898, 7239, 29918, 16975, 11499, 29918, 25838, 29892, 12729, 29918, 16975, 11499, 29918, 25838, 29918, 20387, 29892, 12729, 29918, 2287, 29907, 1964, 29897, 13, 4706, 396, 3820, 15708, 21898, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29892, 364, 29925, 29889, 4776, 1367, 29897, 13, 308, 13, 4706, 364, 29925, 29889, 9748, 29889, 5355, 580, 13, 4706, 1018, 29901, 13, 9651, 3144, 20701, 4032, 2792, 29898, 7239, 29918, 5348, 4330, 29990, 29918, 1718, 22800, 29897, 13, 9651, 396, 3820, 20701, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29918, 12194, 29897, 13, 9651, 396, 3820, 20701, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29897, 13, 9651, 396, 3820, 26887, 7967, 536, 14516, 29898, 29906, 29892, 12729, 29918, 29943, 3927, 1299, 29892, 29871, 29906, 29900, 29892, 364, 29925, 29889, 9748, 29897, 13, 9651, 3144, 22479, 14516, 29898, 29941, 29892, 12729, 29918, 29943, 3927, 1299, 29892, 29871, 29906, 29900, 29892, 364, 29925, 29889, 9748, 29974, 29947, 29897, 13, 9651, 396, 3820, 22479, 14516, 29888, 29898, 29878, 29925, 29889, 9748, 29897, 13, 9651, 3144, 8537, 2588, 29879, 29898, 7239, 29918, 29911, 3960, 19453, 17101, 29892, 29871, 29900, 29892, 364, 29925, 29889, 20047, 29897, 13, 4706, 7146, 29901, 13, 9651, 3144, 4205, 519, 4032, 2792, 29898, 7239, 29918, 5348, 4330, 29990, 29918, 1718, 22800, 29897, 13, 9651, 396, 3820, 4205, 519, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29897, 13, 9651, 396, 3820, 4205, 519, 4032, 2792, 29898, 7239, 29918, 16975, 11499, 29918, 3217, 25593, 29918, 1718, 22800, 29918, 12194, 29897, 13, 1678, 7146, 29901, 13, 4706, 396, 29878, 29925, 29889, 12324, 1338, 29889, 348, 5355, 580, 13, 4706, 364, 29925, 29889, 9748, 29889, 348, 5355, 580, 13, 4706, 396, 3820, 4205, 519, 29898, 7239, 29918, 16975, 11499, 29918, 29906, 29928, 29897, 13, 308, 13, 1678, 3144, 12310, 14609, 580, 13, 268, 13, 1678, 3144, 329, 10840, 481, 29933, 3096, 414, 580, 13, 268, 13, 1990, 4050, 4736, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 15769, 3125, 353, 6213, 13, 4706, 1583, 29889, 29873, 25987, 353, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 13, 4706, 1583, 29889, 29878, 25987, 353, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 13, 4706, 1583, 29889, 29879, 25987, 353, 518, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29962, 13, 4706, 1583, 29889, 9748, 353, 6213, 13, 4706, 1583, 29889, 513, 1575, 353, 6213, 13, 4706, 1583, 29889, 20047, 353, 29871, 29900, 13, 13, 1678, 822, 10092, 29898, 1311, 1125, 13, 4706, 1583, 29889, 15769, 3125, 353, 6213, 13, 4706, 1583, 29889, 29873, 25987, 353, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 13, 4706, 1583, 29889, 29878, 25987, 353, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 13, 4706, 1583, 29889, 29879, 25987, 353, 518, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29962, 13, 4706, 1583, 29889, 9748, 353, 6213, 13, 4706, 1583, 29889, 513, 1575, 353, 6213, 13, 4706, 1583, 29889, 20047, 353, 29871, 29900, 13, 308, 13, 29878, 29925, 353, 4050, 4736, 580, 13, 1025, 14346, 9135, 353, 518, 29900, 29892, 29871, 29900, 29962, 13, 1753, 9495, 3125, 29898, 3092, 29892, 4464, 29892, 921, 29892, 343, 1125, 13, 1678, 5534, 364, 29925, 29892, 2030, 14346, 9135, 13, 1678, 565, 4464, 1275, 12729, 2692, 29918, 3970, 16048, 29901, 13, 4706, 364, 29925, 29889, 15769, 3125, 353, 2826, 13, 1678, 1683, 29901, 13, 4706, 364, 29925, 29889, 15769, 3125, 353, 6213, 13, 1678, 2030, 14346, 9135, 29961, 29900, 1402, 2030, 14346, 9135, 29961, 29896, 29962, 353, 921, 29892, 343, 13, 1678, 3144, 329, 6747, 9039, 275, 1456, 29898, 1723, 13, 13, 1753, 9495, 29924, 8194, 29898, 29916, 29892, 343, 1125, 13, 1678, 5534, 364, 29925, 29892, 2030, 14346, 9135, 13, 1678, 19471, 29990, 353, 921, 448, 2030, 14346, 9135, 29961, 29871, 29900, 4514, 13, 1678, 19471, 29979, 353, 343, 448, 2030, 14346, 9135, 29961, 29871, 29896, 4514, 13, 1678, 565, 364, 29925, 29889, 15769, 3125, 1275, 12729, 2692, 29918, 28024, 29918, 29933, 2692, 29911, 1164, 29901, 13, 4706, 7329, 353, 29871, 29900, 29889, 29900, 29900, 29945, 13, 4706, 364, 29925, 29889, 29873, 25987, 29961, 29900, 29962, 4619, 19471, 29990, 334, 7329, 13, 4706, 364, 29925, 29889, 29873, 25987, 29961, 29896, 29962, 22361, 19471, 29979, 334, 7329, 13, 4706, 2030, 14346, 9135, 29961, 29900, 1402, 2030, 14346, 9135, 29961, 29896, 29962, 353, 921, 29892, 343, 13, 1678, 565, 364, 29925, 29889, 15769, 3125, 1275, 12729, 2692, 29918, 22789, 3912, 29918, 29933, 2692, 29911, 1164, 29901, 13, 4706, 7329, 353, 29871, 29900, 29889, 29896, 13, 4706, 364, 29925, 29889, 29878, 25987, 29961, 29900, 29962, 4619, 19471, 29979, 334, 7329, 13, 4706, 364, 29925, 29889, 29878, 25987, 29961, 29896, 29962, 4619, 19471, 29990, 334, 7329, 13, 4706, 2030, 14346, 9135, 29961, 29900, 1402, 2030, 14346, 9135, 29961, 29896, 29962, 353, 921, 29892, 343, 13, 1678, 565, 364, 29925, 29889, 15769, 3125, 1275, 12729, 2692, 29918, 29924, 1367, 29928, 1307, 29918, 29933, 2692, 29911, 1164, 29901, 13, 4706, 7329, 353, 29871, 29900, 29889, 29900, 29896, 13, 4706, 364, 29925, 29889, 29873, 25987, 29961, 29906, 29962, 4619, 19471, 29979, 334, 7329, 13, 4706, 2030, 14346, 9135, 29961, 29900, 1402, 2030, 14346, 9135, 29961, 29896, 29962, 353, 921, 29892, 343, 13, 1678, 3144, 329, 6747, 9039, 275, 1456, 29898, 1723, 13, 13, 1753, 6036, 10717, 29879, 7295, 13, 1678, 3144, 329, 14346, 14400, 29898, 15769, 3125, 29897, 13, 1678, 3144, 329, 29924, 8194, 14400, 29898, 15769, 29924, 8194, 29897, 13, 13, 1753, 1667, 7295, 13, 1678, 3144, 329, 6644, 580, 268, 13, 1678, 3144, 329, 6644, 5907, 3505, 29898, 29946, 29900, 29900, 29892, 29946, 29900, 29900, 29897, 13, 1678, 3144, 329, 6644, 9323, 6818, 29898, 7239, 2692, 29918, 3970, 7466, 1307, 29989, 12729, 2692, 29918, 29934, 29954, 5688, 891, 12729, 2692, 29918, 2287, 29925, 4690, 29897, 13, 268, 13, 1678, 3144, 329, 4391, 5907, 703, 4421, 2620, 29896, 1159, 13, 1678, 2069, 14400, 580, 13, 1678, 2069, 1469, 580, 13, 1678, 3144, 329, 9323, 14400, 29898, 4990, 14400, 29896, 29897, 13, 1678, 6036, 10717, 29879, 580, 13, 268, 13, 1678, 396, 3820, 329, 4391, 5907, 703, 4421, 2620, 29906, 1159, 13, 1678, 396, 2344, 14400, 580, 13, 1678, 396, 3820, 329, 9323, 14400, 29898, 4990, 14400, 29906, 29897, 13, 1678, 396, 9573, 10717, 29879, 580, 13, 268, 13, 1678, 3144, 329, 6330, 18405, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 2 ]
LC/188.py
szhu3210/LeetCode_Solutions
2
68511
class Solution(object): def maxProfit(self, k, prices): """ :type k: int :type prices: List[int] :rtype: int """ if not prices: return 0 n=len(prices) if k>n//2: return sum([prices[i+1]-prices[i] if prices[i+1]>prices[i] else 0 for i in range(n-1)]) G=[[0]*n for _ in range(k+1)] for i in range(1,k+1): L=[0 for _ in range(n)] for j in range(1,n): p=prices[j]-prices[j-1] # cal local max L[j]=max(G[i-1][j-1]+p, L[j-1]+p) # cal global max G[i][j]=max(G[i][j-1], L[j]) return G[-1][-1]
[ 1, 770, 24380, 29898, 3318, 1125, 13, 1678, 822, 4236, 1184, 9202, 29898, 1311, 29892, 413, 29892, 26094, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 413, 29901, 938, 13, 4706, 584, 1853, 26094, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 4706, 9995, 13, 4706, 565, 451, 26094, 29901, 13, 9651, 736, 29871, 29900, 13, 4706, 302, 29922, 2435, 29898, 558, 1575, 29897, 13, 4706, 565, 413, 29958, 29876, 458, 29906, 29901, 13, 9651, 736, 2533, 4197, 558, 1575, 29961, 29875, 29974, 29896, 29962, 29899, 558, 1575, 29961, 29875, 29962, 565, 26094, 29961, 29875, 29974, 29896, 29962, 29958, 558, 1575, 29961, 29875, 29962, 1683, 29871, 29900, 363, 474, 297, 3464, 29898, 29876, 29899, 29896, 29897, 2314, 13, 4706, 402, 29922, 8999, 29900, 14178, 29876, 363, 903, 297, 3464, 29898, 29895, 29974, 29896, 4638, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 29895, 29974, 29896, 1125, 13, 9651, 365, 11759, 29900, 363, 903, 297, 3464, 29898, 29876, 4638, 13, 9651, 363, 432, 297, 3464, 29898, 29896, 29892, 29876, 1125, 13, 18884, 282, 29922, 558, 1575, 29961, 29926, 29962, 29899, 558, 1575, 29961, 29926, 29899, 29896, 29962, 13, 18884, 396, 1208, 1887, 4236, 13, 18884, 365, 29961, 29926, 13192, 3317, 29898, 29954, 29961, 29875, 29899, 29896, 3816, 29926, 29899, 29896, 10062, 29886, 29892, 365, 29961, 29926, 29899, 29896, 10062, 29886, 29897, 13, 18884, 396, 1208, 5534, 4236, 13, 18884, 402, 29961, 29875, 3816, 29926, 13192, 3317, 29898, 29954, 29961, 29875, 3816, 29926, 29899, 29896, 1402, 365, 29961, 29926, 2314, 13, 4706, 736, 402, 14352, 29896, 3816, 29899, 29896, 29962, 13, 462, 2 ]
backend/gsr_booking/management/commands/load_gsrs.py
pennlabs/penn-mobile
2
38738
<filename>backend/gsr_booking/management/commands/load_gsrs.py import csv from django.core.management.base import BaseCommand from gsr_booking.models import GSR class Command(BaseCommand): def handle(self, *args, **kwargs): with open("gsr_booking/data/gsr_data.csv") as data: reader = csv.reader(data) for i, row in enumerate(reader): if i == 0: continue # collects room information from csv lid, gid, name, service = row # gets image from s3 given the lid and gid # TODO: fix image url! image_url = ( f"https://s3.us-east-2.amazonaws.com/labs.api/gsr/lid-{lid}-gid-{gid}.jpg" ) kind = GSR.KIND_WHARTON if service == "wharton" else GSR.KIND_LIBCAL GSR.objects.create(lid=lid, gid=gid, name=name, kind=kind, image_url=image_url) self.stdout.write("Uploaded GSRs!")
[ 1, 529, 9507, 29958, 27852, 29914, 3174, 29878, 29918, 2909, 292, 29914, 21895, 29914, 26381, 29914, 1359, 29918, 3174, 2288, 29889, 2272, 13, 5215, 11799, 13, 13, 3166, 9557, 29889, 3221, 29889, 21895, 29889, 3188, 1053, 7399, 6255, 13, 13, 3166, 330, 21935, 29918, 2909, 292, 29889, 9794, 1053, 402, 14098, 13, 13, 13, 1990, 10516, 29898, 5160, 6255, 1125, 13, 1678, 822, 4386, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 13, 4706, 411, 1722, 703, 3174, 29878, 29918, 2909, 292, 29914, 1272, 29914, 3174, 29878, 29918, 1272, 29889, 7638, 1159, 408, 848, 29901, 13, 9651, 9591, 353, 11799, 29889, 16950, 29898, 1272, 29897, 13, 13, 9651, 363, 474, 29892, 1948, 297, 26985, 29898, 16950, 1125, 13, 18884, 565, 474, 1275, 29871, 29900, 29901, 13, 462, 1678, 6773, 13, 13, 18884, 396, 6314, 29879, 5716, 2472, 515, 11799, 13, 18884, 17343, 29892, 330, 333, 29892, 1024, 29892, 2669, 353, 1948, 13, 13, 18884, 396, 4947, 1967, 515, 269, 29941, 2183, 278, 17343, 322, 330, 333, 13, 18884, 396, 14402, 29901, 2329, 1967, 3142, 29991, 13, 18884, 1967, 29918, 2271, 353, 313, 13, 462, 1678, 285, 29908, 991, 597, 29879, 29941, 29889, 375, 29899, 23027, 29899, 29906, 29889, 17260, 10467, 29889, 510, 29914, 29880, 6897, 29889, 2754, 29914, 3174, 29878, 29914, 29880, 333, 29899, 29912, 29880, 333, 7402, 29887, 333, 29899, 29912, 29887, 333, 1836, 6173, 29908, 13, 18884, 1723, 13, 18884, 2924, 353, 402, 14098, 29889, 29968, 22255, 29918, 25039, 8322, 1164, 565, 2669, 1275, 376, 1332, 442, 265, 29908, 1683, 402, 14098, 29889, 29968, 22255, 29918, 5265, 5371, 1964, 13, 18884, 402, 14098, 29889, 12650, 29889, 3258, 29898, 29880, 333, 29922, 29880, 333, 29892, 330, 333, 29922, 29887, 333, 29892, 1024, 29922, 978, 29892, 2924, 29922, 14380, 29892, 1967, 29918, 2271, 29922, 3027, 29918, 2271, 29897, 13, 13, 4706, 1583, 29889, 25393, 29889, 3539, 703, 3373, 15638, 402, 14098, 29879, 29991, 1159, 13, 2 ]
test/solution_tests/CHK/test_checkout.py
DPNT-Sourcecode/CHK-qvhh01
0
131182
from lib.solutions.CHK import checkout_solution class TestSkus(): def test_skus_should_created(self): skus_a = checkout_solution.Skus(product_name='A', price=10.0) assert skus_a.get_product_name() == 'A' assert skus_a.get_price() == 10.0 assert skus_a.get_number_of_items() == 1 assert len(skus_a.get_discounts()) == 0 def test_skus_should_created_with_discount_info(self): discount = checkout_solution.Discount(discount_purchase=3, discount_receive=130) skus_a = checkout_solution.Skus(product_name='A', price=50) skus_a.add_discount(discount) assert skus_a.get_product_name() == 'A' assert skus_a.get_price() == 50 assert skus_a.get_number_of_items() == 1 discounts = skus_a.get_discounts() assert len(discounts) == 1 assert discounts[0].get_discount_purchase() == 3 assert discounts[0].get_discount_receive() == 130 class TestBasket(): def test_basket_items(self): discount = checkout_solution.Discount(discount_purchase=3, discount_receive=130) skus_a = checkout_solution.Skus(product_name='A', price=50) skus_a.add_discount(discount) basket = checkout_solution.Basket() assert len(basket.get_items()) == 0 basket.add_item(skus_a) assert len(basket.get_items()) == 1 def test_when_added_the_same_skus_in_basket(self): discount = checkout_solution.Discount(discount_purchase=3, discount_receive=130) discount1 = checkout_solution.Discount(discount_purchase=2, discount_receive=45) skus_a = checkout_solution.Skus(product_name='A', price=50) skus_a.add_discount(discount) skus_b = checkout_solution.Skus(product_name='B', price=30) skus_b.add_discount(discount1) skus_c = checkout_solution.Skus(product_name='C', price=20) basket = checkout_solution.Basket() basket.add_item(skus_a) basket.add_item(skus_b) basket.add_item(skus_c) items_list = basket.get_items() assert len(items_list) == 3 assert items_list[1].get_number_of_items() == 1 basket.add_item(skus_b) items_list = basket.get_items() assert len(items_list) == 3 assert items_list[1].get_number_of_items() == 2 # def test_checkout_without_discount(self): # skus_a = checkout_solution.Skus(product_name='A', price=50) # skus_b = checkout_solution.Skus(product_name='B', price=30) # skus_c = checkout_solution.Skus(product_name='C', price=20) # basket = checkout_solution.Basket() # basket.add_item(skus_a) # basket.add_item(skus_b) # basket.add_item(skus_c) # assert basket.get_total() == 100 # def test_checkout_with_discount_not_applied(self): # discount = checkout_solution.Discount(discount_purchase=3, discount_receive=130) # skus_a = checkout_solution.Skus(product_name='A', price=50) # skus_a.add_discount(discount) # skus_b = checkout_solution.Skus(product_name='B', price=30) # skus_c = checkout_solution.Skus(product_name='C', price=20) # basket = checkout_solution.Basket() # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_b) # basket.add_item(skus_c) # assert basket.get_total() == 150 # def test_checkout_with_discount_applied(self): # discount = checkout_solution.Discount(discount_purchase=3, discount_receive=130) # skus_a = checkout_solution.Skus(product_name='A', price=50) # skus_a.add_discount(discount) # skus_b = checkout_solution.Skus(product_name='B', price=30) # skus_c = checkout_solution.Skus(product_name='C', price=20) # basket = checkout_solution.Basket() # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_b) # basket.add_item(skus_c) # assert basket.get_total() == 180 # def test_checkout_with_discount_applied_but_not_on_all_items(self): # discount = checkout_solution.Discount(discount_purchase=3, discount_receive=130) # skus_a = checkout_solution.Skus(product_name='A', price=50) # skus_a.add_discount(discount) # skus_b = checkout_solution.Skus(product_name='B', price=30) # skus_c = checkout_solution.Skus(product_name='C', price=20) # basket = checkout_solution.Basket() # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_b) # basket.add_item(skus_c) # assert basket.get_total() == 230 # def test_checkout_with_discount_applied_but_not_on_all_items_(self): # discount = checkout_solution.Discount(discount_purchase=2, discount_receive=80) # skus_a = checkout_solution.Skus(product_name='A', price=50) # skus_a.add_discount(discount) # skus_b = checkout_solution.Skus(product_name='B', price=30) # skus_c = checkout_solution.Skus(product_name='C', price=20) # basket = checkout_solution.Basket() # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_a) # basket.add_item(skus_b) # basket.add_item(skus_c) # assert basket.get_total() == 260 def test_checkout_from_string(self): basket = checkout_solution.Basket() assert basket.checkout('ABCD') == 115 def test_checkout_from_string_discount(self): assert checkout_solution.checkout('ABCADA') == 195 def test_checkout_from_string_discount2(self): assert checkout_solution.checkout('ABCADAAAA') == 315 def test_checkout_from_string_discount3(self): assert checkout_solution.checkout('ABCADAAA') == 265 def test_checkout_from_string_discount4(self): assert checkout_solution.checkout('ABCDE') == 155 def test_checkout_from_string_discount5(self): assert checkout_solution.checkout('ABCEDE') == 165 def test_checkout_from_string_discount6(self): assert checkout_solution.checkout('BBEE') == 110 # to check def test_checkout_from_string_discount7(self): assert checkout_solution.checkout('EE') == 80 def test_checkout_from_string_discount8(self): assert checkout_solution.checkout('AAAAAAAA') == 330 def test_checkout_from_string_discount9(self): assert checkout_solution.checkout('ABCDEABCDE') == 280 def test_checkout_from_string_discount10(self): assert checkout_solution.checkout('CCADDEEBBA') == 280 def test_checkout_from_string_discount11(self): assert checkout_solution.checkout('EEEEBB') == 160 def test_checkout_from_string_discount12(self): assert checkout_solution.checkout('FF') == 20 def test_checkout_from_string_discount13(self): assert checkout_solution.checkout('FFF') == 20 def test_checkout_from_string_discount14(self): assert checkout_solution.checkout('NNNM') == 120 def test_checkout_from_string_discount15(self): assert checkout_solution.checkout('NNN') == 120 def test_checkout_from_string_discount16(self): assert checkout_solution.checkout('NNNNNNMM') == 240 def test_checkout_from_string_discount17(self): assert checkout_solution.checkout('NNNNNNM') == 240 def test_checkout_from_string_discount18(self): assert checkout_solution.checkout('M') == 15 def test_checkout_from_string_discount19(self): assert checkout_solution.checkout('ABCDEFGHIJKLMNOPQRSTUVWXYZ') == 965 def test_checkout_from_string_discount20(self): assert checkout_solution.checkout('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ') == 1880 def test_checkout_from_string_discount21(self): assert checkout_solution.checkout('SSS') == 45 def test_checkout_from_string_discount22(self): assert checkout_solution.checkout('TTT') == 45 def test_checkout_from_string_discount23(self): assert checkout_solution.checkout('ZZZ') == 45 def test_checkout_from_string_discount24(self): assert checkout_solution.checkout('STY') == 45 def test_checkout_from_string_discount25(self): assert checkout_solution.checkout('STYX') == 62 def test_checkout_from_string_discount26(self): assert checkout_solution.checkout('XXXX') == 62 def test_checkout_from_string_discount27(self): assert checkout_solution.checkout('XXXST') == 79 def test_checkout_from_string_discount28(self): assert checkout_solution.checkout('S') == 20 def test_checkout_from_string_discount29(self): assert checkout_solution.checkout('Z') == 21 def test_checkout_from_string_discount30(self): assert checkout_solution.checkout('ZZZ') == 45 def test_checkout_from_string_discount31(self): assert checkout_solution.checkout('ZZZX') == 62 def test_checkout_from_invalid_string(self): assert checkout_solution.checkout('') == 0 assert checkout_solution.checkout('a') == -1
[ 1, 515, 4303, 29889, 2929, 17925, 29889, 3210, 29968, 1053, 24808, 29918, 2929, 918, 30004, 13, 30004, 13, 1990, 4321, 15797, 375, 7295, 30004, 13, 1678, 822, 1243, 29918, 808, 375, 29918, 9344, 29918, 11600, 29898, 1311, 1125, 30004, 13, 4706, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29896, 29900, 29889, 29900, 8443, 13, 4706, 4974, 2071, 375, 29918, 29874, 29889, 657, 29918, 4704, 29918, 978, 580, 1275, 525, 29909, 29915, 30004, 13, 4706, 4974, 2071, 375, 29918, 29874, 29889, 657, 29918, 9175, 580, 1275, 29871, 29896, 29900, 29889, 29900, 30004, 13, 4706, 4974, 2071, 375, 29918, 29874, 29889, 657, 29918, 4537, 29918, 974, 29918, 7076, 580, 1275, 29871, 29896, 30004, 13, 4706, 4974, 7431, 29898, 808, 375, 29918, 29874, 29889, 657, 29918, 2218, 2798, 29879, 3101, 1275, 29871, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 808, 375, 29918, 9344, 29918, 11600, 29918, 2541, 29918, 2218, 2798, 29918, 3888, 29898, 1311, 1125, 30004, 13, 4706, 2313, 792, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29941, 29892, 2313, 792, 29918, 13556, 573, 29922, 29896, 29941, 29900, 8443, 13, 4706, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 4706, 2071, 375, 29918, 29874, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 8443, 13, 4706, 4974, 2071, 375, 29918, 29874, 29889, 657, 29918, 4704, 29918, 978, 580, 1275, 525, 29909, 29915, 30004, 13, 4706, 4974, 2071, 375, 29918, 29874, 29889, 657, 29918, 9175, 580, 1275, 29871, 29945, 29900, 30004, 13, 4706, 4974, 2071, 375, 29918, 29874, 29889, 657, 29918, 4537, 29918, 974, 29918, 7076, 580, 1275, 29871, 29896, 30004, 13, 4706, 2313, 792, 29879, 353, 2071, 375, 29918, 29874, 29889, 657, 29918, 2218, 2798, 29879, 26471, 13, 4706, 4974, 7431, 29898, 2218, 2798, 29879, 29897, 1275, 29871, 29896, 30004, 13, 4706, 4974, 2313, 792, 29879, 29961, 29900, 1822, 657, 29918, 2218, 2798, 29918, 29886, 27574, 580, 1275, 29871, 29941, 30004, 13, 4706, 4974, 2313, 792, 29879, 29961, 29900, 1822, 657, 29918, 2218, 2798, 29918, 13556, 573, 580, 1275, 29871, 29896, 29941, 29900, 30004, 13, 30004, 13, 1990, 4321, 29933, 7896, 7295, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 29890, 7896, 29918, 7076, 29898, 1311, 1125, 30004, 13, 4706, 2313, 792, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29941, 29892, 2313, 792, 29918, 13556, 573, 29922, 29896, 29941, 29900, 8443, 13, 4706, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 4706, 2071, 375, 29918, 29874, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 8443, 13, 4706, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 4706, 4974, 7431, 29898, 29890, 7896, 29889, 657, 29918, 7076, 3101, 1275, 29871, 29900, 30004, 13, 4706, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 4706, 4974, 7431, 29898, 29890, 7896, 29889, 657, 29918, 7076, 3101, 1275, 29871, 29896, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 8256, 29918, 23959, 29918, 1552, 29918, 17642, 29918, 808, 375, 29918, 262, 29918, 29890, 7896, 29898, 1311, 1125, 30004, 13, 4706, 2313, 792, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29941, 29892, 2313, 792, 29918, 13556, 573, 29922, 29896, 29941, 29900, 8443, 13, 4706, 2313, 792, 29896, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29906, 29892, 2313, 792, 29918, 13556, 573, 29922, 29946, 29945, 8443, 13, 4706, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 4706, 2071, 375, 29918, 29874, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 8443, 13, 4706, 2071, 375, 29918, 29890, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29933, 742, 8666, 29922, 29941, 29900, 8443, 13, 4706, 2071, 375, 29918, 29890, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 29896, 8443, 13, 4706, 2071, 375, 29918, 29883, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29907, 742, 8666, 29922, 29906, 29900, 8443, 13, 4706, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 4706, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 4706, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29890, 8443, 13, 4706, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29883, 8443, 13, 4706, 4452, 29918, 1761, 353, 25972, 29889, 657, 29918, 7076, 26471, 13, 4706, 4974, 7431, 29898, 7076, 29918, 1761, 29897, 1275, 29871, 29941, 30004, 13, 4706, 4974, 4452, 29918, 1761, 29961, 29896, 1822, 657, 29918, 4537, 29918, 974, 29918, 7076, 580, 1275, 29871, 29896, 30004, 13, 4706, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29890, 8443, 13, 4706, 4452, 29918, 1761, 353, 25972, 29889, 657, 29918, 7076, 26471, 13, 4706, 4974, 7431, 29898, 7076, 29918, 1761, 29897, 1275, 29871, 29941, 30004, 13, 4706, 4974, 4452, 29918, 1761, 29961, 29896, 1822, 657, 29918, 4537, 29918, 974, 29918, 7076, 580, 1275, 29871, 29906, 30004, 13, 30004, 13, 1678, 396, 822, 1243, 29918, 3198, 449, 29918, 14037, 29918, 2218, 2798, 29898, 1311, 1125, 30004, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29890, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29933, 742, 8666, 29922, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29883, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29907, 742, 8666, 29922, 29906, 29900, 8443, 13, 1678, 396, 268, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29890, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29883, 8443, 13, 1678, 396, 268, 4974, 25972, 29889, 657, 29918, 7827, 580, 1275, 29871, 29896, 29900, 29900, 30004, 13, 1678, 6756, 13, 1678, 396, 822, 1243, 29918, 3198, 449, 29918, 2541, 29918, 2218, 2798, 29918, 1333, 29918, 932, 2957, 29898, 1311, 1125, 30004, 13, 1678, 396, 268, 2313, 792, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29941, 29892, 2313, 792, 29918, 13556, 573, 29922, 29896, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29890, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29933, 742, 8666, 29922, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29883, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29907, 742, 8666, 29922, 29906, 29900, 8443, 13, 1678, 396, 268, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29890, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29883, 8443, 13, 1678, 396, 268, 4974, 25972, 29889, 657, 29918, 7827, 580, 1275, 29871, 29896, 29945, 29900, 30004, 13, 30004, 13, 1678, 396, 822, 1243, 29918, 3198, 449, 29918, 2541, 29918, 2218, 2798, 29918, 932, 2957, 29898, 1311, 1125, 30004, 13, 1678, 396, 268, 2313, 792, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29941, 29892, 2313, 792, 29918, 13556, 573, 29922, 29896, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29890, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29933, 742, 8666, 29922, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29883, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29907, 742, 8666, 29922, 29906, 29900, 8443, 13, 1678, 396, 268, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29890, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29883, 8443, 13, 1678, 396, 268, 4974, 25972, 29889, 657, 29918, 7827, 580, 1275, 29871, 29896, 29947, 29900, 30004, 13, 1678, 6756, 13, 1678, 396, 822, 1243, 29918, 3198, 449, 29918, 2541, 29918, 2218, 2798, 29918, 932, 2957, 29918, 4187, 29918, 1333, 29918, 265, 29918, 497, 29918, 7076, 29898, 1311, 1125, 30004, 13, 1678, 396, 268, 2313, 792, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29941, 29892, 2313, 792, 29918, 13556, 573, 29922, 29896, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29890, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29933, 742, 8666, 29922, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29883, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29907, 742, 8666, 29922, 29906, 29900, 8443, 13, 1678, 396, 268, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29890, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29883, 8443, 13, 1678, 396, 268, 4974, 25972, 29889, 657, 29918, 7827, 580, 1275, 29871, 29906, 29941, 29900, 30004, 13, 1678, 6756, 13, 1678, 396, 822, 1243, 29918, 3198, 449, 29918, 2541, 29918, 2218, 2798, 29918, 932, 2957, 29918, 4187, 29918, 1333, 29918, 265, 29918, 497, 29918, 7076, 23538, 1311, 1125, 30004, 13, 1678, 396, 268, 2313, 792, 353, 24808, 29918, 2929, 918, 29889, 4205, 2798, 29898, 2218, 2798, 29918, 29886, 27574, 29922, 29906, 29892, 2313, 792, 29918, 13556, 573, 29922, 29947, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29909, 742, 8666, 29922, 29945, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29874, 29889, 1202, 29918, 2218, 2798, 29898, 2218, 2798, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29890, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29933, 742, 8666, 29922, 29941, 29900, 8443, 13, 1678, 396, 268, 2071, 375, 29918, 29883, 353, 24808, 29918, 2929, 918, 29889, 15797, 375, 29898, 4704, 29918, 978, 2433, 29907, 742, 8666, 29922, 29906, 29900, 8443, 13, 1678, 396, 268, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29874, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29890, 8443, 13, 1678, 396, 268, 25972, 29889, 1202, 29918, 667, 29898, 808, 375, 29918, 29883, 8443, 13, 1678, 396, 268, 4974, 25972, 29889, 657, 29918, 7827, 580, 1275, 29871, 29906, 29953, 29900, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29898, 1311, 1125, 30004, 13, 4706, 25972, 353, 24808, 29918, 2929, 918, 29889, 29933, 7896, 26471, 13, 4706, 4974, 25972, 29889, 3198, 449, 877, 2882, 6530, 1495, 1275, 29871, 29896, 29896, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19658, 3035, 29909, 1495, 1275, 29871, 29896, 29929, 29945, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19658, 3035, 23184, 1495, 1275, 29871, 29941, 29896, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29941, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19658, 3035, 6344, 29909, 1495, 1275, 29871, 29906, 29953, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29946, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19658, 2287, 1495, 1275, 29871, 29896, 29945, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29945, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 2882, 4741, 2287, 1495, 1275, 29871, 29896, 29953, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29953, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 14388, 17896, 1495, 1275, 29871, 29896, 29896, 29900, 396, 304, 1423, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29955, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 17896, 1495, 1275, 29871, 29947, 29900, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29947, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 23184, 23184, 1495, 1275, 29871, 29941, 29941, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29929, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19658, 2287, 19658, 2287, 1495, 1275, 29871, 29906, 29947, 29900, 6756, 13, 4706, 6756, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29900, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 4174, 3035, 2287, 25752, 5688, 1495, 1275, 29871, 29906, 29947, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29896, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 17896, 17896, 14388, 1495, 1275, 29871, 29896, 29953, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29906, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 4198, 1495, 1275, 29871, 29906, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29941, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 4198, 29943, 1495, 1275, 29871, 29906, 29900, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29946, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 10262, 29940, 29924, 1495, 1275, 29871, 29896, 29906, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29945, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 10262, 29940, 1495, 1275, 29871, 29896, 29906, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29953, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 10262, 10262, 10262, 7428, 1495, 1275, 29871, 29906, 29946, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29955, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 10262, 10262, 10262, 29924, 1495, 1275, 29871, 29906, 29946, 29900, 30004, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29947, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 29924, 1495, 1275, 29871, 29896, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29896, 29929, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19658, 24405, 29954, 17628, 29967, 29968, 26369, 29940, 4590, 29984, 29934, 1254, 29965, 29963, 29956, 18454, 29999, 1495, 1275, 29871, 29929, 29953, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29900, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19658, 24405, 29954, 17628, 29967, 29968, 26369, 29940, 4590, 29984, 29934, 1254, 29965, 29963, 29956, 18454, 29999, 19658, 24405, 29954, 17628, 29967, 29968, 26369, 29940, 4590, 29984, 29934, 1254, 29965, 29963, 29956, 18454, 29999, 1495, 1275, 29871, 29896, 29947, 29947, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29896, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 1799, 29903, 1495, 1275, 29871, 29946, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29906, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19988, 29911, 1495, 1275, 29871, 29946, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29941, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 29999, 29999, 29999, 1495, 1275, 29871, 29946, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29946, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 1254, 29979, 1495, 1275, 29871, 29946, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29945, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 1254, 29979, 29990, 1495, 1275, 29871, 29953, 29906, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29953, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 19165, 1495, 1275, 29871, 29953, 29906, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29955, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 22791, 1254, 1495, 1275, 29871, 29955, 29929, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29947, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 29903, 1495, 1275, 29871, 29906, 29900, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29906, 29929, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 29999, 1495, 1275, 29871, 29906, 29896, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29941, 29900, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 29999, 29999, 29999, 1495, 1275, 29871, 29946, 29945, 30004, 13, 1678, 6756, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 1807, 29918, 2218, 2798, 29941, 29896, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 29999, 29999, 29999, 29990, 1495, 1275, 29871, 29953, 29906, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 3198, 449, 29918, 3166, 29918, 20965, 29918, 1807, 29898, 1311, 1125, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 1495, 1275, 29871, 29900, 30004, 13, 4706, 4974, 24808, 29918, 2929, 918, 29889, 3198, 449, 877, 29874, 1495, 1275, 448, 29896, 30004, 13, 1678, 6756, 13, 1678, 6756, 13, 4706, 6756, 13, 9651, 6756, 13, 30004, 13, 30004, 13, 30004, 13, 2 ]
test/test_second_order_warnings.py
maryamhgf/backpack
0
103584
<gh_stars>0 """Checks wether backpack correctly recognizes when 2nd order backprop would fail. Failure cases include - the loss if not the output of a torch.nn module - using unsupported parameters of the loss """ import pytest import torch from torch.nn import CrossEntropyLoss, MSELoss import backpack.extensions as bpext from backpack import backpack as bp from backpack import extend ext_2nd_order = [ bpext.KFAC, bpext.KFRA, bpext.KFLR, bpext.DiagGGNExact, bpext.DiagGGNMC, ] ext_2nd_order_name = [ "KFAC", "KFRA", "KFLR", "DiagGGNExact", "DiagGGNExactMC", ] def classification_targets(N, num_classes): """Create random targets for classes 0, ..., `num_classes - 1`.""" return torch.randint(size=(N,), low=0, high=num_classes) def dummy_cross_entropy(N=5): y_pred = torch.rand((N, 2)) y_pred.requires_grad = True y = classification_targets(N, 2) loss_module = extend(CrossEntropyLoss()) return loss_module(y_pred, y) def dummy_mse(N=5, D=1): y_pred = torch.rand((N, D)) y_pred.requires_grad = True y = torch.randn((N, D)) loss_module = extend(MSELoss()) return loss_module(y_pred, y) @pytest.mark.parametrize("extension", ext_2nd_order, ids=ext_2nd_order_name) def test_sqrt_hessian_crossentropy_should_pass(extension): loss = dummy_cross_entropy() with bp(extension()): loss.backward() @pytest.mark.parametrize("extension", ext_2nd_order, ids=ext_2nd_order_name) def test_sqrt_hessian_mse_should_pass(extension): loss = dummy_mse() with bp(extension()): loss.backward() @pytest.mark.parametrize("extension", ext_2nd_order, ids=ext_2nd_order_name) def test_sqrt_hessian_modified_crossentropy_should_fail(extension): loss = dummy_cross_entropy() * 2 with pytest.warns(UserWarning): with bp(extension()): loss.backward() @pytest.mark.parametrize("extension", ext_2nd_order, ids=ext_2nd_order_name) def test_sqrt_hessian_modified_mse_should_fail(extension): loss = dummy_mse() * 2 with pytest.warns(UserWarning): with bp(extension()): loss.backward()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 5596, 29879, 281, 1979, 1250, 4058, 5149, 5936, 7093, 746, 29871, 29906, 299, 1797, 1250, 7728, 723, 4418, 29889, 13, 13, 24155, 4251, 3160, 13, 29899, 278, 6410, 565, 451, 278, 1962, 310, 263, 4842, 305, 29889, 15755, 3883, 13, 29899, 773, 443, 23765, 4128, 310, 278, 6410, 13, 15945, 29908, 13, 13, 5215, 11451, 1688, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 29889, 15755, 1053, 11189, 5292, 14441, 29931, 2209, 29892, 341, 1660, 29931, 2209, 13, 13, 5215, 1250, 4058, 29889, 24299, 408, 289, 412, 486, 13, 3166, 1250, 4058, 1053, 1250, 4058, 408, 289, 29886, 13, 3166, 1250, 4058, 1053, 10985, 13, 13, 1062, 29918, 29906, 299, 29918, 2098, 353, 518, 13, 1678, 289, 412, 486, 29889, 29968, 29943, 2477, 29892, 13, 1678, 289, 412, 486, 29889, 29968, 29943, 4717, 29892, 13, 1678, 289, 412, 486, 29889, 29968, 10536, 29934, 29892, 13, 1678, 289, 412, 486, 29889, 12130, 351, 29954, 20728, 1252, 627, 29892, 13, 1678, 289, 412, 486, 29889, 12130, 351, 29954, 20728, 12513, 29892, 13, 29962, 13, 1062, 29918, 29906, 299, 29918, 2098, 29918, 978, 353, 518, 13, 1678, 376, 29968, 29943, 2477, 613, 13, 1678, 376, 29968, 29943, 4717, 613, 13, 1678, 376, 29968, 10536, 29934, 613, 13, 1678, 376, 12130, 351, 29954, 20728, 1252, 627, 613, 13, 1678, 376, 12130, 351, 29954, 20728, 1252, 627, 12513, 613, 13, 29962, 13, 13, 13, 1753, 12965, 29918, 5182, 29879, 29898, 29940, 29892, 954, 29918, 13203, 1125, 13, 1678, 9995, 4391, 4036, 22525, 363, 4413, 29871, 29900, 29892, 2023, 29892, 421, 1949, 29918, 13203, 448, 29871, 29896, 29952, 1213, 15945, 13, 1678, 736, 4842, 305, 29889, 9502, 524, 29898, 2311, 7607, 29940, 29892, 511, 4482, 29922, 29900, 29892, 1880, 29922, 1949, 29918, 13203, 29897, 13, 13, 13, 1753, 20254, 29918, 19128, 29918, 296, 14441, 29898, 29940, 29922, 29945, 1125, 13, 1678, 343, 29918, 11965, 353, 4842, 305, 29889, 9502, 3552, 29940, 29892, 29871, 29906, 876, 13, 1678, 343, 29918, 11965, 29889, 276, 339, 2658, 29918, 5105, 353, 5852, 13, 1678, 343, 353, 12965, 29918, 5182, 29879, 29898, 29940, 29892, 29871, 29906, 29897, 13, 1678, 6410, 29918, 5453, 353, 10985, 29898, 29907, 2124, 5292, 14441, 29931, 2209, 3101, 13, 1678, 736, 6410, 29918, 5453, 29898, 29891, 29918, 11965, 29892, 343, 29897, 13, 13, 13, 1753, 20254, 29918, 29885, 344, 29898, 29940, 29922, 29945, 29892, 360, 29922, 29896, 1125, 13, 1678, 343, 29918, 11965, 353, 4842, 305, 29889, 9502, 3552, 29940, 29892, 360, 876, 13, 1678, 343, 29918, 11965, 29889, 276, 339, 2658, 29918, 5105, 353, 5852, 13, 1678, 343, 353, 4842, 305, 29889, 9502, 29876, 3552, 29940, 29892, 360, 876, 13, 1678, 6410, 29918, 5453, 353, 10985, 29898, 29924, 1660, 29931, 2209, 3101, 13, 1678, 736, 6410, 29918, 5453, 29898, 29891, 29918, 11965, 29892, 343, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 703, 17588, 613, 1294, 29918, 29906, 299, 29918, 2098, 29892, 18999, 29922, 1062, 29918, 29906, 299, 29918, 2098, 29918, 978, 29897, 13, 1753, 1243, 29918, 3676, 29918, 29882, 404, 713, 29918, 19128, 296, 14441, 29918, 9344, 29918, 3364, 29898, 17588, 1125, 13, 1678, 6410, 353, 20254, 29918, 19128, 29918, 296, 14441, 580, 13, 13, 1678, 411, 289, 29886, 29898, 17588, 580, 1125, 13, 4706, 6410, 29889, 1627, 1328, 580, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 703, 17588, 613, 1294, 29918, 29906, 299, 29918, 2098, 29892, 18999, 29922, 1062, 29918, 29906, 299, 29918, 2098, 29918, 978, 29897, 13, 1753, 1243, 29918, 3676, 29918, 29882, 404, 713, 29918, 29885, 344, 29918, 9344, 29918, 3364, 29898, 17588, 1125, 13, 1678, 6410, 353, 20254, 29918, 29885, 344, 580, 13, 13, 1678, 411, 289, 29886, 29898, 17588, 580, 1125, 13, 4706, 6410, 29889, 1627, 1328, 580, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 703, 17588, 613, 1294, 29918, 29906, 299, 29918, 2098, 29892, 18999, 29922, 1062, 29918, 29906, 299, 29918, 2098, 29918, 978, 29897, 13, 1753, 1243, 29918, 3676, 29918, 29882, 404, 713, 29918, 1545, 2164, 29918, 19128, 296, 14441, 29918, 9344, 29918, 14057, 29898, 17588, 1125, 13, 1678, 6410, 353, 20254, 29918, 19128, 29918, 296, 14441, 580, 334, 29871, 29906, 13, 13, 1678, 411, 11451, 1688, 29889, 4495, 1983, 29898, 2659, 22709, 1125, 13, 4706, 411, 289, 29886, 29898, 17588, 580, 1125, 13, 9651, 6410, 29889, 1627, 1328, 580, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 703, 17588, 613, 1294, 29918, 29906, 299, 29918, 2098, 29892, 18999, 29922, 1062, 29918, 29906, 299, 29918, 2098, 29918, 978, 29897, 13, 1753, 1243, 29918, 3676, 29918, 29882, 404, 713, 29918, 1545, 2164, 29918, 29885, 344, 29918, 9344, 29918, 14057, 29898, 17588, 1125, 13, 1678, 6410, 353, 20254, 29918, 29885, 344, 580, 334, 29871, 29906, 13, 13, 1678, 411, 11451, 1688, 29889, 4495, 1983, 29898, 2659, 22709, 1125, 13, 4706, 411, 289, 29886, 29898, 17588, 580, 1125, 13, 9651, 6410, 29889, 1627, 1328, 580, 13, 2 ]
openprocurement/auctions/dgf/tests/award.py
openprocurement/openprocurement.auctions.dgf
2
193715
<reponame>openprocurement/openprocurement.auctions.dgf # -*- coding: utf-8 -*- import unittest from datetime import timedelta from openprocurement.auctions.core.utils import get_now from openprocurement.auctions.core.tests.award import ( AuctionLotAwardResourceTestMixin, Auction2LotAwardResourceTestMixin, AuctionAwardDocumentResourceTestMixin, AuctionLotAwardComplaintResourceTestMixin, Auction2LotAwardComplaintResourceTestMixin, AuctionAwardComplaintDocumentResourceTestMixin, Auction2LotAwardComplaintDocumentResourceTestMixin, Auction2LotAwardDocumentResourceTestMixin ) from openprocurement.auctions.core.tests.base import snitch from openprocurement.auctions.core.tests.blanks.award_blanks import ( get_auction_award_complaint, get_auction_award_complaints ) from openprocurement.auctions.core.plugins.awarding.v3.tests.award import ( AuctionAwardProcessTestMixin, CreateAuctionAwardTestMixin ) from openprocurement.auctions.dgf.tests.base import ( BaseAuctionWebTest, test_bids, test_lots, test_financial_auction_data, test_financial_bids, test_financial_organization, ) class CreateAuctionAwardTest(BaseAuctionWebTest, CreateAuctionAwardTestMixin): # initial_data = auction_data initial_status = 'active.auction' initial_bids = test_bids class AuctionAwardProcessTest(BaseAuctionWebTest, AuctionAwardProcessTestMixin): # initial_data = auction_data initial_status = 'active.auction' initial_bids = test_bids docservice = True def setUp(self): super(AuctionAwardProcessTest, self).setUp() authorization = self.app.authorization self.app.authorization = ('Basic', ('auction', '')) now = get_now() auction_result = { 'bids': [ { "id": b['id'], "date": (now - timedelta(seconds=i)).isoformat(), "value": b['value'] } for i, b in enumerate(self.initial_bids) ] } response = self.app.post_json('/auctions/{}/auction'.format(self.auction_id), {'data': auction_result}) self.assertEqual(response.status, '200 OK') self.assertEqual(response.content_type, 'application/json') auction = response.json['data'] self.assertEqual('active.qualification', auction["status"]) self.first_award = auction['awards'][0] self.second_award = auction['awards'][1] self.first_award_id = self.first_award['id'] self.second_award_id = self.second_award['id'] self.app.authorization = authorization def upload_auction_protocol(self, award): award_id = award['id'] bid_token = self.initial_bids_tokens[award['bid_id']] response = self.app.post('/auctions/{}/awards/{}/documents?acc_token={}'.format( self.auction_id, award_id, bid_token), upload_files=[('file', 'auction_protocol.pdf', 'content')]) self.assertEqual(response.status, '201 Created') self.assertEqual(response.content_type, 'application/json') doc_id = response.json["data"]['id'] self.assertIn(doc_id, response.headers['Location']) self.assertEqual('auction_protocol.pdf', response.json["data"]["title"]) key = response.json["data"]["url"].split('?')[-1] response = self.app.patch_json( '/auctions/{}/awards/{}/documents/{}?acc_token={}'.format(self.auction_id, award_id, doc_id, bid_token), {"data": { "description": "auction protocol", "documentType": 'auctionProtocol' }}) self.assertEqual(response.status, '200 OK') self.assertEqual(response.content_type, 'application/json') self.assertEqual(doc_id, response.json["data"]["id"]) self.assertIn("documentType", response.json["data"]) self.assertEqual(response.json["data"]["documentType"], 'auctionProtocol') response = self.app.post('/auctions/{}/awards/{}/documents?acc_token={}'.format( self.auction_id, award_id, self.auction_token), upload_files=[('file', 'auction_protocol.pdf', 'content')]) self.assertEqual(response.status, '201 Created') self.assertEqual(response.content_type, 'application/json') doc_id = response.json["data"]['id'] self.assertIn(doc_id, response.headers['Location']) self.assertEqual('auction_protocol.pdf', response.json["data"]["title"]) key = response.json["data"]["url"].split('?')[-1] response = self.app.patch_json( '/auctions/{}/awards/{}/documents/{}?acc_token={}'.format(self.auction_id, award_id, doc_id, self.auction_token), {"data": { "description": "auction protocol", "documentType": 'auctionProtocol' }}) self.assertEqual(response.status, '200 OK') self.assertEqual(response.content_type, 'application/json') self.assertEqual(doc_id, response.json["data"]["id"]) self.assertIn("documentType", response.json["data"]) self.assertEqual(response.json["data"]["documentType"], 'auctionProtocol') response = self.app.get('/auctions/{}/awards/{}/documents'.format(self.auction_id, award_id, doc_id)) self.assertEqual(response.status, '200 OK') self.assertEqual(response.content_type, 'application/json') self.assertEqual('auctionProtocol', response.json["data"][0]["documentType"]) self.assertEqual('auction_protocol.pdf', response.json["data"][0]["title"]) self.assertEqual('bid_owner', response.json["data"][0]["author"]) self.assertEqual('auctionProtocol', response.json["data"][1]["documentType"]) self.assertEqual('auction_owner', response.json["data"][1]["author"]) @unittest.skip("option not available") class AuctionLotAwardResourceTest(BaseAuctionWebTest, AuctionLotAwardResourceTestMixin): initial_status = 'active.qualification' initial_lots = test_lots initial_bids = test_bids @unittest.skip("option not available") class Auction2LotAwardResourceTest(BaseAuctionWebTest, Auction2LotAwardResourceTestMixin): initial_status = 'active.qualification' initial_lots = 2 * test_lots initial_bids = test_bids # test_create_auction_award_2_lots = snitch(create_auction_award_2_lots) # test_patch_auction_award_2_lots = snitch(patch_auction_award_2_lots) @unittest.skip("option not available") class AuctionLotAwardComplaintResourceTest(BaseAuctionWebTest, AuctionLotAwardComplaintResourceTestMixin): # initial_data = auction_data initial_status = 'active.qualification' initial_lots = test_lots initial_bids = test_bids def setUp(self): super(AuctionLotAwardComplaintResourceTest, self).setUp() # Create award bid = self.initial_bids[0] response = self.app.post_json('/auctions/{}/awards'.format( self.auction_id), { 'data': {'suppliers': [self.initial_organization], 'status': 'pending', 'bid_id': bid['id'], 'lotID': bid['lotValues'][0]['relatedLot']}}) award = response.json['data'] self.award_id = award['id'] @unittest.skip("option not available") class Auction2LotAwardComplaintResourceTest(BaseAuctionWebTest, Auction2LotAwardComplaintResourceTestMixin): initial_status = 'active.qualification' initial_lots = 2 * test_lots initial_bids = test_bids test_get_auction_award_complaint = snitch(get_auction_award_complaint) test_get_auction_award_complaints = snitch(get_auction_award_complaints) @unittest.skip("option not available") class AuctionAwardComplaintDocumentResourceTest(BaseAuctionWebTest, AuctionAwardComplaintDocumentResourceTestMixin): initial_status = 'active.qualification' initial_bids = test_bids def setUp(self): super(AuctionAwardComplaintDocumentResourceTest, self).setUp() # Create award response = self.app.post_json('/auctions/{}/awards'.format( self.auction_id), {'data': {'suppliers': [self.initial_organization], 'status': 'pending', 'bid_id': self.initial_bids[0]['id']}}) award = response.json['data'] self.award_id = award['id'] # Create complaint for award response = self.app.post_json('/auctions/{}/awards/{}/complaints'.format( self.auction_id, self.award_id), { 'data': {'title': 'complaint title', 'description': 'complaint description', 'author': self.initial_organization}}) complaint = response.json['data'] self.complaint_id = complaint['id'] self.complaint_owner_token = response.json['access']['token'] @unittest.skip("option not available") class Auction2LotAwardComplaintDocumentResourceTest(BaseAuctionWebTest, Auction2LotAwardComplaintDocumentResourceTestMixin): initial_status = 'active.qualification' initial_bids = test_bids initial_lots = 2 * test_lots def setUp(self): super(Auction2LotAwardComplaintDocumentResourceTest, self).setUp() # Create award bid = self.initial_bids[0] response = self.app.post_json('/auctions/{}/awards'.format( self.auction_id), { 'data': {'suppliers': [self.initial_organization], 'status': 'pending', 'bid_id': bid['id'], 'lotID': bid['lotValues'][0]['relatedLot']}}) award = response.json['data'] self.award_id = award['id'] # Create complaint for award response = self.app.post_json('/auctions/{}/awards/{}/complaints'.format( self.auction_id, self.award_id), { 'data': {'title': 'complaint title', 'description': 'complaint description', 'author': self.initial_organization}}) complaint = response.json['data'] self.complaint_id = complaint['id'] self.complaint_owner_token = response.json['access']['token'] class AuctionAwardDocumentResourceTest(BaseAuctionWebTest, AuctionAwardDocumentResourceTestMixin): initial_status = 'active.auction' initial_bids = test_bids def setUp(self): super(AuctionAwardDocumentResourceTest, self).setUp() authorization = self.app.authorization self.app.authorization = ('Basic', ('auction', '')) now = get_now() auction_result = { 'bids': [ { "id": b['id'], "date": (now - timedelta(seconds=i)).isoformat(), "value": b['value'] } for i, b in enumerate(self.initial_bids) ] } response = self.app.post_json('/auctions/{}/auction'.format(self.auction_id), {'data': auction_result}) self.assertEqual(response.status, '200 OK') self.assertEqual(response.content_type, 'application/json') auction = response.json['data'] self.assertEqual('active.qualification', auction["status"]) self.first_award = auction['awards'][0] self.second_award = auction['awards'][1] self.first_award_id = self.first_award['id'] self.second_award_id = self.second_award['id'] self.app.authorization = authorization # test_not_found_document = snitch(not_found_document) # test_create_auction_award_document = snitch(create_auction_award_document) # test_put_auction_award_document = snitch(put_auction_award_document) # test_patch_auction_award_document = snitch(patch_auction_award_document) @unittest.skip("option not available") class Auction2LotAwardDocumentResourceTest(BaseAuctionWebTest, Auction2LotAwardDocumentResourceTestMixin): initial_status = 'active.qualification' initial_bids = test_bids initial_lots = 2 * test_lots def setUp(self): super(Auction2LotAwardDocumentResourceTest, self).setUp() # Create award bid = self.initial_bids[0] response = self.app.post_json('/auctions/{}/awards'.format( self.auction_id), { 'data': {'suppliers': [self.initial_organization], 'status': 'pending', 'bid_id': bid['id'], 'lotID': bid['lotValues'][0]['relatedLot']}}) award = response.json['data'] self.award_id = award['id'] class CreateFinancialAuctionAwardTest(CreateAuctionAwardTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization class FinancialAuctionAwardProcessTest(AuctionAwardProcessTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization @unittest.skip("option not available") class FinancialAuctionLotAwardResourceTest(AuctionLotAwardResourceTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization @unittest.skip("option not available") class FinancialAuction2LotAwardResourceTest(Auction2LotAwardResourceTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization @unittest.skip("option not available") class FinancialAuctionLotAwardComplaintResourceTest(AuctionLotAwardComplaintResourceTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data @unittest.skip("option not available") class FinancialAuction2LotAwardComplaintResourceTest(Auction2LotAwardComplaintResourceTest): initial_data = test_financial_auction_data initial_organization = test_financial_organization @unittest.skip("option not available") class FinancialAuctionAwardComplaintDocumentResourceTest(AuctionAwardComplaintDocumentResourceTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization @unittest.skip("option not available") class FinancialAuction2LotAwardComplaintDocumentResourceTest(Auction2LotAwardComplaintDocumentResourceTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization class FinancialAuctionAwardDocumentResourceTest(AuctionAwardDocumentResourceTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization @unittest.skip("option not available") class FinancialAuction2LotAwardDocumentResourceTest(Auction2LotAwardDocumentResourceTest): initial_bids = test_financial_bids initial_data = test_financial_auction_data initial_organization = test_financial_organization def suite(): tests = unittest.TestSuite() tests.addTest(unittest.makeSuite(CreateAuctionAwardTest)) tests.addTest(unittest.makeSuite(AuctionAwardProcessTest)) tests.addTest(unittest.makeSuite(AuctionLotAwardResourceTest)) tests.addTest(unittest.makeSuite(Auction2LotAwardResourceTest)) tests.addTest(unittest.makeSuite(AuctionLotAwardComplaintResourceTest)) tests.addTest(unittest.makeSuite(Auction2LotAwardComplaintResourceTest)) tests.addTest(unittest.makeSuite(AuctionAwardComplaintDocumentResourceTest)) tests.addTest(unittest.makeSuite(Auction2LotAwardComplaintDocumentResourceTest)) tests.addTest(unittest.makeSuite(AuctionAwardDocumentResourceTest)) tests.addTest(unittest.makeSuite(Auction2LotAwardDocumentResourceTest)) tests.addTest(unittest.makeSuite(CreateFinancialAuctionAwardTest)) tests.addTest(unittest.makeSuite(FinancialAuctionAwardProcessTest)) tests.addTest(unittest.makeSuite(FinancialAuctionLotAwardResourceTest)) tests.addTest(unittest.makeSuite(FinancialAuction2LotAwardResourceTest)) tests.addTest(unittest.makeSuite(FinancialAuctionLotAwardComplaintResourceTest)) tests.addTest(unittest.makeSuite(FinancialAuction2LotAwardComplaintResourceTest)) tests.addTest(unittest.makeSuite(FinancialAuctionAwardComplaintDocumentResourceTest)) tests.addTest(unittest.makeSuite(FinancialAuction2LotAwardComplaintDocumentResourceTest)) tests.addTest(unittest.makeSuite(FinancialAuctionAwardDocumentResourceTest)) tests.addTest(unittest.makeSuite(FinancialAuction2LotAwardDocumentResourceTest)) return tests if __name__ == '__main__': unittest.main(defaultTest='suite')
[ 1, 529, 276, 1112, 420, 29958, 3150, 15439, 545, 358, 29914, 3150, 15439, 545, 358, 29889, 585, 1953, 29889, 20726, 29888, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 443, 27958, 13, 13, 3166, 12865, 1053, 5335, 287, 2554, 13, 13, 3166, 1722, 15439, 545, 358, 29889, 585, 1953, 29889, 3221, 29889, 13239, 1053, 679, 29918, 3707, 13, 13, 3166, 1722, 15439, 545, 358, 29889, 585, 1953, 29889, 3221, 29889, 21150, 29889, 29874, 1328, 1053, 313, 13, 1678, 8407, 428, 29931, 327, 29909, 1328, 6848, 3057, 29924, 861, 262, 29892, 13, 1678, 8407, 428, 29906, 29931, 327, 29909, 1328, 6848, 3057, 29924, 861, 262, 29892, 13, 1678, 8407, 428, 29909, 1328, 6268, 6848, 3057, 29924, 861, 262, 29892, 13, 1678, 8407, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29924, 861, 262, 29892, 13, 1678, 8407, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29924, 861, 262, 29892, 13, 1678, 8407, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29924, 861, 262, 29892, 13, 1678, 8407, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29924, 861, 262, 29892, 13, 1678, 8407, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 29924, 861, 262, 13, 29897, 13, 3166, 1722, 15439, 545, 358, 29889, 585, 1953, 29889, 3221, 29889, 21150, 29889, 3188, 1053, 5807, 2335, 13, 3166, 1722, 15439, 545, 358, 29889, 585, 1953, 29889, 3221, 29889, 21150, 29889, 2204, 1331, 29889, 29874, 1328, 29918, 2204, 1331, 1053, 313, 13, 1678, 679, 29918, 585, 428, 29918, 29874, 1328, 29918, 2388, 433, 524, 29892, 13, 1678, 679, 29918, 585, 428, 29918, 29874, 1328, 29918, 2388, 433, 9466, 13, 29897, 13, 3166, 1722, 15439, 545, 358, 29889, 585, 1953, 29889, 3221, 29889, 12800, 29889, 29874, 1328, 292, 29889, 29894, 29941, 29889, 21150, 29889, 29874, 1328, 1053, 313, 13, 1678, 8407, 428, 29909, 1328, 7032, 3057, 29924, 861, 262, 29892, 13, 1678, 6204, 29909, 29884, 428, 29909, 1328, 3057, 29924, 861, 262, 13, 29897, 13, 13, 3166, 1722, 15439, 545, 358, 29889, 585, 1953, 29889, 20726, 29888, 29889, 21150, 29889, 3188, 1053, 313, 13, 1678, 7399, 29909, 29884, 428, 3609, 3057, 29892, 1243, 29918, 29890, 4841, 29892, 13, 1678, 1243, 29918, 29880, 1862, 29892, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 29892, 13, 1678, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 29892, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 29892, 13, 29897, 13, 13, 13, 1990, 6204, 29909, 29884, 428, 29909, 1328, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 6204, 29909, 29884, 428, 29909, 1328, 3057, 29924, 861, 262, 1125, 13, 1678, 396, 2847, 29918, 1272, 353, 782, 428, 29918, 1272, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 585, 428, 29915, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 13, 13, 1990, 8407, 428, 29909, 1328, 7032, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 8407, 428, 29909, 1328, 7032, 3057, 29924, 861, 262, 1125, 13, 1678, 396, 2847, 29918, 1272, 353, 782, 428, 29918, 1272, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 585, 428, 29915, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 1678, 1574, 5509, 353, 5852, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29909, 29884, 428, 29909, 1328, 7032, 3057, 29892, 1583, 467, 842, 3373, 580, 13, 13, 4706, 28733, 353, 1583, 29889, 932, 29889, 8921, 2133, 13, 4706, 1583, 29889, 932, 29889, 8921, 2133, 353, 6702, 16616, 742, 6702, 585, 428, 742, 6629, 876, 13, 4706, 1286, 353, 679, 29918, 3707, 580, 13, 4706, 782, 428, 29918, 2914, 353, 426, 13, 9651, 525, 29890, 4841, 2396, 518, 13, 18884, 426, 13, 462, 1678, 376, 333, 1115, 289, 1839, 333, 7464, 13, 462, 1678, 376, 1256, 1115, 313, 3707, 448, 5335, 287, 2554, 29898, 23128, 29922, 29875, 8106, 10718, 4830, 3285, 13, 462, 1678, 376, 1767, 1115, 289, 1839, 1767, 2033, 13, 18884, 500, 13, 18884, 363, 474, 29892, 289, 297, 26985, 29898, 1311, 29889, 11228, 29918, 29890, 4841, 29897, 13, 9651, 4514, 13, 4706, 500, 13, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 585, 428, 4286, 4830, 29898, 1311, 29889, 585, 428, 29918, 333, 511, 11117, 1272, 2396, 782, 428, 29918, 2914, 1800, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29892, 525, 29906, 29900, 29900, 9280, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3051, 29918, 1853, 29892, 525, 6214, 29914, 3126, 1495, 13, 4706, 782, 428, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 9294, 9843, 877, 4925, 29889, 15380, 2450, 742, 782, 428, 3366, 4882, 20068, 13, 4706, 1583, 29889, 4102, 29918, 29874, 1328, 353, 782, 428, 1839, 29874, 2935, 2033, 29961, 29900, 29962, 13, 4706, 1583, 29889, 7496, 29918, 29874, 1328, 353, 782, 428, 1839, 29874, 2935, 2033, 29961, 29896, 29962, 13, 4706, 1583, 29889, 4102, 29918, 29874, 1328, 29918, 333, 353, 1583, 29889, 4102, 29918, 29874, 1328, 1839, 333, 2033, 13, 4706, 1583, 29889, 7496, 29918, 29874, 1328, 29918, 333, 353, 1583, 29889, 7496, 29918, 29874, 1328, 1839, 333, 2033, 13, 4706, 1583, 29889, 932, 29889, 8921, 2133, 353, 28733, 13, 13, 1678, 822, 6441, 29918, 585, 428, 29918, 20464, 29898, 1311, 29892, 9862, 1125, 13, 4706, 9862, 29918, 333, 353, 9862, 1839, 333, 2033, 13, 4706, 21000, 29918, 6979, 353, 1583, 29889, 11228, 29918, 29890, 4841, 29918, 517, 12360, 29961, 29874, 1328, 1839, 23883, 29918, 333, 2033, 29962, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 11219, 585, 1953, 19248, 6822, 29874, 2935, 19248, 6822, 3225, 29879, 29973, 5753, 29918, 6979, 3790, 29913, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 29892, 9862, 29918, 333, 29892, 21000, 29918, 6979, 511, 6441, 29918, 5325, 11759, 877, 1445, 742, 525, 585, 428, 29918, 20464, 29889, 5140, 742, 525, 3051, 1495, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29892, 525, 29906, 29900, 29896, 6760, 630, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3051, 29918, 1853, 29892, 525, 6214, 29914, 3126, 1495, 13, 4706, 1574, 29918, 333, 353, 2933, 29889, 3126, 3366, 1272, 3108, 1839, 333, 2033, 13, 4706, 1583, 29889, 9294, 797, 29898, 1514, 29918, 333, 29892, 2933, 29889, 13662, 1839, 6508, 11287, 13, 4706, 1583, 29889, 9294, 9843, 877, 585, 428, 29918, 20464, 29889, 5140, 742, 2933, 29889, 3126, 3366, 1272, 3108, 3366, 3257, 20068, 13, 4706, 1820, 353, 2933, 29889, 3126, 3366, 1272, 3108, 3366, 2271, 16862, 5451, 877, 29973, 1495, 14352, 29896, 29962, 13, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 5041, 29918, 3126, 29898, 13, 9651, 8207, 585, 1953, 19248, 6822, 29874, 2935, 19248, 6822, 3225, 29879, 29914, 8875, 29973, 5753, 29918, 6979, 3790, 29913, 4286, 4830, 29898, 1311, 29889, 585, 428, 29918, 333, 29892, 9862, 29918, 333, 29892, 1574, 29918, 333, 29892, 21000, 29918, 6979, 511, 13, 9651, 8853, 1272, 1115, 426, 13, 18884, 376, 8216, 1115, 376, 585, 428, 9608, 613, 13, 18884, 376, 3225, 1542, 1115, 525, 585, 428, 17830, 29915, 13, 9651, 500, 1800, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29892, 525, 29906, 29900, 29900, 9280, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3051, 29918, 1853, 29892, 525, 6214, 29914, 3126, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1514, 29918, 333, 29892, 2933, 29889, 3126, 3366, 1272, 3108, 3366, 333, 20068, 13, 4706, 1583, 29889, 9294, 797, 703, 3225, 1542, 613, 2933, 29889, 3126, 3366, 1272, 20068, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3126, 3366, 1272, 3108, 3366, 3225, 1542, 12436, 525, 585, 428, 17830, 1495, 13, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 11219, 585, 1953, 19248, 6822, 29874, 2935, 19248, 6822, 3225, 29879, 29973, 5753, 29918, 6979, 3790, 29913, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 29892, 9862, 29918, 333, 29892, 1583, 29889, 585, 428, 29918, 6979, 511, 6441, 29918, 5325, 11759, 877, 1445, 742, 525, 585, 428, 29918, 20464, 29889, 5140, 742, 525, 3051, 1495, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29892, 525, 29906, 29900, 29896, 6760, 630, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3051, 29918, 1853, 29892, 525, 6214, 29914, 3126, 1495, 13, 4706, 1574, 29918, 333, 353, 2933, 29889, 3126, 3366, 1272, 3108, 1839, 333, 2033, 13, 4706, 1583, 29889, 9294, 797, 29898, 1514, 29918, 333, 29892, 2933, 29889, 13662, 1839, 6508, 11287, 13, 4706, 1583, 29889, 9294, 9843, 877, 585, 428, 29918, 20464, 29889, 5140, 742, 2933, 29889, 3126, 3366, 1272, 3108, 3366, 3257, 20068, 13, 4706, 1820, 353, 2933, 29889, 3126, 3366, 1272, 3108, 3366, 2271, 16862, 5451, 877, 29973, 1495, 14352, 29896, 29962, 13, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 5041, 29918, 3126, 29898, 13, 9651, 8207, 585, 1953, 19248, 6822, 29874, 2935, 19248, 6822, 3225, 29879, 29914, 8875, 29973, 5753, 29918, 6979, 3790, 29913, 4286, 4830, 29898, 1311, 29889, 585, 428, 29918, 333, 29892, 9862, 29918, 333, 29892, 1574, 29918, 333, 29892, 13, 462, 462, 462, 462, 418, 1583, 29889, 585, 428, 29918, 6979, 511, 13, 9651, 8853, 1272, 1115, 426, 13, 18884, 376, 8216, 1115, 376, 585, 428, 9608, 613, 13, 18884, 376, 3225, 1542, 1115, 525, 585, 428, 17830, 29915, 13, 9651, 500, 1800, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29892, 525, 29906, 29900, 29900, 9280, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3051, 29918, 1853, 29892, 525, 6214, 29914, 3126, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1514, 29918, 333, 29892, 2933, 29889, 3126, 3366, 1272, 3108, 3366, 333, 20068, 13, 4706, 1583, 29889, 9294, 797, 703, 3225, 1542, 613, 2933, 29889, 3126, 3366, 1272, 20068, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3126, 3366, 1272, 3108, 3366, 3225, 1542, 12436, 525, 585, 428, 17830, 1495, 13, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 657, 11219, 585, 1953, 19248, 6822, 29874, 2935, 19248, 6822, 3225, 29879, 4286, 4830, 29898, 1311, 29889, 585, 428, 29918, 333, 29892, 9862, 29918, 333, 29892, 1574, 29918, 333, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29892, 525, 29906, 29900, 29900, 9280, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3051, 29918, 1853, 29892, 525, 6214, 29914, 3126, 1495, 13, 4706, 1583, 29889, 9294, 9843, 877, 585, 428, 17830, 742, 2933, 29889, 3126, 3366, 1272, 3108, 29961, 29900, 29962, 3366, 3225, 1542, 20068, 13, 4706, 1583, 29889, 9294, 9843, 877, 585, 428, 29918, 20464, 29889, 5140, 742, 2933, 29889, 3126, 3366, 1272, 3108, 29961, 29900, 29962, 3366, 3257, 20068, 13, 4706, 1583, 29889, 9294, 9843, 877, 23883, 29918, 20348, 742, 2933, 29889, 3126, 3366, 1272, 3108, 29961, 29900, 29962, 3366, 8921, 20068, 13, 4706, 1583, 29889, 9294, 9843, 877, 585, 428, 17830, 742, 2933, 29889, 3126, 3366, 1272, 3108, 29961, 29896, 29962, 3366, 3225, 1542, 20068, 13, 4706, 1583, 29889, 9294, 9843, 877, 585, 428, 29918, 20348, 742, 2933, 29889, 3126, 3366, 1272, 3108, 29961, 29896, 29962, 3366, 8921, 20068, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 8407, 428, 29931, 327, 29909, 1328, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 8407, 428, 29931, 327, 29909, 1328, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 15380, 2450, 29915, 13, 1678, 2847, 29918, 29880, 1862, 353, 1243, 29918, 29880, 1862, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 8407, 428, 29906, 29931, 327, 29909, 1328, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 8407, 428, 29906, 29931, 327, 29909, 1328, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 15380, 2450, 29915, 13, 1678, 2847, 29918, 29880, 1862, 353, 29871, 29906, 334, 1243, 29918, 29880, 1862, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 13, 1678, 396, 1243, 29918, 3258, 29918, 585, 428, 29918, 29874, 1328, 29918, 29906, 29918, 29880, 1862, 353, 5807, 2335, 29898, 3258, 29918, 585, 428, 29918, 29874, 1328, 29918, 29906, 29918, 29880, 1862, 29897, 13, 1678, 396, 1243, 29918, 5041, 29918, 585, 428, 29918, 29874, 1328, 29918, 29906, 29918, 29880, 1862, 353, 5807, 2335, 29898, 5041, 29918, 585, 428, 29918, 29874, 1328, 29918, 29906, 29918, 29880, 1862, 29897, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 8407, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 13, 462, 462, 965, 8407, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 396, 2847, 29918, 1272, 353, 782, 428, 29918, 1272, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 15380, 2450, 29915, 13, 1678, 2847, 29918, 29880, 1862, 353, 1243, 29918, 29880, 1862, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29909, 29884, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 396, 6204, 9862, 13, 4706, 21000, 353, 1583, 29889, 11228, 29918, 29890, 4841, 29961, 29900, 29962, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 29874, 2935, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 511, 426, 13, 9651, 525, 1272, 2396, 11117, 19303, 27801, 2396, 518, 1311, 29889, 11228, 29918, 6388, 2133, 1402, 525, 4882, 2396, 525, 29886, 2548, 742, 525, 23883, 29918, 333, 2396, 21000, 1839, 333, 7464, 13, 462, 268, 525, 8276, 1367, 2396, 21000, 1839, 8276, 9065, 2033, 29961, 29900, 22322, 12817, 29931, 327, 2033, 24289, 13, 4706, 9862, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 29874, 1328, 29918, 333, 353, 9862, 1839, 333, 2033, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 8407, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 13, 462, 462, 9651, 8407, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 15380, 2450, 29915, 13, 1678, 2847, 29918, 29880, 1862, 353, 29871, 29906, 334, 1243, 29918, 29880, 1862, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 13, 1678, 1243, 29918, 657, 29918, 585, 428, 29918, 29874, 1328, 29918, 2388, 433, 524, 353, 5807, 2335, 29898, 657, 29918, 585, 428, 29918, 29874, 1328, 29918, 2388, 433, 524, 29897, 13, 1678, 1243, 29918, 657, 29918, 585, 428, 29918, 29874, 1328, 29918, 2388, 433, 9466, 353, 5807, 2335, 29898, 657, 29918, 585, 428, 29918, 29874, 1328, 29918, 2388, 433, 9466, 29897, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 8407, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 13, 462, 462, 18884, 8407, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 15380, 2450, 29915, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29909, 29884, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 396, 6204, 9862, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 29874, 2935, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 511, 11117, 1272, 2396, 11117, 19303, 27801, 2396, 518, 1311, 29889, 11228, 29918, 6388, 2133, 1402, 525, 4882, 2396, 525, 29886, 2548, 742, 13, 462, 462, 4706, 525, 23883, 29918, 333, 2396, 1583, 29889, 11228, 29918, 29890, 4841, 29961, 29900, 22322, 333, 2033, 24289, 13, 4706, 9862, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 29874, 1328, 29918, 333, 353, 9862, 1839, 333, 2033, 13, 4706, 396, 6204, 15313, 524, 363, 9862, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 29874, 2935, 19248, 6822, 2388, 433, 9466, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 29892, 1583, 29889, 29874, 1328, 29918, 333, 511, 426, 13, 9651, 525, 1272, 2396, 11117, 3257, 2396, 525, 2388, 433, 524, 3611, 742, 525, 8216, 2396, 525, 2388, 433, 524, 6139, 742, 13, 462, 268, 525, 8921, 2396, 1583, 29889, 11228, 29918, 6388, 2133, 24289, 13, 4706, 15313, 524, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 2388, 433, 524, 29918, 333, 353, 15313, 524, 1839, 333, 2033, 13, 4706, 1583, 29889, 2388, 433, 524, 29918, 20348, 29918, 6979, 353, 2933, 29889, 3126, 1839, 5943, 16215, 6979, 2033, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 8407, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 13, 462, 462, 462, 1678, 8407, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 15380, 2450, 29915, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 1678, 2847, 29918, 29880, 1862, 353, 29871, 29906, 334, 1243, 29918, 29880, 1862, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 396, 6204, 9862, 13, 4706, 21000, 353, 1583, 29889, 11228, 29918, 29890, 4841, 29961, 29900, 29962, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 29874, 2935, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 511, 426, 13, 9651, 525, 1272, 2396, 11117, 19303, 27801, 2396, 518, 1311, 29889, 11228, 29918, 6388, 2133, 1402, 525, 4882, 2396, 525, 29886, 2548, 742, 525, 23883, 29918, 333, 2396, 21000, 1839, 333, 7464, 13, 462, 268, 525, 8276, 1367, 2396, 21000, 1839, 8276, 9065, 2033, 29961, 29900, 22322, 12817, 29931, 327, 2033, 24289, 13, 4706, 9862, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 29874, 1328, 29918, 333, 353, 9862, 1839, 333, 2033, 13, 4706, 396, 6204, 15313, 524, 363, 9862, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 29874, 2935, 19248, 6822, 2388, 433, 9466, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 29892, 1583, 29889, 29874, 1328, 29918, 333, 511, 426, 13, 9651, 525, 1272, 2396, 11117, 3257, 2396, 525, 2388, 433, 524, 3611, 742, 525, 8216, 2396, 525, 2388, 433, 524, 6139, 742, 13, 462, 268, 525, 8921, 2396, 1583, 29889, 11228, 29918, 6388, 2133, 24289, 13, 4706, 15313, 524, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 2388, 433, 524, 29918, 333, 353, 15313, 524, 1839, 333, 2033, 13, 4706, 1583, 29889, 2388, 433, 524, 29918, 20348, 29918, 6979, 353, 2933, 29889, 3126, 1839, 5943, 16215, 6979, 2033, 13, 13, 13, 1990, 8407, 428, 29909, 1328, 6268, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 13, 462, 462, 539, 8407, 428, 29909, 1328, 6268, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 585, 428, 29915, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29909, 29884, 428, 29909, 1328, 6268, 6848, 3057, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 28733, 353, 1583, 29889, 932, 29889, 8921, 2133, 13, 4706, 1583, 29889, 932, 29889, 8921, 2133, 353, 6702, 16616, 742, 6702, 585, 428, 742, 6629, 876, 13, 4706, 1286, 353, 679, 29918, 3707, 580, 13, 4706, 782, 428, 29918, 2914, 353, 426, 13, 9651, 525, 29890, 4841, 2396, 518, 13, 18884, 426, 13, 462, 1678, 376, 333, 1115, 289, 1839, 333, 7464, 13, 462, 1678, 376, 1256, 1115, 313, 3707, 448, 5335, 287, 2554, 29898, 23128, 29922, 29875, 8106, 10718, 4830, 3285, 13, 462, 1678, 376, 1767, 1115, 289, 1839, 1767, 2033, 13, 18884, 500, 13, 18884, 363, 474, 29892, 289, 297, 26985, 29898, 1311, 29889, 11228, 29918, 29890, 4841, 29897, 13, 9651, 4514, 13, 4706, 500, 13, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 585, 428, 4286, 4830, 29898, 1311, 29889, 585, 428, 29918, 333, 511, 11117, 1272, 2396, 782, 428, 29918, 2914, 1800, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29892, 525, 29906, 29900, 29900, 9280, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3051, 29918, 1853, 29892, 525, 6214, 29914, 3126, 1495, 13, 4706, 782, 428, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 9294, 9843, 877, 4925, 29889, 15380, 2450, 742, 782, 428, 3366, 4882, 20068, 13, 4706, 1583, 29889, 4102, 29918, 29874, 1328, 353, 782, 428, 1839, 29874, 2935, 2033, 29961, 29900, 29962, 13, 4706, 1583, 29889, 7496, 29918, 29874, 1328, 353, 782, 428, 1839, 29874, 2935, 2033, 29961, 29896, 29962, 13, 4706, 1583, 29889, 4102, 29918, 29874, 1328, 29918, 333, 353, 1583, 29889, 4102, 29918, 29874, 1328, 1839, 333, 2033, 13, 4706, 1583, 29889, 7496, 29918, 29874, 1328, 29918, 333, 353, 1583, 29889, 7496, 29918, 29874, 1328, 1839, 333, 2033, 13, 4706, 1583, 29889, 932, 29889, 8921, 2133, 353, 28733, 13, 13, 4706, 396, 1243, 29918, 1333, 29918, 11940, 29918, 3225, 353, 5807, 2335, 29898, 1333, 29918, 11940, 29918, 3225, 29897, 13, 4706, 396, 1243, 29918, 3258, 29918, 585, 428, 29918, 29874, 1328, 29918, 3225, 353, 5807, 2335, 29898, 3258, 29918, 585, 428, 29918, 29874, 1328, 29918, 3225, 29897, 13, 4706, 396, 1243, 29918, 649, 29918, 585, 428, 29918, 29874, 1328, 29918, 3225, 353, 5807, 2335, 29898, 649, 29918, 585, 428, 29918, 29874, 1328, 29918, 3225, 29897, 13, 4706, 396, 1243, 29918, 5041, 29918, 585, 428, 29918, 29874, 1328, 29918, 3225, 353, 5807, 2335, 29898, 5041, 29918, 585, 428, 29918, 29874, 1328, 29918, 3225, 29897, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 8407, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 29898, 5160, 29909, 29884, 428, 3609, 3057, 29892, 13, 462, 462, 965, 8407, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 29924, 861, 262, 1125, 13, 1678, 2847, 29918, 4882, 353, 525, 4925, 29889, 15380, 2450, 29915, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 29890, 4841, 13, 1678, 2847, 29918, 29880, 1862, 353, 29871, 29906, 334, 1243, 29918, 29880, 1862, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 29892, 1583, 467, 842, 3373, 580, 13, 4706, 396, 6204, 9862, 13, 4706, 21000, 353, 1583, 29889, 11228, 29918, 29890, 4841, 29961, 29900, 29962, 13, 4706, 2933, 353, 1583, 29889, 932, 29889, 2490, 29918, 3126, 11219, 585, 1953, 19248, 6822, 29874, 2935, 4286, 4830, 29898, 13, 9651, 1583, 29889, 585, 428, 29918, 333, 511, 426, 13, 9651, 525, 1272, 2396, 11117, 19303, 27801, 2396, 518, 1311, 29889, 11228, 29918, 6388, 2133, 1402, 525, 4882, 2396, 525, 29886, 2548, 742, 525, 23883, 29918, 333, 2396, 21000, 1839, 333, 7464, 13, 462, 268, 525, 8276, 1367, 2396, 21000, 1839, 8276, 9065, 2033, 29961, 29900, 22322, 12817, 29931, 327, 2033, 24289, 13, 4706, 9862, 353, 2933, 29889, 3126, 1839, 1272, 2033, 13, 4706, 1583, 29889, 29874, 1328, 29918, 333, 353, 9862, 1839, 333, 2033, 13, 13, 13, 1990, 6204, 12881, 273, 1455, 29909, 29884, 428, 29909, 1328, 3057, 29898, 4391, 29909, 29884, 428, 29909, 1328, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29909, 1328, 7032, 3057, 29898, 29909, 29884, 428, 29909, 1328, 7032, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29931, 327, 29909, 1328, 6848, 3057, 29898, 29909, 29884, 428, 29931, 327, 29909, 1328, 6848, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6848, 3057, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6848, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29898, 29909, 29884, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 1125, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29898, 29909, 29884, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29909, 1328, 6268, 6848, 3057, 29898, 29909, 29884, 428, 29909, 1328, 6268, 6848, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 703, 3385, 451, 3625, 1159, 13, 1990, 4231, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 1125, 13, 1678, 2847, 29918, 29890, 4841, 353, 1243, 29918, 4951, 273, 1455, 29918, 29890, 4841, 13, 1678, 2847, 29918, 1272, 353, 1243, 29918, 4951, 273, 1455, 29918, 585, 428, 29918, 1272, 13, 1678, 2847, 29918, 6388, 2133, 353, 1243, 29918, 4951, 273, 1455, 29918, 6388, 2133, 13, 13, 13, 1753, 9460, 7295, 13, 1678, 6987, 353, 443, 27958, 29889, 3057, 5091, 568, 580, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 4391, 29909, 29884, 428, 29909, 1328, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29909, 1328, 7032, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29931, 327, 29909, 1328, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29909, 1328, 6268, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 4391, 12881, 273, 1455, 29909, 29884, 428, 29909, 1328, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29909, 1328, 7032, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29931, 327, 29909, 1328, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6843, 433, 524, 6268, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29909, 1328, 6268, 6848, 3057, 876, 13, 1678, 6987, 29889, 1202, 3057, 29898, 348, 27958, 29889, 5675, 5091, 568, 29898, 12881, 273, 1455, 29909, 29884, 428, 29906, 29931, 327, 29909, 1328, 6268, 6848, 3057, 876, 13, 1678, 736, 6987, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 29898, 4381, 3057, 2433, 13495, 1495, 2 ]
netrd/reconstruction/marchenko_pastur.py
Carromattsson/netrd
0
97371
""" marchenko_pastur.py -------------- Graph reconstruction algorithm based on <NAME>., & <NAME>. (1967). Distribution of eigenvalues for some sets of random matrices. Matematicheskii Sbornik, 114(4), 507-536. author: <NAME> Submitted as part of the 2019 NetSI Collabathon. """ from .base import BaseReconstructor import numpy as np import networkx as nx from ..utilities import create_graph, threshold class MarchenkoPastur(BaseReconstructor): def fit(self, TS, remove_largest=False, metric_distance=False, threshold_type='range', **kwargs): """Create a correlation-based graph using Marchenko-Pastur law to remove noise. A signed graph is built by constructing a projection of the empirical correlation matrix generated from the time series data after having removed *noisy* components. This method combines the results presented in [1],[2], and [3]. Params ------ TS (np.ndarray): $N \\times L$ array consisting of $L$ observations from $N$ sensors. remove_largest (bool), optional: If ``False``, all the eigenvectors associated to the significant eigenvalues will be used to reconstruct the de-noised empirical correlation matrix. If ``True``, the eigenvector associated to the largest eigenvalue (normally known as the ``market`` mode, [2]) is going to be excluded from the recontruction step. metric_distance (bool), optional: If ``False``, a signed graph is obtained. The weights associated to the edges represent the de-noised correlation coefficient $\\rho_{i,j}$ between time series $i$ and $j$. If ``True``, the correlation is transformed by defining a metric distance between each pair of nodes where $d_{i,j} = \\sqrt{2(1-\\rho_{i,j})}$ as proposed in [3]. threshold_type (str): Which thresholding function to use on the matrix of weights. See `netrd.utilities.threshold.py` for documentation. Pass additional arguments to the thresholder using `**kwargs`. Returns ------- G (nx.Graph): A reconstructed graph with $N$ nodes. Example -------- import numpy as np import networkx as nx from matplotlib import pyplot as plt from netrd.reconstruction import MarchenkoPastur N = 250 T = 300 M = np.random.normal(size=(N,T)) print('Create correlated time series') market_mode = 0.4*np.random.normal(size=(1,T)) M += market_mode sector_modes = {d: 0.5*np.random.normal(size=(1,T)) for d in range(5)} for sector_mode, vals in sector_modes.items(): M[sector_mode*50:(sector_mode+1)*50,:] += vals print('Network reconstruction step') mp_net = MarchenkoPastur() G = mp_net.fit(M, only_positive=True) G_no_market = mp_net.fit(M, only_positive=True, remove_largest=True) print('Observed noisy correlation') C = np.corrcoef(M) C[C<0] = 0 # remove negative values np.fill_diagonal(C,0) # remove self-loops G_noisy = nx.from_numpy_array(C) # create graph print('Plot observed noisy correlation graph') fig, ax = plt.subplots() nx.draw(G_noisy, ax=ax) print('Plot reconstructed correlation graph') fig, ax = plt.subplots() nx.draw(G, ax=ax) print('Plot reconstructed correlation graph without market mode') fig, ax = plt.subplots() nx.draw(G_no_market, ax=ax) References ---------- .. [1] <NAME>., & <NAME>. (1967). Distribution of eigenvalues for some sets of random matrices. Matematicheskii Sbornik, 114(4), 507-536. http://www.mathnet.ru/links/a8d2a49dec161f50c944d9a96298c35a/sm4101.pdf .. [2] <NAME>., <NAME>., <NAME>., & <NAME>. (1999). Noise dressing of financial correlation matrices. Physical review letters, 83(7), 1467. https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.83.1467 .. [3] <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., & Mantegna, <NAME>. (2004). Networks of equities in financial markets. The European Physical Journal B, 38(2), 363-371. https://link.springer.com/article/10.1140/epjb/e2004-00129-6 """ N, L = TS.shape if N>L: raise ValueError("L must be greater or equal than N.") Q = L/N C = np.corrcoef(TS) # Empirical correlation matrix w, v = np.linalg.eigh(C) # Spectral decomposition of C w_min = (1+1/Q-2*np.sqrt(1/Q)) w_max = (1+1/Q+2*np.sqrt(1/Q)) selected = (w<w_min)|(w>w_max) if selected.sum()==0: G = nx.empty_graph(n=N) self.results['graph'] = G return G if remove_largest: selected[-1] = False w_signal = w[selected] v_signal = v[:,selected] C_signal = v_signal.dot(np.diag(w_signal)).dot(v_signal.T) if metric_distance: C_signal = np.sqrt(2*(1-C_signal)) self.results['matrix'] = C_signal #threshold signal matrix self.results['thresholded_matrix'] = threshold(C_signal, threshold_type, **kwargs) G = create_graph(self.results['thresholded_matrix']) self.results['graph'] = G return G
[ 1, 9995, 13, 29885, 1279, 264, 2901, 29918, 29886, 579, 332, 29889, 2272, 13, 9072, 489, 13, 13, 9527, 17789, 4080, 5687, 2729, 373, 529, 5813, 29958, 1696, 669, 529, 5813, 15513, 313, 29896, 29929, 29953, 29955, 467, 29871, 13, 13398, 3224, 310, 25973, 363, 777, 6166, 310, 4036, 13516, 29889, 5345, 4579, 436, 267, 1984, 29875, 29871, 13, 29903, 4939, 638, 29892, 29871, 29896, 29896, 29946, 29898, 29946, 511, 29871, 29945, 29900, 29955, 29899, 29945, 29941, 29953, 29889, 13, 13, 8921, 29901, 529, 5813, 29958, 13, 4035, 29885, 4430, 408, 760, 310, 278, 29871, 29906, 29900, 29896, 29929, 12670, 5425, 1530, 8205, 25206, 29889, 13, 15945, 29908, 13, 13, 3166, 869, 3188, 1053, 7399, 1123, 27821, 13, 5215, 12655, 408, 7442, 13, 5215, 3564, 29916, 408, 302, 29916, 13, 3166, 6317, 4422, 1907, 1053, 1653, 29918, 4262, 29892, 16897, 13, 13, 13, 1990, 1085, 2724, 2901, 29925, 579, 332, 29898, 5160, 1123, 27821, 1125, 13, 1678, 822, 6216, 29898, 1311, 29892, 323, 29903, 29892, 3349, 29918, 27489, 342, 29922, 8824, 29892, 12714, 29918, 19244, 29922, 8824, 29892, 16897, 29918, 1853, 2433, 3881, 742, 3579, 19290, 1125, 13, 4706, 9995, 4391, 263, 19869, 29899, 6707, 3983, 773, 1085, 2724, 2901, 29899, 29925, 579, 332, 4307, 304, 3349, 11462, 29889, 13, 308, 13, 4706, 319, 8794, 3983, 338, 4240, 491, 3386, 292, 263, 18246, 310, 278, 29190, 936, 19869, 29871, 13, 4706, 4636, 5759, 515, 278, 931, 3652, 848, 1156, 2534, 6206, 334, 1217, 13344, 29930, 7117, 29889, 29871, 13, 4706, 910, 1158, 4145, 1475, 278, 2582, 9132, 297, 518, 29896, 16272, 29906, 1402, 322, 518, 29941, 1822, 13, 13, 4706, 1459, 2232, 13, 4706, 448, 23648, 13, 4706, 323, 29903, 313, 9302, 29889, 299, 2378, 1125, 395, 29940, 2474, 3706, 365, 29938, 1409, 19849, 310, 395, 29931, 29938, 13917, 29871, 13, 462, 308, 515, 395, 29940, 29938, 4771, 943, 29889, 13, 4706, 3349, 29918, 27489, 342, 313, 11227, 511, 13136, 29901, 29871, 960, 4954, 8824, 29952, 1673, 599, 278, 7388, 345, 14359, 13, 4706, 6942, 304, 278, 7282, 25973, 674, 367, 1304, 304, 337, 11433, 13, 4706, 278, 316, 29899, 1217, 3368, 29190, 936, 19869, 4636, 29889, 960, 4954, 5574, 29952, 1673, 278, 7388, 8111, 13, 4706, 6942, 304, 278, 10150, 7388, 1767, 313, 12324, 635, 2998, 408, 278, 4954, 28549, 16159, 4464, 29892, 518, 29906, 2314, 13, 4706, 338, 2675, 304, 367, 429, 13347, 515, 278, 8265, 509, 29884, 428, 4331, 29889, 13, 4706, 12714, 29918, 19244, 313, 11227, 511, 13136, 29901, 960, 4954, 8824, 29952, 1673, 263, 8794, 3983, 338, 7625, 29889, 13, 4706, 450, 18177, 6942, 304, 278, 12770, 2755, 278, 316, 29899, 1217, 3368, 19869, 29871, 13, 4706, 10825, 779, 29905, 4650, 648, 29875, 29892, 29926, 1042, 1546, 931, 3652, 395, 29875, 29938, 322, 395, 29926, 1504, 29871, 13, 4706, 960, 4954, 5574, 29952, 1673, 278, 19869, 338, 27615, 491, 16184, 263, 12714, 5418, 29871, 13, 4706, 1546, 1269, 5101, 310, 7573, 988, 395, 29881, 648, 29875, 29892, 29926, 29913, 353, 2474, 3676, 29912, 29906, 29898, 29896, 29899, 1966, 4650, 648, 29875, 29892, 29926, 1800, 1042, 408, 29871, 13, 4706, 7972, 297, 518, 29941, 1822, 13, 4706, 16897, 29918, 1853, 313, 710, 1125, 8449, 16897, 292, 740, 304, 671, 373, 278, 4636, 310, 13, 4706, 18177, 29889, 2823, 421, 1212, 5499, 29889, 4422, 1907, 29889, 386, 12268, 29889, 2272, 29952, 363, 5106, 29889, 6978, 5684, 13, 4706, 6273, 304, 278, 266, 3781, 3194, 773, 421, 1068, 19290, 1412, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 402, 313, 23818, 29889, 9527, 1125, 319, 337, 11433, 287, 3983, 411, 395, 29940, 29938, 7573, 29889, 13, 13, 4706, 8741, 13, 4706, 448, 26589, 13, 13, 4706, 1053, 12655, 408, 7442, 13, 4706, 1053, 3564, 29916, 408, 302, 29916, 13, 4706, 515, 22889, 1053, 11451, 5317, 408, 14770, 13, 4706, 515, 7787, 5499, 29889, 276, 3075, 4080, 1053, 1085, 2724, 2901, 29925, 579, 332, 13, 13, 4706, 405, 353, 29871, 29906, 29945, 29900, 13, 4706, 323, 353, 29871, 29941, 29900, 29900, 13, 4706, 341, 353, 7442, 29889, 8172, 29889, 8945, 29898, 2311, 7607, 29940, 29892, 29911, 876, 13, 13, 4706, 1596, 877, 4391, 8855, 630, 931, 3652, 1495, 13, 4706, 9999, 29918, 8513, 353, 29871, 29900, 29889, 29946, 29930, 9302, 29889, 8172, 29889, 8945, 29898, 2311, 7607, 29896, 29892, 29911, 876, 13, 4706, 341, 4619, 9999, 29918, 8513, 13, 13, 4706, 17535, 29918, 1545, 267, 353, 426, 29881, 29901, 29871, 29900, 29889, 29945, 29930, 9302, 29889, 8172, 29889, 8945, 29898, 2311, 7607, 29896, 29892, 29911, 876, 363, 270, 297, 3464, 29898, 29945, 2915, 13, 4706, 363, 17535, 29918, 8513, 29892, 659, 29879, 297, 17535, 29918, 1545, 267, 29889, 7076, 7295, 13, 9651, 341, 29961, 344, 2801, 29918, 8513, 29930, 29945, 29900, 5919, 344, 2801, 29918, 8513, 29974, 29896, 11877, 29945, 29900, 29892, 17531, 4619, 659, 29879, 13, 13, 4706, 1596, 877, 13724, 17789, 4080, 4331, 1495, 13, 4706, 22326, 29918, 1212, 353, 1085, 2724, 2901, 29925, 579, 332, 580, 13, 4706, 402, 353, 22326, 29918, 1212, 29889, 9202, 29898, 29924, 29892, 871, 29918, 1066, 3321, 29922, 5574, 29897, 13, 4706, 402, 29918, 1217, 29918, 28549, 353, 22326, 29918, 1212, 29889, 9202, 29898, 29924, 29892, 871, 29918, 1066, 3321, 29922, 5574, 29892, 3349, 29918, 27489, 342, 29922, 5574, 29897, 13, 13, 4706, 1596, 877, 6039, 643, 1490, 694, 13344, 19869, 1495, 13, 4706, 315, 353, 7442, 29889, 29725, 1111, 1389, 29898, 29924, 29897, 13, 4706, 315, 29961, 29907, 29966, 29900, 29962, 353, 29871, 29900, 396, 3349, 8178, 1819, 13, 4706, 7442, 29889, 5589, 29918, 6051, 351, 7177, 29898, 29907, 29892, 29900, 29897, 396, 3349, 1583, 29899, 417, 3554, 13, 4706, 402, 29918, 1217, 13344, 353, 302, 29916, 29889, 3166, 29918, 23749, 29918, 2378, 29898, 29907, 29897, 396, 1653, 3983, 13, 13, 4706, 1596, 877, 20867, 8900, 694, 13344, 19869, 3983, 1495, 13, 4706, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 4706, 302, 29916, 29889, 4012, 29898, 29954, 29918, 1217, 13344, 29892, 4853, 29922, 1165, 29897, 13, 13, 4706, 1596, 877, 20867, 337, 11433, 287, 19869, 3983, 1495, 13, 4706, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 4706, 302, 29916, 29889, 4012, 29898, 29954, 29892, 4853, 29922, 1165, 29897, 13, 13, 4706, 1596, 877, 20867, 337, 11433, 287, 19869, 3983, 1728, 9999, 4464, 1495, 13, 4706, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 4706, 302, 29916, 29889, 4012, 29898, 29954, 29918, 1217, 29918, 28549, 29892, 4853, 29922, 1165, 29897, 13, 13, 13, 4706, 28318, 13, 4706, 448, 1378, 29899, 13, 4706, 6317, 518, 29896, 29962, 529, 5813, 29958, 1696, 669, 529, 5813, 15513, 313, 29896, 29929, 29953, 29955, 467, 17740, 310, 25973, 363, 29871, 13, 4706, 777, 6166, 310, 4036, 13516, 29889, 5345, 4579, 436, 267, 1984, 29875, 317, 4939, 638, 29892, 29871, 29896, 29896, 29946, 29898, 29946, 511, 29871, 29945, 29900, 29955, 29899, 29945, 29941, 29953, 29889, 13, 4706, 1732, 597, 1636, 29889, 755, 1212, 29889, 582, 29914, 4965, 29914, 29874, 29947, 29881, 29906, 29874, 29946, 29929, 7099, 29896, 29953, 29896, 29888, 29945, 29900, 29883, 29929, 29946, 29946, 29881, 29929, 29874, 29929, 29953, 29906, 29929, 29947, 29883, 29941, 29945, 29874, 29914, 3844, 29946, 29896, 29900, 29896, 29889, 5140, 13, 13, 4706, 6317, 518, 29906, 29962, 529, 5813, 29958, 1696, 529, 5813, 29958, 1696, 529, 5813, 29958, 1696, 669, 529, 5813, 15513, 313, 29896, 29929, 29929, 29929, 467, 1939, 895, 10714, 292, 29871, 13, 4706, 310, 18161, 19869, 13516, 29889, 11661, 936, 9076, 8721, 29892, 29871, 29947, 29941, 29898, 29955, 511, 29871, 29896, 29946, 29953, 29955, 29889, 13, 4706, 2045, 597, 29926, 2905, 1338, 29889, 2547, 29889, 990, 29914, 558, 29880, 29914, 16595, 29914, 29896, 29900, 29889, 29896, 29896, 29900, 29941, 29914, 25847, 1123, 29894, 29931, 1803, 29889, 29947, 29941, 29889, 29896, 29946, 29953, 29955, 13, 13, 4706, 6317, 518, 29941, 29962, 529, 5813, 29958, 1696, 529, 5813, 29958, 1696, 529, 5813, 29958, 1696, 529, 5813, 29958, 1696, 529, 5813, 29958, 1696, 669, 341, 1647, 29887, 1056, 29892, 29871, 13, 4706, 529, 5813, 15513, 313, 29906, 29900, 29900, 29946, 467, 8527, 29879, 310, 1592, 1907, 297, 18161, 2791, 1691, 29889, 450, 7824, 11661, 936, 8237, 29871, 13, 4706, 350, 29892, 29871, 29941, 29947, 29898, 29906, 511, 29871, 29941, 29953, 29941, 29899, 29941, 29955, 29896, 29889, 13, 4706, 2045, 597, 2324, 29889, 4278, 261, 29889, 510, 29914, 7914, 29914, 29896, 29900, 29889, 29896, 29896, 29946, 29900, 29914, 1022, 16761, 29914, 29872, 29906, 29900, 29900, 29946, 29899, 29900, 29900, 29896, 29906, 29929, 29899, 29953, 13, 13, 13, 4706, 9995, 13, 4706, 405, 29892, 365, 353, 323, 29903, 29889, 12181, 13, 4706, 565, 405, 29958, 29931, 29901, 13, 9651, 12020, 7865, 2392, 703, 29931, 1818, 367, 7621, 470, 5186, 1135, 405, 23157, 13, 13, 4706, 660, 353, 365, 29914, 29940, 13, 4706, 315, 353, 7442, 29889, 29725, 1111, 1389, 29898, 9375, 29897, 396, 7361, 381, 936, 19869, 4636, 13, 13, 4706, 281, 29892, 325, 353, 7442, 29889, 29880, 979, 29887, 29889, 29872, 1141, 29898, 29907, 29897, 396, 27738, 1705, 26227, 310, 315, 13, 13, 4706, 281, 29918, 1195, 353, 313, 29896, 29974, 29896, 29914, 29984, 29899, 29906, 29930, 9302, 29889, 3676, 29898, 29896, 29914, 29984, 876, 13, 4706, 281, 29918, 3317, 353, 313, 29896, 29974, 29896, 29914, 29984, 29974, 29906, 29930, 9302, 29889, 3676, 29898, 29896, 29914, 29984, 876, 13, 13, 4706, 4629, 353, 313, 29893, 29966, 29893, 29918, 1195, 10531, 29898, 29893, 29958, 29893, 29918, 3317, 29897, 13, 13, 4706, 565, 4629, 29889, 2083, 580, 1360, 29900, 29901, 13, 9651, 402, 353, 302, 29916, 29889, 6310, 29918, 4262, 29898, 29876, 29922, 29940, 29897, 13, 9651, 1583, 29889, 9902, 1839, 4262, 2033, 353, 402, 13, 9651, 736, 402, 13, 13, 4706, 565, 3349, 29918, 27489, 342, 29901, 13, 9651, 4629, 14352, 29896, 29962, 353, 7700, 13, 13, 4706, 281, 29918, 25436, 353, 281, 29961, 8391, 29962, 13, 4706, 325, 29918, 25436, 353, 325, 7503, 29892, 8391, 29962, 13, 13, 4706, 315, 29918, 25436, 353, 325, 29918, 25436, 29889, 6333, 29898, 9302, 29889, 6051, 351, 29898, 29893, 29918, 25436, 8106, 6333, 29898, 29894, 29918, 25436, 29889, 29911, 29897, 13, 13, 4706, 565, 12714, 29918, 19244, 29901, 13, 9651, 315, 29918, 25436, 353, 7442, 29889, 3676, 29898, 29906, 16395, 29896, 29899, 29907, 29918, 25436, 876, 13, 13, 4706, 1583, 29889, 9902, 1839, 5344, 2033, 353, 315, 29918, 25436, 13, 13, 4706, 396, 386, 12268, 7182, 4636, 13, 13, 4706, 1583, 29889, 9902, 1839, 386, 12268, 287, 29918, 5344, 2033, 353, 16897, 29898, 29907, 29918, 25436, 29892, 16897, 29918, 1853, 29892, 3579, 19290, 29897, 13, 13, 4706, 402, 353, 1653, 29918, 4262, 29898, 1311, 29889, 9902, 1839, 386, 12268, 287, 29918, 5344, 11287, 13, 13, 4706, 1583, 29889, 9902, 1839, 4262, 2033, 353, 402, 13, 4706, 736, 402, 13, 13, 2 ]
tests/test_pool.py
rsumner31/ngraph
1
72229
# ---------------------------------------------------------------------------- # Copyright 2016 Nervana Systems Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ---------------------------------------------------------------------------- import numpy as np import pytest from neon import NervanaObject from neon.backends import gen_backend from neon.layers.layer import Pooling import ngraph as ng import ngraph.transformers as ngt from ngraph.testing import RandomTensorGenerator, executor from ngraph.frontends.neon import ax, ar from ngraph.frontends.neon.layer import output_dim rng = RandomTensorGenerator(0, np.float32) NervanaObject.be = gen_backend() class DummyDeltaBuffers(object): """ Dummy class for delta buffers needed by neon """ def __init__(self): self.buffers = [None] def test_wrong_input_shape_length(): """ test wrong input shape length """ ax_i = ng.make_axes([ax.C, ax.D, ax.H, ax.W]) inputs = ng.placeholder(axes=ax_i) pool_params = dict(op='max') with pytest.raises(ValueError) as exinfo: ng.pooling(pool_params, inputs, {}) assert str(exinfo.value) == 'pooling input shape must be length 5, found {}' \ .format(len(ax_i)) def test_wrong_op_name(): """ test wrong number of batch axes at input """ ax_i = ng.make_axes([ax.C, ax.D, ax.H, ax.W, ax.N]) inputs = ng.placeholder(axes=ax_i) pooltype = 'min' pool_params = dict(op=pooltype) with pytest.raises(ValueError) as exinfo: ng.pooling(pool_params, inputs, {}) assert str(exinfo.value) == "Unsupported pooling type: {pooltype}. Only max and avg " \ "pooling currently supported. ".format(pooltype=pooltype) def test_pooling(): """ test pooling forward and backward path """ N = 128 C = 3 D = 1 H = W = 32 J = T = 1 R = S = 2 ngt.make_transformer() padding = dict(pad_d=0, pad_h=0, pad_w=0, pad_c=0) strides = dict(str_d=1, str_h=1, str_w=1, str_c=1) fshape = dict(J=J, T=T, R=R, S=S) pool_params = dict(op='max') pool_params.update(padding) pool_params.update(strides) pool_params.update(fshape) ax_i = ng.make_axes([ax.C, ax.D, ax.H, ax.W, ax.N]) ax_i.set_shape((C, D, H, W, N)) inputs = ng.placeholder(axes=ax_i) ax_o = ng.make_axes([ ng.make_axis(roles=[ar.features_input]).named('C'), ng.make_axis(roles=[ar.features_0]).named('D'), ng.make_axis(roles=[ar.features_1]).named('H'), ng.make_axis(roles=[ar.features_2]).named('W'), ax.N ]) ax_o[:-1].set_shape(( output_dim(C, J, padding['pad_c'], strides['str_c']), output_dim(D, T, padding['pad_d'], strides['str_d']), output_dim(H, R, padding['pad_h'], strides['str_h']), output_dim(W, S, padding['pad_w'], strides['str_w'])) ) # randomly initialize input_value = rng.uniform(-1, 1, ax_i) assert input_value.shape == ax_i.lengths # compute convolution with graph output = ng.pooling(pool_params, inputs, axes=ax_o) targets = ng.placeholder(axes=ax_o) costs = ng.cross_entropy_binary(ng.sigmoid(output), targets) error = ng.sum(costs, out_axes=()) / ng.batch_size(costs) d_inputs = ng.deriv(error, inputs) targets_value = rng.uniform(.1, 0.9, output.axes) with executor([output, error, d_inputs], inputs, targets) as conv_executor: result_ng, err_ng, gradI_ng = conv_executor(input_value, targets_value) # Now compute reference values via NEON NervanaObject.be.bsz = N neon_layer = Pooling(fshape=fshape, padding=padding, strides=strides, op="max") inp = neon_layer.be.array(input_value.reshape(C * H * W * D, N)) neon_layer.configure((C, H, W)) neon_layer.prev_layer = True neon_layer.allocate() neon_layer.set_deltas(DummyDeltaBuffers()) result_ne = neon_layer.fprop(inp).get().reshape(output.axes.lengths) act_result_ne = 1. / (1.0 + np.exp(-result_ne)) err = neon_layer.be.array((act_result_ne - targets_value).reshape(-1, N) / float(N)) gradI_ne = neon_layer.bprop(err).get().reshape(ax_i.lengths) # Compare fprop ng.testing.assert_allclose(result_ng, result_ne, rtol=0, atol=1e-6) # Compare bprop ng.testing.assert_allclose(gradI_ng, gradI_ne, rtol=0, atol=1e-6)
[ 1, 396, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29953, 405, 6972, 1648, 23985, 9266, 29889, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 418, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 11451, 1688, 13, 3166, 452, 265, 1053, 405, 6972, 1648, 2061, 13, 3166, 452, 265, 29889, 1627, 1975, 1053, 2531, 29918, 27852, 13, 3166, 452, 265, 29889, 29277, 29889, 13148, 1053, 28625, 292, 13, 13, 5215, 302, 4262, 408, 8736, 13, 5215, 302, 4262, 29889, 9067, 414, 408, 302, 4141, 13, 3166, 302, 4262, 29889, 13424, 1053, 16968, 29911, 6073, 21575, 29892, 2279, 3406, 13, 3166, 302, 4262, 29889, 8862, 1975, 29889, 484, 265, 1053, 4853, 29892, 564, 13, 3166, 302, 4262, 29889, 8862, 1975, 29889, 484, 265, 29889, 13148, 1053, 1962, 29918, 6229, 13, 13, 29878, 865, 353, 16968, 29911, 6073, 21575, 29898, 29900, 29892, 7442, 29889, 7411, 29941, 29906, 29897, 13, 13, 29940, 6972, 1648, 2061, 29889, 915, 353, 2531, 29918, 27852, 580, 13, 13, 13, 1990, 360, 11770, 5268, 29933, 3096, 414, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 360, 11770, 770, 363, 19471, 20487, 414, 4312, 491, 452, 265, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 28040, 414, 353, 518, 8516, 29962, 13, 13, 13, 1753, 1243, 29918, 15866, 549, 29918, 2080, 29918, 12181, 29918, 2848, 7295, 13, 1678, 9995, 13, 1678, 1243, 2743, 1881, 8267, 3309, 13, 1678, 9995, 13, 1678, 4853, 29918, 29875, 353, 8736, 29889, 5675, 29918, 1165, 267, 4197, 1165, 29889, 29907, 29892, 4853, 29889, 29928, 29892, 4853, 29889, 29950, 29892, 4853, 29889, 29956, 2314, 13, 1678, 10970, 353, 8736, 29889, 27074, 29898, 1165, 267, 29922, 1165, 29918, 29875, 29897, 13, 1678, 11565, 29918, 7529, 353, 9657, 29898, 459, 2433, 3317, 1495, 13, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 29897, 408, 429, 3888, 29901, 13, 4706, 8736, 29889, 10109, 292, 29898, 10109, 29918, 7529, 29892, 10970, 29892, 426, 1800, 13, 13, 1678, 4974, 851, 29898, 735, 3888, 29889, 1767, 29897, 1275, 525, 10109, 292, 1881, 8267, 1818, 367, 3309, 29871, 29945, 29892, 1476, 6571, 29915, 320, 13, 4706, 869, 4830, 29898, 2435, 29898, 1165, 29918, 29875, 876, 13, 13, 13, 1753, 1243, 29918, 15866, 549, 29918, 459, 29918, 978, 7295, 13, 1678, 9995, 13, 1678, 1243, 2743, 1353, 310, 9853, 27815, 472, 1881, 13, 1678, 9995, 13, 1678, 4853, 29918, 29875, 353, 8736, 29889, 5675, 29918, 1165, 267, 4197, 1165, 29889, 29907, 29892, 4853, 29889, 29928, 29892, 4853, 29889, 29950, 29892, 4853, 29889, 29956, 29892, 4853, 29889, 29940, 2314, 13, 1678, 10970, 353, 8736, 29889, 27074, 29898, 1165, 267, 29922, 1165, 29918, 29875, 29897, 13, 1678, 11565, 1853, 353, 525, 1195, 29915, 13, 1678, 11565, 29918, 7529, 353, 9657, 29898, 459, 29922, 10109, 1853, 29897, 13, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 29897, 408, 429, 3888, 29901, 13, 4706, 8736, 29889, 10109, 292, 29898, 10109, 29918, 7529, 29892, 10970, 29892, 426, 1800, 13, 13, 1678, 4974, 851, 29898, 735, 3888, 29889, 1767, 29897, 1275, 376, 25807, 29884, 3016, 287, 11565, 292, 1134, 29901, 426, 10109, 1853, 1836, 29871, 9333, 4236, 322, 1029, 29887, 376, 320, 13, 4706, 376, 10109, 292, 5279, 6969, 29889, 11393, 4830, 29898, 10109, 1853, 29922, 10109, 1853, 29897, 13, 13, 13, 1753, 1243, 29918, 10109, 292, 7295, 13, 1678, 9995, 13, 1678, 1243, 11565, 292, 6375, 322, 1250, 1328, 2224, 13, 1678, 9995, 13, 1678, 405, 353, 29871, 29896, 29906, 29947, 13, 1678, 315, 353, 29871, 29941, 13, 1678, 360, 353, 29871, 29896, 13, 1678, 379, 353, 399, 353, 29871, 29941, 29906, 13, 13, 1678, 435, 353, 323, 353, 29871, 29896, 13, 1678, 390, 353, 317, 353, 29871, 29906, 13, 1678, 302, 4141, 29889, 5675, 29918, 9067, 261, 580, 13, 13, 1678, 7164, 353, 9657, 29898, 8305, 29918, 29881, 29922, 29900, 29892, 17132, 29918, 29882, 29922, 29900, 29892, 17132, 29918, 29893, 29922, 29900, 29892, 17132, 29918, 29883, 29922, 29900, 29897, 13, 1678, 851, 2247, 353, 9657, 29898, 710, 29918, 29881, 29922, 29896, 29892, 851, 29918, 29882, 29922, 29896, 29892, 851, 29918, 29893, 29922, 29896, 29892, 851, 29918, 29883, 29922, 29896, 29897, 13, 1678, 285, 12181, 353, 9657, 29898, 29967, 29922, 29967, 29892, 323, 29922, 29911, 29892, 390, 29922, 29934, 29892, 317, 29922, 29903, 29897, 13, 13, 1678, 11565, 29918, 7529, 353, 9657, 29898, 459, 2433, 3317, 1495, 13, 1678, 11565, 29918, 7529, 29889, 5504, 29898, 12791, 29897, 13, 1678, 11565, 29918, 7529, 29889, 5504, 29898, 710, 2247, 29897, 13, 1678, 11565, 29918, 7529, 29889, 5504, 29898, 29888, 12181, 29897, 13, 13, 1678, 4853, 29918, 29875, 353, 8736, 29889, 5675, 29918, 1165, 267, 4197, 1165, 29889, 29907, 29892, 4853, 29889, 29928, 29892, 4853, 29889, 29950, 29892, 4853, 29889, 29956, 29892, 4853, 29889, 29940, 2314, 13, 1678, 4853, 29918, 29875, 29889, 842, 29918, 12181, 3552, 29907, 29892, 360, 29892, 379, 29892, 399, 29892, 405, 876, 13, 1678, 10970, 353, 8736, 29889, 27074, 29898, 1165, 267, 29922, 1165, 29918, 29875, 29897, 13, 13, 1678, 4853, 29918, 29877, 353, 8736, 29889, 5675, 29918, 1165, 267, 4197, 13, 4706, 8736, 29889, 5675, 29918, 8990, 29898, 307, 793, 11759, 279, 29889, 22100, 29918, 2080, 14664, 17514, 877, 29907, 5477, 13, 4706, 8736, 29889, 5675, 29918, 8990, 29898, 307, 793, 11759, 279, 29889, 22100, 29918, 29900, 14664, 17514, 877, 29928, 5477, 13, 4706, 8736, 29889, 5675, 29918, 8990, 29898, 307, 793, 11759, 279, 29889, 22100, 29918, 29896, 14664, 17514, 877, 29950, 5477, 13, 4706, 8736, 29889, 5675, 29918, 8990, 29898, 307, 793, 11759, 279, 29889, 22100, 29918, 29906, 14664, 17514, 877, 29956, 5477, 13, 4706, 4853, 29889, 29940, 13, 268, 2314, 13, 13, 1678, 4853, 29918, 29877, 7503, 29899, 29896, 1822, 842, 29918, 12181, 3552, 13, 4706, 1962, 29918, 6229, 29898, 29907, 29892, 435, 29892, 7164, 1839, 8305, 29918, 29883, 7464, 851, 2247, 1839, 710, 29918, 29883, 2033, 511, 13, 4706, 1962, 29918, 6229, 29898, 29928, 29892, 323, 29892, 7164, 1839, 8305, 29918, 29881, 7464, 851, 2247, 1839, 710, 29918, 29881, 2033, 511, 13, 4706, 1962, 29918, 6229, 29898, 29950, 29892, 390, 29892, 7164, 1839, 8305, 29918, 29882, 7464, 851, 2247, 1839, 710, 29918, 29882, 2033, 511, 13, 4706, 1962, 29918, 6229, 29898, 29956, 29892, 317, 29892, 7164, 1839, 8305, 29918, 29893, 7464, 851, 2247, 1839, 710, 29918, 29893, 25901, 13, 1678, 1723, 13, 1678, 396, 20459, 11905, 13, 1678, 1881, 29918, 1767, 353, 364, 865, 29889, 29590, 6278, 29896, 29892, 29871, 29896, 29892, 4853, 29918, 29875, 29897, 13, 13, 1678, 4974, 1881, 29918, 1767, 29889, 12181, 1275, 4853, 29918, 29875, 29889, 2848, 29879, 13, 13, 1678, 396, 10272, 26851, 411, 3983, 13, 1678, 1962, 353, 8736, 29889, 10109, 292, 29898, 10109, 29918, 7529, 29892, 10970, 29892, 27815, 29922, 1165, 29918, 29877, 29897, 13, 1678, 22525, 353, 8736, 29889, 27074, 29898, 1165, 267, 29922, 1165, 29918, 29877, 29897, 13, 13, 1678, 21544, 353, 8736, 29889, 19128, 29918, 296, 14441, 29918, 19541, 29898, 865, 29889, 18816, 29885, 3398, 29898, 4905, 511, 22525, 29897, 13, 1678, 1059, 353, 8736, 29889, 2083, 29898, 18253, 29879, 29892, 714, 29918, 1165, 267, 29922, 3101, 847, 8736, 29889, 16175, 29918, 2311, 29898, 18253, 29879, 29897, 13, 1678, 270, 29918, 2080, 29879, 353, 8736, 29889, 672, 440, 29898, 2704, 29892, 10970, 29897, 13, 13, 1678, 22525, 29918, 1767, 353, 364, 865, 29889, 29590, 11891, 29896, 29892, 29871, 29900, 29889, 29929, 29892, 1962, 29889, 1165, 267, 29897, 13, 13, 1678, 411, 2279, 3406, 4197, 4905, 29892, 1059, 29892, 270, 29918, 2080, 29879, 1402, 10970, 29892, 22525, 29897, 408, 7602, 29918, 4258, 3406, 29901, 13, 4706, 1121, 29918, 865, 29892, 4589, 29918, 865, 29892, 4656, 29902, 29918, 865, 353, 7602, 29918, 4258, 3406, 29898, 2080, 29918, 1767, 29892, 22525, 29918, 1767, 29897, 13, 13, 1678, 396, 2567, 10272, 3407, 1819, 3025, 14693, 1164, 13, 1678, 405, 6972, 1648, 2061, 29889, 915, 29889, 29890, 3616, 353, 405, 13, 1678, 452, 265, 29918, 13148, 353, 28625, 292, 29898, 29888, 12181, 29922, 29888, 12181, 29892, 7164, 29922, 12791, 29892, 851, 2247, 29922, 710, 2247, 29892, 1015, 543, 3317, 1159, 13, 13, 1678, 297, 29886, 353, 452, 265, 29918, 13148, 29889, 915, 29889, 2378, 29898, 2080, 29918, 1767, 29889, 690, 14443, 29898, 29907, 334, 379, 334, 399, 334, 360, 29892, 405, 876, 13, 1678, 452, 265, 29918, 13148, 29889, 17591, 3552, 29907, 29892, 379, 29892, 399, 876, 13, 1678, 452, 265, 29918, 13148, 29889, 16304, 29918, 13148, 353, 5852, 13, 1678, 452, 265, 29918, 13148, 29889, 15956, 403, 580, 13, 1678, 452, 265, 29918, 13148, 29889, 842, 29918, 29881, 2152, 294, 29898, 29928, 11770, 5268, 29933, 3096, 414, 3101, 13, 13, 1678, 1121, 29918, 484, 353, 452, 265, 29918, 13148, 29889, 29888, 7728, 29898, 262, 29886, 467, 657, 2141, 690, 14443, 29898, 4905, 29889, 1165, 267, 29889, 2848, 29879, 29897, 13, 13, 1678, 1044, 29918, 2914, 29918, 484, 353, 29871, 29896, 29889, 847, 313, 29896, 29889, 29900, 718, 7442, 29889, 4548, 6278, 2914, 29918, 484, 876, 13, 1678, 4589, 353, 452, 265, 29918, 13148, 29889, 915, 29889, 2378, 3552, 627, 29918, 2914, 29918, 484, 448, 22525, 29918, 1767, 467, 690, 14443, 6278, 29896, 29892, 405, 29897, 847, 5785, 29898, 29940, 876, 13, 1678, 4656, 29902, 29918, 484, 353, 452, 265, 29918, 13148, 29889, 29890, 7728, 29898, 3127, 467, 657, 2141, 690, 14443, 29898, 1165, 29918, 29875, 29889, 2848, 29879, 29897, 13, 13, 1678, 396, 3831, 598, 285, 7728, 13, 1678, 8736, 29889, 13424, 29889, 9294, 29918, 497, 5358, 29898, 2914, 29918, 865, 29892, 1121, 29918, 484, 29892, 364, 25027, 29922, 29900, 29892, 472, 324, 29922, 29896, 29872, 29899, 29953, 29897, 13, 13, 1678, 396, 3831, 598, 289, 7728, 13, 1678, 8736, 29889, 13424, 29889, 9294, 29918, 497, 5358, 29898, 5105, 29902, 29918, 865, 29892, 4656, 29902, 29918, 484, 29892, 364, 25027, 29922, 29900, 29892, 472, 324, 29922, 29896, 29872, 29899, 29953, 29897, 13, 2 ]
amazon/__init__.py
gutfeeling/python-amazon-paapi
0
134861
<reponame>gutfeeling/python-amazon-paapi """Amazon Product Advertising API wrapper for Python""" __version__ = '3.2.0' __author__ = '<NAME>'
[ 1, 529, 276, 1112, 420, 29958, 29887, 329, 1725, 14067, 29914, 4691, 29899, 17260, 29899, 3274, 2754, 13, 15945, 29908, 29909, 655, 6626, 10969, 2087, 1765, 5921, 3450, 14476, 363, 5132, 15945, 29908, 13, 13, 1649, 3259, 1649, 353, 525, 29941, 29889, 29906, 29889, 29900, 29915, 13, 1649, 8921, 1649, 353, 12801, 5813, 16299, 13, 2 ]
taobao/old_version/taobao_ver2.py
HowardHowonYu/taobao_crawler
0
92694
import time import sys class ProductCrawler(): def __get_proxy__(self): from selenium import webdriver co = webdriver.ChromeOptions() co.add_argument("log-level=3") co.add_argument("--headless") driver = webdriver.Chrome('./chromedriver', options=co) driver.get("https://free-proxy-list.net/") PROXIES = [] proxies = driver.find_elements_by_css_selector("tr[role='row']") for p in proxies: result = p.text.split(" ") if result[-1] == "yes": PROXIES.append(result[0]+":"+result[1]) driver.close() return PROXIES def __set_cookies_proxies__(self, current_url): from selenium import webdriver import pickle # get proxies PROXIES = self.__get_proxy__() # set proxies to driver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument(PROXIES[1]) driver = webdriver.Chrome( './chromedriver', options=chrome_options) driver.get("https://www.taobao.com") # set cookies to driver # load cookies to get information about 'Promotion Price' # have to find better approach :( if "tmall" in current_url: f = open('cookie_tmall.dat', 'rb') cookies = pickle.load(f) for cookie in cookies: driver.add_cookie(cookie) else: f = open('cookie_taobao.dat', 'rb') cookies = pickle.load(f) for cookie in cookies: driver.add_cookie(cookie) return driver def product_crawler(self, itemid): """ we check the url for confirm the mall first - taobao or tmall if you have information of mall, you can select one method directly. - taobao : taobao_crawler() - tmall : tmall_crawler() """ from selenium import webdriver from fake_useragent import UserAgent # make userAgent randomly ua = UserAgent(verify_ssl=False) userAgent = ua.random chrome_options = webdriver.ChromeOptions() chrome_options.add_argument(userAgent) driver = webdriver.Chrome('./chromedriver', options=chrome_options) driver.get("https://item.taobao.com/item.htm?id={}".format(itemid)) # control alert window try: alert = driver.switch_to_alert() time.sleep(1) alert.accept() current_url = driver.current_url except: current_url = driver.current_url print("사이트 체크 완료", current_url) driver.quit() if "tmall" in current_url: return self.tmall_crawler(itemid, current_url) else: return self.taobao_crawler(itemid, current_url) def tmall_crawler(self, itemid, current_url): from selenium import webdriver from scrapy.http import TextResponse from fake_useragent import UserAgent import requests driver = self.__set_cookies_proxies__(current_url) driver.get("https://detail.tmall.com/item.htm?id={}".format(itemid)) result = {} # item id result['item_id'] = itemid # Tmall has two options of 'Promotion Price' try: result['promo_price_cuxiao'] = driver.find_element_by_xpath( '//*[@id="J_PromoPrice"]/dd/div/span').text except: result['promo_price_cuxiao'] = "가격 정보 없음" try: result['promo_price_kuang'] = driver.find_element_by_xpath('// *[@id="J_DetailMeta"]/div[1]/div[1]/div/div[2]/dl[3]/dd/span').text except: result['promo_price_kuang'] = "가격 정보 없음" driver.quit() # Use 'requests' to get rest of information url = "https://item.taobao.com/item.htm?id={}".format(itemid) ua = UserAgent(verify_ssl=False) userAgent = ua.random headers = { 'User-Agent': userAgent } # https://stackoverflow.com/questions/32910093/python-requests-gets-tlsv1-alert-internal-err requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:!eNULL:!MD5' response = requests.get(url=url, headers=headers) req = TextResponse(response.url, body=response.text, encoding="utf-8") # item_title result['item_title'] = req.xpath( '//*[@id="J_DetailMeta"]/div[@class="tm-clear"]/div[@class="tb-property"]/div/div[@class="tb-detail-hd"]/h1/text()').extract_first().strip() # options option_path = req.xpath( '//*[@id="J_DetailMeta"]/div/div/div/div[@class="tb-key"]/div[@class="tb-skin"]/div[@class="tb-sku"]/dl[contains(@class, "tm-sale-prop") and contains(@class, "tb-prop") and contains(@class, "tm-clear")]') option_ls = [] for path in option_path: option = {} option['option_title'] = path.xpath('dt/text()').extract_first() option['option_details'] = path.xpath('dd/ul/li/a/span/text()').extract() image_elements = path.xpath('dd/ul[contains(@class, "tb-img")]/li/a') option['option_image_urls'] = [element.xpath('@style').extract_first()[19:-40] for element in image_elements] option_ls.append(option) result['options'] = option_ls return result def taobao_crawler(self, itemid, current_url): from selenium import webdriver from scrapy.http import TextResponse from fake_useragent import UserAgent import pickle import requests driver = self.__set_cookies_proxies__(current_url) driver.get("https://item.taobao.com/item.htm?id={}".format(itemid)) result = {} result['item_id'] = itemid # 할인 가격 try: result['promo_price'] = driver.find_element_by_xpath( '//*[@id="J_PromoPriceNum"]').text except: result['promo_price'] = '할인 가격 없음' driver.quit() # Use 'requests' to get rest of information ua = UserAgent(verify_ssl=False) userAgent = ua.random headers = { 'User-Agent': userAgent } url = "https://item.taobao.com/item.htm?id={}".format(itemid) # https://stackoverflow.com/questions/32910093/python-requests-gets-tlsv1-alert-internal-err requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+HIGH:RSA+3DES:!aNULL:!eNULL:!MD5' response = requests.get(url=url, headers=headers) req = TextResponse(response.url, body=response.text, encoding="utf-8") result['item_title'] = req.xpath( '//*[@id="J_Title"]/h3/@data-title').extract_first() option_title = req.xpath( '//*[@id="J_isku"]/div/dl/dd/ul/@data-property').extract() r = [] for title in option_title: j = {} j['option_title'] = title j['option_details'] = req.xpath( '//*[@id="J_isku"]/div/dl/dd/ul[@data-property="{}"]/li/a/span/text()'.format(title)).extract() j['option_image_urls'] = [path[17:-29] for path in req.xpath( '//*[@id="J_isku"]/div/dl/dd/ul[@data-property="{}"]/li/a/@style'.format(title)).extract()] r.append(j) result['options'] = r return result if __name__ == "__main__": crawler = ProductCrawler() print(crawler.product_crawler(sys.argv[1]))
[ 1, 1053, 931, 13, 5215, 10876, 13, 13, 1990, 10969, 29907, 1610, 1358, 7295, 13, 268, 13, 1678, 822, 4770, 657, 29918, 14701, 12035, 1311, 1125, 13, 4706, 515, 18866, 1053, 1856, 9465, 13, 13, 4706, 1302, 353, 1856, 9465, 29889, 1451, 4871, 5856, 580, 13, 4706, 1302, 29889, 1202, 29918, 23516, 703, 1188, 29899, 5563, 29922, 29941, 1159, 13, 4706, 1302, 29889, 1202, 29918, 23516, 703, 489, 2813, 2222, 1159, 13, 4706, 7156, 353, 1856, 9465, 29889, 1451, 4871, 877, 6904, 27433, 287, 3511, 742, 3987, 29922, 1111, 29897, 13, 4706, 7156, 29889, 657, 703, 991, 597, 9021, 29899, 14701, 29899, 1761, 29889, 1212, 29914, 1159, 13, 13, 4706, 13756, 29990, 29059, 353, 5159, 13, 4706, 410, 29916, 583, 353, 7156, 29889, 2886, 29918, 17664, 29918, 1609, 29918, 4268, 29918, 14357, 703, 509, 29961, 12154, 2433, 798, 2033, 1159, 13, 4706, 363, 282, 297, 410, 29916, 583, 29901, 13, 9651, 1121, 353, 282, 29889, 726, 29889, 5451, 703, 16521, 13, 13, 9651, 565, 1121, 14352, 29896, 29962, 1275, 376, 3582, 1115, 13, 18884, 13756, 29990, 29059, 29889, 4397, 29898, 2914, 29961, 29900, 10062, 4710, 29974, 2914, 29961, 29896, 2314, 13, 13, 4706, 7156, 29889, 5358, 580, 13, 4706, 736, 13756, 29990, 29059, 13, 13, 1678, 822, 4770, 842, 29918, 15108, 583, 29918, 771, 29916, 583, 12035, 1311, 29892, 1857, 29918, 2271, 1125, 13, 4706, 515, 18866, 1053, 1856, 9465, 13, 4706, 1053, 5839, 280, 13, 13, 4706, 396, 679, 410, 29916, 583, 13, 4706, 13756, 29990, 29059, 353, 1583, 17255, 657, 29918, 14701, 1649, 580, 13, 259, 13, 4706, 396, 731, 410, 29916, 583, 304, 7156, 13, 4706, 16735, 29918, 6768, 353, 1856, 9465, 29889, 1451, 4871, 5856, 580, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 29898, 8618, 29990, 29059, 29961, 29896, 2314, 13, 4706, 7156, 353, 1856, 9465, 29889, 1451, 4871, 29898, 13, 9651, 19283, 27433, 287, 3511, 742, 3987, 29922, 18114, 29918, 6768, 29897, 13, 4706, 7156, 29889, 657, 703, 991, 597, 1636, 29889, 941, 711, 6241, 29889, 510, 1159, 13, 13, 4706, 396, 731, 21046, 304, 7156, 13, 4706, 396, 2254, 21046, 304, 679, 2472, 1048, 525, 18571, 8194, 20743, 29915, 13, 4706, 396, 505, 304, 1284, 2253, 2948, 16824, 13, 13, 4706, 565, 376, 18276, 497, 29908, 297, 1857, 29918, 2271, 29901, 13, 9651, 285, 353, 1722, 877, 21509, 29918, 18276, 497, 29889, 4130, 742, 525, 6050, 1495, 13, 9651, 21046, 353, 5839, 280, 29889, 1359, 29898, 29888, 29897, 13, 9651, 363, 15327, 297, 21046, 29901, 13, 18884, 7156, 29889, 1202, 29918, 21509, 29898, 21509, 29897, 13, 4706, 1683, 29901, 13, 9651, 285, 353, 1722, 877, 21509, 29918, 941, 711, 6241, 29889, 4130, 742, 525, 6050, 1495, 13, 9651, 21046, 353, 5839, 280, 29889, 1359, 29898, 29888, 29897, 13, 9651, 363, 15327, 297, 21046, 29901, 13, 18884, 7156, 29889, 1202, 29918, 21509, 29898, 21509, 29897, 13, 4706, 736, 7156, 13, 13, 13, 13, 1678, 822, 3234, 29918, 29883, 1610, 1358, 29898, 1311, 29892, 2944, 333, 1125, 13, 4706, 9995, 308, 13, 4706, 591, 1423, 278, 3142, 363, 9659, 278, 286, 497, 937, 448, 11062, 711, 6241, 470, 27702, 497, 13, 4706, 565, 366, 505, 2472, 310, 286, 497, 29892, 366, 508, 1831, 697, 1158, 4153, 29889, 13, 3986, 448, 11062, 711, 6241, 584, 11062, 711, 6241, 29918, 29883, 1610, 1358, 580, 13, 3986, 448, 27702, 497, 584, 27702, 497, 29918, 29883, 1610, 1358, 580, 13, 4706, 9995, 13, 13, 4706, 515, 18866, 1053, 1856, 9465, 13, 4706, 515, 25713, 29918, 1792, 14748, 1053, 4911, 19661, 13, 13, 4706, 396, 1207, 1404, 19661, 20459, 13, 4706, 318, 29874, 353, 4911, 19661, 29898, 27902, 29918, 16265, 29922, 8824, 29897, 13, 4706, 1404, 19661, 353, 318, 29874, 29889, 8172, 13, 4706, 16735, 29918, 6768, 353, 1856, 9465, 29889, 1451, 4871, 5856, 580, 13, 4706, 16735, 29918, 6768, 29889, 1202, 29918, 23516, 29898, 1792, 19661, 29897, 13, 13, 4706, 7156, 353, 1856, 9465, 29889, 1451, 4871, 877, 6904, 27433, 287, 3511, 742, 3987, 29922, 18114, 29918, 6768, 29897, 13, 13, 4706, 7156, 29889, 657, 703, 991, 597, 667, 29889, 941, 711, 6241, 29889, 510, 29914, 667, 29889, 13357, 29973, 333, 3790, 29913, 1642, 4830, 29898, 667, 333, 876, 13, 13, 4706, 396, 2761, 6655, 3474, 29871, 13, 4706, 1018, 29901, 13, 9651, 6655, 353, 7156, 29889, 15123, 29918, 517, 29918, 12888, 580, 13, 9651, 931, 29889, 17059, 29898, 29896, 29897, 13, 9651, 6655, 29889, 16044, 580, 13, 9651, 1857, 29918, 2271, 353, 7156, 29889, 3784, 29918, 2271, 13, 4706, 5174, 29901, 13, 9651, 1857, 29918, 2271, 353, 7156, 29889, 3784, 29918, 2271, 13, 13, 4706, 1596, 703, 30791, 30393, 31177, 29871, 239, 181, 183, 240, 132, 175, 29871, 239, 156, 135, 238, 166, 143, 613, 1857, 29918, 2271, 29897, 13, 13, 4706, 7156, 29889, 28358, 580, 13, 13, 308, 13, 4706, 565, 376, 18276, 497, 29908, 297, 1857, 29918, 2271, 29901, 13, 9651, 736, 1583, 29889, 18276, 497, 29918, 29883, 1610, 1358, 29898, 667, 333, 29892, 1857, 29918, 2271, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 941, 711, 6241, 29918, 29883, 1610, 1358, 29898, 667, 333, 29892, 1857, 29918, 2271, 29897, 13, 13, 1678, 822, 27702, 497, 29918, 29883, 1610, 1358, 29898, 1311, 29892, 2944, 333, 29892, 1857, 29918, 2271, 1125, 13, 4706, 515, 18866, 1053, 1856, 9465, 13, 4706, 515, 24559, 2272, 29889, 1124, 1053, 3992, 5103, 13, 4706, 515, 25713, 29918, 1792, 14748, 1053, 4911, 19661, 13, 13, 4706, 1053, 7274, 13, 13, 4706, 7156, 353, 1583, 17255, 842, 29918, 15108, 583, 29918, 771, 29916, 583, 12035, 3784, 29918, 2271, 29897, 13, 13, 4706, 7156, 29889, 657, 703, 991, 597, 16432, 29889, 18276, 497, 29889, 510, 29914, 667, 29889, 13357, 29973, 333, 3790, 29913, 1642, 4830, 29898, 667, 333, 876, 13, 13, 4706, 1121, 353, 6571, 13, 13, 4706, 396, 2944, 1178, 13, 4706, 1121, 1839, 667, 29918, 333, 2033, 353, 2944, 333, 13, 13, 4706, 396, 323, 29885, 497, 756, 1023, 3987, 310, 525, 18571, 8194, 20743, 29915, 13, 4706, 1018, 29901, 13, 9651, 1121, 1839, 14032, 29877, 29918, 9175, 29918, 29883, 1314, 29653, 2033, 353, 7156, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 23635, 29898, 13, 9651, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 18571, 29877, 13026, 3108, 29914, 1289, 29914, 4563, 29914, 9653, 2824, 726, 13, 4706, 5174, 29901, 13, 9651, 1121, 1839, 14032, 29877, 29918, 9175, 29918, 29883, 1314, 29653, 2033, 353, 376, 30903, 237, 181, 172, 29871, 30852, 31199, 29871, 239, 154, 137, 31966, 29908, 13, 13, 4706, 1018, 29901, 13, 9651, 1121, 1839, 14032, 29877, 29918, 9175, 29918, 2120, 574, 2033, 353, 7156, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 23635, 877, 458, 334, 17548, 333, 543, 29967, 29918, 16570, 19346, 3108, 29914, 4563, 29961, 29896, 16261, 4563, 29961, 29896, 16261, 4563, 29914, 4563, 29961, 29906, 16261, 11671, 29961, 29941, 16261, 1289, 29914, 9653, 2824, 726, 13, 4706, 5174, 29901, 13, 9651, 1121, 1839, 14032, 29877, 29918, 9175, 29918, 2120, 574, 2033, 353, 376, 30903, 237, 181, 172, 29871, 30852, 31199, 29871, 239, 154, 137, 31966, 29908, 13, 13, 4706, 7156, 29889, 28358, 580, 13, 13, 4706, 396, 4803, 525, 24830, 29915, 304, 679, 1791, 310, 2472, 13, 4706, 3142, 353, 376, 991, 597, 667, 29889, 941, 711, 6241, 29889, 510, 29914, 667, 29889, 13357, 29973, 333, 3790, 29913, 1642, 4830, 29898, 667, 333, 29897, 13, 13, 4706, 318, 29874, 353, 4911, 19661, 29898, 27902, 29918, 16265, 29922, 8824, 29897, 13, 4706, 1404, 19661, 353, 318, 29874, 29889, 8172, 13, 13, 4706, 9066, 353, 426, 13, 9651, 525, 2659, 29899, 19661, 2396, 1404, 19661, 13, 4706, 500, 13, 13, 4706, 396, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29941, 29906, 29929, 29896, 29900, 29900, 29929, 29941, 29914, 4691, 29899, 24830, 29899, 20078, 29899, 29873, 3137, 29894, 29896, 29899, 12888, 29899, 7564, 29899, 3127, 13, 4706, 7274, 29889, 8318, 29889, 2271, 1982, 29941, 29889, 4422, 29889, 16265, 5396, 23397, 29918, 29907, 5690, 4448, 29903, 353, 525, 29928, 29950, 29974, 29909, 2890, 8766, 29924, 29901, 29923, 6530, 29950, 29974, 29909, 2890, 29906, 29945, 29953, 29901, 29928, 29950, 29974, 29909, 2890, 29906, 29945, 29953, 29901, 29923, 6530, 29950, 29974, 29909, 2890, 29896, 29906, 29947, 29901, 29928, 29950, 29974, 29909, 2890, 29901, 29923, 6530, 29950, 29974, 29950, 6259, 29950, 29901, 29928, 29950, 29974, 29950, 6259, 29950, 29901, 29923, 6530, 29950, 29974, 29941, 2287, 29903, 29901, 29928, 29950, 29974, 29941, 2287, 29903, 29901, 29934, 8132, 29974, 29909, 2890, 8766, 29924, 29901, 29934, 8132, 29974, 29909, 2890, 29901, 29934, 8132, 29974, 29950, 6259, 29950, 29901, 29934, 8132, 29974, 29941, 2287, 29903, 29901, 29991, 29874, 10074, 29901, 29991, 29872, 10074, 29901, 29991, 5773, 29945, 29915, 13, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 2271, 29922, 2271, 29892, 9066, 29922, 13662, 29897, 13, 4706, 12428, 353, 3992, 5103, 29898, 5327, 29889, 2271, 29892, 3573, 29922, 5327, 29889, 726, 29892, 8025, 543, 9420, 29899, 29947, 1159, 13, 13, 4706, 396, 2944, 29918, 3257, 13, 4706, 1121, 1839, 667, 29918, 3257, 2033, 353, 12428, 29889, 23635, 29898, 13, 9651, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 16570, 19346, 3108, 29914, 4563, 17548, 1990, 543, 18276, 29899, 8551, 3108, 29914, 4563, 17548, 1990, 543, 22625, 29899, 6799, 3108, 29914, 4563, 29914, 4563, 17548, 1990, 543, 22625, 29899, 16432, 29899, 16440, 3108, 29914, 29882, 29896, 29914, 726, 580, 2824, 21111, 29918, 4102, 2141, 17010, 580, 13, 13, 4706, 396, 3987, 13, 4706, 2984, 29918, 2084, 353, 12428, 29889, 23635, 29898, 13, 9651, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 16570, 19346, 3108, 29914, 4563, 29914, 4563, 29914, 4563, 29914, 4563, 17548, 1990, 543, 22625, 29899, 1989, 3108, 29914, 4563, 17548, 1990, 543, 22625, 29899, 808, 262, 3108, 29914, 4563, 17548, 1990, 543, 22625, 29899, 18181, 3108, 29914, 11671, 29961, 11516, 10394, 1990, 29892, 376, 18276, 29899, 29879, 744, 29899, 7728, 1159, 322, 3743, 10394, 1990, 29892, 376, 22625, 29899, 7728, 1159, 322, 3743, 10394, 1990, 29892, 376, 18276, 29899, 8551, 13531, 1495, 13, 4706, 2984, 29918, 3137, 353, 5159, 13, 4706, 363, 2224, 297, 2984, 29918, 2084, 29901, 13, 9651, 2984, 353, 6571, 13, 9651, 2984, 1839, 3385, 29918, 3257, 2033, 353, 2224, 29889, 23635, 877, 6008, 29914, 726, 580, 2824, 21111, 29918, 4102, 580, 13, 9651, 2984, 1839, 3385, 29918, 14144, 2033, 353, 2224, 29889, 23635, 877, 1289, 29914, 352, 29914, 492, 29914, 29874, 29914, 9653, 29914, 726, 580, 2824, 21111, 580, 13, 9651, 1967, 29918, 17664, 353, 2224, 29889, 23635, 877, 1289, 29914, 352, 29961, 11516, 10394, 1990, 29892, 376, 22625, 29899, 2492, 13531, 29914, 492, 29914, 29874, 1495, 13, 9651, 2984, 1839, 3385, 29918, 3027, 29918, 26045, 2033, 353, 518, 5029, 29889, 23635, 877, 29992, 3293, 2824, 21111, 29918, 4102, 580, 29961, 29896, 29929, 13018, 29946, 29900, 29962, 363, 1543, 297, 1967, 29918, 17664, 29962, 13, 9651, 2984, 29918, 3137, 29889, 4397, 29898, 3385, 29897, 13, 9651, 1121, 1839, 6768, 2033, 353, 2984, 29918, 3137, 13, 13, 4706, 736, 1121, 13, 13, 1678, 822, 11062, 711, 6241, 29918, 29883, 1610, 1358, 29898, 1311, 29892, 2944, 333, 29892, 1857, 29918, 2271, 1125, 13, 4706, 515, 18866, 1053, 1856, 9465, 13, 4706, 515, 24559, 2272, 29889, 1124, 1053, 3992, 5103, 13, 4706, 515, 25713, 29918, 1792, 14748, 1053, 4911, 19661, 13, 308, 13, 4706, 1053, 5839, 280, 13, 4706, 1053, 7274, 13, 308, 13, 4706, 7156, 353, 1583, 17255, 842, 29918, 15108, 583, 29918, 771, 29916, 583, 12035, 3784, 29918, 2271, 29897, 13, 13, 4706, 7156, 29889, 657, 703, 991, 597, 667, 29889, 941, 711, 6241, 29889, 510, 29914, 667, 29889, 13357, 29973, 333, 3790, 29913, 1642, 4830, 29898, 667, 333, 876, 13, 13, 4706, 1121, 353, 6571, 13, 4706, 1121, 1839, 667, 29918, 333, 2033, 353, 2944, 333, 13, 13, 4706, 396, 29871, 240, 152, 163, 30918, 29871, 30903, 237, 181, 172, 13, 4706, 1018, 29901, 13, 9651, 1121, 1839, 14032, 29877, 29918, 9175, 2033, 353, 7156, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 23635, 29898, 13, 18884, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 18571, 29877, 13026, 8009, 3108, 2824, 726, 13, 4706, 5174, 29901, 13, 9651, 1121, 1839, 14032, 29877, 29918, 9175, 2033, 353, 525, 240, 152, 163, 30918, 29871, 30903, 237, 181, 172, 29871, 239, 154, 137, 31966, 29915, 13, 13, 4706, 7156, 29889, 28358, 580, 13, 13, 4706, 396, 4803, 525, 24830, 29915, 304, 679, 1791, 310, 2472, 13, 4706, 318, 29874, 353, 4911, 19661, 29898, 27902, 29918, 16265, 29922, 8824, 29897, 13, 4706, 1404, 19661, 353, 318, 29874, 29889, 8172, 13, 13, 4706, 9066, 353, 426, 13, 9651, 525, 2659, 29899, 19661, 2396, 1404, 19661, 13, 4706, 500, 13, 13, 4706, 3142, 353, 376, 991, 597, 667, 29889, 941, 711, 6241, 29889, 510, 29914, 667, 29889, 13357, 29973, 333, 3790, 29913, 1642, 4830, 29898, 667, 333, 29897, 13, 13, 4706, 396, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29941, 29906, 29929, 29896, 29900, 29900, 29929, 29941, 29914, 4691, 29899, 24830, 29899, 20078, 29899, 29873, 3137, 29894, 29896, 29899, 12888, 29899, 7564, 29899, 3127, 13, 4706, 7274, 29889, 8318, 29889, 2271, 1982, 29941, 29889, 4422, 29889, 16265, 5396, 23397, 29918, 29907, 5690, 4448, 29903, 353, 525, 29928, 29950, 29974, 29909, 2890, 8766, 29924, 29901, 29923, 6530, 29950, 29974, 29909, 2890, 29906, 29945, 29953, 29901, 29928, 29950, 29974, 29909, 2890, 29906, 29945, 29953, 29901, 29923, 6530, 29950, 29974, 29909, 2890, 29896, 29906, 29947, 29901, 29928, 29950, 29974, 29909, 2890, 29901, 29923, 6530, 29950, 29974, 29950, 6259, 29950, 29901, 29928, 29950, 29974, 29950, 6259, 29950, 29901, 29923, 6530, 29950, 29974, 29941, 2287, 29903, 29901, 29928, 29950, 29974, 29941, 2287, 29903, 29901, 29934, 8132, 29974, 29909, 2890, 8766, 29924, 29901, 29934, 8132, 29974, 29909, 2890, 29901, 29934, 8132, 29974, 29950, 6259, 29950, 29901, 29934, 8132, 29974, 29941, 2287, 29903, 29901, 29991, 29874, 10074, 29901, 29991, 29872, 10074, 29901, 29991, 5773, 29945, 29915, 13, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 2271, 29922, 2271, 29892, 9066, 29922, 13662, 29897, 13, 4706, 12428, 353, 3992, 5103, 29898, 5327, 29889, 2271, 29892, 3573, 29922, 5327, 29889, 726, 29892, 8025, 543, 9420, 29899, 29947, 1159, 13, 4706, 1121, 1839, 667, 29918, 3257, 2033, 353, 12428, 29889, 23635, 29898, 13, 9651, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 7030, 3108, 29914, 29882, 29941, 29368, 1272, 29899, 3257, 2824, 21111, 29918, 4102, 580, 13, 13, 4706, 2984, 29918, 3257, 353, 12428, 29889, 23635, 29898, 13, 9651, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 275, 2120, 3108, 29914, 4563, 29914, 11671, 29914, 1289, 29914, 352, 29368, 1272, 29899, 6799, 2824, 21111, 580, 13, 4706, 364, 353, 5159, 13, 4706, 363, 3611, 297, 2984, 29918, 3257, 29901, 13, 9651, 432, 353, 6571, 13, 9651, 432, 1839, 3385, 29918, 3257, 2033, 353, 3611, 13, 9651, 432, 1839, 3385, 29918, 14144, 2033, 353, 12428, 29889, 23635, 29898, 13, 18884, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 275, 2120, 3108, 29914, 4563, 29914, 11671, 29914, 1289, 29914, 352, 17548, 1272, 29899, 6799, 543, 8875, 3108, 29914, 492, 29914, 29874, 29914, 9653, 29914, 726, 580, 4286, 4830, 29898, 3257, 8106, 21111, 580, 13, 9651, 432, 1839, 3385, 29918, 3027, 29918, 26045, 2033, 353, 518, 2084, 29961, 29896, 29955, 13018, 29906, 29929, 29962, 363, 2224, 297, 12428, 29889, 23635, 29898, 13, 18884, 525, 458, 29930, 17548, 333, 543, 29967, 29918, 275, 2120, 3108, 29914, 4563, 29914, 11671, 29914, 1289, 29914, 352, 17548, 1272, 29899, 6799, 543, 8875, 3108, 29914, 492, 29914, 29874, 29368, 3293, 4286, 4830, 29898, 3257, 8106, 21111, 580, 29962, 13, 9651, 364, 29889, 4397, 29898, 29926, 29897, 13, 13, 4706, 1121, 1839, 6768, 2033, 353, 364, 13, 13, 4706, 736, 1121, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 29349, 1358, 353, 10969, 29907, 1610, 1358, 580, 13, 1678, 1596, 29898, 29883, 1610, 1358, 29889, 4704, 29918, 29883, 1610, 1358, 29898, 9675, 29889, 19218, 29961, 29896, 12622, 13, 268, 13, 2 ]
common/src/stack/mq/clients/channel-ctrl.py
khanfluence/stacki-cumulus-switch
0
77253
<reponame>khanfluence/stacki-cumulus-switch #! /opt/stack/bin/python3 # # @copyright@ # Copyright (c) 2006 - 2018 Teradata # All rights reserved. Stacki(r) v5.x stacki.com # https://github.com/Teradata/stacki/blob/master/LICENSE.txt # @copyright@ import sys import getopt import stack.mq import json import zmq try: opt, args = getopt.getopt(sys.argv[1:], 'c:H:',['command','host']) except getopt.GetoptError: print('usage: [ -c enable | disable | status ] [ -H host ] {channel}') sys.exit(-1) control = 'smq' command = 'enable' host = 'localhost' for o, a in opt: if o in ['-h','--help']: usage() elif o in ['-c', '--command']: command = a.strip() elif o in ['-H','--host']: host = a.strip() try: channel = args[0].strip() except: channel = control message = {'channel': channel, 'type':'','command':command} context = zmq.Context() sock = context.socket(zmq.REQ) sock.connect("tcp://%s:%d" % (host, stack.mq.ports.control)) sock.send_string(json.dumps(message)) m = sock.recv().decode() print (m)
[ 1, 529, 276, 1112, 420, 29958, 29895, 5403, 25044, 663, 29914, 1429, 29875, 29899, 29883, 398, 14999, 29899, 15123, 13, 29937, 29991, 847, 3670, 29914, 1429, 29914, 2109, 29914, 4691, 29941, 13, 29937, 13, 29937, 732, 8552, 1266, 29992, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29900, 29953, 448, 29871, 29906, 29900, 29896, 29947, 5061, 7221, 13, 29937, 2178, 10462, 21676, 29889, 10292, 29875, 29898, 29878, 29897, 325, 29945, 29889, 29916, 5096, 29875, 29889, 510, 13, 29937, 2045, 597, 3292, 29889, 510, 29914, 29911, 261, 7221, 29914, 1429, 29875, 29914, 10054, 29914, 6207, 29914, 27888, 1430, 1660, 29889, 3945, 13, 29937, 732, 8552, 1266, 29992, 13, 13, 5215, 10876, 13, 5215, 679, 3670, 13, 5215, 5096, 29889, 28466, 13, 5215, 4390, 13, 5215, 12162, 29939, 13, 13, 2202, 29901, 13, 12, 3670, 29892, 6389, 353, 679, 3670, 29889, 657, 3670, 29898, 9675, 29889, 19218, 29961, 29896, 29901, 1402, 525, 29883, 29901, 29950, 29901, 742, 1839, 6519, 3788, 3069, 11287, 13, 19499, 679, 3670, 29889, 2577, 3670, 2392, 29901, 13, 12, 2158, 877, 21125, 29901, 518, 448, 29883, 9025, 891, 11262, 891, 4660, 4514, 518, 448, 29950, 3495, 4514, 426, 12719, 29913, 1495, 13, 12, 9675, 29889, 13322, 6278, 29896, 29897, 13, 13, 6451, 353, 525, 3844, 29939, 29915, 13, 6519, 353, 525, 12007, 29915, 13, 3069, 353, 525, 7640, 29915, 13, 13, 1454, 288, 29892, 263, 297, 3523, 29901, 13, 12, 361, 288, 297, 6024, 29899, 29882, 3788, 489, 8477, 2033, 29901, 13, 12, 12, 21125, 580, 13, 12, 23681, 288, 297, 6024, 29899, 29883, 742, 525, 489, 6519, 2033, 29901, 13, 12, 12, 6519, 353, 263, 29889, 17010, 580, 13, 12, 23681, 288, 297, 6024, 29899, 29950, 3788, 489, 3069, 2033, 29901, 13, 12, 12, 3069, 353, 263, 29889, 17010, 580, 13, 13, 2202, 29901, 13, 12, 12719, 353, 6389, 29961, 29900, 1822, 17010, 580, 13, 19499, 29901, 13, 12, 12719, 353, 2761, 13, 4906, 353, 11117, 12719, 2396, 8242, 29892, 525, 1853, 22099, 3788, 6519, 2396, 6519, 29913, 13, 13, 4703, 353, 12162, 29939, 29889, 2677, 580, 13, 21852, 353, 3030, 29889, 11514, 29898, 14018, 29939, 29889, 1525, 29984, 29897, 13, 21852, 29889, 6915, 703, 23981, 597, 29995, 29879, 16664, 29881, 29908, 1273, 313, 3069, 29892, 5096, 29889, 28466, 29889, 4011, 29889, 6451, 876, 13, 13, 21852, 29889, 6717, 29918, 1807, 29898, 3126, 29889, 29881, 17204, 29898, 4906, 876, 13, 29885, 353, 577, 384, 29889, 3757, 29894, 2141, 13808, 580, 13, 2158, 313, 29885, 29897, 13, 13, 2 ]
ukz/midi/writer.py
clauderichard/Ultrakazoid
0
118119
<gh_stars>0 import math from .byteutil import * from .config import MidiConfig ################################################ # Note: There are 24 MIDI clocks per quarter-note, apparently... ################################################ class EventCategory: TIMESIGNATURE = 0 TEMPOCHANGE = 1 PROGRAMCHANGE = 2 CONTROLCHANGE = 10 NOTEOFF = 21 # note off BEFORE note on NOTEON = 22 ################################################ class MidiWriter: def __init__(self,filename): self.file = open(filename,'wb') self.eventByteArray = bytearray(b'') # self.eventBytes = [] self.evs = [] self.__addTimeSignature() self.ch = 0 self.endTicks = 0 self.tempoMultiplier = 1 self.__initForCh() def setTpb(self,tpb): MidiConfig.tpb = tpb # ukz's tpb self.tempoMultiplier = 1 if tpb > 127: for i in range(2,1000): if tpb%i==0 and tpb//i <= 127: self.tpb = tpb//i #header's tpb self.tempoMultiplier = i return raise Exception(f"Value tpb={tpb} is a bad one") else: self.tpb = tpb self.tempoMultiplier = 1 def __addTimeSignature(self): # Time signature bytes: FF 58 04 nn dd cc bb # The fraction you see on a score would be nn / 2^dd # (denominator always has to be power of 2) # cc = number of MIDI clocks in a metronome click. # bb = number of notated 32nd-notes in a MIDI quarter-note. # bb was added in MIDI to support legacy(?) self.__addGenericEvent(0, EventCategory.TIMESIGNATURE, b'\xFF\x58\x04\x04\x02\x24\x08') # def getMaxEventBeats(self): # maxTicks = max(map(lambda e: e[0], self.evs)) # return maxTicks / MidiConfig.tpb def getMaxEventTicks(self): return max(map(lambda e: e[0], self.evs)) def __initForCh(self): chBytePos = self.ch << 16 self.chNoteOn = 0x900000 | chBytePos self.chNoteOff = 0x800000 | chBytePos self.chPitchBend = 0xE00000 | chBytePos def switchToChannel(self,channelNumber): if channelNumber < 0 or channelNumber > 15: raise ValueError("Bad channel number") self.ch = channelNumber self.__initForCh() def __addGenericEvent(self,time,category,eventBytes): if isinstance(time,float): raise 'what!' timeTicks = time self.evs.append((timeTicks,category,eventBytes)) # Argument tempo in beats per minute def addTempoChange(self,t,beatsPerMinute): if t < 0: raise ValueError("Negative time!") if beatsPerMinute < 1: raise Exception("That's a little too slow, man.") # One beat is 24 ticks. # bpm = 120 => µsecsPerBeat = 500,000 microsecondsPerBeat = 60000000//beatsPerMinute # X beat/min == Y µsec/beat # 1 min = X beats = (X*Y) µsecs # 1 min = 60 million µsecs # 0xA120 in decimal is 500000 self.addTempoChangeMicroseconds(t,microsecondsPerBeat) # Argument tempo in beats per minute def addTempoChangeMicroseconds(self,t,microsecondsPerBeat): if t < 0: raise ValueError("Negative time!") if self.tempoMultiplier > 1: microsecondsPerBeat = microsecondsPerBeat // self.tempoMultiplier if microsecondsPerBeat < 1: raise Exception("That's a little too fast, man.") if microsecondsPerBeat >= 2**24: raise Exception("That's a little too slow, man.") theBytes = bytearray(b'\xFF\x51') + intToLengthedBytes3(microsecondsPerBeat) self.__addGenericEvent(t, EventCategory.TEMPOCHANGE, theBytes) def addProgramChanges(self,t,channelPrograms): for ch,prog in channelPrograms: if t < 0: raise ValueError("Negative time!") if prog < 0 or prog > 127: raise ValueError("Bad program number") theBytes = bytearray([0xc0 | ch,prog]) self.__addGenericEvent(0, EventCategory.PROGRAMCHANGE, theBytes) def addProgramChange(self,ch,t,prog): if t < 0: raise ValueError("Negative time!") if prog < 0 or prog > 127: raise ValueError("Bad program number") #theBytes = prog | ((0xc0 | self.ch)<<8).to_bytes(2) theBytes = bytearray([0xc0 | ch,prog]) self.__addGenericEvent(0, EventCategory.PROGRAMCHANGE, theBytes) ################################################ def addInitialVolumes(self,time,channelVolumes): for ch,vol in channelVolumes: self.addControllerEvent(ch,7,time,vol) self.addControllerEvent(ch,11,time,127) def addInitialVolume(self,ch,time,vol): self.addControllerEvent(ch,7,time,vol) self.addControllerEvent(ch,11,time,127) def addControllerEvent(self,ch,ctrl,time,val): if val < 0 or val > 127: raise Exception("Bend out of range!") if time < 0: raise Exception("Time negative!") theBytes = bytearray([0xB0 | ch, ctrl, val]) self.__addGenericEvent(time, EventCategory.CONTROLCHANGE, theBytes) def addControllerEventStream(self,ctrl,channelTimeVals): evs = self.evs category = EventCategory.CONTROLCHANGE for ch,time,val in channelTimeVals: if val < 0 or val > 127: raise Exception("Bend out of range!") if time < 0: raise Exception("Time negative!") theBytes = bytearray([0xB0 | ch, ctrl, val]) # self.__addGenericEvent(time, EventCategory.CONTROLCHANGE, theBytes) timeTicks = time evs.append((timeTicks,category,theBytes)) ################################################ # Assume this works like any other controller. # But here we map bend value to the range # that MIDI's pitch-bend event expects. def addPitchBend(self,ch,time,bend): if bend < 0 or bend > 127: raise Exception("Bend out of range!") if time < 0: raise Exception("Time negative!") #theBytes = (self.chPitchBend | (bend<<8) | bend).to_bytes(3,'big') theBytes = bytearray([0xE0 | ch, bend, bend]) self.__addGenericEvent(time, EventCategory.CONTROLCHANGE, theBytes) def addNotes(self,notes): for note in notes: if note.p < 0 or note.p > 127: raise Exception("Pitch out of range!") if note.t < 0: raise Exception("Time negative!") if note.d < 0: raise Exception("Duration negative!") if note.l < 0 or note.l > 127: raise Exception("Velocity out of range!") # 0x90 is status byte for noteOn # 0x80 is status byte for noteOff # theBytesOn = (self.chNoteOn | (pitch<<8) | vel).to_bytes(3,'big') theBytesOn = bytearray([0x90 | note.c, note.p, note.l]) # theBytesOff = (self.chNoteOff | (pitch<<8) | vel).to_bytes(3,'big') theBytesOff = bytearray([0x80 | note.c, note.p, note.l]) timeTicksOn = note.t timeTicksOff = note.t+note.d if isinstance(timeTicksOn,float) or isinstance(timeTicksOff,float): raise 'what!' self.evs.append((timeTicksOn, EventCategory.NOTEON, theBytesOn)) self.evs.append((timeTicksOff, EventCategory.NOTEOFF, theBytesOff)) def setEndTime(self,t): self.endTicks = t def __setEventBytes(self): self.evs.sort() curtimeTicks = 0 self.eventByteArray = bytearray(b'') bs = bytearray() for timeTicks,_,ebytes in self.evs: deltaTicks = timeTicks-curtimeTicks # self.eventByteArray.extend(intToVarLengthBytes(deltaTicks)) if deltaTicks==0: self.eventByteArray += b'\x00' else: bs.clear() bs.insert(0, deltaTicks % 128) # rightmost byte, bit 7 NOT set m = deltaTicks >> 7 while m > 0: bs.insert(0, (m % 128) | 0x80) # NOT rightmost byte, bit 7 IS set m >>= 7 self.eventByteArray += bs self.eventByteArray.extend(ebytes) curtimeTicks = timeTicks deltaTicks = self.endTicks - curtimeTicks self.eventByteArray.extend(intToVarLengthBytes(deltaTicks)) self.eventByteArray.extend(b'\xFF\x2F\x00') # self.eventByteArray.extend(b'\x00\xFF\x2F\x00') # track end def writeFile(self): self.__writeHeaderChunk() self.__setEventBytes() self.__writeChunk(b'MTrk',self.eventByteArray) self.file.close() def __writeChunk(self,typenameBytes,chunkBytesArray): self.__writeBytes(typenameBytes) self.__writeBytes(intToBytes(len(chunkBytesArray), 4)) self.__writeBytes(chunkBytesArray) def __writeHeaderChunk(self): headerBytes = bytearray(b'\x00\x00\x00\x01\x00') headerBytes += bytes([self.tpb]) self.__writeChunk(b'MThd',headerBytes) def __writeBytes(self,theBytes): self.file.write(theBytes)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 5844, 13, 3166, 869, 10389, 4422, 1053, 334, 13, 3166, 869, 2917, 1053, 341, 8819, 3991, 13, 13, 13383, 13383, 13383, 13, 13, 29937, 3940, 29901, 1670, 526, 29871, 29906, 29946, 341, 1367, 29902, 12006, 29879, 639, 12616, 29899, 6812, 29892, 13229, 856, 13, 13, 13383, 13383, 13383, 13, 13, 1990, 6864, 10900, 29901, 13, 1678, 323, 8890, 5425, 20728, 1299, 11499, 353, 29871, 29900, 13, 1678, 17067, 3580, 29949, 3210, 24336, 353, 29871, 29896, 13, 1678, 13756, 29954, 25058, 3210, 24336, 353, 29871, 29906, 13, 13, 1678, 8707, 29911, 1672, 29931, 3210, 24336, 353, 29871, 29896, 29900, 13, 13, 1678, 6058, 29923, 27681, 353, 29871, 29906, 29896, 396, 4443, 1283, 20700, 5800, 1525, 4443, 373, 13, 1678, 6058, 29923, 1164, 353, 29871, 29906, 29906, 13, 13, 13383, 13383, 13383, 13, 13, 1990, 341, 8819, 10507, 29901, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9507, 1125, 13, 4706, 1583, 29889, 1445, 353, 1722, 29898, 9507, 5501, 29893, 29890, 1495, 13, 4706, 1583, 29889, 3696, 12901, 2588, 353, 7023, 2378, 29898, 29890, 29915, 1495, 13, 4706, 396, 1583, 29889, 3696, 11207, 353, 5159, 13, 4706, 1583, 29889, 29872, 4270, 353, 5159, 13, 4706, 1583, 17255, 1202, 2481, 10140, 1535, 580, 13, 4706, 1583, 29889, 305, 353, 29871, 29900, 13, 4706, 1583, 29889, 355, 29911, 7358, 353, 29871, 29900, 13, 4706, 1583, 29889, 1356, 1129, 6857, 666, 4926, 353, 29871, 29896, 13, 4706, 1583, 17255, 2344, 2831, 1451, 580, 13, 13, 1678, 822, 731, 29911, 24381, 29898, 1311, 29892, 9392, 29890, 1125, 13, 4706, 341, 8819, 3991, 29889, 9392, 29890, 353, 260, 24381, 396, 18293, 29920, 29915, 29879, 260, 24381, 13, 4706, 1583, 29889, 1356, 1129, 6857, 666, 4926, 353, 29871, 29896, 13, 4706, 565, 260, 24381, 1405, 29871, 29896, 29906, 29955, 29901, 13, 9651, 363, 474, 297, 3464, 29898, 29906, 29892, 29896, 29900, 29900, 29900, 1125, 13, 18884, 565, 260, 24381, 29995, 29875, 1360, 29900, 322, 260, 24381, 458, 29875, 5277, 29871, 29896, 29906, 29955, 29901, 13, 462, 1678, 1583, 29889, 9392, 29890, 353, 260, 24381, 458, 29875, 396, 6672, 29915, 29879, 260, 24381, 13, 462, 1678, 1583, 29889, 1356, 1129, 6857, 666, 4926, 353, 474, 13, 462, 1678, 736, 13, 9651, 12020, 8960, 29898, 29888, 29908, 1917, 260, 24381, 3790, 9392, 29890, 29913, 338, 263, 4319, 697, 1159, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 9392, 29890, 353, 260, 24381, 13, 9651, 1583, 29889, 1356, 1129, 6857, 666, 4926, 353, 29871, 29896, 13, 268, 13, 1678, 822, 4770, 1202, 2481, 10140, 1535, 29898, 1311, 1125, 13, 4706, 396, 5974, 12608, 6262, 29901, 21379, 29871, 29945, 29947, 29871, 29900, 29946, 302, 29876, 24488, 21759, 289, 29890, 13, 4706, 396, 450, 15958, 366, 1074, 373, 263, 8158, 723, 367, 302, 29876, 847, 29871, 29906, 29985, 1289, 13, 4706, 396, 259, 313, 1145, 5817, 1061, 2337, 756, 304, 367, 3081, 310, 29871, 29906, 29897, 13, 4706, 396, 21759, 353, 1353, 310, 341, 1367, 29902, 12006, 29879, 297, 263, 1539, 1617, 608, 2828, 29889, 13, 4706, 396, 289, 29890, 353, 1353, 310, 451, 630, 29871, 29941, 29906, 299, 29899, 16953, 297, 263, 341, 1367, 29902, 12616, 29899, 6812, 29889, 13, 4706, 396, 259, 289, 29890, 471, 2715, 297, 341, 1367, 29902, 304, 2304, 25000, 29898, 7897, 13, 13, 4706, 1583, 17255, 1202, 15809, 2624, 29898, 29900, 29892, 6864, 10900, 29889, 15307, 5425, 20728, 1299, 11499, 29892, 289, 12764, 29916, 4198, 29905, 29916, 29945, 29947, 29905, 29916, 29900, 29946, 29905, 29916, 29900, 29946, 29905, 29916, 29900, 29906, 29905, 29916, 29906, 29946, 29905, 29916, 29900, 29947, 1495, 13, 13, 1678, 396, 822, 679, 7976, 2624, 3629, 1446, 29898, 1311, 1125, 13, 1678, 396, 268, 4236, 29911, 7358, 353, 4236, 29898, 1958, 29898, 2892, 321, 29901, 321, 29961, 29900, 1402, 1583, 29889, 29872, 4270, 876, 13, 1678, 396, 268, 736, 4236, 29911, 7358, 847, 341, 8819, 3991, 29889, 9392, 29890, 13, 13, 1678, 822, 679, 7976, 2624, 29911, 7358, 29898, 1311, 1125, 13, 4706, 736, 4236, 29898, 1958, 29898, 2892, 321, 29901, 321, 29961, 29900, 1402, 1583, 29889, 29872, 4270, 876, 13, 13, 1678, 822, 4770, 2344, 2831, 1451, 29898, 1311, 1125, 13, 4706, 521, 12901, 9135, 353, 1583, 29889, 305, 3532, 29871, 29896, 29953, 13, 4706, 1583, 29889, 305, 9842, 2951, 353, 29871, 29900, 29916, 29929, 29900, 29900, 29900, 29900, 29900, 891, 521, 12901, 9135, 13, 4706, 1583, 29889, 305, 9842, 6880, 353, 29871, 29900, 29916, 29947, 29900, 29900, 29900, 29900, 29900, 891, 521, 12901, 9135, 13, 4706, 1583, 29889, 305, 29925, 2335, 29933, 355, 353, 29871, 29900, 29916, 29923, 29900, 29900, 29900, 29900, 29900, 891, 521, 12901, 9135, 13, 268, 13, 1678, 822, 4607, 1762, 13599, 29898, 1311, 29892, 12719, 4557, 1125, 13, 4706, 565, 8242, 4557, 529, 29871, 29900, 470, 8242, 4557, 1405, 29871, 29896, 29945, 29901, 13, 9651, 12020, 7865, 2392, 703, 22050, 8242, 1353, 1159, 13, 4706, 1583, 29889, 305, 353, 8242, 4557, 13, 4706, 1583, 17255, 2344, 2831, 1451, 580, 13, 268, 13, 1678, 822, 4770, 1202, 15809, 2624, 29898, 1311, 29892, 2230, 29892, 7320, 29892, 3696, 11207, 1125, 13, 4706, 565, 338, 8758, 29898, 2230, 29892, 7411, 1125, 13, 9651, 12020, 525, 5816, 20714, 13, 4706, 931, 29911, 7358, 353, 931, 13, 4706, 1583, 29889, 29872, 4270, 29889, 4397, 3552, 2230, 29911, 7358, 29892, 7320, 29892, 3696, 11207, 876, 13, 13, 1678, 396, 23125, 11413, 297, 367, 1446, 639, 11015, 13, 1678, 822, 788, 5776, 1129, 7277, 29898, 1311, 29892, 29873, 29892, 915, 1446, 5894, 8140, 1082, 1125, 13, 4706, 565, 260, 529, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 29940, 387, 1230, 931, 29991, 1159, 13, 4706, 565, 367, 1446, 5894, 8140, 1082, 529, 29871, 29896, 29901, 13, 9651, 12020, 8960, 703, 7058, 29915, 29879, 263, 2217, 2086, 5232, 29892, 767, 23157, 13, 308, 13, 4706, 396, 3118, 16646, 338, 29871, 29906, 29946, 260, 7358, 29889, 13, 4706, 396, 289, 3358, 353, 29871, 29896, 29906, 29900, 29871, 1149, 259, 30263, 344, 2395, 5894, 3629, 271, 353, 29871, 29945, 29900, 29900, 29892, 29900, 29900, 29900, 13, 4706, 9200, 23128, 5894, 3629, 271, 353, 29871, 29953, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 458, 915, 1446, 5894, 8140, 1082, 13, 4706, 396, 1060, 16646, 29914, 1195, 1275, 612, 29871, 30263, 3471, 29914, 915, 271, 13, 4706, 396, 29871, 29896, 1375, 353, 1060, 367, 1446, 353, 313, 29990, 29930, 29979, 29897, 29871, 30263, 344, 2395, 13, 4706, 396, 29871, 29896, 1375, 353, 29871, 29953, 29900, 7284, 29871, 30263, 344, 2395, 13, 4706, 396, 29871, 29900, 29916, 29909, 29896, 29906, 29900, 297, 13677, 338, 29871, 29945, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 1583, 29889, 1202, 5776, 1129, 7277, 29924, 2357, 23128, 29898, 29873, 29892, 29885, 2357, 23128, 5894, 3629, 271, 29897, 13, 308, 13, 1678, 396, 23125, 11413, 297, 367, 1446, 639, 11015, 13, 1678, 822, 788, 5776, 1129, 7277, 29924, 2357, 23128, 29898, 1311, 29892, 29873, 29892, 29885, 2357, 23128, 5894, 3629, 271, 1125, 13, 4706, 565, 260, 529, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 29940, 387, 1230, 931, 29991, 1159, 13, 13, 4706, 565, 1583, 29889, 1356, 1129, 6857, 666, 4926, 1405, 29871, 29896, 29901, 13, 9651, 9200, 23128, 5894, 3629, 271, 353, 9200, 23128, 5894, 3629, 271, 849, 1583, 29889, 1356, 1129, 6857, 666, 4926, 13, 13, 4706, 565, 9200, 23128, 5894, 3629, 271, 529, 29871, 29896, 29901, 13, 9651, 12020, 8960, 703, 7058, 29915, 29879, 263, 2217, 2086, 5172, 29892, 767, 23157, 13, 4706, 565, 9200, 23128, 5894, 3629, 271, 6736, 29871, 29906, 1068, 29906, 29946, 29901, 13, 9651, 12020, 8960, 703, 7058, 29915, 29879, 263, 2217, 2086, 5232, 29892, 767, 23157, 13, 308, 13, 4706, 278, 11207, 353, 7023, 2378, 29898, 29890, 12764, 29916, 4198, 29905, 29916, 29945, 29896, 1495, 718, 938, 1762, 6513, 287, 11207, 29941, 29898, 29885, 2357, 23128, 5894, 3629, 271, 29897, 13, 4706, 1583, 17255, 1202, 15809, 2624, 29898, 29873, 29892, 6864, 10900, 29889, 4330, 3580, 29949, 3210, 24336, 29892, 278, 11207, 29897, 13, 308, 13, 1678, 822, 788, 9283, 21459, 29898, 1311, 29892, 29873, 29892, 12719, 9283, 29879, 1125, 13, 4706, 363, 521, 29892, 29097, 297, 8242, 9283, 29879, 29901, 13, 9651, 565, 260, 529, 29871, 29900, 29901, 13, 18884, 12020, 7865, 2392, 703, 29940, 387, 1230, 931, 29991, 1159, 13, 9651, 565, 410, 29887, 529, 29871, 29900, 470, 410, 29887, 1405, 29871, 29896, 29906, 29955, 29901, 13, 18884, 12020, 7865, 2392, 703, 22050, 1824, 1353, 1159, 13, 632, 13, 9651, 278, 11207, 353, 7023, 2378, 4197, 29900, 21791, 29900, 891, 521, 29892, 29097, 2314, 13, 9651, 1583, 17255, 1202, 15809, 2624, 29898, 29900, 29892, 6864, 10900, 29889, 8618, 29954, 25058, 3210, 24336, 29892, 278, 11207, 29897, 13, 268, 13, 1678, 822, 788, 9283, 7277, 29898, 1311, 29892, 305, 29892, 29873, 29892, 29097, 1125, 13, 4706, 565, 260, 529, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 29940, 387, 1230, 931, 29991, 1159, 13, 4706, 565, 410, 29887, 529, 29871, 29900, 470, 410, 29887, 1405, 29871, 29896, 29906, 29955, 29901, 13, 9651, 12020, 7865, 2392, 703, 22050, 1824, 1353, 1159, 13, 308, 13, 4706, 396, 1552, 11207, 353, 410, 29887, 891, 5135, 29900, 21791, 29900, 891, 1583, 29889, 305, 29897, 9314, 29947, 467, 517, 29918, 13193, 29898, 29906, 29897, 13, 4706, 278, 11207, 353, 7023, 2378, 4197, 29900, 21791, 29900, 891, 521, 29892, 29097, 2314, 13, 4706, 1583, 17255, 1202, 15809, 2624, 29898, 29900, 29892, 6864, 10900, 29889, 8618, 29954, 25058, 3210, 24336, 29892, 278, 11207, 29897, 13, 268, 13, 13383, 13383, 13383, 13, 13, 1678, 822, 788, 15514, 13072, 9351, 29898, 1311, 29892, 2230, 29892, 12719, 13072, 9351, 1125, 13, 4706, 363, 521, 29892, 1555, 297, 8242, 13072, 9351, 29901, 13, 9651, 1583, 29889, 1202, 2956, 2624, 29898, 305, 29892, 29955, 29892, 2230, 29892, 1555, 29897, 13, 9651, 1583, 29889, 1202, 2956, 2624, 29898, 305, 29892, 29896, 29896, 29892, 2230, 29892, 29896, 29906, 29955, 29897, 13, 13, 1678, 822, 788, 15514, 24679, 29898, 1311, 29892, 305, 29892, 2230, 29892, 1555, 1125, 13, 4706, 1583, 29889, 1202, 2956, 2624, 29898, 305, 29892, 29955, 29892, 2230, 29892, 1555, 29897, 13, 4706, 1583, 29889, 1202, 2956, 2624, 29898, 305, 29892, 29896, 29896, 29892, 2230, 29892, 29896, 29906, 29955, 29897, 13, 13, 1678, 822, 788, 2956, 2624, 29898, 1311, 29892, 305, 29892, 24220, 29892, 2230, 29892, 791, 1125, 13, 4706, 565, 659, 529, 29871, 29900, 470, 659, 1405, 29871, 29896, 29906, 29955, 29901, 13, 9651, 12020, 8960, 703, 29933, 355, 714, 310, 3464, 29991, 1159, 13, 4706, 565, 931, 529, 29871, 29900, 29901, 13, 9651, 12020, 8960, 703, 2481, 8178, 29991, 1159, 13, 308, 13, 4706, 278, 11207, 353, 7023, 2378, 4197, 29900, 29916, 29933, 29900, 891, 521, 29892, 274, 11742, 29892, 659, 2314, 13, 4706, 1583, 17255, 1202, 15809, 2624, 29898, 2230, 29892, 6864, 10900, 29889, 22412, 1672, 29931, 3210, 24336, 29892, 278, 11207, 29897, 13, 13, 1678, 822, 788, 2956, 2624, 3835, 29898, 1311, 29892, 24220, 29892, 12719, 2481, 29963, 1338, 1125, 13, 4706, 3415, 29879, 353, 1583, 29889, 29872, 4270, 13, 4706, 7663, 353, 6864, 10900, 29889, 22412, 1672, 29931, 3210, 24336, 13, 4706, 363, 521, 29892, 2230, 29892, 791, 297, 8242, 2481, 29963, 1338, 29901, 13, 9651, 565, 659, 529, 29871, 29900, 470, 659, 1405, 29871, 29896, 29906, 29955, 29901, 13, 18884, 12020, 8960, 703, 29933, 355, 714, 310, 3464, 29991, 1159, 13, 9651, 565, 931, 529, 29871, 29900, 29901, 13, 18884, 12020, 8960, 703, 2481, 8178, 29991, 1159, 13, 308, 13, 9651, 278, 11207, 353, 7023, 2378, 4197, 29900, 29916, 29933, 29900, 891, 521, 29892, 274, 11742, 29892, 659, 2314, 13, 632, 13, 9651, 396, 1583, 17255, 1202, 15809, 2624, 29898, 2230, 29892, 6864, 10900, 29889, 22412, 1672, 29931, 3210, 24336, 29892, 278, 11207, 29897, 13, 9651, 931, 29911, 7358, 353, 931, 13, 9651, 3415, 29879, 29889, 4397, 3552, 2230, 29911, 7358, 29892, 7320, 29892, 1552, 11207, 876, 13, 13, 13383, 13383, 13383, 13, 13, 1678, 396, 22680, 445, 1736, 763, 738, 916, 4701, 29889, 13, 1678, 396, 1205, 1244, 591, 2910, 289, 355, 995, 304, 278, 3464, 13, 1678, 396, 259, 393, 341, 1367, 29902, 29915, 29879, 15905, 29899, 29890, 355, 1741, 23347, 29889, 13, 1678, 822, 788, 29925, 2335, 29933, 355, 29898, 1311, 29892, 305, 29892, 2230, 29892, 29890, 355, 1125, 13, 4706, 565, 289, 355, 529, 29871, 29900, 470, 289, 355, 1405, 29871, 29896, 29906, 29955, 29901, 13, 9651, 12020, 8960, 703, 29933, 355, 714, 310, 3464, 29991, 1159, 13, 4706, 565, 931, 529, 29871, 29900, 29901, 13, 9651, 12020, 8960, 703, 2481, 8178, 29991, 1159, 13, 13, 4706, 396, 1552, 11207, 353, 313, 1311, 29889, 305, 29925, 2335, 29933, 355, 891, 313, 29890, 355, 9314, 29947, 29897, 891, 289, 355, 467, 517, 29918, 13193, 29898, 29941, 5501, 3752, 1495, 13, 4706, 278, 11207, 353, 7023, 2378, 4197, 29900, 29916, 29923, 29900, 891, 521, 29892, 289, 355, 29892, 289, 355, 2314, 13, 4706, 1583, 17255, 1202, 15809, 2624, 29898, 2230, 29892, 6864, 10900, 29889, 22412, 1672, 29931, 3210, 24336, 29892, 278, 11207, 29897, 13, 13, 1678, 822, 788, 3664, 267, 29898, 1311, 29892, 16953, 1125, 13, 4706, 363, 4443, 297, 11486, 29901, 13, 632, 13, 9651, 565, 4443, 29889, 29886, 529, 29871, 29900, 470, 4443, 29889, 29886, 1405, 29871, 29896, 29906, 29955, 29901, 13, 18884, 12020, 8960, 703, 29925, 2335, 714, 310, 3464, 29991, 1159, 13, 9651, 565, 4443, 29889, 29873, 529, 29871, 29900, 29901, 13, 18884, 12020, 8960, 703, 2481, 8178, 29991, 1159, 13, 9651, 565, 4443, 29889, 29881, 529, 29871, 29900, 29901, 13, 18884, 12020, 8960, 703, 18984, 8178, 29991, 1159, 13, 9651, 565, 4443, 29889, 29880, 529, 29871, 29900, 470, 4443, 29889, 29880, 1405, 29871, 29896, 29906, 29955, 29901, 13, 18884, 12020, 8960, 703, 29963, 295, 25245, 714, 310, 3464, 29991, 1159, 13, 13, 9651, 396, 29871, 29900, 29916, 29929, 29900, 338, 4660, 7023, 363, 4443, 2951, 13, 9651, 396, 29871, 29900, 29916, 29947, 29900, 338, 4660, 7023, 363, 4443, 6880, 13, 9651, 396, 278, 11207, 2951, 353, 313, 1311, 29889, 305, 9842, 2951, 891, 313, 29886, 2335, 9314, 29947, 29897, 891, 5343, 467, 517, 29918, 13193, 29898, 29941, 5501, 3752, 1495, 13, 9651, 278, 11207, 2951, 353, 7023, 2378, 4197, 29900, 29916, 29929, 29900, 891, 4443, 29889, 29883, 29892, 4443, 29889, 29886, 29892, 4443, 29889, 29880, 2314, 13, 9651, 396, 278, 11207, 6880, 353, 313, 1311, 29889, 305, 9842, 6880, 891, 313, 29886, 2335, 9314, 29947, 29897, 891, 5343, 467, 517, 29918, 13193, 29898, 29941, 5501, 3752, 1495, 13, 9651, 278, 11207, 6880, 353, 7023, 2378, 4197, 29900, 29916, 29947, 29900, 891, 4443, 29889, 29883, 29892, 4443, 29889, 29886, 29892, 4443, 29889, 29880, 2314, 13, 632, 13, 9651, 931, 29911, 7358, 2951, 353, 4443, 29889, 29873, 13, 9651, 931, 29911, 7358, 6880, 353, 4443, 29889, 29873, 29974, 6812, 29889, 29881, 13, 9651, 565, 338, 8758, 29898, 2230, 29911, 7358, 2951, 29892, 7411, 29897, 470, 338, 8758, 29898, 2230, 29911, 7358, 6880, 29892, 7411, 1125, 13, 18884, 12020, 525, 5816, 20714, 13, 9651, 1583, 29889, 29872, 4270, 29889, 4397, 3552, 2230, 29911, 7358, 2951, 29892, 6864, 10900, 29889, 12256, 29923, 1164, 29892, 278, 11207, 2951, 876, 13, 9651, 1583, 29889, 29872, 4270, 29889, 4397, 3552, 2230, 29911, 7358, 6880, 29892, 6864, 10900, 29889, 12256, 29923, 27681, 29892, 278, 11207, 6880, 876, 13, 632, 13, 13, 1678, 822, 731, 5044, 2481, 29898, 1311, 29892, 29873, 1125, 13, 4706, 1583, 29889, 355, 29911, 7358, 353, 260, 13, 13, 1678, 822, 4770, 842, 2624, 11207, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29872, 4270, 29889, 6605, 580, 13, 4706, 3151, 2230, 29911, 7358, 353, 29871, 29900, 13, 4706, 1583, 29889, 3696, 12901, 2588, 353, 7023, 2378, 29898, 29890, 29915, 1495, 13, 308, 13, 4706, 24512, 353, 7023, 2378, 580, 13, 13, 4706, 363, 931, 29911, 7358, 29892, 3383, 774, 29891, 2167, 297, 1583, 29889, 29872, 4270, 29901, 13, 9651, 19471, 29911, 7358, 353, 931, 29911, 7358, 29899, 2764, 2230, 29911, 7358, 13, 632, 13, 9651, 396, 1583, 29889, 3696, 12901, 2588, 29889, 21843, 29898, 524, 1762, 9037, 6513, 11207, 29898, 4181, 29911, 7358, 876, 13, 9651, 565, 19471, 29911, 7358, 1360, 29900, 29901, 13, 18884, 1583, 29889, 3696, 12901, 2588, 4619, 289, 12764, 29916, 29900, 29900, 29915, 13, 9651, 1683, 29901, 13, 18884, 24512, 29889, 8551, 580, 13, 18884, 24512, 29889, 7851, 29898, 29900, 29892, 19471, 29911, 7358, 1273, 29871, 29896, 29906, 29947, 29897, 396, 1492, 3242, 7023, 29892, 2586, 29871, 29955, 6058, 731, 13, 18884, 286, 353, 19471, 29911, 7358, 5099, 29871, 29955, 13, 18884, 1550, 286, 1405, 29871, 29900, 29901, 13, 462, 1678, 24512, 29889, 7851, 29898, 29900, 29892, 313, 29885, 1273, 29871, 29896, 29906, 29947, 29897, 891, 29871, 29900, 29916, 29947, 29900, 29897, 396, 6058, 1492, 3242, 7023, 29892, 2586, 29871, 29955, 8519, 731, 13, 462, 1678, 286, 5099, 29922, 29871, 29955, 13, 18884, 1583, 29889, 3696, 12901, 2588, 4619, 24512, 13, 13, 9651, 1583, 29889, 3696, 12901, 2588, 29889, 21843, 29898, 774, 29891, 2167, 29897, 13, 9651, 3151, 2230, 29911, 7358, 353, 931, 29911, 7358, 13, 13, 4706, 19471, 29911, 7358, 353, 1583, 29889, 355, 29911, 7358, 448, 3151, 2230, 29911, 7358, 13, 4706, 1583, 29889, 3696, 12901, 2588, 29889, 21843, 29898, 524, 1762, 9037, 6513, 11207, 29898, 4181, 29911, 7358, 876, 13, 4706, 1583, 29889, 3696, 12901, 2588, 29889, 21843, 29898, 29890, 12764, 29916, 4198, 29905, 29916, 29906, 29943, 29905, 29916, 29900, 29900, 1495, 13, 4706, 396, 1583, 29889, 3696, 12901, 2588, 29889, 21843, 29898, 29890, 12764, 29916, 29900, 29900, 29905, 29916, 4198, 29905, 29916, 29906, 29943, 29905, 29916, 29900, 29900, 1495, 396, 5702, 1095, 13, 268, 13, 1678, 822, 2436, 2283, 29898, 1311, 1125, 13, 4706, 1583, 17255, 3539, 7850, 1451, 2960, 580, 13, 4706, 1583, 17255, 842, 2624, 11207, 580, 13, 4706, 1583, 17255, 3539, 1451, 2960, 29898, 29890, 29915, 29924, 2308, 29895, 742, 1311, 29889, 3696, 12901, 2588, 29897, 13, 4706, 1583, 29889, 1445, 29889, 5358, 580, 13, 13, 1678, 822, 4770, 3539, 1451, 2960, 29898, 1311, 29892, 22646, 11207, 29892, 29812, 11207, 2588, 1125, 13, 4706, 1583, 17255, 3539, 11207, 29898, 22646, 11207, 29897, 13, 4706, 1583, 17255, 3539, 11207, 29898, 524, 1762, 11207, 29898, 2435, 29898, 29812, 11207, 2588, 511, 29871, 29946, 876, 13, 4706, 1583, 17255, 3539, 11207, 29898, 29812, 11207, 2588, 29897, 13, 13, 1678, 822, 4770, 3539, 7850, 1451, 2960, 29898, 1311, 1125, 13, 4706, 4839, 11207, 353, 7023, 2378, 29898, 29890, 12764, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29896, 29905, 29916, 29900, 29900, 1495, 13, 4706, 4839, 11207, 4619, 6262, 4197, 1311, 29889, 9392, 29890, 2314, 13, 4706, 1583, 17255, 3539, 1451, 2960, 29898, 29890, 29915, 29924, 1349, 29881, 742, 6672, 11207, 29897, 13, 268, 13, 1678, 822, 4770, 3539, 11207, 29898, 1311, 29892, 1552, 11207, 1125, 13, 4706, 1583, 29889, 1445, 29889, 3539, 29898, 1552, 11207, 29897, 13, 268, 2 ]
mailbag/emailModel.py
UAlbanyArchives/mailbag
19
181860
from jsonmodels import models, fields, errors, validators class Email(models.Base): """EmailModel - model class for email formats""" Message_ID = fields.StringField(required=True) Email_Folder = fields.StringField() Original_Filename = fields.StringField() Date = fields.StringField() From = fields.StringField() To = fields.StringField() Cc = fields.StringField() Bcc = fields.StringField() Subject = fields.StringField() Content_Type = fields.StringField()
[ 1, 515, 4390, 9794, 1053, 4733, 29892, 4235, 29892, 4436, 29892, 2854, 4097, 13, 13, 1990, 22608, 29898, 9794, 29889, 5160, 1125, 13, 1678, 9995, 9823, 3195, 448, 1904, 770, 363, 4876, 21971, 15945, 29908, 13, 1678, 7777, 29918, 1367, 353, 4235, 29889, 1231, 3073, 29898, 12403, 29922, 5574, 29897, 13, 1678, 22608, 29918, 12924, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 8533, 29918, 3434, 3871, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 4712, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 3645, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 1763, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 315, 29883, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 350, 617, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 3323, 622, 353, 4235, 29889, 1231, 3073, 580, 13, 1678, 10576, 29918, 1542, 353, 4235, 29889, 1231, 3073, 580, 268, 2 ]
examples/photovoltaic/PVProfileInitialization.py
noah80/tsib
14
1615256
<reponame>noah80/tsib # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # # Test weather data and pvlib # %% import matplotlib.pyplot as plt # %matplotlib inline # %load_ext autoreload # %autoreload 2 import tsib # %% [markdown] # ## 1. Simulate PV with TRY data # %% try_data, loc = tsib.readTRY(5) # %% tmy_data = tsib.TRY2TMY(try_data) # %% pv_try, space_cov = tsib.simPhotovoltaic(tmy_data, latitude = loc['latitude'], longitude = loc['longitude'], losses = 0.1,integrateInverter = True) # %% pv_try.sum() # %% pv_try.plot() # %% [markdown] # ## 2. Simulate with COSMO6 data # %% try_data, identifier = tsib.readCosmo(os.path.join(os.environ['DATA_SHARE'], 'weather','cosmo','rea6','processed'), loc['longitude'], loc['latitude'], 2010 ) # %% tmy_data = tsib.TRY2TMY(try_data) # %% pv_try, space_cov = tsib.simPhotovoltaic(tmy_data, latitude = loc['latitude'], longitude = loc['longitude'], losses = 0.1) # %% pv_try.sum() # %%
[ 1, 529, 276, 1112, 420, 29958, 1217, 801, 29947, 29900, 29914, 1372, 747, 13, 29937, 11474, 13, 29937, 432, 786, 25547, 29901, 13, 29937, 259, 432, 786, 29891, 726, 29901, 13, 29937, 268, 1426, 29918, 276, 26081, 29901, 13, 29937, 539, 6081, 29901, 869, 2272, 13, 29937, 539, 3402, 29918, 978, 29901, 10151, 13, 29937, 539, 3402, 29918, 3259, 29901, 525, 29896, 29889, 29941, 29915, 13, 29937, 539, 432, 786, 29891, 726, 29918, 3259, 29901, 29871, 29896, 29889, 29946, 29889, 29906, 13, 29937, 259, 413, 824, 1379, 3135, 29901, 13, 29937, 268, 2479, 29918, 978, 29901, 5132, 29871, 29941, 13, 29937, 268, 4086, 29901, 3017, 13, 29937, 268, 1024, 29901, 3017, 29941, 13, 29937, 11474, 13, 13, 29937, 17806, 518, 3502, 3204, 29962, 13, 29937, 396, 4321, 14826, 848, 322, 282, 29894, 1982, 13, 13, 29937, 17806, 13, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 29937, 1273, 2922, 17357, 10583, 13, 29937, 1273, 1359, 29918, 1062, 8478, 7078, 328, 13, 29937, 1273, 8309, 7078, 328, 29871, 29906, 13, 5215, 18696, 747, 13, 13, 29937, 17806, 518, 3502, 3204, 29962, 13, 29937, 444, 29871, 29896, 29889, 3439, 5987, 349, 29963, 411, 10014, 29979, 848, 13, 13, 29937, 17806, 13, 2202, 29918, 1272, 29892, 1180, 353, 18696, 747, 29889, 949, 5659, 29979, 29898, 29945, 29897, 13, 13, 29937, 17806, 13, 29873, 1357, 29918, 1272, 353, 18696, 747, 29889, 5659, 29979, 29906, 29911, 17870, 29898, 2202, 29918, 1272, 29897, 13, 13, 29937, 17806, 13, 29886, 29894, 29918, 2202, 29892, 2913, 29918, 24542, 353, 18696, 747, 29889, 3601, 4819, 327, 586, 26481, 293, 29898, 29873, 1357, 29918, 1272, 29892, 26271, 353, 1180, 1839, 5066, 4279, 7464, 28745, 353, 1180, 1839, 5426, 4279, 7464, 13, 462, 462, 1678, 28495, 353, 29871, 29900, 29889, 29896, 29892, 14146, 403, 797, 13549, 353, 5852, 29897, 13, 13, 29937, 17806, 13, 29886, 29894, 29918, 2202, 29889, 2083, 580, 13, 13, 29937, 17806, 13, 29886, 29894, 29918, 2202, 29889, 5317, 580, 13, 13, 29937, 17806, 518, 3502, 3204, 29962, 13, 29937, 444, 29871, 29906, 29889, 3439, 5987, 411, 315, 3267, 6720, 29953, 848, 13, 13, 29937, 17806, 13, 2202, 29918, 1272, 29892, 15882, 353, 18696, 747, 29889, 949, 29907, 359, 4346, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 21813, 1839, 14573, 29918, 23498, 1525, 7464, 13, 462, 462, 795, 525, 705, 1624, 3788, 3944, 4346, 3788, 5638, 29953, 3788, 5014, 287, 5477, 13, 462, 18884, 1180, 1839, 5426, 4279, 7464, 1180, 1839, 5066, 4279, 7464, 29871, 29906, 29900, 29896, 29900, 1723, 13, 13, 29937, 17806, 13, 29873, 1357, 29918, 1272, 353, 18696, 747, 29889, 5659, 29979, 29906, 29911, 17870, 29898, 2202, 29918, 1272, 29897, 13, 13, 29937, 17806, 13, 29886, 29894, 29918, 2202, 29892, 2913, 29918, 24542, 353, 18696, 747, 29889, 3601, 4819, 327, 586, 26481, 293, 29898, 29873, 1357, 29918, 1272, 29892, 26271, 353, 1180, 1839, 5066, 4279, 7464, 28745, 353, 1180, 1839, 5426, 4279, 7464, 13, 462, 462, 1678, 28495, 353, 29871, 29900, 29889, 29896, 29897, 13, 13, 29937, 17806, 13, 29886, 29894, 29918, 2202, 29889, 2083, 580, 13, 13, 29937, 17806, 13, 2 ]
Utils.py
MartinEngen/NaiveBayesianClassifier
0
5131
<filename>Utils.py import os import re def get_subfolder_paths(folder_relative_path: str) -> list: """ Gets all subfolders of a given path :param folder_relative_path: Relative path of folder to find subfolders of :return: list of relative paths to any subfolders """ return [f.path for f in os.scandir(folder_relative_path) if f.is_dir()] def get_group_name(group_path: str) -> str: return group_path.split("\\")[-1] def replace_unwanted_characters(line: str) -> str: return re.sub( r'([^\s\w]|_)+', u' ', line.replace('\n', ' ').replace('\t', ' '), flags=re.UNICODE ) def clean_document(document_file) -> list: document = document_file.read().lower().split("\n\n") cleaned_lines = list(map(replace_unwanted_characters, document[1:])) # lambda x, y: x + y, a, b list_of_lines = map(lambda x: x.split(" "), cleaned_lines) flattened_list_of_lines = [val for sublist in list_of_lines for val in sublist] return filter(lambda x: x != '', flattened_list_of_lines)
[ 1, 529, 9507, 29958, 12177, 29889, 2272, 13, 5215, 2897, 13, 5215, 337, 13, 13, 13, 1753, 679, 29918, 1491, 12083, 29918, 24772, 29898, 12083, 29918, 22925, 29918, 2084, 29901, 851, 29897, 1599, 1051, 29901, 13, 1678, 9995, 13, 1678, 402, 1691, 599, 1014, 8771, 414, 310, 263, 2183, 2224, 13, 1678, 584, 3207, 4138, 29918, 22925, 29918, 2084, 29901, 6376, 1230, 2224, 310, 4138, 304, 1284, 1014, 8771, 414, 310, 13, 1678, 584, 2457, 29901, 1051, 310, 6198, 10898, 304, 738, 1014, 8771, 414, 13, 1678, 9995, 13, 1678, 736, 518, 29888, 29889, 2084, 363, 285, 297, 2897, 29889, 1557, 392, 381, 29898, 12083, 29918, 22925, 29918, 2084, 29897, 565, 285, 29889, 275, 29918, 3972, 580, 29962, 13, 13, 13, 1753, 679, 29918, 2972, 29918, 978, 29898, 2972, 29918, 2084, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 736, 2318, 29918, 2084, 29889, 5451, 703, 1966, 1159, 14352, 29896, 29962, 13, 13, 13, 1753, 5191, 29918, 348, 29893, 9714, 29918, 3090, 21706, 29898, 1220, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 736, 337, 29889, 1491, 29898, 13, 4706, 364, 29915, 4197, 3823, 29879, 29905, 29893, 29962, 29989, 29918, 7240, 742, 13, 4706, 318, 29915, 13420, 13, 4706, 1196, 29889, 6506, 28909, 29876, 742, 525, 525, 467, 6506, 28909, 29873, 742, 525, 525, 511, 13, 4706, 13449, 29922, 276, 29889, 3904, 2965, 29949, 2287, 13, 1678, 1723, 13, 13, 1753, 5941, 29918, 3225, 29898, 3225, 29918, 1445, 29897, 1599, 1051, 29901, 13, 1678, 1842, 353, 1842, 29918, 1445, 29889, 949, 2141, 13609, 2141, 5451, 14182, 29876, 29905, 29876, 1159, 13, 1678, 5941, 287, 29918, 9012, 353, 1051, 29898, 1958, 29898, 6506, 29918, 348, 29893, 9714, 29918, 3090, 21706, 29892, 1842, 29961, 29896, 29901, 12622, 13, 1678, 396, 14013, 921, 29892, 343, 29901, 921, 718, 343, 29892, 263, 29892, 289, 13, 1678, 1051, 29918, 974, 29918, 9012, 353, 2910, 29898, 2892, 921, 29901, 921, 29889, 5451, 703, 376, 511, 5941, 287, 29918, 9012, 29897, 13, 1678, 1652, 8606, 287, 29918, 1761, 29918, 974, 29918, 9012, 353, 518, 791, 363, 1014, 1761, 297, 1051, 29918, 974, 29918, 9012, 363, 659, 297, 1014, 1761, 29962, 13, 13, 1678, 736, 4175, 29898, 2892, 921, 29901, 921, 2804, 15516, 1652, 8606, 287, 29918, 1761, 29918, 974, 29918, 9012, 29897, 13, 2 ]
app/migrations/0002_participant.py
mma22-git/woc3.0-eventmanager-Meet_Mungra
0
166715
<gh_stars>0 # Generated by Django 3.1.5 on 2021-01-19 09:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0001_initial'), ] operations = [ migrations.CreateModel( name='Participant', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Name', models.CharField(max_length=30)), ('Contact', models.IntegerField(max_length=10)), ('Email', models.EmailField(max_length=100)), ('Checked', models.CharField(default='Some', max_length=1000)), ('Reg_type', models.CharField(choices=[('I', 'Individual'), ('G', 'Group')], max_length=30)), ('No_of', models.CharField(default='0', max_length=10)), ], ), ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 3251, 630, 491, 15337, 29871, 29941, 29889, 29896, 29889, 29945, 373, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29896, 29929, 29871, 29900, 29929, 29901, 29946, 29946, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 932, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 7439, 12654, 424, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 12300, 3073, 29898, 6921, 29918, 11600, 29922, 5574, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 29892, 26952, 29918, 978, 2433, 1367, 1495, 511, 13, 18884, 6702, 1170, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29941, 29900, 8243, 13, 18884, 6702, 13443, 742, 4733, 29889, 7798, 3073, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 8243, 13, 18884, 6702, 9823, 742, 4733, 29889, 9823, 3073, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29900, 8243, 13, 18884, 6702, 17817, 742, 4733, 29889, 27890, 29898, 4381, 2433, 9526, 742, 4236, 29918, 2848, 29922, 29896, 29900, 29900, 29900, 8243, 13, 18884, 6702, 4597, 29918, 1853, 742, 4733, 29889, 27890, 29898, 1859, 1575, 11759, 877, 29902, 742, 525, 2568, 23352, 5477, 6702, 29954, 742, 525, 4782, 1495, 1402, 4236, 29918, 2848, 29922, 29941, 29900, 8243, 13, 18884, 6702, 3782, 29918, 974, 742, 4733, 29889, 27890, 29898, 4381, 2433, 29900, 742, 4236, 29918, 2848, 29922, 29896, 29900, 8243, 13, 9651, 21251, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
zfused_maya/zfused_maya/tool/animation/studiolibrary/packages/mutils/gui/__init__.py
zhoulh0322/zfused_outsource_old
1
190273
<reponame>zhoulh0322/zfused_outsource_old<gh_stars>1-10 # Copyright 2016 by <NAME>. All Rights Reserved. # # Permission to use, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permission notice appear in # supporting documentation, and that the name of <NAME> # not be used in advertising or publicity pertaining to distribution # of the software without specific, written prior permission. # KURT RATHJEN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING # ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL # KURT RATHJEN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR # ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. try: import maya.OpenMayaUI as omui except ImportError, e: print e from studioqt import QtCore from studioqt import QtWidgets try: from shiboken2 import wrapInstance except ImportError: try: from shiboken import wrapInstance except ImportError, e: print e from .framerangemenu import FrameRangeMenu from .framerangemenu import showFrameRangeMenu from .modelpanelwidget import ModelPanelWidget from .thumbnailcapturedialog import * def mayaWindow(): """ Return the Maya main window as a QMainWindow object. :rtype: QMainWindow """ mainWindowPtr = omui.MQtUtil.mainWindow() return wrapInstance(long(mainWindowPtr), QtWidgets.QMainWindow) def makeMayaStandaloneWindow(w): """ Make a standalone window, though parented under Maya's mainWindow. The parenting under Maya's mainWindow is done so that the QWidget will not auto-destroy itself when the instance variable goes out of scope. """ # Parent under the main Maya window w.setParent(mayaWindow()) # Make this widget appear as a standalone window w.setWindowFlags(QtCore.Qt.Window) w.raise_() w.show()
[ 1, 529, 276, 1112, 420, 29958, 17599, 5059, 29882, 29900, 29941, 29906, 29906, 29914, 29920, 29888, 3880, 29918, 449, 4993, 29918, 1025, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29953, 491, 529, 5813, 15513, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 20894, 2333, 304, 671, 29892, 6623, 29892, 322, 1320, 2666, 445, 7047, 322, 967, 13, 29937, 5106, 363, 738, 6437, 322, 1728, 27684, 338, 1244, 1609, 16896, 29892, 13, 29937, 4944, 393, 278, 2038, 3509, 1266, 8369, 2615, 297, 599, 14591, 322, 393, 13, 29937, 1716, 393, 3509, 1266, 8369, 322, 445, 10751, 8369, 2615, 297, 13, 29937, 20382, 5106, 29892, 322, 393, 278, 1024, 310, 529, 5813, 29958, 13, 29937, 451, 367, 1304, 297, 18811, 5921, 470, 970, 537, 639, 2408, 292, 304, 4978, 13, 29937, 310, 278, 7047, 1728, 2702, 29892, 3971, 7536, 10751, 29889, 13, 29937, 476, 4574, 29911, 390, 7534, 29967, 1430, 28657, 13875, 29902, 4345, 15149, 399, 1718, 29934, 13566, 29059, 22659, 5195, 29954, 17011, 7495, 3446, 3235, 7791, 7818, 12982, 1525, 29892, 2672, 6154, 15789, 4214, 13, 29937, 15149, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 5300, 383, 1806, 8186, 1799, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 13, 29937, 476, 4574, 29911, 390, 7534, 29967, 1430, 20700, 17705, 6181, 15842, 13764, 29979, 317, 4162, 8426, 1964, 29892, 2672, 4571, 26282, 6323, 8707, 1660, 13356, 3919, 25758, 21330, 1529, 1692, 29903, 6323, 13, 29937, 13764, 29979, 21330, 1529, 1692, 29903, 12317, 1299, 6156, 29923, 5348, 390, 2890, 8647, 4214, 3895, 11247, 1799, 8079, 501, 1660, 29892, 360, 8254, 6323, 13756, 29943, 1806, 29903, 29892, 12317, 2544, 4448, 13, 29937, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 405, 11787, 5265, 24647, 4741, 6323, 438, 29911, 4448, 323, 8476, 5971, 3308, 319, 9838, 29892, 9033, 3235, 4214, 19474, 13, 29937, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 501, 1660, 6323, 349, 1001, 22051, 27616, 4741, 8079, 3446, 3235, 7791, 7818, 12982, 1525, 29889, 13, 13, 2202, 29901, 13, 1678, 1053, 1122, 29874, 29889, 6585, 29924, 9010, 3120, 408, 2703, 1481, 13, 19499, 16032, 2392, 29892, 321, 29901, 13, 1678, 1596, 321, 13, 13, 3166, 8693, 17915, 1053, 14705, 9203, 13, 3166, 8693, 17915, 1053, 14705, 8801, 29879, 13, 13, 13, 2202, 29901, 13, 1678, 515, 528, 747, 4476, 29906, 1053, 12244, 4998, 13, 19499, 16032, 2392, 29901, 13, 1678, 1018, 29901, 13, 4706, 515, 528, 747, 4476, 1053, 12244, 4998, 13, 1678, 5174, 16032, 2392, 29892, 321, 29901, 13, 4706, 1596, 321, 13, 13, 13, 3166, 869, 1341, 4183, 574, 331, 4814, 1053, 12218, 6069, 6823, 13, 3166, 869, 1341, 4183, 574, 331, 4814, 1053, 1510, 4308, 6069, 6823, 13, 3166, 869, 4299, 15119, 8030, 1053, 8125, 7490, 8801, 13, 3166, 869, 386, 21145, 17885, 2955, 3658, 1053, 334, 13, 13, 13, 1753, 1122, 29874, 5907, 7295, 13, 1678, 9995, 13, 1678, 7106, 278, 2610, 29874, 1667, 3474, 408, 263, 660, 6330, 5907, 1203, 29889, 13, 268, 13, 1678, 584, 29878, 1853, 29901, 660, 6330, 5907, 13, 1678, 9995, 13, 1678, 1667, 5907, 12058, 353, 2703, 1481, 29889, 29924, 17303, 7270, 29889, 3396, 5907, 580, 13, 1678, 736, 12244, 4998, 29898, 5426, 29898, 3396, 5907, 12058, 511, 14705, 8801, 29879, 29889, 29984, 6330, 5907, 29897, 13, 13, 13, 1753, 1207, 29924, 9010, 11042, 18785, 5907, 29898, 29893, 1125, 13, 1678, 9995, 13, 1678, 8561, 263, 2317, 18785, 3474, 29892, 2466, 3847, 287, 1090, 2610, 29874, 29915, 29879, 1667, 5907, 29889, 13, 13, 1678, 450, 3847, 292, 1090, 2610, 29874, 29915, 29879, 1667, 5907, 338, 2309, 577, 393, 278, 660, 8801, 674, 29871, 13, 1678, 451, 4469, 29899, 20524, 3528, 746, 278, 2777, 2286, 5771, 714, 310, 6874, 29889, 13, 1678, 9995, 13, 1678, 396, 22280, 1090, 278, 1667, 2610, 29874, 3474, 13, 1678, 281, 29889, 842, 9780, 29898, 29885, 9010, 5907, 3101, 13, 13, 1678, 396, 8561, 445, 11109, 2615, 408, 263, 2317, 18785, 3474, 13, 1678, 281, 29889, 842, 5907, 15675, 29898, 17303, 9203, 29889, 17303, 29889, 5907, 29897, 13, 1678, 281, 29889, 22692, 29918, 580, 13, 1678, 281, 29889, 4294, 580, 13, 2 ]
controller/school.py
YunYinORG/social
4
96473
<gh_stars>1-10 #!/usr/bin/env python # coding=utf-8 import web import lib.user as user class nku(object): """南开""" def GET(self): userinfo=user.getUser() render = web.template.render ('templates/school/',base="layout") if userinfo: return render.nku(userinfo) else: return render.nku_unlogin()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 5215, 1856, 13, 5215, 4303, 29889, 1792, 408, 1404, 13, 13, 1990, 302, 2120, 29898, 3318, 1125, 13, 1678, 9995, 30601, 31026, 15945, 29908, 13, 1678, 822, 12354, 29898, 1311, 1125, 13, 268, 12, 1792, 3888, 29922, 1792, 29889, 657, 2659, 580, 13, 268, 12, 9482, 29871, 353, 1856, 29889, 6886, 29889, 9482, 6702, 20943, 29914, 27041, 29914, 742, 3188, 543, 2680, 1159, 13, 268, 12, 361, 1404, 3888, 29901, 13, 268, 12, 12, 2457, 4050, 29889, 29876, 2120, 29898, 1792, 3888, 29897, 13, 268, 12, 2870, 29901, 13, 268, 12, 12, 2457, 4050, 29889, 29876, 2120, 29918, 348, 7507, 580, 2 ]
EXC/CW2/task1/reducer.py
easyCZ/UoE-Projects
0
125450
#!/usr/bin/python # reducer.py import sys word_counter = 0 last_word = None word_documents = [] def write(keyword, total, documents): docs = ", ".join(["(%s, %d)" % (doc, count) for doc, count in documents]) docs = "{%s}" % docs print("{0} : {1} : {2}".format(keyword, total, docs)) # Input is sorted primarily by word, secondarily by # document name. Single pass is required without doing any # sorting. # # Expected input: # also d1.txt 13 # also d3.txt 8 # also d4.txt 3 # altered d5.txt 1 # althorp d5.txt 2 for line in sys.stdin: word, doc, count = line.split(' ', 2) if last_word is not None and last_word != word: # Cleanup after last block write(last_word, word_counter, word_documents) # Start new block word_documents = [] word_counter = 0 count = int(count) last_word = word word_counter += count word_documents.append((doc, count)) if last_word is not None: write(last_word, word_counter, word_documents)
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 29937, 3724, 2265, 29889, 2272, 13, 5215, 10876, 13, 13, 1742, 29918, 11808, 353, 29871, 29900, 13, 4230, 29918, 1742, 353, 6213, 13, 1742, 29918, 3225, 29879, 353, 5159, 13, 13, 13, 1753, 2436, 29898, 26766, 29892, 3001, 29892, 10701, 1125, 13, 1678, 10561, 353, 9162, 11393, 7122, 29898, 3366, 29414, 29879, 29892, 1273, 29881, 5513, 1273, 313, 1514, 29892, 2302, 29897, 363, 1574, 29892, 2302, 297, 10701, 2314, 13, 1678, 10561, 353, 376, 18255, 29879, 5038, 1273, 10561, 13, 1678, 1596, 703, 29912, 29900, 29913, 584, 426, 29896, 29913, 584, 426, 29906, 29913, 1642, 4830, 29898, 26766, 29892, 3001, 29892, 10561, 876, 13, 13, 29937, 10567, 338, 12705, 19434, 491, 1734, 29892, 1473, 6275, 491, 13, 29937, 1842, 1024, 29889, 16740, 1209, 338, 3734, 1728, 2599, 738, 13, 29937, 16548, 29889, 13, 29937, 13, 29937, 1222, 6021, 1881, 29901, 13, 29937, 259, 884, 4706, 270, 29896, 29889, 3945, 259, 29896, 29941, 13, 29937, 259, 884, 4706, 270, 29941, 29889, 3945, 259, 29947, 13, 29937, 259, 884, 4706, 270, 29946, 29889, 3945, 259, 29941, 13, 29937, 259, 10551, 287, 268, 270, 29945, 29889, 3945, 259, 29896, 13, 29937, 259, 394, 386, 26423, 268, 270, 29945, 29889, 3945, 259, 29906, 13, 1454, 1196, 297, 10876, 29889, 4172, 262, 29901, 13, 1678, 1734, 29892, 1574, 29892, 2302, 353, 1196, 29889, 5451, 877, 13420, 29871, 29906, 29897, 13, 13, 1678, 565, 1833, 29918, 1742, 338, 451, 6213, 322, 1833, 29918, 1742, 2804, 1734, 29901, 13, 4706, 396, 315, 14044, 786, 1156, 1833, 2908, 13, 4706, 2436, 29898, 4230, 29918, 1742, 29892, 1734, 29918, 11808, 29892, 1734, 29918, 3225, 29879, 29897, 13, 4706, 396, 7370, 716, 2908, 13, 4706, 1734, 29918, 3225, 29879, 353, 5159, 13, 4706, 1734, 29918, 11808, 353, 29871, 29900, 13, 13, 1678, 2302, 353, 938, 29898, 2798, 29897, 13, 13, 1678, 1833, 29918, 1742, 353, 1734, 13, 1678, 1734, 29918, 11808, 4619, 2302, 13, 1678, 1734, 29918, 3225, 29879, 29889, 4397, 3552, 1514, 29892, 2302, 876, 13, 13, 361, 1833, 29918, 1742, 338, 451, 6213, 29901, 13, 1678, 2436, 29898, 4230, 29918, 1742, 29892, 1734, 29918, 11808, 29892, 1734, 29918, 3225, 29879, 29897, 13, 2 ]
metadyn.py
schneiderfelipe/scripts
0
77802
#!/usr/bin/python3 """Analyse metadynamics trajectories from xtb.""" import argparse import numpy as np import matplotlib.pyplot as plt import MDAnalysis as mda import MDAnalysis.analysis.pca as pca from MDAnalysis.lib import distances from scipy.constants import calorie from scipy.constants import kilo from scipy.constants import N_A from scipy.constants import physical_constants from scipy import stats from rmsd import element from rmsd import read_xyz hartree, _, _ = physical_constants["Hartree energy"] commands = { "q": "exit", "h": "help", "e": "energies", "s": "current selection", "p": "graph", "*anything else*": "any MDAnalysis selection, see <https://userguide.mdanalysis.org/selections.html>.", } def main(): """Run main procedure.""" # TODO(schneiderfelipe): accept multiple files parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("traj_files", nargs="+") args = parser.parse_args() gnorms = [] energies = [] all_atomnos = [] all_atomcoords = [] for traj_file in args.traj_files: atomnos, comments, atomcoords = read_xyz(traj_file) all_atomnos.extend(atomnos) all_atomcoords.extend(atomcoords) for comment in comments: fields = comment.split() gnorms.append(float(fields[3])) energies.append(float(fields[1])) energies = np.array(energies) energies -= energies.min() energies *= hartree * N_A / (kilo * calorie) u = mda.Universe.empty(n_atoms=len(all_atomnos[0]), trajectory=True) u.add_TopologyAttr("type", [element[i] for i in all_atomnos[0]]) u.load_new(all_atomcoords, order="fac") print(u) selection = None print("(enter 'q' for exit, 'h' for help)") while True: code = input("select> ").strip().split() if code[0] == "q": break elif code[0] == "h": for key in commands: print(f"{key:15s}: {commands[key]}") elif code[0] == "e": fig, ax = plt.subplots(2) ax[0].plot(energies) ax[0].set_xlabel("frame") ax[0].set_ylabel("energy (kcal/mol)") ax[1].plot(gnorms) ax[1].set_xlabel("frame") ax[1].set_ylabel("grad. norm (Eh/a0)") plt.show() elif code[0] == "s": print(selection) if selection is not None: print(selection_text) elif code[0] == "pca": if selection is None: print("empty selection, doing nothing") continue p = pca.PCA(u, select=selection_text) p.run() n_pcs = np.where(p.cumulated_variance > 0.95)[0][0] print(n_pcs) print(p.cumulated_variance[0:n_pcs]) pca_space = p.transform(selection, n_components=n_pcs) print(pca_space) print(pca.cosine_content(pca_space, 0)) elif code[0] == "p": if selection is None: print("empty selection, doing nothing") continue n = len(selection) if n == 2: data_label = "bond length (Å)" elif n == 3: data_label = "bond angle (°)" elif n == 4: data_label = "dihedral angle (°)" else: print("too few or too many indices") continue data = [] for i, (e, ts) in enumerate(zip(energies, u.trajectory)): if n == 2: d = distances.calc_bonds( selection[0].position, selection[1].position ) elif n == 3: d = np.degrees( distances.calc_angles( selection[0].position, selection[1].position, selection[2].position, ) ) elif n == 4: d = np.degrees( distances.calc_dihedrals( selection[0].position, selection[1].position, selection[2].position, selection[3].position, ) ) data.append(d) if i % 100 == 0 or i == len(u.trajectory) - 1: print( f"frame = {ts.frame:4d}: e = {e:5.1f} kcal/mol, {data_label.split('(')[0][:-1]} = {d:7.3f} {data_label[-2]}" ) data = np.array(data) fig, ax = plt.subplots(1, 2) ax[0].plot(data) ax[0].set_xlabel("frame") ax[0].set_ylabel(data_label) ax[1].plot(energies, data, "o", label="data points") ax[1].set_xlabel("energy (kcal/mol)") ax[1].set_ylabel(data_label) if n == 2: dx = 0.1 elif n == 3: dx = 10.0 elif n == 4: dx = 10.0 res = stats.binned_statistic( data, energies, "min", min(25, (data.max() - data.min()) / dx) ) # print(res.statistic) mask = np.isnan(res.statistic) res.statistic[mask] = np.interp( np.flatnonzero(mask), np.flatnonzero(~mask), res.statistic[~mask] ) # print(res.statistic) # ax[1].hlines(res.statistic, res.bin_edges[:-1], res.bin_edges[1:], colors='g', lw=2, label='binned min. energies') ax[1].barh( (res.bin_edges[:-1] + res.bin_edges[1:]) / 2, res.statistic, align="center", height=res.bin_edges[1:] - res.bin_edges[:-1], alpha=0.25, label="binned min. energies", ) ax[1].legend() plt.show() else: try: selection_text = " ".join(code) selection = u.select_atoms(selection_text) except mda.exceptions.SelectionError as e: print(e) print("bye") if __name__ == "__main__": main()
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 29941, 13, 13, 15945, 29908, 2744, 14997, 344, 1539, 328, 2926, 1199, 23324, 3842, 515, 29871, 486, 29890, 1213, 15945, 13, 13, 5215, 1852, 5510, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 20672, 21067, 4848, 408, 286, 1388, 13, 5215, 20672, 21067, 4848, 29889, 15916, 29889, 29886, 1113, 408, 282, 1113, 13, 3166, 20672, 21067, 4848, 29889, 1982, 1053, 24610, 13, 3166, 4560, 2272, 29889, 3075, 1934, 1053, 1208, 7661, 13, 3166, 4560, 2272, 29889, 3075, 1934, 1053, 4679, 29877, 13, 3166, 4560, 2272, 29889, 3075, 1934, 1053, 405, 29918, 29909, 13, 3166, 4560, 2272, 29889, 3075, 1934, 1053, 9128, 29918, 3075, 1934, 13, 3166, 4560, 2272, 1053, 22663, 13, 13, 3166, 364, 1516, 29881, 1053, 1543, 13, 3166, 364, 1516, 29881, 1053, 1303, 29918, 20230, 13, 13, 26243, 929, 29892, 17117, 903, 353, 9128, 29918, 3075, 1934, 3366, 29950, 442, 929, 5864, 3108, 13, 13, 13, 26381, 353, 426, 13, 1678, 376, 29939, 1115, 376, 13322, 613, 13, 1678, 376, 29882, 1115, 376, 8477, 613, 13, 1678, 376, 29872, 1115, 376, 759, 29887, 583, 613, 13, 1678, 376, 29879, 1115, 376, 3784, 9262, 613, 13, 1678, 376, 29886, 1115, 376, 4262, 613, 13, 1678, 26345, 1384, 1918, 1683, 29930, 1115, 376, 1384, 20672, 21067, 4848, 9262, 29892, 1074, 529, 991, 597, 1792, 13075, 29889, 3487, 15916, 29889, 990, 29914, 344, 5942, 29889, 1420, 15513, 613, 13, 29913, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 9995, 6558, 1667, 8792, 1213, 15945, 13, 1678, 396, 14402, 29898, 816, 484, 1241, 29888, 5037, 412, 1125, 3544, 2999, 2066, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 29922, 1649, 1514, 1649, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 3018, 29926, 29918, 5325, 613, 302, 5085, 543, 29974, 1159, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 330, 12324, 29879, 353, 5159, 13, 1678, 18190, 583, 353, 5159, 13, 1678, 599, 29918, 8678, 17639, 353, 5159, 13, 1678, 599, 29918, 8678, 1111, 4339, 353, 5159, 13, 1678, 363, 1020, 29926, 29918, 1445, 297, 6389, 29889, 3018, 29926, 29918, 5325, 29901, 13, 4706, 12301, 17639, 29892, 6589, 29892, 12301, 1111, 4339, 353, 1303, 29918, 20230, 29898, 3018, 29926, 29918, 1445, 29897, 13, 4706, 599, 29918, 8678, 17639, 29889, 21843, 29898, 8678, 17639, 29897, 13, 4706, 599, 29918, 8678, 1111, 4339, 29889, 21843, 29898, 8678, 1111, 4339, 29897, 13, 4706, 363, 3440, 297, 6589, 29901, 13, 9651, 4235, 353, 3440, 29889, 5451, 580, 13, 9651, 330, 12324, 29879, 29889, 4397, 29898, 7411, 29898, 9621, 29961, 29941, 12622, 13, 9651, 18190, 583, 29889, 4397, 29898, 7411, 29898, 9621, 29961, 29896, 12622, 13, 1678, 18190, 583, 353, 7442, 29889, 2378, 29898, 759, 29887, 583, 29897, 13, 1678, 18190, 583, 22361, 18190, 583, 29889, 1195, 580, 13, 1678, 18190, 583, 334, 29922, 298, 442, 929, 334, 405, 29918, 29909, 847, 313, 29895, 7820, 334, 1208, 7661, 29897, 13, 13, 1678, 318, 353, 286, 1388, 29889, 8110, 3901, 29889, 6310, 29898, 29876, 29918, 271, 4835, 29922, 2435, 29898, 497, 29918, 8678, 17639, 29961, 29900, 11724, 23324, 706, 29922, 5574, 29897, 13, 1678, 318, 29889, 1202, 29918, 7031, 3002, 25098, 703, 1853, 613, 518, 5029, 29961, 29875, 29962, 363, 474, 297, 599, 29918, 8678, 17639, 29961, 29900, 24960, 13, 1678, 318, 29889, 1359, 29918, 1482, 29898, 497, 29918, 8678, 1111, 4339, 29892, 1797, 543, 17470, 1159, 13, 1678, 1596, 29898, 29884, 29897, 13, 13, 1678, 9262, 353, 6213, 13, 1678, 1596, 703, 29898, 5893, 525, 29939, 29915, 363, 6876, 29892, 525, 29882, 29915, 363, 1371, 25760, 13, 1678, 1550, 5852, 29901, 13, 4706, 775, 353, 1881, 703, 2622, 29958, 376, 467, 17010, 2141, 5451, 580, 13, 4706, 565, 775, 29961, 29900, 29962, 1275, 376, 29939, 1115, 13, 9651, 2867, 13, 4706, 25342, 775, 29961, 29900, 29962, 1275, 376, 29882, 1115, 13, 9651, 363, 1820, 297, 8260, 29901, 13, 18884, 1596, 29898, 29888, 29908, 29912, 1989, 29901, 29896, 29945, 29879, 6177, 426, 26381, 29961, 1989, 12258, 1159, 13, 4706, 25342, 775, 29961, 29900, 29962, 1275, 376, 29872, 1115, 13, 9651, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 29906, 29897, 13, 9651, 4853, 29961, 29900, 1822, 5317, 29898, 759, 29887, 583, 29897, 13, 9651, 4853, 29961, 29900, 1822, 842, 29918, 29916, 1643, 703, 2557, 1159, 13, 9651, 4853, 29961, 29900, 1822, 842, 29918, 29891, 1643, 703, 27548, 313, 29895, 1052, 29914, 29885, 324, 25760, 13, 13, 9651, 4853, 29961, 29896, 1822, 5317, 29898, 5138, 555, 29879, 29897, 13, 9651, 4853, 29961, 29896, 1822, 842, 29918, 29916, 1643, 703, 2557, 1159, 13, 9651, 4853, 29961, 29896, 1822, 842, 29918, 29891, 1643, 703, 5105, 29889, 6056, 313, 29923, 29882, 29914, 29874, 29900, 25760, 13, 9651, 14770, 29889, 4294, 580, 13, 4706, 25342, 775, 29961, 29900, 29962, 1275, 376, 29879, 1115, 13, 9651, 1596, 29898, 21731, 29897, 13, 9651, 565, 9262, 338, 451, 6213, 29901, 13, 18884, 1596, 29898, 21731, 29918, 726, 29897, 13, 4706, 25342, 775, 29961, 29900, 29962, 1275, 376, 29886, 1113, 1115, 13, 9651, 565, 9262, 338, 6213, 29901, 13, 18884, 1596, 703, 6310, 9262, 29892, 2599, 3078, 1159, 13, 18884, 6773, 13, 13, 9651, 282, 353, 282, 1113, 29889, 29925, 5454, 29898, 29884, 29892, 1831, 29922, 21731, 29918, 726, 29897, 13, 9651, 282, 29889, 3389, 580, 13, 13, 9651, 302, 29918, 29886, 2395, 353, 7442, 29889, 3062, 29898, 29886, 29889, 29883, 398, 7964, 29918, 1707, 8837, 1405, 29871, 29900, 29889, 29929, 29945, 9601, 29900, 3816, 29900, 29962, 13, 9651, 1596, 29898, 29876, 29918, 29886, 2395, 29897, 13, 9651, 1596, 29898, 29886, 29889, 29883, 398, 7964, 29918, 1707, 8837, 29961, 29900, 29901, 29876, 29918, 29886, 2395, 2314, 13, 9651, 282, 1113, 29918, 3493, 353, 282, 29889, 9067, 29898, 21731, 29892, 302, 29918, 14036, 29922, 29876, 29918, 29886, 2395, 29897, 13, 9651, 1596, 29898, 29886, 1113, 29918, 3493, 29897, 13, 9651, 1596, 29898, 29886, 1113, 29889, 3944, 457, 29918, 3051, 29898, 29886, 1113, 29918, 3493, 29892, 29871, 29900, 876, 13, 4706, 25342, 775, 29961, 29900, 29962, 1275, 376, 29886, 1115, 13, 9651, 565, 9262, 338, 6213, 29901, 13, 18884, 1596, 703, 6310, 9262, 29892, 2599, 3078, 1159, 13, 18884, 6773, 13, 13, 9651, 302, 353, 7431, 29898, 21731, 29897, 13, 9651, 565, 302, 1275, 29871, 29906, 29901, 13, 18884, 848, 29918, 1643, 353, 376, 29890, 898, 3309, 313, 30129, 5513, 13, 9651, 25342, 302, 1275, 29871, 29941, 29901, 13, 18884, 848, 29918, 1643, 353, 376, 29890, 898, 10696, 313, 30073, 5513, 13, 9651, 25342, 302, 1275, 29871, 29946, 29901, 13, 18884, 848, 29918, 1643, 353, 376, 29881, 4861, 287, 1705, 10696, 313, 30073, 5513, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 517, 29877, 2846, 470, 2086, 1784, 16285, 1159, 13, 18884, 6773, 13, 13, 9651, 848, 353, 5159, 13, 9651, 363, 474, 29892, 313, 29872, 29892, 18696, 29897, 297, 26985, 29898, 7554, 29898, 759, 29887, 583, 29892, 318, 29889, 3018, 622, 706, 22164, 13, 18884, 565, 302, 1275, 29871, 29906, 29901, 13, 462, 1678, 270, 353, 24610, 29889, 28667, 29918, 29890, 13788, 29898, 13, 462, 4706, 9262, 29961, 29900, 1822, 3283, 29892, 9262, 29961, 29896, 1822, 3283, 13, 462, 1678, 1723, 13, 18884, 25342, 302, 1275, 29871, 29941, 29901, 13, 462, 1678, 270, 353, 7442, 29889, 311, 7979, 267, 29898, 13, 462, 4706, 24610, 29889, 28667, 29918, 19536, 29898, 13, 462, 9651, 9262, 29961, 29900, 1822, 3283, 29892, 13, 462, 9651, 9262, 29961, 29896, 1822, 3283, 29892, 13, 462, 9651, 9262, 29961, 29906, 1822, 3283, 29892, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 25342, 302, 1275, 29871, 29946, 29901, 13, 462, 1678, 270, 353, 7442, 29889, 311, 7979, 267, 29898, 13, 462, 4706, 24610, 29889, 28667, 29918, 29881, 4861, 287, 29878, 1338, 29898, 13, 462, 9651, 9262, 29961, 29900, 1822, 3283, 29892, 13, 462, 9651, 9262, 29961, 29896, 1822, 3283, 29892, 13, 462, 9651, 9262, 29961, 29906, 1822, 3283, 29892, 13, 462, 9651, 9262, 29961, 29941, 1822, 3283, 29892, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 13, 18884, 848, 29889, 4397, 29898, 29881, 29897, 13, 18884, 565, 474, 1273, 29871, 29896, 29900, 29900, 1275, 29871, 29900, 470, 474, 1275, 7431, 29898, 29884, 29889, 3018, 622, 706, 29897, 448, 29871, 29896, 29901, 13, 462, 1678, 1596, 29898, 13, 462, 4706, 285, 29908, 2557, 353, 426, 1372, 29889, 2557, 29901, 29946, 29881, 6177, 321, 353, 426, 29872, 29901, 29945, 29889, 29896, 29888, 29913, 413, 1052, 29914, 29885, 324, 29892, 426, 1272, 29918, 1643, 29889, 5451, 877, 877, 9601, 29900, 3816, 13018, 29896, 12258, 353, 426, 29881, 29901, 29955, 29889, 29941, 29888, 29913, 426, 1272, 29918, 1643, 14352, 29906, 29962, 5038, 13, 462, 1678, 1723, 13, 9651, 848, 353, 7442, 29889, 2378, 29898, 1272, 29897, 13, 13, 9651, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 29896, 29892, 29871, 29906, 29897, 13, 9651, 4853, 29961, 29900, 1822, 5317, 29898, 1272, 29897, 13, 9651, 4853, 29961, 29900, 1822, 842, 29918, 29916, 1643, 703, 2557, 1159, 13, 9651, 4853, 29961, 29900, 1822, 842, 29918, 29891, 1643, 29898, 1272, 29918, 1643, 29897, 13, 13, 9651, 4853, 29961, 29896, 1822, 5317, 29898, 759, 29887, 583, 29892, 848, 29892, 376, 29877, 613, 3858, 543, 1272, 3291, 1159, 13, 9651, 4853, 29961, 29896, 1822, 842, 29918, 29916, 1643, 703, 27548, 313, 29895, 1052, 29914, 29885, 324, 25760, 13, 9651, 4853, 29961, 29896, 1822, 842, 29918, 29891, 1643, 29898, 1272, 29918, 1643, 29897, 13, 13, 9651, 565, 302, 1275, 29871, 29906, 29901, 13, 18884, 15414, 353, 29871, 29900, 29889, 29896, 13, 9651, 25342, 302, 1275, 29871, 29941, 29901, 13, 18884, 15414, 353, 29871, 29896, 29900, 29889, 29900, 13, 9651, 25342, 302, 1275, 29871, 29946, 29901, 13, 18884, 15414, 353, 29871, 29896, 29900, 29889, 29900, 13, 9651, 620, 353, 22663, 29889, 2109, 9571, 29918, 6112, 4695, 29898, 13, 18884, 848, 29892, 18190, 583, 29892, 376, 1195, 613, 1375, 29898, 29906, 29945, 29892, 313, 1272, 29889, 3317, 580, 448, 848, 29889, 1195, 3101, 847, 15414, 29897, 13, 9651, 1723, 13, 13, 9651, 396, 1596, 29898, 690, 29889, 6112, 4695, 29897, 13, 9651, 11105, 353, 7442, 29889, 275, 13707, 29898, 690, 29889, 6112, 4695, 29897, 13, 9651, 620, 29889, 6112, 4695, 29961, 13168, 29962, 353, 7442, 29889, 1639, 29886, 29898, 13, 18884, 7442, 29889, 20620, 5464, 9171, 29898, 13168, 511, 7442, 29889, 20620, 5464, 9171, 29898, 30022, 13168, 511, 620, 29889, 6112, 4695, 29961, 30022, 13168, 29962, 13, 9651, 1723, 13, 9651, 396, 1596, 29898, 690, 29889, 6112, 4695, 29897, 13, 13, 9651, 396, 4853, 29961, 29896, 1822, 4415, 1475, 29898, 690, 29889, 6112, 4695, 29892, 620, 29889, 2109, 29918, 287, 2710, 7503, 29899, 29896, 1402, 620, 29889, 2109, 29918, 287, 2710, 29961, 29896, 29901, 1402, 11955, 2433, 29887, 742, 301, 29893, 29922, 29906, 29892, 3858, 2433, 2109, 9571, 1375, 29889, 18190, 583, 1495, 13, 9651, 4853, 29961, 29896, 1822, 1646, 29882, 29898, 13, 18884, 313, 690, 29889, 2109, 29918, 287, 2710, 7503, 29899, 29896, 29962, 718, 620, 29889, 2109, 29918, 287, 2710, 29961, 29896, 29901, 2314, 847, 29871, 29906, 29892, 13, 18884, 620, 29889, 6112, 4695, 29892, 13, 18884, 7595, 543, 5064, 613, 13, 18884, 3171, 29922, 690, 29889, 2109, 29918, 287, 2710, 29961, 29896, 17531, 448, 620, 29889, 2109, 29918, 287, 2710, 7503, 29899, 29896, 1402, 13, 18884, 15595, 29922, 29900, 29889, 29906, 29945, 29892, 13, 18884, 3858, 543, 2109, 9571, 1375, 29889, 18190, 583, 613, 13, 9651, 1723, 13, 9651, 4853, 29961, 29896, 1822, 26172, 580, 13, 13, 9651, 14770, 29889, 4294, 580, 13, 13, 4706, 1683, 29901, 13, 9651, 1018, 29901, 13, 18884, 9262, 29918, 726, 353, 376, 11393, 7122, 29898, 401, 29897, 13, 18884, 9262, 353, 318, 29889, 2622, 29918, 271, 4835, 29898, 21731, 29918, 726, 29897, 13, 9651, 5174, 286, 1388, 29889, 11739, 29879, 29889, 15097, 2392, 408, 321, 29901, 13, 18884, 1596, 29898, 29872, 29897, 13, 13, 1678, 1596, 703, 26966, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
django-rest-framework-api/artists/tasks.py
mattd429/django-rest-framework-musicbrainz-api
1
76103
<reponame>mattd429/django-rest-framework-musicbrainz-api # Django from django.utils.text import slugify # Celery from celery import shared_task # Local from artists.models import Artist, Album, Track # Musicbrainz import musicbrainzngs as mb mb.set_useragent('Mbrown - <EMAIL>', version='1.0.1') @shared_task def get_artist_tracks_from_musicbrianz_api(artist): search_results = mb.search_artists(artist) result = search_results['artist-list'][0] genre = Artist.get_genre_from_musicbrainz_tag_list(result['tag-list']) for album_dict in mb.browse_releases(result['id'], includes=['recordings'])['release-list']: album = Album.objects.create(name=album_dict['title'], artist=artist, slug=slugify(album_dict['title'])) for track_dict in album_dict['medium-list'][0]['track-list']: track = Track.objects.create(album=album, name=track_dict['recording']['title'], track_number=track_dict['position'], slug=slugify(track_dict['recording']['title'])) Artist.objects.create(track=track, artist=artist, genre=genre, slug=slugify(artist)) return Artist.objects.filter(artist=artist)
[ 1, 529, 276, 1112, 420, 29958, 29885, 1131, 29881, 29946, 29906, 29929, 29914, 14095, 29899, 5060, 29899, 4468, 29899, 23596, 2634, 262, 29920, 29899, 2754, 13, 29937, 15337, 13, 3166, 9557, 29889, 13239, 29889, 726, 1053, 2243, 688, 1598, 13, 29937, 14227, 708, 13, 3166, 6432, 708, 1053, 7258, 29918, 7662, 13, 29937, 9959, 13, 3166, 17906, 29889, 9794, 1053, 3012, 391, 29892, 10217, 29892, 17026, 13, 29937, 6125, 2634, 262, 29920, 13, 5215, 4696, 2634, 262, 29920, 865, 29879, 408, 286, 29890, 13, 13, 8337, 29889, 842, 29918, 1792, 14748, 877, 29924, 29890, 4708, 448, 529, 26862, 6227, 29958, 742, 1873, 2433, 29896, 29889, 29900, 29889, 29896, 1495, 13, 13, 13, 29992, 12366, 29918, 7662, 13, 1753, 679, 29918, 442, 391, 29918, 3018, 4684, 29918, 3166, 29918, 23596, 29890, 374, 4096, 29918, 2754, 29898, 442, 391, 1125, 13, 1678, 2740, 29918, 9902, 353, 286, 29890, 29889, 4478, 29918, 442, 2879, 29898, 442, 391, 29897, 13, 1678, 1121, 353, 2740, 29918, 9902, 1839, 442, 391, 29899, 1761, 2033, 29961, 29900, 29962, 13, 539, 13, 1678, 16151, 353, 3012, 391, 29889, 657, 29918, 1885, 276, 29918, 3166, 29918, 23596, 2634, 262, 29920, 29918, 4039, 29918, 1761, 29898, 2914, 1839, 4039, 29899, 1761, 11287, 13, 268, 13, 1678, 363, 3769, 29918, 8977, 297, 286, 29890, 29889, 23721, 344, 29918, 276, 17836, 29898, 2914, 1839, 333, 7464, 7805, 29922, 1839, 11651, 886, 11287, 1839, 14096, 29899, 1761, 2033, 29901, 13, 4706, 3769, 353, 10217, 29889, 12650, 29889, 3258, 29898, 978, 29922, 10336, 29918, 8977, 1839, 3257, 7464, 7664, 29922, 442, 391, 29892, 2243, 688, 29922, 29517, 1598, 29898, 10336, 29918, 8977, 1839, 3257, 25901, 13, 308, 13, 4706, 363, 5702, 29918, 8977, 297, 3769, 29918, 8977, 1839, 27891, 29899, 1761, 2033, 29961, 29900, 22322, 11294, 29899, 1761, 2033, 29901, 13, 9651, 5702, 353, 17026, 29889, 12650, 29889, 3258, 29898, 10336, 29922, 10336, 29892, 1024, 29922, 11294, 29918, 8977, 1839, 3757, 3278, 16215, 3257, 7464, 13, 462, 462, 965, 5702, 29918, 4537, 29922, 11294, 29918, 8977, 1839, 3283, 7464, 13, 462, 462, 965, 2243, 688, 29922, 29517, 1598, 29898, 11294, 29918, 8977, 1839, 3757, 3278, 16215, 3257, 25901, 13, 632, 13, 9651, 3012, 391, 29889, 12650, 29889, 3258, 29898, 11294, 29922, 11294, 29892, 7664, 29922, 442, 391, 29892, 16151, 29922, 1885, 276, 29892, 2243, 688, 29922, 29517, 1598, 29898, 442, 391, 876, 13, 632, 13, 1678, 736, 3012, 391, 29889, 12650, 29889, 4572, 29898, 442, 391, 29922, 442, 391, 29897, 13, 2 ]
sdk/boost_1_30_0/libs/python/test/str.py
acidicMercury8/xray-1.0
2
42413
""" >>> from str_ext import * >>> def printer(*args): ... for x in args: print x, ... print ... >>> work_with_string(printer) ['this', 'is', 'a', 'demo', 'string'] ['this', 'is', 'a', 'demo string'] this<->is<->a<->demo<->string This is a demo string [ this is a demo string ] 2 this is a demo string this is a demo string 0 0 ['this is a demo string'] this is a demo string THIS IS A DEMO STRING This Is A Demo String find 10 10 3 5 10 10 expandtabs tab demo ! tab demo ! tab demo ! operators part1part2 this is a blabla string 18 18 0 0 aaaaaaaaaaaaaaaaaaaaa """ def run(args = None): import sys import doctest if args is not None: sys.argv = args return doctest.testmod(sys.modules.get(__name__)) if __name__ == '__main__': print "running..." import sys sys.exit(run()[0])
[ 1, 9995, 30004, 13, 6778, 29958, 515, 851, 29918, 1062, 1053, 334, 30004, 13, 6778, 29958, 822, 23028, 10456, 5085, 1125, 30004, 13, 856, 268, 363, 921, 297, 6389, 29901, 1596, 921, 11167, 13, 856, 268, 1596, 30004, 13, 856, 30004, 13, 6778, 29958, 664, 29918, 2541, 29918, 1807, 29898, 558, 1639, 8443, 13, 1839, 1366, 742, 525, 275, 742, 525, 29874, 742, 525, 17482, 742, 525, 1807, 2033, 30004, 13, 1839, 1366, 742, 525, 275, 742, 525, 29874, 742, 525, 17482, 1347, 2033, 30004, 13, 1366, 29966, 976, 275, 29966, 976, 29874, 29966, 976, 17482, 29966, 976, 1807, 30004, 13, 4013, 338, 263, 13455, 1347, 30004, 13, 29961, 1678, 445, 338, 263, 13455, 1347, 268, 4514, 30004, 13, 29906, 30004, 13, 1366, 338, 263, 13455, 1347, 30004, 13, 1366, 338, 263, 13455, 1347, 30004, 13, 29900, 30004, 13, 29900, 30004, 13, 1839, 1366, 338, 263, 13455, 1347, 2033, 30004, 13, 1366, 338, 263, 13455, 1347, 30004, 13, 4690, 3235, 8519, 319, 5012, 6720, 29486, 4214, 30004, 13, 4013, 1317, 319, 27819, 1714, 30004, 13, 2886, 30004, 13, 29896, 29900, 30004, 13, 29896, 29900, 29871, 29941, 29871, 29945, 30004, 13, 29896, 29900, 30004, 13, 29896, 29900, 30004, 13, 18837, 21175, 30004, 13, 18884, 4434, 268, 13455, 1678, 1738, 30004, 13, 4706, 4434, 13455, 1678, 1738, 30004, 13, 795, 4434, 1678, 13455, 259, 1738, 30004, 13, 3372, 4097, 30004, 13, 1595, 29896, 1595, 29906, 30004, 13, 1366, 338, 263, 1999, 370, 433, 1347, 30004, 13, 29896, 29947, 30004, 13, 29896, 29947, 30004, 13, 29900, 30004, 13, 29900, 30004, 13, 27137, 27137, 27137, 27137, 27137, 29874, 30004, 13, 15945, 19451, 13, 30004, 13, 1753, 1065, 29898, 5085, 353, 6213, 1125, 30004, 13, 1678, 1053, 10876, 30004, 13, 1678, 1053, 437, 312, 342, 30004, 13, 30004, 13, 1678, 565, 6389, 338, 451, 6213, 29901, 30004, 13, 4706, 10876, 29889, 19218, 353, 6389, 30004, 13, 1678, 736, 437, 312, 342, 29889, 1688, 1545, 29898, 9675, 29889, 7576, 29889, 657, 22168, 978, 1649, 876, 30004, 13, 1678, 6756, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 1678, 1596, 376, 21094, 17794, 30004, 13, 1678, 1053, 10876, 30004, 13, 1678, 10876, 29889, 13322, 29898, 3389, 580, 29961, 29900, 2314, 30004, 13, 2 ]