content
stringlengths 1
1.04M
| input_ids
sequencelengths 1
774k
| ratio_char_token
float64 0.38
22.9
| token_count
int64 1
774k
|
---|---|---|---|
# Guess The No
n = 45
attempt = 0
NoOfGuess = 9
while NoOfGuess > 0:
attempt += 1
print("---------------------------------")
No = int(input("Enter a No:-"))
if No == n:
print("Congratulations You won!")
print("Total Attempt Taken:-", attempt)
break
elif No < n:
print("Given No is Smaller")
else:
print("Given No is Greater")
NoOfGuess -= 1
print("---------------------------------")
if NoOfGuess == 0:
print("Game Over! The Number was ",n)
else:
print("No of Guesses left: ", NoOfGuess)
| [
2,
37571,
383,
1400,
198,
77,
796,
4153,
198,
1078,
1791,
796,
657,
198,
2949,
5189,
8205,
408,
796,
860,
198,
198,
4514,
1400,
5189,
8205,
408,
1875,
657,
25,
198,
220,
220,
220,
2230,
15853,
352,
198,
220,
220,
220,
3601,
7203,
3880,
12,
4943,
198,
220,
220,
220,
1400,
796,
493,
7,
15414,
7203,
17469,
257,
1400,
25,
21215,
4008,
628,
220,
220,
220,
611,
1400,
6624,
299,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
45048,
921,
1839,
2474,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
14957,
25770,
30222,
21912,
1600,
2230,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2270,
628,
220,
220,
220,
1288,
361,
1400,
1279,
299,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
15056,
1400,
318,
10452,
263,
4943,
628,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
15056,
1400,
318,
18169,
4943,
198,
220,
220,
220,
1400,
5189,
8205,
408,
48185,
352,
628,
220,
220,
220,
3601,
7203,
3880,
12,
4943,
198,
220,
220,
220,
611,
1400,
5189,
8205,
408,
6624,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
8777,
3827,
0,
383,
7913,
373,
33172,
77,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
2949,
286,
37571,
274,
1364,
25,
33172,
1400,
5189,
8205,
408,
8,
198
] | 2.47479 | 238 |
#!/usr/bin/env python
# -------------------------------------------------------------------------- #
# System
# -------------------------------------------------------------------------- #
import os
import getpass
import pickle
from threading import Thread
# -------------------------------------------------------------------------- #
# SNMP Simulator
# -------------------------------------------------------------------------- #
from twisted.internet import reactor
from twisted.internet import error as twisted_error
from pymodbus.server.async import ModbusServerFactory
from pymodbus.datastore import ModbusServerContext,ModbusSlaveContext
# -------------------------------------------------------------------------- #
# Logging
# -------------------------------------------------------------------------- #
import logging
log = logging.getLogger("pymodbus")
# -------------------------------------------------------------------------- #
# Application Error
# -------------------------------------------------------------------------- #
class ConfigurationException(Exception):
""" Exception for configuration error """
pass
# -------------------------------------------------------------------------- #
# Extra Global Functions
# -------------------------------------------------------------------------- #
# These are extra helper functions that don't belong in a class
# -------------------------------------------------------------------------- #
def root_test():
""" Simple test to see if we are running as root """
return getpass.getuser() == "root"
# -------------------------------------------------------------------------- #
# Simulator Class
# -------------------------------------------------------------------------- #
class Simulator(object):
"""
Class used to parse configuration file and create and modbus
datastore.
The format of the configuration file is actually just a
python pickle, which is a compressed memory dump from
the scraper.
"""
def __init__(self, config):
"""
Trys to load a configuration file, lets the file not
found exception fall through
:param config: The pickled datastore
"""
try:
self.file = open(config, "r")
except Exception:
raise ConfigurationException("File not found %s" % config)
def _parse(self):
""" Parses the config file and creates a server context """
try:
handle = pickle.load(self.file)
dsd = handle['di']
csd = handle['ci']
hsd = handle['hr']
isd = handle['ir']
except KeyError:
raise ConfigurationException("Invalid Configuration")
slave = ModbusSlaveContext(d=dsd, c=csd, h=hsd, i=isd)
return ModbusServerContext(slaves=slave)
def _simulator(self):
""" Starts the snmp simulator """
ports = [502]+range(20000,25000)
for port in ports:
try:
reactor.listenTCP(port, ModbusServerFactory(self._parse()))
log.debug('listening on port %d' % port)
return port
except twisted_error.CannotListenError:
pass
def run(self):
""" Used to run the simulator """
log.debug('simulator started')
reactor.callWhenRunning(self._simulator)
# -------------------------------------------------------------------------- #
# Network reset thread
# -------------------------------------------------------------------------- #
# This is linux only, maybe I should make a base class that can be filled
# in for linux(debian/redhat)/windows/nix
# -------------------------------------------------------------------------- #
class NetworkReset(Thread):
"""
This class is simply a daemon that is spun off at the end of the
program to call the network restart function (an easy way to
remove all the virtual interfaces)
"""
def __init__(self):
""" Initialize a new network reset thread """
Thread.__init__(self)
self.setDaemon(True)
def run(self):
""" Run the network reset """
os.system("/etc/init.d/networking restart")
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
16529,
35937,
1303,
198,
2,
4482,
198,
2,
16529,
35937,
1303,
198,
11748,
28686,
198,
11748,
651,
6603,
198,
11748,
2298,
293,
198,
6738,
4704,
278,
1330,
14122,
198,
198,
2,
16529,
35937,
1303,
198,
2,
11346,
7378,
13942,
198,
2,
16529,
35937,
1303,
198,
6738,
19074,
13,
37675,
1330,
21905,
198,
6738,
19074,
13,
37675,
1330,
4049,
355,
19074,
62,
18224,
198,
6738,
12972,
4666,
10885,
13,
15388,
13,
292,
13361,
1330,
3401,
10885,
10697,
22810,
198,
6738,
12972,
4666,
10885,
13,
19608,
459,
382,
1330,
3401,
10885,
10697,
21947,
11,
5841,
10885,
11122,
1015,
21947,
198,
198,
2,
16529,
35937,
1303,
198,
2,
5972,
2667,
198,
2,
16529,
35937,
1303,
198,
11748,
18931,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7203,
9078,
4666,
10885,
4943,
198,
198,
2,
16529,
35937,
1303,
198,
2,
15678,
13047,
198,
2,
16529,
35937,
1303,
628,
198,
4871,
28373,
16922,
7,
16922,
2599,
198,
220,
220,
220,
37227,
35528,
329,
8398,
4049,
37227,
198,
220,
220,
220,
1208,
198,
198,
2,
16529,
35937,
1303,
198,
2,
17221,
8060,
40480,
198,
2,
16529,
35937,
1303,
198,
2,
2312,
389,
3131,
31904,
5499,
326,
836,
470,
5594,
287,
257,
1398,
198,
2,
16529,
35937,
1303,
628,
198,
4299,
6808,
62,
9288,
33529,
198,
220,
220,
220,
37227,
17427,
1332,
284,
766,
611,
356,
389,
2491,
355,
6808,
37227,
198,
220,
220,
220,
1441,
651,
6603,
13,
1136,
7220,
3419,
6624,
366,
15763,
1,
198,
198,
2,
16529,
35937,
1303,
198,
2,
13942,
5016,
198,
2,
16529,
35937,
1303,
628,
198,
4871,
13942,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5016,
973,
284,
21136,
8398,
2393,
290,
2251,
290,
953,
10885,
198,
220,
220,
220,
4818,
459,
382,
13,
628,
220,
220,
220,
383,
5794,
286,
262,
8398,
2393,
318,
1682,
655,
257,
198,
220,
220,
220,
21015,
2298,
293,
11,
543,
318,
257,
25388,
4088,
10285,
422,
198,
220,
220,
220,
262,
19320,
525,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
4566,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
9993,
82,
284,
3440,
257,
8398,
2393,
11,
8781,
262,
2393,
407,
198,
220,
220,
220,
220,
220,
220,
220,
1043,
6631,
2121,
832,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4566,
25,
383,
2298,
992,
4818,
459,
382,
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,
2116,
13,
7753,
796,
1280,
7,
11250,
11,
366,
81,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
35528,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
28373,
16922,
7203,
8979,
407,
1043,
4064,
82,
1,
4064,
4566,
8,
628,
220,
220,
220,
825,
4808,
29572,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
23042,
274,
262,
4566,
2393,
290,
8075,
257,
4382,
4732,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5412,
796,
2298,
293,
13,
2220,
7,
944,
13,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
21282,
796,
5412,
17816,
10989,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
21282,
796,
5412,
17816,
979,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
21282,
796,
5412,
17816,
11840,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
67,
796,
5412,
17816,
343,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
7383,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
28373,
16922,
7203,
44651,
28373,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
11778,
796,
3401,
10885,
11122,
1015,
21947,
7,
67,
28,
9310,
67,
11,
269,
28,
6359,
67,
11,
289,
28,
11994,
67,
11,
1312,
28,
9409,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
3401,
10885,
10697,
21947,
7,
6649,
3080,
28,
36341,
8,
628,
220,
220,
220,
825,
4808,
14323,
8927,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
50181,
262,
3013,
3149,
35375,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
14090,
796,
685,
35126,
48688,
9521,
7,
2167,
405,
11,
1495,
830,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2493,
287,
14090,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21905,
13,
4868,
268,
4825,
47,
7,
634,
11,
3401,
10885,
10697,
22810,
7,
944,
13557,
29572,
3419,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2604,
13,
24442,
10786,
4868,
3101,
319,
2493,
4064,
67,
6,
4064,
2493,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2493,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
19074,
62,
18224,
13,
34,
34574,
23061,
12331,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1208,
628,
220,
220,
220,
825,
1057,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
16718,
284,
1057,
262,
35375,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
13,
24442,
10786,
14323,
8927,
2067,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
21905,
13,
13345,
2215,
28768,
7,
944,
13557,
14323,
8927,
8,
198,
198,
2,
16529,
35937,
1303,
198,
2,
7311,
13259,
4704,
198,
2,
16529,
35937,
1303,
198,
2,
770,
318,
32639,
691,
11,
3863,
314,
815,
787,
257,
2779,
1398,
326,
460,
307,
5901,
198,
2,
287,
329,
32639,
7,
24689,
14,
445,
5183,
20679,
28457,
14,
77,
844,
198,
2,
16529,
35937,
1303,
628,
198,
4871,
7311,
4965,
316,
7,
16818,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
770,
1398,
318,
2391,
257,
33386,
326,
318,
26843,
572,
379,
262,
886,
286,
262,
198,
220,
220,
220,
1430,
284,
869,
262,
3127,
15765,
2163,
357,
272,
2562,
835,
284,
198,
220,
220,
220,
4781,
477,
262,
7166,
20314,
8,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
20768,
1096,
257,
649,
3127,
13259,
4704,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
14122,
13,
834,
15003,
834,
7,
944,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2617,
26531,
7966,
7,
17821,
8,
628,
220,
220,
220,
825,
1057,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5660,
262,
3127,
13259,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
10057,
7203,
14,
14784,
14,
15003,
13,
67,
14,
3262,
16090,
15765,
4943,
198
] | 3.540586 | 1,195 |
import logging
import pytest
from promise import Promise
from graphene import InputObjectType
from graphene.relay import Connection
from sqlalchemy import inspect
from .models import Editor as EditorModel
from .models import Pet as PetModel
from ..fields import SQLAlchemyConnectionField, SQLAlchemyFilteredConnectionField
from ..types import SQLAlchemyObjectType
log = logging.getLogger(__name__)
| [
11748,
18931,
198,
198,
11748,
12972,
9288,
198,
6738,
6991,
1330,
34920,
198,
198,
6738,
42463,
1330,
23412,
10267,
6030,
198,
6738,
42463,
13,
2411,
323,
1330,
26923,
198,
6738,
44161,
282,
26599,
1330,
10104,
198,
198,
6738,
764,
27530,
1330,
12058,
355,
12058,
17633,
198,
6738,
764,
27530,
1330,
4767,
355,
4767,
17633,
198,
6738,
11485,
25747,
1330,
16363,
2348,
26599,
32048,
15878,
11,
16363,
2348,
26599,
11928,
4400,
32048,
15878,
198,
6738,
11485,
19199,
1330,
16363,
2348,
26599,
10267,
6030,
198,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
628,
628,
628,
628
] | 4.069307 | 101 |
import aiml
kernel = aiml.Kernel()
kernel.learn("startup.xml")
kernel.respond("load aiml")
while True:
print(kernel.respond(raw_input("Message >>"))) | [
11748,
4031,
75,
198,
198,
33885,
796,
4031,
75,
13,
42,
7948,
3419,
198,
33885,
13,
35720,
7203,
9688,
929,
13,
19875,
4943,
198,
33885,
13,
5546,
7203,
2220,
4031,
75,
4943,
198,
198,
4514,
6407,
25,
198,
220,
220,
220,
3601,
7,
33885,
13,
5546,
7,
1831,
62,
15414,
7203,
12837,
9609,
1,
22305
] | 2.818182 | 55 |
import paddle.nn as nn
from .backbones.mix_transformer import MixVisionTransformer
from .decoders.segformer_head import SegformerHead
class Segformer(nn.Layer):
"""Segformer model implementation
""" | [
11748,
39517,
13,
20471,
355,
299,
77,
198,
198,
6738,
764,
1891,
35095,
13,
19816,
62,
7645,
16354,
1330,
15561,
44206,
8291,
16354,
198,
6738,
764,
12501,
375,
364,
13,
325,
70,
16354,
62,
2256,
1330,
31220,
16354,
13847,
628,
198,
4871,
31220,
16354,
7,
20471,
13,
49925,
2599,
198,
220,
220,
220,
37227,
41030,
16354,
2746,
7822,
198,
220,
220,
220,
220,
198,
220,
220,
220,
37227
] | 3.147059 | 68 |
# symbolic dispatch wrapper ---------------------------------------------------
from functools import singledispatch, update_wrapper, wraps
import inspect
from .calls import Call, FuncArg, MetaArg, Lazy
from .symbolic import Symbolic, create_sym_call, strip_symbolic
def symbolic_dispatch(f = None, cls = object):
"""Return a generic dispatch function with symbolic data implementations.
The function dispatches (Call or Symbolic) -> FuncArg.
Parameters
----------
cls :
A class to dispatch on.
f :
A function to call if no classes match while dispatching.
Examples
--------
Here is an example of running separate add functions on integers and strings.
>>> @symbolic_dispatch(cls = int)
... def add1(x): return x + 1
>>> @add1.register(str)
... def _add1_str(x): return int(x) + 1
>>> add1(1)
2
>>> add1("1")
2
Note that passing a symbolic causes it to return a symbolic, so you can continue
creating expressions.
>>> from siuba.siu import _
>>> type(add1(_.a.b) + _.c.d)
<class 'siuba.siu.symbolic.Symbolic'>
symbolic dispatch raises a NotImplementedError by default if it no function ``f``
is passed. However, you can override the default as follows:
>>> @symbolic_dispatch
... def my_func(x): raise NotImplementedError("some error message")
"""
if f is None:
return lambda f: symbolic_dispatch(f, cls)
# TODO: don't use singledispatch if it has already been done
dispatch_func = singledispatch(f)
if cls is not object:
dispatch_func.register(cls, f)
dispatch_func.register(object, _dispatch_not_impl(dispatch_func.__name__))
@dispatch_func.register(Symbolic)
@dispatch_func.register(Call)
return dispatch_func
# Verb dispatch ==============================================================
def pipe_no_args(f):
"""Register a concrete function that handles when a verb received no arguments."""
@f.register(NoArgs)
return f
def register_pipe(f, cls):
"""Register a concrete function that returns a Pipeable when called."""
@f.register(cls)
return f
def register_pipe_call(f):
"""Register a concrete function that ."""
@f.register(Call)
return f
# option: no args, custom dispatch (e.g. register NoArgs)
# strips symbols
def verb_dispatch(cls, f = None):
"""Wrap singledispatch. Making sure to keep its attributes on the wrapper.
This wrapper has three jobs:
1. strip symbols off of calls
2. pass NoArgs instance for calls like some_func(), so dispatcher can handle
3. return a Pipeable when the first arg of a call is a symbol
Parameters
----------
cls :
A class to dispatch on.
f :
A function to call if no classes match while dispatching.
"""
# classic way of allowing args to a decorator
if f is None:
return lambda f: verb_dispatch(cls, f)
# initially registers func for object, so need to change to pd.DataFrame
dispatch_func = singledispatch(f)
if isinstance(cls, tuple):
for c in cls: dispatch_func.register(c, f)
else:
dispatch_func.register(cls, f)
# then, set the default object dispatcher to create a pipe
register_pipe(dispatch_func, object)
# register dispatcher for Call, and NoArgs
register_pipe_call(dispatch_func)
pipe_no_args(dispatch_func)
@wraps(dispatch_func)
return wrapper
# TODO: deprecate / remove singledispatch2
singledispatch2 = verb_dispatch
# Pipe ========================================================================
class Pipeable:
"""Enable function composition through the right bitshift (>>) operator.
Parameters
----------
f :
A function to be called.
calls : sequence, optional
A list-like of functions to be called, with each result chained into the next.
Examples
--------
>>> f = lambda x: x + 1
Eager evaluation:
>>> 1 >> Pipeable(f)
2
Defer to a pipe:
>>> p = Pipeable(f) >> Pipeable(f)
>>> 1 >> p
3
>>> p_undo = p >> (lambda x: x - 3)
>>> 1 >> p_undo
0
>>> from siuba.siu import _
>>> p_undo_sym = p >> (_ - 3)
>>> 1 >> p_undo_sym
0
"""
def __rshift__(self, x) -> "Pipeable":
"""Defer evaluation when pipe is on the left (lazy piping)."""
if isinstance(x, Pipeable):
return Pipeable(calls = self.calls + x.calls)
elif isinstance(x, (Symbolic, Call)):
call = strip_symbolic(x)
return Pipeable(calls = self.calls + [call])
elif callable(x):
return Pipeable(calls = self.calls + [x])
raise Exception()
def __rrshift__(self, x):
"""Potentially evaluate result when pipe is on the right (eager piping).
This function handles two cases:
* callable >> pipe -> pipe
* otherewise, evaluate the pipe
"""
if isinstance(x, (Symbolic, Call)):
call = strip_symbolic(x)
return Pipeable(calls = [call] + self.calls)
elif callable(x):
return Pipeable(calls = [x] + self.calls)
return self(x)
def __call__(self, x):
"""Evaluate a pipe and return the result.
Parameters
----------
x :
An object to be passed into the first function in the pipe.
"""
res = x
for f in self.calls:
res = f(res)
return res
def create_pipe_call(obj, *args, **kwargs) -> Pipeable:
"""Return a Call of a function on its args and kwargs, wrapped in a Pipeable."""
first, *rest = args
return Pipeable(Call(
"__call__",
strip_symbolic(obj),
strip_symbolic(first),
*(Lazy(strip_symbolic(x)) for x in rest),
**{k: Lazy(strip_symbolic(v)) for k,v in kwargs.items()}
))
| [
2,
18975,
27965,
29908,
20368,
1783,
6329,
198,
198,
6738,
1257,
310,
10141,
1330,
31958,
8802,
963,
11,
4296,
62,
48553,
11,
27521,
198,
11748,
10104,
198,
198,
6738,
764,
66,
5691,
1330,
4889,
11,
11138,
66,
28100,
11,
30277,
28100,
11,
406,
12582,
198,
6738,
764,
1837,
2022,
4160,
1330,
41327,
4160,
11,
2251,
62,
37047,
62,
13345,
11,
10283,
62,
1837,
2022,
4160,
198,
198,
4299,
18975,
62,
6381,
17147,
7,
69,
796,
6045,
11,
537,
82,
796,
2134,
2599,
198,
220,
220,
220,
37227,
13615,
257,
14276,
27965,
2163,
351,
18975,
1366,
25504,
13,
628,
220,
220,
220,
383,
2163,
4596,
20981,
357,
14134,
393,
41327,
4160,
8,
4613,
11138,
66,
28100,
13,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
537,
82,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
317,
1398,
284,
27965,
319,
13,
198,
220,
220,
220,
277,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
317,
2163,
284,
869,
611,
645,
6097,
2872,
981,
4596,
19775,
13,
628,
220,
220,
220,
21066,
198,
220,
220,
220,
24200,
628,
220,
220,
220,
3423,
318,
281,
1672,
286,
2491,
4553,
751,
5499,
319,
37014,
290,
13042,
13,
628,
220,
220,
220,
13163,
2488,
1837,
2022,
4160,
62,
6381,
17147,
7,
565,
82,
796,
493,
8,
198,
220,
220,
220,
2644,
825,
751,
16,
7,
87,
2599,
1441,
2124,
1343,
352,
198,
220,
220,
220,
220,
198,
220,
220,
220,
13163,
2488,
2860,
16,
13,
30238,
7,
2536,
8,
198,
220,
220,
220,
2644,
825,
4808,
2860,
16,
62,
2536,
7,
87,
2599,
1441,
493,
7,
87,
8,
1343,
352,
628,
220,
220,
220,
13163,
751,
16,
7,
16,
8,
198,
220,
220,
220,
362,
628,
220,
220,
220,
13163,
751,
16,
7203,
16,
4943,
198,
220,
220,
220,
362,
628,
220,
220,
220,
5740,
326,
6427,
257,
18975,
5640,
340,
284,
1441,
257,
18975,
11,
523,
345,
460,
2555,
198,
220,
220,
220,
4441,
14700,
13,
628,
220,
220,
220,
13163,
422,
33721,
22013,
13,
13396,
84,
1330,
4808,
198,
220,
220,
220,
13163,
2099,
7,
2860,
16,
28264,
13,
64,
13,
65,
8,
1343,
4808,
13,
66,
13,
67,
8,
198,
220,
220,
220,
1279,
4871,
705,
13396,
22013,
13,
13396,
84,
13,
1837,
2022,
4160,
13,
13940,
2022,
4160,
44167,
198,
220,
220,
220,
220,
198,
220,
220,
220,
18975,
27965,
12073,
257,
1892,
3546,
1154,
12061,
12331,
416,
4277,
611,
340,
645,
2163,
7559,
69,
15506,
198,
220,
220,
220,
318,
3804,
13,
2102,
11,
345,
460,
20957,
262,
4277,
355,
5679,
25,
198,
220,
220,
220,
220,
198,
220,
220,
220,
13163,
2488,
1837,
2022,
4160,
62,
6381,
17147,
198,
220,
220,
220,
2644,
825,
616,
62,
20786,
7,
87,
2599,
5298,
1892,
3546,
1154,
12061,
12331,
7203,
11246,
4049,
3275,
4943,
628,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
277,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
37456,
277,
25,
18975,
62,
6381,
17147,
7,
69,
11,
537,
82,
8,
628,
220,
220,
220,
1303,
16926,
46,
25,
836,
470,
779,
31958,
8802,
963,
611,
340,
468,
1541,
587,
1760,
198,
220,
220,
220,
27965,
62,
20786,
796,
31958,
8802,
963,
7,
69,
8,
628,
220,
220,
220,
611,
537,
82,
318,
407,
2134,
25,
198,
220,
220,
220,
220,
220,
220,
220,
27965,
62,
20786,
13,
30238,
7,
565,
82,
11,
277,
8,
198,
220,
220,
220,
220,
220,
220,
220,
27965,
62,
20786,
13,
30238,
7,
15252,
11,
4808,
6381,
17147,
62,
1662,
62,
23928,
7,
6381,
17147,
62,
20786,
13,
834,
3672,
834,
4008,
628,
198,
220,
220,
220,
2488,
6381,
17147,
62,
20786,
13,
30238,
7,
13940,
2022,
4160,
8,
628,
220,
220,
220,
2488,
6381,
17147,
62,
20786,
13,
30238,
7,
14134,
8,
628,
220,
220,
220,
1441,
27965,
62,
20786,
628,
198,
2,
49973,
27965,
220,
46111,
4770,
25609,
28,
198,
198,
4299,
12656,
62,
3919,
62,
22046,
7,
69,
2599,
198,
220,
220,
220,
37227,
38804,
257,
10017,
2163,
326,
17105,
618,
257,
15942,
2722,
645,
7159,
526,
15931,
198,
220,
220,
220,
2488,
69,
13,
30238,
7,
2949,
42035,
8,
628,
220,
220,
220,
1441,
277,
198,
198,
4299,
7881,
62,
34360,
7,
69,
11,
537,
82,
2599,
198,
220,
220,
220,
37227,
38804,
257,
10017,
2163,
326,
5860,
257,
36039,
540,
618,
1444,
526,
15931,
198,
220,
220,
220,
2488,
69,
13,
30238,
7,
565,
82,
8,
198,
220,
220,
220,
1441,
277,
198,
198,
4299,
7881,
62,
34360,
62,
13345,
7,
69,
2599,
198,
220,
220,
220,
37227,
38804,
257,
10017,
2163,
326,
22135,
15931,
198,
220,
220,
220,
2488,
69,
13,
30238,
7,
14134,
8,
628,
220,
220,
220,
1441,
277,
628,
198,
198,
2,
3038,
25,
645,
26498,
11,
2183,
27965,
357,
68,
13,
70,
13,
7881,
1400,
42035,
8,
198,
2,
22670,
14354,
198,
4299,
15942,
62,
6381,
17147,
7,
565,
82,
11,
277,
796,
6045,
2599,
198,
220,
220,
220,
37227,
54,
2416,
31958,
8802,
963,
13,
16427,
1654,
284,
1394,
663,
12608,
319,
262,
29908,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
770,
29908,
468,
1115,
3946,
25,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
10283,
14354,
572,
286,
3848,
198,
220,
220,
220,
220,
220,
220,
220,
362,
13,
1208,
1400,
42035,
4554,
329,
3848,
588,
617,
62,
20786,
22784,
523,
49952,
460,
5412,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
1441,
257,
36039,
540,
618,
262,
717,
1822,
286,
257,
869,
318,
257,
6194,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
537,
82,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
317,
1398,
284,
27965,
319,
13,
198,
220,
220,
220,
277,
1058,
220,
198,
220,
220,
220,
220,
220,
220,
220,
317,
2163,
284,
869,
611,
645,
6097,
2872,
981,
4596,
19775,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1303,
6833,
835,
286,
5086,
26498,
284,
257,
11705,
1352,
198,
220,
220,
220,
611,
277,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
37456,
277,
25,
15942,
62,
6381,
17147,
7,
565,
82,
11,
277,
8,
628,
220,
220,
220,
1303,
7317,
28441,
25439,
329,
2134,
11,
523,
761,
284,
1487,
284,
279,
67,
13,
6601,
19778,
198,
220,
220,
220,
27965,
62,
20786,
796,
31958,
8802,
963,
7,
69,
8,
198,
220,
220,
220,
611,
318,
39098,
7,
565,
82,
11,
46545,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
329,
269,
287,
537,
82,
25,
27965,
62,
20786,
13,
30238,
7,
66,
11,
277,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
27965,
62,
20786,
13,
30238,
7,
565,
82,
11,
277,
8,
198,
220,
220,
220,
1303,
788,
11,
900,
262,
4277,
2134,
49952,
284,
2251,
257,
12656,
198,
220,
220,
220,
7881,
62,
34360,
7,
6381,
17147,
62,
20786,
11,
2134,
8,
628,
220,
220,
220,
1303,
7881,
49952,
329,
4889,
11,
290,
1400,
42035,
198,
220,
220,
220,
7881,
62,
34360,
62,
13345,
7,
6381,
17147,
62,
20786,
8,
198,
220,
220,
220,
12656,
62,
3919,
62,
22046,
7,
6381,
17147,
62,
20786,
8,
628,
220,
220,
220,
2488,
29988,
862,
7,
6381,
17147,
62,
20786,
8,
628,
220,
220,
220,
1441,
29908,
198,
198,
2,
16926,
46,
25,
1207,
8344,
378,
1220,
4781,
31958,
8802,
963,
17,
198,
12215,
992,
8802,
963,
17,
796,
15942,
62,
6381,
17147,
628,
198,
2,
36039,
38093,
1421,
18604,
198,
198,
4871,
36039,
540,
25,
198,
220,
220,
220,
37227,
36695,
2163,
11742,
832,
262,
826,
10340,
29323,
357,
4211,
8,
10088,
13,
628,
220,
220,
220,
40117,
198,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
277,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
317,
2163,
284,
307,
1444,
13,
198,
220,
220,
220,
3848,
1058,
8379,
11,
11902,
198,
220,
220,
220,
220,
220,
220,
220,
317,
1351,
12,
2339,
286,
5499,
284,
307,
1444,
11,
351,
1123,
1255,
40682,
656,
262,
1306,
13,
628,
220,
220,
220,
21066,
198,
220,
220,
220,
24200,
628,
220,
220,
220,
13163,
277,
796,
37456,
2124,
25,
2124,
1343,
352,
628,
220,
220,
220,
412,
3536,
12660,
25,
628,
220,
220,
220,
13163,
352,
9609,
36039,
540,
7,
69,
8,
198,
220,
220,
220,
362,
628,
220,
220,
220,
2896,
263,
284,
257,
12656,
25,
628,
220,
220,
220,
13163,
279,
796,
36039,
540,
7,
69,
8,
9609,
36039,
540,
7,
69,
8,
198,
220,
220,
220,
13163,
352,
9609,
279,
198,
220,
220,
220,
513,
628,
220,
220,
220,
13163,
279,
62,
41204,
796,
279,
9609,
357,
50033,
2124,
25,
2124,
532,
513,
8,
198,
220,
220,
220,
13163,
352,
9609,
279,
62,
41204,
198,
220,
220,
220,
657,
628,
220,
220,
220,
13163,
422,
33721,
22013,
13,
13396,
84,
1330,
4808,
198,
220,
220,
220,
13163,
279,
62,
41204,
62,
37047,
796,
279,
9609,
44104,
532,
513,
8,
198,
220,
220,
220,
13163,
352,
9609,
279,
62,
41204,
62,
37047,
198,
220,
220,
220,
657,
628,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
81,
30846,
834,
7,
944,
11,
2124,
8,
4613,
366,
47,
3757,
540,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
7469,
263,
12660,
618,
12656,
318,
319,
262,
1364,
357,
75,
12582,
48426,
21387,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
87,
11,
36039,
540,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
36039,
540,
7,
66,
5691,
796,
2116,
13,
66,
5691,
1343,
2124,
13,
66,
5691,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
318,
39098,
7,
87,
11,
357,
13940,
2022,
4160,
11,
4889,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
869,
796,
10283,
62,
1837,
2022,
4160,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
36039,
540,
7,
66,
5691,
796,
2116,
13,
66,
5691,
1343,
685,
13345,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
869,
540,
7,
87,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
36039,
540,
7,
66,
5691,
796,
2116,
13,
66,
5691,
1343,
685,
87,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
5298,
35528,
3419,
628,
220,
220,
220,
825,
11593,
21062,
30846,
834,
7,
944,
11,
2124,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
25396,
3746,
13446,
1255,
618,
12656,
318,
319,
262,
826,
357,
68,
3536,
48426,
737,
628,
220,
220,
220,
220,
220,
220,
220,
770,
2163,
17105,
734,
2663,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
869,
540,
9609,
12656,
4613,
12656,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
267,
1169,
1809,
786,
11,
13446,
262,
12656,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
87,
11,
357,
13940,
2022,
4160,
11,
4889,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
869,
796,
10283,
62,
1837,
2022,
4160,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
36039,
540,
7,
66,
5691,
796,
685,
13345,
60,
1343,
2116,
13,
66,
5691,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
869,
540,
7,
87,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
36039,
540,
7,
66,
5691,
796,
685,
87,
60,
1343,
2116,
13,
66,
5691,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
7,
87,
8,
628,
220,
220,
220,
825,
11593,
13345,
834,
7,
944,
11,
2124,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
36,
2100,
4985,
257,
12656,
290,
1441,
262,
1255,
13,
628,
220,
220,
220,
220,
220,
220,
220,
40117,
198,
220,
220,
220,
220,
220,
220,
220,
24200,
438,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1052,
2134,
284,
307,
3804,
656,
262,
717,
2163,
287,
262,
12656,
13,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
329,
277,
287,
2116,
13,
66,
5691,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
581,
796,
277,
7,
411,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
581,
628,
198,
4299,
2251,
62,
34360,
62,
13345,
7,
26801,
11,
1635,
22046,
11,
12429,
46265,
22046,
8,
4613,
36039,
540,
25,
198,
220,
220,
220,
37227,
13615,
257,
4889,
286,
257,
2163,
319,
663,
26498,
290,
479,
86,
22046,
11,
12908,
287,
257,
36039,
540,
526,
15931,
198,
220,
220,
220,
717,
11,
1635,
2118,
796,
26498,
198,
220,
220,
220,
1441,
36039,
540,
7,
14134,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
834,
13345,
834,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10283,
62,
1837,
2022,
4160,
7,
26801,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10283,
62,
1837,
2022,
4160,
7,
11085,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
7,
43,
12582,
7,
36311,
62,
1837,
2022,
4160,
7,
87,
4008,
329,
2124,
287,
1334,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12429,
90,
74,
25,
406,
12582,
7,
36311,
62,
1837,
2022,
4160,
7,
85,
4008,
329,
479,
11,
85,
287,
479,
86,
22046,
13,
23814,
3419,
92,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15306,
628
] | 2.576956 | 2,326 |
import tensorflow as tf
from tensorflow.contrib.rnn import LSTMCell, MultiRNNCell, DropoutWrapper
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
| [
11748,
11192,
273,
11125,
355,
48700,
201,
198,
6738,
11192,
273,
11125,
13,
3642,
822,
13,
81,
20471,
1330,
406,
2257,
9655,
695,
11,
15237,
49,
6144,
28780,
11,
14258,
448,
36918,
2848,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
201,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
201,
198,
201,
198,
201,
198,
201
] | 2.623188 | 69 |
# =================================================================
#
# Terms and Conditions of Use
#
# Unless otherwise noted, computer program source code of this
# distribution # is covered under Crown Copyright, Government of
# Canada, and is distributed under the MIT License.
#
# The Canada wordmark and related graphics associated with this
# distribution are protected under trademark law and copyright law.
# No permission is granted to use them outside the parameters of
# the Government of Canada's corporate identity program. For
# more information, see
# http://www.tbs-sct.gc.ca/fip-pcim/index-eng.asp
#
# Copyright title to all 3rd party software distributed with this
# software is held by the respective copyright holders as noted in
# those files. Users are asked to read the 3rd Party Licenses
# referenced with those assets.
#
# Copyright (c) 2019 Government of Canada
#
# 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 logging
from sqlalchemy import create_engine
from sqlalchemy.exc import DataError
from sqlalchemy.orm import sessionmaker
from woudc_data_registry import config
LOGGER = logging.getLogger(__name__)
class Registry(object):
"""registry"""
def __init__(self):
"""constructor"""
LOGGER.debug('Creating SQLAlchemy connection')
engine = create_engine(config.WDR_DATABASE_URL,
echo=config.WDR_DB_DEBUG)
Session = sessionmaker(bind=engine, expire_on_commit=False)
self.session = Session()
def query_distinct(self, domain):
"""
queries for distinct values
:param domain: domain to be queried
:returns: list of distinct values
"""
LOGGER.debug('Querying distinct values for {}'.format(domain))
values = [v[0] for v in self.session.query(domain).distinct()]
return values
def query_by_field(self, obj, obj_instance, by):
"""
query data by field
:param obj: object (field) to be queried
:param obj_instance: object instance to be queried
:param by: value to be queried
:returns: query results
"""
field = getattr(obj, by)
value = getattr(obj_instance, by)
LOGGER.debug('Querying for {}={}'.format(field, value))
results = self.session.query(obj).filter(field == value).all()
return results
def query_multiple_fields(self, table, values, fields=None):
"""
query a table by multiple fields
:param table: table to be queried
:param instance: dictionary with query values
:param fields: fields to be filtered by
:returns: query results
"""
conditions = []
if fields is None:
for field in values:
conditions.append(getattr(table, field) == values[field])
else:
for field in fields:
conditions.append(getattr(table, field) == values[field])
results = self.session.query(table).filter(*conditions).first()
return results
def save(self, obj=None):
"""
helper function to save object to registry
:param obj: object to save (defualt None)
:returns: void
"""
try:
LOGGER.debug('Saving')
if obj is not None:
self.session.add(obj)
# self.session.merge(obj)
self.session.commit()
self.session.close()
except DataError as err:
LOGGER.error('Failed to save to registry: {}'.format(err))
self.session.rollback()
| [
2,
38093,
198,
2,
198,
2,
17637,
290,
27617,
286,
5765,
198,
2,
198,
2,
17486,
4306,
4367,
11,
3644,
1430,
2723,
2438,
286,
428,
198,
2,
6082,
1303,
318,
5017,
739,
12223,
15069,
11,
5070,
286,
198,
2,
3340,
11,
290,
318,
9387,
739,
262,
17168,
13789,
13,
198,
2,
198,
2,
383,
3340,
1573,
4102,
290,
3519,
9382,
3917,
351,
428,
198,
2,
6082,
389,
6861,
739,
16028,
1099,
290,
6634,
1099,
13,
198,
2,
1400,
7170,
318,
7520,
284,
779,
606,
2354,
262,
10007,
286,
198,
2,
262,
5070,
286,
3340,
338,
6355,
5369,
1430,
13,
1114,
198,
2,
517,
1321,
11,
766,
198,
2,
2638,
1378,
2503,
13,
83,
1443,
12,
82,
310,
13,
36484,
13,
6888,
14,
69,
541,
12,
14751,
320,
14,
9630,
12,
1516,
13,
5126,
198,
2,
198,
2,
15069,
3670,
284,
477,
513,
4372,
2151,
3788,
9387,
351,
428,
198,
2,
3788,
318,
2714,
416,
262,
11756,
6634,
16392,
355,
4367,
287,
198,
2,
883,
3696,
13,
18987,
389,
1965,
284,
1100,
262,
513,
4372,
3615,
10483,
4541,
198,
2,
20717,
351,
883,
6798,
13,
198,
2,
198,
2,
15069,
357,
66,
8,
13130,
5070,
286,
3340,
198,
2,
198,
2,
2448,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
198,
2,
16727,
257,
4866,
286,
428,
3788,
290,
3917,
10314,
198,
2,
3696,
357,
1169,
366,
25423,
12340,
284,
1730,
287,
262,
10442,
1231,
198,
2,
17504,
11,
1390,
1231,
17385,
262,
2489,
284,
779,
11,
198,
2,
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,
198,
2,
10442,
318,
30760,
284,
466,
523,
11,
2426,
284,
262,
1708,
198,
2,
3403,
25,
198,
2,
198,
2,
383,
2029,
6634,
4003,
290,
428,
7170,
4003,
2236,
307,
198,
2,
3017,
287,
477,
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,
198,
2,
7788,
32761,
6375,
8959,
49094,
11,
47783,
2751,
21728,
5626,
40880,
5390,
3336,
34764,
11015,
198,
2,
3963,
34482,
3398,
1565,
5603,
25382,
11,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
198,
2,
44521,
1268,
10913,
2751,
12529,
13,
3268,
8005,
49261,
50163,
3336,
37195,
20673,
6375,
27975,
38162,
9947,
198,
2,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
43031,
25382,
11,
198,
2,
7655,
2767,
16879,
3268,
3537,
40282,
3963,
27342,
10659,
11,
309,
9863,
6375,
25401,
54,
24352,
11,
5923,
1797,
2751,
198,
2,
16034,
11,
16289,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
47466,
6375,
3336,
23210,
6375,
198,
2,
25401,
5550,
1847,
20754,
3268,
3336,
47466,
13,
198,
2,
198,
2,
38093,
198,
198,
11748,
18931,
198,
198,
6738,
44161,
282,
26599,
1330,
2251,
62,
18392,
198,
6738,
44161,
282,
26599,
13,
41194,
1330,
6060,
12331,
198,
6738,
44161,
282,
26599,
13,
579,
1330,
6246,
10297,
198,
198,
6738,
266,
2778,
66,
62,
7890,
62,
2301,
4592,
1330,
4566,
198,
198,
25294,
30373,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
4871,
33432,
7,
15252,
2599,
198,
220,
220,
220,
37227,
2301,
4592,
37811,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
41571,
273,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
41605,
30373,
13,
24442,
10786,
32071,
16363,
2348,
26599,
4637,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
3113,
796,
2251,
62,
18392,
7,
11250,
13,
54,
7707,
62,
35,
1404,
6242,
11159,
62,
21886,
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,
9809,
28,
11250,
13,
54,
7707,
62,
11012,
62,
30531,
8,
198,
220,
220,
220,
220,
220,
220,
220,
23575,
796,
6246,
10297,
7,
21653,
28,
18392,
11,
24264,
62,
261,
62,
41509,
28,
25101,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29891,
796,
23575,
3419,
628,
220,
220,
220,
825,
12405,
62,
17080,
4612,
7,
944,
11,
7386,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
20743,
329,
7310,
3815,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
7386,
25,
7386,
284,
307,
42517,
798,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
82,
25,
1351,
286,
7310,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
41605,
30373,
13,
24442,
10786,
4507,
263,
1112,
7310,
3815,
329,
23884,
4458,
18982,
7,
27830,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
3815,
796,
685,
85,
58,
15,
60,
329,
410,
287,
2116,
13,
29891,
13,
22766,
7,
27830,
737,
17080,
4612,
3419,
60,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
3815,
628,
220,
220,
220,
825,
12405,
62,
1525,
62,
3245,
7,
944,
11,
26181,
11,
26181,
62,
39098,
11,
416,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
12405,
1366,
416,
2214,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
26181,
25,
2134,
357,
3245,
8,
284,
307,
42517,
798,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
26181,
62,
39098,
25,
2134,
4554,
284,
307,
42517,
798,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
416,
25,
1988,
284,
307,
42517,
798,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
82,
25,
12405,
2482,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
2214,
796,
651,
35226,
7,
26801,
11,
416,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
796,
651,
35226,
7,
26801,
62,
39098,
11,
416,
8,
628,
220,
220,
220,
220,
220,
220,
220,
41605,
30373,
13,
24442,
10786,
4507,
263,
1112,
329,
23884,
34758,
92,
4458,
18982,
7,
3245,
11,
1988,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2482,
796,
2116,
13,
29891,
13,
22766,
7,
26801,
737,
24455,
7,
3245,
6624,
1988,
737,
439,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2482,
628,
220,
220,
220,
825,
12405,
62,
48101,
62,
25747,
7,
944,
11,
3084,
11,
3815,
11,
7032,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
12405,
257,
3084,
416,
3294,
7032,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
3084,
25,
3084,
284,
307,
42517,
798,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4554,
25,
22155,
351,
12405,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
7032,
25,
7032,
284,
307,
29083,
416,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
82,
25,
12405,
2482,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
3403,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
611,
7032,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2214,
287,
3815,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3403,
13,
33295,
7,
1136,
35226,
7,
11487,
11,
2214,
8,
6624,
3815,
58,
3245,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2214,
287,
7032,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3403,
13,
33295,
7,
1136,
35226,
7,
11487,
11,
2214,
8,
6624,
3815,
58,
3245,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
2482,
796,
2116,
13,
29891,
13,
22766,
7,
11487,
737,
24455,
46491,
17561,
1756,
737,
11085,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2482,
628,
220,
220,
220,
825,
3613,
7,
944,
11,
26181,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
31904,
2163,
284,
3613,
2134,
284,
20478,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
26181,
25,
2134,
284,
3613,
357,
4299,
723,
83,
6045,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
82,
25,
7951,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41605,
30373,
13,
24442,
10786,
50,
2703,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
26181,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29891,
13,
2860,
7,
26801,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2116,
13,
29891,
13,
647,
469,
7,
26801,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29891,
13,
41509,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29891,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
6060,
12331,
355,
11454,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41605,
30373,
13,
18224,
10786,
37,
6255,
284,
3613,
284,
20478,
25,
23884,
4458,
18982,
7,
8056,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29891,
13,
2487,
1891,
3419,
198
] | 2.888957 | 1,630 |
"""
String utilities.
"""
def camelize(value):
"""
Return the camel-cased version of a string.
Used for analysis class names.
"""
c = _camelcase()
return "".join(next(c)(x) if x else '_' for x in value.split("_"))
| [
37811,
198,
10100,
20081,
13,
198,
37811,
198,
198,
4299,
41021,
1096,
7,
8367,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8229,
262,
41021,
12,
66,
839,
2196,
286,
257,
4731,
13,
198,
220,
220,
220,
16718,
329,
3781,
1398,
3891,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
269,
796,
4808,
66,
17983,
7442,
3419,
198,
220,
220,
220,
1441,
366,
1911,
22179,
7,
19545,
7,
66,
5769,
87,
8,
611,
2124,
2073,
705,
62,
6,
329,
2124,
287,
1988,
13,
35312,
7203,
62,
48774,
198
] | 2.597826 | 92 |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\holidays\holiday_tradition.py
# Compiled at: 2020-06-15 20:09:55
# Size of source mod 2**32: 25532 bytes
from _collections import defaultdict
from buffs.tunable import TunableBuffReference
from business.business_enums import BusinessType
from event_testing.resolver import SingleSimResolver, GlobalResolver
from holidays.holiday_globals import HolidayState, TraditionPreference
from interactions import ParticipantType
from interactions.utils.display_mixin import get_display_mixin
from relationships.relationship_tests import TunableRelationshipTest
from sims.sim_info_tests import SimInfoTest, TraitTest
from sims4.localization import TunableLocalizedString
from sims4.tuning.instances import HashedTunedInstanceMetaclass
from sims4.tuning.tunable import HasTunableReference, TunableReference, TunableList, Tunable, TunableTuple, TunableEnumEntry, TunableVariant, OptionalTunable, AutoFactoryInit, HasTunableSingletonFactory, TunableEnumSet, TunableSingletonFactory, TunableMapping, TunableRange
from sims4.tuning.tunable_base import GroupNames, ExportModes
from situations.service_npcs.modify_lot_items_tuning import ModifyAllLotItems
from situations.situation_curve import SituationCurve
from situations.situation_guest_list import SituationGuestList
from situations.tunable import DestroySituationsByTagsMixin
from tag import TunableTags
from tunable_time import TunableTimeOfDay
import alarms, elements, enum, event_testing, services, sims4.log, sims4.resources, travel_group.travel_group_tests, world.world_tests
logger = sims4.log.Logger('Holiday', default_owner='jjacobson')
StartSituation = TunableSingletonFactory.create_auto_factory(_StartSituation, 'StartSituation')
ModifyAllItems = TunableSingletonFactory.create_auto_factory(_ModifyAllItems, 'ModifyAllItems')
DestroySituations = TunableSingletonFactory.create_auto_factory(_DestroySituations, 'DestroySituations')
HolidayTraditionDisplayMixin = get_display_mixin(has_description=True, has_icon=True, has_tooltip=True, export_modes=(ExportModes.All))
START_SITUATION = 0
MODIFY_ITEMS = 1
L. 418 0 LOAD_FAST 'self'
2 LOAD_ATTR _state
4 LOAD_GLOBAL HolidayState
6 LOAD_ATTR PRE_DAY
8 COMPARE_OP ==
10 POP_JUMP_IF_FALSE 82 'to 82'
L. 421 12 LOAD_FAST 'sim'
14 LOAD_ATTR is_npc
16 POP_JUMP_IF_FALSE 22 'to 22'
L. 422 18 LOAD_CONST None
20 RETURN_VALUE
22_0 COME_FROM 16 '16'
L. 423 22 SETUP_LOOP 152 'to 152'
24 LOAD_FAST 'self'
26 LOAD_ATTR pre_holiday_buffs
28 GET_ITER
30_0 COME_FROM 56 '56'
30 FOR_ITER 78 'to 78'
32 STORE_FAST 'buff'
L. 424 34 LOAD_FAST 'sim'
36 LOAD_ATTR add_buff
38 LOAD_FAST 'buff'
40 LOAD_FAST 'self'
42 LOAD_ATTR pre_holiday_buff_reason
44 LOAD_CONST ('buff_reason',)
46 CALL_FUNCTION_KW_2 2 '2 total positional and keyword args'
48 STORE_FAST 'buff_handle'
L. 425 50 LOAD_FAST 'buff_handle'
52 LOAD_CONST None
54 COMPARE_OP is-not
56 POP_JUMP_IF_FALSE 30 'to 30'
L. 426 58 LOAD_FAST 'self'
60 LOAD_ATTR _buffs_added
62 LOAD_FAST 'sim'
64 LOAD_ATTR sim_id
66 BINARY_SUBSCR
68 LOAD_METHOD append
70 LOAD_FAST 'buff_handle'
72 CALL_METHOD_1 1 '1 positional argument'
74 POP_TOP
76 JUMP_BACK 30 'to 30'
78 POP_BLOCK
80 JUMP_FORWARD 152 'to 152'
82_0 COME_FROM 10 '10'
L. 427 82 LOAD_FAST 'self'
84 LOAD_ATTR _state
86 LOAD_GLOBAL HolidayState
88 LOAD_ATTR RUNNING
90 COMPARE_OP ==
92 POP_JUMP_IF_FALSE 152 'to 152'
L. 428 94 SETUP_LOOP 152 'to 152'
96 LOAD_FAST 'self'
98 LOAD_ATTR holiday_buffs
100 GET_ITER
102_0 COME_FROM 128 '128'
102 FOR_ITER 150 'to 150'
104 STORE_FAST 'buff'
L. 429 106 LOAD_FAST 'sim'
108 LOAD_ATTR add_buff
110 LOAD_FAST 'buff'
112 LOAD_FAST 'self'
114 LOAD_ATTR holiday_buff_reason
116 LOAD_CONST ('buff_reason',)
118 CALL_FUNCTION_KW_2 2 '2 total positional and keyword args'
120 STORE_FAST 'buff_handle'
L. 430 122 LOAD_FAST 'buff_handle'
124 LOAD_CONST None
126 COMPARE_OP is-not
128 POP_JUMP_IF_FALSE 102 'to 102'
L. 431 130 LOAD_FAST 'self'
132 LOAD_ATTR _buffs_added
134 LOAD_FAST 'sim'
136 LOAD_ATTR sim_id
138 BINARY_SUBSCR
140 LOAD_METHOD append
142 LOAD_FAST 'buff_handle'
144 CALL_METHOD_1 1 '1 positional argument'
146 POP_TOP
148 JUMP_BACK 102 'to 102'
150 POP_BLOCK
152_0 COME_FROM_LOOP 94 '94'
152_1 COME_FROM 92 '92'
152_2 COME_FROM 80 '80'
152_3 COME_FROM_LOOP 22 '22'
Parse error at or near `COME_FROM' instruction at offset 152_2 | [
2,
34318,
2349,
21,
2196,
513,
13,
22,
13,
19,
198,
2,
11361,
18022,
8189,
513,
13,
22,
357,
2091,
5824,
8,
198,
2,
4280,
3361,
3902,
422,
25,
11361,
513,
13,
22,
13,
24,
357,
31499,
14,
85,
18,
13,
22,
13,
24,
25,
1485,
66,
24,
2857,
2857,
66,
22,
11,
2447,
1596,
12131,
11,
1248,
25,
3365,
25,
1507,
8,
685,
5653,
34,
410,
13,
48104,
5598,
1643,
357,
28075,
2414,
15437,
198,
2,
13302,
47238,
2393,
1438,
25,
309,
7479,
818,
8777,
59,
43241,
59,
7391,
82,
59,
10697,
59,
3937,
13842,
59,
37689,
62,
2213,
324,
653,
13,
9078,
198,
2,
3082,
3902,
379,
25,
12131,
12,
3312,
12,
1314,
1160,
25,
2931,
25,
2816,
198,
2,
12849,
286,
2723,
953,
362,
1174,
2624,
25,
14280,
2624,
9881,
198,
6738,
4808,
4033,
26448,
1330,
4277,
11600,
198,
6738,
34636,
13,
28286,
540,
1330,
13932,
540,
36474,
26687,
198,
6738,
1597,
13,
22680,
62,
268,
5700,
1330,
7320,
6030,
198,
6738,
1785,
62,
33407,
13,
411,
14375,
1330,
14206,
8890,
4965,
14375,
11,
8060,
4965,
14375,
198,
6738,
17122,
13,
37689,
62,
4743,
672,
874,
1330,
22770,
9012,
11,
45050,
6719,
4288,
198,
6738,
12213,
1330,
29880,
6030,
198,
6738,
12213,
13,
26791,
13,
13812,
62,
19816,
259,
1330,
651,
62,
13812,
62,
19816,
259,
198,
6738,
6958,
13,
39468,
1056,
62,
41989,
1330,
13932,
540,
47117,
1056,
14402,
198,
6738,
985,
82,
13,
14323,
62,
10951,
62,
41989,
1330,
3184,
12360,
14402,
11,
4759,
270,
14402,
198,
6738,
985,
82,
19,
13,
12001,
1634,
1330,
13932,
540,
14565,
1143,
10100,
198,
6738,
985,
82,
19,
13,
28286,
278,
13,
8625,
1817,
1330,
367,
5263,
51,
40881,
33384,
9171,
330,
31172,
198,
6738,
985,
82,
19,
13,
28286,
278,
13,
28286,
540,
1330,
7875,
51,
403,
540,
26687,
11,
13932,
540,
26687,
11,
13932,
540,
8053,
11,
13932,
540,
11,
13932,
540,
51,
29291,
11,
13932,
540,
4834,
388,
30150,
11,
13932,
540,
23907,
415,
11,
32233,
51,
403,
540,
11,
11160,
22810,
31768,
11,
7875,
51,
403,
540,
29974,
10565,
22810,
11,
13932,
540,
4834,
388,
7248,
11,
13932,
540,
29974,
10565,
22810,
11,
13932,
540,
44,
5912,
11,
13932,
540,
17257,
198,
6738,
985,
82,
19,
13,
28286,
278,
13,
28286,
540,
62,
8692,
1330,
4912,
36690,
11,
36472,
44,
4147,
198,
6738,
7445,
13,
15271,
62,
37659,
6359,
13,
4666,
1958,
62,
26487,
62,
23814,
62,
28286,
278,
1330,
3401,
1958,
3237,
48601,
23022,
198,
6738,
7445,
13,
48937,
2288,
62,
22019,
303,
1330,
49465,
26628,
303,
198,
6738,
7445,
13,
48937,
2288,
62,
5162,
395,
62,
4868,
1330,
49465,
42481,
8053,
198,
6738,
7445,
13,
28286,
540,
1330,
19448,
46655,
6055,
3886,
36142,
35608,
259,
198,
6738,
7621,
1330,
13932,
540,
36142,
198,
6738,
6278,
540,
62,
2435,
1330,
13932,
540,
7575,
5189,
12393,
198,
11748,
36302,
11,
4847,
11,
33829,
11,
1785,
62,
33407,
11,
2594,
11,
985,
82,
19,
13,
6404,
11,
985,
82,
19,
13,
37540,
11,
3067,
62,
8094,
13,
35927,
62,
8094,
62,
41989,
11,
995,
13,
6894,
62,
41989,
198,
6404,
1362,
796,
985,
82,
19,
13,
6404,
13,
11187,
1362,
10786,
28115,
2567,
3256,
4277,
62,
18403,
11639,
73,
30482,
672,
1559,
11537,
628,
628,
198,
198,
10434,
46655,
2288,
796,
13932,
540,
29974,
10565,
22810,
13,
17953,
62,
23736,
62,
69,
9548,
28264,
10434,
46655,
2288,
11,
705,
10434,
46655,
2288,
11537,
628,
198,
5841,
1958,
3237,
23022,
796,
13932,
540,
29974,
10565,
22810,
13,
17953,
62,
23736,
62,
69,
9548,
28264,
5841,
1958,
3237,
23022,
11,
705,
5841,
1958,
3237,
23022,
11537,
628,
198,
49174,
46655,
6055,
796,
13932,
540,
29974,
10565,
22810,
13,
17953,
62,
23736,
62,
69,
9548,
28264,
49174,
46655,
6055,
11,
705,
49174,
46655,
6055,
11537,
628,
198,
198,
28115,
2567,
2898,
324,
653,
23114,
35608,
259,
796,
651,
62,
13812,
62,
19816,
259,
7,
10134,
62,
11213,
28,
17821,
11,
468,
62,
4749,
28,
17821,
11,
468,
62,
25981,
22504,
28,
17821,
11,
10784,
62,
76,
4147,
16193,
43834,
44,
4147,
13,
3237,
4008,
198,
2257,
7227,
62,
50,
2043,
52,
6234,
796,
657,
198,
33365,
5064,
56,
62,
2043,
39201,
796,
352,
628,
406,
13,
45959,
220,
220,
220,
220,
220,
220,
220,
220,
657,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
362,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
5219,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
604,
220,
17579,
2885,
62,
8763,
9864,
1847,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22770,
9012,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
718,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22814,
62,
26442,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
807,
220,
24301,
12203,
62,
3185,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
838,
220,
37586,
62,
41,
20476,
62,
5064,
62,
37,
23719,
220,
220,
220,
9415,
220,
705,
1462,
9415,
6,
628,
406,
13,
49294,
220,
220,
220,
220,
220,
220,
220,
1105,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14323,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1478,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
77,
14751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1467,
220,
37586,
62,
41,
20476,
62,
5064,
62,
37,
23719,
220,
220,
220,
2534,
220,
705,
1462,
2534,
6,
628,
406,
13,
46588,
220,
220,
220,
220,
220,
220,
220,
1248,
220,
17579,
2885,
62,
10943,
2257,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1160,
220,
30826,
27064,
62,
39488,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2534,
62,
15,
220,
9440,
36,
62,
10913,
2662,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1467,
220,
705,
1433,
6,
628,
406,
13,
49125,
220,
220,
220,
220,
220,
220,
220,
2534,
220,
25823,
8577,
62,
21982,
3185,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24848,
220,
705,
1462,
24848,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1987,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2608,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
662,
62,
37689,
62,
65,
18058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2579,
220,
17151,
62,
2043,
1137,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1542,
62,
15,
220,
9440,
36,
62,
10913,
2662,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7265,
220,
705,
3980,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1542,
220,
7473,
62,
2043,
1137,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8699,
220,
705,
1462,
8699,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3933,
220,
3563,
6965,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
6,
628,
406,
13,
48252,
220,
220,
220,
220,
220,
220,
220,
4974,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14323,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4570,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
751,
62,
36873,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4353,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2319,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5433,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
662,
62,
37689,
62,
36873,
62,
41181,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5846,
220,
17579,
2885,
62,
10943,
2257,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19203,
36873,
62,
41181,
3256,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6337,
220,
42815,
62,
42296,
4177,
2849,
62,
42,
54,
62,
17,
220,
220,
220,
220,
362,
220,
705,
17,
2472,
45203,
290,
21179,
26498,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4764,
220,
3563,
6965,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
62,
28144,
6,
628,
406,
13,
36959,
220,
220,
220,
220,
220,
220,
220,
2026,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
62,
28144,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6740,
220,
17579,
2885,
62,
10943,
2257,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7175,
220,
24301,
12203,
62,
3185,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
12,
1662,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7265,
220,
37586,
62,
41,
20476,
62,
5064,
62,
37,
23719,
220,
220,
220,
1542,
220,
705,
1462,
1542,
6,
628,
406,
13,
48065,
220,
220,
220,
220,
220,
220,
220,
7618,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3126,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
65,
18058,
62,
29373,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8190,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14323,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5598,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
985,
62,
312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7930,
220,
347,
1268,
13153,
62,
12564,
4462,
9419,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8257,
220,
17579,
2885,
62,
49273,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24443,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4317,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
62,
28144,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7724,
220,
42815,
62,
49273,
62,
16,
220,
220,
220,
220,
220,
220,
220,
220,
352,
220,
705,
16,
45203,
4578,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8915,
220,
37586,
62,
35222,
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,
8684,
220,
449,
20476,
62,
31098,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1542,
220,
705,
1462,
1542,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8699,
220,
37586,
62,
9148,
11290,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4019,
220,
449,
20476,
62,
13775,
39743,
220,
220,
220,
220,
220,
220,
220,
24848,
220,
705,
1462,
24848,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9415,
62,
15,
220,
9440,
36,
62,
10913,
2662,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
838,
220,
705,
940,
6,
628,
406,
13,
45345,
220,
220,
220,
220,
220,
220,
220,
9415,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9508,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
5219,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9849,
220,
17579,
2885,
62,
8763,
9864,
1847,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22770,
9012,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9193,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32494,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4101,
220,
24301,
12203,
62,
3185,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10190,
220,
37586,
62,
41,
20476,
62,
5064,
62,
37,
23719,
220,
220,
24848,
220,
705,
1462,
24848,
6,
628,
406,
13,
45063,
220,
220,
220,
220,
220,
220,
220,
10048,
220,
25823,
8577,
62,
21982,
3185,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24848,
220,
705,
1462,
24848,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9907,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9661,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9912,
62,
65,
18058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1802,
220,
17151,
62,
2043,
1137,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15143,
62,
15,
220,
9440,
36,
62,
10913,
2662,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13108,
220,
705,
12762,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15143,
220,
7473,
62,
2043,
1137,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6640,
220,
705,
1462,
6640,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14436,
220,
3563,
6965,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
6,
628,
406,
13,
42313,
220,
220,
220,
220,
220,
220,
15696,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14323,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15495,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
751,
62,
36873,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9796,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13539,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17342,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9912,
62,
36873,
62,
41181,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18693,
220,
17579,
2885,
62,
10943,
2257,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19203,
36873,
62,
41181,
3256,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19035,
220,
42815,
62,
42296,
4177,
2849,
62,
42,
54,
62,
17,
220,
220,
220,
220,
362,
220,
705,
17,
2472,
45203,
290,
21179,
26498,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7982,
220,
3563,
6965,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
62,
28144,
6,
628,
406,
13,
35090,
220,
220,
220,
220,
220,
220,
19409,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
62,
28144,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19755,
220,
17579,
2885,
62,
10943,
2257,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19710,
220,
24301,
12203,
62,
3185,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
12,
1662,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13108,
220,
37586,
62,
41,
20476,
62,
5064,
62,
37,
23719,
220,
220,
15143,
220,
705,
1462,
15143,
6,
628,
406,
13,
604,
3132,
220,
220,
220,
220,
220,
220,
11323,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
944,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21761,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
65,
18058,
62,
29373,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22352,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14323,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21056,
220,
17579,
2885,
62,
1404,
5446,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
985,
62,
312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21503,
220,
347,
1268,
13153,
62,
12564,
4462,
9419,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12713,
220,
17579,
2885,
62,
49273,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24443,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25181,
220,
17579,
2885,
62,
37,
11262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
36873,
62,
28144,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20224,
220,
42815,
62,
49273,
62,
16,
220,
220,
220,
220,
220,
220,
220,
220,
352,
220,
705,
16,
45203,
4578,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22986,
220,
37586,
62,
35222,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22613,
220,
449,
20476,
62,
31098,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15143,
220,
705,
1462,
15143,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6640,
220,
37586,
62,
9148,
11290,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24848,
62,
15,
220,
9440,
36,
62,
10913,
2662,
62,
21982,
3185,
220,
220,
220,
220,
220,
220,
10048,
220,
705,
5824,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24848,
62,
16,
220,
9440,
36,
62,
10913,
2662,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10190,
220,
705,
5892,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24848,
62,
17,
220,
9440,
36,
62,
10913,
2662,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4019,
220,
705,
1795,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24848,
62,
18,
220,
9440,
36,
62,
10913,
2662,
62,
21982,
3185,
220,
220,
220,
220,
220,
220,
2534,
220,
705,
1828,
6,
198,
198,
10044,
325,
4049,
379,
393,
1474,
4600,
9858,
36,
62,
10913,
2662,
6,
12064,
379,
11677,
24848,
62,
17
] | 1.76446 | 3,821 |
#encoding: utf-8
import re
import json
from ..extractor.fox import FOXIE as Old
from ..utilsEX import download_webPage_by_PYCURL | [
2,
12685,
7656,
25,
3384,
69,
12,
23,
628,
198,
11748,
302,
198,
11748,
33918,
198,
198,
6738,
11485,
2302,
40450,
13,
12792,
1330,
19912,
10008,
355,
5706,
198,
6738,
11485,
26791,
6369,
1330,
4321,
62,
12384,
9876,
62,
1525,
62,
47,
44816,
21886
] | 2.977273 | 44 |
from .arena_object import Object
class Tetrahedron(Object):
"""
Class for Tetrahedron in the ARENA.
"""
| [
6738,
764,
533,
2616,
62,
15252,
1330,
9515,
198,
198,
4871,
27351,
430,
704,
1313,
7,
10267,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5016,
329,
27351,
430,
704,
1313,
287,
262,
5923,
45510,
13,
198,
220,
220,
220,
37227,
198
] | 2.659091 | 44 |
import os
from pyrogram.types import Message
from tronx import USER_ID, Config
from tronx.database.postgres import dv_sql as dv
# -----
MODULES = sorted(__list_all_plugins())
__all__ = MODULES + ["MODULES"]
# -----
# types of message
# chat type
| [
11748,
28686,
198,
198,
6738,
12972,
39529,
13,
19199,
1330,
16000,
198,
198,
6738,
491,
261,
87,
1330,
1294,
1137,
62,
2389,
11,
17056,
198,
198,
6738,
491,
261,
87,
13,
48806,
13,
7353,
34239,
1330,
288,
85,
62,
25410,
355,
288,
85,
628,
628,
198,
2,
37404,
628,
198,
33365,
6239,
1546,
796,
23243,
7,
834,
4868,
62,
439,
62,
37390,
28955,
198,
834,
439,
834,
796,
19164,
6239,
1546,
1343,
14631,
33365,
6239,
1546,
8973,
198,
2,
37404,
628,
628,
198,
2,
3858,
286,
3275,
628,
628,
198,
2,
8537,
2099,
628,
198
] | 2.789474 | 95 |
from copy import deepcopy
import pytest
from channels.testing import WebsocketCommunicator
from backend.groups.models import ChatGroup, GroupMessage
from backend.socket_chat.tests.utils import round_to_minutes
pytestmark = [pytest.mark.asyncio, pytest.mark.django_db(transaction=True)]
@pytest.fixture
@pytest.fixture
@pytest.fixture
@pytest.fixture
@pytest.fixture
# The list method with a filter should not return groups without messages that match the filter
| [
6738,
4866,
1330,
2769,
30073,
198,
198,
11748,
12972,
9288,
198,
6738,
9619,
13,
33407,
1330,
47736,
5459,
30813,
26407,
198,
198,
6738,
30203,
13,
24432,
13,
27530,
1330,
24101,
13247,
11,
4912,
12837,
198,
6738,
30203,
13,
44971,
62,
17006,
13,
41989,
13,
26791,
1330,
2835,
62,
1462,
62,
1084,
1769,
628,
198,
9078,
9288,
4102,
796,
685,
9078,
9288,
13,
4102,
13,
292,
13361,
952,
11,
12972,
9288,
13,
4102,
13,
28241,
14208,
62,
9945,
7,
7645,
2673,
28,
17821,
15437,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
31,
9078,
9288,
13,
69,
9602,
628,
198,
198,
2,
383,
1351,
2446,
351,
257,
8106,
815,
407,
1441,
2628,
1231,
6218,
326,
2872,
262,
8106,
628
] | 3.333333 | 144 |
import os
import random
import cherrypy
"""
Dumb battlesnake server in python.
For instructions see https://github.com/BattlesnakeOfficial/starter-snake-python/README.md
"""
move_names = ["up", "down", "left", "right"]
moves_dx = [0, 0, -1, 1]
moves_dy = [1, -1, 0, 0]
""" Snake object. """
# Ideas:
# 1. evaluate each direction, pick best
# 2. how to evaluate a move:
# *. if there's a blockage, -100 OK
# *. if it's in the same direction, +1 OK?
# *. if it has food and we're > 70 (modulo length?), +1 OK
# *. if it has food and we're < 40 +10 OK
# *. count "outs" - the more outs, the higher the score OK
# 3. food override: if hungry, pick closest food and find the best move towards it. (?) (NOT DONE)
# returns int
# return a (good) move towards food
# Map from key to AnSnake objects
snakes = {}
if __name__ == "__main__":
server = Battlesnake()
cherrypy.config.update({"server.socket_host": "0.0.0.0"})
cherrypy.config.update(
{"server.socket_port": int(os.environ.get("PORT", "8080")),}
)
print("Starting Battlesnake Server...")
cherrypy.quickstart(server)
| [
11748,
28686,
198,
11748,
4738,
198,
11748,
23612,
9078,
198,
198,
37811,
198,
35,
2178,
10181,
77,
539,
4382,
287,
21015,
13,
198,
1890,
7729,
766,
3740,
1378,
12567,
13,
785,
14,
33,
1078,
829,
77,
539,
28529,
14,
12339,
12,
16184,
539,
12,
29412,
14,
15675,
11682,
13,
9132,
198,
37811,
198,
21084,
62,
14933,
796,
14631,
929,
1600,
366,
2902,
1600,
366,
9464,
1600,
366,
3506,
8973,
198,
76,
5241,
62,
34350,
796,
685,
15,
11,
657,
11,
532,
16,
11,
352,
60,
198,
76,
5241,
62,
9892,
796,
685,
16,
11,
532,
16,
11,
657,
11,
657,
60,
198,
198,
37811,
16705,
2134,
13,
37227,
628,
220,
1303,
35365,
25,
198,
220,
1303,
352,
13,
13446,
1123,
4571,
11,
2298,
1266,
198,
220,
1303,
362,
13,
703,
284,
13446,
257,
1445,
25,
198,
220,
1303,
220,
220,
46866,
611,
612,
338,
257,
2512,
496,
11,
532,
3064,
7477,
198,
220,
1303,
220,
220,
46866,
611,
340,
338,
287,
262,
976,
4571,
11,
1343,
16,
7477,
30,
198,
220,
1303,
220,
220,
46866,
611,
340,
468,
2057,
290,
356,
821,
1875,
4317,
357,
4666,
43348,
4129,
33924,
1343,
16,
7477,
198,
220,
1303,
220,
220,
46866,
611,
340,
468,
2057,
290,
356,
821,
1279,
2319,
1343,
940,
7477,
198,
220,
1303,
220,
220,
46866,
954,
366,
5269,
1,
532,
262,
517,
12198,
11,
262,
2440,
262,
4776,
7477,
198,
220,
1303,
513,
13,
2057,
20957,
25,
611,
14720,
11,
2298,
11706,
2057,
290,
1064,
262,
1266,
1445,
3371,
340,
13,
357,
10091,
357,
11929,
360,
11651,
8,
198,
220,
1303,
5860,
493,
628,
220,
1303,
1441,
257,
357,
11274,
8,
1445,
3371,
2057,
628,
198,
2,
9347,
422,
1994,
284,
1052,
49795,
5563,
198,
16184,
1124,
796,
23884,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
4382,
796,
25467,
77,
539,
3419,
198,
220,
23612,
9078,
13,
11250,
13,
19119,
7,
4895,
15388,
13,
44971,
62,
4774,
1298,
366,
15,
13,
15,
13,
15,
13,
15,
20662,
8,
198,
220,
23612,
9078,
13,
11250,
13,
19119,
7,
198,
220,
220,
220,
220,
220,
19779,
15388,
13,
44971,
62,
634,
1298,
493,
7,
418,
13,
268,
2268,
13,
1136,
7203,
15490,
1600,
366,
1795,
1795,
4943,
828,
92,
198,
220,
1267,
198,
220,
3601,
7203,
22851,
25467,
77,
539,
9652,
9313,
8,
198,
220,
23612,
9078,
13,
24209,
9688,
7,
15388,
8,
198,
220,
220,
198
] | 2.796526 | 403 |
depends = ["unittest"]
description = """
Plug and play integration with the Jenkins Coninuous Integration server.
For more information, visit:
http://www.jenkins-ci.org/
""" | [
10378,
2412,
796,
14631,
403,
715,
395,
8973,
198,
11213,
796,
37227,
198,
23257,
290,
711,
11812,
351,
262,
21835,
1482,
259,
5623,
38410,
4382,
13,
198,
198,
1890,
517,
1321,
11,
3187,
25,
198,
4023,
1378,
2503,
13,
48796,
5331,
12,
979,
13,
2398,
14,
198,
37811
] | 3.625 | 48 |
import numpy as np
import os
import random
from copy import copy
from typing import List
import pickle
from agents.plastic_dqn_v1 import config
REPLAY_MEMORY_SIZE = 50_000 # How many last steps to keep for model training
MIN_REPLAY_MEMORY_SIZE = 1_000 # Minimum number of steps in a memory to
class LearnBuffer:
""" Buffer used during game. Saves and decides which steps to save """
@classmethod
class ExperienceBuffer:
""" Contains all the experience the agent retain during training """
@classmethod
@classmethod
def store_transition(self, curr_st: np.ndarray, action_idx: int,
reward: int, new_st: np.ndarray, done: int):
""" Adds step's data to a memory replay array
(observation space, action, reward, new observation space, done) """
transition = np.array([curr_st, action_idx, reward, new_st, done])
self._data.append(transition)
def store_episode(self, transitions: List[Transition]):
""" Adds step's data to a memory replay array
(observation space, action, reward, new observation space, done) """
if len(transitions) > 0:
for transition in transitions:
self._data.append(transition.to_tuple())
| [
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
198,
11748,
4738,
198,
6738,
4866,
1330,
4866,
198,
6738,
19720,
1330,
7343,
198,
198,
11748,
2298,
293,
198,
198,
6738,
6554,
13,
489,
3477,
62,
49506,
77,
62,
85,
16,
1330,
4566,
198,
198,
2200,
31519,
62,
44,
3620,
15513,
62,
33489,
796,
2026,
62,
830,
220,
1303,
1374,
867,
938,
4831,
284,
1394,
329,
2746,
3047,
198,
23678,
62,
2200,
31519,
62,
44,
3620,
15513,
62,
33489,
796,
352,
62,
830,
220,
1303,
26265,
1271,
286,
4831,
287,
257,
4088,
284,
628,
198,
198,
4871,
14365,
28632,
25,
198,
220,
220,
220,
37227,
47017,
973,
1141,
983,
13,
311,
3080,
290,
13267,
543,
4831,
284,
3613,
37227,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
4871,
24396,
628,
198,
4871,
16386,
28632,
25,
198,
220,
220,
220,
37227,
49850,
477,
262,
1998,
262,
5797,
12377,
1141,
3047,
37227,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
4871,
24396,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
4871,
24396,
198,
220,
220,
220,
220,
198,
220,
220,
220,
825,
3650,
62,
7645,
653,
7,
944,
11,
1090,
81,
62,
301,
25,
45941,
13,
358,
18747,
11,
2223,
62,
312,
87,
25,
493,
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,
6721,
25,
493,
11,
649,
62,
301,
25,
45941,
13,
358,
18747,
11,
1760,
25,
493,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
34333,
2239,
338,
1366,
284,
257,
4088,
24788,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
357,
672,
3168,
341,
2272,
11,
2223,
11,
6721,
11,
649,
13432,
2272,
11,
1760,
8,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6801,
796,
45941,
13,
18747,
26933,
22019,
81,
62,
301,
11,
2223,
62,
312,
87,
11,
6721,
11,
649,
62,
301,
11,
1760,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
7890,
13,
33295,
7,
7645,
653,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
825,
3650,
62,
38668,
7,
944,
11,
27188,
25,
7343,
58,
8291,
653,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
34333,
2239,
338,
1366,
284,
257,
4088,
24788,
7177,
198,
220,
220,
220,
220,
220,
220,
220,
357,
672,
3168,
341,
2272,
11,
2223,
11,
6721,
11,
649,
13432,
2272,
11,
1760,
8,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
18896,
7,
7645,
1756,
8,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
6801,
287,
27188,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
7890,
13,
33295,
7,
7645,
653,
13,
1462,
62,
83,
29291,
28955,
198
] | 2.694093 | 474 |
#!/usr/bin/env python3
import sys
import os
import time
#
# Generate the master out.grid
# Create a 3M point file of lat/lons - and write to ASCII file called out.grd.
# This file will be used as input to ucvm_query for medium scale test for images
#
if not os.path.exists("out.grd"):
print("Creating grd.out file.")
cmd="/app/ucvm/utilities/makegrid"
print(cmd)
os.system(cmd)
#
#
valid_model_strings = {"bbp1d":1,
"cca":1,
"wfcvm":1,
"albacore":1,
"cvlsu":1,
"ivlsu":1,
"cvms":1,
"cvmh":1,
"cvmsi":1,
"cvms5":1}
# Check model parameter
if len (sys.argv) < 2:
print("Input format: % make_mesh_model.py cvms")
sys.exit()
else:
model_string = sys.argv[1]
#
# Check if model is valid
print("Model string: {}".format(model_string))
try:
valid = valid_model_strings[model_string.strip()]
except:
print("Unknown model: {}".format(model_string))
for key in valid_model_strings.items():
print(key, valid_model_strings[key])
sys.exit()
#
# Call each of the installed crustal models and time how
# long it takes to populate the models
#
#
#
start = time.time()
cmd="ucvm_query -f /app/ucvm/conf/ucvm.conf -m %s < out.grd > mesh_%s.out"%(model_string,model_string)
print(cmd)
os.system(cmd)
end = time.time()
print("Mesh extraction for model {} : {} seconds".format(model_string,(end-start)))
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
640,
198,
2,
198,
2,
2980,
378,
262,
4958,
503,
13,
25928,
198,
2,
13610,
257,
513,
44,
966,
2393,
286,
3042,
14,
75,
684,
532,
290,
3551,
284,
37101,
2393,
1444,
503,
13,
2164,
67,
13,
198,
2,
770,
2393,
481,
307,
973,
355,
5128,
284,
334,
66,
14761,
62,
22766,
329,
7090,
5046,
1332,
329,
4263,
198,
2,
198,
361,
407,
28686,
13,
6978,
13,
1069,
1023,
7203,
448,
13,
2164,
67,
1,
2599,
198,
220,
3601,
7203,
32071,
1036,
67,
13,
448,
2393,
19570,
198,
220,
23991,
35922,
1324,
14,
1229,
14761,
14,
315,
2410,
14,
15883,
25928,
1,
198,
220,
3601,
7,
28758,
8,
198,
220,
28686,
13,
10057,
7,
28758,
8,
198,
2,
198,
2,
198,
12102,
62,
19849,
62,
37336,
796,
19779,
11848,
79,
16,
67,
1298,
16,
11,
198,
1,
13227,
1298,
16,
11,
198,
1,
86,
16072,
14761,
1298,
16,
11,
198,
1,
282,
65,
330,
382,
1298,
16,
11,
198,
1,
66,
19279,
2385,
1298,
16,
11,
198,
1,
452,
75,
2385,
1298,
16,
11,
198,
1,
33967,
907,
1298,
16,
11,
198,
1,
66,
14761,
71,
1298,
16,
11,
198,
1,
33967,
907,
72,
1298,
16,
11,
198,
1,
33967,
907,
20,
1298,
16,
92,
198,
198,
2,
6822,
2746,
11507,
198,
361,
18896,
357,
17597,
13,
853,
85,
8,
1279,
362,
25,
198,
220,
3601,
7203,
20560,
5794,
25,
4064,
787,
62,
76,
5069,
62,
19849,
13,
9078,
269,
85,
907,
4943,
198,
220,
25064,
13,
37023,
3419,
198,
17772,
25,
198,
220,
2746,
62,
8841,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
2,
198,
2,
6822,
611,
2746,
318,
4938,
198,
4798,
7203,
17633,
4731,
25,
23884,
1911,
18982,
7,
19849,
62,
8841,
4008,
198,
28311,
25,
198,
220,
4938,
796,
4938,
62,
19849,
62,
37336,
58,
19849,
62,
8841,
13,
36311,
3419,
60,
220,
198,
16341,
25,
198,
220,
3601,
7203,
20035,
2746,
25,
23884,
1911,
18982,
7,
19849,
62,
8841,
4008,
198,
220,
329,
1994,
287,
4938,
62,
19849,
62,
37336,
13,
23814,
33529,
198,
220,
220,
220,
3601,
7,
2539,
11,
4938,
62,
19849,
62,
37336,
58,
2539,
12962,
198,
220,
25064,
13,
37023,
3419,
198,
198,
2,
198,
2,
4889,
1123,
286,
262,
6589,
20048,
282,
4981,
290,
640,
703,
198,
2,
890,
340,
2753,
284,
48040,
262,
4981,
198,
2,
198,
2,
198,
2,
198,
9688,
796,
640,
13,
2435,
3419,
198,
28758,
2625,
1229,
14761,
62,
22766,
532,
69,
1220,
1324,
14,
1229,
14761,
14,
10414,
14,
1229,
14761,
13,
10414,
532,
76,
4064,
82,
1279,
503,
13,
2164,
67,
1875,
19609,
62,
4,
82,
13,
448,
1,
4,
7,
19849,
62,
8841,
11,
19849,
62,
8841,
8,
198,
4798,
7,
28758,
8,
198,
418,
13,
10057,
7,
28758,
8,
198,
437,
796,
640,
13,
2435,
3419,
198,
4798,
7203,
37031,
22236,
329,
2746,
23884,
1058,
23884,
4201,
1911,
18982,
7,
19849,
62,
8841,
11,
7,
437,
12,
9688,
22305,
198
] | 2.582677 | 508 |
#!/usr/bin/python
'''
Copyright(C) 2016 Engineering Department, University of Cambridge, UK.
License
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.
Author
Gilles Degottex <[email protected]>
'''
import sys
import argparse
import numpy as np
sys.path.append('/home/degottex/Research/CUED/Code')
import sigproc as sp
if __name__ == "__main__" :
argpar = argparse.ArgumentParser()
argpar.add_argument("bndspecfile", default=None, help="Input spectrum file")
argpar.add_argument("--nbbands", type=int, help="Number of bands in the warped spectral representation")
argpar.add_argument("--dftlen", default=4096, type=int, help="DFT size for the output spectrum")
argpar.add_argument("--fs", default=16000, type=int, help="Sampling frequency[Hz]")
argpar.add_argument("specfile", default=None, help="Output warped spectrum file")
args, unknown = argpar.parse_known_args()
BNDSPEC = np.fromfile(args.bndspecfile, dtype=np.float32)
BNDSPEC = BNDSPEC.reshape((-1, args.nbbands))
SPEC = np.exp(sp.fwbnd2linbnd(BNDSPEC, args.fs, args.dftlen))
SPEC.astype('float32').tofile(args.specfile)
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
198,
7061,
6,
198,
15269,
7,
34,
8,
1584,
14044,
2732,
11,
2059,
286,
14457,
11,
3482,
13,
198,
198,
34156,
198,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
220,
220,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
220,
220,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
628,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
628,
220,
220,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
220,
220,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
220,
220,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
220,
220,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
220,
220,
11247,
739,
262,
13789,
13,
198,
198,
13838,
198,
220,
220,
220,
12981,
274,
25905,
11404,
87,
1279,
70,
324,
1983,
31,
20991,
13,
330,
13,
2724,
29,
198,
7061,
6,
198,
198,
11748,
25064,
198,
11748,
1822,
29572,
198,
11748,
299,
32152,
355,
45941,
198,
198,
17597,
13,
6978,
13,
33295,
10786,
14,
11195,
14,
13500,
11404,
87,
14,
25104,
14,
43633,
1961,
14,
10669,
11537,
198,
11748,
43237,
36942,
355,
599,
198,
198,
361,
220,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1,
1058,
628,
220,
220,
220,
1822,
1845,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
220,
220,
220,
1822,
1845,
13,
2860,
62,
49140,
7203,
65,
358,
16684,
7753,
1600,
4277,
28,
14202,
11,
1037,
2625,
20560,
10958,
2393,
4943,
198,
220,
220,
220,
1822,
1845,
13,
2860,
62,
49140,
7203,
438,
77,
11848,
1746,
1600,
2099,
28,
600,
11,
1037,
2625,
15057,
286,
11760,
287,
262,
43062,
37410,
10552,
4943,
198,
220,
220,
220,
1822,
1845,
13,
2860,
62,
49140,
7203,
438,
67,
701,
11925,
1600,
4277,
28,
1821,
4846,
11,
2099,
28,
600,
11,
1037,
2625,
8068,
51,
2546,
329,
262,
5072,
10958,
4943,
198,
220,
220,
220,
1822,
1845,
13,
2860,
62,
49140,
7203,
438,
9501,
1600,
4277,
28,
1433,
830,
11,
2099,
28,
600,
11,
1037,
2625,
16305,
11347,
8373,
58,
7399,
60,
4943,
198,
220,
220,
220,
1822,
1845,
13,
2860,
62,
49140,
7203,
16684,
7753,
1600,
4277,
28,
14202,
11,
1037,
2625,
26410,
43062,
10958,
2393,
4943,
198,
220,
220,
220,
26498,
11,
6439,
796,
1822,
1845,
13,
29572,
62,
4002,
62,
22046,
3419,
628,
220,
220,
220,
347,
8575,
48451,
796,
45941,
13,
6738,
7753,
7,
22046,
13,
65,
358,
16684,
7753,
11,
288,
4906,
28,
37659,
13,
22468,
2624,
8,
198,
220,
220,
220,
347,
8575,
48451,
796,
347,
8575,
48451,
13,
3447,
1758,
19510,
12,
16,
11,
26498,
13,
77,
11848,
1746,
4008,
198,
220,
220,
220,
28196,
796,
45941,
13,
11201,
7,
2777,
13,
69,
39346,
358,
17,
2815,
65,
358,
7,
33,
8575,
48451,
11,
26498,
13,
9501,
11,
26498,
13,
67,
701,
11925,
4008,
198,
220,
220,
220,
28196,
13,
459,
2981,
10786,
22468,
2624,
27691,
1462,
7753,
7,
22046,
13,
16684,
7753,
8,
198
] | 3.018484 | 541 |
# ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
# Copyright (c) 2018, S.J.M. Steffann. This software is licensed under the BSD
# 3-Clause License. Please see the LICENSE file in the project root directory.
# ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
# Generated by Django 2.0.7 on 2018-07-23 14:47
from django.db import migrations
| [
2,
5595,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
3581,
198,
2,
220,
15069,
357,
66,
8,
2864,
11,
311,
13,
41,
13,
44,
13,
2441,
487,
1236,
13,
770,
3788,
318,
11971,
739,
262,
347,
10305,
198,
2,
220,
513,
12,
2601,
682,
13789,
13,
4222,
766,
262,
38559,
24290,
2393,
287,
262,
1628,
6808,
8619,
13,
198,
2,
5595,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
39967,
3581,
198,
198,
2,
2980,
515,
416,
37770,
362,
13,
15,
13,
22,
319,
2864,
12,
2998,
12,
1954,
1478,
25,
2857,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 3.248 | 125 |
"""
Copyright (c) 2019 Muhammad Shehriyar Qureshi
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 re
| [
37811,
198,
15269,
357,
66,
8,
13130,
15870,
1375,
71,
380,
88,
283,
1195,
942,
5303,
198,
198,
5990,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
4866,
198,
1659,
428,
3788,
290,
3917,
10314,
3696,
357,
1169,
366,
25423,
12340,
284,
1730,
198,
259,
262,
10442,
1231,
17504,
11,
1390,
1231,
17385,
262,
2489,
198,
1462,
779,
11,
4866,
11,
13096,
11,
20121,
11,
7715,
11,
14983,
11,
850,
43085,
11,
290,
14,
273,
3677,
198,
22163,
444,
286,
262,
10442,
11,
290,
284,
8749,
6506,
284,
4150,
262,
10442,
318,
198,
69,
700,
1348,
284,
466,
523,
11,
2426,
284,
262,
1708,
3403,
25,
198,
198,
464,
2029,
6634,
4003,
290,
428,
7170,
4003,
2236,
307,
3017,
287,
477,
198,
22163,
444,
393,
8904,
16690,
286,
262,
10442,
13,
198,
198,
10970,
47466,
3180,
36592,
2389,
1961,
366,
1921,
3180,
1600,
42881,
34764,
56,
3963,
15529,
509,
12115,
11,
7788,
32761,
6375,
198,
3955,
49094,
11,
47783,
2751,
21728,
5626,
40880,
5390,
3336,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
11,
198,
37,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
44521,
1268,
10913,
2751,
12529,
13,
3268,
8005,
49261,
50163,
3336,
198,
32,
24318,
20673,
6375,
27975,
38162,
9947,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
198,
43,
3539,
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,
12425,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
47466,
6375,
3336,
23210,
6375,
25401,
5550,
1847,
20754,
3268,
3336,
198,
15821,
37485,
13,
198,
37811,
198,
11748,
302,
628
] | 3.848057 | 283 |
from annoying.functions import get_object_or_None
from app.api.serializers import (
SendMessageRequestSerializer
)
from app.core.models import MessageRequest
from app.core.routing import ROUTING_REGISTRY
from app.core.views import (
BaseAPIView, GET, POST
)
from rest_framework import status
class HealthCheckView(BaseAPIView):
"""
View that monitoring services can use to check on the 'aliveness' of a
running messaging service.
"""
allowed_methods = (GET,)
operation_tag = 'health_check'
class SendMessageView(BaseAPIView):
"""
Send message API view
"""
allowed_methods = (POST,)
validator = SendMessageRequestSerializer
operation_tag = 'send_message'
| [
6738,
15774,
13,
12543,
2733,
1330,
651,
62,
15252,
62,
273,
62,
14202,
198,
6738,
598,
13,
15042,
13,
46911,
11341,
1330,
357,
198,
220,
220,
220,
16290,
12837,
18453,
32634,
7509,
198,
8,
198,
6738,
598,
13,
7295,
13,
27530,
1330,
16000,
18453,
198,
6738,
598,
13,
7295,
13,
81,
13660,
1330,
371,
12425,
2751,
62,
31553,
1797,
40405,
198,
6738,
598,
13,
7295,
13,
33571,
1330,
357,
198,
220,
220,
220,
7308,
2969,
3824,
769,
11,
17151,
11,
24582,
198,
8,
198,
6738,
1334,
62,
30604,
1330,
3722,
628,
198,
4871,
3893,
9787,
7680,
7,
14881,
2969,
3824,
769,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3582,
326,
9904,
2594,
460,
779,
284,
2198,
319,
262,
705,
282,
6517,
6,
286,
257,
198,
220,
220,
220,
2491,
19925,
2139,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3142,
62,
24396,
82,
796,
357,
18851,
35751,
198,
220,
220,
220,
4905,
62,
12985,
796,
705,
13948,
62,
9122,
6,
628,
198,
4871,
16290,
12837,
7680,
7,
14881,
2969,
3824,
769,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
16290,
3275,
7824,
1570,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
3142,
62,
24396,
82,
796,
357,
32782,
35751,
198,
220,
220,
220,
4938,
1352,
796,
16290,
12837,
18453,
32634,
7509,
198,
220,
220,
220,
4905,
62,
12985,
796,
705,
21280,
62,
20500,
6,
198
] | 3.064378 | 233 |
import requests
if __name__ == '__main__':
main()
| [
11748,
7007,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.666667 | 21 |
#
# Class SentimentSentences: sentences for polarity analysis
#
from nltk import stem
from collections import Counter
from bisect import bisect_left
from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text import CountVectorizer
| [
2,
198,
2,
5016,
11352,
3681,
31837,
3007,
25,
13439,
329,
755,
6806,
3781,
198,
2,
198,
198,
6738,
299,
2528,
74,
1330,
10717,
198,
6738,
17268,
1330,
15034,
198,
6738,
47457,
478,
1330,
47457,
478,
62,
9464,
198,
6738,
1341,
35720,
13,
29127,
62,
19849,
1330,
5972,
2569,
8081,
2234,
198,
6738,
1341,
35720,
13,
30053,
62,
2302,
7861,
13,
5239,
1330,
2764,
38469,
7509,
628
] | 3.925373 | 67 |
n = 10
result = []
while n < 1000000:
a = str(n)
temp = 0
for i in a:
temp += int(i) ** 5
if temp == n:
result.append(n)
n += 1
print(sum(result))
| [
77,
796,
838,
201,
198,
20274,
796,
17635,
201,
198,
4514,
299,
1279,
1802,
2388,
25,
201,
198,
220,
220,
220,
257,
796,
965,
7,
77,
8,
201,
198,
220,
220,
220,
20218,
796,
657,
201,
198,
220,
220,
220,
329,
1312,
287,
257,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
15853,
493,
7,
72,
8,
12429,
642,
201,
198,
220,
220,
220,
611,
20218,
6624,
299,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
13,
33295,
7,
77,
8,
201,
198,
220,
220,
220,
299,
15853,
352,
201,
198,
201,
198,
4798,
7,
16345,
7,
20274,
4008,
201,
198
] | 1.831776 | 107 |
for i in range(1, 100, 3):
pass | [
1640,
1312,
287,
2837,
7,
16,
11,
1802,
11,
513,
2599,
198,
220,
220,
220,
1208
] | 2.1875 | 16 |
import datetime
import os
from django.utils import timezone
from tzlocal import get_localzone
from obj_sys import obj_tools
from obj_sys.models_ufs_obj import UfsObj
from tagging.models import Tag
| [
11748,
4818,
8079,
198,
11748,
28686,
198,
198,
6738,
42625,
14208,
13,
26791,
1330,
640,
11340,
198,
6738,
256,
89,
12001,
1330,
651,
62,
12001,
11340,
198,
198,
6738,
26181,
62,
17597,
1330,
26181,
62,
31391,
198,
6738,
26181,
62,
17597,
13,
27530,
62,
3046,
82,
62,
26801,
1330,
471,
9501,
49201,
198,
6738,
49620,
13,
27530,
1330,
17467,
628,
628,
198
] | 3.274194 | 62 |
# When merging two debts, if the resulting debt is negative, this function is used to swap the creditor and debtor, so that the sum of debt is always positive
| [
198,
220,
220,
220,
1303,
1649,
35981,
734,
20250,
11,
611,
262,
7186,
5057,
318,
4633,
11,
428,
2163,
318,
973,
284,
16075,
262,
45848,
290,
49519,
11,
523,
326,
262,
2160,
286,
5057,
318,
1464,
3967,
628
] | 4.342105 | 38 |
from django import forms
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm
from datetime import timedelta
from main.models import UserEvent, UserProfile, Organization, Event
import pytz
| [
6738,
42625,
14208,
1330,
5107,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
11,
4912,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
23914,
1330,
11787,
12443,
341,
8479,
198,
6738,
4818,
8079,
1330,
28805,
12514,
198,
6738,
1388,
13,
27530,
1330,
11787,
9237,
11,
11787,
37046,
11,
12275,
11,
8558,
198,
198,
11748,
12972,
22877,
198
] | 3.796875 | 64 |
# -*- coding: utf-8 -*-
"""
Compute magnitude and relative vorticity
"""
import numpy as np
import matplotlib as mpl
mpl.rcParams['mathtext.default'] = 'regular'
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, addcyclic
from netCDF4 import Dataset
from pyveccalc.standard import WindHorizontal
from pyveccalc.tools import prep_data, recover_data
example_data_path = './example_data/data.nc'
with Dataset(example_data_path) as f:
lon = f.variables['longitude'][:]
lat = f.variables['latitude'][:]
u = f.variables['u'][:]
v = f.variables['v'][:]
vo = f.variables['vo'][:]
uu, info = prep_data(u,'tzyx')
vv, _ = prep_data(v,'tzyx')
W = WindHorizontal(uu,vv,lon,lat,'lonlat')
rel_vort = W.vort_z()
rel_vort = recover_data(rel_vort, info)
# Pick a level and a moment in time
# add a cyclic point (for plotting purposes)
rel_vort_c, lon_c = addcyclic(rel_vort[0,0,:,:], lon)
vo_c, _ = addcyclic(vo[0,0,:,:], lon)
#
# Plot the calculated relative vorticity along with relative vorticity from the dataset
#
fig, (ax1, ax2) = plt.subplots(nrows=2)
# Note: excluding high latitudes due to small grid step and large errors in finite differences
m = Basemap(ax=ax1, projection='cyl', resolution='c', \
llcrnrlon=0, llcrnrlat=-88, \
urcrnrlon=360.01, urcrnrlat=88)
x, y = m(*np.meshgrid(lon_c, lat))
c1 = m.contourf(x, y, vo_c*1e4, cmap=plt.cm.RdBu_r,
extend='both')
m.drawcoastlines()
m.drawparallels((-90, -60, -30, 0, 30, 60, 90), labels=[1,0,0,0])
m.drawmeridians((0, 60, 120, 180, 240, 300, 360), labels=[0,0,0,1])
plt.colorbar(c1, ax=ax1, orientation='horizontal')
ax1.set_title('Relative vorticity ($10^{-4}$s$^{-1}$)\n ERA-Interim', fontsize=16)
m = Basemap(ax=ax2, projection='cyl', resolution='c', \
llcrnrlon=0, llcrnrlat=-88, \
urcrnrlon=360.01, urcrnrlat=88)
x, y = m(*np.meshgrid(lon_c, lat))
c2 = m.contourf(x, y, rel_vort_c*1e4, cmap=plt.cm.RdBu_r,
extend='both')
m.drawcoastlines()
m.drawparallels((-90, -60, -30, 0, 30, 60, 90), labels=[1,0,0,0])
m.drawmeridians((0, 60, 120, 180, 240, 300, 360), labels=[0,0,0,1])
plt.colorbar(c2, ax=ax2, orientation='horizontal')
ax2.set_title('Relative vorticity ($10^{-4}$s$^{-1}$)\n calculated by pyveccalc', fontsize=16)
fig.tight_layout()
plt.show()
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
7293,
1133,
14735,
290,
3585,
410,
419,
8467,
198,
37811,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
355,
285,
489,
198,
76,
489,
13,
6015,
10044,
4105,
17816,
11018,
5239,
13,
12286,
20520,
796,
705,
16338,
6,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
285,
489,
62,
25981,
74,
896,
13,
12093,
368,
499,
1330,
6455,
368,
499,
11,
751,
15539,
291,
198,
6738,
2010,
34,
8068,
19,
1330,
16092,
292,
316,
198,
198,
6738,
12972,
303,
535,
282,
66,
13,
20307,
1330,
3086,
27991,
38342,
198,
6738,
12972,
303,
535,
282,
66,
13,
31391,
1330,
3143,
62,
7890,
11,
8551,
62,
7890,
198,
198,
20688,
62,
7890,
62,
6978,
796,
705,
19571,
20688,
62,
7890,
14,
7890,
13,
10782,
6,
198,
198,
4480,
16092,
292,
316,
7,
20688,
62,
7890,
62,
6978,
8,
355,
277,
25,
198,
220,
220,
220,
300,
261,
796,
277,
13,
25641,
2977,
17816,
6511,
3984,
6,
7131,
47715,
198,
220,
220,
220,
3042,
796,
277,
13,
25641,
2977,
17816,
15460,
3984,
6,
7131,
47715,
198,
220,
220,
220,
334,
796,
277,
13,
25641,
2977,
17816,
84,
6,
7131,
47715,
198,
220,
220,
220,
410,
796,
277,
13,
25641,
2977,
17816,
85,
6,
7131,
47715,
198,
220,
220,
220,
7608,
796,
277,
13,
25641,
2977,
17816,
13038,
6,
7131,
47715,
198,
198,
12303,
11,
7508,
796,
3143,
62,
7890,
7,
84,
4032,
83,
7357,
87,
11537,
198,
25093,
11,
4808,
796,
3143,
62,
7890,
7,
85,
4032,
83,
7357,
87,
11537,
198,
198,
54,
796,
3086,
27991,
38342,
7,
12303,
11,
25093,
11,
14995,
11,
15460,
4032,
14995,
15460,
11537,
198,
198,
2411,
62,
85,
419,
796,
370,
13,
85,
419,
62,
89,
3419,
198,
198,
2411,
62,
85,
419,
796,
8551,
62,
7890,
7,
2411,
62,
85,
419,
11,
7508,
8,
198,
198,
2,
12346,
257,
1241,
290,
257,
2589,
287,
640,
198,
2,
751,
257,
11700,
291,
966,
357,
1640,
29353,
4959,
8,
198,
2411,
62,
85,
419,
62,
66,
11,
300,
261,
62,
66,
796,
751,
15539,
291,
7,
2411,
62,
85,
419,
58,
15,
11,
15,
11,
45299,
25,
4357,
300,
261,
8,
198,
13038,
62,
66,
11,
4808,
796,
751,
15539,
291,
7,
13038,
58,
15,
11,
15,
11,
45299,
25,
4357,
300,
261,
8,
198,
198,
2,
198,
2,
28114,
262,
10488,
3585,
410,
419,
8467,
1863,
351,
3585,
410,
419,
8467,
422,
262,
27039,
198,
2,
220,
198,
5647,
11,
357,
897,
16,
11,
7877,
17,
8,
796,
458,
83,
13,
7266,
489,
1747,
7,
77,
8516,
28,
17,
8,
198,
198,
2,
5740,
25,
23494,
1029,
3042,
10455,
2233,
284,
1402,
10706,
2239,
290,
1588,
8563,
287,
27454,
5400,
198,
76,
796,
6455,
368,
499,
7,
897,
28,
897,
16,
11,
20128,
11639,
38801,
3256,
6323,
11639,
66,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32660,
6098,
48624,
14995,
28,
15,
11,
32660,
6098,
48624,
15460,
10779,
3459,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2956,
6098,
48624,
14995,
28,
15277,
13,
486,
11,
2956,
6098,
48624,
15460,
28,
3459,
8,
198,
87,
11,
331,
796,
285,
46491,
37659,
13,
76,
5069,
25928,
7,
14995,
62,
66,
11,
3042,
4008,
198,
66,
16,
796,
285,
13,
3642,
454,
69,
7,
87,
11,
331,
11,
7608,
62,
66,
9,
16,
68,
19,
11,
269,
8899,
28,
489,
83,
13,
11215,
13,
49,
36077,
84,
62,
81,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9117,
11639,
16885,
11537,
198,
76,
13,
19334,
1073,
459,
6615,
3419,
198,
76,
13,
19334,
37083,
7278,
19510,
12,
3829,
11,
532,
1899,
11,
532,
1270,
11,
657,
11,
1542,
11,
3126,
11,
4101,
828,
14722,
41888,
16,
11,
15,
11,
15,
11,
15,
12962,
198,
76,
13,
19334,
647,
312,
1547,
19510,
15,
11,
3126,
11,
7982,
11,
11546,
11,
14956,
11,
5867,
11,
11470,
828,
14722,
41888,
15,
11,
15,
11,
15,
11,
16,
12962,
198,
489,
83,
13,
8043,
5657,
7,
66,
16,
11,
7877,
28,
897,
16,
11,
12852,
11639,
17899,
38342,
11537,
198,
897,
16,
13,
2617,
62,
7839,
10786,
6892,
876,
410,
419,
8467,
7198,
940,
36796,
12,
19,
92,
3,
82,
3,
36796,
12,
16,
92,
3,
19415,
77,
18802,
12,
9492,
320,
3256,
10369,
7857,
28,
1433,
8,
198,
198,
76,
796,
6455,
368,
499,
7,
897,
28,
897,
17,
11,
20128,
11639,
38801,
3256,
6323,
11639,
66,
3256,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32660,
6098,
48624,
14995,
28,
15,
11,
32660,
6098,
48624,
15460,
10779,
3459,
11,
3467,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2956,
6098,
48624,
14995,
28,
15277,
13,
486,
11,
2956,
6098,
48624,
15460,
28,
3459,
8,
198,
87,
11,
331,
796,
285,
46491,
37659,
13,
76,
5069,
25928,
7,
14995,
62,
66,
11,
3042,
4008,
198,
66,
17,
796,
285,
13,
3642,
454,
69,
7,
87,
11,
331,
11,
823,
62,
85,
419,
62,
66,
9,
16,
68,
19,
11,
269,
8899,
28,
489,
83,
13,
11215,
13,
49,
36077,
84,
62,
81,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9117,
11639,
16885,
11537,
198,
76,
13,
19334,
1073,
459,
6615,
3419,
198,
76,
13,
19334,
37083,
7278,
19510,
12,
3829,
11,
532,
1899,
11,
532,
1270,
11,
657,
11,
1542,
11,
3126,
11,
4101,
828,
14722,
41888,
16,
11,
15,
11,
15,
11,
15,
12962,
198,
76,
13,
19334,
647,
312,
1547,
19510,
15,
11,
3126,
11,
7982,
11,
11546,
11,
14956,
11,
5867,
11,
11470,
828,
14722,
41888,
15,
11,
15,
11,
15,
11,
16,
12962,
198,
489,
83,
13,
8043,
5657,
7,
66,
17,
11,
7877,
28,
897,
17,
11,
12852,
11639,
17899,
38342,
11537,
198,
897,
17,
13,
2617,
62,
7839,
10786,
6892,
876,
410,
419,
8467,
7198,
940,
36796,
12,
19,
92,
3,
82,
3,
36796,
12,
16,
92,
3,
19415,
77,
10488,
416,
12972,
303,
535,
282,
66,
3256,
10369,
7857,
28,
1433,
8,
198,
198,
5647,
13,
33464,
62,
39786,
3419,
198,
489,
83,
13,
12860,
3419,
198
] | 2.208136 | 1,057 |
'''Preprocess Epinions and Slashdot data'''
'''Take in text file of data, create and save adjacency matrix'''
import numpy as np, pickle
import scipy.sparse as sp
#Preprocess data
#Optionally run normally or in test mode (when writing tests)
if __name__ == "__main__":
preprocess()
| [
7061,
6,
6719,
14681,
4551,
259,
507,
290,
26616,
26518,
1366,
7061,
6,
198,
7061,
6,
12322,
287,
2420,
2393,
286,
1366,
11,
2251,
290,
3613,
9224,
330,
1387,
17593,
7061,
6,
198,
198,
11748,
299,
32152,
355,
45941,
11,
2298,
293,
198,
11748,
629,
541,
88,
13,
82,
29572,
355,
599,
198,
198,
2,
6719,
14681,
1366,
198,
2,
19722,
453,
1057,
7685,
393,
287,
1332,
4235,
357,
12518,
3597,
5254,
8,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
662,
14681,
3419,
628
] | 3.164835 | 91 |
demo(15324) | [
220,
220,
220,
220,
201,
198,
201,
198,
9536,
78,
7,
21395,
1731,
8
] | 1.357143 | 14 |
import abc
import asyncio
import datetime
import logging
from typing import Any, Coroutine, Generic, Iterable, Iterator, Tuple, TypeVar
from .abc import ABCModbusProtocol, MultiRegister, SingleRegister
logger = logging.getLogger(__name__)
T = TypeVar("T")
class ACThorRegistersMixin(ABCModbusProtocol, abc.ABC):
"""
Provides direct access to the registers with some additional helper methods for accessing multi-register values.
"""
__slots__ = ()
power = ReadWrite(1000)
"""W
0-3.000 M1, 0-6.000 M3,
0-9.000 AC•THOR 9s
"""
temp1 = ReadOnly(1001, 10)
"""°C"""
temp2 = ReadOnly(1030, 10)
"""°C"""
temp3 = ReadOnly(1031, 10)
"""°C"""
temp4 = ReadOnly(1032, 10)
"""°C"""
temp5 = ReadOnly(1033, 10)
"""°C"""
temp6 = ReadOnly(1034, 10)
"""°C"""
temp7 = ReadOnly(1035, 10)
"""°C"""
temp8 = ReadOnly(1036, 10)
"""°C"""
# Sensors 2-8 can be read with a single instruction
_temp_range_2_8 = MultiRegister(1030, 7, factor=10)
ww1_max = ReadWrite(1002, 10)
"""°C"""
ww2_max = ReadWrite(1037, 10)
"""°C"""
ww3_max = ReadWrite(1038, 10)
"""°C"""
ww1_min = ReadWrite(1006, 10)
"""°C"""
ww2_min = ReadWrite(1039, 10)
"""°C"""
ww3_min = ReadWrite(1040, 10)
"""°C"""
_ww_range_2_3 = MultiRegister(1037, 4)
status = ReadOnly(1003)
"""
0..... Off
1-8... device start-up
9... operation
>=200 Error states power stage
"""
power_timeout = ReadWrite(1004)
"""sec"""
boost_mode = ReadWrite(1005)
"""0: off, 1: on, 3: relay boost on"""
boost_time1_start = ReadWrite(1007)
"""Hour"""
boost_time1_stop = ReadWrite(1008)
"""Hour"""
boost_time2_start = ReadWrite(1026)
"""Hour"""
boost_time2_stop = ReadWrite(1027)
"""Hour"""
_boost_time1_range = MultiRegister(1007, 2)
_boost_time2_range = MultiRegister(1026, 2)
hour = ReadWrite(1009)
minute = ReadWrite(1010)
second = ReadWrite(1011)
_hms_range = MultiRegister(1009, 3)
boost_activate = ReadWrite(1012)
number = ReadWrite(1013)
max_power = ReadWrite(1014)
"""500..3000W
do not use with 9s
"""
tempchip = ReadOnly(1015, 10)
"""°C"""
control_firmware_version = ReadOnly(1016)
control_firmware_subversion = ReadOnly(1028)
control_firmware_update_available = ReadOnly(1029)
"""
0 : no new afw available,
1 : new afw available (download not started, fw-version in variable Fwup_actual_version)
2 : download started (ini-file download)
3 : download started (afw.bin-file download)
4 : downloading other files
5 : download interrupted
10: download finished, waiting for installation
"""
ps_firmware_version = ReadOnly(1017)
serial_number = ReadOnlyText(1018, 8)
rh1_max = ReadWrite(1041, 10)
"""°C"""
rh2_max = ReadWrite(1042, 10)
"""°C"""
rh3_max = ReadWrite(1043, 10)
"""°C"""
rh1_day_min = ReadWrite(1044, 10)
"""°C"""
rh2_day_min = ReadWrite(1045, 10)
"""°C"""
rh3_day_min = ReadWrite(1046, 10)
"""°C"""
rh1_night_min = ReadWrite(1047, 10)
"""°C"""
rh2_night_min = ReadWrite(1048, 10)
"""°C"""
rh3_night_min = ReadWrite(1049, 10)
"""°C"""
_rhs_max_range = MultiRegister(1041, 3)
_rhs_day_min_range = MultiRegister(1044, 3)
_rhs_night_min_range = MultiRegister(1047, 3)
night_flag = ReadOnly(1050)
"""0: day, 1: night"""
utc_correction = ReadWrite(1051)
"""0..37"""
dst_correction = ReadWrite(1052)
"""0, 1"""
_time_correction_range = MultiRegister(1051, 2)
legionella_interval = ReadWrite(1053)
"""Days"""
legionella_start = ReadWrite(1054)
"""Hour"""
legionella_temp = ReadWrite(1055)
"""°C"""
legionella_mode = ReadWrite(1056)
"""0: off, 1: on"""
_legionella_range = MultiRegister(1053, 4)
stratification_flag = ReadOnly(1057)
"""0: off, 1: on"""
relay1_status = ReadOnly(1058)
"""0: off, 1: on"""
load_state = ReadOnly(1059)
"""0: off, 1: on"""
load_nominal_power = ReadOnly(1060)
"""W"""
u_l1 = ReadOnly(1061)
"""V"""
u_l2 = ReadOnly(1067)
"""V
9s only, ACTHOR replies 0
"""
u_l3 = ReadOnly(1072)
"""V
9s only, ACTHOR replies 0
"""
i_l1 = ReadOnly(1062, 10)
"""A"""
i_l2 = ReadOnly(1068, 10)
"""A
9s only, ACTHOR replies 0
"""
i_l3 = ReadOnly(1073, 10)
"""A
9s only, ACTHOR replies 0
"""
_l1_range = MultiRegister(1061, 2)
_l2_range = MultiRegister(1067, 2)
_l3_range = MultiRegister(1072, 2)
u_out = ReadOnly(1063)
"""V"""
freq = ReadOnly(1064)
"""mHz"""
operation_mode = ReadWrite(1065)
"""1-8
since version a0010004
"""
access_level = ReadWrite(1066)
"""1-3
since version a0010004
"""
meter_power = ReadOnly(1069)
"""integer, negative is feed in"""
control_type = ReadWrite(1070)
"""
1 = http
2 = Modbus TCP
3 = Fronius Auto
4 = Fronius Manual
5 = SMA
6 = Steca / Kostal Piko MP
7 = Varta Auto
8 = Varta Manual
9 = my-PV Power Meter Auto
10 = my-PV Power Meter Manual
11 = my-PV Power Meter Direkt (not readable, no network connection)
12 = reserved
13 = Multimode slave
14 = RCT Power Manual
15 = Adjustable Modbus TCP
"""
pmax_abs = ReadOnly(1071)
"""
incl. Slave-Power in case of multi-unit-mode
"""
p_out1 = ReadOnly(1074)
"""W
9s only, ACTHOR replies 0
"""
p_out2 = ReadOnly(1075)
"""W
9s only, ACTHOR replies 0
"""
p_out3 = ReadOnly(1076)
"""W
9s only, ACTHOR replies 0
"""
_p_out_range = MultiRegister(1074, 3)
operation_state = ReadOnly(1077)
"""
0 green tick flashes
1 yellow wave is on
2 yellow wave flashes
3 green tick is on
4 red cross is on
5 red cross flashes
"""
power_big = ReadWriteMulti(1078, 2)
"""W
Only for large systems with several units (multi-mode) and output specifications greater than
65,535 watts. Power below this value is entered in register 1000.
"""
power_and_relays = ReadWrite(1080)
"""W
9s only
Allows direct access to the AC•THOR 9s power stage and the relays in Modbus TCP mode.
bit 15: relay Out-3
bit 14: relay Out-2
bit 13 and 12:
0 ... power stage off
1 ... power stage to Out-1
2 ... power stage to Out-2
3 ... power stage to Out-3
bit 11 – 0: power stage power 0 – 3.000 (watt)
"""
async def get_temps(self) -> Tuple[float, float, float, float, float, float, float, float]:
"""Get the temperatures.
Reads all eight temperature sensors with only two instructions.
Returns:
8-tuple containing the temperatures in celsius.
"""
first_temp, other_temps = await asyncio.gather(self.temp1, self._temp_range_2_8.read(self))
return (first_temp, *other_temps)
async def get_temp(self, sensor: int) -> float:
"""Read the value of a temperature sensor.
Args:
sensor: Sensor number in [1..8].
Returns:
Temperature of the sensor.
"""
if not 1 <= sensor <= 8:
raise ValueError("sensor must be in range(1, 9)")
return await getattr(self, f"temp{sensor}")
async def get_control_firmware_version(self) -> Tuple[int, int]:
"""Read the full control firmware version.
Returns:
2-tuple (major, sub)..
"""
maj, sub = await asyncio.gather(self.control_firmware_version, self.control_firmware_subversion)
return maj, sub
| [
11748,
450,
66,
198,
11748,
30351,
952,
198,
11748,
4818,
8079,
198,
11748,
18931,
198,
6738,
19720,
1330,
4377,
11,
2744,
28399,
11,
42044,
11,
40806,
540,
11,
40806,
1352,
11,
309,
29291,
11,
5994,
19852,
198,
198,
6738,
764,
39305,
1330,
9738,
5841,
10885,
19703,
4668,
11,
15237,
38804,
11,
14206,
38804,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
198,
51,
796,
5994,
19852,
7203,
51,
4943,
628,
628,
628,
628,
628,
198,
4871,
7125,
46765,
8081,
6223,
35608,
259,
7,
24694,
5841,
10885,
19703,
4668,
11,
450,
66,
13,
24694,
2599,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
47081,
1277,
1895,
284,
262,
28441,
351,
617,
3224,
31904,
5050,
329,
22534,
5021,
12,
30238,
3815,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
11593,
6649,
1747,
834,
796,
7499,
628,
220,
220,
220,
1176,
796,
4149,
16594,
7,
12825,
8,
198,
220,
220,
220,
37227,
54,
198,
220,
220,
220,
220,
198,
220,
220,
220,
657,
12,
18,
13,
830,
337,
16,
11,
657,
12,
21,
13,
830,
337,
18,
11,
198,
220,
220,
220,
657,
12,
24,
13,
830,
7125,
3581,
4221,
1581,
860,
82,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
20218,
16,
796,
4149,
10049,
7,
47705,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
20218,
17,
796,
4149,
10049,
7,
940,
1270,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
20218,
18,
796,
4149,
10049,
7,
940,
3132,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
20218,
19,
796,
4149,
10049,
7,
940,
2624,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
20218,
20,
796,
4149,
10049,
7,
940,
2091,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
20218,
21,
796,
4149,
10049,
7,
940,
2682,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
20218,
22,
796,
4149,
10049,
7,
940,
2327,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
20218,
23,
796,
4149,
10049,
7,
940,
2623,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
628,
220,
220,
220,
1303,
14173,
669,
362,
12,
23,
460,
307,
1100,
351,
257,
2060,
12064,
198,
220,
220,
220,
4808,
29510,
62,
9521,
62,
17,
62,
23,
796,
15237,
38804,
7,
940,
1270,
11,
767,
11,
5766,
28,
940,
8,
628,
220,
220,
220,
266,
86,
16,
62,
9806,
796,
4149,
16594,
7,
3064,
17,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
266,
86,
17,
62,
9806,
796,
4149,
16594,
7,
940,
2718,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
266,
86,
18,
62,
9806,
796,
4149,
16594,
7,
940,
2548,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
628,
220,
220,
220,
266,
86,
16,
62,
1084,
796,
4149,
16594,
7,
3064,
21,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
266,
86,
17,
62,
1084,
796,
4149,
16594,
7,
940,
2670,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
266,
86,
18,
62,
1084,
796,
4149,
16594,
7,
940,
1821,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
628,
220,
220,
220,
4808,
1383,
62,
9521,
62,
17,
62,
18,
796,
15237,
38804,
7,
940,
2718,
11,
604,
8,
628,
220,
220,
220,
3722,
796,
4149,
10049,
7,
3064,
18,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
198,
220,
220,
220,
657,
12359,
3242,
198,
220,
220,
220,
352,
12,
23,
986,
3335,
923,
12,
929,
198,
220,
220,
220,
860,
986,
4905,
198,
220,
220,
220,
18189,
2167,
13047,
2585,
1176,
3800,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1176,
62,
48678,
796,
4149,
16594,
7,
3064,
19,
8,
198,
220,
220,
220,
37227,
2363,
37811,
198,
220,
220,
220,
5750,
62,
14171,
796,
4149,
16594,
7,
3064,
20,
8,
198,
220,
220,
220,
37227,
15,
25,
572,
11,
352,
25,
319,
11,
513,
25,
24248,
5750,
319,
37811,
628,
220,
220,
220,
5750,
62,
2435,
16,
62,
9688,
796,
4149,
16594,
7,
44318,
8,
198,
220,
220,
220,
37227,
43223,
37811,
198,
220,
220,
220,
5750,
62,
2435,
16,
62,
11338,
796,
4149,
16594,
7,
3064,
23,
8,
198,
220,
220,
220,
37227,
43223,
37811,
198,
220,
220,
220,
5750,
62,
2435,
17,
62,
9688,
796,
4149,
16594,
7,
940,
2075,
8,
198,
220,
220,
220,
37227,
43223,
37811,
198,
220,
220,
220,
5750,
62,
2435,
17,
62,
11338,
796,
4149,
16594,
7,
40403,
8,
198,
220,
220,
220,
37227,
43223,
37811,
628,
220,
220,
220,
4808,
39521,
62,
2435,
16,
62,
9521,
796,
15237,
38804,
7,
44318,
11,
362,
8,
198,
220,
220,
220,
4808,
39521,
62,
2435,
17,
62,
9521,
796,
15237,
38804,
7,
940,
2075,
11,
362,
8,
628,
220,
220,
220,
1711,
796,
4149,
16594,
7,
3064,
24,
8,
198,
220,
220,
220,
5664,
796,
4149,
16594,
7,
8784,
15,
8,
198,
220,
220,
220,
1218,
796,
4149,
16594,
7,
8784,
16,
8,
628,
220,
220,
220,
4808,
71,
907,
62,
9521,
796,
15237,
38804,
7,
3064,
24,
11,
513,
8,
628,
220,
220,
220,
5750,
62,
39022,
796,
4149,
16594,
7,
8784,
17,
8,
198,
220,
220,
220,
1271,
796,
4149,
16594,
7,
8784,
18,
8,
198,
220,
220,
220,
3509,
62,
6477,
796,
4149,
16594,
7,
8784,
19,
8,
198,
220,
220,
220,
37227,
4059,
492,
23924,
54,
198,
220,
220,
220,
220,
198,
220,
220,
220,
466,
407,
779,
351,
860,
82,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
20218,
35902,
796,
4149,
10049,
7,
8784,
20,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
628,
220,
220,
220,
1630,
62,
69,
2533,
1574,
62,
9641,
796,
4149,
10049,
7,
27956,
8,
198,
220,
220,
220,
1630,
62,
69,
2533,
1574,
62,
7266,
9641,
796,
4149,
10049,
7,
940,
2078,
8,
198,
220,
220,
220,
1630,
62,
69,
2533,
1574,
62,
19119,
62,
15182,
796,
4149,
10049,
7,
940,
1959,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
198,
220,
220,
220,
657,
1058,
645,
649,
6580,
86,
1695,
11,
198,
220,
220,
220,
352,
1058,
649,
6580,
86,
1695,
357,
15002,
407,
2067,
11,
277,
86,
12,
9641,
287,
7885,
376,
86,
929,
62,
50039,
62,
9641,
8,
198,
220,
220,
220,
362,
1058,
4321,
2067,
357,
5362,
12,
7753,
4321,
8,
198,
220,
220,
220,
513,
1058,
4321,
2067,
357,
1878,
86,
13,
8800,
12,
7753,
4321,
8,
198,
220,
220,
220,
604,
1058,
22023,
584,
3696,
198,
220,
220,
220,
642,
1058,
4321,
19072,
198,
220,
220,
220,
838,
25,
4321,
5201,
11,
4953,
329,
9988,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
26692,
62,
69,
2533,
1574,
62,
9641,
796,
4149,
10049,
7,
8784,
22,
8,
198,
220,
220,
220,
11389,
62,
17618,
796,
4149,
10049,
8206,
7,
8784,
23,
11,
807,
8,
628,
220,
220,
220,
9529,
16,
62,
9806,
796,
4149,
16594,
7,
940,
3901,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
9529,
17,
62,
9806,
796,
4149,
16594,
7,
940,
3682,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
9529,
18,
62,
9806,
796,
4149,
16594,
7,
940,
3559,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
628,
220,
220,
220,
9529,
16,
62,
820,
62,
1084,
796,
4149,
16594,
7,
940,
2598,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
9529,
17,
62,
820,
62,
1084,
796,
4149,
16594,
7,
940,
2231,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
9529,
18,
62,
820,
62,
1084,
796,
4149,
16594,
7,
940,
3510,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
628,
220,
220,
220,
9529,
16,
62,
3847,
62,
1084,
796,
4149,
16594,
7,
940,
2857,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
9529,
17,
62,
3847,
62,
1084,
796,
4149,
16594,
7,
940,
2780,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
9529,
18,
62,
3847,
62,
1084,
796,
4149,
16594,
7,
940,
2920,
11,
838,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
628,
220,
220,
220,
4808,
81,
11994,
62,
9806,
62,
9521,
796,
15237,
38804,
7,
940,
3901,
11,
513,
8,
198,
220,
220,
220,
4808,
81,
11994,
62,
820,
62,
1084,
62,
9521,
796,
15237,
38804,
7,
940,
2598,
11,
513,
8,
198,
220,
220,
220,
4808,
81,
11994,
62,
3847,
62,
1084,
62,
9521,
796,
15237,
38804,
7,
940,
2857,
11,
513,
8,
628,
220,
220,
220,
1755,
62,
32109,
796,
4149,
10049,
7,
940,
1120,
8,
198,
220,
220,
220,
37227,
15,
25,
1110,
11,
352,
25,
1755,
37811,
628,
220,
220,
220,
3384,
66,
62,
10215,
8243,
796,
4149,
16594,
7,
940,
4349,
8,
198,
220,
220,
220,
37227,
15,
492,
2718,
37811,
198,
220,
220,
220,
29636,
62,
10215,
8243,
796,
4149,
16594,
7,
940,
4309,
8,
198,
220,
220,
220,
37227,
15,
11,
352,
37811,
628,
220,
220,
220,
4808,
2435,
62,
10215,
8243,
62,
9521,
796,
15237,
38804,
7,
940,
4349,
11,
362,
8,
628,
220,
220,
220,
41453,
12627,
62,
3849,
2100,
796,
4149,
16594,
7,
940,
4310,
8,
198,
220,
220,
220,
37227,
38770,
37811,
198,
220,
220,
220,
41453,
12627,
62,
9688,
796,
4149,
16594,
7,
940,
4051,
8,
198,
220,
220,
220,
37227,
43223,
37811,
198,
220,
220,
220,
41453,
12627,
62,
29510,
796,
4149,
16594,
7,
940,
2816,
8,
198,
220,
220,
220,
37227,
7200,
34,
37811,
198,
220,
220,
220,
41453,
12627,
62,
14171,
796,
4149,
16594,
7,
940,
3980,
8,
198,
220,
220,
220,
37227,
15,
25,
572,
11,
352,
25,
319,
37811,
628,
220,
220,
220,
4808,
1455,
295,
12627,
62,
9521,
796,
15237,
38804,
7,
940,
4310,
11,
604,
8,
628,
220,
220,
220,
25369,
2649,
62,
32109,
796,
4149,
10049,
7,
940,
3553,
8,
198,
220,
220,
220,
37227,
15,
25,
572,
11,
352,
25,
319,
37811,
198,
220,
220,
220,
24248,
16,
62,
13376,
796,
4149,
10049,
7,
940,
3365,
8,
198,
220,
220,
220,
37227,
15,
25,
572,
11,
352,
25,
319,
37811,
198,
220,
220,
220,
3440,
62,
5219,
796,
4149,
10049,
7,
940,
3270,
8,
198,
220,
220,
220,
37227,
15,
25,
572,
11,
352,
25,
319,
37811,
198,
220,
220,
220,
3440,
62,
26601,
1292,
62,
6477,
796,
4149,
10049,
7,
940,
1899,
8,
198,
220,
220,
220,
37227,
54,
37811,
628,
220,
220,
220,
334,
62,
75,
16,
796,
4149,
10049,
7,
940,
5333,
8,
198,
220,
220,
220,
37227,
53,
37811,
198,
220,
220,
220,
334,
62,
75,
17,
796,
4149,
10049,
7,
940,
3134,
8,
198,
220,
220,
220,
37227,
53,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
11,
11741,
39,
1581,
20616,
657,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
334,
62,
75,
18,
796,
4149,
10049,
7,
940,
4761,
8,
198,
220,
220,
220,
37227,
53,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
11,
11741,
39,
1581,
20616,
657,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1312,
62,
75,
16,
796,
4149,
10049,
7,
940,
5237,
11,
838,
8,
198,
220,
220,
220,
37227,
32,
37811,
198,
220,
220,
220,
1312,
62,
75,
17,
796,
4149,
10049,
7,
940,
3104,
11,
838,
8,
198,
220,
220,
220,
37227,
32,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
11,
11741,
39,
1581,
20616,
657,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1312,
62,
75,
18,
796,
4149,
10049,
7,
940,
4790,
11,
838,
8,
198,
220,
220,
220,
37227,
32,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
11,
11741,
39,
1581,
20616,
657,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
4808,
75,
16,
62,
9521,
796,
15237,
38804,
7,
940,
5333,
11,
362,
8,
198,
220,
220,
220,
4808,
75,
17,
62,
9521,
796,
15237,
38804,
7,
940,
3134,
11,
362,
8,
198,
220,
220,
220,
4808,
75,
18,
62,
9521,
796,
15237,
38804,
7,
940,
4761,
11,
362,
8,
628,
220,
220,
220,
334,
62,
448,
796,
4149,
10049,
7,
940,
5066,
8,
198,
220,
220,
220,
37227,
53,
37811,
198,
220,
220,
220,
2030,
80,
796,
4149,
10049,
7,
940,
2414,
8,
198,
220,
220,
220,
37227,
76,
7399,
37811,
628,
220,
220,
220,
4905,
62,
14171,
796,
4149,
16594,
7,
940,
2996,
8,
198,
220,
220,
220,
37227,
16,
12,
23,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1201,
2196,
257,
8298,
830,
19,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1895,
62,
5715,
796,
4149,
16594,
7,
940,
2791,
8,
198,
220,
220,
220,
37227,
16,
12,
18,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1201,
2196,
257,
8298,
830,
19,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
16430,
62,
6477,
796,
4149,
10049,
7,
940,
3388,
8,
198,
220,
220,
220,
37227,
41433,
11,
4633,
318,
3745,
287,
37811,
198,
220,
220,
220,
1630,
62,
4906,
796,
4149,
16594,
7,
940,
2154,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
198,
220,
220,
220,
352,
220,
796,
2638,
198,
220,
220,
220,
362,
220,
796,
3401,
10885,
23633,
198,
220,
220,
220,
513,
220,
796,
1305,
261,
3754,
11160,
198,
220,
220,
220,
604,
220,
796,
1305,
261,
3754,
17969,
198,
220,
220,
220,
642,
220,
796,
311,
5673,
198,
220,
220,
220,
718,
220,
796,
520,
31047,
1220,
509,
455,
282,
350,
12125,
4904,
198,
220,
220,
220,
767,
220,
796,
569,
34202,
11160,
198,
220,
220,
220,
807,
220,
796,
569,
34202,
17969,
198,
220,
220,
220,
860,
220,
796,
616,
12,
47,
53,
4333,
46423,
11160,
198,
220,
220,
220,
838,
796,
616,
12,
47,
53,
4333,
46423,
17969,
198,
220,
220,
220,
1367,
796,
616,
12,
47,
53,
4333,
46423,
34177,
21841,
357,
1662,
31744,
11,
645,
3127,
4637,
8,
198,
220,
220,
220,
1105,
796,
10395,
198,
220,
220,
220,
1511,
796,
7854,
320,
1098,
11778,
198,
220,
220,
220,
1478,
796,
371,
4177,
4333,
17969,
198,
220,
220,
220,
1315,
796,
20292,
540,
3401,
10885,
23633,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
9114,
897,
62,
8937,
796,
4149,
10049,
7,
940,
4869,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
198,
220,
220,
220,
13358,
13,
38795,
12,
13434,
287,
1339,
286,
5021,
12,
20850,
12,
14171,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
279,
62,
448,
16,
796,
4149,
10049,
7,
940,
4524,
8,
198,
220,
220,
220,
37227,
54,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
11,
11741,
39,
1581,
20616,
657,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
279,
62,
448,
17,
796,
4149,
10049,
7,
940,
2425,
8,
198,
220,
220,
220,
37227,
54,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
11,
11741,
39,
1581,
20616,
657,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
279,
62,
448,
18,
796,
4149,
10049,
7,
940,
4304,
8,
198,
220,
220,
220,
37227,
54,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
11,
11741,
39,
1581,
20616,
657,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
4808,
79,
62,
448,
62,
9521,
796,
15237,
38804,
7,
940,
4524,
11,
513,
8,
628,
220,
220,
220,
4905,
62,
5219,
796,
4149,
10049,
7,
940,
3324,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
198,
220,
220,
220,
657,
4077,
4378,
29227,
198,
220,
220,
220,
352,
7872,
6769,
318,
319,
198,
220,
220,
220,
362,
7872,
6769,
29227,
198,
220,
220,
220,
513,
4077,
4378,
318,
319,
198,
220,
220,
220,
604,
2266,
3272,
318,
319,
198,
220,
220,
220,
642,
2266,
3272,
29227,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
1176,
62,
14261,
796,
4149,
16594,
29800,
7,
940,
3695,
11,
362,
8,
198,
220,
220,
220,
37227,
54,
198,
220,
220,
220,
220,
198,
220,
220,
220,
5514,
329,
1588,
3341,
351,
1811,
4991,
357,
41684,
12,
14171,
8,
290,
5072,
20640,
3744,
621,
198,
220,
220,
220,
6135,
11,
44465,
36416,
13,
4333,
2174,
428,
1988,
318,
5982,
287,
7881,
8576,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1176,
62,
392,
62,
2411,
592,
796,
4149,
16594,
7,
24045,
8,
198,
220,
220,
220,
37227,
54,
198,
220,
220,
220,
220,
198,
220,
220,
220,
860,
82,
691,
198,
220,
220,
220,
220,
198,
220,
220,
220,
40402,
1277,
1895,
284,
262,
7125,
3581,
4221,
1581,
860,
82,
1176,
3800,
290,
262,
823,
592,
287,
3401,
10885,
23633,
4235,
13,
198,
220,
220,
220,
1643,
1315,
25,
24248,
3806,
12,
18,
198,
220,
220,
220,
1643,
1478,
25,
24248,
3806,
12,
17,
198,
220,
220,
220,
1643,
1511,
290,
1105,
25,
198,
220,
220,
220,
220,
220,
220,
220,
657,
2644,
1176,
3800,
572,
198,
220,
220,
220,
220,
220,
220,
220,
352,
2644,
1176,
3800,
284,
3806,
12,
16,
198,
220,
220,
220,
220,
220,
220,
220,
362,
2644,
1176,
3800,
284,
3806,
12,
17,
198,
220,
220,
220,
220,
220,
220,
220,
513,
2644,
1176,
3800,
284,
3806,
12,
18,
198,
220,
220,
220,
1643,
1367,
784,
657,
25,
1176,
3800,
1176,
657,
784,
513,
13,
830,
357,
86,
1078,
8,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
30351,
825,
651,
62,
11498,
862,
7,
944,
8,
4613,
309,
29291,
58,
22468,
11,
12178,
11,
12178,
11,
12178,
11,
12178,
11,
12178,
11,
12178,
11,
12178,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
3855,
262,
10101,
13,
628,
220,
220,
220,
220,
220,
220,
220,
4149,
82,
477,
3624,
5951,
15736,
351,
691,
734,
7729,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
807,
12,
83,
29291,
7268,
262,
10101,
287,
269,
32495,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
717,
62,
29510,
11,
584,
62,
11498,
862,
796,
25507,
30351,
952,
13,
70,
1032,
7,
944,
13,
29510,
16,
11,
2116,
13557,
29510,
62,
9521,
62,
17,
62,
23,
13,
961,
7,
944,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
11085,
62,
29510,
11,
1635,
847,
62,
11498,
862,
8,
628,
220,
220,
220,
30351,
825,
651,
62,
29510,
7,
944,
11,
12694,
25,
493,
8,
4613,
12178,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5569,
262,
1988,
286,
257,
5951,
12694,
13,
628,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12694,
25,
35367,
1271,
287,
685,
16,
492,
23,
4083,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34467,
286,
262,
12694,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
352,
19841,
12694,
19841,
807,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
7203,
82,
22854,
1276,
307,
287,
2837,
7,
16,
11,
860,
8,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
25507,
651,
35226,
7,
944,
11,
277,
1,
29510,
90,
82,
22854,
92,
4943,
628,
220,
220,
220,
30351,
825,
651,
62,
13716,
62,
69,
2533,
1574,
62,
9641,
7,
944,
8,
4613,
309,
29291,
58,
600,
11,
493,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
5569,
262,
1336,
1630,
18779,
2196,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
362,
12,
83,
29291,
357,
22478,
11,
850,
8,
492,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16486,
11,
850,
796,
25507,
30351,
952,
13,
70,
1032,
7,
944,
13,
13716,
62,
69,
2533,
1574,
62,
9641,
11,
2116,
13,
13716,
62,
69,
2533,
1574,
62,
7266,
9641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
16486,
11,
850,
198
] | 2.266398 | 3,476 |
"""
This file is a part of the source code for the PygameCommunityBot.
This project has been licensed under the MIT license.
Copyright (c) 2020-present PygameCommunityDiscord
This file defines some constants and variables used across the whole codebase
"""
import io
import os
from typing import Optional, Union
import discord
import pygame
from dotenv import load_dotenv
if os.path.isfile(".env"):
load_dotenv() # take environment variables from .env
# declare type alias for any channel
Channel = Union[discord.TextChannel, discord.DMChannel, discord.GroupChannel]
# For commonly used variables
ints = discord.Intents.default()
ints.members = True # needed for on_member_join
bot = discord.Client(intents=ints)
window = pygame.Surface((1, 1)) # This will later be redefined
cmd_logs = {}
# pygame community guild, or whichever is the 'primary' guild for the bot
guild: Optional[discord.Guild] = None
# IO object to redirect output to discord, gets patched later
stdout: Optional[io.StringIO] = None
# Tuple containing all admin commands, gets monkey-patched later
admin_commands = ()
log_channel: discord.TextChannel
arrivals_channel: discord.TextChannel
roles_channel: discord.TextChannel
guide_channel: discord.TextChannel
entries_discussion_channel: discord.TextChannel
console_channel: discord.TextChannel
db_channel: discord.TextChannel
rules_channel: discord.TextChannel
entry_channels = {}
entry_message_deletion_dict = {}
__version__ = "1.5.3"
# BONCC quiky stuff
BONK = "<:pg_bonk:780423317718302781>"
PG_ANGRY_AN = "<a:pg_snake_angry_an:779775305224159232>"
TEST_MODE = "TEST_TOKEN" in os.environ
TOKEN = os.environ["TEST_TOKEN" if TEST_MODE else "TOKEN"]
TEST_USER_ID = int(os.environ["TEST_USER_ID"]) if "TEST_USER_ID" in os.environ else None
TEST_USER_IDS = (
set(int(user_id) for user_id in os.environ["TEST_USER_IDS"].split())
if "TEST_USER_IDS" in os.environ
else set()
)
if TEST_USER_ID is not None:
TEST_USER_IDS.add(TEST_USER_ID)
PREFIX = "pd!" if TEST_MODE else "pg!"
CMD_FUNC_PREFIX = "cmd_"
BASIC_MAX_FILE_SIZE = 8_000_000 # bytes
ZERO_SPACE = "\u200b" # U+200B
DOC_EMBED_LIMIT = 3
BROWSE_MESSAGE_LIMIT = 500
# indicates whether the bot is in generic mode or not. Generic mode is useful
# when you are testing the bot on other servers. Generic mode limits features of
# the bot that requires access to server specific stuff
GENERIC = False
UNIQUE_POLL_MSG = "You cannot make multiple votes in this poll\n"
WC_SCORING = (
("Legendary Guardian ⚜️💫", 42),
("Elite Guardian ⚜️", 30),
("Guardian ⚜️", 15),
("Apprentice ⚜️", 1),
)
class ServerConstants:
"""
Class of all server constants. If you ever want to make a copy of the bot
run on your own server on non-generic mode, replicate this class, but
with the constants from your server
"""
BOT_ID = 772788653326860288
SERVER_ID = 772505616680878080
RULES_CHANNEL_ID = 772509621747187712
ROLES_CHANNEL_ID = 772535163195228200
GUIDE_CHANNEL_ID = 772528306615615500
ARRIVALS_CHANNEL_ID = 774916117881159681
LOG_CHANNEL_ID = 793250875471822930
CONSOLE_CHANNEL_ID = 851123656880816138
ENTRY_CHANNEL_IDS = {
"showcase": 772507247540437032,
"resource": 810516093273768016,
}
ENTRIES_DISCUSSION_CHANNEL_ID = 780351772514058291
# eval is a pretty dangerous command, so grant it only for Admins and Senior Mages
EVAL_ROLES = {772521884373614603, 772849669591400501}
# Admin, Moderator, Senior Mage, Wizards, Lead Forgers
ADMIN_ROLES = {
772521884373614603,
772508687256125440,
772849669591400501,
841338117968756766,
839869589343961099,
}
# Specialties, Helpfulies, Verified pygame contributors, Server Boosters
PRIV_ROLES = {
774473681325785098,
778205389942030377,
780440736457031702,
787473199088533504,
}
DIVIDER_ROLES = {836645525372665887, 836645368744771654, 842754237774692392}
# IDs of rules messages, in the order from rule 1 to rule 7
RULES = (
799339450361577472,
799339479445405746,
799339501511639100,
799339582620827680,
799339603651067974,
799339620810358885,
819537779847200809,
)
# NOTE: It is hardcoded in the bot to remove some messages in resource-entries,
# if you want to remove more, add the ID to the set below
MSGS_TO_FILTER = {
817137523905527889,
810942002114986045,
810942043488256060,
}
# Database channel
DB_CHANNEL_ID = 838090567682490458
# remember to maintain the scores here in descending order
WC_ROLES = (
(42, 889170053013061683), # Legendary Guardian
(30, 889169676398100480), # Elite Guardian
(15, 889169351645749311), # Guardian
(1, 889168765479178240), # Apprentice
)
# Link to pygame snake logo
GUILD_ICON = "https://media.discordapp.net/attachments/793272780987826197/836600713672523826/Discord_Server_Animated_Logo_V5_512x512.gif"
BOT_WELCOME_MSG = {
"greet": (
"Hi",
"Hello",
"Welcome to **Pygame Community**",
"Greetings",
"Howdy",
"Hi there, ",
"Hey there",
"*Hiss* Who's that? It's",
"*Hiss* Welcome",
"Hello there,",
"Ooooh! Hello",
"Hi there,",
"*Hiss* Do I see a new user? *hiss*\n" + "Welcome to our wonderful chatroom",
"Ooooh! It's",
"Oooh! Look who has joined us, it's",
),
"check": (
"Check out our",
"Make sure to check out the",
"Take a look at our",
"See our",
"Please see our",
"Be sure to read our",
"Be sure to check the",
"Be sure to check out our",
"Read our",
"Have a look at our",
"To get started here, please read the",
),
"grab": (
", grab",
". Then get some",
", take",
", then grab yourself some shiny",
". Get some fancy",
", get some",
", then get yourself some cool",
", then get yourself some",
", take some",
", then take some",
", then take some",
". Go get some cool roles at",
". Then go take some fancy",
", then grab some shiny",
),
"end": (
" and have fun!",
", then have fun with pygame!",
", then have fun with pygame! *hiss*",
" and have a nice time!",
" and enjoy your stay!",
" and have some fun! *hisss*",
" and have fun here!",
" and have fun with pygame!",
" and have a wonderful time!",
" and join us!",
" and join the fun!",
" and have fun with pygame! *hisss*",
" and have fun here! *hisss*",
),
}
ILLEGAL_ATTRIBUTES = (
"__subclasses__",
"__loader__",
"__bases__",
"__code__",
"__getattribute__",
"__setattr__",
"__delattr_",
"mro",
"__class__",
"__dict__",
)
DEAD_CHAT_TRIGGERS = {
"the chat is dead",
"the chat is ded",
"this chat is dead",
"this is a ded chat",
"this is a dead chat",
"chat dead",
"chat ded",
"chatded",
"chatdead",
"dead chat",
"ded chat",
"dedchat",
"this chat ded",
"this chat dead",
}
BOT_MENTION = "the bot" if GENERIC else f"<@!{ServerConstants.BOT_ID}>"
BOT_HELP_PROMPT = {
"title": "Help",
"color": 0xFFFF00,
"description": f"""
Hey there, do you want to use {BOT_MENTION} ?
My command prefix is `{PREFIX}`.
If you want me to run your code, use Discord's code block syntax.
Learn more about Discord code formatting **[HERE](https://discord.com/channels/772505616680878080/774217896971730974/785510505728311306)**.
If you want to know about a specifc command run {PREFIX}help [command], for example {PREFIX}help exec.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━""",
}
BYDARIO_QUOTE = """
> Yea, if is dead bring it back to life or let it rest in peace
> When you are death ppl dont go to your tomb and say: dead person
> I know because I am dead and noone comes to visit me
<@!691691416799150152>
"""
SHAKESPEARE_QUOTES = (
"""
To be, or not to be, that is the question
— SHAKESPEARE, _Hamlet_, Act 3 Scene 1, lines 56-83; Hamlet
""",
"""
All the world's a stage,
And all the men and women merely players
— SHAKESPEARE, _As You Like It_, Act 2 Scene 7, lines 139-40; Jacques to Duke Senior and his companions
""",
"""
We are such stuff
As dreams are made on;
and our little life
Is rounded with a sleep
— SHAKESPEARE, _The Tempest_, Act 4 Scene 1, lines 156-58; Prospero to Miranda and Ferdinand
""",
"""
Out, out brief candle!
Life's but a walking shadow, a poor player,
That struts and frets his hour upon the stage.
— SHAKESPEARE, _Macbeth_, Act 5 Scene 5, Lines 23-25; Macbeth to Seyton
""",
"""
Be not afraid of greatness. Some are born great, some achieve greatness, and some have greatness thrust upon 'em.
— SHAKESPEARE, _Twelfth Night_, Act 2 Scene 5, Lines 139-41; Malvolio
""",
"""
When we are born we cry that we are come
To this great stage of fools
— SHAKESPEARE, _King Lear_, Act 4 Scene 6, lines 178-79; King Lear to Gloucester
""",
"""
The web of our life is of a mingled yarn, good and ill together
— SHAKESPEARE, _All's Well That Ends Well_, Act 4 Scene 3, lines 68-69; One lord to another
""",
"""
You cannot, sir, take from me anything that I will not more willingly part withal - except my life, except my life, except my life
— SHAKESPEARE, _Hamlet_, Act 2 Scene 2, lines 213-17; Hamlet
""",
)
| [
37811,
198,
1212,
2393,
318,
257,
636,
286,
262,
2723,
2438,
329,
262,
9485,
6057,
20012,
20630,
13,
198,
1212,
1628,
468,
587,
11971,
739,
262,
17168,
5964,
13,
198,
15269,
357,
66,
8,
12131,
12,
25579,
9485,
6057,
20012,
15642,
585,
198,
198,
1212,
2393,
15738,
617,
38491,
290,
9633,
973,
1973,
262,
2187,
2438,
8692,
198,
37811,
198,
198,
11748,
33245,
198,
11748,
28686,
198,
6738,
19720,
1330,
32233,
11,
4479,
198,
198,
11748,
36446,
198,
11748,
12972,
6057,
198,
198,
6738,
16605,
24330,
1330,
3440,
62,
26518,
24330,
198,
198,
361,
28686,
13,
6978,
13,
4468,
576,
7,
1911,
24330,
1,
2599,
198,
220,
220,
220,
3440,
62,
26518,
24330,
3419,
220,
1303,
1011,
2858,
9633,
422,
764,
24330,
198,
198,
2,
13627,
2099,
16144,
329,
597,
6518,
198,
29239,
796,
4479,
58,
15410,
585,
13,
8206,
29239,
11,
36446,
13,
23127,
29239,
11,
36446,
13,
13247,
29239,
60,
198,
198,
2,
1114,
8811,
973,
9633,
198,
29503,
796,
36446,
13,
5317,
658,
13,
12286,
3419,
198,
29503,
13,
30814,
796,
6407,
220,
1303,
2622,
329,
319,
62,
19522,
62,
22179,
198,
13645,
796,
36446,
13,
11792,
7,
600,
658,
28,
29503,
8,
198,
17497,
796,
12972,
6057,
13,
14214,
2550,
19510,
16,
11,
352,
4008,
220,
1303,
770,
481,
1568,
307,
2266,
18156,
198,
198,
28758,
62,
6404,
82,
796,
23884,
198,
198,
2,
12972,
6057,
2055,
19806,
11,
393,
26204,
318,
262,
705,
39754,
6,
19806,
329,
262,
10214,
198,
70,
3547,
25,
32233,
58,
15410,
585,
13,
38,
3547,
60,
796,
6045,
198,
198,
2,
24418,
2134,
284,
18941,
5072,
284,
36446,
11,
3011,
39378,
1568,
198,
19282,
448,
25,
32233,
58,
952,
13,
10100,
9399,
60,
796,
6045,
198,
198,
2,
309,
29291,
7268,
477,
13169,
9729,
11,
3011,
21657,
12,
8071,
1740,
1568,
198,
28482,
62,
9503,
1746,
796,
7499,
198,
198,
6404,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
283,
380,
12786,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
305,
829,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
41311,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
298,
1678,
62,
15410,
11956,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
41947,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
9945,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
38785,
62,
17620,
25,
36446,
13,
8206,
29239,
198,
13000,
62,
354,
8961,
796,
23884,
198,
13000,
62,
20500,
62,
2934,
1616,
295,
62,
11600,
796,
23884,
198,
198,
834,
9641,
834,
796,
366,
16,
13,
20,
13,
18,
1,
198,
198,
2,
347,
1340,
4093,
627,
47536,
3404,
198,
33,
1340,
42,
796,
33490,
25,
6024,
62,
4189,
74,
25,
22,
36088,
25429,
22413,
1507,
1270,
1983,
6659,
24618,
198,
6968,
62,
1565,
10761,
56,
62,
1565,
796,
33490,
64,
25,
6024,
62,
16184,
539,
62,
648,
563,
62,
272,
25,
3324,
5607,
2425,
1270,
4309,
1731,
19707,
24339,
24618,
198,
198,
51,
6465,
62,
49058,
796,
366,
51,
6465,
62,
10468,
43959,
1,
287,
28686,
13,
268,
2268,
198,
10468,
43959,
796,
28686,
13,
268,
2268,
14692,
51,
6465,
62,
10468,
43959,
1,
611,
43001,
62,
49058,
2073,
366,
10468,
43959,
8973,
198,
198,
51,
6465,
62,
29904,
62,
2389,
796,
493,
7,
418,
13,
268,
2268,
14692,
51,
6465,
62,
29904,
62,
2389,
8973,
8,
611,
366,
51,
6465,
62,
29904,
62,
2389,
1,
287,
28686,
13,
268,
2268,
2073,
6045,
198,
198,
51,
6465,
62,
29904,
62,
14255,
796,
357,
198,
220,
220,
220,
900,
7,
600,
7,
7220,
62,
312,
8,
329,
2836,
62,
312,
287,
28686,
13,
268,
2268,
14692,
51,
6465,
62,
29904,
62,
14255,
1,
4083,
35312,
28955,
198,
220,
220,
220,
611,
366,
51,
6465,
62,
29904,
62,
14255,
1,
287,
28686,
13,
268,
2268,
198,
220,
220,
220,
2073,
900,
3419,
198,
8,
198,
198,
361,
43001,
62,
29904,
62,
2389,
318,
407,
6045,
25,
198,
220,
220,
220,
43001,
62,
29904,
62,
14255,
13,
2860,
7,
51,
6465,
62,
29904,
62,
2389,
8,
628,
198,
47,
31688,
10426,
796,
366,
30094,
2474,
611,
43001,
62,
49058,
2073,
366,
6024,
2474,
198,
34,
12740,
62,
42296,
34,
62,
47,
31688,
10426,
796,
366,
28758,
62,
1,
198,
198,
33,
1921,
2149,
62,
22921,
62,
25664,
62,
33489,
796,
807,
62,
830,
62,
830,
220,
1303,
9881,
198,
198,
57,
34812,
62,
4303,
11598,
796,
37082,
84,
2167,
65,
1,
220,
1303,
471,
10,
2167,
33,
198,
198,
38715,
62,
3620,
33,
1961,
62,
43,
3955,
2043,
796,
513,
198,
11473,
3913,
5188,
62,
44,
1546,
4090,
8264,
62,
43,
3955,
2043,
796,
5323,
198,
198,
2,
9217,
1771,
262,
10214,
318,
287,
14276,
4235,
393,
407,
13,
42044,
4235,
318,
4465,
198,
2,
618,
345,
389,
4856,
262,
10214,
319,
584,
9597,
13,
42044,
4235,
7095,
3033,
286,
198,
2,
262,
10214,
326,
4433,
1895,
284,
4382,
2176,
3404,
198,
35353,
1137,
2149,
796,
10352,
198,
198,
4944,
33866,
8924,
62,
16402,
3069,
62,
5653,
38,
796,
366,
1639,
2314,
787,
3294,
5690,
287,
428,
3278,
59,
77,
1,
198,
198,
27353,
62,
6173,
1581,
2751,
796,
357,
198,
220,
220,
220,
5855,
24524,
8283,
2343,
248,
250,
37929,
8582,
240,
104,
1600,
5433,
828,
198,
220,
220,
220,
5855,
9527,
578,
8283,
2343,
248,
250,
37929,
1600,
1542,
828,
198,
220,
220,
220,
5855,
24502,
666,
2343,
248,
250,
37929,
1600,
1315,
828,
198,
220,
220,
220,
5855,
4677,
20098,
2343,
248,
250,
37929,
1600,
352,
828,
198,
8,
628,
198,
4871,
9652,
34184,
1187,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
5016,
286,
477,
4382,
38491,
13,
1002,
345,
1683,
765,
284,
787,
257,
4866,
286,
262,
10214,
198,
220,
220,
220,
1057,
319,
534,
898,
4382,
319,
1729,
12,
41357,
4235,
11,
24340,
428,
1398,
11,
475,
198,
220,
220,
220,
351,
262,
38491,
422,
534,
4382,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
347,
2394,
62,
2389,
796,
8541,
1983,
3459,
2996,
2091,
25022,
1899,
25270,
628,
220,
220,
220,
18871,
5959,
62,
2389,
796,
767,
4761,
1120,
3980,
23055,
1795,
5774,
1795,
1795,
628,
220,
220,
220,
371,
6239,
1546,
62,
3398,
22846,
3698,
62,
2389,
796,
767,
4761,
1120,
4846,
24591,
2857,
1507,
3324,
1065,
198,
220,
220,
220,
371,
3535,
1546,
62,
3398,
22846,
3698,
62,
2389,
796,
8541,
1495,
2327,
24136,
22186,
23815,
2167,
198,
220,
220,
220,
19348,
14114,
62,
3398,
22846,
3698,
62,
2389,
796,
8541,
1495,
2078,
1270,
2791,
21599,
1314,
4059,
198,
220,
220,
220,
5923,
49,
3824,
23333,
62,
3398,
22846,
3698,
62,
2389,
796,
8541,
2920,
1433,
17657,
3459,
1157,
3270,
48564,
198,
220,
220,
220,
41605,
62,
3398,
22846,
3698,
62,
2389,
796,
9225,
2624,
1120,
31360,
2857,
1507,
23539,
1270,
198,
220,
220,
220,
7102,
15821,
2538,
62,
3398,
22846,
3698,
62,
2389,
796,
807,
4349,
1065,
24760,
3104,
28362,
1433,
20107,
198,
220,
220,
220,
12964,
40405,
62,
3398,
22846,
3698,
62,
14255,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12860,
7442,
1298,
767,
4761,
35378,
1731,
2425,
1821,
3559,
2154,
2624,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
31092,
1298,
807,
13348,
1433,
2931,
34159,
2718,
3104,
27037,
11,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
12964,
5446,
11015,
62,
26288,
34,
32835,
2849,
62,
3398,
22846,
3698,
62,
2389,
796,
41287,
2327,
22413,
1495,
1415,
2713,
23,
33551,
628,
220,
220,
220,
1303,
5418,
318,
257,
2495,
4923,
3141,
11,
523,
7264,
340,
691,
329,
1215,
42951,
290,
14017,
46796,
198,
220,
220,
220,
8696,
1847,
62,
49,
3535,
1546,
796,
1391,
3324,
22800,
1507,
5705,
2718,
2623,
1415,
35642,
11,
8541,
2078,
2920,
36657,
3270,
1415,
22544,
486,
92,
628,
220,
220,
220,
1303,
32053,
11,
35926,
1352,
11,
14017,
17323,
11,
21092,
11,
20116,
1114,
5355,
198,
220,
220,
220,
5984,
23678,
62,
49,
3535,
1546,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
8541,
22800,
1507,
5705,
2718,
2623,
1415,
35642,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
4761,
33042,
39925,
11645,
1065,
4051,
1821,
11,
198,
220,
220,
220,
220,
220,
220,
220,
8541,
2078,
2920,
36657,
3270,
1415,
22544,
486,
11,
198,
220,
220,
220,
220,
220,
220,
220,
9508,
1485,
2548,
1157,
3720,
3104,
2425,
3134,
2791,
11,
198,
220,
220,
220,
220,
220,
220,
220,
807,
31952,
3388,
44169,
2682,
34107,
940,
2079,
11,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
1303,
6093,
4278,
11,
21656,
444,
11,
4643,
1431,
12972,
6057,
20420,
11,
9652,
19835,
364,
198,
220,
220,
220,
4810,
3824,
62,
49,
3535,
1546,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
8541,
34825,
27412,
1485,
1495,
3695,
1120,
4089,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
3695,
21261,
2548,
2079,
27211,
1270,
26514,
11,
198,
220,
220,
220,
220,
220,
220,
220,
41287,
25644,
49150,
2231,
2154,
34125,
2999,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
5774,
37804,
19104,
2919,
5332,
2091,
33580,
11,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
360,
3824,
41237,
62,
49,
3535,
1546,
796,
1391,
23,
32459,
30505,
1495,
2718,
2075,
2996,
46660,
11,
807,
32459,
2231,
2623,
5774,
2598,
3324,
1433,
4051,
11,
9508,
1983,
4051,
1954,
3324,
4524,
3388,
1954,
5892,
92,
628,
220,
220,
220,
1303,
32373,
286,
3173,
6218,
11,
287,
262,
1502,
422,
3896,
352,
284,
3896,
767,
198,
220,
220,
220,
371,
6239,
1546,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
767,
2079,
2091,
5824,
1120,
2623,
1314,
3324,
37856,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
2079,
29626,
2857,
5824,
2231,
1821,
3553,
3510,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
2079,
2091,
3865,
25150,
18298,
2670,
3064,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
2079,
29626,
3365,
2075,
21315,
27988,
1795,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
2079,
29626,
1899,
24760,
940,
37601,
4524,
11,
198,
220,
220,
220,
220,
220,
220,
220,
767,
2079,
2091,
4846,
21315,
940,
2327,
3459,
5332,
11,
198,
220,
220,
220,
220,
220,
220,
220,
807,
22186,
2718,
3324,
4089,
2857,
2167,
34583,
11,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
1303,
24550,
25,
632,
318,
1327,
40976,
287,
262,
10214,
284,
4781,
617,
6218,
287,
8271,
12,
298,
1678,
11,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
611,
345,
765,
284,
4781,
517,
11,
751,
262,
4522,
284,
262,
900,
2174,
198,
220,
220,
220,
6579,
14313,
62,
10468,
62,
46700,
5781,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
807,
1558,
1485,
2425,
23516,
47838,
1983,
39121,
11,
198,
220,
220,
220,
220,
220,
220,
220,
807,
940,
5824,
16942,
1157,
36260,
1899,
2231,
11,
198,
220,
220,
220,
220,
220,
220,
220,
807,
940,
5824,
18638,
2682,
3459,
1495,
1899,
1899,
11,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
1303,
24047,
6518,
198,
220,
220,
220,
20137,
62,
3398,
22846,
3698,
62,
2389,
796,
9698,
34583,
2713,
3134,
3104,
1731,
3829,
29334,
628,
220,
220,
220,
1303,
3505,
284,
5529,
262,
8198,
994,
287,
31491,
1502,
198,
220,
220,
220,
28387,
62,
49,
3535,
1546,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
357,
3682,
11,
807,
4531,
1558,
405,
4310,
486,
20548,
1433,
5999,
828,
220,
1303,
22067,
8283,
198,
220,
220,
220,
220,
220,
220,
220,
357,
1270,
11,
807,
4531,
22172,
42548,
31952,
3064,
22148,
828,
220,
1303,
16158,
8283,
198,
220,
220,
220,
220,
220,
220,
220,
357,
1314,
11,
807,
4531,
22172,
2327,
1433,
33032,
2920,
36244,
828,
220,
1303,
8283,
198,
220,
220,
220,
220,
220,
220,
220,
357,
16,
11,
807,
4531,
1433,
5774,
2996,
31714,
23188,
16102,
828,
220,
1303,
31581,
198,
220,
220,
220,
1267,
628,
198,
2,
7502,
284,
12972,
6057,
17522,
11112,
198,
38022,
26761,
62,
2149,
1340,
796,
366,
5450,
1378,
11431,
13,
15410,
585,
1324,
13,
3262,
14,
47348,
902,
14,
3720,
34159,
1983,
1795,
4089,
3695,
2075,
24991,
14,
23,
2623,
8054,
50055,
3134,
1495,
23721,
2075,
14,
15642,
585,
62,
10697,
62,
2025,
15655,
62,
11187,
78,
62,
53,
20,
62,
25836,
87,
25836,
13,
27908,
1,
198,
198,
33,
2394,
62,
54,
3698,
9858,
36,
62,
5653,
38,
796,
1391,
198,
220,
220,
220,
366,
70,
2871,
1298,
357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
17250,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
15496,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14618,
284,
12429,
20519,
6057,
8108,
1174,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
38,
46648,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
2437,
9892,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
17250,
612,
11,
33172,
198,
220,
220,
220,
220,
220,
220,
220,
366,
10814,
612,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9,
39,
747,
9,
5338,
338,
326,
30,
632,
338,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9,
39,
747,
9,
19134,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
15496,
612,
553,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
46,
2238,
1219,
0,
18435,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
17250,
612,
553,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9,
39,
747,
9,
2141,
314,
766,
257,
649,
2836,
30,
1635,
71,
747,
9,
59,
77,
1,
1343,
366,
14618,
284,
674,
7932,
8537,
3823,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
46,
2238,
1219,
0,
632,
338,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
46,
78,
1219,
0,
6803,
508,
468,
5399,
514,
11,
340,
338,
1600,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
366,
9122,
1298,
357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9787,
503,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12050,
1654,
284,
2198,
503,
262,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12322,
257,
804,
379,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
6214,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
5492,
766,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
3856,
1654,
284,
1100,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
3856,
1654,
284,
2198,
262,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
3856,
1654,
284,
2198,
503,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
5569,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
11980,
257,
804,
379,
674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
2514,
651,
2067,
994,
11,
3387,
1100,
262,
1600,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
366,
32393,
1298,
357,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
5552,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
27071,
3244,
651,
617,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
1011,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
5552,
3511,
617,
22441,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
27071,
3497,
617,
14996,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
651,
617,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
651,
3511,
617,
3608,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
651,
3511,
617,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
1011,
617,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
1011,
617,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
1011,
617,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
27071,
1514,
651,
617,
3608,
9176,
379,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
27071,
3244,
467,
1011,
617,
14996,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
5552,
617,
22441,
1600,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
366,
437,
1298,
357,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
1257,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
423,
1257,
351,
12972,
6057,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
33172,
788,
423,
1257,
351,
12972,
6057,
0,
1635,
71,
747,
9,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
257,
3621,
640,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
2883,
534,
2652,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
617,
1257,
0,
1635,
71,
747,
82,
9,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
1257,
994,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
1257,
351,
12972,
6057,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
257,
7932,
640,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
4654,
514,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
4654,
262,
1257,
40754,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
1257,
351,
12972,
6057,
0,
1635,
71,
747,
82,
9,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
290,
423,
1257,
994,
0,
1635,
71,
747,
82,
9,
1600,
198,
220,
220,
220,
10612,
198,
92,
198,
198,
33844,
38,
1847,
62,
1404,
5446,
9865,
3843,
1546,
796,
357,
198,
220,
220,
220,
366,
834,
7266,
37724,
834,
1600,
198,
220,
220,
220,
366,
834,
29356,
834,
1600,
198,
220,
220,
220,
366,
834,
65,
1386,
834,
1600,
198,
220,
220,
220,
366,
834,
8189,
834,
1600,
198,
220,
220,
220,
366,
834,
1136,
42348,
834,
1600,
198,
220,
220,
220,
366,
834,
2617,
35226,
834,
1600,
198,
220,
220,
220,
366,
834,
12381,
35226,
62,
1600,
198,
220,
220,
220,
366,
76,
305,
1600,
198,
220,
220,
220,
366,
834,
4871,
834,
1600,
198,
220,
220,
220,
366,
834,
11600,
834,
1600,
198,
8,
198,
198,
7206,
2885,
62,
31542,
62,
5446,
3528,
38,
4877,
796,
1391,
198,
220,
220,
220,
366,
1169,
8537,
318,
2636,
1600,
198,
220,
220,
220,
366,
1169,
8537,
318,
4648,
1600,
198,
220,
220,
220,
366,
5661,
8537,
318,
2636,
1600,
198,
220,
220,
220,
366,
5661,
318,
257,
4648,
8537,
1600,
198,
220,
220,
220,
366,
5661,
318,
257,
2636,
8537,
1600,
198,
220,
220,
220,
366,
17006,
2636,
1600,
198,
220,
220,
220,
366,
17006,
4648,
1600,
198,
220,
220,
220,
366,
17006,
9395,
1600,
198,
220,
220,
220,
366,
17006,
25124,
1600,
198,
220,
220,
220,
366,
25124,
8537,
1600,
198,
220,
220,
220,
366,
9395,
8537,
1600,
198,
220,
220,
220,
366,
9395,
17006,
1600,
198,
220,
220,
220,
366,
5661,
8537,
4648,
1600,
198,
220,
220,
220,
366,
5661,
8537,
2636,
1600,
198,
92,
198,
198,
33,
2394,
62,
10979,
2849,
796,
366,
1169,
10214,
1,
611,
24700,
1137,
2149,
2073,
277,
1,
27,
31,
0,
90,
10697,
34184,
1187,
13,
33,
2394,
62,
2389,
92,
24618,
198,
198,
33,
2394,
62,
39,
3698,
47,
62,
4805,
2662,
11571,
796,
1391,
198,
220,
220,
220,
366,
7839,
1298,
366,
22087,
1600,
198,
220,
220,
220,
366,
8043,
1298,
657,
87,
29312,
405,
11,
198,
220,
220,
220,
366,
11213,
1298,
277,
37811,
198,
10814,
612,
11,
466,
345,
765,
284,
779,
1391,
33,
2394,
62,
10979,
2849,
92,
5633,
198,
3666,
3141,
21231,
318,
4600,
90,
47,
31688,
10426,
92,
44646,
198,
1532,
345,
765,
502,
284,
1057,
534,
2438,
11,
779,
39462,
338,
2438,
2512,
15582,
13,
198,
20238,
517,
546,
39462,
2438,
33313,
12429,
58,
39,
9338,
16151,
5450,
1378,
15410,
585,
13,
785,
14,
354,
8961,
14,
3324,
9031,
3980,
23055,
1795,
5774,
1795,
1795,
14,
3324,
3682,
1558,
4531,
40035,
1558,
26895,
4524,
14,
3695,
2816,
940,
1120,
3553,
30290,
1157,
20548,
8,
1174,
13,
198,
1532,
345,
765,
284,
760,
546,
257,
1020,
361,
66,
3141,
1057,
1391,
47,
31688,
10426,
92,
16794,
685,
21812,
4357,
329,
1672,
1391,
47,
31688,
10426,
92,
16794,
2452,
13,
198,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
47486,
15931,
1600,
198,
92,
198,
198,
17513,
35,
1503,
9399,
62,
10917,
23051,
796,
37227,
198,
29,
11609,
64,
11,
611,
318,
2636,
2222,
340,
736,
284,
1204,
393,
1309,
340,
1334,
287,
4167,
198,
29,
1649,
345,
389,
1918,
279,
489,
17666,
467,
284,
534,
22234,
290,
910,
25,
2636,
1048,
198,
29,
314,
760,
780,
314,
716,
2636,
290,
645,
505,
2058,
284,
3187,
502,
198,
27,
31,
0,
3388,
22172,
1415,
21940,
2079,
1314,
486,
4309,
29,
198,
37811,
198,
198,
37596,
42,
1546,
11401,
12203,
62,
10917,
2394,
1546,
796,
357,
198,
220,
220,
220,
37227,
198,
2514,
307,
11,
393,
407,
284,
307,
11,
326,
318,
262,
1808,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
21281,
1616,
62,
11,
2191,
513,
28315,
352,
11,
3951,
7265,
12,
5999,
26,
4345,
1616,
198,
15931,
1600,
198,
220,
220,
220,
37227,
198,
3237,
262,
995,
338,
257,
3800,
11,
198,
1870,
477,
262,
1450,
290,
1466,
6974,
1938,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
1722,
921,
4525,
632,
62,
11,
2191,
362,
28315,
767,
11,
3951,
23666,
12,
1821,
26,
35437,
284,
11083,
14017,
290,
465,
19429,
198,
15931,
1600,
198,
220,
220,
220,
37227,
198,
1135,
389,
884,
3404,
198,
1722,
10625,
389,
925,
319,
26,
198,
392,
674,
1310,
1204,
198,
3792,
19273,
351,
257,
3993,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
464,
34367,
62,
11,
2191,
604,
28315,
352,
11,
3951,
23871,
12,
3365,
26,
41342,
78,
284,
29575,
290,
44312,
198,
15931,
1600,
198,
220,
220,
220,
37227,
198,
7975,
11,
503,
4506,
26839,
0,
198,
14662,
338,
475,
257,
6155,
9082,
11,
257,
3595,
2137,
11,
198,
2504,
965,
5500,
290,
2030,
912,
465,
1711,
2402,
262,
3800,
13,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
14155,
65,
2788,
62,
11,
2191,
642,
28315,
642,
11,
26299,
2242,
12,
1495,
26,
4100,
65,
2788,
284,
1001,
31616,
198,
15931,
1600,
198,
220,
220,
220,
37227,
198,
3856,
407,
7787,
286,
27951,
13,
2773,
389,
4642,
1049,
11,
617,
4620,
27951,
11,
290,
617,
423,
27951,
14613,
2402,
705,
368,
13,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
5080,
44659,
5265,
62,
11,
2191,
362,
28315,
642,
11,
26299,
23666,
12,
3901,
26,
4434,
10396,
952,
198,
15931,
1600,
198,
220,
220,
220,
37227,
198,
2215,
356,
389,
4642,
356,
3960,
326,
356,
389,
1282,
198,
2514,
428,
1049,
3800,
286,
37323,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
15708,
8010,
62,
11,
2191,
604,
28315,
718,
11,
3951,
27368,
12,
3720,
26,
2677,
8010,
284,
49383,
33187,
198,
15931,
1600,
198,
220,
220,
220,
37227,
198,
464,
3992,
286,
674,
1204,
318,
286,
257,
42434,
992,
21181,
11,
922,
290,
2801,
1978,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
3237,
338,
3894,
1320,
46756,
3894,
62,
11,
2191,
604,
28315,
513,
11,
3951,
8257,
12,
3388,
26,
1881,
15876,
284,
1194,
198,
15931,
1600,
198,
220,
220,
220,
37227,
198,
1639,
2314,
11,
15967,
11,
1011,
422,
502,
1997,
326,
314,
481,
407,
517,
30981,
636,
351,
282,
532,
2845,
616,
1204,
11,
2845,
616,
1204,
11,
2845,
616,
1204,
198,
960,
6006,
10206,
1546,
11401,
12203,
11,
4808,
21281,
1616,
62,
11,
2191,
362,
28315,
362,
11,
3951,
28658,
12,
1558,
26,
4345,
1616,
198,
15931,
1600,
198,
8,
198
] | 2.428391 | 3,966 |
# Calculate masked average background reflectance
import numpy as np
def _avg_reflectance(spectral_data, mask):
""" Find average reflectance of masked hyperspectral data instance. This is useful for calculating a target
signature (n_band x 1 - column array) which is required in various GatorSense hyperspectral tools
(https://github.com/GatorSense/hsi_toolkit_py)
Inputs:
spectral_array = Hyperspectral data instance
mask = Target wavelength value
Returns:
idx = Index
:param spectral_data: __main__.Spectral_data
:param mask: numpy.ndarray
:return spectral_array: __main__.Spectral_data
"""
# Initialize list of average reflectance values
avg_r = []
# For each band in a hyperspectral datacube mask and take the average
for i in range(0, len(spectral_data.wavelength_dict)):
band = spectral_data.array_data[:, :, [i]]
band_reshape = np.transpose(np.transpose(band)[0])
masked_band = band_reshape[np.where(mask > 0)]
band_avg = np.average(masked_band)
avg_r.append(band_avg)
# Convert into array object rather than list
avg_r = np.asarray(avg_r)
return avg_r
| [
2,
27131,
378,
29229,
2811,
4469,
4079,
590,
198,
198,
11748,
299,
32152,
355,
45941,
628,
198,
4299,
4808,
615,
70,
62,
35051,
590,
7,
4443,
1373,
62,
7890,
11,
9335,
2599,
198,
220,
220,
220,
37227,
9938,
2811,
4079,
590,
286,
29229,
45086,
806,
1373,
1366,
4554,
13,
770,
318,
4465,
329,
26019,
257,
2496,
198,
220,
220,
220,
220,
220,
220,
220,
9877,
357,
77,
62,
3903,
2124,
352,
532,
5721,
7177,
8,
543,
318,
2672,
287,
2972,
402,
1352,
41166,
45086,
806,
1373,
4899,
198,
220,
220,
220,
220,
220,
220,
220,
357,
5450,
1378,
12567,
13,
785,
14,
38,
1352,
41166,
14,
11994,
72,
62,
25981,
15813,
62,
9078,
8,
628,
220,
220,
220,
220,
220,
220,
220,
23412,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37410,
62,
18747,
796,
21209,
364,
806,
1373,
1366,
4554,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9335,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
12744,
28400,
1988,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
87,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
12901,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
37410,
62,
7890,
25,
11593,
12417,
834,
13,
49738,
1373,
62,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
9335,
25,
299,
32152,
13,
358,
18747,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
37410,
62,
18747,
25,
11593,
12417,
834,
13,
49738,
1373,
62,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
1303,
20768,
1096,
1351,
286,
2811,
4079,
590,
3815,
198,
220,
220,
220,
42781,
62,
81,
796,
17635,
628,
220,
220,
220,
1303,
1114,
1123,
4097,
287,
257,
45086,
806,
1373,
4818,
330,
3266,
9335,
290,
1011,
262,
2811,
198,
220,
220,
220,
329,
1312,
287,
2837,
7,
15,
11,
18896,
7,
4443,
1373,
62,
7890,
13,
10247,
26623,
62,
11600,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
4097,
796,
37410,
62,
7890,
13,
18747,
62,
7890,
58,
45299,
1058,
11,
685,
72,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
4097,
62,
3447,
1758,
796,
45941,
13,
7645,
3455,
7,
37659,
13,
7645,
3455,
7,
3903,
38381,
15,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
29229,
62,
3903,
796,
4097,
62,
3447,
1758,
58,
37659,
13,
3003,
7,
27932,
1875,
657,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
4097,
62,
615,
70,
796,
45941,
13,
23913,
7,
27932,
276,
62,
3903,
8,
198,
220,
220,
220,
220,
220,
220,
220,
42781,
62,
81,
13,
33295,
7,
3903,
62,
615,
70,
8,
628,
220,
220,
220,
1303,
38240,
656,
7177,
2134,
2138,
621,
1351,
198,
220,
220,
220,
42781,
62,
81,
796,
45941,
13,
292,
18747,
7,
615,
70,
62,
81,
8,
628,
220,
220,
220,
1441,
42781,
62,
81,
198
] | 2.503968 | 504 |
if __name__ == "__main__":
print(Solution().longestCommonPrefix(["hello", "heaven", "heavy"]))
"""
Time Complexity = O(N*k), k is the length of the common prefix
Space Complexity = O(1)
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example :
Input: ["flower","flow","flight"]
Output: "fl"
"""
| [
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
3601,
7,
46344,
22446,
6511,
395,
17227,
36698,
844,
7,
14692,
31373,
1600,
366,
258,
4005,
1600,
366,
23701,
8973,
4008,
628,
628,
628,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3862,
19157,
414,
796,
440,
7,
45,
9,
74,
828,
479,
318,
262,
4129,
286,
262,
2219,
21231,
198,
220,
220,
220,
220,
220,
220,
220,
4687,
19157,
414,
796,
440,
7,
16,
8,
628,
220,
220,
220,
220,
220,
220,
220,
19430,
257,
2163,
284,
1064,
262,
14069,
2219,
21231,
4731,
12077,
281,
7177,
286,
13042,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1002,
612,
318,
645,
2219,
21231,
11,
1441,
281,
6565,
4731,
366,
1911,
628,
220,
220,
220,
220,
220,
220,
220,
17934,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
23412,
25,
14631,
25547,
2430,
11125,
2430,
22560,
8973,
198,
220,
220,
220,
220,
220,
220,
220,
25235,
25,
366,
2704,
1,
198,
220,
220,
220,
37227,
198
] | 2.644068 | 177 |
import sys
import binascii
from xts_aes import XTSAES
TEXT_TYPES = {
'encryption': 'plaintext',
'decryption': 'ciphertext',
}
arguments = sys.argv[1:]
mode = 'encryption'
inverse_mode = 'decryption'
if arguments and (arguments[0] == '-d'):
mode = 'decryption'
inverse_mode = 'encryption'
key = read_hex_string('key')
if len(key) != 64:
sys.exit('key should be 64-byte')
tweak = read_hex_string('tweak')
if len(tweak) != 16:
sys.exit('tweak should be 16-byte')
text = read_hex_string(TEXT_TYPES[mode])
if len(text) < 16:
sys.exit('{text_type} should be greater than or equal to 16-byte'.format(text_type=TEXT_TYPES[mode]))
xts_aes = XTSAES(key, tweak)
encryptor = xts_aes.encrypt if mode == 'encryption' else xts_aes.decrypt
ciphertext = encryptor(text)
print('{ciphertext_type}: {ciphertext}'.format(ciphertext_type=TEXT_TYPES[inverse_mode], ciphertext=binascii.hexlify(ciphertext).decode())) | [
11748,
25064,
198,
11748,
9874,
292,
979,
72,
198,
198,
6738,
220,
742,
82,
62,
64,
274,
1330,
44235,
4090,
1546,
198,
198,
32541,
62,
9936,
47,
1546,
796,
1391,
198,
220,
220,
220,
705,
12685,
13168,
10354,
705,
25638,
5239,
3256,
198,
220,
220,
220,
705,
12501,
13168,
10354,
705,
66,
10803,
5239,
3256,
198,
92,
198,
198,
853,
2886,
796,
25064,
13,
853,
85,
58,
16,
47715,
198,
14171,
796,
705,
12685,
13168,
6,
198,
259,
4399,
62,
14171,
796,
705,
12501,
13168,
6,
198,
361,
7159,
290,
357,
853,
2886,
58,
15,
60,
6624,
705,
12,
67,
6,
2599,
198,
220,
220,
220,
4235,
796,
705,
12501,
13168,
6,
198,
220,
220,
220,
34062,
62,
14171,
796,
705,
12685,
13168,
6,
198,
198,
2539,
796,
1100,
62,
33095,
62,
8841,
10786,
2539,
11537,
198,
361,
18896,
7,
2539,
8,
14512,
5598,
25,
198,
220,
220,
220,
25064,
13,
37023,
10786,
2539,
815,
307,
5598,
12,
26327,
11537,
198,
198,
83,
38695,
796,
1100,
62,
33095,
62,
8841,
10786,
83,
38695,
11537,
198,
361,
18896,
7,
83,
38695,
8,
14512,
1467,
25,
198,
220,
220,
220,
25064,
13,
37023,
10786,
83,
38695,
815,
307,
1467,
12,
26327,
11537,
198,
198,
5239,
796,
1100,
62,
33095,
62,
8841,
7,
32541,
62,
9936,
47,
1546,
58,
14171,
12962,
198,
361,
18896,
7,
5239,
8,
1279,
1467,
25,
198,
220,
220,
220,
25064,
13,
37023,
10786,
90,
5239,
62,
4906,
92,
815,
307,
3744,
621,
393,
4961,
284,
1467,
12,
26327,
4458,
18982,
7,
5239,
62,
4906,
28,
32541,
62,
9936,
47,
1546,
58,
14171,
60,
4008,
198,
198,
742,
82,
62,
64,
274,
796,
44235,
4090,
1546,
7,
2539,
11,
25393,
8,
198,
198,
12685,
6012,
273,
796,
220,
742,
82,
62,
64,
274,
13,
12685,
6012,
611,
4235,
6624,
705,
12685,
13168,
6,
2073,
220,
742,
82,
62,
64,
274,
13,
12501,
6012,
198,
66,
10803,
5239,
796,
34117,
273,
7,
5239,
8,
198,
198,
4798,
10786,
90,
66,
10803,
5239,
62,
4906,
38362,
1391,
66,
10803,
5239,
92,
4458,
18982,
7,
66,
10803,
5239,
62,
4906,
28,
32541,
62,
9936,
47,
1546,
58,
259,
4399,
62,
14171,
4357,
38012,
5239,
28,
8800,
292,
979,
72,
13,
33095,
75,
1958,
7,
66,
10803,
5239,
737,
12501,
1098,
3419,
4008
] | 2.444737 | 380 |
from __future__ import absolute_import
from . import ssl_match_hostname
| [
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
198,
6738,
764,
1330,
264,
6649,
62,
15699,
62,
4774,
3672,
628
] | 3.52381 | 21 |
"""Line"""
from .line import Line # noqa: F401
| [
37811,
13949,
37811,
198,
6738,
764,
1370,
1330,
6910,
220,
1303,
645,
20402,
25,
376,
21844,
198
] | 2.823529 | 17 |
import os
from unittest.mock import Mock
import pytest
from doit.exceptions import InvalidCommand
from doit.cmd_run import Run
from doit.cmd_list import List
from doit import doit_cmd
| [
11748,
28686,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
44123,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
466,
270,
13,
1069,
11755,
1330,
17665,
21575,
198,
6738,
466,
270,
13,
28758,
62,
5143,
1330,
5660,
198,
6738,
466,
270,
13,
28758,
62,
4868,
1330,
7343,
198,
6738,
466,
270,
1330,
466,
270,
62,
28758,
628,
628,
628,
198
] | 3.147541 | 61 |
import time
import sys
import os
import glob
import pickle
import json
import torch
import pdb
def mkdir(savepath, prune_fname=False):
"""
returns `True` iff `savepath` is created
"""
if prune_fname:
savepath = os.path.dirname(savepath)
if not os.path.exists(savepath):
try:
os.makedirs(savepath)
except:
print(f'[ utils/serialization ] Warning: did not make directory: {savepath}')
return False
return True
else:
return False
| [
11748,
640,
198,
11748,
25064,
198,
11748,
28686,
198,
11748,
15095,
198,
11748,
2298,
293,
198,
11748,
33918,
198,
11748,
28034,
198,
11748,
279,
9945,
198,
198,
4299,
33480,
15908,
7,
21928,
6978,
11,
778,
1726,
62,
69,
3672,
28,
25101,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5860,
4600,
17821,
63,
611,
69,
4600,
21928,
6978,
63,
318,
2727,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
778,
1726,
62,
69,
3672,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3613,
6978,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
21928,
6978,
8,
198,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
21928,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
21928,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
69,
6,
58,
3384,
4487,
14,
46911,
1634,
2361,
15932,
25,
750,
407,
787,
8619,
25,
1391,
21928,
6978,
92,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6407,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10352,
198
] | 2.244726 | 237 |
"""Analyze results.
Use the saved model output to calculate AUC and other metrics.
"""
import collections
import cPickle as pickle
import gflags as flags
import gzip
import logging
import numpy as np
import os
import pandas as pd
from sklearn import metrics
from statsmodels.stats import proportion
import sys
flags.DEFINE_string('root', None, 'Root directory containing model results.')
flags.DEFINE_string('dataset_file', None, 'Filename containing datasets.')
flags.DEFINE_string('prefix', None, 'Dataset prefix.')
flags.DEFINE_boolean('tversky', False, 'If True, use Tversky features.')
flags.DEFINE_integer('num_folds', 5, 'Number of cross-validation folds.')
flags.DEFINE_boolean('cycle', False,
'If True, expect multiple query molecules.')
flags.DEFINE_string('reload', None, 'Load previously analyzed results.')
flags.DEFINE_string('subset', None, 'Subset.')
FLAGS = flags.FLAGS
logging.getLogger().setLevel(logging.INFO)
FEATURES_MAP = {
'rocs': 'TanimotoCombo',
'shape_color': 'ST-CT',
'shape_color_components': 'ST-CCT',
'shape_color_overlaps': 'ST-CAO',
'shape_color_components_overlaps': 'ST-CCT-CAO',
'rocs_tversky': 'TverskyCombo',
'shape_color_tversky': 'STv-CTv',
'shape_color_components_tversky': 'STv-CCTv',
'shape_color_components_tversky_overlaps': 'STv-CCTv-CAO',
}
MODEL_MAP = {
'logistic': 'LR',
'random_forest': 'RF',
'svm': 'SVM',
}
def roc_enrichment(fpr, tpr, target_fpr):
"""Get ROC enrichment."""
assert fpr[0] == 0
assert fpr[-1] == 1
assert np.all(np.diff(fpr) >= 0)
return np.true_divide(np.interp(target_fpr, fpr, tpr), target_fpr)
def get_cv_metrics(y_true, y_pred):
"""Get 5-fold mean AUC."""
assert len(y_true) == len(y_pred)
fold_metrics = collections.defaultdict(list)
for yt, yp in zip(y_true, y_pred):
assert len(yt) == len(yp)
fold_metrics['auc'].append(metrics.roc_auc_score(yt, yp))
fpr, tpr, _ = metrics.roc_curve(yt, yp)
for x in [0.005, 0.01, 0.02, 0.05, 0.1, 0.2]:
fold_metrics['e-%g' % x].append(roc_enrichment(fpr, tpr, x))
return fold_metrics
def add_rows(features, scores, rows, dataset, index=None):
"""Record per-fold and averaged cross-validation results."""
for fold in range(len(scores['auc'])):
row = {'dataset': dataset, 'features': features, 'fold': fold}
if index is not None:
row['index'] = index
for key, values in scores.iteritems():
row[key] = values[fold]
rows.append(row)
# Averages
row = {'dataset': dataset, 'features': features, 'fold': 'all'}
if index is not None:
row['index'] = index
for key, values in scores.iteritems():
row[key] = np.mean(values)
rows.append(row)
def load_output_and_calculate_metrics(model, subset):
"""Calculate metrics using saved model output.
Args:
model: String model type (e.g. logistic).
subset: String query subset (e.g. omega1).
Returns:
DataFrame containing calculated metrics for each model/subset, including
per-fold and average values for each reference molecule.
"""
with open(FLAGS.dataset_file) as f:
datasets = [line.strip() for line in f]
rows = []
for dataset in datasets:
ref_idx = 0
while True: # Cycle through reference molecules.
ref_idx_exists = get_ref_rows(model, subset, dataset, ref_idx, rows)
if not FLAGS.cycle or not ref_idx_exists:
break
ref_idx += 1
logging.info('%s\t%d', dataset, ref_idx)
return pd.DataFrame(rows)
def confidence_interval(delta, metric):
"""Calculate a two-sided 95% confidence interval for differences."""
# Wilson score interval for sign test.
num_successes = np.count_nonzero(delta > 0)
num_trials = np.count_nonzero(delta != 0) # Exclude zero differences.
lower, upper = proportion.proportion_confint(
num_successes, num_trials, alpha=0.05, method='wilson')
median_delta = delta.median()
if metric == 'auc':
median = r'%.3f' % median_delta
ci = r'(%.2f, %.2f)' % (lower, upper)
else:
median = r'%.0f' % median_delta
ci = r'(%.2f, %.2f)' % (lower, upper)
if lower < 0.5 and upper < 0.5:
median = r'\bfseries \color{red} ' + median
ci = r'\bfseries \color{red} ' + ci
elif lower > 0.5 and upper > 0.5:
median = r'\bfseries ' + median
ci = r'\bfseries ' + ci
return median, ci
def data_table(data, subsets, models, kind=None, tversky=False):
"""Get medians and compare everything to ROCS.
Args:
data: DataFrame containing model performance.
subsets: List of query subsets.
models: List of models to include in the table.
kind: List of metrics to report. Defaults to ['auc'].
tversky: Boolean whether to use Tversky features. If False, use Tanimoto
features.
"""
if kind is None:
kind = ['auc']
if tversky:
rocs_baseline = 'rocs_tversky'
features_order = ['shape_color_tversky',
'shape_color_components_tversky',
'shape_color_overlaps',
'shape_color_components_tversky_overlaps']
else:
rocs_baseline = 'rocs'
features_order = ['shape_color', 'shape_color_components',
'shape_color_overlaps',
'shape_color_components_overlaps']
table = []
# Get ROCS row.
row = [r'\cellcolor{white} ROCS', FEATURES_MAP[rocs_baseline]]
for subset in subsets:
rocs_mask = ((data['features'] == rocs_baseline) &
(data['subset'] == subset) &
(data['model'] == models[0]))
rocs_df = data[rocs_mask]
logging.info('Confidence interval N = %d', len(rocs_df))
logging.info('Number of datasets = %d',
len(pd.unique(rocs_df['dataset'])))
for metric in kind:
if metric == 'auc':
number = '%.3f'
else:
number = '%.0f'
row.extend([number % rocs_df[metric].median(), '', ''])
table.append(' & '.join(row))
# Get model rows.
for model in models:
for features in features_order:
if features == features_order[-1]:
row = [r'\multirow{-%d}{*}{\cellcolor{white} %s}' % (
len(features_order), MODEL_MAP[model])]
else:
row = [r'\cellcolor{white}']
row.append(FEATURES_MAP[features])
for subset in subsets:
mask = ((data['features'] == features) &
(data['subset'] == subset) &
(data['model'] == model))
df = data[mask]
rocs_mask = ((data['features'] == rocs_baseline) &
(data['subset'] == subset) &
(data['model'] == model))
rocs_df = data[rocs_mask]
for metric in kind:
if metric == 'auc':
number = '%.3f'
else:
number = '%.0f'
row.append(number % df[metric].median())
if features == rocs_baseline:
row.append('')
row.append('')
else:
assert np.array_equal(df['dataset'].values,
rocs_df['dataset'].values)
if 'index' in df.columns:
assert np.array_equal(df['index'].values,
rocs_df['index'].values)
delta = df.copy()
delta[metric] -= rocs_df[metric].values
row.extend(confidence_interval(delta[metric], metric))
table.append(' & '.join(row))
print ' \\\\\n'.join(table)
if __name__ == '__main__':
flags.MarkFlagAsRequired('root')
flags.MarkFlagAsRequired('dataset_file')
flags.MarkFlagAsRequired('prefix')
FLAGS(sys.argv)
main()
| [
37811,
37702,
2736,
2482,
13,
198,
198,
11041,
262,
7448,
2746,
5072,
284,
15284,
317,
9598,
290,
584,
20731,
13,
198,
37811,
198,
198,
11748,
17268,
198,
11748,
269,
31686,
293,
355,
2298,
293,
198,
11748,
308,
33152,
355,
9701,
198,
11748,
308,
13344,
198,
11748,
18931,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
1341,
35720,
1330,
20731,
198,
6738,
9756,
27530,
13,
34242,
1330,
9823,
198,
11748,
25064,
198,
198,
33152,
13,
7206,
29940,
62,
8841,
10786,
15763,
3256,
6045,
11,
705,
30016,
8619,
7268,
2746,
2482,
2637,
8,
198,
33152,
13,
7206,
29940,
62,
8841,
10786,
19608,
292,
316,
62,
7753,
3256,
6045,
11,
705,
35063,
7268,
40522,
2637,
8,
198,
33152,
13,
7206,
29940,
62,
8841,
10786,
40290,
3256,
6045,
11,
705,
27354,
292,
316,
21231,
2637,
8,
198,
33152,
13,
7206,
29940,
62,
2127,
21052,
10786,
83,
690,
2584,
3256,
10352,
11,
705,
1532,
6407,
11,
779,
309,
690,
2584,
3033,
2637,
8,
198,
33152,
13,
7206,
29940,
62,
41433,
10786,
22510,
62,
69,
10119,
3256,
642,
11,
705,
15057,
286,
3272,
12,
12102,
341,
38744,
2637,
8,
198,
33152,
13,
7206,
29940,
62,
2127,
21052,
10786,
13696,
3256,
10352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1532,
6407,
11,
1607,
3294,
12405,
17745,
2637,
8,
198,
33152,
13,
7206,
29940,
62,
8841,
10786,
260,
2220,
3256,
6045,
11,
705,
8912,
4271,
15475,
2482,
2637,
8,
198,
33152,
13,
7206,
29940,
62,
8841,
10786,
7266,
2617,
3256,
6045,
11,
705,
7004,
2617,
2637,
8,
198,
38948,
50,
796,
9701,
13,
38948,
50,
198,
198,
6404,
2667,
13,
1136,
11187,
1362,
22446,
2617,
4971,
7,
6404,
2667,
13,
10778,
8,
628,
198,
15112,
47471,
62,
33767,
796,
1391,
198,
220,
220,
220,
705,
305,
6359,
10354,
705,
51,
11227,
2069,
5377,
2127,
3256,
198,
220,
220,
220,
705,
43358,
62,
8043,
10354,
705,
2257,
12,
4177,
3256,
198,
220,
220,
220,
705,
43358,
62,
8043,
62,
5589,
3906,
10354,
705,
2257,
12,
4093,
51,
3256,
198,
220,
220,
220,
705,
43358,
62,
8043,
62,
2502,
75,
1686,
10354,
705,
2257,
12,
8141,
46,
3256,
198,
220,
220,
220,
705,
43358,
62,
8043,
62,
5589,
3906,
62,
2502,
75,
1686,
10354,
705,
2257,
12,
4093,
51,
12,
8141,
46,
3256,
198,
220,
220,
220,
705,
305,
6359,
62,
83,
690,
2584,
10354,
705,
51,
690,
2584,
5377,
2127,
3256,
198,
220,
220,
220,
705,
43358,
62,
8043,
62,
83,
690,
2584,
10354,
705,
2257,
85,
12,
4177,
85,
3256,
198,
220,
220,
220,
705,
43358,
62,
8043,
62,
5589,
3906,
62,
83,
690,
2584,
10354,
705,
2257,
85,
12,
4093,
51,
85,
3256,
198,
220,
220,
220,
705,
43358,
62,
8043,
62,
5589,
3906,
62,
83,
690,
2584,
62,
2502,
75,
1686,
10354,
705,
2257,
85,
12,
4093,
51,
85,
12,
8141,
46,
3256,
198,
92,
198,
198,
33365,
3698,
62,
33767,
796,
1391,
198,
220,
220,
220,
705,
6404,
2569,
10354,
705,
35972,
3256,
198,
220,
220,
220,
705,
25120,
62,
29623,
10354,
705,
32754,
3256,
198,
220,
220,
220,
705,
82,
14761,
10354,
705,
50,
15996,
3256,
198,
92,
628,
198,
4299,
686,
66,
62,
268,
7527,
434,
7,
69,
1050,
11,
256,
1050,
11,
2496,
62,
69,
1050,
2599,
198,
220,
220,
220,
37227,
3855,
371,
4503,
36513,
526,
15931,
198,
220,
220,
220,
6818,
277,
1050,
58,
15,
60,
6624,
657,
198,
220,
220,
220,
6818,
277,
1050,
58,
12,
16,
60,
6624,
352,
198,
220,
220,
220,
6818,
45941,
13,
439,
7,
37659,
13,
26069,
7,
69,
1050,
8,
18189,
657,
8,
198,
220,
220,
220,
1441,
45941,
13,
7942,
62,
7146,
485,
7,
37659,
13,
3849,
79,
7,
16793,
62,
69,
1050,
11,
277,
1050,
11,
256,
1050,
828,
2496,
62,
69,
1050,
8,
628,
198,
4299,
651,
62,
33967,
62,
4164,
10466,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
37227,
3855,
642,
12,
11379,
1612,
317,
9598,
526,
15931,
198,
220,
220,
220,
6818,
18896,
7,
88,
62,
7942,
8,
6624,
18896,
7,
88,
62,
28764,
8,
198,
220,
220,
220,
5591,
62,
4164,
10466,
796,
17268,
13,
12286,
11600,
7,
4868,
8,
198,
220,
220,
220,
329,
331,
83,
11,
331,
79,
287,
19974,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
18896,
7,
20760,
8,
6624,
18896,
7,
4464,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5591,
62,
4164,
10466,
17816,
14272,
6,
4083,
33295,
7,
4164,
10466,
13,
12204,
62,
14272,
62,
26675,
7,
20760,
11,
331,
79,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
277,
1050,
11,
256,
1050,
11,
4808,
796,
20731,
13,
12204,
62,
22019,
303,
7,
20760,
11,
331,
79,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2124,
287,
685,
15,
13,
22544,
11,
657,
13,
486,
11,
657,
13,
2999,
11,
657,
13,
2713,
11,
657,
13,
16,
11,
657,
13,
17,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5591,
62,
4164,
10466,
17816,
68,
12,
4,
70,
6,
4064,
2124,
4083,
33295,
7,
12204,
62,
268,
7527,
434,
7,
69,
1050,
11,
256,
1050,
11,
2124,
4008,
198,
220,
220,
220,
1441,
5591,
62,
4164,
10466,
628,
198,
4299,
751,
62,
8516,
7,
40890,
11,
8198,
11,
15274,
11,
27039,
11,
6376,
28,
14202,
2599,
198,
220,
220,
220,
37227,
23739,
583,
12,
11379,
290,
16449,
3272,
12,
12102,
341,
2482,
526,
15931,
198,
220,
220,
220,
329,
5591,
287,
2837,
7,
11925,
7,
1416,
2850,
17816,
14272,
6,
12962,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
796,
1391,
6,
19608,
292,
316,
10354,
27039,
11,
705,
40890,
10354,
3033,
11,
705,
11379,
10354,
5591,
92,
198,
220,
220,
220,
220,
220,
220,
220,
611,
6376,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
17816,
9630,
20520,
796,
6376,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1994,
11,
3815,
287,
8198,
13,
2676,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
58,
2539,
60,
796,
3815,
58,
11379,
60,
198,
220,
220,
220,
220,
220,
220,
220,
15274,
13,
33295,
7,
808,
8,
628,
220,
220,
220,
1303,
317,
23118,
198,
220,
220,
220,
5752,
796,
1391,
6,
19608,
292,
316,
10354,
27039,
11,
705,
40890,
10354,
3033,
11,
705,
11379,
10354,
705,
439,
6,
92,
198,
220,
220,
220,
611,
6376,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
17816,
9630,
20520,
796,
6376,
198,
220,
220,
220,
329,
1994,
11,
3815,
287,
8198,
13,
2676,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
58,
2539,
60,
796,
45941,
13,
32604,
7,
27160,
8,
198,
220,
220,
220,
15274,
13,
33295,
7,
808,
8,
628,
198,
4299,
3440,
62,
22915,
62,
392,
62,
9948,
3129,
378,
62,
4164,
10466,
7,
19849,
11,
24637,
2599,
198,
220,
220,
220,
37227,
9771,
3129,
378,
20731,
1262,
7448,
2746,
5072,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
25,
10903,
2746,
2099,
357,
68,
13,
70,
13,
2604,
2569,
737,
198,
220,
220,
220,
220,
220,
220,
220,
24637,
25,
10903,
12405,
24637,
357,
68,
13,
70,
13,
37615,
16,
737,
628,
220,
220,
220,
16409,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6060,
19778,
7268,
10488,
20731,
329,
1123,
2746,
14,
7266,
2617,
11,
1390,
198,
220,
220,
220,
220,
220,
220,
220,
583,
12,
11379,
290,
2811,
3815,
329,
1123,
4941,
27756,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
351,
1280,
7,
38948,
50,
13,
19608,
292,
316,
62,
7753,
8,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
40522,
796,
685,
1370,
13,
36311,
3419,
329,
1627,
287,
277,
60,
198,
220,
220,
220,
15274,
796,
17635,
198,
220,
220,
220,
329,
27039,
287,
40522,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1006,
62,
312,
87,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
981,
6407,
25,
220,
1303,
26993,
832,
4941,
17745,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1006,
62,
312,
87,
62,
1069,
1023,
796,
651,
62,
5420,
62,
8516,
7,
19849,
11,
24637,
11,
27039,
11,
1006,
62,
312,
87,
11,
15274,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
9977,
4760,
50,
13,
13696,
393,
407,
1006,
62,
312,
87,
62,
1069,
1023,
25,
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,
1006,
62,
312,
87,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
10786,
4,
82,
59,
83,
4,
67,
3256,
27039,
11,
1006,
62,
312,
87,
8,
198,
220,
220,
220,
1441,
279,
67,
13,
6601,
19778,
7,
8516,
8,
628,
628,
198,
198,
4299,
6628,
62,
3849,
2100,
7,
67,
12514,
11,
18663,
2599,
198,
220,
220,
220,
37227,
9771,
3129,
378,
257,
734,
12,
22339,
6957,
4,
6628,
16654,
329,
5400,
526,
15931,
198,
220,
220,
220,
1303,
8127,
4776,
16654,
329,
1051,
1332,
13,
198,
220,
220,
220,
997,
62,
13138,
274,
796,
45941,
13,
9127,
62,
13159,
22570,
7,
67,
12514,
1875,
657,
8,
198,
220,
220,
220,
997,
62,
28461,
874,
796,
45941,
13,
9127,
62,
13159,
22570,
7,
67,
12514,
14512,
657,
8,
220,
1303,
1475,
9152,
6632,
5400,
13,
198,
220,
220,
220,
2793,
11,
6727,
796,
9823,
13,
1676,
16864,
62,
10414,
600,
7,
198,
220,
220,
220,
220,
220,
220,
220,
997,
62,
13138,
274,
11,
997,
62,
28461,
874,
11,
17130,
28,
15,
13,
2713,
11,
2446,
11639,
86,
346,
1559,
11537,
198,
220,
220,
220,
14288,
62,
67,
12514,
796,
25979,
13,
1150,
666,
3419,
198,
220,
220,
220,
611,
18663,
6624,
705,
14272,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
14288,
796,
374,
6,
7225,
18,
69,
6,
4064,
14288,
62,
67,
12514,
198,
220,
220,
220,
220,
220,
220,
220,
269,
72,
796,
374,
6,
7,
7225,
17,
69,
11,
4064,
13,
17,
69,
33047,
4064,
357,
21037,
11,
6727,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
14288,
796,
374,
6,
7225,
15,
69,
6,
4064,
14288,
62,
67,
12514,
198,
220,
220,
220,
220,
220,
220,
220,
269,
72,
796,
374,
6,
7,
7225,
17,
69,
11,
4064,
13,
17,
69,
33047,
4064,
357,
21037,
11,
6727,
8,
198,
220,
220,
220,
611,
2793,
1279,
657,
13,
20,
290,
6727,
1279,
657,
13,
20,
25,
198,
220,
220,
220,
220,
220,
220,
220,
14288,
796,
374,
6,
59,
19881,
25076,
3467,
8043,
90,
445,
92,
705,
1343,
14288,
198,
220,
220,
220,
220,
220,
220,
220,
269,
72,
796,
374,
6,
59,
19881,
25076,
3467,
8043,
90,
445,
92,
705,
1343,
269,
72,
198,
220,
220,
220,
1288,
361,
2793,
1875,
657,
13,
20,
290,
6727,
1875,
657,
13,
20,
25,
198,
220,
220,
220,
220,
220,
220,
220,
14288,
796,
374,
6,
59,
19881,
25076,
705,
1343,
14288,
198,
220,
220,
220,
220,
220,
220,
220,
269,
72,
796,
374,
6,
59,
19881,
25076,
705,
1343,
269,
72,
198,
220,
220,
220,
1441,
14288,
11,
269,
72,
628,
198,
4299,
1366,
62,
11487,
7,
7890,
11,
6352,
1039,
11,
4981,
11,
1611,
28,
14202,
11,
256,
690,
2584,
28,
25101,
2599,
198,
220,
220,
220,
37227,
3855,
1117,
1547,
290,
8996,
2279,
284,
371,
4503,
50,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
25,
6060,
19778,
7268,
2746,
2854,
13,
198,
220,
220,
220,
220,
220,
220,
220,
6352,
1039,
25,
7343,
286,
12405,
6352,
1039,
13,
198,
220,
220,
220,
220,
220,
220,
220,
4981,
25,
7343,
286,
4981,
284,
2291,
287,
262,
3084,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1611,
25,
7343,
286,
20731,
284,
989,
13,
2896,
13185,
284,
37250,
14272,
6,
4083,
198,
220,
220,
220,
220,
220,
220,
220,
256,
690,
2584,
25,
41146,
1771,
284,
779,
309,
690,
2584,
3033,
13,
1002,
10352,
11,
779,
309,
11227,
2069,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3033,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
1611,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1611,
796,
37250,
14272,
20520,
198,
220,
220,
220,
611,
256,
690,
2584,
25,
198,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
12093,
4470,
796,
705,
305,
6359,
62,
83,
690,
2584,
6,
198,
220,
220,
220,
220,
220,
220,
220,
3033,
62,
2875,
796,
37250,
43358,
62,
8043,
62,
83,
690,
2584,
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,
705,
43358,
62,
8043,
62,
5589,
3906,
62,
83,
690,
2584,
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,
705,
43358,
62,
8043,
62,
2502,
75,
1686,
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,
705,
43358,
62,
8043,
62,
5589,
3906,
62,
83,
690,
2584,
62,
2502,
75,
1686,
20520,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
12093,
4470,
796,
705,
305,
6359,
6,
198,
220,
220,
220,
220,
220,
220,
220,
3033,
62,
2875,
796,
37250,
43358,
62,
8043,
3256,
705,
43358,
62,
8043,
62,
5589,
3906,
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,
705,
43358,
62,
8043,
62,
2502,
75,
1686,
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,
705,
43358,
62,
8043,
62,
5589,
3906,
62,
2502,
75,
1686,
20520,
198,
220,
220,
220,
3084,
796,
17635,
628,
220,
220,
220,
1303,
3497,
371,
4503,
50,
5752,
13,
198,
220,
220,
220,
5752,
796,
685,
81,
6,
59,
3846,
8043,
90,
11186,
92,
371,
4503,
50,
3256,
18630,
47471,
62,
33767,
58,
305,
6359,
62,
12093,
4470,
11907,
628,
220,
220,
220,
329,
24637,
287,
6352,
1039,
25,
198,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
27932,
796,
14808,
7890,
17816,
40890,
20520,
6624,
686,
6359,
62,
12093,
4470,
8,
1222,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
7890,
17816,
7266,
2617,
20520,
6624,
24637,
8,
1222,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
7890,
17816,
19849,
20520,
6624,
4981,
58,
15,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
7568,
796,
1366,
58,
305,
6359,
62,
27932,
60,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
10786,
18546,
1704,
16654,
399,
796,
4064,
67,
3256,
18896,
7,
305,
6359,
62,
7568,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
10786,
15057,
286,
40522,
796,
4064,
67,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18896,
7,
30094,
13,
34642,
7,
305,
6359,
62,
7568,
17816,
19608,
292,
316,
20520,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
329,
18663,
287,
1611,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18663,
6624,
705,
14272,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
705,
7225,
18,
69,
6,
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,
1271,
796,
705,
7225,
15,
69,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
13,
2302,
437,
26933,
17618,
4064,
686,
6359,
62,
7568,
58,
4164,
1173,
4083,
1150,
666,
22784,
705,
3256,
10148,
12962,
198,
220,
220,
220,
3084,
13,
33295,
10786,
1222,
45302,
22179,
7,
808,
4008,
628,
220,
220,
220,
1303,
3497,
2746,
15274,
13,
198,
220,
220,
220,
329,
2746,
287,
4981,
25,
198,
220,
220,
220,
220,
220,
220,
220,
329,
3033,
287,
3033,
62,
2875,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
3033,
6624,
3033,
62,
2875,
58,
12,
16,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
796,
685,
81,
6,
59,
41684,
808,
90,
12,
4,
67,
18477,
9,
18477,
59,
3846,
8043,
90,
11186,
92,
4064,
82,
92,
6,
4064,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18896,
7,
40890,
62,
2875,
828,
19164,
3698,
62,
33767,
58,
19849,
12962,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
796,
685,
81,
6,
59,
3846,
8043,
90,
11186,
92,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
13,
33295,
7,
15112,
47471,
62,
33767,
58,
40890,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
24637,
287,
6352,
1039,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9335,
796,
14808,
7890,
17816,
40890,
20520,
6624,
3033,
8,
1222,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
7890,
17816,
7266,
2617,
20520,
6624,
24637,
8,
1222,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
7890,
17816,
19849,
20520,
6624,
2746,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47764,
796,
1366,
58,
27932,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
27932,
796,
14808,
7890,
17816,
40890,
20520,
6624,
686,
6359,
62,
12093,
4470,
8,
1222,
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,
357,
7890,
17816,
7266,
2617,
20520,
6624,
24637,
8,
1222,
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,
357,
7890,
17816,
19849,
20520,
6624,
2746,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
7568,
796,
1366,
58,
305,
6359,
62,
27932,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
18663,
287,
1611,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
18663,
6624,
705,
14272,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
705,
7225,
18,
69,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
796,
705,
7225,
15,
69,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
13,
33295,
7,
17618,
4064,
47764,
58,
4164,
1173,
4083,
1150,
666,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
3033,
6624,
686,
6359,
62,
12093,
4470,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
13,
33295,
7,
7061,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
13,
33295,
7,
7061,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6818,
45941,
13,
18747,
62,
40496,
7,
7568,
17816,
19608,
292,
316,
6,
4083,
27160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
7568,
17816,
19608,
292,
316,
6,
4083,
27160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
9630,
6,
287,
47764,
13,
28665,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6818,
45941,
13,
18747,
62,
40496,
7,
7568,
17816,
9630,
6,
4083,
27160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
686,
6359,
62,
7568,
17816,
9630,
6,
4083,
27160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25979,
796,
47764,
13,
30073,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25979,
58,
4164,
1173,
60,
48185,
686,
6359,
62,
7568,
58,
4164,
1173,
4083,
27160,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
13,
2302,
437,
7,
39745,
62,
3849,
2100,
7,
67,
12514,
58,
4164,
1173,
4357,
18663,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3084,
13,
33295,
10786,
1222,
45302,
22179,
7,
808,
4008,
198,
220,
220,
220,
3601,
705,
3467,
13426,
77,
4458,
22179,
7,
11487,
8,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
9701,
13,
9704,
34227,
1722,
37374,
10786,
15763,
11537,
198,
220,
220,
220,
9701,
13,
9704,
34227,
1722,
37374,
10786,
19608,
292,
316,
62,
7753,
11537,
198,
220,
220,
220,
9701,
13,
9704,
34227,
1722,
37374,
10786,
40290,
11537,
198,
220,
220,
220,
9977,
4760,
50,
7,
17597,
13,
853,
85,
8,
198,
220,
220,
220,
1388,
3419,
198
] | 2.073963 | 4,002 |
#!/usr/bin/env python
import cgi
import os
from utils import simple_success_response_JSON
from shutil import copyfile
args = cgi.FieldStorage()
u_id = args['u_id'].value
### Check if SVG exists for each user. If it doesn't, create one
### ------------------------------------------------------------
svg_path = os.path.join('..', 'content') # Path to user SVG files
os.chdir(svg_path)
svg_base = 'svg_base.svg' # Name of file with basic wb SVG properties
user_svg_file = u_id + '.svg'
copyfile(svg_base, user_svg_file) # Copy base SVG file into the user's SVG
### Update that room's 'last-mod' field in its config file
### -------------------------------------------------------------
config_filename = r_id + '.xml'
config_path = os.path.join('..', 'config', 'room', config_filename)
tree = ET.parse(config_path)
tree.find('last-mod').text = str( int(time.time()) * 1000 )
tree.write(config_path, encoding="utf-8", xml_declaration=True)
simple_success_response_JSON(); | [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
11748,
269,
12397,
198,
11748,
28686,
198,
198,
6738,
3384,
4487,
1330,
2829,
62,
13138,
62,
26209,
62,
40386,
198,
6738,
4423,
346,
1330,
4866,
7753,
198,
198,
22046,
796,
220,
220,
220,
220,
269,
12397,
13,
15878,
31425,
3419,
198,
84,
62,
312,
796,
220,
220,
220,
220,
26498,
17816,
84,
62,
312,
6,
4083,
8367,
198,
198,
21017,
6822,
611,
45809,
7160,
329,
1123,
2836,
13,
1002,
340,
1595,
470,
11,
2251,
530,
198,
21017,
20368,
1783,
10541,
198,
198,
21370,
70,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
10786,
492,
3256,
705,
11299,
11537,
197,
2,
10644,
284,
2836,
45809,
3696,
198,
418,
13,
354,
15908,
7,
21370,
70,
62,
6978,
8,
198,
21370,
70,
62,
8692,
796,
705,
21370,
70,
62,
8692,
13,
21370,
70,
6,
197,
197,
197,
197,
197,
2,
6530,
286,
2393,
351,
4096,
266,
65,
45809,
6608,
198,
198,
7220,
62,
21370,
70,
62,
7753,
796,
334,
62,
312,
1343,
45302,
21370,
70,
6,
198,
30073,
7753,
7,
21370,
70,
62,
8692,
11,
2836,
62,
21370,
70,
62,
7753,
8,
197,
197,
197,
2,
17393,
2779,
45809,
2393,
656,
262,
2836,
338,
45809,
198,
198,
21017,
10133,
326,
2119,
338,
705,
12957,
12,
4666,
6,
2214,
287,
663,
4566,
2393,
198,
21017,
20368,
1783,
32501,
198,
198,
11250,
62,
34345,
796,
374,
62,
312,
1343,
45302,
19875,
6,
198,
11250,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
10786,
492,
3256,
705,
11250,
3256,
705,
3823,
3256,
4566,
62,
34345,
8,
198,
21048,
796,
12152,
13,
29572,
7,
11250,
62,
6978,
8,
198,
21048,
13,
19796,
10786,
12957,
12,
4666,
27691,
5239,
796,
965,
7,
493,
7,
2435,
13,
2435,
28955,
1635,
8576,
1267,
198,
21048,
13,
13564,
7,
11250,
62,
6978,
11,
21004,
2625,
40477,
12,
23,
1600,
35555,
62,
32446,
10186,
28,
17821,
8,
198,
198,
36439,
62,
13138,
62,
26209,
62,
40386,
9783
] | 3.052308 | 325 |
from os import path
from collections import OrderedDict
from diot import Diot
from pyppl.utils import alwaysList
from bioprocs.utils.tsvio2 import TsvReader, TsvWriter
infile = {{i.infile | quote}}
colfile = {{i.colfile | quote}}
outfile = {{o.outfile | quote}}
inopts = {{args.inopts | repr}}
cols = {{args.cols | repr}}
keep = {{args.keep | repr}}
from_file = False
if path.isfile(colfile):
cols = TsvReader(colfile, cnames = False).dump(0)
from_file = True
elif colfile:
cols = alwaysList(colfile)
elif path.isfile(str(cols)):
cols = TsvReader(cols, cnames = False).dump(0)
from_file = True
elif cols:
cols = alwaysList(cols)
else:
raise ValueError('Columns not provided.')
if not from_file and not isinstance(cols[0], int) and cols[0].isdigit():
cols = [int(c) for c in cols]
reader = TsvReader(infile, **inopts)
writer = TsvWriter(outfile, delimit = inopts.get('delimit', "\t"))
if reader.cnames and not isinstance(cols[0], int):
cols = [reader.cnames.index(c) for c in cols if c in reader.cnames]
elif not reader.cnames and not isinstance(cols[0], int):
raise ValueError("Input file doesn't have column names")
elif min(cols) < -len(reader.cnames) or (reader.cnames and max(cols) >= len(reader.cnames)):
raise IndexError("Provided columns beyond input file range.")
if reader.cnames:
ncol = len(reader.cnames)
else:
ncol = len(reader.next())
reader.rewind()
cols = [ncol + c if c < 0 else c for c in cols]
if not keep:
cols = [c for c in range(ncol) if c not in cols]
if reader.cnames:
writer.cnames = [reader.cnames[c] for c in cols]
writer.writeHead()
for r in reader:
rec = [r[c] for c in cols]
writer.write(rec)
writer.close()
| [
6738,
28686,
1330,
3108,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
198,
6738,
2566,
313,
1330,
360,
5151,
198,
6738,
12972,
381,
75,
13,
26791,
1330,
1464,
8053,
198,
6738,
3182,
404,
305,
6359,
13,
26791,
13,
912,
85,
952,
17,
1330,
13146,
85,
33634,
11,
13146,
85,
34379,
198,
198,
259,
7753,
220,
796,
22935,
72,
13,
259,
7753,
930,
9577,
11709,
198,
66,
4024,
576,
796,
22935,
72,
13,
66,
4024,
576,
930,
9577,
11709,
198,
448,
7753,
796,
22935,
78,
13,
448,
7753,
930,
9577,
11709,
198,
259,
404,
912,
220,
796,
22935,
22046,
13,
259,
404,
912,
930,
41575,
11709,
198,
4033,
82,
220,
220,
220,
796,
22935,
22046,
13,
4033,
82,
930,
41575,
11709,
198,
14894,
220,
220,
220,
796,
22935,
22046,
13,
14894,
930,
41575,
11709,
198,
198,
6738,
62,
7753,
796,
10352,
198,
361,
3108,
13,
4468,
576,
7,
66,
4024,
576,
2599,
198,
197,
4033,
82,
796,
13146,
85,
33634,
7,
66,
4024,
576,
11,
269,
14933,
796,
10352,
737,
39455,
7,
15,
8,
198,
197,
6738,
62,
7753,
796,
6407,
198,
417,
361,
951,
7753,
25,
198,
197,
4033,
82,
796,
1464,
8053,
7,
66,
4024,
576,
8,
198,
417,
361,
3108,
13,
4468,
576,
7,
2536,
7,
4033,
82,
8,
2599,
198,
197,
4033,
82,
796,
13146,
85,
33634,
7,
4033,
82,
11,
269,
14933,
796,
10352,
737,
39455,
7,
15,
8,
198,
197,
6738,
62,
7753,
796,
6407,
198,
417,
361,
951,
82,
25,
198,
197,
4033,
82,
796,
1464,
8053,
7,
4033,
82,
8,
198,
17772,
25,
198,
197,
40225,
11052,
12331,
10786,
39470,
82,
407,
2810,
2637,
8,
198,
361,
407,
422,
62,
7753,
290,
407,
318,
39098,
7,
4033,
82,
58,
15,
4357,
493,
8,
290,
951,
82,
58,
15,
4083,
9409,
328,
270,
33529,
198,
197,
4033,
82,
796,
685,
600,
7,
66,
8,
329,
269,
287,
951,
82,
60,
198,
198,
46862,
796,
13146,
85,
33634,
7,
259,
7753,
11,
12429,
259,
404,
912,
8,
198,
16002,
796,
13146,
85,
34379,
7,
448,
7753,
11,
46728,
270,
796,
287,
404,
912,
13,
1136,
10786,
12381,
320,
270,
3256,
37082,
83,
48774,
198,
361,
9173,
13,
66,
14933,
290,
407,
318,
39098,
7,
4033,
82,
58,
15,
4357,
493,
2599,
198,
197,
4033,
82,
796,
685,
46862,
13,
66,
14933,
13,
9630,
7,
66,
8,
329,
269,
287,
951,
82,
611,
269,
287,
9173,
13,
66,
14933,
60,
198,
417,
361,
407,
9173,
13,
66,
14933,
290,
407,
318,
39098,
7,
4033,
82,
58,
15,
4357,
493,
2599,
198,
197,
40225,
11052,
12331,
7203,
20560,
2393,
1595,
470,
423,
5721,
3891,
4943,
198,
417,
361,
949,
7,
4033,
82,
8,
1279,
532,
11925,
7,
46862,
13,
66,
14933,
8,
393,
357,
46862,
13,
66,
14933,
290,
3509,
7,
4033,
82,
8,
18189,
18896,
7,
46862,
13,
66,
14933,
8,
2599,
198,
197,
40225,
12901,
12331,
7203,
15946,
1384,
15180,
3675,
5128,
2393,
2837,
19570,
198,
198,
361,
9173,
13,
66,
14933,
25,
198,
197,
77,
4033,
796,
18896,
7,
46862,
13,
66,
14933,
8,
198,
17772,
25,
198,
197,
77,
4033,
796,
18896,
7,
46862,
13,
19545,
28955,
198,
197,
46862,
13,
1809,
521,
3419,
198,
198,
4033,
82,
796,
685,
77,
4033,
1343,
269,
611,
269,
1279,
657,
2073,
269,
329,
269,
287,
951,
82,
60,
198,
361,
407,
1394,
25,
198,
197,
4033,
82,
796,
685,
66,
329,
269,
287,
2837,
7,
77,
4033,
8,
611,
269,
407,
287,
951,
82,
60,
198,
198,
361,
9173,
13,
66,
14933,
25,
198,
197,
16002,
13,
66,
14933,
796,
685,
46862,
13,
66,
14933,
58,
66,
60,
329,
269,
287,
951,
82,
60,
198,
197,
16002,
13,
13564,
13847,
3419,
198,
198,
1640,
374,
287,
9173,
25,
198,
197,
8344,
796,
685,
81,
58,
66,
60,
329,
269,
287,
951,
82,
60,
198,
197,
16002,
13,
13564,
7,
8344,
8,
198,
16002,
13,
19836,
3419,
198
] | 2.562883 | 652 |
from app.signal_calc import SignalCalc
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import math
import numpy as np
import pandas as pd
def line_fig(date, y_axis, y_dict):
"""
:param date: xaxis,
:param y_label: yaxis label e.g. 'y2','y3'
:param y_dict: line data
:return: list
"""
y_values = [list(k) for k in y_dict.values()]
y_labels = [l for l in y_dict.keys()]
y_data = np.array(y_values)
fig_res = []
for i in range(len(y_values)):
fig = go.Scatter(
x=date,
y=y_data[i],
mode='lines',
marker=dict(opacity=0.8),
name=y_labels[i],
connectgaps=True,
yaxis=y_axis,
)
fig_res.append(fig)
return fig_res
| [
6738,
598,
13,
12683,
282,
62,
9948,
66,
1330,
26484,
9771,
66,
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,
11748,
10688,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
19798,
292,
355,
279,
67,
628,
198,
4299,
1627,
62,
5647,
7,
4475,
11,
331,
62,
22704,
11,
331,
62,
11600,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1058,
17143,
3128,
25,
2124,
22704,
11,
198,
220,
220,
220,
1058,
17143,
331,
62,
18242,
25,
331,
22704,
6167,
304,
13,
70,
13,
705,
88,
17,
41707,
88,
18,
6,
198,
220,
220,
220,
1058,
17143,
331,
62,
11600,
25,
1627,
1366,
198,
220,
220,
220,
1058,
7783,
25,
1351,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
331,
62,
27160,
796,
685,
4868,
7,
74,
8,
329,
479,
287,
331,
62,
11600,
13,
27160,
3419,
60,
198,
220,
220,
220,
331,
62,
23912,
1424,
796,
685,
75,
329,
300,
287,
331,
62,
11600,
13,
13083,
3419,
60,
198,
220,
220,
220,
331,
62,
7890,
796,
45941,
13,
18747,
7,
88,
62,
27160,
8,
628,
220,
220,
220,
2336,
62,
411,
796,
17635,
198,
220,
220,
220,
329,
1312,
287,
2837,
7,
11925,
7,
88,
62,
27160,
8,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
2336,
796,
467,
13,
3351,
1436,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
28,
4475,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
28,
88,
62,
7890,
58,
72,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4235,
11639,
6615,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18364,
28,
11600,
7,
404,
4355,
28,
15,
13,
23,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
28,
88,
62,
23912,
1424,
58,
72,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2018,
70,
1686,
28,
17821,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
22704,
28,
88,
62,
22704,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
2336,
62,
411,
13,
33295,
7,
5647,
8,
198,
220,
220,
220,
1441,
2336,
62,
411,
628
] | 1.985037 | 401 |
class SplitDataLoader:
"""
This class distributes each sample among different workers.
It returns a dictionary with key as data party's id and
value as a pointer to the list of data batches at party's
location.
example:
>>> from splitnn_dataloader import SplitDataLoader
>>> splitnn_trainloader = SplitDataLoader(data_parties=data_parties, data_loader=trainloader)
>>> splitnn_trainloader.data_pointer[1]['active_party'].shape, obj.data_pointer[1]['passive_party'].shape
(torch.Size([64, 10]), torch.Size([64, 10]))
"""
def __init__(self, data_parties, data_loader):
"""
Args:
data_parties: tuple of data parties
data_loader: torch.utils.data.DataLoader
"""
self.data_parties = data_parties
self.data_loader = data_loader
self.no_of_parties = len(data_parties)
self.data_pointer = []
self.labels = []
"""
self.data_pointer: list of dictionaries where
(key, value) = (id of the data holder, a pointer to the list of batches at that data holder).
example:
self.data_pointer = [
{"active_party": pointer_to_active_batch1, "passive_party": pointer_to_passive_batch1},
{"active_party": pointer_to_active_batch2, "passive_party": pointer_to_passive_batch2},
...
]
"""
# iterate over each batch of dataloader for split sample and send to VirtualWorker
for samples, labels in self.data_loader:
curr_data_dict = {}
# calculate the feature number for each party according to the no. of workers
feature_num_per_party = samples.shape[-1] // self.no_of_parties
self.labels.append(labels)
# iterate over each worker for distributing current batch of the self.data_loader
for i, party in enumerate(self.data_parties[:-1]):
# split the samples and send it to VirtualWorker (which is supposed to be an party or client)
sample_part_ptr = samples[:, feature_num_per_party * i:feature_num_per_party * (i + 1)].send(
party
)
curr_data_dict[party.id] = sample_part_ptr
# repeat same for the remaining part of the samples
last_party = self.data_parties[-1]
last_part_ptr = samples[:, feature_num_per_party * (i + 1):].send(last_party)
curr_data_dict[last_party.id] = last_part_ptr
self.data_pointer.append(curr_data_dict)
| [
198,
4871,
27758,
6601,
17401,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
770,
1398,
1233,
7657,
1123,
6291,
1871,
1180,
3259,
13,
198,
220,
220,
220,
632,
5860,
257,
22155,
351,
1994,
355,
1366,
2151,
338,
4686,
290,
198,
220,
220,
220,
1988,
355,
257,
17562,
284,
262,
1351,
286,
1366,
37830,
379,
2151,
338,
198,
220,
220,
220,
4067,
13,
628,
220,
220,
220,
1672,
25,
198,
220,
220,
220,
13163,
422,
6626,
20471,
62,
67,
10254,
1170,
263,
1330,
27758,
6601,
17401,
198,
220,
220,
220,
13163,
6626,
20471,
62,
27432,
29356,
796,
27758,
6601,
17401,
7,
7890,
62,
3911,
444,
28,
7890,
62,
3911,
444,
11,
1366,
62,
29356,
28,
27432,
29356,
8,
198,
220,
220,
220,
13163,
6626,
20471,
62,
27432,
29356,
13,
7890,
62,
29536,
58,
16,
7131,
6,
5275,
62,
10608,
6,
4083,
43358,
11,
26181,
13,
7890,
62,
29536,
58,
16,
7131,
6,
6603,
425,
62,
10608,
6,
4083,
43358,
198,
220,
220,
220,
220,
357,
13165,
354,
13,
10699,
26933,
2414,
11,
838,
46570,
28034,
13,
10699,
26933,
2414,
11,
838,
60,
4008,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
1366,
62,
3911,
444,
11,
1366,
62,
29356,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
3911,
444,
25,
46545,
286,
1366,
4671,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
62,
29356,
25,
28034,
13,
26791,
13,
7890,
13,
6601,
17401,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7890,
62,
3911,
444,
796,
1366,
62,
3911,
444,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7890,
62,
29356,
796,
1366,
62,
29356,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3919,
62,
1659,
62,
3911,
444,
796,
18896,
7,
7890,
62,
3911,
444,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7890,
62,
29536,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
23912,
1424,
796,
17635,
628,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7890,
62,
29536,
25,
220,
1351,
286,
48589,
3166,
810,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2539,
11,
1988,
8,
796,
357,
312,
286,
262,
1366,
15762,
11,
257,
17562,
284,
262,
1351,
286,
37830,
379,
326,
1366,
15762,
737,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1672,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7890,
62,
29536,
220,
796,
685,
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,
19779,
5275,
62,
10608,
1298,
17562,
62,
1462,
62,
5275,
62,
43501,
16,
11,
366,
6603,
425,
62,
10608,
1298,
17562,
62,
1462,
62,
6603,
425,
62,
43501,
16,
5512,
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,
19779,
5275,
62,
10608,
1298,
17562,
62,
1462,
62,
5275,
62,
43501,
17,
11,
366,
6603,
425,
62,
10608,
1298,
17562,
62,
1462,
62,
6603,
425,
62,
43501,
17,
5512,
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,
2644,
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,
2361,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
11629,
378,
625,
1123,
15458,
286,
4818,
282,
1170,
263,
329,
6626,
6291,
290,
3758,
284,
15595,
12468,
263,
198,
220,
220,
220,
220,
220,
220,
220,
329,
8405,
11,
14722,
287,
2116,
13,
7890,
62,
29356,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1090,
81,
62,
7890,
62,
11600,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
15284,
262,
3895,
1271,
329,
1123,
2151,
1864,
284,
262,
645,
13,
286,
3259,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3895,
62,
22510,
62,
525,
62,
10608,
796,
8405,
13,
43358,
58,
12,
16,
60,
3373,
2116,
13,
3919,
62,
1659,
62,
3911,
444,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
23912,
1424,
13,
33295,
7,
23912,
1424,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
11629,
378,
625,
1123,
8383,
329,
25950,
1459,
15458,
286,
262,
2116,
13,
7890,
62,
29356,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
11,
2151,
287,
27056,
378,
7,
944,
13,
7890,
62,
3911,
444,
58,
21912,
16,
60,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6626,
262,
8405,
290,
3758,
340,
284,
15595,
12468,
263,
357,
4758,
318,
4385,
284,
307,
281,
2151,
393,
5456,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6291,
62,
3911,
62,
20692,
796,
8405,
58,
45299,
3895,
62,
22510,
62,
525,
62,
10608,
1635,
1312,
25,
30053,
62,
22510,
62,
525,
62,
10608,
1635,
357,
72,
1343,
352,
25295,
21280,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2151,
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,
1090,
81,
62,
7890,
62,
11600,
58,
10608,
13,
312,
60,
796,
6291,
62,
3911,
62,
20692,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
9585,
976,
329,
262,
5637,
636,
286,
262,
8405,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
938,
62,
10608,
796,
2116,
13,
7890,
62,
3911,
444,
58,
12,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
938,
62,
3911,
62,
20692,
796,
8405,
58,
45299,
3895,
62,
22510,
62,
525,
62,
10608,
1635,
357,
72,
1343,
352,
2599,
4083,
21280,
7,
12957,
62,
10608,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1090,
81,
62,
7890,
62,
11600,
58,
12957,
62,
10608,
13,
312,
60,
796,
938,
62,
3911,
62,
20692,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7890,
62,
29536,
13,
33295,
7,
22019,
81,
62,
7890,
62,
11600,
8,
198
] | 2.224066 | 1,205 |
from flask import Flask, render_template, send_from_directory, request, redirect, url_for
import os
import psycopg2
# import students
from students import studentRoutes
from Admin import adminRoutes
# import nltk
# import numpy as np
# import pandas as pd
# conn = psycopg2.connect('dbname=postgres')
conn = psycopg2.connect('dbname=group_13 user=group_13 password=p0XvR8Ch4BAGb host=10.17.50.232 port=5432')
cur = conn.cursor()
app = Flask(__name__)
app.register_blueprint(studentRoutes)
app.register_blueprint(adminRoutes)
# app['debug'] = True
# UPLOAD_FOLDER ='./uploads/'
# app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
# CONFIG_FOLDER ='./config/'
# app.config['CONFIG_FOLDER'] = CONFIG_FOLDER
# PDF_FOLDER ='./pdfs/'
# app.config['PDF_FOLDER'] = PDF_FOLDER
# app.config['TMP'] = './tmp/'
currentStudentLoginId = "" # the student who is currently logged in
currentProfLoginId = "" # # the instructor who is currently logged in
COID =""
SN = ""
schedule = []
@app.route("/") #main webpage rendering
@app.route("/instructorScreen", methods = ["POST"])
@app.route("/instructorScreen/AddCourse", methods = ["POST"])
@app.route("/instructorScreen/Requests", methods = ["POST"])
@app.route("/instructorScreen/ProcessRequests", methods = ["POST"])
@app.route("/instructorScreen/Schedule", methods = ["POST"])
@app.route("/instructorScreen/enrollment", methods = ["POST"])
@app.route("/instructorScreen/addGradeDistribution", methods = ["POST"])
@app.route("/instructorScreen/getGradeDistribution", methods = ["POST"])
@app.route("/instructorScreen/room", methods = ["POST"])
@app.route("/instructorScreen/searchCourse", methods = ["POST"])
if __name__ == '__main__':
app.run(host='127.0.0.1', port=5013)
| [
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
11,
3758,
62,
6738,
62,
34945,
11,
2581,
11,
18941,
11,
19016,
62,
1640,
198,
11748,
28686,
198,
11748,
17331,
22163,
70,
17,
198,
2,
1330,
2444,
198,
6738,
2444,
1330,
3710,
49,
448,
274,
198,
6738,
32053,
1330,
13169,
49,
448,
274,
198,
2,
1330,
299,
2528,
74,
198,
2,
1330,
299,
32152,
355,
45941,
198,
2,
1330,
19798,
292,
355,
279,
67,
198,
198,
2,
48260,
796,
17331,
22163,
70,
17,
13,
8443,
10786,
9945,
3672,
28,
7353,
34239,
11537,
198,
37043,
796,
17331,
22163,
70,
17,
13,
8443,
10786,
9945,
3672,
28,
8094,
62,
1485,
2836,
28,
8094,
62,
1485,
9206,
28,
79,
15,
55,
85,
49,
23,
1925,
19,
4339,
49017,
2583,
28,
940,
13,
1558,
13,
1120,
13,
24339,
2493,
28,
4051,
2624,
11537,
198,
198,
22019,
796,
48260,
13,
66,
21471,
3419,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
198,
1324,
13,
30238,
62,
17585,
4798,
7,
50139,
49,
448,
274,
8,
198,
1324,
13,
30238,
62,
17585,
4798,
7,
28482,
49,
448,
274,
8,
198,
2,
598,
17816,
24442,
20520,
796,
6407,
198,
198,
2,
471,
6489,
41048,
62,
37,
3535,
14418,
796,
4458,
14,
39920,
14,
6,
198,
2,
598,
13,
11250,
17816,
52,
6489,
41048,
62,
37,
3535,
14418,
20520,
796,
471,
6489,
41048,
62,
37,
3535,
14418,
198,
2,
25626,
62,
37,
3535,
14418,
796,
4458,
14,
11250,
14,
6,
198,
2,
598,
13,
11250,
17816,
10943,
16254,
62,
37,
3535,
14418,
20520,
796,
25626,
62,
37,
3535,
14418,
198,
2,
12960,
62,
37,
3535,
14418,
796,
4458,
14,
12315,
82,
14,
6,
198,
2,
598,
13,
11250,
17816,
20456,
62,
37,
3535,
14418,
20520,
796,
12960,
62,
37,
3535,
14418,
198,
2,
598,
13,
11250,
17816,
51,
7378,
20520,
796,
705,
19571,
22065,
14,
6,
198,
14421,
38778,
47790,
7390,
796,
13538,
220,
1303,
262,
3710,
508,
318,
3058,
18832,
287,
198,
14421,
15404,
47790,
7390,
796,
13538,
220,
220,
220,
220,
1303,
1303,
262,
21187,
508,
318,
3058,
18832,
287,
198,
8220,
2389,
796,
15931,
198,
15571,
796,
13538,
198,
15952,
5950,
796,
17635,
198,
198,
31,
1324,
13,
38629,
7203,
14,
4943,
220,
1303,
12417,
35699,
14837,
198,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
1600,
5050,
796,
14631,
32782,
8973,
8,
198,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
4550,
49046,
1600,
5050,
796,
14631,
32782,
8973,
8,
198,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
16844,
3558,
1600,
5050,
796,
14631,
32782,
8973,
8,
198,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
18709,
16844,
3558,
1600,
5050,
796,
14631,
32782,
8973,
8,
628,
628,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
27054,
5950,
1600,
5050,
796,
14631,
32782,
8973,
8,
628,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
268,
48108,
1600,
5050,
796,
14631,
32782,
8973,
8,
628,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
2860,
42233,
20344,
3890,
1600,
5050,
796,
14631,
32782,
8973,
8,
198,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
1136,
42233,
20344,
3890,
1600,
5050,
796,
14631,
32782,
8973,
8,
198,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
3823,
1600,
5050,
796,
14631,
32782,
8973,
8,
628,
198,
31,
1324,
13,
38629,
7203,
14,
259,
7249,
273,
23901,
14,
12947,
49046,
1600,
5050,
796,
14631,
32782,
8973,
8,
628,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
598,
13,
5143,
7,
4774,
11639,
16799,
13,
15,
13,
15,
13,
16,
3256,
2493,
28,
20,
30273,
8,
198
] | 2.755556 | 630 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from setuptools import setup, find_namespace_packages
project_name = 'vznncv-miniterm'
with open('README.md') as readme_file:
readme = readme_file.read()
readme = re.sub(r'!\[[^\[\]]*\]\S*', '', readme)
_locals = {}
with open('src/' + project_name.replace('-', '/') + '/_version.py') as fp:
exec(fp.read(), None, _locals)
__version__ = _locals['__version__']
with open('requirements_dev.txt') as fp:
test_requirements = fp.read()
setup(
author="Konstantin Kochin",
classifiers=[
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Terminals :: Serial',
],
description="Line buffered version of pyserial miniterm tool",
long_description=readme,
long_description_content_type="text/markdown",
license='MIT',
include_package_data=True,
name=project_name,
packages=find_namespace_packages(where='src'),
package_dir={'': 'src'},
entry_points={
'console_scripts': [
'vznncv-miniterm = vznncv.miniterm._cli:main',
]
},
install_requires=[
'pyserial>=3.4,<4',
'pyserial-asyncio>=0.4,<1',
'prompt_toolkit>=3,<4',
],
tests_require=test_requirements,
version=__version__,
python_requires='~=3.6',
)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
11748,
302,
198,
198,
6738,
900,
37623,
10141,
1330,
9058,
11,
1064,
62,
14933,
10223,
62,
43789,
198,
198,
16302,
62,
3672,
796,
705,
85,
47347,
10782,
85,
12,
1084,
2676,
76,
6,
198,
198,
4480,
1280,
10786,
15675,
11682,
13,
9132,
11537,
355,
1100,
1326,
62,
7753,
25,
198,
220,
220,
220,
1100,
1326,
796,
1100,
1326,
62,
7753,
13,
961,
3419,
198,
961,
1326,
796,
302,
13,
7266,
7,
81,
6,
0,
59,
30109,
61,
59,
58,
59,
11907,
9,
59,
60,
59,
50,
9,
3256,
705,
3256,
1100,
1326,
8,
198,
198,
62,
17946,
874,
796,
23884,
198,
4480,
1280,
10786,
10677,
14,
6,
1343,
1628,
62,
3672,
13,
33491,
10786,
12,
3256,
31051,
11537,
1343,
31051,
62,
9641,
13,
9078,
11537,
355,
277,
79,
25,
198,
220,
220,
220,
2452,
7,
46428,
13,
961,
22784,
6045,
11,
4808,
17946,
874,
8,
198,
834,
9641,
834,
796,
4808,
17946,
874,
17816,
834,
9641,
834,
20520,
198,
198,
4480,
1280,
10786,
8897,
18883,
62,
7959,
13,
14116,
11537,
355,
277,
79,
25,
198,
220,
220,
220,
1332,
62,
8897,
18883,
796,
277,
79,
13,
961,
3419,
198,
198,
40406,
7,
198,
220,
220,
220,
1772,
2625,
42,
261,
18797,
259,
17009,
259,
1600,
198,
220,
220,
220,
1398,
13350,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
21,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
22,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
23,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15167,
2229,
15417,
7904,
11361,
7904,
513,
13,
24,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
33221,
7904,
15527,
874,
7904,
23283,
3256,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
6764,
2625,
13949,
6940,
1068,
2196,
286,
279,
893,
48499,
949,
2676,
76,
2891,
1600,
198,
220,
220,
220,
890,
62,
11213,
28,
961,
1326,
11,
198,
220,
220,
220,
890,
62,
11213,
62,
11299,
62,
4906,
2625,
5239,
14,
4102,
2902,
1600,
198,
220,
220,
220,
5964,
11639,
36393,
3256,
198,
220,
220,
220,
2291,
62,
26495,
62,
7890,
28,
17821,
11,
198,
220,
220,
220,
1438,
28,
16302,
62,
3672,
11,
198,
220,
220,
220,
10392,
28,
19796,
62,
14933,
10223,
62,
43789,
7,
3003,
11639,
10677,
33809,
198,
220,
220,
220,
5301,
62,
15908,
34758,
7061,
25,
705,
10677,
6,
5512,
198,
220,
220,
220,
5726,
62,
13033,
34758,
198,
220,
220,
220,
220,
220,
220,
220,
705,
41947,
62,
46521,
10354,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
85,
47347,
10782,
85,
12,
1084,
2676,
76,
796,
410,
47347,
10782,
85,
13,
1084,
2676,
76,
13557,
44506,
25,
12417,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
2721,
62,
47911,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
705,
79,
893,
48499,
29,
28,
18,
13,
19,
11,
27,
19,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
79,
893,
48499,
12,
292,
13361,
952,
29,
28,
15,
13,
19,
11,
27,
16,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
16963,
457,
62,
25981,
15813,
29,
28,
18,
11,
27,
19,
3256,
198,
220,
220,
220,
16589,
198,
220,
220,
220,
5254,
62,
46115,
28,
9288,
62,
8897,
18883,
11,
198,
220,
220,
220,
2196,
28,
834,
9641,
834,
11,
198,
220,
220,
220,
21015,
62,
47911,
11639,
93,
28,
18,
13,
21,
3256,
198,
8,
198
] | 2.293185 | 631 |
import os
import json
from PIL import Image, ImageDraw, ImageFont
from inky.inky_uc8159 import Inky
from datetime import datetime as dt
from bots.orgbot import get_org_image
from bots.twitterbot import get_tweet_img
from bots.twitterbot import get_recent_care_tweet
from bots.pomodorobot import get_pomodoro_time
from bots.pomodorobot import get_pomodoro
from bots.calendarbot import get_next_event
from bots.calendarbot import get_event_img
# Inky display information
inky_display = Inky() # Global because only one inky to pass around...
DESATURATED_PALETTE = (
0,
0,
0,
255,
255,
255,
0,
255,
0,
0,
0,
255,
255,
0,
0,
255,
255,
0,
255,
140,
0,
255,
255,
255,
) + (0, 0, 0) * 248
SATURATED_PALETTE = (
57,
48,
57,
255,
255,
255,
58,
91,
70,
61,
59,
94,
156,
72,
75,
208,
190,
71,
177,
106,
73,
255,
255,
255,
) + (0, 0, 0) * 248
MID_PALETTE = tuple(sum(x) // 2 for x in zip(DESATURATED_PALETTE, SATURATED_PALETTE))
DEFAULT_DATA = {
"tomato": 0,
"cycle": "still working",
"start_time": int(dt.utcnow().timestamp()) % 86400,
"pomodoro_mode": True,
"reset": False,
"tweet": "",
"event_counter": 0,
"event": {
"name": 'No events scheduled.',
"location": None,
"start": None,
"end": None,
"active": False,
},
}
# initialize data
data = DEFAULT_DATA
if __name__ == "__main__":
run_tinky_care()
| [
11748,
28686,
198,
11748,
33918,
198,
6738,
350,
4146,
1330,
7412,
11,
7412,
25302,
11,
7412,
23252,
198,
6738,
287,
2584,
13,
29246,
62,
1229,
23,
19707,
1330,
554,
2584,
198,
6738,
4818,
8079,
1330,
4818,
8079,
355,
288,
83,
198,
6738,
29641,
13,
2398,
13645,
1330,
651,
62,
2398,
62,
9060,
198,
6738,
29641,
13,
6956,
13645,
1330,
651,
62,
83,
7277,
62,
9600,
198,
6738,
29641,
13,
6956,
13645,
1330,
651,
62,
49921,
62,
6651,
62,
83,
7277,
198,
6738,
29641,
13,
79,
296,
30530,
672,
313,
1330,
651,
62,
79,
296,
375,
16522,
62,
2435,
198,
6738,
29641,
13,
79,
296,
30530,
672,
313,
1330,
651,
62,
79,
296,
375,
16522,
198,
6738,
29641,
13,
9948,
9239,
13645,
1330,
651,
62,
19545,
62,
15596,
198,
6738,
29641,
13,
9948,
9239,
13645,
1330,
651,
62,
15596,
62,
9600,
198,
198,
2,
554,
2584,
3359,
1321,
198,
29246,
62,
13812,
796,
554,
2584,
3419,
220,
1303,
8060,
780,
691,
530,
287,
2584,
284,
1208,
1088,
986,
198,
198,
30910,
1404,
4261,
11617,
62,
47,
1847,
2767,
9328,
796,
357,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
12713,
11,
198,
220,
220,
220,
657,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
8,
1343,
357,
15,
11,
657,
11,
657,
8,
1635,
32996,
198,
198,
50,
1404,
4261,
11617,
62,
47,
1847,
2767,
9328,
796,
357,
198,
220,
220,
220,
7632,
11,
198,
220,
220,
220,
4764,
11,
198,
220,
220,
220,
7632,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
7618,
11,
198,
220,
220,
220,
10495,
11,
198,
220,
220,
220,
4317,
11,
198,
220,
220,
220,
8454,
11,
198,
220,
220,
220,
7863,
11,
198,
220,
220,
220,
10048,
11,
198,
220,
220,
220,
23871,
11,
198,
220,
220,
220,
7724,
11,
198,
220,
220,
220,
5441,
11,
198,
220,
220,
220,
27121,
11,
198,
220,
220,
220,
19884,
11,
198,
220,
220,
220,
9166,
11,
198,
220,
220,
220,
26607,
11,
198,
220,
220,
220,
15696,
11,
198,
220,
220,
220,
8854,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
220,
220,
220,
14280,
11,
198,
8,
1343,
357,
15,
11,
657,
11,
657,
8,
1635,
32996,
198,
198,
44,
2389,
62,
47,
1847,
2767,
9328,
796,
46545,
7,
16345,
7,
87,
8,
3373,
362,
329,
2124,
287,
19974,
7,
30910,
1404,
4261,
11617,
62,
47,
1847,
2767,
9328,
11,
29020,
4261,
11617,
62,
47,
1847,
2767,
9328,
4008,
198,
198,
7206,
38865,
62,
26947,
796,
1391,
198,
220,
220,
220,
366,
39532,
5549,
1298,
657,
11,
198,
220,
220,
220,
366,
13696,
1298,
366,
24219,
1762,
1600,
198,
220,
220,
220,
366,
9688,
62,
2435,
1298,
493,
7,
28664,
13,
315,
66,
2197,
22446,
16514,
27823,
28955,
4064,
807,
2414,
405,
11,
198,
220,
220,
220,
366,
79,
296,
375,
16522,
62,
14171,
1298,
6407,
11,
198,
220,
220,
220,
366,
42503,
1298,
10352,
11,
198,
220,
220,
220,
366,
83,
7277,
1298,
366,
1600,
198,
220,
220,
220,
366,
15596,
62,
24588,
1298,
657,
11,
198,
220,
220,
220,
366,
15596,
1298,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
366,
3672,
1298,
705,
2949,
2995,
7530,
2637,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
24886,
1298,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
9688,
1298,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
437,
1298,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
5275,
1298,
10352,
11,
198,
220,
220,
220,
8964,
198,
92,
628,
628,
628,
198,
2,
41216,
1366,
198,
7890,
796,
5550,
38865,
62,
26947,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1057,
62,
83,
29246,
62,
6651,
3419,
198
] | 2.054759 | 767 |
import numpy as np
import tensorflow as tf
import keras.backend as K
'''
Cauchy-Schwarz distance between 2 samples
The distance measures 'distinguishability' between samples.
So, if 2 samples belong to same class, the distance would have a small value.
'''
'''
Compute Cauchy-Schwarz distance loss among samples in the batch based on true-label information
That is, if two samples belong to the same class, the distance would be small.
'''
def renyi_crossentropy_loss(y_true, y_pred):
'''
2nd-order Renyi entropy --- collision entorpy
'''
renyi_loss = -tf.log(K.mean(tf.multiply(y_true, y_pred), axis=1))
# (samples, 1)
return K.mean(renyi_loss, -1)
'''
1,2,3-order hinge loss
'''
'''
Wasserstein loss
'''
| [
11748,
299,
32152,
355,
45941,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
41927,
292,
13,
1891,
437,
355,
509,
198,
198,
7061,
6,
198,
220,
220,
220,
327,
559,
29658,
12,
14874,
5767,
89,
5253,
1022,
362,
8405,
198,
220,
220,
220,
383,
5253,
5260,
705,
17080,
6680,
680,
1799,
6,
1022,
8405,
13,
198,
220,
220,
220,
1406,
11,
611,
362,
8405,
5594,
284,
976,
1398,
11,
262,
5253,
561,
423,
257,
1402,
1988,
13,
198,
7061,
6,
198,
198,
7061,
6,
198,
220,
220,
220,
3082,
1133,
327,
559,
29658,
12,
14874,
5767,
89,
5253,
2994,
1871,
8405,
287,
262,
15458,
1912,
319,
2081,
12,
18242,
1321,
198,
220,
220,
220,
1320,
318,
11,
611,
734,
8405,
5594,
284,
262,
976,
1398,
11,
262,
5253,
561,
307,
1402,
13,
198,
7061,
6,
198,
198,
4299,
302,
3281,
72,
62,
19692,
298,
28338,
62,
22462,
7,
88,
62,
7942,
11,
331,
62,
28764,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
362,
358,
12,
2875,
7152,
48111,
40709,
11420,
17661,
920,
273,
9078,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
302,
3281,
72,
62,
22462,
796,
532,
27110,
13,
6404,
7,
42,
13,
32604,
7,
27110,
13,
16680,
541,
306,
7,
88,
62,
7942,
11,
331,
62,
28764,
828,
16488,
28,
16,
4008,
198,
220,
220,
220,
1303,
357,
82,
12629,
11,
352,
8,
198,
220,
220,
220,
1441,
509,
13,
32604,
7,
918,
48111,
62,
22462,
11,
532,
16,
8,
628,
198,
7061,
6,
198,
220,
220,
220,
352,
11,
17,
11,
18,
12,
2875,
41968,
2994,
198,
7061,
6,
198,
198,
7061,
6,
198,
220,
220,
220,
370,
24929,
5714,
2994,
198,
7061,
6,
198
] | 2.648276 | 290 |
import os
import json
import boto3
import logging
from .constants import (
DATA_DIR,
S3_BUCKET,
AWS_DIR,
AWS_EC2_FILE,
AWS_RDS_FILE,
AZURE_DIR,
GCP_DIR
)
# Initialisation of data directory
if not os.path.exists(DATA_DIR):
logging.debug('No data directories yet, creating')
aws_path: str = os.path.join(DATA_DIR, AWS_DIR)
azure_path: str = os.path.join(DATA_DIR, AZURE_DIR)
gcp_path: str = os.path.join(DATA_DIR, GCP_DIR)
os.makedirs(aws_path, exist_ok=True)
os.makedirs(azure_path, exist_ok=True)
os.makedirs(gcp_path, exist_ok=True) | [
11748,
28686,
198,
11748,
33918,
198,
11748,
275,
2069,
18,
198,
11748,
18931,
198,
198,
6738,
764,
9979,
1187,
1330,
357,
198,
220,
220,
220,
42865,
62,
34720,
11,
198,
220,
220,
220,
311,
18,
62,
33,
16696,
2767,
11,
198,
220,
220,
220,
30865,
62,
34720,
11,
198,
220,
220,
220,
30865,
62,
2943,
17,
62,
25664,
11,
198,
220,
220,
220,
30865,
62,
49,
5258,
62,
25664,
11,
198,
220,
220,
220,
26253,
11335,
62,
34720,
11,
198,
220,
220,
220,
402,
8697,
62,
34720,
198,
8,
198,
198,
2,
20768,
5612,
286,
1366,
8619,
198,
361,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
26947,
62,
34720,
2599,
198,
220,
220,
220,
18931,
13,
24442,
10786,
2949,
1366,
29196,
1865,
11,
4441,
11537,
198,
220,
220,
220,
3253,
82,
62,
6978,
25,
965,
796,
28686,
13,
6978,
13,
22179,
7,
26947,
62,
34720,
11,
30865,
62,
34720,
8,
198,
220,
220,
220,
35560,
495,
62,
6978,
25,
965,
796,
28686,
13,
6978,
13,
22179,
7,
26947,
62,
34720,
11,
26253,
11335,
62,
34720,
8,
198,
220,
220,
220,
308,
13155,
62,
6978,
25,
965,
796,
28686,
13,
6978,
13,
22179,
7,
26947,
62,
34720,
11,
402,
8697,
62,
34720,
8,
198,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
8356,
62,
6978,
11,
2152,
62,
482,
28,
17821,
8,
198,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
1031,
495,
62,
6978,
11,
2152,
62,
482,
28,
17821,
8,
198,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
70,
13155,
62,
6978,
11,
2152,
62,
482,
28,
17821,
8
] | 2.230189 | 265 |
## Parinfer.py - a Parinfer implementation in Python
## v3.12.0
## https://github.com/oakmac/parinfer.py
##
## More information about Parinfer can be found here:
## http://shaunlebron.github.io/parinfer/
##
## Copyright (c) 2015, 2020, Chris Oakman and other contributors
## Released under the ISC license
## https://github.com/oakmac/parinfer.py/blob/master/LICENSE.md
import re
import sys
#-------------------------------------------------------------------------------
# Constants
#-------------------------------------------------------------------------------
INDENT_MODE = 'INDENT_MODE'
PAREN_MODE = 'PAREN_MODE'
BACKSLASH = '\\'
BLANK_SPACE = ' '
DOUBLE_SPACE = ' '
DOUBLE_QUOTE = '"'
NEWLINE = '\n'
TAB = '\t'
LINE_ENDING_REGEX = re.compile(r"\r?\n")
CLOSE_PARENS = frozenset(['}', ')', ']'])
OPEN_PARENS = frozenset(['{', '(', '['])
WHITESPACE = frozenset([NEWLINE, BLANK_SPACE, TAB])
MATCH_PAREN = {
'{': '}',
'}': '{',
'[': ']',
']': '[',
'(': ')',
')': '(',
}
# toggle this to check the asserts during development
RUN_ASSERTS = False
#-------------------------------------------------------------------------------
# Options Structure
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Result Structure
#-------------------------------------------------------------------------------
# This represents the running result. As we scan through each character
# of a given text, we mutate this structure to update the state of our
# system.
class Result:
"""Returns a dictionary of the initial state."""
__slots__ = (
'mode', 'smart',
'origText', 'origCursorX', 'origCursorLine',
'inputLines',
'inputLineNo', 'inputX',
'lines', 'lineNo', 'ch', 'x', 'indentX',
'parenStack',
'tabStops', 'parenTrail',
'parenTrails',
'returnParens', 'parens',
'cursorX', 'cursorLine', 'prevCursorX', 'prevCursorLine',
'selectionStartLine',
'changes',
'isInCode', 'isEscaping', 'isEscaped', 'isInStr', 'isInComment',
'commentX',
'quoteDanger', 'trackingIndent', 'skipChar', 'success', 'partialResult',
'forceBalance', 'maxIndent', 'indentDelta', 'trackingArgTabStop',
'error',
'errorPosCache',
'comment')
def __init__(self, text, options, mode, smart):
"""Constructs a dictionary of the initial state."""
super(Result, self).__init__()
self.mode = mode # [enum] - current processing mode (INDENT_MODE or PAREN_MODE)
self.smart = smart # [boolean] - smart mode attempts special user-friendly behavior
self.origText = text # [string] - original text
self.origCursorX = None # [integer] - original cursorX option
self.origCursorLine = None # [integer] - original cursorLine option
# [string array] - input lines that we process line-by-line char-by-char
self.inputLines = re.split(LINE_ENDING_REGEX, text)
self.inputLineNo = -1 # [integer] - the current input line number
self.inputX = -1 # [integer] - the current input x position of the current character (ch)
self.lines = [] # [string array] - output lines (with corrected parens or indentation)
self.lineNo = -1 # [integer] - output line number we are on
self.ch = '' # [string] - character we are processing (can be changed to indicate a replacement)
self.x = 0 # [integer] - output x position of the current character (ch)
self.indentX = None # [integer] - x position of the indentation point if present
self.parenStack = [] # We track where we are in the Lisp tree by keeping a stack (array) of open-parens.
# Stack elements are objects containing keys {ch, x, lineNo, indentDelta}
# whose values are the same as those described here in this result structure.
self.tabStops = [] # In Indent Mode, it is useful for editors to snap a line's indentation
# to certain critical points. Thus, we have a `tabStops` array of objects containing
# keys {ch, x, lineNo, argX}, which is just the state of the `parenStack` at the cursor line.
self.parenTrail = initialParenTrail() # the range of parens at the end of a line
self.parenTrails = [] # [array of {lineNo, startX, endX}] - all non-empty parenTrails to be returned
self.returnParens = False # [boolean] - determines if we return `parens` described below
self.parens = [] # [array of {lineNo, x, closer, children}] - paren tree if `returnParens` is h
self.cursorX = None # [integer] - x position of the cursor
self.cursorLine = None # [integer] - line number of the cursor
self.prevCursorX = None # [integer] - x position of the previous cursor
self.prevCursorLine = None # [integer] - line number of the previous cursor
self.selectionStartLine = None # [integer] - line number of the current selection starting point
self.changes = None # [object] - mapping change.key to a change object (please see `transformChange` for object structure)
self.isInCode = True # [boolean] - indicates if we are currently in "code space" (not string or comment)
self.isEscaping = False # [boolean] - indicates if the next character will be escaped (e.g. `\c`). This may be inside string comment or code.
self.isEscaped = False # [boolean] - indicates if the current character is escaped (e.g. `\c`). This may be inside string comment or code.
self.isInStr = False # [boolean] - indicates if we are currently inside a string
self.isInComment = False # [boolean] - indicates if we are currently inside a comment
self.commentX = None # [integer] - x position of the start of comment on current line (if any)
self.quoteDanger = False # [boolean] - indicates if quotes are imbalanced inside of a comment (dangerous)
self.trackingIndent = False # [boolean] - are we looking for the indentation point of the current line?
self.skipChar = False # [boolean] - should we skip the processing of the current character?
self.success = False # [boolean] - was the input properly formatted enough to create a valid result?
self.partialResult = False # [boolean] - should we return a partial result when an error occurs?
self.forceBalance = False # [boolean] - should indent mode aggressively enforce paren balance?
self.maxIndent = sys.maxsize # [integer] - maximum allowed indentation of subsequent lines in Paren Mode
self.indentDelta = 0 # [integer] - how far indentation was shifted by Paren Mode
# (preserves relative indentation of nested expressions)
self.trackingArgTabStop = None # [string] - enum to track how close we are to the first-arg tabStop in a list
# For example a tabStop occurs at `bar` below:
#
# ` (foo bar`
# 00011112222000 <-- state after processing char (enums below)
#
# 0 None => not searching
# 1 'space' => searching for next space
# 2 'arg' => searching for arg
#
# (We create the tabStop when the change from 2->0 happens.)
#
self.comment = ';' # [string] default to semicolon as comment character
self.error = { # if 'success' is False, return this error to the user
'name': None, # [string] - Parinfer's unique name for this error
'message': None, # [string] - error message to display
'lineNo': None, # [integer] - line number of error
'x': None, # [integer] - start x position of error
'extra': {
'name': None,
'lineNo': None,
'x': None
}
}
self.errorPosCache = {} # [object] - maps error name to a potential error position
if isinstance(options, dict):
if 'cursorX' in options:
self.cursorX = options['cursorX']
self.origCursorX = options['cursorX']
if 'cursorLine' in options:
self.cursorLine = options['cursorLine']
self.origCursorLine = options['cursorLine']
if 'prevCursorX' in options:
self.prevCursorX = options['prevCursorX']
if 'prevCursorLine' in options:
self.prevCursorLine = options['prevCursorLine']
if 'selectionStartLine' in options:
self.selectionStartLine = options['selectionStartLine']
if 'changes' in options:
self.changes = transformChanges(options['changes'])
if 'partialResult' in options:
self.partialResult = options['partialResult']
if 'forceBalance' in options:
self.forceBalance = options['forceBalance']
if 'returnParens' in options:
self.returnParens = options['returnParens']
if 'comment' in options:
self.comment = options['comment']
#-------------------------------------------------------------------------------
# Possible Errors
#-------------------------------------------------------------------------------
# `result.error.name` is set to any of these
ERROR_QUOTE_DANGER = "quote-danger"
ERROR_EOL_BACKSLASH = "eol-backslash"
ERROR_UNCLOSED_QUOTE = "unclosed-quote"
ERROR_UNCLOSED_PAREN = "unclosed-paren"
ERROR_UNMATCHED_CLOSE_PAREN = "unmatched-close-paren"
ERROR_UNMATCHED_OPEN_PAREN = "unmatched-open-paren"
ERROR_LEADING_CLOSE_PAREN = "leading-close-paren"
ERROR_UNHANDLED = "unhandled"
errorMessages = {}
errorMessages[ERROR_QUOTE_DANGER] = "Quotes must balanced inside comment blocks."
errorMessages[ERROR_EOL_BACKSLASH] = "Line cannot end in a hanging backslash."
errorMessages[ERROR_UNCLOSED_QUOTE] = "String is missing a closing quote."
errorMessages[ERROR_UNCLOSED_PAREN] = "Unclosed open-paren."
errorMessages[ERROR_UNMATCHED_CLOSE_PAREN] = "Unmatched close-paren."
errorMessages[ERROR_UNMATCHED_OPEN_PAREN] = "Unmatched open-paren."
errorMessages[ERROR_LEADING_CLOSE_PAREN] = "Line cannot lead with a close-paren."
errorMessages[ERROR_UNHANDLED] = "Unhandled error."
#-------------------------------------------------------------------------------
# String Operations
#-------------------------------------------------------------------------------
if RUN_ASSERTS:
assert replaceWithinString('aaa', 0, 2, '') == 'a'
assert replaceWithinString('aaa', 0, 1, 'b') == 'baa'
assert replaceWithinString('aaa', 0, 2, 'b') == 'ba'
#-------------------------------------------------------------------------------
# Line Operations
#-------------------------------------------------------------------------------
# if the current character has changed, commit its change to the current line.
# def commitChar(result, origCh):
# ch = result.ch
# if origCh != ch:
# replaceWithinLine(result, result.lineNo, result.x, result.x + len(origCh), ch)
# result.indentDelta -= (len(origCh) - len(ch))
# result.x += len(ch)
#-------------------------------------------------------------------------------
# Misc Utils
#-------------------------------------------------------------------------------
# if RUN_ASSERTS:
# assert clamp(1, 3, 5) == 3
# assert clamp(9, 3, 5) == 5
# assert clamp(1, 3, None) == 3
# assert clamp(5, 3, None) == 5
# assert clamp(1, None, 5) == 1
# assert clamp(9, None, 5) == 5
# assert clamp(1, None, None) == 1
if RUN_ASSERTS:
assert peek(['a'], 0) == 'a'
assert peek(['a'], 1) is None
assert peek(['a', 'b', 'c'], 0) == 'c'
assert peek(['a', 'b', 'c'], 1) == 'b'
assert peek(['a', 'b', 'c'], 5) is None
assert peek([], 0) is None
assert peek([], 1) is None
#-------------------------------------------------------------------------------
# Questions about characters
#-------------------------------------------------------------------------------
# def isWhitespace(result):
# return not result.isEscaped and result.ch in WHITESPACE
# can this be the last code character of a list?
#-------------------------------------------------------------------------------
# Advanced operations on characters
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Literal character events
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Character dispatch
#-------------------------------------------------------------------------------
CHAR_DISPATCH = {
'(': onOpenParen,
'{': onOpenParen,
'[': onOpenParen,
')': onCloseParen,
'}': onCloseParen,
']': onCloseParen,
BACKSLASH: onBackslash,
TAB: onTab,
NEWLINE: onNewline,
DOUBLE_QUOTE: onQuote,
}
#-------------------------------------------------------------------------------
# Cursor defs
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Paren Trail defs
#-------------------------------------------------------------------------------
# INDENT MODE: allow the cursor to clamp the paren trail
# INDENT MODE: pops the paren trail from the stack
# Determine which open-paren (if any) on the parenStack should be considered
# the direct parent of the current line (given its indentation point).
# This allows Smart Mode to simulate Paren Mode's structure-preserving
# behavior by adding its `opener.indentDelta` to the current line's indentation.
# (care must be taken to prevent redundant indentation correction, detailed below)
# INDENT MODE: correct paren trail from indentation
# PAREN MODE: remove spaces from the paren trail
# PAREN MODE: append a valid close-paren to the end of the paren trail
#-------------------------------------------------------------------------------
# Indentation defs
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# High-level processing functions
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Public API
#-------------------------------------------------------------------------------
API = {
'version': '3.12.0',
'indent_mode': indent_mode,
'paren_mode': paren_mode,
'smart_mode': smart_mode
}
| [
2235,
2547,
259,
2232,
13,
9078,
532,
257,
2547,
259,
2232,
7822,
287,
11361,
198,
2235,
410,
18,
13,
1065,
13,
15,
198,
2235,
3740,
1378,
12567,
13,
785,
14,
15877,
20285,
14,
1845,
259,
2232,
13,
9078,
198,
2235,
198,
2235,
3125,
1321,
546,
2547,
259,
2232,
460,
307,
1043,
994,
25,
198,
2235,
2638,
1378,
1477,
1942,
293,
65,
1313,
13,
12567,
13,
952,
14,
1845,
259,
2232,
14,
198,
2235,
198,
2235,
15069,
357,
66,
8,
1853,
11,
12131,
11,
5180,
9121,
805,
290,
584,
20420,
198,
2235,
28728,
739,
262,
3180,
34,
5964,
198,
2235,
3740,
1378,
12567,
13,
785,
14,
15877,
20285,
14,
1845,
259,
2232,
13,
9078,
14,
2436,
672,
14,
9866,
14,
43,
2149,
24290,
13,
9132,
198,
198,
11748,
302,
198,
11748,
25064,
198,
198,
2,
10097,
24305,
198,
2,
4757,
1187,
198,
2,
10097,
24305,
198,
198,
12115,
3525,
62,
49058,
796,
705,
12115,
3525,
62,
49058,
6,
198,
27082,
1677,
62,
49058,
796,
705,
27082,
1677,
62,
49058,
6,
198,
198,
31098,
8634,
11211,
796,
705,
6852,
6,
198,
9148,
15154,
62,
4303,
11598,
796,
705,
705,
198,
35,
2606,
19146,
62,
4303,
11598,
796,
705,
220,
705,
198,
35,
2606,
19146,
62,
10917,
23051,
796,
705,
30543,
198,
13965,
24027,
796,
705,
59,
77,
6,
198,
5603,
33,
796,
705,
59,
83,
6,
198,
198,
24027,
62,
10619,
2751,
62,
31553,
6369,
796,
302,
13,
5589,
576,
7,
81,
1,
59,
81,
30,
59,
77,
4943,
198,
198,
32737,
62,
27082,
16938,
796,
8400,
8247,
316,
7,
17816,
92,
3256,
705,
8,
3256,
705,
49946,
12962,
198,
3185,
1677,
62,
27082,
16938,
796,
8400,
8247,
316,
7,
17816,
90,
3256,
29513,
3256,
705,
17816,
12962,
198,
12418,
2043,
1546,
47,
11598,
796,
8400,
8247,
316,
26933,
13965,
24027,
11,
9878,
15154,
62,
4303,
11598,
11,
309,
6242,
12962,
198,
198,
44,
11417,
62,
27082,
1677,
796,
1391,
198,
220,
220,
220,
705,
90,
10354,
705,
92,
3256,
198,
220,
220,
220,
705,
92,
10354,
705,
90,
3256,
198,
220,
220,
220,
44438,
10354,
705,
60,
3256,
198,
220,
220,
220,
705,
60,
10354,
44438,
3256,
198,
220,
220,
220,
29513,
10354,
705,
8,
3256,
198,
220,
220,
220,
705,
8,
10354,
29513,
3256,
198,
92,
198,
198,
2,
19846,
428,
284,
2198,
262,
29348,
1141,
2478,
198,
49,
4944,
62,
10705,
1137,
4694,
796,
10352,
198,
198,
2,
10097,
24305,
198,
2,
18634,
32522,
198,
2,
10097,
24305,
198,
198,
2,
10097,
24305,
198,
2,
25414,
32522,
198,
2,
10097,
24305,
198,
198,
2,
770,
6870,
262,
2491,
1255,
13,
1081,
356,
9367,
832,
1123,
2095,
198,
2,
286,
257,
1813,
2420,
11,
356,
4517,
378,
428,
4645,
284,
4296,
262,
1181,
286,
674,
198,
2,
1080,
13,
198,
198,
4871,
25414,
25,
198,
220,
220,
220,
37227,
35561,
257,
22155,
286,
262,
4238,
1181,
526,
15931,
198,
220,
220,
220,
11593,
6649,
1747,
834,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
705,
14171,
3256,
705,
27004,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
11612,
8206,
3256,
705,
11612,
34,
21471,
55,
3256,
705,
11612,
34,
21471,
13949,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15414,
43,
1127,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15414,
13949,
2949,
3256,
705,
15414,
55,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
6615,
3256,
705,
1370,
2949,
3256,
705,
354,
3256,
705,
87,
3256,
705,
521,
298,
55,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
11730,
25896,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
8658,
1273,
2840,
3256,
705,
11730,
15721,
346,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
11730,
15721,
4487,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7783,
47,
5757,
82,
3256,
705,
11730,
82,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
66,
21471,
55,
3256,
705,
66,
21471,
13949,
3256,
705,
47050,
34,
21471,
55,
3256,
705,
47050,
34,
21471,
13949,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
49283,
10434,
13949,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
36653,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
271,
818,
10669,
3256,
705,
271,
47051,
9269,
3256,
705,
271,
47051,
5813,
3256,
705,
271,
818,
13290,
3256,
705,
271,
818,
21357,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
23893,
55,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
22708,
35,
2564,
3256,
705,
36280,
5497,
298,
3256,
705,
48267,
12441,
3256,
705,
13138,
3256,
705,
47172,
23004,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
3174,
45866,
3256,
705,
9806,
5497,
298,
3256,
705,
521,
298,
42430,
3256,
705,
36280,
28100,
33349,
19485,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
18224,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
18224,
21604,
30562,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
23893,
11537,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
2420,
11,
3689,
11,
4235,
11,
4451,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
42316,
82,
257,
22155,
286,
262,
4238,
1181,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
23004,
11,
2116,
737,
834,
15003,
834,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
14171,
796,
4235,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
44709,
60,
532,
1459,
7587,
4235,
357,
12115,
3525,
62,
49058,
393,
29463,
1677,
62,
49058,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
27004,
796,
4451,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
4451,
4235,
6370,
2041,
2836,
12,
13120,
4069,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11612,
8206,
796,
2420,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
8841,
60,
532,
2656,
2420,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11612,
34,
21471,
55,
796,
6045,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
2656,
23493,
55,
3038,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11612,
34,
21471,
13949,
796,
6045,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
2656,
23493,
13949,
3038,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
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,
685,
8841,
7177,
60,
532,
5128,
3951,
326,
356,
1429,
1627,
12,
1525,
12,
1370,
1149,
12,
1525,
12,
10641,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15414,
43,
1127,
796,
302,
13,
35312,
7,
24027,
62,
10619,
2751,
62,
31553,
6369,
11,
2420,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15414,
13949,
2949,
796,
532,
16,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
262,
1459,
5128,
1627,
1271,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
15414,
55,
796,
532,
16,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
262,
1459,
5128,
2124,
2292,
286,
262,
1459,
2095,
357,
354,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
6615,
796,
17635,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
8841,
7177,
60,
532,
5072,
3951,
357,
4480,
19267,
279,
5757,
82,
393,
33793,
341,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1370,
2949,
796,
532,
16,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
5072,
1627,
1271,
356,
389,
319,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
354,
796,
10148,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
8841,
60,
532,
2095,
356,
389,
7587,
357,
5171,
307,
3421,
284,
7603,
257,
9014,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
87,
796,
657,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
5072,
2124,
2292,
286,
262,
1459,
2095,
357,
354,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
521,
298,
55,
796,
6045,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
2124,
2292,
286,
262,
33793,
341,
966,
611,
1944,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11730,
25896,
796,
17635,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
775,
2610,
810,
356,
389,
287,
262,
38593,
5509,
416,
5291,
257,
8931,
357,
18747,
8,
286,
1280,
12,
11730,
82,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
23881,
4847,
389,
5563,
7268,
8251,
1391,
354,
11,
2124,
11,
1627,
2949,
11,
33793,
42430,
92,
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,
3025,
3815,
389,
262,
976,
355,
883,
3417,
994,
287,
428,
1255,
4645,
13,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
8658,
1273,
2840,
796,
17635,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
554,
1423,
298,
10363,
11,
340,
318,
4465,
329,
15719,
284,
11495,
257,
1627,
338,
33793,
341,
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,
284,
1728,
4688,
2173,
13,
220,
6660,
11,
356,
423,
257,
4600,
8658,
1273,
2840,
63,
7177,
286,
5563,
7268,
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,
8251,
1391,
354,
11,
2124,
11,
1627,
2949,
11,
1822,
55,
5512,
543,
318,
655,
262,
1181,
286,
262,
4600,
11730,
25896,
63,
379,
262,
23493,
1627,
13,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11730,
15721,
346,
796,
4238,
47,
5757,
15721,
346,
3419,
1303,
262,
2837,
286,
279,
5757,
82,
379,
262,
886,
286,
257,
1627,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11730,
15721,
4487,
796,
17635,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
18747,
286,
1391,
1370,
2949,
11,
923,
55,
11,
886,
55,
92,
60,
532,
477,
1729,
12,
28920,
279,
5757,
15721,
4487,
284,
307,
4504,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7783,
47,
5757,
82,
796,
10352,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
15947,
611,
356,
1441,
4600,
11730,
82,
63,
3417,
2174,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11730,
82,
796,
17635,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
18747,
286,
1391,
1370,
2949,
11,
2124,
11,
5699,
11,
1751,
92,
60,
532,
279,
5757,
5509,
611,
4600,
7783,
47,
5757,
82,
63,
318,
289,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
66,
21471,
55,
796,
6045,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
2124,
2292,
286,
262,
23493,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
66,
21471,
13949,
796,
6045,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
1627,
1271,
286,
262,
23493,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47050,
34,
21471,
55,
796,
6045,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
2124,
2292,
286,
262,
2180,
23493,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47050,
34,
21471,
13949,
796,
6045,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
1627,
1271,
286,
262,
2180,
23493,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
49283,
10434,
13949,
796,
6045,
220,
1303,
685,
41433,
60,
532,
1627,
1271,
286,
262,
1459,
6356,
3599,
966,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
36653,
796,
6045,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
15252,
60,
532,
16855,
1487,
13,
2539,
284,
257,
1487,
2134,
357,
29688,
766,
4600,
35636,
19400,
63,
329,
2134,
4645,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
271,
818,
10669,
796,
6407,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
9217,
611,
356,
389,
3058,
287,
366,
8189,
2272,
1,
357,
1662,
4731,
393,
2912,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
271,
47051,
9269,
796,
10352,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
9217,
611,
262,
1306,
2095,
481,
307,
13537,
357,
68,
13,
70,
13,
4600,
59,
66,
63,
737,
220,
770,
743,
307,
2641,
4731,
2912,
393,
2438,
13,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
271,
47051,
5813,
796,
10352,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
9217,
611,
262,
1459,
2095,
318,
13537,
357,
68,
13,
70,
13,
4600,
59,
66,
63,
737,
220,
770,
743,
307,
2641,
4731,
2912,
393,
2438,
13,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
271,
818,
13290,
796,
10352,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
9217,
611,
356,
389,
3058,
2641,
257,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
271,
818,
21357,
796,
10352,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
9217,
611,
356,
389,
3058,
2641,
257,
2912,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
23893,
55,
796,
6045,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
2124,
2292,
286,
262,
923,
286,
2912,
319,
1459,
1627,
357,
361,
597,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
22708,
35,
2564,
796,
10352,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
9217,
611,
13386,
389,
545,
27753,
2641,
286,
257,
2912,
357,
38537,
516,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
36280,
5497,
298,
796,
10352,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
389,
356,
2045,
329,
262,
33793,
341,
966,
286,
262,
1459,
1627,
30,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
48267,
12441,
796,
10352,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
815,
356,
14267,
262,
7587,
286,
262,
1459,
2095,
30,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
13138,
796,
10352,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
373,
262,
5128,
6105,
39559,
1576,
284,
2251,
257,
4938,
1255,
30,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47172,
23004,
796,
10352,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
815,
356,
1441,
257,
13027,
1255,
618,
281,
4049,
8833,
30,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3174,
45866,
796,
10352,
220,
220,
220,
220,
220,
220,
1303,
685,
2127,
21052,
60,
532,
815,
33793,
4235,
19855,
4605,
279,
5757,
5236,
30,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
9806,
5497,
298,
796,
25064,
13,
9806,
7857,
220,
220,
220,
1303,
685,
41433,
60,
532,
5415,
3142,
33793,
341,
286,
8840,
3951,
287,
350,
5757,
10363,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
521,
298,
42430,
796,
657,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
703,
1290,
33793,
341,
373,
14869,
416,
350,
5757,
10363,
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,
357,
18302,
11184,
3585,
33793,
341,
286,
28376,
14700,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
36280,
28100,
33349,
19485,
796,
6045,
220,
1303,
685,
8841,
60,
532,
33829,
284,
2610,
703,
1969,
356,
389,
284,
262,
717,
12,
853,
7400,
19485,
287,
257,
1351,
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,
1114,
1672,
257,
7400,
19485,
8833,
379,
4600,
5657,
63,
2174,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
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,
220,
220,
220,
220,
220,
220,
220,
4600,
220,
220,
357,
21943,
220,
220,
220,
2318,
63,
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,
220,
220,
220,
220,
220,
220,
220,
220,
3571,
486,
1157,
1065,
1828,
11024,
220,
1279,
438,
1181,
706,
7587,
1149,
357,
268,
5700,
2174,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
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,
220,
220,
220,
220,
220,
220,
220,
657,
220,
220,
6045,
220,
220,
220,
5218,
407,
10342,
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,
220,
220,
220,
220,
220,
220,
220,
352,
220,
220,
705,
13200,
6,
5218,
10342,
329,
1306,
2272,
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,
220,
220,
220,
220,
220,
220,
220,
362,
220,
220,
705,
853,
6,
220,
220,
5218,
10342,
329,
1822,
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,
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,
220,
220,
357,
1135,
2251,
262,
7400,
19485,
618,
262,
1487,
422,
362,
3784,
15,
4325,
2014,
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,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
23893,
796,
705,
26,
6,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
8841,
60,
4277,
284,
5026,
27045,
261,
355,
2912,
2095,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
18224,
796,
1391,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
705,
13138,
6,
318,
10352,
11,
1441,
428,
4049,
284,
262,
2836,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
3672,
10354,
6045,
11,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
8841,
60,
532,
2547,
259,
2232,
338,
3748,
1438,
329,
428,
4049,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
20500,
10354,
6045,
11,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
8841,
60,
532,
4049,
3275,
284,
3359,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1370,
2949,
10354,
6045,
11,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
1627,
1271,
286,
4049,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
87,
10354,
6045,
11,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
41433,
60,
532,
923,
2124,
2292,
286,
4049,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
26086,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
3672,
10354,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1370,
2949,
10354,
6045,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
87,
10354,
6045,
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,
2116,
13,
18224,
21604,
30562,
796,
23884,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
685,
15252,
60,
532,
8739,
4049,
1438,
284,
257,
2785,
4049,
2292,
628,
220,
220,
220,
220,
220,
220,
220,
611,
318,
39098,
7,
25811,
11,
8633,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
66,
21471,
55,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
66,
21471,
55,
796,
3689,
17816,
66,
21471,
55,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11612,
34,
21471,
55,
796,
3689,
17816,
66,
21471,
55,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
66,
21471,
13949,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
66,
21471,
13949,
796,
3689,
17816,
66,
21471,
13949,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11612,
34,
21471,
13949,
796,
3689,
17816,
66,
21471,
13949,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
47050,
34,
21471,
55,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47050,
34,
21471,
55,
796,
3689,
17816,
47050,
34,
21471,
55,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
47050,
34,
21471,
13949,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47050,
34,
21471,
13949,
796,
3689,
17816,
47050,
34,
21471,
13949,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
49283,
10434,
13949,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
49283,
10434,
13949,
796,
3689,
17816,
49283,
10434,
13949,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
36653,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
36653,
796,
6121,
29238,
7,
25811,
17816,
36653,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
47172,
23004,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
47172,
23004,
796,
3689,
17816,
47172,
23004,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
3174,
45866,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
3174,
45866,
796,
3689,
17816,
3174,
45866,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
7783,
47,
5757,
82,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7783,
47,
5757,
82,
796,
3689,
17816,
7783,
47,
5757,
82,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
705,
23893,
6,
287,
3689,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
23893,
796,
3689,
17816,
23893,
20520,
198,
198,
2,
10097,
24305,
198,
2,
33671,
44225,
198,
2,
10097,
24305,
198,
198,
2,
4600,
20274,
13,
18224,
13,
3672,
63,
318,
900,
284,
597,
286,
777,
198,
24908,
62,
10917,
23051,
62,
35,
15567,
1137,
796,
366,
22708,
12,
38537,
1,
198,
24908,
62,
36,
3535,
62,
31098,
8634,
11211,
796,
366,
68,
349,
12,
1891,
6649,
1077,
1,
198,
24908,
62,
4944,
5097,
48751,
62,
10917,
23051,
796,
366,
403,
20225,
12,
22708,
1,
198,
24908,
62,
4944,
5097,
48751,
62,
27082,
1677,
796,
366,
403,
20225,
12,
11730,
1,
198,
24908,
62,
4944,
44,
11417,
1961,
62,
32737,
62,
27082,
1677,
796,
366,
403,
31409,
12,
19836,
12,
11730,
1,
198,
24908,
62,
4944,
44,
11417,
1961,
62,
3185,
1677,
62,
27082,
1677,
796,
366,
403,
31409,
12,
9654,
12,
11730,
1,
198,
24908,
62,
2538,
2885,
2751,
62,
32737,
62,
27082,
1677,
796,
366,
12294,
12,
19836,
12,
11730,
1,
198,
24908,
62,
4944,
39,
6981,
30465,
796,
366,
403,
38788,
1,
198,
198,
18224,
36479,
1095,
796,
23884,
198,
18224,
36479,
1095,
58,
24908,
62,
10917,
23051,
62,
35,
15567,
1137,
60,
796,
366,
23138,
1276,
12974,
2641,
2912,
7021,
526,
198,
18224,
36479,
1095,
58,
24908,
62,
36,
3535,
62,
31098,
8634,
11211,
60,
796,
366,
13949,
2314,
886,
287,
257,
10938,
736,
6649,
1077,
526,
198,
18224,
36479,
1095,
58,
24908,
62,
4944,
5097,
48751,
62,
10917,
23051,
60,
796,
366,
10100,
318,
4814,
257,
9605,
9577,
526,
198,
18224,
36479,
1095,
58,
24908,
62,
4944,
5097,
48751,
62,
27082,
1677,
60,
796,
366,
3118,
20225,
1280,
12,
11730,
526,
198,
18224,
36479,
1095,
58,
24908,
62,
4944,
44,
11417,
1961,
62,
32737,
62,
27082,
1677,
60,
796,
366,
3118,
31409,
1969,
12,
11730,
526,
198,
18224,
36479,
1095,
58,
24908,
62,
4944,
44,
11417,
1961,
62,
3185,
1677,
62,
27082,
1677,
60,
796,
366,
3118,
31409,
1280,
12,
11730,
526,
198,
18224,
36479,
1095,
58,
24908,
62,
2538,
2885,
2751,
62,
32737,
62,
27082,
1677,
60,
796,
366,
13949,
2314,
1085,
351,
257,
1969,
12,
11730,
526,
198,
18224,
36479,
1095,
58,
24908,
62,
4944,
39,
6981,
30465,
60,
796,
366,
3118,
38788,
4049,
526,
198,
198,
2,
10097,
24305,
198,
2,
10903,
16205,
198,
2,
10097,
24305,
198,
198,
361,
32494,
62,
10705,
1137,
4694,
25,
198,
220,
220,
220,
6818,
6330,
22005,
10100,
10786,
46071,
3256,
657,
11,
362,
11,
10148,
8,
6624,
705,
64,
6,
198,
220,
220,
220,
6818,
6330,
22005,
10100,
10786,
46071,
3256,
657,
11,
352,
11,
705,
65,
11537,
6624,
705,
7012,
64,
6,
198,
220,
220,
220,
6818,
6330,
22005,
10100,
10786,
46071,
3256,
657,
11,
362,
11,
705,
65,
11537,
6624,
705,
7012,
6,
198,
198,
2,
10097,
24305,
198,
2,
6910,
16205,
198,
2,
10097,
24305,
198,
198,
2,
611,
262,
1459,
2095,
468,
3421,
11,
4589,
663,
1487,
284,
262,
1459,
1627,
13,
198,
2,
825,
4589,
12441,
7,
20274,
11,
1796,
1925,
2599,
198,
2,
220,
220,
220,
220,
442,
796,
1255,
13,
354,
198,
2,
220,
220,
220,
220,
611,
1796,
1925,
14512,
442,
25,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
6330,
22005,
13949,
7,
20274,
11,
1255,
13,
1370,
2949,
11,
1255,
13,
87,
11,
1255,
13,
87,
1343,
18896,
7,
11612,
1925,
828,
442,
8,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
1255,
13,
521,
298,
42430,
48185,
357,
11925,
7,
11612,
1925,
8,
532,
18896,
7,
354,
4008,
198,
2,
220,
220,
220,
220,
1255,
13,
87,
15853,
18896,
7,
354,
8,
198,
198,
2,
10097,
24305,
198,
2,
29882,
7273,
4487,
198,
2,
10097,
24305,
198,
198,
2,
611,
32494,
62,
10705,
1137,
4694,
25,
198,
2,
220,
220,
220,
220,
6818,
29405,
7,
16,
11,
513,
11,
642,
8,
6624,
513,
198,
2,
220,
220,
220,
220,
6818,
29405,
7,
24,
11,
513,
11,
642,
8,
6624,
642,
198,
2,
220,
220,
220,
220,
6818,
29405,
7,
16,
11,
513,
11,
6045,
8,
6624,
513,
198,
2,
220,
220,
220,
220,
6818,
29405,
7,
20,
11,
513,
11,
6045,
8,
6624,
642,
198,
2,
220,
220,
220,
220,
6818,
29405,
7,
16,
11,
6045,
11,
642,
8,
6624,
352,
198,
2,
220,
220,
220,
220,
6818,
29405,
7,
24,
11,
6045,
11,
642,
8,
6624,
642,
198,
2,
220,
220,
220,
220,
6818,
29405,
7,
16,
11,
6045,
11,
6045,
8,
6624,
352,
198,
198,
361,
32494,
62,
10705,
1137,
4694,
25,
198,
220,
220,
220,
6818,
27185,
7,
17816,
64,
6,
4357,
657,
8,
6624,
705,
64,
6,
198,
220,
220,
220,
6818,
27185,
7,
17816,
64,
6,
4357,
352,
8,
318,
6045,
198,
220,
220,
220,
6818,
27185,
7,
17816,
64,
3256,
705,
65,
3256,
705,
66,
6,
4357,
657,
8,
6624,
705,
66,
6,
198,
220,
220,
220,
6818,
27185,
7,
17816,
64,
3256,
705,
65,
3256,
705,
66,
6,
4357,
352,
8,
6624,
705,
65,
6,
198,
220,
220,
220,
6818,
27185,
7,
17816,
64,
3256,
705,
65,
3256,
705,
66,
6,
4357,
642,
8,
318,
6045,
198,
220,
220,
220,
6818,
27185,
26933,
4357,
657,
8,
318,
6045,
198,
220,
220,
220,
6818,
27185,
26933,
4357,
352,
8,
318,
6045,
198,
198,
2,
10097,
24305,
198,
2,
20396,
546,
3435,
198,
2,
10097,
24305,
198,
198,
2,
825,
318,
1199,
2737,
10223,
7,
20274,
2599,
198,
2,
220,
220,
220,
220,
1441,
407,
1255,
13,
271,
47051,
5813,
290,
1255,
13,
354,
287,
7655,
2043,
1546,
47,
11598,
198,
198,
2,
460,
428,
307,
262,
938,
2438,
2095,
286,
257,
1351,
30,
198,
198,
2,
10097,
24305,
198,
2,
13435,
4560,
319,
3435,
198,
2,
10097,
24305,
198,
198,
2,
10097,
24305,
198,
2,
25659,
1691,
2095,
2995,
198,
2,
10097,
24305,
198,
198,
2,
10097,
24305,
198,
2,
15684,
27965,
198,
2,
10097,
24305,
198,
198,
38019,
62,
26288,
47,
11417,
796,
1391,
198,
220,
220,
220,
29513,
10354,
319,
11505,
47,
5757,
11,
198,
220,
220,
220,
705,
90,
10354,
319,
11505,
47,
5757,
11,
198,
220,
220,
220,
44438,
10354,
319,
11505,
47,
5757,
11,
198,
220,
220,
220,
705,
8,
10354,
319,
26125,
47,
5757,
11,
198,
220,
220,
220,
705,
92,
10354,
319,
26125,
47,
5757,
11,
198,
220,
220,
220,
705,
60,
10354,
319,
26125,
47,
5757,
11,
198,
220,
220,
220,
28767,
8634,
11211,
25,
319,
33,
4595,
17055,
11,
198,
220,
220,
220,
309,
6242,
25,
319,
33349,
11,
198,
220,
220,
220,
12682,
24027,
25,
319,
3791,
1370,
11,
198,
220,
220,
220,
360,
2606,
19146,
62,
10917,
23051,
25,
319,
25178,
11,
198,
92,
198,
198,
2,
10097,
24305,
198,
2,
327,
21471,
825,
82,
198,
2,
10097,
24305,
198,
198,
2,
10097,
24305,
198,
2,
350,
5757,
13069,
825,
82,
198,
2,
10097,
24305,
198,
198,
2,
24413,
3525,
337,
16820,
25,
1249,
262,
23493,
284,
29405,
262,
279,
5757,
8025,
198,
198,
2,
24413,
3525,
337,
16820,
25,
26384,
262,
279,
5757,
8025,
422,
262,
8931,
198,
198,
2,
45559,
3810,
543,
1280,
12,
11730,
357,
361,
597,
8,
319,
262,
279,
5757,
25896,
815,
307,
3177,
198,
2,
262,
1277,
2560,
286,
262,
1459,
1627,
357,
35569,
663,
33793,
341,
966,
737,
198,
2,
770,
3578,
10880,
10363,
284,
29308,
350,
5757,
10363,
338,
4645,
12,
18302,
14344,
198,
2,
4069,
416,
4375,
663,
4600,
404,
877,
13,
521,
298,
42430,
63,
284,
262,
1459,
1627,
338,
33793,
341,
13,
198,
2,
357,
6651,
1276,
307,
2077,
284,
2948,
30806,
33793,
341,
17137,
11,
6496,
2174,
8,
198,
198,
2,
24413,
3525,
337,
16820,
25,
3376,
279,
5757,
8025,
422,
33793,
341,
198,
198,
2,
29463,
1677,
337,
16820,
25,
4781,
9029,
422,
262,
279,
5757,
8025,
198,
198,
2,
29463,
1677,
337,
16820,
25,
24443,
257,
4938,
1969,
12,
11730,
284,
262,
886,
286,
262,
279,
5757,
8025,
198,
198,
2,
10097,
24305,
198,
2,
1423,
298,
341,
825,
82,
198,
2,
10097,
24305,
198,
198,
2,
10097,
24305,
198,
2,
3334,
12,
5715,
7587,
5499,
198,
2,
10097,
24305,
198,
198,
2,
10097,
24305,
198,
2,
5094,
7824,
198,
2,
10097,
24305,
198,
198,
17614,
796,
1391,
198,
220,
220,
220,
705,
9641,
10354,
705,
18,
13,
1065,
13,
15,
3256,
198,
220,
220,
220,
705,
521,
298,
62,
14171,
10354,
33793,
62,
14171,
11,
198,
220,
220,
220,
705,
11730,
62,
14171,
10354,
279,
5757,
62,
14171,
11,
198,
220,
220,
220,
705,
27004,
62,
14171,
10354,
4451,
62,
14171,
198,
92,
198
] | 2.713723 | 5,837 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-24 00:52
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,
13,
1558,
319,
2864,
12,
1065,
12,
1731,
3571,
25,
4309,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
628
] | 2.709091 | 55 |
"""Select platform for Nest Protect."""
from __future__ import annotations
from dataclasses import dataclass
from homeassistant.components.select import SelectEntity, SelectEntityDescription
from homeassistant.helpers.entity import EntityCategory
from . import HomeAssistantNestProtectData
from .const import DOMAIN, LOGGER
from .entity import NestDescriptiveEntity, NestProtectDeviceClass
@dataclass
class NestProtectSelectDescriptionMixin:
"""Define an entity description mixin for select entities."""
options: list[str]
# select_option: Callable[[str, Callable[..., Awaitable[None]]], Awaitable[None]]
@dataclass
class NestProtectSelectDescription(
SelectEntityDescription, NestProtectSelectDescriptionMixin
):
"""Class to describe an Nest Protect sensor."""
BRIGHTNESS_TO_PRESET: dict[str, str] = {1: "low", 2: "medium", 3: "high"}
PRESET_TO_BRIGHTNESS = {v: k for k, v in BRIGHTNESS_TO_PRESET.items()}
SENSOR_DESCRIPTIONS: list[SelectEntityDescription] = [
NestProtectSelectDescription(
key="night_light_brightness",
name="Brightness",
icon="mdi:lightbulb-on",
options=[*PRESET_TO_BRIGHTNESS],
entity_category=EntityCategory.CONFIG,
device_class=NestProtectDeviceClass.NIGHT_LIGHT_BRIGHTNESS,
),
]
async def async_setup_entry(hass, entry, async_add_devices):
"""Set up the Nest Protect sensors from a config entry."""
data: HomeAssistantNestProtectData = hass.data[DOMAIN][entry.entry_id]
entities: list[NestProtectSelect] = []
SUPPORTED_KEYS = {
description.key: description for description in SENSOR_DESCRIPTIONS
}
for device in data.devices.values():
for key in device.value:
if description := SUPPORTED_KEYS.get(key):
entities.append(
NestProtectSelect(device, description, data.areas, data.client)
)
async_add_devices(entities)
class NestProtectSelect(NestDescriptiveEntity, SelectEntity):
"""Representation of a Nest Protect Select."""
entity_description: NestProtectSelectDescription
@property
def current_option(self) -> str:
"""Return the selected entity option to represent the entity state."""
state = self.bucket.value.get(self.entity_description.key)
return BRIGHTNESS_TO_PRESET.get(state)
@property
def options(self) -> list[str]:
"""Return a set of selectable options."""
return self.entity_description.options
async def async_select_option(self, option: str) -> None:
"""Change the selected option."""
select = PRESET_TO_BRIGHTNESS.get(option)
objects = [
{
"object_key": self.bucket.object_key,
"op": "MERGE",
"value": {
self.entity_description.key: select,
},
}
]
if not self.client.nest_session or self.client.nest_session.is_expired():
if not self.client.auth or self.client.auth.is_expired():
await self.client.get_access_token()
await self.client.authenticate(self.client.auth.access_token)
result = await self.client.update_objects(
self.client.nest_session.access_token,
self.client.nest_session.userid,
self.client.transport_url,
objects,
)
LOGGER.debug(result)
| [
37811,
17563,
3859,
329,
21420,
21916,
526,
15931,
198,
6738,
11593,
37443,
834,
1330,
37647,
198,
198,
6738,
4818,
330,
28958,
1330,
4818,
330,
31172,
198,
198,
6738,
1363,
562,
10167,
13,
5589,
3906,
13,
19738,
1330,
9683,
32398,
11,
9683,
32398,
11828,
198,
6738,
1363,
562,
10167,
13,
16794,
364,
13,
26858,
1330,
20885,
27313,
198,
198,
6738,
764,
1330,
5995,
48902,
45,
395,
41426,
6601,
198,
6738,
764,
9979,
1330,
24121,
29833,
11,
41605,
30373,
198,
6738,
764,
26858,
1330,
21420,
24564,
1968,
425,
32398,
11,
21420,
41426,
24728,
9487,
628,
198,
31,
19608,
330,
31172,
198,
4871,
21420,
41426,
17563,
11828,
35608,
259,
25,
198,
220,
220,
220,
37227,
7469,
500,
281,
9312,
6764,
5022,
259,
329,
2922,
12066,
526,
15931,
628,
220,
220,
220,
3689,
25,
1351,
58,
2536,
60,
198,
220,
220,
220,
1303,
2922,
62,
18076,
25,
4889,
540,
30109,
2536,
11,
4889,
540,
58,
986,
11,
5851,
4548,
540,
58,
14202,
11907,
4357,
5851,
4548,
540,
58,
14202,
11907,
628,
198,
31,
19608,
330,
31172,
198,
4871,
21420,
41426,
17563,
11828,
7,
198,
220,
220,
220,
9683,
32398,
11828,
11,
21420,
41426,
17563,
11828,
35608,
259,
198,
2599,
198,
220,
220,
220,
37227,
9487,
284,
6901,
281,
21420,
21916,
12694,
526,
15931,
628,
198,
11473,
9947,
31097,
62,
10468,
62,
48296,
2767,
25,
8633,
58,
2536,
11,
965,
60,
796,
1391,
16,
25,
366,
9319,
1600,
362,
25,
366,
24132,
1600,
513,
25,
366,
8929,
20662,
198,
198,
48296,
2767,
62,
10468,
62,
11473,
9947,
31097,
796,
1391,
85,
25,
479,
329,
479,
11,
410,
287,
11177,
9947,
31097,
62,
10468,
62,
48296,
2767,
13,
23814,
3419,
92,
628,
198,
50,
16938,
1581,
62,
30910,
36584,
51,
11053,
25,
1351,
58,
17563,
32398,
11828,
60,
796,
685,
198,
220,
220,
220,
21420,
41426,
17563,
11828,
7,
198,
220,
220,
220,
220,
220,
220,
220,
1994,
2625,
3847,
62,
2971,
62,
29199,
1108,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
2625,
41267,
1108,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
7196,
2625,
9132,
72,
25,
2971,
15065,
65,
12,
261,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
3689,
41888,
9,
48296,
2767,
62,
10468,
62,
11473,
9947,
31097,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
9312,
62,
22872,
28,
32398,
27313,
13,
10943,
16254,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3335,
62,
4871,
28,
45,
395,
41426,
24728,
9487,
13,
45,
9947,
62,
43,
9947,
62,
11473,
9947,
31097,
11,
198,
220,
220,
220,
10612,
198,
60,
628,
198,
292,
13361,
825,
30351,
62,
40406,
62,
13000,
7,
71,
562,
11,
5726,
11,
30351,
62,
2860,
62,
42034,
2599,
198,
220,
220,
220,
37227,
7248,
510,
262,
21420,
21916,
15736,
422,
257,
4566,
5726,
526,
15931,
628,
220,
220,
220,
1366,
25,
5995,
48902,
45,
395,
41426,
6601,
796,
468,
82,
13,
7890,
58,
39170,
29833,
7131,
13000,
13,
13000,
62,
312,
60,
198,
220,
220,
220,
12066,
25,
1351,
58,
45,
395,
41426,
17563,
60,
796,
17635,
628,
220,
220,
220,
43333,
1961,
62,
7336,
16309,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
6764,
13,
2539,
25,
6764,
329,
6764,
287,
311,
16938,
1581,
62,
30910,
36584,
51,
11053,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
329,
3335,
287,
1366,
13,
42034,
13,
27160,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1994,
287,
3335,
13,
8367,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
6764,
19039,
43333,
1961,
62,
7336,
16309,
13,
1136,
7,
2539,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12066,
13,
33295,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21420,
41426,
17563,
7,
25202,
11,
6764,
11,
1366,
13,
533,
292,
11,
1366,
13,
16366,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
30351,
62,
2860,
62,
42034,
7,
298,
871,
8,
628,
198,
4871,
21420,
41426,
17563,
7,
45,
395,
24564,
1968,
425,
32398,
11,
9683,
32398,
2599,
198,
220,
220,
220,
37227,
40171,
341,
286,
257,
21420,
21916,
9683,
526,
15931,
628,
220,
220,
220,
9312,
62,
11213,
25,
21420,
41426,
17563,
11828,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
1459,
62,
18076,
7,
944,
8,
4613,
965,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
262,
6163,
9312,
3038,
284,
2380,
262,
9312,
1181,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1181,
796,
2116,
13,
27041,
316,
13,
8367,
13,
1136,
7,
944,
13,
26858,
62,
11213,
13,
2539,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
11177,
9947,
31097,
62,
10468,
62,
48296,
2767,
13,
1136,
7,
5219,
8,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
3689,
7,
944,
8,
4613,
1351,
58,
2536,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
257,
900,
286,
2922,
540,
3689,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
26858,
62,
11213,
13,
25811,
628,
220,
220,
220,
30351,
825,
30351,
62,
19738,
62,
18076,
7,
944,
11,
3038,
25,
965,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
19400,
262,
6163,
3038,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2922,
796,
32552,
2767,
62,
10468,
62,
11473,
9947,
31097,
13,
1136,
7,
18076,
8,
628,
220,
220,
220,
220,
220,
220,
220,
5563,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
15252,
62,
2539,
1298,
2116,
13,
27041,
316,
13,
15252,
62,
2539,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
404,
1298,
366,
29296,
8264,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
8367,
1298,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
26858,
62,
11213,
13,
2539,
25,
2922,
11,
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,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
2116,
13,
16366,
13,
77,
395,
62,
29891,
393,
2116,
13,
16366,
13,
77,
395,
62,
29891,
13,
271,
62,
1069,
6474,
33529,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
2116,
13,
16366,
13,
18439,
393,
2116,
13,
16366,
13,
18439,
13,
271,
62,
1069,
6474,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25507,
2116,
13,
16366,
13,
1136,
62,
15526,
62,
30001,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25507,
2116,
13,
16366,
13,
41299,
5344,
7,
944,
13,
16366,
13,
18439,
13,
15526,
62,
30001,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
25507,
2116,
13,
16366,
13,
19119,
62,
48205,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16366,
13,
77,
395,
62,
29891,
13,
15526,
62,
30001,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16366,
13,
77,
395,
62,
29891,
13,
7220,
312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16366,
13,
7645,
634,
62,
6371,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5563,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
41605,
30373,
13,
24442,
7,
20274,
8,
198
] | 2.550111 | 1,347 |
L = [10, 11, 12, 13, 14, 15, 16, 17, 18]
print(L)
L1 = [x for x in L if x % 2 == 0]
print(L1)
ip = '10.20.30.40'
octets = ip.split('.')
print(octets)
octets = [int(octet) for octet in octets]
print(octets)
import random
primesPositions = [p for p in range(100) if isPrime(random.randint(1, 1000))]
print(primesPositions)
#list of 10 matrices
matrices = [Matrix(5, 5, [[random.randint(1, 100) for i in range(5)] for j in range(5)]) for k in range(10)]
#print(matrices)
for matrix in matrices :
print(matrix)
print(matrix.get_order()) | [
43,
796,
685,
940,
11,
1367,
11,
1105,
11,
1511,
11,
1478,
11,
1315,
11,
1467,
11,
1596,
11,
1248,
60,
198,
4798,
7,
43,
8,
198,
198,
43,
16,
796,
685,
87,
329,
2124,
287,
406,
611,
2124,
4064,
362,
6624,
657,
60,
198,
4798,
7,
43,
16,
8,
198,
198,
541,
796,
705,
940,
13,
1238,
13,
1270,
13,
1821,
6,
198,
38441,
1039,
796,
20966,
13,
35312,
10786,
2637,
8,
198,
4798,
7,
38441,
1039,
8,
198,
198,
38441,
1039,
796,
685,
600,
7,
38441,
316,
8,
329,
19318,
316,
287,
19318,
1039,
60,
198,
4798,
7,
38441,
1039,
8,
198,
197,
198,
11748,
4738,
198,
1050,
999,
21604,
1756,
796,
685,
79,
329,
279,
287,
2837,
7,
3064,
8,
611,
318,
26405,
7,
25120,
13,
25192,
600,
7,
16,
11,
8576,
4008,
60,
198,
4798,
7,
1050,
999,
21604,
1756,
8,
198,
197,
197,
198,
2,
4868,
286,
838,
2603,
45977,
198,
6759,
45977,
796,
685,
46912,
7,
20,
11,
642,
11,
16410,
25120,
13,
25192,
600,
7,
16,
11,
1802,
8,
329,
1312,
287,
2837,
7,
20,
15437,
329,
474,
287,
2837,
7,
20,
8,
12962,
329,
479,
287,
2837,
7,
940,
15437,
198,
198,
2,
4798,
7,
6759,
45977,
8,
198,
198,
1640,
17593,
287,
2603,
45977,
1058,
198,
197,
4798,
7,
6759,
8609,
8,
198,
197,
4798,
7,
6759,
8609,
13,
1136,
62,
2875,
28955
] | 2.344828 | 232 |
from tensorflow import keras
from model.model import csnet_extra_model
| [
6738,
11192,
273,
11125,
1330,
41927,
292,
198,
6738,
2746,
13,
19849,
1330,
50115,
3262,
62,
26086,
62,
19849,
198
] | 3.55 | 20 |
import os
import traceback
from ..xjson import XJson
| [
11748,
28686,
201,
198,
11748,
12854,
1891,
201,
198,
6738,
11485,
87,
17752,
1330,
1395,
41,
1559,
201,
198,
201,
198,
201,
198,
201,
198,
201
] | 2.423077 | 26 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-11-25 21:03
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
1157,
13,
2075,
319,
13130,
12,
1157,
12,
1495,
2310,
25,
3070,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
11748,
42625,
14208,
13,
7295,
13,
12102,
2024,
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,
42625,
14208,
13,
26791,
13,
2435,
11340,
628
] | 2.968421 | 95 |
print(join(capitalize("this will be uppercase text")))
print(join(leetspeak("This isn't a leetspeak")))
print(join(hypenate("will be hypenated by letters")))
print(join(hypenate("will be hypenated by words".split())))
# next() and send()
free = psychologist()
print('free->', free)
print('next->', next(free))
print("send->", free.send("I feel bad"))
print("send->", free.send("Why i shouldnt ?"))
print("send ->", free.send("ok then i should find what is good for me"))
| [
198,
198,
4798,
7,
22179,
7,
27544,
1096,
7203,
5661,
481,
307,
334,
39921,
589,
2420,
1,
22305,
198,
4798,
7,
22179,
7,
293,
1039,
36729,
7203,
1212,
2125,
470,
257,
443,
1039,
36729,
1,
22305,
198,
4798,
7,
22179,
7,
12114,
3617,
378,
7203,
10594,
307,
2537,
3617,
515,
416,
7475,
1,
22305,
198,
4798,
7,
22179,
7,
12114,
3617,
378,
7203,
10594,
307,
2537,
3617,
515,
416,
2456,
1911,
35312,
3419,
22305,
198,
198,
2,
1306,
3419,
290,
3758,
3419,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
5787,
796,
23540,
3419,
198,
4798,
10786,
5787,
3784,
3256,
1479,
8,
198,
4798,
10786,
19545,
3784,
3256,
1306,
7,
5787,
4008,
198,
4798,
7203,
21280,
3784,
1600,
1479,
13,
21280,
7203,
40,
1254,
2089,
48774,
198,
4798,
7203,
21280,
3784,
1600,
1479,
13,
21280,
7203,
5195,
1312,
815,
429,
220,
1701,
4008,
198,
4798,
7203,
21280,
4613,
1600,
1479,
13,
21280,
7203,
482,
788,
1312,
815,
1064,
644,
318,
922,
329,
502,
48774,
198
] | 2.837209 | 172 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
import logging
import os
import errno
from .BaseDispatch import BaseDispatch
try:
import matplotlib.pyplot as plt
import numpy as np
IMPORTED = True
except Exception as e:
logging.warning('Failed to import numpy or matplotlib. Are you sure they are properly installed?')
logging.warning('You can ignore this warning if you do not plan to use Matplotlib')
logging.warning(e)
IMPORTED = False
class MatplotlibDispatch(BaseDispatch):
"""Display events via Matplotlib backend. This class requires some heavy dependencies, and so
trying to run it without Matplotlib and Numpy installed will result in pass-thru behavior
Arguments
---------
task_params : dict
Dictionary of the task json specification, including name and ID number
img_folder : string
Folder to save output images to
"""
def train_event(self, event):
"""Plot a basic training and testing curve via Matplotlib
Arguments
---------
event : TrainingEvent.TrainingEvent
Event to add to Matplotlib plot
"""
if IMPORTED:
super().train_event(event)
time = event.attributes[event.time_axis]
for item in event.attributes:
if item != event.time_axis:
val = event.attributes[item]
self._data[item].append([time, val])
# Convert to numpy arrays
np_data = []
mins = {}
maxes = {}
for key in self._data:
if self._data[key]:
data = np.array(self._data[key])
mins[key] = np.min(data, axis=0)[1]
maxes[key] = np.max(data, axis=0)[1]
np_data.append(data[:, 0])
np_data.append(data[:, 1])
plt.clf()
plt.plot(*np_data)
self._legend_keys = []
for k in self._data.keys():
text = "{} (".format(k.title())
if k in maxes:
text += "Max: {:0.4f} ".format(float(maxes[k]))
if k in mins:
text += "Min: {:0.4f}".format(float(mins[k]))
text += ")"
self._legend_keys.append(text)
ax = plt.gca()
box = ax.get_position()
ax.set_position([box.x0, box.y0 + box.height * 0.1,
box.width, box.height*0.9])
plt.legend(self._legend_keys,
bbox_to_anchor=(0.5, -0.05),
loc='upper center',
ncol=2,
borderaxespad=0.)
plt.title(self.task_params['title'])
plt.grid(True, which='both')
plt.draw()
else:
logging.error('Improper requirements, skipping train event')
def train_finish(self):
"""Save our output figure to PNG format, as defined by the save path `img_folder`"""
if IMPORTED:
filename = self.task_params['title'].replace(' ', '_')
save_path = os.path.join(self._img_folder, filename)
logging.info('Finished training! Saving output image to {0}'.format(save_path))
logging.info('\'{}\' Final Extremes: {}'.format(self.task_params['title'], self._legend_keys))
try:
fold = os.path.basename(self._img_folder)
logging.info("Creating folder {}".format(fold))
os.makedirs(fold)
except OSError as e:
if e.errno != errno.EEXIST:
raise
plt.savefig(save_path, bbox_inches='tight', format='png')
plt.close()
else:
logging.error('Improper requirements, skipping train finish')
| [
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
3170,
1040,
1330,
2208,
198,
6738,
2003,
1330,
3210,
62,
32016,
198,
20307,
62,
32016,
13,
17350,
62,
7344,
1386,
3419,
198,
11748,
18931,
198,
11748,
28686,
198,
11748,
11454,
3919,
198,
198,
6738,
764,
14881,
49354,
1330,
7308,
49354,
198,
198,
28311,
25,
198,
220,
220,
220,
1330,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
220,
220,
220,
1330,
299,
32152,
355,
45941,
198,
220,
220,
220,
30023,
9863,
1961,
796,
6407,
198,
16341,
35528,
355,
304,
25,
198,
220,
220,
220,
18931,
13,
43917,
10786,
37,
6255,
284,
1330,
299,
32152,
393,
2603,
29487,
8019,
13,
4231,
345,
1654,
484,
389,
6105,
6589,
8348,
8,
198,
220,
220,
220,
18931,
13,
43917,
10786,
1639,
460,
8856,
428,
6509,
611,
345,
466,
407,
1410,
284,
779,
6550,
29487,
8019,
11537,
198,
220,
220,
220,
18931,
13,
43917,
7,
68,
8,
198,
220,
220,
220,
30023,
9863,
1961,
796,
10352,
628,
198,
4871,
6550,
29487,
8019,
49354,
7,
14881,
49354,
2599,
198,
220,
220,
220,
37227,
23114,
2995,
2884,
6550,
29487,
8019,
30203,
13,
770,
1398,
4433,
617,
4334,
20086,
11,
290,
523,
198,
220,
220,
220,
2111,
284,
1057,
340,
1231,
6550,
29487,
8019,
290,
399,
32152,
6589,
481,
1255,
287,
1208,
12,
400,
622,
4069,
628,
220,
220,
220,
20559,
2886,
198,
220,
220,
220,
45337,
198,
220,
220,
220,
4876,
62,
37266,
1058,
8633,
198,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
262,
4876,
33918,
20855,
11,
1390,
1438,
290,
4522,
1271,
628,
220,
220,
220,
33705,
62,
43551,
1058,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
48107,
284,
3613,
5072,
4263,
284,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
4512,
62,
15596,
7,
944,
11,
1785,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
43328,
257,
4096,
3047,
290,
4856,
12133,
2884,
6550,
29487,
8019,
628,
220,
220,
220,
220,
220,
220,
220,
20559,
2886,
198,
220,
220,
220,
220,
220,
220,
220,
45337,
198,
220,
220,
220,
220,
220,
220,
220,
1785,
1058,
13614,
9237,
13,
44357,
9237,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8558,
284,
751,
284,
6550,
29487,
8019,
7110,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
30023,
9863,
1961,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
27432,
62,
15596,
7,
15596,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
640,
796,
1785,
13,
1078,
7657,
58,
15596,
13,
2435,
62,
22704,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2378,
287,
1785,
13,
1078,
7657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2378,
14512,
1785,
13,
2435,
62,
22704,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1188,
796,
1785,
13,
1078,
7657,
58,
9186,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
7890,
58,
9186,
4083,
33295,
26933,
2435,
11,
1188,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
38240,
284,
299,
32152,
26515,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45941,
62,
7890,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23550,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
274,
796,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1994,
287,
2116,
13557,
7890,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13557,
7890,
58,
2539,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
45941,
13,
18747,
7,
944,
13557,
7890,
58,
2539,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23550,
58,
2539,
60,
796,
45941,
13,
1084,
7,
7890,
11,
16488,
28,
15,
38381,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
274,
58,
2539,
60,
796,
45941,
13,
9806,
7,
7890,
11,
16488,
28,
15,
38381,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45941,
62,
7890,
13,
33295,
7,
7890,
58,
45299,
657,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45941,
62,
7890,
13,
33295,
7,
7890,
58,
45299,
352,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
565,
69,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
29487,
46491,
37659,
62,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
1455,
437,
62,
13083,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
2116,
13557,
7890,
13,
13083,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2420,
796,
45144,
92,
357,
1911,
18982,
7,
74,
13,
7839,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
287,
3509,
274,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2420,
15853,
366,
11518,
25,
46110,
15,
13,
19,
69,
92,
27071,
18982,
7,
22468,
7,
9806,
274,
58,
74,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
287,
23550,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2420,
15853,
366,
9452,
25,
46110,
15,
13,
19,
69,
92,
1911,
18982,
7,
22468,
7,
42951,
58,
74,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2420,
15853,
366,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
1455,
437,
62,
13083,
13,
33295,
7,
5239,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7877,
796,
458,
83,
13,
70,
6888,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3091,
796,
7877,
13,
1136,
62,
9150,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7877,
13,
2617,
62,
9150,
26933,
3524,
13,
87,
15,
11,
3091,
13,
88,
15,
1343,
3091,
13,
17015,
1635,
657,
13,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3091,
13,
10394,
11,
3091,
13,
17015,
9,
15,
13,
24,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
1455,
437,
7,
944,
13557,
1455,
437,
62,
13083,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
3524,
62,
1462,
62,
3702,
273,
16193,
15,
13,
20,
11,
532,
15,
13,
2713,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1179,
11639,
45828,
3641,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
4033,
28,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4865,
897,
9774,
324,
28,
15,
2014,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
7839,
7,
944,
13,
35943,
62,
37266,
17816,
7839,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
25928,
7,
17821,
11,
543,
11639,
16885,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
19334,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
18224,
10786,
23028,
525,
5359,
11,
31017,
4512,
1785,
11537,
628,
220,
220,
220,
825,
4512,
62,
15643,
680,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
16928,
674,
5072,
3785,
284,
36182,
5794,
11,
355,
5447,
416,
262,
3613,
3108,
4600,
9600,
62,
43551,
63,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
611,
30023,
9863,
1961,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29472,
796,
2116,
13,
35943,
62,
37266,
17816,
7839,
6,
4083,
33491,
10786,
46083,
705,
62,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3613,
62,
6978,
796,
28686,
13,
6978,
13,
22179,
7,
944,
13557,
9600,
62,
43551,
11,
29472,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
10786,
18467,
1348,
3047,
0,
34689,
5072,
2939,
284,
1391,
15,
92,
4458,
18982,
7,
21928,
62,
6978,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
10786,
43054,
90,
32239,
6,
8125,
47871,
274,
25,
23884,
4458,
18982,
7,
944,
13,
35943,
62,
37266,
17816,
7839,
6,
4357,
2116,
13557,
1455,
437,
62,
13083,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5591,
796,
28686,
13,
6978,
13,
12093,
12453,
7,
944,
13557,
9600,
62,
43551,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
10951,
7203,
32071,
9483,
23884,
1911,
18982,
7,
11379,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
11379,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
440,
5188,
81,
1472,
355,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
304,
13,
8056,
3919,
14512,
11454,
3919,
13,
36,
6369,
8808,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
21928,
5647,
7,
21928,
62,
6978,
11,
275,
3524,
62,
45457,
11639,
33464,
3256,
5794,
11639,
11134,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
458,
83,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18931,
13,
18224,
10786,
23028,
525,
5359,
11,
31017,
4512,
5461,
11537,
198
] | 2.090535 | 1,944 |
#!/usr/bin/env python
from pyon.net.endpoint import RPCClient
#from interface.services.idatastore_service import IDatastoreService
from interface.services.ihello_service import IHelloService
from pyon.net.messaging import make_node
import gevent
import time
import base64
import os
import argparse
import msgpack
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--datasize', type=int, help='Maximum size of data in bytes')
parser.add_argument('-m', '--msgpack', action='store_true', help='Encode data with msgpack')
parser.set_defaults(datasize=1024*1024, parallel=1)
opts = parser.parse_args()
node,iowat=make_node()
#dsclient = RPCClient(node=node, name="datastore", iface=IDatastoreService)
hsclient = RPCClient(node=node, name="hello", iface=IHelloService)
node.client.add_backpressure_callback(notif)
node.client.set_backpressure_multiplier(2)
# make data (bytes)
DATA_SIZE = opts.datasize
# base64 encoding wastes a lot of space, truncate it at the exact data size we requested
data = base64.urlsafe_b64encode(os.urandom(DATA_SIZE))[:DATA_SIZE]
if opts.msgpack:
data = msgpack.dumps(data)
counter = 0
st = 0
#_gt = gevent.spawn(tick)
results = {}
for size in [1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144]:
_gl = gevent.spawn(work, size)
try:
rs = _gl.get(timeout=10)
except gevent.Timeout:
print "10s elapsed, cutting it"
rs = time.time() - st
results[size] = { "elapsed": rs, "count": counter, "ps":counter/rs }
print "Size:", size, str(results[size])
import pprint
pprint.pprint(results)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
6738,
12972,
261,
13,
3262,
13,
437,
4122,
1330,
39400,
11792,
198,
2,
6738,
7071,
13,
30416,
13,
312,
265,
459,
382,
62,
15271,
1330,
4522,
265,
459,
382,
16177,
198,
6738,
7071,
13,
30416,
13,
72,
31373,
62,
15271,
1330,
314,
15496,
16177,
198,
6738,
12972,
261,
13,
3262,
13,
37348,
3039,
1330,
787,
62,
17440,
198,
11748,
4903,
1151,
198,
11748,
640,
198,
11748,
2779,
2414,
198,
11748,
28686,
198,
11748,
1822,
29572,
198,
11748,
31456,
8002,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
67,
3256,
705,
438,
19608,
292,
1096,
3256,
2099,
28,
600,
11,
1037,
11639,
40541,
2546,
286,
1366,
287,
9881,
11537,
198,
48610,
13,
2860,
62,
49140,
10786,
12,
76,
3256,
705,
438,
19662,
8002,
3256,
2223,
11639,
8095,
62,
7942,
3256,
1037,
11639,
4834,
8189,
1366,
351,
31456,
8002,
11537,
198,
48610,
13,
2617,
62,
12286,
82,
7,
19608,
292,
1096,
28,
35500,
9,
35500,
11,
10730,
28,
16,
8,
198,
404,
912,
796,
30751,
13,
29572,
62,
22046,
3419,
628,
198,
17440,
11,
72,
322,
265,
28,
15883,
62,
17440,
3419,
198,
2,
9310,
16366,
796,
39400,
11792,
7,
17440,
28,
17440,
11,
1438,
2625,
19608,
459,
382,
1600,
611,
558,
28,
2389,
265,
459,
382,
16177,
8,
198,
11994,
16366,
796,
39400,
11792,
7,
17440,
28,
17440,
11,
1438,
2625,
31373,
1600,
611,
558,
28,
40,
15496,
16177,
8,
198,
198,
17440,
13,
16366,
13,
2860,
62,
1891,
36151,
62,
47423,
7,
1662,
361,
8,
198,
17440,
13,
16366,
13,
2617,
62,
1891,
36151,
62,
47945,
959,
7,
17,
8,
198,
198,
2,
787,
1366,
357,
33661,
8,
198,
26947,
62,
33489,
796,
2172,
82,
13,
19608,
292,
1096,
198,
2,
2779,
2414,
21004,
43739,
257,
1256,
286,
2272,
11,
40122,
378,
340,
379,
262,
2748,
1366,
2546,
356,
9167,
198,
7890,
796,
2779,
2414,
13,
6371,
21230,
62,
65,
2414,
268,
8189,
7,
418,
13,
333,
3749,
7,
26947,
62,
33489,
4008,
58,
25,
26947,
62,
33489,
60,
198,
361,
2172,
82,
13,
19662,
8002,
25,
198,
220,
220,
220,
1366,
796,
31456,
8002,
13,
67,
8142,
7,
7890,
8,
198,
198,
24588,
796,
657,
198,
301,
796,
657,
198,
198,
2,
62,
13655,
796,
4903,
1151,
13,
48183,
7,
42298,
8,
198,
198,
43420,
796,
23884,
198,
198,
1640,
2546,
287,
685,
35500,
11,
36117,
11,
42479,
11,
807,
17477,
11,
1467,
22842,
11,
36203,
3104,
11,
45021,
2623,
11,
1511,
940,
4761,
11,
35404,
18444,
5974,
198,
220,
220,
220,
4808,
4743,
796,
4903,
1151,
13,
48183,
7,
1818,
11,
2546,
8,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
44608,
796,
4808,
4743,
13,
1136,
7,
48678,
28,
940,
8,
198,
220,
220,
220,
2845,
4903,
1151,
13,
48031,
25,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
366,
940,
82,
42118,
11,
7720,
340,
1,
198,
220,
220,
220,
220,
220,
220,
220,
44608,
796,
640,
13,
2435,
3419,
532,
336,
198,
220,
220,
220,
2482,
58,
7857,
60,
796,
1391,
366,
417,
28361,
1298,
44608,
11,
366,
9127,
1298,
3753,
11,
366,
862,
1298,
24588,
14,
3808,
1782,
198,
220,
220,
220,
3601,
366,
10699,
25,
1600,
2546,
11,
965,
7,
43420,
58,
7857,
12962,
220,
198,
198,
11748,
279,
4798,
198,
381,
22272,
13,
381,
22272,
7,
43420,
8,
628
] | 2.758261 | 575 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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.
#
# ------------------------------------------------------------------------------
"""Gym connector and gym channel."""
import logging
import queue
import threading
from queue import Queue
from threading import Thread
from typing import Dict, Optional, cast
import gym
from aea.configurations.base import ConnectionConfig
from aea.connections.base import Channel, Connection
from aea.helpers.base import locate
from aea.mail.base import Envelope
from gym_protocol.message import GymMessage
from gym_protocol.serialization import GymSerializer
logger = logging.getLogger(__name__)
"""default 'to' field for Gym envelopes."""
DEFAULT_GYM = "gym"
class GymChannel(Channel):
"""A wrapper of the gym environment."""
def __init__(self, public_key: str, gym_env: gym.Env):
"""Initialize a gym channel."""
self.public_key = public_key
self.gym_env = gym_env
self._lock = threading.Lock()
self._queues = {} # type: Dict[str, Queue]
def connect(self) -> Optional[Queue]:
"""
Connect a public key to the gym.
:return: an asynchronous queue, that constitutes the communication channel.
"""
if self.public_key in self._queues:
return None
assert len(self._queues.keys()) == 0, "Only one public key can register to a gym."
q = Queue() # type: Queue
self._queues[self.public_key] = q
return q
def send(self, envelope: Envelope) -> None:
"""
Process the envelopes to the gym.
:return: None
"""
sender = envelope.sender
logger.debug("Processing message from {}: {}".format(sender, envelope))
self._decode_envelope(envelope)
def _decode_envelope(self, envelope: Envelope) -> None:
"""
Decode the envelope.
:param envelope: the envelope
:return: None
"""
if envelope.protocol_id == "gym":
self.handle_gym_message(envelope)
else:
raise ValueError('This protocol is not valid for gym.')
def handle_gym_message(self, envelope: Envelope) -> None:
"""
Forward a message to gym.
:param envelope: the envelope
:return: None
"""
gym_message = GymSerializer().decode(envelope.message)
performative = gym_message.get("performative")
if GymMessage.Performative(performative) == GymMessage.Performative.ACT:
action = gym_message.get("action")
step_id = gym_message.get("step_id")
observation, reward, done, info = self.gym_env.step(action) # type: ignore
msg = GymMessage(performative=GymMessage.Performative.PERCEPT, observation=observation, reward=reward, done=done, info=info, step_id=step_id)
msg_bytes = GymSerializer().encode(msg)
envelope = Envelope(to=envelope.sender, sender=DEFAULT_GYM, protocol_id=GymMessage.protocol_id, message=msg_bytes)
self._send(envelope)
elif GymMessage.Performative(performative) == GymMessage.Performative.RESET:
self.gym_env.reset() # type: ignore
elif GymMessage.Performative(performative) == GymMessage.Performative.CLOSE:
self.gym_env.close() # type: ignore
def _send(self, envelope: Envelope) -> None:
"""Send a message.
:param envelope: the envelope
:return: None
"""
destination = envelope.to
self._queues[destination].put_nowait(envelope)
def disconnect(self) -> None:
"""
Disconnect.
:return: None
"""
with self._lock:
self._queues.pop(self.public_key, None)
class GymConnection(Connection):
"""Proxy to the functionality of the gym."""
def __init__(self, public_key: str, gym_env: gym.Env):
"""
Initialize a connection to a local gym environment.
:param public_key: the public key used in the protocols.
:param gym: the gym environment.
"""
super().__init__()
self.public_key = public_key
self.channel = GymChannel(public_key, gym_env)
self._connection = None # type: Optional[Queue]
self._stopped = True
self.in_thread = None # type: Optional[Thread]
self.out_thread = None # type: Optional[Thread]
def _fetch(self) -> None:
"""
Fetch the envelopes from the outqueue and send them.
:return: None
"""
while not self._stopped:
try:
envelope = self.out_queue.get(block=True, timeout=2.0)
self.send(envelope)
except queue.Empty:
pass
def _receive_loop(self) -> None:
"""
Receive messages.
:return: None
"""
assert self._connection is not None, "Call connect before calling _receive_loop."
while not self._stopped:
try:
data = self._connection.get(timeout=2.0)
self.in_queue.put_nowait(data)
except queue.Empty:
pass
@property
def is_established(self) -> bool:
"""Return True if the connection has been established, False otherwise."""
return self._connection is not None
def connect(self) -> None:
"""
Connect to the gym.
:return: None
"""
if self._stopped:
self._stopped = False
self._connection = self.channel.connect()
self.in_thread = Thread(target=self._receive_loop)
self.out_thread = Thread(target=self._fetch)
self.in_thread.start()
self.out_thread.start()
def disconnect(self) -> None:
"""
Disconnect from the gym.
:return: None
"""
assert self.in_thread is not None, "Call connect before disconnect."
assert self.out_thread is not None, "Call connect before disconnect."
if not self._stopped:
self._stopped = True
self.in_thread.join()
self.out_thread.join()
self.in_thread = None
self.out_thread = None
self.channel.disconnect()
self.stop()
def send(self, envelope: Envelope) -> None:
"""
Send an envelope.
:param envelope: the envelop
:return: None
"""
if not self.is_established:
raise ConnectionError("Connection not established yet. Please use 'connect()'.")
self.channel.send(envelope)
def stop(self) -> None:
"""
Tear down the connection.
:return: None
"""
self._connection = None
@classmethod
def from_config(cls, public_key: str, connection_configuration: ConnectionConfig) -> 'Connection':
"""
Get the Gym connection from the connection configuration.
:param public_key: the public key of the agent.
:param connection_configuration: the connection configuration object.
:return: the connection object
"""
gym_env_package = cast(str, connection_configuration.config.get('env'))
gym_env = locate(gym_env_package)
return GymConnection(public_key, gym_env())
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
2,
16529,
26171,
198,
2,
198,
2,
220,
220,
15069,
2864,
12,
23344,
376,
7569,
13,
20185,
15302,
198,
2,
198,
2,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
220,
220,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
220,
220,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
220,
220,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
220,
220,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
220,
220,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
220,
220,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
220,
220,
11247,
739,
262,
13789,
13,
198,
2,
198,
2,
16529,
26171,
198,
198,
37811,
38,
4948,
21716,
290,
11550,
6518,
526,
15931,
198,
11748,
18931,
198,
11748,
16834,
198,
11748,
4704,
278,
198,
6738,
16834,
1330,
4670,
518,
198,
6738,
4704,
278,
1330,
14122,
198,
6738,
19720,
1330,
360,
713,
11,
32233,
11,
3350,
198,
198,
11748,
11550,
198,
198,
6738,
257,
18213,
13,
11250,
20074,
13,
8692,
1330,
26923,
16934,
198,
6738,
257,
18213,
13,
8443,
507,
13,
8692,
1330,
11102,
11,
26923,
198,
6738,
257,
18213,
13,
16794,
364,
13,
8692,
1330,
17276,
198,
6738,
257,
18213,
13,
4529,
13,
8692,
1330,
2039,
1091,
68,
198,
6738,
11550,
62,
11235,
4668,
13,
20500,
1330,
31187,
12837,
198,
6738,
11550,
62,
11235,
4668,
13,
46911,
1634,
1330,
31187,
32634,
7509,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
37811,
12286,
705,
1462,
6,
2214,
329,
31187,
16441,
274,
526,
15931,
198,
7206,
38865,
62,
31212,
44,
796,
366,
1360,
76,
1,
628,
198,
4871,
31187,
29239,
7,
29239,
2599,
198,
220,
220,
220,
37227,
32,
29908,
286,
262,
11550,
2858,
526,
15931,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
1171,
62,
2539,
25,
965,
11,
11550,
62,
24330,
25,
11550,
13,
4834,
85,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
24243,
1096,
257,
11550,
6518,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11377,
62,
2539,
796,
1171,
62,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1360,
76,
62,
24330,
796,
11550,
62,
24330,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
5354,
796,
4704,
278,
13,
25392,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
4188,
947,
796,
23884,
220,
1303,
2099,
25,
360,
713,
58,
2536,
11,
4670,
518,
60,
628,
220,
220,
220,
825,
2018,
7,
944,
8,
4613,
32233,
58,
34991,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8113,
257,
1171,
1994,
284,
262,
11550,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
281,
39354,
16834,
11,
326,
19300,
262,
6946,
6518,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13,
11377,
62,
2539,
287,
2116,
13557,
4188,
947,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
6045,
628,
220,
220,
220,
220,
220,
220,
220,
6818,
18896,
7,
944,
13557,
4188,
947,
13,
13083,
28955,
6624,
657,
11,
366,
10049,
530,
1171,
1994,
460,
7881,
284,
257,
11550,
526,
198,
220,
220,
220,
220,
220,
220,
220,
10662,
796,
4670,
518,
3419,
220,
1303,
2099,
25,
4670,
518,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
4188,
947,
58,
944,
13,
11377,
62,
2539,
60,
796,
10662,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
10662,
628,
220,
220,
220,
825,
3758,
7,
944,
11,
22878,
25,
2039,
1091,
68,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10854,
262,
16441,
274,
284,
262,
11550,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
29788,
796,
22878,
13,
82,
2194,
198,
220,
220,
220,
220,
220,
220,
220,
49706,
13,
24442,
7203,
18709,
278,
3275,
422,
23884,
25,
23884,
1911,
18982,
7,
82,
2194,
11,
22878,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
12501,
1098,
62,
268,
1091,
68,
7,
268,
1091,
68,
8,
628,
220,
220,
220,
825,
4808,
12501,
1098,
62,
268,
1091,
68,
7,
944,
11,
22878,
25,
2039,
1091,
68,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4280,
1098,
262,
22878,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
22878,
25,
262,
22878,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
22878,
13,
11235,
4668,
62,
312,
6624,
366,
1360,
76,
1298,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
28144,
62,
1360,
76,
62,
20500,
7,
268,
1091,
68,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
11052,
12331,
10786,
1212,
8435,
318,
407,
4938,
329,
11550,
2637,
8,
628,
220,
220,
220,
825,
5412,
62,
1360,
76,
62,
20500,
7,
944,
11,
22878,
25,
2039,
1091,
68,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
19530,
257,
3275,
284,
11550,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
22878,
25,
262,
22878,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
11550,
62,
20500,
796,
31187,
32634,
7509,
22446,
12501,
1098,
7,
268,
1091,
68,
13,
20500,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1620,
876,
796,
11550,
62,
20500,
13,
1136,
7203,
525,
687,
876,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
611,
31187,
12837,
13,
5990,
687,
876,
7,
525,
687,
876,
8,
6624,
31187,
12837,
13,
5990,
687,
876,
13,
10659,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2223,
796,
11550,
62,
20500,
13,
1136,
7203,
2673,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2239,
62,
312,
796,
11550,
62,
20500,
13,
1136,
7203,
9662,
62,
312,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13432,
11,
6721,
11,
1760,
11,
7508,
796,
2116,
13,
1360,
76,
62,
24330,
13,
9662,
7,
2673,
8,
220,
1303,
2099,
25,
8856,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
796,
31187,
12837,
7,
525,
687,
876,
28,
38,
4948,
12837,
13,
5990,
687,
876,
13,
18973,
42006,
11,
13432,
28,
672,
3168,
341,
11,
6721,
28,
260,
904,
11,
1760,
28,
28060,
11,
7508,
28,
10951,
11,
2239,
62,
312,
28,
9662,
62,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
62,
33661,
796,
31187,
32634,
7509,
22446,
268,
8189,
7,
19662,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22878,
796,
2039,
1091,
68,
7,
1462,
28,
268,
1091,
68,
13,
82,
2194,
11,
29788,
28,
7206,
38865,
62,
31212,
44,
11,
8435,
62,
312,
28,
38,
4948,
12837,
13,
11235,
4668,
62,
312,
11,
3275,
28,
19662,
62,
33661,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
21280,
7,
268,
1091,
68,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
31187,
12837,
13,
5990,
687,
876,
7,
525,
687,
876,
8,
6624,
31187,
12837,
13,
5990,
687,
876,
13,
19535,
2767,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1360,
76,
62,
24330,
13,
42503,
3419,
220,
1303,
2099,
25,
8856,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
361,
31187,
12837,
13,
5990,
687,
876,
7,
525,
687,
876,
8,
6624,
31187,
12837,
13,
5990,
687,
876,
13,
32737,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
1360,
76,
62,
24330,
13,
19836,
3419,
220,
1303,
2099,
25,
8856,
628,
220,
220,
220,
825,
4808,
21280,
7,
944,
11,
22878,
25,
2039,
1091,
68,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
25206,
257,
3275,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
22878,
25,
262,
22878,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10965,
796,
22878,
13,
1462,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
4188,
947,
58,
16520,
1883,
4083,
1996,
62,
2197,
4548,
7,
268,
1091,
68,
8,
628,
220,
220,
220,
825,
22837,
7,
944,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3167,
8443,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
351,
2116,
13557,
5354,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
4188,
947,
13,
12924,
7,
944,
13,
11377,
62,
2539,
11,
6045,
8,
628,
198,
4871,
31187,
32048,
7,
32048,
2599,
198,
220,
220,
220,
37227,
44148,
284,
262,
11244,
286,
262,
11550,
526,
15931,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
1171,
62,
2539,
25,
965,
11,
11550,
62,
24330,
25,
11550,
13,
4834,
85,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
20768,
1096,
257,
4637,
284,
257,
1957,
11550,
2858,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1171,
62,
2539,
25,
262,
1171,
1994,
973,
287,
262,
19565,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
11550,
25,
262,
11550,
2858,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
22446,
834,
15003,
834,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11377,
62,
2539,
796,
1171,
62,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
17620,
796,
31187,
29239,
7,
11377,
62,
2539,
11,
11550,
62,
24330,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
38659,
796,
6045,
220,
1303,
2099,
25,
32233,
58,
34991,
60,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
301,
38333,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
259,
62,
16663,
796,
6045,
220,
1303,
2099,
25,
32233,
58,
16818,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
448,
62,
16663,
796,
6045,
220,
1303,
2099,
25,
32233,
58,
16818,
60,
628,
220,
220,
220,
825,
4808,
69,
7569,
7,
944,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
376,
7569,
262,
16441,
274,
422,
262,
503,
36560,
290,
3758,
606,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
981,
407,
2116,
13557,
301,
38333,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22878,
796,
2116,
13,
448,
62,
36560,
13,
1136,
7,
9967,
28,
17821,
11,
26827,
28,
17,
13,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21280,
7,
268,
1091,
68,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
16834,
13,
40613,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1208,
628,
220,
220,
220,
825,
4808,
260,
15164,
62,
26268,
7,
944,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
797,
15164,
6218,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
2116,
13557,
38659,
318,
407,
6045,
11,
366,
14134,
2018,
878,
4585,
4808,
260,
15164,
62,
26268,
526,
198,
220,
220,
220,
220,
220,
220,
220,
981,
407,
2116,
13557,
301,
38333,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
2116,
13557,
38659,
13,
1136,
7,
48678,
28,
17,
13,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
259,
62,
36560,
13,
1996,
62,
2197,
4548,
7,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
16834,
13,
40613,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1208,
628,
220,
220,
220,
2488,
26745,
198,
220,
220,
220,
825,
318,
62,
27718,
7,
944,
8,
4613,
20512,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
13615,
6407,
611,
262,
4637,
468,
587,
4920,
11,
10352,
4306,
526,
15931,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13557,
38659,
318,
407,
6045,
628,
220,
220,
220,
825,
2018,
7,
944,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
8113,
284,
262,
11550,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2116,
13557,
301,
38333,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
301,
38333,
796,
10352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
38659,
796,
2116,
13,
17620,
13,
8443,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
259,
62,
16663,
796,
14122,
7,
16793,
28,
944,
13557,
260,
15164,
62,
26268,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
448,
62,
16663,
796,
14122,
7,
16793,
28,
944,
13557,
69,
7569,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
259,
62,
16663,
13,
9688,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
448,
62,
16663,
13,
9688,
3419,
628,
220,
220,
220,
825,
22837,
7,
944,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3167,
8443,
422,
262,
11550,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
2116,
13,
259,
62,
16663,
318,
407,
6045,
11,
366,
14134,
2018,
878,
22837,
526,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
2116,
13,
448,
62,
16663,
318,
407,
6045,
11,
366,
14134,
2018,
878,
22837,
526,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
2116,
13557,
301,
38333,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
301,
38333,
796,
6407,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
259,
62,
16663,
13,
22179,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
448,
62,
16663,
13,
22179,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
259,
62,
16663,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
448,
62,
16663,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
17620,
13,
6381,
8443,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
11338,
3419,
628,
220,
220,
220,
825,
3758,
7,
944,
11,
22878,
25,
2039,
1091,
68,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
16290,
281,
22878,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
22878,
25,
262,
16441,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
2116,
13,
271,
62,
27718,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
26923,
12331,
7203,
32048,
407,
4920,
1865,
13,
4222,
779,
705,
8443,
3419,
6,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
17620,
13,
21280,
7,
268,
1091,
68,
8,
628,
220,
220,
220,
825,
2245,
7,
944,
8,
4613,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
309,
451,
866,
262,
4637,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
38659,
796,
6045,
628,
220,
220,
220,
2488,
4871,
24396,
198,
220,
220,
220,
825,
422,
62,
11250,
7,
565,
82,
11,
1171,
62,
2539,
25,
965,
11,
4637,
62,
11250,
3924,
25,
26923,
16934,
8,
4613,
705,
32048,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
3497,
262,
31187,
4637,
422,
262,
4637,
8398,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
1171,
62,
2539,
25,
262,
1171,
1994,
286,
262,
5797,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
17143,
4637,
62,
11250,
3924,
25,
262,
4637,
8398,
2134,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
7783,
25,
262,
4637,
2134,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
11550,
62,
24330,
62,
26495,
796,
3350,
7,
2536,
11,
4637,
62,
11250,
3924,
13,
11250,
13,
1136,
10786,
24330,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
11550,
62,
24330,
796,
17276,
7,
1360,
76,
62,
24330,
62,
26495,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
31187,
32048,
7,
11377,
62,
2539,
11,
11550,
62,
24330,
28955,
198
] | 2.446802 | 3,252 |
#!/usr/bin/env python3
import argparse
from augur.utils import read_tree, read_node_data, read_metadata
from collections import Counter
import csv
import hashlib
MAX_HASH_LENGTH = 7
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Find polytomies in a given tree that all belong to the same metadata group",
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("--tree", required=True, help="Newick tree")
parser.add_argument("--metadata", required=True, help="metadata")
parser.add_argument("--mutations", required=True, help="mutations node data JSON")
parser.add_argument("--attribute-name", default="cluster_id", help="name of attribute to store in output JSON")
parser.add_argument("--group-by", default="division", help="identify polytomies where all tips are in the same group")
parser.add_argument("--min-tips", type=int, default=3, help="minimum tips per polytomy to be consider as a cluster")
parser.add_argument("--output", required=True, help="tab-delimited file with strain, cluster id, and group value for each strain")
args = parser.parse_args()
tree = read_tree(args.tree)
tree.collapse_all(lambda c: c.branch_length < 1e-5)
metadata, columns = read_metadata(args.metadata)
muts = read_node_data(args.mutations)
attribute_name = args.attribute_name
group_by = args.group_by
polytomies = []
for node in tree.find_clades(terminal=False):
if node == tree.root:
continue
count_by_group = Counter()
polytomy_sequence_id = None
for child in node.clades:
if child.is_terminal() and child.name:
child_muts_data = muts["nodes"].get(child.name, {})
any_muts = (len(child_muts_data.get("muts", [])) > 0)
if not any_muts:
count_by_group[metadata[child.name][group_by]] += 1
if polytomy_sequence_id is None and "sequence" in child_muts_data:
polytomy_sequence_id = hashlib.sha256(child_muts_data["sequence"].encode()).hexdigest()[:MAX_HASH_LENGTH]
if any(count >= args.min_tips for count in count_by_group.values()):
polytomies.append({"node": node, "name": polytomy_sequence_id})
with open(args.output, "w") as oh:
writer = csv.DictWriter(
oh,
fieldnames=(
"strain",
args.attribute_name,
group_by
),
delimiter="\t",
lineterminator="\n"
)
writer.writeheader()
clusters = 0
for polytomy_data in polytomies:
polytomy = polytomy_data["node"]
polytomy_sequence_id = polytomy_data["name"]
if polytomy.name:
writer.writerow({
"strain": polytomy.name,
args.attribute_name: polytomy_sequence_id,
group_by: metadata[polytomy.name][group_by]
})
for child in polytomy.clades:
if child.is_terminal():
writer.writerow({
"strain": child.name,
args.attribute_name: polytomy_sequence_id,
group_by: metadata[child.name][group_by]
})
clusters += 1
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
1822,
29572,
198,
6738,
16339,
333,
13,
26791,
1330,
1100,
62,
21048,
11,
1100,
62,
17440,
62,
7890,
11,
1100,
62,
38993,
198,
6738,
17268,
1330,
15034,
198,
11748,
269,
21370,
198,
11748,
12234,
8019,
198,
198,
22921,
62,
39,
11211,
62,
43,
49494,
796,
767,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
198,
220,
220,
220,
220,
220,
220,
220,
6764,
2625,
16742,
7514,
39532,
444,
287,
257,
1813,
5509,
326,
477,
5594,
284,
262,
976,
20150,
1448,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
1296,
1436,
62,
4871,
28,
853,
29572,
13,
28100,
1713,
7469,
13185,
22087,
8479,
1436,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
21048,
1600,
2672,
28,
17821,
11,
1037,
2625,
3791,
624,
5509,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
38993,
1600,
2672,
28,
17821,
11,
1037,
2625,
38993,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
21973,
602,
1600,
2672,
28,
17821,
11,
1037,
2625,
21973,
602,
10139,
1366,
19449,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
42348,
12,
3672,
1600,
4277,
2625,
565,
5819,
62,
312,
1600,
1037,
2625,
3672,
286,
11688,
284,
3650,
287,
5072,
19449,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
8094,
12,
1525,
1600,
4277,
2625,
21426,
1600,
1037,
2625,
738,
1958,
7514,
39532,
444,
810,
477,
9040,
389,
287,
262,
976,
1448,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
1084,
12,
41315,
1600,
2099,
28,
600,
11,
4277,
28,
18,
11,
1037,
2625,
39504,
9040,
583,
7514,
83,
9145,
284,
307,
2074,
355,
257,
13946,
4943,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
7203,
438,
22915,
1600,
2672,
28,
17821,
11,
1037,
2625,
8658,
12,
12381,
320,
863,
2393,
351,
14022,
11,
13946,
4686,
11,
290,
1448,
1988,
329,
1123,
14022,
4943,
628,
220,
220,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
3419,
628,
220,
220,
220,
5509,
796,
1100,
62,
21048,
7,
22046,
13,
21048,
8,
198,
220,
220,
220,
5509,
13,
26000,
7512,
62,
439,
7,
50033,
269,
25,
269,
13,
1671,
3702,
62,
13664,
1279,
352,
68,
12,
20,
8,
628,
220,
220,
220,
20150,
11,
15180,
796,
1100,
62,
38993,
7,
22046,
13,
38993,
8,
198,
220,
220,
220,
4517,
82,
796,
1100,
62,
17440,
62,
7890,
7,
22046,
13,
21973,
602,
8,
198,
220,
220,
220,
11688,
62,
3672,
796,
26498,
13,
42348,
62,
3672,
198,
220,
220,
220,
1448,
62,
1525,
796,
26498,
13,
8094,
62,
1525,
628,
220,
220,
220,
7514,
39532,
444,
796,
17635,
198,
220,
220,
220,
329,
10139,
287,
5509,
13,
19796,
62,
565,
2367,
7,
23705,
282,
28,
25101,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
10139,
6624,
5509,
13,
15763,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
954,
62,
1525,
62,
8094,
796,
15034,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
7514,
83,
9145,
62,
43167,
62,
312,
796,
6045,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1200,
287,
10139,
13,
565,
2367,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1200,
13,
271,
62,
23705,
282,
3419,
290,
1200,
13,
3672,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1200,
62,
76,
5500,
62,
7890,
796,
4517,
82,
14692,
77,
4147,
1,
4083,
1136,
7,
9410,
13,
3672,
11,
23884,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
597,
62,
76,
5500,
796,
357,
11925,
7,
9410,
62,
76,
5500,
62,
7890,
13,
1136,
7203,
76,
5500,
1600,
17635,
4008,
1875,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
597,
62,
76,
5500,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
954,
62,
1525,
62,
8094,
58,
38993,
58,
9410,
13,
3672,
7131,
8094,
62,
1525,
11907,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
7514,
83,
9145,
62,
43167,
62,
312,
318,
6045,
290,
366,
43167,
1,
287,
1200,
62,
76,
5500,
62,
7890,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7514,
83,
9145,
62,
43167,
62,
312,
796,
12234,
8019,
13,
26270,
11645,
7,
9410,
62,
76,
5500,
62,
7890,
14692,
43167,
1,
4083,
268,
8189,
3419,
737,
33095,
12894,
395,
3419,
58,
25,
22921,
62,
39,
11211,
62,
43,
49494,
60,
628,
220,
220,
220,
220,
220,
220,
220,
611,
597,
7,
9127,
18189,
26498,
13,
1084,
62,
41315,
329,
954,
287,
954,
62,
1525,
62,
8094,
13,
27160,
3419,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7514,
39532,
444,
13,
33295,
7,
4895,
17440,
1298,
10139,
11,
366,
3672,
1298,
7514,
83,
9145,
62,
43167,
62,
312,
30072,
628,
220,
220,
220,
351,
1280,
7,
22046,
13,
22915,
11,
366,
86,
4943,
355,
11752,
25,
198,
220,
220,
220,
220,
220,
220,
220,
6260,
796,
269,
21370,
13,
35,
713,
34379,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11752,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2214,
14933,
16193,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2536,
391,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
42348,
62,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1448,
62,
1525,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
46728,
2676,
2625,
59,
83,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
13221,
1352,
2625,
59,
77,
1,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
6260,
13,
13564,
25677,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
23163,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
329,
7514,
83,
9145,
62,
7890,
287,
7514,
39532,
444,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7514,
83,
9145,
796,
7514,
83,
9145,
62,
7890,
14692,
17440,
8973,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7514,
83,
9145,
62,
43167,
62,
312,
796,
7514,
83,
9145,
62,
7890,
14692,
3672,
8973,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
7514,
83,
9145,
13,
3672,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6260,
13,
16002,
322,
15090,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2536,
391,
1298,
7514,
83,
9145,
13,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
42348,
62,
3672,
25,
7514,
83,
9145,
62,
43167,
62,
312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1448,
62,
1525,
25,
20150,
58,
35428,
83,
9145,
13,
3672,
7131,
8094,
62,
1525,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32092,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1200,
287,
7514,
83,
9145,
13,
565,
2367,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1200,
13,
271,
62,
23705,
282,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6260,
13,
16002,
322,
15090,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2536,
391,
1298,
1200,
13,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
13,
42348,
62,
3672,
25,
7514,
83,
9145,
62,
43167,
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,
1448,
62,
1525,
25,
20150,
58,
9410,
13,
3672,
7131,
8094,
62,
1525,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32092,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23163,
15853,
352,
198
] | 2.187661 | 1,556 |
from .base import *
ALLOWED_HOSTS = [
"*"
]
SECRET_KEY = os.environ.get("SECERT_KEY", "dummykey")
DATABASE_NAME = os.environ.get("DATABASE_NAME", "newstream")
DATABASE_USER = os.environ.get("DATABASE_USER", "newstream")
DATABASE_HOST = os.environ.get("DATABASE_HOST", "")
DATABASE_PORT = os.environ.get("DATABASE_PORT", "")
DATABASE_PASSWORD = os.environ.get("DATABASE_PASSWORD", "")
DEBUG = int(os.environ.get("NEWSTREAM_DEBUG", "0"))
EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
EMAIL_HOST = 'mailhog'
EMAIL_PORT = '1025'
DEFAULT_FROM_EMAIL = '[email protected]'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': DATABASE_NAME,
'USER': DATABASE_USER,
'HOST': DATABASE_HOST,
'PORT': DATABASE_PORT,
'PASSWORD': DATABASE_PASSWORD,
}
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
'format': '[DJANGO] %(levelname)s %(asctime)s %(module)s '
'%(name)s.%(funcName)s:%(lineno)s: %(message)s'
},
},
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'default',
}
},
'loggers': {
'*': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
}
},
}
try:
from .local import *
except ImportError:
pass
| [
6738,
764,
8692,
1330,
1635,
198,
198,
7036,
3913,
1961,
62,
39,
10892,
50,
796,
685,
198,
220,
220,
220,
366,
9,
1,
198,
60,
198,
198,
23683,
26087,
62,
20373,
796,
28686,
13,
268,
2268,
13,
1136,
7203,
23683,
17395,
62,
20373,
1600,
366,
67,
13513,
2539,
4943,
198,
35,
1404,
6242,
11159,
62,
20608,
796,
28686,
13,
268,
2268,
13,
1136,
7203,
35,
1404,
6242,
11159,
62,
20608,
1600,
366,
3605,
5532,
4943,
198,
35,
1404,
6242,
11159,
62,
29904,
796,
28686,
13,
268,
2268,
13,
1136,
7203,
35,
1404,
6242,
11159,
62,
29904,
1600,
366,
3605,
5532,
4943,
198,
35,
1404,
6242,
11159,
62,
39,
10892,
796,
28686,
13,
268,
2268,
13,
1136,
7203,
35,
1404,
6242,
11159,
62,
39,
10892,
1600,
366,
4943,
198,
35,
1404,
6242,
11159,
62,
15490,
796,
28686,
13,
268,
2268,
13,
1136,
7203,
35,
1404,
6242,
11159,
62,
15490,
1600,
366,
4943,
198,
35,
1404,
6242,
11159,
62,
47924,
54,
12532,
796,
28686,
13,
268,
2268,
13,
1136,
7203,
35,
1404,
6242,
11159,
62,
47924,
54,
12532,
1600,
366,
4943,
198,
30531,
796,
493,
7,
418,
13,
268,
2268,
13,
1136,
7203,
13965,
2257,
32235,
62,
30531,
1600,
366,
15,
48774,
198,
198,
27630,
4146,
62,
31098,
10619,
796,
705,
28241,
14208,
62,
5796,
34788,
62,
45163,
13,
5432,
2538,
4529,
7282,
437,
6,
198,
27630,
4146,
62,
39,
10892,
796,
705,
4529,
31897,
6,
198,
27630,
4146,
62,
15490,
796,
705,
940,
1495,
6,
198,
198,
7206,
38865,
62,
10913,
2662,
62,
27630,
4146,
796,
705,
3605,
5532,
31,
26069,
35587,
13,
952,
6,
198,
198,
35,
1404,
6242,
1921,
1546,
796,
1391,
198,
220,
220,
220,
705,
12286,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
26808,
8881,
10354,
705,
28241,
14208,
13,
9945,
13,
1891,
2412,
13,
7353,
34239,
13976,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
20608,
10354,
360,
1404,
6242,
11159,
62,
20608,
11,
198,
220,
220,
220,
220,
220,
220,
220,
705,
29904,
10354,
360,
1404,
6242,
11159,
62,
29904,
11,
198,
220,
220,
220,
220,
220,
220,
220,
705,
39,
10892,
10354,
360,
1404,
6242,
11159,
62,
39,
10892,
11,
198,
220,
220,
220,
220,
220,
220,
220,
705,
15490,
10354,
360,
1404,
6242,
11159,
62,
15490,
11,
198,
220,
220,
220,
220,
220,
220,
220,
705,
47924,
54,
12532,
10354,
360,
1404,
6242,
11159,
62,
47924,
54,
12532,
11,
198,
220,
220,
220,
1782,
198,
92,
198,
198,
25294,
38,
2751,
796,
1391,
198,
220,
220,
220,
705,
9641,
10354,
352,
11,
198,
220,
220,
220,
705,
40223,
62,
25687,
62,
6404,
5355,
10354,
10352,
11,
198,
220,
220,
220,
705,
18982,
1010,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
12286,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
18982,
10354,
44438,
35028,
1565,
11230,
60,
4064,
7,
5715,
3672,
8,
82,
4064,
7,
292,
310,
524,
8,
82,
4064,
7,
21412,
8,
82,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4,
7,
3672,
8,
82,
13,
4,
7,
20786,
5376,
8,
82,
25,
4,
7,
2815,
23397,
8,
82,
25,
4064,
7,
20500,
8,
82,
6,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
4993,
8116,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
41947,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
5715,
10354,
705,
10778,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4871,
10354,
705,
6404,
2667,
13,
12124,
25060,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
687,
1436,
10354,
705,
12286,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
6404,
5355,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
9,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4993,
8116,
10354,
37250,
41947,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
5715,
10354,
705,
10778,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
22930,
37861,
10354,
6407,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
8964,
198,
92,
198,
198,
28311,
25,
198,
220,
220,
220,
422,
764,
12001,
1330,
1635,
198,
16341,
17267,
12331,
25,
198,
220,
220,
220,
1208,
628,
198
] | 1.919897 | 774 |
from flask import Blueprint, g, render_template, redirect, url_for, g, flash
from flask_security import current_user, login_required, current_user
from app import db
bp = Blueprint('settings', __name__)
#@bp.before_app_request
#def before_request():
# g.search_form = SearchForm()
@bp.route('/index', methods=['GET', 'POST'])
@bp.route('/', methods=['GET', 'POST'])
@login_required
| [
6738,
42903,
1330,
39932,
11,
308,
11,
8543,
62,
28243,
11,
18941,
11,
19016,
62,
1640,
11,
308,
11,
7644,
198,
6738,
42903,
62,
12961,
1330,
1459,
62,
7220,
11,
17594,
62,
35827,
11,
1459,
62,
7220,
198,
6738,
598,
1330,
20613,
198,
198,
46583,
796,
39932,
10786,
33692,
3256,
11593,
3672,
834,
8,
198,
198,
2,
31,
46583,
13,
19052,
62,
1324,
62,
25927,
198,
2,
4299,
878,
62,
25927,
33529,
198,
2,
220,
220,
220,
308,
13,
12947,
62,
687,
796,
11140,
8479,
3419,
198,
198,
31,
46583,
13,
38629,
10786,
14,
9630,
3256,
5050,
28,
17816,
18851,
3256,
705,
32782,
6,
12962,
198,
31,
46583,
13,
38629,
10786,
14,
3256,
5050,
28,
17816,
18851,
3256,
705,
32782,
6,
12962,
198,
31,
38235,
62,
35827,
198
] | 3.03125 | 128 |
import datetime
from flask import Flask
from flask_jwt_extended import JWTManager
from flask_signon.utils import import_string
| [
11748,
4818,
8079,
198,
6738,
42903,
1330,
46947,
198,
6738,
42903,
62,
73,
46569,
62,
2302,
1631,
1330,
449,
39386,
13511,
198,
198,
6738,
42903,
62,
12683,
261,
13,
26791,
1330,
1330,
62,
8841,
628
] | 3.685714 | 35 |
from xml.etree import ElementTree
from datetime import datetime
from typing import Any
from os import path
import re
| [
6738,
35555,
13,
316,
631,
1330,
11703,
27660,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
19720,
1330,
4377,
198,
6738,
28686,
1330,
3108,
198,
11748,
302,
628,
628,
628
] | 3.935484 | 31 |
# a = int(input())
# b = int(input())
# if a < b:
# print('a')
# else:
# print('b')
# password = input('enter password:')
# check_password = input('confirm password:')
# if password == check_password and len(password) >=8:
# print('Succesful')
# else:
# if len(password)>= 8:
# print('password dont match')
# else:
# print('password too short')
# x = int(input())
# y = int(input())
# if x > 0:
# if y > 0:
# print(1)
# else:
# print(4)
# else:
# if y > 0:
# print(2)
# else:
# print(3)
# number1 = int(input())
# if number1 > 0:
# print(1)
# elif number1 == 0:
# print(0)
# else:
# print(-1)
# a = int(input())
# b = int(input())
# c = int(input())
# if a >= b and a >= c:
# print('a')
# elif b >= a and b >= c:
# print('b')
# else:
# print('steps = int
# steps = int(input('enter steps:'))
# point = int(input('enter screen points:'))
# print(steps % point)
# x = float(input())
# print(x - int(x))
# string1 = 'nnnnn n word nnnnnnnnn nn'
# ban_word = 'word'
# if ban_word in string1:
# del string1
# else:
# print('OK')
# s = 500
# distance = int(input())
# if distance <= s:
# print('yes')
# else:
# print('no')
| [
2,
257,
796,
493,
7,
15414,
28955,
198,
2,
275,
796,
493,
7,
15414,
28955,
198,
2,
611,
257,
1279,
275,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
64,
11537,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
65,
11537,
628,
198,
2,
9206,
796,
5128,
10786,
9255,
9206,
25,
11537,
198,
2,
2198,
62,
28712,
796,
5128,
10786,
10414,
2533,
9206,
25,
11537,
198,
2,
611,
9206,
6624,
2198,
62,
28712,
290,
18896,
7,
28712,
8,
18189,
23,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
5606,
535,
274,
913,
11537,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
611,
18896,
7,
28712,
8,
29,
28,
807,
25,
198,
2,
220,
220,
220,
220,
220,
3601,
10786,
28712,
17666,
2872,
11537,
198,
2,
220,
220,
220,
220,
2073,
25,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10786,
28712,
1165,
1790,
11537,
628,
198,
198,
2,
2124,
796,
493,
7,
15414,
28955,
198,
2,
331,
796,
493,
7,
15414,
28955,
198,
2,
611,
2124,
1875,
657,
25,
198,
2,
220,
220,
220,
220,
611,
331,
1875,
657,
25,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
16,
8,
198,
2,
220,
220,
220,
220,
2073,
25,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
19,
8,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
611,
331,
1875,
657,
25,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
17,
8,
198,
2,
220,
220,
220,
220,
2073,
25,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
18,
8,
628,
198,
2,
1271,
16,
796,
493,
7,
15414,
28955,
198,
2,
611,
1271,
16,
1875,
657,
25,
198,
2,
220,
220,
220,
220,
3601,
7,
16,
8,
198,
2,
1288,
361,
1271,
16,
6624,
657,
25,
198,
2,
220,
220,
220,
220,
3601,
7,
15,
8,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
3601,
32590,
16,
8,
628,
198,
198,
2,
257,
796,
493,
7,
15414,
28955,
198,
2,
275,
796,
493,
7,
15414,
28955,
198,
2,
269,
796,
493,
7,
15414,
28955,
198,
2,
611,
257,
18189,
275,
290,
257,
18189,
269,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
64,
11537,
198,
2,
1288,
361,
275,
18189,
257,
290,
275,
18189,
269,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
65,
11537,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
20214,
796,
493,
628,
198,
198,
2,
4831,
796,
493,
7,
15414,
10786,
9255,
4831,
32105,
4008,
198,
2,
966,
796,
493,
7,
15414,
10786,
9255,
3159,
2173,
32105,
4008,
198,
2,
3601,
7,
20214,
4064,
966,
8,
628,
198,
2,
2124,
796,
12178,
7,
15414,
28955,
198,
2,
3601,
7,
87,
532,
493,
7,
87,
4008,
628,
198,
198,
2,
4731,
16,
796,
705,
20471,
20471,
77,
299,
1573,
299,
20471,
20471,
20471,
20471,
299,
77,
6,
198,
2,
3958,
62,
4775,
796,
705,
4775,
6,
198,
2,
611,
3958,
62,
4775,
287,
4731,
16,
25,
198,
2,
220,
220,
220,
220,
1619,
4731,
16,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
11380,
11537,
628,
628,
198,
2,
264,
796,
5323,
198,
2,
5253,
796,
493,
7,
15414,
28955,
198,
2,
611,
5253,
19841,
264,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
8505,
11537,
198,
2,
2073,
25,
198,
2,
220,
220,
220,
220,
3601,
10786,
3919,
11537,
628,
628,
628,
628,
628,
198
] | 2.143581 | 592 |
import unittest
import json
from app import create_app, db, session
from tests.api.v1 import BaseTestCase
class AuthTestCase(BaseTestCase):
"""Test case for the authentication blueprint."""
def test_user_login(self):
"""Test registered user can login. (POST request)"""
#first register a user
self.client().post('/auth/register',
data=json.dumps(self.user_data),
content_type='application/json'
)
#try to login using registration credentials
login_res = self.client().post('/auth/login',
data=json.dumps(self.user_data),
content_type='application/json'
)
# get the results in json format
result = json.loads(login_res.data.decode())
# Test that the response contains success message
self.assertEqual(result['message'], "You logged in successfully.")
# Assert that the status code returned is equal to 200
self.assertEqual(login_res.status_code, 200)
# Assert that the result has an access token
self.assertTrue(result['access_token'])
def test_login_when_email_used(self):
"""Test registered user can login with email address used for username. (POST request)"""
#first register a user
self.client().post('/auth/register',
data=json.dumps(self.user_data),
content_type='application/json'
)
#try to login using registration credentials
login_res = self.client().post('/auth/login',
data=json.dumps({'username':'[email protected]', 'password':'okello'}),
content_type='application/json'
)
# get the results in json format
result = json.loads(login_res.data.decode())
# Test that the response contains success message
self.assertEqual(result['message'], "You logged in successfully.")
# Assert that the status code returned is equal to 200
self.assertEqual(login_res.status_code, 200)
# Assert that the result has an access token
self.assertTrue(result['access_token'])
def test_login_empty_json(self):
"Test user login rejects when data supplied is not json (POST request)"
#make a request to the register endpoint
res = self.client().post('/auth/login',
data=json.dumps({})
)
# get the results returned in json format
result = json.loads(res.data.decode())
# assert that the request contains a success message and
# a 201 status code
self.assertEqual(result['message'],
"Please supply json data")
self.assertEqual(res.status_code, 400)
def test_login_no_username_key(self):
"Test user login rejects when no username key supplied (POST request)"
#make a request to the login endpoint
res = self.client().post('/auth/login',
data=json.dumps({"":""}),
content_type='application/json'
)
# get the results returned in json format
result = json.loads(res.data.decode())
# assert that the request contains a success message and
# a 201 status code
self.assertEqual(result['message'],
"Please supply a 'username'")
self.assertEqual(res.status_code, 400)
def test_login_no_passwd_key(self):
"Test user login rejects when no password key supplied (POST request)"
#register a user
self._register_user()
#make a request to the login endpoint
res = self.client().post('/auth/login',
data=json.dumps({"username":"roger"}),
content_type='application/json'
)
# get the results returned in json format
result = json.loads(res.data.decode())
# assert that the request contains a success message and
# a 201 status code
self.assertEqual(result['message'],
"Please supply a 'password'")
self.assertEqual(res.status_code, 400)
def test_login_invalid_username(self):
"Test user login rejects invalid username supplied (POST request)"
#register a user
self._register_user()
#make a request to the register endpoint
res = self.client().post('/auth/login',
data=json.dumps({"username":"",
"password":""
}),
content_type='application/json'
)
# get the results returned in json format
result = json.loads(res.data.decode())
# assert that the request contains a success message and
# a 401 status code
self.assertEqual(result['message'],
"Invalid username or password, Please try again")
self.assertEqual(res.status_code, 401)
def test_login_non_txt_for_values(self):
"Test user login rejects non text supplied for values (POST request)"
#register a user
self._register_user()
#make a request to the register endpoint
res = self.client().post('/auth/login',
data=json.dumps({"username":12,
"password":2334
}),
content_type='application/json'
)
# get the results returned in json format
result = json.loads(res.data.decode())
# assert that the request contains a success message and
# a 401 status code
self.assertEqual(result['message'],
"Invalid values supplied, Please try again with text values")
self.assertEqual(res.status_code, 401)
def test_login_username_as_no(self):
"Test user login rejects username supplied as a number (POST request)"
#register a user
self._register_user()
#make a request to the register endpoint using a number username
res = self.client().post('/auth/login',
data=json.dumps({"username":123,
"password":""
}),
content_type='application/json'
)
# get the results returned in json format
result = json.loads(res.data.decode())
# assert that the request contains a success message and
# a 401 status code
self.assertEqual(result['message'],
"Invalid values supplied, Please try again with text values")
self.assertEqual(res.status_code, 401) | [
11748,
555,
715,
395,
198,
11748,
33918,
198,
6738,
598,
1330,
2251,
62,
1324,
11,
20613,
11,
6246,
198,
6738,
5254,
13,
15042,
13,
85,
16,
1330,
7308,
14402,
20448,
198,
198,
4871,
26828,
14402,
20448,
7,
14881,
14402,
20448,
2599,
198,
220,
220,
220,
37227,
14402,
1339,
329,
262,
18239,
30881,
526,
15931,
198,
220,
220,
220,
220,
198,
220,
220,
220,
825,
1332,
62,
7220,
62,
38235,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
14402,
6823,
2836,
460,
17594,
13,
357,
32782,
2581,
8,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
11085,
7881,
257,
2836,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
30238,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
944,
13,
7220,
62,
7890,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
28311,
284,
17594,
1262,
9352,
18031,
198,
220,
220,
220,
220,
220,
220,
220,
17594,
62,
411,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
944,
13,
7220,
62,
7890,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
38235,
62,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6208,
326,
262,
2882,
4909,
1943,
3275,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
6,
4357,
366,
1639,
18832,
287,
7675,
19570,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2195,
861,
326,
262,
3722,
2438,
4504,
318,
4961,
284,
939,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
38235,
62,
411,
13,
13376,
62,
8189,
11,
939,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2195,
861,
326,
262,
1255,
468,
281,
1895,
11241,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
17821,
7,
20274,
17816,
15526,
62,
30001,
6,
12962,
628,
220,
220,
220,
825,
1332,
62,
38235,
62,
12518,
62,
12888,
62,
1484,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
14402,
6823,
2836,
460,
17594,
351,
3053,
2209,
973,
329,
20579,
13,
357,
32782,
2581,
8,
37811,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
11085,
7881,
257,
2836,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
30238,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
944,
13,
7220,
62,
7890,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
28311,
284,
17594,
1262,
9352,
18031,
198,
220,
220,
220,
220,
220,
220,
220,
17594,
62,
411,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
15090,
6,
29460,
10354,
6,
305,
1362,
2088,
18798,
31,
14816,
13,
785,
3256,
705,
28712,
10354,
6,
2088,
18798,
6,
92,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
38235,
62,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6208,
326,
262,
2882,
4909,
1943,
3275,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
6,
4357,
366,
1639,
18832,
287,
7675,
19570,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2195,
861,
326,
262,
3722,
2438,
4504,
318,
4961,
284,
939,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
38235,
62,
411,
13,
13376,
62,
8189,
11,
939,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2195,
861,
326,
262,
1255,
468,
281,
1895,
11241,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
17821,
7,
20274,
17816,
15526,
62,
30001,
6,
12962,
628,
220,
220,
220,
825,
1332,
62,
38235,
62,
28920,
62,
17752,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
2836,
17594,
28317,
618,
1366,
14275,
318,
407,
33918,
357,
32782,
2581,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
15883,
257,
2581,
284,
262,
7881,
36123,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
15090,
30072,
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,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
4504,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6818,
326,
262,
2581,
4909,
257,
1943,
3275,
290,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
257,
580,
3722,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
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,
366,
5492,
5127,
33918,
1366,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
411,
13,
13376,
62,
8189,
11,
7337,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
825,
1332,
62,
38235,
62,
3919,
62,
29460,
62,
2539,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
2836,
17594,
28317,
618,
645,
20579,
1994,
14275,
357,
32782,
2581,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
15883,
257,
2581,
284,
262,
17594,
36123,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
4895,
2404,
20662,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
4504,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6818,
326,
262,
2581,
4909,
257,
1943,
3275,
290,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
257,
580,
3722,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
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,
366,
5492,
5127,
257,
705,
29460,
6,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
411,
13,
13376,
62,
8189,
11,
7337,
8,
628,
220,
220,
220,
825,
1332,
62,
38235,
62,
3919,
62,
6603,
16993,
62,
2539,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
2836,
17594,
28317,
618,
645,
9206,
1994,
14275,
357,
32782,
2581,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
30238,
257,
2836,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
30238,
62,
7220,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
15883,
257,
2581,
284,
262,
17594,
36123,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
4895,
29460,
2404,
305,
1362,
20662,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
4504,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6818,
326,
262,
2581,
4909,
257,
1943,
3275,
290,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
257,
580,
3722,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
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,
366,
5492,
5127,
257,
705,
28712,
6,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
411,
13,
13376,
62,
8189,
11,
7337,
8,
628,
220,
220,
220,
825,
1332,
62,
38235,
62,
259,
12102,
62,
29460,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
2836,
17594,
28317,
12515,
20579,
14275,
357,
32782,
2581,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
30238,
257,
2836,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
30238,
62,
7220,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
15883,
257,
2581,
284,
262,
7881,
36123,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
4895,
29460,
2404,
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,
366,
28712,
2404,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
4504,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6818,
326,
262,
2581,
4909,
257,
1943,
3275,
290,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
257,
22219,
3722,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
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,
366,
44651,
20579,
393,
9206,
11,
4222,
1949,
757,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
411,
13,
13376,
62,
8189,
11,
22219,
8,
628,
220,
220,
220,
825,
1332,
62,
38235,
62,
13159,
62,
14116,
62,
1640,
62,
27160,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
2836,
17594,
28317,
1729,
2420,
14275,
329,
3815,
357,
32782,
2581,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
30238,
257,
2836,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
30238,
62,
7220,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
15883,
257,
2581,
284,
262,
7881,
36123,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
4895,
29460,
1298,
1065,
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,
366,
28712,
1298,
1954,
2682,
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,
1782,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
4504,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6818,
326,
262,
2581,
4909,
257,
1943,
3275,
290,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
257,
22219,
3722,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
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,
366,
44651,
3815,
14275,
11,
4222,
1949,
757,
351,
2420,
3815,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
411,
13,
13376,
62,
8189,
11,
22219,
8,
628,
220,
220,
220,
825,
1332,
62,
38235,
62,
29460,
62,
292,
62,
3919,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
2836,
17594,
28317,
20579,
14275,
355,
257,
1271,
357,
32782,
2581,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
30238,
257,
2836,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13557,
30238,
62,
7220,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
15883,
257,
2581,
284,
262,
7881,
36123,
1262,
257,
1271,
20579,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
2116,
13,
16366,
22446,
7353,
10786,
14,
18439,
14,
38235,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
28,
17752,
13,
67,
8142,
7,
4895,
29460,
1298,
10163,
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,
366,
28712,
2404,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
11639,
31438,
14,
17752,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
651,
262,
2482,
4504,
287,
33918,
5794,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
33918,
13,
46030,
7,
411,
13,
7890,
13,
12501,
1098,
28955,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6818,
326,
262,
2581,
4909,
257,
1943,
3275,
290,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
257,
22219,
3722,
2438,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
20274,
17816,
20500,
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,
366,
44651,
3815,
14275,
11,
4222,
1949,
757,
351,
2420,
3815,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
30493,
36,
13255,
7,
411,
13,
13376,
62,
8189,
11,
22219,
8
] | 2.081911 | 3,516 |
from flask import Blueprint, render_template
from sys import version
from flask import Flask, jsonify
from pathogen_memo.controllers import getallquery
#Set word_count_site_name
indexv = Blueprint('indexv', __name__)
@indexv.route('/')
| [
6738,
42903,
1330,
39932,
11,
8543,
62,
28243,
198,
6738,
25064,
1330,
2196,
198,
6738,
42903,
1330,
46947,
11,
33918,
1958,
628,
198,
198,
6738,
3108,
6644,
62,
11883,
78,
13,
3642,
36667,
1330,
651,
439,
22766,
628,
198,
2,
7248,
1573,
62,
9127,
62,
15654,
62,
3672,
198,
9630,
85,
796,
39932,
10786,
9630,
85,
3256,
11593,
3672,
834,
8,
198,
198,
31,
9630,
85,
13,
38629,
10786,
14,
11537,
198
] | 3.361111 | 72 |
#!/usr/bin/env python
"""
fasta_unwrap: hard-wrapped fastas unwrapped (sequence is just 1 line)
Usage:
fasta_unwrap <fasta> | [-]
fasta_unwrap -h | --help
fasta_unwrap --version
Options:
<fasta> Fasta file name ('-' if from STDIN).
-h --help Show this screen.
--version Show version.
Description:
Simply unwrap a hard-wrapped fasta file
"""
from docopt import docopt
if __name__ == '__main__':
args = docopt(__doc__, version='0.1')
import sys
import fileinput
import re
# fixing broken pipe error
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE,SIG_DFL)
# IO error
if args['<fasta>'] is None:
sys.stderr.write('Provide fasta via arg or STDIN')
sys.stderr.write(__doc__)
sys.exit()
if args['<fasta>'] == '-':
inf = sys.stdin
else:
inf = open(args['<fasta>'], 'r')
# parsing fasta
line_cnt = 0
for line in inf:
line_cnt += 1
if line.startswith('>'):
if line_cnt > 1:
print ''
sys.stdout.write(line)
else:
sys.stdout.write(line.rstrip())
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
37811,
198,
7217,
64,
62,
403,
37150,
25,
1327,
12,
29988,
1496,
3049,
292,
7379,
430,
1496,
357,
43167,
318,
655,
352,
1627,
8,
198,
198,
28350,
25,
198,
220,
3049,
64,
62,
403,
37150,
1279,
7217,
64,
29,
930,
25915,
60,
198,
220,
3049,
64,
62,
403,
37150,
532,
71,
930,
1377,
16794,
198,
220,
3049,
64,
62,
403,
37150,
1377,
9641,
198,
198,
29046,
25,
198,
220,
1279,
7217,
64,
29,
220,
220,
220,
220,
220,
220,
12549,
64,
2393,
1438,
19203,
19355,
611,
422,
48571,
1268,
737,
198,
220,
532,
71,
1377,
16794,
220,
220,
220,
220,
5438,
428,
3159,
13,
198,
220,
1377,
9641,
220,
220,
220,
220,
5438,
2196,
13,
198,
198,
11828,
25,
198,
220,
17973,
7379,
2416,
257,
1327,
12,
29988,
1496,
3049,
64,
2393,
198,
37811,
198,
198,
6738,
2205,
8738,
1330,
2205,
8738,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
26498,
796,
2205,
8738,
7,
834,
15390,
834,
11,
2196,
11639,
15,
13,
16,
11537,
198,
198,
11748,
25064,
198,
11748,
2393,
15414,
198,
11748,
302,
198,
198,
2,
18682,
5445,
12656,
4049,
198,
6738,
6737,
1330,
6737,
11,
33993,
47,
4061,
36,
11,
33993,
62,
35,
3697,
198,
12683,
282,
7,
50,
3528,
47,
4061,
36,
11,
50,
3528,
62,
35,
3697,
8,
220,
198,
198,
2,
24418,
4049,
198,
361,
26498,
17816,
27,
7217,
64,
29,
20520,
318,
6045,
25,
198,
220,
220,
220,
25064,
13,
301,
1082,
81,
13,
13564,
10786,
15946,
485,
3049,
64,
2884,
1822,
393,
48571,
1268,
11537,
198,
220,
220,
220,
25064,
13,
301,
1082,
81,
13,
13564,
7,
834,
15390,
834,
8,
198,
220,
220,
220,
25064,
13,
37023,
3419,
628,
198,
361,
26498,
17816,
27,
7217,
64,
29,
20520,
6624,
705,
12,
10354,
198,
220,
220,
220,
1167,
796,
25064,
13,
19282,
259,
198,
17772,
25,
220,
198,
220,
220,
220,
1167,
796,
1280,
7,
22046,
17816,
27,
7217,
64,
29,
6,
4357,
705,
81,
11537,
628,
198,
2,
32096,
3049,
64,
198,
1370,
62,
66,
429,
796,
657,
198,
1640,
1627,
287,
1167,
25,
198,
220,
220,
220,
1627,
62,
66,
429,
15853,
352,
198,
220,
220,
220,
611,
1627,
13,
9688,
2032,
342,
10786,
29,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1627,
62,
66,
429,
1875,
352,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
10148,
198,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
19282,
448,
13,
13564,
7,
1370,
8,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
25064,
13,
19282,
448,
13,
13564,
7,
1370,
13,
81,
36311,
28955,
198
] | 2.306522 | 460 |
# client.py
import socket
import sys
import json
host = sys.argv[1]
port = int(sys.argv[2])
question = sys.argv[3]
userid = sys.argv[4]
max_size = 1024
if len(sys.argv) == 6:
max_size = sys.argv[5]
payload = {"question": question, "userid": userid}
json_data = json.dumps(payload)
# create a socket object
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connection to hostname on the port.
s.connect((host, port))
s.send(json_data.encode('utf-8'))
# Receive no more than 1024 bytes
received = s.recv(max_size)
s.close()
json_data = json.loads(received.decode('utf-8'))
print("Answer: %s" % json_data['answer'])
| [
2,
5456,
13,
9078,
198,
11748,
17802,
198,
11748,
25064,
198,
11748,
33918,
198,
198,
4774,
796,
25064,
13,
853,
85,
58,
16,
60,
198,
634,
796,
493,
7,
17597,
13,
853,
85,
58,
17,
12962,
198,
25652,
796,
25064,
13,
853,
85,
58,
18,
60,
198,
7220,
312,
796,
25064,
13,
853,
85,
58,
19,
60,
198,
9806,
62,
7857,
796,
28119,
198,
361,
18896,
7,
17597,
13,
853,
85,
8,
6624,
718,
25,
198,
220,
220,
220,
3509,
62,
7857,
796,
25064,
13,
853,
85,
58,
20,
60,
198,
198,
15577,
2220,
796,
19779,
25652,
1298,
1808,
11,
366,
7220,
312,
1298,
2836,
312,
92,
198,
17752,
62,
7890,
796,
33918,
13,
67,
8142,
7,
15577,
2220,
8,
198,
198,
2,
2251,
257,
17802,
2134,
198,
82,
796,
17802,
13,
44971,
7,
44971,
13,
8579,
62,
1268,
2767,
11,
17802,
13,
50,
11290,
62,
2257,
32235,
8,
198,
198,
2,
4637,
284,
2583,
3672,
319,
262,
2493,
13,
198,
82,
13,
8443,
19510,
4774,
11,
2493,
4008,
198,
198,
82,
13,
21280,
7,
17752,
62,
7890,
13,
268,
8189,
10786,
40477,
12,
23,
6,
4008,
198,
198,
2,
797,
15164,
645,
517,
621,
28119,
9881,
198,
47844,
796,
264,
13,
8344,
85,
7,
9806,
62,
7857,
8,
198,
198,
82,
13,
19836,
3419,
198,
198,
17752,
62,
7890,
796,
33918,
13,
46030,
7,
47844,
13,
12501,
1098,
10786,
40477,
12,
23,
6,
4008,
198,
198,
4798,
7203,
33706,
25,
4064,
82,
1,
4064,
33918,
62,
7890,
17816,
41484,
6,
12962,
198
] | 2.498024 | 253 |
from .internals.base_operator import BaseOperator
from ...data.writers import MinIoWriter, Writer # type:ignore
from ...data.validator import Schema # type:ignore
import datetime
| [
6738,
764,
23124,
874,
13,
8692,
62,
46616,
1330,
7308,
18843,
1352,
201,
198,
6738,
2644,
7890,
13,
34422,
1330,
1855,
40,
78,
34379,
11,
26606,
220,
1303,
2099,
25,
46430,
201,
198,
6738,
2644,
7890,
13,
12102,
1352,
1330,
10011,
2611,
220,
1303,
2099,
25,
46430,
201,
198,
11748,
4818,
8079,
201,
198,
201,
198
] | 3.339286 | 56 |
#!/usr/bin/env python
# This script ships with HAT, or HercAdminTool.
# Please see our project here: https://github.com/jguy1987/HercAdminTool
# Author: Jguy - John Mish
# The MIT license covers this file. Please see applicable license file here: https://github.com/jguy1987/HercAdminTool/blob/master/license.txt
# You are free to include this file wholesale or parts of it in your project, just as long as you leave the above text alone.
# Purpose of file:
# This file is intended to be ran on a remote server.
# It will gather metrics about the running server using the psutils python module and output them via an XML file with lxml.
# Example output:
#<metrics>
# <basic>
# <name>machinename</name>
# <os>Linux-3.10.0-327.el7.x86_64-x86_64-with-centos-7.2.1511-Core</os>
# <boottime>1365519115.0</boottime>
# </basic>
# <cpu>
# <loadavg>0.5, 0.9, 1.3</loadavg>
# <proccount>121</proccount>
# </cpu>
# <mem>
# <virtual>
# <total>10367352832</total>
# <used>8186245120</used>
# <avail>2181107712</avail>
# <pct>37.6</pct>
# </virtual>
# <swap>
# <total>2097147904</total>
# <used>296128512</used>
# <avail>1801019392</avail>
# <pct>14.1</pct>
# </swap>
# </mem>
# <disk>
# <total>21378641920</total>
# <used>4809781248</used>
# <free>15482871808</free>
# </disk>
#</metrics>
# Import things
import psutil, os, time, sys, platform, socket
from lxml import etree
# get all of the metrics of the running OS. CPU load, MEM usage, disk space.
# load averages...
cpuload = os.getloadavg()
cpuavg = str(cpuload[0])+", "+str(cpuload[1])+", "+str(cpuload[2])
# memory needs a little more work
virt_mem = psutil.virtual_memory()
swap_mem = psutil.swap_memory()
# generate XML using lxml
# <metrics>
root = etree.Element('metrics')
doc = etree.ElementTree(root)
# <basic>
child1 = etree.SubElement(root, 'basic')
# <name>
etree.SubElement(child1, "name").text = socket.gethostname()
# <os>
etree.SubElement(child1, "os").text = platform.platform()
# <boottime>
etree.SubElement(child1, "boottime").text = str(psutil.boot_time())
# <cpu>
child2 = etree.SubElement(root, "cpu")
# <percent>
etree.SubElement(child2, "loadavg").text = str(cpuavg)
# <proccount>
etree.SubElement(child2, "proccount").text = str(len(psutil.pids()))
# <mem>
child3 = etree.SubElement(root, "mem")
# <virtual>
child3_1 = etree.SubElement(child3, "virtual")
# <total>
etree.SubElement(child3_1, "total").text = str(virt_mem.total)
# <used>
etree.SubElement(child3_1, "used").text = str(virt_mem.used)
# <avail>
etree.SubElement(child3_1, "avail").text = str(virt_mem.available)
# <pct>
etree.SubElement(child3_1, "pct").text = str(virt_mem.percent)
# <swap>
child3_2 = etree.SubElement(child3, "swap")
# <total>
etree.SubElement(child3_2, "total").text = str(swap_mem.total)
# <used>
etree.SubElement(child3_2, "used").text = str(swap_mem.used)
# <avail>
etree.SubElement(child3_2, "avail").text = str(swap_mem.free)
# <pct>
etree.SubElement(child3_2, "pct").text = str(swap_mem.percent)
# <disk>
child4 = etree.SubElement(root, "disk")
disk = os.statvfs(__file__)
free = disk.f_bavail * disk.f_frsize
total = disk.f_blocks * disk.f_frsize
used = (disk.f_blocks - disk.f_bfree) * disk.f_frsize
# <total>
etree.SubElement(child4, "total").text = str(total)
# <used>
etree.SubElement(child4, "used").text = str(used)
# <free>
etree.SubElement(child4, "free").text = str(free)
outFile = open('serverstat.xml', 'w')
doc.write(outFile)
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
2,
770,
4226,
7937,
351,
367,
1404,
11,
393,
2332,
66,
46787,
25391,
13,
198,
2,
4222,
766,
674,
1628,
994,
25,
3740,
1378,
12567,
13,
785,
14,
73,
22932,
27301,
14,
39,
2798,
46787,
25391,
198,
2,
6434,
25,
449,
22932,
532,
1757,
39523,
198,
2,
383,
17168,
5964,
8698,
428,
2393,
13,
4222,
766,
9723,
5964,
2393,
994,
25,
3740,
1378,
12567,
13,
785,
14,
73,
22932,
27301,
14,
39,
2798,
46787,
25391,
14,
2436,
672,
14,
9866,
14,
43085,
13,
14116,
198,
2,
921,
389,
1479,
284,
2291,
428,
2393,
24005,
393,
3354,
286,
340,
287,
534,
1628,
11,
655,
355,
890,
355,
345,
2666,
262,
2029,
2420,
3436,
13,
198,
198,
2,
32039,
286,
2393,
25,
198,
2,
770,
2393,
318,
5292,
284,
307,
4966,
319,
257,
6569,
4382,
13,
198,
2,
632,
481,
6431,
20731,
546,
262,
2491,
4382,
1262,
262,
26692,
26791,
21015,
8265,
290,
5072,
606,
2884,
281,
23735,
2393,
351,
300,
19875,
13,
198,
2,
17934,
5072,
25,
198,
2,
27,
4164,
10466,
29,
198,
2,
197,
27,
35487,
29,
198,
2,
197,
197,
27,
3672,
29,
76,
620,
259,
12453,
3556,
3672,
29,
198,
2,
197,
197,
27,
418,
29,
19314,
12,
18,
13,
940,
13,
15,
12,
34159,
13,
417,
22,
13,
87,
4521,
62,
2414,
12,
87,
4521,
62,
2414,
12,
4480,
12,
1087,
418,
12,
22,
13,
17,
13,
1314,
1157,
12,
14055,
3556,
418,
29,
198,
2,
197,
197,
27,
18769,
2435,
29,
20809,
2816,
1129,
15363,
13,
15,
3556,
18769,
2435,
29,
198,
2,
197,
3556,
35487,
29,
198,
2,
197,
27,
36166,
29,
198,
2,
197,
197,
27,
2220,
615,
70,
29,
15,
13,
20,
11,
657,
13,
24,
11,
352,
13,
18,
3556,
2220,
615,
70,
29,
198,
2,
197,
197,
27,
1676,
535,
608,
29,
19244,
3556,
1676,
535,
608,
29,
198,
2,
197,
3556,
36166,
29,
198,
2,
197,
27,
11883,
29,
198,
2,
197,
197,
27,
32844,
29,
198,
2,
197,
197,
197,
27,
23350,
29,
940,
27824,
2327,
2078,
2624,
3556,
23350,
29,
198,
2,
197,
197,
197,
27,
1484,
29,
23,
25096,
22995,
10232,
3556,
1484,
29,
198,
2,
197,
197,
197,
27,
615,
603,
29,
28727,
11442,
3324,
1065,
3556,
615,
603,
29,
198,
2,
197,
197,
197,
27,
79,
310,
29,
2718,
13,
21,
3556,
79,
310,
29,
198,
2,
197,
197,
3556,
32844,
29,
198,
2,
197,
197,
27,
2032,
499,
29,
198,
2,
197,
197,
197,
27,
23350,
29,
1238,
5607,
1415,
3720,
3023,
3556,
23350,
29,
198,
2,
197,
197,
197,
27,
1484,
29,
27137,
1065,
5332,
1065,
3556,
1484,
29,
198,
2,
197,
197,
197,
27,
615,
603,
29,
1507,
486,
30484,
32321,
3556,
615,
603,
29,
198,
2,
197,
197,
197,
27,
79,
310,
29,
1415,
13,
16,
3556,
79,
310,
29,
198,
2,
197,
197,
3556,
2032,
499,
29,
198,
2,
197,
3556,
11883,
29,
198,
2,
197,
27,
39531,
29,
198,
2,
197,
197,
27,
23350,
29,
26427,
3695,
2414,
40454,
3556,
23350,
29,
198,
2,
197,
197,
27,
1484,
29,
22148,
32196,
1065,
2780,
3556,
1484,
29,
198,
2,
197,
197,
27,
5787,
29,
1314,
2780,
27800,
1507,
2919,
3556,
5787,
29,
198,
2,
197,
3556,
39531,
29,
198,
2,
3556,
4164,
10466,
29,
198,
198,
2,
17267,
1243,
198,
11748,
26692,
22602,
11,
28686,
11,
640,
11,
25064,
11,
3859,
11,
17802,
198,
6738,
300,
19875,
1330,
2123,
631,
198,
198,
2,
651,
477,
286,
262,
20731,
286,
262,
2491,
7294,
13,
9135,
3440,
11,
35153,
8748,
11,
11898,
2272,
13,
198,
198,
2,
3440,
25694,
986,
198,
13155,
377,
1170,
796,
28686,
13,
1136,
2220,
615,
70,
3419,
198,
198,
36166,
615,
70,
796,
965,
7,
13155,
377,
1170,
58,
15,
12962,
10,
1600,
43825,
2536,
7,
13155,
377,
1170,
58,
16,
12962,
10,
1600,
43825,
2536,
7,
13155,
377,
1170,
58,
17,
12962,
198,
2,
4088,
2476,
257,
1310,
517,
670,
198,
48940,
62,
11883,
796,
26692,
22602,
13,
32844,
62,
31673,
3419,
198,
2032,
499,
62,
11883,
796,
26692,
22602,
13,
2032,
499,
62,
31673,
3419,
198,
198,
2,
7716,
23735,
1262,
300,
19875,
198,
2,
1279,
4164,
10466,
29,
198,
15763,
796,
2123,
631,
13,
20180,
10786,
4164,
10466,
11537,
198,
15390,
796,
2123,
631,
13,
20180,
27660,
7,
15763,
8,
198,
2,
197,
27,
35487,
29,
198,
9410,
16,
796,
2123,
631,
13,
7004,
20180,
7,
15763,
11,
705,
35487,
11537,
198,
2,
197,
197,
27,
3672,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
16,
11,
366,
3672,
11074,
5239,
796,
17802,
13,
1136,
4774,
3672,
3419,
198,
2,
197,
197,
27,
418,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
16,
11,
366,
418,
11074,
5239,
796,
3859,
13,
24254,
3419,
198,
2,
197,
197,
27,
18769,
2435,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
16,
11,
366,
18769,
2435,
11074,
5239,
796,
965,
7,
862,
22602,
13,
18769,
62,
2435,
28955,
628,
198,
2,
197,
27,
36166,
29,
198,
9410,
17,
796,
2123,
631,
13,
7004,
20180,
7,
15763,
11,
366,
36166,
4943,
198,
2,
197,
197,
27,
25067,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
17,
11,
366,
2220,
615,
70,
11074,
5239,
796,
965,
7,
36166,
615,
70,
8,
198,
2,
197,
197,
27,
1676,
535,
608,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
17,
11,
366,
1676,
535,
608,
11074,
5239,
796,
965,
7,
11925,
7,
862,
22602,
13,
79,
2340,
3419,
4008,
198,
198,
2,
197,
27,
11883,
29,
198,
9410,
18,
796,
2123,
631,
13,
7004,
20180,
7,
15763,
11,
366,
11883,
4943,
198,
2,
197,
197,
27,
32844,
29,
198,
9410,
18,
62,
16,
796,
2123,
631,
13,
7004,
20180,
7,
9410,
18,
11,
366,
32844,
4943,
198,
2,
197,
197,
197,
27,
23350,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
16,
11,
366,
23350,
11074,
5239,
796,
965,
7,
48940,
62,
11883,
13,
23350,
8,
198,
2,
197,
197,
197,
27,
1484,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
16,
11,
366,
1484,
11074,
5239,
796,
965,
7,
48940,
62,
11883,
13,
1484,
8,
198,
2,
197,
197,
197,
27,
615,
603,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
16,
11,
366,
615,
603,
11074,
5239,
796,
965,
7,
48940,
62,
11883,
13,
15182,
8,
198,
2,
197,
197,
197,
27,
79,
310,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
16,
11,
366,
79,
310,
11074,
5239,
796,
965,
7,
48940,
62,
11883,
13,
25067,
8,
198,
2,
197,
197,
27,
2032,
499,
29,
198,
9410,
18,
62,
17,
796,
2123,
631,
13,
7004,
20180,
7,
9410,
18,
11,
366,
2032,
499,
4943,
198,
2,
197,
197,
197,
27,
23350,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
17,
11,
366,
23350,
11074,
5239,
796,
965,
7,
2032,
499,
62,
11883,
13,
23350,
8,
198,
2,
197,
197,
197,
27,
1484,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
17,
11,
366,
1484,
11074,
5239,
796,
965,
7,
2032,
499,
62,
11883,
13,
1484,
8,
198,
2,
197,
197,
197,
27,
615,
603,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
17,
11,
366,
615,
603,
11074,
5239,
796,
965,
7,
2032,
499,
62,
11883,
13,
5787,
8,
198,
2,
197,
197,
197,
27,
79,
310,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
18,
62,
17,
11,
366,
79,
310,
11074,
5239,
796,
965,
7,
2032,
499,
62,
11883,
13,
25067,
8,
198,
198,
2,
197,
27,
39531,
29,
198,
9410,
19,
796,
2123,
631,
13,
7004,
20180,
7,
15763,
11,
366,
39531,
4943,
198,
39531,
796,
28686,
13,
14269,
85,
9501,
7,
834,
7753,
834,
8,
198,
5787,
796,
11898,
13,
69,
62,
65,
615,
603,
1635,
11898,
13,
69,
62,
69,
3808,
1096,
198,
23350,
796,
11898,
13,
69,
62,
27372,
1635,
11898,
13,
69,
62,
69,
3808,
1096,
198,
1484,
796,
357,
39531,
13,
69,
62,
27372,
532,
11898,
13,
69,
62,
65,
5787,
8,
1635,
11898,
13,
69,
62,
69,
3808,
1096,
198,
2,
197,
197,
27,
23350,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
19,
11,
366,
23350,
11074,
5239,
796,
965,
7,
23350,
8,
198,
2,
197,
197,
27,
1484,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
19,
11,
366,
1484,
11074,
5239,
796,
965,
7,
1484,
8,
198,
2,
197,
197,
27,
5787,
29,
198,
316,
631,
13,
7004,
20180,
7,
9410,
19,
11,
366,
5787,
11074,
5239,
796,
965,
7,
5787,
8,
198,
198,
448,
8979,
796,
1280,
10786,
15388,
14269,
13,
19875,
3256,
705,
86,
11537,
198,
15390,
13,
13564,
7,
448,
8979,
8,
198
] | 2.355102 | 1,470 |
from django.urls import path
from companies import views
app_name = 'company'
urlpatterns = [
path('contacts/', views.CompanyContactsView.as_view(), name='contacts'),
path('phone/list/', views.CompanyPhoneListView.as_view(), name='phone_list'),
path('phone/add/', views.CompanyPhoneCreateView.as_view(), name='phone_add'),
path('phone/edit/<int:pk>/', views.CompanyPhoneEditView.as_view(), name='phone_edit'),
path('phone/delete/<int:pk>/', views.CompanyPhoneDeleteView.as_view(), name='phone_delete'),
path('email/list/', views.CompanyEmailListView.as_view(), name='email_list'),
path('email/add/', views.CompanyEmailCreateView.as_view(), name='email_add'),
path('email/edit/<int:pk>/', views.CompanyEmailEditView.as_view(), name='email_edit'),
path('email/delete/<int:pk>/', views.CompanyEmailDeleteView.as_view(), name='email_delete'),
path('list/', views.CompanyListView.as_view(), name='list'),
path('create/', views.CompanyCreateView.as_view(), name='create'),
path('edit/<int:pk>/', views.CompanyEditView.as_view(), name='edit'),
path('<int:pk>/', views.CompanyDetailView.as_view(), name='detail'),
]
| [
6738,
42625,
14208,
13,
6371,
82,
1330,
3108,
198,
198,
6738,
2706,
1330,
5009,
628,
198,
1324,
62,
3672,
796,
705,
39722,
6,
198,
6371,
33279,
82,
796,
685,
198,
220,
220,
220,
3108,
10786,
3642,
8656,
14,
3256,
5009,
13,
39154,
4264,
8656,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
3642,
8656,
33809,
198,
220,
220,
220,
3108,
10786,
4862,
14,
4868,
14,
3256,
5009,
13,
39154,
6132,
8053,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
4862,
62,
4868,
33809,
198,
220,
220,
220,
3108,
10786,
4862,
14,
2860,
14,
3256,
5009,
13,
39154,
6132,
16447,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
4862,
62,
2860,
33809,
198,
220,
220,
220,
3108,
10786,
4862,
14,
19312,
14,
27,
600,
25,
79,
74,
29,
14,
3256,
5009,
13,
39154,
6132,
18378,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
4862,
62,
19312,
33809,
198,
220,
220,
220,
3108,
10786,
4862,
14,
33678,
14,
27,
600,
25,
79,
74,
29,
14,
3256,
5009,
13,
39154,
6132,
38727,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
4862,
62,
33678,
33809,
198,
220,
220,
220,
3108,
10786,
12888,
14,
4868,
14,
3256,
5009,
13,
39154,
15333,
8053,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
12888,
62,
4868,
33809,
198,
220,
220,
220,
3108,
10786,
12888,
14,
2860,
14,
3256,
5009,
13,
39154,
15333,
16447,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
12888,
62,
2860,
33809,
198,
220,
220,
220,
3108,
10786,
12888,
14,
19312,
14,
27,
600,
25,
79,
74,
29,
14,
3256,
5009,
13,
39154,
15333,
18378,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
12888,
62,
19312,
33809,
198,
220,
220,
220,
3108,
10786,
12888,
14,
33678,
14,
27,
600,
25,
79,
74,
29,
14,
3256,
5009,
13,
39154,
15333,
38727,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
12888,
62,
33678,
33809,
198,
220,
220,
220,
3108,
10786,
4868,
14,
3256,
5009,
13,
39154,
8053,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
4868,
33809,
198,
220,
220,
220,
3108,
10786,
17953,
14,
3256,
5009,
13,
39154,
16447,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
17953,
33809,
198,
220,
220,
220,
3108,
10786,
19312,
14,
27,
600,
25,
79,
74,
29,
14,
3256,
5009,
13,
39154,
18378,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
19312,
33809,
198,
220,
220,
220,
3108,
10786,
27,
600,
25,
79,
74,
29,
14,
3256,
5009,
13,
39154,
11242,
603,
7680,
13,
292,
62,
1177,
22784,
1438,
11639,
49170,
33809,
198,
60,
198
] | 2.80241 | 415 |
from django.conf import settings
from django.db import models
from django.contrib import admin
admin.site.register(CrewMember, CrewMemberAdmin)
| [
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
628,
628,
198,
28482,
13,
15654,
13,
30238,
7,
46724,
27608,
11,
17652,
27608,
46787,
8,
198
] | 3.609756 | 41 |
import requests
import urllib3
import re
import time
from pathlib import Path
from __constants.constants import head1
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
######### AUTHOR - @AmmeySaini #########
######### Github Repo - https://github.com/AmmeySaini/Realme-AutoBuy #########
######### I'm not responisble for any damage or anything bad happens to you using this script #########
######### Use it on your own RISK #########
######### This is only for educational purpose #########
if __name__ == '__main__':
main() | [
11748,
7007,
198,
11748,
2956,
297,
571,
18,
198,
11748,
302,
198,
11748,
640,
198,
6738,
3108,
8019,
1330,
10644,
198,
6738,
11593,
9979,
1187,
13,
9979,
1187,
1330,
1182,
16,
198,
333,
297,
571,
18,
13,
40223,
62,
40539,
654,
7,
333,
297,
571,
18,
13,
1069,
11755,
13,
818,
22390,
18453,
20361,
8,
198,
198,
7804,
2,
44746,
532,
2488,
5840,
1326,
88,
50,
391,
72,
1303,
7804,
198,
7804,
2,
38994,
1432,
78,
532,
220,
3740,
1378,
12567,
13,
785,
14,
5840,
1326,
88,
50,
391,
72,
14,
15633,
1326,
12,
27722,
14518,
1303,
7804,
198,
7804,
2,
314,
1101,
407,
1217,
43524,
903,
329,
597,
2465,
393,
1997,
2089,
4325,
284,
345,
1262,
428,
4226,
1303,
7804,
198,
7804,
2,
5765,
340,
319,
534,
898,
45698,
42,
1303,
7804,
198,
7804,
2,
770,
318,
691,
329,
9856,
4007,
1303,
7804,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419
] | 3.401235 | 162 |
import numpy as np
import sys
import regex as re
if __name__ == "__main__":
file_name = sys.argv[1]
parse_output_performance(file_name) | [
11748,
299,
32152,
355,
45941,
201,
198,
11748,
25064,
201,
198,
11748,
40364,
355,
302,
201,
198,
201,
198,
201,
198,
201,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
201,
198,
220,
220,
220,
2393,
62,
3672,
796,
25064,
13,
853,
85,
58,
16,
60,
201,
198,
220,
220,
220,
21136,
62,
22915,
62,
26585,
7,
7753,
62,
3672,
8
] | 2.40625 | 64 |
"""
Demo of CMR.
Note that CMR assumes that the object has been detected, so please use a picture of a bird that is centered and well cropped.
Sample usage:
python demo.py --name bird_net --num_train_epoch 500 --img_path misc/demo_data/img1.jpg
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import flags, app
import numpy as np
import skimage.io as io
import torch
from nnutils import test_utils
from nnutils import predictor as pred_util
from utils import image as img_util
#----------------------------edited by parker call to graph
from pycallgraph import PyCallGraph
from pycallgraph.output import GraphvizOutput
#
# with PyCallGraph(output=GraphvizOutput()):
# code_to_profile()
#-------------------------
flags.DEFINE_string('img_path', 'data/im1963.jpg', 'Image to run')
flags.DEFINE_integer('img_size', 256, 'image size the network was trained on.')
opts = flags.FLAGS
if __name__ == '__main__':
opts.batch_size = 1
opts.name="bird_net"
opts.num_train_epoch=500
opts.img_path="misc/demo_data/img2.jpg"
app.run(main)
| [
37811,
198,
11522,
78,
286,
327,
13599,
13,
198,
198,
6425,
326,
327,
13599,
18533,
326,
262,
2134,
468,
587,
12326,
11,
523,
3387,
779,
257,
4286,
286,
257,
6512,
326,
318,
19254,
290,
880,
48998,
13,
198,
198,
36674,
8748,
25,
198,
198,
29412,
13605,
13,
9078,
1377,
3672,
6512,
62,
3262,
1377,
22510,
62,
27432,
62,
538,
5374,
5323,
1377,
9600,
62,
6978,
12747,
14,
9536,
78,
62,
7890,
14,
9600,
16,
13,
9479,
198,
37811,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
3601,
62,
8818,
198,
198,
6738,
2352,
75,
1330,
9701,
11,
598,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
1341,
9060,
13,
952,
355,
33245,
198,
198,
11748,
28034,
198,
198,
6738,
299,
14930,
4487,
1330,
1332,
62,
26791,
198,
6738,
299,
14930,
4487,
1330,
41568,
355,
2747,
62,
22602,
198,
6738,
3384,
4487,
1330,
2939,
355,
33705,
62,
22602,
198,
2,
1783,
10541,
42131,
416,
3952,
263,
869,
284,
4823,
198,
6738,
12972,
13345,
34960,
1330,
9485,
14134,
37065,
198,
6738,
12972,
13345,
34960,
13,
22915,
1330,
29681,
85,
528,
26410,
198,
2,
198,
2,
351,
9485,
14134,
37065,
7,
22915,
28,
37065,
85,
528,
26410,
3419,
2599,
198,
2,
220,
220,
220,
220,
2438,
62,
1462,
62,
13317,
3419,
198,
2,
22369,
12,
628,
198,
33152,
13,
7206,
29940,
62,
8841,
10786,
9600,
62,
6978,
3256,
705,
7890,
14,
320,
45192,
13,
9479,
3256,
705,
5159,
284,
1057,
11537,
198,
33152,
13,
7206,
29940,
62,
41433,
10786,
9600,
62,
7857,
3256,
17759,
11,
705,
9060,
2546,
262,
3127,
373,
8776,
319,
2637,
8,
198,
198,
404,
912,
796,
9701,
13,
38948,
50,
628,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
2172,
82,
13,
43501,
62,
7857,
796,
352,
198,
220,
220,
220,
2172,
82,
13,
3672,
2625,
16944,
62,
3262,
1,
198,
220,
220,
220,
2172,
82,
13,
22510,
62,
27432,
62,
538,
5374,
28,
4059,
198,
220,
220,
220,
2172,
82,
13,
9600,
62,
6978,
2625,
44374,
14,
9536,
78,
62,
7890,
14,
9600,
17,
13,
9479,
1,
198,
220,
220,
220,
598,
13,
5143,
7,
12417,
8,
198
] | 3.048128 | 374 |
#################################################################################
# Copyright Amazon.com, Inc. or its affiliates. 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 .behaviours.behaviour_manager import BehaviourManager
from .behaviours.deepsim_behaviour import DeepSimBehaviour
from .behaviours.transform import Transform
from .cameras.abs_camera import AbstractCamera
from .cameras.constants import CameraSettings
from .colliders.abs_collider import AbstractCollider, Abstract2DCollider, Abstract3DCollider, ColliderType
from .colliders.box2d_collider import Box2DCollider
from .colliders.geometry2d_collider import Geometry2DCollider
from .colliders.circle2d_collider import Circle2DCollider
from .colliders.sphere_collider import SphereCollider
from .constants import Tag
from .deepsim import DeepSim
from .domain_randomizations.abs_randomizer import AbstractRandomizer
from .domain_randomizations.constants import (
ModelRandomizerType, RangeType,
RANGE_MIN, RANGE_MAX,
ColorAttr, Attenuation
)
from .domain_randomizations.randomizer_manager import RandomizerManager
from .domain_randomizations.randomizers.model_visual_randomizer import ModelVisualRandomizer
from .domain_randomizations.randomizers.light_randomizer import LightRandomizer
from .exception import DeepSimError
from .exception import DeepSimCallbackError
from .exception import DeepSimException
from .gazebo.constants import (
GazeboWorld,
GazeboServiceName,
GeometryType
)
from .core.color import Color
from .core.euler import Euler
from .core.model_state import ModelState
from .core.link_state import LinkState
from .core.material import Material
from .core.math import lerp, lerp_angle_rad, project_to_2d, dot, cross, magnitude, sqr_magnitude, unit, distance
from .core.plane import Plane
from .core.point import Point
from .core.pose import Pose
from .core.quaternion import Quaternion
from .core.ray import Ray
from .core.twist import Twist
from .core.vector3 import Vector3
from .ros.service_proxy_wrapper import ServiceProxyWrapper
from .ros.ros_util import ROSUtil
from .sim_trackers.tracker import TrackerInterface
from .sim_trackers.tracker_manager import TrackerManager
from .sim_trackers.constants import TrackerPriority
from .sim_trackers.trackers.get_model_state_tracker import GetModelStateTracker
from .sim_trackers.trackers.get_link_state_tracker import GetLinkStateTracker
from .sim_trackers.trackers.set_model_state_tracker import SetModelStateTracker
from .sim_trackers.trackers.set_link_state_tracker import SetLinkStateTracker
from .sim_trackers.trackers.set_visual_material_tracker import SetVisualMaterialTracker
from .sim_trackers.trackers.set_visual_transparency_tracker import SetVisualTransparencyTracker
from .sim_trackers.trackers.set_visual_visible_tracker import SetVisualVisibleTracker
from .spawners.gazebo_xml_loader import GazeboXmlLoader
from .spawners.gazebo_model_spawner import GazeboModelSpawner
from .spawners.abs_model_spawner import AbstractModelSpawner
from .spawners.dummy_spawner import DummySpawner
from .visual_effects.abs_effect import AbstractEffect, EffectObserverInterface
from .visual_effects.effect_manager import EffectManager
from .visual_effects.effects.blink_effect import BlinkEffect
from .visual_effects.effects.invisible_effect import InvisibleEffect
| [
29113,
29113,
14468,
2,
198,
2,
220,
220,
15069,
6186,
13,
785,
11,
3457,
13,
393,
663,
29116,
13,
1439,
6923,
33876,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
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,
198,
2,
220,
220,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
11074,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
220,
220,
921,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
220,
220,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
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,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
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,
198,
2,
220,
220,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
220,
220,
220,
220,
220,
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,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
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,
198,
2,
220,
220,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
220,
220,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
220,
220,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
220,
220,
220,
1303,
198,
2,
220,
220,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
220,
220,
11247,
739,
262,
13789,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
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,
198,
29113,
29113,
14468,
2,
198,
6738,
764,
20709,
15820,
4662,
13,
20709,
37716,
62,
37153,
1330,
10407,
37716,
13511,
198,
6738,
764,
20709,
15820,
4662,
13,
22089,
14323,
62,
20709,
37716,
1330,
10766,
8890,
25267,
37716,
198,
6738,
764,
20709,
15820,
4662,
13,
35636,
1330,
26981,
198,
198,
6738,
764,
66,
2382,
292,
13,
8937,
62,
25695,
1330,
27741,
35632,
198,
6738,
764,
66,
2382,
292,
13,
9979,
1187,
1330,
20432,
26232,
198,
198,
6738,
764,
26000,
4157,
13,
8937,
62,
26000,
1304,
1330,
27741,
22667,
1304,
11,
27741,
17,
9697,
692,
1304,
11,
27741,
18,
9697,
692,
1304,
11,
50253,
6030,
198,
6738,
764,
26000,
4157,
13,
3524,
17,
67,
62,
26000,
1304,
1330,
8315,
17,
9697,
692,
1304,
198,
6738,
764,
26000,
4157,
13,
469,
15748,
17,
67,
62,
26000,
1304,
1330,
2269,
15748,
17,
9697,
692,
1304,
198,
6738,
764,
26000,
4157,
13,
45597,
17,
67,
62,
26000,
1304,
1330,
16291,
17,
9697,
692,
1304,
198,
6738,
764,
26000,
4157,
13,
2777,
1456,
62,
26000,
1304,
1330,
31798,
22667,
1304,
198,
198,
6738,
764,
9979,
1187,
1330,
17467,
198,
198,
6738,
764,
22089,
14323,
1330,
10766,
8890,
198,
198,
6738,
764,
27830,
62,
25120,
4582,
13,
8937,
62,
25120,
7509,
1330,
27741,
29531,
7509,
198,
6738,
764,
27830,
62,
25120,
4582,
13,
9979,
1187,
1330,
357,
198,
220,
220,
220,
9104,
29531,
7509,
6030,
11,
13667,
6030,
11,
198,
220,
220,
220,
371,
27746,
62,
23678,
11,
371,
27746,
62,
22921,
11,
198,
220,
220,
220,
5315,
8086,
81,
11,
3460,
268,
2288,
198,
8,
198,
6738,
764,
27830,
62,
25120,
4582,
13,
25120,
7509,
62,
37153,
1330,
14534,
7509,
13511,
198,
6738,
764,
27830,
62,
25120,
4582,
13,
25120,
11341,
13,
19849,
62,
41464,
62,
25120,
7509,
1330,
9104,
36259,
29531,
7509,
198,
6738,
764,
27830,
62,
25120,
4582,
13,
25120,
11341,
13,
2971,
62,
25120,
7509,
1330,
4401,
29531,
7509,
198,
198,
6738,
764,
1069,
4516,
1330,
10766,
8890,
12331,
198,
6738,
764,
1069,
4516,
1330,
10766,
8890,
47258,
12331,
198,
6738,
764,
1069,
4516,
1330,
10766,
8890,
16922,
198,
198,
6738,
764,
70,
1031,
1765,
78,
13,
9979,
1187,
1330,
357,
198,
220,
220,
220,
21347,
1765,
78,
10603,
11,
198,
220,
220,
220,
21347,
1765,
78,
16177,
5376,
11,
198,
220,
220,
220,
2269,
15748,
6030,
198,
8,
198,
198,
6738,
764,
7295,
13,
8043,
1330,
5315,
198,
6738,
764,
7295,
13,
68,
18173,
1330,
412,
18173,
198,
6738,
764,
7295,
13,
19849,
62,
5219,
1330,
9104,
9012,
198,
6738,
764,
7295,
13,
8726,
62,
5219,
1330,
7502,
9012,
198,
6738,
764,
7295,
13,
33665,
1330,
14633,
198,
6738,
764,
7295,
13,
11018,
1330,
300,
263,
79,
11,
300,
263,
79,
62,
9248,
62,
6335,
11,
1628,
62,
1462,
62,
17,
67,
11,
16605,
11,
3272,
11,
14735,
11,
19862,
81,
62,
76,
4660,
3984,
11,
4326,
11,
5253,
198,
6738,
764,
7295,
13,
14382,
1330,
36829,
198,
6738,
764,
7295,
13,
4122,
1330,
6252,
198,
6738,
764,
7295,
13,
3455,
1330,
37557,
198,
6738,
764,
7295,
13,
421,
9205,
295,
1330,
2264,
9205,
295,
198,
6738,
764,
7295,
13,
2433,
1330,
7760,
198,
6738,
764,
7295,
13,
4246,
396,
1330,
44088,
198,
6738,
764,
7295,
13,
31364,
18,
1330,
20650,
18,
198,
198,
6738,
764,
4951,
13,
15271,
62,
36436,
62,
48553,
1330,
4809,
44148,
36918,
2848,
198,
6738,
764,
4951,
13,
4951,
62,
22602,
1330,
48263,
18274,
346,
198,
198,
6738,
764,
14323,
62,
11659,
364,
13,
2213,
10735,
1330,
26885,
39317,
198,
6738,
764,
14323,
62,
11659,
364,
13,
2213,
10735,
62,
37153,
1330,
26885,
13511,
198,
6738,
764,
14323,
62,
11659,
364,
13,
9979,
1187,
1330,
26885,
22442,
414,
198,
6738,
764,
14323,
62,
11659,
364,
13,
11659,
364,
13,
1136,
62,
19849,
62,
5219,
62,
2213,
10735,
1330,
3497,
17633,
9012,
35694,
198,
6738,
764,
14323,
62,
11659,
364,
13,
11659,
364,
13,
1136,
62,
8726,
62,
5219,
62,
2213,
10735,
1330,
3497,
11280,
9012,
35694,
198,
6738,
764,
14323,
62,
11659,
364,
13,
11659,
364,
13,
2617,
62,
19849,
62,
5219,
62,
2213,
10735,
1330,
5345,
17633,
9012,
35694,
198,
6738,
764,
14323,
62,
11659,
364,
13,
11659,
364,
13,
2617,
62,
8726,
62,
5219,
62,
2213,
10735,
1330,
5345,
11280,
9012,
35694,
198,
6738,
764,
14323,
62,
11659,
364,
13,
11659,
364,
13,
2617,
62,
41464,
62,
33665,
62,
2213,
10735,
1330,
5345,
36259,
17518,
35694,
198,
6738,
764,
14323,
62,
11659,
364,
13,
11659,
364,
13,
2617,
62,
41464,
62,
7645,
11944,
62,
2213,
10735,
1330,
5345,
36259,
8291,
11944,
35694,
198,
6738,
764,
14323,
62,
11659,
364,
13,
11659,
364,
13,
2617,
62,
41464,
62,
23504,
62,
2213,
10735,
1330,
5345,
36259,
53,
12843,
35694,
198,
198,
6738,
764,
48183,
364,
13,
70,
1031,
1765,
78,
62,
19875,
62,
29356,
1330,
21347,
1765,
78,
55,
4029,
17401,
198,
6738,
764,
48183,
364,
13,
70,
1031,
1765,
78,
62,
19849,
62,
48183,
263,
1330,
21347,
1765,
78,
17633,
49855,
263,
198,
6738,
764,
48183,
364,
13,
8937,
62,
19849,
62,
48183,
263,
1330,
27741,
17633,
49855,
263,
198,
6738,
764,
48183,
364,
13,
67,
13513,
62,
48183,
263,
1330,
360,
13513,
49855,
263,
198,
198,
6738,
764,
41464,
62,
34435,
13,
8937,
62,
10760,
1330,
27741,
18610,
11,
7896,
31310,
18497,
39317,
198,
6738,
764,
41464,
62,
34435,
13,
10760,
62,
37153,
1330,
7896,
13511,
198,
6738,
764,
41464,
62,
34435,
13,
34435,
13,
2436,
676,
62,
10760,
1330,
41732,
18610,
198,
6738,
764,
41464,
62,
34435,
13,
34435,
13,
259,
23504,
62,
10760,
1330,
39571,
18610,
198
] | 2.878033 | 1,525 |
import multiprocessing as mp
import os
import tempfile
from unittest import skipIf
from .common import TestConfig, test_data
from hexrd import config
reference_data = \
"""
analysis_name: analysis
#working_dir: # not set to test defaulting to cwd
---
analysis_name: analysis_2
working_dir: %(existing_path)s
multiprocessing: -1
---
#analysis_name: # not set to test inheritance
working_dir: %(nonexistent_path)s
multiprocessing: all
---
multiprocessing: half
---
multiprocessing: 2
---
multiprocessing: 1000
---
multiprocessing: -1000
---
multiprocessing: foo
""" % test_data
| [
11748,
18540,
305,
919,
278,
355,
29034,
198,
11748,
28686,
198,
11748,
20218,
7753,
198,
6738,
555,
715,
395,
1330,
14267,
1532,
198,
198,
6738,
764,
11321,
1330,
6208,
16934,
11,
1332,
62,
7890,
198,
6738,
17910,
4372,
1330,
4566,
628,
198,
35790,
62,
7890,
796,
3467,
198,
37811,
198,
20930,
62,
3672,
25,
3781,
198,
2,
16090,
62,
15908,
25,
1303,
407,
900,
284,
1332,
4277,
278,
284,
269,
16993,
198,
6329,
198,
20930,
62,
3672,
25,
3781,
62,
17,
198,
16090,
62,
15908,
25,
4064,
7,
25687,
62,
6978,
8,
82,
198,
16680,
541,
305,
919,
278,
25,
532,
16,
198,
6329,
198,
2,
20930,
62,
3672,
25,
1303,
407,
900,
284,
1332,
24155,
198,
16090,
62,
15908,
25,
4064,
7,
23108,
87,
7609,
62,
6978,
8,
82,
198,
16680,
541,
305,
919,
278,
25,
477,
198,
6329,
198,
16680,
541,
305,
919,
278,
25,
2063,
198,
6329,
198,
16680,
541,
305,
919,
278,
25,
362,
198,
6329,
198,
16680,
541,
305,
919,
278,
25,
8576,
198,
6329,
198,
16680,
541,
305,
919,
278,
25,
532,
12825,
198,
6329,
198,
16680,
541,
305,
919,
278,
25,
22944,
198,
37811,
4064,
1332,
62,
7890,
628,
628
] | 2.954315 | 197 |
# -*- coding: utf-8 -*-
"""
this file is for training the SAE, and apply for the model
@author Zhou Hang
"""
import model
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
198,
5661,
2393,
318,
329,
3047,
262,
311,
14242,
11,
290,
4174,
329,
262,
2746,
198,
31,
9800,
32222,
24300,
198,
37811,
198,
11748,
2746,
198
] | 2.97561 | 41 |
import dataiku
import constants
from dataikuapi.utils import DataikuException
import os
from threading import Thread
from werkzeug.serving import make_server
from tensorflow import logging
from tensorboard.backend import application
import tensorboard.default as tb_default
| [
11748,
1366,
28643,
198,
11748,
38491,
198,
6738,
1366,
28643,
15042,
13,
26791,
1330,
6060,
28643,
16922,
198,
11748,
28686,
198,
6738,
4704,
278,
1330,
14122,
198,
6738,
266,
9587,
2736,
1018,
13,
31293,
1330,
787,
62,
15388,
198,
6738,
11192,
273,
11125,
1330,
18931,
198,
6738,
11192,
273,
3526,
13,
1891,
437,
1330,
3586,
198,
11748,
11192,
273,
3526,
13,
12286,
355,
256,
65,
62,
12286,
628,
628,
628
] | 3.985714 | 70 |
from typing import TYPE_CHECKING, Final
from urllib.parse import quote
from arago.hiro.model.graph.vertex import Vertex
from arago.hiro.utils.cast_b import to_vertex
if TYPE_CHECKING:
from arago.hiro.client.rest_base_client import HiroRestBaseClient
| [
6738,
19720,
1330,
41876,
62,
50084,
2751,
11,
8125,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
9577,
198,
198,
6738,
610,
3839,
13,
49907,
13,
19849,
13,
34960,
13,
332,
16886,
1330,
4643,
16886,
198,
6738,
610,
3839,
13,
49907,
13,
26791,
13,
2701,
62,
65,
1330,
284,
62,
332,
16886,
198,
198,
361,
41876,
62,
50084,
2751,
25,
198,
220,
220,
220,
422,
610,
3839,
13,
49907,
13,
16366,
13,
2118,
62,
8692,
62,
16366,
1330,
25940,
19452,
14881,
11792,
628,
198
] | 3.071429 | 84 |
# -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. 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.
"""Reschedule a Cloud SQL instance's maintenance."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import textwrap
from googlecloudsdk.api_lib.sql import api_util
from googlecloudsdk.calliope import base
from googlecloudsdk.command_lib.sql import flags
from googlecloudsdk.command_lib.sql import reschedule_maintenance_util
@base.ReleaseTracks(base.ReleaseTrack.GA, base.ReleaseTrack.BETA,
base.ReleaseTrack.ALPHA)
class RescheduleMaintenance(base.Command):
"""Reschedule a Cloud SQL instance's maintenance."""
detailed_help = {
'DESCRIPTION':
textwrap.dedent("""\
{command} reschedules a Cloud SQL instance's maintenance.
"""),
'EXAMPLES':
textwrap.dedent("""\
To run maintenance on instance `my-instance` immediately, run:
$ {command} my-instance --reschedule-type=IMMEDIATE
To reschedule maintenance on instance `my-instance` to the next available window, run:
$ {command} my-instance --reschedule-type=NEXT_AVAILABLE_WINDOW
To reschedule maintenance on instance `my-instance` to 2019-11-07 at 4:00 am UTC, run:
$ {command} my-instance --reschedule-type=SPECIFIC_TIME --schedule-time=2019-11-07T04:00Z
"""),
}
@staticmethod
def Args(parser):
"""Args is called by calliope to gather arguments for this command.
Args:
parser: An argparse parser that you can use to add arguments that go on
the command line after this command. Positional arguments are allowed.
"""
flags.AddInstanceArgument(parser)
flags.AddRescheduleType(parser)
flags.AddScheduleTime(parser)
def Run(self, args):
"""Runs the command to reschedule maintenance for a Cloud SQL instance."""
client = api_util.SqlClient(api_util.API_VERSION_DEFAULT)
return reschedule_maintenance_util.RunRescheduleMaintenanceCommand(
args, client)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
1303,
198,
2,
15069,
13130,
3012,
11419,
13,
1439,
6923,
33876,
13,
198,
2,
198,
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
2,
345,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
198,
2,
921,
743,
7330,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
198,
2,
42881,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
198,
2,
4091,
262,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
198,
2,
11247,
739,
262,
13789,
13,
198,
37811,
4965,
2395,
5950,
257,
10130,
16363,
4554,
338,
9262,
526,
15931,
198,
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
198,
6738,
11593,
37443,
834,
1330,
7297,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
11748,
2420,
37150,
198,
198,
6738,
23645,
17721,
21282,
74,
13,
15042,
62,
8019,
13,
25410,
1330,
40391,
62,
22602,
198,
6738,
23645,
17721,
21282,
74,
13,
13345,
72,
3008,
1330,
2779,
198,
6738,
23645,
17721,
21282,
74,
13,
21812,
62,
8019,
13,
25410,
1330,
9701,
198,
6738,
23645,
17721,
21282,
74,
13,
21812,
62,
8019,
13,
25410,
1330,
581,
2395,
5950,
62,
12417,
8219,
62,
22602,
628,
198,
31,
8692,
13,
26362,
2898,
4595,
7,
8692,
13,
26362,
24802,
13,
9273,
11,
2779,
13,
26362,
24802,
13,
33,
20892,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2779,
13,
26362,
24802,
13,
1847,
47,
7801,
8,
198,
4871,
1874,
2395,
5950,
13383,
8219,
7,
8692,
13,
21575,
2599,
198,
220,
37227,
4965,
2395,
5950,
257,
10130,
16363,
4554,
338,
9262,
526,
15931,
628,
220,
6496,
62,
16794,
796,
1391,
198,
220,
220,
220,
220,
220,
705,
30910,
40165,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2420,
37150,
13,
9395,
298,
7203,
15931,
59,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1391,
21812,
92,
581,
1740,
5028,
257,
10130,
16363,
4554,
338,
9262,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13538,
12340,
198,
220,
220,
220,
220,
220,
705,
6369,
2390,
6489,
1546,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2420,
37150,
13,
9395,
298,
7203,
15931,
59,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1675,
1057,
9262,
319,
4554,
4600,
1820,
12,
39098,
63,
3393,
11,
1057,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
1391,
21812,
92,
616,
12,
39098,
1377,
411,
2395,
5950,
12,
4906,
28,
3955,
30733,
40,
6158,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1675,
581,
2395,
5950,
9262,
319,
4554,
4600,
1820,
12,
39098,
63,
284,
262,
1306,
1695,
4324,
11,
1057,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
1391,
21812,
92,
616,
12,
39098,
1377,
411,
2395,
5950,
12,
4906,
28,
45,
13918,
62,
10116,
32,
4146,
17534,
62,
28929,
3913,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1675,
581,
2395,
5950,
9262,
319,
4554,
4600,
1820,
12,
39098,
63,
284,
13130,
12,
1157,
12,
2998,
379,
604,
25,
405,
716,
18119,
11,
1057,
25,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
1391,
21812,
92,
616,
12,
39098,
1377,
411,
2395,
5950,
12,
4906,
28,
48451,
30643,
62,
34694,
1377,
15952,
5950,
12,
2435,
28,
23344,
12,
1157,
12,
2998,
51,
3023,
25,
405,
57,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13538,
12340,
198,
220,
1782,
628,
220,
2488,
12708,
24396,
198,
220,
825,
943,
14542,
7,
48610,
2599,
198,
220,
220,
220,
37227,
42035,
318,
1444,
416,
869,
72,
3008,
284,
6431,
7159,
329,
428,
3141,
13,
628,
220,
220,
220,
943,
14542,
25,
198,
220,
220,
220,
220,
220,
30751,
25,
1052,
1822,
29572,
30751,
326,
345,
460,
779,
284,
751,
7159,
326,
467,
319,
198,
220,
220,
220,
220,
220,
220,
220,
262,
3141,
1627,
706,
428,
3141,
13,
18574,
1859,
7159,
389,
3142,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
9701,
13,
4550,
33384,
28100,
1713,
7,
48610,
8,
198,
220,
220,
220,
9701,
13,
4550,
4965,
2395,
5950,
6030,
7,
48610,
8,
198,
220,
220,
220,
9701,
13,
4550,
27054,
5950,
7575,
7,
48610,
8,
628,
220,
825,
5660,
7,
944,
11,
26498,
2599,
198,
220,
220,
220,
37227,
10987,
82,
262,
3141,
284,
581,
2395,
5950,
9262,
329,
257,
10130,
16363,
4554,
526,
15931,
628,
220,
220,
220,
5456,
796,
40391,
62,
22602,
13,
50,
13976,
11792,
7,
15042,
62,
22602,
13,
17614,
62,
43717,
62,
7206,
38865,
8,
198,
220,
220,
220,
1441,
581,
2395,
5950,
62,
12417,
8219,
62,
22602,
13,
10987,
4965,
2395,
5950,
13383,
8219,
21575,
7,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
11,
5456,
8,
198
] | 2.940449 | 890 |
input = open('inputs/day16.input').read().strip().split(',')
positions = list("abcdefghijklmnop")
print("Part one: %s" % move(1, positions[:]))
print("Part two: %s" % move(1000000000, positions[:]))
| [
15414,
796,
1280,
10786,
15414,
82,
14,
820,
1433,
13,
15414,
27691,
961,
22446,
36311,
22446,
35312,
7,
3256,
11537,
198,
198,
1930,
1756,
796,
1351,
7203,
39305,
4299,
456,
2926,
41582,
10295,
404,
4943,
198,
198,
4798,
7203,
7841,
530,
25,
4064,
82,
1,
4064,
1445,
7,
16,
11,
6116,
58,
47715,
4008,
198,
4798,
7203,
7841,
734,
25,
4064,
82,
1,
4064,
1445,
7,
16,
10535,
830,
11,
6116,
58,
47715,
4008,
198
] | 2.68 | 75 |
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn import model_selection
from sklearn import metrics
from mpl_toolkits.mplot3d import Axes3D
data = pd.read_excel('train_data.xlsx')
data2 = pd.read_excel('test_data.xlsx')
dfX = pd.DataFrame(data, columns=["temp", "humid"])
dfy = pd.DataFrame(data, columns=["Gcal"])
df = pd.concat([dfX, dfy], axis=1)
testx = pd.DataFrame(data2, columns=["temp", "humid"])
testy = pd.DataFrame(data2, columns=["Gcal"])
fig = plt.figure(figsize=(10,5))
ax = fig.add_subplot(111, projection='3d')
cols = ["temp", "humid", "Gcal"]
ax.scatter(df["temp"],df["humid"], df["Gcal"])
model = smf.ols(formula = 'Gcal ~ temp + humid', data = data)
result = model.fit()
#print(result.summary()) #-----변수 별 관계성 수치표현
#plt.show() # plotting function
#x_train, x_test, y_train, y_test = model_selection.train_test_split(dfX, dfy, test_size=0.3)
model = LinearRegression()
model.fit(dfX, dfy)
#print(model.coef_, model.intercept_)
#y_predict = boston_model.predict(x_train)
#score = metrics.r2_score(y_train, y_predict)
#print(score) #1.0
y_predict = model.predict(testx)
score = metrics.r2_score(testy, y_predict)
print(score) #1.0
temp = input()
humid = input()
result = int(model.intercept_[0]) + int(model.coef_[0][0])*float(temp) + int(model.coef_[0][1])*float(humid)
print(result) | [
11748,
9756,
27530,
13,
687,
4712,
13,
15042,
355,
895,
69,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
1341,
35720,
13,
29127,
62,
19849,
1330,
44800,
8081,
2234,
198,
6738,
1341,
35720,
1330,
2746,
62,
49283,
198,
6738,
1341,
35720,
1330,
20731,
198,
6738,
285,
489,
62,
25981,
74,
896,
13,
76,
29487,
18,
67,
1330,
12176,
274,
18,
35,
628,
198,
7890,
796,
279,
67,
13,
961,
62,
1069,
5276,
10786,
27432,
62,
7890,
13,
87,
7278,
87,
11537,
198,
7890,
17,
796,
279,
67,
13,
961,
62,
1069,
5276,
10786,
9288,
62,
7890,
13,
87,
7278,
87,
11537,
198,
7568,
55,
796,
279,
67,
13,
6601,
19778,
7,
7890,
11,
15180,
28,
14692,
29510,
1600,
366,
17047,
312,
8973,
8,
198,
7568,
88,
796,
279,
67,
13,
6601,
19778,
7,
7890,
11,
15180,
28,
14692,
38,
9948,
8973,
8,
198,
7568,
796,
279,
67,
13,
1102,
9246,
26933,
7568,
55,
11,
288,
24928,
4357,
16488,
28,
16,
8,
628,
198,
9288,
87,
796,
279,
67,
13,
6601,
19778,
7,
7890,
17,
11,
15180,
28,
14692,
29510,
1600,
366,
17047,
312,
8973,
8,
198,
9288,
88,
796,
279,
67,
13,
6601,
19778,
7,
7890,
17,
11,
15180,
28,
14692,
38,
9948,
8973,
8,
198,
198,
5647,
796,
458,
83,
13,
26875,
7,
5647,
7857,
16193,
940,
11,
20,
4008,
198,
897,
796,
2336,
13,
2860,
62,
7266,
29487,
7,
16243,
11,
20128,
11639,
18,
67,
11537,
198,
4033,
82,
796,
14631,
29510,
1600,
366,
17047,
312,
1600,
366,
38,
9948,
8973,
198,
198,
897,
13,
1416,
1436,
7,
7568,
14692,
29510,
33116,
7568,
14692,
17047,
312,
33116,
47764,
14692,
38,
9948,
8973,
8,
198,
198,
19849,
796,
895,
69,
13,
10220,
7,
687,
4712,
796,
705,
38,
9948,
5299,
20218,
1343,
35441,
3256,
1366,
796,
1366,
8,
198,
20274,
796,
2746,
13,
11147,
3419,
198,
2,
4798,
7,
20274,
13,
49736,
28955,
220,
1303,
30934,
167,
111,
222,
168,
230,
246,
31619,
111,
226,
220,
166,
112,
222,
166,
111,
226,
168,
226,
109,
23821,
230,
246,
168,
117,
246,
169,
239,
250,
169,
246,
226,
198,
198,
2,
489,
83,
13,
12860,
3419,
220,
1303,
29353,
2163,
628,
198,
2,
87,
62,
27432,
11,
2124,
62,
9288,
11,
331,
62,
27432,
11,
331,
62,
9288,
796,
2746,
62,
49283,
13,
27432,
62,
9288,
62,
35312,
7,
7568,
55,
11,
288,
24928,
11,
1332,
62,
7857,
28,
15,
13,
18,
8,
198,
198,
19849,
796,
44800,
8081,
2234,
3419,
198,
19849,
13,
11147,
7,
7568,
55,
11,
288,
24928,
8,
198,
2,
4798,
7,
19849,
13,
1073,
891,
62,
11,
2746,
13,
3849,
984,
62,
8,
198,
198,
2,
88,
62,
79,
17407,
796,
275,
5744,
62,
19849,
13,
79,
17407,
7,
87,
62,
27432,
8,
220,
198,
2,
26675,
796,
20731,
13,
81,
17,
62,
26675,
7,
88,
62,
27432,
11,
331,
62,
79,
17407,
8,
198,
2,
4798,
7,
26675,
8,
1303,
16,
13,
15,
198,
198,
88,
62,
79,
17407,
796,
2746,
13,
79,
17407,
7,
9288,
87,
8,
220,
198,
26675,
796,
20731,
13,
81,
17,
62,
26675,
7,
9288,
88,
11,
331,
62,
79,
17407,
8,
198,
4798,
7,
26675,
8,
1303,
16,
13,
15,
198,
198,
29510,
796,
5128,
3419,
198,
17047,
312,
796,
5128,
3419,
198,
20274,
796,
493,
7,
19849,
13,
3849,
984,
62,
58,
15,
12962,
1343,
493,
7,
19849,
13,
1073,
891,
62,
58,
15,
7131,
15,
12962,
9,
22468,
7,
29510,
8,
1343,
493,
7,
19849,
13,
1073,
891,
62,
58,
15,
7131,
16,
12962,
9,
22468,
7,
17047,
312,
8,
198,
4798,
7,
20274,
8
] | 2.328969 | 611 |
__all__ = ['read_dir', 'get_last_checkpoint', 'compute_metrics', 'get_aapm_minmax',
'convert_coefficient2hu', 'convert_hu2coefficient']
import os
import os.path as path
import scipy.io as sio
import numpy as np
from tqdm import tqdm
from skimage.measure import compare_ssim, compare_psnr
| [
834,
439,
834,
796,
37250,
961,
62,
15908,
3256,
705,
1136,
62,
12957,
62,
9122,
4122,
3256,
705,
5589,
1133,
62,
4164,
10466,
3256,
705,
1136,
62,
64,
499,
76,
62,
1084,
9806,
3256,
198,
220,
220,
220,
705,
1102,
1851,
62,
1073,
16814,
17,
13415,
3256,
705,
1102,
1851,
62,
13415,
17,
1073,
16814,
20520,
198,
198,
11748,
28686,
198,
11748,
28686,
13,
6978,
355,
3108,
198,
11748,
629,
541,
88,
13,
952,
355,
264,
952,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
198,
6738,
1341,
9060,
13,
1326,
5015,
1330,
8996,
62,
824,
320,
11,
8996,
62,
862,
48624,
628,
628,
628
] | 2.660714 | 112 |
import copy
import logging
import numpy as np
import os
import time
from threading import Thread
import carla
class Speedometer(object):
"""
Speed pseudo sensor that gets the current speed of the vehicle.
This sensor is not placed at the CARLA environment. It is
only an asynchronous interface to the forward speed.
"""
def _get_forward_speed(self):
""" Convert the vehicle transform directly to forward speed """
velocity = self._vehicle.get_velocity()
transform = self._vehicle.get_transform()
vel_np = np.array([velocity.x, velocity.y, velocity.z])
pitch = np.deg2rad(transform.rotation.pitch)
yaw = np.deg2rad(transform.rotation.yaw)
orientation = np.array([np.cos(pitch) * np.cos(yaw), np.cos(pitch) * np.sin(yaw), np.sin(pitch)])
speed = np.dot(vel_np, orientation)
return speed
@threaded
| [
11748,
4866,
198,
11748,
18931,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
198,
11748,
640,
198,
6738,
4704,
278,
1330,
14122,
198,
198,
11748,
1097,
5031,
628,
628,
198,
198,
4871,
8729,
15635,
7,
15252,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8729,
24543,
12694,
326,
3011,
262,
1459,
2866,
286,
262,
4038,
13,
198,
220,
220,
220,
770,
12694,
318,
407,
4624,
379,
262,
17368,
13534,
2858,
13,
632,
318,
198,
220,
220,
220,
691,
281,
39354,
7071,
284,
262,
2651,
2866,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
825,
4808,
1136,
62,
11813,
62,
12287,
7,
944,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
38240,
262,
4038,
6121,
3264,
284,
2651,
2866,
37227,
628,
220,
220,
220,
220,
220,
220,
220,
15432,
796,
2116,
13557,
33892,
1548,
13,
1136,
62,
626,
11683,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
6121,
796,
2116,
13557,
33892,
1548,
13,
1136,
62,
35636,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
11555,
62,
37659,
796,
45941,
13,
18747,
26933,
626,
11683,
13,
87,
11,
15432,
13,
88,
11,
15432,
13,
89,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
7078,
796,
45941,
13,
13500,
17,
6335,
7,
35636,
13,
10599,
341,
13,
79,
2007,
8,
198,
220,
220,
220,
220,
220,
220,
220,
331,
707,
796,
45941,
13,
13500,
17,
6335,
7,
35636,
13,
10599,
341,
13,
88,
707,
8,
198,
220,
220,
220,
220,
220,
220,
220,
12852,
796,
45941,
13,
18747,
26933,
37659,
13,
6966,
7,
79,
2007,
8,
1635,
45941,
13,
6966,
7,
88,
707,
828,
45941,
13,
6966,
7,
79,
2007,
8,
1635,
45941,
13,
31369,
7,
88,
707,
828,
45941,
13,
31369,
7,
79,
2007,
8,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2866,
796,
45941,
13,
26518,
7,
626,
62,
37659,
11,
12852,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2866,
628,
220,
220,
220,
2488,
16663,
276,
628
] | 2.717718 | 333 |
from api.core.exceptions import NotFoundError
from api.staticdata.control_list_entries.models import ControlListEntry
def get_clc_parent_nodes(rating):
"""
A control list entry can be a group entry or a child of a child entry.
Given a rating, this function provides the list of all parent nodes in the chain.
eg.,
ML1 -> ML1a, ML1b, ML1c, ML1d
ML1b -> ML1b1, ML1b2
Given ML1b1, it returns [ML1, ML1b]
"""
parent_nodes = []
try:
node = ControlListEntry.objects.get(rating=rating)
except ControlListEntry.DoesNotExist:
node = None
if node and node.parent:
parent_nodes.append(node.parent.rating)
next_parent = get_clc_parent_nodes(node.parent.rating)
parent_nodes.extend(next_parent)
return parent_nodes
def get_clc_child_nodes(group_rating):
"""
A control list entry can have children at multiple nodes.
Given a group rating, this function provides the list of all child nodes in the chain.
eg.,
ML1 -> ML1a, ML1b, ML1c, ML1d
ML1b -> ML1b1, ML1b2
Given ML1, it returns [ML1, ML1a, ML1b, ML1b1, ML1b2, ML1c, ML1d]
"""
child_nodes = []
try:
node = ControlListEntry.objects.get(rating=group_rating)
except ControlListEntry.DoesNotExist:
node = None
if node:
if node.children.exists():
child_nodes.append(node.rating)
for child in node.children.all():
next_children = get_clc_child_nodes(child.rating)
child_nodes.extend(next_children)
else:
child_nodes.append(group_rating)
return child_nodes
| [
6738,
40391,
13,
7295,
13,
1069,
11755,
1330,
1892,
21077,
12331,
198,
6738,
40391,
13,
12708,
7890,
13,
13716,
62,
4868,
62,
298,
1678,
13,
27530,
1330,
6779,
8053,
30150,
628,
628,
198,
4299,
651,
62,
565,
66,
62,
8000,
62,
77,
4147,
7,
8821,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
317,
1630,
1351,
5726,
460,
307,
257,
1448,
5726,
393,
257,
1200,
286,
257,
1200,
5726,
13,
198,
220,
220,
220,
11259,
257,
7955,
11,
428,
2163,
3769,
262,
1351,
286,
477,
2560,
13760,
287,
262,
6333,
13,
198,
220,
220,
220,
29206,
1539,
198,
220,
220,
220,
10373,
16,
4613,
10373,
16,
64,
11,
10373,
16,
65,
11,
10373,
16,
66,
11,
10373,
16,
67,
198,
220,
220,
220,
10373,
16,
65,
4613,
10373,
16,
65,
16,
11,
10373,
16,
65,
17,
198,
220,
220,
220,
11259,
10373,
16,
65,
16,
11,
340,
5860,
685,
5805,
16,
11,
10373,
16,
65,
60,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
2560,
62,
77,
4147,
796,
17635,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
10139,
796,
6779,
8053,
30150,
13,
48205,
13,
1136,
7,
8821,
28,
8821,
8,
198,
220,
220,
220,
2845,
6779,
8053,
30150,
13,
13921,
3673,
3109,
396,
25,
198,
220,
220,
220,
220,
220,
220,
220,
10139,
796,
6045,
628,
220,
220,
220,
611,
10139,
290,
10139,
13,
8000,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2560,
62,
77,
4147,
13,
33295,
7,
17440,
13,
8000,
13,
8821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1306,
62,
8000,
796,
651,
62,
565,
66,
62,
8000,
62,
77,
4147,
7,
17440,
13,
8000,
13,
8821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2560,
62,
77,
4147,
13,
2302,
437,
7,
19545,
62,
8000,
8,
628,
220,
220,
220,
1441,
2560,
62,
77,
4147,
628,
198,
4299,
651,
62,
565,
66,
62,
9410,
62,
77,
4147,
7,
8094,
62,
8821,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
317,
1630,
1351,
5726,
460,
423,
1751,
379,
3294,
13760,
13,
198,
220,
220,
220,
11259,
257,
1448,
7955,
11,
428,
2163,
3769,
262,
1351,
286,
477,
1200,
13760,
287,
262,
6333,
13,
198,
220,
220,
220,
29206,
1539,
198,
220,
220,
220,
10373,
16,
4613,
10373,
16,
64,
11,
10373,
16,
65,
11,
10373,
16,
66,
11,
10373,
16,
67,
198,
220,
220,
220,
10373,
16,
65,
4613,
10373,
16,
65,
16,
11,
10373,
16,
65,
17,
198,
220,
220,
220,
11259,
10373,
16,
11,
340,
5860,
685,
5805,
16,
11,
10373,
16,
64,
11,
10373,
16,
65,
11,
10373,
16,
65,
16,
11,
10373,
16,
65,
17,
11,
10373,
16,
66,
11,
10373,
16,
67,
60,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1200,
62,
77,
4147,
796,
17635,
198,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
10139,
796,
6779,
8053,
30150,
13,
48205,
13,
1136,
7,
8821,
28,
8094,
62,
8821,
8,
198,
220,
220,
220,
2845,
6779,
8053,
30150,
13,
13921,
3673,
3109,
396,
25,
198,
220,
220,
220,
220,
220,
220,
220,
10139,
796,
6045,
628,
220,
220,
220,
611,
10139,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
10139,
13,
17197,
13,
1069,
1023,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1200,
62,
77,
4147,
13,
33295,
7,
17440,
13,
8821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1200,
287,
10139,
13,
17197,
13,
439,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1306,
62,
17197,
796,
651,
62,
565,
66,
62,
9410,
62,
77,
4147,
7,
9410,
13,
8821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1200,
62,
77,
4147,
13,
2302,
437,
7,
19545,
62,
17197,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1200,
62,
77,
4147,
13,
33295,
7,
8094,
62,
8821,
8,
628,
220,
220,
220,
1441,
1200,
62,
77,
4147,
198
] | 2.345221 | 701 |
import os
import logging
from .kubesubmitmixin import SubmitToKubeMixin
from .kubespecmixin import KubeSpecMixin
log = logging.getLogger(__name__)
| [
11748,
28686,
198,
11748,
18931,
198,
6738,
764,
74,
29080,
549,
2781,
19816,
259,
1330,
39900,
2514,
42,
3266,
35608,
259,
198,
6738,
764,
74,
29080,
431,
11215,
844,
259,
1330,
509,
3266,
22882,
35608,
259,
198,
198,
6404,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628
] | 2.921569 | 51 |
from typing import Optional
from spotty.config.abstract_instance_config import AbstractInstanceConfig
from spotty.providers.aws.config.validation import validate_instance_parameters
VOLUME_TYPE_EBS = 'ebs'
VOLUME_TYPE_EFS = 'efs'
DEFAULT_AMI_NAME = 'SpottyAMI'
| [
6738,
19720,
1330,
32233,
198,
198,
6738,
4136,
774,
13,
11250,
13,
397,
8709,
62,
39098,
62,
11250,
1330,
27741,
33384,
16934,
198,
6738,
4136,
774,
13,
15234,
4157,
13,
8356,
13,
11250,
13,
12102,
341,
1330,
26571,
62,
39098,
62,
17143,
7307,
198,
198,
44558,
38340,
62,
25216,
62,
36,
4462,
796,
705,
68,
1443,
6,
198,
44558,
38340,
62,
25216,
62,
36,
10652,
796,
705,
891,
82,
6,
198,
7206,
38865,
62,
43870,
62,
20608,
796,
705,
32565,
774,
43870,
6,
628
] | 3.142857 | 84 |
"""
Contains models for api app.
"""
import hashlib
import importlib
import csv
import re
import ujson
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import models, transaction, IntegrityError
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
def get_permission_defaults_from_apps():
"""
Return all valid permissions and their default values as a dict.
Gathers permissions from apps that are configured in
settings.API_PERMISSIONS. Apps that want to contribute permissions
to the APIUser model must have a `permissions` module that supplies
a DEFAULTS dict.
"""
permission_defaults = {}
for app_name in settings.API_PERMISSIONS:
perm = importlib.import_module('{}.permissions'.format(app_name))
permission_defaults.update(perm.DEFAULTS)
return permission_defaults
def remove_null_kwargs(**kwargs):
"""
Return a kwargs dict having items with a None value removed.
"""
return {k: v for k, v in kwargs.items() if v is not None}
class APIUser(models.Model):
"""
Provides fields/features for secrets and permissions.
"""
user = models.OneToOneField(User)
secret = models.CharField(max_length=128)
permissions = models.TextField(default='{}')
permission_defaults = get_permission_defaults_from_apps()
objects = APIUserManager()
def __init__(self, *args, **kwargs):
"""
When an APIUser object is initialized, the `secret` and
`permissions` fields may be set via a `secret_text` and
`permissions_dict` kwarg, respectively.
`secret_text` is the user-readable text of the secret, which is
encoded to produce the `secret` field value.
`permissions_dict` is a Python dict w/permissions to override
the defaults.
"""
pdict = ujson.decode(kwargs.pop('permissions', '{}')) or {}
pdict.update(kwargs.pop('permissions_dict', {}) or {})
secret_text = kwargs.pop('secret_text', None)
super(APIUser, self).__init__(*args, **kwargs)
self.update_permissions(pdict)
if not self.secret and secret_text is not None:
self.secret = self.encode_secret(secret_text)
def save(self, *args, **kwargs):
"""
An APIUser MUST have a `secret` and a `user` relation, and the
user must have a non-blank username, before the APIUser obj is
saved. Otherwise, an APIUserException is raised.
"""
msg = ''
if not self.secret:
msg = 'APIUser obj cannot be saved without a `secret`.'
else:
try:
self.user
except User.DoesNotExist:
msg = 'APIUser obj cannot be saved without a related user.'
else:
if not self.user.username:
msg = ('APIUser obj cannot be save if the related user '
'has a blank `username`.')
if msg:
raise APIUserException(msg)
super(APIUser, self).save(*args, **kwargs)
@transaction.atomic
def update_and_save(self, secret_text=None, permissions_dict=None,
password=None, email=None, first_name=None,
last_name=None):
"""
Update AND SAVE an existing APIUser with any or all new values.
For any of `email`, `password`, `first_name`, and `last_name`,
the related User object is updated with the appropriate
value(s).
"""
kwargs = remove_null_kwargs(password=password, email=email,
first_name=first_name, last_name=last_name)
for field, value in kwargs.items():
if field == 'password':
self.user.set_password(value)
else:
setattr(self.user, field, value)
if secret_text is not None:
self.secret = self.encode_secret(secret_text)
if permissions_dict:
self.update_permissions(permissions_dict)
self.user.save()
self.save()
return self
def update_permissions(self, permissions_dict):
"""
Update certain permissions' values via a `permissions_dict`.
The passed `permissions_dict` is a dictionary with key-value
pairs that set particular permissions (keys) to specific bool
values.
Names for the permissions that are set MUST exist in
cls.permission_defaults. An APIUserException is raised if an
unexpected permission is encountered.
Returns a dictionary of all user permissions after the update.
"""
permissions = type(self).permission_defaults.copy()
permissions.update(ujson.decode(self.permissions))
for pname, pvalue in permissions_dict.items():
if not isinstance(pvalue, bool):
msg = ('Permission values must be set to a boolean True or '
'False. "{}" is not valid.').format(pvalue)
raise APIUserException(msg)
if pname in permissions:
permissions[pname] = pvalue
else:
msg = 'Permission `{}` is not valid.'.format(pname)
raise APIUserException(msg)
self.permissions = ujson.encode(permissions)
return permissions
def set_permissions_to_value(self, permissions, value):
"""
Set certain permissions to the given `value` for this APIUser.
`permissions` is a list of permissions to set to the supplied
boolean value.
Returns a dictionary of all user permissions after the update.
"""
return self.update_permissions({pname: value for pname in permissions})
def set_all_permissions_to_value(self, value):
"""
Set ALL permissions for this APIUser to the given value.
Returns a dictionary of all user permissions after the update.
"""
permissions = self.permission_defaults.keys()
return self.set_permissions_to_value(permissions, value)
@staticmethod
def encode_secret(secret, hash_type='sha256'):
"""
Make and return a `secret` string for this APIUser.
`hash_type` should be a string representing the hashing
algorithm to use: md5, sha1, sha224, sha256, sha384, sha512.
"""
valid_hashes = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']
if hash_type not in valid_hashes:
raise APIUserException('Provided hash_type argument must be one '
'of: {}'.format(', '.join(valid_hashes)))
hasher = getattr(hashlib, hash_type)(secret)
return hasher.hexdigest()
| [
37811,
198,
4264,
1299,
4981,
329,
40391,
598,
13,
198,
37811,
198,
11748,
12234,
8019,
198,
11748,
1330,
8019,
198,
11748,
269,
21370,
198,
11748,
302,
198,
198,
11748,
334,
17752,
198,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
6738,
42625,
14208,
13,
7295,
13,
1069,
11755,
1330,
9515,
13921,
3673,
3109,
396,
198,
6738,
42625,
14208,
13,
9945,
1330,
4981,
11,
8611,
11,
39348,
12331,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
1330,
11787,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
1330,
8323,
5344,
628,
628,
198,
4299,
651,
62,
525,
3411,
62,
12286,
82,
62,
6738,
62,
18211,
33529,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8229,
477,
4938,
21627,
290,
511,
4277,
3815,
355,
257,
8633,
13,
628,
220,
220,
220,
402,
1032,
82,
21627,
422,
6725,
326,
389,
17839,
287,
198,
220,
220,
220,
6460,
13,
17614,
62,
18973,
44,
16744,
11053,
13,
27710,
326,
765,
284,
8676,
21627,
198,
220,
220,
220,
284,
262,
7824,
12982,
2746,
1276,
423,
257,
4600,
525,
8481,
63,
8265,
326,
9416,
198,
220,
220,
220,
257,
5550,
7708,
35342,
8633,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
7170,
62,
12286,
82,
796,
23884,
198,
220,
220,
220,
329,
598,
62,
3672,
287,
6460,
13,
17614,
62,
18973,
44,
16744,
11053,
25,
198,
220,
220,
220,
220,
220,
220,
220,
9943,
796,
1330,
8019,
13,
11748,
62,
21412,
10786,
90,
27422,
525,
8481,
4458,
18982,
7,
1324,
62,
3672,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
7170,
62,
12286,
82,
13,
19119,
7,
16321,
13,
7206,
7708,
35342,
8,
198,
220,
220,
220,
1441,
7170,
62,
12286,
82,
628,
198,
4299,
4781,
62,
8423,
62,
46265,
22046,
7,
1174,
46265,
22046,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
8229,
257,
479,
86,
22046,
8633,
1719,
3709,
351,
257,
6045,
1988,
4615,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1441,
1391,
74,
25,
410,
329,
479,
11,
410,
287,
479,
86,
22046,
13,
23814,
3419,
611,
410,
318,
407,
6045,
92,
628,
198,
198,
4871,
7824,
12982,
7,
27530,
13,
17633,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
47081,
7032,
14,
40890,
329,
13141,
290,
21627,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
2836,
796,
4981,
13,
3198,
2514,
3198,
15878,
7,
12982,
8,
198,
220,
220,
220,
3200,
796,
4981,
13,
12441,
15878,
7,
9806,
62,
13664,
28,
12762,
8,
198,
220,
220,
220,
21627,
796,
4981,
13,
8206,
15878,
7,
12286,
11639,
90,
92,
11537,
198,
220,
220,
220,
7170,
62,
12286,
82,
796,
651,
62,
525,
3411,
62,
12286,
82,
62,
6738,
62,
18211,
3419,
198,
220,
220,
220,
5563,
796,
7824,
12982,
13511,
3419,
628,
220,
220,
220,
825,
11593,
15003,
834,
7,
944,
11,
1635,
22046,
11,
12429,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1649,
281,
7824,
12982,
2134,
318,
23224,
11,
262,
4600,
21078,
63,
290,
198,
220,
220,
220,
220,
220,
220,
220,
4600,
525,
8481,
63,
7032,
743,
307,
900,
2884,
257,
4600,
21078,
62,
5239,
63,
290,
198,
220,
220,
220,
220,
220,
220,
220,
4600,
525,
8481,
62,
11600,
63,
479,
86,
853,
11,
8148,
13,
628,
220,
220,
220,
220,
220,
220,
220,
4600,
21078,
62,
5239,
63,
318,
262,
2836,
12,
46155,
2420,
286,
262,
3200,
11,
543,
318,
198,
220,
220,
220,
220,
220,
220,
220,
30240,
284,
4439,
262,
4600,
21078,
63,
2214,
1988,
13,
628,
220,
220,
220,
220,
220,
220,
220,
4600,
525,
8481,
62,
11600,
63,
318,
257,
11361,
8633,
266,
14,
525,
8481,
284,
20957,
198,
220,
220,
220,
220,
220,
220,
220,
262,
26235,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
279,
11600,
796,
334,
17752,
13,
12501,
1098,
7,
46265,
22046,
13,
12924,
10786,
525,
8481,
3256,
705,
90,
92,
6,
4008,
393,
23884,
198,
220,
220,
220,
220,
220,
220,
220,
279,
11600,
13,
19119,
7,
46265,
22046,
13,
12924,
10786,
525,
8481,
62,
11600,
3256,
23884,
8,
393,
23884,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3200,
62,
5239,
796,
479,
86,
22046,
13,
12924,
10786,
21078,
62,
5239,
3256,
6045,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
17614,
12982,
11,
2116,
737,
834,
15003,
834,
46491,
22046,
11,
12429,
46265,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
19119,
62,
525,
8481,
7,
79,
11600,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
2116,
13,
21078,
290,
3200,
62,
5239,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21078,
796,
2116,
13,
268,
8189,
62,
21078,
7,
21078,
62,
5239,
8,
628,
220,
220,
220,
825,
3613,
7,
944,
11,
1635,
22046,
11,
12429,
46265,
22046,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1052,
7824,
12982,
17191,
423,
257,
4600,
21078,
63,
290,
257,
4600,
7220,
63,
8695,
11,
290,
262,
198,
220,
220,
220,
220,
220,
220,
220,
2836,
1276,
423,
257,
1729,
12,
27190,
20579,
11,
878,
262,
7824,
12982,
26181,
318,
198,
220,
220,
220,
220,
220,
220,
220,
7448,
13,
15323,
11,
281,
7824,
12982,
16922,
318,
4376,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
31456,
796,
10148,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
2116,
13,
21078,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
796,
705,
17614,
12982,
26181,
2314,
307,
7448,
1231,
257,
4600,
21078,
63,
2637,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2845,
11787,
13,
13921,
3673,
3109,
396,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
796,
705,
17614,
12982,
26181,
2314,
307,
7448,
1231,
257,
3519,
2836,
2637,
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,
611,
407,
2116,
13,
7220,
13,
29460,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
796,
19203,
17614,
12982,
26181,
2314,
307,
3613,
611,
262,
3519,
2836,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10134,
257,
9178,
4600,
29460,
63,
2637,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
31456,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
7824,
12982,
16922,
7,
19662,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2208,
7,
17614,
12982,
11,
2116,
737,
21928,
46491,
22046,
11,
12429,
46265,
22046,
8,
628,
220,
220,
220,
2488,
7645,
2673,
13,
47116,
198,
220,
220,
220,
825,
4296,
62,
392,
62,
21928,
7,
944,
11,
3200,
62,
5239,
28,
14202,
11,
21627,
62,
11600,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9206,
28,
14202,
11,
3053,
28,
14202,
11,
717,
62,
3672,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
938,
62,
3672,
28,
14202,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10133,
5357,
14719,
6089,
281,
4683,
7824,
12982,
351,
597,
393,
477,
649,
3815,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1114,
597,
286,
4600,
12888,
47671,
4600,
28712,
47671,
4600,
11085,
62,
3672,
47671,
290,
4600,
12957,
62,
3672,
47671,
198,
220,
220,
220,
220,
220,
220,
220,
262,
3519,
11787,
2134,
318,
6153,
351,
262,
5035,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
7,
82,
737,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
479,
86,
22046,
796,
4781,
62,
8423,
62,
46265,
22046,
7,
28712,
28,
28712,
11,
3053,
28,
12888,
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,
717,
62,
3672,
28,
11085,
62,
3672,
11,
938,
62,
3672,
28,
12957,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2214,
11,
1988,
287,
479,
86,
22046,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2214,
6624,
705,
28712,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7220,
13,
2617,
62,
28712,
7,
8367,
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,
900,
35226,
7,
944,
13,
7220,
11,
2214,
11,
1988,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3200,
62,
5239,
318,
407,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21078,
796,
2116,
13,
268,
8189,
62,
21078,
7,
21078,
62,
5239,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
21627,
62,
11600,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
19119,
62,
525,
8481,
7,
525,
8481,
62,
11600,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
7220,
13,
21928,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21928,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
628,
220,
220,
220,
825,
4296,
62,
525,
8481,
7,
944,
11,
21627,
62,
11600,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
10133,
1728,
21627,
6,
3815,
2884,
257,
4600,
525,
8481,
62,
11600,
44646,
628,
220,
220,
220,
220,
220,
220,
220,
383,
3804,
4600,
525,
8481,
62,
11600,
63,
318,
257,
22155,
351,
1994,
12,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
14729,
326,
900,
1948,
21627,
357,
13083,
8,
284,
2176,
20512,
198,
220,
220,
220,
220,
220,
220,
220,
3815,
13,
628,
220,
220,
220,
220,
220,
220,
220,
28531,
329,
262,
21627,
326,
389,
900,
17191,
2152,
287,
198,
220,
220,
220,
220,
220,
220,
220,
537,
82,
13,
525,
3411,
62,
12286,
82,
13,
1052,
7824,
12982,
16922,
318,
4376,
611,
281,
198,
220,
220,
220,
220,
220,
220,
220,
10059,
7170,
318,
12956,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
257,
22155,
286,
477,
2836,
21627,
706,
262,
4296,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
21627,
796,
2099,
7,
944,
737,
525,
3411,
62,
12286,
82,
13,
30073,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
21627,
13,
19119,
7,
84,
17752,
13,
12501,
1098,
7,
944,
13,
525,
8481,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
329,
279,
3672,
11,
279,
8367,
287,
21627,
62,
11600,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
79,
8367,
11,
20512,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
796,
19203,
5990,
3411,
3815,
1276,
307,
900,
284,
257,
25131,
6407,
393,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
25101,
13,
45144,
36786,
318,
407,
4938,
2637,
737,
18982,
7,
79,
8367,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
7824,
12982,
16922,
7,
19662,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
279,
3672,
287,
21627,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21627,
58,
79,
3672,
60,
796,
279,
8367,
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,
31456,
796,
705,
5990,
3411,
4600,
90,
92,
63,
318,
407,
4938,
2637,
13,
18982,
7,
79,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
7824,
12982,
16922,
7,
19662,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
525,
8481,
796,
334,
17752,
13,
268,
8189,
7,
525,
8481,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
21627,
628,
220,
220,
220,
825,
900,
62,
525,
8481,
62,
1462,
62,
8367,
7,
944,
11,
21627,
11,
1988,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5345,
1728,
21627,
284,
262,
1813,
4600,
8367,
63,
329,
428,
7824,
12982,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
4600,
525,
8481,
63,
318,
257,
1351,
286,
21627,
284,
900,
284,
262,
14275,
198,
220,
220,
220,
220,
220,
220,
220,
25131,
1988,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
257,
22155,
286,
477,
2836,
21627,
706,
262,
4296,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
19119,
62,
525,
8481,
15090,
79,
3672,
25,
1988,
329,
279,
3672,
287,
21627,
30072,
628,
220,
220,
220,
825,
900,
62,
439,
62,
525,
8481,
62,
1462,
62,
8367,
7,
944,
11,
1988,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
5345,
11096,
21627,
329,
428,
7824,
12982,
284,
262,
1813,
1988,
13,
628,
220,
220,
220,
220,
220,
220,
220,
16409,
257,
22155,
286,
477,
2836,
21627,
706,
262,
4296,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
21627,
796,
2116,
13,
525,
3411,
62,
12286,
82,
13,
13083,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2116,
13,
2617,
62,
525,
8481,
62,
1462,
62,
8367,
7,
525,
8481,
11,
1988,
8,
628,
220,
220,
220,
2488,
12708,
24396,
198,
220,
220,
220,
825,
37773,
62,
21078,
7,
21078,
11,
12234,
62,
4906,
11639,
26270,
11645,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
6889,
290,
1441,
257,
4600,
21078,
63,
4731,
329,
428,
7824,
12982,
13,
628,
220,
220,
220,
220,
220,
220,
220,
4600,
17831,
62,
4906,
63,
815,
307,
257,
4731,
10200,
262,
49544,
198,
220,
220,
220,
220,
220,
220,
220,
11862,
284,
779,
25,
45243,
20,
11,
427,
64,
16,
11,
427,
64,
24137,
11,
427,
64,
11645,
11,
427,
64,
22842,
11,
427,
64,
25836,
13,
198,
220,
220,
220,
220,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
4938,
62,
71,
7465,
796,
37250,
9132,
20,
3256,
705,
26270,
16,
3256,
705,
26270,
24137,
3256,
705,
26270,
11645,
3256,
705,
26270,
22842,
3256,
705,
26270,
25836,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
611,
12234,
62,
4906,
407,
287,
4938,
62,
71,
7465,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5298,
7824,
12982,
16922,
10786,
15946,
1384,
12234,
62,
4906,
4578,
1276,
307,
530,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1659,
25,
23884,
4458,
18982,
7,
3256,
45302,
22179,
7,
12102,
62,
71,
7465,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
468,
372,
796,
651,
35226,
7,
17831,
8019,
11,
12234,
62,
4906,
5769,
21078,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
468,
372,
13,
33095,
12894,
395,
3419,
198
] | 2.435622 | 2,796 |
from .errors import InvalidInputError
| [
6738,
764,
48277,
1330,
17665,
20560,
12331,
628
] | 4.875 | 8 |
import torch
| [
11748,
28034,
198
] | 4.333333 | 3 |
from time import sleep
import scrapy
from scrapy import Request
# usage: `scrapy crawl fd-sitemap-css -o ./sitemapURLs/fdlinks.json` | [
6738,
640,
1330,
3993,
198,
11748,
15881,
88,
198,
6738,
15881,
88,
1330,
19390,
198,
198,
2,
8748,
25,
4600,
1416,
2416,
88,
27318,
277,
67,
12,
82,
9186,
499,
12,
25471,
532,
78,
24457,
82,
9186,
499,
21886,
82,
14,
16344,
28751,
13,
17752,
63
] | 2.891304 | 46 |
# Generated by Django 2.2.10 on 2020-03-19 15:29
import django.db.models.deletion
from django.db import migrations, models
| [
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
940,
319,
12131,
12,
3070,
12,
1129,
1315,
25,
1959,
198,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
628
] | 2.840909 | 44 |
"""Custom parser which raises an error instead of exiting."""
import argparse
class ArgumentParserError(Exception):
"""Error raised by ArgumentParser"""
pass
class CatParser(argparse.ArgumentParser):
"""Overrides error method to throw an error instead of exiting"""
| [
37811,
15022,
30751,
543,
12073,
281,
4049,
2427,
286,
33895,
526,
15931,
198,
11748,
1822,
29572,
628,
198,
4871,
45751,
46677,
12331,
7,
16922,
2599,
198,
220,
220,
220,
37227,
12331,
4376,
416,
45751,
46677,
37811,
198,
220,
220,
220,
1208,
628,
198,
4871,
5181,
46677,
7,
853,
29572,
13,
28100,
1713,
46677,
2599,
198,
220,
220,
220,
37227,
5886,
81,
1460,
4049,
2446,
284,
3714,
281,
4049,
2427,
286,
33895,
37811,
198
] | 3.863014 | 73 |
from .main import cli
__version__ = 1.0
__all__ = ['cli'] | [
6738,
764,
12417,
1330,
537,
72,
198,
198,
834,
9641,
834,
796,
352,
13,
15,
198,
198,
834,
439,
834,
796,
37250,
44506,
20520
] | 2.458333 | 24 |
"""
link: https://leetcode-cn.com/problems/heaters
problem: 给定数轴上若干A类型的点,再给B类型的点,问以所有B为圆心画圆,最小半径是多少可以覆盖所有的A
solution: 二分。所有A点由其最近的B负责覆盖,结果为此集合中的最大值。
"""
| [
37811,
198,
198,
8726,
25,
3740,
1378,
293,
316,
8189,
12,
31522,
13,
785,
14,
1676,
22143,
14,
258,
8605,
198,
198,
45573,
25,
13328,
119,
247,
22522,
248,
46763,
108,
164,
121,
112,
41468,
164,
233,
98,
33176,
110,
32,
163,
109,
119,
161,
252,
233,
21410,
163,
224,
117,
171,
120,
234,
37863,
235,
163,
119,
247,
33,
163,
109,
119,
161,
252,
233,
21410,
163,
224,
117,
171,
120,
234,
29785,
106,
20015,
98,
33699,
222,
17312,
231,
33,
10310,
118,
28839,
228,
33232,
225,
18796,
119,
28839,
228,
171,
120,
234,
17312,
222,
22887,
237,
39355,
232,
36181,
226,
42468,
13783,
248,
22887,
239,
20998,
107,
20015,
98,
17358,
228,
33566,
244,
33699,
222,
17312,
231,
21410,
32,
198,
198,
82,
2122,
25,
220,
12859,
234,
26344,
228,
16764,
33699,
222,
17312,
231,
32,
163,
224,
117,
18796,
109,
17739,
114,
17312,
222,
32573,
239,
21410,
33,
164,
112,
253,
164,
112,
96,
17358,
228,
33566,
244,
171,
120,
234,
163,
119,
241,
162,
252,
250,
10310,
118,
29826,
97,
37239,
228,
28938,
230,
40792,
21410,
17312,
222,
32014,
161,
222,
120,
16764,
198,
198,
37811,
198
] | 0.82199 | 191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.