content
stringlengths 1
1.04M
| input_ids
sequencelengths 1
774k
| ratio_char_token
float64 0.38
22.9
| token_count
int64 1
774k
|
---|---|---|---|
import cv2 # import OpenCv lib
cap = cv2.VideoCapture(0) # create cap object
# set the format into MJPG in the FourCC format
# cap.set(cv2.CAP_PROP_FOURCC,cv2.VideoWriter_fourcc('M','J','P','G'))
cap.set(cv2.CAP_PROP_FOURCC,cv2.VideoWriter_fourcc('J','P','E','G'))
if not cap.isOpened(): # check if the camera is opened
print('Cannot open webcam')
else:
while True:
success, frame = cap. read() # read frames
cv2.imshow(" Captured: " , frame) # show frames in the window
if cv2.waitKey(1) == 27: # check if the user press ESC or not
break
cap.release() # stop
cv2. destroyAllWindows() | [
11748,
269,
85,
17,
220,
220,
220,
220,
220,
220,
197,
197,
197,
197,
197,
220,
220,
220,
220,
220,
220,
220,
1303,
1330,
4946,
34,
85,
9195,
198,
11128,
796,
269,
85,
17,
13,
10798,
49630,
7,
15,
8,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
197,
220,
220,
220,
1303,
2251,
1451,
2134,
220,
198,
198,
2,
900,
262,
5794,
656,
33974,
6968,
287,
262,
6675,
4093,
5794,
220,
198,
2,
1451,
13,
2617,
7,
33967,
17,
13,
33177,
62,
4805,
3185,
62,
37,
11698,
4093,
11,
33967,
17,
13,
10798,
34379,
62,
14337,
535,
10786,
44,
41707,
41,
41707,
47,
41707,
38,
6,
4008,
198,
198,
11128,
13,
2617,
7,
33967,
17,
13,
33177,
62,
4805,
3185,
62,
37,
11698,
4093,
11,
33967,
17,
13,
10798,
34379,
62,
14337,
535,
10786,
41,
41707,
47,
41707,
36,
41707,
38,
6,
4008,
628,
198,
361,
407,
1451,
13,
271,
18257,
2945,
33529,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
197,
2,
2198,
611,
262,
4676,
318,
4721,
198,
220,
220,
220,
3601,
10786,
34,
34574,
1280,
49823,
11537,
198,
17772,
25,
198,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1943,
11,
5739,
796,
1451,
13,
1100,
3419,
220,
220,
220,
220,
220,
220,
220,
1303,
1100,
13431,
220,
198,
220,
220,
220,
220,
220,
220,
220,
269,
85,
17,
13,
320,
12860,
7203,
6790,
1522,
25,
366,
837,
5739,
8,
220,
220,
1303,
905,
13431,
287,
262,
4324,
198,
220,
220,
220,
220,
220,
220,
220,
611,
269,
85,
17,
13,
17077,
9218,
7,
16,
8,
6624,
2681,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2198,
611,
262,
2836,
1803,
40251,
393,
407,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
11128,
13,
20979,
3419,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2245,
220,
198,
33967,
17,
13,
4117,
3237,
11209,
3419,
220,
220,
220
] | 2.016216 | 370 |
"""
Module for unit tests for translations
"""
import unittest
from translator import french_to_english, english_to_french
class TranslationTest(unittest.TestCase):
"""This Class contains the unit tests for translations"""
def test_french_to_english(self):
"""This method tests the French to English Translations"""
self.assertEqual(french_to_english(""),None)
self.assertEqual(french_to_english("Bonjour"),[{'translation': 'Hello'}])
def test_english_to_french(self):
"""This method tests the English to French Translations"""
self.assertEqual(english_to_french(""),None)
self.assertEqual(english_to_french("Hello"),[{'translation': 'Bonjour'}])
if __name__=='__main__':
unittest.main()
| [
37811,
198,
26796,
329,
4326,
5254,
329,
25231,
198,
37811,
198,
198,
11748,
555,
715,
395,
198,
198,
6738,
33417,
1330,
48718,
62,
1462,
62,
39126,
11,
46932,
62,
1462,
62,
69,
3532,
198,
198,
4871,
33322,
14402,
7,
403,
715,
395,
13,
14402,
20448,
2599,
198,
220,
220,
220,
37227,
1212,
5016,
4909,
262,
4326,
5254,
329,
25231,
37811,
628,
220,
220,
220,
825,
1332,
62,
69,
3532,
62,
1462,
62,
39126,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
1212,
2446,
5254,
262,
4141,
284,
3594,
3602,
49905,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
69,
3532,
62,
1462,
62,
39126,
7203,
12340,
14202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
69,
3532,
62,
1462,
62,
39126,
7203,
20682,
73,
454,
12340,
58,
90,
6,
41519,
10354,
705,
15496,
6,
92,
12962,
628,
220,
220,
220,
825,
1332,
62,
39126,
62,
1462,
62,
69,
3532,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
1212,
2446,
5254,
262,
3594,
284,
4141,
3602,
49905,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
39126,
62,
1462,
62,
69,
3532,
7203,
12340,
14202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
39126,
62,
1462,
62,
69,
3532,
7203,
15496,
12340,
58,
90,
6,
41519,
10354,
705,
20682,
73,
454,
6,
92,
12962,
198,
198,
361,
11593,
3672,
834,
855,
6,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 2.804428 | 271 |
for value in range(1,11):
print(str(value)) | [
1640,
1988,
287,
2837,
7,
16,
11,
1157,
2599,
198,
220,
220,
220,
3601,
7,
2536,
7,
8367,
4008
] | 2.473684 | 19 |
import operator
import sys
sys.path.append("..")
from collections import defaultdict, namedtuple
from intcode import IntCodeMachine, open_file
# The logic is as follows.
# If we would fall into a gap otherwise, we jump (NOT A T // OR T J)
# We jump early, that is a gap at B or C if we have an out, that is we can move to E or we can jump to H.
input_string = """\
OR B J
AND C J
NOT J J
AND D J
OR E T
OR H T
AND T J
NOT A T
OR T J
RUN
"""
inputs = [ord(c) for c in input_string]
if __name__ == '__main__':
run()
| [
11748,
10088,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
33295,
7203,
492,
4943,
198,
6738,
17268,
1330,
4277,
11600,
11,
3706,
83,
29291,
198,
6738,
493,
8189,
1330,
2558,
10669,
37573,
11,
1280,
62,
7753,
198,
198,
2,
383,
9156,
318,
355,
5679,
13,
198,
2,
1002,
356,
561,
2121,
656,
257,
7625,
4306,
11,
356,
4391,
357,
11929,
317,
309,
3373,
6375,
309,
449,
8,
198,
2,
775,
4391,
1903,
11,
326,
318,
257,
7625,
379,
347,
393,
327,
611,
356,
423,
281,
503,
11,
326,
318,
356,
460,
1445,
284,
412,
393,
356,
460,
4391,
284,
367,
13,
198,
15414,
62,
8841,
796,
37227,
59,
198,
1581,
347,
449,
198,
6981,
327,
449,
198,
11929,
449,
449,
198,
6981,
360,
449,
198,
1581,
412,
309,
198,
1581,
367,
309,
198,
6981,
309,
449,
198,
11929,
317,
309,
198,
1581,
309,
449,
198,
49,
4944,
198,
37811,
198,
15414,
82,
796,
685,
585,
7,
66,
8,
329,
269,
287,
5128,
62,
8841,
60,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1057,
3419,
198
] | 2.826087 | 184 |
from .party_affiliation import PartyAffiliation
| [
6738,
764,
10608,
62,
2001,
15547,
1330,
3615,
35191,
15547,
628
] | 4.454545 | 11 |
# Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem
# ou não formar um triângulo.
r1 = int(input('Valor do primeiro segmento: '))
r2 = int(input('Valor do segundo segmento: '))
r3 = int(input('Valor do terceiro segmento: '))
if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2:
print('Os segmentos acima PODEM formar um triângulo!')
else:
print('Os segmentos acima não podem formar um triângulo!')
| [
2,
2935,
268,
10396,
6862,
23781,
1430,
64,
8358,
443,
544,
267,
552,
3036,
50217,
390,
491,
25792,
82,
1005,
292,
304,
3100,
64,
257,
78,
514,
84,
6557,
27250,
384,
1288,
292,
24573,
368,
198,
2,
267,
84,
299,
28749,
1296,
283,
23781,
1333,
22940,
782,
43348,
13,
198,
198,
81,
16,
796,
493,
7,
15414,
10786,
7762,
273,
466,
6994,
7058,
10618,
78,
25,
705,
4008,
198,
81,
17,
796,
493,
7,
15414,
10786,
7762,
273,
466,
384,
70,
41204,
10618,
78,
25,
705,
4008,
198,
81,
18,
796,
493,
7,
15414,
10786,
7762,
273,
466,
1059,
344,
7058,
10618,
78,
25,
705,
4008,
198,
198,
361,
374,
16,
1279,
374,
17,
1343,
374,
18,
290,
374,
17,
1279,
374,
16,
1343,
374,
18,
290,
374,
18,
1279,
374,
16,
1343,
374,
17,
25,
198,
220,
220,
220,
3601,
10786,
16748,
10618,
418,
936,
8083,
350,
3727,
3620,
1296,
283,
23781,
1333,
22940,
782,
43348,
0,
11537,
198,
17772,
25,
198,
220,
220,
220,
3601,
10786,
16748,
10618,
418,
936,
8083,
299,
28749,
24573,
368,
1296,
283,
23781,
1333,
22940,
782,
43348,
0,
11537,
198
] | 2.395722 | 187 |
name='Noaman Monther Mahmood'
job='Full-Stack Mobile Developer'
header= 'This Job is Done By'
desc='And it is one of the requirements to be accepted in th Full-Stack Development Bootcamp \nthat is implemented by Computiq and and GIZ Interview' | [
198,
3672,
11639,
2949,
10546,
2892,
490,
31556,
702,
6,
198,
21858,
11639,
13295,
12,
25896,
12173,
23836,
6,
198,
25677,
28,
705,
1212,
15768,
318,
24429,
2750,
6,
198,
20147,
11639,
1870,
340,
318,
530,
286,
262,
5359,
284,
307,
6292,
287,
294,
6462,
12,
25896,
7712,
18892,
16544,
3467,
77,
5562,
318,
9177,
416,
22476,
25011,
290,
290,
402,
14887,
19371,
6
] | 3.8125 | 64 |
#!/usr/bin/env python
# Copyright 2008-2018 Univa Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import shutil
from tortuga.kit.installer import KitInstallerBase
from tortuga.kit.manager import KitManager
from tortuga.os_utility import tortugaSubprocess
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
2,
15069,
3648,
12,
7908,
791,
12151,
10501,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
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,
11748,
28686,
198,
11748,
4423,
346,
198,
198,
6738,
7619,
30302,
13,
15813,
13,
17350,
263,
1330,
10897,
15798,
263,
14881,
198,
6738,
7619,
30302,
13,
15813,
13,
37153,
1330,
10897,
13511,
198,
6738,
7619,
30302,
13,
418,
62,
315,
879,
1330,
7619,
30302,
7004,
14681,
628
] | 3.740385 | 208 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .dataset_utils import image_to_tfexample
from json import dump
from numpy import arange, empty, array, empty_like
from numpy.random import shuffle
from os import walk
from PIL import Image
from six.moves import urllib
import sys
import tensorflow as tf
_IMAGE_SIZE = 224
_NUM_CHANNELS = 3
def _add_to_tfrecord(images, labels, num_images, tfrecord_writer):
"""
Loads data from the binary MNIST files and writes files to a TFRecord.
Args:
data_filename: The filename of the MNIST images.
labels_filename: The filename of the MNIST labels.
num_images: The number of images in the dataset.
"""
shape = (_IMAGE_SIZE, _IMAGE_SIZE, _NUM_CHANNELS)
with tf.Graph().as_default():
image = tf.placeholder(dtype=tf.uint8, shape=shape)
encoded_png = tf.image.encode_png(image)
with tf.Session('') as sess:
for j in range(num_images):
sys.stdout.write('\r>> Converting image %d/%d' % (j + 1, num_images))
sys.stdout.flush()
png_string = sess.run(encoded_png, feed_dict={image: images[j]})
example = image_to_tfexample(png_string, 'png'.encode(), _IMAGE_SIZE, _IMAGE_SIZE, labels[j])
tfrecord_writer.write(example.SerializeToString()) | [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
6738,
764,
19608,
292,
316,
62,
26791,
1330,
2939,
62,
1462,
62,
27110,
20688,
198,
6738,
33918,
1330,
10285,
198,
6738,
299,
32152,
1330,
610,
858,
11,
6565,
11,
7177,
11,
6565,
62,
2339,
198,
6738,
299,
32152,
13,
25120,
1330,
36273,
198,
6738,
28686,
1330,
2513,
198,
6738,
350,
4146,
1330,
7412,
198,
6738,
2237,
13,
76,
5241,
1330,
2956,
297,
571,
198,
11748,
25064,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
198,
62,
3955,
11879,
62,
33489,
796,
26063,
198,
62,
41359,
62,
3398,
22846,
37142,
796,
513,
628,
198,
198,
4299,
4808,
2860,
62,
1462,
62,
27110,
22105,
7,
17566,
11,
14722,
11,
997,
62,
17566,
11,
48700,
22105,
62,
16002,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8778,
82,
1366,
422,
262,
13934,
29060,
8808,
3696,
290,
6797,
3696,
284,
257,
24958,
23739,
13,
198,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
34345,
25,
383,
29472,
286,
262,
29060,
8808,
4263,
13,
198,
220,
220,
220,
220,
220,
220,
220,
14722,
62,
34345,
25,
383,
29472,
286,
262,
29060,
8808,
14722,
13,
198,
220,
220,
220,
220,
220,
220,
220,
997,
62,
17566,
25,
383,
1271,
286,
4263,
287,
262,
27039,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5485,
796,
44104,
3955,
11879,
62,
33489,
11,
4808,
3955,
11879,
62,
33489,
11,
4808,
41359,
62,
3398,
22846,
37142,
8,
198,
220,
220,
220,
351,
48700,
13,
37065,
22446,
292,
62,
12286,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
2939,
796,
48700,
13,
5372,
13829,
7,
67,
4906,
28,
27110,
13,
28611,
23,
11,
5485,
28,
43358,
8,
198,
220,
220,
220,
220,
220,
220,
220,
30240,
62,
11134,
796,
48700,
13,
9060,
13,
268,
8189,
62,
11134,
7,
9060,
8,
198,
220,
220,
220,
220,
220,
220,
220,
351,
48700,
13,
36044,
7,
7061,
8,
355,
264,
408,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
287,
2837,
7,
22510,
62,
17566,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
19282,
448,
13,
13564,
10786,
59,
81,
4211,
35602,
889,
2939,
4064,
67,
14,
4,
67,
6,
4064,
357,
73,
1343,
352,
11,
997,
62,
17566,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
19282,
448,
13,
25925,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
782,
62,
8841,
796,
264,
408,
13,
5143,
7,
12685,
9043,
62,
11134,
11,
3745,
62,
11600,
34758,
9060,
25,
4263,
58,
73,
60,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1672,
796,
2939,
62,
1462,
62,
27110,
20688,
7,
11134,
62,
8841,
11,
705,
11134,
4458,
268,
8189,
22784,
4808,
3955,
11879,
62,
33489,
11,
4808,
3955,
11879,
62,
33489,
11,
14722,
58,
73,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
48700,
22105,
62,
16002,
13,
13564,
7,
20688,
13,
32634,
1096,
2514,
10100,
28955
] | 2.508961 | 558 |
# -*- coding: utf-8 -*-
"""
Ilustra el método de Newton-Raphson
@author: Nicolas Guarin-Zapata
"""
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["mathtext.fontset"] = "cm"
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"] = False
fun = lambda x: 0.3*np.abs(x)*x
grad = lambda x: 0.6*np.abs(x)
x = np.linspace(-2, 4, 100)
y = fun(x)
#%% Graficacion
plt.figure(figsize=(4, 3))
ax = plt.gca()
ax.plot(x, y, linewidth=2)
x0 = 4
x_iter = [x0]
ax.plot([x0, x0], [fun(x0), 0], color="#3f3f3f", linewidth=1.5,
linestyle="dashed")
ax.plot([x0], [fun(x0)], marker="o", mec="black", mfc="white",
linewidth=0, zorder=5)
for cont in range(3):
x1 = x0 - fun(x0)/grad(x0)
x_iter.append(x1)
ax.plot([x0, x1], [fun(x0), 0], color="#3f3f3f", linewidth=1.5,
linestyle="dashed", zorder=4)
ax.plot([x1, x1], [fun(x1), 0], color="#3f3f3f", linewidth=1.5,
linestyle="dashed", zorder=4)
ax.plot([x1], [fun(x1)], marker="o", mec="black",
mfc="white", linewidth=0, zorder=5)
x0 = x1
ax.plot([0], [0], marker="o",
mec="black", mfc="black", linewidth=0)
plt.xticks(x_iter + [0], [r"$x_{}$".format(k) for k in range(4)] + [r"$x^*$"])
plt.yticks([])
plt.xlabel(r"$x$", horizontalalignment="right", fontsize=12)
plt.ylabel(r"$f(x)$", fontsize=12)
ax.spines['bottom'].set_position(('data',0))
ax.xaxis.set_label_coords(1.05, 0.25)
ax.yaxis.set_label_coords(-0.05, 0.9)
plt.savefig("newton_iter.pdf", bbox_inches="tight")
plt.savefig("newton_iter.svg", bbox_inches="tight", transparent=True)
plt.show()
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
201,
198,
37811,
201,
198,
33666,
436,
430,
1288,
285,
25125,
24313,
390,
17321,
12,
49,
6570,
1559,
201,
198,
201,
198,
31,
9800,
25,
29737,
1962,
17714,
12,
57,
499,
1045,
201,
198,
37811,
201,
198,
6738,
11593,
37443,
834,
1330,
7297,
11,
3601,
62,
8818,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
201,
198,
201,
198,
489,
83,
13,
6015,
10044,
4105,
14692,
11018,
5239,
13,
10331,
2617,
8973,
796,
366,
11215,
1,
201,
198,
489,
83,
13,
6015,
10044,
4105,
14692,
897,
274,
13,
2777,
1127,
13,
4852,
8973,
796,
10352,
201,
198,
489,
83,
13,
6015,
10044,
4105,
14692,
897,
274,
13,
2777,
1127,
13,
3506,
8973,
796,
10352,
201,
198,
201,
198,
201,
198,
201,
198,
12543,
796,
37456,
2124,
25,
657,
13,
18,
9,
37659,
13,
8937,
7,
87,
27493,
87,
201,
198,
9744,
796,
37456,
2124,
25,
657,
13,
21,
9,
37659,
13,
8937,
7,
87,
8,
201,
198,
201,
198,
87,
796,
45941,
13,
21602,
10223,
32590,
17,
11,
604,
11,
1802,
8,
201,
198,
88,
796,
1257,
7,
87,
8,
201,
198,
201,
198,
201,
198,
201,
198,
2,
16626,
7037,
69,
291,
49443,
201,
198,
489,
83,
13,
26875,
7,
5647,
7857,
16193,
19,
11,
513,
4008,
201,
198,
897,
796,
458,
83,
13,
70,
6888,
3419,
201,
198,
897,
13,
29487,
7,
87,
11,
331,
11,
9493,
413,
5649,
28,
17,
8,
201,
198,
87,
15,
796,
604,
201,
198,
87,
62,
2676,
796,
685,
87,
15,
60,
201,
198,
897,
13,
29487,
26933,
87,
15,
11,
2124,
15,
4357,
685,
12543,
7,
87,
15,
828,
657,
4357,
3124,
25698,
18,
69,
18,
69,
18,
69,
1600,
9493,
413,
5649,
28,
16,
13,
20,
11,
201,
198,
220,
220,
220,
220,
220,
220,
220,
9493,
10992,
2625,
67,
5263,
4943,
201,
198,
897,
13,
29487,
26933,
87,
15,
4357,
685,
12543,
7,
87,
15,
8,
4357,
18364,
2625,
78,
1600,
502,
66,
2625,
13424,
1600,
285,
16072,
2625,
11186,
1600,
201,
198,
220,
220,
220,
220,
220,
220,
220,
9493,
413,
5649,
28,
15,
11,
1976,
2875,
28,
20,
8,
201,
198,
1640,
542,
287,
2837,
7,
18,
2599,
201,
198,
220,
220,
220,
2124,
16,
796,
2124,
15,
532,
1257,
7,
87,
15,
20679,
9744,
7,
87,
15,
8,
201,
198,
220,
220,
220,
2124,
62,
2676,
13,
33295,
7,
87,
16,
8,
201,
198,
220,
220,
220,
7877,
13,
29487,
26933,
87,
15,
11,
2124,
16,
4357,
685,
12543,
7,
87,
15,
828,
657,
4357,
3124,
25698,
18,
69,
18,
69,
18,
69,
1600,
9493,
413,
5649,
28,
16,
13,
20,
11,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
10992,
2625,
67,
5263,
1600,
1976,
2875,
28,
19,
8,
201,
198,
220,
220,
220,
7877,
13,
29487,
26933,
87,
16,
11,
2124,
16,
4357,
685,
12543,
7,
87,
16,
828,
657,
4357,
3124,
25698,
18,
69,
18,
69,
18,
69,
1600,
9493,
413,
5649,
28,
16,
13,
20,
11,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
10992,
2625,
67,
5263,
1600,
1976,
2875,
28,
19,
8,
201,
198,
220,
220,
220,
7877,
13,
29487,
26933,
87,
16,
4357,
685,
12543,
7,
87,
16,
8,
4357,
18364,
2625,
78,
1600,
502,
66,
2625,
13424,
1600,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
16072,
2625,
11186,
1600,
9493,
413,
5649,
28,
15,
11,
1976,
2875,
28,
20,
8,
201,
198,
220,
220,
220,
2124,
15,
796,
2124,
16,
201,
198,
897,
13,
29487,
26933,
15,
4357,
685,
15,
4357,
18364,
2625,
78,
1600,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
502,
66,
2625,
13424,
1600,
285,
16072,
2625,
13424,
1600,
9493,
413,
5649,
28,
15,
8,
201,
198,
489,
83,
13,
742,
3378,
7,
87,
62,
2676,
1343,
685,
15,
4357,
685,
81,
1,
3,
87,
23330,
92,
3,
1911,
18982,
7,
74,
8,
329,
479,
287,
2837,
7,
19,
15437,
1343,
685,
81,
1,
3,
87,
61,
9,
3,
8973,
8,
201,
198,
489,
83,
13,
20760,
3378,
26933,
12962,
201,
198,
489,
83,
13,
87,
18242,
7,
81,
1,
3,
87,
3,
1600,
16021,
282,
16747,
2625,
3506,
1600,
10369,
7857,
28,
1065,
8,
201,
198,
489,
83,
13,
2645,
9608,
7,
81,
1,
3,
69,
7,
87,
8,
3,
1600,
10369,
7857,
28,
1065,
8,
201,
198,
897,
13,
2777,
1127,
17816,
22487,
6,
4083,
2617,
62,
9150,
7,
10786,
7890,
3256,
15,
4008,
201,
198,
897,
13,
87,
22704,
13,
2617,
62,
18242,
62,
1073,
3669,
7,
16,
13,
2713,
11,
657,
13,
1495,
8,
201,
198,
897,
13,
88,
22704,
13,
2617,
62,
18242,
62,
1073,
3669,
32590,
15,
13,
2713,
11,
657,
13,
24,
8,
201,
198,
489,
83,
13,
21928,
5647,
7203,
3605,
1122,
62,
2676,
13,
12315,
1600,
275,
3524,
62,
45457,
2625,
33464,
4943,
201,
198,
489,
83,
13,
21928,
5647,
7203,
3605,
1122,
62,
2676,
13,
21370,
70,
1600,
275,
3524,
62,
45457,
2625,
33464,
1600,
13245,
28,
17821,
8,
201,
198,
489,
83,
13,
12860,
3419,
201,
198
] | 1.945392 | 879 |
from metaflow_test import MetaflowTest, ExpectationFailed, steps, tag
class CardExtensionsImportTest(MetaflowTest):
"""
- Requires on tests/extensions/packages to be installed.
"""
PRIORITY = 5
@tag('card(type="card_ext_init_b",save_errors=False)')
@tag('card(type="card_ext_init_a",save_errors=False)')
@tag('card(type="card_ns_subpackage",save_errors=False)')
@tag('card(type="card_init",save_errors=False)')
@steps(0, ["start"])
@steps(1, ["all"])
| [
6738,
1138,
1878,
9319,
62,
9288,
1330,
3395,
1878,
9319,
14402,
11,
23600,
341,
37,
6255,
11,
4831,
11,
7621,
628,
198,
4871,
5172,
11627,
5736,
20939,
14402,
7,
9171,
1878,
9319,
14402,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
532,
26848,
319,
5254,
14,
2302,
5736,
14,
43789,
284,
307,
6589,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
4810,
41254,
9050,
796,
642,
628,
220,
220,
220,
2488,
12985,
10786,
9517,
7,
4906,
2625,
9517,
62,
2302,
62,
15003,
62,
65,
1600,
21928,
62,
48277,
28,
25101,
8,
11537,
198,
220,
220,
220,
2488,
12985,
10786,
9517,
7,
4906,
2625,
9517,
62,
2302,
62,
15003,
62,
64,
1600,
21928,
62,
48277,
28,
25101,
8,
11537,
198,
220,
220,
220,
2488,
12985,
10786,
9517,
7,
4906,
2625,
9517,
62,
5907,
62,
7266,
26495,
1600,
21928,
62,
48277,
28,
25101,
8,
11537,
198,
220,
220,
220,
2488,
12985,
10786,
9517,
7,
4906,
2625,
9517,
62,
15003,
1600,
21928,
62,
48277,
28,
25101,
8,
11537,
198,
220,
220,
220,
2488,
20214,
7,
15,
11,
14631,
9688,
8973,
8,
628,
220,
220,
220,
2488,
20214,
7,
16,
11,
14631,
439,
8973,
8,
198
] | 2.530612 | 196 |
from yapf.yapflib.yapf_api import FormatFile
import sys
# using yapf library taken from https://github.com/google/yapf/
# version v0.28.0
# take the source path
sourcePath = sys.argv[1]
# take the first argument as the filepath
# then update the targeted code with their format corrected.
# this function returns an array consisting the formatted code, type, and a boolean.
# that boolean is assigned to true if the function works.
result = FormatFile(sourcePath, in_place=True, style_config=sys.argv[2])
# this program will display error output once the code is not parseable.
| [
6738,
331,
499,
69,
13,
88,
499,
2704,
571,
13,
88,
499,
69,
62,
15042,
1330,
18980,
8979,
198,
11748,
25064,
198,
2,
1262,
331,
499,
69,
5888,
2077,
422,
3740,
1378,
12567,
13,
785,
14,
13297,
14,
88,
499,
69,
14,
198,
2,
2196,
410,
15,
13,
2078,
13,
15,
198,
198,
2,
1011,
262,
2723,
3108,
198,
10459,
15235,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
2,
1011,
262,
717,
4578,
355,
262,
2393,
6978,
198,
2,
788,
4296,
262,
7977,
2438,
351,
511,
5794,
19267,
13,
198,
2,
428,
2163,
5860,
281,
7177,
17747,
262,
39559,
2438,
11,
2099,
11,
290,
257,
25131,
13,
198,
2,
326,
25131,
318,
8686,
284,
2081,
611,
262,
2163,
2499,
13,
198,
20274,
796,
18980,
8979,
7,
10459,
15235,
11,
287,
62,
5372,
28,
17821,
11,
3918,
62,
11250,
28,
17597,
13,
853,
85,
58,
17,
12962,
198,
198,
2,
428,
1430,
481,
3359,
4049,
5072,
1752,
262,
2438,
318,
407,
21136,
540,
13,
198
] | 3.493976 | 166 |
"""
Copyright (c) Lukas Hedegaard. All Rights Reserved.
Included in the OpenDR Toolit with permission from the author.
"""
from typing import Tuple, Union
import torch
from torch import Tensor
from torch.nn.modules.pooling import (
AdaptiveAvgPool1d,
AdaptiveAvgPool2d,
AdaptiveAvgPool3d,
AdaptiveMaxPool1d,
AdaptiveMaxPool2d,
AdaptiveMaxPool3d,
AvgPool2d,
AvgPool3d,
MaxPool2d,
MaxPool3d,
_triple,
)
from logging import getLogger
from .utils import FillMode
State = Tuple[Tensor, int]
Pool2D = Union[AvgPool2d, MaxPool2d, AdaptiveAvgPool2d, AdaptiveMaxPool2d]
logger = getLogger(__name__)
__all__ = [
"AvgPoolCo3d",
"MaxPoolCo3d",
"AdaptiveAvgPoolCo3d",
"AdaptiveMaxPoolCo3d",
"convert_avgpool3d",
"convert_maxpool3d",
"convert_adaptiveavgpool3d",
"convert_adaptivemaxpool3d",
]
def RecursivelyWindowPooled(cls: Pool2D) -> torch.nn.Module: # noqa: C901
"""Wraps a pooling module to create a recursive version which pools across execusions
Args:
cls (Pool2D): A 2D pooling Module
"""
assert cls in {AdaptiveAvgPool2d, MaxPool2d, AvgPool2d, AdaptiveMaxPool2d}
RePooled.__doc__ = f"""
Recursive {cls.__name__}
Pooling results are stored between `forward` exercutions and used to pool subsequent
inputs along the temporal dimension with a spacified `window_size`.
Example: For `window_size = 3`, the two previous results are stored and used for pooling.
`temporal_fill` determines whether to initialize the state with a ``'replicate'`` of the
output of the first execution or with with ``'zeros'``.
Parent doc:
{cls.__doc__}
"""
return RePooled
AvgPoolCo3d = RecursivelyWindowPooled(AvgPool2d)
MaxPoolCo3d = RecursivelyWindowPooled(MaxPool2d)
AdaptiveAvgPoolCo3d = RecursivelyWindowPooled(AdaptiveAvgPool2d)
AdaptiveMaxPoolCo3d = RecursivelyWindowPooled(AdaptiveMaxPool2d)
| [
37811,
198,
15269,
357,
66,
8,
28102,
292,
30920,
26470,
446,
13,
1439,
6923,
33876,
13,
198,
818,
10341,
287,
262,
4946,
7707,
16984,
270,
351,
7170,
422,
262,
1772,
13,
198,
37811,
198,
198,
6738,
19720,
1330,
309,
29291,
11,
4479,
198,
198,
11748,
28034,
198,
6738,
28034,
1330,
309,
22854,
198,
6738,
28034,
13,
20471,
13,
18170,
13,
7742,
278,
1330,
357,
198,
220,
220,
220,
30019,
425,
48997,
27201,
16,
67,
11,
198,
220,
220,
220,
30019,
425,
48997,
27201,
17,
67,
11,
198,
220,
220,
220,
30019,
425,
48997,
27201,
18,
67,
11,
198,
220,
220,
220,
30019,
425,
11518,
27201,
16,
67,
11,
198,
220,
220,
220,
30019,
425,
11518,
27201,
17,
67,
11,
198,
220,
220,
220,
30019,
425,
11518,
27201,
18,
67,
11,
198,
220,
220,
220,
33455,
27201,
17,
67,
11,
198,
220,
220,
220,
33455,
27201,
18,
67,
11,
198,
220,
220,
220,
5436,
27201,
17,
67,
11,
198,
220,
220,
220,
5436,
27201,
18,
67,
11,
198,
220,
220,
220,
4808,
28461,
1154,
11,
198,
8,
198,
198,
6738,
18931,
1330,
651,
11187,
1362,
198,
198,
6738,
764,
26791,
1330,
27845,
19076,
198,
198,
9012,
796,
309,
29291,
58,
51,
22854,
11,
493,
60,
198,
27201,
17,
35,
796,
4479,
58,
48997,
27201,
17,
67,
11,
5436,
27201,
17,
67,
11,
30019,
425,
48997,
27201,
17,
67,
11,
30019,
425,
11518,
27201,
17,
67,
60,
628,
198,
6404,
1362,
796,
651,
11187,
1362,
7,
834,
3672,
834,
8,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
366,
48997,
27201,
7222,
18,
67,
1600,
198,
220,
220,
220,
366,
11518,
27201,
7222,
18,
67,
1600,
198,
220,
220,
220,
366,
48003,
425,
48997,
27201,
7222,
18,
67,
1600,
198,
220,
220,
220,
366,
48003,
425,
11518,
27201,
7222,
18,
67,
1600,
198,
220,
220,
220,
366,
1102,
1851,
62,
615,
70,
7742,
18,
67,
1600,
198,
220,
220,
220,
366,
1102,
1851,
62,
9806,
7742,
18,
67,
1600,
198,
220,
220,
220,
366,
1102,
1851,
62,
42552,
425,
615,
70,
7742,
18,
67,
1600,
198,
220,
220,
220,
366,
1102,
1851,
62,
42552,
425,
9806,
7742,
18,
67,
1600,
198,
60,
628,
198,
4299,
3311,
1834,
2280,
27703,
27201,
276,
7,
565,
82,
25,
19850,
17,
35,
8,
4613,
28034,
13,
20471,
13,
26796,
25,
220,
1303,
645,
20402,
25,
327,
46815,
198,
220,
220,
220,
37227,
36918,
862,
257,
5933,
278,
8265,
284,
2251,
257,
45115,
2196,
543,
20354,
1973,
2452,
15880,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
537,
82,
357,
27201,
17,
35,
2599,
317,
362,
35,
5933,
278,
19937,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
6818,
537,
82,
287,
1391,
48003,
425,
48997,
27201,
17,
67,
11,
5436,
27201,
17,
67,
11,
33455,
27201,
17,
67,
11,
30019,
425,
11518,
27201,
17,
67,
92,
628,
220,
220,
220,
797,
27201,
276,
13,
834,
15390,
834,
796,
277,
37811,
198,
220,
220,
220,
3311,
30753,
1391,
565,
82,
13,
834,
3672,
834,
92,
628,
220,
220,
220,
19850,
278,
2482,
389,
8574,
1022,
4600,
11813,
63,
4208,
3508,
290,
973,
284,
5933,
8840,
198,
220,
220,
220,
17311,
1863,
262,
21964,
15793,
351,
257,
34752,
1431,
4600,
17497,
62,
7857,
44646,
198,
220,
220,
220,
17934,
25,
1114,
4600,
17497,
62,
7857,
796,
513,
47671,
262,
734,
2180,
2482,
389,
8574,
290,
973,
329,
5933,
278,
13,
198,
220,
220,
220,
4600,
11498,
35738,
62,
20797,
63,
15947,
1771,
284,
41216,
262,
1181,
351,
257,
7559,
6,
35666,
5344,
6,
15506,
286,
262,
198,
220,
220,
220,
5072,
286,
262,
717,
9706,
393,
351,
351,
7559,
6,
9107,
418,
6,
15506,
13,
628,
220,
220,
220,
16774,
2205,
25,
198,
220,
220,
220,
1391,
565,
82,
13,
834,
15390,
834,
92,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1441,
797,
27201,
276,
628,
198,
48997,
27201,
7222,
18,
67,
796,
3311,
1834,
2280,
27703,
27201,
276,
7,
48997,
27201,
17,
67,
8,
198,
11518,
27201,
7222,
18,
67,
796,
3311,
1834,
2280,
27703,
27201,
276,
7,
11518,
27201,
17,
67,
8,
198,
48003,
425,
48997,
27201,
7222,
18,
67,
796,
3311,
1834,
2280,
27703,
27201,
276,
7,
48003,
425,
48997,
27201,
17,
67,
8,
198,
48003,
425,
11518,
27201,
7222,
18,
67,
796,
3311,
1834,
2280,
27703,
27201,
276,
7,
48003,
425,
11518,
27201,
17,
67,
8,
628,
628,
198
] | 2.623306 | 738 |
import pandas as pd
import numpy as np
import data_inputs, evaluate_EWRs
#--------------------------------------------------------------------------------------------------
def sum_events(events):
'''returns a sum of events'''
return int(round(events.sum(), 0))
def get_frequency(events):
'''Returns the frequency of years they occur in'''
if events.count() == 0:
result = 0
else:
result = (int(events.sum())/int(events.count()))*100
return int(round(result, 0))
def get_average(input_events):
'''Returns overall average length of events'''
events = input_events.dropna()
if len(events) == 0:
result = 0
else:
result = round(sum(events)/len(events),1)
return result
def initialise_summary_df_columns(input_dict):
'''Ingest a dictionary of ewr yearly results and a list of statistical tests to perform
initialises a dataframe with these as a multilevel heading and returns this'''
analysis = data_inputs.analysis()
column_list = []
list_of_arrays = []
for scenario, scenario_results in input_dict.items():
for sub_col in analysis:
column_list = tuple((scenario, sub_col))
list_of_arrays.append(column_list)
array_of_arrays =tuple(list_of_arrays)
multi_col_df = pd.MultiIndex.from_tuples(array_of_arrays, names = ['scenario', 'type'])
return multi_col_df
def initialise_summary_df_rows(input_dict):
'''Ingests a dictionary of ewr yearly results
pulls the location information and the assocaited ewrs at each location,
saves these as respective indexes and return the multi-level index'''
index_1 = list()
index_2 = list()
index_3 = list()
combined_index = list()
# Get unique col list:
for scenario, scenario_results in input_dict.items():
for site, site_results in scenario_results.items():
for PU in site_results:
site_list = []
for col in site_results[PU]:
if '_' in col:
all_parts = col.split('_')
remove_end = all_parts[:-1]
if len(remove_end) > 1:
EWR_code = '_'.join(remove_end)
else:
EWR_code = remove_end[0]
else:
EWR_code = col
if EWR_code in site_list:
continue
else:
site_list.append(EWR_code)
add_index = tuple((site, PU, EWR_code))
if add_index not in combined_index:
combined_index.append(add_index)
unique_index = tuple(combined_index)
multi_index = pd.MultiIndex.from_tuples(unique_index, names = ['gauge', 'planning unit', 'EWR'])
return multi_index
def allocate(df, add_this, idx, site, PU, EWR, scenario, category):
'''Save element to a location in the dataframe'''
df.loc[idx[[site], [PU], [EWR]], idx[scenario, category]] = add_this
return df
def summarise(input_dict):
'''Ingests a dictionary with ewr pass/fails
summarises these results and returns a single summary dataframe'''
PU_items = data_inputs.get_planning_unit_info()
EWR_table, see_notes_ewrs, undefined_ewrs, noThresh_df, no_duration, DSF_ewrs = data_inputs.get_EWR_table()
# Initialise dataframe with multi level column heading and multi-index:
multi_col_df = initialise_summary_df_columns(input_dict)
index = initialise_summary_df_rows(input_dict)
df = pd.DataFrame(index = index, columns=multi_col_df)
# Run the analysis and add the results to the dataframe created above:
for scenario, scenario_results in input_dict.items():
for site, site_results in scenario_results.items():
for PU in site_results:
for col in site_results[PU]:
all_parts = col.split('_')
remove_end = all_parts[:-1]
if len(remove_end) > 1:
EWR = '_'.join(remove_end)
else:
EWR = remove_end[0]
idx = pd.IndexSlice
if ('_eventYears' in col):
S = sum_events(site_results[PU][col])
df = allocate(df, S, idx, site, PU, EWR, scenario, 'Event years')
F = get_frequency(site_results[PU][col])
df = allocate(df, F, idx, site, PU, EWR, scenario, 'Frequency')
PU_num = PU_items['PlanningUnitID'].loc[PU_items[PU_items['PlanningUnitName'] == PU].index[0]]
EWR_info = evaluate_EWRs.get_EWRs(PU_num, site, EWR, EWR_table, None, ['TF'])
TF = EWR_info['frequency']
df = allocate(df, TF, idx, site, PU, EWR, scenario, 'Target frequency')
elif ('_numAchieved' in col):
S = sum_events(site_results[PU][col])
df = allocate(df, S, idx, site, PU, EWR, scenario, 'Achievement count')
ME = get_average(site_results[PU][col])
df = allocate(df, ME, idx, site, PU, EWR, scenario, 'Achievements per year')
elif ('_numEvents' in col):
S = sum_events(site_results[PU][col])
df = allocate(df, S, idx, site, PU, EWR, scenario, 'Event count')
ME = get_average(site_results[PU][col])
df = allocate(df, ME, idx, site, PU, EWR, scenario, 'Events per year')
elif ('_eventLength' in col):
EL = get_event_length(site_results[PU][col], S)
df = allocate(df, EL, idx, site, PU, EWR, scenario, 'Event length')
elif ('_totalEventDays' in col):
AD = get_average(site_results[PU][col])
df = allocate(df, AD, idx, site, PU, EWR, scenario, 'Threshold days')
elif ('daysBetweenEvents' in col):
PU_num = PU_items['PlanningUnitID'].loc[PU_items[PU_items['PlanningUnitName'] == PU].index[0]]
EWR_info = evaluate_EWRs.get_EWRs(PU_num, site, EWR, EWR_table, None, ['MIE'])
DB = count_exceedence(site_results[PU][col], EWR_info)
df = allocate(df, DB, idx, site, PU, EWR, scenario, 'Inter-event exceedence count')
# Also save the max inter-event period to the data summary for reference
EWR_info = evaluate_EWRs.get_EWRs(PU_num, site, EWR, EWR_table, None, ['MIE'])
MIE = EWR_info['max_inter-event']
df = allocate(df, MIE, idx, site, PU, EWR, scenario, 'Max inter event period (years)')
elif ('_missingDays' in col):
MD = sum_events(site_results[PU][col])
df = allocate(df, MD, idx, site, PU, EWR, scenario, 'No data days')
elif ('_totalPossibleDays' in col):
TD = sum_events(site_results[PU][col])
df = allocate(df, TD, idx, site, PU, EWR, scenario, 'Total days')
return df | [
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
1366,
62,
15414,
82,
11,
13446,
62,
6217,
31273,
198,
2,
10097,
3880,
438,
198,
198,
4299,
2160,
62,
31534,
7,
31534,
2599,
198,
220,
220,
220,
705,
7061,
7783,
82,
257,
2160,
286,
2995,
7061,
6,
198,
220,
220,
220,
1441,
493,
7,
744,
7,
31534,
13,
16345,
22784,
657,
4008,
198,
198,
4299,
651,
62,
35324,
7,
31534,
2599,
198,
220,
220,
220,
705,
7061,
35561,
262,
8373,
286,
812,
484,
3051,
287,
7061,
6,
198,
220,
220,
220,
611,
2995,
13,
9127,
3419,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
657,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
357,
600,
7,
31534,
13,
16345,
3419,
20679,
600,
7,
31534,
13,
9127,
3419,
4008,
9,
3064,
198,
220,
220,
220,
1441,
493,
7,
744,
7,
20274,
11,
657,
4008,
198,
198,
4299,
651,
62,
23913,
7,
15414,
62,
31534,
2599,
198,
220,
220,
220,
705,
7061,
35561,
4045,
2811,
4129,
286,
2995,
7061,
6,
198,
220,
220,
220,
2995,
796,
5128,
62,
31534,
13,
14781,
2616,
3419,
198,
220,
220,
220,
611,
18896,
7,
31534,
8,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
657,
198,
220,
220,
220,
2073,
25,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
2835,
7,
16345,
7,
31534,
20679,
11925,
7,
31534,
828,
16,
8,
198,
220,
220,
220,
1441,
1255,
198,
198,
4299,
4238,
786,
62,
49736,
62,
7568,
62,
28665,
82,
7,
15414,
62,
11600,
2599,
198,
220,
220,
220,
705,
7061,
27682,
395,
257,
22155,
286,
304,
18351,
24169,
2482,
290,
257,
1351,
286,
13905,
5254,
284,
1620,
198,
220,
220,
220,
4238,
2696,
257,
1366,
14535,
351,
777,
355,
257,
1963,
576,
626,
9087,
290,
5860,
428,
7061,
6,
198,
220,
220,
220,
3781,
796,
1366,
62,
15414,
82,
13,
20930,
3419,
198,
220,
220,
220,
5721,
62,
4868,
796,
17635,
198,
220,
220,
220,
1351,
62,
1659,
62,
3258,
592,
796,
17635,
198,
220,
220,
220,
329,
8883,
11,
8883,
62,
43420,
287,
5128,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
850,
62,
4033,
287,
3781,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5721,
62,
4868,
796,
46545,
19510,
1416,
39055,
11,
850,
62,
4033,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1351,
62,
1659,
62,
3258,
592,
13,
33295,
7,
28665,
62,
4868,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
7177,
62,
1659,
62,
3258,
592,
796,
83,
29291,
7,
4868,
62,
1659,
62,
3258,
592,
8,
220,
220,
220,
220,
198,
220,
220,
220,
5021,
62,
4033,
62,
7568,
796,
279,
67,
13,
29800,
15732,
13,
6738,
62,
28047,
2374,
7,
18747,
62,
1659,
62,
3258,
592,
11,
3891,
796,
37250,
1416,
39055,
3256,
705,
4906,
6,
12962,
628,
220,
220,
220,
1441,
5021,
62,
4033,
62,
7568,
198,
220,
220,
220,
220,
198,
4299,
4238,
786,
62,
49736,
62,
7568,
62,
8516,
7,
15414,
62,
11600,
2599,
198,
220,
220,
220,
705,
7061,
27682,
3558,
257,
22155,
286,
304,
18351,
24169,
2482,
198,
220,
220,
220,
16194,
262,
4067,
1321,
290,
262,
840,
11216,
863,
304,
86,
3808,
379,
1123,
4067,
11,
198,
220,
220,
220,
16031,
777,
355,
11756,
39199,
290,
1441,
262,
5021,
12,
5715,
6376,
7061,
6,
198,
220,
220,
220,
220,
198,
220,
220,
220,
6376,
62,
16,
796,
1351,
3419,
198,
220,
220,
220,
6376,
62,
17,
796,
1351,
3419,
198,
220,
220,
220,
6376,
62,
18,
796,
1351,
3419,
198,
220,
220,
220,
5929,
62,
9630,
796,
1351,
3419,
198,
220,
220,
220,
1303,
3497,
3748,
951,
1351,
25,
198,
220,
220,
220,
329,
8883,
11,
8883,
62,
43420,
287,
5128,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2524,
11,
2524,
62,
43420,
287,
8883,
62,
43420,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
24676,
287,
2524,
62,
43420,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2524,
62,
4868,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
951,
287,
2524,
62,
43420,
58,
5105,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
62,
6,
287,
951,
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,
477,
62,
42632,
796,
951,
13,
35312,
10786,
62,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4781,
62,
437,
796,
477,
62,
42632,
58,
21912,
16,
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,
611,
18896,
7,
28956,
62,
437,
8,
1875,
352,
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,
412,
18564,
62,
8189,
796,
705,
62,
4458,
22179,
7,
28956,
62,
437,
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,
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,
412,
18564,
62,
8189,
796,
4781,
62,
437,
58,
15,
60,
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,
412,
18564,
62,
8189,
796,
951,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
412,
18564,
62,
8189,
287,
2524,
62,
4868,
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,
2555,
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,
2524,
62,
4868,
13,
33295,
7,
6217,
49,
62,
8189,
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,
751,
62,
9630,
796,
46545,
19510,
15654,
11,
24676,
11,
412,
18564,
62,
8189,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
751,
62,
9630,
407,
287,
5929,
62,
9630,
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,
5929,
62,
9630,
13,
33295,
7,
2860,
62,
9630,
8,
198,
220,
220,
220,
3748,
62,
9630,
796,
46545,
7,
24011,
1389,
62,
9630,
8,
198,
220,
220,
220,
5021,
62,
9630,
796,
279,
67,
13,
29800,
15732,
13,
6738,
62,
28047,
2374,
7,
34642,
62,
9630,
11,
3891,
796,
37250,
70,
559,
469,
3256,
705,
11578,
768,
4326,
3256,
705,
6217,
49,
6,
12962,
628,
220,
220,
220,
1441,
5021,
62,
9630,
198,
198,
4299,
31935,
7,
7568,
11,
751,
62,
5661,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
6536,
2599,
198,
220,
220,
220,
705,
7061,
16928,
5002,
284,
257,
4067,
287,
262,
1366,
14535,
7061,
6,
198,
220,
220,
220,
47764,
13,
17946,
58,
312,
87,
30109,
15654,
4357,
685,
5105,
4357,
685,
6217,
49,
60,
4357,
4686,
87,
58,
1416,
39055,
11,
6536,
11907,
796,
751,
62,
5661,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
47764,
198,
220,
220,
220,
220,
198,
4299,
15676,
786,
7,
15414,
62,
11600,
2599,
198,
220,
220,
220,
705,
7061,
27682,
3558,
257,
22155,
351,
304,
18351,
1208,
14,
69,
1768,
198,
220,
220,
220,
15676,
2696,
777,
2482,
290,
5860,
257,
2060,
10638,
1366,
14535,
7061,
6,
198,
220,
220,
220,
24676,
62,
23814,
796,
1366,
62,
15414,
82,
13,
1136,
62,
11578,
768,
62,
20850,
62,
10951,
3419,
198,
220,
220,
220,
412,
18564,
62,
11487,
11,
766,
62,
17815,
62,
413,
3808,
11,
28721,
62,
413,
3808,
11,
645,
817,
3447,
62,
7568,
11,
645,
62,
32257,
11,
17400,
37,
62,
413,
3808,
796,
1366,
62,
15414,
82,
13,
1136,
62,
6217,
49,
62,
11487,
3419,
198,
220,
220,
220,
1303,
20768,
786,
1366,
14535,
351,
5021,
1241,
5721,
9087,
290,
5021,
12,
9630,
25,
198,
220,
220,
220,
5021,
62,
4033,
62,
7568,
796,
4238,
786,
62,
49736,
62,
7568,
62,
28665,
82,
7,
15414,
62,
11600,
8,
198,
220,
220,
220,
6376,
796,
4238,
786,
62,
49736,
62,
7568,
62,
8516,
7,
15414,
62,
11600,
8,
198,
220,
220,
220,
47764,
796,
279,
67,
13,
6601,
19778,
7,
9630,
796,
6376,
11,
15180,
28,
41684,
62,
4033,
62,
7568,
8,
198,
220,
220,
220,
1303,
5660,
262,
3781,
290,
751,
262,
2482,
284,
262,
1366,
14535,
2727,
2029,
25,
198,
220,
220,
220,
329,
8883,
11,
8883,
62,
43420,
287,
5128,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2524,
11,
2524,
62,
43420,
287,
8883,
62,
43420,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
24676,
287,
2524,
62,
43420,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
951,
287,
2524,
62,
43420,
58,
5105,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
477,
62,
42632,
796,
951,
13,
35312,
10786,
62,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4781,
62,
437,
796,
477,
62,
42632,
58,
21912,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
28956,
62,
437,
8,
1875,
352,
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,
412,
18564,
796,
705,
62,
4458,
22179,
7,
28956,
62,
437,
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,
412,
18564,
796,
4781,
62,
437,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
796,
279,
67,
13,
15732,
11122,
501,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
19203,
62,
15596,
40630,
6,
287,
951,
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,
311,
796,
2160,
62,
31534,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
311,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
9237,
812,
11537,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
376,
796,
651,
62,
35324,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
376,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
37,
28707,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24676,
62,
22510,
796,
24676,
62,
23814,
17816,
20854,
768,
26453,
2389,
6,
4083,
17946,
58,
5105,
62,
23814,
58,
5105,
62,
23814,
17816,
20854,
768,
26453,
5376,
20520,
6624,
24676,
4083,
9630,
58,
15,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
412,
18564,
62,
10951,
796,
13446,
62,
6217,
31273,
13,
1136,
62,
6217,
31273,
7,
5105,
62,
22510,
11,
2524,
11,
412,
18564,
11,
412,
18564,
62,
11487,
11,
6045,
11,
37250,
10234,
6,
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,
24958,
796,
412,
18564,
62,
10951,
17816,
35324,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47764,
796,
31935,
7,
7568,
11,
24958,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
21745,
8373,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
19203,
62,
22510,
32,
3043,
1079,
6,
287,
951,
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,
311,
796,
2160,
62,
31534,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
311,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
32,
24957,
434,
954,
11537,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11948,
796,
651,
62,
23913,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
11948,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
32,
24957,
902,
583,
614,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
19203,
62,
22510,
37103,
6,
287,
951,
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,
311,
796,
2160,
62,
31534,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
311,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
9237,
954,
11537,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11948,
796,
651,
62,
23913,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
11948,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
37103,
583,
614,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
19203,
62,
15596,
24539,
6,
287,
951,
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,
17852,
796,
651,
62,
15596,
62,
13664,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
4357,
311,
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,
47764,
796,
31935,
7,
7568,
11,
17852,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
9237,
4129,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
19203,
62,
23350,
9237,
38770,
6,
287,
951,
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,
5984,
796,
651,
62,
23913,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
5984,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
817,
10126,
1528,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
19203,
12545,
25262,
37103,
6,
287,
951,
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,
24676,
62,
22510,
796,
24676,
62,
23814,
17816,
20854,
768,
26453,
2389,
6,
4083,
17946,
58,
5105,
62,
23814,
58,
5105,
62,
23814,
17816,
20854,
768,
26453,
5376,
20520,
6624,
24676,
4083,
9630,
58,
15,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
412,
18564,
62,
10951,
796,
13446,
62,
6217,
31273,
13,
1136,
62,
6217,
31273,
7,
5105,
62,
22510,
11,
2524,
11,
412,
18564,
11,
412,
18564,
62,
11487,
11,
6045,
11,
37250,
8895,
36,
6,
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,
20137,
796,
954,
62,
1069,
2707,
594,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
4357,
412,
18564,
62,
10951,
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,
47764,
796,
31935,
7,
7568,
11,
20137,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
9492,
12,
15596,
7074,
594,
954,
11537,
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,
4418,
3613,
262,
3509,
987,
12,
15596,
2278,
284,
262,
1366,
10638,
329,
4941,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
412,
18564,
62,
10951,
796,
13446,
62,
6217,
31273,
13,
1136,
62,
6217,
31273,
7,
5105,
62,
22510,
11,
2524,
11,
412,
18564,
11,
412,
18564,
62,
11487,
11,
6045,
11,
37250,
8895,
36,
6,
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,
337,
10008,
796,
412,
18564,
62,
10951,
17816,
9806,
62,
3849,
12,
15596,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47764,
796,
31935,
7,
7568,
11,
337,
10008,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
11518,
987,
1785,
2278,
357,
19002,
8,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
19203,
62,
45688,
38770,
6,
287,
951,
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,
10670,
796,
2160,
62,
31534,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
10670,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
2949,
1366,
1528,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
19203,
62,
23350,
47,
4733,
38770,
6,
287,
951,
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,
13320,
796,
2160,
62,
31534,
7,
15654,
62,
43420,
58,
5105,
7131,
4033,
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,
47764,
796,
31935,
7,
7568,
11,
13320,
11,
4686,
87,
11,
2524,
11,
24676,
11,
412,
18564,
11,
8883,
11,
705,
14957,
1528,
11537,
198,
220,
220,
220,
1441,
47764
] | 2.006166 | 3,730 |
# Crie um programa que leia o nome e o preço de vários produtos.
# O programa deverá perguntar se o usuário vai continuar ou não. No final, mostre:
# A) qual é o total gasto na compra.
# B) quantos produtos custam mais de R$1000.
# C) qual é o nome do produto mais barato.
n = ''
p = 0
t = 0
c = 0
b_p = 0 # preço produto mais barato
b_n = '' # nome produto mais barato
while True:
n = input('Nome do produto: ')
p = float(input('Valor: '))
if t == 0 or p < b_p:
b_n = n
b_p = p
if p > 1000:
c += 1
t += p
flag = ' '
while flag not in 'SN':
flag = input('Deseja continuar? [S/N] ').upper()[0]
if flag == 'N':
break
print(f'Total gasto na compra: R$ {t:.2f}')
print(f'{c} produtos custaram mais que R$ 1000,00')
print(f'{b_n} foi o produto mais barato custando R$ {b_p:.2f}')
| [
2,
327,
5034,
23781,
1430,
64,
8358,
443,
544,
267,
299,
462,
304,
267,
662,
16175,
78,
390,
410,
6557,
380,
418,
40426,
315,
418,
13,
198,
2,
440,
1430,
64,
390,
332,
6557,
583,
70,
2797,
283,
384,
267,
514,
84,
6557,
27250,
410,
1872,
11143,
283,
267,
84,
299,
28749,
13,
1400,
2457,
11,
749,
260,
25,
198,
2,
317,
8,
4140,
38251,
267,
2472,
21956,
78,
12385,
552,
430,
13,
198,
2,
347,
8,
5554,
418,
40426,
315,
418,
9378,
321,
285,
15152,
390,
371,
3,
12825,
13,
198,
2,
327,
8,
4140,
38251,
267,
299,
462,
466,
40426,
9390,
285,
15152,
2318,
5549,
13,
198,
77,
796,
10148,
198,
79,
796,
657,
198,
83,
796,
657,
198,
66,
796,
657,
198,
65,
62,
79,
796,
657,
220,
1303,
662,
16175,
78,
40426,
9390,
285,
15152,
2318,
5549,
198,
65,
62,
77,
796,
10148,
220,
1303,
299,
462,
40426,
9390,
285,
15152,
2318,
5549,
198,
4514,
6407,
25,
198,
220,
220,
220,
299,
796,
5128,
10786,
45,
462,
466,
40426,
9390,
25,
705,
8,
198,
220,
220,
220,
279,
796,
12178,
7,
15414,
10786,
7762,
273,
25,
705,
4008,
198,
220,
220,
220,
611,
256,
6624,
657,
393,
279,
1279,
275,
62,
79,
25,
198,
220,
220,
220,
220,
220,
220,
220,
275,
62,
77,
796,
299,
198,
220,
220,
220,
220,
220,
220,
220,
275,
62,
79,
796,
279,
198,
220,
220,
220,
611,
279,
1875,
8576,
25,
198,
220,
220,
220,
220,
220,
220,
220,
269,
15853,
352,
198,
220,
220,
220,
256,
15853,
279,
198,
220,
220,
220,
6056,
796,
705,
705,
198,
220,
220,
220,
981,
6056,
407,
287,
705,
15571,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
6056,
796,
5128,
10786,
35,
2771,
6592,
11143,
283,
30,
685,
50,
14,
45,
60,
705,
737,
45828,
3419,
58,
15,
60,
198,
220,
220,
220,
611,
6056,
6624,
705,
45,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
4798,
7,
69,
6,
14957,
21956,
78,
12385,
552,
430,
25,
371,
3,
1391,
83,
25,
13,
17,
69,
92,
11537,
198,
4798,
7,
69,
6,
90,
66,
92,
40426,
315,
418,
9378,
41158,
285,
15152,
8358,
371,
3,
8576,
11,
405,
11537,
198,
4798,
7,
69,
6,
90,
65,
62,
77,
92,
11511,
72,
267,
40426,
9390,
285,
15152,
2318,
5549,
9378,
25440,
371,
3,
1391,
65,
62,
79,
25,
13,
17,
69,
92,
11537,
198
] | 2.091133 | 406 |
import os
import sys
import logging
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from sdc_etl_libs.database_helpers.SnowflakeDatabase import SnowflakeDatabase
from sdc_etl_libs.database_helpers.NexusDatabase import NexusDatabase
from sdc_etl_libs.database_helpers.MySqlDatabase import MySqlDatabase
from sdc_etl_libs.database_helpers.PostgresSqlDatabase import PostgresSqlDatabase
logging.basicConfig(
format='%(levelname)s: %(asctime)s: '
'%(funcName)s: %(message)s')
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
| [
198,
11748,
28686,
198,
11748,
25064,
198,
11748,
18931,
198,
17597,
13,
6978,
13,
33295,
7,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
5305,
6978,
7,
834,
7753,
834,
22305,
198,
6738,
264,
17896,
62,
316,
75,
62,
8019,
82,
13,
48806,
62,
16794,
364,
13,
28974,
47597,
38105,
1330,
7967,
47597,
38105,
198,
6738,
264,
17896,
62,
316,
75,
62,
8019,
82,
13,
48806,
62,
16794,
364,
13,
45,
1069,
385,
38105,
1330,
16756,
38105,
198,
6738,
264,
17896,
62,
316,
75,
62,
8019,
82,
13,
48806,
62,
16794,
364,
13,
3666,
50,
13976,
38105,
1330,
2011,
50,
13976,
38105,
198,
6738,
264,
17896,
62,
316,
75,
62,
8019,
82,
13,
48806,
62,
16794,
364,
13,
6307,
34239,
50,
13976,
38105,
1330,
2947,
34239,
50,
13976,
38105,
198,
198,
6404,
2667,
13,
35487,
16934,
7,
198,
220,
220,
220,
5794,
11639,
4,
7,
5715,
3672,
8,
82,
25,
4064,
7,
292,
310,
524,
8,
82,
25,
220,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4,
7,
20786,
5376,
8,
82,
25,
4064,
7,
20500,
8,
82,
11537,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
6404,
1362,
13,
2617,
4971,
7,
6404,
2667,
13,
10778,
8,
198
] | 2.651163 | 215 |
import dataiku
def delete_orphaned_datasets(client=None, project_key=None, drop_data=False, dry_run=True):
"""Delete datasets that are not linked to any recipe.
"""
prj = client.get_project(project_key)
flow = prj.get_flow()
graph = flow.get_graph()
cpt = 0
for name, props in graph.nodes.items():
if not props["predecessors"] and not props["successors"]:
print(f"- Deleting {name}...")
ds = prj.get_dataset(name)
if not dry_run:
ds.delete(drop_data=drop_data)
cpt +=1
else:
print("Dry run: nothing was deleted.")
print(f"{cpt} datasets deleted.")
| [
11748,
1366,
28643,
198,
198,
4299,
12233,
62,
13425,
22739,
62,
19608,
292,
1039,
7,
16366,
28,
14202,
11,
1628,
62,
2539,
28,
14202,
11,
4268,
62,
7890,
28,
25101,
11,
5894,
62,
5143,
28,
17821,
2599,
198,
220,
220,
220,
37227,
38727,
40522,
326,
389,
407,
6692,
284,
597,
8364,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
778,
73,
796,
5456,
13,
1136,
62,
16302,
7,
16302,
62,
2539,
8,
198,
220,
220,
220,
5202,
796,
778,
73,
13,
1136,
62,
11125,
3419,
198,
220,
220,
220,
4823,
796,
5202,
13,
1136,
62,
34960,
3419,
198,
220,
220,
220,
269,
457,
796,
657,
198,
220,
220,
220,
329,
1438,
11,
25744,
287,
4823,
13,
77,
4147,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
25744,
14692,
28764,
721,
23295,
8973,
290,
407,
25744,
14692,
13138,
669,
1,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
26793,
42226,
889,
1391,
3672,
92,
9313,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
82,
796,
778,
73,
13,
1136,
62,
19608,
292,
316,
7,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
5894,
62,
5143,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
82,
13,
33678,
7,
14781,
62,
7890,
28,
14781,
62,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
457,
15853,
16,
220,
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,
3601,
7203,
35,
563,
1057,
25,
2147,
373,
13140,
19570,
198,
220,
220,
220,
3601,
7,
69,
1,
90,
66,
457,
92,
40522,
13140,
19570,
198
] | 2.14375 | 320 |
#!/usr/bin/env python3
from urllib.request import urlopen
from urllib.parse import unquote
import base64
import re
n3ro_rss_link = input("N3RO SIP002 URIs: ").strip()
data = urlopen(n3ro_rss_link).read()
links = base64.b64decode(data).decode()
for link in links.splitlines():
matcher = re.match(r"ss://(.+)@(.+)#(.+)", link)
a = base64.b64decode(matcher.group(1)).decode()
b = matcher.group(2)
c = unquote(matcher.group(3))
ss_link = base64.b64encode((a + '@' + b).encode()).decode()
remark = c[:c.index('#')].replace(' ', '')
print('ss://' + ss_link + '#' + remark)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
6738,
2956,
297,
571,
13,
25927,
1330,
19016,
9654,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
555,
22708,
198,
11748,
2779,
2414,
198,
11748,
302,
198,
198,
77,
18,
305,
62,
42216,
62,
8726,
796,
5128,
7203,
45,
18,
13252,
311,
4061,
21601,
37902,
3792,
25,
366,
737,
36311,
3419,
198,
198,
7890,
796,
19016,
9654,
7,
77,
18,
305,
62,
42216,
62,
8726,
737,
961,
3419,
198,
28751,
796,
2779,
2414,
13,
65,
2414,
12501,
1098,
7,
7890,
737,
12501,
1098,
3419,
198,
1640,
2792,
287,
6117,
13,
35312,
6615,
33529,
198,
220,
220,
220,
2603,
2044,
796,
302,
13,
15699,
7,
81,
1,
824,
1378,
7,
13,
28988,
31,
7,
13,
28988,
2,
7,
13,
28988,
1600,
2792,
8,
198,
220,
220,
220,
257,
796,
2779,
2414,
13,
65,
2414,
12501,
1098,
7,
6759,
2044,
13,
8094,
7,
16,
29720,
12501,
1098,
3419,
198,
220,
220,
220,
275,
796,
2603,
2044,
13,
8094,
7,
17,
8,
198,
220,
220,
220,
269,
796,
555,
22708,
7,
6759,
2044,
13,
8094,
7,
18,
4008,
628,
220,
220,
220,
37786,
62,
8726,
796,
2779,
2414,
13,
65,
2414,
268,
8189,
19510,
64,
1343,
705,
31,
6,
1343,
275,
737,
268,
8189,
3419,
737,
12501,
1098,
3419,
198,
220,
220,
220,
6919,
796,
269,
58,
25,
66,
13,
9630,
10786,
2,
11537,
4083,
33491,
10786,
46083,
10148,
8,
198,
220,
220,
220,
3601,
10786,
824,
1378,
6,
1343,
37786,
62,
8726,
1343,
705,
2,
6,
1343,
6919,
8,
198
] | 2.317829 | 258 |
import math
from itertools import islice
from time import ctime
print(ctime())
print(""
"fibonacci algorithms.py")
print("Iterative positive and negative")
print(ctime())
print(ctime())
print("expected Output:")
print(
"-832040 514229 -317811 196418 -121393 75025 -46368 28657 -17711 "
"10946 -6765 4181 -2584 1597 -987 610 -377 233 -144 89 -55 34 -21 13"
" -8 5 -3 2 -1 1 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 "
"2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040")
for i in range(-30, 31):
print(fib(i))
print(ctime())
print("Analytic")
print("Binget formula:")
for i in range(1, 31):
print(analytic_fibonacci(i))
print("expected Output:")
print(
"1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 "
"4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040")
print("Iterative")
print("Recursive")
print("Recursive with Memoization")
fm = fib_memo()
for i in range(1, 31):
print(fm(i))
print("expected Output:")
print("1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 "
"2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 "
"317811 514229 832040")
print("Better Recursive doesn't need Memoization")
print("The recursive code as written two sections above is incredibly "
"slow and inefficient"
" due to the nested recursion calls. Although the memoization "
"above makes the code "
"run faster, it is at the cost of extra memory use. The below "
"code is syntactically "
"recursive but actually encodes the efficient iterative process, and thus doesn't "
"require memoization: ")
print("However, although much faster and not requiring memory, the above "
"code can only work to a limited 'n' due to the limit on stack "
"recursion "
"depth by Python; it is better to use the iterative code above or "
"the generative one below.")
print("Generative")
for i in fib_gen(11):
print(i)
print("Example use: "
"for i in fibGen(11)")
print("expect: [0,1,1,2,3,5,8,13,21,34,55]")
print("Matrix-Based")
print("Translation of the matrix-based approach used in F#.")
print("Large step recurrence")
print("This is much faster for a single, large value of n: ")
print("calculating it takes a few seconds, printing it takes eons... original ex. 100000000 now 1024")
print("fib(1024)")
print(fib(1024))
print("Same as above but slightly faster")
print("Putting the dictionary outside the function makes this about 2 seconds faster, could just make a wrapper:")
F = {0: 0, 1: 1, 2: 1}
print(fib(1024))
print("Generative with Recursion")
print("This can get very slow and uses a lot of memory. Can be sped up by caching the generator results.")
print("Yield fib[n+1] + fib[n]")
print("yield 1 ; have to start somewhere")
print("Yield fib[n+1] + fib[n]")
f = fib()
for _ in range(1, 9):
print(next(f))
print("expected Output:")
print("[1, 1, 2, 3, 5, 8, 13, 21, 34]")
print("Another version of recursive generators solution, starting from 0")
print(tuple(islice(fib2(), 10)))
| [
11748,
10688,
198,
6738,
340,
861,
10141,
1330,
318,
75,
501,
198,
6738,
640,
1330,
269,
2435,
198,
198,
4798,
7,
310,
524,
28955,
628,
198,
4798,
7203,
1,
198,
220,
220,
220,
220,
220,
366,
69,
571,
261,
44456,
16113,
13,
9078,
4943,
198,
198,
4798,
7203,
29993,
876,
3967,
290,
4633,
4943,
198,
198,
4798,
7,
310,
524,
28955,
628,
198,
198,
4798,
7,
310,
524,
28955,
198,
4798,
7203,
40319,
25235,
25,
4943,
198,
4798,
7,
198,
220,
220,
220,
27444,
5999,
1238,
1821,
642,
1415,
23539,
532,
18,
23188,
1157,
17575,
1507,
532,
1065,
1485,
6052,
19683,
1495,
532,
3510,
27412,
2579,
37680,
532,
22413,
1157,
366,
198,
220,
220,
220,
366,
14454,
3510,
532,
3134,
2996,
604,
27057,
532,
1495,
5705,
1315,
5607,
532,
44183,
44300,
532,
26514,
30435,
532,
18444,
9919,
532,
2816,
4974,
532,
2481,
1511,
1,
198,
220,
220,
220,
366,
532,
23,
642,
532,
18,
362,
532,
16,
352,
657,
352,
352,
362,
513,
642,
807,
1511,
2310,
4974,
5996,
9919,
20224,
30435,
42163,
44300,
860,
5774,
1315,
5607,
366,
198,
220,
220,
220,
366,
1495,
5705,
604,
27057,
8275,
2996,
16003,
3510,
26607,
1157,
2579,
37680,
6337,
27412,
19683,
1495,
1105,
1485,
6052,
17575,
1507,
513,
23188,
1157,
642,
1415,
23539,
9698,
1238,
1821,
4943,
198,
198,
1640,
1312,
287,
2837,
32590,
1270,
11,
3261,
2599,
198,
220,
220,
220,
3601,
7,
69,
571,
7,
72,
4008,
198,
198,
4798,
7,
310,
524,
28955,
198,
4798,
7203,
37702,
13370,
4943,
198,
4798,
7203,
33,
278,
316,
10451,
25,
4943,
628,
198,
198,
1640,
1312,
287,
2837,
7,
16,
11,
3261,
2599,
198,
220,
220,
220,
3601,
7,
38200,
13370,
62,
69,
571,
261,
44456,
7,
72,
4008,
198,
198,
4798,
7203,
40319,
25235,
25,
4943,
198,
198,
4798,
7,
198,
220,
220,
220,
366,
16,
352,
362,
513,
642,
807,
1511,
2310,
4974,
5996,
9919,
20224,
30435,
42163,
44300,
860,
5774,
1315,
5607,
1679,
5705,
366,
198,
220,
220,
220,
366,
19,
27057,
8275,
2996,
16003,
3510,
26607,
1157,
2579,
37680,
6337,
27412,
19683,
1495,
1105,
1485,
6052,
17575,
1507,
513,
23188,
1157,
642,
1415,
23539,
9698,
1238,
1821,
4943,
198,
4798,
7203,
29993,
876,
4943,
628,
198,
198,
4798,
7203,
6690,
30753,
4943,
628,
198,
198,
4798,
7203,
6690,
30753,
351,
4942,
78,
1634,
4943,
628,
198,
198,
38353,
796,
12900,
62,
11883,
78,
3419,
198,
1640,
1312,
287,
2837,
7,
16,
11,
3261,
2599,
198,
220,
220,
220,
3601,
7,
38353,
7,
72,
4008,
198,
198,
4798,
7203,
40319,
25235,
25,
4943,
198,
198,
4798,
7203,
16,
352,
362,
513,
642,
807,
1511,
2310,
4974,
5996,
9919,
20224,
30435,
42163,
44300,
860,
5774,
1315,
5607,
366,
198,
220,
220,
220,
220,
220,
366,
1495,
5705,
604,
27057,
8275,
2996,
16003,
3510,
26607,
1157,
2579,
37680,
6337,
27412,
19683,
1495,
1105,
1485,
6052,
17575,
1507,
366,
198,
220,
220,
220,
220,
220,
366,
18,
23188,
1157,
642,
1415,
23539,
9698,
1238,
1821,
4943,
198,
4798,
7203,
28971,
3311,
30753,
1595,
470,
761,
4942,
78,
1634,
4943,
198,
4798,
7203,
464,
45115,
2438,
355,
3194,
734,
9004,
2029,
318,
8131,
366,
198,
220,
220,
220,
220,
220,
366,
38246,
290,
30904,
1,
198,
220,
220,
220,
220,
220,
366,
2233,
284,
262,
28376,
664,
24197,
3848,
13,
4900,
262,
16155,
1634,
366,
198,
220,
220,
220,
220,
220,
366,
29370,
1838,
262,
2438,
366,
198,
220,
220,
220,
220,
220,
366,
5143,
5443,
11,
340,
318,
379,
262,
1575,
286,
3131,
4088,
779,
13,
383,
2174,
366,
198,
220,
220,
220,
220,
220,
366,
8189,
318,
7419,
529,
1146,
366,
198,
220,
220,
220,
220,
220,
366,
8344,
30753,
475,
1682,
2207,
4147,
262,
6942,
11629,
876,
1429,
11,
290,
4145,
1595,
470,
366,
198,
220,
220,
220,
220,
220,
366,
46115,
16155,
1634,
25,
366,
8,
628,
198,
198,
4798,
7203,
4864,
11,
3584,
881,
5443,
290,
407,
10616,
4088,
11,
262,
2029,
366,
198,
220,
220,
220,
220,
220,
366,
8189,
460,
691,
670,
284,
257,
3614,
705,
77,
6,
2233,
284,
262,
4179,
319,
8931,
366,
198,
220,
220,
220,
220,
220,
366,
8344,
24197,
366,
198,
220,
220,
220,
220,
220,
366,
18053,
416,
11361,
26,
340,
318,
1365,
284,
779,
262,
11629,
876,
2438,
2029,
393,
366,
198,
220,
220,
220,
220,
220,
366,
1169,
1152,
876,
530,
2174,
19570,
198,
198,
4798,
7203,
8645,
876,
4943,
628,
198,
198,
1640,
1312,
287,
12900,
62,
5235,
7,
1157,
2599,
198,
220,
220,
220,
3601,
7,
72,
8,
198,
198,
4798,
7203,
16281,
779,
25,
366,
198,
220,
220,
220,
220,
220,
366,
1640,
1312,
287,
12900,
13746,
7,
1157,
8,
4943,
198,
198,
4798,
7203,
1069,
806,
25,
685,
15,
11,
16,
11,
16,
11,
17,
11,
18,
11,
20,
11,
23,
11,
1485,
11,
2481,
11,
2682,
11,
2816,
60,
4943,
198,
198,
4798,
7203,
46912,
12,
15001,
4943,
198,
4798,
7203,
48313,
286,
262,
17593,
12,
3106,
3164,
973,
287,
376,
2,
19570,
628,
628,
198,
4798,
7203,
21968,
2239,
664,
33928,
4943,
198,
4798,
7203,
1212,
318,
881,
5443,
329,
257,
2060,
11,
1588,
1988,
286,
299,
25,
366,
8,
628,
198,
198,
4798,
7203,
9948,
3129,
803,
340,
2753,
257,
1178,
4201,
11,
13570,
340,
2753,
304,
684,
986,
2656,
409,
13,
1802,
10535,
783,
28119,
4943,
198,
4798,
7203,
69,
571,
7,
35500,
8,
4943,
198,
4798,
7,
69,
571,
7,
35500,
4008,
198,
198,
4798,
7203,
30556,
355,
2029,
475,
4622,
5443,
4943,
198,
4798,
7203,
46399,
262,
22155,
2354,
262,
2163,
1838,
428,
546,
362,
4201,
5443,
11,
714,
655,
787,
257,
29908,
25,
4943,
198,
198,
37,
796,
1391,
15,
25,
657,
11,
352,
25,
352,
11,
362,
25,
352,
92,
628,
198,
198,
4798,
7,
69,
571,
7,
35500,
4008,
628,
198,
4798,
7203,
8645,
876,
351,
3311,
24197,
4943,
198,
4798,
7203,
1212,
460,
651,
845,
3105,
290,
3544,
257,
1256,
286,
4088,
13,
1680,
307,
40424,
510,
416,
40918,
262,
17301,
2482,
19570,
198,
4798,
7203,
56,
1164,
12900,
58,
77,
10,
16,
60,
1343,
12900,
58,
77,
60,
4943,
198,
4798,
7203,
88,
1164,
352,
220,
2162,
220,
423,
284,
923,
7382,
4943,
198,
4798,
7203,
56,
1164,
12900,
58,
77,
10,
16,
60,
1343,
12900,
58,
77,
60,
4943,
628,
198,
198,
69,
796,
12900,
3419,
198,
1640,
4808,
287,
2837,
7,
16,
11,
860,
2599,
198,
220,
220,
220,
3601,
7,
19545,
7,
69,
4008,
198,
4798,
7203,
40319,
25235,
25,
4943,
198,
4798,
7203,
58,
16,
11,
352,
11,
362,
11,
513,
11,
642,
11,
807,
11,
1511,
11,
2310,
11,
4974,
60,
4943,
198,
198,
4798,
7203,
6610,
2196,
286,
45115,
27298,
4610,
11,
3599,
422,
657,
4943,
628,
198,
198,
4798,
7,
83,
29291,
7,
3044,
501,
7,
69,
571,
17,
22784,
838,
22305,
198
] | 2.755497 | 1,137 |
# Copyright 2021 Google LLC
#
# 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.
"""Train and evaluate the model."""
import os
import logging
import tensorflow as tf
from tensorflow import keras
import nvtabular as nvt
from nvtabular.loader.tensorflow import KerasSequenceLoader, KerasSequenceValidater
from nvtabular.inference.triton import export_tensorflow_ensemble
from src.common import features, utils
from src.model_training import model
HIDDEN_UNITS = [128, 128]
LEARNING_RATE = 0.001
BATCH_SIZE = 1024 * 32
NUM_EPOCHS = 1
| [
2,
15069,
33448,
3012,
11419,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
37811,
44077,
290,
13446,
262,
2746,
526,
15931,
198,
198,
11748,
28686,
198,
11748,
18931,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
6738,
11192,
273,
11125,
1330,
41927,
292,
198,
11748,
299,
85,
8658,
934,
355,
299,
36540,
198,
6738,
299,
85,
8658,
934,
13,
29356,
13,
83,
22854,
11125,
1330,
17337,
292,
44015,
594,
17401,
11,
17337,
292,
44015,
594,
47139,
729,
198,
6738,
299,
85,
8658,
934,
13,
259,
4288,
13,
83,
799,
261,
1330,
10784,
62,
83,
22854,
11125,
62,
1072,
11306,
198,
198,
6738,
12351,
13,
11321,
1330,
3033,
11,
3384,
4487,
198,
6738,
12351,
13,
19849,
62,
34409,
1330,
2746,
198,
198,
39,
2389,
41819,
62,
4944,
29722,
796,
685,
12762,
11,
13108,
60,
198,
2538,
1503,
15871,
62,
49,
6158,
796,
657,
13,
8298,
198,
33,
11417,
62,
33489,
796,
28119,
1635,
3933,
198,
41359,
62,
8905,
46,
3398,
50,
796,
352,
628,
628,
198
] | 3.428571 | 301 |
import pytesseract
from PIL import Image
img = Image.open("flag.png")
text = pytesseract.image_to_string(img)
print(rot_encode(7)(text))
if __name__ == '__main__':
pass
| [
11748,
12972,
83,
408,
263,
529,
198,
6738,
350,
4146,
1330,
7412,
198,
198,
9600,
796,
7412,
13,
9654,
7203,
32109,
13,
11134,
4943,
198,
5239,
796,
12972,
83,
408,
263,
529,
13,
9060,
62,
1462,
62,
8841,
7,
9600,
8,
628,
628,
198,
198,
4798,
7,
10599,
62,
268,
8189,
7,
22,
5769,
5239,
4008,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1208,
198
] | 2.432432 | 74 |
import json
import requests
import sys
import yaml
from bs4 import BeautifulSoup
from os.path import exists
from os import mkdir, environ
if __name__ == '__main__':
reposUrl = ''
authToken = ''
if len(sys.argv) > 1:
reposUrl = sys.argv[1]
authToken = sys.argv[2]
else:
# an orgs' repo list API url, in form of https://api.github.com/orgs/{org}/repos
reposUrl = environ['GITHUB_CONTENT_SYNC_ORG_REPOS_URL']
# an auth token for example a PAT
authToken = environ['GITHUB_CONTENT_SYNC_PAT']
# info to be pulled from github
initDict = {
'id': 0,
'name': '',
'description': '',
'created_at': '',
'updated_at': '',
'pushed_at': '',
'license': '',
'html_url': '',
'topics': [],
'homepage': '',
# we won't be getting the social img url from github's data source, but we need to instantiate it
'social_img_url': ''
}
headerValues = {
# We should explicitly access the latest api version per github api
'default': 'application/vnd.github.v3+json',
# To access topics, we must explicitly access a preview api version
'topics': 'application/vnd.github.mercy-preview+json'
}
contentOutput = []
repos = []
topics = set(())
keepIndexing = True
print(f'Attempting to get content from {reposUrl}.')
apiPage = 1
while keepIndexing:
requestParams = {'page': apiPage, 'sort': 'updated'}
getRepos = requests.get(
reposUrl,
headers={
'Accept': headerValues['topics'],
'Authorization': f'token {authToken}'
},
params=requestParams
)
if getRepos.status_code != 200:
keepIndexing = False
print('Received non-200 status code', getRepos.status_code, 'while trying to scan repos. This generally '
'means the process will fail. Likely you need '
'to authenticate to get past Github API '
'Limits. Halting content generation.')
raise ValueError('Got non-200 status when trying to get content.')
# Repo information syncing loop
elif keepIndexing:
if not json.loads(getRepos.text):
keepIndexing = False
print(f'End of list reached.')
else:
print(f'Saving page {apiPage} of API response and getting imagery URLs...')
for repo in json.loads(getRepos.text):
if not repo['archived'] and not repo['private']:
for topic in repo['topics']:
topics.add(topic)
# Initialize an empty list entry
compileRepoInfo = initDict.copy()
# Iterate over data placeholders and pull the data from the correct repo in memory
for detail in compileRepoInfo:
if detail in repo:
compileRepoInfo[detail] = repo[detail]
if detail == 'html_url':
pageContent = requests.get(repo[detail]).text
parsePage = BeautifulSoup(pageContent, "html.parser")
# limit tag search to head
pageHead = parsePage.html.find('head')
socialImageElement = pageHead.find("meta", attrs={"property": "og:image"})
if socialImageElement:
if socialImageElement.has_attr('content'):
compileRepoInfo['social_img_url'] = socialImageElement['content']
# Add to list of compiled repo entries for final output
contentOutput.append(compileRepoInfo)
apiPage += 1
print('Collating content...')
if not exists('../assets/img/thumb/'):
mkdir('../assets/img/thumb/')
sortedTopics = list(topics)
sortedTopics.sort()
dump_json('../_data/topics.json', sortedTopics)
dump_json('../_data/projects.json', contentOutput)
print('Downloading images...')
for repo in contentOutput:
response = requests.get(repo['social_img_url'])
if response.ok:
file_name = repo['name']
file_type = response.headers['content-type'].split('/')[1]
with open(f'../assets/img/thumb/{file_name}.{file_type}', 'wb') as file:
file.write(response.content)
| [
11748,
33918,
198,
11748,
7007,
198,
11748,
25064,
198,
11748,
331,
43695,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
6738,
28686,
13,
6978,
1330,
7160,
198,
6738,
28686,
1330,
33480,
15908,
11,
551,
2268,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1128,
418,
28165,
796,
10148,
198,
220,
220,
220,
6284,
30642,
796,
10148,
628,
220,
220,
220,
611,
18896,
7,
17597,
13,
853,
85,
8,
1875,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1128,
418,
28165,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
6284,
30642,
796,
25064,
13,
853,
85,
58,
17,
60,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
281,
8745,
82,
6,
29924,
1351,
7824,
19016,
11,
287,
1296,
286,
3740,
1378,
15042,
13,
12567,
13,
785,
14,
2398,
82,
14,
90,
2398,
92,
14,
260,
1930,
198,
220,
220,
220,
220,
220,
220,
220,
1128,
418,
28165,
796,
551,
2268,
17816,
38,
10554,
10526,
62,
37815,
3525,
62,
23060,
7792,
62,
1581,
38,
62,
35316,
2640,
62,
21886,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
281,
6284,
11241,
329,
1672,
257,
28748,
198,
220,
220,
220,
220,
220,
220,
220,
6284,
30642,
796,
551,
2268,
17816,
38,
10554,
10526,
62,
37815,
3525,
62,
23060,
7792,
62,
47,
1404,
20520,
628,
220,
220,
220,
1303,
7508,
284,
307,
5954,
422,
33084,
198,
220,
220,
220,
2315,
35,
713,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
312,
10354,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
705,
3672,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
11213,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
25598,
62,
265,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
43162,
62,
265,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
79,
7474,
62,
265,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
43085,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
6494,
62,
6371,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
4852,
873,
10354,
685,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
705,
11195,
7700,
10354,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
356,
1839,
470,
307,
1972,
262,
1919,
33705,
19016,
422,
33084,
338,
1366,
2723,
11,
475,
356,
761,
284,
9113,
9386,
340,
198,
220,
220,
220,
220,
220,
220,
220,
705,
14557,
62,
9600,
62,
6371,
10354,
10148,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
13639,
40161,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
775,
815,
11777,
1895,
262,
3452,
40391,
2196,
583,
33084,
40391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
12286,
10354,
705,
31438,
14,
85,
358,
13,
12567,
13,
85,
18,
10,
17752,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1675,
1895,
10233,
11,
356,
1276,
11777,
1895,
257,
12714,
40391,
2196,
198,
220,
220,
220,
220,
220,
220,
220,
705,
4852,
873,
10354,
705,
31438,
14,
85,
358,
13,
12567,
13,
647,
948,
12,
3866,
1177,
10,
17752,
6,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
2695,
26410,
796,
17635,
198,
220,
220,
220,
1128,
418,
796,
17635,
198,
220,
220,
220,
10233,
796,
900,
7,
28955,
628,
220,
220,
220,
1394,
15732,
278,
796,
6407,
628,
220,
220,
220,
3601,
7,
69,
6,
37177,
278,
284,
651,
2695,
422,
1391,
260,
1930,
28165,
92,
2637,
8,
628,
220,
220,
220,
40391,
9876,
796,
352,
198,
220,
220,
220,
981,
1394,
15732,
278,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2581,
10044,
4105,
796,
1391,
6,
7700,
10354,
40391,
9876,
11,
705,
30619,
10354,
705,
43162,
6,
92,
198,
220,
220,
220,
220,
220,
220,
220,
651,
6207,
418,
796,
7007,
13,
1136,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1128,
418,
28165,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24697,
34758,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
38855,
10354,
13639,
40161,
17816,
4852,
873,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
13838,
1634,
10354,
277,
470,
4233,
1391,
18439,
30642,
92,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42287,
28,
25927,
10044,
4105,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
611,
651,
6207,
418,
13,
13376,
62,
8189,
14512,
939,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1394,
15732,
278,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
3041,
6471,
1729,
12,
2167,
3722,
2438,
3256,
651,
6207,
418,
13,
13376,
62,
8189,
11,
705,
4514,
2111,
284,
9367,
1128,
418,
13,
770,
4143,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1326,
504,
262,
1429,
481,
2038,
13,
45974,
345,
761,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1462,
8323,
5344,
284,
651,
1613,
38994,
7824,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
19352,
896,
13,
11023,
889,
2695,
5270,
2637,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
30074,
1729,
12,
2167,
3722,
618,
2111,
284,
651,
2695,
2637,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
1432,
78,
1321,
6171,
2259,
9052,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1394,
15732,
278,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
33918,
13,
46030,
7,
1136,
6207,
418,
13,
5239,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1394,
15732,
278,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
6,
12915,
286,
1351,
4251,
2637,
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,
3601,
7,
69,
6,
50,
2703,
2443,
1391,
15042,
9876,
92,
286,
7824,
2882,
290,
1972,
19506,
32336,
986,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
29924,
287,
33918,
13,
46030,
7,
1136,
6207,
418,
13,
5239,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
29924,
17816,
998,
1572,
20520,
290,
407,
29924,
17816,
19734,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
7243,
287,
29924,
17816,
4852,
873,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10233,
13,
2860,
7,
26652,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
20768,
1096,
281,
6565,
1351,
5726,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17632,
6207,
78,
12360,
796,
2315,
35,
713,
13,
30073,
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,
1303,
40806,
378,
625,
1366,
1295,
10476,
290,
2834,
262,
1366,
422,
262,
3376,
29924,
287,
4088,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
3703,
287,
17632,
6207,
78,
12360,
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,
611,
3703,
287,
29924,
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,
220,
220,
220,
220,
17632,
6207,
78,
12360,
58,
49170,
60,
796,
29924,
58,
49170,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
3703,
6624,
705,
6494,
62,
6371,
10354,
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,
2443,
19746,
796,
7007,
13,
1136,
7,
260,
7501,
58,
49170,
35944,
5239,
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,
21136,
9876,
796,
23762,
50,
10486,
7,
7700,
19746,
11,
366,
6494,
13,
48610,
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,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4179,
7621,
2989,
284,
1182,
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,
2443,
13847,
796,
21136,
9876,
13,
6494,
13,
19796,
10786,
2256,
11537,
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,
1919,
5159,
20180,
796,
2443,
13847,
13,
19796,
7203,
28961,
1600,
708,
3808,
28,
4895,
26745,
1298,
366,
519,
25,
9060,
20662,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1919,
5159,
20180,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1919,
5159,
20180,
13,
10134,
62,
35226,
10786,
11299,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17632,
6207,
78,
12360,
17816,
14557,
62,
9600,
62,
6371,
20520,
796,
1919,
5159,
20180,
17816,
11299,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3060,
284,
1351,
286,
14102,
29924,
12784,
329,
2457,
5072,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
26410,
13,
33295,
7,
5589,
576,
6207,
78,
12360,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
40391,
9876,
15853,
352,
628,
220,
220,
220,
3601,
10786,
22667,
803,
2695,
986,
11537,
198,
220,
220,
220,
611,
407,
7160,
10786,
40720,
19668,
14,
9600,
14,
400,
2178,
14,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
33480,
15908,
10786,
40720,
19668,
14,
9600,
14,
400,
2178,
14,
11537,
628,
220,
220,
220,
23243,
25902,
796,
1351,
7,
4852,
873,
8,
198,
220,
220,
220,
23243,
25902,
13,
30619,
3419,
198,
220,
220,
220,
10285,
62,
17752,
10786,
40720,
62,
7890,
14,
4852,
873,
13,
17752,
3256,
23243,
25902,
8,
198,
220,
220,
220,
10285,
62,
17752,
10786,
40720,
62,
7890,
14,
42068,
13,
17752,
3256,
2695,
26410,
8,
628,
220,
220,
220,
3601,
10786,
10002,
278,
4263,
986,
11537,
198,
220,
220,
220,
329,
29924,
287,
2695,
26410,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2882,
796,
7007,
13,
1136,
7,
260,
7501,
17816,
14557,
62,
9600,
62,
6371,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2882,
13,
482,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
3672,
796,
29924,
17816,
3672,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
4906,
796,
2882,
13,
50145,
17816,
11299,
12,
4906,
6,
4083,
35312,
10786,
14,
11537,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
69,
6,
40720,
19668,
14,
9600,
14,
400,
2178,
14,
90,
7753,
62,
3672,
27422,
90,
7753,
62,
4906,
92,
3256,
705,
39346,
11537,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
13,
13564,
7,
26209,
13,
11299,
8,
198
] | 1.978084 | 2,464 |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------------------------------------------------------------------
import wx
from atom.api import Typed
from enaml.application import Application, ProxyResolver
from .wx_deferred_caller import DeferredCall, TimedCall
from .wx_factories import WX_FACTORIES
class WxApplication(Application):
""" A Wx implementation of an Enaml application.
A WxApplication uses the Wx toolkit to implement an Enaml UI that
runs in the local process.
"""
#: The private QApplication instance.
_wxapp = Typed(wx.App)
def __init__(self):
""" Initialize a WxApplication.
"""
super(WxApplication, self).__init__()
self._wxapp = wx.GetApp() or wx.PySimpleApp()
self.resolver = ProxyResolver(factories=WX_FACTORIES)
#--------------------------------------------------------------------------
# Abstract API Implementation
#--------------------------------------------------------------------------
def start(self):
""" Start the application's main event loop.
"""
app = self._wxapp
if not app.IsMainLoopRunning():
app.MainLoop()
def stop(self):
""" Stop the application's main event loop.
"""
app = self._wxapp
if app.IsMainLoopRunning():
app.Exit()
def deferred_call(self, callback, *args, **kwargs):
""" Invoke a callable on the next cycle of the main event loop
thread.
Parameters
----------
callback : callable
The callable object to execute at some point in the future.
*args, **kwargs
Any additional positional and keyword arguments to pass to
the callback.
"""
DeferredCall(callback, *args, **kwargs)
def timed_call(self, ms, callback, *args, **kwargs):
""" Invoke a callable on the main event loop thread at a
specified time in the future.
Parameters
----------
ms : int
The time to delay, in milliseconds, before executing the
callable.
callback : callable
The callable object to execute at some point in the future.
*args, **kwargs
Any additional positional and keyword arguments to pass to
the callback.
"""
TimedCall(ms, callback, *args, **kwargs)
def is_main_thread(self):
""" Indicates whether the caller is on the main gui thread.
Returns
-------
result : bool
True if called from the main gui thread. False otherwise.
"""
return wx.Thread_IsMain()
| [
2,
10097,
26171,
198,
2,
15069,
357,
66,
8,
2211,
11,
399,
14913,
291,
7712,
4816,
13,
198,
2,
198,
2,
4307,
6169,
739,
262,
2846,
286,
262,
40499,
347,
10305,
13789,
13,
198,
2,
198,
2,
383,
1336,
5964,
318,
287,
262,
2393,
27975,
45761,
13,
14116,
11,
9387,
351,
428,
3788,
13,
198,
2,
10097,
26171,
198,
11748,
266,
87,
198,
198,
6738,
22037,
13,
15042,
1330,
17134,
276,
198,
198,
6738,
551,
43695,
13,
31438,
1330,
15678,
11,
38027,
4965,
14375,
198,
198,
6738,
764,
49345,
62,
4299,
17436,
62,
13345,
263,
1330,
2896,
17436,
14134,
11,
5045,
276,
14134,
198,
6738,
764,
49345,
62,
22584,
1749,
1330,
370,
55,
62,
37,
10659,
1581,
11015,
628,
198,
4871,
370,
87,
23416,
7,
23416,
2599,
198,
220,
220,
220,
37227,
317,
370,
87,
7822,
286,
281,
2039,
43695,
3586,
13,
628,
220,
220,
220,
317,
370,
87,
23416,
3544,
262,
370,
87,
2891,
15813,
284,
3494,
281,
2039,
43695,
12454,
326,
198,
220,
220,
220,
4539,
287,
262,
1957,
1429,
13,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
25,
383,
2839,
1195,
23416,
4554,
13,
198,
220,
220,
220,
4808,
49345,
1324,
796,
17134,
276,
7,
49345,
13,
4677,
8,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
20768,
1096,
257,
370,
87,
23416,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
54,
87,
23416,
11,
2116,
737,
834,
15003,
834,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
49345,
1324,
796,
266,
87,
13,
3855,
4677,
3419,
393,
266,
87,
13,
20519,
26437,
4677,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
411,
14375,
796,
38027,
4965,
14375,
7,
22584,
1749,
28,
54,
55,
62,
37,
10659,
1581,
11015,
8,
628,
220,
220,
220,
1303,
10097,
35937,
198,
220,
220,
220,
1303,
27741,
7824,
46333,
198,
220,
220,
220,
1303,
10097,
35937,
198,
220,
220,
220,
825,
923,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7253,
262,
3586,
338,
1388,
1785,
9052,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
598,
796,
2116,
13557,
49345,
1324,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
598,
13,
3792,
13383,
39516,
28768,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
598,
13,
13383,
39516,
3419,
628,
220,
220,
220,
825,
2245,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13707,
262,
3586,
338,
1388,
1785,
9052,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
598,
796,
2116,
13557,
49345,
1324,
198,
220,
220,
220,
220,
220,
220,
220,
611,
598,
13,
3792,
13383,
39516,
28768,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
598,
13,
30337,
3419,
628,
220,
220,
220,
825,
28651,
62,
13345,
7,
944,
11,
23838,
11,
1635,
22046,
11,
12429,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
10001,
2088,
257,
869,
540,
319,
262,
1306,
6772,
286,
262,
1388,
1785,
9052,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
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,
23838,
1058,
869,
540,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
869,
540,
2134,
284,
12260,
379,
617,
966,
287,
262,
2003,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1635,
22046,
11,
12429,
46265,
22046,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4377,
3224,
45203,
290,
21179,
7159,
284,
1208,
284,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
262,
23838,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2896,
17436,
14134,
7,
47423,
11,
1635,
22046,
11,
12429,
46265,
22046,
8,
628,
220,
220,
220,
825,
28805,
62,
13345,
7,
944,
11,
13845,
11,
23838,
11,
1635,
22046,
11,
12429,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
10001,
2088,
257,
869,
540,
319,
262,
1388,
1785,
9052,
4704,
379,
257,
198,
220,
220,
220,
220,
220,
220,
220,
7368,
640,
287,
262,
2003,
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,
13845,
1058,
493,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
640,
284,
5711,
11,
287,
38694,
11,
878,
23710,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
869,
540,
13,
628,
220,
220,
220,
220,
220,
220,
220,
23838,
1058,
869,
540,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
869,
540,
2134,
284,
12260,
379,
617,
966,
287,
262,
2003,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1635,
22046,
11,
12429,
46265,
22046,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4377,
3224,
45203,
290,
21179,
7159,
284,
1208,
284,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
262,
23838,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5045,
276,
14134,
7,
907,
11,
23838,
11,
1635,
22046,
11,
12429,
46265,
22046,
8,
628,
220,
220,
220,
825,
318,
62,
12417,
62,
16663,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
1423,
16856,
1771,
262,
24955,
318,
319,
262,
1388,
11774,
4704,
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,
1255,
1058,
20512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6407,
611,
1444,
422,
262,
1388,
11774,
4704,
13,
10352,
4306,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
266,
87,
13,
16818,
62,
3792,
13383,
3419,
198
] | 2.787619 | 1,050 |
import os
import platform
import pytest
_is_win = bool(os.environ.get('IS_WIN', None))
_is_macos = bool(os.environ.get('IS_MAC', None))
_is_linux = not _is_macos and not _is_win
windows_mark = pytest.mark.unittest if _is_win else pytest.mark.ignore
macos_mark = pytest.mark.unittest if _is_macos else pytest.mark.ignore
linux_mark = pytest.mark.unittest if _is_linux else pytest.mark.ignore
_is_pypy = bool(os.environ.get('IS_PYPY', None))
_is_cpython = not _is_pypy
pypy_mark = pytest.mark.unittest if _is_pypy else pytest.mark.ignore
cpython_mark = pytest.mark.unittest if _is_cpython else pytest.mark.ignore
vpy_tuple = platform.python_version_tuple()
_is_py36 = vpy_tuple[:2] == ('3', '6')
_is_py37 = vpy_tuple[:2] == ('3', '7')
_is_py38 = vpy_tuple[:2] == ('3', '8')
_is_py39 = vpy_tuple[:2] == ('3', '9')
_is_py310 = vpy_tuple[:2] == ('3', '10')
py36_mark = pytest.mark.unittest if _is_py36 else pytest.mark.ignore
py37_mark = pytest.mark.unittest if _is_py37 else pytest.mark.ignore
py38_mark = pytest.mark.unittest if _is_py38 else pytest.mark.ignore
py39_mark = pytest.mark.unittest if _is_py39 else pytest.mark.ignore
py310_mark = pytest.mark.unittest if _is_py310 else pytest.mark.ignore
| [
11748,
28686,
198,
11748,
3859,
198,
198,
11748,
12972,
9288,
198,
198,
62,
271,
62,
5404,
796,
20512,
7,
418,
13,
268,
2268,
13,
1136,
10786,
1797,
62,
37620,
3256,
6045,
4008,
198,
62,
271,
62,
20285,
418,
796,
20512,
7,
418,
13,
268,
2268,
13,
1136,
10786,
1797,
62,
44721,
3256,
6045,
4008,
198,
62,
271,
62,
23289,
796,
407,
4808,
271,
62,
20285,
418,
290,
407,
4808,
271,
62,
5404,
198,
198,
28457,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
5404,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
20285,
418,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
20285,
418,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
23289,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
23289,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
198,
62,
271,
62,
79,
4464,
88,
796,
20512,
7,
418,
13,
268,
2268,
13,
1136,
10786,
1797,
62,
47,
48232,
56,
3256,
6045,
4008,
198,
62,
271,
62,
13155,
7535,
796,
407,
4808,
271,
62,
79,
4464,
88,
198,
198,
79,
4464,
88,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
79,
4464,
88,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
13155,
7535,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
13155,
7535,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
198,
85,
9078,
62,
83,
29291,
796,
3859,
13,
29412,
62,
9641,
62,
83,
29291,
3419,
198,
62,
271,
62,
9078,
2623,
796,
410,
9078,
62,
83,
29291,
58,
25,
17,
60,
6624,
19203,
18,
3256,
705,
21,
11537,
198,
62,
271,
62,
9078,
2718,
796,
410,
9078,
62,
83,
29291,
58,
25,
17,
60,
6624,
19203,
18,
3256,
705,
22,
11537,
198,
62,
271,
62,
9078,
2548,
796,
410,
9078,
62,
83,
29291,
58,
25,
17,
60,
6624,
19203,
18,
3256,
705,
23,
11537,
198,
62,
271,
62,
9078,
2670,
796,
410,
9078,
62,
83,
29291,
58,
25,
17,
60,
6624,
19203,
18,
3256,
705,
24,
11537,
198,
62,
271,
62,
9078,
26717,
796,
410,
9078,
62,
83,
29291,
58,
25,
17,
60,
6624,
19203,
18,
3256,
705,
940,
11537,
198,
198,
9078,
2623,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
9078,
2623,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
9078,
2718,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
9078,
2718,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
9078,
2548,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
9078,
2548,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
9078,
2670,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
9078,
2670,
2073,
12972,
9288,
13,
4102,
13,
46430,
198,
9078,
26717,
62,
4102,
796,
12972,
9288,
13,
4102,
13,
403,
715,
395,
611,
4808,
271,
62,
9078,
26717,
2073,
12972,
9288,
13,
4102,
13,
46430,
198
] | 2.337209 | 516 |
if __name__ == '__main__':
print(navigation_schmavigation([l.strip() for l in open('input/12')]))
print(navigation_schmavigation_2([l.strip() for l in open('input/12')]))
| [
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
3601,
7,
28341,
7065,
62,
20601,
76,
615,
7065,
26933,
75,
13,
36311,
3419,
329,
300,
287,
1280,
10786,
15414,
14,
1065,
11537,
60,
4008,
198,
220,
220,
220,
3601,
7,
28341,
7065,
62,
20601,
76,
615,
7065,
62,
17,
26933,
75,
13,
36311,
3419,
329,
300,
287,
1280,
10786,
15414,
14,
1065,
11537,
60,
4008,
198
] | 2.486486 | 74 |
from invoke import task
@task
| [
6738,
26342,
1330,
4876,
198,
31,
35943,
198
] | 3.75 | 8 |
#!/usr/bin/python
import re
import json
import datetime
from . import pdk
import logging
logger = logging.getLogger(__name__)
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
11748,
302,
198,
11748,
33918,
198,
11748,
4818,
8079,
198,
6738,
764,
1330,
279,
34388,
198,
11748,
18931,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198
] | 3.073171 | 41 |
""" File defining custom template tags for our project """
# Core Django imports
from django import template
from django.utils.safestring import mark_safe
# app-imports
from posts.models import Post
# third-party imports
import markdown
register = template.Library()
@register.simple_tag
def total_posts():
"""
A simple template tag that shows the number
of posts that have been uploaded so far
"""
return Post.published.count()
@register.inclusion_tag('posts/latest_uploads.html')
def show_latest_uploads(count=3):
"""
An inclusion template tag that renders the latest_uploads.html template
with context variables including the latest uploads.
The number of latest uploads to display can be passed to the tag
as the value of the 'count' variable.
"""
latest_uploads = Post.published.order_by('-created')[:count]
return { 'latest_uploads': latest_uploads }
# template filters are registered the same as template tags
@register.filter(name='markdown')
def markdown_format(text):
"""
Template filter function that renders the text given in markdown
syntax as HTML
"""
# mark the output as safe HTML to be rendered in the template
return mark_safe(markdown.markdown(text))
| [
37811,
9220,
16215,
2183,
11055,
15940,
329,
674,
1628,
37227,
198,
198,
2,
7231,
37770,
17944,
198,
6738,
42625,
14208,
1330,
11055,
198,
6738,
42625,
14208,
13,
26791,
13,
49585,
395,
1806,
1330,
1317,
62,
21230,
198,
198,
2,
598,
12,
320,
3742,
198,
6738,
6851,
13,
27530,
1330,
2947,
198,
198,
2,
2368,
12,
10608,
17944,
198,
11748,
1317,
2902,
628,
198,
30238,
796,
11055,
13,
23377,
3419,
198,
198,
31,
30238,
13,
36439,
62,
12985,
198,
4299,
2472,
62,
24875,
33529,
198,
220,
220,
220,
37227,
220,
198,
220,
220,
220,
317,
2829,
11055,
7621,
326,
2523,
262,
1271,
198,
220,
220,
220,
286,
6851,
326,
423,
587,
19144,
523,
1290,
220,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
2947,
13,
30271,
13,
9127,
3419,
198,
198,
31,
30238,
13,
259,
4717,
62,
12985,
10786,
24875,
14,
42861,
62,
39920,
13,
6494,
11537,
198,
4299,
905,
62,
42861,
62,
39920,
7,
9127,
28,
18,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1052,
14900,
11055,
7621,
326,
30111,
262,
3452,
62,
39920,
13,
6494,
11055,
198,
220,
220,
220,
351,
4732,
9633,
1390,
262,
3452,
9516,
82,
13,
198,
220,
220,
220,
383,
1271,
286,
3452,
9516,
82,
284,
3359,
460,
307,
3804,
284,
262,
7621,
198,
220,
220,
220,
355,
262,
1988,
286,
262,
705,
9127,
6,
7885,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3452,
62,
39920,
796,
2947,
13,
30271,
13,
2875,
62,
1525,
10786,
12,
25598,
11537,
58,
25,
9127,
60,
198,
220,
220,
220,
1441,
1391,
705,
42861,
62,
39920,
10354,
3452,
62,
39920,
1782,
198,
198,
2,
11055,
16628,
389,
6823,
262,
976,
355,
11055,
15940,
198,
31,
30238,
13,
24455,
7,
3672,
11639,
4102,
2902,
11537,
198,
4299,
1317,
2902,
62,
18982,
7,
5239,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
37350,
8106,
2163,
326,
30111,
262,
2420,
1813,
287,
1317,
2902,
198,
220,
220,
220,
15582,
355,
11532,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
1317,
262,
5072,
355,
3338,
11532,
284,
307,
15111,
287,
262,
11055,
198,
220,
220,
220,
1441,
1317,
62,
21230,
7,
4102,
2902,
13,
4102,
2902,
7,
5239,
4008,
198
] | 3.403794 | 369 |
import os
import pytest
import torch
import tests.base.utils as tutils
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.core import memory
from pytorch_lightning.trainer.distrib_parts import (
parse_gpu_ids,
determine_root_gpu_device,
)
from pytorch_lightning.utilities.debugging import MisconfigurationException
from tests.base import LightningTestModel
PRETEND_N_OF_GPUS = 16
def test_multi_gpu_model_ddp2(tmpdir):
"""Make sure DDP2 works."""
if not tutils.can_run_gpu_test():
return
tutils.reset_seed()
tutils.set_random_master_port()
model, hparams = tutils.get_default_model()
trainer_options = dict(
default_save_path=tmpdir,
show_progress_bar=True,
max_epochs=1,
train_percent_check=0.4,
val_percent_check=0.2,
gpus=2,
weights_summary=None,
distributed_backend='ddp2'
)
tutils.run_model_test(trainer_options, model)
def test_multi_gpu_model_ddp(tmpdir):
"""Make sure DDP works."""
if not tutils.can_run_gpu_test():
return
tutils.reset_seed()
tutils.set_random_master_port()
model, hparams = tutils.get_default_model()
trainer_options = dict(
default_save_path=tmpdir,
show_progress_bar=False,
max_epochs=1,
train_percent_check=0.4,
val_percent_check=0.2,
gpus=[0, 1],
distributed_backend='ddp'
)
tutils.run_model_test(trainer_options, model)
def test_ddp_all_dataloaders_passed_to_fit(tmpdir):
"""Make sure DDP works with dataloaders passed to fit()"""
if not tutils.can_run_gpu_test():
return
tutils.reset_seed()
tutils.set_random_master_port()
model, hparams = tutils.get_default_model()
trainer_options = dict(default_save_path=tmpdir,
show_progress_bar=False,
max_epochs=1,
train_percent_check=0.4,
val_percent_check=0.2,
gpus=[0, 1],
distributed_backend='ddp')
fit_options = dict(train_dataloader=model.train_dataloader(),
val_dataloaders=model.val_dataloader())
trainer = Trainer(**trainer_options)
result = trainer.fit(model, **fit_options)
assert result == 1, "DDP doesn't work with dataloaders passed to fit()."
def test_cpu_slurm_save_load(tmpdir):
"""Verify model save/load/checkpoint on CPU."""
tutils.reset_seed()
hparams = tutils.get_default_hparams()
model = LightningTestModel(hparams)
# logger file to get meta
logger = tutils.get_default_testtube_logger(tmpdir, False)
version = logger.version
trainer_options = dict(
max_epochs=1,
logger=logger,
checkpoint_callback=ModelCheckpoint(tmpdir)
)
# fit model
trainer = Trainer(**trainer_options)
result = trainer.fit(model)
real_global_step = trainer.global_step
# traning complete
assert result == 1, 'amp + ddp model failed to complete'
# predict with trained model before saving
# make a prediction
dataloaders = model.test_dataloader()
if not isinstance(dataloaders, list):
dataloaders = [dataloaders]
for dataloader in dataloaders:
for batch in dataloader:
break
x, y = batch
x = x.view(x.size(0), -1)
model.eval()
pred_before_saving = model(x)
# test HPC saving
# simulate snapshot on slurm
saved_filepath = trainer.hpc_save(tmpdir, logger)
assert os.path.exists(saved_filepath)
# new logger file to get meta
logger = tutils.get_default_testtube_logger(tmpdir, False, version=version)
trainer_options = dict(
max_epochs=1,
logger=logger,
checkpoint_callback=ModelCheckpoint(tmpdir),
)
trainer = Trainer(**trainer_options)
model = LightningTestModel(hparams)
# set the epoch start hook so we can predict before the model does the full training
model.on_epoch_start = assert_pred_same
# by calling fit again, we trigger training, loading weights from the cluster
# and our hook to predict using current model before any more weight updates
trainer.fit(model)
def test_multi_gpu_none_backend(tmpdir):
"""Make sure when using multiple GPUs the user can't use `distributed_backend = None`."""
tutils.reset_seed()
if not tutils.can_run_gpu_test():
return
model, hparams = tutils.get_default_model()
trainer_options = dict(
default_save_path=tmpdir,
show_progress_bar=False,
max_epochs=1,
train_percent_check=0.1,
val_percent_check=0.1,
gpus='-1'
)
with pytest.warns(UserWarning):
tutils.run_model_test(trainer_options, model)
def test_multi_gpu_model_dp(tmpdir):
"""Make sure DP works."""
tutils.reset_seed()
if not tutils.can_run_gpu_test():
return
model, hparams = tutils.get_default_model()
trainer_options = dict(
default_save_path=tmpdir,
show_progress_bar=False,
distributed_backend='dp',
max_epochs=1,
train_percent_check=0.1,
val_percent_check=0.1,
gpus='-1'
)
tutils.run_model_test(trainer_options, model)
# test memory helper functions
memory.get_memory_profile('min_max')
@pytest.fixture
@pytest.fixture
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize(["gpus", "expected_num_gpus", "distributed_backend"], [
pytest.param(None, 0, None, id="None - expect 0 gpu to use."),
pytest.param(0, 0, None, id="Oth gpu, expect 1 gpu to use."),
pytest.param(1, 1, None, id="1st gpu, expect 1 gpu to use."),
pytest.param(-1, PRETEND_N_OF_GPUS, "ddp", id="-1 - use all gpus"),
pytest.param('-1', PRETEND_N_OF_GPUS, "ddp", id="'-1' - use all gpus"),
pytest.param(3, 3, "ddp", id="3rd gpu - 1 gpu to use (backend:ddp)")
])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize(["gpus", "expected_num_gpus", "distributed_backend"], [
pytest.param(None, 0, None, id="None - expect 0 gpu to use."),
pytest.param(None, 0, "ddp", id="None - expect 0 gpu to use."),
])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize(['gpus', 'expected_root_gpu', "distributed_backend"], [
pytest.param(None, None, "ddp", id="None is None"),
pytest.param(0, None, "ddp", id="O gpus, expect gpu root device to be None."),
pytest.param(1, 0, "ddp", id="1 gpu, expect gpu root device to be 0."),
pytest.param(-1, 0, "ddp", id="-1 - use all gpus, expect gpu root device to be 0."),
pytest.param('-1', 0, "ddp", id="'-1' - use all gpus, expect gpu root device to be 0."),
pytest.param(3, 0, "ddp", id="3 gpus, expect gpu root device to be 0.(backend:ddp)")
])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize([
'gpus', 'expected_root_gpu', "distributed_backend"], [
pytest.param(None, None, None, id="None is None"),
pytest.param(None, None, "ddp", id="None is None"),
pytest.param(0, None, "ddp", id="None is None"),
])
# Asking for a gpu when non are available will result in a MisconfigurationException
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize([
'gpus', 'expected_root_gpu', "distributed_backend"], [
pytest.param(1, None, "ddp"),
pytest.param(3, None, "ddp"),
pytest.param(3, None, "ddp"),
pytest.param([1, 2], None, "ddp"),
pytest.param([0, 1], None, "ddp"),
pytest.param(-1, None, "ddp"),
pytest.param('-1', None, "ddp")
])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize(['gpus', 'expected_root_gpu'], [
pytest.param(None, None, id="No gpus, expect gpu root device to be None"),
pytest.param([0], 0, id="Oth gpu, expect gpu root device to be 0."),
pytest.param([1], 1, id="1st gpu, expect gpu root device to be 1."),
pytest.param([3], 3, id="3rd gpu, expect gpu root device to be 3."),
pytest.param([1, 2], 1, id="[1, 2] gpus, expect gpu root device to be 1."),
])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize(['gpus', 'expected_gpu_ids'], [
pytest.param(None, None),
pytest.param(0, None),
pytest.param(1, [0]),
pytest.param(3, [0, 1, 2]),
pytest.param(-1, list(range(PRETEND_N_OF_GPUS)), id="-1 - use all gpus"),
pytest.param([0], [0]),
pytest.param([1, 3], [1, 3]),
pytest.param('0', [0]),
pytest.param('3', [3]),
pytest.param('1, 3', [1, 3]),
pytest.param('-1', list(range(PRETEND_N_OF_GPUS)), id="'-1' - use all gpus"),
])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize(['gpus'], [
pytest.param(0.1),
pytest.param(-2),
pytest.param(False),
pytest.param([]),
pytest.param([-1]),
pytest.param([None]),
pytest.param(['0']),
pytest.param((0, 1)),
])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize("gpus", [''])
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize("gpus", [[1, 2, 19], -1, '-1'])
@pytest.mark.gpus_param_tests
@pytest.mark.gpus_param_tests
@pytest.mark.parametrize("gpus", [-1, '-1'])
# if __name__ == '__main__':
# pytest.main([__file__])
| [
11748,
28686,
198,
198,
11748,
12972,
9288,
198,
11748,
28034,
198,
198,
11748,
5254,
13,
8692,
13,
26791,
355,
9732,
4487,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
1330,
31924,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
13,
13345,
10146,
1330,
9104,
9787,
4122,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
13,
7295,
1330,
4088,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
13,
2213,
10613,
13,
17080,
822,
62,
42632,
1330,
357,
198,
220,
220,
220,
21136,
62,
46999,
62,
2340,
11,
198,
220,
220,
220,
5004,
62,
15763,
62,
46999,
62,
25202,
11,
198,
8,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
13,
315,
2410,
13,
24442,
2667,
1330,
14136,
11250,
3924,
16922,
198,
6738,
5254,
13,
8692,
1330,
12469,
14402,
17633,
198,
198,
47,
26087,
10619,
62,
45,
62,
19238,
62,
16960,
2937,
796,
1467,
628,
198,
4299,
1332,
62,
41684,
62,
46999,
62,
19849,
62,
1860,
79,
17,
7,
22065,
15908,
2599,
198,
220,
220,
220,
37227,
12050,
1654,
360,
6322,
17,
2499,
526,
15931,
198,
220,
220,
220,
611,
407,
9732,
4487,
13,
5171,
62,
5143,
62,
46999,
62,
9288,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
9732,
4487,
13,
42503,
62,
28826,
3419,
198,
220,
220,
220,
9732,
4487,
13,
2617,
62,
25120,
62,
9866,
62,
634,
3419,
628,
220,
220,
220,
2746,
11,
289,
37266,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
19849,
3419,
198,
220,
220,
220,
21997,
62,
25811,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
4277,
62,
21928,
62,
6978,
28,
22065,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
905,
62,
33723,
62,
5657,
28,
17821,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
538,
5374,
82,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
25067,
62,
9122,
28,
15,
13,
19,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1188,
62,
25067,
62,
9122,
28,
15,
13,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
27809,
385,
28,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
19590,
62,
49736,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
9387,
62,
1891,
437,
11639,
1860,
79,
17,
6,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
9732,
4487,
13,
5143,
62,
19849,
62,
9288,
7,
2213,
10613,
62,
25811,
11,
2746,
8,
628,
198,
4299,
1332,
62,
41684,
62,
46999,
62,
19849,
62,
1860,
79,
7,
22065,
15908,
2599,
198,
220,
220,
220,
37227,
12050,
1654,
360,
6322,
2499,
526,
15931,
198,
220,
220,
220,
611,
407,
9732,
4487,
13,
5171,
62,
5143,
62,
46999,
62,
9288,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
9732,
4487,
13,
42503,
62,
28826,
3419,
198,
220,
220,
220,
9732,
4487,
13,
2617,
62,
25120,
62,
9866,
62,
634,
3419,
628,
220,
220,
220,
2746,
11,
289,
37266,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
19849,
3419,
198,
220,
220,
220,
21997,
62,
25811,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
4277,
62,
21928,
62,
6978,
28,
22065,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
905,
62,
33723,
62,
5657,
28,
25101,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
538,
5374,
82,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
25067,
62,
9122,
28,
15,
13,
19,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1188,
62,
25067,
62,
9122,
28,
15,
13,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
27809,
385,
41888,
15,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
9387,
62,
1891,
437,
11639,
1860,
79,
6,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
9732,
4487,
13,
5143,
62,
19849,
62,
9288,
7,
2213,
10613,
62,
25811,
11,
2746,
8,
628,
198,
4299,
1332,
62,
1860,
79,
62,
439,
62,
67,
10254,
1170,
364,
62,
6603,
276,
62,
1462,
62,
11147,
7,
22065,
15908,
2599,
198,
220,
220,
220,
37227,
12050,
1654,
360,
6322,
2499,
351,
4818,
282,
1170,
364,
3804,
284,
4197,
3419,
37811,
198,
220,
220,
220,
611,
407,
9732,
4487,
13,
5171,
62,
5143,
62,
46999,
62,
9288,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
9732,
4487,
13,
42503,
62,
28826,
3419,
198,
220,
220,
220,
9732,
4487,
13,
2617,
62,
25120,
62,
9866,
62,
634,
3419,
628,
220,
220,
220,
2746,
11,
289,
37266,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
19849,
3419,
198,
220,
220,
220,
21997,
62,
25811,
796,
8633,
7,
12286,
62,
21928,
62,
6978,
28,
22065,
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,
905,
62,
33723,
62,
5657,
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,
220,
220,
3509,
62,
538,
5374,
82,
28,
16,
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,
4512,
62,
25067,
62,
9122,
28,
15,
13,
19,
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,
1188,
62,
25067,
62,
9122,
28,
15,
13,
17,
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,
27809,
385,
41888,
15,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9387,
62,
1891,
437,
11639,
1860,
79,
11537,
628,
220,
220,
220,
4197,
62,
25811,
796,
8633,
7,
27432,
62,
67,
10254,
1170,
263,
28,
19849,
13,
27432,
62,
67,
10254,
1170,
263,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1188,
62,
67,
10254,
1170,
364,
28,
19849,
13,
2100,
62,
67,
10254,
1170,
263,
28955,
628,
220,
220,
220,
21997,
796,
31924,
7,
1174,
2213,
10613,
62,
25811,
8,
198,
220,
220,
220,
1255,
796,
21997,
13,
11147,
7,
19849,
11,
12429,
11147,
62,
25811,
8,
198,
220,
220,
220,
6818,
1255,
6624,
352,
11,
366,
35,
6322,
1595,
470,
670,
351,
4818,
282,
1170,
364,
3804,
284,
4197,
3419,
526,
628,
198,
198,
4299,
1332,
62,
36166,
62,
6649,
333,
76,
62,
21928,
62,
2220,
7,
22065,
15908,
2599,
198,
220,
220,
220,
37227,
13414,
1958,
2746,
3613,
14,
2220,
14,
9122,
4122,
319,
9135,
526,
15931,
198,
220,
220,
220,
9732,
4487,
13,
42503,
62,
28826,
3419,
628,
220,
220,
220,
289,
37266,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
71,
37266,
3419,
198,
220,
220,
220,
2746,
796,
12469,
14402,
17633,
7,
71,
37266,
8,
628,
220,
220,
220,
1303,
49706,
2393,
284,
651,
13634,
198,
220,
220,
220,
49706,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
9288,
29302,
62,
6404,
1362,
7,
22065,
15908,
11,
10352,
8,
198,
220,
220,
220,
2196,
796,
49706,
13,
9641,
628,
220,
220,
220,
21997,
62,
25811,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
538,
5374,
82,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
28,
6404,
1362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
47423,
28,
17633,
9787,
4122,
7,
22065,
15908,
8,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
1303,
4197,
2746,
198,
220,
220,
220,
21997,
796,
31924,
7,
1174,
2213,
10613,
62,
25811,
8,
198,
220,
220,
220,
1255,
796,
21997,
13,
11147,
7,
19849,
8,
198,
220,
220,
220,
1103,
62,
20541,
62,
9662,
796,
21997,
13,
20541,
62,
9662,
628,
220,
220,
220,
1303,
491,
7574,
1844,
198,
220,
220,
220,
6818,
1255,
6624,
352,
11,
705,
696,
1343,
288,
26059,
2746,
4054,
284,
1844,
6,
628,
220,
220,
220,
1303,
4331,
351,
8776,
2746,
878,
8914,
198,
220,
220,
220,
1303,
787,
257,
17724,
198,
220,
220,
220,
4818,
282,
1170,
364,
796,
2746,
13,
9288,
62,
67,
10254,
1170,
263,
3419,
198,
220,
220,
220,
611,
407,
318,
39098,
7,
67,
10254,
1170,
364,
11,
1351,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
4818,
282,
1170,
364,
796,
685,
67,
10254,
1170,
364,
60,
628,
220,
220,
220,
329,
4818,
282,
1170,
263,
287,
4818,
282,
1170,
364,
25,
198,
220,
220,
220,
220,
220,
220,
220,
329,
15458,
287,
4818,
282,
1170,
263,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
628,
220,
220,
220,
2124,
11,
331,
796,
15458,
198,
220,
220,
220,
2124,
796,
2124,
13,
1177,
7,
87,
13,
7857,
7,
15,
828,
532,
16,
8,
628,
220,
220,
220,
2746,
13,
18206,
3419,
198,
220,
220,
220,
2747,
62,
19052,
62,
29336,
796,
2746,
7,
87,
8,
628,
220,
220,
220,
1303,
1332,
367,
5662,
8914,
198,
220,
220,
220,
1303,
29308,
27479,
319,
40066,
76,
198,
220,
220,
220,
7448,
62,
7753,
6978,
796,
21997,
13,
71,
14751,
62,
21928,
7,
22065,
15908,
11,
49706,
8,
198,
220,
220,
220,
6818,
28686,
13,
6978,
13,
1069,
1023,
7,
82,
9586,
62,
7753,
6978,
8,
628,
220,
220,
220,
1303,
649,
49706,
2393,
284,
651,
13634,
198,
220,
220,
220,
49706,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
9288,
29302,
62,
6404,
1362,
7,
22065,
15908,
11,
10352,
11,
2196,
28,
9641,
8,
628,
220,
220,
220,
21997,
62,
25811,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
538,
5374,
82,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
28,
6404,
1362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
26954,
62,
47423,
28,
17633,
9787,
4122,
7,
22065,
15908,
828,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
21997,
796,
31924,
7,
1174,
2213,
10613,
62,
25811,
8,
198,
220,
220,
220,
2746,
796,
12469,
14402,
17633,
7,
71,
37266,
8,
628,
220,
220,
220,
1303,
900,
262,
36835,
923,
8011,
523,
356,
460,
4331,
878,
262,
2746,
857,
262,
1336,
3047,
628,
220,
220,
220,
2746,
13,
261,
62,
538,
5374,
62,
9688,
796,
6818,
62,
28764,
62,
31642,
628,
220,
220,
220,
1303,
416,
4585,
4197,
757,
11,
356,
7616,
3047,
11,
11046,
19590,
422,
262,
13946,
198,
220,
220,
220,
1303,
290,
674,
8011,
284,
4331,
1262,
1459,
2746,
878,
597,
517,
3463,
5992,
198,
220,
220,
220,
21997,
13,
11147,
7,
19849,
8,
628,
198,
4299,
1332,
62,
41684,
62,
46999,
62,
23108,
62,
1891,
437,
7,
22065,
15908,
2599,
198,
220,
220,
220,
37227,
12050,
1654,
618,
1262,
3294,
32516,
262,
2836,
460,
470,
779,
4600,
17080,
6169,
62,
1891,
437,
796,
6045,
63,
526,
15931,
198,
220,
220,
220,
9732,
4487,
13,
42503,
62,
28826,
3419,
628,
220,
220,
220,
611,
407,
9732,
4487,
13,
5171,
62,
5143,
62,
46999,
62,
9288,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
2746,
11,
289,
37266,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
19849,
3419,
198,
220,
220,
220,
21997,
62,
25811,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
4277,
62,
21928,
62,
6978,
28,
22065,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
905,
62,
33723,
62,
5657,
28,
25101,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
538,
5374,
82,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
25067,
62,
9122,
28,
15,
13,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1188,
62,
25067,
62,
9122,
28,
15,
13,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
27809,
385,
11639,
12,
16,
6,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
351,
12972,
9288,
13,
40539,
82,
7,
12982,
20361,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
9732,
4487,
13,
5143,
62,
19849,
62,
9288,
7,
2213,
10613,
62,
25811,
11,
2746,
8,
628,
198,
4299,
1332,
62,
41684,
62,
46999,
62,
19849,
62,
26059,
7,
22065,
15908,
2599,
198,
220,
220,
220,
37227,
12050,
1654,
27704,
2499,
526,
15931,
198,
220,
220,
220,
9732,
4487,
13,
42503,
62,
28826,
3419,
628,
220,
220,
220,
611,
407,
9732,
4487,
13,
5171,
62,
5143,
62,
46999,
62,
9288,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
2746,
11,
289,
37266,
796,
9732,
4487,
13,
1136,
62,
12286,
62,
19849,
3419,
198,
220,
220,
220,
21997,
62,
25811,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
4277,
62,
21928,
62,
6978,
28,
22065,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
905,
62,
33723,
62,
5657,
28,
25101,
11,
198,
220,
220,
220,
220,
220,
220,
220,
9387,
62,
1891,
437,
11639,
26059,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
538,
5374,
82,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
25067,
62,
9122,
28,
15,
13,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1188,
62,
25067,
62,
9122,
28,
15,
13,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
27809,
385,
11639,
12,
16,
6,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
9732,
4487,
13,
5143,
62,
19849,
62,
9288,
7,
2213,
10613,
62,
25811,
11,
2746,
8,
628,
220,
220,
220,
1303,
1332,
4088,
31904,
5499,
198,
220,
220,
220,
4088,
13,
1136,
62,
31673,
62,
13317,
10786,
1084,
62,
9806,
11537,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
14692,
31197,
385,
1600,
366,
40319,
62,
22510,
62,
31197,
385,
1600,
366,
17080,
6169,
62,
1891,
437,
33116,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
657,
11,
6045,
11,
4686,
2625,
14202,
532,
1607,
657,
308,
19944,
284,
779,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
15,
11,
657,
11,
6045,
11,
4686,
2625,
46,
400,
308,
19944,
11,
1607,
352,
308,
19944,
284,
779,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
16,
11,
352,
11,
6045,
11,
4686,
2625,
16,
301,
308,
19944,
11,
1607,
352,
308,
19944,
284,
779,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
32590,
16,
11,
22814,
51,
10619,
62,
45,
62,
19238,
62,
16960,
2937,
11,
366,
1860,
79,
1600,
4686,
2625,
12,
16,
532,
779,
477,
27809,
385,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
10786,
12,
16,
3256,
22814,
51,
10619,
62,
45,
62,
19238,
62,
16960,
2937,
11,
366,
1860,
79,
1600,
4686,
2625,
29001,
16,
6,
532,
779,
477,
27809,
385,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
18,
11,
513,
11,
366,
1860,
79,
1600,
4686,
2625,
18,
4372,
308,
19944,
532,
352,
308,
19944,
284,
779,
357,
1891,
437,
25,
1860,
79,
8,
4943,
198,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
14692,
31197,
385,
1600,
366,
40319,
62,
22510,
62,
31197,
385,
1600,
366,
17080,
6169,
62,
1891,
437,
33116,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
657,
11,
6045,
11,
4686,
2625,
14202,
532,
1607,
657,
308,
19944,
284,
779,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
657,
11,
366,
1860,
79,
1600,
4686,
2625,
14202,
532,
1607,
657,
308,
19944,
284,
779,
526,
828,
198,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
17816,
31197,
385,
3256,
705,
40319,
62,
15763,
62,
46999,
3256,
366,
17080,
6169,
62,
1891,
437,
33116,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
6045,
11,
366,
1860,
79,
1600,
4686,
2625,
14202,
318,
6045,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
15,
11,
6045,
11,
366,
1860,
79,
1600,
4686,
2625,
46,
27809,
385,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
6045,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
16,
11,
657,
11,
366,
1860,
79,
1600,
4686,
2625,
16,
308,
19944,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
657,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
32590,
16,
11,
657,
11,
366,
1860,
79,
1600,
4686,
2625,
12,
16,
532,
779,
477,
27809,
385,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
657,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
10786,
12,
16,
3256,
657,
11,
366,
1860,
79,
1600,
4686,
2625,
29001,
16,
6,
532,
779,
477,
27809,
385,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
657,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
18,
11,
657,
11,
366,
1860,
79,
1600,
4686,
2625,
18,
27809,
385,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
657,
12195,
1891,
437,
25,
1860,
79,
8,
4943,
198,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
26933,
198,
220,
220,
220,
705,
31197,
385,
3256,
705,
40319,
62,
15763,
62,
46999,
3256,
366,
17080,
6169,
62,
1891,
437,
33116,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
6045,
11,
6045,
11,
4686,
2625,
14202,
318,
6045,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
6045,
11,
366,
1860,
79,
1600,
4686,
2625,
14202,
318,
6045,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
15,
11,
6045,
11,
366,
1860,
79,
1600,
4686,
2625,
14202,
318,
6045,
12340,
198,
12962,
628,
198,
2,
1081,
3364,
329,
257,
308,
19944,
618,
1729,
389,
1695,
481,
1255,
287,
257,
14136,
11250,
3924,
16922,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
26933,
198,
220,
220,
220,
705,
31197,
385,
3256,
705,
40319,
62,
15763,
62,
46999,
3256,
366,
17080,
6169,
62,
1891,
437,
33116,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
16,
11,
6045,
11,
366,
1860,
79,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
18,
11,
6045,
11,
366,
1860,
79,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
18,
11,
6045,
11,
366,
1860,
79,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
16,
11,
362,
4357,
6045,
11,
366,
1860,
79,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
15,
11,
352,
4357,
6045,
11,
366,
1860,
79,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
32590,
16,
11,
6045,
11,
366,
1860,
79,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
10786,
12,
16,
3256,
6045,
11,
366,
1860,
79,
4943,
198,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
17816,
31197,
385,
3256,
705,
40319,
62,
15763,
62,
46999,
6,
4357,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
6045,
11,
4686,
2625,
2949,
27809,
385,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
6045,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
15,
4357,
657,
11,
4686,
2625,
46,
400,
308,
19944,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
657,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
16,
4357,
352,
11,
4686,
2625,
16,
301,
308,
19944,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
352,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
18,
4357,
513,
11,
4686,
2625,
18,
4372,
308,
19944,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
513,
526,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
16,
11,
362,
4357,
352,
11,
4686,
2625,
58,
16,
11,
362,
60,
27809,
385,
11,
1607,
308,
19944,
6808,
3335,
284,
307,
352,
526,
828,
198,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
17816,
31197,
385,
3256,
705,
40319,
62,
46999,
62,
2340,
6,
4357,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
14202,
11,
6045,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
15,
11,
6045,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
16,
11,
685,
15,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
18,
11,
685,
15,
11,
352,
11,
362,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
32590,
16,
11,
1351,
7,
9521,
7,
47,
26087,
10619,
62,
45,
62,
19238,
62,
16960,
2937,
36911,
4686,
2625,
12,
16,
532,
779,
477,
27809,
385,
12340,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
15,
4357,
685,
15,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
16,
11,
513,
4357,
685,
16,
11,
513,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
10786,
15,
3256,
685,
15,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
10786,
18,
3256,
685,
18,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
10786,
16,
11,
513,
3256,
685,
16,
11,
513,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
10786,
12,
16,
3256,
1351,
7,
9521,
7,
47,
26087,
10619,
62,
45,
62,
19238,
62,
16960,
2937,
36911,
4686,
2625,
29001,
16,
6,
532,
779,
477,
27809,
385,
12340,
198,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7,
17816,
31197,
385,
6,
4357,
685,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
15,
13,
16,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
32590,
17,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
25101,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
21737,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
12,
16,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
26933,
14202,
46570,
198,
220,
220,
220,
12972,
9288,
13,
17143,
7,
17816,
15,
20520,
828,
198,
220,
220,
220,
12972,
9288,
13,
17143,
19510,
15,
11,
352,
36911,
198,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
31197,
385,
1600,
685,
7061,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
31197,
385,
1600,
16410,
16,
11,
362,
11,
678,
4357,
532,
16,
11,
705,
12,
16,
6,
12962,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
628,
198,
31,
9078,
9288,
13,
4102,
13,
31197,
385,
62,
17143,
62,
41989,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
31197,
385,
1600,
25915,
16,
11,
705,
12,
16,
6,
12962,
628,
198,
2,
611,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
2,
220,
220,
220,
220,
12972,
9288,
13,
12417,
26933,
834,
7753,
834,
12962,
198
] | 2.302506 | 3,990 |
from django.apps import AppConfig
| [
6738,
42625,
14208,
13,
18211,
1330,
2034,
16934,
628
] | 3.888889 | 9 |
## -*- encoding: utf-8 -*-
"""
This file (./integration_doctest.sage) was *autogenerated* from ./integration.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments from this file.
You should be able to doctest this file with:
sage -t ./integration_doctest.sage
It is always safe to delete this file; it is not used in typesetting your
document.
Sage example in ./integration.tex, line 44::
sage: x = var('x'); f(x) = exp(-x^2) * log(x)
sage: N(integrate(f, x, 1, 3))
0.035860294991267694
sage: plot(f, 1, 3, fill='axis')
Graphics object consisting of 2 graphics primitives
Sage example in ./integration.tex, line 103::
sage: fp = plot(f, 1, 3, color='red')
sage: n = 4
sage: interp_points = [(1+2*u/(n-1), N(f(1+2*u/(n-1))))
....: for u in range(n)]
sage: A = PolynomialRing(RR, 'x')
sage: pp = plot(A.lagrange_polynomial(interp_points), 1, 3, fill='axis')
sage: show(fp+pp)
Sage example in ./integration.tex, line 346::
sage: N(integrate(exp(-x^2)*log(x), x, 17, 42)) # rel tol 7e-15
2.5657285006962035e-127
Sage example in ./integration.tex, line 355::
sage: integrate(log(1+x)*x, x, 0, 1)
1/4
sage: N(integrate(log(1+x)*x, x, 0, 1))
0.250000000000000
Sage example in ./integration.tex, line 372::
sage: numerical_integral(exp(-x^2)*log(x), 17, 42) # rel tol 7e-12
(2.5657285006962035e-127, 3.3540254049238093e-128)
Sage example in ./integration.tex, line 394::
sage: numerical_integral(exp(-x^100), 0, 1.1)
(0.99432585119150..., 4.0775730...e-09)
sage: numerical_integral(exp(-x^100), 0, 1.1, algorithm='qng')
(0.994327538576531..., 0.016840666914...)
Sage example in ./integration.tex, line 404::
sage: integrate(exp(-x^2)*log(x), x, 17, 42)
integrate(e^(-x^2)*log(x), x, 17, 42)
Sage example in ./integration.tex, line 412::
sage: N(integrate(exp(-x^2)*log(x), x, 17, 42), 200) # rel tol 7e-15
2.5657285006962035e-127
Sage example in ./integration.tex, line 417::
sage: N(integrate(sin(x)*exp(cos(x)), x, 0, pi), 200)
2.3504023872876029137647637011912016303114359626681917404591
Sage example in ./integration.tex, line 430::
sage: sage.calculus.calculus.nintegral(sin(sin(x)), x, 0, 1)
(0.430606103120690..., 4.78068810228705...e-15, 21, 0)
Sage example in ./integration.tex, line 436::
sage: g(x) = sin(sin(x))
sage: g.nintegral(x, 0, 1)
(0.430606103120690..., 4.78068810228705...e-15, 21, 0)
Sage example in ./integration.tex, line 465::
sage: gp('intnum(x=17, 42, exp(-x^2)*log(x))') # rel tol 1e-17
2.5657285005610514829176211363206621657 E-127
Sage example in ./integration.tex, line 474::
sage: gp('intnum(x=0, 1, sin(sin(x)))')
0.430606103120690604912377355...
sage: old_prec = gp.set_precision(50)
sage: gp('intnum(x=0, 1, sin(sin(x)))')
0.43060610312069060491237735524846578643360804182200
Sage example in ./integration.tex, line 490::
sage: p = gp.set_precision(old_prec) # on remet la précision par défaut
sage: gp('intnum(x=0, 1, x^(-1/2))')
1.99999999999999999999...
Sage example in ./integration.tex, line 496::
sage: gp('intnum(x=[0, -1/2], 1, x^(-1/2))')
2.000000000000000000000000000...
Sage example in ./integration.tex, line 504::
sage: gp('intnum(x=[0, -1/42], 1, x^(-1/2))')
1.99999999999999999999...
Sage example in ./integration.tex, line 518::
sage: import mpmath
sage: mpmath.mp.prec = 53
sage: mpmath.quad(lambda x: mpmath.sin(mpmath.sin(x)), [0, 1])
mpf('0.43060610312069059')
Sage example in ./integration.tex, line 526::
sage: mpmath.mp.prec = 113
sage: mpmath.quad(lambda x: mpmath.sin(mpmath.sin(x)), [0, 1])
mpf('0.430606103120690604912377355248465809')
sage: mpmath.mp.prec = 114
sage: mpmath.quad(lambda x: mpmath.sin(mpmath.sin(x)), [0, 1])
mpf('0.430606103120690604912377355248465785')
Sage example in ./integration.tex, line 550::
sage: mpmath.quad(sin(sin(x)), [0, 1])
Traceback (most recent call last):
...
TypeError: no canonical coercion from
<type 'sage.libs.mpmath.ext_main.mpf'> to Symbolic Ring
Sage example in ./integration.tex, line 565::
sage: g(x) = max_symbolic(sin(x), cos(x))
sage: mpmath.mp.prec = 100
sage: mpmath.quadts(lambda x: g(N(x, 100)), [0, 1])
mpf('0.873912416263035435957979086252')
Sage example in ./integration.tex, line 574::
sage: mpmath.mp.prec = 170
sage: mpmath.quadts(lambda x: g(N(x, 190)), [0, 1])
mpf('0.87391090757400975205393005981962476344054148354188794')
sage: N(sqrt(2) - cos(1), 100)
0.87391125650495533140075211677
Sage example in ./integration.tex, line 585::
sage: mpmath.quadts(lambda x: g(N(x, 170)), [0, mpmath.pi / 4, 1])
mpf('0.87391125650495533140075211676672147483736145475902551')
Sage example in ./integration.tex, line 750::
sage: T = ode_solver()
Sage example in ./integration.tex, line 761::
sage: def f_1(t,y,params): return [y[1],params[0]*(1-y[0]^2)*y[1]-y[0]]
sage: T.function = f_1
Sage example in ./integration.tex, line 776::
sage: def j_1(t,y,params):
....: return [[0, 1],
....: [-2*params[0]*y[0]*y[1]-1, params[0]*(1-y[0]^2)],
....: [0,0]]
sage: T.jacobian = j_1
Sage example in ./integration.tex, line 786::
sage: T.algorithm = "rk8pd"
sage: T.ode_solve(y_0=[1,0], t_span=[0,100], params=[10],
....: num_points=1000)
sage: f = T.interpolate_solution()
Sage example in ./integration.tex, line 801::
sage: plot(f, 0, 100)
Graphics object consisting of 1 graphics primitive
Sage example in ./integration.tex, line 838::
sage: t, y = var('t, y')
sage: desolve_rk4(t*y*(2-y), y, ics=[0,1], end_points=[0, 1], step=0.5)
[[0, 1], [0.5, 1.12419127424558], [1.0, 1.461590162288825]]
Sage example in ./integration.tex, line 861::
sage: import mpmath
sage: mpmath.mp.prec = 53
sage: sol = mpmath.odefun(lambda t, y: y, 0, 1)
sage: sol(1)
mpf('2.7182818284590451')
sage: mpmath.mp.prec = 100
sage: sol(1)
mpf('2.7182818284590452353602874802307')
sage: N(exp(1), 100)
2.7182818284590452353602874714
Sage example in ./integration.tex, line 889::
sage: mpmath.mp.prec = 53
sage: f = mpmath.odefun(lambda t, y: [-y[1], y[0]], 0, [1, 0])
sage: f(3)
[mpf('-0.98999249660044542'), mpf('0.14112000805986721')]
sage: (cos(3.), sin(3.))
(-0.989992496600445, 0.141120008059867)
Sage example in ./integration.tex, line 939::
sage: mpmath.mp.prec = 10
sage: sol = mpmath.odefun(lambda t, y: y, 0, 1)
sage: sol(1)
mpf('2.7148')
sage: mpmath.mp.prec = 100
sage: sol(1)
mpf('2.7135204235459511323824699502438')
"""
# This file was *autogenerated* from the file integration_doctest.sage.
| [
2235,
532,
9,
12,
21004,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
1212,
2393,
357,
19571,
18908,
1358,
62,
4598,
310,
395,
13,
82,
496,
8,
373,
1635,
2306,
519,
877,
515,
9,
422,
24457,
18908,
1358,
13,
16886,
11,
198,
4480,
45229,
316,
1069,
13,
34365,
2196,
2813,
14,
2713,
14,
1983,
410,
17,
13,
18,
13,
16,
13,
198,
1026,
4909,
262,
10154,
286,
477,
262,
35021,
20688,
12493,
422,
428,
2393,
13,
198,
1639,
815,
307,
1498,
284,
10412,
395,
428,
2393,
351,
25,
198,
82,
496,
532,
83,
24457,
18908,
1358,
62,
4598,
310,
395,
13,
82,
496,
198,
1026,
318,
1464,
3338,
284,
12233,
428,
2393,
26,
340,
318,
407,
973,
287,
3858,
35463,
534,
198,
22897,
13,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
5846,
3712,
628,
220,
220,
220,
35021,
25,
2124,
796,
1401,
10786,
87,
24036,
277,
7,
87,
8,
796,
1033,
32590,
87,
61,
17,
8,
1635,
2604,
7,
87,
8,
198,
220,
220,
220,
35021,
25,
399,
7,
18908,
4873,
7,
69,
11,
2124,
11,
352,
11,
513,
4008,
198,
220,
220,
220,
657,
13,
15,
31128,
1899,
27696,
2079,
1065,
3134,
45214,
198,
220,
220,
220,
35021,
25,
7110,
7,
69,
11,
352,
11,
513,
11,
6070,
11639,
22704,
11537,
198,
220,
220,
220,
19840,
2134,
17747,
286,
362,
9382,
2684,
20288,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
15349,
3712,
628,
220,
220,
220,
35021,
25,
277,
79,
796,
7110,
7,
69,
11,
352,
11,
513,
11,
3124,
11639,
445,
11537,
198,
220,
220,
220,
35021,
25,
299,
796,
604,
198,
220,
220,
220,
35021,
25,
987,
79,
62,
13033,
796,
47527,
16,
10,
17,
9,
84,
29006,
77,
12,
16,
828,
399,
7,
69,
7,
16,
10,
17,
9,
84,
29006,
77,
12,
16,
35514,
198,
220,
220,
220,
19424,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
334,
287,
2837,
7,
77,
15437,
198,
220,
220,
220,
35021,
25,
317,
796,
12280,
26601,
498,
39687,
7,
21095,
11,
705,
87,
11537,
198,
220,
220,
220,
35021,
25,
9788,
796,
7110,
7,
32,
13,
30909,
9521,
62,
35428,
26601,
498,
7,
3849,
79,
62,
13033,
828,
352,
11,
513,
11,
6070,
11639,
22704,
11537,
198,
220,
220,
220,
35021,
25,
905,
7,
46428,
10,
381,
8,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
44729,
3712,
628,
220,
220,
220,
35021,
25,
399,
7,
18908,
4873,
7,
11201,
32590,
87,
61,
17,
27493,
6404,
7,
87,
828,
2124,
11,
1596,
11,
5433,
4008,
1303,
823,
284,
75,
767,
68,
12,
1314,
198,
220,
220,
220,
362,
13,
20,
37680,
2078,
4059,
38205,
1238,
2327,
68,
12,
16799,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
36561,
3712,
628,
220,
220,
220,
35021,
25,
19386,
7,
6404,
7,
16,
10,
87,
27493,
87,
11,
2124,
11,
657,
11,
352,
8,
198,
220,
220,
220,
352,
14,
19,
198,
220,
220,
220,
35021,
25,
399,
7,
18908,
4873,
7,
6404,
7,
16,
10,
87,
27493,
87,
11,
2124,
11,
657,
11,
352,
4008,
198,
220,
220,
220,
657,
13,
1495,
8269,
20483,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
46633,
3712,
628,
220,
220,
220,
35021,
25,
29052,
62,
18908,
1373,
7,
11201,
32590,
87,
61,
17,
27493,
6404,
7,
87,
828,
1596,
11,
5433,
8,
1303,
823,
284,
75,
767,
68,
12,
1065,
198,
220,
220,
220,
357,
17,
13,
20,
37680,
2078,
4059,
38205,
1238,
2327,
68,
12,
16799,
11,
513,
13,
2327,
1821,
1495,
1821,
2920,
1954,
1795,
6052,
68,
12,
12762,
8,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
5014,
19,
3712,
628,
220,
220,
220,
35021,
25,
29052,
62,
18908,
1373,
7,
11201,
32590,
87,
61,
3064,
828,
657,
11,
352,
13,
16,
8,
198,
220,
220,
220,
357,
15,
13,
2079,
3559,
25600,
4349,
1129,
8628,
986,
11,
604,
13,
2998,
39251,
1270,
986,
68,
12,
2931,
8,
198,
220,
220,
220,
35021,
25,
29052,
62,
18908,
1373,
7,
11201,
32590,
87,
61,
3064,
828,
657,
11,
352,
13,
16,
11,
11862,
11639,
80,
782,
11537,
198,
220,
220,
220,
357,
15,
13,
2079,
3559,
23195,
2548,
3553,
2996,
3132,
986,
11,
657,
13,
486,
3104,
1821,
2791,
3388,
1415,
23029,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
32320,
3712,
628,
220,
220,
220,
35021,
25,
19386,
7,
11201,
32590,
87,
61,
17,
27493,
6404,
7,
87,
828,
2124,
11,
1596,
11,
5433,
8,
198,
220,
220,
220,
19386,
7,
68,
61,
32590,
87,
61,
17,
27493,
6404,
7,
87,
828,
2124,
11,
1596,
11,
5433,
8,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
42215,
3712,
628,
220,
220,
220,
35021,
25,
399,
7,
18908,
4873,
7,
11201,
32590,
87,
61,
17,
27493,
6404,
7,
87,
828,
2124,
11,
1596,
11,
5433,
828,
939,
8,
1303,
823,
284,
75,
767,
68,
12,
1314,
198,
220,
220,
220,
362,
13,
20,
37680,
2078,
4059,
38205,
1238,
2327,
68,
12,
16799,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
47580,
3712,
628,
220,
220,
220,
35021,
25,
399,
7,
18908,
4873,
7,
31369,
7,
87,
27493,
11201,
7,
6966,
7,
87,
36911,
2124,
11,
657,
11,
31028,
828,
939,
8,
198,
220,
220,
220,
362,
13,
14877,
1821,
1954,
5774,
27800,
1899,
1959,
19708,
2414,
4304,
2718,
486,
1129,
1065,
27037,
22572,
16562,
2327,
4846,
2075,
3104,
1129,
1558,
1821,
2231,
6420,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
35090,
3712,
628,
220,
220,
220,
35021,
25,
35021,
13,
9948,
17576,
13,
9948,
17576,
13,
77,
18908,
1373,
7,
31369,
7,
31369,
7,
87,
36911,
2124,
11,
657,
11,
352,
8,
198,
220,
220,
220,
357,
15,
13,
31794,
33206,
15197,
1065,
3312,
3829,
986,
11,
604,
13,
40873,
34427,
940,
23815,
34801,
986,
68,
12,
1314,
11,
2310,
11,
657,
8,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
50038,
3712,
628,
220,
220,
220,
35021,
25,
308,
7,
87,
8,
796,
7813,
7,
31369,
7,
87,
4008,
198,
220,
220,
220,
35021,
25,
308,
13,
77,
18908,
1373,
7,
87,
11,
657,
11,
352,
8,
198,
220,
220,
220,
357,
15,
13,
31794,
33206,
15197,
1065,
3312,
3829,
986,
11,
604,
13,
40873,
34427,
940,
23815,
34801,
986,
68,
12,
1314,
11,
2310,
11,
657,
8,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
49669,
3712,
628,
220,
220,
220,
35021,
25,
27809,
10786,
600,
22510,
7,
87,
28,
1558,
11,
5433,
11,
1033,
32590,
87,
61,
17,
27493,
6404,
7,
87,
4008,
11537,
1303,
823,
284,
75,
352,
68,
12,
1558,
198,
220,
220,
220,
362,
13,
20,
37680,
2078,
4059,
3980,
13348,
18294,
1959,
1558,
5237,
1157,
2623,
19504,
2791,
20666,
3553,
412,
12,
16799,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
604,
4524,
3712,
628,
220,
220,
220,
35021,
25,
27809,
10786,
600,
22510,
7,
87,
28,
15,
11,
352,
11,
7813,
7,
31369,
7,
87,
22305,
11537,
198,
220,
220,
220,
657,
13,
31794,
33206,
15197,
1065,
3312,
3829,
1899,
2920,
1065,
26514,
28567,
986,
198,
220,
220,
220,
35021,
25,
1468,
62,
3866,
66,
796,
27809,
13,
2617,
62,
3866,
16005,
7,
1120,
8,
198,
220,
220,
220,
35021,
25,
27809,
10786,
600,
22510,
7,
87,
28,
15,
11,
352,
11,
7813,
7,
31369,
7,
87,
22305,
11537,
198,
220,
220,
220,
657,
13,
31794,
33206,
15197,
1065,
3312,
3829,
1899,
2920,
1065,
26514,
28567,
1731,
5705,
2996,
3695,
2414,
2091,
1899,
36088,
1507,
34294,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
45601,
3712,
628,
220,
220,
220,
35021,
25,
279,
796,
27809,
13,
2617,
62,
3866,
16005,
7,
727,
62,
3866,
66,
8,
1303,
319,
816,
316,
8591,
778,
2634,
16005,
1582,
39073,
69,
2306,
198,
220,
220,
220,
35021,
25,
27809,
10786,
600,
22510,
7,
87,
28,
15,
11,
352,
11,
2124,
61,
32590,
16,
14,
17,
4008,
11537,
198,
220,
220,
220,
352,
13,
24214,
24214,
24214,
24214,
24214,
986,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
604,
4846,
3712,
628,
220,
220,
220,
35021,
25,
27809,
10786,
600,
22510,
7,
87,
41888,
15,
11,
532,
16,
14,
17,
4357,
352,
11,
2124,
61,
32590,
16,
14,
17,
4008,
11537,
198,
220,
220,
220,
362,
13,
25645,
8269,
830,
986,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
41612,
3712,
628,
220,
220,
220,
35021,
25,
27809,
10786,
600,
22510,
7,
87,
41888,
15,
11,
532,
16,
14,
3682,
4357,
352,
11,
2124,
61,
32590,
16,
14,
17,
4008,
11537,
198,
220,
220,
220,
352,
13,
24214,
24214,
24214,
24214,
24214,
986,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
642,
1507,
3712,
628,
220,
220,
220,
35021,
25,
1330,
285,
4426,
776,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
7192,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
47003,
7,
50033,
2124,
25,
285,
4426,
776,
13,
31369,
7,
3149,
11018,
13,
31369,
7,
87,
36911,
685,
15,
11,
352,
12962,
198,
220,
220,
220,
29034,
69,
10786,
15,
13,
31794,
33206,
15197,
1065,
3312,
44928,
24,
11537,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
642,
2075,
3712,
628,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
17318,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
47003,
7,
50033,
2124,
25,
285,
4426,
776,
13,
31369,
7,
3149,
11018,
13,
31369,
7,
87,
36911,
685,
15,
11,
352,
12962,
198,
220,
220,
220,
29034,
69,
10786,
15,
13,
31794,
33206,
15197,
1065,
3312,
3829,
1899,
2920,
1065,
26514,
28567,
1731,
5705,
2996,
34583,
11537,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
17342,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
47003,
7,
50033,
2124,
25,
285,
4426,
776,
13,
31369,
7,
3149,
11018,
13,
31369,
7,
87,
36911,
685,
15,
11,
352,
12962,
198,
220,
220,
220,
29034,
69,
10786,
15,
13,
31794,
33206,
15197,
1065,
3312,
3829,
1899,
2920,
1065,
26514,
28567,
1731,
5705,
2996,
41172,
11537,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
25240,
3712,
628,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
47003,
7,
31369,
7,
31369,
7,
87,
36911,
685,
15,
11,
352,
12962,
198,
220,
220,
220,
34912,
1891,
357,
1712,
2274,
869,
938,
2599,
198,
220,
220,
220,
2644,
198,
220,
220,
220,
5994,
12331,
25,
645,
40091,
32000,
422,
198,
220,
220,
220,
1279,
4906,
705,
82,
496,
13,
8019,
82,
13,
3149,
11018,
13,
2302,
62,
12417,
13,
3149,
69,
44167,
284,
41327,
4160,
12569,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
642,
2996,
3712,
628,
220,
220,
220,
35021,
25,
308,
7,
87,
8,
796,
3509,
62,
1837,
2022,
4160,
7,
31369,
7,
87,
828,
8615,
7,
87,
4008,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
1802,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
47003,
912,
7,
50033,
2124,
25,
308,
7,
45,
7,
87,
11,
1802,
36911,
685,
15,
11,
352,
12962,
198,
220,
220,
220,
29034,
69,
10786,
15,
13,
5774,
2670,
17464,
1433,
2075,
1270,
32182,
30743,
41734,
3720,
2919,
21,
22800,
11537,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
642,
4524,
3712,
628,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
16677,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
47003,
912,
7,
50033,
2124,
25,
308,
7,
45,
7,
87,
11,
19884,
36911,
685,
15,
11,
352,
12962,
198,
220,
220,
220,
29034,
69,
10786,
15,
13,
5774,
2670,
940,
3829,
2425,
4524,
28694,
2425,
21261,
2670,
6200,
41292,
25272,
1731,
4304,
2682,
1821,
4051,
18294,
32182,
20356,
50242,
11537,
198,
220,
220,
220,
35021,
25,
399,
7,
31166,
17034,
7,
17,
8,
532,
8615,
7,
16,
828,
1802,
8,
198,
220,
220,
220,
657,
13,
5774,
2670,
14686,
3980,
1120,
2920,
2816,
2091,
1415,
405,
2425,
21895,
40179,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
642,
5332,
3712,
628,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
47003,
912,
7,
50033,
2124,
25,
308,
7,
45,
7,
87,
11,
16677,
36911,
685,
15,
11,
285,
4426,
776,
13,
14415,
1220,
604,
11,
352,
12962,
198,
220,
220,
220,
29034,
69,
10786,
15,
13,
5774,
2670,
14686,
3980,
1120,
2920,
2816,
2091,
1415,
405,
2425,
21895,
3134,
2791,
4761,
20198,
2780,
2718,
2623,
1415,
4051,
2425,
3829,
1495,
4349,
11537,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
19683,
3712,
628,
220,
220,
220,
35021,
25,
309,
796,
267,
2934,
62,
82,
14375,
3419,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
767,
5333,
3712,
628,
220,
220,
220,
35021,
25,
825,
277,
62,
16,
7,
83,
11,
88,
11,
37266,
2599,
1441,
685,
88,
58,
16,
4357,
37266,
58,
15,
60,
9,
7,
16,
12,
88,
58,
15,
60,
61,
17,
27493,
88,
58,
16,
45297,
88,
58,
15,
11907,
198,
220,
220,
220,
35021,
25,
309,
13,
8818,
796,
277,
62,
16,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
767,
4304,
3712,
628,
220,
220,
220,
35021,
25,
825,
474,
62,
16,
7,
83,
11,
88,
11,
37266,
2599,
198,
220,
220,
220,
19424,
25,
220,
220,
220,
220,
1441,
16410,
15,
11,
352,
4357,
198,
220,
220,
220,
19424,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25915,
17,
9,
37266,
58,
15,
60,
9,
88,
58,
15,
60,
9,
88,
58,
16,
45297,
16,
11,
42287,
58,
15,
60,
9,
7,
16,
12,
88,
58,
15,
60,
61,
17,
8,
4357,
198,
220,
220,
220,
19424,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
15,
11907,
198,
220,
220,
220,
35021,
25,
309,
13,
30482,
672,
666,
796,
474,
62,
16,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
767,
4521,
3712,
628,
220,
220,
220,
35021,
25,
309,
13,
282,
42289,
796,
366,
81,
74,
23,
30094,
1,
198,
220,
220,
220,
35021,
25,
309,
13,
1098,
62,
82,
6442,
7,
88,
62,
15,
41888,
16,
11,
15,
4357,
256,
62,
12626,
41888,
15,
11,
3064,
4357,
42287,
41888,
940,
4357,
198,
220,
220,
220,
19424,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
997,
62,
13033,
28,
12825,
8,
198,
220,
220,
220,
35021,
25,
277,
796,
309,
13,
3849,
16104,
378,
62,
82,
2122,
3419,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
807,
486,
3712,
628,
220,
220,
220,
35021,
25,
7110,
7,
69,
11,
657,
11,
1802,
8,
198,
220,
220,
220,
19840,
2134,
17747,
286,
352,
9382,
20049,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
807,
2548,
3712,
628,
220,
220,
220,
35021,
25,
256,
11,
331,
796,
1401,
10786,
83,
11,
331,
11537,
198,
220,
220,
220,
35021,
25,
748,
6442,
62,
81,
74,
19,
7,
83,
9,
88,
9,
7,
17,
12,
88,
828,
331,
11,
220,
873,
41888,
15,
11,
16,
4357,
886,
62,
13033,
41888,
15,
11,
352,
4357,
2239,
28,
15,
13,
20,
8,
198,
220,
220,
220,
16410,
15,
11,
352,
4357,
685,
15,
13,
20,
11,
352,
13,
17464,
1129,
1065,
4524,
1731,
40486,
4357,
685,
16,
13,
15,
11,
352,
13,
3510,
19707,
27037,
1828,
28011,
1495,
11907,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
807,
5333,
3712,
628,
220,
220,
220,
35021,
25,
1330,
285,
4426,
776,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
7192,
198,
220,
220,
220,
35021,
25,
1540,
796,
285,
4426,
776,
13,
375,
891,
403,
7,
50033,
256,
11,
331,
25,
331,
11,
657,
11,
352,
8,
198,
220,
220,
220,
35021,
25,
1540,
7,
16,
8,
198,
220,
220,
220,
29034,
69,
10786,
17,
13,
45720,
2078,
1507,
2078,
2231,
3829,
36330,
11537,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
1802,
198,
220,
220,
220,
35021,
25,
1540,
7,
16,
8,
198,
220,
220,
220,
29034,
69,
10786,
17,
13,
45720,
2078,
1507,
2078,
2231,
3829,
2231,
1954,
4310,
1899,
2078,
4524,
1795,
19214,
22,
11537,
198,
220,
220,
220,
35021,
25,
399,
7,
11201,
7,
16,
828,
1802,
8,
198,
220,
220,
220,
362,
13,
45720,
2078,
1507,
2078,
2231,
3829,
2231,
1954,
4310,
1899,
27800,
2857,
1415,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
807,
4531,
3712,
628,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
7192,
198,
220,
220,
220,
35021,
25,
277,
796,
285,
4426,
776,
13,
375,
891,
403,
7,
50033,
256,
11,
331,
25,
25915,
88,
58,
16,
4357,
331,
58,
15,
60,
4357,
657,
11,
685,
16,
11,
657,
12962,
198,
220,
220,
220,
35021,
25,
277,
7,
18,
8,
198,
220,
220,
220,
685,
3149,
69,
10786,
12,
15,
13,
4089,
17032,
21626,
2791,
22914,
2231,
3682,
33809,
29034,
69,
10786,
15,
13,
1415,
14686,
830,
1795,
41292,
3134,
2481,
11537,
60,
198,
220,
220,
220,
35021,
25,
357,
6966,
7,
18,
12179,
7813,
7,
18,
2014,
8,
198,
220,
220,
220,
13841,
15,
13,
4089,
17032,
21626,
2791,
22914,
2231,
11,
657,
13,
1415,
14686,
830,
1795,
41292,
3134,
8,
198,
198,
50,
496,
1672,
287,
24457,
18908,
1358,
13,
16886,
11,
1627,
860,
2670,
3712,
628,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
838,
198,
220,
220,
220,
35021,
25,
1540,
796,
285,
4426,
776,
13,
375,
891,
403,
7,
50033,
256,
11,
331,
25,
331,
11,
657,
11,
352,
8,
198,
220,
220,
220,
35021,
25,
1540,
7,
16,
8,
198,
220,
220,
220,
29034,
69,
10786,
17,
13,
22,
18294,
11537,
198,
220,
220,
220,
35021,
25,
285,
4426,
776,
13,
3149,
13,
3866,
66,
796,
1802,
198,
220,
220,
220,
35021,
25,
1540,
7,
16,
8,
198,
220,
220,
220,
29034,
69,
10786,
17,
13,
22,
17059,
18638,
22370,
2231,
3865,
16616,
23721,
26912,
2079,
1120,
1731,
2548,
11537,
198,
198,
37811,
198,
2,
770,
2393,
373,
1635,
2306,
519,
877,
515,
9,
422,
262,
2393,
11812,
62,
4598,
310,
395,
13,
82,
496,
13,
198
] | 2.168917 | 3,185 |
# Generated by Django 3.0.2 on 2020-07-21 00:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
513,
13,
15,
13,
17,
319,
12131,
12,
2998,
12,
2481,
3571,
25,
3365,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
628
] | 3.019231 | 52 |
""" Заголовок пакета """
default_app_config = 'multimeter.apps.MultimeterConfig' # pylint: disable=invalid-name
| [
37811,
12466,
245,
16142,
140,
111,
25443,
119,
25443,
110,
25443,
118,
12466,
123,
16142,
31583,
16843,
20375,
16142,
37227,
198,
198,
12286,
62,
1324,
62,
11250,
796,
705,
16680,
16912,
13,
18211,
13,
15205,
16912,
16934,
6,
220,
1303,
279,
2645,
600,
25,
15560,
28,
259,
12102,
12,
3672,
198
] | 2.235294 | 51 |
#!/usr/bin/env python3
import itertools
import sys
MASK = 0xffffff
# did I implement this correctly?
assert forward(*map(bytes.fromhex, ('1211100a0908020100',
'20796c6c6172'))) == b'\xc0\x49\xa5\x38\x5a\xdc'
if len(sys.argv) < 2:
print(f"Usage: python3 {sys.argv[0]} <hex>")
exit(1)
target = bytes.fromhex(sys.argv[1])
key = (18).to_bytes(9, 'big')
start = bytes(6)
end = backward(key, target)
assert(forward(key, end) == target)
forward_dict = {}
backward_dict = {}
all_bytes = [i.to_bytes(1, 'big') for i in range(256)]
for k in itertools.product(all_bytes, repeat=9):
key = b''.join(k)
f = forward(key, start)
forward_dict[f] = key
if f in backward_dict:
ans = key + backward_dict[f]
break
b = backward(key, end)
backward_dict[b] = key
if b in forward_dict:
ans = forward_dict[b] + key
break
print(ans.hex())
assert H(ans) == target
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
340,
861,
10141,
198,
11748,
25064,
198,
198,
31180,
42,
796,
657,
87,
12927,
487,
628,
628,
198,
2,
750,
314,
3494,
428,
9380,
30,
198,
30493,
2651,
46491,
8899,
7,
33661,
13,
6738,
33095,
11,
19203,
1065,
1157,
3064,
64,
2931,
33057,
1264,
405,
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,
705,
1238,
41060,
66,
21,
66,
21,
23628,
6,
22305,
6624,
275,
6,
59,
25306,
15,
59,
87,
2920,
59,
27865,
20,
59,
87,
2548,
59,
87,
20,
64,
59,
87,
17896,
6,
628,
198,
198,
361,
18896,
7,
17597,
13,
853,
85,
8,
1279,
362,
25,
198,
220,
220,
220,
3601,
7,
69,
1,
28350,
25,
21015,
18,
1391,
17597,
13,
853,
85,
58,
15,
48999,
1279,
33095,
29,
4943,
198,
220,
220,
220,
8420,
7,
16,
8,
198,
198,
16793,
796,
9881,
13,
6738,
33095,
7,
17597,
13,
853,
85,
58,
16,
12962,
628,
198,
2539,
796,
357,
1507,
737,
1462,
62,
33661,
7,
24,
11,
705,
14261,
11537,
198,
198,
9688,
796,
9881,
7,
21,
8,
198,
437,
796,
19528,
7,
2539,
11,
2496,
8,
198,
198,
30493,
7,
11813,
7,
2539,
11,
886,
8,
6624,
2496,
8,
198,
198,
11813,
62,
11600,
796,
23884,
198,
1891,
904,
62,
11600,
796,
23884,
198,
198,
439,
62,
33661,
796,
685,
72,
13,
1462,
62,
33661,
7,
16,
11,
705,
14261,
11537,
329,
1312,
287,
2837,
7,
11645,
15437,
198,
1640,
479,
287,
340,
861,
10141,
13,
11167,
7,
439,
62,
33661,
11,
9585,
28,
24,
2599,
198,
220,
220,
220,
1994,
796,
275,
35384,
22179,
7,
74,
8,
198,
220,
220,
220,
277,
796,
2651,
7,
2539,
11,
923,
8,
198,
220,
220,
220,
2651,
62,
11600,
58,
69,
60,
796,
1994,
198,
220,
220,
220,
611,
277,
287,
19528,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
9093,
796,
1994,
1343,
19528,
62,
11600,
58,
69,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
275,
796,
19528,
7,
2539,
11,
886,
8,
198,
220,
220,
220,
19528,
62,
11600,
58,
65,
60,
796,
1994,
198,
220,
220,
220,
611,
275,
287,
2651,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
9093,
796,
2651,
62,
11600,
58,
65,
60,
1343,
1994,
198,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
198,
4798,
7,
504,
13,
33095,
28955,
198,
30493,
367,
7,
504,
8,
6624,
2496,
198
] | 2.153153 | 444 |
if __name__ == '__main__':
n = int(input())
student_marks = {}
for _ in range(n):
name, *line = input().split()
scores = list(map(float, line))
student_marks[name] = scores
query_name = input()
average = sum(student_marks[query_name])/ len(student_marks[query_name])
print("{:.2f}".format(average))
# Passing an integer after the ':' will cause that field to be a minimum
# number of characters wide.
# str.format(): Perform a string formatting operation. The string on which
# this method is called can contain literal text or replacement fields
# delimited by braces {}. Each replacement field contains either the
# numeric index of a positional argument, or the name of a keyword
# argument. Returns a copy of the string where each replacement field is
# replaced with the string value of the corresponding argument.
| [
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
299,
796,
493,
7,
15414,
28955,
198,
220,
220,
220,
3710,
62,
14306,
796,
23884,
198,
220,
220,
220,
329,
4808,
287,
2837,
7,
77,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
11,
1635,
1370,
796,
5128,
22446,
35312,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
8198,
796,
1351,
7,
8899,
7,
22468,
11,
1627,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
3710,
62,
14306,
58,
3672,
60,
796,
8198,
198,
220,
220,
220,
12405,
62,
3672,
796,
5128,
3419,
198,
220,
220,
220,
2811,
796,
2160,
7,
50139,
62,
14306,
58,
22766,
62,
3672,
12962,
14,
18896,
7,
50139,
62,
14306,
58,
22766,
62,
3672,
12962,
198,
220,
220,
220,
3601,
7203,
90,
25,
13,
17,
69,
92,
1911,
18982,
7,
23913,
4008,
198,
220,
220,
220,
220,
198,
2,
46389,
281,
18253,
706,
262,
705,
32105,
481,
2728,
326,
2214,
284,
307,
257,
5288,
198,
2,
1271,
286,
3435,
3094,
13,
198,
198,
2,
965,
13,
18982,
33529,
35006,
257,
4731,
33313,
4905,
13,
383,
4731,
319,
543,
220,
198,
2,
428,
2446,
318,
1444,
460,
3994,
18875,
2420,
393,
9014,
7032,
220,
198,
2,
46728,
863,
416,
47241,
23884,
13,
5501,
9014,
2214,
4909,
2035,
262,
220,
198,
2,
35575,
6376,
286,
257,
45203,
4578,
11,
393,
262,
1438,
286,
257,
21179,
220,
198,
2,
4578,
13,
16409,
257,
4866,
286,
262,
4731,
810,
1123,
9014,
2214,
318,
220,
198,
2,
6928,
351,
262,
4731,
1988,
286,
262,
11188,
4578,
13,
198
] | 3.304511 | 266 |
/home/runner/.cache/pip/pool/aa/b2/26/72bdb8c2f74308cbc5f71d13cb1f12d650ade8623046fcee026be0fd38 | [
14,
11195,
14,
16737,
11757,
23870,
14,
79,
541,
14,
7742,
14,
7252,
14,
65,
17,
14,
2075,
14,
4761,
65,
9945,
23,
66,
17,
69,
4524,
21495,
66,
15630,
20,
69,
4869,
67,
1485,
21101,
16,
69,
1065,
67,
17544,
671,
4521,
19214,
3510,
69,
344,
68,
45987,
1350,
15,
16344,
2548
] | 1.811321 | 53 |
'''
Run NASQM
created by Dustin Tracy ([email protected])
This program is used to automate NASQM job creations.
You'll find the parameters to change in the file nasqm_user_input.py
'''
import argparse
import time
from pynasqm.initialize import initialize
from pynasqm.inputceon import InputCeon
from pynasqm.write import (write_omega_vs_time, write_spectra_flu_input,
write_average_coeffs)
from pynasqm.spectracollection import write_spectra_input
from pynasqm.userinput import UserInput
from pynasqm.trajectories.qmgroundstatetrajectories import QmGroundTrajectories
from pynasqm.trajectories.qmexcitedstatetrajectories import QmExcitedStateTrajectories
from pynasqm.trajectories.pulsepump import PulsePump
from pynasqm.initialexcitedstates import get_energies_and_strenghts
from pynasqm.trajectories.mmgroundstatetrajectory import groundStateDynamics
from pynasqm.trajectories.absorptionsnaps import AbsorptionSnaps
from pynasqm.trajectories.fluorescencesnaps import FluorescenceSnaps
from pynasqm.sed import sed_inplace, sed_global
from pynasqm.nasqmslurm import restart_nasqm
from pynasqm.trajectories.combine_trajectories import combine_trajectories
from pynasqm.collect_coeffs import collect_coeffs
import subprocess
def main():
'''
The primary nasqm automation function call. All changable parameters can be
found in userinput.py
'''
parser = argparse.ArgumentParser()
parser.add_argument("--init", help="initialize the directory for nasqm", action="store_true")
parser.add_argument("--job", help="0-ground, 1-qmground, 2-qmexcited", default=0, type=int)
parser.add_argument("--restart", help="restart attempt, 0 for first run", default=0, type=int)
args = parser.parse_args()
if args.init:
title_print('Initializing Directory')
print("Amber Input File: md_qmmm_amb.in")
print("NEXMD Input File: input.ceon")
print("PYNASQM Input File: pynasqm.in")
print("Please rename your coordinate file to m1_md2.rst")
print("Please rename your parmtop file to m1.prmtop")
initialize()
exit()
user_input = UserInput()
user_input.restart_attempt = args.restart
if args.restart != 0:
if args.job > 0:
user_input.run_ground_state_dynamics = False
if args.job > 1:
user_input.run_qmground_trajectories = False
user_input.run_absorption_collection = False
original_inputs = copy_inputs()
input_ceon = create_input(user_input)
start_time = time.time()
if user_input.run_ground_state_dynamics:
run_mm_ground_state_dynamics(input_ceon, user_input)
if user_input.run_qmground_trajectories:
run_qm_ground_state_trajectories(input_ceon, user_input)
if user_input.run_absorption_snapshots:
run_absorption_snaps(input_ceon, user_input)
if user_input.run_absorption_collection:
run_absorption_collection(user_input)
if should_perform_pulse_pump(user_input, args.restart):
run_pulse_pump_prep(input_ceon, user_input)
if should_perform_pulse_pump_collection(user_input, args.restart):
run_pulse_pump_prep_collection(input_ceon, user_input)
if user_input.run_excited_state_trajectories:
run_excited_state_trajectories(input_ceon, user_input)
if user_input.run_fluorescence_snapshots:
run_fluorescence_snaps(input_ceon, user_input)
if user_input.run_fluorescence_collection:
run_fluorescence_collection(user_input)
if not user_input.is_hpc:
restore_inputs(original_inputs)
input_ceon.write_log()
end_time = time.time()
print("Job finished in %s seconds" % (end_time - start_time))
def run_mm_ground_state_dynamics(md_qmmm_amb, user_input):
'''
Run the ground state trajectory that will be used to generate initial geometries
for future calculations
'''
title_print("MM Ground-State Trajectory")
groundStateDynamics(md_qmmm_amb, user_input)
manage_restart(0, user_input, user_input.restart_attempt)
def run_qm_ground_state_trajectories(input_ceon, user_input):
'''
Now we want to take the original trajectory snapshots and run more trajectories
using random velocities to make them different from each other
'''
title_print("QM Ground-State Trajectories")
QmGroundTrajectories(user_input, input_ceon).run()
manage_restart(1, user_input, user_input.restart_attempt)
def run_absorption_snaps(input_ceon, user_input):
'''
Take snapshots from the qmground trajectories ignoring a time delay.
Run singlepoints on these snaphsots
'''
title_print("Absorption Snaps")
AbsorptionSnaps(user_input, input_ceon).run()
def run_absorption_collection(user_input):
'''
Parse the output data from amber for absorption energies and create a spectra_abs.input
file
'''
title_print("Absorption Parsing")
write_spectra_input(user_input, 'absorption')
energies, strengths = get_energies_and_strenghts('spectra_absorption.input')
print_energies_and_strengths(energies, strengths)
def run_excited_state_trajectories(input_ceon, user_input):
'''
We take the original trajectory snapshots and run further trajectories
from those at the excited state
'''
print("!!!!!!!!!!!!!!!!!!!! Running Excited States !!!!!!!!!!!!!!!!!!!!")
QmExcitedStateTrajectories(user_input, input_ceon).run()
manage_restart(2, user_input, user_input.restart_attempt)
if user_input.is_tully:
collect_coeffs(
number_trajectories=user_input.n_snapshots_ex,
number_restarts=user_input.n_exc_runs - 1
)
def run_fluorescence_snaps(input_ceon, user_input):
'''
Take snapshots from the qmground trajectories ignoring a time delay.
Run singlepoints on these snaphsots
'''
title_print("Fluorescence Snaps")
FluorescenceSnaps(user_input, input_ceon).run()
def run_fluorescence_collection(user_input):
'''
Parse the output data from amber for fluorescene energies and create a spectra_flu.input
file
'''
print("!!!!!!!!!!!!!!!!!!!! Parsing Fluorescences !!!!!!!!!!!!!!!!!!!!")
# combine_trajectories("qmexcited", user_input.n_snapshots_ex, user_input.n_exc_runs)
exc_state_init = user_input.exc_state_init_ex_param
exc_state_prop = user_input.n_exc_states_propagate_ex_param
n_completed = write_spectra_flu_input(user_input)
write_omega_vs_time(n_trajectories=n_completed, n_states=exc_state_init)
if user_input.is_tully:
write_average_coeffs(n_trajectories=user_input.n_snapshots_ex, n_states=exc_state_prop)
try:
main()
except KeyboardInterrupt:
print("You canceled the operation")
| [
7061,
6,
198,
10987,
7210,
48,
44,
198,
25598,
416,
37616,
31140,
357,
67,
2213,
1590,
13,
3046,
31,
14816,
13,
785,
8,
198,
1212,
1430,
318,
973,
284,
43511,
7210,
48,
44,
1693,
28443,
13,
198,
1639,
1183,
1064,
262,
10007,
284,
1487,
287,
262,
2393,
25221,
80,
76,
62,
7220,
62,
15414,
13,
9078,
198,
7061,
6,
198,
11748,
1822,
29572,
198,
11748,
640,
198,
6738,
279,
2047,
292,
80,
76,
13,
36733,
1096,
1330,
41216,
198,
6738,
279,
2047,
292,
80,
76,
13,
15414,
344,
261,
1330,
23412,
34,
23277,
198,
6738,
279,
2047,
292,
80,
76,
13,
13564,
1330,
357,
13564,
62,
462,
4908,
62,
14259,
62,
2435,
11,
3551,
62,
4443,
430,
62,
35522,
62,
15414,
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,
3551,
62,
23913,
62,
1073,
14822,
82,
8,
198,
6738,
279,
2047,
292,
80,
76,
13,
4443,
11510,
349,
1564,
1330,
3551,
62,
4443,
430,
62,
15414,
198,
6738,
279,
2047,
292,
80,
76,
13,
7220,
15414,
1330,
11787,
20560,
198,
6738,
279,
2047,
292,
80,
76,
13,
9535,
752,
1749,
13,
80,
76,
2833,
14269,
316,
430,
752,
1749,
1330,
1195,
76,
35539,
15721,
752,
1749,
198,
6738,
279,
2047,
292,
80,
76,
13,
9535,
752,
1749,
13,
80,
76,
41194,
863,
14269,
316,
430,
752,
1749,
1330,
1195,
76,
40127,
863,
9012,
15721,
752,
1749,
198,
6738,
279,
2047,
292,
80,
76,
13,
9535,
752,
1749,
13,
79,
9615,
79,
931,
1330,
25062,
47,
931,
198,
6738,
279,
2047,
292,
80,
76,
13,
36733,
41194,
863,
27219,
1330,
651,
62,
877,
70,
444,
62,
392,
62,
301,
918,
456,
912,
198,
6738,
279,
2047,
292,
80,
76,
13,
9535,
752,
1749,
13,
3020,
2833,
14269,
316,
430,
752,
652,
1330,
2323,
9012,
35,
4989,
873,
198,
6738,
279,
2047,
292,
80,
76,
13,
9535,
752,
1749,
13,
46303,
8544,
77,
1686,
1330,
13051,
273,
1159,
16501,
1686,
198,
6738,
279,
2047,
292,
80,
76,
13,
9535,
752,
1749,
13,
35522,
45166,
3007,
77,
1686,
1330,
34070,
48699,
16501,
1686,
198,
6738,
279,
2047,
292,
80,
76,
13,
36622,
1330,
10081,
62,
259,
5372,
11,
10081,
62,
20541,
198,
6738,
279,
2047,
292,
80,
76,
13,
24716,
80,
907,
75,
333,
76,
1330,
15765,
62,
24716,
80,
76,
198,
6738,
279,
2047,
292,
80,
76,
13,
9535,
752,
1749,
13,
24011,
500,
62,
9535,
752,
1749,
1330,
12082,
62,
9535,
752,
1749,
198,
6738,
279,
2047,
292,
80,
76,
13,
33327,
62,
1073,
14822,
82,
1330,
2824,
62,
1073,
14822,
82,
198,
11748,
850,
14681,
628,
198,
4299,
1388,
33529,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
383,
4165,
25221,
80,
76,
22771,
2163,
869,
13,
1439,
1488,
540,
10007,
460,
307,
198,
220,
220,
220,
1043,
287,
2836,
15414,
13,
9078,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
15003,
1600,
1037,
2625,
36733,
1096,
262,
8619,
329,
25221,
80,
76,
1600,
2223,
2625,
8095,
62,
7942,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
21858,
1600,
1037,
2625,
15,
12,
2833,
11,
352,
12,
80,
76,
2833,
11,
362,
12,
80,
76,
41194,
863,
1600,
4277,
28,
15,
11,
2099,
28,
600,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
2118,
433,
1600,
1037,
2625,
2118,
433,
2230,
11,
657,
329,
717,
1057,
1600,
4277,
28,
15,
11,
2099,
28,
600,
8,
198,
220,
220,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
3419,
628,
220,
220,
220,
611,
26498,
13,
15003,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3670,
62,
4798,
10786,
24243,
2890,
27387,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
32,
1916,
23412,
9220,
25,
45243,
62,
80,
27532,
62,
4131,
13,
259,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
45,
6369,
12740,
23412,
9220,
25,
5128,
13,
344,
261,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
47,
56,
18293,
48,
44,
23412,
9220,
25,
279,
2047,
292,
80,
76,
13,
259,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
5492,
36265,
534,
20435,
2393,
284,
285,
16,
62,
9132,
17,
13,
81,
301,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
5492,
36265,
534,
1582,
76,
4852,
2393,
284,
285,
16,
13,
1050,
76,
4852,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
41216,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
8420,
3419,
628,
220,
220,
220,
2836,
62,
15414,
796,
11787,
20560,
3419,
198,
220,
220,
220,
2836,
62,
15414,
13,
2118,
433,
62,
1078,
1791,
796,
26498,
13,
2118,
433,
628,
220,
220,
220,
611,
26498,
13,
2118,
433,
14512,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
26498,
13,
21858,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2836,
62,
15414,
13,
5143,
62,
2833,
62,
5219,
62,
67,
4989,
873,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
611,
26498,
13,
21858,
1875,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2836,
62,
15414,
13,
5143,
62,
80,
76,
2833,
62,
9535,
752,
1749,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2836,
62,
15414,
13,
5143,
62,
46303,
1159,
62,
43681,
796,
10352,
628,
220,
220,
220,
2656,
62,
15414,
82,
796,
4866,
62,
15414,
82,
3419,
198,
220,
220,
220,
5128,
62,
344,
261,
796,
2251,
62,
15414,
7,
7220,
62,
15414,
8,
628,
220,
220,
220,
923,
62,
2435,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
611,
2836,
62,
15414,
13,
5143,
62,
2833,
62,
5219,
62,
67,
4989,
873,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
3020,
62,
2833,
62,
5219,
62,
67,
4989,
873,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
5143,
62,
80,
76,
2833,
62,
9535,
752,
1749,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
80,
76,
62,
2833,
62,
5219,
62,
9535,
752,
1749,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
5143,
62,
46303,
1159,
62,
45380,
20910,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
46303,
1159,
62,
16184,
1686,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
5143,
62,
46303,
1159,
62,
43681,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
46303,
1159,
62,
43681,
7,
7220,
62,
15414,
8,
198,
220,
220,
220,
611,
815,
62,
525,
687,
62,
79,
9615,
62,
79,
931,
7,
7220,
62,
15414,
11,
26498,
13,
2118,
433,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
79,
9615,
62,
79,
931,
62,
46012,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
611,
815,
62,
525,
687,
62,
79,
9615,
62,
79,
931,
62,
43681,
7,
7220,
62,
15414,
11,
26498,
13,
2118,
433,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
79,
9615,
62,
79,
931,
62,
46012,
62,
43681,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
5143,
62,
41194,
863,
62,
5219,
62,
9535,
752,
1749,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
41194,
863,
62,
5219,
62,
9535,
752,
1749,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
5143,
62,
35522,
48699,
62,
45380,
20910,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
35522,
48699,
62,
16184,
1686,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
5143,
62,
35522,
48699,
62,
43681,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
35522,
48699,
62,
43681,
7,
7220,
62,
15414,
8,
628,
220,
220,
220,
611,
407,
2836,
62,
15414,
13,
271,
62,
71,
14751,
25,
198,
220,
220,
220,
220,
220,
220,
220,
11169,
62,
15414,
82,
7,
14986,
62,
15414,
82,
8,
198,
220,
220,
220,
5128,
62,
344,
261,
13,
13564,
62,
6404,
3419,
628,
220,
220,
220,
886,
62,
2435,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
3601,
7203,
33308,
5201,
287,
4064,
82,
4201,
1,
4064,
357,
437,
62,
2435,
532,
923,
62,
2435,
4008,
628,
198,
4299,
1057,
62,
3020,
62,
2833,
62,
5219,
62,
67,
4989,
873,
7,
9132,
62,
80,
27532,
62,
4131,
11,
2836,
62,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
5660,
262,
2323,
1181,
22942,
326,
481,
307,
973,
284,
7716,
4238,
4903,
908,
1678,
198,
220,
220,
220,
329,
2003,
16765,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3670,
62,
4798,
7203,
12038,
13706,
12,
9012,
4759,
752,
652,
4943,
198,
220,
220,
220,
2323,
9012,
35,
4989,
873,
7,
9132,
62,
80,
27532,
62,
4131,
11,
2836,
62,
15414,
8,
198,
220,
220,
220,
6687,
62,
2118,
433,
7,
15,
11,
2836,
62,
15414,
11,
2836,
62,
15414,
13,
2118,
433,
62,
1078,
1791,
8,
628,
198,
4299,
1057,
62,
80,
76,
62,
2833,
62,
5219,
62,
9535,
752,
1749,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
2735,
356,
765,
284,
1011,
262,
2656,
22942,
47787,
290,
1057,
517,
20134,
1749,
198,
220,
220,
220,
1262,
4738,
11555,
420,
871,
284,
787,
606,
1180,
422,
1123,
584,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3670,
62,
4798,
7203,
48,
44,
13706,
12,
9012,
4759,
752,
1749,
4943,
198,
220,
220,
220,
1195,
76,
35539,
15721,
752,
1749,
7,
7220,
62,
15414,
11,
5128,
62,
344,
261,
737,
5143,
3419,
198,
220,
220,
220,
6687,
62,
2118,
433,
7,
16,
11,
2836,
62,
15414,
11,
2836,
62,
15414,
13,
2118,
433,
62,
1078,
1791,
8,
198,
198,
4299,
1057,
62,
46303,
1159,
62,
16184,
1686,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
7214,
47787,
422,
262,
10662,
76,
2833,
20134,
1749,
15482,
257,
640,
5711,
13,
198,
220,
220,
220,
5660,
2060,
13033,
319,
777,
3013,
6570,
82,
1747,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3670,
62,
4798,
7203,
24849,
273,
1159,
5489,
1686,
4943,
198,
220,
220,
220,
13051,
273,
1159,
16501,
1686,
7,
7220,
62,
15414,
11,
5128,
62,
344,
261,
737,
5143,
3419,
198,
198,
4299,
1057,
62,
46303,
1159,
62,
43681,
7,
7220,
62,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
2547,
325,
262,
5072,
1366,
422,
36505,
329,
24774,
27598,
290,
2251,
257,
5444,
430,
62,
8937,
13,
15414,
198,
220,
220,
220,
2393,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3670,
62,
4798,
7203,
24849,
273,
1159,
23042,
278,
4943,
198,
220,
220,
220,
3551,
62,
4443,
430,
62,
15414,
7,
7220,
62,
15414,
11,
705,
46303,
1159,
11537,
198,
220,
220,
220,
27598,
11,
18929,
796,
651,
62,
877,
70,
444,
62,
392,
62,
301,
918,
456,
912,
10786,
4443,
430,
62,
46303,
1159,
13,
15414,
11537,
198,
220,
220,
220,
3601,
62,
877,
70,
444,
62,
392,
62,
22853,
782,
9998,
7,
877,
70,
444,
11,
18929,
8,
198,
198,
4299,
1057,
62,
41194,
863,
62,
5219,
62,
9535,
752,
1749,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
775,
1011,
262,
2656,
22942,
47787,
290,
1057,
2252,
20134,
1749,
198,
220,
220,
220,
422,
883,
379,
262,
6568,
1181,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3601,
7203,
34635,
34635,
13896,
18162,
25268,
863,
1829,
220,
34635,
34635,
10185,
2474,
8,
198,
220,
220,
220,
1195,
76,
40127,
863,
9012,
15721,
752,
1749,
7,
7220,
62,
15414,
11,
5128,
62,
344,
261,
737,
5143,
3419,
198,
220,
220,
220,
6687,
62,
2118,
433,
7,
17,
11,
2836,
62,
15414,
11,
2836,
62,
15414,
13,
2118,
433,
62,
1078,
1791,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
271,
62,
83,
2132,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2824,
62,
1073,
14822,
82,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
62,
9535,
752,
1749,
28,
7220,
62,
15414,
13,
77,
62,
45380,
20910,
62,
1069,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
62,
2118,
5889,
28,
7220,
62,
15414,
13,
77,
62,
41194,
62,
48381,
532,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
198,
4299,
1057,
62,
35522,
48699,
62,
16184,
1686,
7,
15414,
62,
344,
261,
11,
2836,
62,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
7214,
47787,
422,
262,
10662,
76,
2833,
20134,
1749,
15482,
257,
640,
5711,
13,
198,
220,
220,
220,
5660,
2060,
13033,
319,
777,
3013,
6570,
82,
1747,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3670,
62,
4798,
7203,
37,
2290,
48699,
5489,
1686,
4943,
198,
220,
220,
220,
34070,
48699,
16501,
1686,
7,
7220,
62,
15414,
11,
5128,
62,
344,
261,
737,
5143,
3419,
198,
198,
4299,
1057,
62,
35522,
48699,
62,
43681,
7,
7220,
62,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
2547,
325,
262,
5072,
1366,
422,
36505,
329,
6562,
382,
29734,
27598,
290,
2251,
257,
5444,
430,
62,
35522,
13,
15414,
198,
220,
220,
220,
2393,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
3601,
7203,
34635,
34635,
13896,
23042,
278,
34070,
45166,
3007,
220,
34635,
34635,
10185,
2474,
8,
198,
220,
220,
220,
1303,
12082,
62,
9535,
752,
1749,
7203,
80,
76,
41194,
863,
1600,
2836,
62,
15414,
13,
77,
62,
45380,
20910,
62,
1069,
11,
2836,
62,
15414,
13,
77,
62,
41194,
62,
48381,
8,
198,
220,
220,
220,
2859,
62,
5219,
62,
15003,
796,
2836,
62,
15414,
13,
41194,
62,
5219,
62,
15003,
62,
1069,
62,
17143,
198,
220,
220,
220,
2859,
62,
5219,
62,
22930,
796,
2836,
62,
15414,
13,
77,
62,
41194,
62,
27219,
62,
22930,
37861,
62,
1069,
62,
17143,
198,
220,
220,
220,
299,
62,
785,
16838,
796,
3551,
62,
4443,
430,
62,
35522,
62,
15414,
7,
7220,
62,
15414,
8,
198,
220,
220,
220,
3551,
62,
462,
4908,
62,
14259,
62,
2435,
7,
77,
62,
9535,
752,
1749,
28,
77,
62,
785,
16838,
11,
299,
62,
27219,
28,
41194,
62,
5219,
62,
15003,
8,
198,
220,
220,
220,
611,
2836,
62,
15414,
13,
271,
62,
83,
2132,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3551,
62,
23913,
62,
1073,
14822,
82,
7,
77,
62,
9535,
752,
1749,
28,
7220,
62,
15414,
13,
77,
62,
45380,
20910,
62,
1069,
11,
299,
62,
27219,
28,
41194,
62,
5219,
62,
22930,
8,
198,
198,
28311,
25,
198,
220,
220,
220,
1388,
3419,
198,
16341,
31973,
9492,
3622,
25,
198,
220,
220,
220,
3601,
7203,
1639,
19994,
262,
4905,
4943,
198
] | 2.603715 | 2,584 |
# coding=utf-8
# Development server
from slideatlas import create_app
app = create_app()
# app.run(host='0.0.0.0', port=8080)
if __name__ == "__main__":
print "To run:\ngunicorn run_gunicorn:app -b localhost:8080 -w 4" | [
2,
19617,
28,
40477,
12,
23,
198,
198,
2,
7712,
4382,
198,
6738,
10649,
265,
21921,
1330,
2251,
62,
1324,
198,
1324,
796,
2251,
62,
1324,
3419,
198,
2,
598,
13,
5143,
7,
4774,
11639,
15,
13,
15,
13,
15,
13,
15,
3256,
2493,
28,
1795,
1795,
8,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
3601,
366,
2514,
1057,
7479,
782,
46903,
1211,
1057,
62,
7145,
291,
1211,
25,
1324,
532,
65,
1957,
4774,
25,
1795,
1795,
532,
86,
604,
1
] | 2.488889 | 90 |
import os
import helpers
from compas_fab.backends import RosClient
from compas_fab.robots import PlanningScene
import compas
HERE = os.path.dirname(__file__)
MAX_STEP = 0.01
# Load assembly
filename = os.path.join(HERE, 'assembly.json')
assembly = compas.json_load(filename)
with RosClient() as client:
robot = client.load_robot()
scene = PlanningScene(robot)
# Prepare scene for planning
helpers.attach_vacuum_gripper(scene)
helpers.add_static_objects(scene)
trajectory = robot.plan_cartesian_motion(assembly.pick_t0cf_frames(),
start_configuration=assembly.attributes['home_config'],
options=dict(max_step=MAX_STEP))
if trajectory and trajectory.fraction < 1.0:
raise Exception('Incomplete trajectory. Fraction={}'.format(trajectory.fraction))
assembly.pick_trajectory = trajectory
# Save assembly
compas.json_dump(assembly, filename, pretty=True)
| [
11748,
28686,
198,
198,
11748,
49385,
198,
6738,
552,
292,
62,
36434,
13,
1891,
2412,
1330,
10018,
11792,
198,
6738,
552,
292,
62,
36434,
13,
22609,
1747,
1330,
21913,
36542,
198,
198,
11748,
552,
292,
198,
198,
39,
9338,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
8,
198,
22921,
62,
42135,
796,
657,
13,
486,
198,
198,
2,
8778,
10474,
198,
34345,
796,
28686,
13,
6978,
13,
22179,
7,
39,
9338,
11,
705,
41873,
13,
17752,
11537,
198,
41873,
796,
552,
292,
13,
17752,
62,
2220,
7,
34345,
8,
198,
198,
4480,
10018,
11792,
3419,
355,
5456,
25,
198,
220,
220,
220,
9379,
796,
5456,
13,
2220,
62,
305,
13645,
3419,
198,
220,
220,
220,
3715,
796,
21913,
36542,
7,
305,
13645,
8,
628,
220,
220,
220,
1303,
43426,
3715,
329,
5410,
198,
220,
220,
220,
49385,
13,
47348,
62,
85,
330,
13814,
62,
70,
380,
2848,
7,
29734,
8,
198,
220,
220,
220,
49385,
13,
2860,
62,
12708,
62,
48205,
7,
29734,
8,
628,
220,
220,
220,
22942,
796,
9379,
13,
11578,
62,
26674,
35610,
62,
38714,
7,
41873,
13,
27729,
62,
83,
15,
12993,
62,
37805,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
923,
62,
11250,
3924,
28,
41873,
13,
1078,
7657,
17816,
11195,
62,
11250,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3689,
28,
11600,
7,
9806,
62,
9662,
28,
22921,
62,
42135,
4008,
628,
220,
220,
220,
611,
22942,
290,
22942,
13,
69,
7861,
1279,
352,
13,
15,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
35528,
10786,
818,
20751,
22942,
13,
376,
7861,
34758,
92,
4458,
18982,
7,
9535,
752,
652,
13,
69,
7861,
4008,
628,
220,
220,
220,
10474,
13,
27729,
62,
9535,
752,
652,
796,
22942,
198,
198,
2,
12793,
10474,
198,
5589,
292,
13,
17752,
62,
39455,
7,
41873,
11,
29472,
11,
2495,
28,
17821,
8,
198
] | 2.538462 | 390 |
from __future__ import annotations
import typing as t
import enum
from sqlalchemy import (
Column,
Integer,
String,
ForeignKey,
MetaData,
Table,
JSON,
)
from sqlalchemy.orm import (
relationship,
RelationshipProperty,
)
from ...common.sqlalchemy import (
declarative_base,
RequiredColumn,
OptionalColumn,
RequiredEnumColumn,
)
Base = declarative_base() | [
6738,
11593,
37443,
834,
1330,
37647,
198,
11748,
19720,
355,
256,
198,
11748,
33829,
198,
6738,
44161,
282,
26599,
1330,
357,
198,
220,
220,
220,
29201,
11,
198,
220,
220,
220,
34142,
11,
198,
220,
220,
220,
10903,
11,
198,
220,
220,
220,
8708,
9218,
11,
198,
220,
220,
220,
30277,
6601,
11,
198,
220,
220,
220,
8655,
11,
198,
220,
220,
220,
19449,
11,
198,
8,
198,
198,
6738,
44161,
282,
26599,
13,
579,
1330,
357,
198,
220,
220,
220,
2776,
11,
198,
220,
220,
220,
39771,
21746,
11,
198,
8,
198,
198,
6738,
2644,
11321,
13,
25410,
282,
26599,
1330,
357,
198,
220,
220,
220,
2377,
283,
876,
62,
8692,
11,
198,
220,
220,
220,
20906,
39470,
11,
198,
220,
220,
220,
32233,
39470,
11,
198,
220,
220,
220,
20906,
4834,
388,
39470,
11,
198,
8,
198,
198,
14881,
796,
2377,
283,
876,
62,
8692,
3419
] | 2.75 | 148 |
#!/usr/bin/env python
# Line too long - pylint: disable=C0301
# Invalid name - pylint: disable=C0103
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.
Capture the information regarding gpdb
"""
try:
import sys, time
import traceback
#from generalUtil import GeneralUtil
from gppylib.commands.base import Command
from PSQL import PSQL
#from cdbfastUtil import PrettyPrint
from datetime import datetime
except Exception, e:
sys.exit('Cannot import modules GpdbSegmentConfig. Please check that you have sourced greenplum_path.sh. Detail: ' + str(e))
#####
class GpdbSegmentConfig:
"""
Capture the information regarding Gpdb Segment Configuration
@class GpdbSegmentConfig
@organization: DCD Partner Engineering
@contact: Kenneth Wong
"""
###
def __init__(self):
"""
Constructor for GpdbSegmentConfig
"""
#self.generalUtil = GeneralUtil()
self.psql = PSQL
###
def GetSqlData(self, sql):
"""
Execute the sql statement and returns the data
@param sql: The sql command to execute
@return: data
"""
data = []
# use run_sql_command in SQL instead of run
#(rc, out) = psql.run(dbname='gptest', cmd='%s' % (sql), ofile='-', flag='-q -t')
out = self.psql.run_sql_command(sql_cmd='%s' % (sql), dbname='gptest', out_file='-', flags='-q -t')
for line in out:
line = line.strip()
if line:
data.append(line)
return 0, data
def hasStandbyMaster( self ):
'''
check if a greenplum database has standby master configured
@return: True or False which indicates whether or not the gpdb has standby master configured
'''
cmd = 'SELECT CASE WHEN count(*) > 0 THEN \'True\' ELSE \'False\' END AS hasstandby FROM pg_catalog.gp_segment_configuration WHERE content = -1 AND role = \'m\';'
# use run_sql_command in SQL instead of runcmd
#( ok, out ) = psql.runcmd( cmd )
out = self.psql.run_sql_command(sql_cmd='%s' % (cmd), out_file='-', flags='-t -q')
#if not ok:
if out and out[0].strip() == 'True':
return True
else:
return False
def hasMirrors( self ):
'''
check if a greenplum database has mirrors configured
@return: True or False which indicates whether or not the gpdb has mirrors configured
'''
cmd = 'SELECT CASE WHEN count(*) > 0 THEN \'True\' ELSE \'False\' END AS hasstandby FROM pg_catalog.gp_segment_configuration WHERE content > -1 AND role = \'m\';'
# use run_sql_command in SQL instead of runcmd
#( ok, out ) = psql.runcmd( cmd )
out = self.psql.run_sql_command(sql_cmd='%s' % (cmd), out_file='-', flags='-t -q')
if out.strip() == 'True':
return True
else:
return False
###
def GetSegmentInvalidCount(self):
"""
@return: Number of invalid segment servers
"""
"""
"""
cmd = "psql gptest -c 'SET search_path To public,gp_toolkit; SELECT COUNT(*) as invalid FROM gp_pgdatabase_invalid' | sed -n '3,3 s/^[ ]*//p'"
# use Command instead of ShellCommand
#rc, data = self.generalUtil.ShellCommand("psql gptest -c 'SET search_path To public,gp_toolkit; SELECT COUNT(*) as invalid FROM gp_pgdatabase_invalid' | sed -n '3,3 s/^[ ]*//p'")
generalUtil = Command(name='psql gptest -c',cmdStr=cmd)
generalUtil.run()
rc = generalUtil.get_results().rc
if rc != 0:
raise Exception("psql gptest -c failed with rc: (%d)" % (rc))
data = generalUtil.get_results().stdout
#segmentInvalidCount = data[0].strip()
segmentInvalidCount = data.strip()
return rc, segmentInvalidCount
###
def GetSegmentInSync(self, sleepTime=60, repeatCnt=120, greenplum_path=""):
"""
@param sleepTime: Number of seconds to sleep before retry
@param repeatCnt: Number of times to repeat retry. Default is 2 hours
@return: Return True when the number of segment servers that are in resync is 0 rows
"""
inSync = ""
for cnt in range(repeatCnt):
data = ""
try:
cmd = "psql gptest -c \"SELECT dbid, content, role, preferred_role, status, mode, address, fselocation, port, replication_port FROM gp_segment_configuration, pg_filespace_entry where dbid = fsedbid and mode = 'r'\""
if greenplum_path:
cmd = "%s %s" % (greenplum_path, cmd)
# use Command instead of ShellCommand
#rc, data = self.generalUtil.ShellCommand(cmd)
generalUtil = Command(name='psql gptest -c',cmdStr=cmd)
generalUtil.run()
rc = generalUtil.get_results().rc
data = generalUtil.get_results().stdout
if rc == 0:
if True in ['(0 rows)' in x for x in data]:
return rc, True
time.sleep(sleepTime)
except Exception, e:
traceback.print_exc()
print "ERRORFOUND GetSegmentInSync %s" % (str(e))
#PrettyPrint('ERRORFOUND GetSegmentInSync', data) TODO
print 'ERRORFOUND GetSegmentInSync', data
return 0, False
###
def GetServerList(self, role='p', status='u'):
"""
@param role: Supported role are 'p' and 'm'
@param status: Supported status are 'u' and 'd'
@return: list of hostname
"""
cmd = "SELECT hostname FROM gp_segment_configuration WHERE content != -1 AND role = '%s' AND status = '%s'" % (role, status)
(rc, data) = self.GetSqlData(cmd)
return rc, data
###
def GetMasterHost(self, role='p', status='u'):
"""
@param role: Supported role are 'p' and 'm'
@param status: Supported status are 'u' and 'd'
@return: master hostname
"""
cmd = "SELECT hostname FROM gp_segment_configuration WHERE content = -1 AND role = '%s' AND status = '%s'" % (role, status)
(rc, data) = self.GetSqlData(cmd)
if data:
data = data[0]
data = data.strip()
else:
data = None
return rc, data
###
def GetMasterStandbyHost(self, status='u'):
"""
@param status: Supported status are 'u' and 'd'
@return: Master-standby hostname
"""
rc, data = self.GetMasterHost('m', status)
return rc, data
###
def GetUpServerList(self, role='p'):
"""
@param role: Supported role are 'p' and 'm'
@return: list of segment server that are up
"""
serverList = self.GetServerList(role, "u")
return serverList
###
def GetDownServerList(self, role='m'):
"""
@param role: Supported role are 'p' and 'm'
@return: list of segment server that are down
"""
rc, serverList = self.GetServerList(role, "d")
return rc, serverList
###
def GetSegmentServerCount(self, role='p', status='u'):
"""
@param role: Supported role are 'p' and 'm'
@param status: Supported status are 'u' and 'd'
@return: Segment server count
"""
rc, serverList = self.GetServerList(role, status)
return rc, len(serverList)
###
def GetHostAndPort(self, content, role='p', status='u'):
"""
Returns the list of segment server that are up or down depending on mode
@param role: Supported role are 'p' and 'm'
@param status: Supported status are 'u' and 'd'
@return: hostname and port
"""
cmd = "SELECT hostname, port FROM gp_segment_configuration WHERE content = %s AND role = '%s' AND status = '%s'" % (content, role, status)
(rc, data) = self.GetSqlData(cmd)
if data:
host, port = data[0].split('|')
return rc, host.strip(), port.strip()
else:
return rc, "", ""
###
def GetContentIdList(self, role='p', status='u'):
"""
Returns the list of segment server content ID for the primary or mirror depending on role in content assending order
@param role: Supported role are 'p' and 'm'
@return: content list
"""
contentList = []
cmd = "SELECT content FROM gp_segment_configuration WHERE content != -1 AND role = '%s' AND status = '%s' ORDER BY content" % (role, status)
out = self.psql.run_sql_command(sql_cmd='%s' % (cmd), dbname='gptest',out_file='-', flags='-q -t')
#TODO
for line in out:
line = line.strip()
if line:
contentList.append(line)
return contentList
###
def GetPrimaryContentIdList(self, status):
"""
Returns the list of primary segment server content ID that are up or down depending on mode in assending order
@param status: Supported mode are 'u' and 'd'
@return: content list of primary segment server
"""
rc, contentList = self.GetContentIdList("p", status)
return rc, contentList
###
def GetMirrorContentIdList(self, status):
"""
Returns the list of mirror segment server content ID that are up or down depending on mode in assending order
@param status: Supported status are 'u' and 'd'
@return: content list of mirror segment server
"""
rc, contentList = self.GetContentIdList("m", status)
return rc, contentList
###
def GetMasterDataDirectory(self):
"""
@return: master data directory
"""
cmd = "SELECT fselocation as datadir FROM gp_segment_configuration, pg_filespace_entry, pg_catalog.pg_filespace fs WHERE fsefsoid = fs.oid and fsname='pg_system' and gp_segment_configuration.dbid=pg_filespace_entry.fsedbid AND content = -1 AND role = 'p' ORDER BY content, preferred_role"
out = self.psql.run_sql_command(sql_cmd='%s' % (cmd),dbname='gptest', out_file='-', flags='-q -t')
datadir = out
datadir = datadir.strip()
return datadir
###
def GetSegmentData(self, myContentId, myRole='p', myStatus='u'):
"""
Returns the list of segment information that matches the content id, role and status
@param myContentId:
@param myRole: Either 'p' or 'm'
@param myStatus: Either 'u' or 'd'
@return: hostname, port, datadir address and status
"""
segmentData = []
cmd = "SELECT dbid, content, role, preferred_role, mode, status, hostname, address, port, fselocation as datadir, replication_port FROM gp_segment_configuration, pg_filespace_entry, pg_catalog.pg_filespace fs WHERE fsefsoid = fs.oid and fsname='pg_system' and gp_segment_configuration.dbid=pg_filespace_entry.fsedbid ORDER BY content, preferred_role"
#(rc, out) = psql.run(dbname='gptest', cmd='%s' % (cmd), ofile='-', flag='-q -t')
out = self.psql.run_sql_command(sql_cmd='%s' % (cmd),dbname='gptest',out_file='-', flags='-t -q')
for line in out:
if line:
data = {}
# Check for valid data
if len(line) > 10:
(dbid, content, role, preferred_role, mode, status, hostname, address, port, datadir, replication_port) = line.split('|')
content = content.strip()
role = role.strip()
status = status.strip()
if int(content) == int(myContentId) and role == myRole and status == myStatus:
data['content'] = content
data['hostname'] = hostname.strip()
data['port'] = port.strip()
data['datadir'] = datadir.strip()
data['status'] = status.strip()
data['role'] = role.strip()
data['preferred_role'] = preferred_role.strip()
data['address'] = address.strip()
segmentData.append(data)
return segmentData
if __name__ == '__main__':
gpdbSegmentConfig = GpdbSegmentConfig()
gpdbSegmentConfig.GetSegmentInvalidCount()
x, y = gpdbSegmentConfig.GetSegmentInSync()
print "x %s y %s" % (x, y)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
6910,
1165,
890,
532,
279,
2645,
600,
25,
15560,
28,
34,
3070,
486,
198,
2,
17665,
1438,
220,
532,
279,
2645,
600,
25,
15560,
28,
34,
486,
3070,
198,
198,
37811,
198,
15269,
357,
66,
8,
5472,
12,
34695,
350,
452,
4997,
10442,
11,
3457,
13,
198,
198,
1212,
1430,
290,
262,
19249,
5696,
389,
925,
1695,
739,
198,
1169,
2846,
286,
262,
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,
198,
198,
4023,
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,
198,
49630,
262,
1321,
5115,
27809,
9945,
198,
37811,
198,
198,
28311,
25,
198,
220,
220,
220,
1330,
25064,
11,
640,
198,
220,
220,
220,
1330,
12854,
1891,
198,
220,
220,
220,
1303,
6738,
2276,
18274,
346,
1330,
3611,
18274,
346,
198,
220,
220,
220,
422,
308,
381,
2645,
571,
13,
9503,
1746,
13,
8692,
1330,
9455,
198,
220,
220,
220,
422,
6599,
9711,
1330,
6599,
9711,
198,
220,
220,
220,
1303,
6738,
269,
9945,
7217,
18274,
346,
1330,
20090,
18557,
198,
220,
220,
220,
422,
4818,
8079,
1330,
4818,
8079,
198,
16341,
35528,
11,
304,
25,
198,
220,
220,
220,
25064,
13,
37023,
10786,
34,
34574,
1330,
13103,
402,
79,
9945,
41030,
434,
16934,
13,
220,
4222,
2198,
326,
345,
423,
18229,
4077,
489,
388,
62,
6978,
13,
1477,
13,
220,
42585,
25,
705,
1343,
965,
7,
68,
4008,
198,
198,
4242,
2,
198,
4871,
402,
79,
9945,
41030,
434,
16934,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
31793,
262,
1321,
5115,
402,
79,
9945,
1001,
5154,
28373,
198,
220,
220,
220,
2488,
4871,
402,
79,
9945,
41030,
434,
16934,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
9971,
1634,
25,
6257,
35,
35532,
14044,
198,
220,
220,
220,
2488,
32057,
25,
23632,
27247,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
28407,
273,
329,
402,
79,
9945,
41030,
434,
16934,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
944,
13,
24622,
18274,
346,
796,
3611,
18274,
346,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
862,
13976,
796,
6599,
9711,
198,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
50,
13976,
6601,
7,
944,
11,
44161,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8393,
1133,
262,
44161,
2643,
290,
5860,
262,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
44161,
25,
383,
44161,
3141,
284,
12260,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
1057,
62,
25410,
62,
21812,
287,
16363,
2427,
286,
1057,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7,
6015,
11,
503,
8,
796,
279,
25410,
13,
5143,
7,
9945,
3672,
11639,
70,
457,
395,
3256,
23991,
11639,
4,
82,
6,
4064,
357,
25410,
828,
286,
576,
11639,
12,
3256,
6056,
11639,
12,
80,
532,
83,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2116,
13,
862,
13976,
13,
5143,
62,
25410,
62,
21812,
7,
25410,
62,
28758,
11639,
4,
82,
6,
4064,
357,
25410,
828,
20613,
3672,
11639,
70,
457,
395,
3256,
503,
62,
7753,
11639,
12,
3256,
9701,
11639,
12,
80,
532,
83,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
503,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
1627,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
11,
1366,
628,
220,
220,
220,
825,
468,
15480,
1525,
18254,
7,
2116,
15179,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
611,
257,
4077,
489,
388,
6831,
468,
42020,
4958,
17839,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
6407,
393,
10352,
543,
9217,
1771,
393,
407,
262,
27809,
9945,
468,
42020,
4958,
17839,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
705,
46506,
42001,
42099,
954,
7,
28104,
1875,
657,
42243,
34373,
17821,
43054,
17852,
5188,
34373,
25101,
43054,
23578,
7054,
468,
1481,
1525,
16034,
23241,
62,
9246,
11794,
13,
31197,
62,
325,
5154,
62,
11250,
3924,
33411,
2695,
796,
532,
16,
5357,
2597,
796,
34373,
76,
59,
17020,
6,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
1057,
62,
25410,
62,
21812,
287,
16363,
2427,
286,
1057,
28758,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7,
12876,
11,
503,
1267,
796,
279,
25410,
13,
5143,
28758,
7,
23991,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2116,
13,
862,
13976,
13,
5143,
62,
25410,
62,
21812,
7,
25410,
62,
28758,
11639,
4,
82,
6,
4064,
357,
28758,
828,
503,
62,
7753,
11639,
12,
3256,
9701,
11639,
12,
83,
532,
80,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
361,
407,
12876,
25,
628,
220,
220,
220,
220,
220,
220,
220,
611,
503,
290,
503,
58,
15,
4083,
36311,
3419,
6624,
705,
17821,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
628,
220,
220,
220,
825,
468,
27453,
5965,
7,
2116,
15179,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
611,
257,
4077,
489,
388,
6831,
468,
22353,
17839,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
6407,
393,
10352,
543,
9217,
1771,
393,
407,
262,
27809,
9945,
468,
22353,
17839,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
705,
46506,
42001,
42099,
954,
7,
28104,
1875,
657,
42243,
34373,
17821,
43054,
17852,
5188,
34373,
25101,
43054,
23578,
7054,
468,
1481,
1525,
16034,
23241,
62,
9246,
11794,
13,
31197,
62,
325,
5154,
62,
11250,
3924,
33411,
2695,
1875,
532,
16,
5357,
2597,
796,
34373,
76,
59,
17020,
6,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
1057,
62,
25410,
62,
21812,
287,
16363,
2427,
286,
1057,
28758,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7,
12876,
11,
503,
1267,
796,
279,
25410,
13,
5143,
28758,
7,
23991,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2116,
13,
862,
13976,
13,
5143,
62,
25410,
62,
21812,
7,
25410,
62,
28758,
11639,
4,
82,
6,
4064,
357,
28758,
828,
503,
62,
7753,
11639,
12,
3256,
9701,
11639,
12,
83,
532,
80,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
611,
503,
13,
36311,
3419,
6624,
705,
17821,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
41030,
434,
44651,
12332,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
7913,
286,
12515,
10618,
9597,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
862,
13976,
308,
457,
395,
532,
66,
705,
28480,
2989,
62,
6978,
1675,
1171,
11,
31197,
62,
25981,
15813,
26,
33493,
327,
28270,
7,
28104,
355,
12515,
16034,
27809,
62,
6024,
48806,
62,
259,
12102,
6,
930,
10081,
532,
77,
705,
18,
11,
18,
264,
14,
61,
58,
220,
220,
220,
220,
2361,
9,
1003,
79,
29653,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
9455,
2427,
286,
17537,
21575,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6015,
11,
1366,
796,
2116,
13,
24622,
18274,
346,
13,
23248,
21575,
7203,
862,
13976,
308,
457,
395,
532,
66,
705,
28480,
2989,
62,
6978,
1675,
1171,
11,
31197,
62,
25981,
15813,
26,
33493,
327,
28270,
7,
28104,
355,
12515,
16034,
27809,
62,
6024,
48806,
62,
259,
12102,
6,
930,
10081,
532,
77,
705,
18,
11,
18,
264,
14,
61,
58,
220,
220,
220,
220,
2361,
9,
1003,
79,
6,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2276,
18274,
346,
796,
9455,
7,
3672,
11639,
862,
13976,
308,
457,
395,
532,
66,
3256,
28758,
13290,
28,
28758,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2276,
18274,
346,
13,
5143,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
48321,
796,
2276,
18274,
346,
13,
1136,
62,
43420,
22446,
6015,
198,
220,
220,
220,
220,
220,
220,
220,
611,
48321,
14512,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
35528,
7203,
862,
13976,
308,
457,
395,
532,
66,
4054,
351,
48321,
25,
220,
37633,
67,
16725,
4064,
357,
6015,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
2276,
18274,
346,
13,
1136,
62,
43420,
22446,
19282,
448,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
325,
5154,
44651,
12332,
796,
1366,
58,
15,
4083,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
10618,
44651,
12332,
796,
1366,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
10618,
44651,
12332,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
41030,
434,
818,
28985,
7,
944,
11,
3993,
7575,
28,
1899,
11,
9585,
34,
429,
28,
10232,
11,
4077,
489,
388,
62,
6978,
33151,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3993,
7575,
25,
7913,
286,
4201,
284,
3993,
878,
1005,
563,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
9585,
34,
429,
25,
7913,
286,
1661,
284,
9585,
1005,
563,
13,
15161,
318,
362,
2250,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
8229,
6407,
618,
262,
1271,
286,
10618,
9597,
326,
389,
287,
581,
13361,
318,
657,
15274,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
287,
28985,
796,
13538,
198,
220,
220,
220,
220,
220,
220,
220,
329,
269,
429,
287,
2837,
7,
44754,
34,
429,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
13538,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
862,
13976,
308,
457,
395,
532,
66,
19990,
46506,
288,
14065,
11,
2695,
11,
2597,
11,
9871,
62,
18090,
11,
3722,
11,
4235,
11,
2209,
11,
277,
741,
5040,
11,
2493,
11,
30330,
62,
634,
16034,
27809,
62,
325,
5154,
62,
11250,
3924,
11,
23241,
62,
16624,
10223,
62,
13000,
810,
288,
14065,
796,
277,
36622,
14065,
290,
4235,
796,
705,
81,
6,
7879,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4077,
489,
388,
62,
6978,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
36521,
82,
4064,
82,
1,
4064,
357,
14809,
489,
388,
62,
6978,
11,
23991,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
9455,
2427,
286,
17537,
21575,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6015,
11,
1366,
796,
2116,
13,
24622,
18274,
346,
13,
23248,
21575,
7,
28758,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2276,
18274,
346,
796,
9455,
7,
3672,
11639,
862,
13976,
308,
457,
395,
532,
66,
3256,
28758,
13290,
28,
28758,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2276,
18274,
346,
13,
5143,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
48321,
796,
2276,
18274,
346,
13,
1136,
62,
43420,
22446,
6015,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
2276,
18274,
346,
13,
1136,
62,
43420,
22446,
19282,
448,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
48321,
6624,
657,
25,
198,
197,
197,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6407,
287,
37250,
7,
15,
15274,
33047,
287,
2124,
329,
2124,
287,
1366,
5974,
198,
197,
197,
197,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
640,
13,
42832,
7,
42832,
7575,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
11,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12854,
1891,
13,
4798,
62,
41194,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
366,
24908,
37,
15919,
3497,
41030,
434,
818,
28985,
4064,
82,
1,
4064,
357,
2536,
7,
68,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
35700,
18557,
10786,
24908,
37,
15919,
3497,
41030,
434,
818,
28985,
3256,
1366,
8,
16926,
46,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
705,
24908,
37,
15919,
3497,
41030,
434,
818,
28985,
3256,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
11,
10352,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
10697,
8053,
7,
944,
11,
2597,
11639,
79,
3256,
3722,
11639,
84,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
2597,
25,
36848,
2597,
389,
705,
79,
6,
290,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3722,
25,
36848,
3722,
389,
705,
84,
6,
290,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
1351,
286,
2583,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
46506,
2583,
3672,
16034,
27809,
62,
325,
5154,
62,
11250,
3924,
33411,
2695,
14512,
532,
16,
5357,
2597,
796,
705,
4,
82,
6,
5357,
3722,
796,
705,
4,
82,
29653,
4064,
357,
18090,
11,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
357,
6015,
11,
1366,
8,
796,
2116,
13,
3855,
50,
13976,
6601,
7,
28758,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
1366,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
18254,
17932,
7,
944,
11,
2597,
11639,
79,
3256,
3722,
11639,
84,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
2597,
25,
36848,
2597,
389,
705,
79,
6,
290,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3722,
25,
36848,
3722,
389,
705,
84,
6,
290,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
4958,
2583,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
46506,
2583,
3672,
16034,
27809,
62,
325,
5154,
62,
11250,
3924,
33411,
2695,
796,
532,
16,
5357,
2597,
796,
705,
4,
82,
6,
5357,
3722,
796,
705,
4,
82,
29653,
4064,
357,
18090,
11,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
357,
6015,
11,
1366,
8,
796,
2116,
13,
3855,
50,
13976,
6601,
7,
28758,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1366,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1366,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1366,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
1366,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
18254,
15480,
1525,
17932,
7,
944,
11,
3722,
11639,
84,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3722,
25,
36848,
3722,
389,
705,
84,
6,
290,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
5599,
12,
1481,
1525,
2583,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
48321,
11,
1366,
796,
2116,
13,
3855,
18254,
17932,
10786,
76,
3256,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
1366,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
4933,
10697,
8053,
7,
944,
11,
2597,
11639,
79,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
2597,
25,
36848,
2597,
389,
705,
79,
6,
290,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
1351,
286,
10618,
4382,
326,
389,
510,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4382,
8053,
796,
2116,
13,
3855,
10697,
8053,
7,
18090,
11,
366,
84,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4382,
8053,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
8048,
10697,
8053,
7,
944,
11,
2597,
11639,
76,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
2597,
25,
36848,
2597,
389,
705,
79,
6,
290,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
1351,
286,
10618,
4382,
326,
389,
866,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
48321,
11,
4382,
8053,
796,
2116,
13,
3855,
10697,
8053,
7,
18090,
11,
366,
67,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
4382,
8053,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
41030,
434,
10697,
12332,
7,
944,
11,
2597,
11639,
79,
3256,
3722,
11639,
84,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
2597,
25,
36848,
2597,
389,
705,
79,
6,
290,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3722,
25,
36848,
3722,
389,
705,
84,
6,
290,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
1001,
5154,
4382,
954,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
48321,
11,
4382,
8053,
796,
2116,
13,
3855,
10697,
8053,
7,
18090,
11,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
18896,
7,
15388,
8053,
8,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
17932,
1870,
13924,
7,
944,
11,
2695,
11,
2597,
11639,
79,
3256,
3722,
11639,
84,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
1351,
286,
10618,
4382,
326,
389,
510,
393,
866,
6906,
319,
4235,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
2597,
25,
36848,
2597,
389,
705,
79,
6,
290,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3722,
25,
36848,
3722,
389,
705,
84,
6,
290,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
2583,
3672,
290,
2493,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
46506,
2583,
3672,
11,
2493,
16034,
27809,
62,
325,
5154,
62,
11250,
3924,
33411,
2695,
796,
4064,
82,
5357,
2597,
796,
705,
4,
82,
6,
5357,
3722,
796,
705,
4,
82,
29653,
4064,
357,
11299,
11,
2597,
11,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
357,
6015,
11,
1366,
8,
796,
2116,
13,
3855,
50,
13976,
6601,
7,
28758,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1366,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2583,
11,
2493,
796,
1366,
58,
15,
4083,
35312,
10786,
91,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
2583,
13,
36311,
22784,
2493,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
366,
1600,
13538,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
19746,
7390,
8053,
7,
944,
11,
2597,
11639,
79,
3256,
3722,
11639,
84,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
1351,
286,
10618,
4382,
2695,
4522,
220,
329,
262,
4165,
393,
10162,
6906,
319,
2597,
287,
2695,
840,
1571,
1502,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
2597,
25,
36848,
2597,
389,
705,
79,
6,
290,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
2695,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2695,
8053,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
46506,
2695,
16034,
27809,
62,
325,
5154,
62,
11250,
3924,
33411,
2695,
14512,
532,
16,
5357,
2597,
796,
705,
4,
82,
6,
5357,
3722,
796,
705,
4,
82,
6,
38678,
11050,
2695,
1,
4064,
357,
18090,
11,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2116,
13,
862,
13976,
13,
5143,
62,
25410,
62,
21812,
7,
25410,
62,
28758,
11639,
4,
82,
6,
4064,
357,
28758,
828,
20613,
3672,
11639,
70,
457,
395,
3256,
448,
62,
7753,
11639,
12,
3256,
9701,
11639,
12,
80,
532,
83,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
51,
3727,
46,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
503,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
1627,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
8053,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2695,
8053,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
35170,
19746,
7390,
8053,
7,
944,
11,
3722,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
1351,
286,
4165,
10618,
4382,
2695,
4522,
326,
389,
510,
393,
866,
6906,
319,
4235,
287,
840,
1571,
1502,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3722,
25,
36848,
4235,
389,
705,
84,
6,
290,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
2695,
1351,
286,
4165,
10618,
4382,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
48321,
11,
2695,
8053,
796,
2116,
13,
3855,
19746,
7390,
8053,
7203,
79,
1600,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
2695,
8053,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
27453,
1472,
19746,
7390,
8053,
7,
944,
11,
3722,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
1351,
286,
10162,
10618,
4382,
2695,
4522,
326,
389,
510,
393,
866,
6906,
319,
4235,
287,
840,
1571,
1502,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
3722,
25,
36848,
3722,
389,
705,
84,
6,
290,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
2695,
1351,
286,
10162,
10618,
4382,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
48321,
11,
2695,
8053,
796,
2116,
13,
3855,
19746,
7390,
8053,
7203,
76,
1600,
3722,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
48321,
11,
2695,
8053,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
18254,
6601,
43055,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
4958,
1366,
8619,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
46506,
277,
741,
5040,
355,
4818,
324,
343,
16034,
27809,
62,
325,
5154,
62,
11250,
3924,
11,
23241,
62,
16624,
10223,
62,
13000,
11,
23241,
62,
9246,
11794,
13,
6024,
62,
16624,
10223,
43458,
33411,
277,
325,
69,
568,
312,
796,
43458,
13,
1868,
290,
43458,
3672,
11639,
6024,
62,
10057,
6,
290,
27809,
62,
325,
5154,
62,
11250,
3924,
13,
9945,
312,
28,
6024,
62,
16624,
10223,
62,
13000,
13,
9501,
276,
14065,
5357,
2695,
796,
532,
16,
5357,
2597,
796,
705,
79,
6,
38678,
11050,
2695,
11,
9871,
62,
18090,
1,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2116,
13,
862,
13976,
13,
5143,
62,
25410,
62,
21812,
7,
25410,
62,
28758,
11639,
4,
82,
6,
4064,
357,
28758,
828,
9945,
3672,
11639,
70,
457,
395,
3256,
503,
62,
7753,
11639,
12,
3256,
9701,
11639,
12,
80,
532,
83,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
4818,
324,
343,
796,
503,
198,
220,
220,
220,
220,
220,
220,
220,
4818,
324,
343,
796,
4818,
324,
343,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4818,
324,
343,
628,
220,
220,
220,
44386,
198,
220,
220,
220,
825,
3497,
41030,
434,
6601,
7,
944,
11,
616,
19746,
7390,
11,
616,
47445,
11639,
79,
3256,
616,
19580,
11639,
84,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
262,
1351,
286,
10618,
1321,
326,
7466,
262,
2695,
4686,
11,
2597,
290,
3722,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
616,
19746,
7390,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
616,
47445,
25,
15467,
705,
79,
6,
393,
705,
76,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
17143,
616,
19580,
25,
15467,
705,
84,
6,
393,
705,
67,
6,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7783,
25,
2583,
3672,
11,
2493,
11,
4818,
324,
343,
2209,
290,
3722,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10618,
6601,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
366,
46506,
288,
14065,
11,
2695,
11,
2597,
11,
9871,
62,
18090,
11,
4235,
11,
3722,
11,
2583,
3672,
11,
2209,
11,
2493,
11,
277,
741,
5040,
355,
4818,
324,
343,
11,
30330,
62,
634,
16034,
27809,
62,
325,
5154,
62,
11250,
3924,
11,
23241,
62,
16624,
10223,
62,
13000,
11,
23241,
62,
9246,
11794,
13,
6024,
62,
16624,
10223,
43458,
33411,
277,
325,
69,
568,
312,
796,
43458,
13,
1868,
290,
43458,
3672,
11639,
6024,
62,
10057,
6,
290,
27809,
62,
325,
5154,
62,
11250,
3924,
13,
9945,
312,
28,
6024,
62,
16624,
10223,
62,
13000,
13,
9501,
276,
14065,
38678,
11050,
2695,
11,
9871,
62,
18090,
1,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7,
6015,
11,
503,
8,
796,
279,
25410,
13,
5143,
7,
9945,
3672,
11639,
70,
457,
395,
3256,
23991,
11639,
4,
82,
6,
4064,
357,
28758,
828,
286,
576,
11639,
12,
3256,
6056,
11639,
12,
80,
532,
83,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2116,
13,
862,
13976,
13,
5143,
62,
25410,
62,
21812,
7,
25410,
62,
28758,
11639,
4,
82,
6,
4064,
357,
28758,
828,
9945,
3672,
11639,
70,
457,
395,
3256,
448,
62,
7753,
11639,
12,
3256,
9701,
11639,
12,
83,
532,
80,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
503,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
329,
4938,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
1370,
8,
1875,
838,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
9945,
312,
11,
2695,
11,
2597,
11,
9871,
62,
18090,
11,
4235,
11,
3722,
11,
2583,
3672,
11,
2209,
11,
2493,
11,
4818,
324,
343,
11,
30330,
62,
634,
8,
796,
1627,
13,
35312,
10786,
91,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
796,
2695,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2597,
796,
2597,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3722,
796,
3722,
13,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
493,
7,
11299,
8,
6624,
493,
7,
1820,
19746,
7390,
8,
290,
2597,
6624,
616,
47445,
290,
3722,
6624,
616,
19580,
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,
1366,
17816,
11299,
20520,
796,
2695,
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,
17816,
4774,
3672,
20520,
796,
2583,
3672,
13,
36311,
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,
1366,
17816,
634,
20520,
796,
2493,
13,
36311,
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,
1366,
17816,
19608,
324,
343,
20520,
796,
4818,
324,
343,
13,
36311,
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,
1366,
17816,
13376,
20520,
796,
3722,
13,
36311,
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,
1366,
17816,
18090,
20520,
796,
2597,
13,
36311,
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,
1366,
17816,
3866,
18186,
62,
18090,
20520,
796,
9871,
62,
18090,
13,
36311,
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,
1366,
17816,
21975,
20520,
796,
2209,
13,
36311,
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,
10618,
6601,
13,
33295,
7,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10618,
6601,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
27809,
9945,
41030,
434,
16934,
796,
402,
79,
9945,
41030,
434,
16934,
3419,
198,
220,
220,
220,
27809,
9945,
41030,
434,
16934,
13,
3855,
41030,
434,
44651,
12332,
3419,
198,
220,
220,
220,
2124,
11,
331,
796,
27809,
9945,
41030,
434,
16934,
13,
3855,
41030,
434,
818,
28985,
3419,
198,
220,
220,
220,
3601,
366,
87,
4064,
82,
331,
4064,
82,
1,
4064,
357,
87,
11,
331,
8,
198
] | 2.322037 | 5,636 |
import os
import csv
total_months=0
total=0
last_pl=0
average_change=0
change_in_pl=0
total_change=0
ginc_profits=0
gdec_profits=0
prev_change_in_pl=0
ginc_profits_month=""
gdec_profits_month=""
csvpath=os.path.join("..", "Resources", "budget_data.csv")
with open (csvpath, newline="") as csvfile:
csvreader=csv.reader(csvfile, delimiter=",")
csv_header=next(csvreader)
print("csv_header", csv_header)
for row in csvreader:
month=row[0]
total_months=total_months+1
total = total + int(row[1])
if total_months >1:
change_in_pl=int(row[1])-last_pl
total_change+=change_in_pl
average_change=total_change/(total_months-1)
last_pl=int(row[1])
if change_in_pl>ginc_profits:
ginc_profits=change_in_pl
ginc_profits_month=month
elif change_in_pl<gdec_profits:
gdec_profits=change_in_pl
gdec_profits_month=month
print ("Financial Analysis")
print ("-------------------------------------")
print(f'Total Months: {total_months}')
print(f'Total: ${total}')
print(f'Average Change: ${average_change}')
print(f'Greatest Increase in Profits: {ginc_profits_month} ($ {ginc_profits})')
print(f'Greatest Decrease in Profits: {gdec_profits_month} ($ {gdec_profits})')
output= open("budget_data_output.txt","w+")
output.write("Financial Analysis \n")
output.write("------------------------------------- \n")
output.write(f'Total Months: {total_months}' + "\n")
output.write(f'Total: ${total}'+ "\n")
output.write(f'Average Change: ${average_change}'+ "\n")
output.write(f'Greatest Increase in Profits: {ginc_profits_month} ($ {ginc_profits})'+ "\n")
output.write(f'Greatest Decrease in Profits: {gdec_profits_month} ($ {gdec_profits})'+ "\n")
output.close() | [
11748,
28686,
198,
11748,
269,
21370,
198,
198,
23350,
62,
41537,
28,
15,
198,
23350,
28,
15,
198,
12957,
62,
489,
28,
15,
198,
23913,
62,
3803,
28,
15,
198,
3803,
62,
259,
62,
489,
28,
15,
198,
23350,
62,
3803,
28,
15,
198,
1655,
66,
62,
31504,
28,
15,
198,
70,
12501,
62,
31504,
28,
15,
198,
47050,
62,
3803,
62,
259,
62,
489,
28,
15,
198,
1655,
66,
62,
31504,
62,
8424,
33151,
198,
70,
12501,
62,
31504,
62,
8424,
33151,
198,
198,
40664,
6978,
28,
418,
13,
6978,
13,
22179,
7203,
492,
1600,
366,
33236,
1600,
366,
37315,
62,
7890,
13,
40664,
4943,
198,
198,
4480,
1280,
357,
40664,
6978,
11,
649,
1370,
2625,
4943,
355,
269,
21370,
7753,
25,
198,
220,
220,
220,
220,
198,
220,
220,
220,
269,
21370,
46862,
28,
40664,
13,
46862,
7,
40664,
7753,
11,
46728,
2676,
28,
2430,
8,
198,
220,
220,
220,
269,
21370,
62,
25677,
28,
19545,
7,
40664,
46862,
8,
198,
220,
220,
220,
3601,
7203,
40664,
62,
25677,
1600,
269,
21370,
62,
25677,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
329,
5752,
287,
269,
21370,
46862,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1227,
28,
808,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
41537,
28,
23350,
62,
41537,
10,
16,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
796,
2472,
1343,
493,
7,
808,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2472,
62,
41537,
1875,
16,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1487,
62,
259,
62,
489,
28,
600,
7,
808,
58,
16,
12962,
12,
12957,
62,
489,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
3803,
47932,
3803,
62,
259,
62,
489,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2811,
62,
3803,
28,
23350,
62,
3803,
29006,
23350,
62,
41537,
12,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
938,
62,
489,
28,
600,
7,
808,
58,
16,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
611,
220,
1487,
62,
259,
62,
489,
29,
1655,
66,
62,
31504,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
1939,
62,
31504,
28,
3803,
62,
259,
62,
489,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
1939,
62,
31504,
62,
8424,
28,
8424,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1487,
62,
259,
62,
489,
27,
70,
12501,
62,
31504,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
12501,
62,
31504,
28,
3803,
62,
259,
62,
489,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
12501,
62,
31504,
62,
8424,
28,
8424,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
4798,
5855,
43621,
14691,
4943,
198,
4798,
5855,
3880,
30934,
4943,
198,
4798,
7,
69,
6,
14957,
37461,
25,
1391,
23350,
62,
41537,
92,
11537,
198,
4798,
7,
69,
6,
14957,
25,
25597,
23350,
92,
11537,
198,
4798,
7,
69,
6,
26287,
9794,
25,
25597,
23913,
62,
3803,
92,
11537,
198,
4798,
7,
69,
6,
13681,
395,
25285,
287,
4415,
896,
25,
1391,
1655,
66,
62,
31504,
62,
8424,
92,
7198,
1391,
1655,
66,
62,
31504,
30072,
11537,
198,
4798,
7,
69,
6,
13681,
395,
36400,
589,
287,
4415,
896,
25,
1391,
70,
12501,
62,
31504,
62,
8424,
92,
7198,
1391,
70,
12501,
62,
31504,
30072,
11537,
198,
198,
22915,
28,
1280,
7203,
37315,
62,
7890,
62,
22915,
13,
14116,
2430,
86,
10,
4943,
198,
22915,
13,
13564,
7203,
43621,
14691,
3467,
77,
4943,
198,
22915,
13,
13564,
7203,
3880,
30934,
3467,
77,
4943,
198,
22915,
13,
13564,
7,
69,
6,
14957,
37461,
25,
1391,
23350,
62,
41537,
92,
6,
1343,
37082,
77,
4943,
198,
22915,
13,
13564,
7,
69,
6,
14957,
25,
25597,
23350,
92,
6,
10,
37082,
77,
4943,
198,
22915,
13,
13564,
7,
69,
6,
26287,
9794,
25,
25597,
23913,
62,
3803,
92,
6,
10,
37082,
77,
4943,
198,
22915,
13,
13564,
7,
69,
6,
13681,
395,
25285,
287,
4415,
896,
25,
1391,
1655,
66,
62,
31504,
62,
8424,
92,
7198,
1391,
1655,
66,
62,
31504,
30072,
6,
10,
37082,
77,
4943,
198,
22915,
13,
13564,
7,
69,
6,
13681,
395,
36400,
589,
287,
4415,
896,
25,
1391,
70,
12501,
62,
31504,
62,
8424,
92,
7198,
1391,
70,
12501,
62,
31504,
30072,
6,
10,
37082,
77,
4943,
198,
22915,
13,
19836,
3419
] | 2.328302 | 795 |
import sys
import threading
import os
import subprocess
import time
import signal
class Basher():
"""
Class to execute any command given as a subprocess in a new thread.
You can wait for execution to finish or execute in the background and check
the output frequently.
"""
# Init function
def __init__(self, command, lineCb=None, echo=False, waittime=1.0):
"""
Init the Basher
NOTE + TODO: CODE INJECTION is currently possible using Basher!
:param command: The command to execute in string format.
:type command: str
:param lineCB: An optional callback which is called for each line output of
the command.
:type lineCB: function(str, Basher), default: ``None``
:param echo: If output should be echoed to standard out
:type echo: bool, default: ``False``
:param waittime: Time to wait for execution to finish.
This only works if :func:`run<terminal.basher.Basher.run> is called with ``wait=True``
:type waittime: float, default: 1.0
"""
self.command = command
self.lineCb = lineCb
self.output = []
self.echo = echo
self.waittime = waittime
self.startTime = None
self.__process = None
self.running = False
def run(self, wait=True):
"""
Run the specified command.
:param wait: If we shoul wait for execution to finish.
:type wait: bool, default: True
:return: List of output lines.
:rtype: list(str)
"""
self.__process = subprocess.Popen(self.command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid)
self.__thread = threading.Thread(target=self.__output_reader)
self.__thread2 = threading.Thread(target=self.__error_reader)
self.__thread.daemon = True
self.__thread2.daemon = True
self.__thread.start()
self.__thread2.start()
self.startTime = time.time()
self.running=True
if wait:
while self.running and time.time()-self.startTime < self.waittime:
time.sleep(0.01)
self.stop()
return self.output
def stop(self):
"""Stop the execution of the command."""
self.__process.terminate()
self.__process.send_signal(signal.SIGTERM)
# self.__thread.join()
self.running=False
def __output_reader(self):
"""Read output in thread."""
for plain_line in iter(self.__process.stdout.readline, b''):
line = plain_line.decode('utf-8')
self.output.append(line)
if self.echo: print('#BASHER: {0}'.format(line), end='')
if self.lineCb is not None: self.lineCb(line, self)
self.running=False
def __error_reader(self):
"""Read error output in thread."""
for plain_line in iter(self.__process.stderr.readline, b''):
line = plain_line.decode('utf-8')
self.output.append(line)
if self.echo: print('#BASHER: {0}'.format(line), end='')
if self.lineCb is not None: self.lineCb(line, self)
| [
11748,
25064,
198,
11748,
4704,
278,
198,
11748,
28686,
198,
11748,
850,
14681,
198,
11748,
640,
198,
11748,
6737,
198,
198,
4871,
6455,
372,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5016,
284,
12260,
597,
3141,
1813,
355,
257,
850,
14681,
287,
257,
649,
4704,
13,
628,
220,
220,
220,
921,
460,
4043,
329,
9706,
284,
5461,
393,
12260,
287,
262,
4469,
290,
2198,
198,
220,
220,
220,
262,
5072,
6777,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1303,
44707,
2163,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
3141,
11,
1627,
34,
65,
28,
14202,
11,
9809,
28,
25101,
11,
2082,
715,
524,
28,
16,
13,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
44707,
262,
6455,
372,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
24550,
1343,
16926,
46,
25,
42714,
3268,
23680,
2849,
318,
3058,
1744,
1262,
6455,
372,
0,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
3141,
25,
383,
3141,
284,
12260,
287,
4731,
5794,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
3141,
25,
965,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1627,
23199,
25,
220,
1052,
11902,
23838,
543,
318,
1444,
329,
1123,
1627,
5072,
286,
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,
262,
3141,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
1627,
23199,
25,
220,
2163,
7,
2536,
11,
6455,
372,
828,
4277,
25,
7559,
14202,
15506,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
9809,
25,
220,
220,
220,
1002,
5072,
815,
307,
22211,
284,
3210,
503,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
9809,
25,
220,
220,
220,
20512,
11,
4277,
25,
7559,
25101,
15506,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
2082,
715,
524,
25,
220,
220,
220,
3862,
284,
4043,
329,
9706,
284,
5461,
13,
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,
770,
691,
2499,
611,
1058,
20786,
25,
63,
5143,
27,
23705,
282,
13,
12093,
372,
13,
15522,
372,
13,
5143,
29,
318,
1444,
351,
7559,
17077,
28,
17821,
15506,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
2082,
715,
524,
25,
220,
220,
220,
12178,
11,
4277,
25,
352,
13,
15,
220,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21812,
796,
3141,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1370,
34,
65,
796,
1627,
34,
65,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22915,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30328,
796,
9809,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
10247,
715,
524,
796,
2082,
715,
524,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9688,
7575,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
14681,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
20270,
796,
10352,
628,
220,
220,
220,
825,
1057,
7,
944,
11,
4043,
28,
17821,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5660,
262,
7368,
3141,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4043,
25,
1002,
356,
427,
2852,
4043,
329,
9706,
284,
5461,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
4906,
220,
4043,
25,
20512,
11,
4277,
25,
6407,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
7343,
286,
5072,
3951,
13,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
81,
4906,
25,
220,
1351,
7,
2536,
8,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
14681,
796,
850,
14681,
13,
47,
9654,
7,
944,
13,
21812,
11,
7582,
28,
17821,
11,
14367,
448,
28,
7266,
14681,
13,
47,
4061,
36,
11,
336,
1082,
81,
28,
7266,
14681,
13,
47,
4061,
36,
11,
47488,
87,
721,
62,
22184,
28,
418,
13,
28709,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
16663,
796,
4704,
278,
13,
16818,
7,
16793,
28,
944,
13,
834,
22915,
62,
46862,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
16663,
17,
796,
4704,
278,
13,
16818,
7,
16793,
28,
944,
13,
834,
18224,
62,
46862,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
16663,
13,
6814,
7966,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
16663,
17,
13,
6814,
7966,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
16663,
13,
9688,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
16663,
17,
13,
9688,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9688,
7575,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
20270,
28,
17821,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4043,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
2116,
13,
20270,
290,
640,
13,
2435,
3419,
12,
944,
13,
9688,
7575,
1279,
2116,
13,
10247,
715,
524,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
640,
13,
42832,
7,
15,
13,
486,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11338,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
22915,
628,
220,
220,
220,
825,
2245,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
19485,
262,
9706,
286,
262,
3141,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
14681,
13,
23705,
378,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
14681,
13,
21280,
62,
12683,
282,
7,
12683,
282,
13,
50,
3528,
5781,
44,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2116,
13,
834,
16663,
13,
22179,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
20270,
28,
25101,
628,
220,
220,
220,
825,
11593,
22915,
62,
46862,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5569,
5072,
287,
4704,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
329,
8631,
62,
1370,
287,
11629,
7,
944,
13,
834,
14681,
13,
19282,
448,
13,
961,
1370,
11,
275,
7061,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
8631,
62,
1370,
13,
12501,
1098,
10786,
40477,
12,
23,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22915,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
30328,
25,
3601,
10786,
2,
33,
11211,
1137,
25,
1391,
15,
92,
4458,
18982,
7,
1370,
828,
886,
28,
7061,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
1370,
34,
65,
318,
407,
6045,
25,
2116,
13,
1370,
34,
65,
7,
1370,
11,
2116,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
20270,
28,
25101,
628,
220,
220,
220,
825,
11593,
18224,
62,
46862,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5569,
4049,
5072,
287,
4704,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
329,
8631,
62,
1370,
287,
11629,
7,
944,
13,
834,
14681,
13,
301,
1082,
81,
13,
961,
1370,
11,
275,
7061,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
8631,
62,
1370,
13,
12501,
1098,
10786,
40477,
12,
23,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22915,
13,
33295,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
30328,
25,
3601,
10786,
2,
33,
11211,
1137,
25,
1391,
15,
92,
4458,
18982,
7,
1370,
828,
886,
28,
7061,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
1370,
34,
65,
318,
407,
6045,
25,
2116,
13,
1370,
34,
65,
7,
1370,
11,
2116,
8,
628
] | 2.260083 | 1,438 |
import sys
import numpy as np
import re
#tag = sys.argv[len(sys.argv)-1]
#for each log file
for num in range(len(sys.argv)-1):
inp = sys.argv[num+1]
print('################################################################################')
print("File#", num , " ", inp)
print('################################################################################')
run_stats = dict()
trainer_metrics = dict()
current_epoch = {} # Dict for each trainer to track the current epoch
ds_times = {}
active_ds_mode = ''
sync_time = 0
# Patterns for key metrics
p_trainers = re.compile('\s+Trainers\s+: ([0-9.]+)')
p_ppt = re.compile('\s+Processes per trainer\s+: ([0-9.]+)')
p_ppn = re.compile('\s+Processes on node\s+: ([0-9.]+)')
p_procs = re.compile('\s+Total number of processes\s+: ([0-9.]+)')
p_omp = re.compile('\s+OpenMP threads per process\s+: ([0-9.]+)')
p_mb = re.compile('\s+mini_batch_size:\s+([0-9.]+)')
# Patterns for key metrics
p_train_time = re.compile('\w+\s+\(instance ([0-9]*)\) training epoch ([0-9]*) run time : ([0-9.]+)')
p_test_time = re.compile('\w+\s+\(instance ([0-9]*)\) test run time : ([0-9.]+)')
p_test_recon = re.compile('\w+\s+\(instance ([0-9]*)\) test recon : ([0-9.]+)')
# Patterns for secondary metrics
p_train_mb_time = re.compile('\w+\s+\(instance ([0-9]*)\) training epoch ([0-9]*) mini-batch time statistics : ([0-9.]+)s mean')
# p_train_recon = re.compile('\w+\s+\(instance ([0-9]*)\) training epoch ([0-9]*) recon : ([0-9.]+)')
# Capture the time required to load the data
p_preload_data_store_mode = re.compile('starting do_preload_data_store.*num indices:\s+([0-9,]+) for role: (\w+)')
p_preload_data_store_time = re.compile('\s+do_preload_data_store time:\s+([0-9.]+)')
# Find the line with time to synchronize trainers
p_sync_time = re.compile('synchronizing trainers... ([0-9.]+)s')
with open(inp) as ifile1:
for line in ifile1:
m_trainers = p_trainers.match(line)
if (m_trainers):
run_stats['num_trainers'] = m_trainers.group(1)
m_ppt = p_ppt.match(line)
if (m_ppt):
run_stats['procs_per_trainer'] = m_ppt.group(1)
m_ppn = p_ppn.match(line)
if (m_ppn):
run_stats['procs_per_node'] = m_ppn.group(1)
m_procs = p_procs.match(line)
if (m_procs):
run_stats['num_processes'] = m_procs.group(1)
m_omp = p_omp.match(line)
if (m_omp):
run_stats['num_omp_threads'] = m_omp.group(1)
m_mb = p_mb.match(line)
if (m_mb):
run_stats['minibatch_size'] = m_mb.group(1)
m_time = p_train_time.match(line)
if (m_time):
tid = m_time.group(1)
e = m_time.group(2)
current_epoch[tid] = e # track the current epoch for each trainer
t = m_time.group(3)
if not trainer_metrics :
trainer_metrics = { e : { tid : { 'train_time' : t } } }
else:
if e in trainer_metrics :
if tid in trainer_metrics[e]:
trainer_metrics[e][tid]['train_time'] = t
else:
trainer_metrics[e][tid] = { 'train_time' : t }
else:
trainer_metrics[e] = { tid : { 'train_time' : t } }
m_test_recon = p_test_recon.match(line)
if (m_test_recon):
tid = m_test_recon.group(1)
e = current_epoch[tid]
r = m_test_recon.group(2)
if not 'test_recon' in trainer_metrics[e][tid].keys():
trainer_metrics[e][tid]['test_recon'] = r
else:
print('@epoch ' + e
+ ' - duplicate test reconstruction metric found - existing = '
+ trainer_metrics[e][tid]['test_recon']
+ ' discarding ' + r + ' (ran test twice???)')
m_test_time = p_test_time.match(line)
if (m_test_time):
tid = m_test_time.group(1)
e = current_epoch[tid]
r = m_test_time.group(2)
if not 'test_time' in trainer_metrics[e][tid].keys():
trainer_metrics[e][tid]['test_time'] = r
else:
print('@epoch ' + e
+ ' - duplicate test time found - existing = '
+ trainer_metrics[e][tid]['test_time']
+ ' discarding ' + r + ' (ran test twice???)')
m_train_mb_time = p_train_mb_time.match(line)
if (m_train_mb_time):
tid = m_train_mb_time.group(1)
e = current_epoch[tid]
if not e == m_train_mb_time.group(2):
assert('Epoch mismatch')
r = m_train_mb_time.group(3)
if not 'train_mb_time' in trainer_metrics[e][tid].keys():
trainer_metrics[e][tid]['train_mb_time'] = r
else:
print('@epoch ' + e
+ ' - duplicate train mb time found - existing = '
+ trainer_metrics[e][tid]['train_mb_time']
+ ' discarding ' + r + ' (abort)')
exit(-1)
m_ds_mode = p_preload_data_store_mode.match(line)
if (m_ds_mode):
active_mode = m_ds_mode.group(2)
samples = int(m_ds_mode.group(1).replace(',', ''))
ds_times[active_mode] = {'samples' : samples }
m_ds_time = p_preload_data_store_time.match(line)
if (m_ds_time):
time = float(m_ds_time.group(1))
ds_times[active_mode]['load_time'] = time
m_sync_time = p_sync_time.match(line)
if (m_sync_time):
sync_time = float(m_sync_time.group(1))
# m_train_recon = p_train_recon.match(line)
# if (m_train_recon):
# tid = m_train_recon.group(1)
# e = current_epoch[tid]
# if not e == m_train_recon.group(2):
# assert('Epoch mismatch')
# r = m_train_recon.group(3)
# trainer_metrics[e][tid]['train_recon'] = r
print(f"Trainers : {run_stats['num_trainers']}")
print(f"Procs per trainer : {run_stats['procs_per_trainer']}")
print(f"Procs per node : {run_stats['procs_per_node']}")
print(f"Total num. Processes : {run_stats['num_processes']}")
print(f"Num. OpenMP Threads : {run_stats['num_omp_threads']}")
print(f"Mini-batch Size : {run_stats['minibatch_size']}")
results, partial_results, total_train_times, total_train_times_not_first_epoch = summarize_metrics(trainer_metrics)
print_results(results, partial_results, total_train_times, total_train_times_not_first_epoch)
ifile1.close()
#table = pd.DataFrame(results)
#table = pd.DataFrame(all_metrics)
#met_file = "gb_metrics" +str(datetime.date.today())+'.csv'
#print("Saving computed metrics to ", met_file)
#table.to_csv(met_file, index=False)
| [
11748,
25064,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
302,
198,
198,
2,
12985,
796,
25064,
13,
853,
85,
58,
11925,
7,
17597,
13,
853,
85,
13219,
16,
60,
628,
198,
2,
1640,
1123,
2604,
2393,
198,
1640,
997,
287,
2837,
7,
11925,
7,
17597,
13,
853,
85,
13219,
16,
2599,
198,
220,
287,
79,
796,
25064,
13,
853,
85,
58,
22510,
10,
16,
60,
198,
220,
3601,
10786,
29113,
29113,
14468,
11537,
198,
220,
3601,
7203,
8979,
2,
1600,
997,
837,
366,
33172,
287,
79,
8,
198,
220,
3601,
10786,
29113,
29113,
14468,
11537,
198,
220,
1057,
62,
34242,
796,
8633,
3419,
198,
220,
21997,
62,
4164,
10466,
796,
8633,
3419,
198,
220,
1459,
62,
538,
5374,
796,
23884,
1303,
360,
713,
329,
1123,
21997,
284,
2610,
262,
1459,
36835,
198,
220,
288,
82,
62,
22355,
796,
23884,
198,
220,
4075,
62,
9310,
62,
14171,
796,
10148,
198,
220,
17510,
62,
2435,
796,
657,
198,
220,
1303,
47020,
329,
1994,
20731,
198,
220,
279,
62,
27432,
364,
796,
302,
13,
5589,
576,
10786,
59,
82,
10,
44077,
364,
59,
82,
10,
25,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
279,
62,
381,
83,
796,
302,
13,
5589,
576,
10786,
59,
82,
10,
18709,
274,
583,
21997,
59,
82,
10,
25,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
279,
62,
381,
77,
796,
302,
13,
5589,
576,
10786,
59,
82,
10,
18709,
274,
319,
10139,
59,
82,
10,
25,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
279,
62,
1676,
6359,
796,
302,
13,
5589,
576,
10786,
59,
82,
10,
14957,
1271,
286,
7767,
59,
82,
10,
25,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
279,
62,
3361,
796,
302,
13,
5589,
576,
10786,
59,
82,
10,
11505,
7378,
14390,
583,
1429,
59,
82,
10,
25,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
279,
62,
2022,
796,
302,
13,
5589,
576,
10786,
59,
82,
10,
45313,
62,
43501,
62,
7857,
7479,
82,
10,
26933,
15,
12,
24,
8183,
28988,
11537,
198,
220,
1303,
47020,
329,
1994,
20731,
198,
220,
279,
62,
27432,
62,
2435,
796,
302,
13,
5589,
576,
10786,
59,
86,
10,
59,
82,
10,
59,
7,
39098,
29565,
15,
12,
24,
60,
9,
19415,
8,
3047,
36835,
29565,
15,
12,
24,
60,
28104,
1057,
640,
1058,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
279,
62,
9288,
62,
2435,
796,
302,
13,
5589,
576,
10786,
59,
86,
10,
59,
82,
10,
59,
7,
39098,
29565,
15,
12,
24,
60,
9,
19415,
8,
1332,
1057,
640,
1058,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
279,
62,
9288,
62,
260,
1102,
796,
302,
13,
5589,
576,
10786,
59,
86,
10,
59,
82,
10,
59,
7,
39098,
29565,
15,
12,
24,
60,
9,
19415,
8,
1332,
8195,
1058,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
1303,
47020,
329,
9233,
20731,
198,
220,
279,
62,
27432,
62,
2022,
62,
2435,
796,
302,
13,
5589,
576,
10786,
59,
86,
10,
59,
82,
10,
59,
7,
39098,
29565,
15,
12,
24,
60,
9,
19415,
8,
3047,
36835,
29565,
15,
12,
24,
60,
28104,
9927,
12,
43501,
640,
7869,
1058,
29565,
15,
12,
24,
8183,
28988,
82,
1612,
11537,
198,
220,
1303,
279,
62,
27432,
62,
260,
1102,
796,
302,
13,
5589,
576,
10786,
59,
86,
10,
59,
82,
10,
59,
7,
39098,
29565,
15,
12,
24,
60,
9,
19415,
8,
3047,
36835,
29565,
15,
12,
24,
60,
28104,
8195,
1058,
29565,
15,
12,
24,
8183,
28988,
11537,
198,
220,
1303,
31793,
262,
640,
2672,
284,
3440,
262,
1366,
198,
220,
279,
62,
3866,
2220,
62,
7890,
62,
8095,
62,
14171,
796,
302,
13,
5589,
576,
10786,
38690,
466,
62,
3866,
2220,
62,
7890,
62,
8095,
15885,
22510,
36525,
7479,
82,
10,
26933,
15,
12,
24,
11,
60,
28988,
329,
2597,
25,
357,
59,
86,
28988,
11537,
198,
220,
279,
62,
3866,
2220,
62,
7890,
62,
8095,
62,
2435,
796,
302,
13,
5589,
576,
10786,
59,
82,
10,
4598,
62,
3866,
2220,
62,
7890,
62,
8095,
640,
7479,
82,
10,
26933,
15,
12,
24,
8183,
28988,
11537,
198,
220,
1303,
9938,
262,
1627,
351,
640,
284,
18305,
1096,
28514,
198,
220,
279,
62,
27261,
62,
2435,
796,
302,
13,
5589,
576,
10786,
28869,
11413,
2890,
28514,
986,
29565,
15,
12,
24,
8183,
28988,
82,
11537,
198,
220,
351,
1280,
7,
259,
79,
8,
355,
611,
576,
16,
25,
198,
220,
220,
220,
329,
1627,
287,
611,
576,
16,
25,
198,
220,
220,
220,
220,
220,
285,
62,
27432,
364,
796,
279,
62,
27432,
364,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
27432,
364,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
34242,
17816,
22510,
62,
27432,
364,
20520,
796,
285,
62,
27432,
364,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
285,
62,
381,
83,
796,
279,
62,
381,
83,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
381,
83,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
34242,
17816,
1676,
6359,
62,
525,
62,
2213,
10613,
20520,
796,
285,
62,
381,
83,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
285,
62,
381,
77,
796,
279,
62,
381,
77,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
381,
77,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
34242,
17816,
1676,
6359,
62,
525,
62,
17440,
20520,
796,
285,
62,
381,
77,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
285,
62,
1676,
6359,
796,
279,
62,
1676,
6359,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
1676,
6359,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
34242,
17816,
22510,
62,
14681,
274,
20520,
796,
285,
62,
1676,
6359,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
285,
62,
3361,
796,
279,
62,
3361,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
3361,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
34242,
17816,
22510,
62,
3361,
62,
16663,
82,
20520,
796,
285,
62,
3361,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
285,
62,
2022,
796,
279,
62,
2022,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
2022,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
34242,
17816,
1084,
571,
963,
62,
7857,
20520,
796,
285,
62,
2022,
13,
8094,
7,
16,
8,
628,
220,
220,
220,
220,
220,
285,
62,
2435,
796,
279,
62,
27432,
62,
2435,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
2435,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29770,
796,
285,
62,
2435,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
796,
285,
62,
2435,
13,
8094,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1459,
62,
538,
5374,
58,
83,
312,
60,
796,
304,
1303,
2610,
262,
1459,
36835,
329,
1123,
21997,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
796,
285,
62,
2435,
13,
8094,
7,
18,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
21997,
62,
4164,
10466,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21997,
62,
4164,
10466,
796,
1391,
304,
1058,
1391,
29770,
1058,
1391,
705,
27432,
62,
2435,
6,
1058,
256,
1782,
1782,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
304,
287,
21997,
62,
4164,
10466,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
29770,
287,
21997,
62,
4164,
10466,
58,
68,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
27432,
62,
2435,
20520,
796,
256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
60,
796,
1391,
705,
27432,
62,
2435,
6,
1058,
256,
1782,
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,
21997,
62,
4164,
10466,
58,
68,
60,
796,
1391,
29770,
1058,
1391,
705,
27432,
62,
2435,
6,
1058,
256,
1782,
1782,
628,
220,
220,
220,
220,
220,
285,
62,
9288,
62,
260,
1102,
796,
279,
62,
9288,
62,
260,
1102,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
9288,
62,
260,
1102,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29770,
796,
285,
62,
9288,
62,
260,
1102,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
796,
1459,
62,
538,
5374,
58,
83,
312,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
796,
285,
62,
9288,
62,
260,
1102,
13,
8094,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
705,
9288,
62,
260,
1102,
6,
287,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
4083,
13083,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
9288,
62,
260,
1102,
20520,
796,
374,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
31,
538,
5374,
705,
1343,
304,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
705,
532,
23418,
1332,
25056,
18663,
1043,
532,
4683,
796,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
9288,
62,
260,
1102,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
705,
1221,
13493,
705,
1343,
374,
1343,
705,
357,
2596,
1332,
5403,
3548,
10091,
11537,
628,
198,
220,
220,
220,
220,
220,
285,
62,
9288,
62,
2435,
796,
279,
62,
9288,
62,
2435,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
9288,
62,
2435,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29770,
796,
285,
62,
9288,
62,
2435,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
796,
1459,
62,
538,
5374,
58,
83,
312,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
796,
285,
62,
9288,
62,
2435,
13,
8094,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
705,
9288,
62,
2435,
6,
287,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
4083,
13083,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
9288,
62,
2435,
20520,
796,
374,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
31,
538,
5374,
705,
1343,
304,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
705,
532,
23418,
1332,
640,
1043,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
4683,
796,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
9288,
62,
2435,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
705,
1221,
13493,
705,
1343,
374,
1343,
705,
357,
2596,
1332,
5403,
3548,
10091,
11537,
628,
220,
220,
220,
220,
220,
285,
62,
27432,
62,
2022,
62,
2435,
796,
279,
62,
27432,
62,
2022,
62,
2435,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
27432,
62,
2022,
62,
2435,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29770,
796,
285,
62,
27432,
62,
2022,
62,
2435,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
796,
1459,
62,
538,
5374,
58,
83,
312,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
304,
6624,
285,
62,
27432,
62,
2022,
62,
2435,
13,
8094,
7,
17,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6818,
10786,
13807,
5374,
46318,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
796,
285,
62,
27432,
62,
2022,
62,
2435,
13,
8094,
7,
18,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
705,
27432,
62,
2022,
62,
2435,
6,
287,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
4083,
13083,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
27432,
62,
2022,
62,
2435,
20520,
796,
374,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
31,
538,
5374,
705,
1343,
304,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
705,
532,
23418,
4512,
285,
65,
640,
1043,
532,
4683,
796,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
27432,
62,
2022,
62,
2435,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1343,
705,
1221,
13493,
705,
1343,
374,
1343,
705,
357,
397,
419,
8,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8420,
32590,
16,
8,
628,
220,
220,
220,
220,
220,
285,
62,
9310,
62,
14171,
796,
279,
62,
3866,
2220,
62,
7890,
62,
8095,
62,
14171,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
9310,
62,
14171,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
4075,
62,
14171,
796,
285,
62,
9310,
62,
14171,
13,
8094,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
8405,
796,
493,
7,
76,
62,
9310,
62,
14171,
13,
8094,
7,
16,
737,
33491,
7,
3256,
3256,
10148,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
288,
82,
62,
22355,
58,
5275,
62,
14171,
60,
796,
1391,
6,
82,
12629,
6,
1058,
8405,
1782,
628,
220,
220,
220,
220,
220,
285,
62,
9310,
62,
2435,
796,
279,
62,
3866,
2220,
62,
7890,
62,
8095,
62,
2435,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
9310,
62,
2435,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
640,
796,
12178,
7,
76,
62,
9310,
62,
2435,
13,
8094,
7,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
288,
82,
62,
22355,
58,
5275,
62,
14171,
7131,
6,
2220,
62,
2435,
20520,
796,
640,
628,
220,
220,
220,
220,
220,
285,
62,
27261,
62,
2435,
796,
279,
62,
27261,
62,
2435,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
357,
76,
62,
27261,
62,
2435,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
17510,
62,
2435,
796,
12178,
7,
76,
62,
27261,
62,
2435,
13,
8094,
7,
16,
4008,
628,
220,
220,
220,
220,
220,
1303,
285,
62,
27432,
62,
260,
1102,
796,
279,
62,
27432,
62,
260,
1102,
13,
15699,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
1303,
611,
357,
76,
62,
27432,
62,
260,
1102,
2599,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
29770,
796,
285,
62,
27432,
62,
260,
1102,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
304,
796,
1459,
62,
538,
5374,
58,
83,
312,
60,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
611,
407,
304,
6624,
285,
62,
27432,
62,
260,
1102,
13,
8094,
7,
17,
2599,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
6818,
10786,
13807,
5374,
46318,
11537,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
374,
796,
285,
62,
27432,
62,
260,
1102,
13,
8094,
7,
18,
8,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
21997,
62,
4164,
10466,
58,
68,
7131,
83,
312,
7131,
6,
27432,
62,
260,
1102,
20520,
796,
374,
628,
220,
220,
220,
3601,
7,
69,
1,
44077,
364,
1058,
1391,
5143,
62,
34242,
17816,
22510,
62,
27432,
364,
20520,
92,
4943,
198,
220,
220,
220,
3601,
7,
69,
1,
2964,
6359,
583,
21997,
1058,
1391,
5143,
62,
34242,
17816,
1676,
6359,
62,
525,
62,
2213,
10613,
20520,
92,
4943,
198,
220,
220,
220,
3601,
7,
69,
1,
2964,
6359,
583,
10139,
1058,
1391,
5143,
62,
34242,
17816,
1676,
6359,
62,
525,
62,
17440,
20520,
92,
4943,
198,
220,
220,
220,
3601,
7,
69,
1,
14957,
997,
13,
10854,
274,
1058,
1391,
5143,
62,
34242,
17816,
22510,
62,
14681,
274,
20520,
92,
4943,
198,
220,
220,
220,
3601,
7,
69,
1,
33111,
13,
4946,
7378,
14122,
82,
1058,
1391,
5143,
62,
34242,
17816,
22510,
62,
3361,
62,
16663,
82,
20520,
92,
4943,
198,
220,
220,
220,
3601,
7,
69,
1,
39234,
12,
43501,
12849,
1058,
1391,
5143,
62,
34242,
17816,
1084,
571,
963,
62,
7857,
20520,
92,
4943,
198,
220,
220,
220,
2482,
11,
13027,
62,
43420,
11,
2472,
62,
27432,
62,
22355,
11,
2472,
62,
27432,
62,
22355,
62,
1662,
62,
11085,
62,
538,
5374,
796,
35743,
62,
4164,
10466,
7,
2213,
10613,
62,
4164,
10466,
8,
628,
220,
220,
220,
3601,
62,
43420,
7,
43420,
11,
13027,
62,
43420,
11,
2472,
62,
27432,
62,
22355,
11,
2472,
62,
27432,
62,
22355,
62,
1662,
62,
11085,
62,
538,
5374,
8,
628,
220,
220,
220,
611,
576,
16,
13,
19836,
3419,
628,
198,
2,
11487,
796,
279,
67,
13,
6601,
19778,
7,
43420,
8,
198,
2,
11487,
796,
279,
67,
13,
6601,
19778,
7,
439,
62,
4164,
10466,
8,
198,
2,
4164,
62,
7753,
796,
366,
22296,
62,
4164,
10466,
1,
1343,
2536,
7,
19608,
8079,
13,
4475,
13,
40838,
28955,
10,
4458,
40664,
6,
198,
2,
4798,
7203,
50,
2703,
29231,
20731,
284,
33172,
1138,
62,
7753,
8,
198,
2,
11487,
13,
1462,
62,
40664,
7,
4164,
62,
7753,
11,
6376,
28,
25101,
8,
198
] | 2.075272 | 3,215 |
import nltk
lines = []
with open("foitext.txt", 'r') as f:
for line in f:
lines.append(strip_non_ascii(line))
narratives = [x[x.rfind('|')+1:].strip() for x in lines]
tokens_list = [nltk.wordpunct_tokenize(x) for x in narratives]
# pos_list = [nltk.pos_tag(x) for x in tokens_list]
tokens = []
for x in tokens_list:
for y in x:
tokens.append(y)
tokens = list(set(tokens))
tokens.sort()
stem_functions = {
"snwbl_eng": nltk.stem.snowball.EnglishStemmer().stem,
"snwbl_snwbl": nltk.stem.snowball.SnowballStemmer("english").stem,
"snwbl_prtr": nltk.stem.snowball.PorterStemmer().stem,
"prtr": nltk.stem.porter.PorterStemmer().stem,
"wordnet": nltk.stem.wordnet.WordNetLemmatizer().lemmatize,
"lancaster": nltk.stem.lancaster.LancasterStemmer().stem
}
stems = {}
# Make stems
for name, func in stem_functions.items():
this_stem = [func(x) for x in tokens]
this_stem = list(set(this_stem))
this_stem.sort()
stems[name] = this_stem
# Print results
result = "Results:\n"
for name, stem_list in stems.items():
result += name + ":\t" + str(len(stem_list)) + "\n"
print result
| [
11748,
299,
2528,
74,
198,
198,
6615,
796,
17635,
198,
4480,
1280,
7203,
6513,
578,
742,
13,
14116,
1600,
705,
81,
11537,
355,
277,
25,
198,
197,
1640,
1627,
287,
277,
25,
198,
197,
197,
6615,
13,
33295,
7,
36311,
62,
13159,
62,
292,
979,
72,
7,
1370,
4008,
198,
198,
77,
3258,
2929,
796,
685,
87,
58,
87,
13,
81,
19796,
10786,
91,
11537,
10,
16,
25,
4083,
36311,
3419,
329,
2124,
287,
3951,
60,
198,
83,
482,
641,
62,
4868,
796,
685,
77,
2528,
74,
13,
4775,
79,
16260,
62,
30001,
1096,
7,
87,
8,
329,
2124,
287,
26274,
60,
198,
2,
1426,
62,
4868,
796,
685,
77,
2528,
74,
13,
1930,
62,
12985,
7,
87,
8,
329,
2124,
287,
16326,
62,
4868,
60,
198,
198,
83,
482,
641,
796,
17635,
198,
1640,
2124,
287,
16326,
62,
4868,
25,
198,
197,
1640,
331,
287,
2124,
25,
198,
197,
197,
83,
482,
641,
13,
33295,
7,
88,
8,
198,
198,
83,
482,
641,
796,
1351,
7,
2617,
7,
83,
482,
641,
4008,
198,
83,
482,
641,
13,
30619,
3419,
198,
198,
927,
62,
12543,
2733,
796,
1391,
198,
197,
1,
16184,
86,
2436,
62,
1516,
1298,
299,
2528,
74,
13,
927,
13,
82,
2197,
1894,
13,
15823,
1273,
368,
647,
22446,
927,
11,
198,
197,
1,
16184,
86,
2436,
62,
16184,
86,
2436,
1298,
299,
2528,
74,
13,
927,
13,
82,
2197,
1894,
13,
28974,
1894,
1273,
368,
647,
7203,
39126,
11074,
927,
11,
198,
197,
1,
16184,
86,
2436,
62,
1050,
2213,
1298,
299,
2528,
74,
13,
927,
13,
82,
2197,
1894,
13,
47,
4337,
1273,
368,
647,
22446,
927,
11,
198,
197,
1,
1050,
2213,
1298,
299,
2528,
74,
13,
927,
13,
26634,
13,
47,
4337,
1273,
368,
647,
22446,
927,
11,
198,
197,
1,
4775,
3262,
1298,
299,
2528,
74,
13,
927,
13,
4775,
3262,
13,
26449,
7934,
43,
368,
6759,
7509,
22446,
293,
3020,
265,
1096,
11,
198,
197,
1,
75,
1192,
1603,
1298,
299,
2528,
74,
13,
927,
13,
75,
1192,
1603,
13,
43,
1192,
1603,
1273,
368,
647,
22446,
927,
198,
92,
198,
198,
927,
82,
796,
23884,
628,
198,
2,
6889,
21552,
198,
1640,
1438,
11,
25439,
287,
10717,
62,
12543,
2733,
13,
23814,
33529,
198,
197,
5661,
62,
927,
796,
685,
20786,
7,
87,
8,
329,
2124,
287,
16326,
60,
198,
197,
5661,
62,
927,
796,
1351,
7,
2617,
7,
5661,
62,
927,
4008,
198,
197,
5661,
62,
927,
13,
30619,
3419,
198,
197,
927,
82,
58,
3672,
60,
796,
428,
62,
927,
628,
198,
2,
12578,
2482,
198,
20274,
796,
366,
25468,
7479,
77,
1,
198,
1640,
1438,
11,
10717,
62,
4868,
287,
21552,
13,
23814,
33529,
198,
197,
20274,
15853,
1438,
1343,
366,
7479,
83,
1,
1343,
965,
7,
11925,
7,
927,
62,
4868,
4008,
1343,
37082,
77,
1,
628,
198,
4798,
1255,
198
] | 2.307368 | 475 |
'''
This module implements a listen attend and spell classifier.
'''
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from neuralnetworks.classifiers.classifier import Classifier
from neuralnetworks.las_elements import Listener
from neuralnetworks.beam_search_speller import BeamSearchSpeller
from IPython.core.debugger import Tracer; debug_here = Tracer();
class LasModel(Classifier):
""" A neural end to end network based speech model."""
def __init__(self, general_settings, listener_settings,
attend_and_spell_settings):
"""
Create a listen attend and Spell model. As described in,
Chan, Jaitly, Le et al.
Listen, attend and spell
Params:
mel_feature_no: The length of the mel-featrue vectors at each
time step.
batch_size: The number of utterances in each (mini)-batch.
target_label_no: The number of letters or phonemes in the
training data set.
decoding: Boolean flag indicating if this graph is going to be
used for decoding purposes.
"""
super(LasModel, self).__init__(general_settings.target_label_no)
self.gen_set = general_settings
self.lst_set = listener_settings
self.as_set = attend_and_spell_settings
self.dtype = tf.float32
self.mel_feature_no = self.gen_set.mel_feature_no
self.batch_size = self.gen_set.batch_size
self.target_label_no = self.gen_set.target_label_no
#decoding constants
self.max_decoding_steps = 100
#self.max_decoding_steps = 44
#store the two model parts.
self.listener = Listener(general_settings, listener_settings)
#create a greedy speller.
#self.speller = Speller(attend_and_spell_settings,
# self.batch_size,
# self.dtype,
# self.target_label_no,
# self.max_decoding_steps)
#create a beam search speller.
self.speller = BeamSearchSpeller(attend_and_spell_settings,
self.batch_size,
self.dtype,
self.target_label_no,
self.max_decoding_steps,
beam_width=self.gen_set.beam_width,
dropout_settings=self.gen_set.dropout_settings)
def encode_targets_one_hot(self, targets):
"""
Transforn the targets into one hot encoded targets.
Args:
targets: Tensor of shape [batch_size, max_target_time, 1]
Returns:
one_hot_targets: [batch_size, max_target_time, label_no]
"""
with tf.variable_scope("one_hot_encoding"):
target_one_hot = tf.one_hot(targets,
self.target_label_no,
axis=2)
#one hot encoding adds an extra dimension we don't want.
#squeeze it out.
target_one_hot = tf.squeeze(target_one_hot, squeeze_dims=[3])
print("train targets shape: ", tf.Tensor.get_shape(target_one_hot))
return target_one_hot
@staticmethod
def add_input_noise(inputs, stddev=0.65):
"""
Add noise with a given standart deviation to the inputs
Args:
inputs: the noise free input-features.
stddev: The standart deviation of the noise.
returns:
Input features plus noise.
"""
if stddev != 0:
with tf.variable_scope("input_noise"):
#add input noise with a standart deviation of stddev.
inputs = tf.random_normal(tf.shape(inputs), 0.0, stddev) + inputs
else:
print("stddev is zero no input noise added.")
return inputs
| [
7061,
6,
198,
1212,
8265,
23986,
257,
6004,
5262,
290,
4822,
1398,
7483,
13,
198,
7061,
6,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
7297,
11,
3601,
62,
8818,
198,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
6738,
17019,
3262,
5225,
13,
4871,
13350,
13,
4871,
7483,
1330,
5016,
7483,
198,
6738,
17019,
3262,
5225,
13,
21921,
62,
68,
3639,
1330,
7343,
877,
198,
6738,
17019,
3262,
5225,
13,
40045,
62,
12947,
62,
4125,
6051,
1330,
25855,
18243,
5248,
6051,
198,
6738,
6101,
7535,
13,
7295,
13,
24442,
1362,
1330,
833,
11736,
26,
14257,
62,
1456,
796,
833,
11736,
9783,
628,
198,
4871,
10123,
17633,
7,
9487,
7483,
2599,
198,
220,
220,
220,
37227,
317,
17019,
886,
284,
886,
3127,
1912,
4046,
2746,
526,
15931,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2276,
62,
33692,
11,
24783,
62,
33692,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5262,
62,
392,
62,
46143,
62,
33692,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13610,
257,
6004,
5262,
290,
11988,
2746,
13,
1081,
3417,
287,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18704,
11,
449,
4548,
306,
11,
1004,
2123,
435,
13,
198,
220,
220,
220,
220,
220,
220,
220,
20600,
11,
5262,
290,
4822,
628,
220,
220,
220,
220,
220,
220,
220,
2547,
4105,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7758,
62,
30053,
62,
3919,
25,
383,
4129,
286,
262,
7758,
12,
27594,
24508,
30104,
379,
1123,
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,
640,
2239,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
7857,
25,
383,
1271,
286,
10517,
1817,
287,
1123,
357,
45313,
13219,
43501,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
18242,
62,
3919,
25,
383,
1271,
286,
7475,
393,
32896,
368,
274,
287,
262,
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,
3047,
1366,
900,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
39938,
25,
41146,
6056,
12739,
611,
428,
4823,
318,
1016,
284,
307,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
973,
329,
39938,
4959,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
46898,
17633,
11,
2116,
737,
834,
15003,
834,
7,
24622,
62,
33692,
13,
16793,
62,
18242,
62,
3919,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
5235,
62,
2617,
796,
2276,
62,
33692,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
75,
301,
62,
2617,
796,
24783,
62,
33692,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
292,
62,
2617,
796,
5262,
62,
392,
62,
46143,
62,
33692,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
67,
4906,
796,
48700,
13,
22468,
2624,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
17694,
62,
30053,
62,
3919,
796,
2116,
13,
5235,
62,
2617,
13,
17694,
62,
30053,
62,
3919,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43501,
62,
7857,
796,
2116,
13,
5235,
62,
2617,
13,
43501,
62,
7857,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16793,
62,
18242,
62,
3919,
796,
2116,
13,
5235,
62,
2617,
13,
16793,
62,
18242,
62,
3919,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12501,
7656,
38491,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9806,
62,
12501,
7656,
62,
20214,
796,
1802,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
944,
13,
9806,
62,
12501,
7656,
62,
20214,
796,
5846,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
8095,
262,
734,
2746,
3354,
13,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4868,
877,
796,
7343,
877,
7,
24622,
62,
33692,
11,
24783,
62,
33692,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
17953,
257,
31828,
4822,
263,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
944,
13,
4125,
6051,
796,
2531,
6051,
7,
1078,
437,
62,
392,
62,
46143,
62,
33692,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43501,
62,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
67,
4906,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16793,
62,
18242,
62,
3919,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9806,
62,
12501,
7656,
62,
20214,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
17953,
257,
15584,
2989,
4822,
263,
13,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4125,
6051,
796,
25855,
18243,
5248,
6051,
7,
1078,
437,
62,
392,
62,
46143,
62,
33692,
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,
2116,
13,
43501,
62,
7857,
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,
2116,
13,
67,
4906,
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,
2116,
13,
16793,
62,
18242,
62,
3919,
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,
2116,
13,
9806,
62,
12501,
7656,
62,
20214,
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,
15584,
62,
10394,
28,
944,
13,
5235,
62,
2617,
13,
40045,
62,
10394,
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,
4268,
448,
62,
33692,
28,
944,
13,
5235,
62,
2617,
13,
14781,
448,
62,
33692,
8,
628,
220,
220,
220,
825,
37773,
62,
83,
853,
1039,
62,
505,
62,
8940,
7,
944,
11,
6670,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3602,
69,
1211,
262,
6670,
656,
530,
3024,
30240,
6670,
13,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6670,
25,
309,
22854,
286,
5485,
685,
43501,
62,
7857,
11,
3509,
62,
16793,
62,
2435,
11,
352,
60,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
530,
62,
8940,
62,
83,
853,
1039,
25,
685,
43501,
62,
7857,
11,
3509,
62,
16793,
62,
2435,
11,
6167,
62,
3919,
60,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
351,
48700,
13,
45286,
62,
29982,
7203,
505,
62,
8940,
62,
12685,
7656,
1,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
505,
62,
8940,
796,
48700,
13,
505,
62,
8940,
7,
83,
853,
1039,
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,
2116,
13,
16793,
62,
18242,
62,
3919,
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,
16488,
28,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
505,
3024,
21004,
6673,
281,
3131,
15793,
356,
836,
470,
765,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
16485,
1453,
2736,
340,
503,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
505,
62,
8940,
796,
48700,
13,
16485,
1453,
2736,
7,
16793,
62,
505,
62,
8940,
11,
21229,
62,
67,
12078,
41888,
18,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
27432,
6670,
5485,
25,
33172,
48700,
13,
51,
22854,
13,
1136,
62,
43358,
7,
16793,
62,
505,
62,
8940,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2496,
62,
505,
62,
8940,
628,
220,
220,
220,
2488,
12708,
24396,
198,
220,
220,
220,
825,
751,
62,
15414,
62,
3919,
786,
7,
15414,
82,
11,
336,
1860,
1990,
28,
15,
13,
2996,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3060,
7838,
351,
257,
1813,
1302,
433,
28833,
284,
262,
17311,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17311,
25,
262,
7838,
1479,
5128,
12,
40890,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
336,
1860,
1990,
25,
383,
1302,
433,
28833,
286,
262,
7838,
13,
198,
220,
220,
220,
220,
220,
220,
220,
5860,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23412,
3033,
5556,
7838,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
336,
1860,
1990,
14512,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
351,
48700,
13,
45286,
62,
29982,
7203,
15414,
62,
3919,
786,
1,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2860,
5128,
7838,
351,
257,
1302,
433,
28833,
286,
336,
1860,
1990,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17311,
796,
48700,
13,
25120,
62,
11265,
7,
27110,
13,
43358,
7,
15414,
82,
828,
657,
13,
15,
11,
336,
1860,
1990,
8,
1343,
17311,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
301,
1860,
1990,
318,
6632,
645,
5128,
7838,
2087,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
17311,
628
] | 2.050882 | 1,985 |
from basketball_reference_web_scraper.data import TEAM_ABBREVIATIONS_TO_TEAM, POSITION_ABBREVIATIONS_TO_POSITION
from basketball_reference_web_scraper.parsers.common import COLUMN_RENAMER, COLUMN_PARSER, \
find_team_column, parse_souped_row_given_header_columns, split_header_columns, get_all_tables_with_soup
__totals_stats_by_year_header_string = "Player,Pos,Age,Tm,G,GS,MP,FG,FGA,FG%,3P,3PA,3P%,2P,2PA,2P%,eFG%,FT,FTA,FT%,ORB,DRB,TRB,AST,STL,BLK,TOV,PF,PTS"
_totals_stats_by_year_header_columns = split_header_columns(__totals_stats_by_year_header_string)
| [
6738,
9669,
62,
35790,
62,
12384,
62,
1416,
38545,
13,
7890,
1330,
33536,
62,
6242,
40438,
12861,
18421,
62,
10468,
62,
9328,
2390,
11,
28069,
17941,
62,
6242,
40438,
12861,
18421,
62,
10468,
62,
37997,
17941,
198,
6738,
9669,
62,
35790,
62,
12384,
62,
1416,
38545,
13,
79,
945,
364,
13,
11321,
1330,
20444,
5883,
45,
62,
49,
1677,
2390,
1137,
11,
20444,
5883,
45,
62,
27082,
35009,
11,
3467,
198,
220,
220,
220,
1064,
62,
15097,
62,
28665,
11,
21136,
62,
82,
280,
9124,
62,
808,
62,
35569,
62,
25677,
62,
28665,
82,
11,
6626,
62,
25677,
62,
28665,
82,
11,
651,
62,
439,
62,
83,
2977,
62,
4480,
62,
82,
10486,
198,
198,
834,
83,
313,
874,
62,
34242,
62,
1525,
62,
1941,
62,
25677,
62,
8841,
796,
366,
14140,
11,
21604,
11,
23396,
11,
51,
76,
11,
38,
11,
14313,
11,
7378,
11,
30386,
11,
37,
9273,
11,
30386,
7441,
18,
47,
11,
18,
4537,
11,
18,
47,
7441,
17,
47,
11,
17,
4537,
11,
17,
47,
7441,
68,
30386,
7441,
9792,
11,
37,
5603,
11,
9792,
7441,
1581,
33,
11,
7707,
33,
11,
5446,
33,
11,
11262,
11,
2257,
43,
11,
9148,
42,
11,
51,
8874,
11,
42668,
11,
47,
4694,
1,
198,
62,
83,
313,
874,
62,
34242,
62,
1525,
62,
1941,
62,
25677,
62,
28665,
82,
796,
6626,
62,
25677,
62,
28665,
82,
7,
834,
83,
313,
874,
62,
34242,
62,
1525,
62,
1941,
62,
25677,
62,
8841,
8,
198
] | 2.292683 | 246 |
import h2o
from Benchmarker.experiment import Experiment
import Benchmarker.config as config
import Benchmarker.utils as utils
import warnings
from optparse import OptionParser
from Benchmarker.utils import init_journal, close_journal
import numbers
import Benchmarker.metaopt.fakegame as fg
import Benchmarker.metaopt.params as p
from Benchmarker.utils import persist
import datetime
import re
import numpy as np
from numpy.random import rand, randint
import sys
import pysmac
dt = datetime.datetime
## Settings
experiment_name = ""
x_cols = []
y_col = None
data_file = ""
steps = int(sys.argv[1])
experiment_name = "Airlines 10k"
x_cols = ["Year", "Month", "DayofMonth", "DayOfWeek", "DepTime", "CRSDepTime", "ArrTime", "CRSArrTime", "UniqueCarrier",
"FlightNum", "TailNum", "Origin", "Dest", "Distance", "TaxiIn"]
y_col = "IsDepDelayed"
data_file = "/home/frydatom/Sync/School/Vylet_2016/data/airlines_imputed_10k.csv"
# data_file = "/home/ubuntu/frydatom-vylet-2016/data/airlines_imputed_10k.csv"
## ================================================== Script ===========================================================
keep_files = None
optStart = dt.now()
experimentName = experiment_name
## =================================================== Trainers ========================================================
trdata = None
vadata = None
tedata = None
keep_files = None
algs = [(GLMtrainer, p.glm_params),(CCtrainer, p.fakegame_cascadeCorrelation_params), (DRFtrainer, p.drf_params),(GBMtrainer, p.gbm_params),
(BPtrainer, p.fakegame_backprop_params),(DLtrainer, p.dl_params), (QPtrainer, p.fakegame_quickprop_params), (RPtrainer, p.fakegame_rprop_params)]
##################################################### Run ##############################################################
if __name__ == '__main__':
opt = OptionParser()
opt.add_option("-n", "--nthreads", dest="nthreads", help="number of threads used by h2o")
opt.add_option("-c", "--cluster", dest="cluster", help="cluster name used by h2o to establish connection")
opt.add_option("-j", "--journal-file", dest="journal", help="filename of a journal, i.e., file that gets"
"appended by each result in case something goes wrong")
(options, args) = opt.parse_args()
if options.journal:
utils.journal_file = options.journal
init_journal()
# Sanity checks
try:
f = open(utils.journal_file, "a")
f.close()
except:
warnings.warn("An error occurred during opening the journal file. Have you set it properly? (-j)")
exit(1)
config.hostname = "127.0.0.1"
config.port = 54321
config.nthreads = int(options.nthreads) if int(options.nthreads) >= 1 or options.nthreads is None else 4
config.cluster = "one" if options.cluster == "" or options.cluster is None else options.cluster
# Actual code to run
h2o.init(config.hostname, config.port, nthreads=config.nthreads, cluster_name=config.cluster)
h2o.remove_all()
data = h2o.import_file(data_file)
r = data.runif()
trdata = data[r < 0.5]
vadata = data[(r >= 0.5) & (r < 0.75)]
tedata = data[r >= 0.75]
keep_frames = re.compile("|".join([trdata.frame_id, vadata.frame_id, tedata.frame_id]) + "|.*\\.hex|py_.*")
for (tr, par) in algs:
print("random search")
randomSearch(tr, par, steps)
print("smac")
smac(tr, par, steps)
| [
11748,
289,
17,
78,
201,
198,
6738,
25187,
4102,
263,
13,
23100,
3681,
1330,
29544,
201,
198,
11748,
25187,
4102,
263,
13,
11250,
355,
4566,
201,
198,
11748,
25187,
4102,
263,
13,
26791,
355,
3384,
4487,
201,
198,
11748,
14601,
201,
198,
6738,
2172,
29572,
1330,
16018,
46677,
201,
198,
6738,
25187,
4102,
263,
13,
26791,
1330,
2315,
62,
24891,
11,
1969,
62,
24891,
201,
198,
11748,
3146,
201,
198,
11748,
25187,
4102,
263,
13,
28961,
8738,
13,
30706,
6057,
355,
277,
70,
201,
198,
11748,
25187,
4102,
263,
13,
28961,
8738,
13,
37266,
355,
279,
201,
198,
6738,
25187,
4102,
263,
13,
26791,
1330,
21160,
201,
198,
11748,
4818,
8079,
201,
198,
11748,
302,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
6738,
299,
32152,
13,
25120,
1330,
43720,
11,
43720,
600,
201,
198,
11748,
25064,
201,
198,
11748,
279,
893,
20285,
201,
198,
201,
198,
28664,
796,
4818,
8079,
13,
19608,
8079,
201,
198,
201,
198,
2235,
16163,
201,
198,
23100,
3681,
62,
3672,
796,
13538,
201,
198,
87,
62,
4033,
82,
796,
17635,
201,
198,
88,
62,
4033,
796,
6045,
201,
198,
7890,
62,
7753,
796,
13538,
201,
198,
20214,
796,
493,
7,
17597,
13,
853,
85,
58,
16,
12962,
201,
198,
201,
198,
23100,
3681,
62,
3672,
796,
366,
32,
1901,
1127,
838,
74,
1,
201,
198,
87,
62,
4033,
82,
796,
14631,
17688,
1600,
366,
31948,
1600,
366,
12393,
1659,
31948,
1600,
366,
12393,
5189,
20916,
1600,
366,
12156,
7575,
1600,
366,
34,
6998,
12156,
7575,
1600,
366,
3163,
81,
7575,
1600,
366,
34,
6998,
3163,
81,
7575,
1600,
366,
40257,
9914,
5277,
1600,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
43069,
33111,
1600,
366,
51,
603,
33111,
1600,
366,
39688,
1600,
366,
24159,
1600,
366,
45767,
1600,
366,
27017,
72,
818,
8973,
201,
198,
88,
62,
4033,
796,
366,
3792,
12156,
13856,
16548,
1,
201,
198,
7890,
62,
7753,
796,
12813,
11195,
14,
69,
563,
19608,
296,
14,
28985,
14,
26130,
14,
53,
88,
1616,
62,
5304,
14,
7890,
14,
958,
6615,
62,
320,
17128,
62,
940,
74,
13,
40664,
1,
201,
198,
2,
1366,
62,
7753,
796,
12813,
11195,
14,
32230,
14,
69,
563,
19608,
296,
12,
7670,
1616,
12,
5304,
14,
7890,
14,
958,
6615,
62,
320,
17128,
62,
940,
74,
13,
40664,
1,
201,
198,
2235,
46111,
4770,
28,
12327,
46111,
4770,
2559,
855,
201,
198,
14894,
62,
16624,
796,
6045,
201,
198,
8738,
10434,
796,
288,
83,
13,
2197,
3419,
201,
198,
201,
198,
23100,
3681,
5376,
796,
6306,
62,
3672,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
2235,
46111,
4770,
855,
16835,
364,
46111,
4770,
1421,
18604,
201,
198,
2213,
7890,
796,
6045,
201,
198,
85,
14706,
796,
6045,
201,
198,
1513,
1045,
796,
6045,
201,
198,
14894,
62,
16624,
796,
6045,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
201,
198,
14016,
82,
796,
47527,
8763,
44,
2213,
10613,
11,
279,
13,
4743,
76,
62,
37266,
828,
7,
4093,
2213,
10613,
11,
279,
13,
30706,
6057,
62,
66,
28966,
10606,
49501,
62,
37266,
828,
357,
7707,
37,
2213,
10613,
11,
279,
13,
7109,
69,
62,
37266,
828,
7,
4579,
44,
2213,
10613,
11,
279,
13,
70,
20475,
62,
37266,
828,
220,
201,
198,
220,
220,
220,
357,
20866,
2213,
10613,
11,
279,
13,
30706,
6057,
62,
1891,
22930,
62,
37266,
828,
7,
19260,
2213,
10613,
11,
279,
13,
25404,
62,
37266,
828,
357,
48,
46745,
10613,
11,
279,
13,
30706,
6057,
62,
24209,
22930,
62,
37266,
828,
357,
20031,
2213,
10613,
11,
279,
13,
30706,
6057,
62,
81,
22930,
62,
37266,
15437,
201,
198,
201,
198,
29113,
14468,
4242,
2,
5660,
1303,
29113,
14468,
7804,
4242,
2,
201,
198,
201,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
201,
198,
220,
220,
220,
2172,
796,
16018,
46677,
3419,
201,
198,
220,
220,
220,
2172,
13,
2860,
62,
18076,
7203,
12,
77,
1600,
366,
438,
77,
16663,
82,
1600,
2244,
2625,
77,
16663,
82,
1600,
1037,
2625,
17618,
286,
14390,
973,
416,
289,
17,
78,
4943,
201,
198,
220,
220,
220,
2172,
13,
2860,
62,
18076,
7203,
12,
66,
1600,
366,
438,
565,
5819,
1600,
2244,
2625,
565,
5819,
1600,
1037,
2625,
565,
5819,
1438,
973,
416,
289,
17,
78,
284,
4474,
4637,
4943,
201,
198,
220,
220,
220,
2172,
13,
2860,
62,
18076,
7203,
12,
73,
1600,
366,
438,
24891,
12,
7753,
1600,
2244,
2625,
24891,
1600,
1037,
2625,
34345,
286,
257,
3989,
11,
1312,
13,
68,
1539,
2393,
326,
3011,
1,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1324,
1631,
416,
1123,
1255,
287,
1339,
1223,
2925,
2642,
4943,
201,
198,
201,
198,
220,
220,
220,
357,
25811,
11,
26498,
8,
796,
2172,
13,
29572,
62,
22046,
3419,
201,
198,
201,
198,
220,
220,
220,
611,
3689,
13,
24891,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3384,
4487,
13,
24891,
62,
7753,
796,
3689,
13,
24891,
201,
198,
201,
198,
220,
220,
220,
2315,
62,
24891,
3419,
201,
198,
220,
220,
220,
1303,
2986,
414,
8794,
201,
198,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
277,
796,
1280,
7,
26791,
13,
24891,
62,
7753,
11,
366,
64,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
19836,
3419,
201,
198,
220,
220,
220,
2845,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
14601,
13,
40539,
7203,
2025,
4049,
5091,
1141,
4756,
262,
3989,
2393,
13,
8192,
345,
900,
340,
6105,
30,
13841,
73,
8,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
8420,
7,
16,
8,
201,
198,
201,
198,
220,
220,
220,
4566,
13,
4774,
3672,
796,
366,
16799,
13,
15,
13,
15,
13,
16,
1,
201,
198,
220,
220,
220,
4566,
13,
634,
796,
642,
3559,
2481,
201,
198,
220,
220,
220,
4566,
13,
77,
16663,
82,
796,
493,
7,
25811,
13,
77,
16663,
82,
8,
611,
493,
7,
25811,
13,
77,
16663,
82,
8,
18189,
352,
393,
3689,
13,
77,
16663,
82,
318,
6045,
2073,
604,
201,
198,
220,
220,
220,
4566,
13,
565,
5819,
796,
366,
505,
1,
611,
3689,
13,
565,
5819,
6624,
13538,
393,
3689,
13,
565,
5819,
318,
6045,
2073,
3689,
13,
565,
5819,
201,
198,
201,
198,
220,
220,
220,
1303,
33520,
2438,
284,
1057,
201,
198,
220,
220,
220,
289,
17,
78,
13,
15003,
7,
11250,
13,
4774,
3672,
11,
4566,
13,
634,
11,
299,
16663,
82,
28,
11250,
13,
77,
16663,
82,
11,
13946,
62,
3672,
28,
11250,
13,
565,
5819,
8,
201,
198,
220,
220,
220,
289,
17,
78,
13,
28956,
62,
439,
3419,
201,
198,
220,
220,
220,
1366,
796,
289,
17,
78,
13,
11748,
62,
7753,
7,
7890,
62,
7753,
8,
201,
198,
220,
220,
220,
374,
796,
1366,
13,
5143,
361,
3419,
201,
198,
220,
220,
220,
491,
7890,
796,
1366,
58,
81,
1279,
657,
13,
20,
60,
201,
198,
220,
220,
220,
410,
14706,
796,
1366,
58,
7,
81,
18189,
657,
13,
20,
8,
1222,
357,
81,
1279,
657,
13,
2425,
15437,
201,
198,
220,
220,
220,
28501,
1045,
796,
1366,
58,
81,
18189,
657,
13,
2425,
60,
201,
198,
201,
198,
220,
220,
220,
1394,
62,
37805,
796,
302,
13,
5589,
576,
7203,
91,
1911,
22179,
26933,
2213,
7890,
13,
14535,
62,
312,
11,
410,
14706,
13,
14535,
62,
312,
11,
28501,
1045,
13,
14535,
62,
312,
12962,
1343,
366,
91,
15885,
6852,
13,
33095,
91,
9078,
62,
15885,
4943,
201,
198,
201,
198,
220,
220,
220,
329,
357,
2213,
11,
1582,
8,
287,
435,
14542,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
25120,
2989,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
4738,
18243,
7,
2213,
11,
1582,
11,
4831,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
5796,
330,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
895,
330,
7,
2213,
11,
1582,
11,
4831,
8,
201,
198
] | 2.5517 | 1,412 |
#!/usr/bin/env python
import RPi.GPIO as gpio
import os
import time
import subprocess
import sys
import signal
import threading
import datetime
# Volume controls
day_volume = 70
night_volume = 100
# Control box IO
key_channel = 22
button_channel = 7
armed_indicator_channel = 18
activated_indicator_channel = 29
# Motor IO
motor1_channel = 35
motor2_channel = 32
top_limit_channel = 33
# Wacky Wavy Guy Fan
fan_channel = 40
# System control
reboot_channel = 37
shutdown_channel = 38
# Set up GPIO
gpio.setmode(gpio.BOARD)
gpio.setup(button_channel, gpio.IN, pull_up_down=gpio.PUD_UP)
gpio.setup(key_channel, gpio.IN, pull_up_down=gpio.PUD_UP)
gpio.setup(armed_indicator_channel, gpio.OUT)
gpio.setup(activated_indicator_channel, gpio.OUT)
gpio.setup(motor1_channel, gpio.OUT)
gpio.setup(motor2_channel, gpio.OUT)
gpio.setup(top_limit_channel, gpio.IN, pull_up_down=gpio.PUD_UP)
gpio.setup(fan_channel, gpio.OUT)
gpio.setup(reboot_channel, gpio.IN, pull_up_down=gpio.PUD_UP)
gpio.setup(shutdown_channel, gpio.IN, pull_up_down=gpio.PUD_UP)
# Handle keyboard break
# Stop light display
# Check on the state of the key
# Lower platform using motors
# Setup to handle keyboard interrupts (control-C)
signal.signal(signal.SIGINT, signal_handler)
# Initial state
lights = False
raising_platform = False
armed = gpio.input(key_channel)
gpio.output(armed_indicator_channel, gpio.input(key_channel))
gpio.output(activated_indicator_channel, gpio.LOW)
stop_motors()
stop_fan()
gpio.add_event_detect(key_channel, gpio.BOTH, callback=check_event, bouncetime=400)
gpio.add_event_detect(button_channel, gpio.RISING, callback=check_event, bouncetime=300)
gpio.add_event_detect(top_limit_channel, gpio.FALLING, callback=check_event, bouncetime=100)
gpio.add_event_detect(reboot_channel, gpio.FALLING, callback=check_event, bouncetime=300)
gpio.add_event_detect(shutdown_channel, gpio.FALLING, callback=check_event, bouncetime=300)
print("Make sure everything is reset at start")
stop_party()
while True:
# trying not to waste cycles on the pi
time.sleep(2)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
25812,
72,
13,
16960,
9399,
355,
27809,
952,
198,
11748,
28686,
198,
11748,
640,
198,
11748,
850,
14681,
198,
11748,
25064,
198,
11748,
6737,
198,
11748,
4704,
278,
198,
11748,
4818,
8079,
198,
198,
2,
14701,
6973,
198,
820,
62,
29048,
796,
4317,
198,
3847,
62,
29048,
796,
1802,
198,
198,
2,
6779,
3091,
24418,
198,
2539,
62,
17620,
796,
2534,
198,
16539,
62,
17620,
796,
767,
198,
12026,
62,
521,
26407,
62,
17620,
796,
220,
1248,
198,
33106,
62,
521,
26407,
62,
17620,
796,
2808,
220,
198,
198,
2,
12533,
24418,
198,
76,
20965,
16,
62,
17620,
796,
3439,
198,
76,
20965,
17,
62,
17620,
796,
3933,
198,
4852,
62,
32374,
62,
17620,
796,
4747,
198,
198,
2,
370,
36053,
370,
2830,
13145,
13836,
198,
24408,
62,
17620,
796,
2319,
198,
198,
2,
4482,
1630,
198,
260,
18769,
62,
17620,
796,
5214,
198,
49625,
2902,
62,
17620,
796,
4353,
198,
198,
2,
5345,
510,
50143,
198,
31197,
952,
13,
2617,
14171,
7,
31197,
952,
13,
8202,
9795,
8,
198,
198,
31197,
952,
13,
40406,
7,
16539,
62,
17620,
11,
27809,
952,
13,
1268,
11,
2834,
62,
929,
62,
2902,
28,
31197,
952,
13,
5105,
35,
62,
8577,
8,
198,
31197,
952,
13,
40406,
7,
2539,
62,
17620,
11,
27809,
952,
13,
1268,
11,
2834,
62,
929,
62,
2902,
28,
31197,
952,
13,
5105,
35,
62,
8577,
8,
198,
31197,
952,
13,
40406,
7,
12026,
62,
521,
26407,
62,
17620,
11,
27809,
952,
13,
12425,
8,
198,
31197,
952,
13,
40406,
7,
33106,
62,
521,
26407,
62,
17620,
11,
27809,
952,
13,
12425,
8,
198,
198,
31197,
952,
13,
40406,
7,
76,
20965,
16,
62,
17620,
11,
27809,
952,
13,
12425,
8,
198,
31197,
952,
13,
40406,
7,
76,
20965,
17,
62,
17620,
11,
27809,
952,
13,
12425,
8,
198,
31197,
952,
13,
40406,
7,
4852,
62,
32374,
62,
17620,
11,
27809,
952,
13,
1268,
11,
2834,
62,
929,
62,
2902,
28,
31197,
952,
13,
5105,
35,
62,
8577,
8,
198,
198,
31197,
952,
13,
40406,
7,
24408,
62,
17620,
11,
27809,
952,
13,
12425,
8,
198,
198,
31197,
952,
13,
40406,
7,
260,
18769,
62,
17620,
11,
27809,
952,
13,
1268,
11,
2834,
62,
929,
62,
2902,
28,
31197,
952,
13,
5105,
35,
62,
8577,
8,
198,
31197,
952,
13,
40406,
7,
49625,
2902,
62,
17620,
11,
27809,
952,
13,
1268,
11,
2834,
62,
929,
62,
2902,
28,
31197,
952,
13,
5105,
35,
62,
8577,
8,
628,
198,
2,
33141,
10586,
2270,
198,
198,
2,
13707,
1657,
3359,
628,
198,
2,
6822,
319,
262,
1181,
286,
262,
1994,
628,
628,
628,
198,
198,
2,
16048,
3859,
1262,
24699,
628,
628,
198,
2,
31122,
284,
5412,
10586,
48237,
357,
13716,
12,
34,
8,
198,
12683,
282,
13,
12683,
282,
7,
12683,
282,
13,
50,
3528,
12394,
11,
6737,
62,
30281,
8,
198,
198,
2,
20768,
1181,
198,
8091,
796,
10352,
198,
32741,
62,
24254,
796,
10352,
220,
198,
12026,
796,
27809,
952,
13,
15414,
7,
2539,
62,
17620,
8,
198,
31197,
952,
13,
22915,
7,
12026,
62,
521,
26407,
62,
17620,
11,
27809,
952,
13,
15414,
7,
2539,
62,
17620,
4008,
198,
31197,
952,
13,
22915,
7,
33106,
62,
521,
26407,
62,
17620,
11,
27809,
952,
13,
43,
3913,
8,
198,
198,
11338,
62,
27926,
669,
3419,
198,
11338,
62,
24408,
3419,
198,
198,
31197,
952,
13,
2860,
62,
15596,
62,
15255,
478,
7,
2539,
62,
17620,
11,
27809,
952,
13,
33,
26946,
11,
23838,
28,
9122,
62,
15596,
11,
31283,
66,
8079,
28,
7029,
8,
198,
31197,
952,
13,
2860,
62,
15596,
62,
15255,
478,
7,
16539,
62,
17620,
11,
27809,
952,
13,
49,
1797,
2751,
11,
23838,
28,
9122,
62,
15596,
11,
31283,
66,
8079,
28,
6200,
8,
198,
31197,
952,
13,
2860,
62,
15596,
62,
15255,
478,
7,
4852,
62,
32374,
62,
17620,
11,
27809,
952,
13,
37,
7036,
2751,
11,
23838,
28,
9122,
62,
15596,
11,
31283,
66,
8079,
28,
3064,
8,
198,
31197,
952,
13,
2860,
62,
15596,
62,
15255,
478,
7,
260,
18769,
62,
17620,
11,
27809,
952,
13,
37,
7036,
2751,
11,
23838,
28,
9122,
62,
15596,
11,
31283,
66,
8079,
28,
6200,
8,
198,
31197,
952,
13,
2860,
62,
15596,
62,
15255,
478,
7,
49625,
2902,
62,
17620,
11,
27809,
952,
13,
37,
7036,
2751,
11,
23838,
28,
9122,
62,
15596,
11,
31283,
66,
8079,
28,
6200,
8,
198,
198,
4798,
7203,
12050,
1654,
2279,
318,
13259,
379,
923,
4943,
198,
11338,
62,
10608,
3419,
628,
198,
4514,
6407,
25,
198,
220,
220,
220,
1303,
2111,
407,
284,
7030,
16006,
319,
262,
31028,
198,
220,
220,
220,
640,
13,
42832,
7,
17,
8,
628
] | 2.662835 | 783 |
"""Callbacks."""
import gin
from alpacka.agents.callbacks import graph_size_callback
# Configure callbacks in this module to ensure they're accessible via the
# alpacka.agents.callbacks.* namespace.
GraphSizeCallback = configure_callback(graph_size_callback.GraphSizeCallback) # pylint: disable=invalid-name
| [
37811,
14134,
10146,
526,
15931,
198,
198,
11748,
39733,
198,
198,
6738,
435,
8002,
64,
13,
49638,
13,
13345,
10146,
1330,
4823,
62,
7857,
62,
47423,
628,
198,
2,
17056,
495,
869,
10146,
287,
428,
8265,
284,
4155,
484,
821,
9857,
2884,
262,
198,
2,
435,
8002,
64,
13,
49638,
13,
13345,
10146,
15885,
25745,
13,
628,
198,
37065,
10699,
47258,
796,
17425,
62,
47423,
7,
34960,
62,
7857,
62,
47423,
13,
37065,
10699,
47258,
8,
220,
1303,
279,
2645,
600,
25,
15560,
28,
259,
12102,
12,
3672,
198
] | 3.539326 | 89 |
#!/bin/env python
# -*- coding: utf-8 -*-
# encoding=utf-8 vi:ts=4:sw=4:expandtab:ft=python
#======================================================================
#
# Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
#
#======================================================================
"""
@Desc: dist_base_fleet module
@File: dist_base_fleet.py
@Author: liangjinhua
@Date: 2019/8/26 19:21
"""
from __future__ import print_function
import paddle
import math
import time
import numpy as np
import paddle.fluid as fluid
import os
import sys
sys.path.append('./thirdparty/ctr')
import py_reader_generator as py_reader1
# from cts_test.dist_fleet.reader_generator import ctr_py_reader_generator as py_reader1
from dist_base_fleet import runtime_main
from dist_base_fleet import FleetDistRunnerBase
params = {
"is_first_trainer": True,
"model_path": "dist_model_ctr",
"is_pyreader_train": True,
"is_dataset_train": False
}
# Fix seed for test
fluid.default_startup_program().random_seed = 1
fluid.default_main_program().random_seed = 1
np.random.seed(1)
DATA_PATH = 'thirdparty/data/dist_data/ctr_data/part-100'
class TestDistCTR(FleetDistRunnerBase):
"""distCTR model."""
def input_data(self):
"""
def input data for ctr.
Returns:
list: The return value contains dense_input,sparse_input, label.
"""
dense_feature_dim = 13
self.dense_input = fluid.layers.data(
name="dense_input", shape=[dense_feature_dim], dtype='float32')
self.sparse_input_ids = [
fluid.layers.data(
name="C" + str(i), shape=[1], lod_level=1, dtype='int64')
for i in range(1, 27)
]
self.label = fluid.layers.data(name='label', shape=[1], dtype='int64')
self._words = [self.dense_input] + self.sparse_input_ids + [self.label]
return self._words
def py_reader(self):
"""get py_reader."""
py_reader = fluid.layers.create_py_reader_by_data(
capacity=64,
feed_list=self._words,
name='py_reader',
use_double_buffer=False)
return py_reader
def dataset_reader(self):
"""get dataset_reader."""
dataset = fluid.DatasetFactory().create_dataset()
dataset.set_use_var([self.dense_input] + self.sparse_input_ids +
[self.label])
pipe_command = "python ./thirdparty/ctr/dataset_generator.py"
dataset.set_pipe_command(pipe_command)
dataset.set_batch_size(4)
thread_num = int(2)
dataset.set_thread(thread_num)
return dataset
def net(self, args=None):
"""
ctr net struct.
Args:
args (ArgumentParser): run args to config dist fleet.
Returns:
A Variable holding Tensor representing the cross entropy,
whose data type is the same with input.
"""
self.inputs = self.input_data()
if not args.run_params.get("run_from_dataset", False):
self.pyreader = self.py_reader()
self.inputs = fluid.layers.read_file(self.pyreader)
sparse_feature_dim = 1000001
embedding_size = 10
words = self.inputs
sparse_embed_seq = list(map(embedding_layer, words[1:-1]))
concated = fluid.layers.concat(sparse_embed_seq + words[0:1], axis=1)
fc1 = fluid.layers.fc(input=concated,
size=400,
act='relu',
param_attr=fluid.ParamAttr(
initializer=fluid.initializer.Normal(
scale=1 / math.sqrt(concated.shape[1]))))
fc2 = fluid.layers.fc(input=fc1,
size=400,
act='relu',
param_attr=fluid.ParamAttr(
initializer=fluid.initializer.Normal(
scale=1 / math.sqrt(fc1.shape[1]))))
fc3 = fluid.layers.fc(input=fc2,
size=400,
act='relu',
param_attr=fluid.ParamAttr(
initializer=fluid.initializer.Normal(
scale=1 / math.sqrt(fc2.shape[1]))))
predict = fluid.layers.fc(input=fc3,
size=2,
act='softmax',
param_attr=fluid.ParamAttr(
initializer=fluid.initializer.Normal(
scale=1 / math.sqrt(fc3.shape[1]))))
cost = fluid.layers.cross_entropy(input=predict, label=words[-1])
self.avg_cost = fluid.layers.reduce_sum(cost)
accuracy = fluid.layers.accuracy(input=predict, label=words[-1])
auc_var, batch_auc_var, auc_states = \
fluid.layers.auc(input=predict, label=words[-1], num_thresholds=2 ** 12, slide_steps=20)
return self.avg_cost
def check_model_right(self, dirname):
"""
check model right.
Args:
dirname(str): model save dir
"""
model_filename = os.path.join(dirname, "__model__")
with open(model_filename, "rb") as f:
program_desc_str = f.read()
program = fluid.Program.parse_from_string(program_desc_str)
with open(os.path.join(dirname, "__model__.proto"), "w") as wn:
wn.write(str(program))
def do_training(self, fleet, args):
"""
training_from_pyreader
Args:
fleet (DistributedTranspiler): DistributedTranspiler inherited base class Fleet
args (ArgumentParser): run args to config dist fleet.
Returns:
list
"""
exe = fluid.Executor(fluid.CPUPlace())
fleet.init_worker()
exe.run(fleet.startup_program)
train_generator = py_reader1.CriteoDataset(1000001)
file_list = [str(DATA_PATH)] * 2
train_reader = paddle.batch(
train_generator.train(file_list, args.trainers, args.current_id),
batch_size=4)
self.pyreader.decorate_paddle_reader(train_reader)
if os.getenv("PADDLE_COMPATIBILITY_CHECK", False):
exec_strategy = fluid.ExecutionStrategy()
exec_strategy.num_threads = int(2)
build_strategy = fluid.BuildStrategy()
build_strategy.async_mode = self.async_mode
if args.run_params["sync_mode"] == "async":
build_strategy.memory_optimize = False
if args.run_params['cpu_num'] > 1:
build_strategy.reduce_strategy = fluid.BuildStrategy.ReduceStrategy.Reduce
else:
build_strategy = self.strategy.get_build_strategy()
if args.run_params["sync_mode"] == "async":
build_strategy.memory_optimize = False
self.strategy.set_build_strategy(build_strategy)
exec_strategy = self.strategy.get_execute_strategy()
compiled_prog = fluid.compiler.CompiledProgram(
fleet.main_program).with_data_parallel(
loss_name=self.avg_cost.name,
build_strategy=build_strategy,
exec_strategy=exec_strategy)
# Notice: py_reader should use try & catch EOFException method to enter the dataset
# reader.start() must declare in advance
self.pyreader.start()
train_info = []
batch_id = 0
try:
while True:
avg_cost = exe.run(program=compiled_prog,
fetch_list=[self.avg_cost.name])
avg_cost = np.mean(avg_cost)
train_info.append(avg_cost)
batch_id += 1
if params["is_first_trainer"]:
if params["is_pyreader_train"]:
model_path = str(params["model_path"] + "/final" +
"_pyreader")
fleet.save_persistables(
executor=fluid.Executor(fluid.CPUPlace()),
dirname=model_path)
elif params["is_dataset_train"]:
model_path = str(params["model_path"] + '/final' +
"_dataset")
fleet.save_persistables(
executor=fluid.Executor(fluid.CPUPlace()),
dirname=model_path)
else:
raise ValueError(
"Program must has Date feed method: is_pyreader_train / is_dataset_train"
)
if batch_id == 5:
break
except fluid.core.EOFException:
self.pyreader.reset()
fleet.stop_worker()
return train_info
def do_training_from_dataset(self, fleet, args):
"""
training_from_dataset
Args:
fleet (DistributedTranspiler):
args (ArgumentParser): run args to config dist fleet.
Returns:
list
"""
exe = fluid.Executor(fluid.CPUPlace())
fleet.init_worker()
exe.run(fleet.startup_program)
dataset = self.dataset_reader()
file_list = [str(DATA_PATH)] * 2
for epoch in range(1):
dataset.set_filelist(file_list)
var_dict = {"loss": self.avg_cost}
train_info = []
exe.train_from_dataset(
program=fleet.main_program,
dataset=dataset,
fetch_handler=FetchVars(var_dict))
return train_info
if __name__ == "__main__":
runtime_main(TestDistCTR)
| [
2,
48443,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
21004,
28,
40477,
12,
23,
25357,
25,
912,
28,
19,
25,
2032,
28,
19,
25,
11201,
392,
8658,
25,
701,
28,
29412,
198,
2,
23926,
50155,
198,
2,
198,
2,
15069,
357,
66,
8,
2177,
347,
1698,
84,
13,
785,
11,
3457,
13,
1439,
6923,
33876,
198,
2,
198,
2,
23926,
50155,
198,
37811,
198,
31,
24564,
25,
1233,
62,
8692,
62,
33559,
8265,
198,
31,
8979,
25,
1233,
62,
8692,
62,
33559,
13,
9078,
198,
31,
13838,
25,
7649,
648,
18594,
33061,
198,
31,
10430,
25,
13130,
14,
23,
14,
2075,
678,
25,
2481,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
39517,
198,
11748,
10688,
198,
11748,
640,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
39517,
13,
35522,
312,
355,
11711,
198,
11748,
28686,
198,
11748,
25064,
198,
17597,
13,
6978,
13,
33295,
7,
4458,
14,
17089,
10608,
14,
24087,
11537,
198,
11748,
12972,
62,
46862,
62,
8612,
1352,
355,
12972,
62,
46862,
16,
198,
2,
422,
269,
912,
62,
9288,
13,
17080,
62,
33559,
13,
46862,
62,
8612,
1352,
1330,
269,
2213,
62,
9078,
62,
46862,
62,
8612,
1352,
355,
12972,
62,
46862,
16,
198,
6738,
1233,
62,
8692,
62,
33559,
1330,
19124,
62,
12417,
198,
6738,
1233,
62,
8692,
62,
33559,
1330,
20001,
20344,
49493,
14881,
198,
198,
37266,
796,
1391,
198,
220,
220,
220,
366,
271,
62,
11085,
62,
2213,
10613,
1298,
6407,
11,
198,
220,
220,
220,
366,
19849,
62,
6978,
1298,
366,
17080,
62,
19849,
62,
24087,
1600,
198,
220,
220,
220,
366,
271,
62,
9078,
46862,
62,
27432,
1298,
6407,
11,
198,
220,
220,
220,
366,
271,
62,
19608,
292,
316,
62,
27432,
1298,
10352,
198,
92,
198,
198,
2,
13268,
9403,
329,
1332,
198,
35522,
312,
13,
12286,
62,
9688,
929,
62,
23065,
22446,
25120,
62,
28826,
796,
352,
198,
35522,
312,
13,
12286,
62,
12417,
62,
23065,
22446,
25120,
62,
28826,
796,
352,
198,
37659,
13,
25120,
13,
28826,
7,
16,
8,
198,
198,
26947,
62,
34219,
796,
705,
17089,
10608,
14,
7890,
14,
17080,
62,
7890,
14,
24087,
62,
7890,
14,
3911,
12,
3064,
6,
628,
198,
4871,
6208,
20344,
4177,
49,
7,
47669,
316,
20344,
49493,
14881,
2599,
198,
220,
220,
220,
37227,
17080,
4177,
49,
2746,
526,
15931,
628,
220,
220,
220,
825,
5128,
62,
7890,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
825,
5128,
1366,
329,
269,
2213,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1351,
25,
383,
1441,
1988,
4909,
15715,
62,
15414,
11,
82,
29572,
62,
15414,
11,
6167,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
15715,
62,
30053,
62,
27740,
796,
1511,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
67,
1072,
62,
15414,
796,
11711,
13,
75,
6962,
13,
7890,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
2625,
67,
1072,
62,
15414,
1600,
5485,
41888,
67,
1072,
62,
30053,
62,
27740,
4357,
288,
4906,
11639,
22468,
2624,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
82,
29572,
62,
15414,
62,
2340,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11711,
13,
75,
6962,
13,
7890,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
2625,
34,
1,
1343,
965,
7,
72,
828,
5485,
41888,
16,
4357,
19527,
62,
5715,
28,
16,
11,
288,
4906,
11639,
600,
2414,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
2837,
7,
16,
11,
2681,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
18242,
796,
11711,
13,
75,
6962,
13,
7890,
7,
3672,
11639,
18242,
3256,
5485,
41888,
16,
4357,
288,
4906,
11639,
600,
2414,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
10879,
796,
685,
944,
13,
67,
1072,
62,
15414,
60,
1343,
2116,
13,
82,
29572,
62,
15414,
62,
2340,
1343,
685,
944,
13,
18242,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
10879,
628,
220,
220,
220,
825,
12972,
62,
46862,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
1136,
12972,
62,
46862,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
12972,
62,
46862,
796,
11711,
13,
75,
6962,
13,
17953,
62,
9078,
62,
46862,
62,
1525,
62,
7890,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5339,
28,
2414,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3745,
62,
4868,
28,
944,
13557,
10879,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
11639,
9078,
62,
46862,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
779,
62,
23352,
62,
22252,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
12972,
62,
46862,
628,
220,
220,
220,
825,
27039,
62,
46862,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
1136,
27039,
62,
46862,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
27039,
796,
11711,
13,
27354,
292,
316,
22810,
22446,
17953,
62,
19608,
292,
316,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
27039,
13,
2617,
62,
1904,
62,
7785,
26933,
944,
13,
67,
1072,
62,
15414,
60,
1343,
2116,
13,
82,
29572,
62,
15414,
62,
2340,
1343,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
944,
13,
18242,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
12656,
62,
21812,
796,
366,
29412,
24457,
17089,
10608,
14,
24087,
14,
19608,
292,
316,
62,
8612,
1352,
13,
9078,
1,
198,
220,
220,
220,
220,
220,
220,
220,
27039,
13,
2617,
62,
34360,
62,
21812,
7,
34360,
62,
21812,
8,
198,
220,
220,
220,
220,
220,
220,
220,
27039,
13,
2617,
62,
43501,
62,
7857,
7,
19,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4704,
62,
22510,
796,
493,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
27039,
13,
2617,
62,
16663,
7,
16663,
62,
22510,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
27039,
628,
220,
220,
220,
825,
2010,
7,
944,
11,
26498,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
269,
2213,
2010,
2878,
13,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
357,
28100,
1713,
46677,
2599,
1057,
26498,
284,
4566,
1233,
11026,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
317,
35748,
4769,
309,
22854,
10200,
262,
3272,
40709,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3025,
1366,
2099,
318,
262,
976,
351,
5128,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15414,
82,
796,
2116,
13,
15414,
62,
7890,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
26498,
13,
5143,
62,
37266,
13,
1136,
7203,
5143,
62,
6738,
62,
19608,
292,
316,
1600,
10352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9078,
46862,
796,
2116,
13,
9078,
62,
46862,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15414,
82,
796,
11711,
13,
75,
6962,
13,
961,
62,
7753,
7,
944,
13,
9078,
46862,
8,
628,
220,
220,
220,
220,
220,
220,
220,
29877,
62,
30053,
62,
27740,
796,
1802,
18005,
198,
220,
220,
220,
220,
220,
220,
220,
11525,
12083,
62,
7857,
796,
838,
198,
220,
220,
220,
220,
220,
220,
220,
2456,
796,
2116,
13,
15414,
82,
628,
220,
220,
220,
220,
220,
220,
220,
29877,
62,
20521,
62,
41068,
796,
1351,
7,
8899,
7,
20521,
12083,
62,
29289,
11,
2456,
58,
16,
21912,
16,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1673,
515,
796,
11711,
13,
75,
6962,
13,
1102,
9246,
7,
82,
29572,
62,
20521,
62,
41068,
1343,
2456,
58,
15,
25,
16,
4357,
16488,
28,
16,
8,
628,
220,
220,
220,
220,
220,
220,
220,
277,
66,
16,
796,
11711,
13,
75,
6962,
13,
16072,
7,
15414,
28,
1102,
66,
515,
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,
2546,
28,
7029,
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,
719,
11639,
260,
2290,
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,
5772,
62,
35226,
28,
35522,
312,
13,
22973,
8086,
81,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4238,
7509,
28,
35522,
312,
13,
36733,
7509,
13,
26447,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5046,
28,
16,
1220,
10688,
13,
31166,
17034,
7,
1102,
66,
515,
13,
43358,
58,
16,
60,
35514,
198,
220,
220,
220,
220,
220,
220,
220,
277,
66,
17,
796,
11711,
13,
75,
6962,
13,
16072,
7,
15414,
28,
16072,
16,
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,
2546,
28,
7029,
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,
719,
11639,
260,
2290,
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,
5772,
62,
35226,
28,
35522,
312,
13,
22973,
8086,
81,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4238,
7509,
28,
35522,
312,
13,
36733,
7509,
13,
26447,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5046,
28,
16,
1220,
10688,
13,
31166,
17034,
7,
16072,
16,
13,
43358,
58,
16,
60,
35514,
198,
220,
220,
220,
220,
220,
220,
220,
277,
66,
18,
796,
11711,
13,
75,
6962,
13,
16072,
7,
15414,
28,
16072,
17,
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,
2546,
28,
7029,
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,
719,
11639,
260,
2290,
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,
5772,
62,
35226,
28,
35522,
312,
13,
22973,
8086,
81,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4238,
7509,
28,
35522,
312,
13,
36733,
7509,
13,
26447,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5046,
28,
16,
1220,
10688,
13,
31166,
17034,
7,
16072,
17,
13,
43358,
58,
16,
60,
35514,
198,
220,
220,
220,
220,
220,
220,
220,
4331,
796,
11711,
13,
75,
6962,
13,
16072,
7,
15414,
28,
16072,
18,
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,
2546,
28,
17,
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,
719,
11639,
4215,
9806,
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,
5772,
62,
35226,
28,
35522,
312,
13,
22973,
8086,
81,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4238,
7509,
28,
35522,
312,
13,
36733,
7509,
13,
26447,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5046,
28,
16,
1220,
10688,
13,
31166,
17034,
7,
16072,
18,
13,
43358,
58,
16,
60,
35514,
628,
220,
220,
220,
220,
220,
220,
220,
1575,
796,
11711,
13,
75,
6962,
13,
19692,
62,
298,
28338,
7,
15414,
28,
79,
17407,
11,
6167,
28,
10879,
58,
12,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
615,
70,
62,
15805,
796,
11711,
13,
75,
6962,
13,
445,
7234,
62,
16345,
7,
15805,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9922,
796,
11711,
13,
75,
6962,
13,
4134,
23843,
7,
15414,
28,
79,
17407,
11,
6167,
28,
10879,
58,
12,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
257,
1229,
62,
7785,
11,
15458,
62,
14272,
62,
7785,
11,
257,
1229,
62,
27219,
796,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11711,
13,
75,
6962,
13,
14272,
7,
15414,
28,
79,
17407,
11,
6167,
28,
10879,
58,
12,
16,
4357,
997,
62,
400,
10126,
82,
28,
17,
12429,
1105,
11,
10649,
62,
20214,
28,
1238,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
615,
70,
62,
15805,
628,
220,
220,
220,
825,
2198,
62,
19849,
62,
3506,
7,
944,
11,
26672,
3672,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
2746,
826,
13,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26672,
3672,
7,
2536,
2599,
2746,
3613,
26672,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
62,
34345,
796,
28686,
13,
6978,
13,
22179,
7,
15908,
3672,
11,
366,
834,
19849,
834,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
19849,
62,
34345,
11,
366,
26145,
4943,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1430,
62,
20147,
62,
2536,
796,
277,
13,
961,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1430,
796,
11711,
13,
15167,
13,
29572,
62,
6738,
62,
8841,
7,
23065,
62,
20147,
62,
2536,
8,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
418,
13,
6978,
13,
22179,
7,
15908,
3672,
11,
366,
834,
19849,
834,
13,
1676,
1462,
12340,
366,
86,
4943,
355,
266,
77,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
266,
77,
13,
13564,
7,
2536,
7,
23065,
4008,
628,
220,
220,
220,
825,
466,
62,
34409,
7,
944,
11,
11026,
11,
26498,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3047,
62,
6738,
62,
9078,
46862,
220,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11026,
357,
20344,
6169,
8291,
79,
5329,
2599,
4307,
6169,
8291,
79,
5329,
19552,
2779,
1398,
20001,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
357,
28100,
1713,
46677,
2599,
1057,
26498,
284,
4566,
1233,
11026,
13,
220,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
409,
68,
796,
11711,
13,
23002,
38409,
7,
35522,
312,
13,
36037,
27271,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
11026,
13,
15003,
62,
28816,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
409,
68,
13,
5143,
7,
33559,
13,
9688,
929,
62,
23065,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
8612,
1352,
796,
12972,
62,
46862,
16,
13,
34,
6525,
78,
27354,
292,
316,
7,
49388,
486,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
4868,
796,
685,
2536,
7,
26947,
62,
34219,
15437,
1635,
362,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
46862,
796,
39517,
13,
43501,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
8612,
1352,
13,
27432,
7,
7753,
62,
4868,
11,
26498,
13,
27432,
364,
11,
26498,
13,
14421,
62,
312,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
7857,
28,
19,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9078,
46862,
13,
12501,
16262,
62,
79,
37382,
62,
46862,
7,
27432,
62,
46862,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
28686,
13,
1136,
24330,
7203,
47,
29266,
2538,
62,
9858,
47,
1404,
40,
25382,
62,
50084,
1600,
10352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2452,
62,
2536,
4338,
796,
11711,
13,
23002,
1009,
13290,
4338,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2452,
62,
2536,
4338,
13,
22510,
62,
16663,
82,
796,
493,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1382,
62,
2536,
4338,
796,
11711,
13,
15580,
13290,
4338,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1382,
62,
2536,
4338,
13,
292,
13361,
62,
14171,
796,
2116,
13,
292,
13361,
62,
14171,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
26498,
13,
5143,
62,
37266,
14692,
27261,
62,
14171,
8973,
6624,
366,
292,
13361,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1382,
62,
2536,
4338,
13,
31673,
62,
40085,
1096,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
26498,
13,
5143,
62,
37266,
17816,
36166,
62,
22510,
20520,
1875,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1382,
62,
2536,
4338,
13,
445,
7234,
62,
2536,
4338,
796,
11711,
13,
15580,
13290,
4338,
13,
7738,
7234,
13290,
4338,
13,
7738,
7234,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1382,
62,
2536,
4338,
796,
2116,
13,
2536,
4338,
13,
1136,
62,
11249,
62,
2536,
4338,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
26498,
13,
5143,
62,
37266,
14692,
27261,
62,
14171,
8973,
6624,
366,
292,
13361,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1382,
62,
2536,
4338,
13,
31673,
62,
40085,
1096,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2536,
4338,
13,
2617,
62,
11249,
62,
2536,
4338,
7,
11249,
62,
2536,
4338,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2452,
62,
2536,
4338,
796,
2116,
13,
2536,
4338,
13,
1136,
62,
41049,
62,
2536,
4338,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
14102,
62,
1676,
70,
796,
11711,
13,
5589,
5329,
13,
7293,
3902,
15167,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11026,
13,
12417,
62,
23065,
737,
4480,
62,
7890,
62,
1845,
29363,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2994,
62,
3672,
28,
944,
13,
615,
70,
62,
15805,
13,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1382,
62,
2536,
4338,
28,
11249,
62,
2536,
4338,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2452,
62,
2536,
4338,
28,
18558,
62,
2536,
4338,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
17641,
25,
12972,
62,
46862,
815,
779,
1949,
1222,
4929,
412,
19238,
16922,
2446,
284,
3802,
262,
27039,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
9173,
13,
9688,
3419,
1276,
13627,
287,
5963,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9078,
46862,
13,
9688,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
10951,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
312,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42781,
62,
15805,
796,
409,
68,
13,
5143,
7,
23065,
28,
5589,
3902,
62,
1676,
70,
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,
21207,
62,
4868,
41888,
944,
13,
615,
70,
62,
15805,
13,
3672,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42781,
62,
15805,
796,
45941,
13,
32604,
7,
615,
70,
62,
15805,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
10951,
13,
33295,
7,
615,
70,
62,
15805,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
312,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
42287,
14692,
271,
62,
11085,
62,
2213,
10613,
1,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
42287,
14692,
271,
62,
9078,
46862,
62,
27432,
1,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
62,
6978,
796,
965,
7,
37266,
14692,
19849,
62,
6978,
8973,
1343,
12813,
20311,
1,
1343,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45434,
9078,
46862,
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,
11026,
13,
21928,
62,
19276,
396,
2977,
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,
3121,
273,
28,
35522,
312,
13,
23002,
38409,
7,
35522,
312,
13,
36037,
27271,
3419,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26672,
3672,
28,
19849,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
42287,
14692,
271,
62,
19608,
292,
316,
62,
27432,
1,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
62,
6978,
796,
965,
7,
37266,
14692,
19849,
62,
6978,
8973,
1343,
31051,
20311,
6,
1343,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45434,
19608,
292,
316,
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,
11026,
13,
21928,
62,
19276,
396,
2977,
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,
3121,
273,
28,
35522,
312,
13,
23002,
38409,
7,
35522,
312,
13,
36037,
27271,
3419,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26672,
3672,
28,
19849,
62,
6978,
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,
5298,
11052,
12331,
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,
366,
15167,
1276,
468,
7536,
3745,
2446,
25,
318,
62,
9078,
46862,
62,
27432,
1220,
318,
62,
19608,
292,
316,
62,
27432,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
15458,
62,
312,
6624,
642,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
11711,
13,
7295,
13,
4720,
37,
16922,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9078,
46862,
13,
42503,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
11026,
13,
11338,
62,
28816,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4512,
62,
10951,
628,
220,
220,
220,
825,
466,
62,
34409,
62,
6738,
62,
19608,
292,
316,
7,
944,
11,
11026,
11,
26498,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3047,
62,
6738,
62,
19608,
292,
316,
220,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11026,
357,
20344,
6169,
8291,
79,
5329,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
357,
28100,
1713,
46677,
2599,
1057,
26498,
284,
4566,
1233,
11026,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
409,
68,
796,
11711,
13,
23002,
38409,
7,
35522,
312,
13,
36037,
27271,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
11026,
13,
15003,
62,
28816,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
409,
68,
13,
5143,
7,
33559,
13,
9688,
929,
62,
23065,
8,
198,
220,
220,
220,
220,
220,
220,
220,
27039,
796,
2116,
13,
19608,
292,
316,
62,
46862,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
4868,
796,
685,
2536,
7,
26947,
62,
34219,
15437,
1635,
362,
198,
220,
220,
220,
220,
220,
220,
220,
329,
36835,
287,
2837,
7,
16,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27039,
13,
2617,
62,
7753,
4868,
7,
7753,
62,
4868,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1401,
62,
11600,
796,
19779,
22462,
1298,
2116,
13,
615,
70,
62,
15805,
92,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
10951,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
409,
68,
13,
27432,
62,
6738,
62,
19608,
292,
316,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1430,
28,
33559,
13,
12417,
62,
23065,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27039,
28,
19608,
292,
316,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21207,
62,
30281,
28,
37,
7569,
53,
945,
7,
7785,
62,
11600,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
4512,
62,
10951,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
19124,
62,
12417,
7,
14402,
20344,
4177,
49,
8,
198
] | 1.933229 | 5,122 |
# -*- 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.
# --------------------------------------------------------------------------------------------
import pytest
import time
from azure.iot.common.sastoken import SasToken, SasTokenError
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
16529,
1783,
10541,
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,
16529,
1783,
10541,
198,
198,
11748,
12972,
9288,
198,
11748,
640,
198,
6738,
35560,
495,
13,
5151,
13,
11321,
13,
82,
459,
4233,
1330,
23771,
30642,
11,
23771,
30642,
12331,
628,
198
] | 5.411765 | 85 |
#!/usr/bin/env python
# encoding: utf-8
#
# This file is part of graphics-lib.
#
# Copyright (c) 2020, 2021, 2022 Bernardo Fichera <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from waflib.Configure import conf
from utils import check_include, check_lib
@conf
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
21004,
25,
3384,
69,
12,
23,
198,
2,
198,
2,
220,
220,
220,
770,
2393,
318,
636,
286,
9382,
12,
8019,
13,
198,
2,
198,
2,
220,
220,
220,
15069,
357,
66,
8,
12131,
11,
33448,
11,
33160,
6206,
13109,
376,
291,
372,
64,
1279,
33900,
13109,
13,
69,
291,
372,
64,
31,
14816,
13,
785,
29,
198,
2,
198,
2,
220,
220,
220,
2448,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
4866,
198,
2,
220,
220,
220,
286,
428,
3788,
290,
3917,
10314,
3696,
357,
1169,
366,
25423,
12340,
284,
1730,
198,
2,
220,
220,
220,
287,
262,
10442,
1231,
17504,
11,
1390,
1231,
17385,
262,
2489,
198,
2,
220,
220,
220,
284,
779,
11,
4866,
11,
13096,
11,
20121,
11,
7715,
11,
14983,
11,
850,
43085,
11,
290,
14,
273,
3677,
198,
2,
220,
220,
220,
9088,
286,
262,
10442,
11,
290,
284,
8749,
6506,
284,
4150,
262,
10442,
318,
198,
2,
220,
220,
220,
30760,
284,
466,
523,
11,
2426,
284,
262,
1708,
3403,
25,
198,
2,
198,
2,
220,
220,
220,
383,
2029,
6634,
4003,
290,
428,
7170,
4003,
2236,
307,
3017,
287,
477,
198,
2,
220,
220,
220,
9088,
393,
8904,
16690,
286,
262,
10442,
13,
198,
2,
198,
2,
220,
220,
220,
3336,
47466,
3180,
36592,
2389,
1961,
366,
1921,
3180,
1600,
42881,
34764,
56,
3963,
15529,
509,
12115,
11,
7788,
32761,
6375,
198,
2,
220,
220,
220,
8959,
49094,
11,
47783,
2751,
21728,
5626,
40880,
5390,
3336,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
11,
198,
2,
220,
220,
220,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
44521,
1268,
10913,
2751,
12529,
13,
3268,
8005,
49261,
50163,
3336,
198,
2,
220,
220,
220,
37195,
20673,
6375,
27975,
38162,
9947,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
198,
2,
220,
220,
220,
43031,
25382,
11,
7655,
2767,
16879,
3268,
3537,
40282,
3963,
27342,
10659,
11,
309,
9863,
6375,
25401,
54,
24352,
11,
5923,
1797,
2751,
16034,
11,
198,
2,
220,
220,
220,
16289,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
47466,
6375,
3336,
23210,
6375,
25401,
5550,
1847,
20754,
3268,
3336,
198,
2,
220,
220,
220,
47466,
13,
198,
198,
6738,
266,
1878,
8019,
13,
16934,
495,
1330,
1013,
198,
6738,
3384,
4487,
1330,
2198,
62,
17256,
11,
2198,
62,
8019,
628,
198,
198,
31,
10414,
628
] | 3.283293 | 413 |
# coding: utf-8
import pytest
from pytest import approx
import numpy as np
from ....types.angle import Bearing
from ....types.array import StateVector, CovarianceMatrix
from ....types.detection import Detection
from ....types.state import State
from ..linear import LinearGaussian
from ..nonlinear import (
CombinedReversibleGaussianMeasurementModel, CartesianToBearingRange)
@pytest.fixture(scope="module")
| [
2,
19617,
25,
3384,
69,
12,
23,
198,
11748,
12972,
9288,
198,
6738,
12972,
9288,
1330,
5561,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
19424,
19199,
13,
9248,
1330,
28834,
198,
6738,
19424,
19199,
13,
18747,
1330,
1812,
38469,
11,
39751,
2743,
590,
46912,
198,
6738,
19424,
19199,
13,
15255,
3213,
1330,
46254,
198,
6738,
19424,
19199,
13,
5219,
1330,
1812,
198,
6738,
11485,
29127,
1330,
44800,
35389,
31562,
198,
6738,
11485,
13159,
29127,
1330,
357,
198,
220,
220,
220,
32028,
3041,
37393,
35389,
31562,
47384,
434,
17633,
11,
13690,
35610,
2514,
33,
6648,
17257,
8,
628,
198,
31,
9078,
9288,
13,
69,
9602,
7,
29982,
2625,
21412,
4943,
628,
628,
628,
628,
628
] | 3.655172 | 116 |
from flask import Flask,render_template,url_for,request
import pandas as pd
import pickle
import traceback
import ast
import sklearn
import xgboost
pickledModel = pickle.load(open('../app/public/latePaymentsModel.pkl','rb'))
app = Flask(__name__)
@app.route('/')
@app.route('/process',methods=["POST"])
if __name__ == '__main__':
app.run(debug=True)
| [
6738,
42903,
1330,
46947,
11,
13287,
62,
28243,
11,
6371,
62,
1640,
11,
25927,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
2298,
293,
198,
11748,
12854,
1891,
198,
11748,
6468,
198,
11748,
1341,
35720,
198,
11748,
2124,
70,
39521,
198,
27729,
992,
17633,
796,
2298,
293,
13,
2220,
7,
9654,
10786,
40720,
1324,
14,
11377,
14,
17660,
19197,
902,
17633,
13,
79,
41582,
41707,
26145,
6,
4008,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
198,
31,
1324,
13,
38629,
10786,
14,
11537,
198,
198,
31,
1324,
13,
38629,
10786,
14,
14681,
3256,
24396,
82,
28,
14692,
32782,
8973,
8,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
197,
1324,
13,
5143,
7,
24442,
28,
17821,
8,
198
] | 2.795276 | 127 |
"""OwnYourResponses: turns likes, replies, etc. into posts on your web site.
Polls your social network activity and creates new posts on your web site (via
Micropub) for public Facebook comments and likes, Instagram likes, and Twitter
@-replies, retweets, and favorites.
"""
import logging
import json
import urllib.error, urllib.parse, urllib.request
from flask import Flask
from google.cloud import ndb
from granary import (
facebook,
instagram,
microformats2,
source as gr_source,
twitter,
)
from oauth_dropins.webutil import (
appengine_info,
appengine_config,
flask_util,
util,
)
from oauth_dropins.webutil.util import json_loads
# Change this to your web site's Micropub endpoint.
# https://indiewebcamp.com/micropub
if appengine_config.DEBUG:
MICROPUB_ENDPOINT = 'http://localhost/wp-json/micropub/1.0/endpoint'
MICROPUB_ACCESS_TOKEN = util.read('micropub_access_token_local')
else:
MICROPUB_ENDPOINT = 'https://snarfed.org/wp-json/micropub/1.0/endpoint'
MICROPUB_ACCESS_TOKEN = util.read('micropub_access_token')
# ActivityStreams objectTypes and verbs to create posts for. You can add or
# remove types here to control what gets posted to your site.
TYPES = ('like', 'comment', 'share', 'rsvp-yes', 'rsvp-no', 'rsvp-maybe')
# The category to include with each response type. If you don't want categories
# for any (or all) types, just remove them.
CATEGORIES = {
'like': 'like',
'comment': 'reply',
'share': 'repost',
'rsvp-yes': 'rsvp',
'rsvp-no': 'rsvp',
'rsvp-maybe': 'rsvp',
}
FACEBOOK_ACCESS_TOKEN = util.read('facebook_access_token')
INSTAGRAM_ACCESS_TOKEN = util.read('instagram_access_token')
TWITTER_ACCESS_TOKEN = util.read('twitter_access_token')
TWITTER_ACCESS_TOKEN_SECRET = util.read('twitter_access_token_secret')
TWITTER_SCRAPE_HEADERS = json_loads(util.read('twitter_scrape_headers.schnarfed.json'))
# Flask app
app = Flask('bridgy-fed')
app.template_folder = './templates'
app.config.from_mapping(
ENV='development' if appengine_info.DEBUG else 'PRODUCTION',
CACHE_TYPE='SimpleCache',
SECRET_KEY=util.read('flask_secret_key'),
JSONIFY_PRETTYPRINT_REGULAR=True,
)
app.register_error_handler(Exception, flask_util.handle_exception)
app.wsgi_app = flask_util.ndb_context_middleware(
app.wsgi_app, client=appengine_config.ndb_client)
class Response(ndb.Model):
"""Key name is ActivityStreams activity id."""
activity_json = ndb.TextProperty(required=True)
post_url = ndb.TextProperty()
response_body = ndb.TextProperty()
status = ndb.StringProperty(choices=('started', 'complete'), default='started')
created = ndb.DateTimeProperty(auto_now_add=True)
updated = ndb.DateTimeProperty(auto_now=True)
@app.route('/cron/poll')
def poll():
"""Poll handler for cron job."""
# if FACEBOOK_ACCESS_TOKEN:
# sources.append(facebook.Facebook(FACEBOOK_ACCESS_TOKEN))
# if INSTAGRAM_ACCESS_TOKEN:
# sources.append(instagram.Instagram(INSTAGRAM_ACCESS_TOKEN))
source = twitter.Twitter(TWITTER_ACCESS_TOKEN,
TWITTER_ACCESS_TOKEN_SECRET,
scrape_headers=TWITTER_SCRAPE_HEADERS)
activities = source.get_activities(group_id=gr_source.SELF, fetch_likes=True)
resps = ndb.get_multi(ndb.Key('Response', util.trim_nulls(a['id']))
for a in activities)
resps = {r.key.id(): r for r in resps if r}
exception = None
for activity in activities:
obj = activity.get('object', {})
# have we already posted or started on this response?
resp = resps.get(activity['id'])
mf2 = microformats2.object_to_json(activity)
mf2_props = microformats2.first_props(mf2.get('properties', {}))
type = gr_source.object_type(activity)
if mf2_props.get('in-reply-to'):
type = 'comment' # twitter reply
if type not in TYPES or (resp and resp.status == 'complete'):
continue
elif resp:
logging.info('Retrying %s', resp)
else:
resp = Response.get_or_insert(activity['id'],
activity_json=json.dumps(activity))
logging.info('Created new Response: %s', resp)
base_id = source.base_object(activity)['id']
base = source.get_activities(activity_id=base_id)[0]
# logging.info(json.dumps(base, indent=2))
# make micropub call to create post
# http://indiewebcamp.com/micropub
#
# include access token in both header and post body for compatibility
# with servers that only support one or the other (for whatever reason).
headers = {'Authorization': 'Bearer ' + MICROPUB_ACCESS_TOKEN}
data = {
'access_token': MICROPUB_ACCESS_TOKEN,
'h': 'entry',
'category[]': CATEGORIES.get(type),
'content[html]': render(source, activity, base),
'name': base.get('content') or base.get('object', {}).get('content'),
}
for key in 'in-reply-to', 'like-of', 'repost-of', 'published', 'updated':
val = mf2_props.get(key)
if val:
data[key] = microformats2.get_string_urls([val])[0]
try:
result = urlopen(MICROPUB_ENDPOINT, util.trim_nulls(data), headers=headers)
except urllib.error.HTTPError as exception:
logging.exception('%s %s', exception.reason, exception.read())
continue
except urllib.error.URLError as exception:
logging.exception(exception.reason)
continue
resp.post_url = result.info().get('Location')
logging.info('Created new post: %s', resp.post_url)
resp.response_body = result.read()
logging.info('Response body: %s', resp.response_body)
resp.status = 'complete'
resp.put()
# uncomment for testing
# return
# end loop over activities
return ('Failed, see logs', 500) if exception else 'OK'
| [
37811,
23858,
7120,
19309,
684,
274,
25,
4962,
7832,
11,
20616,
11,
3503,
13,
656,
6851,
319,
534,
3992,
2524,
13,
198,
198,
47,
33421,
534,
1919,
3127,
3842,
290,
8075,
649,
6851,
319,
534,
3992,
2524,
357,
8869,
198,
25437,
1773,
549,
8,
329,
1171,
3203,
3651,
290,
7832,
11,
10767,
7832,
11,
290,
3009,
198,
31,
12,
35666,
444,
11,
1005,
732,
1039,
11,
290,
18852,
13,
198,
37811,
198,
11748,
18931,
198,
11748,
33918,
198,
11748,
2956,
297,
571,
13,
18224,
11,
2956,
297,
571,
13,
29572,
11,
2956,
297,
571,
13,
25927,
198,
198,
6738,
42903,
1330,
46947,
198,
6738,
23645,
13,
17721,
1330,
299,
9945,
198,
6738,
19468,
560,
1330,
357,
198,
220,
23960,
11,
198,
220,
916,
6713,
11,
198,
220,
4580,
687,
1381,
17,
11,
198,
220,
2723,
355,
1036,
62,
10459,
11,
198,
220,
17044,
11,
198,
8,
198,
6738,
267,
18439,
62,
14781,
1040,
13,
732,
4360,
346,
1330,
357,
198,
220,
220,
220,
598,
18392,
62,
10951,
11,
198,
220,
220,
220,
598,
18392,
62,
11250,
11,
198,
220,
220,
220,
42903,
62,
22602,
11,
198,
220,
220,
220,
7736,
11,
198,
8,
198,
6738,
267,
18439,
62,
14781,
1040,
13,
732,
4360,
346,
13,
22602,
1330,
33918,
62,
46030,
198,
198,
2,
9794,
428,
284,
534,
3992,
2524,
338,
7631,
1773,
549,
36123,
13,
198,
2,
3740,
1378,
521,
769,
1765,
16544,
13,
785,
14,
9383,
1773,
549,
198,
361,
598,
18392,
62,
11250,
13,
30531,
25,
198,
220,
35878,
49,
3185,
10526,
62,
1677,
6322,
46,
12394,
796,
705,
4023,
1378,
36750,
14,
24142,
12,
17752,
14,
9383,
1773,
549,
14,
16,
13,
15,
14,
437,
4122,
6,
198,
220,
35878,
49,
3185,
10526,
62,
26861,
7597,
62,
10468,
43959,
796,
7736,
13,
961,
10786,
9383,
1773,
549,
62,
15526,
62,
30001,
62,
12001,
11537,
198,
17772,
25,
198,
220,
35878,
49,
3185,
10526,
62,
1677,
6322,
46,
12394,
796,
705,
5450,
1378,
16184,
283,
19082,
13,
2398,
14,
24142,
12,
17752,
14,
9383,
1773,
549,
14,
16,
13,
15,
14,
437,
4122,
6,
198,
220,
35878,
49,
3185,
10526,
62,
26861,
7597,
62,
10468,
43959,
796,
7736,
13,
961,
10786,
9383,
1773,
549,
62,
15526,
62,
30001,
11537,
198,
198,
2,
24641,
12124,
82,
2134,
31431,
290,
41781,
284,
2251,
6851,
329,
13,
921,
460,
751,
393,
198,
2,
4781,
3858,
994,
284,
1630,
644,
3011,
4481,
284,
534,
2524,
13,
198,
9936,
47,
1546,
796,
19203,
2339,
3256,
705,
23893,
3256,
705,
20077,
3256,
705,
3808,
36133,
12,
8505,
3256,
705,
3808,
36133,
12,
3919,
3256,
705,
3808,
36133,
12,
25991,
11537,
198,
198,
2,
383,
6536,
284,
2291,
351,
1123,
2882,
2099,
13,
1002,
345,
836,
470,
765,
9376,
198,
2,
329,
597,
357,
273,
477,
8,
3858,
11,
655,
4781,
606,
13,
198,
34,
6158,
38,
1581,
11015,
796,
1391,
198,
220,
705,
2339,
10354,
705,
2339,
3256,
198,
220,
705,
23893,
10354,
705,
47768,
3256,
198,
220,
705,
20077,
10354,
705,
260,
7353,
3256,
198,
220,
705,
3808,
36133,
12,
8505,
10354,
705,
3808,
36133,
3256,
198,
220,
705,
3808,
36133,
12,
3919,
10354,
705,
3808,
36133,
3256,
198,
220,
705,
3808,
36133,
12,
25991,
10354,
705,
3808,
36133,
3256,
198,
92,
198,
198,
49836,
39453,
62,
26861,
7597,
62,
10468,
43959,
796,
7736,
13,
961,
10786,
19024,
62,
15526,
62,
30001,
11537,
198,
38604,
4760,
24115,
62,
26861,
7597,
62,
10468,
43959,
796,
7736,
13,
961,
10786,
8625,
6713,
62,
15526,
62,
30001,
11537,
198,
34551,
2043,
5781,
62,
26861,
7597,
62,
10468,
43959,
796,
7736,
13,
961,
10786,
6956,
62,
15526,
62,
30001,
11537,
198,
34551,
2043,
5781,
62,
26861,
7597,
62,
10468,
43959,
62,
23683,
26087,
796,
7736,
13,
961,
10786,
6956,
62,
15526,
62,
30001,
62,
21078,
11537,
198,
34551,
2043,
5781,
62,
6173,
49,
45721,
62,
37682,
4877,
796,
33918,
62,
46030,
7,
22602,
13,
961,
10786,
6956,
62,
1416,
13484,
62,
50145,
13,
82,
1349,
283,
19082,
13,
17752,
6,
4008,
628,
198,
2,
46947,
598,
198,
1324,
796,
46947,
10786,
10236,
1360,
12,
19082,
11537,
198,
1324,
13,
28243,
62,
43551,
796,
705,
19571,
11498,
17041,
6,
198,
1324,
13,
11250,
13,
6738,
62,
76,
5912,
7,
198,
220,
220,
220,
12964,
53,
11639,
31267,
6,
611,
598,
18392,
62,
10951,
13,
30531,
2073,
705,
4805,
28644,
2849,
3256,
198,
220,
220,
220,
327,
2246,
13909,
62,
25216,
11639,
26437,
30562,
3256,
198,
220,
220,
220,
10729,
26087,
62,
20373,
28,
22602,
13,
961,
10786,
2704,
2093,
62,
21078,
62,
2539,
33809,
198,
220,
220,
220,
19449,
5064,
56,
62,
47,
26087,
9936,
4805,
12394,
62,
31553,
37232,
28,
17821,
11,
198,
8,
198,
1324,
13,
30238,
62,
18224,
62,
30281,
7,
16922,
11,
42903,
62,
22602,
13,
28144,
62,
1069,
4516,
8,
198,
198,
1324,
13,
18504,
12397,
62,
1324,
796,
42903,
62,
22602,
13,
358,
65,
62,
22866,
62,
27171,
1574,
7,
198,
220,
220,
220,
598,
13,
18504,
12397,
62,
1324,
11,
5456,
28,
1324,
18392,
62,
11250,
13,
358,
65,
62,
16366,
8,
628,
198,
4871,
18261,
7,
358,
65,
13,
17633,
2599,
198,
220,
37227,
9218,
1438,
318,
24641,
12124,
82,
3842,
4686,
526,
15931,
198,
220,
3842,
62,
17752,
796,
299,
9945,
13,
8206,
21746,
7,
35827,
28,
17821,
8,
198,
220,
1281,
62,
6371,
796,
299,
9945,
13,
8206,
21746,
3419,
198,
220,
2882,
62,
2618,
796,
299,
9945,
13,
8206,
21746,
3419,
198,
220,
3722,
796,
299,
9945,
13,
10100,
21746,
7,
6679,
1063,
28,
10786,
46981,
3256,
705,
20751,
33809,
4277,
11639,
46981,
11537,
198,
220,
2727,
796,
299,
9945,
13,
10430,
7575,
21746,
7,
23736,
62,
2197,
62,
2860,
28,
17821,
8,
198,
220,
6153,
796,
299,
9945,
13,
10430,
7575,
21746,
7,
23736,
62,
2197,
28,
17821,
8,
628,
198,
31,
1324,
13,
38629,
10786,
14,
66,
1313,
14,
30393,
11537,
198,
4299,
3278,
33529,
198,
220,
37227,
39176,
21360,
329,
1067,
261,
1693,
526,
15931,
198,
220,
1303,
611,
46587,
39453,
62,
26861,
7597,
62,
10468,
43959,
25,
198,
220,
1303,
220,
220,
4237,
13,
33295,
7,
19024,
13,
12025,
7,
49836,
39453,
62,
26861,
7597,
62,
10468,
43959,
4008,
198,
220,
1303,
611,
40589,
4760,
24115,
62,
26861,
7597,
62,
10468,
43959,
25,
198,
220,
1303,
220,
220,
4237,
13,
33295,
7,
8625,
6713,
13,
6310,
6713,
7,
38604,
4760,
24115,
62,
26861,
7597,
62,
10468,
43959,
4008,
198,
220,
2723,
796,
17044,
13,
14254,
7,
34551,
2043,
5781,
62,
26861,
7597,
62,
10468,
43959,
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,
17306,
2043,
5781,
62,
26861,
7597,
62,
10468,
43959,
62,
23683,
26087,
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,
42778,
62,
50145,
28,
34551,
2043,
5781,
62,
6173,
49,
45721,
62,
37682,
4877,
8,
628,
220,
4568,
796,
2723,
13,
1136,
62,
15791,
871,
7,
8094,
62,
312,
28,
2164,
62,
10459,
13,
50,
37738,
11,
21207,
62,
75,
7938,
28,
17821,
8,
198,
220,
581,
862,
796,
299,
9945,
13,
1136,
62,
41684,
7,
358,
65,
13,
9218,
10786,
31077,
3256,
7736,
13,
2213,
320,
62,
8423,
82,
7,
64,
17816,
312,
20520,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
257,
287,
4568,
8,
198,
220,
581,
862,
796,
1391,
81,
13,
2539,
13,
312,
33529,
374,
329,
374,
287,
581,
862,
611,
374,
92,
628,
220,
6631,
796,
6045,
198,
220,
329,
3842,
287,
4568,
25,
198,
220,
220,
220,
26181,
796,
3842,
13,
1136,
10786,
15252,
3256,
23884,
8,
628,
220,
220,
220,
1303,
423,
356,
1541,
4481,
393,
2067,
319,
428,
2882,
30,
198,
220,
220,
220,
1217,
796,
581,
862,
13,
1136,
7,
21797,
17816,
312,
6,
12962,
198,
220,
220,
220,
285,
69,
17,
796,
4580,
687,
1381,
17,
13,
15252,
62,
1462,
62,
17752,
7,
21797,
8,
198,
220,
220,
220,
285,
69,
17,
62,
1676,
862,
796,
4580,
687,
1381,
17,
13,
11085,
62,
1676,
862,
7,
76,
69,
17,
13,
1136,
10786,
48310,
3256,
23884,
4008,
198,
220,
220,
220,
2099,
796,
1036,
62,
10459,
13,
15252,
62,
4906,
7,
21797,
8,
628,
220,
220,
220,
611,
285,
69,
17,
62,
1676,
862,
13,
1136,
10786,
259,
12,
47768,
12,
1462,
6,
2599,
198,
220,
220,
220,
220,
220,
2099,
796,
705,
23893,
6,
220,
1303,
17044,
10971,
198,
220,
220,
220,
611,
2099,
407,
287,
24412,
47,
1546,
393,
357,
4363,
290,
1217,
13,
13376,
6624,
705,
20751,
6,
2599,
198,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
1288,
361,
1217,
25,
198,
220,
220,
220,
220,
220,
18931,
13,
10951,
10786,
9781,
14992,
4064,
82,
3256,
1217,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
1217,
796,
18261,
13,
1136,
62,
273,
62,
28463,
7,
21797,
17816,
312,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3842,
62,
17752,
28,
17752,
13,
67,
8142,
7,
21797,
4008,
198,
220,
220,
220,
220,
220,
18931,
13,
10951,
10786,
41972,
649,
18261,
25,
4064,
82,
3256,
1217,
8,
628,
220,
220,
220,
2779,
62,
312,
796,
2723,
13,
8692,
62,
15252,
7,
21797,
8,
17816,
312,
20520,
198,
220,
220,
220,
2779,
796,
2723,
13,
1136,
62,
15791,
871,
7,
21797,
62,
312,
28,
8692,
62,
312,
38381,
15,
60,
198,
220,
220,
220,
1303,
18931,
13,
10951,
7,
17752,
13,
67,
8142,
7,
8692,
11,
33793,
28,
17,
4008,
628,
220,
220,
220,
1303,
787,
12314,
1773,
549,
869,
284,
2251,
1281,
198,
220,
220,
220,
1303,
2638,
1378,
521,
769,
1765,
16544,
13,
785,
14,
9383,
1773,
549,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
2291,
1895,
11241,
287,
1111,
13639,
290,
1281,
1767,
329,
17764,
198,
220,
220,
220,
1303,
351,
9597,
326,
691,
1104,
530,
393,
262,
584,
357,
1640,
4232,
1738,
737,
198,
220,
220,
220,
24697,
796,
1391,
6,
13838,
1634,
10354,
705,
3856,
11258,
705,
1343,
35878,
49,
3185,
10526,
62,
26861,
7597,
62,
10468,
43959,
92,
198,
220,
220,
220,
1366,
796,
1391,
198,
220,
220,
220,
220,
220,
705,
15526,
62,
30001,
10354,
35878,
49,
3185,
10526,
62,
26861,
7597,
62,
10468,
43959,
11,
198,
220,
220,
220,
220,
220,
705,
71,
10354,
705,
13000,
3256,
198,
220,
220,
220,
220,
220,
705,
22872,
21737,
10354,
327,
6158,
38,
1581,
11015,
13,
1136,
7,
4906,
828,
198,
220,
220,
220,
220,
220,
705,
11299,
58,
6494,
60,
10354,
8543,
7,
10459,
11,
3842,
11,
2779,
828,
198,
220,
220,
220,
220,
220,
705,
3672,
10354,
2779,
13,
1136,
10786,
11299,
11537,
393,
2779,
13,
1136,
10786,
15252,
3256,
23884,
737,
1136,
10786,
11299,
33809,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
329,
1994,
287,
705,
259,
12,
47768,
12,
1462,
3256,
705,
2339,
12,
1659,
3256,
705,
260,
7353,
12,
1659,
3256,
705,
30271,
3256,
705,
43162,
10354,
198,
220,
220,
220,
220,
220,
1188,
796,
285,
69,
17,
62,
1676,
862,
13,
1136,
7,
2539,
8,
198,
220,
220,
220,
220,
220,
611,
1188,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
58,
2539,
60,
796,
4580,
687,
1381,
17,
13,
1136,
62,
8841,
62,
6371,
82,
26933,
2100,
12962,
58,
15,
60,
628,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
1255,
796,
19016,
9654,
7,
49884,
49,
3185,
10526,
62,
1677,
6322,
46,
12394,
11,
7736,
13,
2213,
320,
62,
8423,
82,
7,
7890,
828,
24697,
28,
50145,
8,
198,
220,
220,
220,
2845,
2956,
297,
571,
13,
18224,
13,
40717,
12331,
355,
6631,
25,
198,
220,
220,
220,
220,
220,
18931,
13,
1069,
4516,
10786,
4,
82,
4064,
82,
3256,
6631,
13,
41181,
11,
6631,
13,
961,
28955,
198,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
2845,
2956,
297,
571,
13,
18224,
13,
4261,
2538,
81,
1472,
355,
6631,
25,
198,
220,
220,
220,
220,
220,
18931,
13,
1069,
4516,
7,
1069,
4516,
13,
41181,
8,
198,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
1217,
13,
7353,
62,
6371,
796,
1255,
13,
10951,
22446,
1136,
10786,
14749,
11537,
198,
220,
220,
220,
18931,
13,
10951,
10786,
41972,
649,
1281,
25,
4064,
82,
3256,
1217,
13,
7353,
62,
6371,
8,
198,
220,
220,
220,
1217,
13,
26209,
62,
2618,
796,
1255,
13,
961,
3419,
198,
220,
220,
220,
18931,
13,
10951,
10786,
31077,
1767,
25,
4064,
82,
3256,
1217,
13,
26209,
62,
2618,
8,
628,
220,
220,
220,
1217,
13,
13376,
796,
705,
20751,
6,
198,
220,
220,
220,
1217,
13,
1996,
3419,
628,
220,
220,
220,
1303,
8820,
434,
329,
4856,
198,
220,
220,
220,
1303,
1441,
628,
220,
1303,
886,
9052,
625,
4568,
198,
220,
1441,
19203,
37,
6255,
11,
766,
17259,
3256,
5323,
8,
611,
6631,
2073,
705,
11380,
6,
198
] | 2.597555 | 2,209 |
## ssh -L 16006:127.0.0.1:16006 [email protected]
import torch
from models import XNOR_VGG
import torchvision
from torchvision import transforms
import argparse
import binop
import torch.utils.tensorboard as tensorboard
import os
from datetime import datetime
import time
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
res.append(correct_k.mul_(100.0 / batch_size))
return res
class AverageMeter(object):
"""Computes and stores the average and current value"""
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', default='./ImageNet', help='path to dataset, default = ./ImageNet')
parser.add_argument('--attention', action='store_true', help='use attention branch model')
parser.add_argument('--imgres', type=int, default=224, help='image input and output resolution, default = 352')
parser.add_argument('--epoch', type=int, default=100, help='number of epochs, default = 100')
parser.add_argument('--lr', type=float, default=1e-2, help='learning rate, default = 0.01')
parser.add_argument('--momentum', type=float, default=0.9, help='momentum, default = 0.9')
parser.add_argument('--weight_decay', type=float, default=5e-4, help='weight_decay, default = 0.0005')
parser.add_argument('--batch_size', type=int, default=16, help='training batch size, default = 10')
parser.add_argument('--clip', type=float, default=0.5, help='gradient clipping margin, default = 0.5')
parser.add_argument('--decay_rate', type=float, default=0.1, help='decay rate of learning rate, default = 0.1')
parser.add_argument('--decay_epoch', type=int, default=30, help='every n epochs decay learning rate, default = 50')
args = parser.parse_args()
# if torch.cuda.is_available():
# device = torch.device('cuda')
# else:
# device = torch.device('cpu')
device = torch.device('cpu')
model = XNOR_VGG().to(device)
# model = torchvision.models.vgg16(pretrained=True).to(device)
print('Model loaded')
b_model = XNOR_VGG(state_dict=model.features.state_dict()).to(device)
save_path = 'ckpts/{}/'.format(model.name)
torch.save(b_model.state_dict(), '{}{}.pth'.format(save_path, 'bin'))
model.eval()
with torch.no_grad():
n = 100
input = torch.rand([n, 1, 3, args.imgres, args.imgres]).to(device)
t0 = time.time()
for i in input:
pred = model(i)
avg_t = (time.time() - t0) / n
print('Inference time', avg_t)
print('FPS', 1/avg_t)
b_model.eval()
with torch.no_grad():
n = 100
input = torch.rand([n, 1, 3, args.imgres, args.imgres]).to(device)
t0 = time.time()
for i in input:
pred = b_model(i)
avg_t = (time.time() - t0) / n
print('Inference time', avg_t)
print('FPS', 1/avg_t)
transform = transforms.Compose([
transforms.Resize((256, 256)),
transforms.RandomCrop((args.imgres, args.imgres)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
dataset = torchvision.datasets.ImageNet(args.dataset, split='train', transform=transform)
dataset_val = torchvision.datasets.ImageNet(args.dataset, split='val', transform=transform)
loader = torch.utils.data.DataLoader(dataset, batch_size=args.batch_size, shuffle=True)
loader_val = torch.utils.data.DataLoader(dataset_val, batch_size=args.batch_size, shuffle=True)
total_steps = len(loader)
print('Dataset loaded')
optimizer = torch.optim.SGD(model.parameters(), lr=args.lr, momentum=args.momentum, weight_decay=args.weight_decay)
bin_op = binop.BinOp(model)
writer = tensorboard.SummaryWriter(os.path.join('logs', datetime.now().strftime('%Y%m%d-%H%M%S')))
criterion = torch.nn.CrossEntropyLoss().to(device)
for epoch in range(args.epoch):
lr_lambda = lambda epoch: args.decay_rate ** (epoch // args.decay_epoch)
scheduler = torch.optim.lr_scheduler.MultiplicativeLR(optimizer, lr_lambda=lr_lambda)
validate(loader_val, model, criterion)
for step, sample in enumerate(loader, start=1):
global_step = epoch * total_steps + step
input, target = sample
target_var = torch.autograd.Variable(target).to(device)
input = input.to(device)
target = input.to(device)
bin_op.binarization()
output = model(input)
loss = criterion(output, target_var)
optimizer.zero_grad()
loss.backward()
bin_op.restore()
bin_op.updateBinaryGradWeight()
optimizer.step()
writer.add_scalar('Loss/Total Loss', float(loss), global_step)
if step % 100 == 0 or step == total_steps:
print('{} Epoch [{:03d}/{:03d}], Step [{:04d}/{:04d}], Loss: {:.4f}'.
format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), epoch+1, args.epoch, step, total_steps, loss.data))
if epoch % 5 == 0:
save_path = 'ckpts/{}/'.format(model.name)
if not os.path.exists(save_path):
os.makedirs(save_path)
torch.save(model.state_dict(), '{}{}.pth.{:03d}'.format(save_path, model.name, epoch))
| [
2235,
26678,
532,
43,
26143,
21,
25,
16799,
13,
15,
13,
15,
13,
16,
25,
1433,
28041,
285,
65,
1983,
2425,
31,
10332,
13,
6359,
13,
37648,
13,
330,
13,
2724,
198,
11748,
28034,
198,
6738,
4981,
1330,
1395,
35510,
62,
53,
11190,
198,
11748,
28034,
10178,
198,
6738,
28034,
10178,
1330,
31408,
198,
11748,
1822,
29572,
198,
11748,
9874,
404,
198,
11748,
28034,
13,
26791,
13,
83,
22854,
3526,
220,
355,
11192,
273,
3526,
198,
11748,
28686,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
640,
198,
198,
4299,
9922,
7,
22915,
11,
2496,
11,
1353,
74,
16193,
16,
35751,
2599,
198,
220,
220,
220,
37227,
7293,
1769,
262,
15440,
31,
74,
329,
262,
7368,
3815,
286,
479,
37811,
198,
220,
220,
220,
3509,
74,
796,
3509,
7,
4852,
74,
8,
198,
220,
220,
220,
15458,
62,
7857,
796,
2496,
13,
7857,
7,
15,
8,
628,
220,
220,
220,
4808,
11,
2747,
796,
5072,
13,
4852,
74,
7,
9806,
74,
11,
352,
11,
6407,
11,
6407,
8,
198,
220,
220,
220,
2747,
796,
2747,
13,
83,
3419,
198,
220,
220,
220,
3376,
796,
2747,
13,
27363,
7,
16793,
13,
1177,
7,
16,
11,
532,
16,
737,
11201,
392,
62,
292,
7,
28764,
4008,
628,
220,
220,
220,
581,
796,
17635,
198,
220,
220,
220,
329,
479,
287,
1353,
74,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3376,
62,
74,
796,
3376,
58,
25,
74,
4083,
1177,
32590,
16,
737,
22468,
22446,
16345,
7,
15,
11,
1394,
27740,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
581,
13,
33295,
7,
30283,
62,
74,
13,
76,
377,
41052,
3064,
13,
15,
1220,
15458,
62,
7857,
4008,
198,
220,
220,
220,
1441,
581,
198,
198,
4871,
13475,
44,
2357,
7,
15252,
2599,
198,
220,
220,
220,
37227,
7293,
1769,
290,
7000,
262,
2811,
290,
1459,
1988,
37811,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
19608,
292,
316,
3256,
4277,
28,
4458,
14,
5159,
7934,
3256,
1037,
11639,
6978,
284,
27039,
11,
4277,
796,
24457,
5159,
7934,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
1078,
1463,
3256,
2223,
11639,
8095,
62,
7942,
3256,
1037,
11639,
1904,
3241,
8478,
2746,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
9600,
411,
3256,
2099,
28,
600,
11,
4277,
28,
24137,
11,
1037,
11639,
9060,
5128,
290,
5072,
6323,
11,
4277,
796,
44063,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
538,
5374,
3256,
2099,
28,
600,
11,
4277,
28,
3064,
11,
1037,
11639,
17618,
286,
36835,
82,
11,
220,
4277,
796,
1802,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
14050,
3256,
2099,
28,
22468,
11,
4277,
28,
16,
68,
12,
17,
11,
1037,
11639,
40684,
2494,
11,
220,
4277,
796,
657,
13,
486,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
32542,
298,
388,
3256,
2099,
28,
22468,
11,
4277,
28,
15,
13,
24,
11,
1037,
11639,
32542,
298,
388,
11,
220,
4277,
796,
657,
13,
24,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
6551,
62,
12501,
323,
3256,
2099,
28,
22468,
11,
4277,
28,
20,
68,
12,
19,
11,
1037,
11639,
6551,
62,
12501,
323,
11,
220,
4277,
796,
657,
13,
830,
20,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
43501,
62,
7857,
3256,
2099,
28,
600,
11,
4277,
28,
1433,
11,
1037,
11639,
34409,
15458,
2546,
11,
220,
4277,
796,
838,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
15036,
3256,
2099,
28,
22468,
11,
4277,
28,
15,
13,
20,
11,
1037,
11639,
49607,
45013,
10330,
11,
4277,
796,
657,
13,
20,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
12501,
323,
62,
4873,
3256,
2099,
28,
22468,
11,
4277,
28,
15,
13,
16,
11,
1037,
11639,
12501,
323,
2494,
286,
4673,
2494,
11,
4277,
796,
657,
13,
16,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
438,
12501,
323,
62,
538,
5374,
3256,
2099,
28,
600,
11,
4277,
28,
1270,
11,
1037,
11639,
16833,
299,
36835,
82,
22119,
4673,
2494,
11,
220,
4277,
796,
2026,
11537,
198,
22046,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
198,
2,
611,
28034,
13,
66,
15339,
13,
271,
62,
15182,
33529,
198,
2,
220,
220,
220,
220,
3335,
796,
28034,
13,
25202,
10786,
66,
15339,
11537,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
3335,
796,
28034,
13,
25202,
10786,
36166,
11537,
198,
198,
25202,
796,
28034,
13,
25202,
10786,
36166,
11537,
198,
19849,
796,
1395,
35510,
62,
53,
11190,
22446,
1462,
7,
25202,
8,
198,
2,
2746,
796,
28034,
10178,
13,
27530,
13,
85,
1130,
1433,
7,
5310,
13363,
28,
17821,
737,
1462,
7,
25202,
8,
198,
4798,
10786,
17633,
9639,
11537,
628,
198,
65,
62,
19849,
796,
1395,
35510,
62,
53,
11190,
7,
5219,
62,
11600,
28,
19849,
13,
40890,
13,
5219,
62,
11600,
3419,
737,
1462,
7,
25202,
8,
198,
21928,
62,
6978,
796,
705,
694,
457,
82,
14,
90,
92,
14,
4458,
18982,
7,
19849,
13,
3672,
8,
198,
13165,
354,
13,
21928,
7,
65,
62,
19849,
13,
5219,
62,
11600,
22784,
705,
90,
18477,
27422,
79,
400,
4458,
18982,
7,
21928,
62,
6978,
11,
705,
8800,
6,
4008,
198,
198,
19849,
13,
18206,
3419,
198,
4480,
28034,
13,
3919,
62,
9744,
33529,
198,
220,
220,
220,
299,
796,
1802,
198,
220,
220,
220,
5128,
796,
28034,
13,
25192,
26933,
77,
11,
352,
11,
513,
11,
26498,
13,
9600,
411,
11,
26498,
13,
9600,
411,
35944,
1462,
7,
25202,
8,
198,
220,
220,
220,
256,
15,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
329,
1312,
287,
5128,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
796,
2746,
7,
72,
8,
198,
220,
220,
220,
42781,
62,
83,
796,
357,
2435,
13,
2435,
3419,
532,
256,
15,
8,
1220,
299,
198,
4798,
10786,
818,
4288,
640,
3256,
42781,
62,
83,
8,
198,
4798,
10786,
37,
3705,
3256,
352,
14,
615,
70,
62,
83,
8,
198,
198,
65,
62,
19849,
13,
18206,
3419,
198,
4480,
28034,
13,
3919,
62,
9744,
33529,
198,
220,
220,
220,
299,
796,
1802,
198,
220,
220,
220,
5128,
796,
28034,
13,
25192,
26933,
77,
11,
352,
11,
513,
11,
26498,
13,
9600,
411,
11,
26498,
13,
9600,
411,
35944,
1462,
7,
25202,
8,
198,
220,
220,
220,
256,
15,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
329,
1312,
287,
5128,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
796,
275,
62,
19849,
7,
72,
8,
198,
220,
220,
220,
42781,
62,
83,
796,
357,
2435,
13,
2435,
3419,
532,
256,
15,
8,
1220,
299,
198,
4798,
10786,
818,
4288,
640,
3256,
42781,
62,
83,
8,
198,
4798,
10786,
37,
3705,
3256,
352,
14,
615,
70,
62,
83,
8,
198,
198,
35636,
796,
31408,
13,
7293,
577,
26933,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
4965,
1096,
19510,
11645,
11,
17759,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
29531,
34,
1773,
19510,
22046,
13,
9600,
411,
11,
26498,
13,
9600,
411,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
2514,
51,
22854,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31408,
13,
26447,
1096,
26933,
15,
13,
32642,
11,
657,
13,
29228,
11,
657,
13,
29703,
4357,
685,
15,
13,
23539,
11,
657,
13,
24137,
11,
657,
13,
18182,
12962,
12962,
198,
198,
19608,
292,
316,
796,
28034,
10178,
13,
19608,
292,
1039,
13,
5159,
7934,
7,
22046,
13,
19608,
292,
316,
11,
6626,
11639,
27432,
3256,
6121,
28,
35636,
8,
198,
19608,
292,
316,
62,
2100,
796,
28034,
10178,
13,
19608,
292,
1039,
13,
5159,
7934,
7,
22046,
13,
19608,
292,
316,
11,
6626,
11639,
2100,
3256,
6121,
28,
35636,
8,
198,
29356,
796,
28034,
13,
26791,
13,
7890,
13,
6601,
17401,
7,
19608,
292,
316,
11,
15458,
62,
7857,
28,
22046,
13,
43501,
62,
7857,
11,
36273,
28,
17821,
8,
198,
29356,
62,
2100,
796,
28034,
13,
26791,
13,
7890,
13,
6601,
17401,
7,
19608,
292,
316,
62,
2100,
11,
15458,
62,
7857,
28,
22046,
13,
43501,
62,
7857,
11,
36273,
28,
17821,
8,
198,
23350,
62,
20214,
796,
18896,
7,
29356,
8,
198,
4798,
10786,
27354,
292,
316,
9639,
11537,
198,
198,
40085,
7509,
796,
28034,
13,
40085,
13,
38475,
35,
7,
19849,
13,
17143,
7307,
22784,
300,
81,
28,
22046,
13,
14050,
11,
12858,
28,
22046,
13,
32542,
298,
388,
11,
3463,
62,
12501,
323,
28,
22046,
13,
6551,
62,
12501,
323,
8,
198,
8800,
62,
404,
796,
9874,
404,
13,
33,
259,
18257,
7,
19849,
8,
198,
198,
16002,
796,
11192,
273,
3526,
13,
22093,
34379,
7,
418,
13,
6978,
13,
22179,
10786,
6404,
82,
3256,
4818,
8079,
13,
2197,
22446,
2536,
31387,
10786,
4,
56,
4,
76,
4,
67,
12,
4,
39,
4,
44,
4,
50,
6,
22305,
198,
198,
22213,
28019,
796,
28034,
13,
20471,
13,
21544,
14539,
28338,
43,
793,
22446,
1462,
7,
25202,
8,
198,
198,
1640,
36835,
287,
2837,
7,
22046,
13,
538,
5374,
2599,
198,
220,
220,
220,
300,
81,
62,
50033,
796,
37456,
36835,
25,
26498,
13,
12501,
323,
62,
4873,
12429,
357,
538,
5374,
3373,
26498,
13,
12501,
323,
62,
538,
5374,
8,
198,
220,
220,
220,
6038,
18173,
796,
28034,
13,
40085,
13,
14050,
62,
1416,
704,
18173,
13,
15205,
24705,
43058,
35972,
7,
40085,
7509,
11,
300,
81,
62,
50033,
28,
14050,
62,
50033,
8,
198,
220,
220,
220,
26571,
7,
29356,
62,
2100,
11,
2746,
11,
34054,
8,
628,
220,
220,
220,
329,
2239,
11,
6291,
287,
27056,
378,
7,
29356,
11,
923,
28,
16,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
62,
9662,
796,
36835,
1635,
2472,
62,
20214,
1343,
2239,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
11,
2496,
796,
6291,
198,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
7785,
796,
28034,
13,
2306,
519,
6335,
13,
43015,
7,
16793,
737,
1462,
7,
25202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
796,
5128,
13,
1462,
7,
25202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2496,
796,
5128,
13,
1462,
7,
25202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9874,
62,
404,
13,
8800,
283,
1634,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
796,
2746,
7,
15414,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2994,
796,
34054,
7,
22915,
11,
2496,
62,
7785,
8,
628,
220,
220,
220,
220,
220,
220,
220,
6436,
7509,
13,
22570,
62,
9744,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2994,
13,
1891,
904,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
9874,
62,
404,
13,
2118,
382,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
9874,
62,
404,
13,
19119,
33,
3219,
42731,
25844,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
6436,
7509,
13,
9662,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
6260,
13,
2860,
62,
1416,
282,
283,
10786,
43,
793,
14,
14957,
22014,
3256,
12178,
7,
22462,
828,
3298,
62,
9662,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
2239,
4064,
1802,
6624,
657,
393,
2239,
6624,
2472,
62,
20214,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
90,
92,
4551,
5374,
685,
90,
25,
3070,
67,
92,
14,
90,
25,
3070,
67,
92,
4357,
5012,
685,
90,
25,
3023,
67,
92,
14,
90,
25,
3023,
67,
92,
4357,
22014,
25,
46110,
13,
19,
69,
92,
4458,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5794,
7,
19608,
8079,
13,
2197,
22446,
2536,
31387,
10786,
4,
56,
12,
4,
76,
12,
4,
67,
4064,
39,
25,
4,
44,
25,
4,
50,
33809,
36835,
10,
16,
11,
26498,
13,
538,
5374,
11,
2239,
11,
2472,
62,
20214,
11,
2994,
13,
7890,
4008,
628,
198,
220,
220,
220,
220,
220,
220,
220,
611,
36835,
4064,
642,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3613,
62,
6978,
796,
705,
694,
457,
82,
14,
90,
92,
14,
4458,
18982,
7,
19849,
13,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
21928,
62,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
21928,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28034,
13,
21928,
7,
19849,
13,
5219,
62,
11600,
22784,
705,
90,
18477,
27422,
79,
400,
13,
90,
25,
3070,
67,
92,
4458,
18982,
7,
21928,
62,
6978,
11,
2746,
13,
3672,
11,
36835,
4008,
198
] | 2.482759 | 2,146 |
"""
This module provides a solver for the spin-boson model at zero temperature
using the hierarchy equations of motion (HEOM) method.
"""
# Authors: Shahnawaz Ahmed, Neill Lambert
# Contact: [email protected]
import numpy as np
from copy import copy
from qutip import Qobj, qeye
from qutip.states import enr_state_dictionaries
from qutip.superoperator import liouvillian, spre, spost
from qutip import liouvillian, mat2vec, state_number_enumerate
from qutip.cy.spmatfuncs import cy_ode_rhs
from qutip.solver import Options, Result, Stats
from scipy.special import factorial
from scipy.sparse import lil_matrix
from scipy.integrate import ode
def add_at_idx(seq, k, val):
"""
Add (subtract) a value in the tuple at position k
"""
lst = list(seq)
lst[k] += val
return tuple(lst)
def prevhe(current_he, k, ncut):
"""
Calculate the previous heirarchy index
for the current index `n`.
"""
nprev = add_at_idx(current_he, k, -1)
if nprev[k] < 0:
return False
return nprev
def nexthe(current_he, k, ncut):
"""
Calculate the next heirarchy index
for the current index `n`.
"""
nnext = add_at_idx(current_he, k, 1)
if sum(nnext) > ncut:
return False
return nnext
def num_hierarchy(ncut, kcut):
"""
Get the total number of auxiliary density matrices in the
hierarchy.
Parameters
==========
ncut: int
The Heirarchy cutoff
kcut: int
The cutoff in the correlation frequencies, i.e., how many
total exponents are used.
Returns
=======
num_hierarchy: int
The total number of auxiliary density matrices in the hierarchy.
"""
return int(factorial(ncut + kcut) / (factorial(ncut) * factorial(kcut)))
def _heom_state_dictionaries(dims, excitations):
"""
Return the number of states, and lookup-dictionaries for translating
a state tuple to a state index, and vice versa, for a system with a given
number of components and maximum number of excitations.
Parameters
----------
dims: list
A list with the number of states in each sub-system.
excitations : integer
The maximum numbers of dimension
Returns
-------
nstates, state2idx, idx2state: integer, dict, dict
The number of states `nstates`, a dictionary for looking up state
indices from a state tuple, and a dictionary for looking up state
state tuples from state indices.
"""
nstates = 0
state2idx = {}
idx2state = {}
for state in state_number_enumerate(dims, excitations):
state2idx[state] = nstates
idx2state[nstates] = state
nstates += 1
return nstates, state2idx, idx2state
def _heom_number_enumerate(dims, excitations=None, state=None, idx=0):
"""
An iterator that enumerate all the state number arrays (quantum numbers on
the form [n1, n2, n3, ...]) for a system with dimensions given by dims.
Example:
>>> for state in state_number_enumerate([2,2]):
>>> print(state)
[ 0. 0.]
[ 0. 1.]
[ 1. 0.]
[ 1. 1.]
Parameters
----------
dims : list or array
The quantum state dimensions array, as it would appear in a Qobj.
state : list
Current state in the iteration. Used internally.
excitations : integer (None)
Restrict state space to states with excitation numbers below or
equal to this value.
idx : integer
Current index in the iteration. Used internally.
Returns
-------
state_number : list
Successive state number arrays that can be used in loops and other
iterations, using standard state enumeration *by definition*.
"""
if state is None:
state = np.zeros(len(dims))
if excitations and sum(state[0:idx]) > excitations:
pass
elif idx == len(dims):
if excitations is None:
yield np.array(state)
else:
yield tuple(state)
else:
for n in range(dims[idx]):
state[idx] = n
for s in state_number_enumerate(dims, excitations, state, idx + 1):
yield s
def get_aux_matrices(full, level, Nc, Nk):
"""
Extracts the auxiliary matrices at a particular level
from the full hierarchy ADOs.
Parameters
----------
full: ndarray
A 2D array of the time evolution of the ADOs.
level: int
The level of the hierarchy to get the ADOs.
Nc: int
The hierarchy cutoff.
k: int
The total number of exponentials used to express the correlation.
"""
nstates, state2idx, idx2state = _heom_state_dictionaries([Nc + 1] * (Nk), Nc)
aux_indices = []
aux_heom_indices = []
for stateid in state2idx:
if np.sum(stateid) == level:
aux_indices.append(state2idx[stateid])
aux_heom_indices.append(stateid)
full = np.array(full)
aux = []
for i in aux_indices:
qlist = [Qobj(full[k, i, :].reshape(2, 2).T) for k in range(len(full))]
aux.append(qlist)
return aux, aux_heom_indices
class HeomUB:
"""
The Heom class to tackle Heirarchy using the underdamped Brownian motion
Parameters
----------
hamiltonian: :class:`qutip.Qobj`
The system Hamiltonian
coupling: :class:`qutip.Qobj`
The coupling operator
coup_strength: float
The coupling strength.
ck: list
The list of amplitudes in the expansion of the correlation function
vk: list
The list of frequencies in the expansion of the correlation function
ncut: int
The hierarchy cutoff
beta: float
Inverse temperature, 1/kT. At zero temperature, beta is inf and we use
an optimization for the non Matsubara terms
"""
def populate(self, heidx_list):
"""
Given a Hierarchy index list, populate the graph of next and
previous elements
"""
ncut = self.ncut
kcut = self.kcut
he2idx = self.he2idx
idx2he = self.idx2he
for heidx in heidx_list:
for k in range(self.kcut):
he_current = idx2he[heidx]
he_next = nexthe(he_current, k, ncut)
he_prev = prevhe(he_current, k, ncut)
if he_next and (he_next not in he2idx):
he2idx[he_next] = self.nhe
idx2he[self.nhe] = he_next
self.nhe += 1
if he_prev and (he_prev not in he2idx):
he2idx[he_prev] = self.nhe
idx2he[self.nhe] = he_prev
self.nhe += 1
def grad_n(self, he_n):
"""
Get the gradient term for the Hierarchy ADM at
level n
"""
c = self.ck
nu = self.vk
L = self.L.copy()
gradient_sum = -np.sum(np.multiply(he_n, nu))
sum_op = gradient_sum * np.eye(L.shape[0])
L += sum_op
# Fill in larger L
nidx = self.he2idx[he_n]
block = self.N ** 2
pos = int(nidx * (block))
self.L_helems[pos : pos + block, pos : pos + block] = L
def grad_prev(self, he_n, k, prev_he):
"""
Get prev gradient
"""
c = self.ck
nu = self.vk
spreQ = self.spreQ
spostQ = self.spostQ
nk = he_n[k]
norm_prev = nk
# Non Matsubara terms
if k == 0:
norm_prev = np.sqrt(float(nk) / abs(self.lam))
op1 = -1j * norm_prev * (-self.lam * spostQ)
elif k == 1:
norm_prev = np.sqrt(float(nk) / abs(self.lam))
op1 = -1j * norm_prev * (self.lam * spreQ)
# Matsubara terms
else:
norm_prev = np.sqrt(float(nk) / abs(c[k]))
op1 = -1j * norm_prev * (c[k] * (spreQ - spostQ))
# Fill in larger L
rowidx = self.he2idx[he_n]
colidx = self.he2idx[prev_he]
block = self.N ** 2
rowpos = int(rowidx * (block))
colpos = int(colidx * (block))
self.L_helems[rowpos : rowpos + block, colpos : colpos + block] = op1
def rhs(self, progress=None):
"""
Make the RHS
"""
while self.nhe < self.total_nhe:
heidxlist = copy(list(self.idx2he.keys()))
self.populate(heidxlist)
if progress is not None:
bar = progress(total=self.nhe * self.kcut)
for n in self.idx2he:
he_n = self.idx2he[n]
self.grad_n(he_n)
for k in range(self.kcut):
next_he = nexthe(he_n, k, self.ncut)
prev_he = prevhe(he_n, k, self.ncut)
if next_he and (next_he in self.he2idx):
self.grad_next(he_n, k, next_he)
if prev_he and (prev_he in self.he2idx):
self.grad_prev(he_n, k, prev_he)
def solve(self, rho0, tlist, options=None, progress=None):
"""
Solve the Hierarchy equations of motion for the given initial
density matrix and time.
"""
if options is None:
options = Options()
output = Result()
output.solver = "hsolve"
output.times = tlist
output.states = []
output.states.append(Qobj(rho0))
dt = np.diff(tlist)
rho_he = np.zeros(self.hshape, dtype=np.complex)
rho_he[0] = rho0.full().ravel("F")
rho_he = rho_he.flatten()
self.rhs()
L_helems = self.L_helems.asformat("csr")
r = ode(cy_ode_rhs)
r.set_f_params(L_helems.data, L_helems.indices, L_helems.indptr)
r.set_integrator(
"zvode",
method=options.method,
order=options.order,
atol=options.atol,
rtol=options.rtol,
nsteps=options.nsteps,
first_step=options.first_step,
min_step=options.min_step,
max_step=options.max_step,
)
r.set_initial_value(rho_he, tlist[0])
dt = np.diff(tlist)
n_tsteps = len(tlist)
if progress:
bar = progress(total=n_tsteps - 1)
for t_idx, t in enumerate(tlist):
if t_idx < n_tsteps - 1:
r.integrate(r.t + dt[t_idx])
r1 = r.y.reshape(self.hshape)
r0 = r1[0].reshape(self.N, self.N).T
output.states.append(Qobj(r0))
r_heom = r.y.reshape(self.hshape)
self.full_hierarchy.append(r_heom)
if progress:
bar.update()
return output
| [
37811,
198,
1212,
8265,
3769,
257,
1540,
332,
329,
262,
7906,
12,
39565,
261,
2746,
379,
6632,
5951,
198,
3500,
262,
18911,
27490,
286,
6268,
357,
13909,
2662,
8,
2446,
13,
198,
37811,
198,
2,
46665,
25,
911,
15386,
707,
1031,
21157,
11,
3169,
359,
36978,
198,
2,
14039,
25,
427,
15386,
707,
1031,
13,
993,
1150,
3865,
31,
14816,
13,
785,
628,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
4866,
1330,
4866,
198,
198,
6738,
10662,
315,
541,
1330,
1195,
26801,
11,
10662,
25379,
198,
6738,
10662,
315,
541,
13,
27219,
1330,
551,
81,
62,
5219,
62,
67,
2867,
3166,
198,
6738,
10662,
315,
541,
13,
16668,
46616,
1330,
7649,
280,
85,
37896,
11,
599,
260,
11,
599,
455,
198,
6738,
10662,
315,
541,
1330,
7649,
280,
85,
37896,
11,
2603,
17,
35138,
11,
1181,
62,
17618,
62,
268,
6975,
378,
198,
6738,
10662,
315,
541,
13,
948,
13,
2777,
6759,
12543,
6359,
1330,
3075,
62,
1098,
62,
81,
11994,
198,
6738,
10662,
315,
541,
13,
82,
14375,
1330,
18634,
11,
25414,
11,
20595,
198,
198,
6738,
629,
541,
88,
13,
20887,
1330,
1109,
5132,
198,
6738,
629,
541,
88,
13,
82,
29572,
1330,
42280,
62,
6759,
8609,
198,
6738,
629,
541,
88,
13,
18908,
4873,
1330,
267,
2934,
628,
198,
4299,
751,
62,
265,
62,
312,
87,
7,
41068,
11,
479,
11,
1188,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3060,
357,
7266,
83,
974,
8,
257,
1988,
287,
262,
46545,
379,
2292,
479,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
300,
301,
796,
1351,
7,
41068,
8,
198,
220,
220,
220,
300,
301,
58,
74,
60,
15853,
1188,
198,
220,
220,
220,
1441,
46545,
7,
75,
301,
8,
628,
198,
4299,
8654,
258,
7,
14421,
62,
258,
11,
479,
11,
299,
8968,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
27131,
378,
262,
2180,
28625,
9282,
6376,
198,
220,
220,
220,
329,
262,
1459,
6376,
4600,
77,
44646,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
299,
47050,
796,
751,
62,
265,
62,
312,
87,
7,
14421,
62,
258,
11,
479,
11,
532,
16,
8,
198,
220,
220,
220,
611,
299,
47050,
58,
74,
60,
1279,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
198,
220,
220,
220,
1441,
299,
47050,
628,
198,
4299,
1306,
258,
7,
14421,
62,
258,
11,
479,
11,
299,
8968,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
27131,
378,
262,
1306,
28625,
9282,
6376,
198,
220,
220,
220,
329,
262,
1459,
6376,
4600,
77,
44646,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
299,
19545,
796,
751,
62,
265,
62,
312,
87,
7,
14421,
62,
258,
11,
479,
11,
352,
8,
198,
220,
220,
220,
611,
2160,
7,
77,
19545,
8,
1875,
299,
8968,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
198,
220,
220,
220,
1441,
299,
19545,
628,
198,
4299,
997,
62,
71,
959,
9282,
7,
77,
8968,
11,
479,
8968,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3497,
262,
2472,
1271,
286,
37419,
12109,
2603,
45977,
287,
262,
198,
220,
220,
220,
18911,
13,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
796,
2559,
28,
198,
220,
220,
220,
299,
8968,
25,
493,
198,
220,
220,
220,
220,
220,
220,
220,
383,
679,
343,
9282,
45616,
628,
220,
220,
220,
479,
8968,
25,
493,
198,
220,
220,
220,
220,
220,
220,
220,
383,
45616,
287,
262,
16096,
19998,
11,
1312,
13,
68,
1539,
703,
867,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
1033,
3906,
389,
973,
13,
628,
220,
220,
220,
16409,
198,
220,
220,
220,
29335,
855,
198,
220,
220,
220,
997,
62,
71,
959,
9282,
25,
493,
198,
220,
220,
220,
220,
220,
220,
220,
383,
2472,
1271,
286,
37419,
12109,
2603,
45977,
287,
262,
18911,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
493,
7,
22584,
5132,
7,
77,
8968,
1343,
479,
8968,
8,
1220,
357,
22584,
5132,
7,
77,
8968,
8,
1635,
1109,
5132,
7,
74,
8968,
22305,
628,
198,
4299,
4808,
258,
296,
62,
5219,
62,
67,
2867,
3166,
7,
67,
12078,
11,
2859,
20597,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8229,
262,
1271,
286,
2585,
11,
290,
35847,
12,
67,
2867,
3166,
329,
34665,
198,
220,
220,
220,
257,
1181,
46545,
284,
257,
1181,
6376,
11,
290,
7927,
25470,
11,
329,
257,
1080,
351,
257,
1813,
198,
220,
220,
220,
1271,
286,
6805,
290,
5415,
1271,
286,
2859,
20597,
13,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
5391,
82,
25,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
317,
1351,
351,
262,
1271,
286,
2585,
287,
1123,
850,
12,
10057,
13,
198,
220,
220,
220,
2859,
20597,
1058,
18253,
198,
220,
220,
220,
220,
220,
220,
220,
383,
5415,
3146,
286,
15793,
198,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
299,
27219,
11,
1181,
17,
312,
87,
11,
4686,
87,
17,
5219,
25,
18253,
11,
8633,
11,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
383,
1271,
286,
2585,
4600,
77,
27219,
47671,
257,
22155,
329,
2045,
510,
1181,
198,
220,
220,
220,
220,
220,
220,
220,
36525,
422,
257,
1181,
46545,
11,
290,
257,
22155,
329,
2045,
510,
1181,
198,
220,
220,
220,
220,
220,
220,
220,
1181,
12777,
2374,
422,
1181,
36525,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
299,
27219,
796,
657,
198,
220,
220,
220,
1181,
17,
312,
87,
796,
23884,
198,
220,
220,
220,
4686,
87,
17,
5219,
796,
23884,
628,
220,
220,
220,
329,
1181,
287,
1181,
62,
17618,
62,
268,
6975,
378,
7,
67,
12078,
11,
2859,
20597,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1181,
17,
312,
87,
58,
5219,
60,
796,
299,
27219,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
17,
5219,
58,
77,
27219,
60,
796,
1181,
198,
220,
220,
220,
220,
220,
220,
220,
299,
27219,
15853,
352,
198,
220,
220,
220,
1441,
299,
27219,
11,
1181,
17,
312,
87,
11,
4686,
87,
17,
5219,
628,
198,
4299,
4808,
258,
296,
62,
17618,
62,
268,
6975,
378,
7,
67,
12078,
11,
2859,
20597,
28,
14202,
11,
1181,
28,
14202,
11,
4686,
87,
28,
15,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1052,
41313,
326,
27056,
378,
477,
262,
1181,
1271,
26515,
357,
40972,
388,
3146,
319,
198,
220,
220,
220,
262,
1296,
685,
77,
16,
11,
299,
17,
11,
299,
18,
11,
2644,
12962,
329,
257,
1080,
351,
15225,
1813,
416,
5391,
82,
13,
198,
220,
220,
220,
17934,
25,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
329,
1181,
287,
1181,
62,
17618,
62,
268,
6975,
378,
26933,
17,
11,
17,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
13163,
220,
220,
220,
220,
3601,
7,
5219,
8,
198,
220,
220,
220,
220,
220,
220,
220,
685,
657,
13,
220,
657,
8183,
198,
220,
220,
220,
220,
220,
220,
220,
685,
657,
13,
220,
352,
8183,
198,
220,
220,
220,
220,
220,
220,
220,
685,
352,
13,
220,
657,
8183,
198,
220,
220,
220,
220,
220,
220,
220,
685,
352,
13,
220,
352,
8183,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
5391,
82,
1058,
1351,
393,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
383,
14821,
1181,
15225,
7177,
11,
355,
340,
561,
1656,
287,
257,
1195,
26801,
13,
198,
220,
220,
220,
1181,
1058,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
9236,
1181,
287,
262,
24415,
13,
16718,
20947,
13,
198,
220,
220,
220,
2859,
20597,
1058,
18253,
357,
14202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
37163,
1181,
2272,
284,
2585,
351,
2859,
3780,
3146,
2174,
393,
198,
220,
220,
220,
220,
220,
220,
220,
4961,
284,
428,
1988,
13,
198,
220,
220,
220,
4686,
87,
1058,
18253,
198,
220,
220,
220,
220,
220,
220,
220,
9236,
6376,
287,
262,
24415,
13,
16718,
20947,
13,
198,
220,
220,
220,
16409,
198,
220,
220,
220,
35656,
198,
220,
220,
220,
1181,
62,
17618,
1058,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
16282,
425,
1181,
1271,
26515,
326,
460,
307,
973,
287,
23607,
290,
584,
198,
220,
220,
220,
220,
220,
220,
220,
34820,
11,
1262,
3210,
1181,
27056,
341,
1635,
1525,
6770,
24620,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
611,
1181,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1181,
796,
45941,
13,
9107,
418,
7,
11925,
7,
67,
12078,
4008,
628,
220,
220,
220,
611,
2859,
20597,
290,
2160,
7,
5219,
58,
15,
25,
312,
87,
12962,
1875,
2859,
20597,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1208,
198,
220,
220,
220,
1288,
361,
4686,
87,
6624,
18896,
7,
67,
12078,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2859,
20597,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7800,
45941,
13,
18747,
7,
5219,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7800,
46545,
7,
5219,
8,
628,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
329,
299,
287,
2837,
7,
67,
12078,
58,
312,
87,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1181,
58,
312,
87,
60,
796,
299,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
264,
287,
1181,
62,
17618,
62,
268,
6975,
378,
7,
67,
12078,
11,
2859,
20597,
11,
1181,
11,
4686,
87,
1343,
352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7800,
264,
628,
198,
4299,
651,
62,
14644,
62,
6759,
45977,
7,
12853,
11,
1241,
11,
399,
66,
11,
399,
74,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
29677,
82,
262,
37419,
2603,
45977,
379,
257,
1948,
1241,
198,
220,
220,
220,
422,
262,
1336,
18911,
5984,
16748,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
1336,
25,
299,
67,
18747,
198,
220,
220,
220,
220,
220,
220,
220,
317,
362,
35,
7177,
286,
262,
640,
6954,
286,
262,
5984,
16748,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1241,
25,
493,
198,
220,
220,
220,
220,
220,
220,
220,
383,
1241,
286,
262,
18911,
284,
651,
262,
5984,
16748,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
399,
66,
25,
493,
198,
220,
220,
220,
220,
220,
220,
220,
383,
18911,
45616,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
479,
25,
493,
198,
220,
220,
220,
220,
220,
220,
220,
383,
2472,
1271,
286,
1033,
261,
14817,
973,
284,
4911,
262,
16096,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
299,
27219,
11,
1181,
17,
312,
87,
11,
4686,
87,
17,
5219,
796,
4808,
258,
296,
62,
5219,
62,
67,
2867,
3166,
26933,
45,
66,
1343,
352,
60,
1635,
357,
45,
74,
828,
399,
66,
8,
198,
220,
220,
220,
27506,
62,
521,
1063,
796,
17635,
628,
220,
220,
220,
27506,
62,
258,
296,
62,
521,
1063,
796,
17635,
198,
220,
220,
220,
329,
1181,
312,
287,
1181,
17,
312,
87,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
45941,
13,
16345,
7,
5219,
312,
8,
6624,
1241,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27506,
62,
521,
1063,
13,
33295,
7,
5219,
17,
312,
87,
58,
5219,
312,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27506,
62,
258,
296,
62,
521,
1063,
13,
33295,
7,
5219,
312,
8,
198,
220,
220,
220,
1336,
796,
45941,
13,
18747,
7,
12853,
8,
198,
220,
220,
220,
27506,
796,
17635,
628,
220,
220,
220,
329,
1312,
287,
27506,
62,
521,
1063,
25,
198,
220,
220,
220,
220,
220,
220,
220,
10662,
4868,
796,
685,
48,
26801,
7,
12853,
58,
74,
11,
1312,
11,
1058,
4083,
3447,
1758,
7,
17,
11,
362,
737,
51,
8,
329,
479,
287,
2837,
7,
11925,
7,
12853,
4008,
60,
198,
220,
220,
220,
220,
220,
220,
220,
27506,
13,
33295,
7,
80,
4868,
8,
198,
220,
220,
220,
1441,
27506,
11,
27506,
62,
258,
296,
62,
521,
1063,
628,
198,
4871,
679,
296,
10526,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
383,
679,
296,
1398,
284,
9761,
679,
343,
9282,
1262,
262,
739,
67,
13322,
4373,
666,
6268,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
8891,
9044,
666,
25,
1058,
4871,
25,
63,
80,
315,
541,
13,
48,
26801,
63,
198,
220,
220,
220,
220,
220,
220,
220,
383,
1080,
11582,
666,
628,
220,
220,
220,
40204,
25,
1058,
4871,
25,
63,
80,
315,
541,
13,
48,
26801,
63,
198,
220,
220,
220,
220,
220,
220,
220,
383,
40204,
10088,
628,
220,
220,
220,
12092,
62,
41402,
25,
12178,
198,
220,
220,
220,
220,
220,
220,
220,
383,
40204,
4202,
13,
628,
220,
220,
220,
269,
74,
25,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
383,
1351,
286,
12306,
10455,
287,
262,
7118,
286,
262,
16096,
2163,
628,
220,
220,
220,
410,
74,
25,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
383,
1351,
286,
19998,
287,
262,
7118,
286,
262,
16096,
2163,
628,
220,
220,
220,
299,
8968,
25,
493,
198,
220,
220,
220,
220,
220,
220,
220,
383,
18911,
45616,
628,
197,
31361,
25,
12178,
198,
197,
197,
818,
4399,
5951,
11,
352,
14,
74,
51,
13,
1629,
6632,
5951,
11,
12159,
318,
1167,
290,
356,
779,
198,
197,
197,
272,
23989,
329,
262,
1729,
30107,
549,
3301,
2846,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
48040,
7,
944,
11,
339,
312,
87,
62,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
11259,
257,
36496,
9282,
6376,
1351,
11,
48040,
262,
4823,
286,
1306,
290,
198,
220,
220,
220,
220,
220,
220,
220,
2180,
4847,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
299,
8968,
796,
2116,
13,
77,
8968,
198,
220,
220,
220,
220,
220,
220,
220,
479,
8968,
796,
2116,
13,
74,
8968,
198,
220,
220,
220,
220,
220,
220,
220,
339,
17,
312,
87,
796,
2116,
13,
258,
17,
312,
87,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
17,
258,
796,
2116,
13,
312,
87,
17,
258,
198,
220,
220,
220,
220,
220,
220,
220,
329,
339,
312,
87,
287,
339,
312,
87,
62,
4868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
2837,
7,
944,
13,
74,
8968,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
339,
62,
14421,
796,
4686,
87,
17,
258,
58,
28420,
87,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
339,
62,
19545,
796,
1306,
258,
7,
258,
62,
14421,
11,
479,
11,
299,
8968,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
339,
62,
47050,
796,
8654,
258,
7,
258,
62,
14421,
11,
479,
11,
299,
8968,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
339,
62,
19545,
290,
357,
258,
62,
19545,
407,
287,
339,
17,
312,
87,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
339,
17,
312,
87,
58,
258,
62,
19545,
60,
796,
2116,
13,
77,
258,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
17,
258,
58,
944,
13,
77,
258,
60,
796,
339,
62,
19545,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
258,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
339,
62,
47050,
290,
357,
258,
62,
47050,
407,
287,
339,
17,
312,
87,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
339,
17,
312,
87,
58,
258,
62,
47050,
60,
796,
2116,
13,
77,
258,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
17,
258,
58,
944,
13,
77,
258,
60,
796,
339,
62,
47050,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
77,
258,
15853,
352,
628,
220,
220,
220,
825,
3915,
62,
77,
7,
944,
11,
339,
62,
77,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3497,
262,
31312,
3381,
329,
262,
36496,
9282,
5984,
44,
379,
198,
220,
220,
220,
220,
220,
220,
220,
1241,
299,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
269,
796,
2116,
13,
694,
198,
220,
220,
220,
220,
220,
220,
220,
14364,
796,
2116,
13,
85,
74,
198,
220,
220,
220,
220,
220,
220,
220,
406,
796,
2116,
13,
43,
13,
30073,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
31312,
62,
16345,
796,
532,
37659,
13,
16345,
7,
37659,
13,
16680,
541,
306,
7,
258,
62,
77,
11,
14364,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2160,
62,
404,
796,
31312,
62,
16345,
1635,
45941,
13,
25379,
7,
43,
13,
43358,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
406,
15853,
2160,
62,
404,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
27845,
287,
4025,
406,
198,
220,
220,
220,
220,
220,
220,
220,
299,
312,
87,
796,
2116,
13,
258,
17,
312,
87,
58,
258,
62,
77,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2512,
796,
2116,
13,
45,
12429,
362,
198,
220,
220,
220,
220,
220,
220,
220,
1426,
796,
493,
7,
77,
312,
87,
1635,
357,
9967,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43,
62,
258,
46367,
58,
1930,
1058,
1426,
1343,
2512,
11,
1426,
1058,
1426,
1343,
2512,
60,
796,
406,
628,
220,
220,
220,
825,
3915,
62,
47050,
7,
944,
11,
339,
62,
77,
11,
479,
11,
8654,
62,
258,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3497,
8654,
31312,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
269,
796,
2116,
13,
694,
198,
220,
220,
220,
220,
220,
220,
220,
14364,
796,
2116,
13,
85,
74,
198,
220,
220,
220,
220,
220,
220,
220,
599,
260,
48,
796,
2116,
13,
2777,
260,
48,
198,
220,
220,
220,
220,
220,
220,
220,
599,
455,
48,
796,
2116,
13,
2777,
455,
48,
198,
220,
220,
220,
220,
220,
220,
220,
299,
74,
796,
339,
62,
77,
58,
74,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
47050,
796,
299,
74,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
8504,
30107,
549,
3301,
2846,
198,
220,
220,
220,
220,
220,
220,
220,
611,
479,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
47050,
796,
45941,
13,
31166,
17034,
7,
22468,
7,
77,
74,
8,
1220,
2352,
7,
944,
13,
2543,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1034,
16,
796,
532,
16,
73,
1635,
2593,
62,
47050,
1635,
13841,
944,
13,
2543,
1635,
599,
455,
48,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
479,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
47050,
796,
45941,
13,
31166,
17034,
7,
22468,
7,
77,
74,
8,
1220,
2352,
7,
944,
13,
2543,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1034,
16,
796,
532,
16,
73,
1635,
2593,
62,
47050,
1635,
357,
944,
13,
2543,
1635,
599,
260,
48,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
30107,
549,
3301,
2846,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
62,
47050,
796,
45941,
13,
31166,
17034,
7,
22468,
7,
77,
74,
8,
1220,
2352,
7,
66,
58,
74,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1034,
16,
796,
532,
16,
73,
1635,
2593,
62,
47050,
1635,
357,
66,
58,
74,
60,
1635,
357,
2777,
260,
48,
532,
599,
455,
48,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
27845,
287,
4025,
406,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
312,
87,
796,
2116,
13,
258,
17,
312,
87,
58,
258,
62,
77,
60,
198,
220,
220,
220,
220,
220,
220,
220,
951,
312,
87,
796,
2116,
13,
258,
17,
312,
87,
58,
47050,
62,
258,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2512,
796,
2116,
13,
45,
12429,
362,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
1930,
796,
493,
7,
808,
312,
87,
1635,
357,
9967,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
951,
1930,
796,
493,
7,
4033,
312,
87,
1635,
357,
9967,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
43,
62,
258,
46367,
58,
808,
1930,
1058,
5752,
1930,
1343,
2512,
11,
951,
1930,
1058,
951,
1930,
1343,
2512,
60,
796,
1034,
16,
628,
220,
220,
220,
825,
9529,
82,
7,
944,
11,
4371,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6889,
262,
371,
7998,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
981,
2116,
13,
77,
258,
1279,
2116,
13,
23350,
62,
77,
258,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
339,
312,
87,
4868,
796,
4866,
7,
4868,
7,
944,
13,
312,
87,
17,
258,
13,
13083,
3419,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
12924,
5039,
7,
28420,
87,
4868,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4371,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2318,
796,
4371,
7,
23350,
28,
944,
13,
77,
258,
1635,
2116,
13,
74,
8968,
8,
628,
220,
220,
220,
220,
220,
220,
220,
329,
299,
287,
2116,
13,
312,
87,
17,
258,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
339,
62,
77,
796,
2116,
13,
312,
87,
17,
258,
58,
77,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9744,
62,
77,
7,
258,
62,
77,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
2837,
7,
944,
13,
74,
8968,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1306,
62,
258,
796,
1306,
258,
7,
258,
62,
77,
11,
479,
11,
2116,
13,
77,
8968,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8654,
62,
258,
796,
8654,
258,
7,
258,
62,
77,
11,
479,
11,
2116,
13,
77,
8968,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1306,
62,
258,
290,
357,
19545,
62,
258,
287,
2116,
13,
258,
17,
312,
87,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9744,
62,
19545,
7,
258,
62,
77,
11,
479,
11,
1306,
62,
258,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
8654,
62,
258,
290,
357,
47050,
62,
258,
287,
2116,
13,
258,
17,
312,
87,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9744,
62,
47050,
7,
258,
62,
77,
11,
479,
11,
8654,
62,
258,
8,
628,
220,
220,
220,
825,
8494,
7,
944,
11,
374,
8873,
15,
11,
256,
4868,
11,
3689,
28,
14202,
11,
4371,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4294,
303,
262,
36496,
9282,
27490,
286,
6268,
329,
262,
1813,
4238,
198,
220,
220,
220,
220,
220,
220,
220,
12109,
17593,
290,
640,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3689,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3689,
796,
18634,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
5072,
796,
25414,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
13,
82,
14375,
796,
366,
11994,
6442,
1,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
13,
22355,
796,
256,
4868,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
13,
27219,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
13,
27219,
13,
33295,
7,
48,
26801,
7,
81,
8873,
15,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
288,
83,
796,
45941,
13,
26069,
7,
83,
4868,
8,
198,
220,
220,
220,
220,
220,
220,
220,
374,
8873,
62,
258,
796,
45941,
13,
9107,
418,
7,
944,
13,
71,
43358,
11,
288,
4906,
28,
37659,
13,
41887,
8,
198,
220,
220,
220,
220,
220,
220,
220,
374,
8873,
62,
258,
58,
15,
60,
796,
374,
8873,
15,
13,
12853,
22446,
25843,
7203,
37,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
374,
8873,
62,
258,
796,
374,
8873,
62,
258,
13,
2704,
41769,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
81,
11994,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
406,
62,
258,
46367,
796,
2116,
13,
43,
62,
258,
46367,
13,
292,
18982,
7203,
6359,
81,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
374,
796,
267,
2934,
7,
948,
62,
1098,
62,
81,
11994,
8,
198,
220,
220,
220,
220,
220,
220,
220,
374,
13,
2617,
62,
69,
62,
37266,
7,
43,
62,
258,
46367,
13,
7890,
11,
406,
62,
258,
46367,
13,
521,
1063,
11,
406,
62,
258,
46367,
13,
521,
20692,
8,
198,
220,
220,
220,
220,
220,
220,
220,
374,
13,
2617,
62,
18908,
12392,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
89,
85,
1098,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2446,
28,
25811,
13,
24396,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1502,
28,
25811,
13,
2875,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
379,
349,
28,
25811,
13,
265,
349,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
83,
349,
28,
25811,
13,
17034,
349,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
20214,
28,
25811,
13,
77,
20214,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
717,
62,
9662,
28,
25811,
13,
11085,
62,
9662,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
949,
62,
9662,
28,
25811,
13,
1084,
62,
9662,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
9662,
28,
25811,
13,
9806,
62,
9662,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
374,
13,
2617,
62,
36733,
62,
8367,
7,
81,
8873,
62,
258,
11,
256,
4868,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
288,
83,
796,
45941,
13,
26069,
7,
83,
4868,
8,
198,
220,
220,
220,
220,
220,
220,
220,
299,
62,
83,
20214,
796,
18896,
7,
83,
4868,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
4371,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2318,
796,
4371,
7,
23350,
28,
77,
62,
83,
20214,
532,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
256,
62,
312,
87,
11,
256,
287,
27056,
378,
7,
83,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
256,
62,
312,
87,
1279,
299,
62,
83,
20214,
532,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
13,
18908,
4873,
7,
81,
13,
83,
1343,
288,
83,
58,
83,
62,
312,
87,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
16,
796,
374,
13,
88,
13,
3447,
1758,
7,
944,
13,
71,
43358,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
15,
796,
374,
16,
58,
15,
4083,
3447,
1758,
7,
944,
13,
45,
11,
2116,
13,
45,
737,
51,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
13,
27219,
13,
33295,
7,
48,
26801,
7,
81,
15,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
62,
258,
296,
796,
374,
13,
88,
13,
3447,
1758,
7,
944,
13,
71,
43358,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
12853,
62,
71,
959,
9282,
13,
33295,
7,
81,
62,
258,
296,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4371,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2318,
13,
19119,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
5072,
198
] | 2.094902 | 5,100 |
#!/usr/bin/env python
from typing import Optional
import sys
import time
import dpkt
import pycozmo
if __name__ == '__main__':
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
6738,
19720,
1330,
32233,
198,
11748,
25064,
198,
11748,
640,
198,
198,
11748,
288,
79,
21841,
198,
198,
11748,
12972,
1073,
89,
5908,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.735849 | 53 |
"""Optimum-Path Forest standard definitions.
"""
import pickle
import numpy as np
import opfython.math.distance as d
import opfython.stream.loader as loader
import opfython.utils.exception as e
import opfython.utils.logging as l
from opfython.core import Subgraph
logger = l.get_logger(__name__)
class OPF:
"""A basic class to define all common OPF-related methods.
References:
J. P. Papa, A. X. Falcão and C. T. N. Suzuki.
LibOPF: A library for the design of optimum-path forest classifiers (2015).
"""
def __init__(self, distance='log_squared_euclidean', pre_computed_distance=None):
"""Initialization method.
Args:
distance (str): An indicator of the distance metric to be used.
pre_computed_distance (str): A pre-computed distance file for feeding into OPF.
"""
logger.info('Creating class: OPF.')
# Initializing an empty subgraph
self.subgraph = None
# An indicator of the distance metric to be used
self.distance = distance
# Gathers the distance function as a property
self.distance_fn = d.DISTANCES[distance]
# If OPF should use a pre-computed distance
if pre_computed_distance:
# Marks the boolean indicator as True
self.pre_computed_distance = True
# Apply the distances matrix
self._read_distances(pre_computed_distance)
else:
# Marks the boolean indicator as False
self.pre_computed_distance = False
# Marks the pre-distances property as None
self.pre_distances = None
logger.debug('Distance: %s | Pre-computed distance: %s.', self.distance, self.pre_computed_distance)
logger.info('Class created.')
@property
def subgraph(self):
"""Subgraph: Subgraph's instance.
"""
return self._subgraph
@subgraph.setter
@property
def distance(self):
"""str: Distance metric to be used.
"""
return self._distance
@distance.setter
@property
def distance_fn(self):
"""callable: Distance function to be used.
"""
return self._distance_fn
@distance_fn.setter
@property
def pre_computed_distance(self):
"""bool: Whether OPF should use a pre-computed distance or not.
"""
return self._pre_computed_distance
@pre_computed_distance.setter
@property
def pre_distances(self):
"""np.array: Pre-computed distance matrix.
"""
return self._pre_distances
@pre_distances.setter
def _read_distances(self, file_name):
"""Reads the distance between nodes from a pre-defined file.
Args:
file_name (str): File to be loaded.
"""
logger.debug('Running private method: read_distances().')
# Getting file extension
extension = file_name.split('.')[-1]
if extension == 'csv':
distances = loader.load_csv(file_name)
elif extension == 'txt':
distances = loader.load_txt(file_name)
else:
# Raises an ArgumentError exception
raise e.ArgumentError('File extension not recognized. It should be either `.csv` or .txt`')
# Check if distances have been properly loaded
if distances is None:
raise e.ValueError('Pre-computed distances could not been properly loaded')
# Apply the distances matrix to the property
self.pre_distances = distances
def load(self, file_name):
"""Loads the object from a pickle encoding.
Args:
file_name (str): Pickle's file path to be loaded.
"""
logger.info('Loading model from file: %s ...', file_name)
with open(file_name, 'rb') as origin_file:
opf = pickle.load(origin_file)
self.__dict__.update(opf.__dict__)
logger.info('Model loaded.')
def save(self, file_name):
"""Saves the object to a pickle encoding.
Args:
file_name (str): File's name to be saved.
"""
logger.info('Saving model to file: %s ...', file_name)
with open(file_name, 'wb') as dest_file:
pickle.dump(self, dest_file)
logger.info('Model saved.')
def fit(self, X, Y):
"""Fits data in the classifier.
It should be directly implemented in OPF child classes.
Args:
X (np.array): Array of features.
Y (np.array): Array of labels.
"""
raise NotImplementedError
def predict(self, X):
"""Predicts new data using the pre-trained classifier.
It should be directly implemented in OPF child classes.
Args:
X (np.array): Array of features.
Returns:
A list of predictions for each record of the data.
"""
raise NotImplementedError
| [
37811,
27871,
2847,
12,
15235,
9115,
3210,
17336,
13,
198,
37811,
198,
198,
11748,
2298,
293,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
1034,
69,
7535,
13,
11018,
13,
30246,
355,
288,
198,
11748,
1034,
69,
7535,
13,
5532,
13,
29356,
355,
40213,
198,
11748,
1034,
69,
7535,
13,
26791,
13,
1069,
4516,
355,
304,
198,
11748,
1034,
69,
7535,
13,
26791,
13,
6404,
2667,
355,
300,
198,
6738,
1034,
69,
7535,
13,
7295,
1330,
3834,
34960,
198,
198,
6404,
1362,
796,
300,
13,
1136,
62,
6404,
1362,
7,
834,
3672,
834,
8,
628,
198,
4871,
13349,
37,
25,
198,
220,
220,
220,
37227,
32,
4096,
1398,
284,
8160,
477,
2219,
13349,
37,
12,
5363,
5050,
13,
628,
220,
220,
220,
31458,
25,
198,
220,
220,
220,
220,
220,
220,
220,
449,
13,
350,
13,
42328,
11,
317,
13,
1395,
13,
9596,
66,
28749,
290,
327,
13,
309,
13,
399,
13,
35807,
13,
198,
220,
220,
220,
220,
220,
220,
220,
7980,
3185,
37,
25,
317,
5888,
329,
262,
1486,
286,
39475,
12,
6978,
8222,
1398,
13350,
357,
4626,
737,
628,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
5253,
11639,
6404,
62,
16485,
1144,
62,
12496,
565,
485,
272,
3256,
662,
62,
785,
17128,
62,
30246,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1634,
2446,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5253,
357,
2536,
2599,
1052,
16916,
286,
262,
5253,
18663,
284,
307,
973,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
662,
62,
785,
17128,
62,
30246,
357,
2536,
2599,
317,
662,
12,
785,
17128,
5253,
2393,
329,
13017,
656,
13349,
37,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
32071,
1398,
25,
13349,
37,
2637,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
20768,
2890,
281,
6565,
850,
34960,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7266,
34960,
796,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
1052,
16916,
286,
262,
5253,
18663,
284,
307,
973,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30246,
796,
5253,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
402,
1032,
82,
262,
5253,
2163,
355,
257,
3119,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30246,
62,
22184,
796,
288,
13,
35,
8808,
20940,
1546,
58,
30246,
60,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
13349,
37,
815,
779,
257,
662,
12,
785,
17128,
5253,
198,
220,
220,
220,
220,
220,
220,
220,
611,
662,
62,
785,
17128,
62,
30246,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
27366,
262,
25131,
16916,
355,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3866,
62,
785,
17128,
62,
30246,
796,
6407,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
27967,
262,
18868,
17593,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
961,
62,
17080,
1817,
7,
3866,
62,
785,
17128,
62,
30246,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
27366,
262,
25131,
16916,
355,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3866,
62,
785,
17128,
62,
30246,
796,
10352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
27366,
262,
662,
12,
17080,
1817,
3119,
355,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3866,
62,
17080,
1817,
796,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
10786,
45767,
25,
4064,
82,
930,
3771,
12,
785,
17128,
5253,
25,
4064,
82,
2637,
11,
2116,
13,
30246,
11,
2116,
13,
3866,
62,
785,
17128,
62,
30246,
8,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
9487,
2727,
2637,
8,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
850,
34960,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7004,
34960,
25,
3834,
34960,
338,
4554,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
7266,
34960,
628,
220,
220,
220,
2488,
7266,
34960,
13,
2617,
353,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
5253,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
2536,
25,
34600,
18663,
284,
307,
973,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
30246,
628,
220,
220,
220,
2488,
30246,
13,
2617,
353,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
5253,
62,
22184,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13345,
540,
25,
34600,
2163,
284,
307,
973,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
30246,
62,
22184,
628,
220,
220,
220,
2488,
30246,
62,
22184,
13,
2617,
353,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
662,
62,
785,
17128,
62,
30246,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
30388,
25,
10127,
13349,
37,
815,
779,
257,
662,
12,
785,
17128,
5253,
393,
407,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
3866,
62,
785,
17128,
62,
30246,
628,
220,
220,
220,
2488,
3866,
62,
785,
17128,
62,
30246,
13,
2617,
353,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
662,
62,
17080,
1817,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
37659,
13,
18747,
25,
3771,
12,
785,
17128,
5253,
17593,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
3866,
62,
17080,
1817,
628,
220,
220,
220,
2488,
3866,
62,
17080,
1817,
13,
2617,
353,
628,
220,
220,
220,
825,
4808,
961,
62,
17080,
1817,
7,
944,
11,
2393,
62,
3672,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5569,
82,
262,
5253,
1022,
13760,
422,
257,
662,
12,
23211,
2393,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
3672,
357,
2536,
2599,
9220,
284,
307,
9639,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
10786,
28768,
2839,
2446,
25,
1100,
62,
17080,
1817,
22446,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
18067,
2393,
7552,
198,
220,
220,
220,
220,
220,
220,
220,
7552,
796,
2393,
62,
3672,
13,
35312,
10786,
2637,
38381,
12,
16,
60,
628,
220,
220,
220,
220,
220,
220,
220,
611,
7552,
6624,
705,
40664,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18868,
796,
40213,
13,
2220,
62,
40664,
7,
7753,
62,
3672,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
7552,
6624,
705,
14116,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18868,
796,
40213,
13,
2220,
62,
14116,
7,
7753,
62,
3672,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
7567,
2696,
281,
45751,
12331,
6631,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
304,
13,
28100,
1713,
12331,
10786,
8979,
7552,
407,
8018,
13,
632,
815,
307,
2035,
4600,
13,
40664,
63,
393,
764,
14116,
63,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
611,
18868,
423,
587,
6105,
9639,
198,
220,
220,
220,
220,
220,
220,
220,
611,
18868,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
304,
13,
11395,
12331,
10786,
6719,
12,
785,
17128,
18868,
714,
407,
587,
6105,
9639,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
27967,
262,
18868,
17593,
284,
262,
3119,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3866,
62,
17080,
1817,
796,
18868,
628,
220,
220,
220,
825,
3440,
7,
944,
11,
2393,
62,
3672,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
8912,
82,
262,
2134,
422,
257,
2298,
293,
21004,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
3672,
357,
2536,
2599,
12346,
293,
338,
2393,
3108,
284,
307,
9639,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
2746,
422,
2393,
25,
4064,
82,
2644,
3256,
2393,
62,
3672,
8,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
7753,
62,
3672,
11,
705,
26145,
11537,
355,
8159,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1034,
69,
796,
2298,
293,
13,
2220,
7,
47103,
62,
7753,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
834,
11600,
834,
13,
19119,
7,
404,
69,
13,
834,
11600,
834,
8,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
17633,
9639,
2637,
8,
628,
220,
220,
220,
825,
3613,
7,
944,
11,
2393,
62,
3672,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
50,
3080,
262,
2134,
284,
257,
2298,
293,
21004,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
3672,
357,
2536,
2599,
9220,
338,
1438,
284,
307,
7448,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
50,
2703,
2746,
284,
2393,
25,
4064,
82,
2644,
3256,
2393,
62,
3672,
8,
628,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
7753,
62,
3672,
11,
705,
39346,
11537,
355,
2244,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2298,
293,
13,
39455,
7,
944,
11,
2244,
62,
7753,
8,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
17633,
7448,
2637,
8,
628,
220,
220,
220,
825,
4197,
7,
944,
11,
1395,
11,
575,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
37,
896,
1366,
287,
262,
1398,
7483,
13,
628,
220,
220,
220,
220,
220,
220,
220,
632,
815,
307,
3264,
9177,
287,
13349,
37,
1200,
6097,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
357,
37659,
13,
18747,
2599,
15690,
286,
3033,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
575,
357,
37659,
13,
18747,
2599,
15690,
286,
14722,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
12331,
628,
220,
220,
220,
825,
4331,
7,
944,
11,
1395,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
39156,
14137,
649,
1366,
1262,
262,
662,
12,
35311,
1398,
7483,
13,
628,
220,
220,
220,
220,
220,
220,
220,
632,
815,
307,
3264,
9177,
287,
13349,
37,
1200,
6097,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
357,
37659,
13,
18747,
2599,
15690,
286,
3033,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
317,
1351,
286,
16277,
329,
1123,
1700,
286,
262,
1366,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
12331,
198
] | 2.43038 | 2,054 |
#!/usr/bin/env python
"""Record default module version and symlinks as shortcuts"""
import os
import re
import sys
from datetime import datetime
from pathlib import Path
def read_and_record_shortcuts(path, filename):
"""Read content of the directory, check validity, record to YAML file"""
path = Path(path)
symlinks = sorted([x for x in path.iterdir() if x.is_symlink()])
default_version = None
version_file = path / ".version"
if version_file.exists():
version_content = version_file.read_text()
match = re.search(
"^set ModulesVersion (.+)$", version_content, flags=re.MULTILINE
)
if match:
default_version = match.group(1)
else:
sys.exit(
"Module .version file exists, but ModulesVersion seems to be missing"
)
if not (path / default_version).exists():
sys.exit(
f"Module .version file exists, but version '{default_version}' does not"
)
with open(filename, "w") as record:
date = datetime.today().strftime("%Y-%m-%d")
record.write(f"date: {date}\n")
if default_version:
record.write(f'default: "{default_version}"\n')
if symlinks:
record.write("symbolic_links:\n")
for symlink in symlinks:
target = os.readlink(symlink)
if not symlink.exists():
sys.exit(
f"Symlink '{symlink}' exists,"
f" but the target '{target}' does not"
)
record.write(f' - name: "{symlink.name}"\n')
record.write(f' points_to: "{target}"\n')
def main():
"""Check parameters, make sure output directory exists, record shortcuts"""
if len(sys.argv) != 2:
sys.exit(f"Usage: {sys.argv[0]} MODULE_DIR")
metadata_dir = Path("available")
metadata_dir.mkdir(exist_ok=True)
read_and_record_shortcuts(sys.argv[1], metadata_dir / "shortcuts.yml")
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
37811,
23739,
4277,
8265,
2196,
290,
5659,
28751,
355,
32953,
37811,
198,
198,
11748,
28686,
198,
11748,
302,
198,
11748,
25064,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
3108,
8019,
1330,
10644,
628,
198,
4299,
1100,
62,
392,
62,
22105,
62,
19509,
23779,
7,
6978,
11,
29472,
2599,
198,
220,
220,
220,
37227,
5569,
2695,
286,
262,
8619,
11,
2198,
19648,
11,
1700,
284,
575,
2390,
43,
2393,
37811,
198,
220,
220,
220,
3108,
796,
10644,
7,
6978,
8,
198,
220,
220,
220,
5659,
28751,
796,
23243,
26933,
87,
329,
2124,
287,
3108,
13,
2676,
15908,
3419,
611,
2124,
13,
271,
62,
1837,
4029,
676,
3419,
12962,
628,
220,
220,
220,
4277,
62,
9641,
796,
6045,
198,
220,
220,
220,
2196,
62,
7753,
796,
3108,
1220,
27071,
9641,
1,
198,
220,
220,
220,
611,
2196,
62,
7753,
13,
1069,
1023,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
2196,
62,
11299,
796,
2196,
62,
7753,
13,
961,
62,
5239,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2872,
796,
302,
13,
12947,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
61,
2617,
3401,
5028,
14815,
20262,
28988,
3,
1600,
2196,
62,
11299,
11,
9701,
28,
260,
13,
44,
16724,
4146,
8881,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2872,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4277,
62,
9641,
796,
2872,
13,
8094,
7,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
26796,
764,
9641,
2393,
7160,
11,
475,
3401,
5028,
14815,
2331,
284,
307,
4814,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
357,
6978,
1220,
4277,
62,
9641,
737,
1069,
1023,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
1,
26796,
764,
9641,
2393,
7160,
11,
475,
2196,
705,
90,
12286,
62,
9641,
92,
6,
857,
407,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
351,
1280,
7,
34345,
11,
366,
86,
4943,
355,
1700,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3128,
796,
4818,
8079,
13,
40838,
22446,
2536,
31387,
7203,
4,
56,
12,
4,
76,
12,
4,
67,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1700,
13,
13564,
7,
69,
1,
4475,
25,
1391,
4475,
32239,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4277,
62,
9641,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1700,
13,
13564,
7,
69,
1549,
891,
1721,
25,
45144,
12286,
62,
9641,
36786,
59,
77,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5659,
28751,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1700,
13,
13564,
7203,
1837,
2022,
4160,
62,
28751,
7479,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
827,
4029,
676,
287,
5659,
28751,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2496,
796,
28686,
13,
961,
8726,
7,
1837,
4029,
676,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
827,
4029,
676,
13,
1069,
1023,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
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,
277,
1,
13940,
4029,
676,
705,
90,
1837,
4029,
676,
92,
6,
7160,
553,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
1,
475,
262,
2496,
705,
90,
16793,
92,
6,
857,
407,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1700,
13,
13564,
7,
69,
6,
220,
532,
1438,
25,
45144,
1837,
4029,
676,
13,
3672,
36786,
59,
77,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1700,
13,
13564,
7,
69,
6,
220,
220,
220,
2173,
62,
1462,
25,
45144,
16793,
36786,
59,
77,
11537,
628,
198,
4299,
1388,
33529,
198,
220,
220,
220,
37227,
9787,
10007,
11,
787,
1654,
5072,
8619,
7160,
11,
1700,
32953,
37811,
198,
220,
220,
220,
611,
18896,
7,
17597,
13,
853,
85,
8,
14512,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
37023,
7,
69,
1,
28350,
25,
1391,
17597,
13,
853,
85,
58,
15,
48999,
33893,
62,
34720,
4943,
198,
220,
220,
220,
20150,
62,
15908,
796,
10644,
7203,
15182,
4943,
198,
220,
220,
220,
20150,
62,
15908,
13,
28015,
15908,
7,
38476,
62,
482,
28,
17821,
8,
198,
220,
220,
220,
1100,
62,
392,
62,
22105,
62,
19509,
23779,
7,
17597,
13,
853,
85,
58,
16,
4357,
20150,
62,
15908,
1220,
366,
19509,
23779,
13,
88,
4029,
4943,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.164426 | 967 |
import unittest
from countryfinder.country_finder import find_countries
| [
11748,
555,
715,
395,
198,
198,
6738,
1499,
22805,
13,
19315,
62,
22805,
1330,
1064,
62,
9127,
1678,
628,
198
] | 3.75 | 20 |
# Copyright 2014-2015 PUNCH Cyber Analytics Group
#
# 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.
"""
Overview
========
Carve OLE streams within Microsoft Office Documents
"""
import olefile
from io import BytesIO
from stoq.plugins import StoqCarverPlugin
| [
2,
220,
220,
15069,
1946,
12,
4626,
350,
47461,
15101,
30437,
4912,
198,
2,
198,
2,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
220,
220,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
220,
220,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
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,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
220,
220,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
220,
220,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
220,
220,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
220,
220,
11247,
739,
262,
13789,
13,
198,
198,
37811,
198,
29064,
198,
2559,
198,
198,
9914,
303,
440,
2538,
15190,
1626,
5413,
4452,
33267,
198,
198,
37811,
198,
198,
11748,
267,
293,
7753,
198,
198,
6738,
33245,
1330,
2750,
4879,
9399,
198,
198,
6738,
3995,
80,
13,
37390,
1330,
22025,
80,
9914,
332,
37233,
628
] | 3.533937 | 221 |
from game import *
from random import *
# elementos e seus ids
# 1-fogo
# 2-agua
# 3-terra
# 4-ar
p1 = Player("P1","Guerreiro","Masculino","Indiano")
ws1 = [
#Weapon(id ,element ,price ,rarity ,strength ,speed),
Weapon( 1 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"espada"),
Weapon( 2 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"machado"),
Weapon( 3 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"clava"),
Weapon( 4 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"massa"),
Weapon( 5 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"adaga")
]
p2 = Player("P2","Guerreiro","Masculino","Australiano")
ws2 = [
#Weapon(id ,element ,price ,rarity ,strength ,speed),
Weapon( 6 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"espada"),
Weapon( 7 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"machado"),
Weapon( 8 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"clava"),
Weapon( 9 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"massa"),
Weapon(10 ,randint(1,4),randint(10,200),randint(1,5),randint(10,100),randint(2,10),"adaga")
]
p1.setItensInventory(ws1)
p1.equip()
p2.setItensInventory(ws2)
p2.equip()
print(p1)
print(p2)
print("="*100)
bf = BattleField(p1,p2)
print(bf.fight())
print(bf.showPlayersStatus())
time = 0
while(not bf.end() and p1.isEquipped() and p2.isEquipped()):
time += 1
if time >= 60:
print("apos uma luta epica os combatentes se cansaram e ambos cairam exaltos no chao e assim o campeao menos machucado foi escolhido")
print(("O "+bf.champion()+" Ganhou a luta") if bf.champion() != 0 else "Deu Empate ninguem ganhou, Droga tudo isso para nada -_-")
break
print(bf.fight())
print(bf.showPlayersStatus())
| [
6738,
983,
1330,
1635,
198,
6738,
4738,
1330,
1635,
198,
2,
5002,
418,
304,
384,
385,
220,
2340,
198,
2,
352,
12,
69,
24076,
198,
2,
362,
12,
363,
6413,
198,
2,
513,
12,
353,
430,
198,
2,
604,
12,
283,
198,
79,
16,
796,
7853,
7203,
47,
16,
2430,
8205,
263,
260,
7058,
2430,
38224,
3129,
2879,
2430,
5497,
10115,
4943,
198,
18504,
16,
796,
685,
198,
220,
220,
1303,
27632,
7,
312,
837,
30854,
220,
220,
220,
220,
837,
20888,
220,
220,
220,
220,
220,
220,
220,
220,
220,
837,
81,
6806,
220,
220,
220,
220,
220,
837,
41402,
220,
220,
220,
220,
220,
220,
837,
12287,
828,
220,
198,
220,
220,
220,
13072,
7,
352,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
9774,
4763,
12340,
198,
220,
220,
220,
13072,
7,
362,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
76,
620,
4533,
12340,
198,
220,
220,
220,
13072,
7,
513,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
565,
4170,
12340,
198,
220,
220,
220,
13072,
7,
604,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
22208,
64,
12340,
198,
220,
220,
220,
13072,
7,
642,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
324,
8126,
4943,
198,
220,
220,
220,
2361,
198,
79,
17,
796,
7853,
7203,
47,
17,
2430,
8205,
263,
260,
7058,
2430,
38224,
3129,
2879,
2430,
19763,
10115,
4943,
198,
18504,
17,
796,
685,
198,
220,
220,
1303,
27632,
7,
312,
837,
30854,
220,
220,
220,
220,
837,
20888,
220,
220,
220,
220,
220,
220,
220,
220,
220,
837,
81,
6806,
220,
220,
220,
220,
220,
837,
41402,
220,
220,
220,
220,
220,
220,
837,
12287,
828,
220,
198,
220,
220,
220,
13072,
7,
718,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
9774,
4763,
12340,
198,
220,
220,
220,
13072,
7,
767,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
76,
620,
4533,
12340,
198,
220,
220,
220,
13072,
7,
807,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
565,
4170,
12340,
198,
220,
220,
220,
13072,
7,
860,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
22208,
64,
12340,
198,
220,
220,
220,
13072,
7,
940,
837,
25192,
600,
7,
16,
11,
19,
828,
25192,
600,
7,
940,
11,
2167,
828,
25192,
600,
7,
16,
11,
20,
828,
25192,
600,
7,
940,
11,
3064,
828,
25192,
600,
7,
17,
11,
940,
27267,
324,
8126,
4943,
198,
220,
220,
220,
2361,
198,
79,
16,
13,
2617,
1026,
641,
818,
17158,
7,
18504,
16,
8,
198,
79,
16,
13,
4853,
541,
3419,
198,
79,
17,
13,
2617,
1026,
641,
818,
17158,
7,
18504,
17,
8,
198,
79,
17,
13,
4853,
541,
3419,
198,
4798,
7,
79,
16,
8,
198,
4798,
7,
79,
17,
8,
198,
198,
4798,
7203,
2625,
9,
3064,
8,
198,
198,
19881,
796,
5838,
15878,
7,
79,
16,
11,
79,
17,
8,
198,
198,
4798,
7,
19881,
13,
15481,
28955,
198,
4798,
7,
19881,
13,
12860,
24860,
19580,
28955,
198,
198,
2435,
796,
657,
198,
198,
4514,
7,
1662,
275,
69,
13,
437,
3419,
290,
279,
16,
13,
271,
23588,
3949,
3419,
290,
279,
17,
13,
271,
23588,
3949,
3419,
2599,
198,
220,
220,
220,
640,
15853,
352,
628,
220,
220,
220,
611,
640,
18189,
3126,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
499,
418,
334,
2611,
300,
29822,
2462,
3970,
28686,
5249,
298,
274,
384,
23916,
41158,
304,
4915,
418,
269,
958,
321,
409,
2501,
418,
645,
442,
5488,
304,
840,
320,
267,
12172,
431,
5488,
1450,
418,
3235,
1229,
4533,
11511,
72,
3671,
349,
71,
17305,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
7203,
46,
43825,
19881,
13,
354,
6734,
3419,
10,
1,
23207,
15710,
257,
300,
29822,
4943,
611,
275,
69,
13,
354,
6734,
3419,
14512,
657,
2073,
366,
5005,
84,
2295,
79,
378,
299,
6680,
368,
308,
272,
15710,
11,
360,
3828,
64,
256,
12003,
318,
568,
31215,
299,
4763,
532,
22955,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2270,
628,
220,
220,
220,
3601,
7,
19881,
13,
15481,
28955,
198,
220,
220,
220,
3601,
7,
19881,
13,
12860,
24860,
19580,
28955,
628,
198
] | 2.141189 | 942 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""The TensorBoard Scalars plugin.
See `http_api.md` in this directory for specifications of the routes for
this plugin.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import csv
import six
from six import StringIO
from werkzeug import wrappers
import numpy as np
from tensorboard import errors
from tensorboard import plugin_util
from tensorboard.backend import http_util
from tensorboard.data import provider
from tensorboard.plugins import base_plugin
from tensorboard.plugins.scalar import metadata
from tensorboard.util import tensor_util
_DEFAULT_DOWNSAMPLING = 1000 # scalars per time series
class OutputFormat(object):
"""An enum used to list the valid output formats for API calls."""
JSON = "json"
CSV = "csv"
class ScalarsPlugin(base_plugin.TBPlugin):
"""Scalars Plugin for TensorBoard."""
plugin_name = metadata.PLUGIN_NAME
def __init__(self, context):
"""Instantiates ScalarsPlugin via TensorBoard core.
Args:
context: A base_plugin.TBContext instance.
"""
self._downsample_to = (context.sampling_hints or {}).get(
self.plugin_name, _DEFAULT_DOWNSAMPLING
)
self._data_provider = context.data_provider
def index_impl(self, ctx, experiment=None):
"""Return {runName: {tagName: {displayName: ..., description:
...}}}."""
mapping = self._data_provider.list_scalars(
ctx, experiment_id=experiment, plugin_name=metadata.PLUGIN_NAME,
)
result = {run: {} for run in mapping}
for (run, tag_to_content) in six.iteritems(mapping):
for (tag, metadatum) in six.iteritems(tag_to_content):
description = plugin_util.markdown_to_safe_html(
metadatum.description
)
result[run][tag] = {
"displayName": metadatum.display_name,
"description": description,
}
return result
def scalars_impl(self, ctx, tag, run, experiment, output_format):
"""Result of the form `(body, mime_type)`."""
all_scalars = self._data_provider.read_scalars(
ctx,
experiment_id=experiment,
plugin_name=metadata.PLUGIN_NAME,
downsample=self._downsample_to,
run_tag_filter=provider.RunTagFilter(runs=[run], tags=[tag]),
)
scalars = all_scalars.get(run, {}).get(tag, None)
if scalars is None:
raise errors.NotFoundError(
"No scalar data for run=%r, tag=%r" % (run, tag)
)
values = [(x.wall_time, x.step, x.value) for x in scalars]
if output_format == OutputFormat.CSV:
string_io = StringIO()
writer = csv.writer(string_io)
writer.writerow(["Wall time", "Step", "Value"])
writer.writerows(values)
return (string_io.getvalue(), "text/csv")
else:
return (values, "application/json")
@wrappers.Request.application
@wrappers.Request.application
def scalars_route(self, request):
"""Given a tag and single run, return array of ScalarEvents."""
tag = request.args.get("tag")
run = request.args.get("run")
ctx = plugin_util.context(request.environ)
experiment = plugin_util.experiment_id(request.environ)
output_format = request.args.get("format")
(body, mime_type) = self.scalars_impl(
ctx, tag, run, experiment, output_format
)
return http_util.Respond(request, body, mime_type)
| [
2,
15069,
2177,
383,
309,
22854,
37535,
46665,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
2,
38093,
25609,
28,
198,
37811,
464,
309,
22854,
29828,
34529,
945,
13877,
13,
198,
198,
6214,
4600,
4023,
62,
15042,
13,
9132,
63,
287,
428,
8619,
329,
20640,
286,
262,
11926,
329,
198,
5661,
13877,
13,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
17268,
198,
11748,
269,
21370,
198,
198,
11748,
2237,
198,
6738,
2237,
1330,
10903,
9399,
198,
6738,
266,
9587,
2736,
1018,
1330,
7917,
11799,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
11192,
273,
3526,
1330,
8563,
198,
6738,
11192,
273,
3526,
1330,
13877,
62,
22602,
198,
6738,
11192,
273,
3526,
13,
1891,
437,
1330,
2638,
62,
22602,
198,
6738,
11192,
273,
3526,
13,
7890,
1330,
10131,
198,
6738,
11192,
273,
3526,
13,
37390,
1330,
2779,
62,
33803,
198,
6738,
11192,
273,
3526,
13,
37390,
13,
1416,
282,
283,
1330,
20150,
198,
6738,
11192,
273,
3526,
13,
22602,
1330,
11192,
273,
62,
22602,
628,
198,
62,
7206,
38865,
62,
35,
3913,
8035,
2390,
6489,
2751,
796,
8576,
220,
1303,
16578,
945,
583,
640,
2168,
628,
198,
4871,
25235,
26227,
7,
15252,
2599,
198,
220,
220,
220,
37227,
2025,
33829,
973,
284,
1351,
262,
4938,
5072,
17519,
329,
7824,
3848,
526,
15931,
628,
220,
220,
220,
19449,
796,
366,
17752,
1,
198,
220,
220,
220,
44189,
796,
366,
40664,
1,
628,
198,
4871,
34529,
945,
37233,
7,
8692,
62,
33803,
13,
22737,
37233,
2599,
198,
220,
220,
220,
37227,
3351,
282,
945,
42636,
329,
309,
22854,
29828,
526,
15931,
628,
220,
220,
220,
13877,
62,
3672,
796,
20150,
13,
6489,
7340,
1268,
62,
20608,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
4732,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
6310,
17096,
689,
34529,
945,
37233,
2884,
309,
22854,
29828,
4755,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4732,
25,
317,
2779,
62,
33803,
13,
51,
2749,
261,
5239,
4554,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
30371,
1403,
62,
1462,
796,
357,
22866,
13,
37687,
11347,
62,
71,
29503,
393,
23884,
737,
1136,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
33803,
62,
3672,
11,
4808,
7206,
38865,
62,
35,
3913,
8035,
2390,
6489,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
7890,
62,
15234,
1304,
796,
4732,
13,
7890,
62,
15234,
1304,
628,
220,
220,
220,
825,
6376,
62,
23928,
7,
944,
11,
269,
17602,
11,
6306,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
1391,
5143,
5376,
25,
1391,
12985,
5376,
25,
1391,
13812,
5376,
25,
2644,
11,
6764,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2644,
42535,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
16855,
796,
2116,
13557,
7890,
62,
15234,
1304,
13,
4868,
62,
1416,
282,
945,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
17602,
11,
6306,
62,
312,
28,
23100,
3681,
11,
13877,
62,
3672,
28,
38993,
13,
6489,
7340,
1268,
62,
20608,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
1391,
5143,
25,
23884,
329,
1057,
287,
16855,
92,
198,
220,
220,
220,
220,
220,
220,
220,
329,
357,
5143,
11,
7621,
62,
1462,
62,
11299,
8,
287,
2237,
13,
2676,
23814,
7,
76,
5912,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
357,
12985,
11,
1138,
324,
21307,
8,
287,
2237,
13,
2676,
23814,
7,
12985,
62,
1462,
62,
11299,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6764,
796,
13877,
62,
22602,
13,
4102,
2902,
62,
1462,
62,
21230,
62,
6494,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1138,
324,
21307,
13,
11213,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1255,
58,
5143,
7131,
12985,
60,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
13812,
5376,
1298,
1138,
324,
21307,
13,
13812,
62,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
11213,
1298,
6764,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1255,
628,
220,
220,
220,
825,
16578,
945,
62,
23928,
7,
944,
11,
269,
17602,
11,
7621,
11,
1057,
11,
6306,
11,
5072,
62,
18982,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
23004,
286,
262,
1296,
4600,
7,
2618,
11,
285,
524,
62,
4906,
8,
63,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
477,
62,
1416,
282,
945,
796,
2116,
13557,
7890,
62,
15234,
1304,
13,
961,
62,
1416,
282,
945,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
17602,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6306,
62,
312,
28,
23100,
3681,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13877,
62,
3672,
28,
38993,
13,
6489,
7340,
1268,
62,
20608,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21838,
1403,
28,
944,
13557,
30371,
1403,
62,
1462,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1057,
62,
12985,
62,
24455,
28,
15234,
1304,
13,
10987,
24835,
22417,
7,
48381,
41888,
5143,
4357,
15940,
41888,
12985,
46570,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
16578,
945,
796,
477,
62,
1416,
282,
945,
13,
1136,
7,
5143,
11,
23884,
737,
1136,
7,
12985,
11,
6045,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
16578,
945,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
8563,
13,
3673,
21077,
12331,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2949,
16578,
283,
1366,
329,
1057,
28,
4,
81,
11,
7621,
28,
4,
81,
1,
4064,
357,
5143,
11,
7621,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
3815,
796,
47527,
87,
13,
11930,
62,
2435,
11,
2124,
13,
9662,
11,
2124,
13,
8367,
8,
329,
2124,
287,
16578,
945,
60,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5072,
62,
18982,
6624,
25235,
26227,
13,
7902,
53,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4731,
62,
952,
796,
10903,
9399,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6260,
796,
269,
21370,
13,
16002,
7,
8841,
62,
952,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6260,
13,
16002,
322,
7,
14692,
22401,
640,
1600,
366,
8600,
1600,
366,
11395,
8973,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6260,
13,
16002,
1666,
7,
27160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
8841,
62,
952,
13,
1136,
8367,
22784,
366,
5239,
14,
40664,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
27160,
11,
366,
31438,
14,
17752,
4943,
628,
220,
220,
220,
2488,
29988,
11799,
13,
18453,
13,
31438,
628,
220,
220,
220,
2488,
29988,
11799,
13,
18453,
13,
31438,
198,
220,
220,
220,
825,
16578,
945,
62,
38629,
7,
944,
11,
2581,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
15056,
257,
7621,
290,
2060,
1057,
11,
1441,
7177,
286,
34529,
283,
37103,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
7621,
796,
2581,
13,
22046,
13,
1136,
7203,
12985,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
796,
2581,
13,
22046,
13,
1136,
7203,
5143,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
269,
17602,
796,
13877,
62,
22602,
13,
22866,
7,
25927,
13,
268,
2268,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6306,
796,
13877,
62,
22602,
13,
23100,
3681,
62,
312,
7,
25927,
13,
268,
2268,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5072,
62,
18982,
796,
2581,
13,
22046,
13,
1136,
7203,
18982,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
357,
2618,
11,
285,
524,
62,
4906,
8,
796,
2116,
13,
1416,
282,
945,
62,
23928,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
17602,
11,
7621,
11,
1057,
11,
6306,
11,
5072,
62,
18982,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2638,
62,
22602,
13,
19309,
623,
7,
25927,
11,
1767,
11,
285,
524,
62,
4906,
8,
198
] | 2.516129 | 1,736 |
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
from django.urls import path
from . import views
from rest_framework.routers import DefaultRouter
app_name = 'djangobasic'
# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r'survey', views.SurveyViewSet)
router.register(r'question', views.QuestionViewSet)
router.register(r'choice', views.ChoiceViewSet)
router.register(r'respond', views.ResponseViewSet)
router.register(r'user', views.UserViewSet)
urlpatterns = [
path('', login_required(views.IndexView.as_view()), name='index'),
path('<int:pk>/', login_required(views.DetailView.as_view()), name='detail'),
path('<int:pk>/results/', login_required(views.ResultsView.as_view()), name='results'),
path('<int:question_id>/respond/', views.respond, name='respond'),
url(r'^api/', include(router.urls)),
]
| [
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
19016,
11,
2291,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
12501,
273,
2024,
1330,
17594,
62,
35827,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
764,
1330,
5009,
198,
198,
6738,
1334,
62,
30604,
13,
472,
1010,
1330,
15161,
49,
39605,
628,
198,
1324,
62,
3672,
796,
705,
28241,
648,
672,
292,
291,
6,
628,
198,
2,
13610,
257,
20264,
290,
7881,
674,
5009,
1039,
351,
340,
13,
198,
472,
353,
796,
15161,
49,
39605,
3419,
198,
472,
353,
13,
30238,
7,
81,
338,
333,
3304,
3256,
5009,
13,
14214,
3304,
7680,
7248,
8,
198,
472,
353,
13,
30238,
7,
81,
6,
25652,
3256,
5009,
13,
24361,
7680,
7248,
8,
198,
472,
353,
13,
30238,
7,
81,
6,
25541,
3256,
5009,
13,
46770,
7680,
7248,
8,
198,
472,
353,
13,
30238,
7,
81,
821,
2777,
623,
3256,
5009,
13,
31077,
7680,
7248,
8,
198,
472,
353,
13,
30238,
7,
81,
6,
7220,
3256,
5009,
13,
12982,
7680,
7248,
8,
628,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
10786,
3256,
17594,
62,
35827,
7,
33571,
13,
15732,
7680,
13,
292,
62,
1177,
3419,
828,
1438,
11639,
9630,
33809,
198,
220,
220,
220,
3108,
10786,
27,
600,
25,
79,
74,
29,
14,
3256,
17594,
62,
35827,
7,
33571,
13,
11242,
603,
7680,
13,
292,
62,
1177,
3419,
828,
1438,
11639,
49170,
33809,
198,
220,
220,
220,
3108,
10786,
27,
600,
25,
79,
74,
29,
14,
43420,
14,
3256,
17594,
62,
35827,
7,
33571,
13,
25468,
7680,
13,
292,
62,
1177,
3419,
828,
1438,
11639,
43420,
33809,
198,
220,
220,
220,
3108,
10786,
27,
600,
25,
25652,
62,
312,
29,
14,
5546,
14,
3256,
5009,
13,
5546,
11,
1438,
11639,
5546,
33809,
198,
220,
220,
220,
19016,
7,
81,
6,
61,
15042,
14,
3256,
2291,
7,
472,
353,
13,
6371,
82,
36911,
198,
60,
628,
198
] | 2.876161 | 323 |
# Copyright (c) 2018 PaddlePaddle 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 __future__ import print_function
import logging
from paddle.fluid.op import Operator, DynamicRecurrentOp
import paddle.fluid.core as core
import unittest
import numpy as np
import paddle.fluid as fluid
from paddle.fluid.framework import Program, program_guard
class BeamSearchOpTester(unittest.TestCase):
"""unittest of beam_search_op"""
if __name__ == '__main__':
unittest.main()
| [
2,
220,
220,
15069,
357,
66,
8,
2864,
350,
37382,
47,
37382,
46665,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
18931,
198,
6738,
39517,
13,
35522,
312,
13,
404,
1330,
35946,
11,
26977,
6690,
6657,
18257,
198,
11748,
39517,
13,
35522,
312,
13,
7295,
355,
4755,
198,
11748,
555,
715,
395,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
39517,
13,
35522,
312,
355,
11711,
198,
6738,
39517,
13,
35522,
312,
13,
30604,
1330,
6118,
11,
1430,
62,
14864,
628,
198,
198,
4871,
25855,
18243,
18257,
51,
7834,
7,
403,
715,
395,
13,
14402,
20448,
2599,
198,
220,
220,
220,
37227,
403,
715,
395,
286,
15584,
62,
12947,
62,
404,
37811,
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.520833 | 288 |
from .uploads_images import custom_upload_to
| [
6738,
764,
39920,
62,
17566,
1330,
2183,
62,
25850,
62,
1462,
198
] | 3.75 | 12 |
import pickle
get_random_pgm_groups()
| [
11748,
2298,
293,
198,
198,
1136,
62,
25120,
62,
6024,
76,
62,
24432,
3419,
198
] | 2.6 | 15 |
# Copyright (C) 2021 rezasf - All Rights Reserved
import random
res = random.randint(0,40)
count = 1
while True:
daf =int(input("ye adad vared kon: "))
if daf == res :
print("bad az "+ str(count) +" bar talash"+" shoma bordid")
break
elif daf > res :
print("bro pain")
count += 1
elif daf < res :
print("bro bala")
count += 1
| [
2,
15069,
357,
34,
8,
33448,
302,
89,
292,
69,
532,
1439,
6923,
33876,
198,
11748,
4738,
198,
411,
796,
4738,
13,
25192,
600,
7,
15,
11,
1821,
8,
198,
9127,
796,
352,
198,
198,
4514,
6407,
25,
198,
220,
220,
220,
288,
1878,
796,
600,
7,
15414,
7203,
5948,
512,
324,
410,
1144,
479,
261,
25,
220,
366,
4008,
198,
220,
220,
220,
611,
288,
1878,
6624,
581,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
14774,
35560,
43825,
965,
7,
9127,
8,
1343,
1,
2318,
3305,
1077,
1,
10,
1,
427,
6086,
275,
585,
312,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
1288,
361,
288,
1878,
1875,
581,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
7957,
2356,
4943,
220,
198,
220,
220,
220,
220,
220,
220,
220,
954,
15853,
352,
198,
220,
220,
220,
1288,
361,
288,
1878,
1279,
581,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
7957,
3652,
64,
4943,
220,
198,
220,
220,
220,
220,
220,
220,
220,
954,
15853,
352,
220,
198
] | 2.135135 | 185 |
import magnetovis as mvs
import paraview.simple as pvs
time = [2015,3,20,0,0,0] # time not used if coord_sys = GSM
coord_sys = 'GSM'
M=7.788E22
dipoleFieldSourceDisplay, renderView, dipoleFieldSource = mvs.dipole_field(time, M, coord_sys)
# create a new 'Glyph'
glyph = pvs.Glyph(registrationName='-- Glyph', Input=dipoleFieldSource,
GlyphType='Arrow')
glyph.OrientationArray = ['POINTS', 'B_field']
glyph.ScaleArray = ['POINTS', 'No scale array']
# show data in view
glyphDisplay = pvs.Show(glyph, renderView, 'GeometryRepresentation')
glyphDisplay.Opacity = 0.72
# center and position camera
renderView.CameraPosition = [0, -120, 0]
renderView.CameraFocalPoint = [0, 0.0, 0]
renderView.CameraViewUp = [0.0, 0.0, 1.0]
pvs.Hide(dipoleFieldSource, renderView)
renderView.Update()
| [
11748,
19972,
709,
271,
355,
285,
14259,
198,
11748,
1582,
615,
769,
13,
36439,
355,
279,
14259,
198,
198,
2435,
796,
685,
4626,
11,
18,
11,
1238,
11,
15,
11,
15,
11,
15,
60,
1303,
640,
407,
973,
611,
6349,
62,
17597,
796,
402,
12310,
198,
37652,
62,
17597,
796,
705,
38,
12310,
6,
198,
44,
28,
22,
13,
22,
3459,
36,
1828,
198,
67,
541,
2305,
15878,
7416,
23114,
11,
8543,
7680,
11,
19550,
2305,
15878,
7416,
796,
220,
285,
14259,
13,
67,
541,
2305,
62,
3245,
7,
2435,
11,
337,
11,
6349,
62,
17597,
8,
198,
198,
2,
2251,
257,
649,
705,
38,
306,
746,
6,
198,
10853,
746,
796,
279,
14259,
13,
38,
306,
746,
7,
2301,
33397,
5376,
11639,
438,
27949,
746,
3256,
23412,
28,
67,
541,
2305,
15878,
7416,
11,
198,
220,
220,
220,
27949,
746,
6030,
11639,
3163,
808,
11537,
198,
10853,
746,
13,
46,
8289,
341,
19182,
796,
37250,
16402,
1268,
4694,
3256,
705,
33,
62,
3245,
20520,
198,
10853,
746,
13,
29990,
19182,
796,
37250,
16402,
1268,
4694,
3256,
705,
2949,
5046,
7177,
20520,
198,
198,
2,
905,
1366,
287,
1570,
198,
10853,
746,
23114,
796,
279,
14259,
13,
15307,
7,
10853,
746,
11,
8543,
7680,
11,
705,
10082,
15748,
40171,
341,
11537,
198,
10853,
746,
23114,
13,
18257,
4355,
796,
657,
13,
4761,
198,
198,
2,
3641,
290,
2292,
4676,
198,
13287,
7680,
13,
35632,
26545,
796,
685,
15,
11,
532,
10232,
11,
657,
60,
198,
13287,
7680,
13,
35632,
37,
4374,
12727,
796,
685,
15,
11,
657,
13,
15,
11,
657,
60,
198,
13287,
7680,
13,
35632,
7680,
4933,
796,
685,
15,
13,
15,
11,
657,
13,
15,
11,
352,
13,
15,
60,
198,
198,
79,
14259,
13,
38518,
7,
67,
541,
2305,
15878,
7416,
11,
8543,
7680,
8,
198,
13287,
7680,
13,
10260,
3419,
198
] | 2.578431 | 306 |
import functions as f
import random
import numpy as np
import matplotlib.pyplot as plt
import json
def crawl2(url, depth, first_call = 0, home_tags = None):
'''
Crawl the yt web graph and return relevance index
upto defined depth.
'''
print("---\tat depth = {}".format(depth))
if depth == 0:
return []
tags = home_tags
links = None
attempt=5
while (tags==None or links==None) and attempt>0:
attempt -= 1
tags, links = f.getDataFromUrl(url)
if tags == None or links == None:
print("---\t---\tpage issues...retrying")
continue
if attempt==0:
print("---\t---\tran out of attempts")
return []
temp_tags = None
attempt = 10
while temp_tags==None and attempt>0:
attempt -= 1
link = random.choice(links)
temp_tags, _ = f.getDataFromUrl(link)
if temp_tags == None:
print("---\t---\tpage issues...skipping page")
continue
if attempt==0:
print("---\t---\tran out of attempts")
return []
relevance_list = []
relevance = 0
if first_call==0:
tags = home_tags
relevance = f.getRelevance(tags, temp_tags)
relevance_list.append(relevance)
return_list = crawl2(link, depth-1, 0, tags)
relevance_list = relevance_list + return_list
return relevance_list
# Start URLs
urls = []
with open("links.txt","r") as file:
urls = file.readlines()
urls = list(set(urls))
# Each item in this list is a list with relevance
# at different depths signified by their indices
results_for_urls = []
depth_range = 16
num_links = len(urls)
lim_urls = random.sample(urls,num_links)
results_for_json = {}
for index, url in enumerate(lim_urls):
print("FOR \turl#{}/{}".format(index + 1, len(lim_urls)))
try:
result = crawl2(url, depth_range, 1)
except:
continue
if len(result)==depth_range:
# Save result in json
results_for_json[url] = result
with open("results_appended_new.json","w") as file:
file.write(json.dumps(results_for_json))
# links_done.add(url)
results_for_urls.append(result)
visualize_results(results_for_urls)
| [
11748,
5499,
355,
277,
198,
11748,
4738,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
33918,
198,
198,
4299,
27318,
17,
7,
6371,
11,
6795,
11,
717,
62,
13345,
796,
657,
11,
1363,
62,
31499,
796,
6045,
2599,
198,
197,
7061,
6,
198,
197,
34,
13132,
262,
331,
83,
3992,
4823,
290,
1441,
23082,
6376,
198,
197,
37623,
78,
5447,
6795,
13,
198,
197,
7061,
6,
198,
197,
4798,
7203,
6329,
59,
83,
265,
6795,
796,
23884,
1911,
18982,
7,
18053,
4008,
198,
197,
361,
6795,
6624,
657,
25,
198,
197,
197,
7783,
17635,
198,
197,
198,
197,
31499,
796,
1363,
62,
31499,
198,
197,
28751,
796,
6045,
198,
197,
1078,
1791,
28,
20,
198,
197,
4514,
357,
31499,
855,
14202,
393,
6117,
855,
14202,
8,
290,
2230,
29,
15,
25,
198,
197,
197,
1078,
1791,
48185,
352,
198,
197,
197,
31499,
11,
6117,
796,
277,
13,
1136,
6601,
4863,
28165,
7,
6371,
8,
198,
197,
197,
361,
15940,
6624,
6045,
393,
6117,
6624,
6045,
25,
198,
197,
197,
197,
4798,
7203,
6329,
59,
83,
6329,
59,
83,
7700,
2428,
986,
1186,
14992,
4943,
198,
197,
197,
197,
43043,
198,
197,
198,
197,
361,
2230,
855,
15,
25,
198,
197,
197,
4798,
7203,
6329,
59,
83,
6329,
59,
2213,
272,
503,
286,
6370,
4943,
198,
197,
197,
7783,
17635,
628,
197,
29510,
62,
31499,
796,
6045,
198,
197,
1078,
1791,
796,
838,
198,
197,
4514,
20218,
62,
31499,
855,
14202,
290,
2230,
29,
15,
25,
198,
197,
197,
1078,
1791,
48185,
352,
198,
197,
197,
8726,
796,
4738,
13,
25541,
7,
28751,
8,
198,
197,
197,
29510,
62,
31499,
11,
4808,
796,
277,
13,
1136,
6601,
4863,
28165,
7,
8726,
8,
198,
197,
197,
361,
20218,
62,
31499,
6624,
6045,
25,
198,
197,
197,
197,
4798,
7203,
6329,
59,
83,
6329,
59,
83,
7700,
2428,
986,
20545,
2105,
2443,
4943,
198,
197,
197,
197,
43043,
198,
197,
361,
2230,
855,
15,
25,
198,
197,
197,
4798,
7203,
6329,
59,
83,
6329,
59,
2213,
272,
503,
286,
6370,
4943,
198,
197,
197,
7783,
17635,
198,
197,
260,
2768,
590,
62,
4868,
796,
17635,
198,
197,
260,
2768,
590,
796,
657,
198,
197,
361,
717,
62,
13345,
855,
15,
25,
198,
197,
197,
31499,
796,
1363,
62,
31499,
198,
197,
260,
2768,
590,
796,
277,
13,
1136,
3041,
2768,
590,
7,
31499,
11,
20218,
62,
31499,
8,
198,
197,
260,
2768,
590,
62,
4868,
13,
33295,
7,
260,
2768,
590,
8,
198,
197,
7783,
62,
4868,
796,
27318,
17,
7,
8726,
11,
6795,
12,
16,
11,
657,
11,
15940,
8,
198,
197,
260,
2768,
590,
62,
4868,
796,
23082,
62,
4868,
1343,
1441,
62,
4868,
198,
197,
7783,
23082,
62,
4868,
198,
198,
2,
7253,
32336,
198,
6371,
82,
796,
17635,
198,
4480,
1280,
7203,
28751,
13,
14116,
2430,
81,
4943,
355,
2393,
25,
198,
197,
6371,
82,
796,
2393,
13,
961,
6615,
3419,
198,
198,
6371,
82,
796,
1351,
7,
2617,
7,
6371,
82,
4008,
198,
2,
5501,
2378,
287,
428,
1351,
318,
257,
1351,
351,
23082,
198,
2,
379,
1180,
21593,
1051,
1431,
416,
511,
36525,
198,
43420,
62,
1640,
62,
6371,
82,
796,
17635,
198,
18053,
62,
9521,
796,
1467,
198,
22510,
62,
28751,
796,
18896,
7,
6371,
82,
8,
198,
2475,
62,
6371,
82,
796,
4738,
13,
39873,
7,
6371,
82,
11,
22510,
62,
28751,
8,
198,
198,
43420,
62,
1640,
62,
17752,
796,
23884,
198,
1640,
6376,
11,
19016,
287,
27056,
378,
7,
2475,
62,
6371,
82,
2599,
198,
220,
220,
220,
3601,
7203,
13775,
3467,
83,
6371,
2,
90,
92,
14,
90,
92,
1911,
18982,
7,
9630,
1343,
352,
11,
18896,
7,
2475,
62,
6371,
82,
22305,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
27318,
17,
7,
6371,
11,
6795,
62,
9521,
11,
352,
8,
198,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
611,
18896,
7,
20274,
8,
855,
18053,
62,
9521,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
12793,
1255,
287,
33918,
198,
220,
220,
220,
220,
220,
220,
220,
2482,
62,
1640,
62,
17752,
58,
6371,
60,
796,
1255,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7203,
43420,
62,
1324,
1631,
62,
3605,
13,
17752,
2430,
86,
4943,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
13,
13564,
7,
17752,
13,
67,
8142,
7,
43420,
62,
1640,
62,
17752,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6117,
62,
28060,
13,
2860,
7,
6371,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2482,
62,
1640,
62,
6371,
82,
13,
33295,
7,
20274,
8,
198,
198,
41464,
1096,
62,
43420,
7,
43420,
62,
1640,
62,
6371,
82,
8,
628,
198
] | 2.506732 | 817 |
import numpy as np
import innvestigate
import innvestigate.utils as iutils
import innvestigate.utils.visualizations as ivis
| [
11748,
299,
32152,
355,
45941,
198,
198,
11748,
3527,
4223,
10055,
198,
11748,
3527,
4223,
10055,
13,
26791,
355,
1312,
26791,
198,
11748,
3527,
4223,
10055,
13,
26791,
13,
41464,
4582,
355,
21628,
271,
628,
628,
628,
198
] | 3.447368 | 38 |
from django.db import models
import uuid
from model_utils.models import TimeStampedModel
from django.conf import settings
# Create your models here.
| [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
11748,
334,
27112,
198,
6738,
2746,
62,
26791,
13,
27530,
1330,
3862,
1273,
13322,
17633,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
628,
198,
198,
2,
13610,
534,
4981,
994,
13,
628,
628
] | 3.690476 | 42 |
import platform, sublime, sublime_plugin
| [
11748,
3859,
11,
41674,
11,
41674,
62,
33803,
628,
198
] | 4.3 | 10 |
from ..common.trex_exceptions import *
from ..utils.common import *
from ..utils.text_tables import TRexTextTable, print_table_with_header
from ..utils import parsing_opts
| [
6738,
11485,
11321,
13,
83,
21510,
62,
1069,
11755,
1330,
1635,
198,
6738,
11485,
26791,
13,
11321,
1330,
1635,
198,
6738,
11485,
26791,
13,
5239,
62,
83,
2977,
1330,
7579,
1069,
8206,
10962,
11,
3601,
62,
11487,
62,
4480,
62,
25677,
198,
6738,
11485,
26791,
1330,
32096,
62,
404,
912,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628,
628
] | 3.145161 | 62 |
import turtle
import pyperclip as pc
class TreeBuild:
""" Display how our tree looks like. """
@staticmethod
@staticmethod
class SquareBracketToCurlyBracket:
""" [[ ]] -> {{}} or [] -> {} or [[...[]...]] -> {{..{}..}} """
if __name__ == "__main__":
rep = "y"
while rep == "y" or rep == "Y":
print("*" * 10 + " ~~HELPER MENU~~ " + "*" * 10 + "\n")
print("1. Draw Tree (press 1) ")
print("2. Convert [] to {} (press 2) ")
print("3. String to CharArray e.g., \"add\" -> \"{'a','d','d'}\" (press 3)")
inp = int(input("\nPress enter your choice : "))
print()
if inp == 1:
t = TreeBuild()
elif inp == 2:
t = SquareBracketToCurlyBracket()
elif inp == 3:
t = ToCharArray()
else:
exit()
rep = input(
"\nDo you want to see 'HELPER MENU', if true 'y' else 'n' : "
).strip()
| [
11748,
28699,
198,
11748,
12972,
525,
15036,
355,
40653,
628,
198,
198,
4871,
12200,
15580,
25,
198,
220,
220,
220,
37227,
16531,
703,
674,
5509,
3073,
588,
13,
37227,
628,
220,
220,
220,
2488,
12708,
24396,
628,
220,
220,
220,
2488,
12708,
24396,
628,
198,
4871,
9276,
9414,
8317,
2514,
26628,
306,
9414,
8317,
25,
198,
220,
220,
220,
37227,
16410,
2361,
60,
4613,
22935,
11709,
393,
17635,
4613,
23884,
393,
16410,
986,
21737,
986,
11907,
4613,
22935,
492,
90,
92,
492,
11709,
37227,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1128,
796,
366,
88,
1,
198,
220,
220,
220,
981,
1128,
6624,
366,
88,
1,
393,
1128,
6624,
366,
56,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
9,
1,
1635,
838,
1343,
366,
220,
4907,
39,
3698,
18973,
41597,
52,
4907,
366,
1343,
366,
9,
1,
1635,
838,
1343,
37082,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
16,
13,
15315,
12200,
357,
8439,
352,
8,
366,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
17,
13,
38240,
17635,
284,
23884,
357,
8439,
362,
8,
366,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
18,
13,
10903,
284,
3178,
19182,
304,
13,
70,
1539,
19990,
2860,
7879,
4613,
19990,
90,
6,
64,
41707,
67,
41707,
67,
6,
92,
7879,
357,
8439,
513,
8,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
287,
79,
796,
493,
7,
15414,
7203,
59,
77,
13800,
3802,
534,
3572,
1058,
366,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
611,
287,
79,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
796,
12200,
15580,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
287,
79,
6624,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
796,
9276,
9414,
8317,
2514,
26628,
306,
9414,
8317,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
287,
79,
6624,
513,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
796,
1675,
12441,
19182,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8420,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1128,
796,
5128,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37082,
77,
5211,
345,
765,
284,
766,
705,
39,
3698,
18973,
41597,
52,
3256,
611,
2081,
705,
88,
6,
2073,
705,
77,
6,
1058,
366,
198,
220,
220,
220,
220,
220,
220,
220,
6739,
36311,
3419,
198
] | 2.071739 | 460 |
import pickle
import os
import json
from sentence_transformers import SentenceTransformer
if __name__ == "__main__":
model = SentenceTransformer('distiluse-base-multilingual-cased', device='cuda')
# path = ['./chat_text/poetry.txt', './chat_text/chat_text.txt']
# path = ['./chat_text/chat_text.txt', './chat_text/ownthink_v2.txt']
path = ['./chat_text/basic_settings.jsonl', './chat_text/natsu_chat.jsonl']
limit = 300000
count = 0
if os.path.isfile('embeddings.pickle'):
with open('embeddings.pickle', 'rb') as file:
embedding_cache = pickle.load(file)
else:
embedding_cache = {}
for each_path in path:
print(each_path)
with open(each_path, 'r', encoding='utf-8') as f:
questions = []
for each_line in f:
obj = json.loads(each_line)
question, answer = obj['question'], obj['answer']
if 'context' in obj:
context = obj['context']
for each_context in context:
if each_context not in embedding_cache:
questions.append(each_context)
if question not in embedding_cache:
questions.append(question)
if len(questions) > 4096 * 10:
out = model.encode(questions, batch_size=512, show_progress_bar=True)
for i, each_out in enumerate(out):
embedding_cache[questions[i]] = each_out
questions.clear()
count += 1
if count > limit:
break
# 把剩余question全部处理完
if len(questions) != 0:
out = model.encode(questions, show_progress_bar=True)
for i, each_out in enumerate(out):
embedding_cache[questions[i]] = each_out
questions.clear()
if count > limit:
break
with open('embeddings.pickle', 'wb') as file:
pickle.dump(embedding_cache, file) | [
11748,
2298,
293,
198,
11748,
28686,
198,
11748,
33918,
198,
6738,
6827,
62,
35636,
364,
1330,
11352,
594,
8291,
16354,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
2746,
796,
11352,
594,
8291,
16354,
10786,
17080,
346,
1904,
12,
8692,
12,
16680,
34900,
12,
66,
839,
3256,
3335,
11639,
66,
15339,
11537,
198,
220,
220,
220,
1303,
3108,
796,
685,
4458,
14,
17006,
62,
5239,
14,
7501,
11973,
13,
14116,
3256,
705,
19571,
17006,
62,
5239,
14,
17006,
62,
5239,
13,
14116,
20520,
198,
220,
220,
220,
1303,
3108,
796,
685,
4458,
14,
17006,
62,
5239,
14,
17006,
62,
5239,
13,
14116,
3256,
705,
19571,
17006,
62,
5239,
14,
593,
14925,
62,
85,
17,
13,
14116,
20520,
198,
220,
220,
220,
3108,
796,
685,
4458,
14,
17006,
62,
5239,
14,
35487,
62,
33692,
13,
17752,
75,
3256,
705,
19571,
17006,
62,
5239,
14,
77,
19231,
62,
17006,
13,
17752,
75,
20520,
198,
220,
220,
220,
4179,
796,
5867,
830,
198,
220,
220,
220,
954,
796,
657,
198,
220,
220,
220,
611,
28686,
13,
6978,
13,
4468,
576,
10786,
20521,
67,
654,
13,
27729,
293,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
10786,
20521,
67,
654,
13,
27729,
293,
3256,
705,
26145,
11537,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11525,
12083,
62,
23870,
796,
2298,
293,
13,
2220,
7,
7753,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
11525,
12083,
62,
23870,
796,
23884,
198,
220,
220,
220,
329,
1123,
62,
6978,
287,
3108,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
27379,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
27379,
62,
6978,
11,
705,
81,
3256,
21004,
11639,
40477,
12,
23,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2683,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1123,
62,
1370,
287,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26181,
796,
33918,
13,
46030,
7,
27379,
62,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1808,
11,
3280,
796,
26181,
17816,
25652,
6,
4357,
26181,
17816,
41484,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
22866,
6,
287,
26181,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4732,
796,
26181,
17816,
22866,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1123,
62,
22866,
287,
4732,
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,
1123,
62,
22866,
407,
287,
11525,
12083,
62,
23870,
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,
2683,
13,
33295,
7,
27379,
62,
22866,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1808,
407,
287,
11525,
12083,
62,
23870,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2683,
13,
33295,
7,
25652,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
6138,
507,
8,
1875,
42479,
1635,
838,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2746,
13,
268,
8189,
7,
6138,
507,
11,
15458,
62,
7857,
28,
25836,
11,
905,
62,
33723,
62,
5657,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
1123,
62,
448,
287,
27056,
378,
7,
448,
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,
11525,
12083,
62,
23870,
58,
6138,
507,
58,
72,
11907,
796,
1123,
62,
448,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2683,
13,
20063,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
954,
1875,
4179,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10545,
232,
232,
30298,
102,
19526,
247,
25652,
17739,
101,
32849,
101,
13783,
226,
49426,
228,
22522,
234,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
6138,
507,
8,
14512,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2746,
13,
268,
8189,
7,
6138,
507,
11,
905,
62,
33723,
62,
5657,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
1123,
62,
448,
287,
27056,
378,
7,
448,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11525,
12083,
62,
23870,
58,
6138,
507,
58,
72,
11907,
796,
1123,
62,
448,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2683,
13,
20063,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
954,
1875,
4179,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
351,
1280,
10786,
20521,
67,
654,
13,
27729,
293,
3256,
705,
39346,
11537,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2298,
293,
13,
39455,
7,
20521,
12083,
62,
23870,
11,
2393,
8
] | 1.946878 | 1,073 |
from numbers import Number
from typing import Type
import numpy as np
import torch
# taken from https://stackoverflow.com/questions/18376935/best-practice-for-equality-in-python
def nested_equal(a, b):
"""
Compare two objects recursively by element, handling numpy objects.
Assumes hashable items are not mutable in a way that affects equality.
"""
if type(a) is not type(b):
return False
if isinstance(a, str):
return a == b
if isinstance(a, Number):
return a == b
if isinstance(a, np.ndarray):
return np.all(a == b)
if isinstance(a, torch.Tensor):
return torch.equal(a, b)
if isinstance(a, list):
return all(nested_equal(x, y) for x, y in zip(a, b))
if isinstance(a, dict):
if set(a.keys()) != set(b.keys()):
return False
return all(nested_equal(a[k], b[k]) for k in a.keys())
return a == b
| [
6738,
3146,
1330,
7913,
198,
6738,
19720,
1330,
5994,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28034,
628,
198,
198,
2,
2077,
422,
3740,
1378,
25558,
2502,
11125,
13,
785,
14,
6138,
507,
14,
1507,
2718,
3388,
2327,
14,
13466,
12,
39541,
12,
1640,
12,
48203,
12,
259,
12,
29412,
198,
4299,
28376,
62,
40496,
7,
64,
11,
275,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
27814,
734,
5563,
664,
1834,
2280,
416,
5002,
11,
9041,
299,
32152,
5563,
13,
628,
220,
220,
220,
2195,
8139,
12234,
540,
3709,
389,
407,
4517,
540,
287,
257,
835,
326,
10975,
10537,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
611,
2099,
7,
64,
8,
318,
407,
2099,
7,
65,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
628,
220,
220,
220,
611,
318,
39098,
7,
64,
11,
965,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
257,
6624,
275,
628,
220,
220,
220,
611,
318,
39098,
7,
64,
11,
7913,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
257,
6624,
275,
628,
220,
220,
220,
611,
318,
39098,
7,
64,
11,
45941,
13,
358,
18747,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
45941,
13,
439,
7,
64,
6624,
275,
8,
628,
220,
220,
220,
611,
318,
39098,
7,
64,
11,
28034,
13,
51,
22854,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
28034,
13,
40496,
7,
64,
11,
275,
8,
628,
220,
220,
220,
611,
318,
39098,
7,
64,
11,
1351,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
477,
7,
77,
7287,
62,
40496,
7,
87,
11,
331,
8,
329,
2124,
11,
331,
287,
19974,
7,
64,
11,
275,
4008,
628,
220,
220,
220,
611,
318,
39098,
7,
64,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
900,
7,
64,
13,
13083,
28955,
14512,
900,
7,
65,
13,
13083,
3419,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
477,
7,
77,
7287,
62,
40496,
7,
64,
58,
74,
4357,
275,
58,
74,
12962,
329,
479,
287,
257,
13,
13083,
28955,
628,
220,
220,
220,
1441,
257,
6624,
275,
198
] | 2.456464 | 379 |
from werkzeug.utils import ImportStringError
from flask.config import Config
class LazyValue(object):
"""
This class may be used to lazy resolve config after importing local overrides.
For example:
REDIS_URL = "redis://localhost:6379/0"
CELERY_BROKER_URL = LazyValue(lambda conf: conf['REDIS_URL'])
After running Config.resolve_lazy_values()
CELERY_BROKER_URL will be resolved to REDIS_URL, even if REDIS_URL were redefined later.
"""
_counter = 0
| [
6738,
266,
9587,
2736,
1018,
13,
26791,
1330,
17267,
10100,
12331,
198,
6738,
42903,
13,
11250,
1330,
17056,
628,
198,
4871,
406,
12582,
11395,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
770,
1398,
743,
307,
973,
284,
16931,
10568,
4566,
706,
33332,
1957,
23170,
1460,
13,
198,
220,
220,
220,
1114,
1672,
25,
198,
220,
220,
220,
23848,
1797,
62,
21886,
796,
366,
445,
271,
1378,
36750,
25,
21,
29088,
14,
15,
1,
198,
220,
220,
220,
327,
3698,
19664,
62,
11473,
11380,
1137,
62,
21886,
796,
406,
12582,
11395,
7,
50033,
1013,
25,
1013,
17816,
22083,
1797,
62,
21886,
6,
12962,
628,
220,
220,
220,
2293,
2491,
17056,
13,
411,
6442,
62,
75,
12582,
62,
27160,
3419,
198,
220,
220,
220,
327,
3698,
19664,
62,
11473,
11380,
1137,
62,
21886,
481,
307,
12939,
284,
23848,
1797,
62,
21886,
11,
772,
611,
23848,
1797,
62,
21886,
547,
2266,
18156,
1568,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4808,
24588,
796,
657,
628
] | 2.870588 | 170 |
#!/usr/bin/env python3
"""
This file contains configs that could not be inferred from the default values
provided by PyTorch. If PyTorch optimizers and lr_schedulers had type annotations
then we could infer everything.
default values that cannot be inferred:
- tuple
- None
- required parameters (no default value)
Sometimes there are no defaults to infer from, so we got to include those here.
TODO: remove this file once we can infer everything.
"""
from typing import List, Optional, Union
from reagent.core.dataclasses import dataclass
from .scheduler import LearningRateSchedulerConfig
@dataclass(frozen=True)
@dataclass(frozen=True)
@dataclass(frozen=True)
@dataclass(frozen=True)
@dataclass(frozen=True)
@dataclass(frozen=True)
@dataclass(frozen=True)
@dataclass(frozen=True)
@dataclass(frozen=True)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
37811,
198,
1212,
2393,
4909,
4566,
82,
326,
714,
407,
307,
41240,
422,
262,
4277,
3815,
198,
41279,
416,
9485,
15884,
354,
13,
1002,
9485,
15884,
354,
6436,
11341,
290,
300,
81,
62,
1416,
704,
377,
364,
550,
2099,
37647,
198,
8524,
356,
714,
13249,
2279,
13,
198,
12286,
3815,
326,
2314,
307,
41240,
25,
198,
12,
46545,
198,
12,
6045,
198,
12,
2672,
10007,
357,
3919,
4277,
1988,
8,
198,
198,
15468,
612,
389,
645,
26235,
284,
13249,
422,
11,
523,
356,
1392,
284,
2291,
883,
994,
13,
198,
51,
3727,
46,
25,
4781,
428,
2393,
1752,
356,
460,
13249,
2279,
13,
198,
37811,
198,
6738,
19720,
1330,
7343,
11,
32233,
11,
4479,
198,
198,
6738,
302,
25781,
13,
7295,
13,
19608,
330,
28958,
1330,
4818,
330,
31172,
198,
198,
6738,
764,
1416,
704,
18173,
1330,
18252,
32184,
50,
1740,
18173,
16934,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
628,
198,
31,
19608,
330,
31172,
7,
69,
42005,
28,
17821,
8,
198
] | 3.152091 | 263 |
# -*- coding: utf-8 -*-
"""Miscellaneous utils of the package."""
import copy
import inspect
import itertools
import logging
import os
import pickle
import random
from collections import defaultdict
from glob import glob
from statistics import mean
from typing import List
import numpy as np
log = logging.getLogger(__name__)
def from_pickle(input_path):
"""Read network from pickle."""
with open(input_path, 'rb') as f:
unpickler = pickle.Unpickler(f)
background_mat = unpickler.load()
return background_mat
def to_pickle(to_pickle, output):
"""Write pickle."""
with open(output, 'wb') as file:
pickle.dump(to_pickle, file)
def get_or_create_dir(path, basename=True) -> List[str]:
"""If a folder in path exist retrieve list of files, else create folder."""
if not os.path.exists(path):
os.makedirs(path)
return []
else:
return get_files_list(path, basename)
def get_dir_list(path, basename=False):
"""Get list of directories in path."""
if basename:
return [os.path.basename(os.path.normpath(f)) for f in glob(os.path.join(path, "*")) if os.path.isdir(f)]
else:
return [f for f in glob(os.path.join(path, "*")) if os.path.isdir(f)]
def get_files_list(path, basename=False):
"""Get list of files in path."""
if basename:
return [os.path.basename(os.path.normpath(f)) for f in glob(os.path.join(path, "*")) if os.path.isfile(f)]
else:
return [f for f in glob(os.path.join(path, "*")) if os.path.isfile(f)]
def get_last_file(path):
"""Get last file."""
list_of_files = glob(os.path.join(path, '*'))
return max(list_of_files, key=os.path.getctime)
def get_kernel_from_graph(graph, kernel_method, normalized=False):
"""Get kernel from graph given a kernel method."""
if 'normalized' in inspect.getfullargspec(kernel_method).args:
return kernel_method(graph, normalized=normalized)
else:
return kernel_method(graph)
def print_dict_dimensions(entities_db, title='', message='Total number of '):
"""Print dimension of the dictionary."""
total = set()
m = f'{title}\n'
for k1, v1 in entities_db.items():
m = ''
if isinstance(v1, dict):
for k2, v2 in v1.items():
m += f'{k2}({len(v2)}), '
total.update(v2)
else:
m += f'{len(v1)} '
total.update(v1)
print(f'{message} {k1}: {m} ')
print(f'Total: {len(total)} ')
def print_dict(dict_to_print, message=''):
"""Print dimension of the dictionary."""
for k1, v1 in dict_to_print.items():
print(f'{message} {k1}: {len(v1)} ')
def get_labels_set_from_dict(entities):
"""Return label set from entity dict values."""
if isinstance(list(entities.values())[0], dict):
# TODO: Check
return set(itertools.chain.from_iterable(itertools.chain.from_iterable(entities.values())))
else:
return set(itertools.chain.from_iterable(entities.values()))
def reverse_twodim_dict(input_d: dict):
"""Revert key-value dictionary."""
dict1 = copy.deepcopy(input_d)
d = defaultdict(lambda: defaultdict(lambda: list))
for k1, entities1 in dict1.items():
for k2, entities2 in entities1.items():
d[k2][k1] = entities2
d[k2] = dict(d[k2])
return dict(d)
def reduce_dict_dimension(d: dict):
"""Reduce dictionary dimension."""
reduced_dict = {}
dict1 = copy.deepcopy(d)
for k1, entities1 in dict1.items():
for k2, entities2 in entities1.items():
if k1 in reduced_dict.keys():
reduced_dict[k1].update(entities2)
else:
reduced_dict[k1] = entities2
return reduced_dict
def reduce_dict_two_dimensional(d1: dict):
"""Reduce dictionary two dimension."""
d2 = reduce_dict_dimension(d1)
return {entity: entity_value
for entity_type, entity_set in d2.items()
for entity, entity_value in entity_set.items()
}
def split_random_two_subsets(to_split):
"""Split random two subsets."""
if isinstance(to_split, dict):
to_split_labels = list(to_split.keys())
else:
to_split_labels = to_split
half_1 = random.sample(population=list(to_split_labels), k=int(len(to_split_labels) / 2))
half_2 = list(set(to_split_labels) - set(half_1))
if isinstance(to_split, dict):
return {entity_label: to_split[entity_label] for entity_label in half_1}, \
{entity_label: to_split[entity_label] for entity_label in half_2}
else:
return half_1, half_2
def hide_true_positives(to_split, k=0.5):
"""Hide relative number of labels."""
if isinstance(to_split, set):
to_split = list(to_split)
new_labels = to_split[:]
# Check for -1
if -1 in new_labels:
new_labels = [0 if label == -1 else label for label in new_labels]
indices = [index for index, label in enumerate(new_labels) if label != 0]
for index in random.choices(indices, k=int(k * len(indices))):
new_labels[index] = 0
return new_labels
def split_random_three_subsets(to_split):
"""Split proportionally random-chosen a given set in three subsets."""
half_1 = random.sample(population=list(to_split), k=int(len(to_split) / 3))
half_2, half_3 = split_random_two_subsets(list(set(to_split) - set(half_1)))
return half_1, half_2, half_3
def get_three_venn_intersections(set1, set2, set3):
"""Get the intersection and disjunction sets from three given subsets."""
set1, set2, set3 = set(set1), set(set2), set(set3)
set1_set2 = set1.intersection(set2)
set1_set3 = set1.intersection(set3)
core = set1_set3.intersection(set1_set2)
set1_set2 = set1_set2 - core
set1_set3 = set1_set3 - core
set2_set3 = set2.intersection(set3) - core
return {'unique_set1': set1 - set1_set2 - set1_set3 - core,
'unique_set2': set2 - set1_set2 - set2_set3 - core,
'set1_set2': set1_set2,
'unique_set3': set3 - set1_set3 - set2_set3 - core,
'set1_set3': set1_set3,
'set2_set3': set2_set3,
'core': core,
}
def random_disjoint_intersection_two_subsets(unique_set1, unique_set2, intersection):
"""Split proportionaly random-chosen the intersection of two subsets and concatenate it to the disjoint part."""
set1, set2 = split_random_two_subsets(intersection)
return unique_set1 | set(set1), unique_set2 | set(set2)
def random_disjoint_intersection_three_subsets(sets_dict):
"""Split proportionally random-chosen the intersections of three subsets and concatenate it to the disjoint part."""
set_labels = list(sets_dict.keys())
set_values = list(sets_dict.values())
set1, set2, set3 = set_values[0][0], set_values[1][0], set_values[2][0]
intersections = get_three_venn_intersections(set1, set2, set3)
set1, set2 = random_disjoint_intersection_two_subsets(
intersections['unique_set1'],
intersections['unique_set2'],
intersections['set1_set2']
)
set1, set3 = random_disjoint_intersection_two_subsets(set1,
intersections['unique_set3'],
intersections['set1_set3']
)
set2, set3 = random_disjoint_intersection_two_subsets(set2,
set3,
intersections['set2_set3']
)
set1_core, set2_core, set3_core = split_random_three_subsets(intersections['core'])
return {set_labels[0]: set1 | set(set1_core),
set_labels[1]: set2 | set(set2_core),
set_labels[2]: set3 | set(set3_core)
}
def get_count_and_labels_from_two_dim_dict(mapping_by_database_and_entity):
"""Get count and raw labels from two dimensional dict."""
db_labels = []
types_labels = []
all_count = []
all_percentage = []
# entity_type_map = {'metabolite_nodes': 'metabolite', 'mirna_nodes': 'micrornas', 'gene_nodes': 'genes', 'bp_nodes': 'bps'}
for type_label, entities in mapping_by_database_and_entity.items():
db_count = []
db_percentage = []
db_labels.append(type_label)
if types_labels == []:
types_labels = list(entities.keys())
for entity_type, entities_tupple in entities.items():
db_count.append(entities_tupple[1])
db_percentage.append(entities_tupple[0])
all_count.append(db_count)
all_percentage.append(db_percentage)
return np.array(all_count), np.array(all_percentage), db_labels, types_labels
def get_mean_from_two_dim_dict(d):
"""Get a dict with the partial means of a two dimensional dict for each subset."""
for k1, v1 in d.items():
for k2, v2 in v1.items():
if v2:
d[k1][k2] = [mean(v2)]
return d
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
37811,
31281,
25673,
3384,
4487,
286,
262,
5301,
526,
15931,
198,
11748,
4866,
198,
11748,
10104,
198,
11748,
340,
861,
10141,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
2298,
293,
198,
11748,
4738,
198,
6738,
17268,
1330,
4277,
11600,
198,
6738,
15095,
1330,
15095,
198,
6738,
7869,
1330,
1612,
198,
6738,
19720,
1330,
7343,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
4299,
422,
62,
27729,
293,
7,
15414,
62,
6978,
2599,
198,
220,
220,
220,
37227,
5569,
3127,
422,
2298,
293,
526,
15931,
198,
220,
220,
220,
351,
1280,
7,
15414,
62,
6978,
11,
705,
26145,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
8593,
624,
1754,
796,
2298,
293,
13,
3118,
27729,
1754,
7,
69,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4469,
62,
6759,
796,
8593,
624,
1754,
13,
2220,
3419,
628,
220,
220,
220,
1441,
4469,
62,
6759,
628,
198,
4299,
284,
62,
27729,
293,
7,
1462,
62,
27729,
293,
11,
5072,
2599,
198,
220,
220,
220,
37227,
16594,
2298,
293,
526,
15931,
198,
220,
220,
220,
351,
1280,
7,
22915,
11,
705,
39346,
11537,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2298,
293,
13,
39455,
7,
1462,
62,
27729,
293,
11,
2393,
8,
628,
198,
4299,
651,
62,
273,
62,
17953,
62,
15908,
7,
6978,
11,
1615,
12453,
28,
17821,
8,
4613,
7343,
58,
2536,
5974,
198,
220,
220,
220,
37227,
1532,
257,
9483,
287,
3108,
2152,
19818,
1351,
286,
3696,
11,
2073,
2251,
9483,
526,
15931,
198,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
17635,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
651,
62,
16624,
62,
4868,
7,
6978,
11,
1615,
12453,
8,
628,
198,
4299,
651,
62,
15908,
62,
4868,
7,
6978,
11,
1615,
12453,
28,
25101,
2599,
198,
220,
220,
220,
37227,
3855,
1351,
286,
29196,
287,
3108,
526,
15931,
198,
220,
220,
220,
611,
1615,
12453,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
418,
13,
6978,
13,
12093,
12453,
7,
418,
13,
6978,
13,
27237,
6978,
7,
69,
4008,
329,
277,
287,
15095,
7,
418,
13,
6978,
13,
22179,
7,
6978,
11,
366,
9,
48774,
611,
28686,
13,
6978,
13,
9409,
343,
7,
69,
15437,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
69,
329,
277,
287,
15095,
7,
418,
13,
6978,
13,
22179,
7,
6978,
11,
366,
9,
48774,
611,
28686,
13,
6978,
13,
9409,
343,
7,
69,
15437,
628,
198,
4299,
651,
62,
16624,
62,
4868,
7,
6978,
11,
1615,
12453,
28,
25101,
2599,
198,
220,
220,
220,
37227,
3855,
1351,
286,
3696,
287,
3108,
526,
15931,
198,
220,
220,
220,
611,
1615,
12453,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
418,
13,
6978,
13,
12093,
12453,
7,
418,
13,
6978,
13,
27237,
6978,
7,
69,
4008,
329,
277,
287,
15095,
7,
418,
13,
6978,
13,
22179,
7,
6978,
11,
366,
9,
48774,
611,
28686,
13,
6978,
13,
4468,
576,
7,
69,
15437,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
69,
329,
277,
287,
15095,
7,
418,
13,
6978,
13,
22179,
7,
6978,
11,
366,
9,
48774,
611,
28686,
13,
6978,
13,
4468,
576,
7,
69,
15437,
628,
198,
4299,
651,
62,
12957,
62,
7753,
7,
6978,
2599,
198,
220,
220,
220,
37227,
3855,
938,
2393,
526,
15931,
198,
220,
220,
220,
1351,
62,
1659,
62,
16624,
796,
15095,
7,
418,
13,
6978,
13,
22179,
7,
6978,
11,
705,
9,
6,
4008,
198,
220,
220,
220,
1441,
3509,
7,
4868,
62,
1659,
62,
16624,
11,
1994,
28,
418,
13,
6978,
13,
1136,
310,
524,
8,
628,
198,
4299,
651,
62,
33885,
62,
6738,
62,
34960,
7,
34960,
11,
9720,
62,
24396,
11,
39279,
28,
25101,
2599,
198,
220,
220,
220,
37227,
3855,
9720,
422,
4823,
1813,
257,
9720,
2446,
526,
15931,
198,
220,
220,
220,
611,
705,
11265,
1143,
6,
287,
10104,
13,
1136,
12853,
853,
16684,
7,
33885,
62,
24396,
737,
22046,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
9720,
62,
24396,
7,
34960,
11,
39279,
28,
11265,
1143,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
9720,
62,
24396,
7,
34960,
8,
628,
198,
4299,
3601,
62,
11600,
62,
27740,
5736,
7,
298,
871,
62,
9945,
11,
3670,
11639,
3256,
3275,
11639,
14957,
1271,
286,
705,
2599,
198,
220,
220,
220,
37227,
18557,
15793,
286,
262,
22155,
526,
15931,
198,
220,
220,
220,
2472,
796,
900,
3419,
198,
220,
220,
220,
285,
796,
277,
6,
90,
7839,
32239,
77,
6,
628,
220,
220,
220,
329,
479,
16,
11,
410,
16,
287,
12066,
62,
9945,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
285,
796,
10148,
198,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
85,
16,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
479,
17,
11,
410,
17,
287,
410,
16,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
15853,
277,
6,
90,
74,
17,
92,
15090,
11925,
7,
85,
17,
38165,
828,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
13,
19119,
7,
85,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
15853,
277,
6,
90,
11925,
7,
85,
16,
38165,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
13,
19119,
7,
85,
16,
8,
628,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
6,
90,
20500,
92,
1391,
74,
16,
38362,
1391,
76,
92,
705,
8,
628,
220,
220,
220,
3601,
7,
69,
6,
14957,
25,
1391,
11925,
7,
23350,
38165,
705,
8,
628,
198,
4299,
3601,
62,
11600,
7,
11600,
62,
1462,
62,
4798,
11,
3275,
28,
7061,
2599,
198,
220,
220,
220,
37227,
18557,
15793,
286,
262,
22155,
526,
15931,
198,
220,
220,
220,
329,
479,
16,
11,
410,
16,
287,
8633,
62,
1462,
62,
4798,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
6,
90,
20500,
92,
1391,
74,
16,
38362,
1391,
11925,
7,
85,
16,
38165,
705,
8,
628,
198,
4299,
651,
62,
23912,
1424,
62,
2617,
62,
6738,
62,
11600,
7,
298,
871,
2599,
198,
220,
220,
220,
37227,
13615,
6167,
900,
422,
9312,
8633,
3815,
526,
15931,
198,
220,
220,
220,
611,
318,
39098,
7,
4868,
7,
298,
871,
13,
27160,
28955,
58,
15,
4357,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
25,
6822,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
900,
7,
270,
861,
10141,
13,
7983,
13,
6738,
62,
2676,
540,
7,
270,
861,
10141,
13,
7983,
13,
6738,
62,
2676,
540,
7,
298,
871,
13,
27160,
3419,
22305,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
900,
7,
270,
861,
10141,
13,
7983,
13,
6738,
62,
2676,
540,
7,
298,
871,
13,
27160,
3419,
4008,
628,
198,
4299,
9575,
62,
4246,
375,
320,
62,
11600,
7,
15414,
62,
67,
25,
8633,
2599,
198,
220,
220,
220,
37227,
49,
964,
83,
1994,
12,
8367,
22155,
526,
15931,
198,
220,
220,
220,
8633,
16,
796,
4866,
13,
22089,
30073,
7,
15414,
62,
67,
8,
628,
220,
220,
220,
288,
796,
4277,
11600,
7,
50033,
25,
4277,
11600,
7,
50033,
25,
1351,
4008,
628,
220,
220,
220,
329,
479,
16,
11,
12066,
16,
287,
8633,
16,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
17,
11,
12066,
17,
287,
12066,
16,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
58,
74,
17,
7131,
74,
16,
60,
796,
12066,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
58,
74,
17,
60,
796,
8633,
7,
67,
58,
74,
17,
12962,
628,
220,
220,
220,
1441,
8633,
7,
67,
8,
628,
198,
4299,
4646,
62,
11600,
62,
46156,
7,
67,
25,
8633,
2599,
198,
220,
220,
220,
37227,
7738,
7234,
22155,
15793,
526,
15931,
198,
220,
220,
220,
5322,
62,
11600,
796,
23884,
628,
220,
220,
220,
8633,
16,
796,
4866,
13,
22089,
30073,
7,
67,
8,
628,
220,
220,
220,
329,
479,
16,
11,
12066,
16,
287,
8633,
16,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
17,
11,
12066,
17,
287,
12066,
16,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
16,
287,
5322,
62,
11600,
13,
13083,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5322,
62,
11600,
58,
74,
16,
4083,
19119,
7,
298,
871,
17,
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,
5322,
62,
11600,
58,
74,
16,
60,
796,
12066,
17,
628,
220,
220,
220,
1441,
5322,
62,
11600,
628,
198,
4299,
4646,
62,
11600,
62,
11545,
62,
19577,
7,
67,
16,
25,
8633,
2599,
198,
220,
220,
220,
37227,
7738,
7234,
22155,
734,
15793,
526,
15931,
198,
220,
220,
220,
288,
17,
796,
4646,
62,
11600,
62,
46156,
7,
67,
16,
8,
628,
220,
220,
220,
1441,
1391,
26858,
25,
9312,
62,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
9312,
62,
4906,
11,
9312,
62,
2617,
287,
288,
17,
13,
23814,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
9312,
11,
9312,
62,
8367,
287,
9312,
62,
2617,
13,
23814,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
198,
4299,
6626,
62,
25120,
62,
11545,
62,
7266,
28709,
7,
1462,
62,
35312,
2599,
198,
220,
220,
220,
37227,
41205,
4738,
734,
6352,
1039,
526,
15931,
198,
220,
220,
220,
611,
318,
39098,
7,
1462,
62,
35312,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
284,
62,
35312,
62,
23912,
1424,
796,
1351,
7,
1462,
62,
35312,
13,
13083,
28955,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
284,
62,
35312,
62,
23912,
1424,
796,
284,
62,
35312,
628,
220,
220,
220,
2063,
62,
16,
796,
4738,
13,
39873,
7,
39748,
28,
4868,
7,
1462,
62,
35312,
62,
23912,
1424,
828,
479,
28,
600,
7,
11925,
7,
1462,
62,
35312,
62,
23912,
1424,
8,
1220,
362,
4008,
198,
220,
220,
220,
2063,
62,
17,
796,
1351,
7,
2617,
7,
1462,
62,
35312,
62,
23912,
1424,
8,
532,
900,
7,
13959,
62,
16,
4008,
628,
220,
220,
220,
611,
318,
39098,
7,
1462,
62,
35312,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1391,
26858,
62,
18242,
25,
284,
62,
35312,
58,
26858,
62,
18242,
60,
329,
9312,
62,
18242,
287,
2063,
62,
16,
5512,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
26858,
62,
18242,
25,
284,
62,
35312,
58,
26858,
62,
18242,
60,
329,
9312,
62,
18242,
287,
2063,
62,
17,
92,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2063,
62,
16,
11,
2063,
62,
17,
628,
198,
4299,
7808,
62,
7942,
62,
1930,
20288,
7,
1462,
62,
35312,
11,
479,
28,
15,
13,
20,
2599,
198,
220,
220,
220,
37227,
38518,
3585,
1271,
286,
14722,
526,
15931,
198,
220,
220,
220,
611,
318,
39098,
7,
1462,
62,
35312,
11,
900,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
284,
62,
35312,
796,
1351,
7,
1462,
62,
35312,
8,
628,
220,
220,
220,
649,
62,
23912,
1424,
796,
284,
62,
35312,
58,
47715,
628,
220,
220,
220,
1303,
6822,
329,
532,
16,
198,
220,
220,
220,
611,
532,
16,
287,
649,
62,
23912,
1424,
25,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
23912,
1424,
796,
685,
15,
611,
6167,
6624,
532,
16,
2073,
6167,
329,
6167,
287,
649,
62,
23912,
1424,
60,
628,
220,
220,
220,
36525,
796,
685,
9630,
329,
6376,
11,
6167,
287,
27056,
378,
7,
3605,
62,
23912,
1424,
8,
611,
6167,
14512,
657,
60,
628,
220,
220,
220,
329,
6376,
287,
4738,
13,
6679,
1063,
7,
521,
1063,
11,
479,
28,
600,
7,
74,
1635,
18896,
7,
521,
1063,
4008,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
23912,
1424,
58,
9630,
60,
796,
657,
628,
220,
220,
220,
1441,
649,
62,
23912,
1424,
628,
198,
4299,
6626,
62,
25120,
62,
15542,
62,
7266,
28709,
7,
1462,
62,
35312,
2599,
198,
220,
220,
220,
37227,
41205,
9823,
453,
4738,
12,
354,
5233,
257,
1813,
900,
287,
1115,
220,
6352,
1039,
526,
15931,
198,
220,
220,
220,
2063,
62,
16,
796,
4738,
13,
39873,
7,
39748,
28,
4868,
7,
1462,
62,
35312,
828,
479,
28,
600,
7,
11925,
7,
1462,
62,
35312,
8,
1220,
513,
4008,
198,
220,
220,
220,
2063,
62,
17,
11,
2063,
62,
18,
796,
6626,
62,
25120,
62,
11545,
62,
7266,
28709,
7,
4868,
7,
2617,
7,
1462,
62,
35312,
8,
532,
900,
7,
13959,
62,
16,
22305,
628,
220,
220,
220,
1441,
2063,
62,
16,
11,
2063,
62,
17,
11,
2063,
62,
18,
628,
198,
4299,
651,
62,
15542,
62,
574,
77,
62,
3849,
23946,
7,
2617,
16,
11,
900,
17,
11,
900,
18,
2599,
198,
220,
220,
220,
37227,
3855,
262,
16246,
290,
595,
73,
4575,
5621,
422,
1115,
1813,
6352,
1039,
526,
15931,
198,
220,
220,
220,
900,
16,
11,
900,
17,
11,
900,
18,
796,
900,
7,
2617,
16,
828,
900,
7,
2617,
17,
828,
900,
7,
2617,
18,
8,
198,
220,
220,
220,
900,
16,
62,
2617,
17,
796,
900,
16,
13,
3849,
5458,
7,
2617,
17,
8,
198,
220,
220,
220,
900,
16,
62,
2617,
18,
796,
900,
16,
13,
3849,
5458,
7,
2617,
18,
8,
198,
220,
220,
220,
4755,
796,
900,
16,
62,
2617,
18,
13,
3849,
5458,
7,
2617,
16,
62,
2617,
17,
8,
628,
220,
220,
220,
900,
16,
62,
2617,
17,
796,
900,
16,
62,
2617,
17,
532,
4755,
198,
220,
220,
220,
900,
16,
62,
2617,
18,
796,
900,
16,
62,
2617,
18,
532,
4755,
198,
220,
220,
220,
900,
17,
62,
2617,
18,
796,
900,
17,
13,
3849,
5458,
7,
2617,
18,
8,
532,
4755,
628,
220,
220,
220,
1441,
1391,
6,
34642,
62,
2617,
16,
10354,
900,
16,
532,
900,
16,
62,
2617,
17,
532,
900,
16,
62,
2617,
18,
532,
4755,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
34642,
62,
2617,
17,
10354,
900,
17,
532,
900,
16,
62,
2617,
17,
532,
900,
17,
62,
2617,
18,
532,
4755,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2617,
16,
62,
2617,
17,
10354,
900,
16,
62,
2617,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
34642,
62,
2617,
18,
10354,
900,
18,
532,
900,
16,
62,
2617,
18,
532,
900,
17,
62,
2617,
18,
532,
4755,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2617,
16,
62,
2617,
18,
10354,
900,
16,
62,
2617,
18,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2617,
17,
62,
2617,
18,
10354,
900,
17,
62,
2617,
18,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
7295,
10354,
4755,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
198,
4299,
4738,
62,
6381,
73,
1563,
62,
3849,
5458,
62,
11545,
62,
7266,
28709,
7,
34642,
62,
2617,
16,
11,
3748,
62,
2617,
17,
11,
16246,
2599,
198,
220,
220,
220,
37227,
41205,
27111,
88,
4738,
12,
354,
5233,
262,
16246,
286,
734,
6352,
1039,
290,
1673,
36686,
378,
340,
284,
262,
595,
73,
1563,
636,
526,
15931,
198,
220,
220,
220,
900,
16,
11,
900,
17,
796,
6626,
62,
25120,
62,
11545,
62,
7266,
28709,
7,
3849,
5458,
8,
628,
220,
220,
220,
1441,
3748,
62,
2617,
16,
930,
900,
7,
2617,
16,
828,
3748,
62,
2617,
17,
930,
900,
7,
2617,
17,
8,
628,
198,
4299,
4738,
62,
6381,
73,
1563,
62,
3849,
5458,
62,
15542,
62,
7266,
28709,
7,
28709,
62,
11600,
2599,
198,
220,
220,
220,
37227,
41205,
9823,
453,
4738,
12,
354,
5233,
262,
42085,
286,
1115,
6352,
1039,
290,
1673,
36686,
378,
340,
284,
262,
595,
73,
1563,
636,
526,
15931,
198,
220,
220,
220,
900,
62,
23912,
1424,
796,
1351,
7,
28709,
62,
11600,
13,
13083,
28955,
198,
220,
220,
220,
900,
62,
27160,
796,
1351,
7,
28709,
62,
11600,
13,
27160,
28955,
628,
220,
220,
220,
900,
16,
11,
900,
17,
11,
900,
18,
796,
900,
62,
27160,
58,
15,
7131,
15,
4357,
900,
62,
27160,
58,
16,
7131,
15,
4357,
900,
62,
27160,
58,
17,
7131,
15,
60,
628,
220,
220,
220,
42085,
796,
651,
62,
15542,
62,
574,
77,
62,
3849,
23946,
7,
2617,
16,
11,
900,
17,
11,
900,
18,
8,
628,
220,
220,
220,
900,
16,
11,
900,
17,
796,
4738,
62,
6381,
73,
1563,
62,
3849,
5458,
62,
11545,
62,
7266,
28709,
7,
198,
220,
220,
220,
220,
220,
220,
220,
42085,
17816,
34642,
62,
2617,
16,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
42085,
17816,
34642,
62,
2617,
17,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
42085,
17816,
2617,
16,
62,
2617,
17,
20520,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
900,
16,
11,
900,
18,
796,
4738,
62,
6381,
73,
1563,
62,
3849,
5458,
62,
11545,
62,
7266,
28709,
7,
2617,
16,
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,
42085,
17816,
34642,
62,
2617,
18,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42085,
17816,
2617,
16,
62,
2617,
18,
20520,
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,
1267,
628,
220,
220,
220,
900,
17,
11,
900,
18,
796,
4738,
62,
6381,
73,
1563,
62,
3849,
5458,
62,
11545,
62,
7266,
28709,
7,
2617,
17,
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,
900,
18,
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,
42085,
17816,
2617,
17,
62,
2617,
18,
20520,
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,
1267,
628,
220,
220,
220,
900,
16,
62,
7295,
11,
900,
17,
62,
7295,
11,
900,
18,
62,
7295,
796,
6626,
62,
25120,
62,
15542,
62,
7266,
28709,
7,
3849,
23946,
17816,
7295,
6,
12962,
628,
220,
220,
220,
1441,
1391,
2617,
62,
23912,
1424,
58,
15,
5974,
900,
16,
930,
900,
7,
2617,
16,
62,
7295,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
900,
62,
23912,
1424,
58,
16,
5974,
900,
17,
930,
900,
7,
2617,
17,
62,
7295,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
900,
62,
23912,
1424,
58,
17,
5974,
900,
18,
930,
900,
7,
2617,
18,
62,
7295,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
198,
4299,
651,
62,
9127,
62,
392,
62,
23912,
1424,
62,
6738,
62,
11545,
62,
27740,
62,
11600,
7,
76,
5912,
62,
1525,
62,
48806,
62,
392,
62,
26858,
2599,
198,
220,
220,
220,
37227,
3855,
954,
290,
8246,
14722,
422,
734,
38517,
8633,
526,
15931,
198,
220,
220,
220,
20613,
62,
23912,
1424,
796,
17635,
198,
220,
220,
220,
3858,
62,
23912,
1424,
796,
17635,
628,
220,
220,
220,
477,
62,
9127,
796,
17635,
198,
220,
220,
220,
477,
62,
25067,
496,
796,
17635,
628,
220,
220,
220,
1303,
9312,
62,
4906,
62,
8899,
796,
1391,
6,
4164,
28426,
578,
62,
77,
4147,
10354,
705,
4164,
28426,
578,
3256,
705,
10793,
2616,
62,
77,
4147,
10354,
705,
9383,
81,
1211,
292,
3256,
705,
70,
1734,
62,
77,
4147,
10354,
705,
5235,
274,
3256,
705,
46583,
62,
77,
4147,
10354,
705,
18799,
6,
92,
628,
220,
220,
220,
329,
2099,
62,
18242,
11,
12066,
287,
16855,
62,
1525,
62,
48806,
62,
392,
62,
26858,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
20613,
62,
9127,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
20613,
62,
25067,
496,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
20613,
62,
23912,
1424,
13,
33295,
7,
4906,
62,
18242,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
3858,
62,
23912,
1424,
6624,
685,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3858,
62,
23912,
1424,
796,
1351,
7,
298,
871,
13,
13083,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
329,
9312,
62,
4906,
11,
12066,
62,
83,
7211,
293,
287,
12066,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20613,
62,
9127,
13,
33295,
7,
298,
871,
62,
83,
7211,
293,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20613,
62,
25067,
496,
13,
33295,
7,
298,
871,
62,
83,
7211,
293,
58,
15,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
477,
62,
9127,
13,
33295,
7,
9945,
62,
9127,
8,
198,
220,
220,
220,
220,
220,
220,
220,
477,
62,
25067,
496,
13,
33295,
7,
9945,
62,
25067,
496,
8,
628,
220,
220,
220,
1441,
45941,
13,
18747,
7,
439,
62,
9127,
828,
45941,
13,
18747,
7,
439,
62,
25067,
496,
828,
20613,
62,
23912,
1424,
11,
3858,
62,
23912,
1424,
628,
198,
4299,
651,
62,
32604,
62,
6738,
62,
11545,
62,
27740,
62,
11600,
7,
67,
2599,
198,
220,
220,
220,
37227,
3855,
257,
8633,
351,
262,
13027,
1724,
286,
257,
734,
38517,
8633,
329,
1123,
24637,
526,
15931,
198,
220,
220,
220,
329,
479,
16,
11,
410,
16,
287,
288,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
17,
11,
410,
17,
287,
410,
16,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
410,
17,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
58,
74,
16,
7131,
74,
17,
60,
796,
685,
32604,
7,
85,
17,
15437,
628,
220,
220,
220,
1441,
288,
198
] | 2.223219 | 4,126 |
import pandas as pd
import collections
import numpy as np
def count_top_words_in_genre(genre, lyrics_df):
"""
Detect the language of the text.
Parameters
----------
genre : str
genre like 'Hip-Hop' or 'Pop'
lyrics_df : pandas dataframe
clean dataframe
Returns
return list of top words of genre
"""
lyrics_df['most_used_words'] = pd.Series(collections.Counter(lyrics.split())
.most_common(10) for _, lyrics in lyrics_df['lyrics'].iteritems())
arr = np.array(lyrics_df[lyrics_df['genre'] == genre]['most_used_words'].tolist()) # merges row's most_used_word column to list
arr = arr[~pd.isna(arr)] # removing nans'
flat_list = [item for sublist in arr for item in sublist] # converts array of arrays to one big array
genre_dict = {}
for tupl in flat_list:
genre_dict[tupl[0]] = genre_dict.get(tupl[0], 0) + tupl[1] # sums up total occurances of each word
top_words = collections.Counter(genre_dict)
return top_words.most_common(10)
def word_count(df, new_col_name, col_with_lyrics):
"""
Count the number of words in a dataframe lyrics column, given a column name, process it, and save as new_col_name
Parameters
----------
df : dataframe
new_col_name : name of new column
col_with_lyric: column with lyrics
Returns
return dataframe with new column
"""
df[new_col_name] = df[col_with_lyrics].apply(lambda words: _count_words(words))
return df
def _count_words(words):
"""
helper method for word_count() method, return length of given words
"""
try:
return len(words.split())
except:
return 0 #TODO: better error handling, maybe not return 0
def sentence_avg_word_length(df, new_col_name, col_with_lyrics):
"""
Count the average word length in a dataframe lyrics column, given a column name, process it, and save as new_col_name
Parameters
----------
df : dataframe
new_col_name : name of new column
col_with_lyric: column with lyrics
Returns
return dataframe with new column
"""
df[new_col_name] = df[col_with_lyrics].apply(_sentence_avg_word_length)
return df
def _sentence_avg_word_length(sentence):
"""
helper method for sentence_avg_word_length() method, sum of len of words in sentence, divided by length of sentence ***3 (factorize)
"""
res = sum(len(word.split()) for word in sentence) / len(sentence.split())**3
return res | [
11748,
19798,
292,
355,
279,
67,
198,
11748,
17268,
198,
11748,
299,
32152,
355,
45941,
198,
198,
4299,
954,
62,
4852,
62,
10879,
62,
259,
62,
35850,
7,
35850,
11,
15844,
62,
7568,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
35874,
262,
3303,
286,
262,
2420,
13,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
12121,
1058,
965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12121,
588,
705,
39,
541,
12,
23483,
6,
393,
705,
16979,
6,
198,
220,
220,
220,
220,
220,
220,
220,
15844,
62,
7568,
1058,
19798,
292,
1366,
14535,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3424,
1366,
14535,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
1351,
286,
1353,
2456,
286,
12121,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
15844,
62,
7568,
17816,
1712,
62,
1484,
62,
10879,
20520,
796,
279,
67,
13,
27996,
7,
4033,
26448,
13,
31694,
7,
306,
10466,
13,
35312,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
764,
1712,
62,
11321,
7,
940,
8,
329,
4808,
11,
15844,
287,
15844,
62,
7568,
17816,
306,
10466,
6,
4083,
2676,
23814,
28955,
198,
220,
220,
220,
5240,
796,
45941,
13,
18747,
7,
306,
10466,
62,
7568,
58,
306,
10466,
62,
7568,
17816,
35850,
20520,
6624,
12121,
7131,
6,
1712,
62,
1484,
62,
10879,
6,
4083,
83,
349,
396,
28955,
1303,
4017,
3212,
5752,
338,
749,
62,
1484,
62,
4775,
5721,
284,
1351,
198,
220,
220,
220,
5240,
796,
5240,
58,
93,
30094,
13,
271,
2616,
7,
3258,
15437,
1303,
10829,
299,
504,
6,
198,
220,
220,
220,
6228,
62,
4868,
796,
685,
9186,
329,
850,
4868,
287,
5240,
329,
2378,
287,
850,
4868,
60,
1303,
26161,
7177,
286,
26515,
284,
530,
1263,
7177,
198,
220,
220,
220,
12121,
62,
11600,
796,
23884,
198,
220,
220,
220,
329,
12777,
489,
287,
6228,
62,
4868,
25,
220,
198,
220,
220,
220,
220,
220,
220,
220,
12121,
62,
11600,
58,
28047,
489,
58,
15,
11907,
796,
12121,
62,
11600,
13,
1136,
7,
28047,
489,
58,
15,
4357,
657,
8,
1343,
12777,
489,
58,
16,
60,
1303,
21784,
510,
2472,
3051,
1817,
286,
1123,
1573,
198,
220,
220,
220,
1353,
62,
10879,
796,
17268,
13,
31694,
7,
35850,
62,
11600,
8,
198,
220,
220,
220,
1441,
1353,
62,
10879,
13,
1712,
62,
11321,
7,
940,
8,
198,
198,
4299,
1573,
62,
9127,
7,
7568,
11,
649,
62,
4033,
62,
3672,
11,
951,
62,
4480,
62,
306,
10466,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2764,
262,
1271,
286,
2456,
287,
257,
1366,
14535,
15844,
5721,
11,
1813,
257,
5721,
1438,
11,
1429,
340,
11,
290,
3613,
355,
649,
62,
4033,
62,
3672,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
1058,
1366,
14535,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
4033,
62,
3672,
1058,
1438,
286,
649,
5721,
198,
220,
220,
220,
220,
220,
220,
220,
951,
62,
4480,
62,
306,
1173,
25,
5721,
351,
15844,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
1366,
14535,
351,
649,
5721,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
47764,
58,
3605,
62,
4033,
62,
3672,
60,
796,
47764,
58,
4033,
62,
4480,
62,
306,
10466,
4083,
39014,
7,
50033,
2456,
25,
4808,
9127,
62,
10879,
7,
10879,
4008,
198,
220,
220,
220,
1441,
47764,
198,
198,
4299,
4808,
9127,
62,
10879,
7,
10879,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
31904,
2446,
329,
1573,
62,
9127,
3419,
2446,
11,
1441,
4129,
286,
1813,
2456,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
18896,
7,
10879,
13,
35312,
28955,
198,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
1303,
51,
3727,
46,
25,
1365,
4049,
9041,
11,
3863,
407,
1441,
657,
198,
198,
4299,
6827,
62,
615,
70,
62,
4775,
62,
13664,
7,
7568,
11,
649,
62,
4033,
62,
3672,
11,
951,
62,
4480,
62,
306,
10466,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2764,
262,
2811,
1573,
4129,
287,
257,
1366,
14535,
15844,
5721,
11,
1813,
257,
5721,
1438,
11,
1429,
340,
11,
290,
3613,
355,
649,
62,
4033,
62,
3672,
198,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
1058,
1366,
14535,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
4033,
62,
3672,
1058,
1438,
286,
649,
5721,
198,
220,
220,
220,
220,
220,
220,
220,
951,
62,
4480,
62,
306,
1173,
25,
5721,
351,
15844,
198,
220,
220,
220,
220,
220,
220,
220,
16409,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
1366,
14535,
351,
649,
5721,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
47764,
58,
3605,
62,
4033,
62,
3672,
60,
796,
47764,
58,
4033,
62,
4480,
62,
306,
10466,
4083,
39014,
28264,
34086,
594,
62,
615,
70,
62,
4775,
62,
13664,
8,
198,
220,
220,
220,
1441,
47764,
198,
198,
4299,
4808,
34086,
594,
62,
615,
70,
62,
4775,
62,
13664,
7,
34086,
594,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
31904,
2446,
329,
6827,
62,
615,
70,
62,
4775,
62,
13664,
3419,
2446,
11,
2160,
286,
18896,
286,
2456,
287,
6827,
11,
9086,
416,
4129,
286,
6827,
17202,
18,
357,
31412,
1096,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
581,
796,
2160,
7,
11925,
7,
4775,
13,
35312,
28955,
329,
1573,
287,
6827,
8,
1220,
18896,
7,
34086,
594,
13,
35312,
28955,
1174,
18,
198,
220,
220,
220,
1441,
581
] | 2.516941 | 1,033 |
import logging
import torch
import numpy as np
import common.utils.torchhelper as th
import common.trainloop.context as ctx
import common.trainloop.hooks as hooks
import common.trainloop.data as data
| [
11748,
18931,
198,
198,
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
2219,
13,
26791,
13,
13165,
354,
2978,
525,
355,
294,
198,
11748,
2219,
13,
27432,
26268,
13,
22866,
355,
269,
17602,
198,
11748,
2219,
13,
27432,
26268,
13,
25480,
82,
355,
26569,
198,
11748,
2219,
13,
27432,
26268,
13,
7890,
355,
1366,
628,
628,
628,
198
] | 3.409836 | 61 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import importlib
from ._format import (CasavaOneEightSingleLanePerSampleDirFmt,
CasavaOneEightLanelessPerSampleDirFmt,
FastqGzFormat, YamlFormat,
FastqManifestFormat, FastqAbsolutePathManifestFormat,
SingleLanePerSampleSingleEndFastqDirFmt,
SingleLanePerSamplePairedEndFastqDirFmt,
SingleEndFastqManifestPhred33,
SingleEndFastqManifestPhred64,
PairedEndFastqManifestPhred33,
PairedEndFastqManifestPhred64,
SingleEndFastqManifestPhred33V2,
SingleEndFastqManifestPhred64V2,
PairedEndFastqManifestPhred33V2,
PairedEndFastqManifestPhred64V2,
QIIME1DemuxFormat, QIIME1DemuxDirFmt)
from ._type import (Sequences, SequencesWithQuality,
PairedEndSequencesWithQuality,
JoinedSequencesWithQuality)
__all__ = ['CasavaOneEightSingleLanePerSampleDirFmt',
'CasavaOneEightLanelessPerSampleDirFmt',
'FastqGzFormat', 'YamlFormat', 'FastqManifestFormat',
'FastqAbsolutePathManifestFormat',
'SingleLanePerSampleSingleEndFastqDirFmt',
'SingleLanePerSamplePairedEndFastqDirFmt', 'Sequences',
'SequencesWithQuality', 'PairedEndSequencesWithQuality',
'JoinedSequencesWithQuality', 'SingleEndFastqManifestPhred33',
'SingleEndFastqManifestPhred64', 'PairedEndFastqManifestPhred33',
'PairedEndFastqManifestPhred64', 'SingleEndFastqManifestPhred33V2',
'SingleEndFastqManifestPhred64V2',
'PairedEndFastqManifestPhred33V2',
'PairedEndFastqManifestPhred64V2', 'QIIME1DemuxFormat',
'QIIME1DemuxDirFmt']
importlib.import_module('q2_types.per_sample_sequences._transformer')
| [
2,
16529,
10541,
198,
2,
15069,
357,
66,
8,
1584,
12,
1238,
2481,
11,
1195,
40,
12789,
362,
2478,
1074,
13,
198,
2,
198,
2,
4307,
6169,
739,
262,
2846,
286,
262,
40499,
347,
10305,
13789,
13,
198,
2,
198,
2,
383,
1336,
5964,
318,
287,
262,
2393,
38559,
24290,
11,
9387,
351,
428,
3788,
13,
198,
2,
16529,
10541,
198,
198,
11748,
1330,
8019,
198,
198,
6738,
47540,
18982,
1330,
357,
35155,
4170,
3198,
29571,
28008,
43,
1531,
5990,
36674,
35277,
37,
16762,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11294,
4170,
3198,
29571,
43,
272,
5321,
5990,
36674,
35277,
37,
16762,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12549,
80,
38,
89,
26227,
11,
14063,
75,
26227,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12549,
80,
5124,
8409,
26227,
11,
12549,
80,
24849,
3552,
15235,
5124,
8409,
26227,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14206,
43,
1531,
5990,
36674,
28008,
12915,
22968,
80,
35277,
37,
16762,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14206,
43,
1531,
5990,
36674,
47,
9820,
12915,
22968,
80,
35277,
37,
16762,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14206,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14206,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
350,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
350,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14206,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
53,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14206,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
53,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
350,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
53,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
350,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
53,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1195,
40,
12789,
16,
11522,
2821,
26227,
11,
1195,
40,
12789,
16,
11522,
2821,
35277,
37,
16762,
8,
198,
6738,
47540,
4906,
1330,
357,
44015,
3007,
11,
24604,
3007,
3152,
35013,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
350,
9820,
12915,
44015,
3007,
3152,
35013,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16709,
44015,
3007,
3152,
35013,
8,
198,
198,
834,
439,
834,
796,
37250,
35155,
4170,
3198,
29571,
28008,
43,
1531,
5990,
36674,
35277,
37,
16762,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
35155,
4170,
3198,
29571,
43,
272,
5321,
5990,
36674,
35277,
37,
16762,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22968,
80,
38,
89,
26227,
3256,
705,
56,
43695,
26227,
3256,
705,
22968,
80,
5124,
8409,
26227,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22968,
80,
24849,
3552,
15235,
5124,
8409,
26227,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
28008,
43,
1531,
5990,
36674,
28008,
12915,
22968,
80,
35277,
37,
16762,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
28008,
43,
1531,
5990,
36674,
47,
9820,
12915,
22968,
80,
35277,
37,
16762,
3256,
705,
44015,
3007,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
44015,
3007,
3152,
35013,
3256,
705,
47,
9820,
12915,
44015,
3007,
3152,
35013,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
24363,
44015,
3007,
3152,
35013,
3256,
705,
28008,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
28008,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
3256,
705,
47,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
47,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
3256,
705,
28008,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
53,
17,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
28008,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
53,
17,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
47,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2091,
53,
17,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
47,
9820,
12915,
22968,
80,
5124,
8409,
2725,
445,
2414,
53,
17,
3256,
705,
48,
40,
12789,
16,
11522,
2821,
26227,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
48,
40,
12789,
16,
11522,
2821,
35277,
37,
16762,
20520,
198,
198,
11748,
8019,
13,
11748,
62,
21412,
10786,
80,
17,
62,
19199,
13,
525,
62,
39873,
62,
3107,
3007,
13557,
7645,
16354,
11537,
198
] | 2.193858 | 1,042 |
from datetime import datetime
import time
import sys
sys.path.insert(1, sys.path[0] + '/lib')
from pexpect import pxssh, TIMEOUT
CRNL = '\r\n'
DEBUG_VERBOSE_PRINTING = False
# experimentally derived that a sequence of tries with delays of
# 1, 5, 25, 125 secs worked to surmount a 1-second delay (via `tc` test)
RETRY_EXPONENT = 5
| [
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
640,
198,
11748,
25064,
198,
198,
17597,
13,
6978,
13,
28463,
7,
16,
11,
25064,
13,
6978,
58,
15,
60,
1343,
31051,
8019,
11537,
198,
6738,
613,
87,
806,
1330,
279,
87,
45824,
11,
20460,
12425,
198,
198,
9419,
32572,
796,
705,
59,
81,
59,
77,
6,
198,
30531,
62,
5959,
33,
14058,
62,
4805,
12394,
2751,
796,
10352,
198,
2,
6306,
453,
10944,
326,
257,
8379,
286,
8404,
351,
16119,
286,
198,
2,
220,
352,
11,
642,
11,
1679,
11,
13151,
792,
82,
3111,
284,
969,
14948,
257,
352,
12,
12227,
5711,
357,
8869,
4600,
23047,
63,
1332,
8,
198,
2200,
40405,
62,
49864,
1340,
3525,
796,
642,
628,
198
] | 2.823529 | 119 |
import os
import signal
import subprocess
from behave import given, when, then
from test.behave_utils import utils
from gppylib.commands.base import Command
@when('the standby host goes down')
def _handle_sigpipe():
"""
Work around https://bugs.python.org/issue1615376, which is not fixed until
Python 3.2. This bug interferes with Bash pipelines that rely on SIGPIPE to
exit cleanly.
"""
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
@when('gpstart is run with prompts accepted')
def impl(context):
"""
Runs `yes | gpstart`.
"""
p = subprocess.Popen(
[ "bash", "-c", "yes | gpstart" ],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
preexec_fn=_handle_sigpipe,
)
context.stdout_message, context.stderr_message = p.communicate()
context.ret_code = p.returncode
@given('segment {dbid} goes down' )
@then('the status of segment {dbid} should be "{expected_status}"' )
@then('the status of segment {dbid} is changed to "{status}"' )
@then('the cluster is returned to a good state' )
| [
11748,
28686,
198,
11748,
6737,
198,
11748,
850,
14681,
198,
198,
6738,
17438,
1330,
1813,
11,
618,
11,
788,
198,
6738,
1332,
13,
1350,
14150,
62,
26791,
1330,
3384,
4487,
198,
6738,
308,
381,
2645,
571,
13,
9503,
1746,
13,
8692,
1330,
9455,
198,
198,
31,
12518,
10786,
1169,
42020,
2583,
2925,
866,
11537,
198,
198,
4299,
4808,
28144,
62,
82,
328,
34360,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5521,
1088,
3740,
1378,
32965,
13,
29412,
13,
2398,
14,
21949,
1433,
1314,
32128,
11,
543,
318,
407,
5969,
1566,
198,
220,
220,
220,
11361,
513,
13,
17,
13,
770,
5434,
987,
5036,
411,
351,
15743,
31108,
326,
8814,
319,
33993,
47,
4061,
36,
284,
198,
220,
220,
220,
8420,
3424,
306,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
6737,
13,
12683,
282,
7,
12683,
282,
13,
50,
3528,
47,
4061,
36,
11,
6737,
13,
50,
3528,
62,
35,
3697,
8,
198,
198,
31,
12518,
10786,
31197,
9688,
318,
1057,
351,
36454,
6292,
11537,
198,
4299,
4114,
7,
22866,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
44743,
4600,
8505,
930,
27809,
9688,
44646,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
279,
796,
850,
14681,
13,
47,
9654,
7,
198,
220,
220,
220,
220,
220,
220,
220,
685,
366,
41757,
1600,
27444,
66,
1600,
366,
8505,
930,
27809,
9688,
1,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
14367,
448,
28,
7266,
14681,
13,
47,
4061,
36,
11,
198,
220,
220,
220,
220,
220,
220,
220,
336,
1082,
81,
28,
7266,
14681,
13,
47,
4061,
36,
11,
198,
220,
220,
220,
220,
220,
220,
220,
47488,
87,
721,
62,
22184,
28,
62,
28144,
62,
82,
328,
34360,
11,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
4732,
13,
19282,
448,
62,
20500,
11,
4732,
13,
301,
1082,
81,
62,
20500,
796,
279,
13,
10709,
5344,
3419,
198,
220,
220,
220,
4732,
13,
1186,
62,
8189,
796,
279,
13,
7783,
8189,
198,
198,
31,
35569,
10786,
325,
5154,
1391,
9945,
312,
92,
2925,
866,
6,
1267,
198,
198,
31,
8524,
10786,
1169,
3722,
286,
10618,
1391,
9945,
312,
92,
815,
307,
45144,
40319,
62,
13376,
92,
30543,
1267,
198,
198,
31,
8524,
10786,
1169,
3722,
286,
10618,
1391,
9945,
312,
92,
318,
3421,
284,
45144,
13376,
92,
30543,
1267,
198,
198,
31,
8524,
10786,
1169,
13946,
318,
4504,
284,
257,
922,
1181,
6,
1267,
198
] | 2.647783 | 406 |
from groupon import Version
__author__ = "Allan Bunch"
__copyright__ = "Copyright (C) 2010 Webframeworks LLC"
__license__ = """Copyright 2010 Webframeworks LLC 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."""
__version__ = Version
__maintainer__ = "Allan Bunch"
__status__ = "Beta"
__credits__ = []
| [
6738,
1448,
261,
1330,
10628,
198,
198,
834,
9800,
834,
796,
366,
3237,
272,
347,
3316,
1,
198,
834,
22163,
4766,
834,
796,
366,
15269,
357,
34,
8,
3050,
5313,
19298,
19653,
11419,
1,
198,
834,
43085,
834,
796,
37227,
15269,
3050,
5313,
19298,
19653,
11419,
49962,
739,
262,
24843,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
407,
779,
428,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
921,
743,
7330,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
4866,
286,
262,
13789,
379,
198,
220,
220,
220,
220,
220,
220,
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,
17486,
2672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29809,
1797,
11,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4911,
393,
17142,
13,
4091,
262,
13789,
329,
262,
2176,
3303,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15030,
21627,
290,
11247,
739,
262,
13789,
526,
15931,
198,
834,
9641,
834,
796,
10628,
198,
834,
76,
2913,
10613,
834,
796,
366,
3237,
272,
347,
3316,
1,
198,
834,
13376,
834,
796,
366,
43303,
1,
198,
834,
66,
20696,
834,
796,
17635,
628,
198
] | 2.648571 | 350 |
import json
from time import sleep
import requests
from cloudaio import tlsexpert
import uuid
import random
s = requests.session()
stylecode = 'DB5074-101'
stop = False
storage = {}
sizes = ['9']
cookie = '_abck=42D4E2E416589130C76B07375A19C056~-1~YAAQwArGF1ovWzJ1AQAAFVlARAS+j6F2rlSe4zrahotRz7GSQSWK5sEIKBw84/F206ZvoZUygpHQDG2YE7a/6qDtXywJFj1qo80QXunTlvRzSb9Ir3ImsuxW2d1aiy+bJXLo/yXYCOuetAXkjg2A5oCOke/NNXdy237kNClxK+sKyTBOKevR+D+E1/NGMYiEpaAzD16lT+2zRGyEuEbaP+zB3uPBJFhWZmoCmaqlwzO4DURy2G6ezrTVix6pnEtqBc8ZnwXDj9EbIet9NllmEsaBbg4J0KVTDZNrj8KC06X9kQY76KG7ySYQo76J/0q87+rdbNLPerfEMa6EEmEA1BALEvPu/QekZodLy4wSyk78/OshgKGI04hEw/A507k+jyvj2bMaRxMDZL6CBfvbNI0pLPWNBKdI38rytTrR7CmgFjb36bypW+EX9+K5CA99EYXszg==~-1~-1~-1;bm_sz=2B6D19B104CB409988B860E3EFE6EFEF~YAAQwArGFw8uWzJ1AQAAbkBARAmC3kWjspX7DFScuMysLDd9PdAF5cLWQ/pCFM4kl5WauGx51hwgvP51RoEjABxOcClhVbzjJkiRUM9nStEYbG44nHc0RZp+5JscnidJMcNh5Mtx/WKLVAI+ZFCcbqTdL/mb1bdGExlbiO11DWzzk6JVgeJMoDf4u4887uoocgyJjo+kwWkmHXUZpj4k5XfCr2IaEbQ+hLlCMOU+qWprIs8ZKdQiWEb8cKSjsfltIL2MUPanCcQIdnN8m/8F0FuevUIBGqN/FKg=;'
region = 'SG'
visitor = str(uuid.uuid4())
url = 'https://api.nike.com/buy/partner_cart_preorder/v1/' + str(uuid.uuid4())
proxy1 = '108.165.18.67:14025'
proxy = {"http": "http://" + proxy1, "https": "https://" + proxy1}
s.proxies.update(proxy)
maxlimit = None
print(json.dumps(
{
"status": "0",
"message": "Starting..."
}
))
# Fetch Product details
found = details()
while not found:
found = details()
# Your monitor code
status,size = monitor()
while not status:
status, size = monitor()
# Later on you branch to ATC
success = atc(size)
if success:
check_order()
#Now tell the UI to show the success to the user
| [
11748,
33918,
198,
6738,
640,
1330,
3993,
198,
11748,
7007,
198,
6738,
6279,
64,
952,
1330,
256,
75,
8044,
11766,
198,
11748,
334,
27112,
198,
11748,
4738,
198,
82,
796,
7007,
13,
29891,
3419,
198,
7635,
8189,
796,
705,
11012,
1120,
4524,
12,
8784,
6,
198,
11338,
796,
10352,
198,
35350,
796,
23884,
198,
82,
4340,
796,
37250,
24,
20520,
198,
44453,
796,
705,
62,
397,
694,
28,
3682,
35,
19,
36,
17,
36,
35218,
3365,
6420,
1270,
34,
4304,
33,
2998,
22318,
32,
1129,
34,
2713,
21,
93,
12,
16,
93,
56,
3838,
48,
86,
3163,
21713,
16,
709,
54,
89,
41,
16,
32,
48,
38540,
53,
75,
1503,
1921,
10,
73,
21,
37,
17,
45895,
4653,
19,
89,
430,
8940,
49,
89,
22,
14313,
48,
17887,
42,
20,
82,
36,
18694,
33,
86,
5705,
14,
37,
22136,
57,
13038,
57,
52,
88,
31197,
41275,
35,
38,
17,
48743,
22,
64,
14,
21,
80,
35,
83,
55,
88,
86,
41,
37,
73,
16,
80,
78,
1795,
48,
55,
403,
51,
6780,
49,
89,
50,
65,
24,
23820,
18,
40,
907,
2821,
54,
17,
67,
16,
1872,
88,
10,
65,
41,
55,
27654,
14,
88,
34278,
8220,
84,
316,
25922,
42421,
70,
17,
32,
20,
78,
8220,
365,
14,
6144,
55,
9892,
24693,
74,
45,
2601,
87,
42,
10,
82,
30630,
51,
8202,
42,
1990,
49,
10,
35,
10,
36,
16,
14,
10503,
26708,
72,
36,
8957,
26903,
35,
1433,
75,
51,
10,
17,
89,
49,
44802,
36,
84,
36,
7012,
47,
10,
89,
33,
18,
84,
49079,
41,
37,
71,
54,
57,
5908,
34,
2611,
13976,
86,
89,
46,
19,
35,
4261,
88,
17,
38,
21,
8471,
81,
6849,
844,
21,
21999,
36,
83,
80,
33,
66,
23,
57,
47516,
55,
35,
73,
24,
36,
65,
40,
316,
24,
45,
297,
76,
36,
11400,
33,
35904,
19,
41,
15,
42,
53,
21016,
57,
45,
81,
73,
23,
36222,
3312,
55,
24,
74,
48,
56,
4304,
42,
38,
22,
88,
23060,
48,
78,
4304,
41,
14,
15,
80,
5774,
10,
4372,
65,
32572,
5990,
69,
3620,
64,
21,
6500,
76,
16412,
16,
33,
1847,
15200,
47,
84,
14,
48,
988,
57,
375,
31633,
19,
86,
13940,
74,
3695,
14,
46,
1477,
70,
42,
18878,
3023,
71,
36,
86,
14,
32,
35378,
74,
10,
73,
88,
85,
73,
17,
65,
21467,
49,
87,
12740,
57,
43,
21,
23199,
69,
85,
65,
22125,
15,
79,
19930,
29767,
33,
42,
67,
40,
2548,
563,
83,
2898,
49,
22,
34,
11296,
37,
73,
65,
2623,
1525,
79,
54,
10,
6369,
24,
10,
42,
20,
8141,
2079,
22348,
55,
82,
89,
70,
855,
93,
12,
16,
93,
12,
16,
93,
12,
16,
26,
20475,
62,
82,
89,
28,
17,
33,
21,
35,
1129,
33,
13464,
23199,
1821,
2079,
3459,
33,
45039,
36,
18,
36,
15112,
21,
36,
15112,
37,
93,
56,
3838,
48,
86,
3163,
21713,
86,
23,
84,
54,
89,
41,
16,
32,
48,
3838,
65,
38841,
1503,
5840,
34,
18,
74,
54,
73,
2777,
55,
22,
8068,
3351,
84,
44,
893,
11163,
67,
24,
47,
67,
8579,
20,
66,
43,
54,
48,
14,
79,
22495,
44,
19,
41582,
20,
54,
559,
38,
87,
4349,
36599,
70,
47322,
4349,
15450,
36,
73,
6242,
87,
46,
66,
2601,
71,
53,
65,
89,
73,
41,
4106,
49,
5883,
24,
77,
1273,
22348,
65,
38,
2598,
77,
39,
66,
15,
49,
57,
79,
10,
20,
41,
1416,
77,
312,
41,
9742,
45,
71,
20,
44,
17602,
14,
54,
42,
43,
11731,
40,
10,
57,
4851,
21101,
80,
51,
45582,
14,
2022,
16,
17457,
38,
3109,
75,
8482,
46,
1157,
42955,
3019,
74,
21,
41697,
469,
41,
16632,
35,
69,
19,
84,
2780,
5774,
20895,
420,
1360,
41,
7639,
10,
46265,
54,
13276,
39,
55,
52,
57,
79,
73,
19,
74,
20,
55,
69,
13916,
17,
40,
64,
36,
65,
48,
10,
71,
43,
75,
24187,
2606,
10,
80,
54,
1050,
3792,
23,
57,
42,
67,
48,
72,
8845,
65,
23,
66,
27015,
8457,
69,
2528,
4146,
17,
44,
8577,
272,
34,
66,
48,
7390,
77,
45,
23,
76,
14,
23,
37,
15,
37,
518,
85,
52,
9865,
38,
80,
45,
14,
26236,
70,
28,
26,
6,
198,
36996,
796,
705,
38475,
6,
198,
4703,
2072,
796,
965,
7,
12303,
312,
13,
12303,
312,
19,
28955,
198,
6371,
796,
705,
5450,
1378,
15042,
13,
77,
522,
13,
785,
14,
17846,
14,
3911,
1008,
62,
26674,
62,
3866,
2875,
14,
85,
16,
14,
6,
1343,
965,
7,
12303,
312,
13,
12303,
312,
19,
28955,
198,
36436,
16,
796,
705,
15711,
13,
20986,
13,
1507,
13,
3134,
25,
15187,
1495,
6,
198,
36436,
796,
19779,
4023,
1298,
366,
4023,
1378,
1,
1343,
15741,
16,
11,
366,
5450,
1298,
366,
5450,
1378,
1,
1343,
15741,
16,
92,
198,
82,
13,
1676,
87,
444,
13,
19119,
7,
36436,
8,
198,
9806,
32374,
796,
6045,
628,
198,
4798,
7,
17752,
13,
67,
8142,
7,
198,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
13376,
1298,
366,
15,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
20500,
1298,
366,
22851,
9313,
198,
220,
220,
220,
1782,
198,
4008,
198,
2,
376,
7569,
8721,
3307,
198,
9275,
796,
3307,
3419,
198,
4514,
407,
1043,
25,
198,
220,
220,
220,
1043,
796,
3307,
3419,
628,
198,
2,
3406,
5671,
2438,
198,
13376,
11,
7857,
796,
5671,
3419,
198,
4514,
407,
3722,
25,
198,
220,
220,
220,
3722,
11,
2546,
796,
5671,
3419,
198,
198,
2,
11450,
319,
345,
8478,
220,
284,
317,
4825,
198,
198,
13138,
796,
379,
66,
7,
7857,
8,
198,
198,
361,
1943,
25,
198,
220,
220,
220,
2198,
62,
2875,
3419,
198,
2,
3844,
1560,
262,
12454,
284,
905,
262,
1943,
284,
262,
2836,
628,
628
] | 1.776275 | 961 |
import streamlit as st
import pandas as pd
import numpy as np
import datetime
import plotly.express as px
import base64 | [
11748,
4269,
18250,
355,
336,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
4818,
8079,
198,
11748,
7110,
306,
13,
42712,
355,
279,
87,
198,
11748,
2779,
2414
] | 3.4 | 35 |
import argparse
import logging
import os
from multiprocessing import Pool
from distutils.util import strtobool
import tensorflow as tf
import numpy as np
import json
from pathlib import Path
from generic.data_provider.iterator import Iterator
from generic.tf_utils.evaluator import Evaluator
from generic.tf_utils.optimizer import create_optimizer
from generic.tf_utils.ckpt_loader import load_checkpoint, create_resnet_saver
from generic.utils.config import load_config
from generic.utils.file_handlers import pickle_dump
from generic.data_provider.image_loader import get_img_builder
from generic.data_provider.nlp_utils import Embeddings
from generic.data_provider.nlp_utils import GloveEmbeddings
from src.guesswhat.data_provider.guesswhat_dataset import OracleDataset
from src.guesswhat.data_provider.oracle_batchifier import OracleBatchifier
from src.guesswhat.data_provider.guesswhat_tokenizer import GWTokenizer
from src.guesswhat.models.oracle.oracle_network import OracleNetwork
import time
if __name__ == '__main__':
#############################
# LOAD CONFIG
#############################
parser = argparse.ArgumentParser('Oracle network baseline!')
parser.add_argument("-data_dir", type=str, help="Directory with data")
parser.add_argument("-exp_dir", type=str, help="Directory in which experiments are stored")
parser.add_argument("-config", type=str, help='Config file')
parser.add_argument("-dict_file_question", type=str, default="dict.json", help="Dictionary file name")# default dict_pos_tag
parser.add_argument("-dict_file_description", type=str, default="dict_Description.json", help="Dictionary file name")
parser.add_argument("-all_dictfile", type=str, default="data/list_allquestion1.npy", help="Dictionary file name")
parser.add_argument("-img_dir", type=str, help='Directory with images')
parser.add_argument("-crop_dir", type=str, help='Directory with images')
parser.add_argument("-load_checkpoint", type=str, help="Load model parameters from specified checkpoint")
parser.add_argument("-continue_exp", type=lambda x: bool(strtobool(x)), default="False", help="Continue previously started experiment?")
parser.add_argument("-gpu_ratio", type=float, default=0.50, help="How many GPU ram is required? (ratio)")
parser.add_argument("-no_thread", type=int, default=4, help="No thread to load batch")
parser.add_argument("-inference_mode", type=bool, default=False, help="inference mode True if you want to execute only test_dataset")
args = parser.parse_args()
config, exp_identifier, save_path = load_config(args.config, args.exp_dir)
# logger.info("Save_path = ",save_path)
# exit()
logger = logging.getLogger()
# Load config
resnet_version = config['model']["image"].get('resnet_version', 50)
finetune = config["model"]["image"].get('finetune', list())
batch_size = config['optimizer']['batch_size']
no_epoch = config["optimizer"]["no_epoch"]
use_glove = config["model"]["glove"]
# Inference True if want to test the dataset_test of the pre-trained Weigth
inference = False
wait_inference = 1
#############################
# LOAD DATA
#############################
# Load image
image_builder, crop_builder = None, None
use_resnet = False
logger.info("Loading ")
t_begin = time.time()
if config['inputs'].get('image', False):
logger.info('Loading images..')
image_builder = get_img_builder(config['model']['image'], args.img_dir)
use_resnet = image_builder.is_raw_image()
if config['inputs'].get('crop', False):
logger.info('Loading crops..')
crop_builder = get_img_builder(config['model']['crop'], args.crop_dir, is_crop=True)
use_resnet = crop_builder.is_raw_image()
# Load data
logger.info('Loading data..')
all_img_bbox = {}
all_img_describtion = []
t1 = time.time()
trainset = OracleDataset.load(args.data_dir, "train",image_builder = image_builder, crop_builder = crop_builder,all_img_bbox = all_img_bbox,all_img_describtion=all_img_describtion)
validset = OracleDataset.load(args.data_dir, "valid", image_builder= image_builder, crop_builder = crop_builder,all_img_bbox = all_img_bbox,all_img_describtion=all_img_describtion)
testset = OracleDataset.load(args.data_dir, "test",image_builder= image_builder, crop_builder = crop_builder,all_img_bbox = all_img_bbox,all_img_describtion=all_img_describtion)
t2 = time.time()
logger.info("Time to load data = {}".format(t2-t1))
# np.save("all_img_bbox.npy",all_img_bbox)
# logger.info("Image_crop legnth= {}".format(len(all_img_describtion)))
# logger.info("Image_crop = {}".format(all_img_describtion))
# with open('all_img_bbox.json', 'a') as file:
# file.write(json.dumps(all_img_bbox,sort_keys=True, indent=4, separators=(',', ': ')))
file_allquestion = Path("all_question_game.txt")
# verify if file exist
if not file_allquestion.is_file():
with open('all_question_game.txt', 'a') as file:
for question in all_img_describtion:
file.write(question+"\n")
else:
logger.info("all_question exist")
# Load dictionary
logger.info('Loading dictionary Question..')
tokenizer = GWTokenizer(os.path.join(args.data_dir, args.dict_file_question),dic_all_question="data/dict_word_indice.pickle")
# Load dictionary
tokenizer_description = None
if config["inputs"]["description"]:
logger.info('Loading dictionary Description......')
tokenizer_description = GWTokenizer(os.path.join(args.data_dir,args.dict_file_description),question=False)
# Build Network
logger.info('Building network..')
if tokenizer_description != None:
network = OracleNetwork(config, num_words_question=tokenizer.no_words,num_words_description=tokenizer_description.no_words)
else:
network = OracleNetwork(config, num_words_question=tokenizer.no_words,num_words_description=None)
# Build Optimizer
logger.info('Building optimizer..')
optimizer, outputs = create_optimizer(network, config, finetune=finetune)
best_param = network.get_predict()
##############################
# START TRAINING
#############################
logger.info("Start training .......")
# create a saver to store/load checkpoint
saver = tf.train.Saver()
resnet_saver = None
logger.info("saver done !")
cpu_pool = Pool(args.no_thread, maxtasksperchild=5000)
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=args.gpu_ratio)
logger.info("gpu_options done !")
# Retrieve only resnet variabes
if use_resnet:
resnet_saver = create_resnet_saver([network])
# use_embedding = False
# if config["embedding"] != "None":
# use_embedding = True
logger.info("resnet_saver done !")
glove = None
if use_glove:
logger.info('Loading glove..')
glove = GloveEmbeddings(os.path.join(args.data_dir, config["glove_name"]),glove_dim=300,type_data="common_crow")
logger.info("glove done !")
# embedding = None
# if use_embedding:
# logger.info('Loading embedding..')
# embedding = Embeddings(args.all_dictfile,total_words=tokenizer.no_words,train=trainset,valid=validset,test=testset,dictionary_file_question=os.path.join(args.data_dir, args.dict_file_question),dictionary_file_description=os.path.join(args.data_dir, args.dict_file_description),description=config["inputs"]["description"],lemme=config["lemme"],pos=config["pos"])
# CPU/GPU option
with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, allow_soft_placement=True)) as sess:
sources = network.get_sources(sess)
out_net = network.get_parameters()[-1]
# logger.info("Sources: " + ', '.join(sources))
sess.run(tf.global_variables_initializer())
if use_resnet:
resnet_saver.restore(sess, os.path.join(args.data_dir, 'resnet_v1_{}.ckpt'.format(resnet_version)))
start_epoch = load_checkpoint(sess, saver, args, save_path)
best_val_err = 0
# best_train_err = None
# # create training tools
evaluator = Evaluator(sources, network.scope_name,network=network,tokenizer=tokenizer)
# train_evaluator = MultiGPUEvaluator(sources, scope_names, networks=networks, tokenizer=tokenizer)
# train_evaluator = Evaluator(sources, scope_names[0], network=networks[0], tokenizer=tokenizer)
# eval_evaluator = Evaluator(sources, scope_names[0], network=networks[0], tokenizer=tokenizer)
batchifier = OracleBatchifier(tokenizer, sources, status=config['status'],glove=glove,tokenizer_description=tokenizer_description,args = args,config=config)
stop_learning = False
progress_compteur = 0
t = 0
if inference == False:
while start_epoch < no_epoch and not stop_learning :
# for t in range(start_epoch, no_epoch):
logger.info('Epoch {}..'.format(t + 1))
# logger.info('Epoch {}..'.format(t + 1))
logger.info(" train_oracle | Iterator ...")
t1 = time.time()
train_iterator = Iterator(trainset,
batch_size=batch_size, pool=cpu_pool,
batchifier=batchifier,
shuffle=True)
t2 = time.time()
logger.info(" train_oracle | Iterator...Total=".format(t2-t1))
t1 = time.time()
train_loss, train_accuracy = evaluator.process(sess, train_iterator, outputs=outputs + [optimizer],out_net=best_param)
t2 = time.time()
logger.info(" train_oracle | evaluatorator...Total=".format(t2-t1))
t1 = time.time()
valid_iterator = Iterator(validset, pool=cpu_pool,
batch_size=batch_size*2,
batchifier=batchifier,
shuffle=False)
t2 = time.time()
logger.info(" train_oracle | Iterator validset...Total=".format(t2-t1))
t1 = time.time()
# [network.get_emb_concat()]
valid_loss, valid_accuracy = evaluator.process(sess, valid_iterator, outputs=outputs,type_data="Valid")
t2 = time.time()
logger.info(" train_oracle | evaluator ...Total=".format(t2-t1))
logger.info("Training loss: {}".format(train_loss))
logger.info("Training error: {}".format(1-train_accuracy))
logger.info("Validation loss: {}".format(valid_loss))
logger.info("Validation error: {}".format(1-valid_accuracy))
t1 = time.time()
if valid_accuracy > best_val_err:
best_train_err = train_accuracy
best_val_err = valid_accuracy
saver.save(sess, save_path.format('params.ckpt'))
progress_compteur = 0
logger.info("Oracle checkpoint saved...")
pickle_dump({'epoch': t}, save_path.format('status.pkl'))
elif valid_accuracy < best_val_err:
progress_compteur += 1
if int(progress_compteur) == int(wait_inference):
stop_learning = True
t2 = time.time()
logger.info(" train_oracle | Condition ...Total=".format(t2-t1))
t += 1
start_epoch += 1
# Load early stopping
t1 = time.time()
if inference:
# save_path = "out/oracle/46499510c2ab980278d91eeff89aa06f/{}" #
# save_path = "out/oracle/9efb52e0bd872e1f4e64f66b35a2f092/{}" # question
# save_path = "out/oracle/a9cc5b30b2024399c79b6997086c5265/{}" # question,category,spatial
# save_path = "out/oracle/89570bad275ddde7b69a5c37659bd40e/{}" # question,category,spaticial,crop
# save_path = "out/oracle/b158b76a46173ff33e4aec021e267e5a/{}" # question,category,spaticial,history
# save_path = "out/oracle/30ef7335e38c93632b58e91fa732cf2d/{}" # question,category,spaticial,history,Images
# save_path = "out/oracle/d9f1951536bbd147a3ea605bb3cbdde7/{}" # question,category,spaticial,history,Crop # question,category,spaticial,history,Crop
# save_path = "out/oracle/4a9f62698e3304c4c2d733bff0b24ee2/{}"
save_path = "out/oracle/a630385c990e5cc470c2488a244f18dc/{}"
# out/oracle/ce02141129f6d87172cafc817c6d0b59/params.ckpt
# save_path = save_path.format('params.ckpt')
logger.info("***** save_path = ".format(save_path))
save_path = save_path.format('params.ckpt')
saver.restore(sess, save_path)
test_iterator = Iterator(testset, pool=cpu_pool,
batch_size=batch_size*2,
batchifier=batchifier,
shuffle=True)
logger.info("Output = {}".format(outputs[1]))
logger.info("Best_param = {}".format(best_param))
test_loss, test_accuracy = evaluator.process(sess, test_iterator, outputs=outputs ,out_net=best_param,inference=inference,type_data="Test")
t2 = time.time()
logger.info(" train_oracle | Iterator testset ...Total=".format(t2-t1))
try:
logger.info("Testing loss: {}".format(test_loss))
except Exception:
logger.info("Erreur loss")
try:
logger.info("Testing error: {}".format(1-test_accuracy))
except Exception:
logger.info("Erreur accuracy")
t_end = time.time()
logger.info("Time execution = {}".format(t_end - t_begin))
| [
11748,
1822,
29572,
198,
11748,
18931,
198,
11748,
28686,
198,
6738,
18540,
305,
919,
278,
1330,
19850,
198,
6738,
1233,
26791,
13,
22602,
1330,
965,
83,
672,
970,
198,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
33918,
198,
6738,
3108,
8019,
1330,
10644,
198,
198,
6738,
14276,
13,
7890,
62,
15234,
1304,
13,
48727,
1330,
40806,
1352,
198,
6738,
14276,
13,
27110,
62,
26791,
13,
18206,
84,
1352,
1330,
26439,
84,
1352,
198,
6738,
14276,
13,
27110,
62,
26791,
13,
40085,
7509,
1330,
2251,
62,
40085,
7509,
198,
6738,
14276,
13,
27110,
62,
26791,
13,
694,
457,
62,
29356,
1330,
3440,
62,
9122,
4122,
11,
2251,
62,
411,
3262,
62,
82,
8770,
198,
6738,
14276,
13,
26791,
13,
11250,
1330,
3440,
62,
11250,
198,
6738,
14276,
13,
26791,
13,
7753,
62,
4993,
8116,
1330,
2298,
293,
62,
39455,
198,
6738,
14276,
13,
7890,
62,
15234,
1304,
13,
9060,
62,
29356,
1330,
651,
62,
9600,
62,
38272,
198,
6738,
14276,
13,
7890,
62,
15234,
1304,
13,
21283,
79,
62,
26791,
1330,
13302,
6048,
654,
198,
6738,
14276,
13,
7890,
62,
15234,
1304,
13,
21283,
79,
62,
26791,
1330,
2671,
659,
31567,
6048,
654,
198,
198,
6738,
12351,
13,
5162,
408,
10919,
13,
7890,
62,
15234,
1304,
13,
5162,
408,
10919,
62,
19608,
292,
316,
1330,
18650,
27354,
292,
316,
198,
6738,
12351,
13,
5162,
408,
10919,
13,
7890,
62,
15234,
1304,
13,
273,
6008,
62,
43501,
7483,
1330,
18650,
33,
963,
7483,
198,
6738,
12351,
13,
5162,
408,
10919,
13,
7890,
62,
15234,
1304,
13,
5162,
408,
10919,
62,
30001,
7509,
1330,
27164,
30642,
7509,
198,
6738,
12351,
13,
5162,
408,
10919,
13,
27530,
13,
273,
6008,
13,
273,
6008,
62,
27349,
1330,
18650,
26245,
198,
11748,
640,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
628,
220,
220,
220,
1303,
14468,
7804,
4242,
198,
220,
220,
220,
1303,
220,
17579,
2885,
25626,
198,
220,
220,
220,
1303,
14468,
7804,
4242,
628,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
10786,
48625,
3127,
14805,
0,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
7890,
62,
15908,
1600,
2099,
28,
2536,
11,
1037,
2625,
43055,
351,
1366,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
11201,
62,
15908,
1600,
2099,
28,
2536,
11,
1037,
2625,
43055,
287,
543,
10256,
389,
8574,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
11250,
1600,
2099,
28,
2536,
11,
1037,
11639,
16934,
2393,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
11600,
62,
7753,
62,
25652,
1600,
2099,
28,
2536,
11,
4277,
2625,
11600,
13,
17752,
1600,
1037,
2625,
35,
14188,
2393,
1438,
4943,
2,
4277,
8633,
62,
1930,
62,
12985,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
11600,
62,
7753,
62,
11213,
1600,
2099,
28,
2536,
11,
4277,
2625,
11600,
62,
11828,
13,
17752,
1600,
1037,
2625,
35,
14188,
2393,
1438,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
439,
62,
11600,
7753,
1600,
2099,
28,
2536,
11,
4277,
2625,
7890,
14,
4868,
62,
439,
25652,
16,
13,
77,
9078,
1600,
1037,
2625,
35,
14188,
2393,
1438,
4943,
198,
220,
220,
220,
220,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
9600,
62,
15908,
1600,
2099,
28,
2536,
11,
1037,
11639,
43055,
351,
4263,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
31476,
62,
15908,
1600,
2099,
28,
2536,
11,
1037,
11639,
43055,
351,
4263,
11537,
628,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
2220,
62,
9122,
4122,
1600,
2099,
28,
2536,
11,
1037,
2625,
8912,
2746,
10007,
422,
7368,
26954,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
43043,
62,
11201,
1600,
2099,
28,
50033,
2124,
25,
20512,
7,
2536,
83,
672,
970,
7,
87,
36911,
4277,
2625,
25101,
1600,
1037,
2625,
29453,
4271,
2067,
6306,
1701,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
46999,
62,
10366,
952,
1600,
2099,
28,
22468,
11,
4277,
28,
15,
13,
1120,
11,
1037,
2625,
2437,
867,
11362,
15770,
318,
2672,
30,
357,
10366,
952,
8,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
3919,
62,
16663,
1600,
2099,
28,
600,
11,
4277,
28,
19,
11,
1037,
2625,
2949,
4704,
284,
3440,
15458,
4943,
628,
628,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
12,
259,
4288,
62,
14171,
1600,
2099,
28,
30388,
11,
4277,
28,
25101,
11,
1037,
2625,
259,
4288,
4235,
6407,
611,
345,
765,
284,
12260,
691,
1332,
62,
19608,
292,
316,
4943,
628,
198,
220,
220,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
220,
198,
220,
220,
220,
4566,
11,
1033,
62,
738,
7483,
11,
3613,
62,
6978,
796,
3440,
62,
11250,
7,
22046,
13,
11250,
11,
26498,
13,
11201,
62,
15908,
8,
198,
220,
220,
220,
1303,
49706,
13,
10951,
7203,
16928,
62,
6978,
796,
33172,
21928,
62,
6978,
8,
198,
220,
220,
220,
1303,
8420,
3419,
628,
198,
220,
220,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
3419,
628,
220,
220,
220,
1303,
8778,
4566,
198,
220,
220,
220,
581,
3262,
62,
9641,
796,
4566,
17816,
19849,
6,
7131,
1,
9060,
1,
4083,
1136,
10786,
411,
3262,
62,
9641,
3256,
2026,
8,
198,
220,
220,
220,
957,
316,
1726,
796,
4566,
14692,
19849,
1,
7131,
1,
9060,
1,
4083,
1136,
10786,
15643,
316,
1726,
3256,
1351,
28955,
198,
220,
220,
220,
15458,
62,
7857,
796,
4566,
17816,
40085,
7509,
6,
7131,
6,
43501,
62,
7857,
20520,
198,
220,
220,
220,
645,
62,
538,
5374,
796,
4566,
14692,
40085,
7509,
1,
7131,
1,
3919,
62,
538,
5374,
8973,
198,
220,
220,
220,
779,
62,
4743,
659,
796,
4566,
14692,
19849,
1,
7131,
1,
4743,
659,
8973,
628,
198,
220,
220,
220,
1303,
554,
4288,
6407,
611,
765,
284,
1332,
262,
27039,
62,
9288,
286,
262,
662,
12,
35311,
775,
328,
400,
628,
198,
220,
220,
220,
32278,
796,
220,
10352,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
4043,
62,
259,
4288,
796,
352,
628,
628,
220,
220,
220,
1303,
14468,
7804,
4242,
198,
220,
220,
220,
1303,
220,
17579,
2885,
42865,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
14468,
7804,
4242,
628,
220,
220,
220,
1303,
8778,
2939,
198,
220,
220,
220,
2939,
62,
38272,
11,
13833,
62,
38272,
796,
6045,
11,
6045,
198,
220,
220,
220,
779,
62,
411,
3262,
796,
10352,
198,
220,
220,
220,
49706,
13,
10951,
7203,
19031,
366,
8,
198,
220,
220,
220,
256,
62,
27471,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
611,
4566,
17816,
15414,
82,
6,
4083,
1136,
10786,
9060,
3256,
10352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
4263,
492,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2939,
62,
38272,
796,
651,
62,
9600,
62,
38272,
7,
11250,
17816,
19849,
6,
7131,
6,
9060,
6,
4357,
26498,
13,
9600,
62,
15908,
8,
198,
220,
220,
220,
220,
220,
220,
220,
779,
62,
411,
3262,
796,
2939,
62,
38272,
13,
271,
62,
1831,
62,
9060,
3419,
628,
220,
220,
220,
611,
4566,
17816,
15414,
82,
6,
4083,
1136,
10786,
31476,
3256,
10352,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
14450,
492,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
13833,
62,
38272,
796,
651,
62,
9600,
62,
38272,
7,
11250,
17816,
19849,
6,
7131,
6,
31476,
6,
4357,
26498,
13,
31476,
62,
15908,
11,
318,
62,
31476,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
779,
62,
411,
3262,
796,
13833,
62,
38272,
13,
271,
62,
1831,
62,
9060,
3419,
628,
220,
220,
220,
220,
628,
198,
220,
220,
220,
1303,
8778,
1366,
198,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
1366,
492,
11537,
628,
220,
220,
220,
477,
62,
9600,
62,
65,
3524,
796,
23884,
198,
220,
220,
220,
477,
62,
9600,
62,
20147,
822,
5378,
796,
17635,
628,
198,
220,
220,
220,
256,
16,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
13404,
316,
796,
220,
18650,
27354,
292,
316,
13,
2220,
7,
22046,
13,
7890,
62,
15908,
11,
366,
27432,
1600,
9060,
62,
38272,
796,
2939,
62,
38272,
11,
13833,
62,
38272,
796,
13833,
62,
38272,
11,
439,
62,
9600,
62,
65,
3524,
220,
796,
477,
62,
9600,
62,
65,
3524,
11,
439,
62,
9600,
62,
20147,
822,
5378,
28,
439,
62,
9600,
62,
20147,
822,
5378,
8,
198,
220,
220,
220,
1188,
2340,
316,
796,
220,
18650,
27354,
292,
316,
13,
2220,
7,
22046,
13,
7890,
62,
15908,
11,
366,
12102,
1600,
2939,
62,
38272,
28,
2939,
62,
38272,
11,
13833,
62,
38272,
796,
13833,
62,
38272,
11,
439,
62,
9600,
62,
65,
3524,
796,
477,
62,
9600,
62,
65,
3524,
11,
439,
62,
9600,
62,
20147,
822,
5378,
28,
439,
62,
9600,
62,
20147,
822,
5378,
8,
198,
220,
220,
220,
1332,
2617,
220,
796,
220,
18650,
27354,
292,
316,
13,
2220,
7,
22046,
13,
7890,
62,
15908,
11,
366,
9288,
1600,
9060,
62,
38272,
28,
2939,
62,
38272,
11,
13833,
62,
38272,
796,
13833,
62,
38272,
11,
439,
62,
9600,
62,
65,
3524,
796,
477,
62,
9600,
62,
65,
3524,
11,
439,
62,
9600,
62,
20147,
822,
5378,
28,
439,
62,
9600,
62,
20147,
822,
5378,
8,
628,
220,
220,
220,
220,
198,
220,
220,
220,
256,
17,
796,
640,
13,
2435,
3419,
628,
198,
220,
220,
220,
49706,
13,
10951,
7203,
7575,
284,
3440,
1366,
796,
23884,
1911,
18982,
7,
83,
17,
12,
83,
16,
4008,
628,
220,
220,
220,
1303,
45941,
13,
21928,
7203,
439,
62,
9600,
62,
65,
3524,
13,
77,
9078,
1600,
439,
62,
9600,
62,
65,
3524,
8,
198,
220,
220,
220,
1303,
49706,
13,
10951,
7203,
5159,
62,
31476,
1232,
77,
400,
28,
23884,
1911,
18982,
7,
11925,
7,
439,
62,
9600,
62,
20147,
822,
5378,
22305,
198,
220,
220,
220,
1303,
49706,
13,
10951,
7203,
5159,
62,
31476,
796,
23884,
1911,
18982,
7,
439,
62,
9600,
62,
20147,
822,
5378,
4008,
198,
220,
220,
220,
1303,
351,
1280,
10786,
439,
62,
9600,
62,
65,
3524,
13,
17752,
3256,
705,
64,
11537,
355,
2393,
25,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
13,
13564,
7,
17752,
13,
67,
8142,
7,
439,
62,
9600,
62,
65,
3524,
11,
30619,
62,
13083,
28,
17821,
11,
33793,
28,
19,
11,
2880,
2024,
16193,
3256,
3256,
705,
25,
705,
22305,
198,
220,
220,
220,
2393,
62,
439,
25652,
796,
220,
10644,
7203,
439,
62,
25652,
62,
6057,
13,
14116,
4943,
628,
220,
220,
220,
1303,
11767,
611,
2393,
2152,
628,
220,
220,
220,
611,
407,
2393,
62,
439,
25652,
13,
271,
62,
7753,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
10786,
439,
62,
25652,
62,
6057,
13,
14116,
3256,
705,
64,
11537,
355,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1808,
287,
477,
62,
9600,
62,
20147,
822,
5378,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
13,
13564,
7,
25652,
10,
1,
59,
77,
4943,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
439,
62,
25652,
2152,
4943,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
8778,
22155,
198,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
22155,
18233,
492,
11537,
198,
220,
220,
220,
11241,
7509,
796,
27164,
30642,
7509,
7,
418,
13,
6978,
13,
22179,
7,
22046,
13,
7890,
62,
15908,
11,
26498,
13,
11600,
62,
7753,
62,
25652,
828,
67,
291,
62,
439,
62,
25652,
2625,
7890,
14,
11600,
62,
4775,
62,
521,
501,
13,
27729,
293,
4943,
628,
220,
220,
220,
1303,
8778,
22155,
198,
220,
220,
220,
11241,
7509,
62,
11213,
796,
6045,
198,
220,
220,
220,
611,
4566,
14692,
15414,
82,
1,
7131,
1,
11213,
1,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
22155,
12489,
16317,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
7509,
62,
11213,
796,
27164,
30642,
7509,
7,
418,
13,
6978,
13,
22179,
7,
22046,
13,
7890,
62,
15908,
11,
22046,
13,
11600,
62,
7753,
62,
11213,
828,
25652,
28,
25101,
8,
628,
220,
220,
220,
1303,
10934,
7311,
198,
220,
220,
220,
49706,
13,
10951,
10786,
25954,
3127,
492,
11537,
198,
220,
220,
220,
611,
11241,
7509,
62,
11213,
14512,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3127,
796,
18650,
26245,
7,
11250,
11,
997,
62,
10879,
62,
25652,
28,
30001,
7509,
13,
3919,
62,
10879,
11,
22510,
62,
10879,
62,
11213,
28,
30001,
7509,
62,
11213,
13,
3919,
62,
10879,
8,
198,
220,
220,
220,
2073,
25,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3127,
796,
18650,
26245,
7,
11250,
11,
997,
62,
10879,
62,
25652,
28,
30001,
7509,
13,
3919,
62,
10879,
11,
22510,
62,
10879,
62,
11213,
28,
14202,
8,
628,
220,
220,
220,
1303,
10934,
30011,
7509,
198,
220,
220,
220,
49706,
13,
10951,
10786,
25954,
6436,
7509,
492,
11537,
198,
220,
220,
220,
6436,
7509,
11,
23862,
796,
2251,
62,
40085,
7509,
7,
27349,
11,
4566,
11,
957,
316,
1726,
28,
15643,
316,
1726,
8,
198,
220,
220,
220,
1266,
62,
17143,
796,
3127,
13,
1136,
62,
79,
17407,
3419,
198,
220,
220,
220,
1303,
14468,
7804,
4242,
2,
198,
220,
220,
220,
1303,
220,
33303,
220,
29125,
1268,
2751,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
14468,
7804,
4242,
198,
220,
220,
220,
49706,
13,
10951,
7203,
10434,
3047,
19424,
9313,
8,
628,
220,
220,
220,
1303,
2251,
257,
473,
332,
284,
3650,
14,
2220,
26954,
198,
220,
220,
220,
473,
332,
796,
48700,
13,
27432,
13,
50,
8770,
3419,
198,
220,
220,
220,
581,
3262,
62,
82,
8770,
796,
6045,
628,
220,
220,
220,
49706,
13,
10951,
7203,
82,
8770,
1760,
220,
2474,
8,
628,
220,
220,
220,
42804,
62,
7742,
796,
19850,
7,
22046,
13,
3919,
62,
16663,
11,
17266,
742,
6791,
525,
9410,
28,
27641,
8,
198,
220,
220,
220,
308,
19944,
62,
25811,
796,
48700,
13,
33346,
29046,
7,
525,
62,
14681,
62,
46999,
62,
31673,
62,
69,
7861,
28,
22046,
13,
46999,
62,
10366,
952,
8,
628,
220,
220,
220,
49706,
13,
10951,
7203,
46999,
62,
25811,
1760,
220,
2474,
8,
628,
198,
220,
220,
220,
1303,
4990,
30227,
691,
581,
3262,
5553,
397,
274,
198,
220,
220,
220,
611,
779,
62,
411,
3262,
25,
198,
220,
220,
220,
220,
220,
220,
220,
581,
3262,
62,
82,
8770,
796,
2251,
62,
411,
3262,
62,
82,
8770,
26933,
27349,
12962,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
779,
62,
20521,
12083,
796,
10352,
198,
220,
220,
220,
1303,
611,
4566,
14692,
20521,
12083,
8973,
14512,
366,
14202,
1298,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
779,
62,
20521,
12083,
796,
6407,
628,
220,
220,
220,
49706,
13,
10951,
7203,
411,
3262,
62,
82,
8770,
1760,
220,
2474,
8,
628,
198,
220,
220,
220,
29144,
796,
6045,
198,
220,
220,
220,
611,
779,
62,
4743,
659,
25,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
29144,
492,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
29144,
796,
2671,
659,
31567,
6048,
654,
7,
418,
13,
6978,
13,
22179,
7,
22046,
13,
7890,
62,
15908,
11,
4566,
14692,
4743,
659,
62,
3672,
8973,
828,
4743,
659,
62,
27740,
28,
6200,
11,
4906,
62,
7890,
2625,
11321,
62,
47114,
4943,
628,
198,
220,
220,
220,
49706,
13,
10951,
7203,
4743,
659,
1760,
220,
2474,
8,
220,
220,
220,
628,
220,
220,
220,
1303,
11525,
12083,
796,
6045,
198,
220,
220,
220,
1303,
611,
779,
62,
20521,
12083,
25,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
49706,
13,
10951,
10786,
19031,
11525,
12083,
492,
11537,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
11525,
12083,
796,
13302,
6048,
654,
7,
22046,
13,
439,
62,
11600,
7753,
11,
23350,
62,
10879,
28,
30001,
7509,
13,
3919,
62,
10879,
11,
27432,
28,
2213,
1299,
316,
11,
12102,
28,
2100,
2340,
316,
11,
9288,
28,
9288,
2617,
11,
67,
14188,
62,
7753,
62,
25652,
28,
418,
13,
6978,
13,
22179,
7,
22046,
13,
7890,
62,
15908,
11,
26498,
13,
11600,
62,
7753,
62,
25652,
828,
67,
14188,
62,
7753,
62,
11213,
28,
418,
13,
6978,
13,
22179,
7,
22046,
13,
7890,
62,
15908,
11,
26498,
13,
11600,
62,
7753,
62,
11213,
828,
11213,
28,
11250,
14692,
15414,
82,
1,
7131,
1,
11213,
33116,
10671,
1326,
28,
11250,
14692,
10671,
1326,
33116,
1930,
28,
11250,
14692,
1930,
8973,
8,
628,
198,
220,
220,
220,
1303,
9135,
14,
33346,
3038,
628,
220,
220,
220,
351,
48700,
13,
36044,
7,
11250,
28,
27110,
13,
16934,
2964,
1462,
7,
46999,
62,
25811,
28,
46999,
62,
25811,
11,
1249,
62,
4215,
62,
489,
5592,
28,
17821,
4008,
355,
264,
408,
25,
628,
198,
220,
220,
220,
220,
220,
220,
220,
4237,
796,
3127,
13,
1136,
62,
82,
2203,
7,
82,
408,
8,
198,
220,
220,
220,
220,
220,
220,
220,
503,
62,
3262,
796,
3127,
13,
1136,
62,
17143,
7307,
3419,
58,
12,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
49706,
13,
10951,
7203,
21188,
25,
366,
1343,
46083,
45302,
22179,
7,
82,
2203,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
264,
408,
13,
5143,
7,
27110,
13,
20541,
62,
25641,
2977,
62,
36733,
7509,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
611,
779,
62,
411,
3262,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
581,
3262,
62,
82,
8770,
13,
2118,
382,
7,
82,
408,
11,
28686,
13,
6978,
13,
22179,
7,
22046,
13,
7890,
62,
15908,
11,
705,
411,
3262,
62,
85,
16,
23330,
27422,
694,
457,
4458,
18982,
7,
411,
3262,
62,
9641,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
923,
62,
538,
5374,
796,
3440,
62,
9122,
4122,
7,
82,
408,
11,
473,
332,
11,
26498,
11,
3613,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1266,
62,
2100,
62,
8056,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1266,
62,
27432,
62,
8056,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1303,
2251,
3047,
4899,
198,
220,
220,
220,
220,
220,
220,
220,
5418,
84,
1352,
796,
26439,
84,
1352,
7,
82,
2203,
11,
3127,
13,
29982,
62,
3672,
11,
27349,
28,
27349,
11,
30001,
7509,
28,
30001,
7509,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
4512,
62,
18206,
84,
1352,
796,
15237,
33346,
36,
2100,
84,
1352,
7,
82,
2203,
11,
8354,
62,
14933,
11,
7686,
28,
3262,
5225,
11,
11241,
7509,
28,
30001,
7509,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4512,
62,
18206,
84,
1352,
796,
26439,
84,
1352,
7,
82,
2203,
11,
8354,
62,
14933,
58,
15,
4357,
3127,
28,
3262,
5225,
58,
15,
4357,
11241,
7509,
28,
30001,
7509,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5418,
62,
18206,
84,
1352,
796,
26439,
84,
1352,
7,
82,
2203,
11,
8354,
62,
14933,
58,
15,
4357,
3127,
28,
3262,
5225,
58,
15,
4357,
11241,
7509,
28,
30001,
7509,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
7483,
796,
220,
18650,
33,
963,
7483,
7,
30001,
7509,
11,
4237,
11,
3722,
28,
11250,
17816,
13376,
6,
4357,
4743,
659,
28,
4743,
659,
11,
30001,
7509,
62,
11213,
28,
30001,
7509,
62,
11213,
11,
22046,
796,
26498,
11,
11250,
28,
11250,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2245,
62,
40684,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
4371,
62,
785,
457,
23365,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
256,
796,
657,
628,
198,
220,
220,
220,
220,
220,
220,
220,
611,
32278,
6624,
10352,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
923,
62,
538,
5374,
1279,
645,
62,
538,
5374,
290,
407,
2245,
62,
40684,
1058,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
329,
256,
287,
2837,
7,
9688,
62,
538,
5374,
11,
645,
62,
538,
5374,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
13807,
5374,
23884,
492,
4458,
18982,
7,
83,
1343,
352,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
49706,
13,
10951,
10786,
13807,
5374,
23884,
492,
4458,
18982,
7,
83,
1343,
352,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
4512,
62,
273,
6008,
930,
40806,
1352,
35713,
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,
220,
220,
220,
220,
256,
16,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
48727,
796,
40806,
1352,
7,
2213,
1299,
316,
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,
15458,
62,
7857,
28,
43501,
62,
7857,
11,
5933,
28,
36166,
62,
7742,
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,
15458,
7483,
28,
43501,
7483,
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,
36273,
28,
17821,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
17,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
4512,
62,
273,
6008,
930,
40806,
1352,
986,
14957,
28,
1911,
18982,
7,
83,
17,
12,
83,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
16,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
22462,
11,
4512,
62,
4134,
23843,
796,
5418,
84,
1352,
13,
14681,
7,
82,
408,
11,
4512,
62,
48727,
11,
23862,
28,
22915,
82,
1343,
685,
40085,
7509,
4357,
448,
62,
3262,
28,
13466,
62,
17143,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
17,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
4512,
62,
273,
6008,
930,
5418,
84,
1352,
1352,
986,
14957,
28,
1911,
18982,
7,
83,
17,
12,
83,
16,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
16,
796,
640,
13,
2435,
3419,
628,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4938,
62,
48727,
796,
40806,
1352,
7,
2100,
2340,
316,
11,
5933,
28,
36166,
62,
7742,
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,
15458,
62,
7857,
28,
43501,
62,
7857,
9,
17,
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,
15458,
7483,
28,
43501,
7483,
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,
36273,
28,
25101,
8,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
17,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
4512,
62,
273,
6008,
930,
40806,
1352,
1188,
2340,
316,
986,
14957,
28,
1911,
18982,
7,
83,
17,
12,
83,
16,
4008,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
16,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
27349,
13,
1136,
62,
24419,
62,
1102,
9246,
3419,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4938,
62,
22462,
11,
4938,
62,
4134,
23843,
796,
5418,
84,
1352,
13,
14681,
7,
82,
408,
11,
4938,
62,
48727,
11,
23862,
28,
22915,
82,
11,
4906,
62,
7890,
2625,
47139,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
17,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
4512,
62,
273,
6008,
930,
5418,
84,
1352,
2644,
14957,
28,
1911,
18982,
7,
83,
17,
12,
83,
16,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
44357,
2994,
25,
23884,
1911,
18982,
7,
27432,
62,
22462,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
44357,
4049,
25,
23884,
1911,
18982,
7,
16,
12,
27432,
62,
4134,
23843,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
7762,
24765,
2994,
25,
23884,
1911,
18982,
7,
12102,
62,
22462,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
7762,
24765,
4049,
25,
23884,
1911,
18982,
7,
16,
12,
12102,
62,
4134,
23843,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
16,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4938,
62,
4134,
23843,
1875,
1266,
62,
2100,
62,
8056,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1266,
62,
27432,
62,
8056,
796,
4512,
62,
4134,
23843,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1266,
62,
2100,
62,
8056,
796,
4938,
62,
4134,
23843,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
473,
332,
13,
21928,
7,
82,
408,
11,
3613,
62,
6978,
13,
18982,
10786,
37266,
13,
694,
457,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4371,
62,
785,
457,
23365,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
48625,
26954,
7448,
9313,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2298,
293,
62,
39455,
15090,
6,
538,
5374,
10354,
256,
5512,
3613,
62,
6978,
13,
18982,
10786,
13376,
13,
79,
41582,
6,
4008,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
4938,
62,
4134,
23843,
1279,
1266,
62,
2100,
62,
8056,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4371,
62,
785,
457,
23365,
15853,
352,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
493,
7,
33723,
62,
785,
457,
23365,
8,
6624,
493,
7,
17077,
62,
259,
4288,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2245,
62,
40684,
796,
6407,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
17,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
4512,
62,
273,
6008,
930,
24295,
2644,
14957,
28,
1911,
18982,
7,
83,
17,
12,
83,
16,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
923,
62,
538,
5374,
15853,
352,
628,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
8778,
1903,
12225,
628,
220,
220,
220,
220,
220,
220,
220,
256,
16,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
611,
32278,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
44578,
33438,
940,
66,
17,
397,
40022,
25870,
67,
6420,
1453,
487,
4531,
7252,
3312,
69,
14,
90,
36786,
1303,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
24,
891,
65,
4309,
68,
15,
17457,
23,
4761,
68,
16,
69,
19,
68,
2414,
69,
2791,
65,
2327,
64,
17,
69,
2931,
17,
14,
90,
36786,
1303,
1808,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
64,
24,
535,
20,
65,
1270,
65,
1238,
26660,
2079,
66,
3720,
65,
47325,
2154,
4521,
66,
20,
22980,
14,
90,
36786,
1303,
1808,
11,
22872,
11,
2777,
34961,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
23,
3865,
2154,
14774,
23195,
1860,
2934,
22,
65,
3388,
64,
20,
66,
2718,
36445,
17457,
1821,
68,
14,
90,
36786,
1303,
1808,
11,
22872,
11,
2777,
1512,
498,
11,
31476,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
65,
21273,
65,
4304,
64,
3510,
25399,
487,
2091,
68,
19,
64,
721,
46821,
68,
25674,
68,
20,
64,
14,
90,
36786,
1303,
1808,
11,
22872,
11,
2777,
1512,
498,
11,
23569,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
1270,
891,
22,
27326,
68,
2548,
66,
24,
2623,
2624,
65,
3365,
68,
6420,
13331,
22,
2624,
12993,
17,
67,
14,
90,
36786,
1303,
1808,
11,
22872,
11,
2777,
1512,
498,
11,
23569,
11,
29398,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
67,
24,
69,
22186,
1314,
2623,
11848,
67,
20198,
64,
18,
18213,
32417,
11848,
18,
21101,
1860,
68,
22,
14,
90,
36786,
1303,
1808,
11,
22872,
11,
2777,
1512,
498,
11,
23569,
11,
34,
1773,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1808,
11,
22872,
11,
2777,
1512,
498,
11,
23569,
11,
34,
1773,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
366,
448,
14,
273,
6008,
14,
19,
64,
24,
69,
45191,
4089,
68,
18,
21288,
66,
19,
66,
17,
67,
49995,
65,
487,
15,
65,
1731,
1453,
17,
14,
90,
36786,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3613,
62,
6978,
796,
220,
220,
366,
448,
14,
273,
6008,
14,
64,
30005,
27203,
66,
34155,
68,
20,
535,
27790,
66,
1731,
3459,
64,
25707,
69,
1507,
17896,
14,
90,
36786,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
503,
14,
273,
6008,
14,
344,
2999,
1415,
14686,
24,
69,
21,
67,
5774,
23628,
66,
1878,
66,
23,
1558,
66,
21,
67,
15,
65,
3270,
14,
37266,
13,
694,
457,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3613,
62,
6978,
796,
3613,
62,
6978,
13,
18982,
10786,
37266,
13,
694,
457,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
35625,
3613,
62,
6978,
796,
27071,
18982,
7,
21928,
62,
6978,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
628,
198,
220,
220,
220,
220,
220,
220,
220,
3613,
62,
6978,
796,
3613,
62,
6978,
13,
18982,
10786,
37266,
13,
694,
457,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
473,
332,
13,
2118,
382,
7,
82,
408,
11,
3613,
62,
6978,
8,
628,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
48727,
796,
40806,
1352,
7,
9288,
2617,
11,
5933,
28,
36166,
62,
7742,
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,
15458,
62,
7857,
28,
43501,
62,
7857,
9,
17,
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,
15458,
7483,
28,
43501,
7483,
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,
36273,
28,
17821,
8,
628,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
26410,
796,
23884,
1911,
18982,
7,
22915,
82,
58,
16,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
13014,
62,
17143,
796,
23884,
1911,
18982,
7,
13466,
62,
17143,
4008,
628,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
22462,
11,
1332,
62,
4134,
23843,
796,
5418,
84,
1352,
13,
14681,
7,
82,
408,
11,
1332,
62,
48727,
11,
220,
23862,
28,
22915,
82,
837,
448,
62,
3262,
28,
13466,
62,
17143,
11,
259,
4288,
28,
259,
4288,
11,
4906,
62,
7890,
2625,
14402,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
256,
17,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
4512,
62,
273,
6008,
930,
40806,
1352,
1332,
2617,
220,
2644,
14957,
28,
1911,
18982,
7,
83,
17,
12,
83,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
44154,
2994,
25,
23884,
1911,
18982,
7,
9288,
62,
22462,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
9139,
260,
333,
2994,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
44154,
4049,
25,
23884,
1911,
18982,
7,
16,
12,
9288,
62,
4134,
23843,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
9139,
260,
333,
9922,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
256,
62,
437,
796,
640,
13,
2435,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7203,
7575,
9706,
796,
23884,
1911,
18982,
7,
83,
62,
437,
532,
256,
62,
27471,
4008,
628,
198
] | 2.274634 | 6,292 |
"""
Generally speaking, compass provides a command line util that is used
a) as a management script (like django-admin.py) doing for example
setup work, adding plugins to a project etc), and
b) can compile the sass source files into CSS.
While generally project-based, starting with 0.10, compass supposedly
supports compiling individual files, which is what we are using for
implementing this filter. Supposedly, because there are numerous issues
that require working around. See the comments in the actual filter code
for the full story on all the hoops be have to jump through.
An alternative option would be to use Sass to compile. Compass essentially
adds two things on top of sass: A bunch of CSS frameworks, ported to Sass,
and available for including. And various ruby helpers that these frameworks
and custom Sass files can use. Apparently there is supposed to be a way
to compile a compass project through sass, but so far, I haven't got it
to work. The syntax is supposed to be one of:
$ sass -r compass `compass imports` FILE
$ sass --compass FILE
See:
http://groups.google.com/group/compass-users/browse_thread/thread/a476dfcd2b47653e
http://groups.google.com/group/compass-users/browse_thread/thread/072bd8b51bec5f7c
http://groups.google.com/group/compass-users/browse_thread/thread/daf55acda03656d1
"""
import os, subprocess
from os import path
import tempfile
import shutil
from webassets.exceptions import FilterError
from webassets.filter import Filter, option
__all__ = ('CompassFilter',)
class CompassFilter(Filter):
"""Converts `Compass <http://compass-style.org/>`_ .sass files to
CSS.
Requires at least version 0.10.
To compile a standard Compass project, you only need to have
to compile your main ``screen.sass``, ``print.sass`` and ``ie.sass``
files. All the partials that you include will be handled by Compass.
If you want to combine the filter with other CSS filters, make
sure this one runs first.
Supported configuration options:
COMPASS_BIN
The path to the Compass binary. If not set, the filter will
try to run ``compass`` as if it's in the system path.
COMPASS_PLUGINS
Compass plugins to use. This is equivalent to the ``--require``
command line option of the Compass. and expects a Python list
object of Ruby libraries to load.
"""
name = 'compass'
options = {
'compass': ('binary', 'COMPASS_BIN'),
'plugins': option('COMPASS_PLUGINS', type=list)
}
def open(self, out, source_path, **kw):
"""Compass currently doesn't take data from stdin, and doesn't allow
us accessing the result from stdout either.
Also, there's a bunch of other issues we need to work around:
- compass doesn't support given an explict output file, only a
"--css-dir" output directory.
We have to "guess" the filename that will be created in that
directory.
- The output filename used is based on the input filename, and
simply cutting of the length of the "sass_dir" (and changing
the file extension). That is, compass expects the input
filename to always be inside the "sass_dir" (which defaults to
./src), and if this is not the case, the output filename will
be gibberish (missing characters in front). See:
https://github.com/chriseppstein/compass/issues/304
We fix this by setting the proper --sass-dir option.
- Compass insists on creating a .sass-cache folder in the
current working directory, and unlike the sass executable,
there doesn't seem to be a way to disable it.
The workaround is to set the working directory to our temp
directory, so that the cache folder will be deleted at the end.
"""
tempout = tempfile.mkdtemp()
# Temporarily move to "tempout", so .sass-cache will be created there
old_wd = os.getcwdu()
os.chdir(tempout)
try:
# Make sure to use normpath() to not cause trouble with
# compass' simplistic path handling, where it just assumes
# source_path is within sassdir, and cuts off the length of
# sassdir from the input file.
sassdir = path.normpath(path.dirname(source_path))
source_path = path.normpath(source_path)
# Compass offers some helpers like image-url(), which need
# information about the urls under which media files will be
# available. This is hard for two reasons: First, the options in
# question aren't supported on the command line, so we need to write
# a temporary config file. Secondly, the assume a defined and
# separate directories for "images", "stylesheets" etc., something
# webassets knows nothing of: we don't support the user defining
# something such directories. Because we traditionally had this
# filter point all type-specific directories to the root media
# directory, we will define the paths to match this. In other
# words, in Compass, both inline-image("img/test.png) and
# image-url("img/test.png") will find the same file, and assume it
# to be {env.directory}/img/test.png.
# However, this partly negates the purpose of an utiility like
# image-url() in the first place - you not having to hard code
# the location of your images. So a possiblity for the future
# might be adding options that allow changing this behavior (see
# ticket #36).
#
# Note that is also the --relative-assets option, which we can't
# use because it calculates an actual relative path between the
# image and the css output file, the latter being in a temporary
# directory in our case.
config_file = path.join(tempout, '.config.rb')
f = open(config_file, 'w')
try:
f.write("""
http_path = "%s"
http_images_dir = ""
http_stylesheets_dir = ""
http_fonts_dir = ""
http_javascripts_dir = ""
""" % self.env.url)
f.flush()
finally:
f.close()
command = [self.compass or 'compass', 'compile']
for plugin in self.plugins or []:
command.extend(('--require', plugin))
command.extend(['--sass-dir', sassdir,
'--css-dir', tempout,
'--image-dir', self.env.directory,
'--config', config_file,
'--quiet',
'--boring',
'--output-style', 'expanded',
source_path])
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
# shell: necessary on windows to execute
# ruby files, but doesn't work on linux.
shell=(os.name == 'nt'))
stdout, stderr = proc.communicate()
# compass seems to always write a utf8 header? to stderr, so
# make sure to not fail just because there's something there.
if proc.returncode != 0:
raise FilterError(('compass: subprocess had error: stderr=%s, '+
'stdout=%s, returncode=%s') % (
stderr, stdout, proc.returncode))
guessed_outputfile = \
path.join(tempout, path.splitext(path.basename(source_path))[0])
f = open("%s.css" % guessed_outputfile)
try:
out.write(f.read())
finally:
f.close()
finally:
# Restore previous working dir
os.chdir(old_wd)
# Clean up the temp dir
shutil.rmtree(tempout)
| [
37811,
198,
37058,
5486,
11,
31855,
3769,
257,
3141,
1627,
7736,
326,
318,
973,
198,
220,
257,
8,
355,
257,
4542,
4226,
357,
2339,
42625,
14208,
12,
28482,
13,
9078,
8,
1804,
329,
1672,
198,
220,
220,
220,
9058,
670,
11,
4375,
20652,
284,
257,
1628,
3503,
828,
290,
198,
220,
275,
8,
460,
17632,
262,
264,
562,
2723,
3696,
656,
17391,
13,
198,
198,
3633,
4143,
1628,
12,
3106,
11,
3599,
351,
657,
13,
940,
11,
31855,
13519,
198,
18608,
2096,
33393,
1981,
3696,
11,
543,
318,
644,
356,
389,
1262,
329,
198,
320,
26908,
278,
428,
8106,
13,
8105,
1335,
306,
11,
780,
612,
389,
6409,
2428,
198,
5562,
2421,
1762,
1088,
13,
4091,
262,
3651,
287,
262,
4036,
8106,
2438,
198,
1640,
262,
1336,
1621,
319,
477,
262,
46730,
307,
423,
284,
4391,
832,
13,
198,
198,
2025,
5559,
3038,
561,
307,
284,
779,
48572,
284,
17632,
13,
46175,
6986,
198,
2860,
82,
734,
1243,
319,
1353,
286,
264,
562,
25,
317,
7684,
286,
17391,
29251,
11,
49702,
284,
48572,
11,
198,
392,
1695,
329,
1390,
13,
843,
2972,
43506,
49385,
326,
777,
29251,
198,
392,
2183,
48572,
3696,
460,
779,
13,
18626,
612,
318,
4385,
284,
307,
257,
835,
198,
1462,
17632,
257,
31855,
1628,
832,
264,
562,
11,
475,
523,
1290,
11,
314,
4398,
470,
1392,
340,
198,
1462,
670,
13,
383,
15582,
318,
4385,
284,
307,
530,
286,
25,
628,
220,
220,
220,
720,
264,
562,
532,
81,
31855,
4600,
5589,
562,
17944,
63,
45811,
198,
220,
220,
220,
720,
264,
562,
1377,
5589,
562,
45811,
198,
198,
6214,
25,
198,
220,
220,
220,
2638,
1378,
24432,
13,
13297,
13,
785,
14,
8094,
14,
5589,
562,
12,
18417,
14,
25367,
325,
62,
16663,
14,
16663,
14,
64,
35435,
7568,
10210,
17,
65,
2857,
46435,
68,
198,
220,
220,
220,
2638,
1378,
24432,
13,
13297,
13,
785,
14,
8094,
14,
5589,
562,
12,
18417,
14,
25367,
325,
62,
16663,
14,
16663,
14,
2998,
17,
17457,
23,
65,
4349,
9423,
20,
69,
22,
66,
198,
220,
220,
220,
2638,
1378,
24432,
13,
13297,
13,
785,
14,
8094,
14,
5589,
562,
12,
18417,
14,
25367,
325,
62,
16663,
14,
16663,
14,
67,
1878,
2816,
330,
6814,
48597,
3980,
67,
16,
198,
37811,
198,
198,
11748,
28686,
11,
850,
14681,
198,
6738,
28686,
1330,
3108,
198,
11748,
20218,
7753,
198,
11748,
4423,
346,
198,
198,
6738,
3992,
19668,
13,
1069,
11755,
1330,
25853,
12331,
198,
6738,
3992,
19668,
13,
24455,
1330,
25853,
11,
3038,
628,
198,
834,
439,
834,
796,
19203,
7293,
562,
22417,
3256,
8,
628,
198,
4871,
46175,
22417,
7,
22417,
2599,
198,
220,
220,
220,
37227,
3103,
24040,
4600,
7293,
562,
1279,
4023,
1378,
5589,
562,
12,
7635,
13,
2398,
15913,
63,
62,
764,
82,
562,
3696,
284,
198,
220,
220,
220,
17391,
13,
628,
220,
220,
220,
26848,
379,
1551,
2196,
657,
13,
940,
13,
628,
220,
220,
220,
1675,
17632,
257,
3210,
46175,
1628,
11,
345,
691,
761,
284,
423,
198,
220,
220,
220,
284,
17632,
534,
1388,
7559,
9612,
13,
82,
562,
15506,
11,
7559,
4798,
13,
82,
562,
15506,
290,
7559,
494,
13,
82,
562,
15506,
198,
220,
220,
220,
3696,
13,
1439,
262,
636,
8231,
326,
345,
2291,
481,
307,
12118,
416,
46175,
13,
628,
220,
220,
220,
1002,
345,
765,
284,
12082,
262,
8106,
351,
584,
17391,
16628,
11,
787,
198,
220,
220,
220,
1654,
428,
530,
4539,
717,
13,
628,
220,
220,
220,
36848,
8398,
3689,
25,
628,
220,
220,
220,
24301,
10705,
62,
33,
1268,
198,
220,
220,
220,
220,
220,
220,
220,
383,
3108,
284,
262,
46175,
13934,
13,
1002,
407,
900,
11,
262,
8106,
481,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
284,
1057,
7559,
5589,
562,
15506,
355,
611,
340,
338,
287,
262,
1080,
3108,
13,
628,
220,
220,
220,
24301,
10705,
62,
6489,
7340,
20913,
198,
220,
220,
220,
220,
220,
220,
220,
46175,
20652,
284,
779,
13,
770,
318,
7548,
284,
262,
7559,
438,
46115,
15506,
198,
220,
220,
220,
220,
220,
220,
220,
3141,
1627,
3038,
286,
262,
46175,
13,
290,
13423,
257,
11361,
1351,
198,
220,
220,
220,
220,
220,
220,
220,
2134,
286,
10888,
12782,
284,
3440,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1438,
796,
705,
5589,
562,
6,
198,
220,
220,
220,
3689,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
5589,
562,
10354,
19203,
39491,
3256,
705,
9858,
47924,
62,
33,
1268,
33809,
198,
220,
220,
220,
220,
220,
220,
220,
705,
37390,
10354,
3038,
10786,
9858,
47924,
62,
6489,
7340,
20913,
3256,
2099,
28,
4868,
8,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
825,
1280,
7,
944,
11,
503,
11,
2723,
62,
6978,
11,
12429,
46265,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7293,
562,
3058,
1595,
470,
1011,
1366,
422,
14367,
259,
11,
290,
1595,
470,
1249,
198,
220,
220,
220,
220,
220,
220,
220,
514,
22534,
262,
1255,
422,
14367,
448,
2035,
13,
628,
220,
220,
220,
220,
220,
220,
220,
4418,
11,
612,
338,
257,
7684,
286,
584,
2428,
356,
761,
284,
670,
1088,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
532,
31855,
1595,
470,
1104,
1813,
281,
1193,
713,
5072,
2393,
11,
691,
257,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
438,
25471,
12,
15908,
1,
5072,
8619,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
775,
423,
284,
366,
5162,
408,
1,
262,
29472,
326,
481,
307,
2727,
287,
326,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8619,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
532,
383,
5072,
29472,
973,
318,
1912,
319,
262,
5128,
29472,
11,
290,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2391,
7720,
286,
262,
4129,
286,
262,
366,
82,
562,
62,
15908,
1,
357,
392,
5609,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
262,
2393,
7552,
737,
1320,
318,
11,
31855,
13423,
262,
5128,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29472,
284,
1464,
307,
2641,
262,
366,
82,
562,
62,
15908,
1,
357,
4758,
26235,
284,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24457,
10677,
828,
290,
611,
428,
318,
407,
262,
1339,
11,
262,
5072,
29472,
481,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
307,
46795,
527,
680,
357,
45688,
3435,
287,
2166,
737,
4091,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3740,
1378,
12567,
13,
785,
14,
354,
17163,
381,
5714,
14,
5589,
562,
14,
37165,
14,
21288,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
775,
4259,
428,
416,
4634,
262,
1774,
1377,
82,
562,
12,
15908,
3038,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
532,
46175,
17424,
319,
4441,
257,
764,
82,
562,
12,
23870,
9483,
287,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1459,
1762,
8619,
11,
290,
5023,
262,
264,
562,
28883,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
612,
1595,
470,
1283,
284,
307,
257,
835,
284,
15560,
340,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
46513,
318,
284,
900,
262,
1762,
8619,
284,
674,
20218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8619,
11,
523,
326,
262,
12940,
9483,
481,
307,
13140,
379,
262,
886,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
20218,
448,
796,
20218,
7753,
13,
28015,
67,
29510,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5825,
1819,
3093,
1445,
284,
366,
29510,
448,
1600,
523,
764,
82,
562,
12,
23870,
481,
307,
2727,
612,
198,
220,
220,
220,
220,
220,
220,
220,
1468,
62,
16993,
796,
28686,
13,
1136,
66,
86,
646,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
354,
15908,
7,
29510,
448,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6889,
1654,
284,
779,
2593,
6978,
3419,
284,
407,
2728,
5876,
351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
31855,
6,
35010,
3108,
9041,
11,
810,
340,
655,
18533,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2723,
62,
6978,
318,
1626,
264,
562,
15908,
11,
290,
6630,
572,
262,
4129,
286,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
264,
562,
15908,
422,
262,
5128,
2393,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
562,
15908,
796,
3108,
13,
27237,
6978,
7,
6978,
13,
15908,
3672,
7,
10459,
62,
6978,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2723,
62,
6978,
796,
3108,
13,
27237,
6978,
7,
10459,
62,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
46175,
4394,
617,
49385,
588,
2939,
12,
6371,
22784,
543,
761,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1321,
546,
262,
2956,
7278,
739,
543,
2056,
3696,
481,
307,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1695,
13,
770,
318,
1327,
329,
734,
3840,
25,
3274,
11,
262,
3689,
287,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1808,
3588,
470,
4855,
319,
262,
3141,
1627,
11,
523,
356,
761,
284,
3551,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
257,
8584,
4566,
2393,
13,
34276,
11,
262,
7048,
257,
5447,
290,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4553,
29196,
329,
366,
17566,
1600,
366,
47720,
258,
1039,
1,
3503,
1539,
1223,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3992,
19668,
4206,
2147,
286,
25,
356,
836,
470,
1104,
262,
2836,
16215,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1223,
884,
29196,
13,
4362,
356,
16083,
550,
428,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
8106,
966,
477,
2099,
12,
11423,
29196,
284,
262,
6808,
2056,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
8619,
11,
356,
481,
8160,
262,
13532,
284,
2872,
428,
13,
554,
584,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2456,
11,
287,
46175,
11,
1111,
26098,
12,
9060,
7203,
9600,
14,
9288,
13,
11134,
8,
290,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2939,
12,
6371,
7203,
9600,
14,
9288,
13,
11134,
4943,
481,
1064,
262,
976,
2393,
11,
290,
7048,
340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
284,
307,
1391,
24330,
13,
34945,
92,
14,
9600,
14,
9288,
13,
11134,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2102,
11,
428,
11476,
2469,
689,
262,
4007,
286,
281,
3384,
72,
879,
588,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2939,
12,
6371,
3419,
287,
262,
717,
1295,
532,
345,
407,
1719,
284,
1327,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
262,
4067,
286,
534,
4263,
13,
1406,
257,
1184,
10506,
414,
329,
262,
2003,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1244,
307,
4375,
3689,
326,
1249,
5609,
428,
4069,
357,
3826,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
7846,
1303,
2623,
737,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
5740,
326,
318,
635,
262,
1377,
43762,
12,
19668,
3038,
11,
543,
356,
460,
470,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
780,
340,
43707,
281,
4036,
3585,
3108,
1022,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2939,
290,
262,
269,
824,
5072,
2393,
11,
262,
6846,
852,
287,
257,
8584,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
8619,
287,
674,
1339,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4566,
62,
7753,
796,
3108,
13,
22179,
7,
29510,
448,
11,
45302,
11250,
13,
26145,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
796,
1280,
7,
11250,
62,
7753,
11,
705,
86,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
13,
13564,
7203,
15931,
198,
4023,
62,
6978,
796,
36521,
82,
1,
198,
4023,
62,
17566,
62,
15908,
796,
13538,
198,
4023,
62,
47720,
258,
1039,
62,
15908,
796,
13538,
198,
4023,
62,
10331,
82,
62,
15908,
796,
13538,
198,
4023,
62,
37495,
82,
62,
15908,
796,
13538,
198,
220,
220,
220,
37227,
4064,
2116,
13,
24330,
13,
6371,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
13,
25925,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
13,
19836,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3141,
796,
685,
944,
13,
5589,
562,
393,
705,
5589,
562,
3256,
705,
5589,
576,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
13877,
287,
2116,
13,
37390,
393,
685,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3141,
13,
2302,
437,
7,
10786,
438,
46115,
3256,
13877,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3141,
13,
2302,
437,
7,
17816,
438,
82,
562,
12,
15908,
3256,
264,
562,
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,
705,
438,
25471,
12,
15908,
3256,
20218,
448,
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,
705,
438,
9060,
12,
15908,
3256,
2116,
13,
24330,
13,
34945,
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,
705,
438,
11250,
3256,
4566,
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,
705,
438,
39624,
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,
705,
438,
2865,
278,
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,
705,
438,
22915,
12,
7635,
3256,
705,
11201,
12249,
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,
2723,
62,
6978,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13834,
796,
850,
14681,
13,
47,
9654,
7,
21812,
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,
14367,
448,
28,
7266,
14681,
13,
47,
4061,
36,
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,
336,
1082,
81,
28,
7266,
14681,
13,
47,
4061,
36,
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,
1303,
7582,
25,
3306,
319,
9168,
284,
12260,
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,
1303,
43506,
3696,
11,
475,
1595,
470,
670,
319,
32639,
13,
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,
7582,
16193,
418,
13,
3672,
6624,
705,
429,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14367,
448,
11,
336,
1082,
81,
796,
13834,
13,
10709,
5344,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
31855,
2331,
284,
1464,
3551,
257,
3384,
69,
23,
13639,
30,
284,
336,
1082,
81,
11,
523,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
787,
1654,
284,
407,
2038,
655,
780,
612,
338,
1223,
612,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
13834,
13,
7783,
8189,
14512,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
25853,
12331,
7,
10786,
5589,
562,
25,
850,
14681,
550,
4049,
25,
336,
1082,
81,
28,
4,
82,
11,
705,
10,
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,
705,
19282,
448,
28,
4,
82,
11,
1441,
8189,
28,
4,
82,
11537,
4064,
357,
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,
336,
1082,
81,
11,
14367,
448,
11,
13834,
13,
7783,
8189,
4008,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25183,
62,
22915,
7753,
796,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3108,
13,
22179,
7,
29510,
448,
11,
3108,
13,
22018,
578,
742,
7,
6978,
13,
12093,
12453,
7,
10459,
62,
6978,
4008,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
796,
1280,
7203,
4,
82,
13,
25471,
1,
4064,
25183,
62,
22915,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
13,
13564,
7,
69,
13,
961,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
42019,
2180,
1762,
26672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
354,
15908,
7,
727,
62,
16993,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
5985,
510,
262,
20218,
26672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4423,
346,
13,
81,
16762,
631,
7,
29510,
448,
8,
198
] | 2.431663 | 3,373 |
import time
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
if __name__ == '__main__':
unittest.main() | [
11748,
640,
198,
11748,
555,
715,
395,
198,
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
13083,
1330,
26363,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419
] | 3.019608 | 51 |
from motor.frameworks.asyncio import pymongo_class_wrapper
from app.api.api_v2.endpoints import job
from typing import Any, List
from app.models.tool.job import JobCompositeInResponse, JobInDb, JobInRequest, JobInResponse, JobProgressResponse, JobUpdateModel
from app.models.mongo_id import ObjectIdInReq, ObjectIdInRes, BsonObjectId
from app.models.tool.builds import BuildMessageSpec
from app.models.tool.build.common import BaseBuildModel, BaseBuildModelInRequest, BaseBuildModelInResponse, BaseBuildWithToolModelInResponse, BuildType
from app.models.tool.executor import BuildExecutorCompositeInResponse, BuildExecutorDeploymentStructure, BuildExecutorInDb, BuildExecutorInRequest, BuildExecutorInResponse, ExecutionStatus
from ..db.mongodb import AsyncIOMotorClient
from ..core.config import (
database_name,
job_collection_name as coll_name,
tools_collection_name,
build_collection_name,
build_executor_collection_name
)
# JobInResponse
# JobInResponse
# JobInResponse
| [
198,
6738,
5584,
13,
19298,
19653,
13,
292,
13361,
952,
1330,
279,
4948,
25162,
62,
4871,
62,
48553,
198,
6738,
598,
13,
15042,
13,
15042,
62,
85,
17,
13,
437,
13033,
1330,
1693,
198,
6738,
19720,
1330,
4377,
11,
7343,
198,
6738,
598,
13,
27530,
13,
25981,
13,
21858,
1330,
15768,
5377,
1930,
578,
818,
31077,
11,
15768,
818,
43832,
11,
15768,
818,
18453,
11,
15768,
818,
31077,
11,
15768,
32577,
31077,
11,
15768,
10260,
17633,
628,
198,
6738,
598,
13,
27530,
13,
76,
25162,
62,
312,
1330,
9515,
7390,
818,
3041,
80,
11,
9515,
7390,
818,
4965,
11,
347,
1559,
10267,
7390,
198,
6738,
598,
13,
27530,
13,
25981,
13,
11249,
82,
1330,
10934,
12837,
22882,
198,
6738,
598,
13,
27530,
13,
25981,
13,
11249,
13,
11321,
1330,
7308,
15580,
17633,
11,
7308,
15580,
17633,
818,
18453,
11,
7308,
15580,
17633,
818,
31077,
11,
7308,
15580,
3152,
25391,
17633,
818,
31077,
11,
10934,
6030,
198,
198,
6738,
598,
13,
27530,
13,
25981,
13,
18558,
38409,
1330,
10934,
23002,
38409,
5377,
1930,
578,
818,
31077,
11,
10934,
23002,
38409,
49322,
434,
1273,
5620,
11,
10934,
23002,
38409,
818,
43832,
11,
10934,
23002,
38409,
818,
18453,
11,
10934,
23002,
38409,
818,
31077,
11,
37497,
19580,
628,
198,
6738,
11485,
9945,
13,
31059,
375,
65,
1330,
1081,
13361,
40,
2662,
20965,
11792,
198,
6738,
11485,
7295,
13,
11250,
1330,
357,
198,
220,
220,
220,
6831,
62,
3672,
11,
198,
220,
220,
220,
1693,
62,
43681,
62,
3672,
355,
2927,
62,
3672,
11,
198,
220,
220,
220,
4899,
62,
43681,
62,
3672,
11,
198,
220,
220,
220,
1382,
62,
43681,
62,
3672,
11,
198,
220,
220,
220,
1382,
62,
18558,
38409,
62,
43681,
62,
3672,
198,
198,
8,
628,
628,
198,
2,
15768,
818,
31077,
628,
198,
2,
15768,
818,
31077,
628,
198,
2,
15768,
818,
31077,
628
] | 3.314754 | 305 |
# Generated by Django 3.1.5 on 2021-02-08 11:06
from django.db import migrations, models
import django.db.models.deletion
| [
2,
2980,
515,
416,
37770,
513,
13,
16,
13,
20,
319,
33448,
12,
2999,
12,
2919,
1367,
25,
3312,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
628
] | 2.818182 | 44 |
from shared.const import APPDIR, TMPDIR, TRACEDIR, PUBDIR, BINDIR, CROSSGENDIR
from performance.common import remove_directory | [
6738,
4888,
13,
9979,
1330,
3486,
5760,
4663,
11,
21232,
5760,
4663,
11,
7579,
2246,
1961,
4663,
11,
350,
10526,
34720,
11,
347,
12115,
4663,
11,
8740,
18420,
38,
10619,
4663,
198,
6738,
2854,
13,
11321,
1330,
4781,
62,
34945
] | 3.15 | 40 |
import unittest
import numpy as np
import chainer
from chainer import optimizer_hooks
from chainer import optimizers
from chainer import testing
_backend_params = [
# NumPy
{},
{'use_ideep': 'always'},
# CuPy
{'use_cuda': True, 'cuda_device': 0},
{'use_cuda': True, 'cuda_device': 1},
# ChainerX
{'use_chainerx': True, 'chainerx_device': 'native:0'},
{'use_chainerx': True, 'chainerx_device': 'cuda:0'},
{'use_chainerx': True, 'chainerx_device': 'cuda:1'},
]
@testing.backend.inject_backend_tests(None, _backend_params)
@testing.backend.inject_backend_tests(None, _backend_params)
@testing.backend.inject_backend_tests(None, _backend_params)
testing.run_module(__name__, __file__)
| [
11748,
555,
715,
395,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
11748,
6333,
263,
198,
6738,
6333,
263,
1330,
6436,
7509,
62,
25480,
82,
198,
6738,
6333,
263,
1330,
6436,
11341,
198,
6738,
6333,
263,
1330,
4856,
628,
198,
62,
1891,
437,
62,
37266,
796,
685,
198,
220,
220,
220,
1303,
31835,
20519,
198,
220,
220,
220,
1391,
5512,
198,
220,
220,
220,
1391,
6,
1904,
62,
485,
538,
10354,
705,
33770,
6,
5512,
198,
220,
220,
220,
1303,
14496,
20519,
198,
220,
220,
220,
1391,
6,
1904,
62,
66,
15339,
10354,
6407,
11,
705,
66,
15339,
62,
25202,
10354,
657,
5512,
198,
220,
220,
220,
1391,
6,
1904,
62,
66,
15339,
10354,
6407,
11,
705,
66,
15339,
62,
25202,
10354,
352,
5512,
198,
220,
220,
220,
1303,
609,
10613,
55,
198,
220,
220,
220,
1391,
6,
1904,
62,
7983,
263,
87,
10354,
6407,
11,
705,
7983,
263,
87,
62,
25202,
10354,
705,
30191,
25,
15,
6,
5512,
198,
220,
220,
220,
1391,
6,
1904,
62,
7983,
263,
87,
10354,
6407,
11,
705,
7983,
263,
87,
62,
25202,
10354,
705,
66,
15339,
25,
15,
6,
5512,
198,
220,
220,
220,
1391,
6,
1904,
62,
7983,
263,
87,
10354,
6407,
11,
705,
7983,
263,
87,
62,
25202,
10354,
705,
66,
15339,
25,
16,
6,
5512,
198,
60,
628,
198,
198,
31,
33407,
13,
1891,
437,
13,
259,
752,
62,
1891,
437,
62,
41989,
7,
14202,
11,
4808,
1891,
437,
62,
37266,
8,
198,
31,
33407,
13,
1891,
437,
13,
259,
752,
62,
1891,
437,
62,
41989,
7,
14202,
11,
4808,
1891,
437,
62,
37266,
8,
198,
31,
33407,
13,
1891,
437,
13,
259,
752,
62,
1891,
437,
62,
41989,
7,
14202,
11,
4808,
1891,
437,
62,
37266,
8,
628,
198,
33407,
13,
5143,
62,
21412,
7,
834,
3672,
834,
11,
11593,
7753,
834,
8,
198
] | 2.385621 | 306 |
from restaurants.api.views import RestaurantViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'', RestaurantViewSet, basename='restaurants')
urlpatterns = router.urls
# from django.urls import path
# from .views import ( RestaurantListView, RestaurantDetailView,
# RestaurantCreateView, RestaurantUpdateView, RestaurantDeleteView )
# urlpatterns = [
# path('', RestaurantListView.as_view()),
# path('create/', RestaurantCreateView.as_view()),
# path('<pk>', RestaurantDetailView.as_view()),
# path('<pk>/update/', RestaurantUpdateView.as_view()),
# path('<pk>/delete/', RestaurantDeleteView.as_view()),
# ] | [
6738,
10808,
13,
15042,
13,
33571,
1330,
26078,
7680,
7248,
198,
6738,
1334,
62,
30604,
13,
472,
1010,
1330,
15161,
49,
39605,
198,
198,
472,
353,
796,
15161,
49,
39605,
3419,
198,
472,
353,
13,
30238,
7,
81,
6,
3256,
26078,
7680,
7248,
11,
1615,
12453,
11639,
2118,
2899,
1187,
11537,
198,
6371,
33279,
82,
796,
20264,
13,
6371,
82,
628,
198,
2,
422,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
2,
422,
764,
33571,
1330,
357,
26078,
8053,
7680,
11,
26078,
11242,
603,
7680,
11,
220,
198,
2,
26078,
16447,
7680,
11,
26078,
10260,
7680,
11,
26078,
38727,
7680,
1267,
198,
198,
2,
19016,
33279,
82,
796,
685,
198,
2,
220,
220,
220,
220,
3108,
10786,
3256,
26078,
8053,
7680,
13,
292,
62,
1177,
3419,
828,
198,
2,
220,
220,
220,
220,
3108,
10786,
17953,
14,
3256,
26078,
16447,
7680,
13,
292,
62,
1177,
3419,
828,
198,
2,
220,
220,
220,
220,
3108,
10786,
27,
79,
74,
29,
3256,
26078,
11242,
603,
7680,
13,
292,
62,
1177,
3419,
828,
198,
2,
220,
220,
220,
220,
3108,
10786,
27,
79,
74,
29,
14,
19119,
14,
3256,
26078,
10260,
7680,
13,
292,
62,
1177,
3419,
828,
198,
2,
220,
220,
220,
220,
3108,
10786,
27,
79,
74,
29,
14,
33678,
14,
3256,
26078,
38727,
7680,
13,
292,
62,
1177,
3419,
828,
198,
2,
2361
] | 3.035714 | 224 |
import socket
import sys
__author__ = 'Gus'
HOST = ''
PORT = 8889
p = 0
e = 0
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print('--Socket created--')
try:
s.bind((HOST, PORT))
except socket.error as msg:
print('Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1])
sys.exit()
print('Bound')
s.listen(10)
print('Listening')
conn, addr = s.accept()
print('Connection get {}'.format(addr))
while 1:
if p > 0:
conn, addr = s.accept()
if e == 0:
print('Connection get {}'.format(addr))
try:
string = conn.recv(1024).decode("UTF-8")
e += 1
print(string)
except:
try:
try:
while 1:
string = conn.recv(4096).decode()
print(string)
except:
print('And unknown error occurred, lost client?')
pass
except ConnectionResetError:
print('Connection Reset')
e = 0
p = 0
string = ''
pass
conn.close()
p += 1
| [
11748,
17802,
198,
11748,
25064,
198,
198,
834,
9800,
834,
796,
705,
38,
385,
6,
198,
198,
39,
10892,
796,
10148,
198,
15490,
796,
807,
39121,
198,
79,
796,
657,
198,
68,
796,
657,
198,
82,
796,
17802,
13,
44971,
7,
44971,
13,
8579,
62,
1268,
2767,
11,
17802,
13,
50,
11290,
62,
2257,
32235,
8,
198,
4798,
10786,
438,
39105,
2727,
438,
11537,
198,
198,
28311,
25,
198,
220,
220,
220,
264,
13,
21653,
19510,
39,
10892,
11,
350,
9863,
4008,
198,
16341,
17802,
13,
18224,
355,
31456,
25,
198,
220,
220,
220,
3601,
10786,
36180,
4054,
13,
13047,
6127,
1058,
705,
1343,
965,
7,
19662,
58,
15,
12962,
1343,
705,
16000,
705,
1343,
31456,
58,
16,
12962,
198,
220,
220,
220,
25064,
13,
37023,
3419,
198,
198,
4798,
10786,
49646,
11537,
198,
198,
82,
13,
4868,
268,
7,
940,
8,
198,
4798,
10786,
8053,
3101,
11537,
198,
37043,
11,
37817,
796,
264,
13,
13635,
3419,
198,
4798,
10786,
32048,
651,
23884,
4458,
18982,
7,
29851,
4008,
198,
4514,
352,
25,
198,
220,
220,
220,
611,
279,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
48260,
11,
37817,
796,
264,
13,
13635,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
611,
304,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
32048,
651,
23884,
4458,
18982,
7,
29851,
4008,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4731,
796,
48260,
13,
8344,
85,
7,
35500,
737,
12501,
1098,
7203,
48504,
12,
23,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
304,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
8841,
8,
198,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4731,
796,
48260,
13,
8344,
85,
7,
1821,
4846,
737,
12501,
1098,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
8841,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
1870,
6439,
4049,
5091,
11,
2626,
5456,
8348,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1208,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
26923,
4965,
316,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
32048,
30027,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4731,
796,
10148,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1208,
198,
220,
220,
220,
48260,
13,
19836,
3419,
198,
220,
220,
220,
279,
15853,
352,
628
] | 1.967509 | 554 |
# encoding: utf-8
# author: BrikerMan
# contact: [email protected]
# blog: https://eliyar.biz
# file: base_processor.py
# time: 2019-05-21 11:27
import collections
import logging
import operator
from typing import List, Optional, Union, Dict, Any
import numpy as np
from tensorflow.python.keras.preprocessing.sequence import pad_sequences
from kashgari import utils
class BaseProcessor(object):
"""
Corpus Pre Processor class
"""
def _build_token_dict(self, corpus: List[List[str]], min_count: int = 3):
"""
Build token index dictionary using corpus
Args:
corpus: List of tokenized sentences, like ``[['I', 'love', 'tf'], ...]``
min_count:
"""
token2idx = {
self.token_pad: 0,
self.token_unk: 1,
self.token_bos: 2,
self.token_eos: 3
}
token2count = {}
for sentence in corpus:
for token in sentence:
count = token2count.get(token, 0)
token2count[token] = count + 1
self.token2count = token2count
# 按照词频降序排序
sorted_token2count = sorted(token2count.items(),
key=operator.itemgetter(1),
reverse=True)
token2count = collections.OrderedDict(sorted_token2count)
for token, token_count in token2count.items():
if token not in token2idx and token_count >= min_count:
token2idx[token] = len(token2idx)
self.token2idx = token2idx
self.idx2token = dict([(value, key)
for key, value in self.token2idx.items()])
logging.debug(f"build token2idx dict finished, contains {len(self.token2idx)} tokens.")
self.dataset_info['token_count'] = len(self.token2idx)
if __name__ == "__main__":
print("Hello world")
| [
2,
21004,
25,
3384,
69,
12,
23,
198,
198,
2,
1772,
25,
25866,
6122,
5124,
198,
2,
2800,
25,
1288,
7745,
283,
24,
1558,
31,
14816,
13,
785,
198,
2,
4130,
25,
3740,
1378,
417,
7745,
283,
13,
42189,
198,
198,
2,
2393,
25,
2779,
62,
41341,
13,
9078,
198,
2,
640,
25,
13130,
12,
2713,
12,
2481,
1367,
25,
1983,
198,
198,
11748,
17268,
198,
11748,
18931,
198,
11748,
10088,
198,
6738,
19720,
1330,
7343,
11,
32233,
11,
4479,
11,
360,
713,
11,
4377,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
11192,
273,
11125,
13,
29412,
13,
6122,
292,
13,
3866,
36948,
13,
43167,
1330,
14841,
62,
3107,
3007,
198,
198,
6738,
479,
1077,
70,
2743,
1330,
3384,
4487,
628,
198,
4871,
7308,
18709,
273,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
44874,
3771,
32893,
1398,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
4808,
11249,
62,
30001,
62,
11600,
7,
944,
11,
35789,
25,
7343,
58,
8053,
58,
2536,
60,
4357,
949,
62,
9127,
25,
493,
796,
513,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10934,
11241,
6376,
22155,
1262,
35789,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
35789,
25,
7343,
286,
11241,
1143,
13439,
11,
588,
7559,
58,
17816,
40,
3256,
705,
23205,
3256,
705,
27110,
6,
4357,
2644,
60,
15506,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
949,
62,
9127,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
17,
312,
87,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30001,
62,
15636,
25,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30001,
62,
2954,
25,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30001,
62,
39565,
25,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30001,
62,
68,
418,
25,
513,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
220,
220,
220,
220,
220,
220,
220,
11241,
17,
9127,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
329,
6827,
287,
35789,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
11241,
287,
6827,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
796,
11241,
17,
9127,
13,
1136,
7,
30001,
11,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11241,
17,
9127,
58,
30001,
60,
796,
954,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30001,
17,
9127,
796,
11241,
17,
9127,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
10545,
234,
231,
163,
227,
100,
46237,
235,
165,
95,
239,
165,
247,
235,
41753,
237,
162,
236,
240,
41753,
237,
198,
220,
220,
220,
220,
220,
220,
220,
23243,
62,
30001,
17,
9127,
796,
23243,
7,
30001,
17,
9127,
13,
23814,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1994,
28,
46616,
13,
9186,
1136,
353,
7,
16,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9575,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
17,
9127,
796,
17268,
13,
35422,
1068,
35,
713,
7,
82,
9741,
62,
30001,
17,
9127,
8,
628,
220,
220,
220,
220,
220,
220,
220,
329,
11241,
11,
11241,
62,
9127,
287,
11241,
17,
9127,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
407,
287,
11241,
17,
312,
87,
290,
11241,
62,
9127,
18189,
949,
62,
9127,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11241,
17,
312,
87,
58,
30001,
60,
796,
18896,
7,
30001,
17,
312,
87,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30001,
17,
312,
87,
796,
11241,
17,
312,
87,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
312,
87,
17,
30001,
796,
8633,
26933,
7,
8367,
11,
1994,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1994,
11,
1988,
287,
2116,
13,
30001,
17,
312,
87,
13,
23814,
3419,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
24442,
7,
69,
1,
11249,
11241,
17,
312,
87,
8633,
5201,
11,
4909,
1391,
11925,
7,
944,
13,
30001,
17,
312,
87,
38165,
16326,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
19608,
292,
316,
62,
10951,
17816,
30001,
62,
9127,
20520,
796,
18896,
7,
944,
13,
30001,
17,
312,
87,
8,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
3601,
7203,
15496,
995,
4943,
198
] | 2.095499 | 911 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.