content
stringlengths 1
1.05M
| input_ids
sequencelengths 1
883k
| ratio_char_token
float64 1
22.9
| token_count
int64 1
883k
|
---|---|---|---|
import tempfile
from pathlib import Path
import pytest
from dug_helpers.dug_utils import FileFetcher, get_topmed_files, get_dbgap_files
from roger.Config import config
| [
11748,
20218,
7753,
198,
198,
6738,
3108,
8019,
1330,
10644,
198,
198,
11748,
12972,
9288,
198,
198,
6738,
18735,
62,
16794,
364,
13,
646,
70,
62,
26791,
1330,
9220,
37,
316,
2044,
11,
651,
62,
4852,
1150,
62,
16624,
11,
651,
62,
9945,
43554,
62,
16624,
198,
6738,
686,
1362,
13,
16934,
1330,
4566,
628,
628
] | 3.107143 | 56 |
# coding: utf-8
# truepy
# Copyright (C) 2014-2015 Moses Palmr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
from datetime import datetime
from truepy import fromstring, tostring
from truepy._bean import snake_to_camel, camel_to_snake
from truepy._bean import value_to_xml
from truepy._bean import deserialize, serialize, to_document
from truepy._bean_serializers import _DESERIALIZER_CLASSES, bean_class
| [
2,
19617,
25,
3384,
69,
12,
23,
198,
2,
2081,
9078,
198,
2,
15069,
357,
34,
8,
1946,
12,
4626,
19010,
18358,
81,
198,
2,
198,
2,
770,
1430,
318,
1479,
3788,
25,
345,
460,
17678,
4163,
340,
290,
14,
273,
13096,
340,
739,
198,
2,
262,
2846,
286,
262,
22961,
3611,
5094,
13789,
355,
3199,
416,
262,
3232,
10442,
198,
2,
5693,
11,
2035,
2196,
513,
286,
262,
13789,
11,
393,
357,
265,
534,
3038,
8,
597,
1568,
198,
2,
2196,
13,
198,
2,
198,
2,
770,
1430,
318,
9387,
287,
262,
2911,
326,
340,
481,
307,
4465,
11,
475,
42881,
198,
2,
15529,
34764,
56,
26,
1231,
772,
262,
17142,
18215,
286,
34482,
3398,
1565,
5603,
25382,
393,
376,
46144,
198,
2,
7473,
317,
16652,
2149,
37232,
33079,
48933,
13,
4091,
262,
22961,
3611,
5094,
13789,
329,
517,
198,
2,
3307,
13,
198,
2,
198,
2,
921,
815,
423,
2722,
257,
4866,
286,
262,
22961,
3611,
5094,
13789,
1863,
351,
198,
2,
428,
1430,
13,
1002,
407,
11,
766,
1279,
4023,
1378,
2503,
13,
41791,
13,
2398,
14,
677,
4541,
15913,
13,
198,
198,
11748,
555,
715,
395,
628,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
198,
6738,
2081,
9078,
1330,
422,
8841,
11,
284,
8841,
198,
6738,
2081,
9078,
13557,
14289,
1330,
17522,
62,
1462,
62,
66,
17983,
11,
41021,
62,
1462,
62,
16184,
539,
198,
6738,
2081,
9078,
13557,
14289,
1330,
1988,
62,
1462,
62,
19875,
198,
6738,
2081,
9078,
13557,
14289,
1330,
748,
48499,
1096,
11,
11389,
1096,
11,
284,
62,
22897,
198,
6738,
2081,
9078,
13557,
14289,
62,
46911,
11341,
1330,
4808,
30910,
1137,
12576,
14887,
1137,
62,
31631,
1546,
11,
26394,
62,
4871,
628
] | 3.595745 | 282 |
# -*- coding: utf-8 -*-
from elasticsearch import Elasticsearch
from datetime import timedelta
import datetime
import os
import json
import logging
from configparser import ConfigParser
#
logging.basicConfig(filename='logging_es.log', level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def write_list_to_json(list, json_file_name, json_file_save_path):
"""
listjson
:param list:
:param json_file_name: json
:param json_file_save_path: json
:return:
"""
if not os.path.exists(json_file_save_path):
os.makedirs(json_file_save_path)
os.chdir(json_file_save_path)
with open(json_file_name, 'w', encoding='utf-8') as f:
json.dump(list, f, ensure_ascii=False)
if __name__ == '__main__':
start_date_time = datetime.datetime.now() + timedelta(days=-1)
end_date_time = datetime.datetime.now()
start_time = start_date_time.strftime("%Y-%m-%dT%H:00:00.000Z")
end_time = end_date_time.strftime("%Y-%m-%dT%H:00:00.000Z")
#
es_dict = read_config()
#
BASE_DIR = os.getcwd()
# esjson
es_json(es_dict, start_time, end_time)
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
6738,
27468,
12947,
1330,
48567,
12947,
198,
6738,
4818,
8079,
1330,
28805,
12514,
198,
11748,
4818,
8079,
198,
11748,
28686,
198,
11748,
33918,
198,
11748,
18931,
198,
6738,
4566,
48610,
1330,
17056,
46677,
198,
198,
2,
220,
198,
6404,
2667,
13,
35487,
16934,
7,
34345,
11639,
6404,
2667,
62,
274,
13,
6404,
3256,
1241,
28,
6404,
2667,
13,
10778,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5794,
11639,
4,
7,
292,
310,
524,
8,
82,
532,
4064,
7,
3672,
8,
82,
532,
4064,
7,
5715,
3672,
8,
82,
532,
4064,
7,
20500,
8,
82,
11537,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
628,
198,
198,
4299,
3551,
62,
4868,
62,
1462,
62,
17752,
7,
4868,
11,
33918,
62,
7753,
62,
3672,
11,
33918,
62,
7753,
62,
21928,
62,
6978,
2599,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
1351,
17752,
198,
220,
220,
220,
1058,
17143,
1351,
25,
198,
220,
220,
220,
1058,
17143,
33918,
62,
7753,
62,
3672,
25,
33918,
198,
220,
220,
220,
1058,
17143,
33918,
62,
7753,
62,
21928,
62,
6978,
25,
33918,
198,
220,
220,
220,
1058,
7783,
25,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
407,
28686,
13,
6978,
13,
1069,
1023,
7,
17752,
62,
7753,
62,
21928,
62,
6978,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
17752,
62,
7753,
62,
21928,
62,
6978,
8,
198,
220,
220,
220,
28686,
13,
354,
15908,
7,
17752,
62,
7753,
62,
21928,
62,
6978,
8,
198,
220,
220,
220,
351,
1280,
7,
17752,
62,
7753,
62,
3672,
11,
705,
86,
3256,
21004,
11639,
40477,
12,
23,
11537,
355,
277,
25,
198,
220,
220,
220,
220,
220,
220,
220,
33918,
13,
39455,
7,
4868,
11,
277,
11,
4155,
62,
292,
979,
72,
28,
25101,
8,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
923,
62,
4475,
62,
2435,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
1343,
28805,
12514,
7,
12545,
10779,
16,
8,
198,
220,
220,
220,
886,
62,
4475,
62,
2435,
796,
4818,
8079,
13,
19608,
8079,
13,
2197,
3419,
198,
220,
220,
220,
923,
62,
2435,
796,
923,
62,
4475,
62,
2435,
13,
2536,
31387,
7203,
4,
56,
12,
4,
76,
12,
4,
67,
51,
4,
39,
25,
405,
25,
405,
13,
830,
57,
4943,
198,
220,
220,
220,
886,
62,
2435,
796,
886,
62,
4475,
62,
2435,
13,
2536,
31387,
7203,
4,
56,
12,
4,
76,
12,
4,
67,
51,
4,
39,
25,
405,
25,
405,
13,
830,
57,
4943,
198,
220,
220,
220,
1303,
220,
198,
220,
220,
220,
1658,
62,
11600,
796,
1100,
62,
11250,
3419,
198,
220,
220,
220,
1303,
220,
198,
220,
220,
220,
49688,
62,
34720,
796,
28686,
13,
1136,
66,
16993,
3419,
198,
220,
220,
220,
1303,
1658,
17752,
198,
220,
220,
220,
1658,
62,
17752,
7,
274,
62,
11600,
11,
923,
62,
2435,
11,
886,
62,
2435,
8,
628
] | 2.275992 | 529 |
__version__ = """1.8.4""" | [
834,
9641,
834,
796,
37227,
16,
13,
23,
13,
19,
37811
] | 2.272727 | 11 |
from django.contrib import admin
# general admin settings
admin.site.site_header = 'Danesfield Admin'
admin.site.site_title = 'Danesfield Admin'
| [
6738,
42625,
14208,
13,
3642,
822,
1330,
13169,
198,
198,
2,
2276,
13169,
6460,
198,
28482,
13,
15654,
13,
15654,
62,
25677,
796,
705,
35,
7305,
3245,
32053,
6,
198,
28482,
13,
15654,
13,
15654,
62,
7839,
796,
705,
35,
7305,
3245,
32053,
6,
198
] | 3.244444 | 45 |
#!/usr/bin/env python
# encoding: utf-8
"""
expfitting.py
Provide single or double exponential fits to data.
"""
import lmfit
import numpy as np
import scipy.optimize
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
21004,
25,
3384,
69,
12,
23,
198,
37811,
198,
11201,
32232,
13,
9078,
198,
15946,
485,
2060,
393,
4274,
39682,
11414,
284,
1366,
13,
198,
37811,
198,
198,
11748,
300,
76,
11147,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
629,
541,
88,
13,
40085,
1096,
628,
198
] | 2.931034 | 58 |
# pylint: disable=no-member
from datetime import datetime
from typing import Optional, Dict
from django.db import transaction, models
from django.apps import apps
from django_cloud_tasks import tasks, serializers
__all__ = (
"Routine",
"RoutineVertex",
"Pipeline",
)
| [
2,
279,
2645,
600,
25,
15560,
28,
3919,
12,
19522,
198,
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
19720,
1330,
32233,
11,
360,
713,
198,
6738,
42625,
14208,
13,
9945,
1330,
8611,
11,
4981,
198,
6738,
42625,
14208,
13,
18211,
1330,
6725,
198,
6738,
42625,
14208,
62,
17721,
62,
83,
6791,
1330,
8861,
11,
11389,
11341,
628,
628,
198,
198,
834,
439,
834,
796,
357,
198,
220,
220,
220,
366,
49,
28399,
1600,
198,
220,
220,
220,
366,
49,
28399,
13414,
16886,
1600,
198,
220,
220,
220,
366,
47,
541,
4470,
1600,
198,
8,
198
] | 2.958333 | 96 |
from datetime import datetime
from uuid import UUID
from ...serializer import IfoodSerializable
from ...utils import auto_str
from uuid import UUID
| [
6738,
4818,
8079,
1330,
4818,
8079,
198,
6738,
334,
27112,
1330,
471,
27586,
198,
6738,
2644,
46911,
7509,
1330,
1002,
702,
32634,
13821,
198,
6738,
2644,
26791,
1330,
8295,
62,
2536,
198,
198,
6738,
334,
27112,
1330,
471,
27586,
628,
198
] | 3.682927 | 41 |
# Importing section
import json
import requests
import argparse
import logging
import time
import datetime
from classes.time_utils import TimeUtils
import utilities as u
# Main
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('-c', help='config file')
arg_parser.add_argument('-l', help='log file')
args = arg_parser.parse_args()
cfg = json.loads(open(args.c).read())
# Get configuration about connections to InfluxDB and remote service related to data retrieving
tmp_config = json.loads(open(cfg['connectionsFile']).read())
cfg.update(tmp_config)
# set logging object
logger = logging.getLogger()
logger.setLevel(logging.INFO)
if not args.l:
log_file = None
else:
log_file = args.l
logger = logging.getLogger()
logging.basicConfig(format='%(asctime)-15s::%(threadName)s::%(levelname)s::%(funcName)s::%(message)s',
level=logging.INFO, filename=log_file)
url_prefix = cfg['sidechainRestApi']
logger.info('Starting program')
# Get the aggregator
res = requests.get('%s/aggregator' % cfg['sidechainRestApi'])
aggregator_id = json.loads(res.text)['Aggregator']['idx']
# Cycle over the configured SLAs
for sla in cfg['slas']:
dt_start, dt_end, _ = TimeUtils.get_start_end(sla['duration'], cfg['utils']['timeZone'])
dt_start = dt_start - datetime.timedelta(minutes=cfg['shiftBackMinutes']['kpiSetting'])
dt_end = dt_end - datetime.timedelta(minutes=cfg['shiftBackMinutes']['kpiSetting'])
sla_idx = '%s_%i-%i' % (sla['idPrefix'], int(dt_start.timestamp()), int(dt_end.timestamp()))
params = {
'idx': sla_idx,
'start': int(dt_start.timestamp()),
'end': int(dt_end.timestamp()),
}
u.send_post('%s/createSla' % url_prefix, params, logger)
time.sleep(cfg['utils']['sleepBetweenTransactions'])
# Cycle over the configured KPIs
for kpi in sla['kpis']:
params = {
'idx': '%s_%i-%i' % (kpi['idPrefix'], int(dt_start.timestamp()), int(dt_end.timestamp())),
'idxSla': sla_idx,
'rule': kpi['rule'],
'limit': kpi['limit'],
'measureUnit': kpi['mu'],
'penalty': kpi['penalty'],
'players': kpi['players'],
}
u.send_post('%s/createKpiFeatures' % url_prefix, params, logger)
time.sleep(cfg['utils']['sleepBetweenTransactions'])
logger.info('Ending program')
| [
2,
17267,
278,
2665,
198,
11748,
33918,
198,
11748,
7007,
198,
11748,
1822,
29572,
198,
11748,
18931,
198,
11748,
640,
198,
11748,
4818,
8079,
198,
6738,
6097,
13,
2435,
62,
26791,
1330,
3862,
18274,
4487,
198,
198,
11748,
20081,
355,
334,
198,
198,
2,
8774,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1822,
62,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
220,
220,
220,
1822,
62,
48610,
13,
2860,
62,
49140,
10786,
12,
66,
3256,
1037,
11639,
11250,
2393,
11537,
198,
220,
220,
220,
1822,
62,
48610,
13,
2860,
62,
49140,
10786,
12,
75,
3256,
1037,
11639,
6404,
2393,
11537,
628,
220,
220,
220,
26498,
796,
1822,
62,
48610,
13,
29572,
62,
22046,
3419,
198,
220,
220,
220,
30218,
70,
796,
33918,
13,
46030,
7,
9654,
7,
22046,
13,
66,
737,
961,
28955,
628,
220,
220,
220,
1303,
3497,
8398,
546,
8787,
284,
4806,
22564,
11012,
290,
6569,
2139,
3519,
284,
1366,
50122,
198,
220,
220,
220,
45218,
62,
11250,
796,
33918,
13,
46030,
7,
9654,
7,
37581,
17816,
8443,
507,
8979,
20520,
737,
961,
28955,
198,
220,
220,
220,
30218,
70,
13,
19119,
7,
22065,
62,
11250,
8,
628,
220,
220,
220,
1303,
900,
18931,
2134,
198,
220,
220,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
3419,
198,
220,
220,
220,
49706,
13,
2617,
4971,
7,
6404,
2667,
13,
10778,
8,
198,
220,
220,
220,
611,
407,
26498,
13,
75,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
62,
7753,
796,
6045,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
2604,
62,
7753,
796,
26498,
13,
75,
628,
220,
220,
220,
49706,
796,
18931,
13,
1136,
11187,
1362,
3419,
198,
220,
220,
220,
18931,
13,
35487,
16934,
7,
18982,
11639,
4,
7,
292,
310,
524,
13219,
1314,
82,
3712,
4,
7,
16663,
5376,
8,
82,
3712,
4,
7,
5715,
3672,
8,
82,
3712,
4,
7,
20786,
5376,
8,
82,
3712,
4,
7,
20500,
8,
82,
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,
1241,
28,
6404,
2667,
13,
10778,
11,
29472,
28,
6404,
62,
7753,
8,
628,
220,
220,
220,
19016,
62,
40290,
796,
30218,
70,
17816,
1589,
7983,
19452,
32,
14415,
20520,
628,
220,
220,
220,
49706,
13,
10951,
10786,
22851,
1430,
11537,
628,
220,
220,
220,
1303,
3497,
262,
13262,
1352,
198,
220,
220,
220,
581,
796,
7007,
13,
1136,
10786,
4,
82,
14,
9460,
2301,
1352,
6,
4064,
30218,
70,
17816,
1589,
7983,
19452,
32,
14415,
6,
12962,
198,
220,
220,
220,
13262,
1352,
62,
312,
796,
33918,
13,
46030,
7,
411,
13,
5239,
8,
17816,
46384,
2301,
1352,
6,
7131,
6,
312,
87,
20520,
628,
220,
220,
220,
1303,
26993,
625,
262,
17839,
12419,
1722,
198,
220,
220,
220,
329,
1017,
64,
287,
30218,
70,
17816,
6649,
292,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
288,
83,
62,
9688,
11,
288,
83,
62,
437,
11,
4808,
796,
3862,
18274,
4487,
13,
1136,
62,
9688,
62,
437,
7,
82,
5031,
17816,
32257,
6,
4357,
30218,
70,
17816,
26791,
6,
7131,
6,
2435,
26961,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
288,
83,
62,
9688,
796,
288,
83,
62,
9688,
532,
4818,
8079,
13,
16514,
276,
12514,
7,
1084,
1769,
28,
37581,
17816,
30846,
7282,
9452,
1769,
6,
7131,
6,
74,
14415,
34149,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
288,
83,
62,
437,
796,
288,
83,
62,
437,
532,
4818,
8079,
13,
16514,
276,
12514,
7,
1084,
1769,
28,
37581,
17816,
30846,
7282,
9452,
1769,
6,
7131,
6,
74,
14415,
34149,
6,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1017,
64,
62,
312,
87,
796,
705,
4,
82,
62,
4,
72,
12,
4,
72,
6,
4064,
357,
82,
5031,
17816,
312,
36698,
844,
6,
4357,
493,
7,
28664,
62,
9688,
13,
16514,
27823,
3419,
828,
493,
7,
28664,
62,
437,
13,
16514,
27823,
3419,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
42287,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
312,
87,
10354,
1017,
64,
62,
312,
87,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
9688,
10354,
493,
7,
28664,
62,
9688,
13,
16514,
27823,
3419,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
437,
10354,
493,
7,
28664,
62,
437,
13,
16514,
27823,
3419,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
220,
220,
220,
220,
220,
220,
220,
334,
13,
21280,
62,
7353,
10786,
4,
82,
14,
17953,
50,
5031,
6,
4064,
19016,
62,
40290,
11,
42287,
11,
49706,
8,
198,
220,
220,
220,
220,
220,
220,
220,
640,
13,
42832,
7,
37581,
17816,
26791,
6,
7131,
6,
42832,
25262,
8291,
4658,
6,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
26993,
625,
262,
17839,
45814,
3792,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
14415,
287,
1017,
64,
17816,
74,
79,
271,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42287,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
312,
87,
10354,
705,
4,
82,
62,
4,
72,
12,
4,
72,
6,
4064,
357,
74,
14415,
17816,
312,
36698,
844,
6,
4357,
493,
7,
28664,
62,
9688,
13,
16514,
27823,
3419,
828,
493,
7,
28664,
62,
437,
13,
16514,
27823,
28955,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
312,
87,
50,
5031,
10354,
1017,
64,
62,
312,
87,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
25135,
10354,
479,
14415,
17816,
25135,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
32374,
10354,
479,
14415,
17816,
32374,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
1326,
5015,
26453,
10354,
479,
14415,
17816,
30300,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
3617,
6017,
10354,
479,
14415,
17816,
3617,
6017,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
32399,
10354,
479,
14415,
17816,
32399,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
13,
21280,
62,
7353,
10786,
4,
82,
14,
17953,
42,
14415,
23595,
6,
4064,
19016,
62,
40290,
11,
42287,
11,
49706,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
640,
13,
42832,
7,
37581,
17816,
26791,
6,
7131,
6,
42832,
25262,
8291,
4658,
6,
12962,
628,
220,
220,
220,
49706,
13,
10951,
10786,
12915,
278,
1430,
11537,
198
] | 2.204411 | 1,179 |
from spinnman.messages.scp.abstract_messages.abstract_scp_request\
import AbstractSCPRequest
from spinnman.messages.sdp.sdp_flag import SDPFlag
from spinnman.messages.sdp.sdp_header import SDPHeader
from spinnman.messages.scp.scp_request_header import SCPRequestHeader
from spinnman.messages.scp.scp_command import SCPCommand
from spinnman.messages.scp.impl.scp_version_response import SCPVersionResponse
| [
6738,
599,
3732,
805,
13,
37348,
1095,
13,
1416,
79,
13,
397,
8709,
62,
37348,
1095,
13,
397,
8709,
62,
1416,
79,
62,
25927,
59,
198,
220,
220,
220,
1330,
27741,
48956,
18453,
198,
6738,
599,
3732,
805,
13,
37348,
1095,
13,
21282,
79,
13,
21282,
79,
62,
32109,
1330,
311,
6322,
34227,
198,
6738,
599,
3732,
805,
13,
37348,
1095,
13,
21282,
79,
13,
21282,
79,
62,
25677,
1330,
311,
6322,
39681,
198,
6738,
599,
3732,
805,
13,
37348,
1095,
13,
1416,
79,
13,
1416,
79,
62,
25927,
62,
25677,
1330,
17527,
18453,
39681,
198,
6738,
599,
3732,
805,
13,
37348,
1095,
13,
1416,
79,
13,
1416,
79,
62,
21812,
1330,
6374,
5662,
2002,
392,
198,
6738,
599,
3732,
805,
13,
37348,
1095,
13,
1416,
79,
13,
23928,
13,
1416,
79,
62,
9641,
62,
26209,
1330,
17527,
14815,
31077,
628
] | 2.907801 | 141 |
from Cocoa import *
from Quartz import *
from SampleCIView import SampleCIView
from math import sin
import objc
NUM_POINTS=4
| [
6738,
18490,
12162,
1330,
1635,
198,
6738,
45976,
1330,
1635,
198,
198,
6738,
27565,
34,
3824,
769,
1330,
27565,
34,
3824,
769,
198,
198,
6738,
10688,
1330,
7813,
198,
198,
11748,
26181,
66,
198,
198,
41359,
62,
16402,
1268,
4694,
28,
19,
198
] | 3 | 43 |
from pathlib import Path
from fhir.resources.codesystem import CodeSystem
from oops_fhir.utils import CodeSystemConcept
__all__ = ["RequestIntent"]
_resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
| [
6738,
3108,
8019,
1330,
10644,
198,
198,
6738,
277,
71,
343,
13,
37540,
13,
40148,
6781,
1330,
6127,
11964,
198,
198,
6738,
267,
2840,
62,
69,
71,
343,
13,
26791,
1330,
6127,
11964,
3103,
984,
628,
198,
834,
439,
834,
796,
14631,
18453,
5317,
298,
8973,
198,
198,
62,
31092,
796,
6127,
11964,
13,
29572,
62,
7753,
7,
15235,
7,
834,
7753,
834,
737,
4480,
62,
37333,
844,
7,
1911,
17752,
48774,
628
] | 3.082192 | 73 |
if __name__ == '__main__':
main()
| [
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.105263 | 19 |
from .app import create_app
# creates the app by calling the package
APP = create_app() | [
6738,
764,
1324,
1330,
2251,
62,
1324,
198,
198,
2,
8075,
262,
598,
416,
4585,
262,
5301,
198,
24805,
796,
2251,
62,
1324,
3419
] | 3.666667 | 24 |
from flask_restplus import Api
API = Api(
title="Book API",
version='1.0',
description="This Api provides endpoint for accessing books and their reviews."
)
| [
6738,
42903,
62,
2118,
9541,
1330,
5949,
72,
198,
198,
17614,
796,
5949,
72,
7,
198,
220,
220,
220,
3670,
2625,
10482,
7824,
1600,
198,
220,
220,
220,
2196,
11639,
16,
13,
15,
3256,
198,
220,
220,
220,
6764,
2625,
1212,
5949,
72,
3769,
36123,
329,
22534,
3835,
290,
511,
8088,
526,
198,
8,
198
] | 3.090909 | 55 |
import unittest
from game import Game
from suit import Suit
if __name__ == '__main__':
unittest.main()
| [
11748,
555,
715,
395,
198,
198,
6738,
983,
1330,
3776,
198,
6738,
6050,
1330,
28871,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
555,
715,
395,
13,
12417,
3419,
198
] | 2.846154 | 39 |
from PyConstants import Paths
from PyConstants import Codes
from PyConstants import CacheTimes
from PyBaseTest import BaseTest
from PyRequest import PyRequest
import time
| [
6738,
9485,
34184,
1187,
1330,
10644,
82,
198,
6738,
9485,
34184,
1187,
1330,
44380,
198,
6738,
9485,
34184,
1187,
1330,
34088,
28595,
198,
6738,
9485,
14881,
14402,
1330,
7308,
14402,
198,
6738,
9485,
18453,
1330,
9485,
18453,
198,
11748,
640,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198
] | 3.6 | 50 |
from __future__ import unicode_literals
from hypothesis.strategies import integers
from star_ratings import app_settings
| [
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
14078,
13,
2536,
2397,
444,
1330,
37014,
198,
6738,
3491,
62,
10366,
654,
1330,
598,
62,
33692,
628
] | 3.967742 | 31 |
''''''
from .Bird import Bird
from .Pipe import Pipe | [
39115,
7061,
198,
6738,
764,
42562,
1330,
14506,
198,
6738,
764,
47,
3757,
1330,
36039
] | 3.466667 | 15 |
import os.path
import configparser
from dircheck import get_yesno_input
import create_jobscripts
from create_dirname_config import config_dirname_cfg
from create_all_dirs import create_all
import socket
import cgns_load_data
# Script that creates the two configuration files (case and render files) necessary to run the scripts, with a data file from Abhiram's body flow simulation as input.
# Check whether scripts being run on Mox
if socket.gethostname()[0:3] == "mox":
mox = True
blender_dir = "/gscratch/ferrante/blender/blender-2.78c-linux-glibc219-x86_64/./"
else:
mox = False
blender_dir = ""
# Check if dirname.cfg, which contains directory paths used throughout the scripts, exists - otherwise, create it
if not os.path.exists("dirname.cfg"):
config_dirname_cfg()
# Load important directories
dirname_config = configparser.ConfigParser()
dirname_config.read("dirname.cfg")
# Get case name. This corresponds to a specific .h5dns file and is specified by the user. A case config file will be created with its name.
case_name = input("Enter case name. This can be any string that refers to a particular VIZ.cgns file. ")
create_all(case_name)
case_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + case_name + "-case.cfg"
# If existing case config file exists, the user is specifying a particular .h5dns file that is already associated with
# this case name, so move on to render settings config. Otherwise, create case config file from user input.
if os.path.exists(case_config_path):
print("Found existing case configuration: " + case_config_path)
existing_case_config = configparser.ConfigParser()
existing_case_config.read(case_config_path)
print("data file: " + existing_case_config["STRING"]["h5dns_path"])
else:
# Create new case config file
new_case_config = configparser.ConfigParser()
# There are different sections for each datatype (this is how the scripts know what data types to load, when they are all saved as strings)
new_case_config["STRING"] = {}
new_case_config["FLOAT"] = {}
new_case_config["INT"] = {}
# Save important strings
new_case_config["STRING"]["case_name"] = case_name
new_case_config["STRING"]["data_file_type"] = "bodyflow"
h5dns_path = input("Enter absolute path to data file: ")
new_case_config["STRING"]["h5dns_path"] = h5dns_path
# Load data file and save important params
params = cgns_load_data.get_important_data(h5dns_path)
new_case_config["INT"]["tres"] = str(params["tres"])
new_case_config["INT"]["ires"] = str(params["ires"])
new_case_config["INT"]["jres"] = str(params["jres"])
new_case_config["INT"]["kres"] = str(params["kres"])
# Write case config file
with open(case_config_path, "w") as case_config_file:
new_case_config.write(case_config_file)
# Get render-specific config settings from user. This specifies what type of render to perform (photorealistic, surface
# temperature, ...), and other render settings (scale of droplet to render, etc.)
render_type = int(input("Select type of render to perform (enter number).\n 1 Streamline render\n 2 Vortex line render\n"))
render_name = input("Enter render profile name. This can be any string that refers to specific rendering settings for a data case. ")
# Initialize categories based on data types
new_render_config = configparser.ConfigParser()
new_render_config["STRING"] = {}
new_render_config["INT"] = {}
new_render_config["FLOAT"] = {}
new_render_config["BOOL"] = {}
new_render_config["STRING"]["render_name"] = render_name
# Determine settings from user that are specific to each type.
if (render_type == 1): # Streamline
# Name render config file based on the type of render being performed
render_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + render_name + "-render-streamline.cfg"
# Get some other settings
elif (render_type == 2): # Vortex line
render_config_path = dirname_config["DIRECTORIES"]["RenderConfig"] + render_name + "-render-vortexline.cfg"
# General inputs
new_render_config["INT"]["num_streamlines"] = input("Specify number of streamlines: ")
new_render_config["INT"]["streamline_seed"] = "777" #input("Specify random seed number to determine streamline start positions from: ")
new_render_config["FLOAT"]["view_fraction"] = input("Specify desired render frame width as multiple of domain length: ")
new_render_config["FLOAT"]["camera_azimuth_angle"] = input("Specify camera azimuth angle from the x-axis (deg): ")
new_render_config["FLOAT"]["camera_elevation_angle"] = input("Specify camera elevation angle from the horizontal (deg): ")
bg_image_enabled = get_yesno_input("Use custom background image? ")
if bg_image_enabled:
new_render_config["STRING"]["bg_image_filepath"] = dirname_config["DIRECTORIES"]["background_images"] + input("Specify background image name (in \"Render2018/BackgroundImages\"): ")
new_render_config["STRING"]["bg_color_1"] = ""
new_render_config["STRING"]["bg_color_2"] = ""
else:
new_render_config["STRING"]["bg_image_filepath"] = ""
new_render_config["STRING"]["bg_color_1"] = input("Specify R,G,B value of lower background color (separate floats by commas, values range from 0 to 1): ")
new_render_config["STRING"]["bg_color_2"] = input("Specify R,G,B value of upper background color (separate floats by commas, values range from 0 to 1): ")
new_render_config["FLOAT"]["resolution_percentage"] = input("Specify resolution percentage out of 100, as a percentage of 4K: ")
# Write render config file
with open(render_config_path, "w") as render_config_file:
new_render_config.write(render_config_file)
# Create slurm jobscript to run on Mox
slurm_name = case_name + "_" + render_name + ".slurm"
create_jobscripts.create_mox_slurm(slurm_dir=dirname_config["DIRECTORIES"]["RenderJobscripts"], slurm_name=slurm_name, job_name=case_name+"_"+render_name, lib_dir=os.getcwd(), python_file_to_run="render_init.py", case_config_path=case_config_path, render_config_path=render_config_path)
local_py_name = case_name + "_" + render_name + ".py"
create_jobscripts.create_local_py(python_dir=dirname_config["DIRECTORIES"]["RenderJobscripts"], python_filename=local_py_name, lib_dir=dirname_config["DIRECTORIES"]["lib"], python_file_to_run="render_init.py", case_config_path=case_config_path, render_config_path=render_config_path)
# Run jobscript if user desires
if mox:
if get_yesno_input("Run " + slurm_name + " to launch this rendering job?"):
os.system("sbatch -p ferrante -A ferrante " + dirname_config["DIRECTORIES"]["RenderJobscripts"] + "/" + slurm_name)
else:
if get_yesno_input("Run " + local_py_name + " to launch this rendering job?"):
os.system("python3 " + dirname_config["DIRECTORIES"]["RenderJobscripts"] + local_py_name)
| [
11748,
28686,
13,
6978,
198,
11748,
4566,
48610,
198,
6738,
288,
1980,
258,
694,
1330,
651,
62,
8505,
3919,
62,
15414,
198,
11748,
2251,
62,
21858,
46521,
198,
6738,
2251,
62,
15908,
3672,
62,
11250,
1330,
4566,
62,
15908,
3672,
62,
37581,
198,
6738,
2251,
62,
439,
62,
15908,
82,
1330,
2251,
62,
439,
198,
11748,
17802,
198,
11748,
269,
4593,
82,
62,
2220,
62,
7890,
198,
2,
12327,
326,
8075,
262,
734,
8398,
3696,
357,
7442,
290,
8543,
3696,
8,
3306,
284,
1057,
262,
14750,
11,
351,
257,
1366,
2393,
422,
2275,
71,
343,
321,
338,
1767,
5202,
18640,
355,
5128,
13,
198,
198,
2,
6822,
1771,
14750,
852,
1057,
319,
337,
1140,
198,
361,
17802,
13,
1136,
4774,
3672,
3419,
58,
15,
25,
18,
60,
6624,
366,
76,
1140,
1298,
198,
220,
220,
220,
285,
1140,
796,
6407,
198,
220,
220,
220,
40047,
62,
15908,
796,
12813,
70,
1416,
36722,
14,
2232,
5250,
68,
14,
2436,
2194,
14,
2436,
2194,
12,
17,
13,
3695,
66,
12,
23289,
12,
4743,
571,
66,
28896,
12,
87,
4521,
62,
2414,
11757,
30487,
198,
17772,
25,
198,
220,
220,
220,
285,
1140,
796,
10352,
198,
220,
220,
220,
40047,
62,
15908,
796,
13538,
198,
198,
2,
6822,
611,
26672,
3672,
13,
37581,
11,
543,
4909,
8619,
13532,
973,
3690,
262,
14750,
11,
7160,
532,
4306,
11,
2251,
340,
198,
361,
407,
28686,
13,
6978,
13,
1069,
1023,
7203,
15908,
3672,
13,
37581,
1,
2599,
198,
220,
220,
220,
4566,
62,
15908,
3672,
62,
37581,
3419,
198,
198,
2,
8778,
1593,
29196,
198,
15908,
3672,
62,
11250,
796,
4566,
48610,
13,
16934,
46677,
3419,
198,
15908,
3672,
62,
11250,
13,
961,
7203,
15908,
3672,
13,
37581,
4943,
198,
198,
2,
3497,
1339,
1438,
13,
770,
24866,
284,
257,
2176,
764,
71,
20,
67,
5907,
2393,
290,
318,
7368,
416,
262,
2836,
13,
317,
1339,
4566,
2393,
481,
307,
2727,
351,
663,
1438,
13,
198,
7442,
62,
3672,
796,
5128,
7203,
17469,
1339,
1438,
13,
770,
460,
307,
597,
4731,
326,
10229,
284,
257,
1948,
13889,
57,
13,
66,
4593,
82,
2393,
13,
366,
8,
198,
17953,
62,
439,
7,
7442,
62,
3672,
8,
198,
7442,
62,
11250,
62,
6978,
796,
26672,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
45819,
16934,
8973,
1343,
1339,
62,
3672,
1343,
27444,
7442,
13,
37581,
1,
198,
198,
2,
1002,
4683,
1339,
4566,
2393,
7160,
11,
262,
2836,
318,
31577,
257,
1948,
764,
71,
20,
67,
5907,
2393,
326,
318,
1541,
3917,
351,
198,
2,
428,
1339,
1438,
11,
523,
1445,
319,
284,
8543,
6460,
4566,
13,
15323,
11,
2251,
1339,
4566,
2393,
422,
2836,
5128,
13,
198,
361,
28686,
13,
6978,
13,
1069,
1023,
7,
7442,
62,
11250,
62,
6978,
2599,
198,
220,
220,
220,
3601,
7203,
21077,
4683,
1339,
8398,
25,
366,
1343,
1339,
62,
11250,
62,
6978,
8,
198,
220,
220,
220,
4683,
62,
7442,
62,
11250,
796,
4566,
48610,
13,
16934,
46677,
3419,
198,
220,
220,
220,
4683,
62,
7442,
62,
11250,
13,
961,
7,
7442,
62,
11250,
62,
6978,
8,
198,
220,
220,
220,
3601,
7203,
7890,
2393,
25,
366,
1343,
4683,
62,
7442,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
71,
20,
67,
5907,
62,
6978,
8973,
8,
198,
17772,
25,
198,
220,
220,
220,
1303,
13610,
649,
1339,
4566,
2393,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
796,
4566,
48610,
13,
16934,
46677,
3419,
628,
220,
220,
220,
1303,
1318,
389,
1180,
9004,
329,
1123,
4818,
265,
2981,
357,
5661,
318,
703,
262,
14750,
760,
644,
1366,
3858,
284,
3440,
11,
618,
484,
389,
477,
7448,
355,
13042,
8,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
18601,
2751,
8973,
796,
23884,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
3697,
46,
1404,
8973,
796,
23884,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
12394,
8973,
796,
23884,
628,
220,
220,
220,
1303,
12793,
1593,
13042,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
7442,
62,
3672,
8973,
796,
1339,
62,
3672,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
7890,
62,
7753,
62,
4906,
8973,
796,
366,
2618,
11125,
1,
198,
220,
220,
220,
289,
20,
67,
5907,
62,
6978,
796,
5128,
7203,
17469,
4112,
3108,
284,
1366,
2393,
25,
366,
8,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
71,
20,
67,
5907,
62,
6978,
8973,
796,
289,
20,
67,
5907,
62,
6978,
628,
220,
220,
220,
1303,
8778,
1366,
2393,
290,
3613,
1593,
42287,
198,
220,
220,
220,
42287,
796,
269,
4593,
82,
62,
2220,
62,
7890,
13,
1136,
62,
18049,
62,
7890,
7,
71,
20,
67,
5907,
62,
6978,
8,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
12394,
1,
7131,
1,
83,
411,
8973,
796,
965,
7,
37266,
14692,
83,
411,
8973,
8,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
12394,
1,
7131,
1,
2387,
8973,
796,
965,
7,
37266,
14692,
2387,
8973,
8,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
12394,
1,
7131,
1,
73,
411,
8973,
796,
965,
7,
37266,
14692,
73,
411,
8973,
8,
198,
220,
220,
220,
649,
62,
7442,
62,
11250,
14692,
12394,
1,
7131,
1,
74,
411,
8973,
796,
965,
7,
37266,
14692,
74,
411,
8973,
8,
628,
220,
220,
220,
1303,
19430,
1339,
4566,
2393,
198,
220,
220,
220,
351,
1280,
7,
7442,
62,
11250,
62,
6978,
11,
366,
86,
4943,
355,
1339,
62,
11250,
62,
7753,
25,
198,
220,
220,
220,
220,
220,
220,
220,
649,
62,
7442,
62,
11250,
13,
13564,
7,
7442,
62,
11250,
62,
7753,
8,
198,
198,
2,
3497,
8543,
12,
11423,
4566,
6460,
422,
2836,
13,
770,
26052,
644,
2099,
286,
8543,
284,
1620,
357,
38611,
39396,
2569,
11,
4417,
198,
2,
5951,
11,
2644,
828,
290,
584,
8543,
6460,
357,
9888,
286,
3102,
37069,
284,
8543,
11,
3503,
2014,
198,
13287,
62,
4906,
796,
493,
7,
15414,
7203,
17563,
2099,
286,
8543,
284,
1620,
357,
9255,
1271,
737,
59,
77,
352,
220,
13860,
1370,
8543,
59,
77,
362,
220,
49790,
1627,
8543,
59,
77,
48774,
198,
13287,
62,
3672,
796,
5128,
7203,
17469,
8543,
7034,
1438,
13,
770,
460,
307,
597,
4731,
326,
10229,
284,
2176,
14837,
6460,
329,
257,
1366,
1339,
13,
366,
8,
198,
198,
2,
20768,
1096,
9376,
1912,
319,
1366,
3858,
198,
3605,
62,
13287,
62,
11250,
796,
4566,
48610,
13,
16934,
46677,
3419,
198,
3605,
62,
13287,
62,
11250,
14692,
18601,
2751,
8973,
796,
23884,
198,
3605,
62,
13287,
62,
11250,
14692,
12394,
8973,
796,
23884,
198,
3605,
62,
13287,
62,
11250,
14692,
3697,
46,
1404,
8973,
796,
23884,
198,
3605,
62,
13287,
62,
11250,
14692,
8202,
3535,
8973,
796,
23884,
198,
3605,
62,
13287,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
13287,
62,
3672,
8973,
796,
8543,
62,
3672,
198,
198,
2,
45559,
3810,
6460,
422,
2836,
326,
389,
2176,
284,
1123,
2099,
13,
198,
361,
357,
13287,
62,
4906,
6624,
352,
2599,
1303,
13860,
1370,
198,
220,
220,
220,
1303,
6530,
8543,
4566,
2393,
1912,
319,
262,
2099,
286,
8543,
852,
6157,
198,
220,
220,
220,
8543,
62,
11250,
62,
6978,
796,
26672,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
45819,
16934,
8973,
1343,
8543,
62,
3672,
1343,
27444,
13287,
12,
5532,
1370,
13,
37581,
1,
198,
220,
220,
220,
1303,
3497,
617,
584,
6460,
198,
198,
417,
361,
357,
13287,
62,
4906,
6624,
362,
2599,
1303,
49790,
1627,
198,
220,
220,
220,
8543,
62,
11250,
62,
6978,
796,
26672,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
45819,
16934,
8973,
1343,
8543,
62,
3672,
1343,
27444,
13287,
12,
85,
26158,
1370,
13,
37581,
1,
198,
198,
2,
3611,
17311,
198,
3605,
62,
13287,
62,
11250,
14692,
12394,
1,
7131,
1,
22510,
62,
5532,
6615,
8973,
796,
5128,
7203,
22882,
1958,
1271,
286,
4269,
6615,
25,
366,
8,
198,
3605,
62,
13287,
62,
11250,
14692,
12394,
1,
7131,
1,
5532,
1370,
62,
28826,
8973,
796,
366,
29331,
1,
1303,
15414,
7203,
22882,
1958,
4738,
9403,
1271,
284,
5004,
4269,
1370,
923,
6116,
422,
25,
366,
8,
198,
3605,
62,
13287,
62,
11250,
14692,
3697,
46,
1404,
1,
7131,
1,
1177,
62,
69,
7861,
8973,
796,
5128,
7203,
22882,
1958,
10348,
8543,
5739,
9647,
355,
3294,
286,
7386,
4129,
25,
366,
8,
198,
3605,
62,
13287,
62,
11250,
14692,
3697,
46,
1404,
1,
7131,
1,
25695,
62,
1031,
320,
1071,
62,
9248,
8973,
796,
5128,
7203,
22882,
1958,
4676,
35560,
320,
1071,
9848,
422,
262,
2124,
12,
22704,
357,
13500,
2599,
366,
8,
198,
3605,
62,
13287,
62,
11250,
14692,
3697,
46,
1404,
1,
7131,
1,
25695,
62,
68,
2768,
341,
62,
9248,
8973,
796,
5128,
7203,
22882,
1958,
4676,
22910,
9848,
422,
262,
16021,
357,
13500,
2599,
366,
8,
198,
35904,
62,
9060,
62,
25616,
796,
651,
62,
8505,
3919,
62,
15414,
7203,
11041,
2183,
4469,
2939,
30,
366,
8,
198,
361,
275,
70,
62,
9060,
62,
25616,
25,
198,
220,
220,
220,
649,
62,
13287,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
35904,
62,
9060,
62,
7753,
6978,
8973,
796,
26672,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
25249,
62,
17566,
8973,
1343,
5128,
7203,
22882,
1958,
4469,
2939,
1438,
357,
259,
19990,
45819,
7908,
14,
21756,
29398,
7879,
2599,
366,
8,
198,
220,
220,
220,
649,
62,
13287,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
35904,
62,
8043,
62,
16,
8973,
796,
13538,
198,
220,
220,
220,
649,
62,
13287,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
35904,
62,
8043,
62,
17,
8973,
796,
13538,
198,
17772,
25,
198,
220,
220,
220,
649,
62,
13287,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
35904,
62,
9060,
62,
7753,
6978,
8973,
796,
13538,
198,
220,
220,
220,
649,
62,
13287,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
35904,
62,
8043,
62,
16,
8973,
796,
5128,
7203,
22882,
1958,
371,
11,
38,
11,
33,
1988,
286,
2793,
4469,
3124,
357,
25512,
378,
36016,
416,
725,
292,
11,
3815,
2837,
422,
657,
284,
352,
2599,
366,
8,
198,
220,
220,
220,
649,
62,
13287,
62,
11250,
14692,
18601,
2751,
1,
7131,
1,
35904,
62,
8043,
62,
17,
8973,
796,
5128,
7203,
22882,
1958,
371,
11,
38,
11,
33,
1988,
286,
6727,
4469,
3124,
357,
25512,
378,
36016,
416,
725,
292,
11,
3815,
2837,
422,
657,
284,
352,
2599,
366,
8,
198,
3605,
62,
13287,
62,
11250,
14692,
3697,
46,
1404,
1,
7131,
1,
29268,
62,
25067,
496,
8973,
796,
5128,
7203,
22882,
1958,
6323,
5873,
503,
286,
1802,
11,
355,
257,
5873,
286,
604,
42,
25,
366,
8,
198,
198,
2,
19430,
8543,
4566,
2393,
198,
4480,
1280,
7,
13287,
62,
11250,
62,
6978,
11,
366,
86,
4943,
355,
8543,
62,
11250,
62,
7753,
25,
198,
220,
220,
220,
649,
62,
13287,
62,
11250,
13,
13564,
7,
13287,
62,
11250,
62,
7753,
8,
198,
198,
2,
13610,
40066,
76,
1693,
12048,
284,
1057,
319,
337,
1140,
198,
6649,
333,
76,
62,
3672,
796,
1339,
62,
3672,
1343,
45434,
1,
1343,
8543,
62,
3672,
1343,
27071,
6649,
333,
76,
1,
198,
17953,
62,
21858,
46521,
13,
17953,
62,
76,
1140,
62,
6649,
333,
76,
7,
6649,
333,
76,
62,
15908,
28,
15908,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
45819,
33308,
46521,
33116,
40066,
76,
62,
3672,
28,
6649,
333,
76,
62,
3672,
11,
1693,
62,
3672,
28,
7442,
62,
3672,
10,
1,
62,
1,
10,
13287,
62,
3672,
11,
9195,
62,
15908,
28,
418,
13,
1136,
66,
16993,
22784,
21015,
62,
7753,
62,
1462,
62,
5143,
2625,
13287,
62,
15003,
13,
9078,
1600,
1339,
62,
11250,
62,
6978,
28,
7442,
62,
11250,
62,
6978,
11,
8543,
62,
11250,
62,
6978,
28,
13287,
62,
11250,
62,
6978,
8,
198,
12001,
62,
9078,
62,
3672,
796,
1339,
62,
3672,
1343,
45434,
1,
1343,
8543,
62,
3672,
1343,
27071,
9078,
1,
198,
17953,
62,
21858,
46521,
13,
17953,
62,
12001,
62,
9078,
7,
29412,
62,
15908,
28,
15908,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
45819,
33308,
46521,
33116,
21015,
62,
34345,
28,
12001,
62,
9078,
62,
3672,
11,
9195,
62,
15908,
28,
15908,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
8019,
33116,
21015,
62,
7753,
62,
1462,
62,
5143,
2625,
13287,
62,
15003,
13,
9078,
1600,
1339,
62,
11250,
62,
6978,
28,
7442,
62,
11250,
62,
6978,
11,
8543,
62,
11250,
62,
6978,
28,
13287,
62,
11250,
62,
6978,
8,
198,
198,
2,
5660,
1693,
12048,
611,
2836,
15997,
198,
361,
285,
1140,
25,
198,
220,
220,
220,
611,
651,
62,
8505,
3919,
62,
15414,
7203,
10987,
366,
1343,
40066,
76,
62,
3672,
1343,
366,
284,
4219,
428,
14837,
1693,
1701,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
10057,
7203,
36299,
963,
532,
79,
11354,
5250,
68,
532,
32,
11354,
5250,
68,
366,
1343,
26672,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
45819,
33308,
46521,
8973,
1343,
12813,
1,
1343,
40066,
76,
62,
3672,
8,
198,
17772,
25,
198,
220,
220,
220,
611,
651,
62,
8505,
3919,
62,
15414,
7203,
10987,
366,
1343,
1957,
62,
9078,
62,
3672,
1343,
366,
284,
4219,
428,
14837,
1693,
1701,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
10057,
7203,
29412,
18,
366,
1343,
26672,
3672,
62,
11250,
14692,
17931,
23988,
1581,
11015,
1,
7131,
1,
45819,
33308,
46521,
8973,
1343,
1957,
62,
9078,
62,
3672,
8,
220,
198
] | 3.008818 | 2,268 |
#!/usr/bin/python
import sys
import simplejson as json
if __name__ == "__main__":
main()
| [
2,
48443,
14629,
14,
8800,
14,
29412,
198,
11748,
25064,
198,
11748,
2829,
17752,
355,
33918,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.685714 | 35 |
#!/usr/bin/env python2
import copy
import random
from classes.Pokemons import *
from classes.Battle import *
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
17,
198,
198,
11748,
4866,
198,
11748,
4738,
198,
6738,
6097,
13,
47,
2088,
11567,
1330,
1635,
198,
6738,
6097,
13,
24064,
1330,
1635,
628
] | 3.363636 | 33 |
# 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 django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
import horizon_hpe_storage.api.keystone_api as keystone
import horizon_hpe_storage.api.barbican_api as barbican
from horizon import exceptions
from horizon import forms
from horizon import messages
| [
2,
49962,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
345,
743,
198,
2,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
921,
743,
7330,
198,
2,
257,
4866,
286,
262,
13789,
379,
198,
2,
198,
2,
220,
220,
220,
220,
220,
2638,
1378,
2503,
13,
43073,
13,
2398,
14,
677,
4541,
14,
43,
2149,
24290,
12,
17,
13,
15,
198,
2,
198,
2,
17486,
2672,
416,
9723,
1099,
393,
4987,
284,
287,
3597,
11,
3788,
198,
2,
9387,
739,
262,
13789,
318,
9387,
319,
281,
366,
1921,
3180,
1,
29809,
1797,
11,
42881,
198,
2,
34764,
11015,
6375,
7102,
49828,
11053,
3963,
15529,
509,
12115,
11,
2035,
4911,
393,
17142,
13,
4091,
262,
198,
2,
13789,
329,
262,
2176,
3303,
15030,
21627,
290,
11247,
198,
2,
739,
262,
13789,
13,
198,
198,
6738,
42625,
14208,
13,
7295,
13,
6371,
411,
349,
690,
1330,
9575,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
334,
1136,
5239,
62,
75,
12582,
355,
4808,
198,
198,
11748,
17810,
62,
71,
431,
62,
35350,
13,
15042,
13,
2539,
6440,
62,
15042,
355,
1994,
6440,
198,
11748,
17810,
62,
71,
431,
62,
35350,
13,
15042,
13,
5657,
65,
7490,
62,
15042,
355,
42577,
7490,
198,
198,
6738,
17810,
1330,
13269,
198,
6738,
17810,
1330,
5107,
198,
6738,
17810,
1330,
6218,
628,
198
] | 3.740088 | 227 |
from diem import chain_ids
from liquidity import create_liquidity_provider, init_liquidity_provider
from liquidity.liquidity import FaucetLiquidityProvider, DDLiquidityProvider
CUSTODY_PRIVATE_KEYS = (
'{"liquidity":"c6537e56d844fa4a15f3bf5eacd41c9123a19ef19a1026f2325a6b2dd33a13f1"}'
)
| [
6738,
2566,
368,
1330,
6333,
62,
2340,
198,
198,
6738,
31061,
1330,
2251,
62,
39250,
414,
62,
15234,
1304,
11,
2315,
62,
39250,
414,
62,
15234,
1304,
198,
6738,
31061,
13,
39250,
414,
1330,
376,
14272,
316,
41966,
414,
29495,
11,
360,
19260,
6394,
414,
29495,
198,
198,
34,
7759,
33076,
62,
4805,
3824,
6158,
62,
7336,
16309,
796,
357,
198,
220,
220,
220,
705,
4895,
39250,
414,
2404,
66,
2996,
2718,
68,
3980,
67,
23,
2598,
13331,
19,
64,
1314,
69,
18,
19881,
20,
68,
330,
67,
3901,
66,
24,
10163,
64,
1129,
891,
1129,
64,
940,
2075,
69,
1954,
1495,
64,
21,
65,
17,
1860,
2091,
64,
1485,
69,
16,
20662,
6,
198,
8,
628,
628
] | 2.508475 | 118 |
from .l2norm import L2Norm
from .multibox_loss import MultiBoxLoss
__all__ = ['L2Norm', 'MultiBoxLoss']
| [
6738,
764,
75,
17,
27237,
220,
220,
220,
220,
220,
220,
220,
1330,
406,
17,
35393,
198,
6738,
764,
16680,
571,
1140,
62,
22462,
1330,
15237,
14253,
43,
793,
198,
198,
834,
439,
834,
796,
37250,
43,
17,
35393,
3256,
705,
29800,
14253,
43,
793,
20520,
198
] | 2.382979 | 47 |
import pymetry
pym = pymetry
pym.octagon(150, "yellow", 8)
| [
11748,
12972,
41935,
198,
79,
4948,
796,
12972,
41935,
198,
79,
4948,
13,
38441,
1840,
7,
8628,
11,
366,
36022,
1600,
807,
8,
198
] | 2.458333 | 24 |
"""
Remote debugging support.
This addon allows you to use a remote Python debugger with PyCharm, PyDev and
possibly other IDEs. As it is, without modification, it only supports PyCharm,
but it may work by pointing it at a similar egg file shipped with PyDev.
Before using, point the addon to your pycharm-debug-py3k.egg file in the
addon preferences screen.
For more information on how to use this addon, please read my article at
http://code.blender.org/2015/10/debugging-python-code-with-pycharm/
"""
bl_info = {
'name': 'Remote debugger',
'author': 'Sybren A. Stvel',
'version': (0, 4),
'blender': (2, 80, 0),
'location': 'Press [Space], search for "debugger"',
'category': 'Development',
}
import bpy
import os.path
from bpy.types import AddonPreferences
from bpy.props import StringProperty
# Get references to all property definition functions in bpy.props,
# so that they can be used to replace 'x = IntProperty()' to 'x: IntProperty()'
# dynamically when working on Blender 2.80+
__all_prop_funcs = {
getattr(bpy.props, propname)
for propname in dir(bpy.props)
if propname.endswith('Property')
}
def convert_properties(class_):
"""Class decorator to avoid warnings in Blender 2.80+
This decorator replaces property definitions like this:
someprop = bpy.props.IntProperty()
to annotations, as introduced in Blender 2.80:
someprop: bpy.props.IntProperty()
No-op if running on Blender 2.79 or older.
"""
if bpy.app.version < (2, 80):
return class_
if not hasattr(class_, '__annotations__'):
class_.__annotations__ = {}
attrs_to_delete = []
for name, value in class_.__dict__.items():
if not isinstance(value, tuple) or len(value) != 2:
continue
prop_func, kwargs = value
if prop_func not in __all_prop_funcs:
continue
# This is a property definition, replace it with annotation.
attrs_to_delete.append(name)
class_.__annotations__[name] = value
for attr_name in attrs_to_delete:
delattr(class_, attr_name)
return class_
def register():
bpy.utils.register_class(DEBUG_OT_connect_debugger_pycharm)
bpy.utils.register_class(DEBUG_OT_connect_debugger_pydev)
bpy.utils.register_class(DebuggerAddonPreferences)
def unregister():
bpy.utils.unregister_class(DEBUG_OT_connect_debugger_pycharm)
bpy.utils.unregister_class(DEBUG_OT_connect_debugger_pydev)
bpy.utils.unregister_class(DebuggerAddonPreferences)
if __name__ == '__main__':
register()
| [
37811,
198,
36510,
28769,
1104,
13,
198,
198,
1212,
48557,
3578,
345,
284,
779,
257,
6569,
11361,
49518,
351,
9485,
1925,
1670,
11,
9485,
13603,
290,
198,
39363,
584,
4522,
23041,
13,
1081,
340,
318,
11,
1231,
17613,
11,
340,
691,
6971,
9485,
1925,
1670,
11,
198,
4360,
340,
743,
670,
416,
10609,
340,
379,
257,
2092,
5935,
2393,
14338,
351,
9485,
13603,
13,
198,
198,
8421,
1262,
11,
966,
262,
48557,
284,
534,
12972,
354,
1670,
12,
24442,
12,
9078,
18,
74,
13,
33856,
2393,
287,
262,
198,
48078,
15387,
3159,
13,
198,
198,
1890,
517,
1321,
319,
703,
284,
779,
428,
48557,
11,
3387,
1100,
616,
2708,
379,
198,
4023,
1378,
8189,
13,
2436,
2194,
13,
2398,
14,
4626,
14,
940,
14,
24442,
2667,
12,
29412,
12,
8189,
12,
4480,
12,
9078,
354,
1670,
14,
198,
37811,
198,
198,
2436,
62,
10951,
796,
1391,
198,
220,
220,
220,
705,
3672,
10354,
705,
36510,
49518,
3256,
198,
220,
220,
220,
705,
9800,
10354,
705,
13940,
65,
918,
317,
13,
520,
626,
3256,
198,
220,
220,
220,
705,
9641,
10354,
357,
15,
11,
604,
828,
198,
220,
220,
220,
705,
2436,
2194,
10354,
357,
17,
11,
4019,
11,
657,
828,
198,
220,
220,
220,
705,
24886,
10354,
705,
13800,
685,
14106,
4357,
2989,
329,
366,
24442,
1362,
1,
3256,
198,
220,
220,
220,
705,
22872,
10354,
705,
41206,
3256,
198,
92,
198,
198,
11748,
275,
9078,
198,
11748,
28686,
13,
6978,
198,
6738,
275,
9078,
13,
19199,
1330,
3060,
261,
36698,
4972,
198,
6738,
275,
9078,
13,
1676,
862,
1330,
10903,
21746,
628,
198,
2,
3497,
10288,
284,
477,
3119,
6770,
5499,
287,
275,
9078,
13,
1676,
862,
11,
198,
2,
523,
326,
484,
460,
307,
973,
284,
6330,
705,
87,
796,
2558,
21746,
3419,
6,
284,
705,
87,
25,
2558,
21746,
3419,
6,
198,
2,
32366,
618,
1762,
319,
1086,
2194,
362,
13,
1795,
10,
198,
834,
439,
62,
22930,
62,
12543,
6359,
796,
1391,
198,
220,
220,
220,
651,
35226,
7,
65,
9078,
13,
1676,
862,
11,
2632,
3672,
8,
198,
220,
220,
220,
329,
2632,
3672,
287,
26672,
7,
65,
9078,
13,
1676,
862,
8,
198,
220,
220,
220,
611,
2632,
3672,
13,
437,
2032,
342,
10786,
21746,
11537,
198,
92,
198,
198,
4299,
10385,
62,
48310,
7,
4871,
62,
2599,
198,
220,
220,
220,
37227,
9487,
11705,
1352,
284,
3368,
14601,
287,
1086,
2194,
362,
13,
1795,
10,
628,
220,
220,
220,
770,
11705,
1352,
24020,
3119,
17336,
588,
428,
25,
628,
220,
220,
220,
220,
220,
220,
220,
617,
22930,
796,
275,
9078,
13,
1676,
862,
13,
5317,
21746,
3419,
628,
220,
220,
220,
284,
37647,
11,
355,
5495,
287,
1086,
2194,
362,
13,
1795,
25,
628,
220,
220,
220,
220,
220,
220,
220,
617,
22930,
25,
275,
9078,
13,
1676,
862,
13,
5317,
21746,
3419,
628,
220,
220,
220,
1400,
12,
404,
611,
2491,
319,
1086,
2194,
362,
13,
3720,
393,
4697,
13,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
611,
275,
9078,
13,
1324,
13,
9641,
1279,
357,
17,
11,
4019,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1398,
62,
628,
220,
220,
220,
611,
407,
468,
35226,
7,
4871,
62,
11,
705,
834,
34574,
602,
834,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1398,
44807,
834,
34574,
602,
834,
796,
23884,
628,
220,
220,
220,
708,
3808,
62,
1462,
62,
33678,
796,
17635,
198,
220,
220,
220,
329,
1438,
11,
1988,
287,
1398,
44807,
834,
11600,
834,
13,
23814,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
318,
39098,
7,
8367,
11,
46545,
8,
393,
18896,
7,
8367,
8,
14512,
362,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
2632,
62,
20786,
11,
479,
86,
22046,
796,
1988,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2632,
62,
20786,
407,
287,
11593,
439,
62,
22930,
62,
12543,
6359,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
770,
318,
257,
3119,
6770,
11,
6330,
340,
351,
23025,
13,
198,
220,
220,
220,
220,
220,
220,
220,
708,
3808,
62,
1462,
62,
33678,
13,
33295,
7,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1398,
44807,
834,
34574,
602,
834,
58,
3672,
60,
796,
1988,
628,
220,
220,
220,
329,
708,
81,
62,
3672,
287,
708,
3808,
62,
1462,
62,
33678,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1619,
35226,
7,
4871,
62,
11,
708,
81,
62,
3672,
8,
628,
220,
220,
220,
1441,
1398,
62,
628,
628,
628,
198,
4299,
7881,
33529,
198,
220,
220,
220,
275,
9078,
13,
26791,
13,
30238,
62,
4871,
7,
30531,
62,
2394,
62,
8443,
62,
24442,
1362,
62,
9078,
354,
1670,
8,
198,
220,
220,
220,
275,
9078,
13,
26791,
13,
30238,
62,
4871,
7,
30531,
62,
2394,
62,
8443,
62,
24442,
1362,
62,
79,
5173,
1990,
8,
198,
220,
220,
220,
275,
9078,
13,
26791,
13,
30238,
62,
4871,
7,
27509,
1362,
4550,
261,
36698,
4972,
8,
628,
198,
4299,
555,
30238,
33529,
198,
220,
220,
220,
275,
9078,
13,
26791,
13,
403,
30238,
62,
4871,
7,
30531,
62,
2394,
62,
8443,
62,
24442,
1362,
62,
9078,
354,
1670,
8,
198,
220,
220,
220,
275,
9078,
13,
26791,
13,
403,
30238,
62,
4871,
7,
30531,
62,
2394,
62,
8443,
62,
24442,
1362,
62,
79,
5173,
1990,
8,
198,
220,
220,
220,
275,
9078,
13,
26791,
13,
403,
30238,
62,
4871,
7,
27509,
1362,
4550,
261,
36698,
4972,
8,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
7881,
3419,
198
] | 2.711297 | 956 |
import datetime
from django.contrib import messages
from django.contrib.auth.decorators import login_required, user_passes_test
from django.http import HttpResponse
from django.shortcuts import render
from .book_assign import send_email_reject_book
from todo.forms import SearchForm
from todo.models import Task, Book, Editor, Writer
| [
11748,
4818,
8079,
198,
198,
6738,
42625,
14208,
13,
3642,
822,
1330,
6218,
198,
6738,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
12501,
273,
2024,
1330,
17594,
62,
35827,
11,
2836,
62,
6603,
274,
62,
9288,
198,
6738,
42625,
14208,
13,
4023,
1330,
367,
29281,
31077,
198,
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
764,
2070,
62,
562,
570,
1330,
3758,
62,
12888,
62,
260,
752,
62,
2070,
198,
198,
6738,
284,
4598,
13,
23914,
1330,
11140,
8479,
198,
6738,
284,
4598,
13,
27530,
1330,
15941,
11,
4897,
11,
12058,
11,
26606,
628
] | 3.474227 | 97 |
import matplotlib.pyplot as plt
# number of threads used to compute product of 2 matrices of dim. 1024
data_x = [1, 2, 3, 4, 8, 16, 32, 64, 128,
256, 512, 1024, 2048, 4096]
# execution time in seconds
data_y = [3.300059, 1.664494, 2.294884, 3.200235,
2.915945, 3.082389, 3.023162, 3.012096,
2.958028, 2.939918, 2.847527, 2.898556,
2.876036, 2.963720]
plt.figure()
plt.plot(data_x, data_y)
plt.xlabel('# of threads')
plt.xscale('log')
plt.ylabel('execution time in seconds')
plt.title('Exection times of 1024x1024 matrix multi with different thread counts')
plt.show() | [
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
198,
2,
1271,
286,
14390,
973,
284,
24061,
1720,
286,
362,
2603,
45977,
286,
5391,
13,
28119,
198,
7890,
62,
87,
796,
685,
16,
11,
362,
11,
513,
11,
604,
11,
807,
11,
1467,
11,
3933,
11,
5598,
11,
13108,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17759,
11,
22243,
11,
28119,
11,
36117,
11,
42479,
60,
198,
2,
9706,
640,
287,
4201,
198,
7890,
62,
88,
796,
685,
18,
13,
23924,
3270,
11,
352,
13,
21,
2414,
39449,
11,
362,
13,
1959,
2780,
5705,
11,
513,
13,
2167,
22370,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
362,
13,
24,
19707,
2231,
11,
513,
13,
2919,
1954,
4531,
11,
513,
13,
45310,
25061,
11,
513,
13,
486,
1238,
4846,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
362,
13,
3865,
1795,
2078,
11,
362,
13,
6052,
2079,
1507,
11,
362,
13,
5705,
2425,
1983,
11,
362,
13,
23,
4089,
37864,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
362,
13,
5774,
1899,
2623,
11,
362,
13,
4846,
2718,
1238,
60,
198,
198,
489,
83,
13,
26875,
3419,
198,
489,
83,
13,
29487,
7,
7890,
62,
87,
11,
1366,
62,
88,
8,
198,
489,
83,
13,
87,
18242,
10786,
2,
286,
14390,
11537,
198,
489,
83,
13,
87,
9888,
10786,
6404,
11537,
198,
489,
83,
13,
2645,
9608,
10786,
18558,
1009,
640,
287,
4201,
11537,
198,
489,
83,
13,
7839,
10786,
3109,
3213,
1661,
286,
28119,
87,
35500,
17593,
5021,
351,
1180,
4704,
9853,
11537,
198,
489,
83,
13,
12860,
3419
] | 2.210145 | 276 |
# memoro.wsgi
# WSGI config for memoro project.
#
# Author: Benjamin Bengfort <[email protected]>
# Created: Sat Nov 28 13:44:01 2020 -0500
#
# Copyright (C) 2020 Bengfort.com
# For license information, see LICENSE
#
# ID: wsgi.py [] [email protected] $
"""
WSGI config for memoro project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
##########################################################################
## Imports
##########################################################################
import os
from django.core.wsgi import get_wsgi_application
from dotenv import find_dotenv, load_dotenv
##########################################################################
## Load environment and create WSGI application
##########################################################################
load_dotenv(find_dotenv())
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'memoro.settings.development')
application = get_wsgi_application()
| [
198,
2,
16181,
78,
13,
18504,
12397,
198,
2,
25290,
18878,
4566,
329,
16181,
78,
1628,
13,
198,
2,
198,
2,
6434,
25,
220,
220,
14533,
14964,
3319,
1279,
11722,
13337,
31,
65,
1516,
3319,
13,
785,
29,
198,
2,
15622,
25,
220,
7031,
5267,
2579,
1511,
25,
2598,
25,
486,
12131,
532,
2713,
405,
198,
2,
198,
2,
15069,
357,
34,
8,
12131,
14964,
3319,
13,
785,
198,
2,
1114,
5964,
1321,
11,
766,
38559,
24290,
198,
2,
198,
2,
4522,
25,
266,
82,
12397,
13,
9078,
17635,
1888,
13337,
31,
65,
1516,
3319,
13,
785,
720,
198,
198,
37811,
198,
19416,
18878,
4566,
329,
16181,
78,
1628,
13,
198,
198,
1026,
32142,
262,
25290,
18878,
869,
540,
355,
257,
8265,
12,
5715,
7885,
3706,
7559,
31438,
15506,
13,
198,
198,
1890,
517,
1321,
319,
428,
2393,
11,
766,
198,
5450,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
268,
14,
18,
13,
16,
14,
4919,
1462,
14,
2934,
1420,
434,
14,
18504,
12397,
14,
198,
37811,
198,
198,
29113,
29113,
7804,
2235,
198,
2235,
1846,
3742,
198,
29113,
29113,
7804,
2235,
198,
198,
11748,
28686,
198,
198,
6738,
42625,
14208,
13,
7295,
13,
18504,
12397,
1330,
651,
62,
18504,
12397,
62,
31438,
198,
6738,
16605,
24330,
1330,
1064,
62,
26518,
24330,
11,
3440,
62,
26518,
24330,
628,
198,
29113,
29113,
7804,
2235,
198,
2235,
8778,
2858,
290,
2251,
25290,
18878,
3586,
198,
29113,
29113,
7804,
2235,
198,
198,
2220,
62,
26518,
24330,
7,
19796,
62,
26518,
24330,
28955,
198,
418,
13,
268,
2268,
13,
2617,
12286,
10786,
35028,
1565,
11230,
62,
28480,
51,
20754,
62,
33365,
24212,
3256,
705,
11883,
16522,
13,
33692,
13,
31267,
11537,
198,
31438,
796,
651,
62,
18504,
12397,
62,
31438,
3419,
198
] | 3.767123 | 292 |
"""
Serialized Data Converter.
Licensed under MIT
Copyright (c) 2012 - 2015 Isaac Muse <[email protected]>
"""
import sublime
import sublime_plugin
import codecs
import re
import traceback
import os
from SerializedDataConverter.lib.log import error_msg
from SerializedDataConverter.lib import plist_includes as plist
from SerializedDataConverter.lib import yaml_includes as yaml
from SerializedDataConverter.lib import json_includes as json
PACKAGE_SETTINGS = "serialized_data_converter.sublime-settings"
def to_hex(value):
"""Convert int value to hex string."""
return "%02x" % value
##########################
# Plist <-> YAML
##########################
##########################
# Plist <-> JSON
##########################
##########################
# YAML <-> JSON
##########################
##########################
# BPLIST <-> PLIST
##########################
| [
37811,
198,
32634,
1143,
6060,
35602,
353,
13,
198,
198,
26656,
15385,
739,
17168,
198,
15269,
357,
66,
8,
2321,
532,
1853,
19068,
32887,
1279,
9160,
330,
76,
1904,
31,
14816,
13,
785,
29,
198,
37811,
198,
11748,
41674,
198,
11748,
41674,
62,
33803,
198,
11748,
40481,
82,
198,
11748,
302,
198,
11748,
12854,
1891,
198,
11748,
28686,
198,
6738,
23283,
1143,
6601,
3103,
332,
353,
13,
8019,
13,
6404,
1330,
4049,
62,
19662,
198,
6738,
23283,
1143,
6601,
3103,
332,
353,
13,
8019,
1330,
458,
396,
62,
42813,
355,
458,
396,
198,
6738,
23283,
1143,
6601,
3103,
332,
353,
13,
8019,
1330,
331,
43695,
62,
42813,
355,
331,
43695,
198,
6738,
23283,
1143,
6601,
3103,
332,
353,
13,
8019,
1330,
33918,
62,
42813,
355,
33918,
198,
198,
47,
8120,
11879,
62,
28480,
51,
20754,
796,
366,
46911,
1143,
62,
7890,
62,
1102,
332,
353,
13,
7266,
27299,
12,
33692,
1,
628,
198,
4299,
284,
62,
33095,
7,
8367,
2599,
198,
220,
220,
220,
37227,
3103,
1851,
493,
1988,
284,
17910,
4731,
526,
15931,
628,
220,
220,
220,
1441,
36521,
2999,
87,
1,
4064,
1988,
628,
628,
198,
14468,
7804,
2235,
198,
2,
1345,
396,
1279,
3784,
575,
2390,
43,
198,
14468,
7804,
2235,
628,
198,
198,
14468,
7804,
2235,
198,
2,
1345,
396,
1279,
3784,
19449,
198,
14468,
7804,
2235,
628,
198,
198,
14468,
7804,
2235,
198,
2,
575,
2390,
43,
1279,
3784,
19449,
198,
14468,
7804,
2235,
628,
198,
198,
14468,
7804,
2235,
198,
2,
347,
6489,
8808,
1279,
3784,
9297,
8808,
198,
14468,
7804,
2235,
198
] | 3.467181 | 259 |
#!/usr/bin/env python2.7
import urho
v = urho.Vector3()
c = urho.Context()
fs = urho.FileSystem(c)
from urho import StringHash as sh
import os
print (os.getcwd())
a = App(c)
#help(a)
var = urho.Variant(u'/home/nathan/Desktop/testClang')
print(var)
print(fs.GetCurrentDir())
#a.engineParameters[urho.StringHash('ResourcePrefixPaths')] = var
#a.engineParameters["FullScreen"] = False
#a.engineParameters[urho.StringHash('FullScreen')] = False
a.engineParameters["WindowWidth"] = 500
c.GetSubsystem(sh('Input')).SetMouseVisible(True)
del fs
c.GetSubsystem(sh('Input')).SetMouseVisible(True)
a.Run()
#ep = a.engineParameters
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
17,
13,
22,
198,
198,
11748,
2956,
8873,
198,
85,
796,
2956,
8873,
13,
38469,
18,
3419,
198,
66,
796,
2956,
8873,
13,
21947,
3419,
198,
9501,
796,
2956,
8873,
13,
8979,
11964,
7,
66,
8,
198,
198,
6738,
2956,
8873,
1330,
10903,
26257,
355,
427,
198,
198,
11748,
28686,
198,
4798,
357,
418,
13,
1136,
66,
16993,
28955,
198,
198,
64,
796,
2034,
7,
66,
8,
198,
2,
16794,
7,
64,
8,
198,
198,
7785,
796,
2956,
8873,
13,
23907,
415,
7,
84,
26488,
11195,
14,
77,
6696,
14,
36881,
14,
9288,
2601,
648,
11537,
198,
4798,
7,
7785,
8,
198,
198,
4798,
7,
9501,
13,
3855,
11297,
35277,
28955,
198,
2,
64,
13,
18392,
48944,
58,
333,
8873,
13,
10100,
26257,
10786,
26198,
36698,
844,
15235,
82,
11537,
60,
796,
1401,
198,
2,
64,
13,
18392,
48944,
14692,
13295,
23901,
8973,
796,
10352,
198,
2,
64,
13,
18392,
48944,
58,
333,
8873,
13,
10100,
26257,
10786,
13295,
23901,
11537,
60,
796,
10352,
198,
198,
64,
13,
18392,
48944,
14692,
27703,
30916,
8973,
796,
5323,
198,
198,
66,
13,
3855,
7004,
10057,
7,
1477,
10786,
20560,
11537,
737,
7248,
39643,
53,
12843,
7,
17821,
8,
198,
198,
12381,
43458,
198,
66,
13,
3855,
7004,
10057,
7,
1477,
10786,
20560,
11537,
737,
7248,
39643,
53,
12843,
7,
17821,
8,
198,
64,
13,
10987,
3419,
198,
198,
2,
538,
796,
257,
13,
18392,
48944,
628,
198
] | 2.604938 | 243 |
"""
Django settings for tesis project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# -*- coding: utf-8 -*-
# A tuple that lists people who get code error notifications.
ADMINS = (
('Abel Gonzlez Mondjar', '[email protected]'),
)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.conf import global_settings
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'a6c$xd0y%_#%&ucf!uzu0cuc)6-+b+t5(63u#a__!^3cnhk)#l'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# A boolean that turns on/off template debug mode.
TEMPLATE_DEBUG = True
# A list of strings representing the host/domain names that this Django site can serve.
ALLOWED_HOSTS = []
# Application definition
# A tuple of strings designating all applications that are enabled in this Django installation
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
# otras apps
'pure_pagination',
'watson',
# Mis Apps
'ajustes',
'persona',
'planEstudio',
# importada y modificada
'main',
)
PAGINATION_SETTINGS = {
'PAGE_RANGE_DISPLAYED': 10,
'MARGIN_PAGES_DISPLAYED': 1,
}
# Middleware is a framework of hooks into Djangos request/response processing.
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
# A string representing the full Python import path to your root URLconf.
ROOT_URLCONF = 'tesis.urls'
# The full Python path of the WSGI application object that Djangos built-in servers (e.g. runserver) will use.
WSGI_APPLICATION = 'tesis.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
# A dictionary containing the settings for all databases to be used with Django.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': os.path.join(BASE_DIR, 'my.cnf'),
'init_command': 'SET storage_engine=INNODB',
},
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
# Language code for this installation.
LANGUAGE_CODE = 'es-CU'
# A boolean that specifies whether Djangos translation system should be enabled.
# This provides an easy way to turn it off, for performance. If this is set to False,
# Django will make some optimizations so as not to load the translation machinery.
USE_I18N = True
# A boolean that specifies if localized formatting of data will be enabled by default or not.
# If this is set to True, e.g. Django will display numbers and dates using the format of the current locale.
USE_L10N = True
# A boolean that specifies if datetimes will be timezone-aware by default or not.
# If this is set to True, Django will use timezone-aware datetimes internally.
# Otherwise, Django will use naive datetimes in local time.
USE_TZ = True
# Number representing the first day of the week.
FIRST_DAY_OF_WEEK = 1
from django.utils.translation import ugettext_lazy as _
# A tuple of all available languages.
LANGUAGES = (
('es', _('Espaol')),
('en', _('English')),
)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
# URL to use when referring to static files located in STATIC_ROOT.
# Example: "http://media.lawrence.com/static/"
# Esto debe configurarse de manera similar que el media para poder servir archivos estticos
# Puede ser algo como esta linea comentada
# STATIC_URL = 'http://localhost:90/static/'
STATIC_URL = '/static/'
# Local time zone for this installation.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Havana'
# List of locations of the template source files searched by django.template.loaders.filesystem.Loader, in search order.
# Note that these paths should use Unix-style forward slashes, even on Windows.
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), '..', 'templates').replace('\\', '/'),)
# This setting defines the additional locations the staticfiles app will traverse if the FileSystemFinder finder is
# enabled, e.g. if you use the collectstatic or findstatic management command or use the static file serving view.
STATICFILES_DIRS = ((os.path.join(BASE_DIR, 'assets')),
(os.path.join(BASE_DIR, 'media')))
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = (os.path.join(BASE_DIR, 'static')) # URL prefix for static files.
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
# MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'assets/upload') # COMENTADO
PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
PROJECT_ROOT = os.path.join("../", PROJECT_PATH)
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media/')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
# Configurar esta lnea es importante puede quedar algo as:
# MEDIA_URL = 'http://localhost:90/media/'
# MEDIA_URL = 'http://127.0.0.1:8000/media/' # COMENTADO
# estas las import tambin
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
# The URL where requests are redirected after login when the contrib.auth.login view gets no next parameter.
LOGIN_REDIRECT_URL = '/'
# The URL where requests are redirected for login, especially when using the login_required() decorator.
LOGIN_URL = '/'
# LOGIN_URL counterpart.
LOGOUT_URL = '/logoutUser'
# TEMPLATE_CONTEXT_PROCESSORS = (
# 'django.contrib.auth.context_processors.auth',
# 'django.core.context_processors.request',
# )
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
"django.core.context_processors.request",
) | [
37811,
198,
35,
73,
14208,
6460,
329,
256,
9339,
1628,
13,
198,
198,
1890,
517,
1321,
319,
428,
2393,
11,
766,
198,
5450,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
268,
14,
16,
13,
22,
14,
4852,
873,
14,
33692,
14,
198,
198,
1890,
262,
1336,
1351,
286,
6460,
290,
511,
3815,
11,
766,
198,
5450,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
268,
14,
16,
13,
22,
14,
5420,
14,
33692,
14,
198,
37811,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
317,
46545,
326,
8341,
661,
508,
651,
2438,
4049,
19605,
13,
198,
2885,
44,
20913,
796,
357,
198,
220,
220,
220,
19203,
4826,
417,
17109,
36858,
27328,
9491,
3256,
705,
9608,
70,
36858,
4531,
31,
14816,
13,
785,
33809,
198,
8,
198,
198,
2,
10934,
13532,
2641,
262,
1628,
588,
428,
25,
28686,
13,
6978,
13,
22179,
7,
33,
11159,
62,
34720,
11,
2644,
8,
198,
11748,
28686,
198,
6738,
42625,
14208,
13,
10414,
1330,
3298,
62,
33692,
198,
198,
33,
11159,
62,
34720,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
4008,
628,
198,
2,
10729,
4261,
9050,
39410,
25,
1394,
262,
3200,
1994,
973,
287,
3227,
3200,
0,
198,
23683,
26087,
62,
20373,
796,
705,
64,
21,
66,
3,
24954,
15,
88,
4,
62,
2,
4,
5,
1229,
69,
0,
10277,
84,
15,
66,
1229,
8,
21,
19529,
65,
10,
83,
20,
7,
5066,
84,
2,
64,
834,
0,
61,
18,
31522,
71,
74,
8,
2,
75,
6,
198,
198,
2,
10729,
4261,
9050,
39410,
25,
836,
470,
1057,
351,
14257,
2900,
319,
287,
3227,
0,
198,
30531,
796,
6407,
198,
198,
2,
317,
25131,
326,
4962,
319,
14,
2364,
11055,
14257,
4235,
13,
198,
51,
3620,
6489,
6158,
62,
30531,
796,
6407,
198,
198,
2,
317,
1351,
286,
13042,
10200,
262,
2583,
14,
27830,
3891,
326,
428,
37770,
2524,
460,
4691,
13,
198,
7036,
3913,
1961,
62,
39,
10892,
50,
796,
17635,
628,
198,
2,
15678,
6770,
198,
198,
2,
317,
46545,
286,
13042,
1486,
803,
477,
5479,
326,
389,
9343,
287,
428,
37770,
9988,
198,
38604,
7036,
1961,
62,
2969,
3705,
796,
357,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
28482,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
18439,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
11299,
19199,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
82,
6202,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
37348,
1095,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
12708,
16624,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
10734,
1096,
3256,
628,
220,
220,
220,
1303,
267,
2213,
292,
6725,
198,
220,
220,
220,
705,
37424,
62,
79,
363,
1883,
3256,
198,
220,
220,
220,
705,
86,
13506,
3256,
628,
198,
220,
220,
220,
1303,
14136,
27710,
198,
220,
220,
220,
705,
1228,
436,
274,
3256,
198,
220,
220,
220,
705,
6259,
64,
3256,
198,
220,
220,
220,
705,
11578,
36,
19149,
952,
3256,
628,
220,
220,
220,
1303,
1330,
4763,
331,
953,
811,
4763,
198,
220,
220,
220,
705,
12417,
3256,
198,
8,
198,
4537,
38,
1268,
6234,
62,
28480,
51,
20754,
796,
1391,
198,
220,
220,
220,
705,
4537,
8264,
62,
49,
27746,
62,
26288,
31519,
1961,
10354,
838,
11,
198,
220,
220,
220,
705,
40569,
38,
1268,
62,
4537,
48075,
62,
26288,
31519,
1961,
10354,
352,
11,
198,
92,
198,
2,
6046,
1574,
318,
257,
9355,
286,
26569,
656,
19307,
648,
418,
2581,
14,
26209,
7587,
13,
198,
44,
2389,
35,
2538,
33746,
62,
31631,
1546,
796,
357,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
82,
6202,
13,
27171,
1574,
13,
36044,
34621,
1574,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
27171,
1574,
13,
11321,
13,
17227,
34621,
1574,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
27171,
1574,
13,
6359,
41871,
13,
34,
27891,
69,
7680,
34621,
1574,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
18439,
13,
27171,
1574,
13,
47649,
3299,
34621,
1574,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
18439,
13,
27171,
1574,
13,
36044,
47649,
3299,
34621,
1574,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
3642,
822,
13,
37348,
1095,
13,
27171,
1574,
13,
12837,
34621,
1574,
3256,
198,
220,
220,
220,
705,
28241,
14208,
13,
27171,
1574,
13,
12976,
73,
5430,
13,
55,
19778,
29046,
34621,
1574,
3256,
198,
8,
198,
198,
2,
317,
4731,
10200,
262,
1336,
11361,
1330,
3108,
284,
534,
6808,
10289,
10414,
13,
198,
13252,
2394,
62,
4261,
5639,
1340,
37,
796,
705,
4879,
271,
13,
6371,
82,
6,
198,
198,
2,
383,
1336,
11361,
3108,
286,
262,
25290,
18878,
3586,
2134,
326,
19307,
648,
418,
3170,
12,
259,
9597,
357,
68,
13,
70,
13,
1057,
15388,
8,
481,
779,
13,
198,
19416,
18878,
62,
2969,
31484,
6234,
796,
705,
4879,
271,
13,
18504,
12397,
13,
31438,
6,
628,
198,
2,
24047,
198,
2,
3740,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
268,
14,
16,
13,
22,
14,
5420,
14,
33692,
31113,
19608,
18826,
198,
198,
2,
317,
22155,
7268,
262,
6460,
329,
477,
20083,
284,
307,
973,
351,
37770,
13,
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,
28744,
13976,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
705,
3185,
51,
11053,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
961,
62,
12286,
62,
7753,
10354,
28686,
13,
6978,
13,
22179,
7,
33,
11159,
62,
34720,
11,
705,
1820,
13,
31522,
69,
33809,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
15003,
62,
21812,
10354,
705,
28480,
6143,
62,
18392,
28,
1268,
45,
3727,
33,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
8964,
198,
220,
220,
220,
1782,
198,
92,
198,
198,
2,
4037,
1634,
198,
2,
3740,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
268,
14,
16,
13,
22,
14,
4852,
873,
14,
72,
1507,
77,
14,
198,
198,
2,
15417,
2438,
329,
428,
9988,
13,
198,
43,
15567,
52,
11879,
62,
34,
16820,
796,
705,
274,
12,
43633,
6,
198,
198,
2,
317,
25131,
326,
26052,
1771,
19307,
648,
418,
11059,
1080,
815,
307,
9343,
13,
198,
2,
770,
3769,
281,
2562,
835,
284,
1210,
340,
572,
11,
329,
2854,
13,
1002,
428,
318,
900,
284,
10352,
11,
198,
2,
37770,
481,
787,
617,
41446,
523,
355,
407,
284,
3440,
262,
11059,
20230,
13,
198,
19108,
62,
40,
1507,
45,
796,
6407,
198,
198,
2,
317,
25131,
326,
26052,
611,
36618,
33313,
286,
1366,
481,
307,
9343,
416,
4277,
393,
407,
13,
198,
2,
1002,
428,
318,
900,
284,
6407,
11,
304,
13,
70,
13,
37770,
481,
3359,
3146,
290,
9667,
1262,
262,
5794,
286,
262,
1459,
36693,
13,
198,
19108,
62,
43,
940,
45,
796,
6407,
198,
198,
2,
317,
25131,
326,
26052,
611,
4818,
46874,
481,
307,
640,
11340,
12,
9685,
416,
4277,
393,
407,
13,
198,
2,
1002,
428,
318,
900,
284,
6407,
11,
37770,
481,
779,
640,
11340,
12,
9685,
4818,
46874,
20947,
13,
198,
2,
15323,
11,
37770,
481,
779,
24354,
4818,
46874,
287,
1957,
640,
13,
198,
19108,
62,
51,
57,
796,
6407,
198,
198,
2,
7913,
10200,
262,
717,
1110,
286,
262,
1285,
13,
198,
39776,
2257,
62,
26442,
62,
19238,
62,
54,
33823,
796,
352,
198,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
334,
1136,
5239,
62,
75,
12582,
355,
4808,
198,
198,
2,
317,
46545,
286,
477,
1695,
8950,
13,
198,
43,
15567,
52,
25552,
796,
357,
198,
220,
220,
220,
19203,
274,
3256,
4808,
10786,
36,
2777,
64,
349,
11537,
828,
198,
220,
220,
220,
19203,
268,
3256,
4808,
10786,
15823,
11537,
828,
198,
8,
198,
198,
2,
36125,
3696,
357,
49155,
11,
11933,
11,
5382,
8,
198,
2,
3740,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
268,
14,
16,
13,
22,
14,
4919,
1462,
14,
12708,
12,
16624,
14,
198,
198,
2,
10289,
284,
779,
618,
9759,
284,
9037,
3696,
5140,
287,
15486,
2149,
62,
13252,
2394,
13,
198,
2,
17934,
25,
366,
4023,
1378,
11431,
13,
6270,
6784,
13,
785,
14,
12708,
30487,
198,
2,
10062,
78,
390,
1350,
4566,
333,
17208,
390,
582,
8607,
2092,
8358,
1288,
2056,
31215,
279,
12342,
1113,
343,
3934,
452,
418,
1556,
13370,
418,
198,
2,
350,
1739,
68,
1055,
435,
2188,
401,
78,
1556,
64,
1627,
64,
401,
298,
4763,
198,
2,
15486,
2149,
62,
21886,
796,
705,
4023,
1378,
36750,
25,
3829,
14,
12708,
14,
6,
198,
35744,
2149,
62,
21886,
796,
31051,
12708,
14,
6,
198,
198,
2,
10714,
640,
6516,
329,
428,
9988,
13,
198,
2,
1550,
33501,
3341,
11,
257,
1988,
286,
6045,
481,
2728,
37770,
284,
779,
262,
976,
198,
2,
640,
11340,
355,
262,
5361,
1080,
13,
198,
2,
1002,
2491,
287,
257,
3964,
2858,
428,
1276,
307,
900,
284,
262,
976,
355,
534,
198,
2,
1080,
640,
6516,
13,
198,
34694,
62,
57,
11651,
796,
705,
18165,
14,
39,
615,
2271,
6,
198,
198,
2,
7343,
286,
7064,
286,
262,
11055,
2723,
3696,
16499,
416,
42625,
14208,
13,
28243,
13,
2220,
364,
13,
16624,
6781,
13,
17401,
11,
287,
2989,
1502,
13,
198,
2,
5740,
326,
777,
13532,
815,
779,
33501,
12,
7635,
2651,
1017,
7465,
11,
772,
319,
3964,
13,
198,
51,
3620,
6489,
6158,
62,
34720,
50,
796,
357,
198,
220,
220,
220,
28686,
13,
6978,
13,
22179,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
828,
705,
492,
3256,
705,
11498,
17041,
27691,
33491,
10786,
6852,
3256,
31051,
33809,
8,
628,
198,
2,
770,
4634,
15738,
262,
3224,
7064,
262,
9037,
16624,
598,
481,
38138,
611,
262,
9220,
11964,
37,
5540,
1064,
263,
318,
198,
2,
9343,
11,
304,
13,
70,
13,
611,
345,
779,
262,
2824,
12708,
393,
1064,
12708,
4542,
3141,
393,
779,
262,
9037,
2393,
7351,
1570,
13,
198,
35744,
2149,
46700,
1546,
62,
34720,
50,
796,
14808,
418,
13,
6978,
13,
22179,
7,
33,
11159,
62,
34720,
11,
705,
19668,
11537,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
418,
13,
6978,
13,
22179,
7,
33,
11159,
62,
34720,
11,
705,
11431,
6,
22305,
628,
198,
2,
36532,
3108,
284,
262,
8619,
9037,
3696,
815,
307,
7723,
284,
13,
198,
2,
2094,
470,
1234,
1997,
287,
428,
8619,
3511,
26,
3650,
534,
9037,
3696,
198,
2,
287,
6725,
6,
366,
12708,
30487,
850,
12942,
1749,
290,
287,
15486,
2149,
46700,
1546,
62,
34720,
50,
13,
198,
2,
17934,
25,
12813,
11195,
14,
11431,
14,
11431,
13,
6270,
6784,
13,
785,
14,
12708,
30487,
198,
35744,
2149,
62,
13252,
2394,
796,
357,
418,
13,
6978,
13,
22179,
7,
33,
11159,
62,
34720,
11,
705,
12708,
6,
4008,
220,
1303,
10289,
21231,
329,
9037,
3696,
13,
198,
198,
2,
36532,
29905,
3108,
284,
262,
8619,
326,
481,
1745,
2836,
12,
25850,
276,
3696,
13,
198,
2,
17934,
25,
12813,
11195,
14,
11431,
14,
11431,
13,
6270,
6784,
13,
785,
14,
11431,
30487,
198,
2,
26112,
3539,
62,
13252,
2394,
796,
28686,
13,
6978,
13,
22179,
7,
31190,
23680,
62,
13252,
2394,
11,
705,
19668,
14,
25850,
11537,
220,
1303,
9440,
3525,
2885,
46,
198,
31190,
23680,
62,
34219,
796,
28686,
13,
6978,
13,
15908,
3672,
7,
418,
13,
6978,
13,
15908,
3672,
7,
834,
7753,
834,
4008,
198,
31190,
23680,
62,
13252,
2394,
796,
28686,
13,
6978,
13,
22179,
7203,
40720,
1600,
21965,
23680,
62,
34219,
8,
198,
30733,
3539,
62,
13252,
2394,
796,
28686,
13,
6978,
13,
22179,
7,
31190,
23680,
62,
13252,
2394,
11,
705,
11431,
14,
11537,
628,
198,
2,
10289,
326,
17105,
262,
2056,
4983,
422,
26112,
3539,
62,
13252,
2394,
13,
6889,
1654,
284,
779,
257,
198,
2,
25462,
24632,
13,
198,
2,
21066,
25,
366,
4023,
1378,
11431,
13,
6270,
6784,
13,
785,
14,
11431,
14,
1600,
366,
4023,
1378,
20688,
13,
785,
14,
11431,
30487,
198,
2,
17056,
333,
283,
1556,
64,
300,
39718,
1658,
1593,
68,
279,
1739,
68,
627,
44226,
435,
2188,
355,
25,
198,
2,
26112,
3539,
62,
21886,
796,
705,
4023,
1378,
36750,
25,
3829,
14,
11431,
14,
6,
198,
2,
26112,
3539,
62,
21886,
796,
705,
4023,
1378,
16799,
13,
15,
13,
15,
13,
16,
25,
33942,
14,
11431,
14,
6,
220,
1303,
9440,
3525,
2885,
46,
198,
198,
2,
1556,
292,
39990,
1330,
256,
4131,
259,
198,
2,
317,
6291,
18931,
8398,
13,
383,
691,
24607,
18931,
198,
2,
6157,
416,
428,
8398,
318,
284,
3758,
281,
3053,
284,
198,
2,
262,
2524,
44563,
319,
790,
14626,
5323,
4049,
618,
16959,
28,
25101,
13,
198,
2,
4091,
2638,
1378,
31628,
13,
28241,
648,
404,
305,
752,
13,
785,
14,
268,
14,
7959,
14,
4852,
873,
14,
6404,
2667,
329,
198,
2,
517,
3307,
319,
703,
284,
24184,
534,
18931,
8398,
13,
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,
10379,
1010,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
46115,
62,
24442,
62,
9562,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
3419,
10354,
705,
28241,
14208,
13,
26791,
13,
6404,
13,
16844,
557,
27509,
25101,
6,
198,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
8964,
198,
220,
220,
220,
705,
4993,
8116,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
705,
4529,
62,
324,
42951,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
5715,
10354,
705,
24908,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
10379,
1010,
10354,
37250,
46115,
62,
24442,
62,
9562,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4871,
10354,
705,
28241,
14208,
13,
26791,
13,
6404,
13,
46787,
15333,
25060,
6,
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,
28241,
14208,
13,
25927,
10354,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
4993,
8116,
10354,
37250,
4529,
62,
324,
42951,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
5715,
10354,
705,
24908,
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,
8964,
198,
220,
220,
220,
1782,
198,
92,
628,
198,
2,
383,
10289,
810,
7007,
389,
45158,
706,
17594,
618,
262,
542,
822,
13,
18439,
13,
38235,
1570,
3011,
645,
1306,
11507,
13,
198,
25294,
1268,
62,
22083,
40,
23988,
62,
21886,
796,
31051,
6,
198,
198,
2,
383,
10289,
810,
7007,
389,
45158,
329,
17594,
11,
2592,
618,
1262,
262,
17594,
62,
35827,
3419,
11705,
1352,
13,
198,
25294,
1268,
62,
21886,
796,
31051,
6,
198,
198,
2,
41605,
1268,
62,
21886,
11283,
13,
198,
25294,
12425,
62,
21886,
796,
31051,
6404,
448,
12982,
6,
198,
198,
2,
309,
3620,
6489,
6158,
62,
10943,
32541,
62,
4805,
4503,
7597,
20673,
796,
357,
198,
2,
705,
28241,
14208,
13,
3642,
822,
13,
18439,
13,
22866,
62,
14681,
669,
13,
18439,
3256,
198,
2,
220,
220,
220,
220,
705,
28241,
14208,
13,
7295,
13,
22866,
62,
14681,
669,
13,
25927,
3256,
198,
2,
1267,
198,
198,
51,
3620,
6489,
6158,
62,
10943,
32541,
62,
4805,
4503,
7597,
20673,
796,
3298,
62,
33692,
13,
51,
3620,
6489,
6158,
62,
10943,
32541,
62,
4805,
4503,
7597,
20673,
1343,
357,
198,
220,
220,
220,
366,
28241,
14208,
13,
7295,
13,
22866,
62,
14681,
669,
13,
25927,
1600,
198,
8
] | 2.821219 | 2,724 |
#!/usr/bin/env python
# This software code is made available "AS IS" without warranties of any
# kind. You may copy, display, modify and redistribute the software
# code either by itself or as incorporated into your code; provided that
# you do not remove any proprietary notices. Your use of this software
# code is at your own risk and you waive any claim against Amazon
# Digital Services, Inc. or its affiliates with respect to your use of
# this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its
# affiliates.
import S3
import time
import sys
AWS_ACCESS_KEY_ID = '<INSERT YOUR AWS ACCESS KEY ID HERE>'
AWS_SECRET_ACCESS_KEY = '<INSERT YOUR AWS SECRET ACCESS KEY HERE>'
# remove these next two lines when you've updated your credentials.
print "update s3-driver.py with your AWS credentials"
sys.exit();
# convert the bucket to lowercase for vanity domains
# the bucket name must be lowercase since DNS is case-insensitive
BUCKET_NAME = AWS_ACCESS_KEY_ID.lower() + '-test-bucket'
KEY_NAME = 'test-key'
conn = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
generator = S3.QueryStringAuthGenerator(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
# Check if the bucket exists. The high availability engineering of
# Amazon S3 is focused on get, put, list, and delete operations.
# Because bucket operations work against a centralized, global
# resource space, it is not appropriate to make bucket create or
# delete calls on the high availability code path of your application.
# It is better to create or delete buckets in a separate initialization
# or setup routine that you run less often.
if (conn.check_bucket_exists(BUCKET_NAME).status == 200):
print '----- bucket already exists! -----'
else:
print '----- creating bucket -----'
print conn.create_located_bucket(BUCKET_NAME, S3.Location.DEFAULT).message
# to create an EU bucket
#print conn.create_located_bucket(BUCKET_NAME, S3.Location.EU).message
print '----- bucket location -----'
print conn.get_bucket_location(BUCKET_NAME).location
print '----- listing bucket -----'
print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries)
print '----- putting object (with content type) -----'
print conn.put(
BUCKET_NAME,
KEY_NAME,
S3.S3Object('this is a test'),
{ 'Content-Type': 'text/plain' }).message
print '----- listing bucket -----'
print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries)
print '----- getting object -----'
print conn.get(BUCKET_NAME, KEY_NAME).object.data
print '----- query string auth example -----'
print "\nTry this url out in your browser (it will only be valid for 60 seconds).\n"
generator.set_expires_in(60);
url = generator.get(BUCKET_NAME, KEY_NAME)
print url
print '\npress enter> ',
sys.stdin.readline()
print "\nNow try just the url without the query string arguments. it should fail.\n"
print generator.make_bare_url(BUCKET_NAME, KEY_NAME)
print '\npress enter> ',
sys.stdin.readline()
print '----- putting object with metadata and public read acl -----'
print conn.put(
BUCKET_NAME,
KEY_NAME + '-public',
S3.S3Object('this is a publicly readable test'),
{ 'x-amz-acl': 'public-read' , 'Content-Type': 'text/plain' }
).message
print '----- anonymous read test ----'
print "\nYou should be able to try this in your browser\n"
public_key = KEY_NAME + '-public'
print generator.make_bare_url(BUCKET_NAME, public_key)
print "\npress enter> ",
sys.stdin.readline()
print "----- getting object's acl -----"
print conn.get_acl(BUCKET_NAME, KEY_NAME).object.data
print "\n----- path style url example -----";
print "Non-location-constrained buckets can also be specified as part of the url path. (This was the original url style supported by S3.)\n";
print "Try this url out in your browser (it will only be valid for 60 seconds).\n"
generator.calling_format = S3.CallingFormat.PATH
url = generator.get(BUCKET_NAME, KEY_NAME)
print url
print "\npress enter> ",
sys.stdin.readline()
print '----- deleting objects -----'
print conn.delete(BUCKET_NAME, KEY_NAME).message
print conn.delete(BUCKET_NAME, KEY_NAME + '-public').message
print '----- listing bucket -----'
print map(lambda x: x.key, conn.list_bucket(BUCKET_NAME).entries)
print '----- listing all my buckets -----'
print map(lambda x: x.name, conn.list_all_my_buckets().entries)
print '----- deleting bucket ------'
print conn.delete_bucket(BUCKET_NAME).message
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
198,
2,
220,
770,
3788,
2438,
318,
925,
1695,
366,
1921,
3180,
1,
1231,
50174,
286,
597,
198,
2,
220,
1611,
13,
220,
921,
743,
4866,
11,
3359,
11,
13096,
290,
17678,
4163,
262,
3788,
198,
2,
220,
2438,
2035,
416,
2346,
393,
355,
16560,
656,
534,
2438,
26,
2810,
326,
198,
2,
220,
345,
466,
407,
4781,
597,
20622,
19748,
13,
220,
3406,
779,
286,
428,
3788,
198,
2,
220,
2438,
318,
379,
534,
898,
2526,
290,
345,
40307,
597,
1624,
1028,
6186,
198,
2,
220,
10231,
6168,
11,
3457,
13,
393,
663,
29116,
351,
2461,
284,
534,
779,
286,
198,
2,
220,
428,
3788,
2438,
13,
357,
66,
8,
4793,
12,
12726,
6186,
10231,
6168,
11,
3457,
13,
393,
663,
198,
2,
220,
29116,
13,
198,
198,
11748,
311,
18,
198,
11748,
640,
198,
11748,
25064,
198,
198,
12298,
50,
62,
26861,
7597,
62,
20373,
62,
2389,
796,
705,
27,
20913,
17395,
16592,
30865,
15859,
7597,
35374,
4522,
15698,
29,
6,
198,
12298,
50,
62,
23683,
26087,
62,
26861,
7597,
62,
20373,
796,
705,
27,
20913,
17395,
16592,
30865,
10729,
26087,
15859,
7597,
35374,
15698,
29,
6,
198,
2,
4781,
777,
1306,
734,
3951,
618,
345,
1053,
6153,
534,
18031,
13,
198,
4798,
366,
19119,
264,
18,
12,
26230,
13,
9078,
351,
534,
30865,
18031,
1,
198,
17597,
13,
37023,
9783,
198,
198,
2,
10385,
262,
19236,
284,
2793,
7442,
329,
39609,
18209,
198,
2,
262,
19236,
1438,
1276,
307,
2793,
7442,
1201,
18538,
318,
1339,
12,
1040,
18464,
198,
33,
16696,
2767,
62,
20608,
796,
30865,
62,
26861,
7597,
62,
20373,
62,
2389,
13,
21037,
3419,
1343,
705,
12,
9288,
12,
27041,
316,
6,
198,
20373,
62,
20608,
796,
705,
9288,
12,
2539,
6,
198,
198,
37043,
796,
311,
18,
13,
12298,
4090,
1071,
32048,
7,
12298,
50,
62,
26861,
7597,
62,
20373,
62,
2389,
11,
30865,
62,
23683,
26087,
62,
26861,
7597,
62,
20373,
8,
198,
8612,
1352,
796,
311,
18,
13,
20746,
10100,
30515,
8645,
1352,
7,
12298,
50,
62,
26861,
7597,
62,
20373,
62,
2389,
11,
30865,
62,
23683,
26087,
62,
26861,
7597,
62,
20373,
8,
628,
198,
2,
6822,
611,
262,
19236,
7160,
13,
220,
383,
1029,
11500,
8705,
286,
220,
198,
2,
6186,
311,
18,
318,
5670,
319,
651,
11,
1234,
11,
1351,
11,
290,
12233,
4560,
13,
220,
198,
2,
4362,
19236,
4560,
670,
1028,
257,
29024,
11,
3298,
198,
2,
8271,
2272,
11,
340,
318,
407,
5035,
284,
787,
19236,
2251,
393,
198,
2,
12233,
3848,
319,
262,
1029,
11500,
2438,
3108,
286,
534,
3586,
13,
198,
2,
632,
318,
1365,
284,
2251,
393,
12233,
38674,
287,
257,
4553,
37588,
198,
2,
393,
9058,
8027,
326,
345,
1057,
1342,
1690,
13,
198,
361,
357,
37043,
13,
9122,
62,
27041,
316,
62,
1069,
1023,
7,
33,
16696,
2767,
62,
20608,
737,
13376,
6624,
939,
2599,
198,
220,
3601,
705,
30934,
19236,
1541,
7160,
0,
13498,
19355,
198,
17772,
25,
198,
220,
3601,
705,
30934,
4441,
19236,
13498,
19355,
198,
220,
3601,
48260,
13,
17953,
62,
75,
10533,
62,
27041,
316,
7,
33,
16696,
2767,
62,
20608,
11,
311,
18,
13,
14749,
13,
7206,
38865,
737,
20500,
198,
220,
1303,
284,
2251,
281,
4576,
19236,
198,
220,
1303,
4798,
48260,
13,
17953,
62,
75,
10533,
62,
27041,
316,
7,
33,
16696,
2767,
62,
20608,
11,
311,
18,
13,
14749,
13,
19684,
737,
20500,
198,
198,
4798,
705,
30934,
19236,
4067,
13498,
19355,
198,
4798,
48260,
13,
1136,
62,
27041,
316,
62,
24886,
7,
33,
16696,
2767,
62,
20608,
737,
24886,
198,
198,
4798,
705,
30934,
13487,
19236,
13498,
19355,
198,
4798,
3975,
7,
50033,
2124,
25,
2124,
13,
2539,
11,
48260,
13,
4868,
62,
27041,
316,
7,
33,
16696,
2767,
62,
20608,
737,
298,
1678,
8,
198,
198,
4798,
705,
30934,
5137,
2134,
357,
4480,
2695,
2099,
8,
13498,
19355,
198,
4798,
48260,
13,
1996,
7,
198,
220,
220,
220,
220,
220,
220,
220,
347,
16696,
2767,
62,
20608,
11,
198,
220,
220,
220,
220,
220,
220,
220,
35374,
62,
20608,
11,
198,
220,
220,
220,
220,
220,
220,
220,
311,
18,
13,
50,
18,
10267,
10786,
5661,
318,
257,
1332,
33809,
198,
220,
220,
220,
220,
220,
220,
220,
1391,
705,
19746,
12,
6030,
10354,
705,
5239,
14,
25638,
6,
1782,
737,
20500,
198,
198,
4798,
705,
30934,
13487,
19236,
13498,
19355,
198,
4798,
3975,
7,
50033,
2124,
25,
2124,
13,
2539,
11,
48260,
13,
4868,
62,
27041,
316,
7,
33,
16696,
2767,
62,
20608,
737,
298,
1678,
8,
198,
198,
4798,
705,
30934,
1972,
2134,
13498,
19355,
198,
4798,
48260,
13,
1136,
7,
33,
16696,
2767,
62,
20608,
11,
35374,
62,
20608,
737,
15252,
13,
7890,
198,
198,
4798,
705,
30934,
12405,
4731,
6284,
1672,
13498,
19355,
198,
4798,
37082,
77,
23433,
428,
19016,
503,
287,
534,
6444,
357,
270,
481,
691,
307,
4938,
329,
3126,
4201,
737,
59,
77,
1,
198,
8612,
1352,
13,
2617,
62,
11201,
2387,
62,
259,
7,
1899,
1776,
198,
6371,
796,
17301,
13,
1136,
7,
33,
16696,
2767,
62,
20608,
11,
35374,
62,
20608,
8,
198,
4798,
19016,
198,
4798,
705,
59,
77,
8439,
3802,
29,
46083,
198,
17597,
13,
19282,
259,
13,
961,
1370,
3419,
198,
198,
4798,
37082,
77,
3844,
1949,
655,
262,
19016,
1231,
262,
12405,
4731,
7159,
13,
220,
340,
815,
2038,
13,
59,
77,
1,
198,
4798,
17301,
13,
15883,
62,
49382,
62,
6371,
7,
33,
16696,
2767,
62,
20608,
11,
35374,
62,
20608,
8,
198,
4798,
705,
59,
77,
8439,
3802,
29,
46083,
198,
17597,
13,
19282,
259,
13,
961,
1370,
3419,
628,
198,
4798,
705,
30934,
5137,
2134,
351,
20150,
290,
1171,
1100,
257,
565,
13498,
19355,
198,
4798,
48260,
13,
1996,
7,
198,
220,
220,
220,
347,
16696,
2767,
62,
20608,
11,
198,
220,
220,
220,
35374,
62,
20608,
1343,
705,
12,
11377,
3256,
198,
220,
220,
220,
311,
18,
13,
50,
18,
10267,
10786,
5661,
318,
257,
7271,
31744,
1332,
33809,
198,
220,
220,
220,
1391,
705,
87,
12,
321,
89,
12,
37779,
10354,
705,
11377,
12,
961,
6,
837,
705,
19746,
12,
6030,
10354,
705,
5239,
14,
25638,
6,
1782,
198,
737,
20500,
198,
198,
4798,
705,
30934,
11614,
1100,
1332,
13498,
6,
198,
4798,
37082,
77,
1639,
815,
307,
1498,
284,
1949,
428,
287,
534,
6444,
59,
77,
1,
198,
11377,
62,
2539,
796,
35374,
62,
20608,
1343,
705,
12,
11377,
6,
198,
4798,
17301,
13,
15883,
62,
49382,
62,
6371,
7,
33,
16696,
2767,
62,
20608,
11,
1171,
62,
2539,
8,
198,
4798,
37082,
77,
8439,
3802,
29,
33172,
198,
17597,
13,
19282,
259,
13,
961,
1370,
3419,
198,
198,
4798,
366,
30934,
1972,
2134,
338,
257,
565,
13498,
21215,
198,
4798,
48260,
13,
1136,
62,
37779,
7,
33,
16696,
2767,
62,
20608,
11,
35374,
62,
20608,
737,
15252,
13,
7890,
198,
198,
4798,
37082,
77,
30934,
3108,
3918,
19016,
1672,
37404,
8172,
198,
4798,
366,
15419,
12,
24886,
12,
1102,
2536,
1328,
38674,
460,
635,
307,
7368,
355,
636,
286,
262,
19016,
3108,
13,
220,
357,
1212,
373,
262,
2656,
19016,
3918,
4855,
416,
311,
18,
2014,
59,
77,
8172,
198,
4798,
366,
23433,
428,
19016,
503,
287,
534,
6444,
357,
270,
481,
691,
307,
4938,
329,
3126,
4201,
737,
59,
77,
1,
198,
8612,
1352,
13,
44714,
62,
18982,
796,
311,
18,
13,
48593,
26227,
13,
34219,
198,
6371,
796,
17301,
13,
1136,
7,
33,
16696,
2767,
62,
20608,
11,
35374,
62,
20608,
8,
198,
4798,
19016,
198,
4798,
37082,
77,
8439,
3802,
29,
33172,
198,
17597,
13,
19282,
259,
13,
961,
1370,
3419,
198,
198,
4798,
705,
30934,
34817,
5563,
13498,
19355,
198,
4798,
48260,
13,
33678,
7,
33,
16696,
2767,
62,
20608,
11,
35374,
62,
20608,
737,
20500,
198,
4798,
48260,
13,
33678,
7,
33,
16696,
2767,
62,
20608,
11,
35374,
62,
20608,
1343,
705,
12,
11377,
27691,
20500,
198,
198,
4798,
705,
30934,
13487,
19236,
13498,
19355,
198,
4798,
3975,
7,
50033,
2124,
25,
2124,
13,
2539,
11,
48260,
13,
4868,
62,
27041,
316,
7,
33,
16696,
2767,
62,
20608,
737,
298,
1678,
8,
198,
198,
4798,
705,
30934,
13487,
477,
616,
38674,
13498,
19355,
198,
4798,
3975,
7,
50033,
2124,
25,
2124,
13,
3672,
11,
48260,
13,
4868,
62,
439,
62,
1820,
62,
27041,
1039,
22446,
298,
1678,
8,
198,
198,
4798,
705,
30934,
34817,
19236,
40103,
6,
198,
4798,
48260,
13,
33678,
62,
27041,
316,
7,
33,
16696,
2767,
62,
20608,
737,
20500,
628
] | 3.15696 | 1,408 |
from __future__ import absolute_import, division, print_function
from models.base_net import BaseNet
import losses.all as losses_lib
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
import pdb
import optimizers.train_steps as train_steps
import optimizers.ops as optimize
from functools import partial
import models.fcrn
from models.fcrn import ResNet50UpProj
| [
198,
6738,
11593,
37443,
834,
1330,
4112,
62,
11748,
11,
7297,
11,
3601,
62,
8818,
198,
198,
6738,
220,
220,
4981,
13,
8692,
62,
3262,
1330,
7308,
7934,
198,
11748,
9089,
13,
439,
355,
9089,
62,
8019,
198,
11748,
11192,
273,
11125,
355,
48700,
198,
11748,
11192,
273,
11125,
13,
3642,
822,
13,
82,
2475,
355,
18862,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
279,
9945,
198,
11748,
6436,
11341,
13,
27432,
62,
20214,
355,
4512,
62,
20214,
198,
11748,
6436,
11341,
13,
2840,
355,
27183,
198,
6738,
1257,
310,
10141,
1330,
13027,
198,
11748,
4981,
13,
69,
6098,
77,
198,
6738,
4981,
13,
69,
6098,
77,
1330,
1874,
7934,
1120,
4933,
2964,
73,
628,
198
] | 3.410256 | 117 |
# trigger build
import json
import uuid
import pytest
from mock import MagicMock, patch
from src import handler, db
from src.models import User, MiniApp, TObject
from src.constants import ROLE
from werkzeug.exceptions import BadRequest
def test_execute_obj_post_no_permission():
with pytest.raises(BadRequest):
handler.execute_obj_post(MagicMock(), MagicMock(), ROLE.STANDARD, MagicMock())
def test_execute_obj_delete_no_permission():
obj = MagicMock()
oid_list = []
with pytest.raises(BadRequest):
handler.execute_obj_delete(obj, ROLE.STANDARD, oid_list)
def test_serialize_objs():
obj1 = MagicMock(oid='oid1')
obj2 = MagicMock(oid='oid2')
obj1.serialize.return_value = 'obj1'
obj2.serialize.return_value = 'obj2'
objs = [obj1, obj2]
user = MagicMock()
assert {'oid1': 'obj1', 'oid2': 'obj2'} == handler.serialize_objs(user, objs, ROLE.ADMIN)
obj1.serialize.assert_called_once_with(user, ROLE.ADMIN)
obj2.serialize.assert_called_once_with(user, ROLE.ADMIN)
def test_get_graph_obj_not_exist():
with pytest.raises(BadRequest):
handler.get_graph_obj('none existing aid', MiniApp)
def test_get_graph_obj_user_not_exist():
uid = str(uuid.uuid4())
u = handler.get_graph_obj(uid, User)
assert u.uid == uid
db.delete(u)
def test_get_graph_obj_exist():
app = MiniApp()
aid = str(uuid.uuid4())
app.aid = aid
db.push(app)
db.pull(app)
assert app == handler.get_graph_obj(aid, MiniApp)
db.delete(app)
def test_handle_obj_patch_root():
with pytest.raises(BadRequest):
handler.handle_obj_patch('root', '')
| [
2,
7616,
1382,
198,
11748,
33918,
198,
11748,
334,
27112,
198,
11748,
12972,
9288,
198,
6738,
15290,
1330,
6139,
44,
735,
11,
8529,
198,
6738,
12351,
1330,
21360,
11,
20613,
198,
6738,
12351,
13,
27530,
1330,
11787,
11,
12558,
4677,
11,
5390,
65,
752,
198,
6738,
12351,
13,
9979,
1187,
1330,
15107,
2538,
198,
6738,
266,
9587,
2736,
1018,
13,
1069,
11755,
1330,
7772,
18453,
628,
628,
198,
198,
4299,
1332,
62,
41049,
62,
26801,
62,
7353,
62,
3919,
62,
525,
3411,
33529,
198,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
22069,
18453,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
21360,
13,
41049,
62,
26801,
62,
7353,
7,
22975,
44,
735,
22784,
6139,
44,
735,
22784,
15107,
2538,
13,
2257,
6981,
9795,
11,
6139,
44,
735,
28955,
628,
628,
198,
198,
4299,
1332,
62,
41049,
62,
26801,
62,
33678,
62,
3919,
62,
525,
3411,
33529,
198,
220,
220,
220,
26181,
796,
6139,
44,
735,
3419,
198,
220,
220,
220,
267,
312,
62,
4868,
796,
17635,
198,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
22069,
18453,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
21360,
13,
41049,
62,
26801,
62,
33678,
7,
26801,
11,
15107,
2538,
13,
2257,
6981,
9795,
11,
267,
312,
62,
4868,
8,
628,
198,
4299,
1332,
62,
46911,
1096,
62,
672,
8457,
33529,
198,
220,
220,
220,
26181,
16,
796,
6139,
44,
735,
7,
1868,
11639,
1868,
16,
11537,
198,
220,
220,
220,
26181,
17,
796,
6139,
44,
735,
7,
1868,
11639,
1868,
17,
11537,
198,
220,
220,
220,
26181,
16,
13,
46911,
1096,
13,
7783,
62,
8367,
796,
705,
26801,
16,
6,
198,
220,
220,
220,
26181,
17,
13,
46911,
1096,
13,
7783,
62,
8367,
796,
705,
26801,
17,
6,
198,
220,
220,
220,
909,
8457,
796,
685,
26801,
16,
11,
26181,
17,
60,
198,
220,
220,
220,
2836,
796,
6139,
44,
735,
3419,
198,
220,
220,
220,
6818,
1391,
6,
1868,
16,
10354,
705,
26801,
16,
3256,
705,
1868,
17,
10354,
705,
26801,
17,
6,
92,
6624,
21360,
13,
46911,
1096,
62,
672,
8457,
7,
7220,
11,
909,
8457,
11,
15107,
2538,
13,
2885,
23678,
8,
198,
220,
220,
220,
26181,
16,
13,
46911,
1096,
13,
30493,
62,
7174,
62,
27078,
62,
4480,
7,
7220,
11,
15107,
2538,
13,
2885,
23678,
8,
198,
220,
220,
220,
26181,
17,
13,
46911,
1096,
13,
30493,
62,
7174,
62,
27078,
62,
4480,
7,
7220,
11,
15107,
2538,
13,
2885,
23678,
8,
628,
628,
628,
628,
198,
4299,
1332,
62,
1136,
62,
34960,
62,
26801,
62,
1662,
62,
38476,
33529,
198,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
22069,
18453,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
21360,
13,
1136,
62,
34960,
62,
26801,
10786,
23108,
4683,
6133,
3256,
12558,
4677,
8,
628,
198,
4299,
1332,
62,
1136,
62,
34960,
62,
26801,
62,
7220,
62,
1662,
62,
38476,
33529,
198,
220,
220,
220,
334,
312,
796,
965,
7,
12303,
312,
13,
12303,
312,
19,
28955,
198,
220,
220,
220,
334,
796,
21360,
13,
1136,
62,
34960,
62,
26801,
7,
27112,
11,
11787,
8,
198,
220,
220,
220,
6818,
334,
13,
27112,
6624,
334,
312,
198,
220,
220,
220,
20613,
13,
33678,
7,
84,
8,
628,
198,
4299,
1332,
62,
1136,
62,
34960,
62,
26801,
62,
38476,
33529,
198,
220,
220,
220,
598,
796,
12558,
4677,
3419,
198,
220,
220,
220,
6133,
796,
965,
7,
12303,
312,
13,
12303,
312,
19,
28955,
198,
220,
220,
220,
598,
13,
1698,
796,
6133,
198,
220,
220,
220,
20613,
13,
14689,
7,
1324,
8,
198,
220,
220,
220,
20613,
13,
31216,
7,
1324,
8,
198,
220,
220,
220,
6818,
598,
6624,
21360,
13,
1136,
62,
34960,
62,
26801,
7,
1698,
11,
12558,
4677,
8,
198,
220,
220,
220,
20613,
13,
33678,
7,
1324,
8,
628,
628,
628,
198,
4299,
1332,
62,
28144,
62,
26801,
62,
17147,
62,
15763,
33529,
198,
220,
220,
220,
351,
12972,
9288,
13,
430,
2696,
7,
22069,
18453,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
21360,
13,
28144,
62,
26801,
62,
17147,
10786,
15763,
3256,
10148,
8,
628
] | 2.423358 | 685 |
try:
import uuid
except ModuleNotFoundError as err:
uuid = None
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
PATTERN = [8, 4, 4, 4, 12]
SEP = "-"
| [
28311,
25,
198,
220,
220,
220,
1330,
334,
27112,
198,
16341,
19937,
3673,
21077,
12331,
355,
11454,
25,
198,
220,
220,
220,
334,
27112,
796,
6045,
198,
198,
1847,
11909,
6242,
2767,
796,
366,
24694,
32988,
17511,
23852,
42,
31288,
45,
3185,
48,
49,
2257,
52,
30133,
34278,
57,
10163,
2231,
30924,
3829,
1,
198,
47,
1404,
31800,
796,
685,
23,
11,
604,
11,
604,
11,
604,
11,
1105,
60,
198,
5188,
47,
796,
366,
21215,
628
] | 2.090909 | 77 |
# Copyright (c) 2019-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import glob
import unittest
from typing import List, Optional
from unittest.mock import MagicMock, patch
from .. import BuilderException, FastBuckBuilder, Target, parser
from ..build_target import (
BuildTarget,
PythonBinary,
PythonLibrary,
PythonWheel,
ThriftLibrary,
)
from ..filesystem import Sources
from .test_common import base
| [
2,
15069,
357,
66,
8,
13130,
12,
25579,
11,
3203,
11,
3457,
13,
198,
2,
198,
2,
770,
2723,
2438,
318,
11971,
739,
262,
17168,
5964,
1043,
287,
262,
198,
2,
38559,
24290,
2393,
287,
262,
6808,
8619,
286,
428,
2723,
5509,
13,
198,
198,
11748,
15095,
198,
11748,
555,
715,
395,
198,
6738,
19720,
1330,
7343,
11,
32233,
198,
6738,
555,
715,
395,
13,
76,
735,
1330,
6139,
44,
735,
11,
8529,
198,
198,
6738,
11485,
1330,
35869,
16922,
11,
12549,
33,
1347,
32875,
11,
12744,
11,
30751,
198,
6738,
11485,
11249,
62,
16793,
1330,
357,
198,
220,
220,
220,
10934,
21745,
11,
198,
220,
220,
220,
11361,
33,
3219,
11,
198,
220,
220,
220,
11361,
23377,
11,
198,
220,
220,
220,
11361,
45307,
11,
198,
220,
220,
220,
16283,
2135,
23377,
11,
198,
8,
198,
6738,
11485,
16624,
6781,
1330,
26406,
198,
6738,
764,
9288,
62,
11321,
1330,
2779,
628
] | 3.473684 | 152 |
from time import time
from typing import List
from core.security import verify_password
from db import users as DBUsers
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi.responses import JSONResponse
from models.user import DBUser
from schemas.user import (UserCreate, UserUpdateActivate, UserUpdatePassword,
UserUpdateSuperuser, UserView)
from sqlalchemy.orm import Session
from .deps import get_current_active_superuser, get_current_active_user, get_db
router = APIRouter(
prefix='/users',
tags=['users']
)
| [
6738,
640,
1330,
640,
198,
6738,
19720,
1330,
7343,
198,
198,
6738,
4755,
13,
12961,
1330,
11767,
62,
28712,
198,
6738,
20613,
1330,
2985,
355,
20137,
14490,
198,
6738,
3049,
15042,
1330,
3486,
4663,
39605,
11,
2129,
2412,
11,
14626,
16922,
11,
3722,
198,
6738,
3049,
15042,
13,
16733,
274,
1330,
19449,
31077,
198,
6738,
4981,
13,
7220,
1330,
20137,
12982,
198,
6738,
3897,
5356,
13,
7220,
1330,
357,
12982,
16447,
11,
11787,
10260,
25526,
378,
11,
11787,
10260,
35215,
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,
11787,
10260,
12442,
7220,
11,
11787,
7680,
8,
198,
6738,
44161,
282,
26599,
13,
579,
1330,
23575,
198,
198,
6738,
764,
10378,
82,
1330,
651,
62,
14421,
62,
5275,
62,
16668,
7220,
11,
651,
62,
14421,
62,
5275,
62,
7220,
11,
651,
62,
9945,
198,
198,
472,
353,
796,
3486,
4663,
39605,
7,
198,
220,
220,
220,
21231,
11639,
14,
18417,
3256,
198,
220,
220,
220,
15940,
28,
17816,
18417,
20520,
198,
8,
628,
628,
628,
628,
628
] | 3.135135 | 185 |
## License: Apache 2.0. See LICENSE file in root directory.
## Copyright(c) 2015-2017 Intel Corporation. All Rights Reserved.
###############################################
## Open CV and Numpy integration ##
###############################################
import pyrealsense2 as rs
import numpy as np
import cv2
# Configure depth and color streams
pipeline = rs.pipeline()
config = rs.config()
# Get device product line for setting a supporting resolution
pipeline_wrapper = rs.pipeline_wrapper(pipeline)
pipeline_profile = config.resolve(pipeline_wrapper)
device = pipeline_profile.get_device()
device_product_line = str(device.get_info(rs.camera_info.product_line))
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
width = 640
height = 480
if device_product_line == 'L500':
config.enable_stream(rs.stream.color, 960, 540, rs.format.bgr8, 30)
else:
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
# Start streaming
pipeline.start(config)
max_lowThreshold = 100
window_name = 'Edge Map'
title_trackbar = 'Min Threshold:'
ratio = 3
kernel_size = 3
try:
while True:
# Wait for a coherent pair of frames: depth and color
frames = pipeline.wait_for_frames()
depth_frame = frames.get_depth_frame()
color_frame = frames.get_color_frame()
if not depth_frame or not color_frame:
continue
# Convert images to numpy arrays
object_color = np.zeros((height, width, 3), np.uint8)
depth_image = np.asanyarray(depth_frame.get_data())
color_image = np.asanyarray(color_frame.get_data())
# depth_image_rgb = cv2.merge((depth_image,depth_image,depth_image))
# Apply colormap on depth image (image must be converted to 8-bit per pixel first)
# depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET)
# depth_colormap_dim = depth_colormap.shape
color_colormap_dim = color_image.shape
depth_image = cv2.resize(depth_image, (width, height), interpolation=cv2.INTER_AREA)
edges = auto_canny(color_image)
#edges = cv2.bitwise_not(edges)
edges_rgb = object_color.shape
edges_rgb = cv2.merge((edges,edges,edges))
#blank_image[5:10 , 5:10] = (255, 0, 0) # [x.1,x.2 , y.1,y.2] (B, G, R)
object_color[0:width, 0:height] = (76, 76, 76)
image = cv2.add(edges_rgb,object_color)
edges_rgb = cv2.bitwise_not(edges_rgb)
image = cv2.multiply(edges_rgb,image,scale = 0.003922)
image = image[0:256, 0:256]
# Show images
cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)
cv2.imshow('RealSense', image)
cv2.waitKey(1)
finally:
# Stop streaming
pipeline.stop()
| [
2235,
13789,
25,
24843,
362,
13,
15,
13,
4091,
38559,
24290,
2393,
287,
6808,
8619,
13,
201,
198,
2235,
15069,
7,
66,
8,
1853,
12,
5539,
8180,
10501,
13,
1439,
6923,
33876,
13,
201,
198,
201,
198,
29113,
7804,
4242,
21017,
201,
198,
2235,
220,
220,
220,
220,
220,
4946,
26196,
290,
399,
32152,
11812,
220,
220,
220,
220,
220,
220,
220,
22492,
201,
198,
29113,
7804,
4242,
21017,
201,
198,
201,
198,
11748,
12972,
260,
874,
1072,
17,
355,
44608,
201,
198,
11748,
299,
32152,
355,
45941,
201,
198,
11748,
269,
85,
17,
201,
198,
201,
198,
201,
198,
201,
198,
2,
17056,
495,
6795,
290,
3124,
15190,
201,
198,
79,
541,
4470,
796,
44608,
13,
79,
541,
4470,
3419,
201,
198,
11250,
796,
44608,
13,
11250,
3419,
201,
198,
201,
198,
2,
3497,
3335,
1720,
1627,
329,
4634,
257,
6493,
6323,
201,
198,
79,
541,
4470,
62,
48553,
796,
44608,
13,
79,
541,
4470,
62,
48553,
7,
79,
541,
4470,
8,
201,
198,
79,
541,
4470,
62,
13317,
796,
4566,
13,
411,
6442,
7,
79,
541,
4470,
62,
48553,
8,
201,
198,
25202,
796,
11523,
62,
13317,
13,
1136,
62,
25202,
3419,
201,
198,
25202,
62,
11167,
62,
1370,
796,
965,
7,
25202,
13,
1136,
62,
10951,
7,
3808,
13,
25695,
62,
10951,
13,
11167,
62,
1370,
4008,
201,
198,
201,
198,
11250,
13,
21633,
62,
5532,
7,
3808,
13,
5532,
13,
18053,
11,
33759,
11,
23487,
11,
44608,
13,
18982,
13,
89,
1433,
11,
1542,
8,
201,
198,
201,
198,
10394,
796,
33759,
201,
198,
17015,
796,
23487,
201,
198,
201,
198,
361,
3335,
62,
11167,
62,
1370,
6624,
705,
43,
4059,
10354,
201,
198,
220,
220,
220,
4566,
13,
21633,
62,
5532,
7,
3808,
13,
5532,
13,
8043,
11,
41263,
11,
38190,
11,
44608,
13,
18982,
13,
65,
2164,
23,
11,
1542,
8,
201,
198,
17772,
25,
201,
198,
220,
220,
220,
4566,
13,
21633,
62,
5532,
7,
3808,
13,
5532,
13,
8043,
11,
33759,
11,
23487,
11,
44608,
13,
18982,
13,
65,
2164,
23,
11,
1542,
8,
201,
198,
201,
198,
2,
7253,
11305,
201,
198,
79,
541,
4470,
13,
9688,
7,
11250,
8,
201,
198,
9806,
62,
9319,
817,
10126,
796,
1802,
201,
198,
17497,
62,
3672,
796,
705,
37021,
9347,
6,
201,
198,
7839,
62,
11659,
5657,
796,
705,
9452,
536,
10126,
32105,
201,
198,
10366,
952,
796,
513,
201,
198,
33885,
62,
7857,
796,
513,
201,
198,
201,
198,
28311,
25,
201,
198,
220,
220,
220,
981,
6407,
25,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16314,
329,
257,
24870,
5166,
286,
13431,
25,
6795,
290,
3124,
201,
198,
220,
220,
220,
220,
220,
220,
220,
13431,
796,
11523,
13,
17077,
62,
1640,
62,
37805,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
6795,
62,
14535,
796,
13431,
13,
1136,
62,
18053,
62,
14535,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3124,
62,
14535,
796,
13431,
13,
1136,
62,
8043,
62,
14535,
3419,
201,
198,
220,
220,
220,
220,
220,
220,
220,
611,
407,
6795,
62,
14535,
393,
407,
3124,
62,
14535,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
38240,
4263,
284,
299,
32152,
26515,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2134,
62,
8043,
796,
45941,
13,
9107,
418,
19510,
17015,
11,
9647,
11,
513,
828,
45941,
13,
28611,
23,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
6795,
62,
9060,
796,
45941,
13,
292,
1092,
18747,
7,
18053,
62,
14535,
13,
1136,
62,
7890,
28955,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3124,
62,
9060,
796,
45941,
13,
292,
1092,
18747,
7,
8043,
62,
14535,
13,
1136,
62,
7890,
28955,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6795,
62,
9060,
62,
81,
22296,
796,
269,
85,
17,
13,
647,
469,
19510,
18053,
62,
9060,
11,
18053,
62,
9060,
11,
18053,
62,
9060,
4008,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
27967,
951,
579,
499,
319,
6795,
2939,
357,
9060,
1276,
307,
11513,
284,
807,
12,
2545,
583,
17465,
717,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6795,
62,
4033,
579,
499,
796,
269,
85,
17,
13,
39014,
10258,
13912,
7,
33967,
17,
13,
1102,
1851,
29990,
24849,
7,
18053,
62,
9060,
11,
17130,
28,
15,
13,
3070,
828,
269,
85,
17,
13,
46786,
33767,
62,
41,
2767,
8,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6795,
62,
4033,
579,
499,
62,
27740,
796,
6795,
62,
4033,
579,
499,
13,
43358,
201,
198,
220,
220,
220,
220,
220,
220,
220,
3124,
62,
4033,
579,
499,
62,
27740,
796,
3124,
62,
9060,
13,
43358,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
6795,
62,
9060,
796,
269,
85,
17,
13,
411,
1096,
7,
18053,
62,
9060,
11,
357,
10394,
11,
6001,
828,
39555,
341,
28,
33967,
17,
13,
41358,
62,
12203,
32,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
13015,
796,
8295,
62,
66,
7737,
7,
8043,
62,
9060,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
276,
3212,
796,
269,
85,
17,
13,
2545,
3083,
62,
1662,
7,
276,
3212,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
13015,
62,
81,
22296,
796,
2134,
62,
8043,
13,
43358,
201,
198,
220,
220,
220,
220,
220,
220,
220,
13015,
62,
81,
22296,
796,
269,
85,
17,
13,
647,
469,
19510,
276,
3212,
11,
276,
3212,
11,
276,
3212,
4008,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
27190,
62,
9060,
58,
20,
25,
940,
837,
642,
25,
940,
60,
796,
357,
13381,
11,
657,
11,
657,
8,
220,
1303,
685,
87,
13,
16,
11,
87,
13,
17,
837,
331,
13,
16,
11,
88,
13,
17,
60,
357,
33,
11,
402,
11,
371,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2134,
62,
8043,
58,
15,
25,
10394,
11,
657,
25,
17015,
60,
796,
357,
4304,
11,
8684,
11,
8684,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2939,
796,
269,
85,
17,
13,
2860,
7,
276,
3212,
62,
81,
22296,
11,
15252,
62,
8043,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
13015,
62,
81,
22296,
796,
269,
85,
17,
13,
2545,
3083,
62,
1662,
7,
276,
3212,
62,
81,
22296,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2939,
796,
269,
85,
17,
13,
16680,
541,
306,
7,
276,
3212,
62,
81,
22296,
11,
9060,
11,
9888,
796,
657,
13,
405,
2670,
1828,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
2939,
796,
2939,
58,
15,
25,
11645,
11,
657,
25,
11645,
60,
201,
198,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5438,
4263,
201,
198,
220,
220,
220,
220,
220,
220,
220,
269,
85,
17,
13,
13190,
27703,
10786,
15633,
41166,
3256,
269,
85,
17,
13,
28929,
3913,
62,
39371,
2640,
35400,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
269,
85,
17,
13,
320,
12860,
10786,
15633,
41166,
3256,
2939,
8,
201,
198,
220,
220,
220,
220,
220,
220,
220,
269,
85,
17,
13,
17077,
9218,
7,
16,
8,
201,
198,
201,
198,
69,
3289,
25,
201,
198,
201,
198,
220,
220,
220,
1303,
13707,
11305,
201,
198,
220,
220,
220,
11523,
13,
11338,
3419,
201,
198
] | 2.308247 | 1,249 |
import logging
import os
import psycopg2
import time
import shlex
import subprocess
import shutil
import threading
from urllib.parse import urlparse
logger = logging.getLogger(__name__)
| [
11748,
18931,
198,
11748,
28686,
198,
11748,
17331,
22163,
70,
17,
198,
11748,
640,
198,
11748,
427,
2588,
198,
11748,
850,
14681,
198,
11748,
4423,
346,
198,
11748,
4704,
278,
198,
198,
6738,
2956,
297,
571,
13,
29572,
1330,
19016,
29572,
198,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198
] | 3.298246 | 57 |
import genetic_algorithm
#where the population will be processed and the main loop is contained
#initialise population with random candidate solutions
print("Enter a function to be solved: \n")
fitness_function = [1780, 17, -2] #n = ax + by
#function: [n, a, b]
ga = genetic_algorithm.genetic_algorithm(fitness_function)
#evaluate each candidate
#repeat until (termination condition is satifsfied ) DO
#select parents;
#recombine pairs of parents
#mutate the resulting offspring
#evaluate new candidates
#select individuals for the next generation
#OD
#END
| [
11748,
8513,
62,
282,
42289,
198,
198,
2,
3003,
262,
3265,
481,
307,
13686,
290,
262,
1388,
9052,
318,
7763,
628,
198,
2,
36733,
786,
3265,
351,
4738,
4540,
8136,
198,
198,
4798,
7203,
17469,
257,
2163,
284,
307,
16019,
25,
3467,
77,
4943,
198,
69,
3659,
62,
8818,
796,
685,
1558,
1795,
11,
1596,
11,
532,
17,
60,
1303,
77,
796,
7877,
1343,
416,
198,
2,
8818,
25,
685,
77,
11,
257,
11,
275,
60,
198,
198,
4908,
796,
8513,
62,
282,
42289,
13,
5235,
5139,
62,
282,
42289,
7,
69,
3659,
62,
8818,
8,
628,
198,
2,
49786,
1123,
4540,
198,
198,
2,
44754,
1566,
357,
41382,
4006,
318,
3332,
361,
28202,
798,
1267,
8410,
198,
198,
2,
19738,
3397,
26,
198,
2,
260,
24011,
500,
14729,
286,
3397,
198,
2,
21973,
378,
262,
7186,
20791,
198,
2,
49786,
649,
5871,
198,
2,
19738,
3925,
329,
262,
1306,
5270,
198,
2,
3727,
198,
2,
10619,
198
] | 3.582278 | 158 |
from flask import Flask, render_template
app = Flask(__name__)
if __name__ == '__main__':
print(app.url_map)
app.run(debug=True, host="0.0.0.0")
| [
6738,
42903,
1330,
46947,
11,
8543,
62,
28243,
198,
198,
1324,
796,
46947,
7,
834,
3672,
834,
8,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
3601,
7,
1324,
13,
6371,
62,
8899,
8,
198,
220,
220,
220,
598,
13,
5143,
7,
24442,
28,
17821,
11,
2583,
2625,
15,
13,
15,
13,
15,
13,
15,
4943,
198
] | 2.378788 | 66 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-09-26 01:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
2980,
515,
416,
37770,
352,
13,
1157,
13,
1314,
319,
2864,
12,
2931,
12,
2075,
5534,
25,
1495,
198,
6738,
11593,
37443,
834,
1330,
28000,
1098,
62,
17201,
874,
198,
198,
6738,
42625,
14208,
13,
9945,
1330,
15720,
602,
11,
4981,
198,
11748,
42625,
14208,
13,
9945,
13,
27530,
13,
2934,
1616,
295,
628
] | 2.753623 | 69 |
# Generated by Django 2.2.13 on 2021-03-10 21:33
import account.models
import datetime
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
| [
198,
2,
2980,
515,
416,
37770,
362,
13,
17,
13,
1485,
319,
33448,
12,
3070,
12,
940,
2310,
25,
2091,
628,
198,
11748,
1848,
13,
27530,
198,
11748,
4818,
8079,
198,
6738,
42625,
14208,
13,
10414,
1330,
6460,
198,
11748,
42625,
14208,
13,
3642,
822,
13,
18439,
13,
27530,
198,
11748,
42625,
14208,
13,
3642,
822,
13,
18439,
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
] | 3.180851 | 94 |
import tensorflow
from PIL import Image
from keras.models import Sequential
from keras.layers import Conv2D, Conv2DTranspose, ConvLSTM2D
from keras.optimizers import SGD
import numpy as np
import os
from keras import backend as K
from src.predictionAlgorithms.machineLearning.algorithms.ConvLSTM import ConvLstm
from src.predictionAlgorithms.machineLearning.algorithms.ConvolutionalChannelsMovementAlgorithm import \
ConvolutionalChannelsMovementAlgorithm
from src.predictionAlgorithms.machineLearning.helpers.callbacks import Callbacks
from src.utilities.imageAnalysis.pixelsRainStrengthConverter import PixelsRainStrengthConverter
# K: 12x12 -> lr: 0.01 -> E = 50; SpE = 10 | [
11748,
11192,
273,
11125,
198,
6738,
350,
4146,
1330,
7412,
198,
6738,
41927,
292,
13,
27530,
1330,
24604,
1843,
198,
6738,
41927,
292,
13,
75,
6962,
1330,
34872,
17,
35,
11,
34872,
17,
35,
8291,
3455,
11,
34872,
43,
2257,
44,
17,
35,
198,
6738,
41927,
292,
13,
40085,
11341,
1330,
26147,
35,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
28686,
198,
6738,
41927,
292,
1330,
30203,
355,
509,
198,
198,
6738,
12351,
13,
28764,
2867,
2348,
7727,
907,
13,
30243,
41730,
13,
282,
7727,
907,
13,
3103,
85,
43,
2257,
44,
1330,
34872,
43,
301,
76,
198,
6738,
12351,
13,
28764,
2867,
2348,
7727,
907,
13,
30243,
41730,
13,
282,
7727,
907,
13,
3103,
85,
2122,
282,
1925,
8961,
21774,
434,
2348,
42289,
1330,
3467,
198,
220,
220,
220,
34872,
2122,
282,
1925,
8961,
21774,
434,
2348,
42289,
198,
6738,
12351,
13,
28764,
2867,
2348,
7727,
907,
13,
30243,
41730,
13,
16794,
364,
13,
13345,
10146,
1330,
4889,
10146,
198,
6738,
12351,
13,
315,
2410,
13,
9060,
32750,
13,
79,
14810,
31443,
45027,
3103,
332,
353,
1330,
350,
14810,
31443,
45027,
3103,
332,
353,
628,
198,
2,
509,
25,
1105,
87,
1065,
4613,
300,
81,
25,
657,
13,
486,
4613,
412,
796,
2026,
26,
1338,
36,
796,
838
] | 3.247619 | 210 |
import bchlib
from PIL import Image, ImageOps
import numpy as np
import glob
from tqdm import tqdm
import torch
import matplotlib.pyplot as plt
from model import StegaStampDecoder
BCH_POLYNOMIAL = 137
BCH_BITS = 5
if __name__ == "__main__":
dirPath = r"E:/dataset/stegastamp_crop"
modelPath = r'saved_models/decoder.pth'
file_list = glob.glob(dirPath + '/*.png')
model = StegaStampDecoder().cuda()
model.load_state_dict(torch.load(modelPath))
model.eval()
bitstring = get_bits()
store = []
with torch.no_grad():
for file in tqdm(file_list):
image = Image.open(file).convert("RGB")
image = image.crop((50, 50, 350, 350))
image = np.array(ImageOps.fit(image, (400, 400)), dtype=np.float32)
image /= 255.
result = decode(image, model)
store.append(get_acc(bitstring, result))
plt.hist(store)
plt.show()
print(np.mean(store))
| [
11748,
275,
354,
8019,
198,
6738,
350,
4146,
1330,
7412,
11,
7412,
41472,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
15095,
198,
6738,
256,
80,
36020,
1330,
256,
80,
36020,
198,
11748,
28034,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
2746,
1330,
520,
26470,
1273,
696,
10707,
12342,
198,
198,
2749,
39,
62,
45472,
40760,
2662,
12576,
796,
21643,
198,
2749,
39,
62,
26094,
50,
796,
642,
628,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
628,
220,
220,
220,
26672,
15235,
796,
374,
1,
36,
14079,
19608,
292,
316,
14,
301,
1533,
459,
696,
62,
31476,
1,
198,
220,
220,
220,
2746,
15235,
796,
374,
338,
9586,
62,
27530,
14,
12501,
12342,
13,
79,
400,
6,
198,
220,
220,
220,
2393,
62,
4868,
796,
15095,
13,
4743,
672,
7,
15908,
15235,
1343,
705,
15211,
13,
11134,
11537,
628,
220,
220,
220,
2746,
796,
520,
26470,
1273,
696,
10707,
12342,
22446,
66,
15339,
3419,
198,
220,
220,
220,
2746,
13,
2220,
62,
5219,
62,
11600,
7,
13165,
354,
13,
2220,
7,
19849,
15235,
4008,
628,
220,
220,
220,
2746,
13,
18206,
3419,
198,
220,
220,
220,
1643,
8841,
796,
651,
62,
9895,
3419,
628,
220,
220,
220,
3650,
796,
17635,
198,
220,
220,
220,
351,
28034,
13,
3919,
62,
9744,
33529,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2393,
287,
256,
80,
36020,
7,
7753,
62,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2939,
796,
7412,
13,
9654,
7,
7753,
737,
1102,
1851,
7203,
36982,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2939,
796,
2939,
13,
31476,
19510,
1120,
11,
2026,
11,
13803,
11,
13803,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2939,
796,
45941,
13,
18747,
7,
5159,
41472,
13,
11147,
7,
9060,
11,
357,
7029,
11,
7337,
36911,
288,
4906,
28,
37659,
13,
22468,
2624,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2939,
1220,
28,
14280,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
36899,
7,
9060,
11,
2746,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3650,
13,
33295,
7,
1136,
62,
4134,
7,
2545,
8841,
11,
1255,
4008,
628,
220,
220,
220,
458,
83,
13,
10034,
7,
8095,
8,
198,
220,
220,
220,
458,
83,
13,
12860,
3419,
198,
220,
220,
220,
3601,
7,
37659,
13,
32604,
7,
8095,
4008,
198
] | 2.260563 | 426 |
import pytest
from django.test import TestCase
from django.test import override_settings
import ozpcenter.api.contact_type.model_access as model_access
from ozpcenter.models import ContactType
from tests.cases.factories import ContactTypeFactory
| [
11748,
12972,
9288,
198,
6738,
42625,
14208,
13,
9288,
1330,
6208,
20448,
198,
6738,
42625,
14208,
13,
9288,
1330,
20957,
62,
33692,
198,
198,
11748,
15649,
79,
16159,
13,
15042,
13,
32057,
62,
4906,
13,
19849,
62,
15526,
355,
2746,
62,
15526,
198,
6738,
15649,
79,
16159,
13,
27530,
1330,
14039,
6030,
198,
6738,
5254,
13,
33964,
13,
22584,
1749,
1330,
14039,
6030,
22810,
628
] | 3.815385 | 65 |
#!/usr/bin/python3
"""Simple bot to reply exactly the same what user sent to chat."""
# This program is dedicated to the public domain under the CC0 license.
from telegrask import Telegrask
bot = Telegrask("BOT_TOKEN")
if __name__ == "__main__":
bot.run(debug=True)
| [
2,
48443,
14629,
14,
8800,
14,
29412,
18,
198,
37811,
26437,
10214,
284,
10971,
3446,
262,
976,
644,
2836,
1908,
284,
8537,
526,
15931,
198,
2,
770,
1430,
318,
7256,
284,
262,
1171,
7386,
739,
262,
12624,
15,
5964,
13,
198,
198,
6738,
573,
1455,
81,
2093,
1330,
1665,
1455,
81,
2093,
198,
198,
13645,
796,
1665,
1455,
81,
2093,
7203,
33,
2394,
62,
10468,
43959,
4943,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
10214,
13,
5143,
7,
24442,
28,
17821,
8,
198
] | 2.956989 | 93 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from emailqueue.models import BaseModel
| [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
6738,
42625,
14208,
13,
26791,
13,
41519,
1330,
334,
1136,
5239,
62,
75,
12582,
355,
4808,
198,
198,
6738,
3053,
36560,
13,
27530,
1330,
7308,
17633,
628,
198
] | 3.555556 | 36 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module is used to crawler emoji unicode from http://www.unicode.org/ """
import urllib
import json
import base64
import os
from bs4 import BeautifulSoup
__EMOJI_V4_URL = "http://www.unicode.org/emoji/charts/emoji-list.html"
__EMOJI_V5_URL = "http://www.unicode.org/emoji/charts-beta/emoji-list.html"
__IMG_FOLDER_NAME = "emoji_imgs"
emoji_file = file("emoji_inverse.json", "r")
emojis = json.loads(emoji_file.read().decode("utf-8-sig"))
print "emoji_inverse.json loaded"
def decode_base64(data):
"""Decode base64, padding being optional.
:param data: Base64 data as an ASCII byte string
:returns: The decoded byte string.
"""
missing_padding = 4 - len(data) % 4
if missing_padding:
data += b'=' * missing_padding
return base64.decodestring(data)
crawler_emojis('V4')
crawler_emojis('V5')
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
37811,
1212,
8265,
318,
973,
284,
27784,
1754,
44805,
28000,
1098,
422,
2638,
1378,
2503,
13,
46903,
1098,
13,
2398,
14,
37227,
198,
11748,
2956,
297,
571,
198,
11748,
33918,
198,
11748,
2779,
2414,
198,
11748,
28686,
198,
6738,
275,
82,
19,
1330,
23762,
50,
10486,
198,
198,
834,
3620,
46,
41,
40,
62,
53,
19,
62,
21886,
796,
366,
4023,
1378,
2503,
13,
46903,
1098,
13,
2398,
14,
368,
31370,
14,
354,
5889,
14,
368,
31370,
12,
4868,
13,
6494,
1,
198,
834,
3620,
46,
41,
40,
62,
53,
20,
62,
21886,
796,
366,
4023,
1378,
2503,
13,
46903,
1098,
13,
2398,
14,
368,
31370,
14,
354,
5889,
12,
31361,
14,
368,
31370,
12,
4868,
13,
6494,
1,
198,
834,
3955,
38,
62,
37,
3535,
14418,
62,
20608,
796,
366,
368,
31370,
62,
9600,
82,
1,
198,
198,
368,
31370,
62,
7753,
220,
796,
2393,
7203,
368,
31370,
62,
259,
4399,
13,
17752,
1600,
366,
81,
4943,
198,
368,
13210,
271,
796,
33918,
13,
46030,
7,
368,
31370,
62,
7753,
13,
961,
22446,
12501,
1098,
7203,
40477,
12,
23,
12,
82,
328,
48774,
198,
4798,
366,
368,
31370,
62,
259,
4399,
13,
17752,
9639,
1,
198,
198,
4299,
36899,
62,
8692,
2414,
7,
7890,
2599,
198,
220,
220,
220,
37227,
10707,
1098,
2779,
2414,
11,
24511,
852,
11902,
13,
198,
220,
220,
220,
1058,
17143,
1366,
25,
7308,
2414,
1366,
355,
281,
37101,
18022,
4731,
198,
220,
220,
220,
1058,
7783,
82,
25,
383,
875,
9043,
18022,
4731,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4814,
62,
39231,
796,
604,
532,
18896,
7,
7890,
8,
4064,
604,
198,
220,
220,
220,
611,
4814,
62,
39231,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
15853,
275,
6,
11639,
1635,
4814,
62,
39231,
198,
220,
220,
220,
1441,
2779,
2414,
13,
12501,
375,
395,
1806,
7,
7890,
8,
628,
198,
198,
66,
39464,
62,
368,
13210,
271,
10786,
53,
19,
11537,
198,
66,
39464,
62,
368,
13210,
271,
10786,
53,
20,
11537,
198
] | 2.458333 | 360 |
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!
import unittest
from traits.api import Constant, HasTraits, TraitError
| [
2,
357,
34,
8,
15069,
5075,
12,
1238,
2481,
2039,
28895,
11,
3457,
1539,
9533,
11,
15326,
198,
2,
1439,
2489,
10395,
13,
198,
2,
198,
2,
770,
3788,
318,
2810,
1231,
18215,
739,
262,
2846,
286,
262,
347,
10305,
198,
2,
5964,
3017,
287,
38559,
24290,
13,
14116,
290,
743,
307,
38913,
691,
739,
198,
2,
262,
3403,
3417,
287,
262,
20794,
5964,
13,
383,
5964,
198,
2,
318,
635,
1695,
2691,
379,
2638,
1378,
2503,
13,
7944,
2917,
13,
785,
14,
677,
4541,
14,
21800,
13,
14116,
198,
2,
198,
2,
6930,
329,
1262,
2039,
28895,
1280,
2723,
0,
628,
198,
11748,
555,
715,
395,
198,
198,
6738,
12796,
13,
15042,
1330,
20217,
11,
7875,
15721,
896,
11,
4759,
270,
12331,
628
] | 3.887097 | 124 |
import mmap
import numpy as np
from time import sleep
import os
| [
11748,
8085,
499,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
640,
1330,
3993,
198,
198,
11748,
28686,
628
] | 3.35 | 20 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
from torch.optim import * | [
2,
15069,
357,
66,
8,
5413,
10501,
13,
1439,
2489,
10395,
13,
198,
2,
49962,
739,
262,
17168,
5964,
13,
198,
6738,
28034,
13,
40085,
1330,
1635
] | 4.407407 | 27 |
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from datetime import date
from typing import Union,Tuple,Optional,List
from ..config_features import CATEGORICAL_FEATURES,NUMERICAL_FEATURES
from ..config import DAYS_FORECAST,ALL_STATIONS
from ..utils.normalizer import get_normalizer_stats
def train_test_split(amur_df: pd.DataFrame,
start_test_date: Union[date,str],
end_test_date: Union[date,str],
fname: Optional[str]=None,
numerical_features: Optional[List[str]]=None,
categorical_features: Optional[List[str]]=None) -> Tuple[np.array,np.array,np.array,np.array]:
'''
, .
- 1 , - 10
[n,DAYS_FORECAST,n_features] - n - ,
DAYS_FORECAST - (10),
n_features -
:param amur_df: pd.DataFrame
:param start_test_date: date,str -
:param end_test_date: date,str -
:param fname: str, json c mean,std
:param numerical_features: List[str] -
:param categorical_features: List[str] -
:return: tuple:
X_train -
y_train -
X_test -
y_test -
'''
if numerical_features is None:
numerical_features = NUMERICAL_FEATURES
if categorical_features is None:
categorical_features = CATEGORICAL_FEATURES
targets = ['sealevel_max_' + identifier for identifier in ALL_STATIONS]
train = amur_df[amur_df['date'] < start_test_date].copy()
test = amur_df[(amur_df['date'] >= start_test_date) &
(amur_df['date'] < end_test_date)].copy()
stats = get_normalizer_stats(fname)
for col in numerical_features:
_mean = stats[col]['mean']
_std = stats[col]['std']
train[col] = (train[col] - _mean) / _std
test[col] = (test[col] - _mean) / _std
train.sort_values('date', inplace=True)
train_x_array = []
train_y_array = []
step = 0
while True:
if step + DAYS_FORECAST + 1 >= len(train):
break
if train.iloc[step:step + DAYS_FORECAST][targets].count().min() < DAYS_FORECAST:
step += 1
continue
train_x_array.append(train.iloc[step:step + DAYS_FORECAST][numerical_features + categorical_features].values)
train_y_array.append(train.iloc[step:step + DAYS_FORECAST][targets].values)
step += 1
X_train = np.transpose(np.dstack(train_x_array), (2, 0, 1))
y_train = np.transpose(np.dstack(train_y_array), (2, 0, 1))
step = 0
test.sort_values('date', inplace=True)
test_x_array = []
test_y_array = []
while True:
if step >= len(test):
break
if test.iloc[step:step + DAYS_FORECAST][targets].count().min() < DAYS_FORECAST:
step += DAYS_FORECAST
continue
test_x_array.append(test.iloc[step:step + DAYS_FORECAST][numerical_features + categorical_features].values)
test_y_array.append(test.iloc[step:step + DAYS_FORECAST][targets].values)
if step + DAYS_FORECAST*2+1 >= len(test):
break
step += DAYS_FORECAST
X_test = np.transpose(np.dstack(test_x_array), (2, 0, 1))
y_test = np.transpose(np.dstack(test_y_array), (2, 0, 1))
return X_train, y_train, X_test, y_test | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
4818,
8079,
1330,
3128,
198,
6738,
19720,
1330,
4479,
11,
51,
29291,
11,
30719,
11,
8053,
198,
198,
6738,
11485,
11250,
62,
40890,
1330,
327,
6158,
38,
1581,
20151,
62,
15112,
47471,
11,
41359,
1137,
20151,
62,
15112,
47471,
198,
6738,
11485,
11250,
1330,
24644,
50,
62,
13775,
2943,
11262,
11,
7036,
62,
2257,
18421,
198,
6738,
11485,
26791,
13,
11265,
7509,
1330,
651,
62,
11265,
7509,
62,
34242,
198,
198,
4299,
4512,
62,
9288,
62,
35312,
7,
321,
333,
62,
7568,
25,
279,
67,
13,
6601,
19778,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
923,
62,
9288,
62,
4475,
25,
4479,
58,
4475,
11,
2536,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
62,
9288,
62,
4475,
25,
4479,
58,
4475,
11,
2536,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
3672,
25,
32233,
58,
2536,
22241,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29052,
62,
40890,
25,
32233,
58,
8053,
58,
2536,
11907,
28,
14202,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4253,
12409,
62,
40890,
25,
32233,
58,
8053,
58,
2536,
11907,
28,
14202,
8,
4613,
309,
29291,
58,
37659,
13,
18747,
11,
37659,
13,
18747,
11,
37659,
13,
18747,
11,
37659,
13,
18747,
5974,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
837,
220,
220,
764,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
352,
837,
220,
220,
220,
220,
220,
220,
532,
838,
220,
628,
220,
220,
220,
220,
220,
685,
77,
11,
26442,
50,
62,
13775,
2943,
11262,
11,
77,
62,
40890,
60,
532,
299,
532,
220,
837,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24644,
50,
62,
13775,
2943,
11262,
532,
220,
220,
220,
357,
940,
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,
220,
220,
220,
299,
62,
40890,
532,
220,
220,
628,
220,
220,
220,
1058,
17143,
716,
333,
62,
7568,
25,
279,
67,
13,
6601,
19778,
198,
220,
220,
220,
1058,
17143,
923,
62,
9288,
62,
4475,
25,
3128,
11,
2536,
532,
220,
220,
220,
220,
220,
198,
220,
220,
220,
1058,
17143,
886,
62,
9288,
62,
4475,
25,
3128,
11,
2536,
532,
220,
220,
220,
220,
220,
198,
220,
220,
220,
1058,
17143,
277,
3672,
25,
965,
11,
220,
220,
220,
33918,
269,
220,
1612,
11,
19282,
220,
220,
220,
198,
220,
220,
220,
1058,
17143,
29052,
62,
40890,
25,
7343,
58,
2536,
60,
532,
220,
220,
220,
198,
220,
220,
220,
1058,
17143,
4253,
12409,
62,
40890,
25,
7343,
58,
2536,
60,
532,
220,
220,
220,
198,
220,
220,
220,
1058,
7783,
25,
46545,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
27432,
532,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
62,
27432,
532,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
9288,
532,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
62,
9288,
532,
220,
220,
220,
220,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
611,
29052,
62,
40890,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
29052,
62,
40890,
796,
36871,
1137,
20151,
62,
15112,
47471,
628,
220,
220,
220,
611,
4253,
12409,
62,
40890,
318,
6045,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4253,
12409,
62,
40890,
796,
327,
6158,
38,
1581,
20151,
62,
15112,
47471,
628,
220,
220,
220,
6670,
796,
37250,
325,
1000,
626,
62,
9806,
62,
6,
1343,
27421,
329,
27421,
287,
11096,
62,
2257,
18421,
60,
628,
220,
220,
220,
4512,
796,
716,
333,
62,
7568,
58,
321,
333,
62,
7568,
17816,
4475,
20520,
1279,
923,
62,
9288,
62,
4475,
4083,
30073,
3419,
198,
220,
220,
220,
1332,
796,
716,
333,
62,
7568,
58,
7,
321,
333,
62,
7568,
17816,
4475,
20520,
18189,
923,
62,
9288,
62,
4475,
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,
357,
321,
333,
62,
7568,
17816,
4475,
20520,
1279,
886,
62,
9288,
62,
4475,
25295,
30073,
3419,
628,
220,
220,
220,
9756,
796,
651,
62,
11265,
7509,
62,
34242,
7,
69,
3672,
8,
198,
220,
220,
220,
329,
951,
287,
29052,
62,
40890,
25,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
32604,
796,
9756,
58,
4033,
7131,
6,
32604,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
19282,
796,
9756,
58,
4033,
7131,
6,
19282,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
58,
4033,
60,
796,
357,
27432,
58,
4033,
60,
532,
4808,
32604,
8,
1220,
4808,
19282,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
58,
4033,
60,
796,
357,
9288,
58,
4033,
60,
532,
4808,
32604,
8,
1220,
4808,
19282,
628,
220,
220,
220,
4512,
13,
30619,
62,
27160,
10786,
4475,
3256,
287,
5372,
28,
17821,
8,
628,
220,
220,
220,
4512,
62,
87,
62,
18747,
796,
17635,
198,
220,
220,
220,
4512,
62,
88,
62,
18747,
796,
17635,
198,
220,
220,
220,
2239,
796,
657,
198,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2239,
1343,
24644,
50,
62,
13775,
2943,
11262,
1343,
352,
18189,
18896,
7,
27432,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4512,
13,
346,
420,
58,
9662,
25,
9662,
1343,
24644,
50,
62,
13775,
2943,
11262,
7131,
83,
853,
1039,
4083,
9127,
22446,
1084,
3419,
1279,
24644,
50,
62,
13775,
2943,
11262,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2239,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
87,
62,
18747,
13,
33295,
7,
27432,
13,
346,
420,
58,
9662,
25,
9662,
1343,
24644,
50,
62,
13775,
2943,
11262,
7131,
77,
6975,
605,
62,
40890,
1343,
4253,
12409,
62,
40890,
4083,
27160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4512,
62,
88,
62,
18747,
13,
33295,
7,
27432,
13,
346,
420,
58,
9662,
25,
9662,
1343,
24644,
50,
62,
13775,
2943,
11262,
7131,
83,
853,
1039,
4083,
27160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2239,
15853,
352,
198,
220,
220,
220,
1395,
62,
27432,
796,
45941,
13,
7645,
3455,
7,
37659,
13,
67,
25558,
7,
27432,
62,
87,
62,
18747,
828,
357,
17,
11,
657,
11,
352,
4008,
198,
220,
220,
220,
331,
62,
27432,
796,
45941,
13,
7645,
3455,
7,
37659,
13,
67,
25558,
7,
27432,
62,
88,
62,
18747,
828,
357,
17,
11,
657,
11,
352,
4008,
628,
220,
220,
220,
2239,
796,
657,
198,
220,
220,
220,
1332,
13,
30619,
62,
27160,
10786,
4475,
3256,
287,
5372,
28,
17821,
8,
198,
220,
220,
220,
1332,
62,
87,
62,
18747,
796,
17635,
198,
220,
220,
220,
1332,
62,
88,
62,
18747,
796,
17635,
198,
220,
220,
220,
981,
6407,
25,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2239,
18189,
18896,
7,
9288,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1332,
13,
346,
420,
58,
9662,
25,
9662,
1343,
24644,
50,
62,
13775,
2943,
11262,
7131,
83,
853,
1039,
4083,
9127,
22446,
1084,
3419,
1279,
24644,
50,
62,
13775,
2943,
11262,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2239,
15853,
24644,
50,
62,
13775,
2943,
11262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
87,
62,
18747,
13,
33295,
7,
9288,
13,
346,
420,
58,
9662,
25,
9662,
1343,
24644,
50,
62,
13775,
2943,
11262,
7131,
77,
6975,
605,
62,
40890,
1343,
4253,
12409,
62,
40890,
4083,
27160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1332,
62,
88,
62,
18747,
13,
33295,
7,
9288,
13,
346,
420,
58,
9662,
25,
9662,
1343,
24644,
50,
62,
13775,
2943,
11262,
7131,
83,
853,
1039,
4083,
27160,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2239,
1343,
24644,
50,
62,
13775,
2943,
11262,
9,
17,
10,
16,
18189,
18896,
7,
9288,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
2239,
15853,
24644,
50,
62,
13775,
2943,
11262,
198,
220,
220,
220,
1395,
62,
9288,
796,
45941,
13,
7645,
3455,
7,
37659,
13,
67,
25558,
7,
9288,
62,
87,
62,
18747,
828,
357,
17,
11,
657,
11,
352,
4008,
198,
220,
220,
220,
331,
62,
9288,
796,
45941,
13,
7645,
3455,
7,
37659,
13,
67,
25558,
7,
9288,
62,
88,
62,
18747,
828,
357,
17,
11,
657,
11,
352,
4008,
628,
220,
220,
220,
1441,
1395,
62,
27432,
11,
331,
62,
27432,
11,
1395,
62,
9288,
11,
331,
62,
9288
] | 2.032448 | 1,695 |
from .Preprocessor import Pipeline
| [
6738,
764,
6719,
41341,
1330,
37709,
198
] | 5 | 7 |
import os
import sys
import copy
import ctypes
import socket
import logging
import threading
import functools
import webbrowser
logger = logging.getLogger(__name__)
import keyboard
from PySide2 import QtCore, QtWidgets, QtGui, QtWebEngineWidgets
# TODO
# Be able to import a text file in the description/title as variables (to have counters and currentsong for example)
# Rajouter dans le menu contextuel les variables %CATEGORY% et autres fichiers monitors
# Pouvoir ajouter un commandbot avec des commandes customs (!game !currentsong)
# Add About and Help menu entries
# Automatically switch scenes in OBS depending of the game played
# Add an XML/EDL file and add each marker created for import into premiere/resolve/FCP
# Change color tray icon to green if update channel with new process or red + toast message if error
# Add trayicons for dropped frames and stream/record states
# Do a notification if the user has not used a streaming process for X minutes if any service is online (to prevent streaming unnoticed)
# Faire un streamdeck customisable qui change automatiquement les touches selon le programme utilis https://interactjs.io/
# Being able to put it in portrait without changing icons layout
# Add Multi Actions with pause timers
# Create an independant server that scan the foreground process and send it to the receiver, this way multi computer streaming is possible
# websocket plugin ( https://github.com/Elektordi/obs-websocket-py ) Show Scene selector, MIC and DEFAULT volume, RECORD and STREAMING status and STATS
import common.manager
import common.remote
import common.tools
import common.systray
def block_signals(iterable, block):
for i in iterable:
i.blockSignals(block)
def updateStyle(obj, name, value):
obj.setProperty(name, value)
obj.setStyle(obj.style())
| [
11748,
28686,
198,
11748,
25064,
198,
11748,
4866,
198,
11748,
269,
19199,
198,
11748,
17802,
198,
11748,
18931,
198,
11748,
4704,
278,
198,
11748,
1257,
310,
10141,
198,
11748,
3992,
40259,
198,
6404,
1362,
796,
18931,
13,
1136,
11187,
1362,
7,
834,
3672,
834,
8,
198,
11748,
10586,
198,
6738,
9485,
24819,
17,
1330,
33734,
14055,
11,
33734,
54,
312,
11407,
11,
33734,
8205,
72,
11,
33734,
13908,
13798,
54,
312,
11407,
198,
198,
2,
16926,
46,
198,
2,
1355,
1498,
284,
1330,
257,
2420,
2393,
287,
262,
6764,
14,
7839,
355,
9633,
357,
1462,
423,
21154,
290,
28629,
506,
329,
1672,
8,
198,
2,
13308,
39605,
288,
504,
443,
6859,
4732,
2731,
10287,
9633,
4064,
34,
6158,
38,
15513,
4,
2123,
1960,
411,
277,
488,
3183,
19374,
198,
2,
350,
280,
85,
10840,
257,
73,
39605,
555,
3141,
13645,
257,
35138,
748,
3141,
274,
17112,
22759,
6057,
5145,
14421,
34050,
8,
198,
2,
3060,
7994,
290,
10478,
6859,
12784,
198,
2,
17406,
4142,
5078,
8188,
287,
440,
4462,
6906,
286,
262,
983,
2826,
198,
2,
3060,
281,
23735,
14,
1961,
43,
2393,
290,
751,
1123,
18364,
2727,
329,
1330,
656,
19245,
14,
411,
6442,
14,
4851,
47,
198,
198,
2,
9794,
3124,
26473,
7196,
284,
4077,
611,
4296,
6518,
351,
649,
1429,
393,
2266,
1343,
27805,
3275,
611,
4049,
198,
2,
3060,
26473,
34280,
329,
5710,
13431,
290,
4269,
14,
22105,
2585,
198,
2,
2141,
257,
14483,
611,
262,
2836,
468,
407,
973,
257,
11305,
1429,
329,
1395,
2431,
611,
597,
2139,
318,
2691,
357,
1462,
2948,
11305,
33755,
8,
198,
2,
376,
7626,
555,
4269,
35875,
2183,
43942,
45567,
1487,
3557,
265,
1557,
972,
10287,
18105,
384,
14995,
443,
11383,
7736,
271,
3740,
1378,
3849,
529,
8457,
13,
952,
14,
198,
2,
11204,
1498,
284,
1234,
340,
287,
18560,
1231,
5609,
17149,
12461,
198,
2,
3060,
15237,
24439,
351,
14985,
48085,
198,
2,
13610,
281,
3485,
415,
4382,
326,
9367,
262,
36282,
1429,
290,
3758,
340,
284,
262,
9733,
11,
428,
835,
5021,
3644,
11305,
318,
1744,
198,
2,
2639,
5459,
13877,
357,
3740,
1378,
12567,
13,
785,
14,
28827,
21841,
585,
72,
14,
8158,
12,
732,
1443,
5459,
12,
9078,
1267,
5438,
28315,
31870,
11,
35878,
290,
5550,
38865,
6115,
11,
220,
19644,
12532,
290,
3563,
32235,
2751,
3722,
290,
37889,
628,
198,
198,
11748,
2219,
13,
37153,
198,
11748,
2219,
13,
47960,
198,
11748,
2219,
13,
31391,
198,
11748,
2219,
13,
1837,
301,
2433,
628,
628,
198,
198,
4299,
2512,
62,
12683,
874,
7,
2676,
540,
11,
2512,
2599,
198,
220,
220,
220,
329,
1312,
287,
11629,
540,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
13,
9967,
11712,
874,
7,
9967,
8,
628,
628,
628,
628,
628,
628,
628,
628,
628,
198,
198,
4299,
4296,
21466,
7,
26801,
11,
1438,
11,
1988,
2599,
198,
220,
220,
220,
26181,
13,
2617,
21746,
7,
3672,
11,
1988,
8,
198,
220,
220,
220,
26181,
13,
2617,
21466,
7,
26801,
13,
7635,
28955,
198
] | 3.706237 | 497 |
"""
Contains unit tests to ensure single database items are created correctly in a
Pascal VOC compatible format.
"""
import os
from xml.etree.ElementTree import Element, SubElement
import numpy as np
from breakdb.io.export.voc import create_annotation
from tests.helpers.dataset import create_random_string
from tests.helpers.xml import match
| [
37811,
198,
4264,
1299,
4326,
5254,
284,
4155,
2060,
6831,
3709,
389,
2727,
9380,
287,
257,
198,
47,
27747,
569,
4503,
11670,
5794,
13,
198,
37811,
198,
11748,
28686,
198,
6738,
35555,
13,
316,
631,
13,
20180,
27660,
1330,
11703,
11,
3834,
20180,
198,
198,
11748,
299,
32152,
355,
45941,
198,
198,
6738,
2270,
9945,
13,
952,
13,
39344,
13,
18893,
1330,
2251,
62,
1236,
14221,
198,
6738,
5254,
13,
16794,
364,
13,
19608,
292,
316,
1330,
2251,
62,
25120,
62,
8841,
198,
6738,
5254,
13,
16794,
364,
13,
19875,
1330,
2872,
628
] | 3.72043 | 93 |
import os
import os.path as osp
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Polygon, Rectangle
from config import PARAMS
def plot_globe(self, angle=0):
'''
Plots the globe and its shade as viewed from 'angle'.
'''
angle = self.normalize_angle(angle)
self.globe = Circle(
xy=(0, 0),
radius=1,
color=self.params['globe']['water_colour'],
zorder=self.params['zorder']['water'],
lw=0,
)
self.ax.add_patch(self.globe)
for shape in self.shapes:
for turn in [-1, 0, 1]: # to cover for the boundary problems
points, unseen = zip(*[self.project(point, angle, turn) for point in shape])
if not all(unseen):
# the border of the land
self.ax.add_patch(Polygon(
xy=points,
color=self.params['globe']['border_colour'],
zorder=self.params['zorder']['land_border'],
lw=self.params['globe']['border'],
clip_path=self.globe,
joinstyle='round',
))
# the main land
self.ax.add_patch(Polygon(
xy=points,
color=self.params['globe']['land_colour'],
zorder=self.params['zorder']['land'],
lw=0,
clip_path=self.globe,
))
# plotting the shade
self.plot_shade(angle)
def plot_shade(self, angle=0):
'''
Plots the shaded version of the globe.
'''
angle = self.normalize_angle(angle + self.params['shade']['angle'])
# general transformation applied on the shade
transform = self.ax.transData.get_affine()
x_shift = transform.get_matrix()[0,2]
y_shift = transform.get_matrix()[1,2]
x_scale = transform.get_matrix()[0,0]
y_scale = transform.get_matrix()[1,1]
transform.set_matrix(np.diag(np.diag(transform.get_matrix()))) # only keep the diagonal
transform.scale(
self.params['shade']['ratio']*self.params['shade']['scale'],
self.params['shade']['scale']
)
transform.rotate_deg(self.params['shade']['rotation'])
transform.translate(
x_shift + x_scale*self.params['shade']['x_pos'],
y_shift - y_scale + y_scale*self.params['shade']['y_pos']
)
# plotting the shaded world sphere
self.ax.add_patch(Circle(
xy=(0, 0),
radius=1,
color=self.params['shade']['water_colour'],
zorder=self.params['zorder']['shade_water'],
alpha=self.params['shade']['alpha'],
transform=transform,
lw=0,
))
for shape in self.shapes:
for turn in [-1, 0, 1]: # to cover for the boundary problems
points, unseen = zip(*[self.project(point, angle, turn, flip=True, away=1) for point in shape])
if not all(unseen):
self.ax.add_patch(Polygon(
xy=points,
color=self.params['shade']['land_colour'],
zorder=self.params['zorder']['shade_land'],
alpha=self.params['shade']['alpha'],
transform=transform,
lw=0,
))
def savefig(self, name='map', folder='.', title=''):
'''
Saves the current state of the figure.
'''
assert hasattr(self, 'fig')
if not osp.exists(folder):
os.makedirs(folder)
# adds a title when available
if title:
bbox = {
'boxstyle' : 'round',
'edgecolor' : self.params['text']['colour'],
'facecolor' : self.params['text']['background'],
'linewidth' : self.params['text']['border'],
}
self.ax.text(
- 1 - self.params['figure']['extra_space'] + self.params['text']['x'],
- 1 - self.params['figure']['extra_space'] + self.params['text']['y'],
title,
fontsize=self.params['text']['fontsize'],
color=self.params['text']['colour'],
#fontweight='demibold',
bbox=bbox,
)
self.fig.savefig(osp.join(folder, name + '.png'), transparent=True)
def plot(self, name='map', folder='.', title='', angle=0):
'''
Plots the world globe.
'''
self.set_figure()
self.plot_globe(angle)
self.savefig(name, folder, title) | [
11748,
28686,
198,
11748,
28686,
13,
6978,
355,
267,
2777,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
2603,
29487,
8019,
13,
9078,
29487,
355,
458,
83,
198,
6738,
2603,
29487,
8019,
13,
8071,
2052,
1330,
16291,
11,
12280,
14520,
11,
48599,
9248,
198,
198,
6738,
4566,
1330,
29463,
40834,
628,
198,
220,
220,
220,
825,
7110,
62,
4743,
5910,
7,
944,
11,
9848,
28,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
1345,
1747,
262,
13342,
290,
663,
17979,
355,
9569,
422,
705,
9248,
4458,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
9848,
796,
2116,
13,
11265,
1096,
62,
9248,
7,
9248,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
4743,
5910,
796,
16291,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
88,
16193,
15,
11,
657,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16874,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
944,
13,
37266,
17816,
4743,
5910,
6,
7131,
6,
7050,
62,
49903,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
2875,
28,
944,
13,
37266,
17816,
89,
2875,
6,
7131,
6,
7050,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
86,
28,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
897,
13,
2860,
62,
17147,
7,
944,
13,
4743,
5910,
8,
628,
220,
220,
220,
220,
220,
220,
220,
329,
5485,
287,
2116,
13,
1477,
7916,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1210,
287,
25915,
16,
11,
657,
11,
352,
5974,
1303,
284,
3002,
329,
262,
18645,
2761,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2173,
11,
29587,
796,
19974,
46491,
58,
944,
13,
16302,
7,
4122,
11,
9848,
11,
1210,
8,
329,
966,
287,
5485,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
477,
7,
403,
15898,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
262,
4865,
286,
262,
1956,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
897,
13,
2860,
62,
17147,
7,
34220,
14520,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
88,
28,
13033,
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,
3124,
28,
944,
13,
37266,
17816,
4743,
5910,
6,
7131,
6,
20192,
62,
49903,
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,
1976,
2875,
28,
944,
13,
37266,
17816,
89,
2875,
6,
7131,
6,
1044,
62,
20192,
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,
300,
86,
28,
944,
13,
37266,
17816,
4743,
5910,
6,
7131,
6,
20192,
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,
10651,
62,
6978,
28,
944,
13,
4743,
5910,
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,
4654,
7635,
11639,
744,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15306,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
262,
1388,
1956,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
897,
13,
2860,
62,
17147,
7,
34220,
14520,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
88,
28,
13033,
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,
3124,
28,
944,
13,
37266,
17816,
4743,
5910,
6,
7131,
6,
1044,
62,
49903,
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,
1976,
2875,
28,
944,
13,
37266,
17816,
89,
2875,
6,
7131,
6,
1044,
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,
300,
86,
28,
15,
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,
10651,
62,
6978,
28,
944,
13,
4743,
5910,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15306,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
29353,
262,
17979,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29487,
62,
1477,
671,
7,
9248,
8,
628,
220,
220,
220,
825,
7110,
62,
1477,
671,
7,
944,
11,
9848,
28,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
1345,
1747,
262,
427,
5286,
2196,
286,
262,
13342,
13,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
9848,
796,
2116,
13,
11265,
1096,
62,
9248,
7,
9248,
1343,
2116,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
9248,
6,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2276,
13389,
5625,
319,
262,
17979,
198,
220,
220,
220,
220,
220,
220,
220,
6121,
796,
2116,
13,
897,
13,
7645,
6601,
13,
1136,
62,
2001,
500,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
30846,
796,
6121,
13,
1136,
62,
6759,
8609,
3419,
58,
15,
11,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
331,
62,
30846,
796,
6121,
13,
1136,
62,
6759,
8609,
3419,
58,
16,
11,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
9888,
796,
6121,
13,
1136,
62,
6759,
8609,
3419,
58,
15,
11,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
331,
62,
9888,
796,
6121,
13,
1136,
62,
6759,
8609,
3419,
58,
16,
11,
16,
60,
628,
220,
220,
220,
220,
220,
220,
220,
6121,
13,
2617,
62,
6759,
8609,
7,
37659,
13,
10989,
363,
7,
37659,
13,
10989,
363,
7,
35636,
13,
1136,
62,
6759,
8609,
3419,
22305,
1303,
691,
1394,
262,
40039,
198,
220,
220,
220,
220,
220,
220,
220,
6121,
13,
9888,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
10366,
952,
20520,
9,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
9888,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
9888,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
6121,
13,
10599,
378,
62,
13500,
7,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
10599,
341,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
6121,
13,
7645,
17660,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
30846,
1343,
2124,
62,
9888,
9,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
87,
62,
1930,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
62,
30846,
532,
331,
62,
9888,
1343,
331,
62,
9888,
9,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
88,
62,
1930,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
29353,
262,
427,
5286,
995,
16558,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
897,
13,
2860,
62,
17147,
7,
31560,
293,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
88,
16193,
15,
11,
657,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16874,
28,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
7050,
62,
49903,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
2875,
28,
944,
13,
37266,
17816,
89,
2875,
6,
7131,
6,
1477,
671,
62,
7050,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17130,
28,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
26591,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6121,
28,
35636,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
86,
28,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
15306,
198,
220,
220,
220,
220,
220,
220,
220,
329,
5485,
287,
2116,
13,
1477,
7916,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1210,
287,
25915,
16,
11,
657,
11,
352,
5974,
1303,
284,
3002,
329,
262,
18645,
2761,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2173,
11,
29587,
796,
19974,
46491,
58,
944,
13,
16302,
7,
4122,
11,
9848,
11,
1210,
11,
14283,
28,
17821,
11,
1497,
28,
16,
8,
329,
966,
287,
5485,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
407,
477,
7,
403,
15898,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
897,
13,
2860,
62,
17147,
7,
34220,
14520,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
88,
28,
13033,
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,
3124,
28,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
1044,
62,
49903,
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,
1976,
2875,
28,
944,
13,
37266,
17816,
89,
2875,
6,
7131,
6,
1477,
671,
62,
1044,
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,
17130,
28,
944,
13,
37266,
17816,
1477,
671,
6,
7131,
6,
26591,
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,
6121,
28,
35636,
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,
300,
86,
28,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15306,
628,
220,
220,
220,
825,
3613,
5647,
7,
944,
11,
1438,
11639,
8899,
3256,
9483,
11639,
2637,
11,
3670,
28,
7061,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
311,
3080,
262,
1459,
1181,
286,
262,
3785,
13,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
6818,
468,
35226,
7,
944,
11,
705,
5647,
11537,
628,
220,
220,
220,
220,
220,
220,
220,
611,
407,
267,
2777,
13,
1069,
1023,
7,
43551,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28686,
13,
76,
4335,
17062,
7,
43551,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6673,
257,
3670,
618,
1695,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3670,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
3524,
796,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
3524,
7635,
6,
1058,
705,
744,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
14907,
8043,
6,
1058,
2116,
13,
37266,
17816,
5239,
6,
7131,
6,
49903,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2550,
8043,
6,
1058,
2116,
13,
37266,
17816,
5239,
6,
7131,
6,
25249,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
2815,
413,
5649,
6,
1058,
2116,
13,
37266,
17816,
5239,
6,
7131,
6,
20192,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
897,
13,
5239,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
352,
532,
2116,
13,
37266,
17816,
26875,
6,
7131,
6,
26086,
62,
13200,
20520,
1343,
2116,
13,
37266,
17816,
5239,
6,
7131,
6,
87,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
352,
532,
2116,
13,
37266,
17816,
26875,
6,
7131,
6,
26086,
62,
13200,
20520,
1343,
2116,
13,
37266,
17816,
5239,
6,
7131,
6,
88,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3670,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10369,
7857,
28,
944,
13,
37266,
17816,
5239,
6,
7131,
6,
10331,
7857,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
28,
944,
13,
37266,
17816,
5239,
6,
7131,
6,
49903,
6,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10331,
6551,
11639,
9536,
571,
727,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
3524,
28,
65,
3524,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
5647,
13,
21928,
5647,
7,
2117,
13,
22179,
7,
43551,
11,
1438,
1343,
45302,
11134,
33809,
13245,
28,
17821,
8,
628,
220,
220,
220,
825,
7110,
7,
944,
11,
1438,
11639,
8899,
3256,
9483,
11639,
2637,
11,
3670,
11639,
3256,
9848,
28,
15,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
1345,
1747,
262,
995,
13342,
13,
198,
220,
220,
220,
220,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
2617,
62,
26875,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
29487,
62,
4743,
5910,
7,
9248,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2116,
13,
21928,
5647,
7,
3672,
11,
9483,
11,
3670,
8
] | 1.836866 | 2,642 |
from django.db import models
from .base import BaseModel
| [
6738,
42625,
14208,
13,
9945,
1330,
4981,
198,
198,
6738,
764,
8692,
1330,
7308,
17633,
628
] | 3.6875 | 16 |
import random
import numpy as np
import cPickle as pkl
Train_handle = open("./data/weixin_data/weixin_train.txt",'w')
Test_handle = open("./data/weixin_data/weixin_test.txt",'w')
Feature_handle = open("./data/weixin_data/weixin_feature.pkl",'w')
max_len = 50
if __name__ == "__main__":
train_sample_list, test_sample_list = generate_sample_list()
produce_neg_item_hist_with_cate(train_sample_list, test_sample_list)
| [
11748,
4738,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
269,
31686,
293,
355,
279,
41582,
628,
198,
44077,
62,
28144,
796,
1280,
7,
1911,
14,
7890,
14,
732,
844,
259,
62,
7890,
14,
732,
844,
259,
62,
27432,
13,
14116,
1600,
6,
86,
11537,
198,
14402,
62,
28144,
796,
1280,
7,
1911,
14,
7890,
14,
732,
844,
259,
62,
7890,
14,
732,
844,
259,
62,
9288,
13,
14116,
1600,
6,
86,
11537,
198,
38816,
62,
28144,
796,
1280,
7,
1911,
14,
7890,
14,
732,
844,
259,
62,
7890,
14,
732,
844,
259,
62,
30053,
13,
79,
41582,
1600,
6,
86,
11537,
198,
9806,
62,
11925,
796,
2026,
628,
628,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
628,
220,
220,
220,
4512,
62,
39873,
62,
4868,
11,
1332,
62,
39873,
62,
4868,
796,
7716,
62,
39873,
62,
4868,
3419,
198,
220,
220,
220,
4439,
62,
12480,
62,
9186,
62,
10034,
62,
4480,
62,
66,
378,
7,
27432,
62,
39873,
62,
4868,
11,
1332,
62,
39873,
62,
4868,
8,
628
] | 2.49711 | 173 |
import sys
import sqlite3
import csv
from random import randint
from faker import Faker
fake = Faker()
if __name__ == "__main__":
main()
| [
11748,
25064,
198,
11748,
44161,
578,
18,
198,
11748,
269,
21370,
198,
6738,
4738,
1330,
43720,
600,
198,
198,
6738,
277,
3110,
1330,
376,
3110,
198,
30706,
796,
376,
3110,
3419,
628,
628,
198,
198,
361,
11593,
3672,
834,
6624,
366,
834,
12417,
834,
1298,
198,
220,
220,
220,
1388,
3419,
198
] | 2.826923 | 52 |
from __future__ import annotations
from amulet.world_interface.chunk.interfaces.leveldb.leveldb_12.leveldb_12_interface import (
LevelDB12Interface,
)
INTERFACE_CLASS = LevelDB13Interface
| [
6738,
11593,
37443,
834,
1330,
37647,
198,
198,
6738,
38335,
13,
6894,
62,
39994,
13,
354,
2954,
13,
3849,
32186,
13,
293,
303,
335,
65,
13,
293,
303,
335,
65,
62,
1065,
13,
293,
303,
335,
65,
62,
1065,
62,
39994,
1330,
357,
198,
220,
220,
220,
5684,
11012,
1065,
39317,
11,
198,
8,
628,
198,
198,
41358,
49836,
62,
31631,
796,
5684,
11012,
1485,
39317,
198
] | 2.925373 | 67 |
from oarepo_model_builder.builders.json import JSONBuilder
from oarepo_model_builder.output import JsonSchemaOutput
| [
6738,
267,
533,
7501,
62,
19849,
62,
38272,
13,
50034,
13,
17752,
1330,
19449,
32875,
198,
6738,
267,
533,
7501,
62,
19849,
62,
38272,
13,
22915,
1330,
449,
1559,
27054,
2611,
26410,
628
] | 3.545455 | 33 |
import numpy as np
def square(x):
"""Square a number"""
return x ** 2
def volume_converter(volume, unit):
"""Convert certain SI volumes to mLs"""
conversions = {'mL': 1E-3, 'uL': 1E-6, 'nL': 1E-9, 'kL': 1E3}
return round(volume * conversions[unit], 10)
def squared_sum(in_list):
"""Finds the sum of squares of a list of numbers."""
return np.sum(np.array(in_list)**2)
| [
11748,
299,
32152,
355,
45941,
198,
198,
4299,
6616,
7,
87,
2599,
198,
220,
220,
220,
37227,
48011,
257,
1271,
37811,
198,
220,
220,
220,
1441,
2124,
12429,
362,
198,
198,
4299,
6115,
62,
1102,
332,
353,
7,
29048,
11,
4326,
2599,
198,
220,
220,
220,
37227,
3103,
1851,
1728,
25861,
15343,
284,
36226,
82,
37811,
198,
220,
220,
220,
32626,
796,
1391,
6,
32087,
10354,
352,
36,
12,
18,
11,
705,
84,
43,
10354,
352,
36,
12,
21,
11,
705,
77,
43,
10354,
352,
36,
12,
24,
11,
705,
74,
43,
10354,
352,
36,
18,
92,
198,
220,
220,
220,
1441,
2835,
7,
29048,
1635,
32626,
58,
20850,
4357,
838,
8,
198,
198,
4299,
44345,
62,
16345,
7,
259,
62,
4868,
2599,
198,
220,
220,
220,
37227,
16742,
82,
262,
2160,
286,
24438,
286,
257,
1351,
286,
3146,
526,
15931,
198,
220,
220,
220,
1441,
45941,
13,
16345,
7,
37659,
13,
18747,
7,
259,
62,
4868,
8,
1174,
17,
8,
198
] | 2.462963 | 162 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import psycopg2
import time
import statistics
from selenium.webdriver.support.select import Select
import json
# except (Exception, psycopg2.Error) as e:
# print(e)
#
#
# finally:
# # closing database connection.
# if (connection):
# cursor.close()
# connection.close()
if __name__ == '__main__':
exec_path = "" # INSERT HERE THE PATH TO THE DRIVER
driver = webdriver.Chrome(executable_path=exec_path)
data = []
timer = 0
try:
c = 0
log_in = login(driver)
if log_in:
while c < 40:
time.sleep(2)
print(str(c))
# connection = psycopg2.connect(dbname="groundtruthdb", user="ims", password="grace.period", host="localhost",
# port="5444")
#
# cursor = connection.cursor()
# cursor.execute('SELECT COUNT(*) FROM associate where username = %s;',['selenium_test'])
# ans = cursor.fetchone()[0]
# if(ans == 100):
# cursor.execute('DELETE FROM associate where username = %s;',['selenium_test'])
# connection.commit()
#
# cursor.execute('SELECT COUNT(*) FROM ground_truth_log_file where username = %s AND gt_type = %s;',['selenium_test','labels'])
# ans = cursor.fetchone()[0]
# if(ans == 100):
# cursor.execute('DELETE FROM ground_truth_log_file where username = %s and gt_type = %s;',['selenium_test','labels'])
# connection.commit()
if c > 0:
driver.refresh()
ele1 = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, '//button[text()="Labels"]'))
)
ele1.click()
timer_1 = exatag_lab_test(driver)
data.append(timer_1)
print(str(timer_1))
if(type(timer_1) == 'str'):
break
else:
timer = timer + timer_1
c = c+1
except (Exception, psycopg2.Error) as e:
print(e)
finally:
# closing database connection.
# if (connection):
# cursor.close()
# connection.close()
print(timer)
std = statistics.stdev(data)
print(str(std))
| [
6738,
384,
11925,
1505,
1330,
3992,
26230,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11321,
13,
1525,
1330,
2750,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
13,
9019,
1330,
5313,
32103,
21321,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
1330,
2938,
62,
17561,
1756,
355,
13182,
198,
11748,
17331,
22163,
70,
17,
198,
11748,
640,
198,
11748,
7869,
198,
6738,
384,
11925,
1505,
13,
12384,
26230,
13,
11284,
13,
19738,
1330,
9683,
198,
198,
11748,
33918,
628,
628,
628,
220,
220,
220,
1303,
2845,
357,
16922,
11,
17331,
22163,
70,
17,
13,
12331,
8,
355,
304,
25,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
3601,
7,
68,
8,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
3443,
25,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1303,
9605,
6831,
4637,
13,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
611,
357,
38659,
2599,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
23493,
13,
19836,
3419,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
4637,
13,
19836,
3419,
628,
198,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
220,
220,
220,
220,
2452,
62,
6978,
796,
13538,
1303,
29194,
17395,
15698,
3336,
46490,
5390,
3336,
10560,
38757,
198,
220,
220,
220,
220,
220,
220,
220,
4639,
796,
3992,
26230,
13,
1925,
5998,
7,
18558,
18187,
62,
6978,
28,
18558,
62,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
19781,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2604,
62,
259,
796,
17594,
7,
26230,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2604,
62,
259,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
269,
1279,
2319,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
640,
13,
42832,
7,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
2536,
7,
66,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4637,
796,
17331,
22163,
70,
17,
13,
8443,
7,
9945,
3672,
2625,
2833,
35310,
9945,
1600,
2836,
2625,
12078,
1600,
9206,
2625,
2164,
558,
13,
41007,
1600,
2583,
2625,
36750,
1600,
198,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2493,
2625,
20,
30272,
4943,
198,
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,
1303,
23493,
796,
4637,
13,
66,
21471,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
23493,
13,
41049,
10786,
46506,
327,
28270,
7,
28104,
16034,
11602,
810,
20579,
796,
4064,
82,
26,
3256,
17816,
741,
47477,
62,
9288,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
9093,
796,
23493,
13,
69,
7569,
505,
3419,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
7,
504,
6624,
1802,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
23493,
13,
41049,
10786,
7206,
2538,
9328,
16034,
11602,
810,
20579,
796,
4064,
82,
26,
3256,
17816,
741,
47477,
62,
9288,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
4637,
13,
41509,
3419,
198,
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,
1303,
23493,
13,
41049,
10786,
46506,
327,
28270,
7,
28104,
16034,
2323,
62,
35310,
62,
6404,
62,
7753,
810,
20579,
796,
4064,
82,
5357,
308,
83,
62,
4906,
796,
4064,
82,
26,
3256,
17816,
741,
47477,
62,
9288,
41707,
23912,
1424,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
9093,
796,
23493,
13,
69,
7569,
505,
3419,
58,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
7,
504,
6624,
1802,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
23493,
13,
41049,
10786,
7206,
2538,
9328,
16034,
2323,
62,
35310,
62,
6404,
62,
7753,
810,
20579,
796,
4064,
82,
290,
308,
83,
62,
4906,
796,
4064,
82,
26,
3256,
17816,
741,
47477,
62,
9288,
41707,
23912,
1424,
6,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
4637,
13,
41509,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
269,
1875,
657,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4639,
13,
5420,
3447,
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,
9766,
16,
796,
5313,
32103,
21321,
7,
26230,
11,
838,
737,
28446,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13182,
13,
18302,
594,
62,
1659,
62,
30854,
62,
75,
10533,
19510,
3886,
13,
27481,
12599,
11,
705,
1003,
16539,
58,
5239,
3419,
2625,
17822,
1424,
8973,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9766,
16,
13,
12976,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19781,
62,
16,
796,
409,
265,
363,
62,
23912,
62,
9288,
7,
26230,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1366,
13,
33295,
7,
45016,
62,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
2536,
7,
45016,
62,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
7,
4906,
7,
45016,
62,
16,
8,
6624,
705,
2536,
6,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
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,
19781,
796,
19781,
1343,
19781,
62,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
796,
269,
10,
16,
628,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
357,
16922,
11,
17331,
22163,
70,
17,
13,
12331,
8,
355,
304,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
68,
8,
628,
198,
220,
220,
220,
220,
220,
220,
220,
3443,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
9605,
6831,
4637,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
357,
38659,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
23493,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
4637,
13,
19836,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
45016,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14367,
796,
7869,
13,
301,
7959,
7,
7890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
2536,
7,
19282,
4008,
628
] | 1.817618 | 1,612 |
#
# $Header: /home/inqwell/cvsroot/dev/scripts/python/FotechUtils/dbUtils.py,v 1.1 2009/05/22 22:16:32 sanderst Exp $
#
import KBC.fotech
from Util import db
from dbConfig import configurationProvider
def getConnection( confile, system, level, access = "read", site = None, user = None, pwdfile = None ):
"""
Partial replacement for the db.py mess in cbtech/python2.5. You should use /prod/fotech/bin/generateDatabaseXml.py
to generate an xml file containing your system/level config from the old db.py. Then replace any call to db.getConnection
with dbUtils.getConnection and you should get back the same object that you would have got in the old strategy.
"""
config = configurationProvider( confile, pwdfile )
vendor, server, user, password, schema, host, port = config.getConnectionDetails( system, level, access, site, user )
return db._getConnection( vendor.upper(), server, schema, user, password )
| [
2,
198,
2,
720,
39681,
25,
1220,
11195,
14,
259,
80,
4053,
14,
66,
14259,
15763,
14,
7959,
14,
46521,
14,
29412,
14,
37,
32469,
18274,
4487,
14,
9945,
18274,
4487,
13,
9078,
11,
85,
352,
13,
16,
3717,
14,
2713,
14,
1828,
2534,
25,
1433,
25,
2624,
264,
4066,
301,
5518,
720,
198,
2,
198,
11748,
509,
2749,
13,
69,
32469,
198,
198,
6738,
7273,
346,
1330,
20613,
198,
198,
6738,
20613,
16934,
1330,
8398,
29495,
198,
198,
4299,
651,
32048,
7,
1013,
576,
11,
1080,
11,
1241,
11,
1895,
796,
366,
961,
1600,
2524,
796,
6045,
11,
2836,
796,
6045,
11,
279,
86,
7568,
576,
796,
6045,
15179,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
220,
220,
220,
220,
43689,
9014,
329,
262,
20613,
13,
9078,
2085,
287,
269,
65,
13670,
14,
29412,
17,
13,
20,
13,
921,
815,
779,
1220,
1676,
67,
14,
69,
32469,
14,
8800,
14,
8612,
378,
38105,
55,
4029,
13,
9078,
198,
220,
220,
220,
220,
220,
220,
220,
284,
7716,
281,
35555,
2393,
7268,
534,
1080,
14,
5715,
4566,
422,
262,
1468,
20613,
13,
9078,
13,
3244,
6330,
597,
869,
284,
20613,
13,
1136,
32048,
198,
220,
220,
220,
220,
220,
220,
220,
351,
20613,
18274,
4487,
13,
1136,
32048,
290,
345,
815,
651,
736,
262,
976,
2134,
326,
345,
561,
423,
1392,
287,
262,
1468,
4811,
13,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
4566,
796,
8398,
29495,
7,
1013,
576,
11,
279,
86,
7568,
576,
1267,
198,
220,
220,
220,
220,
198,
220,
220,
220,
18371,
11,
4382,
11,
2836,
11,
9206,
11,
32815,
11,
2583,
11,
2493,
796,
4566,
13,
1136,
32048,
24259,
7,
1080,
11,
1241,
11,
1895,
11,
2524,
11,
2836,
1267,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
20613,
13557,
1136,
32048,
7,
18371,
13,
45828,
22784,
4382,
11,
32815,
11,
2836,
11,
9206,
1267,
198
] | 3.037855 | 317 |
#!/usr/bin/env python3
import random
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument("number",
help="Generate a random numbers until they are equal to this.", type=int)
parser.add_argument("-s", "--start", type=int, default=0,
help="The range in which the random numbers are in starts with this number. (default 0)")
parser.add_argument("-e", "--end", type=int, default=32767,
help="The range in which the random numbers are in ends with this number. (default 32767)")
parser.add_argument("-c", "--count",
help="Counts the amount of tries it takes to get to the number.", action="store_true")
parser.add_argument("-n", "--newline",
help="Adds a newline between random numbers.", action="store_true")
args = parser.parse_args()
if args.start > args.end:
error("error: start is greater than end")
if args.number > args.end or args.number < args.start:
error("error: number is either greater than end or less than start")
end = "\n" if args.newline else "\r"
rand_num = ''
tries = 0
args.end += 1
while rand_num != args.number:
width = len(str(rand_num))
rand_num = random.randrange(args.start, args.end)
print("{rand_num: <{width}}".format(rand_num=rand_num, width=width), end=end)
tries += 1
if args.count:
print("{} tries to get to {}".format(tries, args.number))
elif end == "\r":
print()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
11748,
4738,
198,
11748,
1822,
29572,
198,
11748,
25064,
628,
198,
198,
48610,
796,
1822,
29572,
13,
28100,
1713,
46677,
3419,
198,
48610,
13,
2860,
62,
49140,
7203,
17618,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
2625,
8645,
378,
257,
4738,
3146,
1566,
484,
389,
4961,
284,
428,
33283,
2099,
28,
600,
8,
198,
48610,
13,
2860,
62,
49140,
7203,
12,
82,
1600,
366,
438,
9688,
1600,
2099,
28,
600,
11,
4277,
28,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
2625,
464,
2837,
287,
543,
262,
4738,
3146,
389,
287,
4940,
351,
428,
1271,
13,
357,
12286,
657,
8,
4943,
198,
48610,
13,
2860,
62,
49140,
7203,
12,
68,
1600,
366,
438,
437,
1600,
2099,
28,
600,
11,
4277,
28,
34159,
3134,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
2625,
464,
2837,
287,
543,
262,
4738,
3146,
389,
287,
5645,
351,
428,
1271,
13,
357,
12286,
36203,
3134,
8,
4943,
198,
48610,
13,
2860,
62,
49140,
7203,
12,
66,
1600,
366,
438,
9127,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
2625,
12332,
82,
262,
2033,
286,
8404,
340,
2753,
284,
651,
284,
262,
1271,
33283,
2223,
2625,
8095,
62,
7942,
4943,
198,
48610,
13,
2860,
62,
49140,
7203,
12,
77,
1600,
366,
438,
3605,
1370,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
2625,
46245,
257,
649,
1370,
1022,
4738,
3146,
33283,
2223,
2625,
8095,
62,
7942,
4943,
198,
198,
22046,
796,
30751,
13,
29572,
62,
22046,
3419,
198,
361,
26498,
13,
9688,
1875,
26498,
13,
437,
25,
198,
220,
220,
220,
4049,
7203,
18224,
25,
923,
318,
3744,
621,
886,
4943,
198,
361,
26498,
13,
17618,
1875,
26498,
13,
437,
393,
26498,
13,
17618,
1279,
26498,
13,
9688,
25,
198,
220,
220,
220,
4049,
7203,
18224,
25,
1271,
318,
2035,
3744,
621,
886,
393,
1342,
621,
923,
4943,
198,
437,
796,
37082,
77,
1,
611,
26498,
13,
3605,
1370,
2073,
37082,
81,
1,
198,
25192,
62,
22510,
796,
10148,
198,
83,
1678,
796,
657,
198,
22046,
13,
437,
15853,
352,
198,
4514,
43720,
62,
22510,
14512,
26498,
13,
17618,
25,
198,
220,
220,
220,
9647,
796,
18896,
7,
2536,
7,
25192,
62,
22510,
4008,
198,
220,
220,
220,
43720,
62,
22510,
796,
4738,
13,
25192,
9521,
7,
22046,
13,
9688,
11,
26498,
13,
437,
8,
198,
220,
220,
220,
3601,
7203,
90,
25192,
62,
22510,
25,
1279,
90,
10394,
11709,
1911,
18982,
7,
25192,
62,
22510,
28,
25192,
62,
22510,
11,
9647,
28,
10394,
828,
886,
28,
437,
8,
198,
220,
220,
220,
8404,
15853,
352,
198,
361,
26498,
13,
9127,
25,
198,
220,
220,
220,
3601,
7203,
90,
92,
8404,
284,
651,
284,
23884,
1911,
18982,
7,
83,
1678,
11,
26498,
13,
17618,
4008,
198,
417,
361,
886,
6624,
37082,
81,
1298,
198,
220,
220,
220,
3601,
3419,
628
] | 2.675824 | 546 |
"""
Clase para representar a los diferentes modelos y su comportamiento
atributos(de momento)
df=dataframe de entrenamiento proviniente del conjunto de datos de entrenamiento del usuario
x_train,x_test,y_train,y_test, particiones de df para entrenar el modelo
El resto de mtodos son autoexplicativos
"""
from numpy import array
from pandas.core.frame import DataFrame
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn import metrics
| [
37811,
198,
2601,
589,
31215,
2380,
283,
257,
22346,
288,
361,
9100,
274,
2746,
418,
331,
424,
552,
419,
321,
1153,
78,
198,
198,
265,
2455,
418,
7,
2934,
2589,
78,
8,
198,
7568,
28,
7890,
14535,
390,
920,
918,
321,
1153,
78,
899,
259,
1153,
68,
1619,
11644,
403,
1462,
390,
4818,
418,
390,
920,
918,
321,
1153,
78,
1619,
514,
84,
4982,
198,
87,
62,
27432,
11,
87,
62,
9288,
11,
88,
62,
27432,
11,
88,
62,
9288,
11,
1344,
295,
274,
390,
47764,
31215,
920,
918,
283,
1288,
2746,
78,
198,
198,
9527,
1334,
78,
390,
45079,
375,
418,
3367,
8295,
20676,
291,
265,
452,
418,
198,
37811,
628,
198,
6738,
299,
32152,
1330,
7177,
198,
6738,
19798,
292,
13,
7295,
13,
14535,
1330,
6060,
19778,
198,
11748,
19798,
292,
355,
279,
67,
198,
6738,
1341,
35720,
13,
19849,
62,
49283,
1330,
4512,
62,
9288,
62,
35312,
198,
6738,
1341,
35720,
13,
29127,
62,
19849,
1330,
5972,
2569,
8081,
2234,
198,
6738,
1341,
35720,
1330,
20731,
198
] | 3.088235 | 170 |
#!/usr/bin/env python3
import numpy as np
import sys
import struct
# from math import fabs
from enum import IntEnum
from scipy import spatial
from math import *
from collections import OrderedDict
| [
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
18,
198,
198,
11748,
299,
32152,
355,
45941,
198,
11748,
25064,
198,
11748,
2878,
198,
2,
422,
10688,
1330,
7843,
82,
198,
6738,
33829,
1330,
2558,
4834,
388,
198,
6738,
629,
541,
88,
1330,
21739,
198,
6738,
10688,
1330,
1635,
198,
6738,
17268,
1330,
14230,
1068,
35,
713,
628
] | 3.491228 | 57 |
from src.eda import make_counter
import pandas as pd
import numpy as np
from src.heroes import heroes, name_id, id_name
def id_list_from_history(data):
'''
Takes raw data returnd by api_calls.get_match_history() and returns a list of just the match ID's
Input:
data(list):
list of match objects
Output:
List of integers each representing a unique match id
'''
return [int(i['match_id']) for i in data]
def clean_match_details(match):
'''
Takes raw data from api_calls.get_match_details() and returns a dictionary with the pertinent details
Input:
match(dict):
Return of the api.steampowers api
Dict with one key-Val pair result is a dictionary with the match information
Output:
out(dict):
Dictionary of pertinent data:
radiant_win(bool): Team that won
match_date(timestamp): When the match was played
radiant_hero_ids(list of ints): List of hero Ids for the radiant team
dire_hero_ids(list of ints): List of hero Ids for the dire team
'''
data = match['result']
out = {}
out['_id'] = data['match_id']
out['radiant_win'] = int(data['radiant_win'])
out['match_date'] = data['start_time']
out['radiant_hero_ids'] = []
out['dire_hero_ids'] = []
for player in data['players']:
if player['player_slot'] < 128:
out['radiant_hero_ids'] += [player['hero_id']]
else:
out['dire_hero_ids'] += [player['hero_id']]
return out
def make_csv(counter, counter_data):
'''
Takes in a premade coutner using make_counter from eda.py and the data used to amke the counter and produces a CSV.
Input:
counter(Counter):
Counter from all the DB data - used to generate unique columns
counter_data(mongo cursor list):
return of .find() on the raw collection
Output:
None: Creates a csv file in the same directory as run
'''
#remove count column so keys includes only hero ids
del counter['count']
uids = sorted(counter.keys())
uid_cols = []
#add a column for each hero fro each team
for i in uids:
uid_cols += [(str(i)+'R')]
uid_cols += [(str(i)+'D')]
#add the initial 3 columns and combine with hero id columns
columns = ['match_id', 'match_date', 'radiant_win']
columns += uid_cols
#create a template for each row
row_template = {col: 0 for col in columns}
rows_list = []
#for each match format a row and add to list
for match in counter_data:
temp_row = row_template.copy()
temp_row['match_id'] = match['_id']
temp_row['match_date'] = match['match_date']
temp_row['radiant_win'] = match['radiant_win']
for indx, hid in enumerate(match['radiant_hero_ids']):
temp_row[(str(hid)+'R')] = 1
temp_row[(str(match['dire_hero_ids'][indx])+'D')] = 1
rows_list += [temp_row]
#use rows to create dataframe and print to csv
df = pd.DataFrame(rows_list)
df.to_csv('test.csv')
def make_pred_row(df, rad, dire):
'''
Makes a row for predicitons to be made on
Input:
df(dataframe):
Read this is from test.csv - used to generate columns
rad(list):
List of hero names recived from the front end for readiant team
dire(list):
List of hero names recived from the front end for dire team
Output:
pred_row(pandas dataframe):
Converts heros names to IDs then adds ones to the DF in the appropriate slotfor their team
'''
#drop unnessacary columns
drop_cols = ['Unnamed: 0', 'match_id', 'match_date', 'Unnamed: 1', 'radiant_win']
for i in drop_cols:
try:
df.pop(i)
except:
continue
#make blank row
pred_row = pd.DataFrame([np.zeros(len(df.columns))], columns=df.columns)
#fill in row
for indx, hero in enumerate(rad):
#get radiant hero id - insert to pred row with R
rhid = name_id(hero)
pred_row[str(rhid)+'R'] = 1.0
#get radiant hero id - insert to pred row with D
dhid = name_id(dire[indx])
pred_row[str(dhid)+'D'] = 1.0
return pred_row | [
6738,
12351,
13,
18082,
1330,
787,
62,
24588,
198,
11748,
19798,
292,
355,
279,
67,
198,
11748,
299,
32152,
355,
45941,
198,
6738,
12351,
13,
11718,
274,
1330,
10281,
11,
1438,
62,
312,
11,
4686,
62,
3672,
198,
198,
4299,
4686,
62,
4868,
62,
6738,
62,
23569,
7,
7890,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
33687,
8246,
1366,
1005,
333,
358,
416,
40391,
62,
66,
5691,
13,
1136,
62,
15699,
62,
23569,
3419,
290,
5860,
257,
1351,
286,
655,
262,
2872,
4522,
338,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
7,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1351,
286,
2872,
5563,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
37014,
1123,
10200,
257,
3748,
2872,
4686,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
685,
600,
7,
72,
17816,
15699,
62,
312,
6,
12962,
329,
1312,
287,
1366,
60,
198,
198,
4299,
3424,
62,
15699,
62,
36604,
7,
15699,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
33687,
8246,
1366,
422,
40391,
62,
66,
5691,
13,
1136,
62,
15699,
62,
36604,
3419,
290,
5860,
257,
22155,
351,
262,
35268,
3307,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2872,
7,
11600,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8229,
286,
262,
40391,
13,
4169,
696,
3618,
40391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
360,
713,
351,
530,
1994,
12,
7762,
5166,
1255,
318,
257,
22155,
351,
262,
2872,
1321,
198,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
503,
7,
11600,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28261,
286,
35268,
1366,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43888,
62,
5404,
7,
30388,
2599,
4816,
326,
1839,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2872,
62,
4475,
7,
16514,
27823,
2599,
1649,
262,
2872,
373,
2826,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43888,
62,
11718,
62,
2340,
7,
4868,
286,
493,
82,
2599,
7343,
286,
4293,
5121,
82,
329,
262,
43888,
1074,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19958,
62,
11718,
62,
2340,
7,
4868,
286,
493,
82,
2599,
7343,
286,
4293,
5121,
82,
329,
262,
19958,
1074,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1366,
796,
2872,
17816,
20274,
20520,
198,
220,
220,
220,
503,
796,
23884,
198,
220,
220,
220,
503,
17816,
62,
312,
20520,
796,
1366,
17816,
15699,
62,
312,
20520,
198,
220,
220,
220,
503,
17816,
6335,
3014,
62,
5404,
20520,
796,
493,
7,
7890,
17816,
6335,
3014,
62,
5404,
6,
12962,
198,
220,
220,
220,
503,
17816,
15699,
62,
4475,
20520,
796,
1366,
17816,
9688,
62,
2435,
20520,
198,
220,
220,
220,
503,
17816,
6335,
3014,
62,
11718,
62,
2340,
20520,
796,
17635,
198,
220,
220,
220,
503,
17816,
67,
557,
62,
11718,
62,
2340,
20520,
796,
17635,
198,
220,
220,
220,
329,
2137,
287,
1366,
17816,
32399,
6,
5974,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2137,
17816,
7829,
62,
43384,
20520,
1279,
13108,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
17816,
6335,
3014,
62,
11718,
62,
2340,
20520,
15853,
685,
7829,
17816,
11718,
62,
312,
6,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
17816,
67,
557,
62,
11718,
62,
2340,
20520,
15853,
685,
7829,
17816,
11718,
62,
312,
6,
11907,
198,
220,
220,
220,
1441,
503,
198,
198,
4299,
787,
62,
40664,
7,
24588,
11,
3753,
62,
7890,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
33687,
287,
257,
4199,
671,
42304,
1008,
1262,
787,
62,
24588,
422,
1225,
64,
13,
9078,
290,
262,
1366,
973,
284,
716,
365,
262,
3753,
290,
11073,
257,
44189,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3753,
7,
31694,
2599,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15034,
422,
477,
262,
20137,
1366,
532,
973,
284,
7716,
3748,
15180,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3753,
62,
7890,
7,
76,
25162,
23493,
1351,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
286,
764,
19796,
3419,
319,
262,
8246,
4947,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
6045,
25,
7921,
274,
257,
269,
21370,
2393,
287,
262,
976,
8619,
355,
1057,
220,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1303,
28956,
954,
5721,
523,
8251,
3407,
691,
4293,
220,
2340,
198,
220,
220,
220,
1619,
3753,
17816,
9127,
20520,
198,
220,
220,
220,
334,
2340,
796,
23243,
7,
24588,
13,
13083,
28955,
198,
220,
220,
220,
334,
312,
62,
4033,
82,
796,
220,
17635,
198,
220,
220,
220,
1303,
2860,
257,
5721,
329,
1123,
4293,
8400,
1123,
1074,
198,
220,
220,
220,
329,
1312,
287,
334,
2340,
25,
198,
220,
220,
220,
220,
220,
220,
220,
334,
312,
62,
4033,
82,
15853,
47527,
2536,
7,
72,
47762,
6,
49,
11537,
60,
198,
220,
220,
220,
220,
220,
220,
220,
334,
312,
62,
4033,
82,
15853,
47527,
2536,
7,
72,
47762,
6,
35,
11537,
60,
198,
220,
220,
220,
1303,
2860,
262,
4238,
513,
15180,
290,
12082,
351,
4293,
4686,
15180,
198,
220,
220,
220,
15180,
796,
37250,
15699,
62,
312,
3256,
705,
15699,
62,
4475,
3256,
705,
6335,
3014,
62,
5404,
20520,
198,
220,
220,
220,
15180,
15853,
334,
312,
62,
4033,
82,
198,
220,
220,
220,
1303,
17953,
257,
11055,
329,
1123,
5752,
198,
220,
220,
220,
5752,
62,
28243,
796,
1391,
4033,
25,
657,
329,
951,
287,
15180,
92,
198,
220,
220,
220,
15274,
62,
4868,
796,
17635,
198,
220,
220,
220,
1303,
1640,
1123,
2872,
5794,
257,
5752,
290,
751,
284,
1351,
198,
220,
220,
220,
329,
2872,
287,
3753,
62,
7890,
25,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
808,
796,
5752,
62,
28243,
13,
30073,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
808,
17816,
15699,
62,
312,
20520,
796,
2872,
17816,
62,
312,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
808,
17816,
15699,
62,
4475,
20520,
796,
2872,
17816,
15699,
62,
4475,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
808,
17816,
6335,
3014,
62,
5404,
20520,
796,
2872,
17816,
6335,
3014,
62,
5404,
20520,
198,
220,
220,
220,
220,
220,
220,
220,
329,
773,
87,
11,
24519,
287,
27056,
378,
7,
15699,
17816,
6335,
3014,
62,
11718,
62,
2340,
20520,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
808,
58,
7,
2536,
7,
49675,
47762,
6,
49,
11537,
60,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20218,
62,
808,
58,
7,
2536,
7,
15699,
17816,
67,
557,
62,
11718,
62,
2340,
6,
7131,
521,
87,
12962,
10,
6,
35,
11537,
60,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
15274,
62,
4868,
15853,
685,
29510,
62,
808,
60,
198,
220,
220,
220,
1303,
1904,
15274,
284,
2251,
1366,
14535,
290,
3601,
284,
269,
21370,
198,
220,
220,
220,
47764,
796,
279,
67,
13,
6601,
19778,
7,
8516,
62,
4868,
8,
198,
220,
220,
220,
47764,
13,
1462,
62,
40664,
10786,
9288,
13,
40664,
11537,
198,
220,
220,
220,
220,
198,
4299,
787,
62,
28764,
62,
808,
7,
7568,
11,
2511,
11,
19958,
2599,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
27433,
257,
5752,
329,
2747,
3628,
684,
284,
307,
925,
319,
198,
220,
220,
220,
220,
198,
220,
220,
220,
23412,
25,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
7,
7890,
14535,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4149,
428,
318,
422,
1332,
13,
40664,
532,
973,
284,
7716,
15180,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2511,
7,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
4293,
3891,
664,
1572,
422,
262,
2166,
886,
329,
1100,
3014,
1074,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
19958,
7,
4868,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7343,
286,
4293,
3891,
664,
1572,
422,
262,
2166,
886,
329,
19958,
1074,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
25235,
25,
198,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
62,
808,
7,
79,
392,
292,
1366,
14535,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1482,
24040,
4293,
82,
3891,
284,
32373,
788,
6673,
3392,
284,
262,
36323,
287,
262,
5035,
10852,
1640,
511,
1074,
220,
198,
220,
220,
220,
705,
7061,
198,
220,
220,
220,
1303,
14781,
555,
1108,
330,
560,
15180,
198,
220,
220,
220,
4268,
62,
4033,
82,
796,
37250,
3118,
13190,
25,
657,
3256,
705,
15699,
62,
312,
3256,
705,
15699,
62,
4475,
3256,
705,
3118,
13190,
25,
352,
3256,
705,
6335,
3014,
62,
5404,
20520,
198,
220,
220,
220,
329,
1312,
287,
4268,
62,
4033,
82,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47764,
13,
12924,
7,
72,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2845,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
1303,
15883,
9178,
5752,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
2747,
62,
808,
796,
279,
67,
13,
6601,
19778,
26933,
37659,
13,
9107,
418,
7,
11925,
7,
7568,
13,
28665,
82,
4008,
4357,
15180,
28,
7568,
13,
28665,
82,
8,
198,
220,
220,
220,
1303,
20797,
287,
5752,
198,
220,
220,
220,
329,
773,
87,
11,
4293,
287,
27056,
378,
7,
6335,
2599,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1136,
43888,
4293,
4686,
532,
7550,
284,
2747,
5752,
351,
371,
198,
220,
220,
220,
220,
220,
220,
220,
9529,
312,
796,
1438,
62,
312,
7,
11718,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
62,
808,
58,
2536,
7,
17179,
312,
47762,
6,
49,
20520,
796,
352,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1136,
43888,
4293,
4686,
532,
7550,
284,
2747,
5752,
351,
360,
198,
220,
220,
220,
220,
220,
220,
220,
34590,
312,
796,
1438,
62,
312,
7,
67,
557,
58,
521,
87,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2747,
62,
808,
58,
2536,
7,
34985,
312,
47762,
6,
35,
20520,
796,
352,
13,
15,
220,
220,
220,
198,
220,
220,
220,
1441,
2747,
62,
808
] | 2.22069 | 2,030 |
from django.shortcuts import render
from .models import *
| [
6738,
42625,
14208,
13,
19509,
23779,
1330,
8543,
198,
6738,
764,
27530,
1330,
1635,
628
] | 3.933333 | 15 |
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from core.models import User
| [
6738,
1334,
62,
30604,
1330,
11389,
11341,
198,
6738,
1334,
62,
30604,
13,
12102,
2024,
1330,
30015,
47139,
1352,
198,
6738,
4755,
13,
27530,
1330,
11787,
628
] | 4.555556 | 27 |
from . import experts, gating_networks, gps, mixture_of_experts, training
| [
6738,
764,
1330,
6154,
11,
308,
803,
62,
3262,
5225,
11,
308,
862,
11,
11710,
62,
1659,
62,
23100,
912,
11,
3047,
198
] | 3.217391 | 23 |
from pynfldata.coaches_data import coaches_parser | [
6738,
279,
2047,
69,
335,
1045,
13,
1073,
3694,
62,
7890,
1330,
11070,
62,
48610
] | 3.266667 | 15 |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers, optimizers
# BatchNorm
# 2 images with 4x4 size, 3 channels
# we explicitly enforce the mean and stddev to N(1, 0.5)
x = tf.random.normal([2, 4, 4, 3], mean=1.0, stddev=0.5)
net = layers.BatchNormalization(axis=-1, center=True, scale=True, trainable=True)
# layers.LayerNormalization
out = net(x)
print("forward in test mode:", net.variables)
out = net(x, training=True)
print("forward in train mode(1 step):", net.variables)
for i in range(100):
out = net(x, training=True)
print("forward in train mode(100 steps):", net.variables)
optimizer = optimizers.SGD(lr=1e-2)
for i in range(10):
with tf.GradientTape() as tape:
out = net(x, training=True)
loss = tf.reduce_mean(tf.pow(out, 2)) - 1
grads = tape.gradient(loss, net.trainable_variables)
optimizer.apply_gradients(zip(grads, net.trainable_variables))
print("backward(10 steps):", net.variables)
| [
11748,
11192,
273,
11125,
355,
48700,
198,
198,
6738,
11192,
273,
11125,
1330,
41927,
292,
198,
6738,
11192,
273,
11125,
13,
6122,
292,
1330,
11685,
11,
6436,
11341,
198,
198,
2,
347,
963,
35393,
220,
198,
2,
362,
4263,
351,
604,
87,
19,
2546,
11,
513,
9619,
198,
2,
356,
11777,
4605,
262,
1612,
290,
336,
1860,
1990,
284,
399,
7,
16,
11,
657,
13,
20,
8,
198,
87,
796,
48700,
13,
25120,
13,
11265,
26933,
17,
11,
604,
11,
604,
11,
513,
4357,
1612,
28,
16,
13,
15,
11,
336,
1860,
1990,
28,
15,
13,
20,
8,
198,
198,
3262,
796,
11685,
13,
33,
963,
26447,
1634,
7,
22704,
10779,
16,
11,
3641,
28,
17821,
11,
5046,
28,
17821,
11,
4512,
540,
28,
17821,
8,
198,
2,
11685,
13,
49925,
26447,
1634,
198,
198,
448,
796,
2010,
7,
87,
8,
198,
4798,
7203,
11813,
287,
1332,
4235,
25,
1600,
2010,
13,
25641,
2977,
8,
198,
198,
448,
796,
2010,
7,
87,
11,
3047,
28,
17821,
8,
198,
4798,
7203,
11813,
287,
4512,
4235,
7,
16,
2239,
2599,
1600,
2010,
13,
25641,
2977,
8,
198,
198,
1640,
1312,
287,
2837,
7,
3064,
2599,
198,
220,
220,
220,
503,
796,
2010,
7,
87,
11,
3047,
28,
17821,
8,
198,
4798,
7203,
11813,
287,
4512,
4235,
7,
3064,
4831,
2599,
1600,
2010,
13,
25641,
2977,
8,
198,
198,
40085,
7509,
796,
6436,
11341,
13,
38475,
35,
7,
14050,
28,
16,
68,
12,
17,
8,
198,
1640,
1312,
287,
2837,
7,
940,
2599,
198,
220,
220,
220,
351,
48700,
13,
42731,
1153,
51,
1758,
3419,
355,
9154,
25,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2010,
7,
87,
11,
3047,
28,
17821,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2994,
796,
48700,
13,
445,
7234,
62,
32604,
7,
27110,
13,
79,
322,
7,
448,
11,
362,
4008,
532,
352,
628,
220,
220,
220,
3915,
82,
796,
9154,
13,
49607,
7,
22462,
11,
2010,
13,
27432,
540,
62,
25641,
2977,
8,
198,
220,
220,
220,
6436,
7509,
13,
39014,
62,
9744,
2334,
7,
13344,
7,
2164,
5643,
11,
2010,
13,
27432,
540,
62,
25641,
2977,
4008,
198,
4798,
7203,
1891,
904,
7,
940,
4831,
2599,
1600,
2010,
13,
25641,
2977,
8,
198
] | 2.632708 | 373 |
"""Application entry point."""
import argparse
import logging
from pytocl.protocol import Client
def main():
"""Main entry point of application."""
parser = argparse.ArgumentParser(description='Client for TORCS racing car simulation with SCRC '
'network server.')
parser.add_argument('--hostname', help='Racing server host name.', default='localhost')
parser.add_argument('--port', help='Port to connect, 3001 - 3010 for clients 1 - 10.',
type=int, default=3001)
parser.add_argument('-v', help='Debug log level.', action='store_true')
args = parser.parse_args()
# switch log level:
if args.v:
level = logging.DEBUG
else:
level = logging.INFO
del args.v
logging.basicConfig(level=level, format="%(asctime)s %(levelname)7s %(name)s %(message)s")
# start client loop:
client = Client(**args.__dict__)
client.run()
if __name__ == '__main__':
main()
| [
37811,
23416,
5726,
966,
526,
15931,
198,
11748,
1822,
29572,
198,
11748,
18931,
198,
198,
6738,
12972,
83,
38679,
13,
11235,
4668,
1330,
20985,
628,
198,
4299,
1388,
33529,
198,
220,
220,
220,
37227,
13383,
5726,
966,
286,
3586,
526,
15931,
198,
220,
220,
220,
30751,
796,
1822,
29572,
13,
28100,
1713,
46677,
7,
11213,
11639,
11792,
329,
40691,
7902,
11717,
1097,
18640,
351,
6374,
7397,
705,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
705,
27349,
4382,
2637,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
4774,
3672,
3256,
1037,
11639,
49,
4092,
4382,
2583,
1438,
2637,
11,
4277,
11639,
36750,
11537,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
10786,
438,
634,
3256,
1037,
11639,
13924,
284,
2018,
11,
5867,
16,
532,
513,
20943,
329,
7534,
352,
532,
838,
2637,
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,
2099,
28,
600,
11,
4277,
28,
6200,
16,
8,
198,
220,
220,
220,
30751,
13,
2860,
62,
49140,
10786,
12,
85,
3256,
1037,
11639,
27509,
2604,
1241,
2637,
11,
2223,
11639,
8095,
62,
7942,
11537,
198,
220,
220,
220,
26498,
796,
30751,
13,
29572,
62,
22046,
3419,
628,
220,
220,
220,
1303,
5078,
2604,
1241,
25,
198,
220,
220,
220,
611,
26498,
13,
85,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1241,
796,
18931,
13,
30531,
198,
220,
220,
220,
2073,
25,
198,
220,
220,
220,
220,
220,
220,
220,
1241,
796,
18931,
13,
10778,
198,
220,
220,
220,
1619,
26498,
13,
85,
198,
220,
220,
220,
18931,
13,
35487,
16934,
7,
5715,
28,
5715,
11,
5794,
2625,
4,
7,
292,
310,
524,
8,
82,
4064,
7,
5715,
3672,
8,
22,
82,
4064,
7,
3672,
8,
82,
4064,
7,
20500,
8,
82,
4943,
628,
220,
220,
220,
1303,
923,
5456,
9052,
25,
198,
220,
220,
220,
5456,
796,
20985,
7,
1174,
22046,
13,
834,
11600,
834,
8,
198,
220,
220,
220,
5456,
13,
5143,
3419,
628,
198,
361,
11593,
3672,
834,
6624,
705,
834,
12417,
834,
10354,
198,
220,
220,
220,
1388,
3419,
198
] | 2.508772 | 399 |
import sublime
import sublime_plugin
import re
import os
rexLastTabs = re.compile(r'(\t+|\s+)$', re.MULTILINE)
rexEmptyLines = re.compile('^[ \t]*$\r?\n', re.MULTILINE)
rexCont = re.compile(r'[^\t\s].*[^\t\s]')
rexFormatted = re.compile(r"((?<=\s)'|(?<=\t)')|('*\s[\+|\\|])")
#https://github.com/jdc0589/JsFormat line 47
def is_js_buffer(view):
fName = view.file_name()
vSettings = view.settings()
syntaxPath = vSettings.get('syntax')
syntax = ""
ext = ""
if (fName != None): # file exists, pull syntax type from extension
ext = os.path.splitext(fName)[1][1:]
if(syntaxPath != None):
syntax = os.path.splitext(syntaxPath)[0].split('/')[-1].lower()
return ext in ['js', 'json'] or "javascript" in syntax or "json" in syntax | [
11748,
41674,
198,
11748,
41674,
62,
33803,
198,
11748,
302,
198,
11748,
28686,
628,
198,
21510,
5956,
51,
8937,
796,
302,
13,
5589,
576,
7,
81,
6,
38016,
83,
10,
91,
59,
82,
28988,
3,
3256,
302,
13,
44,
16724,
4146,
8881,
8,
198,
21510,
40613,
43,
1127,
796,
302,
13,
5589,
576,
10786,
61,
58,
3467,
83,
60,
9,
3,
59,
81,
30,
59,
77,
3256,
302,
13,
44,
16724,
4146,
8881,
8,
198,
21510,
4264,
796,
302,
13,
5589,
576,
7,
81,
6,
58,
61,
59,
83,
59,
82,
4083,
9,
58,
61,
59,
83,
59,
82,
60,
11537,
198,
21510,
8479,
16898,
796,
302,
13,
5589,
576,
7,
81,
18109,
7,
30,
27,
28,
59,
82,
33047,
91,
7,
30,
27,
28,
59,
83,
8,
11537,
91,
10786,
9,
59,
82,
58,
59,
10,
91,
6852,
91,
12962,
4943,
628,
198,
2,
5450,
1378,
12567,
13,
785,
14,
73,
17896,
2713,
4531,
14,
49044,
26227,
1627,
6298,
198,
4299,
318,
62,
8457,
62,
22252,
7,
1177,
2599,
198,
197,
69,
5376,
796,
1570,
13,
7753,
62,
3672,
3419,
198,
197,
85,
26232,
796,
1570,
13,
33692,
3419,
198,
197,
1837,
41641,
15235,
796,
410,
26232,
13,
1136,
10786,
1837,
41641,
11537,
198,
197,
1837,
41641,
796,
13538,
198,
197,
2302,
796,
13538,
628,
197,
361,
357,
69,
5376,
14512,
6045,
2599,
1303,
2393,
7160,
11,
2834,
15582,
2099,
422,
7552,
198,
197,
197,
2302,
796,
28686,
13,
6978,
13,
22018,
578,
742,
7,
69,
5376,
38381,
16,
7131,
16,
47715,
198,
197,
361,
7,
1837,
41641,
15235,
14512,
6045,
2599,
198,
197,
197,
1837,
41641,
796,
28686,
13,
6978,
13,
22018,
578,
742,
7,
1837,
41641,
15235,
38381,
15,
4083,
35312,
10786,
14,
11537,
58,
12,
16,
4083,
21037,
3419,
628,
197,
7783,
1070,
287,
37250,
8457,
3256,
705,
17752,
20520,
393,
366,
37495,
1,
287,
15582,
393,
366,
17752,
1,
287,
15582
] | 2.341772 | 316 |
Subsets and Splits