code
stringlengths
13
1.2M
order_type
stringclasses
1 value
original_example
dict
step_ids
listlengths
1
5
from plprofiler_tool import main from plprofiler import plprofiler
normal
{ "blob_id": "6b616f5ee0a301b76ad3f7284b47f225a694d33c", "index": 1281, "step-1": "<mask token>\n", "step-2": "from plprofiler_tool import main\nfrom plprofiler import plprofiler\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
# Generated by Django 3.0.8 on 2020-07-29 18:30 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('scenario', '0005_auto_20200729_1149'), ] operations = [ migrations.RemoveField( model_name='weapon', name='vehicle', ...
normal
{ "blob_id": "b99093fb13c59d4b9bb0a4f32fb62423d6752118", "index": 6480, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('scenario', ...
[ 0, 1, 2, 3, 4 ]
#!c:\Python\python.exe # Fig 35.16: fig35_16.py # Program to display CGI environment variables import os import cgi print "Content-type: text/html" print print """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">""" print """ <html xmlns = "http://www...
normal
{ "blob_id": "61b28088e4344d8a94006e5c04c189a44bbb6ff3", "index": 3334, "step-1": "#!c:\\Python\\python.exe\r\n# Fig 35.16: fig35_16.py\r\n# Program to display CGI environment variables\r\n\r\nimport os\r\nimport cgi\r\n\r\nprint \"Content-type: text/html\"\r\nprint\r\n\r\nprint \"\"\"<!DOCTYPE html PUBLIC\r\n ...
[ 0 ]
#!/usr1/local/bin/python import os, sys, re, shutil, random from tempfile import * # program location prog_dir = '/home/jpei/test_promals3d_package/bar/promals_package/bin/' # program names promals_web = prog_dir + "progress_for_web.py" csv_cutoff_g = 5 alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV...
normal
{ "blob_id": "b9386cf8c17b28fd1fea6e587ca4401de247cbea", "index": 7779, "step-1": "#!/usr1/local/bin/python\n\nimport os, sys, re, shutil, random\nfrom tempfile import *\n\n\n# program location\nprog_dir = '/home/jpei/test_promals3d_package/bar/promals_package/bin/'\n\n# program names\npromals_web = prog_dir + \"...
[ 0 ]
#!/usr/bin/env python # coding: utf-8 from sklearn.metrics import confusion_matrix import numpy as np import pandas as pd df = pd.read_csv('orb.csv') d = pd.pivot_table(df,index='col1',columns='col2',values='result') d.fillna(0,inplace=True)
normal
{ "blob_id": "ce65a672cae26bdb8ec8cb04eabfe1877f9cd7d4", "index": 9558, "step-1": "<mask token>\n", "step-2": "<mask token>\nd.fillna(0, inplace=True)\n", "step-3": "<mask token>\ndf = pd.read_csv('orb.csv')\nd = pd.pivot_table(df, index='col1', columns='col2', values='result')\nd.fillna(0, inplace=True)\n", ...
[ 0, 1, 2, 3, 4 ]
import numpy as np import cv2 import time cap = cv2.VideoCapture(0) ret, frame = cap.read() average_stack = np.float32(np.copy(frame))/255 frames = 1.0 while(True): # Capture frame-by-frame ret, frame = cap.read() frame = np.float32(frame)/255 average_stack = average_stack * frames + frame frames...
normal
{ "blob_id": "7fd89272d3d3584f35fd8f552cb7b14e57b7ed1b", "index": 1591, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n ret, frame = cap.read()\n frame = np.float32(frame) / 255\n average_stack = average_stack * frames + frame\n frames += 1.0\n average_stack = average_stack / f...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 import pandas as pd import csv def get_apriori_input(input_file,output_file,sample_col="Sample",gene_id_col="Gene_ID"): df=pd.read_csv(input_file,sep="\t") sample_names=df[sample_col].unique() with open(output_file,"w") as out: csv_writer=csv.writer(out,delimiter="\t") ...
normal
{ "blob_id": "e14bea6376c8649bf9c9c5759d530af773664cd4", "index": 891, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_apriori_input(input_file, output_file, sample_col='Sample',\n gene_id_col='Gene_ID'):\n df = pd.read_csv(input_file, sep='\\t')\n sample_names = df[sample_col].unique(...
[ 0, 1, 2, 3, 4 ]
#a list of functions/Classes to be inported when a user imports * from swarmpose __all__ = ['Swarmpose']
normal
{ "blob_id": "e375501e6b815530e61af9181d4cade83d4588ca", "index": 8762, "step-1": "<mask token>\n", "step-2": "__all__ = ['Swarmpose']\n", "step-3": "#a list of functions/Classes to be inported when a user imports * from swarmpose\n__all__ = ['Swarmpose']", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
import json # No llego a solucionarlo entero. #Aparcamientos que estan cubiertos en el centro de deportes . from pprint import pprint with open('Aparcamientos.json') as data_file: data = json.load(data_file) for x in data['docs']: if x['TIPOLOGIA'] == 'Cubierto': print(x['NOMBRE']) elif x['TIPOLOGIA'] == '...
normal
{ "blob_id": "d111f93144a1d2790470365d0ca31bcea17713d7", "index": 8766, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('Aparcamientos.json') as data_file:\n data = json.load(data_file)\nfor x in data['docs']:\n if x['TIPOLOGIA'] == 'Cubierto':\n print(x['NOMBRE'])\n elif x['TIPOL...
[ 0, 1, 2, 3 ]
import streamlit as st from streamlit.components.v1 import components from streamlit.report_thread import get_report_ctx from util.session import * from multipage import MultiPage from pages import register def app(page): if not login_status(): title_container = st.empty() remail_input_container = ...
normal
{ "blob_id": "41cfd558824b6561114a48a694b1e6e6a7cb8c05", "index": 7, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef app(page):\n if not login_status():\n title_container = st.empty()\n remail_input_container = st.empty()\n rpw_input_container = st.empty()\n rregister...
[ 0, 1, 2, 3 ]
__author__ = 'Jager' from equipment import Equipment class Weapon (Equipment): def __init__(self, name, power): super(Weapon, self).__init__(name) self.power = power @staticmethod def fromJSON(jsonstr): obj = Equipment.fromJSON(jsonstr) return Weapon(obj["name"], obj["powe...
normal
{ "blob_id": "276d7ac493ddcb327dbce279d9f4bc8a74c98245", "index": 5749, "step-1": "<mask token>\n\n\nclass Weapon(Equipment):\n\n def __init__(self, name, power):\n super(Weapon, self).__init__(name)\n self.power = power\n <mask token>\n\n def __str__(self):\n return '{}: Power({})'....
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys,os,traceback from PIL import Image class ResizeImageBuilder: def __init__(self): # print(self.__class__) pass def setOriginImagePath(self, filePath): try: img = Image.open(filePath) # img = img.convert('R...
normal
{ "blob_id": "47119f46cdbbb7306aef8237d4f56f0f10690ae4", "index": 9245, "step-1": "<mask token>\n\n\nclass ResizeImageBuilder:\n\n def __init__(self):\n pass\n\n def setOriginImagePath(self, filePath):\n try:\n img = Image.open(filePath)\n print('origin image mode:', img....
[ 5, 6, 8, 9, 10 ]
from string import Template import os #-----template objects----- #for putting a template inside an ifdef guard TIfGuard = Template("""if(${condition}) ${innerbody} endif()\n""") #For minimum cmake version and project name TProjectSettings = Template("""cmake_minimum_required (VERSION ${MinCmakeVer}) project(${Name}...
normal
{ "blob_id": "8cba57e3552e0072720fe42fa1949534f29d71b5", "index": 1562, "step-1": "<mask token>\n\n\ndef WriteToFile(f, output, condition=False, conditionID=''):\n f.write(output if not condition else WrapInGuard(conditionID, output))\n\n\n<mask token>\n\n\ndef WrapInGuard(condition, innerbody):\n return TI...
[ 8, 12, 15, 16, 18 ]
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from interface_app.models import TestTask, TestCase from interface_app.extend.task_run import run_cases import os import json from interface_app.apps import TASK_PATH, RUN_TASK_FILE """ 说明:接口任务文件,返回HTML页面 """ # 获取任务列表 def...
normal
{ "blob_id": "8be70543a7aa177d9ad48fb736228b1ffba5df16", "index": 6179, "step-1": "<mask token>\n\n\ndef run_task(request, tid):\n if request.method == 'GET':\n task_obj = TestTask.objects.get(id=tid)\n cases_list = task_obj.cases.split(',')\n cases_list.pop(-1)\n task_obj.status = ...
[ 1, 2, 3, 4, 5 ]
import os #defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":50} defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":"...
normal
{ "blob_id": "a826f33361ec59824f3c4a83d01e94c6b307b0a9", "index": 9144, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor condition in conditions:\n print(condition)\n command = ['./nk_oee -MODES_RESOLUTION 10 -SEED', seed]\n dir_name = []\n for var in defaults:\n if var not in conditi...
[ 0, 1, 2, 3, 4 ]
a = 1 b = a print(a) print(b) a = 2 print(a) print(b) # 全部大写字符代表常量 USER_NAME = "常量" print(USER_NAME) print(USER_NAME)
normal
{ "blob_id": "1cc9a7bbe1bda06ce76fa8ec1cdc17c7b2fde73b", "index": 4051, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a)\nprint(b)\n<mask token>\nprint(a)\nprint(b)\n<mask token>\nprint(USER_NAME)\nprint(USER_NAME)\n", "step-3": "a = 1\nb = a\nprint(a)\nprint(b)\na = 2\nprint(a)\nprint(b)\nUSER_N...
[ 0, 1, 2, 3 ]
import pickle import select import socket import sys from threading import Thread from typing import Dict, Tuple import pygame from pygame.locals import * import c from models import * class Game: location: list[int, int] = [c.WIDTH / 2, c.HEIGHT / 2] velocity: list[int, int] = [0, 0] current_player: Pl...
normal
{ "blob_id": "418798369578e80ecbf82da802b23dc6ca922569", "index": 7107, "step-1": "<mask token>\n\n\nclass Game:\n location: list[int, int] = [c.WIDTH / 2, c.HEIGHT / 2]\n velocity: list[int, int] = [0, 0]\n current_player: Player = None\n other_players: Dict[str, Tuple[Player, Tuple[int, int]]] = {}\...
[ 10, 11, 12, 14, 15 ]
# vim:sw=4 ts=4 et: # Copyright (c) 2015 Torchbox Ltd. # tomasz.knapik@torchbox.com 2017-12-07 # # Permission is granted to anyone to use this software for any purpose, # including commercial applications, and to alter it and redistribute it # freely. This software is provided 'as-is', without any express or implied # ...
normal
{ "blob_id": "6f271e6cfb03977d52c50562c3c394b962c9af83", "index": 7538, "step-1": "<mask token>\n\n\nclass MarkdownBlock(TextBlock):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MarkdownBlock(TextBlock):\n\n def __init__(self, required=True, help_text=None, **kwargs):\n s...
[ 1, 3, 4, 5, 6 ]
from Adafruit_LSM9DS0 import Adafruit_LSM9DS0 import math imu = Adafruit_LSM9DS0() pi = 3.14159265358979323846 # Written here to increase performance/ speed r2d = 57.2957795 # 1 radian in degrees loop = 0.05 # tuning = 0.98 # Constant for tuning Complimentary filter # Converting accelerometer readings to degrees ax ...
normal
{ "blob_id": "973a58013160cbc71ca46f570bde61eaff87f6a7", "index": 7489, "step-1": "from Adafruit_LSM9DS0 import Adafruit_LSM9DS0\nimport math\n\nimu = Adafruit_LSM9DS0()\n\npi = 3.14159265358979323846 # Written here to increase performance/ speed\nr2d = 57.2957795 # 1 radian in degrees\nloop = 0.05 #\ntuning = 0....
[ 0 ]
#!/usr/bin/env python # Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import subprocess import sys import os def main(): parser = argparse.ArgumentParser( description='Create the s...
normal
{ "blob_id": "d5c6582547df540ffc9c73d10a3405ec97487bba", "index": 4513, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n parser = argparse.ArgumentParser(description=\n 'Create the symbol specifying the location of test fixtures.')\n parser.add_argument('--fixtures_location_fi...
[ 0, 1, 2, 3, 4 ]
from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import Context from books.models import book,Author def index(request): book_list=book.objects.all() c=Context({"book_list":book_list}) return render_to_response("index.html",c)
normal
{ "blob_id": "441d224c37e0eae531c17db0e903b3344c570516", "index": 9867, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n book_list = book.objects.all()\n c = Context({'book_list': book_list})\n return render_to_response('index.html', c)\n", "step-3": "from django.http im...
[ 0, 1, 2, 3 ]
# pylint: disable=W0621,C0114,C0116,W0212,W0613 import io import textwrap from typing import cast, Any, Dict import toml import pytest from dae.testing import convert_to_tab_separated from dae.configuration.gpf_config_parser import GPFConfigParser from dae.configuration.schemas.person_sets import person_set_collectio...
normal
{ "blob_id": "6c8f690e1b43d459535238e24cccc8aa118e2d57", "index": 3038, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef families_fixture():\n ped_content = io.StringIO(convert_to_tab_separated(\n \"\"\"\n familyId personId dadId\t momId\tsex status role\n f1 mom1 0 ...
[ 7, 8, 10, 11, 13 ]
from sqlalchemy import (Column, Integer, Float, String, ForeignKey) from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import relationship from .meta import Base, BaseModel class Stock(Base, BaseModel): __tablename__ = 'stock' name = Column(String(255), nullable=False) starting_price = ...
normal
{ "blob_id": "7251d32918b16166e9b7c9613726e6dc51d6fea4", "index": 3834, "step-1": "<mask token>\n\n\nclass StockType(Base, BaseModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __json__(self, _):\n return {'id': self.id, 'name': self.name}\n", "s...
[ 2, 3, 5, 6, 8 ]
#!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = 'ghou' from datetime import datetime bGameValid = True dAskUserInfo = {} gAccMode = 0 #============UserSyncResource2.py=================== #============前端资源热更白名单测试功能================ #============去读配置表config.xml================== #============大于配置标号的热更内容只有...
normal
{ "blob_id": "2e075c3ee6b245b1ffd0bb8c4e205199f794da76", "index": 5725, "step-1": "<mask token>\n", "step-2": "__author__ = 'ghou'\n<mask token>\nbGameValid = True\ndAskUserInfo = {}\ngAccMode = 0\ngWhiteTestResourceVersion = None\ngInvalidClientVersion = None\n", "step-3": "__author__ = 'ghou'\nfrom datetime...
[ 0, 1, 2, 3 ]
from pyplasm import * import random as r def gen_windows(plan_grid, n, m, window_model): return STRUCT([ T([1,2])([j,i])( gen_cube_windows(plan_grid, window_model)(i, j, n, m)) for i in range(n) for j in range(m) if plan_grid[i][j]]) def gen_cube_windows(plan_grid, wi...
normal
{ "blob_id": "cb48a1601798f72f9cf3759d3c13969bc824a0f6", "index": 707, "step-1": "<mask token>\n\n\ndef gen_windows(plan_grid, n, m, window_model):\n return STRUCT([T([1, 2])([j, i])(gen_cube_windows(plan_grid,\n window_model)(i, j, n, m)) for i in range(n) for j in range(m) if\n plan_grid[i][j]]...
[ 5, 7, 8, 9, 11 ]
data_dir = "../data" output_dir = './' valid_id = dict() for category in ("beauty", "fashion", "mobile"): with open("%s/%s_data_info_val_competition.csv" % (data_dir, category), "r") as infile: next(infile) for line in infile: curr_id = line.strip().split(',')[0] valid_id[cu...
normal
{ "blob_id": "82556291c456b9e43e4e589ea4a77d320430344b", "index": 7478, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor category in ('beauty', 'fashion', 'mobile'):\n with open('%s/%s_data_info_val_competition.csv' % (data_dir, category), 'r'\n ) as infile:\n next(infile)\n for ...
[ 0, 1, 2, 3 ]
import sys from bs4 import BeautifulSoup def get_classes(html): """ returns a list of classes and titles, parsing through 'html' """ # elements = html.find_all("span", "code") # titles = html.find_all("span", "title") # classes = [] # for i in range(len(elements)): # item = element...
normal
{ "blob_id": "9bb8e0f732eac474dbc01c374f9c74178f65dc36", "index": 3063, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_classes(html):\n \"\"\"\n returns a list of classes and titles, parsing through 'html'\n \"\"\"\n", "step-3": "import sys\nfrom bs4 import BeautifulSoup\n\n\ndef ge...
[ 0, 1, 2, 3 ]
def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico): lixos = [garrafa_vidro, lata_metal, copo_plastico, bola_papel, maça_organico] return lixos[n]
normal
{ "blob_id": "71a9c9b8f47dcfbecc154c44d5a72ddbd852145a", "index": 328, "step-1": "<mask token>\n", "step-2": "def randomizer(n, garrafa_vidro, lata_metal, copo_plastico, bola_papel,\n maça_organico):\n lixos = [garrafa_vidro, lata_metal, copo_plastico, bola_papel,\n maça_organico]\n return lixos...
[ 0, 1 ]
from arcade.sprite_list.sprite_list import SpriteList import GamePiece as gp from Errors import * class GameConfig: WINDOW_TITLE = "MyPyTris" SCREEN_WIDTH = 450 SCREEN_HEIGHT = 900 BLOCK_PX = 45 # 45px blocks on screen SPRITE_PX = 64 # 64px sprite BLOCK_SCALE = BLOCK_PX/SPRITE_PX # sprite scal...
normal
{ "blob_id": "2d7431996bc8d1099c08fddc815b4706deb4f023", "index": 4393, "step-1": "<mask token>\n\n\nclass GameBoard:\n <mask token>\n <mask token>\n\n def draw(self):\n self.playerSprites.draw()\n self.groundSprites.draw()\n <mask token>\n <mask token>\n\n def moveGamePiece(self, ...
[ 7, 12, 13, 17, 18 ]
import numpy as np import tensorflow as tf import math from .. import util def debug_inference(inference, dummy, entropy, cross_entropy, expected_log_likelhood): dummy = tf.Print(dummy, [entropy], 'entropy: ') dummy = tf.Print(dummy, [cross_entropy], 'cross_entropy: ') dummy = tf.Print(dummy, [expected_log...
normal
{ "blob_id": "4758d6efde21e3b5d91f107188f24b6ddf7cbbe4", "index": 7935, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef debug_inference(inference, dummy, entropy, cross_entropy,\n expected_log_likelhood):\n dummy = tf.Print(dummy, [entropy], 'entropy: ')\n dummy = tf.Print(dummy, [cross_en...
[ 0, 1, 2, 3, 4 ]
######################################################### # Author: Todd A. Reisel # Date: 2/24/2003 # Class: StaticTemplateList ######################################################### from BaseClasses.TemplateList import *; class StaticTemplateList(TemplateList): def __init__(self, viewMode = None): Te...
normal
{ "blob_id": "7de3c0ab2e7c8ac00d37f1dfb5948027cfa7806c", "index": 5084, "step-1": "<mask token>\n\n\nclass StaticTemplateList(TemplateList):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass StaticTemplateList(TemplateList):\n\n def __init__(self, viewMode=None):\n ...
[ 1, 3, 4, 5, 6 ]
# 데이터 출처: kaggle # 데이터 개요: 511, 유리를 위한 다양한 속성(화학원소)들로부터 type 구별 # 데이터 예측 모델: 이진클래스 # 적용 머신러닝 모델: 깊은 다층 퍼셉트론 신경망 # 훈련 데이터셋: 160건 # 검증 데이터셋: 건 # 시험 데이터셋: 수집데이터로서 시험셋을 확보할 수 없으므로 고려하지 않음 # 입력 데이터: 10개 항목의 데이터 # 은닉층: 2개 # 사용한 활성화 함수 # - 제1 은닉층: Relu # - 제2 은닉층: Relu # - Output Layer: Softmax # 사용한 손실함수: categorical_cros...
normal
{ "blob_id": "bfa5739949c26758e3762fcff8347d23ad70f704", "index": 6114, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(5)\n<mask token>\nmodel.add(Dense(64, input_dim=input_data_number, activation='relu'))\nmodel.add(Dense(64, activation='relu'))\nmodel.add(Dense(7, activation='softmax'))\n...
[ 0, 1, 2, 3, 4 ]
plik=open("nowy_zad_84.txt", "w") print(" Podaj 5 imion") for i in range(1,6): imie=input(f" Podaj imie nr {i} ") # plik.write(imie) # plik.write("\n") plik.write(f" {imie} \n") plik.close() plik=open("nowy_zad_84.txt", "a") for i in range(1,101): plik.write(str(i)) plik.w...
normal
{ "blob_id": "0ac99e2b33f676a99674c9a8e5d9d47c5bce084b", "index": 5820, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' Podaj 5 imion')\nfor i in range(1, 6):\n imie = input(f' Podaj imie nr {i} ')\n plik.write(f' {imie} \\n')\nplik.close()\n<mask token>\nfor i in range(1, 101):\n plik.wri...
[ 0, 1, 2, 3 ]
import os import hashlib import argparse def hashfile(path, blocksize=65536): afile = open(path, 'rb') hasher = hashlib.md5() buf = afile.read(blocksize) while len(buf) > 0: hasher.update(buf) buf = afile.read(blocksize) afile.close() return hasher.hexdigest() def make_duplic...
normal
{ "blob_id": "e99c158e54fd86b00e4e045e7fb28d961089800d", "index": 3289, "step-1": "<mask token>\n\n\ndef hashfile(path, blocksize=65536):\n afile = open(path, 'rb')\n hasher = hashlib.md5()\n buf = afile.read(blocksize)\n while len(buf) > 0:\n hasher.update(buf)\n buf = afile.read(blocks...
[ 1, 2, 3, 4, 5 ]
''' 文件读写的步骤 1.打开文件 2.处理数据 3.关闭文件 1.open函数: fileobj = open(filename, mode) fileobj是open()函数返回的文件对象 mode第一个字母指明文件类型和操作的字符串,第二个字母是文件类型: t(可省略)文本类型,b二进制类型。 文件打开模式:r只读(默认),w覆盖写(不存在则新创建) a追加模式(不存在则创建) 2.read(size):从文件读取长度为size的字符串,若未给定或为负则读取所有内容 3.readline():读取整行返回字符串 4.readline...
normal
{ "blob_id": "25f3c9f48b779d2aec260d529529156ff3c508ca", "index": 7719, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in fileobj3.readlines():\n print(line)\nfileobj3.close()\n", "step-3": "<mask token>\nfileobj3 = open('lines.txt', 'r')\nfor line in fileobj3.readlines():\n print(line)\n...
[ 0, 1, 2, 3 ]
from scrapy import cmdline cmdline.execute("scrapy crawl rapo.com".split())
normal
{ "blob_id": "326f1b5bee8f488382a76fcc5559f4ea13734f21", "index": 6551, "step-1": "<mask token>\n", "step-2": "<mask token>\ncmdline.execute('scrapy crawl rapo.com'.split())\n", "step-3": "from scrapy import cmdline\ncmdline.execute('scrapy crawl rapo.com'.split())\n", "step-4": "from scrapy import cmdline\...
[ 0, 1, 2, 3 ]
from django.conf import settings from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden from django.views.decorators.csrf import csrf_exempt from linebot import LineBotApi, WebhookParser from linebot.exceptions import InvalidSignatureError, LineBotApiError from linebot.models import ...
normal
{ "blob_id": "19f202c32e1cf9f7ab2663827f1f98080f70b83e", "index": 8313, "step-1": "<mask token>\n\n\n@csrf_exempt\ndef callback(request):\n if request.method == 'POST':\n signature = request.META['HTTP_X_LINE_SIGNATURE']\n body = request.body.decode('utf-8')\n try:\n events = pa...
[ 1, 2, 3, 4, 5 ]
# -*- encoding:ascii -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 6 _modified_time = 1383550959.0389481 _template_filename='templates/webapps/tool_shed/repository/browse_repository.mako' _template_uri='/webapps/tool_shed/r...
normal
{ "blob_id": "fd54bbfbc81aec371ad6c82bf402a5a3673a9f24", "index": 8892, "step-1": "<mask token>\n\n\ndef _mako_generate_namespaces(context):\n ns = runtime.TemplateNamespace('__anon_0x88e2e50', context.\n _clean_inheritance_tokens(), templateuri=u'/message.mako',\n callables=None, calling_uri=_te...
[ 3, 5, 7, 9, 10 ]
#-*- coding: utf-8 -*- from django.db import models from authentication.models import Account class QuestionFaq(models.Model): title = models.CharField(max_length=50, verbose_name=u'Тема вопроса') question = models.TextField(verbose_name=u'Задайте вопрос') date = models.DateField(auto_now_add=True) ch...
normal
{ "blob_id": "b00c9f099fcb31262df947f47d7190912ee66965", "index": 6159, "step-1": "<mask token>\n\n\nclass AnswerFaq(models.Model):\n account = models.ForeignKey(Account)\n answer = models.TextField(verbose_name=u'Ответ на вопрос в FAQ')\n question = models.ForeignKey(QuestionFaq)\n date = models.Date...
[ 3, 4, 6, 7, 8 ]
# coding=utf-8 # http://rate.tmall.com/list_detail_rate.htm?itemId=41464129793&sellerId=1652490016&currentPage=1 import requests, re from Tkinter import * import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import random import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['SimHei'] ...
normal
{ "blob_id": "123d3906ce040a4daa5309eae555bad5509f805e", "index": 671, "step-1": "# coding=utf-8\n# http://rate.tmall.com/list_detail_rate.htm?itemId=41464129793&sellerId=1652490016&currentPage=1\nimport requests, re\nfrom Tkinter import *\nimport numpy as np\nimport matplotlib as mpl\nimport matplotlib.pyplot as...
[ 0 ]
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _ut...
normal
{ "blob_id": "2332783c96b24caa383bf47d82384e1c40a48e94", "index": 8566, "step-1": "<mask token>\n\n\n@pulumi.input_type\nclass DashboardArgs:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask...
[ 14, 21, 22, 23, 28 ]
def tobin(n): bin = ""; while(n/2!=0): if n%2==0: bin = bin + "0" else: bin = bin + "1" if n%2==1: bin = bin + "1" return bin n = int(input()) bin = tobin(5) print(bin)
normal
{ "blob_id": "1c5ca920fe1f116a5bc52c9e5c53c13b1e1c925f", "index": 2412, "step-1": "<mask token>\n", "step-2": "def tobin(n):\n bin = ''\n while n / 2 != 0:\n if n % 2 == 0:\n bin = bin + '0'\n else:\n bin = bin + '1'\n if n % 2 == 1:\n bin = bin + '1'\n ret...
[ 0, 1, 2, 3, 4 ]
# cook your dish here t=int(input()) while t: n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) s=0 for i in range(n): k=a[i]-i if k>=0: s+=k print(s%1000000007) t-=1
normal
{ "blob_id": "44bf409d627a6029ab4c4f1fff99f102b8d57279", "index": 3954, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile t:\n n = int(input())\n a = list(map(int, input().split()))\n a.sort(reverse=True)\n s = 0\n for i in range(n):\n k = a[i] - i\n if k >= 0:\n ...
[ 0, 1, 2, 3 ]
import mysql.connector from mysql.connector import errorcode DB_NAME = 'PieDB' TABLES = {} # TABLES['pietweets'] = ( # "CREATE TABLE `pietweets` (" # " `id` int NOT NULL AUTO_INCREMENT," # " `tweet_id` bigint NOT NULL," # " `username` varchar(32) NOT NULL," # " `geo_lat` float(53) NOT NULL," # " `geo_lon...
normal
{ "blob_id": "38abc4bc99f3b15b416c77481818464a6c7f11ef", "index": 3844, "step-1": "<mask token>\n\n\ndef create_database(cursor):\n try:\n cursor.execute(\"CREATE DATABASE {} DEFAULT CHARACTER SET 'utf8'\".\n format(DB_NAME))\n except mysql.connector.Error as err:\n print('Failed cr...
[ 1, 2, 3, 4, 5 ]
import tkinter as tk import random root = tk.Tk() main_frame = tk.Frame(root) var = tk.StringVar() ch = [ "hello world" , "HI Pyton", "Mar Java", "Mit Java", "Lut Java" ] var.set("Hello world I am a Label") label = tk.Label(main_frame,textvariable=var, bg="black",fg="white",font=("Times New Roman",24,"bold")) ...
normal
{ "blob_id": "33938a28aad29e996255827825a0cdb1db6b70b7", "index": 5842, "step-1": "<mask token>\n\n\ndef change_label():\n var.set(random.choice(ch))\n\n\n<mask token>\n\n\ndef slove():\n expr.set(eval(expr.get()))\n\n\n<mask token>\n\n\ndef clear():\n expr.set('')\n\n\n<mask token>\n", "step-2": "<mas...
[ 3, 4, 5, 6, 7 ]
################################################################################ # # # This file is part of the Potato Engine (PE). # # ...
normal
{ "blob_id": "595912753d778a0fa8332f0df00e06a9da5cde93", "index": 447, "step-1": "<mask token>\n", "step-2": "<mask token>\nSetOption('num_jobs', 4)\nSetOption('implicit_cache', 1)\n<mask token>\nbuildVariables.Add(PathVariable('QTDIR', 'Qt4 root directory',\n '/usr/share/qt4', PathVariable.PathIsDir))\nbuil...
[ 0, 1, 2, 3, 4 ]
import pygame as pg screen = pg.display.set_mode((640, 380))
normal
{ "blob_id": "c1374a048187807deac5d28dda4fbc7beeccf8f5", "index": 5221, "step-1": "<mask token>\n", "step-2": "<mask token>\nscreen = pg.display.set_mode((640, 380))\n", "step-3": "import pygame as pg\nscreen = pg.display.set_mode((640, 380))\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ =================================== Demo of DBSCAN clustering algorithm =================================== Finds core samples of high density and expands clusters from them. """ import scipy as sp import numpy as np from scipy import spatial print(__doc__) from sklearn.cluster import D...
normal
{ "blob_id": "d2e3ac490ce5fdc20976567fa320a9e6a53cbe34", "index": 1037, "step-1": "<mask token>\n\n\ndef getDistanceByHaversine(loc1, loc2):\n \"\"\"Haversine formula - give coordinates as a 2D numpy array of\n (lat_denter link description hereecimal,lon_decimal) pairs\"\"\"\n lat1 = loc1[1]\n lon1 = ...
[ 1, 2, 3, 4, 5 ]
import copy import datetime from sacred import Experiment from tqdm import tqdm from mms_msg.databases.classical.full_overlap import WSJ2Mix import paderbox as pb import padertorch as pt ex = Experiment('mixture_generator_create_json') @ex.config def defaults(): json_path = 'database.json' database = { ...
normal
{ "blob_id": "f39130099ccf467623d65ac328fd02538044d36a", "index": 6476, "step-1": "<mask token>\n\n\n@ex.automain\ndef main(json_path, database, _log):\n database_config = database\n database = pt.configurable.config_to_instance(database)\n database_dict = {'datasets': {dataset_name: dict(tqdm(database.\...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- import random import gym import numpy as np from collections import deque from keras.models import Sequential from keras.layers import Dense from keras.optimizers import Adam from simulation_utils import box, simulation from kinematics import pose3D a = np.log(2)/25 apdataX = np.random.random(...
normal
{ "blob_id": "7e7e96fb9377e4dc59a46a46951f5057ecae419a", "index": 201, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(np.linalg.norm(mat))\n", "step-3": "<mask token>\na = np.log(2) / 25\napdataX = np.random.random((5, 35))\nquarter_way_arr = [False, False, False]\nquarter_way_arr[0] = True\nquart...
[ 0, 1, 2, 3, 4 ]
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from database_setup import Base, Country, TouristPlaces, Users # Create database and create a shortcut for easier to update database engine = create_engine('sqlite:///country_catalog.db') Base.metadata.bind = engine DBSession = sessionmaker(b...
normal
{ "blob_id": "21b9844fce10d16a14050a782ce7e15e3f6fb657", "index": 5737, "step-1": "<mask token>\n", "step-2": "<mask token>\nsession.add(user_1)\nsession.commit()\n<mask token>\nsession.add(country_1)\nsession.commit()\n<mask token>\nsession.add(country_2)\nsession.commit()\n<mask token>\nsession.add(country_3)...
[ 0, 1, 2, 3, 4 ]
from flask import Flask, request, render_template from utils import get_result app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route("/result", methods=["POST"]) def result(): form_data = request.form sentence = form_data['sentence'] output = get_result...
normal
{ "blob_id": "264da5a2ab7d5c311d8a59b06c81ea2156cefd76", "index": 9627, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\n\n@app.route('/result', methods=['POST'])\ndef result():\n form_data = request.form\n sentence = form_data['sentence']\n output =...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- ''' * EAFS * Copyright (C) 2009-2011 Adam Etienne <eadam@lunasys.fr> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 3. * * This program is distributed i...
normal
{ "blob_id": "2f5244c6144f5aafce29e5aba32bd7e3fc7ecf5b", "index": 3632, "step-1": "# -*- coding: utf-8 -*-\n'''\n * EAFS\n * Copyright (C) 2009-2011 Adam Etienne <eadam@lunasys.fr>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License...
[ 0 ]
import numpy as np import matplotlib.pyplot as plt from scipy import stats def fit(x, iters=1000, eps=1e-6): """ Fits a 2-parameter Weibull distribution to the given data using maximum-likelihood estimation. :param x: 1d-ndarray of samples from an (unknown) distribution. Each value must satisfy x ...
normal
{ "blob_id": "b10d3d8d0ded0d2055c1abdaf40a97abd4cb2cb8", "index": 1631, "step-1": "<mask token>\n\n\ndef fit(x, iters=1000, eps=1e-06):\n \"\"\"\n Fits a 2-parameter Weibull distribution to the given data using maximum-likelihood estimation.\n :param x: 1d-ndarray of samples from an (unknown) distributio...
[ 1, 2, 3, 4, 5 ]
import json import os import numpy as np import pandas as pd import py4design.py2radiance as py2radiance import py4design.py3dmodel.calculate as calculate from py4design import py3dmodel __author__ = "Jimeno A. Fonseca" __copyright__ = "Copyright 2017, Architecture and Building Systems - ETH Zurich" __credits__ = ["J...
normal
{ "blob_id": "164b0afde225119a8fbd4ccfccbbbc3550aa75fe", "index": 2634, "step-1": "<mask token>\n\n\ndef create_sensor_input_file(rad, chunk_n):\n sensor_file_path = os.path.join(rad.data_folder_path, 'points_' + str(\n chunk_n) + '.pts')\n sensor_file = open(sensor_file_path, 'w')\n sensor_pts_da...
[ 6, 7, 9, 10, 11 ]
# # @lc app=leetcode.cn id=15 lang=python3 # # [15] 三数之和 # # https://leetcode-cn.com/problems/3sum/description/ # # algorithms # Medium (25.76%) # Likes: 1904 # Dislikes: 0 # Total Accepted: 176.6K # Total Submissions: 679K # Testcase Example: '[-1,0,1,2,-1,-4]' # # 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,...
normal
{ "blob_id": "ccf3ada9a2bedf29820170f2e8184fc16f1b7aea", "index": 9580, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def threeSum(self, nums: List[int]) ->List[List[int]]:\n res = []\n nums.sort()\n for k in range(len(nums)...
[ 0, 1, 2, 3 ]
import pyaudio import numpy as np from collections import OrderedDict import utils class MasterPlayer(object): def __init__(self, volume=1., samplesPerSecond=44100): self.p = pyaudio.PyAudio() self.volume = volume self.samplesPerSecond = samplesPerSecond self.individual_callbacks =...
normal
{ "blob_id": "c4e4e54ac93c2acdbd3a1cd22b200341a6e45688", "index": 224, "step-1": "import pyaudio\nimport numpy as np\nfrom collections import OrderedDict\nimport utils\n\n\nclass MasterPlayer(object):\n def __init__(self, volume=1., samplesPerSecond=44100):\n self.p = pyaudio.PyAudio()\n self.vol...
[ 0 ]
# -*- coding: utf-8 -*- """ Created on Tue Mar 12 20:29:49 2019 @author: kzx789 """ from PIL import Image import os, glob, numpy as np import pandas as pd import matplotlib.pyplot as plt import math import cv2 import pymysql import MySQLdb as mysql """ #csv를 읽어서 영양정보 출력 def get_Nutrition(str) : nutrition = pd.r...
normal
{ "blob_id": "1255a9df2fbe11d92991f3f0f7054b92cb017628", "index": 2941, "step-1": "<mask token>\n\n\ndef drawing_plt():\n thisImg = os.listdir(caltech_dir)\n row = 4\n cols = int(math.ceil(len(thisImg) / 4))\n fig = plt.figure()\n i = 1\n for image in glob.glob('C:/cnnTest/*.jpg'):\n img ...
[ 3, 4, 5, 6, 7 ]
from app import create_app from app.config import Config app = create_app(Config) if __name__ == "__main__": app.run(host="0.0.0.0", port=5000, debug=True)
normal
{ "blob_id": "bea90bbcd4d34b64c21f022b6f3af2bee2d978e4", "index": 1123, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n app.run(host='0.0.0.0', port=5000, debug=True)\n", "step-3": "<mask token>\napp = create_app(Config)\nif __name__ == '__main__':\n app.run(host='0.0.0...
[ 0, 1, 2, 3, 4 ]
from more_itertools import ilen from my.body import weight, shower, food, water def test_body() ->None: for func in (weight, shower, food, water): assert ilen(func()) >= 1
normal
{ "blob_id": "e06b740f27e41b9f120c962fd76a38a29d54af3c", "index": 973, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_body() ->None:\n for func in (weight, shower, food, water):\n assert ilen(func()) >= 1\n", "step-3": "from more_itertools import ilen\nfrom my.body import weight, ...
[ 0, 1, 2 ]
import numpy as np import random with open("./roc.txt", "r") as fin: with open("./roc_shuffle.txt", "w") as fout: tmp = [] for k, line in enumerate(fin): i = k + 1 if i % 6 == 0: idx = [0] + np.random.permutation(range(1,5)).tolist() for sen i...
normal
{ "blob_id": "2aec0581413d4fb0ffb4090231fde0fed974bf18", "index": 27, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('./roc.txt', 'r') as fin:\n with open('./roc_shuffle.txt', 'w') as fout:\n tmp = []\n for k, line in enumerate(fin):\n i = k + 1\n if i % 6 ...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 import asyncio import bs4 import itertools import logging import sys import os import zipfile from asyncio import TimeoutError from aiohttp import ClientSession, ClientConnectionError from aiohttp.client_exceptions import ContentTypeError, ServerDisconnectedError from bs4 import BeautifulSoup ...
normal
{ "blob_id": "002f65fd77ce5043d1a0495ed13c15e3b4d2fb76", "index": 7244, "step-1": "<mask token>\n\n\ndef _split_journal_attrs(attrs):\n if attrs:\n return [t.text.replace(':', '').strip().split('\\n') for t in [k for\n k in attrs if isinstance(k, bs4.element.Tag)]]\n return []\n\n\ndef _ge...
[ 6, 8, 9, 10, 11 ]
from rest_framework import permissions class AdminUrlUserPermission(permissions.BasePermission): def has_permission(self, request, view): return (request.user.is_authenticated and (request.user.role == 'admin' or request.user.is_superuser)) def has_object_permissi...
normal
{ "blob_id": "4549f26cf8051535f9d3486d111fc7afe7514dea", "index": 5674, "step-1": "<mask token>\n\n\nclass AdminUrlUserPermission(permissions.BasePermission):\n <mask token>\n <mask token>\n\n\nclass ReadOnly(permissions.BasePermission):\n\n def has_permission(self, request, view):\n return reques...
[ 6, 7, 8, 9, 10 ]
import pandas as pd import matplotlib.pyplot as plt from netCDF4 import Dataset from cftime import num2date import os import numpy as np from datetime import datetime, timedelta, date def plot_temperatures_by_country(values, country, start, end): """ Returns a plot for temperature values for a coun...
normal
{ "blob_id": "2b579c3def4c2d02d365f019518e8e0b25664460", "index": 7436, "step-1": "<mask token>\n\n\ndef plot_temperatures_by_country(values, country, start, end):\n \"\"\"\n Returns a plot for temperature values for a country\n from a start point to an end point\n \"\"\"\n filtered = values.loc[(v...
[ 7, 8, 9, 10, 11 ]
from datapackage_pipelines.wrapper import ingest, spew params, datapackage, res_iter = ingest() columns = params['columns'] for resource in datapackage['resources']: fields = resource.get('schema', {}).get('fields') if fields is not None: fields = [field for field in fields if field['name'] not in colum...
normal
{ "blob_id": "17b3fb44d9e7a09fe3b807b47bdc0248b6960634", "index": 4022, "step-1": "<mask token>\n\n\ndef process_resources(_res_iter):\n for rows in _res_iter:\n\n def process_rows(_rows):\n for row in _rows:\n for column in columns:\n if column in row:\n ...
[ 1, 2, 3, 4 ]
from import_.Import import Import from classifier.Classifier import Classifier from export.Export import Export from preprocessing.PreProcess import PreProcess def main(): date_column = "date of last vet visit" target = "age at death" export_file_dir = "./output/" export_model_dir = "./model/xgb_mode...
normal
{ "blob_id": "696b9db78cc7f6002eb39b640e0e5b2b53e52e91", "index": 8448, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n date_column = 'date of last vet visit'\n target = 'age at death'\n export_file_dir = './output/'\n export_model_dir = './model/xgb_model.dat'\n import_ = ...
[ 0, 1, 2, 3, 4 ]
/home/runner/.cache/pip/pool/9b/88/a0/f20a7b2f367cd365add3353eba0cf34569d5f62a33587f96cebe6d4360
normal
{ "blob_id": "12f05f42c9ed56d6a2c95fb56a8619fae47a2f1a", "index": 6035, "step-1": "/home/runner/.cache/pip/pool/9b/88/a0/f20a7b2f367cd365add3353eba0cf34569d5f62a33587f96cebe6d4360", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
'''Turning on or off, toggling and checking the status' of a specific relay''' #!/bin/env python3 from time import sleep from gpiozero import LED RELAYS = [ LED(23), LED(24), LED(25), LED(8), LED(7), LED(1), LED(12), LED(16) ] def on_action(relay_option, number): '''To turn on t...
normal
{ "blob_id": "d82412055affc96d634957c953a35ea69b7e702f", "index": 403, "step-1": "<mask token>\n\n\ndef on_action(relay_option, number):\n \"\"\"To turn on the chosen relay\"\"\"\n relay_option.on()\n print(f'relay {number} is turning on')\n\n\n<mask token>\n\n\ndef toggle_action(relay_option, number):\n...
[ 6, 7, 9, 10, 11 ]
''' check if word appear in file ''' # easier solution : def findKeyInFile(word, filepath): with open(filepath) as f: for line in f.readlines(): if line.count(word) > 0: return line return None
normal
{ "blob_id": "97fb2388777bcb459b9818495121fdf8318095ca", "index": 8881, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef findKeyInFile(word, filepath):\n with open(filepath) as f:\n for line in f.readlines():\n if line.count(word) > 0:\n return line\n return No...
[ 0, 1, 2 ]
from django.contrib import admin from django.urls import path from django.conf.urls import url from . import views urlpatterns = [ path('admin/', admin.site.urls), path(r'', views.index, name='index'), ]
normal
{ "blob_id": "b0fad3847519bb18365a8cd4226d06e9d96a8308", "index": 1258, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('admin/', admin.site.urls), path('', views.index, name=\n 'index')]\n", "step-3": "from django.contrib import admin\nfrom django.urls import path\nfrom django.con...
[ 0, 1, 2, 3 ]
# Generated by Django 3.0.8 on 2021-03-25 13:47 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('Asha', '0005_baby'), ] operations = [ migrations.AlterField( model_name='baby', ...
normal
{ "blob_id": "e14b8d0f85042ceda955022bee08b3b3b4c2361d", "index": 7367, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('Asha', '000...
[ 0, 1, 2, 3, 4 ]
___author__ = 'acmASCIS' ''' by ahani at {9/24/2016} ''' import time class Freq(object): def __init__(self, array): self.__array = array self.__frequency_dict = {} self.__array_length = len(array) self.__running_time = round(time.time() * 1000) def get_original_array(sel...
normal
{ "blob_id": "b569f0a0dda048d6337e1028a240caabf188a174", "index": 9420, "step-1": "<mask token>\n\n\nclass Freq(object):\n\n def __init__(self, array):\n self.__array = array\n self.__frequency_dict = {}\n self.__array_length = len(array)\n self.__running_time = round(time.time() * ...
[ 3, 5, 6, 7, 10 ]
#import fungsi_saya as fs # from fungsi_saya import kalkulator as k # hasil = k(10,5,'+') # print(hasil) from kelas import Siswa siswa_1 = Siswa('Afif', "A.I.", 17, 'XII IPA') siswa_2 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS') siswa_3 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS') siswa_4 = Siswa('Bayu', 'Sudrajat', 20,...
normal
{ "blob_id": "bd2c327915c1e133a6e7b7a46290369440d50347", "index": 3876, "step-1": "<mask token>\n", "step-2": "<mask token>\nsiswa_1 = Siswa('Afif', 'A.I.', 17, 'XII IPA')\nsiswa_2 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS')\nsiswa_3 = Siswa('Bayu', 'Sudrajat', 20, 'XII IPS')\nsiswa_4 = Siswa('Bayu', 'Sudrajat',...
[ 0, 1, 2, 3 ]
import pytest from homeworks.homework6.oop_2 import ( DeadLineError, Homework, HomeworkResult, Student, Teacher, ) def test_creating_objects(): teacher = Teacher("Daniil", "Shadrin") student = Student("Roman", "Petrov") homework = teacher.create_homework("Learn OOP", 1) homework_r...
normal
{ "blob_id": "8f971ee3b98691a887ee0632afd613bbf4f19aa0", "index": 3505, "step-1": "<mask token>\n\n\ndef test_creating_objects():\n teacher = Teacher('Daniil', 'Shadrin')\n student = Student('Roman', 'Petrov')\n homework = teacher.create_homework('Learn OOP', 1)\n homework_result = student.do_homework...
[ 1, 2, 3, 4, 5 ]
import pandas as pd import numpy as np #import data df = pd.read_csv('../.gitignore/PPP_data_to_150k.csv') counties = pd.read_csv('../data/zip_code_database.csv') demographics = pd.read_csv('../data/counties.csv') #filter out all unanswered ethnicities df2 = df[~df.RaceEthnicity.str.contains("Unanswered")] #drop non...
normal
{ "blob_id": "732478fd826e09cf304760dfcc30cd077f74d83e", "index": 2250, "step-1": "import pandas as pd\nimport numpy as np\n\n#import data\ndf = pd.read_csv('../.gitignore/PPP_data_to_150k.csv')\ncounties = pd.read_csv('../data/zip_code_database.csv')\ndemographics = pd.read_csv('../data/counties.csv')\n\n#filter...
[ 0 ]
from typing import List from re import match from utility import ButtonGroup import rumps class RepeatWorkBreak(rumps.App): def __init__(self): rumps.debug_mode(True) self.config = { "app_title": "Repeat Work and Break", "start": "Start", "pause": "Pause Timer"...
normal
{ "blob_id": "2ca91c410b8c8d6306d5ed918783a4d77a091ba8", "index": 360, "step-1": "<mask token>\n\n\nclass RepeatWorkBreak(rumps.App):\n <mask token>\n\n def set_up_menu(self):\n self.timer.stop()\n self.timer.count = 0\n self.app.title = self.config['app_title']\n\n def convert_secon...
[ 7, 10, 11, 12, 14 ]
from yapsy.IPlugin import IPlugin import wolframalpha import yaml keys_file = open("friday/plugins/KEYS") keys = yaml.load(keys_file) keys_file.close() class Wolfram(IPlugin): def can_perform(self, friday, request): return 'result' in request and 'resolvedQuery' in request['result']\ and ...
normal
{ "blob_id": "57564c2e94a65187bf5e033ee06926fb593e11a7", "index": 7733, "step-1": "<mask token>\n\n\nclass Wolfram(IPlugin):\n\n def can_perform(self, friday, request):\n return 'result' in request and 'resolvedQuery' in request['result'\n ] and 'action' in request['result'] and request['resu...
[ 3, 4, 5, 6, 7 ]
import database import nltk def pop(i): # pupulate the words table loc = i sentencesTrial = [] File = open('words.txt') lines = File.read() sentences = nltk.sent_tokenize(lines) locations = ["Castle","Beach","Beach","Ghost Town","Ghost Town","Haunted House","Jungle","Carnival", "Ghost Town", "Hi...
normal
{ "blob_id": "e7ac5c1010330aec81ce505fd7f52ccdeddb76de", "index": 8923, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef pop(i):\n loc = i\n sentencesTrial = []\n File = open('words.txt')\n lines = File.read()\n sentences = nltk.sent_tokenize(lines)\n locations = ['Castle', 'Beach'...
[ 0, 1, 2, 3, 4 ]
print "test" print "moreing" print " a nnnnn"
normal
{ "blob_id": "551e9c696eaad6c78f2eae66e50cca34c153d9dd", "index": 4636, "step-1": "print \"test\"\n\nprint \"moreing\"\n\nprint \" a nnnnn\"", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
import math r = float(input()) p = int(input()) obim = 2 * r * math.pi ukupanPut = p * obim # centimetre pretvaramo u metre ukupanPut = ukupanPut * 0.01 print("%.2f" % ukupanPut)
normal
{ "blob_id": "1f27b697985c7417e6d8d978703175a415c6c57d", "index": 327, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('%.2f' % ukupanPut)\n", "step-3": "<mask token>\nr = float(input())\np = int(input())\nobim = 2 * r * math.pi\nukupanPut = p * obim\nukupanPut = ukupanPut * 0.01\nprint('%.2f' % uk...
[ 0, 1, 2, 3, 4 ]
import sys def saludar(saludo): print saludo def iniciales(nombre,ape1,ape2): iniciales=nombre[0]+'.'+ape1[0]+'.'+ape2[0]+'.' return "Tus iniciales son:"+iniciales.upper() def iniciales1(nombre,ape1,*apellidos): iniciales=nombre[0]+'.'+ape1[0] for ape in apellidos: iniciales=iniciales+'.'+ape[0] return in...
normal
{ "blob_id": "01b615f8282d4d42c5e83181fffc2d7cb612c096", "index": 704, "step-1": "import sys \n\n\ndef saludar(saludo):\n\tprint saludo\n\ndef iniciales(nombre,ape1,ape2):\n\tiniciales=nombre[0]+'.'+ape1[0]+'.'+ape2[0]+'.'\n\treturn \"Tus iniciales son:\"+iniciales.upper()\n\n\ndef iniciales1(nombre,ape1,*apellid...
[ 0 ]
# 5. Усовершенствовать программу «Банковский депозит». Третьим аргументом в функцию должна # передаваться фиксированная ежемесячная сумма пополнения вклада. Необходимо в главной # функции реализовать вложенную функцию подсчета процентов для пополняемой суммы. # Примем, что клиент вносит средства в последний день каж...
normal
{ "blob_id": "bf9e83591f737caec3060b72d86d56faec9bb23b", "index": 8079, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef chargeable_deposit(amount, months, charge=0):\n percent = get_percent(amount, months)\n if not percent:\n print('Нет подходящего тарифа')\n total = amount\n for...
[ 0, 1, 2, 3, 4 ]
import logging from bson import ObjectId from typing import Union from app.helper import parseControllerResponse from models.members import Member from schema.members import ( CreateMemberSchema, MemberInDBSchema, UpdateMemberSchema, memberHelper, ) def getAllMembersFromDB(**kwargs): """Finds an...
normal
{ "blob_id": "95f9e9a8f681679f56c3755199fba7d654af85e8", "index": 1937, "step-1": "<mask token>\n\n\ndef getAllMembersFromDB(**kwargs):\n \"\"\"Finds and returns all the registered members\"\"\"\n isResponseParsed = kwargs.get('isParsed', False)\n logging.info('Trying to find all the users')\n try:\n ...
[ 3, 4, 5, 6, 7 ]
import caffe import numpy as np class PyLayer(caffe.Layer): def setup(self, bottom, top): if len(bottom) != 2: raise Exception("Need two inputs to compute distance") def reshape(self, bottom, top): if bottom[0].count != bottom[1].count: raise Exception("Inputs must have the same dimension") ...
normal
{ "blob_id": "8040b47dc3fd6b03432f64d7fb8a4267cc94ac9a", "index": 2698, "step-1": "<mask token>\n\n\nclass PyLayer(caffe.Layer):\n\n def setup(self, bottom, top):\n if len(bottom) != 2:\n raise Exception('Need two inputs to compute distance')\n\n def reshape(self, bottom, top):\n if...
[ 3, 4, 5, 6, 7 ]
from __future__ import annotations import logging import os import sys from argparse import Namespace from pathlib import Path from uuid import uuid4 import pytest from virtualenv.discovery.builtin import Builtin, get_interpreter from virtualenv.discovery.py_info import PythonInfo from virtualenv.info import fs_supp...
normal
{ "blob_id": "55d4f4bba2b72ec93cb883527d2a9c2ebe8ec337", "index": 4910, "step-1": "<mask token>\n\n\ndef test_relative_path(session_app_data, monkeypatch):\n sys_executable = Path(PythonInfo.current_system(app_data=\n session_app_data).system_executable)\n cwd = sys_executable.parents[1]\n monkeyp...
[ 1, 4, 5, 6, 7 ]
# template for "Stopwatch: The Game" import math import simplegui # define global variables successcount = 0; totalstopcount = 0; count = 0; T = True; F = True; # define helper function format that converts time # in tenths of seconds into formatted string A:BC.D def format(t): A = str(t // 600); tem = (t /...
normal
{ "blob_id": "bb198978ffc799bb43acf870467496e1dcc54d4b", "index": 3710, "step-1": "<mask token>\n\n\ndef format(t):\n A = str(t // 600)\n tem = t // 10\n tem = tem % 60\n B = str(tem // 10)\n C = str(tem % 10)\n D = str(t % 10)\n return A + ':' + B + C + '.' + D\n\n\n<mask token>\n\n\ndef res...
[ 4, 5, 6, 7, 10 ]
from datetime import datetime as dt YEAR = dt.today().year BINARY_LOCATION = {'binary_location': 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe'} CHROME_DRIVER_PATH = r'C:\Users\pavithra\Downloads\chromedriver_win32\chromedriver.exe' EXTRACTED_DIR = r'C:\Users\pavithra\Documents\fintuple-automation-proje...
normal
{ "blob_id": "95422348c8db9753830cc0a7c8785c05b44886b1", "index": 842, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef enable_download(driver, directory):\n \"\"\"\n\n :param driver: Selenium web driver\n :param directory: Directory to store the file\n\n This function allows the Seleniu...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import RPi.GPIO as gpio # 导入Rpi.GPIO库函数命名为GPIO import time gpio.setmode(gpio.BOARD) #将GPIO编程方式设置为BOARD模式 pin = 40 gpio.setup(pin, gpio.OUT) #控制pin号引脚 gpio.output(pin, gpio.HIGH) #11号引脚输出高电平 time.sleep(5) #计时0.5秒 gpio.output(pin, gpio.LOW) #11号引脚输出低电平 time.sleep(1) #计时1秒 ...
normal
{ "blob_id": "cfdfc490396546b7af732417b506100357cd9a1f", "index": 6762, "step-1": "<mask token>\n", "step-2": "<mask token>\ngpio.setmode(gpio.BOARD)\n<mask token>\ngpio.setup(pin, gpio.OUT)\ngpio.output(pin, gpio.HIGH)\ntime.sleep(5)\ngpio.output(pin, gpio.LOW)\ntime.sleep(1)\ngpio.cleanup()\n", "step-3": "<...
[ 0, 1, 2, 3, 4 ]
from .core import S3FileSystem, S3File from .mapping import S3Map from ._version import get_versions __version__ = get_versions()['version'] del get_versions
normal
{ "blob_id": "32e60c672d6e73600d442c4344743deccaed6796", "index": 8819, "step-1": "<mask token>\n", "step-2": "<mask token>\ndel get_versions\n", "step-3": "<mask token>\n__version__ = get_versions()['version']\ndel get_versions\n", "step-4": "from .core import S3FileSystem, S3File\nfrom .mapping import S3M...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python # -*- coding:utf-8 -*- # # Author : cold # E-mail : wh_linux@126.com # Date : 13/09/05 11:16:58 # Desc : # import twqq from setuptools import setup requires = ["tornado", "pycurl", "tornadohttpclient"] packages = ["twqq"] entry_points = { } setup( name = "twqq", ...
normal
{ "blob_id": "9492142a569da1d21b1927e79d97f9cf6276efdc", "index": 2800, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='twqq', version=twqq.__version__, description=\n 'An asynchronous webqq client library based on tornado',\n long_description=open('README.rst').read(), author='cold', aut...
[ 0, 1, 2, 3, 4 ]
import os import pandas as pd from tabulate import tabulate if __name__ == '__main__': bestPrecision = [0,0,0,0,0,0] bestPrecisionFile = ['','','','','',''] bestRecall = [0,0,0,0,0,0] bestRecallFile = ['','','','','',''] bestSupport = [0,0,0,0,0,0] bestSupportFile = ['','','','','',''] bes...
normal
{ "blob_id": "22c498d84f40455d89ed32ccf3bf8778cb159579", "index": 79, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n bestPrecision = [0, 0, 0, 0, 0, 0]\n bestPrecisionFile = ['', '', '', '', '', '']\n bestRecall = [0, 0, 0, 0, 0, 0]\n bestRecallFile = ['', '', '', ...
[ 0, 1, 2, 3 ]
""" This file is part of GALE, Copyright Joe Krall, 2014. GALE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version...
normal
{ "blob_id": "957545649e9bf1eaabe42a1caa627d544e68f108", "index": 5490, "step-1": "\"\"\"\n This file is part of GALE,\n Copyright Joe Krall, 2014.\n\n GALE is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Fr...
[ 0 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # python/motorcycle.py Author "Nathan Wycoff <nathanbrwycoff@gmail.com>" Date 06.23.2019 # Run a CGAN on the motorcycle data. import keras import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt np.random.seed(123) import tensorflow as tf from scipy.opt...
normal
{ "blob_id": "aba3e0907e59bc5125759e90d3c784ceb97fca80", "index": 9941, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(123)\n<mask token>\ntf.enable_eager_execution()\ntf.set_random_seed(123)\n<mask token>\ngen.add(tf.keras.layers.Dense(H, input_dim=P + R, activation=tf.keras.\n activati...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- { 'name': 'Islamic Datepicker', 'category': 'Extra Tools', 'author': 'Mostafa Mohamed', 'website': 'https://eg.linkedin.com/in/mostafa-mohammed-449a8786', 'price': 25.00, 'currency': 'EUR', 'version': '9.0.1.0.1', 'depends': ['base','web'], 'data': [ '...
normal
{ "blob_id": "51a4d8f1be7009b69f0b69bdd51a0077256304a9", "index": 7222, "step-1": "<mask token>\n", "step-2": "{'name': 'Islamic Datepicker', 'category': 'Extra Tools', 'author':\n 'Mostafa Mohamed', 'website':\n 'https://eg.linkedin.com/in/mostafa-mohammed-449a8786', 'price': 25.0,\n 'currency': 'EUR'...
[ 0, 1, 2 ]
#!/bin/env python from boincvm_common.stomp.StompProtocol import StompProtocolFactory from stomp.HostStompEngine import HostStompEngine from boincvm_host.xmlrpc.HostXMLRPCService import HostXMLRPCService from twisted.internet import reactor from ConfigParser import SafeConfigParser import coilmq.start import loggi...
normal
{ "blob_id": "e533b7aadd1cd7137301af8862dd2987622e499e", "index": 3357, "step-1": "#!/bin/env python\n\nfrom boincvm_common.stomp.StompProtocol import StompProtocolFactory\nfrom stomp.HostStompEngine import HostStompEngine\n\nfrom boincvm_host.xmlrpc.HostXMLRPCService import HostXMLRPCService\n\nfrom twisted.inte...
[ 0 ]
def ddm_dd_convert(coord, direction): """Converts GPS reading from DDM to DD str coord - the ddm coordinate from $GPGGA str direction - the direction of the coord (N,S,W,E) returns - string representation of dd coordinate """ value = '' if (direction == 'S' or direction =...
normal
{ "blob_id": "dc5630e17bb6ed85157b06108250427be41416d1", "index": 7766, "step-1": "<mask token>\n\n\ndef gprmc_convert(line):\n \"\"\"Translates $GPRMC line into documented array\n str line - the GPRMC line\n returns - the data documented into array\n \"\"\"\n gps = line.strip().split(',')\n ...
[ 2, 3, 4, 5, 6 ]
import os import sys import string from array import * from datetime import datetime #f = open('input_test.txt', 'r') f = open('input_task.txt', 'r') width = 60 height = 5000 sleepingMinutes = [[0 for x in range(width)] for y in range(height)] infos = [] # Change lines to tuples and store to array for sorting for l...
normal
{ "blob_id": "293533d07b530be9e8f97f1720619bf6c3113cca", "index": 9447, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in f:\n line = line.rstrip('\\n')\n line = line.replace('[', '')\n splitted = line.split(']')\n stringTime = splitted[0]\n stringTask = splitted[1]\n datetimeTi...
[ 0, 1, 2, 3, 4 ]
from odoo import models,fields, api class director(models.Model): #Clasica _inherit = 'base.entidad' _name = 'cinemateca.director' name = fields.Char(string="name", required=True, help="Nombre del director") apellidos = fields.Char(string="apellidos", required=True, help="Apellidos del director") ...
normal
{ "blob_id": "006f499eed7cd5d73bb0cb9b242c90726fff35c1", "index": 3185, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass director(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass director(models.Model)...
[ 0, 1, 2, 3, 4 ]
'''Lab01 ex4 E/16/319 Rathnayake R.P.V.N''' from dataclasses import asdict from json import dumps from dataclasses import dataclass from typing import List, Dict import json import ex1 #import the ex1 to get the lord_course_registraion function s1=ex1.load_course_registrations("data.txt") #lord the list of Student ...
normal
{ "blob_id": "8a5ade450485f9114fa91c00c7588535ccbaf0e6", "index": 1923, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('student_registrations.json', 'w') as f:\n f.write(e)\n", "step-3": "<mask token>\ns1 = ex1.load_course_registrations('data.txt')\ns1 = map(asdict, s1)\ne = json.dumps(list...
[ 0, 1, 2, 3, 4 ]
import os from src.model_manager import ModelManager dir_path = os.path.dirname(os.path.realpath(__file__)) config_file = '{}/data/config/config_1.json'.format(dir_path) model_dir = '{}/data/models'.format(dir_path) def test_init(): mm = ModelManager(config_file, model_dir) def test_predict(): pass
normal
{ "blob_id": "5da61b4cd8e4faf135b49396d3b346a219bf73f6", "index": 3851, "step-1": "<mask token>\n\n\ndef test_predict():\n pass\n", "step-2": "<mask token>\n\n\ndef test_init():\n mm = ModelManager(config_file, model_dir)\n\n\ndef test_predict():\n pass\n", "step-3": "<mask token>\ndir_path = os.path...
[ 1, 2, 3, 4 ]