content
stringlengths 1
1.04M
| input_ids
sequencelengths 1
774k
| ratio_char_token
float64 0.38
22.9
| token_count
int64 1
774k
|
---|---|---|---|
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="home"),
path('all', views.index),
path('create', views.create, name="create"),
path('delete/<int:contact_id>', views.delete, name="delete"),
path('edit/<int:contact_id>', views.edit, name="edit"),
] | [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
6738,
764,
1330,
5009,
198,
198,
6371,
33279,
82,
796,
685,
198,
197,
6978,
10786,
3256,
5009,
13,
9630,
11,
1438,
2625,
11195,
12340,
198,
197,
6978,
10786,
439,
3256,
5009,
13,
9630,
828,
198,
197,
6978,
10786,
17953,
3256,
5009,
13,
17953,
11,
1438,
2625,
17953,
12340,
198,
197,
6978,
10786,
33678,
14,
27,
600,
25,
32057,
62,
312,
29,
3256,
5009,
13,
33678,
11,
1438,
2625,
33678,
12340,
198,
197,
6978,
10786,
19312,
14,
27,
600,
25,
32057,
62,
312,
29,
3256,
5009,
13,
19312,
11,
1438,
2625,
19312,
12340,
198,
60
] | 2.883495 | 103 |
import numpy as np
from scipy.optimize import fmin
import math
from scipy.optimize import minimize
| [
11748,
299,
32152,
355,
45941,
198,
6738,
629,
541,
88,
13,
40085,
1096,
1330,
277,
1084,
198,
11748,
10688,
198,
6738,
629,
541,
88,
13,
40085,
1096,
1330,
17775,
628,
628,
628,
628
] | 3.212121 | 33 |
""" Dummy source code to initialize repo"""
from typing import Literal
def dummy() -> Literal[True]:
"""Dummy function"""
return True
| [
37811,
360,
13513,
2723,
2438,
284,
41216,
29924,
37811,
198,
198,
6738,
19720,
1330,
25659,
1691,
628,
198,
4299,
31548,
3419,
4613,
25659,
1691,
58,
17821,
5974,
198,
220,
220,
220,
37227,
35,
13513,
2163,
37811,
628,
220,
220,
220,
1441,
6407,
198
] | 3.395349 | 43 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
201,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
198,
201,
198,
201,
198
] | 1.766667 | 30 |
from launch import LaunchDescription
from launch_ros.actions import Node | [
6738,
4219,
1330,
21225,
11828,
198,
6738,
4219,
62,
4951,
13,
4658,
1330,
19081
] | 5.142857 | 14 |
""" Exports a no-op 'cython' namespace similar to
https://github.com/cython/cython/blob/master/Cython/Shadow.py
This allows to optionally compile @cython decorated functions
(when cython is available at built time), or run the same code
as pure-python, without runtime dependency on cython module.
We only define the symbols that we use. E.g. see fontTools.cu2qu
"""
from types import SimpleNamespace
compiled = False
for name in ("double", "complex", "int"):
globals()[name] = None
for name in ("cfunc", "inline"):
globals()[name] = _empty_decorator
locals = lambda **_: _empty_decorator
returns = lambda _: _empty_decorator
| [
37811,
1475,
3742,
257,
645,
12,
404,
705,
948,
400,
261,
6,
25745,
2092,
284,
198,
5450,
1378,
12567,
13,
785,
14,
948,
400,
261,
14,
948,
400,
261,
14,
2436,
672,
14,
9866,
14,
34,
7535,
14,
27447,
13,
9078,
198,
198,
1212,
3578,
284,
42976,
17632,
2488,
948,
400,
261,
24789,
5499,
198,
7,
12518,
3075,
400,
261,
318,
1695,
379,
3170,
640,
828,
393,
1057,
262,
976,
2438,
198,
292,
5899,
12,
29412,
11,
1231,
19124,
20203,
319,
3075,
400,
261,
8265,
13,
198,
198,
1135,
691,
8160,
262,
14354,
326,
356,
779,
13,
412,
13,
70,
13,
766,
10369,
33637,
13,
27399,
17,
421,
198,
37811,
198,
198,
6738,
3858,
1330,
17427,
36690,
10223,
198,
198,
5589,
3902,
796,
10352,
198,
198,
1640,
1438,
287,
5855,
23352,
1600,
366,
41887,
1600,
366,
600,
1,
2599,
198,
220,
220,
220,
15095,
874,
3419,
58,
3672,
60,
796,
6045,
198,
198,
1640,
1438,
287,
5855,
66,
20786,
1600,
366,
45145,
1,
2599,
198,
220,
220,
220,
15095,
874,
3419,
58,
3672,
60,
796,
4808,
28920,
62,
12501,
273,
1352,
198,
198,
17946,
874,
796,
37456,
12429,
62,
25,
4808,
28920,
62,
12501,
273,
1352,
198,
7783,
82,
796,
37456,
4808,
25,
4808,
28920,
62,
12501,
273,
1352,
198
] | 3.052381 | 210 |
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Defines access groups."""
from components import auth
from components import utils
# Names of groups.
# See https://code.google.com/p/swarming/wiki/SwarmingAccessGroups for each
# level.
ADMINS_GROUP = 'swarming-admins'
BOTS_GROUP = 'swarming-bots'
PRIVILEGED_USERS_GROUP = 'swarming-privileged-users'
USERS_GROUP = 'swarming-users'
def is_bot_or_admin():
"""Returns True if current user can execute user-side and bot-side calls."""
return is_bot() or is_admin()
def get_user_type():
"""Returns a string describing the current access control for the user."""
if is_admin():
return 'admin'
if is_privileged_user():
return 'privileged user'
if is_user():
return 'user'
if is_bot():
return 'bot'
return 'unknown user'
def bootstrap_dev_server_acls():
"""Adds localhost to IP whitelist and Swarming groups."""
assert utils.is_local_dev_server()
if auth.is_replica():
return
bots = auth.bootstrap_loopback_ips()
auth.bootstrap_group(BOTS_GROUP, bots, 'Swarming bots')
auth.bootstrap_group(USERS_GROUP, bots, 'Swarming users')
# Add a swarming admin. smoke-test@example.com is used in
# server_smoke_test.py
admin = auth.Identity(auth.IDENTITY_USER, 'smoke-test@example.com')
auth.bootstrap_group(ADMINS_GROUP, [admin], 'Swarming administrators')
# Add an instance admin (for easier manual testing when running dev server).
auth.bootstrap_group(
auth.ADMIN_GROUP,
[auth.Identity(auth.IDENTITY_USER, 'test@example.com')],
'Users that can manage groups')
| [
2,
15069,
1946,
383,
2451,
18052,
46665,
13,
1439,
2489,
10395,
13,
198,
2,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
262,
24843,
410,
17,
13,
15,
5964,
326,
460,
307,
198,
2,
1043,
287,
262,
38559,
24290,
2393,
13,
198,
198,
37811,
7469,
1127,
1895,
2628,
526,
15931,
198,
198,
6738,
6805,
1330,
6284,
198,
6738,
6805,
1330,
3384,
4487,
628,
198,
2,
28531,
286,
2628,
13,
198,
2,
4091,
3740,
1378,
8189,
13,
13297,
13,
785,
14,
79,
14,
2032,
18052,
14,
15466,
14,
10462,
18052,
15457,
38,
14459,
329,
1123,
198,
2,
1241,
13,
198,
2885,
44,
20913,
62,
46846,
796,
705,
2032,
18052,
12,
324,
42951,
6,
198,
33,
33472,
62,
46846,
796,
705,
2032,
18052,
12,
42478,
6,
198,
4805,
3824,
41119,
38,
1961,
62,
2937,
4877,
62,
46846,
796,
705,
2032,
18052,
12,
13776,
48446,
12,
18417,
6,
198,
2937,
4877,
62,
46846,
796,
705,
2032,
18052,
12,
18417,
6,
628,
628,
628,
628,
198,
4299,
318,
62,
13645,
62,
273,
62,
28482,
33529,
198,
220,
37227,
35561,
6407,
611,
1459,
2836,
460,
12260,
2836,
12,
1589,
290,
10214,
12,
1589,
3848,
526,
15931,
198,
220,
1441,
318,
62,
13645,
3419,
393,
318,
62,
28482,
3419,
628,
198,
4299,
651,
62,
7220,
62,
4906,
33529,
198,
220,
37227,
35561,
257,
4731,
12059,
262,
1459,
1895,
1630,
329,
262,
2836,
526,
15931,
198,
220,
611,
318,
62,
28482,
33529,
198,
220,
220,
220,
1441,
705,
28482,
6,
198,
220,
611,
318,
62,
13776,
48446,
62,
7220,
33529,
198,
220,
220,
220,
1441,
705,
13776,
48446,
2836,
6,
198,
220,
611,
318,
62,
7220,
33529,
198,
220,
220,
220,
1441,
705,
7220,
6,
198,
220,
611,
318,
62,
13645,
33529,
198,
220,
220,
220,
1441,
705,
13645,
6,
198,
220,
1441,
705,
34680,
2836,
6,
628,
198,
4299,
6297,
26418,
62,
7959,
62,
15388,
62,
330,
7278,
33529,
198,
220,
37227,
46245,
1957,
4774,
284,
6101,
20542,
46331,
290,
2451,
18052,
2628,
526,
15931,
198,
220,
6818,
3384,
4487,
13,
271,
62,
12001,
62,
7959,
62,
15388,
3419,
198,
220,
611,
6284,
13,
271,
62,
35666,
3970,
33529,
198,
220,
220,
220,
1441,
628,
220,
29641,
796,
6284,
13,
18769,
26418,
62,
26268,
1891,
62,
2419,
3419,
198,
220,
6284,
13,
18769,
26418,
62,
8094,
7,
33,
33472,
62,
46846,
11,
29641,
11,
705,
10462,
18052,
29641,
11537,
198,
220,
6284,
13,
18769,
26418,
62,
8094,
7,
2937,
4877,
62,
46846,
11,
29641,
11,
705,
10462,
18052,
2985,
11537,
628,
220,
1303,
3060,
257,
1509,
18052,
13169,
13,
7523,
12,
9288,
31,
20688,
13,
785,
318,
973,
287,
198,
220,
1303,
4382,
62,
5796,
2088,
62,
9288,
13,
9078,
198,
220,
13169,
796,
6284,
13,
7390,
26858,
7,
18439,
13,
25256,
9050,
62,
29904,
11,
705,
5796,
2088,
12,
9288,
31,
20688,
13,
785,
11537,
198,
220,
6284,
13,
18769,
26418,
62,
8094,
7,
2885,
44,
20913,
62,
46846,
11,
685,
28482,
4357,
705,
10462,
18052,
18618,
11537,
628,
220,
1303,
3060,
281,
4554,
13169,
357,
1640,
4577,
10107,
4856,
618,
2491,
1614,
4382,
737,
198,
220,
6284,
13,
18769,
26418,
62,
8094,
7,
198,
220,
220,
220,
220,
220,
6284,
13,
2885,
23678,
62,
46846,
11,
198,
220,
220,
220,
220,
220,
685,
18439,
13,
7390,
26858,
7,
18439,
13,
25256,
9050,
62,
29904,
11,
705,
9288,
31,
20688,
13,
785,
11537,
4357,
198,
220,
220,
220,
220,
220,
705,
14490,
326,
460,
6687,
2628,
11537,
198
] | 2.989529 | 573 |
# Copyright (C) 2017 Open Information Security Foundation
#
# You can copy, redistribute or modify this Program under the terms of
# the GNU General Public License version 2 as published by the Free
# Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# version 2 along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
from __future__ import print_function
import os
import logging
from suricata.update import config
from suricata.update import sources
logger = logging.getLogger()
| [
2,
15069,
357,
34,
8,
2177,
4946,
6188,
4765,
5693,
198,
2,
198,
2,
921,
460,
4866,
11,
17678,
4163,
393,
13096,
428,
6118,
739,
262,
2846,
286,
198,
2,
262,
22961,
3611,
5094,
13789,
2196,
362,
355,
3199,
416,
262,
3232,
198,
2,
10442,
5693,
13,
198,
2,
198,
2,
770,
1430,
318,
9387,
287,
262,
2911,
326,
340,
481,
307,
4465,
11,
198,
2,
475,
42881,
15529,
34764,
56,
26,
1231,
772,
262,
17142,
18215,
286,
198,
2,
34482,
3398,
1565,
5603,
25382,
393,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
13,
220,
4091,
262,
198,
2,
22961,
3611,
5094,
13789,
329,
517,
3307,
13,
198,
2,
198,
2,
921,
815,
423,
2722,
257,
4866,
286,
262,
22961,
3611,
5094,
13789,
198,
2,
2196,
362,
1863,
351,
428,
1430,
26,
611,
407,
11,
3551,
284,
262,
3232,
10442,
198,
2,
5693,
11,
3457,
1539,
6885,
14021,
3530,
11,
19383,
22343,
11,
6182,
11,
8779,
198,
2,
657,
2481,
940,
12,
1485,
486,
11,
4916,
13,
198,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
28686,
198,
11748,
18931,
198,
198,
6738,
969,
291,
1045,
13,
19119,
1330,
4566,
198,
6738,
969,
291,
1045,
13,
19119,
1330,
4237,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
3419,
198
] | 3.953917 | 217 |
from django.contrib import admin
from .models import Blog, Category, Tag, Comment
# Register your models here.
@admin.register(Blog)
@admin.register(Category)
@admin.register(Tag)
@admin.register(Comment)
| [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
6738,
764,
27530,
1330,
14001,
11,
21743,
11,
17467,
11,
18957,
198,
198,
2,
17296,
534,
4981,
994,
13,
198,
31,
28482,
13,
30238,
7,
42383,
8,
198,
198,
31,
28482,
13,
30238,
7,
27313,
8,
628,
198,
31,
28482,
13,
30238,
7,
24835,
8,
628,
198,
31,
28482,
13,
30238,
7,
21357,
8,
628
] | 3.3125 | 64 |
"""Test methods for `inout_core.py`.
Can be run with:
$ nosetests zcode/inout/tests/test_inout_core.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import warnings
import shutil
from numpy.testing import run_module_suite
import numpy as np
from nose.tools import assert_true, assert_false, assert_equal
# Run all methods as if with `nosetests ...`
if __name__ == "__main__":
run_module_suite()
| [
37811,
14402,
5050,
329,
4600,
259,
448,
62,
7295,
13,
9078,
44646,
198,
198,
6090,
307,
1057,
351,
25,
198,
220,
220,
220,
720,
43630,
316,
3558,
1976,
8189,
14,
259,
448,
14,
41989,
14,
9288,
62,
259,
448,
62,
7295,
13,
9078,
198,
198,
37811,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
7297,
11,
3601,
62,
8818,
11,
28000,
1098,
62,
17201,
874,
198,
198,
11748,
28686,
198,
11748,
14601,
198,
11748,
4423,
346,
198,
6738,
299,
32152,
13,
33407,
1330,
1057,
62,
21412,
62,
2385,
578,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
9686,
13,
31391,
1330,
6818,
62,
7942,
11,
6818,
62,
9562,
11,
6818,
62,
40496,
628,
198,
198,
2,
5660,
477,
5050,
355,
611,
351,
4600,
39369,
316,
3558,
2644,
63,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1057,
62,
21412,
62,
2385,
578,
3419,
198
] | 3.006536 | 153 |
name = input("Mame: ")
print(f"Hello, {name}") | [
3672,
796,
5128,
7203,
44,
480,
25,
366,
8,
198,
4798,
7,
69,
1,
15496,
11,
1391,
3672,
92,
4943
] | 2.3 | 20 |
"""Contains validators for task models."""
def task_instance_args_are_valid(instance, fill_missing_args=False):
"""Determines whether a task instance's arguments are valid.
The arguments are valid if the instance's argument includes all of
its task type's required arguments (but not necessarily the
arguments for which a default value exists).
Arg:
instance: A task instance instance. (Yikes!)
fill_missing_args: A boolean determining whether to fill in any
missing arguments in the instance with default values.
Returns:
A tuple containing a boolean and a string, where the boolean
signals whether the arguments are valid and the string explains
why, in the case that the boolean is False (otherwise it's an
empty string).
"""
# Validate an instance's args against its required args.
task_type_required_args = instance.task_type.required_arguments
task_type_default_vals = (
instance.task_type.required_arguments_default_values
)
instance_arg_keys = instance.arguments.keys()
for required_arg in task_type_required_args:
# Check if the required argument is provided
if required_arg not in instance_arg_keys:
# Required argument not provided. Check if default argument
# value exists.
if required_arg not in task_type_default_vals:
# No default exists
return (
False,
"required argument '%s' not provided!" % required_arg,
)
# Fill in the default value if we're told to
if fill_missing_args:
instance.arguments[required_arg] = task_type_default_vals[
required_arg
]
# Valid
return (True, "")
def task_type_args_are_valid(instance):
"""Determines whether a task type's argument fields are valid.
The argument fields are valid if the argument keys in the
required_arguments_default_values field are a subset of its required
arguments.
Arg:
instance: A task type instance.
Returns:
A tuple containing a boolean and a string, where the boolean
signals whether the arguments are valid and the string explains
why, in the case that the boolean is False (otherwise it's an
empty string).
"""
# Ensure that the default arguments form a subset of the required
# arguments
if not set(instance.required_arguments_default_values.keys()).issubset(
set(instance.required_arguments)
):
return (False, "default arguments not a subset of required arguments")
# Valid
return (True, "")
| [
37811,
4264,
1299,
4938,
2024,
329,
4876,
4981,
526,
15931,
628,
198,
4299,
4876,
62,
39098,
62,
22046,
62,
533,
62,
12102,
7,
39098,
11,
6070,
62,
45688,
62,
22046,
28,
25101,
2599,
198,
220,
220,
220,
37227,
35,
13221,
274,
1771,
257,
4876,
4554,
338,
7159,
389,
4938,
13,
628,
220,
220,
220,
383,
7159,
389,
4938,
611,
262,
4554,
338,
4578,
3407,
477,
286,
198,
220,
220,
220,
663,
4876,
2099,
338,
2672,
7159,
357,
4360,
407,
6646,
262,
198,
220,
220,
220,
7159,
329,
543,
257,
4277,
1988,
7160,
737,
628,
220,
220,
220,
20559,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4554,
25,
317,
4876,
4554,
4554,
13,
357,
56,
7938,
8133,
198,
220,
220,
220,
220,
220,
220,
220,
6070,
62,
45688,
62,
22046,
25,
317,
25131,
13213,
1771,
284,
6070,
287,
597,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4814,
7159,
287,
262,
4554,
351,
4277,
3815,
13,
198,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
317,
46545,
7268,
257,
25131,
290,
257,
4731,
11,
810,
262,
25131,
198,
220,
220,
220,
220,
220,
220,
220,
10425,
1771,
262,
7159,
389,
4938,
290,
262,
4731,
6688,
198,
220,
220,
220,
220,
220,
220,
220,
1521,
11,
287,
262,
1339,
326,
262,
25131,
318,
10352,
357,
847,
3083,
340,
338,
281,
198,
220,
220,
220,
220,
220,
220,
220,
6565,
4731,
737,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
3254,
20540,
281,
4554,
338,
26498,
1028,
663,
2672,
26498,
13,
198,
220,
220,
220,
4876,
62,
4906,
62,
35827,
62,
22046,
796,
4554,
13,
35943,
62,
4906,
13,
35827,
62,
853,
2886,
198,
220,
220,
220,
4876,
62,
4906,
62,
12286,
62,
12786,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
4554,
13,
35943,
62,
4906,
13,
35827,
62,
853,
2886,
62,
12286,
62,
27160,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
4554,
62,
853,
62,
13083,
796,
4554,
13,
853,
2886,
13,
13083,
3419,
628,
220,
220,
220,
329,
2672,
62,
853,
287,
4876,
62,
4906,
62,
35827,
62,
22046,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
611,
262,
2672,
4578,
318,
2810,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2672,
62,
853,
407,
287,
4554,
62,
853,
62,
13083,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
20906,
4578,
407,
2810,
13,
6822,
611,
4277,
4578,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1988,
7160,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2672,
62,
853,
407,
287,
4876,
62,
4906,
62,
12286,
62,
12786,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1400,
4277,
7160,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
35827,
4578,
705,
4,
82,
6,
407,
2810,
2474,
4064,
2672,
62,
853,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
27845,
287,
262,
4277,
1988,
611,
356,
821,
1297,
284,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6070,
62,
45688,
62,
22046,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4554,
13,
853,
2886,
58,
35827,
62,
853,
60,
796,
4876,
62,
4906,
62,
12286,
62,
12786,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2672,
62,
853,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2361,
628,
220,
220,
220,
1303,
48951,
198,
220,
220,
220,
1441,
357,
17821,
11,
366,
4943,
628,
198,
4299,
4876,
62,
4906,
62,
22046,
62,
533,
62,
12102,
7,
39098,
2599,
198,
220,
220,
220,
37227,
35,
13221,
274,
1771,
257,
4876,
2099,
338,
4578,
7032,
389,
4938,
13,
628,
220,
220,
220,
383,
4578,
7032,
389,
4938,
611,
262,
4578,
8251,
287,
262,
198,
220,
220,
220,
2672,
62,
853,
2886,
62,
12286,
62,
27160,
2214,
389,
257,
24637,
286,
663,
2672,
198,
220,
220,
220,
7159,
13,
628,
220,
220,
220,
20559,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4554,
25,
317,
4876,
2099,
4554,
13,
198,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
317,
46545,
7268,
257,
25131,
290,
257,
4731,
11,
810,
262,
25131,
198,
220,
220,
220,
220,
220,
220,
220,
10425,
1771,
262,
7159,
389,
4938,
290,
262,
4731,
6688,
198,
220,
220,
220,
220,
220,
220,
220,
1521,
11,
287,
262,
1339,
326,
262,
25131,
318,
10352,
357,
847,
3083,
340,
338,
281,
198,
220,
220,
220,
220,
220,
220,
220,
6565,
4731,
737,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
48987,
326,
262,
4277,
7159,
1296,
257,
24637,
286,
262,
2672,
198,
220,
220,
220,
1303,
7159,
198,
220,
220,
220,
611,
407,
900,
7,
39098,
13,
35827,
62,
853,
2886,
62,
12286,
62,
27160,
13,
13083,
3419,
737,
747,
549,
2617,
7,
198,
220,
220,
220,
220,
220,
220,
220,
900,
7,
39098,
13,
35827,
62,
853,
2886,
8,
198,
220,
220,
220,
15179,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
25101,
11,
366,
12286,
7159,
407,
257,
24637,
286,
2672,
7159,
4943,
628,
220,
220,
220,
1303,
48951,
198,
220,
220,
220,
1441,
357,
17821,
11,
366,
4943,
198
] | 2.766194 | 988 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (С) ABBYY (BIT Software), 1993 - 2019. All rights reserved.
"""
Различные метрики для keras подсчитываемые при обучении
"""
import functools
import keras.backend as K
import tensorflow as tf
from semantic_segmentation.losses import get_losses
@_metric_wrapper
def confusion_matrix(true, pred, weights):
"""
Confusion matrix для бинарной классификации
:param true:
:param pred:
:param weights:
:return: tp, tn, fp, fn - confusion matrix
"""
equal = K.equal(true, pred)
tp = tf.logical_and(equal, K.equal(true, 1))
tn = tf.logical_and(equal, K.equal(true, 0))
fp = tf.logical_and(tf.logical_not(equal), K.equal(pred, 1))
fn = tf.logical_and(tf.logical_not(equal), K.equal(pred, 0))
tp = calculate_sum(tp)
tn = calculate_sum(tn)
fp = calculate_sum(fp)
fn = calculate_sum(fn)
return tp, tn, fp, fn
@_metric_wrapper
def precision(true, pred, weights):
"""
Вычисляет precision c учетом весов
:param true:
:param pred:
:param weights:
:return:
"""
tp, tn, fp, fn = confusion_matrix(true, pred, weights)
return tp / K.maximum(1., tp + fp)
@_metric_wrapper
def recall(true, pred, weights):
"""
Вычисляет recall с учетом весов
:param true:
:param pred:
:param weights:
:return:
"""
tp, tn, fp, fn = confusion_matrix(true, pred, weights)
return tp / K.maximum(1., tp + fn)
@_metric_wrapper
def f1(true, pred, weights):
"""
Вычисляет f1-меру с учетом весов
:param true:
:param pred:
:param weights:
:return:
"""
tp, tn, fp, fn = confusion_matrix(true, pred, weights)
precision = tp / K.maximum(1., tp + fp)
recall = tp / K.maximum(1., tp + fn)
return tf.cond(K.not_equal(precision + recall, 0.),
lambda: 2. * precision * recall / (precision + recall),
lambda: 0.)
def detection_pixel_acc(y_true, y_pred):
"""
Вычисляет попиксельную accuracy детекции
:param y_true:
:param y_pred:
:return:
"""
detection_true, detection_pred = _get_detection_labels(y_true, y_pred)
return _acc(detection_true, detection_pred)
def detection_pixel_precision(y_true, y_pred):
"""
Вычисляет попиксельню точность (precision) детекции
:param y_true:
:param y_pred:
:return:
"""
detection_true, detection_pred = _get_detection_labels(y_true, y_pred)
return precision(detection_true, detection_pred)
def detection_pixel_recall(y_true, y_pred):
"""
Вычисляет попиксельню полноту (recall) детекции
:param y_true:
:param y_pred:
:return:
"""
detection_true, detection_pred = _get_detection_labels(y_true, y_pred)
return recall(detection_true, detection_pred)
def detection_pixel_f1(y_true, y_pred):
"""
Вычисляет попиксельню f1-меру детекции
:param y_true:
:param y_pred:
:return:
"""
detection_true, detection_pred = _get_detection_labels(y_true, y_pred)
return f1(detection_true, detection_pred)
def classification_pixel_acc(y_true, y_pred):
"""
Вычисляет попиксельную accuracy классификации
считается только по y_true > 0 т.е. там где есть какой-то объект
:param y_true:
:param y_pred:
:return:
"""
mask = K.cast(y_true > 0, tf.float32)
labels = K.cast((y_true - 1) * mask, tf.int64)
class_p = tf.nn.softmax(y_pred[..., 1:], axis=-1)
predictions = tf.argmax(class_p, axis=-1)
return _acc(labels, predictions, weights=mask)
def get_all_metrics(classification_mode=False):
"""
Возвращает список всех метрик
:param classification_mode:
:return:
"""
all_metrics = [
detection_pixel_acc,
detection_pixel_precision,
detection_pixel_recall,
detection_pixel_f1
]
if classification_mode:
all_metrics.append(classification_pixel_acc)
all_metrics += get_losses(classification_mode)
return all_metrics
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
15069,
357,
140,
94,
8,
9564,
17513,
56,
357,
26094,
10442,
828,
9656,
532,
13130,
13,
1439,
2489,
10395,
13,
198,
37811,
198,
140,
254,
16142,
140,
115,
30143,
18849,
141,
229,
22177,
45035,
16843,
12466,
120,
16843,
20375,
21169,
18849,
31583,
18849,
12466,
112,
30143,
40623,
41927,
292,
12466,
123,
25443,
112,
21727,
141,
229,
18849,
20375,
45035,
38857,
16142,
16843,
43108,
45035,
16843,
12466,
123,
21169,
18849,
12466,
122,
140,
109,
35072,
141,
229,
16843,
22177,
18849,
18849,
198,
37811,
198,
198,
11748,
1257,
310,
10141,
198,
198,
11748,
41927,
292,
13,
1891,
437,
355,
509,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
198,
6738,
37865,
62,
325,
5154,
341,
13,
22462,
274,
1330,
651,
62,
22462,
274,
628,
628,
198,
31,
62,
4164,
1173,
62,
48553,
628,
198,
4299,
10802,
62,
6759,
8609,
7,
7942,
11,
2747,
11,
19590,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7326,
4241,
17593,
12466,
112,
30143,
40623,
12466,
109,
18849,
22177,
16142,
21169,
22177,
25443,
117,
12466,
118,
30143,
16142,
21727,
21727,
18849,
141,
226,
18849,
31583,
16142,
141,
228,
18849,
18849,
198,
220,
220,
220,
1058,
17143,
2081,
25,
198,
220,
220,
220,
1058,
17143,
2747,
25,
198,
220,
220,
220,
1058,
17143,
19590,
25,
198,
220,
220,
220,
1058,
7783,
25,
256,
79,
11,
256,
77,
11,
277,
79,
11,
24714,
532,
10802,
17593,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4961,
796,
509,
13,
40496,
7,
7942,
11,
2747,
8,
628,
220,
220,
220,
256,
79,
796,
48700,
13,
6404,
605,
62,
392,
7,
40496,
11,
509,
13,
40496,
7,
7942,
11,
352,
4008,
198,
220,
220,
220,
256,
77,
796,
48700,
13,
6404,
605,
62,
392,
7,
40496,
11,
509,
13,
40496,
7,
7942,
11,
657,
4008,
198,
220,
220,
220,
277,
79,
796,
48700,
13,
6404,
605,
62,
392,
7,
27110,
13,
6404,
605,
62,
1662,
7,
40496,
828,
509,
13,
40496,
7,
28764,
11,
352,
4008,
198,
220,
220,
220,
24714,
796,
48700,
13,
6404,
605,
62,
392,
7,
27110,
13,
6404,
605,
62,
1662,
7,
40496,
828,
509,
13,
40496,
7,
28764,
11,
657,
4008,
628,
220,
220,
220,
256,
79,
796,
15284,
62,
16345,
7,
34788,
8,
198,
220,
220,
220,
256,
77,
796,
15284,
62,
16345,
7,
34106,
8,
198,
220,
220,
220,
277,
79,
796,
15284,
62,
16345,
7,
46428,
8,
198,
220,
220,
220,
24714,
796,
15284,
62,
16345,
7,
22184,
8,
628,
220,
220,
220,
1441,
256,
79,
11,
256,
77,
11,
277,
79,
11,
24714,
628,
198,
31,
62,
4164,
1173,
62,
48553,
198,
4299,
15440,
7,
7942,
11,
2747,
11,
19590,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
15440,
269,
220,
35072,
141,
229,
16843,
20375,
25443,
120,
12466,
110,
16843,
21727,
25443,
110,
198,
220,
220,
220,
1058,
17143,
2081,
25,
198,
220,
220,
220,
1058,
17143,
2747,
25,
198,
220,
220,
220,
1058,
17143,
19590,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
256,
79,
11,
256,
77,
11,
277,
79,
11,
24714,
796,
10802,
62,
6759,
8609,
7,
7942,
11,
2747,
11,
19590,
8,
198,
220,
220,
220,
1441,
256,
79,
1220,
509,
13,
47033,
7,
16,
1539,
256,
79,
1343,
277,
79,
8,
628,
198,
31,
62,
4164,
1173,
62,
48553,
198,
4299,
10014,
7,
7942,
11,
2747,
11,
19590,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
10014,
220,
21727,
220,
35072,
141,
229,
16843,
20375,
25443,
120,
12466,
110,
16843,
21727,
25443,
110,
198,
220,
220,
220,
1058,
17143,
2081,
25,
198,
220,
220,
220,
1058,
17143,
2747,
25,
198,
220,
220,
220,
1058,
17143,
19590,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
256,
79,
11,
256,
77,
11,
277,
79,
11,
24714,
796,
10802,
62,
6759,
8609,
7,
7942,
11,
2747,
11,
19590,
8,
198,
220,
220,
220,
1441,
256,
79,
1220,
509,
13,
47033,
7,
16,
1539,
256,
79,
1343,
24714,
8,
628,
198,
31,
62,
4164,
1173,
62,
48553,
198,
4299,
277,
16,
7,
7942,
11,
2747,
11,
19590,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
277,
16,
12,
43108,
16843,
21169,
35072,
220,
21727,
220,
35072,
141,
229,
16843,
20375,
25443,
120,
12466,
110,
16843,
21727,
25443,
110,
198,
220,
220,
220,
1058,
17143,
2081,
25,
198,
220,
220,
220,
1058,
17143,
2747,
25,
198,
220,
220,
220,
1058,
17143,
19590,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
256,
79,
11,
256,
77,
11,
277,
79,
11,
24714,
796,
10802,
62,
6759,
8609,
7,
7942,
11,
2747,
11,
19590,
8,
198,
220,
220,
220,
15440,
796,
256,
79,
1220,
509,
13,
47033,
7,
16,
1539,
256,
79,
1343,
277,
79,
8,
198,
220,
220,
220,
10014,
796,
256,
79,
1220,
509,
13,
47033,
7,
16,
1539,
256,
79,
1343,
24714,
8,
198,
220,
220,
220,
1441,
48700,
13,
17561,
7,
42,
13,
1662,
62,
40496,
7,
3866,
16005,
1343,
10014,
11,
657,
12179,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37456,
25,
362,
13,
1635,
15440,
1635,
10014,
1220,
357,
3866,
16005,
1343,
10014,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37456,
25,
657,
2014,
628,
198,
198,
4299,
13326,
62,
32515,
62,
4134,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
12466,
123,
25443,
123,
18849,
31583,
21727,
16843,
30143,
45367,
22177,
35072,
141,
236,
9922,
12466,
112,
16843,
20375,
16843,
31583,
141,
228,
18849,
18849,
198,
220,
220,
220,
1058,
17143,
331,
62,
7942,
25,
198,
220,
220,
220,
1058,
17143,
331,
62,
28764,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13326,
62,
7942,
11,
13326,
62,
28764,
796,
4808,
1136,
62,
15255,
3213,
62,
23912,
1424,
7,
88,
62,
7942,
11,
331,
62,
28764,
8,
198,
220,
220,
220,
1441,
4808,
4134,
7,
15255,
3213,
62,
7942,
11,
13326,
62,
28764,
8,
628,
198,
4299,
13326,
62,
32515,
62,
3866,
16005,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
12466,
123,
25443,
123,
18849,
31583,
21727,
16843,
30143,
45367,
22177,
141,
236,
220,
20375,
15166,
141,
229,
22177,
15166,
21727,
20375,
45367,
357,
3866,
16005,
8,
12466,
112,
16843,
20375,
16843,
31583,
141,
228,
18849,
18849,
198,
220,
220,
220,
1058,
17143,
331,
62,
7942,
25,
198,
220,
220,
220,
1058,
17143,
331,
62,
28764,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13326,
62,
7942,
11,
13326,
62,
28764,
796,
4808,
1136,
62,
15255,
3213,
62,
23912,
1424,
7,
88,
62,
7942,
11,
331,
62,
28764,
8,
198,
220,
220,
220,
1441,
15440,
7,
15255,
3213,
62,
7942,
11,
13326,
62,
28764,
8,
628,
198,
4299,
13326,
62,
32515,
62,
8344,
439,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
12466,
123,
25443,
123,
18849,
31583,
21727,
16843,
30143,
45367,
22177,
141,
236,
12466,
123,
25443,
119,
22177,
15166,
20375,
35072,
357,
8344,
439,
8,
12466,
112,
16843,
20375,
16843,
31583,
141,
228,
18849,
18849,
198,
220,
220,
220,
1058,
17143,
331,
62,
7942,
25,
198,
220,
220,
220,
1058,
17143,
331,
62,
28764,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13326,
62,
7942,
11,
13326,
62,
28764,
796,
4808,
1136,
62,
15255,
3213,
62,
23912,
1424,
7,
88,
62,
7942,
11,
331,
62,
28764,
8,
198,
220,
220,
220,
1441,
10014,
7,
15255,
3213,
62,
7942,
11,
13326,
62,
28764,
8,
628,
198,
4299,
13326,
62,
32515,
62,
69,
16,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
12466,
123,
25443,
123,
18849,
31583,
21727,
16843,
30143,
45367,
22177,
141,
236,
277,
16,
12,
43108,
16843,
21169,
35072,
12466,
112,
16843,
20375,
16843,
31583,
141,
228,
18849,
18849,
198,
220,
220,
220,
1058,
17143,
331,
62,
7942,
25,
198,
220,
220,
220,
1058,
17143,
331,
62,
28764,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13326,
62,
7942,
11,
13326,
62,
28764,
796,
4808,
1136,
62,
15255,
3213,
62,
23912,
1424,
7,
88,
62,
7942,
11,
331,
62,
28764,
8,
198,
220,
220,
220,
1441,
277,
16,
7,
15255,
3213,
62,
7942,
11,
13326,
62,
28764,
8,
628,
198,
4299,
17923,
62,
32515,
62,
4134,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
45035,
141,
229,
18849,
21727,
30143,
40623,
16843,
20375,
12466,
123,
25443,
123,
18849,
31583,
21727,
16843,
30143,
45367,
22177,
35072,
141,
236,
9922,
12466,
118,
30143,
16142,
21727,
21727,
18849,
141,
226,
18849,
31583,
16142,
141,
228,
18849,
18849,
198,
220,
220,
220,
220,
21727,
141,
229,
18849,
20375,
16142,
16843,
20375,
21727,
40623,
220,
20375,
25443,
119,
45367,
31583,
15166,
12466,
123,
15166,
331,
62,
7942,
1875,
657,
220,
20375,
13,
16843,
13,
220,
20375,
16142,
43108,
12466,
111,
43666,
16843,
12466,
113,
21727,
20375,
45367,
12466,
118,
16142,
31583,
25443,
117,
12,
20375,
15166,
12466,
122,
140,
109,
141,
232,
16843,
31583,
20375,
198,
220,
220,
220,
1058,
17143,
331,
62,
7942,
25,
198,
220,
220,
220,
1058,
17143,
331,
62,
28764,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
9335,
796,
509,
13,
2701,
7,
88,
62,
7942,
1875,
657,
11,
48700,
13,
22468,
2624,
8,
198,
220,
220,
220,
14722,
796,
509,
13,
2701,
19510,
88,
62,
7942,
532,
352,
8,
1635,
9335,
11,
48700,
13,
600,
2414,
8,
198,
220,
220,
220,
1398,
62,
79,
796,
48700,
13,
20471,
13,
4215,
9806,
7,
88,
62,
28764,
58,
986,
11,
352,
25,
4357,
16488,
10779,
16,
8,
198,
220,
220,
220,
16277,
796,
48700,
13,
853,
9806,
7,
4871,
62,
79,
11,
16488,
10779,
16,
8,
198,
220,
220,
220,
1441,
4808,
4134,
7,
23912,
1424,
11,
16277,
11,
19590,
28,
27932,
8,
628,
198,
4299,
651,
62,
439,
62,
4164,
10466,
7,
4871,
2649,
62,
14171,
28,
25101,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
240,
25443,
115,
38857,
21169,
16142,
141,
231,
16142,
16843,
20375,
220,
21727,
140,
123,
18849,
21727,
25443,
118,
12466,
110,
21727,
16843,
141,
227,
12466,
120,
16843,
20375,
21169,
18849,
31583,
198,
220,
220,
220,
1058,
17143,
17923,
62,
14171,
25,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
477,
62,
4164,
10466,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
13326,
62,
32515,
62,
4134,
11,
198,
220,
220,
220,
220,
220,
220,
220,
13326,
62,
32515,
62,
3866,
16005,
11,
198,
220,
220,
220,
220,
220,
220,
220,
13326,
62,
32515,
62,
8344,
439,
11,
198,
220,
220,
220,
220,
220,
220,
220,
13326,
62,
32515,
62,
69,
16,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
611,
17923,
62,
14171,
25,
198,
220,
220,
220,
220,
220,
220,
220,
477,
62,
4164,
10466,
13,
33295,
7,
4871,
2649,
62,
32515,
62,
4134,
8,
628,
220,
220,
220,
477,
62,
4164,
10466,
15853,
651,
62,
22462,
274,
7,
4871,
2649,
62,
14171,
8,
198,
220,
220,
220,
1441,
477,
62,
4164,
10466,
198
] | 1.968627 | 2,040 |
# -*- coding: utf-8 -*-
"""
Created on %(date)s
@author: %(username)s
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import linear_model
import statsmodels.api as sm
from statsmodels.sandbox.regression.predstd import wls_prediction_std
model_sm = 'sm'
if __name__ == '__main__':
x = np.linspace(0, 10, 21)
y = 3*x + 2
y += np.random.randn(x.size)
lm = LinearModel(y, x)
lm.fit()
lm.summary()
print(lm.predict())
lm.plot()
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
4064,
7,
4475,
8,
82,
198,
198,
31,
9800,
25,
4064,
7,
29460,
8,
82,
198,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
384,
397,
1211,
355,
3013,
82,
198,
198,
6738,
1341,
35720,
1330,
14174,
62,
19849,
198,
11748,
9756,
27530,
13,
15042,
355,
895,
198,
6738,
9756,
27530,
13,
38142,
3524,
13,
2301,
2234,
13,
28764,
19282,
1330,
266,
7278,
62,
28764,
2867,
62,
19282,
628,
198,
19849,
62,
5796,
796,
705,
5796,
6,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
2124,
796,
45941,
13,
21602,
10223,
7,
15,
11,
838,
11,
2310,
8,
198,
220,
220,
220,
331,
796,
513,
9,
87,
1343,
362,
198,
220,
220,
220,
331,
15853,
45941,
13,
25120,
13,
25192,
77,
7,
87,
13,
7857,
8,
198,
220,
220,
220,
300,
76,
796,
44800,
17633,
7,
88,
11,
2124,
8,
198,
220,
220,
220,
300,
76,
13,
11147,
3419,
198,
220,
220,
220,
300,
76,
13,
49736,
3419,
198,
220,
220,
220,
3601,
7,
75,
76,
13,
79,
17407,
28955,
198,
220,
220,
220,
300,
76,
13,
29487,
3419,
198
] | 2.317181 | 227 |
#!/usr/bin/env python3.6
"""Refactored utility functions."""
__author__ = "Richard Cosgrove"
from collections import defaultdict
import gzip
from itertools import combinations
from datetime import datetime, timedelta
import json
import os
def export_compressed_json(dict_item, file_name):
"""Export gzip compressed JSON.
(For Uni dataset compressed size is ~10% of uncompressed.)
:param dict_item: Dictionary to dump as JSON.
:param file_name: Name of file to be written e.g. dict.json.gz
"""
# Use lowest level of compression for fast speed.
os.makedirs(os.path.dirname(file_name), exist_ok=True)
with gzip.open(file_name, mode="wt", compresslevel=1) as f:
json.dump(dict_item, f, separators=(',', ':'))
def import_compressed_json(file_name):
"""Import gzip compressed JSON.
:param file_name: Name of file to be read e.g. dict.json.gz
:returns: JSON as a dictionary.
"""
with gzip.open(file_name, mode="rt") as f:
return json.load(f)
def match_tokens_with_same_ssid_set(token_to_probes):
"""Split into clusters that share the SAME set of SSIDs probed for.
:param token_to_probes: Dictionary with token keys and probe values
:returns: Dictionary with SSID set keys and token values
"""
ssid_set_to_tokens = defaultdict(set)
token_to_ssid_set = {}
for token, probes in token_to_probes.items():
ssid_set = set()
for probe in probes:
if probe["ssid"] == 0:
# Ignore broadcast probes.
continue
ssid_set.add(probe["ssid"])
if len(ssid_set) < 2:
# Ignore sets with cardinality less than X
# due to high rate of false positives.
continue
# Cluster token with any tokens that share the same SSID set.
ssid_set_to_tokens[frozenset(ssid_set)].add(token)
token_to_ssid_set[token] = frozenset(ssid_set)
# Sanity check: Assert that no token has been matched more than once.
tokens = [t for tokens in list(ssid_set_to_tokens.values()) for t in tokens]
assert(len(tokens) == len(set(tokens)))
return (ssid_set_to_tokens, token_to_ssid_set)
def validate_clusters(clusters, token_to_probes):
"""Validate the correctness of a clustering.
:param clusters: An iterable of clusters, where each cluster is a list of tokens.
:returns: Dictionary of binary classifier results
"""
token_to_mac = import_compressed_json("int/token_to_mac.json.gz")
# Use a binary Classification
true_positives, false_positives = 0, 0
num_of_clusters = 0
mac_to_timestamps = defaultdict(list)
for cluster in clusters:
num_of_clusters += 1
for pair in combinations(cluster, r=2):
if token_to_mac[pair[0]] == token_to_mac[pair[1]]:
true_positives += 1
mac = token_to_mac[pair[0]]
t1_timestamps = [float(p["timestamp"]) for p in token_to_probes[pair[0]]]
t2_timestamps = [float(p["timestamp"]) for p in token_to_probes[pair[1]]]
mac_to_timestamps[mac] += t1_timestamps
mac_to_timestamps[mac] += t2_timestamps
else:
false_positives += 1
greater_than = 0
lengths = []
for mac, timestamps in mac_to_timestamps.items():
length = timedelta(seconds=max(timestamps)) - timedelta(seconds=min(timestamps))
if length > timedelta(hours=12):
greater_than += 1
lengths.append(length)
import statistics
mid = statistics.median(lengths)
# Total number of valid pairs and invalid pairs have been
# pre-computed in randomiseTokens.py ...
# So we can easily calculate the negatives by subtracting the positives.
actual_combos = import_compressed_json("int/valid_combinations.json.gz")
true_negatives = actual_combos["invalid_pairs"] - false_positives
false_negatives = actual_combos["valid_pairs"] - true_positives
# Sanity checks
assert(true_positives + false_positives + true_negatives + false_negatives == actual_combos["total_pairs"])
assert(true_positives + false_negatives == actual_combos["valid_pairs"])
assert(false_positives + true_negatives == actual_combos["invalid_pairs"])
true_positive_rate = (true_positives / (float(true_positives + false_negatives)))
false_positive_rate = (false_positives / (float(false_positives + true_negatives)))
accuracy = (true_positives + true_negatives) / float(actual_combos["total_pairs"])
return {
"tp": true_positives,
"fp": false_positives,
"tn": true_negatives,
"fn": false_negatives,
"tpr": true_positive_rate,
"fpr": false_positive_rate,
"accuracy": accuracy,
"clusters": num_of_clusters,
"macs": greater_than,
"median": mid
}
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
13,
21,
198,
198,
37811,
8134,
529,
1850,
10361,
5499,
526,
15931,
198,
198,
834,
9800,
834,
796,
366,
22245,
10437,
27333,
303,
1,
198,
198,
6738,
17268,
1330,
4277,
11600,
198,
11748,
308,
13344,
198,
6738,
340,
861,
10141,
1330,
17790,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
11748,
33918,
198,
11748,
28686,
198,
198,
4299,
10784,
62,
5589,
2790,
62,
17752,
7,
11600,
62,
9186,
11,
2393,
62,
3672,
2599,
198,
220,
220,
220,
37227,
43834,
308,
13344,
25388,
19449,
13,
198,
220,
220,
220,
357,
1890,
43376,
27039,
25388,
2546,
318,
5299,
940,
4,
286,
34318,
2790,
2014,
198,
220,
220,
220,
1058,
17143,
8633,
62,
9186,
25,
28261,
284,
10285,
355,
19449,
13,
198,
220,
220,
220,
1058,
17143,
2393,
62,
3672,
25,
6530,
286,
2393,
284,
307,
3194,
304,
13,
70,
13,
8633,
13,
17752,
13,
34586,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
5765,
9016,
1241,
286,
19794,
329,
3049,
2866,
13,
198,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
418,
13,
6978,
13,
15908,
3672,
7,
7753,
62,
3672,
828,
2152,
62,
482,
28,
17821,
8,
198,
220,
220,
220,
351,
308,
13344,
13,
9654,
7,
7753,
62,
3672,
11,
4235,
2625,
46569,
1600,
27413,
5715,
28,
16,
8,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
11600,
62,
9186,
11,
277,
11,
2880,
2024,
16193,
3256,
3256,
705,
32105,
4008,
198,
198,
4299,
1330,
62,
5589,
2790,
62,
17752,
7,
7753,
62,
3672,
2599,
198,
220,
220,
220,
37227,
20939,
308,
13344,
25388,
19449,
13,
198,
220,
220,
220,
1058,
17143,
2393,
62,
3672,
25,
6530,
286,
2393,
284,
307,
1100,
304,
13,
70,
13,
8633,
13,
17752,
13,
34586,
198,
220,
220,
220,
1058,
7783,
82,
25,
19449,
355,
257,
22155,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
351,
308,
13344,
13,
9654,
7,
7753,
62,
3672,
11,
4235,
2625,
17034,
4943,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
33918,
13,
2220,
7,
69,
8,
198,
198,
4299,
2872,
62,
83,
482,
641,
62,
4480,
62,
31642,
62,
824,
312,
62,
2617,
7,
30001,
62,
1462,
62,
1676,
12636,
2599,
198,
220,
220,
220,
37227,
41205,
656,
23163,
326,
2648,
262,
311,
10067,
900,
286,
6723,
47954,
1861,
276,
329,
13,
198,
220,
220,
220,
1058,
17143,
11241,
62,
1462,
62,
1676,
12636,
25,
28261,
351,
11241,
8251,
290,
12774,
3815,
198,
220,
220,
220,
1058,
7783,
82,
25,
28261,
351,
6723,
2389,
900,
8251,
290,
11241,
3815,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
264,
30255,
62,
2617,
62,
1462,
62,
83,
482,
641,
796,
4277,
11600,
7,
2617,
8,
198,
220,
220,
220,
11241,
62,
1462,
62,
824,
312,
62,
2617,
796,
23884,
198,
220,
220,
220,
329,
11241,
11,
33124,
287,
11241,
62,
1462,
62,
1676,
12636,
13,
23814,
33529,
628,
220,
220,
220,
220,
220,
220,
220,
264,
30255,
62,
2617,
796,
900,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
329,
12774,
287,
33124,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
12774,
14692,
824,
312,
8973,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
41032,
7025,
33124,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
30255,
62,
2617,
13,
2860,
7,
1676,
1350,
14692,
824,
312,
8973,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
824,
312,
62,
2617,
8,
1279,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
41032,
5621,
351,
38691,
414,
1342,
621,
1395,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2233,
284,
1029,
2494,
286,
3991,
38548,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
38279,
11241,
351,
597,
16326,
326,
2648,
262,
976,
6723,
2389,
900,
13,
198,
220,
220,
220,
220,
220,
220,
220,
264,
30255,
62,
2617,
62,
1462,
62,
83,
482,
641,
58,
69,
305,
8247,
316,
7,
824,
312,
62,
2617,
25295,
2860,
7,
30001,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
62,
1462,
62,
824,
312,
62,
2617,
58,
30001,
60,
796,
8400,
8247,
316,
7,
824,
312,
62,
2617,
8,
628,
220,
220,
220,
1303,
2986,
414,
2198,
25,
2195,
861,
326,
645,
11241,
468,
587,
14451,
517,
621,
1752,
13,
198,
220,
220,
220,
16326,
796,
685,
83,
329,
16326,
287,
1351,
7,
824,
312,
62,
2617,
62,
1462,
62,
83,
482,
641,
13,
27160,
28955,
329,
256,
287,
16326,
60,
198,
220,
220,
220,
6818,
7,
11925,
7,
83,
482,
641,
8,
6624,
18896,
7,
2617,
7,
83,
482,
641,
22305,
628,
220,
220,
220,
1441,
357,
824,
312,
62,
2617,
62,
1462,
62,
83,
482,
641,
11,
11241,
62,
1462,
62,
824,
312,
62,
2617,
8,
198,
198,
4299,
26571,
62,
565,
13654,
7,
565,
13654,
11,
11241,
62,
1462,
62,
1676,
12636,
2599,
198,
220,
220,
220,
37227,
7762,
20540,
262,
29409,
286,
257,
32966,
1586,
13,
198,
220,
220,
220,
1058,
17143,
23163,
25,
1052,
11629,
540,
286,
23163,
11,
810,
1123,
13946,
318,
257,
1351,
286,
16326,
13,
198,
220,
220,
220,
1058,
7783,
82,
25,
28261,
286,
13934,
1398,
7483,
2482,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
11241,
62,
1462,
62,
20285,
796,
1330,
62,
5589,
2790,
62,
17752,
7203,
600,
14,
30001,
62,
1462,
62,
20285,
13,
17752,
13,
34586,
4943,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
5765,
257,
13934,
40984,
198,
220,
220,
220,
2081,
62,
1930,
20288,
11,
3991,
62,
1930,
20288,
796,
657,
11,
657,
198,
220,
220,
220,
997,
62,
1659,
62,
565,
13654,
796,
657,
628,
220,
220,
220,
8352,
62,
1462,
62,
16514,
395,
9430,
796,
4277,
11600,
7,
4868,
8,
628,
220,
220,
220,
329,
13946,
287,
23163,
25,
628,
220,
220,
220,
220,
220,
220,
220,
997,
62,
1659,
62,
565,
13654,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
329,
5166,
287,
17790,
7,
565,
5819,
11,
374,
28,
17,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
62,
1462,
62,
20285,
58,
24874,
58,
15,
11907,
6624,
11241,
62,
1462,
62,
20285,
58,
24874,
58,
16,
60,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2081,
62,
1930,
20288,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8352,
796,
11241,
62,
1462,
62,
20285,
58,
24874,
58,
15,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
16,
62,
16514,
395,
9430,
796,
685,
22468,
7,
79,
14692,
16514,
27823,
8973,
8,
329,
279,
287,
11241,
62,
1462,
62,
1676,
12636,
58,
24874,
58,
15,
11907,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
17,
62,
16514,
395,
9430,
796,
685,
22468,
7,
79,
14692,
16514,
27823,
8973,
8,
329,
279,
287,
11241,
62,
1462,
62,
1676,
12636,
58,
24874,
58,
16,
11907,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8352,
62,
1462,
62,
16514,
395,
9430,
58,
20285,
60,
15853,
256,
16,
62,
16514,
395,
9430,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8352,
62,
1462,
62,
16514,
395,
9430,
58,
20285,
60,
15853,
256,
17,
62,
16514,
395,
9430,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3991,
62,
1930,
20288,
15853,
352,
628,
220,
220,
220,
3744,
62,
14813,
796,
657,
198,
220,
220,
220,
20428,
796,
17635,
198,
220,
220,
220,
329,
8352,
11,
4628,
395,
9430,
287,
8352,
62,
1462,
62,
16514,
395,
9430,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
4129,
796,
28805,
12514,
7,
43012,
28,
9806,
7,
16514,
395,
9430,
4008,
532,
28805,
12514,
7,
43012,
28,
1084,
7,
16514,
395,
9430,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4129,
1875,
28805,
12514,
7,
24425,
28,
1065,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3744,
62,
14813,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20428,
13,
33295,
7,
13664,
8,
628,
220,
220,
220,
1330,
7869,
198,
220,
220,
220,
3095,
796,
7869,
13,
1150,
666,
7,
13664,
82,
8,
628,
220,
220,
220,
1303,
7472,
1271,
286,
4938,
14729,
290,
12515,
14729,
423,
587,
198,
220,
220,
220,
1303,
662,
12,
785,
17128,
287,
4738,
786,
22906,
13,
9078,
2644,
198,
220,
220,
220,
1303,
1406,
356,
460,
3538,
15284,
262,
42510,
416,
34128,
278,
262,
38548,
13,
198,
220,
220,
220,
4036,
62,
24011,
418,
796,
1330,
62,
5589,
2790,
62,
17752,
7203,
600,
14,
12102,
62,
24011,
7352,
13,
17752,
13,
34586,
4943,
198,
220,
220,
220,
2081,
62,
12480,
2929,
796,
4036,
62,
24011,
418,
14692,
259,
12102,
62,
79,
3468,
8973,
532,
3991,
62,
1930,
20288,
198,
220,
220,
220,
3991,
62,
12480,
2929,
796,
4036,
62,
24011,
418,
14692,
12102,
62,
79,
3468,
8973,
532,
2081,
62,
1930,
20288,
628,
220,
220,
220,
1303,
2986,
414,
8794,
198,
220,
220,
220,
6818,
7,
7942,
62,
1930,
20288,
1343,
3991,
62,
1930,
20288,
1343,
220,
2081,
62,
12480,
2929,
1343,
3991,
62,
12480,
2929,
6624,
4036,
62,
24011,
418,
14692,
23350,
62,
79,
3468,
8973,
8,
198,
220,
220,
220,
6818,
7,
7942,
62,
1930,
20288,
1343,
3991,
62,
12480,
2929,
6624,
4036,
62,
24011,
418,
14692,
12102,
62,
79,
3468,
8973,
8,
198,
220,
220,
220,
6818,
7,
9562,
62,
1930,
20288,
1343,
2081,
62,
12480,
2929,
6624,
4036,
62,
24011,
418,
14692,
259,
12102,
62,
79,
3468,
8973,
8,
628,
220,
220,
220,
2081,
62,
24561,
62,
4873,
796,
357,
7942,
62,
1930,
20288,
1220,
357,
22468,
7,
7942,
62,
1930,
20288,
1343,
3991,
62,
12480,
2929,
22305,
198,
220,
220,
220,
3991,
62,
24561,
62,
4873,
796,
357,
9562,
62,
1930,
20288,
1220,
357,
22468,
7,
9562,
62,
1930,
20288,
1343,
2081,
62,
12480,
2929,
22305,
198,
220,
220,
220,
9922,
796,
357,
7942,
62,
1930,
20288,
1343,
2081,
62,
12480,
2929,
8,
1220,
12178,
7,
50039,
62,
24011,
418,
14692,
23350,
62,
79,
3468,
8973,
8,
628,
220,
220,
220,
1441,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
34788,
1298,
2081,
62,
1930,
20288,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
46428,
1298,
3991,
62,
1930,
20288,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
34106,
1298,
2081,
62,
12480,
2929,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
22184,
1298,
3991,
62,
12480,
2929,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
83,
1050,
1298,
2081,
62,
24561,
62,
4873,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
69,
1050,
1298,
3991,
62,
24561,
62,
4873,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
4134,
23843,
1298,
9922,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
565,
13654,
1298,
997,
62,
1659,
62,
565,
13654,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
76,
16436,
1298,
3744,
62,
14813,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1150,
666,
1298,
3095,
198,
220,
220,
220,
1782,
198
] | 2.458753 | 1,988 |
from django.contrib.auth import get_user_model
from django.test import TestCase
# Use the proper swappable User model
User = get_user_model()
| [
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
651,
62,
7220,
62,
19849,
198,
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
628,
198,
2,
5765,
262,
1774,
1509,
1324,
540,
11787,
2746,
198,
12982,
796,
651,
62,
7220,
62,
19849,
3419,
628
] | 3.295455 | 44 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Common utility functions for sql instances."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from apitools.base.py import list_pager
from googlecloudsdk.api_lib.sql import api_util
from googlecloudsdk.core import properties
from googlecloudsdk.core.console import console_io
_POSTGRES_DATABASE_VERSION_PREFIX = 'POSTGRES'
class _BaseInstances(object):
"""Common utility functions for sql instances."""
@staticmethod
def GetDatabaseInstances(limit=None, batch_size=None):
"""Gets SQL instances in a given project.
Modifies current state of an individual instance to 'STOPPED' if
activationPolicy is 'NEVER'.
Args:
limit: int, The maximum number of records to yield. None if all available
records should be yielded.
batch_size: int, The number of items to retrieve per request.
Returns:
List of yielded sql_messages.DatabaseInstance instances.
"""
client = api_util.SqlClient(api_util.API_VERSION_DEFAULT)
sql_client = client.sql_client
sql_messages = client.sql_messages
project_id = properties.VALUES.core.project.Get(required=True)
params = {}
if limit is not None:
params['limit'] = limit
if batch_size is not None:
params['batch_size'] = batch_size
yielded = list_pager.YieldFromList(
sql_client.instances,
sql_messages.SqlInstancesListRequest(project=project_id), **params)
return YieldInstancesWithAModifiedState()
@staticmethod
@staticmethod
def IsPostgresDatabaseVersion(database_version):
"""Returns a boolean indicating if the database version is Postgres."""
return _POSTGRES_DATABASE_VERSION_PREFIX in database_version
class InstancesV1Beta3(_BaseInstances):
"""Common utility functions for sql instances V1Beta3."""
@staticmethod
@staticmethod
class InstancesV1Beta4(_BaseInstances):
"""Common utility functions for sql instances V1Beta4."""
@staticmethod
@staticmethod
| [
2,
15069,
1584,
3012,
3457,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
37811,
17227,
10361,
5499,
329,
44161,
10245,
526,
15931,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
6738,
2471,
270,
10141,
13,
8692,
13,
9078,
1330,
1351,
62,
79,
3536,
198,
6738,
23645,
17721,
21282,
74,
13,
15042,
62,
8019,
13,
25410,
1330,
40391,
62,
22602,
198,
6738,
23645,
17721,
21282,
74,
13,
7295,
1330,
6608,
198,
6738,
23645,
17721,
21282,
74,
13,
7295,
13,
41947,
1330,
8624,
62,
952,
628,
198,
62,
32782,
10761,
1546,
62,
35,
1404,
6242,
11159,
62,
43717,
62,
47,
31688,
10426,
796,
705,
32782,
10761,
1546,
6,
628,
198,
4871,
4808,
14881,
6310,
1817,
7,
15252,
2599,
198,
220,
37227,
17227,
10361,
5499,
329,
44161,
10245,
526,
15931,
628,
220,
2488,
12708,
24396,
198,
220,
825,
3497,
38105,
6310,
1817,
7,
32374,
28,
14202,
11,
15458,
62,
7857,
28,
14202,
2599,
198,
220,
220,
220,
37227,
38,
1039,
16363,
10245,
287,
257,
1813,
1628,
13,
628,
220,
220,
220,
3401,
6945,
1459,
1181,
286,
281,
1981,
4554,
284,
705,
2257,
3185,
47,
1961,
6,
611,
198,
220,
220,
220,
14916,
36727,
318,
705,
12161,
5959,
4458,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
4179,
25,
493,
11,
383,
5415,
1271,
286,
4406,
284,
7800,
13,
6045,
611,
477,
1695,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4406,
815,
307,
26403,
13,
198,
220,
220,
220,
220,
220,
15458,
62,
7857,
25,
493,
11,
383,
1271,
286,
3709,
284,
19818,
583,
2581,
13,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
7343,
286,
26403,
44161,
62,
37348,
1095,
13,
38105,
33384,
10245,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
5456,
796,
40391,
62,
22602,
13,
50,
13976,
11792,
7,
15042,
62,
22602,
13,
17614,
62,
43717,
62,
7206,
38865,
8,
198,
220,
220,
220,
44161,
62,
16366,
796,
5456,
13,
25410,
62,
16366,
198,
220,
220,
220,
44161,
62,
37348,
1095,
796,
5456,
13,
25410,
62,
37348,
1095,
198,
220,
220,
220,
1628,
62,
312,
796,
6608,
13,
23428,
35409,
13,
7295,
13,
16302,
13,
3855,
7,
35827,
28,
17821,
8,
628,
220,
220,
220,
42287,
796,
23884,
198,
220,
220,
220,
611,
4179,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
42287,
17816,
32374,
20520,
796,
4179,
198,
220,
220,
220,
611,
15458,
62,
7857,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
42287,
17816,
43501,
62,
7857,
20520,
796,
15458,
62,
7857,
628,
220,
220,
220,
26403,
796,
1351,
62,
79,
3536,
13,
56,
1164,
4863,
8053,
7,
198,
220,
220,
220,
220,
220,
220,
220,
44161,
62,
16366,
13,
8625,
1817,
11,
198,
220,
220,
220,
220,
220,
220,
220,
44161,
62,
37348,
1095,
13,
50,
13976,
6310,
1817,
8053,
18453,
7,
16302,
28,
16302,
62,
312,
828,
12429,
37266,
8,
628,
220,
220,
220,
1441,
575,
1164,
6310,
1817,
3152,
2390,
375,
1431,
9012,
3419,
628,
220,
2488,
12708,
24396,
628,
220,
2488,
12708,
24396,
198,
220,
825,
1148,
6307,
34239,
38105,
14815,
7,
48806,
62,
9641,
2599,
198,
220,
220,
220,
37227,
35561,
257,
25131,
12739,
611,
262,
6831,
2196,
318,
2947,
34239,
526,
15931,
198,
220,
220,
220,
1441,
4808,
32782,
10761,
1546,
62,
35,
1404,
6242,
11159,
62,
43717,
62,
47,
31688,
10426,
287,
6831,
62,
9641,
628,
198,
4871,
2262,
1817,
53,
16,
43303,
18,
28264,
14881,
6310,
1817,
2599,
198,
220,
37227,
17227,
10361,
5499,
329,
44161,
10245,
569,
16,
43303,
18,
526,
15931,
628,
220,
2488,
12708,
24396,
628,
220,
2488,
12708,
24396,
628,
198,
4871,
2262,
1817,
53,
16,
43303,
19,
28264,
14881,
6310,
1817,
2599,
198,
220,
37227,
17227,
10361,
5499,
329,
44161,
10245,
569,
16,
43303,
19,
526,
15931,
628,
220,
2488,
12708,
24396,
628,
220,
2488,
12708,
24396,
198
] | 3.271589 | 799 |
#-*- coding: utf-8 -*-
""" EOSS catalog system
Custom logger
Default configuration file within this directory is used to control logging behaviour; can be overwritten with LOGGING_CONF which points to
local logging configuration
"""
__author__ = "Thilo Wehrmann, Steffen Gebhardt"
__copyright__ = "Copyright 2016, EOSS GmbH"
__credits__ = ["Thilo Wehrmann", "Steffen Gebhardt"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Thilo Wehrmann"
__email__ = "twehrmann@eoss.cloud"
__status__ = "Production"
import logging
from logging.config import fileConfig
import os
from utilities import read_OS_var
try: # Python 2.7+
from logging import NullHandler
except ImportError:
if read_OS_var('LOGGING_CONF', mandatory=False) == None:
path = os.path.dirname(__file__)
log_config_file = os.path.join(path, 'logging.ini')
else:
log_config_file = read_OS_var('LOGGING_CONF', mandatory=False)
fileConfig(log_config_file)
logger = logging.getLogger()
logger.addHandler(NullHandler())
logging.getLogger(__name__).addHandler(NullHandler())
# Configure default logger to do nothing
notificator = logging.getLogger('EOSS:notification')
heartbeat_log = logging.getLogger('EOSS:heartbeat')
tracer_log = logging.getLogger('EOSS:tracer')
CALL = 41
START = 42
BEATING = 43
STOP = 44
STROKE = 45
HEALTH = 46
logging.addLevelName(CALL, 'CALL')
logging.addLevelName(BEATING, 'BEATING')
logging.addLevelName(BEATING, 'BEATING')
logging.addLevelName(STROKE, 'STROKE')
logging.addLevelName(HEALTH, 'HEALTH')
logging.addLevelName(START, 'START BEAT')
logging.addLevelName(STOP, 'STOP BEAT')
# 3rd party logger configuration
logging.getLogger('boto3.resources.action').setLevel(logging.WARNING)
logging.getLogger('botocore.vendored.requests.packages.urllib3.connectionpool').setLevel(logging.WARNING)
| [
2,
12,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
412,
18420,
18388,
1080,
198,
8562,
49706,
198,
15161,
8398,
2393,
1626,
428,
8619,
318,
973,
284,
1630,
18931,
9172,
26,
460,
307,
6993,
9108,
351,
41605,
38,
2751,
62,
10943,
37,
543,
2173,
284,
198,
1957,
18931,
8398,
198,
37811,
198,
198,
834,
9800,
834,
796,
366,
817,
18526,
775,
11840,
9038,
11,
2441,
46985,
402,
1765,
28375,
1,
198,
834,
22163,
4766,
834,
796,
366,
15269,
1584,
11,
412,
18420,
402,
2022,
39,
1,
198,
834,
66,
20696,
834,
796,
14631,
817,
18526,
775,
11840,
9038,
1600,
366,
7447,
46985,
402,
1765,
28375,
8973,
198,
834,
43085,
834,
796,
366,
38,
6489,
1,
198,
834,
9641,
834,
796,
366,
16,
13,
15,
13,
15,
1,
198,
834,
76,
2913,
10613,
834,
796,
366,
817,
18526,
775,
11840,
9038,
1,
198,
834,
12888,
834,
796,
366,
83,
732,
11840,
9038,
31,
68,
793,
13,
17721,
1,
198,
834,
13376,
834,
796,
366,
35027,
1,
198,
198,
11748,
18931,
198,
6738,
18931,
13,
11250,
1330,
2393,
16934,
198,
11748,
28686,
198,
6738,
20081,
1330,
1100,
62,
2640,
62,
7785,
628,
198,
28311,
25,
220,
1303,
11361,
362,
13,
22,
10,
198,
220,
220,
220,
422,
18931,
1330,
35886,
25060,
198,
16341,
17267,
12331,
25,
628,
198,
361,
1100,
62,
2640,
62,
7785,
10786,
25294,
38,
2751,
62,
10943,
37,
3256,
13677,
28,
25101,
8,
6624,
6045,
25,
198,
220,
220,
220,
3108,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
8,
198,
220,
220,
220,
2604,
62,
11250,
62,
7753,
796,
28686,
13,
6978,
13,
22179,
7,
6978,
11,
705,
6404,
2667,
13,
5362,
11537,
198,
17772,
25,
198,
220,
220,
220,
2604,
62,
11250,
62,
7753,
796,
1100,
62,
2640,
62,
7785,
10786,
25294,
38,
2751,
62,
10943,
37,
3256,
13677,
28,
25101,
8,
198,
198,
7753,
16934,
7,
6404,
62,
11250,
62,
7753,
8,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
3419,
198,
6404,
1362,
13,
2860,
25060,
7,
35067,
25060,
28955,
198,
6404,
2667,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
737,
2860,
25060,
7,
35067,
25060,
28955,
198,
198,
2,
17056,
495,
4277,
49706,
284,
466,
2147,
198,
1662,
811,
1352,
796,
18931,
13,
1136,
11187,
1362,
10786,
36,
18420,
25,
1662,
2649,
11537,
198,
11499,
12945,
62,
6404,
796,
18931,
13,
1136,
11187,
1362,
10786,
36,
18420,
25,
11499,
12945,
11537,
198,
2213,
11736,
62,
6404,
796,
18931,
13,
1136,
11187,
1362,
10786,
36,
18420,
25,
2213,
11736,
11537,
198,
198,
34,
7036,
796,
6073,
198,
2257,
7227,
796,
5433,
198,
12473,
33881,
796,
5946,
198,
2257,
3185,
796,
5846,
198,
2257,
13252,
7336,
796,
4153,
198,
13909,
40818,
796,
6337,
198,
198,
6404,
2667,
13,
2860,
4971,
5376,
7,
34,
7036,
11,
705,
34,
7036,
11537,
198,
6404,
2667,
13,
2860,
4971,
5376,
7,
12473,
33881,
11,
705,
12473,
33881,
11537,
198,
6404,
2667,
13,
2860,
4971,
5376,
7,
12473,
33881,
11,
705,
12473,
33881,
11537,
198,
6404,
2667,
13,
2860,
4971,
5376,
7,
2257,
13252,
7336,
11,
705,
2257,
13252,
7336,
11537,
198,
6404,
2667,
13,
2860,
4971,
5376,
7,
13909,
40818,
11,
705,
13909,
40818,
11537,
198,
198,
6404,
2667,
13,
2860,
4971,
5376,
7,
2257,
7227,
11,
705,
2257,
7227,
9348,
1404,
11537,
198,
6404,
2667,
13,
2860,
4971,
5376,
7,
2257,
3185,
11,
705,
2257,
3185,
9348,
1404,
11537,
628,
628,
198,
2,
513,
4372,
2151,
49706,
8398,
198,
6404,
2667,
13,
1136,
11187,
1362,
10786,
65,
2069,
18,
13,
37540,
13,
2673,
27691,
2617,
4971,
7,
6404,
2667,
13,
31502,
8,
198,
6404,
2667,
13,
1136,
11187,
1362,
10786,
13645,
420,
382,
13,
85,
437,
1850,
13,
8897,
3558,
13,
43789,
13,
333,
297,
571,
18,
13,
38659,
7742,
27691,
2617,
4971,
7,
6404,
2667,
13,
31502,
8,
628,
628
] | 2.835148 | 643 |
# Copyright 2019 the ProGraML authors.
#
# Contact Chris Cummins <chrisc.101@gmail.com>.
#
# 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.
"""This file contains TODO: one line summary.
TODO: Detailed explanation of the file.
"""
from typing import Any
from typing import Iterable
from typing import List
from typing import NamedTuple
from typing import Optional
import numpy as np
import sklearn.metrics
from labm8.py import app
FLAGS = app.FLAGS
app.DEFINE_string(
"batch_scores_averaging_method",
"weighted",
"Selects the averaging method to use when computing recall/precision/F1 "
"scores. See <https://scikit-learn.org/stable/modules/generated/sklearn"
".metrics.f1_score.html>",
)
class Data(NamedTuple):
"""The model data for a batch."""
graph_ids: List[int]
data: Any
# A flag used to mark that this batch is the end of an iterable sequences of
# batches.
end_of_batches: bool = False
@property
def EmptyBatch() -> Data:
"""Construct an empty batch."""
return Data(graph_ids=[], data=None)
def EndOfBatches() -> Data:
"""Construct a 'end of batches' marker."""
return Data(graph_ids=[], data=None, end_of_batches=True)
class BatchIterator(NamedTuple):
"""A batch iterator"""
batches: Iterable[Data]
# The total number of graphs in all of the batches.
graph_count: int
class Results(NamedTuple):
"""The results of running a batch through a model.
Don't instantiate this tuple directly, use Results.Create().
"""
targets: np.array
predictions: np.array
# The number of model iterations to compute the final results. This is used
# by iterative models such as message passing networks.
iteration_count: int
# For iterative models, this indicates whether the state of the model at
# iteration_count had converged on a solution.
model_converged: bool
# The learning rate and loss of models, if applicable.
learning_rate: Optional[float]
loss: Optional[float]
# Batch-level average performance metrics.
accuracy: float
precision: float
recall: float
f1: float
@property
@property
@property
def target_count(self) -> int:
"""Get the number of targets in the batch.
For graph-level classifiers, this will be equal to Data.graph_count, else
it's equal to the batch node count.
"""
return self.targets.shape[1]
def __eq__(self, rhs: "Results"):
"""Compare batch results."""
return self.accuracy == rhs.accuracy
def __gt__(self, rhs: "Results"):
"""Compare batch results."""
return self.accuracy > rhs.accuracy
@classmethod
def Create(
cls,
targets: np.array,
predictions: np.array,
iteration_count: int = 1,
model_converged: bool = True,
learning_rate: Optional[float] = None,
loss: Optional[float] = None,
):
"""Construct a results instance from 1-hot targets and predictions.
This is the preferred means of construct a Results instance, which takes
care of evaluating all of the metrics for you. The behavior of metrics
calculation is dependent on the --batch_scores_averaging_method flag.
Args:
targets: An array of 1-hot target vectors with
shape (y_count, y_dimensionality), dtype int32.
predictions: An array of 1-hot prediction vectors with
shape (y_count, y_dimensionality), dtype int32.
iteration_count: For iterative models, the number of model iterations to
compute the final result.
model_converged: For iterative models, whether model converged.
learning_rate: The model learning rate, if applicable.
loss: The model loss, if applicable.
Returns:
A Results instance.
"""
if targets.shape != predictions.shape:
raise TypeError(
f"Expected model to produce targets with shape {targets.shape} but "
f"instead received predictions with shape {predictions.shape}"
)
y_dimensionality = targets.shape[1]
if y_dimensionality < 2:
raise TypeError(
f"Expected label dimensionality > 1, received {y_dimensionality}"
)
# Create dense arrays of shape (target_count).
true_y = np.argmax(targets, axis=1)
pred_y = np.argmax(predictions, axis=1)
# NOTE(github.com/ChrisCummins/ProGraML/issues/22): This assumes that
# labels use the values [0,...n).
labels = np.arange(y_dimensionality, dtype=np.int64)
return cls(
targets=targets,
predictions=predictions,
iteration_count=iteration_count,
model_converged=model_converged,
learning_rate=learning_rate,
loss=loss,
accuracy=sklearn.metrics.accuracy_score(true_y, pred_y),
precision=sklearn.metrics.precision_score(
true_y,
pred_y,
labels=labels,
average=FLAGS.batch_scores_averaging_method,
),
recall=sklearn.metrics.recall_score(
true_y,
pred_y,
labels=labels,
average=FLAGS.batch_scores_averaging_method,
),
f1=sklearn.metrics.f1_score(
true_y,
pred_y,
labels=labels,
average=FLAGS.batch_scores_averaging_method,
),
)
class RollingResults:
"""Maintain weighted rolling averages across batches."""
def Update(
self, data: Data, results: Results, weight: Optional[float] = None
) -> None:
"""Update the rolling results with a new batch.
Args:
data: The batch data used to produce the results.
results: The batch results to update the current state with.
weight: A weight to assign to weighted sums. E.g. to weight results
across all targets, use weight=results.target_count. To weight across
targets, use weight=batch.target_count. To weight across
graphs, use weight=batch.graph_count. By default, weight by target
count.
"""
if weight is None:
weight = results.target_count
self.weight_sum += weight
self.batch_count += 1
self.graph_count += data.graph_count
self.target_count += results.target_count
self.weighted_iteration_count_sum += results.iteration_count * weight
self.weighted_model_converged_sum += (
weight if results.model_converged else 0
)
if results.has_learning_rate:
self.has_learning_rate = True
self.weighted_learning_rate_sum += results.learning_rate * weight
if results.has_loss:
self.has_loss = True
self.weighted_loss_sum += results.loss * weight
self.weighted_accuracy_sum += results.accuracy * weight
self.weighted_precision_sum += results.precision * weight
self.weighted_recall_sum += results.recall * weight
self.weighted_f1_sum += results.f1 * weight
@property
@property
@property
@property
@property
@property
@property
@property
| [
2,
15069,
13130,
262,
1041,
46971,
5805,
7035,
13,
198,
2,
198,
2,
14039,
5180,
30316,
1040,
1279,
354,
81,
2304,
13,
8784,
31,
14816,
13,
785,
28401,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
37811,
1212,
2393,
4909,
16926,
46,
25,
530,
1627,
10638,
13,
198,
198,
51,
3727,
46,
25,
4614,
6255,
7468,
286,
262,
2393,
13,
198,
37811,
198,
6738,
19720,
1330,
4377,
198,
6738,
19720,
1330,
40806,
540,
198,
6738,
19720,
1330,
7343,
198,
6738,
19720,
1330,
34441,
51,
29291,
198,
6738,
19720,
1330,
32233,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
1341,
35720,
13,
4164,
10466,
198,
198,
6738,
2248,
76,
23,
13,
9078,
1330,
598,
628,
198,
38948,
50,
796,
598,
13,
38948,
50,
198,
198,
1324,
13,
7206,
29940,
62,
8841,
7,
198,
220,
366,
43501,
62,
1416,
2850,
62,
8770,
3039,
62,
24396,
1600,
198,
220,
366,
6551,
276,
1600,
198,
220,
366,
17563,
82,
262,
20430,
2446,
284,
779,
618,
14492,
10014,
14,
3866,
16005,
14,
37,
16,
366,
198,
220,
366,
1416,
2850,
13,
4091,
1279,
5450,
1378,
36216,
15813,
12,
35720,
13,
2398,
14,
31284,
14,
18170,
14,
27568,
14,
8135,
35720,
1,
198,
220,
27071,
4164,
10466,
13,
69,
16,
62,
26675,
13,
6494,
29,
1600,
198,
8,
628,
198,
4871,
6060,
7,
45,
2434,
51,
29291,
2599,
198,
220,
37227,
464,
2746,
1366,
329,
257,
15458,
526,
15931,
628,
220,
4823,
62,
2340,
25,
7343,
58,
600,
60,
198,
220,
1366,
25,
4377,
198,
220,
1303,
317,
6056,
973,
284,
1317,
326,
428,
15458,
318,
262,
886,
286,
281,
11629,
540,
16311,
286,
198,
220,
1303,
37830,
13,
198,
220,
886,
62,
1659,
62,
8664,
2052,
25,
20512,
796,
10352,
628,
220,
2488,
26745,
628,
198,
4299,
33523,
33,
963,
3419,
4613,
6060,
25,
198,
220,
37227,
42316,
281,
6565,
15458,
526,
15931,
198,
220,
1441,
6060,
7,
34960,
62,
2340,
41888,
4357,
1366,
28,
14202,
8,
628,
198,
4299,
5268,
5189,
33,
20981,
3419,
4613,
6060,
25,
198,
220,
37227,
42316,
257,
705,
437,
286,
37830,
6,
18364,
526,
15931,
198,
220,
1441,
6060,
7,
34960,
62,
2340,
41888,
4357,
1366,
28,
14202,
11,
886,
62,
1659,
62,
8664,
2052,
28,
17821,
8,
628,
198,
4871,
347,
963,
37787,
7,
45,
2434,
51,
29291,
2599,
198,
220,
37227,
32,
15458,
41313,
37811,
628,
220,
37830,
25,
40806,
540,
58,
6601,
60,
198,
220,
1303,
383,
2472,
1271,
286,
28770,
287,
477,
286,
262,
37830,
13,
198,
220,
4823,
62,
9127,
25,
493,
628,
198,
4871,
15691,
7,
45,
2434,
51,
29291,
2599,
198,
220,
37227,
464,
2482,
286,
2491,
257,
15458,
832,
257,
2746,
13,
628,
220,
2094,
470,
9113,
9386,
428,
46545,
3264,
11,
779,
15691,
13,
16447,
22446,
198,
220,
37227,
628,
220,
6670,
25,
45941,
13,
18747,
198,
220,
16277,
25,
45941,
13,
18747,
198,
220,
1303,
383,
1271,
286,
2746,
34820,
284,
24061,
262,
2457,
2482,
13,
770,
318,
973,
198,
220,
1303,
416,
11629,
876,
4981,
884,
355,
3275,
6427,
7686,
13,
198,
220,
24415,
62,
9127,
25,
493,
198,
220,
1303,
1114,
11629,
876,
4981,
11,
428,
9217,
1771,
262,
1181,
286,
262,
2746,
379,
198,
220,
1303,
24415,
62,
9127,
550,
6718,
2004,
319,
257,
4610,
13,
198,
220,
2746,
62,
1102,
332,
2004,
25,
20512,
198,
220,
1303,
383,
4673,
2494,
290,
2994,
286,
4981,
11,
611,
9723,
13,
198,
220,
4673,
62,
4873,
25,
32233,
58,
22468,
60,
198,
220,
2994,
25,
32233,
58,
22468,
60,
198,
220,
1303,
347,
963,
12,
5715,
2811,
2854,
20731,
13,
198,
220,
9922,
25,
12178,
198,
220,
15440,
25,
12178,
198,
220,
10014,
25,
12178,
198,
220,
277,
16,
25,
12178,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
198,
220,
825,
2496,
62,
9127,
7,
944,
8,
4613,
493,
25,
198,
220,
220,
220,
37227,
3855,
262,
1271,
286,
6670,
287,
262,
15458,
13,
628,
220,
220,
220,
1114,
4823,
12,
5715,
1398,
13350,
11,
428,
481,
307,
4961,
284,
6060,
13,
34960,
62,
9127,
11,
2073,
198,
220,
220,
220,
340,
338,
4961,
284,
262,
15458,
10139,
954,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
2116,
13,
83,
853,
1039,
13,
43358,
58,
16,
60,
628,
220,
825,
11593,
27363,
834,
7,
944,
11,
9529,
82,
25,
366,
25468,
1,
2599,
198,
220,
220,
220,
37227,
41488,
15458,
2482,
526,
15931,
198,
220,
220,
220,
1441,
2116,
13,
4134,
23843,
6624,
9529,
82,
13,
4134,
23843,
628,
220,
825,
11593,
13655,
834,
7,
944,
11,
9529,
82,
25,
366,
25468,
1,
2599,
198,
220,
220,
220,
37227,
41488,
15458,
2482,
526,
15931,
198,
220,
220,
220,
1441,
2116,
13,
4134,
23843,
1875,
9529,
82,
13,
4134,
23843,
628,
220,
2488,
4871,
24396,
198,
220,
825,
13610,
7,
198,
220,
220,
220,
537,
82,
11,
198,
220,
220,
220,
6670,
25,
45941,
13,
18747,
11,
198,
220,
220,
220,
16277,
25,
45941,
13,
18747,
11,
198,
220,
220,
220,
24415,
62,
9127,
25,
493,
796,
352,
11,
198,
220,
220,
220,
2746,
62,
1102,
332,
2004,
25,
20512,
796,
6407,
11,
198,
220,
220,
220,
4673,
62,
4873,
25,
32233,
58,
22468,
60,
796,
6045,
11,
198,
220,
220,
220,
2994,
25,
32233,
58,
22468,
60,
796,
6045,
11,
198,
220,
15179,
198,
220,
220,
220,
37227,
42316,
257,
2482,
4554,
422,
352,
12,
8940,
6670,
290,
16277,
13,
628,
220,
220,
220,
770,
318,
262,
9871,
1724,
286,
5678,
257,
15691,
4554,
11,
543,
2753,
198,
220,
220,
220,
1337,
286,
22232,
477,
286,
262,
20731,
329,
345,
13,
383,
4069,
286,
20731,
198,
220,
220,
220,
17952,
318,
10795,
319,
262,
1377,
43501,
62,
1416,
2850,
62,
8770,
3039,
62,
24396,
6056,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
6670,
25,
1052,
7177,
286,
352,
12,
8940,
2496,
30104,
351,
198,
220,
220,
220,
220,
220,
220,
220,
5485,
357,
88,
62,
9127,
11,
331,
62,
46156,
1483,
828,
288,
4906,
493,
2624,
13,
198,
220,
220,
220,
220,
220,
16277,
25,
1052,
7177,
286,
352,
12,
8940,
17724,
30104,
351,
198,
220,
220,
220,
220,
220,
220,
220,
5485,
357,
88,
62,
9127,
11,
331,
62,
46156,
1483,
828,
288,
4906,
493,
2624,
13,
198,
220,
220,
220,
220,
220,
24415,
62,
9127,
25,
1114,
11629,
876,
4981,
11,
262,
1271,
286,
2746,
34820,
284,
198,
220,
220,
220,
220,
220,
220,
220,
24061,
262,
2457,
1255,
13,
198,
220,
220,
220,
220,
220,
2746,
62,
1102,
332,
2004,
25,
1114,
11629,
876,
4981,
11,
1771,
2746,
6718,
2004,
13,
198,
220,
220,
220,
220,
220,
4673,
62,
4873,
25,
383,
2746,
4673,
2494,
11,
611,
9723,
13,
198,
220,
220,
220,
220,
220,
2994,
25,
383,
2746,
2994,
11,
611,
9723,
13,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
317,
15691,
4554,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
6670,
13,
43358,
14512,
16277,
13,
43358,
25,
198,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
277,
1,
3109,
7254,
2746,
284,
4439,
6670,
351,
5485,
1391,
83,
853,
1039,
13,
43358,
92,
475,
366,
198,
220,
220,
220,
220,
220,
220,
220,
277,
1,
38070,
2722,
16277,
351,
5485,
1391,
28764,
9278,
13,
43358,
36786,
198,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
331,
62,
46156,
1483,
796,
6670,
13,
43358,
58,
16,
60,
198,
220,
220,
220,
611,
331,
62,
46156,
1483,
1279,
362,
25,
198,
220,
220,
220,
220,
220,
5298,
5994,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
277,
1,
3109,
7254,
6167,
15793,
1483,
1875,
352,
11,
2722,
1391,
88,
62,
46156,
1483,
36786,
198,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
1303,
13610,
15715,
26515,
286,
5485,
357,
16793,
62,
9127,
737,
198,
220,
220,
220,
2081,
62,
88,
796,
45941,
13,
853,
9806,
7,
83,
853,
1039,
11,
16488,
28,
16,
8,
198,
220,
220,
220,
2747,
62,
88,
796,
45941,
13,
853,
9806,
7,
28764,
9278,
11,
16488,
28,
16,
8,
628,
220,
220,
220,
1303,
24550,
7,
12567,
13,
785,
14,
15645,
34,
13929,
1040,
14,
2964,
46971,
5805,
14,
37165,
14,
1828,
2599,
770,
18533,
326,
198,
220,
220,
220,
1303,
14722,
779,
262,
3815,
685,
15,
42303,
77,
737,
198,
220,
220,
220,
14722,
796,
45941,
13,
283,
858,
7,
88,
62,
46156,
1483,
11,
288,
4906,
28,
37659,
13,
600,
2414,
8,
628,
220,
220,
220,
1441,
537,
82,
7,
198,
220,
220,
220,
220,
220,
6670,
28,
83,
853,
1039,
11,
198,
220,
220,
220,
220,
220,
16277,
28,
28764,
9278,
11,
198,
220,
220,
220,
220,
220,
24415,
62,
9127,
28,
2676,
341,
62,
9127,
11,
198,
220,
220,
220,
220,
220,
2746,
62,
1102,
332,
2004,
28,
19849,
62,
1102,
332,
2004,
11,
198,
220,
220,
220,
220,
220,
4673,
62,
4873,
28,
40684,
62,
4873,
11,
198,
220,
220,
220,
220,
220,
2994,
28,
22462,
11,
198,
220,
220,
220,
220,
220,
9922,
28,
8135,
35720,
13,
4164,
10466,
13,
4134,
23843,
62,
26675,
7,
7942,
62,
88,
11,
2747,
62,
88,
828,
198,
220,
220,
220,
220,
220,
15440,
28,
8135,
35720,
13,
4164,
10466,
13,
3866,
16005,
62,
26675,
7,
198,
220,
220,
220,
220,
220,
220,
220,
2081,
62,
88,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
62,
88,
11,
198,
220,
220,
220,
220,
220,
220,
220,
14722,
28,
23912,
1424,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2811,
28,
38948,
50,
13,
43501,
62,
1416,
2850,
62,
8770,
3039,
62,
24396,
11,
198,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
10014,
28,
8135,
35720,
13,
4164,
10466,
13,
8344,
439,
62,
26675,
7,
198,
220,
220,
220,
220,
220,
220,
220,
2081,
62,
88,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
62,
88,
11,
198,
220,
220,
220,
220,
220,
220,
220,
14722,
28,
23912,
1424,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2811,
28,
38948,
50,
13,
43501,
62,
1416,
2850,
62,
8770,
3039,
62,
24396,
11,
198,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
277,
16,
28,
8135,
35720,
13,
4164,
10466,
13,
69,
16,
62,
26675,
7,
198,
220,
220,
220,
220,
220,
220,
220,
2081,
62,
88,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
62,
88,
11,
198,
220,
220,
220,
220,
220,
220,
220,
14722,
28,
23912,
1424,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2811,
28,
38948,
50,
13,
43501,
62,
1416,
2850,
62,
8770,
3039,
62,
24396,
11,
198,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
628,
198,
4871,
21567,
25468,
25,
198,
220,
37227,
44,
32725,
26356,
10708,
25694,
1973,
37830,
526,
15931,
628,
220,
825,
10133,
7,
198,
220,
220,
220,
2116,
11,
1366,
25,
6060,
11,
2482,
25,
15691,
11,
3463,
25,
32233,
58,
22468,
60,
796,
6045,
198,
220,
1267,
4613,
6045,
25,
198,
220,
220,
220,
37227,
10260,
262,
10708,
2482,
351,
257,
649,
15458,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
1366,
25,
383,
15458,
1366,
973,
284,
4439,
262,
2482,
13,
198,
220,
220,
220,
220,
220,
2482,
25,
383,
15458,
2482,
284,
4296,
262,
1459,
1181,
351,
13,
198,
220,
220,
220,
220,
220,
3463,
25,
317,
3463,
284,
8333,
284,
26356,
21784,
13,
412,
13,
70,
13,
284,
3463,
2482,
198,
220,
220,
220,
220,
220,
220,
220,
1973,
477,
6670,
11,
779,
3463,
28,
43420,
13,
16793,
62,
9127,
13,
1675,
3463,
1973,
198,
220,
220,
220,
220,
220,
220,
220,
6670,
11,
779,
3463,
28,
43501,
13,
16793,
62,
9127,
13,
1675,
3463,
1973,
198,
220,
220,
220,
220,
220,
220,
220,
28770,
11,
779,
3463,
28,
43501,
13,
34960,
62,
9127,
13,
2750,
4277,
11,
3463,
416,
2496,
198,
220,
220,
220,
220,
220,
220,
220,
954,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
3463,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
3463,
796,
2482,
13,
16793,
62,
9127,
628,
220,
220,
220,
2116,
13,
6551,
62,
16345,
15853,
3463,
198,
220,
220,
220,
2116,
13,
43501,
62,
9127,
15853,
352,
198,
220,
220,
220,
2116,
13,
34960,
62,
9127,
15853,
1366,
13,
34960,
62,
9127,
198,
220,
220,
220,
2116,
13,
16793,
62,
9127,
15853,
2482,
13,
16793,
62,
9127,
198,
220,
220,
220,
2116,
13,
6551,
276,
62,
2676,
341,
62,
9127,
62,
16345,
15853,
2482,
13,
2676,
341,
62,
9127,
1635,
3463,
198,
220,
220,
220,
2116,
13,
6551,
276,
62,
19849,
62,
1102,
332,
2004,
62,
16345,
15853,
357,
198,
220,
220,
220,
220,
220,
3463,
611,
2482,
13,
19849,
62,
1102,
332,
2004,
2073,
657,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
611,
2482,
13,
10134,
62,
40684,
62,
4873,
25,
198,
220,
220,
220,
220,
220,
2116,
13,
10134,
62,
40684,
62,
4873,
796,
6407,
198,
220,
220,
220,
220,
220,
2116,
13,
6551,
276,
62,
40684,
62,
4873,
62,
16345,
15853,
2482,
13,
40684,
62,
4873,
1635,
3463,
198,
220,
220,
220,
611,
2482,
13,
10134,
62,
22462,
25,
198,
220,
220,
220,
220,
220,
2116,
13,
10134,
62,
22462,
796,
6407,
198,
220,
220,
220,
220,
220,
2116,
13,
6551,
276,
62,
22462,
62,
16345,
15853,
2482,
13,
22462,
1635,
3463,
198,
220,
220,
220,
2116,
13,
6551,
276,
62,
4134,
23843,
62,
16345,
15853,
2482,
13,
4134,
23843,
1635,
3463,
198,
220,
220,
220,
2116,
13,
6551,
276,
62,
3866,
16005,
62,
16345,
15853,
2482,
13,
3866,
16005,
1635,
3463,
198,
220,
220,
220,
2116,
13,
6551,
276,
62,
8344,
439,
62,
16345,
15853,
2482,
13,
8344,
439,
1635,
3463,
198,
220,
220,
220,
2116,
13,
6551,
276,
62,
69,
16,
62,
16345,
15853,
2482,
13,
69,
16,
1635,
3463,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
628,
220,
2488,
26745,
198
] | 2.8988 | 2,500 |
# A module inside the package
print("Module: ", __name__)
| [
2,
317,
8265,
2641,
262,
5301,
198,
198,
4798,
7203,
26796,
25,
33172,
11593,
3672,
834,
8,
628
] | 3.333333 | 18 |
"""
https://leetcode.com/problems/divisor-game/
Alice and Bob take turns playing a game, with Alice starting first.
Initially, there is a number N on the chalkboard. On each player's turn, that player makes a move consisting of:
Choosing any x with 0 < x < N and N % x == 0.
Replacing the number N on the chalkboard with N - x.
Also, if a player cannot make a move, they lose the game.
Return True if and only if Alice wins the game, assuming both players play optimally.
Example 1:
Input: 2
Output: true
Explanation: Alice chooses 1, and Bob has no more moves.
Example 2:
Input: 3
Output: false
Explanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves.
Note:
1 <= N <= 1000
"""
# time complexity: O(nlogn), space complexity: O(n) | [
37811,
198,
5450,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
7146,
271,
273,
12,
6057,
14,
198,
44484,
290,
5811,
1011,
4962,
2712,
257,
983,
11,
351,
14862,
3599,
717,
13,
198,
198,
40443,
11,
612,
318,
257,
1271,
399,
319,
262,
30860,
3526,
13,
220,
1550,
1123,
2137,
338,
1210,
11,
326,
2137,
1838,
257,
1445,
17747,
286,
25,
198,
198,
22164,
2752,
597,
2124,
351,
657,
1279,
2124,
1279,
399,
290,
399,
4064,
2124,
6624,
657,
13,
198,
39232,
4092,
262,
1271,
399,
319,
262,
30860,
3526,
351,
399,
532,
2124,
13,
198,
7583,
11,
611,
257,
2137,
2314,
787,
257,
1445,
11,
484,
4425,
262,
983,
13,
198,
198,
13615,
6407,
611,
290,
691,
611,
14862,
7864,
262,
983,
11,
13148,
1111,
1938,
711,
6436,
453,
13,
628,
198,
198,
16281,
352,
25,
198,
198,
20560,
25,
362,
198,
26410,
25,
2081,
198,
3109,
11578,
341,
25,
14862,
19769,
352,
11,
290,
5811,
468,
645,
517,
6100,
13,
198,
16281,
362,
25,
198,
198,
20560,
25,
513,
198,
26410,
25,
3991,
198,
3109,
11578,
341,
25,
14862,
19769,
352,
11,
5811,
19769,
352,
11,
290,
14862,
468,
645,
517,
6100,
13,
628,
198,
6425,
25,
198,
198,
16,
19841,
399,
19841,
8576,
198,
37811,
198,
198,
2,
640,
13357,
25,
440,
7,
21283,
2360,
828,
2272,
13357,
25,
440,
7,
77,
8
] | 3.328947 | 228 |
import sys
import traceback
import numpy as np
from evalml.automl.engine import EngineBase
from evalml.exceptions import PipelineScoreError
from evalml.model_family import ModelFamily
from evalml.objectives.utils import get_objective
from evalml.utils import get_logger
logger = get_logger(__file__)
class SequentialEngine(EngineBase):
"""The default engine for the AutoML search. Trains and scores pipelines locally, one after another."""
def evaluate_batch(self, pipelines):
"""Evaluate a batch of pipelines using the current dataset and AutoML state.
Arguments:
pipelines (list(PipelineBase)): A batch of pipelines to be fitted and evaluated.
Returns:
list (int): a list of the new pipeline IDs which were created by the AutoML search.
"""
if self.X_train is None or self.y_train is None:
raise ValueError("Dataset has not been loaded into the engine.")
new_pipeline_ids = []
index = 0
while self._should_continue_callback() and index < len(pipelines):
pipeline = pipelines[index]
self._pre_evaluation_callback(pipeline)
X, y = self.X_train, self.y_train
if pipeline.model_family == ModelFamily.ENSEMBLE:
X, y = self.X_train.iloc[self.ensembling_indices], self.y_train.iloc[self.ensembling_indices]
elif self.ensembling_indices is not None:
training_indices = [i for i in range(len(self.X_train)) if i not in self.ensembling_indices]
X = self.X_train.iloc[training_indices]
y = self.y_train.iloc[training_indices]
evaluation_result = EngineBase.train_and_score_pipeline(pipeline, self.automl, X, y)
new_pipeline_ids.append(self._post_evaluation_callback(pipeline, evaluation_result))
index += 1
return new_pipeline_ids
def train_batch(self, pipelines):
"""Train a batch of pipelines using the current dataset.
Arguments:
pipelines (list(PipelineBase)): A batch of pipelines to fit.
Returns:
dict[str, PipelineBase]: Dict of fitted pipelines keyed by pipeline name.
"""
super().train_batch(pipelines)
fitted_pipelines = {}
for pipeline in pipelines:
try:
fitted_pipeline = EngineBase.train_pipeline(
pipeline, self.X_train, self.y_train,
self.automl.optimize_thresholds,
self.automl.objective
)
fitted_pipelines[fitted_pipeline.name] = fitted_pipeline
except Exception as e:
logger.error(f'Train error for {pipeline.name}: {str(e)}')
tb = traceback.format_tb(sys.exc_info()[2])
logger.error("Traceback:")
logger.error("\n".join(tb))
return fitted_pipelines
def score_batch(self, pipelines, X, y, objectives):
"""Score a batch of pipelines.
Arguments:
pipelines (list(PipelineBase)): A batch of fitted pipelines to score.
X (ww.DataTable, pd.DataFrame): Features to score on.
y (ww.DataTable, pd.DataFrame): Data to score on.
objectives (list(ObjectiveBase), list(str)): Objectives to score on.
Returns:
dict: Dict containing scores for all objectives for all pipelines. Keyed by pipeline name.
"""
super().score_batch(pipelines, X, y, objectives)
scores = {}
objectives = [get_objective(o, return_instance=True) for o in objectives]
for pipeline in pipelines:
try:
scores[pipeline.name] = pipeline.score(X, y, objectives)
except Exception as e:
logger.error(f"Score error for {pipeline.name}: {str(e)}")
if isinstance(e, PipelineScoreError):
nan_scores = {objective: np.nan for objective in e.exceptions}
scores[pipeline.name] = {**nan_scores, **e.scored_successfully}
else:
# Traceback already included in the PipelineScoreError so we only
# need to include it for all other errors
tb = traceback.format_tb(sys.exc_info()[2])
logger.error("Traceback:")
logger.error("\n".join(tb))
scores[pipeline.name] = {objective.name: np.nan for objective in objectives}
return scores
| [
11748,
25064,
198,
11748,
12854,
1891,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
5418,
4029,
13,
2306,
296,
75,
13,
18392,
1330,
7117,
14881,
198,
6738,
5418,
4029,
13,
1069,
11755,
1330,
37709,
26595,
12331,
198,
6738,
5418,
4029,
13,
19849,
62,
17989,
1330,
9104,
24094,
198,
6738,
5418,
4029,
13,
15252,
1083,
13,
26791,
1330,
651,
62,
15252,
425,
198,
6738,
5418,
4029,
13,
26791,
1330,
651,
62,
6404,
1362,
198,
198,
6404,
1362,
796,
651,
62,
6404,
1362,
7,
834,
7753,
834,
8,
628,
198,
4871,
24604,
1843,
13798,
7,
13798,
14881,
2599,
198,
220,
220,
220,
37227,
464,
4277,
3113,
329,
262,
11160,
5805,
2989,
13,
833,
1299,
290,
8198,
31108,
15726,
11,
530,
706,
1194,
526,
15931,
628,
220,
220,
220,
825,
13446,
62,
43501,
7,
944,
11,
31108,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
36,
2100,
4985,
257,
15458,
286,
31108,
1262,
262,
1459,
27039,
290,
11160,
5805,
1181,
13,
628,
220,
220,
220,
220,
220,
220,
220,
20559,
2886,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31108,
357,
4868,
7,
47,
541,
4470,
14881,
8,
2599,
317,
15458,
286,
31108,
284,
307,
18235,
290,
16726,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1351,
357,
600,
2599,
257,
1351,
286,
262,
649,
11523,
32373,
543,
547,
2727,
416,
262,
11160,
5805,
2989,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
55,
62,
27432,
318,
6045,
393,
2116,
13,
88,
62,
27432,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7203,
27354,
292,
316,
468,
407,
587,
9639,
656,
262,
3113,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
79,
541,
4470,
62,
2340,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
6376,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
981,
2116,
13557,
21754,
62,
43043,
62,
47423,
3419,
290,
6376,
1279,
18896,
7,
79,
541,
20655,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11523,
796,
31108,
58,
9630,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
3866,
62,
18206,
2288,
62,
47423,
7,
79,
541,
4470,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
11,
331,
796,
2116,
13,
55,
62,
27432,
11,
2116,
13,
88,
62,
27432,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11523,
13,
19849,
62,
17989,
6624,
9104,
24094,
13,
16938,
3620,
19146,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
11,
331,
796,
2116,
13,
55,
62,
27432,
13,
346,
420,
58,
944,
13,
1072,
2022,
1359,
62,
521,
1063,
4357,
2116,
13,
88,
62,
27432,
13,
346,
420,
58,
944,
13,
1072,
2022,
1359,
62,
521,
1063,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
2116,
13,
1072,
2022,
1359,
62,
521,
1063,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3047,
62,
521,
1063,
796,
685,
72,
329,
1312,
287,
2837,
7,
11925,
7,
944,
13,
55,
62,
27432,
4008,
611,
1312,
407,
287,
2116,
13,
1072,
2022,
1359,
62,
521,
1063,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
796,
2116,
13,
55,
62,
27432,
13,
346,
420,
58,
34409,
62,
521,
1063,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
796,
2116,
13,
88,
62,
27432,
13,
346,
420,
58,
34409,
62,
521,
1063,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12660,
62,
20274,
796,
7117,
14881,
13,
27432,
62,
392,
62,
26675,
62,
79,
541,
4470,
7,
79,
541,
4470,
11,
2116,
13,
2306,
296,
75,
11,
1395,
11,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
79,
541,
4470,
62,
2340,
13,
33295,
7,
944,
13557,
7353,
62,
18206,
2288,
62,
47423,
7,
79,
541,
4470,
11,
12660,
62,
20274,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6376,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
649,
62,
79,
541,
4470,
62,
2340,
628,
220,
220,
220,
825,
4512,
62,
43501,
7,
944,
11,
31108,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
44077,
257,
15458,
286,
31108,
1262,
262,
1459,
27039,
13,
628,
220,
220,
220,
220,
220,
220,
220,
20559,
2886,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31108,
357,
4868,
7,
47,
541,
4470,
14881,
8,
2599,
317,
15458,
286,
31108,
284,
4197,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8633,
58,
2536,
11,
37709,
14881,
5974,
360,
713,
286,
18235,
31108,
1994,
276,
416,
11523,
1438,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
27432,
62,
43501,
7,
79,
541,
20655,
8,
628,
220,
220,
220,
220,
220,
220,
220,
18235,
62,
79,
541,
20655,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
329,
11523,
287,
31108,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18235,
62,
79,
541,
4470,
796,
7117,
14881,
13,
27432,
62,
79,
541,
4470,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11523,
11,
2116,
13,
55,
62,
27432,
11,
2116,
13,
88,
62,
27432,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2306,
296,
75,
13,
40085,
1096,
62,
400,
10126,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2306,
296,
75,
13,
15252,
425,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18235,
62,
79,
541,
20655,
58,
38631,
62,
79,
541,
4470,
13,
3672,
60,
796,
18235,
62,
79,
541,
4470,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7,
69,
6,
44077,
4049,
329,
1391,
79,
541,
4470,
13,
3672,
38362,
1391,
2536,
7,
68,
38165,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
65,
796,
12854,
1891,
13,
18982,
62,
83,
65,
7,
17597,
13,
41194,
62,
10951,
3419,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7203,
2898,
558,
1891,
25,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7203,
59,
77,
1911,
22179,
7,
83,
65,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
18235,
62,
79,
541,
20655,
628,
220,
220,
220,
825,
4776,
62,
43501,
7,
944,
11,
31108,
11,
1395,
11,
331,
11,
15221,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
26595,
257,
15458,
286,
31108,
13,
628,
220,
220,
220,
220,
220,
220,
220,
20559,
2886,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31108,
357,
4868,
7,
47,
541,
4470,
14881,
8,
2599,
317,
15458,
286,
18235,
31108,
284,
4776,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
357,
1383,
13,
6601,
10962,
11,
279,
67,
13,
6601,
19778,
2599,
17571,
284,
4776,
319,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
357,
1383,
13,
6601,
10962,
11,
279,
67,
13,
6601,
19778,
2599,
6060,
284,
4776,
319,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15221,
357,
4868,
7,
10267,
425,
14881,
828,
1351,
7,
2536,
8,
2599,
9515,
1083,
284,
4776,
319,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8633,
25,
360,
713,
7268,
8198,
329,
477,
15221,
329,
477,
31108,
13,
7383,
276,
416,
11523,
1438,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
26675,
62,
43501,
7,
79,
541,
20655,
11,
1395,
11,
331,
11,
15221,
8,
628,
220,
220,
220,
220,
220,
220,
220,
8198,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
15221,
796,
685,
1136,
62,
15252,
425,
7,
78,
11,
1441,
62,
39098,
28,
17821,
8,
329,
267,
287,
15221,
60,
198,
220,
220,
220,
220,
220,
220,
220,
329,
11523,
287,
31108,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8198,
58,
79,
541,
4470,
13,
3672,
60,
796,
11523,
13,
26675,
7,
55,
11,
331,
11,
15221,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7,
69,
1,
26595,
4049,
329,
1391,
79,
541,
4470,
13,
3672,
38362,
1391,
2536,
7,
68,
38165,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
68,
11,
37709,
26595,
12331,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15709,
62,
1416,
2850,
796,
1391,
15252,
425,
25,
45941,
13,
12647,
329,
9432,
287,
304,
13,
1069,
11755,
92,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8198,
58,
79,
541,
4470,
13,
3672,
60,
796,
1391,
1174,
12647,
62,
1416,
2850,
11,
12429,
68,
13,
1416,
1850,
62,
37351,
92,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
34912,
1891,
1541,
3017,
287,
262,
37709,
26595,
12331,
523,
356,
691,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
761,
284,
2291,
340,
329,
477,
584,
8563,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
65,
796,
12854,
1891,
13,
18982,
62,
83,
65,
7,
17597,
13,
41194,
62,
10951,
3419,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7203,
2898,
558,
1891,
25,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7203,
59,
77,
1911,
22179,
7,
83,
65,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8198,
58,
79,
541,
4470,
13,
3672,
60,
796,
1391,
15252,
425,
13,
3672,
25,
45941,
13,
12647,
329,
9432,
287,
15221,
92,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
8198,
198
] | 2.240869 | 2,026 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import csv
import s3fs
import os
s3 = s3fs.S3FileSystem(anon=False)
header = [
'uuid',
'country',
'itemType',
'salesChannel',
'orderPriority',
'orderDate',
'region',
'shipDate'
]
| [
2,
15069,
6186,
13,
785,
11,
3457,
13,
393,
663,
29116,
13,
1439,
6923,
33876,
13,
198,
2,
30628,
55,
12,
34156,
12,
33234,
7483,
25,
17168,
12,
15,
198,
11748,
269,
21370,
198,
11748,
264,
18,
9501,
198,
11748,
28686,
198,
198,
82,
18,
796,
264,
18,
9501,
13,
50,
18,
8979,
11964,
7,
36902,
28,
25101,
8,
198,
198,
25677,
796,
685,
198,
220,
220,
220,
705,
12303,
312,
3256,
198,
220,
220,
220,
705,
19315,
3256,
198,
220,
220,
220,
705,
9186,
6030,
3256,
198,
220,
220,
220,
705,
82,
2040,
29239,
3256,
198,
220,
220,
220,
705,
2875,
22442,
414,
3256,
198,
220,
220,
220,
705,
2875,
10430,
3256,
198,
220,
220,
220,
705,
36996,
3256,
198,
220,
220,
220,
705,
6720,
10430,
6,
198,
60,
628,
628,
198
] | 2.398496 | 133 |
# -*- coding: utf-8 -*-
from numpy import pi
from numpy import zeros
from numpy import sin
from numpy import cos
from numpy import sqrt
from numpy.random import random
from numpy import float32 as npfloat
from numpy import int32 as npint
TWOPI = pi*2
PI = pi
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
628,
628,
198,
198,
6738,
299,
32152,
1330,
31028,
198,
6738,
299,
32152,
1330,
1976,
27498,
198,
6738,
299,
32152,
1330,
7813,
198,
6738,
299,
32152,
1330,
8615,
198,
6738,
299,
32152,
1330,
19862,
17034,
198,
6738,
299,
32152,
13,
25120,
1330,
4738,
198,
198,
6738,
299,
32152,
1330,
12178,
2624,
355,
45941,
22468,
198,
6738,
299,
32152,
1330,
493,
2624,
355,
45941,
600,
628,
198,
34551,
3185,
40,
796,
31028,
9,
17,
198,
11901,
796,
31028,
628,
628
] | 2.934783 | 92 |
from logging import debug, exception
from flask import Flask, request
import os
import asyncio
import threading
import ssl
import aiohttp
import nest_asyncio
import json
from openleadr.client import OpenADRClient
from openleadr.utils import report_callback
from openleadr.enums import MEASUREMENTS
nest_asyncio.apply()
client = OpenADRClient(ven_name='myven', vtn_url=os.environ.get('VTN_URL'))
client.add_report(report_callback, client.ven_id, report_name = 'TELEMETRY_STATUS')
client.add_report(report_callback, client.ven_id, report_name = 'TELEMETRY_USAGE', measurement= MEASUREMENTS.POWER_REAL)
app = Flask(__name__)
@app.route('/create_party_registration', methods=['POST', 'GET'])
@app.route('/create_party_registration_while_registered', methods=['POST', 'GET'])
@app.route('/query_registration', methods=['POST'])
@app.route('/cancel_party_registration', methods=['POST'])
@app.route('/register_reports')
@app.route('/request_event', methods=['POST'])
@app.route('/create_opt', methods =['POST'])
@app.route('/cancel_opt', methods = ['POST'])
if __name__ == "__main__":
t1 = threading.Thread(target=app.run, kwargs={'host': '0.0.0.0', 'port': os.environ.get('PORT') })
t2 = threading.Thread(target=client_run)
t1.start()
t2.start()
t2.join() | [
6738,
18931,
1330,
14257,
11,
6631,
198,
6738,
42903,
1330,
46947,
11,
2581,
198,
11748,
28686,
198,
11748,
30351,
952,
198,
11748,
4704,
278,
198,
11748,
264,
6649,
198,
11748,
257,
952,
4023,
198,
11748,
16343,
62,
292,
13361,
952,
198,
11748,
33918,
198,
6738,
1280,
28230,
81,
13,
16366,
1330,
4946,
2885,
49,
11792,
198,
6738,
1280,
28230,
81,
13,
26791,
1330,
989,
62,
47423,
198,
6738,
1280,
28230,
81,
13,
268,
5700,
1330,
11948,
1921,
11335,
28957,
198,
198,
77,
395,
62,
292,
13361,
952,
13,
39014,
3419,
198,
16366,
796,
4946,
2885,
49,
11792,
7,
574,
62,
3672,
11639,
1820,
574,
3256,
410,
34106,
62,
6371,
28,
418,
13,
268,
2268,
13,
1136,
10786,
36392,
45,
62,
21886,
6,
4008,
198,
16366,
13,
2860,
62,
13116,
7,
13116,
62,
47423,
11,
5456,
13,
574,
62,
312,
11,
989,
62,
3672,
796,
705,
9328,
2538,
47123,
18276,
62,
35744,
2937,
11537,
198,
16366,
13,
2860,
62,
13116,
7,
13116,
62,
47423,
11,
5456,
13,
574,
62,
312,
11,
989,
62,
3672,
796,
705,
9328,
2538,
47123,
18276,
62,
2937,
11879,
3256,
15558,
28,
11948,
1921,
11335,
28957,
13,
47,
36048,
62,
2200,
1847,
8,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
198,
31,
1324,
13,
38629,
10786,
14,
17953,
62,
10608,
62,
2301,
33397,
3256,
5050,
28,
17816,
32782,
3256,
705,
18851,
6,
12962,
198,
198,
31,
1324,
13,
38629,
10786,
14,
17953,
62,
10608,
62,
2301,
33397,
62,
4514,
62,
33736,
3256,
5050,
28,
17816,
32782,
3256,
705,
18851,
6,
12962,
198,
198,
31,
1324,
13,
38629,
10786,
14,
22766,
62,
2301,
33397,
3256,
5050,
28,
17816,
32782,
6,
12962,
198,
198,
31,
1324,
13,
38629,
10786,
14,
66,
21130,
62,
10608,
62,
2301,
33397,
3256,
5050,
28,
17816,
32782,
6,
12962,
198,
198,
31,
1324,
13,
38629,
10786,
14,
30238,
62,
48922,
11537,
198,
198,
31,
1324,
13,
38629,
10786,
14,
25927,
62,
15596,
3256,
5050,
28,
17816,
32782,
6,
12962,
198,
198,
31,
1324,
13,
38629,
10786,
14,
17953,
62,
8738,
3256,
5050,
796,
17816,
32782,
6,
12962,
198,
198,
31,
1324,
13,
38629,
10786,
14,
66,
21130,
62,
8738,
3256,
5050,
796,
37250,
32782,
6,
12962,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
256,
16,
796,
4704,
278,
13,
16818,
7,
16793,
28,
1324,
13,
5143,
11,
479,
86,
22046,
34758,
6,
4774,
10354,
705,
15,
13,
15,
13,
15,
13,
15,
3256,
705,
634,
10354,
28686,
13,
268,
2268,
13,
1136,
10786,
15490,
11537,
32092,
198,
220,
220,
220,
256,
17,
796,
4704,
278,
13,
16818,
7,
16793,
28,
16366,
62,
5143,
8,
198,
220,
220,
220,
256,
16,
13,
9688,
3419,
198,
220,
220,
220,
256,
17,
13,
9688,
3419,
198,
220,
220,
220,
256,
17,
13,
22179,
3419
] | 2.729211 | 469 |
from __future__ import absolute_import
# Copyright(c) Max Kolosov 2009 maxkolosov@inbox.ru
# http://vosolok2008.narod.ru
# BSD license
__version__ = '0.1'
__versionTime__ = '2009-11-15'
__author__ = 'Max Kolosov <maxkolosov@inbox.ru>'
__doc__ = '''
pybass_aac.py - is ctypes python module for
BASS_AAC - extension to the BASS audio library that enables the playback
of Advanced Audio Coding and MPEG-4 streams (http://www.maresweb.de).
'''
import os, sys, ctypes
from . import pybass
from .paths import x86_path, x64_path
import libloader
bass_aac_module = libloader.load_library('bass_aac', x86_path=x86_path, x64_path=x64_path)
func_type = libloader.get_functype()
#Register the plugin with the Bass plugin system.
pybass.BASS_PluginLoad(libloader.find_library_path('bass_aac', x86_path=x86_path, x64_path=x64_path), 0)
QWORD = pybass.QWORD
HSTREAM = pybass.HSTREAM
DOWNLOADPROC = pybass.DOWNLOADPROC
BASS_FILEPROCS = pybass.BASS_FILEPROCS
# Additional BASS_SetConfig options
BASS_CONFIG_MP4_VIDEO = 0x10700 # play the audio from MP4 videos
# Additional tags available from BASS_StreamGetTags (for MP4 files)
BASS_TAG_MP4 = 7 # MP4/iTunes metadata
BASS_AAC_STEREO = 0x400000 # downmatrix to stereo
# BASS_CHANNELINFO type
BASS_CTYPE_STREAM_AAC = 0x10b00 # AAC
BASS_CTYPE_STREAM_MP4 = 0x10b01 # MP4
#HSTREAM BASSAACDEF(BASS_AAC_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags);
BASS_AAC_StreamCreateFile = func_type(HSTREAM, ctypes.c_byte, ctypes.c_void_p, QWORD, QWORD, ctypes.c_ulong)(('BASS_AAC_StreamCreateFile', bass_aac_module))
#HSTREAM BASSAACDEF(BASS_AAC_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user);
BASS_AAC_StreamCreateURL = func_type(HSTREAM, ctypes.c_char_p, ctypes.c_ulong, ctypes.c_ulong, DOWNLOADPROC, ctypes.c_void_p)(('BASS_AAC_StreamCreateURL', bass_aac_module))
#HSTREAM BASSAACDEF(BASS_AAC_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user);
BASS_AAC_StreamCreateFileUser = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_ulong, ctypes.POINTER(BASS_FILEPROCS), ctypes.c_void_p)(('BASS_AAC_StreamCreateFileUser', bass_aac_module))
#HSTREAM BASSAACDEF(BASS_MP4_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags);
BASS_MP4_StreamCreateFile = func_type(HSTREAM, ctypes.c_byte, ctypes.c_void_p, QWORD, QWORD, ctypes.c_ulong)(('BASS_MP4_StreamCreateFile', bass_aac_module))
#HSTREAM BASSAACDEF(BASS_MP4_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user);
BASS_MP4_StreamCreateFileUser = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_ulong, ctypes.POINTER(BASS_FILEPROCS), ctypes.c_void_p)(('BASS_MP4_StreamCreateFileUser', bass_aac_module))
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
201,
198,
2,
15069,
7,
66,
8,
5436,
25910,
418,
709,
3717,
3509,
74,
349,
418,
709,
31,
259,
3524,
13,
622,
201,
198,
2,
2638,
1378,
85,
418,
349,
482,
11528,
13,
23955,
375,
13,
622,
201,
198,
2,
347,
10305,
5964,
201,
198,
201,
198,
834,
9641,
834,
796,
705,
15,
13,
16,
6,
201,
198,
834,
9641,
7575,
834,
796,
705,
10531,
12,
1157,
12,
1314,
6,
201,
198,
834,
9800,
834,
796,
705,
11518,
25910,
418,
709,
1279,
9806,
74,
349,
418,
709,
31,
259,
3524,
13,
622,
29,
6,
201,
198,
834,
15390,
834,
796,
705,
7061,
201,
198,
9078,
42933,
62,
64,
330,
13,
9078,
532,
318,
269,
19199,
21015,
8265,
329,
201,
198,
33,
10705,
62,
32,
2246,
532,
7552,
284,
262,
347,
10705,
6597,
5888,
326,
13536,
262,
16388,
201,
198,
1659,
13435,
13491,
327,
7656,
290,
41203,
12,
19,
15190,
357,
4023,
1378,
2503,
13,
23745,
12384,
13,
2934,
737,
201,
198,
7061,
6,
201,
198,
201,
198,
11748,
28686,
11,
25064,
11,
269,
19199,
201,
198,
6738,
764,
1330,
12972,
42933,
201,
198,
6738,
764,
6978,
82,
1330,
2124,
4521,
62,
6978,
11,
2124,
2414,
62,
6978,
201,
198,
11748,
9195,
29356,
201,
198,
201,
198,
42933,
62,
64,
330,
62,
21412,
796,
9195,
29356,
13,
2220,
62,
32016,
10786,
42933,
62,
64,
330,
3256,
2124,
4521,
62,
6978,
28,
87,
4521,
62,
6978,
11,
2124,
2414,
62,
6978,
28,
87,
2414,
62,
6978,
8,
201,
198,
20786,
62,
4906,
796,
9195,
29356,
13,
1136,
62,
12543,
310,
2981,
3419,
201,
198,
2,
38804,
262,
13877,
351,
262,
19829,
13877,
1080,
13,
201,
198,
9078,
42933,
13,
33,
10705,
62,
37233,
8912,
7,
8019,
29356,
13,
19796,
62,
32016,
62,
6978,
10786,
42933,
62,
64,
330,
3256,
2124,
4521,
62,
6978,
28,
87,
4521,
62,
6978,
11,
2124,
2414,
62,
6978,
28,
87,
2414,
62,
6978,
828,
657,
8,
201,
198,
201,
198,
48,
54,
12532,
796,
12972,
42933,
13,
48,
54,
12532,
201,
198,
39,
2257,
32235,
796,
12972,
42933,
13,
39,
2257,
32235,
201,
198,
41925,
35613,
4805,
4503,
796,
12972,
42933,
13,
41925,
35613,
4805,
4503,
201,
198,
33,
10705,
62,
25664,
4805,
4503,
50,
796,
12972,
42933,
13,
33,
10705,
62,
25664,
4805,
4503,
50,
201,
198,
201,
198,
201,
198,
2,
15891,
347,
10705,
62,
7248,
16934,
3689,
201,
198,
33,
10705,
62,
10943,
16254,
62,
7378,
19,
62,
42937,
796,
657,
87,
940,
9879,
1303,
711,
262,
6597,
422,
4904,
19,
5861,
201,
198,
201,
198,
2,
15891,
15940,
1695,
422,
347,
10705,
62,
12124,
3855,
36142,
357,
1640,
4904,
19,
3696,
8,
201,
198,
33,
10705,
62,
42197,
62,
7378,
19,
796,
767,
1303,
4904,
19,
14,
72,
51,
4015,
20150,
201,
198,
201,
198,
33,
10705,
62,
32,
2246,
62,
41809,
4720,
796,
657,
87,
7029,
830,
1303,
866,
6759,
8609,
284,
24820,
201,
198,
201,
198,
2,
347,
10705,
62,
3398,
22846,
3698,
10778,
2099,
201,
198,
33,
10705,
62,
4177,
56,
11401,
62,
2257,
32235,
62,
32,
2246,
796,
657,
87,
940,
65,
405,
1303,
47943,
201,
198,
33,
10705,
62,
4177,
56,
11401,
62,
2257,
32235,
62,
7378,
19,
796,
657,
87,
940,
65,
486,
1303,
4904,
19,
201,
198,
201,
198,
201,
198,
2,
39,
2257,
32235,
29809,
4090,
2246,
32988,
7,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
8979,
5769,
8202,
3535,
1066,
11,
1500,
7951,
1635,
7753,
11,
1195,
54,
12532,
11677,
11,
1195,
54,
12532,
4129,
11,
29652,
12532,
9701,
1776,
201,
198,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
8979,
796,
25439,
62,
4906,
7,
39,
2257,
32235,
11,
269,
19199,
13,
66,
62,
26327,
11,
269,
19199,
13,
66,
62,
19382,
62,
79,
11,
1195,
54,
12532,
11,
1195,
54,
12532,
11,
269,
19199,
13,
66,
62,
377,
506,
5769,
10786,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
8979,
3256,
12702,
62,
64,
330,
62,
21412,
4008,
201,
198,
2,
39,
2257,
32235,
29809,
4090,
2246,
32988,
7,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
21886,
5769,
9979,
1149,
1635,
6371,
11,
29652,
12532,
11677,
11,
29652,
12532,
9701,
11,
30320,
35613,
4805,
4503,
1635,
36942,
11,
7951,
1635,
7220,
1776,
201,
198,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
21886,
796,
25439,
62,
4906,
7,
39,
2257,
32235,
11,
269,
19199,
13,
66,
62,
10641,
62,
79,
11,
269,
19199,
13,
66,
62,
377,
506,
11,
269,
19199,
13,
66,
62,
377,
506,
11,
30320,
35613,
4805,
4503,
11,
269,
19199,
13,
66,
62,
19382,
62,
79,
5769,
10786,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
21886,
3256,
12702,
62,
64,
330,
62,
21412,
4008,
201,
198,
2,
39,
2257,
32235,
29809,
4090,
2246,
32988,
7,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
8979,
12982,
5769,
42955,
12532,
1080,
11,
29652,
12532,
9701,
11,
1500,
347,
10705,
62,
25664,
4805,
4503,
50,
1635,
1676,
6359,
11,
7951,
1635,
7220,
1776,
201,
198,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
8979,
12982,
796,
25439,
62,
4906,
7,
39,
2257,
32235,
11,
269,
19199,
13,
66,
62,
377,
506,
11,
269,
19199,
13,
66,
62,
377,
506,
11,
269,
19199,
13,
16402,
41358,
7,
33,
10705,
62,
25664,
4805,
4503,
50,
828,
269,
19199,
13,
66,
62,
19382,
62,
79,
5769,
10786,
33,
10705,
62,
32,
2246,
62,
12124,
16447,
8979,
12982,
3256,
12702,
62,
64,
330,
62,
21412,
4008,
201,
198,
2,
39,
2257,
32235,
29809,
4090,
2246,
32988,
7,
33,
10705,
62,
7378,
19,
62,
12124,
16447,
8979,
5769,
8202,
3535,
1066,
11,
1500,
7951,
1635,
7753,
11,
1195,
54,
12532,
11677,
11,
1195,
54,
12532,
4129,
11,
29652,
12532,
9701,
1776,
201,
198,
33,
10705,
62,
7378,
19,
62,
12124,
16447,
8979,
796,
25439,
62,
4906,
7,
39,
2257,
32235,
11,
269,
19199,
13,
66,
62,
26327,
11,
269,
19199,
13,
66,
62,
19382,
62,
79,
11,
1195,
54,
12532,
11,
1195,
54,
12532,
11,
269,
19199,
13,
66,
62,
377,
506,
5769,
10786,
33,
10705,
62,
7378,
19,
62,
12124,
16447,
8979,
3256,
12702,
62,
64,
330,
62,
21412,
4008,
201,
198,
2,
39,
2257,
32235,
29809,
4090,
2246,
32988,
7,
33,
10705,
62,
7378,
19,
62,
12124,
16447,
8979,
12982,
5769,
42955,
12532,
1080,
11,
29652,
12532,
9701,
11,
1500,
347,
10705,
62,
25664,
4805,
4503,
50,
1635,
1676,
6359,
11,
7951,
1635,
7220,
1776,
201,
198,
33,
10705,
62,
7378,
19,
62,
12124,
16447,
8979,
12982,
796,
25439,
62,
4906,
7,
39,
2257,
32235,
11,
269,
19199,
13,
66,
62,
377,
506,
11,
269,
19199,
13,
66,
62,
377,
506,
11,
269,
19199,
13,
16402,
41358,
7,
33,
10705,
62,
25664,
4805,
4503,
50,
828,
269,
19199,
13,
66,
62,
19382,
62,
79,
5769,
10786,
33,
10705,
62,
7378,
19,
62,
12124,
16447,
8979,
12982,
3256,
12702,
62,
64,
330,
62,
21412,
4008,
201,
198
] | 2.442324 | 1,153 |
from collections import OrderedDict
from django import http
from django.db.models import Prefetch
from django.db.transaction import non_atomic_requests
from django.shortcuts import redirect
from django.utils.cache import patch_cache_control
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from elasticsearch_dsl import Q, query, Search
from rest_framework import exceptions, serializers
from rest_framework.decorators import action
from rest_framework.generics import GenericAPIView, ListAPIView
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.response import Response
from rest_framework.settings import api_settings
from rest_framework.viewsets import GenericViewSet
import olympia.core.logger
from olympia import amo
from olympia.access import acl
from olympia.amo.models import manual_order
from olympia.amo.urlresolvers import get_outgoing_url
from olympia.api.pagination import ESPageNumberPagination
from olympia.api.permissions import (
AllowAddonAuthor, AllowReadOnlyIfPublic, AllowRelatedObjectPermissions,
AllowReviewer, AllowReviewerUnlisted, AnyOf, GroupPermission)
from olympia.constants.categories import CATEGORIES_BY_ID
from olympia.search.filters import (
AddonAppQueryParam, AddonAppVersionQueryParam, AddonAuthorQueryParam,
AddonCategoryQueryParam, AddonGuidQueryParam, AddonTypeQueryParam,
AutoCompleteSortFilter,
ReviewedContentFilter, SearchParameterFilter, SearchQueryFilter,
SortingFilter)
from olympia.translations.query import order_by_translation
from olympia.versions.models import Version
from .decorators import addon_view_factory
from .indexers import AddonIndexer
from .models import Addon, CompatOverride, ReplacementAddon
from .serializers import (
AddonEulaPolicySerializer,
AddonSerializer, AddonSerializerWithUnlistedData, CompatOverrideSerializer,
ESAddonAutoCompleteSerializer, ESAddonSerializer, LanguageToolsSerializer,
ReplacementAddonSerializer, StaticCategorySerializer, VersionSerializer)
from .utils import (
get_addon_recommendations, get_addon_recommendations_invalid,
get_creatured_ids, get_featured_ids, is_outcome_recommended)
log = olympia.core.logger.getLogger('z.addons')
addon_view = addon_view_factory(qs=Addon.objects.valid)
addon_valid_disabled_pending_view = addon_view_factory(
qs=Addon.objects.valid_and_disabled_and_pending)
class BaseFilter(object):
"""
Filters help generate querysets for add-on listings.
You have to define ``opts`` on the subclass as a sequence of (key, title)
pairs. The key is used in GET parameters and the title can be used in the
view.
The chosen filter field is combined with the ``base`` queryset using
the ``key`` found in request.GET. ``default`` should be a key in ``opts``
that's used if nothing good is found in request.GET.
"""
def options(self, request, key, default):
"""Get the (option, title) pair we want according to the request."""
if key in request.GET and (request.GET[key] in self.opts_dict or
request.GET[key] in self.extras_dict):
opt = request.GET[key]
else:
opt = default
if opt in self.opts_dict:
title = self.opts_dict[opt]
else:
title = self.extras_dict[opt]
return opt, title
def all(self):
"""Get a full mapping of {option: queryset}."""
return dict((field, self.filter(field)) for field in dict(self.opts))
def filter(self, field):
"""Get the queryset for the given field."""
return getattr(self, 'filter_{0}'.format(field))()
DEFAULT_FIND_REPLACEMENT_PATH = '/collections/mozilla/featured-add-ons/'
FIND_REPLACEMENT_SRC = 'find-replacement'
class AddonChildMixin(object):
"""Mixin containing method to retrieve the parent add-on object."""
def get_addon_object(self, permission_classes=None, lookup='addon_pk'):
"""Return the parent Addon object using the URL parameter passed
to the view.
`permission_classes` can be use passed to change which permission
classes the parent viewset will be used when loading the Addon object,
otherwise AddonViewSet.permission_classes will be used."""
if hasattr(self, 'addon_object'):
return self.addon_object
if permission_classes is None:
permission_classes = AddonViewSet.permission_classes
self.addon_object = AddonViewSet(
request=self.request, permission_classes=permission_classes,
kwargs={'pk': self.kwargs[lookup]}).get_object()
return self.addon_object
class CompatOverrideView(ListAPIView):
"""This view is used by Firefox so it's performance-critical.
Every firefox client requests the list of overrides approx. once per day.
Firefox requests the overrides via a list of GUIDs which makes caching
hard because the variation of possible GUID combinations prevent us to
simply add some dumb-caching and requires us to resolve cache-misses.
"""
queryset = CompatOverride.objects.all()
serializer_class = CompatOverrideSerializer
@classmethod
def as_view(cls, **initkwargs):
"""The API is read-only so we can turn off atomic requests."""
return non_atomic_requests(
super(CompatOverrideView, cls).as_view(**initkwargs))
| [
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
198,
6738,
42625,
14208,
1330,
2638,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
1330,
42195,
7569,
198,
6738,
42625,
14208,
13,
9945,
13,
7645,
2673,
1330,
1729,
62,
47116,
62,
8897,
3558,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
18941,
198,
6738,
42625,
14208,
13,
26791,
13,
23870,
1330,
8529,
62,
23870,
62,
13716,
198,
6738,
42625,
14208,
13,
26791,
13,
12501,
273,
2024,
1330,
2446,
62,
12501,
273,
1352,
198,
6738,
42625,
14208,
13,
33571,
13,
12501,
273,
2024,
13,
23870,
1330,
12940,
62,
7700,
198,
198,
6738,
27468,
12947,
62,
67,
6649,
1330,
1195,
11,
12405,
11,
11140,
198,
6738,
1334,
62,
30604,
1330,
13269,
11,
11389,
11341,
198,
6738,
1334,
62,
30604,
13,
12501,
273,
2024,
1330,
2223,
198,
6738,
1334,
62,
30604,
13,
8612,
873,
1330,
42044,
2969,
3824,
769,
11,
7343,
2969,
3824,
769,
198,
6738,
1334,
62,
30604,
13,
19816,
1040,
1330,
7343,
17633,
35608,
259,
11,
4990,
30227,
17633,
35608,
259,
198,
6738,
1334,
62,
30604,
13,
26209,
1330,
18261,
198,
6738,
1334,
62,
30604,
13,
33692,
1330,
40391,
62,
33692,
198,
6738,
1334,
62,
30604,
13,
1177,
28709,
1330,
42044,
7680,
7248,
198,
198,
11748,
267,
6760,
544,
13,
7295,
13,
6404,
1362,
198,
198,
6738,
267,
6760,
544,
1330,
716,
78,
198,
6738,
267,
6760,
544,
13,
15526,
1330,
257,
565,
198,
6738,
267,
6760,
544,
13,
18811,
13,
27530,
1330,
10107,
62,
2875,
198,
6738,
267,
6760,
544,
13,
18811,
13,
6371,
411,
349,
690,
1330,
651,
62,
448,
5146,
62,
6371,
198,
6738,
267,
6760,
544,
13,
15042,
13,
79,
363,
1883,
1330,
9428,
496,
15057,
47,
363,
1883,
198,
6738,
267,
6760,
544,
13,
15042,
13,
525,
8481,
1330,
357,
198,
220,
220,
220,
22507,
4550,
261,
13838,
11,
22507,
5569,
10049,
1532,
15202,
11,
22507,
9819,
10267,
5990,
8481,
11,
198,
220,
220,
220,
22507,
35407,
11,
22507,
35407,
3118,
17935,
11,
4377,
5189,
11,
4912,
5990,
3411,
8,
198,
6738,
267,
6760,
544,
13,
9979,
1187,
13,
66,
26129,
1330,
327,
6158,
38,
1581,
11015,
62,
17513,
62,
2389,
198,
6738,
267,
6760,
544,
13,
12947,
13,
10379,
1010,
1330,
357,
198,
220,
220,
220,
3060,
261,
4677,
20746,
22973,
11,
3060,
261,
4677,
14815,
20746,
22973,
11,
3060,
261,
13838,
20746,
22973,
11,
198,
220,
220,
220,
3060,
261,
27313,
20746,
22973,
11,
3060,
261,
8205,
312,
20746,
22973,
11,
3060,
261,
6030,
20746,
22973,
11,
198,
220,
220,
220,
11160,
20988,
42758,
22417,
11,
198,
220,
220,
220,
6602,
276,
19746,
22417,
11,
11140,
36301,
22417,
11,
11140,
20746,
22417,
11,
198,
220,
220,
220,
311,
24707,
22417,
8,
198,
6738,
267,
6760,
544,
13,
7645,
49905,
13,
22766,
1330,
1502,
62,
1525,
62,
41519,
198,
6738,
267,
6760,
544,
13,
47178,
13,
27530,
1330,
10628,
198,
198,
6738,
764,
12501,
273,
2024,
1330,
48557,
62,
1177,
62,
69,
9548,
198,
6738,
764,
9630,
364,
1330,
3060,
261,
15732,
263,
198,
6738,
764,
27530,
1330,
3060,
261,
11,
3082,
265,
37961,
11,
43986,
4550,
261,
198,
6738,
764,
46911,
11341,
1330,
357,
198,
220,
220,
220,
3060,
261,
36,
4712,
36727,
32634,
7509,
11,
198,
220,
220,
220,
3060,
261,
32634,
7509,
11,
3060,
261,
32634,
7509,
3152,
3118,
17935,
6601,
11,
3082,
265,
37961,
32634,
7509,
11,
198,
220,
220,
220,
42212,
1860,
261,
27722,
20988,
32634,
7509,
11,
42212,
1860,
261,
32634,
7509,
11,
15417,
33637,
32634,
7509,
11,
198,
220,
220,
220,
43986,
4550,
261,
32634,
7509,
11,
36125,
27313,
32634,
7509,
11,
10628,
32634,
7509,
8,
198,
6738,
764,
26791,
1330,
357,
198,
220,
220,
220,
651,
62,
48078,
62,
47335,
437,
602,
11,
651,
62,
48078,
62,
47335,
437,
602,
62,
259,
12102,
11,
198,
220,
220,
220,
651,
62,
20123,
1522,
62,
2340,
11,
651,
62,
69,
20980,
62,
2340,
11,
318,
62,
448,
2958,
62,
47335,
1631,
8,
628,
198,
6404,
796,
267,
6760,
544,
13,
7295,
13,
6404,
1362,
13,
1136,
11187,
1362,
10786,
89,
13,
39996,
11537,
198,
48078,
62,
1177,
796,
48557,
62,
1177,
62,
69,
9548,
7,
48382,
28,
4550,
261,
13,
48205,
13,
12102,
8,
198,
48078,
62,
12102,
62,
47730,
62,
79,
1571,
62,
1177,
796,
48557,
62,
1177,
62,
69,
9548,
7,
198,
220,
220,
220,
10662,
82,
28,
4550,
261,
13,
48205,
13,
12102,
62,
392,
62,
47730,
62,
392,
62,
79,
1571,
8,
628,
198,
4871,
7308,
22417,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7066,
1010,
1037,
7716,
42517,
893,
1039,
329,
751,
12,
261,
26890,
13,
628,
220,
220,
220,
921,
423,
284,
8160,
7559,
404,
912,
15506,
319,
262,
47611,
355,
257,
8379,
286,
357,
2539,
11,
3670,
8,
198,
220,
220,
220,
14729,
13,
220,
383,
1994,
318,
973,
287,
17151,
10007,
290,
262,
3670,
460,
307,
973,
287,
262,
198,
220,
220,
220,
1570,
13,
628,
220,
220,
220,
383,
7147,
8106,
2214,
318,
5929,
351,
262,
7559,
8692,
15506,
42517,
893,
316,
1262,
198,
220,
220,
220,
262,
7559,
2539,
15506,
1043,
287,
2581,
13,
18851,
13,
220,
7559,
12286,
15506,
815,
307,
257,
1994,
287,
7559,
404,
912,
15506,
198,
220,
220,
220,
326,
338,
973,
611,
2147,
922,
318,
1043,
287,
2581,
13,
18851,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
3689,
7,
944,
11,
2581,
11,
1994,
11,
4277,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
262,
357,
18076,
11,
3670,
8,
5166,
356,
765,
1864,
284,
262,
2581,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1994,
287,
2581,
13,
18851,
290,
357,
25927,
13,
18851,
58,
2539,
60,
287,
2116,
13,
404,
912,
62,
11600,
393,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2581,
13,
18851,
58,
2539,
60,
287,
2116,
13,
2302,
8847,
62,
11600,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2172,
796,
2581,
13,
18851,
58,
2539,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2172,
796,
4277,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2172,
287,
2116,
13,
404,
912,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3670,
796,
2116,
13,
404,
912,
62,
11600,
58,
8738,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3670,
796,
2116,
13,
2302,
8847,
62,
11600,
58,
8738,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2172,
11,
3670,
628,
220,
220,
220,
825,
477,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
257,
1336,
16855,
286,
1391,
18076,
25,
42517,
893,
316,
92,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
8633,
19510,
3245,
11,
2116,
13,
24455,
7,
3245,
4008,
329,
2214,
287,
8633,
7,
944,
13,
404,
912,
4008,
628,
220,
220,
220,
825,
8106,
7,
944,
11,
2214,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
262,
42517,
893,
316,
329,
262,
1813,
2214,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
651,
35226,
7,
944,
11,
705,
24455,
23330,
15,
92,
4458,
18982,
7,
3245,
4008,
3419,
628,
198,
7206,
38865,
62,
37,
12115,
62,
2200,
6489,
2246,
12529,
62,
34219,
796,
31051,
4033,
26448,
14,
5908,
16496,
14,
69,
20980,
12,
2860,
12,
684,
14,
6,
198,
37,
12115,
62,
2200,
6489,
2246,
12529,
62,
50,
7397,
796,
705,
19796,
12,
35666,
5592,
6,
628,
628,
198,
4871,
3060,
261,
16424,
35608,
259,
7,
15252,
2599,
198,
220,
220,
220,
37227,
35608,
259,
7268,
2446,
284,
19818,
262,
2560,
751,
12,
261,
2134,
526,
15931,
628,
220,
220,
220,
825,
651,
62,
48078,
62,
15252,
7,
944,
11,
7170,
62,
37724,
28,
14202,
11,
35847,
11639,
48078,
62,
79,
74,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
262,
2560,
3060,
261,
2134,
1262,
262,
10289,
11507,
3804,
198,
220,
220,
220,
220,
220,
220,
220,
284,
262,
1570,
13,
628,
220,
220,
220,
220,
220,
220,
220,
4600,
525,
3411,
62,
37724,
63,
460,
307,
779,
3804,
284,
1487,
543,
7170,
198,
220,
220,
220,
220,
220,
220,
220,
6097,
262,
2560,
1570,
2617,
481,
307,
973,
618,
11046,
262,
3060,
261,
2134,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4306,
3060,
261,
7680,
7248,
13,
525,
3411,
62,
37724,
481,
307,
973,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
35226,
7,
944,
11,
705,
48078,
62,
15252,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
48078,
62,
15252,
628,
220,
220,
220,
220,
220,
220,
220,
611,
7170,
62,
37724,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7170,
62,
37724,
796,
3060,
261,
7680,
7248,
13,
525,
3411,
62,
37724,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
48078,
62,
15252,
796,
3060,
261,
7680,
7248,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2581,
28,
944,
13,
25927,
11,
7170,
62,
37724,
28,
525,
3411,
62,
37724,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
86,
22046,
34758,
6,
79,
74,
10354,
2116,
13,
46265,
22046,
58,
5460,
929,
48999,
737,
1136,
62,
15252,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
48078,
62,
15252,
628,
628,
628,
628,
198,
198,
4871,
3082,
265,
37961,
7680,
7,
8053,
2969,
3824,
769,
2599,
198,
220,
220,
220,
37227,
1212,
1570,
318,
973,
416,
16802,
523,
340,
338,
2854,
12,
34666,
13,
628,
220,
220,
220,
3887,
2046,
12792,
5456,
7007,
262,
1351,
286,
23170,
1460,
5561,
13,
1752,
583,
1110,
13,
198,
220,
220,
220,
16802,
7007,
262,
23170,
1460,
2884,
257,
1351,
286,
19348,
47954,
543,
1838,
40918,
198,
220,
220,
220,
1327,
780,
262,
12291,
286,
1744,
19348,
2389,
17790,
2948,
514,
284,
198,
220,
220,
220,
2391,
751,
617,
13526,
12,
66,
8103,
290,
4433,
514,
284,
10568,
12940,
12,
3927,
274,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
42517,
893,
316,
796,
3082,
265,
37961,
13,
48205,
13,
439,
3419,
198,
220,
220,
220,
11389,
7509,
62,
4871,
796,
3082,
265,
37961,
32634,
7509,
628,
220,
220,
220,
2488,
4871,
24396,
198,
220,
220,
220,
825,
355,
62,
1177,
7,
565,
82,
11,
12429,
15003,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
464,
7824,
318,
1100,
12,
8807,
523,
356,
460,
1210,
572,
17226,
7007,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1729,
62,
47116,
62,
8897,
3558,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
40073,
37961,
7680,
11,
537,
82,
737,
292,
62,
1177,
7,
1174,
15003,
46265,
22046,
4008,
628
] | 2.933119 | 1,869 |
"""
Created by Rohan Paleja on September 23, 2019
Nikolaidis et. al. benchmark
"""
import torch
import torch.nn.functional as F
# sys.path.insert(0, '/home/Anonymous/PycharmProjects/bayesian_prolo')
import numpy as np
import pickle
from torch.autograd import Variable
from utils.naive_utils import load_in_naive_data, find_which_schedule_this_belongs_to
from utils.hri_utils import save_performance_results
from sklearn.cluster import KMeans
from scheduling.methods.train_autoencoder import Autoencoder, AutoEncoderTrain
# sys.path.insert(0, '../')
import itertools
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
torch.manual_seed(0)
np.random.seed(0)
from scheduling.methods.NN_naive import NNSmall
# noinspection PyTypeChecker,PyArgumentList
class NNTrain:
"""
class structure to train the NN for a certain amount of schedules.
This class handles training the NN, evaluating the NN, and saving the results
"""
@staticmethod
def cluster_matrices(matrices, num_schedules):
"""
clusters the matrix schedules
:param matrices:
:param num_schedules:
:return:
"""
# vectorize each matrix
vectorized_set = []
for i in matrices:
vectorized = i.reshape(20 * 2048, 1)
vectorized_set.append(vectorized)
kmeans = KMeans(n_clusters=3, random_state=0) # random state makes it deterministic
# Fitting the input data
new_set = np.hstack(tuple(vectorized_set)).reshape(num_schedules, 20 * 2048)
kmeans_model = kmeans.fit(np.asarray(new_set))
labels = kmeans_model.predict(np.asarray(new_set))
return kmeans_model, labels
def train(self):
"""
Trains NN.
Randomly samples a schedule and timestep within that schedule, and passes in the corresponding data in an attempt to classify which task was scheduled
:return:
"""
epochs = 200000 * 3
for epoch in range(epochs):
# sample a timestep before the cutoff for cross_validation
rand_timestep_within_sched = np.random.randint(len(self.X_train_naive))
input_nn = self.X_train_naive[rand_timestep_within_sched]
truth_nn = self.Y_train_naive[rand_timestep_within_sched]
which_schedule = find_which_schedule_this_belongs_to(self.schedule_array_train_naive, rand_timestep_within_sched+self.sample_min)
cluster_num = self.label[which_schedule]
# iterate over pairwise comparisons
if torch.cuda.is_available():
input_nn = Variable(torch.Tensor(np.asarray(input_nn).reshape(1, 242)).cuda()) # change to 5 to increase batch size
truth = Variable(torch.Tensor(np.asarray(truth_nn).reshape(1)).cuda().long())
else:
input_nn = Variable(torch.Tensor(np.asarray(input_nn).reshape(1, 242)))
truth = Variable(torch.Tensor(np.asarray(truth_nn).reshape(1)).long())
self.optimizers[cluster_num].zero_grad()
output = self.models[cluster_num].forward(input_nn)
loss = F.cross_entropy(output, truth)
loss.backward()
# torch.nn.utils.clip_grad_norm_(self.model.parameters(), 0.5)
self.optimizers[cluster_num].step()
self.total_loss_array.append(loss.item())
if epoch % 500 == 499:
print('loss at', epoch, ', total loss (average for each 100, averaged)', np.mean(self.total_loss_array[-100:]))
# self.save_trained_nets(str(epoch))
@staticmethod
def create_iterables():
"""
adds all possible state combinations
:return:
"""
iterables = [[0, 1], [0, 1], [0, 1],
[0, 1], [0, 1], [0, 1],
[0, 1], [0, 1], [0, 1],
[0, 1], [0, 1]]
states = []
for t in itertools.product(*iterables):
states.append(t)
return states
def pass_in_embedding_out_state_ID(self, states, binary):
"""
pass in a binary embedding, and itll return the state id
:param states
:param binary:
:return:
"""
binary_as_tuple = tuple(binary)
index = states.index(binary_as_tuple)
return index
def evaluate_on_test_data(self):
"""
Evaluate performance of a trained network.
This is tested on 20% of the data and will be stored in a text file.
:return:
"""
# confusion_matrix = np.zeros((20,20))
autoencoder_class = AutoEncoderTrain(self.num_schedules)
checkpoint = torch.load('/home/Anonymous/PycharmProjects/bayesian_prolo/scheduling_env/models/Autoencoder150.tar')
autoencoder_class.model.load_state_dict(checkpoint['nn_state_dict'])
states = self.create_iterables()
prediction_accuracy = [0, 0]
percentage_accuracy_top1 = []
percentage_accuracy_top3 = []
mean_input = [1.3277743, 0.32837677, 1.4974482, -1.3519306, -0.64621973, 0.10534518, -2.338118, -2.7345326, 1.7558736, -3.0746384, -3.485554]
for i, schedule in enumerate(self.schedule_array_test_naive):
current_schedule_matrix = np.zeros((2048, 20))
for count in range(schedule[0]-self.sample_test_min, schedule[1]-self.sample_test_min + 1):
if current_schedule_matrix.sum() == 0:
cluster_num = self.kmeans_model.predict(current_schedule_matrix.reshape(1, -1))
else:
matrix = np.divide(current_schedule_matrix, current_schedule_matrix.sum())
cluster_num = self.kmeans_model.predict(matrix.reshape(1, -1))
net_input = self.X_test_naive[count]
truth = self.Y_test_naive[count]
if torch.cuda.is_available():
input_nn = Variable(torch.Tensor(np.asarray(net_input).reshape(1, 242)).cuda())
truth = Variable(torch.Tensor(np.asarray(truth).reshape(1)).cuda().long())
else:
input_nn = Variable(torch.Tensor(np.asarray(net_input).reshape(1, 242)))
truth = Variable(torch.Tensor(np.asarray(truth).reshape(1)))
# forward
output = self.models[int(cluster_num)].forward(input_nn)
index = torch.argmax(output).item()
# confusion_matrix[truth][index] += 1
# top 3
_, top_three = torch.topk(output, 3)
if index == truth.item():
prediction_accuracy[0] += 1
if truth.item() in top_three.detach().cpu().tolist()[0]:
prediction_accuracy[1] += 1
# update matrix
embedding_copy = np.zeros((1, 11))
input_element = autoencoder_class.model.forward_only_encoding(input_nn)
for z, each_element in enumerate(mean_input):
if each_element > input_element[0][z].item():
embedding_copy[0][z] = 0
else:
embedding_copy[0][z] = 1
index = self.pass_in_embedding_out_state_ID(states, embedding_copy[0])
action = truth.item()
current_schedule_matrix[index][int(action)] += 1
print('Prediction Accuracy: top1: ', prediction_accuracy[0] / 20, ' top3: ', prediction_accuracy[1] / 20)
print('schedule num:', i)
percentage_accuracy_top1.append(prediction_accuracy[0] / 20)
percentage_accuracy_top3.append(prediction_accuracy[1] / 20)
prediction_accuracy = [0, 0]
print(np.mean(percentage_accuracy_top1))
# save_performance_results(percentage_accuracy_top1, percentage_accuracy_top3, 'kmeans_to_NN_naive')
return np.mean(percentage_accuracy_top1)
def save_trained_nets(self, name):
"""
saves the model
:return:
"""
torch.save({'nn1_state_dict': self.models[0].state_dict(),
'nn2_state_dict': self.models[1].state_dict(),
'nn3_state_dict': self.models[2].state_dict()},
'/home/Anonymous/PycharmProjects/bayesian_prolo/scheduling_env/models/k_means_NN_' + name + '.tar')
def main():
"""
entry point for file
:return:
"""
res = []
for i in range(3):
trainer = NNTrain()
trainer.train()
out = trainer.evaluate_on_test_data()
res.append(out)
print(np.mean(res))
print(np.std(res))
if __name__ == '__main__':
main()
| [
37811,
198,
41972,
416,
371,
22436,
21706,
6592,
319,
2693,
2242,
11,
13130,
198,
40979,
349,
1698,
271,
2123,
13,
435,
13,
18335,
198,
37811,
198,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
198,
2,
25064,
13,
6978,
13,
28463,
7,
15,
11,
31051,
11195,
14,
20660,
14,
20519,
354,
1670,
16775,
82,
14,
24406,
35610,
62,
1676,
5439,
11537,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2298,
293,
198,
6738,
28034,
13,
2306,
519,
6335,
1330,
35748,
198,
6738,
3384,
4487,
13,
2616,
425,
62,
26791,
1330,
3440,
62,
259,
62,
2616,
425,
62,
7890,
11,
1064,
62,
4758,
62,
15952,
5950,
62,
5661,
62,
6667,
28079,
62,
1462,
198,
6738,
3384,
4487,
13,
71,
380,
62,
26791,
1330,
3613,
62,
26585,
62,
43420,
198,
6738,
1341,
35720,
13,
565,
5819,
1330,
509,
5308,
504,
198,
6738,
26925,
13,
24396,
82,
13,
27432,
62,
2306,
6571,
66,
12342,
1330,
5231,
6571,
66,
12342,
11,
11160,
27195,
12342,
44077,
198,
2,
25064,
13,
6978,
13,
28463,
7,
15,
11,
705,
40720,
11537,
198,
11748,
340,
861,
10141,
198,
198,
13165,
354,
13,
1891,
2412,
13,
66,
463,
20471,
13,
67,
2357,
49228,
796,
6407,
198,
13165,
354,
13,
1891,
2412,
13,
66,
463,
20471,
13,
26968,
4102,
796,
10352,
198,
13165,
354,
13,
805,
723,
62,
28826,
7,
15,
8,
198,
37659,
13,
25120,
13,
28826,
7,
15,
8,
198,
6738,
26925,
13,
24396,
82,
13,
6144,
62,
2616,
425,
1330,
399,
45,
18712,
628,
198,
2,
645,
1040,
14978,
9485,
6030,
9787,
263,
11,
20519,
28100,
1713,
8053,
198,
4871,
399,
45,
44077,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1398,
4645,
284,
4512,
262,
399,
45,
329,
257,
1728,
2033,
286,
24025,
13,
198,
220,
220,
220,
770,
1398,
17105,
3047,
262,
399,
45,
11,
22232,
262,
399,
45,
11,
290,
8914,
262,
2482,
198,
220,
220,
220,
37227,
628,
198,
220,
220,
220,
2488,
12708,
24396,
198,
220,
220,
220,
825,
13946,
62,
6759,
45977,
7,
6759,
45977,
11,
997,
62,
1416,
704,
5028,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
23163,
262,
17593,
24025,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2603,
45977,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
997,
62,
1416,
704,
5028,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
15879,
1096,
1123,
17593,
198,
220,
220,
220,
220,
220,
220,
220,
15879,
1143,
62,
2617,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
2603,
45977,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15879,
1143,
796,
1312,
13,
3447,
1758,
7,
1238,
1635,
36117,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15879,
1143,
62,
2617,
13,
33295,
7,
31364,
1143,
8,
198,
220,
220,
220,
220,
220,
220,
220,
479,
1326,
504,
796,
509,
5308,
504,
7,
77,
62,
565,
13654,
28,
18,
11,
4738,
62,
5219,
28,
15,
8,
220,
1303,
4738,
1181,
1838,
340,
2206,
49228,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
376,
2535,
262,
5128,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
2617,
796,
45941,
13,
71,
25558,
7,
83,
29291,
7,
31364,
1143,
62,
2617,
29720,
3447,
1758,
7,
22510,
62,
1416,
704,
5028,
11,
1160,
1635,
36117,
8,
198,
220,
220,
220,
220,
220,
220,
220,
479,
1326,
504,
62,
19849,
796,
479,
1326,
504,
13,
11147,
7,
37659,
13,
292,
18747,
7,
3605,
62,
2617,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
14722,
796,
479,
1326,
504,
62,
19849,
13,
79,
17407,
7,
37659,
13,
292,
18747,
7,
3605,
62,
2617,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
479,
1326,
504,
62,
19849,
11,
14722,
628,
220,
220,
220,
825,
4512,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
833,
1299,
399,
45,
13,
198,
220,
220,
220,
220,
220,
220,
220,
14534,
306,
8405,
257,
7269,
290,
4628,
395,
538,
1626,
326,
7269,
11,
290,
8318,
287,
262,
11188,
1366,
287,
281,
2230,
284,
36509,
543,
4876,
373,
7530,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
36835,
82,
796,
939,
830,
1635,
513,
628,
220,
220,
220,
220,
220,
220,
220,
329,
36835,
287,
2837,
7,
538,
5374,
82,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6291,
257,
4628,
395,
538,
878,
262,
45616,
329,
3272,
62,
12102,
341,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43720,
62,
16514,
395,
538,
62,
33479,
62,
1416,
704,
796,
45941,
13,
25120,
13,
25192,
600,
7,
11925,
7,
944,
13,
55,
62,
27432,
62,
2616,
425,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
20471,
796,
2116,
13,
55,
62,
27432,
62,
2616,
425,
58,
25192,
62,
16514,
395,
538,
62,
33479,
62,
1416,
704,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3872,
62,
20471,
796,
2116,
13,
56,
62,
27432,
62,
2616,
425,
58,
25192,
62,
16514,
395,
538,
62,
33479,
62,
1416,
704,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
543,
62,
15952,
5950,
796,
1064,
62,
4758,
62,
15952,
5950,
62,
5661,
62,
6667,
28079,
62,
1462,
7,
944,
13,
15952,
5950,
62,
18747,
62,
27432,
62,
2616,
425,
11,
43720,
62,
16514,
395,
538,
62,
33479,
62,
1416,
704,
10,
944,
13,
39873,
62,
1084,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13946,
62,
22510,
796,
2116,
13,
18242,
58,
4758,
62,
15952,
5950,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
11629,
378,
625,
5166,
3083,
17909,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
28034,
13,
66,
15339,
13,
271,
62,
15182,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
20471,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
15414,
62,
20471,
737,
3447,
1758,
7,
16,
11,
34353,
29720,
66,
15339,
28955,
220,
1303,
1487,
284,
642,
284,
2620,
15458,
2546,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3872,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
35310,
62,
20471,
737,
3447,
1758,
7,
16,
29720,
66,
15339,
22446,
6511,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
20471,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
15414,
62,
20471,
737,
3447,
1758,
7,
16,
11,
34353,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3872,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
35310,
62,
20471,
737,
3447,
1758,
7,
16,
29720,
6511,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
40085,
11341,
58,
565,
5819,
62,
22510,
4083,
22570,
62,
9744,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
796,
2116,
13,
27530,
58,
565,
5819,
62,
22510,
4083,
11813,
7,
15414,
62,
20471,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2994,
796,
376,
13,
19692,
62,
298,
28338,
7,
22915,
11,
3872,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2994,
13,
1891,
904,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
28034,
13,
20471,
13,
26791,
13,
15036,
62,
9744,
62,
27237,
41052,
944,
13,
19849,
13,
17143,
7307,
22784,
657,
13,
20,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
40085,
11341,
58,
565,
5819,
62,
22510,
4083,
9662,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
23350,
62,
22462,
62,
18747,
13,
33295,
7,
22462,
13,
9186,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
36835,
4064,
5323,
6624,
48391,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
22462,
379,
3256,
36835,
11,
46083,
2472,
2994,
357,
23913,
329,
1123,
1802,
11,
16449,
8,
3256,
45941,
13,
32604,
7,
944,
13,
23350,
62,
22462,
62,
18747,
58,
12,
3064,
47715,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2116,
13,
21928,
62,
35311,
62,
45938,
7,
2536,
7,
538,
5374,
4008,
628,
220,
220,
220,
2488,
12708,
24396,
198,
220,
220,
220,
825,
2251,
62,
2676,
2977,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6673,
477,
1744,
1181,
17790,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
2977,
796,
16410,
15,
11,
352,
4357,
685,
15,
11,
352,
4357,
685,
15,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
352,
4357,
685,
15,
11,
352,
4357,
685,
15,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
352,
4357,
685,
15,
11,
352,
4357,
685,
15,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
352,
4357,
685,
15,
11,
352,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
2585,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
256,
287,
340,
861,
10141,
13,
11167,
46491,
2676,
2977,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2585,
13,
33295,
7,
83,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2585,
628,
220,
220,
220,
825,
1208,
62,
259,
62,
20521,
12083,
62,
448,
62,
5219,
62,
2389,
7,
944,
11,
2585,
11,
13934,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1208,
287,
257,
13934,
11525,
12083,
11,
290,
340,
297,
1441,
262,
1181,
4686,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2585,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
13934,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13934,
62,
292,
62,
83,
29291,
796,
46545,
7,
39491,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6376,
796,
2585,
13,
9630,
7,
39491,
62,
292,
62,
83,
29291,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6376,
628,
220,
220,
220,
825,
13446,
62,
261,
62,
9288,
62,
7890,
7,
944,
2599,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
26439,
4985,
2854,
286,
257,
8776,
3127,
13,
198,
220,
220,
220,
220,
220,
220,
220,
770,
318,
6789,
319,
1160,
4,
286,
262,
1366,
290,
481,
307,
8574,
287,
257,
2420,
2393,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
10802,
62,
6759,
8609,
796,
45941,
13,
9107,
418,
19510,
1238,
11,
1238,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1960,
6571,
66,
12342,
62,
4871,
796,
11160,
27195,
12342,
44077,
7,
944,
13,
22510,
62,
1416,
704,
5028,
8,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
796,
28034,
13,
2220,
10786,
14,
11195,
14,
20660,
14,
20519,
354,
1670,
16775,
82,
14,
24406,
35610,
62,
1676,
5439,
14,
1416,
704,
16619,
62,
24330,
14,
27530,
14,
16541,
6571,
66,
12342,
8628,
13,
18870,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1960,
6571,
66,
12342,
62,
4871,
13,
19849,
13,
2220,
62,
5219,
62,
11600,
7,
9122,
4122,
17816,
20471,
62,
5219,
62,
11600,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2585,
796,
2116,
13,
17953,
62,
2676,
2977,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
17724,
62,
4134,
23843,
796,
685,
15,
11,
657,
60,
198,
220,
220,
220,
220,
220,
220,
220,
5873,
62,
4134,
23843,
62,
4852,
16,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
5873,
62,
4134,
23843,
62,
4852,
18,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
1612,
62,
15414,
796,
685,
16,
13,
34159,
3324,
3559,
11,
657,
13,
34256,
2718,
40179,
11,
352,
13,
38073,
2598,
6469,
11,
532,
16,
13,
2327,
1129,
20548,
11,
532,
15,
13,
2414,
5237,
40220,
11,
657,
13,
940,
4310,
2231,
1507,
11,
532,
17,
13,
28460,
16817,
11,
532,
17,
13,
4790,
36625,
2075,
11,
352,
13,
2425,
44617,
2623,
11,
532,
18,
13,
2998,
3510,
22842,
11,
532,
18,
13,
2780,
2816,
4051,
60,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
7269,
287,
27056,
378,
7,
944,
13,
15952,
5950,
62,
18747,
62,
9288,
62,
2616,
425,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
15952,
5950,
62,
6759,
8609,
796,
45941,
13,
9107,
418,
19510,
1238,
2780,
11,
1160,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
954,
287,
2837,
7,
15952,
5950,
58,
15,
45297,
944,
13,
39873,
62,
9288,
62,
1084,
11,
7269,
58,
16,
45297,
944,
13,
39873,
62,
9288,
62,
1084,
1343,
352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1459,
62,
15952,
5950,
62,
6759,
8609,
13,
16345,
3419,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13946,
62,
22510,
796,
2116,
13,
74,
1326,
504,
62,
19849,
13,
79,
17407,
7,
14421,
62,
15952,
5950,
62,
6759,
8609,
13,
3447,
1758,
7,
16,
11,
532,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17593,
796,
45941,
13,
7146,
485,
7,
14421,
62,
15952,
5950,
62,
6759,
8609,
11,
1459,
62,
15952,
5950,
62,
6759,
8609,
13,
16345,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13946,
62,
22510,
796,
2116,
13,
74,
1326,
504,
62,
19849,
13,
79,
17407,
7,
6759,
8609,
13,
3447,
1758,
7,
16,
11,
532,
16,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2010,
62,
15414,
796,
2116,
13,
55,
62,
9288,
62,
2616,
425,
58,
9127,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3872,
796,
2116,
13,
56,
62,
9288,
62,
2616,
425,
58,
9127,
60,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
28034,
13,
66,
15339,
13,
271,
62,
15182,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
20471,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
3262,
62,
15414,
737,
3447,
1758,
7,
16,
11,
34353,
29720,
66,
15339,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3872,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
35310,
737,
3447,
1758,
7,
16,
29720,
66,
15339,
22446,
6511,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
20471,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
3262,
62,
15414,
737,
3447,
1758,
7,
16,
11,
34353,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3872,
796,
35748,
7,
13165,
354,
13,
51,
22854,
7,
37659,
13,
292,
18747,
7,
35310,
737,
3447,
1758,
7,
16,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2651,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
796,
2116,
13,
27530,
58,
600,
7,
565,
5819,
62,
22510,
25295,
11813,
7,
15414,
62,
20471,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6376,
796,
28034,
13,
853,
9806,
7,
22915,
737,
9186,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10802,
62,
6759,
8609,
58,
35310,
7131,
9630,
60,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1353,
513,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
11,
1353,
62,
15542,
796,
28034,
13,
4852,
74,
7,
22915,
11,
513,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6376,
6624,
3872,
13,
9186,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17724,
62,
4134,
23843,
58,
15,
60,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
3872,
13,
9186,
3419,
287,
1353,
62,
15542,
13,
15255,
620,
22446,
36166,
22446,
83,
349,
396,
3419,
58,
15,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17724,
62,
4134,
23843,
58,
16,
60,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4296,
17593,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11525,
12083,
62,
30073,
796,
45941,
13,
9107,
418,
19510,
16,
11,
1367,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
30854,
796,
1960,
6571,
66,
12342,
62,
4871,
13,
19849,
13,
11813,
62,
8807,
62,
12685,
7656,
7,
15414,
62,
20471,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1976,
11,
1123,
62,
30854,
287,
27056,
378,
7,
32604,
62,
15414,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1123,
62,
30854,
1875,
5128,
62,
30854,
58,
15,
7131,
89,
4083,
9186,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11525,
12083,
62,
30073,
58,
15,
7131,
89,
60,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11525,
12083,
62,
30073,
58,
15,
7131,
89,
60,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6376,
796,
2116,
13,
6603,
62,
259,
62,
20521,
12083,
62,
448,
62,
5219,
62,
2389,
7,
27219,
11,
11525,
12083,
62,
30073,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
3872,
13,
9186,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
15952,
5950,
62,
6759,
8609,
58,
9630,
7131,
600,
7,
2673,
15437,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
39156,
2867,
33222,
25,
1353,
16,
25,
46083,
17724,
62,
4134,
23843,
58,
15,
60,
1220,
1160,
11,
705,
1353,
18,
25,
46083,
17724,
62,
4134,
23843,
58,
16,
60,
1220,
1160,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
15952,
5950,
997,
25,
3256,
1312,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5873,
62,
4134,
23843,
62,
4852,
16,
13,
33295,
7,
28764,
2867,
62,
4134,
23843,
58,
15,
60,
1220,
1160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5873,
62,
4134,
23843,
62,
4852,
18,
13,
33295,
7,
28764,
2867,
62,
4134,
23843,
58,
16,
60,
1220,
1160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17724,
62,
4134,
23843,
796,
685,
15,
11,
657,
60,
628,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
37659,
13,
32604,
7,
25067,
496,
62,
4134,
23843,
62,
4852,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
26585,
62,
43420,
7,
25067,
496,
62,
4134,
23843,
62,
4852,
16,
11,
5873,
62,
4134,
23843,
62,
4852,
18,
11,
705,
74,
1326,
504,
62,
1462,
62,
6144,
62,
2616,
425,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
45941,
13,
32604,
7,
25067,
496,
62,
4134,
23843,
62,
4852,
16,
8,
628,
220,
220,
220,
825,
3613,
62,
35311,
62,
45938,
7,
944,
11,
1438,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16031,
262,
2746,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
28034,
13,
21928,
15090,
6,
20471,
16,
62,
5219,
62,
11600,
10354,
2116,
13,
27530,
58,
15,
4083,
5219,
62,
11600,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
20471,
17,
62,
5219,
62,
11600,
10354,
2116,
13,
27530,
58,
16,
4083,
5219,
62,
11600,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
20471,
18,
62,
5219,
62,
11600,
10354,
2116,
13,
27530,
58,
17,
4083,
5219,
62,
11600,
3419,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31051,
11195,
14,
20660,
14,
20519,
354,
1670,
16775,
82,
14,
24406,
35610,
62,
1676,
5439,
14,
1416,
704,
16619,
62,
24330,
14,
27530,
14,
74,
62,
1326,
504,
62,
6144,
62,
6,
1343,
1438,
1343,
45302,
18870,
11537,
628,
198,
4299,
1388,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5726,
966,
329,
2393,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
581,
796,
17635,
198,
220,
220,
220,
329,
1312,
287,
2837,
7,
18,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
21997,
796,
399,
45,
44077,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
21997,
13,
27432,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
21997,
13,
49786,
62,
261,
62,
9288,
62,
7890,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
581,
13,
33295,
7,
448,
8,
198,
220,
220,
220,
3601,
7,
37659,
13,
32604,
7,
411,
4008,
198,
220,
220,
220,
3601,
7,
37659,
13,
19282,
7,
411,
4008,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.114611 | 4,127 |
#!/usr/bin/env python3
import argparse
import serial
import time
from time import sleep
import datetime
parser = argparse.ArgumentParser()
parser.add_argument('port')
args = parser.parse_args()
sleep_time = 50
ser = serial.Serial(args.port, 9600)
sleep(3)
send('Button LCLICK', 0.1)
try:
while 1:
candyCorrect()
except KeyboardInterrupt:
send('RELEASE')
ser.close()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
201,
198,
11748,
1822,
29572,
201,
198,
11748,
11389,
201,
198,
11748,
640,
201,
198,
6738,
640,
1330,
3993,
201,
198,
11748,
4818,
8079,
201,
198,
201,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
201,
198,
48610,
13,
2860,
62,
49140,
10786,
634,
11537,
201,
198,
22046,
796,
30751,
13,
29572,
62,
22046,
3419,
201,
198,
201,
198,
42832,
62,
2435,
796,
2026,
201,
198,
201,
198,
2655,
796,
11389,
13,
32634,
7,
22046,
13,
634,
11,
860,
8054,
8,
201,
198,
201,
198,
201,
198,
201,
198,
42832,
7,
18,
8,
201,
198,
21280,
10786,
21864,
406,
5097,
11860,
3256,
657,
13,
16,
8,
201,
198,
201,
198,
28311,
25,
201,
198,
220,
220,
220,
981,
352,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
18550,
42779,
3419,
201,
198,
201,
198,
16341,
31973,
9492,
3622,
25,
201,
198,
220,
220,
220,
3758,
10786,
2200,
22781,
11537,
201,
198,
220,
220,
220,
1055,
13,
19836,
3419,
201,
198
] | 2.433526 | 173 |
import json
import torch
from torchvision import datasets, transforms
from PIL import Image
# Define function to read cat names
# Define function to read data
# Define processing testing image function
def process_image(image):
''' Scales, crops, and normalizes a PIL image for a PyTorch model,
returns an Numpy array
'''
# TODO: Process a PIL image for use in a PyTorch model
# Resize and crop image
im = Image.open(image)
preprocess = transforms.Compose([transforms.Resize(255),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406],
[0.229, 0.224, 0.225])])
im_tensor = preprocess(im)
im_tensor.unsqueeze_(0)
return im_tensor
# Define prediction function
def predict(image_path, model, topk, device, cat_to_name):
''' Predict the class (or classes) of an image using a trained deep learning model.
'''
model.to(device)
model.eval()
# TODO: Implement the code to predict the class from an image file
img = process_image(image_path)
img = img.to(device)
output = model.forward(img)
ps = torch.exp(output)
probs, idxs = ps.topk(topk)
idx_to_class = dict((v,k) for k, v in model.classifier.class_to_idx.items())
classes = [v for k, v in idx_to_class.items() if k in idxs.to('cpu').numpy()]
if cat_to_name:
classes = [cat_to_name[str(i + 1)] for c, i in \
model.classifier.class_to_idx.items() if c in classes]
print('Probabilities:', probs.data.cpu().numpy()[0].tolist())
print('Classes:', classes) | [
11748,
33918,
198,
11748,
28034,
198,
6738,
28034,
10178,
1330,
40522,
11,
31408,
198,
6738,
350,
4146,
1330,
7412,
198,
198,
2,
2896,
500,
2163,
284,
1100,
3797,
3891,
198,
198,
2,
2896,
500,
2163,
284,
1100,
1366,
198,
198,
2,
2896,
500,
7587,
4856,
2939,
2163,
198,
4299,
1429,
62,
9060,
7,
9060,
2599,
198,
220,
220,
220,
705,
7061,
1446,
2040,
11,
14450,
11,
290,
3487,
4340,
257,
350,
4146,
2939,
329,
257,
9485,
15884,
354,
2746,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5860,
281,
399,
32152,
7177,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1303,
16926,
46,
25,
10854,
257,
350,
4146,
2939,
329,
779,
287,
257,
9485,
15884,
354,
2746,
198,
220,
220,
220,
1303,
1874,
1096,
290,
13833,
2939,
198,
220,
220,
220,
545,
796,
7412,
13,
9654,
7,
9060,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
662,
14681,
796,
31408,
13,
7293,
577,
26933,
7645,
23914,
13,
4965,
1096,
7,
13381,
828,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
23656,
34,
1773,
7,
24137,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
2514,
51,
22854,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
26447,
1096,
26933,
15,
13,
32642,
11,
657,
13,
29228,
11,
657,
13,
29703,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
13,
23539,
11,
657,
13,
24137,
11,
657,
13,
18182,
12962,
12962,
198,
220,
220,
220,
220,
198,
220,
220,
220,
545,
62,
83,
22854,
796,
662,
14681,
7,
320,
8,
198,
220,
220,
220,
545,
62,
83,
22854,
13,
13271,
421,
1453,
2736,
41052,
15,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
545,
62,
83,
22854,
198,
198,
2,
2896,
500,
17724,
2163,
220,
198,
4299,
4331,
7,
9060,
62,
6978,
11,
2746,
11,
1353,
74,
11,
3335,
11,
3797,
62,
1462,
62,
3672,
2599,
198,
220,
220,
220,
705,
7061,
49461,
262,
1398,
357,
273,
6097,
8,
286,
281,
2939,
1262,
257,
8776,
2769,
4673,
2746,
13,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
2746,
13,
1462,
7,
25202,
8,
198,
220,
220,
220,
2746,
13,
18206,
3419,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
16926,
46,
25,
48282,
262,
2438,
284,
4331,
262,
1398,
422,
281,
2939,
2393,
198,
220,
220,
220,
33705,
796,
1429,
62,
9060,
7,
9060,
62,
6978,
8,
198,
220,
220,
220,
33705,
796,
33705,
13,
1462,
7,
25202,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
5072,
796,
2746,
13,
11813,
7,
9600,
8,
198,
220,
220,
220,
26692,
796,
28034,
13,
11201,
7,
22915,
8,
220,
220,
220,
220,
198,
220,
220,
220,
386,
1443,
11,
4686,
34223,
796,
26692,
13,
4852,
74,
7,
4852,
74,
8,
628,
220,
220,
220,
4686,
87,
62,
1462,
62,
4871,
796,
8633,
19510,
85,
11,
74,
8,
329,
479,
11,
410,
287,
2746,
13,
4871,
7483,
13,
4871,
62,
1462,
62,
312,
87,
13,
23814,
28955,
198,
220,
220,
220,
6097,
796,
685,
85,
329,
479,
11,
410,
287,
4686,
87,
62,
1462,
62,
4871,
13,
23814,
3419,
611,
479,
287,
4686,
34223,
13,
1462,
10786,
36166,
27691,
77,
32152,
3419,
60,
198,
220,
220,
220,
220,
198,
220,
220,
220,
611,
3797,
62,
1462,
62,
3672,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6097,
796,
685,
9246,
62,
1462,
62,
3672,
58,
2536,
7,
72,
1343,
352,
15437,
329,
269,
11,
1312,
287,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
13,
4871,
7483,
13,
4871,
62,
1462,
62,
312,
87,
13,
23814,
3419,
611,
269,
287,
6097,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
3601,
10786,
2964,
65,
5738,
25,
3256,
386,
1443,
13,
7890,
13,
36166,
22446,
77,
32152,
3419,
58,
15,
4083,
83,
349,
396,
28955,
198,
220,
220,
220,
3601,
10786,
9487,
274,
25,
3256,
6097,
8
] | 2.197789 | 814 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests the graph freezing tool."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
from absl.testing import parameterized
from tensorflow.core.example import example_pb2
from tensorflow.core.framework import graph_pb2
from tensorflow.core.protobuf import saver_pb2
from tensorflow.python.client import session
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import graph_io
from tensorflow.python.framework import importer
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import nn
from tensorflow.python.ops import parsing_ops
from tensorflow.python.ops import partitioned_variables
from tensorflow.python.ops import variable_scope
from tensorflow.python.ops import variables
from tensorflow.python.platform import test
from tensorflow.python.saved_model import builder as saved_model_builder
from tensorflow.python.saved_model import signature_constants
from tensorflow.python.saved_model import signature_def_utils
from tensorflow.python.saved_model import tag_constants
from tensorflow.python.tools import freeze_graph
from tensorflow.python.training import saver as saver_lib
if __name__ == "__main__":
test.main()
| [
2,
15069,
1853,
383,
309,
22854,
37535,
46665,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
2,
38093,
25609,
28,
198,
37811,
51,
3558,
262,
4823,
20884,
2891,
526,
15931,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
28686,
198,
11748,
302,
198,
198,
6738,
2352,
75,
13,
33407,
1330,
11507,
1143,
198,
198,
6738,
11192,
273,
11125,
13,
7295,
13,
20688,
1330,
1672,
62,
40842,
17,
198,
6738,
11192,
273,
11125,
13,
7295,
13,
30604,
1330,
4823,
62,
40842,
17,
198,
6738,
11192,
273,
11125,
13,
7295,
13,
11235,
672,
3046,
1330,
473,
332,
62,
40842,
17,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
16366,
1330,
6246,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
30604,
1330,
288,
19199,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
30604,
1330,
4823,
62,
952,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
30604,
1330,
848,
4337,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
30604,
1330,
39628,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
30604,
1330,
1332,
62,
22602,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
2840,
1330,
7177,
62,
2840,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
2840,
1330,
10688,
62,
2840,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
2840,
1330,
299,
77,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
2840,
1330,
32096,
62,
2840,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
2840,
1330,
18398,
276,
62,
25641,
2977,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
2840,
1330,
7885,
62,
29982,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
2840,
1330,
9633,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
24254,
1330,
1332,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
82,
9586,
62,
19849,
1330,
27098,
355,
7448,
62,
19849,
62,
38272,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
82,
9586,
62,
19849,
1330,
9877,
62,
9979,
1187,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
82,
9586,
62,
19849,
1330,
9877,
62,
4299,
62,
26791,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
82,
9586,
62,
19849,
1330,
7621,
62,
9979,
1187,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
31391,
1330,
16611,
62,
34960,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
34409,
1330,
473,
332,
355,
473,
332,
62,
8019,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
1332,
13,
12417,
3419,
198
] | 3.776173 | 554 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
from gmprocess.core.streamcollection import StreamCollection
from gmprocess.io.read import read_data
from gmprocess.utils.test_utils import read_data_dir
from gmprocess.waveform_processing.adjust_highpass_ridder import ridder_fchp
from gmprocess.utils.config import get_config
if __name__ == "__main__":
os.environ["CALLED_FROM_PYTEST"] = "True"
test_auto_fchp()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
28686,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
308,
76,
14681,
13,
7295,
13,
5532,
43681,
1330,
13860,
36307,
198,
6738,
308,
76,
14681,
13,
952,
13,
961,
1330,
1100,
62,
7890,
198,
6738,
308,
76,
14681,
13,
26791,
13,
9288,
62,
26791,
1330,
1100,
62,
7890,
62,
15908,
198,
6738,
308,
76,
14681,
13,
19204,
687,
62,
36948,
13,
23032,
62,
8929,
6603,
62,
6058,
1082,
1330,
5755,
1082,
62,
69,
354,
79,
198,
6738,
308,
76,
14681,
13,
26791,
13,
11250,
1330,
651,
62,
11250,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
28686,
13,
268,
2268,
14692,
34,
7036,
1961,
62,
10913,
2662,
62,
47,
56,
51,
6465,
8973,
796,
366,
17821,
1,
198,
220,
220,
220,
1332,
62,
23736,
62,
69,
354,
79,
3419,
198
] | 2.743902 | 164 |
"""
Import recipes from URLs to our database
"""
import re
import json
from txpx import background, EchoProcess
from txpx.process import LineGlueProtocol
from supperfeed.build import Recipe
LineGlueProtocol.MAX_LENGTH=10000
class ImportProcess(EchoProcess):
"""
Import a recipe by loading the json data dumped by the downloader process
"""
| [
37811,
198,
20939,
14296,
422,
32336,
284,
674,
6831,
198,
37811,
198,
11748,
302,
198,
11748,
33918,
198,
198,
6738,
27765,
8416,
1330,
4469,
11,
21455,
18709,
198,
6738,
27765,
8416,
13,
14681,
1330,
6910,
9861,
518,
19703,
4668,
198,
198,
6738,
43743,
12363,
13,
11249,
1330,
26694,
628,
198,
13949,
9861,
518,
19703,
4668,
13,
22921,
62,
43,
49494,
28,
49388,
198,
198,
4871,
17267,
18709,
7,
36,
6679,
18709,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
17267,
257,
8364,
416,
11046,
262,
33918,
1366,
24105,
416,
262,
4321,
263,
1429,
198,
220,
220,
220,
37227,
628
] | 3.544554 | 101 |
from typing import List
solution = Solution()
print(solution.groupThePeople(groupSizes = [3,3,3,3,3,1,3]))
| [
6738,
19720,
1330,
7343,
628,
198,
82,
2122,
796,
28186,
3419,
198,
4798,
7,
82,
2122,
13,
8094,
464,
8061,
7,
8094,
50,
4340,
796,
685,
18,
11,
18,
11,
18,
11,
18,
11,
18,
11,
16,
11,
18,
60,
4008,
628
] | 2.619048 | 42 |
#! /usr/bin/python3
import sys
import os
sys.path.append('../')
import numpy as np
import matplotlib.pyplot as plt
import imageio
import matplotlib.cm as cm
import time
from netCDF4 import MFDataset
import mesonh_probe as cdf
"""
test file for periodiccontainer and netcdfinterface types
- arguments : mesonh (netcdf) files to open
"""
mesonhfiles = sys.argv[slice(1,len(sys.argv))]
atm = MFDataset(mesonhfiles)
lut = cdf.BiDirectionalLUT(atm.variables['VLEV'][:,0,0])
lin = cdf.BiDirectionalLinear(atm.variables['S_N_direction'][:])
plot1, axes1 = plt.subplots(1,2)
x = np.linspace(0,160,1000)
axes1[0].plot(x, lut.to_output_space(np.linspace(0,160,1000)))
x = np.linspace(0.005,3.95,1000)
axes1[1].plot(x, lut.to_input_space(np.linspace(0.005,3.95,1000)))
plot1, axes1 = plt.subplots(1,2)
x = np.linspace(0,160,1000)
axes1[0].plot(x, lin.to_output_space(np.linspace(0,700,1000)))
x = np.linspace(0.005,3.95,1000)
axes1[1].plot(x, lin.to_input_space(np.linspace(-1,5,1000)))
plt.show(block=False)
| [
2,
0,
1220,
14629,
14,
8800,
14,
29412,
18,
198,
198,
11748,
25064,
198,
11748,
28686,
198,
17597,
13,
6978,
13,
33295,
10786,
40720,
11537,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
2939,
952,
198,
11748,
2603,
29487,
8019,
13,
11215,
355,
12067,
198,
11748,
640,
198,
198,
6738,
2010,
34,
8068,
19,
1330,
337,
26009,
265,
292,
316,
198,
11748,
18842,
261,
71,
62,
1676,
1350,
355,
269,
7568,
198,
198,
37811,
198,
9288,
2393,
329,
27458,
34924,
290,
2010,
66,
7568,
39994,
3858,
198,
220,
220,
220,
532,
7159,
1058,
18842,
261,
71,
357,
3262,
66,
7568,
8,
3696,
284,
1280,
198,
37811,
198,
198,
6880,
261,
71,
16624,
796,
25064,
13,
853,
85,
58,
48369,
7,
16,
11,
11925,
7,
17597,
13,
853,
85,
4008,
60,
198,
265,
76,
796,
337,
26009,
265,
292,
316,
7,
6880,
261,
71,
16624,
8,
198,
198,
75,
315,
220,
796,
269,
7568,
13,
23286,
35,
4154,
282,
43,
3843,
7,
265,
76,
13,
25641,
2977,
17816,
53,
2538,
53,
6,
7131,
45299,
15,
11,
15,
12962,
198,
2815,
796,
269,
7568,
13,
23286,
35,
4154,
282,
14993,
451,
7,
265,
76,
13,
25641,
2977,
17816,
50,
62,
45,
62,
37295,
6,
7131,
25,
12962,
198,
198,
29487,
16,
11,
34197,
16,
796,
458,
83,
13,
7266,
489,
1747,
7,
16,
11,
17,
8,
198,
87,
796,
45941,
13,
21602,
10223,
7,
15,
11,
14198,
11,
12825,
8,
198,
897,
274,
16,
58,
15,
4083,
29487,
7,
87,
11,
300,
315,
13,
1462,
62,
22915,
62,
13200,
7,
37659,
13,
21602,
10223,
7,
15,
11,
14198,
11,
12825,
22305,
198,
87,
796,
45941,
13,
21602,
10223,
7,
15,
13,
22544,
11,
18,
13,
3865,
11,
12825,
8,
198,
897,
274,
16,
58,
16,
4083,
29487,
7,
87,
11,
300,
315,
13,
1462,
62,
15414,
62,
13200,
7,
37659,
13,
21602,
10223,
7,
15,
13,
22544,
11,
18,
13,
3865,
11,
12825,
22305,
198,
198,
29487,
16,
11,
34197,
16,
796,
458,
83,
13,
7266,
489,
1747,
7,
16,
11,
17,
8,
198,
87,
796,
45941,
13,
21602,
10223,
7,
15,
11,
14198,
11,
12825,
8,
198,
897,
274,
16,
58,
15,
4083,
29487,
7,
87,
11,
9493,
13,
1462,
62,
22915,
62,
13200,
7,
37659,
13,
21602,
10223,
7,
15,
11,
9879,
11,
12825,
22305,
198,
87,
796,
45941,
13,
21602,
10223,
7,
15,
13,
22544,
11,
18,
13,
3865,
11,
12825,
8,
198,
897,
274,
16,
58,
16,
4083,
29487,
7,
87,
11,
9493,
13,
1462,
62,
15414,
62,
13200,
7,
37659,
13,
21602,
10223,
32590,
16,
11,
20,
11,
12825,
22305,
198,
198,
489,
83,
13,
12860,
7,
9967,
28,
25101,
8,
198
] | 2.217105 | 456 |
import responses
@responses.activate
| [
11748,
9109,
628,
198,
31,
16733,
274,
13,
39022,
198
] | 3.9 | 10 |
# 请求成功
RESPONSE_OK = 200
# 请求所需的URL地址
URLS = {
# 主机地址
"hostUrl": "https://m.r.umiaohealth.com/",
# 获取疫苗接种列表地址;POST
"vaccinationAddress": "/InstitutionMedicineStock/GetBykeyword_InstitutionMedicineStock",
# 获取某个社区医院的某一天可预约的时间段
"hospitalTimeRange": "/Reservation/GetByWorkDate_Rsv_TimeRange",
# 执行疫苗预约请求 url;GET
"secVaccination": "/Reservation/Reservation_Create",
# 获取 childId
"childId": "/Adult/Index",
# 获取用户信息
"userMsg": "/Home/My"
}
# 区域名称
AREAS = [
"天河区",
"白云区",
"黄埔区",
"荔湾区",
"越秀区",
"海珠区",
"番禺区",
"花都区",
"南沙区",
"增城区",
"从化区"
]
# 所有疫苗类型
VACCINE_TYPES = {
"veroCell": 5601, # 新冠疫苗(Vero细胞)
"adenovirusVector": 5602 # 新冠疫苗(腺病毒载体)
# etc...
}
# 需要预约的疫苗类型
SEC_TYPE = VACCINE_TYPES["veroCell"]
| [
2,
5525,
107,
115,
162,
109,
224,
22755,
238,
27950,
253,
198,
19535,
47,
1340,
5188,
62,
11380,
796,
939,
198,
198,
2,
5525,
107,
115,
162,
109,
224,
33699,
222,
165,
250,
222,
21410,
21886,
28839,
108,
161,
251,
222,
198,
4261,
6561,
796,
1391,
198,
220,
220,
220,
1303,
220,
10310,
119,
17312,
118,
28839,
108,
161,
251,
222,
198,
220,
220,
220,
366,
4774,
28165,
1298,
366,
5450,
1378,
76,
13,
81,
13,
388,
13481,
13948,
13,
785,
14,
1600,
198,
220,
220,
220,
1303,
5525,
236,
115,
20998,
244,
163,
244,
104,
164,
233,
245,
162,
236,
98,
163,
100,
235,
26344,
245,
26193,
101,
28839,
108,
161,
251,
222,
171,
120,
249,
32782,
198,
220,
220,
220,
366,
37839,
1883,
20231,
1298,
12813,
6310,
2738,
39112,
500,
26207,
14,
3855,
3886,
2539,
4775,
62,
6310,
2738,
39112,
500,
26207,
1600,
198,
220,
220,
220,
1303,
5525,
236,
115,
20998,
244,
162,
253,
238,
10310,
103,
163,
97,
122,
44293,
118,
44293,
119,
165,
247,
95,
21410,
162,
253,
238,
31660,
25465,
20998,
107,
165,
95,
226,
163,
118,
99,
21410,
33768,
114,
29785,
112,
162,
106,
113,
198,
220,
220,
220,
366,
49257,
7575,
17257,
1298,
12813,
4965,
13208,
14,
3855,
3886,
12468,
10430,
62,
49,
21370,
62,
7575,
17257,
1600,
198,
220,
220,
220,
1303,
10545,
231,
100,
26193,
234,
163,
244,
104,
164,
233,
245,
165,
95,
226,
163,
118,
99,
46237,
115,
162,
109,
224,
19016,
171,
120,
249,
18851,
198,
220,
220,
220,
366,
2363,
53,
4134,
1883,
1298,
12813,
4965,
13208,
14,
4965,
13208,
62,
16447,
1600,
198,
220,
220,
220,
1303,
5525,
236,
115,
20998,
244,
1200,
7390,
198,
220,
220,
220,
366,
9410,
7390,
1298,
12813,
42995,
14,
15732,
1600,
198,
220,
220,
220,
1303,
5525,
236,
115,
20998,
244,
18796,
101,
22755,
115,
46479,
94,
162,
223,
107,
198,
220,
220,
220,
366,
7220,
50108,
1298,
12813,
16060,
14,
3666,
1,
198,
92,
198,
198,
2,
10263,
234,
118,
161,
253,
253,
28938,
235,
163,
100,
108,
198,
12203,
1921,
796,
685,
198,
220,
220,
220,
366,
25465,
162,
110,
111,
44293,
118,
1600,
198,
220,
220,
220,
366,
163,
50159,
12859,
239,
44293,
118,
1600,
198,
220,
220,
220,
366,
165,
119,
226,
161,
253,
242,
44293,
118,
1600,
198,
220,
220,
220,
366,
164,
235,
242,
162,
117,
122,
44293,
118,
1600,
198,
220,
220,
220,
366,
164,
114,
232,
163,
100,
222,
44293,
118,
1600,
198,
220,
220,
220,
366,
38184,
115,
163,
237,
254,
44293,
118,
1600,
198,
220,
220,
220,
366,
45911,
103,
163,
99,
118,
44293,
118,
1600,
198,
220,
220,
220,
366,
164,
46788,
32849,
121,
44293,
118,
1600,
198,
220,
220,
220,
366,
39355,
245,
162,
110,
247,
44293,
118,
1600,
198,
220,
220,
220,
366,
161,
95,
252,
161,
253,
236,
44293,
118,
1600,
198,
220,
220,
220,
366,
20015,
236,
44293,
244,
44293,
118,
1,
198,
60,
198,
198,
2,
10545,
231,
222,
17312,
231,
163,
244,
104,
164,
233,
245,
163,
109,
119,
161,
252,
233,
198,
53,
26861,
8881,
62,
9936,
47,
1546,
796,
1391,
198,
220,
220,
220,
366,
332,
78,
28780,
1298,
7265,
486,
11,
220,
1303,
10545,
244,
108,
37863,
254,
163,
244,
104,
164,
233,
245,
171,
120,
230,
53,
3529,
163,
119,
228,
47797,
252,
171,
120,
231,
198,
220,
220,
220,
366,
40780,
709,
19397,
38469,
1298,
642,
31418,
220,
1303,
10545,
244,
108,
37863,
254,
163,
244,
104,
164,
233,
245,
171,
120,
230,
164,
227,
118,
163,
245,
227,
162,
107,
240,
164,
121,
121,
19526,
241,
171,
120,
231,
198,
220,
220,
220,
1303,
3503,
986,
198,
92,
198,
198,
2,
16268,
250,
222,
17358,
223,
165,
95,
226,
163,
118,
99,
21410,
163,
244,
104,
164,
233,
245,
163,
109,
119,
161,
252,
233,
198,
23683,
62,
25216,
796,
569,
26861,
8881,
62,
9936,
47,
1546,
14692,
332,
78,
28780,
8973,
198
] | 1.217656 | 657 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Scikit learn interface for :class:`~gensim.models.hdpmodel.HdpModel`.
Follows scikit-learn API conventions to facilitate using gensim along with scikit-learn.
Examples
--------
.. sourcecode:: pycon
>>> from gensim.test.utils import common_dictionary, common_corpus
>>> from gensim.sklearn_api import HdpTransformer
>>>
>>> # Lets extract the distribution of each document in topics
>>> model = HdpTransformer(id2word=common_dictionary)
>>> distr = model.fit_transform(common_corpus)
"""
import numpy as np
from gensim import matutils # type: ignore
from gensim import models # type: ignore
from scipy import sparse # type: ignore
from sklearn.base import BaseEstimator, TransformerMixin # type: ignore
from sklearn.exceptions import NotFittedError # type: ignore
class HdpTransformer(TransformerMixin, BaseEstimator):
"""Base HDP module, wraps :class:`~gensim.models.hdpmodel.HdpModel`.
The inner workings of this class heavily depends on `Wang, Paisley, Blei: "Online Variational
Inference for the Hierarchical Dirichlet Process, JMLR (2011)"
<http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
"""
def __init__(
self,
id2word,
max_chunks=None,
max_time=None,
chunksize=256,
kappa=1.0,
tau=64.0,
K=15,
T=150,
alpha=1,
gamma=1,
eta=0.01,
scale=1.0,
var_converge=0.0001,
outputdir=None,
random_state=None,
):
"""
Parameters
----------
id2word : :class:`~gensim.corpora.dictionary.Dictionary`, optional
Mapping between a words ID and the word itself in the vocabulary.
max_chunks : int, optional
Upper bound on how many chunks to process.It wraps around corpus beginning in another corpus pass,
if there are not enough chunks in the corpus.
max_time : int, optional
Upper bound on time in seconds for which model will be trained.
chunksize : int, optional
Number of documents to be processed by the model in each mini-batch.
kappa : float, optional
Learning rate, see `Wang, Paisley, Blei: "Online Variational Inference for the Hierarchical Dirichlet
Process, JMLR (2011)" <http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
tau : float, optional
Slow down parameter, see `Wang, Paisley, Blei: "Online Variational Inference for the Hierarchical
Dirichlet Process, JMLR (2011)" <http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
K : int, optional
Second level truncation level, see `Wang, Paisley, Blei: "Online Variational Inference for the Hierarchical
Dirichlet Process, JMLR (2011)" <http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
T : int, optional
Top level truncation level, see `Wang, Paisley, Blei: "Online Variational Inference for the Hierarchical
Dirichlet Process, JMLR (2011)" <http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
alpha : int, optional
Second level concentration, see `Wang, Paisley, Blei: "Online Variational Inference for the Hierarchical
Dirichlet Process, JMLR (2011)" <http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
gamma : int, optional
First level concentration, see `Wang, Paisley, Blei: "Online Variational Inference for the Hierarchical
Dirichlet Process, JMLR (2011)" <http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
eta : float, optional
The topic Dirichlet, see `Wang, Paisley, Blei: "Online Variational Inference for the Hierarchical
Dirichlet Process, JMLR (2011)" <http://jmlr.csail.mit.edu/proceedings/papers/v15/wang11a/wang11a.pdf>`_.
scale : float, optional
Weights information from the mini-chunk of corpus to calculate rhot.
var_converge : float, optional
Lower bound on the right side of convergence. Used when updating variational parameters
for a single document.
outputdir : str, optional
Path to a directory where topic and options information will be stored.
random_state : int, optional
Seed used to create a :class:`~np.random.RandomState`. Useful for obtaining reproducible results.
"""
self.gensim_model = None
self.id2word = id2word
self.max_chunks = max_chunks
self.max_time = max_time
self.chunksize = chunksize
self.kappa = kappa
self.tau = tau
self.K = K
self.T = T
self.alpha = alpha
self.gamma = gamma
self.eta = eta
self.scale = scale
self.var_converge = var_converge
self.outputdir = outputdir
self.random_state = random_state
def fit(self, X, y=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {iterable of list of (int, number), scipy.sparse matrix}
A collection of documents in BOW format used for training the model.
Returns
-------
:class:`~gensim.sklearn_api.hdp.HdpTransformer`
The trained model.
"""
if sparse.issparse(X):
corpus = matutils.Sparse2Corpus(sparse=X, documents_columns=False)
else:
corpus = X
self.gensim_model = models.HdpModel(
corpus=corpus,
id2word=self.id2word,
max_chunks=self.max_chunks,
max_time=self.max_time,
chunksize=self.chunksize,
kappa=self.kappa,
tau=self.tau,
K=self.K,
T=self.T,
alpha=self.alpha,
gamma=self.gamma,
eta=self.eta,
scale=self.scale,
var_converge=self.var_converge,
outputdir=self.outputdir,
random_state=self.random_state,
)
return self
def transform(self, docs):
"""Infer a matrix of topic distribution for the given document bow, where a_ij
indicates (topic_i, topic_probability_j).
Parameters
----------
docs : {iterable of list of (int, number), list of (int, number)}
Document or sequence of documents in BOW format.
Returns
-------
numpy.ndarray of shape [`len(docs), num_topics`]
Topic distribution for `docs`.
"""
if self.gensim_model is None:
raise NotFittedError(
"This model has not been fitted yet. Call 'fit' with appropriate arguments before using this method."
)
# The input as array of array
if isinstance(docs[0], tuple):
docs = [docs]
distribution, max_num_topics = [], 0
for doc in docs:
topicd = self.gensim_model[doc]
distribution.append(topicd)
max_num_topics = max(max_num_topics, max(topic[0] for topic in topicd) + 1)
# returning dense representation for compatibility with sklearn
# but we should go back to sparse representation in the future
distribution = [matutils.sparse2full(t, max_num_topics) for t in distribution]
return np.reshape(np.array(distribution), (len(docs), max_num_topics))
def partial_fit(self, X):
"""Train model over a potentially incomplete set of documents.
Uses the parameters set in the constructor.
This method can be used in two ways:
* On an unfitted model in which case the model is initialized and trained on `X`.
* On an already fitted model in which case the model is **updated** by `X`.
Parameters
----------
X : {iterable of list of (int, number), scipy.sparse matrix}
A collection of documents in BOW format used for training the model.
Returns
-------
:class:`~gensim.sklearn_api.hdp.HdpTransformer`
The trained model.
"""
if sparse.issparse(X):
X = matutils.Sparse2Corpus(sparse=X, documents_columns=False)
if self.gensim_model is None:
self.gensim_model = models.HdpModel(
id2word=self.id2word,
max_chunks=self.max_chunks,
max_time=self.max_time,
chunksize=self.chunksize,
kappa=self.kappa,
tau=self.tau,
K=self.K,
T=self.T,
alpha=self.alpha,
gamma=self.gamma,
eta=self.eta,
scale=self.scale,
var_converge=self.var_converge,
outputdir=self.outputdir,
random_state=self.random_state,
)
self.gensim_model.update(corpus=X)
return self
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
15069,
357,
34,
8,
2813,
5325,
320,
797,
71,
495,
74,
1279,
6335,
320,
260,
71,
495,
74,
31,
325,
89,
7402,
13,
26691,
29,
198,
2,
49962,
739,
262,
22961,
17370,
6489,
410,
17,
13,
16,
532,
2638,
1378,
2503,
13,
41791,
13,
2398,
14,
677,
4541,
14,
75,
70,
489,
13,
6494,
198,
198,
37811,
50,
979,
15813,
2193,
7071,
329,
1058,
4871,
25,
63,
93,
70,
641,
320,
13,
27530,
13,
31298,
4426,
375,
417,
13,
39,
26059,
17633,
44646,
198,
7155,
82,
629,
1134,
270,
12,
35720,
7824,
21396,
284,
15570,
1262,
308,
641,
320,
1863,
351,
629,
1134,
270,
12,
35720,
13,
198,
27730,
198,
982,
198,
492,
2723,
8189,
3712,
12972,
1102,
198,
220,
220,
220,
13163,
422,
308,
641,
320,
13,
9288,
13,
26791,
1330,
2219,
62,
67,
14188,
11,
2219,
62,
10215,
79,
385,
198,
220,
220,
220,
13163,
422,
308,
641,
320,
13,
8135,
35720,
62,
15042,
1330,
367,
26059,
8291,
16354,
198,
220,
220,
220,
13163,
198,
220,
220,
220,
13163,
1303,
38257,
7925,
262,
6082,
286,
1123,
3188,
287,
10233,
198,
220,
220,
220,
13163,
2746,
796,
367,
26059,
8291,
16354,
7,
312,
17,
4775,
28,
11321,
62,
67,
14188,
8,
198,
220,
220,
220,
13163,
1233,
81,
796,
2746,
13,
11147,
62,
35636,
7,
11321,
62,
10215,
79,
385,
8,
198,
37811,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
308,
641,
320,
1330,
2603,
26791,
220,
1303,
2099,
25,
8856,
198,
6738,
308,
641,
320,
1330,
4981,
220,
1303,
2099,
25,
8856,
198,
6738,
629,
541,
88,
1330,
29877,
220,
1303,
2099,
25,
8856,
198,
6738,
1341,
35720,
13,
8692,
1330,
7308,
22362,
320,
1352,
11,
3602,
16354,
35608,
259,
220,
1303,
2099,
25,
8856,
198,
6738,
1341,
35720,
13,
1069,
11755,
1330,
1892,
37,
2175,
12331,
220,
1303,
2099,
25,
8856,
628,
198,
4871,
367,
26059,
8291,
16354,
7,
8291,
16354,
35608,
259,
11,
7308,
22362,
320,
1352,
2599,
198,
220,
220,
220,
37227,
14881,
5572,
47,
8265,
11,
27521,
1058,
4871,
25,
63,
93,
70,
641,
320,
13,
27530,
13,
31298,
4426,
375,
417,
13,
39,
26059,
17633,
44646,
198,
220,
220,
220,
383,
8434,
35084,
286,
428,
1398,
7272,
8338,
319,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
198,
220,
220,
220,
554,
4288,
329,
262,
36496,
998,
605,
36202,
488,
1616,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
198,
220,
220,
220,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
17,
4775,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
354,
14125,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
2435,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
22716,
1096,
28,
11645,
11,
198,
220,
220,
220,
220,
220,
220,
220,
479,
20975,
28,
16,
13,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
256,
559,
28,
2414,
13,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
509,
28,
1314,
11,
198,
220,
220,
220,
220,
220,
220,
220,
309,
28,
8628,
11,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
34236,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2123,
64,
28,
15,
13,
486,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5046,
28,
16,
13,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1401,
62,
1102,
332,
469,
28,
15,
13,
18005,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
15908,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4738,
62,
5219,
28,
14202,
11,
198,
220,
220,
220,
15179,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
17,
4775,
1058,
1058,
4871,
25,
63,
93,
70,
641,
320,
13,
10215,
38851,
13,
67,
14188,
13,
35,
14188,
47671,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
5912,
1022,
257,
2456,
4522,
290,
262,
1573,
2346,
287,
262,
25818,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
354,
14125,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20390,
5421,
319,
703,
867,
22716,
284,
1429,
13,
1026,
27521,
1088,
35789,
3726,
287,
1194,
35789,
1208,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
612,
389,
407,
1576,
22716,
287,
262,
35789,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
2435,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20390,
5421,
319,
640,
287,
4201,
329,
543,
2746,
481,
307,
8776,
13,
198,
220,
220,
220,
220,
220,
220,
220,
22716,
1096,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7913,
286,
4963,
284,
307,
13686,
416,
262,
2746,
287,
1123,
9927,
12,
43501,
13,
198,
220,
220,
220,
220,
220,
220,
220,
479,
20975,
1058,
12178,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18252,
2494,
11,
766,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
554,
4288,
329,
262,
36496,
998,
605,
36202,
488,
1616,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
220,
220,
220,
220,
256,
559,
1058,
12178,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19054,
866,
11507,
11,
766,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
554,
4288,
329,
262,
36496,
998,
605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36202,
488,
1616,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
220,
220,
220,
220,
509,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5498,
1241,
40122,
341,
1241,
11,
766,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
554,
4288,
329,
262,
36496,
998,
605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36202,
488,
1616,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
220,
220,
220,
220,
309,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5849,
1241,
40122,
341,
1241,
11,
766,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
554,
4288,
329,
262,
36496,
998,
605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36202,
488,
1616,
220,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5498,
1241,
10368,
11,
766,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
554,
4288,
329,
262,
36496,
998,
605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36202,
488,
1616,
220,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
220,
220,
220,
220,
34236,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3274,
1241,
10368,
11,
766,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
554,
4288,
329,
262,
36496,
998,
605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36202,
488,
1616,
220,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
220,
220,
220,
220,
2123,
64,
1058,
12178,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
7243,
36202,
488,
1616,
11,
766,
4600,
54,
648,
11,
11243,
271,
1636,
11,
17175,
72,
25,
366,
14439,
15965,
864,
554,
4288,
329,
262,
36496,
998,
605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36202,
488,
1616,
220,
10854,
11,
449,
5805,
49,
357,
9804,
16725,
1279,
4023,
1378,
73,
4029,
81,
13,
6359,
603,
13,
2781,
13,
15532,
14,
1676,
2707,
654,
14,
40491,
14,
85,
1314,
14,
47562,
1157,
64,
14,
47562,
1157,
64,
13,
12315,
29,
63,
44807,
198,
220,
220,
220,
220,
220,
220,
220,
5046,
1058,
12178,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
775,
2337,
1321,
422,
262,
9927,
12,
354,
2954,
286,
35789,
284,
15284,
374,
8940,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1401,
62,
1102,
332,
469,
1058,
12178,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16048,
5421,
319,
262,
826,
1735,
286,
40826,
13,
16718,
618,
19698,
5553,
864,
10007,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
257,
2060,
3188,
13,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
15908,
1058,
965,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10644,
284,
257,
8619,
810,
7243,
290,
3689,
1321,
481,
307,
8574,
13,
198,
220,
220,
220,
220,
220,
220,
220,
4738,
62,
5219,
1058,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23262,
973,
284,
2251,
257,
1058,
4871,
25,
63,
93,
37659,
13,
25120,
13,
29531,
9012,
44646,
49511,
329,
16727,
8186,
37369,
2482,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
70,
641,
320,
62,
19849,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
312,
17,
4775,
796,
4686,
17,
4775,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9806,
62,
354,
14125,
796,
3509,
62,
354,
14125,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9806,
62,
2435,
796,
3509,
62,
2435,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
354,
14125,
1096,
796,
22716,
1096,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
74,
20975,
796,
479,
20975,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
83,
559,
796,
256,
559,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
42,
796,
509,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
51,
796,
309,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
26591,
796,
17130,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
28483,
2611,
796,
34236,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
17167,
796,
2123,
64,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9888,
796,
5046,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7785,
62,
1102,
332,
469,
796,
1401,
62,
1102,
332,
469,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22915,
15908,
796,
5072,
15908,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
25120,
62,
5219,
796,
4738,
62,
5219,
628,
220,
220,
220,
825,
4197,
7,
944,
11,
1395,
11,
331,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
31805,
262,
2746,
1864,
284,
262,
1813,
3047,
1366,
13,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
1058,
1391,
2676,
540,
286,
1351,
286,
357,
600,
11,
1271,
828,
629,
541,
88,
13,
82,
29572,
17593,
92,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
317,
4947,
286,
4963,
287,
347,
3913,
5794,
973,
329,
3047,
262,
2746,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4871,
25,
63,
93,
70,
641,
320,
13,
8135,
35720,
62,
15042,
13,
71,
26059,
13,
39,
26059,
8291,
16354,
63,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
8776,
2746,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
29877,
13,
747,
29572,
7,
55,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
35789,
796,
2603,
26791,
13,
50,
29572,
17,
45680,
385,
7,
82,
29572,
28,
55,
11,
4963,
62,
28665,
82,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
35789,
796,
1395,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
70,
641,
320,
62,
19849,
796,
4981,
13,
39,
26059,
17633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
35789,
28,
10215,
79,
385,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
17,
4775,
28,
944,
13,
312,
17,
4775,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
354,
14125,
28,
944,
13,
9806,
62,
354,
14125,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
2435,
28,
944,
13,
9806,
62,
2435,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22716,
1096,
28,
944,
13,
354,
14125,
1096,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
20975,
28,
944,
13,
74,
20975,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
559,
28,
944,
13,
83,
559,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
509,
28,
944,
13,
42,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
28,
944,
13,
51,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
944,
13,
26591,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34236,
28,
944,
13,
28483,
2611,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2123,
64,
28,
944,
13,
17167,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5046,
28,
944,
13,
9888,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1401,
62,
1102,
332,
469,
28,
944,
13,
7785,
62,
1102,
332,
469,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
15908,
28,
944,
13,
22915,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4738,
62,
5219,
28,
944,
13,
25120,
62,
5219,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
628,
220,
220,
220,
825,
6121,
7,
944,
11,
34165,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
818,
2232,
257,
17593,
286,
7243,
6082,
329,
262,
1813,
3188,
9563,
11,
810,
257,
62,
2926,
198,
220,
220,
220,
220,
220,
220,
220,
9217,
357,
26652,
62,
72,
11,
7243,
62,
1676,
65,
1799,
62,
73,
737,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
34165,
1058,
1391,
2676,
540,
286,
1351,
286,
357,
600,
11,
1271,
828,
1351,
286,
357,
600,
11,
1271,
38165,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16854,
393,
8379,
286,
4963,
287,
347,
3913,
5794,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
299,
32152,
13,
358,
18747,
286,
5485,
685,
63,
11925,
7,
31628,
828,
997,
62,
4852,
873,
63,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47373,
6082,
329,
4600,
31628,
44646,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
70,
641,
320,
62,
19849,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
37,
2175,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1212,
2746,
468,
407,
587,
18235,
1865,
13,
4889,
705,
11147,
6,
351,
5035,
7159,
878,
1262,
428,
2446,
526,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
383,
5128,
355,
7177,
286,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
31628,
58,
15,
4357,
46545,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34165,
796,
685,
31628,
60,
198,
220,
220,
220,
220,
220,
220,
220,
6082,
11,
3509,
62,
22510,
62,
4852,
873,
796,
685,
4357,
657,
628,
220,
220,
220,
220,
220,
220,
220,
329,
2205,
287,
34165,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7243,
67,
796,
2116,
13,
70,
641,
320,
62,
19849,
58,
15390,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6082,
13,
33295,
7,
26652,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
22510,
62,
4852,
873,
796,
3509,
7,
9806,
62,
22510,
62,
4852,
873,
11,
3509,
7,
26652,
58,
15,
60,
329,
7243,
287,
7243,
67,
8,
1343,
352,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
8024,
15715,
10552,
329,
17764,
351,
1341,
35720,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
475,
356,
815,
467,
736,
284,
29877,
10552,
287,
262,
2003,
198,
220,
220,
220,
220,
220,
220,
220,
6082,
796,
685,
6759,
26791,
13,
82,
29572,
17,
12853,
7,
83,
11,
3509,
62,
22510,
62,
4852,
873,
8,
329,
256,
287,
6082,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
45941,
13,
3447,
1758,
7,
37659,
13,
18747,
7,
17080,
3890,
828,
357,
11925,
7,
31628,
828,
3509,
62,
22510,
62,
4852,
873,
4008,
628,
220,
220,
220,
825,
13027,
62,
11147,
7,
944,
11,
1395,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
44077,
2746,
625,
257,
6196,
17503,
900,
286,
4963,
13,
198,
220,
220,
220,
220,
220,
220,
220,
36965,
262,
10007,
900,
287,
262,
23772,
13,
198,
220,
220,
220,
220,
220,
220,
220,
770,
2446,
460,
307,
973,
287,
734,
2842,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
1550,
281,
3684,
2175,
2746,
287,
543,
1339,
262,
2746,
318,
23224,
290,
8776,
319,
4600,
55,
44646,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
1550,
281,
1541,
18235,
2746,
287,
543,
1339,
262,
2746,
318,
12429,
43162,
1174,
416,
4600,
55,
44646,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
1058,
1391,
2676,
540,
286,
1351,
286,
357,
600,
11,
1271,
828,
629,
541,
88,
13,
82,
29572,
17593,
92,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
317,
4947,
286,
4963,
287,
347,
3913,
5794,
973,
329,
3047,
262,
2746,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4871,
25,
63,
93,
70,
641,
320,
13,
8135,
35720,
62,
15042,
13,
71,
26059,
13,
39,
26059,
8291,
16354,
63,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
8776,
2746,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
29877,
13,
747,
29572,
7,
55,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
796,
2603,
26791,
13,
50,
29572,
17,
45680,
385,
7,
82,
29572,
28,
55,
11,
4963,
62,
28665,
82,
28,
25101,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
70,
641,
320,
62,
19849,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
70,
641,
320,
62,
19849,
796,
4981,
13,
39,
26059,
17633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
17,
4775,
28,
944,
13,
312,
17,
4775,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
354,
14125,
28,
944,
13,
9806,
62,
354,
14125,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
2435,
28,
944,
13,
9806,
62,
2435,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22716,
1096,
28,
944,
13,
354,
14125,
1096,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
20975,
28,
944,
13,
74,
20975,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
559,
28,
944,
13,
83,
559,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
509,
28,
944,
13,
42,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
28,
944,
13,
51,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
944,
13,
26591,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34236,
28,
944,
13,
28483,
2611,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2123,
64,
28,
944,
13,
17167,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5046,
28,
944,
13,
9888,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1401,
62,
1102,
332,
469,
28,
944,
13,
7785,
62,
1102,
332,
469,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
15908,
28,
944,
13,
22915,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4738,
62,
5219,
28,
944,
13,
25120,
62,
5219,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
70,
641,
320,
62,
19849,
13,
19119,
7,
10215,
79,
385,
28,
55,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
198
] | 2.231905 | 4,131 |
# 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 oslo_policy import policy
from zaqar.common.policies import base
CLAIMS = 'claims:%s'
rules = [
policy.DocumentedRuleDefault(
name=CLAIMS % 'create',
check_str=base.UNPROTECTED,
description='Claims a set of messages from the specified queue.',
operations=[
{
'path': '/v2/queues/{queue_name}/claims',
'method': 'POST'
}
]
),
policy.DocumentedRuleDefault(
name=CLAIMS % 'get',
check_str=base.UNPROTECTED,
description='Queries the specified claim for the specified queue.',
operations=[
{
'path': '/v2/queues/{queue_name}/claims/{claim_id}',
'method': 'GET'
}
]
),
policy.DocumentedRuleDefault(
name=CLAIMS % 'delete',
check_str=base.UNPROTECTED,
description='Releases the specified claim for the specified queue.',
operations=[
{
'path': '/v2/queues/{queue_name}/claims/{claim_id}',
'method': 'DELETE'
}
]
),
policy.DocumentedRuleDefault(
name=CLAIMS % 'update',
check_str=base.UNPROTECTED,
description='Updates the specified claim for the specified queue.',
operations=[
{
'path': '/v2/queues/{queue_name}/claims/{claim_id}',
'method': 'PATCH'
}
]
)
]
| [
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
198,
2,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
921,
743,
7330,
198,
2,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
42881,
198,
2,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
4091,
262,
198,
2,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
11247,
198,
2,
739,
262,
13789,
13,
198,
198,
6738,
28686,
5439,
62,
30586,
1330,
2450,
198,
198,
6738,
1976,
30188,
283,
13,
11321,
13,
79,
4160,
444,
1330,
2779,
198,
198,
48778,
50,
796,
705,
6604,
82,
25,
4,
82,
6,
628,
198,
38785,
796,
685,
198,
220,
220,
220,
2450,
13,
35,
17664,
31929,
19463,
7,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
28,
48778,
50,
4064,
705,
17953,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
62,
2536,
28,
8692,
13,
4944,
4805,
2394,
9782,
1961,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6764,
11639,
44819,
82,
257,
900,
286,
6218,
422,
262,
7368,
16834,
2637,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4560,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6978,
10354,
31051,
85,
17,
14,
4188,
947,
14,
90,
36560,
62,
3672,
92,
14,
6604,
82,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
24396,
10354,
705,
32782,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
2450,
13,
35,
17664,
31929,
19463,
7,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
28,
48778,
50,
4064,
705,
1136,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
62,
2536,
28,
8692,
13,
4944,
4805,
2394,
9782,
1961,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6764,
11639,
4507,
10640,
262,
7368,
1624,
329,
262,
7368,
16834,
2637,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4560,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6978,
10354,
31051,
85,
17,
14,
4188,
947,
14,
90,
36560,
62,
3672,
92,
14,
6604,
82,
14,
90,
6604,
62,
312,
92,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
24396,
10354,
705,
18851,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
2450,
13,
35,
17664,
31929,
19463,
7,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
28,
48778,
50,
4064,
705,
33678,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
62,
2536,
28,
8692,
13,
4944,
4805,
2394,
9782,
1961,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6764,
11639,
3041,
29329,
262,
7368,
1624,
329,
262,
7368,
16834,
2637,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4560,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6978,
10354,
31051,
85,
17,
14,
4188,
947,
14,
90,
36560,
62,
3672,
92,
14,
6604,
82,
14,
90,
6604,
62,
312,
92,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
24396,
10354,
705,
7206,
2538,
9328,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
2450,
13,
35,
17664,
31929,
19463,
7,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
28,
48778,
50,
4064,
705,
19119,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
62,
2536,
28,
8692,
13,
4944,
4805,
2394,
9782,
1961,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6764,
11639,
4933,
19581,
262,
7368,
1624,
329,
262,
7368,
16834,
2637,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4560,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6978,
10354,
31051,
85,
17,
14,
4188,
947,
14,
90,
36560,
62,
3672,
92,
14,
6604,
82,
14,
90,
6604,
62,
312,
92,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
24396,
10354,
705,
47,
11417,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
1267,
198,
60,
628
] | 2.236464 | 905 |
import discord
import discord.utils
from discord.ext import commands
import requests
import random
client = discord.Client()
SECRET_KEY="secretkey"
BASE_URL="http://0.0.0.0:1234"
@client.event
@client.event
client.run("") | [
11748,
36446,
198,
11748,
36446,
13,
26791,
198,
6738,
36446,
13,
2302,
1330,
9729,
198,
11748,
7007,
198,
11748,
4738,
198,
198,
16366,
796,
36446,
13,
11792,
3419,
198,
198,
23683,
26087,
62,
20373,
2625,
21078,
2539,
1,
198,
33,
11159,
62,
21886,
2625,
4023,
1378,
15,
13,
15,
13,
15,
13,
15,
25,
1065,
2682,
1,
198,
198,
31,
16366,
13,
15596,
198,
198,
31,
16366,
13,
15596,
628,
198,
16366,
13,
5143,
7203,
4943
] | 2.986842 | 76 |
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings
from django.contrib import admin
from django.urls import path, re_path
from . import views
# SSO
urlpatterns = [
path('reports/', views.list_reports,
name="django-pathfinder-statcrunch-list-reports"),
path('reports/<int:pk>/', views.view_report,
name="django-pathfinder-statcrunch-view-report"),
path('reports/<int:pk>/refresh/', views.refresh_report,
name="django-pathfinder-statcrunch-view-report-refresh"),
]
| [
6738,
42625,
14208,
13,
3642,
822,
13,
12708,
16624,
13,
6371,
82,
1330,
9037,
16624,
62,
6371,
33279,
82,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
11,
302,
62,
6978,
198,
6738,
764,
1330,
5009,
220,
198,
198,
2,
6723,
46,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
10786,
48922,
14,
3256,
5009,
13,
4868,
62,
48922,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
2625,
28241,
14208,
12,
6978,
22805,
12,
14269,
6098,
3316,
12,
4868,
12,
48922,
12340,
198,
220,
220,
220,
3108,
10786,
48922,
14,
27,
600,
25,
79,
74,
29,
14,
3256,
5009,
13,
1177,
62,
13116,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
2625,
28241,
14208,
12,
6978,
22805,
12,
14269,
6098,
3316,
12,
1177,
12,
13116,
12340,
198,
220,
220,
220,
3108,
10786,
48922,
14,
27,
600,
25,
79,
74,
29,
14,
5420,
3447,
14,
3256,
5009,
13,
5420,
3447,
62,
13116,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
2625,
28241,
14208,
12,
6978,
22805,
12,
14269,
6098,
3316,
12,
1177,
12,
13116,
12,
5420,
3447,
12340,
198,
60,
198
] | 2.645933 | 209 |
import fileinput
nums = list(map(int, fileinput.input()))
print(sum(inc for inc in gen()))
| [
11748,
2393,
15414,
198,
198,
77,
5700,
796,
1351,
7,
8899,
7,
600,
11,
2393,
15414,
13,
15414,
3419,
4008,
628,
198,
198,
4798,
7,
16345,
7,
1939,
329,
753,
287,
2429,
3419,
4008,
198
] | 2.714286 | 35 |
import connexion
import six
from openapi_server.models.runtime_error import RuntimeError # noqa: E501
from openapi_server.models.v1_health_check_service_health_check_response import V1HealthCheckServiceHealthCheckResponse # noqa: E501
from openapi_server import util
def health_check_service_health_check(): # noqa: E501
"""health_check_service_health_check
# noqa: E501
:rtype: V1HealthCheckServiceHealthCheckResponse
"""
return 'do some magic!'
| [
11748,
369,
12413,
295,
198,
11748,
2237,
198,
198,
6738,
1280,
15042,
62,
15388,
13,
27530,
13,
43282,
62,
18224,
1330,
43160,
12331,
220,
1303,
645,
20402,
25,
412,
33548,
198,
6738,
1280,
15042,
62,
15388,
13,
27530,
13,
85,
16,
62,
13948,
62,
9122,
62,
15271,
62,
13948,
62,
9122,
62,
26209,
1330,
569,
16,
18081,
9787,
16177,
18081,
9787,
31077,
220,
1303,
645,
20402,
25,
412,
33548,
198,
6738,
1280,
15042,
62,
15388,
1330,
7736,
628,
198,
4299,
1535,
62,
9122,
62,
15271,
62,
13948,
62,
9122,
33529,
220,
1303,
645,
20402,
25,
412,
33548,
198,
220,
220,
220,
37227,
13948,
62,
9122,
62,
15271,
62,
13948,
62,
9122,
628,
220,
220,
220,
220,
1303,
645,
20402,
25,
412,
33548,
628,
198,
220,
220,
220,
1058,
81,
4906,
25,
569,
16,
18081,
9787,
16177,
18081,
9787,
31077,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
705,
4598,
617,
5536,
13679,
198
] | 3.077419 | 155 |
class Model182:
"""Class to create Model 182 files"""
declarant = None
declared_registers = {}
| [
4871,
9104,
24294,
25,
198,
220,
220,
220,
37227,
9487,
284,
2251,
9104,
28581,
3696,
37811,
628,
220,
220,
220,
2377,
4741,
796,
6045,
198,
220,
220,
220,
6875,
62,
2301,
6223,
796,
23884,
198
] | 3.085714 | 35 |
"""
Created on 12:39, June. 4th, 2021
Author: fassial
Filename: VoltageJump.py
"""
import brainpy as bp
__all__ = [
"VoltageJump",
]
| [
37811,
198,
41972,
319,
1105,
25,
2670,
11,
2795,
13,
604,
400,
11,
33448,
198,
13838,
25,
277,
562,
498,
198,
35063,
25,
45444,
36046,
13,
9078,
198,
37811,
198,
11748,
3632,
9078,
355,
275,
79,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
366,
53,
5978,
496,
36046,
1600,
198,
60,
628
] | 2.482143 | 56 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 10 10:31:44 2020
@author: alex
"""
import argparse
from clodsa.utils.conf import Conf | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
3825,
1737,
838,
838,
25,
3132,
25,
2598,
12131,
198,
198,
31,
9800,
25,
257,
2588,
198,
37811,
198,
11748,
1822,
29572,
198,
6738,
537,
375,
11400,
13,
26791,
13,
10414,
1330,
7326
] | 2.557377 | 61 |
####################################################################################
# BLACKMAMBA BY: LOSEYS (https://github.com/loseys)
#
# QT GUI INTERFACE BY: WANDERSON M.PIMENTA (https://github.com/Wanderson-Magalhaes)
# ORIGINAL QT GUI: https://github.com/Wanderson-Magalhaes/Simple_PySide_Base
####################################################################################
"""
Video streaming server.
"""
import sys
import socket
from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
from zlib import decompress
from cryptography.fernet import Fernet
try:
SERVER_IP = sys.argv[1]
PORT_VIDEO = sys.argv[2]
except:
SERVER_IP = 0
PORT_VIDEO = 0
if __name__ == "__main__":
start_stream()
| [
29113,
29113,
14468,
4242,
198,
2,
31963,
44,
2390,
4339,
11050,
25,
406,
14058,
16309,
357,
5450,
1378,
12567,
13,
785,
14,
75,
577,
893,
8,
198,
2,
198,
2,
1195,
51,
25757,
23255,
49836,
11050,
25,
370,
6981,
29086,
337,
13,
47,
3955,
3525,
32,
357,
5450,
1378,
12567,
13,
785,
14,
54,
392,
882,
12,
13436,
282,
3099,
274,
8,
198,
2,
43901,
17961,
1195,
51,
25757,
25,
3740,
1378,
12567,
13,
785,
14,
54,
392,
882,
12,
13436,
282,
3099,
274,
14,
26437,
62,
20519,
24819,
62,
14881,
198,
29113,
29113,
14468,
4242,
198,
198,
37811,
198,
10798,
11305,
4382,
13,
198,
37811,
198,
198,
11748,
25064,
198,
11748,
17802,
198,
6738,
28686,
1330,
551,
2268,
198,
268,
2268,
17816,
47,
56,
47109,
62,
39,
14114,
62,
40331,
15490,
62,
4805,
2662,
11571,
20520,
796,
705,
16,
6,
198,
198,
11748,
12972,
6057,
198,
6738,
1976,
8019,
1330,
38237,
601,
198,
6738,
45898,
13,
69,
1142,
316,
1330,
38982,
316,
198,
198,
28311,
25,
198,
220,
220,
220,
18871,
5959,
62,
4061,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
220,
220,
220,
350,
9863,
62,
42937,
796,
25064,
13,
853,
85,
58,
17,
60,
198,
16341,
25,
198,
220,
220,
220,
18871,
5959,
62,
4061,
796,
657,
198,
220,
220,
220,
350,
9863,
62,
42937,
796,
657,
628,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
923,
62,
5532,
3419,
198
] | 3.069388 | 245 |
from datetime import datetime
from infrastructure.cqrs.decorators.requestclass import requestclass
@requestclass
| [
6738,
4818,
8079,
1330,
4818,
8079,
198,
198,
6738,
6884,
13,
66,
80,
3808,
13,
12501,
273,
2024,
13,
25927,
4871,
1330,
2581,
4871,
628,
198,
31,
25927,
4871,
198
] | 3.866667 | 30 |
import sqlite3
# Connect to the sqlite3 file
connection = sqlite3.connect("northwind_small.sqlite3")
cursor = connection.cursor()
# Queries
# `expensive_items`: What are the ten most expensive items (per unit price) in the database?
price_query = f""" SELECT UnitPrice, ProductName
FROM product
ORDER BY UnitPrice DESC
LIMIT 10;"""
expensive_items = cursor.execute(price_query).fetchall()
print("Expensive items:", expensive_items)
# Expensive items: [(263.5, 'Côte de Blaye'), (123.79, 'Thüringer Rostbratwurst'),
# (97, 'Mishi Kobe Niku'), (81, "Sir Rodney's Marmalade"), (62.5, 'Carnarvon Tigers'),
# (55, 'Raclette Courdavault'), (53, 'Manjimup Dried Apples'), (49.3, 'Tarte au sucre'),
# (46, 'Ipoh Coffee'), (45.6, 'Rössle Sauerkraut')]
# `avg_hire_age`: What is the average age of an employee at the time of their hiring?
# ONLY RAN THIS THE FIRST TIME, then commented it out
# add_age_column = f"""
# ALTER TABLE Employee
# ADD age INT AS (hiredate - birthdate)
# """
# cursor.execute(add_age_column)
avghire_query = f"""SELECT AVG(age) from employee"""
avg_hire_age = cursor.execute(avghire_query).fetchone()[0]
print("Average hire age:", avg_hire_age)
# Average hire age: 37.22222222222222
# (*Stretch*) `avg_age_by_city`: How does the average age of employee at hire vary by city?
avg_by_city_query = f"""SELECT AVG(age), city FROM employee
GROUP BY city
"""
avg_age_by_city = cursor.execute(avg_by_city_query).fetchall()
print("Average age by city:", avg_age_by_city)
# Average age by city: [(29.0, 'Kirkland'), (32.5, 'London'),
# (56.0, 'Redmond'), (40.0, 'Seattle'), (40.0, 'Tacoma')]
# - `ten_most_expensive`: What are the ten most expensive items (per unit price) in the database
# *and* their suppliers?
# COMMENTING OUT AFTER RUNNING ONCE
# suppliers_prices_table = f"""CREATE TABLE suppliers_prices AS
# SELECT Product.ProductName, Product.UnitPrice, Supplier.CompanyName
# FROM Product
# LEFT JOIN Supplier ON Product.SupplierId = Supplier.Id
# """
# cursor.execute(suppliers_prices_table)
# insertion_query = f"""SELECT Product.ProductName, Product.UnitPrice, Supplier.CompanyName
# FROM Product
# LEFT JOIN Supplier ON Product.SupplierId = Supplier.Id"""
# cursor.execute(insertion_query)
price_supplier_query = f"""SELECT unitprice, companyname
FROM suppliers_prices
ORDER BY unitprice DESC
LIMIT 10;
"""
price_supplier_topten = cursor.execute(price_supplier_query).fetchall()
print("Top most expensive items and their suppliers:", price_supplier_topten)
# Top most expensive items and their suppliers: [(263.5, 'Aux
# joyeux ecclésiastiques'), (123.79, 'Plutzer Lebensmittelgroßmärkte AG'),
# (97, 'Tokyo Traders'), (81, 'Specialty Biscuits, Ltd.'),
# (62.5, 'Pavlova, Ltd.'), (55, 'Gai pâturage'), (53, "G'day, Mate"),
# (49.3, "Forêts d'érables"), (46, 'Leka Trading'), (45.6, 'Plutzer Lebensmittelgroßmärkte AG')]
# - `largest_category`: What is the largest category (by number of unique products in it)?
largest_category_query = f"""SELECT CategoryId, COUNT(DISTINCT ProductName) FROM Product
GROUP BY CategoryId
ORDER BY COUNT(DISTINCT ProductName) DESC"""
largest_category = cursor.execute(largest_category_query).fetchone()[0]
print("Largest category:", largest_category)
# Largest category: 3
# - (*Stretch*) `most_territories`: Who's the employee with the most territories?
# Use `TerritoryId` (not name, region, or other fields) as the unique
# identifier for territories.
# COMMENT OUT AFTER RUNNING ONCE
# employee_territory_table = f"""CREATE TABLE employee_territory AS
# SELECT Employee.FirstName, Employee.LastName,
# EmployeeTerritory.EmployeeId, EmployeeTerritory.TerritoryId
# FROM Employee
# JOIN EmployeeTerritory ON Employee.Id = EmployeeTerritory.EmployeeId;"""
# cursor.execute(employee_territory_table)
territory_query = f"""SELECT COUNT(DISTINCT TerritoryId), FirstName, LastName, EmployeeId from employee_territory
GROUP BY EmployeeId
ORDER BY COUNT(DISTINCT TerritoryId) DESC"""
employee_territory = cursor.execute(territory_query).fetchone()
print("Which employee has the most territory?", employee_territory)
# Which employee has the most territory? (10, 'Robert', 'King', 7)
connection.commit()
connection.close()
| [
11748,
44161,
578,
18,
628,
198,
2,
8113,
284,
262,
44161,
578,
18,
2393,
198,
198,
38659,
796,
44161,
578,
18,
13,
8443,
7203,
43588,
7972,
62,
17470,
13,
25410,
578,
18,
4943,
198,
198,
66,
21471,
796,
4637,
13,
66,
21471,
3419,
198,
198,
2,
2264,
10640,
198,
2,
4600,
22031,
62,
23814,
63,
25,
1867,
389,
262,
3478,
749,
5789,
3709,
357,
525,
4326,
2756,
8,
287,
262,
6831,
30,
198,
20888,
62,
22766,
796,
277,
37811,
33493,
11801,
18124,
11,
8721,
5376,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16034,
1720,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
38678,
11050,
11801,
18124,
22196,
34,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27564,
2043,
838,
26,
37811,
198,
22031,
62,
23814,
796,
23493,
13,
41049,
7,
20888,
62,
22766,
737,
69,
7569,
439,
3419,
198,
4798,
7203,
16870,
2021,
3709,
25,
1600,
5789,
62,
23814,
8,
198,
2,
5518,
2021,
3709,
25,
47527,
29558,
13,
20,
11,
705,
34,
27083,
660,
390,
1086,
48822,
33809,
357,
10163,
13,
3720,
11,
705,
817,
9116,
1806,
263,
48306,
1671,
265,
86,
24962,
33809,
198,
2,
357,
5607,
11,
705,
44,
21644,
29493,
11271,
84,
33809,
357,
6659,
11,
366,
22788,
34895,
338,
1526,
7617,
671,
12340,
357,
5237,
13,
20,
11,
705,
34,
1501,
283,
26982,
17662,
33809,
198,
2,
357,
2816,
11,
705,
49,
330,
21348,
2734,
67,
615,
1721,
33809,
357,
4310,
11,
705,
5124,
73,
320,
929,
360,
2228,
2034,
829,
33809,
357,
2920,
13,
18,
11,
705,
51,
32074,
35851,
6522,
260,
33809,
198,
2,
357,
3510,
11,
705,
40,
79,
1219,
19443,
33809,
357,
2231,
13,
21,
11,
705,
49,
9101,
824,
293,
23167,
9587,
430,
315,
11537,
60,
198,
198,
2,
4600,
615,
70,
62,
10695,
62,
496,
63,
25,
1867,
318,
262,
2811,
2479,
286,
281,
6538,
379,
262,
640,
286,
511,
12965,
30,
198,
198,
2,
22224,
371,
1565,
12680,
3336,
31328,
20460,
11,
788,
16476,
340,
503,
198,
2,
751,
62,
496,
62,
28665,
796,
277,
37811,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8355,
5781,
43679,
36824,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27841,
2479,
17828,
7054,
357,
71,
1202,
378,
532,
4082,
4475,
8,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
2,
23493,
13,
41049,
7,
2860,
62,
496,
62,
28665,
8,
198,
198,
615,
456,
557,
62,
22766,
796,
277,
37811,
46506,
35224,
7,
496,
8,
422,
6538,
37811,
198,
615,
70,
62,
10695,
62,
496,
796,
23493,
13,
41049,
7,
615,
456,
557,
62,
22766,
737,
69,
7569,
505,
3419,
58,
15,
60,
198,
4798,
7203,
26287,
11078,
2479,
25,
1600,
42781,
62,
10695,
62,
496,
8,
198,
2,
13475,
11078,
2479,
25,
5214,
13,
1828,
1828,
1828,
1828,
1828,
1828,
1828,
198,
198,
2,
20789,
39181,
28104,
4600,
615,
70,
62,
496,
62,
1525,
62,
19205,
63,
25,
1374,
857,
262,
2811,
2479,
286,
6538,
379,
11078,
7565,
416,
1748,
30,
198,
615,
70,
62,
1525,
62,
19205,
62,
22766,
796,
277,
37811,
46506,
35224,
7,
496,
828,
1748,
16034,
6538,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44441,
11050,
1748,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
615,
70,
62,
496,
62,
1525,
62,
19205,
796,
23493,
13,
41049,
7,
615,
70,
62,
1525,
62,
19205,
62,
22766,
737,
69,
7569,
439,
3419,
198,
4798,
7203,
26287,
2479,
416,
1748,
25,
1600,
42781,
62,
496,
62,
1525,
62,
19205,
8,
198,
2,
13475,
2479,
416,
1748,
25,
47527,
1959,
13,
15,
11,
705,
42,
14232,
1044,
33809,
357,
2624,
13,
20,
11,
705,
23421,
33809,
198,
2,
357,
3980,
13,
15,
11,
705,
7738,
6327,
33809,
357,
1821,
13,
15,
11,
705,
34007,
33809,
357,
1821,
13,
15,
11,
705,
51,
330,
6086,
11537,
60,
198,
198,
2,
532,
4600,
1452,
62,
1712,
62,
22031,
63,
25,
1867,
389,
262,
3478,
749,
5789,
3709,
357,
525,
4326,
2756,
8,
287,
262,
6831,
198,
2,
1635,
392,
9,
511,
20499,
30,
198,
198,
2,
9440,
10979,
2751,
16289,
36050,
32494,
15871,
6177,
5222,
198,
2,
20499,
62,
1050,
1063,
62,
11487,
796,
277,
37811,
43387,
6158,
43679,
20499,
62,
1050,
1063,
7054,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33493,
8721,
13,
15667,
5376,
11,
8721,
13,
26453,
18124,
11,
8105,
2505,
13,
39154,
5376,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16034,
8721,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12509,
9792,
32357,
1268,
8105,
2505,
6177,
8721,
13,
15979,
2505,
7390,
796,
8105,
2505,
13,
7390,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
2,
23493,
13,
41049,
7,
18608,
75,
3183,
62,
1050,
1063,
62,
11487,
8,
198,
198,
2,
36075,
62,
22766,
796,
277,
37811,
46506,
8721,
13,
15667,
5376,
11,
8721,
13,
26453,
18124,
11,
8105,
2505,
13,
39154,
5376,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16034,
8721,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12509,
9792,
32357,
1268,
8105,
2505,
6177,
8721,
13,
15979,
2505,
7390,
796,
8105,
2505,
13,
7390,
37811,
198,
2,
23493,
13,
41049,
7,
28463,
295,
62,
22766,
8,
198,
198,
20888,
62,
18608,
2505,
62,
22766,
796,
277,
37811,
46506,
4326,
20888,
11,
1664,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16034,
20499,
62,
1050,
1063,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
38678,
11050,
4326,
20888,
22196,
34,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27564,
2043,
838,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
20888,
62,
18608,
2505,
62,
4852,
1452,
796,
23493,
13,
41049,
7,
20888,
62,
18608,
2505,
62,
22766,
737,
69,
7569,
439,
3419,
198,
4798,
7203,
9126,
749,
5789,
3709,
290,
511,
20499,
25,
1600,
2756,
62,
18608,
2505,
62,
4852,
1452,
8,
198,
2,
5849,
749,
5789,
3709,
290,
511,
20499,
25,
47527,
29558,
13,
20,
11,
705,
32,
2821,
198,
2,
8716,
68,
2821,
21399,
45031,
13396,
459,
6368,
33809,
357,
10163,
13,
3720,
11,
705,
3646,
315,
9107,
1004,
65,
641,
20124,
417,
27333,
39683,
76,
11033,
81,
74,
660,
13077,
33809,
198,
2,
357,
5607,
11,
705,
19042,
8226,
8397,
364,
33809,
357,
6659,
11,
705,
13409,
774,
347,
2304,
15379,
11,
12052,
2637,
828,
198,
2,
357,
5237,
13,
20,
11,
705,
47,
615,
75,
10071,
11,
12052,
2637,
828,
357,
2816,
11,
705,
38,
1872,
279,
22940,
36590,
496,
33809,
357,
4310,
11,
366,
38,
1549,
323,
11,
24787,
12340,
198,
2,
357,
2920,
13,
18,
11,
366,
1890,
25792,
912,
288,
6,
42445,
2977,
12340,
357,
3510,
11,
705,
43,
38001,
25469,
33809,
357,
2231,
13,
21,
11,
705,
3646,
315,
9107,
1004,
65,
641,
20124,
417,
27333,
39683,
76,
11033,
81,
74,
660,
13077,
11537,
60,
198,
198,
2,
532,
4600,
28209,
62,
22872,
63,
25,
1867,
318,
262,
4387,
6536,
357,
1525,
1271,
286,
3748,
3186,
287,
340,
19427,
198,
28209,
62,
22872,
62,
22766,
796,
277,
37811,
46506,
21743,
7390,
11,
327,
28270,
7,
35,
8808,
1268,
4177,
8721,
5376,
8,
16034,
8721,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44441,
11050,
21743,
7390,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
38678,
11050,
327,
28270,
7,
35,
8808,
1268,
4177,
8721,
5376,
8,
22196,
34,
37811,
198,
28209,
62,
22872,
796,
23493,
13,
41049,
7,
28209,
62,
22872,
62,
22766,
737,
69,
7569,
505,
3419,
58,
15,
60,
198,
4798,
7203,
43,
853,
395,
6536,
25,
1600,
4387,
62,
22872,
8,
198,
2,
406,
853,
395,
6536,
25,
513,
198,
198,
2,
532,
20789,
39181,
28104,
4600,
1712,
62,
353,
799,
1749,
63,
25,
5338,
338,
262,
6538,
351,
262,
749,
16771,
30,
198,
2,
5765,
4600,
15156,
799,
652,
7390,
63,
357,
1662,
1438,
11,
3814,
11,
393,
584,
7032,
8,
355,
262,
3748,
198,
2,
27421,
329,
16771,
13,
198,
198,
2,
9440,
10979,
16289,
36050,
32494,
15871,
6177,
5222,
198,
2,
6538,
62,
353,
799,
652,
62,
11487,
796,
277,
37811,
43387,
6158,
43679,
6538,
62,
353,
799,
652,
7054,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33493,
36824,
13,
5962,
5376,
11,
36824,
13,
5956,
5376,
11,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36824,
15156,
799,
652,
13,
29733,
1453,
7390,
11,
36824,
15156,
799,
652,
13,
15156,
799,
652,
7390,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16034,
36824,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32357,
1268,
36824,
15156,
799,
652,
6177,
36824,
13,
7390,
796,
36824,
15156,
799,
652,
13,
29733,
1453,
7390,
26,
37811,
198,
2,
23493,
13,
41049,
7,
7033,
1453,
62,
353,
799,
652,
62,
11487,
8,
198,
198,
353,
799,
652,
62,
22766,
796,
277,
37811,
46506,
327,
28270,
7,
35,
8808,
1268,
4177,
25219,
7390,
828,
3274,
5376,
11,
4586,
5376,
11,
36824,
7390,
422,
6538,
62,
353,
799,
652,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44441,
11050,
36824,
7390,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
38678,
11050,
327,
28270,
7,
35,
8808,
1268,
4177,
25219,
7390,
8,
22196,
34,
37811,
198,
7033,
1453,
62,
353,
799,
652,
796,
23493,
13,
41049,
7,
353,
799,
652,
62,
22766,
737,
69,
7569,
505,
3419,
198,
4798,
7203,
13828,
6538,
468,
262,
749,
7674,
35379,
6538,
62,
353,
799,
652,
8,
198,
2,
9022,
6538,
468,
262,
749,
7674,
30,
357,
940,
11,
705,
19156,
3256,
705,
15708,
3256,
767,
8,
198,
198,
38659,
13,
41509,
3419,
198,
198,
38659,
13,
19836,
3419,
198
] | 2.412835 | 1,979 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import functools
from .SurfaceClassifier import conv1_1, period_loss
# from .DepthNormalizer import DepthNormalizer
from ..net_util import *
# from iPERCore.models.networks.criterions import VGGLoss
from lib.model.Models import NestedUNet
import numpy as np
class ResnetBlock(nn.Module):
"""Define a Resnet block"""
def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias, last=False):
"""Initialize the Resnet block
A resnet block is a conv block with skip connections
We construct a conv block with build_conv_block function,
and implement skip connections in <forward> function.
Original Resnet paper: https://arxiv.org/pdf/1512.03385.pdf
"""
super(ResnetBlock, self).__init__()
self.conv_block = self.build_conv_block(dim, padding_type, norm_layer, use_dropout, use_bias, last)
def build_conv_block(self, dim, padding_type, norm_layer, use_dropout, use_bias, last=False):
"""Construct a convolutional block.
Parameters:
dim (int) -- the number of channels in the conv layer.
padding_type (str) -- the name of padding layer: reflect | replicate | zero
norm_layer -- normalization layer
use_dropout (bool) -- if use dropout layers.
use_bias (bool) -- if the conv layer uses bias or not
Returns a conv block (with a conv layer, a normalization layer, and a non-linearity layer (ReLU))
"""
conv_block = []
p = 0
if padding_type == 'reflect':
conv_block += [nn.ReflectionPad2d(1)]
elif padding_type == 'replicate':
conv_block += [nn.ReplicationPad2d(1)]
elif padding_type == 'zero':
p = 1
else:
raise NotImplementedError('padding [%s] is not implemented' % padding_type)
conv_block += [nn.Conv2d(dim, dim, kernel_size=3, padding=p, bias=use_bias), norm_layer(dim), nn.ReLU(True)]
if use_dropout:
conv_block += [nn.Dropout(0.5)]
p = 0
if padding_type == 'reflect':
conv_block += [nn.ReflectionPad2d(1)]
elif padding_type == 'replicate':
conv_block += [nn.ReplicationPad2d(1)]
elif padding_type == 'zero':
p = 1
else:
raise NotImplementedError('padding [%s] is not implemented' % padding_type)
if last:
conv_block += [nn.Conv2d(dim, dim, kernel_size=3, padding=p, bias=use_bias)]
else:
conv_block += [nn.Conv2d(dim, dim, kernel_size=3, padding=p, bias=use_bias), norm_layer(dim)]
return nn.Sequential(*conv_block)
def forward(self, x):
"""Forward function (with skip connections)"""
out = x + self.conv_block(x) # add skip connections
return out
class ResnetFilter(nn.Module):
"""Resnet-based generator that consists of Resnet blocks between a few downsampling/upsampling operations.
We adapt Torch code and idea from Justin Johnson's neural style transfer project(https://github.com/jcjohnson/fast-neural-style)
"""
def __init__(self, opt, input_nc=3, output_nc=256, ngf=64, norm_layer=nn.BatchNorm2d, use_dropout=False,
n_blocks=6, padding_type='reflect'):
"""Construct a Resnet-based generator
Parameters:
input_nc (int) -- the number of channels in input images
output_nc (int) -- the number of channels in output images
ngf (int) -- the number of filters in the last conv layer
norm_layer -- normalization layer
use_dropout (bool) -- if use dropout layers
n_blocks (int) -- the number of ResNet blocks
padding_type (str) -- the name of padding layer in conv layers: reflect | replicate | zero
"""
assert (n_blocks >= 0)
super(ResnetFilter, self).__init__()
if type(norm_layer) == functools.partial:
use_bias = norm_layer.func == nn.InstanceNorm2d
else:
use_bias = norm_layer == nn.InstanceNorm2d
model = [nn.ReflectionPad2d(3),
nn.Conv2d(input_nc, ngf, kernel_size=7, padding=0, bias=use_bias),
norm_layer(ngf),
nn.ReLU(True)]
n_downsampling = 2
for i in range(n_downsampling): # add downsampling layers
mult = 2 ** i
model += [nn.Conv2d(ngf * mult, ngf * mult * 2, kernel_size=3, stride=2, padding=1, bias=use_bias),
norm_layer(ngf * mult * 2),
nn.ReLU(True)]
mult = 2 ** n_downsampling
for i in range(n_blocks): # add ResNet blocks
if i == n_blocks - 1:
model += [ResnetBlock(ngf * mult, padding_type=padding_type, norm_layer=norm_layer,
use_dropout=use_dropout, use_bias=use_bias, last=True)]
else:
model += [ResnetBlock(ngf * mult, padding_type=padding_type, norm_layer=norm_layer,
use_dropout=use_dropout, use_bias=use_bias)]
if opt.use_tanh:
model += [nn.Tanh()]
self.model = nn.Sequential(*model)
def forward(self, input):
"""Standard forward"""
return self.model(input)
| [
11748,
28034,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
198,
11748,
1257,
310,
10141,
198,
6738,
764,
14214,
2550,
9487,
7483,
1330,
3063,
16,
62,
16,
11,
2278,
62,
22462,
198,
2,
422,
764,
48791,
26447,
7509,
1330,
36350,
26447,
7509,
198,
6738,
11485,
3262,
62,
22602,
1330,
1635,
198,
2,
422,
9736,
1137,
14055,
13,
27530,
13,
3262,
5225,
13,
22213,
263,
507,
1330,
34627,
8763,
793,
198,
6738,
9195,
13,
19849,
13,
5841,
1424,
1330,
399,
7287,
4944,
316,
198,
11748,
299,
32152,
355,
45941,
628,
198,
4871,
1874,
3262,
12235,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
7469,
500,
257,
1874,
3262,
2512,
37811,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
5391,
11,
24511,
62,
4906,
11,
2593,
62,
29289,
11,
779,
62,
14781,
448,
11,
779,
62,
65,
4448,
11,
938,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
262,
1874,
3262,
2512,
198,
220,
220,
220,
220,
220,
220,
220,
317,
581,
3262,
2512,
318,
257,
3063,
2512,
351,
14267,
8787,
198,
220,
220,
220,
220,
220,
220,
220,
775,
5678,
257,
3063,
2512,
351,
1382,
62,
42946,
62,
9967,
2163,
11,
198,
220,
220,
220,
220,
220,
220,
220,
290,
3494,
14267,
8787,
287,
1279,
11813,
29,
2163,
13,
198,
220,
220,
220,
220,
220,
220,
220,
13745,
1874,
3262,
3348,
25,
3740,
1378,
283,
87,
452,
13,
2398,
14,
12315,
14,
1314,
1065,
13,
44427,
5332,
13,
12315,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
4965,
3262,
12235,
11,
2116,
737,
834,
15003,
834,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
42946,
62,
9967,
796,
2116,
13,
11249,
62,
42946,
62,
9967,
7,
27740,
11,
24511,
62,
4906,
11,
2593,
62,
29289,
11,
779,
62,
14781,
448,
11,
779,
62,
65,
4448,
11,
938,
8,
628,
220,
220,
220,
825,
1382,
62,
42946,
62,
9967,
7,
944,
11,
5391,
11,
24511,
62,
4906,
11,
2593,
62,
29289,
11,
779,
62,
14781,
448,
11,
779,
62,
65,
4448,
11,
938,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
42316,
257,
3063,
2122,
282,
2512,
13,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5391,
357,
600,
8,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1377,
262,
1271,
286,
9619,
287,
262,
3063,
7679,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24511,
62,
4906,
357,
2536,
8,
220,
1377,
262,
1438,
286,
24511,
7679,
25,
4079,
930,
24340,
930,
6632,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
29289,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1377,
3487,
1634,
7679,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
14781,
448,
357,
30388,
8,
220,
1377,
611,
779,
4268,
448,
11685,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
65,
4448,
357,
30388,
8,
220,
220,
220,
220,
1377,
611,
262,
3063,
7679,
3544,
10690,
393,
407,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
257,
3063,
2512,
357,
4480,
257,
3063,
7679,
11,
257,
3487,
1634,
7679,
11,
290,
257,
1729,
12,
29127,
414,
7679,
357,
3041,
41596,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
279,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
611,
24511,
62,
4906,
6624,
705,
35051,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
8134,
1564,
26114,
17,
67,
7,
16,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
24511,
62,
4906,
6624,
705,
35666,
5344,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
39232,
3299,
26114,
17,
67,
7,
16,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
24511,
62,
4906,
6624,
705,
22570,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
12331,
10786,
39231,
685,
4,
82,
60,
318,
407,
9177,
6,
4064,
24511,
62,
4906,
8,
628,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
3103,
85,
17,
67,
7,
27740,
11,
5391,
11,
9720,
62,
7857,
28,
18,
11,
24511,
28,
79,
11,
10690,
28,
1904,
62,
65,
4448,
828,
2593,
62,
29289,
7,
27740,
828,
299,
77,
13,
3041,
41596,
7,
17821,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
611,
779,
62,
14781,
448,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
26932,
448,
7,
15,
13,
20,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
279,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
611,
24511,
62,
4906,
6624,
705,
35051,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
8134,
1564,
26114,
17,
67,
7,
16,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
24511,
62,
4906,
6624,
705,
35666,
5344,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
39232,
3299,
26114,
17,
67,
7,
16,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
24511,
62,
4906,
6624,
705,
22570,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
12331,
10786,
39231,
685,
4,
82,
60,
318,
407,
9177,
6,
4064,
24511,
62,
4906,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
938,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
3103,
85,
17,
67,
7,
27740,
11,
5391,
11,
9720,
62,
7857,
28,
18,
11,
24511,
28,
79,
11,
10690,
28,
1904,
62,
65,
4448,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
9967,
15853,
685,
20471,
13,
3103,
85,
17,
67,
7,
27740,
11,
5391,
11,
9720,
62,
7857,
28,
18,
11,
24511,
28,
79,
11,
10690,
28,
1904,
62,
65,
4448,
828,
2593,
62,
29289,
7,
27740,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
299,
77,
13,
44015,
1843,
46491,
42946,
62,
9967,
8,
628,
220,
220,
220,
825,
2651,
7,
944,
11,
2124,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
39746,
2163,
357,
4480,
14267,
8787,
8,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2124,
1343,
2116,
13,
42946,
62,
9967,
7,
87,
8,
220,
1303,
751,
14267,
8787,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
503,
198,
198,
4871,
1874,
3262,
22417,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
4965,
3262,
12,
3106,
17301,
326,
10874,
286,
1874,
3262,
7021,
1022,
257,
1178,
21838,
321,
11347,
14,
4739,
321,
11347,
4560,
13,
198,
220,
220,
220,
775,
6068,
34868,
2438,
290,
2126,
422,
10799,
5030,
338,
17019,
3918,
4351,
1628,
7,
5450,
1378,
12567,
13,
785,
14,
48055,
30686,
1559,
14,
7217,
12,
710,
1523,
12,
7635,
8,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2172,
11,
5128,
62,
10782,
28,
18,
11,
5072,
62,
10782,
28,
11645,
11,
23370,
69,
28,
2414,
11,
2593,
62,
29289,
28,
20471,
13,
33,
963,
35393,
17,
67,
11,
779,
62,
14781,
448,
28,
25101,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
62,
27372,
28,
21,
11,
24511,
62,
4906,
11639,
35051,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
42316,
257,
1874,
3262,
12,
3106,
17301,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
10782,
357,
600,
8,
220,
220,
220,
220,
220,
1377,
262,
1271,
286,
9619,
287,
5128,
4263,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
62,
10782,
357,
600,
8,
220,
220,
220,
220,
1377,
262,
1271,
286,
9619,
287,
5072,
4263,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23370,
69,
357,
600,
8,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1377,
262,
1271,
286,
16628,
287,
262,
938,
3063,
7679,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
29289,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1377,
3487,
1634,
7679,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
14781,
448,
357,
30388,
8,
220,
1377,
611,
779,
4268,
448,
11685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
62,
27372,
357,
600,
8,
220,
220,
220,
220,
220,
1377,
262,
1271,
286,
1874,
7934,
7021,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24511,
62,
4906,
357,
2536,
8,
220,
1377,
262,
1438,
286,
24511,
7679,
287,
3063,
11685,
25,
4079,
930,
24340,
930,
6632,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
357,
77,
62,
27372,
18189,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
4965,
3262,
22417,
11,
2116,
737,
834,
15003,
834,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2099,
7,
27237,
62,
29289,
8,
6624,
1257,
310,
10141,
13,
47172,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
65,
4448,
796,
2593,
62,
29289,
13,
20786,
6624,
299,
77,
13,
33384,
35393,
17,
67,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
65,
4448,
796,
2593,
62,
29289,
6624,
299,
77,
13,
33384,
35393,
17,
67,
628,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
685,
20471,
13,
8134,
1564,
26114,
17,
67,
7,
18,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
77,
13,
3103,
85,
17,
67,
7,
15414,
62,
10782,
11,
23370,
69,
11,
9720,
62,
7857,
28,
22,
11,
24511,
28,
15,
11,
10690,
28,
1904,
62,
65,
4448,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
29289,
7,
782,
69,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
77,
13,
3041,
41596,
7,
17821,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
299,
62,
30371,
321,
11347,
796,
362,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
2837,
7,
77,
62,
30371,
321,
11347,
2599,
220,
1303,
751,
21838,
321,
11347,
11685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1963,
796,
362,
12429,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
15853,
685,
20471,
13,
3103,
85,
17,
67,
7,
782,
69,
1635,
1963,
11,
23370,
69,
1635,
1963,
1635,
362,
11,
9720,
62,
7857,
28,
18,
11,
33769,
28,
17,
11,
24511,
28,
16,
11,
10690,
28,
1904,
62,
65,
4448,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
29289,
7,
782,
69,
1635,
1963,
1635,
362,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
77,
13,
3041,
41596,
7,
17821,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
1963,
796,
362,
12429,
299,
62,
30371,
321,
11347,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
2837,
7,
77,
62,
27372,
2599,
220,
1303,
751,
1874,
7934,
7021,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
6624,
299,
62,
27372,
532,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
15853,
685,
4965,
3262,
12235,
7,
782,
69,
1635,
1963,
11,
24511,
62,
4906,
28,
39231,
62,
4906,
11,
2593,
62,
29289,
28,
27237,
62,
29289,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
14781,
448,
28,
1904,
62,
14781,
448,
11,
779,
62,
65,
4448,
28,
1904,
62,
65,
4448,
11,
938,
28,
17821,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
15853,
685,
4965,
3262,
12235,
7,
782,
69,
1635,
1963,
11,
24511,
62,
4906,
28,
39231,
62,
4906,
11,
2593,
62,
29289,
28,
27237,
62,
29289,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
14781,
448,
28,
1904,
62,
14781,
448,
11,
779,
62,
65,
4448,
28,
1904,
62,
65,
4448,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
611,
2172,
13,
1904,
62,
38006,
71,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
15853,
685,
20471,
13,
45557,
71,
3419,
60,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
19849,
796,
299,
77,
13,
44015,
1843,
46491,
19849,
8,
628,
220,
220,
220,
825,
2651,
7,
944,
11,
5128,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
23615,
2651,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
19849,
7,
15414,
8,
198
] | 2.209671 | 2,461 |
#!/usr/lib/python-exec/python2.7/python
import os
import sys
os.chdir('C:/Users/Leleo/Documents/Active Cell Real Morphology/')
from neuron import h
from neuron import gui
#%%
import numpy as np
import time
import math
import cPickle as pickle
#%%
sk = False
if sk==True:
from sklearn import decomposition
from sklearn import cluster
from sklearn import linear_model
from sklearn import ensemble
from sklearn import cross_validation
#%%
h.load_file('nrngui.hoc')
h.load_file("import3d.hoc")
cvode = h.CVode()
cvode.active(0)
morphologyFilename = "morphologies/cell1.asc"
#morphologyFilename = "morphologies/cell2.asc"
#morphologyFilename = "morphologies/cell3.asc"
#biophysicalModelFilename = "L5PCbiophys1.hoc"
#biophysicalModelFilename = "L5PCbiophys2.hoc"
#biophysicalModelFilename = "L5PCbiophys3.hoc"
#biophysicalModelFilename = "L5PCbiophys4.hoc"
#biophysicalModelFilename = "L5PCbiophys5.hoc"
biophysicalModelFilename = "L5PCbiophys5b.hoc"
#biophysicalModelTemplateFilename = "L5PCtemplate.hoc"
biophysicalModelTemplateFilename = "L5PCtemplate_2.hoc"
#%%
h.load_file(biophysicalModelFilename)
h.load_file(biophysicalModelTemplateFilename)
L5PC = h.L5PCtemplate(morphologyFilename)
h.celsius = 34
#%% set dendritic VDCC g=0
#secs = h.allsec
VDCC_g = 1
if VDCC_g==0:
for sec in h.allsec():
if hasattr(sec, 'gCa_HVAbar_Ca_HVA'):
sec.gCa_HVAbar_Ca_HVA = 0
#%% helper functions
#%% create length-weighted random section list
#%% add some random NMDA synapses and plot a somatic trace just to see all things are alive and kicking
#%% run simulation on some parameter pair, plot the space
L5PC = h.L5PCtemplate(morphologyFilename)
name = 'inh_secdt_meds62_exc60dt0sd0num15'
#saveDir = '/ems/elsc-labs/segev-i/eilam.goldenberg/Documents/coincidence/wgh1/'+name+'/'
saveDir = 'C:/Users/Leleo/Documents/coincidence/wgh1/'+name+'/'
if not os.path.exists(saveDir):
os.makedirs(saveDir)
try:
randomSeed = int(sys.argv[1])
print 'random seed selected by user - %d' %(randomSeed)
except:
randomSeed = np.random.randint(100000)
print 'randomly chose seed - %d' %(randomSeed)
np.random.seed(randomSeed)
#ind = 1
#a = np.linspace(-50,-25,num=6),np.linspace(-20,20,num=21),np.linspace(25,100,num=16)
ApicalBasalInterval = [0]#np.linspace(-10,10,num=11) #[x for xs in a for x in xs]
numBasal = 50 #35 #np.linspace(0,200,num=81)
numApical = 30 #np.linspace(0,20,num=11)#50,num=21)#
numInh = 20 #0
#numOblique = 40-numApical
#totalSyn = [20,50,100,200,400,600,800]#[80,120,150,180]#np.linspace(0,200,num=5)#41)
partApical = 2 #[5,10,20,50,100,200,500]#[i for i in np.linspace(10,100,num=10)]+[200,300,400,500]#np.logspace(0,7,num=29,base=2)
medSegment = [0,36,60,63]#[36]+[i for i in np.linspace(60,65,num=6)]#37,44,num=8)] ##40#60 #
#secInh = [60[0.5],60[1],61[0],62[0],63[0],64[0],67[0]] #optimal planned inh at prox junc
#secInh = [60[1],61[0],63[1]] #encapsulating inh for partApi=20
#random.choice(secInh)
treeTime = 0 #0.1*np.logspace(3,10,num=22,base=2)
numExperiments = 20
spks = [[0 for i in range(len(ApicalBasalInterval))] for j in range(len(medSegment))]#*4)]
frqs = [[0 for i in range(len(ApicalBasalInterval))] for j in range(len(medSegment))]#*4)]
#trc = [[[] for i in range(len(ApicalBasalInterval))] for j in range(len(medSegment))]#*4)]
i = 0
j = 0
start = time.time()
for ApiBasInd in ApicalBasalInterval:#treeT in treeTime:#
print "Running for interval: %s [ms]" % (int(ApiBasInd))#treeTime: %.2f [ms]" % (treeT)#
#for numB in numBasal:#totalS in totalSyn:#
# print "Running for %s basal synapses" % (int(numB))
# for partApi in partApical:
for medS in medSegment:
# for numA in numApical:#np.linspace(0,totalS,num=41):#
print "Running for inhibition in sec: %s" % (int(medS)) #partApi=%s" % (float(partApi)) #
# numA = int(totalS*0.4)
spks[j][i],frqs[j][i] = runSim(L5PC,ApiBasInd,treeTime,numBasal,numInh,numApical,medS,partApical,numExperiments)
j = j+1
j = 0
i = i+1
pickle.dump(spks,open(saveDir+name+'_spks'+str(randomSeed)+".npy","wb"),protocol=2)
pickle.dump(frqs,open(saveDir+name+'_frqs'+str(randomSeed)+".npy","wb"),protocol=2)
print "Saved as ", saveDir+name+'_spks'+str(randomSeed)+".npy"
print "Total running time was: ", (time.time()-start)/3600, "hours"
#saveDir = '/ems/elsc-labs/segev-i/eilam.goldenberg/Documents/concidence/'
#pickle.dump(spks1,open(saveDir+'dt_treet_30tot_hires_spks',"wb"),protocol=2)
#pickle.dump(frqs1,open(saveDir+'dt_treet_30tot_hires_frqs',"wb"),protocol=2)
| [
2,
48443,
14629,
14,
8019,
14,
29412,
12,
18558,
14,
29412,
17,
13,
22,
14,
29412,
198,
11748,
28686,
198,
11748,
25064,
198,
418,
13,
354,
15908,
10786,
34,
14079,
14490,
14,
3123,
293,
78,
14,
38354,
14,
13739,
12440,
6416,
41170,
1435,
14,
11537,
198,
198,
6738,
43164,
1330,
289,
198,
6738,
43164,
1330,
11774,
198,
198,
2,
16626,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
640,
198,
11748,
10688,
198,
11748,
269,
31686,
293,
355,
2298,
293,
198,
198,
2,
16626,
198,
198,
8135,
796,
10352,
198,
198,
361,
1341,
855,
17821,
25,
198,
220,
220,
220,
422,
1341,
35720,
1330,
26969,
9150,
198,
220,
220,
220,
422,
1341,
35720,
1330,
13946,
198,
220,
220,
220,
422,
1341,
35720,
1330,
14174,
62,
19849,
198,
220,
220,
220,
422,
1341,
35720,
1330,
34549,
198,
220,
220,
220,
422,
1341,
35720,
1330,
3272,
62,
12102,
341,
198,
198,
2,
16626,
198,
198,
71,
13,
2220,
62,
7753,
10786,
48624,
782,
9019,
13,
71,
420,
11537,
198,
71,
13,
2220,
62,
7753,
7203,
11748,
18,
67,
13,
71,
420,
4943,
198,
198,
33967,
1098,
796,
289,
13,
33538,
1098,
3419,
198,
33967,
1098,
13,
5275,
7,
15,
8,
198,
198,
24503,
1435,
35063,
796,
366,
24503,
5823,
14,
3846,
16,
13,
3372,
1,
198,
2,
24503,
1435,
35063,
796,
366,
24503,
5823,
14,
3846,
17,
13,
3372,
1,
198,
2,
24503,
1435,
35063,
796,
366,
24503,
5823,
14,
3846,
18,
13,
3372,
1,
198,
198,
2,
8482,
41789,
17633,
35063,
796,
366,
43,
20,
5662,
8482,
39665,
16,
13,
71,
420,
1,
198,
2,
8482,
41789,
17633,
35063,
796,
366,
43,
20,
5662,
8482,
39665,
17,
13,
71,
420,
1,
198,
2,
8482,
41789,
17633,
35063,
796,
366,
43,
20,
5662,
8482,
39665,
18,
13,
71,
420,
1,
198,
2,
8482,
41789,
17633,
35063,
796,
366,
43,
20,
5662,
8482,
39665,
19,
13,
71,
420,
1,
198,
2,
8482,
41789,
17633,
35063,
796,
366,
43,
20,
5662,
8482,
39665,
20,
13,
71,
420,
1,
198,
8482,
41789,
17633,
35063,
796,
366,
43,
20,
5662,
8482,
39665,
20,
65,
13,
71,
420,
1,
198,
198,
2,
8482,
41789,
17633,
30800,
35063,
796,
366,
43,
20,
5662,
28243,
13,
71,
420,
1,
198,
8482,
41789,
17633,
30800,
35063,
796,
366,
43,
20,
5662,
28243,
62,
17,
13,
71,
420,
1,
628,
198,
2,
16626,
198,
198,
71,
13,
2220,
62,
7753,
7,
8482,
41789,
17633,
35063,
8,
198,
71,
13,
2220,
62,
7753,
7,
8482,
41789,
17633,
30800,
35063,
8,
198,
43,
20,
5662,
796,
289,
13,
43,
20,
5662,
28243,
7,
24503,
1435,
35063,
8,
198,
71,
13,
5276,
82,
3754,
796,
4974,
198,
198,
2,
16626,
900,
288,
437,
46015,
569,
35,
4093,
308,
28,
15,
198,
2,
2363,
82,
796,
289,
13,
439,
2363,
198,
198,
8898,
4093,
62,
70,
796,
352,
198,
198,
361,
569,
35,
4093,
62,
70,
855,
15,
25,
198,
220,
220,
220,
329,
792,
287,
289,
13,
439,
2363,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
35226,
7,
2363,
11,
705,
70,
24334,
62,
39,
53,
4826,
283,
62,
24334,
62,
39,
11731,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
792,
13,
70,
24334,
62,
39,
53,
4826,
283,
62,
24334,
62,
39,
11731,
796,
657,
198,
220,
220,
220,
220,
198,
198,
2,
16626,
31904,
5499,
220,
198,
198,
2,
16626,
2251,
4129,
12,
6551,
276,
4738,
2665,
1351,
198,
198,
2,
16626,
751,
617,
4738,
28692,
5631,
6171,
45903,
290,
7110,
257,
3870,
1512,
12854,
655,
284,
766,
477,
1243,
389,
6776,
290,
17997,
198,
198,
2,
16626,
1057,
18640,
319,
617,
11507,
5166,
11,
7110,
262,
2272,
198,
43,
20,
5662,
796,
289,
13,
43,
20,
5662,
28243,
7,
24503,
1435,
35063,
8,
198,
3672,
796,
705,
259,
71,
62,
2363,
28664,
62,
1150,
82,
5237,
62,
41194,
1899,
28664,
15,
21282,
15,
22510,
1314,
6,
198,
2,
21928,
35277,
796,
31051,
5232,
14,
417,
1416,
12,
75,
8937,
14,
325,
469,
85,
12,
72,
14,
68,
346,
321,
13,
24267,
23140,
14,
38354,
14,
1073,
1939,
1704,
14,
86,
456,
16,
14,
6,
10,
3672,
10,
26488,
6,
198,
21928,
35277,
796,
705,
34,
14079,
14490,
14,
3123,
293,
78,
14,
38354,
14,
1073,
1939,
1704,
14,
86,
456,
16,
14,
6,
10,
3672,
10,
26488,
6,
198,
361,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
21928,
35277,
2599,
198,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
21928,
35277,
8,
198,
198,
28311,
25,
198,
220,
220,
220,
4738,
50,
2308,
796,
493,
7,
17597,
13,
853,
85,
58,
16,
12962,
198,
220,
220,
220,
3601,
705,
25120,
9403,
6163,
416,
2836,
532,
4064,
67,
6,
4064,
7,
25120,
50,
2308,
8,
198,
16341,
25,
198,
220,
220,
220,
4738,
50,
2308,
796,
45941,
13,
25120,
13,
25192,
600,
7,
3064,
830,
8,
198,
220,
220,
220,
3601,
705,
25120,
306,
7690,
9403,
532,
4064,
67,
6,
4064,
7,
25120,
50,
2308,
8,
198,
198,
37659,
13,
25120,
13,
28826,
7,
25120,
50,
2308,
8,
198,
198,
2,
521,
796,
352,
198,
2,
64,
796,
45941,
13,
21602,
10223,
32590,
1120,
12095,
1495,
11,
22510,
28,
21,
828,
37659,
13,
21602,
10223,
32590,
1238,
11,
1238,
11,
22510,
28,
2481,
828,
37659,
13,
21602,
10223,
7,
1495,
11,
3064,
11,
22510,
28,
1433,
8,
198,
25189,
605,
15522,
282,
9492,
2100,
796,
685,
15,
60,
2,
37659,
13,
21602,
10223,
32590,
940,
11,
940,
11,
22510,
28,
1157,
8,
1303,
58,
87,
329,
2124,
82,
287,
257,
329,
2124,
287,
2124,
82,
60,
198,
22510,
15522,
282,
796,
2026,
1303,
2327,
1303,
37659,
13,
21602,
10223,
7,
15,
11,
2167,
11,
22510,
28,
6659,
8,
198,
22510,
25189,
605,
796,
1542,
1303,
37659,
13,
21602,
10223,
7,
15,
11,
1238,
11,
22510,
28,
1157,
8,
2,
1120,
11,
22510,
28,
2481,
8,
2,
198,
22510,
818,
71,
796,
1160,
1303,
15,
198,
2,
22510,
46,
2436,
2350,
796,
2319,
12,
22510,
25189,
605,
198,
2,
23350,
29934,
796,
685,
1238,
11,
1120,
11,
3064,
11,
2167,
11,
7029,
11,
8054,
11,
7410,
60,
2,
58,
1795,
11,
10232,
11,
8628,
11,
15259,
60,
2,
37659,
13,
21602,
10223,
7,
15,
11,
2167,
11,
22510,
28,
20,
8,
2,
3901,
8,
198,
3911,
25189,
605,
796,
362,
1303,
58,
20,
11,
940,
11,
1238,
11,
1120,
11,
3064,
11,
2167,
11,
4059,
60,
2,
58,
72,
329,
1312,
287,
45941,
13,
21602,
10223,
7,
940,
11,
3064,
11,
22510,
28,
940,
15437,
10,
58,
2167,
11,
6200,
11,
7029,
11,
4059,
60,
2,
37659,
13,
6404,
13200,
7,
15,
11,
22,
11,
22510,
28,
1959,
11,
8692,
28,
17,
8,
198,
1150,
41030,
434,
796,
685,
15,
11,
2623,
11,
1899,
11,
5066,
60,
2,
58,
2623,
48688,
58,
72,
329,
1312,
287,
45941,
13,
21602,
10223,
7,
1899,
11,
2996,
11,
22510,
28,
21,
15437,
2,
2718,
11,
2598,
11,
22510,
28,
23,
15437,
22492,
1821,
2,
1899,
1303,
198,
2,
2363,
818,
71,
796,
685,
1899,
58,
15,
13,
20,
4357,
1899,
58,
16,
4357,
5333,
58,
15,
4357,
5237,
58,
15,
4357,
5066,
58,
15,
4357,
2414,
58,
15,
4357,
3134,
58,
15,
11907,
1303,
8738,
4402,
6027,
25783,
379,
14793,
10891,
66,
198,
2,
2363,
818,
71,
796,
685,
1899,
58,
16,
4357,
5333,
58,
15,
4357,
5066,
58,
16,
11907,
1303,
12685,
1686,
8306,
25783,
329,
636,
32,
14415,
28,
1238,
198,
2,
25120,
13,
25541,
7,
2363,
818,
71,
8,
198,
21048,
7575,
796,
657,
1303,
15,
13,
16,
9,
37659,
13,
6404,
13200,
7,
18,
11,
940,
11,
22510,
28,
1828,
11,
8692,
28,
17,
8,
198,
22510,
20468,
6800,
796,
1160,
198,
198,
2777,
591,
796,
16410,
15,
329,
1312,
287,
2837,
7,
11925,
7,
25189,
605,
15522,
282,
9492,
2100,
4008,
60,
329,
474,
287,
2837,
7,
11925,
7,
1150,
41030,
434,
4008,
60,
2,
9,
19,
15437,
220,
198,
8310,
48382,
796,
16410,
15,
329,
1312,
287,
2837,
7,
11925,
7,
25189,
605,
15522,
282,
9492,
2100,
4008,
60,
329,
474,
287,
2837,
7,
11925,
7,
1150,
41030,
434,
4008,
60,
2,
9,
19,
15437,
198,
2,
2213,
66,
796,
16410,
21737,
329,
1312,
287,
2837,
7,
11925,
7,
25189,
605,
15522,
282,
9492,
2100,
4008,
60,
329,
474,
287,
2837,
7,
11925,
7,
1150,
41030,
434,
4008,
60,
2,
9,
19,
15437,
198,
198,
72,
796,
657,
198,
73,
796,
657,
198,
198,
9688,
796,
640,
13,
2435,
3419,
198,
198,
1640,
5949,
72,
15522,
5497,
287,
5949,
605,
15522,
282,
9492,
2100,
43922,
21048,
51,
287,
5509,
7575,
43922,
198,
220,
220,
220,
3601,
366,
28768,
329,
16654,
25,
4064,
82,
685,
907,
30866,
4064,
357,
600,
7,
32,
14415,
15522,
5497,
4008,
2,
21048,
7575,
25,
4064,
13,
17,
69,
685,
907,
30866,
4064,
357,
21048,
51,
8,
2,
198,
2,
1640,
997,
33,
287,
997,
15522,
282,
43922,
23350,
50,
287,
2472,
29934,
43922,
198,
2,
220,
220,
220,
3601,
366,
28768,
329,
4064,
82,
41202,
6171,
45903,
1,
4064,
357,
600,
7,
22510,
33,
4008,
198,
2,
220,
220,
220,
329,
636,
32,
14415,
287,
636,
25189,
605,
25,
198,
220,
220,
220,
329,
1117,
50,
287,
1117,
41030,
434,
25,
198,
2,
220,
220,
220,
329,
997,
32,
287,
997,
25189,
605,
43922,
37659,
13,
21602,
10223,
7,
15,
11,
23350,
50,
11,
22510,
28,
3901,
2599,
2,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
366,
28768,
329,
30725,
287,
792,
25,
4064,
82,
1,
4064,
357,
600,
7,
1150,
50,
4008,
1303,
3911,
32,
14415,
28,
4,
82,
1,
4064,
357,
22468,
7,
3911,
32,
14415,
4008,
1303,
198,
2,
220,
220,
220,
220,
220,
220,
220,
997,
32,
796,
493,
7,
23350,
50,
9,
15,
13,
19,
8,
198,
220,
220,
220,
220,
220,
220,
220,
599,
591,
58,
73,
7131,
72,
4357,
8310,
48382,
58,
73,
7131,
72,
60,
796,
1057,
8890,
7,
43,
20,
5662,
11,
32,
14415,
15522,
5497,
11,
21048,
7575,
11,
22510,
15522,
282,
11,
22510,
818,
71,
11,
22510,
25189,
605,
11,
1150,
50,
11,
3911,
25189,
605,
11,
22510,
20468,
6800,
8,
198,
220,
220,
220,
220,
220,
220,
220,
474,
796,
474,
10,
16,
198,
220,
220,
220,
474,
796,
657,
198,
220,
220,
220,
1312,
796,
1312,
10,
16,
198,
220,
220,
220,
220,
198,
27729,
293,
13,
39455,
7,
2777,
591,
11,
9654,
7,
21928,
35277,
10,
3672,
10,
6,
62,
2777,
591,
6,
10,
2536,
7,
25120,
50,
2308,
47762,
1911,
77,
9078,
2430,
39346,
12340,
11235,
4668,
28,
17,
8,
198,
27729,
293,
13,
39455,
7,
8310,
48382,
11,
9654,
7,
21928,
35277,
10,
3672,
10,
6,
62,
8310,
48382,
6,
10,
2536,
7,
25120,
50,
2308,
47762,
1911,
77,
9078,
2430,
39346,
12340,
11235,
4668,
28,
17,
8,
198,
198,
4798,
366,
50,
9586,
355,
33172,
3613,
35277,
10,
3672,
10,
6,
62,
2777,
591,
6,
10,
2536,
7,
25120,
50,
2308,
47762,
1911,
77,
9078,
1,
198,
4798,
366,
14957,
2491,
640,
373,
25,
33172,
357,
2435,
13,
2435,
3419,
12,
9688,
20679,
2623,
405,
11,
366,
24425,
1,
198,
198,
2,
21928,
35277,
796,
31051,
5232,
14,
417,
1416,
12,
75,
8937,
14,
325,
469,
85,
12,
72,
14,
68,
346,
321,
13,
24267,
23140,
14,
38354,
14,
1102,
66,
1704,
14,
6,
198,
2,
27729,
293,
13,
39455,
7,
2777,
591,
16,
11,
9654,
7,
21928,
35277,
10,
6,
28664,
62,
83,
2871,
62,
1270,
83,
313,
62,
71,
2387,
62,
2777,
591,
40264,
39346,
12340,
11235,
4668,
28,
17,
8,
198,
2,
27729,
293,
13,
39455,
7,
8310,
48382,
16,
11,
9654,
7,
21928,
35277,
10,
6,
28664,
62,
83,
2871,
62,
1270,
83,
313,
62,
71,
2387,
62,
8310,
48382,
40264,
39346,
12340,
11235,
4668,
28,
17,
8,
198
] | 2.305906 | 1,981 |
from selenium import webdriver
import time
from datetime import date
from selenium.webdriver.common.keys import Keys
from scrape_table_all import scrape_table
from return_dates import return_dates
# Open the link
PATH = "/Users/prajwalshrestha/Desktop/PythonApp/thesis/web-scrapers/sharesansar/chromedriver"
browser = webdriver.Chrome(PATH)
browser.maximize_window()
browser.get("https://www.sharesansar.com/today-share-price")
# Select the type of data to scrape
searchBar = browser.find_element_by_id('sector')
browser.implicitly_wait(20)
# Select Commercial Bank
searchBar.send_keys('Commercial Bank')
sdate = date(2020, 3, 23)
edate = date(2021, 5, 13)
dates = return_dates(sdate, edate)
for day in dates:
# Enter the date
date_box = browser.find_elements_by_id('fromdate')
date_box[0].clear()
date_box[0].send_keys(day)
# Click Search
searchBar = browser.find_element_by_id('btn_todayshareprice_submit')
searchBar.click()
time.sleep(3)
# Needed for this sites
searchBar.send_keys(Keys.ENTER)
# Wait for data to show up longer wait time ensures data has loaded before scraping begins
time.sleep(8)
# Scrape the table
html = browser.page_source
scrape_table(data=html, date=day)
browser.close()
| [
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
11748,
640,
198,
6738,
4818,
8079,
1330,
3128,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
13083,
1330,
26363,
198,
6738,
42778,
62,
11487,
62,
439,
1330,
42778,
62,
11487,
198,
6738,
1441,
62,
19581,
1330,
1441,
62,
19581,
198,
198,
2,
4946,
262,
2792,
198,
34219,
796,
12813,
14490,
14,
79,
430,
73,
86,
22114,
2118,
3099,
14,
36881,
14,
37906,
4677,
14,
83,
8497,
14,
12384,
12,
1416,
2416,
364,
14,
1477,
3565,
504,
283,
14,
28663,
276,
38291,
1,
198,
40259,
796,
3992,
26230,
13,
1925,
5998,
7,
34219,
8,
198,
40259,
13,
9806,
48439,
62,
17497,
3419,
198,
40259,
13,
1136,
7203,
5450,
1378,
2503,
13,
1477,
3565,
504,
283,
13,
785,
14,
40838,
12,
20077,
12,
20888,
4943,
198,
2,
9683,
262,
2099,
286,
1366,
284,
42778,
198,
12947,
10374,
796,
6444,
13,
19796,
62,
30854,
62,
1525,
62,
312,
10786,
34914,
11537,
198,
40259,
13,
23928,
3628,
306,
62,
17077,
7,
1238,
8,
198,
2,
9683,
22724,
5018,
198,
12947,
10374,
13,
21280,
62,
13083,
10786,
48401,
5018,
11537,
198,
198,
82,
4475,
796,
3128,
7,
42334,
11,
513,
11,
2242,
8,
198,
276,
378,
796,
3128,
7,
1238,
2481,
11,
642,
11,
1511,
8,
198,
19581,
796,
1441,
62,
19581,
7,
82,
4475,
11,
1225,
378,
8,
628,
198,
1640,
1110,
287,
9667,
25,
198,
220,
220,
220,
1303,
6062,
262,
3128,
198,
220,
220,
220,
3128,
62,
3524,
796,
6444,
13,
19796,
62,
68,
3639,
62,
1525,
62,
312,
10786,
6738,
4475,
11537,
198,
220,
220,
220,
3128,
62,
3524,
58,
15,
4083,
20063,
3419,
198,
220,
220,
220,
3128,
62,
3524,
58,
15,
4083,
21280,
62,
13083,
7,
820,
8,
198,
220,
220,
220,
1303,
6914,
11140,
198,
220,
220,
220,
2989,
10374,
796,
6444,
13,
19796,
62,
30854,
62,
1525,
62,
312,
10786,
46118,
62,
83,
375,
592,
43466,
20888,
62,
46002,
11537,
198,
220,
220,
220,
2989,
10374,
13,
12976,
3419,
198,
220,
220,
220,
640,
13,
42832,
7,
18,
8,
198,
220,
220,
220,
1303,
10664,
276,
329,
428,
5043,
198,
220,
220,
220,
2989,
10374,
13,
21280,
62,
13083,
7,
40729,
13,
3525,
1137,
8,
198,
220,
220,
220,
1303,
16314,
329,
1366,
284,
905,
510,
2392,
4043,
640,
19047,
1366,
468,
9639,
878,
46743,
6140,
198,
220,
220,
220,
640,
13,
42832,
7,
23,
8,
198,
220,
220,
220,
1303,
1446,
13484,
262,
3084,
198,
220,
220,
220,
27711,
796,
6444,
13,
7700,
62,
10459,
198,
220,
220,
220,
42778,
62,
11487,
7,
7890,
28,
6494,
11,
3128,
28,
820,
8,
198,
198,
40259,
13,
19836,
3419,
198
] | 2.851016 | 443 |
import pytest
import subprocess
from io import BytesIO
import json
from werkzeug.wrappers import Response
from elephant_vending_machine import elephant_vending_machine
from subprocess import CompletedProcess, CalledProcessError
@pytest.fixture
| [
11748,
12972,
9288,
198,
11748,
850,
14681,
198,
6738,
33245,
1330,
2750,
4879,
9399,
198,
11748,
33918,
198,
198,
6738,
266,
9587,
2736,
1018,
13,
29988,
11799,
1330,
18261,
198,
198,
6738,
20950,
62,
85,
1571,
62,
30243,
1330,
20950,
62,
85,
1571,
62,
30243,
198,
6738,
850,
14681,
1330,
32983,
18709,
11,
34099,
18709,
12331,
198,
198,
31,
9078,
9288,
13,
69,
9602,
628,
628
] | 3.787879 | 66 |
from django.conf.urls import url
from django.urls import path
from . import views
app_name = 'articles'
urlpatterns = [
url(r'^$', views.homepage, name="list"),
url(r'^about/$', views.about, name="about"),
url(r'^contact/$', views.contact, name="contact"),
url(r'^bolaka/$', views.bolaka, name="bolaka"),
url(r'^offers_page/$', views.offers, name="offers_page"),
url(r'^bolakareview/$', views.bolakareview, name="bolakareview"),
url(r'^ticket/$', views.ticket, name="ticket"),
path('deletebalaka/<str:pk>/$', views.deletebalaka, name="deletebalaka"),
url(r'^ticket_page/$', views.ticket_page, name="ticket_page"),
# Air
url(r'^Air_Biman_Bangladesh/$', views.Air_Biman_Bangladesh, name="Air_Biman_Bangladesh"),
url(r'^Air_Novoair/$', views.Air_Novoair, name="Air_Novoair"),
url(r'^Air_US_Bangla/$', views.Air_US_Bangla, name="Air_US_Bangla"),
# Bus
url(r'^Bus_Akash/$', views.Bus_Akash, name="Bus_Akash"),
url(r'^Bus_Alif/$', views.Bus_Alif, name="Bus_Alif"),
url(r'^Bus_Anabil/$', views.Bus_Anabil, name="Bus_Anabil"),
url(r'^Bus_BRTC/$', views.Bus_BRTC, name="Bus_BRTC"),
url(r'^Bus_Green_Dhaka/$', views.Bus_Green_Dhaka, name="Bus_Green_Dhaka"),
url(r'^Bus_Raida/$', views.Bus_Raida, name="Bus_Raida"),
url(r'^Bus_Skyline/$', views.Bus_Skyline, name="Bus_Skyline"),
url(r'^Bus_Supravat/$', views.Bus_Supravat, name="Bus_Supravat"),
url(r'^Bus_VIP/$', views.Bus_VIP, name="Bus_VIP"),
# Train
url(r'^Train_Chitra_Express/$', views.Train_Chitra_Express, name="Train_Chitra_Express"),
url(r'^Train_Ekota_Express/$', views.Train_Ekota_Express, name="Train_Ekota_Express"),
url(r'^Train_Mahanagar_Godhuli/$', views.Train_Mahanagar_Godhuli, name="Train_Mahanagar_Godhuli"),
url(r'^Train_Suborno_Express/$', views.Train_Suborno_Express, name="Train_Suborno_Express"),
url(r'^Train_Tista_Express/$', views.Train_Tista_Express, name="Train_Tista_Express"),
url(r'^(?P<slug>[\w-]+)/$', views.homepage, name="list"),
]
| [
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
19016,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
764,
1330,
5009,
198,
198,
1324,
62,
3672,
796,
705,
26845,
6,
628,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
3,
3256,
5009,
13,
11195,
7700,
11,
1438,
2625,
4868,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
10755,
32624,
3256,
5009,
13,
10755,
11,
1438,
2625,
10755,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
32057,
32624,
3256,
5009,
13,
32057,
11,
1438,
2625,
32057,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
28984,
8130,
32624,
3256,
5009,
13,
28984,
8130,
11,
1438,
2625,
28984,
8130,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
2364,
364,
62,
7700,
32624,
3256,
5009,
13,
2364,
364,
11,
1438,
2625,
2364,
364,
62,
7700,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
28984,
461,
533,
1177,
32624,
3256,
5009,
13,
28984,
461,
533,
1177,
11,
1438,
2625,
28984,
461,
533,
1177,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
43350,
32624,
3256,
5009,
13,
43350,
11,
1438,
2625,
43350,
12340,
198,
220,
220,
220,
3108,
10786,
33678,
6893,
8130,
14,
27,
2536,
25,
79,
74,
29,
32624,
3256,
5009,
13,
33678,
6893,
8130,
11,
1438,
2625,
33678,
6893,
8130,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
43350,
62,
7700,
32624,
3256,
5009,
13,
43350,
62,
7700,
11,
1438,
2625,
43350,
62,
7700,
12340,
628,
198,
220,
220,
220,
1303,
3701,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16170,
62,
33,
24086,
62,
43984,
75,
13410,
32624,
3256,
5009,
13,
16170,
62,
33,
24086,
62,
43984,
75,
13410,
11,
1438,
2625,
16170,
62,
33,
24086,
62,
43984,
75,
13410,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16170,
62,
45,
18768,
958,
32624,
3256,
5009,
13,
16170,
62,
45,
18768,
958,
11,
1438,
2625,
16170,
62,
45,
18768,
958,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16170,
62,
2937,
62,
43984,
5031,
32624,
3256,
5009,
13,
16170,
62,
2937,
62,
43984,
5031,
11,
1438,
2625,
16170,
62,
2937,
62,
43984,
5031,
12340,
628,
220,
220,
220,
1303,
5869,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
33901,
1077,
32624,
3256,
5009,
13,
16286,
62,
33901,
1077,
11,
1438,
2625,
16286,
62,
33901,
1077,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
2348,
361,
32624,
3256,
5009,
13,
16286,
62,
2348,
361,
11,
1438,
2625,
16286,
62,
2348,
361,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
2025,
14991,
32624,
3256,
5009,
13,
16286,
62,
2025,
14991,
11,
1438,
2625,
16286,
62,
2025,
14991,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
11473,
4825,
32624,
3256,
5009,
13,
16286,
62,
11473,
4825,
11,
1438,
2625,
16286,
62,
11473,
4825,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
13719,
62,
35,
71,
8130,
32624,
3256,
5009,
13,
16286,
62,
13719,
62,
35,
71,
8130,
11,
1438,
2625,
16286,
62,
13719,
62,
35,
71,
8130,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
49,
30546,
32624,
3256,
5009,
13,
16286,
62,
49,
30546,
11,
1438,
2625,
16286,
62,
49,
30546,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
22308,
1370,
32624,
3256,
5009,
13,
16286,
62,
22308,
1370,
11,
1438,
2625,
16286,
62,
22308,
1370,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
40784,
4108,
265,
32624,
3256,
5009,
13,
16286,
62,
40784,
4108,
265,
11,
1438,
2625,
16286,
62,
40784,
4108,
265,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
16286,
62,
53,
4061,
32624,
3256,
5009,
13,
16286,
62,
53,
4061,
11,
1438,
2625,
16286,
62,
53,
4061,
12340,
628,
220,
220,
220,
1303,
16835,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
44077,
62,
1925,
270,
430,
62,
38839,
32624,
3256,
5009,
13,
44077,
62,
1925,
270,
430,
62,
38839,
11,
1438,
2625,
44077,
62,
1925,
270,
430,
62,
38839,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
44077,
62,
36,
74,
4265,
62,
38839,
32624,
3256,
5009,
13,
44077,
62,
36,
74,
4265,
62,
38839,
11,
1438,
2625,
44077,
62,
36,
74,
4265,
62,
38839,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
44077,
62,
44,
19210,
32452,
62,
13482,
71,
32176,
32624,
3256,
5009,
13,
44077,
62,
44,
19210,
32452,
62,
13482,
71,
32176,
11,
1438,
2625,
44077,
62,
44,
19210,
32452,
62,
13482,
71,
32176,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
44077,
62,
7004,
46447,
62,
38839,
32624,
3256,
5009,
13,
44077,
62,
7004,
46447,
62,
38839,
11,
1438,
2625,
44077,
62,
7004,
46447,
62,
38839,
12340,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
44077,
62,
51,
12523,
62,
38839,
32624,
3256,
5009,
13,
44077,
62,
51,
12523,
62,
38839,
11,
1438,
2625,
44077,
62,
51,
12523,
62,
38839,
12340,
628,
220,
220,
220,
19016,
7,
81,
6,
61,
7,
30,
47,
27,
6649,
1018,
36937,
59,
86,
12,
48688,
20679,
3,
3256,
5009,
13,
11195,
7700,
11,
1438,
2625,
4868,
12340,
198,
60,
198
] | 2.31328 | 881 |
"""Extensions for the ``maya.OpenMayaFX`` module."""
| [
37811,
11627,
5736,
329,
262,
7559,
11261,
64,
13,
11505,
6747,
64,
17213,
15506,
8265,
526,
15931,
198
] | 2.944444 | 18 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
from django.db import models
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
11748,
334,
27112,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
628
] | 2.769231 | 39 |
from running_modes.configurations import GeneralConfigurationEnvelope
from running_modes.constructors.base_running_mode import BaseRunningMode
from running_modes.constructors.create_model_mode_constructor import CreateModelModeConstructor
from running_modes.constructors.curriculum_learning_mode_constructor import CurriculumLearningModeConstructor
from running_modes.constructors.reinforcement_learning_mode_constructor import ReinforcementLearningModeConstructor
from running_modes.constructors.sampling_mode_constructor import SamplingModeConstructor
from running_modes.constructors.scoring_mode_constructor import ScoringModeConstructor
from running_modes.constructors.transfer_learning_mode_constructor import TransferLearningModeConstructor
from running_modes.constructors.validation_mode_constructor import ValidationModeConstructor
from running_modes.enums.running_mode_enum import RunningModeEnum
| [
6738,
2491,
62,
76,
4147,
13,
11250,
20074,
1330,
3611,
38149,
4834,
1091,
68,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
8692,
62,
20270,
62,
14171,
1330,
7308,
28768,
19076,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
17953,
62,
19849,
62,
14171,
62,
41571,
273,
1330,
13610,
17633,
19076,
42316,
273,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
22019,
1173,
14452,
62,
40684,
62,
14171,
62,
41571,
273,
1330,
4424,
1173,
14452,
41730,
19076,
42316,
273,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
260,
259,
13442,
62,
40684,
62,
14171,
62,
41571,
273,
1330,
22299,
13442,
41730,
19076,
42316,
273,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
37687,
11347,
62,
14171,
62,
41571,
273,
1330,
3409,
11347,
19076,
42316,
273,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
46536,
62,
14171,
62,
41571,
273,
1330,
1446,
3255,
19076,
42316,
273,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
39437,
62,
40684,
62,
14171,
62,
41571,
273,
1330,
20558,
41730,
19076,
42316,
273,
198,
6738,
2491,
62,
76,
4147,
13,
41571,
669,
13,
12102,
341,
62,
14171,
62,
41571,
273,
1330,
3254,
24765,
19076,
42316,
273,
198,
6738,
2491,
62,
76,
4147,
13,
268,
5700,
13,
20270,
62,
14171,
62,
44709,
1330,
18162,
19076,
4834,
388,
198
] | 4.026667 | 225 |
from ansible_collections.nhsd.apigee.plugins.module_utils import constants
def org_from_env(environment) -> str:
"""Get nhsd apigee organization name from environment name."""
for org, envs in constants.APIGEE_ORG_TO_ENV.items():
if environment in envs:
return org
valid_envs = []
for v in constants.APIGEE_ORG_TO_ENV.values():
valid_envs = valid_envs + v
raise ValueError(f"Unknown environment {environment}, valid environments are {valid_envs}")
| [
6738,
9093,
856,
62,
4033,
26448,
13,
77,
11994,
67,
13,
499,
328,
1453,
13,
37390,
13,
21412,
62,
26791,
1330,
38491,
628,
198,
4299,
8745,
62,
6738,
62,
24330,
7,
38986,
8,
4613,
965,
25,
198,
220,
220,
220,
37227,
3855,
299,
11994,
67,
2471,
328,
1453,
4009,
1438,
422,
2858,
1438,
526,
15931,
198,
220,
220,
220,
329,
8745,
11,
551,
14259,
287,
38491,
13,
2969,
3528,
6500,
62,
1581,
38,
62,
10468,
62,
1677,
53,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2858,
287,
551,
14259,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
8745,
198,
220,
220,
220,
4938,
62,
268,
14259,
796,
17635,
198,
220,
220,
220,
329,
410,
287,
38491,
13,
2969,
3528,
6500,
62,
1581,
38,
62,
10468,
62,
1677,
53,
13,
27160,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
4938,
62,
268,
14259,
796,
4938,
62,
268,
14259,
1343,
410,
198,
220,
220,
220,
5298,
11052,
12331,
7,
69,
1,
20035,
2858,
1391,
38986,
5512,
4938,
12493,
389,
1391,
12102,
62,
268,
14259,
92,
4943,
628
] | 2.668449 | 187 |
"""
``astyle`` provides classes for adding style (foreground and background color;
bold; blink; etc.) to terminal and curses output.
"""
import sys, os
try:
import curses
except ImportError:
curses = None
COLOR_BLACK = 0
COLOR_RED = 1
COLOR_GREEN = 2
COLOR_YELLOW = 3
COLOR_BLUE = 4
COLOR_MAGENTA = 5
COLOR_CYAN = 6
COLOR_WHITE = 7
A_BLINK = 1<<0 # Blinking text
A_BOLD = 1<<1 # Extra bright or bold text
A_DIM = 1<<2 # Half bright text
A_REVERSE = 1<<3 # Reverse-video text
A_STANDOUT = 1<<4 # The best highlighting mode available
A_UNDERLINE = 1<<5 # Underlined text
class Style(object):
"""
Store foreground color, background color and attribute (bold, underlined
etc.).
"""
__slots__ = ("fg", "bg", "attrs")
COLORNAMES = {
"black": COLOR_BLACK,
"red": COLOR_RED,
"green": COLOR_GREEN,
"yellow": COLOR_YELLOW,
"blue": COLOR_BLUE,
"magenta": COLOR_MAGENTA,
"cyan": COLOR_CYAN,
"white": COLOR_WHITE,
}
ATTRNAMES = {
"blink": A_BLINK,
"bold": A_BOLD,
"dim": A_DIM,
"reverse": A_REVERSE,
"standout": A_STANDOUT,
"underline": A_UNDERLINE,
}
def __init__(self, fg, bg, attrs=0):
"""
Create a ``Style`` object with ``fg`` as the foreground color,
``bg`` as the background color and ``attrs`` as the attributes.
Examples:
>>> Style(COLOR_RED, COLOR_BLACK)
<Style fg=red bg=black attrs=0>
>>> Style(COLOR_YELLOW, COLOR_BLUE, A_BOLD|A_UNDERLINE)
<Style fg=yellow bg=blue attrs=bold|underline>
"""
self.fg = fg
self.bg = bg
self.attrs = attrs
def fromstr(cls, value):
"""
Create a ``Style`` object from a string. The format looks like this:
``"red:black:bold|blink"``.
"""
# defaults
fg = COLOR_WHITE
bg = COLOR_BLACK
attrs = 0
parts = value.split(":")
if len(parts) > 0:
fg = cls.COLORNAMES[parts[0].lower()]
if len(parts) > 1:
bg = cls.COLORNAMES[parts[1].lower()]
if len(parts) > 2:
for strattr in parts[2].split("|"):
attrs |= cls.ATTRNAMES[strattr.lower()]
return cls(fg, bg, attrs)
fromstr = classmethod(fromstr)
def fromenv(cls, name, default):
"""
Create a ``Style`` from an environment variable named ``name``
(using ``default`` if the environment variable doesn't exist).
"""
return cls.fromstr(os.environ.get(name, default))
fromenv = classmethod(fromenv)
def switchstyle(s1, s2):
"""
Return the ANSI escape sequence needed to switch from style ``s1`` to
style ``s2``.
"""
attrmask = (A_BLINK|A_BOLD|A_UNDERLINE|A_REVERSE)
a1 = s1.attrs & attrmask
a2 = s2.attrs & attrmask
args = []
if s1 != s2:
# do we have to get rid of the bold/underline/blink bit?
# (can only be done by a reset)
# use reset when our target color is the default color
# (this is shorter than 37;40)
if (a1 & ~a2 or s2==style_default):
args.append("0")
s1 = style_default
a1 = 0
# now we know that old and new color have the same boldness,
# or the new color is bold and the old isn't,
# i.e. we only might have to switch bold on, not off
if not (a1 & A_BOLD) and (a2 & A_BOLD):
args.append("1")
# Fix underline
if not (a1 & A_UNDERLINE) and (a2 & A_UNDERLINE):
args.append("4")
# Fix blink
if not (a1 & A_BLINK) and (a2 & A_BLINK):
args.append("5")
# Fix reverse
if not (a1 & A_REVERSE) and (a2 & A_REVERSE):
args.append("7")
# Fix foreground color
if s1.fg != s2.fg:
args.append("3%d" % s2.fg)
# Finally fix the background color
if s1.bg != s2.bg:
args.append("4%d" % s2.bg)
if args:
return "\033[%sm" % ";".join(args)
return ""
class Text(list):
"""
A colored string. A ``Text`` object is a sequence, the sequence
items will be ``(style, string)`` tuples.
"""
def format(self, styled=True):
"""
This generator yields the strings that will make up the final
colorized string.
"""
if styled:
oldstyle = style_default
for (style, string) in self:
if not isinstance(style, (int, long)):
switch = switchstyle(oldstyle, style)
if switch:
yield switch
if string:
yield string
oldstyle = style
switch = switchstyle(oldstyle, style_default)
if switch:
yield switch
else:
for (style, string) in self:
if not isinstance(style, (int, long)):
yield string
def string(self, styled=True):
"""
Return the resulting string (with escape sequences, if ``styled``
is true).
"""
return "".join(self.format(styled))
def __str__(self):
"""
Return ``self`` as a string (without ANSI escape sequences).
"""
return self.string(False)
def write(self, stream, styled=True):
"""
Write ``self`` to the output stream ``stream`` (with escape sequences,
if ``styled`` is true).
"""
for part in self.format(styled):
stream.write(part)
try:
import ipipe
except ImportError:
pass
else:
ipipe.xrepr.when_type(Text)(xrepr_astyle_text)
def streamstyle(stream, styled=None):
"""
If ``styled`` is ``None``, return whether ``stream`` refers to a terminal.
If this can't be determined (either because ``stream`` doesn't refer to a
real OS file, or because you're on Windows) return ``False``. If ``styled``
is not ``None`` ``styled`` will be returned unchanged.
"""
if styled is None:
try:
styled = os.isatty(stream.fileno())
except (KeyboardInterrupt, SystemExit):
raise
except Exception:
styled = False
return styled
def write(stream, styled, *texts):
"""
Write ``texts`` to ``stream``.
"""
text = Text(*texts)
text.write(stream, streamstyle(stream, styled))
def writeln(stream, styled, *texts):
"""
Write ``texts`` to ``stream`` and finish with a line feed.
"""
write(stream, styled, *texts)
stream.write("\n")
class Stream(object):
"""
Stream wrapper that adds color output.
"""
class stdout(object):
"""
Stream wrapper for ``sys.stdout`` that adds color output.
"""
stdout = stdout()
class stderr(object):
"""
Stream wrapper for ``sys.stderr`` that adds color output.
"""
stderr = stderr()
if curses is not None:
# This is probably just range(8)
COLOR2CURSES = [
COLOR_BLACK,
COLOR_RED,
COLOR_GREEN,
COLOR_YELLOW,
COLOR_BLUE,
COLOR_MAGENTA,
COLOR_CYAN,
COLOR_WHITE,
]
A2CURSES = {
A_BLINK: curses.A_BLINK,
A_BOLD: curses.A_BOLD,
A_DIM: curses.A_DIM,
A_REVERSE: curses.A_REVERSE,
A_STANDOUT: curses.A_STANDOUT,
A_UNDERLINE: curses.A_UNDERLINE,
}
# default style
style_default = Style.fromstr("white:black")
# Styles for datatypes
style_type_none = Style.fromstr("magenta:black")
style_type_bool = Style.fromstr("magenta:black")
style_type_number = Style.fromstr("yellow:black")
style_type_datetime = Style.fromstr("magenta:black")
style_type_type = Style.fromstr("cyan:black")
# Style for URLs and file/directory names
style_url = Style.fromstr("green:black")
style_dir = Style.fromstr("cyan:black")
style_file = Style.fromstr("green:black")
# Style for ellipsis (when an output has been shortened
style_ellisis = Style.fromstr("red:black")
# Style for displaying exceptions
style_error = Style.fromstr("red:black")
# Style for displaying non-existing attributes
style_nodata = Style.fromstr("red:black")
| [
37811,
198,
15506,
459,
2349,
15506,
3769,
6097,
329,
4375,
3918,
357,
754,
2833,
290,
4469,
3124,
26,
198,
36575,
26,
21019,
26,
3503,
2014,
284,
12094,
290,
43878,
5072,
13,
198,
37811,
628,
198,
11748,
25064,
11,
28686,
198,
198,
28311,
25,
198,
220,
220,
220,
1330,
43878,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
43878,
796,
6045,
628,
198,
46786,
62,
9148,
8120,
220,
220,
796,
657,
198,
46786,
62,
22083,
220,
220,
220,
220,
796,
352,
198,
46786,
62,
43016,
220,
220,
796,
362,
198,
46786,
62,
56,
23304,
3913,
220,
796,
513,
198,
46786,
62,
9148,
8924,
220,
220,
220,
796,
604,
198,
46786,
62,
45820,
3525,
32,
796,
642,
198,
46786,
62,
34,
56,
1565,
220,
220,
220,
796,
718,
198,
46786,
62,
12418,
12709,
220,
220,
796,
767,
198,
198,
32,
62,
9148,
17248,
220,
220,
220,
220,
796,
352,
16791,
15,
1303,
1086,
8040,
2420,
198,
32,
62,
33,
15173,
220,
220,
220,
220,
220,
796,
352,
16791,
16,
1303,
17221,
6016,
393,
10758,
2420,
198,
32,
62,
35,
3955,
220,
220,
220,
220,
220,
220,
796,
352,
16791,
17,
1303,
13139,
6016,
2420,
198,
32,
62,
2200,
28884,
36,
220,
220,
796,
352,
16791,
18,
1303,
31849,
12,
15588,
2420,
198,
32,
62,
2257,
6981,
12425,
220,
796,
352,
16791,
19,
1303,
383,
1266,
21292,
4235,
1695,
198,
32,
62,
4944,
14418,
24027,
796,
352,
16791,
20,
1303,
4698,
10837,
2420,
628,
198,
4871,
17738,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
9363,
36282,
3124,
11,
4469,
3124,
290,
11688,
357,
36575,
11,
739,
10837,
198,
220,
220,
220,
3503,
15729,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
11593,
6649,
1747,
834,
796,
5855,
40616,
1600,
366,
35904,
1600,
366,
1078,
3808,
4943,
628,
220,
220,
220,
20444,
30649,
29559,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
13424,
1298,
20444,
1581,
62,
9148,
8120,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
445,
1298,
20444,
1581,
62,
22083,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14809,
1298,
20444,
1581,
62,
43016,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
36022,
1298,
20444,
1581,
62,
56,
23304,
3913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
17585,
1298,
20444,
1581,
62,
9148,
8924,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
19726,
29188,
1298,
20444,
1581,
62,
45820,
3525,
32,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
948,
272,
1298,
20444,
1581,
62,
34,
56,
1565,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
11186,
1298,
20444,
1581,
62,
12418,
12709,
11,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
5161,
5446,
45,
29559,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
2436,
676,
1298,
317,
62,
9148,
17248,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
36575,
1298,
317,
62,
33,
15173,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
27740,
1298,
317,
62,
35,
3955,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
50188,
1298,
317,
62,
2200,
28884,
36,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1481,
448,
1298,
317,
62,
2257,
6981,
12425,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
4625,
1370,
1298,
317,
62,
4944,
14418,
24027,
11,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
277,
70,
11,
275,
70,
11,
708,
3808,
28,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13610,
257,
7559,
21466,
15506,
2134,
351,
7559,
40616,
15506,
355,
262,
36282,
3124,
11,
198,
220,
220,
220,
220,
220,
220,
220,
7559,
35904,
15506,
355,
262,
4469,
3124,
290,
7559,
1078,
3808,
15506,
355,
262,
12608,
13,
628,
220,
220,
220,
220,
220,
220,
220,
21066,
25,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
17738,
7,
46786,
62,
22083,
11,
20444,
1581,
62,
9148,
8120,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1279,
21466,
277,
70,
28,
445,
275,
70,
28,
13424,
708,
3808,
28,
15,
29,
628,
220,
220,
220,
220,
220,
220,
220,
13163,
17738,
7,
46786,
62,
56,
23304,
3913,
11,
20444,
1581,
62,
9148,
8924,
11,
317,
62,
33,
15173,
91,
32,
62,
4944,
14418,
24027,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1279,
21466,
277,
70,
28,
36022,
275,
70,
28,
17585,
708,
3808,
28,
36575,
91,
4625,
1370,
29,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
40616,
796,
277,
70,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
35904,
796,
275,
70,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1078,
3808,
796,
708,
3808,
628,
220,
220,
220,
825,
422,
2536,
7,
565,
82,
11,
1988,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13610,
257,
7559,
21466,
15506,
2134,
422,
257,
4731,
13,
383,
5794,
3073,
588,
428,
25,
198,
220,
220,
220,
220,
220,
220,
220,
7559,
1,
445,
25,
13424,
25,
36575,
91,
2436,
676,
1,
15506,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
26235,
198,
220,
220,
220,
220,
220,
220,
220,
277,
70,
796,
20444,
1581,
62,
12418,
12709,
198,
220,
220,
220,
220,
220,
220,
220,
275,
70,
796,
20444,
1581,
62,
9148,
8120,
198,
220,
220,
220,
220,
220,
220,
220,
708,
3808,
796,
657,
628,
220,
220,
220,
220,
220,
220,
220,
3354,
796,
1988,
13,
35312,
7,
2404,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
42632,
8,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
70,
796,
537,
82,
13,
25154,
30649,
29559,
58,
42632,
58,
15,
4083,
21037,
3419,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
42632,
8,
1875,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
70,
796,
537,
82,
13,
25154,
30649,
29559,
58,
42632,
58,
16,
4083,
21037,
3419,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
42632,
8,
1875,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
965,
35226,
287,
3354,
58,
17,
4083,
35312,
7203,
91,
1,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
708,
3808,
930,
28,
537,
82,
13,
1404,
5446,
45,
29559,
58,
2536,
35226,
13,
21037,
3419,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
537,
82,
7,
40616,
11,
275,
70,
11,
708,
3808,
8,
198,
220,
220,
220,
422,
2536,
796,
1398,
24396,
7,
6738,
2536,
8,
628,
220,
220,
220,
825,
422,
24330,
7,
565,
82,
11,
1438,
11,
4277,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13610,
257,
7559,
21466,
15506,
422,
281,
2858,
7885,
3706,
7559,
3672,
15506,
198,
220,
220,
220,
220,
220,
220,
220,
357,
3500,
7559,
12286,
15506,
611,
262,
2858,
7885,
1595,
470,
2152,
737,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
537,
82,
13,
6738,
2536,
7,
418,
13,
268,
2268,
13,
1136,
7,
3672,
11,
4277,
4008,
198,
220,
220,
220,
422,
24330,
796,
1398,
24396,
7,
6738,
24330,
8,
628,
198,
4299,
5078,
7635,
7,
82,
16,
11,
264,
17,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8229,
262,
3537,
11584,
6654,
8379,
2622,
284,
5078,
422,
3918,
7559,
82,
16,
15506,
284,
198,
220,
220,
220,
3918,
7559,
82,
17,
15506,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
708,
26224,
2093,
796,
357,
32,
62,
9148,
17248,
91,
32,
62,
33,
15173,
91,
32,
62,
4944,
14418,
24027,
91,
32,
62,
2200,
28884,
36,
8,
198,
220,
220,
220,
257,
16,
796,
264,
16,
13,
1078,
3808,
1222,
708,
26224,
2093,
198,
220,
220,
220,
257,
17,
796,
264,
17,
13,
1078,
3808,
1222,
708,
26224,
2093,
628,
220,
220,
220,
26498,
796,
17635,
198,
220,
220,
220,
611,
264,
16,
14512,
264,
17,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
466,
356,
423,
284,
651,
5755,
286,
262,
10758,
14,
4625,
1370,
14,
2436,
676,
1643,
30,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
357,
5171,
691,
307,
1760,
416,
257,
13259,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
13259,
618,
674,
2496,
3124,
318,
262,
4277,
3124,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
357,
5661,
318,
12238,
621,
5214,
26,
1821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
357,
64,
16,
1222,
5299,
64,
17,
393,
264,
17,
855,
7635,
62,
12286,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
33295,
7203,
15,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
16,
796,
3918,
62,
12286,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
16,
796,
657,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
783,
356,
760,
326,
1468,
290,
649,
3124,
423,
262,
976,
10758,
1108,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
393,
262,
649,
3124,
318,
10758,
290,
262,
1468,
2125,
470,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1312,
13,
68,
13,
356,
691,
1244,
423,
284,
5078,
10758,
319,
11,
407,
572,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
357,
64,
16,
1222,
317,
62,
33,
15173,
8,
290,
357,
64,
17,
1222,
317,
62,
33,
15173,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
33295,
7203,
16,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
13268,
739,
1370,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
357,
64,
16,
1222,
317,
62,
4944,
14418,
24027,
8,
290,
357,
64,
17,
1222,
317,
62,
4944,
14418,
24027,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
33295,
7203,
19,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
13268,
21019,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
357,
64,
16,
1222,
317,
62,
9148,
17248,
8,
290,
357,
64,
17,
1222,
317,
62,
9148,
17248,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
33295,
7203,
20,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
13268,
9575,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
357,
64,
16,
1222,
317,
62,
2200,
28884,
36,
8,
290,
357,
64,
17,
1222,
317,
62,
2200,
28884,
36,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
33295,
7203,
22,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
13268,
36282,
3124,
198,
220,
220,
220,
220,
220,
220,
220,
611,
264,
16,
13,
40616,
14512,
264,
17,
13,
40616,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
33295,
7203,
18,
4,
67,
1,
4064,
264,
17,
13,
40616,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
9461,
4259,
262,
4469,
3124,
198,
220,
220,
220,
220,
220,
220,
220,
611,
264,
16,
13,
35904,
14512,
264,
17,
13,
35904,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
33295,
7203,
19,
4,
67,
1,
4064,
264,
17,
13,
35904,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
26498,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
37082,
44427,
58,
4,
5796,
1,
4064,
366,
26,
1911,
22179,
7,
22046,
8,
198,
220,
220,
220,
1441,
13538,
628,
198,
4871,
8255,
7,
4868,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
317,
16396,
4731,
13,
317,
7559,
8206,
15506,
2134,
318,
257,
8379,
11,
262,
8379,
198,
220,
220,
220,
3709,
481,
307,
11592,
7635,
11,
4731,
8,
15506,
12777,
2374,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
5794,
7,
944,
11,
45552,
28,
17821,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
770,
17301,
19299,
262,
13042,
326,
481,
787,
510,
262,
2457,
198,
220,
220,
220,
220,
220,
220,
220,
3124,
1143,
4731,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
45552,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1468,
7635,
796,
3918,
62,
12286,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
357,
7635,
11,
4731,
8,
287,
2116,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
7635,
11,
357,
600,
11,
890,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5078,
796,
5078,
7635,
7,
727,
7635,
11,
3918,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
5078,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7800,
5078,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4731,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7800,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1468,
7635,
796,
3918,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5078,
796,
5078,
7635,
7,
727,
7635,
11,
3918,
62,
12286,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
5078,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7800,
5078,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
357,
7635,
11,
4731,
8,
287,
2116,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
7635,
11,
357,
600,
11,
890,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7800,
4731,
628,
220,
220,
220,
825,
4731,
7,
944,
11,
45552,
28,
17821,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8229,
262,
7186,
4731,
357,
4480,
6654,
16311,
11,
611,
7559,
34365,
992,
15506,
198,
220,
220,
220,
220,
220,
220,
220,
318,
2081,
737,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
366,
1911,
22179,
7,
944,
13,
18982,
7,
34365,
992,
4008,
628,
220,
220,
220,
825,
11593,
2536,
834,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8229,
7559,
944,
15506,
355,
257,
4731,
357,
19419,
3537,
11584,
6654,
16311,
737,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
8841,
7,
25101,
8,
628,
220,
220,
220,
825,
3551,
7,
944,
11,
4269,
11,
45552,
28,
17821,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
19430,
7559,
944,
15506,
284,
262,
5072,
4269,
7559,
5532,
15506,
357,
4480,
6654,
16311,
11,
198,
220,
220,
220,
220,
220,
220,
220,
611,
7559,
34365,
992,
15506,
318,
2081,
737,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
329,
636,
287,
2116,
13,
18982,
7,
34365,
992,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4269,
13,
13564,
7,
3911,
8,
628,
198,
28311,
25,
198,
220,
220,
220,
1330,
20966,
3757,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
1208,
198,
17772,
25,
198,
220,
220,
220,
20966,
3757,
13,
87,
260,
1050,
13,
12518,
62,
4906,
7,
8206,
5769,
87,
260,
1050,
62,
459,
2349,
62,
5239,
8,
628,
198,
4299,
4269,
7635,
7,
5532,
11,
45552,
28,
14202,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1002,
7559,
34365,
992,
15506,
318,
7559,
14202,
15506,
11,
1441,
1771,
7559,
5532,
15506,
10229,
284,
257,
12094,
13,
198,
220,
220,
220,
1002,
428,
460,
470,
307,
5295,
357,
31336,
780,
7559,
5532,
15506,
1595,
470,
3522,
284,
257,
198,
220,
220,
220,
1103,
7294,
2393,
11,
393,
780,
345,
821,
319,
3964,
8,
1441,
7559,
25101,
15506,
13,
1002,
7559,
34365,
992,
15506,
198,
220,
220,
220,
318,
407,
7559,
14202,
15506,
7559,
34365,
992,
15506,
481,
307,
4504,
21588,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
45552,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45552,
796,
28686,
13,
271,
265,
774,
7,
5532,
13,
10379,
23397,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
357,
9218,
3526,
9492,
3622,
11,
4482,
30337,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45552,
796,
10352,
198,
220,
220,
220,
1441,
45552,
628,
198,
4299,
3551,
7,
5532,
11,
45552,
11,
1635,
5239,
82,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
19430,
7559,
5239,
82,
15506,
284,
7559,
5532,
15506,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2420,
796,
8255,
46491,
5239,
82,
8,
198,
220,
220,
220,
2420,
13,
13564,
7,
5532,
11,
4269,
7635,
7,
5532,
11,
45552,
4008,
628,
198,
4299,
1991,
45542,
7,
5532,
11,
45552,
11,
1635,
5239,
82,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
19430,
7559,
5239,
82,
15506,
284,
7559,
5532,
15506,
290,
5461,
351,
257,
1627,
3745,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3551,
7,
5532,
11,
45552,
11,
1635,
5239,
82,
8,
198,
220,
220,
220,
4269,
13,
13564,
7203,
59,
77,
4943,
628,
198,
4871,
13860,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13860,
29908,
326,
6673,
3124,
5072,
13,
198,
220,
220,
220,
37227,
628,
198,
4871,
14367,
448,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13860,
29908,
329,
7559,
17597,
13,
19282,
448,
15506,
326,
6673,
3124,
5072,
13,
198,
220,
220,
220,
37227,
198,
19282,
448,
796,
14367,
448,
3419,
628,
198,
4871,
336,
1082,
81,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13860,
29908,
329,
7559,
17597,
13,
301,
1082,
81,
15506,
326,
6673,
3124,
5072,
13,
198,
220,
220,
220,
37227,
198,
301,
1082,
81,
796,
336,
1082,
81,
3419,
628,
198,
361,
43878,
318,
407,
6045,
25,
198,
220,
220,
220,
1303,
770,
318,
2192,
655,
2837,
7,
23,
8,
198,
220,
220,
220,
20444,
1581,
17,
34,
4261,
50,
1546,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
9148,
8120,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
22083,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
43016,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
56,
23304,
3913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
9148,
8924,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
45820,
3525,
32,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
34,
56,
1565,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20444,
1581,
62,
12418,
12709,
11,
198,
220,
220,
220,
2361,
628,
220,
220,
220,
317,
17,
34,
4261,
50,
1546,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
317,
62,
9148,
17248,
25,
43878,
13,
32,
62,
9148,
17248,
11,
198,
220,
220,
220,
220,
220,
220,
220,
317,
62,
33,
15173,
25,
43878,
13,
32,
62,
33,
15173,
11,
198,
220,
220,
220,
220,
220,
220,
220,
317,
62,
35,
3955,
25,
43878,
13,
32,
62,
35,
3955,
11,
198,
220,
220,
220,
220,
220,
220,
220,
317,
62,
2200,
28884,
36,
25,
43878,
13,
32,
62,
2200,
28884,
36,
11,
198,
220,
220,
220,
220,
220,
220,
220,
317,
62,
2257,
6981,
12425,
25,
43878,
13,
32,
62,
2257,
6981,
12425,
11,
198,
220,
220,
220,
220,
220,
220,
220,
317,
62,
4944,
14418,
24027,
25,
43878,
13,
32,
62,
4944,
14418,
24027,
11,
198,
220,
220,
220,
1782,
628,
198,
2,
4277,
3918,
198,
7635,
62,
12286,
796,
17738,
13,
6738,
2536,
7203,
11186,
25,
13424,
4943,
198,
198,
2,
44963,
329,
4818,
265,
9497,
198,
7635,
62,
4906,
62,
23108,
796,
17738,
13,
6738,
2536,
7203,
19726,
29188,
25,
13424,
4943,
198,
7635,
62,
4906,
62,
30388,
796,
17738,
13,
6738,
2536,
7203,
19726,
29188,
25,
13424,
4943,
198,
7635,
62,
4906,
62,
17618,
796,
17738,
13,
6738,
2536,
7203,
36022,
25,
13424,
4943,
198,
7635,
62,
4906,
62,
19608,
8079,
796,
17738,
13,
6738,
2536,
7203,
19726,
29188,
25,
13424,
4943,
198,
7635,
62,
4906,
62,
4906,
796,
17738,
13,
6738,
2536,
7203,
948,
272,
25,
13424,
4943,
198,
198,
2,
17738,
329,
32336,
290,
2393,
14,
34945,
3891,
198,
7635,
62,
6371,
796,
17738,
13,
6738,
2536,
7203,
14809,
25,
13424,
4943,
198,
7635,
62,
15908,
796,
17738,
13,
6738,
2536,
7203,
948,
272,
25,
13424,
4943,
198,
7635,
62,
7753,
796,
17738,
13,
6738,
2536,
7203,
14809,
25,
13424,
4943,
198,
198,
2,
17738,
329,
30004,
2419,
271,
357,
12518,
281,
5072,
468,
587,
34464,
198,
7635,
62,
695,
271,
271,
796,
17738,
13,
6738,
2536,
7203,
445,
25,
13424,
4943,
198,
198,
2,
17738,
329,
19407,
13269,
198,
7635,
62,
18224,
796,
17738,
13,
6738,
2536,
7203,
445,
25,
13424,
4943,
198,
198,
2,
17738,
329,
19407,
1729,
12,
25687,
12608,
198,
7635,
62,
77,
375,
1045,
796,
17738,
13,
6738,
2536,
7203,
445,
25,
13424,
4943,
198
] | 2.162338 | 3,850 |
import pickle
import robot_sim.robots.ur3_dual.ur3_dual as ur3d
import rbt_con.force_control as ur3dx
# import robot_con.ur.ur3_dual_x as ur3dx
import visualization.panda.world as wd
import modeling.geometric_model as gm
import motion.optimization_based.incremental_nik as inik
import numpy as np
import modeling.collision_model as cm
import cv2
import img_to_depth as itd
import time
import motion.probabilistic.rrt_connect as rrtc
ur_dual_x = ur3dx.UR3DualX(lft_robot_ip='10.2.0.50', rgt_robot_ip='10.2.0.51', pc_ip='10.2.0.100')
base = wd.World(cam_pos=[2,1,3], lookat_pos=[0,0,1.1])
gm.gen_frame().attach_to(base)
robot_s = ur3d.UR3Dual()
jnt = ur_dual_x.get_jnt_values("lft_arm")
robot_s.fk(component_name="lft_arm",jnt_values= np.array(jnt))
robot_meshmodel = robot_s.gen_meshmodel(toggle_tcpcs=True)
robot_meshmodel.attach_to(base)
base.run() | [
11748,
2298,
293,
198,
11748,
9379,
62,
14323,
13,
22609,
1747,
13,
333,
18,
62,
646,
282,
13,
333,
18,
62,
646,
282,
355,
2956,
18,
67,
198,
11748,
374,
18347,
62,
1102,
13,
3174,
62,
13716,
355,
2956,
18,
34350,
198,
2,
1330,
9379,
62,
1102,
13,
333,
13,
333,
18,
62,
646,
282,
62,
87,
355,
2956,
18,
34350,
198,
11748,
32704,
13,
79,
5282,
13,
6894,
355,
266,
67,
198,
11748,
21128,
13,
469,
16996,
62,
19849,
355,
308,
76,
198,
11748,
6268,
13,
40085,
1634,
62,
3106,
13,
24988,
37098,
62,
17187,
355,
287,
1134,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
21128,
13,
26000,
1166,
62,
19849,
355,
12067,
198,
11748,
269,
85,
17,
198,
11748,
33705,
62,
1462,
62,
18053,
355,
340,
67,
198,
11748,
640,
198,
11748,
6268,
13,
1676,
65,
14991,
2569,
13,
81,
17034,
62,
8443,
355,
374,
17034,
66,
198,
198,
333,
62,
646,
282,
62,
87,
796,
2956,
18,
34350,
13,
4261,
18,
36248,
55,
7,
75,
701,
62,
305,
13645,
62,
541,
11639,
940,
13,
17,
13,
15,
13,
1120,
3256,
374,
13655,
62,
305,
13645,
62,
541,
11639,
940,
13,
17,
13,
15,
13,
4349,
3256,
40653,
62,
541,
11639,
940,
13,
17,
13,
15,
13,
3064,
11537,
198,
198,
8692,
796,
266,
67,
13,
10603,
7,
20991,
62,
1930,
41888,
17,
11,
16,
11,
18,
4357,
804,
265,
62,
1930,
41888,
15,
11,
15,
11,
16,
13,
16,
12962,
198,
39870,
13,
5235,
62,
14535,
22446,
47348,
62,
1462,
7,
8692,
8,
198,
305,
13645,
62,
82,
796,
2956,
18,
67,
13,
4261,
18,
36248,
3419,
198,
198,
73,
429,
796,
2956,
62,
646,
282,
62,
87,
13,
1136,
62,
73,
429,
62,
27160,
7203,
75,
701,
62,
1670,
4943,
198,
305,
13645,
62,
82,
13,
69,
74,
7,
42895,
62,
3672,
2625,
75,
701,
62,
1670,
1600,
73,
429,
62,
27160,
28,
45941,
13,
18747,
7,
73,
429,
4008,
198,
198,
305,
13645,
62,
76,
5069,
19849,
796,
9379,
62,
82,
13,
5235,
62,
76,
5069,
19849,
7,
44256,
62,
83,
13155,
6359,
28,
17821,
8,
198,
305,
13645,
62,
76,
5069,
19849,
13,
47348,
62,
1462,
7,
8692,
8,
198,
8692,
13,
5143,
3419
] | 2.299191 | 371 |
"""
This module use SpiralArm superclass, with some modifications,
to create 3-kpc arm.
"""
from shapely.geometry.polygon import Polygon
from descartes import PolygonPatch
from .spiral_parameters import Three_Kpc
from . import spiral_property as spiral_eq
from .spiral_arm_superclass import SpiralArm
| [
37811,
198,
1212,
8265,
779,
46727,
26560,
2208,
4871,
11,
351,
617,
19008,
11,
198,
284,
2251,
513,
12,
74,
14751,
3211,
13,
198,
37811,
198,
198,
6738,
5485,
306,
13,
469,
15748,
13,
35428,
14520,
1330,
12280,
14520,
198,
6738,
1715,
433,
274,
1330,
12280,
14520,
33952,
198,
198,
6738,
764,
2777,
21093,
62,
17143,
7307,
1330,
7683,
62,
42,
14751,
198,
6738,
764,
1330,
23642,
62,
26745,
355,
23642,
62,
27363,
198,
6738,
764,
2777,
21093,
62,
1670,
62,
16668,
4871,
1330,
46727,
26560,
628
] | 3.505747 | 87 |
'Code for scrapping RBI Data'
from datetime import date
from lxml import etree
import logging
from logging.config import fileConfig
from scrappers.scrapping_utils import ScrappingUtils
fileConfig('scrappers/logging_config.ini')
logger = logging.getLogger()
OUT_FOLDER = "rbi"
if __name__ == '__main__':
obj = RBIBudgetScraper()
for year in range(2002,2015):
year = str(year)
url1 = "https://www.rbi.org.in/scripts/AnnualPublications.aspx?head=Handbook%20of%20Statistics%20on%20Indian%20Economy"
url2 = "https://rbi.org.in/Scripts/AnnualPublications.aspx?head=State+Finances+%3a+A+Study+of+Budgets"
obj.fetch_docs_for_year(url1, year)
obj.fetch_docs_for_year(url2, year)
| [
6,
10669,
329,
19320,
2105,
20948,
6060,
6,
198,
198,
6738,
4818,
8079,
1330,
3128,
198,
6738,
300,
19875,
1330,
2123,
631,
198,
11748,
18931,
198,
6738,
18931,
13,
11250,
1330,
2393,
16934,
198,
6738,
19320,
11799,
13,
1416,
430,
2105,
62,
26791,
1330,
1446,
430,
2105,
18274,
4487,
198,
198,
7753,
16934,
10786,
1416,
430,
11799,
14,
6404,
2667,
62,
11250,
13,
5362,
11537,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
3419,
198,
12425,
62,
37,
3535,
14418,
796,
366,
81,
8482,
1,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
26181,
796,
20948,
33,
29427,
3351,
38545,
3419,
198,
220,
220,
220,
329,
614,
287,
2837,
7,
16942,
11,
4626,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
614,
796,
965,
7,
1941,
8,
198,
220,
220,
220,
220,
220,
220,
220,
19016,
16,
796,
366,
5450,
1378,
2503,
13,
81,
8482,
13,
2398,
13,
259,
14,
46521,
14,
18858,
723,
15202,
602,
13,
31740,
30,
2256,
28,
12885,
2070,
4,
1238,
1659,
4,
1238,
48346,
4,
1238,
261,
4,
1238,
30821,
4,
1238,
28489,
88,
1,
198,
220,
220,
220,
220,
220,
220,
220,
19016,
17,
796,
366,
5450,
1378,
81,
8482,
13,
2398,
13,
259,
14,
7391,
82,
14,
18858,
723,
15202,
602,
13,
31740,
30,
2256,
28,
9012,
10,
18467,
1817,
10,
4,
18,
64,
10,
32,
10,
39841,
10,
1659,
10,
33,
463,
11407,
1,
198,
220,
220,
220,
220,
220,
220,
220,
26181,
13,
69,
7569,
62,
31628,
62,
1640,
62,
1941,
7,
6371,
16,
11,
614,
8,
198,
220,
220,
220,
220,
220,
220,
220,
26181,
13,
69,
7569,
62,
31628,
62,
1640,
62,
1941,
7,
6371,
17,
11,
614,
8,
198
] | 2.477663 | 291 |
#!/usr/bin/python3
""" post email """
import urllib.request
import urllib.parse
import sys
if __name__ == "__main__":
value = {'email': sys.argv[2]}
data = urllib.parse.urlencode(value)
data = data.encode('utf-8')
req = urllib.request.Request(sys.argv[1], data)
with urllib.request.urlopen(req) as response:
res = response.read().decode(encoding='UTF-8')
print(res)
| [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
37811,
1281,
3053,
37227,
198,
11748,
2956,
297,
571,
13,
25927,
198,
11748,
2956,
297,
571,
13,
29572,
198,
11748,
25064,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1988,
796,
1391,
6,
12888,
10354,
25064,
13,
853,
85,
58,
17,
48999,
198,
220,
220,
220,
1366,
796,
2956,
297,
571,
13,
29572,
13,
6371,
268,
8189,
7,
8367,
8,
198,
220,
220,
220,
1366,
796,
1366,
13,
268,
8189,
10786,
40477,
12,
23,
11537,
198,
220,
220,
220,
43089,
796,
2956,
297,
571,
13,
25927,
13,
18453,
7,
17597,
13,
853,
85,
58,
16,
4357,
1366,
8,
198,
220,
220,
220,
351,
2956,
297,
571,
13,
25927,
13,
6371,
9654,
7,
42180,
8,
355,
2882,
25,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2882,
13,
961,
22446,
12501,
1098,
7,
12685,
7656,
11639,
48504,
12,
23,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
411,
8,
198
] | 2.362573 | 171 |
# selection.py
# since: 10/2018
# Developed by: Shehu Lab
"""Module for selecting next generation from current generation.
This module provides methods to select next generation from
current generation.
Available Functions:
- truncation: Selects next generation via elitism truncation selection.
"""
def truncation(parent_population, child_population, parents_scores,
children_scores, elitism_rate):
"""Selects next generation using elitism truncation selection.
This function implements truncation selection while ensuring elitism
to select a specific number of members for the next generation.
Args:
parent_population: A list containing members of parent
population.
child_population: A list containing members of offspring
population.
parents_scores: A list containing scores of each member of the
parent population. The format is:
[member 1 score, member 2 score, ....]
The order of members has to be consistent with
parent_population argument.
children_scores: A list containing scores of each member of the
offspring population. The format is:
[member 1 score, member 2 score, ....]
The order of members has to be consistent with
child_population argument.
elitism_rate: A float indicating the elitism percentage.
Returns:
A list of members for the next generation of population.
"""
population_size = len(parent_population)
population_indices = list(range(population_size))
sorted_parents_indices = [x for _, x in sorted(zip(
parents_scores, population_indices
))]
sorted_parents_scores = sorted(parents_scores)
# Slice parent population using elitism rate
slice_index = int(population_size * elitism_rate)
selected_parents_indices = sorted_parents_indices[:slice_index]
selected_parents = [parent_population[i] for i in selected_parents_indices]
combined_population = selected_parents + child_population
combined_scores = sorted_parents_scores[:slice_index] + children_scores
combined_population_indices = list(range(len(combined_population)))
sorted_population_indices = [x for _, x in sorted(zip(
combined_scores, combined_population_indices
))]
selected_population_indices = sorted_population_indices[:population_size]
# Truncate and return
return [combined_population[i] for i in selected_population_indices]
| [
2,
6356,
13,
9078,
198,
2,
1201,
25,
838,
14,
7908,
198,
2,
6013,
276,
416,
25,
1375,
13415,
3498,
198,
198,
37811,
26796,
329,
17246,
1306,
5270,
422,
1459,
5270,
13,
198,
198,
1212,
8265,
3769,
5050,
284,
2922,
1306,
5270,
422,
198,
14421,
5270,
13,
198,
198,
10493,
40480,
25,
198,
12,
40122,
341,
25,
9683,
82,
1306,
5270,
2884,
1288,
18937,
40122,
341,
6356,
13,
198,
37811,
628,
198,
4299,
40122,
341,
7,
8000,
62,
39748,
11,
1200,
62,
39748,
11,
3397,
62,
1416,
2850,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1751,
62,
1416,
2850,
11,
1288,
18937,
62,
4873,
2599,
198,
220,
220,
220,
37227,
17563,
82,
1306,
5270,
1262,
1288,
18937,
40122,
341,
6356,
13,
628,
220,
220,
220,
770,
2163,
23986,
40122,
341,
6356,
981,
13359,
1288,
18937,
198,
220,
220,
220,
284,
2922,
257,
2176,
1271,
286,
1866,
329,
262,
1306,
5270,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2560,
62,
39748,
25,
317,
1351,
7268,
1866,
286,
2560,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3265,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1200,
62,
39748,
25,
317,
1351,
7268,
1866,
286,
20791,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3265,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3397,
62,
1416,
2850,
25,
317,
1351,
7268,
8198,
286,
1123,
2888,
286,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2560,
3265,
13,
383,
5794,
318,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
19522,
352,
4776,
11,
2888,
362,
4776,
11,
19424,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
1502,
286,
1866,
468,
284,
307,
6414,
351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2560,
62,
39748,
4578,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1751,
62,
1416,
2850,
25,
317,
1351,
7268,
8198,
286,
1123,
2888,
286,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20791,
3265,
13,
383,
5794,
318,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
19522,
352,
4776,
11,
2888,
362,
4776,
11,
19424,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
1502,
286,
1866,
468,
284,
307,
6414,
351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1200,
62,
39748,
4578,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
18937,
62,
4873,
25,
317,
12178,
12739,
262,
1288,
18937,
5873,
13,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
317,
1351,
286,
1866,
329,
262,
1306,
5270,
286,
3265,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3265,
62,
7857,
796,
18896,
7,
8000,
62,
39748,
8,
198,
220,
220,
220,
3265,
62,
521,
1063,
796,
1351,
7,
9521,
7,
39748,
62,
7857,
4008,
628,
220,
220,
220,
23243,
62,
23743,
62,
521,
1063,
796,
685,
87,
329,
4808,
11,
2124,
287,
23243,
7,
13344,
7,
198,
220,
220,
220,
220,
220,
220,
220,
3397,
62,
1416,
2850,
11,
3265,
62,
521,
1063,
198,
220,
220,
220,
15306,
60,
198,
220,
220,
220,
23243,
62,
23743,
62,
1416,
2850,
796,
23243,
7,
23743,
62,
1416,
2850,
8,
628,
220,
220,
220,
1303,
3454,
501,
2560,
3265,
1262,
1288,
18937,
2494,
198,
220,
220,
220,
16416,
62,
9630,
796,
493,
7,
39748,
62,
7857,
1635,
1288,
18937,
62,
4873,
8,
198,
220,
220,
220,
6163,
62,
23743,
62,
521,
1063,
796,
23243,
62,
23743,
62,
521,
1063,
58,
25,
48369,
62,
9630,
60,
198,
220,
220,
220,
6163,
62,
23743,
796,
685,
8000,
62,
39748,
58,
72,
60,
329,
1312,
287,
6163,
62,
23743,
62,
521,
1063,
60,
628,
220,
220,
220,
5929,
62,
39748,
796,
6163,
62,
23743,
1343,
1200,
62,
39748,
198,
220,
220,
220,
5929,
62,
1416,
2850,
796,
23243,
62,
23743,
62,
1416,
2850,
58,
25,
48369,
62,
9630,
60,
1343,
1751,
62,
1416,
2850,
198,
220,
220,
220,
5929,
62,
39748,
62,
521,
1063,
796,
1351,
7,
9521,
7,
11925,
7,
24011,
1389,
62,
39748,
22305,
628,
220,
220,
220,
23243,
62,
39748,
62,
521,
1063,
796,
685,
87,
329,
4808,
11,
2124,
287,
23243,
7,
13344,
7,
198,
220,
220,
220,
220,
220,
220,
220,
5929,
62,
1416,
2850,
11,
5929,
62,
39748,
62,
521,
1063,
198,
220,
220,
220,
15306,
60,
628,
220,
220,
220,
6163,
62,
39748,
62,
521,
1063,
796,
23243,
62,
39748,
62,
521,
1063,
58,
25,
39748,
62,
7857,
60,
628,
220,
220,
220,
1303,
833,
19524,
378,
290,
1441,
198,
220,
220,
220,
1441,
685,
24011,
1389,
62,
39748,
58,
72,
60,
329,
1312,
287,
6163,
62,
39748,
62,
521,
1063,
60,
198
] | 3.034731 | 835 |
n = int(input('Digite um número: '))
if n % 2 == 0:
print(f'O número {n} é par.')
else:
print(f'O número {n} é ímpar.')
| [
77,
796,
493,
7,
15414,
10786,
19511,
578,
23781,
299,
21356,
647,
78,
25,
705,
4008,
198,
361,
299,
4064,
362,
6624,
657,
25,
198,
220,
220,
220,
3601,
7,
69,
6,
46,
299,
21356,
647,
78,
1391,
77,
92,
38251,
1582,
2637,
8,
198,
17772,
25,
198,
220,
220,
220,
3601,
7,
69,
6,
46,
299,
21356,
647,
78,
1391,
77,
92,
38251,
6184,
255,
76,
1845,
2637,
8,
628
] | 1.816901 | 71 |
import math
def find_index(sorted_list, target):
"""Finds the index where the target value is expected in a sorted list."""
def binary_search(low_index, hi_index):
"""Searches for a value in a list, throwing away half each call"""
# locate the middle index
mid_index = math.ceil((low_index + hi_index) / 2)
# obtain values from all three indices
low_val, mid_val, high_val = (
sorted_list[low_index],
sorted_list[mid_index],
sorted_list[hi_index],
)
# Base case: the target value is found
if mid_val == target:
return mid_index
# target value not found:
elif mid_val > target:
# if target lies "before" the array
if low_index == hi_index:
# return the 0 index
return mid_index
# otherwise search the lower half of the array
return binary_search(low_index, mid_index - 1)
elif mid_val < target:
# if target lies "after" the last value
if low_index == hi_index:
return mid_index + 1
# otherwise search the larger half of the array
return binary_search(mid_index + 1, hi_index)
# store the array length
ARRAY_LENGTH = len(sorted_list)
# execute binary search on the array
return binary_search(0, ARRAY_LENGTH - 1)
if __name__ == "__main__":
print(find_index([1, 3, 5, 6], 5))
| [
11748,
10688,
628,
198,
4299,
1064,
62,
9630,
7,
82,
9741,
62,
4868,
11,
2496,
2599,
198,
220,
220,
220,
37227,
16742,
82,
262,
6376,
810,
262,
2496,
1988,
318,
2938,
287,
257,
23243,
1351,
526,
15931,
628,
220,
220,
220,
825,
13934,
62,
12947,
7,
9319,
62,
9630,
11,
23105,
62,
9630,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
50,
451,
2052,
329,
257,
1988,
287,
257,
1351,
11,
9644,
1497,
2063,
1123,
869,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
17276,
262,
3504,
6376,
198,
220,
220,
220,
220,
220,
220,
220,
3095,
62,
9630,
796,
10688,
13,
344,
346,
19510,
9319,
62,
9630,
1343,
23105,
62,
9630,
8,
1220,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7330,
3815,
422,
477,
1115,
36525,
198,
220,
220,
220,
220,
220,
220,
220,
1877,
62,
2100,
11,
3095,
62,
2100,
11,
1029,
62,
2100,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23243,
62,
4868,
58,
9319,
62,
9630,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23243,
62,
4868,
58,
13602,
62,
9630,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23243,
62,
4868,
58,
5303,
62,
9630,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7308,
1339,
25,
262,
2496,
1988,
318,
1043,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3095,
62,
2100,
6624,
2496,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
3095,
62,
9630,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2496,
1988,
407,
1043,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
3095,
62,
2100,
1875,
2496,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
2496,
7363,
366,
19052,
1,
262,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1877,
62,
9630,
6624,
23105,
62,
9630,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1441,
262,
657,
6376,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
3095,
62,
9630,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4306,
2989,
262,
2793,
2063,
286,
262,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
13934,
62,
12947,
7,
9319,
62,
9630,
11,
3095,
62,
9630,
532,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
3095,
62,
2100,
1279,
2496,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
2496,
7363,
366,
8499,
1,
262,
938,
1988,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1877,
62,
9630,
6624,
23105,
62,
9630,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
3095,
62,
9630,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4306,
2989,
262,
4025,
2063,
286,
262,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
13934,
62,
12947,
7,
13602,
62,
9630,
1343,
352,
11,
23105,
62,
9630,
8,
628,
220,
220,
220,
1303,
3650,
262,
7177,
4129,
198,
220,
220,
220,
5923,
30631,
62,
43,
49494,
796,
18896,
7,
82,
9741,
62,
4868,
8,
198,
220,
220,
220,
1303,
12260,
13934,
2989,
319,
262,
7177,
198,
220,
220,
220,
1441,
13934,
62,
12947,
7,
15,
11,
5923,
30631,
62,
43,
49494,
532,
352,
8,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
3601,
7,
19796,
62,
9630,
26933,
16,
11,
513,
11,
642,
11,
718,
4357,
642,
4008,
198
] | 2.280675 | 652 |
with open('input.txt') as file:
total = 0
for line in file:
inputs, outputs = parse_line(line)
for code in outputs:
if len(code) == 2 or len(code) == 3 or len(code) == 4 or len(code) == 7:
total += 1
print(total) | [
198,
4480,
1280,
10786,
15414,
13,
14116,
11537,
355,
2393,
25,
198,
220,
220,
220,
2472,
796,
657,
198,
220,
220,
220,
329,
1627,
287,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
17311,
11,
23862,
796,
21136,
62,
1370,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2438,
287,
23862,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
8189,
8,
6624,
362,
393,
18896,
7,
8189,
8,
6624,
513,
393,
18896,
7,
8189,
8,
6624,
604,
393,
18896,
7,
8189,
8,
6624,
767,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
15853,
352,
198,
220,
220,
220,
3601,
7,
23350,
8
] | 2.134921 | 126 |
import vcf
import argparse
from pyfaidx import Fasta
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import MutableSeq
parser = argparse.ArgumentParser(description='Make fasta for each variant to align/augment.')
parser.add_argument('-v', help='the input VCF file.', required=True)
parser.add_argument('-r', help='the reference FASTA file.', required=True)
parser.add_argument('-s', help='the output FASTA file with SV sequence to align/augment', required=True)
parser.add_argument('-f', default=50000, type=int,
help='the flank size. Default 50000.')
args = parser.parse_args()
# get chromosome length
ref = Fasta(args.r)
# read vcf
vcfi = open(args.v, 'r')
vcf_reader = vcf.Reader(vcfi)
fa_outf = open(args.s, 'w')
tail_buff = 1000 # tail buffer: no sequence extracted from a buffer at the chunk tails to ensure they stay untouched
for record in vcf_reader:
chr_len = len(ref[record.CHROM])
# retrieve alt allele with flanks
# left flank sequence
fl1_e = record.POS - 1
if fl1_e < tail_buff:
l1_s = tail_buff / 2
else:
fl1_s = fl1_e - args.f
fl1_s = max(0, fl1_s) + tail_buff
fl1_seq = ref[record.CHROM][fl1_s:fl1_e]
fl1_seq = fl1_seq.seq
# Get flank 2 sequence
fl2_s = record.POS + len(record.REF) - 1
if fl2_s > chr_len - tail_buff:
fl2_e = (chr_len + fl2_s)/2
else:
fl2_e = fl2_s + args.f
fl2_e = min(fl2_e, len(ref[record.CHROM])) - tail_buff
fl2_seq = ref[record.CHROM][int(fl2_s):int(fl2_e)]
fl2_seq = fl2_seq.seq
# Fasta record
oseq = fl1_seq + str(record.ALT[0]) + fl2_seq
svid = '{}_{}_{}_{}'.format(record.CHROM, int(fl1_s), int(fl2_e), record.ID)
orec = SeqRecord(MutableSeq(oseq.upper()), id=svid,
description='')
SeqIO.write(orec, fa_outf, "fasta")
fa_outf.close()
vcfi.close()
| [
11748,
410,
12993,
198,
11748,
1822,
29572,
198,
6738,
12972,
69,
1698,
87,
1330,
12549,
64,
198,
6738,
16024,
1330,
1001,
80,
9399,
198,
6738,
16024,
13,
4653,
80,
23739,
1330,
1001,
80,
23739,
198,
6738,
16024,
13,
4653,
80,
1330,
13859,
540,
4653,
80,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
11639,
12050,
3049,
64,
329,
1123,
15304,
284,
10548,
14,
559,
5154,
2637,
8,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
85,
3256,
1037,
11639,
1169,
5128,
569,
22495,
2393,
2637,
11,
2672,
28,
17821,
8,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
81,
3256,
1037,
11639,
1169,
4941,
376,
1921,
5603,
2393,
2637,
11,
2672,
28,
17821,
8,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
82,
3256,
1037,
11639,
1169,
5072,
376,
1921,
5603,
2393,
351,
20546,
8379,
284,
10548,
14,
559,
5154,
3256,
2672,
28,
17821,
8,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
69,
3256,
4277,
28,
20,
2388,
11,
2099,
28,
600,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
11639,
1169,
30172,
2546,
13,
15161,
642,
2388,
2637,
8,
198,
22046,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
198,
2,
651,
34348,
4129,
198,
5420,
796,
12549,
64,
7,
22046,
13,
81,
8,
198,
198,
2,
1100,
410,
12993,
198,
28435,
12463,
796,
1280,
7,
22046,
13,
85,
11,
705,
81,
11537,
198,
85,
12993,
62,
46862,
796,
410,
12993,
13,
33634,
7,
28435,
12463,
8,
198,
13331,
62,
448,
69,
796,
1280,
7,
22046,
13,
82,
11,
705,
86,
11537,
198,
13199,
62,
36873,
796,
8576,
1303,
7894,
11876,
25,
645,
8379,
21242,
422,
257,
11876,
379,
262,
16058,
30514,
284,
4155,
484,
2652,
36519,
198,
1640,
1700,
287,
410,
12993,
62,
46862,
25,
198,
220,
220,
220,
442,
81,
62,
11925,
796,
18896,
7,
5420,
58,
22105,
13,
3398,
33676,
12962,
198,
220,
220,
220,
1303,
19818,
5988,
45907,
351,
781,
2283,
198,
220,
220,
220,
1303,
1364,
30172,
8379,
198,
220,
220,
220,
781,
16,
62,
68,
796,
1700,
13,
37997,
532,
352,
198,
220,
220,
220,
611,
781,
16,
62,
68,
1279,
7894,
62,
36873,
25,
198,
220,
220,
220,
220,
220,
220,
220,
300,
16,
62,
82,
796,
7894,
62,
36873,
1220,
362,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
781,
16,
62,
82,
796,
781,
16,
62,
68,
532,
26498,
13,
69,
198,
220,
220,
220,
220,
220,
220,
220,
781,
16,
62,
82,
796,
3509,
7,
15,
11,
781,
16,
62,
82,
8,
220,
1343,
7894,
62,
36873,
198,
220,
220,
220,
781,
16,
62,
41068,
796,
1006,
58,
22105,
13,
3398,
33676,
7131,
2704,
16,
62,
82,
25,
2704,
16,
62,
68,
60,
198,
220,
220,
220,
781,
16,
62,
41068,
796,
781,
16,
62,
41068,
13,
41068,
198,
220,
220,
220,
1303,
3497,
30172,
362,
8379,
198,
220,
220,
220,
781,
17,
62,
82,
796,
1700,
13,
37997,
1343,
18896,
7,
22105,
13,
31688,
8,
532,
352,
198,
220,
220,
220,
611,
781,
17,
62,
82,
1875,
442,
81,
62,
11925,
532,
7894,
62,
36873,
25,
198,
220,
220,
220,
220,
220,
220,
220,
781,
17,
62,
68,
796,
357,
354,
81,
62,
11925,
1343,
781,
17,
62,
82,
20679,
17,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
781,
17,
62,
68,
796,
781,
17,
62,
82,
1343,
26498,
13,
69,
198,
220,
220,
220,
220,
220,
220,
220,
781,
17,
62,
68,
796,
949,
7,
2704,
17,
62,
68,
11,
18896,
7,
5420,
58,
22105,
13,
3398,
33676,
60,
4008,
532,
7894,
62,
36873,
198,
220,
220,
220,
781,
17,
62,
41068,
796,
1006,
58,
22105,
13,
3398,
33676,
7131,
600,
7,
2704,
17,
62,
82,
2599,
600,
7,
2704,
17,
62,
68,
15437,
198,
220,
220,
220,
781,
17,
62,
41068,
796,
781,
17,
62,
41068,
13,
41068,
198,
220,
220,
220,
1303,
12549,
64,
1700,
198,
220,
220,
220,
267,
41068,
796,
781,
16,
62,
41068,
1343,
965,
7,
22105,
13,
31429,
58,
15,
12962,
1343,
781,
17,
62,
41068,
198,
220,
220,
220,
264,
16921,
796,
705,
90,
92,
23330,
92,
23330,
92,
23330,
92,
4458,
18982,
7,
22105,
13,
3398,
33676,
11,
493,
7,
2704,
16,
62,
82,
828,
493,
7,
2704,
17,
62,
68,
828,
1700,
13,
2389,
8,
198,
220,
220,
220,
267,
8344,
796,
1001,
80,
23739,
7,
44,
18187,
4653,
80,
7,
577,
80,
13,
45828,
3419,
828,
4686,
28,
82,
16921,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6764,
28,
7061,
8,
198,
220,
220,
220,
1001,
80,
9399,
13,
13564,
7,
382,
66,
11,
24685,
62,
448,
69,
11,
366,
7217,
64,
4943,
198,
13331,
62,
448,
69,
13,
19836,
3419,
198,
28435,
12463,
13,
19836,
3419,
198
] | 2.27657 | 828 |
"""
Ethernet RMII Interface
Copyright 2018-2019 Adam Greig
Released under the MIT license; see LICENSE for details.
"""
from nmigen import Elaboratable, Module, Signal, Cat
from .crc import CRC32
from .mac_address_match import MACAddressMatch
class RMIIRx(Elaboratable):
"""
RMII receive module
Receives incoming packets and saves them to a memory. Validates incoming
frame check sequence and only asserts `rx_valid` when an entire valid
packet has been saved to the port.
This module must be run in the RMII ref_clk domain, and the memory port
and inputs and outputs must also be in that clock domain.
Parameters:
* `mac_addr`: 6-byte MAC address (list of ints)
Ports:
* `write_port`: a write-capable memory port, 8 bits wide by 2048,
running in the RMII ref_clk domain
Pins:
* `crs_dv`: RMII carrier sense/data valid
* `rxd0`: RMII receive data 0
* `rxd1`: RMII receive data 1
Outputs:
* `rx_valid`: pulsed when a valid packet is in memory
* `rx_offset`: n-bit start address of received packet
* `rx_len`: 11-bit length of received packet
"""
class RMIIRxByte(Elaboratable):
"""
RMII Receive Byte De-muxer
Handles receiving a byte dibit-by-dibit.
This submodule must be in the RMII ref_clk clock domain,
and its outputs are likewise in that domain.
Pins:
* `crs_dv`: Data valid, input
* `rxd0`: RX data 0, input
* `rxd1`: RX data 1, input
Outputs:
* `data`: 8-bit wide output data
* `data_valid`: Asserted for one cycle when `data` is valid
* `dv`: RMII Data valid recovered signal
* `crs`: RMII Carrier sense recovered signal
"""
class RMIITx(Elaboratable):
"""
RMII transmit module
Transmits outgoing packets from a memory. Adds preamble, start of frame
delimiter, and frame check sequence (CRC32) automatically.
This module must be run in the RMII ref_clk domain, and the memory port
and inputs and outputs must also be in that clock domain.
Ports:
* `read_port`: a read memory port, 8 bits wide by 2048,
running in the RMII ref_clk domain
Pins:
* `txen`: RMII transmit enable
* `txd0`: RMII transmit data 0
* `txd1`: RMII transmit data 1
Inputs:
* `tx_start`: Pulse high to begin transmission of a packet
* `tx_offset`: n-bit address offset of packet to transmit
* `tx_len`: 11-bit length of packet to transmit
Outputs:
* `tx_ready`: Asserted while ready to transmit a new packet
"""
class RMIITxByte(Elaboratable):
"""
RMII Transmit Byte Muxer
Handles transmitting a byte dibit-by-dibit.
This submodule must be in the RMII ref_clk clock domain,
and its inputs and outputs are likewise in that domain.
Pins:
* `txen`: RMII Transmit enable
* `txd0`: TMII Transmit data 0
* `txd1`: TMII Transmit data 1
Inputs:
* `data`: 8-bit wide data to transmit. Latched internally so you may
update it to the next word after asserting `data_valid`.
* `data_valid`: Assert while valid data is present at `data`.
Outputs:
* `ready`: Asserted when ready to receive new data. This is asserted
while the final dibit is being transmitted so that new data
can be produced on the next clock cycle.
"""
| [
37811,
198,
36,
490,
3262,
29820,
3978,
26491,
198,
198,
15269,
2864,
12,
23344,
7244,
11955,
328,
198,
45037,
739,
262,
17168,
5964,
26,
766,
38559,
24290,
329,
3307,
13,
198,
37811,
198,
198,
6738,
28642,
9324,
1330,
2574,
4820,
21156,
11,
19937,
11,
26484,
11,
5181,
198,
6738,
764,
66,
6015,
1330,
45623,
2624,
198,
6738,
764,
20285,
62,
21975,
62,
15699,
1330,
20582,
20231,
23850,
628,
198,
4871,
29820,
3978,
49,
87,
7,
9527,
4820,
21156,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
29820,
3978,
3328,
8265,
628,
220,
220,
220,
19520,
1083,
15619,
24624,
290,
16031,
606,
284,
257,
4088,
13,
3254,
37051,
15619,
198,
220,
220,
220,
5739,
2198,
8379,
290,
691,
29348,
4600,
40914,
62,
12102,
63,
618,
281,
2104,
4938,
198,
220,
220,
220,
19638,
468,
587,
7448,
284,
262,
2493,
13,
628,
220,
220,
220,
770,
8265,
1276,
307,
1057,
287,
262,
29820,
3978,
1006,
62,
565,
74,
7386,
11,
290,
262,
4088,
2493,
198,
220,
220,
220,
290,
17311,
290,
23862,
1276,
635,
307,
287,
326,
8801,
7386,
13,
628,
220,
220,
220,
40117,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
20285,
62,
29851,
63,
25,
718,
12,
26327,
20582,
2209,
357,
4868,
286,
493,
82,
8,
628,
220,
220,
220,
30824,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
13564,
62,
634,
63,
25,
257,
3551,
12,
11128,
540,
4088,
2493,
11,
807,
10340,
3094,
416,
36117,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2491,
287,
262,
29820,
3978,
1006,
62,
565,
74,
7386,
628,
220,
220,
220,
350,
1040,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
66,
3808,
62,
67,
85,
63,
25,
29820,
3978,
11920,
2565,
14,
7890,
4938,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
81,
24954,
15,
63,
25,
29820,
3978,
3328,
1366,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
81,
24954,
16,
63,
25,
29820,
3978,
3328,
1366,
352,
628,
220,
220,
220,
25235,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
40914,
62,
12102,
63,
25,
22271,
276,
618,
257,
4938,
19638,
318,
287,
4088,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
40914,
62,
28968,
63,
25,
299,
12,
2545,
923,
2209,
286,
2722,
19638,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
40914,
62,
11925,
63,
25,
1367,
12,
2545,
4129,
286,
2722,
19638,
198,
220,
220,
220,
37227,
628,
198,
4871,
29820,
3978,
49,
87,
40778,
7,
9527,
4820,
21156,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
29820,
3978,
797,
15164,
30589,
1024,
12,
76,
2821,
263,
628,
220,
220,
220,
7157,
829,
6464,
257,
18022,
288,
571,
270,
12,
1525,
12,
67,
571,
270,
13,
628,
220,
220,
220,
770,
850,
21412,
1276,
307,
287,
262,
29820,
3978,
1006,
62,
565,
74,
8801,
7386,
11,
198,
220,
220,
220,
290,
663,
23862,
389,
20467,
287,
326,
7386,
13,
628,
220,
220,
220,
350,
1040,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
66,
3808,
62,
67,
85,
63,
25,
6060,
4938,
11,
5128,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
81,
24954,
15,
63,
25,
24202,
1366,
657,
11,
5128,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
81,
24954,
16,
63,
25,
24202,
1366,
352,
11,
5128,
628,
220,
220,
220,
25235,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
7890,
63,
25,
807,
12,
2545,
3094,
5072,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
7890,
62,
12102,
63,
25,
2195,
861,
276,
329,
530,
6772,
618,
4600,
7890,
63,
318,
4938,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
67,
85,
63,
25,
29820,
3978,
6060,
4938,
11911,
6737,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
66,
3808,
63,
25,
29820,
3978,
30252,
2565,
11911,
6737,
198,
220,
220,
220,
37227,
628,
198,
4871,
371,
8895,
2043,
87,
7,
9527,
4820,
21156,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
29820,
3978,
21937,
8265,
628,
220,
220,
220,
3602,
24883,
28181,
24624,
422,
257,
4088,
13,
34333,
662,
321,
903,
11,
923,
286,
5739,
198,
220,
220,
220,
46728,
2676,
11,
290,
5739,
2198,
8379,
357,
34,
7397,
2624,
8,
6338,
13,
628,
220,
220,
220,
770,
8265,
1276,
307,
1057,
287,
262,
29820,
3978,
1006,
62,
565,
74,
7386,
11,
290,
262,
4088,
2493,
198,
220,
220,
220,
290,
17311,
290,
23862,
1276,
635,
307,
287,
326,
8801,
7386,
13,
628,
220,
220,
220,
30824,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
961,
62,
634,
63,
25,
257,
1100,
4088,
2493,
11,
807,
10340,
3094,
416,
36117,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2491,
287,
262,
29820,
3978,
1006,
62,
565,
74,
7386,
628,
220,
220,
220,
350,
1040,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
268,
63,
25,
29820,
3978,
21937,
7139,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
67,
15,
63,
25,
29820,
3978,
21937,
1366,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
67,
16,
63,
25,
29820,
3978,
21937,
1366,
352,
628,
220,
220,
220,
23412,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
62,
9688,
63,
25,
25062,
1029,
284,
2221,
11478,
286,
257,
19638,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
62,
28968,
63,
25,
299,
12,
2545,
2209,
11677,
286,
19638,
284,
21937,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
62,
11925,
63,
25,
1367,
12,
2545,
4129,
286,
19638,
284,
21937,
628,
220,
220,
220,
25235,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
62,
1493,
63,
25,
2195,
861,
276,
981,
3492,
284,
21937,
257,
649,
19638,
198,
220,
220,
220,
37227,
628,
198,
4871,
371,
8895,
2043,
87,
40778,
7,
9527,
4820,
21156,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
29820,
3978,
3602,
2781,
30589,
337,
2821,
263,
628,
220,
220,
220,
7157,
829,
39573,
257,
18022,
288,
571,
270,
12,
1525,
12,
67,
571,
270,
13,
628,
220,
220,
220,
770,
850,
21412,
1276,
307,
287,
262,
29820,
3978,
1006,
62,
565,
74,
8801,
7386,
11,
198,
220,
220,
220,
290,
663,
17311,
290,
23862,
389,
20467,
287,
326,
7386,
13,
628,
220,
220,
220,
350,
1040,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
268,
63,
25,
29820,
3978,
3602,
2781,
7139,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
67,
15,
63,
25,
21232,
3978,
3602,
2781,
1366,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
17602,
67,
16,
63,
25,
21232,
3978,
3602,
2781,
1366,
352,
628,
220,
220,
220,
23412,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
7890,
63,
25,
807,
12,
2545,
3094,
1366,
284,
21937,
13,
5476,
1740,
20947,
523,
345,
743,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4296,
340,
284,
262,
1306,
1573,
706,
33183,
4600,
7890,
62,
12102,
44646,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
7890,
62,
12102,
63,
25,
2195,
861,
981,
4938,
1366,
318,
1944,
379,
4600,
7890,
44646,
628,
220,
220,
220,
25235,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
4600,
1493,
63,
25,
2195,
861,
276,
618,
3492,
284,
3328,
649,
1366,
13,
770,
318,
21635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
262,
2457,
288,
571,
270,
318,
852,
18307,
523,
326,
649,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
460,
307,
4635,
319,
262,
1306,
8801,
6772,
13,
198,
220,
220,
220,
37227,
628,
628,
198
] | 2.585059 | 1,352 |
import discord
from discord.ext import commands
import random
import sys
sys.path.insert(1, '../functions')
from functions.cmd_print import cmd_print
| [
11748,
36446,
198,
6738,
36446,
13,
2302,
1330,
9729,
198,
11748,
4738,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
28463,
7,
16,
11,
705,
40720,
12543,
2733,
11537,
198,
6738,
5499,
13,
28758,
62,
4798,
1330,
23991,
62,
4798,
628,
198
] | 3.619048 | 42 |
sentences = [['a', 'b', 'c'], ['a', 'd','e']]
default_val = ''
entity_embeddings_dict = {}
entity_embeddings_dict = {sentence[0]: doThis(sentence) + entity_embeddings_dict.get(sentence[0], default_val) \
for sentence in sentences }
print(entity_embeddings_dict) | [
34086,
3007,
796,
16410,
6,
64,
3256,
705,
65,
3256,
705,
66,
6,
4357,
37250,
64,
3256,
705,
67,
41707,
68,
6,
11907,
198,
198,
12286,
62,
2100,
796,
10148,
198,
26858,
62,
20521,
67,
654,
62,
11600,
796,
23884,
198,
26858,
62,
20521,
67,
654,
62,
11600,
796,
1391,
34086,
594,
58,
15,
5974,
466,
1212,
7,
34086,
594,
8,
1343,
9312,
62,
20521,
67,
654,
62,
11600,
13,
1136,
7,
34086,
594,
58,
15,
4357,
4277,
62,
2100,
8,
3467,
198,
1640,
6827,
287,
13439,
1782,
198,
4798,
7,
26858,
62,
20521,
67,
654,
62,
11600,
8
] | 2.646465 | 99 |
import dill as pickle
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import grav_util_3 as gu
import bead_util as bu
import configuration as config
import warnings
warnings.filterwarnings("ignore")
theory_data_dir = '/data/grav_sim_data/2um_spacing_data/'
data_dirs = [#'/data/20180625/bead1/grav_data/shield/X50-75um_Z15-25um_17Hz', \
#'/data/20180625/bead1/grav_data/shield/X50-75um_Z15-25um_17Hz_elec-term', \
#\
#'/data/20180704/bead1/grav_data/shield', \
#'/data/20180704/bead1/grav_data/shield_1s_1h', \
#'/data/20180704/bead1/grav_data/shield2', \
#'/data/20180704/bead1/grav_data/shield3', \
#'/data/20180704/bead1/grav_data/shield4', \
'/data/20180704/no_bead/grav_data/shield', \
#\
#'/data/20180808/bead4/grav_data/shield1'
]
fit_type = 'Gaussian'
#fit_type = 'Planar'
p0_bead_dict = {'20180625': [19.0,40.0,20.0], \
'20180704': [18.7,40.0,20.0], \
'20180808': [18,40.0,23.0] \
}
load_agg = True
harms = [1,2,3,4,5,6]
#opt_ext = 'TEST'
opt_ext = '_6harm-full'
if fit_type == 'Gaussian':
data_ind = 2
err_ind = 4
if fit_type == 'Planar':
data_ind = 0
err_ind = 1
for ddir in data_dirs:
print()
parts = ddir.split('/')
date = parts[2]
p0_bead = p0_bead_dict[date]
nobead = ('no_bead' in parts) or ('nobead' in parts) or ('no-bead' in parts)
if nobead:
opt_ext += '_NO-BEAD'
agg_path = '/processed_data/aggdat/' + date + '_' + parts[-1] + opt_ext + '.agg'
alpha_arr_path = '/processed_data/alpha_arrs/' + date + '_' + parts[-1] + opt_ext + '.arr'
lambda_path = alpha_arr_path[:-4] + '_lambdas.arr'
if load_agg:
print(agg_path)
agg_dat = gu.AggregateData([], p0_bead=p0_bead, harms=harms)
agg_dat.load(agg_path)
agg_dat.reload_grav_funcs()
#agg_dat.fit_alpha_xyz_vs_alldim(weight_planar=False, plot=False, plot_hists=True)
alpha_arr = agg_dat.alpha_xyz_best_fit
lambdas = agg_dat.lambdas
np.save(open(alpha_arr_path, 'wb'), alpha_arr)
np.save(open(lambda_path, 'wb'), agg_dat.lambdas)
else:
alpha_arr = np.load(open(alpha_arr_path, 'rb'))
lambdas = np.load(open(lambda_path, 'rb'))
Ncomp = alpha_arr.shape[-2]
comp_colors = bu.get_color_map(Ncomp, cmap='viridis')
alpha_w = np.sum(alpha_arr[:,0:2,:,data_ind]*alpha_arr[:,0:2,:,err_ind]**(-2), axis=1) / \
np.sum(alpha_arr[:,0:2,:,err_ind]**(-2), axis=1)
#alpha_w = np.sum(alpha_arr[:,0:2,:,2], axis=1) * 0.5
errs_x = np.zeros_like(alpha_arr[:,0,0,0])
N = 0
for ind in range(Ncomp - 1):
errs_x += alpha_w[:,ind+1]**2
N += 1
errs_x = np.sqrt(errs_x / N)
sigma_alpha_w = 1.0 / np.sqrt( np.sum(alpha_arr[:,:2,:,3]**(-2), axis=1) )
N_w = np.sum(alpha_arr[:,:2,:,7], axis=1)
plt.figure(1)
if nobead:
plt.title(date + '_' + 'no-bead' + ': Result of %s Fitting' % fit_type, fontsize=16)
else:
plt.title(date + '_' + parts[-1] + ': Result of %s Fitting' % fit_type, fontsize=16)
plt.loglog(lambdas, np.abs(alpha_w[:,0]), lw=4, \
label='Template basis vector')
plt.loglog(lambdas, errs_x, '--', lw=2, \
label='Quadrature sum of other vectors')
plt.loglog(gu.limitdata[:,0], gu.limitdata[:,1], '--', label=gu.limitlab, \
linewidth=3, color='r')
plt.loglog(gu.limitdata2[:,0], gu.limitdata2[:,1], '--', label=gu.limitlab2, \
linewidth=3, color='k')
plt.xlabel('Length Scale: $\lambda$ [m]')
plt.ylabel('Strength: |$\\alpha$| [arb]')
plt.xlim(1e-7, 1e-3)
plt.ylim(1e4, 1e14)
plt.legend()
plt.grid()
plt.show()
for ind in range(Ncomp):
fig2 = plt.figure(2)
plt.title("%s fit for Basis Vector: %i" % (fit_type, ind))
plt.loglog(lambdas, np.abs(alpha_arr[:,0,ind,data_ind]), \
color=comp_colors[ind], ls='--', label='$\\alpha_x$')
plt.loglog(lambdas, np.abs(alpha_arr[:,0,ind,err_ind]), \
color=comp_colors[ind], ls='--', label='$\sigma_{\\alpha_x}$', \
alpha=0.5)
plt.loglog(lambdas, np.abs(alpha_w[:,ind]), \
color=comp_colors[ind], ls='-', lw=3, label='Weighted mean')
plt.loglog(lambdas, np.abs(alpha_arr[:,1,ind,data_ind]), \
color=comp_colors[ind], ls='-.', label='$\\alpha_y$')
plt.loglog(lambdas, np.abs(alpha_arr[:,1,ind,err_ind]), \
color=comp_colors[ind], ls='-.', label='$\sigma_{\\alpha_y}$', \
alpha=0.5)
plt.xlabel('Length Scale: $\lambda$ [m]')
plt.ylabel('Strength: |$\\alpha$| [arb]')
plt.xlim(1e-6, 1e-3)
plt.ylim(1e6, 1e15)
plt.legend()
plt.grid()
fig_title = '/home/charles/plots/' + date + '/' + parts[-1] + '/' \
+ date + '_' + parts[-1] + '_%s-fit_comp%i.png' % (fit_type, ind)
fig2.savefig(fig_title)
plt.close(fig2)
#plt.show()
#for fig_num in [1,2,3]:
# plt.figure(fig_num)
# plt.xlabel('Length Scale: $\lambda$ [m]')
# plt.ylabel('Strength: |$\\alpha$| [arb]')
# plt.legend()
# plt.grid()
#plt.show()
| [
11748,
288,
359,
355,
2298,
293,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
285,
489,
62,
25981,
74,
896,
13,
76,
29487,
18,
67,
1330,
12176,
274,
18,
35,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
11748,
9067,
62,
22602,
62,
18,
355,
915,
198,
11748,
49773,
62,
22602,
355,
809,
198,
11748,
8398,
355,
4566,
198,
198,
11748,
14601,
198,
40539,
654,
13,
24455,
40539,
654,
7203,
46430,
4943,
628,
628,
198,
1169,
652,
62,
7890,
62,
15908,
796,
31051,
7890,
14,
70,
4108,
62,
14323,
62,
7890,
14,
17,
388,
62,
2777,
4092,
62,
7890,
14,
6,
198,
198,
7890,
62,
15908,
82,
796,
685,
2,
26488,
7890,
14,
1264,
1795,
26704,
14,
65,
1329,
16,
14,
70,
4108,
62,
7890,
14,
26662,
14,
55,
1120,
12,
2425,
388,
62,
57,
1314,
12,
1495,
388,
62,
1558,
7399,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26488,
7890,
14,
1264,
1795,
26704,
14,
65,
1329,
16,
14,
70,
4108,
62,
7890,
14,
26662,
14,
55,
1120,
12,
2425,
388,
62,
57,
1314,
12,
1495,
388,
62,
1558,
7399,
62,
11129,
66,
12,
4354,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
59,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26488,
7890,
14,
1264,
1795,
32869,
14,
65,
1329,
16,
14,
70,
4108,
62,
7890,
14,
26662,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26488,
7890,
14,
1264,
1795,
32869,
14,
65,
1329,
16,
14,
70,
4108,
62,
7890,
14,
26662,
62,
16,
82,
62,
16,
71,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26488,
7890,
14,
1264,
1795,
32869,
14,
65,
1329,
16,
14,
70,
4108,
62,
7890,
14,
26662,
17,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26488,
7890,
14,
1264,
1795,
32869,
14,
65,
1329,
16,
14,
70,
4108,
62,
7890,
14,
26662,
18,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26488,
7890,
14,
1264,
1795,
32869,
14,
65,
1329,
16,
14,
70,
4108,
62,
7890,
14,
26662,
19,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31051,
7890,
14,
1264,
1795,
32869,
14,
3919,
62,
65,
1329,
14,
70,
4108,
62,
7890,
14,
26662,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
59,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26488,
7890,
14,
1264,
1795,
28362,
14,
65,
1329,
19,
14,
70,
4108,
62,
7890,
14,
26662,
16,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
198,
11147,
62,
4906,
796,
705,
35389,
31562,
6,
198,
2,
11147,
62,
4906,
796,
705,
20854,
283,
6,
198,
198,
79,
15,
62,
65,
1329,
62,
11600,
796,
1391,
6,
1264,
1795,
26704,
10354,
685,
1129,
13,
15,
11,
1821,
13,
15,
11,
1238,
13,
15,
4357,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1264,
1795,
32869,
10354,
685,
1507,
13,
22,
11,
1821,
13,
15,
11,
1238,
13,
15,
4357,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1264,
1795,
28362,
10354,
685,
1507,
11,
1821,
13,
15,
11,
1954,
13,
15,
60,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
198,
2220,
62,
9460,
796,
6407,
198,
198,
71,
8357,
796,
685,
16,
11,
17,
11,
18,
11,
19,
11,
20,
11,
21,
60,
198,
198,
2,
8738,
62,
2302,
796,
705,
51,
6465,
6,
198,
8738,
62,
2302,
796,
705,
62,
21,
29155,
12,
12853,
6,
628,
198,
198,
361,
4197,
62,
4906,
6624,
705,
35389,
31562,
10354,
198,
220,
220,
220,
1366,
62,
521,
796,
362,
198,
220,
220,
220,
11454,
62,
521,
796,
604,
198,
361,
4197,
62,
4906,
6624,
705,
20854,
283,
10354,
198,
220,
220,
220,
1366,
62,
521,
796,
657,
198,
220,
220,
220,
11454,
62,
521,
796,
352,
628,
198,
1640,
288,
15908,
287,
1366,
62,
15908,
82,
25,
198,
220,
220,
220,
3601,
3419,
628,
220,
220,
220,
3354,
796,
288,
15908,
13,
35312,
10786,
14,
11537,
198,
220,
220,
220,
3128,
796,
3354,
58,
17,
60,
198,
220,
220,
220,
279,
15,
62,
65,
1329,
796,
279,
15,
62,
65,
1329,
62,
11600,
58,
4475,
60,
198,
220,
220,
220,
220,
198,
220,
220,
220,
31801,
1329,
796,
19203,
3919,
62,
65,
1329,
6,
287,
3354,
8,
393,
19203,
34952,
1329,
6,
287,
3354,
8,
393,
19203,
3919,
12,
65,
1329,
6,
287,
3354,
8,
198,
220,
220,
220,
611,
31801,
1329,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2172,
62,
2302,
15853,
705,
62,
15285,
12,
12473,
2885,
6,
628,
220,
220,
220,
4194,
62,
6978,
796,
31051,
14681,
276,
62,
7890,
14,
9460,
19608,
14,
6,
1343,
3128,
1343,
705,
62,
6,
1343,
3354,
58,
12,
16,
60,
1343,
2172,
62,
2302,
1343,
45302,
9460,
6,
198,
220,
220,
220,
17130,
62,
3258,
62,
6978,
796,
31051,
14681,
276,
62,
7890,
14,
26591,
62,
3258,
82,
14,
6,
1343,
3128,
1343,
705,
62,
6,
1343,
3354,
58,
12,
16,
60,
1343,
2172,
62,
2302,
1343,
45302,
3258,
6,
198,
220,
220,
220,
37456,
62,
6978,
796,
17130,
62,
3258,
62,
6978,
58,
21912,
19,
60,
1343,
705,
62,
2543,
17457,
292,
13,
3258,
6,
628,
220,
220,
220,
611,
3440,
62,
9460,
25,
628,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
9460,
62,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4194,
62,
19608,
796,
915,
13,
46384,
49373,
6601,
26933,
4357,
279,
15,
62,
65,
1329,
28,
79,
15,
62,
65,
1329,
11,
34859,
28,
71,
8357,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4194,
62,
19608,
13,
2220,
7,
9460,
62,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4194,
62,
19608,
13,
260,
2220,
62,
70,
4108,
62,
12543,
6359,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
9460,
62,
19608,
13,
11147,
62,
26591,
62,
5431,
89,
62,
14259,
62,
282,
335,
320,
7,
6551,
62,
11578,
283,
28,
25101,
11,
7110,
28,
25101,
11,
7110,
62,
71,
1023,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
62,
3258,
796,
4194,
62,
19608,
13,
26591,
62,
5431,
89,
62,
13466,
62,
11147,
198,
220,
220,
220,
220,
220,
220,
220,
19343,
67,
292,
796,
4194,
62,
19608,
13,
2543,
17457,
292,
628,
220,
220,
220,
220,
220,
220,
220,
45941,
13,
21928,
7,
9654,
7,
26591,
62,
3258,
62,
6978,
11,
705,
39346,
33809,
17130,
62,
3258,
8,
198,
220,
220,
220,
220,
220,
220,
220,
45941,
13,
21928,
7,
9654,
7,
50033,
62,
6978,
11,
705,
39346,
33809,
4194,
62,
19608,
13,
2543,
17457,
292,
8,
628,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
62,
3258,
796,
45941,
13,
2220,
7,
9654,
7,
26591,
62,
3258,
62,
6978,
11,
705,
26145,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
19343,
67,
292,
796,
45941,
13,
2220,
7,
9654,
7,
50033,
62,
6978,
11,
705,
26145,
6,
4008,
628,
198,
220,
220,
220,
399,
5589,
796,
17130,
62,
3258,
13,
43358,
58,
12,
17,
60,
198,
220,
220,
220,
552,
62,
4033,
669,
796,
809,
13,
1136,
62,
8043,
62,
8899,
7,
45,
5589,
11,
269,
8899,
11639,
37040,
29207,
11537,
628,
220,
220,
220,
17130,
62,
86,
796,
45941,
13,
16345,
7,
26591,
62,
3258,
58,
45299,
15,
25,
17,
11,
45299,
7890,
62,
521,
60,
9,
26591,
62,
3258,
58,
45299,
15,
25,
17,
11,
45299,
8056,
62,
521,
60,
1174,
32590,
17,
828,
16488,
28,
16,
8,
1220,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45941,
13,
16345,
7,
26591,
62,
3258,
58,
45299,
15,
25,
17,
11,
45299,
8056,
62,
521,
60,
1174,
32590,
17,
828,
16488,
28,
16,
8,
628,
220,
220,
220,
1303,
26591,
62,
86,
796,
45941,
13,
16345,
7,
26591,
62,
3258,
58,
45299,
15,
25,
17,
11,
45299,
17,
4357,
16488,
28,
16,
8,
1635,
657,
13,
20,
628,
220,
220,
220,
1931,
3808,
62,
87,
796,
45941,
13,
9107,
418,
62,
2339,
7,
26591,
62,
3258,
58,
45299,
15,
11,
15,
11,
15,
12962,
198,
220,
220,
220,
399,
796,
657,
198,
220,
220,
220,
329,
773,
287,
2837,
7,
45,
5589,
532,
352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1931,
3808,
62,
87,
15853,
17130,
62,
86,
58,
45299,
521,
10,
16,
60,
1174,
17,
198,
220,
220,
220,
220,
220,
220,
220,
399,
15853,
352,
198,
220,
220,
220,
1931,
3808,
62,
87,
796,
45941,
13,
31166,
17034,
7,
263,
3808,
62,
87,
1220,
399,
8,
628,
220,
220,
220,
264,
13495,
62,
26591,
62,
86,
796,
352,
13,
15,
1220,
45941,
13,
31166,
17034,
7,
45941,
13,
16345,
7,
26591,
62,
3258,
58,
45299,
25,
17,
11,
45299,
18,
60,
1174,
32590,
17,
828,
16488,
28,
16,
8,
1267,
198,
220,
220,
220,
399,
62,
86,
796,
45941,
13,
16345,
7,
26591,
62,
3258,
58,
45299,
25,
17,
11,
45299,
22,
4357,
16488,
28,
16,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
458,
83,
13,
26875,
7,
16,
8,
198,
220,
220,
220,
611,
31801,
1329,
25,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
7839,
7,
4475,
1343,
705,
62,
6,
1343,
705,
3919,
12,
65,
1329,
6,
1343,
705,
25,
25414,
286,
4064,
82,
376,
2535,
6,
4064,
4197,
62,
4906,
11,
10369,
7857,
28,
1433,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
7839,
7,
4475,
1343,
705,
62,
6,
1343,
3354,
58,
12,
16,
60,
1343,
705,
25,
25414,
286,
4064,
82,
376,
2535,
6,
4064,
4197,
62,
4906,
11,
10369,
7857,
28,
1433,
8,
628,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
2543,
17457,
292,
11,
45941,
13,
8937,
7,
26591,
62,
86,
58,
45299,
15,
46570,
300,
86,
28,
19,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6167,
11639,
30800,
4308,
15879,
11537,
628,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
2543,
17457,
292,
11,
1931,
3808,
62,
87,
11,
705,
438,
3256,
300,
86,
28,
17,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6167,
11639,
4507,
41909,
1300,
2160,
286,
584,
30104,
11537,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
5162,
13,
32374,
7890,
58,
45299,
15,
4357,
915,
13,
32374,
7890,
58,
45299,
16,
4357,
705,
438,
3256,
6167,
28,
5162,
13,
32374,
23912,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
413,
5649,
28,
18,
11,
3124,
11639,
81,
11537,
198,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
5162,
13,
32374,
7890,
17,
58,
45299,
15,
4357,
915,
13,
32374,
7890,
17,
58,
45299,
16,
4357,
705,
438,
3256,
6167,
28,
5162,
13,
32374,
23912,
17,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
413,
5649,
28,
18,
11,
3124,
11639,
74,
11537,
198,
220,
220,
220,
458,
83,
13,
87,
18242,
10786,
24539,
21589,
25,
39280,
50033,
3,
685,
76,
60,
11537,
198,
220,
220,
220,
458,
83,
13,
2645,
9608,
10786,
45027,
25,
930,
3,
6852,
26591,
3,
91,
685,
38039,
60,
11537,
198,
220,
220,
220,
458,
83,
13,
87,
2475,
7,
16,
68,
12,
22,
11,
352,
68,
12,
18,
8,
198,
220,
220,
220,
458,
83,
13,
88,
2475,
7,
16,
68,
19,
11,
352,
68,
1415,
8,
198,
220,
220,
220,
458,
83,
13,
1455,
437,
3419,
198,
220,
220,
220,
458,
83,
13,
25928,
3419,
198,
220,
220,
220,
458,
83,
13,
12860,
3419,
628,
198,
220,
220,
220,
220,
198,
220,
220,
220,
329,
773,
287,
2837,
7,
45,
5589,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
2336,
17,
796,
458,
83,
13,
26875,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
7839,
7203,
4,
82,
4197,
329,
6455,
271,
20650,
25,
4064,
72,
1,
4064,
357,
11147,
62,
4906,
11,
773,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
2543,
17457,
292,
11,
45941,
13,
8937,
7,
26591,
62,
3258,
58,
45299,
15,
11,
521,
11,
7890,
62,
521,
46570,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
5589,
62,
4033,
669,
58,
521,
4357,
43979,
11639,
438,
3256,
6167,
11639,
3,
6852,
26591,
62,
87,
3,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
2543,
17457,
292,
11,
45941,
13,
8937,
7,
26591,
62,
3258,
58,
45299,
15,
11,
521,
11,
8056,
62,
521,
46570,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
5589,
62,
4033,
669,
58,
521,
4357,
43979,
11639,
438,
3256,
6167,
11639,
3,
59,
82,
13495,
23330,
6852,
26591,
62,
87,
92,
3,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
15,
13,
20,
8,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
2543,
17457,
292,
11,
45941,
13,
8937,
7,
26591,
62,
86,
58,
45299,
521,
46570,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
5589,
62,
4033,
669,
58,
521,
4357,
43979,
11639,
12,
3256,
300,
86,
28,
18,
11,
6167,
11639,
25844,
276,
1612,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
2543,
17457,
292,
11,
45941,
13,
8937,
7,
26591,
62,
3258,
58,
45299,
16,
11,
521,
11,
7890,
62,
521,
46570,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
5589,
62,
4033,
669,
58,
521,
4357,
43979,
11639,
12,
2637,
11,
6167,
11639,
3,
6852,
26591,
62,
88,
3,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
6404,
6404,
7,
2543,
17457,
292,
11,
45941,
13,
8937,
7,
26591,
62,
3258,
58,
45299,
16,
11,
521,
11,
8056,
62,
521,
46570,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
5589,
62,
4033,
669,
58,
521,
4357,
43979,
11639,
12,
2637,
11,
6167,
11639,
3,
59,
82,
13495,
23330,
6852,
26591,
62,
88,
92,
3,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
15,
13,
20,
8,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
87,
18242,
10786,
24539,
21589,
25,
39280,
50033,
3,
685,
76,
60,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
2645,
9608,
10786,
45027,
25,
930,
3,
6852,
26591,
3,
91,
685,
38039,
60,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
87,
2475,
7,
16,
68,
12,
21,
11,
352,
68,
12,
18,
8,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
88,
2475,
7,
16,
68,
21,
11,
352,
68,
1314,
8,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
1455,
437,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
25928,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
2336,
62,
7839,
796,
31051,
11195,
14,
10641,
829,
14,
489,
1747,
14,
6,
1343,
3128,
1343,
31051,
6,
1343,
3354,
58,
12,
16,
60,
1343,
31051,
6,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
3128,
1343,
705,
62,
6,
1343,
3354,
58,
12,
16,
60,
1343,
705,
62,
4,
82,
12,
11147,
62,
5589,
4,
72,
13,
11134,
6,
4064,
357,
11147,
62,
4906,
11,
773,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2336,
17,
13,
21928,
5647,
7,
5647,
62,
7839,
8,
198,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
19836,
7,
5647,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
489,
83,
13,
12860,
3419,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
1640,
2336,
62,
22510,
287,
685,
16,
11,
17,
11,
18,
5974,
198,
220,
220,
220,
1303,
220,
220,
220,
458,
83,
13,
26875,
7,
5647,
62,
22510,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
458,
83,
13,
87,
18242,
10786,
24539,
21589,
25,
39280,
50033,
3,
685,
76,
60,
11537,
198,
220,
220,
220,
1303,
220,
220,
220,
458,
83,
13,
2645,
9608,
10786,
45027,
25,
930,
3,
6852,
26591,
3,
91,
685,
38039,
60,
11537,
198,
220,
220,
220,
1303,
220,
220,
220,
458,
83,
13,
1455,
437,
3419,
198,
220,
220,
220,
1303,
220,
220,
220,
458,
83,
13,
25928,
3419,
198,
220,
220,
220,
1303,
489,
83,
13,
12860,
3419,
198
] | 1.836181 | 2,985 |
from ursina import *
# Test Cube
# Test button
# update is run every frame
# basic window
app = Ursina()
# basic cube
cube = Entity(model='quad', color=color.orange, scale = (2,5), position = (5,1))
# quad with texture
#sans_image = load_texture('Sans.png')
#sans = Entity(model = 'quad', texture = sans_image)
#sans = Entity(model = 'quad', texture = 'Sans.png')
# creating a block properly
test = Test_cube()
# creating a button
btn = Test_button()
punch_sound = Audio('assets/punch', loop=False, autoplay=False)
app.run()
| [
6738,
220,
1834,
1437,
1330,
1635,
198,
198,
2,
6208,
23315,
198,
198,
2,
6208,
4936,
628,
198,
2,
4296,
318,
1057,
790,
5739,
198,
198,
2,
4096,
4324,
198,
1324,
796,
37935,
1437,
3419,
198,
198,
2,
4096,
23441,
220,
198,
40296,
796,
20885,
7,
19849,
11639,
47003,
3256,
3124,
28,
8043,
13,
43745,
11,
5046,
796,
357,
17,
11,
20,
828,
2292,
796,
357,
20,
11,
16,
4008,
198,
198,
2,
15094,
351,
11743,
198,
2,
82,
504,
62,
9060,
796,
3440,
62,
41293,
10786,
50,
504,
13,
11134,
11537,
198,
2,
82,
504,
796,
20885,
7,
19849,
796,
705,
47003,
3256,
11743,
796,
38078,
62,
9060,
8,
198,
2,
82,
504,
796,
20885,
7,
19849,
796,
705,
47003,
3256,
11743,
796,
705,
50,
504,
13,
11134,
11537,
198,
198,
2,
4441,
257,
2512,
6105,
198,
9288,
796,
6208,
62,
40296,
3419,
198,
198,
2,
4441,
257,
4936,
198,
46118,
796,
6208,
62,
16539,
3419,
198,
79,
3316,
62,
23661,
796,
13491,
10786,
19668,
14,
79,
3316,
3256,
9052,
28,
25101,
11,
22320,
10724,
28,
25101,
8,
198,
198,
1324,
13,
5143,
3419,
198
] | 2.88172 | 186 |
import numpy as np
from copy import copy, deepcopy
from utils.rvs.utils import COMPARATOR_NEGATIONS
def parse_value(value):
''' Attempts to interpret <value> as a number. '''
if isinstance(value, str):
try:
value = int(value)
except ValueError:
value = float(value)
return value
| [
11748,
299,
32152,
355,
45941,
198,
6738,
4866,
1330,
4866,
11,
2769,
30073,
198,
6738,
3384,
4487,
13,
81,
14259,
13,
26791,
1330,
24301,
1503,
25633,
62,
45,
7156,
18421,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628,
198,
198,
4299,
21136,
62,
8367,
7,
8367,
2599,
198,
197,
7061,
6,
25770,
82,
284,
6179,
1279,
8367,
29,
355,
257,
1271,
13,
705,
7061,
198,
197,
361,
318,
39098,
7,
8367,
11,
965,
2599,
198,
197,
197,
28311,
25,
198,
197,
197,
197,
8367,
796,
493,
7,
8367,
8,
198,
197,
197,
16341,
11052,
12331,
25,
198,
197,
197,
197,
8367,
796,
12178,
7,
8367,
8,
198,
197,
7783,
1988,
628,
198
] | 2.74359 | 117 |
from django import forms
| [
6738,
42625,
14208,
1330,
5107,
628,
198
] | 3.857143 | 7 |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
# pylint: disable=invalid-name
"""
Sphinx documentation builder
"""
project = 'Qiskit AQT Provider'
copyright = '2021, Qiskit and AQT development teams' # pylint: disable=redefined-builtin
author = 'Qiskit and AQT development teams'
# The short X.Y version
version = '0.5.0'
# The full version, including alpha/beta/rc tags
release = '0.5.0'
extensions = [
'sphinx.ext.napoleon',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.extlinks',
'jupyter_sphinx',
]
templates_path = ["_templates"]
html_static_path = ['_static']
html_css_files = []
autosummary_generate = True
autosummary_generate_overwrite = False
autoclass_content = "both"
numfig = True
numfig_format = {
'table': 'Table %s'
}
language = None
exclude_patterns = ['_build', '**.ipynb_checkpoints']
pygments_style = 'colorful'
add_module_names = False
modindex_common_prefix = ['qiskit_aqt.']
html_theme = 'qiskit_sphinx_theme'
html_last_updated_fmt = '%Y/%m/%d'
html_theme_options = {
'logo_only': True,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': True,
}
| [
2,
770,
2438,
318,
636,
286,
1195,
1984,
270,
13,
198,
2,
198,
2,
357,
34,
8,
15069,
19764,
2864,
13,
198,
2,
198,
2,
770,
2438,
318,
11971,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
13,
921,
743,
198,
2,
7330,
257,
4866,
286,
428,
5964,
287,
262,
38559,
24290,
13,
14116,
2393,
287,
262,
6808,
8619,
198,
2,
286,
428,
2723,
5509,
393,
379,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
13,
198,
2,
198,
2,
4377,
19008,
393,
27255,
2499,
286,
428,
2438,
1276,
12377,
428,
198,
2,
6634,
4003,
11,
290,
9518,
3696,
761,
284,
3283,
257,
4003,
12739,
198,
2,
326,
484,
423,
587,
14294,
422,
262,
47324,
13,
198,
198,
2,
279,
2645,
600,
25,
15560,
28,
259,
12102,
12,
3672,
198,
37811,
198,
50,
746,
28413,
10314,
27098,
198,
37811,
628,
198,
16302,
796,
705,
48,
1984,
270,
39514,
51,
32549,
6,
198,
22163,
4766,
796,
705,
1238,
2481,
11,
1195,
1984,
270,
290,
39514,
51,
2478,
3466,
6,
220,
1303,
279,
2645,
600,
25,
15560,
28,
445,
18156,
12,
18780,
259,
198,
9800,
796,
705,
48,
1984,
270,
290,
39514,
51,
2478,
3466,
6,
198,
198,
2,
383,
1790,
1395,
13,
56,
2196,
198,
9641,
796,
705,
15,
13,
20,
13,
15,
6,
198,
2,
383,
1336,
2196,
11,
1390,
17130,
14,
31361,
14,
6015,
15940,
198,
20979,
796,
705,
15,
13,
20,
13,
15,
6,
198,
198,
2302,
5736,
796,
685,
198,
220,
220,
220,
705,
82,
746,
28413,
13,
2302,
13,
77,
499,
25637,
3256,
198,
220,
220,
220,
705,
82,
746,
28413,
13,
2302,
13,
2306,
375,
420,
3256,
198,
220,
220,
220,
705,
82,
746,
28413,
13,
2302,
13,
2306,
418,
388,
6874,
3256,
198,
220,
220,
220,
705,
82,
746,
28413,
13,
2302,
13,
11018,
73,
897,
3256,
198,
220,
220,
220,
705,
82,
746,
28413,
13,
2302,
13,
1177,
8189,
3256,
198,
220,
220,
220,
705,
82,
746,
28413,
13,
2302,
13,
2302,
28751,
3256,
198,
220,
220,
220,
705,
73,
929,
88,
353,
62,
82,
746,
28413,
3256,
198,
60,
198,
11498,
17041,
62,
6978,
796,
14631,
62,
11498,
17041,
8973,
198,
6494,
62,
12708,
62,
6978,
796,
37250,
62,
12708,
20520,
198,
6494,
62,
25471,
62,
16624,
796,
17635,
198,
198,
2306,
418,
388,
6874,
62,
8612,
378,
796,
6407,
198,
2306,
418,
388,
6874,
62,
8612,
378,
62,
2502,
13564,
796,
10352,
198,
2306,
420,
31172,
62,
11299,
796,
366,
16885,
1,
198,
198,
22510,
5647,
796,
6407,
198,
198,
22510,
5647,
62,
18982,
796,
1391,
198,
220,
220,
220,
705,
11487,
10354,
705,
10962,
4064,
82,
6,
198,
92,
198,
16129,
796,
6045,
198,
198,
1069,
9152,
62,
33279,
82,
796,
37250,
62,
11249,
3256,
705,
1174,
13,
541,
2047,
65,
62,
9122,
13033,
20520,
198,
198,
9078,
11726,
62,
7635,
796,
705,
8043,
913,
6,
198,
198,
2860,
62,
21412,
62,
14933,
796,
10352,
198,
198,
4666,
9630,
62,
11321,
62,
40290,
796,
37250,
80,
1984,
270,
62,
30188,
83,
2637,
60,
198,
198,
6494,
62,
43810,
796,
705,
80,
1984,
270,
62,
82,
746,
28413,
62,
43810,
6,
198,
6494,
62,
12957,
62,
43162,
62,
69,
16762,
796,
705,
4,
56,
14,
4,
76,
14,
4,
67,
6,
198,
6494,
62,
43810,
62,
25811,
796,
1391,
198,
220,
220,
220,
705,
6404,
78,
62,
8807,
10354,
6407,
11,
198,
220,
220,
220,
705,
13812,
62,
9641,
10354,
6407,
11,
198,
220,
220,
220,
705,
47050,
62,
19545,
62,
4360,
27288,
62,
24886,
10354,
705,
22487,
3256,
198,
220,
220,
220,
705,
7635,
62,
22615,
62,
28751,
10354,
6407,
11,
198,
92,
198
] | 2.697561 | 615 |
# Generated by Django 3.1.2 on 2021-09-20 13:36
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
17,
319,
33448,
12,
2931,
12,
1238,
1511,
25,
2623,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
#!/usr/bin/env python3
# Copyright <2019> <Chen Wang [https://chenwang.site], Carnegie Mellon University>
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
# 2. 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.
# 3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
import os
import cv2
import copy
import time
import math
import torch
import os.path
import argparse
import torchvision
import numpy as np
import torch.nn as nn
import torch.optim as optim
from torchvision import models
import torch.utils.data as Data
from torch.autograd import Variable
from torch.nn import functional as F
from torchvision.models.vgg import VGG
import torchvision.transforms as transforms
from torchvision.datasets import CocoDetection
from torch.optim.lr_scheduler import ReduceLROnPlateau
from interestingness import AE, VAE, AutoEncoder, Interestingness
from dataset import ImageData, Dronefilm, DroneFilming, SubT, SubTF, PersonalVideo
from torchutil import count_parameters, show_batch, show_batch_origin, Timer, MovAvg
from torchutil import ConvLoss, CosineLoss, CorrelationLoss, Split2d, Merge2d, PearsonLoss, FiveSplit2d
class Interest():
'''
Maintain top K interests
'''
if __name__ == "__main__":
# Arguements
parser = argparse.ArgumentParser(description='Test Interestingness Networks')
parser.add_argument("--data-root", type=str, default='/data/datasets', help="dataset root folder")
parser.add_argument("--model-save", type=str, default='saves/ae.pt.SubTF.n1000.mse', help="read model")
parser.add_argument("--test-data", type=int, default=2, help='test data ID.')
parser.add_argument("--seed", type=int, default=0, help='Random seed.')
parser.add_argument("--crop-size", type=int, default=320, help='crop size')
parser.add_argument("--num-interest", type=int, default=10, help='loss compute by grid')
parser.add_argument("--skip-frames", type=int, default=1, help='number of skip frame')
parser.add_argument("--window-size", type=int, default=1, help='smooth window size >=1')
parser.add_argument('--dataset', type=str, default='SubTF', help='dataset type (SubTF, DroneFilming')
parser.add_argument('--save-flag', type=str, default='n1000', help='save name flag')
parser.add_argument("--rr", type=float, default=5, help="reading rate")
parser.add_argument("--wr", type=float, default=5, help="writing rate")
parser.add_argument('--debug', dest='debug', action='store_true')
parser.add_argument('--drawbox', dest='drawbox', action='store_true')
parser.set_defaults(debug=False)
parser.set_defaults(drawbox=False)
args = parser.parse_args(); print(args)
torch.manual_seed(args.seed)
os.makedirs('results', exist_ok=True)
if args.debug is True and not os.path.exists('images/%s-%d'%(args.dataset,args.test_data)):
os.makedirs('images/%s-%d'%(args.dataset,args.test_data))
transform = transforms.Compose([
# transforms.CenterCrop(args.crop_size),
transforms.Resize((args.crop_size,args.crop_size)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
timer = Timer()
test_name = '%s-%d-%s-%s'%(args.dataset, args.test_data, time.strftime('%Y-%m-%d-%H:%M:%S'), args.save_flag)
if args.dataset == 'DroneFilming':
test_data = DroneFilming(root=args.data_root, train=False, test_data=args.test_data, transform=transform)
elif args.dataset == 'SubTF':
test_data = SubTF(root=args.data_root, train=False, test_data=args.test_data, transform=transform)
elif args.dataset == 'PersonalVideo':
test_data = PersonalVideo(root=args.data_root, train=False, test_data=args.test_data, transform=transform)
test_loader = Data.DataLoader(dataset=test_data, batch_size=1, shuffle=False)
net = torch.load(args.model_save)
net.set_train(False)
net.memory.set_learning_rate(rr=args.rr, wr=args.wr)
interest = Interest(args.num_interest, 'results/%s.txt'%(test_name))
movavg = MovAvg(args.window_size)
if torch.cuda.is_available():
net = net.cuda()
drawbox = ConvLoss(input_size=args.crop_size, kernel_size=args.crop_size//2, stride=args.crop_size//4)
criterion = CorrelationLoss(args.crop_size//2, reduce=False, accept_translation=False)
fivecrop = FiveSplit2d(args.crop_size//2)
print('number of parameters:', count_parameters(net))
val_loss = performance(test_loader, net)
print('Done.')
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
2,
15069,
1279,
23344,
29,
1279,
34,
831,
15233,
685,
5450,
1378,
6607,
47562,
13,
15654,
4357,
33976,
49808,
2059,
29,
198,
198,
2,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
17613,
11,
389,
220,
198,
2,
10431,
2810,
326,
262,
1708,
3403,
389,
1138,
25,
198,
198,
2,
352,
13,
2297,
396,
2455,
507,
286,
2723,
2438,
1276,
12377,
262,
2029,
6634,
4003,
11,
428,
1351,
286,
220,
198,
2,
3403,
290,
262,
1708,
37592,
13,
198,
198,
2,
362,
13,
2297,
396,
2455,
507,
287,
13934,
1296,
1276,
22919,
262,
2029,
6634,
4003,
11,
428,
1351,
220,
198,
2,
286,
3403,
290,
262,
1708,
37592,
287,
262,
10314,
290,
14,
273,
584,
5696,
220,
198,
2,
2810,
351,
262,
6082,
13,
198,
198,
2,
513,
13,
16126,
262,
1438,
286,
262,
6634,
15762,
4249,
262,
3891,
286,
663,
20420,
743,
307,
220,
198,
2,
973,
284,
11438,
393,
7719,
3186,
10944,
422,
428,
3788,
1231,
2176,
3161,
220,
198,
2,
3194,
7170,
13,
198,
198,
2,
12680,
47466,
3180,
36592,
2389,
1961,
11050,
3336,
27975,
38162,
9947,
367,
15173,
4877,
5357,
27342,
9865,
3843,
20673,
366,
1921,
3180,
1,
5357,
15529,
220,
198,
2,
7788,
32761,
6375,
8959,
49094,
34764,
11015,
11,
47783,
2751,
11,
21728,
5626,
40880,
5390,
11,
3336,
8959,
49094,
34764,
11015,
220,
198,
2,
3963,
34482,
3398,
1565,
5603,
25382,
5357,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
15986,
13954,
48778,
1961,
13,
3268,
8005,
49261,
220,
198,
2,
50163,
3336,
27975,
38162,
9947,
49707,
14418,
6375,
27342,
9865,
3843,
20673,
9348,
43031,
19146,
7473,
15529,
42242,
11,
3268,
17931,
23988,
11,
220,
198,
2,
19387,
25256,
1847,
11,
38846,
11,
7788,
3620,
6489,
13153,
11,
6375,
7102,
5188,
10917,
3525,
12576,
29506,
25552,
357,
1268,
39149,
2751,
11,
21728,
5626,
40880,
220,
198,
2,
5390,
11,
41755,
11335,
10979,
3963,
28932,
2257,
2043,
37780,
21090,
50,
6375,
49254,
26,
406,
18420,
3963,
23210,
11,
42865,
11,
6375,
4810,
19238,
29722,
26,
220,
198,
2,
6375,
43949,
44180,
23255,
49,
8577,
24131,
8,
29630,
36,
5959,
7257,
2937,
1961,
5357,
6177,
15529,
3336,
15513,
3963,
43031,
25382,
11,
7655,
2767,
16879,
3268,
220,
198,
2,
27342,
10659,
11,
19269,
18379,
43031,
25382,
11,
6375,
309,
9863,
357,
1268,
39149,
2751,
399,
7156,
43,
3528,
18310,
6375,
25401,
54,
24352,
8,
5923,
1797,
2751,
3268,
220,
198,
2,
15529,
34882,
16289,
3963,
3336,
23210,
3963,
12680,
47466,
11,
45886,
16876,
5984,
29817,
1961,
3963,
3336,
28069,
11584,
25382,
3963,
13558,
3398,
220,
198,
2,
29506,
11879,
13,
198,
198,
11748,
28686,
198,
11748,
269,
85,
17,
198,
11748,
4866,
198,
11748,
640,
198,
11748,
10688,
198,
11748,
28034,
198,
11748,
28686,
13,
6978,
198,
11748,
1822,
29572,
198,
11748,
28034,
10178,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
13,
20471,
355,
299,
77,
198,
11748,
28034,
13,
40085,
355,
6436,
198,
6738,
28034,
10178,
1330,
4981,
198,
11748,
28034,
13,
26791,
13,
7890,
355,
6060,
198,
6738,
28034,
13,
2306,
519,
6335,
1330,
35748,
198,
6738,
28034,
13,
20471,
1330,
10345,
355,
376,
198,
6738,
28034,
10178,
13,
27530,
13,
85,
1130,
1330,
569,
11190,
198,
11748,
28034,
10178,
13,
7645,
23914,
355,
31408,
198,
6738,
28034,
10178,
13,
19608,
292,
1039,
1330,
48222,
11242,
3213,
198,
6738,
28034,
13,
40085,
13,
14050,
62,
1416,
704,
18173,
1330,
44048,
35972,
2202,
3646,
378,
559,
198,
198,
6738,
3499,
1108,
1330,
25603,
11,
13753,
36,
11,
11160,
27195,
12342,
11,
43580,
1108,
198,
6738,
27039,
1330,
7412,
6601,
11,
38959,
26240,
11,
38959,
11928,
2229,
11,
3834,
51,
11,
3834,
10234,
11,
15644,
10798,
198,
6738,
28034,
22602,
1330,
954,
62,
17143,
7307,
11,
905,
62,
43501,
11,
905,
62,
43501,
62,
47103,
11,
5045,
263,
11,
44795,
48997,
198,
6738,
28034,
22602,
1330,
34872,
43,
793,
11,
10437,
500,
43,
793,
11,
2744,
49501,
43,
793,
11,
27758,
17,
67,
11,
39407,
17,
67,
11,
31074,
43,
793,
11,
10579,
41205,
17,
67,
198,
198,
4871,
12033,
33529,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
337,
32725,
1353,
509,
5353,
198,
220,
220,
220,
705,
7061,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1303,
943,
5162,
3196,
198,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
11639,
14402,
43580,
1108,
27862,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
7890,
12,
15763,
1600,
2099,
28,
2536,
11,
4277,
11639,
14,
7890,
14,
19608,
292,
1039,
3256,
1037,
2625,
19608,
292,
316,
6808,
9483,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
19849,
12,
21928,
1600,
2099,
28,
2536,
11,
4277,
11639,
82,
3080,
14,
3609,
13,
457,
13,
7004,
10234,
13,
77,
12825,
13,
76,
325,
3256,
1037,
2625,
961,
2746,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
9288,
12,
7890,
1600,
2099,
28,
600,
11,
4277,
28,
17,
11,
1037,
11639,
9288,
1366,
4522,
2637,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
28826,
1600,
2099,
28,
600,
11,
4277,
28,
15,
11,
1037,
11639,
29531,
9403,
2637,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
31476,
12,
7857,
1600,
2099,
28,
600,
11,
4277,
28,
19504,
11,
1037,
11639,
31476,
2546,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
22510,
12,
9446,
1600,
2099,
28,
600,
11,
4277,
28,
940,
11,
1037,
11639,
22462,
24061,
416,
10706,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
48267,
12,
37805,
1600,
2099,
28,
600,
11,
4277,
28,
16,
11,
1037,
11639,
17618,
286,
14267,
5739,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
17497,
12,
7857,
1600,
2099,
28,
600,
11,
4277,
28,
16,
11,
1037,
11639,
5796,
5226,
4324,
2546,
18189,
16,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
19608,
292,
316,
3256,
2099,
28,
2536,
11,
4277,
11639,
7004,
10234,
3256,
1037,
11639,
19608,
292,
316,
2099,
357,
7004,
10234,
11,
38959,
11928,
2229,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
21928,
12,
32109,
3256,
2099,
28,
2536,
11,
4277,
11639,
77,
12825,
3256,
1037,
11639,
21928,
1438,
6056,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
21062,
1600,
2099,
28,
22468,
11,
4277,
28,
20,
11,
1037,
2625,
25782,
2494,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
18351,
1600,
2099,
28,
22468,
11,
4277,
28,
20,
11,
1037,
2625,
16502,
2494,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
24442,
3256,
2244,
11639,
24442,
3256,
2223,
11639,
8095,
62,
7942,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
19334,
3524,
3256,
2244,
11639,
19334,
3524,
3256,
2223,
11639,
8095,
62,
7942,
11537,
198,
220,
220,
220,
30751,
13,
2617,
62,
12286,
82,
7,
24442,
28,
25101,
8,
198,
220,
220,
220,
30751,
13,
2617,
62,
12286,
82,
7,
19334,
3524,
28,
25101,
8,
198,
220,
220,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
9783,
3601,
7,
22046,
8,
198,
220,
220,
220,
28034,
13,
805,
723,
62,
28826,
7,
22046,
13,
28826,
8,
628,
220,
220,
220,
28686,
13,
76,
4335,
17062,
10786,
43420,
3256,
2152,
62,
482,
28,
17821,
8,
628,
220,
220,
220,
611,
26498,
13,
24442,
318,
6407,
290,
407,
28686,
13,
6978,
13,
1069,
1023,
10786,
17566,
14,
4,
82,
12,
4,
67,
6,
4,
7,
22046,
13,
19608,
292,
316,
11,
22046,
13,
9288,
62,
7890,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
10786,
17566,
14,
4,
82,
12,
4,
67,
6,
4,
7,
22046,
13,
19608,
292,
316,
11,
22046,
13,
9288,
62,
7890,
4008,
628,
220,
220,
220,
6121,
796,
31408,
13,
7293,
577,
26933,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
31408,
13,
23656,
34,
1773,
7,
22046,
13,
31476,
62,
7857,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
4965,
1096,
19510,
22046,
13,
31476,
62,
7857,
11,
22046,
13,
31476,
62,
7857,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
2514,
51,
22854,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
26447,
1096,
7,
32604,
41888,
15,
13,
32642,
11,
657,
13,
29228,
11,
657,
13,
29703,
4357,
14367,
41888,
15,
13,
23539,
11,
657,
13,
24137,
11,
657,
13,
18182,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33761,
628,
220,
220,
220,
19781,
796,
5045,
263,
3419,
198,
220,
220,
220,
1332,
62,
3672,
796,
705,
4,
82,
12,
4,
67,
12,
4,
82,
12,
4,
82,
6,
4,
7,
22046,
13,
19608,
292,
316,
11,
26498,
13,
9288,
62,
7890,
11,
640,
13,
2536,
31387,
10786,
4,
56,
12,
4,
76,
12,
4,
67,
12,
4,
39,
25,
4,
44,
25,
4,
50,
33809,
26498,
13,
21928,
62,
32109,
8,
628,
220,
220,
220,
611,
26498,
13,
19608,
292,
316,
6624,
705,
6187,
505,
11928,
2229,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7890,
796,
38959,
11928,
2229,
7,
15763,
28,
22046,
13,
7890,
62,
15763,
11,
4512,
28,
25101,
11,
1332,
62,
7890,
28,
22046,
13,
9288,
62,
7890,
11,
6121,
28,
35636,
8,
198,
220,
220,
220,
1288,
361,
26498,
13,
19608,
292,
316,
6624,
705,
7004,
10234,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7890,
796,
3834,
10234,
7,
15763,
28,
22046,
13,
7890,
62,
15763,
11,
4512,
28,
25101,
11,
1332,
62,
7890,
28,
22046,
13,
9288,
62,
7890,
11,
6121,
28,
35636,
8,
198,
220,
220,
220,
1288,
361,
26498,
13,
19608,
292,
316,
6624,
705,
30228,
10798,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7890,
796,
15644,
10798,
7,
15763,
28,
22046,
13,
7890,
62,
15763,
11,
4512,
28,
25101,
11,
1332,
62,
7890,
28,
22046,
13,
9288,
62,
7890,
11,
6121,
28,
35636,
8,
628,
220,
220,
220,
1332,
62,
29356,
796,
6060,
13,
6601,
17401,
7,
19608,
292,
316,
28,
9288,
62,
7890,
11,
15458,
62,
7857,
28,
16,
11,
36273,
28,
25101,
8,
628,
220,
220,
220,
2010,
796,
28034,
13,
2220,
7,
22046,
13,
19849,
62,
21928,
8,
198,
220,
220,
220,
2010,
13,
2617,
62,
27432,
7,
25101,
8,
198,
220,
220,
220,
2010,
13,
31673,
13,
2617,
62,
40684,
62,
4873,
7,
21062,
28,
22046,
13,
21062,
11,
1319,
28,
22046,
13,
18351,
8,
628,
220,
220,
220,
1393,
796,
12033,
7,
22046,
13,
22510,
62,
9446,
11,
705,
43420,
14,
4,
82,
13,
14116,
6,
4,
7,
9288,
62,
3672,
4008,
198,
220,
220,
220,
1409,
615,
70,
796,
44795,
48997,
7,
22046,
13,
17497,
62,
7857,
8,
198,
220,
220,
220,
611,
28034,
13,
66,
15339,
13,
271,
62,
15182,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
2010,
796,
2010,
13,
66,
15339,
3419,
628,
220,
220,
220,
3197,
3524,
796,
34872,
43,
793,
7,
15414,
62,
7857,
28,
22046,
13,
31476,
62,
7857,
11,
9720,
62,
7857,
28,
22046,
13,
31476,
62,
7857,
1003,
17,
11,
33769,
28,
22046,
13,
31476,
62,
7857,
1003,
19,
8,
198,
220,
220,
220,
34054,
796,
2744,
49501,
43,
793,
7,
22046,
13,
31476,
62,
7857,
1003,
17,
11,
4646,
28,
25101,
11,
2453,
62,
41519,
28,
25101,
8,
198,
220,
220,
220,
1936,
31476,
796,
10579,
41205,
17,
67,
7,
22046,
13,
31476,
62,
7857,
1003,
17,
8,
628,
220,
220,
220,
3601,
10786,
17618,
286,
10007,
25,
3256,
954,
62,
17143,
7307,
7,
3262,
4008,
198,
220,
220,
220,
1188,
62,
22462,
796,
2854,
7,
9288,
62,
29356,
11,
2010,
8,
198,
220,
220,
220,
3601,
10786,
45677,
2637,
8,
198
] | 2.901542 | 2,011 |
from .features import FeatureBinarizer, FeatureBinarizerFromTrees
from .linear_regression import LinearRuleRegression
from .logistic_regression import LogisticRuleRegression
from .boolean_rule_cg import BooleanRuleCG
from .GLRM import GLRMExplainer
from .BRCG import BRCGExplainer
| [
6738,
764,
40890,
1330,
27018,
33,
22050,
7509,
11,
27018,
33,
22050,
7509,
4863,
51,
6037,
198,
6738,
764,
29127,
62,
2301,
2234,
1330,
44800,
31929,
8081,
2234,
198,
6738,
764,
6404,
2569,
62,
2301,
2234,
1330,
5972,
2569,
31929,
8081,
2234,
198,
6738,
764,
2127,
21052,
62,
25135,
62,
66,
70,
1330,
41146,
31929,
39816,
198,
6738,
764,
8763,
29138,
1330,
10188,
29138,
18438,
10613,
198,
6738,
764,
33,
7397,
38,
1330,
347,
7397,
38,
18438,
10613,
198
] | 3.556962 | 79 |
import tkinter
import time
from . import render
| [
11748,
256,
74,
3849,
198,
11748,
640,
198,
6738,
764,
1330,
8543,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
628,
198
] | 1.685185 | 54 |
from numpy import array
import os
import inspect
import matplotlib.pyplot as plt
def plot_learning_curve(title, computed_score, train_sizes, \
train_scores_mean, train_scores_std, test_scores_mean, \
test_scores_std):
"""Generate a plot of the test and training learning curves.
Parameters
----------
title: string
Contains the title of the chart.
computed_score: string
Contains the name of the computed score.
train_sizes: a one dimension numpy.ndarray
An array containing the various sizes of the training set for
which the scores have been computed.
train_scores_mean: a one dimension numpy.ndarray
An array containing the various means of the scores related
to each element in train_sizes. These scores should have been
computed on the training set.
train_scores_std: a one dimension numpy.ndarray
An array containing the various standard deviations of the
scores related to each element in train_sizes. These scores
should have been computed on the training set.
test_scores_mean: a one dimension numpy.ndarray
An array containing the various means of the scores related
to each element in train_sizes. These scores should have been
computed on the test set.
test_scores_std: a one dimension numpy.ndarray
An array containing the various standard deviations of the
scores related to each element in train_sizes. These scores
should have been computed on the test set.
ylim: tuple, shape (ymin, ymax), optional
Defines minimum and maximum yvalues plotted.
"""
fig = plt.figure(figsize=(20.0, 12.5))
plt.title(title, size=31)
plt.xlim(xmin=0, xmax=25000)
plt.ylim(ymin=0.0, ymax=1.0)
plt.xlabel("Training examples", size=28)
plt.ylabel(computed_score.capitalize(), size=28)
plt.grid(linewidth=3)
plt.fill_between(train_sizes, train_scores_mean - \
train_scores_std, train_scores_mean + train_scores_std, \
alpha=0.3, color="r")
plt.fill_between(train_sizes, test_scores_mean - \
test_scores_std, test_scores_mean + test_scores_std, \
alpha=0.3, color="g")
plt.plot(train_sizes, train_scores_mean, 'o-', color="r", \
label="Training {}".format(computed_score), \
linewidth=5.0, markersize=13.0)
plt.plot(train_sizes, test_scores_mean, 'o-', color="g", \
label="Test {}".format(computed_score), \
linewidth=5.0, markersize=13.0)
plt.legend(loc="best", prop={'size': 26})
plt.tick_params(axis='both', which='major', labelsize=22)
return fig
if __name__ == "__main__":
main() | [
6738,
299,
32152,
1330,
7177,
198,
11748,
28686,
198,
11748,
10104,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
628,
198,
4299,
7110,
62,
40684,
62,
22019,
303,
7,
7839,
11,
29231,
62,
26675,
11,
4512,
62,
82,
4340,
11,
3467,
198,
220,
220,
220,
4512,
62,
1416,
2850,
62,
32604,
11,
4512,
62,
1416,
2850,
62,
19282,
11,
1332,
62,
1416,
2850,
62,
32604,
11,
3467,
198,
220,
220,
220,
1332,
62,
1416,
2850,
62,
19282,
2599,
198,
220,
220,
220,
37227,
8645,
378,
257,
7110,
286,
262,
1332,
290,
3047,
4673,
23759,
13,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
3670,
25,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
49850,
262,
3670,
286,
262,
8262,
13,
628,
220,
220,
220,
29231,
62,
26675,
25,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
49850,
262,
1438,
286,
262,
29231,
4776,
13,
628,
220,
220,
220,
4512,
62,
82,
4340,
25,
257,
530,
15793,
299,
32152,
13,
358,
18747,
198,
220,
220,
220,
220,
220,
220,
220,
1052,
7177,
7268,
262,
2972,
10620,
286,
262,
3047,
900,
329,
220,
198,
220,
220,
220,
220,
220,
220,
220,
543,
262,
8198,
423,
587,
29231,
13,
628,
220,
220,
220,
4512,
62,
1416,
2850,
62,
32604,
25,
257,
530,
15793,
299,
32152,
13,
358,
18747,
198,
220,
220,
220,
220,
220,
220,
220,
1052,
7177,
7268,
262,
2972,
1724,
286,
262,
8198,
3519,
220,
198,
220,
220,
220,
220,
220,
220,
220,
284,
1123,
5002,
287,
4512,
62,
82,
4340,
13,
2312,
8198,
815,
423,
587,
220,
198,
220,
220,
220,
220,
220,
220,
220,
29231,
319,
262,
3047,
900,
13,
628,
220,
220,
220,
4512,
62,
1416,
2850,
62,
19282,
25,
257,
530,
15793,
299,
32152,
13,
358,
18747,
198,
220,
220,
220,
220,
220,
220,
220,
1052,
7177,
7268,
262,
2972,
3210,
47060,
286,
262,
220,
198,
220,
220,
220,
220,
220,
220,
220,
8198,
3519,
284,
1123,
5002,
287,
4512,
62,
82,
4340,
13,
2312,
8198,
220,
198,
220,
220,
220,
220,
220,
220,
220,
815,
423,
587,
29231,
319,
262,
3047,
900,
13,
628,
220,
220,
220,
1332,
62,
1416,
2850,
62,
32604,
25,
257,
530,
15793,
299,
32152,
13,
358,
18747,
198,
220,
220,
220,
220,
220,
220,
220,
1052,
7177,
7268,
262,
2972,
1724,
286,
262,
8198,
3519,
220,
198,
220,
220,
220,
220,
220,
220,
220,
284,
1123,
5002,
287,
4512,
62,
82,
4340,
13,
2312,
8198,
815,
423,
587,
220,
198,
220,
220,
220,
220,
220,
220,
220,
29231,
319,
262,
1332,
900,
13,
628,
220,
220,
220,
1332,
62,
1416,
2850,
62,
19282,
25,
257,
530,
15793,
299,
32152,
13,
358,
18747,
198,
220,
220,
220,
220,
220,
220,
220,
1052,
7177,
7268,
262,
2972,
3210,
47060,
286,
262,
220,
198,
220,
220,
220,
220,
220,
220,
220,
8198,
3519,
284,
1123,
5002,
287,
4512,
62,
82,
4340,
13,
2312,
8198,
220,
198,
220,
220,
220,
220,
220,
220,
220,
815,
423,
587,
29231,
319,
262,
1332,
900,
13,
628,
220,
220,
220,
331,
2475,
25,
46545,
11,
5485,
357,
88,
1084,
11,
331,
9806,
828,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
2896,
1127,
5288,
290,
5415,
331,
27160,
37515,
13,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
2336,
796,
458,
83,
13,
26875,
7,
5647,
7857,
16193,
1238,
13,
15,
11,
1105,
13,
20,
4008,
198,
220,
220,
220,
458,
83,
13,
7839,
7,
7839,
11,
2546,
28,
3132,
8,
198,
220,
220,
220,
458,
83,
13,
87,
2475,
7,
87,
1084,
28,
15,
11,
2124,
9806,
28,
1495,
830,
8,
198,
220,
220,
220,
458,
83,
13,
88,
2475,
7,
88,
1084,
28,
15,
13,
15,
11,
331,
9806,
28,
16,
13,
15,
8,
198,
220,
220,
220,
458,
83,
13,
87,
18242,
7203,
44357,
6096,
1600,
2546,
28,
2078,
8,
198,
220,
220,
220,
458,
83,
13,
2645,
9608,
7,
785,
17128,
62,
26675,
13,
27544,
1096,
22784,
2546,
28,
2078,
8,
198,
220,
220,
220,
458,
83,
13,
25928,
7,
2815,
413,
5649,
28,
18,
8,
628,
220,
220,
220,
458,
83,
13,
20797,
62,
23395,
7,
27432,
62,
82,
4340,
11,
4512,
62,
1416,
2850,
62,
32604,
532,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
1416,
2850,
62,
19282,
11,
4512,
62,
1416,
2850,
62,
32604,
1343,
4512,
62,
1416,
2850,
62,
19282,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
15,
13,
18,
11,
3124,
2625,
81,
4943,
198,
220,
220,
220,
458,
83,
13,
20797,
62,
23395,
7,
27432,
62,
82,
4340,
11,
1332,
62,
1416,
2850,
62,
32604,
532,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
1416,
2850,
62,
19282,
11,
1332,
62,
1416,
2850,
62,
32604,
1343,
1332,
62,
1416,
2850,
62,
19282,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
15,
13,
18,
11,
3124,
2625,
70,
4943,
198,
220,
220,
220,
458,
83,
13,
29487,
7,
27432,
62,
82,
4340,
11,
4512,
62,
1416,
2850,
62,
32604,
11,
705,
78,
12,
3256,
3124,
2625,
81,
1600,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6167,
2625,
44357,
23884,
1911,
18982,
7,
785,
17128,
62,
26675,
828,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
413,
5649,
28,
20,
13,
15,
11,
19736,
1096,
28,
1485,
13,
15,
8,
198,
220,
220,
220,
458,
83,
13,
29487,
7,
27432,
62,
82,
4340,
11,
1332,
62,
1416,
2850,
62,
32604,
11,
705,
78,
12,
3256,
3124,
2625,
70,
1600,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6167,
2625,
14402,
23884,
1911,
18982,
7,
785,
17128,
62,
26675,
828,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
413,
5649,
28,
20,
13,
15,
11,
19736,
1096,
28,
1485,
13,
15,
8,
198,
220,
220,
220,
458,
83,
13,
1455,
437,
7,
17946,
2625,
13466,
1600,
2632,
34758,
6,
7857,
10354,
2608,
30072,
198,
220,
220,
220,
458,
83,
13,
42298,
62,
37266,
7,
22704,
11639,
16885,
3256,
543,
11639,
22478,
3256,
14722,
1096,
28,
1828,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
2336,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419
] | 2.565789 | 1,064 |
from .args import get_args
from .config import get_config, get_connection_config, get_engine, get_meta
from .query import query
from .export import get_exporter
def main():
"""
Provides a CLI entrypoint to access a database and export a subset of its
data in a specified format.
"""
args = get_args()
config = get_config(args.config)
connection_config = get_connection_config(config, args.connection)
engine = get_engine(connection_config)
export = get_exporter(args.format, config['exporters'])
connection = engine.connect()
meta = get_meta(engine)
resolver = connection_config['resolver']
data = query(connection, meta, resolver, args.query)
export(meta, data, args.output)
| [
6738,
764,
22046,
1330,
651,
62,
22046,
198,
6738,
764,
11250,
1330,
651,
62,
11250,
11,
651,
62,
38659,
62,
11250,
11,
651,
62,
18392,
11,
651,
62,
28961,
198,
6738,
764,
22766,
1330,
12405,
198,
6738,
764,
39344,
1330,
651,
62,
1069,
26634,
198,
198,
4299,
1388,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
47081,
257,
43749,
5726,
4122,
284,
1895,
257,
6831,
290,
10784,
257,
24637,
286,
663,
198,
220,
220,
220,
1366,
287,
257,
7368,
5794,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
26498,
796,
651,
62,
22046,
3419,
198,
220,
220,
220,
4566,
796,
651,
62,
11250,
7,
22046,
13,
11250,
8,
198,
220,
220,
220,
4637,
62,
11250,
796,
651,
62,
38659,
62,
11250,
7,
11250,
11,
26498,
13,
38659,
8,
198,
220,
220,
220,
3113,
796,
651,
62,
18392,
7,
38659,
62,
11250,
8,
198,
220,
220,
220,
10784,
796,
651,
62,
1069,
26634,
7,
22046,
13,
18982,
11,
4566,
17816,
1069,
1819,
1010,
6,
12962,
628,
220,
220,
220,
4637,
796,
3113,
13,
8443,
3419,
198,
220,
220,
220,
13634,
796,
651,
62,
28961,
7,
18392,
8,
198,
220,
220,
220,
581,
14375,
796,
4637,
62,
11250,
17816,
411,
14375,
20520,
198,
220,
220,
220,
1366,
796,
12405,
7,
38659,
11,
13634,
11,
581,
14375,
11,
26498,
13,
22766,
8,
198,
220,
220,
220,
10784,
7,
28961,
11,
1366,
11,
26498,
13,
22915,
8,
198
] | 3.088235 | 238 |
"""Circles URLs"""
# Django
from django.urls import path
# Views
from cride.circles.views import list_circles
from cride.circles.views import create_circle
urlpatterns = [
path ('circles/', list_circles),
path ('circles/create/', create_circle),
] | [
37811,
34,
343,
5427,
32336,
37811,
198,
198,
2,
37770,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
2,
29978,
198,
6738,
1067,
485,
13,
66,
343,
5427,
13,
33571,
1330,
1351,
62,
66,
343,
5427,
198,
6738,
1067,
485,
13,
66,
343,
5427,
13,
33571,
1330,
2251,
62,
45597,
198,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
19203,
66,
343,
5427,
14,
3256,
1351,
62,
66,
343,
5427,
828,
198,
220,
220,
220,
3108,
19203,
66,
343,
5427,
14,
17953,
14,
3256,
2251,
62,
45597,
828,
198,
60
] | 2.6875 | 96 |
__version__ = '1.5.4'
__copyright__ = 'Copyright (c) 2018, Skioo SA'
__licence__ = 'MIT'
__URL__ = 'https://github.com/skioo/django-customer-billing'
| [
834,
9641,
834,
796,
705,
16,
13,
20,
13,
19,
6,
198,
834,
22163,
4766,
834,
796,
705,
15269,
357,
66,
8,
2864,
11,
3661,
952,
78,
14719,
6,
198,
834,
677,
594,
834,
796,
705,
36393,
6,
198,
834,
21886,
834,
796,
705,
5450,
1378,
12567,
13,
785,
14,
8135,
952,
78,
14,
28241,
14208,
12,
23144,
263,
12,
65,
4509,
6,
198
] | 2.34375 | 64 |
# Copyright (c) 2013, Nathan Dunsworth - 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__ = [
'SgFieldCheckbox',
'SgFieldColor',
'SgFieldColor2',
'SgFieldDate',
'SgFieldDateTime',
'SgFieldEntity',
'SgFieldEntityMulti',
'SgFieldFloat',
'SgFieldID',
'SgFieldImage',
'SgFieldInt',
'SgFieldSelectionList',
'SgFieldTagList',
'SgFieldText',
'SgFieldType',
'SgFieldUrl'
]
# Python imports
import copy
import datetime
import os
import re
import threading
import urllib2
import webbrowser
# This module imports
import ShotgunORM
class SgFieldCheckbox(ShotgunORM.SgField):
'''
Entity field that stores a bool value for a checkbox.
'''
class SgFieldColor(ShotgunORM.SgField):
'''
Entity field that stores a list of 3 ints that represent a rgb color 0-255.
Example: [128, 128, 128]
'''
REGEXP_COLOR = re.compile(r'(\d+,\d+,\d+)')
class SgFieldColor2(ShotgunORM.SgField):
'''
Entity field that stores a list of 3 ints that represent a rgb color 0-255.
Fix the color return value for Task and Phase Entities color field.
Task and Phase Entities can have their color field set to a value that points
to the color field of the pipeline step or project they belong to.
Brilliant engineering to still call the return type "color" and not
differentiate the two I know right?
'''
REGEXP_COLOR = re.compile(r'(\d+,\d+,\d+)')
REGEXP_TASK_COLOR = re.compile(r'(\d+,\d+,\d+)|(pipeline_step)')
REGEXP_PHASE_COLOR = re.compile(r'(\d+,\d+,\d+)|(project)')
def linkField(self):
'''
Returns the link field this color field can possibly link to.
'''
return self._linkField
def parentChanged(self):
'''
'''
parent = self.parentEntity()
if parent == None:
return
pType = parent.schemaInfo().name()
if pType == 'Task':
self._regexp = self.REGEXP_TASK_COLOR
self._linkString = 'pipeline_step'
self._linkField = 'step'
elif pType == 'Phase':
self._regexp = self.REGEXP_PHASE_COLOR
self._linkString = 'project'
self._linkField= 'project'
else:
self._regexp = self.REGEXP_COLOR
def value(self, linkEvaluate=True):
'''
Args:
* (bool) linkEvaluate:
When True and the color field is a link to another Entity's color field
the value of the linked color field will be returned.
If linkEvaluate is False a string may be returned instead of a list.
'''
result = super(SgFieldColor2, self).value()
if result == None:
return None
if not linkEvaluate and result == self._linkString:
return result
parent = self.parentEntity()
if parent == None:
if result == self._linkString:
return None
newResult = []
for i in result.split(','):
newResult.append(int(i))
if result == self._linkString:
linkObj = self.parentEntity()[self._linkField]
if linkObj == None:
return None
return linkObj['color']
else:
newResult = []
for i in result.split(','):
newResult.append(int(i))
class SgFieldDate(ShotgunORM.SgField):
'''
Entity field that stores a date string
Example: "1980-01-30".
'''
REGEXP = re.compile(r'^\d{4}-\d{2}-\d{2}')
class SgFieldDateTime(ShotgunORM.SgField):
'''
Entity field that stores a python datetime object.
'''
class SgFieldEntity(ShotgunORM.SgField):
'''
Entity field that stores a link to another Entity.
'''
##############################################################################
#
# IMPORTANT!!!!
#
# Any changes to _fromFieldData, _setValue, _toFieldData, value functions
# should also be applied to the SgUserFieldAbstractEntity class.
#
##############################################################################
def value(self, sgSyncFields=None):
'''
Returns the fields value as a Entity object.
Args:
* (list) sgSyncFields:
List of field names to populate the returned Entity with.
'''
value = super(SgFieldEntity, self).value()
parent = self.parentEntity()
if value == None or parent == None:
return None
connection = parent.connection()
if isinstance(sgSyncFields, dict):
sgSyncFields = sgSyncFields.get(parent.type, None)
elif isinstance(sgSyncFields, str):
sgSyncFields = [sgSyncFields]
if sgSyncFields == None:
sgSyncFields = connection.defaultEntityQueryFields(value['type'])
if len(sgSyncFields) <= 0:
sgSyncFields = None
else:
pullFields = set(sgSyncFields)
extraFields = []
if 'all' in pullFields:
pullFields.remove('all')
extraFields = parent.fieldNames()
if 'default' in pullFields:
pullFields.remove('default')
elif 'default' in pullFields:
pullFields.remove('default')
extraFields = connection.defaultEntityQueryFields(value['type'])
pullFields.update(extraFields)
if len(pullFields) >= 1:
sgSyncFields = list(pullFields)
else:
sgSyncFields = None
result = connection._createEntity(
value['type'],
value,
sgSyncFields=sgSyncFields
)
return result
class SgFieldEntityMulti(ShotgunORM.SgField):
'''
Entity field that stores a list of links to other Entities.
Example: [Entity01, Entity02, ...]
'''
##############################################################################
#
# IMPORTANT!!!!
#
# Any changes to _fromFieldData, _setValue, _toFieldData, value functions
# should also be applied to the SgUserFieldAbstractMultiEntity class.
#
##############################################################################
def value(self, sgSyncFields=None):
'''
Returns the fields value as a list of Entity objects.
Args:
* (dict) sgSyncFields:
Dict of entity types and field names to populate the returned Entities
with.
'''
result = super(SgFieldEntityMulti, self).value()
if result in [None, []]:
return result
parent = self.parentEntity()
if parent == None:
return copy.deepcopy(result)
connection = parent.connection()
schema = connection.schema()
tmp = []
qEng = connection.queryEngine()
qEng.block()
try:
for i in result:
t = i['type']
iSyncFields = None
if sgSyncFields != None:
if sgSyncFields.has_key(t):
iFields = sgSyncFields[t]
if iFields == None:
iSyncFields = connection.defaultEntityQueryFields(t)
if len(iSyncFields) <= 0:
iSyncFields = None
else:
pullFields = []
if isinstance(iFields, str):
pullFields = set([iFields])
else:
pullFields = set(iFields)
extraFields = []
if 'all' in pullFields:
pullFields.remove('all')
extraFields = schema.entityInfo(t).fieldNames()
if 'default' in pullFields:
pullFields.remove('default')
elif 'default' in pullFields:
pullFields.remove('default')
extraFields = connection.defaultEntityQueryFields(t)
pullFields.update(extraFields)
if len(pullFields) >= 1:
iSyncFields = list(pullFields)
else:
iSyncFields = None
else:
iSyncFields = connection.defaultEntityQueryFields(t)
if len(iSyncFields) <= 0:
iSyncFields = None
else:
iSyncFields = connection.defaultEntityQueryFields(t)
entity = connection._createEntity(t, i, sgSyncFields=iSyncFields)
tmp.append(entity)
finally:
qEng.unblock()
return tmp
class SgFieldFloat(ShotgunORM.SgField):
'''
Entity field that stores a float.
'''
class SgFieldInt(ShotgunORM.SgField):
'''
Entity field that stores an integer.
'''
class SgFieldSelectionList(ShotgunORM.SgField):
'''
Entity field that stores a text string that is from a list selection.
The field may contain a list of valid values which when the field is set are
compared and an Exception thrown when the value is not a valid one.
'''
class SgFieldSerializable(ShotgunORM.SgField):
'''
Entity field that stores serializable data.
'''
class SgFieldSummary(ShotgunORM.SgField):
'''
Entity field that returns an Entity or list of Entities based on a search
expression.
Summary fields.
'''
DATE_REGEXP = re.compile(r'(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) UTC')
def _buildLogicalOp(self, conditions, info):
'''
Builds the logical operator search pattern and returns it.
'''
result = []
parent = self.parentEntity()
connection = parent.connection()
for c in conditions:
if c.has_key('logical_operator'):
logicalOp = {
'conditions': self._buildLogicalOp(c['conditions'], info),
'logical_operator': c['logical_operator']
}
result.append(logicalOp)
else:
newValues = []
cInfo = info.fieldInfo(c['path'])
cType = cInfo.returnType()
########################################################################
#
# Date and Date Time fields
#
########################################################################
if cType in [ShotgunORM.SgField.RETURN_TYPE_DATE, ShotgunORM.SgField.RETURN_TYPE_DATE_TIME]:
# http://stackoverflow.com/a/13287083
for v in c['values']:
if isinstance(v, dict):
if v.has_key('relative_day'):
time = datetime.time(*v['time'])
date = datetime.date.today()
rd = v['relative_day']
if rd == 'tomorrow':
date = date.replace(day=date.day + 1)
elif rd == 'yesterday':
date = date.replace(day=date.day - 1)
dt = datetime.datetime.combine(date, time)
# Relative day calcs use utc time!
dt.replace(tzinfo=None)
newValues.append(dt)
else:
newValues.append(v)
elif isinstance(v, str):
search = DATE_REGEXP.match(v)
if search:
time = datetime.time(search.group(4), search.group(5), search.group(6))
date = datetime.date(search.group(1), search.group(2), search.group(3))
dt = datetime.datetime.combine(date, time)
dt.replace(tzinfo=None)
newValues.append(utc_to_local(dt))
else:
newValues.append(v)
########################################################################
#
# Entity and Multi-Entity fields
#
########################################################################
elif cType in [ShotgunORM.SgField.RETURN_TYPE_ENTITY, ShotgunORM.SgField.RETURN_TYPE_MULTI_ENTITY]:
for v in c['values']:
if v['name'] == 'Current %s' % parent.type:
newValues.append(parent.toEntityFieldData())
elif v['name'] == 'Me':
login = os.getenv('USERNAME')
user = connection.findOne('HumanUser', [['login', 'is', login]], ['login'])
if user == None:
raise RuntimError('summary field unable to find user "%s" in Shotgun' % login)
newValues.append(user.toEntityFieldData())
else:
newValues.append(v)
else:
# Do nothing
newValues = c['values']
c['values'] = newValues
del c['active']
result.append(c)
return result
def _buildSearchFilter(self):
'''
'''
opsRaw = copy.deepcopy(self._filtersRaw)
logicalOps = {
'conditions': self._buildLogicalOp(
opsRaw['conditions'],
self.parentEntity().connection().schema().entityInfo(self.entityType())
),
'logical_operator': opsRaw['logical_operator']
}
self._searchFilter = logicalOps
def _fromFieldData(self, sgData):
'''
Always return False for summary fields, they can not be set.
'''
if self._value == sgData:
return False
self._value = sgData
return True
def entityType(self):
'''
Returns the type of Entity the summary field will return.
'''
return self._entityType
def hasCommit(self):
'''
Always returns False for summary fields.
'''
return False
def _invalidate(self):
'''
Deletes the search filter so its built again.
'''
self._searchFilter = None
def isEditable(self):
'''
Always return False for summary fields.
'''
return False
def isQueryable(self):
'''
Even though summary fields can be queried from Shotgun return False.
'''
return False
def setHasCommit(self, valid):
'''
Summary fields can't be committed, always returns False.
'''
return False
def setHasSyncUpdate(self, valid):
'''
Summary fields cant be queried so thus they can not be background pulled.
Always returns False.
'''
return False
def _setValue(self, value):
'''
Always return False for summary fields, they can not be set.
'''
return False
class SgFieldTagList(ShotgunORM.SgField):
'''
Entity field that stores a list of strings.
The field may contain a list of valid values which when the field is set are
compared and an Exception thrown when the value is not a valid one.
'''
class SgFieldText(ShotgunORM.SgField):
'''
Entity field that stores a str.
'''
class SgFieldImage(SgFieldText):
'''
See SgFieldText.
'''
def downloadThumbnail(self, path):
'''
Downloads the image to the specified path.
'''
url = self.value()
if url == None or url == '':
raise ValueError('%s value is empty' % self)
if os.path.exists(path) and os.path.isdir(path):
raise OSError('output path "%s" is a directory' % path)
try:
data = urllib2.urlopen(url)
f = open(path, 'w')
f.write(data.read())
f.close()
except Exception, e:
ShotgunORM.LoggerField.error('%(field)s: %(error)s', {
'field': self,
'error': e
})
raise RuntimeError('%s an error occured while downloading the file' % self)
return True
def openInBrowser(self):
'''
Opens the image in a web-browser
'''
url = self.value()
if url == None:
url = ''
webbrowser.open(url)
def uploadThumbnail(self, path):
'''
Uploads the specified image file and sets it as the Entities thumbnail.
Returns the Attachment id.
'''
parent = self.parentEntity()
if not parent.exists():
raise RuntimeError('parent entity does not exist')
with self:
if self.hasCommit():
raise RuntimeError('can not upload a new thumbnail while the image field has an un-commited update')
parent = self.parentEntity()
if parent == None or not parent.exist():
raise RuntimeError('parent entity does not exists')
sgconnection = parent.connection().connection()
with ShotgunORM.SHOTGUN_API_LOCK:
sgResult = sgconnection.upload_thumbnail(parent.type, parent['id'], path)
parent.sync([self.name()])
return sgResult
def uploadFilmstripThumbnail(self, path):
'''
Uploads the specified image file and sets it as the Entities flimstrip
thumbnail.
Returns the Attachment id.
Note:
This function is only valid for Version Entities.
'''
with self:
if self.hasCommit():
raise RuntimeError('can not upload a new thumbnail while the image field has an un-commited update')
parent = self.parentEntity()
if not parent.type == 'Version':
raise RuntimeError('only valid on Version Entities')
if parent == None or not parent.exist():
raise RuntimeError('parent entity does not exists')
sgconnection = parent.connection().connection()
sgResult = sgconnection.upload_filmstrip_thumbnail(parent.type, parent['id'], path)
parent.sync([self.name()])
return sgResult
class SgFieldUrl(ShotgunORM.SgField):
'''
Entity field that stores a url.
Example URL: {
'content_type': 'image/jpeg',
'link_type': 'upload',
'name': 'bob.jpg',
'url': 'http://www.owned.com/bob.jpg'
}
Example Local: {
'content_type': 'image/jpeg',
'link_type': 'local',
'name': 'bob.jpg',
'local_storage': 'c:/temp/bob.jpg'
}
'''
def url(self, openInBrowser=False):
'''
Returns the url value.
When the arg "openInBrowser" is set to True then the returned URL will
also be opened in the operating systems default web-browser.
'''
data = self.value()
result = ''
if data == None:
result = ''
else:
try:
result = data['url']
except:
pass
if openInBrowser:
webbrowser.open(url)
return result
# Register the fields.
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_CHECKBOX, SgFieldCheckbox)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_COLOR, SgFieldColor)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_COLOR2, SgFieldColor2)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_DATE, SgFieldDate)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_DATE_TIME, SgFieldDateTime)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_ENTITY, SgFieldEntity)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_FLOAT, SgFieldFloat)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_IMAGE, SgFieldImage)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_INT, SgFieldInt)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_LIST, SgFieldSelectionList)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_MULTI_ENTITY, SgFieldEntityMulti)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_SERIALIZABLE, SgFieldSerializable)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_STATUS_LIST, SgFieldSelectionList)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_SUMMARY, SgFieldSummary)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_TAG_LIST, SgFieldTagList)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_TEXT, SgFieldText)
ShotgunORM.SgField.registerFieldClass(ShotgunORM.SgField.RETURN_TYPE_URL, SgFieldUrl)
################################################################################
#
# Custom fields
#
################################################################################
class SgFieldID(SgFieldInt):
'''
Field that returns the parent Entities Type.
'''
# Do not allow the field to lock, no point in it.
def invalidate(self):
'''
Does nothing for ID fields.
'''
return False
def isCacheable(self):
'''
Always returns False for ID fields.
'''
return False
def setHasSyncUpdate(self, valid):
'''
Always returns False for ID fields.
'''
return False
def setValid(self, valid):
'''
Always returns False for ID fields.
'''
return False
def setValueFromShotgun(self):
'''
Always returns False for ID fields.
'''
return False
def validate(self, forReal=False, force=False):
'''
Always returns False for ID fields.
'''
return False
def value(self):
'''
Returns the value of the ID field.
'''
return self._value
def _valueSg(self):
'''
Returns the value of the ID field.
For ID fields this will never query Shotgun.
'''
return self._value
class SgFieldType(SgFieldText):
'''
Field that returns the parent Entities Type.
'''
# Do not allow the field to lock, no point in it.
def invalidate(self):
'''
Always returns False for Type fields.
'''
return False
def isCacheable(self):
'''
Always returns False for Type fields.
'''
return False
def setHasSyncUpdate(self, valid):
'''
Always returns False for Type fields.
'''
return False
def setValid(self, valid):
'''
Always returns False for Type fields.
'''
return False
def setValueFromShotgun(self):
'''
Always returns False for Type fields.
'''
return False
def validate(self, forReal=False, force=False):
'''
Always returns False for Type fields.
'''
return False
def value(self):
'''
Returns the Entity type the field belongs to.
'''
return self._value
def _valueSg(self):
'''
Returns the Entity type the field belongs to.
For Type fields this will never query Shotgun.
'''
return self._value
| [
2,
15069,
357,
66,
8,
2211,
11,
18106,
5648,
30567,
532,
399,
17213,
23257,
1040,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
198,
2,
17613,
11,
389,
10431,
2810,
326,
262,
1708,
3403,
389,
1138,
25,
198,
2,
220,
220,
220,
220,
1635,
2297,
396,
2455,
507,
286,
2723,
2438,
1276,
12377,
262,
2029,
6634,
198,
2,
220,
220,
220,
220,
220,
220,
4003,
11,
428,
1351,
286,
3403,
290,
262,
1708,
37592,
13,
198,
2,
220,
220,
220,
220,
1635,
2297,
396,
2455,
507,
287,
13934,
1296,
1276,
22919,
262,
2029,
6634,
198,
2,
220,
220,
220,
220,
220,
220,
4003,
11,
428,
1351,
286,
3403,
290,
262,
1708,
37592,
287,
262,
198,
2,
220,
220,
220,
220,
220,
220,
10314,
290,
14,
273,
584,
5696,
2810,
351,
262,
6082,
13,
198,
2,
220,
220,
220,
220,
1635,
16126,
262,
1438,
286,
262,
399,
17213,
23257,
1040,
4249,
262,
3891,
286,
663,
20420,
198,
2,
220,
220,
220,
220,
220,
220,
743,
307,
973,
284,
11438,
393,
7719,
3186,
10944,
422,
428,
3788,
198,
2,
220,
220,
220,
220,
220,
220,
1231,
2176,
3161,
3194,
7170,
13,
198,
2,
198,
2,
12680,
47466,
3180,
36592,
2389,
1961,
11050,
3336,
27975,
38162,
9947,
367,
15173,
4877,
5357,
27342,
9865,
3843,
20673,
366,
1921,
3180,
1,
5357,
198,
2,
15529,
7788,
32761,
6375,
8959,
49094,
34764,
11015,
11,
47783,
2751,
11,
21728,
5626,
40880,
5390,
11,
3336,
8959,
49094,
198,
2,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
5357,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
15986,
198,
2,
13954,
48778,
1961,
13,
3268,
8005,
49261,
50163,
399,
17213,
6489,
7340,
20913,
9348,
43031,
19146,
7473,
15529,
198,
2,
42242,
11,
3268,
17931,
23988,
11,
19387,
25256,
1847,
11,
38846,
11,
7788,
3620,
6489,
13153,
11,
6375,
7102,
5188,
10917,
3525,
12576,
29506,
25552,
198,
2,
357,
1268,
39149,
2751,
11,
21728,
5626,
40880,
5390,
11,
41755,
11335,
10979,
3963,
28932,
2257,
2043,
37780,
21090,
50,
6375,
49254,
26,
198,
2,
406,
18420,
3963,
23210,
11,
42865,
11,
6375,
4810,
19238,
29722,
26,
6375,
43949,
44180,
23255,
49,
8577,
24131,
8,
29630,
36,
5959,
7257,
2937,
1961,
5357,
198,
2,
6177,
15529,
3336,
15513,
3963,
43031,
25382,
11,
7655,
2767,
16879,
3268,
27342,
10659,
11,
19269,
18379,
43031,
25382,
11,
6375,
309,
9863,
198,
2,
357,
1268,
39149,
2751,
399,
7156,
43,
3528,
18310,
6375,
25401,
54,
24352,
8,
5923,
1797,
2751,
3268,
15529,
34882,
16289,
3963,
3336,
23210,
3963,
12680,
198,
2,
47466,
11,
45886,
16876,
5984,
29817,
1961,
3963,
3336,
28069,
11584,
25382,
3963,
13558,
3398,
29506,
11879,
13,
198,
2,
198,
198,
834,
439,
834,
796,
685,
198,
220,
705,
50,
70,
15878,
9787,
3524,
3256,
198,
220,
705,
50,
70,
15878,
10258,
3256,
198,
220,
705,
50,
70,
15878,
10258,
17,
3256,
198,
220,
705,
50,
70,
15878,
10430,
3256,
198,
220,
705,
50,
70,
15878,
10430,
7575,
3256,
198,
220,
705,
50,
70,
15878,
32398,
3256,
198,
220,
705,
50,
70,
15878,
32398,
29800,
3256,
198,
220,
705,
50,
70,
15878,
43879,
3256,
198,
220,
705,
50,
70,
15878,
2389,
3256,
198,
220,
705,
50,
70,
15878,
5159,
3256,
198,
220,
705,
50,
70,
15878,
5317,
3256,
198,
220,
705,
50,
70,
15878,
4653,
1564,
8053,
3256,
198,
220,
705,
50,
70,
15878,
24835,
8053,
3256,
198,
220,
705,
50,
70,
15878,
8206,
3256,
198,
220,
705,
50,
70,
15878,
6030,
3256,
198,
220,
705,
50,
70,
15878,
28165,
6,
198,
60,
198,
198,
2,
11361,
17944,
198,
11748,
4866,
198,
11748,
4818,
8079,
198,
11748,
28686,
198,
11748,
302,
198,
11748,
4704,
278,
198,
11748,
2956,
297,
571,
17,
198,
11748,
3992,
40259,
198,
198,
2,
770,
8265,
17944,
198,
11748,
34198,
1581,
44,
198,
198,
4871,
311,
70,
15878,
9787,
3524,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
20512,
1988,
329,
257,
2198,
3524,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
10258,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
1351,
286,
513,
493,
82,
326,
2380,
257,
46140,
3124,
657,
12,
13381,
13,
628,
220,
17934,
25,
685,
12762,
11,
13108,
11,
13108,
60,
198,
220,
705,
7061,
628,
220,
23337,
49864,
62,
46786,
796,
302,
13,
5589,
576,
7,
81,
6,
38016,
67,
28200,
59,
67,
28200,
59,
67,
28988,
11537,
198,
198,
4871,
311,
70,
15878,
10258,
17,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
1351,
286,
513,
493,
82,
326,
2380,
257,
46140,
3124,
657,
12,
13381,
13,
628,
220,
13268,
262,
3124,
1441,
1988,
329,
15941,
290,
18983,
7232,
871,
3124,
2214,
13,
628,
220,
15941,
290,
18983,
7232,
871,
460,
423,
511,
3124,
2214,
900,
284,
257,
1988,
326,
2173,
198,
220,
284,
262,
3124,
2214,
286,
262,
11523,
2239,
393,
1628,
484,
5594,
284,
13,
628,
220,
45891,
8705,
284,
991,
869,
262,
1441,
2099,
366,
8043,
1,
290,
407,
198,
220,
28754,
262,
734,
314,
760,
826,
30,
198,
220,
705,
7061,
628,
220,
23337,
49864,
62,
46786,
796,
302,
13,
5589,
576,
7,
81,
6,
38016,
67,
28200,
59,
67,
28200,
59,
67,
28988,
11537,
198,
220,
23337,
49864,
62,
51,
1921,
42,
62,
46786,
796,
302,
13,
5589,
576,
7,
81,
6,
38016,
67,
28200,
59,
67,
28200,
59,
67,
10,
14726,
7,
79,
541,
4470,
62,
9662,
8,
11537,
198,
220,
23337,
49864,
62,
11909,
11159,
62,
46786,
796,
302,
13,
5589,
576,
7,
81,
6,
38016,
67,
28200,
59,
67,
28200,
59,
67,
10,
14726,
7,
16302,
8,
11537,
628,
220,
825,
2792,
15878,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
2792,
2214,
428,
3124,
2214,
460,
5457,
2792,
284,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
2116,
13557,
8726,
15878,
628,
220,
825,
2560,
31813,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
628,
220,
220,
220,
611,
2560,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
279,
6030,
796,
2560,
13,
15952,
2611,
12360,
22446,
3672,
3419,
628,
220,
220,
220,
611,
279,
6030,
6624,
705,
25714,
10354,
198,
220,
220,
220,
220,
220,
2116,
13557,
260,
25636,
79,
796,
2116,
13,
31553,
49864,
62,
51,
1921,
42,
62,
46786,
198,
220,
220,
220,
220,
220,
2116,
13557,
8726,
10100,
796,
705,
79,
541,
4470,
62,
9662,
6,
198,
220,
220,
220,
220,
220,
2116,
13557,
8726,
15878,
796,
705,
9662,
6,
198,
220,
220,
220,
1288,
361,
279,
6030,
6624,
705,
35645,
10354,
198,
220,
220,
220,
220,
220,
2116,
13557,
260,
25636,
79,
796,
2116,
13,
31553,
49864,
62,
11909,
11159,
62,
46786,
198,
220,
220,
220,
220,
220,
2116,
13557,
8726,
10100,
796,
705,
16302,
6,
198,
220,
220,
220,
220,
220,
2116,
13557,
8726,
15878,
28,
705,
16302,
6,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
2116,
13557,
260,
25636,
79,
796,
2116,
13,
31553,
49864,
62,
46786,
628,
220,
825,
1988,
7,
944,
11,
2792,
36,
2100,
4985,
28,
17821,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
1635,
357,
30388,
8,
2792,
36,
2100,
4985,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1649,
6407,
290,
262,
3124,
2214,
318,
257,
2792,
284,
1194,
20885,
338,
3124,
2214,
198,
220,
220,
220,
220,
220,
220,
220,
262,
1988,
286,
262,
6692,
3124,
2214,
481,
307,
4504,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1002,
2792,
36,
2100,
4985,
318,
10352,
257,
4731,
743,
307,
4504,
2427,
286,
257,
1351,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1255,
796,
2208,
7,
50,
70,
15878,
10258,
17,
11,
2116,
737,
8367,
3419,
628,
220,
220,
220,
611,
1255,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
1441,
6045,
628,
220,
220,
220,
611,
407,
2792,
36,
2100,
4985,
290,
1255,
6624,
2116,
13557,
8726,
10100,
25,
198,
220,
220,
220,
220,
220,
1441,
1255,
628,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
628,
220,
220,
220,
611,
2560,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
611,
1255,
6624,
2116,
13557,
8726,
10100,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6045,
628,
220,
220,
220,
220,
220,
649,
23004,
796,
17635,
628,
220,
220,
220,
220,
220,
329,
1312,
287,
1255,
13,
35312,
7,
41707,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
649,
23004,
13,
33295,
7,
600,
7,
72,
4008,
628,
220,
220,
220,
611,
1255,
6624,
2116,
13557,
8726,
10100,
25,
198,
220,
220,
220,
220,
220,
2792,
49201,
796,
2116,
13,
8000,
32398,
3419,
58,
944,
13557,
8726,
15878,
60,
628,
220,
220,
220,
220,
220,
611,
2792,
49201,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6045,
628,
220,
220,
220,
220,
220,
1441,
2792,
49201,
17816,
8043,
20520,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
649,
23004,
796,
17635,
628,
220,
220,
220,
220,
220,
329,
1312,
287,
1255,
13,
35312,
7,
41707,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
649,
23004,
13,
33295,
7,
600,
7,
72,
4008,
198,
198,
4871,
311,
70,
15878,
10430,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
3128,
4731,
628,
220,
17934,
25,
366,
23664,
12,
486,
12,
1270,
1911,
198,
220,
705,
7061,
628,
220,
23337,
49864,
796,
302,
13,
5589,
576,
7,
81,
6,
61,
59,
67,
90,
19,
92,
12,
59,
67,
90,
17,
92,
12,
59,
67,
90,
17,
92,
11537,
198,
198,
4871,
311,
70,
15878,
10430,
7575,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
21015,
4818,
8079,
2134,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
32398,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
2792,
284,
1194,
20885,
13,
198,
220,
705,
7061,
628,
220,
1303,
29113,
29113,
7804,
4242,
2,
198,
220,
1303,
198,
220,
1303,
30023,
9863,
8643,
13896,
198,
220,
1303,
198,
220,
1303,
4377,
2458,
284,
4808,
6738,
15878,
6601,
11,
4808,
2617,
11395,
11,
4808,
1462,
15878,
6601,
11,
1988,
5499,
198,
220,
1303,
815,
635,
307,
5625,
284,
262,
311,
70,
12982,
15878,
23839,
32398,
1398,
13,
198,
220,
1303,
198,
220,
1303,
29113,
29113,
7804,
4242,
2,
628,
220,
825,
1988,
7,
944,
11,
264,
70,
28985,
15878,
82,
28,
14202,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
7032,
1988,
355,
257,
20885,
2134,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
1635,
357,
4868,
8,
264,
70,
28985,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
2214,
3891,
284,
48040,
262,
4504,
20885,
351,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1988,
796,
2208,
7,
50,
70,
15878,
32398,
11,
2116,
737,
8367,
3419,
628,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
628,
220,
220,
220,
611,
1988,
6624,
6045,
393,
2560,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
1441,
6045,
628,
220,
220,
220,
4637,
796,
2560,
13,
38659,
3419,
628,
220,
220,
220,
611,
318,
39098,
7,
45213,
28985,
15878,
82,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
264,
70,
28985,
15878,
82,
796,
264,
70,
28985,
15878,
82,
13,
1136,
7,
8000,
13,
4906,
11,
6045,
8,
198,
220,
220,
220,
1288,
361,
318,
39098,
7,
45213,
28985,
15878,
82,
11,
965,
2599,
198,
220,
220,
220,
220,
220,
264,
70,
28985,
15878,
82,
796,
685,
45213,
28985,
15878,
82,
60,
628,
220,
220,
220,
611,
264,
70,
28985,
15878,
82,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
264,
70,
28985,
15878,
82,
796,
4637,
13,
12286,
32398,
20746,
15878,
82,
7,
8367,
17816,
4906,
6,
12962,
628,
220,
220,
220,
220,
220,
611,
18896,
7,
45213,
28985,
15878,
82,
8,
19841,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
264,
70,
28985,
15878,
82,
796,
6045,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
2834,
15878,
82,
796,
900,
7,
45213,
28985,
15878,
82,
8,
628,
220,
220,
220,
220,
220,
3131,
15878,
82,
796,
17635,
628,
220,
220,
220,
220,
220,
611,
705,
439,
6,
287,
2834,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
28956,
10786,
439,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
3131,
15878,
82,
796,
2560,
13,
3245,
36690,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
611,
705,
12286,
6,
287,
2834,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
28956,
10786,
12286,
11537,
198,
220,
220,
220,
220,
220,
1288,
361,
705,
12286,
6,
287,
2834,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
28956,
10786,
12286,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
3131,
15878,
82,
796,
4637,
13,
12286,
32398,
20746,
15878,
82,
7,
8367,
17816,
4906,
6,
12962,
628,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
19119,
7,
26086,
15878,
82,
8,
628,
220,
220,
220,
220,
220,
611,
18896,
7,
31216,
15878,
82,
8,
18189,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
264,
70,
28985,
15878,
82,
796,
1351,
7,
31216,
15878,
82,
8,
198,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
264,
70,
28985,
15878,
82,
796,
6045,
628,
220,
220,
220,
1255,
796,
4637,
13557,
17953,
32398,
7,
198,
220,
220,
220,
220,
220,
1988,
17816,
4906,
6,
4357,
198,
220,
220,
220,
220,
220,
1988,
11,
198,
220,
220,
220,
220,
220,
264,
70,
28985,
15878,
82,
28,
45213,
28985,
15878,
82,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
1441,
1255,
198,
198,
4871,
311,
70,
15878,
32398,
29800,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
1351,
286,
6117,
284,
584,
7232,
871,
13,
628,
220,
17934,
25,
685,
32398,
486,
11,
20885,
2999,
11,
2644,
60,
198,
220,
705,
7061,
628,
220,
1303,
29113,
29113,
7804,
4242,
2,
198,
220,
1303,
198,
220,
1303,
30023,
9863,
8643,
13896,
198,
220,
1303,
198,
220,
1303,
4377,
2458,
284,
4808,
6738,
15878,
6601,
11,
4808,
2617,
11395,
11,
4808,
1462,
15878,
6601,
11,
1988,
5499,
198,
220,
1303,
815,
635,
307,
5625,
284,
262,
311,
70,
12982,
15878,
23839,
29800,
32398,
1398,
13,
198,
220,
1303,
198,
220,
1303,
29113,
29113,
7804,
4242,
2,
628,
220,
825,
1988,
7,
944,
11,
264,
70,
28985,
15878,
82,
28,
14202,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
7032,
1988,
355,
257,
1351,
286,
20885,
5563,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
1635,
357,
11600,
8,
264,
70,
28985,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
360,
713,
286,
9312,
3858,
290,
2214,
3891,
284,
48040,
262,
4504,
7232,
871,
198,
220,
220,
220,
220,
220,
220,
220,
351,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1255,
796,
2208,
7,
50,
70,
15878,
32398,
29800,
11,
2116,
737,
8367,
3419,
628,
220,
220,
220,
611,
1255,
287,
685,
14202,
11,
17635,
5974,
198,
220,
220,
220,
220,
220,
1441,
1255,
628,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
628,
220,
220,
220,
611,
2560,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
1441,
4866,
13,
22089,
30073,
7,
20274,
8,
628,
220,
220,
220,
4637,
796,
2560,
13,
38659,
3419,
198,
220,
220,
220,
32815,
796,
4637,
13,
15952,
2611,
3419,
628,
220,
220,
220,
45218,
796,
17635,
628,
220,
220,
220,
10662,
7936,
796,
4637,
13,
22766,
13798,
3419,
628,
220,
220,
220,
10662,
7936,
13,
9967,
3419,
628,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
329,
1312,
287,
1255,
25,
198,
220,
220,
220,
220,
220,
220,
220,
256,
796,
1312,
17816,
4906,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
611,
264,
70,
28985,
15878,
82,
14512,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
264,
70,
28985,
15878,
82,
13,
10134,
62,
2539,
7,
83,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
15878,
82,
796,
264,
70,
28985,
15878,
82,
58,
83,
60,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
15878,
82,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
4637,
13,
12286,
32398,
20746,
15878,
82,
7,
83,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
72,
28985,
15878,
82,
8,
19841,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
72,
15878,
82,
11,
965,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
796,
900,
26933,
72,
15878,
82,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
796,
900,
7,
72,
15878,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3131,
15878,
82,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
439,
6,
287,
2834,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
28956,
10786,
439,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3131,
15878,
82,
796,
32815,
13,
26858,
12360,
7,
83,
737,
3245,
36690,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
12286,
6,
287,
2834,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
28956,
10786,
12286,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
705,
12286,
6,
287,
2834,
15878,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
28956,
10786,
12286,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3131,
15878,
82,
796,
4637,
13,
12286,
32398,
20746,
15878,
82,
7,
83,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2834,
15878,
82,
13,
19119,
7,
26086,
15878,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
31216,
15878,
82,
8,
18189,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
1351,
7,
31216,
15878,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
4637,
13,
12286,
32398,
20746,
15878,
82,
7,
83,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
72,
28985,
15878,
82,
8,
19841,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
28985,
15878,
82,
796,
4637,
13,
12286,
32398,
20746,
15878,
82,
7,
83,
8,
628,
220,
220,
220,
220,
220,
220,
220,
9312,
796,
4637,
13557,
17953,
32398,
7,
83,
11,
1312,
11,
264,
70,
28985,
15878,
82,
28,
72,
28985,
15878,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
45218,
13,
33295,
7,
26858,
8,
198,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
10662,
7936,
13,
403,
9967,
3419,
628,
220,
220,
220,
1441,
45218,
198,
198,
4871,
311,
70,
15878,
43879,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
12178,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
5317,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
281,
18253,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
4653,
1564,
8053,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
2420,
4731,
326,
318,
422,
257,
1351,
6356,
13,
628,
220,
383,
2214,
743,
3994,
257,
1351,
286,
4938,
3815,
543,
618,
262,
2214,
318,
900,
389,
198,
220,
3688,
290,
281,
35528,
8754,
618,
262,
1988,
318,
407,
257,
4938,
530,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
32634,
13821,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
11389,
13821,
1366,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
22093,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
5860,
281,
20885,
393,
1351,
286,
7232,
871,
1912,
319,
257,
2989,
198,
220,
5408,
13,
628,
220,
21293,
7032,
13,
198,
220,
705,
7061,
628,
220,
360,
6158,
62,
31553,
49864,
796,
302,
13,
5589,
576,
7,
81,
6,
38016,
67,
90,
19,
92,
13219,
38016,
67,
90,
17,
92,
13219,
38016,
67,
90,
17,
30072,
357,
59,
67,
90,
17,
92,
2599,
38016,
67,
90,
17,
92,
2599,
38016,
67,
90,
17,
30072,
18119,
11537,
628,
220,
825,
4808,
11249,
11187,
605,
18257,
7,
944,
11,
3403,
11,
7508,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
10934,
82,
262,
12219,
10088,
2989,
3912,
290,
5860,
340,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1255,
796,
17635,
628,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
198,
220,
220,
220,
4637,
796,
2560,
13,
38659,
3419,
628,
220,
220,
220,
329,
269,
287,
3403,
25,
198,
220,
220,
220,
220,
220,
611,
269,
13,
10134,
62,
2539,
10786,
6404,
605,
62,
46616,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
12219,
18257,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
17561,
1756,
10354,
2116,
13557,
11249,
11187,
605,
18257,
7,
66,
17816,
17561,
1756,
6,
4357,
7508,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6404,
605,
62,
46616,
10354,
269,
17816,
6404,
605,
62,
46616,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
220,
220,
220,
220,
220,
220,
220,
1255,
13,
33295,
7,
6404,
605,
18257,
8,
198,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
269,
12360,
796,
7508,
13,
3245,
12360,
7,
66,
17816,
6978,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
269,
6030,
796,
269,
12360,
13,
7783,
6030,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
29113,
29113,
4242,
21017,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7536,
290,
7536,
3862,
7032,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
29113,
29113,
4242,
21017,
198,
220,
220,
220,
220,
220,
220,
220,
611,
269,
6030,
287,
685,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
35,
6158,
11,
34198,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
35,
6158,
62,
34694,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2638,
1378,
25558,
2502,
11125,
13,
785,
14,
64,
14,
1485,
2078,
2154,
5999,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
410,
287,
269,
17816,
27160,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
85,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
410,
13,
10134,
62,
2539,
10786,
43762,
62,
820,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
640,
796,
4818,
8079,
13,
2435,
46491,
85,
17816,
2435,
6,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3128,
796,
4818,
8079,
13,
4475,
13,
40838,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
67,
796,
410,
17816,
43762,
62,
820,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
374,
67,
6624,
705,
39532,
6254,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3128,
796,
3128,
13,
33491,
7,
820,
28,
4475,
13,
820,
1343,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
374,
67,
6624,
705,
8505,
6432,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3128,
796,
3128,
13,
33491,
7,
820,
28,
4475,
13,
820,
532,
352,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
83,
796,
4818,
8079,
13,
19608,
8079,
13,
24011,
500,
7,
4475,
11,
640,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
45344,
1110,
2386,
6359,
779,
3384,
66,
640,
0,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
83,
13,
33491,
7,
22877,
10951,
28,
14202,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
13,
33295,
7,
28664,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
13,
33295,
7,
85,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
318,
39098,
7,
85,
11,
965,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2989,
796,
360,
6158,
62,
31553,
49864,
13,
15699,
7,
85,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2989,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
640,
796,
4818,
8079,
13,
2435,
7,
12947,
13,
8094,
7,
19,
828,
2989,
13,
8094,
7,
20,
828,
2989,
13,
8094,
7,
21,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3128,
796,
4818,
8079,
13,
4475,
7,
12947,
13,
8094,
7,
16,
828,
2989,
13,
8094,
7,
17,
828,
2989,
13,
8094,
7,
18,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
83,
796,
4818,
8079,
13,
19608,
8079,
13,
24011,
500,
7,
4475,
11,
640,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
83,
13,
33491,
7,
22877,
10951,
28,
14202,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
13,
33295,
7,
315,
66,
62,
1462,
62,
12001,
7,
28664,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
13,
33295,
7,
85,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
29113,
29113,
4242,
21017,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
20885,
290,
15237,
12,
32398,
7032,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
29113,
29113,
4242,
21017,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
269,
6030,
287,
685,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
3525,
9050,
11,
34198,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
44,
16724,
40,
62,
3525,
9050,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
410,
287,
269,
17816,
27160,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
410,
17816,
3672,
20520,
6624,
705,
11297,
4064,
82,
6,
4064,
2560,
13,
4906,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
13,
33295,
7,
8000,
13,
1462,
32398,
15878,
6601,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
410,
17816,
3672,
20520,
6624,
705,
5308,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17594,
796,
28686,
13,
1136,
24330,
10786,
29904,
20608,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2836,
796,
4637,
13,
19796,
3198,
10786,
20490,
12982,
3256,
16410,
6,
38235,
3256,
705,
271,
3256,
17594,
60,
4357,
37250,
38235,
6,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2836,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
371,
2797,
320,
12331,
10786,
49736,
2214,
5906,
284,
1064,
2836,
36521,
82,
1,
287,
34198,
6,
4064,
17594,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
13,
33295,
7,
7220,
13,
1462,
32398,
15878,
6601,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
13,
33295,
7,
85,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2141,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
40161,
796,
269,
17816,
27160,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
269,
17816,
27160,
20520,
796,
649,
40161,
628,
220,
220,
220,
220,
220,
220,
220,
1619,
269,
17816,
5275,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
1255,
13,
33295,
7,
66,
8,
628,
220,
220,
220,
1441,
1255,
628,
220,
825,
4808,
11249,
18243,
22417,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
39628,
27369,
796,
4866,
13,
22089,
30073,
7,
944,
13557,
10379,
1010,
27369,
8,
628,
220,
220,
220,
12219,
41472,
796,
1391,
198,
220,
220,
220,
220,
220,
705,
17561,
1756,
10354,
2116,
13557,
11249,
11187,
605,
18257,
7,
198,
220,
220,
220,
220,
220,
220,
220,
39628,
27369,
17816,
17561,
1756,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
8000,
32398,
22446,
38659,
22446,
15952,
2611,
22446,
26858,
12360,
7,
944,
13,
26858,
6030,
28955,
198,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
705,
6404,
605,
62,
46616,
10354,
39628,
27369,
17816,
6404,
605,
62,
46616,
20520,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
2116,
13557,
12947,
22417,
796,
12219,
41472,
628,
220,
825,
4808,
6738,
15878,
6601,
7,
944,
11,
264,
70,
6601,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
1441,
10352,
329,
10638,
7032,
11,
484,
460,
407,
307,
900,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
611,
2116,
13557,
8367,
6624,
264,
70,
6601,
25,
198,
220,
220,
220,
220,
220,
1441,
10352,
628,
220,
220,
220,
2116,
13557,
8367,
796,
264,
70,
6601,
628,
220,
220,
220,
1441,
6407,
628,
220,
825,
9312,
6030,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
2099,
286,
20885,
262,
10638,
2214,
481,
1441,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
2116,
13557,
26858,
6030,
628,
220,
825,
468,
6935,
270,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
10638,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
4808,
259,
12102,
378,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1024,
40676,
262,
2989,
8106,
523,
663,
3170,
757,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
2116,
13557,
12947,
22417,
796,
6045,
628,
220,
825,
318,
7407,
4674,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
1441,
10352,
329,
10638,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
318,
20746,
540,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3412,
996,
10638,
7032,
460,
307,
42517,
798,
422,
34198,
1441,
10352,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
19242,
6935,
270,
7,
944,
11,
4938,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
21293,
7032,
460,
470,
307,
5364,
11,
1464,
5860,
10352,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
19242,
28985,
10260,
7,
944,
11,
4938,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
21293,
7032,
18548,
307,
42517,
798,
523,
4145,
484,
460,
407,
307,
4469,
5954,
13,
628,
220,
220,
220,
16622,
5860,
10352,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
4808,
2617,
11395,
7,
944,
11,
1988,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
1441,
10352,
329,
10638,
7032,
11,
484,
460,
407,
307,
900,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
198,
198,
4871,
311,
70,
15878,
24835,
8053,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
1351,
286,
13042,
13,
628,
220,
383,
2214,
743,
3994,
257,
1351,
286,
4938,
3815,
543,
618,
262,
2214,
318,
900,
389,
198,
220,
3688,
290,
281,
35528,
8754,
618,
262,
1988,
318,
407,
257,
4938,
530,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
8206,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
965,
13,
198,
220,
705,
7061,
198,
198,
4871,
311,
70,
15878,
5159,
7,
50,
70,
15878,
8206,
2599,
198,
220,
705,
7061,
198,
220,
4091,
311,
70,
15878,
8206,
13,
198,
220,
705,
7061,
628,
220,
825,
4321,
35523,
7,
944,
11,
3108,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
50093,
262,
2939,
284,
262,
7368,
3108,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
19016,
796,
2116,
13,
8367,
3419,
628,
220,
220,
220,
611,
19016,
6624,
6045,
393,
19016,
6624,
10148,
25,
198,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
4,
82,
1988,
318,
6565,
6,
4064,
2116,
8,
628,
220,
220,
220,
611,
28686,
13,
6978,
13,
1069,
1023,
7,
6978,
8,
290,
28686,
13,
6978,
13,
9409,
343,
7,
6978,
2599,
198,
220,
220,
220,
220,
220,
5298,
440,
5188,
81,
1472,
10786,
22915,
3108,
36521,
82,
1,
318,
257,
8619,
6,
4064,
3108,
8,
628,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
1366,
796,
2956,
297,
571,
17,
13,
6371,
9654,
7,
6371,
8,
628,
220,
220,
220,
220,
220,
277,
796,
1280,
7,
6978,
11,
705,
86,
11537,
628,
220,
220,
220,
220,
220,
277,
13,
13564,
7,
7890,
13,
961,
28955,
628,
220,
220,
220,
220,
220,
277,
13,
19836,
3419,
198,
220,
220,
220,
2845,
35528,
11,
304,
25,
198,
220,
220,
220,
220,
220,
34198,
1581,
44,
13,
11187,
1362,
15878,
13,
18224,
10786,
4,
7,
3245,
8,
82,
25,
4064,
7,
18224,
8,
82,
3256,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
3245,
10354,
2116,
11,
198,
220,
220,
220,
220,
220,
220,
220,
705,
18224,
10354,
304,
198,
220,
220,
220,
220,
220,
32092,
628,
220,
220,
220,
220,
220,
5298,
43160,
12331,
10786,
4,
82,
281,
4049,
1609,
1522,
981,
22023,
262,
2393,
6,
4064,
2116,
8,
628,
220,
220,
220,
1441,
6407,
628,
220,
825,
1280,
818,
46532,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
8670,
641,
262,
2939,
287,
257,
3992,
12,
40259,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
19016,
796,
2116,
13,
8367,
3419,
628,
220,
220,
220,
611,
19016,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
19016,
796,
10148,
628,
220,
220,
220,
3992,
40259,
13,
9654,
7,
6371,
8,
628,
220,
825,
9516,
35523,
7,
944,
11,
3108,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
36803,
82,
262,
7368,
2939,
2393,
290,
5621,
340,
355,
262,
7232,
871,
40901,
13,
628,
220,
220,
220,
16409,
262,
3460,
15520,
4686,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
628,
220,
220,
220,
611,
407,
2560,
13,
1069,
1023,
33529,
198,
220,
220,
220,
220,
220,
5298,
43160,
12331,
10786,
8000,
9312,
857,
407,
2152,
11537,
628,
220,
220,
220,
351,
2116,
25,
198,
220,
220,
220,
220,
220,
611,
2116,
13,
10134,
6935,
270,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
43160,
12331,
10786,
5171,
407,
9516,
257,
649,
40901,
981,
262,
2939,
2214,
468,
281,
555,
12,
9503,
863,
4296,
11537,
628,
220,
220,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
628,
220,
220,
220,
220,
220,
611,
2560,
6624,
6045,
393,
407,
2560,
13,
38476,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
43160,
12331,
10786,
8000,
9312,
857,
407,
7160,
11537,
628,
220,
220,
220,
220,
220,
264,
70,
38659,
796,
2560,
13,
38659,
22446,
38659,
3419,
628,
220,
220,
220,
220,
220,
351,
34198,
1581,
44,
13,
9693,
2394,
38,
4944,
62,
17614,
62,
36840,
25,
198,
220,
220,
220,
220,
220,
220,
220,
264,
70,
23004,
796,
264,
70,
38659,
13,
25850,
62,
400,
20566,
7,
8000,
13,
4906,
11,
2560,
17816,
312,
6,
4357,
3108,
8,
628,
220,
220,
220,
220,
220,
2560,
13,
27261,
26933,
944,
13,
3672,
3419,
12962,
628,
220,
220,
220,
220,
220,
1441,
264,
70,
23004,
628,
220,
825,
9516,
39750,
36311,
35523,
7,
944,
11,
3108,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
36803,
82,
262,
7368,
2939,
2393,
290,
5621,
340,
355,
262,
7232,
871,
781,
320,
36311,
198,
220,
220,
220,
40901,
13,
628,
220,
220,
220,
16409,
262,
3460,
15520,
4686,
13,
628,
220,
220,
220,
5740,
25,
198,
220,
220,
220,
770,
2163,
318,
691,
4938,
329,
10628,
7232,
871,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
351,
2116,
25,
198,
220,
220,
220,
220,
220,
611,
2116,
13,
10134,
6935,
270,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
43160,
12331,
10786,
5171,
407,
9516,
257,
649,
40901,
981,
262,
2939,
2214,
468,
281,
555,
12,
9503,
863,
4296,
11537,
628,
220,
220,
220,
220,
220,
2560,
796,
2116,
13,
8000,
32398,
3419,
628,
220,
220,
220,
220,
220,
611,
407,
2560,
13,
4906,
6624,
705,
14815,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
43160,
12331,
10786,
8807,
4938,
319,
10628,
7232,
871,
11537,
628,
220,
220,
220,
220,
220,
611,
2560,
6624,
6045,
393,
407,
2560,
13,
38476,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
43160,
12331,
10786,
8000,
9312,
857,
407,
7160,
11537,
628,
220,
220,
220,
220,
220,
264,
70,
38659,
796,
2560,
13,
38659,
22446,
38659,
3419,
628,
220,
220,
220,
220,
220,
264,
70,
23004,
796,
264,
70,
38659,
13,
25850,
62,
26240,
36311,
62,
400,
20566,
7,
8000,
13,
4906,
11,
2560,
17816,
312,
6,
4357,
3108,
8,
628,
220,
220,
220,
220,
220,
2560,
13,
27261,
26933,
944,
13,
3672,
3419,
12962,
628,
220,
220,
220,
220,
220,
1441,
264,
70,
23004,
198,
198,
4871,
311,
70,
15878,
28165,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
2599,
198,
220,
705,
7061,
198,
220,
20885,
2214,
326,
7000,
257,
19016,
13,
628,
220,
17934,
10289,
25,
1391,
198,
220,
220,
220,
705,
11299,
62,
4906,
10354,
705,
9060,
14,
73,
22071,
3256,
198,
220,
220,
220,
705,
8726,
62,
4906,
10354,
705,
25850,
3256,
198,
220,
220,
220,
705,
3672,
10354,
705,
65,
672,
13,
9479,
3256,
198,
220,
220,
220,
705,
6371,
10354,
705,
4023,
1378,
2503,
13,
11990,
13,
785,
14,
65,
672,
13,
9479,
6,
198,
220,
1782,
628,
220,
17934,
10714,
25,
1391,
198,
220,
220,
220,
705,
11299,
62,
4906,
10354,
705,
9060,
14,
73,
22071,
3256,
198,
220,
220,
220,
705,
8726,
62,
4906,
10354,
705,
12001,
3256,
198,
220,
220,
220,
705,
3672,
10354,
705,
65,
672,
13,
9479,
3256,
198,
220,
220,
220,
705,
12001,
62,
35350,
10354,
705,
66,
14079,
29510,
14,
65,
672,
13,
9479,
6,
198,
220,
1782,
198,
220,
705,
7061,
628,
220,
825,
19016,
7,
944,
11,
1280,
818,
46532,
28,
25101,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
19016,
1988,
13,
628,
220,
220,
220,
1649,
262,
1822,
366,
9654,
818,
46532,
1,
318,
900,
284,
6407,
788,
262,
4504,
10289,
481,
198,
220,
220,
220,
635,
307,
4721,
287,
262,
5361,
3341,
4277,
3992,
12,
40259,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1366,
796,
2116,
13,
8367,
3419,
628,
220,
220,
220,
1255,
796,
10148,
628,
220,
220,
220,
611,
1366,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
1255,
796,
10148,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
1366,
17816,
6371,
20520,
198,
220,
220,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1208,
628,
220,
220,
220,
611,
1280,
818,
46532,
25,
198,
220,
220,
220,
220,
220,
3992,
40259,
13,
9654,
7,
6371,
8,
628,
220,
220,
220,
1441,
1255,
198,
198,
2,
17296,
262,
7032,
13,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
50084,
39758,
11,
311,
70,
15878,
9787,
3524,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
46786,
11,
311,
70,
15878,
10258,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
46786,
17,
11,
311,
70,
15878,
10258,
17,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
35,
6158,
11,
311,
70,
15878,
10430,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
35,
6158,
62,
34694,
11,
311,
70,
15878,
10430,
7575,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
3525,
9050,
11,
311,
70,
15878,
32398,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
3697,
46,
1404,
11,
311,
70,
15878,
43879,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
3955,
11879,
11,
311,
70,
15878,
5159,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
12394,
11,
311,
70,
15878,
5317,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
45849,
11,
311,
70,
15878,
4653,
1564,
8053,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
44,
16724,
40,
62,
3525,
9050,
11,
311,
70,
15878,
32398,
29800,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
35009,
12576,
14887,
17534,
11,
311,
70,
15878,
32634,
13821,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
35744,
2937,
62,
45849,
11,
311,
70,
15878,
4653,
1564,
8053,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
50,
5883,
44,
13153,
11,
311,
70,
15878,
22093,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
42197,
62,
45849,
11,
311,
70,
15878,
24835,
8053,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
32541,
11,
311,
70,
15878,
8206,
8,
198,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
30238,
15878,
9487,
7,
28512,
7145,
1581,
44,
13,
50,
70,
15878,
13,
26087,
27064,
62,
25216,
62,
21886,
11,
311,
70,
15878,
28165,
8,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
8562,
7032,
198,
2,
198,
29113,
29113,
14468,
198,
198,
4871,
311,
70,
15878,
2389,
7,
50,
70,
15878,
5317,
2599,
198,
220,
705,
7061,
198,
220,
7663,
326,
5860,
262,
2560,
7232,
871,
5994,
13,
198,
220,
705,
7061,
628,
220,
1303,
2141,
407,
1249,
262,
2214,
284,
5793,
11,
645,
966,
287,
340,
13,
628,
220,
825,
12515,
378,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
8314,
2147,
329,
4522,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
318,
30562,
540,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
4522,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
19242,
28985,
10260,
7,
944,
11,
4938,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
4522,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
47139,
7,
944,
11,
4938,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
4522,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
11395,
4863,
28512,
7145,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
4522,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
26571,
7,
944,
11,
329,
15633,
28,
25101,
11,
2700,
28,
25101,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
4522,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
1988,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
1988,
286,
262,
4522,
2214,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
2116,
13557,
8367,
628,
220,
825,
4808,
8367,
50,
70,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
1988,
286,
262,
4522,
2214,
13,
628,
220,
220,
220,
1114,
4522,
7032,
428,
481,
1239,
12405,
34198,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
2116,
13557,
8367,
198,
198,
4871,
311,
70,
15878,
6030,
7,
50,
70,
15878,
8206,
2599,
198,
220,
705,
7061,
198,
220,
7663,
326,
5860,
262,
2560,
7232,
871,
5994,
13,
198,
220,
705,
7061,
628,
220,
1303,
2141,
407,
1249,
262,
2214,
284,
5793,
11,
645,
966,
287,
340,
13,
628,
220,
825,
12515,
378,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
5994,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
318,
30562,
540,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
5994,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
19242,
28985,
10260,
7,
944,
11,
4938,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
5994,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
47139,
7,
944,
11,
4938,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
5994,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
900,
11395,
4863,
28512,
7145,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
5994,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
26571,
7,
944,
11,
329,
15633,
28,
25101,
11,
2700,
28,
25101,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16622,
5860,
10352,
329,
5994,
7032,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
10352,
628,
220,
825,
1988,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
20885,
2099,
262,
2214,
14448,
284,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
2116,
13557,
8367,
628,
220,
825,
4808,
8367,
50,
70,
7,
944,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
16409,
262,
20885,
2099,
262,
2214,
14448,
284,
13,
628,
220,
220,
220,
1114,
5994,
7032,
428,
481,
1239,
12405,
34198,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
1441,
2116,
13557,
8367,
198
] | 2.556234 | 8,838 |
import numpy as np
| [
11748,
299,
32152,
355,
45941,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220
] | 1.333333 | 42 |
# Advent of Code 2018, Day 16
# (c) blu3r4y
from collections import namedtuple
from parse import parse
OPERATIONS = ['addr', 'addi', 'mulr', 'muli', 'banr', 'bani', 'borr', 'bori',
'setr', 'seti', 'gtir', 'gtri', 'gtrr', 'eqir', 'eqri', 'eqrr']
Observation = namedtuple("Observation", ["instruction", "before", "after"])
if __name__ == "__main__":
print(part1(_parse(open(r"../assets/day16.txt").readlines())[0]))
print(part2(*_parse(open(r"../assets/day16.txt").readlines())))
| [
2,
33732,
286,
6127,
2864,
11,
3596,
1467,
198,
2,
357,
66,
8,
48208,
18,
81,
19,
88,
198,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
198,
6738,
21136,
1330,
21136,
198,
198,
31054,
18421,
796,
37250,
29851,
3256,
705,
2860,
72,
3256,
705,
76,
377,
81,
3256,
705,
76,
32176,
3256,
705,
3820,
81,
3256,
705,
65,
3216,
3256,
705,
2865,
81,
3256,
705,
2865,
72,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2617,
81,
3256,
705,
2617,
72,
3256,
705,
13655,
343,
3256,
705,
13655,
380,
3256,
705,
70,
2213,
81,
3256,
705,
27363,
343,
3256,
705,
27363,
380,
3256,
705,
27363,
21062,
20520,
198,
198,
31310,
13208,
796,
3706,
83,
29291,
7203,
31310,
13208,
1600,
14631,
8625,
2762,
1600,
366,
19052,
1600,
366,
8499,
8973,
8,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
3601,
7,
3911,
16,
28264,
29572,
7,
9654,
7,
81,
1,
40720,
19668,
14,
820,
1433,
13,
14116,
11074,
961,
6615,
28955,
58,
15,
60,
4008,
198,
220,
220,
220,
3601,
7,
3911,
17,
46491,
62,
29572,
7,
9654,
7,
81,
1,
40720,
19668,
14,
820,
1433,
13,
14116,
11074,
961,
6615,
3419,
22305,
198
] | 2.40566 | 212 |
from keras.models import load_model
import keras.preprocessing.text as kpt
from keras.preprocessing.sequence import pad_sequences
import sys
import os
import json
import numpy as np
from utils import ConfigurationManager, FileManager
##
global dictionary
global model
dictionaryUrl = os.path.join(FileManager.getRootUrl(), 'tmp/wordindex.json')
dictionary = json.loads(FileManager.readFile(dictionaryUrl))
modelUrl = os.path.join(FileManager.getRootUrl(), 'tmp/code_model.h5')
model = load_model(modelUrl)
##
##
if __name__ == "__main__":
main()
| [
6738,
41927,
292,
13,
27530,
1330,
3440,
62,
19849,
198,
11748,
41927,
292,
13,
3866,
36948,
13,
5239,
355,
479,
457,
198,
6738,
41927,
292,
13,
3866,
36948,
13,
43167,
1330,
14841,
62,
3107,
3007,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
33918,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
3384,
4487,
1330,
28373,
13511,
11,
9220,
13511,
628,
198,
2235,
198,
198,
20541,
22155,
198,
20541,
2746,
198,
198,
67,
14188,
28165,
796,
28686,
13,
6978,
13,
22179,
7,
8979,
13511,
13,
1136,
30016,
28165,
22784,
705,
22065,
14,
4775,
9630,
13,
17752,
11537,
198,
67,
14188,
796,
33918,
13,
46030,
7,
8979,
13511,
13,
961,
8979,
7,
67,
14188,
28165,
4008,
198,
198,
19849,
28165,
796,
28686,
13,
6978,
13,
22179,
7,
8979,
13511,
13,
1136,
30016,
28165,
22784,
705,
22065,
14,
8189,
62,
19849,
13,
71,
20,
11537,
198,
19849,
796,
3440,
62,
19849,
7,
19849,
28165,
8,
628,
198,
2235,
628,
198,
198,
2235,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 3.139665 | 179 |
import pandas as pd
from PIL import Image # www.pythonware.com/library/pil/handbook
from PIL import ImageFont, ImageDraw, ImageEnhance
from PIL import ImageFilter
import os
#import time
import logging
from Animate.Items import *
from Animate.Properties import *
from Animate.Constants import *
LOG_FILENAME = '__logfile.txt'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
| [
11748,
19798,
292,
355,
279,
67,
198,
198,
6738,
350,
4146,
1330,
7412,
1303,
7324,
13,
29412,
1574,
13,
785,
14,
32016,
14,
79,
346,
14,
4993,
2070,
198,
6738,
350,
4146,
1330,
7412,
23252,
11,
7412,
25302,
11,
7412,
35476,
590,
198,
6738,
350,
4146,
1330,
7412,
22417,
198,
198,
11748,
28686,
198,
2,
11748,
640,
198,
11748,
18931,
628,
198,
6738,
1052,
1920,
13,
23022,
1330,
1635,
198,
6738,
1052,
1920,
13,
2964,
18200,
1330,
1635,
198,
6738,
1052,
1920,
13,
34184,
1187,
1330,
1635,
198,
198,
25294,
62,
46700,
1677,
10067,
796,
705,
834,
6404,
7753,
13,
14116,
6,
198,
6404,
2667,
13,
35487,
16934,
7,
34345,
28,
25294,
62,
46700,
1677,
10067,
11,
5715,
28,
6404,
2667,
13,
30531,
8,
628,
628
] | 3.142857 | 126 |
import os
def get_project_folder():
'''
Gives us the path to MGR-Project-Code from a list of allowed folders.
:return:
'''
PATH_ALTERNATIVES = ['/home/ekmek/Project II/MGR-Project-Code/', '/storage/brno2/home/previtus/MGR-Project-Code/', '/home/ekmek/Vitek/MGR-Project-Code/']
ABS_PATH_TO_PRJ = use_path_which_exists(PATH_ALTERNATIVES)
return ABS_PATH_TO_PRJ
def get_geojson_path():
'''
Gives us the path directly to attractivity_previtus_data_1_edges.geojson from a list of allowed paths
:return:
'''
folders = ['/home/ekmek/Desktop/Project II/graph_new_data/',
'/home/ekmek/Vitek/graph_new_data/',
'/storage/brno2/home/previtus/important_files/']
folder = use_path_which_exists(folders)
return folder+'attractivity_previtus_data_1_edges.geojson'
def use_path_which_exists(list_of_possible_paths):
'''
From a list of possible paths choose the one which exists.
:param list_of_possible_paths: possible paths
:return: working path
'''
used_path = ''
for path in list_of_possible_paths:
if os.path.exists(path):
used_path = path
if used_path == '':
print "Error, cannot locate the path of project, will likely fail!"
return used_path
def file_exists(fname):
''' Does file exist, returns boolean.'''
return os.path.isfile(fname)
def get_folder_from_file(fname):
''' Get folder name from path to a file.'''
return os.path.dirname(fname) + '/'
def folder_exists(directory):
''' Does folder with this name exist, returns boolean'''
return os.path.exists(directory)
def make_folder_ifItDoesntExist(directory):
''' Make a new directory, if it didn't previously exist.'''
if not os.path.exists(directory):
os.makedirs(directory)
import shutil, errno
def copy_folder(src, dst):
''' Copy and paste folders. Used for dataset augmentation.'''
try:
shutil.copytree(src, dst)
except OSError as exc: # python >2.5
if exc.errno == errno.ENOTDIR:
shutil.copy(src, dst)
else: raise
def copy_file(src, dst):
''' Copy and paste file.'''
try:
shutil.copy(src, dst)
except OSError as exc:
raise
import hashlib
def md5(fname):
''' Get md5 hash of a file.'''
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
| [
11748,
28686,
198,
198,
4299,
651,
62,
16302,
62,
43551,
33529,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
402,
1083,
514,
262,
3108,
284,
337,
10761,
12,
16775,
12,
10669,
422,
257,
1351,
286,
3142,
24512,
13,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
46490,
62,
1847,
31800,
1404,
42472,
796,
685,
26488,
11195,
14,
988,
76,
988,
14,
16775,
2873,
14,
44,
10761,
12,
16775,
12,
10669,
14,
3256,
31051,
35350,
14,
1671,
3919,
17,
14,
11195,
14,
47050,
17506,
14,
44,
10761,
12,
16775,
12,
10669,
14,
3256,
31051,
11195,
14,
988,
76,
988,
14,
53,
578,
74,
14,
44,
10761,
12,
16775,
12,
10669,
14,
20520,
198,
220,
220,
220,
29950,
62,
34219,
62,
10468,
62,
4805,
41,
796,
779,
62,
6978,
62,
4758,
62,
1069,
1023,
7,
34219,
62,
1847,
31800,
1404,
42472,
8,
198,
220,
220,
220,
1441,
29950,
62,
34219,
62,
10468,
62,
4805,
41,
198,
198,
4299,
651,
62,
469,
13210,
1559,
62,
6978,
33529,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
402,
1083,
514,
262,
3108,
3264,
284,
4729,
3458,
62,
47050,
17506,
62,
7890,
62,
16,
62,
276,
3212,
13,
469,
13210,
1559,
422,
257,
1351,
286,
3142,
13532,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
24512,
796,
685,
26488,
11195,
14,
988,
76,
988,
14,
36881,
14,
16775,
2873,
14,
34960,
62,
3605,
62,
7890,
14,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31051,
11195,
14,
988,
76,
988,
14,
53,
578,
74,
14,
34960,
62,
3605,
62,
7890,
14,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31051,
35350,
14,
1671,
3919,
17,
14,
11195,
14,
47050,
17506,
14,
18049,
62,
16624,
14,
20520,
198,
220,
220,
220,
9483,
796,
779,
62,
6978,
62,
4758,
62,
1069,
1023,
7,
11379,
364,
8,
628,
220,
220,
220,
1441,
9483,
10,
6,
1078,
974,
3458,
62,
47050,
17506,
62,
7890,
62,
16,
62,
276,
3212,
13,
469,
13210,
1559,
6,
198,
198,
4299,
779,
62,
6978,
62,
4758,
62,
1069,
1023,
7,
4868,
62,
1659,
62,
79,
4733,
62,
6978,
82,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3574,
257,
1351,
286,
1744,
13532,
3853,
262,
530,
543,
7160,
13,
198,
220,
220,
220,
1058,
17143,
1351,
62,
1659,
62,
79,
4733,
62,
6978,
82,
25,
1744,
13532,
198,
220,
220,
220,
1058,
7783,
25,
1762,
3108,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
973,
62,
6978,
796,
10148,
628,
220,
220,
220,
329,
3108,
287,
1351,
62,
1659,
62,
79,
4733,
62,
6978,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
28686,
13,
6978,
13,
1069,
1023,
7,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
973,
62,
6978,
796,
3108,
628,
220,
220,
220,
611,
973,
62,
6978,
6624,
10148,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
366,
12331,
11,
2314,
17276,
262,
3108,
286,
1628,
11,
481,
1884,
2038,
2474,
628,
220,
220,
220,
1441,
973,
62,
6978,
198,
198,
4299,
2393,
62,
1069,
1023,
7,
69,
3672,
2599,
198,
220,
220,
220,
705,
7061,
8314,
2393,
2152,
11,
5860,
25131,
2637,
7061,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
4468,
576,
7,
69,
3672,
8,
198,
198,
4299,
651,
62,
43551,
62,
6738,
62,
7753,
7,
69,
3672,
2599,
198,
220,
220,
220,
705,
7061,
3497,
9483,
1438,
422,
3108,
284,
257,
2393,
2637,
7061,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
15908,
3672,
7,
69,
3672,
8,
1343,
31051,
6,
198,
198,
4299,
9483,
62,
1069,
1023,
7,
34945,
2599,
198,
220,
220,
220,
705,
7061,
8314,
9483,
351,
428,
1438,
2152,
11,
5860,
25131,
7061,
6,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
1069,
1023,
7,
34945,
8,
198,
198,
4299,
787,
62,
43551,
62,
361,
1026,
13921,
429,
3109,
396,
7,
34945,
2599,
198,
220,
220,
220,
705,
7061,
6889,
257,
649,
8619,
11,
611,
340,
1422,
470,
4271,
2152,
2637,
7061,
198,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
34945,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
34945,
8,
198,
198,
11748,
4423,
346,
11,
11454,
3919,
198,
4299,
4866,
62,
43551,
7,
10677,
11,
29636,
2599,
198,
220,
220,
220,
705,
7061,
17393,
290,
17008,
24512,
13,
16718,
329,
27039,
16339,
14374,
2637,
7061,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4423,
346,
13,
30073,
21048,
7,
10677,
11,
29636,
8,
198,
220,
220,
220,
2845,
440,
5188,
81,
1472,
355,
2859,
25,
1303,
21015,
1875,
17,
13,
20,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2859,
13,
8056,
3919,
6624,
11454,
3919,
13,
1677,
2394,
34720,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4423,
346,
13,
30073,
7,
10677,
11,
29636,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
5298,
198,
198,
4299,
4866,
62,
7753,
7,
10677,
11,
29636,
2599,
198,
220,
220,
220,
705,
7061,
17393,
290,
17008,
2393,
2637,
7061,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4423,
346,
13,
30073,
7,
10677,
11,
29636,
8,
198,
220,
220,
220,
2845,
440,
5188,
81,
1472,
355,
2859,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
198,
198,
11748,
12234,
8019,
198,
4299,
45243,
20,
7,
69,
3672,
2599,
198,
220,
220,
220,
705,
7061,
3497,
45243,
20,
12234,
286,
257,
2393,
2637,
7061,
198,
220,
220,
220,
12234,
62,
9132,
20,
796,
12234,
8019,
13,
9132,
20,
3419,
198,
220,
220,
220,
351,
1280,
7,
69,
3672,
11,
366,
26145,
4943,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
329,
16058,
287,
11629,
7,
50033,
25,
277,
13,
961,
7,
1821,
4846,
828,
275,
15931,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12234,
62,
9132,
20,
13,
19119,
7,
354,
2954,
8,
198,
220,
220,
220,
1441,
12234,
62,
9132,
20,
13,
33095,
12894,
395,
3419,
198
] | 2.356808 | 1,065 |
# from sympy import *
# Robot Chassis Parameters
l = 370 #hip to hip length of the robot
b = 210.1 #hip to hip breadth of the robot
h = 44 #height of the robot
## Leg Type 1: Rear
'''
Variable name convention as follows:
The first number represents the length and the second number represents the Leg Type
l11 is the hip to knee length of Leg Type 1
l21 is the knee to ankle length of Leg Type 1
l22 is the knee to ankle length of Leg Type 2
and so on...
'''
# Defining lengths and offsets
l11 = 160 #hip to knee length
l21 = 160 #knee to ankle length
l3 = 39 #ankle to toe length
d1 = 37 #hip offset
d2 = 12.95 #knee offset
'''
Variable name convention as follows:
The first number represents the angle and the second number represents the Leg #
theta11 is the hip rotation angle of Leg 1
theta21 is the knee roation angle of Leg 1
theta31 is the ankle roation angle of Leg 1
theta14 is the hip rotation angle of Leg 4
and so on...
'''
# theta11, alpha11, theta21, alpha21, theta31, alpha31 = symbols("theta11 alpha11 theta21 alpha21 theta31 alpha31")
# theta14, alpha14, theta24, alpha24, theta34, alpha34 = symbols("theta14 alpha14 theta24 alpha24 theta34 alpha34")
## Leg Type 2: Front
# Defining lengths and offsets
l12 = 160 #hip to knee length
l22 = 173.5 #knee to ankle length
# theta12, alpha12, theta22, alpha22 = symbols("theta12 alpha12 theta22 alpha22")
# theta13, alpha13, theta23, alpha23 = symbols("theta13 alpha13 theta23 alpha23")
| [
2,
422,
10558,
88,
1330,
1635,
201,
198,
201,
198,
2,
16071,
609,
20297,
40117,
201,
198,
75,
796,
28687,
220,
220,
220,
220,
220,
220,
1303,
1056,
284,
10359,
4129,
286,
262,
9379,
201,
198,
65,
796,
20064,
13,
16,
220,
220,
220,
220,
1303,
1056,
284,
10359,
32483,
286,
262,
9379,
201,
198,
71,
796,
5846,
220,
220,
220,
220,
220,
220,
220,
1303,
17015,
286,
262,
9379,
201,
198,
201,
198,
2235,
3564,
5994,
352,
25,
30144,
201,
198,
201,
198,
7061,
6,
201,
198,
43015,
1438,
9831,
355,
5679,
25,
201,
198,
201,
198,
464,
717,
1271,
6870,
262,
4129,
290,
262,
1218,
1271,
6870,
262,
3564,
5994,
201,
198,
201,
198,
75,
1157,
318,
262,
10359,
284,
10329,
4129,
286,
3564,
5994,
352,
201,
198,
75,
2481,
318,
262,
10329,
284,
19847,
4129,
286,
3564,
5994,
352,
201,
198,
201,
198,
75,
1828,
318,
262,
10329,
284,
19847,
4129,
286,
3564,
5994,
362,
201,
198,
392,
523,
319,
986,
201,
198,
201,
198,
7061,
6,
201,
198,
201,
198,
2,
2896,
3191,
20428,
290,
49005,
201,
198,
75,
1157,
796,
13454,
220,
220,
220,
220,
220,
1303,
1056,
284,
10329,
4129,
201,
198,
75,
2481,
796,
13454,
220,
220,
220,
220,
220,
1303,
74,
21381,
284,
19847,
4129,
201,
198,
75,
18,
796,
5014,
220,
220,
220,
220,
220,
220,
220,
1303,
962,
293,
284,
21189,
4129,
201,
198,
67,
16,
796,
5214,
220,
220,
220,
220,
220,
220,
220,
1303,
1056,
11677,
201,
198,
67,
17,
796,
1105,
13,
3865,
220,
220,
220,
220,
1303,
74,
21381,
11677,
201,
198,
201,
198,
7061,
6,
201,
198,
43015,
1438,
9831,
355,
5679,
25,
201,
198,
201,
198,
464,
717,
1271,
6870,
262,
9848,
290,
262,
1218,
1271,
6870,
262,
3564,
1303,
201,
198,
201,
198,
1169,
8326,
1157,
318,
262,
10359,
13179,
9848,
286,
3564,
352,
201,
198,
1169,
8326,
2481,
318,
262,
10329,
686,
341,
9848,
286,
3564,
352,
201,
198,
1169,
8326,
3132,
318,
262,
19847,
686,
341,
9848,
286,
3564,
352,
201,
198,
201,
198,
1169,
8326,
1415,
318,
262,
10359,
13179,
9848,
286,
3564,
604,
201,
198,
392,
523,
319,
986,
201,
198,
201,
198,
7061,
6,
201,
198,
201,
198,
2,
262,
8326,
1157,
11,
17130,
1157,
11,
262,
8326,
2481,
11,
17130,
2481,
11,
262,
8326,
3132,
11,
17130,
3132,
796,
14354,
7203,
1169,
8326,
1157,
17130,
1157,
262,
8326,
2481,
17130,
2481,
262,
8326,
3132,
17130,
3132,
4943,
201,
198,
2,
262,
8326,
1415,
11,
17130,
1415,
11,
262,
8326,
1731,
11,
17130,
1731,
11,
262,
8326,
2682,
11,
17130,
2682,
796,
14354,
7203,
1169,
8326,
1415,
17130,
1415,
262,
8326,
1731,
17130,
1731,
262,
8326,
2682,
17130,
2682,
4943,
201,
198,
201,
198,
201,
198,
2235,
3564,
5994,
362,
25,
8880,
201,
198,
201,
198,
2,
2896,
3191,
20428,
290,
49005,
201,
198,
75,
1065,
796,
13454,
220,
220,
220,
220,
220,
1303,
1056,
284,
10329,
4129,
201,
198,
75,
1828,
796,
28174,
13,
20,
220,
220,
220,
1303,
74,
21381,
284,
19847,
4129,
201,
198,
201,
198,
2,
262,
8326,
1065,
11,
17130,
1065,
11,
262,
8326,
1828,
11,
17130,
1828,
796,
14354,
7203,
1169,
8326,
1065,
17130,
1065,
262,
8326,
1828,
17130,
1828,
4943,
201,
198,
2,
262,
8326,
1485,
11,
17130,
1485,
11,
262,
8326,
1954,
11,
17130,
1954,
796,
14354,
7203,
1169,
8326,
1485,
17130,
1485,
262,
8326,
1954,
17130,
1954,
4943,
201,
198
] | 2.758319 | 571 |
from math import floor, log10
| [
6738,
10688,
1330,
4314,
11,
2604,
940,
198
] | 3.75 | 8 |
import folium
import csv
from folium.plugins import MarkerCluster
def main():
"""
Creates a map of nodes with available SSH connection.\n
:return: map_ssh.html file
"""
map_ssh = folium.Map(location=[45.523, -122.675],
zoom_start=2)
with open('lib/base_data.txt') as tsv:
for row in csv.reader(tsv, delimiter='\t'):
name = row[0]
try:
x = float(row[1])
y = float(row[2])
print(" %s " % name)
folium.Marker([x, y], popup=name).add_to(map_ssh)
except ValueError:
pass
map_ssh.save('map_ssh.html')
if __name__ == "__main__":
main()
| [
11748,
5955,
1505,
198,
11748,
269,
21370,
198,
6738,
5955,
1505,
13,
37390,
1330,
2940,
263,
2601,
5819,
628,
198,
4299,
1388,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7921,
274,
257,
3975,
286,
13760,
351,
1695,
33825,
4637,
13,
59,
77,
198,
220,
220,
220,
1058,
7783,
25,
3975,
62,
45824,
13,
6494,
2393,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3975,
62,
45824,
796,
5955,
1505,
13,
13912,
7,
24886,
41888,
2231,
13,
49803,
11,
532,
18376,
13,
42444,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19792,
62,
9688,
28,
17,
8,
628,
220,
220,
220,
351,
1280,
10786,
8019,
14,
8692,
62,
7890,
13,
14116,
11537,
355,
256,
21370,
25,
198,
220,
220,
220,
220,
220,
220,
220,
329,
5752,
287,
269,
21370,
13,
46862,
7,
912,
85,
11,
46728,
2676,
11639,
59,
83,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
5752,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
12178,
7,
808,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
796,
12178,
7,
808,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
4064,
82,
366,
4064,
1438,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5955,
1505,
13,
9704,
263,
26933,
87,
11,
331,
4357,
46207,
28,
3672,
737,
2860,
62,
1462,
7,
8899,
62,
45824,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
11052,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1208,
628,
220,
220,
220,
3975,
62,
45824,
13,
21928,
10786,
8899,
62,
45824,
13,
6494,
11537,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 1.919571 | 373 |
#!/usr/bin/env python3
ans = 0
with open("input.txt") as f:
for line in f:
ans += 2 + line.count("\\") + line.count("\"")
print(ans)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
504,
796,
657,
198,
4480,
1280,
7203,
15414,
13,
14116,
4943,
355,
277,
25,
198,
220,
220,
220,
329,
1627,
287,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
9093,
15853,
362,
1343,
1627,
13,
9127,
7203,
6852,
4943,
1343,
1627,
13,
9127,
7203,
7879,
4943,
198,
4798,
7,
504,
8,
198
] | 2.246154 | 65 |
"""
Copyright (c) 2015 Marshall Farrier
license http://opensource.org/licenses/MIT
lib/ui/edit_menu.py
Content for interactive editor
"""
from functools import partial
from .obs_handlers import ObsHandlers
from .menu import Menu
from .spread_selector import SpreadSelector
| [
37811,
198,
15269,
357,
66,
8,
1853,
13606,
6755,
5277,
198,
43085,
2638,
1378,
44813,
1668,
13,
2398,
14,
677,
4541,
14,
36393,
198,
198,
8019,
14,
9019,
14,
19312,
62,
26272,
13,
9078,
198,
198,
19746,
329,
14333,
5464,
198,
37811,
198,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
198,
6738,
764,
8158,
62,
4993,
8116,
1330,
11086,
12885,
8116,
198,
6738,
764,
26272,
1330,
21860,
198,
6738,
764,
43639,
62,
19738,
273,
1330,
31843,
17563,
273,
198
] | 3.4625 | 80 |
import numpy as np
from uwb.generator import BlobGenerator
from uwb.map import NoiseMapNormal
| [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
334,
39346,
13,
8612,
1352,
1330,
1086,
672,
8645,
1352,
198,
6738,
334,
39346,
13,
8899,
1330,
30964,
13912,
26447,
628,
628
] | 3.266667 | 30 |
import sklearn
from classifiers.classification_model import ClassificationModel
| [
11748,
1341,
35720,
201,
198,
201,
198,
6738,
1398,
13350,
13,
4871,
2649,
62,
19849,
1330,
40984,
17633,
201,
198,
201,
198
] | 3.909091 | 22 |
"""A helper for running inference callable multiple times, and ensemble the
predictions with a simple majority vote.
"""
from typing import Callable
from collections import Counter
def majority_vote_ensemble(eval_func: Callable, num_runs: int):
"""
Args:
eval_func: call without argument to get a prediction or
a list of predictions.
num_runs: how many times to run the eval_func to get the predictions
Returns:
a prediction or a list of predictions after majority vote.
"""
if num_runs == 1:
return eval_func()
all_predictions = [eval_func() for _ in range(num_runs)]
if not isinstance(all_predictions[0][0], list):
# eval func gives single prediction
return _vote(all_predictions)
else:
# eval func gives a list of predictions
results = list()
for i in range(len(all_predictions[0])):
results.append(_vote([pred_list[i]
for pred_list in all_predictions]))
return results
| [
37811,
32,
31904,
329,
2491,
32278,
869,
540,
3294,
1661,
11,
290,
34549,
262,
198,
28764,
9278,
351,
257,
2829,
3741,
3015,
13,
198,
37811,
198,
198,
6738,
19720,
1330,
4889,
540,
198,
6738,
17268,
1330,
15034,
628,
198,
4299,
3741,
62,
27257,
62,
1072,
11306,
7,
18206,
62,
20786,
25,
4889,
540,
11,
997,
62,
48381,
25,
493,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5418,
62,
20786,
25,
869,
1231,
4578,
284,
651,
257,
17724,
393,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
1351,
286,
16277,
13,
198,
220,
220,
220,
220,
220,
220,
220,
997,
62,
48381,
25,
703,
867,
1661,
284,
1057,
262,
5418,
62,
20786,
284,
651,
262,
16277,
198,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
257,
17724,
393,
257,
1351,
286,
16277,
706,
3741,
3015,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
997,
62,
48381,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
5418,
62,
20786,
3419,
198,
220,
220,
220,
220,
198,
220,
220,
220,
477,
62,
28764,
9278,
796,
685,
18206,
62,
20786,
3419,
329,
4808,
287,
2837,
7,
22510,
62,
48381,
15437,
198,
220,
220,
220,
611,
407,
318,
39098,
7,
439,
62,
28764,
9278,
58,
15,
7131,
15,
4357,
1351,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5418,
25439,
3607,
2060,
17724,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4808,
27257,
7,
439,
62,
28764,
9278,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5418,
25439,
3607,
257,
1351,
286,
16277,
198,
220,
220,
220,
220,
220,
220,
220,
2482,
796,
1351,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
2837,
7,
11925,
7,
439,
62,
28764,
9278,
58,
15,
12962,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2482,
13,
33295,
28264,
27257,
26933,
28764,
62,
4868,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2747,
62,
4868,
287,
477,
62,
28764,
9278,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2482,
198
] | 2.601485 | 404 |
import logging
import os
import shutil
import subprocess
import psutil
from patroni.postgresql import Postgresql
logger = logging.getLogger(__name__)
| [
11748,
18931,
198,
11748,
28686,
198,
11748,
4423,
346,
198,
11748,
850,
14681,
198,
11748,
26692,
22602,
198,
198,
6738,
19686,
72,
13,
7353,
34239,
13976,
1330,
2947,
34239,
13976,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198
] | 3.276596 | 47 |
__all__ = ["tosca_parser", "tosca_rdcl_graph"] | [
834,
439,
834,
796,
14631,
83,
418,
6888,
62,
48610,
1600,
366,
83,
418,
6888,
62,
4372,
565,
62,
34960,
8973
] | 2.190476 | 21 |