content
stringlengths 1
1.04M
| input_ids
sequencelengths 1
774k
| ratio_char_token
float64 0.38
22.9
| token_count
int64 1
774k
|
---|---|---|---|
# Copyright (c) 2017, Mayo Clinic
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# Neither the name of the Mayo Clinic nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
import unittest
import os
from fhirtordf.fhir.picklejar import picklejar, picklejarfactory
from tests.utils.base_test_case import make_and_clear_directory
if __name__ == '__main__':
unittest.main()
| [
2,
15069,
357,
66,
8,
2177,
11,
32987,
26690,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
17613,
11,
198,
2,
389,
10431,
2810,
326,
262,
1708,
3403,
389,
1138,
25,
198,
2,
198,
2,
2297,
396,
2455,
507,
286,
2723,
2438,
1276,
12377,
262,
2029,
6634,
4003,
11,
428,
198,
2,
220,
220,
220,
220,
1351,
286,
3403,
290,
262,
1708,
37592,
13,
198,
2,
198,
2,
220,
220,
220,
220,
2297,
396,
2455,
507,
287,
13934,
1296,
1276,
22919,
262,
2029,
6634,
4003,
11,
198,
2,
220,
220,
220,
220,
428,
1351,
286,
3403,
290,
262,
1708,
37592,
287,
262,
10314,
198,
2,
220,
220,
220,
220,
290,
14,
273,
584,
5696,
2810,
351,
262,
6082,
13,
198,
2,
198,
2,
220,
220,
220,
220,
16126,
262,
1438,
286,
262,
32987,
26690,
4249,
262,
3891,
286,
663,
20420,
198,
2,
220,
220,
220,
220,
743,
307,
973,
284,
11438,
393,
7719,
3186,
10944,
422,
428,
3788,
198,
2,
220,
220,
220,
220,
1231,
2176,
3161,
3194,
7170,
13,
198,
2,
198,
2,
12680,
47466,
3180,
36592,
2389,
1961,
11050,
3336,
27975,
38162,
9947,
367,
15173,
4877,
5357,
27342,
9865,
3843,
20673,
366,
1921,
3180,
1,
5357,
198,
2,
15529,
7788,
32761,
6375,
8959,
49094,
34764,
11015,
11,
47783,
2751,
11,
21728,
5626,
40880,
5390,
11,
3336,
8959,
49094,
198,
2,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
5357,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
15986,
13954,
48778,
1961,
13,
198,
2,
3268,
8005,
49261,
50163,
3336,
27975,
38162,
9947,
49707,
14418,
6375,
27342,
9865,
3843,
20673,
9348,
43031,
19146,
7473,
15529,
42242,
11,
198,
2,
3268,
17931,
23988,
11,
19387,
25256,
1847,
11,
38846,
11,
7788,
3620,
6489,
13153,
11,
6375,
7102,
5188,
10917,
3525,
12576,
29506,
25552,
357,
1268,
39149,
2751,
11,
198,
2,
21728,
5626,
40880,
5390,
11,
41755,
11335,
10979,
3963,
28932,
2257,
2043,
37780,
21090,
50,
6375,
49254,
26,
406,
18420,
3963,
23210,
11,
220,
198,
2,
42865,
11,
6375,
4810,
19238,
29722,
26,
6375,
43949,
44180,
23255,
49,
8577,
24131,
8,
29630,
36,
5959,
7257,
2937,
1961,
5357,
6177,
15529,
3336,
15513,
3963,
198,
2,
43031,
25382,
11,
7655,
2767,
16879,
3268,
27342,
10659,
11,
19269,
18379,
43031,
25382,
11,
6375,
309,
9863,
357,
1268,
39149,
2751,
399,
7156,
43,
3528,
18310,
198,
2,
6375,
25401,
54,
24352,
8,
5923,
1797,
2751,
3268,
15529,
34882,
16289,
3963,
3336,
23210,
3963,
12680,
47466,
11,
45886,
16876,
5984,
29817,
1961,
198,
2,
3963,
3336,
28069,
11584,
25382,
3963,
13558,
3398,
29506,
11879,
13,
198,
198,
11748,
555,
715,
395,
198,
198,
11748,
28686,
198,
198,
6738,
277,
49756,
585,
69,
13,
69,
71,
343,
13,
27729,
293,
9491,
1330,
2298,
293,
9491,
11,
2298,
293,
9491,
69,
9548,
198,
6738,
5254,
13,
26791,
13,
8692,
62,
9288,
62,
7442,
1330,
787,
62,
392,
62,
20063,
62,
34945,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 3.399225 | 516 |
# Created by rahman at 15:20 2020-03-05 using PyCharm
import subprocess
from image_attacks.im_utils import slice_files, combine_files, clean_trim, count_cats, make_features_counts, score
from shared_tools.utils import make_allPairs, classifiers, DATAPATH, city
def attack_images(cores, prob_cutoff):
"""
:param cores: how many cores to use for multiprocessing
:param prob_cutoff: user's image belongs to a certain category if the output of the last FC layer of the resnet model for the category > prob_cutoff
:return:
"""
mediaFile = "target_media"
slice_files(mediaFile, DATAPATH, cores)
subprocess.call(['./parallelize_im2proba.sh', cores,
city]) # downloads images and converts to embeddings, shell script calls im2proba.py
prob_file = combine_files(DATAPATH, cores)
clean_file = clean_trim(prob_cutoff, DATAPATH, prob_file)
counts_file = count_cats(DATAPATH, clean_file, countsFile="proba_cut_01_counts.csv" )
allPairs = make_allPairs("avg_pairs.csv", u_list_file=counts_file, DATAPATH=DATAPATH,
friendFile=city + ".target_friends", makeStrangers=True)
data_file = DATAPATH + "im_dataset.csv"
dataset = make_features_counts(DATAPATH, clean_file, data_file, counts_file,
allPairs)
score(dataset, name="mini-counts, cosine, entropy of max cat", classifiers=classifiers)
print ("Created image dataset at", data_file)
return data_file
if __name__ == '__main__':
data_file = attack_images(cores = 120, prob_cutoff = 0.05)
| [
2,
15622,
416,
374,
993,
805,
379,
1315,
25,
1238,
12131,
12,
3070,
12,
2713,
1262,
9485,
1925,
1670,
198,
11748,
850,
14681,
198,
198,
6738,
2939,
62,
38458,
13,
320,
62,
26791,
1330,
16416,
62,
16624,
11,
12082,
62,
16624,
11,
3424,
62,
2213,
320,
11,
954,
62,
24619,
11,
787,
62,
40890,
62,
9127,
82,
11,
4776,
198,
198,
6738,
4888,
62,
31391,
13,
26791,
1330,
787,
62,
439,
47,
3468,
11,
1398,
13350,
11,
360,
1404,
2969,
12599,
11,
1748,
628,
198,
198,
4299,
1368,
62,
17566,
7,
66,
2850,
11,
1861,
62,
8968,
2364,
2599,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1058,
17143,
21758,
25,
703,
867,
21758,
284,
779,
329,
18540,
305,
919,
278,
198,
220,
220,
220,
1058,
17143,
1861,
62,
8968,
2364,
25,
2836,
338,
2939,
14448,
284,
257,
1728,
6536,
611,
262,
5072,
286,
262,
938,
10029,
7679,
286,
262,
581,
3262,
2746,
329,
262,
6536,
220,
1875,
1861,
62,
8968,
2364,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
628,
198,
220,
220,
220,
2056,
8979,
796,
366,
16793,
62,
11431,
1,
628,
220,
220,
220,
16416,
62,
16624,
7,
11431,
8979,
11,
360,
1404,
2969,
12599,
11,
21758,
8,
628,
220,
220,
220,
850,
14681,
13,
13345,
26933,
4458,
14,
1845,
29363,
1096,
62,
320,
17,
1676,
7012,
13,
1477,
3256,
21758,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1748,
12962,
220,
1303,
21333,
4263,
290,
26161,
284,
11525,
67,
654,
11,
7582,
4226,
3848,
545,
17,
1676,
7012,
13,
9078,
628,
220,
220,
220,
1861,
62,
7753,
796,
12082,
62,
16624,
7,
35,
1404,
2969,
12599,
11,
21758,
8,
628,
220,
220,
220,
3424,
62,
7753,
796,
3424,
62,
2213,
320,
7,
1676,
65,
62,
8968,
2364,
11,
360,
1404,
2969,
12599,
11,
1861,
62,
7753,
8,
628,
220,
220,
220,
9853,
62,
7753,
796,
954,
62,
24619,
7,
35,
1404,
2969,
12599,
11,
3424,
62,
7753,
11,
9853,
8979,
2625,
1676,
7012,
62,
8968,
62,
486,
62,
9127,
82,
13,
40664,
1,
1267,
628,
220,
220,
220,
477,
47,
3468,
796,
787,
62,
439,
47,
3468,
7203,
615,
70,
62,
79,
3468,
13,
40664,
1600,
334,
62,
4868,
62,
7753,
28,
9127,
82,
62,
7753,
11,
360,
1404,
2969,
12599,
28,
35,
1404,
2969,
12599,
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,
1545,
8979,
28,
19205,
1343,
27071,
16793,
62,
36154,
1600,
787,
13290,
6606,
28,
17821,
8,
628,
220,
220,
220,
1366,
62,
7753,
796,
360,
1404,
2969,
12599,
1343,
366,
320,
62,
19608,
292,
316,
13,
40664,
1,
628,
220,
220,
220,
27039,
796,
787,
62,
40890,
62,
9127,
82,
7,
35,
1404,
2969,
12599,
11,
3424,
62,
7753,
11,
1366,
62,
7753,
11,
9853,
62,
7753,
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,
477,
47,
3468,
8,
628,
220,
220,
220,
4776,
7,
19608,
292,
316,
11,
1438,
2625,
45313,
12,
9127,
82,
11,
8615,
500,
11,
40709,
286,
3509,
3797,
1600,
1398,
13350,
28,
4871,
13350,
8,
628,
220,
220,
220,
3601,
5855,
41972,
2939,
27039,
379,
1600,
1366,
62,
7753,
8,
628,
220,
220,
220,
1441,
1366,
62,
7753,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
628,
220,
220,
220,
1366,
62,
7753,
796,
1368,
62,
17566,
7,
66,
2850,
796,
7982,
11,
1861,
62,
8968,
2364,
796,
657,
13,
2713,
8,
628,
628,
628,
628,
628,
628,
628
] | 2.545741 | 634 |
import numpy as np
from dr.backend.base import Backend
| [
11748,
299,
32152,
355,
45941,
198,
198,
6738,
1553,
13,
1891,
437,
13,
8692,
1330,
5157,
437,
628
] | 3.166667 | 18 |
from random import randint
from time import sleep
computador = randint(1, 5)
print('\033[34m-==-\033[m'*17)
print('Vamos jogar um jogo, tente adivinhar o número que estou pensando !')
sleep(1)
jogador = int(input('Chute um valor de 1 até 5: '))
print('PROCESSANDO...')
sleep(1)
if jogador == computador:
print('\033[1;32mPARABÉNS, VOCÊ ACERTOU!!\033[m Eu realmente esta pensando no número {} !'.format(computador))
else:
print('\033[1;31mERROUUUU !!\033[m Eu estava pensando no número {} e não no número {}'.format(computador,jogador))
print('\033[34m-==-'*17) | [
6738,
4738,
1330,
43720,
600,
198,
6738,
640,
1330,
3993,
198,
785,
1996,
7079,
796,
43720,
600,
7,
16,
11,
642,
8,
198,
4798,
10786,
59,
44427,
58,
2682,
76,
12,
855,
12,
59,
44427,
58,
76,
6,
9,
1558,
8,
198,
4798,
10786,
53,
321,
418,
48342,
283,
23781,
474,
24076,
11,
11105,
68,
512,
452,
259,
9869,
267,
299,
21356,
647,
78,
8358,
1556,
280,
29707,
25440,
5145,
11537,
198,
42832,
7,
16,
8,
198,
73,
519,
7079,
796,
493,
7,
15414,
10786,
1925,
1133,
23781,
1188,
273,
390,
352,
379,
2634,
642,
25,
705,
4008,
198,
4798,
10786,
4805,
4503,
7597,
6981,
46,
986,
11537,
198,
42832,
7,
16,
8,
198,
198,
361,
48342,
7079,
6624,
2653,
7079,
25,
198,
220,
220,
220,
3601,
10786,
59,
44427,
58,
16,
26,
2624,
76,
27082,
6242,
38351,
8035,
11,
569,
4503,
127,
232,
7125,
17395,
2606,
3228,
59,
44427,
58,
76,
412,
84,
1103,
434,
68,
1556,
64,
29707,
25440,
645,
299,
21356,
647,
78,
23884,
5145,
4458,
18982,
7,
785,
1996,
7079,
4008,
198,
17772,
25,
198,
220,
220,
220,
3601,
10786,
59,
44427,
58,
16,
26,
3132,
76,
1137,
49,
2606,
30100,
52,
37867,
59,
44427,
58,
76,
412,
84,
1556,
4170,
29707,
25440,
645,
299,
21356,
647,
78,
23884,
304,
299,
28749,
645,
299,
21356,
647,
78,
23884,
4458,
18982,
7,
785,
1996,
7079,
11,
73,
519,
7079,
4008,
198,
198,
4798,
10786,
59,
44427,
58,
2682,
76,
12,
855,
19355,
9,
1558,
8
] | 2.298387 | 248 |
from datetime import date
from dateutil.relativedelta import relativedelta
from celery.task import task, group
from django.db.models import Sum, Count
from go.billing import settings
from go.billing.models import (
Account, Transaction, MessageCost, Statement, LineItem)
from go.base.utils import vumi_api
@task()
def generate_monthly_statement(account_id, from_date, to_date):
"""Generate a new *Monthly* ``Statement`` for the given ``account``
between the given ``from_date`` and ``to_date``.
"""
account = Account.objects.get(id=account_id)
tagpools = get_tagpools(account)
statement = Statement(
account=account,
title=settings.MONTHLY_STATEMENT_TITLE,
type=Statement.TYPE_MONTHLY,
from_date=from_date,
to_date=to_date)
statement.save()
items = []
items.extend(make_message_items(account, statement, tagpools))
items.extend(make_session_items(account, statement, tagpools))
statement.lineitem_set.bulk_create(items)
return statement
@task()
def generate_monthly_account_statements():
"""Spawn sub-tasks to generate a *Monthly* ``Statement`` for accounts
without a *Monthly* statement.
"""
today = date.today()
last_month = today - relativedelta(months=1)
from_date = date(last_month.year, last_month.month, 1)
to_date = date(today.year, today.month, 1) - relativedelta(days=1)
account_list = Account.objects.exclude(
statement__type=Statement.TYPE_MONTHLY,
statement__from_date=from_date,
statement__to_date=to_date)
task_list = []
for account in account_list:
task_list.append(
generate_monthly_statement.s(account.id, from_date, to_date))
return group(task_list)()
| [
6738,
4818,
8079,
1330,
3128,
198,
198,
6738,
3128,
22602,
13,
2411,
265,
1572,
12514,
1330,
48993,
1572,
12514,
198,
198,
6738,
18725,
1924,
13,
35943,
1330,
4876,
11,
1448,
198,
198,
6738,
42625,
14208,
13,
9945,
13,
27530,
1330,
5060,
11,
2764,
198,
198,
6738,
467,
13,
65,
4509,
1330,
6460,
198,
6738,
467,
13,
65,
4509,
13,
27530,
1330,
357,
198,
220,
220,
220,
10781,
11,
45389,
11,
16000,
13729,
11,
21983,
11,
6910,
7449,
8,
198,
6738,
467,
13,
8692,
13,
26791,
1330,
410,
12994,
62,
15042,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628,
198,
198,
31,
35943,
3419,
198,
4299,
7716,
62,
8424,
306,
62,
26090,
7,
23317,
62,
312,
11,
422,
62,
4475,
11,
284,
62,
4475,
2599,
198,
220,
220,
220,
37227,
8645,
378,
257,
649,
1635,
31948,
306,
9,
7559,
48682,
15506,
329,
262,
1813,
7559,
23317,
15506,
198,
220,
220,
220,
220,
220,
220,
1022,
262,
1813,
7559,
6738,
62,
4475,
15506,
290,
7559,
1462,
62,
4475,
15506,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1848,
796,
10781,
13,
48205,
13,
1136,
7,
312,
28,
23317,
62,
312,
8,
198,
220,
220,
220,
7621,
7742,
82,
796,
651,
62,
12985,
7742,
82,
7,
23317,
8,
628,
220,
220,
220,
2643,
796,
21983,
7,
198,
220,
220,
220,
220,
220,
220,
220,
1848,
28,
23317,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3670,
28,
33692,
13,
27857,
4221,
11319,
62,
35744,
12529,
62,
49560,
2538,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2099,
28,
48682,
13,
25216,
62,
27857,
4221,
11319,
11,
198,
220,
220,
220,
220,
220,
220,
220,
422,
62,
4475,
28,
6738,
62,
4475,
11,
198,
220,
220,
220,
220,
220,
220,
220,
284,
62,
4475,
28,
1462,
62,
4475,
8,
628,
220,
220,
220,
2643,
13,
21928,
3419,
628,
220,
220,
220,
3709,
796,
17635,
198,
220,
220,
220,
3709,
13,
2302,
437,
7,
15883,
62,
20500,
62,
23814,
7,
23317,
11,
2643,
11,
7621,
7742,
82,
4008,
198,
220,
220,
220,
3709,
13,
2302,
437,
7,
15883,
62,
29891,
62,
23814,
7,
23317,
11,
2643,
11,
7621,
7742,
82,
4008,
628,
220,
220,
220,
2643,
13,
1370,
9186,
62,
2617,
13,
65,
12171,
62,
17953,
7,
23814,
8,
198,
220,
220,
220,
1441,
2643,
628,
198,
31,
35943,
3419,
198,
4299,
7716,
62,
8424,
306,
62,
23317,
62,
14269,
3196,
33529,
198,
220,
220,
220,
37227,
49855,
850,
12,
83,
6791,
284,
7716,
257,
1635,
31948,
306,
9,
7559,
48682,
15506,
329,
5504,
198,
220,
220,
220,
220,
220,
220,
1231,
257,
1635,
31948,
306,
9,
2643,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1909,
796,
3128,
13,
40838,
3419,
198,
220,
220,
220,
938,
62,
8424,
796,
1909,
532,
48993,
1572,
12514,
7,
41537,
28,
16,
8,
198,
220,
220,
220,
422,
62,
4475,
796,
3128,
7,
12957,
62,
8424,
13,
1941,
11,
938,
62,
8424,
13,
8424,
11,
352,
8,
198,
220,
220,
220,
284,
62,
4475,
796,
3128,
7,
40838,
13,
1941,
11,
1909,
13,
8424,
11,
352,
8,
532,
48993,
1572,
12514,
7,
12545,
28,
16,
8,
198,
220,
220,
220,
1848,
62,
4868,
796,
10781,
13,
48205,
13,
1069,
9152,
7,
198,
220,
220,
220,
220,
220,
220,
220,
2643,
834,
4906,
28,
48682,
13,
25216,
62,
27857,
4221,
11319,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2643,
834,
6738,
62,
4475,
28,
6738,
62,
4475,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2643,
834,
1462,
62,
4475,
28,
1462,
62,
4475,
8,
628,
220,
220,
220,
4876,
62,
4868,
796,
17635,
198,
220,
220,
220,
329,
1848,
287,
1848,
62,
4868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4876,
62,
4868,
13,
33295,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7716,
62,
8424,
306,
62,
26090,
13,
82,
7,
23317,
13,
312,
11,
422,
62,
4475,
11,
284,
62,
4475,
4008,
628,
220,
220,
220,
1441,
1448,
7,
35943,
62,
4868,
8,
3419,
198
] | 2.644018 | 677 |
_base_ = './i_base.py'
item_cfg = {'b': 2}
item6 = {'cfg': item_cfg}
| [
62,
8692,
62,
796,
705,
19571,
72,
62,
8692,
13,
9078,
6,
198,
9186,
62,
37581,
796,
1391,
6,
65,
10354,
362,
92,
198,
9186,
21,
796,
1391,
6,
37581,
10354,
2378,
62,
37581,
92,
198
] | 1.916667 | 36 |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from collections import OrderedDict
from functools import partial
from typing import Dict
import oneflow._oneflow_internal
import oneflow.framework.c_api_util as c_api_util
import oneflow.framework.graph_build_util as graph_build_util
import oneflow.framework.session_context as session_ctx
from oneflow.framework.distribute import get_rank
from oneflow.framework.tensor import Tensor, TensorTuple
from oneflow.framework.multi_client_session import MultiClientSession
from oneflow.framework.tensor_tuple_util import convert_to_tensor_tuple
from oneflow.nn.graph.block import Block, BlockType
from oneflow.nn.graph.config import GraphConfig
from oneflow.nn.graph.optimizer import OptDict, VariableConfig
from oneflow.amp import GradScaler
from oneflow.nn.graph.util import add_indent, sys_exc_error_msg, list_to_func_return
from oneflow.nn.module import Module
from oneflow.nn.optimizer.optimizer import Optimizer
from oneflow.nn.optimizer.lr_scheduler import LrScheduler
| [
37811,
198,
15269,
12131,
383,
1881,
37535,
46665,
13,
1439,
2489,
10395,
13,
198,
198,
26656,
15385,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
5832,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
1639,
743,
7330,
257,
4866,
286,
262,
13789,
379,
628,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
198,
28042,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
17080,
6169,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
54,
10554,
12425,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
6214,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2475,
20597,
739,
262,
13789,
13,
198,
37811,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
6738,
19720,
1330,
360,
713,
198,
198,
11748,
530,
11125,
13557,
505,
11125,
62,
32538,
198,
11748,
530,
11125,
13,
30604,
13,
66,
62,
15042,
62,
22602,
355,
269,
62,
15042,
62,
22602,
198,
11748,
530,
11125,
13,
30604,
13,
34960,
62,
11249,
62,
22602,
355,
4823,
62,
11249,
62,
22602,
198,
11748,
530,
11125,
13,
30604,
13,
29891,
62,
22866,
355,
6246,
62,
49464,
198,
6738,
530,
11125,
13,
30604,
13,
17080,
4163,
1330,
651,
62,
43027,
198,
6738,
530,
11125,
13,
30604,
13,
83,
22854,
1330,
309,
22854,
11,
309,
22854,
51,
29291,
198,
6738,
530,
11125,
13,
30604,
13,
41684,
62,
16366,
62,
29891,
1330,
15237,
11792,
36044,
198,
6738,
530,
11125,
13,
30604,
13,
83,
22854,
62,
83,
29291,
62,
22602,
1330,
10385,
62,
1462,
62,
83,
22854,
62,
83,
29291,
198,
6738,
530,
11125,
13,
20471,
13,
34960,
13,
9967,
1330,
9726,
11,
9726,
6030,
198,
6738,
530,
11125,
13,
20471,
13,
34960,
13,
11250,
1330,
29681,
16934,
198,
6738,
530,
11125,
13,
20471,
13,
34960,
13,
40085,
7509,
1330,
13123,
35,
713,
11,
35748,
16934,
198,
6738,
530,
11125,
13,
696,
1330,
17701,
3351,
36213,
198,
6738,
530,
11125,
13,
20471,
13,
34960,
13,
22602,
1330,
751,
62,
521,
298,
11,
25064,
62,
41194,
62,
18224,
62,
19662,
11,
1351,
62,
1462,
62,
20786,
62,
7783,
198,
6738,
530,
11125,
13,
20471,
13,
21412,
1330,
19937,
198,
6738,
530,
11125,
13,
20471,
13,
40085,
7509,
13,
40085,
7509,
1330,
30011,
7509,
198,
6738,
530,
11125,
13,
20471,
13,
40085,
7509,
13,
14050,
62,
1416,
704,
18173,
1330,
406,
81,
50,
1740,
18173,
628
] | 3.6097 | 433 |
import sys
import csv
import re
from modules.pixelBasedDecoding import decodePixelBased
# Input parsing:
# needs to know up front how large the image is going to be
x_dim = int(sys.argv[1])
y_dim = int(sys.argv[2])
# Extract tile nr
tile_nr = sys.argv[3]
tile_nr_int = int(re.findall(r"\d+", tile_nr)[0])
codebook = sys.argv[4]
bit_len = int(sys.argv[5])
threshold = float(sys.argv[6])
# Prefix to be able to sort the images in the correct order
image_prefix= sys.argv[7]
image_path_list = [sys.argv[i] for i in range(8, len(sys.argv))]
# Decode pixelbase
decoded_df = decodePixelBased(x_dim,y_dim, codebook, bit_len, image_path_list,image_prefix,threshold)
# Add an extra rown with tile number to the dataframe
decoded_df['Tile'] = [tile_nr_int for i in range(0,len(decoded_df))]
decoded_df.to_csv(f"decoded_{tile_nr}.csv", index=False)
| [
11748,
25064,
198,
11748,
269,
21370,
198,
11748,
302,
198,
6738,
13103,
13,
32515,
15001,
10707,
7656,
1330,
36899,
40809,
15001,
198,
198,
2,
23412,
32096,
25,
198,
198,
2,
2476,
284,
760,
510,
2166,
703,
1588,
262,
2939,
318,
1016,
284,
307,
198,
87,
62,
27740,
796,
493,
7,
17597,
13,
853,
85,
58,
16,
12962,
198,
88,
62,
27740,
796,
493,
7,
17597,
13,
853,
85,
58,
17,
12962,
198,
198,
2,
29677,
17763,
299,
81,
198,
40927,
62,
48624,
796,
220,
25064,
13,
853,
85,
58,
18,
60,
198,
40927,
62,
48624,
62,
600,
796,
493,
7,
260,
13,
19796,
439,
7,
81,
1,
59,
67,
10,
1600,
17763,
62,
48624,
38381,
15,
12962,
628,
198,
8189,
2070,
796,
25064,
13,
853,
85,
58,
19,
60,
198,
2545,
62,
11925,
796,
220,
493,
7,
17597,
13,
853,
85,
58,
20,
12962,
198,
400,
10126,
796,
12178,
7,
17597,
13,
853,
85,
58,
21,
12962,
198,
198,
2,
3771,
13049,
284,
307,
1498,
284,
3297,
262,
4263,
287,
262,
3376,
1502,
198,
9060,
62,
40290,
28,
25064,
13,
853,
85,
58,
22,
60,
198,
9060,
62,
6978,
62,
4868,
796,
685,
17597,
13,
853,
85,
58,
72,
60,
329,
1312,
287,
2837,
7,
23,
11,
18896,
7,
17597,
13,
853,
85,
4008,
60,
198,
198,
2,
4280,
1098,
17465,
8692,
198,
12501,
9043,
62,
7568,
796,
36899,
40809,
15001,
7,
87,
62,
27740,
11,
88,
62,
27740,
11,
2438,
2070,
11,
1643,
62,
11925,
11,
2939,
62,
6978,
62,
4868,
11,
9060,
62,
40290,
11,
400,
10126,
8,
198,
198,
2,
3060,
281,
3131,
686,
675,
351,
17763,
1271,
284,
262,
1366,
14535,
198,
12501,
9043,
62,
7568,
17816,
35103,
20520,
796,
685,
40927,
62,
48624,
62,
600,
329,
1312,
287,
2837,
7,
15,
11,
11925,
7,
12501,
9043,
62,
7568,
4008,
60,
198,
12501,
9043,
62,
7568,
13,
1462,
62,
40664,
7,
69,
1,
12501,
9043,
23330,
40927,
62,
48624,
27422,
40664,
1600,
6376,
28,
25101,
8,
198
] | 2.561934 | 331 |
# Generated by Django 3.2.6 on 2021-08-08 21:52
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
17,
13,
21,
319,
33448,
12,
2919,
12,
2919,
2310,
25,
4309,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
import os, sys
os.chdir("G:\\My Drive\\Academic\\Research\\Neural Heap")
from neural_heap.dataset.io_synthesis.io_synthesis_args import IOSynthesisArgs
from neural_heap.dataset.io_synthesis.io_synthesis_utils import IOSynthesisUtils
| [
11748,
28686,
11,
25064,
201,
198,
418,
13,
354,
15908,
7203,
38,
25,
6852,
3666,
9974,
6852,
12832,
49113,
6852,
25104,
6852,
8199,
1523,
679,
499,
4943,
201,
198,
6738,
17019,
62,
258,
499,
13,
19608,
292,
316,
13,
952,
62,
1837,
429,
8497,
13,
952,
62,
1837,
429,
8497,
62,
22046,
1330,
314,
2640,
44411,
42035,
201,
198,
6738,
17019,
62,
258,
499,
13,
19608,
292,
316,
13,
952,
62,
1837,
429,
8497,
13,
952,
62,
1837,
429,
8497,
62,
26791,
1330,
314,
2640,
44411,
18274,
4487,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220
] | 2.5 | 98 |
from pyteal import *
from algosdk.v2client import algod
from algosdk import account, mnemonic
import pyteal
# from deploy import PytealDeploy
algod_token = 'B3SU4KcVKi94Jap2VXkK83xx38bsv95K5UZm2lab'
algod_addres = "http://testnet-algorand.api.purestake.io/ps2"
purestack_token = {
"X-Api-Key": algod_token
}
tmpl_fee = Int(1000)
tmpl_period = Int(50)
tmpl_dur = Int(5000)
tmpl_lease = Bytes("base64", "023sdDE2")
tmpl_amt = Int(2000)
tmpl_rcv = Addr("6ZHGHH5Z5CTPCF5WCESXMGRSVK7QJETR63M3NY5FJCUYDHO57VTCMJOBGY")
tmpl_timeout = Int(30000)
| [
6738,
12972,
660,
282,
1330,
1635,
201,
198,
6738,
435,
70,
418,
34388,
13,
85,
17,
16366,
1330,
435,
25344,
201,
198,
6738,
435,
70,
418,
34388,
1330,
1848,
11,
285,
77,
50016,
201,
198,
11748,
12972,
660,
282,
201,
198,
201,
198,
2,
422,
6061,
1330,
9485,
660,
282,
49322,
201,
198,
201,
198,
201,
198,
14016,
375,
62,
30001,
796,
705,
33,
18,
12564,
19,
42,
66,
47191,
72,
5824,
41,
499,
17,
53,
55,
74,
42,
5999,
5324,
2548,
1443,
85,
3865,
42,
20,
52,
57,
76,
17,
23912,
6,
201,
198,
14016,
375,
62,
2860,
411,
796,
366,
4023,
1378,
9288,
3262,
12,
282,
7053,
392,
13,
15042,
13,
37424,
301,
539,
13,
952,
14,
862,
17,
1,
201,
198,
37424,
25558,
62,
30001,
796,
1391,
201,
198,
220,
220,
220,
366,
55,
12,
32,
14415,
12,
9218,
1298,
435,
25344,
62,
30001,
201,
198,
92,
201,
198,
201,
198,
17209,
489,
62,
39071,
796,
2558,
7,
12825,
8,
201,
198,
17209,
489,
62,
41007,
796,
2558,
7,
1120,
8,
201,
198,
17209,
489,
62,
67,
333,
796,
2558,
7,
27641,
8,
201,
198,
17209,
489,
62,
1274,
796,
2750,
4879,
7203,
8692,
2414,
1600,
366,
45310,
21282,
7206,
17,
4943,
201,
198,
17209,
489,
62,
321,
83,
796,
2558,
7,
11024,
8,
201,
198,
17209,
489,
62,
6015,
85,
796,
3060,
81,
7203,
21,
57,
39,
38,
16768,
20,
57,
20,
4177,
5662,
37,
20,
27353,
1546,
55,
20474,
6998,
47191,
22,
48,
41,
2767,
49,
5066,
44,
18,
12805,
20,
37,
34382,
52,
35755,
32298,
3553,
53,
4825,
43421,
9864,
31212,
4943,
201,
198,
17209,
489,
62,
48678,
796,
2558,
7,
18,
2388,
8,
201,
198,
201,
198,
201,
198,
201,
198,
220,
220,
220,
220
] | 1.976027 | 292 |
# Copyright (c) 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from tempest import config
from tempest.lib import decorators
from murano_tempest_tests.tests.api.application_catalog import base
from murano_tempest_tests import utils
CONF = config.CONF
| [
2,
220,
220,
220,
15069,
357,
66,
8,
1584,
7381,
20836,
11,
3457,
13,
198,
2,
198,
2,
220,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
198,
2,
220,
220,
220,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
921,
743,
7330,
198,
2,
220,
220,
220,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
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,
220,
220,
220,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
220,
220,
220,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
42881,
198,
2,
220,
220,
220,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
4091,
262,
198,
2,
220,
220,
220,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
11247,
198,
2,
220,
220,
220,
739,
262,
13789,
13,
198,
198,
11748,
28686,
198,
198,
6738,
20218,
395,
1330,
4566,
198,
6738,
20218,
395,
13,
8019,
1330,
11705,
2024,
198,
198,
6738,
4636,
5733,
62,
29510,
395,
62,
41989,
13,
41989,
13,
15042,
13,
31438,
62,
9246,
11794,
1330,
2779,
198,
6738,
4636,
5733,
62,
29510,
395,
62,
41989,
1330,
3384,
4487,
198,
198,
10943,
37,
796,
4566,
13,
10943,
37,
628,
198
] | 3.294355 | 248 |
#!/usr/bin/python
# See file COPYING distributed with python-hypothesis for copyright and
# license.
from setuptools import setup
long_description = open('README.rst').read()
setup(name='python-hypothesis',
version='0.4.2',
description='Python library for the Hypothes.is API',
author='Christian Haselgrove',
author_email='[email protected]',
url='https://github.com/chaselgrove/python-hypothesis',
packages=['h_annot'],
scripts=[],
install_requires=['requests',
'python-dateutil',
'six'],
classifiers=['Development Status :: 3 - Alpha',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development :: Libraries'],
license='BSD license',
long_description=long_description
)
# eof
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
2,
4091,
2393,
27975,
45761,
9387,
351,
21015,
12,
36362,
313,
8497,
329,
6634,
290,
220,
198,
2,
5964,
13,
198,
198,
6738,
900,
37623,
10141,
1330,
9058,
198,
198,
6511,
62,
11213,
796,
1280,
10786,
15675,
11682,
13,
81,
301,
27691,
961,
3419,
198,
198,
40406,
7,
3672,
11639,
29412,
12,
36362,
313,
8497,
3256,
220,
198,
220,
220,
220,
220,
220,
2196,
11639,
15,
13,
19,
13,
17,
3256,
220,
198,
220,
220,
220,
220,
220,
6764,
11639,
37906,
5888,
329,
262,
21209,
31690,
13,
271,
7824,
3256,
220,
198,
220,
220,
220,
220,
220,
1772,
11639,
20298,
7875,
417,
27333,
303,
3256,
220,
198,
220,
220,
220,
220,
220,
1772,
62,
12888,
11639,
43533,
666,
13,
10134,
417,
27333,
303,
31,
388,
562,
1150,
13,
15532,
3256,
220,
198,
220,
220,
220,
220,
220,
19016,
11639,
5450,
1378,
12567,
13,
785,
14,
354,
48038,
27333,
303,
14,
29412,
12,
36362,
313,
8497,
3256,
220,
198,
220,
220,
220,
220,
220,
10392,
28,
17816,
71,
62,
34574,
6,
4357,
220,
198,
220,
220,
220,
220,
220,
14750,
41888,
4357,
220,
198,
220,
220,
220,
220,
220,
2721,
62,
47911,
28,
17816,
8897,
3558,
3256,
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,
705,
29412,
12,
4475,
22602,
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,
705,
19412,
6,
4357,
220,
198,
220,
220,
220,
220,
220,
1398,
13350,
28,
17816,
41206,
12678,
7904,
513,
532,
12995,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
31441,
7904,
5313,
9344,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
5317,
1631,
7591,
1240,
7904,
34152,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
34156,
7904,
7294,
40,
20010,
1079,
7904,
347,
10305,
13789,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
35364,
15417,
7904,
3594,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
18843,
803,
4482,
7904,
7294,
13362,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
33221,
7904,
4455,
7904,
13505,
54,
14,
40717,
3256,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
33221,
7904,
10442,
7712,
7904,
46267,
6,
4357,
220,
198,
220,
220,
220,
220,
220,
5964,
11639,
21800,
5964,
3256,
220,
198,
220,
220,
220,
220,
220,
890,
62,
11213,
28,
6511,
62,
11213,
198,
220,
220,
220,
220,
1267,
198,
198,
2,
304,
1659,
198
] | 2.216117 | 546 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-04-22 14:31
from __future__ import unicode_literals
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,
22,
319,
2864,
12,
3023,
12,
1828,
1478,
25,
3132,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.736842 | 57 |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import oneflow
from oneflow.framework.docstr.utils import add_docstr
add_docstr(
oneflow.index_select,
"""
input.index_select(dim, index) -> Tensor
The interface is consistent with PyTorch.
The documentation is referenced from: https://pytorch-cn.readthedocs.io/zh/latest/package_references/torch/#torchindex_select
Select values along an axis specified by `dim`.
:attr:`index` must be an Int32 Tensor with 1-D.
:attr:`dim` must be in the range of input Dimensions.
value of :attr:`index` must be in the range of the dim-th of input.
Note that ``input`` and ``index`` do not broadcast against each other.
Args:
input (Tensor): the source tensor
dim (int): the axis along which to index
index (Tensor): the 1-D tensor containing the indices to index
For example:
.. code-block:: python
>>> import oneflow as flow
>>> input = flow.tensor([[1,2,3],[4,5,6]], dtype=flow.int32)
>>> input
tensor([[1, 2, 3],
[4, 5, 6]], dtype=oneflow.int32)
>>> index = flow.tensor([0,1], dtype=flow.int32)
>>> output = flow.index_select(input, 1, index)
>>> output
tensor([[1, 2],
[4, 5]], dtype=oneflow.int32)
>>> output = input.index_select(1, index)
>>> output
tensor([[1, 2],
[4, 5]], dtype=oneflow.int32)
""",
)
| [
37811,
198,
15269,
12131,
383,
1881,
37535,
46665,
13,
1439,
2489,
10395,
13,
198,
198,
26656,
15385,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
5832,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
1639,
743,
7330,
257,
4866,
286,
262,
13789,
379,
628,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
198,
28042,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
17080,
6169,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
54,
10554,
12425,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
6214,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2475,
20597,
739,
262,
13789,
13,
198,
37811,
198,
11748,
530,
11125,
198,
6738,
530,
11125,
13,
30604,
13,
15390,
2536,
13,
26791,
1330,
751,
62,
15390,
2536,
198,
198,
2860,
62,
15390,
2536,
7,
198,
220,
220,
220,
530,
11125,
13,
9630,
62,
19738,
11,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5128,
13,
9630,
62,
19738,
7,
27740,
11,
6376,
8,
4613,
309,
22854,
628,
220,
220,
220,
383,
7071,
318,
6414,
351,
9485,
15884,
354,
13,
220,
220,
220,
220,
198,
220,
220,
220,
383,
10314,
318,
20717,
422,
25,
3740,
1378,
9078,
13165,
354,
12,
31522,
13,
961,
83,
704,
420,
82,
13,
952,
14,
23548,
14,
42861,
14,
26495,
62,
5420,
4972,
14,
13165,
354,
31113,
13165,
354,
9630,
62,
19738,
628,
220,
220,
220,
9683,
3815,
1863,
281,
16488,
7368,
416,
4600,
27740,
44646,
628,
220,
220,
220,
1058,
35226,
25,
63,
9630,
63,
1276,
307,
281,
2558,
2624,
309,
22854,
351,
352,
12,
35,
13,
198,
220,
220,
220,
1058,
35226,
25,
63,
27740,
63,
1276,
307,
287,
262,
2837,
286,
5128,
41265,
13,
198,
220,
220,
220,
1988,
286,
1058,
35226,
25,
63,
9630,
63,
1276,
307,
287,
262,
2837,
286,
262,
5391,
12,
400,
286,
5128,
13,
198,
220,
220,
220,
5740,
326,
7559,
15414,
15506,
290,
7559,
9630,
15506,
466,
407,
7025,
1028,
1123,
584,
13,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
357,
51,
22854,
2599,
262,
2723,
11192,
273,
198,
220,
220,
220,
220,
220,
220,
220,
5391,
357,
600,
2599,
262,
16488,
1863,
543,
284,
6376,
198,
220,
220,
220,
220,
220,
220,
220,
6376,
357,
51,
22854,
2599,
262,
352,
12,
35,
11192,
273,
7268,
262,
36525,
284,
6376,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1114,
1672,
25,
628,
220,
220,
220,
11485,
2438,
12,
9967,
3712,
21015,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
1330,
530,
11125,
355,
5202,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
5128,
796,
5202,
13,
83,
22854,
26933,
58,
16,
11,
17,
11,
18,
38430,
19,
11,
20,
11,
21,
60,
4357,
288,
4906,
28,
11125,
13,
600,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
5128,
220,
198,
220,
220,
220,
220,
220,
220,
220,
11192,
273,
26933,
58,
16,
11,
362,
11,
513,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
19,
11,
642,
11,
718,
60,
4357,
288,
4906,
28,
505,
11125,
13,
600,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
6376,
796,
5202,
13,
83,
22854,
26933,
15,
11,
16,
4357,
288,
4906,
28,
11125,
13,
600,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
5072,
796,
5202,
13,
9630,
62,
19738,
7,
15414,
11,
352,
11,
6376,
8,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
5072,
198,
220,
220,
220,
220,
220,
220,
220,
11192,
273,
26933,
58,
16,
11,
362,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
19,
11,
642,
60,
4357,
288,
4906,
28,
505,
11125,
13,
600,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
5072,
796,
5128,
13,
9630,
62,
19738,
7,
16,
11,
6376,
8,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
5072,
198,
220,
220,
220,
220,
220,
220,
220,
11192,
273,
26933,
58,
16,
11,
362,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
19,
11,
642,
60,
4357,
288,
4906,
28,
505,
11125,
13,
600,
2624,
8,
198,
220,
220,
220,
13538,
1600,
198,
8,
198
] | 2.610039 | 777 |
someList = ['470 градусов по фаренгейту', 'Сталкер', 'Наруто', 'Форсаж', 'Оно', 'Оно2', 'Смешарики', 'Лунтик']
print(someList)
someList.append('frdfvty')
del someList[8]
print(someList)
| [
11246,
8053,
796,
37250,
27790,
12466,
111,
21169,
16142,
43666,
35072,
21727,
25443,
110,
12466,
123,
15166,
220,
141,
226,
16142,
21169,
16843,
22177,
140,
111,
16843,
140,
117,
20375,
35072,
3256,
705,
140,
94,
20375,
16142,
30143,
31583,
16843,
21169,
3256,
705,
140,
251,
16142,
21169,
35072,
20375,
15166,
3256,
705,
140,
97,
15166,
21169,
21727,
16142,
140,
114,
3256,
705,
140,
252,
22177,
15166,
3256,
705,
140,
252,
22177,
15166,
17,
3256,
705,
140,
94,
43108,
16843,
141,
230,
16142,
21169,
18849,
31583,
18849,
3256,
705,
140,
249,
35072,
22177,
20375,
18849,
31583,
20520,
198,
4798,
7,
11246,
8053,
8,
198,
11246,
8053,
13,
33295,
10786,
69,
4372,
69,
85,
774,
11537,
198,
12381,
617,
8053,
58,
23,
60,
198,
4798,
7,
11246,
8053,
8,
198
] | 1.453125 | 128 |
import asyncio
from aiogoogle import Aiogoogle, GoogleAPI
from aiogoogle.auth.creds import ClientCreds, UserCreds
import base64
import bs4
import json
import scraper.util
import scraper.flags
AUTHOR = "Erratic Errata"
| [
11748,
30351,
952,
198,
6738,
257,
72,
24076,
2467,
1330,
38230,
24076,
2467,
11,
3012,
17614,
198,
6738,
257,
72,
24076,
2467,
13,
18439,
13,
66,
445,
82,
1330,
20985,
34,
445,
82,
11,
11787,
34,
445,
82,
198,
11748,
2779,
2414,
198,
11748,
275,
82,
19,
198,
11748,
33918,
198,
198,
11748,
19320,
525,
13,
22602,
198,
11748,
19320,
525,
13,
33152,
198,
198,
32,
24318,
1581,
796,
366,
9139,
81,
1512,
41512,
1045,
1,
198
] | 2.857143 | 77 |
# Copyright 2021-2022 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
| [
2,
15069,
33448,
12,
1238,
1828,
37754,
11,
3457,
13,
198,
2,
30628,
55,
12,
34156,
12,
33234,
7483,
25,
347,
10305,
12,
17,
12,
2601,
682,
198
] | 2.678571 | 28 |
"""Storage engine sanity tests"""
from pymongo import MongoClient
import copy
import unittest
import time
from . import storage
ITEM_VISIBLE = {"key" : "valueA", storage.VISIBLE_KEY : True}
ITEM_HIDDEN = {"key" : "valueB"}
def is_same_dictionary(a, b):
"""Shallow dictionary comparison"""
keysA = set(a.keys())
keysB = set(b.keys())
sharedKeys = keysA & keysB
if len(keysA) != len(keysB) or len(sharedKeys) != len(keysB):
return False
for k, v in a.items():
if b[k] != v:
return False
return True
class StorageTest(unittest.TestCase):
"""Tests the storage engine implementation for sanity."""
def list(self):
"""Wraps storage listing returning list."""
return list(self.storage.list())
MONGO_TEST_COLLECTION = "storage_test"
# Override test loading to skip test from storage test base class
# without skipping them in the subclasses.
| [
37811,
31425,
3113,
34182,
5254,
37811,
198,
198,
6738,
279,
4948,
25162,
1330,
42591,
11792,
198,
11748,
4866,
198,
11748,
555,
715,
395,
198,
11748,
640,
198,
198,
6738,
764,
1330,
6143,
198,
198,
2043,
3620,
62,
29817,
34563,
796,
19779,
2539,
1,
1058,
366,
8367,
32,
1600,
6143,
13,
29817,
34563,
62,
20373,
1058,
6407,
92,
198,
2043,
3620,
62,
39,
2389,
41819,
220,
796,
19779,
2539,
1,
1058,
366,
8367,
33,
20662,
198,
198,
4299,
318,
62,
31642,
62,
67,
14188,
7,
64,
11,
275,
2599,
198,
220,
220,
220,
37227,
2484,
12154,
22155,
7208,
37811,
198,
220,
220,
220,
8251,
32,
796,
900,
7,
64,
13,
13083,
28955,
198,
220,
220,
220,
8251,
33,
796,
900,
7,
65,
13,
13083,
28955,
198,
220,
220,
220,
4888,
40729,
796,
8251,
32,
1222,
8251,
33,
198,
220,
220,
220,
611,
18896,
7,
13083,
32,
8,
14512,
18896,
7,
13083,
33,
8,
393,
18896,
7,
28710,
40729,
8,
14512,
18896,
7,
13083,
33,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
198,
220,
220,
220,
329,
479,
11,
410,
287,
257,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
611,
275,
58,
74,
60,
14512,
410,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
198,
220,
220,
220,
1441,
6407,
628,
628,
198,
198,
4871,
20514,
14402,
7,
403,
715,
395,
13,
14402,
20448,
2599,
198,
220,
220,
220,
37227,
51,
3558,
262,
6143,
3113,
7822,
329,
34182,
526,
15931,
628,
220,
220,
220,
825,
1351,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
36918,
862,
6143,
13487,
8024,
1351,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1351,
7,
944,
13,
35350,
13,
4868,
28955,
628,
198,
198,
27857,
11230,
62,
51,
6465,
62,
25154,
16779,
2849,
796,
366,
35350,
62,
9288,
1,
628,
198,
2,
3827,
13154,
1332,
11046,
284,
14267,
1332,
422,
6143,
1332,
2779,
1398,
198,
2,
1231,
31017,
606,
287,
262,
850,
37724,
13,
628
] | 2.738235 | 340 |
import torch
import copy
from torch import nn
from torch.nn import functional as F
from torch.nn.modules.container import ModuleList
class NeighborAttention(nn.Module):
"""
A graph-based attention replacement.
"""
class NeighborEncoderLayer(nn.Module):
"""
Copy-paste of torch.nn.TransformerEncoderLayer but
uses 'NeighborAttention' instead of the regural
torch.nn.MultiheadAttention.
"""
class SimpleNeighborEncoderLayer(nn.Module):
"""
Copy-paste of torch.nn.TransformerEncoderLayer but
uses 'NeighborAttention' instead of the regural
torch.nn.MultiheadAttention.
"""
class GCN(nn.Module):
"""
NeighborEncoder is a stack of NeighborEncoderLayers.
"""
| [
11748,
28034,
198,
11748,
4866,
198,
198,
6738,
28034,
1330,
299,
77,
198,
6738,
28034,
13,
20471,
1330,
10345,
355,
376,
198,
6738,
28034,
13,
20471,
13,
18170,
13,
34924,
1330,
19937,
8053,
628,
198,
4871,
28708,
8086,
1463,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
317,
4823,
12,
3106,
3241,
9014,
13,
198,
220,
220,
220,
37227,
628,
198,
4871,
28708,
27195,
12342,
49925,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
17393,
12,
34274,
286,
28034,
13,
20471,
13,
8291,
16354,
27195,
12342,
49925,
475,
198,
220,
220,
220,
3544,
705,
46445,
2865,
8086,
1463,
6,
2427,
286,
262,
842,
1523,
198,
220,
220,
220,
28034,
13,
20471,
13,
29800,
2256,
8086,
1463,
13,
198,
220,
220,
220,
37227,
628,
198,
4871,
17427,
46445,
2865,
27195,
12342,
49925,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
17393,
12,
34274,
286,
28034,
13,
20471,
13,
8291,
16354,
27195,
12342,
49925,
475,
198,
220,
220,
220,
3544,
705,
46445,
2865,
8086,
1463,
6,
2427,
286,
262,
842,
1523,
198,
220,
220,
220,
28034,
13,
20471,
13,
29800,
2256,
8086,
1463,
13,
198,
220,
220,
220,
37227,
628,
198,
4871,
20145,
45,
7,
20471,
13,
26796,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
28708,
27195,
12342,
318,
257,
8931,
286,
28708,
27195,
12342,
43,
6962,
13,
198,
220,
220,
220,
37227,
198
] | 2.987654 | 243 |
username="postgres"
password="dr@g0ngThcetaG" | [
29460,
2625,
7353,
34239,
1,
198,
28712,
2625,
7109,
31,
70,
15,
782,
817,
66,
17167,
38,
1
] | 2.5 | 18 |
# Testoob, Python Testing Out Of (The) Box
# Copyright (C) 2005-2006 The Testoob Team
#
# 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.
"getting information about tests"
def create_test_info(arg):
"""
Factory method for creating TestInfo instances.
"""
if isinstance(arg, TestInfo):
return arg
return TestInfo(arg)
class TestInfo:
"""
An interface for getting information about tests.
Reporters receive instances of this class.
"""
# should be usable as dictionary keys, so define __hash__ and __cmp__
from testoob.utils import add_fields_pickling
add_fields_pickling(TestInfo)
| [
2,
6208,
78,
672,
11,
11361,
23983,
3806,
3226,
357,
464,
8,
8315,
198,
2,
15069,
357,
34,
8,
5075,
12,
13330,
383,
6208,
78,
672,
4816,
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,
1,
37210,
1321,
546,
5254,
1,
198,
198,
4299,
2251,
62,
9288,
62,
10951,
7,
853,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
19239,
2446,
329,
4441,
6208,
12360,
10245,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
318,
39098,
7,
853,
11,
6208,
12360,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1822,
628,
220,
220,
220,
1441,
6208,
12360,
7,
853,
8,
198,
198,
4871,
6208,
12360,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1052,
7071,
329,
1972,
1321,
546,
5254,
13,
198,
220,
220,
220,
1432,
3816,
3328,
10245,
286,
428,
1398,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1303,
815,
307,
24284,
355,
22155,
8251,
11,
523,
8160,
11593,
17831,
834,
290,
11593,
48991,
834,
198,
198,
6738,
1332,
78,
672,
13,
26791,
1330,
751,
62,
25747,
62,
27729,
1359,
198,
2860,
62,
25747,
62,
27729,
1359,
7,
14402,
12360,
8,
198
] | 3.407855 | 331 |
import urllib
import os
from subprocess import Popen
directory = 'C:\\Temp\\cygwindownload'
if not os.path.isdir(directory):
os.makedirs(directory)
urllib.urlretrieve("https://cygwin.com/setup-x86.exe", directory + '\\setup.exe')
p = Popen("cygwin-install.bat")
stdout, stderr = p.communicate()
| [
11748,
2956,
297,
571,
201,
198,
11748,
28686,
201,
198,
201,
198,
6738,
850,
14681,
1330,
8099,
268,
201,
198,
201,
198,
201,
198,
34945,
796,
705,
34,
25,
6852,
30782,
6852,
948,
70,
7972,
593,
2220,
6,
201,
198,
361,
407,
28686,
13,
6978,
13,
9409,
343,
7,
34945,
2599,
201,
198,
220,
220,
28686,
13,
76,
4335,
17062,
7,
34945,
8,
201,
198,
333,
297,
571,
13,
6371,
1186,
30227,
7203,
5450,
1378,
948,
70,
5404,
13,
785,
14,
40406,
12,
87,
4521,
13,
13499,
1600,
8619,
1343,
705,
6852,
40406,
13,
13499,
11537,
201,
198,
201,
198,
79,
796,
8099,
268,
7203,
948,
70,
5404,
12,
17350,
13,
8664,
4943,
201,
198,
19282,
448,
11,
336,
1082,
81,
796,
279,
13,
10709,
5344,
3419,
201,
198
] | 2.44186 | 129 |
# -*- coding: utf-8 -*-
import datetime, json, logging, os, pprint
from availability_app import settings_app
from availability_app.lib import view_info_helper
from availability_app.lib.concurrency import AsyncHelper # temporary demo helper
from availability_app.lib.ezb_v1_handler import EzbV1Helper
from availability_app.lib.bib_items_v2 import BibItemsInfo
from availability_app.lib.bib_items_async_v2 import BibItemsInfoAsync # not yet in production
from availability_app.lib.stats_v1_handler import StatsValidator, StatsBuilder
from django.conf import settings as project_settings
from django.contrib.auth import logout
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseBadRequest, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
log = logging.getLogger( __name__ )
slog = logging.getLogger( 'stats_logger' )
ezb1_helper = EzbV1Helper()
stats_builder = StatsBuilder()
stats_validator = StatsValidator()
bib_items = BibItemsInfo()
# ===========================
# demo handlers
# ===========================
def concurrency_test( request ):
""" Tests concurrency, via trio, with django. """
if project_settings.DEBUG == False: # only active on dev-server
return HttpResponseNotFound( '<div>404 / Not Found</div>' )
async_hlpr = AsyncHelper()
url_dct = {
'shortest': 'https://httpbin.org/delay/.6',
'shorter': 'https://httpbin.org/delay/.8',
'standard': 'https://httpbin.org/delay/1',
'longer': 'https://httpbin.org/delay/1.2',
'longest': 'https://httpbin.org/delay/1.4' }
if request.GET.get( 'outlier', '' ) == 'yes':
url_dct['outlier'] = 'https://httpbin.org/delay/10'
async_hlpr.process_urls( url_dct )
response_dct = { 'results:': async_hlpr.results_dct, 'total_time_taken': async_hlpr.total_time_taken }
output = json.dumps( response_dct, sort_keys=True, indent=2 )
return HttpResponse( output, content_type='application/json; charset=utf-8' )
def v2_bib_items_async( request, bib_value ):
""" Not currently used; non-async version in production is used by easyrequest_hay. """
# if project_settings.DEBUG == False: # only active on dev-server
# return HttpResponseNotFound( '<div>404 / Not Found</div>' )
bib_items_async = bitems_async = BibItemsInfoAsync()
log.debug( f'starting... request.__dict__, ```{request.__dict__}```' )
start_stamp = datetime.datetime.now()
query_dct = bitems_async.build_query_dct( request, start_stamp )
raw_data_dct = bitems_async.manage_data_calls( bib_value )
host = request.META.get( 'HTTP_HOST', '127.0.0.1' )
data_dct = bitems_async.prep_data( raw_data_dct, host )
response_dct = bitems_async.build_response_dct( data_dct, start_stamp )
jsn = json.dumps( { 'query': query_dct, 'response': response_dct }, sort_keys=True, indent=2 )
return HttpResponse( jsn, content_type='application/javascript; charset=utf-8' )
# ===========================
# primary app handlers
# ===========================
def ezb_v1( request, id_type, id_value ):
""" Handles existing easyborrow-api call. """
params = request.GET
log.debug( 'starting; id_type, `%s`; id_value, `%s`' % (id_type, id_value) )
validity_dct = ezb1_helper.validate( id_type, id_value )
if validity_dct['validity'] is not True:
data_dct = { 'query': ezb1_helper.build_query_dct( request, datetime.datetime.now() ), u'response': {u'error': validity_dct['error']} }
jsn = json.dumps( data_dct, sort_keys=True, indent=2 )
return HttpResponseBadRequest( jsn, content_type=u'application/javascript; charset=utf-8' )
else:
data_dct = ezb1_helper.build_data_dct( id_type, validity_dct['value'], request.GET.get('show_marc', ''), request )
jsn = json.dumps( data_dct, sort_keys=True, indent=2 )
return HttpResponse( jsn, content_type='application/javascript; charset=utf-8' )
def v2_bib_items( request, bib_value ):
""" Handles easy_request_hay call. """
# log.debug( f'starting... request.__dict__, ```{pprint.pformat(request.__dict__)}```' )
log.debug( f'starting... request.__dict__, ```{request.__dict__}```' )
start_stamp = datetime.datetime.now()
query_dct = bib_items.build_query_dct( request, start_stamp )
host = request.META.get( 'HTTP_HOST', '127.0.0.1' )
data_dct = bib_items.prep_data( bib_value, host )
## TODO- refactor this quick-handling of a bad sierra response
response_dct = {}
if 'httpStatus' in data_dct.keys():
if data_dct['httpStatus'] != 200:
response_dct = { 'problem_sierra_response': data_dct }
jsn = json.dumps( { 'query': query_dct, 'response': response_dct }, sort_keys=True, indent=2 )
return HttpResponseNotFound( jsn, content_type='application/javascript; charset=utf-8' )
else:
response_dct = bib_items.build_response_dct( data_dct, start_stamp )
jsn = json.dumps( { 'query': query_dct, 'response': response_dct }, sort_keys=True, indent=2 )
return HttpResponse( jsn, content_type='application/javascript; charset=utf-8' )
def ezb_v1_stats( request ):
""" Returns basic stats on v1-api usage. """
log.debug( 'starting ezb_v1_stats()' )
slog.info( 'new entry!' )
## grab & validate params
rq_now = datetime.datetime.now()
if stats_validator.check_params( request.GET, request.scheme, request.META['HTTP_HOST'], rq_now ) == False:
return HttpResponseBadRequest( stats_validator.output, content_type=u'application/javascript; charset=utf-8' )
## run-query
results = stats_builder.run_query( request.GET )
## build response
stats_builder.build_response( results, request.GET, request.scheme, request.META['HTTP_HOST'], rq_now )
return HttpResponse( stats_builder.output, content_type=u'application/javascript; charset=utf-8' )
def locations_and_statuses( request ):
""" Shows values being used. """
rq_now = datetime.datetime.now()
data_dct = {
'query': ezb1_helper.build_query_dct( request, rq_now ),
'response': {
'ezb_available_locations': json.loads( os.environ['AVL_API__EZB_AVAILABLE_LOCATIONS'] ),
'ezb_available_statuses': json.loads( os.environ['AVL_API__EZB_AVAILABLE_STATUSES'] ),
'time_taken': str( datetime.datetime.now() - rq_now ) }
}
output = json.dumps( data_dct, sort_keys=True, indent=2 )
return HttpResponse( output, content_type='application/json; charset=utf-8' )
# ===========================
# for development convenience
# ===========================
def version( request ):
""" Returns basic data including branch & commit. """
# log.debug( 'request.__dict__, ```%s```' % pprint.pformat(request.__dict__) )
rq_now = datetime.datetime.now()
commit = view_info_helper.get_commit()
branch = view_info_helper.get_branch()
info_txt = commit.replace( 'commit', branch )
resp_now = datetime.datetime.now()
taken = resp_now - rq_now
context_dct = view_info_helper.make_context( request, rq_now, info_txt, taken )
output = json.dumps( context_dct, sort_keys=True, indent=2 )
return HttpResponse( output, content_type='application/json; charset=utf-8' )
def error_check( request ):
""" For checking that admins receive error-emails. """
if project_settings.DEBUG == True:
1/0
else:
return HttpResponseNotFound( '<div>404 / Not Found</div>' )
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
4818,
8079,
11,
33918,
11,
18931,
11,
28686,
11,
279,
4798,
198,
198,
6738,
11500,
62,
1324,
1330,
6460,
62,
1324,
198,
6738,
11500,
62,
1324,
13,
8019,
1330,
1570,
62,
10951,
62,
2978,
525,
198,
6738,
11500,
62,
1324,
13,
8019,
13,
1102,
34415,
1330,
1081,
13361,
47429,
220,
1303,
8584,
13605,
31904,
198,
6738,
11500,
62,
1324,
13,
8019,
13,
8471,
65,
62,
85,
16,
62,
30281,
1330,
412,
14969,
53,
16,
47429,
198,
6738,
11500,
62,
1324,
13,
8019,
13,
65,
571,
62,
23814,
62,
85,
17,
1330,
43278,
23022,
12360,
198,
6738,
11500,
62,
1324,
13,
8019,
13,
65,
571,
62,
23814,
62,
292,
13361,
62,
85,
17,
1330,
43278,
23022,
12360,
42367,
220,
1303,
407,
1865,
287,
3227,
198,
6738,
11500,
62,
1324,
13,
8019,
13,
34242,
62,
85,
16,
62,
30281,
1330,
20595,
47139,
1352,
11,
20595,
32875,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
355,
1628,
62,
33692,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
2604,
448,
198,
6738,
42625,
14208,
13,
7295,
13,
6371,
411,
349,
690,
1330,
9575,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
11,
367,
29281,
31077,
3673,
21077,
11,
367,
29281,
31077,
22069,
18453,
11,
367,
29281,
31077,
7738,
1060,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
651,
62,
15252,
62,
273,
62,
26429,
11,
8543,
628,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
11593,
3672,
834,
1267,
198,
82,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
705,
34242,
62,
6404,
1362,
6,
1267,
198,
8471,
65,
16,
62,
2978,
525,
796,
412,
14969,
53,
16,
47429,
3419,
198,
34242,
62,
38272,
796,
20595,
32875,
3419,
198,
34242,
62,
12102,
1352,
796,
20595,
47139,
1352,
3419,
198,
65,
571,
62,
23814,
796,
43278,
23022,
12360,
3419,
628,
198,
2,
36658,
2559,
855,
198,
2,
13605,
32847,
198,
2,
36658,
2559,
855,
628,
198,
4299,
1673,
13382,
62,
9288,
7,
2581,
15179,
198,
220,
220,
220,
37227,
30307,
1673,
13382,
11,
2884,
19886,
11,
351,
42625,
14208,
13,
37227,
198,
220,
220,
220,
611,
1628,
62,
33692,
13,
30531,
6624,
10352,
25,
220,
1303,
691,
4075,
319,
1614,
12,
15388,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
29281,
31077,
3673,
21077,
7,
705,
27,
7146,
29,
26429,
1220,
1892,
4062,
3556,
7146,
29,
6,
1267,
198,
220,
220,
220,
30351,
62,
18519,
1050,
796,
1081,
13361,
47429,
3419,
198,
220,
220,
220,
19016,
62,
67,
310,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
19509,
395,
10354,
705,
5450,
1378,
4023,
8800,
13,
2398,
14,
40850,
11757,
21,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
1477,
4337,
10354,
705,
5450,
1378,
4023,
8800,
13,
2398,
14,
40850,
11757,
23,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
20307,
10354,
705,
5450,
1378,
4023,
8800,
13,
2398,
14,
40850,
14,
16,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
6511,
263,
10354,
705,
5450,
1378,
4023,
8800,
13,
2398,
14,
40850,
14,
16,
13,
17,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
6511,
395,
10354,
705,
5450,
1378,
4023,
8800,
13,
2398,
14,
40850,
14,
16,
13,
19,
6,
1782,
198,
220,
220,
220,
611,
2581,
13,
18851,
13,
1136,
7,
705,
448,
2505,
3256,
10148,
1267,
6624,
705,
8505,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
19016,
62,
67,
310,
17816,
448,
2505,
20520,
796,
705,
5450,
1378,
4023,
8800,
13,
2398,
14,
40850,
14,
940,
6,
198,
220,
220,
220,
30351,
62,
18519,
1050,
13,
14681,
62,
6371,
82,
7,
19016,
62,
67,
310,
1267,
198,
220,
220,
220,
2882,
62,
67,
310,
796,
1391,
705,
43420,
25,
10354,
30351,
62,
18519,
1050,
13,
43420,
62,
67,
310,
11,
705,
23350,
62,
2435,
62,
83,
1685,
10354,
30351,
62,
18519,
1050,
13,
23350,
62,
2435,
62,
83,
1685,
1782,
198,
220,
220,
220,
5072,
796,
33918,
13,
67,
8142,
7,
2882,
62,
67,
310,
11,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
1441,
367,
29281,
31077,
7,
5072,
11,
2695,
62,
4906,
11639,
31438,
14,
17752,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
628,
198,
4299,
410,
17,
62,
65,
571,
62,
23814,
62,
292,
13361,
7,
2581,
11,
275,
571,
62,
8367,
15179,
198,
220,
220,
220,
37227,
1892,
3058,
973,
26,
1729,
12,
292,
13361,
2196,
287,
3227,
318,
973,
416,
2562,
25927,
62,
71,
323,
13,
37227,
198,
220,
220,
220,
1303,
611,
1628,
62,
33692,
13,
30531,
6624,
10352,
25,
220,
1303,
691,
4075,
319,
1614,
12,
15388,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1441,
367,
29281,
31077,
3673,
21077,
7,
705,
27,
7146,
29,
26429,
1220,
1892,
4062,
3556,
7146,
29,
6,
1267,
198,
220,
220,
220,
275,
571,
62,
23814,
62,
292,
13361,
796,
1643,
5232,
62,
292,
13361,
796,
43278,
23022,
12360,
42367,
3419,
198,
220,
220,
220,
2604,
13,
24442,
7,
277,
338,
83,
433,
278,
986,
2581,
13,
834,
11600,
834,
11,
7559,
63,
90,
25927,
13,
834,
11600,
834,
92,
15506,
63,
6,
1267,
198,
220,
220,
220,
923,
62,
301,
696,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
198,
220,
220,
220,
12405,
62,
67,
310,
796,
1643,
5232,
62,
292,
13361,
13,
11249,
62,
22766,
62,
67,
310,
7,
2581,
11,
923,
62,
301,
696,
1267,
198,
220,
220,
220,
8246,
62,
7890,
62,
67,
310,
796,
1643,
5232,
62,
292,
13361,
13,
805,
496,
62,
7890,
62,
66,
5691,
7,
275,
571,
62,
8367,
1267,
198,
220,
220,
220,
2583,
796,
2581,
13,
44,
20892,
13,
1136,
7,
705,
40717,
62,
39,
10892,
3256,
705,
16799,
13,
15,
13,
15,
13,
16,
6,
1267,
198,
220,
220,
220,
1366,
62,
67,
310,
796,
1643,
5232,
62,
292,
13361,
13,
46012,
62,
7890,
7,
8246,
62,
7890,
62,
67,
310,
11,
2583,
1267,
198,
220,
220,
220,
2882,
62,
67,
310,
796,
1643,
5232,
62,
292,
13361,
13,
11249,
62,
26209,
62,
67,
310,
7,
1366,
62,
67,
310,
11,
923,
62,
301,
696,
1267,
198,
220,
220,
220,
474,
16184,
796,
33918,
13,
67,
8142,
7,
1391,
705,
22766,
10354,
12405,
62,
67,
310,
11,
705,
26209,
10354,
2882,
62,
67,
310,
8964,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
1441,
367,
29281,
31077,
7,
474,
16184,
11,
2695,
62,
4906,
11639,
31438,
14,
37495,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
628,
198,
2,
36658,
2559,
855,
198,
2,
4165,
598,
32847,
198,
2,
36658,
2559,
855,
628,
198,
4299,
304,
14969,
62,
85,
16,
7,
2581,
11,
4686,
62,
4906,
11,
4686,
62,
8367,
15179,
198,
220,
220,
220,
37227,
7157,
829,
4683,
2562,
2865,
808,
12,
15042,
869,
13,
37227,
198,
220,
220,
220,
42287,
796,
2581,
13,
18851,
198,
220,
220,
220,
2604,
13,
24442,
7,
705,
38690,
26,
4686,
62,
4906,
11,
4600,
4,
82,
63,
26,
4686,
62,
8367,
11,
4600,
4,
82,
63,
6,
4064,
357,
312,
62,
4906,
11,
4686,
62,
8367,
8,
1267,
198,
220,
220,
220,
19648,
62,
67,
310,
796,
304,
14969,
16,
62,
2978,
525,
13,
12102,
378,
7,
4686,
62,
4906,
11,
4686,
62,
8367,
1267,
198,
220,
220,
220,
611,
19648,
62,
67,
310,
17816,
12102,
414,
20520,
318,
407,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
67,
310,
796,
1391,
705,
22766,
10354,
304,
14969,
16,
62,
2978,
525,
13,
11249,
62,
22766,
62,
67,
310,
7,
2581,
11,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
10612,
334,
821,
2777,
2591,
10354,
1391,
84,
6,
18224,
10354,
19648,
62,
67,
310,
17816,
18224,
20520,
92,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
474,
16184,
796,
33918,
13,
67,
8142,
7,
1366,
62,
67,
310,
11,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
29281,
31077,
22069,
18453,
7,
474,
16184,
11,
2695,
62,
4906,
28,
84,
6,
31438,
14,
37495,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
67,
310,
796,
304,
14969,
16,
62,
2978,
525,
13,
11249,
62,
7890,
62,
67,
310,
7,
4686,
62,
4906,
11,
19648,
62,
67,
310,
17816,
8367,
6,
4357,
2581,
13,
18851,
13,
1136,
10786,
12860,
62,
3876,
66,
3256,
10148,
828,
2581,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
474,
16184,
796,
33918,
13,
67,
8142,
7,
1366,
62,
67,
310,
11,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
29281,
31077,
7,
474,
16184,
11,
2695,
62,
4906,
11639,
31438,
14,
37495,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
628,
198,
4299,
410,
17,
62,
65,
571,
62,
23814,
7,
2581,
11,
275,
571,
62,
8367,
15179,
198,
220,
220,
220,
37227,
7157,
829,
2562,
62,
25927,
62,
71,
323,
869,
13,
37227,
198,
220,
220,
220,
1303,
2604,
13,
24442,
7,
277,
338,
83,
433,
278,
986,
2581,
13,
834,
11600,
834,
11,
7559,
63,
90,
381,
22272,
13,
79,
18982,
7,
25927,
13,
834,
11600,
834,
38165,
15506,
63,
6,
1267,
198,
220,
220,
220,
2604,
13,
24442,
7,
277,
338,
83,
433,
278,
986,
2581,
13,
834,
11600,
834,
11,
7559,
63,
90,
25927,
13,
834,
11600,
834,
92,
15506,
63,
6,
1267,
198,
220,
220,
220,
923,
62,
301,
696,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
198,
220,
220,
220,
12405,
62,
67,
310,
796,
275,
571,
62,
23814,
13,
11249,
62,
22766,
62,
67,
310,
7,
2581,
11,
923,
62,
301,
696,
1267,
198,
220,
220,
220,
2583,
796,
2581,
13,
44,
20892,
13,
1136,
7,
705,
40717,
62,
39,
10892,
3256,
705,
16799,
13,
15,
13,
15,
13,
16,
6,
1267,
198,
220,
220,
220,
1366,
62,
67,
310,
796,
275,
571,
62,
23814,
13,
46012,
62,
7890,
7,
275,
571,
62,
8367,
11,
2583,
1267,
198,
220,
220,
220,
22492,
16926,
46,
12,
1006,
11218,
428,
2068,
12,
4993,
1359,
286,
257,
2089,
264,
16367,
2882,
198,
220,
220,
220,
2882,
62,
67,
310,
796,
23884,
198,
220,
220,
220,
611,
705,
4023,
19580,
6,
287,
1366,
62,
67,
310,
13,
13083,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1366,
62,
67,
310,
17816,
4023,
19580,
20520,
14512,
939,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2882,
62,
67,
310,
796,
1391,
705,
45573,
62,
82,
16367,
62,
26209,
10354,
1366,
62,
67,
310,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
474,
16184,
796,
33918,
13,
67,
8142,
7,
1391,
705,
22766,
10354,
12405,
62,
67,
310,
11,
705,
26209,
10354,
2882,
62,
67,
310,
8964,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
29281,
31077,
3673,
21077,
7,
474,
16184,
11,
2695,
62,
4906,
11639,
31438,
14,
37495,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2882,
62,
67,
310,
796,
275,
571,
62,
23814,
13,
11249,
62,
26209,
62,
67,
310,
7,
1366,
62,
67,
310,
11,
923,
62,
301,
696,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
474,
16184,
796,
33918,
13,
67,
8142,
7,
1391,
705,
22766,
10354,
12405,
62,
67,
310,
11,
705,
26209,
10354,
2882,
62,
67,
310,
8964,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
29281,
31077,
7,
474,
16184,
11,
2695,
62,
4906,
11639,
31438,
14,
37495,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
628,
198,
4299,
304,
14969,
62,
85,
16,
62,
34242,
7,
2581,
15179,
198,
220,
220,
220,
37227,
16409,
4096,
9756,
319,
410,
16,
12,
15042,
8748,
13,
37227,
198,
220,
220,
220,
2604,
13,
24442,
7,
705,
38690,
304,
14969,
62,
85,
16,
62,
34242,
3419,
6,
1267,
198,
220,
220,
220,
25801,
13,
10951,
7,
705,
3605,
5726,
13679,
1267,
198,
220,
220,
220,
22492,
5552,
1222,
26571,
42287,
198,
220,
220,
220,
374,
80,
62,
2197,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
198,
220,
220,
220,
611,
9756,
62,
12102,
1352,
13,
9122,
62,
37266,
7,
2581,
13,
18851,
11,
2581,
13,
15952,
1326,
11,
2581,
13,
44,
20892,
17816,
40717,
62,
39,
10892,
6,
4357,
374,
80,
62,
2197,
1267,
6624,
10352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
29281,
31077,
22069,
18453,
7,
9756,
62,
12102,
1352,
13,
22915,
11,
2695,
62,
4906,
28,
84,
6,
31438,
14,
37495,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
198,
220,
220,
220,
22492,
1057,
12,
22766,
198,
220,
220,
220,
2482,
796,
9756,
62,
38272,
13,
5143,
62,
22766,
7,
2581,
13,
18851,
1267,
198,
220,
220,
220,
22492,
1382,
2882,
198,
220,
220,
220,
9756,
62,
38272,
13,
11249,
62,
26209,
7,
2482,
11,
2581,
13,
18851,
11,
2581,
13,
15952,
1326,
11,
2581,
13,
44,
20892,
17816,
40717,
62,
39,
10892,
6,
4357,
374,
80,
62,
2197,
1267,
198,
220,
220,
220,
1441,
367,
29281,
31077,
7,
9756,
62,
38272,
13,
22915,
11,
2695,
62,
4906,
28,
84,
6,
31438,
14,
37495,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
628,
198,
4299,
7064,
62,
392,
62,
14269,
2664,
7,
2581,
15179,
198,
220,
220,
220,
37227,
25156,
3815,
852,
973,
13,
37227,
198,
220,
220,
220,
374,
80,
62,
2197,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
198,
220,
220,
220,
1366,
62,
67,
310,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
22766,
10354,
304,
14969,
16,
62,
2978,
525,
13,
11249,
62,
22766,
62,
67,
310,
7,
2581,
11,
374,
80,
62,
2197,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
705,
26209,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
8471,
65,
62,
15182,
62,
17946,
602,
10354,
33918,
13,
46030,
7,
28686,
13,
268,
2268,
17816,
10116,
43,
62,
17614,
834,
36,
57,
33,
62,
10116,
32,
4146,
17534,
62,
29701,
18421,
20520,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
8471,
65,
62,
15182,
62,
14269,
2664,
10354,
33918,
13,
46030,
7,
28686,
13,
268,
2268,
17816,
10116,
43,
62,
17614,
834,
36,
57,
33,
62,
10116,
32,
4146,
17534,
62,
35744,
2937,
1546,
20520,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2435,
62,
83,
1685,
10354,
965,
7,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
532,
374,
80,
62,
2197,
1267,
1782,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
5072,
796,
33918,
13,
67,
8142,
7,
1366,
62,
67,
310,
11,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
1441,
367,
29281,
31077,
7,
5072,
11,
2695,
62,
4906,
11639,
31438,
14,
17752,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
628,
198,
2,
36658,
2559,
855,
198,
2,
329,
2478,
15607,
198,
2,
36658,
2559,
855,
628,
198,
4299,
2196,
7,
2581,
15179,
198,
220,
220,
220,
37227,
16409,
4096,
1366,
1390,
8478,
1222,
4589,
13,
37227,
198,
220,
220,
220,
1303,
2604,
13,
24442,
7,
705,
25927,
13,
834,
11600,
834,
11,
7559,
63,
4,
82,
15506,
63,
6,
4064,
279,
4798,
13,
79,
18982,
7,
25927,
13,
834,
11600,
834,
8,
1267,
198,
220,
220,
220,
374,
80,
62,
2197,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
198,
220,
220,
220,
4589,
796,
1570,
62,
10951,
62,
2978,
525,
13,
1136,
62,
41509,
3419,
198,
220,
220,
220,
8478,
796,
1570,
62,
10951,
62,
2978,
525,
13,
1136,
62,
1671,
3702,
3419,
198,
220,
220,
220,
7508,
62,
14116,
796,
4589,
13,
33491,
7,
705,
41509,
3256,
8478,
1267,
198,
220,
220,
220,
1217,
62,
2197,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
198,
220,
220,
220,
2077,
796,
1217,
62,
2197,
532,
374,
80,
62,
2197,
198,
220,
220,
220,
4732,
62,
67,
310,
796,
1570,
62,
10951,
62,
2978,
525,
13,
15883,
62,
22866,
7,
2581,
11,
374,
80,
62,
2197,
11,
7508,
62,
14116,
11,
2077,
1267,
198,
220,
220,
220,
5072,
796,
33918,
13,
67,
8142,
7,
4732,
62,
67,
310,
11,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
17,
1267,
198,
220,
220,
220,
1441,
367,
29281,
31077,
7,
5072,
11,
2695,
62,
4906,
11639,
31438,
14,
17752,
26,
34534,
316,
28,
40477,
12,
23,
6,
1267,
628,
198,
4299,
4049,
62,
9122,
7,
2581,
15179,
198,
220,
220,
220,
37227,
1114,
10627,
326,
44563,
3328,
4049,
12,
368,
1768,
13,
37227,
198,
220,
220,
220,
611,
1628,
62,
33692,
13,
30531,
6624,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
352,
14,
15,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
29281,
31077,
3673,
21077,
7,
705,
27,
7146,
29,
26429,
1220,
1892,
4062,
3556,
7146,
29,
6,
1267,
198
] | 2.589752 | 2,908 |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
import time
wd = webdriver.Firefox()
wd.get("https://www.google.com/search?q=python")
# wd.find_element_by_css_selector("a").click() # This doesn't work, same error
# The css selector is needed, because not all a tags are clickable
WebDriverWait(wd, 20).until(
expected_conditions.element_to_be_clickable((By.CSS_SELECTOR, 'div[id=search] a[href^="http"]'))
).click()
# WebDriverWait(wd, 20).until(
# expected_conditions.element_to_be_clickable((By.XPATH, "//div[@id='search']//a[contains(@href,'http')]"))
# ).click()
time.sleep(5)
wd.close()
| [
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
13,
9019,
1330,
5313,
32103,
21321,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
1525,
1330,
2750,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
1330,
2938,
62,
17561,
1756,
198,
11748,
640,
198,
198,
16993,
796,
3992,
26230,
13,
13543,
12792,
3419,
198,
198,
16993,
13,
1136,
7203,
5450,
1378,
2503,
13,
13297,
13,
785,
14,
12947,
30,
80,
28,
29412,
4943,
198,
198,
2,
266,
67,
13,
19796,
62,
30854,
62,
1525,
62,
25471,
62,
19738,
273,
7203,
64,
11074,
12976,
3419,
220,
1303,
770,
1595,
470,
670,
11,
976,
4049,
198,
198,
2,
383,
269,
824,
31870,
318,
2622,
11,
780,
407,
477,
257,
15940,
389,
3904,
540,
198,
13908,
32103,
21321,
7,
16993,
11,
1160,
737,
28446,
7,
198,
220,
220,
220,
2938,
62,
17561,
1756,
13,
30854,
62,
1462,
62,
1350,
62,
12976,
540,
19510,
3886,
13,
49155,
62,
46506,
1581,
11,
705,
7146,
58,
312,
28,
12947,
60,
257,
58,
33257,
61,
2625,
4023,
8973,
6,
4008,
198,
737,
12976,
3419,
198,
198,
2,
5313,
32103,
21321,
7,
16993,
11,
1160,
737,
28446,
7,
198,
2,
220,
220,
220,
220,
2938,
62,
17561,
1756,
13,
30854,
62,
1462,
62,
1350,
62,
12976,
540,
19510,
3886,
13,
27481,
12599,
11,
366,
1003,
7146,
58,
31,
312,
11639,
12947,
20520,
1003,
64,
58,
3642,
1299,
7,
31,
33257,
4032,
4023,
11537,
30866,
4008,
198,
2,
6739,
12976,
3419,
198,
198,
2435,
13,
42832,
7,
20,
8,
198,
198,
16993,
13,
19836,
3419,
198
] | 2.788104 | 269 |
from functools import wraps
from flask import g, abort | [
6738,
1257,
310,
10141,
1330,
27521,
198,
6738,
42903,
1330,
308,
11,
15614,
220
] | 3.928571 | 14 |
#Elsa by Frostmeister
import discord
import math
import time
import datetime
import googlesearch as gs
import urbandictionary as ud
import random
import asyncio
import os
from discord.ext import commands
bot = commands.Bot(description=" The Snow Queen ❄️" , command_prefix=("e!","E!"))
################ EVENTS ###################
@bot.event
@bot.event
@bot.event
@bot.event
@bot.event
@bot.event
@bot.event
############ BOT RUN ################
bot.run(os.getenv("TOKEN"))
| [
2,
49050,
416,
15122,
1326,
1694,
628,
198,
198,
11748,
36446,
198,
11748,
10688,
198,
11748,
640,
198,
11748,
4818,
8079,
198,
11748,
467,
519,
829,
3679,
355,
308,
82,
198,
11748,
2956,
3903,
14188,
355,
334,
67,
198,
11748,
4738,
198,
11748,
30351,
952,
198,
11748,
28686,
198,
6738,
36446,
13,
2302,
1330,
9729,
628,
198,
198,
13645,
796,
9729,
13,
20630,
7,
11213,
2625,
383,
7967,
7542,
43074,
226,
37929,
1,
837,
3141,
62,
40290,
28,
7203,
68,
0,
2430,
36,
2474,
4008,
628,
198,
198,
14468,
220,
220,
22399,
220,
220,
1303,
14468,
2235,
628,
198,
31,
13645,
13,
15596,
628,
198,
220,
220,
220,
628,
628,
198,
31,
13645,
13,
15596,
628,
628,
198,
198,
31,
13645,
13,
15596,
628,
628,
198,
31,
13645,
13,
15596,
628,
198,
31,
13645,
13,
15596,
628,
628,
198,
31,
13645,
13,
15596,
628,
628,
628,
198,
198,
31,
13645,
13,
15596,
628,
628,
628,
628,
628,
628,
198,
198,
7804,
4242,
220,
220,
220,
220,
347,
2394,
32494,
220,
220,
220,
1303,
7804,
4242,
21017,
198,
198,
13645,
13,
5143,
7,
418,
13,
1136,
24330,
7203,
10468,
43959,
48774,
628
] | 2.837696 | 191 |
# Working in IT, a lot of what we do boils down to using a computer to perform a
# certain task. In your job you might create user accounts, configure the network,
# install software, backup existing data, or execute a whole range of other
# computer based tasks from day to day. Back in my first IT job, I realized that
# every day I came into work I typed the same three commands to authenticate
# into systems. Those credentials timed out everyday by design, for security
# reasons, so I created a script that would automatically run these commands for
# me every morning to avoid having to type them myself. Funny enough, the team
# that monitors anomalous activity discovered my little invention and contacted
# me to remove it, oops. Tasks performed by a computer that need to be done
# multiple times with little variation are really well suited for automation, because
# when you automate a task you avoid the possibility of human errors, and reduce
# the time it takes to do it. Imagine this scenario, your company had a booth at a
# recent conference and has gathered a huge list of emails from people interested
# in learning more about your products. You want to send these people your
# monthly email newsletter, but some of the people on the list are already
# subscribed to receive it. So how do you make sure everyone receives your
# newsletter, without accidentally sending it to the same person twice? Well, you
# could manually check each email address one by one to make sure you only add
# new ones to the list, sounds boring and inefficient, right? It could be, and it's also
# more error prone, you might accidentally miss new emails, or add emails that
# were already there, or it might get so boring you fall asleep at your desk, Even
# your automated coffee machine won't help you out there. So what could you do
# instead? You could get the computer to do the work for you. You could write a
# program that checks for duplicates, and the adds each new email to the list.
# Your computer will do exactly as its told no matter how many emails there are in
# the list, so it won't get tired or make any mistakes. Even better, once you've
# written the program you can use the same code in the future situations, saving
# you even more time, pretty cool, right? It gets better, think about when you're
# going to send these emails out, if you send them out manually you'll have to send
# the same email to everybody, personalizing the emails would be way too much
# manual work. If instead you use automation to send them, you could have the
# name and company of each person added to the email automatically. The result?
# More effective emails, without you spending hours inserting names into the text.
# Automating tasks allows you to focus on projects that are a better use of your
# time, letting computer do the boring stuff for you. Learning how to program is
# the first step to being able to do this, if you want to get computers to do the
# work for you, you're in the right place. Earlier in this video I told you about the
# first task I ever automated, now I want to tell you about coolest thing I ever
# automated. It was a script that changed a bunch of access permissions for a
# whole lot of Google Internal Services. The script reversed a large directory tree
# with tons of different files, checked the file contents, and then updated the
# permissions to the services based on the conditions that I laid out in the script.
# Okay, I admit I'm total nerd, but I still think it's really cool. Next up, it's time to
# share your ideas. What things would you like to automate using programming?
# While these discussion prompts are optional, they're really fun. Seriously, they let
# you get to know your fellow learners a bit, and collaborate on ideas and insights.
# Make sure you read what others are saying, they may give you ideas that you
# haven't even though of. After that, you're ready to take your very first quiz of the
# course. Don't worry, it's just for practice.
| [
2,
14594,
287,
7283,
11,
257,
1256,
286,
644,
356,
466,
40169,
866,
284,
1262,
257,
3644,
284,
1620,
257,
198,
2,
1728,
4876,
13,
554,
534,
1693,
345,
1244,
2251,
2836,
5504,
11,
17425,
262,
3127,
11,
198,
2,
2721,
3788,
11,
11559,
4683,
1366,
11,
393,
12260,
257,
2187,
2837,
286,
584,
198,
2,
3644,
1912,
8861,
422,
1110,
284,
1110,
13,
5157,
287,
616,
717,
7283,
1693,
11,
314,
6939,
326,
198,
2,
790,
1110,
314,
1625,
656,
670,
314,
25683,
262,
976,
1115,
9729,
284,
8323,
5344,
198,
2,
656,
3341,
13,
5845,
18031,
28805,
503,
10908,
416,
1486,
11,
329,
2324,
198,
2,
3840,
11,
523,
314,
2727,
257,
4226,
326,
561,
6338,
1057,
777,
9729,
329,
198,
2,
502,
790,
3329,
284,
3368,
1719,
284,
2099,
606,
3589,
13,
40473,
1576,
11,
262,
1074,
198,
2,
326,
19374,
26921,
516,
3842,
5071,
616,
1310,
14250,
290,
11237,
198,
2,
502,
284,
4781,
340,
11,
267,
2840,
13,
309,
6791,
6157,
416,
257,
3644,
326,
761,
284,
307,
1760,
198,
2,
3294,
1661,
351,
1310,
12291,
389,
1107,
880,
16662,
329,
22771,
11,
780,
198,
2,
618,
345,
43511,
257,
4876,
345,
3368,
262,
5885,
286,
1692,
8563,
11,
290,
4646,
198,
2,
262,
640,
340,
2753,
284,
466,
340,
13,
18450,
428,
8883,
11,
534,
1664,
550,
257,
18600,
379,
257,
198,
2,
2274,
4495,
290,
468,
9272,
257,
3236,
1351,
286,
7237,
422,
661,
4609,
198,
2,
287,
4673,
517,
546,
534,
3186,
13,
921,
765,
284,
3758,
777,
661,
534,
198,
2,
9651,
3053,
13129,
11,
475,
617,
286,
262,
661,
319,
262,
1351,
389,
1541,
198,
2,
45794,
284,
3328,
340,
13,
1406,
703,
466,
345,
787,
1654,
2506,
11583,
534,
198,
2,
13129,
11,
1231,
14716,
7216,
340,
284,
262,
976,
1048,
5403,
30,
3894,
11,
345,
198,
2,
714,
14500,
2198,
1123,
3053,
2209,
530,
416,
530,
284,
787,
1654,
345,
691,
751,
198,
2,
649,
3392,
284,
262,
1351,
11,
5238,
14262,
290,
30904,
11,
826,
30,
632,
714,
307,
11,
290,
340,
338,
635,
198,
2,
517,
4049,
17592,
11,
345,
1244,
14716,
2051,
649,
7237,
11,
393,
751,
7237,
326,
198,
2,
547,
1541,
612,
11,
393,
340,
1244,
651,
523,
14262,
345,
2121,
16039,
379,
534,
6915,
11,
3412,
198,
2,
534,
16359,
6891,
4572,
1839,
470,
1037,
345,
503,
612,
13,
1406,
644,
714,
345,
466,
198,
2,
2427,
30,
921,
714,
651,
262,
3644,
284,
466,
262,
670,
329,
345,
13,
921,
714,
3551,
257,
198,
2,
1430,
326,
8794,
329,
14184,
16856,
11,
290,
262,
6673,
1123,
649,
3053,
284,
262,
1351,
13,
198,
2,
3406,
3644,
481,
466,
3446,
355,
663,
1297,
645,
2300,
703,
867,
7237,
612,
389,
287,
198,
2,
262,
1351,
11,
523,
340,
1839,
470,
651,
10032,
393,
787,
597,
10135,
13,
3412,
1365,
11,
1752,
345,
1053,
198,
2,
3194,
262,
1430,
345,
460,
779,
262,
976,
2438,
287,
262,
2003,
7445,
11,
8914,
198,
2,
345,
772,
517,
640,
11,
2495,
3608,
11,
826,
30,
632,
3011,
1365,
11,
892,
546,
618,
345,
821,
198,
2,
1016,
284,
3758,
777,
7237,
503,
11,
611,
345,
3758,
606,
503,
14500,
345,
1183,
423,
284,
3758,
198,
2,
262,
976,
3053,
284,
7288,
11,
2614,
2890,
262,
7237,
561,
307,
835,
1165,
881,
198,
2,
10107,
670,
13,
1002,
2427,
345,
779,
22771,
284,
3758,
606,
11,
345,
714,
423,
262,
198,
2,
1438,
290,
1664,
286,
1123,
1048,
2087,
284,
262,
3053,
6338,
13,
383,
1255,
30,
198,
2,
3125,
4050,
7237,
11,
1231,
345,
4581,
2250,
19319,
3891,
656,
262,
2420,
13,
198,
2,
17406,
803,
8861,
3578,
345,
284,
2962,
319,
4493,
326,
389,
257,
220,
1365,
779,
286,
534,
198,
2,
640,
11,
9616,
3644,
466,
262,
14262,
3404,
329,
345,
13,
18252,
703,
284,
1430,
318,
198,
2,
262,
717,
2239,
284,
852,
1498,
284,
466,
428,
11,
611,
345,
765,
284,
651,
9061,
284,
466,
262,
198,
2,
670,
329,
345,
11,
345,
821,
287,
262,
826,
1295,
13,
20635,
287,
428,
2008,
314,
1297,
345,
546,
262,
198,
2,
717,
4876,
314,
1683,
16359,
11,
783,
314,
765,
284,
1560,
345,
546,
38889,
1517,
314,
1683,
198,
2,
16359,
13,
632,
373,
257,
4226,
326,
3421,
257,
7684,
286,
1895,
21627,
329,
257,
198,
2,
2187,
1256,
286,
3012,
18628,
6168,
13,
383,
4226,
17687,
257,
1588,
8619,
5509,
198,
2,
351,
10860,
286,
1180,
3696,
11,
10667,
262,
2393,
10154,
11,
290,
788,
6153,
262,
198,
2,
21627,
284,
262,
2594,
1912,
319,
262,
3403,
326,
314,
8104,
503,
287,
262,
4226,
13,
198,
2,
16805,
11,
314,
9159,
314,
1101,
2472,
34712,
11,
475,
314,
991,
892,
340,
338,
1107,
3608,
13,
7406,
510,
11,
340,
338,
640,
284,
198,
2,
2648,
534,
4213,
13,
1867,
1243,
561,
345,
588,
284,
43511,
1262,
8300,
30,
198,
2,
2893,
777,
5114,
36454,
389,
11902,
11,
484,
821,
1107,
1257,
13,
27777,
11,
484,
1309,
198,
2,
345,
651,
284,
760,
534,
5891,
46184,
257,
1643,
11,
290,
30081,
319,
4213,
290,
17218,
13,
198,
2,
6889,
1654,
345,
1100,
644,
1854,
389,
2282,
11,
484,
743,
1577,
345,
4213,
326,
345,
198,
2,
4398,
470,
772,
996,
286,
13,
2293,
326,
11,
345,
821,
3492,
284,
1011,
534,
845,
717,
38964,
286,
262,
198,
2,
1781,
13,
2094,
470,
5490,
11,
340,
338,
655,
329,
3357,
13,
628,
198
] | 4.418681 | 910 |
"""
Analytic integral for vectorized field / potential computation
"""
__all__ = [
"c_coeffs",
"d_distance",
"gamma0",
"omega",
"potential_dipoles",
"potential_vertex_dipoles",
"triangle_potential_approx",
"triangle_potential_dipole_linear",
"triangle_potential_uniform",
"x_distance",
"x_distance2",
]
import numpy as np
def determinant(a):
"""Faster determinant for the two last dimensions of 'a'"""
det = a[..., 0, 0] * (a[..., 1, 1] * a[..., 2, 2] - a[..., 2, 1] * a[..., 1, 2])
det += a[..., 0, 1] * (a[..., 1, 2] * a[..., 2, 0] - a[..., 2, 2] * a[..., 1, 0])
det += a[..., 0, 2] * (a[..., 1, 0] * a[..., 2, 1] - a[..., 2, 0] * a[..., 1, 1])
return det
def norm(vecs):
"""Faster vector norm for the last dimension of 'vecs'"""
return np.sqrt(np.einsum("...i,...i", vecs, vecs))
def cross(r1, r2):
"""Cross product without overhead for the last dimensions of 'r1' and 'r2'"""
result = np.zeros(r1.shape)
result[..., 0] = r1[..., 1] * r2[..., 2] - r1[..., 2] * r2[..., 1]
result[..., 1] = r1[..., 2] * r2[..., 0] - r1[..., 0] * r2[..., 2]
result[..., 2] = r1[..., 0] * r2[..., 1] - r1[..., 1] * r2[..., 0]
return result
def gamma0(R, reg=1e-13, symmetrize=True):
"""1/r integrals over the edges of a triangle called gamma_0
(line charge potentials).
**NOTE: MAY NOT BE VERY PRECISE FOR POINTS DIRECTLY AT TRIANGLE
EDGES.**
Parameters
----------
R : ndarray (..., N_triverts, xyz)
displacement vectors (r-r') between Neval evaluation points (r)
and the 3 vertices of the Ntri triangles/triangle.
reg: float, a small value added to the arguments of the logarithm,
regularizes the values very close to the line segments
symmetrize: recalculates the result for by mirroring
the evaluation points with respect the line segment
mid point to get rid off the badly behaving points on the
negative extension of the line segment
Returns
-------
res: array (Neval, Nverts)
The analytic integrals for each vertex/edge
"""
edges = np.roll(R[0], 2, -2) - np.roll(R[0], 1, -2)
dotprods1 = np.einsum("...i,...i", np.roll(R, 1, -2), edges)
dotprods2 = np.einsum("...i,...i", np.roll(R, 2, -2), edges)
en = norm(edges)
del edges
n = norm(R)
# Regularize s.t. neither the denominator or the numerator can be zero
# Avoid numerical issues directly at the edge
nn1 = np.roll(n, 1, -1) * en
nn2 = np.roll(n, 2, -1) * en
res = np.log((nn1 + dotprods1 + reg) / (nn2 + dotprods2 + reg))
# Symmetrize the result since on the negative extension of the edge
# there's division of two small values resulting numerical instabilities
# (also incompatible with adding the reg value)
if symmetrize:
mask = ((np.abs(dotprods1 + nn1)) < 1e-12) * (dotprods1 + dotprods2 < 0)
res[mask] = -np.log(
(nn1[mask] - dotprods1[mask] + reg) / (nn2[mask] - dotprods2[mask] + reg)
)
res /= en
return -res
def omega(R):
"""Calculate the solid angle of a triangles
see
A. Van Oosterom and J. Strackee
IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING,
VOL. BME-30, NO. 2, 1983
Parameters
----------
R : ndarray (Neval, (Ntri), N_triverts, xyz)
displacement vectors (r-r') of Ntri triangles
and Neval evaluation points for the 3 vertices
of the triangles/triangle.
The shape of R can any with the constraint that
the last dimenion corrsponds to coordinates (x, y, z) and the
second last dimension to triangle vertices (vert1, vert2, vert3)
Returns
-------
sa: (Neval, (Ntri))
Solid angles of subtened by triangles at evaluation points
"""
# Distances
d = norm(R)
# Scalar triple products
stp = determinant(R)
# Denominator
denom = np.prod(d, axis=-1)
for i in range(3):
j = (i + 1) % 3
k = (i + 2) % 3
# denom += np.sum(R[..., i, :]*R[..., j, :], axis=-1)*d[..., k]
denom += np.einsum("...i,...i,...", R[..., i, :], R[..., j, :], d[..., k])
# Solid angles
sa = -2 * np.arctan2(stp, denom)
return sa
def x_distance(R, tn, ta=None):
"""Signed distances in the triangle planes from the opposite
edge towards the node for all evaluation points in R
The distances are normalized to one at the node if areas are given
The distances are multiplied by the edge lenght if areass are None
Parameters:
R: ndarray (... Ntri, Nverts, xyz)
displacement vectors (coordinates)
tn: ndarray (Ntri, 3)
triangle normals
ta: ndarray (Ntri)
triangle areas
if None, normalizization with double area is not carried out
returns:
ndaarray (..., Ntri, N_triverts (3)), distance in the triangle plane
"""
edges = np.roll(R[0], 2, -2) - np.roll(R[0], 1, -2)
if ta is not None:
edges /= 2 * ta[:, None, None]
edges = -cross(edges, tn[:, None, :])
return np.einsum("...k,...k->...", np.roll(R, 1, -2), edges)
def x_distance2(mesh):
"""Signed distances in the triangle planes from the opposite
edge towards the node for all evalution points in R
"""
# TODO: with gradient, needs mesh info
pass
def d_distance(R, tn):
"""Signed distance from the triangle plane for each triangle
Parameters:
R: ndarray (... Ntri, Nverts, xyz)
displacement vectors (coordinates)
tn: ndarray (Ntri, 3)
triangle normals
Returns:
ndarray (..., Ntri, N_triverts (3)) of signed distances
"""
return np.einsum("...ki,ki->...k", np.take(R, 0, -2), tn)
def c_coeffs(R, ta):
"""Cotan-coeffs
Parameters:
R: ndarray (... Ntri, Nverts, xyz)
displacement vectors (coordinates)
ta: ndarray (Ntri)
triangle areas
Returns:
ndarray (..., Ntri, N_triverts (3))
"""
edges = np.roll(R[0], 2, -2) - np.roll(R[0], 1, -2)
return np.einsum("...ik,...jk->...ij", edges, edges / (2 * ta[:, None, None]))
def triangle_potential_uniform(R, tn, planar=False):
"""1/r potential of a uniform triangle
for original derivation see
A. S. Ferguson, Xu Zhang and G. Stroink,
"A complete linear discretization for calculating the magnetic field
using the boundary element method,"
in IEEE Transactions on Biomedical Engineering,
vol. 41, no. 5, pp. 455-460, May 1994.
doi: 10.1109/10.293220
Parameters
----------
R : (Neval, (Ntri), 3, 3) array
Displacement vectors (Neval, (Ntri), Ntri_verts, xyz)
tn : ((Ntri), 3) array
Triangle normals (Ntri, dir)
planar: boolean
If True, assume all the triangles and the evaluation points
are on the same plane (for speed), leaves out the
omega term
Returns
-------
result: result: ndarray (Neval, (Ntri))
Resultant 1/r potential for each triangle (Ntri)
at the field evaluation points (Neval)
"""
x = x_distance(R, tn, None)
result = np.einsum("...i,...i", gamma0(R), x)
if not planar:
result += d_distance(R, tn) * omega(R)
return result
def triangle_potential_approx(Rcenters, ta, reg=1e-12):
"""1/r potential of a uniform triangle using centroid approximation
Calculates 1/R potentials for triangle centroids
(The singularity at the centroid is handled with the very small
reg value, but anyway the values close to the centroid are inexact)
Parameters
----------
Rcenters : (N, (Ntri), 3) array
Displacement vectors (Neval, Ntri, xyz)
from triangle centers
ta : (Ntri) array
Triangle areas
reg: float
Regularization value used in approximation
Returns
-------
result: result: ndarray (...., Ntri, Ntri_verts)
Resultant 1/r potential for each node (Ntri_verts)
in each triangle (Ntri) in the displacement vectors R
"""
result = ta / (norm(Rcenters) + reg)
return result
def potential_dipoles(R, face_normals, face_areas):
"""Approximate the potential of linearly varying dipole density by
by dipoles at each face
Parameters
R : ndarray (Neval, Ntri, Ntri_verts, N_xyz)
Displacement vectors
face_normals: ndarray (Ntri, 3)
normals for each triangle
face_areas: ndarray (Ntri,)
areas for each triangle
Return
Potential approximation for vertex in each face
pot: (Neval, Ntri, Ntriverts)
"""
nn = face_normals
# Calculate quadrature points corresponding to linear shape functions (Ok?)
weights = np.array([[0.5, 0.25, 0.25], [0.25, 0.5, 0.25], [0.25, 0.25, 0.5]])
# weights = np.eye(3)
# weights = np.ones((3,3))/3
# Combine vertices for quadrature points
Rquad = np.einsum("...ij,ik->...kj", R, weights)
pot = np.einsum("ik, ...ijk->...ij", nn, Rquad) / (norm(Rquad) ** 3)
pot = pot * (face_areas[:, None] / 3)
return pot
def potential_vertex_dipoles(R, vertex_normals, vertex_areas):
"""Approximate the potential of linearly varying dipole density by
by dipoles at each vertex
Parameters
R : ndarray (Neval, Nvertex, N_xyz)
Displacement vectors
vertex_normals: ndarray (Nvertex, 3)
normals for each triangle
vertex_areas: ndarray (Nvertex,)
areas for each triangle
Return
Potential approximation for vertex in each face
pot: (Neval, Ntri, Ntriverts)
"""
nn = vertex_normals
pot = np.einsum("ik, lik->li", nn, R) / (norm(R) ** 3)
pot *= vertex_areas
return pot
def triangle_potential_dipole_linear(R, tn, ta):
"""Potential of dipolar density with magnitude of a
linear shape function on a triangle, "omega_i" in de Munck's paper
for the original derivation, see:
J. C. de Munck, "A linear discretization of the volume mesh_conductor
boundary integral equation using analytically integrated elements
(electrophysiology application),"
in IEEE Transactions on Biomedical Engineering,
vol. 39, no. 9, pp. 986-990, Sept. 1992.
doi: 10.1109/10.256433
Parameters
----------
R : (..., Ntri, 3, 3) array
Displacement vectors (...., Ntri, Ntri_verts, xyz)
tn : ((Ntri), 3) array
Triangle normals (Ntri, dir)
ta : (Ntri), array
Triangle areas (Ntri, dir)
Returns
-------
result: ndarray (...., Ntri, Ntri_verts)
Resultant dipolar potential for each shape functions (Ntri_verts)
in each triangle (Ntri) at the points
corresponding to displacement vectors in R
"""
result = np.einsum(
"...i,...ij,...->...j",
gamma0(R),
c_coeffs(R, ta),
d_distance(R, tn),
optimize=True,
)
x_dists = x_distance(R, tn, ta)
result -= x_dists * omega(R)[..., :, None]
return result
| [
37811,
198,
198,
37702,
13370,
19287,
329,
15879,
1143,
2214,
1220,
2785,
29964,
198,
198,
37811,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
366,
66,
62,
1073,
14822,
82,
1600,
198,
220,
220,
220,
366,
67,
62,
30246,
1600,
198,
220,
220,
220,
366,
28483,
2611,
15,
1600,
198,
220,
220,
220,
366,
462,
4908,
1600,
198,
220,
220,
220,
366,
13059,
1843,
62,
67,
541,
4316,
1600,
198,
220,
220,
220,
366,
13059,
1843,
62,
332,
16886,
62,
67,
541,
4316,
1600,
198,
220,
220,
220,
366,
28461,
9248,
62,
13059,
1843,
62,
1324,
13907,
1600,
198,
220,
220,
220,
366,
28461,
9248,
62,
13059,
1843,
62,
67,
541,
2305,
62,
29127,
1600,
198,
220,
220,
220,
366,
28461,
9248,
62,
13059,
1843,
62,
403,
6933,
1600,
198,
220,
220,
220,
366,
87,
62,
30246,
1600,
198,
220,
220,
220,
366,
87,
62,
30246,
17,
1600,
198,
60,
198,
198,
11748,
299,
32152,
355,
45941,
628,
198,
4299,
3416,
415,
7,
64,
2599,
198,
220,
220,
220,
37227,
37,
1603,
3416,
415,
329,
262,
734,
938,
15225,
286,
705,
64,
6,
37811,
198,
220,
220,
220,
1062,
796,
257,
58,
986,
11,
657,
11,
657,
60,
1635,
357,
64,
58,
986,
11,
352,
11,
352,
60,
1635,
257,
58,
986,
11,
362,
11,
362,
60,
532,
257,
58,
986,
11,
362,
11,
352,
60,
1635,
257,
58,
986,
11,
352,
11,
362,
12962,
198,
220,
220,
220,
1062,
15853,
257,
58,
986,
11,
657,
11,
352,
60,
1635,
357,
64,
58,
986,
11,
352,
11,
362,
60,
1635,
257,
58,
986,
11,
362,
11,
657,
60,
532,
257,
58,
986,
11,
362,
11,
362,
60,
1635,
257,
58,
986,
11,
352,
11,
657,
12962,
198,
220,
220,
220,
1062,
15853,
257,
58,
986,
11,
657,
11,
362,
60,
1635,
357,
64,
58,
986,
11,
352,
11,
657,
60,
1635,
257,
58,
986,
11,
362,
11,
352,
60,
532,
257,
58,
986,
11,
362,
11,
657,
60,
1635,
257,
58,
986,
11,
352,
11,
352,
12962,
198,
220,
220,
220,
1441,
1062,
628,
198,
4299,
2593,
7,
303,
6359,
2599,
198,
220,
220,
220,
37227,
37,
1603,
15879,
2593,
329,
262,
938,
15793,
286,
705,
303,
6359,
6,
37811,
198,
220,
220,
220,
1441,
45941,
13,
31166,
17034,
7,
37659,
13,
68,
1040,
388,
7203,
986,
72,
42303,
72,
1600,
1569,
6359,
11,
1569,
6359,
4008,
628,
198,
4299,
3272,
7,
81,
16,
11,
374,
17,
2599,
198,
220,
220,
220,
37227,
21544,
1720,
1231,
16965,
329,
262,
938,
15225,
286,
705,
81,
16,
6,
290,
705,
81,
17,
6,
37811,
198,
220,
220,
220,
1255,
796,
45941,
13,
9107,
418,
7,
81,
16,
13,
43358,
8,
198,
220,
220,
220,
1255,
58,
986,
11,
657,
60,
796,
374,
16,
58,
986,
11,
352,
60,
1635,
374,
17,
58,
986,
11,
362,
60,
532,
374,
16,
58,
986,
11,
362,
60,
1635,
374,
17,
58,
986,
11,
352,
60,
198,
220,
220,
220,
1255,
58,
986,
11,
352,
60,
796,
374,
16,
58,
986,
11,
362,
60,
1635,
374,
17,
58,
986,
11,
657,
60,
532,
374,
16,
58,
986,
11,
657,
60,
1635,
374,
17,
58,
986,
11,
362,
60,
198,
220,
220,
220,
1255,
58,
986,
11,
362,
60,
796,
374,
16,
58,
986,
11,
657,
60,
1635,
374,
17,
58,
986,
11,
352,
60,
532,
374,
16,
58,
986,
11,
352,
60,
1635,
374,
17,
58,
986,
11,
657,
60,
198,
220,
220,
220,
1441,
1255,
628,
198,
4299,
34236,
15,
7,
49,
11,
842,
28,
16,
68,
12,
1485,
11,
23606,
316,
380,
2736,
28,
17821,
2599,
198,
220,
220,
220,
37227,
16,
14,
81,
4132,
30691,
625,
262,
13015,
286,
257,
22950,
1444,
34236,
62,
15,
198,
220,
220,
220,
357,
1370,
3877,
2785,
82,
737,
628,
220,
220,
220,
12429,
16580,
25,
26720,
5626,
9348,
29550,
22814,
34,
24352,
7473,
19922,
1268,
4694,
42242,
11319,
5161,
37679,
15567,
2538,
198,
220,
220,
220,
8392,
48075,
13,
1174,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
371,
1058,
299,
67,
18747,
357,
986,
11,
399,
62,
28461,
24040,
11,
2124,
45579,
8,
198,
220,
220,
220,
220,
220,
220,
220,
29358,
30104,
357,
81,
12,
81,
11537,
1022,
9873,
282,
12660,
2173,
357,
81,
8,
198,
220,
220,
220,
220,
220,
220,
220,
290,
262,
513,
9421,
1063,
286,
262,
399,
28461,
44360,
14,
28461,
9248,
13,
198,
220,
220,
220,
842,
25,
12178,
11,
257,
1402,
1988,
2087,
284,
262,
7159,
286,
262,
2604,
283,
342,
76,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
3218,
4340,
262,
3815,
845,
1969,
284,
262,
1627,
17894,
198,
220,
220,
220,
23606,
316,
380,
2736,
25,
42653,
3129,
689,
262,
1255,
329,
416,
10162,
278,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
262,
12660,
2173,
351,
2461,
262,
1627,
10618,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3095,
966,
284,
651,
5755,
572,
262,
11234,
37722,
2173,
319,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4633,
7552,
286,
262,
1627,
10618,
628,
198,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
581,
25,
7177,
357,
45,
18206,
11,
399,
24040,
8,
198,
220,
220,
220,
220,
220,
220,
220,
383,
49166,
4132,
30691,
329,
1123,
37423,
14,
14907,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
13015,
796,
45941,
13,
2487,
7,
49,
58,
15,
4357,
362,
11,
532,
17,
8,
532,
45941,
13,
2487,
7,
49,
58,
15,
4357,
352,
11,
532,
17,
8,
198,
220,
220,
220,
16605,
1676,
9310,
16,
796,
45941,
13,
68,
1040,
388,
7203,
986,
72,
42303,
72,
1600,
45941,
13,
2487,
7,
49,
11,
352,
11,
532,
17,
828,
13015,
8,
198,
220,
220,
220,
16605,
1676,
9310,
17,
796,
45941,
13,
68,
1040,
388,
7203,
986,
72,
42303,
72,
1600,
45941,
13,
2487,
7,
49,
11,
362,
11,
532,
17,
828,
13015,
8,
198,
220,
220,
220,
551,
796,
2593,
7,
276,
3212,
8,
198,
220,
220,
220,
1619,
13015,
198,
220,
220,
220,
299,
796,
2593,
7,
49,
8,
198,
220,
220,
220,
1303,
23603,
1096,
264,
13,
83,
13,
6159,
262,
31457,
1352,
393,
262,
5470,
1352,
460,
307,
6632,
198,
220,
220,
220,
1303,
24390,
29052,
2428,
3264,
379,
262,
5743,
198,
220,
220,
220,
299,
77,
16,
796,
45941,
13,
2487,
7,
77,
11,
352,
11,
532,
16,
8,
1635,
551,
198,
220,
220,
220,
299,
77,
17,
796,
45941,
13,
2487,
7,
77,
11,
362,
11,
532,
16,
8,
1635,
551,
198,
220,
220,
220,
581,
796,
45941,
13,
6404,
19510,
20471,
16,
1343,
16605,
1676,
9310,
16,
1343,
842,
8,
1220,
357,
20471,
17,
1343,
16605,
1676,
9310,
17,
1343,
842,
4008,
628,
220,
220,
220,
1303,
1632,
3020,
316,
380,
2736,
262,
1255,
1201,
319,
262,
4633,
7552,
286,
262,
5743,
198,
220,
220,
220,
1303,
612,
338,
7297,
286,
734,
1402,
3815,
7186,
29052,
916,
5738,
198,
220,
220,
220,
1303,
357,
14508,
27294,
351,
4375,
262,
842,
1988,
8,
198,
220,
220,
220,
611,
23606,
316,
380,
2736,
25,
198,
220,
220,
220,
220,
220,
220,
220,
9335,
796,
14808,
37659,
13,
8937,
7,
26518,
1676,
9310,
16,
1343,
299,
77,
16,
4008,
1279,
352,
68,
12,
1065,
8,
1635,
357,
26518,
1676,
9310,
16,
1343,
16605,
1676,
9310,
17,
1279,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
581,
58,
27932,
60,
796,
532,
37659,
13,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
20471,
16,
58,
27932,
60,
532,
16605,
1676,
9310,
16,
58,
27932,
60,
1343,
842,
8,
1220,
357,
20471,
17,
58,
27932,
60,
532,
16605,
1676,
9310,
17,
58,
27932,
60,
1343,
842,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
581,
1220,
28,
551,
198,
220,
220,
220,
1441,
532,
411,
628,
198,
4299,
37615,
7,
49,
2599,
198,
220,
220,
220,
37227,
9771,
3129,
378,
262,
4735,
9848,
286,
257,
44360,
628,
220,
220,
220,
766,
198,
220,
220,
220,
317,
13,
6656,
440,
6197,
296,
290,
449,
13,
4285,
330,
11035,
198,
220,
220,
220,
40552,
44069,
10659,
11053,
6177,
20068,
2662,
1961,
20151,
36924,
8881,
1137,
2751,
11,
198,
220,
220,
220,
38570,
13,
347,
11682,
12,
1270,
11,
8005,
13,
362,
11,
13540,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
371,
1058,
299,
67,
18747,
357,
45,
18206,
11,
357,
45,
28461,
828,
399,
62,
28461,
24040,
11,
2124,
45579,
8,
198,
220,
220,
220,
220,
220,
220,
220,
29358,
30104,
357,
81,
12,
81,
11537,
286,
399,
28461,
44360,
198,
220,
220,
220,
220,
220,
220,
220,
290,
9873,
282,
12660,
2173,
329,
262,
513,
9421,
1063,
198,
220,
220,
220,
220,
220,
220,
220,
286,
262,
44360,
14,
28461,
9248,
13,
628,
220,
220,
220,
220,
220,
220,
220,
383,
5485,
286,
371,
460,
597,
351,
262,
32315,
326,
198,
220,
220,
220,
220,
220,
220,
220,
262,
938,
5391,
268,
295,
1162,
81,
2777,
24764,
284,
22715,
357,
87,
11,
331,
11,
1976,
8,
290,
262,
198,
220,
220,
220,
220,
220,
220,
220,
1218,
938,
15793,
284,
22950,
9421,
1063,
357,
1851,
16,
11,
9421,
17,
11,
9421,
18,
8,
628,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
473,
25,
357,
45,
18206,
11,
357,
45,
28461,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
15831,
18333,
286,
850,
1452,
276,
416,
44360,
379,
12660,
2173,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
4307,
1817,
198,
220,
220,
220,
288,
796,
2593,
7,
49,
8,
198,
220,
220,
220,
1303,
34529,
283,
15055,
3186,
198,
220,
220,
220,
336,
79,
796,
3416,
415,
7,
49,
8,
198,
220,
220,
220,
1303,
5601,
6351,
1352,
198,
220,
220,
220,
2853,
296,
796,
45941,
13,
1676,
67,
7,
67,
11,
16488,
10779,
16,
8,
198,
220,
220,
220,
329,
1312,
287,
2837,
7,
18,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
474,
796,
357,
72,
1343,
352,
8,
4064,
513,
198,
220,
220,
220,
220,
220,
220,
220,
479,
796,
357,
72,
1343,
362,
8,
4064,
513,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
2853,
296,
15853,
45941,
13,
16345,
7,
49,
58,
986,
11,
1312,
11,
1058,
60,
9,
49,
58,
986,
11,
474,
11,
1058,
4357,
16488,
10779,
16,
27493,
67,
58,
986,
11,
479,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2853,
296,
15853,
45941,
13,
68,
1040,
388,
7203,
986,
72,
42303,
72,
11,
9313,
11,
371,
58,
986,
11,
1312,
11,
1058,
4357,
371,
58,
986,
11,
474,
11,
1058,
4357,
288,
58,
986,
11,
479,
12962,
198,
220,
220,
220,
1303,
15831,
18333,
198,
220,
220,
220,
473,
796,
532,
17,
1635,
45941,
13,
283,
310,
272,
17,
7,
301,
79,
11,
2853,
296,
8,
198,
220,
220,
220,
1441,
473,
628,
198,
4299,
2124,
62,
30246,
7,
49,
11,
256,
77,
11,
20486,
28,
14202,
2599,
198,
220,
220,
220,
37227,
50,
3916,
18868,
287,
262,
22950,
13016,
422,
262,
6697,
198,
220,
220,
220,
5743,
3371,
262,
10139,
329,
477,
12660,
2173,
287,
371,
628,
220,
220,
220,
383,
18868,
389,
39279,
284,
530,
379,
262,
10139,
611,
3006,
389,
1813,
198,
220,
220,
220,
383,
18868,
389,
33096,
416,
262,
5743,
18896,
456,
83,
611,
389,
562,
389,
6045,
628,
220,
220,
220,
40117,
25,
628,
220,
220,
220,
220,
220,
220,
220,
371,
25,
299,
67,
18747,
357,
986,
399,
28461,
11,
399,
24040,
11,
2124,
45579,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29358,
30104,
357,
37652,
17540,
8,
198,
220,
220,
220,
220,
220,
220,
220,
256,
77,
25,
299,
67,
18747,
357,
45,
28461,
11,
513,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22950,
2593,
874,
198,
220,
220,
220,
220,
220,
220,
220,
20486,
25,
299,
67,
18747,
357,
45,
28461,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22950,
3006,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6045,
11,
3487,
528,
1634,
351,
4274,
1989,
318,
407,
5281,
503,
628,
220,
220,
220,
5860,
25,
198,
220,
220,
220,
220,
220,
220,
220,
299,
6814,
18747,
357,
986,
11,
399,
28461,
11,
399,
62,
28461,
24040,
357,
18,
36911,
5253,
287,
262,
22950,
6614,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13015,
796,
45941,
13,
2487,
7,
49,
58,
15,
4357,
362,
11,
532,
17,
8,
532,
45941,
13,
2487,
7,
49,
58,
15,
4357,
352,
11,
532,
17,
8,
198,
220,
220,
220,
611,
20486,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
13015,
1220,
28,
362,
1635,
20486,
58,
45299,
6045,
11,
6045,
60,
198,
220,
220,
220,
13015,
796,
532,
19692,
7,
276,
3212,
11,
256,
77,
58,
45299,
6045,
11,
1058,
12962,
198,
220,
220,
220,
1441,
45941,
13,
68,
1040,
388,
7203,
986,
74,
42303,
74,
3784,
9313,
11,
45941,
13,
2487,
7,
49,
11,
352,
11,
532,
17,
828,
13015,
8,
628,
198,
4299,
2124,
62,
30246,
17,
7,
76,
5069,
2599,
198,
220,
220,
220,
37227,
50,
3916,
18868,
287,
262,
22950,
13016,
422,
262,
6697,
198,
220,
220,
220,
5743,
3371,
262,
10139,
329,
477,
5418,
1009,
2173,
287,
371,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
16926,
46,
25,
351,
31312,
11,
2476,
19609,
7508,
198,
220,
220,
220,
1208,
628,
198,
4299,
288,
62,
30246,
7,
49,
11,
256,
77,
2599,
198,
220,
220,
220,
37227,
50,
3916,
5253,
422,
262,
22950,
6614,
329,
1123,
22950,
628,
220,
220,
220,
40117,
25,
628,
220,
220,
220,
220,
220,
220,
220,
371,
25,
299,
67,
18747,
357,
986,
399,
28461,
11,
399,
24040,
11,
2124,
45579,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29358,
30104,
357,
37652,
17540,
8,
198,
220,
220,
220,
220,
220,
220,
220,
256,
77,
25,
299,
67,
18747,
357,
45,
28461,
11,
513,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22950,
2593,
874,
628,
220,
220,
220,
16409,
25,
628,
220,
220,
220,
220,
220,
220,
220,
299,
67,
18747,
357,
986,
11,
399,
28461,
11,
399,
62,
28461,
24040,
357,
18,
4008,
286,
4488,
18868,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
45941,
13,
68,
1040,
388,
7203,
986,
4106,
11,
4106,
3784,
986,
74,
1600,
45941,
13,
20657,
7,
49,
11,
657,
11,
532,
17,
828,
256,
77,
8,
628,
198,
4299,
269,
62,
1073,
14822,
82,
7,
49,
11,
20486,
2599,
198,
220,
220,
220,
37227,
34,
313,
272,
12,
1073,
14822,
82,
628,
220,
220,
220,
40117,
25,
628,
220,
220,
220,
220,
220,
220,
220,
371,
25,
299,
67,
18747,
357,
986,
399,
28461,
11,
399,
24040,
11,
2124,
45579,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29358,
30104,
357,
37652,
17540,
8,
198,
220,
220,
220,
220,
220,
220,
220,
20486,
25,
299,
67,
18747,
357,
45,
28461,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22950,
3006,
628,
198,
220,
220,
220,
16409,
25,
628,
220,
220,
220,
220,
220,
220,
220,
299,
67,
18747,
357,
986,
11,
399,
28461,
11,
399,
62,
28461,
24040,
357,
18,
4008,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
13015,
796,
45941,
13,
2487,
7,
49,
58,
15,
4357,
362,
11,
532,
17,
8,
532,
45941,
13,
2487,
7,
49,
58,
15,
4357,
352,
11,
532,
17,
8,
198,
220,
220,
220,
1441,
45941,
13,
68,
1040,
388,
7203,
986,
1134,
42303,
73,
74,
3784,
986,
2926,
1600,
13015,
11,
13015,
1220,
357,
17,
1635,
20486,
58,
45299,
6045,
11,
6045,
60,
4008,
628,
198,
4299,
22950,
62,
13059,
1843,
62,
403,
6933,
7,
49,
11,
256,
77,
11,
1410,
283,
28,
25101,
2599,
198,
220,
220,
220,
37227,
16,
14,
81,
2785,
286,
257,
8187,
22950,
628,
220,
220,
220,
329,
2656,
16124,
341,
766,
198,
220,
220,
220,
317,
13,
311,
13,
15031,
11,
33591,
19439,
290,
402,
13,
30183,
676,
11,
198,
220,
220,
220,
366,
32,
1844,
14174,
1221,
1186,
1634,
329,
26019,
262,
14091,
2214,
198,
220,
220,
220,
1262,
262,
18645,
5002,
2446,
553,
198,
220,
220,
220,
287,
40552,
46192,
319,
8436,
35914,
14044,
11,
198,
220,
220,
220,
2322,
13,
6073,
11,
645,
13,
642,
11,
9788,
13,
46839,
12,
34716,
11,
1737,
9162,
13,
198,
220,
220,
220,
23899,
25,
838,
13,
11442,
24,
14,
940,
13,
1959,
2624,
1238,
628,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
628,
220,
220,
220,
371,
1058,
357,
45,
18206,
11,
357,
45,
28461,
828,
513,
11,
513,
8,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
3167,
489,
5592,
30104,
357,
45,
18206,
11,
357,
45,
28461,
828,
399,
28461,
62,
24040,
11,
2124,
45579,
8,
198,
220,
220,
220,
256,
77,
1058,
14808,
45,
28461,
828,
513,
8,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
33233,
2593,
874,
357,
45,
28461,
11,
26672,
8,
198,
220,
220,
220,
1410,
283,
25,
25131,
198,
220,
220,
220,
220,
220,
220,
220,
1002,
6407,
11,
7048,
477,
262,
44360,
290,
262,
12660,
2173,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
389,
319,
262,
976,
6614,
357,
1640,
2866,
828,
5667,
503,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37615,
3381,
628,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
1255,
25,
1255,
25,
220,
299,
67,
18747,
357,
45,
18206,
11,
357,
45,
28461,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
25414,
415,
352,
14,
81,
2785,
329,
1123,
22950,
357,
45,
28461,
8,
198,
220,
220,
220,
220,
220,
220,
220,
379,
262,
2214,
12660,
2173,
357,
45,
18206,
8,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
2124,
796,
2124,
62,
30246,
7,
49,
11,
256,
77,
11,
6045,
8,
198,
220,
220,
220,
1255,
796,
45941,
13,
68,
1040,
388,
7203,
986,
72,
42303,
72,
1600,
34236,
15,
7,
49,
828,
2124,
8,
198,
220,
220,
220,
611,
407,
1410,
283,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
15853,
288,
62,
30246,
7,
49,
11,
256,
77,
8,
1635,
37615,
7,
49,
8,
198,
220,
220,
220,
1441,
1255,
628,
198,
4299,
22950,
62,
13059,
1843,
62,
1324,
13907,
7,
49,
1087,
364,
11,
20486,
11,
842,
28,
16,
68,
12,
1065,
2599,
198,
220,
220,
220,
37227,
16,
14,
81,
2785,
286,
257,
8187,
22950,
1262,
1247,
3882,
40874,
628,
220,
220,
220,
27131,
689,
352,
14,
49,
2785,
82,
329,
22950,
1247,
305,
2340,
198,
220,
220,
220,
357,
464,
18032,
414,
379,
262,
1247,
3882,
318,
12118,
351,
262,
845,
1402,
198,
220,
220,
220,
842,
1988,
11,
475,
6949,
262,
3815,
1969,
284,
262,
1247,
3882,
389,
16087,
529,
8,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
371,
1087,
364,
1058,
357,
45,
11,
357,
45,
28461,
828,
513,
8,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
3167,
489,
5592,
30104,
357,
45,
18206,
11,
399,
28461,
11,
2124,
45579,
8,
198,
220,
220,
220,
220,
220,
220,
220,
422,
22950,
10399,
198,
220,
220,
220,
20486,
1058,
357,
45,
28461,
8,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
33233,
3006,
628,
220,
220,
220,
842,
25,
12178,
198,
220,
220,
220,
220,
220,
220,
220,
23603,
1634,
1988,
973,
287,
40874,
628,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
1255,
25,
1255,
25,
220,
299,
67,
18747,
357,
1106,
11,
399,
28461,
11,
399,
28461,
62,
24040,
8,
198,
220,
220,
220,
220,
220,
220,
220,
25414,
415,
352,
14,
81,
2785,
329,
1123,
10139,
357,
45,
28461,
62,
24040,
8,
198,
220,
220,
220,
220,
220,
220,
220,
287,
1123,
22950,
357,
45,
28461,
8,
287,
262,
29358,
30104,
371,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
1255,
796,
20486,
1220,
357,
27237,
7,
49,
1087,
364,
8,
1343,
842,
8,
198,
220,
220,
220,
1441,
1255,
628,
198,
4299,
2785,
62,
67,
541,
4316,
7,
49,
11,
1986,
62,
27237,
874,
11,
1986,
62,
533,
292,
2599,
198,
220,
220,
220,
37227,
4677,
13907,
1920,
262,
2785,
286,
9493,
11458,
15874,
19550,
2305,
12109,
416,
198,
220,
220,
220,
220,
220,
220,
220,
416,
19550,
4316,
379,
1123,
1986,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
371,
1058,
299,
67,
18747,
357,
45,
18206,
11,
399,
28461,
11,
399,
28461,
62,
24040,
11,
399,
62,
5431,
89,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3167,
489,
5592,
30104,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1986,
62,
27237,
874,
25,
299,
67,
18747,
357,
45,
28461,
11,
513,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
874,
329,
1123,
22950,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1986,
62,
533,
292,
25,
299,
67,
18747,
357,
45,
28461,
35751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3006,
329,
1123,
22950,
628,
220,
220,
220,
8229,
198,
220,
220,
220,
220,
220,
220,
220,
32480,
40874,
329,
37423,
287,
1123,
1986,
198,
220,
220,
220,
220,
220,
220,
220,
1787,
25,
357,
45,
18206,
11,
399,
28461,
11,
399,
28461,
24040,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
299,
77,
796,
1986,
62,
27237,
874,
198,
220,
220,
220,
1303,
27131,
378,
15094,
81,
1300,
2173,
11188,
284,
14174,
5485,
5499,
357,
18690,
10091,
198,
220,
220,
220,
19590,
796,
45941,
13,
18747,
26933,
58,
15,
13,
20,
11,
657,
13,
1495,
11,
657,
13,
1495,
4357,
685,
15,
13,
1495,
11,
657,
13,
20,
11,
657,
13,
1495,
4357,
685,
15,
13,
1495,
11,
657,
13,
1495,
11,
657,
13,
20,
11907,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
19590,
796,
45941,
13,
25379,
7,
18,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
19590,
796,
45941,
13,
1952,
19510,
18,
11,
18,
4008,
14,
18,
198,
220,
220,
220,
1303,
29176,
9421,
1063,
329,
15094,
81,
1300,
2173,
198,
220,
220,
220,
371,
47003,
796,
45941,
13,
68,
1040,
388,
7203,
986,
2926,
11,
1134,
3784,
986,
42421,
1600,
371,
11,
19590,
8,
198,
220,
220,
220,
1787,
796,
45941,
13,
68,
1040,
388,
7203,
1134,
11,
2644,
45961,
3784,
986,
2926,
1600,
299,
77,
11,
371,
47003,
8,
1220,
357,
27237,
7,
49,
47003,
8,
12429,
513,
8,
198,
220,
220,
220,
1787,
796,
1787,
1635,
357,
2550,
62,
533,
292,
58,
45299,
6045,
60,
1220,
513,
8,
628,
220,
220,
220,
1441,
1787,
628,
198,
4299,
2785,
62,
332,
16886,
62,
67,
541,
4316,
7,
49,
11,
37423,
62,
27237,
874,
11,
37423,
62,
533,
292,
2599,
198,
220,
220,
220,
37227,
4677,
13907,
1920,
262,
2785,
286,
9493,
11458,
15874,
19550,
2305,
12109,
416,
198,
220,
220,
220,
220,
220,
220,
220,
416,
19550,
4316,
379,
1123,
37423,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
371,
1058,
299,
67,
18747,
357,
45,
18206,
11,
399,
332,
16886,
11,
399,
62,
5431,
89,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3167,
489,
5592,
30104,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37423,
62,
27237,
874,
25,
299,
67,
18747,
357,
45,
332,
16886,
11,
513,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
874,
329,
1123,
22950,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37423,
62,
533,
292,
25,
299,
67,
18747,
357,
45,
332,
16886,
35751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3006,
329,
1123,
22950,
628,
220,
220,
220,
8229,
198,
220,
220,
220,
220,
220,
220,
220,
32480,
40874,
329,
37423,
287,
1123,
1986,
198,
220,
220,
220,
220,
220,
220,
220,
1787,
25,
357,
45,
18206,
11,
399,
28461,
11,
399,
28461,
24040,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
299,
77,
796,
37423,
62,
27237,
874,
198,
220,
220,
220,
1787,
796,
45941,
13,
68,
1040,
388,
7203,
1134,
11,
4300,
3784,
4528,
1600,
299,
77,
11,
371,
8,
1220,
357,
27237,
7,
49,
8,
12429,
513,
8,
198,
220,
220,
220,
1787,
1635,
28,
37423,
62,
533,
292,
628,
220,
220,
220,
1441,
1787,
628,
198,
4299,
22950,
62,
13059,
1843,
62,
67,
541,
2305,
62,
29127,
7,
49,
11,
256,
77,
11,
20486,
2599,
198,
220,
220,
220,
37227,
25396,
1843,
286,
19550,
6192,
12109,
351,
14735,
286,
257,
198,
220,
220,
220,
14174,
5485,
2163,
319,
257,
22950,
11,
366,
462,
4908,
62,
72,
1,
287,
390,
12107,
694,
338,
3348,
628,
220,
220,
220,
329,
262,
2656,
16124,
341,
11,
766,
25,
198,
220,
220,
220,
449,
13,
327,
13,
390,
12107,
694,
11,
366,
32,
14174,
1221,
1186,
1634,
286,
262,
6115,
19609,
62,
17561,
33029,
198,
220,
220,
220,
18645,
19287,
16022,
1262,
4284,
83,
1146,
11521,
4847,
198,
220,
220,
220,
357,
9509,
10051,
893,
12371,
3586,
27267,
198,
220,
220,
220,
287,
40552,
46192,
319,
8436,
35914,
14044,
11,
198,
220,
220,
220,
2322,
13,
5014,
11,
645,
13,
860,
11,
9788,
13,
860,
4521,
12,
34155,
11,
2362,
13,
9768,
13,
198,
220,
220,
220,
23899,
25,
838,
13,
11442,
24,
14,
940,
13,
1495,
2414,
2091,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
628,
220,
220,
220,
371,
1058,
357,
986,
11,
399,
28461,
11,
513,
11,
513,
8,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
3167,
489,
5592,
30104,
357,
1106,
11,
399,
28461,
11,
399,
28461,
62,
24040,
11,
2124,
45579,
8,
198,
220,
220,
220,
256,
77,
1058,
14808,
45,
28461,
828,
513,
8,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
33233,
2593,
874,
357,
45,
28461,
11,
26672,
8,
198,
220,
220,
220,
20486,
1058,
357,
45,
28461,
828,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
33233,
3006,
357,
45,
28461,
11,
26672,
8,
628,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
1255,
25,
220,
299,
67,
18747,
357,
1106,
11,
399,
28461,
11,
399,
28461,
62,
24040,
8,
198,
220,
220,
220,
220,
220,
220,
220,
25414,
415,
19550,
6192,
2785,
329,
1123,
5485,
5499,
357,
45,
28461,
62,
24040,
8,
198,
220,
220,
220,
220,
220,
220,
220,
287,
1123,
22950,
357,
45,
28461,
8,
379,
262,
2173,
198,
220,
220,
220,
220,
220,
220,
220,
11188,
284,
29358,
30104,
287,
371,
628,
220,
220,
220,
37227,
628,
220,
220,
220,
1255,
796,
45941,
13,
68,
1040,
388,
7,
198,
220,
220,
220,
220,
220,
220,
220,
27896,
72,
42303,
2926,
42303,
3784,
986,
73,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
34236,
15,
7,
49,
828,
198,
220,
220,
220,
220,
220,
220,
220,
269,
62,
1073,
14822,
82,
7,
49,
11,
20486,
828,
198,
220,
220,
220,
220,
220,
220,
220,
288,
62,
30246,
7,
49,
11,
256,
77,
828,
198,
220,
220,
220,
220,
220,
220,
220,
27183,
28,
17821,
11,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
2124,
62,
67,
1023,
796,
2124,
62,
30246,
7,
49,
11,
256,
77,
11,
20486,
8,
198,
220,
220,
220,
1255,
48185,
2124,
62,
67,
1023,
1635,
37615,
7,
49,
38381,
986,
11,
1058,
11,
6045,
60,
628,
220,
220,
220,
1441,
1255,
198
] | 2.358888 | 4,748 |
"""
_GetNotClosedOutWorkflows_
Oracle implementation of GetNotClosedOutWorkflows
Lists top level filesets not injected to monitoring
"""
from WMCore.Database.DBFormatter import DBFormatter
| [
37811,
198,
62,
3855,
3673,
2601,
1335,
7975,
12468,
44041,
62,
198,
198,
48625,
7822,
286,
3497,
3673,
2601,
1335,
7975,
12468,
44041,
198,
43,
1023,
1353,
1241,
3696,
1039,
407,
25077,
284,
9904,
198,
37811,
198,
6738,
370,
9655,
382,
13,
38105,
13,
11012,
8479,
1436,
1330,
20137,
8479,
1436,
628
] | 3.673077 | 52 |
from setuptools import setup, find_packages
__version__ = '0.1.0'
setup(
name='cst-micro-chassis',
version=__version__,
author='CyberSolutionsTech',
license='MIT',
author_email='[email protected]',
description='Microservices chassis pattern library',
long_description=read('README.md'),
long_description_content_type='text/markdown',
packages=find_packages(where='src'),
package_dir={'': 'src'},
url='https://pypi.org/project/cst-micro-chassis/',
project_urls={
'Source': 'https://github.com/CyberSolutionsTech/cst-micro-chassis'
},
install_requires=[
'flask==1.1.*',
'flask-restful==0.3.*',
],
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'License :: OSI Approved :: MIT License',
],
python_requires='>=3.7',
)
| [
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
43789,
198,
198,
834,
9641,
834,
796,
705,
15,
13,
16,
13,
15,
6,
628,
198,
198,
40406,
7,
198,
220,
220,
220,
1438,
11639,
66,
301,
12,
24055,
12,
354,
20297,
3256,
198,
220,
220,
220,
2196,
28,
834,
9641,
834,
11,
198,
220,
220,
220,
1772,
11639,
20418,
527,
50,
14191,
17760,
3256,
198,
220,
220,
220,
5964,
11639,
36393,
3256,
198,
220,
220,
220,
1772,
62,
12888,
11639,
6988,
349,
3609,
13,
32353,
13484,
16115,
31,
948,
527,
12,
82,
14191,
13,
785,
3256,
198,
220,
220,
220,
6764,
11639,
13031,
30416,
24587,
3912,
5888,
3256,
198,
220,
220,
220,
890,
62,
11213,
28,
961,
10786,
15675,
11682,
13,
9132,
33809,
198,
220,
220,
220,
890,
62,
11213,
62,
11299,
62,
4906,
11639,
5239,
14,
4102,
2902,
3256,
198,
220,
220,
220,
10392,
28,
19796,
62,
43789,
7,
3003,
11639,
10677,
33809,
198,
220,
220,
220,
5301,
62,
15908,
34758,
7061,
25,
705,
10677,
6,
5512,
198,
220,
220,
220,
19016,
11639,
5450,
1378,
79,
4464,
72,
13,
2398,
14,
16302,
14,
66,
301,
12,
24055,
12,
354,
20297,
14,
3256,
198,
220,
220,
220,
1628,
62,
6371,
82,
34758,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7416,
10354,
705,
5450,
1378,
12567,
13,
785,
14,
20418,
527,
50,
14191,
17760,
14,
66,
301,
12,
24055,
12,
354,
20297,
6,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
2721,
62,
47911,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
705,
2704,
2093,
855,
16,
13,
16,
15885,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
2704,
2093,
12,
2118,
913,
855,
15,
13,
18,
15885,
3256,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
1398,
13350,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
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,
46333,
7904,
16932,
7535,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
34156,
7904,
7294,
40,
20010,
1079,
7904,
17168,
13789,
3256,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
21015,
62,
47911,
11639,
29,
28,
18,
13,
22,
3256,
198,
8,
198
] | 2.483376 | 391 |
#
# Copyright (c) 2010 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from cli.command.command import Command
| [
2,
198,
2,
15069,
357,
66,
8,
3050,
2297,
10983,
11,
3457,
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,
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,
628,
198,
6738,
537,
72,
13,
21812,
13,
21812,
1330,
9455,
628
] | 3.622857 | 175 |
import collections
import os,sys
Coord = collections.namedtuple("Coord", ["x", "y"]) | [
11748,
17268,
198,
11748,
28686,
11,
17597,
628,
198,
7222,
585,
796,
17268,
13,
13190,
83,
29291,
7203,
7222,
585,
1600,
14631,
87,
1600,
366,
88,
8973,
8
] | 3.071429 | 28 |
import os
import time
import fero
from fero import FeroError
from typing import Optional, Union
from marshmallow import (
Schema,
fields,
validate,
EXCLUDE,
)
from .common import FeroObject
| [
11748,
28686,
198,
11748,
640,
198,
11748,
277,
3529,
198,
6738,
277,
3529,
1330,
376,
3529,
12331,
198,
6738,
19720,
1330,
32233,
11,
4479,
198,
6738,
22397,
42725,
1330,
357,
198,
220,
220,
220,
10011,
2611,
11,
198,
220,
220,
220,
7032,
11,
198,
220,
220,
220,
26571,
11,
198,
220,
220,
220,
7788,
5097,
52,
7206,
11,
198,
8,
198,
198,
6738,
764,
11321,
1330,
376,
3529,
10267,
628,
628,
198
] | 2.930556 | 72 |
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium import webdriver
from decouple import config
import time
import re
import os
url = "https://busyliving.co.uk/"
username = config("login_username")
password = config("password")
# Log in to the site and get the source code
# Define a class to store the results needed
# Finds the elements needed and put them in an array
# Define the path to the files
directory = "s3://busyliving"
local = "C:\\Users\\emilf\\Downloads\\Ringley\\Images\\"
files_names = os.listdir("C:\\Users\\emilf\\Downloads\\Ringley\\Images\\")
grant = " --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers"
# Change the file
# Function that does it all
# Runs the program
replace(finder(site_login(url))) | [
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
1330,
2938,
62,
17561,
1756,
355,
13182,
201,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
13,
9019,
1330,
5313,
32103,
21321,
220,
201,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
1525,
1330,
2750,
201,
198,
6738,
384,
11925,
1505,
1330,
3992,
26230,
201,
198,
6738,
875,
43846,
1330,
4566,
201,
198,
11748,
640,
201,
198,
11748,
302,
201,
198,
11748,
28686,
201,
198,
201,
198,
6371,
796,
366,
5450,
1378,
10885,
2645,
1412,
13,
1073,
13,
2724,
30487,
201,
198,
29460,
796,
4566,
7203,
38235,
62,
29460,
4943,
201,
198,
28712,
796,
4566,
7203,
28712,
4943,
201,
198,
201,
198,
2,
5972,
287,
284,
262,
2524,
290,
651,
262,
2723,
2438,
201,
198,
201,
198,
2,
2896,
500,
257,
1398,
284,
3650,
262,
2482,
2622,
201,
198,
201,
198,
2,
9938,
82,
262,
4847,
2622,
290,
1234,
606,
287,
281,
7177,
201,
198,
201,
198,
2,
2896,
500,
262,
3108,
284,
262,
3696,
201,
198,
34945,
796,
366,
82,
18,
1378,
10885,
2645,
1412,
1,
201,
198,
12001,
796,
366,
34,
25,
6852,
14490,
6852,
368,
346,
69,
6852,
10002,
82,
6852,
39687,
1636,
6852,
29398,
6852,
1,
201,
198,
16624,
62,
14933,
796,
28686,
13,
4868,
15908,
7203,
34,
25,
6852,
14490,
6852,
368,
346,
69,
6852,
10002,
82,
6852,
39687,
1636,
6852,
29398,
6852,
4943,
201,
198,
2164,
415,
796,
366,
1377,
2164,
1187,
1100,
28,
9900,
28,
4023,
1378,
16436,
13,
33103,
8356,
13,
785,
14,
24432,
14,
20541,
14,
3237,
14490,
1,
201,
198,
201,
198,
2,
9794,
262,
2393,
201,
198,
201,
198,
2,
15553,
326,
857,
340,
477,
201,
198,
201,
198,
2,
44743,
262,
1430,
201,
198,
33491,
7,
22805,
7,
15654,
62,
38235,
7,
6371,
22305
] | 3.016667 | 300 |
import csv
from datetime import datetime
from typing import Dict, Optional, Union
def attendee_report(csv_path: str) -> Dict:
"""Given a standard Zoom CSV attendee report, returns massaged information."""
report = []
field_map = {
"email": ["Email", str],
"first_name": ["First Name", str],
"last_name": ["Last Name", str],
"attended": ["Attended", to_bool],
"join_time": ["Join Time", to_datetime],
"leave_time": ["Leave Time", to_datetime],
"minutes": ["Time in Session (minutes)", to_minutes],
}
with open(csv_path) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=",")
section = None
tmp = None
for row in csv_reader:
if len(row) == 2 and row[0] == "Attendee Details":
section = "attendees"
continue
if not section:
continue
if not len(report) and row[0] == "Attended":
fields = row
continue
tmp = dict(zip(fields, row))
report.append({k: v[1](tmp[v[0]]) for k, v in field_map.items()})
return report
| [
11748,
269,
21370,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
19720,
1330,
360,
713,
11,
32233,
11,
4479,
628,
628,
198,
198,
4299,
5262,
1453,
62,
13116,
7,
40664,
62,
6978,
25,
965,
8,
4613,
360,
713,
25,
198,
220,
220,
220,
37227,
15056,
257,
3210,
40305,
44189,
5262,
1453,
989,
11,
5860,
2347,
1886,
1321,
526,
15931,
198,
220,
220,
220,
989,
796,
17635,
198,
220,
220,
220,
2214,
62,
8899,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12888,
1298,
14631,
15333,
1600,
965,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
11085,
62,
3672,
1298,
14631,
5962,
6530,
1600,
965,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12957,
62,
3672,
1298,
14631,
5956,
6530,
1600,
965,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1078,
1631,
1298,
14631,
8086,
1631,
1600,
284,
62,
30388,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
22179,
62,
2435,
1298,
14631,
18234,
3862,
1600,
284,
62,
19608,
8079,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
47408,
62,
2435,
1298,
14631,
35087,
3862,
1600,
284,
62,
19608,
8079,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1084,
1769,
1298,
14631,
7575,
287,
23575,
357,
1084,
1769,
42501,
284,
62,
1084,
1769,
4357,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
351,
1280,
7,
40664,
62,
6978,
8,
355,
269,
21370,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
269,
21370,
62,
46862,
796,
269,
21370,
13,
46862,
7,
40664,
62,
7753,
11,
46728,
2676,
28,
2430,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2665,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
45218,
796,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
329,
5752,
287,
269,
21370,
62,
46862,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
808,
8,
6624,
362,
290,
5752,
58,
15,
60,
6624,
366,
8086,
437,
1453,
14890,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2665,
796,
366,
1078,
437,
2841,
1,
198,
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,
611,
407,
2665,
25,
198,
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,
611,
407,
18896,
7,
13116,
8,
290,
5752,
58,
15,
60,
6624,
366,
8086,
1631,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7032,
796,
5752,
198,
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,
45218,
796,
8633,
7,
13344,
7,
25747,
11,
5752,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
989,
13,
33295,
15090,
74,
25,
410,
58,
16,
16151,
22065,
58,
85,
58,
15,
11907,
8,
329,
479,
11,
410,
287,
2214,
62,
8899,
13,
23814,
3419,
30072,
628,
220,
220,
220,
1441,
989,
198
] | 2.159633 | 545 |
# *****************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the NVIDIA CORPORATION nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# *****************************************************************************
import sys
import copy
import torch
if __name__ == '__main__':
old_model_path = sys.argv[1]
new_model_path = sys.argv[2]
model = torch.load(old_model_path, map_location='cpu')
model['model'] = update_model(model['model'])
torch.save(model, new_model_path)
| [
2,
41906,
17174,
4557,
35625,
198,
2,
220,
15069,
357,
66,
8,
2864,
11,
15127,
23929,
44680,
6234,
13,
220,
1439,
2489,
10395,
13,
198,
2,
198,
2,
220,
2297,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
198,
2,
220,
17613,
11,
389,
10431,
2810,
326,
262,
1708,
3403,
389,
1138,
25,
198,
2,
220,
220,
220,
220,
220,
1635,
2297,
396,
2455,
507,
286,
2723,
2438,
1276,
12377,
262,
2029,
6634,
198,
2,
220,
220,
220,
220,
220,
220,
220,
4003,
11,
428,
1351,
286,
3403,
290,
262,
1708,
37592,
13,
198,
2,
220,
220,
220,
220,
220,
1635,
2297,
396,
2455,
507,
287,
13934,
1296,
1276,
22919,
262,
2029,
6634,
198,
2,
220,
220,
220,
220,
220,
220,
220,
4003,
11,
428,
1351,
286,
3403,
290,
262,
1708,
37592,
287,
262,
198,
2,
220,
220,
220,
220,
220,
220,
220,
10314,
290,
14,
273,
584,
5696,
2810,
351,
262,
6082,
13,
198,
2,
220,
220,
220,
220,
220,
1635,
16126,
262,
1438,
286,
262,
15127,
23929,
44680,
6234,
4249,
262,
198,
2,
220,
220,
220,
220,
220,
220,
220,
3891,
286,
663,
20420,
743,
307,
973,
284,
11438,
393,
7719,
3186,
198,
2,
220,
220,
220,
220,
220,
220,
220,
10944,
422,
428,
3788,
1231,
2176,
3161,
3194,
7170,
13,
198,
2,
198,
2,
220,
12680,
47466,
3180,
36592,
2389,
1961,
11050,
3336,
27975,
38162,
9947,
367,
15173,
4877,
5357,
27342,
9865,
3843,
20673,
366,
1921,
3180,
1,
5357,
198,
2,
220,
15529,
7788,
32761,
6375,
8959,
49094,
34764,
11015,
11,
47783,
2751,
11,
21728,
5626,
40880,
5390,
11,
3336,
8959,
49094,
198,
2,
220,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
5357,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
15986,
198,
2,
220,
13954,
48778,
1961,
13,
3268,
8005,
49261,
50163,
15127,
23929,
44680,
6234,
9348,
43031,
19146,
7473,
15529,
198,
2,
220,
42242,
11,
3268,
17931,
23988,
11,
19387,
25256,
1847,
11,
38846,
11,
7788,
3620,
6489,
13153,
11,
6375,
7102,
5188,
10917,
3525,
12576,
29506,
25552,
198,
2,
220,
357,
1268,
39149,
2751,
11,
21728,
5626,
40880,
5390,
11,
41755,
11335,
10979,
3963,
28932,
2257,
2043,
37780,
21090,
50,
6375,
49254,
26,
198,
2,
220,
406,
18420,
3963,
23210,
11,
42865,
11,
6375,
4810,
19238,
29722,
26,
6375,
43949,
44180,
23255,
49,
8577,
24131,
8,
29630,
36,
5959,
7257,
2937,
1961,
5357,
198,
2,
220,
6177,
15529,
3336,
15513,
3963,
43031,
25382,
11,
7655,
2767,
16879,
3268,
27342,
10659,
11,
19269,
18379,
43031,
25382,
11,
6375,
309,
9863,
198,
2,
220,
357,
1268,
39149,
2751,
399,
7156,
43,
3528,
18310,
6375,
25401,
54,
24352,
8,
5923,
1797,
2751,
3268,
15529,
34882,
16289,
3963,
3336,
23210,
3963,
12680,
198,
2,
220,
47466,
11,
45886,
16876,
5984,
29817,
1961,
3963,
3336,
28069,
11584,
25382,
3963,
13558,
3398,
29506,
11879,
13,
198,
2,
198,
2,
41906,
17174,
4557,
35625,
198,
11748,
25064,
198,
11748,
4866,
198,
11748,
28034,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1468,
62,
19849,
62,
6978,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
220,
220,
220,
649,
62,
19849,
62,
6978,
796,
25064,
13,
853,
85,
58,
17,
60,
198,
220,
220,
220,
2746,
796,
28034,
13,
2220,
7,
727,
62,
19849,
62,
6978,
11,
3975,
62,
24886,
11639,
36166,
11537,
198,
220,
220,
220,
2746,
17816,
19849,
20520,
796,
4296,
62,
19849,
7,
19849,
17816,
19849,
6,
12962,
198,
220,
220,
220,
28034,
13,
21928,
7,
19849,
11,
649,
62,
19849,
62,
6978,
8,
198
] | 3.400673 | 594 |
#
# Copyright IBM Corp. 2014
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from paver.easy import *
from shutil import rmtree, copytree, copyfile
from subprocess import call
import os
import getpass
@task
@task
@task
@task
@task
@task
@task
@task
@task
@needs('clean', 'copy_client_code', 'copy_mongo_manifest', 'create_mongo_service', 'deploy_to_bluemix')
@task
@needs('clean', 'copy_client_code', 'copy_cloudant_manifest', 'create_cloudant_service', 'deploy_to_bluemix') | [
2,
198,
2,
15069,
19764,
11421,
13,
1946,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
2,
198,
198,
6738,
279,
8770,
13,
38171,
1330,
1635,
198,
6738,
4423,
346,
1330,
374,
16762,
631,
11,
4866,
21048,
11,
4866,
7753,
198,
6738,
850,
14681,
1330,
869,
198,
11748,
28686,
198,
11748,
651,
6603,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
198,
31,
35943,
198,
31,
50032,
10786,
27773,
3256,
705,
30073,
62,
16366,
62,
8189,
3256,
705,
30073,
62,
76,
25162,
62,
805,
8409,
3256,
705,
17953,
62,
76,
25162,
62,
15271,
3256,
705,
2934,
1420,
62,
1462,
62,
65,
2290,
368,
844,
11537,
198,
198,
31,
35943,
198,
31,
50032,
10786,
27773,
3256,
705,
30073,
62,
16366,
62,
8189,
3256,
705,
30073,
62,
17721,
415,
62,
805,
8409,
3256,
705,
17953,
62,
17721,
415,
62,
15271,
3256,
705,
2934,
1420,
62,
1462,
62,
65,
2290,
368,
844,
11537
] | 3.184466 | 309 |
from asciimatics.effects import Effect
from asciimatics.screen import Screen
from pyfiglet import Figlet
import re
import ftfy
import unicodedata
# XXX: Should this be a Renderer?
| [
6738,
355,
979,
320,
23372,
13,
34435,
1330,
7896,
198,
6738,
355,
979,
320,
23372,
13,
9612,
1330,
15216,
198,
198,
6738,
12972,
5647,
1616,
1330,
12138,
1616,
198,
198,
11748,
302,
198,
11748,
10117,
24928,
198,
11748,
28000,
9043,
1045,
628,
198,
198,
2,
27713,
25,
10358,
428,
307,
257,
28703,
11882,
30,
628
] | 3.381818 | 55 |
import pymongo
import shutil
import os
import argparse
import re
import urllib2
import subprocess
import time
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import kmeanstree
from sys import exit
# instanciate and configure an argument parser
PARSER = argparse.ArgumentParser(description='')
PARSER.add_argument('serverfile', metavar='SERVERFILE',
help='The full path to the cherrypy python file, which will be used for the benchmark (absolute!!!)')
PARSER.add_argument('port', metavar='PORT',
help='The port on which the webserver will run')
PARSER.add_argument('database', metavar='DB',
help='The name of the MongoDB Database on localhost')
PARSER.add_argument('collection', metavar='COLLECTION',
help='The name of the Collection in the Database')
PARSER.add_argument('origpath', metavar='ORIGINALPATH',
help='The original path, where the queries and targets are (absolute!!!). This is used for the informations in the output files and reading the groundtruth file.')
PARSER.add_argument('tolerance', metavar='TOLERANCE',
help='The tolerance (in frames) how many frames the found target can be away from ground truth')
# parse input arguments
ARGS = PARSER.parse_args()
SERVERFILE = ARGS.serverfile
PORT = ARGS.port
DBNAME = ARGS.database
COLNAME = ARGS.collection
ORIGPATH = ARGS.origpath
TOLERANCE = int(ARGS.tolerance)
# Directory of this file
ROOTDIR = os.path.abspath('.')
if (not os.path.exists(SERVERFILE)) or (not os.path.isfile(SERVERFILE)):
print "The webserver file: '" + SERVERFILE + "', doesn't exist or is not a file!"
sys.exit(1)
if (not os.path.exists(ORIGPATH)) or (not os.path.isdir(ORIGPATH)):
print "The given path: '" + ORIGPATH + "', doesn't exist or is not a directory!"
sys.exit(1)
GTFILE = os.path.join(ORIGPATH, 'BENCHMARK_FULL.TXT')
if (not os.path.exists(GTFILE)) or (not os.path.isfile(GTFILE)):
print "The groundtruth file: '" + GTFILE + "', doesn't exist or is not a file!"
sys.exit(1)
# Read Ground Truth file and split on lines and on spaces for each line
# Ground Truth looks like:
# <querypath> <targetpath> <position_from> <position_to>...
GTDATA = open(GTFILE, 'r').read().split('\n')
for lineNum in range(0, len(GTDATA)):
GTDATA[lineNum] = GTDATA[lineNum].split()
# Establish MongoDb Connection and get db and video collection
MONGOCLIENT = pymongo.MongoClient(port=8099)
DB = MONGOCLIENT[DBNAME]
VIDEOS = DB[COLNAME]
# Get config from MongoDb
CONFIG = VIDEOS.find_one({'_id': 'config'})
COLORNORMAL = '\033[0m'
COLORWARNING = '\033[93m'
COLORFAIL = '\033[91m'
# Search for all videos starting with "query" in database
# RegEx: Search for substring "query" in path, with digits after the string and a period after the digits
# (so we can be sure 'query' is not some directory name or else...)
if __name__ == '__main__':
outdir = os.path.join(ROOTDIR, 'out')
try:
os.mkdir(outdir)
except OSError:
print COLORWARNING + "WARNING: Output directory already exists. Existing data may be overwritten." + COLORNORMAL
benchmarkTreeBuild(outdir)
benchmarkSceneSearch(outdir) | [
11748,
279,
4948,
25162,
198,
11748,
4423,
346,
198,
11748,
28686,
198,
11748,
1822,
29572,
198,
11748,
302,
198,
11748,
2956,
297,
571,
17,
198,
11748,
850,
14681,
198,
11748,
640,
198,
198,
11748,
2603,
29487,
8019,
355,
285,
489,
198,
76,
489,
13,
1904,
10786,
46384,
11537,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
11748,
479,
32604,
301,
631,
198,
198,
6738,
25064,
1330,
8420,
198,
198,
2,
916,
272,
979,
378,
290,
17425,
281,
4578,
30751,
198,
27082,
35009,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
28,
7061,
8,
198,
27082,
35009,
13,
2860,
62,
49140,
10786,
15388,
7753,
3256,
1138,
615,
283,
11639,
35009,
5959,
25664,
3256,
198,
197,
16794,
11639,
464,
1336,
3108,
284,
262,
23612,
9078,
21015,
2393,
11,
543,
481,
307,
973,
329,
262,
18335,
357,
48546,
3228,
8133,
11537,
198,
27082,
35009,
13,
2860,
62,
49140,
10786,
634,
3256,
1138,
615,
283,
11639,
15490,
3256,
198,
197,
16794,
11639,
464,
2493,
319,
543,
262,
2639,
18497,
481,
1057,
11537,
198,
27082,
35009,
13,
2860,
62,
49140,
10786,
48806,
3256,
1138,
615,
283,
11639,
11012,
3256,
198,
197,
16794,
11639,
464,
1438,
286,
262,
42591,
11012,
24047,
319,
1957,
4774,
11537,
198,
27082,
35009,
13,
2860,
62,
49140,
10786,
43681,
3256,
1138,
615,
283,
11639,
25154,
16779,
2849,
3256,
198,
197,
16794,
11639,
464,
1438,
286,
262,
12251,
287,
262,
24047,
11537,
198,
27082,
35009,
13,
2860,
62,
49140,
10786,
11612,
6978,
3256,
1138,
615,
283,
11639,
1581,
3528,
17961,
34219,
3256,
198,
197,
16794,
11639,
464,
2656,
3108,
11,
810,
262,
20743,
290,
6670,
389,
357,
48546,
10185,
737,
770,
318,
973,
329,
262,
4175,
602,
287,
262,
5072,
3696,
290,
3555,
262,
2323,
35310,
2393,
2637,
8,
198,
27082,
35009,
13,
2860,
62,
49140,
10786,
83,
37668,
3256,
1138,
615,
283,
11639,
51,
3535,
1137,
19240,
3256,
198,
197,
16794,
11639,
464,
15621,
357,
259,
13431,
8,
703,
867,
13431,
262,
1043,
2496,
460,
307,
1497,
422,
2323,
3872,
11537,
198,
198,
2,
21136,
5128,
7159,
198,
1503,
14313,
796,
350,
27415,
1137,
13,
29572,
62,
22046,
3419,
198,
198,
35009,
5959,
25664,
796,
5923,
14313,
13,
15388,
7753,
198,
15490,
796,
5923,
14313,
13,
634,
198,
11012,
20608,
796,
5923,
14313,
13,
48806,
198,
25154,
20608,
796,
5923,
14313,
13,
43681,
198,
1581,
3528,
34219,
796,
5923,
14313,
13,
11612,
6978,
198,
51,
3535,
1137,
19240,
796,
493,
7,
1503,
14313,
13,
83,
37668,
8,
198,
198,
2,
27387,
286,
428,
2393,
198,
13252,
2394,
34720,
796,
28686,
13,
6978,
13,
397,
2777,
776,
10786,
2637,
8,
198,
198,
361,
357,
1662,
28686,
13,
6978,
13,
1069,
1023,
7,
35009,
5959,
25664,
4008,
393,
357,
1662,
28686,
13,
6978,
13,
4468,
576,
7,
35009,
5959,
25664,
8,
2599,
198,
197,
4798,
366,
464,
2639,
18497,
2393,
25,
705,
1,
1343,
18871,
5959,
25664,
1343,
366,
3256,
1595,
470,
2152,
393,
318,
407,
257,
2393,
2474,
198,
197,
17597,
13,
37023,
7,
16,
8,
198,
198,
361,
357,
1662,
28686,
13,
6978,
13,
1069,
1023,
7,
1581,
3528,
34219,
4008,
393,
357,
1662,
28686,
13,
6978,
13,
9409,
343,
7,
1581,
3528,
34219,
8,
2599,
198,
197,
4798,
366,
464,
1813,
3108,
25,
705,
1,
1343,
43901,
34219,
1343,
366,
3256,
1595,
470,
2152,
393,
318,
407,
257,
8619,
2474,
198,
197,
17597,
13,
37023,
7,
16,
8,
198,
198,
38,
10234,
41119,
796,
28686,
13,
6978,
13,
22179,
7,
1581,
3528,
34219,
11,
705,
33,
1677,
3398,
44,
14175,
62,
37,
9994,
13,
51,
25010,
11537,
198,
198,
361,
357,
1662,
28686,
13,
6978,
13,
1069,
1023,
7,
38,
10234,
41119,
4008,
393,
357,
1662,
28686,
13,
6978,
13,
4468,
576,
7,
38,
10234,
41119,
8,
2599,
198,
197,
4798,
366,
464,
2323,
35310,
2393,
25,
705,
1,
1343,
7963,
25664,
1343,
366,
3256,
1595,
470,
2152,
393,
318,
407,
257,
2393,
2474,
198,
197,
17597,
13,
37023,
7,
16,
8,
198,
198,
2,
4149,
13706,
14056,
2393,
290,
6626,
319,
3951,
290,
319,
9029,
329,
1123,
1627,
198,
2,
13706,
14056,
3073,
588,
25,
198,
2,
1279,
22766,
6978,
29,
1279,
16793,
6978,
29,
1279,
9150,
62,
6738,
29,
1279,
9150,
62,
1462,
29,
986,
198,
19555,
26947,
796,
1280,
7,
38,
10234,
41119,
11,
705,
81,
27691,
961,
22446,
35312,
10786,
59,
77,
11537,
198,
1640,
1627,
33111,
287,
2837,
7,
15,
11,
18896,
7,
19555,
26947,
8,
2599,
198,
197,
19555,
26947,
58,
1370,
33111,
60,
796,
7963,
26947,
58,
1370,
33111,
4083,
35312,
3419,
198,
198,
2,
10062,
17148,
42591,
43832,
26923,
290,
651,
20613,
290,
2008,
4947,
198,
44,
18494,
4503,
43,
28495,
796,
279,
4948,
25162,
13,
44,
25162,
11792,
7,
634,
28,
1795,
2079,
8,
198,
11012,
796,
337,
18494,
4503,
43,
28495,
58,
11012,
20608,
60,
198,
11008,
36,
2640,
796,
20137,
58,
25154,
20608,
60,
198,
198,
2,
3497,
4566,
422,
42591,
43832,
198,
10943,
16254,
796,
48876,
13,
19796,
62,
505,
15090,
6,
62,
312,
10354,
705,
11250,
6,
30072,
198,
198,
25154,
30649,
1581,
42126,
796,
705,
59,
44427,
58,
15,
76,
6,
198,
46786,
31502,
796,
705,
59,
44427,
58,
6052,
76,
6,
198,
46786,
7708,
4146,
796,
705,
59,
44427,
58,
6420,
76,
6,
628,
198,
198,
2,
11140,
329,
477,
5861,
3599,
351,
366,
22766,
1,
287,
6831,
198,
2,
3310,
3109,
25,
11140,
329,
3293,
1806,
366,
22766,
1,
287,
3108,
11,
351,
19561,
706,
262,
4731,
290,
257,
2278,
706,
262,
19561,
198,
2,
357,
568,
356,
460,
307,
1654,
705,
22766,
6,
318,
407,
617,
8619,
1438,
393,
2073,
23029,
198,
197,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
197,
448,
15908,
796,
28686,
13,
6978,
13,
22179,
7,
13252,
2394,
34720,
11,
705,
448,
11537,
198,
197,
28311,
25,
198,
197,
197,
418,
13,
28015,
15908,
7,
448,
15908,
8,
198,
197,
16341,
440,
5188,
81,
1472,
25,
198,
197,
197,
4798,
20444,
1581,
31502,
1343,
366,
31502,
25,
25235,
8619,
1541,
7160,
13,
1475,
9665,
1366,
743,
307,
6993,
9108,
526,
1343,
20444,
30649,
1581,
42126,
628,
197,
26968,
4102,
27660,
15580,
7,
448,
15908,
8,
628,
197,
26968,
4102,
36542,
18243,
7,
448,
15908,
8
] | 2.963356 | 1,037 |
import pytest
import mock
import numpy as np
import awkward as awk
from zinv.utils.AwkwardOps import (
get_nth_object,
get_nth_sorted_object_indices,
get_attr_for_min_ref,
jagged_prod,
)
@pytest.mark.parametrize("array,id,size,out", ([
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
0, 3,
np.array([0, 3, 5]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
1, 3,
np.array([1, 4, 6]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
2, 3,
np.array([2, np.nan, 7]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
3, 3,
np.array([np.nan, np.nan, 8]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
4, 3,
np.array([np.nan, np.nan, np.nan]),
]))
@pytest.mark.parametrize("array,ref,id,size,out", ([
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
awk.JaggedArray.fromiter([[3, 1, 2], [1, 2], [4, 1, 3, 2]]),
0, 3,
np.array([0, 4, 5]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
awk.JaggedArray.fromiter([[3, 1, 2], [1, 2], [4, 1, 3, 2]]),
1, 3,
np.array([2, 3, 7]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
awk.JaggedArray.fromiter([[3, 1, 2], [1, 2], [4, 1, 3, 2]]),
2, 3,
np.array([1, np.nan, 8]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
awk.JaggedArray.fromiter([[3, 1, 2], [1, 2], [4, 1, 3, 2]]),
3, 3,
np.array([np.nan, np.nan, 6]),
], [
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
awk.JaggedArray.fromiter([[3, 1, 2], [1, 2], [4, 1, 3, 2]]),
4, 3,
np.array([np.nan, np.nan, np.nan]),
]))
@pytest.mark.parametrize("array,ref,size,out", ([
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]),
awk.JaggedArray.fromiter([[3, 1, 2], [1, 2], [4, 1, 3, 2]]),
3,
np.array([1, 3, 6]),
],))
@pytest.mark.parametrize("input_,output", ([
awk.JaggedArray.fromiter([[0, 1, 2], [3, 4], [5, 6, 7, 8]]).astype(np.float32),
np.array([0, 12, 1680]),
],))
| [
11748,
12972,
9288,
198,
11748,
15290,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
13006,
355,
3253,
74,
198,
198,
6738,
1976,
16340,
13,
26791,
13,
23155,
12378,
41472,
1330,
357,
198,
220,
220,
220,
651,
62,
77,
400,
62,
15252,
11,
198,
220,
220,
220,
651,
62,
77,
400,
62,
82,
9741,
62,
15252,
62,
521,
1063,
11,
198,
220,
220,
220,
651,
62,
35226,
62,
1640,
62,
1084,
62,
5420,
11,
198,
220,
220,
220,
474,
14655,
62,
1676,
67,
11,
198,
8,
198,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
18747,
11,
312,
11,
7857,
11,
448,
1600,
29565,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
657,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
15,
11,
513,
11,
642,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
352,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
16,
11,
604,
11,
718,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
362,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
17,
11,
45941,
13,
12647,
11,
767,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
513,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
37659,
13,
12647,
11,
45941,
13,
12647,
11,
807,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
604,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
37659,
13,
12647,
11,
45941,
13,
12647,
11,
45941,
13,
12647,
46570,
198,
60,
4008,
198,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
18747,
11,
5420,
11,
312,
11,
7857,
11,
448,
1600,
29565,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
18,
11,
352,
11,
362,
4357,
685,
16,
11,
362,
4357,
685,
19,
11,
352,
11,
513,
11,
362,
11907,
828,
198,
220,
220,
220,
657,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
15,
11,
604,
11,
642,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
18,
11,
352,
11,
362,
4357,
685,
16,
11,
362,
4357,
685,
19,
11,
352,
11,
513,
11,
362,
11907,
828,
198,
220,
220,
220,
352,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
17,
11,
513,
11,
767,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
18,
11,
352,
11,
362,
4357,
685,
16,
11,
362,
4357,
685,
19,
11,
352,
11,
513,
11,
362,
11907,
828,
198,
220,
220,
220,
362,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
16,
11,
45941,
13,
12647,
11,
807,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
18,
11,
352,
11,
362,
4357,
685,
16,
11,
362,
4357,
685,
19,
11,
352,
11,
513,
11,
362,
11907,
828,
198,
220,
220,
220,
513,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
37659,
13,
12647,
11,
45941,
13,
12647,
11,
718,
46570,
198,
4357,
685,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
18,
11,
352,
11,
362,
4357,
685,
16,
11,
362,
4357,
685,
19,
11,
352,
11,
513,
11,
362,
11907,
828,
198,
220,
220,
220,
604,
11,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
37659,
13,
12647,
11,
45941,
13,
12647,
11,
45941,
13,
12647,
46570,
198,
60,
4008,
198,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
18747,
11,
5420,
11,
7857,
11,
448,
1600,
29565,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
828,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
18,
11,
352,
11,
362,
4357,
685,
16,
11,
362,
4357,
685,
19,
11,
352,
11,
513,
11,
362,
11907,
828,
198,
220,
220,
220,
513,
11,
198,
220,
220,
220,
45941,
13,
18747,
26933,
16,
11,
513,
11,
718,
46570,
198,
220,
220,
220,
16589,
4008,
198,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
15414,
62,
11,
22915,
1600,
29565,
198,
220,
220,
220,
3253,
74,
13,
41,
14655,
19182,
13,
6738,
2676,
26933,
58,
15,
11,
352,
11,
362,
4357,
685,
18,
11,
604,
4357,
685,
20,
11,
718,
11,
767,
11,
807,
11907,
737,
459,
2981,
7,
37659,
13,
22468,
2624,
828,
198,
220,
220,
220,
45941,
13,
18747,
26933,
15,
11,
1105,
11,
1467,
1795,
46570,
198,
4357,
4008,
198
] | 1.854403 | 1,147 |
#!/usr/bin/env python
import datetime
import time
import os
from shutil import copyfile
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from grovepi import *
SLEEP_TIME = 3
dht_sensor_port = 7
dht_sensor_type = 0
g_login = GoogleAuth()
g_login.LocalWebserverAuth()
drive = GoogleDrive(g_login)
# set loop delay time in seconds, must be less than 1000
loopdelay = 5
# set time at which to upload to google drive
upload_time = datetime.time(12, 0, 0)
# generate two time objects to represent a range of time using the loop delay
# to make sure the current time will only be within the update range once per day
upload_time_begin = datetime.time(upload_time.hour, upload_time.minute, upload_time.second)
minuteoffset = loopdelay/60
secondoffset = loopdelay%60
upload_time_end = datetime.time(upload_time.hour, (upload_time.minute + minuteoffset), (upload_time.second + secondoffset))
# object to hold the currrent time
now = datetime.datetime.now().time()
today = datetime.datetime.now().date()
# check to see if there is an old log file; if there is delete it
if os.path.exists("logdata.tmp"):
os.remove("logdata.tmp")
#initalize temp file to hold the log data as it is produced
tempfile = open("logdata.tmp", 'w')
# begin file with time program was started
print("Program started at %s on %s\n" % (now.strftime("%H:%M:%S"), today))
tempfile.write("Log started at %s on %s\n" % (now.strftime("%H:%M:%S"), today))
#print(upload_time_begin)
#print(upload_time_end)
[temperature, humidity] = dht(dht_sensor_port, dht_sensor_type)
# Main loop
while True:
#try block to catch if the user intrupts the script running
try:
#update the now time
now = datetime.datetime.now().time()
today = datetime.datetime.now().date()
# if now is between upload time and loopdelay seconds after that time:
if upload_time_begin < now < upload_time_end:
#close the file
tempfile.close()
# generate logfile final na,e
logfilename = "%s.dat" % datetime.datetime.now().date()
#copy contents of temp file to final log file form
copyfile("logdata.tmp", logfilename)
# will be uploading logic
upload(logfilename)
# delete old files
os.remove("logdata.tmp")
os.remove(logfilename)
# open new tempfile and write the first line
tempfile = open("logdata.tmp", 'w')
tempfile.write("Log started at %s on %s\n" % (now, today))
# get/write data to the file
[temperature, humidity] = dht(dht_sensor_port, dht_sensor_type)
tempstring = now.strftime("%H:%M:%S") + "| TEMPERATURE: " + str(temperature) + " | HUMIDITY: " + str(humidity) + "\n"
tempfile.write(tempstring)
print(tempstring)
# wait for a user difined number of seconds
time.sleep(loopdelay)
except KeyboardInterrupt:
tempfile.close()
interruptfile = "%s-interrupt.dat" % datetime.datetime.now().date()
copyfile("logdata.tmp", interruptfile)
upload(interruptfile)
os.remove(interruptfile)
break
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
4818,
8079,
198,
11748,
640,
198,
11748,
28686,
198,
6738,
4423,
346,
1330,
4866,
7753,
198,
6738,
279,
5173,
11590,
13,
18439,
1330,
3012,
30515,
198,
6738,
279,
5173,
11590,
13,
19472,
1330,
3012,
24825,
198,
6738,
7128,
303,
14415,
1330,
1635,
198,
198,
50,
2538,
8905,
62,
34694,
796,
513,
198,
198,
67,
4352,
62,
82,
22854,
62,
634,
796,
767,
198,
67,
4352,
62,
82,
22854,
62,
4906,
796,
657,
198,
198,
70,
62,
38235,
796,
3012,
30515,
3419,
198,
70,
62,
38235,
13,
14565,
1135,
1443,
18497,
30515,
3419,
198,
19472,
796,
3012,
24825,
7,
70,
62,
38235,
8,
628,
198,
2,
900,
9052,
5711,
640,
287,
4201,
11,
1276,
307,
1342,
621,
8576,
198,
26268,
40850,
796,
642,
198,
198,
2,
900,
640,
379,
543,
284,
9516,
284,
23645,
3708,
198,
25850,
62,
2435,
796,
4818,
8079,
13,
2435,
7,
1065,
11,
657,
11,
657,
8,
628,
198,
198,
2,
7716,
734,
640,
5563,
284,
2380,
257,
2837,
286,
640,
1262,
262,
9052,
5711,
198,
2,
284,
787,
1654,
262,
1459,
640,
481,
691,
307,
1626,
262,
4296,
2837,
1752,
583,
1110,
198,
25850,
62,
2435,
62,
27471,
796,
4818,
8079,
13,
2435,
7,
25850,
62,
2435,
13,
9769,
11,
9516,
62,
2435,
13,
11374,
11,
9516,
62,
2435,
13,
12227,
8,
198,
198,
11374,
28968,
796,
9052,
40850,
14,
1899,
198,
12227,
28968,
796,
9052,
40850,
4,
1899,
198,
25850,
62,
2435,
62,
437,
796,
4818,
8079,
13,
2435,
7,
25850,
62,
2435,
13,
9769,
11,
357,
25850,
62,
2435,
13,
11374,
1343,
5664,
28968,
828,
357,
25850,
62,
2435,
13,
12227,
1343,
1218,
28968,
4008,
628,
198,
2,
2134,
284,
1745,
262,
1090,
81,
1156,
640,
198,
2197,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
22446,
2435,
3419,
198,
40838,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
22446,
4475,
3419,
628,
198,
2,
2198,
284,
766,
611,
612,
318,
281,
1468,
2604,
2393,
26,
611,
612,
318,
12233,
340,
198,
361,
28686,
13,
6978,
13,
1069,
1023,
7203,
6404,
7890,
13,
22065,
1,
2599,
198,
220,
220,
220,
28686,
13,
28956,
7203,
6404,
7890,
13,
22065,
4943,
198,
198,
2,
259,
1287,
1096,
20218,
2393,
284,
1745,
262,
2604,
1366,
355,
340,
318,
4635,
198,
29510,
7753,
796,
1280,
7203,
6404,
7890,
13,
22065,
1600,
705,
86,
11537,
198,
198,
2,
2221,
2393,
351,
640,
1430,
373,
2067,
198,
4798,
7203,
15167,
2067,
379,
4064,
82,
319,
4064,
82,
59,
77,
1,
4064,
357,
2197,
13,
2536,
31387,
7203,
4,
39,
25,
4,
44,
25,
4,
50,
12340,
1909,
4008,
198,
29510,
7753,
13,
13564,
7203,
11187,
2067,
379,
4064,
82,
319,
4064,
82,
59,
77,
1,
4064,
357,
2197,
13,
2536,
31387,
7203,
4,
39,
25,
4,
44,
25,
4,
50,
12340,
1909,
4008,
198,
198,
2,
4798,
7,
25850,
62,
2435,
62,
27471,
8,
198,
2,
4798,
7,
25850,
62,
2435,
62,
437,
8,
198,
198,
58,
11498,
21069,
11,
27716,
60,
796,
288,
4352,
7,
67,
4352,
62,
82,
22854,
62,
634,
11,
288,
4352,
62,
82,
22854,
62,
4906,
8,
628,
198,
2,
8774,
9052,
198,
4514,
6407,
25,
198,
220,
220,
220,
1303,
28311,
2512,
284,
4929,
611,
262,
2836,
493,
3622,
82,
262,
4226,
2491,
198,
220,
220,
220,
1949,
25,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
19119,
262,
783,
640,
198,
220,
220,
220,
220,
220,
220,
220,
783,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
22446,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1909,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
22446,
4475,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
783,
318,
1022,
9516,
640,
290,
9052,
40850,
4201,
706,
326,
640,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
9516,
62,
2435,
62,
27471,
1279,
783,
1279,
9516,
62,
2435,
62,
437,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
19836,
262,
2393,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
7753,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
7716,
2604,
7753,
2457,
12385,
11,
68,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2604,
34345,
796,
36521,
82,
13,
19608,
1,
4064,
4818,
8079,
13,
19608,
8079,
13,
2197,
22446,
4475,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
30073,
10154,
286,
20218,
2393,
284,
2457,
2604,
2393,
1296,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4866,
7753,
7203,
6404,
7890,
13,
22065,
1600,
2604,
34345,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
481,
307,
33794,
9156,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9516,
7,
6404,
34345,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
12233,
1468,
3696,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
28956,
7203,
6404,
7890,
13,
22065,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
28956,
7,
6404,
34345,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1280,
649,
20218,
7753,
290,
3551,
262,
717,
1627,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
7753,
796,
1280,
7203,
6404,
7890,
13,
22065,
1600,
705,
86,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
7753,
13,
13564,
7203,
11187,
2067,
379,
4064,
82,
319,
4064,
82,
59,
77,
1,
4064,
357,
2197,
11,
1909,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
14,
13564,
1366,
284,
262,
2393,
198,
220,
220,
220,
220,
220,
220,
220,
685,
11498,
21069,
11,
27716,
60,
796,
288,
4352,
7,
67,
4352,
62,
82,
22854,
62,
634,
11,
288,
4352,
62,
82,
22854,
62,
4906,
8,
628,
220,
220,
220,
220,
220,
220,
220,
20218,
8841,
796,
783,
13,
2536,
31387,
7203,
4,
39,
25,
4,
44,
25,
4,
50,
4943,
1343,
366,
91,
309,
3620,
18973,
40086,
25,
366,
1343,
965,
7,
11498,
21069,
8,
1343,
366,
220,
220,
930,
45850,
2389,
9050,
25,
366,
1343,
965,
7,
17047,
17995,
8,
1343,
37082,
77,
1,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
7753,
13,
13564,
7,
29510,
8841,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
29510,
8841,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
4043,
329,
257,
2836,
288,
361,
1389,
1271,
286,
4201,
198,
220,
220,
220,
220,
220,
220,
220,
640,
13,
42832,
7,
26268,
40850,
8,
628,
220,
220,
220,
2845,
31973,
9492,
3622,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
7753,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
11313,
7753,
796,
36521,
82,
12,
3849,
3622,
13,
19608,
1,
4064,
4818,
8079,
13,
19608,
8079,
13,
2197,
22446,
4475,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4866,
7753,
7203,
6404,
7890,
13,
22065,
1600,
11313,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9516,
7,
3849,
3622,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
28956,
7,
3849,
3622,
7753,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2270,
198
] | 2.579839 | 1,240 |
colors = {
"white": (255, 255, 255),
"red": (255, 0, 0),
"green": (0, 255, 0),
"blue": (0, 0, 255),
"orange": (255, 128, 0)
} | [
4033,
669,
796,
1391,
198,
220,
220,
220,
366,
11186,
1298,
357,
13381,
11,
14280,
11,
14280,
828,
198,
220,
220,
220,
366,
445,
1298,
357,
13381,
11,
657,
11,
657,
828,
198,
220,
220,
220,
366,
14809,
1298,
357,
15,
11,
14280,
11,
657,
828,
198,
220,
220,
220,
366,
17585,
1298,
357,
15,
11,
657,
11,
14280,
828,
198,
220,
220,
220,
366,
43745,
1298,
357,
13381,
11,
13108,
11,
657,
8,
198,
92
] | 1.907895 | 76 |
from domain.address_details import AddressDetails
from domain.gdk_account import GdkAccount
from domain.gdk_wallet import GdkWallet
from typing import Dict, List
from domain.utxo import Utxo
from services.wallet import WalletService
class AccountService:
"""create a new GDK account"""
"""derive new addresses for an account"""
"""list all known addresses of the account"""
"""get the balance of the account, include only unspent where min_num_confs is met"""
"""list all the known unspents for an account""" | [
6738,
7386,
13,
21975,
62,
36604,
1330,
17917,
24259,
198,
6738,
7386,
13,
21287,
74,
62,
23317,
1330,
402,
34388,
30116,
198,
6738,
7386,
13,
21287,
74,
62,
44623,
1330,
402,
34388,
47152,
198,
6738,
19720,
1330,
360,
713,
11,
7343,
198,
198,
6738,
7386,
13,
315,
87,
78,
1330,
7273,
87,
78,
198,
6738,
2594,
13,
44623,
1330,
37249,
16177,
198,
198,
4871,
10781,
16177,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
37227,
17953,
257,
649,
27044,
42,
1848,
37811,
198,
220,
220,
220,
220,
198,
220,
220,
220,
37227,
1082,
425,
649,
9405,
329,
281,
1848,
37811,
628,
220,
220,
220,
37227,
4868,
477,
1900,
9405,
286,
262,
1848,
37811,
198,
220,
220,
220,
220,
198,
220,
220,
220,
37227,
1136,
262,
5236,
286,
262,
1848,
11,
2291,
691,
555,
2777,
298,
810,
949,
62,
22510,
62,
1102,
9501,
318,
1138,
37811,
198,
220,
220,
220,
220,
198,
220,
220,
220,
37227,
4868,
477,
262,
1900,
555,
2777,
658,
329,
281,
1848,
37811
] | 3.226744 | 172 |
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from ngsi_v2.api.api_entry_point_api import APIEntryPointApi
from ngsi_v2.api.attribute_value_api import AttributeValueApi
from ngsi_v2.api.attributes_api import AttributesApi
from ngsi_v2.api.batch_operations_api import BatchOperationsApi
from ngsi_v2.api.entities_api import EntitiesApi
from ngsi_v2.api.registrations_api import RegistrationsApi
from ngsi_v2.api.subscriptions_api import SubscriptionsApi
from ngsi_v2.api.types_api import TypesApi
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
2,
781,
539,
23,
25,
645,
20402,
198,
198,
2,
1330,
2471,
271,
656,
40391,
5301,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
15042,
62,
13000,
62,
4122,
62,
15042,
1330,
7824,
30150,
12727,
32,
14415,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
42348,
62,
8367,
62,
15042,
1330,
3460,
4163,
11395,
32,
14415,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
1078,
7657,
62,
15042,
1330,
49213,
32,
14415,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
43501,
62,
3575,
602,
62,
15042,
1330,
347,
963,
18843,
602,
32,
14415,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
298,
871,
62,
15042,
1330,
7232,
871,
32,
14415,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
2301,
396,
9143,
62,
15042,
1330,
13811,
9143,
32,
14415,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
7266,
12048,
507,
62,
15042,
1330,
3834,
12048,
507,
32,
14415,
198,
6738,
23370,
13396,
62,
85,
17,
13,
15042,
13,
19199,
62,
15042,
1330,
24897,
32,
14415,
198
] | 2.84127 | 189 |
from django.db import models
| [
6738,
42625,
14208,
13,
9945,
1330,
4981,
628,
198
] | 3.444444 | 9 |
from __future__ import annotations
from cli_stryket.system_exception import InvalidSystemException
| [
6738,
11593,
37443,
834,
1330,
37647,
198,
6738,
537,
72,
62,
301,
563,
7126,
13,
10057,
62,
1069,
4516,
1330,
17665,
11964,
16922,
628,
628,
198
] | 3.961538 | 26 |
import pandas as pd
import glob
txt_files = glob.glob("*.txt")
image_files=[]
for i in txt_files:
i=i.replace(".txt", "");
image_files.append(i)
print(image_files)
print(len(image_files))
#print((txt_files))
df=pd.read_csv('train.csv') # enter your filename with exiftags
df['Assessment']=''
df['Compression/Ratio']=''
df['BPP']=''
df['Signature']=''
df['Signature Rotated']=''
df['SW']=''
df['Luminance(QT)']=''
df['Chrominance(QT)']=''
df['Quality Factor(Luminance)']=''
df['Quality Factor(Chrominance)']=''
print (df.name)
for i in image_files:
#df2=df[df['name'].str.contains(i)]
#print(df2)
file_name=i+".txt"
sw=[]
with open(file_name, 'r') as f:
for line in f:
if 'Destination ID=0 (Luminance)' in line:
count=0
lum_list=[]
for line in f:
if count<9:
#print (line)
count=count+1
lum_list.append(line)
else:
break
if 'Destination ID=1 (Chrominance)' in line:
count=0
chrom_list=[]
for line in f:
if count<9:
#print (line)
count=count+1
chrom_list.append(line)
else:
break
#cr=''
if 'Compression Ratio:' in line:
cr=line
print (cr)
else:
cr=''
#bpp=''
if 'Bits per pixel:' in line:
bpp=line
#print (line)
else:
bpp=''
if 'Signature:' in line:
sign=line
#print (line)
if 'Signature (Rotated):' in line:
signR=line
#print (line)
if 'SW :' in line:
#print(line)
sw.append(line)
if 'ASSESSMENT:' in line:
assessment=line
#print (line)
lum_li=lum_list[:-1]
chrom_li=chrom_list[:-1]
#print (sw)
#print(lum_li)
#print(chrom_li)
#print (cr)
cr= cr
print (cr)
bpp = bpp.strip('Bits per pixel: ')
sign = sign.strip('Signature: ')
signR = signR.strip('Signature (Rotated): ')
assessment=assessment.strip('ASSESSMENT: Class 1 - ')
lum_qf= (lum_list[-1])
chrom_qf= (chrom_list[-1])
lum_qf=lum_qf.strip('Approx quality factor = ')
chrom_qf=chrom_qf.strip('Approx quality factor = ')
df.loc[df['name'].str.contains(i), 'Assessment'] = assessment
df.loc[df['name'].str.contains(i), 'Compression/Ratio'] = str(cr)
df.loc[df['name'].str.contains(i), 'BPP'] = str(bpp)
df.loc[df['name'].str.contains(i), 'Signature'] = sign
df.loc[df['name'].str.contains(i), 'Signature Rotated'] = signR
df.loc[df['name'].str.contains(i), 'SW'] = str(sw)
df.loc[df['name'].str.contains(i), 'Luminance(QT)'] = str(lum_li)
df.loc[df['name'].str.contains(i), 'Chrominance(QT)'] = str(chrom_li)
df.loc[df['name'].str.contains(i), 'Quality Factor(Luminance)'] = lum_qf
df.loc[df['name'].str.contains(i), 'Quality Factor(Chrominance)'] = chrom_qf
df.to_csv('updated_test.csv', index=False) #your csv with exif and jpegsnoop data
print (df.shape) | [
11748,
19798,
292,
355,
279,
67,
198,
11748,
15095,
198,
14116,
62,
16624,
796,
15095,
13,
4743,
672,
7203,
24620,
14116,
4943,
198,
9060,
62,
16624,
28,
21737,
198,
1640,
1312,
287,
256,
742,
62,
16624,
25,
198,
220,
220,
220,
1312,
28,
72,
13,
33491,
7,
1911,
14116,
1600,
13538,
1776,
198,
220,
220,
220,
2939,
62,
16624,
13,
33295,
7,
72,
8,
198,
220,
220,
220,
220,
198,
4798,
7,
9060,
62,
16624,
8,
198,
198,
4798,
7,
11925,
7,
9060,
62,
16624,
4008,
198,
198,
2,
4798,
19510,
14116,
62,
16624,
4008,
198,
198,
7568,
28,
30094,
13,
961,
62,
40664,
10786,
27432,
13,
40664,
11537,
1303,
3802,
534,
29472,
351,
409,
2135,
3775,
198,
7568,
17816,
8021,
21687,
20520,
28,
7061,
198,
7568,
17816,
7293,
2234,
14,
29665,
952,
20520,
28,
7061,
198,
7568,
17816,
33,
10246,
20520,
28,
7061,
198,
7568,
17816,
11712,
1300,
20520,
28,
7061,
198,
7568,
17816,
11712,
1300,
18481,
515,
20520,
28,
7061,
198,
7568,
17816,
17887,
20520,
28,
7061,
198,
7568,
17816,
43,
7230,
590,
7,
48,
51,
8,
20520,
28,
7061,
198,
7568,
17816,
1925,
398,
14149,
7,
48,
51,
8,
20520,
28,
7061,
198,
7568,
17816,
35013,
27929,
7,
43,
7230,
590,
8,
20520,
28,
7061,
198,
7568,
17816,
35013,
27929,
7,
1925,
398,
14149,
8,
20520,
28,
7061,
198,
198,
4798,
357,
7568,
13,
3672,
8,
628,
198,
1640,
1312,
287,
2939,
62,
16624,
25,
198,
220,
220,
220,
1303,
7568,
17,
28,
7568,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
15437,
198,
220,
220,
220,
1303,
4798,
7,
7568,
17,
8,
220,
220,
220,
220,
628,
198,
220,
220,
220,
2393,
62,
3672,
28,
72,
10,
1911,
14116,
1,
198,
220,
220,
220,
1509,
28,
21737,
198,
220,
220,
220,
351,
1280,
7,
7753,
62,
3672,
11,
705,
81,
11537,
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,
611,
705,
24159,
1883,
4522,
28,
15,
357,
43,
7230,
590,
33047,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
28,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
46390,
62,
4868,
28,
21737,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
954,
27,
24,
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,
1303,
4798,
357,
1370,
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,
954,
28,
9127,
10,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
46390,
62,
4868,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
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,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
24159,
1883,
4522,
28,
16,
357,
1925,
398,
14149,
33047,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
28,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15358,
62,
4868,
28,
21737,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
954,
27,
24,
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,
1303,
4798,
357,
1370,
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,
954,
28,
9127,
10,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15358,
62,
4868,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6098,
28,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
7293,
2234,
33956,
32105,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1067,
28,
1370,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
357,
6098,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1067,
28,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
65,
381,
28,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
33,
896,
583,
17465,
32105,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
381,
28,
1370,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
381,
28,
7061,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
11712,
1300,
32105,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1051,
28,
1370,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
11712,
1300,
357,
24864,
515,
2599,
6,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1051,
49,
28,
1370,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
17887,
1058,
6,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1509,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
10705,
7597,
10979,
32105,
287,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8922,
28,
1370,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
1370,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
46390,
62,
4528,
28,
75,
388,
62,
4868,
58,
21912,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
15358,
62,
4528,
28,
28663,
62,
4868,
58,
21912,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
2032,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
7,
75,
388,
62,
4528,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
7,
28663,
62,
4528,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
6098,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1067,
28,
1067,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
357,
6098,
8,
198,
220,
220,
220,
220,
220,
220,
220,
275,
381,
796,
275,
381,
13,
36311,
10786,
33,
896,
583,
17465,
25,
220,
220,
220,
220,
705,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1051,
796,
1051,
13,
36311,
10786,
11712,
1300,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1051,
49,
796,
1051,
49,
13,
36311,
10786,
11712,
1300,
357,
24864,
515,
2599,
705,
8,
198,
220,
220,
220,
220,
220,
220,
220,
8922,
28,
562,
21687,
13,
36311,
10786,
10705,
7597,
10979,
25,
5016,
352,
532,
705,
8,
198,
220,
220,
220,
220,
220,
220,
220,
46390,
62,
80,
69,
28,
357,
75,
388,
62,
4868,
58,
12,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
15358,
62,
80,
69,
28,
357,
28663,
62,
4868,
58,
12,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
46390,
62,
80,
69,
28,
75,
388,
62,
80,
69,
13,
36311,
10786,
4677,
13907,
3081,
5766,
796,
705,
8,
198,
220,
220,
220,
220,
220,
220,
220,
15358,
62,
80,
69,
28,
28663,
62,
80,
69,
13,
36311,
10786,
4677,
13907,
3081,
5766,
796,
705,
8,
628,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
8021,
21687,
20520,
796,
8922,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
7293,
2234,
14,
29665,
952,
20520,
796,
965,
7,
6098,
8,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
33,
10246,
20520,
796,
965,
7,
65,
381,
8,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
11712,
1300,
20520,
796,
1051,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
11712,
1300,
18481,
515,
20520,
796,
1051,
49,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
17887,
20520,
796,
965,
7,
2032,
8,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
43,
7230,
590,
7,
48,
51,
8,
20520,
796,
965,
7,
75,
388,
62,
4528,
8,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
1925,
398,
14149,
7,
48,
51,
8,
20520,
796,
965,
7,
28663,
62,
4528,
8,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
35013,
27929,
7,
43,
7230,
590,
8,
20520,
796,
46390,
62,
80,
69,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
17946,
58,
7568,
17816,
3672,
6,
4083,
2536,
13,
3642,
1299,
7,
72,
828,
705,
35013,
27929,
7,
1925,
398,
14149,
8,
20520,
796,
15358,
62,
80,
69,
198,
198,
7568,
13,
1462,
62,
40664,
10786,
43162,
62,
9288,
13,
40664,
3256,
6376,
28,
25101,
8,
1303,
14108,
269,
21370,
351,
409,
361,
290,
474,
431,
14542,
3919,
404,
1366,
198,
4798,
357,
7568,
13,
43358,
8
] | 1.69129 | 2,193 |
#!/usr/bin/env python
##
# omnibus - deadbits
# Twitter username search
##
from BeautifulSoup import BeautifulSoup
from http import get
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2235,
198,
2,
22284,
26333,
532,
2636,
9895,
198,
2,
3009,
20579,
2989,
198,
2235,
198,
198,
6738,
23762,
50,
10486,
1330,
23762,
50,
10486,
198,
198,
6738,
2638,
1330,
651,
628,
628
] | 3.357143 | 42 |
import logging
from niftypet.ninst import install_tools as tls
from .conftest import HOME
log = logging.getLogger(__name__)
DATA_URL = "https://zenodo.org/record/3877529/files/amyloidPET_FBP_TP0_extra.zip?download=1"
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
main()
| [
11748,
18931,
198,
198,
6738,
47803,
6449,
13,
77,
8625,
1330,
2721,
62,
31391,
355,
256,
7278,
198,
198,
6738,
764,
1102,
701,
395,
1330,
41779,
198,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
26947,
62,
21886,
796,
366,
5450,
1378,
4801,
24313,
13,
2398,
14,
22105,
14,
32220,
2425,
1959,
14,
16624,
14,
321,
2645,
1868,
47731,
62,
37,
20866,
62,
7250,
15,
62,
26086,
13,
13344,
30,
15002,
28,
16,
1,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
18931,
13,
35487,
16934,
7,
5715,
28,
6404,
2667,
13,
10778,
8,
198,
220,
220,
220,
1388,
3419,
198
] | 2.62931 | 116 |
forces = pinocchio.StdVect_Force()
for i in range(rmodel.njoints): forces.append(pinocchio.Force.Zero())
tau,fr,fl = pbm.x2vars(res)
Mr = rmodel.frames[pbm.idR].placement
jr = rmodel.frames[pbm.idR].parent
forces[jr] = Mr.act(pinocchio.Force(fr))
Ml = rmodel.frames[pbm.idL].placement
jl = rmodel.frames[pbm.idL].parent
fl = pinocchio.Force(fl)
forces[jl] = Mr.act(pinocchio.Force(fl))
print(pinocchio.rnea(rmodel,rdata,pbm.q,pbm.vq,zero(rmodel.nv),forces)-tau)
| [
27087,
796,
6757,
420,
40900,
13,
1273,
67,
53,
478,
62,
10292,
3419,
198,
1640,
1312,
287,
2837,
7,
81,
19849,
13,
77,
73,
1563,
82,
2599,
3386,
13,
33295,
7,
11635,
420,
40900,
13,
10292,
13,
28667,
28955,
198,
198,
83,
559,
11,
8310,
11,
2704,
796,
279,
20475,
13,
87,
17,
85,
945,
7,
411,
8,
198,
198,
5246,
796,
374,
19849,
13,
37805,
58,
79,
20475,
13,
312,
49,
4083,
489,
5592,
198,
73,
81,
796,
374,
19849,
13,
37805,
58,
79,
20475,
13,
312,
49,
4083,
8000,
198,
27087,
58,
73,
81,
60,
796,
1770,
13,
529,
7,
11635,
420,
40900,
13,
10292,
7,
8310,
4008,
198,
198,
44,
75,
796,
374,
19849,
13,
37805,
58,
79,
20475,
13,
312,
43,
4083,
489,
5592,
198,
20362,
796,
374,
19849,
13,
37805,
58,
79,
20475,
13,
312,
43,
4083,
8000,
198,
2704,
796,
6757,
420,
40900,
13,
10292,
7,
2704,
8,
198,
27087,
58,
20362,
60,
796,
1770,
13,
529,
7,
11635,
420,
40900,
13,
10292,
7,
2704,
4008,
198,
198,
4798,
7,
11635,
420,
40900,
13,
81,
39718,
7,
81,
19849,
11,
4372,
1045,
11,
79,
20475,
13,
80,
11,
79,
20475,
13,
85,
80,
11,
22570,
7,
81,
19849,
13,
48005,
828,
27087,
13219,
83,
559,
8,
198
] | 2.187793 | 213 |
'''
boxdb/support_litebase -> v0.3
This file contain code for
1)get the data from file, and get row data
[ ]get_content() speed optimization
[ ]get_element() function added
'''
def get_content(context, target):
"""
It gets the content from any file with
data in it(auto generated) and returns in list
"""
lines = []
try:
with open(target,encoding='UTF-8') as file:
for line in file:
line = line.strip()
lines.append(line)
except FileNotFoundError:
print(f"{context} file missing")
return lines
def get_columns(table_name):
"""
It gets the content from any file with
data in it(auto generated) and returns in list
"""
lines = []
try:
with open(f"{table_name}/{table_name}_data.txt",encoding='UTF-8') as file:
for line in file:
line = line.strip()
try:
lines.append(line.removesuffix("-P").strip())
except Exception:
lines.append(line)
except FileNotFoundError:
print("column file missing")
return lines
def get_primary_column(table_name):
"""
This gets all the primary key rows from the table
"""
#FIXME optimization need takes 0.009 secs
columns= get_content("row", f"{table_name}/{table_name}_data.txt")
return [
elements[: len(elements) - 2].strip()
for elements in columns
if elements.find("-P") > 0]
def get_elements(table_name,column):
"""
get values from column
"""
with open(f'.\\{table_name}\\tables\\{column}.txt','r+',encoding="UTF-8") as files:
line=files.readlines()
return [elements.removesuffix('\n').strip() for elements in line]
| [
7061,
6,
198,
3524,
9945,
14,
11284,
62,
36890,
8692,
4613,
410,
15,
13,
18,
198,
198,
1212,
2393,
3994,
2438,
329,
198,
16,
8,
1136,
262,
1366,
422,
2393,
11,
290,
651,
5752,
1366,
198,
198,
58,
2361,
1136,
62,
11299,
3419,
2866,
23989,
198,
58,
2361,
1136,
62,
30854,
3419,
2163,
2087,
198,
198,
7061,
6,
198,
198,
4299,
651,
62,
11299,
7,
22866,
11,
2496,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
632,
3011,
262,
2695,
422,
597,
2393,
351,
198,
220,
220,
220,
1366,
287,
340,
7,
23736,
7560,
8,
290,
5860,
287,
1351,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3951,
796,
17635,
198,
220,
220,
220,
1949,
25,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
16793,
11,
12685,
7656,
11639,
48504,
12,
23,
11537,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
1627,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3951,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
2845,
9220,
3673,
21077,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
1,
90,
22866,
92,
2393,
4814,
4943,
198,
220,
220,
220,
1441,
3951,
198,
198,
4299,
651,
62,
28665,
82,
7,
11487,
62,
3672,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
632,
3011,
262,
2695,
422,
597,
2393,
351,
198,
220,
220,
220,
1366,
287,
340,
7,
23736,
7560,
8,
290,
5860,
287,
1351,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3951,
796,
17635,
628,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
69,
1,
90,
11487,
62,
3672,
92,
14,
90,
11487,
62,
3672,
92,
62,
7890,
13,
14116,
1600,
12685,
7656,
11639,
48504,
12,
23,
11537,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
1627,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3951,
13,
33295,
7,
1370,
13,
2787,
5241,
1648,
844,
7203,
12,
47,
11074,
36311,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3951,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
2845,
9220,
3673,
21077,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
28665,
2393,
4814,
4943,
198,
220,
220,
220,
1441,
3951,
198,
220,
220,
220,
220,
198,
198,
4299,
651,
62,
39754,
62,
28665,
7,
11487,
62,
3672,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
770,
3011,
477,
262,
4165,
1994,
15274,
422,
262,
3084,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
47084,
11682,
23989,
761,
2753,
657,
13,
28694,
792,
82,
198,
220,
220,
220,
15180,
28,
651,
62,
11299,
7203,
808,
1600,
277,
1,
90,
11487,
62,
3672,
92,
14,
90,
11487,
62,
3672,
92,
62,
7890,
13,
14116,
4943,
198,
220,
220,
220,
1441,
685,
198,
220,
220,
220,
220,
220,
220,
220,
4847,
58,
25,
18896,
7,
68,
3639,
8,
532,
362,
4083,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
329,
4847,
287,
15180,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4847,
13,
19796,
7203,
12,
47,
4943,
1875,
657,
60,
198,
198,
4299,
651,
62,
68,
3639,
7,
11487,
62,
3672,
11,
28665,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
651,
3815,
422,
5721,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
351,
1280,
7,
69,
4458,
6852,
90,
11487,
62,
3672,
92,
6852,
83,
2977,
6852,
90,
28665,
27422,
14116,
41707,
81,
10,
3256,
12685,
7656,
2625,
48504,
12,
23,
4943,
355,
3696,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1627,
28,
16624,
13,
961,
6615,
3419,
198,
220,
220,
220,
1441,
685,
68,
3639,
13,
2787,
5241,
1648,
844,
10786,
59,
77,
27691,
36311,
3419,
329,
4847,
287,
1627,
60,
198
] | 2.320313 | 768 |
import re
CITY_RE = re.compile('[^a-zA-Z- ]')
DATA = {
'a': {
'anzherosudzhensk':'анжеро-судженск',
'ashukino':'ашукино',
},
'b': {
'bronnitsy':'бронницы',
'biysk':'бийск',
},
'c': {
'chelyabinsk':'челябинск',
},
'd': {
},
'e': {
'elektrostal':'электросталь',
},
'f': {
},
'g': {
},
'h': {
},
'i': {
'ivanteyevka':'ивантеевка',
'irkutsk':'иркутск',
'ivanovo':'иваново',
},
'j': {
},
'k': {
'kirov':'киров',
'krasnoarmeysk':'красноармейск',
'korolyov':'королев',
'kashira':'кашира',
'kazan':'казань',
'kozhevnikovo':'кожевниково',
'klin':'клин',
'klimovsk':'климовск',
'krasnodar':'краснодар',
},
'l': {
'leninsk_kuznetsky':'ленинск-кузнецкий',
},
'm': {
'moscow':'москва',
'mezhdurechensk':'междуреченск',
},
'n': {
'novoaltaysk':'новоалтайск',
'nizhniy_novgorod':'нижний новгород',
},
'o': {
'oktyabrsky':'октябрьский',
'orenburg':'оренбург',
},
'p': {
'podolsk':'подольск',
'plavsk':'плавск',
'prokopyevsk':'прокопьевск',
},
'q': {
},
'r': {
'ramenskoye':'раменское',
},
's': {
'st_petersburg':'санкт-петербург',
'staraya yurga':'старая юрга',
'sverdlovskiy':'свердловский',
},
't': {
'tayga':'тайга',
'tula':'тула',
},
'v': {
'volgograd':'волгоград',
},
'u': {
},
'w': {
},
'x': {
},
'y': {
'yaroslavl':'ярославль',
'yekaterinburg':'екатеринбург',
},
'z': {
'zhukovskiy':'жуковский',
},
}
| [
11748,
302,
198,
198,
34,
9050,
62,
2200,
796,
302,
13,
5589,
576,
10786,
58,
61,
64,
12,
89,
32,
12,
57,
12,
2361,
11537,
198,
26947,
796,
1391,
198,
220,
220,
220,
705,
64,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
35410,
258,
4951,
463,
89,
5135,
74,
10354,
6,
16142,
22177,
140,
114,
16843,
21169,
15166,
12,
21727,
35072,
43666,
140,
114,
16843,
22177,
21727,
31583,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
1077,
2724,
2879,
10354,
6,
16142,
141,
230,
35072,
31583,
18849,
22177,
15166,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
65,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
65,
1313,
77,
896,
88,
10354,
6,
140,
109,
21169,
15166,
22177,
22177,
18849,
141,
228,
45035,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
8482,
893,
74,
10354,
6,
140,
109,
18849,
140,
117,
21727,
31583,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
66,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
2395,
306,
397,
35803,
10354,
6,
141,
229,
16843,
30143,
40623,
140,
109,
18849,
22177,
21727,
31583,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
67,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
68,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
11129,
21841,
305,
7757,
10354,
6,
141,
235,
30143,
16843,
31583,
20375,
21169,
15166,
21727,
20375,
16142,
30143,
45367,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
69,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
70,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
71,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
72,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
452,
415,
2959,
1990,
4914,
10354,
6,
18849,
38857,
16142,
22177,
20375,
16843,
16843,
38857,
31583,
16142,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
14232,
5500,
74,
10354,
6,
18849,
21169,
31583,
35072,
20375,
21727,
31583,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
13809,
18768,
10354,
6,
18849,
38857,
16142,
22177,
25443,
110,
15166,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
73,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
74,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
4106,
18657,
10354,
6,
31583,
18849,
21169,
25443,
110,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
74,
8847,
3919,
283,
1326,
893,
74,
10354,
6,
31583,
21169,
16142,
21727,
22177,
15166,
16142,
21169,
43108,
16843,
140,
117,
21727,
31583,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
74,
273,
3366,
709,
10354,
6,
31583,
15166,
21169,
25443,
119,
16843,
38857,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
74,
1077,
8704,
10354,
6,
31583,
16142,
141,
230,
18849,
21169,
16142,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
74,
1031,
272,
10354,
6,
31583,
16142,
140,
115,
16142,
22177,
45367,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
7204,
89,
258,
85,
17187,
18768,
10354,
6,
31583,
25443,
114,
16843,
38857,
22177,
18849,
31583,
25443,
110,
15166,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
74,
2815,
10354,
6,
31583,
30143,
18849,
22177,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
74,
2475,
709,
8135,
10354,
6,
31583,
30143,
18849,
43108,
25443,
110,
21727,
31583,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
74,
8847,
77,
375,
283,
10354,
6,
31583,
21169,
16142,
21727,
22177,
25443,
112,
16142,
21169,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
75,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
11925,
35803,
62,
74,
10277,
45938,
2584,
10354,
6,
30143,
16843,
22177,
18849,
22177,
21727,
31583,
12,
31583,
35072,
140,
115,
22177,
16843,
141,
228,
31583,
18849,
140,
117,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
76,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
16785,
8232,
10354,
6,
43108,
15166,
21727,
31583,
38857,
16142,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
1326,
23548,
67,
495,
29937,
74,
10354,
6,
43108,
16843,
140,
114,
43666,
35072,
21169,
16843,
141,
229,
16843,
22177,
21727,
31583,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
77,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
77,
18768,
2501,
592,
74,
10354,
6,
22177,
25443,
110,
15166,
16142,
30143,
20375,
16142,
140,
117,
21727,
31583,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
77,
528,
21116,
7745,
62,
37302,
7053,
375,
10354,
6,
22177,
18849,
140,
114,
22177,
18849,
140,
117,
12466,
121,
25443,
110,
140,
111,
15166,
21169,
25443,
112,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
78,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
482,
774,
397,
3808,
2584,
10354,
6,
25443,
118,
20375,
40623,
140,
109,
21169,
45367,
21727,
31583,
18849,
140,
117,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
29578,
7423,
10354,
6,
15166,
21169,
16843,
22177,
140,
109,
35072,
21169,
140,
111,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
79,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
33320,
349,
8135,
10354,
6,
140,
123,
25443,
112,
25443,
119,
45367,
21727,
31583,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
489,
615,
8135,
10354,
6,
140,
123,
30143,
16142,
38857,
21727,
31583,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
1676,
74,
11081,
1990,
8135,
10354,
6,
140,
123,
21169,
25443,
118,
25443,
123,
45367,
16843,
38857,
21727,
31583,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
80,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
81,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
859,
641,
74,
726,
68,
10354,
6,
21169,
16142,
43108,
16843,
22177,
21727,
31583,
15166,
16843,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
82,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
301,
62,
6449,
364,
7423,
10354,
6,
21727,
16142,
22177,
31583,
20375,
12,
140,
123,
16843,
20375,
16843,
21169,
140,
109,
35072,
21169,
140,
111,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
7364,
11729,
331,
45098,
10354,
6,
21727,
20375,
16142,
21169,
16142,
40623,
220,
141,
236,
21169,
140,
111,
16142,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
82,
332,
25404,
709,
20545,
88,
10354,
6,
21727,
38857,
16843,
21169,
43666,
30143,
25443,
110,
21727,
31583,
18849,
140,
117,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
83,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
83,
323,
4908,
10354,
6,
20375,
16142,
140,
117,
140,
111,
16142,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
83,
4712,
10354,
6,
20375,
35072,
30143,
16142,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
85,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
10396,
70,
519,
6335,
10354,
6,
38857,
25443,
119,
140,
111,
25443,
111,
21169,
16142,
43666,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
84,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
86,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
87,
10354,
1391,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
88,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
88,
283,
26388,
75,
10354,
6,
40623,
21169,
15166,
21727,
30143,
16142,
38857,
30143,
45367,
3256,
198,
220,
220,
220,
220,
220,
220,
705,
88,
988,
729,
259,
7423,
10354,
6,
16843,
31583,
16142,
20375,
16843,
21169,
18849,
22177,
140,
109,
35072,
21169,
140,
111,
3256,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
89,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
705,
23548,
2724,
709,
20545,
88,
10354,
6,
140,
114,
35072,
31583,
25443,
110,
21727,
31583,
18849,
140,
117,
3256,
198,
220,
220,
220,
8964,
198,
92,
198
] | 1.317945 | 1,343 |
import json
import os
from collections import OrderedDict
from itertools import count
from multiprocessing import cpu_count
from tempfile import TemporaryDirectory as InTemporaryDirectory
from types import MethodType
from joblib import Parallel, delayed
from checkpoint import __version__ as version
from checkpoint.crypt import Crypt, generate_key
from checkpoint.io import IO
from checkpoint.readers import get_all_readers
from checkpoint.utils import LogColors, Logger, get_reader_by_extension
class Sequence:
"""Class to represent a sequence of operations."""
def __init__(self, sequence_name, order_dict=None, logger=None, terminal_log=False):
"""Initialize the sequence class.
Parameters
----------
sequence_name: str
Name of the sequence.
order_dict: dict, optional
Dictionary of function names and their order in the sequence.
logger: `checkpoint.utils.Logger`, optional
Logger for the sequence class
log: bool, optional
If True, the sequence will be logged.
"""
self.terminal_log = terminal_log
self.log_mode = 't' if self.terminal_log else 'f'
self.logger = logger or Logger(log_mode=self.log_mode)
self.sequence_name = sequence_name
self.sequence_dict = OrderedDict()
self.order_dict = order_dict or {}
self._sequence_functions = self.sequence_dict.items()
self.sequence_functions = []
self.get_sequence_functions()
# User hook that is triggered when the sequence/sequence function has finished
self.on_sequence_end = lambda seq: None
self.on_sequence_function_end = lambda seq: None
def __repr__(self):
"""Return the string representation of the Sequence."""
_member_functions = [
_func.__name__ for _func in self.sequence_dict.values()]
return f'Name: {self.name}, Member Function: {_member_functions}'
def add_sequence_function(self, func, order=0):
"""Add a member function to the sequence.
Parameters
----------
func: method
Function that is to be added to the sequence.
order: int, optional
The order of the function in the sequence
"""
if not func.__name__.startswith('seq'):
raise ValueError('Function name must start with "seq"')
if order in self.sequence_dict:
_msg = f'Warning: overriting {self.sequence_dict[order].__name__} with {func.__name__}'
self.logger.log(
_msg, LogColors.WARNING, timestamp=True, log_caller=True, log_type="INFO")
self.sequence_dict[order] = func
def add_sub_sequence(self, sequence, order=0):
"""Add a sub sequence to the current sequence.
Parameter
---------
sequence: :class: `Sequence`
The sub sequence that is to be added
order: int, optional
The order of the sub sequence in the sequence
"""
if not isinstance(sequence, Sequence):
raise TypeError('Sub sequence must be of type Sequence')
_iterator = (count(start=order, step=1))
for func_obj in sequence.sequence_dict.items():
self.add_sequence_function(func_obj[1], order=next(_iterator))
def execute_sequence(self, execution_policy='decreasing_order', pass_args=False):
"""Execute all functions in the current sequence.
Parameters
----------
execution_policy: str
The policy to be followed while executing the functions.
Possible values are 'increasing_order' or 'decreasing_order'.
pass_args: bool
If True, the arguments of the executed function will be passed to the next function.
"""
self.update_order()
_return_values = []
if execution_policy == 'decreasing_order':
_sorted_sequence = sorted(self.sequence_dict.items(), reverse=True)
for func_obj in _sorted_sequence:
context_text = func_obj[1].__name__.split(
'seq_')[-1].replace('_', ' ').title()
try:
if pass_args:
if len(_return_values) > 0:
_return_value = func_obj[1](_return_values[-1])
else:
_return_value = func_obj[1]()
else:
_return_value = func_obj[1]()
except Exception as e:
_msg = f'{context_text}'
self.logger.log(
_msg, [LogColors.ERROR, LogColors.UNDERLINE],
timestamp=True, log_type="ERROR")
raise type(e)(f'{context_text} failed with error: {e}')
_msg = f'{context_text}'
self.logger.log(
_msg, [LogColors.SUCCESS, LogColors.UNDERLINE],
timestamp=True, log_type="SUCCESS")
self.on_sequence_function_end(self)
_return_values.append(_return_value)
self.on_sequence_end(self)
elif execution_policy == 'increasing_order':
for _, func in self.sequence_dict.items():
if pass_args:
_return_value = func(_return_values[-1])
else:
_return_value = func()
_return_values.append(_return_value)
self.on_sequence_end(self)
else:
raise ValueError(
f'{execution_policy} is an invalid execution policy')
return _return_values
def update_order(self):
"""Update the order of sequence functions in sequence dict."""
self.sequence_dict = OrderedDict(sorted(self.sequence_dict.items()))
def flush_sequence(self):
"""Flush the sequence."""
self.sequence_dict.clear()
def get_sequence_functions(self):
"""Get all the sequence functions."""
self.sequence_functions.clear()
for name in dir(self):
if name.startswith('seq') and isinstance(getattr(self, name), MethodType):
_func = getattr(self, name)
if name not in self.order_dict:
self.order_dict[name] = len(self.sequence_functions)
self.sequence_functions.append(_func)
self.generate_sequence()
def generate_sequence(self):
"""Generate a sequence from all memeber functions."""
for func in self.sequence_functions:
_name = func.__name__
_order = self.order_dict[_name]
self.add_sequence_function(func, _order)
@property
@property
@sequence_functions.setter
def sequence_functions(self, functions):
"""Set the value of sequence functions to a list.
Parameters
----------
functions: list of methods
List of methods that are to be assigned
"""
self._sequence_functions = functions[:]
class IOSequence(Sequence):
"""Class to represent a sequence of IO operations."""
def __init__(self, sequence_name='IO_Sequence', order_dict=None,
root_dir=None, ignore_dirs=None, num_cores=None,
terminal_log=False):
"""Initialize the IO sequence class.
Default execution sequence is:
1. Walk through the root directory
2. Group files by extension
3. Map readers based on extension
4. Read files
5. Encrypt the files
Parameters
----------
sequence_name: str
Name of the sequence.
order_dict: dict, optional
Dictionary of function names and their order in the sequence.
root_dir: str, optional
The root directory.
ignore_dirs: list of str, optional
List of directories to be ignored.
num_cores: int, optional
Number of cores to be used for parallel processing.
terminal_log: bool, optional
If True, messages will be logged to the terminal
"""
self.default_order_dict = {
'seq_walk_directories': 4,
'seq_group_files': 3,
'seq_map_readers': 2,
'seq_read_files': 1,
'seq_encrypt_files': 0,
}
super(IOSequence, self).__init__(sequence_name,
order_dict or self.default_order_dict,
terminal_log=terminal_log)
self.root_dir = root_dir or os.getcwd()
self.ignore_dirs = ignore_dirs or []
self.ignore_dirs.append('.checkpoint')
self.io = IO(self.root_dir, ignore_dirs=self.ignore_dirs)
self.num_cores = num_cores or cpu_count()
def seq_walk_directories(self):
"""Walk through all directories in the root directory.
Parameters
----------
root_directory: str
The root directory to be walked through.
"""
directory2files = {}
for root, file in self.io.walk_directory():
if root in directory2files:
directory2files[root].append(os.path.join(root, file))
else:
directory2files[root] = [os.path.join(root, file)]
return directory2files
def seq_group_files(self, directory2files):
"""Group files in the same directory.
Parameters
----------
directory2files: dict
Dictionary of directory names and their files.
"""
extensions_dict = {}
for files in directory2files.items():
for file in files[1]:
base_file = os.path.basename(file)
extension = base_file.split('.')[-1].lower()
if extension not in extensions_dict:
extensions_dict[extension] = [file]
else:
extensions_dict[extension].append(file)
return extensions_dict
def seq_map_readers(self, extensions_dict):
"""Map the extensions to their respective Readers.
Parameters
----------
extensions_dict: dict
Dictionary of extensions and their files.
Returns
-------
dict
Dictionary of extensions and their Readers.
"""
_readers = {}
unavailabe_extensions = []
for extension, _ in extensions_dict.items():
_readers[extension] = get_reader_by_extension(extension)
if not _readers[extension]:
all_readers = get_all_readers()
with InTemporaryDirectory() as temp_dir:
temp_file = os.path.join(temp_dir, f'temp.{extension}')
self.io.write(temp_file, 'w+', 'test content')
selected_reader = None
for reader in all_readers:
try:
_msg = f'Trying {reader.__name__} for extension {extension}'
self.logger.log(
_msg, colors=LogColors.BOLD, log_caller=True, log_type="INFO")
reader = reader()
reader.read(temp_file, validate=False)
selected_reader = reader
except Exception:
selected_reader = None
continue
if selected_reader:
_msg = f'{selected_reader.__class__.__name__} selected'
self.logger.log(
_msg, colors=LogColors.SUCCESS, timestamp=True, log_type="SUCCESS")
_readers[extension] = selected_reader
else:
unavailabe_extensions.append(extension)
del _readers[extension]
self.logger.log(
f'No reader found for extension {extension}, skipping',
colors=LogColors.ERROR, log_caller=True, log_type="ERROR")
for extension in unavailabe_extensions:
del extensions_dict[extension]
return [_readers, extensions_dict]
def seq_read_files(self, readers_extension):
"""Read the gathered files using their respective reader.
Parameters
----------
readers_extension: list
Readers dict and extensions dict packed in a list.
Returns
-------
dict
Dictionary of files and their content.
"""
readers_dict, extension_dict = readers_extension
contents = \
Parallel(self.num_cores)(delayed(readers_dict[ext].read)(files,
validate=False) for (ext, files) in
extension_dict.items())
return contents
def seq_encrypt_files(self, contents):
"""Encrypt the read files.
Parameters
----------
contents: dict
Dictionary of file paths and their content.
Returns
-------
dict
Dictionary of file paths and their encrypted content.
"""
# TODO: Parallelize this
path2content = {}
crypt_obj = Crypt(key='crypt.key', key_path=os.path.join(
self.root_dir, '.checkpoint'))
for content in contents:
for obj in content:
path = list(obj.keys())[0]
path2content[path] = crypt_obj.encrypt(path)
return path2content
class CheckpointSequence(Sequence):
"""Sequence to perform checkpoint operations."""
def __init__(self, sequence_name, order_dict, root_dir, ignore_dirs,
terminal_log=False):
"""Initialize the CheckpointSequence class.
Parameters
----------
sequence_name: str
Name of the sequence.
order_dict: dict
Dictionary of function names and their order in the sequence.
root_dir: str
The root directory.
ignore_dirs: list of str
List of directories to be ignored.
terminal_log: bool, optional
If True, messages will be logged to the terminal
"""
self.sequence_name = sequence_name
self.order_dict = order_dict
self.root_dir = root_dir
self.ignore_dirs = ignore_dirs
super(CheckpointSequence, self).__init__(sequence_name, order_dict,
terminal_log=terminal_log)
def _validate_checkpoint(self):
"""Validate if a checkpoint is valid."""
checkpoint_path = os.path.join(self.root_dir, '.checkpoint', self.sequence_name)
if not os.path.isdir(checkpoint_path):
raise ValueError(f'Checkpoint {self.sequence_name} does not exist')
def seq_init_checkpoint(self):
"""Initialize the checkpoint directory."""
_io = IO(path=self.root_dir, mode="a",
ignore_dirs=self.ignore_dirs)
path = _io.make_dir('.checkpoint')
generate_key('crypt.key', path)
checkpoint_config = {
'current_checkpoint': None,
'checkpoints': [],
'ignore_dirs': self.ignore_dirs,
'root_dir': self.root_dir,
}
config_path = os.path.join(self.root_dir, '.checkpoint', '.config')
_io.write(config_path, 'w+', json.dumps(checkpoint_config))
def seq_create_checkpoint(self):
"""Create a new checkpoint for the target directory."""
checkpoint_path = os.path.join(self.root_dir, '.checkpoint', self.sequence_name)
if os.path.isdir(checkpoint_path):
raise ValueError(f'Checkpoint {self.sequence_name} already exists')
_io = IO(path=self.root_dir, mode="a",
ignore_dirs=self.ignore_dirs)
_io_sequence = IOSequence(root_dir=self.root_dir,
ignore_dirs=self.ignore_dirs,
terminal_log=self.terminal_log)
enc_files = _io_sequence.execute_sequence(pass_args=True)[-1]
checkpoint_path = os.path.join(
self.root_dir, '.checkpoint', self.sequence_name)
checkpoint_path = _io.make_dir(checkpoint_path)
checkpoint_file_path = os.path.join(
checkpoint_path, f'{self.sequence_name}.json')
config_path = os.path.join(self.root_dir, '.checkpoint', '.config')
with open(checkpoint_file_path, 'w+') as checkpoint_file:
json.dump(enc_files, checkpoint_file, indent=4)
with open(config_path, 'r') as config_file:
checkpoint_config = json.load(config_file)
checkpoint_config['checkpoints'].append(self.sequence_name)
checkpoint_config['current_checkpoint'] = self.sequence_name
with open(config_path, 'w+') as config_file:
json.dump(checkpoint_config, config_file, indent=4)
root2file = {}
for root, file in _io.walk_directory():
if root in root2file:
root2file[root].append(os.path.join(root, file))
else:
root2file[root] = [os.path.join(root, file)]
with open(os.path.join(checkpoint_path, '.metadata'), 'w+') as metadata_file:
json.dump(root2file, metadata_file, indent=4)
def seq_delete_checkpoint(self):
"""Delete the checkpoint for the target directory."""
self._validate_checkpoint()
_io = IO(path=self.root_dir, mode="a",
ignore_dirs=self.ignore_dirs)
checkpoint_path = os.path.join(
self.root_dir, '.checkpoint', self.sequence_name)
config_path = os.path.join(self.root_dir, '.checkpoint', '.config')
with open(config_path, 'r') as config_file:
checkpoint_config = json.load(config_file)
checkpoint_config['checkpoints'].remove(self.sequence_name)
if len(checkpoint_config['checkpoints']):
_new_current_checkpoint = checkpoint_config['checkpoints'][-1]
else:
_new_current_checkpoint = None
checkpoint_config['current_checkpoint'] = _new_current_checkpoint
with open(config_path, 'w+') as config_file:
json.dump(checkpoint_config, config_file, indent=4)
_io.delete_dir(checkpoint_path)
def seq_restore_checkpoint(self):
"""Restore back to a specific checkpoint."""
self._validate_checkpoint()
_io = IO(path=self.root_dir, mode="a",
ignore_dirs=self.ignore_dirs)
_key = os.path.join(self.root_dir, '.checkpoint')
crypt = Crypt(key='crypt.key', key_path=_key)
checkpoint_path = os.path.join(self.root_dir, '.checkpoint',
self.sequence_name, f'{self.sequence_name}.json')
config_path = os.path.join(self.root_dir, '.checkpoint', '.config')
with open(checkpoint_path, 'r') as checkpoint_file:
checkpoint_dict = json.load(checkpoint_file)
with open(config_path, 'r') as config_file:
checkpoint_config = json.load(config_file)
checkpoint_config['current_checkpoint'] = self.sequence_name
with open(config_path, 'w+') as config_file:
json.dump(checkpoint_config, config_file, indent=4)
for file, content in checkpoint_dict.items():
content = crypt.decrypt(content)
_io.write(file, 'wb+', content)
def seq_version(self):
"""Print the version of the sequence."""
_msg = f'Running version {version}'
self.logger.log(_msg, timestamp=True, log_type="INFO")
class CLISequence(Sequence):
"""Sequence for the CLI environment."""
def __init__(self, sequence_name='CLI_Sequence', order_dict=None,
arg_parser=None, args=None, terminal_log=False):
"""Initialize the CLISequence class.
Default execution sequence is:
1. Parse the arguments.
2. Determine the action to perform from the arguments.
3. Perform the action.
Parameters
----------
sequence_name: str
Name of the sequence.
order_dict: dict
Dictionary of the order of the functions in the sequence.
arg_parser: ArgumentParser
Argument parser for the CLI.
"""
self.default_order_dict = {
'seq_parse_args': 2,
'seq_determine_action': 1,
'seq_perform_action': 0,
}
self.args = args
self.arg_parser = arg_parser
super(CLISequence, self).__init__(sequence_name=sequence_name,
order_dict=order_dict or self.default_order_dict,
terminal_log=terminal_log)
def seq_parse_args(self):
"""Parse the arguments from the CLI."""
if self.args is None:
args = self.arg_parser.parse_args()
else:
args = self.arg_parser.parse_args(self.args)
return args
def seq_determine_action(self, args):
"""Determine the action to be performed.
Parameters
----------
args: ArgumentParser
Parsed arguments from the CLI.
"""
if args.action == 'create':
action = 'seq_create_checkpoint'
elif args.action == 'restore':
action = 'seq_restore_checkpoint'
elif args.action == 'delete':
action = 'seq_delete_checkpoint'
elif args.action == 'init':
action = 'seq_init_checkpoint'
elif args.action == 'version':
action = 'seq_version'
else:
raise ValueError('Invalid action.')
return [action, args]
def seq_perform_action(self, action_args):
"""Perform the action.
Parameters
----------
action_args: list
List containing action and args NameSpace.
"""
action, args = action_args
_name = args.name
_path = args.path
_ignore_dirs = args.ignore_dirs or []
_helper_actions = ['seq_init_checkpoint', 'seq_version']
if not (_name and _path) and action not in _helper_actions:
raise ValueError(f'{args.action} requires a valid name and a path')
order_dict = {action: 0}
_checkpoint_sequence = CheckpointSequence(
_name, order_dict, _path, _ignore_dirs,
terminal_log=self.terminal_log)
action_function = getattr(_checkpoint_sequence, action)
action_function()
| [
11748,
33918,
198,
11748,
28686,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
6738,
340,
861,
10141,
1330,
954,
198,
6738,
18540,
305,
919,
278,
1330,
42804,
62,
9127,
198,
6738,
20218,
7753,
1330,
46042,
43055,
355,
554,
12966,
5551,
43055,
198,
6738,
3858,
1330,
11789,
6030,
198,
198,
6738,
1693,
8019,
1330,
42945,
11,
11038,
198,
198,
6738,
26954,
1330,
11593,
9641,
834,
355,
2196,
198,
6738,
26954,
13,
29609,
1330,
15126,
11,
7716,
62,
2539,
198,
6738,
26954,
13,
952,
1330,
24418,
198,
6738,
26954,
13,
961,
364,
1330,
651,
62,
439,
62,
961,
364,
198,
6738,
26954,
13,
26791,
1330,
5972,
5216,
669,
11,
5972,
1362,
11,
651,
62,
46862,
62,
1525,
62,
2302,
3004,
628,
198,
4871,
45835,
25,
198,
220,
220,
220,
37227,
9487,
284,
2380,
257,
8379,
286,
4560,
526,
15931,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
8379,
62,
3672,
11,
1502,
62,
11600,
28,
14202,
11,
49706,
28,
14202,
11,
12094,
62,
6404,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
262,
8379,
1398,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
8379,
62,
3672,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6530,
286,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1502,
62,
11600,
25,
8633,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
2163,
3891,
290,
511,
1502,
287,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
25,
4600,
9122,
4122,
13,
26791,
13,
11187,
1362,
47671,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5972,
1362,
329,
262,
8379,
1398,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
25,
20512,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1002,
6407,
11,
262,
8379,
481,
307,
18832,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
23705,
282,
62,
6404,
796,
12094,
62,
6404,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
62,
14171,
796,
705,
83,
6,
611,
2116,
13,
23705,
282,
62,
6404,
2073,
705,
69,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
1362,
796,
49706,
393,
5972,
1362,
7,
6404,
62,
14171,
28,
944,
13,
6404,
62,
14171,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
3672,
796,
8379,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
11600,
796,
14230,
1068,
35,
713,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2875,
62,
11600,
796,
1502,
62,
11600,
393,
23884,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
43167,
62,
12543,
2733,
796,
2116,
13,
43167,
62,
11600,
13,
23814,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
12543,
2733,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1136,
62,
43167,
62,
12543,
2733,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
11787,
8011,
326,
318,
13973,
618,
262,
8379,
14,
43167,
2163,
468,
5201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
261,
62,
43167,
62,
437,
796,
37456,
33756,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
261,
62,
43167,
62,
8818,
62,
437,
796,
37456,
33756,
25,
6045,
628,
220,
220,
220,
825,
11593,
260,
1050,
834,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
262,
4731,
10552,
286,
262,
45835,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
19522,
62,
12543,
2733,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
20786,
13,
834,
3672,
834,
329,
4808,
20786,
287,
2116,
13,
43167,
62,
11600,
13,
27160,
3419,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
277,
6,
5376,
25,
1391,
944,
13,
3672,
5512,
10239,
15553,
25,
1391,
62,
19522,
62,
12543,
2733,
92,
6,
628,
220,
220,
220,
825,
751,
62,
43167,
62,
8818,
7,
944,
11,
25439,
11,
1502,
28,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
4550,
257,
2888,
2163,
284,
262,
8379,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
25439,
25,
2446,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15553,
326,
318,
284,
307,
2087,
284,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1502,
25,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
1502,
286,
262,
2163,
287,
262,
8379,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
25439,
13,
834,
3672,
834,
13,
9688,
2032,
342,
10786,
41068,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
22203,
1438,
1276,
923,
351,
366,
41068,
1,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
611,
1502,
287,
2116,
13,
43167,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
796,
277,
6,
20361,
25,
625,
799,
278,
1391,
944,
13,
43167,
62,
11600,
58,
2875,
4083,
834,
3672,
834,
92,
351,
1391,
20786,
13,
834,
3672,
834,
92,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
1362,
13,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
11,
5972,
5216,
669,
13,
31502,
11,
41033,
28,
17821,
11,
2604,
62,
13345,
263,
28,
17821,
11,
2604,
62,
4906,
2625,
10778,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
11600,
58,
2875,
60,
796,
25439,
628,
220,
220,
220,
825,
751,
62,
7266,
62,
43167,
7,
944,
11,
8379,
11,
1502,
28,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
4550,
257,
850,
8379,
284,
262,
1459,
8379,
13,
628,
220,
220,
220,
220,
220,
220,
220,
25139,
2357,
198,
220,
220,
220,
220,
220,
220,
220,
45337,
198,
220,
220,
220,
220,
220,
220,
220,
8379,
25,
1058,
4871,
25,
4600,
44015,
594,
63,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
850,
8379,
326,
318,
284,
307,
2087,
198,
220,
220,
220,
220,
220,
220,
220,
1502,
25,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
1502,
286,
262,
850,
8379,
287,
262,
8379,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
43167,
11,
45835,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5994,
12331,
10786,
7004,
8379,
1276,
307,
286,
2099,
45835,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
4808,
48727,
796,
357,
9127,
7,
9688,
28,
2875,
11,
2239,
28,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
329,
25439,
62,
26801,
287,
8379,
13,
43167,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2860,
62,
43167,
62,
8818,
7,
20786,
62,
26801,
58,
16,
4357,
1502,
28,
19545,
28264,
48727,
4008,
628,
220,
220,
220,
825,
12260,
62,
43167,
7,
944,
11,
9706,
62,
30586,
11639,
12501,
260,
2313,
62,
2875,
3256,
1208,
62,
22046,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
23002,
1133,
477,
5499,
287,
262,
1459,
8379,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
9706,
62,
30586,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
2450,
284,
307,
3940,
981,
23710,
262,
5499,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33671,
3815,
389,
705,
42647,
62,
2875,
6,
393,
705,
12501,
260,
2313,
62,
2875,
4458,
198,
220,
220,
220,
220,
220,
220,
220,
1208,
62,
22046,
25,
20512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1002,
6407,
11,
262,
7159,
286,
262,
10945,
2163,
481,
307,
3804,
284,
262,
1306,
2163,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
19119,
62,
2875,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
27160,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
611,
9706,
62,
30586,
6624,
705,
12501,
260,
2313,
62,
2875,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
82,
9741,
62,
43167,
796,
23243,
7,
944,
13,
43167,
62,
11600,
13,
23814,
22784,
9575,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
25439,
62,
26801,
287,
4808,
82,
9741,
62,
43167,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4732,
62,
5239,
796,
25439,
62,
26801,
58,
16,
4083,
834,
3672,
834,
13,
35312,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
11537,
58,
12,
16,
4083,
33491,
10786,
62,
3256,
705,
705,
737,
7839,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1208,
62,
22046,
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,
611,
18896,
28264,
7783,
62,
27160,
8,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
8367,
796,
25439,
62,
26801,
58,
16,
16151,
62,
7783,
62,
27160,
58,
12,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
8367,
796,
25439,
62,
26801,
58,
16,
60,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
8367,
796,
25439,
62,
26801,
58,
16,
60,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
796,
277,
6,
90,
22866,
62,
5239,
92,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
1362,
13,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
11,
685,
11187,
5216,
669,
13,
24908,
11,
5972,
5216,
669,
13,
4944,
14418,
24027,
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,
41033,
28,
17821,
11,
2604,
62,
4906,
2625,
24908,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
2099,
7,
68,
5769,
69,
6,
90,
22866,
62,
5239,
92,
4054,
351,
4049,
25,
1391,
68,
92,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
796,
277,
6,
90,
22866,
62,
5239,
92,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
1362,
13,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
11,
685,
11187,
5216,
669,
13,
12564,
4093,
7597,
11,
5972,
5216,
669,
13,
4944,
14418,
24027,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41033,
28,
17821,
11,
2604,
62,
4906,
2625,
12564,
4093,
7597,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
261,
62,
43167,
62,
8818,
62,
437,
7,
944,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
27160,
13,
33295,
28264,
7783,
62,
8367,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
261,
62,
43167,
62,
437,
7,
944,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
9706,
62,
30586,
6624,
705,
42647,
62,
2875,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
4808,
11,
25439,
287,
2116,
13,
43167,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1208,
62,
22046,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
8367,
796,
25439,
28264,
7783,
62,
27160,
58,
12,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
8367,
796,
25439,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
7783,
62,
27160,
13,
33295,
28264,
7783,
62,
8367,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
261,
62,
43167,
62,
437,
7,
944,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
6,
90,
18558,
1009,
62,
30586,
92,
318,
281,
12515,
9706,
2450,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4808,
7783,
62,
27160,
628,
220,
220,
220,
825,
4296,
62,
2875,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
10260,
262,
1502,
286,
8379,
5499,
287,
8379,
8633,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
11600,
796,
14230,
1068,
35,
713,
7,
82,
9741,
7,
944,
13,
43167,
62,
11600,
13,
23814,
3419,
4008,
628,
220,
220,
220,
825,
24773,
62,
43167,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7414,
1530,
262,
8379,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
11600,
13,
20063,
3419,
628,
220,
220,
220,
825,
651,
62,
43167,
62,
12543,
2733,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
477,
262,
8379,
5499,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
12543,
2733,
13,
20063,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
329,
1438,
287,
26672,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1438,
13,
9688,
2032,
342,
10786,
41068,
11537,
290,
318,
39098,
7,
1136,
35226,
7,
944,
11,
1438,
828,
11789,
6030,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
20786,
796,
651,
35226,
7,
944,
11,
1438,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1438,
407,
287,
2116,
13,
2875,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2875,
62,
11600,
58,
3672,
60,
796,
18896,
7,
944,
13,
43167,
62,
12543,
2733,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
12543,
2733,
13,
33295,
28264,
20786,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
8612,
378,
62,
43167,
3419,
628,
220,
220,
220,
825,
7716,
62,
43167,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
8645,
378,
257,
8379,
422,
477,
25336,
527,
5499,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
329,
25439,
287,
2116,
13,
43167,
62,
12543,
2733,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
3672,
796,
25439,
13,
834,
3672,
834,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
2875,
796,
2116,
13,
2875,
62,
11600,
29795,
3672,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2860,
62,
43167,
62,
8818,
7,
20786,
11,
4808,
2875,
8,
628,
220,
220,
220,
2488,
26745,
628,
220,
220,
220,
2488,
26745,
628,
220,
220,
220,
2488,
43167,
62,
12543,
2733,
13,
2617,
353,
198,
220,
220,
220,
825,
8379,
62,
12543,
2733,
7,
944,
11,
5499,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
262,
1988,
286,
8379,
5499,
284,
257,
1351,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
5499,
25,
1351,
286,
5050,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
5050,
326,
389,
284,
307,
8686,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
43167,
62,
12543,
2733,
796,
5499,
58,
47715,
628,
198,
4871,
314,
2640,
4853,
594,
7,
44015,
594,
2599,
198,
220,
220,
220,
37227,
9487,
284,
2380,
257,
8379,
286,
24418,
4560,
526,
15931,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
8379,
62,
3672,
11639,
9399,
62,
44015,
594,
3256,
1502,
62,
11600,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6808,
62,
15908,
28,
14202,
11,
8856,
62,
15908,
82,
28,
14202,
11,
997,
62,
66,
2850,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12094,
62,
6404,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
262,
24418,
8379,
1398,
13,
628,
220,
220,
220,
220,
220,
220,
220,
15161,
9706,
8379,
318,
25,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
6857,
832,
262,
6808,
8619,
198,
220,
220,
220,
220,
220,
220,
220,
362,
13,
4912,
3696,
416,
7552,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
9347,
7183,
1912,
319,
7552,
198,
220,
220,
220,
220,
220,
220,
220,
604,
13,
4149,
3696,
198,
220,
220,
220,
220,
220,
220,
220,
642,
13,
14711,
6012,
262,
3696,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
8379,
62,
3672,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6530,
286,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1502,
62,
11600,
25,
8633,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
2163,
3891,
290,
511,
1502,
287,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
6808,
62,
15908,
25,
965,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
6808,
8619,
13,
198,
220,
220,
220,
220,
220,
220,
220,
8856,
62,
15908,
82,
25,
1351,
286,
965,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
29196,
284,
307,
9514,
13,
198,
220,
220,
220,
220,
220,
220,
220,
997,
62,
66,
2850,
25,
493,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7913,
286,
21758,
284,
307,
973,
329,
10730,
7587,
13,
198,
220,
220,
220,
220,
220,
220,
220,
12094,
62,
6404,
25,
20512,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1002,
6407,
11,
6218,
481,
307,
18832,
284,
262,
12094,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
12286,
62,
2875,
62,
11600,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
11152,
62,
12942,
1749,
10354,
604,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
8094,
62,
16624,
10354,
513,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
8899,
62,
961,
364,
10354,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
961,
62,
16624,
10354,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
12685,
6012,
62,
16624,
10354,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
40,
2640,
4853,
594,
11,
2116,
737,
834,
15003,
834,
7,
43167,
62,
3672,
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,
1502,
62,
11600,
393,
2116,
13,
12286,
62,
2875,
62,
11600,
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,
12094,
62,
6404,
28,
23705,
282,
62,
6404,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15763,
62,
15908,
796,
6808,
62,
15908,
393,
28686,
13,
1136,
66,
16993,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
46430,
62,
15908,
82,
796,
8856,
62,
15908,
82,
393,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
46430,
62,
15908,
82,
13,
33295,
7,
4458,
9122,
4122,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
952,
796,
24418,
7,
944,
13,
15763,
62,
15908,
11,
8856,
62,
15908,
82,
28,
944,
13,
46430,
62,
15908,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22510,
62,
66,
2850,
796,
997,
62,
66,
2850,
393,
42804,
62,
9127,
3419,
628,
220,
220,
220,
825,
33756,
62,
11152,
62,
12942,
1749,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
35963,
832,
477,
29196,
287,
262,
6808,
8619,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
6808,
62,
34945,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
6808,
8619,
284,
307,
6807,
832,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8619,
17,
16624,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
329,
6808,
11,
2393,
287,
2116,
13,
952,
13,
11152,
62,
34945,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6808,
287,
8619,
17,
16624,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8619,
17,
16624,
58,
15763,
4083,
33295,
7,
418,
13,
6978,
13,
22179,
7,
15763,
11,
2393,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8619,
17,
16624,
58,
15763,
60,
796,
685,
418,
13,
6978,
13,
22179,
7,
15763,
11,
2393,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
8619,
17,
16624,
628,
220,
220,
220,
825,
33756,
62,
8094,
62,
16624,
7,
944,
11,
8619,
17,
16624,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13247,
3696,
287,
262,
976,
8619,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
8619,
17,
16624,
25,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
8619,
3891,
290,
511,
3696,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
18366,
62,
11600,
796,
23884,
628,
220,
220,
220,
220,
220,
220,
220,
329,
3696,
287,
8619,
17,
16624,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2393,
287,
3696,
58,
16,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2779,
62,
7753,
796,
28686,
13,
6978,
13,
12093,
12453,
7,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7552,
796,
2779,
62,
7753,
13,
35312,
10786,
2637,
38381,
12,
16,
4083,
21037,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
7552,
407,
287,
18366,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18366,
62,
11600,
58,
2302,
3004,
60,
796,
685,
7753,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18366,
62,
11600,
58,
2302,
3004,
4083,
33295,
7,
7753,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
18366,
62,
11600,
628,
220,
220,
220,
825,
33756,
62,
8899,
62,
961,
364,
7,
944,
11,
18366,
62,
11600,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13912,
262,
18366,
284,
511,
11756,
41969,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
18366,
62,
11600,
25,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
18366,
290,
511,
3696,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
18366,
290,
511,
41969,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
961,
364,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
555,
615,
603,
11231,
62,
2302,
5736,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
7552,
11,
4808,
287,
18366,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
961,
364,
58,
2302,
3004,
60,
796,
651,
62,
46862,
62,
1525,
62,
2302,
3004,
7,
2302,
3004,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
4808,
961,
364,
58,
2302,
3004,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
477,
62,
961,
364,
796,
651,
62,
439,
62,
961,
364,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
554,
12966,
5551,
43055,
3419,
355,
20218,
62,
15908,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
7753,
796,
28686,
13,
6978,
13,
22179,
7,
29510,
62,
15908,
11,
277,
470,
45787,
13,
90,
2302,
3004,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
952,
13,
13564,
7,
29510,
62,
7753,
11,
705,
86,
10,
3256,
705,
9288,
2695,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6163,
62,
46862,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
9173,
287,
477,
62,
961,
364,
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,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
796,
277,
6,
51,
14992,
1391,
46862,
13,
834,
3672,
834,
92,
329,
7552,
1391,
2302,
3004,
92,
6,
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,
2116,
13,
6404,
1362,
13,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
11,
7577,
28,
11187,
5216,
669,
13,
33,
15173,
11,
2604,
62,
13345,
263,
28,
17821,
11,
2604,
62,
4906,
2625,
10778,
4943,
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,
9173,
796,
9173,
3419,
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,
9173,
13,
961,
7,
29510,
62,
7753,
11,
26571,
28,
25101,
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,
6163,
62,
46862,
796,
9173,
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,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6163,
62,
46862,
796,
6045,
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,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6163,
62,
46862,
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,
4808,
19662,
796,
277,
6,
90,
34213,
62,
46862,
13,
834,
4871,
834,
13,
834,
3672,
834,
92,
6163,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
1362,
13,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
11,
7577,
28,
11187,
5216,
669,
13,
12564,
4093,
7597,
11,
41033,
28,
17821,
11,
2604,
62,
4906,
2625,
12564,
4093,
7597,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
961,
364,
58,
2302,
3004,
60,
796,
6163,
62,
46862,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
555,
615,
603,
11231,
62,
2302,
5736,
13,
33295,
7,
2302,
3004,
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,
1619,
4808,
961,
364,
58,
2302,
3004,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
1362,
13,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
6,
2949,
9173,
1043,
329,
7552,
1391,
2302,
3004,
5512,
31017,
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,
7577,
28,
11187,
5216,
669,
13,
24908,
11,
2604,
62,
13345,
263,
28,
17821,
11,
2604,
62,
4906,
2625,
24908,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
329,
7552,
287,
555,
615,
603,
11231,
62,
2302,
5736,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1619,
18366,
62,
11600,
58,
2302,
3004,
60,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
62,
961,
364,
11,
18366,
62,
11600,
60,
628,
220,
220,
220,
825,
33756,
62,
961,
62,
16624,
7,
944,
11,
7183,
62,
2302,
3004,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5569,
262,
9272,
3696,
1262,
511,
11756,
9173,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
7183,
62,
2302,
3004,
25,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41969,
8633,
290,
18366,
8633,
11856,
287,
257,
1351,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
3696,
290,
511,
2695,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
7183,
62,
11600,
11,
7552,
62,
11600,
796,
7183,
62,
2302,
3004,
628,
220,
220,
220,
220,
220,
220,
220,
10154,
796,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42945,
7,
944,
13,
22510,
62,
66,
2850,
5769,
12381,
16548,
7,
961,
364,
62,
11600,
58,
2302,
4083,
961,
5769,
16624,
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,
26571,
28,
25101,
8,
329,
357,
2302,
11,
3696,
8,
287,
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,
7552,
62,
11600,
13,
23814,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10154,
628,
220,
220,
220,
825,
33756,
62,
12685,
6012,
62,
16624,
7,
944,
11,
10154,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
27195,
6012,
262,
1100,
3696,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
10154,
25,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
2393,
13532,
290,
511,
2695,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
2393,
13532,
290,
511,
19365,
2695,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
25,
42945,
1096,
428,
198,
220,
220,
220,
220,
220,
220,
220,
3108,
17,
11299,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
8194,
62,
26801,
796,
15126,
7,
2539,
11639,
29609,
13,
2539,
3256,
1994,
62,
6978,
28,
418,
13,
6978,
13,
22179,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
6,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
329,
2695,
287,
10154,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
26181,
287,
2695,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3108,
796,
1351,
7,
26801,
13,
13083,
28955,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3108,
17,
11299,
58,
6978,
60,
796,
8194,
62,
26801,
13,
12685,
6012,
7,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
3108,
17,
11299,
628,
198,
4871,
6822,
4122,
44015,
594,
7,
44015,
594,
2599,
198,
220,
220,
220,
37227,
44015,
594,
284,
1620,
26954,
4560,
526,
15931,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
8379,
62,
3672,
11,
1502,
62,
11600,
11,
6808,
62,
15908,
11,
8856,
62,
15908,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12094,
62,
6404,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
262,
6822,
4122,
44015,
594,
1398,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
8379,
62,
3672,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6530,
286,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1502,
62,
11600,
25,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
2163,
3891,
290,
511,
1502,
287,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
6808,
62,
15908,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
6808,
8619,
13,
198,
220,
220,
220,
220,
220,
220,
220,
8856,
62,
15908,
82,
25,
1351,
286,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
29196,
284,
307,
9514,
13,
198,
220,
220,
220,
220,
220,
220,
220,
12094,
62,
6404,
25,
20512,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1002,
6407,
11,
6218,
481,
307,
18832,
284,
262,
12094,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
3672,
796,
8379,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2875,
62,
11600,
796,
1502,
62,
11600,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15763,
62,
15908,
796,
6808,
62,
15908,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
46430,
62,
15908,
82,
796,
8856,
62,
15908,
82,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
9787,
4122,
44015,
594,
11,
2116,
737,
834,
15003,
834,
7,
43167,
62,
3672,
11,
1502,
62,
11600,
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,
12094,
62,
6404,
28,
23705,
282,
62,
6404,
8,
628,
220,
220,
220,
825,
4808,
12102,
378,
62,
9122,
4122,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7762,
20540,
611,
257,
26954,
318,
4938,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
2116,
13,
43167,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
9409,
343,
7,
9122,
4122,
62,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
69,
6,
9787,
4122,
1391,
944,
13,
43167,
62,
3672,
92,
857,
407,
2152,
11537,
628,
198,
220,
220,
220,
825,
33756,
62,
15003,
62,
9122,
4122,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
262,
26954,
8619,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
796,
24418,
7,
6978,
28,
944,
13,
15763,
62,
15908,
11,
4235,
2625,
64,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8856,
62,
15908,
82,
28,
944,
13,
46430,
62,
15908,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3108,
796,
4808,
952,
13,
15883,
62,
15908,
7,
4458,
9122,
4122,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
7716,
62,
2539,
10786,
29609,
13,
2539,
3256,
3108,
8,
628,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14421,
62,
9122,
4122,
10354,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
9122,
13033,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
46430,
62,
15908,
82,
10354,
2116,
13,
46430,
62,
15908,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
15763,
62,
15908,
10354,
2116,
13,
15763,
62,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
220,
220,
220,
220,
220,
220,
220,
4566,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
45302,
11250,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
13,
13564,
7,
11250,
62,
6978,
11,
705,
86,
10,
3256,
33918,
13,
67,
8142,
7,
9122,
4122,
62,
11250,
4008,
628,
198,
220,
220,
220,
825,
33756,
62,
17953,
62,
9122,
4122,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
16447,
257,
649,
26954,
329,
262,
2496,
8619,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
2116,
13,
43167,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
28686,
13,
6978,
13,
9409,
343,
7,
9122,
4122,
62,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
69,
6,
9787,
4122,
1391,
944,
13,
43167,
62,
3672,
92,
1541,
7160,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
796,
24418,
7,
6978,
28,
944,
13,
15763,
62,
15908,
11,
4235,
2625,
64,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8856,
62,
15908,
82,
28,
944,
13,
46430,
62,
15908,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
62,
43167,
796,
314,
2640,
4853,
594,
7,
15763,
62,
15908,
28,
944,
13,
15763,
62,
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,
220,
220,
220,
220,
8856,
62,
15908,
82,
28,
944,
13,
46430,
62,
15908,
82,
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,
12094,
62,
6404,
28,
944,
13,
23705,
282,
62,
6404,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2207,
62,
16624,
796,
4808,
952,
62,
43167,
13,
41049,
62,
43167,
7,
6603,
62,
22046,
28,
17821,
38381,
12,
16,
60,
628,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
2116,
13,
43167,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
6978,
796,
4808,
952,
13,
15883,
62,
15908,
7,
9122,
4122,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
7753,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
6978,
11,
277,
6,
90,
944,
13,
43167,
62,
3672,
27422,
17752,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
4566,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
45302,
11250,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
9122,
4122,
62,
7753,
62,
6978,
11,
705,
86,
10,
11537,
355,
26954,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
12685,
62,
16624,
11,
26954,
62,
7753,
11,
33793,
28,
19,
8,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
6978,
11,
705,
81,
11537,
355,
4566,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
796,
33918,
13,
2220,
7,
11250,
62,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
17816,
9122,
13033,
6,
4083,
33295,
7,
944,
13,
43167,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
17816,
14421,
62,
9122,
4122,
20520,
796,
2116,
13,
43167,
62,
3672,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
6978,
11,
705,
86,
10,
11537,
355,
4566,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
9122,
4122,
62,
11250,
11,
4566,
62,
7753,
11,
33793,
28,
19,
8,
628,
220,
220,
220,
220,
220,
220,
220,
6808,
17,
7753,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
329,
6808,
11,
2393,
287,
4808,
952,
13,
11152,
62,
34945,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6808,
287,
6808,
17,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6808,
17,
7753,
58,
15763,
4083,
33295,
7,
418,
13,
6978,
13,
22179,
7,
15763,
11,
2393,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6808,
17,
7753,
58,
15763,
60,
796,
685,
418,
13,
6978,
13,
22179,
7,
15763,
11,
2393,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
418,
13,
6978,
13,
22179,
7,
9122,
4122,
62,
6978,
11,
45302,
38993,
33809,
705,
86,
10,
11537,
355,
20150,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
15763,
17,
7753,
11,
20150,
62,
7753,
11,
33793,
28,
19,
8,
628,
220,
220,
220,
825,
33756,
62,
33678,
62,
9122,
4122,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
38727,
262,
26954,
329,
262,
2496,
8619,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
12102,
378,
62,
9122,
4122,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
796,
24418,
7,
6978,
28,
944,
13,
15763,
62,
15908,
11,
4235,
2625,
64,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8856,
62,
15908,
82,
28,
944,
13,
46430,
62,
15908,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
2116,
13,
43167,
62,
3672,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4566,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
45302,
11250,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
6978,
11,
705,
81,
11537,
355,
4566,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
796,
33918,
13,
2220,
7,
11250,
62,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
17816,
9122,
13033,
6,
4083,
28956,
7,
944,
13,
43167,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
9122,
4122,
62,
11250,
17816,
9122,
13033,
20520,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
3605,
62,
14421,
62,
9122,
4122,
796,
26954,
62,
11250,
17816,
9122,
13033,
6,
7131,
12,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
3605,
62,
14421,
62,
9122,
4122,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
17816,
14421,
62,
9122,
4122,
20520,
796,
4808,
3605,
62,
14421,
62,
9122,
4122,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
6978,
11,
705,
86,
10,
11537,
355,
4566,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
9122,
4122,
62,
11250,
11,
4566,
62,
7753,
11,
33793,
28,
19,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
13,
33678,
62,
15908,
7,
9122,
4122,
62,
6978,
8,
628,
220,
220,
220,
825,
33756,
62,
2118,
382,
62,
9122,
4122,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
19452,
382,
736,
284,
257,
2176,
26954,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
12102,
378,
62,
9122,
4122,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
796,
24418,
7,
6978,
28,
944,
13,
15763,
62,
15908,
11,
4235,
2625,
64,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8856,
62,
15908,
82,
28,
944,
13,
46430,
62,
15908,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
2539,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
8194,
796,
15126,
7,
2539,
11639,
29609,
13,
2539,
3256,
1994,
62,
6978,
28,
62,
2539,
8,
628,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43167,
62,
3672,
11,
277,
6,
90,
944,
13,
43167,
62,
3672,
27422,
17752,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
4566,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13,
15763,
62,
15908,
11,
45302,
9122,
4122,
3256,
45302,
11250,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
9122,
4122,
62,
6978,
11,
705,
81,
11537,
355,
26954,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11600,
796,
33918,
13,
2220,
7,
9122,
4122,
62,
7753,
8,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
6978,
11,
705,
81,
11537,
355,
4566,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
796,
33918,
13,
2220,
7,
11250,
62,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
11250,
17816,
14421,
62,
9122,
4122,
20520,
796,
2116,
13,
43167,
62,
3672,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
6978,
11,
705,
86,
10,
11537,
355,
4566,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
9122,
4122,
62,
11250,
11,
4566,
62,
7753,
11,
33793,
28,
19,
8,
628,
220,
220,
220,
220,
220,
220,
220,
329,
2393,
11,
2695,
287,
26954,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
796,
8194,
13,
12501,
6012,
7,
11299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
13,
13564,
7,
7753,
11,
705,
39346,
10,
3256,
2695,
8,
628,
220,
220,
220,
825,
33756,
62,
9641,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
18557,
262,
2196,
286,
262,
8379,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
19662,
796,
277,
6,
28768,
2196,
1391,
9641,
92,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6404,
1362,
13,
6404,
28264,
19662,
11,
41033,
28,
17821,
11,
2604,
62,
4906,
2625,
10778,
4943,
628,
198,
4871,
7852,
1797,
4853,
594,
7,
44015,
594,
2599,
198,
220,
220,
220,
37227,
44015,
594,
329,
262,
43749,
2858,
526,
15931,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
8379,
62,
3672,
11639,
5097,
40,
62,
44015,
594,
3256,
1502,
62,
11600,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1822,
62,
48610,
28,
14202,
11,
26498,
28,
14202,
11,
12094,
62,
6404,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
262,
7852,
1797,
4853,
594,
1398,
13,
628,
220,
220,
220,
220,
220,
220,
220,
15161,
9706,
8379,
318,
25,
628,
220,
220,
220,
220,
220,
220,
220,
352,
13,
2547,
325,
262,
7159,
13,
198,
220,
220,
220,
220,
220,
220,
220,
362,
13,
45559,
3810,
262,
2223,
284,
1620,
422,
262,
7159,
13,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
35006,
262,
2223,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
8379,
62,
3672,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6530,
286,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1502,
62,
11600,
25,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
262,
1502,
286,
262,
5499,
287,
262,
8379,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1822,
62,
48610,
25,
45751,
46677,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45751,
30751,
329,
262,
43749,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
12286,
62,
2875,
62,
11600,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
29572,
62,
22046,
10354,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
67,
2357,
3810,
62,
2673,
10354,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
41068,
62,
525,
687,
62,
2673,
10354,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22046,
796,
26498,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
853,
62,
48610,
796,
1822,
62,
48610,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
5097,
1797,
4853,
594,
11,
2116,
737,
834,
15003,
834,
7,
43167,
62,
3672,
28,
43167,
62,
3672,
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,
1502,
62,
11600,
28,
2875,
62,
11600,
393,
2116,
13,
12286,
62,
2875,
62,
11600,
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,
12094,
62,
6404,
28,
23705,
282,
62,
6404,
8,
628,
220,
220,
220,
825,
33756,
62,
29572,
62,
22046,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
10044,
325,
262,
7159,
422,
262,
43749,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
22046,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
2116,
13,
853,
62,
48610,
13,
29572,
62,
22046,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
2116,
13,
853,
62,
48610,
13,
29572,
62,
22046,
7,
944,
13,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
26498,
628,
220,
220,
220,
825,
33756,
62,
67,
2357,
3810,
62,
2673,
7,
944,
11,
26498,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
35,
2357,
3810,
262,
2223,
284,
307,
6157,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
25,
45751,
46677,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23042,
276,
7159,
422,
262,
43749,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
26498,
13,
2673,
6624,
705,
17953,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
705,
41068,
62,
17953,
62,
9122,
4122,
6,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
26498,
13,
2673,
6624,
705,
2118,
382,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
705,
41068,
62,
2118,
382,
62,
9122,
4122,
6,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
26498,
13,
2673,
6624,
705,
33678,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
705,
41068,
62,
33678,
62,
9122,
4122,
6,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
26498,
13,
2673,
6624,
705,
15003,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
705,
41068,
62,
15003,
62,
9122,
4122,
6,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
26498,
13,
2673,
6624,
705,
9641,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
705,
41068,
62,
9641,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
44651,
2223,
2637,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
2673,
11,
26498,
60,
628,
220,
220,
220,
825,
33756,
62,
525,
687,
62,
2673,
7,
944,
11,
2223,
62,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5990,
687,
262,
2223,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
2223,
62,
22046,
25,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
7268,
2223,
290,
26498,
6530,
14106,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2223,
11,
26498,
796,
2223,
62,
22046,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
3672,
796,
26498,
13,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
6978,
796,
26498,
13,
6978,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
46430,
62,
15908,
82,
796,
26498,
13,
46430,
62,
15908,
82,
393,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
2978,
525,
62,
4658,
796,
37250,
41068,
62,
15003,
62,
9122,
4122,
3256,
705,
41068,
62,
9641,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
44104,
3672,
290,
4808,
6978,
8,
290,
2223,
407,
287,
4808,
2978,
525,
62,
4658,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
69,
6,
90,
22046,
13,
2673,
92,
4433,
257,
4938,
1438,
290,
257,
3108,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
1502,
62,
11600,
796,
1391,
2673,
25,
657,
92,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
9122,
4122,
62,
43167,
796,
6822,
4122,
44015,
594,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
3672,
11,
1502,
62,
11600,
11,
4808,
6978,
11,
4808,
46430,
62,
15908,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12094,
62,
6404,
28,
944,
13,
23705,
282,
62,
6404,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2223,
62,
8818,
796,
651,
35226,
28264,
9122,
4122,
62,
43167,
11,
2223,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2223,
62,
8818,
3419,
198
] | 2.16515 | 10,548 |
# from secret import FLAG
FLAG = "CSR{fuckingIdiotShitStupid}"
c = hashfun(FLAG)
print(c)
print(len(FLAG))
print(len(c))
m = revhash(c)
print(m)
c = [10, 30, 31, 62, 27, 9, 4, 0, 1, 1, 4, 4, 7, 13, 8, 12, 21, 28, 12, 6, 60]
m = revhash(c)
print(m)
| [
2,
422,
3200,
1330,
9977,
4760,
198,
198,
38948,
796,
366,
7902,
49,
90,
69,
19296,
7390,
5151,
2484,
270,
1273,
7658,
36786,
628,
628,
198,
66,
796,
12234,
12543,
7,
38948,
8,
198,
4798,
7,
66,
8,
198,
4798,
7,
11925,
7,
38948,
4008,
198,
4798,
7,
11925,
7,
66,
4008,
198,
198,
76,
796,
2710,
17831,
7,
66,
8,
198,
4798,
7,
76,
8,
198,
198,
66,
796,
685,
940,
11,
1542,
11,
3261,
11,
8190,
11,
2681,
11,
860,
11,
604,
11,
657,
11,
352,
11,
352,
11,
604,
11,
604,
11,
767,
11,
1511,
11,
807,
11,
1105,
11,
2310,
11,
2579,
11,
1105,
11,
718,
11,
3126,
60,
198,
76,
796,
2710,
17831,
7,
66,
8,
198,
4798,
7,
76,
8,
198
] | 2.007874 | 127 |
#!/usr/local/bin/python3
total_fuel = 0
with open("input.txt") as f:
for line in f.readlines():
total_fuel += int(int(line) / 3) - 2
print(total_fuel)
| [
2,
48443,
14629,
14,
12001,
14,
8800,
14,
29412,
18,
198,
198,
23350,
62,
25802,
796,
657,
198,
4480,
1280,
7203,
15414,
13,
14116,
4943,
355,
277,
25,
198,
220,
220,
220,
329,
1627,
287,
277,
13,
961,
6615,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
25802,
15853,
493,
7,
600,
7,
1370,
8,
1220,
513,
8,
532,
362,
198,
4798,
7,
23350,
62,
25802,
8,
198
] | 2.309859 | 71 |
#!/usr/bin/env python
__author__ = "Akalanka Galappaththi"
__email__ = "[email protected]"
__copyright__ = "Copyright 2020, The Bug Report Summarization Project @ Sybil-Lab"
__license__ = "MIT"
__maintainer__ = "Akalanka Galappaththi"
from models.Turn import Turn
class BugReport:
"""Class represents a comment of a bug report.
Parameters
----------
title : str
Title of the bug report (One sentence summary)
bug_id : int
bug_id is a unique identifier
product : str
Software product name
list_of_turns :list of int
Contains a list of comment numbers
"""
def add_topics(self, topics):
"""Add topic list to the bug report
Parameters
----------
topics : list
List of topic words
"""
self.topics.extend(topics)
def add_a_turn(self, turn):
"""Add a comment to the list
Parameters
----------
turn : object
Turn object
"""
self.list_of_turns.append(turn)
def number_of_turns(self):
"""Return the number of turns in the bug report
Returns
-------
len : int
Length of the list
"""
return len(self.list_of_turns)
def get_turns(self):
"""Returns a list of turns
Returns
-------
list_of_turns : list
List of turns
"""
return self.list_of_turns
def get_a_turn(self, turn_id):
"""Return a turn with a matching ID
Parameters
----------
turn_id : int
Turn ID
Returns
-------
t : object
Turn object
"""
for t in self.list_of_turns:
if t.get_id() == turn_id:
return t
def get_title(self):
"""Get title
Returns
-------
title : str
Title of the bug report
"""
return self.title
def set_title(self, title):
"""Set title
Parameters
----------
title : str
Title of the bug report
"""
self.title = title
def set_bug_id(self, bug_id):
"""Set bug ID
Parameters
----------
bug_id : int
Bug ID
"""
self.bug_id = bug_id
def get_bug_id(self):
"""Get bug ID
Returns
-------
bug_id : int
Bug ID
"""
return self.bug_id
def get_product(self):
"""Get product name
Returns
-------
product : str
Product name
"""
return self.product
def set_product(self, product):
"""Set product name
Parameters
----------
product : str
Product name
"""
self.product = product
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
834,
9800,
834,
796,
366,
33901,
282,
15927,
5027,
1324,
776,
400,
72,
1,
198,
834,
12888,
834,
796,
366,
64,
13,
13528,
1324,
776,
400,
72,
31,
2261,
400,
13,
6888,
1,
198,
834,
22163,
4766,
834,
796,
366,
15269,
12131,
11,
383,
15217,
6358,
5060,
3876,
1634,
4935,
2488,
1632,
33473,
12,
17822,
1,
198,
834,
43085,
834,
796,
366,
36393,
1,
198,
834,
76,
2913,
10613,
834,
796,
366,
33901,
282,
15927,
5027,
1324,
776,
400,
72,
1,
198,
198,
6738,
4981,
13,
17278,
1330,
6756,
628,
198,
4871,
15217,
19100,
25,
198,
220,
220,
220,
37227,
9487,
6870,
257,
2912,
286,
257,
5434,
989,
13,
220,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
3670,
1058,
965,
198,
220,
220,
220,
220,
220,
220,
220,
11851,
286,
262,
5434,
989,
357,
3198,
6827,
10638,
8,
198,
220,
220,
220,
5434,
62,
312,
1058,
493,
198,
220,
220,
220,
220,
220,
220,
220,
5434,
62,
312,
318,
257,
3748,
27421,
198,
220,
220,
220,
1720,
1058,
965,
198,
220,
220,
220,
220,
220,
220,
220,
10442,
1720,
1438,
198,
220,
220,
220,
1351,
62,
1659,
62,
15344,
82,
1058,
4868,
286,
493,
198,
220,
220,
220,
220,
220,
220,
220,
49850,
257,
1351,
286,
2912,
3146,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
751,
62,
4852,
873,
7,
944,
11,
10233,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
4550,
7243,
1351,
284,
262,
5434,
989,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
10233,
1058,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
7243,
2456,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4852,
873,
13,
2302,
437,
7,
4852,
873,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
825,
751,
62,
64,
62,
15344,
7,
944,
11,
1210,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
4550,
257,
2912,
284,
262,
1351,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1210,
1058,
2134,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6756,
2134,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4868,
62,
1659,
62,
15344,
82,
13,
33295,
7,
15344,
8,
628,
220,
220,
220,
825,
1271,
62,
1659,
62,
15344,
82,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
262,
1271,
286,
4962,
287,
262,
5434,
989,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
18896,
1058,
493,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22313,
286,
262,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
18896,
7,
944,
13,
4868,
62,
1659,
62,
15344,
82,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
825,
651,
62,
15344,
82,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
35561,
257,
1351,
286,
4962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
1351,
62,
1659,
62,
15344,
82,
1058,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
4962,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
4868,
62,
1659,
62,
15344,
82,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
825,
651,
62,
64,
62,
15344,
7,
944,
11,
1210,
62,
312,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
257,
1210,
351,
257,
12336,
4522,
198,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1210,
62,
312,
1058,
493,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6756,
4522,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
256,
1058,
2134,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6756,
2134,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
329,
256,
287,
2116,
13,
4868,
62,
1659,
62,
15344,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
256,
13,
1136,
62,
312,
3419,
6624,
1210,
62,
312,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
825,
651,
62,
7839,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
3670,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
3670,
1058,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11851,
286,
262,
5434,
989,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
7839,
628,
220,
220,
220,
825,
900,
62,
7839,
7,
944,
11,
3670,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
3670,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
3670,
1058,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11851,
286,
262,
5434,
989,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7839,
796,
3670,
628,
220,
220,
220,
825,
900,
62,
25456,
62,
312,
7,
944,
11,
5434,
62,
312,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
5434,
4522,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
5434,
62,
312,
1058,
493,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15217,
4522,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
25456,
62,
312,
796,
5434,
62,
312,
628,
220,
220,
220,
825,
651,
62,
25456,
62,
312,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
5434,
4522,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
5434,
62,
312,
1058,
493,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15217,
4522,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
25456,
62,
312,
628,
220,
220,
220,
825,
651,
62,
11167,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
1720,
1438,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
1720,
1058,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8721,
1438,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
11167,
628,
220,
220,
220,
825,
900,
62,
11167,
7,
944,
11,
1720,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
1720,
1438,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1720,
1058,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8721,
1438,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11167,
796,
1720,
198
] | 2.025482 | 1,452 |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# Project: http://plankton-toolbox.org
# Copyright (c) 2010-2018 SMHI, Swedish Meteorological and Hydrological Institute
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
import app_tools
import toolbox_utils
@toolbox_utils.singleton
class ToolManager(object):
"""
The tool manager is used to set up available tools.
"""
def __init__(self):
""" """
self._parent = None
self._toollist = [] # List of tools derived from ToolsBase.
def set_parent(self, parentwidget):
""" """
self._parent = parentwidget
def init_tools(self):
""" Tool activator. """
self._toollist.append(app_tools.DatasetViewerTool('Dataset viewer', self._parent))
self._toollist.append(app_tools.GraphPlotterTool('Graph plotter', self._parent))
self._toollist.append(app_tools.LogTool('Toolbox logging', self._parent))
def get_tool_by_name(self, object_name):
""" Returns the tool. """
for tool in self._toollist:
if tool.objectName() == object_name:
return tool
return None
def show_tool_by_name(self, object_name):
""" Makes a tool visible. """
for tool in self._toollist:
if tool.objectName() == object_name:
tool.show_tool()
return
def get_tool_list(self):
""" """
return self._toollist
| [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
201,
198,
2,
532,
9,
12,
19617,
25,
40477,
12,
23,
532,
9,
12,
201,
198,
2,
4935,
25,
2638,
1378,
489,
962,
1122,
12,
25981,
3524,
13,
2398,
201,
198,
2,
15069,
357,
66,
8,
3050,
12,
7908,
9447,
25374,
11,
14023,
25582,
2770,
290,
15084,
3225,
30766,
5136,
220,
201,
198,
2,
13789,
25,
17168,
13789,
357,
3826,
38559,
24290,
13,
14116,
393,
2638,
1378,
44813,
1668,
13,
2398,
14,
677,
4541,
14,
2781,
737,
201,
198,
201,
198,
11748,
598,
62,
31391,
201,
198,
11748,
2891,
3524,
62,
26791,
201,
198,
201,
198,
201,
198,
31,
25981,
3524,
62,
26791,
13,
12215,
10565,
201,
198,
4871,
16984,
13511,
7,
15252,
2599,
201,
198,
220,
220,
220,
37227,
201,
198,
220,
220,
220,
383,
2891,
4706,
318,
973,
284,
900,
510,
1695,
4899,
13,
220,
201,
198,
220,
220,
220,
37227,
201,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
8000,
796,
6045,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
1462,
692,
396,
796,
17635,
1303,
7343,
286,
4899,
10944,
422,
20003,
14881,
13,
201,
198,
201,
198,
220,
220,
220,
825,
900,
62,
8000,
7,
944,
11,
2560,
42655,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
8000,
796,
2560,
42655,
201,
198,
201,
198,
220,
220,
220,
825,
2315,
62,
31391,
7,
944,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
16984,
1753,
1352,
13,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
1462,
692,
396,
13,
33295,
7,
1324,
62,
31391,
13,
27354,
292,
316,
7680,
263,
25391,
10786,
27354,
292,
316,
19091,
3256,
2116,
13557,
8000,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
1462,
692,
396,
13,
33295,
7,
1324,
62,
31391,
13,
37065,
43328,
353,
25391,
10786,
37065,
7110,
353,
3256,
2116,
13557,
8000,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
1462,
692,
396,
13,
33295,
7,
1324,
62,
31391,
13,
11187,
25391,
10786,
25391,
3524,
18931,
3256,
2116,
13557,
8000,
4008,
201,
198,
201,
198,
220,
220,
220,
825,
651,
62,
25981,
62,
1525,
62,
3672,
7,
944,
11,
2134,
62,
3672,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
16409,
262,
2891,
13,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2891,
287,
2116,
13557,
1462,
692,
396,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2891,
13,
15252,
5376,
3419,
6624,
2134,
62,
3672,
25,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2891,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6045,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
825,
905,
62,
25981,
62,
1525,
62,
3672,
7,
944,
11,
2134,
62,
3672,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
27433,
257,
2891,
7424,
13,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2891,
287,
2116,
13557,
1462,
692,
396,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2891,
13,
15252,
5376,
3419,
6624,
2134,
62,
3672,
25,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2891,
13,
12860,
62,
25981,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
825,
651,
62,
25981,
62,
4868,
7,
944,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
1462,
692,
396,
201,
198
] | 2.264706 | 680 |
# 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.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import TYPE_CHECKING
from azure.core import PipelineClient
from msrest import Deserializer, Serializer
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from ._configuration import ContainerRegistryConfiguration
from .operations import ContainerRegistryOperations
from .operations import ContainerRegistryRepositoryOperations
from .operations import ContainerRegistryBlobOperations
from .operations import RefreshTokensOperations
from .operations import AccessTokensOperations
from . import models
class ContainerRegistry(object):
"""Metadata API definition for the Azure Container Registry runtime.
:ivar container_registry: ContainerRegistryOperations operations
:vartype container_registry: azure.containerregistry.operations.ContainerRegistryOperations
:ivar container_registry_repository: ContainerRegistryRepositoryOperations operations
:vartype container_registry_repository: azure.containerregistry.operations.ContainerRegistryRepositoryOperations
:ivar container_registry_blob: ContainerRegistryBlobOperations operations
:vartype container_registry_blob: azure.containerregistry.operations.ContainerRegistryBlobOperations
:ivar refresh_tokens: RefreshTokensOperations operations
:vartype refresh_tokens: azure.containerregistry.operations.RefreshTokensOperations
:ivar access_tokens: AccessTokensOperations operations
:vartype access_tokens: azure.containerregistry.operations.AccessTokensOperations
:param url: Registry login URL.
:type url: str
"""
def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
path_format_arguments = {
'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True),
}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response
| [
2,
19617,
28,
40477,
12,
23,
198,
2,
16529,
35937,
198,
2,
15069,
357,
66,
8,
5413,
10501,
13,
1439,
2489,
10395,
13,
198,
2,
49962,
739,
262,
17168,
13789,
13,
4091,
13789,
13,
14116,
287,
262,
1628,
6808,
329,
5964,
1321,
13,
198,
2,
6127,
7560,
416,
5413,
357,
49,
8,
11160,
19452,
6127,
35986,
13,
198,
2,
19179,
743,
2728,
11491,
4069,
290,
481,
307,
2626,
611,
262,
2438,
318,
16935,
515,
13,
198,
2,
16529,
35937,
198,
198,
6738,
19720,
1330,
41876,
62,
50084,
2751,
198,
198,
6738,
35560,
495,
13,
7295,
1330,
37709,
11792,
198,
6738,
13845,
2118,
1330,
2935,
48499,
7509,
11,
23283,
7509,
198,
198,
361,
41876,
62,
50084,
2751,
25,
198,
220,
220,
220,
1303,
279,
2645,
600,
25,
15560,
28,
403,
1484,
12,
11748,
11,
2150,
3233,
276,
12,
320,
3742,
198,
220,
220,
220,
422,
19720,
1330,
4377,
628,
220,
220,
220,
422,
35560,
495,
13,
7295,
13,
79,
541,
4470,
13,
7645,
634,
1330,
367,
29281,
18453,
11,
367,
29281,
31077,
198,
198,
6738,
47540,
11250,
3924,
1330,
43101,
8081,
4592,
38149,
198,
6738,
764,
3575,
602,
1330,
43101,
8081,
4592,
18843,
602,
198,
6738,
764,
3575,
602,
1330,
43101,
8081,
4592,
6207,
13264,
18843,
602,
198,
6738,
764,
3575,
602,
1330,
43101,
8081,
4592,
3629,
672,
18843,
602,
198,
6738,
764,
3575,
602,
1330,
22539,
22906,
18843,
602,
198,
6738,
764,
3575,
602,
1330,
8798,
22906,
18843,
602,
198,
6738,
764,
1330,
4981,
628,
198,
4871,
43101,
8081,
4592,
7,
15252,
2599,
198,
220,
220,
220,
37227,
9171,
14706,
7824,
6770,
329,
262,
22134,
43101,
33432,
19124,
13,
628,
220,
220,
220,
1058,
452,
283,
9290,
62,
2301,
4592,
25,
43101,
8081,
4592,
18843,
602,
4560,
198,
220,
220,
220,
1058,
85,
433,
2981,
9290,
62,
2301,
4592,
25,
35560,
495,
13,
34924,
2301,
4592,
13,
3575,
602,
13,
29869,
8081,
4592,
18843,
602,
198,
220,
220,
220,
1058,
452,
283,
9290,
62,
2301,
4592,
62,
260,
1930,
37765,
25,
43101,
8081,
4592,
6207,
13264,
18843,
602,
4560,
198,
220,
220,
220,
1058,
85,
433,
2981,
9290,
62,
2301,
4592,
62,
260,
1930,
37765,
25,
35560,
495,
13,
34924,
2301,
4592,
13,
3575,
602,
13,
29869,
8081,
4592,
6207,
13264,
18843,
602,
198,
220,
220,
220,
1058,
452,
283,
9290,
62,
2301,
4592,
62,
2436,
672,
25,
43101,
8081,
4592,
3629,
672,
18843,
602,
4560,
198,
220,
220,
220,
1058,
85,
433,
2981,
9290,
62,
2301,
4592,
62,
2436,
672,
25,
35560,
495,
13,
34924,
2301,
4592,
13,
3575,
602,
13,
29869,
8081,
4592,
3629,
672,
18843,
602,
198,
220,
220,
220,
1058,
452,
283,
14976,
62,
83,
482,
641,
25,
22539,
22906,
18843,
602,
4560,
198,
220,
220,
220,
1058,
85,
433,
2981,
14976,
62,
83,
482,
641,
25,
35560,
495,
13,
34924,
2301,
4592,
13,
3575,
602,
13,
8134,
3447,
22906,
18843,
602,
198,
220,
220,
220,
1058,
452,
283,
1895,
62,
83,
482,
641,
25,
8798,
22906,
18843,
602,
4560,
198,
220,
220,
220,
1058,
85,
433,
2981,
1895,
62,
83,
482,
641,
25,
35560,
495,
13,
34924,
2301,
4592,
13,
3575,
602,
13,
15457,
22906,
18843,
602,
198,
220,
220,
220,
1058,
17143,
19016,
25,
33432,
17594,
10289,
13,
198,
220,
220,
220,
1058,
4906,
19016,
25,
965,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
4808,
21280,
62,
25927,
7,
944,
11,
2638,
62,
25927,
11,
12429,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2099,
25,
357,
43481,
18453,
11,
4377,
8,
4613,
367,
29281,
31077,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
10987,
82,
262,
3127,
2581,
832,
262,
5456,
338,
40682,
4788,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2638,
62,
25927,
25,
383,
3127,
2581,
345,
765,
284,
787,
13,
20906,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
2638,
62,
25927,
25,
5299,
1031,
495,
13,
7295,
13,
79,
541,
4470,
13,
7645,
634,
13,
43481,
18453,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
2539,
4775,
20512,
4269,
25,
10127,
262,
2882,
21437,
481,
307,
35377,
13,
2896,
13185,
284,
6407,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
383,
2882,
286,
534,
3127,
869,
13,
8314,
407,
466,
4049,
9041,
319,
534,
2882,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
81,
4906,
25,
5299,
1031,
495,
13,
7295,
13,
79,
541,
4470,
13,
7645,
634,
13,
43481,
31077,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3108,
62,
18982,
62,
853,
2886,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
6371,
10354,
2116,
13557,
46911,
1096,
13,
6371,
7203,
944,
13557,
11250,
13,
6371,
1600,
2116,
13557,
11250,
13,
6371,
11,
705,
2536,
3256,
14267,
62,
22708,
28,
17821,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2638,
62,
25927,
13,
6371,
796,
2116,
13557,
16366,
13,
18982,
62,
6371,
7,
4023,
62,
25927,
13,
6371,
11,
12429,
6978,
62,
18982,
62,
853,
2886,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4269,
796,
479,
86,
22046,
13,
12924,
7203,
5532,
1600,
6407,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11523,
62,
26209,
796,
2116,
13557,
16366,
13557,
79,
541,
4470,
13,
5143,
7,
4023,
62,
25927,
11,
4269,
28,
5532,
11,
12429,
46265,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
11523,
62,
26209,
13,
4023,
62,
26209,
198
] | 3.385776 | 928 |
from RPIO import PWM
| [
6738,
25812,
9399,
1330,
350,
22117,
628
] | 3.142857 | 7 |
# program to compute the time
# of execution of any python code
import time
from collections import Counter
if __name__ == "__main__":
puzzle_input = read_input("day14.txt")
start = time.time()
print(f"Part 1: {part1(puzzle_input)}")
print(f"Part 2: {part2(puzzle_input)}")
end = time.time()
print(f"Took {round(end - start, 5)} to process the puzzle")
| [
2,
1430,
284,
24061,
262,
640,
198,
2,
286,
9706,
286,
597,
21015,
2438,
198,
11748,
640,
198,
6738,
17268,
1330,
15034,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
15027,
62,
15414,
796,
1100,
62,
15414,
7203,
820,
1415,
13,
14116,
4943,
198,
220,
220,
220,
923,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
3601,
7,
69,
1,
7841,
352,
25,
1391,
3911,
16,
7,
79,
9625,
62,
15414,
38165,
4943,
198,
220,
220,
220,
3601,
7,
69,
1,
7841,
362,
25,
1391,
3911,
17,
7,
79,
9625,
62,
15414,
38165,
4943,
198,
220,
220,
220,
886,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
3601,
7,
69,
1,
51,
566,
1391,
744,
7,
437,
532,
923,
11,
642,
38165,
284,
1429,
262,
15027,
4943,
198
] | 2.735714 | 140 |
import numpy as np
from sklearn.model_selection import train_test_split
from file_io import features_from_file, labels_from_file, add_history
from utils import labels_to_categorical, transpose_vector, get_count, get_mean_stddev, normalize_data
BATCH_SIZE = 128
| [
11748,
299,
32152,
355,
45941,
198,
6738,
1341,
35720,
13,
19849,
62,
49283,
1330,
4512,
62,
9288,
62,
35312,
198,
198,
6738,
2393,
62,
952,
1330,
3033,
62,
6738,
62,
7753,
11,
14722,
62,
6738,
62,
7753,
11,
751,
62,
23569,
198,
6738,
3384,
4487,
1330,
14722,
62,
1462,
62,
66,
2397,
12409,
11,
1007,
3455,
62,
31364,
11,
651,
62,
9127,
11,
651,
62,
32604,
62,
301,
1860,
1990,
11,
3487,
1096,
62,
7890,
628,
198,
33,
11417,
62,
33489,
796,
13108,
628,
628
] | 3.141176 | 85 |
import cv2
import numpy as np
import glob
# This function records images from the connected camera to specified directory
# when the "Space" key is pressed.
# directory: should be a string corresponding to the name of an existing
# directory
print("Hello!")
folder = 'calibration_data' ####### THE FOLDER YOU CREATED GOES HERE!
print(folder)
# This function calls OpenCV's camera calibration on the directory of images
# created above.
# Returns the following values
# intrinsics: the current camera intrinsic calibration matrix
# distortion: the current distortion coefficients
# roi: the region of the image with full data
# new_intrinsics: the intrinsic calibration matrix of an image after
# undistortion and roi cropping
# This function will save the calibration data to a file in the specified
# directory
# This function will load the calibration data from a file in the specified
# directory
| [
11748,
269,
85,
17,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
15095,
198,
198,
2,
770,
2163,
4406,
4263,
422,
262,
5884,
4676,
284,
7368,
8619,
220,
198,
2,
618,
262,
366,
14106,
1,
1994,
318,
12070,
13,
198,
2,
8619,
25,
815,
307,
257,
4731,
11188,
284,
262,
1438,
286,
281,
4683,
220,
198,
2,
8619,
198,
4798,
7203,
15496,
2474,
8,
198,
43551,
796,
705,
9948,
571,
1358,
62,
7890,
6,
46424,
2235,
3336,
376,
3535,
14418,
7013,
29244,
11617,
10351,
1546,
15698,
0,
198,
4798,
7,
43551,
8,
628,
198,
2,
770,
2163,
3848,
4946,
33538,
338,
4676,
36537,
319,
262,
8619,
286,
4263,
220,
198,
2,
2727,
2029,
13,
220,
198,
2,
16409,
262,
1708,
3815,
198,
2,
22496,
873,
25,
262,
1459,
4676,
28327,
36537,
17593,
220,
220,
198,
2,
25100,
25,
262,
1459,
25100,
44036,
198,
2,
686,
72,
25,
262,
3814,
286,
262,
2939,
351,
1336,
1366,
198,
2,
649,
62,
600,
81,
1040,
873,
25,
262,
28327,
36537,
17593,
286,
281,
2939,
706,
220,
198,
2,
3318,
396,
5817,
290,
686,
72,
6763,
2105,
220,
220,
220,
198,
198,
2,
770,
2163,
481,
3613,
262,
36537,
1366,
284,
257,
2393,
287,
262,
7368,
220,
198,
2,
8619,
198,
220,
220,
220,
220,
198,
2,
770,
2163,
481,
3440,
262,
36537,
1366,
422,
257,
2393,
287,
262,
7368,
220,
198,
2,
8619,
220,
220,
220,
628,
198
] | 3.940426 | 235 |
FILENAME = './puzzle1/data/input'
s = 0
previous_value = None
with open(FILENAME) as file:
for line in file:
if previous_value:
if int(line) > previous_value:
s += 1
previous_value = int(line)
print(s) | [
46700,
1677,
10067,
796,
705,
19571,
79,
9625,
16,
14,
7890,
14,
15414,
6,
201,
198,
201,
198,
82,
796,
657,
201,
198,
3866,
1442,
62,
8367,
796,
6045,
201,
198,
4480,
1280,
7,
46700,
1677,
10067,
8,
355,
2393,
25,
201,
198,
220,
220,
220,
329,
1627,
287,
2393,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2180,
62,
8367,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
493,
7,
1370,
8,
1875,
2180,
62,
8367,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
15853,
352,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2180,
62,
8367,
796,
493,
7,
1370,
8,
201,
198,
4798,
7,
82,
8
] | 1.984733 | 131 |
'''
Author : MiKueen
Level : Medium
Problem Statement : Single Number III
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.
Example:
Input: [1,2,1,3,2,5]
Output: [3,5]
Note:
The order of the result is not important. So in the above example, [5, 3] is also correct.
Your algorithm should run in linear runtime complexity. Could you implement it using only constant space complexity?
'''
| [
7061,
6,
198,
13838,
1058,
13756,
42,
518,
268,
198,
4971,
1058,
13398,
198,
40781,
21983,
1058,
14206,
7913,
6711,
198,
198,
15056,
281,
7177,
286,
3146,
997,
82,
11,
287,
543,
3446,
734,
4847,
1656,
691,
1752,
290,
477,
262,
584,
4847,
1656,
3446,
5403,
13,
9938,
262,
734,
4847,
326,
1656,
691,
1752,
13,
198,
198,
16281,
25,
198,
20560,
25,
220,
685,
16,
11,
17,
11,
16,
11,
18,
11,
17,
11,
20,
60,
198,
26410,
25,
685,
18,
11,
20,
60,
198,
6425,
25,
198,
198,
464,
1502,
286,
262,
1255,
318,
407,
1593,
13,
1406,
287,
262,
2029,
1672,
11,
685,
20,
11,
513,
60,
318,
635,
3376,
13,
198,
7120,
11862,
815,
1057,
287,
14174,
19124,
13357,
13,
10347,
345,
3494,
340,
1262,
691,
6937,
2272,
13357,
30,
198,
7061,
6,
198,
220,
220,
220,
220
] | 3.640845 | 142 |
print('hello word','sub2')
name = input()
print('hello,', name)
if name=='test':
print('hello1,', name)
else:
print('hello2,', name) | [
4798,
10786,
31373,
1573,
41707,
7266,
17,
11537,
198,
198,
3672,
796,
5128,
3419,
198,
4798,
10786,
31373,
11,
3256,
1438,
8,
198,
198,
361,
1438,
855,
6,
9288,
10354,
198,
220,
220,
220,
3601,
10786,
31373,
16,
11,
3256,
1438,
8,
198,
17772,
25,
198,
220,
220,
220,
3601,
10786,
31373,
17,
11,
3256,
1438,
8
] | 2.491228 | 57 |
from django.apps import AppConfig
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
628
] | 3.888889 | 9 |
t = (1, 2, 3)
a, b, c = t
print(a)
print(b)
print(c) | [
83,
796,
357,
16,
11,
362,
11,
513,
8,
198,
64,
11,
275,
11,
269,
796,
256,
198,
198,
4798,
7,
64,
8,
198,
4798,
7,
65,
8,
198,
4798,
7,
66,
8
] | 1.606061 | 33 |
import numpy as np
import wave
#takes input frame and width of sample in bytes and transforms it into a number between -1 and 1
#reverses squash()
vunsquash = np.vectorize(unsquash)
vsquash = np.vectorize(squash)
#Gets next frame in the file
#Arranges the file into numpy matrix for input using every possible sequence.
#Arranges the file into numpy matrix for input sequentially.
| [
11748,
299,
32152,
355,
45941,
198,
11748,
6769,
198,
198,
2,
83,
1124,
5128,
5739,
290,
9647,
286,
6291,
287,
9881,
290,
31408,
340,
656,
257,
1271,
1022,
532,
16,
290,
352,
198,
198,
2,
260,
690,
274,
34613,
3419,
198,
198,
85,
13271,
421,
1077,
796,
45941,
13,
31364,
1096,
7,
13271,
421,
1077,
8,
198,
198,
14259,
421,
1077,
796,
45941,
13,
31364,
1096,
7,
16485,
1077,
8,
198,
198,
2,
38,
1039,
1306,
5739,
287,
262,
2393,
198,
198,
2,
3163,
81,
6231,
262,
2393,
656,
299,
32152,
17593,
329,
5128,
1262,
790,
1744,
8379,
13,
628,
198,
2,
3163,
81,
6231,
262,
2393,
656,
299,
32152,
17593,
329,
5128,
4726,
3746,
13,
198
] | 3.324786 | 117 |
# -*- coding: utf-8 -*-
"""Console script for polr."""
import sys
import click
from .polr import Polr
from . import utils
from . import settings
_client = None
@click.group()
def polr(args=None):
"""
Console script for polr.
"""
return 0
SHORTEN_HELP_STR = "Return an error if a link with the desired customending already exists"
@polr.command(name="shorten")
@click.argument("url")
@click.option("-e", "--ending", "ending", help="A custom ending for the shortened link.")
@click.option("-f", "--fail", "raise_on_exists", is_flag=True, help=SHORTEN_HELP_STR)
def shorten(url, ending="", raise_on_exists=False):
"""
Shorten a link with the option to give it a custom ending. Checks to see if a link with
the given ending exists. Can be configured to fail if it already exists with [-f|--fail].
Usage:
jinc go shorten URL [(-e|--ending=)ending] [(-f|--fail)]
Examples:
\b
# Use default ending
$ polr shorten https://example.com
http://go/ad14gfwe
\b
# Use custom ending, if ending already exists don't return error, return link with that ending.
$ polr shorten https://example.com -e my-custom-ending
http://go/my-custom-ending
\b
# Use custom ending, return error if it already exists.
polr shorten https://example.com -e my-custom-ending -f
"""
client = get_client()
try:
shortened = client.shorten(url, ending=ending, raise_on_exists=raise_on_exists)
click.echo(shortened)
except client.ShortenerException as err:
utils.print_error_and_exit(f"{err}")
@polr.command(name="shorten-bulk")
@click.argument("links")
@polr.command(name="exists", help="Check to see if a link with the given ending already exists.")
@click.argument("ending")
@polr.command(name="lookup")
@click.argument("ending")
@polr.command(name="data")
@click.argument("ending")
if __name__ == "__main__":
sys.exit(polr()) # pragma: no cover
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
47581,
4226,
329,
755,
81,
526,
15931,
198,
11748,
25064,
198,
198,
11748,
3904,
198,
198,
6738,
764,
16104,
81,
1330,
2165,
81,
198,
6738,
764,
1330,
3384,
4487,
198,
6738,
764,
1330,
6460,
628,
198,
62,
16366,
796,
6045,
628,
198,
198,
31,
12976,
13,
8094,
3419,
198,
4299,
755,
81,
7,
22046,
28,
14202,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
24371,
4226,
329,
755,
81,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
657,
628,
198,
9693,
9863,
1677,
62,
39,
3698,
47,
62,
18601,
796,
366,
13615,
281,
4049,
611,
257,
2792,
351,
262,
10348,
2183,
1571,
1541,
7160,
1,
628,
198,
31,
16104,
81,
13,
21812,
7,
3672,
2625,
19509,
268,
4943,
198,
31,
12976,
13,
49140,
7203,
6371,
4943,
198,
31,
12976,
13,
18076,
7203,
12,
68,
1600,
366,
438,
1571,
1600,
366,
1571,
1600,
1037,
2625,
32,
2183,
7464,
329,
262,
34464,
2792,
19570,
198,
31,
12976,
13,
18076,
7203,
12,
69,
1600,
366,
438,
32165,
1600,
366,
40225,
62,
261,
62,
1069,
1023,
1600,
318,
62,
32109,
28,
17821,
11,
1037,
28,
9693,
9863,
1677,
62,
39,
3698,
47,
62,
18601,
8,
198,
4299,
45381,
7,
6371,
11,
7464,
2625,
1600,
5298,
62,
261,
62,
1069,
1023,
28,
25101,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
10073,
268,
257,
2792,
351,
262,
3038,
284,
1577,
340,
257,
2183,
7464,
13,
47719,
284,
766,
611,
257,
2792,
351,
198,
220,
220,
220,
262,
1813,
7464,
7160,
13,
1680,
307,
17839,
284,
2038,
611,
340,
1541,
7160,
351,
25915,
69,
91,
438,
32165,
4083,
628,
220,
220,
220,
29566,
25,
628,
220,
220,
220,
220,
220,
220,
220,
474,
1939,
467,
45381,
10289,
685,
32590,
68,
91,
438,
1571,
28,
8,
1571,
60,
685,
32590,
69,
91,
438,
32165,
15437,
628,
220,
220,
220,
21066,
25,
628,
220,
220,
220,
220,
220,
220,
220,
3467,
65,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5765,
4277,
7464,
198,
220,
220,
220,
220,
220,
220,
220,
720,
755,
81,
45381,
3740,
1378,
20688,
13,
785,
198,
220,
220,
220,
220,
220,
220,
220,
2638,
1378,
2188,
14,
324,
1415,
70,
69,
732,
628,
220,
220,
220,
220,
220,
220,
220,
3467,
65,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5765,
2183,
7464,
11,
611,
7464,
1541,
7160,
836,
470,
1441,
4049,
11,
1441,
2792,
351,
326,
7464,
13,
198,
220,
220,
220,
220,
220,
220,
220,
720,
755,
81,
45381,
3740,
1378,
20688,
13,
785,
532,
68,
616,
12,
23144,
12,
1571,
198,
220,
220,
220,
220,
220,
220,
220,
2638,
1378,
2188,
14,
1820,
12,
23144,
12,
1571,
628,
220,
220,
220,
220,
220,
220,
220,
3467,
65,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5765,
2183,
7464,
11,
1441,
4049,
611,
340,
1541,
7160,
13,
198,
220,
220,
220,
220,
220,
220,
220,
755,
81,
45381,
3740,
1378,
20688,
13,
785,
532,
68,
616,
12,
23144,
12,
1571,
532,
69,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
5456,
796,
651,
62,
16366,
3419,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
34464,
796,
5456,
13,
19509,
268,
7,
6371,
11,
7464,
28,
1571,
11,
5298,
62,
261,
62,
1069,
1023,
28,
40225,
62,
261,
62,
1069,
1023,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3904,
13,
30328,
7,
19509,
2945,
8,
198,
220,
220,
220,
2845,
5456,
13,
16438,
877,
16922,
355,
11454,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3384,
4487,
13,
4798,
62,
18224,
62,
392,
62,
37023,
7,
69,
1,
90,
8056,
92,
4943,
628,
198,
31,
16104,
81,
13,
21812,
7,
3672,
2625,
19509,
268,
12,
65,
12171,
4943,
198,
31,
12976,
13,
49140,
7203,
28751,
4943,
628,
198,
31,
16104,
81,
13,
21812,
7,
3672,
2625,
1069,
1023,
1600,
1037,
2625,
9787,
284,
766,
611,
257,
2792,
351,
262,
1813,
7464,
1541,
7160,
19570,
198,
31,
12976,
13,
49140,
7203,
1571,
4943,
628,
198,
31,
16104,
81,
13,
21812,
7,
3672,
2625,
5460,
929,
4943,
198,
31,
12976,
13,
49140,
7203,
1571,
4943,
628,
198,
31,
16104,
81,
13,
21812,
7,
3672,
2625,
7890,
4943,
198,
31,
12976,
13,
49140,
7203,
1571,
4943,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
25064,
13,
37023,
7,
16104,
81,
28955,
220,
1303,
23864,
2611,
25,
645,
3002,
198
] | 2.655673 | 758 |
from unittest import TestCase
from src.pynwb.ndx_franklab_novela.associated_files import AssociatedFiles
| [
6738,
555,
715,
395,
1330,
6208,
20448,
198,
198,
6738,
12351,
13,
79,
2047,
39346,
13,
358,
87,
62,
8310,
962,
23912,
62,
3919,
626,
64,
13,
32852,
62,
16624,
1330,
10575,
25876,
628
] | 3.147059 | 34 |
import functools
import requests
from dbt.events.functions import fire_event
from dbt.events.types import (
RegistryProgressMakingGETRequest,
RegistryProgressGETResponse
)
from dbt.utils import memoized, _connection_exception_retry as connection_exception_retry
from dbt import deprecations
import os
if os.getenv('DBT_PACKAGE_HUB_URL'):
DEFAULT_REGISTRY_BASE_URL = os.getenv('DBT_PACKAGE_HUB_URL')
else:
DEFAULT_REGISTRY_BASE_URL = 'https://hub.getdbt.com/'
index_cached = memoized(index)
| [
11748,
1257,
310,
10141,
198,
11748,
7007,
198,
6738,
288,
18347,
13,
31534,
13,
12543,
2733,
1330,
2046,
62,
15596,
198,
6738,
288,
18347,
13,
31534,
13,
19199,
1330,
357,
198,
220,
220,
220,
33432,
32577,
23874,
18851,
18453,
11,
198,
220,
220,
220,
33432,
32577,
18851,
31077,
198,
8,
198,
6738,
288,
18347,
13,
26791,
1330,
16155,
1143,
11,
4808,
38659,
62,
1069,
4516,
62,
1186,
563,
355,
4637,
62,
1069,
4516,
62,
1186,
563,
198,
6738,
288,
18347,
1330,
1207,
8344,
602,
198,
11748,
28686,
198,
198,
361,
28686,
13,
1136,
24330,
10786,
11012,
51,
62,
47,
8120,
11879,
62,
39,
10526,
62,
21886,
6,
2599,
198,
220,
220,
220,
5550,
38865,
62,
31553,
1797,
40405,
62,
33,
11159,
62,
21886,
796,
28686,
13,
1136,
24330,
10786,
11012,
51,
62,
47,
8120,
11879,
62,
39,
10526,
62,
21886,
11537,
198,
17772,
25,
198,
220,
220,
220,
5550,
38865,
62,
31553,
1797,
40405,
62,
33,
11159,
62,
21886,
796,
705,
5450,
1378,
40140,
13,
1136,
9945,
83,
13,
785,
14,
6,
628,
628,
628,
198,
9630,
62,
66,
2317,
796,
16155,
1143,
7,
9630,
8,
628,
628,
198
] | 2.73545 | 189 |
#from https://stackoverflow.com/questions/726549/algorithm-for-additive-color-mixing-for-rgb-values/726578
rgb_scale = 255
cmyk_scale = 100
def cmyk_to_rgb(c, m, y, k):
"""
"""
r = rgb_scale*(1.0 - (c + k) / float(cmyk_scale))
g = rgb_scale*(1.0 - (m + k) / float(cmyk_scale))
b = rgb_scale*(1.0 - (y + k) / float(cmyk_scale))
return int(r), int(g), int(b)
def ink_add_for_rgb(list_of_colors):
"""input: list of rgb, opacity (r,g,b,o) colors to be added, o acts as weights.
output (r,g,b)
"""
C = 0
M = 0
Y = 0
K = 0
for (r, g, b, o) in list_of_colors:
c, m, y, k = rgb_to_cmyk(r, g, b)
C += o * c
M += o * m
Y += o * y
K += o * k
return cmyk_to_rgb(C, M, Y, K)
| [
2,
6738,
3740,
1378,
25558,
2502,
11125,
13,
785,
14,
6138,
507,
14,
22,
22980,
2920,
14,
282,
42289,
12,
1640,
12,
2860,
1800,
12,
8043,
12,
19816,
278,
12,
1640,
12,
81,
22296,
12,
27160,
14,
22,
2075,
38907,
198,
198,
81,
22296,
62,
9888,
796,
14280,
198,
66,
1820,
74,
62,
9888,
796,
1802,
198,
198,
4299,
269,
1820,
74,
62,
1462,
62,
81,
22296,
7,
66,
11,
285,
11,
331,
11,
479,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
374,
796,
46140,
62,
9888,
9,
7,
16,
13,
15,
532,
357,
66,
1343,
479,
8,
1220,
12178,
7,
66,
1820,
74,
62,
9888,
4008,
198,
220,
220,
220,
308,
796,
46140,
62,
9888,
9,
7,
16,
13,
15,
532,
357,
76,
1343,
479,
8,
1220,
12178,
7,
66,
1820,
74,
62,
9888,
4008,
198,
220,
220,
220,
275,
796,
46140,
62,
9888,
9,
7,
16,
13,
15,
532,
357,
88,
1343,
479,
8,
1220,
12178,
7,
66,
1820,
74,
62,
9888,
4008,
198,
220,
220,
220,
1441,
493,
7,
81,
828,
493,
7,
70,
828,
493,
7,
65,
8,
198,
198,
4299,
16882,
62,
2860,
62,
1640,
62,
81,
22296,
7,
4868,
62,
1659,
62,
4033,
669,
2599,
198,
220,
220,
220,
37227,
15414,
25,
1351,
286,
46140,
11,
45912,
357,
81,
11,
70,
11,
65,
11,
78,
8,
7577,
284,
307,
2087,
11,
267,
6529,
355,
19590,
13,
198,
220,
220,
220,
5072,
357,
81,
11,
70,
11,
65,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
327,
796,
657,
198,
220,
220,
220,
337,
796,
657,
198,
220,
220,
220,
575,
796,
657,
198,
220,
220,
220,
509,
796,
657,
628,
220,
220,
220,
329,
357,
81,
11,
308,
11,
275,
11,
267,
8,
287,
1351,
62,
1659,
62,
4033,
669,
25,
198,
220,
220,
220,
220,
220,
220,
220,
269,
11,
285,
11,
331,
11,
479,
796,
46140,
62,
1462,
62,
66,
1820,
74,
7,
81,
11,
308,
11,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
327,
15853,
267,
1635,
269,
198,
220,
220,
220,
220,
220,
220,
220,
337,
15853,
267,
1635,
285,
198,
220,
220,
220,
220,
220,
220,
220,
575,
15853,
267,
1635,
331,
198,
220,
220,
220,
220,
220,
220,
220,
509,
15853,
267,
1635,
479,
628,
220,
220,
220,
1441,
269,
1820,
74,
62,
1462,
62,
81,
22296,
7,
34,
11,
337,
11,
575,
11,
509,
8,
628
] | 1.864078 | 412 |
"""
Convert txt files of ApolloCar3D into json file with COCO format
"""
import glob
import os
import time
from shutil import copyfile
import json
import argparse
import numpy as np
from PIL import Image
# Packages for data processing, crowd annotations and histograms
try:
import matplotlib.pyplot as plt # pylint: disable=import-error
except ModuleNotFoundError as err:
if err.name != 'matplotlib':
raise err
plt = None
try:
import cv2 # pylint: disable=import-error
except ModuleNotFoundError as err:
if err.name != 'cv2':
raise err
cv2 = None # pylint: disable=invalid-name
from .constants import CAR_KEYPOINTS_24, CAR_SKELETON_24,\
CAR_KEYPOINTS_66, CAR_SKELETON_66, KPS_MAPPING
from .transforms import skeleton_mapping
if __name__ == "__main__":
main()
| [
37811,
198,
3103,
1851,
256,
742,
3696,
286,
17508,
9914,
18,
35,
656,
33918,
2393,
351,
327,
4503,
46,
5794,
198,
37811,
198,
198,
11748,
15095,
198,
11748,
28686,
198,
11748,
640,
198,
6738,
4423,
346,
1330,
4866,
7753,
198,
11748,
33918,
198,
11748,
1822,
29572,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
350,
4146,
1330,
7412,
198,
198,
2,
6400,
1095,
329,
1366,
7587,
11,
4315,
37647,
290,
1554,
26836,
198,
28311,
25,
198,
220,
220,
220,
1330,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
220,
1303,
279,
2645,
600,
25,
15560,
28,
11748,
12,
18224,
198,
16341,
19937,
3673,
21077,
12331,
355,
11454,
25,
198,
220,
220,
220,
611,
11454,
13,
3672,
14512,
705,
6759,
29487,
8019,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
11454,
198,
220,
220,
220,
458,
83,
796,
6045,
198,
28311,
25,
198,
220,
220,
220,
1330,
269,
85,
17,
220,
1303,
279,
2645,
600,
25,
15560,
28,
11748,
12,
18224,
198,
16341,
19937,
3673,
21077,
12331,
355,
11454,
25,
198,
220,
220,
220,
611,
11454,
13,
3672,
14512,
705,
33967,
17,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
11454,
198,
220,
220,
220,
269,
85,
17,
796,
6045,
220,
1303,
279,
2645,
600,
25,
15560,
28,
259,
12102,
12,
3672,
198,
198,
6738,
764,
9979,
1187,
1330,
17368,
62,
20373,
16402,
1268,
4694,
62,
1731,
11,
17368,
62,
50,
7336,
2538,
11357,
62,
1731,
11,
59,
198,
220,
220,
220,
17368,
62,
20373,
16402,
1268,
4694,
62,
2791,
11,
17368,
62,
50,
7336,
2538,
11357,
62,
2791,
11,
509,
3705,
62,
44,
24805,
2751,
198,
6738,
764,
7645,
23914,
1330,
18328,
62,
76,
5912,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.715232 | 302 |
#!/usr/bin/env python
import os
import sys
import ci_lib
batches = []
if 0 and os.uname()[0] == 'Linux':
batches += [
[
"sudo chown `whoami`: ~",
"chmod u=rwx,g=rx,o= ~",
"sudo mkdir /var/run/sshd",
"sudo /etc/init.d/ssh start",
"mkdir -p ~/.ssh",
"chmod u=rwx,go= ~/.ssh",
"ssh-keyscan -H localhost >> ~/.ssh/known_hosts",
"chmod u=rw,go= ~/.ssh/known_hosts",
"cat tests/data/docker/mitogen__has_sudo_pubkey.key > ~/.ssh/id_rsa",
"chmod u=rw,go= ~/.ssh/id_rsa",
"cat tests/data/docker/mitogen__has_sudo_pubkey.key.pub > ~/.ssh/authorized_keys",
"chmod u=rw,go=r ~/.ssh/authorized_keys",
]
]
if ci_lib.have_apt():
batches.append([
'echo force-unsafe-io | sudo tee /etc/dpkg/dpkg.cfg.d/nosync',
'sudo add-apt-repository ppa:deadsnakes/ppa',
'sudo apt-get update',
'sudo apt-get -y install '
'python{pv} '
'python{pv}-dev '
'libsasl2-dev '
'libldap2-dev '
.format(pv=os.environ['PYTHONVERSION'])
])
ci_lib.run_batches(batches)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
28686,
198,
11748,
25064,
198,
198,
11748,
269,
72,
62,
8019,
198,
198,
8664,
2052,
796,
17635,
198,
198,
361,
657,
290,
28686,
13,
403,
480,
3419,
58,
15,
60,
6624,
705,
19314,
10354,
198,
220,
220,
220,
37830,
15853,
685,
198,
220,
220,
220,
220,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
24032,
442,
593,
4600,
8727,
6277,
63,
25,
5299,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
354,
4666,
334,
28,
31653,
87,
11,
70,
28,
40914,
11,
78,
28,
5299,
1600,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
24032,
33480,
15908,
1220,
7785,
14,
5143,
14,
824,
31298,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
24032,
1220,
14784,
14,
15003,
13,
67,
14,
45824,
923,
1600,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
28015,
15908,
532,
79,
39763,
45824,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
354,
4666,
334,
28,
31653,
87,
11,
2188,
28,
39763,
45824,
1600,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
45824,
12,
13083,
5171,
532,
39,
1957,
4774,
9609,
39763,
45824,
14,
4002,
62,
4774,
82,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
354,
4666,
334,
28,
31653,
11,
2188,
28,
39763,
45824,
14,
4002,
62,
4774,
82,
1600,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
9246,
5254,
14,
7890,
14,
45986,
14,
2781,
6644,
834,
10134,
62,
24032,
62,
12984,
2539,
13,
2539,
1875,
39763,
45824,
14,
312,
62,
3808,
64,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
354,
4666,
334,
28,
31653,
11,
2188,
28,
39763,
45824,
14,
312,
62,
3808,
64,
1600,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
9246,
5254,
14,
7890,
14,
45986,
14,
2781,
6644,
834,
10134,
62,
24032,
62,
12984,
2539,
13,
2539,
13,
12984,
1875,
39763,
45824,
14,
19721,
62,
13083,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
354,
4666,
334,
28,
31653,
11,
2188,
28,
81,
39763,
45824,
14,
19721,
62,
13083,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
2361,
198,
198,
361,
269,
72,
62,
8019,
13,
14150,
62,
2373,
33529,
198,
220,
220,
220,
37830,
13,
33295,
26933,
198,
220,
220,
220,
220,
220,
220,
220,
705,
30328,
2700,
12,
13271,
8635,
12,
952,
930,
21061,
30479,
1220,
14784,
14,
26059,
10025,
14,
26059,
10025,
13,
37581,
13,
67,
14,
39369,
13361,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
24032,
751,
12,
2373,
12,
260,
1930,
37765,
279,
8957,
25,
25124,
16184,
1124,
14,
44989,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
24032,
15409,
12,
1136,
4296,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
24032,
15409,
12,
1136,
532,
88,
2721,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
29412,
90,
79,
85,
92,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
29412,
90,
79,
85,
92,
12,
7959,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
8019,
82,
292,
75,
17,
12,
7959,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
8019,
335,
499,
17,
12,
7959,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
764,
18982,
7,
79,
85,
28,
418,
13,
268,
2268,
17816,
47,
56,
4221,
1340,
43717,
6,
12962,
198,
220,
220,
220,
33761,
198,
198,
979,
62,
8019,
13,
5143,
62,
8664,
2052,
7,
8664,
2052,
8,
198
] | 1.821483 | 661 |
from django.shortcuts import render, redirect
from django.http import HttpResponse, Http404
from .models import Order, _get_all_order
from .forms import DriverModelForm, OrderModelForm, StoreModelForm
| [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
11,
18941,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
11,
367,
29281,
26429,
198,
6738,
764,
27530,
1330,
8284,
11,
4808,
1136,
62,
439,
62,
2875,
198,
6738,
764,
23914,
1330,
12434,
17633,
8479,
11,
8284,
17633,
8479,
11,
9363,
17633,
8479,
628,
628,
628,
628
] | 3.649123 | 57 |
# a simple Ngram finder
# only feasible for 3.x version
# original text file must be plain text
n=1 # min N
howmany = 5 # max N
outlength = 200
white_list = []
white_punc = [',','。','“','”','—','?','!','…','"',"'",':','?','!','.',',']
file_raw = open('put full path to youre text file here','r',encoding='utf-8')
file_out = open('output file with or without full path','w',encoding='utf-8')
full_text = ''
for line in file_raw: #read and remove punctuation
_ = line[:-1].strip().replace(' ','')
for ch in white_punc:
if ch in _:
_ = _.replace(ch, '')
full_text+=_
file_raw.close()
while n<=howmany:
file_out.write('====='+str(n)+'=====\n')
d = search_ngram(n, full_text)
values = list(d.values())
values.sort(key=lambda x:x[0], reverse=True)
outcount = 0
for element in values:
if element[1] not in white_list:
countp = 0
for p in white_punc:
if p not in element[1]:
countp+=1
if countp==len(white_punc):
file_out.write(element[1]+'\t'+str(element[0])+'\n')
outcount+=1
if outcount>outlength:
break
n+=1
file_out.flush()
file_out.close()
| [
2,
257,
2829,
399,
4546,
1064,
263,
198,
2,
691,
23498,
329,
513,
13,
87,
2196,
198,
2,
2656,
2420,
2393,
1276,
307,
8631,
2420,
220,
198,
198,
77,
28,
16,
220,
1303,
949,
399,
198,
4919,
21834,
796,
642,
220,
1303,
3509,
399,
198,
448,
13664,
796,
939,
198,
11186,
62,
4868,
796,
17635,
198,
11186,
62,
79,
19524,
796,
37250,
171,
120,
234,
41707,
16764,
41707,
447,
250,
41707,
447,
251,
41707,
960,
41707,
171,
120,
253,
41707,
171,
120,
223,
41707,
1399,
3256,
29653,
40264,
6,
1600,
6,
171,
120,
248,
3256,
30960,
41707,
0,
41707,
2637,
11,
3256,
20520,
198,
7753,
62,
1831,
796,
1280,
10786,
1996,
1336,
3108,
284,
345,
260,
2420,
2393,
994,
41707,
81,
3256,
12685,
7656,
11639,
40477,
12,
23,
11537,
198,
7753,
62,
448,
796,
1280,
10786,
22915,
2393,
351,
393,
1231,
1336,
3108,
41707,
86,
3256,
12685,
7656,
11639,
40477,
12,
23,
11537,
198,
12853,
62,
5239,
796,
10148,
198,
198,
1640,
1627,
287,
2393,
62,
1831,
25,
220,
1303,
961,
290,
4781,
21025,
2288,
198,
220,
220,
220,
4808,
796,
1627,
58,
21912,
16,
4083,
36311,
22446,
33491,
10786,
705,
4032,
11537,
198,
220,
220,
220,
329,
442,
287,
2330,
62,
79,
19524,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
442,
287,
4808,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
796,
4808,
13,
33491,
7,
354,
11,
10148,
8,
198,
220,
220,
220,
1336,
62,
5239,
47932,
62,
198,
7753,
62,
1831,
13,
19836,
3419,
628,
198,
198,
4514,
299,
27,
28,
4919,
21834,
25,
198,
220,
220,
220,
2393,
62,
448,
13,
13564,
10786,
1421,
11639,
10,
2536,
7,
77,
47762,
6,
1421,
28,
59,
77,
11537,
198,
220,
220,
220,
288,
796,
2989,
62,
782,
859,
7,
77,
11,
1336,
62,
5239,
8,
198,
220,
220,
220,
3815,
796,
1351,
7,
67,
13,
27160,
28955,
198,
220,
220,
220,
3815,
13,
30619,
7,
2539,
28,
50033,
2124,
25,
87,
58,
15,
4357,
9575,
28,
17821,
8,
198,
220,
220,
220,
503,
9127,
796,
657,
198,
220,
220,
220,
329,
5002,
287,
3815,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5002,
58,
16,
60,
407,
287,
2330,
62,
4868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
79,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
279,
287,
2330,
62,
79,
19524,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
407,
287,
5002,
58,
16,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
79,
47932,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
954,
79,
855,
11925,
7,
11186,
62,
79,
19524,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
448,
13,
13564,
7,
30854,
58,
16,
48688,
6,
59,
83,
6,
10,
2536,
7,
30854,
58,
15,
12962,
10,
6,
59,
77,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
9127,
47932,
16,
198,
220,
220,
220,
220,
220,
220,
220,
611,
503,
9127,
29,
448,
13664,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
299,
47932,
16,
198,
220,
220,
220,
2393,
62,
448,
13,
25925,
3419,
628,
198,
7753,
62,
448,
13,
19836,
3419,
198
] | 2.08194 | 598 |
#===========================================================================
#
# Report functions
#
#===========================================================================
import time
from ..util import Data
from .Link import Link
#===========================================================================
def power( *args, **kwargs ):
"""Return instantaneous AC and DC power generation.
Inputs are the same as Link() constructor:
obj = report.instant( '192.168.1.15' )
print obj
"""
with Link( *args, **kwargs ) as link:
link.decode = False
link.raw = False
dcBytes, dc = link.dcPower()
acBytes, ac = link.acTotalPower()
now = time.time()
obj = dc.decode( dcBytes )
obj.update( ac.decode( acBytes ) )
obj.time = now
obj.dcPower = obj.dcPower1 + obj.dcPower2
return obj
#===========================================================================
def energy( *args, **kwargs ):
"""Return instantaneous power and total energy status.
Get instantaneous AC and DC power generation and energy created for
the day.
Inputs are the same as Link() constructor:
obj = report.energy( '192.168.1.15' )
print obj
"""
with Link( *args, **kwargs ) as link:
link.decode = False
dcBytes, dc = link.dcPower()
acBytes, ac = link.acTotalPower()
totBytes, total = link.acTotalEnergy()
now = time.time()
obj = dc.decode( dcBytes )
obj.update( ac.decode( acBytes ) )
obj.update( total.decode( totBytes ) )
obj.time = now
obj.dcPower = obj.dcPower1 + obj.dcPower2
return obj
#===========================================================================
def full( *args, **kwargs ):
"""Return all possible fields.
Inputs are the same as Link() constructor:
obj = report.full( '192.168.1.15' )
print obj
"""
funcs = [
Link.info,
Link.status,
Link.gridRelayStatus,
Link.temperature,
Link.version,
Link.acTotalEnergy,
Link.acTotalPower,
Link.acPower,
Link.acMaxPower,
Link.operationTime,
Link.dcPower,
Link.dcVoltage,
Link.acVoltage,
Link.gridFrequency,
]
with Link( *args, **kwargs ) as link:
link.decode = False
results = [ f( link ) for f in funcs ]
now = time.time()
obj = Data()
for bytes, decoder in results:
obj.update( decoder.decode( bytes ) )
obj.time = now
obj.dcPower = obj.dcPower1 + obj.dcPower2
return obj
#===========================================================================
| [
2,
23926,
2559,
18604,
198,
2,
198,
2,
6358,
5499,
198,
2,
198,
2,
23926,
2559,
18604,
198,
11748,
640,
198,
6738,
11485,
22602,
1330,
6060,
198,
6738,
764,
11280,
1330,
7502,
198,
198,
2,
23926,
2559,
18604,
198,
4299,
1176,
7,
1635,
22046,
11,
12429,
46265,
22046,
15179,
198,
220,
220,
37227,
13615,
47707,
7125,
290,
6257,
1176,
5270,
13,
628,
220,
220,
23412,
82,
389,
262,
976,
355,
7502,
3419,
23772,
25,
628,
220,
220,
26181,
796,
989,
13,
8625,
415,
7,
705,
17477,
13,
14656,
13,
16,
13,
1314,
6,
1267,
198,
220,
220,
3601,
26181,
198,
220,
220,
37227,
198,
220,
220,
351,
7502,
7,
1635,
22046,
11,
12429,
46265,
22046,
1267,
355,
2792,
25,
198,
220,
220,
220,
220,
220,
2792,
13,
12501,
1098,
796,
10352,
198,
220,
220,
220,
220,
220,
2792,
13,
1831,
796,
10352,
198,
220,
220,
220,
220,
220,
30736,
45992,
11,
30736,
796,
2792,
13,
17896,
13434,
3419,
198,
220,
220,
220,
220,
220,
936,
45992,
11,
936,
796,
2792,
13,
330,
14957,
13434,
3419,
628,
220,
220,
783,
796,
640,
13,
2435,
3419,
198,
220,
220,
26181,
796,
30736,
13,
12501,
1098,
7,
30736,
45992,
1267,
198,
220,
220,
26181,
13,
19119,
7,
936,
13,
12501,
1098,
7,
936,
45992,
1267,
1267,
628,
220,
220,
26181,
13,
2435,
796,
783,
198,
220,
220,
26181,
13,
17896,
13434,
796,
26181,
13,
17896,
13434,
16,
1343,
26181,
13,
17896,
13434,
17,
198,
220,
220,
1441,
26181,
198,
198,
2,
23926,
2559,
18604,
198,
4299,
2568,
7,
1635,
22046,
11,
12429,
46265,
22046,
15179,
198,
220,
220,
37227,
13615,
47707,
1176,
290,
2472,
2568,
3722,
13,
628,
220,
220,
3497,
47707,
7125,
290,
6257,
1176,
5270,
290,
2568,
2727,
329,
198,
220,
220,
262,
1110,
13,
628,
220,
220,
23412,
82,
389,
262,
976,
355,
7502,
3419,
23772,
25,
628,
220,
220,
26181,
796,
989,
13,
22554,
7,
705,
17477,
13,
14656,
13,
16,
13,
1314,
6,
1267,
198,
220,
220,
3601,
26181,
198,
220,
220,
37227,
198,
220,
220,
351,
7502,
7,
1635,
22046,
11,
12429,
46265,
22046,
1267,
355,
2792,
25,
198,
220,
220,
220,
220,
220,
2792,
13,
12501,
1098,
796,
10352,
198,
220,
220,
220,
220,
220,
30736,
45992,
11,
30736,
796,
2792,
13,
17896,
13434,
3419,
198,
220,
220,
220,
220,
220,
936,
45992,
11,
936,
796,
2792,
13,
330,
14957,
13434,
3419,
198,
220,
220,
220,
220,
220,
2006,
45992,
11,
2472,
796,
2792,
13,
330,
14957,
28925,
3419,
198,
220,
220,
220,
220,
220,
220,
198,
220,
220,
783,
796,
640,
13,
2435,
3419,
198,
220,
220,
26181,
796,
30736,
13,
12501,
1098,
7,
30736,
45992,
1267,
198,
220,
220,
26181,
13,
19119,
7,
936,
13,
12501,
1098,
7,
936,
45992,
1267,
1267,
198,
220,
220,
26181,
13,
19119,
7,
2472,
13,
12501,
1098,
7,
2006,
45992,
1267,
1267,
628,
220,
220,
26181,
13,
2435,
796,
783,
198,
220,
220,
26181,
13,
17896,
13434,
796,
26181,
13,
17896,
13434,
16,
1343,
26181,
13,
17896,
13434,
17,
198,
220,
220,
1441,
26181,
198,
220,
220,
220,
198,
2,
23926,
2559,
18604,
198,
4299,
1336,
7,
1635,
22046,
11,
12429,
46265,
22046,
15179,
198,
220,
220,
37227,
13615,
477,
1744,
7032,
13,
198,
220,
220,
220,
198,
220,
220,
23412,
82,
389,
262,
976,
355,
7502,
3419,
23772,
25,
628,
220,
220,
26181,
796,
989,
13,
12853,
7,
705,
17477,
13,
14656,
13,
16,
13,
1314,
6,
1267,
198,
220,
220,
3601,
26181,
198,
220,
220,
37227,
198,
220,
220,
1257,
6359,
796,
685,
198,
220,
220,
220,
220,
220,
7502,
13,
10951,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
13376,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
25928,
6892,
323,
19580,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
11498,
21069,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
9641,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
330,
14957,
28925,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
330,
14957,
13434,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
330,
13434,
11,
220,
198,
220,
220,
220,
220,
220,
7502,
13,
330,
11518,
13434,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
27184,
7575,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
17896,
13434,
11,
220,
198,
220,
220,
220,
220,
220,
7502,
13,
17896,
53,
5978,
496,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
330,
53,
5978,
496,
11,
198,
220,
220,
220,
220,
220,
7502,
13,
25928,
37,
28707,
11,
198,
220,
220,
220,
220,
220,
2361,
628,
220,
220,
351,
7502,
7,
1635,
22046,
11,
12429,
46265,
22046,
1267,
355,
2792,
25,
198,
220,
220,
220,
220,
220,
2792,
13,
12501,
1098,
796,
10352,
198,
220,
220,
220,
220,
220,
2482,
796,
685,
277,
7,
2792,
1267,
329,
277,
287,
1257,
6359,
2361,
628,
220,
220,
783,
796,
640,
13,
2435,
3419,
198,
220,
220,
26181,
796,
6060,
3419,
198,
220,
220,
329,
9881,
11,
875,
12342,
287,
2482,
25,
198,
220,
220,
220,
220,
220,
26181,
13,
19119,
7,
875,
12342,
13,
12501,
1098,
7,
9881,
1267,
1267,
628,
220,
220,
26181,
13,
2435,
796,
783,
198,
220,
220,
26181,
13,
17896,
13434,
796,
26181,
13,
17896,
13434,
16,
1343,
26181,
13,
17896,
13434,
17,
198,
220,
220,
1441,
26181,
198,
198,
2,
23926,
2559,
18604,
198
] | 2.907762 | 889 |
from test.integration.base import DBTIntegrationTest, use_profile
| [
6738,
1332,
13,
18908,
1358,
13,
8692,
1330,
360,
19313,
34500,
1358,
14402,
11,
779,
62,
13317,
628
] | 3.722222 | 18 |
import endpoints
import graylogapi
| [
11748,
886,
13033,
198,
11748,
12768,
6404,
15042,
198
] | 3.888889 | 9 |
"""
Install API Endpoint
"""
# Third Party Library
from django.views import View
from django.http import JsonResponse
from django.utils.translation import gettext as _
# Local Library
from pyvalitron.form import Form
from app.modules.util.helpers import Helpers
from app.modules.core.request import Request
from app.modules.core.response import Response
from app.modules.validation.extension import ExtraRules
from app.modules.core.install import Install as InstallModule
from app.modules.core.decorators import stop_request_if_installed
from app.modules.core.notification import Notification as NotificationModule
| [
37811,
198,
15798,
7824,
5268,
4122,
198,
37811,
198,
198,
2,
10467,
3615,
10074,
198,
6738,
42625,
14208,
13,
33571,
1330,
3582,
198,
6738,
42625,
14208,
13,
4023,
1330,
449,
1559,
31077,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
651,
5239,
355,
4808,
198,
198,
2,
10714,
10074,
198,
6738,
12972,
2100,
270,
1313,
13,
687,
1330,
5178,
198,
6738,
598,
13,
18170,
13,
22602,
13,
16794,
364,
1330,
10478,
364,
198,
6738,
598,
13,
18170,
13,
7295,
13,
25927,
1330,
19390,
198,
6738,
598,
13,
18170,
13,
7295,
13,
26209,
1330,
18261,
198,
6738,
598,
13,
18170,
13,
12102,
341,
13,
2302,
3004,
1330,
17221,
37766,
198,
6738,
598,
13,
18170,
13,
7295,
13,
17350,
1330,
15545,
355,
15545,
26796,
198,
6738,
598,
13,
18170,
13,
7295,
13,
12501,
273,
2024,
1330,
2245,
62,
25927,
62,
361,
62,
37050,
198,
6738,
598,
13,
18170,
13,
7295,
13,
1662,
2649,
1330,
42808,
355,
42808,
26796,
628
] | 3.911392 | 158 |
import pytest
from crawler.core import Downloader, Config, UrlManager
import os
from shutil import rmtree
DEFAULT_INI_PATH = "./tests/config/default.ini"
CONFIG_DIR_PATH = "./tests/config"
test_failed_urls = ["http://www.google.com"]
test_finished_urls = ["http://www.baidu.com"]
test_repeated_urls = []
for i in range(10):
test_repeated_urls.append("http://www.baidu.com")
test_repeated_urls.append("http://www.hubianluanzao2131231231.com")
| [
11748,
12972,
9288,
198,
6738,
27784,
1754,
13,
7295,
1330,
10472,
263,
11,
17056,
11,
8799,
75,
13511,
198,
11748,
28686,
198,
6738,
4423,
346,
1330,
374,
16762,
631,
198,
198,
7206,
38865,
62,
1268,
40,
62,
34219,
796,
366,
19571,
41989,
14,
11250,
14,
12286,
13,
5362,
1,
198,
10943,
16254,
62,
34720,
62,
34219,
796,
366,
19571,
41989,
14,
11250,
1,
198,
198,
9288,
62,
47904,
62,
6371,
82,
796,
14631,
4023,
1378,
2503,
13,
13297,
13,
785,
8973,
198,
9288,
62,
43952,
62,
6371,
82,
796,
14631,
4023,
1378,
2503,
13,
65,
1698,
84,
13,
785,
8973,
198,
9288,
62,
45956,
515,
62,
6371,
82,
796,
17635,
198,
1640,
1312,
287,
2837,
7,
940,
2599,
198,
220,
220,
220,
1332,
62,
45956,
515,
62,
6371,
82,
13,
33295,
7203,
4023,
1378,
2503,
13,
65,
1698,
84,
13,
785,
4943,
198,
220,
220,
220,
1332,
62,
45956,
515,
62,
6371,
82,
13,
33295,
7203,
4023,
1378,
2503,
13,
40140,
666,
2290,
35819,
78,
26427,
10163,
1065,
3132,
13,
785,
4943,
628
] | 2.618497 | 173 |
# Generated by Django 3.0.7 on 2020-07-01 17:59
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
513,
13,
15,
13,
22,
319,
12131,
12,
2998,
12,
486,
1596,
25,
3270,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.84375 | 32 |
import pytest
from cogctl.cli.relay import relay
import responses
@pytest.fixture(autouse=True)
| [
11748,
12972,
9288,
198,
6738,
43072,
34168,
13,
44506,
13,
2411,
323,
1330,
24248,
198,
11748,
9109,
628,
198,
31,
9078,
9288,
13,
69,
9602,
7,
2306,
1076,
28,
17821,
8,
628,
628,
628,
628,
628,
628
] | 2.945946 | 37 |
from abc import ABC, abstractmethod
from typing import Callable, Generic, Iterable, List, Optional, Tuple, TypeVar, Union
from helpers.utils import CacheContainer, with_cache
# S and A are used for generic typing where S represents the state type and A represents the action type
S = TypeVar("S")
A = TypeVar("A")
# Game is a generic abstract class for game definitions
# It also implements 'CacheContainer' which allows you to call the "cache" method
# which returns a dictionary in which you can store any data you want to cache
# A heuristic function which estimates the value of a given state for a certain agent within a certain game.
# E.g. if the heuristic function returns a high value for a certain agent, it should return low values for their enemies.
HeuristicFunction = Callable[[Game[S, A], S, int], float] | [
6738,
450,
66,
1330,
9738,
11,
12531,
24396,
198,
6738,
19720,
1330,
4889,
540,
11,
42044,
11,
40806,
540,
11,
7343,
11,
32233,
11,
309,
29291,
11,
5994,
19852,
11,
4479,
198,
6738,
49385,
13,
26791,
1330,
34088,
29869,
11,
351,
62,
23870,
198,
198,
2,
311,
290,
317,
389,
973,
329,
14276,
19720,
810,
311,
6870,
262,
1181,
2099,
290,
317,
6870,
262,
2223,
2099,
198,
50,
796,
5994,
19852,
7203,
50,
4943,
198,
32,
796,
5994,
19852,
7203,
32,
4943,
198,
198,
2,
3776,
318,
257,
14276,
12531,
1398,
329,
983,
17336,
198,
2,
632,
635,
23986,
705,
30562,
29869,
6,
543,
3578,
345,
284,
869,
262,
366,
23870,
1,
2446,
198,
2,
543,
5860,
257,
22155,
287,
543,
345,
460,
3650,
597,
1366,
345,
765,
284,
12940,
198,
198,
2,
317,
339,
27915,
2163,
543,
7746,
262,
1988,
286,
257,
1813,
1181,
329,
257,
1728,
5797,
1626,
257,
1728,
983,
13,
198,
2,
412,
13,
70,
13,
611,
262,
339,
27915,
2163,
5860,
257,
1029,
1988,
329,
257,
1728,
5797,
11,
340,
815,
1441,
1877,
3815,
329,
511,
5775,
13,
198,
1544,
27915,
22203,
796,
4889,
540,
30109,
8777,
58,
50,
11,
317,
4357,
311,
11,
493,
4357,
12178,
60
] | 4.049261 | 203 |
from models.constants import CONFIGURATION_FILE_PATH, CONFIGURATION_FILENAME
from os import path
import json
try:
config = path.join(CONFIGURATION_FILE_PATH, CONFIGURATION_FILENAME)
with open(config) as configuration_file:
config = json.load(configuration_file)
except FileNotFoundError:
config = dict()
| [
6738,
4981,
13,
9979,
1187,
1330,
25626,
4261,
6234,
62,
25664,
62,
34219,
11,
25626,
4261,
6234,
62,
46700,
1677,
10067,
198,
6738,
28686,
1330,
3108,
198,
11748,
33918,
198,
198,
28311,
25,
198,
220,
220,
220,
4566,
796,
3108,
13,
22179,
7,
10943,
16254,
4261,
6234,
62,
25664,
62,
34219,
11,
25626,
4261,
6234,
62,
46700,
1677,
10067,
8,
198,
220,
220,
220,
351,
1280,
7,
11250,
8,
355,
8398,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
796,
33918,
13,
2220,
7,
11250,
3924,
62,
7753,
8,
198,
16341,
9220,
3673,
21077,
12331,
25,
198,
220,
220,
220,
4566,
796,
8633,
3419,
198
] | 2.981651 | 109 |
from pymongo.cursor import Cursor
import bson.objectid
import datetime
import json
import pytz
from ..jobs.jobs import Job
def sse_pack(d):
"""
Format a map with Server-Sent-Event-meaningful keys into a string for transport.
Happily borrowed from: http://taoofmac.com/space/blog/2014/11/16/1940
For reading on web usage: http://www.html5rocks.com/en/tutorials/eventsource/basics
For reading on the format: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format
"""
buffer_ = ''
for k in ['retry', 'id', 'event', 'data']:
if k in d.keys():
buffer_ += '%s: %s\n' % (k, d[k])
return buffer_ + '\n'
def json_sse_pack(d):
"""
Variant of sse_pack that will json-encode your data blob.
"""
d['data'] = json.dumps(d['data'], default=custom_json_serializer)
return sse_pack(d)
def pseudo_consistent_json_encode(d):
"""
Some parts of our system rely upon consistently-produced JSON encoding.
This implementation is not guaranteed to be consistent, but it's good enough for now.
"""
return json.dumps(d, sort_keys=True, indent=4, separators=(',', ': ')) + '\n'
| [
6738,
279,
4948,
25162,
13,
66,
21471,
1330,
327,
21471,
198,
11748,
275,
1559,
13,
15252,
312,
198,
11748,
4818,
8079,
198,
11748,
33918,
198,
11748,
12972,
22877,
198,
198,
6738,
11485,
43863,
13,
43863,
1330,
15768,
628,
198,
4299,
264,
325,
62,
8002,
7,
67,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
18980,
257,
3975,
351,
9652,
12,
31837,
12,
9237,
12,
24815,
913,
8251,
656,
257,
4731,
329,
4839,
13,
628,
220,
220,
220,
18321,
813,
22546,
422,
25,
220,
220,
220,
220,
220,
2638,
1378,
83,
5488,
1659,
20285,
13,
785,
14,
13200,
14,
14036,
14,
4967,
14,
1157,
14,
1433,
14,
1129,
1821,
198,
220,
220,
220,
1114,
3555,
319,
3992,
8748,
25,
220,
220,
2638,
1378,
2503,
13,
6494,
20,
305,
4657,
13,
785,
14,
268,
14,
83,
44917,
82,
14,
31534,
1668,
14,
12093,
873,
198,
220,
220,
220,
1114,
3555,
319,
262,
5794,
25,
220,
3740,
1378,
16244,
263,
13,
5908,
16496,
13,
2398,
14,
268,
12,
2937,
14,
31628,
14,
13908,
14,
17614,
14,
10697,
12,
34086,
62,
31534,
14,
12814,
62,
15388,
12,
34086,
62,
31534,
2,
9237,
62,
5532,
62,
18982,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
11876,
62,
796,
10148,
628,
220,
220,
220,
329,
479,
287,
37250,
1186,
563,
3256,
705,
312,
3256,
705,
15596,
3256,
705,
7890,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
611,
479,
287,
288,
13,
13083,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11876,
62,
15853,
705,
4,
82,
25,
4064,
82,
59,
77,
6,
4064,
357,
74,
11,
288,
58,
74,
12962,
628,
220,
220,
220,
1441,
11876,
62,
1343,
705,
59,
77,
6,
198,
198,
4299,
33918,
62,
82,
325,
62,
8002,
7,
67,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
38215,
286,
264,
325,
62,
8002,
326,
481,
33918,
12,
268,
8189,
534,
1366,
44812,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
288,
17816,
7890,
20520,
796,
33918,
13,
67,
8142,
7,
67,
17816,
7890,
6,
4357,
4277,
28,
23144,
62,
17752,
62,
46911,
7509,
8,
628,
220,
220,
220,
1441,
264,
325,
62,
8002,
7,
67,
8,
198,
198,
4299,
24543,
62,
5936,
7609,
62,
17752,
62,
268,
8189,
7,
67,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2773,
3354,
286,
674,
1080,
8814,
2402,
9835,
12,
32783,
19449,
21004,
13,
198,
220,
220,
220,
770,
7822,
318,
407,
11462,
284,
307,
6414,
11,
475,
340,
338,
922,
1576,
329,
783,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1441,
33918,
13,
67,
8142,
7,
67,
11,
3297,
62,
13083,
28,
17821,
11,
33793,
28,
19,
11,
2880,
2024,
16193,
3256,
3256,
705,
25,
705,
4008,
1343,
705,
59,
77,
6,
198
] | 2.609808 | 469 |
# -*- coding: utf-8 -*-
from django.core import mail
from nose.tools import eq_
from kitsune.sumo.tests import post
from kitsune.users.tests import add_permission, user
from kitsune.wiki.config import (
SIGNIFICANCES, MEDIUM_SIGNIFICANCE, TYPO_SIGNIFICANCE)
from kitsune.wiki.events import (
ReadyRevisionEvent, ApproveRevisionInLocaleEvent)
from kitsune.wiki.models import Revision
from kitsune.wiki.tests import revision, TestCaseBase
def _set_up_ready_watcher():
"""Make a user who watches for revision readiness."""
ready_watcher = user(email='[email protected]', save=True)
ReadyRevisionEvent.notify(ready_watcher)
return ready_watcher
class ReviewTests(TestCaseBase):
"""Tests for notifications sent during revision review"""
def setUp(self):
"""Have a user watch for revision approval. Log in."""
self.approved_watcher = user(email='[email protected]', save=True)
ApproveRevisionInLocaleEvent.notify(self.approved_watcher,
locale='en-US')
approver = user(save=True)
add_permission(approver, Revision, 'review_revision')
add_permission(approver, Revision, 'mark_ready_for_l10n')
self.client.login(username=approver.username, password='testpass')
def _review_revision(self, is_approved=True, is_ready=False,
significance=SIGNIFICANCES[0][0], r=None,
comment=None):
"""Make a revision, and approve or reject it through the view."""
if not r:
r = revision(is_approved=False,
is_ready_for_localization=False,
significance=significance,
save=True)
# Figure out POST data:
data = {'comment': 'đSome comment'}
if is_approved:
data['approve'] = 'Approve Revision'
data['significance'] = significance
if is_ready:
data['is_ready_for_localization'] = 'on'
if comment:
data['comment'] = comment
else:
data['reject'] = 'Reject Revision'
response = post(self.client,
'wiki.review_revision',
data,
args=[r.document.slug, r.id])
eq_(200, response.status_code)
def test_ready(self):
"""Show that a ready(-and-approved) rev mails Ready watchers a Ready
notification and Approved watchers an Approved one."""
_set_up_ready_watcher()
self._review_revision(is_ready=True, significance=MEDIUM_SIGNIFICANCE)
# 1 mail to each watcher, 1 to the creator, and one to the reviewer
eq_(4, len(mail.outbox))
_assert_ready_mail(mail.outbox[0])
_assert_approved_mail(mail.outbox[1])
_assert_creator_mail(mail.outbox[2])
def test_approved(self):
"""Show that an approved rev mails Ready watchers nothing and Approved
watchers an Approved notification."""
_set_up_ready_watcher()
self._review_revision(is_ready=False)
# 1 mail to Approved watcher, 1 to creator, 1 for reviewer
eq_(3, len(mail.outbox))
assert 'new approved revision' in mail.outbox[0].subject
assert 'Your revision has been approved' in mail.outbox[1].subject
def test_neither(self):
"""Show that neither an Approved nor a Ready mail is sent if a rev is
rejected."""
_set_up_ready_watcher()
self._review_revision(is_approved=False)
eq_(2, len(mail.outbox)) # 1 mail to creator, one to the reviewer.
assert mail.outbox[0].subject.startswith(
'Your revision has been reviewed')
def test_user_watching_both(self):
"""If a single person is watching ready and approved revisions and a
revision becomes ready, send only the readiness email, not the approval
one."""
# Have the Approved watcher watch Ready as well:
ReadyRevisionEvent.notify(self.approved_watcher)
self._review_revision(is_ready=True, significance=MEDIUM_SIGNIFICANCE)
# 1 mail to watcher, 1 to creator, 1 to reviewer
eq_(3, len(mail.outbox))
_assert_ready_mail(mail.outbox[0])
_assert_creator_mail(mail.outbox[1])
def test_new_lines_in_review_message(self):
"""Test that newlines in a review message are properly displayed."""
_set_up_ready_watcher()
self._review_revision(comment='foo\n\nbar\nbaz')
assert 'foo<br><br>bar<br>baz' in mail.outbox[1].alternatives[0][0]
class ReadyForL10nTests(TestCaseBase):
"""Tests for notifications sent during ready for l10n"""
def setUp(self):
"""Have a user watch for revision approval. Log in."""
self.ready_watcher = user(email='[email protected]', save=True)
ReadyRevisionEvent.notify(self.ready_watcher)
readyer = user(save=True)
add_permission(readyer, Revision, 'mark_ready_for_l10n')
self.client.login(username=readyer.username, password='testpass')
def _mark_as_ready_revision(self):
"""Make a revision, and approve or reject it through the view."""
r = revision(is_approved=True,
is_ready_for_localization=False,
significance=MEDIUM_SIGNIFICANCE,
save=True)
# Figure out POST data:
data = {'comment': 'something'}
response = post(self.client,
'wiki.mark_ready_for_l10n_revision',
data,
args=[r.document.slug, r.id])
eq_(200, response.status_code)
def test_ready(self):
"""Show that a ready(-and-approved) rev mails Ready watchers a Ready
notification and Approved watchers an Approved one."""
_set_up_ready_watcher()
self._mark_as_ready_revision()
eq_(2, len(mail.outbox)) # 1 mail to each watcher, none to marker
_assert_ready_mail(mail.outbox[0])
_assert_ready_mail(mail.outbox[1])
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
42625,
14208,
13,
7295,
1330,
6920,
198,
198,
6738,
9686,
13,
31391,
1330,
37430,
62,
198,
198,
6738,
19183,
1726,
13,
16345,
78,
13,
41989,
1330,
1281,
198,
6738,
19183,
1726,
13,
18417,
13,
41989,
1330,
751,
62,
525,
3411,
11,
2836,
198,
6738,
19183,
1726,
13,
15466,
13,
11250,
1330,
357,
198,
220,
220,
220,
36771,
30643,
20940,
1546,
11,
26112,
41796,
62,
46224,
30643,
19240,
11,
24412,
16402,
62,
46224,
30643,
19240,
8,
198,
6738,
19183,
1726,
13,
15466,
13,
31534,
1330,
357,
198,
220,
220,
220,
23432,
18009,
1166,
9237,
11,
20010,
303,
18009,
1166,
818,
33711,
1000,
9237,
8,
198,
6738,
19183,
1726,
13,
15466,
13,
27530,
1330,
46604,
198,
6738,
19183,
1726,
13,
15466,
13,
41989,
1330,
18440,
11,
6208,
20448,
14881,
628,
628,
198,
198,
4299,
4808,
2617,
62,
929,
62,
1493,
62,
86,
34734,
33529,
198,
220,
220,
220,
37227,
12050,
257,
2836,
508,
16860,
329,
18440,
30618,
526,
15931,
198,
220,
220,
220,
3492,
62,
86,
34734,
796,
2836,
7,
12888,
11639,
1493,
31,
20688,
13,
785,
3256,
3613,
28,
17821,
8,
198,
220,
220,
220,
23432,
18009,
1166,
9237,
13,
1662,
1958,
7,
1493,
62,
86,
34734,
8,
198,
220,
220,
220,
1441,
3492,
62,
86,
34734,
628,
198,
4871,
6602,
51,
3558,
7,
14402,
20448,
14881,
2599,
198,
220,
220,
220,
37227,
51,
3558,
329,
19605,
1908,
1141,
18440,
2423,
37811,
628,
220,
220,
220,
825,
900,
4933,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
11980,
257,
2836,
2342,
329,
18440,
7546,
13,
5972,
287,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29137,
62,
86,
34734,
796,
2836,
7,
12888,
11639,
29137,
31,
20688,
13,
785,
3256,
3613,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
20010,
303,
18009,
1166,
818,
33711,
1000,
9237,
13,
1662,
1958,
7,
944,
13,
29137,
62,
86,
34734,
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,
36693,
11639,
268,
12,
2937,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1331,
332,
796,
2836,
7,
21928,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
751,
62,
525,
3411,
7,
21064,
332,
11,
46604,
11,
705,
19023,
62,
260,
10178,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
751,
62,
525,
3411,
7,
21064,
332,
11,
46604,
11,
705,
4102,
62,
1493,
62,
1640,
62,
75,
940,
77,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16366,
13,
38235,
7,
29460,
28,
21064,
332,
13,
29460,
11,
9206,
11639,
9288,
6603,
11537,
628,
220,
220,
220,
825,
4808,
19023,
62,
260,
10178,
7,
944,
11,
318,
62,
29137,
28,
17821,
11,
318,
62,
1493,
28,
25101,
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,
12085,
28,
46224,
30643,
20940,
1546,
58,
15,
7131,
15,
4357,
374,
28,
14202,
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,
2912,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
12050,
257,
18440,
11,
290,
14762,
393,
4968,
340,
832,
262,
1570,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
374,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
796,
18440,
7,
271,
62,
29137,
28,
25101,
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,
318,
62,
1493,
62,
1640,
62,
12001,
1634,
28,
25101,
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,
12085,
28,
12683,
811,
590,
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,
3613,
28,
17821,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
11291,
503,
24582,
1366,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1391,
6,
23893,
10354,
705,
128,
239,
4366,
2912,
6,
92,
198,
220,
220,
220,
220,
220,
220,
220,
611,
318,
62,
29137,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
17816,
21064,
303,
20520,
796,
705,
4677,
305,
303,
46604,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
17816,
12683,
811,
590,
20520,
796,
12085,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
62,
1493,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
17816,
271,
62,
1493,
62,
1640,
62,
12001,
1634,
20520,
796,
705,
261,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2912,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
17816,
23893,
20520,
796,
2912,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
17816,
260,
752,
20520,
796,
705,
3041,
752,
46604,
6,
628,
220,
220,
220,
220,
220,
220,
220,
2882,
796,
1281,
7,
944,
13,
16366,
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,
705,
15466,
13,
19023,
62,
260,
10178,
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,
1366,
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,
26498,
41888,
81,
13,
22897,
13,
6649,
1018,
11,
374,
13,
312,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
37430,
41052,
2167,
11,
2882,
13,
13376,
62,
8189,
8,
628,
220,
220,
220,
825,
1332,
62,
1493,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15307,
326,
257,
3492,
32590,
392,
12,
29137,
8,
2710,
285,
1768,
23432,
4383,
3533,
257,
23432,
198,
220,
220,
220,
220,
220,
220,
220,
14483,
290,
20010,
1079,
4383,
3533,
281,
20010,
1079,
530,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
2617,
62,
929,
62,
1493,
62,
86,
34734,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
19023,
62,
260,
10178,
7,
271,
62,
1493,
28,
17821,
11,
12085,
28,
30733,
41796,
62,
46224,
30643,
19240,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
352,
6920,
284,
1123,
4383,
2044,
11,
352,
284,
262,
13172,
11,
290,
530,
284,
262,
37823,
198,
220,
220,
220,
220,
220,
220,
220,
37430,
41052,
19,
11,
18896,
7,
4529,
13,
448,
3524,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
30493,
62,
1493,
62,
4529,
7,
4529,
13,
448,
3524,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
30493,
62,
29137,
62,
4529,
7,
4529,
13,
448,
3524,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
30493,
62,
45382,
62,
4529,
7,
4529,
13,
448,
3524,
58,
17,
12962,
628,
220,
220,
220,
825,
1332,
62,
29137,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15307,
326,
281,
6325,
2710,
285,
1768,
23432,
4383,
3533,
2147,
290,
20010,
1079,
198,
220,
220,
220,
220,
220,
220,
220,
4383,
3533,
281,
20010,
1079,
14483,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
2617,
62,
929,
62,
1493,
62,
86,
34734,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
19023,
62,
260,
10178,
7,
271,
62,
1493,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
352,
6920,
284,
20010,
1079,
4383,
2044,
11,
352,
284,
13172,
11,
352,
329,
37823,
198,
220,
220,
220,
220,
220,
220,
220,
37430,
41052,
18,
11,
18896,
7,
4529,
13,
448,
3524,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
705,
3605,
6325,
18440,
6,
287,
6920,
13,
448,
3524,
58,
15,
4083,
32796,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
705,
7120,
18440,
468,
587,
6325,
6,
287,
6920,
13,
448,
3524,
58,
16,
4083,
32796,
628,
220,
220,
220,
825,
1332,
62,
710,
1555,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15307,
326,
6159,
281,
20010,
1079,
4249,
257,
23432,
6920,
318,
1908,
611,
257,
2710,
318,
198,
220,
220,
220,
220,
220,
220,
220,
8606,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
2617,
62,
929,
62,
1493,
62,
86,
34734,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
19023,
62,
260,
10178,
7,
271,
62,
29137,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
37430,
41052,
17,
11,
18896,
7,
4529,
13,
448,
3524,
4008,
220,
1303,
352,
6920,
284,
13172,
11,
530,
284,
262,
37823,
13,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
6920,
13,
448,
3524,
58,
15,
4083,
32796,
13,
9688,
2032,
342,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
7120,
18440,
468,
587,
11765,
11537,
628,
220,
220,
220,
825,
1332,
62,
7220,
62,
50042,
62,
16885,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
1532,
257,
2060,
1048,
318,
4964,
3492,
290,
6325,
33315,
290,
257,
198,
220,
220,
220,
220,
220,
220,
220,
18440,
4329,
3492,
11,
3758,
691,
262,
30618,
3053,
11,
407,
262,
7546,
198,
220,
220,
220,
220,
220,
220,
220,
530,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
8192,
262,
20010,
1079,
4383,
2044,
2342,
23432,
355,
880,
25,
198,
220,
220,
220,
220,
220,
220,
220,
23432,
18009,
1166,
9237,
13,
1662,
1958,
7,
944,
13,
29137,
62,
86,
34734,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
19023,
62,
260,
10178,
7,
271,
62,
1493,
28,
17821,
11,
12085,
28,
30733,
41796,
62,
46224,
30643,
19240,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
352,
6920,
284,
4383,
2044,
11,
352,
284,
13172,
11,
352,
284,
37823,
198,
220,
220,
220,
220,
220,
220,
220,
37430,
41052,
18,
11,
18896,
7,
4529,
13,
448,
3524,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
30493,
62,
1493,
62,
4529,
7,
4529,
13,
448,
3524,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
30493,
62,
45382,
62,
4529,
7,
4529,
13,
448,
3524,
58,
16,
12962,
628,
220,
220,
220,
825,
1332,
62,
3605,
62,
6615,
62,
259,
62,
19023,
62,
20500,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
14402,
326,
649,
6615,
287,
257,
2423,
3275,
389,
6105,
9066,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
2617,
62,
929,
62,
1493,
62,
86,
34734,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
19023,
62,
260,
10178,
7,
23893,
11639,
21943,
59,
77,
59,
77,
5657,
59,
46803,
1031,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
705,
21943,
27,
1671,
6927,
1671,
29,
5657,
27,
1671,
29,
65,
1031,
6,
287,
6920,
13,
448,
3524,
58,
16,
4083,
33645,
2929,
58,
15,
7131,
15,
60,
628,
198,
4871,
23432,
1890,
43,
940,
77,
51,
3558,
7,
14402,
20448,
14881,
2599,
198,
220,
220,
220,
37227,
51,
3558,
329,
19605,
1908,
1141,
3492,
329,
300,
940,
77,
37811,
628,
220,
220,
220,
825,
900,
4933,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
11980,
257,
2836,
2342,
329,
18440,
7546,
13,
5972,
287,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1493,
62,
86,
34734,
796,
2836,
7,
12888,
11639,
29137,
31,
20688,
13,
785,
3256,
3613,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
23432,
18009,
1166,
9237,
13,
1662,
1958,
7,
944,
13,
1493,
62,
86,
34734,
8,
628,
220,
220,
220,
220,
220,
220,
220,
3492,
263,
796,
2836,
7,
21928,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
751,
62,
525,
3411,
7,
1493,
263,
11,
46604,
11,
705,
4102,
62,
1493,
62,
1640,
62,
75,
940,
77,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16366,
13,
38235,
7,
29460,
28,
1493,
263,
13,
29460,
11,
9206,
11639,
9288,
6603,
11537,
628,
220,
220,
220,
825,
4808,
4102,
62,
292,
62,
1493,
62,
260,
10178,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
12050,
257,
18440,
11,
290,
14762,
393,
4968,
340,
832,
262,
1570,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
374,
796,
18440,
7,
271,
62,
29137,
28,
17821,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
1493,
62,
1640,
62,
12001,
1634,
28,
25101,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12085,
28,
30733,
41796,
62,
46224,
30643,
19240,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3613,
28,
17821,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
11291,
503,
24582,
1366,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1391,
6,
23893,
10354,
705,
18927,
6,
92,
628,
220,
220,
220,
220,
220,
220,
220,
2882,
796,
1281,
7,
944,
13,
16366,
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,
705,
15466,
13,
4102,
62,
1493,
62,
1640,
62,
75,
940,
77,
62,
260,
10178,
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,
1366,
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,
26498,
41888,
81,
13,
22897,
13,
6649,
1018,
11,
374,
13,
312,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
37430,
41052,
2167,
11,
2882,
13,
13376,
62,
8189,
8,
628,
220,
220,
220,
825,
1332,
62,
1493,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15307,
326,
257,
3492,
32590,
392,
12,
29137,
8,
2710,
285,
1768,
23432,
4383,
3533,
257,
23432,
198,
220,
220,
220,
220,
220,
220,
220,
14483,
290,
20010,
1079,
4383,
3533,
281,
20010,
1079,
530,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
2617,
62,
929,
62,
1493,
62,
86,
34734,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
4102,
62,
292,
62,
1493,
62,
260,
10178,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
37430,
41052,
17,
11,
18896,
7,
4529,
13,
448,
3524,
4008,
220,
1303,
352,
6920,
284,
1123,
4383,
2044,
11,
4844,
284,
18364,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
30493,
62,
1493,
62,
4529,
7,
4529,
13,
448,
3524,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
30493,
62,
1493,
62,
4529,
7,
4529,
13,
448,
3524,
58,
16,
12962,
198
] | 2.308974 | 2,641 |
from sys import version_info
import inspect
from weakref import WeakSet, WeakKeyDictionary
from collections import deque
from functools import partial
class Signal(object):
""" basic signal emitter
fired signals are added to this object's calling frame -
if this becomes excessive, this
also includes mode to add function calls to queue
instead of directly firing connnected functions
queue support not complete yet, as nothing I use needs it.
"""
queues = {"default" : deque()}
def __init__(self, queue="", useQueue=False):
""":param queue : name of queue to use, or external queue object """
self._functions = WeakSet()
self._methods = WeakKeyDictionary()
# is signal active
self._active = True
# event queue support
self._useQueue = useQueue
self._queue = queue or "default"
def getQueue(self, name="default", create=True):
"""return one of the event queues attended by signal objects"""
name = name or self._queue or "default"
if not name in self.queues and create:
self.queues[name] = deque()
return self.queues[name]
def setQueue(self, queueName):
""" set signal to use given queue """
self._queue = queueName
def emit(self, *args, **kwargs):
""" brings this object up to rough parity with qt signals """
self(*args, **kwargs) | [
198,
6738,
25064,
1330,
2196,
62,
10951,
628,
198,
11748,
10104,
198,
6738,
4939,
5420,
1330,
28788,
7248,
11,
28788,
9218,
35,
14188,
198,
6738,
17268,
1330,
390,
4188,
198,
6738,
1257,
310,
10141,
1330,
13027,
628,
198,
4871,
26484,
7,
15252,
2599,
198,
197,
37811,
4096,
6737,
795,
1967,
198,
197,
26803,
10425,
389,
2087,
284,
428,
2134,
338,
4585,
5739,
532,
198,
197,
361,
428,
4329,
13181,
11,
428,
198,
197,
14508,
3407,
4235,
284,
751,
2163,
3848,
284,
16834,
198,
197,
38070,
286,
3264,
9645,
48260,
1606,
276,
5499,
628,
197,
36560,
1104,
407,
1844,
1865,
11,
355,
2147,
314,
779,
2476,
340,
13,
198,
197,
37811,
198,
197,
198,
197,
4188,
947,
796,
19779,
12286,
1,
1058,
390,
4188,
3419,
92,
198,
197,
198,
197,
4299,
11593,
15003,
834,
7,
944,
11,
16834,
2625,
1600,
779,
34991,
28,
25101,
2599,
198,
197,
197,
15931,
1298,
17143,
16834,
1058,
1438,
286,
16834,
284,
779,
11,
393,
7097,
16834,
2134,
37227,
198,
197,
197,
944,
13557,
12543,
2733,
796,
28788,
7248,
3419,
198,
197,
197,
944,
13557,
24396,
82,
796,
28788,
9218,
35,
14188,
3419,
628,
197,
197,
2,
318,
6737,
4075,
198,
197,
197,
944,
13557,
5275,
796,
6407,
628,
197,
197,
2,
1785,
16834,
1104,
198,
197,
197,
944,
13557,
1904,
34991,
796,
779,
34991,
198,
197,
197,
944,
13557,
36560,
796,
16834,
393,
366,
12286,
1,
628,
197,
4299,
651,
34991,
7,
944,
11,
1438,
2625,
12286,
1600,
2251,
28,
17821,
2599,
198,
197,
197,
37811,
7783,
530,
286,
262,
1785,
43359,
9141,
416,
6737,
5563,
37811,
198,
197,
197,
3672,
796,
1438,
393,
2116,
13557,
36560,
393,
366,
12286,
1,
198,
197,
197,
361,
407,
1438,
287,
2116,
13,
4188,
947,
290,
2251,
25,
198,
197,
197,
197,
944,
13,
4188,
947,
58,
3672,
60,
796,
390,
4188,
3419,
198,
197,
197,
7783,
2116,
13,
4188,
947,
58,
3672,
60,
628,
197,
4299,
900,
34991,
7,
944,
11,
16834,
5376,
2599,
198,
197,
197,
37811,
900,
6737,
284,
779,
1813,
16834,
37227,
198,
197,
197,
944,
13557,
36560,
796,
16834,
5376,
628,
197,
4299,
27588,
7,
944,
11,
1635,
22046,
11,
12429,
46265,
22046,
2599,
198,
197,
197,
37811,
6774,
428,
2134,
510,
284,
5210,
34383,
351,
10662,
83,
10425,
37227,
198,
197,
197,
944,
46491,
22046,
11,
12429,
46265,
22046,
8
] | 3.335052 | 388 |
from json import JSONEncoder
import json
| [
6738,
33918,
1330,
19449,
27195,
12342,
198,
11748,
33918,
628,
198
] | 3.909091 | 11 |
from xivdb.sql import DB, Base, Weapon, Repair, Materia, Stats
from xivdb.importCsv import importCsv
from typing import List
from sqlalchemy.orm import sessionmaker
from XivDbReader import Reader
import sqlalchemy.orm
d = DB(Base)
session: sessionmaker = d.newSession()
w = d.newWeapon()
read: Reader = Reader(job='whm')
whm = read.getArms(recordLimit=1)
for i in whm:
try:
res: Weapon = session.query(Weapon).filter(Weapon.name == i.name).one()
except Exception as e:
#print(f"{i.name} was not found in the DB.")
ic = importCsv()
counter: int = 1
weapons: List[Weapon] = ic.getAllWeapons()
stats: List[Stats] = ic.getAllStats()
repairs: List[Repair] = ic.getAllRepairs()
materias: List[Materia] = ic.getAllMateria()
counter: int = 0
for i in weapons:
try:
res: Weapon = session.query(Weapon).filter(Weapon.name == i.name).one()
counter = counter + 1
if res.name != None:
print(f"Skiped - {i.name}")
continue
except:
w: Weapon = i
s: Stats = stats[counter]
r: Repair = repairs[counter]
m: Materia = materias[counter]
w.stats = s
w.repair = r
w.materia = m
session.add(w)
counter = counter + 1
try:
session.commit()
print(f"Added - {w.name}")
except Exception as e:
print(e)
session.close()
| [
198,
6738,
2124,
452,
9945,
13,
25410,
1330,
20137,
11,
7308,
11,
13072,
11,
28912,
11,
337,
729,
544,
11,
20595,
198,
6738,
2124,
452,
9945,
13,
11748,
34,
21370,
1330,
1330,
34,
21370,
198,
6738,
19720,
1330,
7343,
198,
6738,
44161,
282,
26599,
13,
579,
1330,
6246,
10297,
198,
6738,
1395,
452,
43832,
33634,
1330,
25342,
198,
11748,
44161,
282,
26599,
13,
579,
198,
198,
67,
796,
20137,
7,
14881,
8,
198,
29891,
25,
6246,
10297,
796,
288,
13,
3605,
36044,
3419,
198,
86,
796,
288,
13,
3605,
27632,
3419,
198,
198,
961,
25,
25342,
796,
25342,
7,
21858,
11639,
1929,
76,
11537,
198,
1929,
76,
796,
1100,
13,
1136,
3163,
907,
7,
22105,
39184,
28,
16,
8,
198,
198,
1640,
1312,
287,
348,
76,
25,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
581,
25,
13072,
796,
6246,
13,
22766,
7,
27632,
737,
24455,
7,
27632,
13,
3672,
6624,
1312,
13,
3672,
737,
505,
3419,
198,
220,
220,
220,
2845,
35528,
355,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
7,
69,
1,
90,
72,
13,
3672,
92,
373,
407,
1043,
287,
262,
20137,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
198,
291,
796,
1330,
34,
21370,
3419,
198,
24588,
25,
493,
796,
352,
198,
198,
33999,
25,
7343,
58,
27632,
60,
796,
14158,
13,
1136,
3237,
41818,
3419,
220,
198,
34242,
25,
7343,
58,
29668,
60,
796,
14158,
13,
1136,
3237,
29668,
3419,
198,
7856,
3468,
25,
7343,
58,
6207,
958,
60,
796,
14158,
13,
1136,
3237,
6207,
3468,
3419,
198,
76,
729,
4448,
25,
7343,
58,
44,
729,
544,
60,
796,
14158,
13,
1136,
3237,
44,
729,
544,
3419,
198,
24588,
25,
493,
796,
657,
198,
1640,
1312,
287,
3777,
25,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
581,
25,
13072,
796,
6246,
13,
22766,
7,
27632,
737,
24455,
7,
27632,
13,
3672,
6624,
1312,
13,
3672,
737,
505,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
3753,
796,
3753,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
611,
581,
13,
3672,
14512,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
1,
15739,
46647,
532,
1391,
72,
13,
3672,
92,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
266,
25,
13072,
796,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
264,
25,
20595,
796,
9756,
58,
24588,
60,
198,
220,
220,
220,
220,
220,
220,
220,
374,
25,
28912,
796,
20097,
58,
24588,
60,
198,
220,
220,
220,
220,
220,
220,
220,
285,
25,
337,
729,
544,
796,
26910,
4448,
58,
24588,
60,
198,
220,
220,
220,
220,
220,
220,
220,
266,
13,
34242,
796,
264,
198,
220,
220,
220,
220,
220,
220,
220,
266,
13,
49932,
796,
374,
198,
220,
220,
220,
220,
220,
220,
220,
266,
13,
76,
729,
544,
796,
285,
198,
220,
220,
220,
220,
220,
220,
220,
6246,
13,
2860,
7,
86,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3753,
796,
3753,
1343,
352,
628,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6246,
13,
41509,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
1,
13003,
532,
1391,
86,
13,
3672,
92,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
355,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
68,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
198,
29891,
13,
19836,
3419,
628
] | 2.236677 | 638 |
"""
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import itertools
import numbers
import warnings
import numpy as np
from sklearn.utils import check_array, resample
from .bootstrap import BootstrapResult
from .direct_lingam import DirectLiNGAM
from .hsic import hsic_test_gamma
from .utils import predict_adaptive_lasso
class MultiGroupDirectLiNGAM(DirectLiNGAM):
"""Implementation of DirectLiNGAM Algorithm with multiple groups [1]_
References
----------
.. [1] S. Shimizu. Joint estimation of linear non-Gaussian acyclic models. Neurocomputing, 81: 104-107, 2012.
"""
def __init__(self, random_state=None, prior_knowledge=None, apply_prior_knowledge_softly=False):
"""Construct a model.
Parameters
----------
random_state : int, optional (default=None)
``random_state`` is the seed used by the random number generator.
prior_knowledge : array-like, shape (n_features, n_features), optional (default=None)
Prior background_knowledge used for causal discovery, where ``n_features`` is the number of features.
The elements of prior background_knowledge matrix are defined as follows [1]_:
* ``0`` : :math:`x_i` does not have a directed path to :math:`x_j`
* ``1`` : :math:`x_i` has a directed path to :math:`x_j`
* ``-1`` : No prior background_knowledge is available to know if either of the two cases above (0 or 1) is true.
apply_prior_knowledge_softly : boolean, optional (default=False)
If True, apply prior background_knowledge softly.
"""
super().__init__(random_state, prior_knowledge, apply_prior_knowledge_softly)
def fit(self, X_list):
"""Fit the model to multiple datasets.
Parameters
----------
X_list : list, shape [X, ...]
Multiple datasets for training, where ``X`` is an dataset.
The shape of ''X'' is (n_samples, n_features),
where ``n_samples`` is the number of samples and ``n_features`` is the number of features.
Returns
-------
self : object
Returns the instance itself.
"""
# Check parameters
X_list = self._check_X_list(X_list)
if self._Aknw is not None:
if (self._n_features, self._n_features) != self._Aknw.shape:
raise ValueError(
'The shape of prior background_knowledge must be (n_features, n_features)')
# Causal discovery
U = np.arange(self._n_features)
K = []
X_list_ = [np.copy(X) for X in X_list]
for _ in range(self._n_features):
m = self._search_causal_order(X_list_, U)
for i in U:
if i != m:
for d in range(len(X_list_)):
X_list_[d][:, i] = self._residual(
X_list_[d][:, i], X_list_[d][:, m])
K.append(m)
U = U[U != m]
if (self._Aknw is not None) and (not self._apply_prior_knowledge_softly):
self._partial_orders = self._partial_orders[self._partial_orders[:, 0] != m]
self._causal_order = K
self._adjacency_matrices = []
for X in X_list:
self._estimate_adjacency_matrix(X, prior_knowledge=self._Aknw)
self._adjacency_matrices.append(self._adjacency_matrix)
return self
def bootstrap(self, X_list, n_sampling):
"""Evaluate the statistical reliability of DAG based on the bootstrapping.
Parameters
----------
X_list : array-like, shape (X, ...)
Multiple datasets for training, where ``X`` is an dataset.
The shape of ''X'' is (n_samples, n_features),
where ``n_samples`` is the number of samples and ``n_features`` is the number of features.
n_sampling : int
Number of bootstrapping samples.
Returns
-------
results : array-like, shape (BootstrapResult, ...)
Returns the results of bootstrapping for multiple datasets.
"""
# Check parameters
X_list = self._check_X_list(X_list)
if isinstance(n_sampling, (numbers.Integral, np.integer)):
if not 0 < n_sampling:
raise ValueError(
'n_sampling must be an integer greater than 0.')
else:
raise ValueError('n_sampling must be an integer greater than 0.')
# Bootstrapping
adjacency_matrices_list = np.zeros(
[len(X_list), n_sampling, self._n_features, self._n_features])
total_effects_list = np.zeros(
[len(X_list), n_sampling, self._n_features, self._n_features])
for n in range(n_sampling):
resampled_X_list = [resample(X) for X in X_list]
self.fit(resampled_X_list)
for i, am in enumerate(self._adjacency_matrices):
adjacency_matrices_list[i][n] = am
# Calculate total effects
for c, from_ in enumerate(self._causal_order):
for to in self._causal_order[c + 1:]:
effects = self.estimate_total_effect(
resampled_X_list, from_, to)
for i, effect in enumerate(effects):
total_effects_list[i, n, to, from_] = effect
result_list = []
for am, te in zip(adjacency_matrices_list, total_effects_list):
result_list.append(BootstrapResult(am, te))
return result_list
def estimate_total_effect(self, X_list, from_index, to_index):
"""Estimate total effect using causal model.
Parameters
----------
X_list : array-like, shape (X, ...)
Multiple datasets for training, where ``X`` is an dataset.
The shape of ''X'' is (n_samples, n_features),
where ``n_samples`` is the number of samples and ``n_features`` is the number of features.
from_index :
Index of source variable to estimate total effect.
to_index :
Index of destination variable to estimate total effect.
Returns
-------
total_effect : float
Estimated total effect.
"""
# Check parameters
X_list = self._check_X_list(X_list)
# Check from/to causal order
from_order = self._causal_order.index(from_index)
to_order = self._causal_order.index(to_index)
if from_order > to_order:
warnings.warn(f'The estimated causal effect may be incorrect because '
f'the causal order of the destination variable (to_index={to_index}) '
f'is earlier than the source variable (from_index={from_index}).')
effects = []
for X, am in zip(X_list, self._adjacency_matrices):
# from_index + parents indices
parents = np.where(np.abs(am[from_index]) > 0)[0]
predictors = [from_index]
predictors.extend(parents)
# Estimate total effect
coefs = predict_adaptive_lasso(X, predictors, to_index)
effects.append(coefs[0])
return effects
def get_error_independence_p_values(self, X_list):
"""Calculate the p-value matrix of independence between error variables.
Parameters
----------
X_list : array-like, shape (X, ...)
Multiple datasets for training, where ``X`` is an dataset.
The shape of ''X'' is (n_samples, n_features),
where ``n_samples`` is the number of samples and ``n_features`` is the number of features.
Returns
-------
independence_p_values : array-like, shape (n_datasets, n_features, n_features)
p-value matrix of independence between error variables.
"""
# Check parameters
X_list = self._check_X_list(X_list)
p_values = np.zeros([len(X_list), self._n_features, self._n_features])
for d, (X, am) in enumerate(zip(X_list, self._adjacency_matrices)):
n_samples = X.shape[0]
E = X - np.dot(am, X.T).T
for i, j in itertools.combinations(range(self._n_features), 2):
_, p_value = hsic_test_gamma(np.reshape(E[:, i], [n_samples, 1]),
np.reshape(E[:, j], [n_samples, 1]))
p_values[d, i, j] = p_value
p_values[d, j, i] = p_value
return p_values
def _check_X_list(self, X_list):
"""Check input X list."""
if not isinstance(X_list, list):
raise ValueError('X_list must be a list.')
if len(X_list) < 2:
raise ValueError(
'X_list must be a list containing at least two items')
self._n_features = check_array(X_list[0]).shape[1]
X_list_ = []
for X in X_list:
X_ = check_array(X)
if X_.shape[1] != self._n_features:
raise ValueError(
'X_list must be a list with the same number of features')
X_list_.append(X_)
return np.array(X_list_)
def _search_causal_order(self, X_list, U):
"""Search the causal ordering."""
Uc, Vj = self._search_candidate(U)
if len(Uc) == 1:
return Uc[0]
total_size = 0
for X in X_list:
total_size += len(X)
MG_list = []
for i in Uc:
MG = 0
for X in X_list:
M = 0
for j in U:
if i != j:
xi_std = (X[:, i] - np.mean(X[:, i])) / np.std(X[:, i])
xj_std = (X[:, j] - np.mean(X[:, j])) / np.std(X[:, j])
ri_j = xi_std if i in Vj and j in Uc else self._residual(
xi_std, xj_std)
rj_i = xj_std if j in Vj and i in Uc else self._residual(
xj_std, xi_std)
M += np.min([0, self._diff_mutual_info(xi_std,
xj_std, ri_j, rj_i)]) ** 2
MG += M * (len(X) / total_size)
MG_list.append(-1.0 * MG)
return Uc[np.argmax(MG_list)]
@property
def adjacency_matrices_(self):
"""Estimated adjacency matrices.
Returns
-------
adjacency_matrices_ : array-like, shape (B, ...)
The list of adjacency matrix B for multiple datasets.
The shape of B is (n_features, n_features), where
n_features is the number of features.
"""
return self._adjacency_matrices
| [
37811,
198,
37906,
7822,
286,
262,
7455,
10503,
2390,
16113,
13,
198,
464,
7455,
10503,
2390,
4935,
25,
3740,
1378,
49315,
13,
13297,
13,
785,
14,
15654,
14,
824,
38400,
47775,
3312,
14,
1359,
321,
198,
37811,
198,
11748,
340,
861,
10141,
198,
11748,
3146,
198,
11748,
14601,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
1341,
35720,
13,
26791,
1330,
2198,
62,
18747,
11,
581,
1403,
198,
198,
6738,
764,
18769,
26418,
1330,
18892,
26418,
23004,
198,
6738,
764,
12942,
62,
1359,
321,
1330,
4128,
32304,
10503,
2390,
198,
6738,
764,
11994,
291,
1330,
289,
21383,
62,
9288,
62,
28483,
2611,
198,
6738,
764,
26791,
1330,
4331,
62,
42552,
425,
62,
75,
28372,
628,
198,
4871,
15237,
13247,
13470,
32304,
10503,
2390,
7,
13470,
32304,
10503,
2390,
2599,
198,
220,
220,
220,
37227,
3546,
32851,
286,
4128,
32304,
10503,
2390,
978,
42289,
351,
3294,
2628,
685,
16,
60,
62,
628,
220,
220,
220,
31458,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
11485,
685,
16,
60,
311,
13,
31698,
47775,
13,
16798,
31850,
286,
14174,
1729,
12,
35389,
31562,
936,
88,
565,
291,
4981,
13,
13782,
785,
48074,
11,
9773,
25,
14436,
12,
15982,
11,
2321,
13,
220,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
4738,
62,
5219,
28,
14202,
11,
3161,
62,
45066,
28,
14202,
11,
4174,
62,
3448,
273,
62,
45066,
62,
4215,
306,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
42316,
257,
2746,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
4738,
62,
5219,
1058,
493,
11,
11902,
357,
12286,
28,
14202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7559,
25120,
62,
5219,
15506,
318,
262,
9403,
973,
416,
262,
4738,
1271,
17301,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3161,
62,
45066,
1058,
7177,
12,
2339,
11,
5485,
357,
77,
62,
40890,
11,
299,
62,
40890,
828,
11902,
357,
12286,
28,
14202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14481,
4469,
62,
45066,
973,
329,
26558,
9412,
11,
810,
7559,
77,
62,
40890,
15506,
318,
262,
1271,
286,
3033,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
4847,
286,
3161,
4469,
62,
45066,
17593,
389,
5447,
355,
5679,
685,
16,
60,
62,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
7559,
15,
15506,
1058,
1058,
11018,
25,
63,
87,
62,
72,
63,
857,
407,
423,
257,
7924,
3108,
284,
1058,
11018,
25,
63,
87,
62,
73,
63,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
7559,
16,
15506,
1058,
1058,
11018,
25,
63,
87,
62,
72,
63,
468,
257,
7924,
3108,
284,
1058,
11018,
25,
63,
87,
62,
73,
63,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
7559,
12,
16,
15506,
1058,
1400,
3161,
4469,
62,
45066,
318,
1695,
284,
760,
611,
2035,
286,
262,
734,
2663,
2029,
357,
15,
393,
352,
8,
318,
2081,
13,
198,
220,
220,
220,
220,
220,
220,
220,
4174,
62,
3448,
273,
62,
45066,
62,
4215,
306,
1058,
25131,
11,
11902,
357,
12286,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1002,
6407,
11,
4174,
3161,
4469,
62,
45066,
26625,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
834,
15003,
834,
7,
25120,
62,
5219,
11,
3161,
62,
45066,
11,
4174,
62,
3448,
273,
62,
45066,
62,
4215,
306,
8,
628,
220,
220,
220,
825,
4197,
7,
944,
11,
1395,
62,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
31805,
262,
2746,
284,
3294,
40522,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
1058,
1351,
11,
5485,
685,
55,
11,
2644,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20401,
40522,
329,
3047,
11,
810,
7559,
55,
15506,
318,
281,
27039,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
5485,
286,
10148,
55,
7061,
318,
357,
77,
62,
82,
12629,
11,
299,
62,
40890,
828,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
810,
7559,
77,
62,
82,
12629,
15506,
318,
262,
1271,
286,
8405,
290,
7559,
77,
62,
40890,
15506,
318,
262,
1271,
286,
3033,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
1058,
2134,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
4554,
2346,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
10007,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
796,
2116,
13557,
9122,
62,
55,
62,
4868,
7,
55,
62,
4868,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13557,
32,
15418,
86,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
357,
944,
13557,
77,
62,
40890,
11,
2116,
13557,
77,
62,
40890,
8,
14512,
2116,
13557,
32,
15418,
86,
13,
43358,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
464,
5485,
286,
3161,
4469,
62,
45066,
1276,
307,
357,
77,
62,
40890,
11,
299,
62,
40890,
8,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6488,
6775,
9412,
198,
220,
220,
220,
220,
220,
220,
220,
471,
796,
45941,
13,
283,
858,
7,
944,
13557,
77,
62,
40890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
509,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
62,
796,
685,
37659,
13,
30073,
7,
55,
8,
329,
1395,
287,
1395,
62,
4868,
60,
198,
220,
220,
220,
220,
220,
220,
220,
329,
4808,
287,
2837,
7,
944,
13557,
77,
62,
40890,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
796,
2116,
13557,
12947,
62,
6888,
6775,
62,
2875,
7,
55,
62,
4868,
62,
11,
471,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
471,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
14512,
285,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
288,
287,
2837,
7,
11925,
7,
55,
62,
4868,
62,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
62,
58,
67,
7131,
45299,
1312,
60,
796,
2116,
13557,
411,
312,
723,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
62,
58,
67,
7131,
45299,
1312,
4357,
1395,
62,
4868,
62,
58,
67,
7131,
45299,
285,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
509,
13,
33295,
7,
76,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
471,
796,
471,
58,
52,
14512,
285,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
357,
944,
13557,
32,
15418,
86,
318,
407,
6045,
8,
290,
357,
1662,
2116,
13557,
39014,
62,
3448,
273,
62,
45066,
62,
4215,
306,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
47172,
62,
6361,
796,
2116,
13557,
47172,
62,
6361,
58,
944,
13557,
47172,
62,
6361,
58,
45299,
657,
60,
14512,
285,
60,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
6888,
6775,
62,
2875,
796,
509,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
324,
30482,
1387,
62,
6759,
45977,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1395,
287,
1395,
62,
4868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
395,
1920,
62,
324,
30482,
1387,
62,
6759,
8609,
7,
55,
11,
3161,
62,
45066,
28,
944,
13557,
32,
15418,
86,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
324,
30482,
1387,
62,
6759,
45977,
13,
33295,
7,
944,
13557,
324,
30482,
1387,
62,
6759,
8609,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
628,
220,
220,
220,
825,
6297,
26418,
7,
944,
11,
1395,
62,
4868,
11,
299,
62,
37687,
11347,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
36,
2100,
4985,
262,
13905,
17843,
286,
360,
4760,
1912,
319,
262,
6297,
12044,
2105,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
1058,
7177,
12,
2339,
11,
5485,
357,
55,
11,
2644,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20401,
40522,
329,
3047,
11,
810,
7559,
55,
15506,
318,
281,
27039,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
5485,
286,
10148,
55,
7061,
318,
357,
77,
62,
82,
12629,
11,
299,
62,
40890,
828,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
810,
7559,
77,
62,
82,
12629,
15506,
318,
262,
1271,
286,
8405,
290,
7559,
77,
62,
40890,
15506,
318,
262,
1271,
286,
3033,
13,
198,
220,
220,
220,
220,
220,
220,
220,
299,
62,
37687,
11347,
1058,
493,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7913,
286,
6297,
12044,
2105,
8405,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
2482,
1058,
7177,
12,
2339,
11,
5485,
357,
36476,
26418,
23004,
11,
2644,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
2482,
286,
6297,
12044,
2105,
329,
3294,
40522,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
10007,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
796,
2116,
13557,
9122,
62,
55,
62,
4868,
7,
55,
62,
4868,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
77,
62,
37687,
11347,
11,
357,
77,
17024,
13,
34500,
1373,
11,
45941,
13,
41433,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
657,
1279,
299,
62,
37687,
11347,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
77,
62,
37687,
11347,
1276,
307,
281,
18253,
3744,
621,
657,
2637,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
77,
62,
37687,
11347,
1276,
307,
281,
18253,
3744,
621,
657,
2637,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
18892,
12044,
2105,
198,
220,
220,
220,
220,
220,
220,
220,
9224,
330,
1387,
62,
6759,
45977,
62,
4868,
796,
45941,
13,
9107,
418,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11925,
7,
55,
62,
4868,
828,
299,
62,
37687,
11347,
11,
2116,
13557,
77,
62,
40890,
11,
2116,
13557,
77,
62,
40890,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
34435,
62,
4868,
796,
45941,
13,
9107,
418,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
11925,
7,
55,
62,
4868,
828,
299,
62,
37687,
11347,
11,
2116,
13557,
77,
62,
40890,
11,
2116,
13557,
77,
62,
40890,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
329,
299,
287,
2837,
7,
77,
62,
37687,
11347,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
581,
321,
10137,
62,
55,
62,
4868,
796,
685,
411,
1403,
7,
55,
8,
329,
1395,
287,
1395,
62,
4868,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11147,
7,
411,
321,
10137,
62,
55,
62,
4868,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
716,
287,
27056,
378,
7,
944,
13557,
324,
30482,
1387,
62,
6759,
45977,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9224,
330,
1387,
62,
6759,
45977,
62,
4868,
58,
72,
7131,
77,
60,
796,
716,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
27131,
378,
2472,
3048,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
269,
11,
422,
62,
287,
27056,
378,
7,
944,
13557,
6888,
6775,
62,
2875,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
284,
287,
2116,
13557,
6888,
6775,
62,
2875,
58,
66,
1343,
352,
25,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3048,
796,
2116,
13,
395,
1920,
62,
23350,
62,
10760,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
581,
321,
10137,
62,
55,
62,
4868,
11,
422,
62,
11,
284,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
1245,
287,
27056,
378,
7,
34435,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
34435,
62,
4868,
58,
72,
11,
299,
11,
284,
11,
422,
62,
60,
796,
1245,
628,
220,
220,
220,
220,
220,
220,
220,
1255,
62,
4868,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
716,
11,
573,
287,
19974,
7,
324,
30482,
1387,
62,
6759,
45977,
62,
4868,
11,
2472,
62,
34435,
62,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1255,
62,
4868,
13,
33295,
7,
36476,
26418,
23004,
7,
321,
11,
573,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
1255,
62,
4868,
628,
220,
220,
220,
825,
8636,
62,
23350,
62,
10760,
7,
944,
11,
1395,
62,
4868,
11,
422,
62,
9630,
11,
284,
62,
9630,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
22362,
1920,
2472,
1245,
1262,
26558,
2746,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
1058,
7177,
12,
2339,
11,
5485,
357,
55,
11,
2644,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20401,
40522,
329,
3047,
11,
810,
7559,
55,
15506,
318,
281,
27039,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
5485,
286,
10148,
55,
7061,
318,
357,
77,
62,
82,
12629,
11,
299,
62,
40890,
828,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
810,
7559,
77,
62,
82,
12629,
15506,
318,
262,
1271,
286,
8405,
290,
7559,
77,
62,
40890,
15506,
318,
262,
1271,
286,
3033,
13,
198,
220,
220,
220,
220,
220,
220,
220,
422,
62,
9630,
1058,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12901,
286,
2723,
7885,
284,
8636,
2472,
1245,
13,
198,
220,
220,
220,
220,
220,
220,
220,
284,
62,
9630,
1058,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12901,
286,
10965,
7885,
284,
8636,
2472,
1245,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
10760,
1058,
12178,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47737,
2472,
1245,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
10007,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
796,
2116,
13557,
9122,
62,
55,
62,
4868,
7,
55,
62,
4868,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
422,
14,
1462,
26558,
1502,
198,
220,
220,
220,
220,
220,
220,
220,
422,
62,
2875,
796,
2116,
13557,
6888,
6775,
62,
2875,
13,
9630,
7,
6738,
62,
9630,
8,
198,
220,
220,
220,
220,
220,
220,
220,
284,
62,
2875,
796,
2116,
13557,
6888,
6775,
62,
2875,
13,
9630,
7,
1462,
62,
9630,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
422,
62,
2875,
1875,
284,
62,
2875,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14601,
13,
40539,
7,
69,
6,
464,
6108,
26558,
1245,
743,
307,
11491,
780,
705,
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,
277,
470,
258,
26558,
1502,
286,
262,
10965,
7885,
357,
1462,
62,
9630,
34758,
1462,
62,
9630,
30072,
705,
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,
277,
6,
271,
2961,
621,
262,
2723,
7885,
357,
6738,
62,
9630,
34758,
6738,
62,
9630,
92,
737,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
3048,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1395,
11,
716,
287,
19974,
7,
55,
62,
4868,
11,
2116,
13557,
324,
30482,
1387,
62,
6759,
45977,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
422,
62,
9630,
1343,
3397,
36525,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3397,
796,
45941,
13,
3003,
7,
37659,
13,
8937,
7,
321,
58,
6738,
62,
9630,
12962,
1875,
657,
38381,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4331,
669,
796,
685,
6738,
62,
9630,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4331,
669,
13,
2302,
437,
7,
23743,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10062,
1920,
2472,
1245,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
763,
891,
82,
796,
4331,
62,
42552,
425,
62,
75,
28372,
7,
55,
11,
4331,
669,
11,
284,
62,
9630,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3048,
13,
33295,
7,
1073,
891,
82,
58,
15,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
3048,
628,
220,
220,
220,
825,
651,
62,
18224,
62,
39894,
62,
79,
62,
27160,
7,
944,
11,
1395,
62,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
9771,
3129,
378,
262,
279,
12,
8367,
17593,
286,
10404,
1022,
4049,
9633,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
1058,
7177,
12,
2339,
11,
5485,
357,
55,
11,
2644,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20401,
40522,
329,
3047,
11,
810,
7559,
55,
15506,
318,
281,
27039,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
5485,
286,
10148,
55,
7061,
318,
357,
77,
62,
82,
12629,
11,
299,
62,
40890,
828,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
810,
7559,
77,
62,
82,
12629,
15506,
318,
262,
1271,
286,
8405,
290,
7559,
77,
62,
40890,
15506,
318,
262,
1271,
286,
3033,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
10404,
62,
79,
62,
27160,
1058,
7177,
12,
2339,
11,
5485,
357,
77,
62,
19608,
292,
1039,
11,
299,
62,
40890,
11,
299,
62,
40890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
12,
8367,
17593,
286,
10404,
1022,
4049,
9633,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
10007,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
796,
2116,
13557,
9122,
62,
55,
62,
4868,
7,
55,
62,
4868,
8,
628,
220,
220,
220,
220,
220,
220,
220,
279,
62,
27160,
796,
45941,
13,
9107,
418,
26933,
11925,
7,
55,
62,
4868,
828,
2116,
13557,
77,
62,
40890,
11,
2116,
13557,
77,
62,
40890,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
329,
288,
11,
357,
55,
11,
716,
8,
287,
27056,
378,
7,
13344,
7,
55,
62,
4868,
11,
2116,
13557,
324,
30482,
1387,
62,
6759,
45977,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
62,
82,
12629,
796,
1395,
13,
43358,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
412,
796,
1395,
532,
45941,
13,
26518,
7,
321,
11,
1395,
13,
51,
737,
51,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
474,
287,
340,
861,
10141,
13,
24011,
7352,
7,
9521,
7,
944,
13557,
77,
62,
40890,
828,
362,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
11,
279,
62,
8367,
796,
289,
21383,
62,
9288,
62,
28483,
2611,
7,
37659,
13,
3447,
1758,
7,
36,
58,
45299,
1312,
4357,
685,
77,
62,
82,
12629,
11,
352,
46570,
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,
45941,
13,
3447,
1758,
7,
36,
58,
45299,
474,
4357,
685,
77,
62,
82,
12629,
11,
352,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
27160,
58,
67,
11,
1312,
11,
474,
60,
796,
279,
62,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
27160,
58,
67,
11,
474,
11,
1312,
60,
796,
279,
62,
8367,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
279,
62,
27160,
628,
220,
220,
220,
825,
4808,
9122,
62,
55,
62,
4868,
7,
944,
11,
1395,
62,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
9787,
5128,
1395,
1351,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
55,
62,
4868,
11,
1351,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
55,
62,
4868,
1276,
307,
257,
1351,
2637,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
55,
62,
4868,
8,
1279,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
55,
62,
4868,
1276,
307,
257,
1351,
7268,
379,
1551,
734,
3709,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
77,
62,
40890,
796,
2198,
62,
18747,
7,
55,
62,
4868,
58,
15,
35944,
43358,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
62,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1395,
287,
1395,
62,
4868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
796,
2198,
62,
18747,
7,
55,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1395,
44807,
43358,
58,
16,
60,
14512,
2116,
13557,
77,
62,
40890,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
55,
62,
4868,
1276,
307,
257,
1351,
351,
262,
976,
1271,
286,
3033,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
4868,
44807,
33295,
7,
55,
62,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
45941,
13,
18747,
7,
55,
62,
4868,
62,
8,
628,
220,
220,
220,
825,
4808,
12947,
62,
6888,
6775,
62,
2875,
7,
944,
11,
1395,
62,
4868,
11,
471,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
18243,
262,
26558,
16216,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
471,
66,
11,
569,
73,
796,
2116,
13557,
12947,
62,
46188,
20540,
7,
52,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
52,
66,
8,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
471,
66,
58,
15,
60,
628,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
7857,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1395,
287,
1395,
62,
4868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
7857,
15853,
18896,
7,
55,
8,
628,
220,
220,
220,
220,
220,
220,
220,
34809,
62,
4868,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
471,
66,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34809,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1395,
287,
1395,
62,
4868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
287,
471,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
14512,
474,
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,
2124,
72,
62,
19282,
796,
357,
55,
58,
45299,
1312,
60,
532,
45941,
13,
32604,
7,
55,
58,
45299,
1312,
60,
4008,
1220,
45941,
13,
19282,
7,
55,
58,
45299,
1312,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
73,
62,
19282,
796,
357,
55,
58,
45299,
474,
60,
532,
45941,
13,
32604,
7,
55,
58,
45299,
474,
60,
4008,
1220,
45941,
13,
19282,
7,
55,
58,
45299,
474,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
72,
62,
73,
796,
2124,
72,
62,
19282,
611,
1312,
287,
569,
73,
290,
474,
287,
471,
66,
2073,
2116,
13557,
411,
312,
723,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
72,
62,
19282,
11,
2124,
73,
62,
19282,
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,
374,
73,
62,
72,
796,
2124,
73,
62,
19282,
611,
474,
287,
569,
73,
290,
1312,
287,
471,
66,
2073,
2116,
13557,
411,
312,
723,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
73,
62,
19282,
11,
2124,
72,
62,
19282,
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,
337,
15853,
45941,
13,
1084,
26933,
15,
11,
2116,
13557,
26069,
62,
21973,
723,
62,
10951,
7,
29992,
62,
19282,
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,
2124,
73,
62,
19282,
11,
374,
72,
62,
73,
11,
374,
73,
62,
72,
8,
12962,
12429,
362,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34809,
15853,
337,
1635,
357,
11925,
7,
55,
8,
1220,
2472,
62,
7857,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34809,
62,
4868,
13,
33295,
32590,
16,
13,
15,
1635,
34809,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
471,
66,
58,
37659,
13,
853,
9806,
7,
20474,
62,
4868,
15437,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
9224,
330,
1387,
62,
6759,
45977,
41052,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
22362,
15655,
9224,
330,
1387,
2603,
45977,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
35656,
198,
220,
220,
220,
220,
220,
220,
220,
9224,
330,
1387,
62,
6759,
45977,
62,
1058,
7177,
12,
2339,
11,
5485,
357,
33,
11,
2644,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
1351,
286,
9224,
330,
1387,
17593,
347,
329,
3294,
40522,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
5485,
286,
347,
318,
357,
77,
62,
40890,
11,
299,
62,
40890,
828,
810,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
62,
40890,
318,
262,
1271,
286,
3033,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
324,
30482,
1387,
62,
6759,
45977,
198
] | 2.095771 | 5,179 |
from django.apps import AppConfig
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
628
] | 3.888889 | 9 |
# -*- coding: utf-8 -*-
"""
The :class:`SwaggerClient` provides an interface for making API calls based on
a swagger spec, and returns responses of python objects which build from the
API response.
Structure Diagram::
+---------------------+
| |
| SwaggerClient |
| |
+------+--------------+
|
| has many
|
+------v--------------+
| |
| Resource +------------------+
| | |
+------+--------------+ has many |
| |
| has many |
| |
+------v--------------+ +------v--------------+
| | | |
| Operation | | SwaggerModel |
| | | |
+------+--------------+ +---------------------+
|
| uses
|
+------v--------------+
| |
| HttpClient |
| |
+---------------------+
To get a client
.. code-block:: python
client = bravado.client.SwaggerClient.from_url(swagger_spec_url)
"""
import logging
from bravado_core.docstring import create_operation_docstring
from bravado_core.exception import SwaggerMappingError
from bravado_core.formatter import SwaggerFormat # noqa
from bravado_core.param import marshal_param
from bravado_core.spec import Spec
from six import iteritems, itervalues
from bravado.docstring_property import docstring_property
from bravado.requests_client import RequestsClient
from bravado.swagger_model import Loader
from bravado.warning import warn_for_deprecated_op
log = logging.getLogger(__name__)
CONFIG_DEFAULTS = {
# See the constructor of :class:`bravado.http_future.HttpFuture` for an
# in depth explanation of what this means.
'also_return_response': False,
}
REQUEST_OPTIONS_DEFAULTS = {
# List of callbacks that are executed after the incoming response has been
# validated and the swagger_result has been unmarshalled.
#
# The callback should expect two arguments:
# param : incoming_response
# type : subclass of class:`bravado_core.response.IncomingResponse`
# param : operation
# type : class:`bravado_core.operation.Operation`
'response_callbacks': [],
}
class SwaggerClient(object):
"""A client for accessing a Swagger-documented RESTful service.
:type swagger_spec: :class:`bravado_core.spec.Spec`
"""
@classmethod
def from_url(cls, spec_url, http_client=None, request_headers=None,
config=None):
"""Build a :class:`SwaggerClient` from a url to the Swagger
specification for a RESTful API.
:param spec_url: url pointing at the swagger API specification
:type spec_url: str
:param http_client: an HTTP client used to perform requests
:type http_client: :class:`bravado.http_client.HttpClient`
:param request_headers: Headers to pass with http requests
:type request_headers: dict
:param config: Config dict for bravado and bravado_core.
See CONFIG_DEFAULTS in :module:`bravado_core.spec`.
See CONFIG_DEFAULTS in :module:`bravado.client`.
:rtype: :class:`bravado_core.spec.Spec`
"""
log.debug(u"Loading from %s" % spec_url)
http_client = http_client or RequestsClient()
loader = Loader(http_client, request_headers=request_headers)
spec_dict = loader.load_spec(spec_url)
# RefResolver may have to download additional json files (remote refs)
# via http. Wrap http_client's request() so that request headers are
# passed along with the request transparently. Yeah, this is not ideal,
# but since RefResolver has new found responsibilities, it is
# functional.
if request_headers is not None:
http_client.request = inject_headers_for_remote_refs(
http_client.request, request_headers)
return cls.from_spec(spec_dict, spec_url, http_client, config)
@classmethod
def from_spec(cls, spec_dict, origin_url=None, http_client=None,
config=None):
"""
Build a :class:`SwaggerClient` from a Swagger spec in dict form.
:param spec_dict: a dict with a Swagger spec in json-like form
:param origin_url: the url used to retrieve the spec_dict
:type origin_url: str
:param config: Configuration dict - see spec.CONFIG_DEFAULTS
:rtype: :class:`bravado_core.spec.Spec`
"""
http_client = http_client or RequestsClient()
# Apply bravado config defaults
config = dict(CONFIG_DEFAULTS, **(config or {}))
swagger_spec = Spec.from_dict(
spec_dict, origin_url, http_client, config)
return cls(swagger_spec)
def __getattr__(self, item):
"""
:param item: name of the resource to return
:return: :class:`Resource`
"""
resource = self.swagger_spec.resources.get(item)
if not resource:
raise AttributeError(
'Resource {0} not found. Available resources: {1}'
.format(item, ', '.join(dir(self))))
# Wrap bravado-core's Resource and Operation objects in order to
# execute a service call via the http_client.
return ResourceDecorator(resource)
def inject_headers_for_remote_refs(request_callable, request_headers):
"""Inject request_headers only when the request is to retrieve the
remote refs in the swagger spec (vs being a request for a service call).
:param request_callable: method on http_client to make a http request
:param request_headers: headers to inject when retrieving remote refs
"""
return request_wrapper
class ResourceDecorator(object):
"""
Wraps :class:`bravado_core.resource.Resource` so that accesses to contained
operations can be instrumented.
"""
def __init__(self, resource):
"""
:type resource: :class:`bravado_core.resource.Resource`
"""
self.resource = resource
def __getattr__(self, name):
"""
:rtype: :class:`CallableOperation`
"""
return CallableOperation(getattr(self.resource, name))
def __dir__(self):
"""
Exposes correct attrs on resource when tab completing in a REPL
"""
return self.resource.__dir__()
class CallableOperation(object):
"""Wraps an operation to make it callable and provides a docstring. Calling
the operation uses the configured http_client.
:type operation: :class:`bravado_core.operation.Operation`
"""
@docstring_property(__doc__)
def __getattr__(self, name):
"""Forward requests for attrs not found on this decorator to the
delegate.
"""
return getattr(self.operation, name)
def __call__(self, **op_kwargs):
"""Invoke the actual HTTP request and return a future.
:rtype: :class:`bravado.http_future.HTTPFuture`
"""
log.debug(u"%s(%s)" % (self.operation.operation_id, op_kwargs))
warn_for_deprecated_op(self.operation)
# Apply request_options defaults
request_options = dict(
REQUEST_OPTIONS_DEFAULTS,
**(op_kwargs.pop('_request_options', {})))
request_params = construct_request(
self.operation, request_options, **op_kwargs)
config = self.operation.swagger_spec.config
http_client = self.operation.swagger_spec.http_client
# Per-request config overrides client wide config
also_return_response = request_options.get(
'also_return_response',
config['also_return_response'])
return http_client.request(
request_params,
operation=self.operation,
response_callbacks=request_options['response_callbacks'],
also_return_response=also_return_response)
def construct_request(operation, request_options, **op_kwargs):
"""Construct the outgoing request dict.
:type operation: :class:`bravado_core.operation.Operation`
:param request_options: _request_options passed into the operation
invocation.
:param op_kwargs: parameter name/value pairs to passed to the
invocation of the operation.
:return: request in dict form
"""
url = operation.swagger_spec.api_url.rstrip('/') + operation.path_name
request = {
'method': operation.http_method.upper(),
'url': url,
'params': {}, # filled in downstream
'headers': request_options.get('headers', {}),
}
# Copy over optional request options
for request_option in ('connect_timeout', 'timeout'):
if request_option in request_options:
request[request_option] = request_options[request_option]
construct_params(operation, request, op_kwargs)
return request
def construct_params(operation, request, op_kwargs):
"""Given the parameters passed to the operation invocation, validates and
marshals the parameters into the provided request dict.
:type operation: :class:`bravado_core.operation.Operation`
:type request: dict
:param op_kwargs: the kwargs passed to the operation invocation
:raises: SwaggerMappingError on extra parameters or when a required
parameter is not supplied.
"""
current_params = operation.params.copy()
for param_name, param_value in iteritems(op_kwargs):
param = current_params.pop(param_name, None)
if param is None:
raise SwaggerMappingError(
"{0} does not have parameter {1}"
.format(operation.operation_id, param_name))
marshal_param(param, param_value, request)
# Check required params and non-required params with a 'default' value
for remaining_param in itervalues(current_params):
if remaining_param.required:
raise SwaggerMappingError(
'{0} is a required parameter'.format(remaining_param.name))
if not remaining_param.required and remaining_param.has_default():
marshal_param(remaining_param, None, request)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
464,
1058,
4871,
25,
63,
10462,
7928,
11792,
63,
3769,
281,
7071,
329,
1642,
7824,
3848,
1912,
319,
198,
64,
1509,
7928,
1020,
11,
290,
5860,
9109,
286,
21015,
5563,
543,
1382,
422,
262,
198,
17614,
2882,
13,
198,
198,
1273,
5620,
6031,
6713,
3712,
628,
220,
220,
220,
220,
220,
220,
220,
1343,
19351,
19529,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
2451,
7928,
11792,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1343,
23031,
10,
26171,
10,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
468,
867,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1343,
23031,
85,
26171,
10,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
20857,
220,
220,
220,
220,
220,
220,
220,
1343,
1783,
44785,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1343,
23031,
10,
26171,
10,
220,
220,
220,
220,
220,
220,
220,
220,
468,
867,
930,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
468,
867,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1343,
23031,
85,
26171,
10,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
23031,
85,
26171,
10,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
14680,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
2451,
7928,
17633,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1343,
23031,
10,
26171,
10,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
19351,
19529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
220,
3544,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1343,
23031,
85,
26171,
10,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
367,
29281,
11792,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
930,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
220,
220,
220,
220,
220,
220,
220,
1343,
19351,
19529,
628,
198,
2514,
651,
257,
5456,
198,
198,
492,
2438,
12,
9967,
3712,
21015,
628,
220,
220,
220,
5456,
796,
49025,
4533,
13,
16366,
13,
10462,
7928,
11792,
13,
6738,
62,
6371,
7,
2032,
7928,
62,
16684,
62,
6371,
8,
198,
37811,
198,
11748,
18931,
198,
198,
6738,
49025,
4533,
62,
7295,
13,
15390,
8841,
1330,
2251,
62,
27184,
62,
15390,
8841,
198,
6738,
49025,
4533,
62,
7295,
13,
1069,
4516,
1330,
2451,
7928,
44,
5912,
12331,
198,
6738,
49025,
4533,
62,
7295,
13,
687,
1436,
1330,
2451,
7928,
26227,
220,
1303,
645,
20402,
198,
6738,
49025,
4533,
62,
7295,
13,
17143,
1330,
22397,
282,
62,
17143,
198,
6738,
49025,
4533,
62,
7295,
13,
16684,
1330,
18291,
198,
6738,
2237,
1330,
11629,
23814,
11,
340,
712,
282,
947,
198,
198,
6738,
49025,
4533,
13,
15390,
8841,
62,
26745,
1330,
2205,
8841,
62,
26745,
198,
6738,
49025,
4533,
13,
8897,
3558,
62,
16366,
1330,
9394,
3558,
11792,
198,
6738,
49025,
4533,
13,
2032,
7928,
62,
19849,
1330,
8778,
263,
198,
6738,
49025,
4533,
13,
43917,
1330,
9828,
62,
1640,
62,
10378,
31023,
62,
404,
198,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
10943,
16254,
62,
7206,
7708,
35342,
796,
1391,
198,
220,
220,
220,
1303,
4091,
262,
23772,
286,
1058,
4871,
25,
63,
65,
4108,
4533,
13,
4023,
62,
37443,
13,
43481,
29783,
63,
329,
281,
198,
220,
220,
220,
1303,
287,
6795,
7468,
286,
644,
428,
1724,
13,
198,
220,
220,
220,
705,
14508,
62,
7783,
62,
26209,
10354,
10352,
11,
198,
92,
198,
198,
2200,
35780,
62,
3185,
51,
11053,
62,
7206,
7708,
35342,
796,
1391,
198,
220,
220,
220,
1303,
7343,
286,
869,
10146,
326,
389,
10945,
706,
262,
15619,
2882,
468,
587,
198,
220,
220,
220,
1303,
31031,
290,
262,
1509,
7928,
62,
20274,
468,
587,
21303,
5406,
4262,
13,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
383,
23838,
815,
1607,
734,
7159,
25,
198,
220,
220,
220,
1303,
220,
220,
5772,
1058,
15619,
62,
26209,
198,
220,
220,
220,
1303,
220,
220,
2099,
220,
1058,
47611,
286,
1398,
25,
63,
65,
4108,
4533,
62,
7295,
13,
26209,
13,
818,
4976,
31077,
63,
198,
220,
220,
220,
1303,
220,
220,
5772,
1058,
4905,
198,
220,
220,
220,
1303,
220,
220,
2099,
220,
1058,
1398,
25,
63,
65,
4108,
4533,
62,
7295,
13,
27184,
13,
32180,
63,
198,
220,
220,
220,
705,
26209,
62,
13345,
10146,
10354,
685,
4357,
198,
92,
628,
198,
4871,
2451,
7928,
11792,
7,
15252,
2599,
198,
220,
220,
220,
37227,
32,
5456,
329,
22534,
257,
2451,
7928,
12,
47045,
30617,
913,
2139,
13,
628,
220,
220,
220,
1058,
4906,
1509,
7928,
62,
16684,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
16684,
13,
22882,
63,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
2488,
4871,
24396,
198,
220,
220,
220,
825,
422,
62,
6371,
7,
565,
82,
11,
1020,
62,
6371,
11,
2638,
62,
16366,
28,
14202,
11,
2581,
62,
50145,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4566,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15580,
257,
1058,
4871,
25,
63,
10462,
7928,
11792,
63,
422,
257,
19016,
284,
262,
2451,
7928,
198,
220,
220,
220,
220,
220,
220,
220,
20855,
329,
257,
30617,
913,
7824,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1020,
62,
6371,
25,
19016,
10609,
379,
262,
1509,
7928,
7824,
20855,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
1020,
62,
6371,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2638,
62,
16366,
25,
281,
14626,
5456,
973,
284,
1620,
7007,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
2638,
62,
16366,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
13,
4023,
62,
16366,
13,
43481,
11792,
63,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2581,
62,
50145,
25,
7123,
364,
284,
1208,
351,
2638,
7007,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
2581,
62,
50145,
25,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4566,
25,
17056,
8633,
329,
49025,
4533,
290,
49025,
4533,
62,
7295,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4091,
25626,
62,
7206,
7708,
35342,
287,
1058,
21412,
25,
63,
65,
4108,
4533,
62,
7295,
13,
16684,
44646,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4091,
25626,
62,
7206,
7708,
35342,
287,
1058,
21412,
25,
63,
65,
4108,
4533,
13,
16366,
44646,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
81,
4906,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
16684,
13,
22882,
63,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
13,
24442,
7,
84,
1,
19031,
422,
4064,
82,
1,
4064,
1020,
62,
6371,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2638,
62,
16366,
796,
2638,
62,
16366,
393,
9394,
3558,
11792,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
40213,
796,
8778,
263,
7,
4023,
62,
16366,
11,
2581,
62,
50145,
28,
25927,
62,
50145,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1020,
62,
11600,
796,
40213,
13,
2220,
62,
16684,
7,
16684,
62,
6371,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6524,
4965,
14375,
743,
423,
284,
4321,
3224,
33918,
3696,
357,
47960,
1006,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2884,
2638,
13,
41028,
2638,
62,
16366,
338,
2581,
3419,
523,
326,
2581,
24697,
389,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
3804,
1863,
351,
262,
2581,
13245,
306,
13,
9425,
11,
428,
318,
407,
7306,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
475,
1201,
6524,
4965,
14375,
468,
649,
1043,
15171,
11,
340,
318,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
10345,
13,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2581,
62,
50145,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2638,
62,
16366,
13,
25927,
796,
8677,
62,
50145,
62,
1640,
62,
47960,
62,
5420,
82,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2638,
62,
16366,
13,
25927,
11,
2581,
62,
50145,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
537,
82,
13,
6738,
62,
16684,
7,
16684,
62,
11600,
11,
1020,
62,
6371,
11,
2638,
62,
16366,
11,
4566,
8,
628,
220,
220,
220,
2488,
4871,
24396,
198,
220,
220,
220,
825,
422,
62,
16684,
7,
565,
82,
11,
1020,
62,
11600,
11,
8159,
62,
6371,
28,
14202,
11,
2638,
62,
16366,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4566,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10934,
257,
1058,
4871,
25,
63,
10462,
7928,
11792,
63,
422,
257,
2451,
7928,
1020,
287,
8633,
1296,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1020,
62,
11600,
25,
257,
8633,
351,
257,
2451,
7928,
1020,
287,
33918,
12,
2339,
1296,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
8159,
62,
6371,
25,
262,
19016,
973,
284,
19818,
262,
1020,
62,
11600,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
8159,
62,
6371,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4566,
25,
28373,
8633,
532,
766,
1020,
13,
10943,
16254,
62,
7206,
7708,
35342,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
81,
4906,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
16684,
13,
22882,
63,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2638,
62,
16366,
796,
2638,
62,
16366,
393,
9394,
3558,
11792,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
27967,
49025,
4533,
4566,
26235,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
796,
8633,
7,
10943,
16254,
62,
7206,
7708,
35342,
11,
12429,
7,
11250,
393,
23884,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1509,
7928,
62,
16684,
796,
18291,
13,
6738,
62,
11600,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1020,
62,
11600,
11,
8159,
62,
6371,
11,
2638,
62,
16366,
11,
4566,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
537,
82,
7,
2032,
7928,
62,
16684,
8,
628,
220,
220,
220,
825,
11593,
1136,
35226,
834,
7,
944,
11,
2378,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2378,
25,
1438,
286,
262,
8271,
284,
1441,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
1058,
4871,
25,
63,
26198,
63,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8271,
796,
2116,
13,
2032,
7928,
62,
16684,
13,
37540,
13,
1136,
7,
9186,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
8271,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
3460,
4163,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
26198,
1391,
15,
92,
407,
1043,
13,
14898,
4133,
25,
1391,
16,
92,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
764,
18982,
7,
9186,
11,
46083,
45302,
22179,
7,
15908,
7,
944,
35514,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
41028,
49025,
4533,
12,
7295,
338,
20857,
290,
14680,
5563,
287,
1502,
284,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
12260,
257,
2139,
869,
2884,
262,
2638,
62,
16366,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
20857,
10707,
273,
1352,
7,
31092,
8,
628,
198,
4299,
8677,
62,
50145,
62,
1640,
62,
47960,
62,
5420,
82,
7,
25927,
62,
13345,
540,
11,
2581,
62,
50145,
2599,
198,
220,
220,
220,
37227,
818,
752,
2581,
62,
50145,
691,
618,
262,
2581,
318,
284,
19818,
262,
198,
220,
220,
220,
6569,
1006,
82,
287,
262,
1509,
7928,
1020,
357,
14259,
852,
257,
2581,
329,
257,
2139,
869,
737,
628,
220,
220,
220,
1058,
17143,
2581,
62,
13345,
540,
25,
2446,
319,
2638,
62,
16366,
284,
787,
257,
2638,
2581,
198,
220,
220,
220,
1058,
17143,
2581,
62,
50145,
25,
24697,
284,
8677,
618,
50122,
6569,
1006,
82,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1441,
2581,
62,
48553,
628,
198,
4871,
20857,
10707,
273,
1352,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
27323,
862,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
31092,
13,
26198,
63,
523,
326,
1895,
274,
284,
7763,
198,
220,
220,
220,
4560,
460,
307,
8875,
276,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
8271,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
8271,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
31092,
13,
26198,
63,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
31092,
796,
8271,
628,
220,
220,
220,
825,
11593,
1136,
35226,
834,
7,
944,
11,
1438,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
81,
4906,
25,
1058,
4871,
25,
63,
14134,
540,
32180,
63,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4889,
540,
32180,
7,
1136,
35226,
7,
944,
13,
31092,
11,
1438,
4008,
628,
220,
220,
220,
825,
11593,
15908,
834,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
4832,
3376,
708,
3808,
319,
8271,
618,
7400,
14339,
287,
257,
45285,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
31092,
13,
834,
15908,
834,
3419,
628,
198,
4871,
4889,
540,
32180,
7,
15252,
2599,
198,
220,
220,
220,
37227,
36918,
862,
281,
4905,
284,
787,
340,
869,
540,
290,
3769,
257,
2205,
8841,
13,
32677,
198,
220,
220,
220,
262,
4905,
3544,
262,
17839,
2638,
62,
16366,
13,
628,
220,
220,
220,
1058,
4906,
4905,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
27184,
13,
32180,
63,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
2488,
15390,
8841,
62,
26745,
7,
834,
15390,
834,
8,
628,
220,
220,
220,
825,
11593,
1136,
35226,
834,
7,
944,
11,
1438,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
39746,
7007,
329,
708,
3808,
407,
1043,
319,
428,
11705,
1352,
284,
262,
198,
220,
220,
220,
220,
220,
220,
220,
23191,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
651,
35226,
7,
944,
13,
27184,
11,
1438,
8,
628,
220,
220,
220,
825,
11593,
13345,
834,
7,
944,
11,
12429,
404,
62,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
19904,
2088,
262,
4036,
14626,
2581,
290,
1441,
257,
2003,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
81,
4906,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
13,
4023,
62,
37443,
13,
40717,
29783,
63,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
13,
24442,
7,
84,
1,
4,
82,
7,
4,
82,
16725,
4064,
357,
944,
13,
27184,
13,
27184,
62,
312,
11,
1034,
62,
46265,
22046,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
9828,
62,
1640,
62,
10378,
31023,
62,
404,
7,
944,
13,
27184,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
27967,
2581,
62,
25811,
26235,
198,
220,
220,
220,
220,
220,
220,
220,
2581,
62,
25811,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4526,
35780,
62,
3185,
51,
11053,
62,
7206,
7708,
35342,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12429,
7,
404,
62,
46265,
22046,
13,
12924,
10786,
62,
25927,
62,
25811,
3256,
23884,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
2581,
62,
37266,
796,
5678,
62,
25927,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
27184,
11,
2581,
62,
25811,
11,
12429,
404,
62,
46265,
22046,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4566,
796,
2116,
13,
27184,
13,
2032,
7928,
62,
16684,
13,
11250,
198,
220,
220,
220,
220,
220,
220,
220,
2638,
62,
16366,
796,
2116,
13,
27184,
13,
2032,
7928,
62,
16684,
13,
4023,
62,
16366,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2448,
12,
25927,
4566,
23170,
1460,
5456,
3094,
4566,
198,
220,
220,
220,
220,
220,
220,
220,
635,
62,
7783,
62,
26209,
796,
2581,
62,
25811,
13,
1136,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14508,
62,
7783,
62,
26209,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4566,
17816,
14508,
62,
7783,
62,
26209,
6,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2638,
62,
16366,
13,
25927,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2581,
62,
37266,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4905,
28,
944,
13,
27184,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2882,
62,
13345,
10146,
28,
25927,
62,
25811,
17816,
26209,
62,
13345,
10146,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
635,
62,
7783,
62,
26209,
28,
14508,
62,
7783,
62,
26209,
8,
628,
198,
4299,
5678,
62,
25927,
7,
27184,
11,
2581,
62,
25811,
11,
12429,
404,
62,
46265,
22046,
2599,
198,
220,
220,
220,
37227,
42316,
262,
28181,
2581,
8633,
13,
628,
220,
220,
220,
1058,
4906,
4905,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
27184,
13,
32180,
63,
198,
220,
220,
220,
1058,
17143,
2581,
62,
25811,
25,
4808,
25927,
62,
25811,
3804,
656,
262,
4905,
198,
220,
220,
220,
220,
220,
220,
220,
43219,
13,
198,
220,
220,
220,
1058,
17143,
1034,
62,
46265,
22046,
25,
11507,
1438,
14,
8367,
14729,
284,
3804,
284,
262,
198,
220,
220,
220,
220,
220,
220,
220,
43219,
286,
262,
4905,
13,
628,
220,
220,
220,
1058,
7783,
25,
2581,
287,
8633,
1296,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
19016,
796,
4905,
13,
2032,
7928,
62,
16684,
13,
15042,
62,
6371,
13,
81,
36311,
10786,
14,
11537,
1343,
4905,
13,
6978,
62,
3672,
198,
220,
220,
220,
2581,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
24396,
10354,
4905,
13,
4023,
62,
24396,
13,
45828,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
705,
6371,
10354,
19016,
11,
198,
220,
220,
220,
220,
220,
220,
220,
705,
37266,
10354,
1391,
5512,
220,
1303,
5901,
287,
33218,
198,
220,
220,
220,
220,
220,
220,
220,
705,
50145,
10354,
2581,
62,
25811,
13,
1136,
10786,
50145,
3256,
23884,
828,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
1303,
17393,
625,
11902,
2581,
3689,
198,
220,
220,
220,
329,
2581,
62,
18076,
287,
19203,
8443,
62,
48678,
3256,
705,
48678,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2581,
62,
18076,
287,
2581,
62,
25811,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2581,
58,
25927,
62,
18076,
60,
796,
2581,
62,
25811,
58,
25927,
62,
18076,
60,
628,
220,
220,
220,
5678,
62,
37266,
7,
27184,
11,
2581,
11,
1034,
62,
46265,
22046,
8,
198,
220,
220,
220,
1441,
2581,
628,
198,
4299,
5678,
62,
37266,
7,
27184,
11,
2581,
11,
1034,
62,
46265,
22046,
2599,
198,
220,
220,
220,
37227,
15056,
262,
10007,
3804,
284,
262,
4905,
43219,
11,
4938,
689,
290,
198,
220,
220,
220,
22397,
874,
262,
10007,
656,
262,
2810,
2581,
8633,
13,
628,
220,
220,
220,
1058,
4906,
4905,
25,
1058,
4871,
25,
63,
65,
4108,
4533,
62,
7295,
13,
27184,
13,
32180,
63,
198,
220,
220,
220,
1058,
4906,
2581,
25,
8633,
198,
220,
220,
220,
1058,
17143,
1034,
62,
46265,
22046,
25,
262,
479,
86,
22046,
3804,
284,
262,
4905,
43219,
628,
220,
220,
220,
1058,
430,
2696,
25,
2451,
7928,
44,
5912,
12331,
319,
3131,
10007,
393,
618,
257,
2672,
198,
220,
220,
220,
220,
220,
220,
220,
11507,
318,
407,
14275,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1459,
62,
37266,
796,
4905,
13,
37266,
13,
30073,
3419,
198,
220,
220,
220,
329,
5772,
62,
3672,
11,
5772,
62,
8367,
287,
11629,
23814,
7,
404,
62,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
5772,
796,
1459,
62,
37266,
13,
12924,
7,
17143,
62,
3672,
11,
6045,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5772,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
2451,
7928,
44,
5912,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45144,
15,
92,
857,
407,
423,
11507,
1391,
16,
36786,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
764,
18982,
7,
27184,
13,
27184,
62,
312,
11,
5772,
62,
3672,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
22397,
282,
62,
17143,
7,
17143,
11,
5772,
62,
8367,
11,
2581,
8,
628,
220,
220,
220,
1303,
6822,
2672,
42287,
290,
1729,
12,
35827,
42287,
351,
257,
705,
12286,
6,
1988,
198,
220,
220,
220,
329,
5637,
62,
17143,
287,
340,
712,
282,
947,
7,
14421,
62,
37266,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5637,
62,
17143,
13,
35827,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
2451,
7928,
44,
5912,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
90,
15,
92,
318,
257,
2672,
11507,
4458,
18982,
7,
2787,
1397,
62,
17143,
13,
3672,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
5637,
62,
17143,
13,
35827,
290,
5637,
62,
17143,
13,
10134,
62,
12286,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22397,
282,
62,
17143,
7,
2787,
1397,
62,
17143,
11,
6045,
11,
2581,
8,
198
] | 2.429392 | 4,355 |
# coding:utf-8
import json
import pickle
import requests
import os
import re
from io import BytesIO
BASE_DIR = os.path.dirname(__file__)
# LOGIN_URL = 'http://grdms.bit.edu.cn/yjs/login_cas.jsp'
# LOGIN_URL = 'https://login.bit.edu.cn/cas/login?service=https://login.bit.edu.cn/campus-account/shiro-cas'
LOGIN_URL = 'https://login.bit.edu.cn/cas/login?service=http%3A%2F%2Fgrdms.bit.edu.cn%2Fyjs%2Flogin_cas.jsp'
# LOGIN_INDEX_URL = 'https://login.bit.edu.cn/cas/login?service=https://login.bit.edu.cn/campus-account/shiro-cas'
LOGIN_INDEX_URL = LOGIN_URL
# 验证码
CAPTCHA_URL = 'https://login.bit.edu.cn/cas/captcha.html'
NEED_CAPTCHA_URL = 'https://login.bit.edu.cn/cas/needCaptcha.html?username=%s'
| [
2,
19617,
25,
40477,
12,
23,
198,
11748,
33918,
198,
11748,
2298,
293,
198,
198,
11748,
7007,
198,
11748,
28686,
198,
11748,
302,
198,
6738,
33245,
1330,
2750,
4879,
9399,
198,
198,
33,
11159,
62,
34720,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
8,
198,
2,
41605,
1268,
62,
21886,
796,
705,
4023,
1378,
2164,
67,
907,
13,
2545,
13,
15532,
13,
31522,
14,
88,
8457,
14,
38235,
62,
34004,
13,
73,
2777,
6,
198,
2,
41605,
1268,
62,
21886,
796,
705,
5450,
1378,
38235,
13,
2545,
13,
15532,
13,
31522,
14,
34004,
14,
38235,
30,
15271,
28,
5450,
1378,
38235,
13,
2545,
13,
15532,
13,
31522,
14,
43842,
12,
23317,
14,
1477,
7058,
12,
34004,
6,
198,
25294,
1268,
62,
21886,
796,
705,
5450,
1378,
38235,
13,
2545,
13,
15532,
13,
31522,
14,
34004,
14,
38235,
30,
15271,
28,
4023,
4,
18,
32,
4,
17,
37,
4,
17,
37,
2164,
67,
907,
13,
2545,
13,
15532,
13,
31522,
4,
17,
37,
88,
8457,
4,
17,
37,
38235,
62,
34004,
13,
73,
2777,
6,
198,
2,
41605,
1268,
62,
12115,
6369,
62,
21886,
796,
705,
5450,
1378,
38235,
13,
2545,
13,
15532,
13,
31522,
14,
34004,
14,
38235,
30,
15271,
28,
5450,
1378,
38235,
13,
2545,
13,
15532,
13,
31522,
14,
43842,
12,
23317,
14,
1477,
7058,
12,
34004,
6,
198,
25294,
1268,
62,
12115,
6369,
62,
21886,
796,
41605,
1268,
62,
21886,
198,
2,
16268,
103,
234,
46237,
223,
163,
254,
223,
198,
33177,
51,
49285,
62,
21886,
796,
705,
5450,
1378,
38235,
13,
2545,
13,
15532,
13,
31522,
14,
34004,
14,
27144,
11693,
13,
6494,
6,
198,
12161,
1961,
62,
33177,
51,
49285,
62,
21886,
796,
705,
5450,
1378,
38235,
13,
2545,
13,
15532,
13,
31522,
14,
34004,
14,
31227,
19209,
11693,
13,
6494,
30,
29460,
28,
4,
82,
6,
198
] | 2.283388 | 307 |
import discord, requests, os
from discord.ext import commands, tasks
from discord_components import DiscordComponents
from config import token, db
from typing import Union
from help_ import CustomHelpCommand
config = db["config"]
links = db["linked"]
presence_count = 0
intents = discord.Intents.all()
bot = commands.Bot(
command_prefix="/",
intents=intents,
help_command=CustomHelpCommand(),
case_insensitive=True,
)
DiscordComponents(bot)
@tasks.loop(seconds=20)
@bot.event
if __name__ == "__main__":
bot.load_extension("cogs.commands")
bot.load_extension("cogs.news")
bot.run(token)
| [
11748,
36446,
11,
7007,
11,
28686,
201,
198,
6738,
36446,
13,
2302,
1330,
9729,
11,
8861,
201,
198,
6738,
36446,
62,
5589,
3906,
1330,
39462,
7293,
3906,
201,
198,
6738,
4566,
1330,
11241,
11,
20613,
201,
198,
6738,
19720,
1330,
4479,
201,
198,
6738,
1037,
62,
1330,
8562,
22087,
21575,
201,
198,
201,
198,
201,
198,
11250,
796,
20613,
14692,
11250,
8973,
201,
198,
28751,
796,
20613,
14692,
25614,
8973,
201,
198,
201,
198,
18302,
594,
62,
9127,
796,
657,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
600,
658,
796,
36446,
13,
5317,
658,
13,
439,
3419,
201,
198,
201,
198,
13645,
796,
9729,
13,
20630,
7,
201,
198,
220,
220,
220,
3141,
62,
40290,
35922,
1600,
201,
198,
220,
220,
220,
493,
658,
28,
600,
658,
11,
201,
198,
220,
220,
220,
1037,
62,
21812,
28,
15022,
22087,
21575,
22784,
201,
198,
220,
220,
220,
1339,
62,
1040,
18464,
28,
17821,
11,
201,
198,
8,
201,
198,
15642,
585,
7293,
3906,
7,
13645,
8,
201,
198,
201,
198,
201,
198,
31,
83,
6791,
13,
26268,
7,
43012,
28,
1238,
8,
201,
198,
201,
198,
201,
198,
31,
13645,
13,
15596,
201,
198,
201,
198,
201,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
201,
198,
220,
220,
220,
10214,
13,
2220,
62,
2302,
3004,
7203,
66,
18463,
13,
9503,
1746,
4943,
201,
198,
220,
220,
220,
10214,
13,
2220,
62,
2302,
3004,
7203,
66,
18463,
13,
10827,
4943,
201,
198,
201,
198,
220,
220,
220,
10214,
13,
5143,
7,
30001,
8,
201,
198
] | 2.553435 | 262 |
from vtk import *
source = vtkRandomGraphSource()
source.DirectedOff()
source.SetNumberOfVertices(50)
source.SetEdgeProbability(0.01)
source.SetUseEdgeProbability(True)
source.AllowParallelEdgesOn()
source.AllowSelfLoopsOn()
source.SetStartWithTree(True)
# Connect to the Boost centrality filter.
centrality = vtkBoostBrandesCentrality ()
centrality.SetInputConnection(source.GetOutputPort())
view = vtkGraphLayoutView()
view.AddRepresentationFromInputConnection(centrality.GetOutputPort())
view.SetVertexLabelArrayName("centrality")
view.SetVertexLabelVisibility(True)
view.SetVertexColorArrayName("centrality")
view.SetColorVertices(True)
view.SetEdgeLabelArrayName("centrality")
#view.SetEdgeLabelVisibility(True)
view.SetEdgeColorArrayName("centrality")
view.SetColorEdges(True)
view.SetLayoutStrategyToSimple2D()
theme = vtkViewTheme.CreateMellowTheme()
theme.SetLineWidth(5)
theme.SetPointSize(10)
theme.SetCellOpacity(1)
theme.SetVertexLabelColor(0, 0, 0)
view.ApplyViewTheme(theme)
theme.FastDelete()
view.GetRenderWindow().SetSize(600, 600)
view.ResetCamera()
view.Render()
view.GetInteractor().Start()
| [
6738,
410,
30488,
1330,
1635,
198,
198,
10459,
796,
410,
30488,
29531,
37065,
7416,
3419,
198,
10459,
13,
13470,
276,
9362,
3419,
198,
10459,
13,
7248,
15057,
5189,
42369,
1063,
7,
1120,
8,
198,
10459,
13,
7248,
37021,
2964,
65,
1799,
7,
15,
13,
486,
8,
198,
10459,
13,
7248,
11041,
37021,
2964,
65,
1799,
7,
17821,
8,
198,
10459,
13,
35265,
10044,
29363,
7407,
3212,
2202,
3419,
198,
10459,
13,
35265,
24704,
27654,
2840,
2202,
3419,
198,
10459,
13,
7248,
10434,
3152,
27660,
7,
17821,
8,
628,
198,
2,
8113,
284,
262,
19835,
4318,
414,
8106,
13,
198,
31463,
414,
796,
410,
30488,
45686,
38416,
274,
30645,
414,
7499,
198,
31463,
414,
13,
7248,
20560,
32048,
7,
10459,
13,
3855,
26410,
13924,
28955,
628,
198,
1177,
796,
410,
30488,
37065,
32517,
7680,
3419,
198,
1177,
13,
4550,
40171,
341,
4863,
20560,
32048,
7,
31463,
414,
13,
3855,
26410,
13924,
28955,
198,
1177,
13,
7248,
13414,
16886,
33986,
19182,
5376,
7203,
31463,
414,
4943,
198,
1177,
13,
7248,
13414,
16886,
33986,
15854,
2247,
7,
17821,
8,
198,
1177,
13,
7248,
13414,
16886,
10258,
19182,
5376,
7203,
31463,
414,
4943,
198,
1177,
13,
7248,
10258,
42369,
1063,
7,
17821,
8,
198,
1177,
13,
7248,
37021,
33986,
19182,
5376,
7203,
31463,
414,
4943,
198,
2,
1177,
13,
7248,
37021,
33986,
15854,
2247,
7,
17821,
8,
198,
1177,
13,
7248,
37021,
10258,
19182,
5376,
7203,
31463,
414,
4943,
198,
1177,
13,
7248,
10258,
7407,
3212,
7,
17821,
8,
198,
1177,
13,
7248,
32517,
13290,
4338,
2514,
26437,
17,
35,
3419,
198,
198,
43810,
796,
410,
30488,
7680,
47863,
13,
16447,
44,
5037,
47863,
3419,
198,
43810,
13,
7248,
13949,
30916,
7,
20,
8,
198,
43810,
13,
7248,
12727,
10699,
7,
940,
8,
198,
43810,
13,
7248,
28780,
18257,
4355,
7,
16,
8,
198,
43810,
13,
7248,
13414,
16886,
33986,
10258,
7,
15,
11,
657,
11,
657,
8,
198,
1177,
13,
44836,
7680,
47863,
7,
43810,
8,
198,
43810,
13,
22968,
38727,
3419,
198,
198,
1177,
13,
3855,
45819,
27703,
22446,
7248,
10699,
7,
8054,
11,
10053,
8,
198,
1177,
13,
4965,
316,
35632,
3419,
198,
1177,
13,
45819,
3419,
198,
198,
1177,
13,
3855,
9492,
11218,
22446,
10434,
3419,
628
] | 3.054496 | 367 |
import input_data #input import
BLOSUM52=input_data.BLOSUM52
seq2=input_data.seq2
seq1=input_data.seq1
matrix=NW_matrix(seq1,seq2,BLOSUM52,-2) #compute 2 matrix, gap penality is set to -2
result=allign(matrix[0],matrix[1],seq1,seq2) #use matrix obtained before to get the alignment
print(result[0],result[1]) #and print it with it's score | [
11748,
5128,
62,
7890,
220,
197,
197,
197,
197,
197,
197,
197,
197,
197,
197,
2,
15414,
1330,
198,
9148,
2640,
5883,
4309,
28,
15414,
62,
7890,
13,
9148,
2640,
5883,
4309,
198,
41068,
17,
28,
15414,
62,
7890,
13,
41068,
17,
198,
41068,
16,
28,
15414,
62,
7890,
13,
41068,
16,
198,
198,
6759,
8609,
28,
27605,
62,
6759,
8609,
7,
41068,
16,
11,
41068,
17,
11,
9148,
2640,
5883,
4309,
12095,
17,
8,
220,
1303,
5589,
1133,
362,
17593,
11,
7625,
3112,
1483,
318,
900,
284,
532,
17,
198,
20274,
28,
439,
570,
7,
6759,
8609,
58,
15,
4357,
6759,
8609,
58,
16,
4357,
41068,
16,
11,
41068,
17,
8,
1303,
1904,
17593,
6492,
878,
284,
651,
262,
19114,
198,
4798,
7,
20274,
58,
15,
4357,
20274,
58,
16,
12962,
1303,
392,
3601,
340,
351,
340,
338,
4776
] | 2.5 | 140 |
directions = open('input', 'r').read().strip().split(', ')
x = 0
y = 0
facing = 0 #North
visited = {}
visited[(x, y)] = True
for direction in directions:
if direction[0] == 'R':
facing += 1
else:
facing -= 1
if facing < 0:
facing = 3
elif facing > 3:
facing = 0
count = int(direction[1:])
for i in range(count):
if facing == 0: # North
y += 1
elif facing == 1: # East
x += 1
elif facing == 2: # South
y -= 1
elif facing == 3: # West
x -= 1
position = (x, y)
if visited.get(position, False):
# Absolute values because direction isn't relevant, just distance
x = abs(x)
y = abs(y)
print(x + y)
exit()
visited[position] = True
| [
12942,
507,
796,
1280,
10786,
15414,
3256,
705,
81,
27691,
961,
22446,
36311,
22446,
35312,
7,
3256,
705,
8,
198,
87,
796,
657,
198,
88,
796,
657,
198,
29532,
796,
657,
1303,
14157,
198,
4703,
863,
796,
23884,
198,
4703,
863,
58,
7,
87,
11,
331,
15437,
796,
6407,
198,
198,
1640,
4571,
287,
11678,
25,
198,
220,
220,
220,
611,
4571,
58,
15,
60,
6624,
705,
49,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
6476,
15853,
352,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6476,
48185,
352,
628,
220,
220,
220,
611,
6476,
1279,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6476,
796,
513,
198,
220,
220,
220,
1288,
361,
6476,
1875,
513,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6476,
796,
657,
628,
220,
220,
220,
954,
796,
493,
7,
37295,
58,
16,
25,
12962,
628,
220,
220,
220,
329,
1312,
287,
2837,
7,
9127,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
6476,
6624,
657,
25,
1303,
2258,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
15853,
352,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
6476,
6624,
352,
25,
1303,
3687,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
6476,
6624,
362,
25,
1303,
2520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
48185,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
6476,
6624,
513,
25,
1303,
2688,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
48185,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2292,
796,
357,
87,
11,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
8672,
13,
1136,
7,
9150,
11,
10352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
36532,
3815,
780,
4571,
2125,
470,
5981,
11,
655,
5253,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
2352,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
796,
2352,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
87,
1343,
331,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8420,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
8672,
58,
9150,
60,
796,
6407,
198
] | 2 | 425 |
from ..broker import Broker
| [
6738,
11485,
7957,
6122,
1330,
2806,
6122,
628
] | 3.625 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.