content
stringlengths 1
1.04M
| input_ids
sequencelengths 1
774k
| ratio_char_token
float64 0.38
22.9
| token_count
int64 1
774k
|
---|---|---|---|
import re
import struct
from typing import Any, BinaryIO, Dict, NamedTuple, Optional, Sequence, Tuple
from .util import music, tilesets, load_tileset, spritesets, load_spriteset, PokeImportError
from .sound import MinLibSound
from .encoders import encode_tiles
| [
11748,
302,
198,
11748,
2878,
198,
6738,
19720,
1330,
4377,
11,
45755,
9399,
11,
360,
713,
11,
34441,
51,
29291,
11,
32233,
11,
45835,
11,
309,
29291,
198,
198,
6738,
764,
22602,
1330,
2647,
11,
19867,
1039,
11,
3440,
62,
83,
2915,
316,
11,
42866,
1039,
11,
3440,
62,
2777,
23156,
316,
11,
41163,
20939,
12331,
198,
6738,
764,
23661,
1330,
1855,
25835,
21369,
198,
6738,
764,
12685,
375,
364,
1330,
37773,
62,
83,
2915,
628,
628,
628,
628,
198
] | 3.375 | 80 |
# This is an example program showing different methods of controlling motors, servos, and Neopixels.
# It works with a Rock Candy or PiHut PS3 controller.
# The left stick controls the speed and direction of both motors - push up to go forwards, down for backwards and left or right to steer.
# The right stick directly controls two servo motors connected to GPIO pins 21 and 22.
# The R1 button starts or stops turbo mode (the robot goes faster!) .
# The L1 and L2 buttons move a servo connected to GPIO 22 to two pre-set positions.
# The Square button starts or stops a servo connected to GPIO 20 slowly sweeping left to right. This uses multiprocessing to run at the same time as the main program loop.
# The Triangle, Circle, and X buttons start and stop different Neopixels sequences - also with multiprocessing.
# Author: Neil Lambeth. [email protected] @NeilRedRobotics
from __future__ import print_function # Make print work with python 2 & 3
from evdev import InputDevice, ecodes
import redboard
import multiprocessing
import time
try:
import neopixels # Neopixels need to be run with 'sudo', just a reminder!
except RuntimeError:
print ('')
print ("Remember to use 'sudo' if you're using neopixels!")
print ('')
exit()
dev = InputDevice('/dev/input/event0')
#print(dev)
device = str(dev).find('Rock Candy') # Look for a Rock Candy or PiHut controller
if device != -1:
print ('Controller: Rock Candy PS3 Gamepad')
controller = 1
else:
print ('Controller: PiHut PS3 Gamepad')
controller = 2
# Button mapping for different controllers
if controller == 1: # Rock Candy
triangle, x, square, circle = 307, 305, 304, 306
R1, R2, R3 = 309, 311, 315
L1, L2, L3 = 308, 310, 314
select, start, home = 312, 313, 316
if controller == 2: # PiHut
triangle, x, square, circle = 308, 304, 307, 305
R1, R2, R3 = 311, 313, 318
L1, L2, L3 = 310, 312, 317
select, start, home = 314, 315, 316
# Set up variables
RX = 0
LX = 0
RY = 0
RY = 0
LeftY = 0
LeftX = 0
LeftX_R = 0
LeftX_L = 0
Leftmotor = 0
Rightmotor = 0
LM_OLD = 0
RM_OLD = 0
turbo = False
invertX = False
triangleToggle = False
xToggle = False
circleToggle = False
squareToggle = False
# Function to use with multiprocessing to sweep a servo slowly left and right
# without interrupting the normal program flow
# Set up neopixel processes - neopixel code is in ~/RedBoard/neopixels.py
p1 = multiprocessing.Process(target = neopixels.knightRider)
p1.start() # Start the neopixel display when the program starts
triangleToggle = True
p2 = multiprocessing.Process(target = neopixels.headLights)
p3 = multiprocessing.Process(target = neopixels.demo)
p4 = multiprocessing.Process(target = servoSlowSweep)
# Read gamepad buttons-----------------------------------------------------------
for event in dev.read_loop():
#print(event) # Uncomment to show all button data
if event.type == ecodes.EV_KEY:
#print(event.code) # Uncomment to show each keycode
# Button pressed code
if event.value == 1:
if event.code == triangle and triangleToggle == False: # Toggles the button press - one press for on - one press for off.
triangleToggle = True
print ('triangle on')
# Start and stop the neopixel processes - it's important to only run one neopixel process at any one time. So check and stop other processes if they are running.
if p1.is_alive() == False: # Make sure the process isn't already running
if p2.is_alive() == True: # Kill the other process if it's running
p2.terminate()
if p3.is_alive() == True: # Kill the other process if it's running
p3.terminate()
p1 = multiprocessing.Process(target = neopixels.knightRider)
p1.start() # Start the process
elif event.code == triangle and triangleToggle == True:
triangleToggle = False
print ('triangle off')
p1.terminate()
neopixels.clear()
elif event.code == x and xToggle == False:
xToggle = True
print ('X on')
if p2.is_alive() == False: # Make sure the process isn't already running
if p1.is_alive() == True: # Kill the other process if it's running
p1.terminate()
if p3.is_alive() == True: # Kill the other process if it's running
p3.terminate()
p2 = multiprocessing.Process(target = neopixels.headLights)
p2.start() # Start the process
elif event.code == x and xToggle == True:
xToggle = False
print ('x off')
p2.terminate()
neopixels.clear()
elif event.code == circle and circleToggle == False:
circleToggle = True
print ('Circle on')
if p3.is_alive() == False: # Make sure the process isn't already running
if p1.is_alive() == True: # Kill the other process if it's running
p1.terminate()
if p2.is_alive() == True: # Kill the other process if it's running
p2.terminate()
p3 = multiprocessing.Process(target = neopixels.demo)
p3.start() # Start the process
elif event.code == circle and circleToggle == True:
circleToggle = False
print ('Circle off')
p3.terminate()
neopixels.clear()
elif event.code == square and squareToggle == False:
squareToggle = True
print ('Square on')
if p4.is_alive() == False: # Make sure the process isn't already running
p4 = multiprocessing.Process(target = servoSlowSweep)
p4.start() # Start the process
elif event.code == square and squareToggle == True:
squareToggle = False
print ('Square off')
p4.terminate()
elif event.code == R1:
print ('R1 - Turbo On')
turbo = True
elif event.code == R2:
print ('R2')
elif event.code == R3:
print ('R3')
elif event.code == L1:
print ('L1')
redboard.servo22(80) # Send the positon to the servo
elif event.code == L2:
print ('L2')
redboard.servo22(-80) # Send the positon to the servo
elif event.code == L3:
print ('L3')
elif event.code == select and invertX == False:
print ('Invert X')
invertX = True
elif event.code == select and invertX == True:
print ('Normal X')
invertX = False
elif event.code == start:
print ('Start')
elif event.code == home:
print ('Home')
# Button Release Code------------------------------------------------
if event.value == 0: # Button released
if event.code == R1: # Turbo Off
print ('R1 - Turbo Off')
turbo = False
elif event.code == R2:
print ('R2')
elif event.code == L1 or event.code == L2: # Servos Centre
print ('Servo Centre')
redboard.servo22(0)
# Analogue Sticks and Dpad---------------------------------------------
if event.type == ecodes.EV_ABS:
print('')
print('---------------------------------')
# Dpad
if event.code == 16:
if event.value == -1:
print ('Dpad LEFT')
if event.value == 1:
print ('Dpad RIGHT')
if event.code == 17:
if event.value == -1:
print ('Dpad UP')
if event.value == 1:
print ('Dpad DOWN')
# Right analogue stick servo controls
elif event.code == 5: # Right analogue Vertical stick
RY = event.value
#print (RY)
S21 = redboard.mapServo(RY) # Scale the value from the
# joystick to work with the servo
redboard.servo21_P(S21) # Send the positon to the servo
elif event.code == 2: # Right analogue Horizontal stick
RX = event.value
#print (RX)
S22 = redboard.mapServo(RX) # Scale the value from the
# joystick to work with the servo
redboard.servo22_P(S22) # Send the positon to the servo
# Left analogue stick motor controls
if event.code == 1: # Left analogue Vertical stick
# The analogue stick gives a value between 0-255
# Convert the value to 0-127 for forwards
# and 0- -127 for backwards
LY = event.value
if LY < 128: # Forwards
LeftY = 127 - LY
#print('LY =',LY)
#print('LeftY = ',LeftY)
elif LY >= 128: # Backwards
LeftY = LY - 128
LeftY = -LeftY # Make negative
#print('LY =',LY)
#print('LeftY = ',LeftY)
elif event.code == 0: # Left analogue Horizontal stick
# The analogue stick gives a value between 0-255
# Convert the value to 0-127 for left
# and 0-127 for right
LX = event.value
if LX < 128: # Left
LeftX_L = 127 - LX
#print('LX =',LX)
#print('LeftX_Left = ',LeftX_L)
if LX > 128: # Right
LeftX_R = LX - 128
#print('LX = ',LX)
#print('LeftX_Right = ',LeftX_R)
if LX == 128: # Make sure both values are zero if stick is in the centre
LeftX_L = 0
LeftX_R = 0
# Prepare the values to send to the motors
if LeftY == 0: #Turn on the spot if not going forwards or backwards
if LX <= 128: # Turn Left
Leftmotor = -LeftX_L # Reverse motor to turn on the spot
Rightmotor = LeftX_L
elif LX >= 127: # Turn Right
Leftmotor = LeftX_R
Rightmotor = -LeftX_R # Reverse motor to turn on the spot
elif LY <= 128: # Forwards
print ('Forwards')
Leftmotor = LeftY - LeftX_L # Mix steering values
if Leftmotor <1: # Stop motor going backwards
Leftmotor = 0;
Rightmotor = LeftY - LeftX_R # Mix steering values
if Rightmotor <1: # Stop motor going backwards
Rightmotor = 0;
elif LY >= 127: # Backwards
print('Backwards')
Leftmotor = LeftY + LeftX_L # Mix steering values
if Leftmotor >-1: # Stop motor going forwards
Leftmotor = 0;
Rightmotor = LeftY + LeftX_R # Mix steering values
if Rightmotor >-1: # Stop motor going forwards
Rightmotor = 0;
if turbo == True: # Double speed for turbo
LM = Leftmotor * 2
RM = Rightmotor * 2
else: # Normal speed
LM = Leftmotor
RM = Rightmotor
if LM != LM_OLD or RM != RM_OLD: # Only print motor speeds if they have changed
print ('Left motor =',LM)
print ('Right motor =',RM)
LM_OLD = LM
RM_OLD = RM
# Set motor speed and direction
if invertX == True: # Reverse steering controls
#print('Reverse steering')
redboard.M2_8bit(RM)
redboard.M1_8bit(LM)
else: # Normal steering controls
#print ('Normal steering')
redboard.M2_8bit(LM)
redboard.M1_8bit(RM)
| [
2,
770,
318,
281,
1672,
1430,
4478,
1180,
5050,
286,
12755,
24699,
11,
1113,
418,
11,
290,
3169,
404,
14810,
13,
198,
2,
632,
2499,
351,
257,
4631,
24680,
393,
13993,
39,
315,
6599,
18,
10444,
13,
198,
2,
383,
1364,
4859,
6973,
262,
2866,
290,
4571,
286,
1111,
24699,
532,
4574,
510,
284,
467,
22052,
11,
866,
329,
16196,
290,
1364,
393,
826,
284,
27401,
13,
198,
2,
383,
826,
4859,
3264,
6973,
734,
1113,
78,
24699,
5884,
284,
50143,
20567,
2310,
290,
2534,
13,
220,
198,
2,
383,
371,
16,
4936,
4940,
393,
9911,
29292,
4235,
357,
1169,
9379,
2925,
5443,
8133,
764,
220,
198,
2,
383,
406,
16,
290,
406,
17,
12163,
1445,
257,
1113,
78,
5884,
284,
50143,
2534,
284,
734,
662,
12,
2617,
6116,
13,
198,
2,
383,
9276,
4936,
4940,
393,
9911,
257,
1113,
78,
5884,
284,
50143,
1160,
6364,
18404,
1364,
284,
826,
13,
770,
3544,
18540,
305,
919,
278,
284,
1057,
379,
262,
976,
640,
355,
262,
1388,
1430,
9052,
13,
220,
220,
198,
2,
383,
33233,
11,
16291,
11,
290,
1395,
12163,
923,
290,
2245,
1180,
3169,
404,
14810,
16311,
532,
635,
351,
18540,
305,
919,
278,
13,
628,
198,
2,
6434,
25,
15929,
21114,
2788,
13,
497,
346,
31,
445,
305,
13645,
873,
13,
1073,
13,
2724,
2488,
29354,
7738,
14350,
23891,
628,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
220,
1303,
6889,
3601,
670,
351,
21015,
362,
1222,
513,
198,
6738,
819,
7959,
1330,
23412,
24728,
11,
9940,
4147,
198,
11748,
2266,
3526,
198,
11748,
18540,
305,
919,
278,
198,
11748,
640,
198,
198,
28311,
25,
220,
198,
220,
220,
220,
1330,
497,
404,
14810,
1303,
220,
3169,
404,
14810,
761,
284,
307,
1057,
351,
705,
24032,
3256,
655,
257,
15438,
0,
198,
16341,
43160,
12331,
25,
198,
220,
220,
220,
3601,
357,
7061,
8,
198,
220,
220,
220,
3601,
5855,
16676,
284,
779,
705,
24032,
6,
611,
345,
821,
1262,
497,
404,
14810,
2474,
8,
198,
220,
220,
220,
3601,
357,
7061,
8,
198,
220,
220,
220,
8420,
3419,
628,
220,
220,
220,
220,
198,
7959,
796,
23412,
24728,
10786,
14,
7959,
14,
15414,
14,
15596,
15,
11537,
198,
2,
4798,
7,
7959,
8,
198,
198,
25202,
796,
965,
7,
7959,
737,
19796,
10786,
19665,
24680,
11537,
220,
1303,
6803,
329,
257,
4631,
24680,
393,
13993,
39,
315,
10444,
198,
361,
3335,
14512,
532,
16,
25,
198,
220,
220,
220,
3601,
19203,
22130,
25,
4631,
24680,
6599,
18,
3776,
15636,
11537,
198,
220,
220,
220,
10444,
796,
352,
198,
17772,
25,
198,
220,
220,
220,
3601,
19203,
22130,
25,
13993,
39,
315,
6599,
18,
3776,
15636,
11537,
198,
220,
220,
220,
10444,
796,
362,
628,
198,
2,
20969,
16855,
329,
1180,
20624,
198,
361,
10444,
6624,
352,
25,
220,
1303,
4631,
24680,
198,
220,
220,
220,
22950,
11,
2124,
11,
6616,
11,
9197,
796,
38369,
11,
32747,
11,
31672,
11,
37255,
198,
220,
220,
220,
371,
16,
11,
371,
17,
11,
371,
18,
796,
40286,
11,
35592,
11,
32647,
198,
220,
220,
220,
406,
16,
11,
406,
17,
11,
406,
18,
796,
35617,
11,
28947,
11,
34085,
198,
220,
220,
220,
2922,
11,
923,
11,
1363,
796,
34465,
11,
35897,
11,
34131,
220,
628,
198,
361,
10444,
6624,
362,
25,
220,
1303,
13993,
39,
315,
198,
220,
220,
220,
22950,
11,
2124,
11,
6616,
11,
9197,
796,
35617,
11,
31672,
11,
38369,
11,
32747,
198,
220,
220,
220,
371,
16,
11,
371,
17,
11,
371,
18,
796,
35592,
11,
35897,
11,
39320,
198,
220,
220,
220,
406,
16,
11,
406,
17,
11,
406,
18,
796,
28947,
11,
34465,
11,
37563,
198,
220,
220,
220,
2922,
11,
923,
11,
1363,
796,
34085,
11,
32647,
11,
34131,
220,
628,
198,
2,
5345,
510,
9633,
198,
49,
55,
796,
657,
198,
43,
55,
796,
657,
198,
18276,
796,
657,
198,
18276,
796,
657,
198,
18819,
56,
796,
657,
198,
18819,
55,
796,
657,
198,
18819,
55,
62,
49,
796,
657,
198,
18819,
55,
62,
43,
796,
657,
198,
18819,
76,
20965,
796,
657,
198,
11028,
76,
20965,
796,
657,
198,
31288,
62,
15173,
796,
657,
198,
29138,
62,
15173,
796,
657,
198,
36590,
2127,
796,
10352,
198,
259,
1851,
55,
796,
10352,
198,
198,
28461,
9248,
51,
20258,
796,
10352,
198,
87,
51,
20258,
796,
10352,
198,
45597,
51,
20258,
796,
10352,
198,
23415,
51,
20258,
796,
10352,
628,
198,
2,
220,
15553,
284,
779,
351,
18540,
305,
919,
278,
284,
16085,
257,
1113,
78,
6364,
1364,
290,
826,
220,
198,
2,
220,
1231,
11313,
278,
262,
3487,
1430,
5202,
220,
628,
198,
2,
5345,
510,
497,
404,
7168,
7767,
532,
497,
404,
7168,
2438,
318,
287,
47795,
7738,
29828,
14,
710,
404,
14810,
13,
9078,
220,
220,
220,
198,
79,
16,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
497,
404,
14810,
13,
74,
3847,
49,
1304,
8,
198,
79,
16,
13,
9688,
3419,
1303,
220,
7253,
262,
497,
404,
7168,
3359,
618,
262,
1430,
4940,
198,
28461,
9248,
51,
20258,
796,
6407,
220,
198,
198,
79,
17,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
497,
404,
14810,
13,
2256,
43,
2337,
8,
198,
79,
18,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
497,
404,
14810,
13,
9536,
78,
8,
198,
79,
19,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
1113,
34049,
9319,
40783,
538,
8,
628,
198,
2,
4149,
983,
15636,
12163,
43801,
6329,
198,
1640,
1785,
287,
1614,
13,
961,
62,
26268,
33529,
198,
220,
220,
220,
1303,
4798,
7,
15596,
8,
220,
1303,
791,
23893,
284,
905,
477,
4936,
1366,
198,
220,
220,
220,
220,
198,
220,
220,
220,
611,
1785,
13,
4906,
6624,
9940,
4147,
13,
20114,
62,
20373,
25,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
7,
15596,
13,
8189,
8,
220,
1303,
791,
23893,
284,
905,
1123,
1994,
8189,
198,
198,
2,
20969,
12070,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8367,
6624,
352,
25,
220,
220,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8189,
6624,
22950,
290,
22950,
51,
20258,
6624,
10352,
25,
1303,
309,
48549,
262,
4936,
1803,
532,
530,
1803,
329,
319,
532,
530,
1803,
329,
572,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22950,
51,
20258,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
28461,
9248,
319,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
2,
7253,
290,
2245,
262,
497,
404,
7168,
7767,
532,
340,
338,
1593,
284,
691,
1057,
530,
497,
404,
7168,
1429,
379,
597,
530,
640,
13,
1406,
2198,
290,
2245,
584,
7767,
611,
484,
389,
2491,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
16,
13,
271,
62,
282,
425,
3419,
6624,
10352,
25,
220,
1303,
6889,
1654,
262,
1429,
2125,
470,
1541,
2491,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
17,
13,
271,
62,
282,
425,
3419,
6624,
6407,
25,
1303,
12265,
262,
584,
1429,
611,
340,
338,
2491,
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,
279,
17,
13,
23705,
378,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
18,
13,
271,
62,
282,
425,
3419,
6624,
6407,
25,
1303,
12265,
262,
584,
1429,
611,
340,
338,
2491,
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,
279,
18,
13,
23705,
378,
3419,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
16,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
497,
404,
14810,
13,
74,
3847,
49,
1304,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
16,
13,
9688,
3419,
220,
1303,
7253,
262,
1429,
198,
220,
220,
220,
220,
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,
1288,
361,
1785,
13,
8189,
6624,
22950,
290,
22950,
51,
20258,
6624,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22950,
51,
20258,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
28461,
9248,
572,
11537,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
16,
13,
23705,
378,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
497,
404,
14810,
13,
20063,
3419,
220,
628,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
2124,
290,
2124,
51,
20258,
6624,
10352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
51,
20258,
796,
6407,
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,
3601,
19203,
55,
319,
11537,
198,
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,
611,
279,
17,
13,
271,
62,
282,
425,
3419,
6624,
10352,
25,
1303,
6889,
1654,
262,
1429,
2125,
470,
1541,
2491,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
16,
13,
271,
62,
282,
425,
3419,
6624,
6407,
25,
1303,
12265,
262,
584,
1429,
611,
340,
338,
2491,
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,
279,
16,
13,
23705,
378,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
18,
13,
271,
62,
282,
425,
3419,
6624,
6407,
25,
1303,
12265,
262,
584,
1429,
611,
340,
338,
2491,
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,
279,
18,
13,
23705,
378,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
17,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
497,
404,
14810,
13,
2256,
43,
2337,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
17,
13,
9688,
3419,
220,
1303,
7253,
262,
1429,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
2124,
290,
2124,
51,
20258,
6624,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
51,
20258,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
87,
572,
11537,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
17,
13,
23705,
378,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
497,
404,
14810,
13,
20063,
3419,
220,
628,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
9197,
290,
9197,
51,
20258,
6624,
10352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9197,
51,
20258,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
31560,
293,
319,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
18,
13,
271,
62,
282,
425,
3419,
6624,
10352,
25,
1303,
6889,
1654,
262,
1429,
2125,
470,
1541,
2491,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
16,
13,
271,
62,
282,
425,
3419,
6624,
6407,
25,
1303,
12265,
262,
584,
1429,
611,
340,
338,
2491,
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,
279,
16,
13,
23705,
378,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
17,
13,
271,
62,
282,
425,
3419,
6624,
6407,
25,
1303,
12265,
262,
584,
1429,
611,
340,
338,
2491,
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,
279,
17,
13,
23705,
378,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
18,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
497,
404,
14810,
13,
9536,
78,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
18,
13,
9688,
3419,
220,
1303,
7253,
262,
1429,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
9197,
290,
9197,
51,
20258,
6624,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9197,
51,
20258,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
31560,
293,
572,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
18,
13,
23705,
378,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
497,
404,
14810,
13,
20063,
3419,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
6616,
290,
6616,
51,
20258,
6624,
10352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6616,
51,
20258,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
48011,
319,
11537,
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,
611,
279,
19,
13,
271,
62,
282,
425,
3419,
6624,
10352,
25,
1303,
6889,
1654,
262,
1429,
2125,
470,
1541,
2491,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
19,
796,
18540,
305,
919,
278,
13,
18709,
7,
16793,
796,
1113,
34049,
9319,
40783,
538,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
19,
13,
9688,
3419,
220,
1303,
7253,
262,
1429,
628,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
6616,
290,
6616,
51,
20258,
6624,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6616,
51,
20258,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
48011,
572,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
19,
13,
23705,
378,
3419,
628,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
371,
16,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
49,
16,
532,
22278,
1550,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29292,
796,
6407,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
371,
17,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
49,
17,
11537,
220,
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,
1288,
361,
1785,
13,
8189,
6624,
371,
18,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
49,
18,
11537,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
406,
16,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
43,
16,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
3168,
78,
1828,
7,
1795,
8,
1303,
220,
16290,
262,
1426,
37752,
284,
262,
1113,
78,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
406,
17,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
43,
17,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
3168,
78,
1828,
32590,
1795,
8,
1303,
220,
16290,
262,
1426,
37752,
284,
262,
1113,
78,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
406,
18,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
43,
18,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
2922,
290,
287,
1851,
55,
6624,
10352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
818,
1851,
1395,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
287,
1851,
55,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
2922,
290,
287,
1851,
55,
6624,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
26447,
1395,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
287,
1851,
55,
796,
10352,
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,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
923,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
10434,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
1363,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
16060,
11537,
628,
628,
198,
2,
220,
20969,
13868,
6127,
47232,
628,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8367,
6624,
657,
25,
220,
1303,
20969,
2716,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8189,
6624,
371,
16,
25,
220,
1303,
22278,
3242,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
49,
16,
532,
22278,
3242,
11537,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29292,
796,
10352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
371,
17,
25,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
49,
17,
11537,
220,
220,
220,
220,
220,
198,
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,
1288,
361,
1785,
13,
8189,
6624,
406,
16,
393,
1785,
13,
8189,
6624,
406,
17,
25,
220,
1303,
3116,
418,
9072,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
11838,
78,
9072,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
3168,
78,
1828,
7,
15,
8,
220,
220,
220,
628,
628,
198,
2,
220,
1052,
30326,
520,
3378,
290,
360,
15636,
3880,
32501,
628,
220,
220,
220,
611,
1785,
13,
4906,
6624,
9940,
4147,
13,
20114,
62,
32,
4462,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
7061,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
3880,
12,
11537,
628,
198,
2,
360,
15636,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8189,
6624,
1467,
25,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8367,
6624,
532,
16,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
35,
15636,
12509,
9792,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8367,
6624,
352,
25,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
35,
15636,
33621,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8189,
6624,
1596,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8367,
6624,
532,
16,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
35,
15636,
15958,
11537,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8367,
6624,
352,
25,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
35,
15636,
30320,
11537,
628,
198,
198,
2,
220,
6498,
45304,
4859,
1113,
78,
6973,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
642,
25,
220,
1303,
6498,
45304,
38937,
4859,
220,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
371,
56,
796,
1785,
13,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
18276,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
311,
2481,
796,
2266,
3526,
13,
8899,
11838,
78,
7,
18276,
8,
1303,
220,
21589,
262,
1988,
422,
262,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
49485,
284,
670,
351,
262,
1113,
78,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
3168,
78,
2481,
62,
47,
7,
50,
2481,
8,
220,
220,
220,
220,
1303,
220,
16290,
262,
1426,
37752,
284,
262,
1113,
78,
628,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
362,
25,
220,
1303,
6498,
45304,
6075,
38342,
4859,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24202,
796,
1785,
13,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
357,
49,
55,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
311,
1828,
796,
2266,
3526,
13,
8899,
11838,
78,
7,
49,
55,
8,
1303,
220,
21589,
262,
1988,
422,
262,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
49485,
284,
670,
351,
262,
1113,
78,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
3168,
78,
1828,
62,
47,
7,
50,
1828,
8,
220,
220,
220,
220,
1303,
220,
16290,
262,
1426,
37752,
284,
262,
1113,
78,
628,
198,
198,
2,
220,
9578,
45304,
4859,
5584,
6973,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1785,
13,
8189,
6624,
352,
25,
220,
1303,
9578,
45304,
38937,
4859,
628,
197,
197,
197,
2,
383,
45304,
4859,
3607,
257,
1988,
1022,
657,
12,
13381,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
38240,
262,
1988,
284,
657,
12,
16799,
329,
22052,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
290,
657,
12,
532,
16799,
329,
16196,
198,
197,
197,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
406,
56,
796,
1785,
13,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
406,
56,
1279,
13108,
25,
220,
1303,
1114,
2017,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
56,
796,
18112,
532,
406,
56,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
11319,
796,
3256,
11319,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
18819,
56,
796,
46083,
18819,
56,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
406,
56,
18189,
13108,
25,
220,
1303,
5157,
2017,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
56,
796,
406,
56,
532,
13108,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
56,
796,
532,
18819,
56,
220,
1303,
6889,
4633,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
11319,
796,
3256,
11319,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
18819,
56,
796,
46083,
18819,
56,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
1785,
13,
8189,
6624,
657,
25,
220,
1303,
9578,
45304,
6075,
38342,
4859,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
383,
45304,
4859,
3607,
257,
1988,
1022,
657,
12,
13381,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
38240,
262,
1988,
284,
657,
12,
16799,
329,
1364,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
290,
657,
12,
16799,
329,
826,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44988,
796,
1785,
13,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
44988,
1279,
13108,
25,
220,
1303,
9578,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
55,
62,
43,
796,
18112,
532,
44988,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
43,
55,
796,
3256,
43,
55,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
18819,
55,
62,
18819,
796,
46083,
18819,
55,
62,
43,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
44988,
1875,
13108,
25,
220,
1303,
6498,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
55,
62,
49,
796,
44988,
532,
13108,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
43,
55,
796,
46083,
43,
55,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
18819,
55,
62,
11028,
796,
46083,
18819,
55,
62,
49,
8,
198,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
44988,
6624,
13108,
25,
220,
1303,
6889,
1654,
1111,
3815,
389,
6632,
611,
4859,
318,
287,
262,
7372,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
55,
62,
43,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
55,
62,
49,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
198,
2,
220,
43426,
262,
3815,
284,
3758,
284,
262,
24699,
198,
220,
220,
220,
220,
220,
220,
220,
611,
9578,
56,
6624,
657,
25,
220,
1303,
17278,
319,
262,
4136,
611,
407,
1016,
22052,
393,
16196,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
44988,
19841,
13108,
25,
1303,
6756,
9578,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
76,
20965,
796,
532,
18819,
55,
62,
43,
220,
1303,
31849,
5584,
284,
1210,
319,
262,
4136,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6498,
76,
20965,
796,
9578,
55,
62,
43,
220,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
44988,
18189,
18112,
25,
1303,
6756,
6498,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
76,
20965,
796,
9578,
55,
62,
49,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6498,
76,
20965,
796,
532,
18819,
55,
62,
49,
220,
1303,
31849,
5584,
284,
1210,
319,
262,
4136,
628,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
406,
56,
19841,
13108,
25,
220,
1303,
1114,
2017,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
1890,
2017,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
76,
20965,
796,
9578,
56,
532,
9578,
55,
62,
43,
220,
1303,
15561,
19702,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
9578,
76,
20965,
1279,
16,
25,
220,
1303,
13707,
5584,
1016,
16196,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
76,
20965,
796,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6498,
76,
20965,
796,
9578,
56,
532,
9578,
55,
62,
49,
220,
1303,
15561,
19702,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6498,
76,
20965,
1279,
16,
25,
220,
1303,
13707,
5584,
1016,
16196,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6498,
76,
20965,
796,
657,
26,
628,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
406,
56,
18189,
18112,
25,
220,
1303,
5157,
2017,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
7282,
2017,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
76,
20965,
796,
9578,
56,
1343,
9578,
55,
62,
43,
220,
1303,
15561,
19702,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
9578,
76,
20965,
1875,
12,
16,
25,
220,
1303,
13707,
5584,
1016,
22052,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9578,
76,
20965,
796,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6498,
76,
20965,
796,
9578,
56,
1343,
9578,
55,
62,
49,
220,
220,
1303,
15561,
19702,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6498,
76,
20965,
1875,
12,
16,
25,
220,
1303,
13707,
5584,
1016,
22052,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6498,
76,
20965,
796,
657,
26,
628,
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,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
611,
29292,
6624,
6407,
25,
220,
1303,
11198,
2866,
329,
29292,
198,
220,
220,
220,
220,
220,
220,
220,
37125,
220,
796,
9578,
76,
20965,
1635,
362,
198,
220,
220,
220,
220,
220,
220,
220,
29820,
796,
6498,
76,
20965,
1635,
362,
628,
198,
220,
220,
220,
2073,
25,
220,
1303,
14435,
2866,
198,
220,
220,
220,
220,
220,
220,
220,
37125,
796,
9578,
76,
20965,
198,
220,
220,
220,
220,
220,
220,
220,
29820,
796,
6498,
76,
20965,
628,
220,
220,
220,
611,
37125,
14512,
37125,
62,
15173,
393,
29820,
14512,
29820,
62,
15173,
25,
220,
1303,
5514,
3601,
5584,
12055,
611,
484,
423,
3421,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
18819,
5584,
220,
796,
3256,
31288,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
19203,
11028,
5584,
796,
3256,
29138,
8,
198,
197,
198,
220,
220,
220,
37125,
62,
15173,
796,
37125,
198,
220,
220,
220,
29820,
62,
15173,
796,
29820,
198,
197,
198,
197,
198,
220,
220,
220,
1303,
5345,
5584,
2866,
290,
4571,
197,
198,
220,
220,
220,
220,
220,
197,
198,
220,
220,
220,
611,
287,
1851,
55,
6624,
6407,
25,
220,
1303,
31849,
19702,
6973,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
10786,
49,
964,
325,
19702,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
44,
17,
62,
23,
2545,
7,
29138,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
44,
16,
62,
23,
2545,
7,
31288,
8,
628,
220,
220,
220,
2073,
25,
220,
1303,
14435,
19702,
6973,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4798,
19203,
26447,
19702,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
44,
17,
62,
23,
2545,
7,
31288,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2266,
3526,
13,
44,
16,
62,
23,
2545,
7,
29138,
8,
220,
198,
220,
220,
220,
220,
220,
628,
628,
198,
220,
220,
220,
198
] | 2.083556 | 5,996 |
"""
Tools to help manage Globus proxies
"""
import os
import subprocess
import logging
from iceprod.server.config import IceProdConfig
logger = logging.getLogger('globus')
class SiteGlobusProxy(object):
"""
Manage site-wide globus proxy
:param cfgfile: cfgfile location (optional)
:param duration: proxy duration (optional, default 72 hours)
"""
def set_passphrase(self, p):
"""Set the passphrase"""
self.cfg['passphrase'] = p
def set_duration(self, d):
"""Set the duration"""
self.cfg['duration'] = d
def set_voms_vo(self, vo):
"""Set the voms VO"""
self.cfg['voms_vo'] = vo
def set_voms_role(self, r):
"""Set the voms role"""
self.cfg['voms_role'] = r
def update_proxy(self):
"""Update the proxy"""
if 'passphrase' not in self.cfg:
raise Exception('passphrase missing')
if 'duration' not in self.cfg:
raise Exception('duration missing')
logger.info('duration: %r',self.cfg['duration'])
if subprocess.call(['grid-proxy-info','-e',
'-valid','%d:0'%self.cfg['duration'],
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL):
# proxy needs updating
if 'voms_vo' in self.cfg and self.cfg['voms_vo']:
cmd = ['voms-proxy-init']
if 'voms_role' in self.cfg and self.cfg['voms_role']:
vo = self.cfg['voms_vo']
role = self.cfg['voms_role']
cmd.extend(['-voms', '{0}:/{0}/Role={1}'.format(vo, role)])
else:
cmd.extend(['-voms', self.cfg['voms_vo']])
else:
cmd = ['grid-proxy-init']
cmd.extend(['-pwstdin','-valid','%d:0'%(self.cfg['duration']+1)])
if 'out' in self.cfg:
cmd.extend(['-out', self.cfg['out']])
inputbytes = (self.cfg['passphrase']+'\n').encode('utf-8')
p = subprocess.run(cmd, input=inputbytes, capture_output=True, timeout=60, check=False)
logger.info('proxy cmd: %r', p.args)
logger.info('stdout: %s', p.stdout)
logger.info('stderr: %s', p.stderr)
if 'voms_vo' in self.cfg and self.cfg['voms_vo']:
for line in p.stdout.decode('utf-8').split('\n'):
if line.startswith('Creating proxy') and line.endswith('Done'):
break # this is a good proxy
else:
raise Exception('voms-proxy-init failed')
elif p.returncode > 0:
raise Exception('grid-proxy-init failed')
def get_proxy(self):
"""Get the proxy location"""
if 'out' in self.cfg:
return self.cfg['out']
FNULL = open(os.devnull, 'w')
return subprocess.check_output(['grid-proxy-info','-path'],
stderr=FNULL).decode('utf-8').strip()
| [
37811,
198,
33637,
284,
1037,
6687,
40713,
385,
41775,
198,
37811,
198,
198,
11748,
28686,
198,
11748,
850,
14681,
198,
11748,
18931,
198,
198,
6738,
4771,
1676,
67,
13,
15388,
13,
11250,
1330,
6663,
2964,
67,
16934,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
10786,
4743,
672,
385,
11537,
198,
198,
4871,
14413,
9861,
672,
385,
44148,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1869,
496,
2524,
12,
4421,
15095,
385,
15741,
628,
220,
220,
220,
1058,
17143,
30218,
70,
7753,
25,
30218,
70,
7753,
4067,
357,
25968,
8,
198,
220,
220,
220,
1058,
17143,
9478,
25,
15741,
9478,
357,
25968,
11,
4277,
7724,
2250,
8,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
900,
62,
6603,
34675,
7,
944,
11,
279,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
262,
1208,
34675,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
37581,
17816,
6603,
34675,
20520,
796,
279,
628,
220,
220,
220,
825,
900,
62,
32257,
7,
944,
11,
288,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
262,
9478,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
37581,
17816,
32257,
20520,
796,
288,
628,
220,
220,
220,
825,
900,
62,
85,
3150,
62,
13038,
7,
944,
11,
7608,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
262,
410,
3150,
30578,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
37581,
17816,
85,
3150,
62,
13038,
20520,
796,
7608,
628,
220,
220,
220,
825,
900,
62,
85,
3150,
62,
18090,
7,
944,
11,
374,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7248,
262,
410,
3150,
2597,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
37581,
17816,
85,
3150,
62,
18090,
20520,
796,
374,
628,
220,
220,
220,
825,
4296,
62,
36436,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
10260,
262,
15741,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
611,
705,
6603,
34675,
6,
407,
287,
2116,
13,
37581,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
35528,
10786,
6603,
34675,
4814,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
611,
705,
32257,
6,
407,
287,
2116,
13,
37581,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
35528,
10786,
32257,
4814,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
32257,
25,
4064,
81,
3256,
944,
13,
37581,
17816,
32257,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
611,
850,
14681,
13,
13345,
7,
17816,
25928,
12,
36436,
12,
10951,
3256,
29001,
68,
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,
12,
12102,
41707,
4,
67,
25,
15,
6,
4,
944,
13,
37581,
17816,
32257,
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,
16589,
14367,
448,
28,
7266,
14681,
13,
39345,
33991,
11,
336,
1082,
81,
28,
7266,
14681,
13,
39345,
33991,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
15741,
2476,
19698,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
85,
3150,
62,
13038,
6,
287,
2116,
13,
37581,
290,
2116,
13,
37581,
17816,
85,
3150,
62,
13038,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
37250,
85,
3150,
12,
36436,
12,
15003,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
85,
3150,
62,
18090,
6,
287,
2116,
13,
37581,
290,
2116,
13,
37581,
17816,
85,
3150,
62,
18090,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7608,
796,
2116,
13,
37581,
17816,
85,
3150,
62,
13038,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2597,
796,
2116,
13,
37581,
17816,
85,
3150,
62,
18090,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
13,
2302,
437,
7,
17816,
12,
85,
3150,
3256,
705,
90,
15,
92,
14079,
90,
15,
92,
14,
47445,
34758,
16,
92,
4458,
18982,
7,
13038,
11,
2597,
8,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
13,
2302,
437,
7,
17816,
12,
85,
3150,
3256,
2116,
13,
37581,
17816,
85,
3150,
62,
13038,
6,
11907,
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,
23991,
796,
37250,
25928,
12,
36436,
12,
15003,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
13,
2302,
437,
7,
17816,
12,
79,
86,
19282,
259,
3256,
29001,
12102,
41707,
4,
67,
25,
15,
6,
4,
7,
944,
13,
37581,
17816,
32257,
20520,
10,
16,
8,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
448,
6,
287,
2116,
13,
37581,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
13,
2302,
437,
7,
17816,
12,
448,
3256,
2116,
13,
37581,
17816,
448,
6,
11907,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
33661,
796,
357,
944,
13,
37581,
17816,
6603,
34675,
20520,
10,
6,
59,
77,
27691,
268,
8189,
10786,
40477,
12,
23,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
796,
850,
14681,
13,
5143,
7,
28758,
11,
5128,
28,
15414,
33661,
11,
8006,
62,
22915,
28,
17821,
11,
26827,
28,
1899,
11,
2198,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
36436,
23991,
25,
4064,
81,
3256,
279,
13,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
19282,
448,
25,
4064,
82,
3256,
279,
13,
19282,
448,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
301,
1082,
81,
25,
4064,
82,
3256,
279,
13,
301,
1082,
81,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
85,
3150,
62,
13038,
6,
287,
2116,
13,
37581,
290,
2116,
13,
37581,
17816,
85,
3150,
62,
13038,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
279,
13,
19282,
448,
13,
12501,
1098,
10786,
40477,
12,
23,
27691,
35312,
10786,
59,
77,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1627,
13,
9688,
2032,
342,
10786,
32071,
15741,
11537,
290,
1627,
13,
437,
2032,
342,
10786,
45677,
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,
2270,
1303,
428,
318,
257,
922,
15741,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
35528,
10786,
85,
3150,
12,
36436,
12,
15003,
4054,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
279,
13,
7783,
8189,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
35528,
10786,
25928,
12,
36436,
12,
15003,
4054,
11537,
628,
220,
220,
220,
825,
651,
62,
36436,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
262,
15741,
4067,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
611,
705,
448,
6,
287,
2116,
13,
37581,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
37581,
17816,
448,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
376,
33991,
796,
1280,
7,
418,
13,
7959,
8423,
11,
705,
86,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
850,
14681,
13,
9122,
62,
22915,
7,
17816,
25928,
12,
36436,
12,
10951,
3256,
29001,
6978,
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,
336,
1082,
81,
28,
37,
33991,
737,
12501,
1098,
10786,
40477,
12,
23,
27691,
36311,
3419,
198
] | 1.980354 | 1,527 |
import os
import percy
from percy import utils
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
__all__ = ['ResourceLoader']
MAX_FILESIZE_BYTES = 15 * 1024**2 # 15 MiB.
| [
11748,
28686,
198,
11748,
583,
948,
198,
6738,
583,
948,
1330,
3384,
4487,
198,
198,
28311,
25,
198,
220,
220,
220,
422,
2956,
297,
571,
13,
29572,
1330,
19016,
29572,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
422,
19016,
29572,
1330,
19016,
29572,
198,
198,
834,
439,
834,
796,
37250,
26198,
17401,
20520,
198,
198,
22921,
62,
46700,
1546,
35400,
62,
17513,
51,
1546,
796,
1315,
1635,
28119,
1174,
17,
220,
1303,
1315,
13756,
33,
13,
628,
198
] | 2.7875 | 80 |
import traceback
import uuid
import socket
import logging
import os
import base64
import zlib
import gzip
import time
import datetime
from http import cookies
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from threading import Thread
import WebRequest
if __name__ == '__main__':
wg = WebRequest.WebGetRobust()
srv = start_server(
assertion_class = None,
from_wg = wg,
skip_header_checks = True)
print("running server on port: ", srv)
while 1:
time.sleep(1)
| [
198,
11748,
12854,
1891,
198,
11748,
334,
27112,
198,
11748,
17802,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
2779,
2414,
198,
11748,
1976,
8019,
198,
11748,
308,
13344,
198,
11748,
640,
198,
11748,
4818,
8079,
198,
6738,
2638,
1330,
14746,
198,
6738,
2638,
13,
15388,
1330,
7308,
40717,
18453,
25060,
198,
6738,
2638,
13,
15388,
1330,
38288,
18497,
198,
6738,
4704,
278,
1330,
14122,
198,
198,
11748,
5313,
18453,
628,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
628,
197,
86,
70,
796,
5313,
18453,
13,
13908,
3855,
14350,
436,
3419,
198,
197,
27891,
85,
796,
923,
62,
15388,
7,
198,
197,
197,
30493,
295,
62,
4871,
220,
220,
220,
796,
6045,
11,
198,
197,
197,
6738,
62,
86,
70,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
266,
70,
11,
198,
197,
197,
48267,
62,
25677,
62,
42116,
796,
6407,
8,
628,
197,
4798,
7203,
20270,
4382,
319,
2493,
25,
33172,
19677,
85,
8,
198,
197,
4514,
352,
25,
198,
197,
197,
2435,
13,
42832,
7,
16,
8,
198
] | 2.933333 | 180 |
import re
import math
import random
import logging
from collections import OrderedDict
from discord.ext import commands
from common import utilities
from common import dynamo_manager
from common.module.discoverable_module import DiscoverableCog
from common.module.module_initialization_container import ModuleInitializationContainer
## Config
CONFIG_OPTIONS = utilities.load_config()
## Logging
logger = utilities.initialize_logging(logging.getLogger(__name__))
class Music(DiscoverableCog):
'''
Note that there's something wrong with the note parsing logic. It still works, but it takes waaay too long now. I'll
look into it later.
'''
## Keys
BPM_KEY = "bpm"
OCTAVE_KEY = "octave"
TONE_KEY = "tone"
BAD_KEY = "bad"
BAD_PERCENT_KEY = "bad_percent"
## Defaults
BPM = CONFIG_OPTIONS.get(BPM_KEY, 100)
OCTAVE = CONFIG_OPTIONS.get(OCTAVE_KEY, 2)
TONE = CONFIG_OPTIONS.get(TONE_KEY, False)
BAD = CONFIG_OPTIONS.get(BAD_KEY, False)
BAD_PERCENT = CONFIG_OPTIONS.get(BAD_PERCENT_KEY, 10)
## Config
## todo: fix this
NOTES = ["c", "c#", "d", "d#", "e", "f", "f#", "g", "g#", "a", "a#", "b"]
HALF_STEPS = len(NOTES)
OCTAVES = 10
NOTE_REPLACEMENT = "[laa<{},{}>]"
REST = "r"
REST_REPLACEMENT = "[_<{},{}>]"
TONE_REPLACEMENT = "[:t <{},{}>]"
SHARP = "#"
## Properties
@property
## Methods
## Calculates the frequency of a note at a given number of half steps from the reference frequency
## Builds a dictionary of notes and their pitches at a given octave
## Pulls any TTS config options (ex. [:dv hs 10]) from the message string
## Pulls any music config options (ex. \bpm=N) from the message string
## Turns a list of Note objects into a string of TTS friendly phonemes
## Commands
@commands.command(no_pm=True, brief="Sings the given notes aloud!")
async def music(self, ctx, notes, ignore_char_limit=False):
"""
Sings the given notes aloud to your voice channel.
A note (or notes) can look like any of these:
'a' - Just the 'a' quarter note in the default second octave.
'2d' - A 'd' quarter note held for two beats, again in the second octave.
'c#4' - A 'c#' quarter note in the fourth octave.
'2b#3' - A 'b#' quarter note held for two beats, in the third octave.
'r' - A quarter rest.
'4r' - A quarter rest held for four beats.
'b/b' - Two 'b' eighth notes.
'2c#/d#/a3/f' - A 'c#' sixteenth note held for two beats, a 'd#' sixteenth note,
an 'a' sixteenth note in the third octave, and a 'f' sixteenth note.
Formatting:
Notes (at the moment) have four distinct parts (Duration?)(Note)(Sharp?)(Octave?).
Only the base note is necessary, everything else can be omitted if necessary
(see examples) A single space NEEDS to be inserted between notes.
You can chain notes together by inserting a '/' between notes, this lets you create
multiple shorter beats.
This lets you approximate eighth notes, sixteenth notes, thirty-second notes, and
really any other division of notes. (Twelfth, Twentieth, etc)
You can also use the | character to help with formatting your bars
(ex. 'c d e f | r g a b')
Inline Configuration:
BPM:
The '\\bpm=N' line can be inserted anywhere to adjust the bpm of notes in that
line. N can be any positive integer. (ex. '\\bpm=120' or '\\bpm=60')
Octave:
The '\\octave=N' line can be inserted anywhere to adjust the default octave of
notes in that line. N can be any integer between 0 and 9 (inclusive)
(ex. '\\octave=1' or '\\octave=3'), however 0 through 4 give the best results.
Tones:
The '\\tone=N' line can be inserted anywhere to set whether or not to use tones
instead of phonemes on that line. N can be either 0 or 1, where 0 disables tones,
and 1 enables them.
Bad:
The '\\bad=N' line can be inserted anywhere to set whether or not to make the notes
on that line sound worse (See: https://www.youtube.com/watch?v=KolfEhV-KiA). N can
be either 0 or 1, where 0 disables the badness, and 1 enables it.
Bad_Percent:
The '\\bad_percent=N' line can be inserted anywhere to set the level of badness,
when using the \\bad config. N can be any positive integer. It works as a
percentage where if N = 0, then it's not at all worse, and N = 100 would be 100%
worse. Needs \\bad to be set to have any effect.
Examples:
My Heart Will Go On (first 7 bars):
'\music \\bpm=100 f f f f | e 2f f | e 2f g | 2a 2g | f f f f | e 2f f | 2d 2r'
Sandstorm (kinda):
'\music \\bpm=136 \\octave=3 \\tone=1 b/b/b/b/b b/b/b/b/b/b/b e/e/e/e/e/e/e
d/d/d/d/d/d/d a b/b/b/b/b/b b/b/b/b/b/b c# b/b/b/b/b/a'
Defaults:
bpm = 100
octave = 2
tone = 0
bad = 0
bad_percent = 10
"""
## Todo: preserve the position of tts_configs in the message
tts_configs, message = self._extract_tts_configs(notes)
music_configs, message = self._extract_music_configs(notes)
bpm = music_configs.get(self.BPM_KEY, self.bpm)
beat_length = 60 / bpm # for a quarter note
octave = music_configs.get(self.OCTAVE_KEY, self.octave)
notes = MusicParser(message, beat_length, octave).notes
tts_notes = self._build_tts_note_string(notes, **music_configs)
await self.speech_cog._say(ctx, " ".join(tts_configs) + tts_notes, ignore_char_limit=ignore_char_limit)
| [
11748,
302,
198,
11748,
10688,
198,
11748,
4738,
198,
11748,
18931,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
198,
6738,
36446,
13,
2302,
1330,
9729,
198,
198,
6738,
2219,
1330,
20081,
198,
6738,
2219,
1330,
6382,
78,
62,
37153,
198,
6738,
2219,
13,
21412,
13,
67,
29392,
540,
62,
21412,
1330,
29704,
540,
34,
519,
198,
6738,
2219,
13,
21412,
13,
21412,
62,
36733,
1634,
62,
34924,
1330,
19937,
24243,
1634,
29869,
198,
198,
2235,
17056,
198,
10943,
16254,
62,
3185,
51,
11053,
796,
20081,
13,
2220,
62,
11250,
3419,
198,
198,
2235,
5972,
2667,
198,
6404,
1362,
796,
20081,
13,
36733,
1096,
62,
6404,
2667,
7,
6404,
2667,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
4008,
628,
628,
198,
198,
4871,
7849,
7,
44596,
540,
34,
519,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
5740,
326,
612,
338,
1223,
2642,
351,
262,
3465,
32096,
9156,
13,
632,
991,
2499,
11,
475,
340,
2753,
2082,
64,
323,
1165,
890,
783,
13,
314,
1183,
198,
220,
220,
220,
804,
656,
340,
1568,
13,
198,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
22492,
26363,
198,
220,
220,
220,
347,
5868,
62,
20373,
796,
366,
65,
4426,
1,
198,
220,
220,
220,
42256,
32,
6089,
62,
20373,
796,
366,
38441,
1015,
1,
198,
220,
220,
220,
309,
11651,
62,
20373,
796,
366,
41527,
1,
198,
220,
220,
220,
33934,
62,
20373,
796,
366,
14774,
1,
198,
220,
220,
220,
33934,
62,
18973,
43960,
62,
20373,
796,
366,
14774,
62,
25067,
1,
628,
220,
220,
220,
22492,
2896,
13185,
198,
220,
220,
220,
347,
5868,
796,
25626,
62,
3185,
51,
11053,
13,
1136,
7,
33,
5868,
62,
20373,
11,
1802,
8,
198,
220,
220,
220,
42256,
32,
6089,
796,
25626,
62,
3185,
51,
11053,
13,
1136,
7,
46,
4177,
32,
6089,
62,
20373,
11,
362,
8,
198,
220,
220,
220,
309,
11651,
796,
25626,
62,
3185,
51,
11053,
13,
1136,
7,
11357,
36,
62,
20373,
11,
10352,
8,
198,
220,
220,
220,
33934,
796,
25626,
62,
3185,
51,
11053,
13,
1136,
7,
33,
2885,
62,
20373,
11,
10352,
8,
198,
220,
220,
220,
33934,
62,
18973,
43960,
796,
25626,
62,
3185,
51,
11053,
13,
1136,
7,
33,
2885,
62,
18973,
43960,
62,
20373,
11,
838,
8,
628,
220,
220,
220,
22492,
17056,
198,
220,
220,
220,
22492,
284,
4598,
25,
4259,
428,
198,
220,
220,
220,
5626,
1546,
796,
14631,
66,
1600,
366,
66,
2,
1600,
366,
67,
1600,
366,
67,
2,
1600,
366,
68,
1600,
366,
69,
1600,
366,
69,
2,
1600,
366,
70,
1600,
366,
70,
2,
1600,
366,
64,
1600,
366,
64,
2,
1600,
366,
65,
8973,
198,
220,
220,
220,
42968,
37,
62,
30516,
3705,
796,
18896,
7,
11929,
1546,
8,
198,
220,
220,
220,
42256,
10116,
1546,
796,
838,
198,
220,
220,
220,
24550,
62,
2200,
6489,
2246,
12529,
796,
12878,
5031,
64,
27,
90,
5512,
90,
92,
29,
30866,
198,
220,
220,
220,
30617,
796,
366,
81,
1,
198,
220,
220,
220,
30617,
62,
2200,
6489,
2246,
12529,
796,
12878,
62,
27,
90,
5512,
90,
92,
29,
30866,
198,
220,
220,
220,
309,
11651,
62,
2200,
6489,
2246,
12529,
796,
12878,
25,
83,
1279,
90,
5512,
90,
92,
29,
30866,
198,
220,
220,
220,
6006,
36035,
796,
25113,
1,
628,
198,
220,
220,
220,
22492,
24946,
628,
220,
220,
220,
2488,
26745,
628,
220,
220,
220,
22492,
25458,
628,
220,
220,
220,
22492,
27131,
689,
262,
8373,
286,
257,
3465,
379,
257,
1813,
1271,
286,
2063,
4831,
422,
262,
4941,
8373,
628,
198,
220,
220,
220,
22492,
10934,
82,
257,
22155,
286,
4710,
290,
511,
22421,
379,
257,
1813,
19318,
1015,
628,
198,
220,
220,
220,
22492,
21429,
82,
597,
309,
4694,
4566,
3689,
357,
1069,
13,
685,
25,
67,
85,
289,
82,
838,
12962,
422,
262,
3275,
4731,
628,
198,
220,
220,
220,
22492,
21429,
82,
597,
2647,
4566,
3689,
357,
1069,
13,
3467,
65,
4426,
28,
45,
8,
422,
262,
3275,
4731,
628,
198,
220,
220,
220,
22492,
30875,
257,
1351,
286,
5740,
5563,
656,
257,
4731,
286,
309,
4694,
8030,
32896,
368,
274,
628,
220,
220,
220,
22492,
49505,
628,
220,
220,
220,
2488,
9503,
1746,
13,
21812,
7,
3919,
62,
4426,
28,
17821,
11,
4506,
2625,
50,
654,
262,
1813,
4710,
32227,
2474,
8,
198,
220,
220,
220,
30351,
825,
2647,
7,
944,
11,
269,
17602,
11,
4710,
11,
8856,
62,
10641,
62,
32374,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
311,
654,
262,
1813,
4710,
32227,
284,
534,
3809,
6518,
13,
628,
220,
220,
220,
220,
220,
220,
220,
317,
3465,
357,
273,
4710,
8,
460,
804,
588,
597,
286,
777,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
64,
6,
532,
2329,
262,
705,
64,
6,
3860,
3465,
287,
262,
4277,
1218,
19318,
1015,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
17,
67,
6,
532,
317,
705,
67,
6,
3860,
3465,
2714,
329,
734,
17825,
11,
757,
287,
262,
1218,
19318,
1015,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
66,
2,
19,
6,
532,
317,
705,
66,
2,
6,
3860,
3465,
287,
262,
5544,
19318,
1015,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
17,
65,
2,
18,
6,
532,
317,
705,
65,
2,
6,
3860,
3465,
2714,
329,
734,
17825,
11,
287,
262,
2368,
19318,
1015,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
81,
6,
532,
317,
3860,
1334,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
19,
81,
6,
532,
317,
3860,
1334,
2714,
329,
1440,
17825,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
65,
14,
65,
6,
532,
4930,
705,
65,
6,
16974,
4710,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
17,
66,
2,
14,
67,
2,
14,
64,
18,
14,
69,
6,
532,
317,
705,
66,
2,
6,
2237,
20283,
3465,
2714,
329,
734,
17825,
11,
257,
705,
67,
2,
6,
2237,
20283,
3465,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
281,
705,
64,
6,
2237,
20283,
3465,
287,
262,
2368,
19318,
1015,
11,
290,
257,
705,
69,
6,
2237,
20283,
3465,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
18980,
889,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11822,
357,
265,
262,
2589,
8,
423,
1440,
7310,
3354,
357,
26054,
30,
5769,
6425,
5769,
44336,
30,
5769,
12349,
1015,
29865,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5514,
262,
2779,
3465,
318,
3306,
11,
2279,
2073,
460,
307,
22532,
611,
3306,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
3826,
6096,
8,
317,
2060,
2272,
36465,
50,
284,
307,
18846,
1022,
4710,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
921,
460,
6333,
4710,
1978,
416,
19319,
257,
31051,
6,
1022,
4710,
11,
428,
8781,
345,
2251,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3294,
12238,
17825,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
770,
8781,
345,
27665,
16974,
4710,
11,
2237,
20283,
4710,
11,
12277,
12,
12227,
4710,
11,
290,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1107,
597,
584,
7297,
286,
4710,
13,
357,
5080,
44659,
11,
1815,
298,
19235,
11,
3503,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
921,
460,
635,
779,
262,
930,
2095,
284,
1037,
351,
33313,
534,
9210,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
1069,
13,
705,
66,
288,
304,
277,
930,
374,
308,
257,
275,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
554,
1370,
28373,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
5868,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
705,
6852,
65,
4426,
28,
45,
6,
1627,
460,
307,
18846,
6609,
284,
4532,
262,
275,
4426,
286,
4710,
287,
326,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
13,
399,
460,
307,
597,
3967,
18253,
13,
357,
1069,
13,
705,
6852,
65,
4426,
28,
10232,
6,
393,
705,
6852,
65,
4426,
28,
1899,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2556,
1015,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
705,
6852,
38441,
1015,
28,
45,
6,
1627,
460,
307,
18846,
6609,
284,
4532,
262,
4277,
19318,
1015,
286,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4710,
287,
326,
1627,
13,
399,
460,
307,
597,
18253,
1022,
657,
290,
860,
357,
259,
5731,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
1069,
13,
705,
6852,
38441,
1015,
28,
16,
6,
393,
705,
6852,
38441,
1015,
28,
18,
33809,
2158,
657,
832,
604,
1577,
262,
1266,
2482,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
1952,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
705,
6852,
41527,
28,
45,
6,
1627,
460,
307,
18846,
6609,
284,
900,
1771,
393,
407,
284,
779,
23755,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2427,
286,
32896,
368,
274,
319,
326,
1627,
13,
399,
460,
307,
2035,
657,
393,
352,
11,
810,
657,
595,
2977,
23755,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
290,
352,
13536,
606,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7772,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
705,
6852,
14774,
28,
45,
6,
1627,
460,
307,
18846,
6609,
284,
900,
1771,
393,
407,
284,
787,
262,
4710,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
319,
326,
1627,
2128,
4785,
357,
6214,
25,
3740,
1378,
2503,
13,
11604,
13,
785,
14,
8340,
30,
85,
28,
42,
4024,
43894,
53,
12,
42,
72,
32,
737,
399,
460,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
307,
2035,
657,
393,
352,
11,
810,
657,
595,
2977,
262,
2089,
1108,
11,
290,
352,
13536,
340,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7772,
62,
31905,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
705,
6852,
14774,
62,
25067,
28,
45,
6,
1627,
460,
307,
18846,
6609,
284,
900,
262,
1241,
286,
2089,
1108,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
618,
1262,
262,
26867,
14774,
4566,
13,
399,
460,
307,
597,
3967,
18253,
13,
632,
2499,
355,
257,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5873,
810,
611,
399,
796,
657,
11,
788,
340,
338,
407,
379,
477,
4785,
11,
290,
399,
796,
1802,
561,
307,
1802,
4,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4785,
13,
36557,
26867,
14774,
284,
307,
900,
284,
423,
597,
1245,
13,
628,
220,
220,
220,
220,
220,
220,
220,
21066,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2011,
8894,
2561,
1514,
1550,
357,
11085,
767,
9210,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
59,
28965,
26867,
65,
4426,
28,
3064,
277,
277,
277,
277,
930,
304,
362,
69,
277,
930,
304,
362,
69,
308,
930,
362,
64,
362,
70,
930,
277,
277,
277,
277,
930,
304,
362,
69,
277,
930,
362,
67,
362,
81,
6,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3837,
12135,
357,
11031,
64,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
59,
28965,
26867,
65,
4426,
28,
20809,
26867,
38441,
1015,
28,
18,
26867,
41527,
28,
16,
275,
14,
65,
14,
65,
14,
65,
14,
65,
275,
14,
65,
14,
65,
14,
65,
14,
65,
14,
65,
14,
65,
304,
14,
68,
14,
68,
14,
68,
14,
68,
14,
68,
14,
68,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
14,
67,
14,
67,
14,
67,
14,
67,
14,
67,
14,
67,
257,
275,
14,
65,
14,
65,
14,
65,
14,
65,
14,
65,
275,
14,
65,
14,
65,
14,
65,
14,
65,
14,
65,
269,
2,
275,
14,
65,
14,
65,
14,
65,
14,
65,
14,
64,
6,
628,
220,
220,
220,
220,
220,
220,
220,
2896,
13185,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
4426,
796,
1802,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19318,
1015,
796,
362,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8216,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2089,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2089,
62,
25067,
796,
838,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
22492,
309,
24313,
25,
12201,
262,
2292,
286,
256,
912,
62,
11250,
82,
287,
262,
3275,
198,
220,
220,
220,
220,
220,
220,
220,
256,
912,
62,
11250,
82,
11,
3275,
796,
2116,
13557,
2302,
974,
62,
83,
912,
62,
11250,
82,
7,
17815,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2647,
62,
11250,
82,
11,
3275,
796,
2116,
13557,
2302,
974,
62,
28965,
62,
11250,
82,
7,
17815,
8,
628,
220,
220,
220,
220,
220,
220,
220,
275,
4426,
796,
2647,
62,
11250,
82,
13,
1136,
7,
944,
13,
33,
5868,
62,
20373,
11,
2116,
13,
65,
4426,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4405,
62,
13664,
796,
3126,
1220,
275,
4426,
220,
1303,
329,
257,
3860,
3465,
198,
220,
220,
220,
220,
220,
220,
220,
19318,
1015,
796,
2647,
62,
11250,
82,
13,
1136,
7,
944,
13,
46,
4177,
32,
6089,
62,
20373,
11,
2116,
13,
38441,
1015,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4710,
796,
7849,
46677,
7,
20500,
11,
4405,
62,
13664,
11,
19318,
1015,
737,
17815,
198,
220,
220,
220,
220,
220,
220,
220,
256,
912,
62,
17815,
796,
2116,
13557,
11249,
62,
83,
912,
62,
11295,
62,
8841,
7,
17815,
11,
12429,
28965,
62,
11250,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
25507,
2116,
13,
45862,
62,
66,
519,
13557,
16706,
7,
49464,
11,
366,
27071,
22179,
7,
83,
912,
62,
11250,
82,
8,
1343,
256,
912,
62,
17815,
11,
8856,
62,
10641,
62,
32374,
28,
46430,
62,
10641,
62,
32374,
8,
628
] | 2.308666 | 2,608 |
import pytest
from keras.preprocessing import image
from PIL import Image
import numpy as np
import os
import shutil
import tempfile
if __name__ == '__main__':
pytest.main([__file__])
| [
11748,
12972,
9288,
201,
198,
6738,
41927,
292,
13,
3866,
36948,
1330,
2939,
201,
198,
6738,
350,
4146,
1330,
7412,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
11748,
28686,
201,
198,
11748,
4423,
346,
201,
198,
11748,
20218,
7753,
201,
198,
201,
198,
201,
198,
201,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
201,
198,
220,
220,
220,
12972,
9288,
13,
12417,
26933,
834,
7753,
834,
12962,
201,
198
] | 2.706667 | 75 |
#!/usr/bin/env python
from setuptools import find_packages, setup
project = "ch-cli"
version = "0.1.0"
setup(
name=project,
version=version,
description="Command line tool for ch",
author="Zuiwan",
author_email="[email protected]",
url="https://github.com/zuiwan/CodingHub-CLI.git",
packages=find_packages(exclude=("*.tests", "*.tests.*", "tests.*", "tests")),
inchude_package_data=True,
zip_safe=False,
keywords="ch",
install_requires=[
"click>=6.7",
"requests>=2.12.4",
"marshmallow>=2.11.1",
"pytz>=2016.10",
"shortuuid>=0.4.3",
"tabulate>=0.7.7",
"kafka-python>=1.3.3",
"pathlib2>=2.3.0",
"tzlocal>=1.4",
"progressbar33>=2.4",
"websocket-client>=0.44.0",
],
setup_requires=[
"nose>=1.0",
],
dependency_links=[
],
entry_points={
"console_scripts": [
"codehub = ch.main:cli",
"ch-dev = ch.development.dev:cli",
"ch-local = ch.development.local:cli",
],
},
tests_require=[
"mock>=1.0.1",
],
)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
6738,
900,
37623,
10141,
1330,
1064,
62,
43789,
11,
9058,
198,
198,
16302,
796,
366,
354,
12,
44506,
1,
198,
9641,
796,
366,
15,
13,
16,
13,
15,
1,
198,
40406,
7,
198,
220,
220,
220,
1438,
28,
16302,
11,
198,
220,
220,
220,
2196,
28,
9641,
11,
198,
220,
220,
220,
6764,
2625,
21575,
1627,
2891,
329,
442,
1600,
198,
220,
220,
220,
1772,
2625,
57,
9019,
8149,
1600,
198,
220,
220,
220,
1772,
62,
12888,
2625,
67,
590,
3541,
31,
14816,
13,
785,
1600,
198,
220,
220,
220,
19016,
2625,
5450,
1378,
12567,
13,
785,
14,
89,
9019,
8149,
14,
34,
7656,
16066,
12,
5097,
40,
13,
18300,
1600,
198,
220,
220,
220,
10392,
28,
19796,
62,
43789,
7,
1069,
9152,
28,
7203,
24620,
41989,
1600,
366,
24620,
41989,
15885,
1600,
366,
41989,
15885,
1600,
366,
41989,
4943,
828,
198,
220,
220,
220,
11111,
2507,
62,
26495,
62,
7890,
28,
17821,
11,
198,
220,
220,
220,
19974,
62,
21230,
28,
25101,
11,
198,
220,
220,
220,
26286,
2625,
354,
1600,
198,
220,
220,
220,
2721,
62,
47911,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12976,
29,
28,
21,
13,
22,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
8897,
3558,
29,
28,
17,
13,
1065,
13,
19,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
76,
5406,
42725,
29,
28,
17,
13,
1157,
13,
16,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9078,
22877,
29,
28,
5304,
13,
940,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
19509,
12303,
312,
29,
28,
15,
13,
19,
13,
18,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
8658,
5039,
29,
28,
15,
13,
22,
13,
22,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
74,
1878,
4914,
12,
29412,
29,
28,
16,
13,
18,
13,
18,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
6978,
8019,
17,
29,
28,
17,
13,
18,
13,
15,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
22877,
12001,
29,
28,
16,
13,
19,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
33723,
5657,
2091,
29,
28,
17,
13,
19,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
732,
1443,
5459,
12,
16366,
29,
28,
15,
13,
2598,
13,
15,
1600,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
9058,
62,
47911,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
366,
77,
577,
29,
28,
16,
13,
15,
1600,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
20203,
62,
28751,
41888,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
5726,
62,
13033,
34758,
198,
220,
220,
220,
220,
220,
220,
220,
366,
41947,
62,
46521,
1298,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
8189,
40140,
796,
442,
13,
12417,
25,
44506,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
354,
12,
7959,
796,
442,
13,
31267,
13,
7959,
25,
44506,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
354,
12,
12001,
796,
442,
13,
31267,
13,
12001,
25,
44506,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
5254,
62,
46115,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
366,
76,
735,
29,
28,
16,
13,
15,
13,
16,
1600,
198,
220,
220,
220,
16589,
198,
8,
198
] | 1.918644 | 590 |
import os
import re
from typing import (
Union,
List,
Dict,
Pattern
)
from pyrogram.filters import create
from pyrogram import filters, Client
from pyrogram.types import (
Message,
CallbackQuery,
InlineQuery,
InlineKeyboardMarkup,
ReplyKeyboardMarkup,
Update
)
from config import Config
from tronx.database.postgres.dv_sql import DVSQL
dv = DVSQL()
# custom regex filter
def MyPrefix():
"""Multiple prefix support function"""
return dv.getdv("PREFIX").split() or Config.PREFIX.split() or "."
# custom command filter
| [
11748,
28686,
198,
11748,
302,
198,
198,
6738,
19720,
1330,
357,
198,
197,
38176,
11,
220,
198,
197,
8053,
11,
220,
198,
197,
35,
713,
11,
220,
198,
197,
47546,
198,
8,
198,
198,
6738,
12972,
39529,
13,
10379,
1010,
1330,
2251,
198,
6738,
12972,
39529,
1330,
16628,
11,
20985,
198,
6738,
12972,
39529,
13,
19199,
1330,
357,
198,
197,
12837,
11,
220,
198,
197,
47258,
20746,
11,
220,
198,
197,
818,
1370,
20746,
11,
220,
198,
197,
818,
1370,
9218,
3526,
9704,
929,
11,
220,
198,
197,
36875,
9218,
3526,
9704,
929,
11,
220,
198,
197,
10260,
198,
8,
198,
6738,
4566,
1330,
17056,
198,
6738,
491,
261,
87,
13,
48806,
13,
7353,
34239,
13,
67,
85,
62,
25410,
1330,
29854,
17861,
220,
198,
198,
67,
85,
796,
29854,
17861,
3419,
628,
198,
2,
2183,
40364,
8106,
628,
198,
198,
4299,
2011,
36698,
844,
33529,
198,
197,
37811,
31217,
21231,
1104,
2163,
37811,
198,
197,
7783,
288,
85,
13,
1136,
67,
85,
7203,
47,
31688,
10426,
11074,
35312,
3419,
393,
17056,
13,
47,
31688,
10426,
13,
35312,
3419,
393,
366,
526,
628,
198,
198,
2,
2183,
3141,
8106,
628,
198
] | 2.879581 | 191 |
import torch
from dataset import DrivingDataset
from vidvqvae import VQVAE
from torch.utils.data import DataLoader
from torch.utils.data import random_split
import pytorch_lightning as pl
from pytorch_lightning.loggers import WandbLogger
from pytorch_lightning.callbacks import ModelCheckpoint
dataset = DrivingDataset("./generative", frames=16, skip=16)
print(len(dataset))
train_set, val_set = random_split(dataset, [10000, 3009], generator=torch.Generator().manual_seed(42))
train_loader = DataLoader(train_set, batch_size=16, num_workers=12)
val_loader = DataLoader(val_set, batch_size=8, num_workers=12)
model = VQVAE(
in_channel=3,
channel=128,
n_res_block=2,
n_res_channel=32,
embed_dim=64,
n_embed=512,
decay=0.99
)
# wandb_logger = WandbLogger(project="VidVQVAE", log_model="all")
# wandb_logger.watch(model)
# checkpoint_callback = ModelCheckpoint(monitor="val_loss")
# trainer = pl.Trainer(gpus=1, logger=wandb_logger, callbacks=[checkpoint_callback])
trainer = pl.Trainer(gpus=1)
trainer.fit(model, train_loader, val_loader) | [
11748,
28034,
198,
6738,
27039,
1330,
32889,
27354,
292,
316,
198,
6738,
410,
312,
85,
80,
33353,
1330,
569,
48,
11731,
36,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
17401,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
4738,
62,
35312,
198,
11748,
12972,
13165,
354,
62,
2971,
768,
355,
458,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
13,
6404,
5355,
1330,
22420,
65,
11187,
1362,
198,
6738,
12972,
13165,
354,
62,
2971,
768,
13,
13345,
10146,
1330,
9104,
9787,
4122,
628,
198,
19608,
292,
316,
796,
32889,
27354,
292,
316,
7,
1911,
14,
8612,
876,
1600,
13431,
28,
1433,
11,
14267,
28,
1433,
8,
198,
4798,
7,
11925,
7,
19608,
292,
316,
4008,
198,
27432,
62,
2617,
11,
1188,
62,
2617,
796,
4738,
62,
35312,
7,
19608,
292,
316,
11,
685,
49388,
11,
5867,
24,
4357,
17301,
28,
13165,
354,
13,
8645,
1352,
22446,
805,
723,
62,
28826,
7,
3682,
4008,
198,
198,
27432,
62,
29356,
796,
6060,
17401,
7,
27432,
62,
2617,
11,
15458,
62,
7857,
28,
1433,
11,
997,
62,
22896,
28,
1065,
8,
198,
2100,
62,
29356,
796,
6060,
17401,
7,
2100,
62,
2617,
11,
15458,
62,
7857,
28,
23,
11,
997,
62,
22896,
28,
1065,
8,
198,
198,
19849,
796,
569,
48,
11731,
36,
7,
198,
220,
220,
220,
287,
62,
17620,
28,
18,
11,
198,
220,
220,
220,
6518,
28,
12762,
11,
198,
220,
220,
220,
299,
62,
411,
62,
9967,
28,
17,
11,
198,
220,
220,
220,
299,
62,
411,
62,
17620,
28,
2624,
11,
198,
220,
220,
220,
11525,
62,
27740,
28,
2414,
11,
198,
220,
220,
220,
299,
62,
20521,
28,
25836,
11,
198,
220,
220,
220,
22119,
28,
15,
13,
2079,
198,
8,
198,
198,
2,
11569,
65,
62,
6404,
1362,
796,
22420,
65,
11187,
1362,
7,
16302,
2625,
53,
312,
53,
48,
11731,
36,
1600,
2604,
62,
19849,
2625,
439,
4943,
198,
2,
11569,
65,
62,
6404,
1362,
13,
8340,
7,
19849,
8,
198,
198,
2,
26954,
62,
47423,
796,
9104,
9787,
4122,
7,
41143,
2625,
2100,
62,
22462,
4943,
198,
2,
21997,
796,
220,
458,
13,
2898,
10613,
7,
31197,
385,
28,
16,
11,
49706,
28,
86,
392,
65,
62,
6404,
1362,
11,
869,
10146,
41888,
9122,
4122,
62,
47423,
12962,
198,
2213,
10613,
796,
458,
13,
2898,
10613,
7,
31197,
385,
28,
16,
8,
198,
2213,
10613,
13,
11147,
7,
19849,
11,
4512,
62,
29356,
11,
1188,
62,
29356,
8
] | 2.637931 | 406 |
# Copyright 2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import argparse
from requestbuilder import Arg, MutuallyExclusiveArgList
from requestbuilder.mixins import TabifyingMixin
from euca2ools.commands.autoscaling import AutoScalingRequest
| [
2,
15069,
2211,
412,
1229,
3400,
457,
385,
11998,
11,
3457,
13,
198,
2,
198,
2,
2297,
396,
3890,
290,
779,
286,
428,
3788,
287,
2723,
290,
13934,
5107,
11,
198,
2,
351,
393,
1231,
17613,
11,
389,
10431,
2810,
326,
262,
1708,
198,
2,
3403,
389,
1138,
25,
198,
2,
198,
2,
220,
220,
2297,
396,
2455,
507,
286,
2723,
2438,
1276,
12377,
262,
2029,
6634,
4003,
11,
198,
2,
220,
220,
428,
1351,
286,
3403,
290,
262,
1708,
37592,
13,
198,
2,
198,
2,
220,
220,
2297,
396,
2455,
507,
287,
13934,
1296,
1276,
22919,
262,
2029,
6634,
198,
2,
220,
220,
4003,
11,
428,
1351,
286,
3403,
290,
262,
1708,
37592,
287,
262,
198,
2,
220,
220,
10314,
290,
14,
273,
584,
5696,
2810,
351,
262,
6082,
13,
198,
2,
198,
2,
12680,
47466,
3180,
36592,
2389,
1961,
11050,
3336,
27975,
38162,
9947,
367,
15173,
4877,
5357,
27342,
9865,
3843,
20673,
198,
2,
366,
1921,
3180,
1,
5357,
15529,
7788,
32761,
6375,
8959,
49094,
34764,
11015,
11,
47783,
2751,
11,
21728,
5626,
198,
2,
40880,
5390,
11,
3336,
8959,
49094,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
5357,
376,
46144,
7473,
198,
2,
317,
16652,
2149,
37232,
33079,
48933,
15986,
13954,
48778,
1961,
13,
3268,
8005,
49261,
50163,
3336,
27975,
38162,
9947,
198,
2,
47210,
21479,
6375,
27342,
9865,
3843,
20673,
9348,
43031,
19146,
7473,
15529,
42242,
11,
3268,
17931,
23988,
11,
19387,
25256,
1847,
11,
198,
2,
38846,
11,
7788,
3620,
6489,
13153,
11,
6375,
7102,
5188,
10917,
3525,
12576,
29506,
25552,
357,
1268,
39149,
2751,
11,
21728,
5626,
198,
2,
40880,
5390,
11,
41755,
11335,
10979,
3963,
28932,
2257,
2043,
37780,
21090,
50,
6375,
49254,
26,
406,
18420,
3963,
23210,
11,
198,
2,
42865,
11,
6375,
4810,
19238,
29722,
26,
6375,
43949,
44180,
23255,
49,
8577,
24131,
8,
29630,
36,
5959,
7257,
2937,
1961,
5357,
6177,
15529,
198,
2,
3336,
15513,
3963,
43031,
25382,
11,
7655,
2767,
16879,
3268,
27342,
10659,
11,
19269,
18379,
43031,
25382,
11,
6375,
309,
9863,
198,
2,
357,
1268,
39149,
2751,
399,
7156,
43,
3528,
18310,
6375,
25401,
54,
24352,
8,
5923,
1797,
2751,
3268,
15529,
34882,
16289,
3963,
3336,
23210,
198,
2,
3963,
12680,
47466,
11,
45886,
16876,
5984,
29817,
1961,
3963,
3336,
28069,
11584,
25382,
3963,
13558,
3398,
29506,
11879,
13,
198,
198,
11748,
1822,
29572,
198,
198,
6738,
2581,
38272,
1330,
20559,
11,
13859,
935,
3109,
5731,
28100,
8053,
198,
6738,
2581,
38272,
13,
19816,
1040,
1330,
16904,
4035,
35608,
259,
198,
198,
6738,
304,
43120,
17,
10141,
13,
9503,
1746,
13,
2306,
17500,
4272,
1330,
11160,
3351,
4272,
18453,
628
] | 3.514943 | 435 |
from ColorText import ColorText
Texto = ColorText.mudaCor('Olá Mundo!','blue','lo')
print(Texto) | [
6738,
5315,
8206,
1330,
5315,
8206,
201,
198,
201,
198,
8206,
78,
796,
5315,
8206,
13,
76,
15339,
10606,
10786,
30098,
6557,
33324,
78,
0,
41707,
17585,
41707,
5439,
11537,
201,
198,
4798,
7,
8206,
78,
8
] | 2.702703 | 37 |
# -*- coding: utf-8 -*-
"""Tests for the color module.
BSD 3-Clause License
Copyright (c) 2020-2021, Daniel Nagel
All rights reserved.
"""
import numpy as np
import pytest
from matplotlib import colors as clr
import prettypyplot
@pytest.mark.parametrize('num, kwargs, error', [
(1, {}, None),
(2, {'high': 2}, None),
(2, {}, ValueError),
('a', {}, TypeError),
((1, 2), {}, TypeError),
])
def test__is_number_in_range(num, kwargs, error):
"""Test if number is in range."""
if error is None:
prettypyplot.colors._is_number_in_range(num, **kwargs)
else:
with pytest.raises(error):
prettypyplot.colors._is_number_in_range(num, **kwargs)
@pytest.mark.parametrize('L1, L2, refcontrast', [
(1, 0, 21), (0.5, 0.5, 1),
])
def test__contrast(L1, L2, refcontrast):
"""Test contrast."""
for l1, l2 in ((L1, L2), (L2, L1)):
contrast = prettypyplot.colors._contrast(l1, l2)
assert contrast == refcontrast
@pytest.mark.parametrize('rgb, refluminace', [
((1, 1, 1), 1),
((1, 0, 0), 0.2126),
((0, 1, 0), 0.7152),
((0, 0, 0), 0),
])
def test__relative_luminance(rgb, refluminace):
"""Test luminance."""
luminance = prettypyplot.colors._relative_luminance(rgb)
assert luminance == refluminace
@pytest.mark.parametrize('bgcolor, kwargs, refcolor, error', [
('w', {}, '#000000', None),
('b', {}, '#ffffff', None),
('w', {'colors': ('r', 'w', 'k')}, clr.to_rgb('k'), None),
('w', {'colors': ('r', 'w')}, clr.to_rgb('r'), None),
('#505050', {}, '#ffffff', None),
('#a0a0a0', {}, '#000000', None),
('notAColorCode', {}, None, ValueError),
('w', {'colors': ('notAColorCode')}, None, ValueError),
])
def test_text_color(bgcolor, kwargs, refcolor, error):
"""Test estimate text color."""
if error is None:
color = prettypyplot.colors.text_color(bgcolor, **kwargs)
assert clr.to_rgb(color) == clr.to_rgb(refcolor)
else:
with pytest.raises(error):
prettypyplot.colors.text_color(bgcolor, **kwargs)
@pytest.mark.parametrize('color, refbool, error', [
('k', True, None),
('w', True, None),
('r', False, None),
('#212121', True, None),
('#212122', False, None),
('NoColorCode', None, ValueError),
])
def test_is_grayshade(color, refbool, error):
"""Test if color is gray shade."""
if error is None:
assert refbool == prettypyplot.colors.is_greyshade(color)
else:
with pytest.raises(error):
prettypyplot.colors.is_greyshade(color)
@pytest.mark.parametrize('nsc, color, kwargs, refcolors, error', [
(2, 'k', {}, [[0, 0, 0], [0.75, 0.75, 0.75]], None),
(2, 'k', {'return_hex': False}, ['#000000', '#bfbfbf'], None),
(2, 'k', {'return_hex': True}, ['#000000', '#bfbfbf'], None),
(3, 'r', {}, ['#ff0000', '#ff6060', '#ffbfbf'], None),
(3, 'NoColorCoder', {}, None, ValueError),
(1.2, 'k', {}, None, TypeError),
('s', 'k', {}, None, TypeError),
(0, 'k', {}, None, ValueError),
(-5, 'k', {}, None, ValueError),
])
def test_categorical_color(nsc, color, kwargs, refcolors, error):
"""Test categorical color."""
if error is None:
colors = prettypyplot.colors.categorical_color(nsc, color, **kwargs)
# convert colors to hex
if 'return_hex' not in kwargs or not kwargs['return_hex']:
colors = [clr.to_hex(c) for c in colors]
assert all(
c == clr.to_hex(rc) for c, rc in zip(colors, refcolors)
)
else:
with pytest.raises(error):
prettypyplot.colors.categorical_color(nsc, color, **kwargs)
@pytest.mark.parametrize('nc, nsc, kwargs, ref, error', [
(
2,
2,
{'cmap': 'tab10'},
[
[0.12, 0.47, 0.71],
[0.75, 0.9, 1.0],
[1.0, 0.5, 0.06],
[1.0, 0.87, 0.75],
],
None,
),
(
2,
2,
{},
[
[0.12, 0.47, 0.71],
[0.75, 0.9, 1.0],
[1.0, 0.5, 0.06],
[1.0, 0.87, 0.75],
],
None,
),
(
2,
2,
{'return_colors': True},
[
[0.12, 0.47, 0.71],
[0.75, 0.9, 1.0],
[1.0, 0.5, 0.06],
[1.0, 0.87, 0.75],
],
None,
),
(
1,
2,
{'cmap': 'jet'},
[[0.0, 0.0, 0.5], [0.75, 0.75, 1.0]],
None,
),
(2, 2, {'cmap': 'NoColorMap'}, None, ValueError),
(20, 2, {'cmap': 'tab10'}, None, ValueError),
(-2, 2, {}, None, ValueError),
(2, -2, {}, None, ValueError),
(2, -2, {}, None, ValueError),
])
def test_categorical_cmap(nc, nsc, kwargs, ref, error):
"""Test categorical cmap."""
if error is None:
colors = prettypyplot.colors.categorical_cmap(nc, nsc, **kwargs)
# convert colors to hex
if 'return_colors' in kwargs and kwargs['return_colors']:
colors = colors.reshape(-1, 3)
else:
colors = colors.colors
np.testing.assert_array_almost_equal(colors, ref, decimal=2)
else:
with pytest.raises(error):
prettypyplot.colors.categorical_cmap(nc, nsc, **kwargs)
# dummy coverage tests
def test_load_colors():
"""Check that no error get raised."""
prettypyplot.colors.load_colors()
def test_load_cmaps():
"""Check that no error get raised."""
prettypyplot.colors.load_cmaps()
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
51,
3558,
329,
262,
3124,
8265,
13,
198,
198,
21800,
513,
12,
2601,
682,
13789,
198,
15269,
357,
66,
8,
12131,
12,
1238,
2481,
11,
7806,
15196,
417,
198,
3237,
2489,
10395,
13,
198,
198,
37811,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
12972,
9288,
198,
6738,
2603,
29487,
8019,
1330,
7577,
355,
537,
81,
198,
198,
11748,
2495,
9078,
29487,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
22510,
11,
479,
86,
22046,
11,
4049,
3256,
685,
198,
220,
220,
220,
357,
16,
11,
1391,
5512,
6045,
828,
198,
220,
220,
220,
357,
17,
11,
1391,
6,
8929,
10354,
362,
5512,
6045,
828,
198,
220,
220,
220,
357,
17,
11,
1391,
5512,
11052,
12331,
828,
198,
220,
220,
220,
19203,
64,
3256,
1391,
5512,
5994,
12331,
828,
198,
220,
220,
220,
14808,
16,
11,
362,
828,
1391,
5512,
5994,
12331,
828,
198,
12962,
198,
4299,
1332,
834,
271,
62,
17618,
62,
259,
62,
9521,
7,
22510,
11,
479,
86,
22046,
11,
4049,
2599,
198,
220,
220,
220,
37227,
14402,
611,
1271,
318,
287,
2837,
526,
15931,
198,
220,
220,
220,
611,
4049,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13557,
271,
62,
17618,
62,
259,
62,
9521,
7,
22510,
11,
12429,
46265,
22046,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
18224,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13557,
271,
62,
17618,
62,
259,
62,
9521,
7,
22510,
11,
12429,
46265,
22046,
8,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
43,
16,
11,
406,
17,
11,
1006,
3642,
5685,
3256,
685,
198,
220,
220,
220,
357,
16,
11,
657,
11,
2310,
828,
357,
15,
13,
20,
11,
657,
13,
20,
11,
352,
828,
198,
12962,
198,
4299,
1332,
834,
3642,
5685,
7,
43,
16,
11,
406,
17,
11,
1006,
3642,
5685,
2599,
198,
220,
220,
220,
37227,
14402,
6273,
526,
15931,
198,
220,
220,
220,
329,
300,
16,
11,
300,
17,
287,
14808,
43,
16,
11,
406,
17,
828,
357,
43,
17,
11,
406,
16,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
6273,
796,
2495,
9078,
29487,
13,
4033,
669,
13557,
3642,
5685,
7,
75,
16,
11,
300,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
6273,
6624,
1006,
3642,
5685,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
81,
22296,
11,
1006,
75,
7230,
558,
3256,
685,
198,
220,
220,
220,
14808,
16,
11,
352,
11,
352,
828,
352,
828,
198,
220,
220,
220,
14808,
16,
11,
657,
11,
657,
828,
657,
13,
17,
19420,
828,
198,
220,
220,
220,
14808,
15,
11,
352,
11,
657,
828,
657,
13,
22,
17827,
828,
198,
220,
220,
220,
14808,
15,
11,
657,
11,
657,
828,
657,
828,
198,
12962,
198,
4299,
1332,
834,
43762,
62,
75,
7230,
590,
7,
81,
22296,
11,
1006,
75,
7230,
558,
2599,
198,
220,
220,
220,
37227,
14402,
29763,
590,
526,
15931,
198,
220,
220,
220,
29763,
590,
796,
2495,
9078,
29487,
13,
4033,
669,
13557,
43762,
62,
75,
7230,
590,
7,
81,
22296,
8,
198,
220,
220,
220,
6818,
29763,
590,
6624,
1006,
75,
7230,
558,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
35904,
8043,
11,
479,
86,
22046,
11,
1006,
8043,
11,
4049,
3256,
685,
198,
220,
220,
220,
19203,
86,
3256,
1391,
5512,
705,
2,
10535,
3256,
6045,
828,
198,
220,
220,
220,
19203,
65,
3256,
1391,
5512,
705,
2,
12927,
487,
3256,
6045,
828,
198,
220,
220,
220,
19203,
86,
3256,
1391,
6,
4033,
669,
10354,
19203,
81,
3256,
705,
86,
3256,
705,
74,
11537,
5512,
537,
81,
13,
1462,
62,
81,
22296,
10786,
74,
33809,
6045,
828,
198,
220,
220,
220,
19203,
86,
3256,
1391,
6,
4033,
669,
10354,
19203,
81,
3256,
705,
86,
11537,
5512,
537,
81,
13,
1462,
62,
81,
22296,
10786,
81,
33809,
6045,
828,
198,
220,
220,
220,
19203,
2,
1120,
1120,
1120,
3256,
1391,
5512,
705,
2,
12927,
487,
3256,
6045,
828,
198,
220,
220,
220,
19203,
2,
64,
15,
64,
15,
64,
15,
3256,
1391,
5512,
705,
2,
10535,
3256,
6045,
828,
198,
220,
220,
220,
19203,
1662,
2246,
45621,
10669,
3256,
1391,
5512,
6045,
11,
11052,
12331,
828,
198,
220,
220,
220,
19203,
86,
3256,
1391,
6,
4033,
669,
10354,
19203,
1662,
2246,
45621,
10669,
11537,
5512,
6045,
11,
11052,
12331,
828,
198,
12962,
198,
4299,
1332,
62,
5239,
62,
8043,
7,
35904,
8043,
11,
479,
86,
22046,
11,
1006,
8043,
11,
4049,
2599,
198,
220,
220,
220,
37227,
14402,
8636,
2420,
3124,
526,
15931,
198,
220,
220,
220,
611,
4049,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3124,
796,
2495,
9078,
29487,
13,
4033,
669,
13,
5239,
62,
8043,
7,
35904,
8043,
11,
12429,
46265,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
537,
81,
13,
1462,
62,
81,
22296,
7,
8043,
8,
6624,
537,
81,
13,
1462,
62,
81,
22296,
7,
5420,
8043,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
18224,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13,
5239,
62,
8043,
7,
35904,
8043,
11,
12429,
46265,
22046,
8,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
8043,
11,
1006,
30388,
11,
4049,
3256,
685,
198,
220,
220,
220,
19203,
74,
3256,
6407,
11,
6045,
828,
198,
220,
220,
220,
19203,
86,
3256,
6407,
11,
6045,
828,
198,
220,
220,
220,
19203,
81,
3256,
10352,
11,
6045,
828,
198,
220,
220,
220,
19203,
2,
21777,
19244,
3256,
6407,
11,
6045,
828,
198,
220,
220,
220,
19203,
2,
21777,
18376,
3256,
10352,
11,
6045,
828,
198,
220,
220,
220,
19203,
2949,
10258,
10669,
3256,
6045,
11,
11052,
12331,
828,
198,
12962,
198,
4299,
1332,
62,
271,
62,
2164,
592,
71,
671,
7,
8043,
11,
1006,
30388,
11,
4049,
2599,
198,
220,
220,
220,
37227,
14402,
611,
3124,
318,
12768,
17979,
526,
15931,
198,
220,
220,
220,
611,
4049,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
1006,
30388,
6624,
2495,
9078,
29487,
13,
4033,
669,
13,
271,
62,
16694,
893,
71,
671,
7,
8043,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
18224,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13,
271,
62,
16694,
893,
71,
671,
7,
8043,
8,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
77,
1416,
11,
3124,
11,
479,
86,
22046,
11,
1006,
4033,
669,
11,
4049,
3256,
685,
198,
220,
220,
220,
357,
17,
11,
705,
74,
3256,
1391,
5512,
16410,
15,
11,
657,
11,
657,
4357,
685,
15,
13,
2425,
11,
657,
13,
2425,
11,
657,
13,
2425,
60,
4357,
6045,
828,
198,
220,
220,
220,
357,
17,
11,
705,
74,
3256,
1391,
6,
7783,
62,
33095,
10354,
10352,
5512,
37250,
2,
10535,
3256,
705,
2,
19881,
19881,
19881,
6,
4357,
6045,
828,
198,
220,
220,
220,
357,
17,
11,
705,
74,
3256,
1391,
6,
7783,
62,
33095,
10354,
6407,
5512,
37250,
2,
10535,
3256,
705,
2,
19881,
19881,
19881,
6,
4357,
6045,
828,
198,
220,
220,
220,
357,
18,
11,
705,
81,
3256,
1391,
5512,
37250,
2,
487,
2388,
3256,
705,
2,
487,
1899,
1899,
3256,
705,
2,
487,
19881,
19881,
6,
4357,
6045,
828,
198,
220,
220,
220,
357,
18,
11,
705,
2949,
10258,
34,
12342,
3256,
1391,
5512,
6045,
11,
11052,
12331,
828,
198,
220,
220,
220,
357,
16,
13,
17,
11,
705,
74,
3256,
1391,
5512,
6045,
11,
5994,
12331,
828,
198,
220,
220,
220,
19203,
82,
3256,
705,
74,
3256,
1391,
5512,
6045,
11,
5994,
12331,
828,
198,
220,
220,
220,
357,
15,
11,
705,
74,
3256,
1391,
5512,
6045,
11,
11052,
12331,
828,
198,
220,
220,
220,
13841,
20,
11,
705,
74,
3256,
1391,
5512,
6045,
11,
11052,
12331,
828,
198,
12962,
198,
4299,
1332,
62,
66,
2397,
12409,
62,
8043,
7,
77,
1416,
11,
3124,
11,
479,
86,
22046,
11,
1006,
4033,
669,
11,
4049,
2599,
198,
220,
220,
220,
37227,
14402,
4253,
12409,
3124,
526,
15931,
198,
220,
220,
220,
611,
4049,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
7577,
796,
2495,
9078,
29487,
13,
4033,
669,
13,
66,
2397,
12409,
62,
8043,
7,
77,
1416,
11,
3124,
11,
12429,
46265,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
10385,
7577,
284,
17910,
198,
220,
220,
220,
220,
220,
220,
220,
611,
705,
7783,
62,
33095,
6,
407,
287,
479,
86,
22046,
393,
407,
479,
86,
22046,
17816,
7783,
62,
33095,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7577,
796,
685,
565,
81,
13,
1462,
62,
33095,
7,
66,
8,
329,
269,
287,
7577,
60,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
477,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
6624,
537,
81,
13,
1462,
62,
33095,
7,
6015,
8,
329,
269,
11,
48321,
287,
19974,
7,
4033,
669,
11,
1006,
4033,
669,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
18224,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13,
66,
2397,
12409,
62,
8043,
7,
77,
1416,
11,
3124,
11,
12429,
46265,
22046,
8,
628,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
10786,
10782,
11,
299,
1416,
11,
479,
86,
22046,
11,
1006,
11,
4049,
3256,
685,
198,
220,
220,
220,
357,
198,
220,
220,
220,
220,
220,
220,
220,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
6,
66,
8899,
10354,
705,
8658,
940,
6,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
13,
1065,
11,
657,
13,
2857,
11,
657,
13,
4869,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
13,
2425,
11,
657,
13,
24,
11,
352,
13,
15,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
16,
13,
15,
11,
657,
13,
20,
11,
657,
13,
3312,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
16,
13,
15,
11,
657,
13,
5774,
11,
657,
13,
2425,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
357,
198,
220,
220,
220,
220,
220,
220,
220,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
13,
1065,
11,
657,
13,
2857,
11,
657,
13,
4869,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
13,
2425,
11,
657,
13,
24,
11,
352,
13,
15,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
16,
13,
15,
11,
657,
13,
20,
11,
657,
13,
3312,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
16,
13,
15,
11,
657,
13,
5774,
11,
657,
13,
2425,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
357,
198,
220,
220,
220,
220,
220,
220,
220,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
6,
7783,
62,
4033,
669,
10354,
6407,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
13,
1065,
11,
657,
13,
2857,
11,
657,
13,
4869,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
15,
13,
2425,
11,
657,
13,
24,
11,
352,
13,
15,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
16,
13,
15,
11,
657,
13,
20,
11,
657,
13,
3312,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
16,
13,
15,
11,
657,
13,
5774,
11,
657,
13,
2425,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
357,
198,
220,
220,
220,
220,
220,
220,
220,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
6,
66,
8899,
10354,
705,
31173,
6,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
16410,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
20,
4357,
685,
15,
13,
2425,
11,
657,
13,
2425,
11,
352,
13,
15,
60,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
6045,
11,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
357,
17,
11,
362,
11,
1391,
6,
66,
8899,
10354,
705,
2949,
10258,
13912,
6,
5512,
6045,
11,
11052,
12331,
828,
198,
220,
220,
220,
357,
1238,
11,
362,
11,
1391,
6,
66,
8899,
10354,
705,
8658,
940,
6,
5512,
6045,
11,
11052,
12331,
828,
198,
220,
220,
220,
13841,
17,
11,
362,
11,
1391,
5512,
6045,
11,
11052,
12331,
828,
198,
220,
220,
220,
357,
17,
11,
532,
17,
11,
1391,
5512,
6045,
11,
11052,
12331,
828,
198,
220,
220,
220,
357,
17,
11,
532,
17,
11,
1391,
5512,
6045,
11,
11052,
12331,
828,
198,
12962,
198,
4299,
1332,
62,
66,
2397,
12409,
62,
66,
8899,
7,
10782,
11,
299,
1416,
11,
479,
86,
22046,
11,
1006,
11,
4049,
2599,
198,
220,
220,
220,
37227,
14402,
4253,
12409,
269,
8899,
526,
15931,
198,
220,
220,
220,
611,
4049,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
7577,
796,
2495,
9078,
29487,
13,
4033,
669,
13,
66,
2397,
12409,
62,
66,
8899,
7,
10782,
11,
299,
1416,
11,
12429,
46265,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
10385,
7577,
284,
17910,
198,
220,
220,
220,
220,
220,
220,
220,
611,
705,
7783,
62,
4033,
669,
6,
287,
479,
86,
22046,
290,
479,
86,
22046,
17816,
7783,
62,
4033,
669,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7577,
796,
7577,
13,
3447,
1758,
32590,
16,
11,
513,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7577,
796,
7577,
13,
4033,
669,
198,
220,
220,
220,
220,
220,
220,
220,
45941,
13,
33407,
13,
30493,
62,
18747,
62,
28177,
62,
40496,
7,
4033,
669,
11,
1006,
11,
32465,
28,
17,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
18224,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13,
66,
2397,
12409,
62,
66,
8899,
7,
10782,
11,
299,
1416,
11,
12429,
46265,
22046,
8,
628,
198,
2,
31548,
5197,
5254,
198,
4299,
1332,
62,
2220,
62,
4033,
669,
33529,
198,
220,
220,
220,
37227,
9787,
326,
645,
4049,
651,
4376,
526,
15931,
198,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13,
2220,
62,
4033,
669,
3419,
628,
198,
4299,
1332,
62,
2220,
62,
11215,
1686,
33529,
198,
220,
220,
220,
37227,
9787,
326,
645,
4049,
651,
4376,
526,
15931,
198,
220,
220,
220,
2495,
9078,
29487,
13,
4033,
669,
13,
2220,
62,
11215,
1686,
3419,
198
] | 1.998542 | 2,744 |
from typing import Text
import os
import pytest
from rasa.constants import (DEFAULT_DOMAIN_PATH, DEFAULT_CONFIG_PATH,
DEFAULT_MODELS_PATH, DEFAULT_DATA_PATH)
@pytest.fixture(scope="session")
@pytest.fixture(scope="session")
| [
6738,
19720,
1330,
8255,
198,
11748,
28686,
198,
11748,
12972,
9288,
198,
198,
6738,
374,
15462,
13,
9979,
1187,
1330,
357,
7206,
38865,
62,
39170,
29833,
62,
34219,
11,
5550,
38865,
62,
10943,
16254,
62,
34219,
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,
5550,
38865,
62,
33365,
37142,
62,
34219,
11,
5550,
38865,
62,
26947,
62,
34219,
8,
628,
198,
31,
9078,
9288,
13,
69,
9602,
7,
29982,
2625,
29891,
4943,
628,
198,
198,
31,
9078,
9288,
13,
69,
9602,
7,
29982,
2625,
29891,
4943,
198
] | 2.388889 | 108 |
# pylint: disable = missing-docstring
import pytest
from bases import encoding
from bases.encoding import BaseEncoding
from bases import random
from bases.random import rand_str
random.set_options(min_bytes=0, max_bytes=16)
nsamples = 1024
@pytest.mark.parametrize("enc_name,enc", list(encoding.table()))
| [
2,
279,
2645,
600,
25,
15560,
796,
4814,
12,
15390,
8841,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
12536,
1330,
21004,
198,
6738,
12536,
13,
12685,
7656,
1330,
7308,
27195,
7656,
198,
6738,
12536,
1330,
4738,
198,
6738,
12536,
13,
25120,
1330,
43720,
62,
2536,
198,
198,
25120,
13,
2617,
62,
25811,
7,
1084,
62,
33661,
28,
15,
11,
3509,
62,
33661,
28,
1433,
8,
198,
5907,
12629,
796,
28119,
198,
198,
31,
9078,
9288,
13,
4102,
13,
17143,
316,
380,
2736,
7203,
12685,
62,
3672,
11,
12685,
1600,
1351,
7,
12685,
7656,
13,
11487,
3419,
4008,
198
] | 3.121212 | 99 |
from marshmallow import Schema, fields
| [
6738,
22397,
42725,
1330,
10011,
2611,
11,
7032,
198
] | 4.333333 | 9 |
from pydantic import validator, Field
from pystratis.api import Model
# noinspection PyUnresolvedReferences
class AddNodeRequest(Model):
"""A request model for the connectionmanager/addnode endpoint.
Args:
ipaddr (str): The endpoint.
command (str): Allowed commands [add, remove, onetry]
"""
ipaddr: str = Field(alias='endpoint')
command: str
# noinspection PyMethodParameters,PyUnusedLocal
@validator('command')
| [
6738,
279,
5173,
5109,
1330,
4938,
1352,
11,
7663,
198,
6738,
12972,
2536,
37749,
13,
15042,
1330,
9104,
628,
198,
2,
645,
1040,
14978,
9485,
3118,
411,
5634,
19927,
198,
4871,
3060,
19667,
18453,
7,
17633,
2599,
198,
220,
220,
220,
37227,
32,
2581,
2746,
329,
262,
4637,
37153,
14,
2860,
17440,
36123,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20966,
29851,
357,
2536,
2599,
383,
36123,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3141,
357,
2536,
2599,
1439,
6972,
9729,
685,
2860,
11,
4781,
11,
319,
11973,
60,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
20966,
29851,
25,
965,
796,
7663,
7,
26011,
11639,
437,
4122,
11537,
198,
220,
220,
220,
3141,
25,
965,
628,
220,
220,
220,
1303,
645,
1040,
14978,
9485,
17410,
48944,
11,
20519,
3118,
1484,
14565,
198,
220,
220,
220,
2488,
12102,
1352,
10786,
21812,
11537,
198
] | 2.974194 | 155 |
import os
PATH = os.path.abspath(os.path.dirname(__file__))
| [
11748,
28686,
198,
198,
34219,
796,
28686,
13,
6978,
13,
397,
2777,
776,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
4008,
198
] | 2.346154 | 26 |
import urllib
from django.forms.fields import CharField
from django.utils.translation import ugettext_lazy as _
from django.views.generic import View
from .exceptions import PopupViewIsNotSubclassView
from .widgets import PopupViewWidget
| [
11748,
2956,
297,
571,
198,
198,
6738,
42625,
14208,
13,
23914,
13,
25747,
1330,
3178,
15878,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
334,
1136,
5239,
62,
75,
12582,
355,
4808,
198,
6738,
42625,
14208,
13,
33571,
13,
41357,
1330,
3582,
198,
198,
6738,
764,
1069,
11755,
1330,
8099,
929,
7680,
3792,
3673,
7004,
4871,
7680,
198,
6738,
764,
28029,
11407,
1330,
8099,
929,
7680,
38300,
628
] | 3.492754 | 69 |
from browser import document as doc
from browser.html import TABLE, TR, TH, TD, INPUT, SELECT, OPTION, DIV, BUTTON, SPAN, LI, H2, H3, IMG, COLGROUP, COL, P, SECTION, BR
from json import load
from last_update import time
# Create the static elements of the home page
init_page()
doc['loading'] <= DIV(Id='prerendered')
| [
6738,
6444,
1330,
3188,
355,
2205,
198,
6738,
6444,
13,
6494,
1330,
43679,
11,
7579,
11,
2320,
11,
13320,
11,
3268,
30076,
11,
33493,
11,
39852,
2849,
11,
360,
3824,
11,
21728,
11357,
11,
6226,
1565,
11,
24653,
11,
367,
17,
11,
367,
18,
11,
8959,
38,
11,
20444,
46846,
11,
20444,
11,
350,
11,
44513,
11,
11177,
198,
6738,
33918,
1330,
3440,
198,
6738,
938,
62,
19119,
1330,
640,
628,
198,
2,
13610,
262,
9037,
4847,
286,
262,
1363,
2443,
628,
198,
15003,
62,
7700,
3419,
198,
15390,
17816,
25138,
20520,
19841,
360,
3824,
7,
7390,
11639,
3866,
26238,
11537,
198
] | 3.156863 | 102 |
"""Conversion functions for weather radar and rainfall data."""
from numpy import isfinite, log, ubyte
from scipy.ndimage import gaussian_filter
from skimage.exposure import equalize_hist, rescale_intensity
def dBZ_to_ubyte(I, dBZ_min=-10.0, dBZ_max=50.0, filter_stddev=3.0):
"""Convert a dBZ field into a 8-bit image, as required by Optflow. Optionally,
apply a Gaussian smoothing filter.
Parameters
----------
I : array-like
The dBZ field.
dBZ_min : float
Minimum dBZ. Values smaller than dBZ_min are set to dBZ_min. If None,
dBZ_min is computed from I.
dBZ_max : float
Maximum dBZ. Values greater than dBZ_max are set to dBZ_max. If None,
dBZ_max is computed from I.
filter_stddev : float
Standard deviation of the Gaussian filter (0=no filtering)
Returns
-------
out : ndarray(dtype=ubyte)
The processed dBZ field.
"""
I = I.copy()
MASK = isfinite(I)
if dBZ_min == None:
dBZ_min = min(I[MASK])
if dBZ_max == None:
dBZ_max = max(I[MASK])
I[~MASK] = dBZ_min
I[I < dBZ_min] = dBZ_min
I[I > dBZ_max] = dBZ_max
if filter_stddev > 0.0:
I = gaussian_filter(I, filter_stddev, mode="reflect")
I = ((I - dBZ_min) / (dBZ_max - dBZ_min)) * 255.0
return I.astype(ubyte)
def rainfall_to_ubyte(I, R_min=0.1, R_max=40.0, filter_stddev=3.0, logtrans=False):
"""Convert a rainfall intensity field into a 8-bit image, as required by
Optflow. Optionally, apply a Gaussian smoothing filter.
Parameters
----------
I : array-like
The input rainfall field.
R_min : float
Minimum rainfall intensity. Values smaller than R_min are set to R_min.
If None, R_min is computed from I.
R_max : float
Maximum rainfall intensity. Values greater than R_max are set to R_max.
If None, R_max is computed from I.
filter_stddev : float
Standard deviation of the Gaussian filter (0=no filtering)
logtrans : bool
If True, apply a log-transform to the input rainfall field. In this case,
R_min must be nonzero.
Returns
-------
out : ndarray(dtype=ubyte)
The processed rainfall field.
"""
I = I.copy()
MASK = isfinite(I)
if R_min == None:
R_min = min(I[MASK])
if R_max == None:
R_max = max(I[MASK])
I[~MASK] = R_min
I[I < R_min] = R_min
I[I > R_max] = R_max
if logtrans == True:
if R_min == 0.0:
raise ValueError("R_min must be nonzero if log-transform is used")
I = log(I)
R_min = log(R_min)
R_max = log(R_max)
# TESTING
#I = rescale_intensity(I, (R_min, R_max), (0.0, 1.0))
#I = equalize_hist(I)
#I = ((I - min(I)) / (max(I) - min(I))) * 255.0
MASK = I > R_min
# TODO: Make the threshold 128 configurable.
I[MASK] = 128.0 + ((I[MASK] - R_min) / (R_max - R_min)) * (255.0 - 128.0)
I[~MASK] = 0.0
I = I.astype(ubyte)
if filter_stddev > 0.0:
I = gaussian_filter(I, filter_stddev, mode="reflect")
return I
| [
37811,
3103,
9641,
5499,
329,
6193,
13428,
290,
25807,
1366,
526,
15931,
198,
198,
6738,
299,
32152,
1330,
318,
69,
9504,
11,
2604,
11,
334,
26327,
198,
6738,
629,
541,
88,
13,
358,
9060,
1330,
31986,
31562,
62,
24455,
198,
6738,
1341,
9060,
13,
1069,
26205,
1330,
4961,
1096,
62,
10034,
11,
6811,
1000,
62,
47799,
198,
198,
4299,
30221,
57,
62,
1462,
62,
549,
88,
660,
7,
40,
11,
30221,
57,
62,
1084,
10779,
940,
13,
15,
11,
30221,
57,
62,
9806,
28,
1120,
13,
15,
11,
8106,
62,
301,
1860,
1990,
28,
18,
13,
15,
2599,
198,
220,
37227,
3103,
1851,
257,
30221,
57,
2214,
656,
257,
807,
12,
2545,
2939,
11,
355,
2672,
416,
13123,
11125,
13,
16018,
453,
11,
220,
198,
220,
4174,
257,
12822,
31562,
32746,
722,
8106,
13,
198,
220,
220,
198,
220,
40117,
198,
220,
24200,
438,
198,
220,
314,
1058,
7177,
12,
2339,
198,
220,
220,
220,
383,
30221,
57,
2214,
13,
198,
220,
30221,
57,
62,
1084,
1058,
12178,
198,
220,
220,
220,
26265,
30221,
57,
13,
27068,
4833,
621,
30221,
57,
62,
1084,
389,
900,
284,
30221,
57,
62,
1084,
13,
1002,
6045,
11,
220,
198,
220,
220,
220,
30221,
57,
62,
1084,
318,
29231,
422,
314,
13,
198,
220,
30221,
57,
62,
9806,
1058,
12178,
198,
220,
220,
220,
22246,
30221,
57,
13,
27068,
3744,
621,
30221,
57,
62,
9806,
389,
900,
284,
30221,
57,
62,
9806,
13,
1002,
6045,
11,
220,
198,
220,
220,
220,
30221,
57,
62,
9806,
318,
29231,
422,
314,
13,
198,
220,
8106,
62,
301,
1860,
1990,
1058,
12178,
198,
220,
220,
220,
8997,
28833,
286,
262,
12822,
31562,
8106,
357,
15,
28,
3919,
25431,
8,
198,
220,
220,
198,
220,
16409,
198,
220,
35656,
198,
220,
503,
1058,
299,
67,
18747,
7,
67,
4906,
28,
549,
88,
660,
8,
198,
220,
220,
220,
383,
13686,
30221,
57,
2214,
13,
198,
220,
37227,
198,
220,
314,
796,
314,
13,
30073,
3419,
198,
220,
32337,
42,
796,
318,
69,
9504,
7,
40,
8,
198,
220,
220,
198,
220,
611,
30221,
57,
62,
1084,
6624,
6045,
25,
198,
220,
220,
220,
30221,
57,
62,
1084,
796,
949,
7,
40,
58,
31180,
42,
12962,
198,
220,
611,
30221,
57,
62,
9806,
6624,
6045,
25,
198,
220,
220,
220,
30221,
57,
62,
9806,
796,
3509,
7,
40,
58,
31180,
42,
12962,
198,
220,
220,
198,
220,
314,
58,
93,
31180,
42,
60,
796,
30221,
57,
62,
1084,
198,
220,
314,
58,
40,
1279,
30221,
57,
62,
1084,
60,
796,
30221,
57,
62,
1084,
198,
220,
314,
58,
40,
1875,
30221,
57,
62,
9806,
60,
796,
30221,
57,
62,
9806,
198,
220,
220,
198,
220,
611,
8106,
62,
301,
1860,
1990,
1875,
657,
13,
15,
25,
198,
220,
220,
220,
314,
796,
31986,
31562,
62,
24455,
7,
40,
11,
8106,
62,
301,
1860,
1990,
11,
4235,
2625,
35051,
4943,
198,
220,
220,
198,
220,
314,
796,
14808,
40,
532,
30221,
57,
62,
1084,
8,
1220,
357,
36077,
57,
62,
9806,
532,
30221,
57,
62,
1084,
4008,
1635,
14280,
13,
15,
198,
220,
220,
198,
220,
1441,
314,
13,
459,
2981,
7,
549,
88,
660,
8,
198,
198,
4299,
25807,
62,
1462,
62,
549,
88,
660,
7,
40,
11,
371,
62,
1084,
28,
15,
13,
16,
11,
371,
62,
9806,
28,
1821,
13,
15,
11,
8106,
62,
301,
1860,
1990,
28,
18,
13,
15,
11,
2604,
7645,
28,
25101,
2599,
198,
220,
37227,
3103,
1851,
257,
25807,
12245,
2214,
656,
257,
807,
12,
2545,
2939,
11,
355,
2672,
416,
220,
198,
220,
13123,
11125,
13,
16018,
453,
11,
4174,
257,
12822,
31562,
32746,
722,
8106,
13,
198,
220,
220,
198,
220,
40117,
198,
220,
24200,
438,
198,
220,
314,
1058,
7177,
12,
2339,
198,
220,
220,
220,
383,
5128,
25807,
2214,
13,
198,
220,
371,
62,
1084,
1058,
12178,
198,
220,
220,
220,
26265,
25807,
12245,
13,
27068,
4833,
621,
371,
62,
1084,
389,
900,
284,
371,
62,
1084,
13,
220,
198,
220,
220,
220,
1002,
6045,
11,
371,
62,
1084,
318,
29231,
422,
314,
13,
198,
220,
371,
62,
9806,
1058,
12178,
198,
220,
220,
220,
22246,
25807,
12245,
13,
27068,
3744,
621,
371,
62,
9806,
389,
900,
284,
371,
62,
9806,
13,
220,
198,
220,
220,
220,
1002,
6045,
11,
371,
62,
9806,
318,
29231,
422,
314,
13,
198,
220,
8106,
62,
301,
1860,
1990,
1058,
12178,
198,
220,
220,
220,
8997,
28833,
286,
262,
12822,
31562,
8106,
357,
15,
28,
3919,
25431,
8,
198,
220,
2604,
7645,
1058,
20512,
198,
220,
220,
220,
1002,
6407,
11,
4174,
257,
2604,
12,
35636,
284,
262,
5128,
25807,
2214,
13,
554,
428,
1339,
11,
220,
198,
220,
220,
220,
371,
62,
1084,
1276,
307,
1729,
22570,
13,
198,
220,
220,
198,
220,
16409,
198,
220,
35656,
198,
220,
503,
1058,
299,
67,
18747,
7,
67,
4906,
28,
549,
88,
660,
8,
198,
220,
220,
220,
383,
13686,
25807,
2214,
13,
198,
220,
37227,
198,
220,
314,
796,
314,
13,
30073,
3419,
198,
220,
32337,
42,
796,
318,
69,
9504,
7,
40,
8,
198,
220,
220,
198,
220,
611,
371,
62,
1084,
6624,
6045,
25,
198,
220,
220,
220,
371,
62,
1084,
796,
949,
7,
40,
58,
31180,
42,
12962,
198,
220,
611,
371,
62,
9806,
6624,
6045,
25,
198,
220,
220,
220,
371,
62,
9806,
796,
3509,
7,
40,
58,
31180,
42,
12962,
198,
220,
220,
198,
220,
314,
58,
93,
31180,
42,
60,
796,
371,
62,
1084,
198,
220,
314,
58,
40,
1279,
371,
62,
1084,
60,
796,
371,
62,
1084,
198,
220,
314,
58,
40,
1875,
371,
62,
9806,
60,
796,
371,
62,
9806,
198,
220,
220,
198,
220,
611,
2604,
7645,
6624,
6407,
25,
198,
220,
220,
220,
611,
371,
62,
1084,
6624,
657,
13,
15,
25,
198,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7203,
49,
62,
1084,
1276,
307,
1729,
22570,
611,
2604,
12,
35636,
318,
973,
4943,
198,
220,
220,
220,
314,
796,
2604,
7,
40,
8,
198,
220,
220,
220,
371,
62,
1084,
796,
2604,
7,
49,
62,
1084,
8,
198,
220,
220,
220,
371,
62,
9806,
796,
2604,
7,
49,
62,
9806,
8,
198,
220,
220,
198,
220,
1303,
43001,
2751,
198,
220,
1303,
40,
796,
6811,
1000,
62,
47799,
7,
40,
11,
357,
49,
62,
1084,
11,
371,
62,
9806,
828,
357,
15,
13,
15,
11,
352,
13,
15,
4008,
198,
220,
1303,
40,
796,
4961,
1096,
62,
10034,
7,
40,
8,
198,
220,
1303,
40,
796,
14808,
40,
532,
949,
7,
40,
4008,
1220,
357,
9806,
7,
40,
8,
532,
949,
7,
40,
22305,
1635,
14280,
13,
15,
198,
220,
220,
198,
220,
32337,
42,
796,
314,
1875,
371,
62,
1084,
198,
220,
1303,
16926,
46,
25,
6889,
262,
11387,
13108,
4566,
11970,
13,
198,
220,
314,
58,
31180,
42,
60,
796,
13108,
13,
15,
1343,
14808,
40,
58,
31180,
42,
60,
532,
371,
62,
1084,
8,
1220,
357,
49,
62,
9806,
532,
371,
62,
1084,
4008,
1635,
357,
13381,
13,
15,
532,
13108,
13,
15,
8,
198,
220,
314,
58,
93,
31180,
42,
60,
796,
657,
13,
15,
198,
220,
220,
198,
220,
314,
796,
314,
13,
459,
2981,
7,
549,
88,
660,
8,
198,
220,
220,
198,
220,
611,
8106,
62,
301,
1860,
1990,
1875,
657,
13,
15,
25,
198,
220,
220,
220,
314,
796,
31986,
31562,
62,
24455,
7,
40,
11,
8106,
62,
301,
1860,
1990,
11,
4235,
2625,
35051,
4943,
198,
220,
220,
198,
220,
1441,
314,
198
] | 2.368463 | 1,243 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from .vendor.Qt import QtWidgets
from .libs.maya import fbx
from .libs.maya import namespace
from . import history_helper
def import_fbx(path, import_mode, parent):
"""import fbx
Args:
path (unicode): path
import_mode (.libs.maya.fbx.FBXImportMode): import mode
parent (QtWidgets.QWidget): parent
"""
namespaces = namespace.get_namespaces(return_separator=True, return_root=True)
if len(namespaces) == 1:
fbx.import_fbx(path, import_mode, namespaces[0])
history_helper.add_recent_file(path)
return
ns, confirmed = QtWidgets.QInputDialog.getItem(parent,
"Select Namespace",
"Namespace",
namespaces,
0,
False)
if not confirmed:
return
fbx.import_fbx(path, import_mode, ns)
history_helper.add_recent_file(path)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
7297,
11,
3601,
62,
8818,
198,
198,
6738,
764,
85,
18738,
13,
48,
83,
1330,
33734,
54,
312,
11407,
198,
198,
6738,
764,
8019,
82,
13,
11261,
64,
1330,
277,
65,
87,
198,
6738,
764,
8019,
82,
13,
11261,
64,
1330,
25745,
198,
6738,
764,
1330,
2106,
62,
2978,
525,
628,
198,
4299,
1330,
62,
21855,
87,
7,
6978,
11,
1330,
62,
14171,
11,
2560,
2599,
198,
220,
220,
220,
37227,
11748,
277,
65,
87,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3108,
357,
46903,
1098,
2599,
3108,
198,
220,
220,
220,
220,
220,
220,
220,
1330,
62,
14171,
20262,
8019,
82,
13,
11261,
64,
13,
21855,
87,
13,
26001,
55,
20939,
19076,
2599,
1330,
4235,
198,
220,
220,
220,
220,
220,
220,
220,
2560,
357,
48,
83,
54,
312,
11407,
13,
48,
38300,
2599,
2560,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3891,
43076,
796,
25745,
13,
1136,
62,
14933,
43076,
7,
7783,
62,
25512,
1352,
28,
17821,
11,
1441,
62,
15763,
28,
17821,
8,
628,
220,
220,
220,
611,
18896,
7,
14933,
43076,
8,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
277,
65,
87,
13,
11748,
62,
21855,
87,
7,
6978,
11,
1330,
62,
14171,
11,
3891,
43076,
58,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2106,
62,
2978,
525,
13,
2860,
62,
49921,
62,
7753,
7,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
36545,
11,
4999,
796,
33734,
54,
312,
11407,
13,
48,
20560,
44204,
13,
1136,
7449,
7,
8000,
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,
366,
17563,
28531,
10223,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
36690,
10223,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3891,
43076,
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,
657,
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,
10352,
8,
198,
220,
220,
220,
611,
407,
4999,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
277,
65,
87,
13,
11748,
62,
21855,
87,
7,
6978,
11,
1330,
62,
14171,
11,
36545,
8,
198,
220,
220,
220,
2106,
62,
2978,
525,
13,
2860,
62,
49921,
62,
7753,
7,
6978,
8,
198
] | 1.861066 | 619 |
from sqlalchemy import schema
from sqlalchemy.orm import Session
from fastapi import Depends, APIRouter, HTTPException, status
from fastapi.security.oauth2 import OAuth2PasswordRequestForm
from .. import db, models, schemas, utils, oauth2
router = APIRouter(
tags=["Authentication"],
)
@router.post("/login", response_model=schemas.Token)
| [
6738,
44161,
282,
26599,
1330,
32815,
198,
6738,
44161,
282,
26599,
13,
579,
1330,
23575,
198,
6738,
3049,
15042,
1330,
2129,
2412,
11,
3486,
4663,
39605,
11,
14626,
16922,
11,
3722,
198,
6738,
3049,
15042,
13,
12961,
13,
12162,
1071,
17,
1330,
440,
30515,
17,
35215,
18453,
8479,
198,
198,
6738,
11485,
1330,
20613,
11,
4981,
11,
3897,
5356,
11,
3384,
4487,
11,
267,
18439,
17,
628,
198,
472,
353,
796,
3486,
4663,
39605,
7,
198,
220,
220,
220,
15940,
28,
14692,
47649,
3299,
33116,
198,
8,
628,
198,
31,
472,
353,
13,
7353,
7203,
14,
38235,
1600,
2882,
62,
19849,
28,
1416,
4411,
292,
13,
30642,
8,
198
] | 3.192661 | 109 |
import logging
import os
from aiohttp import web, WSMsgType
from aiohttp.web_response import Response
from jsonrpcserver.aio import methods
from sn_agent import ontology
from sn_agent.api.job import can_perform_service, perform_job
from sn_agent.job.job_descriptor import JobDescriptor
from sn_agent.ontology.service_descriptor import ServiceDescriptor
logger = logging.getLogger(__name__)
WS_FILE = os.path.join(os.path.dirname(__file__), 'websocket.html')
@methods.add
@methods.add
| [
11748,
18931,
198,
11748,
28686,
198,
198,
6738,
257,
952,
4023,
1330,
3992,
11,
25290,
50108,
6030,
198,
6738,
257,
952,
4023,
13,
12384,
62,
26209,
1330,
18261,
198,
6738,
33918,
81,
14751,
15388,
13,
64,
952,
1330,
5050,
198,
198,
6738,
3013,
62,
25781,
1330,
39585,
1435,
198,
6738,
3013,
62,
25781,
13,
15042,
13,
21858,
1330,
460,
62,
525,
687,
62,
15271,
11,
1620,
62,
21858,
198,
6738,
3013,
62,
25781,
13,
21858,
13,
21858,
62,
20147,
1968,
273,
1330,
15768,
24564,
1968,
273,
198,
6738,
3013,
62,
25781,
13,
756,
1435,
13,
15271,
62,
20147,
1968,
273,
1330,
4809,
24564,
1968,
273,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
198,
19416,
62,
25664,
796,
28686,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
828,
705,
732,
1443,
5459,
13,
6494,
11537,
628,
198,
31,
24396,
82,
13,
2860,
628,
198,
31,
24396,
82,
13,
2860,
628,
628,
198
] | 2.97006 | 167 |
maior = 0
menor = 0
for p in range(1, 6):
peso = float(input(f'Digite a massa da {p}º pessoa em quilos: '))
if p == 1:
maior = peso
menor = peso
else:
if peso > maior:
maior = peso
if peso < menor:
menor = peso
print('O maior peso lido foi de {}Kg'.format(maior))
print('O menor peso lido foi de {}Kg'.format(menor)) | [
2611,
1504,
796,
657,
198,
3653,
273,
796,
657,
198,
1640,
279,
287,
2837,
7,
16,
11,
718,
2599,
198,
220,
220,
220,
32317,
78,
796,
12178,
7,
15414,
7,
69,
6,
19511,
578,
257,
2347,
64,
12379,
1391,
79,
92,
36165,
279,
408,
12162,
795,
627,
346,
418,
25,
705,
4008,
198,
220,
220,
220,
611,
279,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
17266,
1504,
796,
32317,
78,
198,
220,
220,
220,
220,
220,
220,
220,
1450,
273,
796,
32317,
78,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
32317,
78,
1875,
17266,
1504,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17266,
1504,
796,
32317,
78,
198,
220,
220,
220,
220,
220,
220,
220,
611,
32317,
78,
1279,
1450,
273,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1450,
273,
796,
32317,
78,
198,
4798,
10786,
46,
17266,
1504,
32317,
78,
300,
17305,
11511,
72,
390,
23884,
42,
70,
4458,
18982,
7,
2611,
1504,
4008,
198,
4798,
10786,
46,
1450,
273,
32317,
78,
300,
17305,
11511,
72,
390,
23884,
42,
70,
4458,
18982,
7,
3653,
273,
4008
] | 1.910448 | 201 |
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2022 Amano Team
from pyrogram import types
from pyrogram.helpers import bki, ikb
from userlixo.database import Message
| [
2,
30628,
55,
12,
34156,
12,
33234,
7483,
25,
17168,
198,
2,
15069,
357,
66,
8,
2864,
12,
1238,
1828,
42614,
78,
4816,
198,
198,
6738,
12972,
39529,
1330,
3858,
198,
6738,
12972,
39529,
13,
16794,
364,
1330,
275,
4106,
11,
220,
1134,
65,
198,
198,
6738,
2836,
75,
844,
78,
13,
48806,
1330,
16000,
628,
628,
198
] | 3.051724 | 58 |
import matplotlib.pyplot as plt
import sys
import os
outDir = sys.argv[1]
finalOutDir = outDir + '/figure3d/'
if not os.path.exists(finalOutDir):
os.makedirs(finalOutDir)
#make a plot showing the true positive and false positive rates of each method.
#each sv type will get its own icon, and methods can be labeled by color
methods = ['chrCV MIL', 'chrCV simple RF', 'VEP', 'SVScore']
methodColors = ['#0055d4ff', '#c83737ff', 'orange', '#808080ff']
#These are obtained from running the individual scripts for each method (see workflow.sh)
tprsDEL = [0.53, 0.56, 0.02, 0.009]
fprsDEL = [0.20, 0.56, 0.2, 0.09]
tprsDUP = [0.58, 0.45, 0.08, 0.03]
fprsDUP = [0.30, 0.46, 0.46, 0.08]
tprsINV = [0.60, 0.38, 0, 0.007]
fprsINV = [0.25, 0.37, 0, 0.03]
tprsITX = [0.62, 0.47, 0, 0]
fprsITX = [0.30, 0.43, 0, 0.02]
#make the scatter plot
plt.scatter(fprsDEL, tprsDEL, marker='.', facecolor=methodColors, edgecolor=methodColors)
plt.scatter(fprsDUP, tprsDUP, marker='s', facecolor=methodColors, edgecolor=methodColors)
plt.scatter(fprsINV, tprsINV, marker='^', facecolor=methodColors, edgecolor=methodColors)
plt.scatter(fprsITX, tprsITX, marker='*', facecolor=methodColors, edgecolor=methodColors)
plt.savefig(finalOutDir + '/tpr_fpr.svg')
| [
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
25064,
198,
11748,
28686,
198,
198,
448,
35277,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
198,
20311,
7975,
35277,
796,
503,
35277,
1343,
31051,
26875,
18,
67,
14,
6,
198,
361,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
20311,
7975,
35277,
2599,
198,
197,
418,
13,
76,
4335,
17062,
7,
20311,
7975,
35277,
8,
198,
198,
2,
15883,
257,
7110,
4478,
262,
2081,
3967,
290,
3991,
3967,
3965,
286,
1123,
2446,
13,
198,
2,
27379,
38487,
2099,
481,
651,
663,
898,
7196,
11,
290,
5050,
460,
307,
15494,
416,
3124,
198,
198,
24396,
82,
796,
37250,
354,
81,
33538,
31515,
3256,
705,
354,
81,
33538,
2829,
20445,
3256,
705,
6089,
47,
3256,
705,
50,
53,
26595,
20520,
198,
24396,
5216,
669,
796,
37250,
2,
405,
2816,
67,
19,
487,
3256,
705,
2,
66,
23,
2718,
2718,
487,
3256,
705,
43745,
3256,
705,
2,
1795,
1795,
1795,
487,
20520,
198,
198,
2,
4711,
389,
6492,
422,
2491,
262,
1981,
14750,
329,
1123,
2446,
357,
3826,
30798,
13,
1477,
8,
198,
83,
1050,
82,
35,
3698,
796,
685,
15,
13,
4310,
11,
657,
13,
3980,
11,
657,
13,
2999,
11,
657,
13,
28694,
60,
198,
69,
1050,
82,
35,
3698,
796,
685,
15,
13,
1238,
11,
657,
13,
3980,
11,
657,
13,
17,
11,
657,
13,
2931,
60,
198,
198,
83,
1050,
82,
35,
8577,
796,
685,
15,
13,
3365,
11,
657,
13,
2231,
11,
657,
13,
2919,
11,
657,
13,
3070,
60,
198,
69,
1050,
82,
35,
8577,
796,
685,
15,
13,
1270,
11,
657,
13,
3510,
11,
657,
13,
3510,
11,
657,
13,
2919,
60,
198,
198,
83,
1050,
82,
1268,
53,
796,
685,
15,
13,
1899,
11,
657,
13,
2548,
11,
657,
11,
657,
13,
25816,
60,
198,
69,
1050,
82,
1268,
53,
796,
685,
15,
13,
1495,
11,
657,
13,
2718,
11,
657,
11,
657,
13,
3070,
60,
198,
198,
83,
1050,
82,
2043,
55,
796,
685,
15,
13,
5237,
11,
657,
13,
2857,
11,
657,
11,
657,
60,
198,
69,
1050,
82,
2043,
55,
796,
685,
15,
13,
1270,
11,
657,
13,
3559,
11,
657,
11,
657,
13,
2999,
60,
198,
198,
2,
15883,
262,
41058,
7110,
198,
489,
83,
13,
1416,
1436,
7,
69,
1050,
82,
35,
3698,
11,
256,
1050,
82,
35,
3698,
11,
18364,
11639,
2637,
11,
1986,
8043,
28,
24396,
5216,
669,
11,
5743,
8043,
28,
24396,
5216,
669,
8,
198,
489,
83,
13,
1416,
1436,
7,
69,
1050,
82,
35,
8577,
11,
256,
1050,
82,
35,
8577,
11,
18364,
11639,
82,
3256,
1986,
8043,
28,
24396,
5216,
669,
11,
5743,
8043,
28,
24396,
5216,
669,
8,
198,
489,
83,
13,
1416,
1436,
7,
69,
1050,
82,
1268,
53,
11,
256,
1050,
82,
1268,
53,
11,
18364,
11639,
61,
3256,
1986,
8043,
28,
24396,
5216,
669,
11,
5743,
8043,
28,
24396,
5216,
669,
8,
198,
489,
83,
13,
1416,
1436,
7,
69,
1050,
82,
2043,
55,
11,
256,
1050,
82,
2043,
55,
11,
18364,
11639,
9,
3256,
1986,
8043,
28,
24396,
5216,
669,
11,
5743,
8043,
28,
24396,
5216,
669,
8,
198,
198,
489,
83,
13,
21928,
5647,
7,
20311,
7975,
35277,
1343,
31051,
83,
1050,
62,
69,
1050,
13,
21370,
70,
11537,
628,
628
] | 2.276051 | 547 |
from collections import deque
from math import ceil, log
from division import Division
from picker import Picker
| [
6738,
17268,
1330,
390,
4188,
198,
6738,
10688,
1330,
2906,
346,
11,
2604,
198,
198,
6738,
7297,
1330,
7458,
198,
6738,
2298,
263,
1330,
12346,
263,
628,
198
] | 4.142857 | 28 |
#!/usr/bin/env python3
import csv
import sys
import xml.etree.ElementTree as ET
### Natural key sorting for orders like : C1, C5, C10, C12 ... (instead of C1, C10, C12, C5...)
# http://stackoverflow.com/a/5967539
import re
def natural_keys(text):
'''
alist.sort(key=natural_keys) sorts in human order
http://nedbatchelder.com/blog/200712/human_sorting.html
(See Toothy's implementation in the comments)
'''
return [ atoi(c) for c in re.split('(\d+)', text) ]
###
def parse_kicad_xml(input_file):
"""Parse the KiCad XML file and look for the part designators
as done in the case of the official KiCad Open Parts Library:
* OPL parts are designated with "SKU" (preferred)
* other parts are designated with "MPN"
"""
components = {}
parts = {}
missing = []
tree = ET.parse(input_file)
root = tree.getroot()
for f in root.findall('./components/'):
name = f.attrib['ref']
info = {}
fields = f.find('fields')
opl, mpn = None, None
if fields is not None:
for x in fields:
if x.attrib['name'].upper() == 'SKU':
opl = x.text
elif x.attrib['name'].upper() == 'MPN':
mpn = x.text
if opl:
components[name] = opl
elif mpn:
components[name] = mpn
else:
missing += [name]
continue
if components[name] not in parts:
parts[components[name]] = []
parts[components[name]] += [name]
return components, missing
def write_bom_seeed(output_file_slug, components):
"""Write the BOM according to the Seeed Studio Fusion PCBA template available at:
https://statics3.seeedstudio.com/assets/file/fusion/bom_template_2016-08-18.csv
```
Part/Designator,Manufacture Part Number/Seeed SKU,Quantity
C1,RHA,1
"D1,D2",CC0603KRX7R9BB102,2
```
The output is a CSV file at the `output_file_slug`.csv location.
"""
parts = {}
for c in components:
if components[c] not in parts:
parts[components[c]] = []
parts[components[c]] += [c]
field_names = ['Part/Designator', 'Manufacture Part Number/Seeed SKU', 'Quantity']
with open("{}.csv".format(output_file_slug), 'w') as csvfile:
bomwriter = csv.DictWriter(csvfile, fieldnames=field_names, delimiter=',',
quotechar='"', quoting=csv.QUOTE_MINIMAL)
bomwriter.writeheader()
for p in sorted(parts.keys()):
pieces = sorted(parts[p], key=natural_keys)
designators = ",".join(pieces)
bomwriter.writerow({'Part/Designator': designators,
'Manufacture Part Number/Seeed SKU': p,
'Quantity': len(pieces)})
if __name__ == "__main__":
input_file = sys.argv[1]
output_file = sys.argv[2]
components, missing = parse_kicad_xml(input_file)
write_bom_seeed(output_file, components)
if len(missing) > 0:
print("** Warning **: there were parts with missing SKU/MFP")
print(missing)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
269,
21370,
198,
11748,
25064,
198,
11748,
35555,
13,
316,
631,
13,
20180,
27660,
355,
12152,
198,
198,
21017,
12068,
1994,
29407,
329,
6266,
588,
1058,
327,
16,
11,
327,
20,
11,
327,
940,
11,
327,
1065,
2644,
357,
38070,
286,
327,
16,
11,
327,
940,
11,
327,
1065,
11,
327,
20,
23029,
198,
2,
2638,
1378,
25558,
2502,
11125,
13,
785,
14,
64,
14,
3270,
42444,
2670,
198,
11748,
302,
198,
198,
4299,
3288,
62,
13083,
7,
5239,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
435,
396,
13,
30619,
7,
2539,
28,
11802,
62,
13083,
8,
10524,
287,
1692,
1502,
198,
220,
220,
220,
2638,
1378,
2817,
8664,
2395,
6499,
13,
785,
14,
14036,
14,
12726,
1065,
14,
10734,
62,
82,
24707,
13,
6494,
198,
220,
220,
220,
357,
6214,
1675,
14863,
338,
7822,
287,
262,
3651,
8,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1441,
685,
379,
23013,
7,
66,
8,
329,
269,
287,
302,
13,
35312,
10786,
38016,
67,
28988,
3256,
2420,
8,
2361,
198,
21017,
198,
198,
4299,
21136,
62,
74,
291,
324,
62,
19875,
7,
15414,
62,
7753,
2599,
198,
220,
220,
220,
37227,
10044,
325,
262,
21927,
34,
324,
23735,
2393,
290,
804,
329,
262,
636,
1486,
2024,
198,
220,
220,
220,
355,
1760,
287,
262,
1339,
286,
262,
1743,
21927,
34,
324,
4946,
22349,
10074,
25,
198,
220,
220,
220,
1635,
440,
6489,
3354,
389,
11032,
351,
366,
18831,
52,
1,
357,
3866,
18186,
8,
198,
220,
220,
220,
1635,
584,
3354,
389,
11032,
351,
366,
7378,
45,
1,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
6805,
796,
23884,
198,
220,
220,
220,
3354,
796,
23884,
198,
220,
220,
220,
4814,
796,
17635,
628,
220,
220,
220,
5509,
796,
12152,
13,
29572,
7,
15414,
62,
7753,
8,
198,
220,
220,
220,
6808,
796,
5509,
13,
1136,
15763,
3419,
198,
220,
220,
220,
329,
277,
287,
6808,
13,
19796,
439,
7,
4458,
14,
5589,
3906,
14,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
277,
13,
1078,
822,
17816,
5420,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
7508,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
7032,
796,
277,
13,
19796,
10786,
25747,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
267,
489,
11,
285,
21999,
796,
6045,
11,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
611,
7032,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2124,
287,
7032,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2124,
13,
1078,
822,
17816,
3672,
6,
4083,
45828,
3419,
6624,
705,
18831,
52,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
267,
489,
796,
2124,
13,
5239,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
2124,
13,
1078,
822,
17816,
3672,
6,
4083,
45828,
3419,
6624,
705,
7378,
45,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
21999,
796,
2124,
13,
5239,
198,
220,
220,
220,
220,
220,
220,
220,
611,
267,
489,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6805,
58,
3672,
60,
796,
267,
489,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
285,
21999,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6805,
58,
3672,
60,
796,
285,
21999,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4814,
15853,
685,
3672,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
611,
6805,
58,
3672,
60,
407,
287,
3354,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3354,
58,
5589,
3906,
58,
3672,
11907,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
3354,
58,
5589,
3906,
58,
3672,
11907,
15853,
685,
3672,
60,
198,
220,
220,
220,
1441,
6805,
11,
4814,
198,
198,
4299,
3551,
62,
65,
296,
62,
325,
2308,
7,
22915,
62,
7753,
62,
6649,
1018,
11,
6805,
2599,
198,
220,
220,
220,
37227,
16594,
262,
347,
2662,
1864,
284,
262,
1001,
2308,
11733,
21278,
4217,
4339,
11055,
1695,
379,
25,
198,
220,
220,
220,
3740,
1378,
14269,
873,
18,
13,
325,
2308,
19149,
952,
13,
785,
14,
19668,
14,
7753,
14,
69,
4241,
14,
65,
296,
62,
28243,
62,
5304,
12,
2919,
12,
1507,
13,
40664,
628,
220,
220,
220,
7559,
63,
198,
220,
220,
220,
2142,
14,
23067,
1352,
11,
44445,
495,
2142,
7913,
14,
6214,
276,
14277,
52,
11,
31208,
198,
220,
220,
220,
327,
16,
11,
49,
7801,
11,
16,
198,
220,
220,
220,
366,
35,
16,
11,
35,
17,
1600,
4093,
15,
35642,
30758,
55,
22,
49,
24,
15199,
15377,
11,
17,
198,
220,
220,
220,
7559,
63,
628,
220,
220,
220,
383,
5072,
318,
257,
44189,
2393,
379,
262,
4600,
22915,
62,
7753,
62,
6649,
1018,
44646,
40664,
4067,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3354,
796,
23884,
198,
220,
220,
220,
329,
269,
287,
6805,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
6805,
58,
66,
60,
407,
287,
3354,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3354,
58,
5589,
3906,
58,
66,
11907,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
3354,
58,
5589,
3906,
58,
66,
11907,
15853,
685,
66,
60,
628,
220,
220,
220,
2214,
62,
14933,
796,
37250,
7841,
14,
23067,
1352,
3256,
705,
44445,
495,
2142,
7913,
14,
6214,
276,
14277,
52,
3256,
705,
31208,
20520,
198,
220,
220,
220,
351,
1280,
7203,
90,
27422,
40664,
1911,
18982,
7,
22915,
62,
7753,
62,
6649,
1018,
828,
705,
86,
11537,
355,
269,
21370,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
8626,
16002,
796,
269,
21370,
13,
35,
713,
34379,
7,
40664,
7753,
11,
2214,
14933,
28,
3245,
62,
14933,
11,
46728,
2676,
28,
3256,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
10641,
11639,
1,
3256,
28411,
28,
40664,
13,
10917,
23051,
62,
23678,
3955,
1847,
8,
198,
220,
220,
220,
220,
220,
220,
220,
8626,
16002,
13,
13564,
25677,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
329,
279,
287,
23243,
7,
42632,
13,
13083,
3419,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5207,
796,
23243,
7,
42632,
58,
79,
4357,
1994,
28,
11802,
62,
13083,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1486,
2024,
796,
366,
553,
13,
22179,
7,
34154,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8626,
16002,
13,
16002,
322,
15090,
6,
7841,
14,
23067,
1352,
10354,
1486,
2024,
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,
705,
44445,
495,
2142,
7913,
14,
6214,
276,
14277,
52,
10354,
279,
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,
705,
31208,
10354,
18896,
7,
34154,
8,
30072,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
5128,
62,
7753,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
220,
220,
220,
5072,
62,
7753,
796,
25064,
13,
853,
85,
58,
17,
60,
628,
220,
220,
220,
6805,
11,
4814,
796,
21136,
62,
74,
291,
324,
62,
19875,
7,
15414,
62,
7753,
8,
198,
220,
220,
220,
3551,
62,
65,
296,
62,
325,
2308,
7,
22915,
62,
7753,
11,
6805,
8,
198,
220,
220,
220,
611,
18896,
7,
45688,
8,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
1174,
15932,
12429,
25,
612,
547,
3354,
351,
4814,
14277,
52,
14,
44,
5837,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
45688,
8,
198
] | 2.220099 | 1,413 |
import wget
import gzip
import time as t
import json
import fileinput
import os
| [
11748,
266,
1136,
198,
11748,
308,
13344,
198,
11748,
640,
355,
256,
198,
11748,
33918,
198,
11748,
2393,
15414,
198,
11748,
28686,
628,
628,
628
] | 3.4 | 25 |
"""Sample ace and supersmoother problems from literature."""
| [
37811,
36674,
31506,
290,
22754,
5908,
847,
2761,
422,
9285,
526,
15931,
198
] | 4.692308 | 13 |
from threading import Lock
import geoip2.database
from util import resource_path
| [
6738,
4704,
278,
1330,
13656,
201,
198,
201,
198,
11748,
40087,
541,
17,
13,
48806,
201,
198,
201,
198,
6738,
7736,
1330,
8271,
62,
6978,
201,
198,
201,
198,
201,
198
] | 2.967742 | 31 |
from stable_baselines.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise
from stable_baselines.td3.rnd import RND
from stable_baselines.td3.td3 import TD3
from stable_baselines.td3.dist_predictor import Predictor
from stable_baselines.td3.ddl_td3 import DDLTD3
from stable_baselines.td3.policies import MlpPolicy, CnnPolicy, LnMlpPolicy, LnCnnPolicy
| [
6738,
8245,
62,
12093,
20655,
13,
11321,
13,
3919,
786,
1330,
14435,
12502,
2949,
786,
11,
49359,
5714,
34653,
11925,
27343,
12502,
2949,
786,
198,
6738,
8245,
62,
12093,
20655,
13,
8671,
18,
13,
81,
358,
1330,
371,
8575,
198,
6738,
8245,
62,
12093,
20655,
13,
8671,
18,
13,
8671,
18,
1330,
13320,
18,
198,
6738,
8245,
62,
12093,
20655,
13,
8671,
18,
13,
17080,
62,
79,
17407,
273,
1330,
49461,
273,
198,
6738,
8245,
62,
12093,
20655,
13,
8671,
18,
13,
1860,
75,
62,
8671,
18,
1330,
360,
19260,
21016,
18,
198,
6738,
8245,
62,
12093,
20655,
13,
8671,
18,
13,
79,
4160,
444,
1330,
337,
34431,
36727,
11,
327,
20471,
36727,
11,
406,
77,
44,
34431,
36727,
11,
406,
77,
34,
20471,
36727,
628
] | 2.920635 | 126 |
from django.shortcuts import render
import random
| [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
11748,
4738,
198
] | 4.166667 | 12 |
#from django.test import TestCase
from datetime import date
from decimal import *
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from rest_framework.test import APITestCase
from rest_framework.authtoken.models import Token
from .models import *
from .mommy_recipes import *
# def test_response(self):
# response = get_response(self.client, self.url, None)
# self.assertEqual(response.status_code, 200)
# def test_public_deter_response(self):
# public_deter_1.make()
# public_deter_2.make()
# params = {'uf': 'MA', 'ano': 2015, 'mes': 8,
# 'tipo': 'DETER', 'estagio': 'Corte Raso'}
# response = get_response(self.client, self.url, params)
# def test_daily_deter_qualif_response(self):
# daily_deter_qualif_1.make()
# daily_deter_qualif_2.make()
# params = {'uf': 'MA', 'ano': 2015, 'mes': 8,
# 'tipo': 'DETER', 'estagio': 'Corte Raso'}
# response = get_response(self.client, self.url, params)
# self.assertEqual(response.status_code, 200)
# self.assertEqual(response.status_code, 200)
# def test_public_deter_qualif_response(self):
# public_deter_qualif_1.make()
# public_deter_qualif_2.make()
# params = {'uf': 'MA', 'ano': 2015, 'mes': 8,
# 'tipo': 'DETER', 'estagio': 'Corte Raso'}
# response = get_response(self.client, self.url, params)
# self.assertEqual(response.status_code, 200)
# def test_deter_awifs_response(self):
# deter_awifs_1.make()
# deter_awifs_2.make()
# params = {'uf': 'MA', 'ano': 2015, 'mes': 8,
# 'tipo': 'DETER', 'estagio': 'Corte Raso'}
# response = get_response(self.client, self.url, params)
# self.assertEqual(response.status_code, 200) | [
2,
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
198,
6738,
4818,
8079,
1330,
3128,
198,
6738,
32465,
1330,
1635,
198,
198,
6738,
42625,
14208,
13,
7295,
13,
6371,
411,
349,
690,
1330,
9575,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
198,
6738,
1334,
62,
30604,
13,
9288,
1330,
3486,
2043,
395,
20448,
198,
6738,
1334,
62,
30604,
13,
18439,
30001,
13,
27530,
1330,
29130,
198,
198,
6738,
764,
27530,
1330,
1635,
198,
6738,
764,
32542,
1820,
62,
8344,
18636,
1330,
1635,
628,
628,
628,
198,
220,
220,
220,
1303,
825,
1332,
62,
26209,
7,
944,
2599,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
2882,
796,
651,
62,
26209,
7,
944,
13,
16366,
11,
2116,
13,
6371,
11,
6045,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
26209,
13,
13376,
62,
8189,
11,
939,
8,
628,
220,
220,
220,
1303,
825,
1332,
62,
11377,
62,
67,
2357,
62,
26209,
7,
944,
2599,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1171,
62,
67,
2357,
62,
16,
13,
15883,
3419,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1171,
62,
67,
2357,
62,
17,
13,
15883,
3419,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
42287,
796,
1391,
6,
3046,
10354,
705,
5673,
3256,
705,
5733,
10354,
1853,
11,
705,
6880,
10354,
807,
11,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22504,
78,
10354,
705,
35,
2767,
1137,
3256,
705,
395,
363,
952,
10354,
705,
34,
419,
68,
28513,
78,
6,
92,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
2882,
796,
651,
62,
26209,
7,
944,
13,
16366,
11,
2116,
13,
6371,
11,
42287,
8,
628,
220,
220,
220,
1303,
825,
1332,
62,
29468,
62,
67,
2357,
62,
13255,
361,
62,
26209,
7,
944,
2599,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
4445,
62,
67,
2357,
62,
13255,
361,
62,
16,
13,
15883,
3419,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
4445,
62,
67,
2357,
62,
13255,
361,
62,
17,
13,
15883,
3419,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
42287,
796,
1391,
6,
3046,
10354,
705,
5673,
3256,
705,
5733,
10354,
1853,
11,
705,
6880,
10354,
807,
11,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22504,
78,
10354,
705,
35,
2767,
1137,
3256,
705,
395,
363,
952,
10354,
705,
34,
419,
68,
28513,
78,
6,
92,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
2882,
796,
651,
62,
26209,
7,
944,
13,
16366,
11,
2116,
13,
6371,
11,
42287,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
26209,
13,
13376,
62,
8189,
11,
939,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
26209,
13,
13376,
62,
8189,
11,
939,
8,
628,
220,
220,
220,
1303,
825,
1332,
62,
11377,
62,
67,
2357,
62,
13255,
361,
62,
26209,
7,
944,
2599,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1171,
62,
67,
2357,
62,
13255,
361,
62,
16,
13,
15883,
3419,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1171,
62,
67,
2357,
62,
13255,
361,
62,
17,
13,
15883,
3419,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
42287,
796,
1391,
6,
3046,
10354,
705,
5673,
3256,
705,
5733,
10354,
1853,
11,
705,
6880,
10354,
807,
11,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22504,
78,
10354,
705,
35,
2767,
1137,
3256,
705,
395,
363,
952,
10354,
705,
34,
419,
68,
28513,
78,
6,
92,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
2882,
796,
651,
62,
26209,
7,
944,
13,
16366,
11,
2116,
13,
6371,
11,
42287,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
26209,
13,
13376,
62,
8189,
11,
939,
8,
628,
220,
220,
220,
1303,
825,
1332,
62,
67,
2357,
62,
707,
361,
82,
62,
26209,
7,
944,
2599,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2206,
62,
707,
361,
82,
62,
16,
13,
15883,
3419,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2206,
62,
707,
361,
82,
62,
17,
13,
15883,
3419,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
42287,
796,
1391,
6,
3046,
10354,
705,
5673,
3256,
705,
5733,
10354,
1853,
11,
705,
6880,
10354,
807,
11,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22504,
78,
10354,
705,
35,
2767,
1137,
3256,
705,
395,
363,
952,
10354,
705,
34,
419,
68,
28513,
78,
6,
92,
628,
220,
220,
220,
1303,
220,
220,
220,
220,
2882,
796,
651,
62,
26209,
7,
944,
13,
16366,
11,
2116,
13,
6371,
11,
42287,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
26209,
13,
13376,
62,
8189,
11,
939,
8
] | 2.256627 | 830 |
from localization import L
from resources.fonts import QXFontDB
from resources.gfx import QXImageDB, QXImageSequenceDB
from xlib import qt as qtx
from ...backend import BackendHost
class QBackendPanel(qtx.QXWidget):
"""
Base panel for CSW backend
"""
| [
6738,
42842,
1330,
406,
198,
6738,
4133,
13,
10331,
82,
1330,
1195,
55,
23252,
11012,
198,
6738,
4133,
13,
70,
21373,
1330,
1195,
55,
5159,
11012,
11,
1195,
55,
5159,
44015,
594,
11012,
198,
6738,
2124,
8019,
1330,
10662,
83,
355,
10662,
17602,
198,
198,
6738,
2644,
1891,
437,
1330,
5157,
437,
17932,
628,
198,
4871,
1195,
7282,
437,
26639,
7,
80,
17602,
13,
48,
55,
38300,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7308,
6103,
329,
9429,
54,
30203,
198,
220,
220,
220,
37227,
198
] | 2.988764 | 89 |
import jax.numpy as jnp
import numpy as np
from jax import random
from rmhmc.hmc import hmc
from .problems import banana
| [
11748,
474,
897,
13,
77,
32152,
355,
474,
37659,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
474,
897,
1330,
4738,
198,
198,
6738,
42721,
71,
23209,
13,
71,
23209,
1330,
289,
23209,
198,
198,
6738,
764,
1676,
22143,
1330,
25996,
628
] | 2.952381 | 42 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *
__all__ = ['NamespaceArgs', 'Namespace']
@pulumi.input_type
@pulumi.input_type
| [
2,
19617,
28,
40477,
12,
23,
198,
2,
17202,
39410,
25,
428,
2393,
373,
7560,
416,
262,
21624,
12994,
24118,
687,
10290,
357,
27110,
5235,
8,
16984,
13,
17202,
198,
2,
17202,
2141,
407,
4370,
416,
1021,
4556,
345,
821,
1728,
345,
760,
644,
345,
389,
1804,
0,
17202,
198,
198,
11748,
14601,
198,
11748,
17472,
12994,
198,
11748,
17472,
12994,
13,
43282,
198,
6738,
19720,
1330,
4377,
11,
337,
5912,
11,
32233,
11,
45835,
11,
4479,
11,
31754,
198,
6738,
764,
1330,
4808,
315,
2410,
198,
6738,
764,
1330,
23862,
198,
6738,
47540,
15414,
82,
1330,
1635,
198,
198,
834,
439,
834,
796,
37250,
36690,
10223,
42035,
3256,
705,
36690,
10223,
20520,
198,
198,
31,
79,
377,
12994,
13,
15414,
62,
4906,
628,
198,
31,
79,
377,
12994,
13,
15414,
62,
4906,
628,
198
] | 3.414815 | 135 |
'''Encoder eval for MS-SSIM
'''
from cortex.main import run
from cortex_DIM.configs.deconvnets import configs as decoder_configs
from cortex_DIM.models.decoder import Decoder
class MSSSIMEval(Decoder):
'''Measure MS-SSIM through a decoder trained with reconstruction.
'''
defaults = dict(
data=dict(batch_size=dict(train=64, test=64),
inputs=dict(inputs='images'),
skip_last_batch=True),
optimizer=dict(learning_rate=1e-4,
scheduler='MultiStepLR',
scheduler_options=dict(milestones=[50, 100], gamma=0.1))
)
def build(self, encoder, config_,
task_idx=-1, config='basic32x32', args={}):
'''Builds MINE evaluator.
Args:
encoder_key: Dictionary key for the encoder.
task_idx: Index of output tensor to measure MS-SSIM.
config: Config name for decoder. See `configs` for details.
args: Arguments to update config with.
'''
self.nets.encoder = encoder
X = self.inputs('data.images')
self.task_idx = task_idx
out = self.nets.encoder(X, return_all_activations=True)[self.task_idx]
config = decoder_configs.get(config)
config.update(**args)
super().build(out.size()[1:], args=config)
if __name__ == '__main__':
run(MSSSIMEval()) | [
7061,
6,
27195,
12342,
5418,
329,
6579,
12,
5432,
3955,
198,
198,
7061,
6,
198,
198,
6738,
20223,
13,
12417,
1330,
1057,
198,
198,
6738,
20223,
62,
35,
3955,
13,
11250,
82,
13,
12501,
261,
85,
45938,
1330,
4566,
82,
355,
875,
12342,
62,
11250,
82,
198,
6738,
20223,
62,
35,
3955,
13,
27530,
13,
12501,
12342,
1330,
34580,
628,
198,
4871,
337,
5432,
50,
12789,
2100,
7,
10707,
12342,
2599,
198,
220,
220,
220,
705,
7061,
47384,
6579,
12,
5432,
3955,
832,
257,
875,
12342,
8776,
351,
25056,
13,
628,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
26235,
796,
8633,
7,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
11600,
7,
43501,
62,
7857,
28,
11600,
7,
27432,
28,
2414,
11,
1332,
28,
2414,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17311,
28,
11600,
7,
15414,
82,
11639,
17566,
33809,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14267,
62,
12957,
62,
43501,
28,
17821,
828,
198,
220,
220,
220,
220,
220,
220,
220,
6436,
7509,
28,
11600,
7,
40684,
62,
4873,
28,
16,
68,
12,
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,
6038,
18173,
11639,
29800,
8600,
35972,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6038,
18173,
62,
25811,
28,
11600,
7,
25433,
30637,
41888,
1120,
11,
1802,
4357,
34236,
28,
15,
13,
16,
4008,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
825,
1382,
7,
944,
11,
2207,
12342,
11,
4566,
62,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4876,
62,
312,
87,
10779,
16,
11,
4566,
11639,
35487,
2624,
87,
2624,
3256,
26498,
34758,
92,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
15580,
82,
337,
8881,
5418,
84,
1352,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2207,
12342,
62,
2539,
25,
28261,
1994,
329,
262,
2207,
12342,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4876,
62,
312,
87,
25,
12901,
286,
5072,
11192,
273,
284,
3953,
6579,
12,
5432,
3955,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4566,
25,
17056,
1438,
329,
875,
12342,
13,
4091,
4600,
11250,
82,
63,
329,
3307,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
25,
20559,
2886,
284,
4296,
4566,
351,
13,
628,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
45938,
13,
12685,
12342,
796,
2207,
12342,
628,
220,
220,
220,
220,
220,
220,
220,
1395,
796,
2116,
13,
15414,
82,
10786,
7890,
13,
17566,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
35943,
62,
312,
87,
796,
4876,
62,
312,
87,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2116,
13,
45938,
13,
12685,
12342,
7,
55,
11,
1441,
62,
439,
62,
15791,
602,
28,
17821,
38381,
944,
13,
35943,
62,
312,
87,
60,
628,
220,
220,
220,
220,
220,
220,
220,
4566,
796,
875,
12342,
62,
11250,
82,
13,
1136,
7,
11250,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
13,
19119,
7,
1174,
22046,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
11249,
7,
448,
13,
7857,
3419,
58,
16,
25,
4357,
26498,
28,
11250,
8,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1057,
7,
44,
5432,
50,
12789,
2100,
28955
] | 2.170807 | 644 |
# -*- coding: utf-8 -*-
import asyncio
import aiohttp
if __name__ == "__main__":
loop = asyncio.get_event_loop()
yahoo = Yahoo()
loop.run_until_complete(yahoo.fetch_price())
loop.run_forever()
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
30351,
952,
198,
11748,
257,
952,
4023,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
9052,
796,
30351,
952,
13,
1136,
62,
15596,
62,
26268,
3419,
198,
220,
220,
220,
331,
12992,
796,
16551,
3419,
198,
220,
220,
220,
9052,
13,
5143,
62,
28446,
62,
20751,
7,
40774,
13,
69,
7569,
62,
20888,
28955,
198,
220,
220,
220,
9052,
13,
5143,
62,
754,
332,
3419,
198
] | 2.355556 | 90 |
"""Reusable utilities for data and model I/O"""
from ._data_io import (
load_data,
save_csv,
try_load_data,
try_load_xy,
)
from ._model_io import save, saver
DIVIK_RESULT_FNAME = "result.pkl"
__all__ = [
"load_data",
"save_csv",
"try_load_data",
"try_load_xy",
"save",
"saver",
]
| [
37811,
3041,
31979,
20081,
329,
1366,
290,
2746,
314,
14,
46,
37811,
198,
6738,
47540,
7890,
62,
952,
1330,
357,
198,
220,
220,
220,
3440,
62,
7890,
11,
198,
220,
220,
220,
3613,
62,
40664,
11,
198,
220,
220,
220,
1949,
62,
2220,
62,
7890,
11,
198,
220,
220,
220,
1949,
62,
2220,
62,
5431,
11,
198,
8,
198,
6738,
47540,
19849,
62,
952,
1330,
3613,
11,
473,
332,
198,
198,
33569,
18694,
62,
19535,
16724,
62,
37,
20608,
796,
366,
20274,
13,
79,
41582,
1,
198,
198,
834,
439,
834,
796,
685,
198,
220,
220,
220,
366,
2220,
62,
7890,
1600,
198,
220,
220,
220,
366,
21928,
62,
40664,
1600,
198,
220,
220,
220,
366,
28311,
62,
2220,
62,
7890,
1600,
198,
220,
220,
220,
366,
28311,
62,
2220,
62,
5431,
1600,
198,
220,
220,
220,
366,
21928,
1600,
198,
220,
220,
220,
366,
82,
8770,
1600,
198,
60,
198
] | 2.13245 | 151 |
import pyglet
import rabbyt
from pyglet.window import key
from pyglet.window import mouse
from pyglet.gl import *
from tools import *
| [
11748,
12972,
70,
1616,
198,
11748,
27998,
1525,
83,
198,
6738,
12972,
70,
1616,
13,
17497,
1330,
1994,
198,
6738,
12972,
70,
1616,
13,
17497,
1330,
10211,
198,
6738,
12972,
70,
1616,
13,
4743,
1330,
1635,
198,
6738,
4899,
1330,
1635,
198
] | 3.190476 | 42 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 30 22:41:09 2021
@author: amanda
"""
# loop through the .zip files and create images in .png format
# import necessary libraries
import os
import image_to_png
directory = "dataset_zip"
#file_extensions = ["OSAVI", "NDVI", "GNDVI", "PSRI", "NDVI45"]
extension = "OSAVI"
print("Extension: ", extension)
# crawling through directory and subdirectories
for root, directories, files in os.walk(directory):
for filename in files:
print("filname", filename)
# join the two strings in order to form the full filepath.
filepath = os.path.join(root, filename)
print("Filepath: ", filepath)
""" For creating RGB images, no extension is required"""
#image_to_png.RGB_spliter(filepath)
image_to_png.three_channel_spliter(filepath, extension)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
41972,
319,
19480,
2758,
1542,
2534,
25,
3901,
25,
2931,
33448,
198,
31,
9800,
25,
716,
5282,
198,
37811,
198,
198,
2,
9052,
832,
262,
764,
13344,
3696,
290,
2251,
4263,
287,
764,
11134,
5794,
198,
2,
1330,
3306,
12782,
198,
198,
11748,
28686,
198,
11748,
2939,
62,
1462,
62,
11134,
198,
198,
34945,
796,
366,
19608,
292,
316,
62,
13344,
1,
198,
198,
2,
7753,
62,
2302,
5736,
796,
14631,
2640,
10116,
40,
1600,
366,
8575,
12861,
1600,
366,
38,
8575,
12861,
1600,
366,
3705,
7112,
1600,
366,
8575,
12861,
2231,
8973,
198,
2302,
3004,
796,
366,
2640,
10116,
40,
1,
198,
4798,
7203,
11627,
3004,
25,
33172,
7552,
8,
198,
198,
2,
34499,
832,
8619,
290,
850,
12942,
1749,
198,
1640,
6808,
11,
29196,
11,
3696,
287,
28686,
13,
11152,
7,
34945,
2599,
198,
220,
220,
220,
329,
29472,
287,
3696,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
10379,
3672,
1600,
29472,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4654,
262,
734,
13042,
287,
1502,
284,
1296,
262,
1336,
2393,
6978,
13,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
15763,
11,
29472,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
8979,
6978,
25,
33172,
2393,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
1114,
4441,
25228,
4263,
11,
645,
7552,
318,
2672,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
9060,
62,
1462,
62,
11134,
13,
36982,
62,
22018,
2676,
7,
7753,
6978,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2939,
62,
1462,
62,
11134,
13,
15542,
62,
17620,
62,
22018,
2676,
7,
7753,
6978,
11,
7552,
8,
198
] | 2.773026 | 304 |
import pandas as pd
CRITERIA = [
"largely_recommended",
"reliability",
"importance",
"engaging",
"pedagogy",
"layman_friendly",
"entertaining_relaxing",
"better_habits",
"diversity_inclusion",
"backfire_risk",
]
TCOLOR = [
"#1282b2",
"#DC8A5D",
"#C28BED",
"#4C72D5",
"#4BB061",
"#D37A80",
"#DFC642",
"#76C6CB",
"#9DD654",
"#D8836D",
]
MSG_NO_DATA = "You should first load the public dataset at the top of the page."
def set_df(data, users=[]):
"""Set up the dataframe"""
df_tmp = pd.read_csv(data)
index = ["video_a", "video_b", "public_username"]
df = df_tmp.pivot(index=index, columns="criteria", values="score")
df.reset_index(inplace=True)
if users:
df = df[df["public_username"].isin(users)]
return df
| [
11748,
19798,
292,
355,
279,
67,
628,
198,
9419,
2043,
1137,
3539,
796,
685,
198,
220,
220,
220,
366,
11664,
306,
62,
47335,
1631,
1600,
198,
220,
220,
220,
366,
2411,
12455,
1600,
198,
220,
220,
220,
366,
11748,
590,
1600,
198,
220,
220,
220,
366,
1516,
3039,
1600,
198,
220,
220,
220,
366,
9124,
363,
9868,
1600,
198,
220,
220,
220,
366,
10724,
805,
62,
13120,
1600,
198,
220,
220,
220,
366,
298,
861,
1397,
62,
2411,
897,
278,
1600,
198,
220,
220,
220,
366,
27903,
62,
5976,
896,
1600,
198,
220,
220,
220,
366,
67,
1608,
62,
259,
4717,
1600,
198,
220,
220,
220,
366,
1891,
6495,
62,
19121,
1600,
198,
60,
198,
198,
4825,
3535,
1581,
796,
685,
198,
220,
220,
220,
25113,
1065,
6469,
65,
17,
1600,
198,
220,
220,
220,
25113,
9697,
23,
32,
20,
35,
1600,
198,
220,
220,
220,
25113,
34,
2078,
33,
1961,
1600,
198,
220,
220,
220,
25113,
19,
34,
4761,
35,
20,
1600,
198,
220,
220,
220,
25113,
19,
15199,
3312,
16,
1600,
198,
220,
220,
220,
25113,
35,
2718,
32,
1795,
1600,
198,
220,
220,
220,
25113,
35,
4851,
41290,
1600,
198,
220,
220,
220,
25113,
4304,
34,
21,
23199,
1600,
198,
220,
220,
220,
25113,
24,
16458,
39111,
1600,
198,
220,
220,
220,
25113,
35,
3459,
2623,
35,
1600,
198,
60,
198,
198,
5653,
38,
62,
15285,
62,
26947,
796,
366,
1639,
815,
717,
3440,
262,
1171,
27039,
379,
262,
1353,
286,
262,
2443,
526,
628,
198,
4299,
900,
62,
7568,
7,
7890,
11,
2985,
28,
21737,
2599,
198,
220,
220,
220,
37227,
7248,
510,
262,
1366,
14535,
37811,
628,
220,
220,
220,
47764,
62,
22065,
796,
279,
67,
13,
961,
62,
40664,
7,
7890,
8,
628,
220,
220,
220,
6376,
796,
14631,
15588,
62,
64,
1600,
366,
15588,
62,
65,
1600,
366,
11377,
62,
29460,
8973,
628,
220,
220,
220,
47764,
796,
47764,
62,
22065,
13,
79,
45785,
7,
9630,
28,
9630,
11,
15180,
2625,
22213,
5142,
1600,
3815,
2625,
26675,
4943,
198,
220,
220,
220,
47764,
13,
42503,
62,
9630,
7,
259,
5372,
28,
17821,
8,
628,
220,
220,
220,
611,
2985,
25,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
796,
47764,
58,
7568,
14692,
11377,
62,
29460,
1,
4083,
45763,
7,
18417,
15437,
628,
220,
220,
220,
1441,
47764,
628
] | 2.157623 | 387 |
# Copyright (c) 2015 Orange.
# 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 sqlalchemy import orm
from sqlalchemy import sql
from neutron.db.models import l3
from neutron.db import models_v2
from neutron.debug import debug_agent
from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib.callbacks import resources
from neutron_lib import constants as const
from neutron_lib.db import api as db_api
from oslo_log import helpers as log_helpers
from oslo_log import log as logging
from networking_bagpipe.agent.bgpvpn import rpc_client
from networking_bgpvpn.neutron.db import bgpvpn_db
from networking_bgpvpn.neutron.services.common import utils
from networking_bgpvpn.neutron.services.service_drivers.bagpipe \
import bagpipe_v2 as v2
LOG = logging.getLogger(__name__)
@log_helpers.log_method_call
@db_api.CONTEXT_READER
def get_network_info_for_port(context, port_id, network_id):
"""Get MAC, IP and Gateway IP addresses informations for a specific port"""
try:
net_info = (context.session.
query(models_v2.Port.mac_address,
models_v2.IPAllocation.ip_address,
models_v2.Subnet.cidr,
models_v2.Subnet.gateway_ip).
join(models_v2.IPAllocation,
models_v2.IPAllocation.port_id ==
models_v2.Port.id).
join(models_v2.Subnet,
models_v2.IPAllocation.subnet_id ==
models_v2.Subnet.id).
filter(models_v2.Subnet.ip_version == 4).
filter(models_v2.Port.id == port_id).one())
(mac_address, ip_address, cidr, gateway_ip) = net_info
except orm.exc.NoResultFound:
return
gateway_mac = (
context.session.
query(models_v2.Port.mac_address).
filter(
models_v2.Port.network_id == network_id,
(models_v2.Port.device_owner ==
const.DEVICE_OWNER_ROUTER_INTF)
).
one_or_none()
)
return {'mac_address': mac_address,
'ip_address': ip_address + cidr[cidr.index('/'):],
'gateway_ip': gateway_ip,
'gateway_mac': gateway_mac[0] if gateway_mac else None}
@db_api.CONTEXT_READER
@db_api.CONTEXT_READER
@db_api.CONTEXT_READER
@db_api.CONTEXT_READER
@db_api.CONTEXT_READER
@db_api.CONTEXT_READER
@db_api.CONTEXT_READER
@registry.has_registry_receivers
class BaGPipeBGPVPNDriver(v2.BaGPipeBGPVPNDriver):
"""BGPVPN Service Driver class for BaGPipe"""
def _format_bgpvpn(self, context, bgpvpn, network_id):
"""JSON-format BGPVPN
BGPVPN, network identifiers, and route targets.
"""
formatted_bgpvpn = {'id': bgpvpn['id'],
'network_id': network_id,
'gateway_mac': get_gateway_mac(context,
network_id)}
formatted_bgpvpn.update(
self._format_bgpvpn_network_route_targets([bgpvpn]))
return formatted_bgpvpn
def _format_bgpvpn_network_route_targets(self, bgpvpns):
"""Format BGPVPN network informations (VPN type and route targets)
[{
'type': 'l3',
'route_targets': ['12345:1', '12345:2'],
'import_targets': ['12345:3'],
'export_targets': ['12345:4']
},
{
'type': 'l3',
'route_targets': ['12346:1']
},
{
'type': 'l2',
'route_targets': ['12347:1']
}
]
to
{
'l3vpn' : {
'import_rt': ['12345:1', '12345:2', '12345:3', '12346:1'],
'export_rt': ['12345:1', '12345:2', '12345:4', '12346:1']
},
'l2vpn' : {
'import_rt': ['12347:1'],
'export_rt': ['12347:1']
}
}
"""
bgpvpn_rts = {}
for bgpvpn in bgpvpns:
# Add necessary keys to BGP VPN route targets dictionary
if bgpvpn['type'] + 'vpn' not in bgpvpn_rts:
bgpvpn_rts.update(
{bgpvpn['type'] + 'vpn': {'import_rt': [],
'export_rt': []}}
)
if 'route_targets' in bgpvpn:
bgpvpn_rts[bgpvpn['type'] + 'vpn']['import_rt'] += (
bgpvpn['route_targets']
)
bgpvpn_rts[bgpvpn['type'] + 'vpn']['export_rt'] += (
bgpvpn['route_targets']
)
if 'import_targets' in bgpvpn:
bgpvpn_rts[bgpvpn['type'] + 'vpn']['import_rt'] += (
bgpvpn['import_targets']
)
if 'export_targets' in bgpvpn:
bgpvpn_rts[bgpvpn['type'] + 'vpn']['export_rt'] += (
bgpvpn['export_targets']
)
for attribute in ('import_rt', 'export_rt'):
if bgpvpn_rts[bgpvpn['type'] + 'vpn'][attribute]:
bgpvpn_rts[bgpvpn['type'] + 'vpn'][attribute] = list(
set(bgpvpn_rts[bgpvpn['type'] + 'vpn'][attribute]))
return bgpvpn_rts
def _retrieve_bgpvpn_network_info_for_port(self, context, port):
"""Retrieve BGP VPN network informations for a specific port
{
'network_id': <UUID>,
'mac_address': '00:00:de:ad:be:ef',
'ip_address': '10.0.0.2',
'gateway_ip': '10.0.0.1',
'gateway_mac': 'aa:bb:cc:dd:ee:ff', # if a router interface exists
'l3vpn' : {
'import_rt': ['12345:1', '12345:2', '12345:3'],
'export_rt': ['12345:1', '12345:2', '12345:4']
}
}
"""
port_id = port['id']
network_id = port['network_id']
bgpvpn_network_info = {}
bgpvpns = self._bgpvpns_for_network(context, network_id)
# NOTE(tmorin): We currently need to send 'network_id', 'mac_address',
# 'ip_address', 'gateway_ip' to the agent, even in the absence of
# a BGPVPN bound to the port. If we don't this information will
# lack on an update_bgpvpn RPC. When the agent will have the ability
# to retrieve this info by itself, we'll change this method
# to return {} if there is no bound bgpvpn.
bgpvpn_rts = self._format_bgpvpn_network_route_targets(bgpvpns)
LOG.debug("Port connected on BGPVPN network %s with route targets "
"%s" % (network_id, bgpvpn_rts))
bgpvpn_network_info.update(bgpvpn_rts)
LOG.debug("Getting port %s network details" % port_id)
network_info = get_network_info_for_port(context, port_id, network_id)
if not network_info:
LOG.warning("No network information for net %s", network_id)
return
bgpvpn_network_info.update(network_info)
return bgpvpn_network_info
@db_api.CONTEXT_READER
@log_helpers.log_method_call
@log_helpers.log_method_call
@log_helpers.log_method_call
@log_helpers.log_method_call
@registry.receives(resources.PORT, [events.AFTER_UPDATE])
@log_helpers.log_method_call
@registry.receives(resources.PORT, [events.AFTER_DELETE])
@log_helpers.log_method_call
# contrary to mother class, no need to subscribe to router interface
# before-delete, because after delete, we still can generate RPCs
@registry.receives(resources.ROUTER_INTERFACE, [events.AFTER_DELETE])
@log_helpers.log_method_call
| [
2,
15069,
357,
66,
8,
1853,
11942,
13,
198,
2,
1439,
6923,
33876,
13,
198,
2,
198,
2,
220,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
198,
2,
220,
220,
220,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
921,
743,
7330,
198,
2,
220,
220,
220,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
220,
220,
220,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
220,
220,
220,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
42881,
198,
2,
220,
220,
220,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
4091,
262,
198,
2,
220,
220,
220,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
11247,
198,
2,
220,
220,
220,
739,
262,
13789,
13,
198,
198,
6738,
44161,
282,
26599,
1330,
393,
76,
198,
6738,
44161,
282,
26599,
1330,
44161,
198,
198,
6738,
49810,
13,
9945,
13,
27530,
1330,
300,
18,
198,
6738,
49810,
13,
9945,
1330,
4981,
62,
85,
17,
198,
6738,
49810,
13,
24442,
1330,
14257,
62,
25781,
198,
198,
6738,
49810,
62,
8019,
13,
15042,
13,
4299,
50101,
1330,
2493,
21653,
654,
198,
6738,
49810,
62,
8019,
13,
13345,
10146,
1330,
2995,
198,
6738,
49810,
62,
8019,
13,
13345,
10146,
1330,
20478,
198,
6738,
49810,
62,
8019,
13,
13345,
10146,
1330,
4133,
198,
6738,
49810,
62,
8019,
1330,
38491,
355,
1500,
198,
6738,
49810,
62,
8019,
13,
9945,
1330,
40391,
355,
20613,
62,
15042,
198,
198,
6738,
28686,
5439,
62,
6404,
1330,
49385,
355,
2604,
62,
16794,
364,
198,
6738,
28686,
5439,
62,
6404,
1330,
2604,
355,
18931,
198,
198,
6738,
19140,
62,
21454,
34360,
13,
25781,
13,
65,
31197,
85,
21999,
1330,
374,
14751,
62,
16366,
198,
198,
6738,
19140,
62,
65,
31197,
85,
21999,
13,
710,
315,
1313,
13,
9945,
1330,
275,
31197,
85,
21999,
62,
9945,
198,
6738,
19140,
62,
65,
31197,
85,
21999,
13,
710,
315,
1313,
13,
30416,
13,
11321,
1330,
3384,
4487,
198,
6738,
19140,
62,
65,
31197,
85,
21999,
13,
710,
315,
1313,
13,
30416,
13,
15271,
62,
36702,
13,
21454,
34360,
3467,
198,
220,
220,
220,
1330,
6131,
34360,
62,
85,
17,
355,
410,
17,
628,
198,
25294,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
31,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
198,
4299,
651,
62,
27349,
62,
10951,
62,
1640,
62,
634,
7,
22866,
11,
2493,
62,
312,
11,
3127,
62,
312,
2599,
198,
220,
220,
220,
37227,
3855,
20582,
11,
6101,
290,
29916,
6101,
9405,
4175,
602,
329,
257,
2176,
2493,
37811,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2010,
62,
10951,
796,
357,
22866,
13,
29891,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12405,
7,
27530,
62,
85,
17,
13,
13924,
13,
20285,
62,
21975,
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,
4981,
62,
85,
17,
13,
4061,
3237,
5040,
13,
541,
62,
21975,
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,
4981,
62,
85,
17,
13,
7004,
3262,
13,
66,
312,
81,
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,
4981,
62,
85,
17,
13,
7004,
3262,
13,
10494,
1014,
62,
541,
737,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4654,
7,
27530,
62,
85,
17,
13,
4061,
3237,
5040,
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,
4981,
62,
85,
17,
13,
4061,
3237,
5040,
13,
634,
62,
312,
6624,
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,
4981,
62,
85,
17,
13,
13924,
13,
312,
737,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4654,
7,
27530,
62,
85,
17,
13,
7004,
3262,
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,
4981,
62,
85,
17,
13,
4061,
3237,
5040,
13,
7266,
3262,
62,
312,
6624,
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,
4981,
62,
85,
17,
13,
7004,
3262,
13,
312,
737,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8106,
7,
27530,
62,
85,
17,
13,
7004,
3262,
13,
541,
62,
9641,
6624,
604,
737,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8106,
7,
27530,
62,
85,
17,
13,
13924,
13,
312,
6624,
2493,
62,
312,
737,
505,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
357,
20285,
62,
21975,
11,
20966,
62,
21975,
11,
269,
312,
81,
11,
24308,
62,
541,
8,
796,
2010,
62,
10951,
198,
220,
220,
220,
2845,
393,
76,
13,
41194,
13,
2949,
23004,
21077,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
24308,
62,
20285,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
4732,
13,
29891,
13,
198,
220,
220,
220,
220,
220,
220,
220,
12405,
7,
27530,
62,
85,
17,
13,
13924,
13,
20285,
62,
21975,
737,
198,
220,
220,
220,
220,
220,
220,
220,
8106,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4981,
62,
85,
17,
13,
13924,
13,
27349,
62,
312,
6624,
3127,
62,
312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
27530,
62,
85,
17,
13,
13924,
13,
25202,
62,
18403,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1500,
13,
7206,
27389,
62,
14165,
1137,
62,
49,
2606,
5781,
62,
1268,
10234,
8,
198,
220,
220,
220,
220,
220,
220,
220,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
530,
62,
273,
62,
23108,
3419,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
1441,
1391,
6,
20285,
62,
21975,
10354,
8352,
62,
21975,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
541,
62,
21975,
10354,
20966,
62,
21975,
1343,
269,
312,
81,
58,
66,
312,
81,
13,
9630,
10786,
14,
6,
2599,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10494,
1014,
62,
541,
10354,
24308,
62,
541,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10494,
1014,
62,
20285,
10354,
24308,
62,
20285,
58,
15,
60,
611,
24308,
62,
20285,
2073,
6045,
92,
628,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
198,
31,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
198,
198,
31,
2301,
4592,
13,
10134,
62,
2301,
4592,
62,
260,
344,
1191,
198,
4871,
8999,
16960,
3757,
33,
16960,
8859,
8575,
38291,
7,
85,
17,
13,
34458,
16960,
3757,
33,
16960,
8859,
8575,
38291,
2599,
628,
220,
220,
220,
37227,
33,
16960,
33883,
4809,
12434,
1398,
329,
8999,
16960,
3757,
37811,
628,
220,
220,
220,
825,
4808,
18982,
62,
65,
31197,
85,
21999,
7,
944,
11,
4732,
11,
275,
31197,
85,
21999,
11,
3127,
62,
312,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
40386,
12,
18982,
347,
16960,
33883,
628,
220,
220,
220,
220,
220,
220,
220,
347,
16960,
33883,
11,
3127,
42814,
11,
290,
6339,
6670,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
39559,
62,
65,
31197,
85,
21999,
796,
1391,
6,
312,
10354,
275,
31197,
85,
21999,
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,
705,
27349,
62,
312,
10354,
3127,
62,
312,
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,
10494,
1014,
62,
20285,
10354,
651,
62,
10494,
1014,
62,
20285,
7,
22866,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3127,
62,
312,
38165,
198,
220,
220,
220,
220,
220,
220,
220,
39559,
62,
65,
31197,
85,
21999,
13,
19119,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
18982,
62,
65,
31197,
85,
21999,
62,
27349,
62,
38629,
62,
83,
853,
1039,
26933,
65,
31197,
85,
21999,
60,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
39559,
62,
65,
31197,
85,
21999,
628,
220,
220,
220,
825,
4808,
18982,
62,
65,
31197,
85,
21999,
62,
27349,
62,
38629,
62,
83,
853,
1039,
7,
944,
11,
275,
31197,
36133,
5907,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
26227,
347,
16960,
33883,
3127,
4175,
602,
357,
33883,
2099,
290,
6339,
6670,
8,
628,
220,
220,
220,
220,
220,
220,
220,
685,
90,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4906,
10354,
705,
75,
18,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
38629,
62,
83,
853,
1039,
10354,
37250,
10163,
2231,
25,
16,
3256,
705,
10163,
2231,
25,
17,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
11748,
62,
83,
853,
1039,
10354,
37250,
10163,
2231,
25,
18,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
39344,
62,
83,
853,
1039,
10354,
37250,
10163,
2231,
25,
19,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4906,
10354,
705,
75,
18,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
38629,
62,
83,
853,
1039,
10354,
37250,
1065,
30557,
25,
16,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4906,
10354,
705,
75,
17,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
38629,
62,
83,
853,
1039,
10354,
37250,
1065,
30995,
25,
16,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
628,
220,
220,
220,
220,
220,
220,
220,
284,
628,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
75,
18,
85,
21999,
6,
1058,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
11748,
62,
17034,
10354,
37250,
10163,
2231,
25,
16,
3256,
705,
10163,
2231,
25,
17,
3256,
705,
10163,
2231,
25,
18,
3256,
705,
1065,
30557,
25,
16,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
39344,
62,
17034,
10354,
37250,
10163,
2231,
25,
16,
3256,
705,
10163,
2231,
25,
17,
3256,
705,
10163,
2231,
25,
19,
3256,
705,
1065,
30557,
25,
16,
20520,
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,
705,
75,
17,
85,
21999,
6,
1058,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
11748,
62,
17034,
10354,
37250,
1065,
30995,
25,
16,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
39344,
62,
17034,
10354,
37250,
1065,
30995,
25,
16,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
81,
912,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
329,
275,
31197,
85,
21999,
287,
275,
31197,
36133,
5907,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3060,
3306,
8251,
284,
347,
16960,
21669,
6339,
6670,
22155,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
275,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
407,
287,
275,
31197,
85,
21999,
62,
81,
912,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
81,
912,
13,
19119,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
10354,
1391,
6,
11748,
62,
17034,
10354,
685,
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,
705,
39344,
62,
17034,
10354,
17635,
11709,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
38629,
62,
83,
853,
1039,
6,
287,
275,
31197,
85,
21999,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
81,
912,
58,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
7131,
6,
11748,
62,
17034,
20520,
15853,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
17816,
38629,
62,
83,
853,
1039,
20520,
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,
275,
31197,
85,
21999,
62,
81,
912,
58,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
7131,
6,
39344,
62,
17034,
20520,
15853,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
17816,
38629,
62,
83,
853,
1039,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
11748,
62,
83,
853,
1039,
6,
287,
275,
31197,
85,
21999,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
81,
912,
58,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
7131,
6,
11748,
62,
17034,
20520,
15853,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
17816,
11748,
62,
83,
853,
1039,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
39344,
62,
83,
853,
1039,
6,
287,
275,
31197,
85,
21999,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
81,
912,
58,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
7131,
6,
39344,
62,
17034,
20520,
15853,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
17816,
39344,
62,
83,
853,
1039,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
11688,
287,
19203,
11748,
62,
17034,
3256,
705,
39344,
62,
17034,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
275,
31197,
85,
21999,
62,
81,
912,
58,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
7131,
42348,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
81,
912,
58,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
7131,
42348,
60,
796,
1351,
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,
900,
7,
65,
31197,
85,
21999,
62,
81,
912,
58,
65,
31197,
85,
21999,
17816,
4906,
20520,
1343,
705,
85,
21999,
6,
7131,
42348,
60,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
275,
31197,
85,
21999,
62,
81,
912,
628,
220,
220,
220,
825,
4808,
1186,
30227,
62,
65,
31197,
85,
21999,
62,
27349,
62,
10951,
62,
1640,
62,
634,
7,
944,
11,
4732,
11,
2493,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
9781,
30227,
347,
16960,
21669,
3127,
4175,
602,
329,
257,
2176,
2493,
628,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
27349,
62,
312,
10354,
1279,
52,
27586,
22330,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
20285,
62,
21975,
10354,
705,
405,
25,
405,
25,
2934,
25,
324,
25,
1350,
25,
891,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
541,
62,
21975,
10354,
705,
940,
13,
15,
13,
15,
13,
17,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10494,
1014,
62,
541,
10354,
705,
940,
13,
15,
13,
15,
13,
16,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10494,
1014,
62,
20285,
10354,
705,
7252,
25,
11848,
25,
535,
25,
1860,
25,
1453,
25,
487,
3256,
1303,
611,
257,
20264,
7071,
7160,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
75,
18,
85,
21999,
6,
1058,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
11748,
62,
17034,
10354,
37250,
10163,
2231,
25,
16,
3256,
705,
10163,
2231,
25,
17,
3256,
705,
10163,
2231,
25,
18,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
39344,
62,
17034,
10354,
37250,
10163,
2231,
25,
16,
3256,
705,
10163,
2231,
25,
17,
3256,
705,
10163,
2231,
25,
19,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2493,
62,
312,
796,
2493,
17816,
312,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
3127,
62,
312,
796,
2493,
17816,
27349,
62,
312,
20520,
628,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
27349,
62,
10951,
796,
23884,
628,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
36133,
5907,
796,
2116,
13557,
65,
31197,
36133,
5907,
62,
1640,
62,
27349,
7,
22866,
11,
3127,
62,
312,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
24550,
7,
83,
4491,
259,
2599,
775,
3058,
761,
284,
3758,
705,
27349,
62,
312,
3256,
705,
20285,
62,
21975,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
705,
541,
62,
21975,
3256,
705,
10494,
1014,
62,
541,
6,
284,
262,
5797,
11,
772,
287,
262,
8889,
286,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
257,
347,
16960,
33883,
5421,
284,
262,
2493,
13,
220,
1002,
356,
836,
470,
428,
1321,
481,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
3092,
319,
281,
4296,
62,
65,
31197,
85,
21999,
39400,
13,
1649,
262,
5797,
481,
423,
262,
2694,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
284,
19818,
428,
7508,
416,
2346,
11,
356,
1183,
1487,
428,
2446,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
284,
1441,
23884,
611,
612,
318,
645,
5421,
275,
31197,
85,
21999,
13,
628,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
81,
912,
796,
2116,
13557,
18982,
62,
65,
31197,
85,
21999,
62,
27349,
62,
38629,
62,
83,
853,
1039,
7,
65,
31197,
36133,
5907,
8,
628,
220,
220,
220,
220,
220,
220,
220,
41605,
13,
24442,
7203,
13924,
5884,
319,
347,
16960,
33883,
3127,
4064,
82,
351,
6339,
6670,
366,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36521,
82,
1,
4064,
357,
27349,
62,
312,
11,
275,
31197,
85,
21999,
62,
81,
912,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
27349,
62,
10951,
13,
19119,
7,
65,
31197,
85,
21999,
62,
81,
912,
8,
628,
220,
220,
220,
220,
220,
220,
220,
41605,
13,
24442,
7203,
20570,
2493,
4064,
82,
3127,
3307,
1,
4064,
2493,
62,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3127,
62,
10951,
796,
651,
62,
27349,
62,
10951,
62,
1640,
62,
634,
7,
22866,
11,
2493,
62,
312,
11,
3127,
62,
312,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
3127,
62,
10951,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41605,
13,
43917,
7203,
2949,
3127,
1321,
329,
2010,
4064,
82,
1600,
3127,
62,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
628,
220,
220,
220,
220,
220,
220,
220,
275,
31197,
85,
21999,
62,
27349,
62,
10951,
13,
19119,
7,
27349,
62,
10951,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
275,
31197,
85,
21999,
62,
27349,
62,
10951,
628,
220,
220,
220,
2488,
9945,
62,
15042,
13,
10943,
32541,
62,
15675,
1137,
628,
220,
220,
220,
2488,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
628,
220,
220,
220,
2488,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
628,
220,
220,
220,
2488,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
628,
220,
220,
220,
2488,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
628,
220,
220,
220,
2488,
2301,
4592,
13,
260,
344,
1083,
7,
37540,
13,
15490,
11,
685,
31534,
13,
8579,
5781,
62,
16977,
12962,
198,
220,
220,
220,
2488,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
628,
220,
220,
220,
2488,
2301,
4592,
13,
260,
344,
1083,
7,
37540,
13,
15490,
11,
685,
31534,
13,
8579,
5781,
62,
7206,
2538,
9328,
12962,
198,
220,
220,
220,
2488,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
628,
220,
220,
220,
1303,
10388,
284,
2802,
1398,
11,
645,
761,
284,
12383,
284,
20264,
7071,
198,
220,
220,
220,
1303,
878,
12,
33678,
11,
780,
706,
12233,
11,
356,
991,
460,
7716,
39400,
82,
198,
220,
220,
220,
2488,
2301,
4592,
13,
260,
344,
1083,
7,
37540,
13,
49,
2606,
5781,
62,
41358,
49836,
11,
685,
31534,
13,
8579,
5781,
62,
7206,
2538,
9328,
12962,
198,
220,
220,
220,
2488,
6404,
62,
16794,
364,
13,
6404,
62,
24396,
62,
13345,
198
] | 1.985011 | 4,203 |
from diepvries.deserializers.snowflake_deserializer import (
DatabaseConfiguration,
SnowflakeDeserializer,
)
if __name__ == "__main__":
deserialize()
| [
6738,
4656,
79,
85,
1678,
13,
8906,
48499,
11341,
13,
82,
2197,
47597,
62,
8906,
48499,
7509,
1330,
357,
198,
220,
220,
220,
24047,
38149,
11,
198,
220,
220,
220,
7967,
47597,
5960,
48499,
7509,
11,
198,
8,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
748,
48499,
1096,
3419,
198
] | 2.75 | 60 |
"""
Metrics measuring either uncertainty or confidence of a model.
"""
import torch
import torch.nn.functional as F
| [
37811,
198,
9171,
10466,
15964,
2035,
13479,
393,
6628,
286,
257,
2746,
13,
198,
37811,
198,
11748,
28034,
198,
11748,
28034,
13,
20471,
13,
45124,
355,
376,
628,
628,
628
] | 4.033333 | 30 |
#
# PySNMP MIB module TUBS-IBR-AGENT-CAPABILITIES (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-IBR-AGENT-CAPABILITIES
# Produced by pysmi-0.3.4 at Wed May 1 15:27:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion")
ModuleCompliance, AgentCapabilities, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "AgentCapabilities", "NotificationGroup")
Gauge32, ObjectIdentity, Counter64, Counter32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, IpAddress, MibIdentifier, Bits, Integer32, ModuleIdentity, Unsigned32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ObjectIdentity", "Counter64", "Counter32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "IpAddress", "MibIdentifier", "Bits", "Integer32", "ModuleIdentity", "Unsigned32", "iso")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
ibr, = mibBuilder.importSymbols("TUBS-SMI", "ibr")
ibrAgentCapabilities = ModuleIdentity((1, 3, 6, 1, 4, 1, 1575, 1, 6))
ibrAgentCapabilities.setRevisions(('2000-02-09 00:00', '1998-08-05 16:23', '1997-02-14 10:23',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: ibrAgentCapabilities.setRevisionsDescriptions(('Updated IMPORTS and minor stylistic fixes.', 'Added agent capabilities for the WWW-MIB subagent version 1.0.', 'The initial revision of this module.',))
if mibBuilder.loadTexts: ibrAgentCapabilities.setLastUpdated('200002090000Z')
if mibBuilder.loadTexts: ibrAgentCapabilities.setOrganization('TU Braunschweig')
if mibBuilder.loadTexts: ibrAgentCapabilities.setContactInfo('Juergen Schoenwaelder TU Braunschweig Bueltenweg 74/75 38106 Braunschweig Germany Tel: +49 531 391 3283 Fax: +49 531 391 5936 E-mail: [email protected]')
if mibBuilder.loadTexts: ibrAgentCapabilities.setDescription('Agent capability statements.')
linux = MibIdentifier((1, 3, 6, 1, 4, 1, 1575, 1, 6, 1))
linuxAgent3dot3 = AgentCapabilities((1, 3, 6, 1, 4, 1, 1575, 1, 6, 2))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
linuxAgent3dot3 = linuxAgent3dot3.setProductRelease('cmu-snmp-linux-3.3')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
linuxAgent3dot3 = linuxAgent3dot3.setStatus('current')
if mibBuilder.loadTexts: linuxAgent3dot3.setDescription('CMU SNMP v1.1b + SNMPv2 USEC + LINUX')
wwwSubagent1dot0 = AgentCapabilities((1, 3, 6, 1, 4, 1, 1575, 1, 6, 3))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
wwwSubagent1dot0 = wwwSubagent1dot0.setProductRelease('TUBS Apache WWW-MIB sub-agent version 1.0')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
wwwSubagent1dot0 = wwwSubagent1dot0.setStatus('current')
if mibBuilder.loadTexts: wwwSubagent1dot0.setDescription('TUBS WWW-MIB sub-agent version 1.0 for Solaris.')
mibBuilder.exportSymbols("TUBS-IBR-AGENT-CAPABILITIES", linuxAgent3dot3=linuxAgent3dot3, ibrAgentCapabilities=ibrAgentCapabilities, PYSNMP_MODULE_ID=ibrAgentCapabilities, wwwSubagent1dot0=wwwSubagent1dot0, linux=linux)
| [
2,
198,
2,
9485,
15571,
7378,
337,
9865,
8265,
309,
52,
4462,
12,
9865,
49,
12,
4760,
3525,
12,
33177,
32,
49516,
357,
4023,
1378,
16184,
76,
489,
8937,
13,
785,
14,
79,
893,
11632,
8,
198,
2,
7054,
45,
13,
16,
2723,
2393,
1378,
14,
14490,
14,
67,
615,
47562,
19,
14,
13603,
14,
76,
571,
82,
13,
16184,
76,
489,
8937,
13,
785,
14,
292,
77,
16,
14,
51,
52,
4462,
12,
9865,
49,
12,
4760,
3525,
12,
33177,
32,
49516,
198,
2,
21522,
771,
416,
279,
893,
11632,
12,
15,
13,
18,
13,
19,
379,
3300,
1737,
220,
352,
1315,
25,
1983,
25,
2857,
13130,
198,
2,
1550,
2583,
42274,
54,
15567,
19,
12,
44,
12,
1415,
2425,
3859,
21450,
2196,
1248,
13,
20,
13,
15,
416,
2836,
288,
615,
47562,
19,
198,
2,
8554,
11361,
2196,
513,
13,
22,
13,
18,
357,
12286,
11,
1526,
2681,
13130,
11,
7769,
25,
1954,
25,
1314,
8,
220,
198,
2,
198,
12349,
316,
10100,
11,
9515,
33234,
7483,
11,
34142,
796,
285,
571,
32875,
13,
11748,
13940,
2022,
10220,
7203,
1921,
45,
16,
1600,
366,
12349,
316,
10100,
1600,
366,
10267,
33234,
7483,
1600,
366,
46541,
4943,
198,
45,
2434,
40161,
11,
796,
285,
571,
32875,
13,
11748,
13940,
2022,
10220,
7203,
1921,
45,
16,
12,
1677,
5883,
1137,
6234,
1600,
366,
45,
2434,
40161,
4943,
198,
3103,
2536,
6003,
9492,
5458,
11,
14206,
11395,
3103,
2536,
2913,
11,
11052,
17257,
3103,
2536,
2913,
11,
11052,
10699,
3103,
2536,
2913,
11,
1482,
2536,
6003,
38176,
796,
285,
571,
32875,
13,
11748,
13940,
2022,
10220,
7203,
1921,
45,
16,
12,
2200,
20032,
12529,
1600,
366,
3103,
2536,
6003,
9492,
5458,
1600,
366,
28008,
11395,
3103,
2536,
2913,
1600,
366,
11395,
17257,
3103,
2536,
2913,
1600,
366,
11395,
10699,
3103,
2536,
2913,
1600,
366,
3103,
2536,
6003,
38176,
4943,
198,
26796,
38143,
3610,
11,
15906,
15610,
5738,
11,
42808,
13247,
796,
285,
571,
32875,
13,
11748,
13940,
2022,
10220,
7203,
15571,
7378,
85,
17,
12,
10943,
37,
1600,
366,
26796,
38143,
3610,
1600,
366,
36772,
15610,
5738,
1600,
366,
3673,
2649,
13247,
4943,
198,
38,
559,
469,
2624,
11,
9515,
7390,
26858,
11,
15034,
2414,
11,
15034,
2624,
11,
42808,
6030,
11,
337,
571,
3351,
282,
283,
11,
337,
571,
10962,
11,
337,
571,
10962,
25166,
11,
337,
571,
10962,
39470,
11,
3862,
51,
3378,
11,
314,
79,
20231,
11,
337,
571,
33234,
7483,
11,
44733,
11,
34142,
2624,
11,
19937,
7390,
26858,
11,
791,
32696,
2624,
11,
47279,
796,
285,
571,
32875,
13,
11748,
13940,
2022,
10220,
7203,
15571,
7378,
85,
17,
12,
50,
8895,
1600,
366,
38,
559,
469,
2624,
1600,
366,
10267,
7390,
26858,
1600,
366,
31694,
2414,
1600,
366,
31694,
2624,
1600,
366,
3673,
2649,
6030,
1600,
366,
44,
571,
3351,
282,
283,
1600,
366,
44,
571,
10962,
1600,
366,
44,
571,
10962,
25166,
1600,
366,
44,
571,
10962,
39470,
1600,
366,
7575,
51,
3378,
1600,
366,
40,
79,
20231,
1600,
366,
44,
571,
33234,
7483,
1600,
366,
33,
896,
1600,
366,
46541,
2624,
1600,
366,
26796,
7390,
26858,
1600,
366,
3118,
32696,
2624,
1600,
366,
26786,
4943,
198,
23114,
10100,
11,
8255,
723,
3103,
4018,
796,
285,
571,
32875,
13,
11748,
13940,
2022,
10220,
7203,
15571,
7378,
85,
17,
12,
4825,
1600,
366,
23114,
10100,
1600,
366,
8206,
723,
3103,
4018,
4943,
198,
2889,
11,
796,
285,
571,
32875,
13,
11748,
13940,
2022,
10220,
7203,
51,
52,
4462,
12,
50,
8895,
1600,
366,
2889,
4943,
198,
2889,
36772,
15610,
5738,
796,
19937,
7390,
26858,
19510,
16,
11,
513,
11,
718,
11,
352,
11,
604,
11,
352,
11,
1315,
2425,
11,
352,
11,
718,
4008,
198,
2889,
36772,
15610,
5738,
13,
2617,
18009,
3279,
7,
10786,
11024,
12,
2999,
12,
2931,
3571,
25,
405,
3256,
705,
21113,
12,
2919,
12,
2713,
1467,
25,
1954,
3256,
705,
21498,
12,
2999,
12,
1415,
838,
25,
1954,
3256,
4008,
198,
198,
361,
651,
35226,
7,
76,
571,
32875,
11,
705,
9641,
3256,
357,
15,
11,
657,
11,
657,
4008,
1875,
357,
19,
11,
604,
11,
657,
2599,
198,
220,
220,
220,
611,
285,
571,
32875,
13,
2220,
8206,
82,
25,
220,
2889,
36772,
15610,
5738,
13,
2617,
18009,
3279,
24564,
1968,
507,
7,
10786,
17354,
30023,
33002,
290,
4159,
22152,
2569,
13040,
2637,
11,
705,
13003,
5797,
9889,
329,
262,
13505,
54,
12,
8895,
33,
850,
25781,
2196,
352,
13,
15,
2637,
11,
705,
464,
4238,
18440,
286,
428,
8265,
2637,
11,
4008,
198,
361,
285,
571,
32875,
13,
2220,
8206,
82,
25,
220,
2889,
36772,
15610,
5738,
13,
2617,
5956,
17354,
10786,
2167,
405,
22567,
2388,
57,
11537,
198,
361,
285,
571,
32875,
13,
2220,
8206,
82,
25,
220,
2889,
36772,
15610,
5738,
13,
2617,
26121,
1634,
10786,
51,
52,
9718,
13271,
354,
732,
328,
11537,
198,
361,
285,
571,
32875,
13,
2220,
8206,
82,
25,
220,
2889,
36772,
15610,
5738,
13,
2617,
17829,
12360,
10786,
41,
15573,
5235,
3059,
6571,
86,
3609,
6499,
309,
52,
9718,
13271,
354,
732,
328,
347,
2731,
1452,
732,
70,
8915,
14,
2425,
4353,
15801,
9718,
13271,
354,
732,
328,
4486,
12088,
25,
1343,
2920,
642,
3132,
5014,
16,
513,
30290,
376,
897,
25,
1343,
2920,
642,
3132,
5014,
16,
7863,
2623,
412,
12,
4529,
25,
5513,
6571,
86,
31,
2889,
13,
6359,
13,
28047,
12,
1443,
13,
2934,
11537,
198,
361,
285,
571,
32875,
13,
2220,
8206,
82,
25,
220,
2889,
36772,
15610,
5738,
13,
2617,
11828,
10786,
36772,
12971,
6299,
2637,
8,
198,
23289,
796,
337,
571,
33234,
7483,
19510,
16,
11,
513,
11,
718,
11,
352,
11,
604,
11,
352,
11,
1315,
2425,
11,
352,
11,
718,
11,
352,
4008,
198,
23289,
36772,
18,
26518,
18,
796,
15906,
15610,
5738,
19510,
16,
11,
513,
11,
718,
11,
352,
11,
604,
11,
352,
11,
1315,
2425,
11,
352,
11,
718,
11,
362,
4008,
198,
361,
651,
35226,
7,
76,
571,
32875,
11,
705,
9641,
3256,
357,
15,
11,
657,
11,
657,
4008,
1875,
357,
19,
11,
604,
11,
657,
2599,
198,
220,
220,
220,
32639,
36772,
18,
26518,
18,
796,
32639,
36772,
18,
26518,
18,
13,
2617,
15667,
26362,
10786,
11215,
84,
12,
16184,
3149,
12,
23289,
12,
18,
13,
18,
11537,
198,
361,
651,
35226,
7,
76,
571,
32875,
11,
705,
9641,
3256,
357,
15,
11,
657,
11,
657,
4008,
1875,
357,
19,
11,
604,
11,
657,
2599,
198,
220,
220,
220,
32639,
36772,
18,
26518,
18,
796,
32639,
36772,
18,
26518,
18,
13,
2617,
19580,
10786,
14421,
11537,
198,
361,
285,
571,
32875,
13,
2220,
8206,
82,
25,
32639,
36772,
18,
26518,
18,
13,
2617,
11828,
10786,
24187,
52,
11346,
7378,
410,
16,
13,
16,
65,
1343,
11346,
7378,
85,
17,
1294,
2943,
1343,
43277,
31235,
11537,
198,
2503,
7004,
25781,
16,
26518,
15,
796,
15906,
15610,
5738,
19510,
16,
11,
513,
11,
718,
11,
352,
11,
604,
11,
352,
11,
1315,
2425,
11,
352,
11,
718,
11,
513,
4008,
198,
361,
651,
35226,
7,
76,
571,
32875,
11,
705,
9641,
3256,
357,
15,
11,
657,
11,
657,
4008,
1875,
357,
19,
11,
604,
11,
657,
2599,
198,
220,
220,
220,
7324,
7004,
25781,
16,
26518,
15,
796,
7324,
7004,
25781,
16,
26518,
15,
13,
2617,
15667,
26362,
10786,
51,
52,
4462,
24843,
13505,
54,
12,
8895,
33,
850,
12,
25781,
2196,
352,
13,
15,
11537,
198,
361,
651,
35226,
7,
76,
571,
32875,
11,
705,
9641,
3256,
357,
15,
11,
657,
11,
657,
4008,
1875,
357,
19,
11,
604,
11,
657,
2599,
198,
220,
220,
220,
7324,
7004,
25781,
16,
26518,
15,
796,
7324,
7004,
25781,
16,
26518,
15,
13,
2617,
19580,
10786,
14421,
11537,
198,
361,
285,
571,
32875,
13,
2220,
8206,
82,
25,
7324,
7004,
25781,
16,
26518,
15,
13,
2617,
11828,
10786,
51,
52,
4462,
13505,
54,
12,
8895,
33,
850,
12,
25781,
2196,
352,
13,
15,
329,
12347,
271,
2637,
8,
198,
76,
571,
32875,
13,
39344,
13940,
2022,
10220,
7203,
51,
52,
4462,
12,
9865,
49,
12,
4760,
3525,
12,
33177,
32,
49516,
1600,
32639,
36772,
18,
26518,
18,
28,
23289,
36772,
18,
26518,
18,
11,
220,
2889,
36772,
15610,
5738,
28,
2889,
36772,
15610,
5738,
11,
350,
56,
15571,
7378,
62,
33365,
24212,
62,
2389,
28,
2889,
36772,
15610,
5738,
11,
7324,
7004,
25781,
16,
26518,
15,
28,
2503,
7004,
25781,
16,
26518,
15,
11,
32639,
28,
23289,
8,
198
] | 2.677954 | 1,388 |
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import numpy as np
import matplotlib.pyplot as plt
import os
from skimage.filters import threshold_otsu
import scipy
from scipy import ndimage
from scipy.interpolate import griddata
import cv2
import preprocess
if __name__ == "__main__":
# DEFINE AND LOAD FONT
script_root = '/Users/junkyungkim/Documents/PycharmProjects/cluttered_nist'
fontnames = ['FUTRFW.ttf',
'Instruction.otf',
'absender1.ttf',
'5Identification-Mono.ttf',
'7Segment.ttf',
'VCR_OSD_MONO_1.001.ttf',
'Instruction.otf',
'Segment16B Regular.ttf']
std_fontsizes = [225, 240, 225, 150, 255, 255, 255, 255]
std_thin_iters = [6, 15, 4, 9, 9, 2]
scale = 1 # 0.5
for fontname, std_fontsize, std_thin_iter in zip(fontnames, std_fontsizes, std_thin_iters):
std_fontsize = int(std_fontsize*scale)
std_thin_iter = int(std_thin_iter*scale)
font = ImageFont.truetype(os.path.join(script_root,'fonts',fontname), std_fontsize)
# RENDER
img=Image.new("RGBA", (2500, 300), (255, 255, 255))
draw = ImageDraw.Draw(img)
draw.text((0, 0), "ABCDEFGXYZ", (0, 0, 0), font=font)
draw = ImageDraw.Draw(img)
# MORPHOLOGICAL POSTPROC (FOR CONSTNAT STROKE THICKNESS)
img = 255 - np.mean(np.array(img), axis=2)
binary = img > 128
# img_closed = scipy.ndimage.binary_closing(binary.astype(np.int), iterations=20)##np.maximum(iterations / 2, 1))
img_eroded = (scipy.ndimage.morphology.binary_erosion(binary, iterations=std_thin_iter) * 255).astype(np.uint8)
landscape = preprocess.generate_distortion_mask(img_eroded, sigma=[4000,2000], num_centers=[30,20])
warped = preprocess.custom_warp(img_eroded, landscape, power=0.07)
# img_dist = img_eroded
# distCoeffs = [-.1, 1.0, 1.0, 1.0]
# focal_length = [1000, 1000]
# for coord in [[400,100],[500,150],[600,200]]:
# distCoeffs[0] = distCoeffs[0]*-1
# img_dist = custom_fisheye(img_dist, coord, distCoeffs, focal_length)
# import preprocess
# im_pixelated = preprocess.pixelate_obj(img_eroded, [10 * scale, 10 * scale], 0.1, 5 * scale, ignore_fit=True)
plt.subplot(211);plt.imshow(binary, cmap='gray')
plt.subplot(212);plt.imshow(warped, cmap='gray')
plt.show()
# thinned = zhangSuen(binary)
# plt.subplot(121)
# plt.imshow(img)
# plt.subplot(122)
# plt.imshow(thinned)
# plt.show() | [
11748,
350,
4146,
198,
6738,
350,
4146,
1330,
7412,
23252,
198,
6738,
350,
4146,
1330,
7412,
198,
6738,
350,
4146,
1330,
7412,
25302,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
28686,
198,
6738,
1341,
9060,
13,
10379,
1010,
1330,
11387,
62,
1747,
84,
198,
11748,
629,
541,
88,
198,
6738,
629,
541,
88,
1330,
299,
67,
9060,
198,
6738,
629,
541,
88,
13,
3849,
16104,
378,
1330,
1036,
1638,
1045,
198,
198,
11748,
269,
85,
17,
198,
198,
11748,
662,
14681,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
197,
2,
23449,
8881,
5357,
17579,
2885,
376,
35830,
198,
197,
12048,
62,
15763,
796,
31051,
14490,
14,
73,
28898,
2150,
74,
320,
14,
38354,
14,
20519,
354,
1670,
16775,
82,
14,
565,
46322,
62,
77,
396,
6,
198,
197,
10331,
14933,
796,
37250,
37,
3843,
49,
24160,
13,
926,
69,
3256,
198,
197,
197,
197,
197,
705,
6310,
2762,
13,
313,
69,
3256,
198,
197,
197,
197,
197,
705,
8937,
2194,
16,
13,
926,
69,
3256,
198,
197,
197,
197,
197,
705,
20,
33234,
2649,
12,
9069,
78,
13,
926,
69,
3256,
198,
197,
197,
197,
197,
705,
22,
41030,
434,
13,
926,
69,
3256,
198,
197,
197,
197,
197,
705,
53,
9419,
62,
2640,
35,
62,
27857,
46,
62,
16,
13,
8298,
13,
926,
69,
3256,
198,
197,
197,
197,
197,
705,
6310,
2762,
13,
313,
69,
3256,
198,
197,
197,
197,
197,
705,
41030,
434,
1433,
33,
23603,
13,
926,
69,
20520,
198,
197,
19282,
62,
10331,
82,
4340,
796,
685,
18182,
11,
14956,
11,
18500,
11,
6640,
11,
14280,
11,
14280,
11,
14280,
11,
14280,
60,
198,
197,
19282,
62,
40871,
62,
270,
364,
796,
685,
21,
11,
1315,
11,
604,
11,
860,
11,
860,
11,
362,
60,
198,
197,
9888,
796,
352,
220,
1303,
657,
13,
20,
628,
197,
1640,
10369,
3672,
11,
14367,
62,
10331,
7857,
11,
14367,
62,
40871,
62,
2676,
287,
19974,
7,
10331,
14933,
11,
14367,
62,
10331,
82,
4340,
11,
14367,
62,
40871,
62,
270,
364,
2599,
198,
197,
197,
19282,
62,
10331,
7857,
796,
493,
7,
19282,
62,
10331,
7857,
9,
9888,
8,
198,
197,
197,
19282,
62,
40871,
62,
2676,
796,
493,
7,
19282,
62,
40871,
62,
2676,
9,
9888,
8,
628,
197,
197,
10331,
796,
7412,
23252,
13,
83,
622,
2963,
431,
7,
418,
13,
6978,
13,
22179,
7,
12048,
62,
15763,
4032,
10331,
82,
3256,
10331,
3672,
828,
14367,
62,
10331,
7857,
8,
628,
197,
197,
2,
371,
10619,
1137,
198,
197,
197,
9600,
28,
5159,
13,
3605,
7203,
48192,
4339,
1600,
357,
44688,
11,
5867,
828,
357,
13381,
11,
14280,
11,
14280,
4008,
198,
197,
197,
19334,
796,
7412,
25302,
13,
25302,
7,
9600,
8,
198,
197,
197,
19334,
13,
5239,
19510,
15,
11,
657,
828,
366,
24694,
7206,
30386,
34278,
57,
1600,
357,
15,
11,
657,
11,
657,
828,
10369,
28,
10331,
8,
198,
197,
197,
19334,
796,
7412,
25302,
13,
25302,
7,
9600,
8,
628,
197,
197,
2,
35208,
11909,
33462,
20151,
24582,
4805,
4503,
357,
13775,
7102,
2257,
34259,
3563,
13252,
7336,
2320,
11860,
31097,
8,
198,
197,
197,
9600,
796,
14280,
532,
45941,
13,
32604,
7,
37659,
13,
18747,
7,
9600,
828,
16488,
28,
17,
8,
198,
197,
197,
39491,
796,
33705,
1875,
13108,
198,
197,
197,
2,
33705,
62,
20225,
796,
629,
541,
88,
13,
358,
9060,
13,
39491,
62,
565,
2752,
7,
39491,
13,
459,
2981,
7,
37659,
13,
600,
828,
34820,
28,
1238,
8,
2235,
37659,
13,
47033,
7,
2676,
602,
1220,
362,
11,
352,
4008,
198,
197,
197,
9600,
62,
263,
9043,
796,
357,
1416,
541,
88,
13,
358,
9060,
13,
24503,
1435,
13,
39491,
62,
263,
18442,
7,
39491,
11,
34820,
28,
19282,
62,
40871,
62,
2676,
8,
1635,
14280,
737,
459,
2981,
7,
37659,
13,
28611,
23,
8,
628,
197,
197,
1044,
6794,
796,
662,
14681,
13,
8612,
378,
62,
17080,
5817,
62,
27932,
7,
9600,
62,
263,
9043,
11,
264,
13495,
41888,
27559,
11,
11024,
4357,
997,
62,
1087,
364,
41888,
1270,
11,
1238,
12962,
198,
197,
197,
86,
5117,
276,
796,
662,
14681,
13,
23144,
62,
86,
5117,
7,
9600,
62,
263,
9043,
11,
10747,
11,
1176,
28,
15,
13,
2998,
8,
198,
197,
197,
2,
33705,
62,
17080,
796,
33705,
62,
263,
9043,
198,
197,
197,
2,
1233,
34,
2577,
487,
82,
796,
25915,
13,
16,
11,
352,
13,
15,
11,
352,
13,
15,
11,
352,
13,
15,
60,
198,
197,
197,
2,
25397,
62,
13664,
796,
685,
12825,
11,
8576,
60,
198,
197,
197,
2,
329,
6349,
287,
16410,
7029,
11,
3064,
38430,
4059,
11,
8628,
38430,
8054,
11,
2167,
60,
5974,
198,
197,
197,
2,
220,
197,
17080,
34,
2577,
487,
82,
58,
15,
60,
796,
1233,
34,
2577,
487,
82,
58,
15,
60,
9,
12,
16,
198,
197,
197,
2,
220,
197,
9600,
62,
17080,
796,
2183,
62,
69,
271,
258,
5948,
7,
9600,
62,
17080,
11,
6349,
11,
1233,
34,
2577,
487,
82,
11,
25397,
62,
13664,
8,
628,
197,
197,
2,
1330,
662,
14681,
198,
197,
197,
2,
545,
62,
32515,
515,
796,
662,
14681,
13,
32515,
378,
62,
26801,
7,
9600,
62,
263,
9043,
11,
685,
940,
1635,
5046,
11,
838,
1635,
5046,
4357,
657,
13,
16,
11,
642,
1635,
5046,
11,
8856,
62,
11147,
28,
17821,
8,
198,
197,
197,
489,
83,
13,
7266,
29487,
7,
21895,
1776,
489,
83,
13,
320,
12860,
7,
39491,
11,
269,
8899,
11639,
44605,
11537,
198,
197,
197,
489,
83,
13,
7266,
29487,
7,
21777,
1776,
489,
83,
13,
320,
12860,
7,
86,
5117,
276,
11,
269,
8899,
11639,
44605,
11537,
198,
197,
197,
489,
83,
13,
12860,
3419,
628,
197,
197,
2,
7888,
2817,
796,
1976,
33255,
5606,
268,
7,
39491,
8,
628,
197,
197,
2,
458,
83,
13,
7266,
29487,
7,
19244,
8,
198,
197,
197,
2,
458,
83,
13,
320,
12860,
7,
9600,
8,
198,
197,
197,
2,
458,
83,
13,
7266,
29487,
7,
18376,
8,
198,
197,
197,
2,
458,
83,
13,
320,
12860,
7,
40871,
2817,
8,
198,
197,
197,
2,
458,
83,
13,
12860,
3419
] | 2.306122 | 1,029 |
import os
import sys
import numpy as np
import scipy.stats as stats
import pandas as pd
from IPython import embed
from qlknn.NNDB.model import Network, NetworkJSON
from qlknn.models.ffnn import QuaLiKizNDNN
shortname = {'Ate': '$R/L_{T_e}$',
'Ati': '$R/L_{T_i}$'}
longname ={
'Ate': 'Normalized electron temperature gradient $R/L_{T_e}$',
'Ati': 'Normalized ion temperature gradient $R/L_{T_i}$'}
nameconvert = {
'An': '$R/L_n$',
#'Nustar': '$\\nu^*$',
'Nustar': '$log_{10}(\\nu^*)$',
'logNustar': '$log_{10}(\\nu^*)$',
'Ti_Te': 'Relative temperature $T_i/T_e$',
'Zeff': '$Z_{eff}$',
'q': '$q$',
'smag': 'Magnetic shear $\hat{s}$',
'x': '$\\varepsilon\,(r/R)$',
'efe_GB': '$q_e\,[GB]$',
'efi_GB': '$q_i\,[GB]$',
'efiITG_GB': '$q_{ITG, i}\,[GB]$',
'efeITG_GB': '$q_{ITG, e}\,[GB]$',
'efiTEM_GB': '$q_{TEM, i}\,[GB]$',
'efeTEM_GB': '$q_{TEM, e}\,[GB]$',
'efeETG_GB': 'Normalized heat flux $q$',
'pfe_GB': '$\Gamma_e\,[GB]$',
'pfi_GB': '$\Gamma_i\,[GB]$',
'pfeITG_GB': '$\Gamma_{ITG, i}\,[GB]$',
'pfeTEM_GB': '$\Gamma_{TEM, i}\,[GB]$',
'gam_leq_GB': '$\gamma_{max, \leq 2}\,[GB]$'
}
comboname = {
'efiTEM_GB_div_efeTEM_GB': nameconvert['efiTEM_GB'] + '/' + nameconvert['efeTEM_GB'],
'pfeTEM_GB_div_efeTEM_GB': nameconvert['pfeTEM_GB'] + '/' + nameconvert['efeTEM_GB'],
'efeITG_GB_div_efiITG_GB': nameconvert['efeITG_GB'] + '/' + nameconvert['efiITG_GB'],
'pfeITG_GB_div_efiITG_GB': nameconvert['pfeITG_GB'] + '/' + nameconvert['efiITG_GB']
}
nameconvert.update(shortname)
nameconvert.update(comboname)
| [
11748,
28686,
198,
11748,
25064,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
629,
541,
88,
13,
34242,
355,
9756,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
6101,
7535,
1330,
11525,
198,
198,
6738,
10662,
75,
15418,
77,
13,
6144,
11012,
13,
19849,
1330,
7311,
11,
7311,
40386,
198,
6738,
10662,
75,
15418,
77,
13,
27530,
13,
487,
20471,
1330,
2264,
64,
32304,
42,
528,
8575,
6144,
198,
198,
19509,
3672,
796,
1391,
6,
32,
660,
10354,
705,
3,
49,
14,
43,
23330,
51,
62,
68,
92,
3,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2953,
72,
10354,
705,
3,
49,
14,
43,
23330,
51,
62,
72,
92,
3,
6,
92,
198,
198,
6511,
3672,
796,
90,
198,
220,
220,
220,
705,
32,
660,
10354,
705,
26447,
1143,
11538,
5951,
31312,
720,
49,
14,
43,
23330,
51,
62,
68,
92,
3,
3256,
198,
220,
220,
220,
705,
2953,
72,
10354,
705,
26447,
1143,
22088,
5951,
31312,
720,
49,
14,
43,
23330,
51,
62,
72,
92,
3,
6,
92,
198,
198,
3672,
1102,
1851,
796,
1391,
198,
220,
220,
220,
705,
2025,
10354,
705,
3,
49,
14,
43,
62,
77,
3,
3256,
198,
220,
220,
220,
1303,
6,
45,
436,
283,
10354,
705,
3,
6852,
28803,
61,
9,
3,
3256,
198,
220,
220,
220,
705,
45,
436,
283,
10354,
705,
3,
6404,
23330,
940,
92,
7,
6852,
28803,
61,
28104,
3,
3256,
198,
220,
220,
220,
705,
6404,
45,
436,
283,
10354,
705,
3,
6404,
23330,
940,
92,
7,
6852,
28803,
61,
28104,
3,
3256,
198,
220,
220,
220,
705,
40533,
62,
6767,
10354,
705,
6892,
876,
5951,
720,
51,
62,
72,
14,
51,
62,
68,
3,
3256,
198,
220,
220,
220,
705,
57,
14822,
10354,
705,
3,
57,
23330,
14822,
92,
3,
3256,
198,
220,
220,
220,
705,
80,
10354,
705,
3,
80,
3,
3256,
198,
220,
220,
220,
705,
5796,
363,
10354,
705,
13436,
9833,
673,
283,
39280,
5183,
90,
82,
92,
3,
3256,
198,
220,
220,
220,
705,
87,
10354,
705,
3,
6852,
85,
533,
862,
33576,
59,
11,
7,
81,
14,
49,
8,
3,
3256,
628,
220,
220,
220,
705,
22521,
62,
4579,
10354,
705,
3,
80,
62,
68,
59,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
891,
72,
62,
4579,
10354,
705,
3,
80,
62,
72,
59,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
891,
72,
2043,
38,
62,
4579,
10354,
705,
3,
80,
23330,
2043,
38,
11,
1312,
32239,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
22521,
2043,
38,
62,
4579,
10354,
705,
3,
80,
23330,
2043,
38,
11,
304,
32239,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
891,
72,
51,
3620,
62,
4579,
10354,
705,
3,
80,
23330,
51,
3620,
11,
1312,
32239,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
22521,
51,
3620,
62,
4579,
10354,
705,
3,
80,
23330,
51,
3620,
11,
304,
32239,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
22521,
2767,
38,
62,
4579,
10354,
705,
26447,
1143,
4894,
28462,
720,
80,
3,
3256,
628,
220,
220,
220,
705,
79,
5036,
62,
4579,
10354,
705,
3,
59,
34777,
2611,
62,
68,
59,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
79,
12463,
62,
4579,
10354,
705,
3,
59,
34777,
2611,
62,
72,
59,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
79,
5036,
2043,
38,
62,
4579,
10354,
705,
3,
59,
34777,
2611,
23330,
2043,
38,
11,
1312,
32239,
17414,
4579,
60,
3,
3256,
198,
220,
220,
220,
705,
79,
5036,
51,
3620,
62,
4579,
10354,
705,
3,
59,
34777,
2611,
23330,
51,
3620,
11,
1312,
32239,
17414,
4579,
60,
3,
3256,
628,
220,
220,
220,
705,
28483,
62,
293,
80,
62,
4579,
10354,
705,
3,
59,
28483,
2611,
23330,
9806,
11,
3467,
293,
80,
362,
32239,
17414,
4579,
60,
3,
6,
198,
198,
92,
198,
198,
785,
4189,
480,
796,
1391,
198,
220,
220,
220,
705,
891,
72,
51,
3620,
62,
4579,
62,
7146,
62,
22521,
51,
3620,
62,
4579,
10354,
1438,
1102,
1851,
17816,
891,
72,
51,
3620,
62,
4579,
20520,
1343,
31051,
6,
1343,
1438,
1102,
1851,
17816,
22521,
51,
3620,
62,
4579,
6,
4357,
198,
220,
220,
220,
705,
79,
5036,
51,
3620,
62,
4579,
62,
7146,
62,
22521,
51,
3620,
62,
4579,
10354,
1438,
1102,
1851,
17816,
79,
5036,
51,
3620,
62,
4579,
20520,
1343,
31051,
6,
1343,
1438,
1102,
1851,
17816,
22521,
51,
3620,
62,
4579,
6,
4357,
198,
220,
220,
220,
705,
22521,
2043,
38,
62,
4579,
62,
7146,
62,
891,
72,
2043,
38,
62,
4579,
10354,
1438,
1102,
1851,
17816,
22521,
2043,
38,
62,
4579,
20520,
1343,
31051,
6,
1343,
1438,
1102,
1851,
17816,
891,
72,
2043,
38,
62,
4579,
6,
4357,
198,
220,
220,
220,
705,
79,
5036,
2043,
38,
62,
4579,
62,
7146,
62,
891,
72,
2043,
38,
62,
4579,
10354,
1438,
1102,
1851,
17816,
79,
5036,
2043,
38,
62,
4579,
20520,
1343,
31051,
6,
1343,
1438,
1102,
1851,
17816,
891,
72,
2043,
38,
62,
4579,
20520,
198,
198,
92,
198,
3672,
1102,
1851,
13,
19119,
7,
19509,
3672,
8,
198,
3672,
1102,
1851,
13,
19119,
7,
785,
4189,
480,
8,
628
] | 1.865297 | 876 |
"""Alconna ArgAction相关"""
from datetime import datetime
from typing import Any, Optional, TYPE_CHECKING, Literal
from arclet.alconna.components.action import ArgAction
from arclet.alconna.components.behavior import ArpamarBehavior
from arclet.alconna.exceptions import BehaveCancelled, OutBoundsBehavior
from arclet.alconna.config import config
class _StoreValue(ArgAction):
"""针对特定值的类"""
def store_value(value: Any):
"""存储一个值"""
return _StoreValue(value)
if TYPE_CHECKING:
from arclet.alconna import alconna_version
from arclet.alconna.arpamar import Arpamar
def version(value: Optional[tuple]):
"""返回一个以元组形式存储的版本信息"""
return _StoreValue(value) if value else _StoreValue(alconna_version)
def set_default(value: Any, option: Optional[str] = None, subcommand: Optional[str] = None):
"""
设置一个选项的默认值, 在无该选项时会被设置
当option与subcommand同时传入时, 则会被设置为该subcommand内option的默认值
Args:
value: 默认值
option: 选项名
subcommand: 子命令名
"""
return _SetDefault()
def exclusion(target_path: str, other_path: str):
"""
当设置的两个路径同时存在时, 抛出异常
Args:
target_path: 目标路径
other_path: 其他路径
"""
return _EXCLUSION()
def cool_down(seconds: float):
"""
当设置的时间间隔内被调用时, 抛出异常
Args:
seconds: 时间间隔
"""
return _CoolDown()
def inclusion(*targets: str, flag: Literal["any", "all"] = "any"):
"""
当设置的路径不存在时, 抛出异常
Args:
targets: 路径列表
flag: 匹配方式, 可选值为"any"或"all", 默认为"any"
"""
return _Inclusion()
| [
37811,
2348,
1102,
2616,
20559,
12502,
33566,
116,
17739,
111,
37811,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
19720,
1330,
4377,
11,
32233,
11,
41876,
62,
50084,
2751,
11,
25659,
1691,
198,
6738,
10389,
1616,
13,
282,
1102,
2616,
13,
5589,
3906,
13,
2673,
1330,
20559,
12502,
198,
6738,
10389,
1616,
13,
282,
1102,
2616,
13,
5589,
3906,
13,
46571,
1330,
943,
79,
39236,
25267,
15759,
198,
6738,
10389,
1616,
13,
282,
1102,
2616,
13,
1069,
11755,
1330,
10407,
1015,
34,
590,
3353,
11,
3806,
33,
3733,
25267,
15759,
198,
6738,
10389,
1616,
13,
282,
1102,
2616,
13,
11250,
1330,
4566,
628,
198,
4871,
4808,
22658,
11395,
7,
28100,
12502,
2599,
198,
220,
220,
220,
37227,
165,
240,
230,
43380,
117,
31965,
117,
22522,
248,
161,
222,
120,
21410,
163,
109,
119,
37811,
628,
198,
4299,
3650,
62,
8367,
7,
8367,
25,
4377,
2599,
198,
220,
220,
220,
37227,
27764,
246,
43636,
101,
31660,
10310,
103,
161,
222,
120,
37811,
198,
220,
220,
220,
1441,
4808,
22658,
11395,
7,
8367,
8,
628,
198,
361,
41876,
62,
50084,
2751,
25,
198,
220,
220,
220,
422,
10389,
1616,
13,
282,
1102,
2616,
1330,
435,
1102,
2616,
62,
9641,
198,
220,
220,
220,
422,
10389,
1616,
13,
282,
1102,
2616,
13,
5117,
39236,
1330,
943,
79,
39236,
628,
198,
220,
220,
220,
825,
2196,
7,
8367,
25,
32233,
58,
83,
29291,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
32573,
242,
32368,
252,
31660,
10310,
103,
20015,
98,
17739,
225,
163,
119,
226,
37605,
95,
28156,
237,
27764,
246,
43636,
101,
21410,
48304,
17312,
105,
46479,
94,
162,
223,
107,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4808,
22658,
11395,
7,
8367,
8,
611,
1988,
2073,
4808,
22658,
11395,
7,
282,
1102,
2616,
62,
9641,
8,
628,
198,
4299,
900,
62,
12286,
7,
8367,
25,
4377,
11,
3038,
25,
32233,
58,
2536,
60,
796,
6045,
11,
850,
21812,
25,
32233,
58,
2536,
60,
796,
6045,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5525,
106,
122,
163,
121,
106,
31660,
10310,
103,
34460,
231,
165,
94,
117,
21410,
165,
119,
246,
164,
106,
97,
161,
222,
120,
11,
10263,
250,
101,
33768,
254,
46237,
98,
34460,
231,
165,
94,
117,
33768,
114,
27670,
248,
164,
95,
104,
164,
106,
122,
163,
121,
106,
628,
220,
220,
220,
10263,
121,
241,
18076,
10310,
236,
7266,
21812,
28938,
234,
33768,
114,
27670,
254,
17739,
98,
33768,
114,
11,
10263,
230,
247,
27670,
248,
164,
95,
104,
164,
106,
122,
163,
121,
106,
10310,
118,
46237,
98,
7266,
21812,
37863,
227,
18076,
21410,
165,
119,
246,
164,
106,
97,
161,
222,
120,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
25,
16268,
119,
246,
164,
106,
97,
161,
222,
120,
198,
220,
220,
220,
220,
220,
220,
220,
3038,
25,
16268,
222,
231,
165,
94,
117,
28938,
235,
198,
220,
220,
220,
220,
220,
220,
220,
850,
21812,
25,
10263,
255,
238,
37772,
121,
20015,
97,
28938,
235,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1441,
4808,
7248,
19463,
3419,
628,
198,
4299,
19328,
7,
16793,
62,
6978,
25,
965,
11,
584,
62,
6978,
25,
965,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
10263,
121,
241,
164,
106,
122,
163,
121,
106,
21410,
10310,
97,
10310,
103,
164,
115,
107,
36181,
226,
28938,
234,
33768,
114,
27764,
246,
28839,
101,
33768,
114,
11,
10545,
232,
249,
49035,
118,
28156,
224,
30585,
116,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
6978,
25,
13328,
249,
106,
43718,
229,
164,
115,
107,
36181,
226,
198,
220,
220,
220,
220,
220,
220,
220,
584,
62,
6978,
25,
10263,
227,
114,
20015,
244,
164,
115,
107,
36181,
226,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1441,
4808,
6369,
28332,
2849,
3419,
628,
198,
4299,
3608,
62,
2902,
7,
43012,
25,
12178,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
10263,
121,
241,
164,
106,
122,
163,
121,
106,
21410,
33768,
114,
29785,
112,
29785,
112,
49694,
242,
37863,
227,
164,
95,
104,
164,
108,
225,
18796,
101,
33768,
114,
11,
10545,
232,
249,
49035,
118,
28156,
224,
30585,
116,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4201,
25,
10545,
245,
114,
29785,
112,
29785,
112,
49694,
242,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1441,
4808,
34530,
8048,
3419,
628,
198,
4299,
14900,
46491,
83,
853,
1039,
25,
965,
11,
6056,
25,
25659,
1691,
14692,
1092,
1600,
366,
439,
8973,
796,
366,
1092,
1,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
10263,
121,
241,
164,
106,
122,
163,
121,
106,
21410,
164,
115,
107,
36181,
226,
38834,
27764,
246,
28839,
101,
33768,
114,
11,
10545,
232,
249,
49035,
118,
28156,
224,
30585,
116,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6670,
25,
5525,
115,
107,
36181,
226,
26344,
245,
26193,
101,
198,
220,
220,
220,
220,
220,
220,
220,
6056,
25,
10263,
234,
117,
165,
227,
235,
43095,
28156,
237,
11,
10263,
237,
107,
34460,
231,
161,
222,
120,
10310,
118,
1,
1092,
1,
22755,
244,
1,
439,
1600,
16268,
119,
246,
164,
106,
97,
10310,
118,
1,
1092,
1,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
4808,
818,
4717,
3419,
198
] | 1.702081 | 913 |
from django.contrib import admin
from notification.models import Notifications
# Register your models here.
admin.site.register(Notifications) | [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
6738,
14483,
13,
27530,
1330,
1892,
6637,
198,
2,
17296,
534,
4981,
994,
13,
198,
28482,
13,
15654,
13,
30238,
7,
3673,
6637,
8
] | 4.30303 | 33 |
#!/usr/bin/env python
'''
Outer ear simulator
Author: Michal Sudwoj <[email protected]>
Version: 1.0.0
Data: 2019-09-09
'''
from typing import Tuple
import numpy as np
import scipy.io.wavfile as wav
import scipy.signal as ss
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from pysofaconventions import SOFAFile
def head(data : np.ndarray, sofa : SOFAFile, azimuth : float, elevation : float):
'''
Apply effects of the head (HRTF)
'''
from scipy.spatial import KDTree
s = get_sofa(sofa)
pos = s.getVariableValue('SourcePosition')
# find closest position to requested azimuth and elevation
# TODO: consider normalizing position units to eg. degrees
index = KDTree(pos).query([azimuth, elevation, 1])[1]
hrir = s.getDataIR()[index, :, :]
data = data.T
left = ss.fftconvolve(data, hrir[0])
right = ss.fftconvolve(data, hrir[1])
output = np.asarray([left, right]).swapaxes(-1, 0)
return output
def canal(input : np.ndarray, f_s: int, l : float, d : float):
'''
Apply effects of the ear canal
Modeled as a bandpass filter, as in 'Matlab Auditory Periphery (MAP)'
'''
assert f_s > 0
assert l >= 0
assert d >= 0
v = 343
gain = 10
order = 1
f_nyq = f_s / 2
for n in [1, 3, 5]:
# 'Stopped pipe' resonator; resonating frequency
f_r = (n * v) / (4 * l / 1000 + 0.4 * d / 1000)
# bandpass cut offsets somewhat chosen s.t. for the first mode, they coincide with the parameters from MAP
lowcut = f_r - 1500 # Hz
highcut = f_r + 500 # Hz
low = lowcut / f_nyq
high = highcut / f_nyq
b, a = ss.butter(order, [low, high], btype = 'band')
input += gain * ss.lfilter(b, a, input)
return input
def middle(input):
'''
Apply the effects of the middle ear
Modelled soley as impedence mismatch and lever
'''
z_air = 414 # kg m^-2 s^-1
z_water = 1.48e6 # kg m^-2 s^-1
A_eardrum = 60 # mm^2
A_oval = 3.2 # mm^2
lever_malleus = 1.3
reflected = ((z_air - z_water) / (z_air + z_water)) ** 2
transmitted = 1 - reflected
return input * transmitted * (A_eardrum / A_oval) * lever_malleus
def read(filename : str) -> Tuple[np.ndarray, float]:
'''
Read WAV file and normalize to float array
'''
f_s, data = wav.read(filename)
if data.dtype == 'uint8':
data = data / 255 - 0.5
elif data.dtype == 'int16':
data = data / 32767
elif data.dtype == 'int32':
data = data / 2147483647
elif data.dtype == 'float32':
data = 1.0 * data
else:
eprint(f'Input error: data.dtype = {data.dtype}')
exit(1)
if data.ndim == 1:
# mono
pass
elif data.ndim == 2:
data = data[:, 0]
else:
eprint(f'Input error: data.ndim = {data.ndim}')
exit(1)
return data, f_s
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
7061,
6,
198,
7975,
263,
1027,
35375,
198,
198,
13838,
25,
2843,
282,
14818,
86,
13210,
1279,
907,
463,
86,
13210,
31,
50139,
13,
2788,
89,
13,
354,
29,
198,
14815,
25,
352,
13,
15,
13,
15,
198,
6601,
25,
13130,
12,
2931,
12,
2931,
198,
7061,
6,
198,
198,
6738,
19720,
1330,
309,
29291,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
629,
541,
88,
13,
952,
13,
45137,
7753,
355,
266,
615,
198,
11748,
629,
541,
88,
13,
12683,
282,
355,
37786,
198,
6738,
1822,
29572,
1330,
45751,
46677,
11,
45751,
7469,
13185,
22087,
8479,
1436,
198,
6738,
12972,
568,
69,
7807,
16593,
1330,
12809,
7708,
8979,
198,
198,
4299,
1182,
7,
7890,
1058,
45941,
13,
358,
18747,
11,
34902,
1058,
12809,
7708,
8979,
11,
35560,
320,
1071,
1058,
12178,
11,
22910,
1058,
12178,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
27967,
3048,
286,
262,
1182,
357,
17184,
10234,
8,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
422,
629,
541,
88,
13,
2777,
34961,
1330,
509,
24544,
631,
628,
220,
220,
220,
264,
796,
651,
62,
568,
13331,
7,
568,
13331,
8,
198,
220,
220,
220,
1426,
796,
264,
13,
1136,
43015,
11395,
10786,
7416,
26545,
11537,
198,
220,
220,
220,
1303,
1064,
11706,
2292,
284,
9167,
35560,
320,
1071,
290,
22910,
198,
220,
220,
220,
1303,
16926,
46,
25,
2074,
3487,
2890,
2292,
4991,
284,
29206,
13,
7370,
198,
220,
220,
220,
6376,
796,
509,
24544,
631,
7,
1930,
737,
22766,
26933,
1031,
320,
1071,
11,
22910,
11,
352,
12962,
58,
16,
60,
198,
220,
220,
220,
289,
29283,
796,
264,
13,
1136,
6601,
4663,
3419,
58,
9630,
11,
1058,
11,
1058,
60,
628,
220,
220,
220,
1366,
796,
1366,
13,
51,
198,
220,
220,
220,
1364,
796,
37786,
13,
487,
83,
42946,
6442,
7,
7890,
11,
289,
29283,
58,
15,
12962,
198,
220,
220,
220,
826,
796,
37786,
13,
487,
83,
42946,
6442,
7,
7890,
11,
289,
29283,
58,
16,
12962,
198,
220,
220,
220,
5072,
796,
45941,
13,
292,
18747,
26933,
9464,
11,
826,
35944,
2032,
499,
897,
274,
32590,
16,
11,
657,
8,
628,
220,
220,
220,
1441,
5072,
198,
198,
4299,
29365,
7,
15414,
1058,
45941,
13,
358,
18747,
11,
277,
62,
82,
25,
493,
11,
300,
1058,
12178,
11,
288,
1058,
12178,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
27967,
3048,
286,
262,
1027,
29365,
628,
220,
220,
220,
9104,
276,
355,
257,
4097,
6603,
8106,
11,
355,
287,
705,
19044,
23912,
7591,
37765,
2448,
10803,
88,
357,
33767,
33047,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
6818,
277,
62,
82,
1875,
657,
198,
220,
220,
220,
6818,
300,
18189,
657,
198,
220,
220,
220,
6818,
288,
18189,
657,
628,
220,
220,
220,
410,
796,
37290,
198,
220,
220,
220,
4461,
796,
838,
198,
220,
220,
220,
1502,
796,
352,
198,
220,
220,
220,
277,
62,
3281,
80,
796,
277,
62,
82,
1220,
362,
628,
220,
220,
220,
329,
299,
287,
685,
16,
11,
513,
11,
642,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
705,
1273,
38333,
12656,
6,
14309,
1352,
26,
14309,
803,
8373,
198,
220,
220,
220,
220,
220,
220,
220,
277,
62,
81,
796,
357,
77,
1635,
410,
8,
1220,
357,
19,
1635,
300,
1220,
8576,
1343,
657,
13,
19,
1635,
288,
1220,
8576,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4097,
6603,
2005,
49005,
6454,
7147,
264,
13,
83,
13,
329,
262,
717,
4235,
11,
484,
37319,
351,
262,
10007,
422,
34645,
198,
220,
220,
220,
220,
220,
220,
220,
1877,
8968,
796,
277,
62,
81,
532,
20007,
1303,
26109,
198,
220,
220,
220,
220,
220,
220,
220,
1029,
8968,
796,
277,
62,
81,
1343,
5323,
1303,
26109,
628,
220,
220,
220,
220,
220,
220,
220,
1877,
796,
1877,
8968,
1220,
277,
62,
3281,
80,
198,
220,
220,
220,
220,
220,
220,
220,
1029,
796,
1029,
8968,
1220,
277,
62,
3281,
80,
198,
220,
220,
220,
220,
220,
220,
220,
275,
11,
257,
796,
37786,
13,
4360,
353,
7,
2875,
11,
685,
9319,
11,
1029,
4357,
275,
4906,
796,
705,
3903,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
15853,
4461,
1635,
37786,
13,
1652,
346,
353,
7,
65,
11,
257,
11,
5128,
8,
628,
220,
220,
220,
1441,
5128,
198,
198,
4299,
3504,
7,
15414,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
27967,
262,
3048,
286,
262,
3504,
1027,
628,
220,
220,
220,
3401,
11978,
523,
1636,
355,
26795,
594,
46318,
290,
17124,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1976,
62,
958,
796,
45900,
1303,
14211,
285,
61,
12,
17,
264,
61,
12,
16,
198,
220,
220,
220,
1976,
62,
7050,
796,
352,
13,
2780,
68,
21,
1303,
14211,
285,
61,
12,
17,
264,
61,
12,
16,
198,
220,
220,
220,
317,
62,
68,
446,
6582,
796,
3126,
1303,
8085,
61,
17,
198,
220,
220,
220,
317,
62,
8325,
796,
513,
13,
17,
1303,
8085,
61,
17,
198,
220,
220,
220,
17124,
62,
76,
6765,
385,
796,
352,
13,
18,
628,
220,
220,
220,
12548,
796,
14808,
89,
62,
958,
532,
1976,
62,
7050,
8,
1220,
357,
89,
62,
958,
1343,
1976,
62,
7050,
4008,
12429,
362,
198,
220,
220,
220,
18307,
796,
352,
532,
12548,
628,
220,
220,
220,
1441,
5128,
1635,
18307,
1635,
357,
32,
62,
68,
446,
6582,
1220,
317,
62,
8325,
8,
1635,
17124,
62,
76,
6765,
385,
198,
198,
4299,
1100,
7,
34345,
1058,
965,
8,
4613,
309,
29291,
58,
37659,
13,
358,
18747,
11,
12178,
5974,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
4149,
370,
10116,
2393,
290,
3487,
1096,
284,
12178,
7177,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
277,
62,
82,
11,
1366,
796,
266,
615,
13,
961,
7,
34345,
8,
198,
220,
220,
220,
611,
1366,
13,
67,
4906,
6624,
705,
28611,
23,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1366,
1220,
14280,
532,
657,
13,
20,
198,
220,
220,
220,
1288,
361,
1366,
13,
67,
4906,
6624,
705,
600,
1433,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1366,
1220,
36203,
3134,
198,
220,
220,
220,
1288,
361,
1366,
13,
67,
4906,
6624,
705,
600,
2624,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1366,
1220,
362,
20198,
2780,
26780,
22,
198,
220,
220,
220,
1288,
361,
1366,
13,
67,
4906,
6624,
705,
22468,
2624,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
352,
13,
15,
1635,
1366,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
304,
4798,
7,
69,
6,
20560,
4049,
25,
1366,
13,
67,
4906,
796,
1391,
7890,
13,
67,
4906,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
8420,
7,
16,
8,
628,
220,
220,
220,
611,
1366,
13,
358,
320,
6624,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
33361,
198,
220,
220,
220,
220,
220,
220,
220,
1208,
198,
220,
220,
220,
1288,
361,
1366,
13,
358,
320,
6624,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
1366,
58,
45299,
657,
60,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
304,
4798,
7,
69,
6,
20560,
4049,
25,
1366,
13,
358,
320,
796,
1391,
7890,
13,
358,
320,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
8420,
7,
16,
8,
628,
220,
220,
220,
1441,
1366,
11,
277,
62,
82,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.295578 | 1,289 |
import numpy as np
import math
| [
11748,
299,
32152,
355,
45941,
198,
11748,
10688,
628,
198
] | 3.3 | 10 |
from flask import Flask, Blueprint, request, jsonify, make_response, redirect, url_for
from werkzeug.security import generate_password_hash, check_password_hash
from functools import wraps
from db import db_connect
import datetime
import jwt
import sys
auth = Blueprint('auth', __name__)
@auth.route('/login')
@db_connect
| [
6738,
42903,
1330,
46947,
11,
39932,
11,
2581,
11,
33918,
1958,
11,
787,
62,
26209,
11,
18941,
11,
19016,
62,
1640,
198,
6738,
266,
9587,
2736,
1018,
13,
12961,
1330,
7716,
62,
28712,
62,
17831,
11,
2198,
62,
28712,
62,
17831,
198,
6738,
1257,
310,
10141,
1330,
27521,
198,
6738,
20613,
1330,
20613,
62,
8443,
198,
11748,
4818,
8079,
198,
11748,
474,
46569,
198,
11748,
25064,
198,
198,
18439,
796,
39932,
10786,
18439,
3256,
11593,
3672,
834,
8,
628,
198,
198,
31,
18439,
13,
38629,
10786,
14,
38235,
11537,
198,
31,
9945,
62,
8443,
198
] | 3.431579 | 95 |
# yelp/urls.py
from django.urls import path
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
# view functions
from .views import hello
from .views import home
urlpatterns = {
path('', hello, name='hello'),
path('<slug:business_id>', home, name='home'),
}
urlpatterns = format_suffix_patterns(urlpatterns) | [
2,
331,
417,
79,
14,
6371,
82,
13,
9078,
198,
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
6738,
42625,
14208,
13,
10414,
13,
6371,
82,
1330,
19016,
198,
6738,
1334,
62,
30604,
13,
6371,
33279,
82,
1330,
5794,
62,
37333,
844,
62,
33279,
82,
198,
2,
1570,
5499,
198,
6738,
764,
33571,
1330,
23748,
198,
6738,
764,
33571,
1330,
1363,
628,
198,
6371,
33279,
82,
796,
1391,
198,
220,
220,
220,
3108,
10786,
3256,
23748,
11,
1438,
11639,
31373,
33809,
198,
220,
220,
220,
3108,
10786,
27,
6649,
1018,
25,
22680,
62,
312,
29,
3256,
1363,
11,
1438,
11639,
11195,
33809,
198,
92,
198,
198,
6371,
33279,
82,
796,
5794,
62,
37333,
844,
62,
33279,
82,
7,
6371,
33279,
82,
8
] | 2.934959 | 123 |
import tensorflow as tf
def model_inputs(image_size):
'''
Defines CNN inputs (placeholders).
:param image_size: tuple, (height, width) of an image
'''
#-> [Batch_size, image_size[0], image_size[1], 3]
inputs = tf.placeholder(dtype=tf.float32, shape=[None, image_size[0], image_size[1], 3], name='images')
targets = tf.placeholder(dtype=tf.int32, shape=[None,], name='targets')
dropout_prob = tf.placeholder(dtype=tf.float32, name='dropout_probs')
return inputs, targets, dropout_prob
def conv_block(inputs,
number_of_filters,
kernel_size,
strides=(1, 1),
padding='SAME',
activation=tf.nn.relu,
max_pool=True,
batch_norm=True):
'''
Defines convolutional block layer.
:param inputs: data from a previous layer
:param number_of_filters: integer, number of conv filters
:param kernel_size: tuple, size of conv layer kernel
:param padding: string, type of padding technique: SAME or VALID
:param activation: tf.object, activation function used on the layer
:param max_pool: boolean, if true the conv block will use max_pool
:param batch_norm: boolean, if true the conv block will use batch normalization
'''
conv_features = layer = tf.layers.conv2d(inputs=inputs,
filters=number_of_filters,
kernel_size=kernel_size,
strides=strides,
padding=padding,
activation=activation)
if max_pool:
layer = tf.layers.max_pooling2d(layer,
pool_size=(2, 2),
strides=(2, 2),
padding='SAME')
if batch_norm:
layer = tf.layers.batch_normalization(layer)
return layer, conv_features
def dense_block(inputs,
units,
activation=tf.nn.relu,
dropout_rate=None,
batch_norm=True):
'''
Defines dense block layer.
:param inputs: data from a previous layer
:param units: integer, number of neurons/units for a dense layer
:param activation: tf.object, activation function used on the layer
:param dropout_rate: dropout rate used in this dense block
:param batch_norm: boolean, if true the conv block will use batch normalization
'''
dense_features = layer = tf.layers.dense(inputs,
units=units,
activation=activation)
if dropout_rate is not None:
layer = tf.layers.dropout(layer, rate=dropout_rate)
if batch_norm:
layer = tf.layers.batch_normalization(layer)
return layer, dense_features
def opt_loss(logits,
targets,
learning_rate):
'''
Defines model's optimizer and loss functions.
:param logits: pre-activated model outputs
:param targets: true labels for each input sample
:param learning_rate: learning_rate
'''
loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=targets, logits=logits))
optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate).minimize(loss)
return loss, optimizer | [
11748,
11192,
273,
11125,
355,
48700,
201,
198,
201,
198,
201,
198,
4299,
2746,
62,
15414,
82,
7,
9060,
62,
7857,
2599,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
2896,
1127,
8100,
17311,
357,
5372,
10476,
737,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1058,
17143,
2939,
62,
7857,
25,
46545,
11,
357,
17015,
11,
9647,
8,
286,
281,
2939,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
1303,
3784,
685,
33,
963,
62,
7857,
11,
2939,
62,
7857,
58,
15,
4357,
2939,
62,
7857,
58,
16,
4357,
513,
60,
201,
198,
220,
220,
220,
17311,
796,
48700,
13,
5372,
13829,
7,
67,
4906,
28,
27110,
13,
22468,
2624,
11,
5485,
41888,
14202,
11,
2939,
62,
7857,
58,
15,
4357,
2939,
62,
7857,
58,
16,
4357,
513,
4357,
1438,
11639,
17566,
11537,
201,
198,
220,
220,
220,
6670,
796,
48700,
13,
5372,
13829,
7,
67,
4906,
28,
27110,
13,
600,
2624,
11,
5485,
41888,
14202,
11,
4357,
1438,
11639,
83,
853,
1039,
11537,
201,
198,
220,
220,
220,
4268,
448,
62,
1676,
65,
796,
48700,
13,
5372,
13829,
7,
67,
4906,
28,
27110,
13,
22468,
2624,
11,
1438,
11639,
14781,
448,
62,
1676,
1443,
11537,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1441,
17311,
11,
6670,
11,
4268,
448,
62,
1676,
65,
201,
198,
201,
198,
201,
198,
4299,
3063,
62,
9967,
7,
15414,
82,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
62,
1659,
62,
10379,
1010,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9720,
62,
7857,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
35002,
16193,
16,
11,
352,
828,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24511,
11639,
50,
10067,
3256,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14916,
28,
27110,
13,
20471,
13,
260,
2290,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
7742,
28,
17821,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
27237,
28,
17821,
2599,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
2896,
1127,
3063,
2122,
282,
2512,
7679,
13,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1058,
17143,
17311,
25,
1366,
422,
257,
2180,
7679,
201,
198,
220,
220,
220,
1058,
17143,
1271,
62,
1659,
62,
10379,
1010,
25,
18253,
11,
1271,
286,
3063,
16628,
201,
198,
220,
220,
220,
1058,
17143,
9720,
62,
7857,
25,
46545,
11,
2546,
286,
3063,
7679,
9720,
201,
198,
220,
220,
220,
1058,
17143,
24511,
25,
4731,
11,
2099,
286,
24511,
8173,
25,
311,
10067,
393,
26173,
2389,
201,
198,
220,
220,
220,
1058,
17143,
14916,
25,
48700,
13,
15252,
11,
14916,
2163,
973,
319,
262,
7679,
201,
198,
220,
220,
220,
1058,
17143,
3509,
62,
7742,
25,
25131,
11,
611,
2081,
262,
3063,
2512,
481,
779,
3509,
62,
7742,
201,
198,
220,
220,
220,
1058,
17143,
15458,
62,
27237,
25,
25131,
11,
611,
2081,
262,
3063,
2512,
481,
779,
15458,
3487,
1634,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
3063,
62,
40890,
796,
7679,
796,
48700,
13,
75,
6962,
13,
42946,
17,
67,
7,
15414,
82,
28,
15414,
82,
11,
220,
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,
16628,
28,
17618,
62,
1659,
62,
10379,
1010,
11,
220,
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,
9720,
62,
7857,
28,
33885,
62,
7857,
11,
220,
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,
35002,
28,
2536,
1460,
11,
220,
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,
24511,
28,
39231,
11,
220,
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,
14916,
28,
48545,
8,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
611,
3509,
62,
7742,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
7679,
796,
48700,
13,
75,
6962,
13,
9806,
62,
7742,
278,
17,
67,
7,
29289,
11,
220,
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,
5933,
62,
7857,
16193,
17,
11,
362,
828,
220,
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,
35002,
16193,
17,
11,
362,
828,
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,
24511,
11639,
50,
10067,
11537,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
611,
15458,
62,
27237,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
7679,
796,
48700,
13,
75,
6962,
13,
43501,
62,
11265,
1634,
7,
29289,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1441,
7679,
11,
3063,
62,
40890,
201,
198,
201,
198,
201,
198,
4299,
15715,
62,
9967,
7,
15414,
82,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4991,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14916,
28,
27110,
13,
20471,
13,
260,
2290,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4268,
448,
62,
4873,
28,
14202,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
27237,
28,
17821,
2599,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
2896,
1127,
15715,
2512,
7679,
13,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1058,
17143,
17311,
25,
1366,
422,
257,
2180,
7679,
201,
198,
220,
220,
220,
1058,
17143,
4991,
25,
18253,
11,
1271,
286,
16890,
14,
41667,
329,
257,
15715,
7679,
201,
198,
220,
220,
220,
1058,
17143,
14916,
25,
48700,
13,
15252,
11,
14916,
2163,
973,
319,
262,
7679,
201,
198,
220,
220,
220,
1058,
17143,
4268,
448,
62,
4873,
25,
4268,
448,
2494,
973,
287,
428,
15715,
2512,
201,
198,
220,
220,
220,
1058,
17143,
15458,
62,
27237,
25,
25131,
11,
611,
2081,
262,
3063,
2512,
481,
779,
15458,
3487,
1634,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
15715,
62,
40890,
796,
7679,
796,
48700,
13,
75,
6962,
13,
67,
1072,
7,
15414,
82,
11,
220,
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,
4991,
28,
41667,
11,
220,
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,
14916,
28,
48545,
8,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
611,
4268,
448,
62,
4873,
318,
407,
6045,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
7679,
796,
48700,
13,
75,
6962,
13,
14781,
448,
7,
29289,
11,
2494,
28,
14781,
448,
62,
4873,
8,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
611,
15458,
62,
27237,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
7679,
796,
48700,
13,
75,
6962,
13,
43501,
62,
11265,
1634,
7,
29289,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1441,
7679,
11,
15715,
62,
40890,
201,
198,
201,
198,
201,
198,
4299,
2172,
62,
22462,
7,
6404,
896,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6670,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4673,
62,
4873,
2599,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
2896,
1127,
2746,
338,
6436,
7509,
290,
2994,
5499,
13,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1058,
17143,
2604,
896,
25,
662,
12,
33106,
2746,
23862,
201,
198,
220,
220,
220,
1058,
17143,
6670,
25,
2081,
14722,
329,
1123,
5128,
6291,
201,
198,
220,
220,
220,
1058,
17143,
4673,
62,
4873,
25,
4673,
62,
4873,
201,
198,
220,
220,
220,
705,
7061,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
2994,
796,
48700,
13,
445,
7234,
62,
32604,
7,
27110,
13,
20471,
13,
82,
29572,
62,
4215,
9806,
62,
19692,
62,
298,
28338,
62,
4480,
62,
6404,
896,
7,
23912,
1424,
28,
83,
853,
1039,
11,
2604,
896,
28,
6404,
896,
4008,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
6436,
7509,
796,
48700,
13,
27432,
13,
23159,
27871,
320,
7509,
7,
40684,
62,
4873,
28,
40684,
62,
4873,
737,
1084,
48439,
7,
22462,
8,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
1441,
2994,
11,
6436,
7509
] | 1.979989 | 1,849 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Adapted from https://github.com/priba/nmp_qc
"""
utils.py: Functions to process dataset graphs.
Usage:
"""
from __future__ import print_function
import rdkit
import torch
from joblib import Parallel, delayed
import multiprocessing
import networkx as nx
import numpy as np
import shutil
import os
__author__ = "Pedro HC Avelar, Pau Riba, Anjan Dutta"
__email__ = "[email protected], [email protected], [email protected]"
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()
pred = pred.type_as(target)
target = target.type_as(pred)
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0)
res.append(correct_k.mul_(100.0 / batch_size))
return res
#end collate_g_concat
#end collate_g_concat
#end collate_g_concat_dict
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
30019,
276,
422,
3740,
1378,
12567,
13,
785,
14,
79,
822,
64,
14,
77,
3149,
62,
80,
66,
198,
198,
37811,
198,
220,
220,
220,
3384,
4487,
13,
9078,
25,
40480,
284,
1429,
27039,
28770,
13,
628,
220,
220,
220,
29566,
25,
198,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
11748,
374,
67,
15813,
198,
11748,
28034,
198,
6738,
1693,
8019,
1330,
42945,
11,
11038,
198,
11748,
18540,
305,
919,
278,
198,
11748,
3127,
87,
355,
299,
87,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
4423,
346,
198,
11748,
28686,
198,
198,
834,
9800,
834,
796,
366,
43468,
305,
27327,
317,
626,
283,
11,
37329,
23133,
64,
11,
1052,
13881,
360,
315,
8326,
1,
198,
834,
12888,
834,
796,
366,
746,
6888,
626,
283,
31,
10745,
13,
3046,
81,
14542,
13,
1671,
11,
279,
822,
64,
31,
66,
28435,
13,
84,
397,
13,
9246,
11,
512,
315,
8326,
31,
66,
28435,
13,
84,
397,
13,
9246,
1,
628,
198,
220,
220,
220,
220,
628,
628,
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,
198,
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,
2747,
796,
2747,
13,
4906,
62,
292,
7,
16793,
8,
198,
220,
220,
220,
2496,
796,
2496,
13,
4906,
62,
292,
7,
28764,
8,
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,
198,
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,
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,
2,
437,
2927,
378,
62,
70,
62,
1102,
9246,
198,
2,
437,
2927,
378,
62,
70,
62,
1102,
9246,
198,
198,
2,
437,
2927,
378,
62,
70,
62,
1102,
9246,
62,
11600,
628,
628
] | 2.381898 | 453 |
'''
###############################################################################
Ultrafast Quantum Optics Package
###############################################################################
Quantum Optics and Quantum Information Group
Written by
> Jean-Philippe MacLean: [email protected]
> Sacha Schwarz [email protected]
'''
#Initialize modules
from .whitepeaks.analytics import *
from .whitepeaks.interface import *
from .whitepeaks.methods import *
from .whitepeaks.states import *
#Define constants
c=0.299792458 #Speed of light in um/fs or mm/ps
import warnings
warnings.filterwarnings("ignore")
from timeit import default_timer as time | [
7061,
6,
198,
29113,
29113,
7804,
4242,
21017,
198,
36122,
7217,
29082,
13123,
873,
15717,
198,
29113,
29113,
7804,
4242,
21017,
198,
198,
24915,
388,
13123,
873,
290,
29082,
6188,
4912,
198,
25354,
416,
220,
198,
29,
11320,
12,
49680,
68,
4100,
35806,
25,
474,
4426,
6008,
272,
31,
84,
7050,
29680,
13,
6888,
198,
29,
20678,
64,
34835,
264,
34518,
13,
20601,
5767,
89,
31,
84,
7050,
29680,
13,
6888,
198,
198,
7061,
6,
198,
198,
2,
24243,
1096,
13103,
220,
198,
6738,
764,
11186,
431,
4730,
13,
38200,
14094,
1330,
1635,
220,
198,
6738,
764,
11186,
431,
4730,
13,
39994,
1330,
1635,
220,
198,
6738,
764,
11186,
431,
4730,
13,
24396,
82,
1330,
1635,
220,
198,
6738,
764,
11186,
431,
4730,
13,
27219,
1330,
1635,
220,
198,
198,
2,
7469,
500,
38491,
198,
66,
28,
15,
13,
22579,
3720,
1731,
3365,
1303,
22785,
286,
1657,
287,
23781,
14,
9501,
393,
8085,
14,
862,
198,
198,
11748,
14601,
198,
40539,
654,
13,
24455,
40539,
654,
7203,
46430,
4943,
198,
198,
6738,
640,
270,
1330,
4277,
62,
45016,
355,
640
] | 3.75 | 180 |
import os, sys
from flask import request
from flask_restplus import Namespace, Resource, fields
from flask.wrappers import Response
from app.utils.async_action import async_action
from app.api_response import ApiResponse
from app.errors import ApiException, JobTemplateNotFound, PlaybookFailure, PlaybookTimeout, SwitchNotFound
from .service import SwitchService
from .model import Switch
from .interfaces import SwitchInterfaces
from app.utils.authorization import authorize
from app.utils.logger import log
from app.utils.b64 import decode
from app.macs.service import MacService
api_description = """
Representación de los switches de la empresa.
"""
api = Namespace('Switch', description=api_description)
interfaces = SwitchInterfaces(api)
@api.route("/")
@api.response(400, 'Bad Request', interfaces.error_response_model)
@api.doc(responses={
401: 'Unauthorized',
403: 'Forbidden',
500: 'Internal server error',
502: 'Bad Gateway',
503: 'Service Unavailable',
})
class SwitchResource(Resource):
"""
Switch Resource
"""
@api.response(200, 'Lista de Switches', interfaces.many_response_model)
@log
@async_action
@authorize
async def get(self):
"""
Devuelve la lista de Switches
"""
try:
entities = await SwitchService.get_all()
return ApiResponse(interfaces.many_schema.dump(entities).data)
except JobTemplateNotFound:
raise ApiException('No existe un playbook para obtener la infrmación de las interfaces')
except PlaybookTimeout:
raise ApiException('La ejecución de la tarea supero el tiempo del timeout')
except PlaybookFailure:
raise ApiException('Fallo la ejecución de la tarea')
@api.expect(interfaces.create_model)
@api.response(200, 'Nuevo Switch', interfaces.single_response_model)
@log
@authorize
def post(self):
"""
Crea un nuevo Switch.
"""
json_data = request.get_json()
if json_data is None:
raise ApiException('JSON body is undefined')
body = interfaces.single_schema.load(json_data).data
Switch = SwitchService.create(body)
return ApiResponse(interfaces.single_schema.dump(Switch).data)
@api.expect(interfaces.update_model)
@api.response(200, 'Switches Actualizados', interfaces.many_response_model)
@log
@authorize
def put(self, id: int):
"""
Actualiza un batch de Switches por su ID.
"""
json_data = request.get_json()
sw_updated = []
for item in json_data:
sw = interfaces.single_schema.load(request.json).data
sw_updated.append(SwitchService.update(id, sw))
return ApiResponse(interfaces.many_schema.dump(sw_updated).data)
@api.route("/<int:id>")
@api.param("id", "Identificador único del Switch")
@api.response(400, 'Bad Request', interfaces.error_response_model)
@api.doc(responses={
401: 'Unauthorized',
403: 'Forbidden',
500: 'Internal server error',
502: 'Bad Gateway',
503: 'Service Unavailable',
})
@api.route("/inventory")
@api.response(400, 'Bad Request', interfaces.error_response_model)
@api.doc(responses={
401: 'Unauthorized',
403: 'Forbidden',
500: 'Internal server error',
502: 'Bad Gateway',
503: 'Service Unavailable',
})
class SwitchInventoryResource(Resource):
"""
Inventory switch Resource
"""
@api.response(200, 'Inventario con lista de swithces')
@async_action
async def get(self):
"""
Devuelve la lista de Switches
"""
try:
entities = await SwitchService.get_all()
ansible_switches_vars = {}
for x in entities:
ansible_switches_vars[x.name] = {
"ansible_host": x.ip,
"ansible_become": True,
"ansible_become_method": "enable",
"ansible_connection": "network_cli",
"ansible_network_os": "ios",
"ansible_port": x.ansible_ssh_port or 22,
"ansible_user": decode(x.ansible_user),
"ansible_ssh_pass": decode(x.ansible_ssh_pass)
}
ansible_switches_hostnames = map(lambda x : x.name, entities)
sw_inv = {
'group': {
'hosts': list(ansible_switches_hostnames),
},
'_meta': {
'hostvars': ansible_switches_vars
}
}
return ApiResponse(sw_inv)
except JobTemplateNotFound:
raise ApiException('No existe un playbook para obtener la infrmación de las interfaces')
except PlaybookTimeout:
raise ApiException('La ejecución de la tarea supero el tiempo del timeout')
except PlaybookFailure:
raise ApiException('Fallo la ejecución de la tarea')
@api.route("/<int:id>/macs")
@api.param("id", "Identificador único del Switch")
class SwitchMacResource(Resource):
"""
Mac Resource
"""
@api.response(200, 'Lista de Interfaces con sus respectivas macs', interfaces.many_response_model)
@log
@async_action
@authorize
async def get(self, switch_id: int):
"""
Devuelve la lista de todaslas macs del switch
"""
try:
resp = await MacService.get(switch_id)
return ApiResponse(resp)
except SwitchNotFound:
raise ApiException(f'No se encuentra un switch con el id:{switch_id}')
except JobTemplateNotFound:
raise ApiException('No existe un playbook para obtener la infrmación de las interfaces')
except PlaybookTimeout:
raise ApiException('La ejecución de la tarea supero el tiempo del timeout')
except PlaybookFailure:
raise ApiException('Fallo la ejecución de la tarea')
| [
11748,
28686,
11,
25064,
198,
6738,
42903,
1330,
2581,
198,
6738,
42903,
62,
2118,
9541,
1330,
28531,
10223,
11,
20857,
11,
7032,
198,
6738,
42903,
13,
29988,
11799,
1330,
18261,
198,
6738,
598,
13,
26791,
13,
292,
13361,
62,
2673,
1330,
30351,
62,
2673,
198,
198,
6738,
598,
13,
15042,
62,
26209,
1330,
5949,
72,
31077,
198,
6738,
598,
13,
48277,
1330,
5949,
72,
16922,
11,
15768,
30800,
3673,
21077,
11,
3811,
2070,
50015,
11,
3811,
2070,
48031,
11,
14645,
3673,
21077,
198,
6738,
764,
15271,
1330,
14645,
16177,
198,
6738,
764,
19849,
1330,
14645,
198,
6738,
764,
3849,
32186,
1330,
14645,
9492,
32186,
198,
198,
6738,
598,
13,
26791,
13,
9800,
1634,
1330,
29145,
198,
6738,
598,
13,
26791,
13,
6404,
1362,
1330,
2604,
198,
6738,
598,
13,
26791,
13,
65,
2414,
1330,
36899,
198,
6738,
598,
13,
76,
16436,
13,
15271,
1330,
4100,
16177,
198,
198,
15042,
62,
11213,
796,
37227,
198,
40171,
32009,
18840,
390,
22346,
18225,
390,
8591,
795,
79,
14625,
13,
198,
37811,
198,
198,
15042,
796,
28531,
10223,
10786,
38978,
3256,
6764,
28,
15042,
62,
11213,
8,
198,
3849,
32186,
796,
14645,
9492,
32186,
7,
15042,
8,
198,
198,
31,
15042,
13,
38629,
7203,
14,
4943,
198,
31,
15042,
13,
26209,
7,
7029,
11,
705,
22069,
19390,
3256,
20314,
13,
18224,
62,
26209,
62,
19849,
8,
198,
31,
15042,
13,
15390,
7,
16733,
274,
34758,
198,
220,
220,
220,
22219,
25,
705,
52,
2616,
1457,
1143,
3256,
198,
220,
220,
220,
38210,
25,
705,
1890,
37978,
3256,
198,
220,
220,
220,
5323,
25,
705,
37693,
4382,
4049,
3256,
198,
220,
220,
220,
47233,
25,
705,
22069,
29916,
3256,
198,
220,
220,
220,
44541,
25,
705,
16177,
791,
15182,
3256,
198,
30072,
198,
4871,
14645,
26198,
7,
26198,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
14645,
20857,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2488,
15042,
13,
26209,
7,
2167,
11,
705,
8053,
64,
390,
2451,
9249,
3256,
20314,
13,
21834,
62,
26209,
62,
19849,
8,
198,
220,
220,
220,
2488,
6404,
198,
220,
220,
220,
2488,
292,
13361,
62,
2673,
198,
220,
220,
220,
2488,
9800,
1096,
198,
220,
220,
220,
30351,
825,
651,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6245,
2731,
303,
8591,
1351,
64,
390,
2451,
9249,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12066,
796,
25507,
14645,
16177,
13,
1136,
62,
439,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
5949,
72,
31077,
7,
3849,
32186,
13,
21834,
62,
15952,
2611,
13,
39455,
7,
298,
871,
737,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
15768,
30800,
3673,
21077,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
2949,
2152,
68,
555,
41794,
31215,
909,
83,
877,
8591,
1167,
81,
20285,
72,
18840,
390,
39990,
20314,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
3811,
2070,
48031,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
14772,
304,
73,
721,
42008,
18840,
390,
8591,
256,
20337,
2208,
78,
1288,
256,
26597,
7501,
1619,
26827,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
3811,
2070,
50015,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
24750,
78,
8591,
304,
73,
721,
42008,
18840,
390,
8591,
256,
20337,
11537,
198,
220,
220,
220,
2488,
15042,
13,
1069,
806,
7,
3849,
32186,
13,
17953,
62,
19849,
8,
198,
220,
220,
220,
2488,
15042,
13,
26209,
7,
2167,
11,
705,
45,
518,
13038,
14645,
3256,
20314,
13,
29762,
62,
26209,
62,
19849,
8,
198,
220,
220,
220,
2488,
6404,
198,
220,
220,
220,
2488,
9800,
1096,
198,
220,
220,
220,
825,
1281,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5844,
64,
555,
299,
518,
13038,
14645,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
33918,
62,
7890,
796,
2581,
13,
1136,
62,
17752,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
611,
33918,
62,
7890,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
40386,
1767,
318,
28721,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1767,
796,
20314,
13,
29762,
62,
15952,
2611,
13,
2220,
7,
17752,
62,
7890,
737,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
14645,
796,
14645,
16177,
13,
17953,
7,
2618,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
5949,
72,
31077,
7,
3849,
32186,
13,
29762,
62,
15952,
2611,
13,
39455,
7,
38978,
737,
7890,
8,
628,
220,
220,
220,
2488,
15042,
13,
1069,
806,
7,
3849,
32186,
13,
19119,
62,
19849,
8,
198,
220,
220,
220,
2488,
15042,
13,
26209,
7,
2167,
11,
705,
10462,
9249,
33520,
528,
22484,
3256,
20314,
13,
21834,
62,
26209,
62,
19849,
8,
198,
220,
220,
220,
2488,
6404,
198,
220,
220,
220,
2488,
9800,
1096,
198,
220,
220,
220,
825,
1234,
7,
944,
11,
4686,
25,
493,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
33520,
23638,
555,
15458,
390,
2451,
9249,
16964,
424,
4522,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
33918,
62,
7890,
796,
2581,
13,
1136,
62,
17752,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1509,
62,
43162,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2378,
287,
33918,
62,
7890,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1509,
796,
20314,
13,
29762,
62,
15952,
2611,
13,
2220,
7,
25927,
13,
17752,
737,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1509,
62,
43162,
13,
33295,
7,
38978,
16177,
13,
19119,
7,
312,
11,
1509,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
5949,
72,
31077,
7,
3849,
32186,
13,
21834,
62,
15952,
2611,
13,
39455,
7,
2032,
62,
43162,
737,
7890,
8,
198,
198,
31,
15042,
13,
38629,
7203,
14,
27,
600,
25,
312,
29,
4943,
198,
31,
15042,
13,
17143,
7203,
312,
1600,
366,
33234,
811,
7079,
6184,
118,
77,
3713,
1619,
14645,
4943,
198,
31,
15042,
13,
26209,
7,
7029,
11,
705,
22069,
19390,
3256,
20314,
13,
18224,
62,
26209,
62,
19849,
8,
198,
31,
15042,
13,
15390,
7,
16733,
274,
34758,
198,
220,
220,
220,
22219,
25,
705,
52,
2616,
1457,
1143,
3256,
198,
220,
220,
220,
38210,
25,
705,
1890,
37978,
3256,
198,
220,
220,
220,
5323,
25,
705,
37693,
4382,
4049,
3256,
198,
220,
220,
220,
47233,
25,
705,
22069,
29916,
3256,
198,
220,
220,
220,
44541,
25,
705,
16177,
791,
15182,
3256,
198,
30072,
198,
31,
15042,
13,
38629,
7203,
14,
24807,
4943,
198,
31,
15042,
13,
26209,
7,
7029,
11,
705,
22069,
19390,
3256,
20314,
13,
18224,
62,
26209,
62,
19849,
8,
198,
31,
15042,
13,
15390,
7,
16733,
274,
34758,
198,
220,
220,
220,
22219,
25,
705,
52,
2616,
1457,
1143,
3256,
198,
220,
220,
220,
38210,
25,
705,
1890,
37978,
3256,
198,
220,
220,
220,
5323,
25,
705,
37693,
4382,
4049,
3256,
198,
220,
220,
220,
47233,
25,
705,
22069,
29916,
3256,
198,
220,
220,
220,
44541,
25,
705,
16177,
791,
15182,
3256,
198,
30072,
198,
4871,
14645,
818,
17158,
26198,
7,
26198,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
35772,
5078,
20857,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2488,
15042,
13,
26209,
7,
2167,
11,
705,
818,
1151,
4982,
369,
1351,
64,
390,
1509,
342,
728,
11537,
198,
220,
220,
220,
2488,
292,
13361,
62,
2673,
198,
220,
220,
220,
30351,
825,
651,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6245,
2731,
303,
8591,
1351,
64,
390,
2451,
9249,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12066,
796,
25507,
14645,
16177,
13,
1136,
62,
439,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9093,
856,
62,
2032,
9249,
62,
85,
945,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2124,
220,
287,
12066,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9093,
856,
62,
2032,
9249,
62,
85,
945,
58,
87,
13,
3672,
60,
796,
1391,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
4774,
1298,
2124,
13,
541,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
9423,
462,
1298,
6407,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
9423,
462,
62,
24396,
1298,
366,
21633,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
38659,
1298,
366,
27349,
62,
44506,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
27349,
62,
418,
1298,
366,
4267,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
634,
1298,
2124,
13,
504,
856,
62,
45824,
62,
634,
393,
2534,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
7220,
1298,
36899,
7,
87,
13,
504,
856,
62,
7220,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
504,
856,
62,
45824,
62,
6603,
1298,
36899,
7,
87,
13,
504,
856,
62,
45824,
62,
6603,
8,
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,
220,
220,
220,
220,
9093,
856,
62,
2032,
9249,
62,
4774,
14933,
796,
3975,
7,
50033,
2124,
1058,
2124,
13,
3672,
11,
12066,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1509,
62,
16340,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
8094,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4774,
82,
10354,
1351,
7,
504,
856,
62,
2032,
9249,
62,
4774,
14933,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
62,
28961,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4774,
85,
945,
10354,
9093,
856,
62,
2032,
9249,
62,
85,
945,
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,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
5949,
72,
31077,
7,
2032,
62,
16340,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
15768,
30800,
3673,
21077,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
2949,
2152,
68,
555,
41794,
31215,
909,
83,
877,
8591,
1167,
81,
20285,
72,
18840,
390,
39990,
20314,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
3811,
2070,
48031,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
14772,
304,
73,
721,
42008,
18840,
390,
8591,
256,
20337,
2208,
78,
1288,
256,
26597,
7501,
1619,
26827,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
3811,
2070,
50015,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
24750,
78,
8591,
304,
73,
721,
42008,
18840,
390,
8591,
256,
20337,
11537,
198,
198,
31,
15042,
13,
38629,
7203,
14,
27,
600,
25,
312,
29,
14,
76,
16436,
4943,
198,
31,
15042,
13,
17143,
7203,
312,
1600,
366,
33234,
811,
7079,
6184,
118,
77,
3713,
1619,
14645,
4943,
198,
4871,
14645,
14155,
26198,
7,
26198,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4100,
20857,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2488,
15042,
13,
26209,
7,
2167,
11,
705,
8053,
64,
390,
4225,
32186,
369,
2341,
2461,
38630,
8352,
82,
3256,
20314,
13,
21834,
62,
26209,
62,
19849,
8,
198,
220,
220,
220,
2488,
6404,
198,
220,
220,
220,
2488,
292,
13361,
62,
2673,
198,
220,
220,
220,
2488,
9800,
1096,
198,
220,
220,
220,
30351,
825,
651,
7,
944,
11,
5078,
62,
312,
25,
493,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6245,
2731,
303,
8591,
1351,
64,
390,
284,
67,
292,
21921,
8352,
82,
1619,
5078,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1217,
796,
25507,
4100,
16177,
13,
1136,
7,
31943,
62,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
5949,
72,
31077,
7,
4363,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
14645,
3673,
21077,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
7,
69,
6,
2949,
384,
2207,
84,
298,
430,
555,
5078,
369,
1288,
4686,
29164,
31943,
62,
312,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
15768,
30800,
3673,
21077,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
2949,
2152,
68,
555,
41794,
31215,
909,
83,
877,
8591,
1167,
81,
20285,
72,
18840,
390,
39990,
20314,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
3811,
2070,
48031,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
14772,
304,
73,
721,
42008,
18840,
390,
8591,
256,
20337,
2208,
78,
1288,
256,
26597,
7501,
1619,
26827,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
3811,
2070,
50015,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
5949,
72,
16922,
10786,
24750,
78,
8591,
304,
73,
721,
42008,
18840,
390,
8591,
256,
20337,
11537,
198
] | 2.337255 | 2,550 |
# Authors: Stephane Gaiffas <[email protected]>
# Ibrahim Merad <[email protected]>
# License: BSD 3 clause
"""
This module implement the ``TMean`` class for the trimmed-means robust estimator.
`StateTMean` is a place-holder for the TMean estimator containing:
"""
from collections import namedtuple
import numpy as np
from numba import jit
from ._base import Estimator, jit_kwargs
from .._utils import np_float, trimmed_mean, fast_trimmed_mean
StateTMean = namedtuple(
"StateTMean",
[
"deriv_samples",
"deriv_samples_outer_prods",
"gradient",
"loss_derivative",
"partial_derivative",
],
)
class TMean(Estimator):
"""Trimmed-mean estimator"""
| [
2,
46665,
25,
39644,
1531,
12822,
733,
292,
1279,
9662,
71,
1531,
13,
4908,
733,
292,
31,
14816,
13,
785,
29,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
30917,
4638,
324,
1279,
22723,
324,
22,
31,
14816,
13,
785,
29,
198,
2,
13789,
25,
347,
10305,
513,
13444,
198,
198,
37811,
198,
1212,
8265,
3494,
262,
7559,
51,
5308,
272,
15506,
1398,
329,
262,
40325,
12,
1326,
504,
12373,
3959,
1352,
13,
198,
198,
63,
9012,
51,
5308,
272,
63,
318,
257,
1295,
12,
13829,
329,
262,
309,
5308,
272,
3959,
1352,
7268,
25,
198,
198,
37811,
198,
198,
6738,
17268,
1330,
3706,
83,
29291,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
997,
7012,
1330,
474,
270,
198,
6738,
47540,
8692,
1330,
10062,
320,
1352,
11,
474,
270,
62,
46265,
22046,
198,
6738,
11485,
62,
26791,
1330,
45941,
62,
22468,
11,
40325,
62,
32604,
11,
3049,
62,
2213,
320,
1150,
62,
32604,
198,
198,
9012,
51,
5308,
272,
796,
3706,
83,
29291,
7,
198,
220,
220,
220,
366,
9012,
51,
5308,
272,
1600,
198,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1082,
452,
62,
82,
12629,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
1082,
452,
62,
82,
12629,
62,
39605,
62,
1676,
9310,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
49607,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
22462,
62,
1082,
452,
876,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
47172,
62,
1082,
452,
876,
1600,
198,
220,
220,
220,
16589,
198,
8,
628,
198,
4871,
309,
5308,
272,
7,
22362,
320,
1352,
2599,
198,
220,
220,
220,
37227,
2898,
320,
1150,
12,
32604,
3959,
1352,
37811,
628
] | 2.491409 | 291 |
from typing import Set, List, Tuple
from bauh.api.abstract.handler import ProcessWatcher
from bauh.api.abstract.view import MultipleSelectComponent, InputOption
from bauh.commons import resource
from bauh.commons.html import bold
from bauh.gems.arch import ROOT_DIR
from bauh.view.util.translation import I18n
| [
6738,
19720,
1330,
5345,
11,
7343,
11,
309,
29291,
198,
198,
6738,
275,
559,
71,
13,
15042,
13,
397,
8709,
13,
30281,
1330,
10854,
54,
34734,
198,
6738,
275,
559,
71,
13,
15042,
13,
397,
8709,
13,
1177,
1330,
20401,
17563,
21950,
11,
23412,
19722,
198,
6738,
275,
559,
71,
13,
9503,
684,
1330,
8271,
198,
6738,
275,
559,
71,
13,
9503,
684,
13,
6494,
1330,
10758,
198,
6738,
275,
559,
71,
13,
70,
5232,
13,
998,
1330,
15107,
2394,
62,
34720,
198,
6738,
275,
559,
71,
13,
1177,
13,
22602,
13,
41519,
1330,
314,
1507,
77,
628,
628
] | 3.171717 | 99 |
from policyglass import Action, EffectiveAction
| [
6738,
2450,
20721,
1330,
7561,
11,
29455,
12502,
628
] | 5.444444 | 9 |
import unittest
import shutil
import tempfile
from os import path
from unittest.mock import patch, mock_open
from taurex.model.model import ForwardModel
from taurex.model.simplemodel import SimpleForwardModel
import numpy as np
import pickle
| [
198,
11748,
555,
715,
395,
198,
11748,
4423,
346,
198,
11748,
20218,
7753,
198,
6738,
28686,
1330,
3108,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
8529,
11,
15290,
62,
9654,
198,
6738,
20486,
495,
87,
13,
19849,
13,
19849,
1330,
19530,
17633,
198,
6738,
20486,
495,
87,
13,
19849,
13,
36439,
19849,
1330,
17427,
39746,
17633,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2298,
293,
628,
198
] | 3.5 | 70 |
from typing import List
# 迭代先序遍历
| [
6738,
19720,
1330,
7343,
198,
198,
2,
5525,
123,
255,
47987,
17739,
230,
41753,
237,
34402,
235,
43889,
228,
198
] | 1.7 | 20 |
# if __name__ == '__main__':
# print "the generator function:"
# print repr(counter)
# print "call generator function"
# c = counter()
# print "the generator:"
# print repr(c)
# print 'iterate'
# for item in c:
# print 'received:', item
| [
198,
198,
2,
611,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
2,
220,
220,
220,
220,
3601,
366,
1169,
17301,
2163,
11097,
198,
2,
220,
220,
220,
220,
3601,
41575,
7,
24588,
8,
198,
2,
220,
220,
220,
220,
3601,
366,
13345,
17301,
2163,
1,
198,
198,
2,
220,
220,
220,
220,
269,
796,
3753,
3419,
198,
2,
220,
220,
220,
220,
3601,
366,
1169,
17301,
11097,
198,
2,
220,
220,
220,
220,
3601,
41575,
7,
66,
8,
198,
198,
2,
220,
220,
220,
220,
3601,
705,
2676,
378,
6,
198,
2,
220,
220,
220,
220,
329,
2378,
287,
269,
25,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
705,
47844,
25,
3256,
2378,
198
] | 2.322314 | 121 |
# -*- coding: utf-8 -*-
#
# Star Trek: Interstellar Transport
#
# Written in 2021 by Moky <[email protected]>
#
# ==============================================================================
# MIT License
#
# Copyright (c) 2021 Albert Moky
#
# 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.
# ==============================================================================
import socket
from abc import ABC, abstractmethod
from typing import Optional, Set
from ..fsm import Processor
from .channel import Channel
from .connection import Connection
class Hub(Processor, ABC):
""" Connections & Channels Container """
@abstractmethod
def open_channel(self, remote: Optional[tuple], local: Optional[tuple]) -> Optional[Channel]:
"""
Open a channel with direction (remote, local)
:param remote: remote address to connected
:param local: local address to bound
:return: None on socket error
"""
raise NotImplemented
@abstractmethod
def close_channel(self, channel: Channel):
"""
Close socket channel
:param channel: socket channel
:return:
"""
raise NotImplemented
@abstractmethod
def connect(self, remote: tuple, local: Optional[tuple] = None) -> Optional[Connection]:
"""
Get connection with direction (remote, local)
:param remote: remote address
:param local: local address
:return: None on channel not opened
"""
raise NotImplemented
@abstractmethod
def disconnect(self, remote: tuple = None, local: Optional[tuple] = None,
connection: Connection = None) -> Optional[Connection]:
"""
Close connection
:param remote: remote address
:param local: local address
:param connection: closing connection
:return: closed connection
"""
raise NotImplemented
#
# Local Address
#
@classmethod
@classmethod
@classmethod
@classmethod
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
220,
220,
2907,
12338,
25,
49041,
19940,
198,
2,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22503,
287,
33448,
416,
337,
31375,
1279,
282,
4835,
13,
76,
31375,
31,
14816,
13,
785,
29,
198,
2,
198,
2,
38093,
25609,
28,
198,
2,
17168,
13789,
198,
2,
198,
2,
15069,
357,
66,
8,
33448,
9966,
337,
31375,
198,
2,
198,
2,
2448,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
4866,
198,
2,
286,
428,
3788,
290,
3917,
10314,
3696,
357,
1169,
366,
25423,
12340,
284,
1730,
198,
2,
287,
262,
10442,
1231,
17504,
11,
1390,
1231,
17385,
262,
2489,
198,
2,
284,
779,
11,
4866,
11,
13096,
11,
20121,
11,
7715,
11,
14983,
11,
850,
43085,
11,
290,
14,
273,
3677,
198,
2,
9088,
286,
262,
10442,
11,
290,
284,
8749,
6506,
284,
4150,
262,
10442,
318,
198,
2,
30760,
284,
466,
523,
11,
2426,
284,
262,
1708,
3403,
25,
198,
2,
198,
2,
383,
2029,
6634,
4003,
290,
428,
7170,
4003,
2236,
307,
3017,
287,
477,
198,
2,
9088,
393,
8904,
16690,
286,
262,
10442,
13,
198,
2,
198,
2,
3336,
47466,
3180,
36592,
2389,
1961,
366,
1921,
3180,
1600,
42881,
34764,
56,
3963,
15529,
509,
12115,
11,
7788,
32761,
6375,
198,
2,
8959,
49094,
11,
47783,
2751,
21728,
5626,
40880,
5390,
3336,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
11,
198,
2,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
44521,
1268,
10913,
2751,
12529,
13,
3268,
8005,
49261,
50163,
3336,
198,
2,
37195,
20673,
6375,
27975,
38162,
9947,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
198,
2,
43031,
25382,
11,
7655,
2767,
16879,
3268,
3537,
40282,
3963,
27342,
10659,
11,
309,
9863,
6375,
25401,
54,
24352,
11,
5923,
1797,
2751,
16034,
11,
198,
2,
16289,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
47466,
6375,
3336,
23210,
6375,
25401,
5550,
1847,
20754,
3268,
3336,
198,
2,
47466,
13,
198,
2,
38093,
25609,
28,
198,
198,
11748,
17802,
198,
6738,
450,
66,
1330,
9738,
11,
12531,
24396,
198,
6738,
19720,
1330,
32233,
11,
5345,
198,
198,
6738,
11485,
69,
5796,
1330,
32893,
198,
198,
6738,
764,
17620,
1330,
11102,
198,
6738,
764,
38659,
1330,
26923,
628,
198,
4871,
14699,
7,
18709,
273,
11,
9738,
2599,
198,
220,
220,
220,
37227,
8113,
507,
1222,
609,
8961,
43101,
37227,
628,
220,
220,
220,
2488,
397,
8709,
24396,
198,
220,
220,
220,
825,
1280,
62,
17620,
7,
944,
11,
6569,
25,
32233,
58,
83,
29291,
4357,
1957,
25,
32233,
58,
83,
29291,
12962,
4613,
32233,
58,
29239,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4946,
257,
6518,
351,
4571,
357,
47960,
11,
1957,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
6569,
25,
6569,
2209,
284,
5884,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1957,
25,
220,
1957,
2209,
284,
5421,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
319,
17802,
4049,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
628,
220,
220,
220,
2488,
397,
8709,
24396,
198,
220,
220,
220,
825,
1969,
62,
17620,
7,
944,
11,
6518,
25,
11102,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13872,
17802,
6518,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
6518,
25,
17802,
6518,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
628,
220,
220,
220,
2488,
397,
8709,
24396,
198,
220,
220,
220,
825,
2018,
7,
944,
11,
6569,
25,
46545,
11,
1957,
25,
32233,
58,
83,
29291,
60,
796,
6045,
8,
4613,
32233,
58,
32048,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3497,
4637,
351,
4571,
357,
47960,
11,
1957,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
6569,
25,
6569,
2209,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1957,
25,
220,
1957,
2209,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
319,
6518,
407,
4721,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
628,
220,
220,
220,
2488,
397,
8709,
24396,
198,
220,
220,
220,
825,
22837,
7,
944,
11,
6569,
25,
46545,
796,
6045,
11,
1957,
25,
32233,
58,
83,
29291,
60,
796,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4637,
25,
26923,
796,
6045,
8,
4613,
32233,
58,
32048,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
13872,
4637,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
6569,
25,
6569,
2209,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1957,
25,
220,
1957,
2209,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4637,
25,
9605,
4637,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
4838,
4637,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
1892,
3546,
1154,
12061,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
220,
220,
10714,
17917,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
2488,
4871,
24396,
628,
220,
220,
220,
2488,
4871,
24396,
628,
220,
220,
220,
2488,
4871,
24396,
628,
220,
220,
220,
2488,
4871,
24396,
198
] | 3.091908 | 1,001 |
#!/usr/bin/python
# Filename: TMWP_OO_CustDataStructures.py
# TMWP = TheMitchWorksPro
# Functions and/or Objects for smarter handling of common data structures
# required imports are noted in the code where used/required
# from ... import ...
version = '0.1'
python_version_support = 'code shoud be compatibile w/ Python 2.7 and Python 3.x'
import collections
# source: https://code.activestate.com/recipes/576694/
# added to collection for testing but may or may not be tested yet
# notes say this was created for Python 2.6 but should be compatible w/ 2.7 and 3.x
# Alternatives: from sortedcontainers import SortedSet
# pip install sortedcontainers library to use it
# libraries needed: import collections | [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
2,
7066,
12453,
25,
309,
14326,
47,
62,
6684,
62,
34,
436,
6601,
44909,
942,
13,
9078,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
14326,
47,
796,
383,
44,
2007,
23044,
2964,
198,
198,
2,
40480,
290,
14,
273,
35832,
329,
23714,
9041,
286,
2219,
1366,
8573,
198,
2,
2672,
17944,
389,
4367,
287,
262,
2438,
810,
973,
14,
35827,
198,
2,
422,
2644,
1330,
2644,
198,
198,
9641,
796,
705,
15,
13,
16,
6,
198,
29412,
62,
9641,
62,
11284,
796,
705,
8189,
427,
2778,
307,
8330,
571,
576,
266,
14,
11361,
362,
13,
22,
290,
11361,
513,
13,
87,
6,
628,
198,
11748,
17268,
198,
220,
220,
220,
1303,
2723,
25,
3740,
1378,
8189,
13,
15791,
44146,
13,
785,
14,
8344,
18636,
14,
3553,
2791,
5824,
14,
198,
197,
2,
220,
220,
220,
220,
220,
220,
220,
220,
2087,
284,
4947,
329,
4856,
475,
743,
393,
743,
407,
307,
6789,
1865,
198,
197,
2,
220,
220,
220,
220,
220,
220,
220,
220,
4710,
910,
428,
373,
2727,
329,
11361,
362,
13,
21,
475,
815,
307,
11670,
266,
14,
362,
13,
22,
290,
513,
13,
87,
198,
197,
2,
13243,
2929,
25,
220,
422,
23243,
3642,
50221,
1330,
311,
9741,
7248,
198,
197,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7347,
2721,
23243,
3642,
50221,
5888,
284,
779,
340,
198,
197,
198,
197,
2,
12782,
2622,
25,
220,
1330,
17268
] | 3.015748 | 254 |
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""File-based buffer common.
A file-based buffer which writes its events to a single file on disk, and
separately maintains metadata.
There are three files maintained, plus one for each consumer created:
data.json:
Stores actual data. Each line corresponds to one event. As events are
written to disk, each one is given a sequence number. Format of each line:
[SEQ_NUM, {EVENT_DATA}, CRC_SUM]
Writing SEQ_NUM to data.json is not strictly necessary since we keep track
of sequence numbers in metadata, but it is useful for debugging, and could
also help when restoring a corrupt database.
metadata.json:
Stores current sequence numbers and cursor positions. The "first seq" and
"start pos" are taken to be absolute to the original untruncated data file,
and refer to the beginning of data currently stored on disk.
So if seq=1 was consumed by all Consumers, and Truncate removed it from
disk, first_seq would be set to 2.
Note that since the cursor positions are absolute, start_pos must be
subtracted to get the actual position in the file on disk, e.g.:
f.seek(current_pos - start_pos)
consumers.json:
Stores a list of all active Consumers. If a Consumer is removed, it will be
removed from this list, but its metadata file will continue to exist. If it
is ever re-created, the existing metadata will be used. If this is
undesired behaviour, the metadata file for that Consumer should be manually
deleted.
consumer_X.json:
Stores the sequence number and cursor position of a particular Consumer.
Versioning:
Another concept that is worth explaining separately is "versioning". We want
to support truncating, that is, when our file contains N records which have
already been consumed by all Consumers, and M remaining records, remove the
first N records from the main data file in order to save disk space. After
rewriting the data file, update metadata accordingly.
But what happens if a failure occurs in between these two steps? Our "old"
metadata now is now paired with a "new" data file, which means we will likely
be unable to read anything properly.
To solve this problem, before re-writing the main data file, we save a
metadata file to disk with both "old" and "new" metadata versions *before*
performing a truncate on the main data file. The key is a CRC hash of the
first line of the main data file. When the buffer first starts, it will check
to see which key matches the first line, and it will use this metadata
version.
Thus, if a failure occurs *before* writing the main data file, the "old"
metadata can be used. If a failure occurs *after* writing the main data file,
the "new" metadata can be used.
"""
import copy
import json
import logging
import os
import shutil
import zlib
from cros.factory.instalog import datatypes
from cros.factory.instalog import lock_utils
from cros.factory.instalog import log_utils
from cros.factory.instalog import plugin_base
from cros.factory.instalog.utils import file_utils
# The number of bytes to buffer when retrieving events from a file.
_BUFFER_SIZE_BYTES = 4 * 1024 # 4kb
class SimpleFileException(Exception):
"""General exception type for this plugin."""
def GetChecksumLegacy(data):
"""Generates an 8-character CRC32 checksum of given string."""
# TODO(chuntsen): Remove this legacy function.
# The function crc32() returns a signed 32-bit integer in Python2, but it
# returns an unsigned 32-bit integer in Python3. To generate the same value
# across all Python versions, we convert unsigned integer to signed integer.
checksum = zlib.crc32(data.encode('utf-8'))
if checksum >= 2**31:
checksum -= 2**32
return '{:08x}'.format(abs(checksum))
def GetChecksum(data):
"""Generates an 8-character CRC32 checksum of given string."""
# The function crc32() returns a signed 32-bit integer in Python2, but it
# returns an unsigned 32-bit integer in Python3. To generate the same value
# across all Python versions, we use "crc32() & 0xffffffff".
return '{:08x}'.format(zlib.crc32(data.encode('utf-8')) & 0xffffffff)
def FormatRecord(seq, record):
"""Returns a record formatted as a line to be written to disk."""
data = '%d, %s' % (seq, record)
checksum = GetChecksum(data)
return '[%s, "%s"]\n' % (data, checksum)
def ParseRecord(line, logger_name=None):
"""Parses and returns a line from disk as a record.
Returns:
A tuple of (seq_number, record), or None on failure.
"""
logger = logging.getLogger(logger_name)
line_inner = line.rstrip()[1:-1] # Strip [] and newline
data, _, checksum = line_inner.rpartition(', ')
# TODO(chuntsen): Change this method after a long time.
checksum = checksum.strip('"')
seq, _, record = data.partition(', ')
if not seq or not record:
logger.warning('Parsing error for record %s', line.rstrip())
return None, None
if checksum != GetChecksum(data) and checksum != GetChecksumLegacy(data):
logger.warning('Checksum error for record %s', line.rstrip())
return None, None
return int(seq), record
def TryLoadJSON(path, logger_name=None):
"""Attempts to load JSON from the given file.
Returns:
Parsed data from the file. None if the file does not exist.
Raises:
Exception if there was some other problem reading the file, or if something
went wrong parsing the data.
"""
logger = logging.getLogger(logger_name)
if not os.path.isfile(path):
logger.debug('%s: does not exist', path)
return None
try:
with open(path, 'r') as f:
return json.load(f)
except Exception:
logger.exception('%s: Error reading disk or loading JSON', path)
raise
def CopyAttachmentsToTempDir(att_paths, tmp_dir, logger_name=None):
"""Copys attachments to the temporary directory."""
logger = logging.getLogger(logger_name)
try:
for att_path in att_paths:
# Check that the source file exists.
if not os.path.isfile(att_path):
raise ValueError('Attachment path `%s` specified in event does not '
'exist' % att_path)
target_path = os.path.join(tmp_dir, att_path.replace('/', '_'))
logger.debug('Copying attachment: %s --> %s',
att_path, target_path)
with open(target_path, 'w') as dst_f:
with open(att_path, 'r') as src_f:
shutil.copyfileobj(src_f, dst_f)
# Fsync the file and the containing directory to make sure it
# is flushed to disk.
dst_f.flush()
os.fdatasync(dst_f)
# Fsync the containing directory to make sure all attachments are flushed
# to disk.
dirfd = os.open(tmp_dir, os.O_DIRECTORY)
os.fsync(dirfd)
os.close(dirfd)
return True
except Exception:
logger.exception('Exception encountered when copying attachments')
return False
def MoveAndWrite(config_dct, events):
"""Moves the atts, serializes the events and writes them to the data_path."""
logger = logging.getLogger(config_dct['logger_name'])
metadata_dct = RestoreMetadata(config_dct)
cur_seq = metadata_dct['last_seq'] + 1
cur_pos = metadata_dct['end_pos'] - metadata_dct['start_pos']
# Truncate the size of the file in case of a previously unfinished
# transaction.
with open(config_dct['data_path'], 'a') as f:
f.truncate(cur_pos)
with open(config_dct['data_path'], 'a') as f:
# On some machines, the file handle offset isn't set to EOF until
# a write occurs. Thus we must manually seek to the end to ensure
# that f.tell() will return useful results.
f.seek(0, 2) # 2 means use EOF as the reference point.
assert f.tell() == cur_pos
for event in events:
for att_id, att_path in event.attachments.items():
target_name = '%s_%s' % (cur_seq, att_id)
target_path = os.path.join(config_dct['attachments_dir'], target_name)
event.attachments[att_id] = target_name
logger.debug('Relocating attachment %s: %s --> %s',
att_id, att_path, target_path)
# Note: This could potentially overwrite an existing file that got
# written just before Instalog process stopped unexpectedly.
os.rename(att_path, target_path)
logger.debug('Writing event with cur_seq=%d, cur_pos=%d',
cur_seq, cur_pos)
output = FormatRecord(cur_seq, event.Serialize())
# Store the version for SaveMetadata to use.
if cur_pos == 0:
metadata_dct['version'] = GetChecksum(output)
f.write(output)
cur_seq += 1
cur_pos += len(output)
if config_dct['args'].enable_fsync:
# Fsync the file and the containing directory to make sure it
# is flushed to disk.
f.flush()
os.fdatasync(f)
dirfd = os.open(os.path.dirname(config_dct['data_path']),
os.O_DIRECTORY)
os.fsync(dirfd)
os.close(dirfd)
metadata_dct['last_seq'] = cur_seq - 1
metadata_dct['end_pos'] = metadata_dct['start_pos'] + cur_pos
SaveMetadata(config_dct, metadata_dct)
def SaveMetadata(config_dct, metadata_dct, old_metadata_dct=None):
"""Writes metadata of main database to disk."""
if not metadata_dct['version']:
raise SimpleFileException('No `version` available for SaveMetadata')
data = {metadata_dct['version']: metadata_dct}
if old_metadata_dct and old_metadata_dct['version']:
if metadata_dct['version'] == old_metadata_dct['version']:
raise SimpleFileException(
'Same `version` from new metadata and old metadata')
data[old_metadata_dct['version']] = old_metadata_dct
with file_utils.AtomicWrite(config_dct['metadata_path'], fsync=True) as f:
json.dump(data, f)
def RestoreMetadata(config_dct):
"""Restores version from the main data file on disk.
If the metadata file does not exist, will silently return.
"""
logger = logging.getLogger(config_dct['logger_name'])
metadata_dct = {'first_seq': 1, 'last_seq': 0,
'start_pos': 0, 'end_pos': 0,
'version': '00000000'}
data = TryLoadJSON(config_dct['metadata_path'], logger.name)
if data is not None:
try:
with open(config_dct['data_path'], 'r') as f:
metadata_dct['version'] = GetChecksum(f.readline())
except Exception:
logger.error('Data file unexpectedly missing; resetting metadata')
return metadata_dct
if metadata_dct['version'] not in data:
logger.error('Could not find metadata version %s (available: %s); '
'recovering metadata from data file',
metadata_dct['version'], ', '.join(data.keys()))
RecoverMetadata(config_dct, metadata_dct)
return metadata_dct
if len(data) > 1:
logger.info('Metadata contains multiple versions %s; choosing %s',
', '.join(data.keys()), metadata_dct['version'])
metadata_dct.update(data[metadata_dct['version']])
if (metadata_dct['end_pos'] >
metadata_dct['start_pos'] + os.path.getsize(config_dct['data_path'])):
logger.error('end_pos in restored metadata is larger than start_pos + '
'data file; recovering metadata from data file')
RecoverMetadata(config_dct, metadata_dct)
else:
if os.path.isfile(config_dct['data_path']):
logger.error('Could not find metadata file, but we have data file; '
'recovering metadata from data file')
RecoverMetadata(config_dct, metadata_dct)
else:
logger.info('Creating metadata file and data file')
SaveMetadata(config_dct, metadata_dct)
file_utils.TouchFile(config_dct['data_path'])
return metadata_dct
def RecoverMetadata(config_dct, metadata_dct):
"""Recovers metadata from the main data file on disk.
Uses the first valid record for first_seq and start_pos, and the last
valid record for last_seq and end_pos.
"""
logger = logging.getLogger(config_dct['logger_name'])
first_record = True
cur_pos = 0
with open(config_dct['data_path'], 'r') as f:
for line in f:
seq, _unused_record = ParseRecord(line, config_dct['logger_name'])
if first_record and seq:
metadata_dct['first_seq'] = seq
metadata_dct['start_pos'] = cur_pos
first_record = False
cur_pos += len(line)
if seq:
metadata_dct['last_seq'] = seq
metadata_dct['end_pos'] = cur_pos
logger.info('Finished recovering metadata; sequence range found: %d to %d',
metadata_dct['first_seq'], metadata_dct['last_seq'])
SaveMetadata(config_dct, metadata_dct)
def TruncateAttachments(config_dct, metadata_dct):
"""Deletes attachments of events no longer stored within data.json."""
logger = logging.getLogger(config_dct['logger_name'])
for fname in os.listdir(config_dct['attachments_dir']):
fpath = os.path.join(config_dct['attachments_dir'], fname)
if not os.path.isfile(fpath):
continue
seq, unused_underscore, unused_att_id = fname.partition('_')
if not seq.isdigit():
continue
if int(seq) < metadata_dct['first_seq']:
logger.debug('Truncating attachment (<seq=%d): %s',
metadata_dct['first_seq'], fname)
os.unlink(fpath)
def Truncate(config_dct, min_seq, min_pos):
"""Truncates the main data file to only contain unprocessed records.
See file-level docstring for more information about versions.
"""
logger = logging.getLogger(config_dct['logger_name'])
metadata_dct = RestoreMetadata(config_dct)
# Does the buffer already have data in it?
if not metadata_dct['version']:
return
if metadata_dct['first_seq'] == min_seq:
logger.info('No need to truncate')
return
try:
logger.debug('Will truncate up until seq=%d, pos=%d', min_seq, min_pos)
# Prepare the old vs. new metadata to write to disk.
old_metadata_dct = copy.deepcopy(metadata_dct)
metadata_dct['first_seq'] = min_seq
metadata_dct['start_pos'] = min_pos
with file_utils.AtomicWrite(config_dct['data_path'], fsync=True) as new_f:
# AtomicWrite opens a file handle to a temporary file right next to
# the real file (data_path), so we can open a "read" handle on data_path
# without affecting AtomicWrite's handle. Only when AtomicWrite's context
# block ends will the temporary be moved to replace data_path.
with open(config_dct['data_path'], 'r') as old_f:
old_f.seek(min_pos - old_metadata_dct['start_pos'])
# Deal with the first line separately to get the new version.
first_line = old_f.readline()
metadata_dct['version'] = GetChecksum(first_line)
new_f.write(first_line)
shutil.copyfileobj(old_f, new_f)
# Before performing the "replace" step of write-replace (when
# the file_utils.AtomicWrite context ends), save metadata to disk in
# case of disk failure.
SaveMetadata(config_dct, metadata_dct, old_metadata_dct)
# After we use AtomicWrite, we can remove old metadata.
SaveMetadata(config_dct, metadata_dct)
except Exception:
logger.exception('Exception occurred during Truncate operation')
raise
class Consumer(log_utils.LoggerMixin, plugin_base.BufferEventStream):
"""Represents a Consumer and its BufferEventStream.
Since SimpleFile has only a single database file, there can only ever be one
functioning BufferEventStream at any given time. So we bundle the Consumer
and its BufferEventStream into one object. When CreateStream is called, a
lock is acquired and the Consumer object is return. The lock must first be
acquired before any of Next, Commit, or Abort can be used.
"""
def CreateStream(self):
"""Creates a BufferEventStream object to be used by Instalog core.
Since this class doubles as BufferEventStream, we mark that the
BufferEventStream is "unexpired" by setting self._stream_lock,
and return self.
Returns:
`self` if BufferEventStream not already in use, None if busy.
"""
return self if self._stream_lock.acquire(False) else None
def _SaveMetadata(self):
"""Saves metadata for this Consumer to disk (seq and pos)."""
data = {'cur_seq': self.cur_seq,
'cur_pos': self.cur_pos}
with file_utils.AtomicWrite(self.metadata_path, fsync=True) as f:
json.dump(data, f)
def RestoreConsumerMetadata(self):
"""Restores metadata for this Consumer from disk (seq and pos).
On each restore, ensure that the available window of records on disk has
not surpassed our own current record. How would this happen? If the
Consumer is removed, records it still hasn't read are truncated from the
main database, and the Consumer is re-added under the same name.
If the metadata file does not exist, will silently return.
"""
data = TryLoadJSON(self.metadata_path, self.logger.name)
if data is not None:
if 'cur_seq' not in data or 'cur_pos' not in data:
self.error('Consumer %s metadata file invalid; resetting', self.name)
return
# Make sure we are still ahead of simple_file.
with self.read_lock:
metadata_dct = RestoreMetadata(self.simple_file.ConfigToDict())
self.cur_seq = min(max(metadata_dct['first_seq'], data['cur_seq']),
metadata_dct['last_seq'] + 1)
self.cur_pos = min(max(metadata_dct['start_pos'], data['cur_pos']),
metadata_dct['end_pos'])
if (data['cur_seq'] < metadata_dct['first_seq'] or
data['cur_seq'] > (metadata_dct['last_seq'] + 1)):
self.error('Consumer %s cur_seq=%d is out of buffer range %d to %d, '
'correcting to %d', self.name, data['cur_seq'],
metadata_dct['first_seq'], metadata_dct['last_seq'] + 1,
self.cur_seq)
self.new_seq = self.cur_seq
self.new_pos = self.cur_pos
def _Buffer(self):
"""Returns a list of pending records.
Stores the current buffer internally at self.read_buf. If it already has
data in it, self.read_buf will be returned as-is. It will be "refilled"
when it is empty.
Reads up to _BUFFER_SIZE_BYTES from the file on each "refill".
Returns:
A list of records, where each is a three-element tuple:
(record_seq, record_data, line_bytes).
"""
if self.read_buf:
return self.read_buf
# Does the buffer already have data in it?
if not os.path.exists(self.simple_file.data_path):
return self.read_buf
self.debug('_Buffer: waiting for read_lock')
try:
# When the buffer is truncating, we can't get the read_lock.
if not self.read_lock.acquire(timeout=0.5):
return []
metadata_dct = RestoreMetadata(self.simple_file.ConfigToDict())
with open(self.simple_file.data_path, 'r') as f:
cur = self.new_pos - metadata_dct['start_pos']
f.seek(cur)
total_bytes = 0
skipped_bytes = 0
for line in f:
if total_bytes > _BUFFER_SIZE_BYTES:
break
size = len(line)
cur += size
if cur > (metadata_dct['end_pos'] - metadata_dct['start_pos']):
break
seq, record = ParseRecord(line, self.logger.name)
if seq is None:
# Parsing of this line failed for some reason.
skipped_bytes += size
continue
# Only add to total_bytes for a valid line.
total_bytes += size
# Include any skipped bytes from previously skipped records in the
# "size" of this record, in order to allow the consumer to skip to the
# proper offset.
self.read_buf.append((seq, record, size + skipped_bytes))
skipped_bytes = 0
finally:
self.read_lock.CheckAndRelease()
return self.read_buf
def _Next(self):
"""Helper for Next, also used for testing purposes.
Returns:
A tuple of (seq, record), or (None, None) if no records available.
"""
if not self._stream_lock.IsHolder():
raise plugin_base.EventStreamExpired
buf = self._Buffer()
if not buf:
return None, None
seq, record, size = buf.pop(0)
self.new_seq = seq + 1
self.new_pos += size
return seq, record
def Next(self):
"""See BufferEventStream.Next."""
seq, record = self._Next()
if not seq:
return None
event = datatypes.Event.Deserialize(record)
return self.simple_file.ExternalizeEvent(event)
def Commit(self):
"""See BufferEventStream.Commit."""
if not self._stream_lock.IsHolder():
raise plugin_base.EventStreamExpired
self.cur_seq = self.new_seq
self.cur_pos = self.new_pos
# Ensure that regardless of any errors, locks are released.
try:
self._SaveMetadata()
except Exception:
# TODO(kitching): Instalog core or PluginSandbox should catch this
# exception and attempt to safely shut down.
self.exception('Commit: Write exception occurred, Events may be '
'processed by output plugin multiple times')
finally:
try:
self._stream_lock.release()
except Exception:
# TODO(kitching): Instalog core or PluginSandbox should catch this
# exception and attempt to safely shut down.
self.exception('Commit: Internal error occurred')
def Abort(self):
"""See BufferEventStream.Abort."""
if not self._stream_lock.IsHolder():
raise plugin_base.EventStreamExpired
self.new_seq = self.cur_seq
self.new_pos = self.cur_pos
self.read_buf = []
try:
self._stream_lock.release()
except Exception:
# TODO(kitching): Instalog core or PluginSandbox should catch this
# exception and attempt to safely shut down.
self.exception('Abort: Internal error occurred')
| [
2,
15069,
2177,
383,
18255,
1505,
7294,
46665,
13,
1439,
2489,
10395,
13,
198,
2,
5765,
286,
428,
2723,
2438,
318,
21825,
416,
257,
347,
10305,
12,
7635,
5964,
326,
460,
307,
198,
2,
1043,
287,
262,
38559,
24290,
2393,
13,
198,
198,
37811,
8979,
12,
3106,
11876,
2219,
13,
198,
198,
32,
2393,
12,
3106,
11876,
543,
6797,
663,
2995,
284,
257,
2060,
2393,
319,
11898,
11,
290,
198,
25512,
1286,
16047,
20150,
13,
198,
198,
1858,
389,
1115,
3696,
9456,
11,
5556,
530,
329,
1123,
7172,
2727,
25,
628,
220,
1366,
13,
17752,
25,
628,
220,
220,
220,
41835,
4036,
1366,
13,
220,
5501,
1627,
24866,
284,
530,
1785,
13,
220,
1081,
2995,
389,
198,
220,
220,
220,
3194,
284,
11898,
11,
1123,
530,
318,
1813,
257,
8379,
1271,
13,
220,
18980,
286,
1123,
1627,
25,
628,
220,
220,
220,
220,
220,
220,
220,
685,
5188,
48,
62,
41359,
11,
1391,
20114,
3525,
62,
26947,
5512,
45623,
62,
50,
5883,
60,
628,
220,
220,
220,
22183,
7946,
48,
62,
41359,
284,
1366,
13,
17752,
318,
407,
14084,
3306,
1201,
356,
1394,
2610,
198,
220,
220,
220,
286,
8379,
3146,
287,
20150,
11,
475,
340,
318,
4465,
329,
28769,
11,
290,
714,
198,
220,
220,
220,
635,
1037,
618,
25646,
257,
10622,
6831,
13,
628,
220,
20150,
13,
17752,
25,
628,
220,
220,
220,
41835,
1459,
8379,
3146,
290,
23493,
6116,
13,
220,
383,
366,
11085,
33756,
1,
290,
198,
220,
220,
220,
366,
9688,
1426,
1,
389,
2077,
284,
307,
4112,
284,
262,
2656,
1418,
5143,
66,
515,
1366,
2393,
11,
198,
220,
220,
220,
290,
3522,
284,
262,
3726,
286,
1366,
3058,
8574,
319,
11898,
13,
628,
220,
220,
220,
1406,
611,
33756,
28,
16,
373,
13529,
416,
477,
45103,
11,
290,
833,
19524,
378,
4615,
340,
422,
198,
220,
220,
220,
11898,
11,
717,
62,
41068,
561,
307,
900,
284,
362,
13,
628,
220,
220,
220,
5740,
326,
1201,
262,
23493,
6116,
389,
4112,
11,
923,
62,
1930,
1276,
307,
198,
220,
220,
220,
13284,
20216,
284,
651,
262,
4036,
2292,
287,
262,
2393,
319,
11898,
11,
304,
13,
70,
11207,
628,
220,
220,
220,
220,
220,
220,
220,
277,
13,
36163,
7,
14421,
62,
1930,
532,
923,
62,
1930,
8,
628,
220,
7008,
13,
17752,
25,
628,
220,
220,
220,
41835,
257,
1351,
286,
477,
4075,
45103,
13,
220,
1002,
257,
18110,
318,
4615,
11,
340,
481,
307,
198,
220,
220,
220,
4615,
422,
428,
1351,
11,
475,
663,
20150,
2393,
481,
2555,
284,
2152,
13,
220,
1002,
340,
198,
220,
220,
220,
318,
1683,
302,
12,
25598,
11,
262,
4683,
20150,
481,
307,
973,
13,
220,
1002,
428,
318,
198,
220,
220,
220,
27858,
1202,
9172,
11,
262,
20150,
2393,
329,
326,
18110,
815,
307,
14500,
198,
220,
220,
220,
13140,
13,
628,
220,
7172,
62,
55,
13,
17752,
25,
628,
220,
220,
220,
41835,
262,
8379,
1271,
290,
23493,
2292,
286,
257,
1948,
18110,
13,
628,
198,
14815,
278,
25,
628,
220,
6023,
3721,
326,
318,
2861,
11170,
13869,
318,
366,
9641,
278,
1911,
220,
775,
765,
198,
220,
284,
1104,
40122,
803,
11,
326,
318,
11,
618,
674,
2393,
4909,
399,
4406,
543,
423,
198,
220,
1541,
587,
13529,
416,
477,
45103,
11,
290,
337,
5637,
4406,
11,
4781,
262,
198,
220,
717,
399,
4406,
422,
262,
1388,
1366,
2393,
287,
1502,
284,
3613,
11898,
2272,
13,
220,
2293,
198,
220,
49614,
262,
1366,
2393,
11,
4296,
20150,
16062,
13,
628,
220,
887,
644,
4325,
611,
257,
5287,
8833,
287,
1022,
777,
734,
4831,
30,
220,
3954,
366,
727,
1,
198,
220,
20150,
783,
318,
783,
20312,
351,
257,
366,
3605,
1,
1366,
2393,
11,
543,
1724,
356,
481,
1884,
198,
220,
307,
5906,
284,
1100,
1997,
6105,
13,
628,
220,
1675,
8494,
428,
1917,
11,
878,
302,
12,
16502,
262,
1388,
1366,
2393,
11,
356,
3613,
257,
198,
220,
20150,
2393,
284,
11898,
351,
1111,
366,
727,
1,
290,
366,
3605,
1,
20150,
6300,
1635,
19052,
9,
198,
220,
9489,
257,
40122,
378,
319,
262,
1388,
1366,
2393,
13,
220,
383,
1994,
318,
257,
45623,
12234,
286,
262,
198,
220,
717,
1627,
286,
262,
1388,
1366,
2393,
13,
220,
1649,
262,
11876,
717,
4940,
11,
340,
481,
2198,
198,
220,
284,
766,
543,
1994,
7466,
262,
717,
1627,
11,
290,
340,
481,
779,
428,
20150,
198,
220,
2196,
13,
628,
220,
6660,
11,
611,
257,
5287,
8833,
1635,
19052,
9,
3597,
262,
1388,
1366,
2393,
11,
262,
366,
727,
1,
198,
220,
20150,
460,
307,
973,
13,
220,
1002,
257,
5287,
8833,
1635,
8499,
9,
3597,
262,
1388,
1366,
2393,
11,
198,
220,
262,
366,
3605,
1,
20150,
460,
307,
973,
13,
198,
37811,
198,
198,
11748,
4866,
198,
11748,
33918,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
4423,
346,
198,
11748,
1976,
8019,
198,
198,
6738,
269,
4951,
13,
69,
9548,
13,
259,
7757,
519,
1330,
4818,
265,
9497,
198,
6738,
269,
4951,
13,
69,
9548,
13,
259,
7757,
519,
1330,
5793,
62,
26791,
198,
6738,
269,
4951,
13,
69,
9548,
13,
259,
7757,
519,
1330,
2604,
62,
26791,
198,
6738,
269,
4951,
13,
69,
9548,
13,
259,
7757,
519,
1330,
13877,
62,
8692,
198,
6738,
269,
4951,
13,
69,
9548,
13,
259,
7757,
519,
13,
26791,
1330,
2393,
62,
26791,
628,
198,
2,
383,
1271,
286,
9881,
284,
11876,
618,
50122,
2995,
422,
257,
2393,
13,
198,
62,
19499,
45746,
62,
33489,
62,
17513,
51,
1546,
796,
604,
1635,
28119,
220,
1303,
604,
32812,
628,
198,
4871,
17427,
8979,
16922,
7,
16922,
2599,
198,
220,
37227,
12218,
6631,
2099,
329,
428,
13877,
526,
15931,
628,
198,
4299,
3497,
7376,
4657,
388,
11484,
1590,
7,
7890,
2599,
198,
220,
37227,
8645,
689,
281,
807,
12,
22769,
45623,
2624,
8794,
388,
286,
1813,
4731,
526,
15931,
198,
220,
1303,
16926,
46,
7,
354,
34115,
268,
2599,
17220,
428,
10655,
2163,
13,
198,
220,
1303,
383,
2163,
1067,
66,
2624,
3419,
5860,
257,
4488,
3933,
12,
2545,
18253,
287,
11361,
17,
11,
475,
340,
198,
220,
1303,
5860,
281,
22165,
3933,
12,
2545,
18253,
287,
11361,
18,
13,
1675,
7716,
262,
976,
1988,
198,
220,
1303,
1973,
477,
11361,
6300,
11,
356,
10385,
22165,
18253,
284,
4488,
18253,
13,
198,
220,
8794,
388,
796,
1976,
8019,
13,
66,
6015,
2624,
7,
7890,
13,
268,
8189,
10786,
40477,
12,
23,
6,
4008,
198,
220,
611,
8794,
388,
18189,
362,
1174,
3132,
25,
198,
220,
220,
220,
8794,
388,
48185,
362,
1174,
2624,
198,
220,
1441,
705,
90,
25,
2919,
87,
92,
4458,
18982,
7,
8937,
7,
42116,
388,
4008,
628,
198,
4299,
3497,
7376,
4657,
388,
7,
7890,
2599,
198,
220,
37227,
8645,
689,
281,
807,
12,
22769,
45623,
2624,
8794,
388,
286,
1813,
4731,
526,
15931,
198,
220,
1303,
383,
2163,
1067,
66,
2624,
3419,
5860,
257,
4488,
3933,
12,
2545,
18253,
287,
11361,
17,
11,
475,
340,
198,
220,
1303,
5860,
281,
22165,
3933,
12,
2545,
18253,
287,
11361,
18,
13,
1675,
7716,
262,
976,
1988,
198,
220,
1303,
1973,
477,
11361,
6300,
11,
356,
779,
366,
66,
6015,
2624,
3419,
1222,
657,
87,
12927,
12927,
1911,
198,
220,
1441,
705,
90,
25,
2919,
87,
92,
4458,
18982,
7,
89,
8019,
13,
66,
6015,
2624,
7,
7890,
13,
268,
8189,
10786,
40477,
12,
23,
6,
4008,
1222,
657,
87,
12927,
12927,
8,
628,
198,
4299,
18980,
23739,
7,
41068,
11,
1700,
2599,
198,
220,
37227,
35561,
257,
1700,
39559,
355,
257,
1627,
284,
307,
3194,
284,
11898,
526,
15931,
198,
220,
1366,
796,
705,
4,
67,
11,
4064,
82,
6,
4064,
357,
41068,
11,
1700,
8,
198,
220,
8794,
388,
796,
3497,
7376,
4657,
388,
7,
7890,
8,
198,
220,
1441,
44438,
4,
82,
11,
36521,
82,
8973,
59,
77,
6,
4064,
357,
7890,
11,
8794,
388,
8,
628,
198,
4299,
2547,
325,
23739,
7,
1370,
11,
49706,
62,
3672,
28,
14202,
2599,
198,
220,
37227,
47,
945,
274,
290,
5860,
257,
1627,
422,
11898,
355,
257,
1700,
13,
628,
220,
16409,
25,
198,
220,
220,
220,
317,
46545,
286,
357,
41068,
62,
17618,
11,
1700,
828,
393,
6045,
319,
5287,
13,
198,
220,
37227,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
6404,
1362,
62,
3672,
8,
198,
220,
1627,
62,
5083,
796,
1627,
13,
81,
36311,
3419,
58,
16,
21912,
16,
60,
220,
1303,
18508,
17635,
290,
649,
1370,
198,
220,
1366,
11,
4808,
11,
8794,
388,
796,
1627,
62,
5083,
13,
81,
3911,
653,
7,
3256,
705,
8,
198,
220,
1303,
16926,
46,
7,
354,
34115,
268,
2599,
9794,
428,
2446,
706,
257,
890,
640,
13,
198,
220,
8794,
388,
796,
8794,
388,
13,
36311,
10786,
1,
11537,
198,
220,
33756,
11,
4808,
11,
1700,
796,
1366,
13,
3911,
653,
7,
3256,
705,
8,
198,
220,
611,
407,
33756,
393,
407,
1700,
25,
198,
220,
220,
220,
49706,
13,
43917,
10786,
47,
945,
278,
4049,
329,
1700,
4064,
82,
3256,
1627,
13,
81,
36311,
28955,
198,
220,
220,
220,
1441,
6045,
11,
6045,
198,
220,
611,
8794,
388,
14512,
3497,
7376,
4657,
388,
7,
7890,
8,
290,
8794,
388,
14512,
3497,
7376,
4657,
388,
11484,
1590,
7,
7890,
2599,
198,
220,
220,
220,
49706,
13,
43917,
10786,
7376,
4657,
388,
4049,
329,
1700,
4064,
82,
3256,
1627,
13,
81,
36311,
28955,
198,
220,
220,
220,
1441,
6045,
11,
6045,
198,
220,
1441,
493,
7,
41068,
828,
1700,
628,
198,
4299,
9993,
8912,
40386,
7,
6978,
11,
49706,
62,
3672,
28,
14202,
2599,
198,
220,
37227,
48452,
284,
3440,
19449,
422,
262,
1813,
2393,
13,
628,
220,
16409,
25,
198,
220,
220,
220,
23042,
276,
1366,
422,
262,
2393,
13,
220,
6045,
611,
262,
2393,
857,
407,
2152,
13,
628,
220,
7567,
2696,
25,
198,
220,
220,
220,
35528,
611,
612,
373,
617,
584,
1917,
3555,
262,
2393,
11,
393,
611,
1223,
198,
220,
220,
220,
1816,
2642,
32096,
262,
1366,
13,
198,
220,
37227,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
6404,
1362,
62,
3672,
8,
198,
220,
611,
407,
28686,
13,
6978,
13,
4468,
576,
7,
6978,
2599,
198,
220,
220,
220,
49706,
13,
24442,
10786,
4,
82,
25,
857,
407,
2152,
3256,
3108,
8,
198,
220,
220,
220,
1441,
6045,
198,
220,
1949,
25,
198,
220,
220,
220,
351,
1280,
7,
6978,
11,
705,
81,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
1441,
33918,
13,
2220,
7,
69,
8,
198,
220,
2845,
35528,
25,
198,
220,
220,
220,
49706,
13,
1069,
4516,
10786,
4,
82,
25,
13047,
3555,
11898,
393,
11046,
19449,
3256,
3108,
8,
198,
220,
220,
220,
5298,
628,
198,
4299,
17393,
33296,
902,
2514,
30782,
35277,
7,
1078,
62,
6978,
82,
11,
45218,
62,
15908,
11,
49706,
62,
3672,
28,
14202,
2599,
198,
220,
37227,
13379,
893,
32161,
284,
262,
8584,
8619,
526,
15931,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
6404,
1362,
62,
3672,
8,
198,
220,
1949,
25,
198,
220,
220,
220,
329,
708,
62,
6978,
287,
708,
62,
6978,
82,
25,
198,
220,
220,
220,
220,
220,
1303,
6822,
326,
262,
2723,
2393,
7160,
13,
198,
220,
220,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
4468,
576,
7,
1078,
62,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
8086,
15520,
3108,
4600,
4,
82,
63,
7368,
287,
1785,
857,
407,
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,
705,
38476,
6,
4064,
708,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
2496,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
22065,
62,
15908,
11,
708,
62,
6978,
13,
33491,
10786,
14,
3256,
705,
62,
6,
4008,
198,
220,
220,
220,
220,
220,
49706,
13,
24442,
10786,
13379,
1112,
18231,
25,
4064,
82,
14610,
4064,
82,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
708,
62,
6978,
11,
2496,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
351,
1280,
7,
16793,
62,
6978,
11,
705,
86,
11537,
355,
29636,
62,
69,
25,
198,
220,
220,
220,
220,
220,
220,
220,
351,
1280,
7,
1078,
62,
6978,
11,
705,
81,
11537,
355,
12351,
62,
69,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4423,
346,
13,
30073,
7753,
26801,
7,
10677,
62,
69,
11,
29636,
62,
69,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
376,
27261,
262,
2393,
290,
262,
7268,
8619,
284,
787,
1654,
340,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
318,
44869,
284,
11898,
13,
198,
220,
220,
220,
220,
220,
220,
220,
29636,
62,
69,
13,
25925,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
16344,
265,
292,
13361,
7,
67,
301,
62,
69,
8,
198,
220,
220,
220,
1303,
376,
27261,
262,
7268,
8619,
284,
787,
1654,
477,
32161,
389,
44869,
198,
220,
220,
220,
1303,
284,
11898,
13,
198,
220,
220,
220,
26672,
16344,
796,
28686,
13,
9654,
7,
22065,
62,
15908,
11,
28686,
13,
46,
62,
17931,
23988,
15513,
8,
198,
220,
220,
220,
28686,
13,
69,
27261,
7,
15908,
16344,
8,
198,
220,
220,
220,
28686,
13,
19836,
7,
15908,
16344,
8,
198,
220,
220,
220,
1441,
6407,
198,
220,
2845,
35528,
25,
198,
220,
220,
220,
49706,
13,
1069,
4516,
10786,
16922,
12956,
618,
23345,
32161,
11537,
198,
220,
220,
220,
1441,
10352,
628,
198,
4299,
10028,
1870,
16594,
7,
11250,
62,
67,
310,
11,
2995,
2599,
198,
220,
37227,
44,
5241,
262,
708,
82,
11,
11389,
4340,
262,
2995,
290,
6797,
606,
284,
262,
1366,
62,
6978,
526,
15931,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
11250,
62,
67,
310,
17816,
6404,
1362,
62,
3672,
6,
12962,
198,
220,
20150,
62,
67,
310,
796,
42019,
9171,
14706,
7,
11250,
62,
67,
310,
8,
198,
220,
1090,
62,
41068,
796,
20150,
62,
67,
310,
17816,
12957,
62,
41068,
20520,
1343,
352,
198,
220,
1090,
62,
1930,
796,
20150,
62,
67,
310,
17816,
437,
62,
1930,
20520,
532,
20150,
62,
67,
310,
17816,
9688,
62,
1930,
20520,
198,
220,
1303,
833,
19524,
378,
262,
2546,
286,
262,
2393,
287,
1339,
286,
257,
4271,
34419,
198,
220,
1303,
8611,
13,
198,
220,
351,
1280,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
4357,
705,
64,
11537,
355,
277,
25,
198,
220,
220,
220,
277,
13,
2213,
19524,
378,
7,
22019,
62,
1930,
8,
628,
220,
351,
1280,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
4357,
705,
64,
11537,
355,
277,
25,
198,
220,
220,
220,
1303,
1550,
617,
8217,
11,
262,
2393,
5412,
11677,
2125,
470,
900,
284,
412,
19238,
1566,
198,
220,
220,
220,
1303,
257,
3551,
8833,
13,
220,
6660,
356,
1276,
14500,
5380,
284,
262,
886,
284,
4155,
198,
220,
220,
220,
1303,
326,
277,
13,
33331,
3419,
481,
1441,
4465,
2482,
13,
198,
220,
220,
220,
277,
13,
36163,
7,
15,
11,
362,
8,
220,
1303,
362,
1724,
779,
412,
19238,
355,
262,
4941,
966,
13,
198,
220,
220,
220,
6818,
277,
13,
33331,
3419,
6624,
1090,
62,
1930,
198,
220,
220,
220,
329,
1785,
287,
2995,
25,
198,
220,
220,
220,
220,
220,
329,
708,
62,
312,
11,
708,
62,
6978,
287,
1785,
13,
47348,
902,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
3672,
796,
705,
4,
82,
62,
4,
82,
6,
4064,
357,
22019,
62,
41068,
11,
708,
62,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
11250,
62,
67,
310,
17816,
47348,
902,
62,
15908,
6,
4357,
2496,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1785,
13,
47348,
902,
58,
1078,
62,
312,
60,
796,
2496,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
10786,
6892,
27123,
18231,
4064,
82,
25,
4064,
82,
14610,
4064,
82,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
708,
62,
312,
11,
708,
62,
6978,
11,
2496,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5740,
25,
770,
714,
6196,
49312,
281,
4683,
2393,
326,
1392,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
3194,
655,
878,
2262,
11794,
1429,
5025,
25884,
13,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
918,
480,
7,
1078,
62,
6978,
11,
2496,
62,
6978,
8,
628,
220,
220,
220,
220,
220,
49706,
13,
24442,
10786,
33874,
1785,
351,
1090,
62,
41068,
28,
4,
67,
11,
1090,
62,
1930,
28,
4,
67,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1090,
62,
41068,
11,
1090,
62,
1930,
8,
198,
220,
220,
220,
220,
220,
5072,
796,
18980,
23739,
7,
22019,
62,
41068,
11,
1785,
13,
32634,
1096,
28955,
628,
220,
220,
220,
220,
220,
1303,
9363,
262,
2196,
329,
12793,
9171,
14706,
284,
779,
13,
198,
220,
220,
220,
220,
220,
611,
1090,
62,
1930,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
9641,
20520,
796,
3497,
7376,
4657,
388,
7,
22915,
8,
628,
220,
220,
220,
220,
220,
277,
13,
13564,
7,
22915,
8,
198,
220,
220,
220,
220,
220,
1090,
62,
41068,
15853,
352,
198,
220,
220,
220,
220,
220,
1090,
62,
1930,
15853,
18896,
7,
22915,
8,
628,
220,
220,
220,
611,
4566,
62,
67,
310,
17816,
22046,
6,
4083,
21633,
62,
69,
27261,
25,
198,
220,
220,
220,
220,
220,
1303,
376,
27261,
262,
2393,
290,
262,
7268,
8619,
284,
787,
1654,
340,
198,
220,
220,
220,
220,
220,
1303,
318,
44869,
284,
11898,
13,
198,
220,
220,
220,
220,
220,
277,
13,
25925,
3419,
198,
220,
220,
220,
220,
220,
28686,
13,
16344,
265,
292,
13361,
7,
69,
8,
198,
220,
220,
220,
220,
220,
26672,
16344,
796,
28686,
13,
9654,
7,
418,
13,
6978,
13,
15908,
3672,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
20520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
46,
62,
17931,
23988,
15513,
8,
198,
220,
220,
220,
220,
220,
28686,
13,
69,
27261,
7,
15908,
16344,
8,
198,
220,
220,
220,
220,
220,
28686,
13,
19836,
7,
15908,
16344,
8,
198,
220,
20150,
62,
67,
310,
17816,
12957,
62,
41068,
20520,
796,
1090,
62,
41068,
532,
352,
198,
220,
20150,
62,
67,
310,
17816,
437,
62,
1930,
20520,
796,
20150,
62,
67,
310,
17816,
9688,
62,
1930,
20520,
1343,
1090,
62,
1930,
198,
220,
12793,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
8,
628,
198,
4299,
12793,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
11,
1468,
62,
38993,
62,
67,
310,
28,
14202,
2599,
198,
220,
37227,
20257,
274,
20150,
286,
1388,
6831,
284,
11898,
526,
15931,
198,
220,
611,
407,
20150,
62,
67,
310,
17816,
9641,
6,
5974,
198,
220,
220,
220,
5298,
17427,
8979,
16922,
10786,
2949,
4600,
9641,
63,
1695,
329,
12793,
9171,
14706,
11537,
198,
220,
1366,
796,
1391,
38993,
62,
67,
310,
17816,
9641,
6,
5974,
20150,
62,
67,
310,
92,
198,
220,
611,
1468,
62,
38993,
62,
67,
310,
290,
1468,
62,
38993,
62,
67,
310,
17816,
9641,
6,
5974,
198,
220,
220,
220,
611,
20150,
62,
67,
310,
17816,
9641,
20520,
6624,
1468,
62,
38993,
62,
67,
310,
17816,
9641,
6,
5974,
198,
220,
220,
220,
220,
220,
5298,
17427,
8979,
16922,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
30556,
4600,
9641,
63,
422,
649,
20150,
290,
1468,
20150,
11537,
198,
220,
220,
220,
1366,
58,
727,
62,
38993,
62,
67,
310,
17816,
9641,
6,
11907,
796,
1468,
62,
38993,
62,
67,
310,
198,
220,
351,
2393,
62,
26791,
13,
2953,
10179,
16594,
7,
11250,
62,
67,
310,
17816,
38993,
62,
6978,
6,
4357,
277,
27261,
28,
17821,
8,
355,
277,
25,
198,
220,
220,
220,
33918,
13,
39455,
7,
7890,
11,
277,
8,
628,
198,
4299,
42019,
9171,
14706,
7,
11250,
62,
67,
310,
2599,
198,
220,
37227,
19452,
2850,
2196,
422,
262,
1388,
1366,
2393,
319,
11898,
13,
628,
220,
1002,
262,
20150,
2393,
857,
407,
2152,
11,
481,
24595,
1441,
13,
198,
220,
37227,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
11250,
62,
67,
310,
17816,
6404,
1362,
62,
3672,
6,
12962,
198,
220,
20150,
62,
67,
310,
796,
1391,
6,
11085,
62,
41068,
10354,
352,
11,
705,
12957,
62,
41068,
10354,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
9688,
62,
1930,
10354,
657,
11,
705,
437,
62,
1930,
10354,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
9641,
10354,
705,
8269,
6,
92,
198,
220,
1366,
796,
9993,
8912,
40386,
7,
11250,
62,
67,
310,
17816,
38993,
62,
6978,
6,
4357,
49706,
13,
3672,
8,
198,
220,
611,
1366,
318,
407,
6045,
25,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
4357,
705,
81,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
9641,
20520,
796,
3497,
7376,
4657,
388,
7,
69,
13,
961,
1370,
28955,
198,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
49706,
13,
18224,
10786,
6601,
2393,
25884,
4814,
26,
13259,
889,
20150,
11537,
198,
220,
220,
220,
220,
220,
1441,
20150,
62,
67,
310,
198,
220,
220,
220,
611,
20150,
62,
67,
310,
17816,
9641,
20520,
407,
287,
1366,
25,
198,
220,
220,
220,
220,
220,
49706,
13,
18224,
10786,
23722,
407,
1064,
20150,
2196,
4064,
82,
357,
15182,
25,
4064,
82,
1776,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
260,
9631,
278,
20150,
422,
1366,
2393,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
9641,
6,
4357,
46083,
45302,
22179,
7,
7890,
13,
13083,
3419,
4008,
198,
220,
220,
220,
220,
220,
49107,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
8,
198,
220,
220,
220,
220,
220,
1441,
20150,
62,
67,
310,
198,
220,
220,
220,
611,
18896,
7,
7890,
8,
1875,
352,
25,
198,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
9171,
14706,
4909,
3294,
6300,
4064,
82,
26,
11236,
4064,
82,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
46083,
45302,
22179,
7,
7890,
13,
13083,
3419,
828,
20150,
62,
67,
310,
17816,
9641,
6,
12962,
198,
220,
220,
220,
20150,
62,
67,
310,
13,
19119,
7,
7890,
58,
38993,
62,
67,
310,
17816,
9641,
6,
11907,
8,
198,
220,
220,
220,
611,
357,
38993,
62,
67,
310,
17816,
437,
62,
1930,
20520,
1875,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
9688,
62,
1930,
20520,
1343,
28686,
13,
6978,
13,
11407,
1096,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
12962,
2599,
198,
220,
220,
220,
220,
220,
49706,
13,
18224,
10786,
437,
62,
1930,
287,
15032,
20150,
318,
4025,
621,
923,
62,
1930,
1343,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
7890,
2393,
26,
20222,
20150,
422,
1366,
2393,
11537,
198,
220,
220,
220,
220,
220,
49107,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
8,
198,
220,
2073,
25,
198,
220,
220,
220,
611,
28686,
13,
6978,
13,
4468,
576,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
20520,
2599,
198,
220,
220,
220,
220,
220,
49706,
13,
18224,
10786,
23722,
407,
1064,
20150,
2393,
11,
475,
356,
423,
1366,
2393,
26,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
260,
9631,
278,
20150,
422,
1366,
2393,
11537,
198,
220,
220,
220,
220,
220,
49107,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
49706,
13,
10951,
10786,
32071,
20150,
2393,
290,
1366,
2393,
11537,
198,
220,
220,
220,
220,
220,
12793,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
8,
198,
220,
220,
220,
220,
220,
2393,
62,
26791,
13,
35211,
8979,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
12962,
198,
220,
1441,
20150,
62,
67,
310,
628,
198,
4299,
49107,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
2599,
198,
220,
37227,
6690,
13801,
20150,
422,
262,
1388,
1366,
2393,
319,
11898,
13,
628,
220,
36965,
262,
717,
4938,
1700,
329,
717,
62,
41068,
290,
923,
62,
1930,
11,
290,
262,
938,
198,
220,
4938,
1700,
329,
938,
62,
41068,
290,
886,
62,
1930,
13,
198,
220,
37227,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
11250,
62,
67,
310,
17816,
6404,
1362,
62,
3672,
6,
12962,
198,
220,
717,
62,
22105,
796,
6407,
198,
220,
1090,
62,
1930,
796,
657,
198,
220,
351,
1280,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
4357,
705,
81,
11537,
355,
277,
25,
198,
220,
220,
220,
329,
1627,
287,
277,
25,
198,
220,
220,
220,
220,
220,
33756,
11,
4808,
403,
1484,
62,
22105,
796,
2547,
325,
23739,
7,
1370,
11,
4566,
62,
67,
310,
17816,
6404,
1362,
62,
3672,
6,
12962,
198,
220,
220,
220,
220,
220,
611,
717,
62,
22105,
290,
33756,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
20520,
796,
33756,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
9688,
62,
1930,
20520,
796,
1090,
62,
1930,
198,
220,
220,
220,
220,
220,
220,
220,
717,
62,
22105,
796,
10352,
198,
220,
220,
220,
220,
220,
1090,
62,
1930,
15853,
18896,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
611,
33756,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
12957,
62,
41068,
20520,
796,
33756,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
437,
62,
1930,
20520,
796,
1090,
62,
1930,
198,
220,
49706,
13,
10951,
10786,
18467,
1348,
20222,
20150,
26,
8379,
2837,
1043,
25,
4064,
67,
284,
4064,
67,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
6,
4357,
20150,
62,
67,
310,
17816,
12957,
62,
41068,
6,
12962,
198,
220,
12793,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
8,
628,
198,
4299,
833,
19524,
378,
33296,
902,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
2599,
198,
220,
37227,
5005,
40676,
32161,
286,
2995,
645,
2392,
8574,
1626,
1366,
13,
17752,
526,
15931,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
11250,
62,
67,
310,
17816,
6404,
1362,
62,
3672,
6,
12962,
198,
220,
329,
277,
3672,
287,
28686,
13,
4868,
15908,
7,
11250,
62,
67,
310,
17816,
47348,
902,
62,
15908,
20520,
2599,
198,
220,
220,
220,
277,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
11250,
62,
67,
310,
17816,
47348,
902,
62,
15908,
6,
4357,
277,
3672,
8,
198,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
4468,
576,
7,
69,
6978,
2599,
198,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
33756,
11,
21958,
62,
41116,
7295,
11,
21958,
62,
1078,
62,
312,
796,
277,
3672,
13,
3911,
653,
10786,
62,
11537,
198,
220,
220,
220,
611,
407,
33756,
13,
9409,
328,
270,
33529,
198,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
611,
493,
7,
41068,
8,
1279,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
6,
5974,
198,
220,
220,
220,
220,
220,
49706,
13,
24442,
10786,
2898,
19524,
803,
18231,
38155,
41068,
28,
4,
67,
2599,
4064,
82,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
6,
4357,
277,
3672,
8,
198,
220,
220,
220,
220,
220,
28686,
13,
403,
8726,
7,
69,
6978,
8,
628,
198,
4299,
833,
19524,
378,
7,
11250,
62,
67,
310,
11,
949,
62,
41068,
11,
949,
62,
1930,
2599,
198,
220,
37227,
2898,
19524,
689,
262,
1388,
1366,
2393,
284,
691,
3994,
555,
14681,
276,
4406,
13,
628,
220,
4091,
2393,
12,
5715,
2205,
8841,
329,
517,
1321,
546,
6300,
13,
198,
220,
37227,
198,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
7,
11250,
62,
67,
310,
17816,
6404,
1362,
62,
3672,
6,
12962,
198,
220,
20150,
62,
67,
310,
796,
42019,
9171,
14706,
7,
11250,
62,
67,
310,
8,
198,
220,
1303,
8314,
262,
11876,
1541,
423,
1366,
287,
340,
30,
198,
220,
611,
407,
20150,
62,
67,
310,
17816,
9641,
6,
5974,
198,
220,
220,
220,
1441,
198,
220,
611,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
20520,
6624,
949,
62,
41068,
25,
198,
220,
220,
220,
49706,
13,
10951,
10786,
2949,
761,
284,
40122,
378,
11537,
198,
220,
220,
220,
1441,
198,
220,
1949,
25,
198,
220,
220,
220,
49706,
13,
24442,
10786,
8743,
40122,
378,
510,
1566,
33756,
28,
4,
67,
11,
1426,
28,
4,
67,
3256,
949,
62,
41068,
11,
949,
62,
1930,
8,
628,
220,
220,
220,
1303,
43426,
262,
1468,
3691,
13,
649,
20150,
284,
3551,
284,
11898,
13,
198,
220,
220,
220,
1468,
62,
38993,
62,
67,
310,
796,
4866,
13,
22089,
30073,
7,
38993,
62,
67,
310,
8,
198,
220,
220,
220,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
20520,
796,
949,
62,
41068,
198,
220,
220,
220,
20150,
62,
67,
310,
17816,
9688,
62,
1930,
20520,
796,
949,
62,
1930,
628,
220,
220,
220,
351,
2393,
62,
26791,
13,
2953,
10179,
16594,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
4357,
277,
27261,
28,
17821,
8,
355,
649,
62,
69,
25,
198,
220,
220,
220,
220,
220,
1303,
28976,
16594,
9808,
257,
2393,
5412,
284,
257,
8584,
2393,
826,
1306,
284,
198,
220,
220,
220,
220,
220,
1303,
262,
1103,
2393,
357,
7890,
62,
6978,
828,
523,
356,
460,
1280,
257,
366,
961,
1,
5412,
319,
1366,
62,
6978,
198,
220,
220,
220,
220,
220,
1303,
1231,
13891,
28976,
16594,
338,
5412,
13,
220,
5514,
618,
28976,
16594,
338,
4732,
198,
220,
220,
220,
220,
220,
1303,
2512,
5645,
481,
262,
8584,
307,
3888,
284,
6330,
1366,
62,
6978,
13,
198,
220,
220,
220,
220,
220,
351,
1280,
7,
11250,
62,
67,
310,
17816,
7890,
62,
6978,
6,
4357,
705,
81,
11537,
355,
1468,
62,
69,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1468,
62,
69,
13,
36163,
7,
1084,
62,
1930,
532,
1468,
62,
38993,
62,
67,
310,
17816,
9688,
62,
1930,
6,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
15138,
351,
262,
717,
1627,
13869,
284,
651,
262,
649,
2196,
13,
198,
220,
220,
220,
220,
220,
220,
220,
717,
62,
1370,
796,
1468,
62,
69,
13,
961,
1370,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
9641,
20520,
796,
3497,
7376,
4657,
388,
7,
11085,
62,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
69,
13,
13564,
7,
11085,
62,
1370,
8,
628,
220,
220,
220,
220,
220,
220,
220,
4423,
346,
13,
30073,
7753,
26801,
7,
727,
62,
69,
11,
649,
62,
69,
8,
628,
220,
220,
220,
220,
220,
1303,
7413,
9489,
262,
366,
33491,
1,
2239,
286,
3551,
12,
33491,
357,
12518,
198,
220,
220,
220,
220,
220,
1303,
262,
2393,
62,
26791,
13,
2953,
10179,
16594,
4732,
5645,
828,
3613,
20150,
284,
11898,
287,
198,
220,
220,
220,
220,
220,
1303,
1339,
286,
11898,
5287,
13,
198,
220,
220,
220,
220,
220,
12793,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
11,
1468,
62,
38993,
62,
67,
310,
8,
628,
220,
220,
220,
1303,
2293,
356,
779,
28976,
16594,
11,
356,
460,
4781,
1468,
20150,
13,
198,
220,
220,
220,
12793,
9171,
14706,
7,
11250,
62,
67,
310,
11,
20150,
62,
67,
310,
8,
628,
220,
2845,
35528,
25,
198,
220,
220,
220,
49706,
13,
1069,
4516,
10786,
16922,
5091,
1141,
833,
19524,
378,
4905,
11537,
198,
220,
220,
220,
5298,
628,
198,
198,
4871,
18110,
7,
6404,
62,
26791,
13,
11187,
1362,
35608,
259,
11,
13877,
62,
8692,
13,
28632,
9237,
12124,
2599,
198,
220,
37227,
6207,
6629,
257,
18110,
290,
663,
47017,
9237,
12124,
13,
628,
220,
4619,
17427,
8979,
468,
691,
257,
2060,
6831,
2393,
11,
612,
460,
691,
1683,
307,
530,
198,
220,
15025,
47017,
9237,
12124,
379,
597,
1813,
640,
13,
220,
1406,
356,
18537,
262,
18110,
198,
220,
290,
663,
47017,
9237,
12124,
656,
530,
2134,
13,
220,
1649,
13610,
12124,
318,
1444,
11,
257,
198,
220,
5793,
318,
9477,
290,
262,
18110,
2134,
318,
1441,
13,
220,
383,
5793,
1276,
717,
307,
198,
220,
9477,
878,
597,
286,
7406,
11,
35910,
11,
393,
2275,
419,
460,
307,
973,
13,
198,
220,
37227,
628,
220,
825,
13610,
12124,
7,
944,
2599,
198,
220,
220,
220,
37227,
16719,
274,
257,
47017,
9237,
12124,
2134,
284,
307,
973,
416,
2262,
11794,
4755,
13,
628,
220,
220,
220,
4619,
428,
1398,
21938,
355,
47017,
9237,
12124,
11,
356,
1317,
326,
262,
198,
220,
220,
220,
47017,
9237,
12124,
318,
366,
403,
1069,
6474,
1,
416,
4634,
2116,
13557,
5532,
62,
5354,
11,
198,
220,
220,
220,
290,
1441,
2116,
13,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
4600,
944,
63,
611,
47017,
9237,
12124,
407,
1541,
287,
779,
11,
6045,
611,
8179,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
2116,
611,
2116,
13557,
5532,
62,
5354,
13,
330,
29782,
7,
25101,
8,
2073,
6045,
628,
220,
825,
4808,
16928,
9171,
14706,
7,
944,
2599,
198,
220,
220,
220,
37227,
50,
3080,
20150,
329,
428,
18110,
284,
11898,
357,
41068,
290,
1426,
21387,
15931,
198,
220,
220,
220,
1366,
796,
1391,
6,
22019,
62,
41068,
10354,
2116,
13,
22019,
62,
41068,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22019,
62,
1930,
10354,
2116,
13,
22019,
62,
1930,
92,
198,
220,
220,
220,
351,
2393,
62,
26791,
13,
2953,
10179,
16594,
7,
944,
13,
38993,
62,
6978,
11,
277,
27261,
28,
17821,
8,
355,
277,
25,
198,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
7890,
11,
277,
8,
628,
220,
825,
42019,
49106,
9171,
14706,
7,
944,
2599,
198,
220,
220,
220,
37227,
19452,
2850,
20150,
329,
428,
18110,
422,
11898,
357,
41068,
290,
1426,
737,
628,
220,
220,
220,
1550,
1123,
11169,
11,
4155,
326,
262,
1695,
4324,
286,
4406,
319,
11898,
468,
198,
220,
220,
220,
407,
30612,
674,
898,
1459,
1700,
13,
220,
1374,
561,
428,
1645,
30,
220,
1002,
262,
198,
220,
220,
220,
18110,
318,
4615,
11,
4406,
340,
991,
5818,
470,
1100,
389,
40122,
515,
422,
262,
198,
220,
220,
220,
1388,
6831,
11,
290,
262,
18110,
318,
302,
12,
29373,
739,
262,
976,
1438,
13,
628,
220,
220,
220,
1002,
262,
20150,
2393,
857,
407,
2152,
11,
481,
24595,
1441,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1366,
796,
9993,
8912,
40386,
7,
944,
13,
38993,
62,
6978,
11,
2116,
13,
6404,
1362,
13,
3672,
8,
198,
220,
220,
220,
611,
1366,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
611,
705,
22019,
62,
41068,
6,
407,
287,
1366,
393,
705,
22019,
62,
1930,
6,
407,
287,
1366,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
18224,
10786,
49106,
4064,
82,
20150,
2393,
12515,
26,
13259,
889,
3256,
2116,
13,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
198,
220,
220,
220,
220,
220,
1303,
6889,
1654,
356,
389,
991,
4058,
286,
2829,
62,
7753,
13,
198,
220,
220,
220,
220,
220,
351,
2116,
13,
961,
62,
5354,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
796,
42019,
9171,
14706,
7,
944,
13,
36439,
62,
7753,
13,
16934,
2514,
35,
713,
28955,
198,
220,
220,
220,
220,
220,
2116,
13,
22019,
62,
41068,
796,
949,
7,
9806,
7,
38993,
62,
67,
310,
17816,
11085,
62,
41068,
6,
4357,
1366,
17816,
22019,
62,
41068,
20520,
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,
20150,
62,
67,
310,
17816,
12957,
62,
41068,
20520,
1343,
352,
8,
198,
220,
220,
220,
220,
220,
2116,
13,
22019,
62,
1930,
796,
949,
7,
9806,
7,
38993,
62,
67,
310,
17816,
9688,
62,
1930,
6,
4357,
1366,
17816,
22019,
62,
1930,
20520,
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,
20150,
62,
67,
310,
17816,
437,
62,
1930,
6,
12962,
198,
220,
220,
220,
220,
220,
611,
357,
7890,
17816,
22019,
62,
41068,
20520,
1279,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
20520,
393,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
17816,
22019,
62,
41068,
20520,
1875,
357,
38993,
62,
67,
310,
17816,
12957,
62,
41068,
20520,
1343,
352,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
18224,
10786,
49106,
4064,
82,
1090,
62,
41068,
28,
4,
67,
318,
503,
286,
11876,
2837,
4064,
67,
284,
4064,
67,
11,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
30283,
278,
284,
4064,
67,
3256,
2116,
13,
3672,
11,
1366,
17816,
22019,
62,
41068,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
17816,
11085,
62,
41068,
6,
4357,
20150,
62,
67,
310,
17816,
12957,
62,
41068,
20520,
1343,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22019,
62,
41068,
8,
198,
220,
220,
220,
220,
220,
2116,
13,
3605,
62,
41068,
796,
2116,
13,
22019,
62,
41068,
198,
220,
220,
220,
220,
220,
2116,
13,
3605,
62,
1930,
796,
2116,
13,
22019,
62,
1930,
628,
220,
825,
4808,
28632,
7,
944,
2599,
198,
220,
220,
220,
37227,
35561,
257,
1351,
286,
13310,
4406,
13,
628,
220,
220,
220,
41835,
262,
1459,
11876,
20947,
379,
2116,
13,
961,
62,
29325,
13,
220,
1002,
340,
1541,
468,
198,
220,
220,
220,
1366,
287,
340,
11,
2116,
13,
961,
62,
29325,
481,
307,
4504,
355,
12,
271,
13,
220,
632,
481,
307,
366,
5420,
2967,
1,
198,
220,
220,
220,
618,
340,
318,
6565,
13,
628,
220,
220,
220,
4149,
82,
510,
284,
4808,
19499,
45746,
62,
33489,
62,
17513,
51,
1546,
422,
262,
2393,
319,
1123,
366,
5420,
359,
1911,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
317,
1351,
286,
4406,
11,
810,
1123,
318,
257,
1115,
12,
30854,
46545,
25,
198,
220,
220,
220,
220,
220,
220,
220,
357,
22105,
62,
41068,
11,
1700,
62,
7890,
11,
1627,
62,
33661,
737,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
2116,
13,
961,
62,
29325,
25,
198,
220,
220,
220,
220,
220,
1441,
2116,
13,
961,
62,
29325,
198,
220,
220,
220,
1303,
8314,
262,
11876,
1541,
423,
1366,
287,
340,
30,
198,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
944,
13,
36439,
62,
7753,
13,
7890,
62,
6978,
2599,
198,
220,
220,
220,
220,
220,
1441,
2116,
13,
961,
62,
29325,
198,
220,
220,
220,
2116,
13,
24442,
10786,
62,
28632,
25,
4953,
329,
1100,
62,
5354,
11537,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
1303,
1649,
262,
11876,
318,
40122,
803,
11,
356,
460,
470,
651,
262,
1100,
62,
5354,
13,
198,
220,
220,
220,
220,
220,
611,
407,
2116,
13,
961,
62,
5354,
13,
330,
29782,
7,
48678,
28,
15,
13,
20,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
17635,
198,
220,
220,
220,
220,
220,
20150,
62,
67,
310,
796,
42019,
9171,
14706,
7,
944,
13,
36439,
62,
7753,
13,
16934,
2514,
35,
713,
28955,
198,
220,
220,
220,
220,
220,
351,
1280,
7,
944,
13,
36439,
62,
7753,
13,
7890,
62,
6978,
11,
705,
81,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1090,
796,
2116,
13,
3605,
62,
1930,
532,
20150,
62,
67,
310,
17816,
9688,
62,
1930,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
277,
13,
36163,
7,
22019,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
33661,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
26684,
62,
33661,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1627,
287,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2472,
62,
33661,
1875,
4808,
19499,
45746,
62,
33489,
62,
17513,
51,
1546,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2546,
796,
18896,
7,
1370,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1090,
15853,
2546,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1090,
1875,
357,
38993,
62,
67,
310,
17816,
437,
62,
1930,
20520,
532,
20150,
62,
67,
310,
17816,
9688,
62,
1930,
20520,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33756,
11,
1700,
796,
2547,
325,
23739,
7,
1370,
11,
2116,
13,
6404,
1362,
13,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
33756,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
23042,
278,
286,
428,
1627,
4054,
329,
617,
1738,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26684,
62,
33661,
15853,
2546,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
5514,
751,
284,
2472,
62,
33661,
329,
257,
4938,
1627,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2472,
62,
33661,
15853,
2546,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
40348,
597,
26684,
9881,
422,
4271,
26684,
4406,
287,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
366,
7857,
1,
286,
428,
1700,
11,
287,
1502,
284,
1249,
262,
7172,
284,
14267,
284,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1774,
11677,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
961,
62,
29325,
13,
33295,
19510,
41068,
11,
1700,
11,
2546,
1343,
26684,
62,
33661,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26684,
62,
33661,
796,
657,
198,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
2116,
13,
961,
62,
5354,
13,
9787,
1870,
26362,
3419,
198,
220,
220,
220,
1441,
2116,
13,
961,
62,
29325,
628,
220,
825,
4808,
10019,
7,
944,
2599,
198,
220,
220,
220,
37227,
47429,
329,
7406,
11,
635,
973,
329,
4856,
4959,
13,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
317,
46545,
286,
357,
41068,
11,
1700,
828,
393,
357,
14202,
11,
6045,
8,
611,
645,
4406,
1695,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
407,
2116,
13557,
5532,
62,
5354,
13,
3792,
39,
19892,
33529,
198,
220,
220,
220,
220,
220,
5298,
13877,
62,
8692,
13,
9237,
12124,
3109,
6474,
198,
220,
220,
220,
42684,
796,
2116,
13557,
28632,
3419,
198,
220,
220,
220,
611,
407,
42684,
25,
198,
220,
220,
220,
220,
220,
1441,
6045,
11,
6045,
198,
220,
220,
220,
33756,
11,
1700,
11,
2546,
796,
42684,
13,
12924,
7,
15,
8,
198,
220,
220,
220,
2116,
13,
3605,
62,
41068,
796,
33756,
1343,
352,
198,
220,
220,
220,
2116,
13,
3605,
62,
1930,
15853,
2546,
198,
220,
220,
220,
1441,
33756,
11,
1700,
628,
220,
825,
7406,
7,
944,
2599,
198,
220,
220,
220,
37227,
6214,
47017,
9237,
12124,
13,
10019,
526,
15931,
198,
220,
220,
220,
33756,
11,
1700,
796,
2116,
13557,
10019,
3419,
198,
220,
220,
220,
611,
407,
33756,
25,
198,
220,
220,
220,
220,
220,
1441,
6045,
198,
220,
220,
220,
1785,
796,
4818,
265,
9497,
13,
9237,
13,
5960,
48499,
1096,
7,
22105,
8,
198,
220,
220,
220,
1441,
2116,
13,
36439,
62,
7753,
13,
41506,
1096,
9237,
7,
15596,
8,
628,
220,
825,
35910,
7,
944,
2599,
198,
220,
220,
220,
37227,
6214,
47017,
9237,
12124,
13,
6935,
270,
526,
15931,
198,
220,
220,
220,
611,
407,
2116,
13557,
5532,
62,
5354,
13,
3792,
39,
19892,
33529,
198,
220,
220,
220,
220,
220,
5298,
13877,
62,
8692,
13,
9237,
12124,
3109,
6474,
198,
220,
220,
220,
2116,
13,
22019,
62,
41068,
796,
2116,
13,
3605,
62,
41068,
198,
220,
220,
220,
2116,
13,
22019,
62,
1930,
796,
2116,
13,
3605,
62,
1930,
198,
220,
220,
220,
1303,
48987,
326,
7692,
286,
597,
8563,
11,
19253,
389,
2716,
13,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
2116,
13557,
16928,
9171,
14706,
3419,
198,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
1303,
16926,
46,
7,
74,
19811,
2599,
2262,
11794,
4755,
393,
42636,
18471,
3524,
815,
4929,
428,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6631,
290,
2230,
284,
11512,
4423,
866,
13,
198,
220,
220,
220,
220,
220,
2116,
13,
1069,
4516,
10786,
6935,
270,
25,
19430,
6631,
5091,
11,
18715,
743,
307,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14681,
276,
416,
5072,
13877,
3294,
1661,
11537,
198,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
5532,
62,
5354,
13,
20979,
3419,
198,
220,
220,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
7,
74,
19811,
2599,
2262,
11794,
4755,
393,
42636,
18471,
3524,
815,
4929,
428,
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,
6631,
290,
2230,
284,
11512,
4423,
866,
13,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1069,
4516,
10786,
6935,
270,
25,
18628,
4049,
5091,
11537,
628,
220,
825,
2275,
419,
7,
944,
2599,
198,
220,
220,
220,
37227,
6214,
47017,
9237,
12124,
13,
4826,
419,
526,
15931,
198,
220,
220,
220,
611,
407,
2116,
13557,
5532,
62,
5354,
13,
3792,
39,
19892,
33529,
198,
220,
220,
220,
220,
220,
5298,
13877,
62,
8692,
13,
9237,
12124,
3109,
6474,
198,
220,
220,
220,
2116,
13,
3605,
62,
41068,
796,
2116,
13,
22019,
62,
41068,
198,
220,
220,
220,
2116,
13,
3605,
62,
1930,
796,
2116,
13,
22019,
62,
1930,
198,
220,
220,
220,
2116,
13,
961,
62,
29325,
796,
17635,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
2116,
13557,
5532,
62,
5354,
13,
20979,
3419,
198,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
1303,
16926,
46,
7,
74,
19811,
2599,
2262,
11794,
4755,
393,
42636,
18471,
3524,
815,
4929,
428,
198,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6631,
290,
2230,
284,
11512,
4423,
866,
13,
198,
220,
220,
220,
220,
220,
2116,
13,
1069,
4516,
10786,
4826,
419,
25,
18628,
4049,
5091,
11537,
198
] | 2.721083 | 8,092 |
from model.pgra import PGRA
from model.pgra_function.sc import Score
from data_utils.data_gen import LinkGenerator, init_seed_fn
from torch.utils.data import DataLoader
from time import perf_counter
import torch
import numpy as np
import config
from model.modules.regularizer import Regularizer
import tempfile
from collections import Counter
from tqdm import tqdm
import os
from model.tracker import LossTracker, MultiClsTracker
| [
6738,
2746,
13,
6024,
430,
1330,
23842,
3861,
198,
6738,
2746,
13,
6024,
430,
62,
8818,
13,
1416,
1330,
15178,
198,
6738,
1366,
62,
26791,
13,
7890,
62,
5235,
1330,
7502,
8645,
1352,
11,
2315,
62,
28826,
62,
22184,
198,
6738,
28034,
13,
26791,
13,
7890,
1330,
6060,
17401,
198,
6738,
640,
1330,
23035,
62,
24588,
198,
11748,
28034,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
4566,
198,
6738,
2746,
13,
18170,
13,
16338,
7509,
1330,
23603,
7509,
198,
11748,
20218,
7753,
198,
6738,
17268,
1330,
15034,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
198,
11748,
28686,
198,
198,
6738,
2746,
13,
2213,
10735,
1330,
22014,
35694,
11,
15237,
2601,
82,
35694,
628
] | 3.724138 | 116 |
from astropy import cosmology as cosmo
import autofit as af
from autolens.pipeline import tagging
from autolens.pipeline.phase import dataset
from autolens.pipeline.phase.imaging.analysis import Analysis
from autolens.pipeline.phase.imaging.meta_imaging import MetaImaging
from autolens.pipeline.phase.imaging.result import Result
| [
6738,
6468,
28338,
1330,
8615,
29126,
355,
8615,
5908,
198,
198,
11748,
1960,
1659,
270,
355,
6580,
198,
6738,
1960,
349,
641,
13,
79,
541,
4470,
1330,
49620,
198,
6738,
1960,
349,
641,
13,
79,
541,
4470,
13,
40715,
1330,
27039,
198,
6738,
1960,
349,
641,
13,
79,
541,
4470,
13,
40715,
13,
320,
3039,
13,
20930,
1330,
14691,
198,
6738,
1960,
349,
641,
13,
79,
541,
4470,
13,
40715,
13,
320,
3039,
13,
28961,
62,
320,
3039,
1330,
30277,
3546,
3039,
198,
6738,
1960,
349,
641,
13,
79,
541,
4470,
13,
40715,
13,
320,
3039,
13,
20274,
1330,
25414,
628,
198
] | 3.27451 | 102 |
from torch.utils.data import Dataset
import h5py
import abc
| [
6738,
28034,
13,
26791,
13,
7890,
1330,
16092,
292,
316,
198,
11748,
289,
20,
9078,
198,
11748,
450,
66,
628
] | 3.05 | 20 |
import os
import shutil
import time
import pprint
import torch
import argparse
import numpy as np
## ------------------------ Basic Functions ------------------------
def one_hot(indices, depth):
"""
Returns a one-hot tensor.
This is a PyTorch equivalent of Tensorflow's tf.one_hot.
Parameters:
indices: a (n_batch, m) Tensor or (m) Tensor.
depth: a scalar. Represents the depth of the one hot dimension.
Returns: a (n_batch, m, depth) Tensor or (m, depth) Tensor.
"""
encoded_indicies = torch.zeros(indices.size() + torch.Size([depth]))
if indices.is_cuda:
encoded_indicies = encoded_indicies.cuda()
index = indices.view(indices.size()+torch.Size([1]))
encoded_indicies = encoded_indicies.scatter_(1,index,1)
return encoded_indicies
_utils_pp = pprint.PrettyPrinter()
def compute_confidence_interval(data):
"""
Compute 95% confidence interval
:param data: An array of mean accuracy (or mAP) across a number of sampled episodes.
:return: the 95% confidence interval for this data.
"""
a = 1.0 * np.array(data)
m = np.mean(a)
std = np.std(a)
pm = 1.96 * (std / np.sqrt(len(a)))
return m, pm
## ------------------------ GFSL Measures ------------------------
# the method to count harmonic mean in low-shot learning paper
# based on the seen-joint and unseen_joint performnace
from sklearn.metrics import average_precision_score
# based on the seen-joint and unseen_joint performnace based on MAP
# change recall = tps / tps[-1] in sklearn/metrics/ranking.py to recall = np.ones(tps.size) if tps[-1] == 0 else tps / tps[-1]
## ------------------------GFSL Training Arguments Related ------------------------
## ------------------------GFSL Evaluation Arguments Related ------------------------ | [
11748,
28686,
198,
11748,
4423,
346,
198,
11748,
640,
198,
11748,
279,
4798,
198,
11748,
28034,
198,
11748,
1822,
29572,
198,
11748,
299,
32152,
355,
45941,
198,
198,
2235,
220,
22369,
14392,
40480,
220,
22369,
220,
198,
4299,
530,
62,
8940,
7,
521,
1063,
11,
6795,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
16409,
257,
530,
12,
8940,
11192,
273,
13,
198,
220,
220,
220,
770,
318,
257,
9485,
15884,
354,
7548,
286,
309,
22854,
11125,
338,
48700,
13,
505,
62,
8940,
13,
628,
220,
220,
220,
40117,
25,
198,
220,
220,
220,
220,
220,
36525,
25,
220,
257,
357,
77,
62,
43501,
11,
285,
8,
309,
22854,
393,
357,
76,
8,
309,
22854,
13,
198,
220,
220,
220,
220,
220,
6795,
25,
257,
16578,
283,
13,
1432,
6629,
262,
6795,
286,
262,
530,
3024,
15793,
13,
198,
220,
220,
220,
16409,
25,
257,
357,
77,
62,
43501,
11,
285,
11,
6795,
8,
309,
22854,
393,
357,
76,
11,
6795,
8,
309,
22854,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
30240,
62,
521,
291,
444,
796,
28034,
13,
9107,
418,
7,
521,
1063,
13,
7857,
3419,
1343,
28034,
13,
10699,
26933,
18053,
60,
4008,
198,
220,
220,
220,
611,
36525,
13,
271,
62,
66,
15339,
25,
198,
220,
220,
220,
220,
220,
220,
220,
30240,
62,
521,
291,
444,
796,
30240,
62,
521,
291,
444,
13,
66,
15339,
3419,
198,
220,
220,
220,
6376,
796,
36525,
13,
1177,
7,
521,
1063,
13,
7857,
3419,
10,
13165,
354,
13,
10699,
26933,
16,
60,
4008,
198,
220,
220,
220,
30240,
62,
521,
291,
444,
796,
30240,
62,
521,
291,
444,
13,
1416,
1436,
41052,
16,
11,
9630,
11,
16,
8,
628,
220,
220,
220,
1441,
30240,
62,
521,
291,
444,
628,
628,
198,
198,
62,
26791,
62,
381,
796,
279,
4798,
13,
35700,
6836,
3849,
3419,
198,
198,
4299,
24061,
62,
39745,
62,
3849,
2100,
7,
7890,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3082,
1133,
6957,
4,
6628,
16654,
198,
220,
220,
220,
1058,
17143,
1366,
25,
1052,
7177,
286,
1612,
9922,
357,
273,
285,
2969,
8,
1973,
257,
1271,
286,
35846,
8640,
13,
198,
220,
220,
220,
1058,
7783,
25,
262,
6957,
4,
6628,
16654,
329,
428,
1366,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
257,
796,
352,
13,
15,
1635,
45941,
13,
18747,
7,
7890,
8,
198,
220,
220,
220,
285,
796,
45941,
13,
32604,
7,
64,
8,
198,
220,
220,
220,
14367,
796,
45941,
13,
19282,
7,
64,
8,
198,
220,
220,
220,
9114,
796,
352,
13,
4846,
1635,
357,
19282,
1220,
45941,
13,
31166,
17034,
7,
11925,
7,
64,
22305,
198,
220,
220,
220,
1441,
285,
11,
9114,
198,
198,
2235,
220,
22369,
34977,
8634,
45040,
220,
22369,
220,
628,
198,
2,
262,
2446,
284,
954,
49239,
1612,
287,
1877,
12,
9442,
4673,
3348,
198,
198,
2,
1912,
319,
262,
1775,
12,
73,
1563,
290,
29587,
62,
73,
1563,
1620,
77,
558,
198,
198,
6738,
1341,
35720,
13,
4164,
10466,
1330,
2811,
62,
3866,
16005,
62,
26675,
198,
198,
2,
1912,
319,
262,
1775,
12,
73,
1563,
290,
29587,
62,
73,
1563,
1620,
77,
558,
1912,
319,
34645,
198,
2,
1487,
10014,
796,
256,
862,
1220,
256,
862,
58,
12,
16,
60,
287,
1341,
35720,
14,
4164,
10466,
14,
28405,
13,
9078,
284,
10014,
796,
45941,
13,
1952,
7,
83,
862,
13,
7857,
8,
611,
256,
862,
58,
12,
16,
60,
6624,
657,
2073,
256,
862,
1220,
256,
862,
58,
12,
16,
60,
628,
198,
2235,
220,
22369,
21713,
8634,
13614,
20559,
2886,
19809,
220,
22369,
220,
628,
198,
2235,
220,
22369,
21713,
8634,
34959,
20559,
2886,
19809,
220,
22369,
220
] | 2.954545 | 616 |
from pyoinformatics.align import lcs, format_matrix
from pyoinformatics.seq import Seq
| [
6738,
279,
8226,
259,
18982,
873,
13,
31494,
1330,
300,
6359,
11,
5794,
62,
6759,
8609,
198,
6738,
279,
8226,
259,
18982,
873,
13,
41068,
1330,
1001,
80,
628,
198
] | 2.966667 | 30 |
from __future__ import annotations
import os
from importlib import import_module
from typing import TYPE_CHECKING, List, Type, Dict, Union
from openhab_creator import logger
if TYPE_CHECKING:
from openhab_creator.models.configuration import Configuration
from openhab_creator.output.items.baseitemscreator import BaseItemsCreator
| [
6738,
11593,
37443,
834,
1330,
37647,
198,
198,
11748,
28686,
198,
6738,
1330,
8019,
1330,
1330,
62,
21412,
198,
6738,
19720,
1330,
41876,
62,
50084,
2751,
11,
7343,
11,
5994,
11,
360,
713,
11,
4479,
198,
198,
6738,
1280,
5976,
62,
45382,
1330,
49706,
198,
198,
361,
41876,
62,
50084,
2751,
25,
198,
220,
220,
220,
422,
1280,
5976,
62,
45382,
13,
27530,
13,
11250,
3924,
1330,
28373,
198,
220,
220,
220,
422,
1280,
5976,
62,
45382,
13,
22915,
13,
23814,
13,
8692,
9186,
1416,
630,
273,
1330,
7308,
23022,
16719,
273,
628,
198
] | 3.648936 | 94 |
import pandas as pd
from imblearn.over_sampling import RandomOverSampler
import math
#Training Data
re = RandomOverSampler()
df = pd.read_csv("data/raw/train.csv")
y = df["Survived"]
x = df.drop(["Survived", "Cabin", "Name", "PassengerId", "Ticket"], axis=1)
embark = ["C", "Q", "S"]
genders = ["male", "female"]
for i, v in enumerate(x["Embarked"]):
try:
x.at[i, "Embarked"] = embark.index(v) + 1
except ValueError as n:
x.at[i, "Embarked"] = 0
for i, v in enumerate(x["Sex"]):
x.at[i, "Sex"] = genders.index(v)
mean_age = df.describe()["Age"]["mean"]
for i, v in enumerate(x["Age"]):
if(math.isnan(v)):
x.at[i, "Age"] = mean_age
x,y = re.fit_resample(x,y)
df = pd.concat([x,y], axis=1)
df.to_csv("data/processed/train.csv", index=False)
#Test Data
test_df = pd.read_csv("data/raw/test.csv")
test_df = test_df.drop(["Cabin", "Name", "PassengerId", "Ticket"], axis=1)
for i, v in enumerate(test_df["Embarked"]):
try:
test_df.at[i, "Embarked"] = embark.index(v) + 1
except ValueError as n:
test_df.at[i, "Embarked"] = 0
for i, v in enumerate(test_df["Sex"]):
test_df.at[i, "Sex"] = genders.index(v)
for i, v in enumerate(test_df["Age"]):
if(math.isnan(v)):
test_df.at[i, "Age"] = mean_age
for i, v in enumerate(test_df["Age"]):
if(math.isnan(v)):
test_df.at[i, "Age"] = mean_age
mean_fare = df.describe()["Fare"]["mean"]
for i, v in enumerate(test_df["Fare"]):
if(math.isnan(v)):
test_df.at[i, "Fare"] = mean_fare
test_y = pd.read_csv("data/raw/gender.csv")
test_y = test_y.drop(["PassengerId"], axis=1)
test_df = pd.concat([test_df, test_y], axis=1)
test_df.to_csv("data/processed/test.csv", index=False) | [
11748,
19798,
292,
355,
279,
67,
198,
6738,
545,
903,
1501,
13,
2502,
62,
37687,
11347,
1330,
14534,
5886,
16305,
20053,
198,
11748,
10688,
628,
198,
2,
44357,
6060,
198,
260,
796,
14534,
5886,
16305,
20053,
3419,
628,
198,
7568,
796,
279,
67,
13,
961,
62,
40664,
7203,
7890,
14,
1831,
14,
27432,
13,
40664,
4943,
198,
198,
88,
796,
47764,
14692,
34652,
1572,
8973,
198,
87,
796,
47764,
13,
14781,
7,
14692,
34652,
1572,
1600,
366,
34,
6014,
1600,
366,
5376,
1600,
366,
14478,
6540,
7390,
1600,
366,
51,
9715,
33116,
16488,
28,
16,
8,
628,
198,
24419,
668,
796,
14631,
34,
1600,
366,
48,
1600,
366,
50,
8973,
198,
70,
7338,
796,
14631,
22606,
1600,
366,
24724,
8973,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
87,
14692,
31567,
668,
276,
8973,
2599,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
13,
265,
58,
72,
11,
366,
31567,
668,
276,
8973,
796,
21030,
13,
9630,
7,
85,
8,
1343,
352,
198,
220,
220,
220,
2845,
11052,
12331,
355,
299,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
13,
265,
58,
72,
11,
366,
31567,
668,
276,
8973,
796,
657,
198,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
87,
14692,
23398,
8973,
2599,
198,
220,
220,
220,
2124,
13,
265,
58,
72,
11,
366,
23398,
8973,
796,
38054,
13,
9630,
7,
85,
8,
628,
198,
32604,
62,
496,
796,
47764,
13,
20147,
4892,
3419,
14692,
23396,
1,
7131,
1,
32604,
8973,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
87,
14692,
23396,
8973,
2599,
198,
220,
220,
220,
611,
7,
11018,
13,
271,
12647,
7,
85,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
13,
265,
58,
72,
11,
366,
23396,
8973,
796,
1612,
62,
496,
198,
198,
87,
11,
88,
796,
302,
13,
11147,
62,
411,
1403,
7,
87,
11,
88,
8,
628,
198,
7568,
796,
279,
67,
13,
1102,
9246,
26933,
87,
11,
88,
4357,
16488,
28,
16,
8,
198,
7568,
13,
1462,
62,
40664,
7203,
7890,
14,
14681,
276,
14,
27432,
13,
40664,
1600,
6376,
28,
25101,
8,
628,
198,
2,
14402,
6060,
198,
198,
9288,
62,
7568,
796,
279,
67,
13,
961,
62,
40664,
7203,
7890,
14,
1831,
14,
9288,
13,
40664,
4943,
198,
198,
9288,
62,
7568,
796,
1332,
62,
7568,
13,
14781,
7,
14692,
34,
6014,
1600,
366,
5376,
1600,
366,
14478,
6540,
7390,
1600,
366,
51,
9715,
33116,
16488,
28,
16,
8,
628,
198,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
9288,
62,
7568,
14692,
31567,
668,
276,
8973,
2599,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7568,
13,
265,
58,
72,
11,
366,
31567,
668,
276,
8973,
796,
21030,
13,
9630,
7,
85,
8,
1343,
352,
198,
220,
220,
220,
2845,
11052,
12331,
355,
299,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7568,
13,
265,
58,
72,
11,
366,
31567,
668,
276,
8973,
796,
657,
628,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
9288,
62,
7568,
14692,
23398,
8973,
2599,
198,
220,
220,
220,
1332,
62,
7568,
13,
265,
58,
72,
11,
366,
23398,
8973,
796,
38054,
13,
9630,
7,
85,
8,
198,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
9288,
62,
7568,
14692,
23396,
8973,
2599,
198,
220,
220,
220,
611,
7,
11018,
13,
271,
12647,
7,
85,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7568,
13,
265,
58,
72,
11,
366,
23396,
8973,
796,
1612,
62,
496,
628,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
9288,
62,
7568,
14692,
23396,
8973,
2599,
198,
220,
220,
220,
611,
7,
11018,
13,
271,
12647,
7,
85,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7568,
13,
265,
58,
72,
11,
366,
23396,
8973,
796,
1612,
62,
496,
198,
198,
32604,
62,
9496,
796,
47764,
13,
20147,
4892,
3419,
14692,
37,
533,
1,
7131,
1,
32604,
8973,
198,
1640,
1312,
11,
410,
287,
27056,
378,
7,
9288,
62,
7568,
14692,
37,
533,
8973,
2599,
198,
220,
220,
220,
611,
7,
11018,
13,
271,
12647,
7,
85,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
7568,
13,
265,
58,
72,
11,
366,
37,
533,
8973,
796,
1612,
62,
9496,
198,
198,
9288,
62,
88,
796,
279,
67,
13,
961,
62,
40664,
7203,
7890,
14,
1831,
14,
8388,
13,
40664,
4943,
198,
9288,
62,
88,
796,
1332,
62,
88,
13,
14781,
7,
14692,
14478,
6540,
7390,
33116,
16488,
28,
16,
8,
198,
198,
9288,
62,
7568,
796,
279,
67,
13,
1102,
9246,
26933,
9288,
62,
7568,
11,
1332,
62,
88,
4357,
16488,
28,
16,
8,
198,
9288,
62,
7568,
13,
1462,
62,
40664,
7203,
7890,
14,
14681,
276,
14,
9288,
13,
40664,
1600,
6376,
28,
25101,
8
] | 2.135301 | 813 |
from typing import List
from cu_pass.dpa_calculator.aggregate_interference_calculator.configuration.support.eirps import \
EIRP_DISTRIBUTION_MAP_TYPE
from cu_pass.dpa_calculator.cbsd.cbsd import CbsdCategories
from cu_pass.dpa_calculator.dpa.builder import RadioAstronomyFacilityNames
from cu_pass.dpa_calculator.dpa.dpa import Dpa
from testcases.cu_pass.dpa_calculator.features.environment.hooks import ContextSas
from testcases.cu_pass.dpa_calculator.features.steps.dpa_neighborhood.environment.contexts.context_cbsd_deployment_options import \
ContextCbsdDeploymentOptions
from testcases.cu_pass.dpa_calculator.features.steps.dpa_neighborhood.environment.contexts.context_monte_carlo_iterations import \
ContextMonteCarloIterations
from testcases.cu_pass.dpa_calculator.features.steps.dpa_neighborhood.environment.parsers.parse_dpa import parse_dpa
ARBITRARY_BUCKET_NAME = 'arbitrary_bucket_name'
ARBITRARY_DPA_NAME = RadioAstronomyFacilityNames.HatCreek.value
ARBITRARY_NUMBER_OF_ITERATIONS = 1
ARBITRARY_RADIUS_IN_KILOMETERS = 2
ARBITRARY_OUTPUT_DIRECTORY = 'arbitrary_output_directory'
| [
6738,
19720,
1330,
7343,
198,
198,
6738,
18912,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
9460,
49373,
62,
3849,
4288,
62,
9948,
3129,
1352,
13,
11250,
3924,
13,
11284,
13,
68,
343,
862,
1330,
3467,
198,
220,
220,
220,
412,
4663,
47,
62,
26288,
5446,
9865,
35354,
62,
33767,
62,
25216,
198,
6738,
18912,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
66,
1443,
67,
13,
66,
1443,
67,
1330,
327,
1443,
67,
34,
26129,
198,
6738,
18912,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
67,
8957,
13,
38272,
1330,
8829,
33751,
1313,
9145,
47522,
879,
36690,
198,
6738,
18912,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
67,
8957,
13,
67,
8957,
1330,
360,
8957,
198,
6738,
1332,
33964,
13,
27399,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
40890,
13,
38986,
13,
25480,
82,
1330,
30532,
50,
292,
198,
6738,
1332,
33964,
13,
27399,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
40890,
13,
20214,
13,
67,
8957,
62,
710,
394,
2865,
2894,
13,
38986,
13,
22866,
82,
13,
22866,
62,
66,
1443,
67,
62,
2934,
1420,
434,
62,
25811,
1330,
3467,
198,
220,
220,
220,
30532,
34,
1443,
67,
49322,
434,
29046,
198,
6738,
1332,
33964,
13,
27399,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
40890,
13,
20214,
13,
67,
8957,
62,
710,
394,
2865,
2894,
13,
38986,
13,
22866,
82,
13,
22866,
62,
2144,
660,
62,
7718,
5439,
62,
2676,
602,
1330,
3467,
198,
220,
220,
220,
30532,
9069,
660,
9914,
5439,
29993,
602,
198,
6738,
1332,
33964,
13,
27399,
62,
6603,
13,
67,
8957,
62,
9948,
3129,
1352,
13,
40890,
13,
20214,
13,
67,
8957,
62,
710,
394,
2865,
2894,
13,
38986,
13,
79,
945,
364,
13,
29572,
62,
67,
8957,
1330,
21136,
62,
67,
8957,
198,
198,
1503,
26094,
49,
13153,
62,
33,
16696,
2767,
62,
20608,
796,
705,
283,
2545,
11619,
62,
27041,
316,
62,
3672,
6,
198,
1503,
26094,
49,
13153,
62,
35,
4537,
62,
20608,
796,
8829,
33751,
1313,
9145,
47522,
879,
36690,
13,
40483,
34,
10316,
13,
8367,
198,
1503,
26094,
49,
13153,
62,
41359,
13246,
62,
19238,
62,
2043,
1137,
18421,
796,
352,
198,
1503,
26094,
49,
13153,
62,
49,
2885,
40,
2937,
62,
1268,
62,
42,
4146,
2662,
2767,
4877,
796,
362,
198,
1503,
26094,
49,
13153,
62,
2606,
7250,
3843,
62,
17931,
23988,
15513,
796,
705,
283,
2545,
11619,
62,
22915,
62,
34945,
6,
628,
198
] | 2.663462 | 416 |
import logging
import os
import sys
import time
from typing import Union
from io import IOBase
from .base import Client
from tftpy.shared import TIMEOUT_RETRIES
from tftpy.packet import types
from tftpy.exceptions import TftpException,TftpTimeout,TftpFileNotFoundError
from tftpy.states import SentReadRQ,SentWriteRQ
logger = logging.getLogger('tftpy.context.client')
class Upload(Client):
"""The upload context for the client during an upload.
Note: If input is a hyphen, then we will use stdin."""
def __init__(self, host: str, port: int, timeout: int,
input: Union[IOBase,str], **kwargs) -> None:
"""Upload context for uploading data to a server.
Args:
host (str): Server Address
port (int): Server Port
timeout (int): socket timeout
input ([IOBase,str]): Input data, can be one of
- An open file object
- A path to a file
- a '-' indicating read from STDIN
"""
super().__init__(host, port, timeout, **kwargs)
# If the input object has a read() function, assume it is file-like.
if hasattr(input, 'read'):
self.fileobj = input
elif input == '-':
self.fileobj = sys.stdin
else:
self.fileobj = open(input, "rb")
logger.debug("tftpy.context.client.upload.__init__()")
logger.debug(f" file_to_transfer = {self.file_to_transfer}, options = {self.options}")
def start(self) -> None:
"""Main loop to read data in and send file to the server."""
logger.info(f"Sending tftp upload request to {self.host}")
logger.info(f" filename -> {self.file_to_transfer}")
logger.info(f" options -> {self.options}")
self.metrics.start_time = time.time()
logger.debug(f"Set metrics.start_time to {self.metrics.start_time}")
pkt = types.WriteRQ()
pkt.filename = self.file_to_transfer
pkt.mode = self.mode
pkt.options = self.options
self.send(pkt)
self.state = SentWriteRQ(self)
while self.state:
try:
logger.debug(f"State is {self.state}")
self.cycle()
except TftpTimeout as err:
logger.error(str(err))
self.retry_count += 1
if self.retry_count >= TIMEOUT_RETRIES:
logger.debug("hit max retries, giving up")
raise
else:
logger.warning("resending last packet")
self.state.resend_last()
def end(self, *args):
"""Finish up the context."""
super().end()
self.metrics.end_time = time.time()
logger.debug(f"Set metrics.end_time to {self.metrics.end_time}")
self.metrics.compute()
class Download(Client):
"""The download context for the client during a download.
Note: If output is a hyphen, then the output will be sent to stdout."""
def __init__(self, host: str, port: int, timeout: int,
output: Union[IOBase,str], **kwargs) -> None:
"""Initalize the Download context with the server and
where to save the data
Args:
host (str): Server Address
port (int): Server port
timeout (int): Socket Timeout
output (Union[IOBase,str]): Output data, can be one of
- An open file object
- A path to a file
- '-' indicating write to STDOUT
Raises:
TftpException: unable to open the destiation file for writing
"""
super().__init__(host, port, timeout, **kwargs)
self.filelike_fileobj = False
# If the output object has a write() function, assume it is file-like.
if hasattr(output, 'write'):
self.fileobj = output
self.filelike_fileobj = True
# If the output filename is -, then use stdout
elif output == '-':
self.fileobj = sys.stdout
self.filelike_fileobj = True
else:
try:
self.fileobj = open(output, "wb")
except OSError as err:
raise TftpException("Could not open output file", err)
logger.debug("tftpy.context.client.Download.__init__()")
logger.debug(f" file_to_transfer = {self.file_to_transfer}, options = {self.options}")
def start(self) -> None:
"""Initiate the download.
Raises:
TftpTimeout: Failed to connect to the server
TftpFileNotFoundError: Recieved a File not fount error
"""
logger.info(f"Sending tftp download request to {self.host}")
logger.info(f" filename -> {self.file_to_transfer}")
logger.info(f" options -> {self.options}")
self.metrics.start_time = time.time()
logger.debug(f"Set metrics.start_time to {self.metrics.start_time}")
pkt = types.ReadRQ()
pkt.filename = self.file_to_transfer
pkt.mode = self.mode
pkt.options = self.options
self.send(pkt)
self.state = SentReadRQ(self)
while self.state:
try:
logger.debug(f"State is {self.state}")
self.cycle()
except TftpTimeout as err:
logger.error(str(err))
self.retry_count += 1
if self.retry_count >= TIMEOUT_RETRIES:
logger.debug("hit max retries, giving up")
raise TftpTimeout("Max retries reached")
else:
logger.warning("resending last packet")
self.state.resend_last()
except TftpFileNotFoundError as err:
# If we received file not found, then we should not save the open
# output file or we'll be left with a size zero file. Delete it,
# if it exists.
logger.error("Received File not found error")
if self.fileobj is not None and not self.filelike_fileobj and os.path.exists(self.fileobj.name):
logger.debug(f"unlinking output file of {self.fileobj.name}")
os.unlink(self.fileobj.name)
raise TftpFileNotFoundError(err)
def end(self) -> None:
"""Finish up the context."""
super().end(not self.filelike_fileobj)
self.metrics.end_time = time.time()
logger.debug(f"Set metrics.end_time to {self.metrics.end_time}")
self.metrics.compute() | [
11748,
18931,
201,
198,
11748,
28686,
201,
198,
11748,
25064,
201,
198,
11748,
640,
201,
198,
201,
198,
6738,
19720,
1330,
4479,
201,
198,
6738,
33245,
1330,
314,
9864,
589,
201,
198,
201,
198,
6738,
764,
8692,
1330,
20985,
201,
198,
6738,
256,
701,
9078,
13,
28710,
1330,
20460,
12425,
62,
2200,
5446,
11015,
201,
198,
6738,
256,
701,
9078,
13,
8002,
316,
1330,
3858,
201,
198,
6738,
256,
701,
9078,
13,
1069,
11755,
1330,
309,
701,
79,
16922,
11,
51,
701,
79,
48031,
11,
51,
701,
79,
8979,
3673,
21077,
12331,
201,
198,
6738,
256,
701,
9078,
13,
27219,
1330,
11352,
5569,
49,
48,
11,
31837,
16594,
49,
48,
201,
198,
201,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
10786,
83,
701,
9078,
13,
22866,
13,
16366,
11537,
201,
198,
201,
198,
4871,
36803,
7,
11792,
2599,
201,
198,
220,
220,
220,
37227,
464,
9516,
4732,
329,
262,
5456,
1141,
281,
9516,
13,
201,
198,
220,
220,
220,
5740,
25,
1002,
5128,
318,
257,
5328,
831,
11,
788,
356,
481,
779,
14367,
259,
526,
15931,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2583,
25,
965,
11,
2493,
25,
493,
11,
26827,
25,
493,
11,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
25,
4479,
58,
9399,
14881,
11,
2536,
4357,
12429,
46265,
22046,
8,
4613,
6045,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
41592,
4732,
329,
33794,
1366,
284,
257,
4382,
13,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2583,
357,
2536,
2599,
9652,
17917,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2493,
357,
600,
2599,
9652,
4347,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26827,
357,
600,
2599,
17802,
26827,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
29565,
9399,
14881,
11,
2536,
60,
2599,
23412,
1366,
11,
460,
307,
530,
286,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
1052,
1280,
2393,
2134,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
317,
3108,
284,
257,
2393,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
257,
705,
19355,
12739,
1100,
422,
48571,
1268,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
834,
15003,
834,
7,
4774,
11,
2493,
11,
26827,
11,
12429,
46265,
22046,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
262,
5128,
2134,
468,
257,
1100,
3419,
2163,
11,
7048,
340,
318,
2393,
12,
2339,
13,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
35226,
7,
15414,
11,
705,
961,
6,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
26801,
796,
5128,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
5128,
6624,
705,
12,
10354,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
26801,
796,
25064,
13,
19282,
259,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
26801,
796,
1280,
7,
15414,
11,
366,
26145,
4943,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7203,
83,
701,
9078,
13,
22866,
13,
16366,
13,
25850,
13,
834,
15003,
834,
3419,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
2393,
62,
1462,
62,
39437,
796,
1391,
944,
13,
7753,
62,
1462,
62,
39437,
5512,
3689,
796,
1391,
944,
13,
25811,
92,
4943,
201,
198,
201,
198,
220,
220,
220,
825,
923,
7,
944,
8,
4613,
6045,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13383,
9052,
284,
1100,
1366,
287,
290,
3758,
2393,
284,
262,
4382,
526,
15931,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7,
69,
1,
50,
1571,
256,
701,
79,
9516,
2581,
284,
1391,
944,
13,
4774,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7,
69,
1,
220,
220,
220,
29472,
4613,
1391,
944,
13,
7753,
62,
1462,
62,
39437,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7,
69,
1,
220,
220,
220,
3689,
4613,
1391,
944,
13,
25811,
92,
4943,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4164,
10466,
13,
9688,
62,
2435,
796,
640,
13,
2435,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
7248,
20731,
13,
9688,
62,
2435,
284,
1391,
944,
13,
4164,
10466,
13,
9688,
62,
2435,
92,
4943,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
796,
3858,
13,
16594,
49,
48,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
13,
34345,
796,
2116,
13,
7753,
62,
1462,
62,
39437,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
13,
14171,
796,
2116,
13,
14171,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
13,
25811,
796,
2116,
13,
25811,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21280,
7,
79,
21841,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
5219,
796,
11352,
16594,
49,
48,
7,
944,
8,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
981,
2116,
13,
5219,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
9012,
318,
1391,
944,
13,
5219,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
13696,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
309,
701,
79,
48031,
355,
11454,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7,
2536,
7,
8056,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1186,
563,
62,
9127,
15853,
352,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
1186,
563,
62,
9127,
18189,
20460,
12425,
62,
2200,
5446,
11015,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7203,
17945,
3509,
1005,
1678,
11,
3501,
510,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
43917,
7203,
411,
1571,
938,
19638,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
5219,
13,
411,
437,
62,
12957,
3419,
201,
198,
201,
198,
220,
220,
220,
825,
886,
7,
944,
11,
1635,
22046,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
48658,
510,
262,
4732,
526,
15931,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
437,
3419,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4164,
10466,
13,
437,
62,
2435,
796,
640,
13,
2435,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
7248,
20731,
13,
437,
62,
2435,
284,
1391,
944,
13,
4164,
10466,
13,
437,
62,
2435,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4164,
10466,
13,
5589,
1133,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
201,
198,
4871,
10472,
7,
11792,
2599,
201,
198,
220,
220,
220,
37227,
464,
4321,
4732,
329,
262,
5456,
1141,
257,
4321,
13,
201,
198,
220,
220,
220,
5740,
25,
1002,
5072,
318,
257,
5328,
831,
11,
788,
262,
5072,
481,
307,
1908,
284,
14367,
448,
526,
15931,
201,
198,
220,
220,
220,
220,
201,
198,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2583,
25,
965,
11,
2493,
25,
493,
11,
26827,
25,
493,
11,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
25,
4479,
58,
9399,
14881,
11,
2536,
4357,
12429,
46265,
22046,
8,
4613,
6045,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
818,
1287,
1096,
262,
10472,
4732,
351,
262,
4382,
290,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
810,
284,
3613,
262,
1366,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2583,
357,
2536,
2599,
9652,
17917,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2493,
357,
600,
2599,
9652,
2493,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26827,
357,
600,
2599,
47068,
3862,
448,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
357,
38176,
58,
9399,
14881,
11,
2536,
60,
2599,
25235,
1366,
11,
460,
307,
530,
286,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
1052,
1280,
2393,
2134,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
317,
3108,
284,
257,
2393,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
705,
19355,
12739,
3551,
284,
48571,
12425,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
7567,
2696,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
701,
79,
16922,
25,
5906,
284,
1280,
262,
2244,
3920,
2393,
329,
3597,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
834,
15003,
834,
7,
4774,
11,
2493,
11,
26827,
11,
12429,
46265,
22046,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
2339,
62,
7753,
26801,
796,
10352,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
262,
5072,
2134,
468,
257,
3551,
3419,
2163,
11,
7048,
340,
318,
2393,
12,
2339,
13,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
35226,
7,
22915,
11,
705,
13564,
6,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
26801,
796,
5072,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
2339,
62,
7753,
26801,
796,
6407,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
262,
5072,
29472,
318,
532,
11,
788,
779,
14367,
448,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
5072,
6624,
705,
12,
10354,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
26801,
796,
25064,
13,
19282,
448,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
2339,
62,
7753,
26801,
796,
6407,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7753,
26801,
796,
1280,
7,
22915,
11,
366,
39346,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
440,
5188,
81,
1472,
355,
11454,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
309,
701,
79,
16922,
7203,
23722,
407,
1280,
5072,
2393,
1600,
11454,
8,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7203,
83,
701,
9078,
13,
22866,
13,
16366,
13,
10002,
13,
834,
15003,
834,
3419,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
2393,
62,
1462,
62,
39437,
796,
1391,
944,
13,
7753,
62,
1462,
62,
39437,
5512,
3689,
796,
1391,
944,
13,
25811,
92,
4943,
201,
198,
201,
198,
220,
220,
220,
825,
923,
7,
944,
8,
4613,
6045,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
818,
8846,
378,
262,
4321,
13,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
7567,
2696,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
701,
79,
48031,
25,
22738,
284,
2018,
284,
262,
4382,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
701,
79,
8979,
3673,
21077,
12331,
25,
3311,
39591,
257,
9220,
407,
277,
608,
4049,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7,
69,
1,
50,
1571,
256,
701,
79,
4321,
2581,
284,
1391,
944,
13,
4774,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7,
69,
1,
220,
220,
220,
29472,
4613,
1391,
944,
13,
7753,
62,
1462,
62,
39437,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
10951,
7,
69,
1,
220,
220,
220,
3689,
4613,
1391,
944,
13,
25811,
92,
4943,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4164,
10466,
13,
9688,
62,
2435,
796,
640,
13,
2435,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
7248,
20731,
13,
9688,
62,
2435,
284,
1391,
944,
13,
4164,
10466,
13,
9688,
62,
2435,
92,
4943,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
796,
3858,
13,
5569,
49,
48,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
13,
34345,
796,
2116,
13,
7753,
62,
1462,
62,
39437,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
13,
14171,
796,
2116,
13,
14171,
201,
198,
220,
220,
220,
220,
220,
220,
220,
279,
21841,
13,
25811,
796,
2116,
13,
25811,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21280,
7,
79,
21841,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
5219,
796,
11352,
5569,
49,
48,
7,
944,
8,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
981,
2116,
13,
5219,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
9012,
318,
1391,
944,
13,
5219,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
13696,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
309,
701,
79,
48031,
355,
11454,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7,
2536,
7,
8056,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1186,
563,
62,
9127,
15853,
352,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
1186,
563,
62,
9127,
18189,
20460,
12425,
62,
2200,
5446,
11015,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7203,
17945,
3509,
1005,
1678,
11,
3501,
510,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
309,
701,
79,
48031,
7203,
11518,
1005,
1678,
4251,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
43917,
7203,
411,
1571,
938,
19638,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
5219,
13,
411,
437,
62,
12957,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
309,
701,
79,
8979,
3673,
21077,
12331,
355,
11454,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
356,
2722,
2393,
407,
1043,
11,
788,
356,
815,
407,
3613,
262,
1280,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
5072,
2393,
393,
356,
1183,
307,
1364,
351,
257,
2546,
6632,
2393,
13,
23520,
340,
11,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
340,
7160,
13,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
18224,
7203,
3041,
6471,
9220,
407,
1043,
4049,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
7753,
26801,
318,
407,
6045,
290,
407,
2116,
13,
7753,
2339,
62,
7753,
26801,
290,
28686,
13,
6978,
13,
1069,
1023,
7,
944,
13,
7753,
26801,
13,
3672,
2599,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
403,
75,
8040,
5072,
2393,
286,
1391,
944,
13,
7753,
26801,
13,
3672,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
403,
8726,
7,
944,
13,
7753,
26801,
13,
3672,
8,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
309,
701,
79,
8979,
3673,
21077,
12331,
7,
8056,
8,
201,
198,
201,
198,
220,
220,
220,
825,
886,
7,
944,
8,
4613,
6045,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
48658,
510,
262,
4732,
526,
15931,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
437,
7,
1662,
2116,
13,
7753,
2339,
62,
7753,
26801,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4164,
10466,
13,
437,
62,
2435,
796,
640,
13,
2435,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7,
69,
1,
7248,
20731,
13,
437,
62,
2435,
284,
1391,
944,
13,
4164,
10466,
13,
437,
62,
2435,
92,
4943,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4164,
10466,
13,
5589,
1133,
3419
] | 2.016208 | 3,455 |
import importlib
max_steps = 1000
terminate_prob = 0.998
batch_size = 5
gameEnv = importlib.import_module('coin_game_v')
env = gameEnv.gameEnv(terminate_prob=terminate_prob, max_steps=max_steps, batch_size=batch_size)
print('state_space', env.state_space)
print('red_pos', env.red_pos)
print('blue_pos', env.blue_pos)
print('red_coin', env.red_coin)
print('coin_pos', env.coin_pos)
# test red agent picks up red coin
env.red_coin = [1, 1, 1, 1, 1]
env.red_pos = ( env.coin_pos - env.actions[1] ) % env.grid_size
state, reward, done = env.step(actions=[[1,1], [1,1], [1,1], [1,1], [1,1]])
print('red_pos', env.red_pos)
print('blue_pos', env.blue_pos)
print('red_coin', env.red_coin)
print('coin_pos', env.coin_pos)
print('reward', reward)
print('state', state)
# # test red agent picks up blue coin
# env.red_coin = 0
# env.red_pos = ( env.coin_pos - env.actions[1] ) % env.grid_size
# _, reward, done = env.step(action=1, agent='red')
# print('red_pos', env.red_pos)
# print('blue_pos', env.blue_pos)
# print('red_coin', env.red_coin)
# print('coin_pos', env.coin_pos)
# print('reward', reward)
# # test blue agent picks up red coin
# env.red_coin = 1
# env.blue_pos = ( env.coin_pos - env.actions[1] ) % env.grid_size
# _, reward, done = env.step(action=1, agent='blue')
# print('red_pos', env.red_pos)
# print('blue_pos', env.blue_pos)
# print('red_coin', env.red_coin)
# print('coin_pos', env.coin_pos)
# print('reward', reward)
# # test blue agent picks up blue coin
# env.red_coin = 0
# env.blue_pos = ( env.coin_pos - env.actions[1] ) % env.grid_size
# _, reward, done = env.step(action=1, agent='blue')
# print('red_pos', env.red_pos)
# print('blue_pos', env.blue_pos)
# print('red_coin', env.red_coin)
# print('coin_pos', env.coin_pos)
# print('reward', reward)
| [
11748,
1330,
8019,
198,
198,
9806,
62,
20214,
796,
8576,
198,
23705,
378,
62,
1676,
65,
796,
657,
13,
34808,
198,
43501,
62,
7857,
796,
642,
198,
6057,
4834,
85,
796,
1330,
8019,
13,
11748,
62,
21412,
10786,
3630,
62,
6057,
62,
85,
11537,
198,
24330,
796,
983,
4834,
85,
13,
6057,
4834,
85,
7,
23705,
378,
62,
1676,
65,
28,
23705,
378,
62,
1676,
65,
11,
3509,
62,
20214,
28,
9806,
62,
20214,
11,
15458,
62,
7857,
28,
43501,
62,
7857,
8,
198,
198,
4798,
10786,
5219,
62,
13200,
3256,
17365,
13,
5219,
62,
13200,
8,
198,
4798,
10786,
445,
62,
1930,
3256,
17365,
13,
445,
62,
1930,
8,
198,
4798,
10786,
17585,
62,
1930,
3256,
17365,
13,
17585,
62,
1930,
8,
198,
4798,
10786,
445,
62,
3630,
3256,
17365,
13,
445,
62,
3630,
8,
198,
4798,
10786,
3630,
62,
1930,
3256,
17365,
13,
3630,
62,
1930,
8,
628,
198,
2,
1332,
2266,
5797,
11103,
510,
2266,
10752,
198,
24330,
13,
445,
62,
3630,
796,
685,
16,
11,
352,
11,
352,
11,
352,
11,
352,
60,
198,
24330,
13,
445,
62,
1930,
796,
357,
17365,
13,
3630,
62,
1930,
532,
17365,
13,
4658,
58,
16,
60,
1267,
4064,
17365,
13,
25928,
62,
7857,
198,
5219,
11,
6721,
11,
1760,
796,
17365,
13,
9662,
7,
4658,
28,
30109,
16,
11,
16,
4357,
685,
16,
11,
16,
4357,
685,
16,
11,
16,
4357,
685,
16,
11,
16,
4357,
685,
16,
11,
16,
11907,
8,
198,
4798,
10786,
445,
62,
1930,
3256,
17365,
13,
445,
62,
1930,
8,
198,
4798,
10786,
17585,
62,
1930,
3256,
17365,
13,
17585,
62,
1930,
8,
198,
4798,
10786,
445,
62,
3630,
3256,
17365,
13,
445,
62,
3630,
8,
198,
4798,
10786,
3630,
62,
1930,
3256,
17365,
13,
3630,
62,
1930,
8,
198,
4798,
10786,
260,
904,
3256,
6721,
8,
198,
4798,
10786,
5219,
3256,
1181,
8,
628,
198,
2,
1303,
1332,
2266,
5797,
11103,
510,
4171,
10752,
198,
2,
17365,
13,
445,
62,
3630,
796,
657,
198,
2,
17365,
13,
445,
62,
1930,
796,
357,
17365,
13,
3630,
62,
1930,
532,
17365,
13,
4658,
58,
16,
60,
1267,
4064,
17365,
13,
25928,
62,
7857,
198,
2,
4808,
11,
6721,
11,
1760,
796,
17365,
13,
9662,
7,
2673,
28,
16,
11,
5797,
11639,
445,
11537,
198,
2,
3601,
10786,
445,
62,
1930,
3256,
17365,
13,
445,
62,
1930,
8,
198,
2,
3601,
10786,
17585,
62,
1930,
3256,
17365,
13,
17585,
62,
1930,
8,
198,
2,
3601,
10786,
445,
62,
3630,
3256,
17365,
13,
445,
62,
3630,
8,
198,
2,
3601,
10786,
3630,
62,
1930,
3256,
17365,
13,
3630,
62,
1930,
8,
198,
2,
3601,
10786,
260,
904,
3256,
6721,
8,
198,
198,
2,
1303,
1332,
4171,
5797,
11103,
510,
2266,
10752,
198,
2,
17365,
13,
445,
62,
3630,
796,
352,
198,
2,
17365,
13,
17585,
62,
1930,
796,
357,
17365,
13,
3630,
62,
1930,
532,
17365,
13,
4658,
58,
16,
60,
1267,
4064,
17365,
13,
25928,
62,
7857,
198,
2,
4808,
11,
6721,
11,
1760,
796,
17365,
13,
9662,
7,
2673,
28,
16,
11,
5797,
11639,
17585,
11537,
198,
2,
3601,
10786,
445,
62,
1930,
3256,
17365,
13,
445,
62,
1930,
8,
198,
2,
3601,
10786,
17585,
62,
1930,
3256,
17365,
13,
17585,
62,
1930,
8,
198,
2,
3601,
10786,
445,
62,
3630,
3256,
17365,
13,
445,
62,
3630,
8,
198,
2,
3601,
10786,
3630,
62,
1930,
3256,
17365,
13,
3630,
62,
1930,
8,
198,
2,
3601,
10786,
260,
904,
3256,
6721,
8,
198,
198,
2,
1303,
1332,
4171,
5797,
11103,
510,
4171,
10752,
198,
2,
17365,
13,
445,
62,
3630,
796,
657,
198,
2,
17365,
13,
17585,
62,
1930,
796,
357,
17365,
13,
3630,
62,
1930,
532,
17365,
13,
4658,
58,
16,
60,
1267,
4064,
17365,
13,
25928,
62,
7857,
198,
2,
4808,
11,
6721,
11,
1760,
796,
17365,
13,
9662,
7,
2673,
28,
16,
11,
5797,
11639,
17585,
11537,
198,
2,
3601,
10786,
445,
62,
1930,
3256,
17365,
13,
445,
62,
1930,
8,
198,
2,
3601,
10786,
17585,
62,
1930,
3256,
17365,
13,
17585,
62,
1930,
8,
198,
2,
3601,
10786,
445,
62,
3630,
3256,
17365,
13,
445,
62,
3630,
8,
198,
2,
3601,
10786,
3630,
62,
1930,
3256,
17365,
13,
3630,
62,
1930,
8,
198,
2,
3601,
10786,
260,
904,
3256,
6721,
8,
198
] | 2.504225 | 710 |
# -*- coding: utf-8 -*-
import pygame, os
from src.sprites.MyStaticSprite import *
from src.sprites.Interactive import *
from src.ResourceManager import *
from src.scenes.stage.OnDialogueState import *
SPRITE_FILES = os.path.join("sprites", "interactives")
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
12972,
6057,
11,
28686,
198,
6738,
12351,
13,
2777,
23156,
13,
3666,
45442,
38454,
578,
1330,
1635,
198,
6738,
12351,
13,
2777,
23156,
13,
9492,
5275,
1330,
1635,
198,
6738,
12351,
13,
26198,
13511,
1330,
1635,
198,
6738,
12351,
13,
28123,
13,
14247,
13,
2202,
41099,
9012,
1330,
1635,
198,
198,
4303,
49,
12709,
62,
46700,
1546,
796,
28686,
13,
6978,
13,
22179,
7203,
2777,
23156,
1600,
366,
3849,
529,
1083,
4943,
198
] | 2.910112 | 89 |
from os import environ
from boto3 import client
import actions
from loader import Loader
ACCOUNTID = client('sts').get_caller_identity()['Account']
ARN = 'arn:aws:forecast:{region}:{account}:dataset/{name}'
LOADER = Loader()
| [
6738,
28686,
1330,
551,
2268,
198,
6738,
275,
2069,
18,
1330,
5456,
198,
11748,
4028,
198,
6738,
40213,
1330,
8778,
263,
198,
198,
26861,
28270,
2389,
796,
5456,
10786,
6448,
27691,
1136,
62,
13345,
263,
62,
738,
414,
3419,
17816,
30116,
20520,
198,
1503,
45,
796,
705,
1501,
25,
8356,
25,
754,
2701,
29164,
36996,
92,
29164,
23317,
38362,
19608,
292,
316,
14,
90,
3672,
92,
6,
198,
35613,
1137,
796,
8778,
263,
3419,
628
] | 3.026667 | 75 |
from ecpy import EllipticCurve, ExtendedFiniteField, symmetric_tate_pairing
import hashlib
import random
import cPickle
# PKI secret
secret = 0xdeadbeef
p = int("501794446334189957604282155189438160845433783392772743395579628617109"
"929160215221425142482928909270259580854362463493326988807453595748573"
"76419559953437557")
l = (p + 1) / 6
F = ExtendedFiniteField(p, "x^2+x+1")
E = EllipticCurve(F, 0, 1)
P = E(3, int("1418077311270457886139292292020587683642898636677353664354101171"
"7684401801069777797699258667061922178009879315047772033936311133"
"535564812495329881887557081"))
sP = E(int("129862491850266001914601437161941818413833907050695770313188660767"
"152646233571458109764766382285470424230719843324368007925375351295"
"39576510740045312772012"),
int("452543250979361708074026409576755302296698208397782707067096515523"
"033579018123253402743775747767548650767928190884624134827869137911"
"24188897792458334596297"))
if __name__ == "__main__":
main()
| [
6738,
9940,
9078,
1330,
7122,
10257,
291,
26628,
303,
11,
24204,
37,
9504,
15878,
11,
23606,
19482,
62,
83,
378,
62,
24874,
278,
198,
11748,
12234,
8019,
198,
11748,
4738,
198,
11748,
269,
31686,
293,
198,
198,
2,
29673,
40,
3200,
198,
21078,
796,
657,
24954,
1329,
1350,
891,
198,
198,
79,
796,
493,
7203,
33548,
3720,
2598,
3510,
31380,
1507,
2079,
3553,
31916,
32568,
18742,
1507,
5824,
2548,
1433,
2919,
34229,
2091,
3695,
29626,
27019,
28857,
29626,
2816,
41060,
27033,
1558,
14454,
1,
198,
220,
220,
220,
220,
220,
220,
220,
366,
24,
1959,
1433,
2999,
1314,
1828,
1415,
1495,
1415,
23045,
1959,
27693,
2931,
20233,
1495,
3865,
28362,
4051,
2623,
26912,
27371,
2091,
26276,
3459,
36928,
2231,
30743,
3553,
2780,
48638,
1,
198,
220,
220,
220,
220,
220,
220,
220,
366,
22,
2414,
1129,
2816,
33438,
2682,
22318,
3553,
4943,
198,
198,
75,
796,
357,
79,
1343,
352,
8,
1220,
718,
198,
198,
37,
796,
24204,
37,
9504,
15878,
7,
79,
11,
366,
87,
61,
17,
10,
87,
10,
16,
4943,
198,
36,
796,
7122,
10257,
291,
26628,
303,
7,
37,
11,
657,
11,
352,
8,
198,
198,
47,
796,
412,
7,
18,
11,
493,
7203,
1415,
1507,
2998,
22,
3132,
1065,
2154,
33032,
44980,
20219,
1959,
23539,
42334,
3365,
30610,
26780,
2078,
49087,
2623,
40179,
2327,
2623,
2414,
2327,
3901,
486,
27192,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
30610,
2598,
29159,
486,
3312,
24,
3324,
40393,
4304,
2079,
25600,
2791,
35402,
1129,
1828,
1558,
7410,
4089,
3720,
3132,
1120,
2857,
3324,
1238,
29626,
35447,
1157,
16945,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
20,
28567,
34287,
1065,
2920,
4310,
1959,
3459,
20356,
38172,
2154,
6659,
48774,
198,
82,
47,
796,
412,
7,
600,
7203,
1065,
49087,
21626,
1507,
1120,
2075,
8054,
1129,
20964,
28645,
2718,
1433,
22913,
1507,
22883,
20107,
2091,
3829,
2154,
1120,
3388,
3553,
2154,
25838,
1507,
4521,
31980,
3134,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1314,
2075,
3510,
1954,
27277,
1415,
3365,
940,
5607,
33981,
2791,
2548,
23815,
4051,
32869,
1731,
19214,
22,
28296,
2091,
1731,
2623,
7410,
3720,
1495,
22318,
2327,
1065,
3865,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2670,
3553,
2996,
940,
4524,
405,
2231,
27970,
3324,
6999,
12340,
198,
220,
220,
220,
220,
220,
220,
493,
7203,
2231,
24970,
2624,
29022,
3720,
2623,
17279,
36928,
1821,
2075,
29416,
37452,
38172,
1270,
23539,
2791,
4089,
21315,
2670,
39761,
20233,
35402,
31495,
2996,
18742,
1954,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
44427,
41734,
29159,
10163,
1495,
23601,
28857,
2718,
39251,
2857,
4304,
2425,
2780,
17544,
32059,
24,
2078,
1129,
46556,
3510,
1731,
1485,
2780,
25870,
3388,
1485,
3720,
1157,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1731,
1507,
39121,
40393,
1731,
3365,
2091,
2231,
4846,
26561,
48774,
628,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
1388,
3419,
198
] | 2.07529 | 518 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-12 20:32
from __future__ import unicode_literals
import annoying.fields
import byro.common.models.auditable
from django.db import migrations, models
import django.db.models.deletion
import localflavor.generic.models
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
1157,
13,
21,
319,
2177,
12,
940,
12,
1065,
1160,
25,
2624,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
11748,
15774,
13,
25747,
198,
11748,
416,
305,
13,
11321,
13,
27530,
13,
3885,
4674,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
198,
11748,
1179,
1604,
75,
5570,
13,
41357,
13,
27530,
628
] | 2.968421 | 95 |
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from typing import Any, Dict, List, NamedTuple, Optional
from bkuser_core.categories.plugins.ldap.models import DepartmentProfile, UserProfile
from bkuser_core.user_settings.loader import ConfigProvider
from django.utils.encoding import force_str
from ldap3.utils import dn as dn_utils
@dataclass
class ProfileFieldMapper:
"""从 ldap 对象属性中获取用户字段"""
config_loader: ConfigProvider
setting_field_map: dict
def get_field(self, user_meta: Dict[str, List[bytes]], field_name: str, raise_exception: bool = False) -> str:
"""根据字段映射关系, 从 ldap 中获取 `field_name` 的值"""
try:
setting_name = self.setting_field_map[field_name]
except KeyError:
if raise_exception:
raise ValueError("该用户字段没有在配置中有对应项,无法同步")
return ""
try:
ldap_field_name = self.config_loader[setting_name]
except KeyError:
if raise_exception:
raise ValueError(f"用户目录配置中缺失字段 {setting_name}")
return ""
try:
if user_meta[ldap_field_name]:
return force_str(user_meta[ldap_field_name][0])
return ""
except KeyError:
if raise_exception:
raise ValueError(f"搜索数据中没有对应的字段 {ldap_field_name}")
return ""
def get_user_attributes(self) -> list:
"""获取远端属性名列表"""
return [self.config_loader[x] for x in self.setting_field_map.values() if self.config_loader[x]]
class RDN(NamedTuple):
"""RelativeDistinguishedName"""
type: str
value: str
separator: str
def parse_dn_tree(dn: str, restrict_types: List[str] = None) -> List[RDN]:
"""A DN is a sequence of relative distinguished names (RDN) connected by commas, For examples:
we have a dn = "CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM", this method will parse the dn to:
>>> parse_dn_tree("CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM")
[RDN(type='CN', value='Jeff Smith', separator=','),
RDN(type='OU', value='Sales', separator=','),
RDN(type='DC', value='Fabrikam', separator=','),
RDN(type='DC', value='COM', separator='')]
if provide restrict_types, this method will ignore the attribute not in restrict_types, For examples:
>>> parse_dn_tree("CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM", restrict_types=["DC"])
[RDN(type='DC', value='Fabrikam', separator=','), RDN(type='DC', value='COM', separator='')]
Furthermore, restrict_types is Case-insensitive, the ["DC"], ["dc"], ["Dc"] are Exactly equal.
>>> parse_dn_tree("CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM", restrict_types=["dc"])
[RDN(type='DC', value='Fabrikam', separator=','), RDN(type='DC', value='COM', separator='')]
See Also: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ldap/distinguished-names
"""
restrict_types = [type_.upper() for type_ in (restrict_types or [])]
items = dn_utils.parse_dn(dn, escape=True)
if restrict_types:
parts = [RDN(*i) for i in items if i[0].upper() in restrict_types]
else:
parts = [RDN(*i) for i in items]
return parts
def parse_dn_value_list(dn: str, restrict_types: List[str] = None) -> List[str]:
"""this method work like parse_dn_tree, be only return values of those attributes, For examples:
>>> parse_dn_value_list("CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM")
['Jeff Smith', 'Sales', 'Fabrikam', 'COM']
if provide restrict_types, this method will ignore the attribute not in restrict_types, For examples:
>>> parse_dn_value_list("CN=Jeff Smith,OU=Sales,DC=Fabrikam,DC=COM", restrict_types=["DC"])
['Fabrikam', 'COM']
"""
tree = parse_dn_tree(dn, restrict_types)
parts = []
for part in tree:
parts.append(part.value)
return parts
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
198,
6738,
19720,
1330,
4377,
11,
360,
713,
11,
7343,
11,
34441,
51,
29291,
11,
32233,
198,
198,
6738,
275,
74,
7220,
62,
7295,
13,
66,
26129,
13,
37390,
13,
335,
499,
13,
27530,
1330,
2732,
37046,
11,
11787,
37046,
198,
6738,
275,
74,
7220,
62,
7295,
13,
7220,
62,
33692,
13,
29356,
1330,
17056,
29495,
198,
6738,
42625,
14208,
13,
26791,
13,
12685,
7656,
1330,
2700,
62,
2536,
198,
6738,
300,
67,
499,
18,
13,
26791,
1330,
288,
77,
355,
288,
77,
62,
26791,
628,
198,
31,
19608,
330,
31172,
198,
4871,
13118,
15878,
44,
11463,
25,
198,
220,
220,
220,
37227,
20015,
236,
300,
67,
499,
10263,
107,
117,
164,
109,
94,
161,
109,
252,
45250,
100,
40792,
164,
236,
115,
20998,
244,
18796,
101,
22755,
115,
27764,
245,
162,
106,
113,
37811,
628,
220,
220,
220,
4566,
62,
29356,
25,
17056,
29495,
198,
220,
220,
220,
4634,
62,
3245,
62,
8899,
25,
8633,
628,
220,
220,
220,
825,
651,
62,
3245,
7,
944,
11,
2836,
62,
28961,
25,
360,
713,
58,
2536,
11,
7343,
58,
33661,
60,
4357,
2214,
62,
3672,
25,
965,
11,
5298,
62,
1069,
4516,
25,
20512,
796,
10352,
8,
4613,
965,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
43718,
117,
162,
235,
106,
27764,
245,
162,
106,
113,
23626,
254,
22887,
226,
17739,
111,
163,
111,
119,
11,
220,
20015,
236,
300,
67,
499,
220,
40792,
164,
236,
115,
20998,
244,
4600,
3245,
62,
3672,
63,
13328,
248,
226,
161,
222,
120,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4634,
62,
3672,
796,
2116,
13,
33990,
62,
3245,
62,
8899,
58,
3245,
62,
3672,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
7383,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
5298,
62,
1069,
4516,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7203,
46237,
98,
18796,
101,
22755,
115,
27764,
245,
162,
106,
113,
162,
110,
94,
17312,
231,
28839,
101,
165,
227,
235,
163,
121,
106,
40792,
17312,
231,
43380,
117,
41753,
242,
165,
94,
117,
171,
120,
234,
33768,
254,
37345,
243,
28938,
234,
29826,
98,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
13538,
628,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
67,
499,
62,
3245,
62,
3672,
796,
2116,
13,
11250,
62,
29356,
58,
33990,
62,
3672,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
7383,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
5298,
62,
1069,
4516,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
69,
1,
18796,
101,
22755,
115,
33566,
106,
37605,
243,
165,
227,
235,
163,
121,
106,
40792,
163,
120,
118,
13783,
109,
27764,
245,
162,
106,
113,
1391,
33990,
62,
3672,
92,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
13538,
628,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2836,
62,
28961,
58,
335,
499,
62,
3245,
62,
3672,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2700,
62,
2536,
7,
7220,
62,
28961,
58,
335,
499,
62,
3245,
62,
3672,
7131,
15,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
13538,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
7383,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
5298,
62,
1069,
4516,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7,
69,
1,
162,
238,
250,
163,
112,
95,
46763,
108,
162,
235,
106,
40792,
162,
110,
94,
17312,
231,
43380,
117,
41753,
242,
21410,
27764,
245,
162,
106,
113,
1391,
335,
499,
62,
3245,
62,
3672,
92,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
13538,
628,
220,
220,
220,
825,
651,
62,
7220,
62,
1078,
7657,
7,
944,
8,
4613,
1351,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
164,
236,
115,
20998,
244,
32573,
250,
44165,
107,
161,
109,
252,
45250,
100,
28938,
235,
26344,
245,
26193,
101,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
685,
944,
13,
11250,
62,
29356,
58,
87,
60,
329,
2124,
287,
2116,
13,
33990,
62,
3245,
62,
8899,
13,
27160,
3419,
611,
2116,
13,
11250,
62,
29356,
58,
87,
11907,
628,
628,
198,
4871,
31475,
45,
7,
45,
2434,
51,
29291,
2599,
198,
220,
220,
220,
37227,
6892,
876,
20344,
46709,
5376,
37811,
628,
220,
220,
220,
2099,
25,
965,
198,
220,
220,
220,
1988,
25,
965,
198,
220,
220,
220,
2880,
1352,
25,
965,
628,
198,
4299,
21136,
62,
32656,
62,
21048,
7,
32656,
25,
965,
11,
4239,
62,
19199,
25,
7343,
58,
2536,
60,
796,
6045,
8,
4613,
7343,
58,
35257,
45,
5974,
198,
220,
220,
220,
37227,
32,
45080,
318,
257,
8379,
286,
3585,
18876,
3891,
357,
35257,
45,
8,
5884,
416,
725,
292,
11,
1114,
6096,
25,
628,
220,
220,
220,
356,
423,
257,
288,
77,
796,
366,
44175,
28,
19139,
4176,
11,
2606,
28,
44490,
11,
9697,
28,
43957,
12602,
321,
11,
9697,
28,
9858,
1600,
428,
2446,
481,
21136,
262,
288,
77,
284,
25,
198,
220,
220,
220,
13163,
21136,
62,
32656,
62,
21048,
7203,
44175,
28,
19139,
4176,
11,
2606,
28,
44490,
11,
9697,
28,
43957,
12602,
321,
11,
9697,
28,
9858,
4943,
198,
220,
220,
220,
685,
35257,
45,
7,
4906,
11639,
44175,
3256,
1988,
11639,
19139,
4176,
3256,
2880,
1352,
28,
3256,
33809,
198,
220,
220,
220,
220,
31475,
45,
7,
4906,
11639,
2606,
3256,
1988,
11639,
44490,
3256,
2880,
1352,
28,
3256,
33809,
198,
220,
220,
220,
220,
31475,
45,
7,
4906,
11639,
9697,
3256,
1988,
11639,
43957,
12602,
321,
3256,
2880,
1352,
28,
3256,
33809,
198,
220,
220,
220,
220,
31475,
45,
7,
4906,
11639,
9697,
3256,
1988,
11639,
9858,
3256,
2880,
1352,
28,
7061,
15437,
628,
220,
220,
220,
611,
2148,
4239,
62,
19199,
11,
428,
2446,
481,
8856,
262,
11688,
407,
287,
4239,
62,
19199,
11,
1114,
6096,
25,
198,
220,
220,
220,
13163,
21136,
62,
32656,
62,
21048,
7203,
44175,
28,
19139,
4176,
11,
2606,
28,
44490,
11,
9697,
28,
43957,
12602,
321,
11,
9697,
28,
9858,
1600,
4239,
62,
19199,
28,
14692,
9697,
8973,
8,
198,
220,
220,
220,
685,
35257,
45,
7,
4906,
11639,
9697,
3256,
1988,
11639,
43957,
12602,
321,
3256,
2880,
1352,
28,
3256,
33809,
31475,
45,
7,
4906,
11639,
9697,
3256,
1988,
11639,
9858,
3256,
2880,
1352,
28,
7061,
15437,
628,
220,
220,
220,
11399,
11,
4239,
62,
19199,
318,
8913,
12,
1040,
18464,
11,
262,
14631,
9697,
33116,
14631,
17896,
33116,
14631,
35,
66,
8973,
389,
36819,
4961,
13,
198,
220,
220,
220,
13163,
21136,
62,
32656,
62,
21048,
7203,
44175,
28,
19139,
4176,
11,
2606,
28,
44490,
11,
9697,
28,
43957,
12602,
321,
11,
9697,
28,
9858,
1600,
4239,
62,
19199,
28,
14692,
17896,
8973,
8,
198,
220,
220,
220,
685,
35257,
45,
7,
4906,
11639,
9697,
3256,
1988,
11639,
43957,
12602,
321,
3256,
2880,
1352,
28,
3256,
33809,
31475,
45,
7,
4906,
11639,
9697,
3256,
1988,
11639,
9858,
3256,
2880,
1352,
28,
7061,
15437,
628,
220,
220,
220,
4091,
4418,
25,
3740,
1378,
31628,
13,
40485,
13,
785,
14,
268,
12,
385,
14,
3866,
1442,
12,
47178,
14,
28457,
14,
41375,
14,
335,
499,
14,
17080,
46709,
12,
14933,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4239,
62,
19199,
796,
685,
4906,
44807,
45828,
3419,
329,
2099,
62,
287,
357,
2118,
2012,
62,
19199,
393,
685,
12962,
60,
198,
220,
220,
220,
3709,
796,
288,
77,
62,
26791,
13,
29572,
62,
32656,
7,
32656,
11,
6654,
28,
17821,
8,
628,
220,
220,
220,
611,
4239,
62,
19199,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3354,
796,
685,
35257,
45,
46491,
72,
8,
329,
1312,
287,
3709,
611,
1312,
58,
15,
4083,
45828,
3419,
287,
4239,
62,
19199,
60,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3354,
796,
685,
35257,
45,
46491,
72,
8,
329,
1312,
287,
3709,
60,
628,
220,
220,
220,
1441,
3354,
628,
198,
4299,
21136,
62,
32656,
62,
8367,
62,
4868,
7,
32656,
25,
965,
11,
4239,
62,
19199,
25,
7343,
58,
2536,
60,
796,
6045,
8,
4613,
7343,
58,
2536,
5974,
198,
220,
220,
220,
37227,
5661,
2446,
670,
588,
21136,
62,
32656,
62,
21048,
11,
307,
691,
1441,
3815,
286,
883,
12608,
11,
1114,
6096,
25,
628,
220,
220,
220,
13163,
21136,
62,
32656,
62,
8367,
62,
4868,
7203,
44175,
28,
19139,
4176,
11,
2606,
28,
44490,
11,
9697,
28,
43957,
12602,
321,
11,
9697,
28,
9858,
4943,
198,
220,
220,
220,
37250,
19139,
4176,
3256,
705,
44490,
3256,
705,
43957,
12602,
321,
3256,
705,
9858,
20520,
628,
220,
220,
220,
611,
2148,
4239,
62,
19199,
11,
428,
2446,
481,
8856,
262,
11688,
407,
287,
4239,
62,
19199,
11,
1114,
6096,
25,
198,
220,
220,
220,
13163,
21136,
62,
32656,
62,
8367,
62,
4868,
7203,
44175,
28,
19139,
4176,
11,
2606,
28,
44490,
11,
9697,
28,
43957,
12602,
321,
11,
9697,
28,
9858,
1600,
4239,
62,
19199,
28,
14692,
9697,
8973,
8,
198,
220,
220,
220,
37250,
43957,
12602,
321,
3256,
705,
9858,
20520,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
5509,
796,
21136,
62,
32656,
62,
21048,
7,
32656,
11,
4239,
62,
19199,
8,
198,
220,
220,
220,
3354,
796,
17635,
198,
220,
220,
220,
329,
636,
287,
5509,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3354,
13,
33295,
7,
3911,
13,
8367,
8,
198,
220,
220,
220,
1441,
3354,
198
] | 2.262757 | 1,705 |
# IMPORTS
# DATA
data = []
with open("Data - Day04.txt") as file:
for line in file:
data.append(line.strip().split(" "))
# GOAL 1
"""
A new system policy has been put in place that requires all accounts to use a passphrase
instead of simply a password.
A passphrase consists of a series of words (lowercase letters) separated by spaces.
To ensure security, a valid passphrase must contain no duplicate words.
The system's full passphrase list is available as your puzzle input. How many passphrases are valid?
"""
# ANSWER 1
data_sets = []
for phrase in data:
data_sets.append(set(phrase))
num_valid = 0
for i in range(len(data)):
if len(data[i]) == len(data_sets[i]):
num_valid += 1
print(f"Answer 4a: {num_valid}")
# GOAL 2
"""
For added security, yet another system policy has been put in place.
Now, a valid passphrase must contain no two words that are anagrams of each other - that is,
a passphrase is invalid if any word's letters can be rearranged to form any other word in the passphrase.
"""
sorted_data = []
sorted_data_sets = []
for i in data:
new_i = is_anagram(i)
sorted_data.append(new_i)
sorted_data_sets.append(set(new_i))
num_valid_b = 0
for i in range(len(sorted_data)):
if len(sorted_data[i]) == len(sorted_data_sets[i]):
num_valid_b += 1
print(f"Answer 4b: {num_valid_b}") | [
2,
30023,
33002,
198,
198,
2,
42865,
198,
7890,
796,
17635,
198,
4480,
1280,
7203,
6601,
532,
3596,
3023,
13,
14116,
4943,
355,
2393,
25,
198,
220,
220,
220,
329,
1627,
287,
2393,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
13,
33295,
7,
1370,
13,
36311,
22446,
35312,
7203,
366,
4008,
198,
198,
2,
10351,
1847,
352,
198,
37811,
198,
32,
649,
1080,
2450,
468,
587,
1234,
287,
1295,
326,
4433,
477,
5504,
284,
779,
257,
1208,
34675,
220,
198,
38070,
286,
2391,
257,
9206,
13,
220,
198,
32,
1208,
34675,
10874,
286,
257,
2168,
286,
2456,
357,
21037,
7442,
7475,
8,
11266,
416,
9029,
13,
198,
198,
2514,
4155,
2324,
11,
257,
4938,
1208,
34675,
1276,
3994,
645,
23418,
2456,
13,
198,
198,
464,
1080,
338,
1336,
1208,
34675,
1351,
318,
1695,
355,
534,
15027,
5128,
13,
1374,
867,
1208,
746,
81,
1386,
389,
4938,
30,
198,
37811,
198,
198,
2,
3537,
17887,
1137,
352,
198,
7890,
62,
28709,
796,
17635,
198,
1640,
9546,
287,
1366,
25,
198,
220,
220,
220,
1366,
62,
28709,
13,
33295,
7,
2617,
7,
34675,
4008,
198,
198,
22510,
62,
12102,
796,
657,
198,
1640,
1312,
287,
2837,
7,
11925,
7,
7890,
8,
2599,
198,
220,
220,
220,
611,
18896,
7,
7890,
58,
72,
12962,
6624,
18896,
7,
7890,
62,
28709,
58,
72,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
997,
62,
12102,
15853,
352,
198,
198,
4798,
7,
69,
1,
33706,
604,
64,
25,
1391,
22510,
62,
12102,
92,
4943,
198,
198,
2,
10351,
1847,
362,
198,
37811,
198,
1890,
2087,
2324,
11,
1865,
1194,
1080,
2450,
468,
587,
1234,
287,
1295,
13,
220,
198,
3844,
11,
257,
4938,
1208,
34675,
1276,
3994,
645,
734,
2456,
326,
389,
281,
6713,
82,
286,
1123,
584,
532,
326,
318,
11,
220,
198,
64,
1208,
34675,
318,
12515,
611,
597,
1573,
338,
7475,
460,
307,
37825,
5102,
284,
1296,
597,
584,
1573,
287,
262,
1208,
34675,
13,
198,
37811,
198,
198,
82,
9741,
62,
7890,
796,
17635,
198,
82,
9741,
62,
7890,
62,
28709,
796,
17635,
198,
1640,
1312,
287,
1366,
25,
198,
220,
220,
220,
649,
62,
72,
796,
318,
62,
272,
6713,
7,
72,
8,
198,
220,
220,
220,
23243,
62,
7890,
13,
33295,
7,
3605,
62,
72,
8,
198,
220,
220,
220,
23243,
62,
7890,
62,
28709,
13,
33295,
7,
2617,
7,
3605,
62,
72,
4008,
628,
198,
22510,
62,
12102,
62,
65,
796,
657,
198,
1640,
1312,
287,
2837,
7,
11925,
7,
82,
9741,
62,
7890,
8,
2599,
198,
220,
220,
220,
611,
18896,
7,
82,
9741,
62,
7890,
58,
72,
12962,
6624,
18896,
7,
82,
9741,
62,
7890,
62,
28709,
58,
72,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
997,
62,
12102,
62,
65,
15853,
352,
198,
198,
4798,
7,
69,
1,
33706,
604,
65,
25,
1391,
22510,
62,
12102,
62,
65,
92,
4943
] | 2.823651 | 482 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import unittest
from azure.cli.core.auth.adal_authentication import _normalize_expires_on
if __name__ == '__main__':
unittest.main()
| [
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,
555,
715,
395,
198,
198,
6738,
35560,
495,
13,
44506,
13,
7295,
13,
18439,
13,
31682,
62,
41299,
3299,
1330,
4808,
11265,
1096,
62,
11201,
2387,
62,
261,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 5.020619 | 97 |
#! /usr/bin/env python
"""
An implementation of Vanilla Policy Gradient (VPG) for solo_escape_task
VPG is a model free, on policy, reinforcement learning algorithm (https://papers.nips.cc/paper/1713-policy-gradient-methods-for-reinforcement-learning-with-function-approximation.pdf)
Author: LinZHanK ([email protected])
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import time
from datetime import datetime
import numpy as np
import tensorflow as tf
import rospy
from envs.solo_escape_task_env import SoloEscapeEnv
from utils import data_utils, solo_utils, tf_utils
from utils.data_utils import bcolors
from agents.vpg import VPGAgent
if __name__ == "__main__":
# create argument parser
args = data_utils.get_args()
# start timing training
rospy.init_node("solo_escape_dqn", anonymous=True, log_level=rospy.INFO)
# make an instance from env class
env = SoloEscapeEnv()
env.reset()
agent_params = {}
train_params = {}
# agent parameters
agent_params["dim_state"] = len(solo_utils.obs_to_state(env.observation))
agent_params["actions"] = np.array([np.array([1, -1]), np.array([1, 1])])
agent_params["layer_sizes"] = args.layer_sizes
agent_params["learning_rate"] = args.learning_rate
# training params
if args.datetime:
train_params["datetime"] = args.datetime
else:
train_params["datetime"] = datetime.now().strftime("%Y-%m-%d-%H-%M")
train_params["num_epochs"] = args.num_epochs
train_params["num_steps"] = args.num_steps
train_params["time_bonus"] = -1./train_params['num_steps']
train_params["success_bonus"] = 0
train_params["wall_bonus"] = -10./train_params["num_steps"]
train_params["door_bonus"] = 0
train_params["sample_size"] = args.sample_size
# instantiate agent
agent = VPGAgent(agent_params)
# specify model path
model_path = os.path.dirname(sys.path[0])+"/saved_models/solo_escape/vpg/"+train_params["datetime"]+"/agent/model.h5"
update_counter = 0
episodic_returns = []
episode = 0
step = 0
start_time = time.time()
for ep in range(train_params['num_epochs']):
# init training batches
batch_states = []
batch_acts = []
batch_rtaus = []
# init episode
obs, _ = env.reset()
state_0 = solo_utils.obs_to_state(obs)
done, ep_rewards = False, []
batch_counter = 0
while True:
# take action by sampling policy_net predictions
act_id = agent.sample_action(state_0)
action = agent.actions[act_id]
obs, rew, done, info = env.step(action)
state_1 = solo_utils.obs_to_state(obs)
# adjust reward
rew, done = solo_utils.adjust_reward(train_params, env)
# fill training batch
batch_acts.append(act_id)
batch_states.append(state_0)
# update
ep_rewards.append(rew)
state_0 = state_1
print(
bcolors.OKGREEN,
"Epoch: {} \nEpisode: {}, Step: {} \naction: {}->{}, state: {}, reward/episodic_return: {}/{}, status: {}, success: {}".format(
ep,
episode,
step,
act_id,
action,
state_1,
rew,
sum(ep_rewards),
info,
env.success_count
),
bcolors.ENDC
)
# step increment
step += 1
if done:
ep_return, ep_length = sum(ep_rewards), len(ep_rewards)
batch_rtaus += list(solo_utils.reward_to_go(ep_rewards))
assert len(batch_rtaus) == len(batch_states)
# store episodic_return
episodic_returns.append(ep_return)
# reset to a new episode
obs, _ = env.reset()
done, ep_rewards = False, []
state_0 = solo_utils.obs_to_state(obs)
episode += 1
step = 0
print(
bcolors.OKGREEN,
"current batch size: {}".format(len(batch_rtaus)),
bcolors.ENDC
)
if len(batch_rtaus) > train_params['sample_size']:
break
agent.train(batch_states, batch_acts, batch_rtaus)
agent.save_model(model_path)
# time training
end_time = time.time()
training_time = end_time - start_time
# plot episodic returns
data_utils.plot_returns(returns=episodic_returns, mode=0, save_flag=True, fdir=os.path.dirname(model_path))
# plot accumulated returns
data_utils.plot_returns(returns=episodic_returns, mode=1, save_flag=True, fdir=os.path.dirname(model_path))
# plot averaged return
data_utils.plot_returns(returns=episodic_returns, mode=2, save_flag=True,
fdir=os.path.dirname(model_path))
# save agent parameters
data_utils.save_pkl(content=agent_params, fdir=os.path.dirname(model_path), fname="agent_parameters.pkl")
# save returns
data_utils.save_pkl(content=episodic_returns, fdir=os.path.dirname(os.path.dirname(model_path)), fname="episodic_returns.pkl")
# save results
train_info = train_params
train_info["success_count"] = env.success_count
train_info["training_time"] = training_time
train_info["learning_rate"] = agent_params["learning_rate"]
train_info["state_dimension"] = agent_params["dim_state"]
train_info["action_options"] = agent_params["actions"]
train_info["layer_sizes"] = agent_params["layer_sizes"]
data_utils.save_csv(content=train_info, fdir=os.path.dirname(os.path.dirname(model_path)), fname="train_information.csv")
| [
2,
0,
1220,
14629,
14,
8800,
14,
24330,
21015,
198,
37811,
198,
2025,
7822,
286,
33897,
7820,
17701,
1153,
357,
53,
6968,
8,
329,
12199,
62,
41915,
62,
35943,
198,
53,
6968,
318,
257,
2746,
1479,
11,
319,
2450,
11,
37414,
4673,
11862,
357,
5450,
1378,
40491,
13,
77,
2419,
13,
535,
14,
20189,
14,
1558,
1485,
12,
30586,
12,
49607,
12,
24396,
82,
12,
1640,
12,
260,
259,
13442,
12,
40684,
12,
4480,
12,
8818,
12,
1324,
13907,
18991,
13,
12315,
8,
198,
13838,
25,
5164,
57,
29919,
42,
357,
2815,
23548,
962,
31,
14816,
13,
785,
8,
198,
37811,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
7297,
11,
3601,
62,
8818,
198,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
640,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
686,
2777,
88,
198,
198,
6738,
551,
14259,
13,
82,
14057,
62,
41915,
62,
35943,
62,
24330,
1330,
20284,
36,
6794,
4834,
85,
198,
6738,
3384,
4487,
1330,
1366,
62,
26791,
11,
12199,
62,
26791,
11,
48700,
62,
26791,
198,
6738,
3384,
4487,
13,
7890,
62,
26791,
1330,
275,
4033,
669,
198,
6738,
6554,
13,
85,
6024,
1330,
569,
6968,
36772,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1303,
2251,
4578,
30751,
198,
220,
220,
220,
26498,
796,
1366,
62,
26791,
13,
1136,
62,
22046,
3419,
198,
220,
220,
220,
1303,
923,
10576,
3047,
198,
220,
220,
220,
686,
2777,
88,
13,
15003,
62,
17440,
7203,
82,
14057,
62,
41915,
62,
49506,
77,
1600,
11614,
28,
17821,
11,
2604,
62,
5715,
28,
305,
2777,
88,
13,
10778,
8,
198,
220,
220,
220,
1303,
787,
281,
4554,
422,
17365,
1398,
198,
220,
220,
220,
17365,
796,
20284,
36,
6794,
4834,
85,
3419,
198,
220,
220,
220,
17365,
13,
42503,
3419,
198,
220,
220,
220,
5797,
62,
37266,
796,
23884,
198,
220,
220,
220,
4512,
62,
37266,
796,
23884,
198,
220,
220,
220,
1303,
5797,
10007,
198,
220,
220,
220,
5797,
62,
37266,
14692,
27740,
62,
5219,
8973,
796,
18896,
7,
82,
14057,
62,
26791,
13,
8158,
62,
1462,
62,
5219,
7,
24330,
13,
672,
3168,
341,
4008,
198,
220,
220,
220,
5797,
62,
37266,
14692,
4658,
8973,
796,
45941,
13,
18747,
26933,
37659,
13,
18747,
26933,
16,
11,
532,
16,
46570,
45941,
13,
18747,
26933,
16,
11,
352,
12962,
12962,
198,
220,
220,
220,
5797,
62,
37266,
14692,
29289,
62,
82,
4340,
8973,
796,
26498,
13,
29289,
62,
82,
4340,
198,
220,
220,
220,
5797,
62,
37266,
14692,
40684,
62,
4873,
8973,
796,
26498,
13,
40684,
62,
4873,
198,
220,
220,
220,
1303,
3047,
42287,
198,
220,
220,
220,
611,
26498,
13,
19608,
8079,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
37266,
14692,
19608,
8079,
8973,
796,
26498,
13,
19608,
8079,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
37266,
14692,
19608,
8079,
8973,
796,
4818,
8079,
13,
2197,
22446,
2536,
31387,
7203,
4,
56,
12,
4,
76,
12,
4,
67,
12,
4,
39,
12,
4,
44,
4943,
198,
220,
220,
220,
4512,
62,
37266,
14692,
22510,
62,
538,
5374,
82,
8973,
796,
26498,
13,
22510,
62,
538,
5374,
82,
198,
220,
220,
220,
4512,
62,
37266,
14692,
22510,
62,
20214,
8973,
796,
26498,
13,
22510,
62,
20214,
198,
220,
220,
220,
4512,
62,
37266,
14692,
2435,
62,
4189,
385,
8973,
796,
532,
16,
19571,
27432,
62,
37266,
17816,
22510,
62,
20214,
20520,
198,
220,
220,
220,
4512,
62,
37266,
14692,
13138,
62,
4189,
385,
8973,
796,
657,
198,
220,
220,
220,
4512,
62,
37266,
14692,
11930,
62,
4189,
385,
8973,
796,
532,
940,
19571,
27432,
62,
37266,
14692,
22510,
62,
20214,
8973,
198,
220,
220,
220,
4512,
62,
37266,
14692,
9424,
62,
4189,
385,
8973,
796,
657,
198,
220,
220,
220,
4512,
62,
37266,
14692,
39873,
62,
7857,
8973,
796,
26498,
13,
39873,
62,
7857,
198,
220,
220,
220,
1303,
9113,
9386,
5797,
198,
220,
220,
220,
5797,
796,
569,
6968,
36772,
7,
25781,
62,
37266,
8,
198,
220,
220,
220,
1303,
11986,
2746,
3108,
198,
220,
220,
220,
2746,
62,
6978,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
17597,
13,
6978,
58,
15,
12962,
10,
1,
14,
82,
9586,
62,
27530,
14,
82,
14057,
62,
41915,
14,
85,
6024,
30487,
10,
27432,
62,
37266,
14692,
19608,
8079,
8973,
10,
1,
14,
25781,
14,
19849,
13,
71,
20,
1,
198,
220,
220,
220,
4296,
62,
24588,
796,
657,
198,
220,
220,
220,
48177,
29512,
62,
7783,
82,
796,
17635,
198,
220,
220,
220,
4471,
796,
657,
198,
220,
220,
220,
2239,
796,
657,
198,
220,
220,
220,
923,
62,
2435,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
329,
2462,
287,
2837,
7,
27432,
62,
37266,
17816,
22510,
62,
538,
5374,
82,
20520,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2315,
3047,
37830,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
27219,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
8656,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
81,
8326,
385,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2315,
4471,
198,
220,
220,
220,
220,
220,
220,
220,
10201,
11,
4808,
796,
17365,
13,
42503,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1181,
62,
15,
796,
12199,
62,
26791,
13,
8158,
62,
1462,
62,
5219,
7,
8158,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1760,
11,
2462,
62,
260,
2017,
796,
10352,
11,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
24588,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1011,
2223,
416,
19232,
2450,
62,
3262,
16277,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
62,
312,
796,
5797,
13,
39873,
62,
2673,
7,
5219,
62,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
5797,
13,
4658,
58,
529,
62,
312,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10201,
11,
302,
86,
11,
1760,
11,
7508,
796,
17365,
13,
9662,
7,
2673,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1181,
62,
16,
796,
12199,
62,
26791,
13,
8158,
62,
1462,
62,
5219,
7,
8158,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4532,
6721,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
302,
86,
11,
1760,
796,
12199,
62,
26791,
13,
23032,
62,
260,
904,
7,
27432,
62,
37266,
11,
17365,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6070,
3047,
15458,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
8656,
13,
33295,
7,
529,
62,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
27219,
13,
33295,
7,
5219,
62,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4296,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2462,
62,
260,
2017,
13,
33295,
7,
1809,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1181,
62,
15,
796,
1181,
62,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
4033,
669,
13,
11380,
43016,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
13807,
5374,
25,
23884,
3467,
77,
23758,
25,
1391,
5512,
5012,
25,
23884,
3467,
77,
2673,
25,
23884,
3784,
90,
5512,
1181,
25,
1391,
5512,
6721,
14,
538,
271,
29512,
62,
7783,
25,
23884,
14,
90,
5512,
3722,
25,
1391,
5512,
1943,
25,
23884,
1911,
18982,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2462,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4471,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2239,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
62,
312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1181,
62,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
302,
86,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2160,
7,
538,
62,
260,
2017,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7508,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17365,
13,
13138,
62,
9127,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
4033,
669,
13,
1677,
9697,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2239,
18703,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2239,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1760,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2462,
62,
7783,
11,
2462,
62,
13664,
796,
2160,
7,
538,
62,
260,
2017,
828,
18896,
7,
538,
62,
260,
2017,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15458,
62,
81,
8326,
385,
15853,
1351,
7,
82,
14057,
62,
26791,
13,
260,
904,
62,
1462,
62,
2188,
7,
538,
62,
260,
2017,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6818,
18896,
7,
43501,
62,
81,
8326,
385,
8,
6624,
18896,
7,
43501,
62,
27219,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3650,
48177,
29512,
62,
7783,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
48177,
29512,
62,
7783,
82,
13,
33295,
7,
538,
62,
7783,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
13259,
284,
257,
649,
4471,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10201,
11,
4808,
796,
17365,
13,
42503,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1760,
11,
2462,
62,
260,
2017,
796,
10352,
11,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1181,
62,
15,
796,
12199,
62,
26791,
13,
8158,
62,
1462,
62,
5219,
7,
8158,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4471,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2239,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
4033,
669,
13,
11380,
43016,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
14421,
15458,
2546,
25,
23884,
1911,
18982,
7,
11925,
7,
43501,
62,
81,
8326,
385,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
4033,
669,
13,
1677,
9697,
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,
611,
18896,
7,
43501,
62,
81,
8326,
385,
8,
1875,
4512,
62,
37266,
17816,
39873,
62,
7857,
6,
5974,
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,
5797,
13,
27432,
7,
43501,
62,
27219,
11,
15458,
62,
8656,
11,
15458,
62,
81,
8326,
385,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5797,
13,
21928,
62,
19849,
7,
19849,
62,
6978,
8,
198,
220,
220,
220,
1303,
640,
3047,
198,
220,
220,
220,
886,
62,
2435,
796,
640,
13,
2435,
3419,
198,
220,
220,
220,
3047,
62,
2435,
796,
886,
62,
2435,
532,
923,
62,
2435,
628,
220,
220,
220,
1303,
7110,
48177,
29512,
5860,
198,
220,
220,
220,
1366,
62,
26791,
13,
29487,
62,
7783,
82,
7,
7783,
82,
28,
538,
271,
29512,
62,
7783,
82,
11,
4235,
28,
15,
11,
3613,
62,
32109,
28,
17821,
11,
277,
15908,
28,
418,
13,
6978,
13,
15908,
3672,
7,
19849,
62,
6978,
4008,
198,
220,
220,
220,
1303,
7110,
22425,
5860,
198,
220,
220,
220,
1366,
62,
26791,
13,
29487,
62,
7783,
82,
7,
7783,
82,
28,
538,
271,
29512,
62,
7783,
82,
11,
4235,
28,
16,
11,
3613,
62,
32109,
28,
17821,
11,
277,
15908,
28,
418,
13,
6978,
13,
15908,
3672,
7,
19849,
62,
6978,
4008,
198,
220,
220,
220,
1303,
7110,
16449,
1441,
198,
220,
220,
220,
1366,
62,
26791,
13,
29487,
62,
7783,
82,
7,
7783,
82,
28,
538,
271,
29512,
62,
7783,
82,
11,
4235,
28,
17,
11,
3613,
62,
32109,
28,
17821,
11,
198,
220,
220,
220,
277,
15908,
28,
418,
13,
6978,
13,
15908,
3672,
7,
19849,
62,
6978,
4008,
198,
220,
220,
220,
1303,
3613,
5797,
10007,
198,
220,
220,
220,
1366,
62,
26791,
13,
21928,
62,
79,
41582,
7,
11299,
28,
25781,
62,
37266,
11,
277,
15908,
28,
418,
13,
6978,
13,
15908,
3672,
7,
19849,
62,
6978,
828,
277,
3672,
2625,
25781,
62,
17143,
7307,
13,
79,
41582,
4943,
198,
220,
220,
220,
1303,
3613,
5860,
198,
220,
220,
220,
1366,
62,
26791,
13,
21928,
62,
79,
41582,
7,
11299,
28,
538,
271,
29512,
62,
7783,
82,
11,
277,
15908,
28,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
15908,
3672,
7,
19849,
62,
6978,
36911,
277,
3672,
2625,
538,
271,
29512,
62,
7783,
82,
13,
79,
41582,
4943,
198,
220,
220,
220,
1303,
3613,
2482,
198,
220,
220,
220,
4512,
62,
10951,
796,
4512,
62,
37266,
198,
220,
220,
220,
4512,
62,
10951,
14692,
13138,
62,
9127,
8973,
796,
17365,
13,
13138,
62,
9127,
198,
220,
220,
220,
4512,
62,
10951,
14692,
34409,
62,
2435,
8973,
796,
3047,
62,
2435,
198,
220,
220,
220,
4512,
62,
10951,
14692,
40684,
62,
4873,
8973,
796,
5797,
62,
37266,
14692,
40684,
62,
4873,
8973,
198,
220,
220,
220,
4512,
62,
10951,
14692,
5219,
62,
46156,
8973,
796,
5797,
62,
37266,
14692,
27740,
62,
5219,
8973,
198,
220,
220,
220,
4512,
62,
10951,
14692,
2673,
62,
25811,
8973,
796,
5797,
62,
37266,
14692,
4658,
8973,
198,
220,
220,
220,
4512,
62,
10951,
14692,
29289,
62,
82,
4340,
8973,
796,
5797,
62,
37266,
14692,
29289,
62,
82,
4340,
8973,
198,
220,
220,
220,
1366,
62,
26791,
13,
21928,
62,
40664,
7,
11299,
28,
27432,
62,
10951,
11,
277,
15908,
28,
418,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
15908,
3672,
7,
19849,
62,
6978,
36911,
277,
3672,
2625,
27432,
62,
17018,
13,
40664,
4943,
198
] | 2.163529 | 2,709 |
# Buycoin Python SDK
# Copyright 2021 Iyanuoluwa Ajao
# See LICENCE for details.
"""
Authentication is handled by the :any:`Airtable` class.
>>> airtable = Airtable(base_key, table_name, api_key)
Note:
You can also use this class to handle authentication for you if you
are making your own wrapper:
>>> auth = BuycoinsAuth(api_key)
>>>
>>> response = requests.get('https://api.airtable.com/v0/{basekey}/{table_name}', auth=auth)
"""
from requests.auth import AuthBase
| [
2,
11763,
3630,
11361,
26144,
198,
2,
15069,
33448,
314,
4121,
84,
349,
84,
10247,
22028,
5488,
198,
2,
4091,
38559,
18310,
329,
3307,
13,
198,
198,
37811,
198,
47649,
3299,
318,
12118,
416,
262,
1058,
1092,
25,
63,
32,
2265,
540,
63,
1398,
13,
198,
198,
33409,
1633,
11487,
796,
317,
2265,
540,
7,
8692,
62,
2539,
11,
3084,
62,
3672,
11,
40391,
62,
2539,
8,
198,
6425,
25,
198,
220,
220,
220,
921,
460,
635,
779,
428,
1398,
284,
5412,
18239,
329,
345,
611,
345,
198,
220,
220,
220,
389,
1642,
534,
898,
29908,
25,
198,
220,
220,
220,
13163,
6284,
796,
11763,
14624,
30515,
7,
15042,
62,
2539,
8,
198,
220,
220,
220,
13163,
198,
220,
220,
220,
13163,
2882,
796,
7007,
13,
1136,
10786,
5450,
1378,
15042,
13,
958,
11487,
13,
785,
14,
85,
15,
14,
90,
8692,
2539,
92,
14,
90,
11487,
62,
3672,
92,
3256,
6284,
28,
18439,
8,
198,
37811,
198,
198,
6738,
7007,
13,
18439,
1330,
26828,
14881,
628,
198
] | 2.934524 | 168 |
#!/usr/bin/env python3
###Description: The tool reads cern web services behind SSO using user certificates
from __future__ import print_function
import os, urllib, urllib2, httplib, cookielib, sys, HTMLParser, re
from optparse import OptionParser
if __name__ == "__main__":
parser = OptionParser(usage="%prog [-d(ebug)] -o(ut) COOKIE_FILENAME -c(cert) CERN-PEM -k(ey) CERT-KEY -u(rl) URL")
parser.add_option("-d", "--debug", dest="debug", help="Enable pycurl debugging. Prints to data and headers to stderr.", action="store_true", default=False)
parser.add_option("-p", "--postdata", dest="postdata", help="Data to be sent as post request", action="store", default=None)
parser.add_option("-c", "--cert", dest="cert_path", help="[REQUIRED] Absolute path to cert file.", action="store")
parser.add_option("-k", "--key", dest="key_path", help="[REQUIRED] Absolute path to key file.", action="store")
parser.add_option("-u", "--url", dest="url", help="[REQUIRED] Url to a service behind the SSO", action="store")
(opts, args) = parser.parse_args()
checkRequiredArguments(opts, parser)
content = getContent(opts.url, opts.cert_path, opts.key_path, opts.postdata, opts.debug)
print(content)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
21017,
11828,
25,
383,
2891,
9743,
269,
1142,
3992,
2594,
2157,
6723,
46,
1262,
2836,
20835,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
11748,
28686,
11,
2956,
297,
571,
11,
2956,
297,
571,
17,
11,
1841,
489,
571,
11,
4255,
8207,
571,
11,
25064,
11,
11532,
46677,
11,
302,
198,
6738,
2172,
29572,
1330,
16018,
46677,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
30751,
796,
16018,
46677,
7,
26060,
2625,
4,
1676,
70,
25915,
67,
7,
1765,
1018,
15437,
532,
78,
7,
315,
8,
327,
15308,
10008,
62,
46700,
1677,
10067,
532,
66,
7,
22583,
8,
327,
28778,
12,
47,
3620,
532,
74,
7,
2959,
8,
327,
17395,
12,
20373,
532,
84,
7,
45895,
8,
10289,
4943,
220,
198,
220,
30751,
13,
2860,
62,
18076,
7203,
12,
67,
1600,
366,
438,
24442,
1600,
2244,
2625,
24442,
1600,
1037,
2625,
36695,
12972,
66,
6371,
28769,
13,
12578,
82,
284,
1366,
290,
24697,
284,
336,
1082,
81,
33283,
2223,
2625,
8095,
62,
7942,
1600,
4277,
28,
25101,
8,
198,
220,
30751,
13,
2860,
62,
18076,
7203,
12,
79,
1600,
366,
438,
7353,
7890,
1600,
2244,
2625,
7353,
7890,
1600,
1037,
2625,
6601,
284,
307,
1908,
355,
1281,
2581,
1600,
2223,
2625,
8095,
1600,
4277,
28,
14202,
8,
198,
220,
30751,
13,
2860,
62,
18076,
7203,
12,
66,
1600,
366,
438,
22583,
1600,
2244,
2625,
22583,
62,
6978,
1600,
1037,
2625,
58,
2200,
10917,
37819,
60,
36532,
3108,
284,
5051,
2393,
33283,
2223,
2625,
8095,
4943,
198,
220,
30751,
13,
2860,
62,
18076,
7203,
12,
74,
1600,
366,
438,
2539,
1600,
2244,
2625,
2539,
62,
6978,
1600,
1037,
2625,
58,
2200,
10917,
37819,
60,
36532,
3108,
284,
1994,
2393,
33283,
2223,
2625,
8095,
4943,
198,
220,
30751,
13,
2860,
62,
18076,
7203,
12,
84,
1600,
366,
438,
6371,
1600,
2244,
2625,
6371,
1600,
1037,
2625,
58,
2200,
10917,
37819,
60,
8799,
75,
284,
257,
2139,
2157,
262,
6723,
46,
1600,
2223,
2625,
8095,
4943,
198,
220,
357,
404,
912,
11,
26498,
8,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
220,
2198,
37374,
28100,
2886,
7,
404,
912,
11,
30751,
8,
198,
220,
2695,
796,
651,
19746,
7,
404,
912,
13,
6371,
11,
2172,
82,
13,
22583,
62,
6978,
11,
2172,
82,
13,
2539,
62,
6978,
11,
2172,
82,
13,
7353,
7890,
11,
2172,
82,
13,
24442,
8,
198,
220,
3601,
7,
11299,
8,
198
] | 2.932039 | 412 |
# -*- coding: utf-8 -*-
import filecmp
import json
import os
import pkgutil
import zipfile
import hypothesis
import pytest
import six
from verta.tracking.entities._deployable_entity import _DeployableEntity
from verta._internal_utils.custom_modules import CustomModules
from .. import utils
from . import contexts
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
2393,
48991,
198,
11748,
33918,
198,
11748,
28686,
198,
11748,
279,
10025,
22602,
198,
11748,
19974,
7753,
198,
198,
11748,
14078,
198,
11748,
12972,
9288,
198,
11748,
2237,
198,
198,
6738,
9421,
64,
13,
36280,
13,
298,
871,
13557,
2934,
1420,
540,
62,
26858,
1330,
4808,
49322,
540,
32398,
198,
6738,
9421,
64,
13557,
32538,
62,
26791,
13,
23144,
62,
18170,
1330,
8562,
5841,
5028,
198,
198,
6738,
11485,
1330,
3384,
4487,
198,
6738,
764,
1330,
26307,
628
] | 3.393617 | 94 |
# We need those imports for migrations compatibility purpose
from privatemedia.storage import ProtectedStorage, PrivateStorage # noqa
| [
2,
775,
761,
883,
17944,
329,
15720,
602,
17764,
4007,
198,
6738,
21883,
368,
5507,
13,
35350,
1330,
5038,
11197,
31425,
11,
15348,
31425,
220,
1303,
645,
20402,
198
] | 4.655172 | 29 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Ari Aosved
# http://github.com/devaos/sublime-remote/blob/master/LICENSE
"""This module implements an API layer for Vagrant related functionality."""
import re
import subprocess
# =============================================================================
def parse_vm_id(line):
"""Determine if a line appears to be from `vagrant global-status`."""
parts = re.split("\s+", line)
if len(parts) == 5 and parts[0] != "id" \
and re.match("^[0-9a-f]{1,7}$", parts[0]):
return parts[0]
return None
def get_vm_list(opt):
"""Pull a list of all running vagrant VMs for the user to choose from."""
p1 = subprocess.Popen(["/usr/bin/vagrant", "global-status"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while True:
buf = p1.stdout.readline()
decoded = buf.decode("utf-8").rstrip()
if decoded == "" and p1.poll() is not None:
break
if decoded == "":
continue
if parse_vm_id(decoded) is not None:
opt.append(decoded)
return opt
def get_ssh_options(vm):
"""Pull the ssh options required to connect to a specific vagrant VM."""
cmd = 'PATH="${PATH}:/usr/local/bin" /usr/bin/vagrant ssh-config'
cmd = cmd + ' ' + vm + '; exit 0'
print("ssh options cmd", cmd)
out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
out = out.decode("utf-8").rstrip()
print("ssh options output", out)
obj = [s.strip().split(' ') for s in out.splitlines()]
opt = []
for field in obj:
if field[0] != "Host":
opt.append("=".join(field))
opt = "-o " + " -o ".join(opt)
print("ssh options parsed", opt)
return opt
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
15069,
357,
66,
8,
1946,
6069,
317,
418,
1079,
198,
2,
2638,
1378,
12567,
13,
785,
14,
7959,
7495,
14,
7266,
27299,
12,
47960,
14,
2436,
672,
14,
9866,
14,
43,
2149,
24290,
198,
198,
37811,
1212,
8265,
23986,
281,
7824,
7679,
329,
37203,
5250,
3519,
11244,
526,
15931,
198,
198,
11748,
302,
198,
11748,
850,
14681,
198,
198,
2,
38093,
25609,
628,
198,
4299,
21136,
62,
14761,
62,
312,
7,
1370,
2599,
198,
220,
220,
220,
37227,
35,
2357,
3810,
611,
257,
1627,
3568,
284,
307,
422,
4600,
29821,
5250,
3298,
12,
13376,
63,
526,
15931,
628,
220,
220,
220,
3354,
796,
302,
13,
35312,
7203,
59,
82,
10,
1600,
1627,
8,
198,
220,
220,
220,
611,
18896,
7,
42632,
8,
6624,
642,
290,
3354,
58,
15,
60,
14512,
366,
312,
1,
3467,
198,
220,
220,
220,
220,
220,
220,
290,
302,
13,
15699,
7203,
61,
58,
15,
12,
24,
64,
12,
69,
60,
90,
16,
11,
22,
92,
3,
1600,
3354,
58,
15,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
3354,
58,
15,
60,
628,
220,
220,
220,
1441,
6045,
628,
198,
4299,
651,
62,
14761,
62,
4868,
7,
8738,
2599,
198,
220,
220,
220,
37227,
42940,
257,
1351,
286,
477,
2491,
14334,
5250,
569,
10128,
329,
262,
2836,
284,
3853,
422,
526,
15931,
628,
220,
220,
220,
279,
16,
796,
850,
14681,
13,
47,
9654,
7,
14692,
14,
14629,
14,
8800,
14,
29821,
5250,
1600,
366,
20541,
12,
13376,
33116,
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,
14367,
448,
28,
7266,
14681,
13,
47,
4061,
36,
11,
336,
1082,
81,
28,
7266,
14681,
13,
47,
4061,
36,
8,
628,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
42684,
796,
279,
16,
13,
19282,
448,
13,
961,
1370,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
875,
9043,
796,
42684,
13,
12501,
1098,
7203,
40477,
12,
23,
11074,
81,
36311,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
611,
875,
9043,
6624,
13538,
290,
279,
16,
13,
30393,
3419,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
611,
875,
9043,
6624,
366,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
611,
21136,
62,
14761,
62,
312,
7,
12501,
9043,
8,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2172,
13,
33295,
7,
12501,
9043,
8,
628,
220,
220,
220,
1441,
2172,
628,
198,
4299,
651,
62,
45824,
62,
25811,
7,
14761,
2599,
198,
220,
220,
220,
37227,
42940,
262,
26678,
3689,
2672,
284,
2018,
284,
257,
2176,
14334,
5250,
16990,
526,
15931,
628,
220,
220,
220,
23991,
796,
705,
34219,
2625,
38892,
34219,
92,
14079,
14629,
14,
12001,
14,
8800,
1,
1220,
14629,
14,
8800,
14,
29821,
5250,
26678,
12,
11250,
6,
198,
220,
220,
220,
23991,
796,
23991,
1343,
705,
705,
1343,
45887,
1343,
705,
26,
8420,
657,
6,
198,
220,
220,
220,
3601,
7203,
45824,
3689,
23991,
1600,
23991,
8,
628,
220,
220,
220,
503,
796,
850,
14681,
13,
9122,
62,
22915,
7,
28758,
11,
336,
1082,
81,
28,
7266,
14681,
13,
36886,
11,
7582,
28,
17821,
8,
198,
220,
220,
220,
503,
796,
503,
13,
12501,
1098,
7203,
40477,
12,
23,
11074,
81,
36311,
3419,
198,
220,
220,
220,
3601,
7203,
45824,
3689,
5072,
1600,
503,
8,
628,
220,
220,
220,
26181,
796,
685,
82,
13,
36311,
22446,
35312,
10786,
705,
8,
329,
264,
287,
503,
13,
35312,
6615,
3419,
60,
198,
220,
220,
220,
2172,
796,
17635,
198,
220,
220,
220,
329,
2214,
287,
26181,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2214,
58,
15,
60,
14512,
366,
17932,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2172,
13,
33295,
7203,
28,
1911,
22179,
7,
3245,
4008,
628,
220,
220,
220,
2172,
796,
27444,
78,
366,
1343,
366,
532,
78,
27071,
22179,
7,
8738,
8,
198,
220,
220,
220,
3601,
7203,
45824,
3689,
44267,
1600,
2172,
8,
628,
220,
220,
220,
1441,
2172,
198
] | 2.429932 | 735 |
import gym
import numpy as np
from gym_framework.panda_ctrl.panda_mujoco_base_ctrl import PandaBase
class PandaTorqueControl(PandaBase):
"""
Control the Panda robot by directly applying torques (control=torque).
"""
@property
@property
@property
@property
| [
11748,
11550,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
11550,
62,
30604,
13,
79,
5282,
62,
44755,
13,
79,
5282,
62,
76,
23577,
25634,
62,
8692,
62,
44755,
1330,
41112,
14881,
628,
198,
4871,
41112,
15884,
4188,
15988,
7,
47,
5282,
14881,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
6779,
262,
41112,
9379,
416,
3264,
11524,
7332,
13281,
357,
13716,
28,
13165,
4188,
737,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
2488,
26745,
628,
220,
220,
220,
2488,
26745,
628,
220,
220,
220,
2488,
26745,
628,
220,
220,
220,
2488,
26745,
198
] | 2.939394 | 99 |
import plotly.express as px
import plotly.io as pio
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import pandas as pd
import numpy as np
from agents import *
from generators import *
from CMDataLoader import CMDataLoader
from Simulator import Simulator
from plotutils import update_layout_wrapper
import config
import constants
import random
# my_palette = ["#264653","#9D1DC8","#287271", "#645DAC","#636EFA", "#ECA400","#FE484E","#8484E8", "#03b800" ,"#9251e1","#F4A261"]
# my_palette = ["#54478c","#9D1DC8","#2c699a","#048ba8","#0db39e","#16db93","#83e377","#b9e769","#efea5a","#f1c453","#f29e4c"]
my_palette = ["#1f00a7","#9d1dc8","#00589f","#009b86","#00a367","#67a300","#645dac","#eca400","#fd7e00","#b6322b", "#FE484E"]
hardware_palette = ["#009b86", "#9D1DC8"]
opex_palette = ["#9D1DC8","#264653","#8484E8"]
primary_color = ["#9d1dc8"]
if __name__ == '__main__':
random.seed(1032009)
np.random.seed(1032009)
n_trials = 25
fee_params = CMDataLoader.get_historical_fee_params()
block_subsidy = 6.25
historical_price_params = CMDataLoader.get_historical_price_params()
get_summary_plots(historical_price_params, fee_params, block_subsidy, n_trials, "with Historical Parameters", "historical")
bearish_price_params = (historical_price_params[0], -1 * abs(historical_price_params[1]), historical_price_params[2])
get_summary_plots(bearish_price_params, fee_params, block_subsidy, n_trials, "with Bearish Parameters", "bearish")
corrections_price_params = (historical_price_params[0], 0, historical_price_params[2] * 1.25)
get_summary_plots(corrections_price_params, fee_params, block_subsidy, n_trials, "in Bull Market with Corrections", "corrections")
s9_s19_prices = {key: config.machine_prices[key] for key in [constants.MachineName.ANTMINER_S9, constants.MachineName.ANTMINER_S19]}
get_summary_plots(historical_price_params, fee_params, block_subsidy, n_trials, "with Historical Parameters", "historical-machines", s9_s19_prices, [0.03], hardware_palette)
get_summary_plots_opex(bearish_price_params, fee_params, block_subsidy, n_trials, "with Bearish Parameters", "bearish-opex", s9_s19_prices, [0.03, 0.04, 0.05], opex_palette)
| [
11748,
7110,
306,
13,
42712,
355,
279,
87,
198,
11748,
7110,
306,
13,
952,
355,
279,
952,
198,
11748,
7110,
306,
13,
34960,
62,
48205,
355,
467,
198,
6738,
7110,
306,
13,
7266,
489,
1747,
1330,
787,
62,
7266,
489,
1747,
198,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
6554,
1330,
1635,
198,
6738,
27298,
1330,
1635,
198,
6738,
16477,
6601,
17401,
1330,
16477,
6601,
17401,
198,
6738,
13942,
1330,
13942,
198,
6738,
7110,
26791,
1330,
4296,
62,
39786,
62,
48553,
198,
11748,
4566,
198,
11748,
38491,
198,
11748,
4738,
198,
198,
2,
616,
62,
18596,
5857,
796,
14631,
2,
18897,
46435,
2430,
2,
24,
35,
16,
9697,
23,
2430,
2,
27800,
28977,
1600,
25113,
49259,
35,
2246,
2430,
2,
21,
2623,
36,
7708,
1600,
25113,
36600,
7029,
2430,
2,
15112,
34137,
36,
2430,
2,
23,
34137,
36,
23,
1600,
25113,
3070,
65,
7410,
1,
42911,
2,
24,
28072,
68,
16,
2430,
2,
37,
19,
32,
30057,
8973,
198,
2,
616,
62,
18596,
5857,
796,
14631,
2,
47576,
3695,
66,
2430,
2,
24,
35,
16,
9697,
23,
2430,
2,
17,
66,
47325,
64,
2430,
2,
47202,
7012,
23,
2430,
2,
15,
9945,
2670,
68,
2430,
2,
1433,
9945,
6052,
2430,
2,
5999,
68,
26514,
2430,
2,
65,
24,
68,
22,
3388,
2430,
2,
891,
18213,
20,
64,
2430,
2,
69,
16,
66,
36625,
2430,
2,
69,
1959,
68,
19,
66,
8973,
198,
1820,
62,
18596,
5857,
796,
14631,
2,
16,
69,
405,
64,
22,
2430,
2,
24,
67,
16,
17896,
23,
2430,
2,
405,
44169,
69,
2430,
2,
28694,
65,
4521,
2430,
2,
405,
64,
27824,
2430,
2,
3134,
64,
6200,
2430,
2,
49259,
67,
330,
2430,
2,
31047,
7029,
2430,
2,
16344,
22,
68,
405,
2430,
2,
65,
5066,
1828,
65,
1600,
25113,
15112,
34137,
36,
8973,
198,
10424,
1574,
62,
18596,
5857,
796,
14631,
2,
28694,
65,
4521,
1600,
25113,
24,
35,
16,
9697,
23,
8973,
198,
404,
1069,
62,
18596,
5857,
796,
14631,
2,
24,
35,
16,
9697,
23,
2430,
2,
18897,
46435,
2430,
2,
23,
34137,
36,
23,
8973,
198,
39754,
62,
8043,
796,
14631,
2,
24,
67,
16,
17896,
23,
8973,
628,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
4738,
13,
28826,
7,
15197,
10531,
8,
198,
220,
220,
220,
45941,
13,
25120,
13,
28826,
7,
15197,
10531,
8,
198,
220,
220,
220,
299,
62,
28461,
874,
796,
1679,
628,
220,
220,
220,
6838,
62,
37266,
796,
16477,
6601,
17401,
13,
1136,
62,
10034,
12409,
62,
39071,
62,
37266,
3419,
198,
220,
220,
220,
2512,
62,
7266,
82,
19325,
796,
718,
13,
1495,
628,
220,
220,
220,
6754,
62,
20888,
62,
37266,
796,
16477,
6601,
17401,
13,
1136,
62,
10034,
12409,
62,
20888,
62,
37266,
3419,
198,
220,
220,
220,
651,
62,
49736,
62,
489,
1747,
7,
10034,
12409,
62,
20888,
62,
37266,
11,
6838,
62,
37266,
11,
2512,
62,
7266,
82,
19325,
11,
299,
62,
28461,
874,
11,
366,
4480,
23121,
40117,
1600,
366,
10034,
12409,
4943,
628,
220,
220,
220,
6842,
680,
62,
20888,
62,
37266,
796,
357,
10034,
12409,
62,
20888,
62,
37266,
58,
15,
4357,
532,
16,
1635,
2352,
7,
10034,
12409,
62,
20888,
62,
37266,
58,
16,
46570,
6754,
62,
20888,
62,
37266,
58,
17,
12962,
198,
220,
220,
220,
651,
62,
49736,
62,
489,
1747,
7,
33227,
680,
62,
20888,
62,
37266,
11,
6838,
62,
37266,
11,
2512,
62,
7266,
82,
19325,
11,
299,
62,
28461,
874,
11,
366,
4480,
14732,
680,
40117,
1600,
366,
33227,
680,
4943,
628,
220,
220,
220,
26251,
62,
20888,
62,
37266,
796,
357,
10034,
12409,
62,
20888,
62,
37266,
58,
15,
4357,
657,
11,
6754,
62,
20888,
62,
37266,
58,
17,
60,
1635,
352,
13,
1495,
8,
198,
220,
220,
220,
651,
62,
49736,
62,
489,
1747,
7,
30283,
507,
62,
20888,
62,
37266,
11,
6838,
62,
37266,
11,
2512,
62,
7266,
82,
19325,
11,
299,
62,
28461,
874,
11,
366,
259,
8266,
5991,
351,
40526,
1600,
366,
30283,
507,
4943,
628,
220,
220,
220,
264,
24,
62,
82,
1129,
62,
1050,
1063,
796,
1391,
2539,
25,
4566,
13,
30243,
62,
1050,
1063,
58,
2539,
60,
329,
1994,
287,
685,
9979,
1187,
13,
37573,
5376,
13,
8643,
23678,
1137,
62,
50,
24,
11,
38491,
13,
37573,
5376,
13,
8643,
23678,
1137,
62,
50,
1129,
48999,
198,
220,
220,
220,
651,
62,
49736,
62,
489,
1747,
7,
10034,
12409,
62,
20888,
62,
37266,
11,
6838,
62,
37266,
11,
2512,
62,
7266,
82,
19325,
11,
299,
62,
28461,
874,
11,
366,
4480,
23121,
40117,
1600,
366,
10034,
12409,
12,
76,
620,
1127,
1600,
264,
24,
62,
82,
1129,
62,
1050,
1063,
11,
685,
15,
13,
3070,
4357,
6890,
62,
18596,
5857,
8,
628,
220,
220,
220,
651,
62,
49736,
62,
489,
1747,
62,
404,
1069,
7,
33227,
680,
62,
20888,
62,
37266,
11,
6838,
62,
37266,
11,
2512,
62,
7266,
82,
19325,
11,
299,
62,
28461,
874,
11,
366,
4480,
14732,
680,
40117,
1600,
366,
33227,
680,
12,
404,
1069,
1600,
264,
24,
62,
82,
1129,
62,
1050,
1063,
11,
685,
15,
13,
3070,
11,
657,
13,
3023,
11,
657,
13,
2713,
4357,
267,
24900,
62,
18596,
5857,
8,
198
] | 2.558857 | 875 |
__all__ = (
"extract_value",
"extract_errors",
)
from typing import (
cast,
Any,
Type,
Union,
List,
)
from testplates.impl.value import (
MISSING,
)
from testplates.impl.exceptions import (
TestplatesError,
)
from .attrs import (
TESTPLATES_ERRORS_ATTR,
TESTPLATES_VALUE_ATTR,
)
def extract_value(
instance: Any,
) -> Any:
"""
Extracts value.
For internal use only.
"""
value = getattr(instance, TESTPLATES_VALUE_ATTR, MISSING)
return value
def extract_errors(
cls_or_instance: Union[Type[Any], Any],
) -> List[TestplatesError]:
"""
Extracts errors.
For internal use only.
"""
errors = getattr(cls_or_instance, TESTPLATES_ERRORS_ATTR, MISSING)
if errors is MISSING:
setattr(cls_or_instance, TESTPLATES_ERRORS_ATTR, errors := list())
return cast(List[TestplatesError], errors)
| [
834,
439,
834,
796,
357,
198,
220,
220,
220,
366,
2302,
974,
62,
8367,
1600,
198,
220,
220,
220,
366,
2302,
974,
62,
48277,
1600,
198,
8,
198,
198,
6738,
19720,
1330,
357,
198,
220,
220,
220,
3350,
11,
198,
220,
220,
220,
4377,
11,
198,
220,
220,
220,
5994,
11,
198,
220,
220,
220,
4479,
11,
198,
220,
220,
220,
7343,
11,
198,
8,
198,
198,
6738,
1332,
17041,
13,
23928,
13,
8367,
1330,
357,
198,
220,
220,
220,
49684,
2751,
11,
198,
8,
198,
198,
6738,
1332,
17041,
13,
23928,
13,
1069,
11755,
1330,
357,
198,
220,
220,
220,
6208,
17041,
12331,
11,
198,
8,
198,
198,
6738,
764,
1078,
3808,
1330,
357,
198,
220,
220,
220,
43001,
6489,
29462,
62,
24908,
50,
62,
1404,
5446,
11,
198,
220,
220,
220,
43001,
6489,
29462,
62,
39488,
62,
1404,
5446,
11,
198,
8,
628,
198,
4299,
7925,
62,
8367,
7,
198,
220,
220,
220,
4554,
25,
4377,
11,
198,
8,
4613,
4377,
25,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
29677,
82,
1988,
13,
198,
220,
220,
220,
1114,
5387,
779,
691,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1988,
796,
651,
35226,
7,
39098,
11,
43001,
6489,
29462,
62,
39488,
62,
1404,
5446,
11,
49684,
2751,
8,
628,
220,
220,
220,
1441,
1988,
628,
198,
4299,
7925,
62,
48277,
7,
198,
220,
220,
220,
537,
82,
62,
273,
62,
39098,
25,
4479,
58,
6030,
58,
7149,
4357,
4377,
4357,
198,
8,
4613,
7343,
58,
14402,
17041,
12331,
5974,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
29677,
82,
8563,
13,
198,
220,
220,
220,
1114,
5387,
779,
691,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
8563,
796,
651,
35226,
7,
565,
82,
62,
273,
62,
39098,
11,
43001,
6489,
29462,
62,
24908,
50,
62,
1404,
5446,
11,
49684,
2751,
8,
628,
220,
220,
220,
611,
8563,
318,
49684,
2751,
25,
198,
220,
220,
220,
220,
220,
220,
220,
900,
35226,
7,
565,
82,
62,
273,
62,
39098,
11,
43001,
6489,
29462,
62,
24908,
50,
62,
1404,
5446,
11,
8563,
19039,
1351,
28955,
628,
220,
220,
220,
1441,
3350,
7,
8053,
58,
14402,
17041,
12331,
4357,
8563,
8,
198
] | 2.447154 | 369 |
# Copyright 2014 Diamond Light Source Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
.. module:: projection_shift
:platform: Unix
:synopsis: Calculate horizontal and vertical shifts in the projection\
images over time, using template matching.
.. moduleauthor:: Nicola Wadeson <[email protected]>
"""
import logging
import numpy as np
from skimage.feature import match_template, match_descriptors, ORB
from scipy.linalg import lstsq
from skimage.transform import AffineTransform
from skimage.measure import ransac
from savu.plugins.utils import register_plugin
from savu.plugins.filters.base_filter import BaseFilter
from savu.plugins.driver.cpu_plugin import CpuPlugin
@register_plugin
class ProjectionShift(BaseFilter, CpuPlugin):
"""
"""
| [
2,
15069,
1946,
13566,
4401,
8090,
12052,
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,
37811,
198,
492,
8265,
3712,
20128,
62,
30846,
198,
220,
220,
1058,
24254,
25,
33501,
198,
220,
220,
1058,
28869,
24608,
25,
27131,
378,
16021,
290,
11723,
15381,
287,
262,
20128,
59,
198,
220,
220,
220,
220,
220,
220,
4263,
625,
640,
11,
1262,
11055,
12336,
13,
198,
198,
492,
8265,
9800,
3712,
40396,
370,
2367,
261,
1279,
41355,
43776,
31,
67,
8446,
13,
330,
13,
2724,
29,
198,
198,
37811,
198,
198,
11748,
18931,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
1341,
9060,
13,
30053,
1330,
2872,
62,
28243,
11,
2872,
62,
20147,
1968,
669,
11,
6375,
33,
198,
6738,
629,
541,
88,
13,
75,
1292,
70,
1330,
300,
6448,
80,
198,
6738,
1341,
9060,
13,
35636,
1330,
6708,
500,
41762,
198,
6738,
1341,
9060,
13,
1326,
5015,
1330,
374,
504,
330,
198,
198,
6738,
6799,
84,
13,
37390,
13,
26791,
1330,
7881,
62,
33803,
198,
6738,
6799,
84,
13,
37390,
13,
10379,
1010,
13,
8692,
62,
24455,
1330,
7308,
22417,
198,
6738,
6799,
84,
13,
37390,
13,
26230,
13,
36166,
62,
33803,
1330,
327,
19944,
37233,
628,
198,
31,
30238,
62,
33803,
198,
4871,
4935,
295,
33377,
7,
14881,
22417,
11,
327,
19944,
37233,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
37227,
198
] | 3.578947 | 361 |
import torch
# cand_ids = torch.randint(0,10000,(10,))
# print(cand_ids.dtype)
# print(cand_ids.shape)
scores = torch.Tensor([[ 0, 1, 2],[ 3, 4, 5],[ 6, 7, 8],[ 9, 10, 11]])
a=scores[0:2]
# print(a)
# print(scores.dtype)
# print(scores.shape)
# scores[[1,2,3]]
# with torch.autograd.profiler.profile(record_shapes=True) as prof:
# print(scores[[1,2],[0,2]])
# print(prof.key_averages(group_by_input_shape=True).table(sort_by="self_cpu_time_total"))
| [
11748,
28034,
628,
198,
2,
2658,
62,
2340,
796,
28034,
13,
25192,
600,
7,
15,
11,
49388,
11,
7,
940,
11,
4008,
198,
2,
3601,
7,
46188,
62,
2340,
13,
67,
4906,
8,
198,
2,
3601,
7,
46188,
62,
2340,
13,
43358,
8,
198,
1416,
2850,
796,
28034,
13,
51,
22854,
26933,
58,
657,
11,
220,
352,
11,
220,
362,
38430,
513,
11,
220,
604,
11,
220,
642,
38430,
718,
11,
220,
767,
11,
220,
807,
38430,
860,
11,
838,
11,
1367,
11907,
8,
198,
198,
64,
28,
1416,
2850,
58,
15,
25,
17,
60,
198,
2,
3601,
7,
64,
8,
198,
2,
3601,
7,
1416,
2850,
13,
67,
4906,
8,
198,
2,
3601,
7,
1416,
2850,
13,
43358,
8,
198,
2,
8198,
30109,
16,
11,
17,
11,
18,
11907,
198,
2,
351,
28034,
13,
2306,
519,
6335,
13,
5577,
5329,
13,
13317,
7,
22105,
62,
1477,
7916,
28,
17821,
8,
355,
1534,
25,
198,
2,
3601,
7,
1416,
2850,
30109,
16,
11,
17,
38430,
15,
11,
17,
11907,
8,
198,
2,
3601,
7,
5577,
13,
2539,
62,
8770,
1095,
7,
8094,
62,
1525,
62,
15414,
62,
43358,
28,
17821,
737,
11487,
7,
30619,
62,
1525,
2625,
944,
62,
36166,
62,
2435,
62,
23350,
48774,
198
] | 2.223301 | 206 |
import csv
from decimal import Decimal
from itertools import islice
from datetime import datetime, timedelta
import pytest
from bs4 import BeautifulSoup
from src.jamberry.workstation import extract_shipping_address, extract_line_items, parse_order_row_soup, \
JamberryWorkstation
# uncomment these lines to see requests
# import logging
# logging.basicConfig(level=logging.DEBUG)
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.usefixtures('order_detail_html')
@pytest.mark.usefixtures('order_detail_html')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.usefixtures('order_row_html')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
@pytest.mark.online
@pytest.mark.usefixtures('ws')
| [
11748,
269,
21370,
198,
6738,
32465,
1330,
4280,
4402,
198,
198,
6738,
340,
861,
10141,
1330,
318,
75,
501,
198,
198,
6738,
4818,
8079,
1330,
4818,
8079,
11,
28805,
12514,
198,
11748,
12972,
9288,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
198,
6738,
12351,
13,
73,
7789,
563,
13,
1818,
17529,
1330,
7925,
62,
1477,
4501,
62,
21975,
11,
7925,
62,
1370,
62,
23814,
11,
21136,
62,
2875,
62,
808,
62,
82,
10486,
11,
3467,
198,
220,
220,
220,
449,
7789,
563,
12468,
17529,
628,
198,
2,
8820,
434,
777,
3951,
284,
766,
7007,
198,
2,
1330,
18931,
198,
2,
18931,
13,
35487,
16934,
7,
5715,
28,
6404,
2667,
13,
30531,
8,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
2875,
62,
49170,
62,
6494,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
2875,
62,
49170,
62,
6494,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
2875,
62,
808,
62,
6494,
11537,
628,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
628,
198,
198,
31,
9078,
9288,
13,
4102,
13,
25119,
198,
31,
9078,
9288,
13,
4102,
13,
1904,
69,
25506,
10786,
18504,
11537,
198
] | 2.731707 | 369 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2020-03-28 11:49
from __future__ import unicode_literals
from django.db import migrations
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
1157,
319,
12131,
12,
3070,
12,
2078,
1367,
25,
2920,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.754717 | 53 |
"""
clustering_utils.py: utilitary functions for the clustering.py module.
"""
import numpy as np
from enum import IntEnum
from .utils import find_in_sequence
class Link(IntEnum):
"""
Represents state of coreferring links.
Must be negative integers to not interfere with the clustering process.
"""
NO_ANTECEDENT = -1
PROCESSED = -2
def cluster_labels_to_entity_clusters(cluster_labels):
"""
@cluster_labels is the second return from the affinity_matrix computation,
and cluster_labels[mention_idx] = mention's cluster
"""
clusters = dict()
for idx, label in enumerate(cluster_labels):
if label not in clusters:
clusters[label] = list()
clusters[label].append(idx)
return [clusters[key] for key in clusters.keys()]
def coreference_links_to_entity_clusters(links):
"""
Transforms the given array of coreference links into a set of entities (mention clusters).
Each entity/cluster is represented by the mentions' indices.
"""
clusters = []
for i in range(len(links) - 1, -1, -1):
new_cluster = set()
j = i
while True:
antecedent = links[j]
links[j] = Link.PROCESSED
new_cluster.add(j)
# end of coreference link
if antecedent == Link.NO_ANTECEDENT:
clusters.append(new_cluster)
break
# linking to previously processed cluster
elif antecedent == Link.PROCESSED:
previous_cluster_idx = find_in_sequence(lambda s: j in s, clusters)
clusters[previous_cluster_idx].update(new_cluster)
break
j = antecedent
return clusters
def generate_affinity_matrix(document, mention_pair_predictions):
"""
Generates an affinity/similarity matrix from the given mention-pair scores.
@returns affinity_matrix[m1_idx, m2_idx] = affinity_score
"""
num_mentions = len(document.mentions)
affinity_matrix = np.ndarray(shape=(num_mentions, num_mentions), dtype=np.float32)
affinity_matrix.fill(0)
for idx in range(len(mention_pair_predictions)):
i1, i2 = document.pairwise_combinations[idx]
affinity_matrix[i1,i2] = mention_pair_predictions[idx]
affinity_matrix[i2,i1] = mention_pair_predictions[idx]
return affinity_matrix
| [
37811,
198,
565,
436,
1586,
62,
26791,
13,
9078,
25,
3384,
18748,
5499,
329,
262,
32966,
1586,
13,
9078,
8265,
13,
198,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
33829,
1330,
2558,
4834,
388,
198,
6738,
764,
26791,
1330,
1064,
62,
259,
62,
43167,
628,
198,
4871,
7502,
7,
5317,
4834,
388,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1432,
6629,
1181,
286,
4755,
2232,
1806,
6117,
13,
198,
220,
220,
220,
12039,
307,
4633,
37014,
284,
407,
18135,
351,
262,
32966,
1586,
1429,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8005,
62,
8643,
2943,
1961,
3525,
220,
220,
796,
532,
16,
198,
220,
220,
220,
41755,
7597,
1961,
220,
220,
220,
220,
220,
220,
796,
532,
17,
628,
198,
4299,
13946,
62,
23912,
1424,
62,
1462,
62,
26858,
62,
565,
13654,
7,
565,
5819,
62,
23912,
1424,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2488,
565,
5819,
62,
23912,
1424,
318,
262,
1218,
1441,
422,
262,
28430,
62,
6759,
8609,
29964,
11,
198,
220,
220,
220,
220,
290,
13946,
62,
23912,
1424,
58,
434,
295,
62,
312,
87,
60,
796,
3068,
338,
13946,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
23163,
796,
8633,
3419,
198,
220,
220,
220,
329,
4686,
87,
11,
6167,
287,
27056,
378,
7,
565,
5819,
62,
23912,
1424,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
6167,
407,
287,
23163,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23163,
58,
18242,
60,
796,
1351,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
23163,
58,
18242,
4083,
33295,
7,
312,
87,
8,
628,
220,
220,
220,
1441,
685,
565,
13654,
58,
2539,
60,
329,
1994,
287,
23163,
13,
13083,
3419,
60,
628,
198,
4299,
4755,
4288,
62,
28751,
62,
1462,
62,
26858,
62,
565,
13654,
7,
28751,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3602,
23914,
262,
1813,
7177,
286,
4755,
4288,
6117,
656,
257,
900,
286,
12066,
357,
434,
295,
23163,
737,
198,
220,
220,
220,
5501,
9312,
14,
565,
5819,
318,
7997,
416,
262,
15802,
6,
36525,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
23163,
796,
17635,
198,
220,
220,
220,
329,
1312,
287,
2837,
7,
11925,
7,
28751,
8,
532,
352,
11,
532,
16,
11,
532,
16,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
565,
5819,
796,
900,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
474,
796,
1312,
628,
220,
220,
220,
220,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29692,
771,
298,
796,
6117,
58,
73,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6117,
58,
73,
60,
796,
7502,
13,
4805,
4503,
7597,
1961,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
565,
5819,
13,
2860,
7,
73,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
886,
286,
4755,
4288,
2792,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
29692,
771,
298,
6624,
7502,
13,
15285,
62,
8643,
2943,
1961,
3525,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23163,
13,
33295,
7,
3605,
62,
565,
5819,
8,
198,
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,
17795,
284,
4271,
13686,
13946,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
29692,
771,
298,
6624,
7502,
13,
4805,
4503,
7597,
1961,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2180,
62,
565,
5819,
62,
312,
87,
796,
1064,
62,
259,
62,
43167,
7,
50033,
264,
25,
474,
287,
264,
11,
23163,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23163,
58,
3866,
1442,
62,
565,
5819,
62,
312,
87,
4083,
19119,
7,
3605,
62,
565,
5819,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
474,
796,
29692,
771,
298,
628,
220,
220,
220,
1441,
23163,
198,
220,
220,
220,
220,
198,
198,
4299,
7716,
62,
2001,
6269,
62,
6759,
8609,
7,
22897,
11,
3068,
62,
24874,
62,
28764,
9278,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2980,
689,
281,
28430,
14,
38610,
414,
17593,
422,
262,
1813,
3068,
12,
24874,
8198,
13,
198,
220,
220,
220,
2488,
7783,
82,
28430,
62,
6759,
8609,
58,
76,
16,
62,
312,
87,
11,
285,
17,
62,
312,
87,
60,
796,
28430,
62,
26675,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
997,
62,
434,
507,
796,
18896,
7,
22897,
13,
434,
507,
8,
198,
220,
220,
220,
28430,
62,
6759,
8609,
796,
45941,
13,
358,
18747,
7,
43358,
16193,
22510,
62,
434,
507,
11,
997,
62,
434,
507,
828,
288,
4906,
28,
37659,
13,
22468,
2624,
8,
198,
220,
220,
220,
28430,
62,
6759,
8609,
13,
20797,
7,
15,
8,
628,
220,
220,
220,
329,
4686,
87,
287,
2837,
7,
11925,
7,
434,
295,
62,
24874,
62,
28764,
9278,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
16,
11,
1312,
17,
796,
3188,
13,
24874,
3083,
62,
24011,
7352,
58,
312,
87,
60,
198,
220,
220,
220,
220,
220,
220,
220,
28430,
62,
6759,
8609,
58,
72,
16,
11,
72,
17,
60,
796,
3068,
62,
24874,
62,
28764,
9278,
58,
312,
87,
60,
198,
220,
220,
220,
220,
220,
220,
220,
28430,
62,
6759,
8609,
58,
72,
17,
11,
72,
16,
60,
796,
3068,
62,
24874,
62,
28764,
9278,
58,
312,
87,
60,
628,
220,
220,
220,
1441,
28430,
62,
6759,
8609,
198
] | 2.395792 | 998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.