content
stringlengths 1
1.04M
| input_ids
sequencelengths 1
774k
| ratio_char_token
float64 0.38
22.9
| token_count
int64 1
774k
|
---|---|---|---|
import unittest
from partname_resolver.components.inductor import Inductor
from partname_resolver.units.temperature import TemperatureRange
| [
11748,
555,
715,
395,
198,
6738,
636,
3672,
62,
411,
14375,
13,
5589,
3906,
13,
10259,
2715,
1330,
1423,
33029,
198,
6738,
636,
3672,
62,
411,
14375,
13,
41667,
13,
11498,
21069,
1330,
34467,
17257,
628
] | 3.916667 | 36 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 CESNET.
#
# CESNET-OpenID-Remote is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""CESNET OIDC Auth backend for OARepo"""
import os
from setuptools import find_packages, setup
readme = open('README.md').read()
history = open('CHANGES.rst').read()
OAREPO_VERSION = os.environ.get('OAREPO_VERSION', '3.3.0')
tests_require = [
'pydocstyle',
'isort',
'oarepo-communities>=1.1.0',
'invenio-oauthclient==1.4.0'
]
extras_require = {
'tests': [
'oarepo[tests]~={version}'.format(version=OAREPO_VERSION),
*tests_require
]
}
extras_require['all'] = []
for reqs in extras_require.values():
extras_require['all'].extend(reqs)
setup_requires = [
]
install_requires = [
'urnparse>=0.2.0',
'invenio-openid-connect>=2.1.0',
]
packages = find_packages(exclude=['examples', 'tests'])
# Get the version string. Cannot be done with import!
g = {}
with open(os.path.join('cesnet_openid_remote', 'version.py'), 'rt') as fp:
exec(fp.read(), g)
version = g['__version__']
setup(
name='cesnet-openid-remote',
version=version,
description=__doc__,
long_description=readme + '\n\n' + history,
long_description_content_type='text/markdown',
keywords='invenio oarepo oauth openidc auth groups',
license='MIT',
author='Miroslav Bauer',
author_email='[email protected]',
url='https://github.com/oarepo/cesnet-openid-remote',
packages=packages,
zip_safe=False,
include_package_data=True,
platforms='any',
entry_points={
'flask.commands': [
'cesnet:group = cesnet_openid_remote.cli:cesnet_group',
],
'invenio_base.apps': [
'cesnet_openid_remote = cesnet_openid_remote:CESNETOpenIDRemote',
],
# TODO: Edit these entry points to fit your needs.
# 'invenio_access.actions': [],
# 'invenio_admin.actions': [],
# 'invenio_assets.bundles': [],
'invenio_base.api_apps': [
'cesnet_openid_remote = cesnet_openid_remote:CESNETOpenIDRemote',
],
# 'invenio_base.api_blueprints': [],
# 'invenio_base.blueprints': [],
# 'invenio_celery.tasks': [],
'invenio_db.models': [
'cesnet_openid_remote = cesnet_openid_remote.models',
],
'invenio_db.alembic': [
'cesnet_openid_remote = cesnet_openid_remote:alembic',
],
# 'invenio_pidstore.minters': [],
# 'invenio_records.jsonresolver': [],
},
extras_require=extras_require,
install_requires=install_requires,
setup_requires=setup_requires,
tests_require=tests_require,
classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Development Status :: 1 - Planning',
],
)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
15069,
357,
34,
8,
33448,
42700,
12884,
13,
198,
2,
198,
2,
42700,
12884,
12,
11505,
2389,
12,
36510,
318,
1479,
3788,
26,
345,
460,
17678,
4163,
340,
290,
14,
273,
198,
2,
13096,
340,
739,
262,
2846,
286,
262,
17168,
13789,
26,
766,
38559,
24290,
2393,
329,
517,
198,
2,
3307,
13,
198,
198,
37811,
34,
1546,
12884,
440,
2389,
34,
26828,
30203,
329,
440,
1503,
538,
78,
37811,
198,
198,
11748,
28686,
198,
198,
6738,
900,
37623,
10141,
1330,
1064,
62,
43789,
11,
9058,
198,
198,
961,
1326,
796,
1280,
10786,
15675,
11682,
13,
9132,
27691,
961,
3419,
198,
23569,
796,
1280,
10786,
3398,
15567,
1546,
13,
81,
301,
27691,
961,
3419,
198,
198,
46,
1503,
8905,
46,
62,
43717,
796,
28686,
13,
268,
2268,
13,
1136,
10786,
46,
1503,
8905,
46,
62,
43717,
3256,
705,
18,
13,
18,
13,
15,
11537,
198,
198,
41989,
62,
46115,
796,
685,
198,
220,
220,
220,
705,
79,
5173,
420,
7635,
3256,
198,
220,
220,
220,
705,
271,
419,
3256,
198,
220,
220,
220,
705,
78,
533,
7501,
12,
10709,
871,
29,
28,
16,
13,
16,
13,
15,
3256,
198,
220,
220,
220,
705,
259,
574,
952,
12,
12162,
1071,
16366,
855,
16,
13,
19,
13,
15,
6,
198,
60,
198,
198,
2302,
8847,
62,
46115,
796,
1391,
198,
220,
220,
220,
705,
41989,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
705,
78,
533,
7501,
58,
41989,
60,
93,
34758,
9641,
92,
4458,
18982,
7,
9641,
28,
46,
1503,
8905,
46,
62,
43717,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1635,
41989,
62,
46115,
198,
220,
220,
220,
2361,
198,
92,
198,
198,
2302,
8847,
62,
46115,
17816,
439,
20520,
796,
17635,
198,
1640,
43089,
82,
287,
33849,
62,
46115,
13,
27160,
33529,
198,
220,
220,
220,
33849,
62,
46115,
17816,
439,
6,
4083,
2302,
437,
7,
42180,
82,
8,
198,
198,
40406,
62,
47911,
796,
685,
198,
60,
198,
198,
17350,
62,
47911,
796,
685,
198,
220,
220,
220,
705,
700,
29572,
29,
28,
15,
13,
17,
13,
15,
3256,
198,
220,
220,
220,
705,
259,
574,
952,
12,
9654,
312,
12,
8443,
29,
28,
17,
13,
16,
13,
15,
3256,
198,
60,
198,
198,
43789,
796,
1064,
62,
43789,
7,
1069,
9152,
28,
17816,
1069,
12629,
3256,
705,
41989,
6,
12962,
628,
198,
2,
3497,
262,
2196,
4731,
13,
26003,
307,
1760,
351,
1330,
0,
198,
70,
796,
23884,
198,
4480,
1280,
7,
418,
13,
6978,
13,
22179,
10786,
728,
3262,
62,
9654,
312,
62,
47960,
3256,
705,
9641,
13,
9078,
33809,
705,
17034,
11537,
355,
277,
79,
25,
198,
220,
220,
220,
2452,
7,
46428,
13,
961,
22784,
308,
8,
198,
220,
220,
220,
2196,
796,
308,
17816,
834,
9641,
834,
20520,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
11639,
728,
3262,
12,
9654,
312,
12,
47960,
3256,
198,
220,
220,
220,
2196,
28,
9641,
11,
198,
220,
220,
220,
6764,
28,
834,
15390,
834,
11,
198,
220,
220,
220,
890,
62,
11213,
28,
961,
1326,
1343,
705,
59,
77,
59,
77,
6,
1343,
2106,
11,
198,
220,
220,
220,
890,
62,
11213,
62,
11299,
62,
4906,
11639,
5239,
14,
4102,
2902,
3256,
198,
220,
220,
220,
26286,
11639,
259,
574,
952,
267,
533,
7501,
267,
18439,
1280,
312,
66,
6284,
2628,
3256,
198,
220,
220,
220,
5964,
11639,
36393,
3256,
198,
220,
220,
220,
1772,
11639,
41541,
4951,
18809,
41971,
3256,
198,
220,
220,
220,
1772,
62,
12888,
11639,
65,
16261,
31,
728,
3262,
13,
26691,
3256,
198,
220,
220,
220,
19016,
11639,
5450,
1378,
12567,
13,
785,
14,
78,
533,
7501,
14,
728,
3262,
12,
9654,
312,
12,
47960,
3256,
198,
220,
220,
220,
10392,
28,
43789,
11,
198,
220,
220,
220,
19974,
62,
21230,
28,
25101,
11,
198,
220,
220,
220,
2291,
62,
26495,
62,
7890,
28,
17821,
11,
198,
220,
220,
220,
9554,
11639,
1092,
3256,
198,
220,
220,
220,
5726,
62,
13033,
34758,
198,
220,
220,
220,
220,
220,
220,
220,
705,
2704,
2093,
13,
9503,
1746,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
728,
3262,
25,
8094,
796,
269,
274,
3262,
62,
9654,
312,
62,
47960,
13,
44506,
25,
728,
3262,
62,
8094,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
705,
259,
574,
952,
62,
8692,
13,
18211,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
728,
3262,
62,
9654,
312,
62,
47960,
796,
269,
274,
3262,
62,
9654,
312,
62,
47960,
25,
34,
1546,
12884,
11505,
2389,
36510,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
25,
5312,
777,
5726,
2173,
284,
4197,
534,
2476,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
15526,
13,
4658,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
28482,
13,
4658,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
19668,
13,
65,
917,
829,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
705,
259,
574,
952,
62,
8692,
13,
15042,
62,
18211,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
728,
3262,
62,
9654,
312,
62,
47960,
796,
269,
274,
3262,
62,
9654,
312,
62,
47960,
25,
34,
1546,
12884,
11505,
2389,
36510,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
8692,
13,
15042,
62,
17585,
17190,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
8692,
13,
17585,
17190,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
7015,
88,
13,
83,
6791,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
705,
259,
574,
952,
62,
9945,
13,
27530,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
728,
3262,
62,
9654,
312,
62,
47960,
796,
269,
274,
3262,
62,
9654,
312,
62,
47960,
13,
27530,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
705,
259,
574,
952,
62,
9945,
13,
282,
24419,
291,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
728,
3262,
62,
9654,
312,
62,
47960,
796,
269,
274,
3262,
62,
9654,
312,
62,
47960,
25,
282,
24419,
291,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
35317,
8095,
13,
1084,
1010,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
259,
574,
952,
62,
8344,
3669,
13,
17752,
411,
14375,
10354,
685,
4357,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
33849,
62,
46115,
28,
2302,
8847,
62,
46115,
11,
198,
220,
220,
220,
2721,
62,
47911,
28,
17350,
62,
47911,
11,
198,
220,
220,
220,
9058,
62,
47911,
28,
40406,
62,
47911,
11,
198,
220,
220,
220,
5254,
62,
46115,
28,
41989,
62,
46115,
11,
198,
220,
220,
220,
1398,
13350,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
705,
31441,
7904,
5313,
9344,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
5317,
1631,
7591,
1240,
7904,
34152,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
34156,
7904,
7294,
40,
20010,
1079,
7904,
17168,
13789,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
18843,
803,
4482,
7904,
7294,
13362,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
33221,
7904,
4455,
7904,
13505,
54,
14,
40717,
7904,
26977,
14041,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
33221,
7904,
10442,
7712,
7904,
46267,
7904,
11361,
3401,
5028,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
21,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
22,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
23,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
24,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
41206,
12678,
7904,
352,
532,
21913,
3256,
198,
220,
220,
220,
16589,
198,
8,
198
] | 2.322733 | 1,478 |
high_resource_language_list = [
'bg', 'cs', 'da', 'de', 'en', 'es', 'eu', 'fa', 'fi', 'fr', 'he', 'hi',
'hr', 'id', 'it', 'nl', 'no', 'pl', 'pt', 'sl', 'sv'
]
low_resource_language_list = [
'el', 'et', 'ga', 'hu', 'ro', 'ta'
]
extra_language_list_ud12 = [
'ar', 'cu', 'fi_ftb', 'got', 'grc', 'grc_proiel',
'la', 'la_itt', 'la_proiel'
]
extra_low_resource_language_list_ud26 = [
'be_hse', 'cop_scriptorium', 'lt_hse', 'mr_ufal', 'ta_ttb', 'te_mtg'
]
| [
8929,
62,
31092,
62,
16129,
62,
4868,
796,
685,
198,
220,
220,
220,
705,
35904,
3256,
705,
6359,
3256,
705,
6814,
3256,
705,
2934,
3256,
705,
268,
3256,
705,
274,
3256,
705,
12496,
3256,
705,
13331,
3256,
705,
12463,
3256,
705,
8310,
3256,
705,
258,
3256,
705,
5303,
3256,
220,
198,
220,
220,
220,
705,
11840,
3256,
705,
312,
3256,
705,
270,
3256,
705,
21283,
3256,
705,
3919,
3256,
705,
489,
3256,
705,
457,
3256,
705,
6649,
3256,
705,
21370,
6,
198,
60,
198,
9319,
62,
31092,
62,
16129,
62,
4868,
796,
685,
198,
220,
220,
220,
705,
417,
3256,
705,
316,
3256,
705,
4908,
3256,
705,
13415,
3256,
705,
305,
3256,
705,
8326,
6,
198,
60,
198,
26086,
62,
16129,
62,
4868,
62,
463,
1065,
796,
685,
198,
220,
220,
220,
705,
283,
3256,
705,
27399,
3256,
220,
705,
12463,
62,
701,
65,
3256,
705,
23442,
3256,
705,
2164,
66,
3256,
705,
2164,
66,
62,
1676,
8207,
3256,
220,
198,
220,
220,
220,
705,
5031,
3256,
705,
5031,
62,
715,
3256,
705,
5031,
62,
1676,
8207,
6,
198,
60,
198,
26086,
62,
9319,
62,
31092,
62,
16129,
62,
4868,
62,
463,
2075,
796,
685,
198,
220,
220,
220,
705,
1350,
62,
71,
325,
3256,
705,
22163,
62,
12048,
273,
1505,
3256,
705,
2528,
62,
71,
325,
3256,
705,
43395,
62,
3046,
282,
3256,
705,
8326,
62,
926,
65,
3256,
705,
660,
62,
16762,
70,
6,
198,
60,
198
] | 1.991632 | 239 |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import cast, Iterable, Optional, Set, TYPE_CHECKING, FrozenSet
from cirq import circuits, value, devices, ops, protocols
from cirq.ion import convert_to_ion_gates
if TYPE_CHECKING:
import cirq
@value.value_equality
class IonDevice(devices.Device):
"""A device with qubits placed on a line.
Qubits have all-to-all connectivity.
"""
def __init__(self, measurement_duration: 'cirq.DURATION_LIKE',
twoq_gates_duration: 'cirq.DURATION_LIKE',
oneq_gates_duration: 'cirq.DURATION_LIKE',
qubits: Iterable[devices.LineQubit]) -> None:
"""Initializes the description of an ion trap device.
Args:
measurement_duration: The maximum duration of a measurement.
twoq_gates_duration: The maximum duration of a two qubit operation.
oneq_gates_duration: The maximum duration of a single qubit
operation.
qubits: Qubits on the device, identified by their x, y location.
"""
self._measurement_duration = value.Duration(measurement_duration)
self._twoq_gates_duration = value.Duration(twoq_gates_duration)
self._oneq_gates_duration = value.Duration(oneq_gates_duration)
self.qubits = frozenset(qubits)
def at(self, position: int) -> Optional[devices.LineQubit]:
"""Returns the qubit at the given position, if there is one, else None.
"""
q = devices.LineQubit(position)
return q if q in self.qubits else None
def neighbors_of(self, qubit: devices.LineQubit):
"""Returns the qubits that the given qubit can interact with."""
possibles = [
devices.LineQubit(qubit.x + 1),
devices.LineQubit(qubit.x - 1),
]
return [e for e in possibles if e in self.qubits]
| [
2,
15069,
2864,
383,
21239,
80,
34152,
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,
3740,
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,
198,
6738,
19720,
1330,
3350,
11,
40806,
540,
11,
32233,
11,
5345,
11,
41876,
62,
50084,
2751,
11,
23673,
7248,
198,
198,
6738,
10774,
80,
1330,
24907,
11,
1988,
11,
4410,
11,
39628,
11,
19565,
198,
6738,
10774,
80,
13,
295,
1330,
10385,
62,
1462,
62,
295,
62,
70,
689,
198,
198,
361,
41876,
62,
50084,
2751,
25,
198,
220,
220,
220,
1330,
10774,
80,
628,
198,
31,
8367,
13,
8367,
62,
48203,
198,
4871,
36404,
24728,
7,
42034,
13,
24728,
2599,
198,
220,
220,
220,
37227,
32,
3335,
351,
627,
9895,
4624,
319,
257,
1627,
13,
628,
220,
220,
220,
1195,
549,
896,
423,
477,
12,
1462,
12,
439,
19843,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
15558,
62,
32257,
25,
705,
66,
343,
80,
13,
35,
4261,
6234,
62,
31271,
7336,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
734,
80,
62,
70,
689,
62,
32257,
25,
705,
66,
343,
80,
13,
35,
4261,
6234,
62,
31271,
7336,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
530,
80,
62,
70,
689,
62,
32257,
25,
705,
66,
343,
80,
13,
35,
4261,
6234,
62,
31271,
7336,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
627,
9895,
25,
40806,
540,
58,
42034,
13,
13949,
48,
549,
270,
12962,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
4340,
262,
6764,
286,
281,
22088,
12840,
3335,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15558,
62,
32257,
25,
383,
5415,
9478,
286,
257,
15558,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
734,
80,
62,
70,
689,
62,
32257,
25,
383,
5415,
9478,
286,
257,
734,
627,
2545,
4905,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
530,
80,
62,
70,
689,
62,
32257,
25,
383,
5415,
9478,
286,
257,
2060,
627,
2545,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4905,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
627,
9895,
25,
1195,
549,
896,
319,
262,
3335,
11,
5174,
416,
511,
2124,
11,
331,
4067,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
1326,
5015,
434,
62,
32257,
796,
1988,
13,
26054,
7,
1326,
5015,
434,
62,
32257,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
11545,
80,
62,
70,
689,
62,
32257,
796,
1988,
13,
26054,
7,
11545,
80,
62,
70,
689,
62,
32257,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
505,
80,
62,
70,
689,
62,
32257,
796,
1988,
13,
26054,
7,
505,
80,
62,
70,
689,
62,
32257,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
421,
9895,
796,
8400,
8247,
316,
7,
421,
9895,
8,
628,
220,
220,
220,
825,
379,
7,
944,
11,
2292,
25,
493,
8,
4613,
32233,
58,
42034,
13,
13949,
48,
549,
270,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
35561,
262,
627,
2545,
379,
262,
1813,
2292,
11,
611,
612,
318,
530,
11,
2073,
6045,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10662,
796,
4410,
13,
13949,
48,
549,
270,
7,
9150,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10662,
611,
10662,
287,
2116,
13,
421,
9895,
2073,
6045,
628,
220,
220,
220,
825,
12020,
62,
1659,
7,
944,
11,
627,
2545,
25,
4410,
13,
13949,
48,
549,
270,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
35561,
262,
627,
9895,
326,
262,
1813,
627,
2545,
460,
9427,
351,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1184,
18764,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4410,
13,
13949,
48,
549,
270,
7,
421,
2545,
13,
87,
1343,
352,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4410,
13,
13949,
48,
549,
270,
7,
421,
2545,
13,
87,
532,
352,
828,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
68,
329,
304,
287,
1184,
18764,
611,
304,
287,
2116,
13,
421,
9895,
60,
628
] | 2.665567 | 909 |
#coding=utf-8
# Copyright (C) 2020 ATHENA AUTHORS; LanYu;
# 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.
# ==============================================================================
""" LJspeech dataset
This is a public domain speech dataset consisting of 13,100 short audio clips of a single speaker
reading passages from 7 non-fiction books. A transcription is provided for each clip.
Clips vary in length from 1 to 10 seconds and have a total length of approximately 24 hours.
detailed information can be seen on https://keithito.com/LJ-Speech-Dataset
"""
import os
import re
import sys
import tarfile
import inflect
import urllib
import tempfile
import codecs
import pandas
from absl import logging
from sklearn.model_selection import train_test_split
from unidecode import unidecode
import tensorflow as tf
from athena import get_wave_file_length
GFILE = tf.compat.v1.gfile
URL = "https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2"
#------------normalize_numbers--------------#
_INFLECT = inflect.engine()
_COMMA_NUMBER_RE = re.compile(r'([0-9][0-9\,]+[0-9])')
_DECIMAL_NUMBER_RE = re.compile(r'([0-9]+\.[0-9]+)')
_POUNDS_RE = re.compile(r'£([0-9\,]*[0-9]+)')
_DOLLARS_RE = re.compile(r'\$([0-9\.\,]*[0-9]+)')
_ORDINAL_RE = re.compile(r'[0-9]+(st|nd|rd|th)')
_NUMBER_RE = re.compile(r'[0-9]+')
def normalize_numbers(text):
"""
normalize numbers in text
"""
text = re.sub(_COMMA_NUMBER_RE, _remove_commas, text)
text = re.sub(_POUNDS_RE, r'\1 pounds', text)
text = re.sub(_DOLLARS_RE, _expand_dollars, text)
text = re.sub(_DECIMAL_NUMBER_RE, _expand_decimal_point, text)
text = re.sub(_ORDINAL_RE, _expand_ordinal, text)
text = re.sub(_NUMBER_RE, _expand_number, text)
return text
#---------------clean_text---------------#
# Regular expression matching whitespace:
_whitespace_re = re.compile(r'\s+')
# List of (regular expression, replacement) pairs for abbreviations:
_abbreviations = [(re.compile('\\b%s\\.' % x[0], re.IGNORECASE), x[1]) for x in [
('Mrs', 'Misess'),
('Mr', 'Mister'),
('Dr', 'Doctor'),
('St', 'Saint'),
('Co', 'Company'),
('Jr', 'Junior'),
('Maj', 'Major'),
('Gen', 'General'),
('Drs', 'Doctors'),
('Rev', 'Reverend'),
('Lt', 'Lieutenant'),
('Hon', 'Honorable'),
('Sgt', 'Sergeant'),
('Capt', 'Captain'),
('Esq', 'Esquire'),
('Ltd', 'Limited'),
('Col', 'Colonel'),
('Ft', 'Fort'),
]]
def expand_abbreviations(text):
"""
expand abbreviations in text
"""
for regex, replacement in _abbreviations:
text = re.sub(regex, replacement, text)
return text
def collapse_whitespace(text):
"""
collapse whitespace in text
"""
return re.sub(_whitespace_re, ' ', text)
# NOTE (kan-bayashi): Following functions additionally defined, not inclueded in original codes.
def remove_unnecessary_symbols(text):
"""
remove unnecessary symbols in text
"""
text = re.sub(r'[\(\)\[\]\<\>\"]+', '', text)
return text
def expand_symbols(text):
"""
expand symbols in text
"""
text = re.sub("\;", ",", text)
text = re.sub("\:", ",", text)
text = re.sub("\-", " ", text)
text = re.sub("\&", "and", text)
return text
def preprocess(text):
'''Custom pipeline for English text, including number and abbreviation expansion.'''
text = convert_to_ascii(text)
text = normalize_numbers(text)
text = expand_abbreviations(text)
text = expand_symbols(text)
text = remove_unnecessary_symbols(text)
text = collapse_whitespace(text)
return text
def download_and_extract(directory, url):
"""Download and extract the given split of dataset.
Args:
directory: the directory where to extract the tarball.
url: the url to download the data file.
"""
if not GFILE.Exists(directory):
GFILE.MakeDirs(directory)
_, tar_filepath = tempfile.mkstemp(suffix=".tar.bz2")
try:
logging.info("Downloading %s to %s" % (url, tar_filepath))
urllib.request.urlretrieve(url, tar_filepath, _progress)
statinfo = os.stat(tar_filepath)
logging.info(
"Successfully downloaded %s, size(bytes): %d" % (url, statinfo.st_size)
)
with tarfile.open(tar_filepath, "r") as tar:
tar.extractall(directory)
logging.info("Successfully extracted data from LJSpeech-1.1.tar.bz2")
finally:
GFILE.Remove(tar_filepath)
#----------------create total.csv-----------------
def convert_audio_and_split_transcript(dataset_dir, total_csv_path):
"""Convert rar to WAV and split the transcript.
Args:
dataset_dir : the directory which holds the input dataset.
total_csv_path : the resulting output csv file.
LJSpeech-1.1 dir Tree structure:
LJSpeech-1.1
-metadata.csv
-LJ001-0002|in being comparatively modern.|in being comparatively modern.
...
-wavs
-LJ001-0001.wav
-LJ001-0002.wav
...
-LJ050-0278
-pcms
-audio-LJ001-0001.s16
-audio-LJ001-0002.s16
...
"""
logging.info("Processing audio and transcript for {}".format("all_files"))
wav_dir = os.path.join(dataset_dir, "LJSpeech-1.1/wavs/")
files = []
# ProsodyLabel ---word
with codecs.open(os.path.join(dataset_dir, "LJSpeech-1.1/metadata.csv"),
"r",
encoding="utf-8") as f:
for line in f:
wav_name = line.split('|')[0] + '.wav'
wav_file = os.path.join(wav_dir, wav_name)
wav_length = get_wave_file_length(wav_file)
#get transcript
content = line.split('|')[2]
clean_content = preprocess(content.rstrip())
transcript = ' '.join(list(clean_content))
transcript = transcript.replace(' ', ' <space>')
transcript = 'sp1 ' + transcript + ' sil' #' sil\n'
files.append((os.path.abspath(wav_file), wav_length, transcript))
# Write to txt file which contains three columns:
fp = open(total_csv_path, 'w', encoding="utf-8")
fp.write("wav_filename"+'\t'
"wav_length_ms"+'\t'
"transcript"+'\n')
for i in range(len(files)):
fp.write(str(files[i][0])+'\t')
fp.write(str(files[i][1])+'\t')
fp.write(str(files[i][2])+'\n')
fp.close()
logging.info("Successfully generated csv file {}".format(total_csv_path))
def processor(dircetory):
""" download and process """
#logging.info("Downloading the dataset may take a long time so you can download it in another way and move it to the dircetory {}".format(dircetory))
LJSpeech = os.path.join(dircetory, "LJSpeech-1.1.tar.bz2")
if os.path.exists(LJSpeech):
logging.info("{} already exist".format(LJSpeech))
else:
download_and_extract(dircetory, URL)
# get total_csv
logging.info("Processing the LJspeech total.csv in {}".format(dircetory))
total_csv_path = os.path.join(dircetory, "total.csv")
convert_audio_and_split_transcript(dircetory, total_csv_path)
split_train_dev_test(total_csv_path, dircetory)
logging.info("Finished processing LJspeech csv ")
if __name__ == "__main__":
logging.set_verbosity(logging.INFO)
DIR = sys.argv[1]
processor(DIR)
| [
2,
66,
7656,
28,
40477,
12,
23,
198,
2,
15069,
357,
34,
8,
12131,
317,
4221,
45510,
37195,
20673,
26,
14730,
40728,
26,
198,
2,
1439,
2489,
10395,
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,
406,
41,
45862,
27039,
198,
1212,
318,
257,
1171,
7386,
4046,
27039,
17747,
286,
1511,
11,
3064,
1790,
6597,
19166,
286,
257,
2060,
10834,
198,
25782,
22674,
422,
767,
1729,
12,
24046,
3835,
13,
317,
26955,
318,
2810,
329,
1123,
10651,
13,
198,
2601,
2419,
7565,
287,
4129,
422,
352,
284,
838,
4201,
290,
423,
257,
2472,
4129,
286,
6702,
1987,
2250,
13,
198,
15255,
6255,
1321,
460,
307,
1775,
319,
3740,
1378,
365,
342,
10094,
13,
785,
14,
43,
41,
12,
5248,
3055,
12,
27354,
292,
316,
198,
37811,
198,
198,
11748,
28686,
198,
11748,
302,
198,
11748,
25064,
198,
11748,
13422,
7753,
198,
11748,
1167,
801,
198,
11748,
2956,
297,
571,
198,
11748,
20218,
7753,
198,
11748,
40481,
82,
198,
11748,
19798,
292,
198,
6738,
2352,
75,
1330,
18931,
198,
6738,
1341,
35720,
13,
19849,
62,
49283,
1330,
4512,
62,
9288,
62,
35312,
198,
6738,
555,
485,
8189,
1330,
555,
485,
8189,
198,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
6738,
379,
831,
64,
1330,
651,
62,
19204,
62,
7753,
62,
13664,
628,
198,
38,
25664,
796,
48700,
13,
5589,
265,
13,
85,
16,
13,
70,
7753,
198,
21886,
796,
366,
5450,
1378,
7890,
13,
365,
342,
10094,
13,
785,
14,
7890,
14,
45862,
14,
43,
41,
5248,
3055,
12,
16,
13,
16,
13,
18870,
13,
65,
89,
17,
1,
198,
198,
2,
10541,
11265,
1096,
62,
77,
17024,
26171,
2,
198,
62,
1268,
37,
16779,
796,
1167,
801,
13,
18392,
3419,
198,
62,
9858,
5673,
62,
41359,
13246,
62,
2200,
796,
302,
13,
5589,
576,
7,
81,
6,
26933,
15,
12,
24,
7131,
15,
12,
24,
59,
11,
48688,
58,
15,
12,
24,
12962,
11537,
198,
62,
41374,
3955,
1847,
62,
41359,
13246,
62,
2200,
796,
302,
13,
5589,
576,
7,
81,
6,
26933,
15,
12,
24,
48688,
59,
3693,
15,
12,
24,
60,
28988,
11537,
198,
62,
47,
19385,
5258,
62,
2200,
796,
302,
13,
5589,
576,
7,
81,
6,
14988,
26933,
15,
12,
24,
59,
11,
60,
9,
58,
15,
12,
24,
60,
28988,
11537,
198,
62,
18227,
3069,
27415,
62,
2200,
796,
302,
13,
5589,
576,
7,
81,
6,
59,
3,
26933,
15,
12,
24,
17405,
59,
11,
60,
9,
58,
15,
12,
24,
60,
28988,
11537,
198,
62,
12532,
17961,
62,
2200,
796,
302,
13,
5589,
576,
7,
81,
6,
58,
15,
12,
24,
60,
33747,
301,
91,
358,
91,
4372,
91,
400,
8,
11537,
198,
62,
41359,
13246,
62,
2200,
796,
302,
13,
5589,
576,
7,
81,
6,
58,
15,
12,
24,
48688,
11537,
198,
198,
4299,
3487,
1096,
62,
77,
17024,
7,
5239,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3487,
1096,
3146,
287,
2420,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
28264,
9858,
5673,
62,
41359,
13246,
62,
2200,
11,
4808,
28956,
62,
785,
5356,
11,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
28264,
47,
19385,
5258,
62,
2200,
11,
374,
6,
59,
16,
8059,
3256,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
28264,
18227,
3069,
27415,
62,
2200,
11,
4808,
11201,
392,
62,
67,
692,
945,
11,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
28264,
41374,
3955,
1847,
62,
41359,
13246,
62,
2200,
11,
4808,
11201,
392,
62,
12501,
4402,
62,
4122,
11,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
28264,
12532,
17961,
62,
2200,
11,
4808,
11201,
392,
62,
585,
1292,
11,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
28264,
41359,
13246,
62,
2200,
11,
4808,
11201,
392,
62,
17618,
11,
2420,
8,
198,
220,
220,
220,
1441,
2420,
198,
198,
2,
24305,
27773,
62,
5239,
24305,
2,
198,
2,
23603,
5408,
12336,
13216,
10223,
25,
198,
62,
1929,
2737,
10223,
62,
260,
796,
302,
13,
5589,
576,
7,
81,
6,
59,
82,
10,
11537,
198,
198,
2,
7343,
286,
357,
16338,
5408,
11,
9014,
8,
14729,
329,
37640,
602,
25,
198,
62,
397,
4679,
8903,
602,
796,
47527,
260,
13,
5589,
576,
10786,
6852,
65,
4,
82,
6852,
2637,
4064,
2124,
58,
15,
4357,
302,
13,
16284,
1581,
2943,
11159,
828,
2124,
58,
16,
12962,
329,
2124,
287,
685,
198,
220,
220,
220,
19203,
27034,
3256,
705,
31281,
408,
33809,
198,
220,
220,
220,
19203,
5246,
3256,
705,
44,
1694,
33809,
198,
220,
220,
220,
19203,
6187,
3256,
705,
37564,
33809,
198,
220,
220,
220,
19203,
1273,
3256,
705,
48615,
33809,
198,
220,
220,
220,
19203,
7222,
3256,
705,
39154,
33809,
198,
220,
220,
220,
19203,
50123,
3256,
705,
22396,
1504,
33809,
198,
220,
220,
220,
19203,
44,
1228,
3256,
705,
24206,
33809,
198,
220,
220,
220,
19203,
13746,
3256,
705,
12218,
33809,
198,
220,
220,
220,
19203,
35,
3808,
3256,
705,
47087,
33809,
198,
220,
220,
220,
19203,
18009,
3256,
705,
3041,
37713,
33809,
198,
220,
220,
220,
19203,
49578,
3256,
705,
47918,
15340,
33809,
198,
220,
220,
220,
19203,
29478,
3256,
705,
29478,
10475,
33809,
198,
220,
220,
220,
19203,
50,
13655,
3256,
705,
7089,
30205,
33809,
198,
220,
220,
220,
19203,
19209,
3256,
705,
27898,
33809,
198,
220,
220,
220,
19203,
23041,
80,
3256,
705,
36,
16485,
557,
33809,
198,
220,
220,
220,
19203,
43,
8671,
3256,
705,
37214,
33809,
198,
220,
220,
220,
19203,
5216,
3256,
705,
5216,
26261,
33809,
198,
220,
220,
220,
19203,
37,
83,
3256,
705,
21926,
33809,
198,
11907,
198,
198,
4299,
4292,
62,
397,
4679,
8903,
602,
7,
5239,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4292,
37640,
602,
287,
2420,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
329,
40364,
11,
9014,
287,
4808,
397,
4679,
8903,
602,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2420,
796,
302,
13,
7266,
7,
260,
25636,
11,
9014,
11,
2420,
8,
198,
220,
220,
220,
1441,
2420,
198,
198,
4299,
9807,
62,
1929,
2737,
10223,
7,
5239,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
9807,
13216,
10223,
287,
2420,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
302,
13,
7266,
28264,
1929,
2737,
10223,
62,
260,
11,
705,
46083,
2420,
8,
198,
198,
2,
24550,
357,
27541,
12,
24406,
12144,
2599,
14207,
5499,
36527,
5447,
11,
407,
13358,
1739,
276,
287,
2656,
12416,
13,
198,
4299,
4781,
62,
403,
49986,
62,
1837,
2022,
10220,
7,
5239,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4781,
13114,
14354,
287,
2420,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
7,
81,
6,
58,
59,
38016,
19415,
58,
59,
60,
49778,
59,
29,
7879,
48688,
3256,
705,
3256,
2420,
8,
198,
220,
220,
220,
1441,
2420,
198,
198,
4299,
4292,
62,
1837,
2022,
10220,
7,
5239,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4292,
14354,
287,
2420,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
7203,
59,
26,
1600,
366,
553,
11,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
7203,
59,
25,
1600,
366,
553,
11,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
7203,
41441,
1600,
366,
33172,
2420,
8,
198,
220,
220,
220,
2420,
796,
302,
13,
7266,
7203,
59,
5,
1600,
366,
392,
1600,
2420,
8,
198,
220,
220,
220,
1441,
2420,
198,
198,
4299,
662,
14681,
7,
5239,
2599,
198,
220,
220,
220,
705,
7061,
15022,
11523,
329,
3594,
2420,
11,
1390,
1271,
290,
28873,
47625,
7118,
2637,
7061,
198,
220,
220,
220,
2420,
796,
10385,
62,
1462,
62,
292,
979,
72,
7,
5239,
8,
198,
220,
220,
220,
2420,
796,
3487,
1096,
62,
77,
17024,
7,
5239,
8,
198,
220,
220,
220,
2420,
796,
4292,
62,
397,
4679,
8903,
602,
7,
5239,
8,
198,
220,
220,
220,
2420,
796,
4292,
62,
1837,
2022,
10220,
7,
5239,
8,
198,
220,
220,
220,
2420,
796,
4781,
62,
403,
49986,
62,
1837,
2022,
10220,
7,
5239,
8,
198,
220,
220,
220,
2420,
796,
9807,
62,
1929,
2737,
10223,
7,
5239,
8,
198,
220,
220,
220,
1441,
2420,
198,
198,
4299,
4321,
62,
392,
62,
2302,
974,
7,
34945,
11,
19016,
2599,
198,
220,
220,
220,
37227,
10002,
290,
7925,
262,
1813,
6626,
286,
27039,
13,
198,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
8619,
25,
262,
8619,
810,
284,
7925,
262,
13422,
1894,
13,
198,
220,
220,
220,
220,
220,
220,
220,
19016,
25,
262,
19016,
284,
4321,
262,
1366,
2393,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
407,
402,
25664,
13,
3109,
1023,
7,
34945,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
402,
25664,
13,
12050,
35,
17062,
7,
34945,
8,
628,
220,
220,
220,
4808,
11,
13422,
62,
7753,
6978,
796,
20218,
7753,
13,
28015,
927,
79,
7,
37333,
844,
28,
1911,
18870,
13,
65,
89,
17,
4943,
628,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
7203,
10002,
278,
4064,
82,
284,
4064,
82,
1,
4064,
357,
6371,
11,
13422,
62,
7753,
6978,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
2956,
297,
571,
13,
25927,
13,
6371,
1186,
30227,
7,
6371,
11,
13422,
62,
7753,
6978,
11,
4808,
33723,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1185,
10951,
796,
28686,
13,
14269,
7,
18870,
62,
7753,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
33244,
2759,
15680,
4064,
82,
11,
2546,
7,
33661,
2599,
4064,
67,
1,
4064,
357,
6371,
11,
1185,
10951,
13,
301,
62,
7857,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
351,
13422,
7753,
13,
9654,
7,
18870,
62,
7753,
6978,
11,
366,
81,
4943,
355,
13422,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13422,
13,
2302,
974,
439,
7,
34945,
8,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
7203,
33244,
2759,
21242,
1366,
422,
406,
41,
5248,
3055,
12,
16,
13,
16,
13,
18870,
13,
65,
89,
17,
4943,
198,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
220,
220,
402,
25664,
13,
27914,
7,
18870,
62,
7753,
6978,
8,
198,
198,
2,
1783,
17953,
2472,
13,
40664,
1783,
12,
198,
4299,
10385,
62,
24051,
62,
392,
62,
35312,
62,
7645,
6519,
7,
19608,
292,
316,
62,
15908,
11,
2472,
62,
40664,
62,
6978,
2599,
198,
220,
220,
220,
37227,
3103,
1851,
374,
283,
284,
370,
10116,
290,
6626,
262,
14687,
13,
198,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
27039,
62,
15908,
220,
1058,
262,
8619,
543,
6622,
262,
5128,
27039,
13,
198,
220,
220,
220,
2472,
62,
40664,
62,
6978,
1058,
262,
7186,
5072,
269,
21370,
2393,
13,
628,
220,
220,
220,
406,
41,
5248,
3055,
12,
16,
13,
16,
26672,
12200,
4645,
25,
198,
220,
220,
220,
406,
41,
5248,
3055,
12,
16,
13,
16,
198,
220,
220,
220,
220,
220,
220,
220,
532,
38993,
13,
40664,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
43,
41,
8298,
12,
34215,
91,
259,
852,
31188,
3660,
13,
91,
259,
852,
31188,
3660,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2644,
198,
220,
220,
220,
220,
220,
220,
220,
532,
45137,
82,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
43,
41,
8298,
12,
18005,
13,
45137,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
43,
41,
8298,
12,
34215,
13,
45137,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2644,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
43,
41,
28669,
12,
15,
25870,
198,
220,
220,
220,
220,
220,
220,
220,
532,
14751,
907,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
24051,
12,
43,
41,
8298,
12,
18005,
13,
82,
1433,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
24051,
12,
43,
41,
8298,
12,
34215,
13,
82,
1433,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2644,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
18931,
13,
10951,
7203,
18709,
278,
6597,
290,
14687,
329,
23884,
1911,
18982,
7203,
439,
62,
16624,
48774,
198,
220,
220,
220,
266,
615,
62,
15908,
796,
28686,
13,
6978,
13,
22179,
7,
19608,
292,
316,
62,
15908,
11,
366,
43,
41,
5248,
3055,
12,
16,
13,
16,
14,
45137,
82,
14,
4943,
198,
220,
220,
220,
3696,
796,
17635,
198,
220,
220,
220,
1303,
27631,
1118,
33986,
11420,
4775,
198,
220,
220,
220,
351,
40481,
82,
13,
9654,
7,
418,
13,
6978,
13,
22179,
7,
19608,
292,
316,
62,
15908,
11,
366,
43,
41,
5248,
3055,
12,
16,
13,
16,
14,
38993,
13,
40664,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
81,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21004,
2625,
40477,
12,
23,
4943,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
266,
615,
62,
3672,
796,
1627,
13,
35312,
10786,
91,
11537,
58,
15,
60,
1343,
45302,
45137,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
266,
615,
62,
7753,
796,
28686,
13,
6978,
13,
22179,
7,
45137,
62,
15908,
11,
266,
615,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
266,
615,
62,
13664,
796,
651,
62,
19204,
62,
7753,
62,
13664,
7,
45137,
62,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1136,
14687,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
796,
1627,
13,
35312,
10786,
91,
11537,
58,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3424,
62,
11299,
796,
662,
14681,
7,
11299,
13,
81,
36311,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14687,
796,
705,
45302,
22179,
7,
4868,
7,
27773,
62,
11299,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14687,
796,
14687,
13,
33491,
10786,
220,
46083,
705,
1279,
13200,
29,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14687,
796,
705,
2777,
16,
705,
1343,
14687,
1343,
705,
3313,
6,
1303,
6,
3313,
59,
77,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3696,
13,
33295,
19510,
418,
13,
6978,
13,
397,
2777,
776,
7,
45137,
62,
7753,
828,
266,
615,
62,
13664,
11,
14687,
4008,
628,
220,
220,
220,
1303,
19430,
284,
256,
742,
2393,
543,
4909,
1115,
15180,
25,
198,
220,
220,
220,
277,
79,
796,
1280,
7,
23350,
62,
40664,
62,
6978,
11,
705,
86,
3256,
21004,
2625,
40477,
12,
23,
4943,
198,
220,
220,
220,
277,
79,
13,
13564,
7203,
45137,
62,
34345,
1,
10,
6,
59,
83,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
45137,
62,
13664,
62,
907,
1,
10,
6,
59,
83,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
7645,
6519,
1,
10,
6,
59,
77,
11537,
198,
220,
220,
220,
329,
1312,
287,
2837,
7,
11925,
7,
16624,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
277,
79,
13,
13564,
7,
2536,
7,
16624,
58,
72,
7131,
15,
12962,
10,
6,
59,
83,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
277,
79,
13,
13564,
7,
2536,
7,
16624,
58,
72,
7131,
16,
12962,
10,
6,
59,
83,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
277,
79,
13,
13564,
7,
2536,
7,
16624,
58,
72,
7131,
17,
12962,
10,
6,
59,
77,
11537,
198,
220,
220,
220,
277,
79,
13,
19836,
3419,
220,
220,
220,
220,
198,
220,
220,
220,
18931,
13,
10951,
7203,
33244,
2759,
7560,
269,
21370,
2393,
23884,
1911,
18982,
7,
23350,
62,
40664,
62,
6978,
4008,
198,
198,
4299,
12649,
7,
67,
1980,
316,
652,
2599,
198,
220,
220,
220,
37227,
4321,
290,
1429,
37227,
198,
220,
220,
220,
1303,
6404,
2667,
13,
10951,
7203,
10002,
278,
262,
27039,
743,
1011,
257,
890,
640,
523,
345,
460,
4321,
340,
287,
1194,
835,
290,
1445,
340,
284,
262,
288,
1980,
316,
652,
23884,
1911,
18982,
7,
67,
1980,
316,
652,
4008,
198,
220,
220,
220,
406,
41,
5248,
3055,
796,
28686,
13,
6978,
13,
22179,
7,
67,
1980,
316,
652,
11,
366,
43,
41,
5248,
3055,
12,
16,
13,
16,
13,
18870,
13,
65,
89,
17,
4943,
198,
220,
220,
220,
611,
28686,
13,
6978,
13,
1069,
1023,
7,
43,
41,
5248,
3055,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
7203,
90,
92,
1541,
2152,
1911,
18982,
7,
43,
41,
5248,
3055,
4008,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4321,
62,
392,
62,
2302,
974,
7,
67,
1980,
316,
652,
11,
10289,
8,
220,
220,
220,
198,
220,
220,
220,
1303,
651,
2472,
62,
40664,
198,
220,
220,
220,
18931,
13,
10951,
7203,
18709,
278,
262,
406,
41,
45862,
2472,
13,
40664,
287,
23884,
1911,
18982,
7,
67,
1980,
316,
652,
4008,
198,
220,
220,
220,
2472,
62,
40664,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
67,
1980,
316,
652,
11,
366,
23350,
13,
40664,
4943,
198,
220,
220,
220,
10385,
62,
24051,
62,
392,
62,
35312,
62,
7645,
6519,
7,
67,
1980,
316,
652,
11,
2472,
62,
40664,
62,
6978,
8,
198,
220,
220,
220,
6626,
62,
27432,
62,
7959,
62,
9288,
7,
23350,
62,
40664,
62,
6978,
11,
288,
1980,
316,
652,
8,
198,
220,
220,
220,
18931,
13,
10951,
7203,
18467,
1348,
7587,
406,
41,
45862,
269,
21370,
366,
8,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
18931,
13,
2617,
62,
19011,
16579,
7,
6404,
2667,
13,
10778,
8,
198,
220,
220,
220,
360,
4663,
796,
25064,
13,
853,
85,
58,
16,
60,
220,
198,
220,
220,
220,
12649,
7,
34720,
8,
198
] | 2.422181 | 3,264 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-31 16:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
24,
319,
1853,
12,
1065,
12,
3132,
1467,
25,
2713,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
628
] | 2.776119 | 67 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-09 19:24
from __future__ import unicode_literals
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
940,
13,
17,
319,
1584,
12,
940,
12,
2931,
678,
25,
1731,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
11748,
4818,
8079,
198,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.914634 | 82 |
"""
This component provides support for Home Automation Manager (HAM).
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/edgeos/
"""
import asyncio
import json
import logging
import re
from typing import Optional
from urllib.parse import urlparse
import aiohttp
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from ..helpers.const import *
from ..models.config_data import ConfigData
REQUIREMENTS = ["aiohttp"]
_LOGGER = logging.getLogger(__name__)
| [
37811,
198,
1212,
7515,
3769,
1104,
329,
5995,
17406,
341,
9142,
357,
33363,
737,
198,
1890,
517,
3307,
546,
428,
7515,
11,
3387,
3522,
284,
262,
10314,
379,
198,
5450,
1378,
11195,
12,
562,
10167,
13,
952,
14,
5589,
3906,
14,
14907,
418,
14,
198,
37811,
198,
11748,
30351,
952,
198,
11748,
33918,
198,
11748,
18931,
198,
11748,
302,
198,
6738,
19720,
1330,
32233,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
19016,
29572,
198,
198,
11748,
257,
952,
4023,
198,
198,
6738,
1363,
562,
10167,
13,
16794,
364,
13,
64,
952,
4023,
62,
16366,
1330,
30351,
62,
17953,
62,
565,
2334,
2521,
198,
198,
6738,
11485,
16794,
364,
13,
9979,
1330,
1635,
198,
6738,
11485,
27530,
13,
11250,
62,
7890,
1330,
17056,
6601,
198,
198,
2200,
49128,
28957,
796,
14631,
64,
952,
4023,
8973,
198,
198,
62,
25294,
30373,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628
] | 3.592105 | 152 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 2.3.33.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class LinkedServiceProps(Model):
"""LinkedService specific properties.
:param linked_service_resource_id: ResourceId of the link target of the
linked service.
:type linked_service_resource_id: str
:param link_type: Type of the link target. Possible values include:
'Synapse'
:type link_type: str or ~_restclient.models.LinkedServiceLinkType
:param created_time: The creation time of the linked service.
:type created_time: datetime
:param modified_time: The last modified time of the linked service.
:type modified_time: datetime
"""
_validation = {
'linked_service_resource_id': {'required': True},
}
_attribute_map = {
'linked_service_resource_id': {'key': 'linkedServiceResourceId', 'type': 'str'},
'link_type': {'key': 'linkType', 'type': 'LinkedServiceLinkType'},
'created_time': {'key': 'createdTime', 'type': 'iso-8601'},
'modified_time': {'key': 'modifiedTime', 'type': 'iso-8601'},
}
| [
2,
19617,
28,
40477,
12,
23,
201,
198,
2,
16529,
35937,
201,
198,
2,
15069,
357,
66,
8,
5413,
10501,
13,
1439,
2489,
10395,
13,
201,
198,
2,
49962,
739,
262,
17168,
13789,
13,
4091,
13789,
13,
14116,
287,
262,
1628,
6808,
329,
201,
198,
2,
5964,
1321,
13,
201,
198,
2,
201,
198,
2,
6127,
7560,
416,
5413,
357,
49,
8,
11160,
19452,
6127,
35986,
362,
13,
18,
13,
2091,
13,
15,
201,
198,
2,
19179,
743,
2728,
11491,
4069,
290,
481,
307,
2626,
611,
262,
2438,
318,
201,
198,
2,
16935,
515,
13,
201,
198,
2,
16529,
35937,
201,
198,
201,
198,
6738,
13845,
2118,
13,
46911,
1634,
1330,
9104,
201,
198,
201,
198,
201,
198,
4871,
7502,
276,
16177,
2964,
862,
7,
17633,
2599,
201,
198,
220,
220,
220,
37227,
11280,
276,
16177,
2176,
6608,
13,
201,
198,
201,
198,
220,
220,
220,
1058,
17143,
6692,
62,
15271,
62,
31092,
62,
312,
25,
20857,
7390,
286,
262,
2792,
2496,
286,
262,
201,
198,
220,
220,
220,
220,
6692,
2139,
13,
201,
198,
220,
220,
220,
1058,
4906,
6692,
62,
15271,
62,
31092,
62,
312,
25,
965,
201,
198,
220,
220,
220,
1058,
17143,
2792,
62,
4906,
25,
5994,
286,
262,
2792,
2496,
13,
33671,
3815,
2291,
25,
201,
198,
220,
220,
220,
220,
705,
29934,
7512,
6,
201,
198,
220,
220,
220,
1058,
4906,
2792,
62,
4906,
25,
965,
393,
5299,
62,
2118,
16366,
13,
27530,
13,
11280,
276,
16177,
11280,
6030,
201,
198,
220,
220,
220,
1058,
17143,
2727,
62,
2435,
25,
383,
6282,
640,
286,
262,
6692,
2139,
13,
201,
198,
220,
220,
220,
1058,
4906,
2727,
62,
2435,
25,
4818,
8079,
201,
198,
220,
220,
220,
1058,
17143,
9518,
62,
2435,
25,
383,
938,
9518,
640,
286,
262,
6692,
2139,
13,
201,
198,
220,
220,
220,
1058,
4906,
9518,
62,
2435,
25,
4818,
8079,
201,
198,
220,
220,
220,
37227,
201,
198,
201,
198,
220,
220,
220,
4808,
12102,
341,
796,
1391,
201,
198,
220,
220,
220,
220,
220,
220,
220,
705,
25614,
62,
15271,
62,
31092,
62,
312,
10354,
1391,
6,
35827,
10354,
6407,
5512,
201,
198,
220,
220,
220,
1782,
201,
198,
201,
198,
220,
220,
220,
4808,
42348,
62,
8899,
796,
1391,
201,
198,
220,
220,
220,
220,
220,
220,
220,
705,
25614,
62,
15271,
62,
31092,
62,
312,
10354,
1391,
6,
2539,
10354,
705,
25614,
16177,
26198,
7390,
3256,
705,
4906,
10354,
705,
2536,
6,
5512,
201,
198,
220,
220,
220,
220,
220,
220,
220,
705,
8726,
62,
4906,
10354,
1391,
6,
2539,
10354,
705,
8726,
6030,
3256,
705,
4906,
10354,
705,
11280,
276,
16177,
11280,
6030,
6,
5512,
201,
198,
220,
220,
220,
220,
220,
220,
220,
705,
25598,
62,
2435,
10354,
1391,
6,
2539,
10354,
705,
25598,
7575,
3256,
705,
4906,
10354,
705,
26786,
12,
4521,
486,
6,
5512,
201,
198,
220,
220,
220,
220,
220,
220,
220,
705,
41771,
62,
2435,
10354,
1391,
6,
2539,
10354,
705,
41771,
7575,
3256,
705,
4906,
10354,
705,
26786,
12,
4521,
486,
6,
5512,
201,
198,
220,
220,
220,
1782,
201,
198
] | 3.060665 | 511 |
#!/usr/bin/env python
# graph.py
# Created by Vivek Gopalakrishnan on 2018-11-13.
# Email: [email protected]
# Copyright (c) 2018. All rights reserved.
import timeit
from src.features.summary import Stats
from src.random.bernoulli import RandomGraph
def measure_runtime(n, p, number=5):
"""
Calculates the runtime for a given graph.
Does not time the functions: 'khop_locality', 'scan_statistic'
"""
# Initialize graph and stats class
A = RandomGraph(int(n), p)
s = Stats(A)
public_method_names = [method for method in dir(s) if callable(
getattr(s, method)) if not method.startswith('_')]
for method in ['return_stats', 'khop_locality', 'scan_statistic']:
public_method_names.remove(method)
# Dictionary for holding results
results = [n, p]
# Runtime
for method in public_method_names:
results += [timeit.timeit(lambda: getattr(s, method)(), number=number)]
return results
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
2,
4823,
13,
9078,
198,
2,
15622,
416,
29237,
74,
402,
33067,
461,
37518,
12647,
319,
2864,
12,
1157,
12,
1485,
13,
198,
2,
9570,
25,
410,
70,
404,
6081,
19,
31,
73,
13415,
13,
15532,
198,
2,
15069,
357,
66,
8,
2864,
13,
1439,
2489,
10395,
13,
198,
198,
11748,
640,
270,
198,
198,
6738,
12351,
13,
40890,
13,
49736,
1330,
20595,
198,
6738,
12351,
13,
25120,
13,
33900,
280,
15516,
1330,
14534,
37065,
628,
198,
4299,
3953,
62,
43282,
7,
77,
11,
279,
11,
1271,
28,
20,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
27131,
689,
262,
19124,
329,
257,
1813,
4823,
13,
198,
220,
220,
220,
8314,
407,
640,
262,
5499,
25,
705,
74,
8548,
62,
17946,
1483,
3256,
705,
35836,
62,
14269,
2569,
6,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1303,
20768,
1096,
4823,
290,
9756,
1398,
198,
220,
220,
220,
317,
796,
14534,
37065,
7,
600,
7,
77,
828,
279,
8,
198,
220,
220,
220,
264,
796,
20595,
7,
32,
8,
628,
220,
220,
220,
1171,
62,
24396,
62,
14933,
796,
685,
24396,
329,
2446,
287,
26672,
7,
82,
8,
611,
869,
540,
7,
198,
220,
220,
220,
220,
220,
220,
220,
651,
35226,
7,
82,
11,
2446,
4008,
611,
407,
2446,
13,
9688,
2032,
342,
10786,
62,
11537,
60,
198,
220,
220,
220,
329,
2446,
287,
37250,
7783,
62,
34242,
3256,
705,
74,
8548,
62,
17946,
1483,
3256,
705,
35836,
62,
14269,
2569,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
1171,
62,
24396,
62,
14933,
13,
28956,
7,
24396,
8,
628,
220,
220,
220,
1303,
28261,
329,
4769,
2482,
198,
220,
220,
220,
2482,
796,
685,
77,
11,
279,
60,
628,
220,
220,
220,
1303,
43160,
198,
220,
220,
220,
329,
2446,
287,
1171,
62,
24396,
62,
14933,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2482,
15853,
685,
2435,
270,
13,
2435,
270,
7,
50033,
25,
651,
35226,
7,
82,
11,
2446,
5769,
828,
1271,
28,
17618,
15437,
628,
220,
220,
220,
1441,
2482,
198
] | 2.735795 | 352 |
import os
import numpy as np
learning_rate = [0.01, 0.001]
prune_ratio = 30
ADMM_times = [2,3,4,5,6,7]
Total_epochs = [10,30,40,50,60]
target_accuracy = 0.76
count = 0
highest_acc = 0
for i in range(len(learning_rate)):
for j in range(len(ADMM_times)):
for k in range(len(Total_epochs)):
lr = learning_rate[i]
admm = ADMM_times[j]
epoch = Total_epochs[k]
#linux
#os.system('rm '+"log"+str(count)+".txt")
#windows
os.system('del '+"log"+str(count)+".txt")
os.system("python train-auto-admm-tuneParameter.py"
+" --target_acc="+str(target_accuracy)
+" --prune_ratio="+str(prune_ratio)
+" --count=" + str(count)
+" --learning_rate="+str(lr)
+" --ADMM="+str(admm)
+" --epochs="+str(epoch)
+" >>log"+str(count)+".txt")
f = open("log" + str(count) + ".txt")
for line2 in f:
if "Finally Test set results" in line2:
res = line2.split()
if float(res[7]) > highest_acc:
highest_acc = float(res[7])
count+=1
print("highest accuracy only train with pruned adjacency + weights: ", highest_acc)
| [
11748,
28686,
198,
11748,
299,
32152,
355,
45941,
198,
40684,
62,
4873,
796,
685,
15,
13,
486,
11,
657,
13,
8298,
60,
198,
1050,
1726,
62,
10366,
952,
796,
1542,
198,
2885,
12038,
62,
22355,
796,
685,
17,
11,
18,
11,
19,
11,
20,
11,
21,
11,
22,
60,
198,
14957,
62,
538,
5374,
82,
796,
685,
940,
11,
1270,
11,
1821,
11,
1120,
11,
1899,
60,
198,
16793,
62,
4134,
23843,
796,
657,
13,
4304,
198,
9127,
796,
657,
198,
35323,
62,
4134,
796,
657,
198,
198,
1640,
1312,
287,
2837,
7,
11925,
7,
40684,
62,
4873,
8,
2599,
198,
220,
220,
220,
329,
474,
287,
2837,
7,
11925,
7,
2885,
12038,
62,
22355,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
2837,
7,
11925,
7,
14957,
62,
538,
5374,
82,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
81,
796,
4673,
62,
4873,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
512,
3020,
796,
5984,
12038,
62,
22355,
58,
73,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36835,
796,
7472,
62,
538,
5374,
82,
58,
74,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
23289,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
418,
13,
10057,
10786,
26224,
705,
10,
1,
6404,
1,
10,
2536,
7,
9127,
47762,
1911,
14116,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
28457,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
10057,
10786,
12381,
705,
10,
1,
6404,
1,
10,
2536,
7,
9127,
47762,
1911,
14116,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
10057,
7203,
29412,
4512,
12,
23736,
12,
324,
3020,
12,
83,
1726,
36301,
13,
9078,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
1,
1377,
16793,
62,
4134,
2625,
10,
2536,
7,
16793,
62,
4134,
23843,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
1,
1377,
1050,
1726,
62,
10366,
952,
2625,
10,
2536,
7,
1050,
1726,
62,
10366,
952,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
1,
1377,
9127,
2625,
1343,
965,
7,
9127,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
1,
1377,
40684,
62,
4873,
2625,
10,
2536,
7,
14050,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
1,
1377,
2885,
12038,
2625,
10,
2536,
7,
324,
3020,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
1,
1377,
538,
5374,
82,
2625,
10,
2536,
7,
538,
5374,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
1,
9609,
6404,
1,
10,
2536,
7,
9127,
47762,
1911,
14116,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
796,
1280,
7203,
6404,
1,
1343,
965,
7,
9127,
8,
1343,
27071,
14116,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
17,
287,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
366,
11158,
6208,
900,
2482,
1,
287,
1627,
17,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
581,
796,
1627,
17,
13,
35312,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
12178,
7,
411,
58,
22,
12962,
1875,
4511,
62,
4134,
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,
4511,
62,
4134,
796,
12178,
7,
411,
58,
22,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
47932,
16,
198,
198,
4798,
7203,
35323,
9922,
691,
4512,
351,
778,
40881,
9224,
330,
1387,
1343,
19590,
25,
33172,
4511,
62,
4134,
8,
198
] | 1.759379 | 773 |
from django.contrib import admin
from tower import ugettext_lazy as _
from users.models import Profile, Link
username = lambda u: u.user.username
username.short_description = _('Username')
admin.site.register(Profile, ProfileAdmin)
admin.site.register(Link, LinkAdmin)
| [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
198,
6738,
10580,
1330,
334,
1136,
5239,
62,
75,
12582,
355,
4808,
198,
198,
6738,
2985,
13,
27530,
1330,
13118,
11,
7502,
628,
198,
29460,
796,
37456,
334,
25,
334,
13,
7220,
13,
29460,
198,
29460,
13,
19509,
62,
11213,
796,
4808,
10786,
5842,
13292,
11537,
628,
198,
198,
28482,
13,
15654,
13,
30238,
7,
37046,
11,
13118,
46787,
8,
198,
28482,
13,
15654,
13,
30238,
7,
11280,
11,
7502,
46787,
8,
198
] | 3.365854 | 82 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# we need to use composite data pipeline with multiblock datasets
alg = vtk.vtkAlgorithm()
pip = vtk.vtkCompositeDataPipeline()
alg.SetDefaultExecutivePrototype(pip)
#del pip
Ren1 = vtk.vtkRenderer()
Ren1.SetBackground(0.33, 0.35, 0.43)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(Ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
Plot3D0 = vtk.vtkMultiBlockPLOT3DReader()
Plot3D0.SetFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
Plot3D0.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
Plot3D0.SetBinaryFile(1)
Plot3D0.SetMultiGrid(0)
Plot3D0.SetHasByteCount(0)
Plot3D0.SetIBlanking(0)
Plot3D0.SetTwoDimensionalGeometry(0)
Plot3D0.SetForceRead(0)
Plot3D0.SetByteOrder(0)
Plot3D0.Update()
output = Plot3D0.GetOutput().GetBlock(0)
Geometry5 = vtk.vtkStructuredGridOutlineFilter()
Geometry5.SetInputData(output)
Mapper5 = vtk.vtkPolyDataMapper()
Mapper5.SetInputConnection(Geometry5.GetOutputPort())
Mapper5.SetImmediateModeRendering(1)
Mapper5.UseLookupTableScalarRangeOn()
Mapper5.SetScalarVisibility(0)
Mapper5.SetScalarModeToDefault()
Actor5 = vtk.vtkActor()
Actor5.SetMapper(Mapper5)
Actor5.GetProperty().SetRepresentationToSurface()
Actor5.GetProperty().SetInterpolationToGouraud()
Actor5.GetProperty().SetAmbient(0.15)
Actor5.GetProperty().SetDiffuse(0.85)
Actor5.GetProperty().SetSpecular(0.1)
Actor5.GetProperty().SetSpecularPower(100)
Actor5.GetProperty().SetSpecularColor(1, 1, 1)
Actor5.GetProperty().SetColor(1, 1, 1)
Ren1.AddActor(Actor5)
ExtractGrid0 = vtk.vtkExtractGrid()
ExtractGrid0.SetInputData(output)
ExtractGrid0.SetVOI(0, 14, 0, 32, 0, 24)
ExtractGrid0.SetSampleRate(1, 1, 1)
ExtractGrid0.SetIncludeBoundary(0)
ExtractGrid1 = vtk.vtkExtractGrid()
ExtractGrid1.SetInputData(output)
ExtractGrid1.SetVOI(14, 29, 0, 32, 0, 24)
ExtractGrid1.SetSampleRate(1, 1, 1)
ExtractGrid1.SetIncludeBoundary(0)
ExtractGrid2 = vtk.vtkExtractGrid()
ExtractGrid2.SetInputData(output)
ExtractGrid2.SetVOI(29, 56, 0, 32, 0, 24)
ExtractGrid2.SetSampleRate(1, 1, 1)
ExtractGrid2.SetIncludeBoundary(0)
LineSourceWidget0 = vtk.vtkLineSource()
LineSourceWidget0.SetPoint1(3.05638, -3.00497, 28.2211)
LineSourceWidget0.SetPoint2(3.05638, 3.95916, 28.2211)
LineSourceWidget0.SetResolution(20)
mbds = vtk.vtkMultiBlockDataSet()
mbds.SetNumberOfBlocks(3)
i = 0
while i < 3:
eval("ExtractGrid" + str(i)).Update()
exec("sg" + str(i) + " = vtk.vtkStructuredGrid()")
eval("sg" + str(i)).ShallowCopy(eval("ExtractGrid" + str(i)).GetOutput())
mbds.SetBlock(i, eval("sg" + str(i)))
i += 1
Stream0 = vtk.vtkStreamTracer()
Stream0.SetInputData(mbds)
Stream0.SetSourceConnection(LineSourceWidget0.GetOutputPort())
Stream0.SetIntegrationStepUnit(2)
Stream0.SetMaximumPropagation(20)
Stream0.SetInitialIntegrationStep(0.5)
Stream0.SetIntegrationDirection(0)
Stream0.SetIntegratorType(0)
Stream0.SetMaximumNumberOfSteps(2000)
Stream0.SetTerminalSpeed(1e-12)
#del mbds
aa = vtk.vtkAssignAttribute()
aa.SetInputConnection(Stream0.GetOutputPort())
aa.Assign("Normals", "NORMALS", "POINT_DATA")
Ribbon0 = vtk.vtkRibbonFilter()
Ribbon0.SetInputConnection(aa.GetOutputPort())
Ribbon0.SetWidth(0.1)
Ribbon0.SetAngle(0)
Ribbon0.SetDefaultNormal(0, 0, 1)
Ribbon0.SetVaryWidth(0)
LookupTable1 = vtk.vtkLookupTable()
LookupTable1.SetNumberOfTableValues(256)
LookupTable1.SetHueRange(0, 0.66667)
LookupTable1.SetSaturationRange(1, 1)
LookupTable1.SetValueRange(1, 1)
LookupTable1.SetTableRange(0.197813, 0.710419)
LookupTable1.SetVectorComponent(0)
LookupTable1.Build()
Mapper10 = vtk.vtkPolyDataMapper()
Mapper10.SetInputConnection(Ribbon0.GetOutputPort())
Mapper10.SetImmediateModeRendering(1)
Mapper10.UseLookupTableScalarRangeOn()
Mapper10.SetScalarVisibility(1)
Mapper10.SetScalarModeToUsePointFieldData()
Mapper10.SelectColorArray("Density")
Mapper10.SetLookupTable(LookupTable1)
Actor10 = vtk.vtkActor()
Actor10.SetMapper(Mapper10)
Actor10.GetProperty().SetRepresentationToSurface()
Actor10.GetProperty().SetInterpolationToGouraud()
Actor10.GetProperty().SetAmbient(0.15)
Actor10.GetProperty().SetDiffuse(0.85)
Actor10.GetProperty().SetSpecular(0)
Actor10.GetProperty().SetSpecularPower(1)
Actor10.GetProperty().SetSpecularColor(1, 1, 1)
Ren1.AddActor(Actor10)
iren.Initialize()
alg.SetDefaultExecutivePrototype(None)
#del alg
#iren.Start()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
201,
198,
11748,
410,
30488,
201,
198,
6738,
410,
30488,
13,
9288,
1330,
23983,
201,
198,
6738,
410,
30488,
13,
22602,
13,
44374,
1330,
410,
30488,
3855,
6601,
30016,
201,
198,
36392,
42,
62,
26947,
62,
13252,
2394,
796,
410,
30488,
3855,
6601,
30016,
3419,
201,
198,
201,
198,
2,
356,
761,
284,
779,
24185,
1366,
11523,
351,
1963,
571,
5354,
40522,
201,
198,
14016,
796,
410,
30488,
13,
85,
30488,
2348,
42289,
3419,
201,
198,
79,
541,
796,
410,
30488,
13,
85,
30488,
5377,
1930,
578,
6601,
47,
541,
4470,
3419,
201,
198,
14016,
13,
7248,
19463,
43885,
19703,
8690,
7,
79,
541,
8,
201,
198,
2,
12381,
7347,
201,
198,
201,
198,
26764,
16,
796,
410,
30488,
13,
85,
30488,
49,
437,
11882,
3419,
201,
198,
26764,
16,
13,
7248,
21756,
7,
15,
13,
2091,
11,
657,
13,
2327,
11,
657,
13,
3559,
8,
201,
198,
918,
16643,
796,
410,
30488,
13,
85,
30488,
45819,
27703,
3419,
201,
198,
918,
16643,
13,
4550,
49,
437,
11882,
7,
26764,
16,
8,
201,
198,
24080,
796,
410,
30488,
13,
85,
30488,
45819,
27703,
9492,
11218,
3419,
201,
198,
24080,
13,
7248,
45819,
27703,
7,
918,
16643,
8,
201,
198,
201,
198,
43328,
18,
35,
15,
796,
410,
30488,
13,
85,
30488,
29800,
12235,
6489,
2394,
18,
35,
33634,
3419,
201,
198,
43328,
18,
35,
15,
13,
7248,
8979,
5376,
7,
36392,
42,
62,
26947,
62,
13252,
2394,
1343,
12813,
6601,
14,
24011,
5431,
89,
13,
8800,
4943,
201,
198,
43328,
18,
35,
15,
13,
7248,
48,
8979,
5376,
7,
36392,
42,
62,
26947,
62,
13252,
2394,
1343,
12813,
6601,
14,
24011,
80,
13,
8800,
4943,
201,
198,
43328,
18,
35,
15,
13,
7248,
33,
3219,
8979,
7,
16,
8,
201,
198,
43328,
18,
35,
15,
13,
7248,
29800,
41339,
7,
15,
8,
201,
198,
43328,
18,
35,
15,
13,
7248,
19242,
40778,
12332,
7,
15,
8,
201,
198,
43328,
18,
35,
15,
13,
7248,
40,
3629,
15230,
7,
15,
8,
201,
198,
43328,
18,
35,
15,
13,
7248,
7571,
35,
16198,
10082,
15748,
7,
15,
8,
201,
198,
43328,
18,
35,
15,
13,
7248,
10292,
5569,
7,
15,
8,
201,
198,
43328,
18,
35,
15,
13,
7248,
40778,
18743,
7,
15,
8,
201,
198,
43328,
18,
35,
15,
13,
10260,
3419,
201,
198,
201,
198,
22915,
796,
28114,
18,
35,
15,
13,
3855,
26410,
22446,
3855,
12235,
7,
15,
8,
201,
198,
201,
198,
10082,
15748,
20,
796,
410,
30488,
13,
85,
30488,
44909,
1522,
41339,
7975,
1370,
22417,
3419,
201,
198,
10082,
15748,
20,
13,
7248,
20560,
6601,
7,
22915,
8,
201,
198,
201,
198,
44,
11463,
20,
796,
410,
30488,
13,
85,
30488,
34220,
6601,
44,
11463,
3419,
201,
198,
44,
11463,
20,
13,
7248,
20560,
32048,
7,
10082,
15748,
20,
13,
3855,
26410,
13924,
28955,
201,
198,
44,
11463,
20,
13,
7248,
3546,
13857,
19076,
49,
437,
1586,
7,
16,
8,
201,
198,
44,
11463,
20,
13,
11041,
8567,
929,
10962,
3351,
282,
283,
17257,
2202,
3419,
201,
198,
44,
11463,
20,
13,
7248,
3351,
282,
283,
15854,
2247,
7,
15,
8,
201,
198,
44,
11463,
20,
13,
7248,
3351,
282,
283,
19076,
2514,
19463,
3419,
201,
198,
201,
198,
40277,
20,
796,
410,
30488,
13,
85,
30488,
40277,
3419,
201,
198,
40277,
20,
13,
7248,
44,
11463,
7,
44,
11463,
20,
8,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
40171,
341,
2514,
14214,
2550,
3419,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
9492,
16104,
341,
2514,
38,
280,
22863,
3419,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
35649,
1153,
7,
15,
13,
1314,
8,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
28813,
1904,
7,
15,
13,
5332,
8,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
5248,
10440,
7,
15,
13,
16,
8,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
5248,
10440,
13434,
7,
3064,
8,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
5248,
10440,
10258,
7,
16,
11,
352,
11,
352,
8,
201,
198,
40277,
20,
13,
3855,
21746,
22446,
7248,
10258,
7,
16,
11,
352,
11,
352,
8,
201,
198,
201,
198,
26764,
16,
13,
4550,
40277,
7,
40277,
20,
8,
201,
198,
201,
198,
11627,
974,
41339,
15,
796,
410,
30488,
13,
85,
30488,
11627,
974,
41339,
3419,
201,
198,
11627,
974,
41339,
15,
13,
7248,
20560,
6601,
7,
22915,
8,
201,
198,
11627,
974,
41339,
15,
13,
7248,
29516,
40,
7,
15,
11,
1478,
11,
657,
11,
3933,
11,
657,
11,
1987,
8,
201,
198,
11627,
974,
41339,
15,
13,
7248,
36674,
32184,
7,
16,
11,
352,
11,
352,
8,
201,
198,
11627,
974,
41339,
15,
13,
7248,
818,
9152,
49646,
560,
7,
15,
8,
201,
198,
201,
198,
11627,
974,
41339,
16,
796,
410,
30488,
13,
85,
30488,
11627,
974,
41339,
3419,
201,
198,
11627,
974,
41339,
16,
13,
7248,
20560,
6601,
7,
22915,
8,
201,
198,
11627,
974,
41339,
16,
13,
7248,
29516,
40,
7,
1415,
11,
2808,
11,
657,
11,
3933,
11,
657,
11,
1987,
8,
201,
198,
11627,
974,
41339,
16,
13,
7248,
36674,
32184,
7,
16,
11,
352,
11,
352,
8,
201,
198,
11627,
974,
41339,
16,
13,
7248,
818,
9152,
49646,
560,
7,
15,
8,
201,
198,
201,
198,
11627,
974,
41339,
17,
796,
410,
30488,
13,
85,
30488,
11627,
974,
41339,
3419,
201,
198,
11627,
974,
41339,
17,
13,
7248,
20560,
6601,
7,
22915,
8,
201,
198,
11627,
974,
41339,
17,
13,
7248,
29516,
40,
7,
1959,
11,
7265,
11,
657,
11,
3933,
11,
657,
11,
1987,
8,
201,
198,
11627,
974,
41339,
17,
13,
7248,
36674,
32184,
7,
16,
11,
352,
11,
352,
8,
201,
198,
11627,
974,
41339,
17,
13,
7248,
818,
9152,
49646,
560,
7,
15,
8,
201,
198,
201,
198,
13949,
7416,
38300,
15,
796,
410,
30488,
13,
85,
30488,
13949,
7416,
3419,
201,
198,
13949,
7416,
38300,
15,
13,
7248,
12727,
16,
7,
18,
13,
2713,
21,
2548,
11,
532,
18,
13,
405,
38073,
11,
2579,
13,
1828,
1157,
8,
201,
198,
13949,
7416,
38300,
15,
13,
7248,
12727,
17,
7,
18,
13,
2713,
21,
2548,
11,
513,
13,
24,
3270,
1433,
11,
2579,
13,
1828,
1157,
8,
201,
198,
13949,
7416,
38300,
15,
13,
7248,
4965,
2122,
7,
1238,
8,
201,
198,
201,
198,
2022,
9310,
796,
410,
30488,
13,
85,
30488,
29800,
12235,
6601,
7248,
3419,
201,
198,
2022,
9310,
13,
7248,
15057,
5189,
45356,
7,
18,
8,
201,
198,
201,
198,
72,
796,
657,
201,
198,
4514,
1312,
1279,
513,
25,
201,
198,
220,
220,
220,
5418,
7203,
11627,
974,
41339,
1,
1343,
965,
7,
72,
29720,
10260,
3419,
201,
198,
220,
220,
220,
2452,
7203,
45213,
1,
1343,
965,
7,
72,
8,
1343,
366,
796,
410,
30488,
13,
85,
30488,
44909,
1522,
41339,
3419,
4943,
201,
198,
220,
220,
220,
5418,
7203,
45213,
1,
1343,
965,
7,
72,
29720,
2484,
12154,
29881,
7,
18206,
7203,
11627,
974,
41339,
1,
1343,
965,
7,
72,
29720,
3855,
26410,
28955,
201,
198,
220,
220,
220,
285,
65,
9310,
13,
7248,
12235,
7,
72,
11,
5418,
7203,
45213,
1,
1343,
965,
7,
72,
22305,
201,
198,
220,
220,
220,
1312,
15853,
352,
201,
198,
201,
198,
12124,
15,
796,
410,
30488,
13,
85,
30488,
12124,
2898,
11736,
3419,
201,
198,
12124,
15,
13,
7248,
20560,
6601,
7,
2022,
9310,
8,
201,
198,
12124,
15,
13,
7248,
7416,
32048,
7,
13949,
7416,
38300,
15,
13,
3855,
26410,
13924,
28955,
201,
198,
12124,
15,
13,
7248,
34500,
1358,
8600,
26453,
7,
17,
8,
201,
198,
12124,
15,
13,
7248,
40541,
24331,
363,
341,
7,
1238,
8,
201,
198,
12124,
15,
13,
7248,
24243,
34500,
1358,
8600,
7,
15,
13,
20,
8,
201,
198,
12124,
15,
13,
7248,
34500,
1358,
35,
4154,
7,
15,
8,
201,
198,
12124,
15,
13,
7248,
34500,
12392,
6030,
7,
15,
8,
201,
198,
12124,
15,
13,
7248,
40541,
15057,
5189,
8600,
82,
7,
11024,
8,
201,
198,
12124,
15,
13,
7248,
44798,
282,
22785,
7,
16,
68,
12,
1065,
8,
201,
198,
201,
198,
2,
12381,
285,
65,
9310,
201,
198,
201,
198,
7252,
796,
410,
30488,
13,
85,
30488,
8021,
570,
33682,
3419,
201,
198,
7252,
13,
7248,
20560,
32048,
7,
12124,
15,
13,
3855,
26410,
13924,
28955,
201,
198,
7252,
13,
8021,
570,
7203,
35393,
874,
1600,
366,
35510,
44,
23333,
1600,
366,
16402,
12394,
62,
26947,
4943,
201,
198,
201,
198,
49,
571,
4189,
15,
796,
410,
30488,
13,
85,
30488,
49,
571,
4189,
22417,
3419,
201,
198,
49,
571,
4189,
15,
13,
7248,
20560,
32048,
7,
7252,
13,
3855,
26410,
13924,
28955,
201,
198,
49,
571,
4189,
15,
13,
7248,
30916,
7,
15,
13,
16,
8,
201,
198,
49,
571,
4189,
15,
13,
7248,
13450,
293,
7,
15,
8,
201,
198,
49,
571,
4189,
15,
13,
7248,
19463,
26447,
7,
15,
11,
657,
11,
352,
8,
201,
198,
49,
571,
4189,
15,
13,
7248,
53,
560,
30916,
7,
15,
8,
201,
198,
201,
198,
8567,
929,
10962,
16,
796,
410,
30488,
13,
85,
30488,
8567,
929,
10962,
3419,
201,
198,
8567,
929,
10962,
16,
13,
7248,
15057,
5189,
10962,
40161,
7,
11645,
8,
201,
198,
8567,
929,
10962,
16,
13,
7248,
39,
518,
17257,
7,
15,
11,
657,
13,
19060,
22,
8,
201,
198,
8567,
929,
10962,
16,
13,
7248,
50,
36921,
17257,
7,
16,
11,
352,
8,
201,
198,
8567,
929,
10962,
16,
13,
7248,
11395,
17257,
7,
16,
11,
352,
8,
201,
198,
8567,
929,
10962,
16,
13,
7248,
10962,
17257,
7,
15,
13,
37950,
1485,
11,
657,
13,
22,
13464,
1129,
8,
201,
198,
8567,
929,
10962,
16,
13,
7248,
38469,
21950,
7,
15,
8,
201,
198,
8567,
929,
10962,
16,
13,
15580,
3419,
201,
198,
201,
198,
44,
11463,
940,
796,
410,
30488,
13,
85,
30488,
34220,
6601,
44,
11463,
3419,
201,
198,
44,
11463,
940,
13,
7248,
20560,
32048,
7,
49,
571,
4189,
15,
13,
3855,
26410,
13924,
28955,
201,
198,
44,
11463,
940,
13,
7248,
3546,
13857,
19076,
49,
437,
1586,
7,
16,
8,
201,
198,
44,
11463,
940,
13,
11041,
8567,
929,
10962,
3351,
282,
283,
17257,
2202,
3419,
201,
198,
44,
11463,
940,
13,
7248,
3351,
282,
283,
15854,
2247,
7,
16,
8,
201,
198,
44,
11463,
940,
13,
7248,
3351,
282,
283,
19076,
2514,
11041,
12727,
15878,
6601,
3419,
201,
198,
44,
11463,
940,
13,
17563,
10258,
19182,
7203,
35,
6377,
4943,
201,
198,
44,
11463,
940,
13,
7248,
8567,
929,
10962,
7,
8567,
929,
10962,
16,
8,
201,
198,
201,
198,
40277,
940,
796,
410,
30488,
13,
85,
30488,
40277,
3419,
201,
198,
40277,
940,
13,
7248,
44,
11463,
7,
44,
11463,
940,
8,
201,
198,
40277,
940,
13,
3855,
21746,
22446,
7248,
40171,
341,
2514,
14214,
2550,
3419,
201,
198,
40277,
940,
13,
3855,
21746,
22446,
7248,
9492,
16104,
341,
2514,
38,
280,
22863,
3419,
201,
198,
40277,
940,
13,
3855,
21746,
22446,
7248,
35649,
1153,
7,
15,
13,
1314,
8,
201,
198,
40277,
940,
13,
3855,
21746,
22446,
7248,
28813,
1904,
7,
15,
13,
5332,
8,
201,
198,
40277,
940,
13,
3855,
21746,
22446,
7248,
5248,
10440,
7,
15,
8,
201,
198,
40277,
940,
13,
3855,
21746,
22446,
7248,
5248,
10440,
13434,
7,
16,
8,
201,
198,
40277,
940,
13,
3855,
21746,
22446,
7248,
5248,
10440,
10258,
7,
16,
11,
352,
11,
352,
8,
201,
198,
201,
198,
26764,
16,
13,
4550,
40277,
7,
40277,
940,
8,
201,
198,
201,
198,
24080,
13,
24243,
1096,
3419,
201,
198,
201,
198,
14016,
13,
7248,
19463,
43885,
19703,
8690,
7,
14202,
8,
201,
198,
2,
12381,
435,
70,
201,
198,
201,
198,
2,
24080,
13,
10434,
3419,
201,
198
] | 2.349255 | 1,947 |
from __future__ import absolute_import
from pdbuddy.formatters.base import BaseFormatter
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
6738,
279,
9945,
21584,
13,
18982,
1010,
13,
8692,
1330,
7308,
8479,
1436,
628
] | 3.791667 | 24 |
import vsearch as vsearch
from flask import Flask, render_template, request, redirect
app= Flask(__name__)
#
# @app.route('/')
# def hello() -> str:
# return redirect('/entry')
@app.route('/search4', methods=['POST'])
@app.route('/')
@app.route('/entry')
if __name__ == '__main__0':
app.run(debug=True)
| [
11748,
410,
12947,
355,
410,
12947,
198,
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
11,
2581,
11,
18941,
198,
198,
1324,
28,
46947,
7,
834,
3672,
834,
8,
198,
198,
2,
198,
2,
2488,
1324,
13,
38629,
10786,
14,
11537,
198,
2,
825,
23748,
3419,
4613,
965,
25,
198,
2,
220,
220,
220,
220,
1441,
18941,
10786,
14,
13000,
11537,
628,
198,
31,
1324,
13,
38629,
10786,
14,
12947,
19,
3256,
5050,
28,
17816,
32782,
6,
12962,
628,
198,
31,
1324,
13,
38629,
10786,
14,
11537,
198,
31,
1324,
13,
38629,
10786,
14,
13000,
11537,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
15,
10354,
198,
220,
220,
220,
598,
13,
5143,
7,
24442,
28,
17821,
8,
198
] | 2.614754 | 122 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None | [
2,
30396,
329,
257,
13934,
5509,
10139,
13,
198,
2,
1398,
12200,
19667,
25,
198,
2,
220,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2124,
2599,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2100,
796,
2124,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9464,
796,
6045,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3506,
796,
6045
] | 2.175676 | 74 |
import numpy as np
import pandas as pd
def calculate_dG(data_dict: dict, gas_constant: float, temperature: float, rxn_order: list = None) -> tuple:
"""
Given a dictionary representing a GRASP input file, calculates the minimum and maximum reaction dGs based on the
standard dGs in thermoRxns and metabolite concentrations in thermoMets.
It also calculates the mass-action ratio and the part of the dG based on the mass-action ratio.
Args:
data_dict: a dictionary that represents the excel file with the GRASP model.
gas_constant: the gas constant to calculate the Gibbs energy.
temperature: the temperature to calculate the Gibbs energy.
rxn_order: a list with the reactions order (optional).
Returns:
Mass action ratio dataframe, dG_Q dataframe, Gibbs energies dataframe.
"""
dG_Q_df = pd.DataFrame()
dG_df = pd.DataFrame()
ma_df = pd.DataFrame()
stoic_df = data_dict['stoic']
mets_conc_df = data_dict['thermoMets']
mets_conc_df['mean (M)'] = (mets_conc_df['min (M)'] + mets_conc_df['max (M)']) / 2.
dG_std_df = data_dict['thermoRxns']
dG_std_df['∆Gr_mean'] = (dG_std_df['∆Gr\'_min (kJ/mol)'] + dG_std_df['∆Gr\'_max (kJ/mol)']) / 2.
rxn_names = stoic_df.index.values
stoic_matrix = stoic_df.values
min_met_conc = mets_conc_df['min (M)'].values
max_met_conc = mets_conc_df['max (M)'].values
dG_list_mean, dG_Q_list_mean, ma_ratio_list_mean = _get_dG_list(rxn_names, stoic_matrix,
mets_conc_df['mean (M)'].values,
mets_conc_df['mean (M)'].values,
dG_std_df['∆Gr_mean'].values,
gas_constant, temperature)
dG_list_min, dG_Q_list_min, ma_ratio_list_min = _get_dG_list(rxn_names, stoic_matrix, max_met_conc, min_met_conc,
dG_std_df['∆Gr\'_min (kJ/mol)'].values,
gas_constant, temperature)
dG_list_max, dG_Q_list_max, ma_ratio_list_max = _get_dG_list(rxn_names, stoic_matrix, min_met_conc, max_met_conc,
dG_std_df['∆Gr\'_max (kJ/mol)'].values,
gas_constant, temperature)
ma_df['ma_min'] = ma_ratio_list_min
ma_df['ma_mean'] = ma_ratio_list_mean
ma_df['ma_max'] = ma_ratio_list_max
dG_Q_df['∆G_Q_min'] = dG_Q_list_min
dG_Q_df['∆G_Q_mean'] = dG_Q_list_mean
dG_Q_df['∆G_Q_max'] = dG_Q_list_max
dG_df['∆G_min'] = dG_list_min
dG_df['∆G_mean'] = dG_list_mean
dG_df['∆G_max'] = dG_list_max
ma_df.index = rxn_names
dG_Q_df.index = rxn_names
dG_df.index = rxn_names
if rxn_order:
ma_df = ma_df.reindex(rxn_order)
dG_Q_df = dG_Q_df.reindex(rxn_order)
dG_df = dG_df.reindex(rxn_order)
return ma_df, dG_Q_df, dG_df
def get_robust_fluxes(data_dict: dict, rxn_order: list = None) -> pd.DataFrame:
"""
Given a dictionary representing a GRASP input file, it calculates the robust fluxes (almost) as in GRASP,
unless the system is not fully determined.
Args:
data_dict: path to the GRASP input file
rxn_order: a list with the reactions order (optional)
Returns:
fluxes_df: dataframe with flux mean and std values
"""
fluxes_df = pd.DataFrame()
stoic_balanced, rxn_list = _get_balanced_s_matrix(data_dict)
# n_reactions = len(rxn_order)
meas_rates_mean, meas_rates_std = _get_meas_rates(data_dict, rxn_list)
v_mean, v_std = _compute_robust_fluxes(stoic_balanced, meas_rates_mean, meas_rates_std, rxn_list)
fluxes_df['vref_mean (mmol/L/h)'] = v_mean
fluxes_df['vref_std (mmol/L/h)'] = v_std
fluxes_df.index = rxn_list
if rxn_order:
fluxes_df = fluxes_df.reindex(rxn_order)
fluxes_df = fluxes_df.reindex(rxn_order)
return fluxes_df
def check_thermodynamic_feasibility(data_dict: dict) -> tuple:
"""
Given a dictionary representing a GRASP input file, it checks if the reaction's dG are compatible with the
respective fluxes. It works both when all fluxes are specified in measRates and when robust fluxes are calculated
for a fully determined system. If the fluxes are not fully specified not the system is fully determined, it
doesn't work.
Args:
data_dict: a dictionary representing a GRASP input file.
Returns:
Whether or not the model is thermodynamically feasible plus fluxes and Gibbs energies dataframes.
"""
print('\nChecking if fluxes and Gibbs energies are compatible.\n')
flag = False
temperature = 298 # in K
gas_constant = 8.314 * 10**-3 # in kJ K^-1 mol^-1
stoic_df = data_dict['stoic']
flux_df = data_dict['measRates']
ma_df, dG_Q_df, dG_df = calculate_dG(data_dict, gas_constant, temperature)
if len(stoic_df.index) != len(flux_df.index):
flux_df = get_robust_fluxes(data_dict)
for rxn in flux_df.index:
if flux_df.loc[rxn, 'vref_mean (mmol/L/h)'] > 0 and dG_df.loc[rxn, '∆G_min'] > 0:
print(f'The flux and ∆G range seem to be incompatible for reaction {rxn}')
flag = True
if flux_df.loc[rxn, 'vref_mean (mmol/L/h)'] < 0 and dG_df.loc[rxn, '∆G_max'] < 0:
print(f'The flux and ∆G range seem to be incompatible for reaction {rxn}')
flag = True
if flag is False:
print('Everything seems to be OK.')
return flag, flux_df, dG_df
| [
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
628,
198,
198,
4299,
15284,
62,
67,
38,
7,
7890,
62,
11600,
25,
8633,
11,
3623,
62,
9979,
415,
25,
12178,
11,
5951,
25,
12178,
11,
374,
87,
77,
62,
2875,
25,
1351,
796,
6045,
8,
4613,
46545,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
11259,
257,
22155,
10200,
257,
10863,
1921,
47,
5128,
2393,
11,
43707,
262,
5288,
290,
5415,
6317,
288,
33884,
1912,
319,
262,
198,
220,
220,
220,
3210,
288,
33884,
287,
10811,
5908,
49,
87,
5907,
290,
14623,
578,
14587,
287,
10811,
5908,
44,
1039,
13,
198,
220,
220,
220,
632,
635,
43707,
262,
2347,
12,
2673,
8064,
290,
262,
636,
286,
262,
288,
38,
1912,
319,
262,
2347,
12,
2673,
8064,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
11600,
25,
257,
22155,
326,
6870,
262,
27336,
2393,
351,
262,
10863,
1921,
47,
2746,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3623,
62,
9979,
415,
25,
262,
3623,
6937,
284,
15284,
262,
41071,
2568,
13,
198,
220,
220,
220,
220,
220,
220,
220,
5951,
25,
262,
5951,
284,
15284,
262,
41071,
2568,
13,
198,
220,
220,
220,
220,
220,
220,
220,
374,
87,
77,
62,
2875,
25,
257,
1351,
351,
262,
12737,
1502,
357,
25968,
737,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5674,
2223,
8064,
1366,
14535,
11,
288,
38,
62,
48,
1366,
14535,
11,
41071,
27598,
1366,
14535,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
288,
38,
62,
48,
62,
7568,
796,
279,
67,
13,
6601,
19778,
3419,
198,
220,
220,
220,
288,
38,
62,
7568,
796,
279,
67,
13,
6601,
19778,
3419,
198,
220,
220,
220,
17266,
62,
7568,
796,
279,
67,
13,
6601,
19778,
3419,
628,
220,
220,
220,
3995,
291,
62,
7568,
796,
1366,
62,
11600,
17816,
301,
78,
291,
20520,
628,
220,
220,
220,
285,
1039,
62,
1102,
66,
62,
7568,
796,
1366,
62,
11600,
17816,
490,
5908,
44,
1039,
20520,
198,
220,
220,
220,
285,
1039,
62,
1102,
66,
62,
7568,
17816,
32604,
357,
44,
8,
20520,
796,
357,
76,
1039,
62,
1102,
66,
62,
7568,
17816,
1084,
357,
44,
8,
20520,
1343,
285,
1039,
62,
1102,
66,
62,
7568,
17816,
9806,
357,
44,
33047,
12962,
1220,
362,
13,
628,
220,
220,
220,
288,
38,
62,
19282,
62,
7568,
796,
1366,
62,
11600,
17816,
490,
5908,
49,
87,
5907,
20520,
198,
220,
220,
220,
288,
38,
62,
19282,
62,
7568,
17816,
24861,
228,
8642,
62,
32604,
20520,
796,
357,
67,
38,
62,
19282,
62,
7568,
17816,
24861,
228,
8642,
43054,
62,
1084,
357,
74,
41,
14,
43132,
8,
20520,
1343,
288,
38,
62,
19282,
62,
7568,
17816,
24861,
228,
8642,
43054,
62,
9806,
357,
74,
41,
14,
43132,
33047,
12962,
1220,
362,
13,
628,
220,
220,
220,
374,
87,
77,
62,
14933,
796,
3995,
291,
62,
7568,
13,
9630,
13,
27160,
628,
220,
220,
220,
3995,
291,
62,
6759,
8609,
796,
3995,
291,
62,
7568,
13,
27160,
628,
220,
220,
220,
949,
62,
4164,
62,
1102,
66,
796,
285,
1039,
62,
1102,
66,
62,
7568,
17816,
1084,
357,
44,
33047,
4083,
27160,
198,
220,
220,
220,
3509,
62,
4164,
62,
1102,
66,
796,
285,
1039,
62,
1102,
66,
62,
7568,
17816,
9806,
357,
44,
33047,
4083,
27160,
628,
220,
220,
220,
288,
38,
62,
4868,
62,
32604,
11,
288,
38,
62,
48,
62,
4868,
62,
32604,
11,
17266,
62,
10366,
952,
62,
4868,
62,
32604,
796,
4808,
1136,
62,
67,
38,
62,
4868,
7,
40914,
77,
62,
14933,
11,
3995,
291,
62,
6759,
8609,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
1039,
62,
1102,
66,
62,
7568,
17816,
32604,
357,
44,
33047,
4083,
27160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
1039,
62,
1102,
66,
62,
7568,
17816,
32604,
357,
44,
33047,
4083,
27160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
38,
62,
19282,
62,
7568,
17816,
24861,
228,
8642,
62,
32604,
6,
4083,
27160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3623,
62,
9979,
415,
11,
5951,
8,
198,
220,
220,
220,
288,
38,
62,
4868,
62,
1084,
11,
288,
38,
62,
48,
62,
4868,
62,
1084,
11,
17266,
62,
10366,
952,
62,
4868,
62,
1084,
796,
4808,
1136,
62,
67,
38,
62,
4868,
7,
40914,
77,
62,
14933,
11,
3995,
291,
62,
6759,
8609,
11,
3509,
62,
4164,
62,
1102,
66,
11,
949,
62,
4164,
62,
1102,
66,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
38,
62,
19282,
62,
7568,
17816,
24861,
228,
8642,
43054,
62,
1084,
357,
74,
41,
14,
43132,
33047,
4083,
27160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3623,
62,
9979,
415,
11,
5951,
8,
198,
220,
220,
220,
288,
38,
62,
4868,
62,
9806,
11,
288,
38,
62,
48,
62,
4868,
62,
9806,
11,
17266,
62,
10366,
952,
62,
4868,
62,
9806,
796,
4808,
1136,
62,
67,
38,
62,
4868,
7,
40914,
77,
62,
14933,
11,
3995,
291,
62,
6759,
8609,
11,
949,
62,
4164,
62,
1102,
66,
11,
3509,
62,
4164,
62,
1102,
66,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
38,
62,
19282,
62,
7568,
17816,
24861,
228,
8642,
43054,
62,
9806,
357,
74,
41,
14,
43132,
33047,
4083,
27160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3623,
62,
9979,
415,
11,
5951,
8,
628,
220,
220,
220,
17266,
62,
7568,
17816,
2611,
62,
1084,
20520,
796,
17266,
62,
10366,
952,
62,
4868,
62,
1084,
198,
220,
220,
220,
17266,
62,
7568,
17816,
2611,
62,
32604,
20520,
796,
17266,
62,
10366,
952,
62,
4868,
62,
32604,
198,
220,
220,
220,
17266,
62,
7568,
17816,
2611,
62,
9806,
20520,
796,
17266,
62,
10366,
952,
62,
4868,
62,
9806,
628,
220,
220,
220,
288,
38,
62,
48,
62,
7568,
17816,
24861,
228,
38,
62,
48,
62,
1084,
20520,
796,
288,
38,
62,
48,
62,
4868,
62,
1084,
198,
220,
220,
220,
288,
38,
62,
48,
62,
7568,
17816,
24861,
228,
38,
62,
48,
62,
32604,
20520,
796,
288,
38,
62,
48,
62,
4868,
62,
32604,
198,
220,
220,
220,
288,
38,
62,
48,
62,
7568,
17816,
24861,
228,
38,
62,
48,
62,
9806,
20520,
796,
288,
38,
62,
48,
62,
4868,
62,
9806,
628,
220,
220,
220,
288,
38,
62,
7568,
17816,
24861,
228,
38,
62,
1084,
20520,
796,
288,
38,
62,
4868,
62,
1084,
198,
220,
220,
220,
288,
38,
62,
7568,
17816,
24861,
228,
38,
62,
32604,
20520,
796,
288,
38,
62,
4868,
62,
32604,
198,
220,
220,
220,
288,
38,
62,
7568,
17816,
24861,
228,
38,
62,
9806,
20520,
796,
288,
38,
62,
4868,
62,
9806,
628,
220,
220,
220,
17266,
62,
7568,
13,
9630,
796,
374,
87,
77,
62,
14933,
198,
220,
220,
220,
288,
38,
62,
48,
62,
7568,
13,
9630,
796,
374,
87,
77,
62,
14933,
198,
220,
220,
220,
288,
38,
62,
7568,
13,
9630,
796,
374,
87,
77,
62,
14933,
628,
220,
220,
220,
611,
374,
87,
77,
62,
2875,
25,
198,
220,
220,
220,
220,
220,
220,
220,
17266,
62,
7568,
796,
17266,
62,
7568,
13,
260,
9630,
7,
40914,
77,
62,
2875,
8,
198,
220,
220,
220,
220,
220,
220,
220,
288,
38,
62,
48,
62,
7568,
796,
288,
38,
62,
48,
62,
7568,
13,
260,
9630,
7,
40914,
77,
62,
2875,
8,
198,
220,
220,
220,
220,
220,
220,
220,
288,
38,
62,
7568,
796,
288,
38,
62,
7568,
13,
260,
9630,
7,
40914,
77,
62,
2875,
8,
628,
220,
220,
220,
1441,
17266,
62,
7568,
11,
288,
38,
62,
48,
62,
7568,
11,
288,
38,
62,
7568,
628,
628,
198,
198,
4299,
651,
62,
22609,
436,
62,
69,
22564,
274,
7,
7890,
62,
11600,
25,
8633,
11,
374,
87,
77,
62,
2875,
25,
1351,
796,
6045,
8,
4613,
279,
67,
13,
6601,
19778,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
11259,
257,
22155,
10200,
257,
10863,
1921,
47,
5128,
2393,
11,
340,
43707,
262,
12373,
28462,
274,
357,
28177,
8,
355,
287,
10863,
1921,
47,
11,
198,
220,
220,
220,
4556,
262,
1080,
318,
407,
3938,
5295,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
11600,
25,
3108,
284,
262,
10863,
1921,
47,
5128,
2393,
198,
220,
220,
220,
220,
220,
220,
220,
374,
87,
77,
62,
2875,
25,
257,
1351,
351,
262,
12737,
1502,
357,
25968,
8,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
274,
62,
7568,
25,
1366,
14535,
351,
28462,
1612,
290,
14367,
3815,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
28462,
274,
62,
7568,
796,
279,
67,
13,
6601,
19778,
3419,
198,
220,
220,
220,
3995,
291,
62,
27753,
11,
374,
87,
77,
62,
4868,
796,
4808,
1136,
62,
27753,
62,
82,
62,
6759,
8609,
7,
7890,
62,
11600,
8,
198,
220,
220,
220,
1303,
299,
62,
260,
4658,
796,
18896,
7,
40914,
77,
62,
2875,
8,
628,
220,
220,
220,
2212,
62,
9700,
62,
32604,
11,
2212,
62,
9700,
62,
19282,
796,
4808,
1136,
62,
1326,
292,
62,
9700,
7,
7890,
62,
11600,
11,
374,
87,
77,
62,
4868,
8,
628,
220,
220,
220,
410,
62,
32604,
11,
410,
62,
19282,
796,
4808,
5589,
1133,
62,
22609,
436,
62,
69,
22564,
274,
7,
301,
78,
291,
62,
27753,
11,
2212,
62,
9700,
62,
32604,
11,
2212,
62,
9700,
62,
19282,
11,
374,
87,
77,
62,
4868,
8,
628,
220,
220,
220,
28462,
274,
62,
7568,
17816,
85,
5420,
62,
32604,
357,
3020,
349,
14,
43,
14,
71,
8,
20520,
796,
410,
62,
32604,
198,
220,
220,
220,
28462,
274,
62,
7568,
17816,
85,
5420,
62,
19282,
357,
3020,
349,
14,
43,
14,
71,
8,
20520,
796,
410,
62,
19282,
628,
220,
220,
220,
28462,
274,
62,
7568,
13,
9630,
796,
374,
87,
77,
62,
4868,
198,
220,
220,
220,
611,
374,
87,
77,
62,
2875,
25,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
274,
62,
7568,
796,
28462,
274,
62,
7568,
13,
260,
9630,
7,
40914,
77,
62,
2875,
8,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
274,
62,
7568,
796,
28462,
274,
62,
7568,
13,
260,
9630,
7,
40914,
77,
62,
2875,
8,
628,
220,
220,
220,
1441,
28462,
274,
62,
7568,
628,
198,
4299,
2198,
62,
490,
76,
34743,
62,
5036,
292,
2247,
7,
7890,
62,
11600,
25,
8633,
8,
4613,
46545,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
11259,
257,
22155,
10200,
257,
10863,
1921,
47,
5128,
2393,
11,
340,
8794,
611,
262,
6317,
338,
288,
38,
389,
11670,
351,
262,
198,
220,
220,
220,
11756,
28462,
274,
13,
632,
2499,
1111,
618,
477,
28462,
274,
389,
7368,
287,
2212,
49,
689,
290,
618,
12373,
28462,
274,
389,
10488,
198,
220,
220,
220,
329,
257,
3938,
5295,
1080,
13,
1002,
262,
28462,
274,
389,
407,
3938,
7368,
407,
262,
1080,
318,
3938,
5295,
11,
340,
198,
220,
220,
220,
1595,
470,
670,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
11600,
25,
257,
22155,
10200,
257,
10863,
1921,
47,
5128,
2393,
13,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
10127,
393,
407,
262,
2746,
318,
21969,
24319,
1146,
23498,
5556,
28462,
274,
290,
41071,
27598,
1366,
37805,
13,
628,
220,
220,
220,
37227,
628,
220,
220,
220,
3601,
10786,
59,
77,
9787,
278,
611,
28462,
274,
290,
41071,
27598,
389,
11670,
13,
59,
77,
11537,
628,
220,
220,
220,
6056,
796,
10352,
198,
220,
220,
220,
5951,
796,
37576,
220,
1303,
287,
509,
198,
220,
220,
220,
3623,
62,
9979,
415,
796,
807,
13,
33638,
1635,
838,
1174,
12,
18,
220,
1303,
287,
479,
41,
509,
61,
12,
16,
18605,
61,
12,
16,
628,
220,
220,
220,
3995,
291,
62,
7568,
796,
1366,
62,
11600,
17816,
301,
78,
291,
20520,
198,
220,
220,
220,
28462,
62,
7568,
796,
1366,
62,
11600,
17816,
1326,
292,
49,
689,
20520,
628,
220,
220,
220,
17266,
62,
7568,
11,
288,
38,
62,
48,
62,
7568,
11,
288,
38,
62,
7568,
796,
15284,
62,
67,
38,
7,
7890,
62,
11600,
11,
3623,
62,
9979,
415,
11,
5951,
8,
628,
220,
220,
220,
611,
18896,
7,
301,
78,
291,
62,
7568,
13,
9630,
8,
14512,
18896,
7,
69,
22564,
62,
7568,
13,
9630,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
62,
7568,
796,
651,
62,
22609,
436,
62,
69,
22564,
274,
7,
7890,
62,
11600,
8,
628,
220,
220,
220,
329,
374,
87,
77,
287,
28462,
62,
7568,
13,
9630,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
28462,
62,
7568,
13,
17946,
58,
40914,
77,
11,
705,
85,
5420,
62,
32604,
357,
3020,
349,
14,
43,
14,
71,
8,
20520,
1875,
657,
290,
288,
38,
62,
7568,
13,
17946,
58,
40914,
77,
11,
705,
24861,
228,
38,
62,
1084,
20520,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
6,
464,
28462,
290,
18872,
228,
38,
2837,
1283,
284,
307,
27294,
329,
6317,
1391,
40914,
77,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6056,
796,
6407,
628,
220,
220,
220,
220,
220,
220,
220,
611,
28462,
62,
7568,
13,
17946,
58,
40914,
77,
11,
705,
85,
5420,
62,
32604,
357,
3020,
349,
14,
43,
14,
71,
8,
20520,
1279,
657,
290,
288,
38,
62,
7568,
13,
17946,
58,
40914,
77,
11,
705,
24861,
228,
38,
62,
9806,
20520,
1279,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
6,
464,
28462,
290,
18872,
228,
38,
2837,
1283,
284,
307,
27294,
329,
6317,
1391,
40914,
77,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6056,
796,
6407,
628,
220,
220,
220,
611,
6056,
318,
10352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
19693,
2331,
284,
307,
7477,
2637,
8,
628,
220,
220,
220,
1441,
6056,
11,
28462,
62,
7568,
11,
288,
38,
62,
7568,
198
] | 2.034507 | 2,840 |
import clustering
import numpy as np
from sklearn import datasets
import matplotlib.pyplot as plt
import dionysus as dion
import random
if __name__ == '__main__':
seed = 0
dataset = gen_data2(seed, noise=0.1, n_samples=100)
diagrams = compute_diagrams(dataset)
diagrams_cluster = clustering.reformat_diagrams(diagrams)
r, M = clustering.pd_fuzzy(diagrams_cluster, 3, verbose=True, max_iter=20)
print("Membership values")
print(r)
plot_dataset(dataset)
plot_all_diagrams(diagrams)
plot_three_clusters(M)
# Other synthetic data, not used in the paper
# data = gen_data(seed, noise=0.3)
# plot_all(data, diagrams)
# plot_clusters(M)
# plot_everything(dataset, diagrams)
| [
198,
11748,
32966,
1586,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
1341,
35720,
1330,
40522,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
288,
295,
893,
385,
355,
288,
295,
198,
11748,
4738,
628,
628,
628,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
628,
220,
220,
220,
9403,
796,
657,
198,
220,
220,
220,
27039,
796,
2429,
62,
7890,
17,
7,
28826,
11,
7838,
28,
15,
13,
16,
11,
299,
62,
82,
12629,
28,
3064,
8,
628,
220,
220,
220,
37067,
796,
24061,
62,
10989,
6713,
82,
7,
19608,
292,
316,
8,
198,
220,
220,
220,
37067,
62,
565,
5819,
796,
32966,
1586,
13,
260,
18982,
62,
10989,
6713,
82,
7,
10989,
6713,
82,
8,
198,
220,
220,
220,
374,
11,
337,
796,
32966,
1586,
13,
30094,
62,
69,
4715,
88,
7,
10989,
6713,
82,
62,
565,
5819,
11,
513,
11,
15942,
577,
28,
17821,
11,
3509,
62,
2676,
28,
1238,
8,
628,
220,
220,
220,
3601,
7203,
25341,
1056,
3815,
4943,
198,
220,
220,
220,
3601,
7,
81,
8,
628,
220,
220,
220,
7110,
62,
19608,
292,
316,
7,
19608,
292,
316,
8,
198,
220,
220,
220,
7110,
62,
439,
62,
10989,
6713,
82,
7,
10989,
6713,
82,
8,
198,
220,
220,
220,
7110,
62,
15542,
62,
565,
13654,
7,
44,
8,
628,
220,
220,
220,
1303,
3819,
18512,
1366,
11,
407,
973,
287,
262,
3348,
198,
220,
220,
220,
1303,
1366,
796,
2429,
62,
7890,
7,
28826,
11,
7838,
28,
15,
13,
18,
8,
198,
220,
220,
220,
1303,
7110,
62,
439,
7,
7890,
11,
37067,
8,
198,
220,
220,
220,
1303,
7110,
62,
565,
13654,
7,
44,
8,
198,
220,
220,
220,
1303,
7110,
62,
37814,
7,
19608,
292,
316,
11,
37067,
8,
198
] | 2.483333 | 300 |
"""pathfinder.py - specifies paths and common filenames"""
__author__ = 'Chris R. Coughlin'
from models import config
import os.path
import sys
def normalized(path_fn):
"""Decorator to normalize (os.path.normcase) paths"""
return normalize
@normalized
def app_path():
"""Returns the base application path."""
if hasattr(sys, 'frozen'):
# Handles PyInstaller
entry_point = sys.executable
else:
import controllers
entry_point = os.path.dirname(controllers.__file__)
return os.path.dirname(entry_point)
@normalized
def user_path():
"""Returns the path for storing user data. If not already set,
returns user's home directory/nditoolbox and sets the default in the
config file."""
_config = config.Configure(config_path())
upath_key = "User Path"
if _config.has_app_option(upath_key):
return _config.get_app_option(upath_key)
else:
default_upath = os.path.normcase(os.path.join(os.path.expanduser('~'), 'nditoolbox'))
_config.set_app_option({upath_key: default_upath})
return default_upath
@normalized
def docs_path():
"""Returns the path to the HTML documentation."""
return os.path.join(app_path(), 'docs')
@normalized
def resource_path():
"""Returns the path to resources - home folder
for icons, bitmaps, etc."""
return os.path.join(app_path(), 'resources')
@normalized
def icons_path():
"""Returns the path to application icons"""
return os.path.join(resource_path(), 'icons')
@normalized
def icon_path():
"""Returns the path to the application's default
PNG icon"""
return os.path.join(icons_path(), 'a7117_64.png')
@normalized
def winicon_path():
"""Returns the path to the application's default
.ICO icon"""
return os.path.join(icons_path(), 'a7117_64.ico')
@normalized
def bitmap_path():
"""Returns the path to application bitmaps"""
return os.path.join(resource_path(), 'bitmaps')
@normalized
def textfiles_path():
"""Returns the path to application textfiles"""
return os.path.join(resource_path(), 'textfiles')
@normalized
def data_path():
"""Returns the path to data files"""
return os.path.join(user_path(), 'data')
@normalized
def thumbnails_path():
"""Returns the path to data thumbnails"""
return os.path.join(user_path(), 'thumbnails')
@normalized
def plugins_path():
"""Returns the path to plugins"""
return os.path.join(user_path(), 'plugins')
@normalized
def config_path():
"""Returns the path to the configuration file"""
return os.path.expanduser("~/nditoolbox.cfg")
@normalized
def log_path():
"""Returns the path to the log file. If not already set,
sets to user's home directory/nditoolbox.log and sets the default in the config file."""
_config = config.Configure(config_path())
logpath_key = "Log File"
if _config.has_app_option(logpath_key):
return _config.get_app_option(logpath_key)
else:
default_logpath = os.path.normcase(os.path.join(os.path.expanduser('~'), 'nditoolbox.log'))
_config.set_app_option({logpath_key: default_logpath})
return default_logpath
@normalized
def podmodels_path():
"""Returns the path to POD Toolkit models"""
return os.path.join(user_path(), "podmodels")
@normalized
def gates_path():
"""Returns the path to ultrasonic gates"""
return os.path.join(user_path(), "gates")
@normalized
def colormaps_path():
"""Returns the path to user-defined colormaps"""
return os.path.join(user_path(), "colormaps")
@normalized
def batchoutput_path():
"""Returns the path to data files produced with batch processing mode"""
return os.path.join(data_path(), "batch_output") | [
37811,
6978,
22805,
13,
9078,
532,
26052,
13532,
290,
2219,
1226,
268,
1047,
37811,
198,
834,
9800,
834,
796,
705,
15645,
371,
13,
327,
619,
2815,
6,
198,
198,
6738,
4981,
1330,
4566,
198,
11748,
28686,
13,
6978,
198,
11748,
25064,
198,
198,
4299,
39279,
7,
6978,
62,
22184,
2599,
198,
220,
220,
220,
37227,
10707,
273,
1352,
284,
3487,
1096,
357,
418,
13,
6978,
13,
27237,
7442,
8,
13532,
37811,
628,
220,
220,
220,
1441,
3487,
1096,
628,
198,
31,
11265,
1143,
198,
4299,
598,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
2779,
3586,
3108,
526,
15931,
198,
220,
220,
220,
611,
468,
35226,
7,
17597,
11,
705,
69,
42005,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7157,
829,
9485,
15798,
263,
198,
220,
220,
220,
220,
220,
220,
220,
5726,
62,
4122,
796,
25064,
13,
18558,
18187,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1330,
20624,
628,
220,
220,
220,
220,
220,
220,
220,
5726,
62,
4122,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
3642,
36667,
13,
834,
7753,
834,
8,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
15908,
3672,
7,
13000,
62,
4122,
8,
628,
198,
31,
11265,
1143,
198,
4299,
2836,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
329,
23069,
2836,
1366,
13,
220,
1002,
407,
1541,
900,
11,
198,
220,
220,
220,
5860,
2836,
338,
1363,
8619,
14,
358,
270,
970,
3524,
290,
5621,
262,
4277,
287,
262,
198,
220,
220,
220,
4566,
2393,
526,
15931,
198,
220,
220,
220,
4808,
11250,
796,
4566,
13,
16934,
495,
7,
11250,
62,
6978,
28955,
198,
220,
220,
220,
510,
776,
62,
2539,
796,
366,
12982,
10644,
1,
198,
220,
220,
220,
611,
4808,
11250,
13,
10134,
62,
1324,
62,
18076,
7,
929,
776,
62,
2539,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4808,
11250,
13,
1136,
62,
1324,
62,
18076,
7,
929,
776,
62,
2539,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4277,
62,
929,
776,
796,
28686,
13,
6978,
13,
27237,
7442,
7,
418,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
11201,
392,
7220,
10786,
93,
33809,
705,
358,
270,
970,
3524,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
11250,
13,
2617,
62,
1324,
62,
18076,
15090,
929,
776,
62,
2539,
25,
4277,
62,
929,
776,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4277,
62,
929,
776,
628,
198,
31,
11265,
1143,
198,
4299,
34165,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
262,
11532,
10314,
526,
15931,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
1324,
62,
6978,
22784,
705,
31628,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
8271,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
4133,
532,
1363,
9483,
198,
220,
220,
220,
329,
17149,
11,
1643,
31803,
11,
3503,
526,
15931,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
1324,
62,
6978,
22784,
705,
37540,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
17149,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
3586,
17149,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
31092,
62,
6978,
22784,
705,
34280,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
7196,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
262,
3586,
338,
4277,
198,
220,
220,
220,
36182,
7196,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
34280,
62,
6978,
22784,
705,
64,
22,
17657,
62,
2414,
13,
11134,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
1592,
4749,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
262,
3586,
338,
4277,
198,
220,
220,
220,
764,
22707,
7196,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
34280,
62,
6978,
22784,
705,
64,
22,
17657,
62,
2414,
13,
3713,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
1643,
8899,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
3586,
1643,
31803,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
31092,
62,
6978,
22784,
705,
2545,
31803,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
2420,
16624,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
3586,
2420,
16624,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
31092,
62,
6978,
22784,
705,
5239,
16624,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
1366,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
1366,
3696,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
7220,
62,
6978,
22784,
705,
7890,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
294,
13668,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
1366,
294,
13668,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
7220,
62,
6978,
22784,
705,
18670,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
20652,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
20652,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
7220,
62,
6978,
22784,
705,
37390,
11537,
628,
198,
31,
11265,
1143,
198,
4299,
4566,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
262,
8398,
2393,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
11201,
392,
7220,
7203,
93,
14,
358,
270,
970,
3524,
13,
37581,
4943,
628,
198,
31,
11265,
1143,
198,
4299,
2604,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
262,
2604,
2393,
13,
220,
1002,
407,
1541,
900,
11,
198,
220,
220,
220,
5621,
284,
2836,
338,
1363,
8619,
14,
358,
270,
970,
3524,
13,
6404,
290,
5621,
262,
4277,
287,
262,
4566,
2393,
526,
15931,
198,
220,
220,
220,
4808,
11250,
796,
4566,
13,
16934,
495,
7,
11250,
62,
6978,
28955,
198,
220,
220,
220,
2604,
6978,
62,
2539,
796,
366,
11187,
9220,
1,
198,
220,
220,
220,
611,
4808,
11250,
13,
10134,
62,
1324,
62,
18076,
7,
6404,
6978,
62,
2539,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4808,
11250,
13,
1136,
62,
1324,
62,
18076,
7,
6404,
6978,
62,
2539,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4277,
62,
6404,
6978,
796,
28686,
13,
6978,
13,
27237,
7442,
7,
418,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
11201,
392,
7220,
10786,
93,
33809,
705,
358,
270,
970,
3524,
13,
6404,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
11250,
13,
2617,
62,
1324,
62,
18076,
15090,
6404,
6978,
62,
2539,
25,
4277,
62,
6404,
6978,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4277,
62,
6404,
6978,
628,
198,
31,
11265,
1143,
198,
4299,
24573,
27530,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
350,
3727,
16984,
15813,
4981,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
7220,
62,
6978,
22784,
366,
33320,
27530,
4943,
628,
198,
31,
11265,
1143,
198,
4299,
17435,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
23212,
30189,
17435,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
7220,
62,
6978,
22784,
366,
70,
689,
4943,
198,
198,
31,
11265,
1143,
198,
4299,
951,
579,
1686,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
2836,
12,
23211,
951,
579,
1686,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
7220,
62,
6978,
22784,
366,
4033,
579,
1686,
4943,
198,
198,
31,
11265,
1143,
198,
4299,
15458,
22915,
62,
6978,
33529,
198,
220,
220,
220,
37227,
35561,
262,
3108,
284,
1366,
3696,
4635,
351,
15458,
7587,
4235,
37811,
198,
220,
220,
220,
1441,
28686,
13,
6978,
13,
22179,
7,
7890,
62,
6978,
22784,
366,
43501,
62,
22915,
4943
] | 2.809274 | 1,337 |
TRANSACTION_STATUS_PENDING = 'pending'
TRANSACTION_STATUS_COMPLETE = 'complete'
TRANSACTION_STATUS_REFUNDED = 'refunded'
TRANSACTION_STATUSES = (
(TRANSACTION_STATUS_PENDING, TRANSACTION_STATUS_PENDING),
(TRANSACTION_STATUS_COMPLETE, TRANSACTION_STATUS_COMPLETE),
(TRANSACTION_STATUS_REFUNDED, TRANSACTION_STATUS_REFUNDED),
)
| [
5446,
15037,
44710,
62,
35744,
2937,
62,
47,
10619,
2751,
796,
705,
79,
1571,
6,
198,
5446,
15037,
44710,
62,
35744,
2937,
62,
41335,
9328,
796,
705,
20751,
6,
198,
5446,
15037,
44710,
62,
35744,
2937,
62,
31688,
4944,
35,
1961,
796,
705,
5420,
917,
276,
6,
198,
5446,
15037,
44710,
62,
35744,
2937,
1546,
796,
357,
198,
220,
220,
220,
357,
5446,
15037,
44710,
62,
35744,
2937,
62,
47,
10619,
2751,
11,
44069,
44710,
62,
35744,
2937,
62,
47,
10619,
2751,
828,
198,
220,
220,
220,
357,
5446,
15037,
44710,
62,
35744,
2937,
62,
41335,
9328,
11,
44069,
44710,
62,
35744,
2937,
62,
41335,
9328,
828,
198,
220,
220,
220,
357,
5446,
15037,
44710,
62,
35744,
2937,
62,
31688,
4944,
35,
1961,
11,
44069,
44710,
62,
35744,
2937,
62,
31688,
4944,
35,
1961,
828,
198,
8,
198
] | 2.449275 | 138 |
import numpy as np
import sys
import yaml
import pytest
import test_tools
import hsbalance as hs
'''This module is for testing Min_Max model solver'''
# Reading the test cases from config.yaml file, to add more tests follow the rules on the file
tests, tests_id, timeout = test_tools.get_tests_from_yaml('Min_max')
@pytest.mark.parametrize('param, expected',
tests,
ids=tests_id
)
@pytest.mark.timeout(timeout)
def test_Min_max(param, expected):
'''
Testing instantiate Min_Max model and test it against test cases
'''
my_ALPHA = hs.Alpha()
A = hs.convert_matrix_to_cart(param[0]['A'])
weight_const = param[0]['weight_const']
A0 = [0]
# It is acceptable to enter either direct_matrix or A,B,U matrices
try:
direct_matrix = hs.convert_matrix_to_cart(param[0]['ALPHA'])
my_ALPHA.add(direct_matrix=direct_matrix)
except KeyError:
B = hs.convert_matrix_to_cart(param[0]['B'])
U = hs.convert_matrix_to_cart(param[0]['U'])
my_ALPHA.add(A=A, B=B, U=U)
try:
A0 = hs.convert_matrix_to_cart(param[0]['A0'])
except KeyError:
pass
expected_W = hs.convert_matrix_to_cart(expected)
my_model = hs.Min_max(A, my_ALPHA,
weight_const=weight_const,name='Min_max') # Setting the model almost with no constraints
W = my_model.solve()
print((expected))
print('Residual Vibration rmse calculated = ', my_model.rmse())
print('Residual Vibration rmse from test_case = ',
hs.rmse(hs.residual_vibration(my_ALPHA.value, expected_W, A)))
print('expected_residual_vibration',
hs.convert_matrix_to_math(my_model.expected_residual_vibration()))
print('Correction weights', hs.convert_cart_math(W))
# Constraint Minmax algorithm was slightly inefficient in CVXPY
# The rmse was marginally more than the author solution
np.testing.assert_allclose(W, expected_W, rtol=0.09) # allowance 9% error
| [
11748,
299,
32152,
355,
45941,
198,
11748,
25064,
198,
11748,
331,
43695,
198,
11748,
12972,
9288,
198,
11748,
1332,
62,
31391,
198,
11748,
289,
82,
20427,
355,
289,
82,
198,
198,
7061,
6,
1212,
8265,
318,
329,
4856,
1855,
62,
11518,
2746,
1540,
332,
7061,
6,
198,
2,
11725,
262,
1332,
2663,
422,
4566,
13,
88,
43695,
2393,
11,
284,
751,
517,
5254,
1061,
262,
3173,
319,
262,
2393,
198,
41989,
11,
5254,
62,
312,
11,
26827,
796,
1332,
62,
31391,
13,
1136,
62,
41989,
62,
6738,
62,
88,
43695,
10786,
9452,
62,
9806,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
17143,
11,
2938,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5254,
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,
2340,
28,
41989,
62,
312,
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,
1267,
198,
31,
9078,
9288,
13,
4102,
13,
48678,
7,
48678,
8,
198,
4299,
1332,
62,
9452,
62,
9806,
7,
17143,
11,
2938,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
23983,
9113,
9386,
1855,
62,
11518,
2746,
290,
1332,
340,
1028,
1332,
2663,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
616,
62,
1847,
47,
7801,
796,
289,
82,
13,
38077,
3419,
198,
220,
220,
220,
317,
796,
289,
82,
13,
1102,
1851,
62,
6759,
8609,
62,
1462,
62,
26674,
7,
17143,
58,
15,
7131,
6,
32,
6,
12962,
198,
220,
220,
220,
3463,
62,
9979,
796,
5772,
58,
15,
7131,
6,
6551,
62,
9979,
20520,
198,
220,
220,
220,
317,
15,
796,
685,
15,
60,
198,
220,
220,
220,
1303,
632,
318,
10909,
284,
3802,
2035,
1277,
62,
6759,
8609,
393,
317,
11,
33,
11,
52,
2603,
45977,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1277,
62,
6759,
8609,
796,
289,
82,
13,
1102,
1851,
62,
6759,
8609,
62,
1462,
62,
26674,
7,
17143,
58,
15,
7131,
6,
1847,
47,
7801,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
616,
62,
1847,
47,
7801,
13,
2860,
7,
12942,
62,
6759,
8609,
28,
12942,
62,
6759,
8609,
8,
198,
220,
220,
220,
2845,
7383,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
347,
796,
289,
82,
13,
1102,
1851,
62,
6759,
8609,
62,
1462,
62,
26674,
7,
17143,
58,
15,
7131,
6,
33,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
471,
796,
289,
82,
13,
1102,
1851,
62,
6759,
8609,
62,
1462,
62,
26674,
7,
17143,
58,
15,
7131,
6,
52,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
616,
62,
1847,
47,
7801,
13,
2860,
7,
32,
28,
32,
11,
347,
28,
33,
11,
471,
28,
52,
8,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
317,
15,
796,
289,
82,
13,
1102,
1851,
62,
6759,
8609,
62,
1462,
62,
26674,
7,
17143,
58,
15,
7131,
6,
32,
15,
6,
12962,
198,
220,
220,
220,
2845,
7383,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1208,
198,
220,
220,
220,
2938,
62,
54,
796,
289,
82,
13,
1102,
1851,
62,
6759,
8609,
62,
1462,
62,
26674,
7,
40319,
8,
628,
220,
220,
220,
616,
62,
19849,
796,
289,
82,
13,
9452,
62,
9806,
7,
32,
11,
616,
62,
1847,
47,
7801,
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,
3463,
62,
9979,
28,
6551,
62,
9979,
11,
3672,
11639,
9452,
62,
9806,
11537,
220,
1303,
25700,
262,
2746,
2048,
351,
645,
17778,
198,
220,
220,
220,
370,
796,
616,
62,
19849,
13,
82,
6442,
3419,
198,
220,
220,
220,
3601,
19510,
40319,
4008,
198,
220,
220,
220,
3601,
10786,
4965,
312,
723,
569,
571,
1358,
42721,
325,
10488,
796,
46083,
616,
62,
19849,
13,
26224,
325,
28955,
198,
220,
220,
220,
3601,
10786,
4965,
312,
723,
569,
571,
1358,
42721,
325,
422,
1332,
62,
7442,
796,
46083,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
82,
13,
26224,
325,
7,
11994,
13,
411,
312,
723,
62,
85,
571,
1358,
7,
1820,
62,
1847,
47,
7801,
13,
8367,
11,
2938,
62,
54,
11,
317,
22305,
198,
220,
220,
220,
3601,
10786,
40319,
62,
411,
312,
723,
62,
85,
571,
1358,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
82,
13,
1102,
1851,
62,
6759,
8609,
62,
1462,
62,
11018,
7,
1820,
62,
19849,
13,
40319,
62,
411,
312,
723,
62,
85,
571,
1358,
3419,
4008,
198,
220,
220,
220,
3601,
10786,
43267,
19590,
3256,
289,
82,
13,
1102,
1851,
62,
26674,
62,
11018,
7,
54,
4008,
198,
220,
220,
220,
1303,
1482,
2536,
2913,
1855,
9806,
11862,
373,
4622,
30904,
287,
26196,
27481,
56,
198,
220,
220,
220,
1303,
383,
42721,
325,
373,
44108,
517,
621,
262,
1772,
4610,
198,
220,
220,
220,
45941,
13,
33407,
13,
30493,
62,
439,
19836,
7,
54,
11,
2938,
62,
54,
11,
374,
83,
349,
28,
15,
13,
2931,
8,
1303,
24930,
860,
4,
4049,
628,
198
] | 2.246696 | 908 |
from pymatex.listener import MatexASTVisitor
from pymatex.node import *
| [
6738,
279,
4948,
378,
87,
13,
4868,
877,
1330,
24787,
87,
1921,
6849,
271,
2072,
198,
6738,
279,
4948,
378,
87,
13,
17440,
1330,
1635,
628
] | 2.807692 | 26 |
from datetime import datetime, timedelta
import time
from db_apis import trim_tables, create_summaries
| [
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
11748,
640,
198,
6738,
20613,
62,
499,
271,
1330,
15797,
62,
83,
2977,
11,
2251,
62,
82,
13929,
3166,
628
] | 3.466667 | 30 |
##################### QuickSort ###################
from typing import List
def quick_sort(nums: List[int]) -> List[int]:
""" Does recursive sorting using quick sort """
if len(nums) < 2:
return nums
mid: int = (len(nums) - 1)//2
smaller_values: List[int] = [num for i, num in enumerate(nums)
if num <= nums[mid] and i != mid]
bigger_values: List[int] = [num for num in nums
if num > nums[mid]]
return quick_sort(smaller_values) + [nums[mid]] + quick_sort(bigger_values)
| [
14468,
4242,
2,
12029,
42758,
1303,
14468,
2235,
198,
6738,
19720,
1330,
7343,
628,
198,
4299,
2068,
62,
30619,
7,
77,
5700,
25,
7343,
58,
600,
12962,
4613,
7343,
58,
600,
5974,
198,
220,
220,
220,
37227,
8314,
45115,
29407,
1262,
2068,
3297,
37227,
198,
220,
220,
220,
611,
18896,
7,
77,
5700,
8,
1279,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
997,
82,
198,
220,
220,
220,
3095,
25,
493,
796,
357,
11925,
7,
77,
5700,
8,
532,
352,
8,
1003,
17,
198,
220,
220,
220,
4833,
62,
27160,
25,
7343,
58,
600,
60,
796,
685,
22510,
329,
1312,
11,
997,
287,
27056,
378,
7,
77,
5700,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
997,
19841,
997,
82,
58,
13602,
60,
290,
1312,
14512,
3095,
60,
198,
220,
220,
220,
5749,
62,
27160,
25,
7343,
58,
600,
60,
796,
685,
22510,
329,
997,
287,
997,
82,
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,
611,
997,
1875,
997,
82,
58,
13602,
11907,
198,
220,
220,
220,
1441,
2068,
62,
30619,
7,
17470,
263,
62,
27160,
8,
1343,
685,
77,
5700,
58,
13602,
11907,
1343,
2068,
62,
30619,
7,
14261,
1362,
62,
27160,
8,
628
] | 2.180812 | 271 |
import numpy as np | [
11748,
299,
32152,
355,
45941
] | 3.6 | 5 |
import pytest
from models.test import StructA
from models.simple import MILSTD_1553_Message
from models.chapter10 import MILSTD_1553_Data_Packet_Format_1
@pytest.mark.parametrize(
"struct", [StructA, MILSTD_1553_Message, MILSTD_1553_Data_Packet_Format_1]
)
| [
11748,
12972,
9288,
198,
198,
6738,
4981,
13,
9288,
1330,
32112,
32,
198,
6738,
4981,
13,
36439,
1330,
31515,
32147,
62,
1314,
4310,
62,
12837,
198,
6738,
4981,
13,
43582,
940,
1330,
31515,
32147,
62,
1314,
4310,
62,
6601,
62,
47,
8317,
62,
26227,
62,
16,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
198,
220,
220,
220,
366,
7249,
1600,
685,
44909,
32,
11,
31515,
32147,
62,
1314,
4310,
62,
12837,
11,
31515,
32147,
62,
1314,
4310,
62,
6601,
62,
47,
8317,
62,
26227,
62,
16,
60,
198,
8,
198
] | 2.75 | 96 |
from lib.base import PowerDNSClientAction
class ServerListAction(PowerDNSClientAction):
"""
List available PowerDNS servers.
"""
| [
6738,
9195,
13,
8692,
1330,
4333,
35,
8035,
11792,
12502,
628,
198,
4871,
9652,
8053,
12502,
7,
13434,
35,
8035,
11792,
12502,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7343,
1695,
4333,
35,
8035,
9597,
13,
198,
220,
220,
220,
37227,
198
] | 3.177778 | 45 |
from unittest import mock
from rattr.analyser.context import Call, Func, Import, Name
from rattr.analyser.context.symbol import Class
from rattr.analyser.results import generate_results_from_ir
| [
6738,
555,
715,
395,
1330,
15290,
198,
198,
6738,
27263,
81,
13,
272,
26266,
263,
13,
22866,
1330,
4889,
11,
11138,
66,
11,
17267,
11,
6530,
198,
6738,
27263,
81,
13,
272,
26266,
263,
13,
22866,
13,
1837,
23650,
1330,
5016,
198,
6738,
27263,
81,
13,
272,
26266,
263,
13,
43420,
1330,
7716,
62,
43420,
62,
6738,
62,
343,
628
] | 3.266667 | 60 |
# Work with Python 3.6
import discord
import numpy as np
import pandas as pd
import random
import subprocess
import weather as wt
from nlu_yahoo import nluservice
from MorseCode import morse
# from wc import noname_wc
#import softalk as sf
from calender import getCalender, getCalLink, getCommandList
from news import getNews
from matchbattle.map import getTargetMap
import noname_vocabulary as nnm
import traceback
from logger import writelog
from logger import nonamelog
from bs4 import BeautifulSoup
import requests
import configparser
config = configparser.ConfigParser()
config.read('noname.ini')
TOKEN = config['noname']['TOKEN']
client = discord.Client()
@client.event
@client.event
client.run(TOKEN) | [
2,
5521,
351,
11361,
513,
13,
21,
198,
11748,
36446,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
4738,
198,
11748,
850,
14681,
198,
11748,
6193,
355,
266,
83,
198,
6738,
299,
2290,
62,
40774,
1330,
299,
41790,
712,
501,
198,
6738,
44049,
10669,
1330,
2146,
325,
198,
2,
422,
266,
66,
1330,
1729,
480,
62,
86,
66,
198,
2,
11748,
2705,
971,
355,
264,
69,
198,
6738,
2386,
2194,
1330,
651,
9771,
2194,
11,
651,
9771,
11280,
11,
651,
21575,
8053,
198,
6738,
1705,
1330,
651,
9980,
198,
6738,
2872,
38471,
13,
8899,
1330,
651,
21745,
13912,
198,
11748,
1729,
480,
62,
18893,
22528,
355,
299,
21533,
198,
11748,
12854,
1891,
198,
6738,
49706,
1330,
1991,
417,
519,
198,
6738,
49706,
1330,
1729,
17983,
519,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
11748,
7007,
198,
198,
11748,
4566,
48610,
198,
11250,
796,
4566,
48610,
13,
16934,
46677,
3419,
198,
11250,
13,
961,
10786,
13159,
480,
13,
5362,
11537,
198,
10468,
43959,
796,
4566,
17816,
13159,
480,
6,
7131,
6,
10468,
43959,
20520,
198,
198,
16366,
796,
36446,
13,
11792,
3419,
198,
198,
31,
16366,
13,
15596,
198,
198,
31,
16366,
13,
15596,
198,
198,
16366,
13,
5143,
7,
10468,
43959,
8
] | 3.358491 | 212 |
# Copyright 2020, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# pytype: skip-file
# This modules disables the Pytype analyzer, see
# https://github.com/tensorflow/federated/blob/main/docs/pytype.md for more
# information.
"""A collection of utilities for compiling TFF code for execution on IREE."""
import tempfile
import iree.compiler.tf
import tensorflow as tf
from tensorflow_federated.proto.v0 import computation_pb2 as pb
from tensorflow_federated.python.common_libs import py_typecheck
from tensorflow_federated.python.common_libs import serialization_utils
from tensorflow_federated.python.core.backends.iree import computation_module
from tensorflow_federated.python.core.impl.types import computation_types
from tensorflow_federated.python.core.impl.types import type_serialization
from tensorflow_federated.python.core.impl.utils import tensorflow_utils
def import_tensorflow_computation(comp, name='fn'):
"""Creates a `computation_module.ComputationModule` from a TF computation.
WARNING: This helper function is under construction, and most capabilities are
not implemented at this stage:
* The parameter and result of `comp` can only be a single tensor. Named
tuples, sequences, or functional types are not currently supported.
* Only tensorflow code can be imported.
TODO(b/153499219): Add support for named tuples, sequences, and functions.
Args:
comp: An instance of a `pb.Computation` with TensorFlow code to import.
name: An optional `str` name of the (single) function in the IREE module.
Returns:
An instance of `Module` with the imported function present.
Raises:
TypeError: If arguments are of the wrong types, e.g., in `comp` is not a
TensorFlow computation.
"""
py_typecheck.check_type(comp, pb.Computation)
type_spec = type_serialization.deserialize_type(comp.type)
if not type_spec.is_function():
type_spec = computation_types.FunctionType(None, type_spec)
# TODO(b/153499219): Replace this with a recursive check of the signature
# after relaxing the type restrictions and introducing nested structures.
py_typecheck.check_type(type_spec.result, computation_types.TensorType)
if type_spec.parameter is not None:
py_typecheck.check_type(type_spec.parameter, computation_types.TensorType)
which_computation = comp.WhichOneof('computation')
if which_computation != 'tensorflow':
raise TypeError('Expected a TensorFlow computation, found {}.'.format(
which_computation))
output_tensor_names = tensorflow_utils.extract_tensor_names_from_binding(
comp.tensorflow.result)
if type_spec.parameter is not None:
input_tensor_names = tensorflow_utils.extract_tensor_names_from_binding(
comp.tensorflow.parameter)
else:
input_tensor_names = []
graph_def = serialization_utils.unpack_graph_def(comp.tensorflow.graph_def)
init_op = comp.tensorflow.initialize_op
return_elements = input_tensor_names + output_tensor_names
if init_op:
graph_def = tensorflow_utils.add_control_deps_for_init_op(
graph_def, init_op)
return_elements.append(init_op)
with tf.Graph().as_default() as graph:
# TODO(b/153499219): See if we can reintroduce uniquify_shared_names().
# Right now, it causes loader breakage, and unclear if still necessary.
import_results = tf.graph_util.import_graph_def(
graph_def, input_map={}, return_elements=return_elements, name='')
if init_op:
initializer = import_results[-1]
import_results.pop()
else:
initializer = None
inputs = import_results[0:len(input_tensor_names)]
outputs = import_results[len(input_tensor_names):]
with graph.as_default():
# TODO(b/153499219): Find a way to reflect the nested parameter and result
# structure here after relaxing the restrictions.
if inputs:
assert len(inputs) < 2
input_dict = {
'parameter':
tf.compat.v1.saved_model.utils.build_tensor_info(inputs[0])
}
else:
input_dict = {}
assert len(outputs) == 1
output_dict = {
'result': tf.compat.v1.saved_model.utils.build_tensor_info(outputs[0])
}
sig_def = tf.compat.v1.saved_model.signature_def_utils.build_signature_def(
inputs=input_dict, outputs=output_dict, method_name=name)
with tempfile.TemporaryDirectory() as model_dir:
builder = tf.compat.v1.saved_model.Builder(model_dir)
with tf.compat.v1.Session(graph=graph) as sess:
builder.add_meta_graph_and_variables(
sess, ['unused'],
signature_def_map={name: sig_def},
legacy_init_op=initializer,
strip_default_attrs=True)
builder.save()
iree_module = iree.compiler.tf.compile_saved_model(
model_dir,
import_type='SIGNATURE_DEF',
import_only=True,
saved_model_tags=set(['unused']),
exported_names=[name])
return computation_module.ComputationModule(iree_module, name, type_spec)
| [
2,
15069,
12131,
11,
383,
309,
22854,
37535,
35089,
515,
46665,
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,
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,
198,
2,
12972,
4906,
25,
14267,
12,
7753,
198,
2,
770,
13103,
595,
2977,
262,
9485,
4906,
4284,
9107,
11,
766,
198,
2,
3740,
1378,
12567,
13,
785,
14,
83,
22854,
11125,
14,
69,
5702,
515,
14,
2436,
672,
14,
12417,
14,
31628,
14,
9078,
4906,
13,
9132,
329,
517,
198,
2,
1321,
13,
198,
37811,
32,
4947,
286,
20081,
329,
33393,
309,
5777,
2438,
329,
9706,
319,
314,
11587,
526,
15931,
198,
198,
11748,
20218,
7753,
198,
198,
11748,
35918,
68,
13,
5589,
5329,
13,
27110,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
198,
6738,
11192,
273,
11125,
62,
69,
5702,
515,
13,
1676,
1462,
13,
85,
15,
1330,
29964,
62,
40842,
17,
355,
279,
65,
198,
6738,
11192,
273,
11125,
62,
69,
5702,
515,
13,
29412,
13,
11321,
62,
8019,
82,
1330,
12972,
62,
4906,
9122,
198,
6738,
11192,
273,
11125,
62,
69,
5702,
515,
13,
29412,
13,
11321,
62,
8019,
82,
1330,
11389,
1634,
62,
26791,
198,
6738,
11192,
273,
11125,
62,
69,
5702,
515,
13,
29412,
13,
7295,
13,
1891,
2412,
13,
557,
68,
1330,
29964,
62,
21412,
198,
6738,
11192,
273,
11125,
62,
69,
5702,
515,
13,
29412,
13,
7295,
13,
23928,
13,
19199,
1330,
29964,
62,
19199,
198,
6738,
11192,
273,
11125,
62,
69,
5702,
515,
13,
29412,
13,
7295,
13,
23928,
13,
19199,
1330,
2099,
62,
46911,
1634,
198,
6738,
11192,
273,
11125,
62,
69,
5702,
515,
13,
29412,
13,
7295,
13,
23928,
13,
26791,
1330,
11192,
273,
11125,
62,
26791,
628,
198,
4299,
1330,
62,
83,
22854,
11125,
62,
785,
1996,
341,
7,
5589,
11,
1438,
11639,
22184,
6,
2599,
198,
220,
37227,
16719,
274,
257,
4600,
785,
1996,
341,
62,
21412,
13,
5377,
1996,
341,
26796,
63,
422,
257,
24958,
29964,
13,
628,
220,
39410,
25,
770,
31904,
2163,
318,
739,
5103,
11,
290,
749,
9889,
389,
198,
220,
407,
9177,
379,
428,
3800,
25,
628,
220,
1635,
383,
11507,
290,
1255,
286,
4600,
5589,
63,
460,
691,
307,
257,
2060,
11192,
273,
13,
34441,
198,
220,
220,
220,
12777,
2374,
11,
16311,
11,
393,
10345,
3858,
389,
407,
3058,
4855,
13,
628,
220,
1635,
5514,
11192,
273,
11125,
2438,
460,
307,
17392,
13,
628,
220,
16926,
46,
7,
65,
14,
1314,
2682,
2079,
28896,
2599,
3060,
1104,
329,
3706,
12777,
2374,
11,
16311,
11,
290,
5499,
13,
628,
220,
943,
14542,
25,
198,
220,
220,
220,
552,
25,
1052,
4554,
286,
257,
4600,
40842,
13,
5377,
1996,
341,
63,
351,
309,
22854,
37535,
2438,
284,
1330,
13,
198,
220,
220,
220,
1438,
25,
1052,
11902,
4600,
2536,
63,
1438,
286,
262,
357,
29762,
8,
2163,
287,
262,
314,
11587,
8265,
13,
628,
220,
16409,
25,
198,
220,
220,
220,
1052,
4554,
286,
4600,
26796,
63,
351,
262,
17392,
2163,
1944,
13,
628,
220,
7567,
2696,
25,
198,
220,
220,
220,
5994,
12331,
25,
1002,
7159,
389,
286,
262,
2642,
3858,
11,
304,
13,
70,
1539,
287,
4600,
5589,
63,
318,
407,
257,
198,
220,
220,
220,
220,
220,
309,
22854,
37535,
29964,
13,
198,
220,
37227,
198,
220,
12972,
62,
4906,
9122,
13,
9122,
62,
4906,
7,
5589,
11,
279,
65,
13,
5377,
1996,
341,
8,
198,
220,
2099,
62,
16684,
796,
2099,
62,
46911,
1634,
13,
8906,
48499,
1096,
62,
4906,
7,
5589,
13,
4906,
8,
198,
220,
611,
407,
2099,
62,
16684,
13,
271,
62,
8818,
33529,
198,
220,
220,
220,
2099,
62,
16684,
796,
29964,
62,
19199,
13,
22203,
6030,
7,
14202,
11,
2099,
62,
16684,
8,
628,
220,
1303,
16926,
46,
7,
65,
14,
1314,
2682,
2079,
28896,
2599,
40177,
428,
351,
257,
45115,
2198,
286,
262,
9877,
198,
220,
1303,
706,
28175,
262,
2099,
8733,
290,
16118,
28376,
8573,
13,
198,
220,
12972,
62,
4906,
9122,
13,
9122,
62,
4906,
7,
4906,
62,
16684,
13,
20274,
11,
29964,
62,
19199,
13,
51,
22854,
6030,
8,
198,
220,
611,
2099,
62,
16684,
13,
17143,
2357,
318,
407,
6045,
25,
198,
220,
220,
220,
12972,
62,
4906,
9122,
13,
9122,
62,
4906,
7,
4906,
62,
16684,
13,
17143,
2357,
11,
29964,
62,
19199,
13,
51,
22854,
6030,
8,
628,
220,
543,
62,
785,
1996,
341,
796,
552,
13,
13828,
3198,
1659,
10786,
785,
1996,
341,
11537,
198,
220,
611,
543,
62,
785,
1996,
341,
14512,
705,
83,
22854,
11125,
10354,
198,
220,
220,
220,
5298,
5994,
12331,
10786,
3109,
7254,
257,
309,
22854,
37535,
29964,
11,
1043,
23884,
2637,
13,
18982,
7,
198,
220,
220,
220,
220,
220,
220,
220,
543,
62,
785,
1996,
341,
4008,
628,
220,
5072,
62,
83,
22854,
62,
14933,
796,
11192,
273,
11125,
62,
26791,
13,
2302,
974,
62,
83,
22854,
62,
14933,
62,
6738,
62,
30786,
7,
198,
220,
220,
220,
220,
220,
552,
13,
83,
22854,
11125,
13,
20274,
8,
198,
220,
611,
2099,
62,
16684,
13,
17143,
2357,
318,
407,
6045,
25,
198,
220,
220,
220,
5128,
62,
83,
22854,
62,
14933,
796,
11192,
273,
11125,
62,
26791,
13,
2302,
974,
62,
83,
22854,
62,
14933,
62,
6738,
62,
30786,
7,
198,
220,
220,
220,
220,
220,
220,
220,
552,
13,
83,
22854,
11125,
13,
17143,
2357,
8,
198,
220,
2073,
25,
198,
220,
220,
220,
5128,
62,
83,
22854,
62,
14933,
796,
17635,
628,
220,
4823,
62,
4299,
796,
11389,
1634,
62,
26791,
13,
403,
8002,
62,
34960,
62,
4299,
7,
5589,
13,
83,
22854,
11125,
13,
34960,
62,
4299,
8,
198,
220,
2315,
62,
404,
796,
552,
13,
83,
22854,
11125,
13,
36733,
1096,
62,
404,
198,
220,
1441,
62,
68,
3639,
796,
5128,
62,
83,
22854,
62,
14933,
1343,
5072,
62,
83,
22854,
62,
14933,
198,
220,
611,
2315,
62,
404,
25,
198,
220,
220,
220,
4823,
62,
4299,
796,
11192,
273,
11125,
62,
26791,
13,
2860,
62,
13716,
62,
10378,
82,
62,
1640,
62,
15003,
62,
404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
4823,
62,
4299,
11,
2315,
62,
404,
8,
198,
220,
220,
220,
1441,
62,
68,
3639,
13,
33295,
7,
15003,
62,
404,
8,
628,
220,
351,
48700,
13,
37065,
22446,
292,
62,
12286,
3419,
355,
4823,
25,
198,
220,
220,
220,
1303,
16926,
46,
7,
65,
14,
1314,
2682,
2079,
28896,
2599,
4091,
611,
356,
460,
38368,
344,
555,
1557,
1958,
62,
28710,
62,
14933,
22446,
198,
220,
220,
220,
1303,
6498,
783,
11,
340,
5640,
40213,
2270,
496,
11,
290,
10061,
611,
991,
3306,
13,
198,
220,
220,
220,
1330,
62,
43420,
796,
48700,
13,
34960,
62,
22602,
13,
11748,
62,
34960,
62,
4299,
7,
198,
220,
220,
220,
220,
220,
220,
220,
4823,
62,
4299,
11,
5128,
62,
8899,
34758,
5512,
1441,
62,
68,
3639,
28,
7783,
62,
68,
3639,
11,
1438,
28,
7061,
8,
628,
220,
611,
2315,
62,
404,
25,
198,
220,
220,
220,
4238,
7509,
796,
1330,
62,
43420,
58,
12,
16,
60,
198,
220,
220,
220,
1330,
62,
43420,
13,
12924,
3419,
198,
220,
2073,
25,
198,
220,
220,
220,
4238,
7509,
796,
6045,
628,
220,
17311,
796,
1330,
62,
43420,
58,
15,
25,
11925,
7,
15414,
62,
83,
22854,
62,
14933,
15437,
198,
220,
23862,
796,
1330,
62,
43420,
58,
11925,
7,
15414,
62,
83,
22854,
62,
14933,
2599,
60,
628,
220,
351,
4823,
13,
292,
62,
12286,
33529,
198,
220,
220,
220,
1303,
16926,
46,
7,
65,
14,
1314,
2682,
2079,
28896,
2599,
9938,
257,
835,
284,
4079,
262,
28376,
11507,
290,
1255,
198,
220,
220,
220,
1303,
4645,
994,
706,
28175,
262,
8733,
13,
198,
220,
220,
220,
611,
17311,
25,
198,
220,
220,
220,
220,
220,
6818,
18896,
7,
15414,
82,
8,
1279,
362,
198,
220,
220,
220,
220,
220,
5128,
62,
11600,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
17143,
2357,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
48700,
13,
5589,
265,
13,
85,
16,
13,
82,
9586,
62,
19849,
13,
26791,
13,
11249,
62,
83,
22854,
62,
10951,
7,
15414,
82,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
5128,
62,
11600,
796,
23884,
198,
220,
220,
220,
6818,
18896,
7,
22915,
82,
8,
6624,
352,
198,
220,
220,
220,
5072,
62,
11600,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
20274,
10354,
48700,
13,
5589,
265,
13,
85,
16,
13,
82,
9586,
62,
19849,
13,
26791,
13,
11249,
62,
83,
22854,
62,
10951,
7,
22915,
82,
58,
15,
12962,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
43237,
62,
4299,
796,
48700,
13,
5589,
265,
13,
85,
16,
13,
82,
9586,
62,
19849,
13,
12683,
1300,
62,
4299,
62,
26791,
13,
11249,
62,
12683,
1300,
62,
4299,
7,
198,
220,
220,
220,
220,
220,
220,
220,
17311,
28,
15414,
62,
11600,
11,
23862,
28,
22915,
62,
11600,
11,
2446,
62,
3672,
28,
3672,
8,
198,
220,
220,
220,
351,
20218,
7753,
13,
12966,
5551,
43055,
3419,
355,
2746,
62,
15908,
25,
198,
220,
220,
220,
220,
220,
27098,
796,
48700,
13,
5589,
265,
13,
85,
16,
13,
82,
9586,
62,
19849,
13,
32875,
7,
19849,
62,
15908,
8,
198,
220,
220,
220,
220,
220,
351,
48700,
13,
5589,
265,
13,
85,
16,
13,
36044,
7,
34960,
28,
34960,
8,
355,
264,
408,
25,
198,
220,
220,
220,
220,
220,
220,
220,
27098,
13,
2860,
62,
28961,
62,
34960,
62,
392,
62,
25641,
2977,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
408,
11,
37250,
403,
1484,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9877,
62,
4299,
62,
8899,
34758,
3672,
25,
43237,
62,
4299,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10655,
62,
15003,
62,
404,
28,
36733,
7509,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10283,
62,
12286,
62,
1078,
3808,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
27098,
13,
21928,
3419,
198,
220,
220,
220,
220,
220,
35918,
68,
62,
21412,
796,
35918,
68,
13,
5589,
5329,
13,
27110,
13,
5589,
576,
62,
82,
9586,
62,
19849,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
62,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1330,
62,
4906,
11639,
46224,
40086,
62,
32988,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1330,
62,
8807,
28,
17821,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7448,
62,
19849,
62,
31499,
28,
2617,
7,
17816,
403,
1484,
20520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29050,
62,
14933,
41888,
3672,
12962,
198,
220,
220,
220,
220,
220,
1441,
29964,
62,
21412,
13,
5377,
1996,
341,
26796,
7,
557,
68,
62,
21412,
11,
1438,
11,
2099,
62,
16684,
8,
198
] | 2.818785 | 1,959 |
from phi.fluidformat import *
# for scene in scenes("~/data/control/squares"):
# scene.remove()
scenecount = 1000
for scene_index in range(scenecount):
scene = new_scene("~/data/control/squares")
start_x, start_y, end_x, end_y = np.random.randint(10, 110, 4)
print(scene)
scenelength = 32
vx = (end_x-start_x) / float(scenelength)
vy = (end_y-start_y) / float(scenelength)
for frame in range(scenelength+1):
time = frame / float(scenelength)
array = np.zeros([128, 128, 1], np.float32)
x = int(round(start_x * (1-time) + end_x * time))
y = int(round(start_y * (1-time) + end_y * time))
array[y:y+8, x:x+8, :] = 1
velocity_array = np.empty([129, 129, 2], np.float32)
velocity_array[...,0] = vx
velocity_array[...,1] = vy
write_sim_frame(scene.path, [array, velocity_array], ["Density", "Velocity"], frame) | [
6738,
872,
72,
13,
35522,
312,
18982,
1330,
1635,
198,
198,
2,
329,
3715,
287,
8188,
7203,
93,
14,
7890,
14,
13716,
14,
16485,
3565,
1,
2599,
198,
2,
220,
220,
220,
220,
3715,
13,
28956,
3419,
198,
198,
1416,
268,
721,
608,
796,
8576,
198,
198,
1640,
3715,
62,
9630,
287,
2837,
7,
1416,
268,
721,
608,
2599,
198,
220,
220,
220,
3715,
796,
649,
62,
29734,
7203,
93,
14,
7890,
14,
13716,
14,
16485,
3565,
4943,
198,
220,
220,
220,
923,
62,
87,
11,
923,
62,
88,
11,
886,
62,
87,
11,
886,
62,
88,
796,
45941,
13,
25120,
13,
25192,
600,
7,
940,
11,
9796,
11,
604,
8,
198,
220,
220,
220,
3601,
7,
29734,
8,
198,
220,
220,
220,
4408,
417,
3286,
796,
3933,
198,
220,
220,
220,
410,
87,
796,
357,
437,
62,
87,
12,
9688,
62,
87,
8,
1220,
12178,
7,
1416,
268,
417,
3286,
8,
198,
220,
220,
220,
410,
88,
796,
357,
437,
62,
88,
12,
9688,
62,
88,
8,
1220,
12178,
7,
1416,
268,
417,
3286,
8,
198,
220,
220,
220,
329,
5739,
287,
2837,
7,
1416,
268,
417,
3286,
10,
16,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
640,
796,
5739,
1220,
12178,
7,
1416,
268,
417,
3286,
8,
198,
220,
220,
220,
220,
220,
220,
220,
7177,
796,
45941,
13,
9107,
418,
26933,
12762,
11,
13108,
11,
352,
4357,
45941,
13,
22468,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
493,
7,
744,
7,
9688,
62,
87,
1635,
357,
16,
12,
2435,
8,
1343,
886,
62,
87,
1635,
640,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
331,
796,
493,
7,
744,
7,
9688,
62,
88,
1635,
357,
16,
12,
2435,
8,
1343,
886,
62,
88,
1635,
640,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
7177,
58,
88,
25,
88,
10,
23,
11,
2124,
25,
87,
10,
23,
11,
1058,
60,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
15432,
62,
18747,
796,
45941,
13,
28920,
26933,
18741,
11,
20248,
11,
362,
4357,
45941,
13,
22468,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
15432,
62,
18747,
58,
986,
11,
15,
60,
796,
410,
87,
198,
220,
220,
220,
220,
220,
220,
220,
15432,
62,
18747,
58,
986,
11,
16,
60,
796,
410,
88,
198,
220,
220,
220,
220,
220,
220,
220,
3551,
62,
14323,
62,
14535,
7,
29734,
13,
6978,
11,
685,
18747,
11,
15432,
62,
18747,
4357,
14631,
35,
6377,
1600,
366,
46261,
11683,
33116,
5739,
8
] | 2.153664 | 423 |
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# [🥭 Mango Markets](https://mango.markets/) support is available at:
# [Docs](https://docs.mango.markets/)
# [Discord](https://discord.gg/67jySBhxrg)
# [Twitter](https://twitter.com/mangomarkets)
# [Github](https://github.com/blockworks-foundation)
# [Email](mailto:[email protected])
import enum
import mango
import typing
from solana.publickey import PublicKey
from ..constants import SYSTEM_PROGRAM_ADDRESS
from ..modelstate import ModelState
from .modelstatebuilder import (
ModelStateBuilder,
WebsocketModelStateBuilder,
SerumPollingModelStateBuilder,
SpotPollingModelStateBuilder,
PerpPollingModelStateBuilder,
)
# # 🥭 ModelStateBuilder class
#
# Base class for building a `ModelState` through polling or websockets.
#
| [
2,
1303,
2343,
248,
254,
15932,
198,
2,
198,
2,
3336,
47466,
3180,
36592,
2389,
1961,
366,
1921,
3180,
1600,
42881,
34764,
56,
3963,
15529,
509,
12115,
11,
7788,
32761,
6375,
8959,
49094,
11,
47783,
2751,
21728,
5626,
198,
2,
40880,
5390,
3336,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
11,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
44521,
1268,
10913,
2751,
12529,
13,
3268,
198,
2,
8005,
49261,
50163,
3336,
37195,
20673,
6375,
27975,
38162,
9947,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
43031,
25382,
11,
198,
2,
7655,
2767,
16879,
3268,
3537,
40282,
3963,
27342,
10659,
11,
309,
9863,
6375,
25401,
54,
24352,
11,
5923,
1797,
2751,
16034,
11,
16289,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
198,
2,
47466,
6375,
3336,
23210,
6375,
25401,
5550,
1847,
20754,
3268,
3336,
47466,
13,
198,
2,
198,
2,
685,
8582,
98,
255,
337,
14208,
30251,
16151,
5450,
1378,
76,
14208,
13,
34162,
34729,
1104,
318,
1695,
379,
25,
198,
2,
220,
220,
685,
23579,
82,
16151,
5450,
1378,
31628,
13,
76,
14208,
13,
34162,
34729,
198,
2,
220,
220,
685,
15642,
585,
16151,
5450,
1378,
15410,
585,
13,
1130,
14,
3134,
73,
88,
16811,
71,
87,
41345,
8,
198,
2,
220,
220,
685,
14254,
16151,
5450,
1378,
6956,
13,
785,
14,
76,
648,
296,
668,
1039,
8,
198,
2,
220,
220,
685,
38,
10060,
16151,
5450,
1378,
12567,
13,
785,
14,
9967,
5225,
12,
42526,
8,
198,
2,
220,
220,
685,
15333,
16151,
4529,
1462,
25,
31373,
31,
9967,
5225,
13,
42526,
8,
198,
198,
11748,
33829,
198,
11748,
49364,
198,
11748,
19720,
198,
198,
6738,
1540,
2271,
13,
11377,
2539,
1330,
5094,
9218,
198,
198,
6738,
11485,
9979,
1187,
1330,
36230,
62,
4805,
7730,
24115,
62,
2885,
7707,
7597,
198,
6738,
11485,
19849,
5219,
1330,
9104,
9012,
198,
6738,
764,
19849,
5219,
38272,
1330,
357,
198,
220,
220,
220,
9104,
9012,
32875,
11,
198,
220,
220,
220,
47736,
5459,
17633,
9012,
32875,
11,
198,
220,
220,
220,
2930,
388,
39176,
278,
17633,
9012,
32875,
11,
198,
220,
220,
220,
15899,
39176,
278,
17633,
9012,
32875,
11,
198,
220,
220,
220,
2448,
79,
39176,
278,
17633,
9012,
32875,
11,
198,
8,
628,
198,
198,
2,
1303,
12520,
98,
255,
9104,
9012,
32875,
1398,
198,
2,
198,
2,
7308,
1398,
329,
2615,
257,
4600,
17633,
9012,
63,
832,
13985,
393,
2639,
11603,
13,
198,
2,
628,
628,
628,
198
] | 3.080292 | 411 |
# -*- coding: utf-8 -*-
# ToMaTo (Topology management software)
# Copyright (C) 2010 Dennis Schwerdel, University of Kaiserslautern
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from . import run, spawn, CommandError, process
from .. import util
from ... import config
import os
_clientPid = None
_clientConfig = {}
_trackerPid = None
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
1675,
21467,
2514,
357,
9126,
1435,
4542,
3788,
8,
220,
198,
2,
15069,
357,
34,
8,
3050,
16902,
3059,
15448,
12381,
11,
2059,
286,
11611,
21572,
75,
2306,
1142,
198,
2,
198,
2,
770,
1430,
318,
1479,
3788,
25,
345,
460,
17678,
4163,
340,
290,
14,
273,
13096,
198,
2,
340,
739,
262,
2846,
286,
262,
22961,
3611,
5094,
13789,
355,
3199,
416,
198,
2,
262,
3232,
10442,
5693,
11,
2035,
2196,
513,
286,
262,
13789,
11,
393,
198,
2,
357,
265,
534,
3038,
8,
597,
1568,
2196,
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,
1863,
351,
428,
1430,
13,
220,
1002,
407,
11,
766,
1279,
4023,
1378,
2503,
13,
41791,
13,
2398,
14,
677,
4541,
15913,
198,
198,
6738,
764,
1330,
1057,
11,
10922,
11,
9455,
12331,
11,
1429,
198,
6738,
11485,
1330,
7736,
198,
6738,
2644,
1330,
4566,
198,
11748,
28686,
198,
198,
62,
16366,
47,
312,
796,
6045,
198,
62,
16366,
16934,
796,
23884,
198,
62,
2213,
10735,
47,
312,
796,
6045,
198
] | 3.635294 | 255 |
# Generated by Django 2.1.9 on 2019-07-03 04:53
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
16,
13,
24,
319,
13130,
12,
2998,
12,
3070,
8702,
25,
4310,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Массовая загрузка набора данных Open Images Dataset V6
python oidv6/samples/run.py <command> --classes названия_классов_или_текстовый_файл
[--dataset Dataset --type_data train --limit 0 --multi_classes --yes --no_labels --hide_metadata --no_clear_shell]
"""
# ######################################################################################################################
# Импорт необходимых инструментов
# ######################################################################################################################
from datetime import datetime # Работа со временем
from types import ModuleType # Проверка объектов на модуль
# Персональные
import oidv6 # Массовая загрузка набора данных Open Images Dataset V6
from oidv6.OIDv6 import OIDv6 # Массовая загрузка набора данных Open Images Dataset V6
from oidv6.modules.trml.shell import Shell # Работа с Shell
# ######################################################################################################################
# Сообщения
# ######################################################################################################################
class Messages(OIDv6):
"""Класс для сообщений"""
# ------------------------------------------------------------------------------------------------------------------
# Конструктор
# ------------------------------------------------------------------------------------------------------------------
# ######################################################################################################################
# Выполняем только в том случае, если файл запущен сам по себе
# ######################################################################################################################
class Run(Messages):
"""Класс для массовой загрузки набора данных Open Images Dataset V6"""
# ------------------------------------------------------------------------------------------------------------------
# Конструктор
# ------------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------------
# Внутренние методы
# ------------------------------------------------------------------------------------------------------------------
# Построение аргументов командной строки
def _build_args(self, conv_to_dict = True):
"""
Построение аргументов командной строки
([bool]) -> None or dict
Аргументы:
conv_to_dict - Преобразование списка аргументов командной строки в словарь
Возвращает: dict если парсер командной строки окончательный, в обратном случае None
"""
super().build_args(False) # Выполнение функции из суперкласса
# Добавление аргументов в парсер командной строки
self._ap.add_argument('command', metavar = '<command> downloader',
choices = self.commands, help = self._('Команда загрузки'))
self._ap.add_argument('--dataset', required = False, metavar = self._('путь_к_директории'),
default = self.dir,
help = self._('Корневая директория для сохранения OIDv6, значение по умолчанию:') +
' %(default)s')
self._ap.add_argument('--type_data', required = False, choices = list(self.type_data.keys()) + ['all'],
default = 'train', metavar = 'train, validation, test ' + self._('или') + ' all',
help = self._('Набор данных, значение по умолчанию:') + ' %(default)s')
self._ap.add_argument('--classes', required = False, nargs = '+', metavar = self._('название_класса'),
help = self._('Последовательность названий классов или текстовый файл'))
self._ap.add_argument('--limit', required = False, default = 0, type = int, metavar = self._('целое_число'),
help = self._('Лимит загрузки изображений, значение по умолчанию:') +
' %(default)s (' + self._('нет лимита') + ')')
self._ap.add_argument('--multi_classes', required = False, action = 'store_true',
help = self._('Загрузка классов в одну директорию'))
self._ap.add_argument('--yes', required = False, action = 'store_true',
help = self._('Автоматическая загрузка служебных файлов'))
self._ap.add_argument('--no_labels', required = False, action = 'store_true',
help = self._('Не формировать метки'))
self._ap.add_argument('--hide_metadata', required = False, action = 'store_true',
help = self._('Вывод метаданных'))
self._ap.add_argument('--no_clear_shell', required = False, action = 'store_false',
help = self._('Не очищать консоль перед выполнением'))
# Преобразование списка аргументов командной строки в словарь
if conv_to_dict is True:
args, _ = self._ap.parse_known_args()
return vars(args) # Преобразование списка аргументов командной строки в словарь
# ------------------------------------------------------------------------------------------------------------------
# Внешние методы
# ------------------------------------------------------------------------------------------------------------------
# Запуск
def run(self, metadata = oidv6, out = True):
"""
Запуск
([module, module, bool, bool]) -> None
Аргументы:
out - Печатать процесс выполнения
"""
# Проверка аргументов
if type(out) is not bool or not isinstance(metadata, ModuleType):
# Вывод сообщения
if out is True:
print(self._invalid_arguments.format(
self.red, datetime.now().strftime(self._format_time),
self.end, __class__.__name__ + '.' + self.run.__name__
))
return False
self._args = self._build_args() # Построение аргументов командной строки
self.clear_shell(self._args['no_clear_shell']) # Очистка консоли перед выполнением
# Приветствие
Shell.add_line() # Добавление линии во весь экран
print(self._oidv6.format(self.bold, self.blue, self.end))
Shell.add_line() # Добавление линии во весь экран
# Запуск
if self._args['hide_metadata'] is False:
print(self._metadata.format(
datetime.now().strftime(self._format_time),
metadata.__author__,
metadata.__email__,
metadata.__maintainer__,
metadata.__version__
))
Shell.add_line() # Добавление линии во весь экран
self.download(self._args, out)
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
198,
140,
250,
16142,
21727,
21727,
25443,
110,
16142,
40623,
12466,
115,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
16142,
12466,
121,
16142,
140,
109,
15166,
21169,
16142,
12466,
112,
16142,
22177,
22177,
45035,
141,
227,
4946,
5382,
16092,
292,
316,
569,
21,
198,
198,
29412,
267,
312,
85,
21,
14,
82,
12629,
14,
5143,
13,
9078,
1279,
21812,
29,
1377,
37724,
12466,
121,
16142,
140,
115,
38857,
16142,
22177,
18849,
40623,
62,
31583,
30143,
16142,
21727,
21727,
25443,
110,
62,
18849,
30143,
18849,
62,
20375,
16843,
31583,
21727,
20375,
25443,
110,
45035,
140,
117,
62,
141,
226,
16142,
140,
117,
30143,
198,
220,
220,
220,
685,
438,
19608,
292,
316,
16092,
292,
316,
1377,
4906,
62,
7890,
4512,
1377,
32374,
657,
1377,
41684,
62,
37724,
1377,
8505,
1377,
3919,
62,
23912,
1424,
1377,
24717,
62,
38993,
1377,
3919,
62,
20063,
62,
29149,
60,
198,
37811,
628,
198,
2,
1303,
29113,
29113,
29113,
14468,
4242,
2,
198,
2,
12466,
246,
43108,
140,
123,
15166,
21169,
20375,
12466,
121,
16843,
25443,
109,
141,
227,
25443,
112,
18849,
43108,
45035,
141,
227,
12466,
116,
22177,
21727,
20375,
21169,
35072,
43108,
16843,
22177,
20375,
25443,
110,
198,
2,
1303,
29113,
29113,
29113,
14468,
4242,
2,
198,
6738,
4818,
8079,
1330,
4818,
8079,
220,
1303,
12466,
254,
16142,
140,
109,
15166,
20375,
16142,
220,
21727,
15166,
12466,
110,
21169,
16843,
43108,
16843,
22177,
16843,
43108,
198,
6738,
3858,
1330,
19937,
6030,
220,
1303,
12466,
253,
21169,
25443,
110,
16843,
21169,
31583,
16142,
12466,
122,
140,
109,
141,
232,
16843,
31583,
20375,
25443,
110,
12466,
121,
16142,
12466,
120,
25443,
112,
35072,
30143,
45367,
198,
198,
2,
12466,
253,
16843,
21169,
21727,
15166,
22177,
16142,
30143,
45367,
22177,
45035,
16843,
198,
11748,
267,
312,
85,
21,
220,
1303,
12466,
250,
16142,
21727,
21727,
25443,
110,
16142,
40623,
12466,
115,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
16142,
12466,
121,
16142,
140,
109,
15166,
21169,
16142,
12466,
112,
16142,
22177,
22177,
45035,
141,
227,
4946,
5382,
16092,
292,
316,
569,
21,
198,
198,
6738,
267,
312,
85,
21,
13,
46,
2389,
85,
21,
1330,
440,
2389,
85,
21,
220,
1303,
12466,
250,
16142,
21727,
21727,
25443,
110,
16142,
40623,
12466,
115,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
16142,
12466,
121,
16142,
140,
109,
15166,
21169,
16142,
12466,
112,
16142,
22177,
22177,
45035,
141,
227,
4946,
5382,
16092,
292,
316,
569,
21,
198,
6738,
267,
312,
85,
21,
13,
18170,
13,
2213,
4029,
13,
29149,
1330,
17537,
220,
1303,
12466,
254,
16142,
140,
109,
15166,
20375,
16142,
220,
21727,
17537,
628,
198,
2,
1303,
29113,
29113,
29113,
14468,
4242,
2,
198,
2,
12466,
94,
15166,
25443,
109,
141,
231,
16843,
22177,
18849,
40623,
198,
2,
1303,
29113,
29113,
29113,
14468,
4242,
2,
198,
4871,
43534,
7,
46,
2389,
85,
21,
2599,
198,
220,
220,
220,
37227,
140,
248,
30143,
16142,
21727,
21727,
12466,
112,
30143,
40623,
220,
21727,
15166,
25443,
109,
141,
231,
16843,
22177,
18849,
140,
117,
37811,
628,
220,
220,
220,
1303,
16529,
47232,
438,
198,
220,
220,
220,
1303,
12466,
248,
15166,
22177,
21727,
20375,
21169,
35072,
31583,
20375,
15166,
21169,
198,
220,
220,
220,
1303,
16529,
47232,
438,
628,
198,
2,
1303,
29113,
29113,
29113,
14468,
4242,
2,
198,
2,
12466,
240,
45035,
140,
123,
25443,
119,
22177,
40623,
16843,
43108,
220,
20375,
25443,
119,
45367,
31583,
15166,
12466,
110,
220,
20375,
25443,
120,
220,
21727,
30143,
35072,
141,
229,
16142,
16843,
11,
12466,
113,
21727,
30143,
18849,
220,
141,
226,
16142,
140,
117,
30143,
12466,
115,
16142,
140,
123,
35072,
141,
231,
16843,
22177,
220,
21727,
16142,
43108,
12466,
123,
15166,
220,
21727,
16843,
140,
109,
16843,
198,
2,
1303,
29113,
29113,
29113,
14468,
4242,
2,
198,
4871,
5660,
7,
36479,
1095,
2599,
198,
220,
220,
220,
37227,
140,
248,
30143,
16142,
21727,
21727,
12466,
112,
30143,
40623,
12466,
120,
16142,
21727,
21727,
25443,
110,
25443,
117,
12466,
115,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
18849,
12466,
121,
16142,
140,
109,
15166,
21169,
16142,
12466,
112,
16142,
22177,
22177,
45035,
141,
227,
4946,
5382,
16092,
292,
316,
569,
21,
37811,
628,
220,
220,
220,
1303,
16529,
47232,
438,
198,
220,
220,
220,
1303,
12466,
248,
15166,
22177,
21727,
20375,
21169,
35072,
31583,
20375,
15166,
21169,
198,
220,
220,
220,
1303,
16529,
47232,
438,
628,
220,
220,
220,
1303,
16529,
47232,
438,
198,
220,
220,
220,
1303,
220,
12466,
240,
22177,
35072,
20375,
21169,
16843,
22177,
22177,
18849,
16843,
12466,
120,
16843,
20375,
25443,
112,
45035,
198,
220,
220,
220,
1303,
16529,
47232,
438,
628,
220,
220,
220,
1303,
12466,
253,
15166,
21727,
20375,
21169,
15166,
16843,
22177,
18849,
16843,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
198,
220,
220,
220,
825,
4808,
11249,
62,
22046,
7,
944,
11,
3063,
62,
1462,
62,
11600,
796,
6407,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
12466,
253,
15166,
21727,
20375,
21169,
15166,
16843,
22177,
18849,
16843,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
628,
220,
220,
220,
220,
220,
220,
220,
29565,
30388,
12962,
4613,
6045,
393,
8633,
628,
220,
220,
220,
220,
220,
220,
220,
12466,
238,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
45035,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
1462,
62,
11600,
532,
12466,
253,
21169,
16843,
25443,
109,
21169,
16142,
140,
115,
25443,
110,
16142,
22177,
18849,
16843,
220,
21727,
140,
123,
18849,
21727,
31583,
16142,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
12466,
110,
220,
21727,
30143,
25443,
110,
16142,
21169,
45367,
628,
220,
220,
220,
220,
220,
220,
220,
12466,
240,
25443,
115,
38857,
21169,
16142,
141,
231,
16142,
16843,
20375,
25,
8633,
12466,
113,
21727,
30143,
18849,
12466,
123,
16142,
21169,
21727,
16843,
21169,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
12466,
122,
31583,
15166,
22177,
141,
229,
16142,
20375,
16843,
30143,
45367,
22177,
45035,
140,
117,
11,
12466,
110,
12466,
122,
140,
109,
21169,
16142,
20375,
22177,
25443,
120,
220,
21727,
30143,
35072,
141,
229,
16142,
16843,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
11249,
62,
22046,
7,
25101,
8,
220,
1303,
12466,
240,
45035,
140,
123,
25443,
119,
22177,
16843,
22177,
18849,
16843,
220,
141,
226,
35072,
22177,
31583,
141,
228,
18849,
18849,
12466,
116,
140,
115,
220,
21727,
35072,
140,
123,
16843,
21169,
31583,
30143,
16142,
21727,
21727,
16142,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12466,
242,
25443,
109,
16142,
38857,
30143,
16843,
22177,
18849,
16843,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
12466,
110,
12466,
123,
16142,
21169,
21727,
16843,
21169,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
21812,
3256,
1138,
615,
283,
796,
705,
27,
21812,
29,
4321,
263,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7747,
796,
2116,
13,
9503,
1746,
11,
1037,
796,
2116,
13557,
10786,
140,
248,
25443,
120,
16142,
22177,
43666,
16142,
12466,
115,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
18849,
6,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
19608,
292,
316,
3256,
2672,
796,
10352,
11,
1138,
615,
283,
796,
2116,
13557,
10786,
140,
123,
35072,
20375,
45367,
62,
31583,
62,
43666,
18849,
21169,
16843,
31583,
20375,
15166,
21169,
18849,
18849,
33809,
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,
4277,
796,
2116,
13,
15908,
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,
1037,
796,
2116,
13557,
10786,
140,
248,
15166,
21169,
22177,
16843,
38857,
16142,
40623,
12466,
112,
18849,
21169,
16843,
31583,
20375,
15166,
21169,
18849,
40623,
12466,
112,
30143,
40623,
220,
21727,
15166,
141,
227,
21169,
16142,
22177,
16843,
22177,
18849,
40623,
440,
2389,
85,
21,
11,
12466,
115,
22177,
16142,
141,
229,
16843,
22177,
18849,
16843,
12466,
123,
15166,
220,
35072,
43108,
25443,
119,
141,
229,
16142,
22177,
18849,
141,
236,
25,
11537,
1343,
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,
705,
4064,
7,
12286,
8,
82,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
4906,
62,
7890,
3256,
2672,
796,
10352,
11,
7747,
796,
1351,
7,
944,
13,
4906,
62,
7890,
13,
13083,
28955,
1343,
37250,
439,
6,
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,
4277,
796,
705,
27432,
3256,
1138,
615,
283,
796,
705,
27432,
11,
21201,
11,
1332,
705,
1343,
2116,
13557,
10786,
18849,
30143,
18849,
11537,
1343,
705,
477,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
796,
2116,
13557,
10786,
140,
251,
16142,
140,
109,
15166,
21169,
12466,
112,
16142,
22177,
22177,
45035,
141,
227,
11,
12466,
115,
22177,
16142,
141,
229,
16843,
22177,
18849,
16843,
12466,
123,
15166,
220,
35072,
43108,
25443,
119,
141,
229,
16142,
22177,
18849,
141,
236,
25,
11537,
1343,
705,
4064,
7,
12286,
8,
82,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
37724,
3256,
2672,
796,
10352,
11,
299,
22046,
796,
705,
10,
3256,
1138,
615,
283,
796,
2116,
13557,
10786,
22177,
16142,
140,
115,
38857,
16142,
22177,
18849,
16843,
62,
31583,
30143,
16142,
21727,
21727,
16142,
33809,
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,
1037,
796,
2116,
13557,
10786,
140,
253,
15166,
21727,
30143,
16843,
43666,
25443,
110,
16142,
20375,
16843,
30143,
45367,
22177,
15166,
21727,
20375,
45367,
12466,
121,
16142,
140,
115,
38857,
16142,
22177,
18849,
140,
117,
12466,
118,
30143,
16142,
21727,
21727,
25443,
110,
12466,
116,
30143,
18849,
220,
20375,
16843,
31583,
21727,
20375,
25443,
110,
45035,
140,
117,
220,
141,
226,
16142,
140,
117,
30143,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
32374,
3256,
2672,
796,
10352,
11,
4277,
796,
657,
11,
2099,
796,
493,
11,
1138,
615,
283,
796,
2116,
13557,
10786,
141,
228,
16843,
30143,
15166,
16843,
62,
141,
229,
18849,
21727,
30143,
15166,
33809,
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,
1037,
796,
2116,
13557,
10786,
140,
249,
18849,
43108,
18849,
20375,
12466,
115,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
18849,
12466,
116,
140,
115,
25443,
109,
21169,
16142,
140,
114,
16843,
22177,
18849,
140,
117,
11,
12466,
115,
22177,
16142,
141,
229,
16843,
22177,
18849,
16843,
12466,
123,
15166,
220,
35072,
43108,
25443,
119,
141,
229,
16142,
22177,
18849,
141,
236,
25,
11537,
1343,
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,
705,
4064,
7,
12286,
8,
82,
19203,
1343,
2116,
13557,
10786,
22177,
16843,
20375,
12466,
119,
18849,
43108,
18849,
20375,
16142,
11537,
1343,
705,
8,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
41684,
62,
37724,
3256,
2672,
796,
10352,
11,
2223,
796,
705,
8095,
62,
7942,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
796,
2116,
13557,
10786,
140,
245,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
16142,
12466,
118,
30143,
16142,
21727,
21727,
25443,
110,
12466,
110,
12466,
122,
43666,
22177,
35072,
12466,
112,
18849,
21169,
16843,
31583,
20375,
15166,
21169,
18849,
141,
236,
6,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
8505,
3256,
2672,
796,
10352,
11,
2223,
796,
705,
8095,
62,
7942,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
796,
2116,
13557,
10786,
140,
238,
38857,
20375,
25443,
120,
16142,
20375,
18849,
141,
229,
16843,
21727,
31583,
16142,
40623,
12466,
115,
16142,
140,
111,
21169,
35072,
140,
115,
31583,
16142,
220,
21727,
30143,
35072,
140,
114,
16843,
140,
109,
22177,
45035,
141,
227,
220,
141,
226,
16142,
140,
117,
30143,
25443,
110,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
3919,
62,
23912,
1424,
3256,
2672,
796,
10352,
11,
2223,
796,
705,
8095,
62,
7942,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
796,
2116,
13557,
10786,
140,
251,
16843,
220,
141,
226,
15166,
21169,
43108,
18849,
21169,
25443,
110,
16142,
20375,
45367,
12466,
120,
16843,
20375,
31583,
18849,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
24717,
62,
38993,
3256,
2672,
796,
10352,
11,
2223,
796,
705,
8095,
62,
7942,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
796,
2116,
13557,
10786,
140,
240,
45035,
38857,
25443,
112,
12466,
120,
16843,
20375,
16142,
43666,
16142,
22177,
22177,
45035,
141,
227,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
499,
13,
2860,
62,
49140,
10786,
438,
3919,
62,
20063,
62,
29149,
3256,
2672,
796,
10352,
11,
2223,
796,
705,
8095,
62,
9562,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
796,
2116,
13557,
10786,
140,
251,
16843,
12466,
122,
141,
229,
18849,
141,
231,
16142,
20375,
45367,
12466,
118,
15166,
22177,
21727,
25443,
119,
45367,
12466,
123,
16843,
21169,
16843,
43666,
12466,
110,
45035,
140,
123,
25443,
119,
22177,
16843,
22177,
18849,
16843,
43108,
6,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12466,
253,
21169,
16843,
25443,
109,
21169,
16142,
140,
115,
25443,
110,
16142,
22177,
18849,
16843,
220,
21727,
140,
123,
18849,
21727,
31583,
16142,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
12466,
110,
220,
21727,
30143,
25443,
110,
16142,
21169,
45367,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3063,
62,
1462,
62,
11600,
318,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
11,
4808,
796,
2116,
13557,
499,
13,
29572,
62,
4002,
62,
22046,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
410,
945,
7,
22046,
8,
220,
1303,
12466,
253,
21169,
16843,
25443,
109,
21169,
16142,
140,
115,
25443,
110,
16142,
22177,
18849,
16843,
220,
21727,
140,
123,
18849,
21727,
31583,
16142,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
12466,
110,
220,
21727,
30143,
25443,
110,
16142,
21169,
45367,
628,
220,
220,
220,
1303,
16529,
47232,
438,
198,
220,
220,
220,
1303,
220,
12466,
240,
22177,
16843,
141,
230,
22177,
18849,
16843,
12466,
120,
16843,
20375,
25443,
112,
45035,
198,
220,
220,
220,
1303,
16529,
47232,
438,
628,
220,
220,
220,
1303,
12466,
245,
16142,
140,
123,
35072,
21727,
31583,
198,
220,
220,
220,
825,
1057,
7,
944,
11,
20150,
796,
267,
312,
85,
21,
11,
503,
796,
6407,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
12466,
245,
16142,
140,
123,
35072,
21727,
31583,
628,
220,
220,
220,
220,
220,
220,
220,
29565,
21412,
11,
8265,
11,
20512,
11,
20512,
12962,
4613,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
12466,
238,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
45035,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
532,
12466,
253,
16843,
141,
229,
16142,
20375,
16142,
20375,
45367,
12466,
123,
21169,
15166,
141,
228,
16843,
21727,
21727,
12466,
110,
45035,
140,
123,
25443,
119,
22177,
16843,
22177,
18849,
40623,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12466,
253,
21169,
25443,
110,
16843,
21169,
31583,
16142,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2099,
7,
448,
8,
318,
407,
20512,
393,
407,
318,
39098,
7,
38993,
11,
19937,
6030,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
12466,
240,
45035,
38857,
25443,
112,
220,
21727,
15166,
25443,
109,
141,
231,
16843,
22177,
18849,
40623,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
503,
318,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
944,
13557,
259,
12102,
62,
853,
2886,
13,
18982,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
445,
11,
4818,
8079,
13,
2197,
22446,
2536,
31387,
7,
944,
13557,
18982,
62,
2435,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
437,
11,
11593,
4871,
834,
13,
834,
3672,
834,
1343,
705,
2637,
1343,
2116,
13,
5143,
13,
834,
3672,
834,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15306,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
22046,
796,
2116,
13557,
11249,
62,
22046,
3419,
220,
1303,
12466,
253,
15166,
21727,
20375,
21169,
15166,
16843,
22177,
18849,
16843,
12466,
108,
21169,
140,
111,
35072,
43108,
16843,
22177,
20375,
25443,
110,
12466,
118,
25443,
120,
16142,
22177,
43666,
22177,
25443,
117,
220,
21727,
20375,
21169,
25443,
118,
18849,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
20063,
62,
29149,
7,
944,
13557,
22046,
17816,
3919,
62,
20063,
62,
29149,
6,
12962,
220,
1303,
12466,
252,
141,
229,
18849,
21727,
20375,
31583,
16142,
12466,
118,
15166,
22177,
21727,
25443,
119,
18849,
12466,
123,
16843,
21169,
16843,
43666,
12466,
110,
45035,
140,
123,
25443,
119,
22177,
16843,
22177,
18849,
16843,
43108,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12466,
253,
21169,
18849,
38857,
16843,
20375,
21727,
20375,
38857,
18849,
16843,
198,
220,
220,
220,
220,
220,
220,
220,
17537,
13,
2860,
62,
1370,
3419,
220,
1303,
12466,
242,
25443,
109,
16142,
38857,
30143,
16843,
22177,
18849,
16843,
12466,
119,
18849,
22177,
18849,
18849,
12466,
110,
15166,
12466,
110,
16843,
21727,
45367,
220,
141,
235,
31583,
21169,
16142,
22177,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
944,
13557,
1868,
85,
21,
13,
18982,
7,
944,
13,
36575,
11,
2116,
13,
17585,
11,
2116,
13,
437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
17537,
13,
2860,
62,
1370,
3419,
220,
1303,
12466,
242,
25443,
109,
16142,
38857,
30143,
16843,
22177,
18849,
16843,
12466,
119,
18849,
22177,
18849,
18849,
12466,
110,
15166,
12466,
110,
16843,
21727,
45367,
220,
141,
235,
31583,
21169,
16142,
22177,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12466,
245,
16142,
140,
123,
35072,
21727,
31583,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13557,
22046,
17816,
24717,
62,
38993,
20520,
318,
10352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
944,
13557,
38993,
13,
18982,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4818,
8079,
13,
2197,
22446,
2536,
31387,
7,
944,
13557,
18982,
62,
2435,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
834,
9800,
834,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
834,
12888,
834,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
834,
76,
2913,
10613,
834,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
834,
9641,
834,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15306,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17537,
13,
2860,
62,
1370,
3419,
220,
1303,
12466,
242,
25443,
109,
16142,
38857,
30143,
16843,
22177,
18849,
16843,
12466,
119,
18849,
22177,
18849,
18849,
12466,
110,
15166,
12466,
110,
16843,
21727,
45367,
220,
141,
235,
31583,
21169,
16142,
22177,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15002,
7,
944,
13557,
22046,
11,
503,
8,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 1.880487 | 3,782 |
import pytest
from requests import Response
from py42._internal.auth_handling import AuthHandler
from py42._internal.auth_handling import HeaderModifier
from py42._internal.auth_handling import TokenProvider
ORIGINAL_VALUE = "test-original-value"
UPDATED_VALUE = "test-updated-value"
CUSTOM_NAME = "Custom-Name"
DEFAULT_HEADER = "Authorization"
TEST_SECRET = "TEST-SECRET"
@pytest.fixture
@pytest.fixture
| [
11748,
12972,
9288,
198,
6738,
7007,
1330,
18261,
198,
198,
6738,
12972,
3682,
13557,
32538,
13,
18439,
62,
4993,
1359,
1330,
26828,
25060,
198,
6738,
12972,
3682,
13557,
32538,
13,
18439,
62,
4993,
1359,
1330,
48900,
5841,
7483,
198,
6738,
12972,
3682,
13557,
32538,
13,
18439,
62,
4993,
1359,
1330,
29130,
29495,
198,
198,
1581,
3528,
17961,
62,
39488,
796,
366,
9288,
12,
14986,
12,
8367,
1,
198,
52,
49316,
62,
39488,
796,
366,
9288,
12,
43162,
12,
8367,
1,
198,
34,
7759,
2662,
62,
20608,
796,
366,
15022,
12,
5376,
1,
198,
7206,
38865,
62,
37682,
1137,
796,
366,
13838,
1634,
1,
198,
198,
51,
6465,
62,
23683,
26087,
796,
366,
51,
6465,
12,
23683,
26087,
1,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
628,
628,
628,
628,
628,
628,
198
] | 3 | 142 |
# There is probably a more efficient way to do this
# Now I need to do the actual backwards function | [
198,
220,
220,
220,
1303,
1318,
318,
2192,
257,
517,
6942,
835,
284,
466,
428,
628,
220,
220,
220,
1303,
2735,
314,
761,
284,
466,
262,
4036,
16196,
2163
] | 3.793103 | 29 |
#!/usr/bin/env python2.7
# TODO: Actual values
devid = { 'p24fj256gb106': 0xFFFF
, 'p18f2550': 0x1234
}
targetmem = { 'int_flash': 0
, 'int_eeprom': 1
# , 'ext_flash': 2
# , 'ext_eeprom': 3
}
# TODO: Actual values
maxmem = { 'p24fj256gb106': {'int_flash':255*1024, 'int_eeprom':2048}
, 'p18f2550': {'int_flash':255*1024, 'int_eeprom':2048}
}
blocksize = { 'p24fj256gb106': {'int_flash':64, 'int_eeprom':16}
, 'p18f2550': {'int_flash':32, 'int_eeprom':16}
}
if __name__ = '__main__':
import sys
import argparse
import os.path
from intelhex import IntelHex
from cStringIO import StringIO
from dfu_suffix import *
parser = argparse.ArgumentParser( description='Convert an Intel HEX file into a dfu file suitable for OpenPICUSB bootloader.',
epilog='''Default output filename is the input filename with
".dfu" in stead of ".hex".''')
action = parser.add_mutually_exclusive_group( required=True )
# parser.add_argument( '-f', '--force', help='Forcefully try to execute given command. May result in unusable files.', action='store_true', default=False )
parser.add_argument( '-p', '--processor', help='Target processor (currently only p18f2550 and p24fj256bg106)', dest='proc', nargs=1, choices=devid, required=True )
parser.add_argument( '-t', '--targetmem', help='Target memory', nargs=1, choices=targetmem, default='int_flash' )
parser.add_argument( '-o', '--output', help='Output file.', type=argparse.FileType('wb'), dest='outfile', nargs=1, metavar='file.dfu' )
parser.add_argument( 'hexfile', help='Firmware file with DFU suffix.', type=argparse.FileType('r'), nargs=1 )
parser.add_argument( 'vid', help='The Vendor ID to use.', action='store', type=int, nargs='?', default=0xFFFF );
parser.add_argument( 'pid', help='The Product ID to use.', action='store', type=int, nargs='?', default=0xFFFF );
parser.add_argument( 'did', help='The Device version to use.', action='store', type=int, nargs='?', default=0xFFFF );
args = parser.parse_args()
(rootname, ext) = os.path.splitext( args.hexfile.name )
try:
ih = IntelHex.fromfile(hexfile)
except FileNotFoundException:
print 'File "%(name)s" not found.' % args.hexfile
sys.exit(1)
hexfile.close();
blob = StringIO()
PROC = args.proc[0]
TGTMEM = args.targetmem[0]
DEVID = devid[PROC]
MAXMEM = maxmem[PROC][TGTMEM]
BLOCKSIZE = blocksize[PROC][TGTMEM]
# Construct bootloader header
blob.write( 'HBL\x01' ) # Magic identifier
blob.write( struct.pack('>h', DEVID ) # Device ID in big endian 16bits
blob.write( struct.pack('>h', tgt_mem[TGTMEM] ) # Target memory
for addr in range(0, MAXMEM, BLOCKSIZE):
blob.write(struct.pack('>l', addr)
ih.tobinfile(blob, start=addr, size=BLOCKSIZE)
blob_suffix = Suffix._make( args.did, args.pid, args.vid, 0x0100, 'DFU', 16, 0 )
firmware = append_suffix(blob, user_suffix)
if args.outfile is None:
args.outfile = open( rootname + '.dfu', 'wb' )
args.outfile.write(firmware)
outfile.close()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
17,
13,
22,
198,
198,
2,
16926,
46,
25,
33520,
3815,
198,
7959,
312,
220,
220,
220,
220,
796,
1391,
705,
79,
1731,
69,
73,
11645,
22296,
15801,
10354,
657,
87,
29312,
198,
197,
197,
197,
11,
705,
79,
1507,
69,
1495,
1120,
10354,
657,
87,
1065,
2682,
198,
197,
197,
197,
92,
198,
198,
16793,
11883,
796,
1391,
705,
600,
62,
34167,
10354,
657,
198,
197,
197,
197,
11,
705,
600,
62,
68,
538,
398,
10354,
352,
198,
2,
197,
197,
197,
11,
705,
2302,
62,
34167,
10354,
362,
198,
2,
197,
197,
197,
11,
705,
2302,
62,
68,
538,
398,
10354,
513,
198,
197,
197,
197,
92,
198,
198,
2,
16926,
46,
25,
33520,
3815,
198,
9806,
11883,
220,
220,
220,
796,
1391,
705,
79,
1731,
69,
73,
11645,
22296,
15801,
10354,
197,
90,
6,
600,
62,
34167,
10354,
13381,
9,
35500,
11,
705,
600,
62,
68,
538,
398,
10354,
1238,
2780,
92,
198,
197,
197,
197,
11,
705,
79,
1507,
69,
1495,
1120,
10354,
197,
197,
90,
6,
600,
62,
34167,
10354,
13381,
9,
35500,
11,
705,
600,
62,
68,
538,
398,
10354,
1238,
2780,
92,
198,
197,
197,
197,
92,
198,
198,
27372,
1096,
796,
1391,
705,
79,
1731,
69,
73,
11645,
22296,
15801,
10354,
197,
90,
6,
600,
62,
34167,
10354,
2414,
11,
705,
600,
62,
68,
538,
398,
10354,
1433,
92,
198,
197,
197,
197,
11,
705,
79,
1507,
69,
1495,
1120,
10354,
197,
197,
90,
6,
600,
62,
34167,
10354,
2624,
11,
705,
600,
62,
68,
538,
398,
10354,
1433,
92,
198,
197,
197,
197,
92,
628,
198,
361,
11593,
3672,
834,
796,
705,
834,
12417,
834,
10354,
198,
197,
11748,
25064,
198,
197,
11748,
1822,
29572,
198,
197,
11748,
28686,
13,
6978,
198,
197,
6738,
33649,
33095,
1330,
8180,
39,
1069,
198,
197,
6738,
269,
10100,
9399,
1330,
10903,
9399,
198,
197,
6738,
288,
20942,
62,
37333,
844,
1330,
1635,
628,
197,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
6764,
11639,
3103,
1851,
281,
8180,
367,
6369,
2393,
656,
257,
288,
20942,
2393,
11080,
329,
4946,
47,
2149,
27155,
6297,
29356,
2637,
11,
198,
197,
197,
197,
197,
197,
197,
197,
197,
197,
220,
2462,
346,
519,
28,
7061,
6,
19463,
5072,
29472,
318,
262,
5128,
29472,
351,
198,
197,
197,
197,
197,
197,
197,
197,
197,
197,
197,
197,
197,
1911,
7568,
84,
1,
287,
7978,
286,
27071,
33095,
1911,
7061,
11537,
198,
197,
2673,
796,
30751,
13,
2860,
62,
21973,
935,
62,
41195,
62,
8094,
7,
2672,
28,
17821,
1267,
198,
2,
197,
48610,
13,
2860,
62,
49140,
7,
705,
12,
69,
3256,
705,
438,
3174,
3256,
220,
220,
220,
220,
1037,
11639,
10292,
2759,
1949,
284,
12260,
1813,
3141,
13,
1737,
1255,
287,
7242,
540,
3696,
2637,
11,
2223,
11639,
8095,
62,
7942,
3256,
4277,
28,
25101,
1267,
198,
197,
48610,
13,
2860,
62,
49140,
7,
705,
12,
79,
3256,
705,
438,
41341,
3256,
1037,
11639,
21745,
12649,
357,
41745,
691,
279,
1507,
69,
1495,
1120,
290,
279,
1731,
69,
73,
11645,
35904,
15801,
8,
3256,
2244,
11639,
36942,
3256,
299,
22046,
28,
16,
11,
7747,
28,
7959,
312,
11,
2672,
28,
17821,
1267,
198,
197,
48610,
13,
2860,
62,
49140,
7,
705,
12,
83,
3256,
705,
438,
16793,
11883,
3256,
1037,
11639,
21745,
4088,
3256,
299,
22046,
28,
16,
11,
7747,
28,
16793,
11883,
11,
4277,
11639,
600,
62,
34167,
6,
1267,
198,
197,
48610,
13,
2860,
62,
49140,
7,
705,
12,
78,
3256,
705,
438,
22915,
3256,
220,
220,
220,
1037,
11639,
26410,
2393,
2637,
11,
2099,
28,
853,
29572,
13,
8979,
6030,
10786,
39346,
33809,
2244,
11639,
448,
7753,
3256,
299,
22046,
28,
16,
11,
1138,
615,
283,
11639,
7753,
13,
7568,
84,
6,
1267,
198,
197,
48610,
13,
2860,
62,
49140,
7,
705,
33095,
7753,
3256,
1037,
11639,
37,
2533,
1574,
2393,
351,
36323,
52,
35488,
2637,
11,
220,
2099,
28,
853,
29572,
13,
8979,
6030,
10786,
81,
33809,
299,
22046,
28,
16,
1267,
198,
197,
48610,
13,
2860,
62,
49140,
7,
705,
16921,
3256,
220,
220,
220,
220,
1037,
11639,
464,
39896,
4522,
284,
779,
2637,
11,
220,
2223,
11639,
8095,
3256,
2099,
28,
600,
11,
299,
22046,
11639,
30,
3256,
4277,
28,
15,
87,
29312,
5619,
198,
197,
48610,
13,
2860,
62,
49140,
7,
705,
35317,
3256,
220,
220,
220,
220,
1037,
11639,
464,
8721,
4522,
284,
779,
2637,
11,
2223,
11639,
8095,
3256,
2099,
28,
600,
11,
299,
22046,
11639,
30,
3256,
4277,
28,
15,
87,
29312,
5619,
198,
197,
48610,
13,
2860,
62,
49140,
7,
705,
20839,
3256,
220,
220,
220,
220,
1037,
11639,
464,
16232,
2196,
284,
779,
2637,
11,
220,
2223,
11639,
8095,
3256,
2099,
28,
600,
11,
299,
22046,
11639,
30,
3256,
4277,
28,
15,
87,
29312,
5619,
628,
197,
22046,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
197,
7,
15763,
3672,
11,
1070,
8,
796,
28686,
13,
6978,
13,
22018,
578,
742,
7,
26498,
13,
33095,
7753,
13,
3672,
1267,
628,
197,
28311,
25,
198,
197,
197,
4449,
796,
8180,
39,
1069,
13,
6738,
7753,
7,
33095,
7753,
8,
198,
197,
16341,
9220,
3673,
21077,
16922,
25,
198,
197,
197,
4798,
705,
8979,
36521,
7,
3672,
8,
82,
1,
407,
1043,
2637,
4064,
26498,
13,
33095,
7753,
198,
197,
197,
17597,
13,
37023,
7,
16,
8,
198,
197,
33095,
7753,
13,
19836,
9783,
628,
197,
2436,
672,
796,
10903,
9399,
3419,
628,
197,
4805,
4503,
796,
26498,
13,
36942,
58,
15,
60,
198,
197,
35990,
15972,
3620,
796,
26498,
13,
16793,
11883,
58,
15,
60,
628,
197,
7206,
11008,
796,
1614,
312,
58,
4805,
4503,
60,
198,
197,
22921,
44,
3620,
796,
3509,
11883,
58,
4805,
4503,
7131,
35990,
15972,
3620,
60,
198,
197,
9148,
11290,
33489,
796,
7021,
1096,
58,
4805,
4503,
7131,
35990,
15972,
3620,
60,
198,
198,
2,
197,
42316,
6297,
29356,
13639,
198,
197,
2436,
672,
13,
13564,
7,
705,
39,
9148,
59,
87,
486,
6,
1267,
197,
197,
197,
197,
197,
197,
197,
2,
6139,
27421,
198,
197,
2436,
672,
13,
13564,
7,
2878,
13,
8002,
10786,
29,
71,
3256,
5550,
11008,
1267,
197,
197,
197,
2,
16232,
4522,
287,
1263,
886,
666,
1467,
9895,
198,
197,
2436,
672,
13,
13564,
7,
2878,
13,
8002,
10786,
29,
71,
3256,
256,
13655,
62,
11883,
58,
35990,
15972,
3620,
60,
1267,
197,
2,
12744,
4088,
628,
197,
1640,
37817,
287,
2837,
7,
15,
11,
25882,
44,
3620,
11,
9878,
11290,
33489,
2599,
198,
197,
197,
2436,
672,
13,
13564,
7,
7249,
13,
8002,
10786,
29,
75,
3256,
37817,
8,
198,
197,
197,
4449,
13,
83,
38954,
7753,
7,
2436,
672,
11,
923,
28,
29851,
11,
2546,
28,
9148,
11290,
33489,
8,
628,
197,
2436,
672,
62,
37333,
844,
796,
24974,
844,
13557,
15883,
7,
26498,
13,
20839,
11,
26498,
13,
35317,
11,
26498,
13,
16921,
11,
657,
87,
39103,
11,
705,
8068,
52,
3256,
1467,
11,
657,
1267,
198,
197,
69,
2533,
1574,
796,
24443,
62,
37333,
844,
7,
2436,
672,
11,
2836,
62,
37333,
844,
8,
198,
197,
198,
197,
361,
26498,
13,
448,
7753,
318,
6045,
25,
198,
197,
197,
22046,
13,
448,
7753,
796,
1280,
7,
6808,
3672,
1343,
45302,
7568,
84,
3256,
705,
39346,
6,
1267,
628,
197,
22046,
13,
448,
7753,
13,
13564,
7,
69,
2533,
1574,
8,
198,
197,
198,
197,
448,
7753,
13,
19836,
3419,
198
] | 2.460976 | 1,230 |
import time
import copy
import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import gridspec
from matplotlib.animation import FuncAnimation
import matplotlib.animation as animation
import flowrect
from flowrect.simulations.util import calculate_age, calculate_mt, eta_SRM
from flowrect.simulations import particle_population, flow_rectification, quasi_renewal
# Plot saving parameters
save = False
save_path = ""
save_name = "m_t2.pdf"
# Simulation parameters
Lambda = np.array([33.0, 8.0])
Gamma = np.array([-8, 1.0])
N = 10
dt = 1e-4
np.random.seed(123)
ts, M, spikes, A, X = particle_population(
0.18, dt, Gamma, Lambda, 0, 3, 0, 2, c=10, Gamma_ext=True, N=N
)
mask = spikes.T == 1
ticks = ts[spikes.T[0] == 1]
ticks_text = [r"$t^{(1)}$", r"$t^{(2)}$"]
fig = plt.figure(figsize=(6, 4))
gs = gridspec.GridSpec(2, 1, height_ratios=[3, 1])
# Calculate m_t
spike_mask = spikes.T[0] == 1
m_t = np.zeros(len(ts))
for s in range(1, len(ts)):
if spike_mask[s]:
m_t[s] = M[s, 0, 1]
else:
m_t[s] = m_t[s - 1]
# Leaky memory plot
ax1 = plt.subplot(gs[0])
ax1.set_yticks([])
ax1.plot(ts, M[:, 0, 1], "-k", linewidth=0.9, label=r"$M$")
ax1.plot(ts, m_t, "-r", linewidth=0.9, label=r"$m_t$")
ax1.set_ylim(0, 2)
ax1.legend()
text = (
r"$m_t(t^{(2)}) = m_t(t^{(1)})"
"\cdot e^{-\lambda (t^{(2)} - t^{(1)})} + \Gamma$"
"\n"
r" $= m_t(t^{(1)}) \cdot e^{-\lambda a} + \Gamma $"
)
ax1.annotate(
text,
color="grey",
xy=(0.11, 1.08),
xycoords="data",
xytext=(0.2, 0.9),
textcoords="axes fraction",
arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=-0.3"),
horizontalalignment="left",
verticalalignment="top",
)
# Spike plot
ax2 = plt.subplot(gs[1], sharex=ax1)
ax2.eventplot(
ts[mask[0]],
lineoffsets=0.5,
colors="black",
linewidths=0.5,
)
ax2.set_xticks(ticks)
ax2.set_xticklabels(ticks_text)
ax2.set_yticks([])
ax2.set_ylabel("Spikes")
ax2.set_ylim(0, 1)
if save:
fig.savefig(os.path.join(save_path, save_name), transparent=True)
plt.show() | [
11748,
640,
198,
11748,
4866,
198,
11748,
28686,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
2603,
29487,
8019,
1330,
50000,
43106,
198,
6738,
2603,
29487,
8019,
13,
11227,
341,
1330,
11138,
66,
39520,
198,
11748,
2603,
29487,
8019,
13,
11227,
341,
355,
11034,
198,
198,
11748,
5202,
2554,
198,
198,
6738,
5202,
2554,
13,
14323,
5768,
13,
22602,
1330,
15284,
62,
496,
11,
15284,
62,
16762,
11,
2123,
64,
62,
12562,
44,
198,
6738,
5202,
2554,
13,
14323,
5768,
1330,
18758,
62,
39748,
11,
5202,
62,
2554,
2649,
11,
32551,
62,
918,
413,
282,
198,
198,
2,
28114,
8914,
10007,
198,
21928,
796,
10352,
198,
21928,
62,
6978,
796,
13538,
198,
21928,
62,
3672,
796,
366,
76,
62,
83,
17,
13,
12315,
1,
198,
198,
2,
41798,
10007,
198,
198,
43,
4131,
6814,
796,
45941,
13,
18747,
26933,
2091,
13,
15,
11,
807,
13,
15,
12962,
198,
34777,
2611,
796,
45941,
13,
18747,
26933,
12,
23,
11,
352,
13,
15,
12962,
198,
198,
45,
796,
838,
198,
28664,
796,
352,
68,
12,
19,
198,
37659,
13,
25120,
13,
28826,
7,
10163,
8,
198,
912,
11,
337,
11,
27198,
11,
317,
11,
1395,
796,
18758,
62,
39748,
7,
198,
220,
220,
220,
657,
13,
1507,
11,
288,
83,
11,
43595,
11,
21114,
6814,
11,
657,
11,
513,
11,
657,
11,
362,
11,
269,
28,
940,
11,
43595,
62,
2302,
28,
17821,
11,
399,
28,
45,
198,
8,
198,
27932,
796,
27198,
13,
51,
6624,
352,
198,
198,
83,
3378,
796,
40379,
58,
2777,
7938,
13,
51,
58,
15,
60,
6624,
352,
60,
198,
83,
3378,
62,
5239,
796,
685,
81,
1,
3,
83,
36796,
7,
16,
38165,
3,
1600,
374,
1,
3,
83,
36796,
7,
17,
38165,
3,
8973,
198,
198,
5647,
796,
458,
83,
13,
26875,
7,
5647,
7857,
16193,
21,
11,
604,
4008,
198,
14542,
796,
50000,
43106,
13,
41339,
22882,
7,
17,
11,
352,
11,
6001,
62,
10366,
4267,
41888,
18,
11,
352,
12962,
198,
198,
2,
27131,
378,
285,
62,
83,
198,
2777,
522,
62,
27932,
796,
27198,
13,
51,
58,
15,
60,
6624,
352,
198,
76,
62,
83,
796,
45941,
13,
9107,
418,
7,
11925,
7,
912,
4008,
198,
1640,
264,
287,
2837,
7,
16,
11,
18896,
7,
912,
8,
2599,
198,
220,
220,
220,
611,
20240,
62,
27932,
58,
82,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
285,
62,
83,
58,
82,
60,
796,
337,
58,
82,
11,
657,
11,
352,
60,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
285,
62,
83,
58,
82,
60,
796,
285,
62,
83,
58,
82,
532,
352,
60,
198,
198,
2,
1004,
15492,
4088,
7110,
198,
897,
16,
796,
458,
83,
13,
7266,
29487,
7,
14542,
58,
15,
12962,
198,
897,
16,
13,
2617,
62,
20760,
3378,
26933,
12962,
198,
897,
16,
13,
29487,
7,
912,
11,
337,
58,
45299,
657,
11,
352,
4357,
27444,
74,
1600,
9493,
413,
5649,
28,
15,
13,
24,
11,
6167,
28,
81,
1,
3,
44,
3,
4943,
198,
897,
16,
13,
29487,
7,
912,
11,
285,
62,
83,
11,
27444,
81,
1600,
9493,
413,
5649,
28,
15,
13,
24,
11,
6167,
28,
81,
1,
3,
76,
62,
83,
3,
4943,
198,
897,
16,
13,
2617,
62,
88,
2475,
7,
15,
11,
362,
8,
198,
897,
16,
13,
1455,
437,
3419,
198,
198,
5239,
796,
357,
198,
220,
220,
220,
374,
1,
3,
76,
62,
83,
7,
83,
36796,
7,
17,
8,
30072,
796,
285,
62,
83,
7,
83,
36796,
7,
16,
38165,
16725,
198,
220,
220,
220,
37082,
10210,
313,
304,
36796,
12,
59,
50033,
357,
83,
36796,
7,
17,
38165,
532,
256,
36796,
7,
16,
8,
30072,
92,
1343,
3467,
34777,
2611,
3,
1,
198,
220,
220,
220,
37082,
77,
1,
198,
220,
220,
220,
374,
1,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
28,
285,
62,
83,
7,
83,
36796,
7,
16,
8,
30072,
3467,
10210,
313,
304,
36796,
12,
59,
50033,
257,
92,
1343,
3467,
34777,
2611,
720,
1,
198,
8,
198,
897,
16,
13,
34574,
378,
7,
198,
220,
220,
220,
2420,
11,
198,
220,
220,
220,
3124,
2625,
49502,
1600,
198,
220,
220,
220,
2124,
88,
16193,
15,
13,
1157,
11,
352,
13,
2919,
828,
198,
220,
220,
220,
2124,
88,
1073,
3669,
2625,
7890,
1600,
198,
220,
220,
220,
2124,
88,
5239,
16193,
15,
13,
17,
11,
657,
13,
24,
828,
198,
220,
220,
220,
2420,
1073,
3669,
2625,
897,
274,
13390,
1600,
198,
220,
220,
220,
15452,
1676,
862,
28,
11600,
7,
6018,
7635,
2625,
3784,
1600,
4637,
7635,
2625,
5605,
18,
11,
6335,
10779,
15,
13,
18,
12340,
198,
220,
220,
220,
16021,
282,
16747,
2625,
9464,
1600,
198,
220,
220,
220,
11723,
282,
16747,
2625,
4852,
1600,
198,
8,
198,
198,
2,
26309,
7110,
198,
897,
17,
796,
458,
83,
13,
7266,
29487,
7,
14542,
58,
16,
4357,
2648,
87,
28,
897,
16,
8,
198,
897,
17,
13,
15596,
29487,
7,
198,
220,
220,
220,
40379,
58,
27932,
58,
15,
60,
4357,
198,
220,
220,
220,
1627,
8210,
1039,
28,
15,
13,
20,
11,
198,
220,
220,
220,
7577,
2625,
13424,
1600,
198,
220,
220,
220,
9493,
413,
5649,
82,
28,
15,
13,
20,
11,
198,
8,
198,
897,
17,
13,
2617,
62,
742,
3378,
7,
83,
3378,
8,
198,
897,
17,
13,
2617,
62,
742,
624,
23912,
1424,
7,
83,
3378,
62,
5239,
8,
198,
198,
897,
17,
13,
2617,
62,
20760,
3378,
26933,
12962,
198,
897,
17,
13,
2617,
62,
2645,
9608,
7203,
4561,
7938,
4943,
198,
897,
17,
13,
2617,
62,
88,
2475,
7,
15,
11,
352,
8,
198,
361,
3613,
25,
198,
220,
220,
220,
2336,
13,
21928,
5647,
7,
418,
13,
6978,
13,
22179,
7,
21928,
62,
6978,
11,
3613,
62,
3672,
828,
13245,
28,
17821,
8,
198,
489,
83,
13,
12860,
3419
] | 2.108543 | 995 |
import tkinter as tk
from tkinter import ttk
import tkinter.scrolledtext as st
from tkinter import filedialog
from functools import partial
"""
Вкладка "перекодировать текст"
"""
def init_frame(self, frame: tk.Frame):
"""
Инициализация вкладки "Перекодировать текст"
:param tk_recoder.gui.Gui self: Основное окно программы
:param frame: Контейнер вкладки
:return: None
"""
buttons = tk.Frame(frame)
buttons.pack(fill='x', padx=10, pady=(10, 0))
buttons.columnconfigure(5, weight=1)
texts = tk.Frame(frame)
texts.pack(fill='both', expand=1, pady=(10, 0), padx=10)
self.tc_text_from = st.ScrolledText(texts, width=30, height=3)
self.tc_text_from.pack(side='left', expand=1, fill='both', padx=(0, 2))
self.tc_text_from.insert(tk.INSERT, "Привет мир!")
self.tc_text_to = st.ScrolledText(texts, width=30, height=3)
self.tc_text_to.pack(side='right', expand=1, fill='both', padx=(2, 0))
ttk.Label(buttons, text='Исходная').grid(column=0, row=0)
choices = self.recoder.text_encodings
self.tc_enc_from = tk.StringVar(self)
self.tc_enc_from.set(choices[0])
ttk.OptionMenu(buttons, self.tc_enc_from, self.tc_enc_from.get(), *choices).grid(column=1, row=0, padx=(10, 20))
ttk.Label(buttons, text='Конечная').grid(column=2, row=0)
self.tc_enc_to = tk.StringVar(self)
self.tc_enc_to.set(choices[0])
ttk.OptionMenu(buttons, self.tc_enc_to, self.tc_enc_to.get(), *choices).grid(column=3, row=0, padx=(10, 20))
enc_button = ttk.Button(buttons, text='Перекодировать', padding=(10, 3, 10, 3), command=convert)
enc_button.grid(column=4, row=0)
bt = tk.Menubutton(buttons, text='Сохранить как...', relief='raised', compound='right', padx=10)
popup = tk.Menu(bt, tearoff=0)
bt.configure(menu=popup)
for enc in self.recoder.file_encodings:
popup.add_command(label=enc, command=partial(save_as, enc))
frame.columnconfigure(5, weight=1)
bt.grid(column=5, row=0, padx=10, sticky=tk.E)
| [
11748,
256,
74,
3849,
355,
256,
74,
198,
6738,
256,
74,
3849,
1330,
256,
30488,
198,
11748,
256,
74,
3849,
13,
1416,
8375,
5239,
355,
336,
198,
6738,
256,
74,
3849,
1330,
5717,
498,
519,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
198,
37811,
198,
140,
240,
31583,
30143,
16142,
43666,
31583,
16142,
366,
140,
123,
16843,
21169,
16843,
31583,
25443,
112,
18849,
21169,
25443,
110,
16142,
20375,
45367,
220,
20375,
16843,
31583,
21727,
20375,
1,
220,
198,
37811,
628,
198,
4299,
2315,
62,
14535,
7,
944,
11,
5739,
25,
256,
74,
13,
19778,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12466,
246,
22177,
18849,
141,
228,
18849,
16142,
30143,
18849,
140,
115,
16142,
141,
228,
18849,
40623,
12466,
110,
31583,
30143,
16142,
43666,
31583,
18849,
366,
140,
253,
16843,
21169,
16843,
31583,
25443,
112,
18849,
21169,
25443,
110,
16142,
20375,
45367,
220,
20375,
16843,
31583,
21727,
20375,
1,
628,
220,
220,
220,
1058,
17143,
256,
74,
62,
8344,
12342,
13,
48317,
13,
8205,
72,
2116,
25,
12466,
252,
21727,
22177,
25443,
110,
22177,
15166,
16843,
12466,
122,
31583,
22177,
15166,
12466,
123,
21169,
25443,
111,
21169,
16142,
43108,
43108,
45035,
198,
220,
220,
220,
1058,
17143,
5739,
25,
12466,
248,
15166,
22177,
20375,
16843,
140,
117,
22177,
16843,
21169,
12466,
110,
31583,
30143,
16142,
43666,
31583,
18849,
198,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
12163,
796,
256,
74,
13,
19778,
7,
14535,
8,
198,
220,
220,
220,
12163,
13,
8002,
7,
20797,
11639,
87,
3256,
14841,
87,
28,
940,
11,
279,
4597,
16193,
940,
11,
657,
4008,
198,
220,
220,
220,
12163,
13,
28665,
11250,
495,
7,
20,
11,
3463,
28,
16,
8,
628,
220,
220,
220,
13399,
796,
256,
74,
13,
19778,
7,
14535,
8,
198,
220,
220,
220,
13399,
13,
8002,
7,
20797,
11639,
16885,
3256,
4292,
28,
16,
11,
279,
4597,
16193,
940,
11,
657,
828,
14841,
87,
28,
940,
8,
628,
220,
220,
220,
2116,
13,
23047,
62,
5239,
62,
6738,
796,
336,
13,
3351,
8375,
8206,
7,
5239,
82,
11,
9647,
28,
1270,
11,
6001,
28,
18,
8,
198,
220,
220,
220,
2116,
13,
23047,
62,
5239,
62,
6738,
13,
8002,
7,
1589,
11639,
9464,
3256,
4292,
28,
16,
11,
6070,
11639,
16885,
3256,
14841,
87,
16193,
15,
11,
362,
4008,
198,
220,
220,
220,
2116,
13,
23047,
62,
5239,
62,
6738,
13,
28463,
7,
30488,
13,
20913,
17395,
11,
366,
140,
253,
21169,
18849,
38857,
16843,
20375,
12466,
120,
18849,
21169,
2474,
8,
628,
220,
220,
220,
2116,
13,
23047,
62,
5239,
62,
1462,
796,
336,
13,
3351,
8375,
8206,
7,
5239,
82,
11,
9647,
28,
1270,
11,
6001,
28,
18,
8,
198,
220,
220,
220,
2116,
13,
23047,
62,
5239,
62,
1462,
13,
8002,
7,
1589,
11639,
3506,
3256,
4292,
28,
16,
11,
6070,
11639,
16885,
3256,
14841,
87,
16193,
17,
11,
657,
4008,
628,
220,
220,
220,
256,
30488,
13,
33986,
7,
4360,
27288,
11,
2420,
11639,
140,
246,
21727,
141,
227,
25443,
112,
22177,
16142,
40623,
27691,
25928,
7,
28665,
28,
15,
11,
5752,
28,
15,
8,
628,
220,
220,
220,
7747,
796,
2116,
13,
8344,
12342,
13,
5239,
62,
12685,
375,
654,
628,
220,
220,
220,
2116,
13,
23047,
62,
12685,
62,
6738,
796,
256,
74,
13,
10100,
19852,
7,
944,
8,
198,
220,
220,
220,
2116,
13,
23047,
62,
12685,
62,
6738,
13,
2617,
7,
6679,
1063,
58,
15,
12962,
198,
220,
220,
220,
256,
30488,
13,
19722,
23381,
7,
4360,
27288,
11,
2116,
13,
23047,
62,
12685,
62,
6738,
11,
2116,
13,
23047,
62,
12685,
62,
6738,
13,
1136,
22784,
1635,
6679,
1063,
737,
25928,
7,
28665,
28,
16,
11,
5752,
28,
15,
11,
14841,
87,
16193,
940,
11,
1160,
4008,
628,
220,
220,
220,
256,
30488,
13,
33986,
7,
4360,
27288,
11,
2420,
11639,
140,
248,
15166,
22177,
16843,
141,
229,
22177,
16142,
40623,
27691,
25928,
7,
28665,
28,
17,
11,
5752,
28,
15,
8,
628,
220,
220,
220,
2116,
13,
23047,
62,
12685,
62,
1462,
796,
256,
74,
13,
10100,
19852,
7,
944,
8,
198,
220,
220,
220,
2116,
13,
23047,
62,
12685,
62,
1462,
13,
2617,
7,
6679,
1063,
58,
15,
12962,
198,
220,
220,
220,
256,
30488,
13,
19722,
23381,
7,
4360,
27288,
11,
2116,
13,
23047,
62,
12685,
62,
1462,
11,
2116,
13,
23047,
62,
12685,
62,
1462,
13,
1136,
22784,
1635,
6679,
1063,
737,
25928,
7,
28665,
28,
18,
11,
5752,
28,
15,
11,
14841,
87,
16193,
940,
11,
1160,
4008,
628,
220,
220,
220,
2207,
62,
16539,
796,
256,
30488,
13,
21864,
7,
4360,
27288,
11,
2420,
11639,
140,
253,
16843,
21169,
16843,
31583,
25443,
112,
18849,
21169,
25443,
110,
16142,
20375,
45367,
3256,
24511,
16193,
940,
11,
513,
11,
838,
11,
513,
828,
3141,
28,
1102,
1851,
8,
198,
220,
220,
220,
2207,
62,
16539,
13,
25928,
7,
28665,
28,
19,
11,
5752,
28,
15,
8,
628,
220,
220,
220,
275,
83,
796,
256,
74,
13,
10418,
549,
21115,
7,
4360,
27288,
11,
2420,
11639,
140,
94,
15166,
141,
227,
21169,
16142,
22177,
18849,
20375,
45367,
12466,
118,
16142,
31583,
986,
3256,
8259,
11639,
49309,
3256,
13061,
11639,
3506,
3256,
14841,
87,
28,
940,
8,
198,
220,
220,
220,
46207,
796,
256,
74,
13,
23381,
7,
18347,
11,
11626,
2364,
28,
15,
8,
198,
220,
220,
220,
275,
83,
13,
11250,
495,
7,
26272,
28,
12924,
929,
8,
628,
220,
220,
220,
329,
2207,
287,
2116,
13,
8344,
12342,
13,
7753,
62,
12685,
375,
654,
25,
198,
220,
220,
220,
220,
220,
220,
220,
46207,
13,
2860,
62,
21812,
7,
18242,
28,
12685,
11,
3141,
28,
47172,
7,
21928,
62,
292,
11,
2207,
4008,
628,
220,
220,
220,
5739,
13,
28665,
11250,
495,
7,
20,
11,
3463,
28,
16,
8,
198,
220,
220,
220,
275,
83,
13,
25928,
7,
28665,
28,
20,
11,
5752,
28,
15,
11,
14841,
87,
28,
940,
11,
23408,
28,
30488,
13,
36,
8,
198
] | 2.029175 | 994 |
# Bigram formation
# using list comprehension + enumerate() + split()
# initializing list
test_list = ['በሙቀት ጀምሮ በቅዝቃዜ መጨረስ የዚህ ዓለም መገለጫ ሆኗል እልልታ በኡኡታ፣ ሠርግ በግልግል፣ ማሬ የሚለው ቃል እሬቴ በሚልይለወጣል', 'ጨርሰው የማይሰሩ አሳሳቢ አይደሉም፣ አይሠሩምና። ብልሽት ያለባቸው ማሞቂያዎች ግን ሰውዬው ሲሞክራቸው ይሠራሉ ']
# printing the original list
print ("The original list is : " + str(test_list))
# using list comprehension + enumerate() + split()
# for Bigram formation
res = [(x, i.split()[j + 1]) for i in test_list
for j, x in enumerate(i.split()) if j < len(i.split()) - 1]
# printing result
print ("The formed bigrams are : " + str(res))
| [
198,
2,
4403,
859,
9978,
198,
2,
1262,
1351,
35915,
1343,
27056,
378,
3419,
1343,
6626,
3419,
198,
198,
2,
4238,
2890,
1351,
198,
9288,
62,
4868,
796,
37250,
157,
231,
254,
157,
230,
247,
157,
231,
222,
157,
231,
113,
28053,
234,
222,
157,
230,
251,
157,
230,
106,
28053,
231,
254,
157,
231,
227,
157,
233,
251,
157,
231,
225,
157,
233,
250,
28053,
230,
246,
157,
234,
101,
157,
230,
101,
157,
230,
113,
28053,
233,
101,
157,
233,
248,
157,
230,
227,
28053,
233,
241,
157,
230,
230,
157,
230,
251,
28053,
230,
246,
157,
234,
230,
157,
230,
230,
157,
234,
104,
28053,
230,
228,
157,
232,
245,
157,
230,
235,
28053,
232,
98,
157,
230,
235,
157,
230,
235,
157,
231,
111,
28053,
231,
254,
157,
232,
94,
157,
232,
94,
157,
231,
111,
157,
235,
96,
28053,
230,
254,
157,
230,
255,
157,
234,
235,
28053,
231,
254,
157,
234,
235,
157,
230,
235,
157,
234,
235,
157,
230,
235,
157,
235,
96,
28053,
230,
249,
157,
230,
105,
28053,
233,
101,
157,
230,
248,
157,
230,
230,
157,
233,
235,
28053,
231,
225,
157,
230,
235,
28053,
232,
98,
157,
230,
105,
157,
231,
112,
28053,
231,
254,
157,
230,
248,
157,
230,
235,
157,
233,
255,
157,
230,
230,
157,
233,
230,
157,
234,
96,
157,
230,
235,
3256,
705,
157,
234,
101,
157,
230,
255,
157,
230,
108,
157,
233,
235,
28053,
233,
101,
157,
230,
249,
157,
233,
255,
157,
230,
108,
157,
230,
102,
28053,
232,
254,
157,
230,
111,
157,
230,
111,
157,
231,
95,
28053,
232,
254,
157,
233,
255,
157,
233,
108,
157,
230,
231,
157,
230,
251,
157,
235,
96,
28053,
232,
254,
157,
233,
255,
157,
230,
254,
157,
230,
102,
157,
230,
251,
157,
232,
241,
157,
235,
95,
28053,
231,
98,
157,
230,
235,
157,
230,
121,
157,
231,
113,
28053,
233,
104,
157,
230,
230,
157,
231,
96,
157,
231,
116,
157,
233,
235,
28053,
230,
249,
157,
230,
252,
157,
231,
224,
157,
233,
104,
157,
233,
236,
157,
231,
121,
28053,
234,
235,
157,
232,
243,
28053,
230,
108,
157,
233,
235,
157,
233,
105,
157,
233,
235,
28053,
230,
110,
157,
230,
252,
157,
232,
255,
157,
230,
104,
157,
231,
116,
157,
233,
235,
28053,
233,
255,
157,
230,
254,
157,
230,
104,
157,
230,
231,
705,
60,
198,
198,
2,
13570,
262,
2656,
1351,
198,
4798,
5855,
464,
2656,
1351,
318,
1058,
366,
1343,
965,
7,
9288,
62,
4868,
4008,
198,
198,
2,
1262,
1351,
35915,
1343,
27056,
378,
3419,
1343,
6626,
3419,
198,
2,
329,
4403,
859,
9978,
198,
411,
796,
47527,
87,
11,
1312,
13,
35312,
3419,
58,
73,
1343,
352,
12962,
329,
1312,
287,
1332,
62,
4868,
198,
197,
1640,
474,
11,
2124,
287,
27056,
378,
7,
72,
13,
35312,
28955,
611,
474,
1279,
18896,
7,
72,
13,
35312,
28955,
532,
352,
60,
198,
198,
2,
13570,
1255,
198,
4798,
5855,
464,
7042,
1263,
9474,
389,
1058,
366,
1343,
965,
7,
411,
4008,
198
] | 1.162109 | 512 |
from blspy import G1Element
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.ints import uint32, uint64
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk
| [
6738,
698,
2777,
88,
1330,
402,
16,
20180,
198,
198,
6738,
442,
544,
13,
19199,
13,
9967,
7983,
62,
18982,
13,
3630,
1330,
16312,
198,
6738,
442,
544,
13,
19199,
13,
9967,
7983,
62,
18982,
13,
13982,
62,
33661,
1330,
9881,
2624,
198,
6738,
442,
544,
13,
22602,
13,
29503,
1330,
20398,
2624,
11,
20398,
2414,
198,
6738,
442,
544,
13,
44623,
13,
79,
4715,
829,
13,
79,
17,
62,
2934,
1455,
515,
62,
79,
9625,
62,
273,
62,
30342,
62,
79,
9625,
1330,
15027,
62,
1640,
62,
79,
74,
628,
628,
628,
628
] | 2.904255 | 94 |
#
#
from os import stat
import pymongo
from apps.wxs.model.m_mongodb import MMongoDb
| [
2,
201,
198,
2,
220,
201,
198,
6738,
28686,
1330,
1185,
201,
198,
11748,
279,
4948,
25162,
201,
198,
6738,
6725,
13,
86,
34223,
13,
19849,
13,
76,
62,
31059,
375,
65,
1330,
20806,
25162,
43832,
201
] | 2.432432 | 37 |
"""
Workflow definition to book data
"""
from __future__ import division, absolute_import, print_function
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators import (
BookData
)
dag_id = "book_data"
schedule_interval = None
default_args = {
'owner': 'europython',
'depends_on_past': False,
'email': ['airflow@europython'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 0,
'retry_delay': timedelta(seconds=30)
}
dag = DAG(
dag_id,
start_date=datetime(2016, 12, 7),
schedule_interval=schedule_interval,
default_args=default_args)
book = BookData(dag=dag)
| [
37811,
198,
12468,
11125,
6770,
284,
1492,
1366,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
7297,
11,
4112,
62,
11748,
11,
3601,
62,
8818,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
198,
6738,
45771,
1330,
360,
4760,
198,
6738,
45771,
13,
3575,
2024,
1330,
357,
198,
220,
220,
220,
4897,
6601,
198,
8,
198,
198,
67,
363,
62,
312,
796,
366,
2070,
62,
7890,
1,
198,
15952,
5950,
62,
3849,
2100,
796,
6045,
198,
198,
12286,
62,
22046,
796,
1391,
198,
220,
220,
220,
705,
18403,
10354,
705,
44252,
29412,
3256,
198,
220,
220,
220,
705,
10378,
2412,
62,
261,
62,
30119,
10354,
10352,
11,
198,
220,
220,
220,
705,
12888,
10354,
37250,
958,
11125,
31,
44252,
29412,
6,
4357,
198,
220,
220,
220,
705,
12888,
62,
261,
62,
32165,
495,
10354,
10352,
11,
198,
220,
220,
220,
705,
12888,
62,
261,
62,
1186,
563,
10354,
10352,
11,
198,
220,
220,
220,
705,
1186,
1678,
10354,
657,
11,
198,
220,
220,
220,
705,
1186,
563,
62,
40850,
10354,
28805,
12514,
7,
43012,
28,
1270,
8,
198,
92,
198,
198,
67,
363,
796,
360,
4760,
7,
198,
220,
220,
220,
48924,
62,
312,
11,
198,
220,
220,
220,
923,
62,
4475,
28,
19608,
8079,
7,
5304,
11,
1105,
11,
767,
828,
198,
220,
220,
220,
7269,
62,
3849,
2100,
28,
15952,
5950,
62,
3849,
2100,
11,
198,
220,
220,
220,
4277,
62,
22046,
28,
12286,
62,
22046,
8,
198,
198,
2070,
796,
4897,
6601,
7,
67,
363,
28,
67,
363,
8,
198
] | 2.562016 | 258 |
from unittest import TestCase
from alex.components.tts.voicerss import VoiceRssTTS
import alex.utils.audio as audio
import wave
from alex.utils.config import as_project_path
__author__ = 'm2rtin'
| [
6738,
555,
715,
395,
1330,
6208,
20448,
198,
198,
6738,
257,
2588,
13,
5589,
3906,
13,
83,
912,
13,
13038,
291,
364,
82,
1330,
15282,
49,
824,
51,
4694,
198,
11748,
257,
2588,
13,
26791,
13,
24051,
355,
6597,
198,
11748,
6769,
198,
6738,
257,
2588,
13,
26791,
13,
11250,
1330,
355,
62,
16302,
62,
6978,
198,
198,
834,
9800,
834,
796,
705,
76,
17,
17034,
259,
6,
198
] | 2.869565 | 69 |
"""
TXA - Transfer Register X to Accumulator.
A = X
Copies the current contents of the X register into the accumulator and sets
the zero and negative flags as appropriate.
Processor Status after use:
+------+-------------------+--------------------------+
| Flag | Description | State |
+======+===================+==========================+
| C | Carry Flag | Not affected |
+------+-------------------+--------------------------+
| Z | Zero Flag | Set is A = 0 |
+------+-------------------+--------------------------+
| I | Interrupt Disable | Not affected |
+------+-------------------+--------------------------+
| D | Decimal Mode Flag | Not affected |
+------+-------------------+--------------------------+
| B | Break Command | Not affected |
+------+-------------------+--------------------------+
| V | Overflow Flag | Not affected |
+------+-------------------+--------------------------+
| N | Negative Flag | Set if bit 7 of A is set |
+------+-------------------+--------------------------+
+-----------------+--------+-------+--------+
| Addressing Mode | Opcode | Bytes | Cycles |
+=================+========+=======+========+
| Implied | 0x8A | 1 | 2 |
+-----------------+--------+-------+--------+
See also: TAX
"""
import pytest
import m6502
@pytest.mark.parametrize(
"value, flag_n, flag_z", [
(0x0F, False, False),
(0x00, False, True),
(0xF0, True, False),
])
def test_cpu_ins_txa_imm(value: int, flag_n: bool, flag_z: bool) -> None:
"""
Transfer Accumulator, Implied.
return: None
"""
memory = m6502.Memory()
cpu = m6502.Processor(memory)
cpu.reset()
cpu.reg_a = 0x00
cpu.reg_x = value
memory[0xFCE2] = 0x8A
cpu.execute(2)
assert (
cpu.program_counter,
cpu.stack_pointer,
cpu.cycles,
cpu.flag_n,
cpu.flag_z,
cpu.reg_a,
) == (0xFCE3, 0x01FD, 2, flag_n, flag_z, value)
| [
37811,
198,
29551,
32,
532,
20558,
17296,
1395,
284,
6366,
388,
8927,
13,
198,
198,
32,
796,
1395,
198,
198,
13379,
444,
262,
1459,
10154,
286,
262,
1395,
7881,
656,
262,
10507,
8927,
290,
5621,
198,
1169,
6632,
290,
4633,
9701,
355,
5035,
13,
198,
198,
18709,
273,
12678,
706,
779,
25,
198,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
91,
19762,
930,
12489,
220,
220,
220,
220,
220,
220,
930,
1812,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
10,
50155,
10,
4770,
18604,
10,
4770,
2559,
855,
10,
198,
91,
220,
327,
220,
220,
930,
36366,
19762,
220,
220,
220,
220,
220,
220,
220,
930,
1892,
5676,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
91,
220,
1168,
220,
220,
930,
12169,
19762,
220,
220,
220,
220,
220,
220,
220,
220,
930,
5345,
318,
317,
796,
657,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
91,
220,
314,
220,
220,
930,
4225,
3622,
31529,
930,
1892,
5676,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
91,
220,
360,
220,
220,
930,
4280,
4402,
10363,
19762,
930,
1892,
5676,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
91,
220,
347,
220,
220,
930,
12243,
9455,
220,
220,
220,
220,
930,
1892,
5676,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
91,
220,
569,
220,
220,
930,
3827,
11125,
19762,
220,
220,
220,
220,
930,
1892,
5676,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
91,
220,
399,
220,
220,
930,
36183,
19762,
220,
220,
220,
220,
930,
5345,
611,
1643,
767,
286,
317,
318,
900,
930,
198,
10,
23031,
10,
1783,
6329,
10,
22369,
44785,
198,
198,
10,
1783,
19529,
982,
10,
26866,
10,
982,
10,
198,
91,
3060,
11697,
10363,
930,
8670,
8189,
930,
2750,
4879,
930,
5934,
5427,
930,
198,
10,
4770,
28,
10,
2559,
10,
1421,
18604,
10,
2559,
10,
198,
91,
34347,
798,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
657,
87,
23,
32,
220,
930,
220,
220,
352,
220,
220,
930,
220,
220,
362,
220,
220,
220,
930,
198,
10,
1783,
19529,
982,
10,
26866,
10,
982,
10,
198,
198,
6214,
635,
25,
21664,
55,
198,
37811,
198,
11748,
12972,
9288,
198,
11748,
285,
17544,
17,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
198,
220,
220,
220,
366,
8367,
11,
6056,
62,
77,
11,
6056,
62,
89,
1600,
685,
198,
220,
220,
220,
220,
220,
220,
220,
357,
15,
87,
15,
37,
11,
10352,
11,
10352,
828,
198,
220,
220,
220,
220,
220,
220,
220,
357,
15,
87,
405,
11,
10352,
11,
6407,
828,
198,
220,
220,
220,
220,
220,
220,
220,
357,
15,
87,
37,
15,
11,
6407,
11,
10352,
828,
198,
220,
220,
220,
33761,
198,
4299,
1332,
62,
36166,
62,
1040,
62,
17602,
64,
62,
8608,
7,
8367,
25,
493,
11,
6056,
62,
77,
25,
20512,
11,
6056,
62,
89,
25,
20512,
8,
4613,
6045,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
20558,
6366,
388,
8927,
11,
34347,
798,
13,
628,
220,
220,
220,
1441,
25,
6045,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4088,
796,
285,
17544,
17,
13,
30871,
3419,
198,
220,
220,
220,
42804,
796,
285,
17544,
17,
13,
18709,
273,
7,
31673,
8,
198,
220,
220,
220,
42804,
13,
42503,
3419,
198,
220,
220,
220,
42804,
13,
2301,
62,
64,
796,
657,
87,
405,
198,
220,
220,
220,
42804,
13,
2301,
62,
87,
796,
1988,
198,
220,
220,
220,
4088,
58,
15,
87,
4851,
36,
17,
60,
796,
657,
87,
23,
32,
198,
220,
220,
220,
42804,
13,
41049,
7,
17,
8,
198,
220,
220,
220,
6818,
357,
198,
220,
220,
220,
220,
220,
220,
220,
42804,
13,
23065,
62,
24588,
11,
198,
220,
220,
220,
220,
220,
220,
220,
42804,
13,
25558,
62,
29536,
11,
198,
220,
220,
220,
220,
220,
220,
220,
42804,
13,
32503,
11,
198,
220,
220,
220,
220,
220,
220,
220,
42804,
13,
32109,
62,
77,
11,
198,
220,
220,
220,
220,
220,
220,
220,
42804,
13,
32109,
62,
89,
11,
198,
220,
220,
220,
220,
220,
220,
220,
42804,
13,
2301,
62,
64,
11,
198,
220,
220,
220,
1267,
6624,
357,
15,
87,
4851,
36,
18,
11,
657,
87,
486,
26009,
11,
362,
11,
6056,
62,
77,
11,
6056,
62,
89,
11,
1988,
8,
198
] | 2.543689 | 824 |
import pwn
HOST, PORT = "crypto.hsctf.com", 6001
rem = pwn.remote(HOST, PORT)
rem.recvline()
data = rem.recvline()
initial = data.decode().strip().split(':')[-1]
print(initial)
initial = int(initial)
for i in range(10):
rem.sendline(str(nextval(initial)).encode())
print(rem.recvline().decode())
initial = nextval(initial)
| [
11748,
279,
675,
198,
198,
39,
10892,
11,
350,
9863,
796,
366,
29609,
78,
13,
11994,
310,
69,
13,
785,
1600,
718,
8298,
198,
2787,
796,
279,
675,
13,
47960,
7,
39,
10892,
11,
350,
9863,
8,
198,
198,
2787,
13,
8344,
85,
1370,
3419,
198,
7890,
796,
816,
13,
8344,
85,
1370,
3419,
198,
198,
36733,
796,
1366,
13,
12501,
1098,
22446,
36311,
22446,
35312,
7,
10354,
11537,
58,
12,
16,
60,
198,
4798,
7,
36733,
8,
198,
36733,
796,
493,
7,
36733,
8,
198,
198,
1640,
1312,
287,
2837,
7,
940,
2599,
198,
220,
220,
220,
816,
13,
21280,
1370,
7,
2536,
7,
19545,
2100,
7,
36733,
29720,
268,
8189,
28955,
198,
220,
220,
220,
3601,
7,
2787,
13,
8344,
85,
1370,
22446,
12501,
1098,
28955,
198,
220,
220,
220,
4238,
796,
1306,
2100,
7,
36733,
8,
198
] | 2.421429 | 140 |
#!/usr/bin/env python3
# Author:: Justin Flannery (mailto:[email protected])
"""
YAML Utilities for Camply
"""
from datetime import datetime
import logging
import os
from pathlib import Path
from re import compile
from typing import Dict, Tuple
from yaml import load, SafeLoader
from camply.config import SearchConfig
from camply.containers import SearchWindow
logger = logging.getLogger(__name__)
def read_yml(path: str = None):
"""
Load a yaml configuration file_path (path) or data object (data)
and resolve any environment variables. The environment
variables must be in this format to be parsed: ${VAR_NAME}.
Parameters
----------
path: str
File Path of YAML Object to Read
Examples
----------
database:
host: ${HOST}
port: ${PORT}
${KEY}: ${VALUE}
app:
log_path: "/var/${LOG_PATH}"
something_else: "${AWESOME_ENV_VAR}/var/${A_SECOND_AWESOME_VAR}"
"""
path = os.path.abspath(path)
pattern = compile(r".*?\${(\w+)}.*?")
safe_loader = SafeLoader
safe_loader.add_implicit_resolver(tag=None, regexp=pattern, first=None)
def env_var_constructor(safe_loader: object, node: object):
"""
Extracts the environment variable from the node's value
:param yaml.Loader safe_loader: the yaml loader
:param node: the current node in the yaml
:return: the parsed string that contains the value of the environment
variable
"""
value = safe_loader.construct_scalar(node=node)
match = pattern.findall(string=value)
if match:
full_value = value
for item in match:
full_value = full_value.replace(
"${{{key}}}".format(key=item), os.getenv(key=item, default=item))
return full_value
return value
safe_loader.add_constructor(tag=None, constructor=env_var_constructor)
with open(path) as conf_data:
return load(stream=conf_data, Loader=safe_loader)
def yaml_file_to_arguments(file_path: str) -> Tuple[str, Dict[str, object], Dict[str, object]]:
"""
Convert YAML File into A Dictionary to be used as **kwargs
Parameters
----------
file_path: str
File Path to YAML
Returns
-------
provider, provider_kwargs, search_kwargs: Tuple[str, Dict[str, object], Dict[str, object]]
Tuple containing provider string, provider **kwargs, and search **kwargs
"""
yaml_search = read_yml(path=file_path)
logger.info(f"YML File Parsed: {Path(file_path).name}")
provider = yaml_search.get("provider", "RecreationDotGov")
start_date = datetime.strptime(str(yaml_search["start_date"]), "%Y-%m-%d")
end_date = datetime.strptime(str(yaml_search["end_date"]), "%Y-%m-%d")
nights = int(yaml_search.get("nights", 1))
recreation_area = yaml_search.get("recreation_area", None)
campgrounds = yaml_search.get("campgrounds", None)
weekends_only = yaml_search.get("weekends", False)
continuous = yaml_search.get("continuous", True)
polling_interval = yaml_search.get("polling_interval",
SearchConfig.RECOMMENDED_POLLING_INTERVAL)
notify_first_try = yaml_search.get("notify_first_try", False)
notification_provider = yaml_search.get("notifications", "silent")
search_forever = yaml_search.get("search_forever", False)
search_window = SearchWindow(start_date=start_date, end_date=end_date)
provider_kwargs = dict(search_window=search_window,
recreation_area=recreation_area,
campgrounds=campgrounds,
weekends_only=weekends_only,
nights=nights)
search_kwargs = dict(
log=True, verbose=True,
continuous=continuous,
polling_interval=polling_interval,
notify_first_try=notify_first_try,
notification_provider=notification_provider,
search_forever=search_forever)
return provider, provider_kwargs, search_kwargs
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
2,
6434,
3712,
220,
220,
220,
10799,
39016,
35865,
220,
357,
4529,
1462,
25,
14396,
701,
259,
31,
14396,
701,
259,
13,
785,
8,
198,
198,
37811,
198,
56,
2390,
43,
41086,
329,
5425,
306,
198,
37811,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
18931,
198,
11748,
28686,
198,
6738,
3108,
8019,
1330,
10644,
198,
6738,
302,
1330,
17632,
198,
6738,
19720,
1330,
360,
713,
11,
309,
29291,
198,
198,
6738,
331,
43695,
1330,
3440,
11,
19978,
17401,
198,
198,
6738,
1413,
306,
13,
11250,
1330,
11140,
16934,
198,
6738,
1413,
306,
13,
3642,
50221,
1330,
11140,
27703,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
4299,
1100,
62,
88,
4029,
7,
6978,
25,
965,
796,
6045,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8778,
257,
331,
43695,
8398,
2393,
62,
6978,
357,
6978,
8,
393,
1366,
2134,
357,
7890,
8,
198,
220,
220,
220,
290,
10568,
597,
2858,
9633,
13,
383,
2858,
198,
220,
220,
220,
9633,
1276,
307,
287,
428,
5794,
284,
307,
44267,
25,
25597,
53,
1503,
62,
20608,
27422,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
3108,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
9220,
10644,
286,
575,
2390,
43,
9515,
284,
4149,
628,
220,
220,
220,
21066,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
6831,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2583,
25,
25597,
39,
10892,
92,
198,
220,
220,
220,
220,
220,
220,
220,
2493,
25,
25597,
15490,
92,
198,
220,
220,
220,
220,
220,
220,
220,
25597,
20373,
38362,
25597,
39488,
92,
198,
220,
220,
220,
598,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
62,
6978,
25,
12813,
7785,
32624,
90,
25294,
62,
34219,
36786,
198,
220,
220,
220,
220,
220,
220,
220,
1223,
62,
17772,
25,
17971,
90,
12298,
1546,
13649,
62,
1677,
53,
62,
53,
1503,
92,
14,
7785,
32624,
90,
32,
62,
23683,
18672,
62,
12298,
1546,
13649,
62,
53,
1503,
36786,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3108,
796,
28686,
13,
6978,
13,
397,
2777,
776,
7,
6978,
8,
198,
220,
220,
220,
3912,
796,
17632,
7,
81,
1911,
9,
30,
59,
38892,
38016,
86,
28988,
92,
15885,
1701,
8,
628,
220,
220,
220,
3338,
62,
29356,
796,
19978,
17401,
198,
220,
220,
220,
3338,
62,
29356,
13,
2860,
62,
23928,
3628,
62,
411,
14375,
7,
12985,
28,
14202,
11,
40364,
79,
28,
33279,
11,
717,
28,
14202,
8,
628,
220,
220,
220,
825,
17365,
62,
7785,
62,
41571,
273,
7,
21230,
62,
29356,
25,
2134,
11,
10139,
25,
2134,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
29677,
82,
262,
2858,
7885,
422,
262,
10139,
338,
1988,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
331,
43695,
13,
17401,
3338,
62,
29356,
25,
262,
331,
43695,
40213,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
10139,
25,
262,
1459,
10139,
287,
262,
331,
43695,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
262,
44267,
4731,
326,
4909,
262,
1988,
286,
262,
2858,
198,
220,
220,
220,
220,
220,
220,
220,
7885,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
796,
3338,
62,
29356,
13,
41571,
62,
1416,
282,
283,
7,
17440,
28,
17440,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2872,
796,
3912,
13,
19796,
439,
7,
8841,
28,
8367,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2872,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1336,
62,
8367,
796,
1988,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2378,
287,
2872,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1336,
62,
8367,
796,
1336,
62,
8367,
13,
33491,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17971,
27007,
90,
2539,
42535,
1911,
18982,
7,
2539,
28,
9186,
828,
28686,
13,
1136,
24330,
7,
2539,
28,
9186,
11,
4277,
28,
9186,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
1336,
62,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1988,
628,
220,
220,
220,
3338,
62,
29356,
13,
2860,
62,
41571,
273,
7,
12985,
28,
14202,
11,
23772,
28,
24330,
62,
7785,
62,
41571,
273,
8,
198,
220,
220,
220,
351,
1280,
7,
6978,
8,
355,
1013,
62,
7890,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
3440,
7,
5532,
28,
10414,
62,
7890,
11,
8778,
263,
28,
21230,
62,
29356,
8,
628,
198,
4299,
331,
43695,
62,
7753,
62,
1462,
62,
853,
2886,
7,
7753,
62,
6978,
25,
965,
8,
4613,
309,
29291,
58,
2536,
11,
360,
713,
58,
2536,
11,
2134,
4357,
360,
713,
58,
2536,
11,
2134,
60,
5974,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
38240,
575,
2390,
43,
9220,
656,
317,
28261,
284,
307,
973,
355,
12429,
46265,
22046,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
2393,
62,
6978,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
9220,
10644,
284,
575,
2390,
43,
628,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
10131,
11,
10131,
62,
46265,
22046,
11,
2989,
62,
46265,
22046,
25,
309,
29291,
58,
2536,
11,
360,
713,
58,
2536,
11,
2134,
4357,
360,
713,
58,
2536,
11,
2134,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
309,
29291,
7268,
10131,
4731,
11,
10131,
12429,
46265,
22046,
11,
290,
2989,
12429,
46265,
22046,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
331,
43695,
62,
12947,
796,
1100,
62,
88,
4029,
7,
6978,
28,
7753,
62,
6978,
8,
198,
220,
220,
220,
49706,
13,
10951,
7,
69,
1,
56,
5805,
9220,
23042,
276,
25,
1391,
15235,
7,
7753,
62,
6978,
737,
3672,
92,
4943,
198,
220,
220,
220,
10131,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
15234,
1304,
1600,
366,
6690,
260,
341,
35,
313,
23774,
4943,
198,
220,
220,
220,
923,
62,
4475,
796,
4818,
8079,
13,
2536,
457,
524,
7,
2536,
7,
88,
43695,
62,
12947,
14692,
9688,
62,
4475,
8973,
828,
36521,
56,
12,
4,
76,
12,
4,
67,
4943,
198,
220,
220,
220,
886,
62,
4475,
796,
4818,
8079,
13,
2536,
457,
524,
7,
2536,
7,
88,
43695,
62,
12947,
14692,
437,
62,
4475,
8973,
828,
36521,
56,
12,
4,
76,
12,
4,
67,
4943,
198,
220,
220,
220,
12513,
796,
493,
7,
88,
43695,
62,
12947,
13,
1136,
7203,
77,
2337,
1600,
352,
4008,
198,
220,
220,
220,
27702,
62,
20337,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
260,
38793,
62,
20337,
1600,
6045,
8,
198,
220,
220,
220,
1413,
40520,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
16544,
40520,
1600,
6045,
8,
198,
220,
220,
220,
21511,
62,
8807,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
10464,
2412,
1600,
10352,
8,
198,
220,
220,
220,
12948,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
18487,
5623,
1600,
6407,
8,
198,
220,
220,
220,
13985,
62,
3849,
2100,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
30393,
278,
62,
3849,
2100,
1600,
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,
11140,
16934,
13,
2200,
9858,
44,
49361,
62,
16402,
3069,
2751,
62,
41358,
23428,
8,
198,
220,
220,
220,
19361,
62,
11085,
62,
28311,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
1662,
1958,
62,
11085,
62,
28311,
1600,
10352,
8,
198,
220,
220,
220,
14483,
62,
15234,
1304,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
1662,
6637,
1600,
366,
18217,
298,
4943,
198,
220,
220,
220,
2989,
62,
754,
332,
796,
331,
43695,
62,
12947,
13,
1136,
7203,
12947,
62,
754,
332,
1600,
10352,
8,
628,
220,
220,
220,
2989,
62,
17497,
796,
11140,
27703,
7,
9688,
62,
4475,
28,
9688,
62,
4475,
11,
886,
62,
4475,
28,
437,
62,
4475,
8,
628,
220,
220,
220,
10131,
62,
46265,
22046,
796,
8633,
7,
12947,
62,
17497,
28,
12947,
62,
17497,
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,
27702,
62,
20337,
28,
260,
38793,
62,
20337,
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,
1413,
40520,
28,
16544,
40520,
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,
21511,
62,
8807,
28,
10464,
2412,
62,
8807,
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,
12513,
28,
77,
2337,
8,
198,
220,
220,
220,
2989,
62,
46265,
22046,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
28,
17821,
11,
15942,
577,
28,
17821,
11,
198,
220,
220,
220,
220,
220,
220,
220,
12948,
28,
18487,
5623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
13985,
62,
3849,
2100,
28,
30393,
278,
62,
3849,
2100,
11,
198,
220,
220,
220,
220,
220,
220,
220,
19361,
62,
11085,
62,
28311,
28,
1662,
1958,
62,
11085,
62,
28311,
11,
198,
220,
220,
220,
220,
220,
220,
220,
14483,
62,
15234,
1304,
28,
1662,
2649,
62,
15234,
1304,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2989,
62,
754,
332,
28,
12947,
62,
754,
332,
8,
198,
220,
220,
220,
1441,
10131,
11,
10131,
62,
46265,
22046,
11,
2989,
62,
46265,
22046,
198
] | 2.409198 | 1,696 |
'''
Created on May 23, 2016
@author: Lucas Lehnert ([email protected])
Script to generate all plots from the NIPS 2016 paper.
'''
import matplotlib
matplotlib.use( 'agg' )
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['text.latex.preamble'] = [r'\usepackage{amsmath}']
import matplotlib.pyplot as plt
import numpy as np
import glob
import os
from util.numpy_json import loadJSONResults
experimentDir = '../data/'
plotDir = '../plot/'
if not os.path.exists( plotDir ):
os.makedirs( plotDir )
if __name__ == '__main__':
main()
| [
7061,
6,
198,
41972,
319,
1737,
2242,
11,
1584,
198,
198,
31,
9800,
25,
15257,
1004,
21116,
861,
357,
75,
1229,
292,
13,
293,
21116,
861,
31,
4529,
13,
23209,
70,
359,
13,
6888,
8,
198,
198,
7391,
284,
7716,
477,
21528,
422,
262,
24947,
3705,
1584,
3348,
13,
198,
198,
7061,
6,
198,
198,
11748,
2603,
29487,
8019,
198,
6759,
29487,
8019,
13,
1904,
7,
705,
9460,
6,
1267,
198,
6759,
29487,
8019,
13,
6015,
10044,
4105,
17816,
5239,
13,
385,
316,
1069,
20520,
796,
6407,
198,
6759,
29487,
8019,
13,
6015,
10044,
4105,
17816,
5239,
13,
17660,
87,
13,
79,
1476,
903,
20520,
796,
685,
81,
6,
59,
1904,
26495,
90,
4105,
11018,
92,
20520,
198,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
15095,
198,
11748,
28686,
198,
6738,
7736,
13,
77,
32152,
62,
17752,
1330,
3440,
40386,
25468,
198,
198,
23100,
3681,
35277,
796,
705,
40720,
7890,
14,
6,
198,
29487,
35277,
796,
705,
40720,
29487,
14,
6,
198,
198,
361,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
7110,
35277,
15179,
198,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
7110,
35277,
1267,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.586364 | 220 |
from Support.Code.actions.Support.utils.functions_dict import get_name
from django.utils.text import slugify
| [
6738,
7929,
13,
10669,
13,
4658,
13,
15514,
13,
26791,
13,
12543,
2733,
62,
11600,
1330,
651,
62,
3672,
198,
6738,
42625,
14208,
13,
26791,
13,
5239,
1330,
31065,
1958,
198
] | 3.516129 | 31 |
# Standard Library Imports
from datetime import datetime
from typing import List
# Protean
from protean.core.aggregate import BaseAggregate
from protean.core.entity import BaseEntity
from protean.core.field.association import HasMany, HasOne, Reference
from protean.core.field.basic import Auto, DateTime, Integer, String, Text
from protean.core.repository import BaseRepository
# Aggregates to test Identity
# Aggregates to test Subclassing
# Aggregates to test Abstraction # START #
# Aggregates to test Abstraction # END #
# Aggregates to test Meta Info overriding # START #
# Aggregates to test Meta Info overriding # END #
# Aggregates to test associations # START #
# Aggregates to test associations # END #
| [
2,
8997,
10074,
1846,
3742,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
19720,
1330,
7343,
198,
198,
2,
1041,
660,
272,
198,
6738,
5915,
272,
13,
7295,
13,
9460,
49373,
1330,
7308,
46384,
49373,
198,
6738,
5915,
272,
13,
7295,
13,
26858,
1330,
7308,
32398,
198,
6738,
5915,
272,
13,
7295,
13,
3245,
13,
562,
41003,
1330,
7875,
7085,
11,
7875,
3198,
11,
20984,
198,
6738,
5915,
272,
13,
7295,
13,
3245,
13,
35487,
1330,
11160,
11,
7536,
7575,
11,
34142,
11,
10903,
11,
8255,
198,
6738,
5915,
272,
13,
7295,
13,
260,
1930,
37765,
1330,
7308,
6207,
13264,
628,
628,
198,
198,
2,
19015,
2301,
689,
284,
1332,
27207,
628,
198,
198,
2,
19015,
2301,
689,
284,
1332,
3834,
4871,
278,
628,
198,
2,
19015,
2301,
689,
284,
1332,
2275,
301,
7861,
1303,
33303,
1303,
628,
628,
198,
2,
19015,
2301,
689,
284,
1332,
2275,
301,
7861,
1303,
23578,
1303,
628,
198,
2,
19015,
2301,
689,
284,
1332,
30277,
14151,
44987,
1303,
33303,
1303,
628,
628,
628,
198,
198,
2,
19015,
2301,
689,
284,
1332,
30277,
14151,
44987,
1303,
23578,
1303,
628,
198,
2,
19015,
2301,
689,
284,
1332,
15814,
1303,
33303,
1303,
628,
628,
628,
628,
628,
628,
628,
628,
198,
2,
19015,
2301,
689,
284,
1332,
15814,
1303,
23578,
1303,
198
] | 3.5 | 216 |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
#%load_ext autoreload
#%autoreload 2
# In[ ]:
import sys
import torch
import numpy as np
import time
import hashlib
from os import listdir
from os.path import isfile, join
import pickle
import argparse
import json
from tqdm import tqdm
from copy import deepcopy
import os
from pytorch_pretrained_bert import BertTokenizer, BertModel
PATH_SENTEVAL = './SentEval'
PATH_TO_DATA = './SentEval/data/'
PATH_TO_CACHE = './cache/'
sys.path.insert(0, PATH_SENTEVAL)
import senteval
seed = 123
np.random.seed(seed)
torch.manual_seed(seed)
# In[ ]:
def convert_sentences_to_features(sentences, seq_length, tokenizer):
"""Convert sentence into Tensor"""
num_sent = len(sentences)
input_type_ids = np.zeros((num_sent, seq_length), dtype=np.int32)
input_ids = np.zeros((num_sent, seq_length), dtype=np.int32)
input_mask = np.zeros((num_sent, seq_length), dtype=np.int32)
for idx, sent in enumerate(sentences):
tokens = tokenizer.tokenize(sent)
tokens = tokens[0:min((seq_length - 2), len(tokens))] # truncate tokens longer than seq_length
tokens.insert(0, "[CLS]")
tokens.append("[SEP]")
input_ids[idx,:len(tokens)] = np.array(tokenizer.convert_tokens_to_ids(tokens), dtype=np.int32)
input_mask[idx,:len(tokens)] = np.ones(len(tokens), dtype=np.int32)
assert len(input_ids[idx]) == seq_length
assert len(input_mask[idx]) == seq_length
assert len(input_type_ids[idx]) == seq_length
return input_ids, input_type_ids, input_mask
# In[ ]:
# In[ ]:
# In[ ]:
# In[ ]:
tasks = ['Length', 'WordContent', 'Depth', 'TopConstituents',
'BigramShift', 'Tense', 'SubjNumber', 'ObjNumber',
'OddManOut', 'CoordinationInversion']
seed = 123
np.random.seed(seed)
torch.manual_seed(seed)
parser = argparse.ArgumentParser(description='Evaluate BERT')
parser.add_argument("--device", type=list, default=[1,2])
parser.add_argument("--batch_size", type=int, default=500)
parser.add_argument("--nhid", type=int, default=0)
parser.add_argument("--kfold", type=int, default=5)
parser.add_argument("--usepytorch", type=bool, default=True)
parser.add_argument("--data_path", type=str, default='./SentEval/data/')
parser.add_argument("--cache_path", type=str, default='./cache/')
parser.add_argument("--result_path", type=str, default='./results/')
parser.add_argument("--optim", type=str, default='rmsprop')
parser.add_argument("--cbatch_size", type=int, default=512)
parser.add_argument("--tenacity", type=int, default=3)
parser.add_argument("--epoch_size", type=int, default=2)
parser.add_argument("--model_name", type=str, default='bert-base-uncased')
parser.add_argument("--task", type=int, default=0)
parser.add_argument("--layer", type=int, default=[0, 11])
parser.add_argument("--head", type=int, default=[-1, 11])
parser.add_argument("--head_size", type=int, default=64)
args = parser.parse_args()
os.environ["CUDA_VISIBLE_DEVICES"] = ','.join(str(x) for x in args.device)
list_layer = range(args.layer[0], args.layer[1]+1) if len(args.layer) > 1 else [args.layer[0]]
list_head = range(args.head[0], args.head[1]+1) if len(args.head) > 1 else [args.head[0]]
num_exp = len(list(list_layer)) * len(list(list_head))
print("======= Benchmark Configuration ======")
print("Device: ", args.device)
print("model name: ", args.model_name)
print("Task: ", tasks[args.task])
print("range layer: ", list_layer)
print("range head: ", list_head)
print("Total Exps: ", num_exp)
print("======================================")
cnt = 0
target_task = tasks[args.task]
with tqdm(total=num_exp, file=sys.stdout) as pbar:
for layer in list_layer:
for head in list_head:
args.layer = layer
args.head = head
print()
experiment(args, target_task)
pbar.set_description('processed: %d' % (1 + cnt))
pbar.update(1)
cnt += 1
# In[ ]:
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
554,
58,
2361,
25,
628,
198,
2,
4,
2220,
62,
2302,
1960,
382,
2220,
198,
2,
4,
2306,
382,
2220,
362,
628,
198,
2,
554,
58,
2361,
25,
628,
198,
11748,
25064,
198,
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
640,
198,
11748,
12234,
8019,
198,
6738,
28686,
1330,
1351,
15908,
198,
6738,
28686,
13,
6978,
1330,
318,
7753,
11,
4654,
198,
11748,
2298,
293,
198,
11748,
1822,
29572,
198,
11748,
33918,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
198,
6738,
4866,
1330,
2769,
30073,
198,
11748,
28686,
198,
198,
6738,
12972,
13165,
354,
62,
5310,
13363,
62,
4835,
1330,
22108,
30642,
7509,
11,
22108,
17633,
198,
198,
34219,
62,
50,
3525,
20114,
1847,
796,
705,
19571,
31837,
36,
2100,
6,
198,
34219,
62,
10468,
62,
26947,
796,
705,
19571,
31837,
36,
2100,
14,
7890,
14,
6,
198,
34219,
62,
10468,
62,
34,
2246,
13909,
796,
705,
19571,
23870,
14,
6,
198,
17597,
13,
6978,
13,
28463,
7,
15,
11,
46490,
62,
50,
3525,
20114,
1847,
8,
198,
11748,
1908,
18206,
198,
198,
28826,
796,
17031,
198,
37659,
13,
25120,
13,
28826,
7,
28826,
8,
198,
13165,
354,
13,
805,
723,
62,
28826,
7,
28826,
8,
628,
198,
2,
554,
58,
2361,
25,
628,
198,
4299,
10385,
62,
34086,
3007,
62,
1462,
62,
40890,
7,
34086,
3007,
11,
33756,
62,
13664,
11,
11241,
7509,
2599,
198,
220,
220,
220,
37227,
3103,
1851,
6827,
656,
309,
22854,
37811,
198,
220,
220,
220,
220,
198,
220,
220,
220,
997,
62,
34086,
796,
18896,
7,
34086,
3007,
8,
198,
220,
220,
220,
5128,
62,
4906,
62,
2340,
796,
45941,
13,
9107,
418,
19510,
22510,
62,
34086,
11,
33756,
62,
13664,
828,
288,
4906,
28,
37659,
13,
600,
2624,
8,
198,
220,
220,
220,
5128,
62,
2340,
796,
45941,
13,
9107,
418,
19510,
22510,
62,
34086,
11,
33756,
62,
13664,
828,
288,
4906,
28,
37659,
13,
600,
2624,
8,
198,
220,
220,
220,
5128,
62,
27932,
796,
45941,
13,
9107,
418,
19510,
22510,
62,
34086,
11,
33756,
62,
13664,
828,
288,
4906,
28,
37659,
13,
600,
2624,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
329,
4686,
87,
11,
1908,
287,
27056,
378,
7,
34086,
3007,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
16326,
796,
11241,
7509,
13,
30001,
1096,
7,
34086,
8,
198,
220,
220,
220,
220,
220,
220,
220,
16326,
796,
16326,
58,
15,
25,
1084,
19510,
41068,
62,
13664,
532,
362,
828,
18896,
7,
83,
482,
641,
4008,
60,
1303,
40122,
378,
16326,
2392,
621,
33756,
62,
13664,
198,
220,
220,
220,
220,
220,
220,
220,
16326,
13,
28463,
7,
15,
11,
12878,
5097,
50,
60,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
16326,
13,
33295,
7203,
58,
5188,
47,
60,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
2340,
58,
312,
87,
11,
25,
11925,
7,
83,
482,
641,
15437,
796,
45941,
13,
18747,
7,
30001,
7509,
13,
1102,
1851,
62,
83,
482,
641,
62,
1462,
62,
2340,
7,
83,
482,
641,
828,
288,
4906,
28,
37659,
13,
600,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
62,
27932,
58,
312,
87,
11,
25,
11925,
7,
83,
482,
641,
15437,
796,
45941,
13,
1952,
7,
11925,
7,
83,
482,
641,
828,
288,
4906,
28,
37659,
13,
600,
2624,
8,
628,
220,
220,
220,
220,
220,
220,
220,
6818,
18896,
7,
15414,
62,
2340,
58,
312,
87,
12962,
6624,
33756,
62,
13664,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
18896,
7,
15414,
62,
27932,
58,
312,
87,
12962,
6624,
33756,
62,
13664,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
18896,
7,
15414,
62,
4906,
62,
2340,
58,
312,
87,
12962,
6624,
33756,
62,
13664,
628,
220,
220,
220,
1441,
5128,
62,
2340,
11,
5128,
62,
4906,
62,
2340,
11,
5128,
62,
27932,
628,
198,
2,
554,
58,
2361,
25,
628,
198,
198,
2,
554,
58,
2361,
25,
628,
628,
198,
198,
2,
554,
58,
2361,
25,
628,
198,
198,
2,
554,
58,
2361,
25,
628,
198,
83,
6791,
796,
37250,
24539,
3256,
705,
26449,
19746,
3256,
705,
48791,
3256,
705,
9126,
34184,
34272,
658,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
705,
12804,
859,
33377,
3256,
705,
51,
1072,
3256,
705,
7004,
73,
15057,
3256,
705,
49201,
15057,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
705,
46,
1860,
5124,
7975,
3256,
705,
7222,
585,
1883,
818,
9641,
20520,
198,
198,
28826,
796,
17031,
198,
37659,
13,
25120,
13,
28826,
7,
28826,
8,
198,
13165,
354,
13,
805,
723,
62,
28826,
7,
28826,
8,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
11639,
36,
2100,
4985,
347,
17395,
11537,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
25202,
1600,
2099,
28,
4868,
11,
4277,
41888,
16,
11,
17,
12962,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
43501,
62,
7857,
1600,
2099,
28,
600,
11,
4277,
28,
4059,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
77,
49675,
1600,
2099,
28,
600,
11,
4277,
28,
15,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
74,
11379,
1600,
2099,
28,
600,
11,
4277,
28,
20,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
1904,
9078,
13165,
354,
1600,
2099,
28,
30388,
11,
4277,
28,
17821,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
7890,
62,
6978,
1600,
2099,
28,
2536,
11,
4277,
28,
4458,
14,
31837,
36,
2100,
14,
7890,
14,
11537,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
23870,
62,
6978,
1600,
2099,
28,
2536,
11,
4277,
28,
4458,
14,
23870,
14,
11537,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
20274,
62,
6978,
1600,
2099,
28,
2536,
11,
4277,
28,
4458,
14,
43420,
14,
11537,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
40085,
1600,
2099,
28,
2536,
11,
4277,
11639,
81,
907,
22930,
11537,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
21101,
963,
62,
7857,
1600,
2099,
28,
600,
11,
4277,
28,
25836,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
1452,
4355,
1600,
2099,
28,
600,
11,
4277,
28,
18,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
538,
5374,
62,
7857,
1600,
2099,
28,
600,
11,
4277,
28,
17,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
19849,
62,
3672,
1600,
2099,
28,
2536,
11,
4277,
11639,
4835,
12,
8692,
12,
19524,
839,
11537,
198,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
35943,
1600,
2099,
28,
600,
11,
4277,
28,
15,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
29289,
1600,
2099,
28,
600,
11,
4277,
41888,
15,
11,
1367,
12962,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
2256,
1600,
2099,
28,
600,
11,
4277,
41888,
12,
16,
11,
1367,
12962,
198,
48610,
13,
2860,
62,
49140,
7203,
438,
2256,
62,
7857,
1600,
2099,
28,
600,
11,
4277,
28,
2414,
8,
198,
198,
22046,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
418,
13,
268,
2268,
14692,
43633,
5631,
62,
29817,
34563,
62,
39345,
34444,
8973,
796,
705,
4032,
13,
22179,
7,
2536,
7,
87,
8,
329,
2124,
287,
26498,
13,
25202,
8,
628,
198,
4868,
62,
29289,
796,
2837,
7,
22046,
13,
29289,
58,
15,
4357,
26498,
13,
29289,
58,
16,
48688,
16,
8,
611,
18896,
7,
22046,
13,
29289,
8,
1875,
352,
2073,
685,
22046,
13,
29289,
58,
15,
11907,
198,
4868,
62,
2256,
796,
2837,
7,
22046,
13,
2256,
58,
15,
4357,
26498,
13,
2256,
58,
16,
48688,
16,
8,
611,
18896,
7,
22046,
13,
2256,
8,
1875,
352,
2073,
685,
22046,
13,
2256,
58,
15,
11907,
198,
22510,
62,
11201,
796,
18896,
7,
4868,
7,
4868,
62,
29289,
4008,
1635,
18896,
7,
4868,
7,
4868,
62,
2256,
4008,
628,
198,
4798,
7203,
1421,
18604,
25187,
4102,
28373,
29335,
2625,
8,
198,
4798,
7203,
24728,
25,
33172,
26498,
13,
25202,
8,
198,
4798,
7203,
19849,
1438,
25,
33172,
26498,
13,
19849,
62,
3672,
8,
198,
4798,
7203,
25714,
25,
33172,
8861,
58,
22046,
13,
35943,
12962,
198,
4798,
7203,
9521,
7679,
25,
33172,
1351,
62,
29289,
8,
198,
4798,
7203,
9521,
1182,
25,
33172,
1351,
62,
2256,
8,
198,
4798,
7203,
14957,
1475,
862,
25,
33172,
997,
62,
11201,
8,
198,
4798,
7203,
10052,
50155,
4943,
198,
198,
66,
429,
796,
657,
198,
16793,
62,
35943,
796,
8861,
58,
22046,
13,
35943,
60,
198,
4480,
256,
80,
36020,
7,
23350,
28,
22510,
62,
11201,
11,
2393,
28,
17597,
13,
19282,
448,
8,
355,
279,
5657,
25,
198,
220,
220,
220,
329,
7679,
287,
1351,
62,
29289,
25,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1182,
287,
1351,
62,
2256,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
29289,
796,
7679,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
2256,
796,
1182,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6306,
7,
22046,
11,
2496,
62,
35943,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
5657,
13,
2617,
62,
11213,
10786,
14681,
276,
25,
4064,
67,
6,
4064,
357,
16,
1343,
269,
429,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
5657,
13,
19119,
7,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
429,
15853,
352,
628,
198,
2,
554,
58,
2361,
25,
628,
628,
198
] | 2.479851 | 1,613 |
import RPi.GPIO as GPIO
import time
dis=0
while True:
# Setup triggers and Echos of all sensors
GPIO.setmode(GPIO.BOARD)
TRIG=11
ECHO=13
GPIO.setup(TRIG,GPIO.OUT)
GPIO.setup(3,GPIO.OUT)
GPIO.setup(ECHO,GPIO.IN)
GPIO.setup(5,GPIO.IN)
GPIO.setup(35,GPIO.OUT)
GPIO.setup(31,GPIO.OUT)
GPIO.setup(33,GPIO.IN)
GPIO.setup(29,GPIO.IN)
GPIO.setup(38,GPIO.OUT)
GPIO.setup(19,GPIO.OUT)
GPIO.setup(23,GPIO.IN)
GPIO.setup(21,GPIO.IN)
station1()
a=station1()
print(str(a)+'Station 1 OK')
station2()
b=station2()
print(str(b)+'Station 2 OK')
station4()
d=station4()
print(str(d)+'Station 4 OK')
station3()
c=station3()
print(str(c)+'Station 3 OK')
station6()
f=station6()
print(str(f)+'Station 6 OK')
station5()
e=station5()
print(str(e)+'Station 5 OK')
| [
11748,
25812,
72,
13,
16960,
9399,
355,
50143,
198,
11748,
640,
198,
198,
6381,
28,
15,
198,
198,
4514,
6407,
25,
198,
220,
220,
220,
1303,
31122,
20022,
290,
412,
354,
418,
286,
477,
15736,
198,
220,
220,
220,
50143,
13,
2617,
14171,
7,
16960,
9399,
13,
8202,
9795,
8,
198,
220,
220,
220,
7579,
3528,
28,
1157,
198,
220,
220,
220,
412,
44899,
28,
1485,
198,
220,
220,
220,
50143,
13,
40406,
7,
5446,
3528,
11,
16960,
9399,
13,
12425,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
18,
11,
16960,
9399,
13,
12425,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
25994,
46,
11,
16960,
9399,
13,
1268,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
20,
11,
16960,
9399,
13,
1268,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
2327,
11,
16960,
9399,
13,
12425,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
3132,
11,
16960,
9399,
13,
12425,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
2091,
11,
16960,
9399,
13,
1268,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
1959,
11,
16960,
9399,
13,
1268,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
2548,
11,
16960,
9399,
13,
12425,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
1129,
11,
16960,
9399,
13,
12425,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
1954,
11,
16960,
9399,
13,
1268,
8,
198,
220,
220,
220,
50143,
13,
40406,
7,
2481,
11,
16960,
9399,
13,
1268,
8,
628,
220,
220,
220,
4429,
16,
3419,
198,
220,
220,
220,
257,
28,
17529,
16,
3419,
198,
220,
220,
220,
3601,
7,
2536,
7,
64,
47762,
6,
12367,
352,
7477,
11537,
198,
220,
220,
220,
4429,
17,
3419,
198,
220,
220,
220,
275,
28,
17529,
17,
3419,
198,
220,
220,
220,
3601,
7,
2536,
7,
65,
47762,
6,
12367,
362,
7477,
11537,
628,
220,
220,
220,
4429,
19,
3419,
198,
220,
220,
220,
288,
28,
17529,
19,
3419,
198,
220,
220,
220,
3601,
7,
2536,
7,
67,
47762,
6,
12367,
604,
7477,
11537,
198,
220,
220,
220,
4429,
18,
3419,
198,
220,
220,
220,
269,
28,
17529,
18,
3419,
198,
220,
220,
220,
3601,
7,
2536,
7,
66,
47762,
6,
12367,
513,
7477,
11537,
198,
220,
220,
220,
4429,
21,
3419,
198,
220,
220,
220,
277,
28,
17529,
21,
3419,
198,
220,
220,
220,
3601,
7,
2536,
7,
69,
47762,
6,
12367,
718,
7477,
11537,
198,
220,
220,
220,
4429,
20,
3419,
198,
220,
220,
220,
304,
28,
17529,
20,
3419,
198,
220,
220,
220,
3601,
7,
2536,
7,
68,
47762,
6,
12367,
642,
7477,
11537,
198
] | 2.02069 | 435 |
"""
Copyright C.C.:
Emiliano Hernandez Laos
https://github.com/emhlaos/
28/02/2018
"""
from urllib.request import urlopen
import os
from io import BytesIO
from zipfile import ZipFile
#LOAD FUNCTION:
currentdirectory = os.getcwd()
xbrldirectory = currentdirectory+"/xbrl"
if not os.path.exists(xbrldirectory): os.makedirs(xbrldirectory)
db = open(currentdirectory+"/babycaw.txt","r").read()
matrix = {}
rows = db.split("\n")
matrix["R.TIME"] = {}
n = 0
for t in rows[0].split(",")[1:]:
matrix["R.TIME"][n] = t
n=n+1
print(rows[1]," $$ ",rows[1].split(","))
for row in rows[1:]:
columns = row.split(",")
ticker = columns[0]
matrix[ticker]={}
n=0
for cell in columns[1:]:
matrix[ticker][n] = cell
n=n+1
#DOWNLOAD INFO:
revenue_matrix = matrix
allread = []
stocks = list(matrix.keys())[1:]
n=len(list(matrix["R.TIME"].keys()))
print(n,"\n",stocks)
for stock in stocks:
allread.append(stock)
for m in range(n):
print("Reading about "+stock)
if ".zip" in matrix[stock][m]:
with urlopen(matrix[stock][m]) as pzip:
with ZipFile(BytesIO(pzip.read())) as zp:
for file in zp.namelist():
print(file)
print("Dowloading: "+ stock + "_" + matrix["R.TIME"][m] + ".json")
try:
pjson = open(xbrldirectory+"/" + stock + "_" + matrix["R.TIME"][m] + ".json", "wb")
pjson.write(zp.read(file))
pjson.close()
except Exception as args:
print(args,"you got {}%".format(len(allread)/n))
teencow = open(currentdirectory+"/teencaw.txt", "w")
for riadboe in allread:
teencow.write(riadboe,"\n")
allread=[]
elif ".json" in matrix[stock][m]:
jsonurl = matrix[stock][m]
jsonresp = urlopen(jsonurl)
with urlopen(matrix[stock][m]) as pjson:
try:
print("Downloading",stock + "_" + matrix["R.TIME"][m] + ".json")
tempjson = open(xbrldirectory+"/" + stock + "_" + matrix["R.TIME"][m] + ".json", "wb")
tempjson.write(pjson.read())
tempjson.close()
except Exception as args:
print(args, "you got {}%".format(len(allread) / n),"ending at a json file JSUUN")
teencow = open(currentdirectory+"/teencaw.txt", "w")
for riadboe in allread:
teencow.write(riadboe, "\n")
allread = []
| [
37811,
201,
198,
15269,
327,
13,
34,
11207,
201,
198,
220,
220,
220,
44272,
10115,
24687,
45919,
201,
198,
220,
220,
220,
3740,
1378,
12567,
13,
785,
14,
368,
71,
5031,
418,
14,
201,
198,
220,
220,
220,
2579,
14,
2999,
14,
7908,
201,
198,
37811,
201,
198,
201,
198,
6738,
2956,
297,
571,
13,
25927,
1330,
19016,
9654,
201,
198,
11748,
28686,
201,
198,
6738,
33245,
1330,
2750,
4879,
9399,
201,
198,
6738,
19974,
7753,
1330,
38636,
8979,
201,
198,
201,
198,
2,
35613,
29397,
4177,
2849,
25,
201,
198,
14421,
34945,
796,
28686,
13,
1136,
66,
16993,
3419,
201,
198,
87,
1671,
335,
1060,
652,
796,
1459,
34945,
10,
1,
14,
87,
1671,
75,
1,
201,
198,
361,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
87,
1671,
335,
1060,
652,
2599,
28686,
13,
76,
4335,
17062,
7,
87,
1671,
335,
1060,
652,
8,
201,
198,
9945,
796,
1280,
7,
14421,
34945,
10,
1,
14,
40252,
66,
707,
13,
14116,
2430,
81,
11074,
961,
3419,
201,
198,
6759,
8609,
796,
23884,
201,
198,
8516,
796,
20613,
13,
35312,
7203,
59,
77,
4943,
201,
198,
6759,
8609,
14692,
49,
13,
34694,
8973,
796,
23884,
201,
198,
77,
796,
657,
201,
198,
1640,
256,
287,
15274,
58,
15,
4083,
35312,
7,
2430,
38381,
16,
25,
5974,
201,
198,
220,
220,
220,
17593,
14692,
49,
13,
34694,
1,
7131,
77,
60,
796,
256,
201,
198,
220,
220,
220,
299,
28,
77,
10,
16,
201,
198,
4798,
7,
8516,
58,
16,
17241,
32382,
33172,
8516,
58,
16,
4083,
35312,
7,
2430,
4008,
201,
198,
1640,
5752,
287,
15274,
58,
16,
25,
5974,
201,
198,
220,
220,
220,
15180,
796,
5752,
13,
35312,
7,
2430,
8,
201,
198,
220,
220,
220,
4378,
263,
796,
15180,
58,
15,
60,
201,
198,
220,
220,
220,
17593,
58,
83,
15799,
22241,
90,
92,
201,
198,
220,
220,
220,
299,
28,
15,
201,
198,
220,
220,
220,
329,
2685,
287,
15180,
58,
16,
25,
5974,
201,
198,
220,
220,
220,
220,
220,
220,
220,
17593,
58,
83,
15799,
7131,
77,
60,
796,
2685,
201,
198,
220,
220,
220,
220,
220,
220,
220,
299,
28,
77,
10,
16,
201,
198,
201,
198,
2,
41925,
35613,
24890,
25,
201,
198,
260,
4080,
62,
6759,
8609,
796,
17593,
201,
198,
439,
961,
796,
17635,
201,
198,
29522,
796,
1351,
7,
6759,
8609,
13,
13083,
28955,
58,
16,
47715,
201,
198,
77,
28,
11925,
7,
4868,
7,
6759,
8609,
14692,
49,
13,
34694,
1,
4083,
13083,
3419,
4008,
201,
198,
4798,
7,
77,
553,
59,
77,
1600,
29522,
8,
201,
198,
1640,
4283,
287,
14420,
25,
201,
198,
220,
220,
220,
477,
961,
13,
33295,
7,
13578,
8,
201,
198,
220,
220,
220,
329,
285,
287,
2837,
7,
77,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
36120,
546,
43825,
13578,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
27071,
13344,
1,
287,
17593,
58,
13578,
7131,
76,
5974,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
19016,
9654,
7,
6759,
8609,
58,
13578,
7131,
76,
12962,
355,
279,
13344,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
38636,
8979,
7,
45992,
9399,
7,
79,
13344,
13,
961,
3419,
4008,
355,
1976,
79,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2393,
287,
1976,
79,
13,
7402,
46331,
33529,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
7753,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
35,
322,
25138,
25,
43825,
4283,
1343,
45434,
1,
1343,
17593,
14692,
49,
13,
34694,
1,
7131,
76,
60,
1343,
27071,
17752,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
17752,
796,
1280,
7,
87,
1671,
335,
1060,
652,
10,
1,
30487,
1343,
4283,
1343,
45434,
1,
1343,
17593,
14692,
49,
13,
34694,
1,
7131,
76,
60,
1343,
27071,
17752,
1600,
366,
39346,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
17752,
13,
13564,
7,
89,
79,
13,
961,
7,
7753,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
17752,
13,
19836,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
26498,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
22046,
553,
5832,
1392,
23884,
4,
1911,
18982,
7,
11925,
7,
439,
961,
20679,
77,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6036,
8232,
796,
1280,
7,
14421,
34945,
10,
1,
14,
7821,
66,
707,
13,
14116,
1600,
366,
86,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
374,
72,
324,
2127,
68,
287,
477,
961,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6036,
8232,
13,
13564,
7,
21244,
2127,
68,
553,
59,
77,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
477,
961,
28,
21737,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
27071,
17752,
1,
220,
287,
17593,
58,
13578,
7131,
76,
5974,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33918,
6371,
796,
17593,
58,
13578,
7131,
76,
60,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33918,
4363,
796,
19016,
9654,
7,
17752,
6371,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
19016,
9654,
7,
6759,
8609,
58,
13578,
7131,
76,
12962,
355,
279,
17752,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
10002,
278,
1600,
13578,
1343,
45434,
1,
1343,
17593,
14692,
49,
13,
34694,
1,
7131,
76,
60,
1343,
27071,
17752,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
17752,
796,
1280,
7,
87,
1671,
335,
1060,
652,
10,
1,
30487,
1343,
4283,
1343,
45434,
1,
1343,
17593,
14692,
49,
13,
34694,
1,
7131,
76,
60,
1343,
27071,
17752,
1600,
366,
39346,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
17752,
13,
13564,
7,
79,
17752,
13,
961,
28955,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
17752,
13,
19836,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
26498,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
22046,
11,
366,
5832,
1392,
23884,
4,
1911,
18982,
7,
11925,
7,
439,
961,
8,
1220,
299,
27267,
1571,
379,
257,
33918,
2393,
449,
12564,
4944,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6036,
8232,
796,
1280,
7,
14421,
34945,
10,
1,
14,
7821,
66,
707,
13,
14116,
1600,
366,
86,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
374,
72,
324,
2127,
68,
287,
477,
961,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6036,
8232,
13,
13564,
7,
21244,
2127,
68,
11,
37082,
77,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
477,
961,
796,
17635,
201,
198
] | 1.821636 | 1,553 |
import six
from oslo_log import log as logging
from hpedockerplugin.cmd import cmd
from hpedockerplugin import exception
LOG = logging.getLogger(__name__)
| [
11748,
2237,
198,
198,
6738,
28686,
5439,
62,
6404,
1330,
2604,
355,
18931,
198,
198,
6738,
289,
9124,
12721,
33803,
13,
28758,
1330,
23991,
198,
6738,
289,
9124,
12721,
33803,
1330,
6631,
198,
198,
25294,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628
] | 3.382979 | 47 |
input = """
1 2 3 2 3 4 5
1 3 3 2 2 4 5
1 4 3 2 2 3 5
1 5 0 0
5 6 4 3 0 2 3 4 2 2 2
1 1 1 1 6
0
4 c
3 b
2 a
0
B+
0
B-
1
0
1
"""
output = """
INCOHERENT
"""
| [
15414,
796,
37227,
198,
16,
362,
513,
362,
513,
604,
642,
198,
16,
513,
513,
362,
362,
604,
642,
198,
16,
604,
513,
362,
362,
513,
642,
198,
16,
642,
657,
657,
198,
20,
718,
604,
513,
657,
362,
513,
604,
362,
362,
362,
198,
16,
352,
352,
352,
718,
198,
15,
198,
19,
269,
198,
18,
275,
198,
17,
257,
198,
15,
198,
33,
10,
198,
15,
198,
33,
12,
198,
16,
198,
15,
198,
16,
198,
37811,
198,
22915,
796,
37227,
198,
1268,
8220,
16879,
3525,
198,
37811,
198
] | 1.714286 | 91 |
import os
import shutil
import pickle as pkl
import numpy as np
import SimpleITK as sitk
from data_registration import RegHearts
LOAD_DIR = '/pylon5/ac5616p/Data/HeartSegmentationProject/CAP_challenge/CAP_challenge_training_set/test2/brain/total/'
'''
Generator function to get one pair of fixed and moving image at a time
(fixed, moving) are viewed as without order.
(a, b) is the same as (b, a), so (b, a) won't be registered
'''
'''
Register two images and
'''
if __name__ == '__main__':
main()
| [
11748,
28686,
198,
11748,
4423,
346,
198,
11748,
2298,
293,
355,
279,
41582,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
17427,
2043,
42,
355,
1650,
74,
198,
6738,
1366,
62,
2301,
33397,
1330,
3310,
1544,
5889,
198,
198,
35613,
62,
34720,
796,
31051,
79,
15158,
20,
14,
330,
3980,
1433,
79,
14,
6601,
14,
28541,
41030,
14374,
16775,
14,
33177,
62,
36747,
3540,
14,
33177,
62,
36747,
3540,
62,
34409,
62,
2617,
14,
9288,
17,
14,
27825,
14,
23350,
14,
6,
198,
198,
7061,
6,
198,
8645,
1352,
2163,
284,
651,
530,
5166,
286,
5969,
290,
3867,
2939,
379,
257,
640,
198,
7,
34021,
11,
3867,
8,
389,
9569,
355,
1231,
1502,
13,
198,
7,
64,
11,
275,
8,
318,
262,
976,
355,
357,
65,
11,
257,
828,
523,
357,
65,
11,
257,
8,
1839,
470,
307,
6823,
220,
198,
7061,
6,
198,
7061,
6,
198,
38804,
734,
4263,
290,
220,
198,
7061,
6,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.913793 | 174 |
# coding=utf-8
"""
LCD1602 Plugin for Octoprint
"""
from __future__ import absolute_import
from octoprint.printer.estimation import PrintTimeEstimator
import octoprint.plugin
import octoprint.events
from RPLCD.i2c import CharLCD
import time
import datetime
import os
import sys
from fake_rpi import printf
import fake_rpi
__plugin_name__ = "LCD1602 I2c display"
| [
2,
19617,
28,
40477,
12,
23,
198,
198,
37811,
198,
220,
23598,
1433,
2999,
42636,
329,
2556,
404,
22272,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
19318,
404,
22272,
13,
1050,
3849,
13,
395,
18991,
1330,
12578,
7575,
22362,
320,
1352,
198,
11748,
19318,
404,
22272,
13,
33803,
198,
11748,
19318,
404,
22272,
13,
31534,
198,
6738,
25812,
5639,
35,
13,
72,
17,
66,
1330,
3178,
5639,
35,
198,
11748,
640,
198,
11748,
4818,
8079,
198,
11748,
28686,
198,
11748,
25064,
198,
6738,
8390,
62,
81,
14415,
1330,
30812,
198,
11748,
8390,
62,
81,
14415,
628,
628,
628,
198,
198,
834,
33803,
62,
3672,
834,
796,
366,
5639,
35,
1433,
2999,
314,
17,
66,
3359,
1,
198
] | 3.008065 | 124 |
from bangtal import *
import random
import copy
import time
setGameOption(GameOption.INVENTORY_BUTTON, False)
setGameOption(GameOption.MESSAGE_BOX_BUTTON, False)
main_scene = Scene("퍼즐게임", "images/backgroud.PNG")
scene1 = Scene("Loopy 퍼즐", "images/backgroud.PNG")
scene2 = Scene("Lion 퍼즐", "images/backgroud.PNG")
help_message = showMessage("퍼즐 맞출 이미지를 클릭해주세요!!")
images = (
Object('images/loopy.jpg'),
Object('images/lion.jpg'),
Object('images/exit_button.png'),
Object('images/score.jpg'),
Object('images/another.jpg')
)
loopy_image = images[0]
loopy_image.locate(main_scene, 150, 50)
loopy_image.setScale(1.64)
loopy_image.show()
lion_image = images[1]
lion_image.locate(main_scene, 650, 50)
lion_image.setScale(0.7)
lion_image.show()
exit_button = images[2]
exit_button.locate(main_scene, 1150, 650)
exit_button.setScale(0.1)
exit_button.show()
blank = 8
game_board = []
init_board = []
start = 0
max_time = 987654321
loopy_max_score = 0
lion_max_score = 0
delta = [-1, 1, -3, 3]
Object.onMouseActionDefault = onMouseAction_piece
| [
6738,
20188,
39240,
1330,
1635,
201,
198,
201,
198,
11748,
4738,
201,
198,
201,
198,
11748,
4866,
201,
198,
201,
198,
11748,
640,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
2617,
8777,
19722,
7,
8777,
19722,
13,
1268,
53,
3525,
15513,
62,
47526,
11357,
11,
10352,
8,
201,
198,
201,
198,
2617,
8777,
19722,
7,
8777,
19722,
13,
44,
1546,
4090,
8264,
62,
39758,
62,
47526,
11357,
11,
10352,
8,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
12417,
62,
29734,
796,
28315,
7203,
169,
235,
120,
168,
99,
238,
166,
110,
234,
168,
252,
226,
1600,
366,
17566,
14,
1891,
70,
5493,
13,
47,
10503,
4943,
201,
198,
201,
198,
29734,
16,
796,
28315,
7203,
27654,
11081,
220,
169,
235,
120,
168,
99,
238,
1600,
366,
17566,
14,
1891,
70,
5493,
13,
47,
10503,
4943,
201,
198,
201,
198,
29734,
17,
796,
28315,
7203,
43,
295,
220,
169,
235,
120,
168,
99,
238,
1600,
366,
17566,
14,
1891,
70,
5493,
13,
47,
10503,
4943,
201,
198,
201,
198,
220,
201,
198,
201,
198,
16794,
62,
20500,
796,
905,
12837,
7203,
169,
235,
120,
168,
99,
238,
31619,
100,
252,
168,
114,
250,
23821,
251,
112,
167,
107,
116,
168,
100,
222,
167,
98,
120,
220,
169,
223,
112,
167,
99,
255,
47991,
112,
168,
96,
120,
168,
226,
116,
168,
248,
242,
37160,
8,
201,
198,
201,
198,
220,
201,
198,
201,
198,
17566,
796,
357,
201,
198,
201,
198,
220,
220,
220,
9515,
10786,
17566,
14,
5439,
11081,
13,
9479,
33809,
201,
198,
201,
198,
220,
220,
220,
9515,
10786,
17566,
14,
75,
295,
13,
9479,
33809,
201,
198,
201,
198,
220,
220,
220,
9515,
10786,
17566,
14,
37023,
62,
16539,
13,
11134,
33809,
201,
198,
201,
198,
220,
220,
220,
9515,
10786,
17566,
14,
26675,
13,
9479,
33809,
201,
198,
201,
198,
220,
220,
220,
9515,
10786,
17566,
14,
29214,
13,
9479,
11537,
201,
198,
201,
198,
8,
201,
198,
201,
198,
220,
201,
198,
201,
198,
5439,
11081,
62,
9060,
796,
4263,
58,
15,
60,
201,
198,
201,
198,
5439,
11081,
62,
9060,
13,
75,
13369,
7,
12417,
62,
29734,
11,
6640,
11,
2026,
8,
201,
198,
201,
198,
5439,
11081,
62,
9060,
13,
2617,
29990,
7,
16,
13,
2414,
8,
201,
198,
201,
198,
5439,
11081,
62,
9060,
13,
12860,
3419,
201,
198,
201,
198,
220,
201,
198,
201,
198,
75,
295,
62,
9060,
796,
4263,
58,
16,
60,
201,
198,
201,
198,
75,
295,
62,
9060,
13,
75,
13369,
7,
12417,
62,
29734,
11,
22626,
11,
2026,
8,
201,
198,
201,
198,
75,
295,
62,
9060,
13,
2617,
29990,
7,
15,
13,
22,
8,
201,
198,
201,
198,
75,
295,
62,
9060,
13,
12860,
3419,
201,
198,
201,
198,
220,
201,
198,
201,
198,
37023,
62,
16539,
796,
4263,
58,
17,
60,
201,
198,
201,
198,
37023,
62,
16539,
13,
75,
13369,
7,
12417,
62,
29734,
11,
1367,
1120,
11,
22626,
8,
201,
198,
201,
198,
37023,
62,
16539,
13,
2617,
29990,
7,
15,
13,
16,
8,
201,
198,
201,
198,
37023,
62,
16539,
13,
12860,
3419,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
27190,
796,
807,
201,
198,
201,
198,
6057,
62,
3526,
796,
17635,
201,
198,
201,
198,
15003,
62,
3526,
796,
17635,
201,
198,
201,
198,
9688,
796,
657,
201,
198,
201,
198,
9806,
62,
2435,
796,
860,
5774,
2996,
3559,
2481,
201,
198,
201,
198,
5439,
11081,
62,
9806,
62,
26675,
796,
657,
201,
198,
201,
198,
75,
295,
62,
9806,
62,
26675,
796,
657,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
67,
12514,
796,
25915,
16,
11,
352,
11,
532,
18,
11,
513,
60,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
220,
201,
198,
201,
198,
10267,
13,
261,
39643,
12502,
19463,
796,
319,
39643,
12502,
62,
12239,
201,
198
] | 1.790476 | 735 |
import sys
if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
from . import (
cpu,
devices,
gpu,
memory,
)
__all__ = (
"cpu",
"devices",
"gpu",
"installed_plugins",
"memory",
)
installed_plugins = entry_points(group=__name__)
| [
11748,
25064,
198,
198,
361,
25064,
13,
9641,
62,
10951,
1279,
357,
18,
11,
838,
2599,
198,
220,
220,
220,
422,
1330,
8019,
62,
38993,
1330,
5726,
62,
13033,
198,
17772,
25,
198,
220,
220,
220,
422,
1330,
8019,
13,
38993,
1330,
5726,
62,
13033,
198,
198,
6738,
764,
1330,
357,
198,
220,
220,
220,
42804,
11,
198,
220,
220,
220,
4410,
11,
198,
220,
220,
220,
308,
19944,
11,
198,
220,
220,
220,
4088,
11,
198,
8,
198,
198,
834,
439,
834,
796,
357,
198,
220,
220,
220,
366,
36166,
1600,
198,
220,
220,
220,
366,
42034,
1600,
198,
220,
220,
220,
366,
46999,
1600,
198,
220,
220,
220,
366,
37050,
62,
37390,
1600,
198,
220,
220,
220,
366,
31673,
1600,
198,
8,
628,
198,
37050,
62,
37390,
796,
5726,
62,
13033,
7,
8094,
28,
834,
3672,
834,
8,
198
] | 2.475177 | 141 |
from __future__ import annotations
import typing
import torch
from torch.utils.data import DataLoader
import pytorch_lightning as pl
from pltools.config import Config
transform_type = typing.Iterable[typing.Callable]
| [
6738,
11593,
37443,
834,
1330,
37647,
628,
198,
11748,
19720,
198,
11748,
28034,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
17401,
198,
11748,
12972,
13165,
354,
62,
2971,
768,
355,
458,
198,
198,
6738,
458,
31391,
13,
11250,
1330,
17056,
198,
198,
35636,
62,
4906,
796,
19720,
13,
29993,
540,
58,
774,
13886,
13,
14134,
540,
60,
628,
198
] | 3.655738 | 61 |
# coding: utf-8
from datetime import timedelta
from helpers import make_record
def day_fill(data, fill_value=None):
"""Given a data set with missing day values sorted by day, adds records
with value of `fill_value`
"""
return generic_day_fill(1, data, fill_value)
def week_fill(data, fill_value=None):
"""Given a sorted data set with missing week keys, adds records with
value of `fill_value`
"""
return generic_day_fill(7, data, fill_value)
| [
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
6738,
4818,
8079,
1330,
28805,
12514,
198,
6738,
49385,
1330,
787,
62,
22105,
628,
198,
4299,
1110,
62,
20797,
7,
7890,
11,
6070,
62,
8367,
28,
14202,
2599,
198,
220,
220,
220,
37227,
15056,
257,
1366,
900,
351,
4814,
1110,
3815,
23243,
416,
1110,
11,
6673,
4406,
198,
220,
220,
220,
351,
1988,
286,
4600,
20797,
62,
8367,
63,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
14276,
62,
820,
62,
20797,
7,
16,
11,
1366,
11,
6070,
62,
8367,
8,
628,
198,
4299,
1285,
62,
20797,
7,
7890,
11,
6070,
62,
8367,
28,
14202,
2599,
198,
220,
220,
220,
37227,
15056,
257,
23243,
1366,
900,
351,
4814,
1285,
8251,
11,
6673,
4406,
351,
198,
220,
220,
220,
1988,
286,
4600,
20797,
62,
8367,
63,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
14276,
62,
820,
62,
20797,
7,
22,
11,
1366,
11,
6070,
62,
8367,
8,
628
] | 2.981366 | 161 |
from Foundation import NSObject
from objc import *
from AppKit import NSBezierPath
from fieldMath import *
#____________________________________________________________
| [
6738,
5693,
1330,
10896,
10267,
198,
6738,
26181,
66,
1330,
1635,
198,
6738,
2034,
20827,
1330,
10896,
3856,
89,
959,
15235,
198,
198,
6738,
2214,
37372,
1330,
1635,
198,
198,
2,
10221,
32941,
1427,
628
] | 4.914286 | 35 |
from __future__ import division as division
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import field
import traceray
import surface
import cal_tools
# test ray.py and traceray.py
# define rays
l1 = np.linspace(-5,5,10)
Pos1 = []
for i in l1:
for j in l1:
if i**2+j**2<25:
Pos1.append([i,j,0])
KLM = []
for i in Pos1:
KLM.append([0,0,1])
# define surface
surface1 = surface.Surface(number=1,radius = 10000000, thickness = 10, index = 1,STO=0) #object
surface2 = surface.Surface(number=2,radius = 20, thickness = 40, index = 2,STO=0) #surface i
surface3 = surface.Surface(number=3,radius = 10000000, thickness = 0, index = 1,STO=0) #image
raylist1 = []
raylist2 = []
for pos,klm in zip(Pos1,KLM):
ray1 = field.Field(Pos = pos, KLM = klm)
raylist1.append(ray1)
Pos_new_list,KLM_new_list = traceray.trace(raylist1,surface1,surface2)
x = []
y = []
z = []
for i in Pos_new_list:
x.append(i[0])
y.append(i[1])
z.append(i[2])
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x, z, y)
ax.set_xlim3d(-6, 6)
ax.set_ylim3d(-6, 6)
ax.set_zlim3d(-6, 6)
plt.show()
for pos,klm in zip(Pos_new_list,KLM_new_list):
ray2 = field.Field(Pos = pos, KLM = klm)
raylist2.append(ray2)
Pos_new_list1,KLM_new_list1 = traceray.trace(raylist2, surface2, surface3)
x2 = []
y2 = []
z2 = []
for i in Pos_new_list1:
x2.append(i[0])
y2.append(i[1])
z2.append(i[2])
fig = plt.figure()
plt.plot(x2,y2,'b*')
plt.show()
rms = cal_tools.rms(Pos_new_list1)
print rms
| [
6738,
11593,
37443,
834,
1330,
7297,
355,
7297,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
285,
489,
62,
25981,
74,
896,
13,
76,
29487,
18,
67,
1330,
12176,
274,
18,
35,
198,
11748,
2214,
198,
11748,
491,
11736,
323,
198,
11748,
4417,
198,
11748,
2386,
62,
31391,
198,
2,
1332,
26842,
13,
9078,
290,
491,
11736,
323,
13,
9078,
198,
197,
197,
198,
198,
2,
8160,
24823,
198,
75,
16,
796,
45941,
13,
21602,
10223,
32590,
20,
11,
20,
11,
940,
8,
198,
21604,
16,
796,
17635,
198,
1640,
1312,
287,
300,
16,
25,
198,
197,
1640,
474,
287,
300,
16,
25,
198,
197,
197,
361,
1312,
1174,
17,
10,
73,
1174,
17,
27,
1495,
25,
198,
197,
197,
197,
21604,
16,
13,
33295,
26933,
72,
11,
73,
11,
15,
12962,
198,
42,
31288,
796,
17635,
198,
1640,
1312,
287,
18574,
16,
25,
198,
197,
42,
31288,
13,
33295,
26933,
15,
11,
15,
11,
16,
12962,
198,
198,
2,
8160,
4417,
198,
42029,
16,
796,
4417,
13,
14214,
2550,
7,
17618,
28,
16,
11,
42172,
796,
1802,
20483,
11,
20735,
796,
838,
11,
6376,
796,
352,
11,
2257,
46,
28,
15,
8,
1303,
15252,
198,
42029,
17,
796,
4417,
13,
14214,
2550,
7,
17618,
28,
17,
11,
42172,
796,
1160,
11,
20735,
796,
2319,
11,
6376,
796,
362,
11,
2257,
46,
28,
15,
8,
220,
1303,
42029,
1312,
198,
42029,
18,
796,
4417,
13,
14214,
2550,
7,
17618,
28,
18,
11,
42172,
796,
1802,
20483,
11,
20735,
796,
657,
11,
6376,
796,
352,
11,
2257,
46,
28,
15,
8,
1303,
9060,
198,
198,
2433,
4868,
16,
796,
17635,
198,
2433,
4868,
17,
796,
17635,
198,
198,
1640,
1426,
11,
41582,
76,
287,
19974,
7,
21604,
16,
11,
42,
31288,
2599,
198,
197,
197,
2433,
16,
796,
2214,
13,
15878,
7,
21604,
796,
1426,
11,
509,
31288,
796,
479,
75,
76,
8,
220,
198,
197,
197,
2433,
4868,
16,
13,
33295,
7,
2433,
16,
8,
198,
197,
197,
198,
21604,
62,
3605,
62,
4868,
11,
42,
31288,
62,
3605,
62,
4868,
796,
491,
11736,
323,
13,
40546,
7,
2433,
4868,
16,
11,
42029,
16,
11,
42029,
17,
8,
628,
198,
87,
796,
17635,
198,
88,
796,
17635,
198,
89,
796,
17635,
198,
1640,
1312,
287,
18574,
62,
3605,
62,
4868,
25,
198,
197,
87,
13,
33295,
7,
72,
58,
15,
12962,
198,
197,
88,
13,
33295,
7,
72,
58,
16,
12962,
198,
197,
89,
13,
33295,
7,
72,
58,
17,
12962,
198,
197,
198,
5647,
796,
458,
83,
13,
26875,
3419,
198,
897,
796,
2336,
13,
2860,
62,
7266,
29487,
7,
16243,
11,
20128,
11639,
18,
67,
11537,
198,
897,
13,
1416,
1436,
7,
87,
11,
1976,
11,
331,
8,
198,
897,
13,
2617,
62,
87,
2475,
18,
67,
32590,
21,
11,
718,
8,
198,
897,
13,
2617,
62,
88,
2475,
18,
67,
32590,
21,
11,
718,
8,
198,
897,
13,
2617,
62,
89,
2475,
18,
67,
32590,
21,
11,
718,
8,
198,
489,
83,
13,
12860,
3419,
628,
198,
1640,
1426,
11,
41582,
76,
287,
19974,
7,
21604,
62,
3605,
62,
4868,
11,
42,
31288,
62,
3605,
62,
4868,
2599,
198,
197,
197,
2433,
17,
796,
2214,
13,
15878,
7,
21604,
796,
1426,
11,
509,
31288,
796,
479,
75,
76,
8,
220,
198,
197,
197,
2433,
4868,
17,
13,
33295,
7,
2433,
17,
8,
628,
198,
21604,
62,
3605,
62,
4868,
16,
11,
42,
31288,
62,
3605,
62,
4868,
16,
796,
491,
11736,
323,
13,
40546,
7,
2433,
4868,
17,
11,
4417,
17,
11,
4417,
18,
8,
198,
198,
87,
17,
796,
17635,
198,
88,
17,
796,
17635,
198,
89,
17,
796,
17635,
198,
1640,
1312,
287,
18574,
62,
3605,
62,
4868,
16,
25,
198,
197,
87,
17,
13,
33295,
7,
72,
58,
15,
12962,
198,
197,
88,
17,
13,
33295,
7,
72,
58,
16,
12962,
198,
197,
89,
17,
13,
33295,
7,
72,
58,
17,
12962,
198,
198,
5647,
796,
458,
83,
13,
26875,
3419,
198,
489,
83,
13,
29487,
7,
87,
17,
11,
88,
17,
4032,
65,
9,
11537,
198,
489,
83,
13,
12860,
3419,
628,
198,
198,
81,
907,
796,
2386,
62,
31391,
13,
81,
907,
7,
21604,
62,
3605,
62,
4868,
16,
8,
198,
4798,
374,
907,
628,
628,
197
] | 2.163408 | 716 |
# -*- coding: utf-8 -*-
from unittest import TestCase, main
from recc.mime.mime_codec_register import get_global_mime_register
if __name__ == "__main__":
main()
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
555,
715,
395,
1330,
6208,
20448,
11,
1388,
198,
6738,
302,
535,
13,
76,
524,
13,
76,
524,
62,
19815,
721,
62,
30238,
1330,
651,
62,
20541,
62,
76,
524,
62,
30238,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.5 | 68 |
#!/usr/bin/env python3.7
import sys
import json
import signal
import urllib.request as urllib
import threading
import pyperclip
import time
if __name__ == '__main__':
exitflag = False
try:
signal.signal(signal.SIGINT, quit)
signal.signal(signal.SIGTERM, quit)
thread1 = Clipboard()
thread2 = Outinput()
thread1.setDaemon(True)
thread1.start()
thread2.setDaemon(True)
thread2.start()
thread1.join()
thread2.join()
print("bye!!")
except:
print()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
13,
22,
198,
198,
11748,
25064,
198,
11748,
33918,
198,
11748,
6737,
198,
11748,
2956,
297,
571,
13,
25927,
355,
2956,
297,
571,
198,
11748,
4704,
278,
198,
11748,
12972,
525,
15036,
198,
11748,
640,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
8420,
32109,
796,
10352,
628,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6737,
13,
12683,
282,
7,
12683,
282,
13,
50,
3528,
12394,
11,
11238,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6737,
13,
12683,
282,
7,
12683,
282,
13,
50,
3528,
5781,
44,
11,
11238,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
16,
796,
42512,
3526,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
17,
796,
3806,
15414,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
4704,
16,
13,
2617,
26531,
7966,
7,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
16,
13,
9688,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
4704,
17,
13,
2617,
26531,
7966,
7,
17821,
8,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
17,
13,
9688,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
16,
13,
22179,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
17,
13,
22179,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
16390,
37160,
8,
198,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
3419,
198
] | 2.060071 | 283 |
# -*- coding: utf-8 -*-
#Search Wikipedia for Heart Attack
import wikipedia, codecs, itertools, os, time
from pprint import pprint
relevant_categories = {'medical','emergencies','disease'}
conditions = ["heart attack","palpitations"] #Search all related pages?
make_filename = lambda aStr: aStr.replace(' ','_')
for condition in conditions:
findRelevantArticles(condition,data_path=os.path.join('./data/wikipedia',make_filename(condition)))
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
18243,
15312,
329,
8894,
8307,
198,
11748,
47145,
11151,
11,
40481,
82,
11,
340,
861,
10141,
11,
28686,
11,
640,
198,
6738,
279,
4798,
1330,
279,
4798,
198,
198,
49659,
62,
66,
26129,
796,
1391,
6,
41693,
41707,
368,
6422,
3976,
41707,
67,
786,
589,
6,
92,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
17561,
1756,
796,
14631,
11499,
1368,
2430,
18596,
15544,
602,
8973,
1303,
18243,
477,
3519,
5468,
30,
198,
15883,
62,
34345,
796,
37456,
257,
13290,
25,
257,
13290,
13,
33491,
10786,
705,
4032,
62,
11537,
220,
198,
1640,
4006,
287,
3403,
25,
198,
220,
220,
220,
1064,
3041,
14938,
8001,
2983,
7,
31448,
11,
7890,
62,
6978,
28,
418,
13,
6978,
13,
22179,
7,
4458,
14,
7890,
14,
31266,
3256,
15883,
62,
34345,
7,
31448,
22305,
198
] | 3.060403 | 149 |
from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from datetime import datetime, timedelta
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template import Context
from django.template.loader import render_to_string
import random
import string
import requests
import json
from donor.models import DonorDetail as DD, NewDonor as ND
from recipient.models import RecipientDetail as RD
from .models import AccountPath as AP
# Create your views here.
@login_required(login_url='/accounts')
#================= FUCTIONS =================# | [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
8323,
5344,
11,
17594,
11,
2604,
448,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
7738,
1060,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
9575,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
12501,
273,
2024,
1330,
17594,
62,
35827,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
220,
198,
6738,
42625,
14208,
13,
7295,
13,
4529,
1330,
9570,
29800,
23081,
2929,
198,
6738,
42625,
14208,
13,
28243,
1330,
30532,
198,
6738,
42625,
14208,
13,
28243,
13,
29356,
1330,
8543,
62,
1462,
62,
8841,
628,
198,
11748,
4738,
198,
11748,
4731,
198,
198,
11748,
7007,
198,
11748,
33918,
198,
198,
6738,
17052,
13,
27530,
1330,
2094,
273,
11242,
603,
355,
20084,
11,
968,
3987,
273,
355,
25524,
198,
6738,
17800,
13,
27530,
1330,
3311,
48137,
11242,
603,
355,
31475,
198,
6738,
764,
27530,
1330,
10781,
15235,
355,
3486,
198,
198,
2,
13610,
534,
5009,
994,
13,
628,
628,
628,
628,
198,
198,
31,
38235,
62,
35827,
7,
38235,
62,
6371,
11639,
14,
23317,
82,
11537,
628,
198,
2,
4770,
28,
376,
18415,
11053,
36658,
2
] | 3.714932 | 221 |
import random, math
N = 16
eta = 0.26
sigma = math.sqrt(eta / N / math.pi)
n_runs = 100
print 'Note that this program might take a while!'
for run in range(n_runs):
iterations, config = direct_disks(N, sigma)
print 'run',run
print iterations - 1, 'tabula rasa wipe-outs before producing the following configuration'
print config
print
| [
11748,
4738,
11,
10688,
198,
198,
45,
796,
1467,
198,
17167,
796,
657,
13,
2075,
198,
82,
13495,
796,
10688,
13,
31166,
17034,
7,
17167,
1220,
399,
1220,
10688,
13,
14415,
8,
198,
77,
62,
48381,
796,
1802,
198,
4798,
705,
6425,
326,
428,
1430,
1244,
1011,
257,
981,
13679,
198,
1640,
1057,
287,
2837,
7,
77,
62,
48381,
2599,
198,
220,
220,
220,
34820,
11,
4566,
796,
220,
1277,
62,
6381,
591,
7,
45,
11,
264,
13495,
8,
198,
220,
220,
220,
3601,
705,
5143,
3256,
5143,
198,
220,
220,
220,
3601,
34820,
532,
352,
11,
705,
8658,
4712,
374,
15462,
19916,
12,
5269,
878,
9194,
262,
1708,
8398,
6,
198,
220,
220,
220,
3601,
4566,
198,
220,
220,
220,
3601,
628
] | 2.910569 | 123 |
import re
template = r"[a-zA-Z]"
username = input()
match = re.match(template, username)
if match:
print("Thank you!")
else:
print("Oops! The username has to start with a letter.")
| [
11748,
302,
198,
198,
28243,
796,
374,
17912,
64,
12,
89,
32,
12,
57,
30866,
198,
29460,
796,
5128,
3419,
198,
15699,
796,
302,
13,
15699,
7,
28243,
11,
20579,
8,
198,
361,
2872,
25,
198,
220,
220,
220,
3601,
7203,
10449,
345,
2474,
8,
198,
17772,
25,
198,
220,
220,
220,
3601,
7203,
46,
2840,
0,
383,
20579,
468,
284,
923,
351,
257,
3850,
19570,
198
] | 2.835821 | 67 |
import argparse
import numpy as np
if __name__ == '__main__':
main()
| [
11748,
1822,
29572,
198,
11748,
299,
32152,
355,
45941,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.655172 | 29 |
# -*- coding: utf-8 -*-
import os
import sys
import signal
import inspect
from qtpy.QtCore import QObject, Slot
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
6737,
198,
11748,
10104,
198,
198,
6738,
10662,
83,
9078,
13,
48,
83,
14055,
1330,
1195,
10267,
11,
32026,
628
] | 2.780488 | 41 |
"""
Author: David Walshe
Date: 08 April 2021
"""
import logging
from tabulate import tabulate
from sla_cli.src.db.accessors.base import Accessor
logger = logging.getLogger(__name__)
| [
37811,
198,
13838,
25,
220,
220,
220,
220,
3271,
370,
874,
258,
198,
10430,
25,
220,
220,
220,
220,
220,
220,
8487,
3035,
33448,
198,
37811,
198,
198,
11748,
18931,
198,
198,
6738,
7400,
5039,
1330,
7400,
5039,
198,
198,
6738,
1017,
64,
62,
44506,
13,
10677,
13,
9945,
13,
15526,
669,
13,
8692,
1330,
8798,
273,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628
] | 2.69863 | 73 |
from collections import OrderedDict
import pandas as pd
import numpy as np
from tia.util.decorator import lazy_property
from tia.analysis.model.interface import TxnPlColumns as TPL
from tia.analysis.perf import drawdown_info, drawdowns, guess_freq, downside_deviation, periodicity
from tia.analysis.plots import plot_return_on_dollar
from tia.util.mplot import AxesFormat
from tia.util.fmt import PercentFormatter, new_percent_formatter, new_float_formatter
__all__ = ['RoiiRetCalculator', 'AumRetCalculator', 'FixedAumRetCalculator', 'CumulativeRets', 'Performance']
def return_on_initial_capital(capital, period_pl, leverage=None):
"""Return the daily return series based on the capital"""
if capital <= 0:
raise ValueError('cost must be a positive number not %s' % capital)
leverage = leverage or 1.
eod = capital + (leverage * period_pl.cumsum())
ltd_rets = (eod / capital) - 1.
dly_rets = ltd_rets
dly_rets.iloc[1:] = (1. + ltd_rets).pct_change().iloc[1:]
return dly_rets
| [
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
256,
544,
13,
22602,
13,
12501,
273,
1352,
1330,
16931,
62,
26745,
198,
6738,
256,
544,
13,
20930,
13,
19849,
13,
39994,
1330,
309,
87,
77,
3646,
39470,
82,
355,
309,
6489,
198,
6738,
256,
544,
13,
20930,
13,
525,
69,
1330,
3197,
2902,
62,
10951,
11,
3197,
30371,
11,
4724,
62,
19503,
80,
11,
25320,
62,
7959,
3920,
11,
2278,
8467,
198,
6738,
256,
544,
13,
20930,
13,
489,
1747,
1330,
7110,
62,
7783,
62,
261,
62,
22569,
198,
6738,
256,
544,
13,
22602,
13,
76,
29487,
1330,
12176,
274,
26227,
198,
6738,
256,
544,
13,
22602,
13,
69,
16762,
1330,
22512,
8479,
1436,
11,
649,
62,
25067,
62,
687,
1436,
11,
649,
62,
22468,
62,
687,
1436,
628,
198,
834,
439,
834,
796,
37250,
15450,
4178,
9781,
9771,
3129,
1352,
3256,
705,
32,
388,
9781,
9771,
3129,
1352,
3256,
705,
13715,
32,
388,
9781,
9771,
3129,
1352,
3256,
705,
34,
388,
13628,
49,
1039,
3256,
705,
32273,
20520,
628,
198,
4299,
1441,
62,
261,
62,
36733,
62,
27544,
7,
27544,
11,
2278,
62,
489,
11,
16094,
28,
14202,
2599,
198,
220,
220,
220,
37227,
13615,
262,
4445,
1441,
2168,
1912,
319,
262,
3139,
37811,
198,
220,
220,
220,
611,
3139,
19841,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
15805,
1276,
307,
257,
3967,
1271,
407,
4064,
82,
6,
4064,
3139,
8,
198,
220,
220,
220,
16094,
796,
16094,
393,
352,
13,
198,
220,
220,
220,
304,
375,
796,
3139,
1343,
357,
293,
1857,
1635,
2278,
62,
489,
13,
66,
5700,
388,
28955,
198,
220,
220,
220,
300,
8671,
62,
8004,
796,
357,
68,
375,
1220,
3139,
8,
532,
352,
13,
198,
220,
220,
220,
288,
306,
62,
8004,
796,
300,
8671,
62,
8004,
198,
220,
220,
220,
288,
306,
62,
8004,
13,
346,
420,
58,
16,
47715,
796,
357,
16,
13,
1343,
300,
8671,
62,
8004,
737,
79,
310,
62,
3803,
22446,
346,
420,
58,
16,
47715,
198,
220,
220,
220,
1441,
288,
306,
62,
8004,
628,
628,
628,
198
] | 2.834711 | 363 |
# noinspection PyUnusedLocal
# friend_name = unicode string
#print(hello("Mike"))
| [
201,
198,
201,
198,
2,
645,
1040,
14978,
9485,
3118,
1484,
14565,
201,
198,
2,
1545,
62,
3672,
796,
28000,
1098,
4731,
201,
198,
201,
198,
2,
4798,
7,
31373,
7203,
16073,
48774,
201,
198
] | 2.6 | 35 |
import numpy
# Remark:
# Real FFT with even n is faster than real FFT with odd n.
# I do not know why.
def realfft_col(a_mat):
'''
Real Fast Fourier Transform (FFT) Independently Applied to Each Column of A
Input
a_mat: n-by-d dense NumPy matrix.
Output
c_mat: n-by-d matrix C = F * A.
Here F is the n-by-n orthogonal real FFT matrix (not explicitly formed)
Notice that $C^T * C = A^T * A$;
however, $C * C^T = A * A^T$ is not true.
'''
n_int = a_mat.shape[0]
fft_mat = numpy.fft.fft(a_mat, n=None, axis=0) / numpy.sqrt(n_int)
if n_int % 2 == 1:
cutoff_int = int((n_int+1) / 2)
idx_real_vec = list(range(1, cutoff_int))
idx_imag_vec = list(range(cutoff_int, n_int))
else:
cutoff_int = int(n_int/2)
idx_real_vec = list(range(1, cutoff_int))
idx_imag_vec = list(range(cutoff_int+1, n_int))
c_mat = fft_mat.real
c_mat[idx_real_vec, :] *= numpy.sqrt(2)
c_mat[idx_imag_vec, :] = fft_mat[idx_imag_vec, :].imag * numpy.sqrt(2)
return c_mat
def realfft_row(a_mat):
'''
Real Fast Fourier Transform (FFT) Independently Applied to Each Row of A
Input
a_mat: m-by-n dense NumPy matrix.
Output
c_mat: m-by-n matrix C = A * F.
Here F is the n-by-n orthogonal real FFT matrix (not explicitly formed)
Notice that $C * C^T = A * A^T$;
however, $C^T * C = A^T * A$ is not true.
'''
n_int = a_mat.shape[1]
fft_mat = numpy.fft.fft(a_mat, n=None, axis=1) / numpy.sqrt(n_int)
if n_int % 2 == 1:
cutoff_int = int((n_int+1) / 2)
idx_real_vec = list(range(1, cutoff_int))
idx_imag_vec = list(range(cutoff_int, n_int))
else:
cutoff_int = int(n_int/2)
idx_real_vec = list(range(1, cutoff_int))
idx_imag_vec = list(range(cutoff_int+1, n_int))
c_mat = fft_mat.real
c_mat[:, idx_real_vec] *= numpy.sqrt(2)
c_mat[:, idx_imag_vec] = fft_mat[:, idx_imag_vec].imag * numpy.sqrt(2)
return c_mat
def srft(a_mat, s_int):
'''
Subsampled Randomized Fourier Transform (SRFT) for Dense Matrix
Input
a_mat: m-by-n dense NumPy matrix;
s_int: sketch size.
Output
c_mat: m-by-s sketch C = A * S.
Here S is the sketching matrix (not explicitly formed)
'''
n_int = a_mat.shape[1]
sign_vec = numpy.random.choice(2, n_int) * 2 - 1
idx_vec = numpy.random.choice(n_int, s_int, replace=False)
a_mat = a_mat * sign_vec.reshape(1, n_int)
a_mat = realfft_row(a_mat)
c_mat = a_mat[:, idx_vec] * numpy.sqrt(n_int / s_int)
return c_mat
def srft2(a_mat, b_mat, s_int):
'''
Subsampled Randomized Fourier Transform (SRFT) for Dense Matrix
Input
a_mat: m-by-n dense NumPy matrix;
b_mat: d-by-n dense NumPy matrix;
s_int: sketch size.
Output
c_mat: m-by-s sketch C = A * S;
d_mat: d-by-s sketch D = B * S.
Here S is the sketching matrix (not explicitly formed)
'''
n_int = a_mat.shape[1]
sign_vec = numpy.random.choice(2, n_int) * 2 - 1
idx_vec = numpy.random.choice(n_int, s_int, replace=False)
a_mat = a_mat * sign_vec.reshape(1, n_int)
a_mat = realfft_row(a_mat)
c_mat = a_mat[:, idx_vec] * numpy.sqrt(n_int / s_int)
b_mat = b_mat * sign_vec.reshape(1, n_int)
b_mat = realfft_row(b_mat)
d_mat = b_mat[:, idx_vec] * numpy.sqrt(n_int / s_int)
return c_mat, d_mat
| [
11748,
299,
32152,
198,
198,
2,
3982,
668,
25,
198,
2,
220,
220,
6416,
376,
9792,
351,
772,
299,
318,
5443,
621,
1103,
376,
9792,
351,
5629,
299,
13,
198,
2,
220,
220,
314,
466,
407,
760,
1521,
13,
198,
198,
4299,
1103,
487,
83,
62,
4033,
7,
64,
62,
6759,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
6416,
12549,
34296,
5277,
26981,
357,
5777,
51,
8,
1423,
2690,
1473,
27684,
284,
5501,
29201,
286,
317,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
198,
220,
220,
220,
220,
220,
220,
220,
257,
62,
6759,
25,
299,
12,
1525,
12,
67,
15715,
31835,
20519,
17593,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
198,
220,
220,
220,
220,
220,
220,
220,
269,
62,
6759,
25,
299,
12,
1525,
12,
67,
17593,
327,
796,
376,
1635,
317,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3423,
376,
318,
262,
299,
12,
1525,
12,
77,
29617,
519,
20996,
1103,
376,
9792,
17593,
357,
1662,
11777,
7042,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
17641,
326,
720,
34,
61,
51,
1635,
327,
796,
317,
61,
51,
1635,
317,
3,
26,
220,
198,
220,
220,
220,
2158,
11,
720,
34,
1635,
327,
61,
51,
796,
317,
1635,
317,
61,
51,
3,
318,
407,
2081,
13,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
299,
62,
600,
796,
257,
62,
6759,
13,
43358,
58,
15,
60,
198,
220,
220,
220,
277,
701,
62,
6759,
796,
299,
32152,
13,
487,
83,
13,
487,
83,
7,
64,
62,
6759,
11,
299,
28,
14202,
11,
16488,
28,
15,
8,
1220,
299,
32152,
13,
31166,
17034,
7,
77,
62,
600,
8,
198,
220,
220,
220,
611,
299,
62,
600,
4064,
362,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
45616,
62,
600,
796,
493,
19510,
77,
62,
600,
10,
16,
8,
1220,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
5305,
62,
35138,
796,
1351,
7,
9521,
7,
16,
11,
45616,
62,
600,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
48466,
62,
35138,
796,
1351,
7,
9521,
7,
8968,
2364,
62,
600,
11,
299,
62,
600,
4008,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
45616,
62,
600,
796,
493,
7,
77,
62,
600,
14,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
5305,
62,
35138,
796,
1351,
7,
9521,
7,
16,
11,
45616,
62,
600,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
48466,
62,
35138,
796,
1351,
7,
9521,
7,
8968,
2364,
62,
600,
10,
16,
11,
299,
62,
600,
4008,
198,
220,
220,
220,
269,
62,
6759,
796,
277,
701,
62,
6759,
13,
5305,
198,
220,
220,
220,
269,
62,
6759,
58,
312,
87,
62,
5305,
62,
35138,
11,
1058,
60,
1635,
28,
299,
32152,
13,
31166,
17034,
7,
17,
8,
198,
220,
220,
220,
269,
62,
6759,
58,
312,
87,
62,
48466,
62,
35138,
11,
1058,
60,
796,
277,
701,
62,
6759,
58,
312,
87,
62,
48466,
62,
35138,
11,
1058,
4083,
48466,
1635,
299,
32152,
13,
31166,
17034,
7,
17,
8,
198,
220,
220,
220,
1441,
269,
62,
6759,
628,
198,
4299,
1103,
487,
83,
62,
808,
7,
64,
62,
6759,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
6416,
12549,
34296,
5277,
26981,
357,
5777,
51,
8,
1423,
2690,
1473,
27684,
284,
5501,
11314,
286,
317,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
198,
220,
220,
220,
220,
220,
220,
220,
257,
62,
6759,
25,
285,
12,
1525,
12,
77,
15715,
31835,
20519,
17593,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
198,
220,
220,
220,
220,
220,
220,
220,
269,
62,
6759,
25,
285,
12,
1525,
12,
77,
17593,
327,
796,
317,
1635,
376,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3423,
376,
318,
262,
299,
12,
1525,
12,
77,
29617,
519,
20996,
1103,
376,
9792,
17593,
357,
1662,
11777,
7042,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
17641,
326,
720,
34,
1635,
327,
61,
51,
796,
317,
1635,
317,
61,
51,
3,
26,
220,
198,
220,
220,
220,
2158,
11,
720,
34,
61,
51,
1635,
327,
796,
317,
61,
51,
1635,
317,
3,
318,
407,
2081,
13,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
299,
62,
600,
796,
257,
62,
6759,
13,
43358,
58,
16,
60,
198,
220,
220,
220,
277,
701,
62,
6759,
796,
299,
32152,
13,
487,
83,
13,
487,
83,
7,
64,
62,
6759,
11,
299,
28,
14202,
11,
16488,
28,
16,
8,
1220,
299,
32152,
13,
31166,
17034,
7,
77,
62,
600,
8,
198,
220,
220,
220,
611,
299,
62,
600,
4064,
362,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
45616,
62,
600,
796,
493,
19510,
77,
62,
600,
10,
16,
8,
1220,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
5305,
62,
35138,
796,
1351,
7,
9521,
7,
16,
11,
45616,
62,
600,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
48466,
62,
35138,
796,
1351,
7,
9521,
7,
8968,
2364,
62,
600,
11,
299,
62,
600,
4008,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
45616,
62,
600,
796,
493,
7,
77,
62,
600,
14,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
5305,
62,
35138,
796,
1351,
7,
9521,
7,
16,
11,
45616,
62,
600,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
62,
48466,
62,
35138,
796,
1351,
7,
9521,
7,
8968,
2364,
62,
600,
10,
16,
11,
299,
62,
600,
4008,
198,
220,
220,
220,
269,
62,
6759,
796,
277,
701,
62,
6759,
13,
5305,
198,
220,
220,
220,
269,
62,
6759,
58,
45299,
4686,
87,
62,
5305,
62,
35138,
60,
1635,
28,
299,
32152,
13,
31166,
17034,
7,
17,
8,
198,
220,
220,
220,
269,
62,
6759,
58,
45299,
4686,
87,
62,
48466,
62,
35138,
60,
796,
277,
701,
62,
6759,
58,
45299,
4686,
87,
62,
48466,
62,
35138,
4083,
48466,
1635,
299,
32152,
13,
31166,
17034,
7,
17,
8,
198,
220,
220,
220,
1441,
269,
62,
6759,
628,
220,
220,
220,
220,
198,
4299,
19677,
701,
7,
64,
62,
6759,
11,
264,
62,
600,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3834,
37687,
10137,
14534,
1143,
34296,
5277,
26981,
357,
12562,
9792,
8,
329,
360,
1072,
24936,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
198,
220,
220,
220,
220,
220,
220,
220,
257,
62,
6759,
25,
285,
12,
1525,
12,
77,
15715,
31835,
20519,
17593,
26,
198,
220,
220,
220,
220,
220,
220,
220,
264,
62,
600,
25,
17548,
2546,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
198,
220,
220,
220,
220,
220,
220,
220,
269,
62,
6759,
25,
285,
12,
1525,
12,
82,
17548,
327,
796,
317,
1635,
311,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3423,
311,
318,
262,
17548,
278,
17593,
357,
1662,
11777,
7042,
8,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
299,
62,
600,
796,
257,
62,
6759,
13,
43358,
58,
16,
60,
198,
220,
220,
220,
1051,
62,
35138,
796,
299,
32152,
13,
25120,
13,
25541,
7,
17,
11,
299,
62,
600,
8,
1635,
362,
532,
352,
198,
220,
220,
220,
4686,
87,
62,
35138,
796,
299,
32152,
13,
25120,
13,
25541,
7,
77,
62,
600,
11,
264,
62,
600,
11,
6330,
28,
25101,
8,
198,
220,
220,
220,
257,
62,
6759,
796,
257,
62,
6759,
1635,
1051,
62,
35138,
13,
3447,
1758,
7,
16,
11,
299,
62,
600,
8,
198,
220,
220,
220,
257,
62,
6759,
796,
1103,
487,
83,
62,
808,
7,
64,
62,
6759,
8,
198,
220,
220,
220,
269,
62,
6759,
796,
257,
62,
6759,
58,
45299,
4686,
87,
62,
35138,
60,
1635,
299,
32152,
13,
31166,
17034,
7,
77,
62,
600,
1220,
264,
62,
600,
8,
198,
220,
220,
220,
1441,
269,
62,
6759,
628,
220,
220,
220,
220,
198,
4299,
19677,
701,
17,
7,
64,
62,
6759,
11,
275,
62,
6759,
11,
264,
62,
600,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3834,
37687,
10137,
14534,
1143,
34296,
5277,
26981,
357,
12562,
9792,
8,
329,
360,
1072,
24936,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
198,
220,
220,
220,
220,
220,
220,
220,
257,
62,
6759,
25,
285,
12,
1525,
12,
77,
15715,
31835,
20519,
17593,
26,
198,
220,
220,
220,
220,
220,
220,
220,
275,
62,
6759,
25,
288,
12,
1525,
12,
77,
15715,
31835,
20519,
17593,
26,
198,
220,
220,
220,
220,
220,
220,
220,
264,
62,
600,
25,
17548,
2546,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
198,
220,
220,
220,
220,
220,
220,
220,
269,
62,
6759,
25,
285,
12,
1525,
12,
82,
17548,
327,
796,
317,
1635,
311,
26,
198,
220,
220,
220,
220,
220,
220,
220,
288,
62,
6759,
25,
288,
12,
1525,
12,
82,
17548,
360,
796,
347,
1635,
311,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3423,
311,
318,
262,
17548,
278,
17593,
357,
1662,
11777,
7042,
8,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
299,
62,
600,
796,
257,
62,
6759,
13,
43358,
58,
16,
60,
198,
220,
220,
220,
1051,
62,
35138,
796,
299,
32152,
13,
25120,
13,
25541,
7,
17,
11,
299,
62,
600,
8,
1635,
362,
532,
352,
198,
220,
220,
220,
4686,
87,
62,
35138,
796,
299,
32152,
13,
25120,
13,
25541,
7,
77,
62,
600,
11,
264,
62,
600,
11,
6330,
28,
25101,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
257,
62,
6759,
796,
257,
62,
6759,
1635,
1051,
62,
35138,
13,
3447,
1758,
7,
16,
11,
299,
62,
600,
8,
198,
220,
220,
220,
257,
62,
6759,
796,
1103,
487,
83,
62,
808,
7,
64,
62,
6759,
8,
198,
220,
220,
220,
269,
62,
6759,
796,
257,
62,
6759,
58,
45299,
4686,
87,
62,
35138,
60,
1635,
299,
32152,
13,
31166,
17034,
7,
77,
62,
600,
1220,
264,
62,
600,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
275,
62,
6759,
796,
275,
62,
6759,
1635,
1051,
62,
35138,
13,
3447,
1758,
7,
16,
11,
299,
62,
600,
8,
198,
220,
220,
220,
275,
62,
6759,
796,
1103,
487,
83,
62,
808,
7,
65,
62,
6759,
8,
198,
220,
220,
220,
288,
62,
6759,
796,
275,
62,
6759,
58,
45299,
4686,
87,
62,
35138,
60,
1635,
299,
32152,
13,
31166,
17034,
7,
77,
62,
600,
1220,
264,
62,
600,
8,
198,
220,
220,
220,
1441,
269,
62,
6759,
11,
288,
62,
6759,
198
] | 1.959534 | 1,804 |
from urldl import download
from pycallisto import fitsfile
callisto_archives = 'http://soleil80.cs.technik.fhnw.ch/' \
'solarradio/data/2002-20yy_Callisto/'
filelist = [
"BLEN7M_20110216_133009_24.fit.gz", "BLEN7M_20110216_134510_24.fit.gz",
"BLEN7M_20110216_140011_24.fit.gz", "BLEN7M_20110216_141512_24.fit.gz",
"BLEN7M_20110216_143014_24.fit.gz", "BLEN7M_20110216_144515_24.fit.gz",
"BLEN7M_20110216_150016_24.fit.gz", "BLEN7M_20110216_151517_24.fit.gz",
"BLEN7M_20110216_153019_24.fit.gz"]
for filename in filelist:
fits_year = filename.split('_')[1][:4]
fits_month = filename.split('_')[1][4:6]
fits_day = filename.split('_')[1][-2:]
fits_url = f'{callisto_archives}/{fits_year}/{fits_month}/' \
f'{fits_day}/{filename}'
download(fits_url)
title = "Flare classe M1.6, 16/02/2011 (BLEN7M)"
plot_filename = "for_publication"
fitsfile.ECallistoFitsFile.plot_fits_files_list(filelist,
title=title,
plot_filename=plot_filename,
show=True)
| [
6738,
2956,
335,
75,
1330,
4321,
198,
6738,
12972,
13345,
396,
78,
1330,
11414,
7753,
628,
198,
13345,
396,
78,
62,
48814,
796,
705,
4023,
1378,
6753,
346,
1795,
13,
6359,
13,
23873,
1134,
13,
69,
21116,
86,
13,
354,
14,
6,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
34453,
3258,
324,
952,
14,
7890,
14,
16942,
12,
1238,
22556,
62,
14134,
396,
78,
14,
6,
198,
7753,
4868,
796,
685,
198,
220,
220,
220,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1485,
6200,
24,
62,
1731,
13,
11147,
13,
34586,
1600,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1485,
2231,
940,
62,
1731,
13,
11147,
13,
34586,
1600,
198,
220,
220,
220,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1415,
405,
1157,
62,
1731,
13,
11147,
13,
34586,
1600,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1415,
1314,
1065,
62,
1731,
13,
11147,
13,
34586,
1600,
198,
220,
220,
220,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1415,
18938,
19,
62,
1731,
13,
11147,
13,
34586,
1600,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1415,
2231,
1314,
62,
1731,
13,
11147,
13,
34586,
1600,
198,
220,
220,
220,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
33698,
1433,
62,
1731,
13,
11147,
13,
34586,
1600,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1314,
1314,
1558,
62,
1731,
13,
11147,
13,
34586,
1600,
198,
220,
220,
220,
366,
9148,
1677,
22,
44,
62,
1264,
15377,
1433,
62,
1314,
18938,
24,
62,
1731,
13,
11147,
13,
34586,
8973,
198,
198,
1640,
29472,
287,
2393,
4868,
25,
198,
220,
220,
220,
11414,
62,
1941,
796,
29472,
13,
35312,
10786,
62,
11537,
58,
16,
7131,
25,
19,
60,
198,
220,
220,
220,
11414,
62,
8424,
796,
29472,
13,
35312,
10786,
62,
11537,
58,
16,
7131,
19,
25,
21,
60,
198,
220,
220,
220,
11414,
62,
820,
796,
29472,
13,
35312,
10786,
62,
11537,
58,
16,
7131,
12,
17,
47715,
198,
220,
220,
220,
11414,
62,
6371,
796,
277,
6,
90,
13345,
396,
78,
62,
48814,
92,
14,
90,
21013,
62,
1941,
92,
14,
90,
21013,
62,
8424,
92,
14,
6,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
6,
90,
21013,
62,
820,
92,
14,
90,
34345,
92,
6,
198,
220,
220,
220,
4321,
7,
21013,
62,
6371,
8,
198,
198,
7839,
796,
366,
7414,
533,
537,
21612,
337,
16,
13,
21,
11,
1467,
14,
2999,
14,
9804,
357,
9148,
1677,
22,
44,
16725,
198,
29487,
62,
34345,
796,
366,
1640,
62,
11377,
341,
1,
198,
21013,
7753,
13,
2943,
439,
396,
78,
37,
896,
8979,
13,
29487,
62,
21013,
62,
16624,
62,
4868,
7,
7753,
4868,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3670,
28,
7839,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7110,
62,
34345,
28,
29487,
62,
34345,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
905,
28,
17821,
8,
198
] | 1.807154 | 643 |
import logging
import yaml
from detectime.detectime import detectron
from definitions import ROOT_DIR
from detectime.utils import convert_dict_to_tuple
log = logging.getLogger(__name__)
CONFIG_PATH = 'config.yml'
if __name__ == '__main__':
main()
| [
11748,
18931,
198,
11748,
331,
43695,
198,
6738,
4886,
524,
13,
15255,
478,
524,
1330,
4886,
1313,
198,
6738,
17336,
1330,
15107,
2394,
62,
34720,
198,
6738,
4886,
524,
13,
26791,
1330,
10385,
62,
11600,
62,
1462,
62,
83,
29291,
198,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
198,
10943,
16254,
62,
34219,
796,
705,
11250,
13,
88,
4029,
6,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.942529 | 87 |
#!/usr/bin/env python
"""Clone wars simulator.
Simulates the growth of clones in a 2D space.
Mutations are induced by button presses.
Currently untested.
"""
import splash
splash.splashScreen("CloneWars!",rotation=270)
import signal
import sys
import RPi.GPIO as GPIO
try:
import numpy as np
except ImportError:
import numpyReplace as np
from UnicornWF import UnicornSimulator
# Need to check the pin numbers
RED_BUTTON_GPIO = 21
BLUE_BUTTON_GPIO = 16
GREEN_BUTTON_GPIO = 12
BLACK_BUTTON_GPIO = 25
GPIO.setmode(GPIO.BCM)
buttons = [RED_BUTTON_GPIO, BLUE_BUTTON_GPIO, GREEN_BUTTON_GPIO, BLACK_BUTTON_GPIO]
class DecayMutation(UnicornSimulator):
"""Random mutation turns cells black"""
def mutate(self, colour=0):
"""Select a random cell and change fitness and colour to black."""
cell = np.random.randint(0, self.population)
self.fitness[cell] += np.random.normal(loc=self.advantage, scale=0.1)
if colour == None:
self.colour[cell] = self.mutantColour
else:
self.colour[cell] = colour
self.colourUpdate()
if __name__ == "__main__":
for BUTTON_GPIO in buttons:
GPIO.setup(BUTTON_GPIO, GPIO.IN, pull_up_down=GPIO.PUD_UP)
grid = DecayMutation(16, 30, 0.1, advantage=0.1)
print("setup buttons")
GPIO.add_event_detect(RED_BUTTON_GPIO, GPIO.FALLING,
callback=redMutation, bouncetime=50)
GPIO.add_event_detect(BLUE_BUTTON_GPIO, GPIO.FALLING,
callback=blueMutation, bouncetime=50)
GPIO.add_event_detect(GREEN_BUTTON_GPIO, GPIO.FALLING,
callback=greenMutation, bouncetime=50)
GPIO.add_event_detect(BLACK_BUTTON_GPIO, GPIO.FALLING,
callback=blackMutation, bouncetime=50)
print("enter loop")
grid.runAndProject()
GPIO.cleanup()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
2601,
505,
9976,
35375,
13,
198,
198,
8890,
15968,
262,
3349,
286,
32498,
287,
257,
362,
35,
2272,
13,
198,
44,
32855,
389,
18268,
416,
4936,
31048,
13,
198,
198,
21327,
1418,
7287,
13,
198,
37811,
198,
198,
11748,
22870,
198,
22018,
1077,
13,
22018,
1077,
23901,
7203,
2601,
505,
41508,
40754,
10599,
341,
28,
20233,
8,
198,
198,
11748,
6737,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
11748,
25064,
198,
11748,
25812,
72,
13,
16960,
9399,
355,
50143,
198,
198,
28311,
25,
198,
220,
220,
220,
1330,
299,
32152,
355,
45941,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
1330,
299,
32152,
3041,
5372,
355,
45941,
198,
198,
6738,
39481,
48397,
1330,
39481,
8890,
8927,
198,
198,
2,
10664,
284,
2198,
262,
6757,
3146,
198,
22083,
62,
47526,
11357,
62,
16960,
9399,
796,
2310,
198,
9148,
8924,
62,
47526,
11357,
62,
16960,
9399,
796,
1467,
198,
43016,
62,
47526,
11357,
62,
16960,
9399,
796,
1105,
198,
9148,
8120,
62,
47526,
11357,
62,
16960,
9399,
796,
1679,
198,
198,
16960,
9399,
13,
2617,
14171,
7,
16960,
9399,
13,
2749,
44,
8,
198,
4360,
27288,
796,
685,
22083,
62,
47526,
11357,
62,
16960,
9399,
11,
9878,
8924,
62,
47526,
11357,
62,
16960,
9399,
11,
47606,
62,
47526,
11357,
62,
16960,
9399,
11,
31963,
62,
47526,
11357,
62,
16960,
9399,
60,
198,
198,
4871,
39087,
44,
7094,
7,
3118,
291,
1211,
8890,
8927,
2599,
198,
220,
220,
220,
37227,
29531,
15148,
4962,
4778,
2042,
37811,
198,
220,
220,
220,
825,
4517,
378,
7,
944,
11,
9568,
28,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
17563,
257,
4738,
2685,
290,
1487,
13547,
290,
9568,
284,
2042,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2685,
796,
45941,
13,
25120,
13,
25192,
600,
7,
15,
11,
2116,
13,
39748,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
69,
3659,
58,
3846,
60,
15853,
45941,
13,
25120,
13,
11265,
7,
17946,
28,
944,
13,
13461,
496,
11,
5046,
28,
15,
13,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
9568,
6624,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
49903,
58,
3846,
60,
796,
2116,
13,
21973,
415,
5216,
454,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
49903,
58,
3846,
60,
796,
9568,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
49903,
10260,
3419,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
329,
21728,
11357,
62,
16960,
9399,
287,
12163,
25,
198,
220,
220,
220,
220,
220,
220,
220,
50143,
13,
40406,
7,
47526,
11357,
62,
16960,
9399,
11,
50143,
13,
1268,
11,
2834,
62,
929,
62,
2902,
28,
16960,
9399,
13,
5105,
35,
62,
8577,
8,
198,
220,
220,
220,
10706,
796,
39087,
44,
7094,
7,
1433,
11,
1542,
11,
657,
13,
16,
11,
4621,
28,
15,
13,
16,
8,
198,
220,
220,
220,
3601,
7203,
40406,
12163,
4943,
198,
220,
220,
220,
50143,
13,
2860,
62,
15596,
62,
15255,
478,
7,
22083,
62,
47526,
11357,
62,
16960,
9399,
11,
50143,
13,
37,
7036,
2751,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23838,
28,
445,
44,
7094,
11,
31283,
66,
8079,
28,
1120,
8,
198,
220,
220,
220,
50143,
13,
2860,
62,
15596,
62,
15255,
478,
7,
9148,
8924,
62,
47526,
11357,
62,
16960,
9399,
11,
50143,
13,
37,
7036,
2751,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23838,
28,
17585,
44,
7094,
11,
31283,
66,
8079,
28,
1120,
8,
198,
220,
220,
220,
50143,
13,
2860,
62,
15596,
62,
15255,
478,
7,
43016,
62,
47526,
11357,
62,
16960,
9399,
11,
50143,
13,
37,
7036,
2751,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23838,
28,
14809,
44,
7094,
11,
31283,
66,
8079,
28,
1120,
8,
198,
220,
220,
220,
50143,
13,
2860,
62,
15596,
62,
15255,
478,
7,
9148,
8120,
62,
47526,
11357,
62,
16960,
9399,
11,
50143,
13,
37,
7036,
2751,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23838,
28,
13424,
44,
7094,
11,
31283,
66,
8079,
28,
1120,
8,
198,
220,
220,
220,
3601,
7203,
9255,
9052,
4943,
198,
220,
220,
220,
10706,
13,
5143,
1870,
16775,
3419,
198,
198,
16960,
9399,
13,
27773,
929,
3419,
198
] | 2.364341 | 774 |
# Generated by Django 4.0.2 on 2022-02-06 09:41
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
604,
13,
15,
13,
17,
319,
33160,
12,
2999,
12,
3312,
7769,
25,
3901,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
628
] | 3.019231 | 52 |
import numpy as np | [
11748,
299,
32152,
355,
45941
] | 3.6 | 5 |
from EMAlgorithm import EmAlgorithm
import numpy as np
def create_data(mu0, sigma0, mu1, sigma1, alpha0, alpha1):
'''
初始化数据集
这里通过服从高斯分布的随机函数来伪造数据集
:param mu0: 高斯0的均值
:param sigma0: 高斯0的方差
:param mu1: 高斯1的均值
:param sigma1: 高斯1的方差
:param alpha0: 高斯0的系数
:param alpha1: 高斯1的系数
:return: 混合了两个高斯分布的数据
'''
#定义数据集长度为1000
length = 1000
#初始化第一个高斯分布,生成数据,数据长度为length * alpha系数,以此来
#满足alpha的作用
data0 = np.random.normal(mu0, sigma0, int(length * alpha0))
#第二个高斯分布的数据
data1 = np.random.normal(mu1, sigma1, int(length * alpha1))
#初始化总数据集
#两个高斯分布的数据混合后会放在该数据集中返回
dataSet = []
#将第一个数据集的内容添加进去
dataSet.extend(data0)
#添加第二个数据集的数据
dataSet.extend(data1)
#返回伪造好的数据集
return dataSet
data = create_data(2, 2, 4, 2, 0.6, 0.4)
e = EmAlgorithm(data, 2)
e.train()
# a = e.compute_gama()
# e.update() | [
6738,
17228,
2348,
42289,
1330,
2295,
2348,
42289,
198,
11748,
299,
32152,
355,
45941,
628,
198,
4299,
2251,
62,
7890,
7,
30300,
15,
11,
264,
13495,
15,
11,
38779,
16,
11,
264,
13495,
16,
11,
17130,
15,
11,
17130,
16,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
10263,
230,
251,
34650,
233,
44293,
244,
46763,
108,
162,
235,
106,
37239,
228,
198,
220,
220,
220,
5525,
123,
247,
34932,
234,
34460,
248,
32573,
229,
17312,
235,
20015,
236,
165,
45865,
23877,
107,
26344,
228,
30585,
225,
21410,
49694,
237,
17312,
118,
49035,
121,
46763,
108,
30266,
98,
27670,
103,
34460,
254,
46763,
108,
162,
235,
106,
37239,
228,
198,
220,
220,
220,
1058,
17143,
38779,
15,
25,
16268,
45865,
23877,
107,
15,
21410,
161,
251,
229,
161,
222,
120,
198,
220,
220,
220,
1058,
17143,
264,
13495,
15,
25,
16268,
45865,
23877,
107,
15,
21410,
43095,
32432,
106,
198,
220,
220,
220,
1058,
17143,
38779,
16,
25,
16268,
45865,
23877,
107,
16,
21410,
161,
251,
229,
161,
222,
120,
198,
220,
220,
220,
1058,
17143,
264,
13495,
16,
25,
16268,
45865,
23877,
107,
16,
21410,
43095,
32432,
106,
198,
220,
220,
220,
1058,
17143,
17130,
15,
25,
16268,
45865,
23877,
107,
15,
21410,
163,
111,
119,
46763,
108,
198,
220,
220,
220,
1058,
17143,
17130,
16,
25,
16268,
45865,
23877,
107,
16,
21410,
163,
111,
119,
46763,
108,
198,
220,
220,
220,
1058,
7783,
25,
10545,
115,
115,
28938,
230,
12859,
228,
10310,
97,
10310,
103,
165,
45865,
23877,
107,
26344,
228,
30585,
225,
21410,
46763,
108,
162,
235,
106,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1303,
22522,
248,
20046,
231,
46763,
108,
162,
235,
106,
37239,
228,
165,
243,
123,
41753,
99,
10310,
118,
12825,
198,
220,
220,
220,
4129,
796,
8576,
628,
220,
220,
220,
1303,
26344,
251,
34650,
233,
44293,
244,
163,
105,
105,
31660,
10310,
103,
165,
45865,
23877,
107,
26344,
228,
30585,
225,
171,
120,
234,
37955,
22755,
238,
46763,
108,
162,
235,
106,
171,
120,
234,
46763,
108,
162,
235,
106,
165,
243,
123,
41753,
99,
10310,
118,
13664,
1635,
17130,
163,
111,
119,
46763,
108,
171,
120,
234,
20015,
98,
29826,
97,
30266,
98,
198,
220,
220,
220,
1303,
162,
119,
94,
164,
114,
111,
26591,
21410,
43291,
18796,
101,
198,
220,
220,
220,
1366,
15,
796,
45941,
13,
25120,
13,
11265,
7,
30300,
15,
11,
264,
13495,
15,
11,
493,
7,
13664,
1635,
17130,
15,
4008,
198,
220,
220,
220,
1303,
163,
105,
105,
12859,
234,
10310,
103,
165,
45865,
23877,
107,
26344,
228,
30585,
225,
21410,
46763,
108,
162,
235,
106,
198,
220,
220,
220,
1366,
16,
796,
45941,
13,
25120,
13,
11265,
7,
30300,
16,
11,
264,
13495,
16,
11,
493,
7,
13664,
1635,
17130,
16,
4008,
628,
220,
220,
220,
1303,
26344,
251,
34650,
233,
44293,
244,
45250,
119,
46763,
108,
162,
235,
106,
37239,
228,
198,
220,
220,
220,
1303,
10310,
97,
10310,
103,
165,
45865,
23877,
107,
26344,
228,
30585,
225,
21410,
46763,
108,
162,
235,
106,
162,
115,
115,
28938,
230,
28938,
236,
27670,
248,
162,
242,
122,
28839,
101,
46237,
98,
46763,
108,
162,
235,
106,
37239,
228,
40792,
32573,
242,
32368,
252,
198,
220,
220,
220,
1366,
7248,
796,
17635,
198,
220,
220,
220,
1303,
49546,
163,
105,
105,
31660,
10310,
103,
46763,
108,
162,
235,
106,
37239,
228,
21410,
37863,
227,
22522,
117,
162,
115,
119,
27950,
254,
32573,
249,
43889,
119,
198,
220,
220,
220,
1366,
7248,
13,
2302,
437,
7,
7890,
15,
8,
198,
220,
220,
220,
1303,
162,
115,
119,
27950,
254,
163,
105,
105,
12859,
234,
10310,
103,
46763,
108,
162,
235,
106,
37239,
228,
21410,
46763,
108,
162,
235,
106,
198,
220,
220,
220,
1366,
7248,
13,
2302,
437,
7,
7890,
16,
8,
628,
220,
220,
220,
1303,
32573,
242,
32368,
252,
27670,
103,
34460,
254,
25001,
121,
21410,
46763,
108,
162,
235,
106,
37239,
228,
198,
220,
220,
220,
1441,
1366,
7248,
628,
198,
7890,
796,
2251,
62,
7890,
7,
17,
11,
362,
11,
604,
11,
362,
11,
657,
13,
21,
11,
657,
13,
19,
8,
198,
68,
796,
2295,
2348,
42289,
7,
7890,
11,
362,
8,
198,
68,
13,
27432,
3419,
198,
2,
257,
796,
304,
13,
5589,
1133,
62,
70,
1689,
3419,
198,
2,
304,
13,
19119,
3419
] | 1.227462 | 721 |
import os
xmldir = '/media/e813/E/dataset/eccv/eccv/VisDrone2018-VID-val/xmlannotations'
# datasetdir = '/media/e813/E/dataset/eccv/eccv/VisDrone2018-VID-train'
# file = os.path.join(datasetdir,'index.txt')
# f = open(file,'w')
count=0
for seq in os.listdir(xmldir):
seqpath = os.path.join(xmldir,seq)
for n,xml_name in enumerate(os.listdir(seqpath)):
count += 1
if n%4==0:
name = xml_name[:-4]
# f.write('{} {}\n'.format(seq,name))
print(count)
# f.close()
# with open(file) as f:
# xmls = f.readlines()
# xmls =[x.strip("\n") for x in xmls]
# xmls = [x.split(' ') for x in xmls]
# print(xmls[1:10])
| [
11748,
28686,
198,
87,
76,
335,
343,
796,
31051,
11431,
14,
68,
23,
1485,
14,
36,
14,
19608,
292,
316,
14,
68,
535,
85,
14,
68,
535,
85,
14,
15854,
6187,
505,
7908,
12,
11008,
12,
2100,
14,
19875,
34574,
602,
6,
198,
2,
27039,
15908,
796,
31051,
11431,
14,
68,
23,
1485,
14,
36,
14,
19608,
292,
316,
14,
68,
535,
85,
14,
68,
535,
85,
14,
15854,
6187,
505,
7908,
12,
11008,
12,
27432,
6,
198,
2,
2393,
796,
28686,
13,
6978,
13,
22179,
7,
19608,
292,
316,
15908,
4032,
9630,
13,
14116,
11537,
198,
2,
277,
796,
1280,
7,
7753,
4032,
86,
11537,
198,
9127,
28,
15,
198,
1640,
33756,
287,
28686,
13,
4868,
15908,
7,
87,
76,
335,
343,
2599,
198,
220,
220,
220,
33756,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
87,
76,
335,
343,
11,
41068,
8,
198,
220,
220,
220,
329,
299,
11,
19875,
62,
3672,
287,
27056,
378,
7,
418,
13,
4868,
15908,
7,
41068,
6978,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
954,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
611,
299,
4,
19,
855,
15,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
35555,
62,
3672,
58,
21912,
19,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
277,
13,
13564,
10786,
90,
92,
23884,
59,
77,
4458,
18982,
7,
41068,
11,
3672,
4008,
198,
4798,
7,
9127,
8,
198,
2,
277,
13,
19836,
3419,
198,
2,
351,
1280,
7,
7753,
8,
355,
277,
25,
198,
2,
220,
220,
220,
220,
35555,
82,
796,
277,
13,
961,
6615,
3419,
198,
2,
220,
220,
220,
220,
35555,
82,
796,
58,
87,
13,
36311,
7203,
59,
77,
4943,
329,
2124,
287,
35555,
82,
60,
198,
2,
220,
220,
220,
220,
35555,
82,
796,
685,
87,
13,
35312,
10786,
705,
8,
329,
2124,
287,
35555,
82,
60,
198,
2,
3601,
7,
19875,
82,
58,
16,
25,
940,
12962,
198
] | 1.976119 | 335 |
import textwrap
from asyncio import Future
from prompt_toolkit.layout.containers import HSplit
from prompt_toolkit.layout.dimension import D
from prompt_toolkit.widgets import Button, Label
from prompt_toolkit.widgets.dialogs import Dialog
from pepys_admin.maintenance.utils import get_system_name_mappings
from pepys_admin.maintenance.widgets.entry_edit_widget import EntryEditWidget
| [
11748,
2420,
37150,
198,
6738,
30351,
952,
1330,
10898,
198,
198,
6738,
6152,
62,
25981,
15813,
13,
39786,
13,
3642,
50221,
1330,
18070,
489,
270,
198,
6738,
6152,
62,
25981,
15813,
13,
39786,
13,
46156,
1330,
360,
198,
6738,
6152,
62,
25981,
15813,
13,
28029,
11407,
1330,
20969,
11,
36052,
198,
6738,
6152,
62,
25981,
15813,
13,
28029,
11407,
13,
38969,
18463,
1330,
21269,
519,
198,
198,
6738,
279,
538,
893,
62,
28482,
13,
12417,
8219,
13,
26791,
1330,
651,
62,
10057,
62,
3672,
62,
76,
39242,
198,
6738,
279,
538,
893,
62,
28482,
13,
12417,
8219,
13,
28029,
11407,
13,
13000,
62,
19312,
62,
42655,
1330,
21617,
18378,
38300,
628
] | 3.495495 | 111 |
# @param {integer[]} nums1
# @param {integer} m
# @param {integer[]} nums2
# @param {integer} n
# @return {void} Do not return anything, modify nums1 in-place instead. | [
220,
220,
220,
1303,
2488,
17143,
1391,
41433,
21737,
92,
997,
82,
16,
198,
220,
220,
220,
1303,
2488,
17143,
1391,
41433,
92,
285,
198,
220,
220,
220,
1303,
2488,
17143,
1391,
41433,
21737,
92,
997,
82,
17,
198,
220,
220,
220,
1303,
2488,
17143,
1391,
41433,
92,
299,
198,
220,
220,
220,
1303,
2488,
7783,
1391,
19382,
92,
2141,
407,
1441,
1997,
11,
13096,
997,
82,
16,
287,
12,
5372,
2427,
13
] | 2.561644 | 73 |
from ansible.parsing.dataloader import DataLoader
from ansible.template import Templar
import json
import pytest
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.fixture()
def get_vars(host):
"""
"""
base_dir, molecule_dir = base_directory()
distribution = host.system_info.distribution
if distribution in ['debian', 'ubuntu']:
os = "debian"
elif distribution in ['redhat', 'ol', 'centos', 'rocky', 'almalinux']:
os = "redhat"
elif distribution in ['arch']:
os = "archlinux"
print(" -> {} / {}".format(distribution, os))
file_defaults = "file={}/defaults/main.yml name=role_defaults".format(base_dir)
file_vars = "file={}/vars/main.yml name=role_vars".format(base_dir)
file_molecule = "file={}/group_vars/all/vars.yml name=test_vars".format(molecule_dir)
file_distibution = "file={}/vars/{}.yml name=role_distibution".format(base_dir, os)
defaults_vars = host.ansible("include_vars", file_defaults).get("ansible_facts").get("role_defaults")
vars_vars = host.ansible("include_vars", file_vars).get("ansible_facts").get("role_vars")
distibution_vars = host.ansible("include_vars", file_distibution).get("ansible_facts").get("role_distibution")
molecule_vars = host.ansible("include_vars", file_molecule).get("ansible_facts").get("test_vars")
ansible_vars = defaults_vars
ansible_vars.update(vars_vars)
ansible_vars.update(distibution_vars)
ansible_vars.update(molecule_vars)
templar = Templar(loader=DataLoader(), variables=ansible_vars)
result = templar.template(ansible_vars, fail_on_undefined=False)
return result
def test_directories(host, get_vars):
"""
used config directory
debian based: /etc/mysql
redhat based: /etc/my.cnf.d
arch based : /etc/my.cnf.d
"""
pp_json(get_vars)
directories = [
"/etc/postfix",
"/etc/postfix/maps.d",
"/etc/postfix/postfix-files.d",
"/etc/postfix/dynamicmaps.cf.d"
]
directories.append(get_vars.get("postfix_config_directory"))
for dirs in directories:
d = host.file(dirs)
assert d.is_directory
def test_files(host, get_vars):
"""
created config files
"""
files = [
"/etc/postfix/main.cf",
"/etc/postfix/master.cf",
"/etc/postfix/maps.d/generic",
"/etc/postfix/maps.d/header_checks",
"/etc/postfix/maps.d/sender_canonical_maps",
]
files.append(get_vars.get("postfix_mailname_file"))
files.append(get_vars.get("postfix_aliases_file"))
for _file in files:
f = host.file(_file)
assert f.is_file
def test_user(host, get_vars):
"""
created user
"""
shell = '/usr/sbin/nologin'
distribution = host.system_info.distribution
if distribution in ['redhat', 'ol', 'centos', 'rocky', 'almalinux']:
shell = "/sbin/nologin"
elif distribution == "arch":
shell = "/usr/bin/nologin"
user_name = "postfix"
u = host.user(user_name)
g = host.group(user_name)
assert g.exists
assert u.exists
assert user_name in u.groups
assert u.shell == shell
def test_service_running_and_enabled(host, get_vars):
"""
running service
"""
service_name = "postfix"
service = host.service(service_name)
assert service.is_running
assert service.is_enabled
def test_listening_socket(host, get_vars):
"""
"""
listening = host.socket.get_listening_sockets()
interfaces = host.interface.names()
eth = []
if "eth0" in interfaces:
eth = host.interface("eth0").addresses
for i in listening:
print(i)
for i in interfaces:
print(i)
for i in eth:
print(i)
distribution = host.system_info.distribution
release = host.system_info.release
bind_address = eth[0]
bind_port = 25
socket_name = "private/smtp"
listen = []
listen.append("tcp://{}:{}".format(bind_address, bind_port))
if not (distribution == 'ubuntu' and release == '18.04'):
listen.append("unix://{}".format(socket_name))
for spec in listen:
socket = host.socket(spec)
assert socket.is_listening
| [
198,
6738,
9093,
856,
13,
79,
945,
278,
13,
67,
10254,
1170,
263,
1330,
6060,
17401,
198,
6738,
9093,
856,
13,
28243,
1330,
41741,
198,
198,
11748,
33918,
198,
11748,
12972,
9288,
198,
11748,
28686,
198,
198,
11748,
1332,
10745,
430,
13,
26791,
13,
504,
856,
62,
16737,
628,
198,
9288,
10745,
430,
62,
4774,
82,
796,
1332,
10745,
430,
13,
26791,
13,
504,
856,
62,
16737,
13,
2025,
82,
856,
49493,
7,
198,
220,
220,
220,
28686,
13,
268,
2268,
17816,
11770,
2538,
34,
24212,
62,
1268,
53,
3525,
15513,
62,
25664,
20520,
737,
1136,
62,
4774,
82,
10786,
439,
11537,
628,
628,
198,
31,
9078,
9288,
13,
69,
9602,
3419,
198,
4299,
651,
62,
85,
945,
7,
4774,
2599,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
2779,
62,
15908,
11,
27756,
62,
15908,
796,
2779,
62,
34945,
3419,
198,
220,
220,
220,
6082,
796,
2583,
13,
10057,
62,
10951,
13,
17080,
3890,
628,
220,
220,
220,
611,
6082,
287,
37250,
24689,
3256,
705,
32230,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
796,
366,
24689,
1,
198,
220,
220,
220,
1288,
361,
6082,
287,
37250,
445,
5183,
3256,
705,
349,
3256,
705,
1087,
418,
3256,
705,
10823,
88,
3256,
705,
282,
7617,
259,
2821,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
796,
366,
445,
5183,
1,
198,
220,
220,
220,
1288,
361,
6082,
287,
37250,
998,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
796,
366,
998,
23289,
1,
628,
220,
220,
220,
3601,
7203,
4613,
23884,
1220,
23884,
1911,
18982,
7,
17080,
3890,
11,
28686,
4008,
628,
220,
220,
220,
2393,
62,
12286,
82,
796,
366,
7753,
34758,
92,
14,
12286,
82,
14,
12417,
13,
88,
4029,
1438,
28,
18090,
62,
12286,
82,
1911,
18982,
7,
8692,
62,
15908,
8,
198,
220,
220,
220,
2393,
62,
85,
945,
796,
366,
7753,
34758,
92,
14,
85,
945,
14,
12417,
13,
88,
4029,
1438,
28,
18090,
62,
85,
945,
1911,
18982,
7,
8692,
62,
15908,
8,
198,
220,
220,
220,
2393,
62,
76,
2305,
23172,
796,
366,
7753,
34758,
92,
14,
8094,
62,
85,
945,
14,
439,
14,
85,
945,
13,
88,
4029,
1438,
28,
9288,
62,
85,
945,
1911,
18982,
7,
76,
2305,
23172,
62,
15908,
8,
198,
220,
220,
220,
2393,
62,
17080,
571,
1009,
796,
366,
7753,
34758,
92,
14,
85,
945,
14,
90,
27422,
88,
4029,
1438,
28,
18090,
62,
17080,
571,
1009,
1911,
18982,
7,
8692,
62,
15908,
11,
28686,
8,
628,
220,
220,
220,
26235,
62,
85,
945,
796,
2583,
13,
504,
856,
7203,
17256,
62,
85,
945,
1600,
2393,
62,
12286,
82,
737,
1136,
7203,
504,
856,
62,
37473,
11074,
1136,
7203,
18090,
62,
12286,
82,
4943,
198,
220,
220,
220,
410,
945,
62,
85,
945,
796,
2583,
13,
504,
856,
7203,
17256,
62,
85,
945,
1600,
2393,
62,
85,
945,
737,
1136,
7203,
504,
856,
62,
37473,
11074,
1136,
7203,
18090,
62,
85,
945,
4943,
198,
220,
220,
220,
1233,
571,
1009,
62,
85,
945,
796,
2583,
13,
504,
856,
7203,
17256,
62,
85,
945,
1600,
2393,
62,
17080,
571,
1009,
737,
1136,
7203,
504,
856,
62,
37473,
11074,
1136,
7203,
18090,
62,
17080,
571,
1009,
4943,
198,
220,
220,
220,
27756,
62,
85,
945,
796,
2583,
13,
504,
856,
7203,
17256,
62,
85,
945,
1600,
2393,
62,
76,
2305,
23172,
737,
1136,
7203,
504,
856,
62,
37473,
11074,
1136,
7203,
9288,
62,
85,
945,
4943,
628,
220,
220,
220,
9093,
856,
62,
85,
945,
796,
26235,
62,
85,
945,
198,
220,
220,
220,
9093,
856,
62,
85,
945,
13,
19119,
7,
85,
945,
62,
85,
945,
8,
198,
220,
220,
220,
9093,
856,
62,
85,
945,
13,
19119,
7,
17080,
571,
1009,
62,
85,
945,
8,
198,
220,
220,
220,
9093,
856,
62,
85,
945,
13,
19119,
7,
76,
2305,
23172,
62,
85,
945,
8,
628,
220,
220,
220,
2169,
489,
283,
796,
41741,
7,
29356,
28,
6601,
17401,
22784,
9633,
28,
504,
856,
62,
85,
945,
8,
198,
220,
220,
220,
1255,
796,
2169,
489,
283,
13,
28243,
7,
504,
856,
62,
85,
945,
11,
2038,
62,
261,
62,
917,
18156,
28,
25101,
8,
628,
220,
220,
220,
1441,
1255,
628,
198,
4299,
1332,
62,
12942,
1749,
7,
4774,
11,
651,
62,
85,
945,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
973,
4566,
8619,
628,
220,
220,
220,
220,
220,
50001,
1912,
25,
1220,
14784,
14,
28744,
13976,
198,
220,
220,
220,
220,
220,
2266,
5183,
1912,
25,
1220,
14784,
14,
1820,
13,
31522,
69,
13,
67,
198,
220,
220,
220,
220,
220,
3934,
1912,
220,
1058,
1220,
14784,
14,
1820,
13,
31522,
69,
13,
67,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
9788,
62,
17752,
7,
1136,
62,
85,
945,
8,
628,
220,
220,
220,
29196,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
31803,
13,
67,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
7353,
13049,
12,
16624,
13,
67,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
67,
28995,
31803,
13,
12993,
13,
67,
1,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
29196,
13,
33295,
7,
1136,
62,
85,
945,
13,
1136,
7203,
7353,
13049,
62,
11250,
62,
34945,
48774,
628,
220,
220,
220,
329,
288,
17062,
287,
29196,
25,
198,
220,
220,
220,
220,
220,
220,
220,
288,
796,
2583,
13,
7753,
7,
15908,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
288,
13,
271,
62,
34945,
628,
198,
4299,
1332,
62,
16624,
7,
4774,
11,
651,
62,
85,
945,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
2727,
4566,
3696,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3696,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
12417,
13,
12993,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
9866,
13,
12993,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
31803,
13,
67,
14,
41357,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
31803,
13,
67,
14,
25677,
62,
42116,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
12813,
14784,
14,
7353,
13049,
14,
31803,
13,
67,
14,
82,
2194,
62,
49883,
605,
62,
31803,
1600,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
3696,
13,
33295,
7,
1136,
62,
85,
945,
13,
1136,
7203,
7353,
13049,
62,
4529,
3672,
62,
7753,
48774,
198,
220,
220,
220,
3696,
13,
33295,
7,
1136,
62,
85,
945,
13,
1136,
7203,
7353,
13049,
62,
7344,
1386,
62,
7753,
48774,
628,
220,
220,
220,
329,
4808,
7753,
287,
3696,
25,
198,
220,
220,
220,
220,
220,
220,
220,
277,
796,
2583,
13,
7753,
28264,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
277,
13,
271,
62,
7753,
628,
198,
4299,
1332,
62,
7220,
7,
4774,
11,
651,
62,
85,
945,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
2727,
2836,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7582,
796,
31051,
14629,
14,
82,
8800,
14,
77,
928,
259,
6,
628,
220,
220,
220,
6082,
796,
2583,
13,
10057,
62,
10951,
13,
17080,
3890,
628,
220,
220,
220,
611,
6082,
287,
37250,
445,
5183,
3256,
705,
349,
3256,
705,
1087,
418,
3256,
705,
10823,
88,
3256,
705,
282,
7617,
259,
2821,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
7582,
796,
12813,
82,
8800,
14,
77,
928,
259,
1,
198,
220,
220,
220,
1288,
361,
6082,
6624,
366,
998,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
7582,
796,
12813,
14629,
14,
8800,
14,
77,
928,
259,
1,
628,
220,
220,
220,
2836,
62,
3672,
796,
366,
7353,
13049,
1,
198,
220,
220,
220,
334,
796,
2583,
13,
7220,
7,
7220,
62,
3672,
8,
198,
220,
220,
220,
308,
796,
2583,
13,
8094,
7,
7220,
62,
3672,
8,
628,
220,
220,
220,
6818,
308,
13,
1069,
1023,
198,
220,
220,
220,
6818,
334,
13,
1069,
1023,
198,
220,
220,
220,
6818,
2836,
62,
3672,
287,
334,
13,
24432,
198,
220,
220,
220,
6818,
334,
13,
29149,
6624,
7582,
628,
198,
4299,
1332,
62,
15271,
62,
20270,
62,
392,
62,
25616,
7,
4774,
11,
651,
62,
85,
945,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
2491,
2139,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2139,
62,
3672,
796,
366,
7353,
13049,
1,
628,
220,
220,
220,
2139,
796,
2583,
13,
15271,
7,
15271,
62,
3672,
8,
198,
220,
220,
220,
6818,
2139,
13,
271,
62,
20270,
198,
220,
220,
220,
6818,
2139,
13,
271,
62,
25616,
628,
198,
4299,
1332,
62,
4868,
3101,
62,
44971,
7,
4774,
11,
651,
62,
85,
945,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8680,
796,
2583,
13,
44971,
13,
1136,
62,
4868,
3101,
62,
82,
11603,
3419,
198,
220,
220,
220,
20314,
796,
2583,
13,
39994,
13,
14933,
3419,
198,
220,
220,
220,
4555,
796,
17635,
628,
220,
220,
220,
611,
366,
2788,
15,
1,
287,
20314,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4555,
796,
2583,
13,
39994,
7203,
2788,
15,
11074,
2860,
16746,
628,
220,
220,
220,
329,
1312,
287,
8680,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
72,
8,
628,
220,
220,
220,
329,
1312,
287,
20314,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
72,
8,
628,
220,
220,
220,
329,
1312,
287,
4555,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
72,
8,
628,
220,
220,
220,
6082,
796,
2583,
13,
10057,
62,
10951,
13,
17080,
3890,
198,
220,
220,
220,
2650,
796,
2583,
13,
10057,
62,
10951,
13,
20979,
628,
220,
220,
220,
11007,
62,
21975,
796,
4555,
58,
15,
60,
198,
220,
220,
220,
11007,
62,
634,
796,
1679,
198,
220,
220,
220,
17802,
62,
3672,
796,
366,
19734,
14,
5796,
34788,
1,
628,
220,
220,
220,
6004,
796,
17635,
198,
220,
220,
220,
6004,
13,
33295,
7203,
83,
13155,
1378,
90,
92,
29164,
92,
1911,
18982,
7,
21653,
62,
21975,
11,
11007,
62,
634,
4008,
628,
220,
220,
220,
611,
407,
357,
17080,
3890,
6624,
705,
32230,
6,
290,
2650,
6624,
705,
1507,
13,
3023,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
6004,
13,
33295,
7203,
403,
844,
1378,
90,
92,
1911,
18982,
7,
44971,
62,
3672,
4008,
628,
220,
220,
220,
329,
1020,
287,
6004,
25,
198,
220,
220,
220,
220,
220,
220,
220,
17802,
796,
2583,
13,
44971,
7,
16684,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
17802,
13,
271,
62,
4868,
3101,
198
] | 2.372752 | 1,835 |
import sys
if (sys.version_info >= (2,7)):
import unittest
else:
import unittest2 as unittest
import pydevtest_sessions as s
from pydevtest_common import assertiCmd, assertiCmdFail, interruptiCmd
from resource_suite import ResourceBase
import commands
import os, stat
import datetime
import time
import shutil
import random
| [
11748,
25064,
198,
361,
357,
17597,
13,
9641,
62,
10951,
18189,
357,
17,
11,
22,
8,
2599,
198,
220,
220,
220,
1330,
555,
715,
395,
198,
17772,
25,
198,
220,
220,
220,
1330,
555,
715,
395,
17,
355,
555,
715,
395,
198,
11748,
279,
5173,
1990,
9288,
62,
82,
6202,
355,
264,
198,
6738,
279,
5173,
1990,
9288,
62,
11321,
1330,
6818,
72,
40109,
11,
6818,
72,
40109,
39044,
11,
11313,
72,
40109,
198,
6738,
8271,
62,
2385,
578,
1330,
20857,
14881,
198,
11748,
9729,
198,
11748,
28686,
11,
1185,
198,
11748,
4818,
8079,
198,
11748,
640,
198,
11748,
4423,
346,
198,
11748,
4738,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198
] | 1.394783 | 575 |
from sqlalchemy import Column, ForeignKey, Integer, String, Enum, Float, DateTime, func
from sqlalchemy.orm import relationship
import enum
from app.database import Base
| [
6738,
44161,
282,
26599,
1330,
29201,
11,
8708,
9218,
11,
34142,
11,
10903,
11,
2039,
388,
11,
48436,
11,
7536,
7575,
11,
25439,
198,
6738,
44161,
282,
26599,
13,
579,
1330,
2776,
198,
11748,
33829,
198,
6738,
598,
13,
48806,
1330,
7308,
628,
628,
628,
198
] | 3.826087 | 46 |
# Embedded file name: c:\Jenkins\live\output\win_32_static\Release\midi-remote-scripts\Push\MelodicComponent.py
from __future__ import with_statement
from _Framework.Util import forward_property, find_if
from _Framework.SubjectSlot import subject_slot
from _Framework.ModesComponent import ModesComponent, LayerMode
from MessageBoxComponent import Messenger
from MatrixMaps import FEEDBACK_CHANNELS, NON_FEEDBACK_CHANNEL
from InstrumentComponent import InstrumentComponent
from NoteEditorComponent import NoteEditorComponent
from PlayheadComponent import PlayheadComponent
from MelodicPattern import pitch_index_to_string
from LoopSelectorComponent import LoopSelectorComponent
from NoteEditorPaginator import NoteEditorPaginator
NUM_NOTE_EDITORS = 7 | [
2,
13302,
47238,
2393,
1438,
25,
269,
7479,
44875,
5331,
59,
12583,
59,
22915,
59,
5404,
62,
2624,
62,
12708,
59,
26362,
59,
13602,
72,
12,
47960,
12,
46521,
59,
49222,
59,
21102,
29512,
21950,
13,
9078,
198,
6738,
11593,
37443,
834,
1330,
351,
62,
26090,
198,
6738,
4808,
21055,
6433,
13,
18274,
346,
1330,
2651,
62,
26745,
11,
1064,
62,
361,
198,
6738,
4808,
21055,
6433,
13,
19776,
38963,
1330,
2426,
62,
43384,
198,
6738,
4808,
21055,
6433,
13,
44,
4147,
21950,
1330,
42082,
21950,
11,
34398,
19076,
198,
6738,
16000,
14253,
21950,
1330,
24306,
198,
6738,
24936,
47010,
1330,
18630,
1961,
31098,
62,
3398,
22846,
37142,
11,
44521,
62,
15112,
1961,
31098,
62,
3398,
22846,
3698,
198,
6738,
42410,
21950,
1330,
42410,
21950,
198,
6738,
5740,
17171,
21950,
1330,
5740,
17171,
21950,
198,
6738,
3811,
2256,
21950,
1330,
3811,
2256,
21950,
198,
6738,
5616,
29512,
47546,
1330,
7078,
62,
9630,
62,
1462,
62,
8841,
198,
6738,
26304,
17563,
273,
21950,
1330,
26304,
17563,
273,
21950,
198,
6738,
5740,
17171,
47,
363,
20900,
1330,
5740,
17171,
47,
363,
20900,
198,
41359,
62,
16580,
62,
24706,
20673,
796,
767
] | 3.968254 | 189 |
# MIT License
# Copyright (c) 2021 xadrianzetx
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from enum import Enum
| [
2,
17168,
13789,
198,
198,
2,
15069,
357,
66,
8,
33448,
2124,
324,
4484,
89,
316,
87,
198,
198,
2,
2448,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
4866,
198,
2,
286,
428,
3788,
290,
3917,
10314,
3696,
357,
1169,
366,
25423,
12340,
284,
1730,
198,
2,
287,
262,
10442,
1231,
17504,
11,
1390,
1231,
17385,
262,
2489,
198,
2,
284,
779,
11,
4866,
11,
13096,
11,
20121,
11,
7715,
11,
14983,
11,
850,
43085,
11,
290,
14,
273,
3677,
198,
2,
9088,
286,
262,
10442,
11,
290,
284,
8749,
6506,
284,
4150,
262,
10442,
318,
198,
2,
30760,
284,
466,
523,
11,
2426,
284,
262,
1708,
3403,
25,
198,
198,
2,
383,
2029,
6634,
4003,
290,
428,
7170,
4003,
2236,
307,
3017,
287,
477,
198,
2,
9088,
393,
8904,
16690,
286,
262,
10442,
13,
198,
198,
2,
3336,
47466,
3180,
36592,
2389,
1961,
366,
1921,
3180,
1600,
42881,
34764,
56,
3963,
15529,
509,
12115,
11,
7788,
32761,
6375,
198,
2,
8959,
49094,
11,
47783,
2751,
21728,
5626,
40880,
5390,
3336,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
11,
198,
2,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
44521,
1268,
10913,
2751,
12529,
13,
3268,
8005,
49261,
50163,
3336,
198,
2,
37195,
20673,
6375,
27975,
38162,
9947,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
198,
2,
43031,
25382,
11,
7655,
2767,
16879,
3268,
3537,
40282,
3963,
27342,
10659,
11,
309,
9863,
6375,
25401,
54,
24352,
11,
5923,
1797,
2751,
16034,
11,
198,
2,
16289,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
47466,
6375,
3336,
23210,
6375,
25401,
5550,
1847,
20754,
3268,
3336,
198,
2,
47466,
13,
198,
198,
6738,
33829,
1330,
2039,
388,
628,
628
] | 3.823729 | 295 |
import os
import prody as pr
# Manipulate rcsb file
def organize_rcsb_file(workdir = "/mnt/e/DesignData/ligands/NI_rcsb/"):
'''
The .csv files downloaded from rcsb database will be combined first,
then generate tab deliminated txt file.
'''
all_lines = []
for file in os.listdir(workdir):
if file.endswith(".csv"):
with open(workdir + file, 'r') as f:
all_lines.extend(f.readlines())
with open(workdir + 'all_rcsb.txt', 'w') as f:
f.write('\t'.join(all_lines[0].split(',')))
for r in all_lines:
if 'Entry ID' not in r and r.split(',')[0]!= '':
f.write('\t'.join(r.split(',')))
# download rcsb pdb files
| [
11748,
28686,
198,
11748,
386,
9892,
355,
778,
628,
198,
2,
35045,
5039,
374,
6359,
65,
2393,
198,
198,
4299,
16481,
62,
6015,
36299,
62,
7753,
7,
1818,
15908,
796,
12813,
76,
429,
14,
68,
14,
23067,
6601,
14,
4604,
1746,
14,
22125,
62,
6015,
36299,
30487,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
383,
764,
40664,
3696,
15680,
422,
374,
6359,
65,
6831,
481,
307,
5929,
717,
11,
220,
198,
220,
220,
220,
788,
7716,
7400,
46728,
3898,
256,
742,
2393,
13,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
477,
62,
6615,
796,
17635,
198,
220,
220,
220,
329,
2393,
287,
28686,
13,
4868,
15908,
7,
1818,
15908,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2393,
13,
437,
2032,
342,
7,
1911,
40664,
1,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
1818,
15908,
1343,
2393,
11,
705,
81,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
477,
62,
6615,
13,
2302,
437,
7,
69,
13,
961,
6615,
28955,
198,
220,
220,
220,
351,
1280,
7,
1818,
15908,
1343,
705,
439,
62,
6015,
36299,
13,
14116,
3256,
705,
86,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
59,
83,
4458,
22179,
7,
439,
62,
6615,
58,
15,
4083,
35312,
7,
41707,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
329,
374,
287,
477,
62,
6615,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
30150,
4522,
6,
407,
287,
374,
290,
374,
13,
35312,
7,
3256,
11537,
58,
15,
60,
0,
28,
10148,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
10786,
59,
83,
4458,
22179,
7,
81,
13,
35312,
7,
41707,
22305,
198,
198,
2,
4321,
374,
6359,
65,
279,
9945,
3696,
628
] | 2.159639 | 332 |
import os
import json
import boto3
REGION = 'us-east-2'
session = boto3.session.Session(profile_name='sandbox')
#iam = boto3.resource('iam', region_name=REGION)
policy = {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:DeleteVolume",
"Resource": "arn:aws:ec2:us-east-2:xxxxx:volume/*"
},
{
"Effect": "Allow",
"Action": "ec2:DeleteSnapshot",
"Resource": "arn:aws:ec2:us-east-2:xxxxx:snapshot/*"
},
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"autoscaling:SetDesiredCapacity",
"ssm:DescribeParameters",
"autoscaling:DescribeAutoScalingGroups",
"ec2:DescribeVolumes",
"ec2:DescribeSnapshots"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "ssm:GetParameters",
"Resource": "arn:aws:ssm:us-east-2:xxxxx:parameter/mysandbox/*"
},
{
"Effect": "Allow",
"Action": "ssm:PutParameter",
"Resource": "arn:aws:ssm:us-east-2:xxxxx:parameter/mysandbox/*"
},
{
"Effect": "Allow",
"Action": [
"ec2:TerminateInstances",
"ec2:StopInstances"
],
"Resource": "arn:aws:ec2:us-east-2:xxxxx:instance/*"
}
]
}
parameterRoot = '/AccountCleaner/'
retentionDays = 7
ssm = session.client('ssm', region_name=REGION)
ssm.put_parameter(
Name=parameterRoot + 'retentionDays',
Description='Days to retain snapsots',
Value=str(retentionDays),
Type='String',
Overwrite=True)
ssm.put_parameter(
Name=parameterRoot + 'Enalbed',
Description='Flag to turn off cleaner lambdas globally',
Value='True',
Type='String',
Overwrite=True)
ssm.put_parameter(
Name=parameterRoot + 'DryRun',
Description='Flag to turn dry run on for cleaner lambdas globally',
Value='False',
Type='String',
Overwrite=True) | [
11748,
28686,
198,
11748,
33918,
198,
11748,
275,
2069,
18,
198,
198,
31553,
2849,
796,
705,
385,
12,
23316,
12,
17,
6,
198,
198,
29891,
796,
275,
2069,
18,
13,
29891,
13,
36044,
7,
13317,
62,
3672,
11639,
38142,
3524,
11537,
198,
198,
2,
1789,
796,
275,
2069,
18,
13,
31092,
10786,
1789,
3256,
3814,
62,
3672,
28,
31553,
2849,
8,
198,
198,
30586,
796,
1391,
198,
220,
220,
220,
366,
14815,
1298,
366,
6999,
12,
940,
12,
1558,
1600,
198,
220,
220,
220,
366,
48682,
1298,
685,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18610,
1298,
366,
35265,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12502,
1298,
366,
721,
17,
25,
38727,
31715,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
26198,
1298,
366,
1501,
25,
8356,
25,
721,
17,
25,
385,
12,
23316,
12,
17,
25,
12343,
87,
25,
29048,
15211,
1,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18610,
1298,
366,
35265,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12502,
1298,
366,
721,
17,
25,
38727,
43826,
9442,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
26198,
1298,
366,
1501,
25,
8356,
25,
721,
17,
25,
385,
12,
23316,
12,
17,
25,
12343,
87,
25,
45380,
9442,
15211,
1,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18610,
1298,
366,
35265,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12502,
1298,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
721,
17,
25,
24564,
4892,
6310,
1817,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2306,
17500,
4272,
25,
7248,
5960,
1202,
15610,
4355,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
824,
76,
25,
24564,
4892,
48944,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2306,
17500,
4272,
25,
24564,
4892,
27722,
3351,
4272,
38,
14459,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
721,
17,
25,
24564,
4892,
16598,
8139,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
721,
17,
25,
24564,
4892,
43826,
20910,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
26198,
1298,
366,
9,
1,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18610,
1298,
366,
35265,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12502,
1298,
366,
824,
76,
25,
3855,
48944,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
26198,
1298,
366,
1501,
25,
8356,
25,
824,
76,
25,
385,
12,
23316,
12,
17,
25,
12343,
87,
25,
17143,
2357,
14,
28744,
392,
3524,
15211,
1,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18610,
1298,
366,
35265,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12502,
1298,
366,
824,
76,
25,
11588,
36301,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
26198,
1298,
366,
1501,
25,
8356,
25,
824,
76,
25,
385,
12,
23316,
12,
17,
25,
12343,
87,
25,
17143,
2357,
14,
28744,
392,
3524,
15211,
1,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18610,
1298,
366,
35265,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12502,
1298,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
721,
17,
25,
44798,
378,
6310,
1817,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
721,
17,
25,
19485,
6310,
1817,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
26198,
1298,
366,
1501,
25,
8356,
25,
721,
17,
25,
385,
12,
23316,
12,
17,
25,
12343,
87,
25,
39098,
15211,
1,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
2361,
198,
92,
198,
198,
17143,
2357,
30016,
796,
31051,
30116,
32657,
263,
14,
6,
198,
1186,
1463,
38770,
796,
767,
198,
198,
824,
76,
796,
6246,
13,
16366,
10786,
824,
76,
3256,
3814,
62,
3672,
28,
31553,
2849,
8,
198,
824,
76,
13,
1996,
62,
17143,
2357,
7,
198,
220,
220,
220,
6530,
28,
17143,
2357,
30016,
1343,
705,
1186,
1463,
38770,
3256,
198,
220,
220,
220,
12489,
11639,
38770,
284,
12377,
23429,
1747,
3256,
198,
220,
220,
220,
11052,
28,
2536,
7,
1186,
1463,
38770,
828,
198,
220,
220,
220,
5994,
11639,
10100,
3256,
198,
220,
220,
220,
3827,
13564,
28,
17821,
8,
198,
198,
824,
76,
13,
1996,
62,
17143,
2357,
7,
198,
220,
220,
220,
6530,
28,
17143,
2357,
30016,
1343,
705,
4834,
282,
3077,
3256,
198,
220,
220,
220,
12489,
11639,
34227,
284,
1210,
572,
21723,
19343,
67,
292,
18309,
3256,
198,
220,
220,
220,
11052,
11639,
17821,
3256,
198,
220,
220,
220,
5994,
11639,
10100,
3256,
198,
220,
220,
220,
3827,
13564,
28,
17821,
8,
198,
198,
824,
76,
13,
1996,
62,
17143,
2357,
7,
198,
220,
220,
220,
6530,
28,
17143,
2357,
30016,
1343,
705,
35,
563,
10987,
3256,
198,
220,
220,
220,
12489,
11639,
34227,
284,
1210,
5894,
1057,
319,
329,
21723,
19343,
67,
292,
18309,
3256,
198,
220,
220,
220,
11052,
11639,
25101,
3256,
198,
220,
220,
220,
5994,
11639,
10100,
3256,
198,
220,
220,
220,
3827,
13564,
28,
17821,
8
] | 1.945603 | 1,103 |
"""
Dauphin is wrapper module around graphene meant to provide a couple additional
features. Most importantly is a type registry. Instead of referring to
the class that corresponds to the GraphQL type everywhere, you are instead
allows to use the GraphQL string. This solves an immediate short term problem
in that it is quite irritating to manage dependencies in a graphql schema
where the types refer to each other in cyclic fashion. Breaking up a schema
into multiple files without this feature (Python has no notion of forward
declarations) is difficult.
Dauphin is meant to totally wrap graphene. That means if you are viewing a code
sample online or within the graphene docs, one should be be able use
dauphin.ChooseYourClass instead of graphene.ChooseYourClass.
We also use dauphin as disintermediation layer between our application code and
graphene in places where we want additional strictness or more convenient idioms.
e.g.
dauphin.non_null_list(dauphin.String)
as opposed to
graphene.NonNull(graphene.List(graphene.NonNull(graphene.String)))
"""
from functools import partial
import graphene
from graphene.types.definitions import GrapheneGraphQLType, GrapheneObjectType, GrapheneUnionType
from graphene.types.enum import EnumMeta
from graphene.types.generic import GenericScalar
from graphene.types.typemap import TypeMap as GrapheneTypeMap
from graphene.types.typemap import resolve_type
from graphene.utils.subclass_with_meta import SubclassWithMeta_Meta
from graphql.type.introspection import IntrospectionSchema
GRAPHENE_TYPES = [
graphene.ObjectType,
graphene.InputObjectType,
graphene.Interface,
graphene.Scalar,
]
GRAPHENE_BUILT_IN = [
graphene.String,
graphene.Int,
graphene.Float,
graphene.Boolean,
graphene.ID,
GenericScalar,
]
# we change map to map_ in construct_union override because of collision with built-in
# pylint: disable=W0221
| [
37811,
198,
35,
559,
746,
259,
318,
29908,
8265,
1088,
42463,
4001,
284,
2148,
257,
3155,
3224,
198,
40890,
13,
4042,
11003,
318,
257,
2099,
20478,
13,
5455,
286,
9759,
284,
198,
1169,
1398,
326,
24866,
284,
262,
29681,
9711,
2099,
8347,
11,
345,
389,
2427,
198,
47205,
284,
779,
262,
29681,
9711,
4731,
13,
770,
39107,
281,
7103,
1790,
3381,
1917,
198,
259,
326,
340,
318,
2407,
42010,
284,
6687,
20086,
287,
257,
4823,
13976,
32815,
198,
3003,
262,
3858,
3522,
284,
1123,
584,
287,
11700,
291,
6977,
13,
24942,
510,
257,
32815,
198,
20424,
3294,
3696,
1231,
428,
3895,
357,
37906,
468,
645,
9495,
286,
2651,
198,
32446,
24355,
8,
318,
2408,
13,
198,
198,
35,
559,
746,
259,
318,
4001,
284,
6635,
14441,
42463,
13,
1320,
1724,
611,
345,
389,
11681,
257,
2438,
198,
39873,
2691,
393,
1626,
262,
42463,
34165,
11,
530,
815,
307,
307,
1498,
779,
198,
67,
559,
746,
259,
13,
31851,
7120,
9487,
2427,
286,
42463,
13,
31851,
7120,
9487,
13,
198,
198,
1135,
635,
779,
288,
559,
746,
259,
355,
595,
3849,
2379,
341,
7679,
1022,
674,
3586,
2438,
290,
198,
70,
2416,
29473,
287,
4113,
810,
356,
765,
3224,
7646,
1108,
393,
517,
11282,
46205,
3150,
13,
198,
198,
68,
13,
70,
13,
198,
198,
67,
559,
746,
259,
13,
13159,
62,
8423,
62,
4868,
7,
67,
559,
746,
259,
13,
10100,
8,
198,
198,
292,
6886,
284,
198,
198,
70,
2416,
29473,
13,
15419,
35067,
7,
70,
2416,
29473,
13,
8053,
7,
70,
2416,
29473,
13,
15419,
35067,
7,
70,
2416,
29473,
13,
10100,
22305,
198,
198,
37811,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
198,
11748,
42463,
198,
6738,
42463,
13,
19199,
13,
4299,
50101,
1330,
402,
2416,
29473,
37065,
9711,
6030,
11,
402,
2416,
29473,
10267,
6030,
11,
402,
2416,
29473,
38176,
6030,
198,
6738,
42463,
13,
19199,
13,
44709,
1330,
2039,
388,
48526,
198,
6738,
42463,
13,
19199,
13,
41357,
1330,
42044,
3351,
282,
283,
198,
6738,
42463,
13,
19199,
13,
28004,
368,
499,
1330,
5994,
13912,
355,
402,
2416,
29473,
6030,
13912,
198,
6738,
42463,
13,
19199,
13,
28004,
368,
499,
1330,
10568,
62,
4906,
198,
6738,
42463,
13,
26791,
13,
7266,
4871,
62,
4480,
62,
28961,
1330,
3834,
4871,
3152,
48526,
62,
48526,
198,
6738,
4823,
13976,
13,
4906,
13,
600,
305,
31308,
1330,
37219,
31308,
27054,
2611,
198,
198,
10761,
31300,
39267,
62,
9936,
47,
1546,
796,
685,
198,
220,
220,
220,
42463,
13,
10267,
6030,
11,
198,
220,
220,
220,
42463,
13,
20560,
10267,
6030,
11,
198,
220,
220,
220,
42463,
13,
39317,
11,
198,
220,
220,
220,
42463,
13,
3351,
282,
283,
11,
198,
60,
198,
198,
10761,
31300,
39267,
62,
19499,
4146,
51,
62,
1268,
796,
685,
198,
220,
220,
220,
42463,
13,
10100,
11,
198,
220,
220,
220,
42463,
13,
5317,
11,
198,
220,
220,
220,
42463,
13,
43879,
11,
198,
220,
220,
220,
42463,
13,
46120,
13087,
11,
198,
220,
220,
220,
42463,
13,
2389,
11,
198,
220,
220,
220,
42044,
3351,
282,
283,
11,
198,
60,
198,
198,
2,
356,
1487,
3975,
284,
3975,
62,
287,
5678,
62,
24592,
20957,
780,
286,
17661,
351,
3170,
12,
259,
198,
2,
279,
2645,
600,
25,
15560,
28,
54,
15,
26115,
628,
628,
628,
628,
628,
628,
628
] | 3.516423 | 548 |
#!python3.6
print("int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42))
print("int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42))
| [
2,
0,
29412,
18,
13,
21,
198,
4798,
7203,
600,
25,
1391,
15,
25,
67,
19629,
220,
17910,
25,
1391,
15,
25,
87,
19629,
220,
19318,
25,
1391,
15,
25,
78,
19629,
220,
9874,
25,
1391,
15,
25,
65,
92,
1911,
18982,
7,
3682,
4008,
198,
4798,
7203,
600,
25,
1391,
15,
25,
67,
19629,
220,
17910,
25,
1391,
15,
43922,
87,
19629,
220,
19318,
25,
1391,
15,
43922,
78,
19629,
220,
9874,
25,
1391,
15,
43922,
65,
92,
1911,
18982,
7,
3682,
4008,
198
] | 1.823529 | 85 |
from flask import Flask, request
from waitress import serve
from src.config.appConfig import loadAppConfig
from src.logs.loggerFactory import getFileLogger
from src.services.smsSender import SmsApi
# get application config
appConf = loadAppConfig()
# setup logging based on application config
backUpCount = appConf["backUpCount"]
fileRollingHrs = appConf["fileRollingHrs"]
logFilePath = appConf["logFilePath"]
logger = getFileLogger(
"app_logger", logFilePath, backUpCount, fileRollingHrs)
# create webhook server
app = Flask(__name__)
app.secret_key = appConf['flaskSecret']
app.logger = logger
# initialize sms api sender with required parameters from application config
smsApi = SmsApi(appConf["smsUsername"], appConf["smsPassword"],
appConf["persons"], appConf["groups"])
@app.route('/')
@app.route('/api/send-sms/<grpName>', methods=['POST'])
if __name__ == '__main__':
serverMode: str = appConf['mode']
if serverMode.lower() == 'd':
app.run(host=appConf["flaskHost"], port=int(
appConf["flaskPort"]), debug=True)
else:
serve(app, host=appConf["flaskHost"], port=int(
appConf["flaskPort"]), threads=1)
| [
6738,
42903,
1330,
46947,
11,
2581,
198,
6738,
44511,
1330,
4691,
198,
198,
6738,
12351,
13,
11250,
13,
1324,
16934,
1330,
3440,
4677,
16934,
198,
6738,
12351,
13,
6404,
82,
13,
6404,
1362,
22810,
1330,
651,
8979,
11187,
1362,
198,
6738,
12351,
13,
30416,
13,
82,
907,
50,
2194,
1330,
311,
907,
32,
14415,
198,
198,
2,
651,
3586,
4566,
198,
1324,
18546,
796,
3440,
4677,
16934,
3419,
198,
198,
2,
9058,
18931,
1912,
319,
3586,
4566,
198,
1891,
4933,
12332,
796,
598,
18546,
14692,
1891,
4933,
12332,
8973,
198,
7753,
26869,
278,
39,
3808,
796,
598,
18546,
14692,
7753,
26869,
278,
39,
3808,
8973,
198,
6404,
8979,
15235,
796,
598,
18546,
14692,
6404,
8979,
15235,
8973,
198,
6404,
1362,
796,
651,
8979,
11187,
1362,
7,
198,
220,
220,
220,
366,
1324,
62,
6404,
1362,
1600,
2604,
8979,
15235,
11,
736,
4933,
12332,
11,
2393,
26869,
278,
39,
3808,
8,
198,
198,
2,
2251,
3992,
25480,
4382,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
1324,
13,
21078,
62,
2539,
796,
598,
18546,
17816,
2704,
2093,
23725,
20520,
198,
1324,
13,
6404,
1362,
796,
49706,
198,
198,
2,
41216,
895,
82,
40391,
29788,
351,
2672,
10007,
422,
3586,
4566,
198,
82,
907,
32,
14415,
796,
311,
907,
32,
14415,
7,
1324,
18546,
14692,
82,
907,
5842,
13292,
33116,
598,
18546,
14692,
82,
907,
35215,
33116,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
598,
18546,
14692,
19276,
684,
33116,
598,
18546,
14692,
24432,
8973,
8,
628,
198,
31,
1324,
13,
38629,
10786,
14,
11537,
628,
198,
31,
1324,
13,
38629,
10786,
14,
15042,
14,
21280,
12,
82,
907,
14,
27,
2164,
79,
5376,
29,
3256,
5050,
28,
17816,
32782,
6,
12962,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
4382,
19076,
25,
965,
796,
598,
18546,
17816,
14171,
20520,
198,
220,
220,
220,
611,
4382,
19076,
13,
21037,
3419,
6624,
705,
67,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
598,
13,
5143,
7,
4774,
28,
1324,
18546,
14692,
2704,
2093,
17932,
33116,
2493,
28,
600,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
598,
18546,
14692,
2704,
2093,
13924,
8973,
828,
14257,
28,
17821,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4691,
7,
1324,
11,
2583,
28,
1324,
18546,
14692,
2704,
2093,
17932,
33116,
2493,
28,
600,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
598,
18546,
14692,
2704,
2093,
13924,
8973,
828,
14390,
28,
16,
8,
198
] | 2.729358 | 436 |
import torch
from torchvision import transforms, datasets
from torch.utils.data import DataLoader
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
training_data = datasets.CIFAR10(root="data", train=True, download=True,
transform=transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5,0.5,0.5), (0.5,0.5,0.5))
]))
validation_data = datasets.CIFAR10(root="data", train=False, download=True,
transform=transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5,0.5,0.5), (0.5,0.5,0.5))
]))
#Hyper parameters
batch_size = 128
d_lr = 2e-4 #learning rate of discriminator
g_lr = 2e-4 #learning rate of generator
epochs = 20
train_shape = training_data.data.shape[0]
training_loader = DataLoader(training_data,batch_size=batch_size, shuffle=True,pin_memory=True)
validation_loader = DataLoader(validation_data,batch_size=16,shuffle=True,pin_memory=True) | [
11748,
28034,
201,
198,
6738,
28034,
10178,
1330,
31408,
11,
40522,
201,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
17401,
201,
198,
25202,
796,
28034,
13,
25202,
10786,
66,
15339,
6,
611,
28034,
13,
66,
15339,
13,
271,
62,
15182,
3419,
2073,
705,
36166,
11537,
201,
198,
201,
198,
201,
198,
34409,
62,
7890,
796,
40522,
13,
34,
5064,
1503,
940,
7,
15763,
2625,
7890,
1600,
4512,
28,
17821,
11,
4321,
28,
17821,
11,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6121,
28,
7645,
23914,
13,
7293,
577,
26933,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
2514,
51,
22854,
22784,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
26447,
1096,
19510,
15,
13,
20,
11,
15,
13,
20,
11,
15,
13,
20,
828,
357,
15,
13,
20,
11,
15,
13,
20,
11,
15,
13,
20,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2361,
4008,
201,
198,
201,
198,
12102,
341,
62,
7890,
796,
40522,
13,
34,
5064,
1503,
940,
7,
15763,
2625,
7890,
1600,
4512,
28,
25101,
11,
4321,
28,
17821,
11,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6121,
28,
7645,
23914,
13,
7293,
577,
26933,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
2514,
51,
22854,
22784,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
26447,
1096,
19510,
15,
13,
20,
11,
15,
13,
20,
11,
15,
13,
20,
828,
357,
15,
13,
20,
11,
15,
13,
20,
11,
15,
13,
20,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2361,
4008,
201,
198,
201,
198,
2,
38197,
10007,
201,
198,
43501,
62,
7857,
796,
13108,
201,
198,
67,
62,
14050,
796,
362,
68,
12,
19,
1303,
40684,
2494,
286,
6534,
20900,
201,
198,
70,
62,
14050,
796,
362,
68,
12,
19,
1303,
40684,
2494,
286,
17301,
201,
198,
538,
5374,
82,
796,
1160,
201,
198,
201,
198,
27432,
62,
43358,
796,
3047,
62,
7890,
13,
7890,
13,
43358,
58,
15,
60,
201,
198,
34409,
62,
29356,
796,
6060,
17401,
7,
34409,
62,
7890,
11,
43501,
62,
7857,
28,
43501,
62,
7857,
11,
36273,
28,
17821,
11,
11635,
62,
31673,
28,
17821,
8,
201,
198,
12102,
341,
62,
29356,
796,
6060,
17401,
7,
12102,
341,
62,
7890,
11,
43501,
62,
7857,
28,
1433,
11,
1477,
18137,
28,
17821,
11,
11635,
62,
31673,
28,
17821,
8
] | 1.9408 | 625 |
# Copyright 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""helper.py
This file defines a class to implement the various storage service
operations on the lmdb file.
"""
import base64
import hashlib
import lmdb
import struct
import time
import pdo.common.keys as keys
from pdo.service_client.storage import StorageException
import logging
logger = logging.getLogger(__name__)
class BlockMetadata(object) :
"""Implements a wrapper for block metadata.
"""
minimum_expiration_time = 60
@classmethod
class BlockStoreManager(object) :
"""Implements the storage service operations in a way that provides
symmetry with the storage service client.
"""
map_size = 1 << 40
def __init__(self, block_store_file, service_keys = None, create_block_store=False) :
"""Initialize storage service class instance
:param block_store_file string: name of the lmdb file used for block storage
:param service_keys ServiceKeys: ECDSA keys used to sign storage contracts
:param create_block_store boolean: flag to note that missing blockstore file should be created
"""
self.service_keys = service_keys
if self.service_keys is None :
self.service_keys = keys.ServiceKeys.create_service_keys()
self.block_store_env = lmdb.open(
block_store_file,
create=create_block_store,
max_dbs=2,
subdir=False,
sync=False,
map_size=self.map_size)
def close(self) :
"""Sync the database to disk and close the handles
"""
self.block_store_env.sync()
self.block_store_env.close()
self.block_store_env = None
def get_service_info(self) :
"""Return useful information about the service
:return dict: dictionary of information about the storage service
"""
return {'verifying_key' : self.service_keys.verifying_key }
def list_blocks(self, encoding='b64') :
"""Return a list of all block identifiers currently
stored in the database; mostly for debugging purposes
:param encoding string: encoding to use for block identifiers, raw/b64
:return list of string: list of block identifiers
"""
encoding_fn = lambda x : x
if encoding == 'b64' :
encoding_fn = lambda x : base64.urlsafe_b64encode(x).decode()
mdb = self.block_store_env.open_db(b'meta_data')
block_ids = []
with self.block_store_env.begin() as txn :
cursor = txn.cursor(db=mdb)
for key, value in cursor :
block_ids.append(encoding_fn(key))
return block_ids
def get_block(self, block_id, encoding='b64') :
"""Return the data for a block given the hash of the block
:param block_id string: block identifier
:param encoding string: encoding to use for block identifiers, raw/b64
:return string: block data
"""
decoding_fn = lambda x : x
if encoding == 'b64' :
decoding_fn = lambda x : base64.urlsafe_b64decode(x)
block_hash = decoding_fn(block_id)
bdb = self.block_store_env.open_db(b'block_data')
with self.block_store_env.begin() as txn :
block_data = txn.get(block_hash, db=bdb)
return block_data
# return block_data_list
def get_blocks(self, block_ids, encoding='b64') :
"""Return the data for a list of blocks
"""
# the iterator means that we don't have to use as much memory
# for operations that can process the blocks one at a time
return self.__block_iterator__(block_ids, encoding)
def store_block(self, block_data, expiration=60, encoding='b64') :
"""Add a new data block to the store
:param block_data string: binary content of the block
:param encoding string: encoding to use for block identifiers, raw/b64
:return string: block identifier
"""
return self.store_blocks([block_data], expiration, encoding)
def store_blocks(self, block_data_list, expiration=60, encoding='b64') :
"""Save a list of blocks in the store
:param iterable block_data_list: iterable collection of blocks to store
:param expiration int: number of seconds to use for expiration
:param encoding string: encoding to use for block identifiers, raw/b64
:return list of string: list of block identifiers
"""
encoding_fn = lambda x : x
if encoding == 'b64' :
encoding_fn = lambda x : base64.urlsafe_b64encode(x).decode()
current_time = int(time.time())
expiration_time = current_time + expiration
mdb = self.block_store_env.open_db(b'meta_data')
bdb = self.block_store_env.open_db(b'block_data')
block_hashes = []
# this might keep the database locked for too long for a write transaction
# might want to flip the order, one transaction per update
with self.block_store_env.begin(write=True) as txn :
for block_data in block_data_list :
block_hash = hashlib.sha256(block_data).digest()
block_hashes.append(block_hash)
# need to check to see if the block already exists, if it
# does then just extend the expiration time if necessary
raw_metadata = txn.get(block_hash, db=mdb)
if raw_metadata :
metadata = BlockMetadata.unpack(raw_metadata)
if expiration_time > metadata.expiration_time :
metadata.expiration_time = expiration_time
if not txn.put(block_hash, metadata.pack(), db=mdb, overwrite=True) :
raise StorageException("failed to update metadata")
continue
# this is a new block that needs to be added
metadata = BlockMetadata()
metadata.block_size = len(block_data)
metadata.create_time = current_time
metadata.expiration_time = expiration_time
metadata.mark = 0
if not txn.put(block_hash, metadata.pack(), db=mdb) :
raise StorageException("failed to save metadata")
if not txn.put(block_hash, block_data, db=bdb) :
raise StorageException("failed to save block data")
try :
# going to just concatenate all hashes, safe since these are all fixed size
signing_hash_accumulator = expiration.to_bytes(32, byteorder='big', signed=False)
signing_hash_accumulator += b''.join(block_hashes)
signing_hash = hashlib.sha256(signing_hash_accumulator).digest()
signature = self.service_keys.sign(signing_hash, encoding=encoding)
except Exception as e :
logger.error("unknown exception packing response (BlockStatus); %s", str(e))
return StorageException('signature failed')
result = dict()
result['signature'] = signature
result['block_ids'] = list(map(encoding_fn, block_hashes))
return result
def check_blocks(self, block_ids, encoding='b64') :
"""Check status of a list of block
:param block_ids list of string: block identifiers
:param encoding string: encoding to use for block identifiers, raw/b64
:return list of dict: list of block status
"""
decoding_fn = lambda x : x
if encoding == 'b64' :
decoding_fn = lambda x : base64.urlsafe_b64decode(x)
current_time = int(time.time())
mdb = self.block_store_env.open_db(b'meta_data')
block_status_list = []
with self.block_store_env.begin() as txn :
for block_id in block_ids :
# use the input format for the output block identifier
block_status = { 'block_id' : block_id, 'size' : 0, 'expiration' : 0 }
block_hash = decoding_fn(block_id)
raw_metadata = txn.get(block_hash, db=mdb)
if raw_metadata :
metadata = BlockMetadata.unpack(raw_metadata)
block_status['size'] = metadata.block_size
block_status['expiration'] = metadata.expiration_time - current_time
if block_status['expiration'] < 0 :
block_status['expiration'] = 0
block_status_list.append(block_status)
return block_status_list
def expire_blocks(self) :
"""Delete data and metadata for blocks that have expired
"""
try :
mdb = self.block_store_env.open_db(b'meta_data')
bdb = self.block_store_env.open_db(b'block_data')
current_time = int(time.time())
count = 0
with self.block_store_env.begin() as txn :
cursor = txn.cursor(db=mdb)
for key, value in cursor :
metadata = BlockMetadata.unpack(value)
if metadata.expiration_time < current_time :
logger.debug('expire block %s',base64.urlsafe_b64encode(key).decode())
count += 1
with self.block_store_env.begin(write=True) as dtxn :
assert dtxn.delete(key, db=bdb)
assert dtxn.delete(key, db=mdb)
logger.info('expired %d blocks', count)
except Exception as e :
logger.error('garbage collection failed; %s', str(e))
return None
return count
| [
2,
15069,
13130,
8180,
10501,
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,
198,
37811,
2978,
525,
13,
9078,
198,
198,
1212,
2393,
15738,
257,
1398,
284,
3494,
262,
2972,
6143,
2139,
198,
3575,
602,
319,
262,
300,
9132,
65,
2393,
13,
198,
37811,
198,
198,
11748,
2779,
2414,
198,
11748,
12234,
8019,
198,
11748,
300,
9132,
65,
198,
11748,
2878,
198,
11748,
640,
198,
198,
11748,
279,
4598,
13,
11321,
13,
13083,
355,
8251,
198,
6738,
279,
4598,
13,
15271,
62,
16366,
13,
35350,
1330,
20514,
16922,
198,
198,
11748,
18931,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
198,
4871,
9726,
9171,
14706,
7,
15252,
8,
1058,
198,
220,
220,
220,
37227,
3546,
1154,
902,
257,
29908,
329,
2512,
20150,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
5288,
62,
1069,
10514,
62,
2435,
796,
3126,
628,
220,
220,
220,
2488,
4871,
24396,
198,
198,
4871,
9726,
22658,
13511,
7,
15252,
8,
1058,
198,
220,
220,
220,
37227,
3546,
1154,
902,
262,
6143,
2139,
4560,
287,
257,
835,
326,
3769,
198,
220,
220,
220,
40686,
351,
262,
6143,
2139,
5456,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
3975,
62,
7857,
796,
352,
9959,
2319,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2512,
62,
8095,
62,
7753,
11,
2139,
62,
13083,
796,
6045,
11,
2251,
62,
9967,
62,
8095,
28,
25101,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
6143,
2139,
1398,
4554,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2512,
62,
8095,
62,
7753,
4731,
25,
1438,
286,
262,
300,
9132,
65,
2393,
973,
329,
2512,
6143,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2139,
62,
13083,
4809,
40729,
25,
412,
8610,
4090,
8251,
973,
284,
1051,
6143,
8592,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2251,
62,
9967,
62,
8095,
25131,
25,
6056,
284,
3465,
326,
4814,
2512,
8095,
2393,
815,
307,
2727,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15271,
62,
13083,
796,
2139,
62,
13083,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
15271,
62,
13083,
318,
6045,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15271,
62,
13083,
796,
8251,
13,
16177,
40729,
13,
17953,
62,
15271,
62,
13083,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9967,
62,
8095,
62,
24330,
796,
300,
9132,
65,
13,
9654,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
8095,
62,
7753,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2251,
28,
17953,
62,
9967,
62,
8095,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
67,
1443,
28,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
850,
15908,
28,
25101,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17510,
28,
25101,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3975,
62,
7857,
28,
944,
13,
8899,
62,
7857,
8,
628,
220,
220,
220,
825,
1969,
7,
944,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
28985,
262,
6831,
284,
11898,
290,
1969,
262,
17105,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
27261,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9967,
62,
8095,
62,
24330,
796,
6045,
628,
220,
220,
220,
825,
651,
62,
15271,
62,
10951,
7,
944,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
4465,
1321,
546,
262,
2139,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
8633,
25,
22155,
286,
1321,
546,
262,
6143,
2139,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1391,
6,
332,
4035,
62,
2539,
6,
1058,
2116,
13,
15271,
62,
13083,
13,
332,
4035,
62,
2539,
1782,
628,
220,
220,
220,
825,
1351,
62,
27372,
7,
944,
11,
21004,
11639,
65,
2414,
11537,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
257,
1351,
286,
477,
2512,
42814,
3058,
198,
220,
220,
220,
220,
220,
220,
220,
8574,
287,
262,
6831,
26,
4632,
329,
28769,
4959,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
21004,
4731,
25,
21004,
284,
779,
329,
2512,
42814,
11,
8246,
14,
65,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
1351,
286,
4731,
25,
1351,
286,
2512,
42814,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
21004,
62,
22184,
796,
37456,
2124,
1058,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
611,
21004,
6624,
705,
65,
2414,
6,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21004,
62,
22184,
796,
37456,
2124,
1058,
2779,
2414,
13,
6371,
21230,
62,
65,
2414,
268,
8189,
7,
87,
737,
12501,
1098,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
285,
9945,
796,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
9654,
62,
9945,
7,
65,
1101,
17167,
62,
7890,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
2340,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
351,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
27471,
3419,
355,
27765,
77,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23493,
796,
27765,
77,
13,
66,
21471,
7,
9945,
28,
9132,
65,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1994,
11,
1988,
287,
23493,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
2340,
13,
33295,
7,
12685,
7656,
62,
22184,
7,
2539,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2512,
62,
2340,
628,
220,
220,
220,
825,
651,
62,
9967,
7,
944,
11,
2512,
62,
312,
11,
21004,
11639,
65,
2414,
11537,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
262,
1366,
329,
257,
2512,
1813,
262,
12234,
286,
262,
2512,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2512,
62,
312,
4731,
25,
2512,
27421,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
21004,
4731,
25,
21004,
284,
779,
329,
2512,
42814,
11,
8246,
14,
65,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
4731,
25,
2512,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
39938,
62,
22184,
796,
37456,
2124,
1058,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
611,
21004,
6624,
705,
65,
2414,
6,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
39938,
62,
22184,
796,
37456,
2124,
1058,
2779,
2414,
13,
6371,
21230,
62,
65,
2414,
12501,
1098,
7,
87,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
17831,
796,
39938,
62,
22184,
7,
9967,
62,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
275,
9945,
796,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
9654,
62,
9945,
7,
65,
6,
9967,
62,
7890,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
351,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
27471,
3419,
355,
27765,
77,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
7890,
796,
27765,
77,
13,
1136,
7,
9967,
62,
17831,
11,
20613,
28,
65,
9945,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2512,
62,
7890,
628,
220,
220,
220,
1303,
1441,
2512,
62,
7890,
62,
4868,
628,
220,
220,
220,
825,
651,
62,
27372,
7,
944,
11,
2512,
62,
2340,
11,
21004,
11639,
65,
2414,
11537,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
262,
1366,
329,
257,
1351,
286,
7021,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
262,
41313,
1724,
326,
356,
836,
470,
423,
284,
779,
355,
881,
4088,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
329,
4560,
326,
460,
1429,
262,
7021,
530,
379,
257,
640,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
834,
9967,
62,
48727,
834,
7,
9967,
62,
2340,
11,
21004,
8,
628,
220,
220,
220,
825,
3650,
62,
9967,
7,
944,
11,
2512,
62,
7890,
11,
28385,
28,
1899,
11,
21004,
11639,
65,
2414,
11537,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
4550,
257,
649,
1366,
2512,
284,
262,
3650,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2512,
62,
7890,
4731,
25,
13934,
2695,
286,
262,
2512,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
21004,
4731,
25,
21004,
284,
779,
329,
2512,
42814,
11,
8246,
14,
65,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
4731,
25,
2512,
27421,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
8095,
62,
27372,
26933,
9967,
62,
7890,
4357,
28385,
11,
21004,
8,
628,
220,
220,
220,
825,
3650,
62,
27372,
7,
944,
11,
2512,
62,
7890,
62,
4868,
11,
28385,
28,
1899,
11,
21004,
11639,
65,
2414,
11537,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
16928,
257,
1351,
286,
7021,
287,
262,
3650,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
11629,
540,
2512,
62,
7890,
62,
4868,
25,
11629,
540,
4947,
286,
7021,
284,
3650,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
28385,
493,
25,
1271,
286,
4201,
284,
779,
329,
28385,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
21004,
4731,
25,
21004,
284,
779,
329,
2512,
42814,
11,
8246,
14,
65,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
1351,
286,
4731,
25,
1351,
286,
2512,
42814,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
21004,
62,
22184,
796,
37456,
2124,
1058,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
611,
21004,
6624,
705,
65,
2414,
6,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21004,
62,
22184,
796,
37456,
2124,
1058,
2779,
2414,
13,
6371,
21230,
62,
65,
2414,
268,
8189,
7,
87,
737,
12501,
1098,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
2435,
796,
493,
7,
2435,
13,
2435,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
28385,
62,
2435,
796,
1459,
62,
2435,
1343,
28385,
628,
220,
220,
220,
220,
220,
220,
220,
285,
9945,
796,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
9654,
62,
9945,
7,
65,
1101,
17167,
62,
7890,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
275,
9945,
796,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
9654,
62,
9945,
7,
65,
6,
9967,
62,
7890,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
71,
7465,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
428,
1244,
1394,
262,
6831,
8970,
329,
1165,
890,
329,
257,
3551,
8611,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1244,
765,
284,
14283,
262,
1502,
11,
530,
8611,
583,
4296,
198,
220,
220,
220,
220,
220,
220,
220,
351,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
27471,
7,
13564,
28,
17821,
8,
355,
27765,
77,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2512,
62,
7890,
287,
2512,
62,
7890,
62,
4868,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
17831,
796,
12234,
8019,
13,
26270,
11645,
7,
9967,
62,
7890,
737,
12894,
395,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
71,
7465,
13,
33295,
7,
9967,
62,
17831,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
761,
284,
2198,
284,
766,
611,
262,
2512,
1541,
7160,
11,
611,
340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
857,
788,
655,
9117,
262,
28385,
640,
611,
3306,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8246,
62,
38993,
796,
27765,
77,
13,
1136,
7,
9967,
62,
17831,
11,
20613,
28,
9132,
65,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
8246,
62,
38993,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
796,
9726,
9171,
14706,
13,
403,
8002,
7,
1831,
62,
38993,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
28385,
62,
2435,
1875,
20150,
13,
1069,
10514,
62,
2435,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
1069,
10514,
62,
2435,
796,
28385,
62,
2435,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
27765,
77,
13,
1996,
7,
9967,
62,
17831,
11,
20150,
13,
8002,
22784,
20613,
28,
9132,
65,
11,
49312,
28,
17821,
8,
1058,
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,
5298,
20514,
16922,
7203,
47904,
284,
4296,
20150,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
428,
318,
257,
649,
2512,
326,
2476,
284,
307,
2087,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
796,
9726,
9171,
14706,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
9967,
62,
7857,
796,
18896,
7,
9967,
62,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
17953,
62,
2435,
796,
1459,
62,
2435,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
1069,
10514,
62,
2435,
796,
28385,
62,
2435,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
13,
4102,
796,
657,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
27765,
77,
13,
1996,
7,
9967,
62,
17831,
11,
20150,
13,
8002,
22784,
20613,
28,
9132,
65,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
20514,
16922,
7203,
47904,
284,
3613,
20150,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
27765,
77,
13,
1996,
7,
9967,
62,
17831,
11,
2512,
62,
7890,
11,
20613,
28,
65,
9945,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
20514,
16922,
7203,
47904,
284,
3613,
2512,
1366,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1949,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1016,
284,
655,
1673,
36686,
378,
477,
46621,
11,
3338,
1201,
777,
389,
477,
5969,
2546,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8415,
62,
17831,
62,
4134,
388,
8927,
796,
28385,
13,
1462,
62,
33661,
7,
2624,
11,
18022,
2875,
11639,
14261,
3256,
4488,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8415,
62,
17831,
62,
4134,
388,
8927,
15853,
275,
35384,
22179,
7,
9967,
62,
71,
7465,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8415,
62,
17831,
796,
12234,
8019,
13,
26270,
11645,
7,
12683,
278,
62,
17831,
62,
4134,
388,
8927,
737,
12894,
395,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9877,
796,
2116,
13,
15271,
62,
13083,
13,
12683,
7,
12683,
278,
62,
17831,
11,
21004,
28,
12685,
7656,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
304,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7203,
34680,
6631,
24157,
2882,
357,
12235,
19580,
1776,
4064,
82,
1600,
965,
7,
68,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
20514,
16922,
10786,
12683,
1300,
4054,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
8633,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
17816,
12683,
1300,
20520,
796,
9877,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
17816,
9967,
62,
2340,
20520,
796,
1351,
7,
8899,
7,
12685,
7656,
62,
22184,
11,
2512,
62,
71,
7465,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1255,
628,
220,
220,
220,
825,
2198,
62,
27372,
7,
944,
11,
2512,
62,
2340,
11,
21004,
11639,
65,
2414,
11537,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
9787,
3722,
286,
257,
1351,
286,
2512,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2512,
62,
2340,
1351,
286,
4731,
25,
2512,
42814,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
21004,
4731,
25,
21004,
284,
779,
329,
2512,
42814,
11,
8246,
14,
65,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
1351,
286,
8633,
25,
1351,
286,
2512,
3722,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
39938,
62,
22184,
796,
37456,
2124,
1058,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
611,
21004,
6624,
705,
65,
2414,
6,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
39938,
62,
22184,
796,
37456,
2124,
1058,
2779,
2414,
13,
6371,
21230,
62,
65,
2414,
12501,
1098,
7,
87,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
2435,
796,
493,
7,
2435,
13,
2435,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
285,
9945,
796,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
9654,
62,
9945,
7,
65,
1101,
17167,
62,
7890,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
13376,
62,
4868,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
351,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
27471,
3419,
355,
27765,
77,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2512,
62,
312,
287,
2512,
62,
2340,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
262,
5128,
5794,
329,
262,
5072,
2512,
27421,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
13376,
796,
1391,
705,
9967,
62,
312,
6,
1058,
2512,
62,
312,
11,
705,
7857,
6,
1058,
657,
11,
705,
1069,
10514,
6,
1058,
657,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
17831,
796,
39938,
62,
22184,
7,
9967,
62,
312,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8246,
62,
38993,
796,
27765,
77,
13,
1136,
7,
9967,
62,
17831,
11,
20613,
28,
9132,
65,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
8246,
62,
38993,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
796,
9726,
9171,
14706,
13,
403,
8002,
7,
1831,
62,
38993,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
13376,
17816,
7857,
20520,
796,
20150,
13,
9967,
62,
7857,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
13376,
17816,
1069,
10514,
20520,
796,
20150,
13,
1069,
10514,
62,
2435,
532,
1459,
62,
2435,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2512,
62,
13376,
17816,
1069,
10514,
20520,
1279,
657,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
13376,
17816,
1069,
10514,
20520,
796,
657,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
62,
13376,
62,
4868,
13,
33295,
7,
9967,
62,
13376,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2512,
62,
13376,
62,
4868,
628,
220,
220,
220,
825,
24264,
62,
27372,
7,
944,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
38727,
1366,
290,
20150,
329,
7021,
326,
423,
21350,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
9945,
796,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
9654,
62,
9945,
7,
65,
1101,
17167,
62,
7890,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
9945,
796,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
9654,
62,
9945,
7,
65,
6,
9967,
62,
7890,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
2435,
796,
493,
7,
2435,
13,
2435,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
27471,
3419,
355,
27765,
77,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23493,
796,
27765,
77,
13,
66,
21471,
7,
9945,
28,
9132,
65,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1994,
11,
1988,
287,
23493,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
796,
9726,
9171,
14706,
13,
403,
8002,
7,
8367,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
20150,
13,
1069,
10514,
62,
2435,
1279,
1459,
62,
2435,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
10786,
1069,
5111,
2512,
4064,
82,
3256,
8692,
2414,
13,
6371,
21230,
62,
65,
2414,
268,
8189,
7,
2539,
737,
12501,
1098,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
2116,
13,
9967,
62,
8095,
62,
24330,
13,
27471,
7,
13564,
28,
17821,
8,
355,
288,
17602,
77,
1058,
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,
6818,
288,
17602,
77,
13,
33678,
7,
2539,
11,
20613,
28,
65,
9945,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6818,
288,
17602,
77,
13,
33678,
7,
2539,
11,
20613,
28,
9132,
65,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
1069,
6474,
4064,
67,
7021,
3256,
954,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
304,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
10786,
4563,
13866,
4947,
4054,
26,
4064,
82,
3256,
965,
7,
68,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
954,
198
] | 2.37895 | 4,304 |
import pymc as pm
import pymc.gp as gp
from pymc.gp.cov_funs import matern
import numpy as np
import matplotlib.pyplot as pl
from numpy.random import normal
x = np.arange(-1.,1.,.1)
# Prior parameters of C
diff_degree = pm.Uniform('diff_degree', .1, 3)
amp = pm.Lognormal('amp', mu=.4, tau=1.)
scale = pm.Lognormal('scale', mu=.5, tau=1.)
# The covariance dtrm C is valued as a Covariance object.
@pm.deterministic
# Prior parameters of M
a = pm.Normal('a', mu=1., tau=1.)
b = pm.Normal('b', mu=.5, tau=1.)
c = pm.Normal('c', mu=2., tau=1.)
# The mean M is valued as a Mean object.
@pm.deterministic
# The GP itself
fmesh = np.linspace(-np.pi/3.3,np.pi/3.3,4)
f = gp.GP(name="f", M=M, C=C, mesh=fmesh, init_mesh_vals = 0.*fmesh)
# Observation precision
# V = Gamma('V', alpha=3., beta=3./.002, value=.002)
V = .0001
# The data d is just array-valued. It's normally distributed about GP.f(obs_x).
@pm.observed
@pm.stochastic
def d(value=np.random.normal(size=len(fmesh)), mu=f, V=V):
"""
Data
"""
mu_eval = mu(fmesh)
return pm.flib.normal(value, mu_eval, 1./V)
| [
11748,
279,
4948,
66,
355,
9114,
198,
11748,
279,
4948,
66,
13,
31197,
355,
27809,
198,
6738,
279,
4948,
66,
13,
31197,
13,
66,
709,
62,
12543,
82,
1330,
285,
9205,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
198,
198,
6738,
299,
32152,
13,
25120,
1330,
3487,
628,
198,
198,
87,
796,
45941,
13,
283,
858,
32590,
16,
1539,
16,
1539,
13,
16,
8,
198,
198,
2,
14481,
10007,
286,
327,
198,
26069,
62,
16863,
796,
9114,
13,
3118,
6933,
10786,
26069,
62,
16863,
3256,
764,
16,
11,
513,
8,
198,
696,
796,
9114,
13,
43,
2360,
6636,
10786,
696,
3256,
38779,
28,
13,
19,
11,
256,
559,
28,
16,
2014,
198,
9888,
796,
9114,
13,
43,
2360,
6636,
10786,
9888,
3256,
38779,
28,
13,
20,
11,
256,
559,
28,
16,
2014,
198,
198,
2,
383,
44829,
590,
288,
2213,
76,
327,
318,
17560,
355,
257,
39751,
2743,
590,
2134,
13,
198,
31,
4426,
13,
67,
2357,
49228,
628,
198,
2,
14481,
10007,
286,
337,
198,
64,
796,
9114,
13,
26447,
10786,
64,
3256,
38779,
28,
16,
1539,
256,
559,
28,
16,
2014,
198,
65,
796,
9114,
13,
26447,
10786,
65,
3256,
38779,
28,
13,
20,
11,
256,
559,
28,
16,
2014,
198,
66,
796,
9114,
13,
26447,
10786,
66,
3256,
38779,
28,
17,
1539,
256,
559,
28,
16,
2014,
198,
198,
2,
383,
1612,
337,
318,
17560,
355,
257,
22728,
2134,
13,
198,
31,
4426,
13,
67,
2357,
49228,
628,
198,
2,
383,
14714,
2346,
198,
38353,
5069,
796,
45941,
13,
21602,
10223,
32590,
37659,
13,
14415,
14,
18,
13,
18,
11,
37659,
13,
14415,
14,
18,
13,
18,
11,
19,
8,
198,
69,
796,
27809,
13,
16960,
7,
3672,
2625,
69,
1600,
337,
28,
44,
11,
327,
28,
34,
11,
19609,
28,
38353,
5069,
11,
2315,
62,
76,
5069,
62,
12786,
796,
657,
15885,
38353,
5069,
8,
628,
198,
2,
11086,
13208,
15440,
198,
2,
569,
796,
43595,
10786,
53,
3256,
17130,
28,
18,
1539,
12159,
28,
18,
13,
11757,
21601,
11,
1988,
28,
13,
21601,
8,
198,
53,
796,
764,
18005,
198,
198,
2,
383,
1366,
288,
318,
655,
7177,
12,
39728,
13,
632,
338,
7685,
9387,
546,
14714,
13,
69,
7,
8158,
62,
87,
737,
198,
31,
4426,
13,
672,
45852,
198,
31,
4426,
13,
301,
5374,
3477,
198,
4299,
288,
7,
8367,
28,
37659,
13,
25120,
13,
11265,
7,
7857,
28,
11925,
7,
38353,
5069,
36911,
38779,
28,
69,
11,
569,
28,
53,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
6060,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
38779,
62,
18206,
796,
38779,
7,
38353,
5069,
8,
198,
220,
220,
220,
1441,
9114,
13,
2704,
571,
13,
11265,
7,
8367,
11,
38779,
62,
18206,
11,
352,
19571,
53,
8,
198
] | 2.332623 | 469 |
import maxflow
# Create a graph with integer capacities.
g = maxflow.Graph[int](2, 2)
# Add two (non-terminal) nodes. Get the index to the first one.
nodes = g.add_nodes(2)
# Create two edges (forwards and backwards) with the given capacities.
# The indices of the nodes are always consecutive.
g.add_edge(nodes[0], nodes[1], 1, 2)
# Set the capacities of the terminal edges...
# ...for the first node.
g.add_tedge(nodes[0], 2, 5)
# ...for the second node.
g.add_tedge(nodes[1], 9, 4)
# Find the maxflow.
flow = g.maxflow()
print("Maximum flow: {}".format(flow))
# Print the segment of each node.
print("Segment of the node 0: {}".format(g.get_segment(nodes[0])))
print("Segment of the node 1: {}".format(g.get_segment(nodes[1])))
| [
11748,
3509,
11125,
198,
198,
2,
13610,
257,
4823,
351,
18253,
32484,
13,
198,
70,
796,
3509,
11125,
13,
37065,
58,
600,
16151,
17,
11,
362,
8,
198,
2,
3060,
734,
357,
13159,
12,
23705,
282,
8,
13760,
13,
3497,
262,
6376,
284,
262,
717,
530,
13,
198,
77,
4147,
796,
308,
13,
2860,
62,
77,
4147,
7,
17,
8,
198,
2,
13610,
734,
13015,
357,
1640,
2017,
290,
16196,
8,
351,
262,
1813,
32484,
13,
198,
2,
383,
36525,
286,
262,
13760,
389,
1464,
12785,
13,
198,
70,
13,
2860,
62,
14907,
7,
77,
4147,
58,
15,
4357,
13760,
58,
16,
4357,
352,
11,
362,
8,
198,
2,
5345,
262,
32484,
286,
262,
12094,
13015,
986,
198,
2,
2644,
1640,
262,
717,
10139,
13,
198,
70,
13,
2860,
62,
1513,
469,
7,
77,
4147,
58,
15,
4357,
362,
11,
642,
8,
198,
2,
2644,
1640,
262,
1218,
10139,
13,
198,
70,
13,
2860,
62,
1513,
469,
7,
77,
4147,
58,
16,
4357,
860,
11,
604,
8,
198,
198,
2,
9938,
262,
3509,
11125,
13,
198,
11125,
796,
308,
13,
9806,
11125,
3419,
198,
4798,
7203,
40541,
5202,
25,
23884,
1911,
18982,
7,
11125,
4008,
198,
198,
2,
12578,
262,
10618,
286,
1123,
10139,
13,
198,
4798,
7203,
41030,
434,
286,
262,
10139,
657,
25,
23884,
1911,
18982,
7,
70,
13,
1136,
62,
325,
5154,
7,
77,
4147,
58,
15,
60,
22305,
198,
4798,
7203,
41030,
434,
286,
262,
10139,
352,
25,
23884,
1911,
18982,
7,
70,
13,
1136,
62,
325,
5154,
7,
77,
4147,
58,
16,
60,
22305,
198
] | 2.823077 | 260 |
#!/usr/bin/env python
"""
Analyze FRC data.
Hazen 01/18
"""
import glob
import storm_analysis.frc.frc_calc2d as frcCalc2d
dirs = sorted(glob.glob("test*"))
total_time = 0.0
for a_dir in dirs:
print()
print("Analyzing:", a_dir)
print()
hdf5 = a_dir + "/test.hdf5"
frc_text = a_dir + "/frc.txt"
# Run FRC analysis.
frcCalc2d.frcCalc2d(hdf5, frc_text)
print()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
198,
37702,
2736,
376,
7397,
1366,
13,
198,
198,
39,
1031,
268,
5534,
14,
1507,
198,
37811,
198,
11748,
15095,
198,
198,
11748,
6388,
62,
20930,
13,
69,
6015,
13,
69,
6015,
62,
9948,
66,
17,
67,
355,
1216,
66,
9771,
66,
17,
67,
198,
198,
15908,
82,
796,
23243,
7,
4743,
672,
13,
4743,
672,
7203,
9288,
9,
48774,
198,
23350,
62,
2435,
796,
657,
13,
15,
198,
1640,
257,
62,
15908,
287,
288,
17062,
25,
198,
220,
220,
220,
3601,
3419,
198,
220,
220,
220,
3601,
7203,
37702,
9510,
25,
1600,
257,
62,
15908,
8,
198,
220,
220,
220,
3601,
3419,
198,
220,
220,
220,
220,
198,
220,
220,
220,
289,
7568,
20,
796,
257,
62,
15908,
1343,
12813,
9288,
13,
71,
7568,
20,
1,
198,
220,
220,
220,
1216,
66,
62,
5239,
796,
257,
62,
15908,
1343,
12813,
69,
6015,
13,
14116,
1,
628,
220,
220,
220,
1303,
5660,
376,
7397,
3781,
13,
198,
220,
220,
220,
1216,
66,
9771,
66,
17,
67,
13,
69,
6015,
9771,
66,
17,
67,
7,
71,
7568,
20,
11,
1216,
66,
62,
5239,
8,
198,
198,
4798,
3419,
198
] | 1.994949 | 198 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.