index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
994,200
b49c9caaba16a6917e0f337c50dadc75e6dd4718
from sys import stdin from collections import deque """ # sin guardar los equipos def main(): conta = 1 n = int(stdin.readline()) while n != 0: print("Scenario","#"+str(conta)) teams = deque() for i in range(n): m = list(stdin.readline().split()) teams += dequ...
994,201
dafb5bcde2d1cc8014266c54cd986c20f13dd9d8
import serial import time import configparser import os from helpers import parseData, buildSerial def main(): config = configparser.ConfigParser() config.read(os.path.join(os.path.dirname(__file__), "config.ini")) print("Starting serial connection") ser = buildSerial(config["APP"]["DEVICE"]) whi...
994,202
57960d32fc3e22ea87791478537f34fcd46ead4c
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' def user_login(func): def inner(): print('登录') func() return inner @user_login def news(): print('新闻详情') news() # show_news = user_login(news) # show_news() # print(show_news._...
994,203
e2fd602e017a91e9ad025f7bed6a03810af885d1
# -*- coding: utf-8 -*- # this file is generated by gen_kdata_schema function, dont't change it from zvt.domain.quotes.stock.stock_1d_money_flow import * from zvt.domain.quotes.stock.stock_1m_kdata import * from zvt.domain.quotes.stock.stock_1m_hfq_kdata import * from zvt.domain.quotes.stock.stock_5m_kdata import * fro...
994,204
7de977bef33c341a368e81f45ab87ee2566b3afa
from socket import * #获取计算机名称 hostname=gethostname() #获取本机IP ip=gethostbyname(hostname) clientPort=7179 #如何在未连接前得知自己的本地端口号? serverName = 'localhost' serverPort = 12000 clientSocket = socket(AF_INET, SOCK_STREAM) # 用socket函数来创建客户套接字。第一个参数指示底层网络使用的是IPv4。第二个参数指示该套接字是SOCK_STREAM 类型。这表明它是一个 TCP 套接字,而不是一个 ...
994,205
bfef6782ecca067645aaf2556a11714c91c0995b
# This one is like your scripts with argv def print_two(*args): arg1, arg2 = args print(f"arg1: {arg1}, arg2: {arg2}") # Ok, thats *args is actually pointless, we can just do this def print_two_again(arg1, arg2): print(f"arg1: {arg1}, arg2: {arg2}") # This jest takes one argument def print_one(a...
994,206
e1a41ea1fcd7d21060a8071b75d592f413163003
import os import Tkinter as tk import sqlite3 import logging import threading import time import numpy as np from PIL import Image, ImageTk from collections import deque from argparse import ArgumentParser logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) def load_raw_images(f...
994,207
5d6dcce87357fc354b96057b804d4b424f9485a6
fold_model = "./results/svm_ovr/" if not os.path.exists(fold_model): os.makedirs(fold_model) clf =svm.LinearSVC(class_weight= 'balanced', verbose = 1) mc= multiclass.OneVsRestClassifier(clf) accs = [] for j in n_shuffles: #np.random.shuffle(index) index = index_list[j] X = XX[index, :] Y = T...
994,208
7d74b4afebc4d9c1817065d7bc2f220f7c73326a
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
994,209
2a692b65ced5359ea58844975957102dcca28bc5
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ """幸运数字猜猜猜 2.0 于文斌 2020年5月30日""" import random random.randint(0,9) n=1 while n<4: number= input("请您猜0-9中一个数字") guess=int(number) if n==3: if guess==random.randint(0,9): print("恭喜您,GOODLUCK!") print("您和python太有缘分了,lets go on...
994,210
cdc3df62293bf5c8023d84437ab7d99cccdaa6cb
# Source : https://oj.leetcode.com/problems/sqrtx/ # Author : Ping Zhen # Date : 2017-04-17 '''********************************************************************************** * * Implement int sqrt(int x). * * Compute and return the square root of x. * *******************************************...
994,211
f6edf0d4e9229e6198674ae62bd6873c91bbc730
from os import makedirs from os.path import join, split, isdir import create_eml import db import media_download_stats as stats import pandas def mkdir_if_not_exists(directory): if not isdir(directory): makedirs(directory) def convert_filepath_to_urlpath(filepath): return 'https://www.morphosource.org/rss' + fil...
994,212
03614eac51d4afc0a3918b0be3c1c3160ba3e4b9
import click from pymongo import MongoClient import socket import time # ------------------------- CLI ---------------------- @click.group() def cli(): pass @cli.command() @click.argument('hostname') def wait_for_dns(hostname): __wait_for_dns(hostname) @cli.command() def wait_for_local_dns(): __wait_fo...
994,213
e59a861a4b62bbefeb6b1f0fef5b770a0f77bfc5
#!/usr/bin/env python3 import argparse import os import re import sys import time from reportgen import Reportgen class Pipal_Eater(object): def __init__(self): self.file = None self.verbose = False self.version = '0.1' self.pipal_file_content = {} self.start_time = time....
994,214
d3ac9336de395d1fda5f49b165199654a01693e1
#!/usr/bin/python3 from subprocess import call, check_output from sept_demo import init_ir_debian, cmd_to import os ain = "AIN1" min_safe = 1250 ain_path = "/sys/devices/ocp.3/helper.15/" + ain def main(): init_ir_debian() sense_loop(1000) def sense_loop(counter): while counter > 0: ir = int(ch...
994,215
c02f3ec1acb54ee0aadbf9402bab913fd49a8776
from selenium import webdriver import pandas as pd browser = webdriver.Chrome() browser.get('https://www.investidorpetrobras.com.br/acoes-dividendos-e-divida/dividendos-e-jcp/') tabela = browser.find_element_by_css_selector('.tabs-body > div:nth-child(2) > table') tabela = tabela.get_attribute('outerHTML') browser.c...
994,216
2b78c67e5d82ee04d1b01d3a5296ceb4f89f2d88
# a + b + c = 1000, a ^2 + b ^2 = c ^2 # a,b,c > 0 import math input = int(raw_input("BLOOP BLEEP: ")) a = 1 b = 1 c = 1 while a < input: a +=1 b = (input * a - 500 * input)/(a - input) c = math.sqrt(a ** 2 + b ** 2) if (b % 2 == 0 or (b + 1) % 2 == 0) and b > 0: if (c % 2 == 0 or (c + 1) % 2 == 0) and c > 0...
994,217
1224646c8bcb066c7d1f691e5b8a4573958e3b43
import tensorflow as tf from tensorflow.keras import layers def gather_action_probabilities(p, action_ids): gather_indices = tf.stack([ tf.range(tf.shape(action_ids)[0]), action_ids ], -1) return tf.gather_nd(p, gather_indices) def ppo_loss(new_values, values, p, p_old, action_ids, rewa...
994,218
6c5ec0bcfa8fcf3def625db3b76f0f991a6df153
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import os # to get the resume file import time # to sleep import get_links # sample application links if we don't want to run get_links.py URL_l2 = 'https://jobs.lever.co/scratch...
994,219
998d4c7a7c9ecfe2a756181481caf5fc9011a9de
#coding=utf-8 import os import sys sys.path.append("E:\\jiekou") from data.get_data import Get_data from base.demo import RunMain from util.commen import CommonUtil from data.dependdent_data import Deppenddent_data from util.send_mail import SendMail from redis import * import json from pymysql import * from jsonpath_...
994,220
a55d42e485cd5fd921273d029ecafc86975ee353
# -*- coding: utf-8 -*- # Generated by Django 1.9.3 on 2017-04-15 08:05 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('resume', '0014_auto_20170413_1507'), # ('resume', '0014_remove_resume_hireable'), ] operations = [ ]
994,221
9cb2721c40f8db799579b01f31d58a8054e49439
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import re import time import sys def detectGPU_exec(exec_filename, sleep_second): exec_return = None while(exec_return==None): gpustatus = os.popen("nvidia-smi").read() gpustatus = gpustatus.replace("\n", "") pattern = "(\d) TITAN X...
994,222
8fd41dc279a438251eff5690a9035756b6e748af
from syml_schemas.service.schemas import SymlSchemasService if __name__ == '__main__': service = SymlSchemasService() service.unix_serve()
994,223
715e0aa3e76a367113d081d420003ef9c03df359
from functools import reduce from guppy.etc.Descriptor import property_exp class UniSet(object): __slots__ = '_hiding_tag_', 'fam', '_origin_' _help_url_ = 'heapy_UniSet.html#heapykinds.UniSet' _instahelp_ = '' _doc_nodes = """nodes: ImmNodeSet The actual objects contained in x. These are called n...
994,224
f36c81329179aa9b48f91188f9cd5a87f6255635
## Motor Test GUI from Tkinter import Tk, BOTH, RIGHT, RAISED, Listbox, END, LEFT from ttk import Frame, Button, Style class Motor(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Motor Test") self.style = Style() ...
994,225
fb7d9a4f02beeaac817c4909f7873490b069f691
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 6 04:21:23 2020 @author: levitannin Working on threadding module in python. Threading vs Multiprocessing Multiprocessing -- library uses separate memory space, multiple CPU cores, bypasses GIL limitations in CPython, child processes are killa...
994,226
f3e0732e9fe98f7ea53c41765471e35f6a42bdeb
#!/usr/bin/env python # -*- coding: utf-8 -*- """ metrics holds metrics to evaluate results Author: Jacob Reinhold (jacob.reinhold@jhu.edu) Created on: January 14, 2019 """ __all__ = ['jaccard', 'dice', 'largest_cc'] import numpy as np from skimage.measure import label from torch import Tensor def jaccard(x:Tens...
994,227
5f2a8cf700b41d39f3367f2252e9e5f353c115ac
from pycaret.regression import load_model, predict_model import streamlit as st import pandas as pd import numpy as np model = load_model('deployment_model') def predict(model, input_df): predictions_df = predict_model(estimator=model, data=input_df) predictions = predictions_df['Label'][0] return predict...
994,228
d8ab21dfe4aacc5a12ce3c4d3ce557037a8436a4
import pandas as pd from coding_the_matrix import Vec from coding_the_matrix import matutil from numbers import Number import numpy as np def vec_mul_mat(u, M): """vec * matrix multiplication""" assert u.D == M.D[0] # get a row representation of matrix return Vec.Vec(M.D[1], {k: u * vec for k, vec in ...
994,229
145064f1444de21c6f652cbf26df25b3c7af9a14
#! /usr/bin/env python3 import sys def isLoadStore(instruction: str): return (instruction.find("mov") != -1 or instruction.find("add") != -1 or instruction.find("sub") != -1 or instruction.find("mul") != -1 or instruction.find("sal") != -1 or instruction.find("sar") != -1 or instruction.find("xor") != -1 or instruc...
994,230
28041a46a3cc302f94edf3cddb14a5b762ab5c4e
# Generated by Django 3.1.3 on 2020-12-15 15:40 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('api', '0007_profile'), ] operations = [ migrations.AddField( model_name='ad', name='Tim...
994,231
67b1d926d0d0dc1260e811b429480ccee0f81ce8
# -*- coding: utf-8 -*- from odoo import models, fields, api class ProductProduct(models.Model): _inherit = 'product.product' x_service_remind_ids = fields.One2many('product.service.remind', 'product_id', string="Remind Service") x_is_remind = fields.Boolean(string="Is remind", default=False) def g...
994,232
3b00e7993fe3df0b4059a3cdf2fd591e6cef83d8
alist = [100, 200, 300, 400, 500] blist = [] for i in alist[::]: blist.append(i) print(blist)
994,233
e25eb3ecfab44b06322111b47c330dfca2a98770
from pwn import * import sys if len(sys.argv) == 1 : p = process('./pwn200') else : print 'Remote server is disabled' exit() # Gadget pop_1_ret = 0x8048331 # Address puts_plt = 0x8048360 read_got = 0x804A00C puts_got = 0x804A010 payload = 'A'*(0x18+4) payload += p32(puts_plt) payload += p32(pop_1_ret) payload +=...
994,234
b6123793cd00d49d0866556a5e69ea7513891e8e
from tests.base_case import ChatBotTestCase from chatterbot.trainers import Trainer from chatterbot.conversation import Statement class TrainingTests(ChatBotTestCase): def setUp(self): super().setUp() self.trainer = Trainer(self.chatbot) def test_trainer_not_set(self): with self.ass...
994,235
37d1e5b7ace4ca7f1c90ed632acdc05dd6593d8e
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module is here to make it easy load various text corpuses into other scripts. """ from os import path from nltk.corpus.reader import PlaintextCorpusReader pwd = path.curdir def load_pres_debates(): """ Returns the corpus for the presidential debates. ...
994,236
75b0c8bd407c17b6fc5d6bd04e2dd069fed7ad07
class Solution(object): def constructArray(self, n, k): i, j = 1, n res = [] while i <= j: res.append(i) if i != j: res.append(j) i+=1 j-=1 res = res[:k-1] + sorted(res[k-1:]) if k>1 and res[k-2]<=n/2: ...
994,237
0afc1fc1f3c8f70ec8f28dfbfbd6b900373074b9
import gc, const, plotter, file_refs import numpy as np from scipy import interpolate from excel import ExcelReader # These calculations reference equations in 2 papers: # "Limitations on Observing Submillimeter and Far Infrared Galaxies" by Denny # and # "Fundamental Limits of Detection in the Far Infrared" by Denny ...
994,238
828db2a3154304b87c8e4aa357cf3253cf8bac2c
# -*- coding: utf-8 -*- """ Created on Fri Feb 19 16:55:54 2016 @author: Administrator """ import pandas as pd import pandas.io.sql as pd_sql import sqlite3 as sql df_file = pd.read_csv('CS_table_No2_No4_new.csv',delimiter=";", skip_blank_lines = True, error_bad_lines=False,encoding='utf8') df_file...
994,239
3fe19b57673195d5c21a6420ef3057fceb6be422
#! usr/bin/python3 if (__name__ == "__main__"): from abstract_sniffer import Abstract_Sniffer import abc import os else: from smellml_modules.abstract_sniffer import Abstract_Sniffer import abc import os class Pylint_Sniffer(Abstract_Sniffer): CMD = str(f"pylint INFILE") sniffer_name = ...
994,240
1c50195fe10f2bfd18025d05c7055ae9ed2c08ca
import re import string import pickle import itertools as it from argparse import ArgumentParser def num_vowels(word): return len(re.findall("[AEIOU]", word)) def num_consonants(word): return len(word) - num_vowels(word) def point_value(word): points = [ 1, 3, 3, 2, ...
994,241
3ff725e4b7ae33726b7ffb23fd2edc6d73eb97c6
from .async_stream_receiver import AsyncStreamReceiver from .tcp_stream_receiver import TCPStreamReceiver class AsyncTCPStreamReceiver(AsyncStreamReceiver, TCPStreamReceiver): def __init__(self, ip, port, *args, **kwargs): TCPStreamReceiver.__init__(self, ip, port, *args, **kwargs) AsyncStreamRec...
994,242
c32394ea0af0e7d1c91048ac63b9d323aa58a0d4
import sys, math nums = map(int, sys.stdin.readlines()[1:]) gauss = lambda x: (x/2.0)*(1+x) total = gauss(len(nums)-1) a = max(nums) nums.remove(a) b = max(nums) nums.remove(b) if a == b: cnt = gauss(1 + nums.count(a)) else: cnt = 1 + nums.count(b) shit_fmt = lambda x: math.floor(x*100.0)/100.0 # b/c hacke...
994,243
f5f181bc7cb377ad166c2eb198b4f39dff4d6c00
# Generated by Django 3.0.3 on 2020-03-01 18:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rule_based_engine', '0005_auto_20200302_0002'), ] operations = [ migrations.AlterField( model_name='camp_rules', nam...
994,244
1da65c6e632c50db358c4a7e5d540af24f52359b
# -*- coding: utf-8 -*- from __future__ import division import math valor=input('Digite quanto deseja sacar:') a=20 b=10 c=5 d=2 e=1 j=(valor//a) r=(valor%a) if r == 0: print('a= %.1d'% j)
994,245
9efca94ef458a8e118c5dce57da1205fbc69ec39
import os.path import numpy as np import pandas as pd import util # Query elasticsearch for the items to use for the data set def download_data(query_body, filename): query_results = util.es_bulk_query(query_body) data = [] columns = set() count = 0 # Fill out the columns for item in query_re...
994,246
18103a4e900919fbc0ad1956eee5fd66bf59b206
# Generated by Django 2.0.6 on 2018-08-15 01:22 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Airport', fields=[ ...
994,247
790c897bfe4d5c28ffc6d8c927b180b7e717f3cb
import numpy as np import cv2 from constants import * from utilities import * # average movement sensitivity sensitivity = 2.5 class optical_flow_advanced_tracker: def __init__(self): self.track_len = 10 self.detect_interval = 5 self.tracks = [] self.cam = cv2.VideoCapture(0) ...
994,248
816faa4b2bf15f81a077440778bf7ffda2bbbc33
# coding=utf-8 # Copyright (c) 2015 EMC Corporation. # 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 # #...
994,249
5518a9fa27ee3455ca76b9c7e5f42abc34048a22
from django.db import models from django.contrib.auth.models import User from django.contrib.auth import get_user_model # Create your models here. class Tag(models.Model): tagname = models.CharField(max_length=50) def __str__(self): return self.tagname class Question(models.Model): di...
994,250
a0e5bd3d5480e6ac6d76a92eaf9960fe156584b4
## 문제: https://leetcode.com/problems/combination-sum/ ## 풀이: dfs, 백트래킹 ## Runtime: 32 ms, faster than 99.17% of Python online submissions for Combination Sum. ## sort candidates -> makes possible stop early class Solution(object): def combinationSum(self, candidates, target): results = [] ...
994,251
38272ce20969159475c891746f85c4f6375fbeed
print('-=-=-=-=- Fatorial -=-=-=-=-\n') num0 = int(input('Número = ')) num = num0 if num0 < 0: num = - num0 print('O número dado é negativo, continuaremos com seu módulo: |{}| = {}' .format(num0, num)) num0 = num fat = 1 print('{}! = ' .format(num0), end='') while num >= 1: fat = fat * num print(...
994,252
e0ec4bac6cc1742d5a4e1f313e4547bf7cd3b198
def calculate_apr(principal, interest_rate, years): # Condition to check if all the values entered are non-negative if principal >= 0 and interest_rate >= 0 and years >= 0 p = principal i = interest_rate y = years # Condition to check if the entered values are what they are supposed to be # prinicipal and ...
994,253
29ae7e7f96b95ee9f78b443039779534840e19f5
from setup import BASE_DIR from setup import ENGINE from setup import DataFrame from setup import datetime from setup import pd from setup import re """Used for loading stop words and input files, and for writing to export files.""" def load_stop_words() -> list: """Load the stop words compiled manually...
994,254
28756cfbb1db8223d1fe0d6036f858459eff19e7
# -*- coding: utf-8 -*- import RPi.GPIO as GPIO import time a = 0.5 COUNT = 10 PIN1 = 17 PIN2 = 18 GPIO.setmode(GPIO.BCM) GPIO.setup(PIN1,GPIO.OUT) GPIO.setup(PIN2,GPIO.OUT) for _ in xrange(COUNT): GPIO.output(PIN1,True) time.sleep(a) GPIO.output(PIN2,True) time.sleep(a) GPIO.output(PIN1,False) time.sleep(a) G...
994,255
f621828920dac78610549345e0128ba9c2d67047
from django.urls import path, re_path from django.conf.urls import url from . import views app_name = 'blog' urlpatterns = [ path('', views.index, name='index'), re_path(r'^(?P<slug>[\w-]+)/$', views.detail, name='detail') ]
994,256
f12df0f66c266449bb4dc25d2395997b7ddda20a
N = int(input()) A = list(map(int, input().split())) amax = max(A) max_idx = A.index(amax) amin = min(A) min_idx = A.index(amin) ans_list = [] if amax*amin < 0: if abs(amax) >= abs(amin): for i in range(N): A[i] += amax ans_list.append([max_idx+1, i+1]) else: for i in ra...
994,257
903ffdf15faca6d4304372d4b38fe5908d60089e
# Generated by Django 3.0.3 on 2021-03-19 17:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0014_auto_20210319_2156'), ] operations = [ migrations.AddField( model_name='telegram', name='confirm_paid'...
994,258
931e2020d6d0588ef117ef96c829515537d352b1
__author__ = 'Mohamed' import sys import json import cgi def gerar_campos_busca(): campos = FORM( DIV(_id='div_campos_busca_geral', *FIELDSET( LEGEND(_id='lgd_campos_busca_geral', *'BUSCA'), INPUT(_type='radio', _id='chk_busca_1', _name='ch...
994,259
960e00276841e7d48dc3c4df8bfc4e1f58f4de5d
#!/usr/bin/env python import subprocess import sys from subprocess import PIPE def extract(filename, table): overall_count = 0 overall_time = 0 count = 0 time = 0 with open(filename, 'r') as f: for line in f.readlines(): for i in range(3): if not line.strip():...
994,260
1f1710c149810be37dbdab0536f83869e0931679
class Solution: def taskSchedulerII(self, tasks: 'List[int]', space: int) -> int: #O( N | N ) date = 1 #current date d = {} #to record last time the task was performed for t in tasks : if t not in d or d[t] + space + 1 < date: #current task can be performed d[t] ...
994,261
bb77229bc913ccc8801ac5c0469b6528835e5eb6
# Generated by Django 3.1.4 on 2020-12-19 12:36 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('clues', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='clue', name='codeword', ), ...
994,262
42be26907190bcfd80b5e128fd00ee007e3efc33
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## ### ### This file is part of the BBS software (Bioconductor Build System). ### ### Authors: ### Andrzej Oleś <andrzej.oles@embl.de> ### Hervé Pagès <hpages@fredhutch.org> ### ### Last modific...
994,263
b5dd4e334e611267de1fa0eaa970be49ec7996d3
from collections import deque import sys T = int(sys.stdin.readline()) for i in range(T): N, M = map(int, sys.stdin.readline().split()) arr = list((map(int, input().split()))) queue = deque(enumerate(arr)) cnt = 0 flag = -1 answer = 0 while queue: point = queue.popleft() if ...
994,264
059210140f9fb045f348e28842e54e154414a2ce
import pygame import sys WHITE=(255,255,255) BLACK=(0,0,0) def main(): pygame.init() pygame.display.set_caption('My Game') screen=pygame.display.set_mode((640,360)) clock=pygame.time.Clock() img_bg=pygame.image.load('pg_bg.png') img_chara=[ pygame.image.load('pg_chara0.png'), pygame.image.load('pg_chara1.pn...
994,265
f23464ca93b05f68f51b85ef5a37ef504933c834
f = open("input.txt") inp = '' out = '' for line in f: #print(line) if line[-1] == '\n': inp += line[:-1] else: inp += line def calcSize( segment ): count = 0 i = 0 #print(segment) while i < len(segment): if segment[i] == '(': inst = '' x = 1 ...
994,266
170dca043ea496c95665e7734102bc7c462ca22c
# -*- coding:utf-8 -*- ''' ''' from ass_module import AssModule import ass_base class AssBase(AssModule): def __init__(self): super(AssBase, self).__init__() self.print_report = False def run(self): super(AssBase, self).run() ass_base.write_file(self.apk_...
994,267
da4aa8f0eceb76e23579dd8c7698d9e12817ae47
from cog.models import * from django.forms import ModelForm, ModelMultipleChoiceField, NullBooleanSelect from django.db import models from django.contrib.admin.widgets import FilteredSelectMultiple from django import forms from django.forms import ModelForm, Textarea, TextInput, Select, SelectMultiple, FileInput, Check...
994,268
6959e82dfb1e2a2b7eaf08e962f42ed370908bb4
# Cracking the Coding Interview # p 79 - converting between hex and binary # 3/11/2016 # @totallygloria def convert_10(num, base): lookup = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" int_sum = 0 for i in range(len(num)): # counts bases from zero up, walks backward through string int_sum += (base ** i) * lookup....
994,269
f8d1e6567bbefc5bb0d1e348984bdb9c264d8ea5
# -*- coding: utf-8 -*- from flectra import http # class YkpAbsen(http.Controller): # @http.route('/ykp_absen/ykp_absen/', auth='public') # def index(self, **kw): # return "Hello, world" # @http.route('/ykp_absen/ykp_absen/objects/', auth='public') # def list(self, **kw): # return http...
994,270
8cbf306c26051ab2a49edc620aabe343760c6549
# Copyright (c) 2012, CyberPoint International, LLC # 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 lis...
994,271
bfb4a4cca5702191b61245dc837e494cbcd3e939
## Vacuum control program ## Built for VASP 4.6 or above format ## Built as a preliminary work as a part of MTG Materials Tool Kit. ## By Johnny Chang-Eun Kim, April. 2013 from vacuum_agent import * from sys import argv ##where='0.5' ##howmuch='-10.0' target=load('POSCAR', 'vacuum_edit') where=argv[1] howmuch=argv[2] ...
994,272
f14682ec87a7a211ce397fcafc9206b81ba332d5
from itertools import permutations n = int(input()) inning = [list(map(int, input().split())) for _ in range(n)] answer = 0 for order in list(map(list, permutations(range(1, 9), 8))): order = order[:3] + [0] + order[3:] score = 0 i = 0 for k in range(n): out = 0 base1, base2, base3 = 0,...
994,273
a99bbf44434be264b4d823d25392538964245ca7
# -*- coding: UTF-8 -*- from pysenal.io import * from datagrand_ie_2019.utils.constant import * from datagrand_ie_2019.data_process.entity2label import Entity2Label def process_training_data(src_filename, dest_filename): e2l = Entity2Label(resolve_conflict=False) data = [] for idx, line in enumerate(read_...
994,274
a58bca03675a31f7ddb1852a1a2bc132c6a5a06d
#!/usr/bin/env python3 # Copyright (c) 2015, Bartlomiej Puget <larhard@gmail.com> # 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 copy...
994,275
2ad360f9d18daf4288558fa33d1108b59e41c5e2
import turtle from random import randint #region dessiner l'echiquier Circuit = turtle.Turtle() turtle.Screen().setworldcoordinates(-20, turtle.Screen().window_height()/(-2),500,20) Circuit.hideturtle() Circuit.speed(100) for i in range(4): Circuit.forward(400) Circuit.right(90) a = 0 b = 0 for i in range(8): ...
994,276
8b0bf16e775610481c0ad807be30cd8bd1be10c3
'''input file''' import math bcc_screw = { # edge length of a unit cell (scaled by lattice constant) "cell_x" : math.sqrt(2), #[-1,1,0] "cell_y" : math.sqrt(6)/3, #[1,1,2] "cell_z" : math.sqrt(3)/2,#[1,1,1] # basis atoms (relative coordinates) "basis_atom...
994,277
1b7758bdfa66c3e4ea54060330f342e2446e88bc
from django.contrib import admin from django_vcs.models import CodeRepository class CodeRepositoryAdmin(admin.ModelAdmin): prepopulated_fields = { 'slug': ('name',) } admin.site.register(CodeRepository, CodeRepositoryAdmin)
994,278
14d127424b2e593bfa7ae7a5f9da2877239c72e2
# Grid codes from . import Q2012034_L3m_DAY_EVSCI_V1_2DR_SSS_1deg # Swath codes from . import Q2011280003000_L2_EVSCI_V1_2
994,279
ca7b5e1fa0ba4697d4e2104c97e1808edff95fb0
import os import operator root = r'/Users/michaelpuncel/Desktop/Spring2013/6.345/speech-authentication/by_speaker/' matlab_script = file(r'/Users/michaelpuncel/Desktop/Spring2013/6.345/speech-authentication/matlab_scripts/mfcc_saver.m', 'w') for root, dirs, files in os.walk(root): for dir in dirs: for roo...
994,280
0c95519365f06508adb87e3f065cc498690d1197
from fdx_color_extractor import FdxColorExtractor import sys import click import os import json sys.path.append('../core') @click.command() @click.option('--swatch', '-s', default=False, help='True, True indicates images are swatch images') @click.option('--image', '-i', help='path of the image') @click.op...
994,281
6c939a68c27a67db4bc4278b1480b9b2cff3d6d2
from colorama import init, Fore import os from string import Formatter import random from .support import merge def get_field_value(field_name, mapping): try: def recursive_get(field_name, mapping): if '.' not in field_name: return mapping[field_name], True ...
994,282
55ae25b40552d541b917af7ebc3aa1de4e4ca3d6
from models import Advertiser from models.ad import Ad if __name__ == '__main__': advertiser1 = Advertiser('name1') advertiser2 = Advertiser('name2') ad1 = Ad(title='title1', image_url='image-url1', link='link1', advertiser=advertiser1) ad2 = Ad(title='title2', image_url='image-url2', link='link2', adv...
994,283
cfa9d3f6348637835af0313b8c6a14c5c9274d1b
#Autor: Felipe Gomez Portugal # km = float(input("Teclea el numero de km recorridos: ")) lt = int(input("Teclea el numero de litros de gasolina usados: ")) rendimiento =
994,284
8c648c168d08eb1b65e8ff11c98d57a7f00984b9
#!/usr/bin/env python """ mark-duplicate-phrases.py: mark duplicate sequences of n words usage: mark-duplicate-phrases.py file1.xml [file2.xml ...] notes: * divides body texts in texts (original) and dups (duplicates) * ref attributes contain message ids and word ids (n.m) 20190723 erikt(at)xs4...
994,285
9f8d6d6a7b2a06ac1117f83b8ab6487fa1bef40a
odd = list(range(1,20,2)) print("The first three numbers of the list are ") print(odd[0:3]) print("\nThree items from the middle of the list are: ") print(odd[3:7]) print("\nThe last three items in the list are: ") print(odd[-3:])
994,286
f18ea982bea51b04f9026d4461e8afb7b169897b
from Products.CMFCore.utils import getToolByName import itertools from zope.component import getGlobalSiteManager, getSiteManager from zope.app.component.hooks import getSite from plone.app.themeeditor.interfaces import IResourceType from plone.app.themeeditor.interfaces import IResourceRegistration from zope.interface...
994,287
b7bad52d6dad7825d53e6b8f072f79a70c02db58
from moviepy.video.io.VideoFileClip import VideoFileClip from image_processing import ImageProcessing def video_processing(file_name): video_output = "output_videos/" + file_name[:-4] + "_result.mp4" image_processing = ImageProcessing.invoke clip1 = VideoFileClip(file_name) white_clip = clip1.fl_ima...
994,288
5297e99caf896842a65cdfb5770128718ec7fc7d
import ibis from ibis_vega_transform.util import promote_list def collect(transform: dict, expr: ibis.Expr) -> ibis.Expr: """ Apply a vega collect transform to an ibis expression. https://vega.github.io/vega/docs/transforms/collect/ Parameters ---------- transform: dict A JSON-able d...
994,289
0267a3c63e1df17450bcad885afa1da3325463a0
import pytest from demisto_sdk.commands.common.hook_validations.incident_field import ( GroupFieldTypes, IncidentFieldValidator) from demisto_sdk.commands.common.hook_validations.structure import \ StructureValidator from mock import patch class TestIncidentFieldsValidator: NAME_SANITY_FILE = { 'c...
994,290
dadc65c3853ffda9e6a2973ab0bebf609e9d9b5c
import numpy as np import matplotlib.pyplot as plt import cluster_utils from cluster_class import cluster_class from cluster_class_bonus import cluster_class_bonus from sklearn.cluster import KMeans import plot #Load train and test data train = np.load("../../Data/ECG/train.npy") test = np.load("../../Data/ECG/test.np...
994,291
98df772795a941a59978fa9789638d2cd730a709
from PIL import Image from StringIO import StringIO from redmap.common.urls import fqdn from redmap.common.wms import get_distribution_url from django.contrib.auth.models import User from django.core import serializers as django_serializers from django.core.files.uploadedfile import InMemoryUploadedFile from redmap.app...
994,292
6d9600ec2cdc0d3f92729e73d483687479b64edf
def left_rotation(arr): temp = arr[0] for i in range(len(arr)-1): arr[i] = arr[i+1] arr[len(arr)-1] = temp def array_rotation(arr,pos): for i in range(pos): left_rotation(arr) print(arr) def main(): arr = list(map(int,input("Please enter the array: ").split())) ...
994,293
6ca26503dd10e2cc288375da8c1000ab0d30c47d
# Copyright 2016 Huawei, 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 applica...
994,294
7d46f816d5810fb5fd0f35590bb8702afe531660
# author: Justin Cui # date: 2019/10/23 # email: 321923502@qq.com # 加入数据 def load_dataset(): dataSet = [['bread', 'milk', 'vegetable', 'fruit', 'eggs'], ['noodle', 'beef', 'pork', 'water', 'socks', 'gloves', 'shoes', 'rice'], ['socks', 'gloves'], ['bread', 'milk', 'sho...
994,295
ee113d352fe637ff2803f7e6c4592bc5f1f0a086
from csv_writer import CSVWriter from canonical_name import canonicalName from current_team_name import currentTeamName from draft_loader import DraftLoader from keepers_loader import KeepersLoader from player import Player from player_status_finder import PlayerStatusFinder from team import Team from team_loader impor...
994,296
20c76bf6cb5343e4336bc3fa739238d00d7c85b5
from flask import Blueprint, request, render_template,redirect,url_for import json from models.items import Item item_blueprint = Blueprint("items",__name__) @item_blueprint.route("/") def index(): items = Item.getAll() return render_template("item/index.html",items=items) @item_blueprint.route("/new",method...
994,297
6cd6af7251aa8c2f9d637871e884db133b250520
# This problem was asked by Google. # The area of a circle is defined as pi*r^2. Estimate pi to 3 decimal places using a Monte Carlo method. # Hint: The basic equation of a circle is x2 + y2 = r2. # pi*r^2 = Area of circle # x^2 + y^2 = r^2 # # l * w = Area of square # (2r) * (2r) = 4r^2 = Area of square # # Therefor...
994,298
86489b68a938ab7d6f8023d31d7f3815e4556ac9
import os import subprocess # This grabs book data # subprocess.call(["java","-jar", "pdfbox-app-2.0.2.jar", # "ExtractText", "/Users/terences/Downloads/approximate_injectivity.pdf", # "output/approximate_injectivity.txt"]) import nltk # nltk.download() text_file = "" with open("outp...
994,299
21b0d4ef63797619f18d33b6c71892992e087797
/Users/kmsnyder2/anaconda/lib/python3.6/copy.py