content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
# Copyright 2016 Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import mock from osprofiler.drivers.ceilometer import Ceilometer from osprofiler.tests import test
[ 2, 15069, 1584, 7381, 20836, 3457, 13, 198, 2, 1439, 6923, 33876, 13, 198, 2, 198, 2, 220, 220, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 345, 743, 198, 2, 220, 220, 220, 407, 779, ...
3.42723
213
from pathlib import Path import numpy as np import pickle import argparse import errno import sys if __name__ == '__main__': main()
[ 6738, 3108, 8019, 1330, 10644, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2298, 293, 198, 11748, 1822, 29572, 198, 11748, 11454, 3919, 198, 11748, 25064, 628, 628, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 1...
3
48
#!/usr/bin/python from aos.util.trapezoid_profile import TrapezoidProfile from frc971.control_loops.python import control_loop from frc971.control_loops.python import angular_system from frc971.control_loops.python import controls import copy import numpy import sys from matplotlib import pylab import gflags import glog FLAGS = gflags.FLAGS try: gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.') except gflags.DuplicateFlagError: pass # Wrist alone # 0.1348 # Wrist with ball # 0.3007 # Wrist with hatch # 0.446 kWrist = angular_system.AngularSystemParams( name='Wrist', motor=control_loop.BAG(), G=(6.0 / 60.0) * (20.0 / 100.0) * (24.0 / 84.0), J=0.30, q_pos=0.20, q_vel=5.0, kalman_q_pos=0.12, kalman_q_vel=2.0, kalman_q_voltage=4.0, kalman_r_position=0.05) kWristBall = copy.copy(kWrist) kWristBall.J = 0.4007 kWristBall.q_pos = 0.55 kWristBall.q_vel = 5.0 kWristPanel = copy.copy(kWrist) kWristPanel.J = 0.446 kWristModel = copy.copy(kWrist) kWristModel.J = 0.1348 if __name__ == '__main__': argv = FLAGS(sys.argv) glog.init() sys.exit(main(argv))
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 198, 6738, 257, 418, 13, 22602, 13, 9535, 46057, 1868, 62, 13317, 1330, 4759, 46057, 1868, 37046, 198, 6738, 1216, 66, 24, 4869, 13, 13716, 62, 5439, 2840, 13, 29412, 1330, 1630, 62, 26268, ...
2.19084
524
from torch.nn.modules import loss import torch import numpy as np def AE_loss(mu, labels, ignore_zero): if ignore_zero: indexes = (labels != 0) else: indexes = (labels >= 0) ae = torch.abs(labels[indexes] - mu[indexes]) return ae
[ 6738, 28034, 13, 20471, 13, 18170, 1330, 2994, 198, 11748, 28034, 198, 11748, 299, 32152, 355, 45941, 628, 198, 4299, 25603, 62, 22462, 7, 30300, 11, 14722, 11, 8856, 62, 22570, 2599, 198, 220, 220, 220, 611, 8856, 62, 22570, 25, 198,...
2.409091
110
import pytest from pandas.errors import NullFrequencyError import pandas as pd from pandas import TimedeltaIndex import pandas._testing as tm
[ 11748, 12972, 9288, 198, 198, 6738, 19798, 292, 13, 48277, 1330, 35886, 37, 28707, 12331, 198, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 19798, 292, 1330, 5045, 276, 12514, 15732, 198, 11748, 19798, 292, 13557, 33407, 355, 256, 7...
3.452381
42
# use selenium to scrape headlines from corriere.it # pip install selenium from re import L from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By import pandas as pd import time import sys HOME = "https://corriere.it" # open Firefox driver = webdriver.Firefox() # navigate to corriere.it driver.get(HOME) # In order to extract the information that youre looking to scrape, # you need to locate the elements XPath. # An XPath is a syntax used for finding any element on a webpage. # We can see the headline #<a class="has-text-black" href="https://www.corriere.it/sport/calcio/coppa-italia/22_aprile_19/inter-milan-formazioni-news-risultato-f607f438-bfef-11ec-9f78-c9d279c21b38.shtml">Inter-Milan, doppio Lautaro e Gosens, nerazzurri in finale di Coppa Italia </a> # --> [@class=name] # all great but we need to sort out this coxokie pop-up #driver.find_element_by_xpath("//*[@id='_cpmt-accept']").click() #WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, '_cpmt-accept'))).click() #WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div#_cpmt-buttons button#_cpmt-accept"))).click() time.sleep(5) # carefully look at the env, we have an iframe here cookie_iframe = driver.find_element_by_xpath("//iframe[@id='_cpmt-iframe']") driver.switch_to.frame(cookie_iframe) print(cookie_iframe) #driver.switch_to.frame(driver.find_element(By.XPATH("//iframe[@id='_cpmt-iframe']"))) button = driver.find_element_by_id("_cpmt-accept").click() # back to the main class driver.get(HOME) # elements --> find_all headlines = driver.find_elements_by_xpath('//h4[@class="title-art-hp is-medium is-line-h-106"]') # here we get all the headlines from the corriere # we can get the text for headline in headlines: print(headline.text)
[ 2, 779, 384, 11925, 1505, 284, 42778, 14408, 422, 1162, 380, 567, 13, 270, 220, 198, 2, 7347, 2721, 384, 11925, 1505, 198, 6738, 302, 1330, 406, 198, 6738, 384, 11925, 1505, 1330, 3992, 26230, 198, 6738, 384, 11925, 1505, 13, 12384, ...
2.782486
708
import os from subprocess import check_output, CalledProcessError from nose import tools as nt from stolos import queue_backend as qb from stolos.testing_tools import ( with_setup, validate_zero_queued_task, validate_one_queued_task, validate_n_queued_task )
[ 11748, 28686, 198, 6738, 850, 14681, 1330, 2198, 62, 22915, 11, 34099, 18709, 12331, 198, 6738, 9686, 1330, 4899, 355, 299, 83, 198, 6738, 336, 349, 418, 1330, 16834, 62, 1891, 437, 355, 10662, 65, 198, 198, 6738, 336, 349, 418, 13, ...
3.022222
90
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import mock from senlin.common import consts from senlin.engine.actions import base as ab from senlin.engine.actions import cluster_action as ca from senlin.engine import cluster as cm from senlin.engine import dispatcher from senlin.engine import node as nm from senlin.objects import action as ao from senlin.objects import cluster as co from senlin.objects import dependency as dobj from senlin.tests.unit.common import base from senlin.tests.unit.common import utils
[ 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,...
3.799257
269
# -*- coding: utf-8 -*- # Copyright (c) 2018-2021, earthobservations developers. # Distributed under the MIT License. See LICENSE for more info. import pytest from wetterdienst import Wetterdienst
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 357, 66, 8, 2864, 12, 1238, 2481, 11, 4534, 672, 3168, 602, 6505, 13, 198, 2, 4307, 6169, 739, 262, 17168, 13789, 13, 4091, 38559, 24290, 329, 517, 7508, 1...
3.061538
65
#! -*- coding:utf-8 -*- # -pretrain, devsts-b from bert4torch.tokenizers import Tokenizer from bert4torch.models import build_transformer_model, BaseModel from bert4torch.snippets import sequence_padding, Callback, ListDataset import torch.nn as nn import torch import torch.optim as optim from torch.utils.data import DataLoader from sklearn.metrics.pairwise import paired_cosine_distances from scipy.stats import pearsonr, spearmanr import copy import random import numpy as np random.seed(2022) np.random.seed(2002) maxlen = 256 batch_size = 8 config_path = 'F:/Projects/pretrain_ckpt/bert/[google_tf_base]--chinese_L-12_H-768_A-12/bert_config.json' checkpoint_path = 'F:/Projects/pretrain_ckpt/bert/[google_tf_base]--chinese_L-12_H-768_A-12/pytorch_model.bin' dict_path = 'F:/Projects/pretrain_ckpt/bert/[google_tf_base]--chinese_L-12_H-768_A-12/vocab.txt' device = 'cuda' if torch.cuda.is_available() else 'cpu' # tokenizer = Tokenizer(dict_path, do_lower_case=True) # train_data = get_data('F:/Projects/data/corpus/pretrain/film/film.txt') train_dataloader = DataLoader(ListDataset(data=train_data), batch_size=batch_size, shuffle=True, collate_fn=collate_fn) from task_sentence_embedding_sbert_sts_b__CosineSimilarityLoss import valid_dataloader # bert model = Model().to(device) # lossoptimizer model.compile( loss=nn.CrossEntropyLoss(ignore_index=0), optimizer=optim.Adam(model.parameters(), lr=2e-5), # ) # if __name__ == '__main__': evaluator = Evaluator() model.fit(train_dataloader, epochs=20, steps_per_epoch=100, callbacks=[evaluator] ) else: model.load_weights('best_model.pt')
[ 2, 0, 532, 9, 12, 19617, 25, 40477, 12, 23, 532, 9, 12, 198, 2, 532, 5310, 3201, 11, 1614, 6448, 12, 65, 628, 198, 6738, 275, 861, 19, 13165, 354, 13, 30001, 11341, 1330, 29130, 7509, 198, 6738, 275, 861, 19, 13165, 354, 13, 2...
2.427954
694
from pathlib import Path from .anki_exporter import AnkiJsonExporter from ..anki.adapters.anki_deck import AnkiDeck from ..config.config_settings import ConfigSettings from ..utils import constants from ..utils.notifier import AnkiModalNotifier, Notifier from ..utils.disambiguate_uuids import disambiguate_note_model_uuids EXPORT_FAILED_TITLE = "Export failed"
[ 6738, 3108, 8019, 1330, 10644, 198, 198, 6738, 764, 962, 72, 62, 1069, 26634, 1330, 1052, 4106, 41, 1559, 3109, 26634, 198, 6738, 11485, 962, 72, 13, 324, 12126, 13, 962, 72, 62, 35875, 1330, 1052, 4106, 5005, 694, 198, 6738, 11485, ...
3.191304
115
from functools import lru_cache from typing import Optional import requests from .patches import Patches
[ 6738, 1257, 310, 10141, 1330, 300, 622, 62, 23870, 198, 6738, 19720, 1330, 32233, 198, 198, 11748, 7007, 198, 198, 6738, 764, 8071, 2052, 1330, 3208, 2052, 198 ]
3.821429
28
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for LMDBDataset.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import shutil import tempfile import numpy as np import tensorflow as tf if not (hasattr(tf, "version") and tf.version.VERSION.startswith("2.")): tf.compat.v1.enable_eager_execution() import tensorflow_io.lmdb as lmdb_io # pylint: disable=wrong-import-position def test_lmdb_read_from_file(): """test_read_from_file""" # Copy database out because we need the path to be writable to use locks. path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "test_lmdb", "data.mdb") tmp_path = tempfile.mkdtemp() filename = os.path.join(tmp_path, "data.mdb") shutil.copy(path, filename) num_repeats = 2 lmdb_dataset = lmdb_io.LMDBDataset([filename]).repeat(num_repeats) ii = 0 for vv in lmdb_dataset: i = ii % 10 k, v = vv assert k.numpy() == str(i).encode() assert v.numpy() == str(chr(ord("a") + i)).encode() ii += 1 shutil.rmtree(tmp_path) def test_lmdb_read_from_file_with_batch(): """test_read_from_file""" # Copy database out because we need the path to be writable to use locks. path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "test_lmdb", "data.mdb") tmp_path = tempfile.mkdtemp() filename = os.path.join(tmp_path, "data.mdb") shutil.copy(path, filename) lmdb_dataset = lmdb_io.LMDBDataset([filename], batch=3) i = 0 for vv in lmdb_dataset: k, v = vv if i < 9: assert np.alltrue(k.numpy() == [ str(i).encode(), str(i + 1).encode(), str(i + 2).encode()]) assert np.alltrue(v.numpy() == [ str(chr(ord("a") + i)).encode(), str(chr(ord("a") + i + 1)).encode(), str(chr(ord("a") + i + 2)).encode()]) else: assert k.numpy() == str(9).encode() assert v.numpy() == str('j').encode() i += 3 shutil.rmtree(tmp_path) if __name__ == "__main__": test.main()
[ 2, 220, 15069, 13130, 383, 309, 22854, 37535, 46665, 13, 1439, 6923, 33876, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, ...
2.587896
1,041
# @Time : 2020/10/6 # @Author : Shanlei Mu # @Email : slmu@ruc.edu.cn """ recbole.quick_start ######################## """ import logging from logging import getLogger from recbole.config import Config from recbole.data import create_dataset, data_preparation from recbole.utils import init_logger, get_model, get_trainer, init_seed from recbole.utils.utils import set_color def run_recbole(model=None, dataset=None, config_file_list=None, config_dict=None, saved=True): r""" A fast running api, which includes the complete process of training and testing a model on a specified dataset Args: model (str): model name dataset (str): dataset name config_file_list (list): config files used to modify experiment parameters config_dict (dict): parameters dictionary used to modify experiment parameters saved (bool): whether to save the model """ # configurations initialization config = Config(model=model, dataset=dataset, config_file_list=config_file_list, config_dict=config_dict) # init_seed(config['seed'], config['reproducibility']) # logger initialization init_logger(config) logger = getLogger() import os log_dir = os.path.dirname(logger.handlers[0].baseFilename) config['log_dir'] = log_dir logger.info(config) # dataset filtering dataset = create_dataset(config) logger.info(dataset) # dataset splitting train_data, valid_data, test_data = data_preparation(config, dataset) # model loading and initialization model = get_model(config['model'])(config, train_data).to(config['device']) logger.info(model) # trainer loading and initialization trainer = get_trainer(config['MODEL_TYPE'], config['model'])(config, model) # model training best_valid_score, best_valid_result = trainer.fit( train_data, valid_data, saved=saved, show_progress=config['show_progress'] ) import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.decomposition import TruncatedSVD embedding_matrix = model.item_embedding.weight[1:].cpu().detach().numpy() svd = TruncatedSVD(n_components=2) svd.fit(embedding_matrix) comp_tr = np.transpose(svd.components_) proj = np.dot(embedding_matrix, comp_tr) cnt = {} for i in dataset['item_id']: if i.item() in cnt: cnt[i.item()] += 1 else: cnt[i.item()] = 1 freq = np.zeros(embedding_matrix.shape[0]) for i in cnt: freq[i-1] = cnt[i] # freq /= freq.max() sns.set(style='darkgrid') sns.set_context("notebook", font_scale=1.8, rc={"lines.linewidth": 3, 'lines.markersize': 20}) plt.figure(figsize=(6, 4.5)) plt.scatter(proj[:, 0], proj[:, 1], s=1, c=freq, cmap='viridis_r') plt.colorbar() plt.xlim(-2, 2) plt.ylim(-2, 2) # plt.axis('square') # plt.show() plt.savefig(log_dir + '/' + config['model'] + '-' + config['dataset'] + '.pdf', format='pdf', transparent=False, bbox_inches='tight') from scipy.linalg import svdvals svs = svdvals(embedding_matrix) svs /= svs.max() np.save(log_dir + '/sv.npy', svs) sns.set(style='darkgrid') sns.set_context("notebook", font_scale=1.8, rc={"lines.linewidth": 3, 'lines.markersize': 20}) plt.figure(figsize=(6, 4.5)) plt.plot(svs) # plt.show() plt.savefig(log_dir + '/svs.pdf', format='pdf', transparent=False, bbox_inches='tight') # model evaluation test_result = trainer.evaluate(test_data, load_best_model=saved, show_progress=config['show_progress']) logger.info(set_color('best valid ', 'yellow') + f': {best_valid_result}') logger.info(set_color('test result', 'yellow') + f': {test_result}') return { 'best_valid_score': best_valid_score, 'valid_score_bigger': config['valid_metric_bigger'], 'best_valid_result': best_valid_result, 'test_result': test_result } def objective_function(config_dict=None, config_file_list=None, saved=True): r""" The default objective_function used in HyperTuning Args: config_dict (dict): parameters dictionary used to modify experiment parameters config_file_list (list): config files used to modify experiment parameters saved (bool): whether to save the model """ config = Config(config_dict=config_dict, config_file_list=config_file_list) init_seed(config['seed'], config['reproducibility']) logging.basicConfig(level=logging.ERROR) dataset = create_dataset(config) train_data, valid_data, test_data = data_preparation(config, dataset) model = get_model(config['model'])(config, train_data).to(config['device']) trainer = get_trainer(config['MODEL_TYPE'], config['model'])(config, model) best_valid_score, best_valid_result = trainer.fit(train_data, valid_data, verbose=False, saved=saved) test_result = trainer.evaluate(test_data, load_best_model=saved) return { 'best_valid_score': best_valid_score, 'valid_score_bigger': config['valid_metric_bigger'], 'best_valid_result': best_valid_result, 'test_result': test_result }
[ 2, 2488, 7575, 220, 220, 1058, 12131, 14, 940, 14, 21, 198, 2, 2488, 13838, 1058, 14866, 293, 72, 8252, 198, 2, 2488, 15333, 220, 1058, 1017, 30300, 31, 622, 66, 13, 15532, 13, 31522, 198, 198, 37811, 198, 8344, 45693, 13, 24209, ...
2.548166
2,045
# Copyright (c) The InferLO authors. All rights reserved. # Licensed under the Apache License, Version 2.0 - see LICENSE. import warnings import numpy as np from sklearn.utils.extmath import randomized_svd from .bucket_elimination import BucketElimination from .factor import Factor, default_factor_name, product_over_ from .graphical_model import GraphicalModel from .mini_bucket_elimination import MiniBucketElimination
[ 2, 15069, 357, 66, 8, 383, 554, 2232, 21982, 7035, 13, 1439, 2489, 10395, 13, 201, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 532, 766, 38559, 24290, 13, 201, 198, 11748, 14601, 201, 198, 201, 198, 11748, 299, ...
3.335878
131
import os import urllib from google.appengine.api import users from google.appengine.ext import ndb import jinja2 import webapp2 from sys import argv import datetime import pickle import sys sys.path.insert(0, 'libs') import BeautifulSoup from bs4 import BeautifulSoup import requests import json JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape', 'jinja2.ext.loopcontrols'], autoescape=True) url = 'http://www.njtransit.com/sf/sf_servlet.srv?hdnPageAction=TrainSchedulesFrom' pu_code = "124_PRIN" ny_code = "105_BNTN" prs = "Princeton" nyp = "New York Penn Station" # get date today = datetime.date.today() str_date = today.__format__("%m/%d/%Y") # trip info toNY_dict = {'selOrigin': pu_code, 'selDestination': ny_code, 'datepicker': str_date, 'OriginDescription': prs, 'DestDescription': nyp} toPU_dict = {'selOrigin': ny_code, 'selDestination': pu_code, 'datepicker': str_date, 'OriginDescription': nyp, 'DestDescription': prs} # get to webpage with data for the day with requests.Session() as re: toNY = re.post(url, data=toNY_dict) toPU = re.post(url, data=toPU_dict) toPUhtml = toPU.text toNYhtml = toNY.text #Reads in html file and name of destination and outputs csv file with comma spliced file of train information #Create csv files for to Princeton and to New York toPUDict = scrape(toPUhtml, 'PU') toNYDict = scrape(toNYhtml, 'NY') globalPUDict = {} application = webapp2.WSGIApplication([ ('/', MainPage), ('/toNY', ToNY), ('/toPU', ToPU), ('/test', Test123), ], debug=True)
[ 11748, 28686, 198, 11748, 2956, 297, 571, 198, 198, 6738, 23645, 13, 1324, 18392, 13, 15042, 1330, 2985, 198, 6738, 23645, 13, 1324, 18392, 13, 2302, 1330, 299, 9945, 198, 198, 11748, 474, 259, 6592, 17, 198, 11748, 3992, 1324, 17, 19...
2.643436
617
import json from django.utils.encoding import force_text from germanium.tools import assert_true, assert_not_equal from germanium.test_cases.client import ClientTestCase from germanium.decorators import login from germanium.crawler import Crawler, LinkExtractor, HtmlLinkExtractor as OriginalHtmlLinkExtractor
[ 11748, 33918, 198, 198, 6738, 42625, 14208, 13, 26791, 13, 12685, 7656, 1330, 2700, 62, 5239, 198, 198, 6738, 308, 2224, 1505, 13, 31391, 1330, 6818, 62, 7942, 11, 6818, 62, 1662, 62, 40496, 198, 6738, 308, 2224, 1505, 13, 9288, 62, ...
3.483516
91
from django.contrib import admin from geometry.models import Shape
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 22939, 13, 27530, 1330, 25959, 628 ]
4.25
16
# -*- coding: utf-8 -*- # @Author : Ecohnoch(xcy) # @File : demo2_consume.py # @Function : TODO import kafka demo2_config = { 'kafka_host': 'localhost:9092', 'kafka_topic': 'demo2', 'kafka_group_id': 'demo2_group1' } if __name__ == '__main__': consume()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2488, 13838, 220, 220, 1058, 38719, 71, 3919, 354, 7, 87, 948, 8, 198, 2, 2488, 8979, 220, 220, 220, 220, 1058, 13605, 17, 62, 5936, 2454, 13, 9078, 198, 2, 248...
1.978873
142
import json import pandas as pd from .application_scaling_model import ApplicationScalingModel from .platform_scaling_model import PlatformScalingModel from autoscalingsim.deltarepr.group_of_services_delta import GroupOfServicesDelta from autoscalingsim.deltarepr.node_group_delta import NodeGroupDelta from autoscalingsim.utils.error_check import ErrorChecker
[ 11748, 33918, 198, 11748, 19798, 292, 355, 279, 67, 198, 198, 6738, 764, 31438, 62, 1416, 4272, 62, 19849, 1330, 15678, 3351, 4272, 17633, 198, 6738, 764, 24254, 62, 1416, 4272, 62, 19849, 1330, 19193, 3351, 4272, 17633, 198, 198, 6738,...
3.5
104
############################################################################## # # Copyright (c) 2009 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """ $Id$ """ from zope import component, interface from zc.copy.interfaces import ICopyHook from data import File, Image from interfaces import IFile, IImage
[ 29113, 29113, 7804, 4242, 2235, 198, 2, 198, 2, 15069, 357, 66, 8, 3717, 1168, 3008, 5693, 290, 25767, 669, 13, 198, 2, 1439, 6923, 33876, 13, 198, 2, 198, 2, 770, 3788, 318, 2426, 284, 262, 8617, 286, 262, 1168, 3008, 5094, 13789...
3.99
200
import sys verbose = False
[ 11748, 25064, 198, 198, 19011, 577, 796, 10352, 628, 628 ]
3.1
10
import grpc from google.protobuf import empty_pb2 from django_grpc_framework.services import Service from component_b.common.serializers import PersonProtoSerializer from component_b.common.models import PersonModel
[ 11748, 1036, 14751, 198, 6738, 23645, 13, 11235, 672, 3046, 1330, 6565, 62, 40842, 17, 198, 6738, 42625, 14208, 62, 2164, 14751, 62, 30604, 13, 30416, 1330, 4809, 198, 198, 6738, 7515, 62, 65, 13, 11321, 13, 46911, 11341, 1330, 7755, ...
3.758621
58
__author__ = 'kq4hy' import csv import sqlite3 load_course_database('course1.db', 'seas-courses-5years.csv')
[ 834, 9800, 834, 796, 705, 74, 80, 19, 12114, 6, 198, 198, 11748, 269, 21370, 198, 11748, 44161, 578, 18, 628, 198, 2220, 62, 17319, 62, 48806, 10786, 17319, 16, 13, 9945, 3256, 705, 325, 292, 12, 66, 39975, 12, 20, 19002, 13, 4066...
2.466667
45
from .enum_field import EnumField, RegisteredEnum # noqa from .marsh_schema import attr_with_schema, derive # noqa
[ 6738, 764, 44709, 62, 3245, 1330, 2039, 388, 15878, 11, 27049, 4834, 388, 220, 1303, 645, 20402, 198, 6738, 764, 76, 5406, 62, 15952, 2611, 1330, 708, 81, 62, 4480, 62, 15952, 2611, 11, 27099, 220, 1303, 645, 20402, 198 ]
2.925
40
''' IoT Mini Project Weather Station using DHT Sensor and Raspberry Pi with ThingSpeak Platform Code Sample: Interfacing DHT22 with Raspberry Pi and sending the data to an IoT Platform (ThingSpeak Platform) ''' from time import sleep # import Adafruit_DHT # Not supported library import adafruit_dht from board import * import requests # After creating your account on ThingSpeak platform, put your channel id below channel_id = 12345 write_key = 'WriteYourKeyAsString.......' # Put your write key here # D4 = GPIO4 / D17 = GPIO17 ...etc. SENSOR_PIN = D17 params = {'key': write_key, 'field1': temp, 'field2': humidity} res = requests.get(url, params=params) if __name__ == "__main__": while True: # 15 seconds is the minimum time for the free account on ThingSpeak sleep(15) try: temperature, humidity = get_measurements() except: print("Error: Can't get the sensor values, check out your wiring connection.") try: sendData(temperature, humidity) except: print("Error: Can't push the sensor values to ThingSpeak server.")
[ 7061, 6, 198, 40, 78, 51, 12558, 4935, 198, 41865, 9327, 1262, 360, 6535, 35367, 290, 24244, 13993, 351, 21561, 5248, 461, 19193, 198, 10669, 27565, 25, 4225, 29532, 360, 6535, 1828, 351, 24244, 13993, 290, 7216, 262, 1366, 284, 281, ...
2.845771
402
#!/usr/bin/python # -*- coding: utf-8 -*- import time from page_objects import PageObject, PageElement from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.by import By delay_min = 3 # sec delay_medium = 5 # sec delay_max = 9 # sec
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 640, 198, 6738, 2443, 62, 48205, 1330, 7873, 10267, 11, 7873, 20180, 198, 6738, 384, 11925, 1505, 13, 12384, 26230...
3.107438
121
config = dict( module="HOTrialWavefunction.py" )
[ 198, 11250, 796, 8633, 7, 198, 220, 220, 220, 8265, 2625, 39, 2394, 4454, 39709, 8818, 13, 9078, 1, 198, 8 ]
2.52381
21
#!/usr/bin/python2 import sys import os import redis import time import datetime string_keys = [] hash_keys = [] list_keys = [] set_keys = [] zset_keys = [] if __name__ == '__main__': config = { "source": ['10.4.1.91:0', '10.4.13.124:0', '10.4.12.16:0', '10.4.2.250:0'], "dest": ['127.0.0.1:11', '127.0.0.1:12', '127.0.0.1:2', '127.0.0.1:1'] } start = datetime.datetime.now() for group in zip(config["source"], config["dest"]): print group SrcIP = group[0].split(':')[0] SrcPort = 6379 DstIP = group[1].split(':')[0] DstPort = 6379 DstDB = group[1].split(':')[1] source = redis.Redis(host=SrcIP, port=SrcPort) dest = redis.Redis(host=DstIP, port=DstPort, db=DstDB) print "Begin Read Keys" read_type_keys(source) print "String Key Count is:", len(string_keys) print "Set Key Count is:", len(set_keys) print "ZSet Key Count is:", len(zset_keys) print "List Key Count is:", len(list_keys) print "Hash Key Count is:", len(hash_keys) import_string(source, dest) import_hash(source, dest) import_list(source, dest) import_set(source, dest) import_zset(source, dest) stop = datetime.datetime.now() diff = stop - start print "Finish, token time:", str(diff)
[ 2, 48443, 14629, 14, 8800, 14, 29412, 17, 198, 11748, 25064, 198, 11748, 28686, 198, 11748, 2266, 271, 198, 11748, 640, 198, 11748, 4818, 8079, 198, 198, 8841, 62, 13083, 796, 17635, 198, 17831, 62, 13083, 796, 17635, 198, 4868, 62, 1...
2.078907
659
import torch import torch.nn as nn import numpy as np from enum import Enum from typing import List, Callable, Any from tqdm import tqdm from .model import Model from .dataset import Dataset from .experiment import Experiment from .callback import Callback
[ 11748, 28034, 198, 11748, 28034, 13, 20471, 355, 299, 77, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 33829, 1330, 2039, 388, 198, 6738, 19720, 1330, 7343, 11, 4889, 540, 11, 4377, 198, 6738, 256, 80, 36020, 1330, 256, 80, 360...
3.513514
74
import unittest from pystac.utils import (make_relative_href, make_absolute_href, is_absolute_href)
[ 11748, 555, 715, 395, 198, 198, 6738, 12972, 301, 330, 13, 26791, 1330, 357, 15883, 62, 43762, 62, 33257, 11, 787, 62, 48546, 62, 33257, 11, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,...
2.169492
59
# Copyright (c) 2020 Michael Herman # Copyright (c) 2020 Vid Podpean # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights to use, copy, modify, merge, # publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons # to whom the Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all copies or # substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. from flask.cli import FlaskGroup from flask_cors import CORS from project import flask_app CORS(flask_app) cli = FlaskGroup(flask_app) if __name__ == "__main__": cli() #flask_app.run(debug=True)
[ 2, 15069, 357, 66, 8, 12131, 3899, 25028, 198, 2, 15069, 357, 66, 8, 12131, 38965, 17437, 431, 272, 198, 2, 2448, 3411, 318, 29376, 7520, 11, 1479, 286, 3877, 11, 284, 597, 1048, 16727, 257, 4866, 286, 428, 198, 2, 3788, 290, 3917...
3.649171
362
from PyQt5.QtWidgets import QDialog, QPushButton, QVBoxLayout, QComboBox, QGroupBox, QCheckBox, QGridLayout, QMessageBox, QRadioButton from GUI.CustomWidgets.PathFileLineEdit import PathFileLineEdit from GUI.CustomWidgets.InputField import InputField
[ 6738, 9485, 48, 83, 20, 13, 48, 83, 54, 312, 11407, 1330, 1195, 44204, 11, 1195, 49222, 21864, 11, 1195, 53, 14253, 32517, 11, 1195, 5377, 2127, 14253, 11, 1195, 13247, 14253, 11, 1195, 9787, 14253, 11, 1195, 41339, 32517, 11, 1195, ...
3.111111
81
from __future__ import absolute_import import copy import re from typing import (Any, Callable, Dict, List, MutableMapping, MutableSequence, Optional, Tuple, Union) from functools import partial from ruamel.yaml.comments import CommentedMap, CommentedSeq from schema_salad import validate from schema_salad.ref_resolver import Loader # pylint: disable=unused-import from six import string_types from six.moves import urllib from typing_extensions import Text from schema_salad.sourceline import SourceLine from .loghandler import _logger # move to a regular typing import when Python 3.3-3.6 is no longer supported from .utils import visit_class, visit_field, aslist def v1_0to1_1(doc, loader, baseuri): # pylint: disable=unused-argument # type: (Any, Loader, Text) -> Tuple[Any, Text] """Public updater for v1.0 to v1.1.""" doc = copy.deepcopy(doc) rewrite = { "http://commonwl.org/cwltool#WorkReuse": "WorkReuse", "http://arvados.org/cwl#ReuseRequirement": "WorkReuse", "http://commonwl.org/cwltool#TimeLimit": "ToolTimeLimit", "http://commonwl.org/cwltool#NetworkAccess": "NetworkAccess", "http://commonwl.org/cwltool#InplaceUpdateRequirement": "InplaceUpdateRequirement", "http://commonwl.org/cwltool#LoadListingRequirement": "LoadListingRequirement" } visit_class(doc, ("CommandLineTool","Workflow"), rewrite_requirements) visit_class(doc, ("ExpressionTool","Workflow"), fix_inputBinding) visit_field(doc, "secondaryFiles", partial(update_secondaryFiles, top=True)) upd = doc if isinstance(upd, MutableMapping) and "$graph" in upd: upd = upd["$graph"] for proc in aslist(upd): proc.setdefault("hints", CommentedSeq()) proc["hints"].insert(0, CommentedMap([("class", "NetworkAccess"),( "networkAccess", True)])) proc["hints"].insert(0, CommentedMap([("class", "LoadListingRequirement"),("loadListing", "deep_listing")])) if "cwlVersion" in proc: del proc["cwlVersion"] return (doc, "v1.1") UPDATES = { u"v1.0": v1_0to1_1, u"v1.1": None } # type: Dict[Text, Optional[Callable[[Any, Loader, Text], Tuple[Any, Text]]]] DEVUPDATES = { u"v1.0": v1_0to1_1, u"v1.1.0-dev1": v1_1_0dev1to1_1, u"v1.1": None } # type: Dict[Text, Optional[Callable[[Any, Loader, Text], Tuple[Any, Text]]]] ALLUPDATES = UPDATES.copy() ALLUPDATES.update(DEVUPDATES) INTERNAL_VERSION = u"v1.1" def identity(doc, loader, baseuri): # pylint: disable=unused-argument # type: (Any, Loader, Text) -> Tuple[Any, Union[Text, Text]] """Default, do-nothing, CWL document upgrade function.""" return (doc, doc["cwlVersion"]) def checkversion(doc, # type: Union[CommentedSeq, CommentedMap] metadata, # type: CommentedMap enable_dev # type: bool ): # type: (...) -> Tuple[CommentedMap, Text] """Check the validity of the version of the give CWL document. Returns the document and the validated version string. """ cdoc = None # type: Optional[CommentedMap] if isinstance(doc, CommentedSeq): if not isinstance(metadata, CommentedMap): raise Exception("Expected metadata to be CommentedMap") lc = metadata.lc metadata = copy.deepcopy(metadata) metadata.lc.data = copy.copy(lc.data) metadata.lc.filename = lc.filename metadata[u"$graph"] = doc cdoc = metadata elif isinstance(doc, CommentedMap): cdoc = doc else: raise Exception("Expected CommentedMap or CommentedSeq") version = metadata[u"cwlVersion"] cdoc["cwlVersion"] = version if version not in UPDATES: if version in DEVUPDATES: if enable_dev: pass else: keys = list(UPDATES.keys()) keys.sort() raise validate.ValidationException( u"Version '%s' is a development or deprecated version.\n " "Update your document to a stable version (%s) or use " "--enable-dev to enable support for development and " "deprecated versions." % (version, ", ".join(keys))) else: raise validate.ValidationException( u"Unrecognized version %s" % version) return (cdoc, version)
[ 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 198, 11748, 4866, 198, 11748, 302, 198, 6738, 19720, 1330, 357, 7149, 11, 4889, 540, 11, 360, 713, 11, 7343, 11, 13859, 540, 44, 5912, 11, 13859, 540, 44015, 594, 11, 198, 220, 22...
2.403614
1,826
import matplotlib.pyplot as plt from matplotlib import collections from matplotlib.lines import Line2D if __name__ == "__main__": import numpy as np from plottify import autosize import matplotlib.pyplot as plt n = 100 x = np.random.uniform(low=-5, high=5, size=n) y = x + np.random.normal(scale=0.5, size=n) for size in [3, 10, 20]: plt.figure(figsize=(size, size)) plt.scatter(x, y) plt.xlabel("X") plt.ylabel("Y") plt.title("Default") plt.show() plt.figure(figsize=(size, size)) plt.scatter(x, y) plt.xlabel("X") plt.ylabel("Y") plt.title("Autosized") autosize() plt.show()
[ 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 2603, 29487, 8019, 1330, 17268, 198, 6738, 2603, 29487, 8019, 13, 6615, 1330, 6910, 17, 35, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 22...
2.019774
354
from re import S from manimlib import * import sys import os from tqdm.std import tqdm sys.path.append(os.getcwd()) from utils.imports import *
[ 6738, 302, 1330, 311, 198, 6738, 582, 320, 8019, 1330, 1635, 198, 198, 11748, 25064, 198, 11748, 28686, 198, 198, 6738, 256, 80, 36020, 13, 19282, 1330, 256, 80, 36020, 198, 198, 17597, 13, 6978, 13, 33295, 7, 418, 13, 1136, 66, 169...
2.709091
55
# POKEMING - GON'NA CATCH 'EM ALL # -- A simple hack 'n slash game in console # -- This class is handles all utility related things
[ 2, 350, 11380, 3620, 2751, 532, 402, 1340, 6, 4535, 327, 11417, 705, 3620, 11096, 201, 198, 2, 1377, 317, 2829, 8156, 705, 77, 24632, 983, 287, 8624, 201, 198, 2, 1377, 770, 1398, 318, 17105, 477, 10361, 3519, 1243, 201 ]
3.268293
41
import logging import sys from typing import Union, Optional, Dict, Any, List from dataclasses import dataclass, replace from exp.ours import file_paths from exp.ours.boosting import MaskSpec from exp.ours.data.dataset import Dataset, Task from exp.ours.data.gpv_example import GPVExample from exp.ours.models.model import PredictionArg from os.path import join, exists from exp.ours.util.py_utils import int_to_str from utils.io import load_json_object, dump_json_object import numpy as np ID_LIST = set([0]) LAST_ID = 0 def _intern(x): if x is None: return None return sys.intern(x) def load_mil(split): #file = join(file_paths.WEBQA_DIR, split + "_image_info.json") #file = file_paths.IMAGECONTRAST_DIR+'/train_large_2.json' #file = '/data/michal5/gpv/text_contrast/train_large.json' if split == 'small': file = '/data/michal5/gpv/lessons/mil_small.json' else: file = '/data/michal5/gpv/lessons/mil_train.json' #file = '/data/michal5/gpv/lessons/mil_small.json' logging.info(f"Loading mil data from {file}") raw_instances = load_json_object(file) out = [] for i, x in enumerate(raw_instances): if isinstance(x["image"], dict): image_id = x["image"]["image_id"] else: image_id = x["image"] ex = MILExample(gpv_id=x['gpv_id'],image_id=image_id,answer=x['answer'], query=x['query'],correct_answer=x['correct'],rel_query=x['rel_query'] ) out.append(ex) return out
[ 11748, 18931, 198, 11748, 25064, 198, 6738, 19720, 1330, 4479, 11, 32233, 11, 360, 713, 11, 4377, 11, 7343, 198, 198, 6738, 4818, 330, 28958, 1330, 4818, 330, 31172, 11, 6330, 198, 198, 6738, 1033, 13, 4662, 1330, 2393, 62, 6978, 82, ...
2.499145
585
import django_filters from ...models import FN024 from .filter_utils import NumberInFilter, ValueInFilter
[ 11748, 42625, 14208, 62, 10379, 1010, 198, 198, 6738, 2644, 27530, 1330, 44260, 40839, 198, 6738, 764, 24455, 62, 26791, 1330, 7913, 818, 22417, 11, 11052, 818, 22417, 628, 198 ]
3.633333
30
import numpy as np from time import time import matplotlib.pyplot as plt measure2index={"y-coordinate":0,"x-coordinate":1,"timestamp":2, "button_status":3,"tilt":4, "elevation":5,"pressure":6} index2measure=list(measure2index.keys()) task2index={"spiral":0,"l":1,"le":2 ,"les":3,"lektorka" :4,"porovnat":5,"nepopadnout":6, "tram":7} index2task=list(task2index.keys()) max_lengths=[16071, 4226, 6615, 6827, 7993, 5783, 4423, 7676]#max length per task token_lengths=[16071,1242,1649,1956]#max length per token stroke_lengths=[16071,752,1104,1476,3568,2057,2267,1231]#max length per stroke (either on paper or in air) stroke_avg_plus_std=[2904,277,363,411,484,346,324,218]#stroke avg length + stroke avg length std max_strokes=[25,15,15,21,29,43,35, 67]#max n of strokes per task (in air + on paper) plot2index={"loss":0,"accuracy":1} index2plot= list(plot2index.keys()) on_paper_value=1.0#on_paper_stroke iff button_status==1.0 one_hot=np.identity(8) def get_significance(p): """used to print significance of a statistic test given p-value)""" if p<0.01: significance="***" elif p<0.05: significance="**" elif p<0.1: significance="*" else: significance="_" return significance def CorrectPool(out_size,current_pool): """makes convolved size divisible by pooling kernel""" ratio=out_size/current_pool if (ratio)%1==0:#whole number return int(current_pool) else: whole_ratio=round(ratio) if whole_ratio==0: whole_ratio+=1 return int(out_size/whole_ratio) def CorrectHyperparameters(input_size,seq_len,hidden_size,conv_kernel,pool_kernel ,padding=0, stride=1,dilation=1, dropout=0.0,output_size=1,n_seq=1): """makes convolved size divisible by pooling kernel and computes size of sequence after convolutions""" out_size=seq_len print("seq_len :",out_size) for i, (h,c,p,pad,d) in enumerate(list(zip(hidden_size,conv_kernel,pool_kernel,padding,dilation))): print("layer",i+1) in_size=out_size out_size=get_out_size(out_size,pad,d,c,stride=1) print("\tafter conv{} :{}".format(i+1,out_size)) if out_size<1: c=(in_size-1)//d+1 out_size=get_out_size(in_size,pad,d,c,stride=1) print("\t\tupdate c. after conv{} :{}".format(i+1,out_size)) conv_kernel[i]=c pool_kernel[i]=CorrectPool(out_size,p) out_size=get_out_size(out_size,padding=0,dilation=1,kernel_size=pool_kernel[i],stride=pool_kernel[i]) print("\tafter pool{} :{}".format(i+1,out_size)) out_size*=hidden_size[-1] print("after flatting",out_size) return input_size,out_size,hidden_size,conv_kernel,pool_kernel ,padding,stride,dilation, dropout,output_size def get_out_size(in_size,padding,dilation,kernel_size,stride): """computes output size after a conv or a pool layer""" return (in_size+2*padding-dilation*(kernel_size-1)-1)//stride +1 def count_params(model): """returns (total n of parameters, n of trainable parameters)""" total_params = sum(p.numel() for p in model.parameters()) trainable_params = sum(p.numel() for p in model.parameters() if p.requires_grad) return total_params, trainable_params def ReshapeAndVote(model_train_predictions,round_before_voting=True): """used to fuse the predictions of n_models models after n_CV CV""" n_CV=len(model_train_predictions[0]) n_models=len(model_train_predictions) if round_before_voting: reshaped_train_predictions=[[np.around(model_train_predictions[i][j]) for i in range(n_models)] for j in range(n_CV)] else: reshaped_train_predictions=[[model_train_predictions[i][j] for i in range(n_models)] for j in range(n_CV)] voted_train_predictions=[np.around(np.mean(reshaped_train_predictions[i],axis=0)) for i in range(n_CV)] return voted_train_predictions
[ 11748, 299, 32152, 355, 45941, 198, 6738, 640, 1330, 640, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 198, 1326, 5015, 17, 9630, 28, 4895, 88, 12, 37652, 4559, 1298, 15, 553, 87, 12, 37652, 4559, 1298, 16, 553...
2.354858
1,657
import datetime datenasc = int(input(f'insert you date of bit ')) atualdate = str(datetime.date.today())[0:4] datestr = int(atualdate) datefinal = datestr - datenasc print(datefinal) if datefinal < 18: print(f'voce esta com {datefinal}Faltam {18-datefinal} pra voc se alistar ao exercito hahahah' ) elif datefinal == 18: print(f'Voc completa 18 anos agora em {atualdate}' f'Chegou a hora ser servir seu pas como bucha de canho otario.\nPegue seus documentos ') else: print(f'Voc escapou sabicho, ja esta com {datefinal}, se livrou n safadenho')
[ 11748, 4818, 8079, 198, 19608, 268, 3372, 796, 493, 7, 15414, 7, 69, 6, 28463, 345, 3128, 286, 1643, 705, 4008, 198, 265, 723, 4475, 796, 965, 7, 19608, 8079, 13, 4475, 13, 40838, 28955, 58, 15, 25, 19, 60, 198, 19608, 395, 81, ...
2.486842
228
__author__ = 'rob' import unittest import logging import evernotebookparser from xml.etree import ElementTree import re
[ 834, 9800, 834, 796, 705, 22609, 6, 198, 11748, 555, 715, 395, 198, 11748, 18931, 198, 11748, 304, 933, 1258, 2070, 48610, 198, 6738, 35555, 13, 316, 631, 1330, 11703, 27660, 198, 11748, 302, 628, 628, 220, 220, 220, 220, 220, 628, ...
2.955556
45
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Unit tests for the `create_cc_sysroot.py` script.""" import getpass from pathlib import Path from typing import Tuple from cross_compile.sysroot_compiler import DockerConfig from cross_compile.sysroot_compiler import Platform from cross_compile.sysroot_compiler import QEMU_DIR_NAME from cross_compile.sysroot_compiler import ROS_DOCKERFILE_NAME from cross_compile.sysroot_compiler import SYSROOT_DIR_NAME from cross_compile.sysroot_compiler import SysrootCompiler import pytest def setup_mock_sysroot(path: Path) -> Tuple[Path, Path]: """Create mock directories to correctly construct the SysrootCreator.""" sysroot_dir = path / SYSROOT_DIR_NAME sysroot_dir.mkdir() ros_workspace_dir = sysroot_dir / 'ros_ws' ros_workspace_dir.mkdir() qemu_dir = sysroot_dir / QEMU_DIR_NAME qemu_dir.mkdir() qemu_binary_mock = qemu_dir / 'qemu' qemu_binary_mock.ensure() docker_ws_dir = sysroot_dir / ROS_DOCKERFILE_NAME docker_ws_dir.ensure() return sysroot_dir, ros_workspace_dir def test_get_workspace_image_tag(platform_config): """Make sure the image tag is created correctly.""" image_tag = platform_config.get_workspace_image_tag() test_tag = '{}/{}:latest'.format(getpass.getuser(), str(platform_config)) assert isinstance(image_tag, str) assert image_tag == test_tag def test_docker_config_args(docker_config): """Make sure the Docker configuration is setup correctly.""" args = _default_docker_kwargs() test_config_string = ( 'Base Image: {}\n' 'Network Mode: {}\n' 'Caching: {}' ).format( args['sysroot_base_image'], args['docker_network_mode'], args['sysroot_nocache'] ) config_string = str(docker_config) assert isinstance(config_string, str) assert config_string == test_config_string def test_sysroot_compiler_constructor( platform_config, docker_config, tmpdir): """Test the SysrootCompiler constructor assuming valid path setup.""" # Create mock directories and files sysroot_dir, ros_workspace_dir = setup_mock_sysroot(tmpdir) sysroot_compiler = SysrootCompiler( str(tmpdir), 'ros_ws', platform_config, docker_config, None) assert isinstance(sysroot_compiler.get_build_setup_script_path(), Path) assert isinstance(sysroot_compiler.get_system_setup_script_path(), Path) def test_sysroot_compiler_tree_validation(platform_config, docker_config, tmpdir): """ Ensure that the SysrootCompiler constructor validates the workspace. Start with empty directory and add one piece at a time, expecting failures until all parts are present. """ kwargs = { 'cc_root_dir': str(tmpdir), 'ros_workspace_dir': 'ros_ws', 'platform': platform_config, 'docker_config': docker_config, 'custom_setup_script_path': None, } # There's no 'sysroot' at all yet with pytest.raises(FileNotFoundError): compiler = SysrootCompiler(**kwargs) sysroot_dir = tmpdir / SYSROOT_DIR_NAME sysroot_dir.mkdir() # ROS2 ws and qemu dirs are missing with pytest.raises(FileNotFoundError): compiler = SysrootCompiler(**kwargs) ros_workspace_dir = sysroot_dir / 'ros_ws' ros_workspace_dir.mkdir() # qemu dirs are missing with pytest.raises(FileNotFoundError): compiler = SysrootCompiler(**kwargs) qemu_dir = sysroot_dir / QEMU_DIR_NAME qemu_dir.mkdir() # the qemu binary is still missing with pytest.raises(FileNotFoundError): compiler = SysrootCompiler(**kwargs) qemu_binary_mock = qemu_dir / 'qemu' qemu_binary_mock.ensure() # everything is present now compiler = SysrootCompiler(**kwargs) assert compiler def verify_base_docker_images(arch, os, rosdistro, image_name): """Assert correct base image is generated.""" sysroot_base_image = None docker_network_mode = 'host' sysroot_nocache = 'False' assert DockerConfig( arch, os, rosdistro, sysroot_base_image, docker_network_mode, sysroot_nocache).base_image == image_name def test_get_docker_base_image(): """Test that the correct base docker image is used for all arguments.""" verify_base_docker_images('aarch64', 'ubuntu', 'dashing', 'arm64v8/ubuntu:bionic') verify_base_docker_images('aarch64', 'ubuntu', 'eloquent', 'arm64v8/ubuntu:bionic') verify_base_docker_images('aarch64', 'ubuntu', 'kinetic', 'arm64v8/ubuntu:xenial') verify_base_docker_images('aarch64', 'ubuntu', 'melodic', 'arm64v8/ubuntu:bionic') verify_base_docker_images('aarch64', 'debian', 'dashing', 'arm64v8/debian:stretch') verify_base_docker_images('aarch64', 'debian', 'eloquent', 'arm64v8/debian:buster') verify_base_docker_images('aarch64', 'debian', 'kinetic', 'arm64v8/debian:jessie') verify_base_docker_images('aarch64', 'debian', 'melodic', 'arm64v8/debian:stretch') verify_base_docker_images('armhf', 'ubuntu', 'dashing', 'arm32v7/ubuntu:bionic') verify_base_docker_images('armhf', 'ubuntu', 'eloquent', 'arm32v7/ubuntu:bionic') verify_base_docker_images('armhf', 'ubuntu', 'kinetic', 'arm32v7/ubuntu:xenial') verify_base_docker_images('armhf', 'ubuntu', 'melodic', 'arm32v7/ubuntu:bionic') verify_base_docker_images('armhf', 'debian', 'dashing', 'arm32v7/debian:stretch') verify_base_docker_images('armhf', 'debian', 'eloquent', 'arm32v7/debian:buster') verify_base_docker_images('armhf', 'debian', 'kinetic', 'arm32v7/debian:jessie') verify_base_docker_images('armhf', 'debian', 'melodic', 'arm32v7/debian:stretch')
[ 2, 15069, 13130, 6186, 13, 785, 11, 3457, 13, 393, 663, 29116, 13, 1439, 6923, 33876, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, ...
2.669957
2,330
#!/usr/bin/env python r"""estimate.py Use to estimate masses based on observed proxy values (and associated errors) from a pre-calibrated generative model for the mass-proxy relationship. The estimates will be returned as samples (fair draws) from the model's posterior on the mass given the proxy observation. This program expects the proxy data in a file with at least 'proxy' and 'dp' column headers, followed by observed proxy values and relative errors in those columns: proxy dp p1 dp1 ... The output will have one row for each proxy measurement, with one column for each draw from the mass posterior for that system: m1_draw m1_draw ... m2_draw m2_draw ... ... """ import argparse import bz2 import numpy as np import os.path as op import pickle import posterior as pos import plotutils.runner as pr if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--caldir', metavar='DIR', required=True, help='directory with calibration data') parser.add_argument('--proxyfile', metavar='FILE', required=True, help='proxy observations') parser.add_argument('--output', metavar='FILE', default='masses.dat.bz2', help='mass posterior draws') args = parser.parse_args() runner = pr.load_runner(args.caldir) with bz2.BZ2File(op.join(args.caldir, 'logpost.pkl.bz2'), 'r') as inp: logpost = pickle.load(inp) flatchain = runner.thin_chain[:,-16:,:].reshape((-1, runner.chain.shape[2])) data = np.genfromtxt(args.proxyfile, names=True) ms = [] for log_p, dp in zip(np.log(data['proxy']), data['dp']): mdraws = [] for p in flatchain: ((log_m, log_p_est), (var_log_m, var_log_p)) = \ logpost.mass_proxy_estimate(p, log_p, dp) mdraws.append(np.exp(np.random.normal(loc=log_m, scale=np.sqrt(var_log_m)))) ms.append(mdraws) ms = np.array(ms) fname = args.output fbase, fext = op.splitext(fname) if not (fext == '.bz2'): fname = fname + '.bz2' with bz2.BZ2File(fname, 'w') as out: np.savetxt(out, ms)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 81, 37811, 395, 1920, 13, 9078, 198, 198, 11041, 284, 8636, 14568, 1912, 319, 6515, 15741, 3815, 357, 392, 3917, 198, 48277, 8, 422, 257, 662, 12, 9948, 2889, 515, 1152, 876, 27...
2.581165
807
str1 = "Python" str2 = "Python" print("\nMemory location of str1 =", hex(id(str1))) print("Memory location of str2 =", hex(id(str2))) print()
[ 2536, 16, 796, 366, 37906, 1, 198, 2536, 17, 796, 366, 37906, 1, 198, 220, 198, 4798, 7203, 59, 77, 30871, 4067, 286, 965, 16, 796, 1600, 17910, 7, 312, 7, 2536, 16, 22305, 198, 4798, 7203, 30871, 4067, 286, 965, 17, 796, 1600, ...
2.648148
54
config = dict() config['fixed_cpu_frequency'] = "@ 3700 MHz" config['frequency'] = 3.7e9 config['maxflops_sisd'] = 2 config['maxflops_sisd_fma'] = 4 config['maxflops_simd'] = 16 config['maxflops_simd_fma'] = 32 config['roofline_beta'] = 64 # According to WikiChip (Skylake) config['figure_size'] = (20,9) config['save_folder'] = '../all_plots/'
[ 11250, 796, 8633, 3419, 198, 198, 11250, 17816, 34021, 62, 36166, 62, 35324, 20520, 796, 44212, 5214, 405, 19805, 1, 198, 11250, 17816, 35324, 20520, 796, 513, 13, 22, 68, 24, 198, 11250, 17816, 9806, 2704, 2840, 62, 82, 9409, 20520, ...
2.485915
142
import cx_Oracle from oracledb import OracleJSONDatabaseConnection import json jsondb = OracleJSONDatabaseConnection() connection = jsondb.get_connection() connection.autocommit = True soda = connection.getSodaDatabase() x_collection = soda.createCollection('f1_2021_weather') all_data = list() for doc in x_collection.find().getCursor(): content = doc.getContent() all_data.append(content) print('Data length: {}'.format(len(all_data))) with open("weather.json", 'w') as outfile: outfile.write(json.dumps(all_data, indent=4)) outfile.close()
[ 11748, 43213, 62, 48625, 198, 6738, 393, 330, 992, 65, 1330, 18650, 40386, 38105, 32048, 198, 11748, 33918, 220, 198, 198, 8457, 623, 65, 796, 18650, 40386, 38105, 32048, 3419, 198, 198, 38659, 796, 44804, 623, 65, 13, 1136, 62, 38659, ...
3.005348
187
from Tkinter import * import ttk import BuyBook import BookInformationPage import Message
[ 6738, 309, 74, 3849, 1330, 1635, 198, 11748, 256, 30488, 198, 11748, 11763, 10482, 198, 11748, 4897, 21918, 9876, 198, 11748, 16000, 628, 628, 198 ]
3.76
25
"""initial migration Revision ID: 1b57e397deea Revises: Create Date: 2021-12-20 20:57:14.696646 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '1b57e397deea' down_revision = None branch_labels = None depends_on = None
[ 37811, 36733, 13472, 198, 198, 18009, 1166, 4522, 25, 352, 65, 3553, 68, 33372, 67, 1453, 64, 198, 18009, 2696, 25, 220, 198, 16447, 7536, 25, 33448, 12, 1065, 12, 1238, 1160, 25, 3553, 25, 1415, 13, 38205, 27720, 198, 198, 37811, 1...
2.650943
106
import copy import itertools import re from base64 import b64decode from app.utility.base_service import BaseService from app.utility.rule import RuleSet
[ 11748, 4866, 198, 11748, 340, 861, 10141, 198, 11748, 302, 198, 6738, 2779, 2414, 1330, 275, 2414, 12501, 1098, 198, 198, 6738, 598, 13, 315, 879, 13, 8692, 62, 15271, 1330, 7308, 16177, 198, 6738, 598, 13, 315, 879, 13, 25135, 1330, ...
3.466667
45
import math from pyclid.vector import * from pyclid.matrix import * from pyclid.quaternion import * #from pyclid.vector import vector #from pyclid.quaternion import quaternion #from pyclid.matrix import matrix
[ 11748, 10688, 198, 198, 6738, 12972, 565, 312, 13, 31364, 1330, 1635, 198, 6738, 12972, 565, 312, 13, 6759, 8609, 1330, 1635, 198, 6738, 12972, 565, 312, 13, 421, 9205, 295, 1330, 1635, 628, 198, 2, 6738, 12972, 565, 312, 13, 31364, ...
3.028169
71
import os rootdir = os.path.abspath(os.path.join(__file__, "..", "..")) mldir = os.path.join(rootdir, "ml") import sys sys.path.append(mldir) import pfm import iispt_transforms import math import plotly import plotly.plotly as py import plotly.graph_objs as go # ============================================================================= # Conf NUM_BUCKETS = 100 INPUTDIR = "/home/gj/git/pbrt-v3-IISPT-dataset-indirect/breakfast" SELECTOR = "p" GAMMA_VALUE = 1.8 NORMALIZATION_INTENSITY = 3.807115077972 # ============================================================================= # Script flist = [] for f in os.listdir(INPUTDIR): fpath = os.path.join(INPUTDIR, f) if f.startswith(SELECTOR) and f.endswith(".pfm"): flist.append(fpath) # Generate histogram for raw data standard_imgs = [] for fpath in flist: standard_imgs.append(pfm.load(fpath)) histogram(standard_imgs, "Raw intensity") # Generate histogram after log transform log_imgs = [] for fpath in flist: img = pfm.load(fpath) img.map(iispt_transforms.LogTransform()) log_imgs.append(img) histogram(log_imgs, "Log transform") # GEnerate histogram after log + gamma transform lg_imgs = [] for fpath in flist: img = pfm.load(fpath) img.normalize_log_gamma(NORMALIZATION_INTENSITY, GAMMA_VALUE) lg_imgs.append(img) histogram(lg_imgs, "Log + Gamma transform")
[ 11748, 28686, 198, 198, 15763, 15908, 796, 28686, 13, 6978, 13, 397, 2777, 776, 7, 418, 13, 6978, 13, 22179, 7, 834, 7753, 834, 11, 366, 492, 1600, 366, 492, 48774, 198, 198, 76, 335, 343, 796, 28686, 13, 6978, 13, 22179, 7, 15763...
2.651252
519
import logging import sys import threading import serial import serial.tools.list_ports from crownstone_uart.Constants import UART_READ_TIMEOUT, UART_WRITE_TIMEOUT from crownstone_uart.core.UartEventBus import UartEventBus from crownstone_uart.core.uart.UartParser import UartParser from crownstone_uart.core.uart.UartReadBuffer import UartReadBuffer from crownstone_uart.topics.SystemTopics import SystemTopics _LOGGER = logging.getLogger(__name__)
[ 11748, 18931, 198, 11748, 25064, 198, 11748, 4704, 278, 198, 198, 11748, 11389, 198, 11748, 11389, 13, 31391, 13, 4868, 62, 3742, 198, 198, 6738, 12389, 6440, 62, 19986, 13, 34184, 1187, 1330, 471, 7227, 62, 15675, 62, 34694, 12425, 11,...
3.313869
137
Locations = [ Location(1, "EWR", "Newark Airport", 40.6895314, -74.1744624), Location(2, "Queens", "Jamaica Bay", 40.6056632, -73.8713099), Location(3, "Bronx", "Allerton/Pelham Gardens", 40.8627726, -73.84343919999999), Location(4, "Manhattan", "Alphabet City", 40.7258428, -73.9774916), Location(5, "Staten Island", "Arden Heights", 40.556413, -74.1735044), Location(6, "Staten Island", "Arrochar/Fort Wadsworth", 40.6012117, -74.0579185), Location(7, "Queens", "Astoria", 40.7643574, -73.92346189999999), Location(8, "Queens", "Astoria Park", 40.7785364, -73.92283359999999), Location(9, "Queens", "Auburndale", 40.7577672, -73.78339609999999), Location(10, "Queens", "Baisley Park", 40.6737751, -73.786025), Location(11, "Brooklyn", "Bath Beach", 40.6038852, -74.0062078), Location(12, "Manhattan", "Battery Park", 40.703141, -74.0159996), Location(13, "Manhattan", "Battery Park City", 40.7115786, -74.0158441), Location(14, "Brooklyn", "Bay Ridge", 40.6263732, -74.0298767), Location(15, "Queens", "Bay Terrace/Fort Totten", 40.7920899, -73.7760996), Location(16, "Queens", "Bayside", 40.7585569, -73.7654367), Location(17, "Brooklyn", "Bedford", 40.6872176, -73.9417735), Location(18, "Bronx", "Bedford Park", 40.8700999, -73.8856912), Location(19, "Queens", "Bellerose", 40.7361769, -73.7137365), Location(20, "Bronx", "Belmont", 40.8534507, -73.88936819999999), Location(21, "Brooklyn", "Bensonhurst East", 40.6139307, -73.9921833), Location(22, "Brooklyn", "Bensonhurst West", 40.6139307, -73.9921833), Location(23, "Staten Island", "Bloomfield/Emerson Hill", 40.6074525, -74.0963115), Location(24, "Manhattan", "Bloomingdale", 40.7988958, -73.9697795), Location(25, "Brooklyn", "Boerum Hill", 40.6848689, -73.9844722), Location(26, "Brooklyn", "Borough Park", 40.6350319, -73.9921028), Location(27, "Queens", "Breezy Point/Fort Tilden/Riis Beach", 40.5597687, -73.88761509999999), Location(28, "Queens", "Briarwood/Jamaica Hills", 40.7109315, -73.81356099999999), Location(29, "Brooklyn", "Brighton Beach", 40.5780706, -73.9596565), Location(30, "Queens", "Broad Channel", 40.6158335, -73.8213213), Location(31, "Bronx", "Bronx Park", 40.8608544, -73.8706278), Location(32, "Bronx", "Bronxdale", 40.8474697, -73.8599132), Location(33, "Brooklyn", "Brooklyn Heights", 40.6959294, -73.9955523), Location(34, "Brooklyn", "Brooklyn Navy Yard", 40.7025634, -73.9697795), Location(35, "Brooklyn", "Brownsville", 40.665214, -73.9125304), Location(36, "Brooklyn", "Bushwick North", 40.6957755, -73.9170604), Location(37, "Brooklyn", "Bushwick South", 40.7043655, -73.9383476), Location(38, "Queens", "Cambria Heights", 40.692158, -73.7330753), Location(39, "Brooklyn", "Canarsie", 40.6402325, -73.9060579), Location(40, "Brooklyn", "Carroll Gardens", 40.6795331, -73.9991637), Location(41, "Manhattan", "Central Harlem", 40.8089419, -73.9482305), Location(42, "Manhattan", "Central Harlem North", 40.8142585, -73.9426617), Location(43, "Manhattan", "Central Park", 40.7812199, -73.9665138), Location(44, "Staten Island", "Charleston/Tottenville", 40.5083408, -74.23554039999999), Location(45, "Manhattan", "Chinatown", 40.7157509, -73.9970307), Location(46, "Bronx", "City Island", 40.8468202, -73.7874983), Location(47, "Bronx", "Claremont/Bathgate", 40.84128339999999, -73.9001573), Location(48, "Manhattan", "Clinton East", 40.7637581, -73.9918181), Location(49, "Brooklyn", "Clinton Hill", 40.6896834, -73.9661144), Location(50, "Manhattan", "Clinton West", 40.7628785, -73.9940134), Location(51, "Bronx", "Co-Op City", 40.8738889, -73.82944440000001), Location(52, "Brooklyn", "Cobble Hill", 40.686536, -73.9962255), Location(53, "Queens", "College Point", 40.786395, -73.8389657), Location(54, "Brooklyn", "Columbia Street", 40.6775239, -74.00634409999999), Location(55, "Brooklyn", "Coney Island", 40.5755438, -73.9707016), Location(56, "Queens", "Corona", 40.7449859, -73.8642613), Location(57, "Queens", "Corona", 40.7449859, -73.8642613), Location(58, "Bronx", "Country Club", 40.8391667, -73.8197222), Location(59, "Bronx", "Crotona Park", 40.8400367, -73.8953489), Location(60, "Bronx", "Crotona Park East", 40.8365344, -73.8933509), Location(61, "Brooklyn", "Crown Heights North", 40.6694022, -73.9422324), Location(62, "Brooklyn", "Crown Heights South", 40.6694022, -73.9422324), Location(63, "Brooklyn", "Cypress Hills", 40.6836873, -73.87963309999999), Location(64, "Queens", "Douglaston", 40.76401509999999, -73.7433727), Location(65, "Brooklyn", "Downtown Brooklyn/MetroTech", 40.6930987, -73.98566339999999), Location(66, "Brooklyn", "DUMBO/Vinegar Hill", 40.70371859999999, -73.98226830000002), Location(67, "Brooklyn", "Dyker Heights", 40.6214932, -74.00958399999999), Location(68, "Manhattan", "East Chelsea", 40.7465004, -74.00137370000002), Location(69, "Bronx", "East Concourse/Concourse Village", 40.8255863, -73.9184388), Location(70, "Queens", "East Elmhurst", 40.7737505, -73.8713099), Location(71, "Brooklyn", "East Flatbush/Farragut", 40.63751329999999, -73.9280797), Location(72, "Brooklyn", "East Flatbush/Remsen Village", 40.6511399, -73.9181602), Location(73, "Queens", "East Flushing", 40.7540534, -73.8086418), Location(74, "Manhattan", "East Harlem North", 40.7957399, -73.93892129999999), Location(75, "Manhattan", "East Harlem South", 40.7957399, -73.93892129999999), Location(76, "Brooklyn", "East New York", 40.6590529, -73.8759245), Location(77, "Brooklyn", "East New York/Pennsylvania Avenue", 40.65845729999999, -73.8904498), Location(78, "Bronx", "East Tremont", 40.8453781, -73.8909693), Location(79, "Manhattan", "East Village", 40.7264773, -73.98153370000001), Location(80, "Brooklyn", "East Williamsburg", 40.7141953, -73.9316461), Location(81, "Bronx", "Eastchester", 40.8859837, -73.82794710000002), Location(82, "Queens", "Elmhurst", 40.737975, -73.8801301), Location(83, "Queens", "Elmhurst/Maspeth", 40.7294018, -73.9065883), Location(84, "Staten Island", "Eltingville/Annadale/Prince's Bay", 40.52899439999999, -74.197644), Location(85, "Brooklyn", "Erasmus", 40.649649, -73.95287379999999), Location(86, "Queens", "Far Rockaway", 40.5998931, -73.74484369999999), Location(87, "Manhattan", "Financial District North", 40.7077143, -74.00827869999999), Location(88, "Manhattan", "Financial District South", 40.705123, -74.0049259), Location(89, "Brooklyn", "Flatbush/Ditmas Park", 40.6414876, -73.9593998), Location(90, "Manhattan", "Flatiron", 40.740083, -73.9903489), Location(91, "Brooklyn", "Flatlands", 40.6232714, -73.9321664), Location(92, "Queens", "Flushing", 40.7674987, -73.833079), Location(93, "Queens", "Flushing Meadows-Corona Park", 40.7400275, -73.8406953), Location(94, "Bronx", "Fordham South", 40.8592667, -73.8984694), Location(95, "Queens", "Forest Hills", 40.718106, -73.8448469), Location(96, "Queens", "Forest Park/Highland Park", 40.6960418, -73.8663024), Location(97, "Brooklyn", "Fort Greene", 40.6920638, -73.97418739999999), Location(98, "Queens", "Fresh Meadows", 40.7335179, -73.7801447), Location(99, "Staten Island", "Freshkills Park", 40.5772365, -74.1858183), Location(100, "Manhattan", "Garment District", 40.7547072, -73.9916342), Location(101, "Queens", "Glen Oaks", 40.7471504, -73.7118223), Location(102, "Queens", "Glendale", 40.7016662, -73.8842219), Location(103, "Manhattan", "Governor's Island/Ellis Island/Liberty Island", 40.6892494, -74.04450039999999), Location(104, "Manhattan", "Governor's Island/Ellis Island/Liberty Island", 40.6892494, -74.04450039999999), Location(105, "Manhattan", "Governor's Island/Ellis Island/Liberty Island", 40.6892494, -74.04450039999999), Location(106, "Brooklyn", "Gowanus", 40.6751161, -73.9879753), Location(107, "Manhattan", "Gramercy", 40.7367783, -73.9844722), Location(108, "Brooklyn", "Gravesend", 40.5918636, -73.9768653), Location(109, "Staten Island", "Great Kills", 40.5543273, -74.156292), Location(110, "Staten Island", "Great Kills Park", 40.5492367, -74.1238486), Location(111, "Brooklyn", "Green-Wood Cemetery", 40.6579777, -73.9940634), Location(112, "Brooklyn", "Greenpoint", 40.7304701, -73.95150319999999), Location(113, "Manhattan", "Greenwich Village North", 40.7335719, -74.0027418), Location(114, "Manhattan", "Greenwich Village South", 40.7335719, -74.0027418), Location(115, "Staten Island", "Grymes Hill/Clifton", 40.6189726, -74.0784785), Location(116, "Manhattan", "Hamilton Heights", 40.8252793, -73.94761390000001), Location(117, "Queens", "Hammels/Arverne", 40.5880813, -73.81199289999999), Location(118, "Staten Island", "Heartland Village/Todt Hill", 40.5975007, -74.10189749999999), Location(119, "Bronx", "Highbridge", 40.836916, -73.9271294), Location(120, "Manhattan", "Highbridge Park", 40.8537599, -73.9257492), Location(121, "Queens", "Hillcrest/Pomonok", 40.732341, -73.81077239999999), Location(122, "Queens", "Hollis", 40.7112203, -73.762495), Location(123, "Brooklyn", "Homecrest", 40.6004787, -73.9565551), Location(124, "Queens", "Howard Beach", 40.6571222, -73.8429989), Location(125, "Manhattan", "Hudson Sq", 40.7265834, -74.0074731), Location(126, "Bronx", "Hunts Point", 40.8094385, -73.8803315), Location(127, "Manhattan", "Inwood", 40.8677145, -73.9212019), Location(128, "Manhattan", "Inwood Hill Park", 40.8722007, -73.9255549), Location(129, "Queens", "Jackson Heights", 40.7556818, -73.8830701), Location(130, "Queens", "Jamaica", 40.702677, -73.7889689), Location(131, "Queens", "Jamaica Estates", 40.7179512, -73.783822), Location(132, "Queens", "JFK Airport", 40.6413111, -73.77813909999999), Location(133, "Brooklyn", "Kensington", 40.63852019999999, -73.97318729999999), Location(134, "Queens", "Kew Gardens", 40.705695, -73.8272029), Location(135, "Queens", "Kew Gardens Hills", 40.724707, -73.8207618), Location(136, "Bronx", "Kingsbridge Heights", 40.8711235, -73.8976328), Location(137, "Manhattan", "Kips Bay", 40.74232920000001, -73.9800645), Location(138, "Queens", "LaGuardia Airport", 40.7769271, -73.8739659), Location(139, "Queens", "Laurelton", 40.67764, -73.7447853), Location(140, "Manhattan", "Lenox Hill East", 40.7662315, -73.9602312), Location(141, "Manhattan", "Lenox Hill West", 40.7662315, -73.9602312), Location(142, "Manhattan", "Lincoln Square East", 40.7741769, -73.98491179999999), Location(143, "Manhattan", "Lincoln Square West", 40.7741769, -73.98491179999999), Location(144, "Manhattan", "Little Italy/NoLiTa", 40.7230413, -73.99486069999999), Location(145, "Queens", "Long Island City/Hunters Point", 40.7485587, -73.94964639999999), Location(146, "Queens", "Long Island City/Queens Plaza", 40.7509846, -73.9402762), Location(147, "Bronx", "Longwood", 40.8248438, -73.8915875), Location(148, "Manhattan", "Lower East Side", 40.715033, -73.9842724), Location(149, "Brooklyn", "Madison", 40.60688529999999, -73.947958), Location(150, "Brooklyn", "Manhattan Beach", 40.57815799999999, -73.93892129999999), Location(151, "Manhattan", "Manhattan Valley", 40.7966989, -73.9684247), Location(152, "Manhattan", "Manhattanville", 40.8169443, -73.9558333), Location(153, "Manhattan", "Marble Hill", 40.8761173, -73.9102628), Location(154, "Brooklyn", "Marine Park/Floyd Bennett Field", 40.58816030000001, -73.8969745), Location(155, "Brooklyn", "Marine Park/Mill Basin", 40.6055157, -73.9348698), Location(156, "Staten Island", "Mariners Harbor", 40.63677010000001, -74.1587547), Location(157, "Queens", "Maspeth", 40.7294018, -73.9065883), Location(158, "Manhattan", "Meatpacking/West Village West", 40.7342331, -74.0100622), Location(159, "Bronx", "Melrose South", 40.824545, -73.9104143), Location(160, "Queens", "Middle Village", 40.717372, -73.87425), Location(161, "Manhattan", "Midtown Center", 40.7314658, -73.9970956), Location(162, "Manhattan", "Midtown East", 40.7571432, -73.9718815), Location(163, "Manhattan", "Midtown North", 40.7649516, -73.9851039), Location(164, "Manhattan", "Midtown South", 40.7521795, -73.9875438), Location(165, "Brooklyn", "Midwood", 40.6204388, -73.95997779999999), Location(166, "Manhattan", "Morningside Heights", 40.8105443, -73.9620581), Location(167, "Bronx", "Morrisania/Melrose", 40.824545, -73.9104143), Location(168, "Bronx", "Mott Haven/Port Morris", 40.8022025, -73.9166051), Location(169, "Bronx", "Mount Hope", 40.8488863, -73.9051185), Location(170, "Manhattan", "Murray Hill", 40.7478792, -73.9756567), Location(171, "Queens", "Murray Hill-Queens", 40.7634996, -73.8073261), Location(172, "Staten Island", "New Dorp/Midland Beach", 40.5739937, -74.1159755), Location(173, "Queens", "North Corona", 40.7543725, -73.8669188), Location(174, "Bronx", "Norwood", 40.8810341, -73.878486), Location(175, "Queens", "Oakland Gardens", 40.7408584, -73.758241), Location(176, "Staten Island", "Oakwood", 40.563994, -74.1159754), Location(177, "Brooklyn", "Ocean Hill", 40.6782737, -73.9108212), Location(178, "Brooklyn", "Ocean Parkway South", 40.61287799999999, -73.96838620000001), Location(179, "Queens", "Old Astoria", 40.7643574, -73.92346189999999), Location(180, "Queens", "Ozone Park", 40.6794072, -73.8507279), Location(181, "Brooklyn", "Park Slope", 40.6710672, -73.98142279999999), Location(182, "Bronx", "Parkchester", 40.8382522, -73.8566087), Location(183, "Bronx", "Pelham Bay", 40.8505556, -73.83333329999999), Location(184, "Bronx", "Pelham Bay Park", 40.8670144, -73.81006339999999), Location(185, "Bronx", "Pelham Parkway", 40.8553279, -73.8639594), Location(186, "Manhattan", "Penn Station/Madison Sq West", 40.7505045, -73.9934387), Location(187, "Staten Island", "Port Richmond", 40.63549140000001, -74.1254641), Location(188, "Brooklyn", "Prospect-Lefferts Gardens", 40.6592355, -73.9533895), Location(189, "Brooklyn", "Prospect Heights", 40.6774196, -73.9668408), Location(190, "Brooklyn", "Prospect Park", 40.6602037, -73.9689558), Location(191, "Queens", "Queens Village", 40.7156628, -73.7419017), Location(192, "Queens", "Queensboro Hill", 40.7429383, -73.8251741), Location(193, "Queens", "Queensbridge/Ravenswood", 40.7556711, -73.9456723), Location(194, "Manhattan", "Randalls Island", 40.7932271, -73.92128579999999), Location(195, "Brooklyn", "Red Hook", 40.6733676, -74.00831889999999), Location(196, "Queens", "Rego Park", 40.72557219999999, -73.8624893), Location(197, "Queens", "Richmond Hill", 40.6958108, -73.8272029), Location(198, "Queens", "Ridgewood", 40.7043986, -73.9018292), Location(199, "Bronx", "Rikers Island", 40.79312770000001, -73.88601), Location(200, "Bronx", "Riverdale/North Riverdale/Fieldston", 40.89961830000001, -73.9088276), Location(201, "Queens", "Rockaway Park", 40.57978629999999, -73.8372237), Location(202, "Manhattan", "Roosevelt Island", 40.76050310000001, -73.9509934), Location(203, "Queens", "Rosedale", 40.6584068, -73.7389596), Location(204, "Staten Island", "Rossville/Woodrow", 40.5434385, -74.19764409999999), Location(205, "Queens", "Saint Albans", 40.6895283, -73.76436880000001), Location(206, "Staten Island", "Saint George/New Brighton", 40.6404369, -74.090226), Location(207, "Queens", "Saint Michaels Cemetery/Woodside", 40.7646761, -73.89850419999999), Location(208, "Bronx", "Schuylerville/Edgewater Park", 40.8235967, -73.81029269999999), Location(209, "Manhattan", "Seaport", 40.70722629999999, -74.0027431), Location(210, "Brooklyn", "Sheepshead Bay", 40.5953955, -73.94575379999999), Location(211, "Manhattan", "SoHo", 40.723301, -74.0029883), Location(212, "Bronx", "Soundview/Bruckner", 40.8247566, -73.8710929), Location(213, "Bronx", "Soundview/Castle Hill", 40.8176831, -73.8507279), Location(214, "Staten Island", "South Beach/Dongan Hills", 40.5903824, -74.06680759999999), Location(215, "Queens", "South Jamaica", 40.6808594, -73.7919103), Location(216, "Queens", "South Ozone Park", 40.6764003, -73.8124984), Location(217, "Brooklyn", "South Williamsburg", 40.7043921, -73.9565551), Location(218, "Queens", "Springfield Gardens North", 40.6715916, -73.779798), Location(219, "Queens", "Springfield Gardens South", 40.6715916, -73.779798), Location(220, "Bronx", "Spuyten Duyvil/Kingsbridge", 40.8833912, -73.9051185), Location(221, "Staten Island", "Stapleton", 40.6264929, -74.07764139999999), Location(222, "Brooklyn", "Starrett City", 40.6484272, -73.88236119999999), Location(223, "Queens", "Steinway", 40.7745459, -73.9037477), Location(224, "Manhattan", "Stuy Town/Peter Cooper Village", 40.7316903, -73.9778494), Location(225, "Brooklyn", "Stuyvesant Heights", 40.6824166, -73.9319933), Location(226, "Queens", "Sunnyside", 40.7432759, -73.9196324), Location(227, "Brooklyn", "Sunset Park East", 40.65272, -74.00933479999999), Location(228, "Brooklyn", "Sunset Park West", 40.65272, -74.00933479999999), Location(229, "Manhattan", "Sutton Place/Turtle Bay North", 40.7576281, -73.961698), Location(230, "Manhattan", "Times Sq/Theatre District", 40.759011, -73.9844722), Location(231, "Manhattan", "TriBeCa/Civic Center", 40.71625299999999, -74.0122396), Location(232, "Manhattan", "Two Bridges/Seward Park", 40.7149056, -73.98924699999999), Location(233, "Manhattan", "UN/Turtle Bay South", 40.7571432, -73.9718815), Location(234, "Manhattan", "Union Sq", 40.7358633, -73.9910835), Location(235, "Bronx", "University Heights/Morris Heights", 40.8540855, -73.9198498), Location(236, "Manhattan", "Upper East Side North", 40.7600931, -73.9598414), Location(237, "Manhattan", "Upper East Side South", 40.7735649, -73.9565551), Location(238, "Manhattan", "Upper West Side North", 40.7870106, -73.9753676), Location(239, "Manhattan", "Upper West Side South", 40.7870106, -73.9753676), Location(240, "Bronx", "Van Cortlandt Park", 40.8972233, -73.8860668), Location(241, "Bronx", "Van Cortlandt Village", 40.8837203, -73.89313899999999), Location(242, "Bronx", "Van Nest/Morris Park", 40.8459682, -73.8625946), Location(243, "Manhattan", "Washington Heights North", 40.852476, -73.9342996), Location(244, "Manhattan", "Washington Heights South", 40.8417082, -73.9393554), Location(245, "Staten Island", "West Brighton", 40.6270298, -74.10931409999999), Location(246, "Manhattan", "West Chelsea/Hudson Yards", 40.7542535, -74.0023331), Location(247, "Bronx", "West Concourse", 40.8316761, -73.9227554), Location(248, "Bronx", "West Farms/Bronx River", 40.8430609, -73.8816001), Location(249, "Manhattan", "West Village", 40.73468, -74.0047554), Location(250, "Bronx", "Westchester Village/Unionport", 40.8340447, -73.8531349), Location(251, "Staten Island", "Westerleigh", 40.616296, -74.1386767), Location(252, "Queens", "Whitestone", 40.7920449, -73.8095574), Location(253, "Queens", "Willets Point", 40.7606911, -73.840436), Location(254, "Bronx", "Williamsbridge/Olinville", 40.8787602, -73.85283559999999), Location(255, "Brooklyn", "Williamsburg (North Side)", 40.71492, -73.9528472), Location(256, "Brooklyn", "Williamsburg (South Side)", 40.70824229999999, -73.9571487), Location(257, "Brooklyn", "Windsor Terrace", 40.6539346, -73.9756567), Location(258, "Queens", "Woodhaven", 40.6901366, -73.8566087), Location(259, "Bronx", "Woodlawn/Wakefield", 40.8955885, -73.8627133), Location(260, "Queens", "Woodside", 40.7532952, -73.9068973), Location(261, "Manhattan", "World Trade Center", 40.7118011, -74.0131196), Location(262, "Manhattan", "Yorkville East", 40.7762231, -73.94920789999999), Location(263, "Manhattan", "Yorkville West", 40.7762231, -73.94920789999999) ]
[ 198, 198, 43, 20968, 796, 685, 198, 220, 220, 220, 13397, 7, 16, 11, 366, 6217, 49, 1600, 366, 3791, 668, 12690, 1600, 2319, 13, 3104, 3865, 33638, 11, 532, 4524, 13, 1558, 27260, 1731, 828, 198, 220, 220, 220, 13397, 7, 17, 11, ...
2.408757
8,428
import math from utils import * main()
[ 11748, 10688, 198, 6738, 3384, 4487, 1330, 1635, 198, 198, 12417, 3419 ]
3.25
12
import os import simplejson as json
[ 11748, 28686, 198, 11748, 2829, 17752, 355, 33918, 628 ]
4.111111
9
#! /usr/bin/env python # -*- coding: utf-8 -*- import daiquiri from time import time import warp10client LOG = daiquiri.getLogger(__name__) warp10_api_url = '' # Add here backend url where metrics are stored read_token = '' # Add here your metrics read token write_token = '' # Add here your metrics write token # To get metrics: metric_get = { 'name': 'cpu_util', 'tags': { 'resource_id': '18d94676-077c-4c13-b000-27fd603f3056', 'project_id': '8069f876e7d444249ef04b9a74090711', }, 'aggregate': { 'type': 'mean', 'span': 1000000 * 3600, }, 'timestamp': { 'start': "2017-01-01T00:00:00.000Z", 'end': "2018-01-01T00:00:00.000Z" } # 'timestamp': { 'end': "2018-01-01T00:00:00.000Z" } # 'timestamp': { 'start': None, 'end': None } } # To write metrics: metric_write = { 'name': 'cpu_util_mjozefcz', 'tags': { 'resource_id': '18d94676-077c-4c13-b000-27fd603f3056', 'project_id': '8069f876e7d444249ef04b9a74090711', 'unit': '%', }, 'position': { 'longitude': None, 'latitude': None, 'elevation': None, 'timestamp': time() * 1000 * 1000, }, 'value': 11, } # To check metrics metric_check = { 'name': 'cpu_util', 'tags': { 'resource_id': '18d94676-077c-4c13-b000-27fd603f3056', 'project_id': '8069f876e7d444249ef04b9a74090711', }, } # arguments need to authorize in metrics backend kwargs = { 'write_token': write_token, 'read_token': read_token, 'warp10_api_url': warp10_api_url, } client = warp10client.Warp10Client(**kwargs) # Consider to create timeseries, new object with included metrics as each point # Thats goooood idea. metric_get_test = client.get(metric_get) metric_exists = client.exists(metric_check) metric_obj = warp10client.Metric(**metric_write) metric_send = client.set(metric_write) # delete method is not yet implemented # metric_send = client.delete(metric_write)
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 12379, 1557, 14783, 198, 6738, 640, 1330, 640, 198, 11748, 25825, 940, 16366, 198, 198, 25294, 796, 12379...
2.201542
908
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2020 Jim Mussared # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # This script obfuscates the ST wireless binaries so they can be safely copied # to the flash filesystem and not be accidentally discovered by the FUS during # an update. See more information (and the corresponding de-obfuscation) in # rfcore_firmware.py as well as instructions on how to use. import os import struct import sys # Must match rfcore_firmware.py. _OBFUSCATION_KEY = 0x0573B55AA _FIRMWARE_FILES = { "stm32wb5x_FUS_fw_1_0_2.bin": "fus_102.bin", "stm32wb5x_FUS_fw.bin": "fus_112.bin", "stm32wb5x_BLE_HCILayer_fw.bin": "ws_ble_hci.bin", } if __name__ == "__main__": if len(sys.argv) != 3: print("Usage: {} src_path dest_path".format(sys.argv[0])) print() print( '"src_path" should be the location of the ST binaries from https://github.com/STMicroelectronics/STM32CubeWB/tree/master/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x' ) print( '"dest_path" will be where fus_102.bin, fus_110.bin, and ws_ble_hci.bin will be written to.' ) sys.exit(1) main(sys.argv[1], sys.argv[2])
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 262, 4527, 37906, 1628, 11, 2638, 1378, 9383, 1773, 7535, 13, 2398, 14, 198, 2, 198, 2, 383, 17168, 13789, 357, 36393, 8, 198, 2, 198, 2,...
2.867574
808
import scrapy import yaml
[ 11748, 15881, 88, 198, 11748, 331, 43695, 198 ]
3.25
8
import warnings import gym import matplotlib.pyplot as plt import numpy as np from skopt.acquisition import gaussian_ei from environments.groundtruthgenerator import GroundTruth warnings.simplefilter("ignore", UserWarning) from skopt.learning.gaussian_process import gpr, kernels if __name__ == "__main__": """ Test to check the wall-time for an episode to run and the average number of steps per episode """ my_map = np.genfromtxt('YpacaraiMap_big.csv', delimiter=',').astype(int) / 255 env = ContinuousBO(scenario_map=my_map, resolution=1) # env.render() import time t0 = time.time() for i in range(100): env.reset() d = False print('Episode ', i) avg_r_ep = 0 while not d: a = get_action_using_bo(env) s, r_, d, _ = env.step(a) avg_r_ep += r_ if r_ == -10: print("collision") # env.render() print('Number of steps: ', env.step_count) print((time.time() - t0) / 100, ' segundos la iteracion')
[ 11748, 14601, 198, 198, 11748, 11550, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 1341, 8738, 13, 43561, 10027, 1330, 31986, 31562, 62, 20295, 198, 198, 6738, 12493, 13, 2...
2.366667
450
import numpy as np from sklearn.metrics import pairwise_distances import matplotlib.pyplot as plt
[ 11748, 299, 32152, 355, 45941, 220, 198, 6738, 1341, 35720, 13, 4164, 10466, 1330, 5166, 3083, 62, 17080, 1817, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 628, 220, 220, 220, 220 ]
2.971429
35
# -*- coding: utf-8 -*- import logging if __name__ == '__main__': logging.basicConfig() _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils import os.path xsd='''<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:simpleType name="foo"/> </xs:schema>''' from pyxb.exceptions_ import * import unittest if __name__ == '__main__': unittest.main()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 18931, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 18931, 13, 35487, 16934, 3419, 198, 62, 6404, 796, 18931, 13, 1136, 1118...
2.480392
204
import sys ii = int(sys.argv[1]) env = sys.argv[2] # python3 print_data_structure.py 22 MD10 import glob import os import numpy as n import EmergeIterate iterate = EmergeIterate.EmergeIterate(ii, env) iterate.open_snapshots() print_data_structure(iterate.f0)
[ 11748, 25064, 198, 4178, 796, 493, 7, 17597, 13, 853, 85, 58, 16, 12962, 198, 24330, 796, 25064, 13, 853, 85, 58, 17, 60, 198, 2, 21015, 18, 3601, 62, 7890, 62, 301, 5620, 13, 9078, 2534, 10670, 940, 198, 11748, 15095, 198, 11748,...
2.594059
101
# based on https://github.com/pypa/sampleproject from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the relevant file with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='mergevcf', version='1.0.1', description='Merge VCF calls', long_description=long_description, # The project's main homepage. url='https://github.com/ljdursi/mergevcf', # Author details author='Jonathan Dursi', author_email='Jonathan.Dursi@oicr.on.ca', # Choose your license license='GPL', classifiers=[ # 5 - Production/Stable 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Science/Research', 'Topic :: Scientific/Engineering', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.8', # 'Programming Language :: Python :: 3', # 'Programming Language :: Python :: 3.2', # 'Programming Language :: Python :: 3.3', # 'Programming Language :: Python :: 3.4', ], keywords='merge vcfs', packages=find_packages(exclude=['contrib', 'docs', 'tests*']), install_requires=['pyvcf'], test_suite='tests', extras_require={ 'dev': ['check-manifest'], 'test': ['coverage'], }, # If there are data files included in your packages that need to be # installed, specify them here. If using Python 2.6 or less, then these # have to be included in MANIFEST.in as well. # package_data={ # 'sample': ['package_data.dat'], # }, entry_points={ 'console_scripts': [ 'mergevcf=mergevcf:main', ], }, )
[ 2, 1912, 319, 3740, 1378, 12567, 13, 785, 14, 79, 4464, 64, 14, 39873, 16302, 198, 6738, 900, 37623, 10141, 1330, 9058, 11, 1064, 62, 43789, 198, 6738, 40481, 82, 1330, 1280, 198, 6738, 28686, 1330, 3108, 198, 198, 1456, 796, 3108, ...
2.56611
779
import pytest import six import ujson import apache_beam as beam from apache_beam.testing.test_pipeline import TestPipeline as _TestPipeline from apache_beam.testing.util import assert_that from apache_beam.testing.util import equal_to from apache_beam.coders import typecoders from apache_beam.typehints import Dict, Union from pipe_tools.coders import JSONDictCoder from pipe_tools.coders import JSONDict from pipe_tools.generator import MessageGenerator
[ 11748, 12972, 9288, 198, 11748, 2237, 198, 11748, 334, 17752, 198, 198, 11748, 2471, 4891, 62, 40045, 355, 15584, 198, 6738, 2471, 4891, 62, 40045, 13, 33407, 13, 9288, 62, 79, 541, 4470, 1330, 6208, 47, 541, 4470, 355, 4808, 14402, 4...
3.276596
141
"""Detail Yeti's Entity object structure.""" import json from yeti.core.errors import ValidationError from .base import StixObject
[ 37811, 11242, 603, 6430, 72, 338, 20885, 2134, 4645, 526, 15931, 198, 11748, 33918, 198, 198, 6738, 1865, 72, 13, 7295, 13, 48277, 1330, 3254, 24765, 12331, 198, 6738, 764, 8692, 1330, 520, 844, 10267, 198 ]
3.666667
36
# Copyright (c) 2012-2015 Netforce Co. Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE # OR OTHER DEALINGS IN THE SOFTWARE. from netforce.model import Model, fields, get_model from netforce.utils import get_data_path BarcodeQC.register()
[ 2, 15069, 357, 66, 8, 2321, 12, 4626, 3433, 3174, 1766, 13, 12052, 13, 198, 2, 220, 198, 2, 2448, 3411, 318, 29376, 7520, 11, 1479, 286, 3877, 11, 284, 597, 1048, 16727, 257, 4866, 198, 2, 286, 428, 3788, 290, 3917, 10314, 3696, ...
3.733945
327
import pickle from scipy.sparse import lil_matrix import numpy as np def _preproc(analyzer, str): return analyzer(str)[0] if analyzer(str) else 'null__' def pack_domains(source, target, pivots_source, pivots_target): dX = {source.name(): source.X, target.name(): target.X} dU = {source.name(): source.U, target.name(): target.U} dP = {source.name(): pivots_source, target.name(): pivots_target} dV = {source.name(): source.V, target.name(): target.V} return dX, dU, dP, dV def unify_feat_space(source, target): """ Given a source and a target domain, returns two new versions of them in which the feature spaces are common, by trivially juxtapossing the two vocabularies :param source: the source domain :param target: the target domain :return: a new version of the source and the target domains where the feature space is common """ word_set = source.V.term_set().union(target.V.term_set()) word2idx = {w:i for i,w in enumerate(word_set)} Vshared = Vocabulary(word2idx) return reindexDomain(source, Vshared), reindexDomain(target, Vshared)
[ 11748, 2298, 293, 198, 6738, 629, 541, 88, 13, 82, 29572, 1330, 42280, 62, 6759, 8609, 198, 11748, 299, 32152, 355, 45941, 628, 628, 198, 4299, 4808, 3866, 36942, 7, 38200, 9107, 11, 965, 2599, 198, 220, 220, 220, 1441, 4284, 9107, ...
2.837563
394
from typing import List
[ 6738, 19720, 1330, 7343, 198 ]
4.8
5
import numpy import tensorflow as tf import tensorflow_hub as hub import tf_sentencepiece
[ 11748, 299, 32152, 198, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 11748, 11192, 273, 11125, 62, 40140, 355, 12575, 198, 11748, 48700, 62, 34086, 594, 12239, 628 ]
3.285714
28
#!/usr/bin/env python """Creates the JADE configuration for stage 2 of the demo pipeline.""" import os import sys from jade.models import PipelineConfig from jade.utils.subprocess_manager import run_command from jade.utils.utils import load_data PRED_GDP_COMMANDS_FILE = "pred_gdp_commands.txt" if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 37811, 16719, 274, 262, 449, 19266, 8398, 329, 3800, 362, 286, 262, 13605, 11523, 526, 15931, 198, 198, 11748, 28686, 198, 11748, 25064, 198, 198, 6738, 474, 671, 13, 27530, 1330, ...
2.956522
115
# 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 oslo_config import cfg import passlib.utils from hamal.conf import utils max_password_length = cfg.IntOpt( 'max_password_length', default=4096, max=passlib.utils.MAX_PASSWORD_SIZE, help=utils.fmt(""" Maximum allowed length for user passwords. Decrease this value to improve performance. Changing this value does not effect existing passwords. """)) password_hash_algorithm = cfg.StrOpt( 'password_hash_algorithm', choices=['bcrypt', 'scrypt', 'pbkdf2_sha512'], default='bcrypt', help=utils.fmt(""" The password hashing algorithm to use for passwords stored within hamal. """)) password_hash_rounds = cfg.IntOpt( 'password_hash_rounds', help=utils.fmt(""" This option represents a trade off between security and performance. Higher values lead to slower performance, but higher security. Changing this option will only affect newly created passwords as existing password hashes already have a fixed number of rounds applied, so it is safe to tune this option in a running cluster. The default for bcrypt is 12, must be between 4 and 31, inclusive. The default for scrypt is 16, must be within `range(1,32)`. The default for pbkdf_sha512 is 60000, must be within `range(1,1<32)` WARNING: If using scrypt, increasing this value increases BOTH time AND memory requirements to hash a password. """)) salt_bytesize = cfg.IntOpt( 'salt_bytesize', min=0, max=96, help=utils.fmt(""" Number of bytes to use in scrypt and pbkfd2_sha512 hashing salt. Default for scrypt is 16 bytes. Default for pbkfd2_sha512 is 16 bytes. Limited to a maximum of 96 bytes due to the size of the column used to store password hashes. """)) scrypt_block_size = cfg.IntOpt( 'scrypt_block_size', help=utils.fmt(""" Optional block size to pass to scrypt hash function (the `r` parameter). Useful for tuning scrypt to optimal performance for your CPU architecture. This option is only used when the `password_hash_algorithm` option is set to `scrypt`. Defaults to 8. """)) scrypt_paralellism = cfg.IntOpt( 'scrypt_parallelism', help=utils.fmt(""" Optional parallelism to pass to scrypt hash function (the `p` parameter). This option is only used when the `password_hash_algorithm` option is set to `scrypt`. Defaults to 1. """)) GROUP_NAME = __name__.split('.')[-1] ALL_OPTS = [ max_password_length, password_hash_algorithm, password_hash_rounds, scrypt_block_size, scrypt_paralellism, salt_bytesize ]
[ 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,...
3.149378
964
from __future__ import print_function __author__ = 'dneise, mnoethe' """ This file contains some functions to deal with FACT modified modified julian date The time used most of the time in FACT is the number of days since 01.01.1970 So this time is related to unix time, since it has the same offset (unix time is the number of seconds since 01.01.1970 00:00:00) but it is also related to "the" Modified Julian Date (MJD), which is used by astronomers in the sense, that it also counts days. According to http://en.wikipedia.org/wiki/Julian_day, there is quite a large number of somehow modified julian dates, of which the MJD is only one. So it might be okay, to introduce a new modification, going by the name of FACT Julian Date (FJD). """ import time import calendar from datetime import datetime import logging import dateutil import dateutil.parser OFFSET = (datetime(1970, 1, 1) - datetime(1, 1, 1)).days def fjd(datetime_inst): """ convert datetime instance to FJD """ if datetime_inst.tzinfo is None: logging.warning("datetime instance is not aware of its timezone." " Result possibly wrong!") return calendar.timegm(datetime_inst.utctimetuple()) / (24.*3600.) def iso2dt(iso_time_string): """ parse ISO time string to timezone aware datetime instance example 2015-01-23T08:08+01:00 """ datetime_inst = dateutil.parser.parse(iso_time_string) # make aware at any cost! if datetime_inst.tzinfo is None: print("ISO time string did not contain timezone info. I assume UTC!") datetime_inst = datetime_inst.replace(tzinfo=dateutil.tz.tzutc()) return datetime_inst def run2dt(run_string): """ parse typical FACT run file path string to datetime instance (UTC) example first you do this: "/path/to/file/20141231.more_text" --> "20141231" then call run2dt("20141231") """ format_ = "%Y%m%d" datetime_inst = datetime.strptime(run_string, format_) datetime_inst = datetime_inst.replace(tzinfo=dateutil.tz.tzutc()) return datetime_inst def facttime(time_string): """ conver time-string with format %Y%m%d %H:%M to fact time """ return calendar.timegm(time.strptime( time_string, "%Y%m%d %H:%M")) / (24.*3600.) def to_datetime(fact_julian_date): """ convert facttime to datetime instance """ unix_time = fact_julian_date*24*3600 datetime_inst = datetime.utcfromtimestamp(unix_time) return datetime_inst def datestr(datetime_inst): """ make iso time string from datetime instance """ return datetime_inst.isoformat("T")
[ 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 198, 834, 9800, 834, 796, 705, 67, 710, 786, 11, 285, 3919, 10567, 6, 198, 198, 37811, 770, 2393, 4909, 617, 5499, 284, 1730, 351, 376, 10659, 9518, 9518, 474, 377, 666, 3128, 198,...
2.775316
948
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ..utils import ImageMath
[ 2, 47044, 46, 12, 35353, 1137, 11617, 416, 4899, 14, 42116, 431, 6359, 13, 9078, 532, 8410, 5626, 48483, 198, 6738, 11485, 26791, 1330, 7412, 37372, 628, 198 ]
3.071429
28
import chainer import numpy import pytest import chainerx import chainerx.testing from chainerx_tests import array_utils from chainerx_tests import dtype_utils from chainerx_tests import math_utils from chainerx_tests import op_utils _in_out_dtypes_arithmetic_invalid = [ (('bool_', 'bool_'), 'bool_'), (('bool_', 'int8'), 'int8'), (('bool_', 'int16'), 'int16'), (('bool_', 'int32'), 'int32'), (('bool_', 'int64'), 'int64'), (('bool_', 'uint8'), 'uint8'), (('bool_', 'float16'), 'float16'), (('bool_', 'float32'), 'float32'), (('bool_', 'float64'), 'float64'), (('int8', 'bool_'), 'int8'), (('int16', 'bool_'), 'int16'), (('int32', 'bool_'), 'int32'), (('int64', 'bool_'), 'int64'), (('uint8', 'bool_'), 'uint8'), (('float16', 'bool_'), 'float16'), (('float32', 'bool_'), 'float32'), (('float64', 'bool_'), 'float64'), ] _in_out_dtypes_arithmetic = [ dtypes for dtypes in dtype_utils.result_dtypes_two_arrays if dtypes not in _in_out_dtypes_arithmetic_invalid ] _in_out_dtypes_inplace_arithmetic_invalid = [ ((t1, t2), t3) for (t1, t2), t3 in _in_out_dtypes_arithmetic if (numpy.dtype(t1).kind != 'f' and numpy.dtype(t2).kind == 'f') ] + _in_out_dtypes_arithmetic_invalid _in_out_dtypes_inplace_arithmetic = [ dtypes for dtypes in dtype_utils.result_dtypes_two_arrays if dtypes not in _in_out_dtypes_inplace_arithmetic_invalid ] _in_out_dtypes_array_int_scalar = [ # Int scalar. (('int8',), int, 'int8'), (('int16',), int, 'int16'), (('int32',), int, 'int32'), (('int64',), int, 'int64'), (('uint8',), int, 'uint8'), (('float16',), int, 'float16'), (('float32',), int, 'float32'), (('float64',), int, 'float64'), (('int16',), numpy.int16, 'int16'), (('uint8',), numpy.int8, 'uint8'), (('float64',), numpy.int8, 'float64'), (('float16',), numpy.int64, 'float16'), ] _in_out_dtypes_int_array_float_scalar = [ # Int arrays and float scalars. (('int8',), float, 'float32'), (('int16',), float, 'float32'), (('int32',), float, 'float32'), (('int64',), float, 'float32'), (('uint8',), float, 'float32'), (('int8',), numpy.float32, 'float32'), (('int64',), numpy.float16, 'float32'), (('uint8',), numpy.float64, 'float32'), ] _in_out_dtypes_float_array_float_scalar = [ # Float arrays and flaot scalars. (('float16',), float, 'float16'), (('float32',), float, 'float32'), (('float64',), float, 'float64'), (('float64',), float, 'float64'), (('float16',), numpy.float64, 'float16'), (('float64',), numpy.float16, 'float64'), ] _in_out_dtypes_arithmetic_scalar = ( _in_out_dtypes_array_int_scalar + _in_out_dtypes_int_array_float_scalar + _in_out_dtypes_float_array_float_scalar) _in_out_dtypes_inplace_arithmetic_scalar = ( _in_out_dtypes_array_int_scalar + _in_out_dtypes_float_array_float_scalar) _in_out_dtypes_float_arithmetic_scalar = ( _in_out_dtypes_int_array_float_scalar + _in_out_dtypes_float_array_float_scalar) _in_out_dtypes_inplace_float_arithmetic_scalar = ( _in_out_dtypes_float_array_float_scalar) # TODO(imanishi): Support and test zero division and mixed dtypes. # TODO(imanishi): Support and test chainerx.Scalar // chainerx.ndarray. # TODO(imanishi): Support and test bool dtype. _in_out_dtypes_inplace_truediv = [ (('float32', 'int16'), 'float32'), (('float64', 'uint8'), 'float64'), (('float16', 'float16'), 'float16'), (('float32', 'float32'), 'float32'), (('float64', 'float64'), 'float64'), (('float32', 'float16'), 'float32'), (('float16', 'float64'), 'float64'), ] _in_out_dtypes_truediv = _in_out_dtypes_inplace_truediv + [ (('int8', 'int8'), 'float32'), (('int16', 'int16'), 'float32'), (('int32', 'int32'), 'float32'), (('int64', 'int64'), 'float32'), (('uint8', 'uint8'), 'float32'), (('int8', 'int32'), 'float32'), (('uint8', 'int64'), 'float32'), (('int8', 'uint8'), 'float32'), (('int32', 'float16'), 'float16'), (('uint8', 'float32'), 'float32'), ] _in_out_dtypes_inplace_truediv_scalar = [ (('int8',), int, 'float32'), (('int16',), int, 'float32'), (('int32',), int, 'float32'), (('int64',), int, 'float32'), (('uint8',), int, 'float32'), (('float16',), int, 'float16'), (('float32',), int, 'float32'), (('float64',), int, 'float64'), (('float16',), float, 'float16'), (('float32',), float, 'float32'), (('float64',), float, 'float64'), ] _in_out_dtypes_truediv_scalar = _in_out_dtypes_inplace_truediv_scalar + [ (('int8',), float, 'float32'), (('int16',), float, 'float32'), (('int32',), float, 'float32'), (('int64',), float, 'float32'), (('uint8',), float, 'float32'), ] # TODO(hvy): Support and test zero division and mixed dtypes (dtype kinds). def _create_dummy_array_for_dot(xp, shape, dtype): x = numpy.arange(numpy.prod(shape)).reshape(shape) if dtype == 'bool_': x = numpy.asarray(x % 2 == 0) else: x = x.astype(dtype) return xp.array(x) _logsumexp_params = [ ((2,), 0), ((2,), -1), ((2, 3), None), ((2, 3), 0), ((2, 3), 1), ((2, 3), -2), ((2, 3), (0, 1)), ((2, 3), (-2, 1)), ((1, 2, 3), None), ((1, 2, 3), (1)), ((1, 2, 3), (1, 0)), ((1, 2, 3), (0, 1, 2)), ] _invalid_logsumexp_params = [ # Axis out of bounds ((2,), 1), ((2,), -2), ((2,), (0, 1)), ((2, 3), (0, 1, 2)), # Duplicate axes ((2,), (0, 0)), ((2, 3), (0, 0)), ]
[ 11748, 6333, 263, 198, 11748, 299, 32152, 198, 11748, 12972, 9288, 198, 198, 11748, 6333, 263, 87, 198, 11748, 6333, 263, 87, 13, 33407, 198, 198, 6738, 6333, 263, 87, 62, 41989, 1330, 7177, 62, 26791, 198, 6738, 6333, 263, 87, 62, ...
2.177786
2,593
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. # # What is the 10 001st prime number? primes = [] for i in range(2, 100): if len(primes) == 10001: break x = list(map(lambda y: i % y == 0, range(2,i))) if sum(x) == False: primes.append(i) print(i) print(primes[-1] , "Len: ", len(primes)) # x = list(map(lambda y: i % y == 0, range(2,i)))
[ 198, 198, 2, 2750, 13487, 262, 717, 2237, 6994, 3146, 25, 362, 11, 513, 11, 642, 11, 767, 11, 1367, 11, 290, 1511, 11, 356, 460, 766, 326, 262, 718, 400, 6994, 318, 1511, 13, 198, 2, 198, 2, 1867, 318, 262, 838, 3571, 16, 301,...
2.20297
202
import os import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt SAVE_ROOT = '../../figs_sigcomm22' plt.style.use('seaborn-deep') plt.rcParams['font.family'] = 'Arial' # plt.rcParams['font.size'] = 42 # plt.rcParams['axes.labelsize'] = 42 # plt.rcParams['legend.fontsize'] = 42 # plt.rcParams['figure.figsize'] = (11, 9) plt.rcParams['font.size'] = 36 plt.rcParams['axes.labelsize'] = 36 plt.rcParams['axes.titlesize'] = 36 plt.rcParams['legend.fontsize'] = 36 plt.rcParams['svg.fonttype'] = 'none' HATCHES = ['/', '\\', 'x', 'o', '.', 'O', '-', '*', '+'] WIDTH = 0.3 bbr_reward, bbr_tput, bbr_tail_lat, bbr_loss = 118.07, 5.23, 517.02, 0.05 copa_reward, copa_tput, copa_tail_lat, copa_loss = 255.84, 4.58, 333.47, 0.01 cubic_reward, cubic_tput, cubic_tail_lat, cubic_loss = 69.75, 5.40, 858.46, 0.02 vivace_reward, vivace_tput, vivace_tail_lat, vivace_loss = -404.59, 4.04, 864.41, 0.21 vivace_latency_reward, vivace_latency_tput, vivace_latency_tail_lat, vivace_latency_loss = -422.16, 4.40, 888.76, 0.22 vivace_loss_reward = -616.31 #5.04 941.72 0.32 genet_reward = 252.28 genet_reward_err = 6.46 genet_tput, genet_tail_lat, genet_loss = 5.02, 251.02, 0.02 udr1_reward = 142.31 udr1_reward_err = 23.78 # udr1_tput, udr1_tail_lat, udr1_loss = 4.59, 418.87, 0.03 udr2_reward = 187.61 udr2_reward_err = 5.03 # udr2_tput, udr2_tail_lat, udr2_loss = 4.74, 408.95, 0.01 udr3_reward = 203.96 udr3_reward_err = 4.05 # 4.74 386.01 0.01 udr3_tput, udr3_tail_lat, udr3_loss = 4.74, 386.01, 0.01 real_reward = 171.61 real_reward_err = 3.18 # 5.01 459.23 0.02 cl1_reward = 206.56 cl1_reward_err = 3.07 # 4.88 413.40 0.01 cl2_reward = 211.89 cl2_reward_err = 4.05 # 4.82 419.74 0.00 column_wid = 0.7 capsize_wid = 8 eline_wid = 2 if __name__ == '__main__': cellular_bars() # cc_scatter()
[ 11748, 28686, 198, 198, 11748, 2603, 29487, 8019, 198, 6759, 29487, 8019, 13, 1904, 10786, 46384, 11537, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 198, 4090, 6089, 62, 13252, 2394, 796, 705, 40720, 40720, 5647, ...
1.948691
955
from .stop_words import STOP_WORDS from .lex_attrs import LEX_ATTRS from ...language import Language, BaseDefaults from ...tokens import Doc from ...util import DummyTokenizer, registry, load_config_from_str from ...vocab import Vocab DEFAULT_CONFIG = """ [nlp] [nlp.tokenizer] @tokenizers = "spacy.th.ThaiTokenizer" """ __all__ = ["Thai"]
[ 6738, 764, 11338, 62, 10879, 1330, 44934, 62, 45359, 5258, 198, 6738, 764, 2588, 62, 1078, 3808, 1330, 406, 6369, 62, 1404, 5446, 50, 198, 6738, 2644, 16129, 1330, 15417, 11, 7308, 7469, 13185, 198, 6738, 2644, 83, 482, 641, 1330, 144...
2.837398
123
from .args import args from .extensions import extensions from .logger import logger from .routes import routes __all__ = ['args', 'extensions', 'logger', 'routes']
[ 6738, 764, 22046, 1330, 26498, 198, 6738, 764, 2302, 5736, 1330, 18366, 198, 6738, 764, 6404, 1362, 1330, 49706, 198, 6738, 764, 81, 448, 274, 1330, 11926, 628, 198, 834, 439, 834, 796, 37250, 22046, 3256, 705, 2302, 5736, 3256, 705, ...
3.34
50
#!/usr/bin/python # -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # /******************************************************* # * Copyright (C) 2013-2014 CloudRunner.io <info@cloudrunner.io> # * # * Proprietary and confidential # * This file is part of CloudRunner Server. # * # * CloudRunner Server can not be copied and/or distributed # * without the express permission of CloudRunner.io # *******************************************************/ import json import os import requests import tempfile from cloudrunner import VAR_DIR from .base import BaseCloudProvider, CR_SERVER HEADERS = {'Content-Type': 'application/json'}
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 43907, 25, 7400, 11338, 28, 19, 6482, 10394, 28, 19, 2705, 8658, 11338, 28, 19, 198, 198, 2, 1220, 17174, 8412, 2466, 8...
3.478947
190
# -*- coding: utf-8 -*- # This code is licensed under the MIT License (see LICENSE file for details) import platform import datetime import sys import pathlib import subprocess import time from .. import scope_job_runner from ..config import scope_configuration TIMER_UNIT = '''[Unit] Description=Check that scope_job_runner is active if jobs are queued [Timer] OnBootSec=15min OnUnitActiveSec=45min [Install] WantedBy=timers.target ''' SERVICE_UNIT = '''[Unit] Description=Check that scope_job_runner is active if jobs are queued [Service] ExecStart={executable} ''' ERROR_SUBJECT = '{host}: scope job pending but scope_job_runner is inactive.' ERROR_MESSAGE = '''One or more of your jobs is overdue on {host}, but the scope job runner daemon is not running. These jobs will not be run until the command `scope_job_runner start` is executed on that machine. Time: {time} Queued Jobs: {jobs} ''' ALL_CLEAR_SUBJECT = '{host}: scope_job_runner was reactivated.' ALL_CLEAR_MESSAGE = '''One or more of your jobs on {host} was stalled due to an inactive job runner. The job runner has now been restarted and your jobs will be run as planned. Time: {time} Queued Jobs: {jobs} '''
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 770, 2438, 318, 11971, 739, 262, 17168, 13789, 357, 3826, 38559, 24290, 2393, 329, 3307, 8, 198, 198, 11748, 3859, 198, 11748, 4818, 8079, 198, 11748, 25064, 198, 117...
3.137566
378
import copy import json import os from ark.utils import io_utils def rename_missing_fovs(fov_data): """Identify FOVs that are missing the 'name' key and create one with value placeholder_{n} Args: fov_data (dict): the FOV run JSON data Returns: dict: a copy of the run JSON data with placeholder names for FOVs that lack one """ copy_fov_data = copy.deepcopy(fov_data) # count of FOVs that are missing the 'name' key missing_count = 0 # iterate over each FOV and add a placeholder name if necessary for fov in copy_fov_data['fovs']: if 'name' not in fov.keys(): missing_count += 1 fov['name'] = f'placeholder_{missing_count}' return copy_fov_data def rename_duplicate_fovs(tma_fovs): """Identify and rename duplicate FOV names in `fov_list` For a given FOV name, the subsequent duplicates get renamed `{FOV}_duplicate{n}` Args: tma_fovs (dict): The TMA run JSON, should contain a `'fovs'` key defining the list of FOVs Returns: dict: The same run JSON with the FOVs renamed to account for duplicates """ # used for identifying the number of times each FOV was found fov_count = {} # iterate over each FOV for fov in tma_fovs['fovs']: if fov['name'] not in fov_count: fov_count[fov['name']] = 0 fov_count[fov['name']] += 1 if fov_count[fov['name']] > 1: fov['name'] = '%s_duplicate%d' % (fov['name'], fov_count[fov['name']] - 1) return tma_fovs def list_moly_fovs(bin_file_dir): """Lists all of the FOVs in a directory which are moly FOVs Args: bin_file_dir (str): path to bin files Returns: list: list of FOVs which are moly FOVs""" json_files = io_utils.list_files(bin_file_dir, '.json') moly_fovs = [] for file in json_files: json_path = os.path.join(bin_file_dir, file) with open(json_path, 'r') as jp: json_file = json.load(jp) if json_file.get('standardTarget', "") == "Molybdenum Foil": moly_name = file.split('.json')[0] moly_fovs.append(moly_name) return moly_fovs
[ 11748, 4866, 198, 11748, 33918, 198, 11748, 28686, 198, 198, 6738, 610, 74, 13, 26791, 1330, 33245, 62, 26791, 628, 198, 4299, 36265, 62, 45688, 62, 69, 709, 82, 7, 69, 709, 62, 7890, 2599, 198, 220, 220, 220, 37227, 33234, 1958, 37...
2.246714
989
from systems.plugins.index import BaseProvider import os
[ 6738, 3341, 13, 37390, 13, 9630, 1330, 7308, 29495, 198, 198, 11748, 28686, 628 ]
4.214286
14
# ============================================================================ # FILE: outline.py # AUTHOR: Yasumasa Tamura (tamura.yasumasa _at_ gmail.com) # License: MIT license # ============================================================================ from .base import Base from subprocess import check_output, CalledProcessError from denite.util import parse_tagline import re import tempfile OUTLINE_HIGHLIGHT_SYNTAX = [ {'name': 'Name', 'link': 'Identifier', 're': '\S\+\%(\s\+\[\)\@='}, {'name': 'Type', 'link': 'Type', 're': '\[.\{-}\]'}, {'name': 'Ref', 'link': 'Comment', 're': '\s\s.\+'} ]
[ 2, 38093, 2559, 18604, 198, 2, 45811, 25, 19001, 13, 9078, 198, 2, 44746, 25, 25957, 388, 15462, 11552, 5330, 357, 83, 37324, 13, 88, 292, 388, 15462, 4808, 265, 62, 308, 4529, 13, 785, 8, 198, 2, 13789, 25, 17168, 5964, 198, 2, ...
2.976415
212
from base64 import b64encode from app import app import unittest from mock import patch import os import json from twython import Twython if __name__ == '__main__': unittest.main()
[ 6738, 2779, 2414, 1330, 275, 2414, 268, 8189, 198, 6738, 598, 1330, 598, 198, 11748, 555, 715, 395, 198, 6738, 15290, 1330, 8529, 198, 11748, 28686, 198, 11748, 33918, 198, 6738, 665, 7535, 1330, 1815, 7535, 198, 198, 361, 11593, 3672, ...
3.152542
59
# Converts a given temperature from Celsius to Fahrenheit # Prompt user for Celsius temperature degreesCelsius = float(input('\nEnter the temperature in Celsius: ')) # Calculate and display the converted # temperature in Fahrenheit degreesFahrenheit = ((9.0 / 5.0) * degreesCelsius) + 32 print('Fahrenheit equivalent: ', format(degreesFahrenheit, ',.1f'), '\n', sep='')
[ 2, 1482, 24040, 257, 1813, 5951, 422, 34186, 284, 35935, 198, 198, 2, 45965, 2836, 329, 34186, 5951, 198, 13500, 6037, 34, 32495, 796, 12178, 7, 15414, 10786, 59, 77, 17469, 262, 5951, 287, 34186, 25, 705, 4008, 198, 198, 2, 27131, ...
3.509434
106
from bs4 import BeautifulSoup from django.db import models from django.utils.translation import ugettext_lazy as _ from taggit.managers import TaggableManager
[ 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 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, 6738, 7621, 18300, 13, 805, 10321, 1330, 30...
3.478261
46
# -*- coding: utf-8 -*- from __future__ import absolute_import import six from sentry.api.serializers import serialize from sentry.api.serializers.models.alert_rule import DetailedAlertRuleSerializer from sentry.incidents.logic import create_alert_rule, create_alert_rule_trigger from sentry.incidents.models import AlertRuleThresholdType from sentry.snuba.models import QueryAggregations from sentry.testutils import TestCase
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 198, 11748, 2237, 198, 198, 6738, 1908, 563, 13, 15042, 13, 46911, 11341, 1330, 11389, 1096, 198, 6738, 1908, 5...
3.409449
127
import os from ..utils import add_jobs_argument from ..utils import add_no_ccache_argument from ..utils import add_optimize_argument from ..utils import add_verbose_argument from ..utils import build_prepare from ..utils import run
[ 11748, 28686, 198, 198, 6738, 11485, 26791, 1330, 751, 62, 43863, 62, 49140, 198, 6738, 11485, 26791, 1330, 751, 62, 3919, 62, 535, 4891, 62, 49140, 198, 6738, 11485, 26791, 1330, 751, 62, 40085, 1096, 62, 49140, 198, 6738, 11485, 26791...
3.615385
65
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2018 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause OR GPL-3.0-only # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: nsxt_transport_node_collections short_description: Create transport node collection by attaching Transport Node Profile to cluster. description: When transport node collection is created the hosts which are part of compute collection will be prepared automatically i.e. NSX Manager attempts to install the NSX components on hosts. Transport nodes for these hosts are created using the configuration specified in transport node profile. version_added: "2.7" author: Rahul Raghuvanshi options: hostname: description: Deployed NSX manager hostname. required: true type: str username: description: The username to authenticate with the NSX manager. required: true type: str password: description: The password to authenticate with the NSX manager. required: true type: str cluster_name: description: CLuster Name required: false type: str compute_manager_name: description: Cluster Manager Name required: false type: str description: description: Description required: true type: str display_name: description: Display name required: true type: str resource_type: description: "Must be set to the value TransportNodeCollection" required: true type: str state: choices: - present - absent description: "State can be either 'present' or 'absent'. 'present' is used to create or update resource. 'absent' is used to delete resource." required: true transport_node_profile_name: description: Transport Node Profile Names required: true type: str ''' EXAMPLES = ''' - name: Create transport node collection nsxt_transport_node_collections: hostname: "{{hostname}}" username: "{{username}}" password: "{{password}}" validate_certs: False display_name: "TNC1" resource_type: "TransportNodeCollection" description: "Transport Node Collections 1" compute_manager_name: "VC1" cluster_name: "cl1" transport_node_profile_name: "TNP1" state: present ''' RETURN = '''# ''' import json, time from ansible.module_utils.basic import AnsibleModule from ansible_collections.vmware.ansible_for_nsxt.plugins.module_utils.vmware_nsxt import vmware_argument_spec, request from ansible.module_utils._text import to_native import ssl import socket import hashlib if __name__ == '__main__': main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 198, 2, 15069, 2864, 37754, 11, 3457, 13, 198, 2, 30628, 55, 12, 34156, 12, 33234, 7483, 25, 347, 10305, 12, 17,...
2.706983
1,389
import numpy as np import torch from torch_utils import training_stats from torch_utils import misc from torch_utils.ops import conv2d_gradfix import torch.nn.functional as F import torchvision.transforms as T import clip import dnnlib import random #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
[ 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28034, 198, 6738, 28034, 62, 26791, 1330, 3047, 62, 34242, 198, 6738, 28034, 62, 26791, 1330, 12747, 198, 6738, 28034, 62, 26791, 13, 2840, 1330, 3063, 17, 67, 62, 9744, 13049, 198, 11748,...
5.891566
83
import time import logging from bandl.nse_data import NseData from influxdb import InfluxDBClient
[ 11748, 640, 198, 11748, 18931, 198, 6738, 4097, 75, 13, 77, 325, 62, 7890, 1330, 399, 325, 6601, 198, 6738, 25065, 9945, 1330, 4806, 22564, 11012, 11792, 198 ]
3.5
28
from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn.metrics import accuracy_score from sklearn.metrics import roc_auc_score import numpy as np import pandas as pd import matplotlib.pyplot as plt
[ 6738, 1341, 35720, 13, 19849, 62, 49283, 1330, 4512, 62, 9288, 62, 35312, 198, 6738, 1341, 35720, 1330, 20731, 198, 6738, 1341, 35720, 13, 4164, 10466, 1330, 9922, 62, 26675, 198, 6738, 1341, 35720, 13, 4164, 10466, 1330, 686, 66, 62, ...
3.414286
70
# Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """A simple cross-platform helper to create an RPM package.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import contextlib import fileinput import os import re import shutil import subprocess import sys from tempfile import mkdtemp # pylint: disable=g-direct-third-party-import from third_party.py import gflags gflags.DEFINE_string('name', '', 'The name of the software being packaged.') gflags.DEFINE_string('version', '', 'The version of the software being packaged.') gflags.DEFINE_string('release', '', 'The release of the software being packaged.') gflags.DEFINE_string('arch', '', 'The CPU architecture of the software being packaged.') gflags.DEFINE_string('spec_file', '', 'The file containing the RPM specification.') gflags.DEFINE_string('out_file', '', 'The destination to save the resulting RPM file to.') # Setup to safely create a temporary directory and clean it up when done. def GetFlagValue(flagvalue, strip=True): if flagvalue: if flagvalue[0] == '@': with open(flagvalue[1:], 'r') as f: flagvalue = f.read() if strip: return flagvalue.strip() return flagvalue WROTE_FILE_RE = re.compile(r'Wrote: (?P<rpm_path>.+)', re.MULTILINE) def FindOutputFile(log): """Find the written file from the log information.""" m = WROTE_FILE_RE.search(log) if m: return m.group('rpm_path') return None def CopyAndRewrite(input_file, output_file, replacements=None): """Copies the given file and optionally rewrites with replacements. Args: input_file: The file to copy. output_file: The file to write to. replacements: A dictionary of replacements. Keys are prefixes scan for, values are the replacements to write after the prefix. """ with open(output_file, 'w') as output: for line in fileinput.input(input_file): if replacements: for prefix, text in replacements.items(): if line.startswith(prefix): line = prefix + ' ' + text + '\n' break output.write(line) if __name__ == '__main__': FLAGS = gflags.FLAGS main(FLAGS(sys.argv))
[ 2, 15069, 2177, 383, 347, 41319, 46665, 13, 1439, 2489, 10395, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, ...
2.9
990
import os import pickle import random from torch.utils.data import Dataset from .datasets import dataset_register default_split = { 'train': 0.7, 'val': 0.3, } if __name__ == '__main__': gb_100 = GB100( root_path='/space1/zhaoqing/dataset/fsl/gb-100', split='val', split_method='novel') print(len(gb_100)) # random # val 3840 # train 8960 # novel # val 4000 # train 8800
[ 11748, 28686, 198, 11748, 2298, 293, 198, 11748, 4738, 198, 198, 6738, 28034, 13, 26791, 13, 7890, 1330, 16092, 292, 316, 198, 198, 6738, 764, 19608, 292, 1039, 1330, 27039, 62, 30238, 198, 198, 12286, 62, 35312, 796, 1391, 198, 220, ...
2.278075
187
#!/usr/bin/env python # # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # # Re-analyze all images that don't have latest version of the analysis available from freta.api import Freta if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 198, 2, 15069, 357, 66, 8, 5413, 10501, 13, 198, 2, 49962, 739, 262, 17168, 13789, 13, 198, 2, 198, 2, 797, 12, 38200, 2736, 477, 4263, 326, 836, 470, 423, 3452, 2196, 286, 26...
3.205128
78
import numpy as np import tensorflow as tf from keras import backend as K from tqdm import tqdm
[ 11748, 299, 32152, 355, 45941, 201, 198, 11748, 11192, 273, 11125, 355, 48700, 201, 198, 6738, 41927, 292, 1330, 30203, 355, 509, 201, 198, 6738, 256, 80, 36020, 1330, 256, 80, 36020, 201, 198 ]
2.941176
34
"""TrafficSignDataset dataset.""" from .TrafficSignsDataset import Trafficsignsdataset
[ 37811, 15721, 2108, 11712, 27354, 292, 316, 27039, 526, 15931, 198, 198, 6738, 764, 15721, 2108, 11712, 82, 27354, 292, 316, 1330, 31203, 873, 570, 82, 19608, 292, 316, 198 ]
2.933333
30
#Refaa o DESAFIO 035 dos tringulos, acrescentando o recurso de mostrar que tipo de tringulo ser formado: #- EQUILTERO: todos os lados iguais #- ISSCELES: dois lados iguais, um diferente #- ESCALENO: todos os lados diferentes print('-' * 20, 'Programa Analisador de Tringulos', '-' * 20) seg1 = float(input('Digite o valor do primeiro segmento: ')) seg2 = float(input('Digite o valor do segundo segmento: ')) seg3 = float(input('Digite o valor do terceiro segmento: ')) if seg1 < seg2 + seg3 and seg2 < seg1 + seg3 and seg3 < seg1 + seg2: if seg1 == seg2 and seg3: # outra possibilidade --> seg1 == seg2 == seg3: print('Os segmentos PODEM formar um tringulo do tipo EQUILTERO!') elif seg1 != seg2 != seg3 != seg1: print('Os segmentos acima PODEM formar um tringulo do tipo ESCALENO!') else: print('Os segmentos acima PODEM formar um tringulo do tipo ISSCELES!') else: print('Os segmentos NO PODEM formar um tringulo!')
[ 2, 8134, 7252, 267, 22196, 8579, 9399, 657, 2327, 23430, 491, 278, 377, 418, 11, 16051, 1087, 25440, 267, 664, 333, 568, 390, 749, 20040, 8358, 8171, 78, 390, 491, 278, 43348, 1055, 1296, 4533, 25, 198, 2, 12, 46886, 4146, 5781, 46,...
2.348039
408
from mopidy_vfd import Extension
[ 6738, 285, 404, 19325, 62, 85, 16344, 1330, 27995, 628, 198 ]
3.181818
11