content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
from __future__ import unicode_literals from django.db import migrations, models
[ 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
3.608696
23
# 018 - Faa um programa que leia um ngulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse ngulo. ''' from math import sin, cos, tan ang = float(input('Digite um ngulo: ')) sen = sin(ang) cos = cos(ang) tan = tan(ang) print('ngulo de {}: \n Seno = {:.2f} \n Cosseno = {:.2f} \n Tangente = {:.2f}'.format(ang, sen, cos, tan)) ''' ''' # apenas faltou conventer para radiano: import math ang = float(input('Digite um ngulo: ')) sen = math.sin(math.radians(ang)) cos = math.cos(math.radians(ang)) tan = math.tan(math.radians(ang)) print('O ngulo de {} tem o SENO de {:.2f}'.format(ang, sen)) print('O ngulo de {} tem o COSSENO de {:.2f}'.format(ang, cos)) print('O ngulo de {} tem a TANGENTE de {:.2f}'.format(ang, tan)) ''' # importando somente o que vamos utilizar: sin, cos, tan, radians from math import sin, cos, tan, radians ang = float(input('Digite um ngulo: ')) sen = sin(radians(ang)) cos = cos(radians(ang)) tan = tan(radians(ang)) print('ngulo de {}: \n Seno = {:.2f} \n Cosseno = {:.2f} \n Tangente = {:.2f}'.format(ang, sen, cos, tan))
[ 2, 5534, 23, 532, 376, 7252, 23781, 1430, 64, 8358, 443, 544, 23781, 23370, 43348, 4140, 10819, 304, 749, 260, 12385, 256, 10304, 267, 1188, 273, 466, 3308, 78, 11, 269, 793, 23397, 304, 13875, 21872, 748, 325, 23370, 43348, 13, 198, ...
2.441913
439
import torch from torch import nn import torchvision import torch.nn.functional as F import time import os
[ 11748, 28034, 198, 6738, 28034, 1330, 299, 77, 198, 11748, 28034, 10178, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 198, 11748, 640, 198, 11748, 28686 ]
3.925926
27
import math result = [1] * 4355 list = [] flag = '' Sigma = ['A', 'C', 'T'] f = open('./cresci_text/finalTest1.txt', 'r', encoding='UTF-8') for line in f: list.append(line[line.find(' ', 2) + 1: -1]) f.close() for substring in Sigma: tryy(substring) for i in result: print(i)
[ 11748, 10688, 198, 198, 20274, 796, 685, 16, 60, 1635, 604, 28567, 198, 4868, 796, 17635, 198, 32109, 796, 10148, 628, 198, 198, 50, 13495, 796, 37250, 32, 3256, 705, 34, 3256, 705, 51, 20520, 198, 198, 69, 796, 1280, 7, 4458, 14, ...
2.231343
134
import random from pyautonifty.constants import DRAWING_SIZE, YELLOW, BLACK, MAGENTA, BLUE from pyautonifty.pos import Pos from pyautonifty.drawing import Drawing from pyautonifty.renderer import Renderer if __name__ == "__main__": example_drawing = smiley_face(Drawing()) output_data = example_drawing.to_nifty_import() # Replace previous canvas contents in Nifty.Ink print(f"Lines: {len(example_drawing)}, " f"Points: {sum([len(line['points']) for line in example_drawing])}, " f"Size: {(len(output_data) / 1024.0 ** 2):.2f}MB") with open("output.txt", "w") as file: file.write(output_data) # Init render class. renderer = Renderer() # Render in a very accurate (but slower) way. renderer.render(example_drawing, filename="smiley_face_%Y_%m_%d_%H-%M-%S-%f.png", simulate=True, allow_transparency=True, proper_line_thickness=True, draw_as_bezier=True, step_size=10)
[ 11748, 4738, 198, 198, 6738, 12972, 2306, 261, 24905, 13, 9979, 1187, 1330, 360, 20530, 2751, 62, 33489, 11, 575, 23304, 3913, 11, 31963, 11, 28263, 3525, 32, 11, 9878, 8924, 198, 6738, 12972, 2306, 261, 24905, 13, 1930, 1330, 18574, ...
2.403941
406
import json import yaml from jsonschema import validate from cumulusci.utils.yaml import cumulusci_yml
[ 11748, 33918, 198, 198, 11748, 331, 43695, 198, 6738, 44804, 684, 2395, 2611, 1330, 26571, 198, 198, 6738, 10973, 23515, 979, 13, 26791, 13, 88, 43695, 1330, 10973, 23515, 979, 62, 88, 4029, 628 ]
3.117647
34
# -*- coding: utf-8 -*- # Copyright (c) 2019-2020 Christiaan Frans Rademan <chris@fwiw.co.za>. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # * Neither the name of the copyright holders nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # 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. import ssl import struct import socket import select import pickle from multiprocessing import Lock def Pipe(): sock1, sock2 = socket.socketpair() sock1.setblocking(False) sock2.setblocking(False) return (Socket(sock1), Socket(sock2),)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 357, 66, 8, 13130, 12, 42334, 1951, 544, 272, 1305, 504, 5325, 8463, 1279, 354, 2442, 31, 44482, 14246, 13, 1073, 13, 4496, 28401, 198, 2, 1439, 2489, 10395,...
3.404762
546
#! /usr/bin/env python3 "A script to perform the linear regression and create the plot." # Python program to # demonstrate merging of # two files # Creating a list of filenames filenames = ['A.591-search-immune-dmel-FlyBase_IDs.txt', 'B.432_search-defense-dmel-FlyBase_IDs.txt'] # Open file3 in write mode with open('C.search-immune-defense-dmel-FlyBase_IDs.txt', 'w') as outfile: # Iterate through list for names in filenames: # Open each file in read mode with open(names) as infile: # read the data from file1 and # file2 and write it in file3 outfile.write(infile.read()) # Add '\n' to enter data of file2 # from next line outfile.write("\n")
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 1, 32, 4226, 284, 1620, 262, 14174, 20683, 290, 2251, 262, 7110, 526, 198, 198, 2, 11361, 1430, 284, 198, 2, 10176, 35981, 286, 198, 2, 734, 3696, 198, 198, 2, 30481, ...
2.505085
295
all=['load']
[ 439, 28, 17816, 2220, 20520, 198 ]
2.166667
6
# encoding: utf-8 import os import pydoc import inspect import PySide import vs import sfm import sfmApp class SFMAttribute(object): def list_attrs(o): current_attribute = o.FirstAttribute() attributes = [] while current_attribute is not None: attributes.append(SFMAttribute(current_attribute)) current_attribute = current_attribute.NextAttribute() return attributes def getActiveControlsList(): animset = sfm.GetCurrentAnimationSet() c = sfmApp.GetDocumentRoot().settings.graphEditorState.activeControlList return c def getAnimationSetByName(name): shot = sfm.GetCurrentShot() for animset in shot.animationSets: if animset.name.GetValue() == name: return SFMAnimationSet(animset) def set_override_materials(override=True, jump=False): """Toggle override materials for current animation set by emulating clicking on "Add / Remove Override Materials" menu button""" qApp = PySide.QtGui.QApplication.instance() top = qApp.topLevelWidgets() override_status = 'Add Override Materials' if override else 'Remove Override Materials' for widget in top: if isinstance(widget, PySide.QtGui.QMenu): try: actions = widget.actions() override_action = None jump_to_ev_action = None for action in actions: if action.text() == 'Show in Element Viewer': jump_to_ev_action = action.menu().actions()[1] if action.text() == override_status: override_action = action if override_action: override_action.trigger() if jump and jump_to_ev_action: jump_to_ev_action.trigger() except RuntimeError: pass def debug_breakpoint(*kwargs): """Usable as a breakpoint for debugging animation set and dag scripts via external debugger - for example Wing IDE (can't recommend it enough). More on SFM scripts debugging: https://wingware.com/doc/howtos/sfm """ sfmApp.ProcessEvents() if __name__ == '__main__': main()
[ 2, 21004, 25, 3384, 69, 12, 23, 198, 198, 11748, 28686, 198, 11748, 279, 5173, 420, 198, 11748, 10104, 198, 198, 11748, 9485, 24819, 198, 11748, 3691, 198, 11748, 264, 38353, 198, 11748, 264, 38353, 4677, 628, 198, 4871, 14362, 5673, ...
2.449048
893
# Generated by Django 2.2 on 2021-09-14 07:38 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 319, 33448, 12, 2931, 12, 1415, 8753, 25, 2548, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.966667
30
# graphs.py # TODO: Import zeta function here or assume that the calling/loading program puts it into our global scope for us?
[ 2, 28770, 13, 9078, 198, 198, 2, 16926, 46, 25, 17267, 1976, 17167, 2163, 994, 393, 7048, 326, 262, 4585, 14, 25138, 1430, 7584, 340, 656, 674, 3298, 8354, 329, 514, 30 ]
3.96875
32
import pandas as pd import numpy as np from sklearn.linear_model import LogisticRegression from lightgbm import LGBMRegressor
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 1341, 35720, 13, 29127, 62, 19849, 1330, 5972, 2569, 8081, 2234, 198, 6738, 1657, 70, 20475, 1330, 406, 4579, 44, 8081, 44292, 628, 198 ]
3.368421
38
"""257. Binary Tree Paths""" # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right
[ 37811, 28676, 13, 45755, 12200, 10644, 82, 37811, 198, 198, 2, 30396, 329, 257, 13934, 5509, 10139, 13, 198, 2, 1398, 12200, 19667, 7, 15252, 2599, 198, 2, 220, 220, 220, 220, 825, 11593, 15003, 834, 7, 944, 11, 1188, 28, 15, 11, ...
2.371134
97
"""A tasks package, used to support different tasks that the bot can execute. Essentialy, one can define any kind of operation that the bot can perform over a type of input data (audio, text, video and voice). """
[ 37811, 32, 8861, 5301, 11, 973, 284, 1104, 1180, 8861, 326, 262, 10214, 460, 12260, 13, 198, 29508, 1843, 88, 11, 530, 460, 8160, 597, 1611, 286, 4905, 326, 262, 10214, 460, 1620, 625, 257, 2099, 198, 1659, 5128, 1366, 357, 24051, 1...
4.176471
51
# -*- coding: utf-8 -*- """ @Datetime: 2018/10/23 @Author: Zhang Yafei """ from django.forms import ModelForm, forms from crm import models
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 37811, 198, 31, 27354, 8079, 25, 2864, 14, 940, 14, 1954, 198, 31, 13838, 25, 19439, 575, 8635, 72, 198, 37811, 198, 6738, 42625, 14208, 13, 23914, 1330, 9104, 84...
2.6
55
import uuid from django.core.files.base import ContentFile from django.core.files.storage import default_storage from django.db.models import Q from BiSheServer import settings from api.model_json import queryset_to_json from user.models import UsersPerfer, UsersDetail, UserTag # api # # def modify_user_tag(self, user_id, tag_type, tag_name, tag_weight): user_tag = UserTag.objects.filter(Q(user_id=user_id) & Q(tag_type=tag_type) & Q(tag_name=tag_name)) if user_tag.exists(): # if type(tag_weight) == str: # old_tag_weight = int(user_tag.first().tag_weight) try: tag_weight = int(tag_weight) except Exception as ex: print("" + ex.__str__()) return "" if old_tag_weight != 0: # tag_weight = old_tag_weight + tag_weight else: # tag_weight = 5 + tag_weight user_tag.update(tag_weight=str(tag_weight)) else: self.add_user_tag(user_id, tag_type, tag_name, tag_weight) # #
[ 11748, 334, 27112, 198, 6738, 42625, 14208, 13, 7295, 13, 16624, 13, 8692, 1330, 14041, 8979, 198, 6738, 42625, 14208, 13, 7295, 13, 16624, 13, 35350, 1330, 4277, 62, 35350, 198, 6738, 42625, 14208, 13, 9945, 13, 27530, 1330, 1195, 198,...
2.01049
572
#!/usr/bin/env python #-*- coding: utf-8 -*- """ lib.py """ from string import printable as printable_chrs from collections import namedtuple from requests import get as re_get from datetime import datetime # Define constants API_URL = "http://dailydota2.com/match-api" Match = namedtuple("Match", ["timediff", "series_type", "link", "starttime", "status", "starttime_unix", "comment", "viewers", "team1", "team2", "league"]) def print_match(m, longest): "Do all the match info here" print("=== {} (best of {}) ===".format(m.league["name"], m.series_type)) print("{[team_name]:<{width}} vs. {[team_name]:>{width}}".format( m.team1, m.team2, width=longest)) print(display_time(m)) print() def display_time(m): """Convert unix time to readable""" x = int(m.timediff) if x <= 0: return "***Currently Running***" return "Time until: {}".format( datetime.fromtimestamp(x).strftime("%H:%M:%S")) def main(*args, **kwargs): """ Main function Retrieves, forms data, and prints out information """ print() # First retrieve the JSON data = get_url(API_URL) # Interpret results into a list of matches matches = [Match(**unpack) for unpack in data["matches"]] # Find the longest team name and create dynamic alignment longest = get_longest(matches) # Print out a list of all matches (possibly order by the Unix timestamp) for match in matches: print_match(match, longest) if __name__ == "__main__": main() # end
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 12, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 37811, 198, 8019, 13, 9078, 198, 37811, 198, 198, 6738, 4731, 1330, 3601, 540, 355, 3601, 540, 62, 354, 3808, 198...
2.49766
641
import sys if len(sys.argv) <= 1: print("python vv_hash.py property_name") exit(0) propertyName = sys.argv[1] if len(propertyName) == 0: print("empty element name") exit(0) hashCode = 0 for i in range(0, len(propertyName)): hashCode = (31 * hashCode + ord(propertyName[i])) & 0xFFFFFFFF if hashCode > 0x7FFFFFFF: hashCode = hashCode - 0x100000000 print("hash code: %d" % (hashCode))
[ 11748, 25064, 198, 198, 361, 18896, 7, 17597, 13, 853, 85, 8, 19841, 352, 25, 198, 220, 220, 220, 3601, 7203, 29412, 410, 85, 62, 17831, 13, 9078, 3119, 62, 3672, 4943, 198, 220, 220, 220, 8420, 7, 15, 8, 198, 198, 26745, 5376, ...
2.410405
173
"""Test COUNTER JR1 journal report (TSV)"""
[ 37811, 14402, 31404, 5781, 32598, 16, 3989, 989, 357, 4694, 53, 8, 37811, 628, 198 ]
3.066667
15
from app import create_app, db from flask_migrate import Migrate from app.models import User, Posts from flask_script import Manager,Server app = create_app() # manager = Manager(app) # manager.add_command('server', Server) # #Creating migration instance # migrate = Migrate(app, db) # manager.add_command('db',MigrateCommand) # # @manager.shell # @manager.shell_context_processor # def make_shell_context(): # return dict(db = db, User =User, Posts=Posts) # if __name__ == '__main__': # # manager.debug = True # app.run()
[ 6738, 598, 1330, 2251, 62, 1324, 11, 20613, 198, 6738, 42903, 62, 76, 42175, 1330, 337, 42175, 198, 6738, 598, 13, 27530, 1330, 11787, 11, 12043, 198, 6738, 42903, 62, 12048, 1330, 9142, 11, 10697, 198, 198, 1324, 796, 2251, 62, 1324,...
2.961957
184
# # . path_admin_schedules_grade_1 = '/schedules?grade=1&school=true&' path_admin_schedules_grade_2 = '/schedules?grade=2&school=true&' path_admin_schedules_grade_3 = '/schedules?grade=3&school=true&' path_admin_schedules_grade_4 = '/schedules?grade=4&school=true&' path_admin_schedules_grade_5 = '/schedules?grade=5&school=true&' path_admin_schedules_grade_6 = '/schedules?grade=6&school=true&' path_admin_schedules_grade_7 = '/schedules?grade=7&school=true&' path_admin_schedules_grade_8 = '/schedules?grade=8&school=true&' path_admin_schedules_grade_9 = '/schedules?grade=9&school=true&' path_admin_schedules_grade_10 = '/schedules?grade=10&school=true&' path_admin_schedules_grade_11 = '/schedules?grade=11&school=true&' # \ path_admin_add_subject = '/schedules?' path_admin_delete_subject = '/schedules/5583026?' # path_admin_item_editor = '/schedule_items.json?schedule_id=3908531&' # path_admin_add_topic = '/topics?' # path_admin_add_lesson = 'lessons.json?' # path_admin_lesson_for_day = '/schedule_items.json?' # path_admin_remove_lesson = '/lessons/37865.json?' # path_admin_remove_topic = '/topics/24273?addLessonHide=true&addLessonNameEvent=click&calendarActive=false&editTopicNameHide=true&lessonsHide=false&name=&schedule_id=3908531&subject_id=201&' path_admin_save_date_ege = '/schedules/3908531?' # # path_admin_monthly_homework_editor = '/monthly_homeworks?schedule_id=3908531&' # path_admin_create_monthly_homework = '/monthly_homeworks?' # path_admin_delete_monthly_homework = '/monthly_homeworks/7229?' # # path_admin_editor_ege = '/schedules?grade=11&school=false&' # path_admin_attach_subject_ege = '/schedules?' # path_admin_delete_subject_ege = '/schedules/5583707?' # path_admin_add_topic = '/topics?' #
[ 2, 220, 220, 220, 220, 198, 2, 220, 220, 220, 220, 220, 220, 764, 220, 198, 6978, 62, 28482, 62, 1416, 704, 5028, 62, 9526, 62, 16, 796, 31051, 1416, 704, 5028, 30, 9526, 28, 16, 5, 14347, 28, 7942, 5, 6, 198, 6978, 62, 28482,...
2.355091
766
from .loader import * from .swagger import *
[ 6738, 764, 29356, 1330, 1635, 198, 6738, 764, 2032, 7928, 1330, 1635, 628 ]
3.538462
13
with open("input/input07.txt") as f: content = f.read().splitlines() positions = list(map(lambda x: int(x), content[0].split(","))) max_pos = max(positions) min_pos = min(positions) possible_pos = range(min_pos, max_pos + 1) fuel_costs1 = [] for align_pos in possible_pos: fuel_costs1.append(sum([abs(pos - align_pos) for pos in positions])) final_fuel_cost1 = min(fuel_costs1) align_position1 = possible_pos[fuel_costs1.index(final_fuel_cost1)] print("Solution 1: the crabs need to spend {} fuel to align at position {}".format(final_fuel_cost1, align_position1)) fuel_costs2 = [] for align_pos in possible_pos: fuel_costs2.append(sum([int(abs(pos - align_pos) * (abs(pos - align_pos) + 1) / 2) for pos in positions])) final_fuel_cost2 = min(fuel_costs2) align_position2 = possible_pos[fuel_costs2.index(final_fuel_cost2)] print("Solution 2: the crabs need to spend {} fuel to align at position {}".format(final_fuel_cost2, align_position2))
[ 4480, 1280, 7203, 15414, 14, 15414, 2998, 13, 14116, 4943, 355, 277, 25, 198, 220, 220, 220, 2695, 796, 277, 13, 961, 22446, 35312, 6615, 3419, 198, 198, 1930, 1756, 796, 1351, 7, 8899, 7, 50033, 2124, 25, 493, 7, 87, 828, 2695, 5...
2.720339
354
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2018 PocketBudgetTracker. All rights reserved. Author: Andrey Shelest (khadsl1305@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import os import os.path import subprocess import sys modules_dir = os.path.dirname(__file__) req_file_name = 'requirements.txt' if __name__ == '__main__': installer = Installer(True) # Upgrade pip installer.install('pip') # Install all modules dependencies installer.install_modules_deps() sys.exit(0)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 15269, 220, 2864, 27290, 33, 29427, 35694, 13, 1439, 2489, 10395, 13, 198, 13838, 25, 843, 4364, 15325, 395...
3.269231
312
""" Copyright (C) 2018-2019 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from ..biases import Biases from ..weights import Weights
[ 37811, 198, 15269, 357, 34, 8, 2864, 12, 23344, 8180, 10501, 198, 198, 26656, 15385, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 5832, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789,...
3.878049
164
import os import time import unittest import bitcoin.rpc import grpc import lnd_grpc.lnd_grpc as py_rpc import lnd_grpc.protos.rpc_pb2 as rpc_pb2 # from google.protobuf.internal.containers import RepeatedCompositeFieldContainer ####################### # Configure variables # ####################### CWD = os.getcwd() ALICE_LND_DIR = '/Users/will/regtest/.lnd/' ALICE_NETWORK = 'regtest' ALICE_RPC_HOST = '127.0.0.1' ALICE_RPC_PORT = '10009' ALICE_MACAROON_PATH = '/Users/will/regtest/.lnd/data/chain/bitcoin/regtest/admin.macaroon' ALICE_PEER_PORT = '9735' ALICE_HOST_ADDR = ALICE_RPC_HOST + ':' + ALICE_PEER_PORT BOB_LND_DIR = '/Users/will/regtest/.lnd2/' BOB_NETWORK = 'regtest' BOB_RPC_HOST = '127.0.0.1' BOB_RPC_PORT = '11009' BOB_MACAROON_PATH = '/Users/will/regtest/.lnd2/data/chain/bitcoin/regtest/admin.macaroon' BOB_PEER_PORT = '9734' BOB_HOST_ADDR = BOB_RPC_HOST + ':' + BOB_PEER_PORT BITCOIN_SERVICE_PORT = 18443 BITCOIN_CONF_FILE = '/Users/will/regtest/.bitcoin/bitcoin.conf' BITCOIN_ADDR = None DEBUG_LEVEL = 'error' SLEEP_TIME = 0.5 ################## # Test framework # ##################i
[ 11748, 28686, 198, 11748, 640, 198, 11748, 555, 715, 395, 198, 198, 11748, 8550, 13, 81, 14751, 198, 11748, 1036, 14751, 198, 198, 11748, 300, 358, 62, 2164, 14751, 13, 75, 358, 62, 2164, 14751, 355, 12972, 62, 81, 14751, 198, 11748, ...
2.322981
483
# Copyright 2018 TVB-HPC contributors # # 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 .base import BaseKernel
[ 2, 220, 220, 220, 220, 15069, 2864, 3195, 33, 12, 39, 5662, 20420, 198, 2, 198, 2, 220, 220, 220, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 220, 220, 220, 220, 345, 743, 40...
3.252475
202
# # 20. Valid Parentheses # # Q: https://leetcode.com/problems/valid-parentheses/ # A: https://leetcode.com/problems/valid-parentheses/discuss/9214/Kt-Js-Py3-Cpp-Stack #
[ 2, 198, 2, 1160, 13, 48951, 16774, 39815, 198, 2, 198, 2, 1195, 25, 3740, 1378, 293, 316, 8189, 13, 785, 14, 1676, 22143, 14, 12102, 12, 8000, 39815, 14, 198, 2, 317, 25, 3740, 1378, 293, 316, 8189, 13, 785, 14, 1676, 22143, 14,...
2.394366
71
import common lines = common.read_file('2016/23/data.txt').splitlines() # part 1 eggs = 7 # part 2 eggs = 12 registers = dict(a=eggs, b=0, c=0, d=0) instructions = [x.split(' ') for x in lines] i = 0 while i < len(instructions) and i >= 0: print(registers) instr = instructions[i] code = instr[0] if code == 'cpy': if is_reg(instr[2]): registers[instr[2]] = get_val(instr[1]) i += 1 elif code == 'inc': if is_reg(instr[1]): registers[instr[1]] += 1 i += 1 elif code == 'dec': if is_reg(instr[1]): registers[instr[1]] -= 1 i += 1 elif code == 'jnz': if get_val(instr[1]) != 0: i += get_val(instr[2]) else: i += 1 else: # tgl instr_offset = get_val(instr[1]) instr_idx = i + instr_offset if 0 <= instr_idx < len(instructions): to_tgl = instructions[instr_idx] if to_tgl[0] == 'inc': to_tgl[0] = 'dec' elif to_tgl[0] == 'dec' or to_tgl[0] == 'tgl': to_tgl[0] = 'inc' elif to_tgl[0] == 'jnz': to_tgl[0] = 'cpy' else: # cpy to_tgl[0] = 'jnz' i += 1 print('a=', registers['a'])
[ 11748, 2219, 198, 198, 6615, 796, 2219, 13, 961, 62, 7753, 10786, 5304, 14, 1954, 14, 7890, 13, 14116, 27691, 35312, 6615, 3419, 198, 198, 2, 636, 352, 198, 33856, 82, 796, 767, 198, 2, 636, 362, 198, 33856, 82, 796, 1105, 198, 19...
1.738544
742
""" This module contains functions that are imported and called by the server whenever it changes its running status. At the point these functions are run, all applicable hooks on individual objects have already been executed. The main purpose of this is module is to have a safe place to initialize eventual custom modules that your game needs to start up or load. The module should define at least these global functions: at_server_start() at_server_stop() The module used is defined by settings.AT_SERVER_STARTSTOP_MODULE. """ def at_server_start(): """ This is called every time the server starts up (also after a reload or reset). """ pass def at_server_stop(): """ This is called just before a server is shut down, reloaded or reset. """ pass
[ 37811, 198, 1212, 8265, 4909, 5499, 326, 389, 17392, 290, 1444, 416, 262, 198, 15388, 8797, 340, 2458, 663, 2491, 3722, 13, 1629, 262, 966, 777, 198, 12543, 2733, 389, 1057, 11, 477, 9723, 26569, 319, 1981, 5563, 423, 198, 282, 1493, ...
3.484716
229
from django.urls import path from . import views urlpatterns = [ path('register/student/', views.StudentCreate.as_view(), name='student-register'), path('register/prof/', views.ProfCreate.as_view(), name='prof-register'), path('remove/student/<pk>/', views.StudentRemove.as_view(), name='student-remove'), path('remove/prof/<pk>/', views.ProfRemove.as_view(), name='prof-remove'), ]
[ 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 201, 198, 6738, 764, 1330, 5009, 201, 198, 201, 198, 6371, 33279, 82, 796, 685, 201, 198, 220, 220, 220, 3108, 10786, 30238, 14, 50139, 14, 3256, 5009, 13, 38778, 16447, 13, 292, 62, 117...
2.826389
144
import sys from dataclasses import dataclass from io import StringIO from pathlib import Path from typing import Any import numpy as np from sklearn.model_selection import StratifiedKFold from utils.logger import logger from .artifacts import ExperimentArtifacts INPUT_COLUMNS = [ "Time", "V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18", "V19", "V20", "V21", "V22", "V23", "V24", "V25", "V26", "V27", "V28", "Amount", "Class", ]
[ 11748, 25064, 198, 6738, 4818, 330, 28958, 1330, 4818, 330, 31172, 198, 6738, 33245, 1330, 10903, 9399, 198, 6738, 3108, 8019, 1330, 10644, 198, 6738, 19720, 1330, 4377, 198, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 1341, 35720, 13,...
2.408451
213
# 4.Crie uma lista que v de 1 at 100. list = [ cont for cont in range(1,101)] print(list)
[ 2, 604, 13, 34, 5034, 334, 2611, 1351, 64, 8358, 410, 390, 352, 379, 1802, 13, 198, 198, 4868, 796, 685, 542, 329, 542, 287, 2837, 7, 16, 11, 8784, 15437, 198, 4798, 7, 4868, 8 ]
2.5
36
"""Fig. 3 from Heitzig & Hiller (2020) Degrees of individual and groupwise backward and forward responsibility in extensive-form games with ambiguity, and their application to social choice problems. ArXiv:2007.07352 drsc_fig3: v1: i dont_hesitatew3: lives hesitatev2: i try_after_alldelayed_try succeedw4: lives failw6: dies pass_w5: dies Situation related to the Independence of Nested Decisions (IND) axiom. The agent sees someone having a heart attack and may either try to rescue them without hesitation, applying CPU until the ambulance arrives, or hesitate and then reconsider and try rescuing them after all, in which case it is ambiguous whether the attempt can still succeed. """ from ..__init__ import * global_players("i") global_actions("hesitate", "dont_hesitate", "try_after_all", "pass_") lives = Ou("lives", ac=True) dies = Ou("dies", ac=False) T = Tree("drsc_fig3", ro=DeN("v1", pl=i, co={ dont_hesitate: OuN("w3", ou=lives), hesitate: DeN("v2", pl=i, co={ try_after_all: PoN("delayed_try", su={ ("succeed", OuN("w4", ou=lives)), ("fail", OuN("w6", ou=dies)) }), pass_: OuN("w5", ou=dies) }) }) ) T.make_globals()
[ 37811, 14989, 13, 513, 422, 679, 4224, 328, 1222, 3327, 263, 357, 42334, 8, 25905, 6037, 286, 1981, 290, 1448, 3083, 220, 198, 1891, 904, 290, 2651, 5798, 287, 7667, 12, 687, 1830, 351, 33985, 11, 220, 198, 392, 511, 3586, 284, 1919...
2.27242
591
fib(30)
[ 198, 69, 571, 7, 1270, 8, 198 ]
1.285714
7
from dataclasses import dataclass from bindings.csw.code_type_1 import CodeType1 __NAMESPACE__ = "http://www.opengis.net/ows"
[ 6738, 4818, 330, 28958, 1330, 4818, 330, 31172, 198, 6738, 34111, 13, 66, 2032, 13, 8189, 62, 4906, 62, 16, 1330, 6127, 6030, 16, 198, 198, 834, 45, 29559, 47, 11598, 834, 796, 366, 4023, 1378, 2503, 13, 404, 1516, 271, 13, 3262, ...
2.723404
47
from .image_generator import *
[ 6738, 764, 9060, 62, 8612, 1352, 1330, 1635, 198 ]
3.444444
9
import warnings import urllib warnings.filterwarnings("ignore", category=UserWarning) from fuzzywuzzy import fuzz from bs4 import BeautifulSoup from discogstagger.crawler import WebCrawler
[ 11748, 14601, 198, 11748, 2956, 297, 571, 198, 40539, 654, 13, 24455, 40539, 654, 7203, 46430, 1600, 6536, 28, 12982, 20361, 8, 198, 198, 6738, 34669, 86, 4715, 88, 1330, 26080, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 673...
3.537037
54
""" Just some text transformation functions related to our conditions-related workarounds """ # Borrowed from parliament. Altered with normalization for lowercase. def translate_condition_key_data_types(condition_str): """ The docs use different type names, so this standardizes them. Example: The condition secretsmanager:RecoveryWindowInDays is listed as using a "Long" So return "Number" """ if condition_str.lower() in ["arn", "arn"]: return "Arn" elif condition_str.lower() in ["bool", "boolean"]: return "Bool" elif condition_str.lower() in ["date"]: return "Date" elif condition_str.lower() in ["long", "numeric"]: return "Number" elif condition_str.lower() in ["string", "string", "arrayofstring"]: return "String" elif condition_str.lower() in ["ip"]: return "Ip" else: raise Exception("Unknown data format: {}".format(str)) def get_service_from_condition_key(condition_key): """Given a condition key, return the service prefix""" elements = condition_key.split(":", 2) return elements[0] def get_comma_separated_condition_keys(condition_keys): """ :param condition_keys: String containing multiple condition keys, separated by double spaces :return: result: String containing multiple condition keys, comma-separated """ result = condition_keys.replace(" ", ",") # replace the double spaces with a comma return result
[ 37811, 198, 5703, 617, 2420, 13389, 5499, 3519, 284, 674, 198, 17561, 1756, 12, 5363, 670, 283, 3733, 198, 37811, 628, 198, 2, 347, 6254, 276, 422, 8540, 13, 978, 4400, 351, 3487, 1634, 329, 2793, 7442, 13, 198, 4299, 15772, 62, 314...
2.991903
494
# -*- coding: utf-8 -*- import sys import re from .input import Input from ..exceptions import NoSuchOption, BadOptionUsage, TooManyArguments
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 25064, 198, 11748, 302, 198, 198, 6738, 764, 15414, 1330, 23412, 198, 6738, 11485, 1069, 11755, 1330, 1400, 16678, 19722, 11, 7772, 19722, 28350, 11, 14190, 70...
3.152174
46
import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from bs4 import BeautifulSoup as bs # your credentials email = "email@example.com" password = "password" # the sender's email FROM = "email@example.com" # the receiver's email TO = "to@example.com" # the subject of the email (subject) subject = "Just a subject" # initialize the message we wanna send msg = MIMEMultipart("alternative") # set the sender's email msg["From"] = FROM # set the receiver's email msg["To"] = TO # set the subject msg["Subject"] = subject # set the body of the email as HTML html = """ This email is sent using <b>Python </b>! """ # uncomment below line if you want to use the HTML template # located in mail.html # html = open("mail.html").read() # make the text version of the HTML text = bs(html, "html.parser").text text_part = MIMEText(text, "plain") html_part = MIMEText(html, "html") # attach the email body to the mail message # attach the plain text version first msg.attach(text_part) msg.attach(html_part) # send the mail send_mail(email, password, FROM, TO, msg)
[ 11748, 895, 83, 489, 571, 198, 6738, 3053, 13, 76, 524, 13, 5239, 1330, 337, 3955, 2767, 2302, 198, 6738, 3053, 13, 76, 524, 13, 16680, 541, 433, 1330, 337, 3955, 3620, 586, 541, 433, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486...
3.089385
358
# flake8: noqa from .base import Base from .item import Item, ItemCreateModel, ItemModel from .user import User, UserCreateModel, UserModel
[ 2, 781, 539, 23, 25, 645, 20402, 198, 6738, 764, 8692, 1330, 7308, 198, 6738, 764, 9186, 1330, 9097, 11, 9097, 16447, 17633, 11, 9097, 17633, 198, 6738, 764, 7220, 1330, 11787, 11, 11787, 16447, 17633, 11, 11787, 17633, 198 ]
3.5
40
#!/usr/bin/python3 # direwatch """ Craig Lamparter KM6LYW, 2021, MIT License modified by W4MHI February 2022 - see the init_display.py module for display settings - see https://www.delftstack.com/howto/python/get-ip-address-python/ for the ip address """ import sys import argparse import time from netifaces import interfaces, ifaddresses, AF_INET sys.path.insert(0, '/home/pi/common') from display_util import * from constants import * args = parse_arguments() if args["fontsize"]: fontsize = int(args["fontsize"]) if fontsize > 34: print("The input: " + str(fontsize) + " is greater than: 34 that is maximum value supported.") print("Setting to maximum value: 34.") fontsize = 34 elif fontsize < 20: print("The input: " + str(fontsize) + " is lower than: 20 that is minimum value supported.") print("Setting to minimum value: 20.") fontsize = 20 else: print("Setting font size to default value: 24.") fontsize = 24 if args["big"]: message_big = args["big"] else: message_big = "DigiPi" if args["small"]: message_small = args["small"] else: message_small = "DigiPi Operational!" # title font_title = get_titlefont() # define writing fonts font_message = get_writingfont(fontsize) spacing = get_spacing(fontsize) last_line = get_lastline(fontsize) # Draw a black filled box to clear the image. draw.rectangle((0, 0, width, height), outline=0, fill="#000000") # title bar draw.rectangle((0, 0, width, TITLE_BAR_H), outline=0, fill="#333333") draw.text((10, 0) , TITLE, font=font_title, fill="#888888") # ip addresses message count = 1 draw.text((PAD_LEFT, count*spacing), "Net's IP Addresses", font=font_message, fill="#00FF00") first_pass = True ip_present = False while ip_present == False: count = 1 # ip addresses for ifaceName in interfaces(): for i in ifaddresses(ifaceName).setdefault(AF_INET, [{'addr':'No IP yet'}]): if ifaceName.startswith("wlan") or ifaceName.startswith("eth"): # increment for interface name count = count + 1 if first_pass: # show the interface name draw.text((PAD_LEFT, count*spacing), "[" + ifaceName + "]", font=font_message, fill="#00FF00") # increment for the ip address count = count + 1 #delete the previous line if exists draw.rectangle((0, count*spacing, width, (count+1)*spacing), outline=0, fill="#000000") draw.text((4*PAD_LEFT, count*spacing), i['addr'], font=font_message, fill="#00FF00") if i['addr'].startswith('No IP') == False: ip_present = True disp.image(image) first_pass = False # wait and re-iterate if no ip address if ip_present == False: time.sleep(3) # message count = count + 1 if last_line >= count: draw.text((PAD_LEFT, last_line*spacing), message_small, font=font_message, fill="#FFFF00") #with display_lock: disp.image(image) print("DigiPi operational!\n") exit(0)
[ 2, 48443, 14629, 14, 8800, 14, 29412, 18, 198, 198, 2, 19958, 8340, 198, 198, 37811, 198, 40441, 28607, 2571, 46646, 21, 11319, 54, 11, 220, 33448, 11, 17168, 13789, 198, 198, 41771, 416, 370, 19, 44, 25374, 3945, 33160, 198, 12, 76...
2.590361
1,162
from __future__ import division import hashlib import logging import os import re __all__ = [ 'is_unsplitable', 'get_root_of_unsplitable', 'Pieces', ] UNSPLITABLE_FILE_EXTENSIONS = [ set(['.rar', '.sfv']), set(['.mp3', '.sfv']), set(['.vob', '.ifo']), ] logger = logging.getLogger(__name__) def is_unsplitable(files): """ Checks if a list of files can be considered unsplitable, e.g. VOB/IFO or scene release. This means the files can only be used in this combination. """ extensions = set(os.path.splitext(f)[1].lower() for f in files) found_unsplitable_extensions = False for exts in UNSPLITABLE_FILE_EXTENSIONS: if len(extensions & exts) == len(exts): found_unsplitable_extensions = True break lowercased_files = set([f.lower() for f in files]) found_magic_file = False if 'movieobject.bdmv' in lowercased_files: found_magic_file = True return found_unsplitable_extensions or found_magic_file def get_root_of_unsplitable(path): """ Scans a path for the actual scene release name, e.g. skipping cd1 folders. Returns None if no scene folder could be found """ path = path[::-1] for p in path: if not p: continue if re.match(r'^(cd[1-9])|(samples?)|(proofs?)|((vob)?sub(title)?s?)$', p, re.IGNORECASE): # scene paths continue if re.match(r'^(bdmv)|(disc\d*)|(video_ts)$', p, re.IGNORECASE): # bluray / dd continue return p
[ 6738, 11593, 37443, 834, 1330, 7297, 198, 198, 11748, 12234, 8019, 198, 11748, 18931, 198, 11748, 28686, 198, 11748, 302, 198, 198, 834, 439, 834, 796, 685, 198, 220, 220, 220, 705, 271, 62, 13271, 489, 4674, 3256, 198, 220, 220, 220,...
2.215989
713
gs2 = gridspec.GridSpec(3, 1) for ss in gs2: ax = fig.add_subplot(ss) example_plot(ax) ax.set_title("") ax.set_xlabel("") ax.set_xlabel("x-label", fontsize=12) gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5)
[ 14542, 17, 796, 50000, 43106, 13, 41339, 22882, 7, 18, 11, 352, 8, 198, 198, 1640, 37786, 287, 308, 82, 17, 25, 198, 220, 220, 220, 7877, 796, 2336, 13, 2860, 62, 7266, 29487, 7, 824, 8, 198, 220, 220, 220, 1672, 62, 29487, 7, ...
1.94958
119
from __future__ import print_function, division import os import torch import pandas as pd from skimage import io, transform import numpy as np import matplotlib.pyplot as plt from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import random import model from torch.autograd import Variable
[ 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 11, 7297, 198, 11748, 28686, 198, 11748, 28034, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 1341, 9060, 1330, 33245, 11, 6121, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 294...
3.772727
88
from argparse import ArgumentParser from datetime import datetime from os import path, listdir, getcwd, chdir import subprocess from dateutil.parser import parse as dt_parse from ruamel.yaml import YAML if __name__ == '__main__': parser = ArgumentParser(description='Transform the FlashReads posts to Jekyll-style MD posts.') parser.add_argument('-s', '--source', type=str, dest='src_dir', help='The source directory where the flash-reads posts are contained.') parser.add_argument('-d', '--dest', type=str, dest='dest_dir', help='The destination directory where the Jekyll-style posts will reside - usually <repo>/_posts.') parser.add_argument('-f', '--featured', type=str, dest='featured_path', help='File containing the featured posts by id, separated by a comma.') args = parser.parse_args() transform_posts(args.src_dir, args.dest_dir, args.featured_path)
[ 6738, 1822, 29572, 1330, 45751, 46677, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 28686, 1330, 3108, 11, 1351, 15908, 11, 651, 66, 16993, 11, 442, 15908, 198, 11748, 850, 14681, 198, 198, 6738, 3128, 22602, 13, 48610, 1330, 211...
3.226619
278
"""Copyright (c) 2018 Great Ormond Street Hospital for Children NHS Foundation Trust & Birmingham Women's and Children's NHS Foundation Trust 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 django.shortcuts import render from django.shortcuts import render, redirect from . import * from gel2mdt.models import * from gel2mdt.config import load_config from django.contrib.auth.decorators import login_required from .forms import ProbandCancerForm from django.contrib import messages
[ 37811, 15269, 357, 66, 8, 2864, 3878, 1471, 6327, 3530, 9256, 329, 8990, 18183, 5693, 198, 33814, 1222, 18899, 6926, 338, 290, 8990, 338, 18183, 5693, 9870, 198, 198, 5990, 3411, 318, 29376, 7520, 11, 1479, 286, 3877, 11, 284, 597, 10...
3.9437
373
import pygame import lib.common as common # initializing module pygame.init()
[ 11748, 12972, 6057, 198, 198, 11748, 9195, 13, 11321, 355, 2219, 198, 198, 2, 4238, 2890, 8265, 198, 9078, 6057, 13, 15003, 3419, 198 ]
3.333333
24
from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Social Network Analysis module group project 2020', author='Dean Power', license='', )
[ 6738, 900, 37623, 10141, 1330, 1064, 62, 43789, 11, 9058, 198, 198, 40406, 7, 198, 220, 220, 220, 1438, 11639, 10677, 3256, 198, 220, 220, 220, 10392, 28, 19796, 62, 43789, 22784, 198, 220, 220, 220, 2196, 11639, 15, 13, 16, 13, 15,...
3
77
from __future__ import annotations from jigu.core import AccAddress, Coins from jigu.util.serdes import JsonDeserializable, JsonSerializable from jigu.util.validation import Schemas as S from jigu.util.validation import validate_acc_address __all__ = ["Input", "Output"]
[ 6738, 11593, 37443, 834, 1330, 37647, 198, 198, 6738, 474, 328, 84, 13, 7295, 1330, 6366, 20231, 11, 30108, 198, 6738, 474, 328, 84, 13, 22602, 13, 2655, 8906, 1330, 449, 1559, 5960, 48499, 13821, 11, 449, 1559, 32634, 13821, 198, 673...
3.209302
86
""" A package dedicated to a memory related components, interfaces and utilities. """
[ 37811, 198, 32, 5301, 7256, 284, 257, 4088, 3519, 6805, 11, 20314, 290, 20081, 13, 198, 37811 ]
5
17
""" Vertical Order Traversal On Binary Tree """ from collections import defaultdict def vertical_order(root): """ vertical order traversal of binary tree """ hd_map = defaultdict(list) horizontal_dist = 0 preorder(root, horizontal_dist, hd_map) for key, value in hd_map.items(): print(f"{key}: {value}") def main(): """ operational function """ root = Node(2) root.left = Node(7) root.left.left = Node(2) root.left.right = Node(6) root.left.right.left = Node(5) root.left.right.right = Node(11) root.right = Node(5) root.right.right = Node(9) root.right.right.left = Node(4) vertical_order(root) if __name__ == "__main__": main()
[ 37811, 38937, 8284, 4759, 690, 282, 1550, 45755, 12200, 198, 37811, 198, 198, 6738, 17268, 1330, 4277, 11600, 628, 628, 198, 4299, 11723, 62, 2875, 7, 15763, 2599, 198, 220, 220, 220, 37227, 11723, 1502, 33038, 282, 286, 13934, 5509, 22...
2.53169
284
import torchvision.transforms as transforms import torch import torchvision __author__ = "Dublin City University" __copyright__ = "Copyright 2019, Dublin City University" __credits__ = ["Gideon Maillette de Buy Wenniger"] __license__ = "Dublin City University Software License (enclosed)"
[ 11748, 28034, 10178, 13, 7645, 23914, 355, 31408, 198, 11748, 28034, 198, 11748, 28034, 10178, 198, 198, 834, 9800, 834, 796, 366, 37590, 2815, 2254, 2059, 1, 198, 834, 22163, 4766, 834, 796, 366, 15269, 13130, 11, 18220, 2254, 2059, 1,...
3.818182
77
import cProfile import functools import logging import pstats import sys import six _logger = logging.getLogger(__name__) _logger.setLevel(logging.DEBUG) _stream_handler = logging.StreamHandler(sys.stdout) _stream_handler.setLevel(logging.DEBUG) _logger.addHandler(_stream_handler)
[ 11748, 269, 37046, 198, 11748, 1257, 310, 10141, 198, 11748, 18931, 198, 11748, 279, 34242, 198, 11748, 25064, 198, 198, 11748, 2237, 628, 198, 62, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 198, 62, 6404, 13...
3.042553
94
import helper_funcs.spline import helper_funcs.plotter import helper_funcs.grid
[ 11748, 31904, 62, 12543, 6359, 13, 22018, 500, 198, 11748, 31904, 62, 12543, 6359, 13, 29487, 353, 198, 11748, 31904, 62, 12543, 6359, 13, 25928 ]
3.16
25
import os import sys from urllib.parse import urlencode from flask import Flask, Response, abort, request, stream_with_context, jsonify from flask_restx import Api, Resource, fields, reqparse import requests from qwc_services_core.api import CaseInsensitiveArgument from qwc_services_core.app import app_nocache from qwc_services_core.auth import auth_manager, optional_auth, get_auth_user from qwc_services_core.tenant_handler import TenantHandler from qwc_services_core.runtime_config import RuntimeConfig from qwc_services_core.permissions_reader import PermissionsReader # Flask application app = Flask(__name__) app_nocache(app) api = Api(app, version='1.0', title='Document service API', description="""API for QWC Document service. The document service delivers reports from the Jasper reporting service. """, default_label='Document operations', doc='/api/') app.config.SWAGGER_UI_DOC_EXPANSION = 'list' # disable verbose 404 error message app.config['ERROR_404_HELP'] = False auth = auth_manager(app, api) tenant_handler = TenantHandler(app.logger) config_handler = RuntimeConfig("document", app.logger) def get_document(tenant, template, format): """Return report with specified template and format. :param str template: Template ID :param str format: Document format """ config = config_handler.tenant_config(tenant) jasper_service_url = config.get( 'jasper_service_url', 'http://localhost:8002/reports') jasper_timeout = config.get("jasper_timeout", 60) resources = config.resources().get('document_templates', []) permissions_handler = PermissionsReader(tenant, app.logger) permitted_resources = permissions_handler.resource_permissions( 'document_templates', get_auth_user() ) if template in permitted_resources: resource = list(filter( lambda entry: entry.get("template") == template, resources)) if len(resource) != 1: app.logger.info("Template '%s' not found in config", template) abort(404) jasper_template = resource[0]['report_filename'] # http://localhost:8002/reports/BelasteteStandorte/?format=pdf&p1=v1&.. url = "%s/%s/" % (jasper_service_url, jasper_template) params = {"format": format} for k, v in request.args.lists(): params[k] = v app.logger.info("Forward request to %s?%s" % (url, urlencode(params))) response = requests.get(url, params=params, timeout=jasper_timeout) r = Response( stream_with_context(response.iter_content(chunk_size=16*1024)), content_type=response.headers['content-type'], status=response.status_code) return r else: app.logger.info("Missing permissions for template '%s'", template) abort(404) # routes """ readyness probe endpoint """ """ liveness probe endpoint """ # local webserver if __name__ == '__main__': print("Starting GetDocument service...") app.run(host='localhost', port=5018, debug=True)
[ 11748, 28686, 198, 11748, 25064, 198, 6738, 2956, 297, 571, 13, 29572, 1330, 2956, 11925, 8189, 198, 198, 6738, 42903, 1330, 46947, 11, 18261, 11, 15614, 11, 2581, 11, 4269, 62, 4480, 62, 22866, 11, 33918, 1958, 198, 6738, 42903, 62, ...
2.731041
1,134
from matplotlib import pyplot as plt # data speding from Federal Government Plan planes = ['Transferncia para sade', 'FPE e FPM', 'Assistncia Social', 'Suspenso de dvidas da Unio', 'Renegociao com bancos'] spend = [8, 16, 2, 12.6, 9.3] plt.axis("equal") plt.pie(spend, labels=planes, autopct='%1.2f%%') plt.title("Gastos dos Planos Governamentais") plt.show()
[ 201, 198, 201, 198, 6738, 2603, 29487, 8019, 1330, 12972, 29487, 355, 458, 83, 201, 198, 201, 198, 2, 1366, 599, 8228, 422, 5618, 5070, 5224, 201, 198, 22587, 796, 37250, 8291, 69, 1142, 33743, 31215, 264, 671, 3256, 705, 5837, 36, ...
2.257143
175
import unittest from nexusmaker import CognateParser
[ 11748, 555, 715, 395, 198, 198, 6738, 45770, 10297, 1330, 26543, 378, 46677, 198 ]
3.857143
14
from django.contrib import admin from django.urls import path from . import views from django.conf.urls import url urlpatterns = [ path('',views.home,name='home'), path('register/',views.register,name='register'), path('login/',views.Login,name='login'), path('logout/', views.logout_view, name='logout_view'), path('add-requirement/', views.addRequirement, name='addRequirement'), path('ngo-dashboard/', views.ngoDashboard, name='ngoDashboard'), path('ngo-requirement-view/<int:rid>/', views.ngoRequirementView, name='ngoRequirementView'), path('donor-requirement-view/<int:rid>/', views.donorRequirementView, name='donorRequirementView'), path('donor-dashboard/', views.donorDashboard, name='donorDashboard'), path('requirement-fulfillment/<int:rid>/', views.requirement_fulfillment, name='requirement_fulfillment'), ]
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 198, 6738, 764, 1330, 5009, 198, 6738, 42625, 14208, 13, 10414, 13, 6371, 82, 1330, 19016, 628, 198, 6371, 33279, 82, 796, 685, 198, 22...
2.824104
307
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import math import time from typing import Union, Sequence, List from tqdm import trange import numpy as np import paddle from paddle import nn from paddle.nn import functional as F import paddle.fluid.initializer as I import paddle.fluid.layers.distributions as D from parakeet.modules.conv import Conv1dCell from parakeet.modules.audio import quantize, dequantize, STFT from parakeet.utils import checkpoint, layer_tools __all__ = ["WaveNet", "ConditionalWaveNet"] def crop(x, audio_start, audio_length): """Crop the upsampled condition to match audio_length. The upsampled condition has the same time steps as the whole audio does. But since audios are sliced to 0.5 seconds randomly while conditions are not, upsampled conditions should also be sliced to extactly match the time steps of the audio slice. Parameters ---------- x : Tensor [shape=(B, C, T)] The upsampled condition. audio_start : Tensor [shape=(B,), dtype:int] The index of the starting point of the audio clips. audio_length : int The length of the audio clip(number of samples it contaions). Returns ------- Tensor [shape=(B, C, audio_length)] Cropped condition. """ # crop audio slices = [] # for each example # paddle now supports Tensor of shape [1] in slice # starts = audio_start.numpy() for i in range(x.shape[0]): start = audio_start[i] end = start + audio_length slice = paddle.slice(x[i], axes=[1], starts=[start], ends=[end]) slices.append(slice) out = paddle.stack(slices) return out
[ 2, 15069, 357, 66, 8, 12131, 350, 37382, 47, 37382, 46665, 13, 1439, 6923, 33876, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845...
3.082305
729
def normalize(values, gammas): """Adjust a list of brightness values according to a list of gamma values. Given a list of light brightness values from 0.0 to 1.0, adjust the value according to the corresponding maximum brightness in the gamma list. For example:: >>> gammas = [0.3, 1.0] >>> values = [1.0, 1.0] >>> normalize(values, gammas) [0.3, 1.0] >>> values = [0.5, 0.5] >>> normalize(values, gammas) [0.15, 0.5] >>> values = [0.1, 0.0] >>> normalize(values, gammas) [0.03, 0.0] """ return [value * gamma for value, gamma in zip(values, gammas)]
[ 4299, 3487, 1096, 7, 27160, 11, 9106, 5356, 2599, 198, 220, 220, 220, 37227, 39668, 257, 1351, 286, 22204, 3815, 1864, 284, 257, 1351, 286, 34236, 3815, 13, 628, 220, 220, 220, 11259, 257, 1351, 286, 1657, 22204, 3815, 422, 657, 13, ...
2.335689
283
import sys import cv2 # it is necessary to use cv2 library import numpy as np # https://docs.opencv.org/4.5.2/d4/dc6/tutorial_py_template_matching.html if( __name__ == '__main__' ): if( len(sys.argv) >= 3 ): main( sys.argv[1], sys.argv[2] ) else: print( 'usage: python '+sys.argv[0]+' input_filenname template_filename' )
[ 11748, 25064, 198, 198, 11748, 269, 85, 17, 1303, 340, 318, 3306, 284, 779, 269, 85, 17, 5888, 198, 11748, 299, 32152, 355, 45941, 198, 198, 2, 3740, 1378, 31628, 13, 9654, 33967, 13, 2398, 14, 19, 13, 20, 13, 17, 14, 67, 19, 14...
2.251613
155
n = int(input()) s = input() bcnt = [0]*n wcnt = [0]*n result = 2 * 10 ** 5 # if s[0] == "#": bcnt[0] = 1 if s[n-1] == ".": wcnt[n-1] = 1 for i in range(1,n): bcnt[i] = bcnt[i-1] if s[i] == "#": bcnt[i] += 1 for i in range(n-2,-1,-1): wcnt[i] = wcnt[i+1] if s[i] == ".": wcnt[i] += 1 # for i in range(0,n-1): result = min(bcnt[i] + wcnt[i+1],result) result = min(result,bcnt[n-1]) result = min(result,wcnt[0]) print(result)
[ 77, 796, 493, 7, 15414, 28955, 201, 198, 82, 796, 5128, 3419, 201, 198, 15630, 429, 796, 685, 15, 60, 9, 77, 201, 198, 86, 66, 429, 796, 685, 15, 60, 9, 77, 201, 198, 20274, 796, 362, 1635, 838, 12429, 642, 201, 198, 201, 198,...
1.631068
309
#!/usr/bin/env python3 """Script for Tkinter GUI chat client.""" from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinter from tkinter import filedialog, Tk import os import time def private_receive(pmsg_list, pclient_socket): """Handles receiving of messages.""" # pmsg_list = ptop.messages_frame.msg_list while True: try: msg = pclient_socket.recv(BUFSIZ) if msg == bytes("{file}", "utf8"): pmsg_list.insert(tkinter.END, "Receiving File") fname, fsize = private_recv_file(pclient_socket) pmsg_list.insert(tkinter.END, "File Recieved") elif msg == bytes("{quit}", "utf8"): break else: msg = msg.decode('utf8') pmsg_list.insert(tkinter.END, msg) except OSError: # Possibly client has left the chat. break def receive(): """Handles receiving of messages.""" buttons_frame = tkinter.Frame(top) while True: try: msg = client_socket.recv(BUFSIZ).decode("utf8") # print(msg) if msg == '{quit}': break elif '{prequest}' in msg[0:12]: name = msg[11:] handle_connection_request(name) elif '{name}' in msg[0:6]: print(msg) uname.insert(tkinter.END, msg[7:]) elif '{namelist}' in msg[0:12]: nlist = msg.split('_')[1] name_list = nlist.split(',')[1:] print(name_list) buttons_frame.destroy() buttons_frame = tkinter.Frame(top) for name in name_list: private_button = tkinter.Button(buttons_frame, text=name, command=lambda user=name: create_private(user)) private_button.pack(side=tkinter.LEFT) buttons_frame.pack(side=tkinter.LEFT) else: msg_list.insert(tkinter.END, msg) except OSError: # Possibly client has left the chat. break def private_send(client_socket_no, pmy_msg, pmsg_list, event=None): # event is passed by binders. """Handles sending of messages.""" print("socket") print(client_socket_no) print(pmy_msg) print(pmsg_list) msg = pmy_msg.get() pmy_msg.delete(0, 100) # Clears input field. print("message sent is: " + msg) try: client_socket_no.send(bytes(msg, "utf8")) except BrokenPipeError: error_msg = "Unable to send" pmsg_list.insert(tkinter.END, error_msg) if msg == "{quit}": client_socket_no.close() top.quit() def send(event=None): # event is passed by binders. """Handles sending of messages.""" print("socket") print(client_socket) msg = my_msg.get() my_msg.set("") # Clears input field. try: client_socket.send(bytes(msg, "utf8")) except BrokenPipeError: error_msg = "Unable to send" msg_list.insert(tkinter.END, error_msg) if msg == "{quit}": client_socket.close() top.quit() # def on_closing(event=None): # """This function is to be called when the window is closed.""" # my_msg.set("{quit}") # try: # send() # except BrokenPipeError: # print("BrokenPipeError") # top.quit() #----Now comes the sockets part---- HOST = input('Enter host: ') PORT = input('Enter port: ') if not PORT: PORT = 35000 else: PORT = int(PORT) if not HOST: HOST = '127.0.0.1' BUFSIZ = 1024 ADDR = (HOST, PORT) client_socket = socket(AF_INET, SOCK_STREAM) client_socket.connect(ADDR) top = tkinter.Tk() top.title("Group Chat") uname = tkinter.Text(top) # uname.pack() messages_frame = tkinter.Frame(top) my_msg = tkinter.StringVar() # For the messages to be sent. # my_msg.set("Type your messages here.") scrollbar = tkinter.Scrollbar(messages_frame) # To navigate through past messages. # Following will contain the messages. msg_list = tkinter.Listbox(messages_frame, height=15, width=50, yscrollcommand=scrollbar.set) scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y) msg_list.pack(side=tkinter.LEFT, fill=tkinter.BOTH) msg_list.pack() messages_frame.pack() entry_field = tkinter.Entry(top, textvariable=my_msg) entry_field.bind("<Return>", send) entry_field.pack() send_button = tkinter.Button(top, text="Send", command=send) send_button.pack() send_file_button = tkinter.Button(top, text="Send File", command=send_file) send_file_button.pack() # top.protocol("WM_DELETE_WINDOW", on_closing) # #----Now comes the sockets part---- # HOST = input('Enter host: ') # PORT = input('Enter port: ') # if not PORT: # PORT = 33000 # else: # PORT = int(PORT) # BUFSIZ = 1024 # ADDR = (HOST, PORT) # client_socket = socket(AF_INET, SOCK_STREAM) # client_socket.connect(ADDR) receive_thread = Thread(target=receive) receive_thread.start() top.mainloop() # Starts GUI execution.
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 7391, 329, 309, 74, 3849, 25757, 8537, 5456, 526, 15931, 198, 6738, 17802, 1330, 12341, 62, 1268, 2767, 11, 17802, 11, 311, 11290, 62, 2257, 32235, 198, 6738, 4704, 278, 133...
2.179409
2,302
import wexpect import time import sys import os here = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, here) from long_printer import puskas_wiki print(wexpect.__version__) # With quotes (C:\Program Files\Python37\python.exe needs quotes) python_executable = '"' + sys.executable + '" ' child_script = here + '\\long_printer.py' main()
[ 11748, 356, 87, 806, 201, 198, 11748, 640, 201, 198, 11748, 25064, 201, 198, 11748, 28686, 201, 198, 201, 198, 1456, 796, 28686, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 4008, 201, 198, 1...
2.241758
182
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 26 10:17:51 2020 description : Sampling methods from sir space to data space author : bveitch version : 1.0 project : EpidPy (epidemic modelling in python) Usage: Data fitting in least squares fit Also acts on labels for data description and fitting randSampler: adds random noise/sampling bias to synthetics """ import numpy as np; #def draw_samples(pT,n,Ntests): # np.random.seed(0) # s = np.random.normal(0, 1,n) # mu = Ntests*pT # sigma = np.sqrt(Ntests*pT*(1-pT)) # data_samp = (sigma*s+mu)/Ntests # return data_samp def randSampler(data,pTT,pTF,Ntests): if(len(data.shape)==1): n=data.shape[0] pT=pTT*data+pTF*(1-data) data_samp=draw_samples(pT,n,Ntests) return data_samp else: [n,m]=data.shape assert (m == len(pTT)),"data size doesnt match size pTT" pT=np.zeros(n) for i in range(m): pT=pTT[i]*data[:,i]+pTF*(1-np.sum(data,1)) data_samp=draw_samples(pT,n,Ntests) return data_samp
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 41972, 319, 19480, 7653, 2608, 838, 25, 1558, 25, 4349, 12131, 198, 198, 11213, 1058, 3409, 11347, 5050...
1.974533
589
""" API to sanitation session. Sanitation session allows having a state within a single sanitation process. One important thing stored to the session is a secret key which is generated to a new random value for each sanitation session, but it stays constant during the whole sanitation process. Its value is never revealed, so that it is possible to generate such one way hashes with it, that should not be redoable afterwards. I.e. during the sanitation session it's possible to do ``hash(C) -> H`` for any clear text C, but it is not possible to check if H is the hashed value of C after the sanitation session has ended. """ import hashlib import hmac import random import sys import threading from six import int2byte if sys.version_info >= (3, 6): from typing import Callable, Optional, Sequence # noqa SECRET_KEY_BITS = 128 _thread_local_storage = threading.local() def hash_text_to_int(value, bit_length=32): # type: (str, int) -> int """ Hash a text value to an integer. Generates an integer number based on the hash derived with `hash_text` from the given text value. :param bit_length: Number of bits to use from the hash value. :return: Integer value within ``0 <= result < 2**bit_length`` """ hash_value = hash_text(value) return int(hash_value[0:(bit_length // 4)], 16) def hash_text_to_ints(value, bit_lengths=(16, 16, 16, 16)): # type: (str, Sequence[int]) -> Sequence[int] """ Hash a text value to a sequence of integers. Generates a sequence of integer values with given bit-lengths similarly to `hash_text_to_int`, but allowing generating many separate numbers with a single call. :param bit_lengths: Tuple of bit lengths for the resulting integers. Defines also the length of the result tuple. :return: Tuple of ``n`` integers ``(R_1, ... R_n)`` with the requested bit-lengths ``(L_1, ..., L_n)`` and values ranging within ``0 <= R_i < 2**L_i`` for each ``i``. """ hash_value = hash_text(value) hex_lengths = [x // 4 for x in bit_lengths] hex_ranges = ( (sum(hex_lengths[0:i]), sum(hex_lengths[0:(i + 1)])) for i in range(len(hex_lengths))) return tuple(int(hash_value[a:b], 16) for (a, b) in hex_ranges) def hash_text(value, hasher=hashlib.sha256, encoding='utf-8'): # type: (str, Callable, str) -> str """ Generate a hash for a text value. The hash will be generated by encoding the text to bytes with given encoding and then generating a hash with HMAC using the session secret as the key and the given hash function. :param value: Text value to hash :param hasher: Hash function to use, SHA256 by default :param encoding: Encoding to use, UTF-8 by default :return: Hexadecimal presentation of the hash as a string """ return hash_bytes(value.encode(encoding), hasher) def hash_bytes(value, hasher=hashlib.sha256): # type: (bytes, Callable) -> str """ Generate a hash for a bytes value. The hash will be generated by generating a hash with HMAC using the session secret as the key and the given hash function. :param value: Bytes value to hash :param hasher: Hash function to use. :return: Hexadecimal presentation of the hash as a string """ return hmac.new(get_secret(), value, hasher).hexdigest() def get_secret(): # type: () -> bytes """ Get session specific secret key. :return: Session key as bytes """ if not getattr(_thread_local_storage, 'secret_key', None): _initialize_session() return _thread_local_storage.secret_key # type: ignore def reset(secret_key=None): # type: (Optional[bytes]) -> None """ Reset the session. By default, this resets the value of the secret to None so that, if there was an earlier sanitation process ran on the same thread, then a next call that needs the secret key of the session will generate a new value for it. This may also be used to set a predefined value for the secret key. :param secret_key: Value to set as the new session secret key or None if a new one should be generated as soon as one is needed. """ _thread_local_storage.secret_key = secret_key def _initialize_session(): # type: () -> None """ Generate a new session key and store it to thread local storage. """ sys_random = random.SystemRandom() _thread_local_storage.secret_key = b''.join( int2byte(sys_random.randint(0, 255)) for _ in range(SECRET_KEY_BITS // 8))
[ 37811, 198, 17614, 284, 39958, 6246, 13, 198, 198, 15017, 3780, 6246, 3578, 1719, 257, 1181, 1626, 257, 2060, 39958, 198, 14681, 13, 198, 198, 3198, 1593, 1517, 8574, 284, 262, 6246, 318, 257, 3200, 1994, 543, 318, 198, 27568, 284, 25...
2.967721
1,549
import pyb print("Test Timers") t1 = pyb.Timer(1) t2 = pyb.Timer(2) t1.interval(2000,callb) t2.timeout(5000,callbTimeout) t1.freq(1) print("f t1:"+str(t1.freq())) t1.period(204000000) t1.prescaler(3) print("period t1:"+str(t1.period())) print("presc t1:"+str(t1.prescaler())) t1.counter(0) print("counter t1:"+str(t1.counter())) print("src freq t1:"+str(t1.source_freq())) while True: pyb.delay(100) #t1.counter(0) #t1.deinit()
[ 11748, 12972, 65, 198, 198, 4798, 7203, 14402, 5045, 364, 4943, 198, 198, 83, 16, 796, 12972, 65, 13, 48801, 7, 16, 8, 198, 83, 17, 796, 12972, 65, 13, 48801, 7, 17, 8, 198, 198, 83, 16, 13, 3849, 2100, 7, 11024, 11, 13345, 65...
1.990991
222
import json import os import tempfile import unittest from unittest.mock import patch from waterfalls import Viewer, viewer if __name__ == "__main__": unittest.main()
[ 11748, 33918, 198, 11748, 28686, 198, 11748, 20218, 7753, 198, 11748, 555, 715, 395, 198, 6738, 555, 715, 395, 13, 76, 735, 1330, 8529, 198, 198, 6738, 1660, 23348, 1330, 3582, 263, 11, 19091, 628, 198, 198, 361, 11593, 3672, 834, 662...
3.017241
58
from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit import PromptSession,prompt,print_formatted_text from reflect.style import * import os from prompt_toolkit.shortcuts import clear from prompt_toolkit.formatted_text import FormattedText
[ 6738, 6152, 62, 25981, 15813, 13, 2539, 62, 30786, 1330, 7383, 36180, 654, 198, 6738, 6152, 62, 25981, 15813, 1330, 45965, 36044, 11, 16963, 457, 11, 4798, 62, 687, 16898, 62, 5239, 198, 6738, 4079, 13, 7635, 1330, 1635, 198, 11748, 2...
3.676056
71
from matrix import Matrix as CMatrix from py_matrix import PyMatrix if __name__ == '__main__': main()
[ 6738, 17593, 1330, 24936, 355, 16477, 265, 8609, 198, 6738, 12972, 62, 6759, 8609, 1330, 9485, 46912, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419, 198 ]
2.972222
36
import datetime import json from django.conf import settings from django.http import HttpResponse from django.utils.translation import ugettext_lazy as _ from django.views.generic import TemplateView from horizon import exceptions, tables from horizon_telemetry.forms import DateForm from horizon_telemetry.utils.influxdb_client import (get_host_usage_metrics, get_host_cpu_metric, get_host_disk_metric, get_host_memory_metric, get_host_network_metric) from openstack_dashboard import api from . import tables as project_tables
[ 11748, 4818, 8079, 198, 11748, 33918, 198, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 198, 6738, 42625, 14208, 13, 26791, 13, 41519, 1330, 334, 1136, 5239, 62, 75, 12582, ...
2.035422
367
from unittest import TestCase from util.boyer_moore_search import z_array from util.boyer_moore_search import boyer_moore, BoyerMoore __author__ = 'Yifei'
[ 6738, 555, 715, 395, 1330, 6208, 20448, 198, 6738, 7736, 13, 7081, 263, 62, 5908, 382, 62, 12947, 1330, 1976, 62, 18747, 198, 6738, 7736, 13, 7081, 263, 62, 5908, 382, 62, 12947, 1330, 2933, 263, 62, 5908, 382, 11, 6387, 263, 40049,...
2.854545
55
from django.contrib import messages from django.contrib.auth import authenticate, login, logout from django.contrib.auth.models import User from django.shortcuts import render, redirect # Create your views here.
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 6218, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 1330, 8323, 5344, 11, 17594, 11, 2604, 448, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, 1330, 11787, 198, 6738, 42625, ...
3.661017
59
import random nouns = ["", "", "", "", ""] adverbs = ["", "", "", "", ""] adjectives = ["", "", "", "", ""] print(get_jokes(6)) print(get_jokes_adv(2,False)) print(nouns, adverbs, adjectives) #,
[ 11748, 4738, 198, 198, 77, 977, 82, 796, 14631, 1600, 366, 1600, 366, 1600, 366, 1600, 366, 8973, 198, 324, 46211, 796, 14631, 1600, 366, 1600, 366, 1600, 366, 1600, 366, 8973, 198, 324, 752, 1083, 796, 14631, 1600, 366, 1600, 366, ...
2.195652
92
# # Dates and Times in Python: Dates & Time # Python Techdegree # # Created by Dulio Denis on 12/24/18. # Copyright (c) 2018 ddApps. All rights reserved. # ------------------------------------------------ # Challenge 4: strftime & strptime # ------------------------------------------------ # Challenge Task 1 of 2 # Create a function named to_string that takes a # datetime and gives back a string in the format # "24 September 2012". # ## Examples # to_string(datetime_object) => "24 September 2012" # from_string("09/24/12 18:30", "%m/%d/%y %H:%M") => datetime import datetime # TEST dt = datetime.datetime.now() print(to_string(dt)) # Challenge Task 2 of 2 # Create a new function named from_string that takes two arguments: # a date as a string and an strftime-compatible format string, and # returns a datetime created from them. # TEST date_string = "24 December 2018" date_format = "%d %B %Y" print(from_string(date_string, date_format))
[ 2, 198, 2, 220, 44712, 290, 3782, 287, 11361, 25, 44712, 1222, 3862, 198, 2, 220, 11361, 9634, 16863, 198, 2, 198, 2, 220, 15622, 416, 42148, 952, 33089, 319, 1105, 14, 1731, 14, 1507, 13, 198, 2, 220, 15069, 357, 66, 8, 2864, 4...
3.23588
301
from google.appengine.ext import ndb
[ 6738, 23645, 13, 1324, 18392, 13, 2302, 1330, 299, 9945, 198 ]
3.363636
11
# Generated by Django 2.1.4 on 2019-11-18 11:00 from django.db import migrations
[ 2, 2980, 515, 416, 37770, 362, 13, 16, 13, 19, 319, 13130, 12, 1157, 12, 1507, 1367, 25, 405, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 628 ]
2.766667
30
#!/usr/bin/python from __future__ import division from __future__ import with_statement import matplotlib from matplotlib import rcParams from matplotlib import pyplot from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.mplot3d import Axes3D from PIL import Image #import Image from pylab import * import matplotlib.cbook as cbook import numpy import os import random from scipy.spatial import KDTree from scipy.stats import linregress import toolbox_basic # University of Birmingham (UK) thesis guidelines state: # - inner margin = 30mm, outer margin = 20mm, so double column = 160mm # - top margin = bottom margin = 30mm, so maximum height = 237mm def padding_axis(axis, side="right", pad=0.04): divider = make_axes_locatable(axis) cax = divider.append_axes(side, size="5%", pad=pad, axisbg='none') return cax def empty_padding_axis(axis, side="right"): cax = padding_axis(axis, side=side) cax.set_xticklabels(['']*10) cax.set_yticklabels(['']*10) for spine in ['right', 'left', 'top', 'bottom']: cax.spines[spine].set_color('none') cax.tick_params(top="off", bottom="off", right="off", left="off") return cax def make_colorbar(axis, colorscheme, side="right", fontsize=10, pad=0.04): cax = padding_axis(axis, side=side, pad=pad) orientation = 'vertical' if side in ["right", "left"] else 'horizontal' cbar = pyplot.colorbar(colorscheme, cax=cax, orientation=orientation) cbar.ax.tick_params(labelsize=fontsize) return cbar def colorbar_on_right(axis, colorscheme, fontsize=10): #divider = make_axes_locatable(axis) #cax = divider.append_axes("right", size="5%", pad=0.04) #cax = space_on_right(axis) #cbar = pyplot.colorbar(colorscheme, cax=cax) #cbar.ax.tick_params(labelsize=fontsize) print '\n\ntoolbox_plotting.colorbar_on_right() is deprecated' print 'Please use toolbox_plotting.make_colorbar() instead\n\n' cbar = make_colorbar(axis, colorscheme, side="right") return cbar def draw_linear_regression(axis, color, x_vals, y_vals): slope, intercept, r_value, p_value, std_err = linregress(x_vals, y_vals) x1, x2 = min(x_vals), max(x_vals) y1, y2 = x1*slope + intercept, x2*slope + intercept axis.plot([x1, x2], [y1, y2], color) return r_value, p_value, std_err
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 6738, 11593, 37443, 834, 1330, 7297, 198, 6738, 11593, 37443, 834, 1330, 351, 62, 26090, 198, 11748, 2603, 29487, 8019, 198, 6738, 2603, 29487, 8019, 1330, 48321, 10044, 4105, 198, 6738, 2603, ...
2.560922
911
from hata import Client MELON : Client #@MELON.commands.from_class #class prefix: # pass #@MELON.commands.from_class #class slowmode: # pass #@MELON.commands.from_class #class logs: # pass #@MELON.commands.from_class #class warn: # pass #@MELON.commands.from_class #class mute: # pass #@MELON.commands.from_class #class kick: # pass #@MELON.commands.from_class #class ban: # pass #@MELON.commands.from_class #class lock: # pass #@MELON.commands.from_class #class unlock: # pass #@MELON.commands.from_class #class clear: # pass
[ 6738, 289, 1045, 1330, 20985, 198, 198, 44, 3698, 1340, 1058, 20985, 198, 198, 2, 31, 44, 3698, 1340, 13, 9503, 1746, 13, 6738, 62, 4871, 198, 2, 4871, 21231, 25, 198, 2, 220, 220, 220, 1208, 198, 198, 2, 31, 44, 3698, 1340, 13,...
2.151515
264
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ Implementation of linting support over LSP. """ import json import pathlib import sys from typing import Dict, Sequence, Union # Ensure that will can import LSP libraries, and other bundled linter libraries sys.path.append(str(pathlib.Path(__file__).parent.parent / "libs")) # pylint: disable=wrong-import-position,import-error import utils from pygls import lsp, server from pygls.lsp import types all_configurations = { "name": "Pylint", "module": "pylint", "patterns": { "default": { "regex": "", "args": ["--reports=n", "--output-format=json"], "lineStartsAt1": True, "columnStartsAt1": False, "useStdin": True, } }, } SETTINGS = {} LINTER = {} MAX_WORKERS = 5 LSP_SERVER = server.LanguageServer(max_workers=MAX_WORKERS) def _get_severity( symbol: str, code: str, code_type: str, severity: Dict[str, str] ) -> types.DiagnosticSeverity: """Converts severity provided by linter to LSP specific value.""" value = ( severity.get(symbol, None) or severity.get(code, None) or severity.get(code_type, "Error") ) try: return types.DiagnosticSeverity[value] except KeyError: pass return types.DiagnosticSeverity.Error def _parse_output( content: str, line_at_1: bool, column_at_1: bool, severity: Dict[str, str], additional_offset: int = 0, ) -> Sequence[types.Diagnostic]: """Parses linter messages and return LSP diagnostic object for each message.""" diagnostics = [] line_offset = (1 if line_at_1 else 0) + additional_offset col_offset = 1 if column_at_1 else 0 messages = json.loads(content) for data in messages: start = types.Position( line=int(data["line"]) - line_offset, character=int(data["column"]) - col_offset, ) if data["endLine"] is not None: end = types.Position( line=int(data["endLine"]) - line_offset, character=int(data["endColumn"]) - col_offset, ) else: end = start diagnostic = types.Diagnostic( range=types.Range( start=start, end=end, ), message=data["message"], severity=_get_severity( data["symbol"], data["message-id"], data["type"], severity ), code=f"{data['message-id']}:{ data['symbol']}", source=LINTER["name"], ) diagnostics.append(diagnostic) return diagnostics def _lint_and_publish_diagnostics( params: Union[types.DidOpenTextDocumentParams, types.DidSaveTextDocumentParams] ) -> None: """Runs linter, processes the output, and publishes the diagnostics over LSP.""" document = LSP_SERVER.workspace.get_document(params.text_document.uri) if utils.is_stdlib_file(document.path): # Don't lint standard library python files. # Publishing empty diagnostics clears the entry. LSP_SERVER.publish_diagnostics(document.uri, []) return module = LINTER["module"] use_stdin = LINTER["useStdin"] use_path = len(SETTINGS["path"]) > 0 argv = SETTINGS["path"] if use_path else [module] argv += LINTER["args"] + SETTINGS["args"] argv += ["--from-stdin", document.path] if use_stdin else [document.path] if use_path: result = utils.run_path(argv, use_stdin, document.source) else: # This is needed to preserve sys.path, pylint modifies # sys.path and that might not work for this scenario # next time around. with utils.SubstituteAttr(sys, "path", sys.path[:]): result = utils.run_module(module, argv, use_stdin, document.source) if result.stderr: LSP_SERVER.show_message_log(result.stderr) LSP_SERVER.show_message_log(f"{document.uri} :\r\n{result.stdout}") diagnostics = _parse_output( result.stdout, LINTER["lineStartsAt1"], LINTER["columnStartsAt1"], SETTINGS["severity"], ) LSP_SERVER.publish_diagnostics(document.uri, diagnostics) if __name__ == "__main__": LSP_SERVER.start_io()
[ 2, 15069, 357, 66, 8, 5413, 10501, 13, 1439, 2489, 10395, 13, 198, 2, 49962, 739, 262, 17168, 13789, 13, 198, 37811, 198, 3546, 32851, 286, 300, 600, 278, 1104, 625, 406, 4303, 13, 198, 37811, 198, 198, 11748, 33918, 198, 11748, 310...
2.331713
1,851
from .webapi import WebAPI
[ 6738, 764, 12384, 15042, 1330, 5313, 17614, 198 ]
3.375
8
from pybloom import BloomFilter if __name__ == '__main__': total_items = 9585058 error = 0.01 bf = BloomFilter(capacity=total_items, error_rate=error) for i in range(total_items): bf.add(i) cf = 0 ct = 0 for i in range(total_items, 2*total_items): if i in bf: cf += 1 ct += 1 fpr = cf * 1.0 / ct * 100 print("false positive rate: %.2f" % fpr)
[ 6738, 12972, 2436, 4207, 1330, 11891, 22417, 220, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 2472, 62, 23814, 796, 860, 3365, 1120, 3365, 198, 220, 220, 220, 4049, 796, 657, 13, 486, 198, ...
2.048544
206
# Generated by Django 2.1.7 on 2019-10-31 16:30 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 16, 13, 22, 319, 13130, 12, 940, 12, 3132, 1467, 25, 1270, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
from .cmdline import CmdUtils
[ 6738, 764, 28758, 1370, 1330, 327, 9132, 18274, 4487, 628, 198 ]
2.909091
11
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-11-24 18:24 from __future__ import unicode_literals from django.db import migrations, models
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2980, 515, 416, 37770, 352, 13, 1157, 13, 20, 319, 2177, 12, 1157, 12, 1731, 1248, 25, 1731, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, ...
2.736842
57
#!/usr/bin/env python3 PKG = 'test_harmoni_speaker' # Common Imports import unittest, rospy, rospkg, roslib, sys #from unittest.mock import Mock, patch # Specific Imports from actionlib_msgs.msg import GoalStatus from harmoni_common_msgs.msg import harmoniAction, harmoniFeedback, harmoniResult from harmoni_common_lib.constants import State from std_msgs.msg import String import os, io import ast from harmoni_speaker.speaker_service import SpeakerService import json if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 628, 198, 40492, 38, 796, 705, 9288, 62, 29155, 14651, 62, 4125, 3110, 6, 198, 2, 8070, 1846, 3742, 198, 11748, 555, 715, 395, 11, 686, 2777, 88, 11, 686, 2777, 10025, 11, 686, 6649...
3.023669
169
""" An utility class for initializing different explainer objects. """ from torch import nn import numpy as np from captum.attr import DeepLift, IntegratedGradients, ShapleyValueSampling, LayerGradCam, Saliency from captum.attr._utils.attribution import LayerAttribution
[ 37811, 198, 2025, 10361, 1398, 329, 4238, 2890, 1180, 4727, 263, 5563, 13, 198, 37811, 198, 198, 6738, 28034, 1330, 299, 77, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 3144, 388, 13, 35226, 1330, 10766, 43, 2135, 11, 35432, 42731, ...
3.84507
71
from django.shortcuts import render from . import forms from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth import authenticate,login,logout # Create your views here. def registro(request): registered = False if request.method == 'POST': user_form = forms.UserForm(data=request.POST) profile_form = forms.UserProfileInfo(data=request.POST) if user_form.is_valid() and profile_form.is_valid(): user = user_form.save() user.set_password(user.password) user.save() profile = profile_form.save(commit=False) profile.user = user if 'profile_pic' in request.FILES: profile.profile_pic = request.FILES['profile_pic'] profile.save() registered = True else: print(user_form.errors,profile_form.errors) else: user_form = forms.UserForm() profile_form = forms.UserProfileInfo() return render(request,'registros/registration.html', {'registered': registered, 'user_form': user_form,'profile_form':profile_form}) def user_login(request): logged = False if request.method == 'POST': username = request.POST.get('username') password = request.POST.get('password') user = authenticate(username=username, password=password) if user: if user.is_active: login(request, user) logged = True return render(request, 'registros/login.html', {'logged': logged}) else: return HttpResponse("Cuenta inactiva") else: print("Alguien intento loguearse y fall") return HttpResponse("Datos de acceso invlidos") else: return render(request, 'registros/login.html',{'logged':logged})
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 198, 6738, 764, 1330, 5107, 198, 6738, 42625, 14208, 13, 7295, 13, 6371, 411, 349, 690, 1330, 9575, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 12501, 273, 2024, 1330, 17594, ...
2.375912
822
from django.conf import settings from django.contrib import admin from geotrek.common.admin import MergeActionMixin from geotrek.outdoor.models import Practice, SiteType if 'modeltranslation' in settings.INSTALLED_APPS: from modeltranslation.admin import TranslationAdmin else: TranslationAdmin = admin.ModelAdmin
[ 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 6738, 4903, 313, 37818, 13, 11321, 13, 28482, 1330, 39407, 12502, 35608, 259, 198, 6738, 4903, 313, 37818, 13, 448, 9424, 13, 27530, 13...
3.457447
94
from __future__ import print_function import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from apiclient.http import MediaFileUpload import gdown def gdrive_up(credentials_path, file_list, folder_id, token_path='/work/awilf/utils/gdrive_token.json'): ''' credentials_path: json containing gdrive credentials of form {"installed":{"client_id":"<something>.apps.googleusercontent.com","project_id":"decisive-engine-<something>","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"<client_secret>","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}} file_list: full path of files to upload, e.g. ['/work/awilf/tonicnet.tar'] folder_id: id of folder you've already created in google drive (awilf@andrew account, for these credentials) e.g. gdrive_up('gdrive_credentials.json', ['hi.txt', 'yo.txt'], '1E1ub35TDJP59rlIqDBI9SLEncCEaI4aT') note: if token_path does not exist, you will need to authenticate. here are the instructions ON MAC: ssh -N -f -L localhost:8080:localhost:8080 awilf@taro ON MAC (CHROME): go to link provided ''' # If modifying these scopes, delete the file token.json. SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly', 'https://www.googleapis.com/auth/drive.file'] creds = None if os.path.exists(token_path): # UNCOMMENT THIS IF DON'T WANT TO LOG IN EACH TIME creds = Credentials.from_authorized_user_file(token_path, SCOPES) if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file(credentials_path, SCOPES) creds = flow.run_local_server(port=8080) with open(token_path, 'w') as token: token.write(creds.to_json()) service = build('drive', 'v3', credentials=creds) for name in file_list: file_metadata = { 'name': name, 'parents': [folder_id] } media = MediaFileUpload(file_metadata['name'], resumable=True) file = service.files().create(body=file_metadata, media_body=media, fields='id').execute() def gdrive_down(url, out_path=None): ''' first, make sure file in url is available for anyone to view url should be of one of these forms: https://drive.google.com/file/d/195C6CoqMBYzteJIx-FFOsNFATvu5cr_z/view?usp=sharing https://drive.google.com/uc?id=1eGj8DSau66NiklH30UIGab55cUWR_qw9 out_path can be None, in which case the result will be the file name from google drive saved in ./. else, save to out_path ''' if 'uc?' not in url: id = url.split('/')[-2] url = f'https://drive.google.com/uc?id={id}' gdown.download(url, out_path) # gdrive_down('https://drive.google.com/file/d/1dAvxdsHWbtA1ZIh3Ex9DPn9Nemx9M1-L/view', out_path='/work/awilf/mfa/') # gdrive_down('https://drive.google.com/file/d/1XEsc6rLXtjfo2rtms2GR0hDqfTiat5Zo/view?usp=sharing') # gdrive_up('/work/awilf/utils/gdrive_credentials.json', ['pyg.sif'], '1zBldu3ipR6LtrJBxxNlaKBPW_kio6nli') gdrive_down('https://drive.google.com/file/d/1eEdRQVgBCcq8DyasduZpMzTlCIjrekLM/view?usp=sharing')
[ 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 11748, 28686, 13, 6978, 198, 6738, 23645, 499, 291, 75, 1153, 13, 67, 40821, 1330, 1382, 198, 6738, 23645, 62, 18439, 62, 12162, 1071, 8019, 13, 11125, 1330, 2262, 4262, 4677, 37535, ...
2.416495
1,455
import pytest from pathlib import Path
[ 11748, 12972, 9288, 198, 6738, 3108, 8019, 1330, 10644, 628, 198 ]
3.727273
11
# @TODO(aaronhma): UPDATE # @TODO(aaronhma): UPDATE
[ 220, 220, 220, 1303, 2488, 51, 3727, 46, 7, 64, 8045, 21720, 2599, 35717, 198, 220, 220, 220, 1303, 2488, 51, 3727, 46, 7, 64, 8045, 21720, 2599, 35717 ]
2.034483
29
import os, logging from foresight.environment.git.git_helper import GitHelper from foresight.environment.git.git_env_info_provider import GitEnvironmentInfoProvider from foresight.environment.github.github_environment_info_provider import GithubEnvironmentInfoProvider from foresight.environment.gitlab.gitlab_environment_info_provider import GitlabEnvironmentInfoProvider from foresight.environment.jenkins.jenkins_environment_info_provider import JenkinsEnvironmentInfoProvider from foresight.environment.travisci.travisci_environment_info_provider import TravisCIEnvironmentInfoProvider from foresight.environment.circleci.circleci_environment_info_provider import CircleCIEnvironmentInfoProvider from foresight.environment.bitbucket.bitbucket_environment_info_provider import BitbucketEnvironmentInfoProvider from foresight.environment.azure.azure_environment_info_provider import AzureEnvironmentInfoProvider from foresight.test_runner_tags import TestRunnerTags from foresight.utils.generic_utils import print_debug_message_to_console LOGGER = logging.getLogger(__name__)
[ 11748, 28686, 11, 18931, 198, 6738, 1674, 18627, 13, 38986, 13, 18300, 13, 18300, 62, 2978, 525, 1330, 15151, 47429, 198, 6738, 1674, 18627, 13, 38986, 13, 18300, 13, 18300, 62, 24330, 62, 10951, 62, 15234, 1304, 1330, 15151, 31441, 123...
4.052632
266
import math import os import random import re import sys if __name__ == '__main__': n = int(input()) arr = list(map(int, input().rstrip().split())) plusMinus(arr)
[ 11748, 10688, 198, 11748, 28686, 198, 11748, 4738, 198, 11748, 302, 198, 11748, 25064, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 299, 796, 493, 7, 15414, 28955, 628, 220, 220, 220, 5240, 7...
2.656716
67
#!/usr/bin/env python3 """Start the godoc server and open the docs in a browser window. This uses the 'open' command to open a web browser. """ import argparse import http import http.client import subprocess import time def is_ready(host, port): """Check if the web server returns an OK status.""" conn = http.client.HTTPConnection(host, port) try: conn.request('HEAD', '/') resp = conn.getresponse() return resp.status == 200 except ConnectionRefusedError: return False def main(): """Do the thing.""" parser = argparse.ArgumentParser(description='Spawn godoc and open browser window.') parser.add_argument('--port', help='port on which to run godoc', default=6060) args = parser.parse_args() host = "localhost" port = args.port # If not already running, start godoc in the background and wait for it # to be ready by making an HTTP request and checking the status. if not is_ready(host, port): subprocess.Popen(["godoc", "-http=:{port}".format(port=port)]) while True: if is_ready(host, port): break print('Waiting for server to start...') time.sleep(1) # Open the docs in a browser window. url = "http://{host}:{port}".format(host=host, port=port) subprocess.check_call(["open", url]) if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 10434, 262, 5770, 420, 4382, 290, 1280, 262, 34165, 287, 257, 6444, 4324, 13, 198, 198, 1212, 3544, 262, 705, 9654, 6, 3141, 284, 1280, 257, 3992, 6444, 13, 198, 198, 3781...
2.687739
522
import glob import os import random import re import sys import numpy as np import bio import config # # experiment to see what position does with one mutation # what is the effect of position? # # # experiment to see what position does with one mutation # what is the effect of position? # # # what is the mapping quality as the distance between repeats and the read change? # # # what is the mapping quality with ultra low entropy # # # what is the mapping quality with tandem repeats # # make fasta with open(sys.argv[2], 'w') as result_fh: if sys.argv[3] == 'position': experiment_pos( result_fh ) elif sys.argv[3] == 'genome': experiment_genome_pos( result_fh ) elif sys.argv[3] == 'distance': experiment_candidate_distance( result_fh ) elif sys.argv[3] == 'entropy': experiment_entropy( result_fh ) elif sys.argv[3] == 'tandem': experiment_tandem_repeats( result_fh ) elif sys.argv[3] == 'unmapped': count_unmapped( sys.stdin, result_fh ) elif sys.argv[3] == 'clip': count_clipped( sys.stdin, result_fh )
[ 198, 11748, 15095, 198, 11748, 28686, 198, 11748, 4738, 198, 11748, 302, 198, 11748, 25064, 198, 198, 11748, 299, 32152, 355, 45941, 198, 198, 11748, 13401, 198, 11748, 4566, 198, 198, 2, 220, 198, 2, 6306, 284, 766, 644, 2292, 857, 3...
2.766234
385
"""Extend user table Revision ID: e3dda7be6a95 Revises: Create Date: 2021-06-07 11:43:45.144088 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "e3dda7be6a95" down_revision = None branch_labels = None depends_on = None
[ 37811, 11627, 437, 2836, 3084, 198, 198, 18009, 1166, 4522, 25, 304, 18, 1860, 64, 22, 1350, 21, 64, 3865, 198, 18009, 2696, 25, 220, 198, 16447, 7536, 25, 33448, 12, 3312, 12, 2998, 1367, 25, 3559, 25, 2231, 13, 1415, 1821, 3459, ...
2.531532
111