code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
def DFS(x): # 전위순회 if x > 7: return else: DFS((x * 2)) print(x) DFS((x*2)+1) if __name__ == "__main__": DFS(1)
normal
{ "blob_id": "1cc8695aa694359314b6d478fe6abed29fdc6c91", "index": 3309, "step-1": "<mask token>\n", "step-2": "def DFS(x):\n if x > 7:\n return\n else:\n DFS(x * 2)\n print(x)\n DFS(x * 2 + 1)\n\n\n<mask token>\n", "step-3": "def DFS(x):\n if x > 7:\n return\n el...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ArrayHardwareMetrics: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ArrayHardwareMetrics: def __init__(self, fa): self.fa = fa self.chassis_...
flexible
{ "blob_id": "527d514cbad0916fecfe0da68de04d3b130d94c7", "index": 5156, "step-1": "<mask token>\n\n\nclass ArrayHardwareMetrics:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ArrayHardwareMetrics:\n\n def __init__(self, fa):\n self.fa = fa\n self.c...
[ 1, 2, 3, 5, 6 ]
from skimage import data, filters, measure, exposure from skimage.filters import threshold_mean from skimage.transform import resize import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import pyfits as pf import time import numpy as np import healpy as hp from healpy.projector import CartesianProj f...
normal
{ "blob_id": "d86fd2e6ef5dab4444772192471538842112b3fd", "index": 2675, "step-1": "<mask token>\n", "step-2": "<mask token>\nhp.mollview(fu, title='Full map +50 GLAT', sub=311)\nhp.mollview(se, title='Above threshold (4.0) +50 GLAT', sub=312)\nhp.mollview(ma, title='Diff +50 GLAT', sub=313)\nplt.savefig('figs/d...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for nth in moves: for i in range(len(board)): selected = board[i][nth - 1] if selected == 0: continue else: resultList.append(selected) lenR = len(resultList) ...
flexible
{ "blob_id": "18e032b7ff7ae9d3f5fecc86f63d12f4da7b8067", "index": 6180, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor nth in moves:\n for i in range(len(board)):\n selected = board[i][nth - 1]\n if selected == 0:\n continue\n else:\n resultList.append(sel...
[ 0, 1, 2, 3 ]
from envs import DATASET_FOLDER from os.path import join import json import collections from tqdm import tqdm def add_space(context_list): space_context = [] for idx, context in enumerate(context_list): space_sent_list = [] sent_list = context[1] if idx == 0: for sent_idx, s...
normal
{ "blob_id": "a179d3d2f04a101eaa60b5964c2b1cd77071633f", "index": 5344, "step-1": "<mask token>\n\n\ndef find_answer(answer, sents):\n for s_idx, sent in enumerate(sents):\n if answer in sent:\n return s_idx\n return -1\n\n\n<mask token>\n\n\ndef docred_refiner():\n DOCRED_OUTPUT_PROCES...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def gen_arbitrary_network(num_eps, ep_label=None, ep_capacity=12500, num_channels=1, racks_dict=None, topology_type=None): """Generates an arbitrary network with num_eps nodes labelled as ep_label. Note that no edges are formed in this network; it is purely for ep name i...
flexible
{ "blob_id": "4cf2829282cb0a1673e741f78f17ce27a2817ff2", "index": 651, "step-1": "<mask token>\n\n\ndef gen_arbitrary_network(num_eps, ep_label=None, ep_capacity=12500,\n num_channels=1, racks_dict=None, topology_type=None):\n \"\"\"Generates an arbitrary network with num_eps nodes labelled as ep_label.\n\n...
[ 11, 12, 13, 15, 16 ]
import os import sys import pytest def run_test(file_name, capture_stdout=True, allure_dir=None): cmd = [ file_name, "-vvv", ] if capture_stdout: cmd.append("-s") test_name = os.path.splitext(os.path.basename(file_name))[0] alluredir = os.path.normpath("%s/%s/" % (allure_dir or "...
normal
{ "blob_id": "7e7a50cb8e66a71c1df2d61241f8a55c042b7d59", "index": 2664, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run_test(file_name, capture_stdout=True, allure_dir=None):\n cmd = [file_name, '-vvv']\n if capture_stdout:\n cmd.append('-s')\n test_name = os.path.splitext(os.pa...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> style.use('ggplot') <|reserved_special_token_0|> clf.fit(X) <|reserved_special_token_0|> print(cluster_centers) <|reserved_special_token_0|> print('Number of clusters found:', n_clusters) <|reserved_special_token_0|> for i in rang...
flexible
{ "blob_id": "c0216dbd52be134eb417c20ed80b398b22e5d844", "index": 6967, "step-1": "<mask token>\n", "step-2": "<mask token>\nstyle.use('ggplot')\n<mask token>\nclf.fit(X)\n<mask token>\nprint(cluster_centers)\n<mask token>\nprint('Number of clusters found:', n_clusters)\n<mask token>\nfor i in range(len(X)):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Song: def __init__(self, songName, artistName, lyric): self.songName = songName self.artistName = artistName self.lyric = lyric self.phrasePinyinDict = util.lyricToPinYi(self.lyric) <|reserved_special_token_0|> def getArtistName(self): ...
flexible
{ "blob_id": "fa3cec0781b9ca5c1d99a7500748104d7cdce631", "index": 130, "step-1": "<mask token>\n\n\nclass Song:\n\n def __init__(self, songName, artistName, lyric):\n self.songName = songName\n self.artistName = artistName\n self.lyric = lyric\n self.phrasePinyinDict = util.lyricToP...
[ 6, 7, 8, 9, 10 ]
from golem import actions from projects.golem_gui.pages import common from projects.golem_gui.pages import api from projects.golem_gui.pages import test_builder_code description = 'Verify the user can edit test code and save it' tags = ['smoke'] def setup(data): common.access_golem(data.env.url, data.env.admin) ...
normal
{ "blob_id": "d4cdc4f1995eab7f01c970b43cb0a3c5ed4a2711", "index": 3673, "step-1": "<mask token>\n\n\ndef setup(data):\n common.access_golem(data.env.url, data.env.admin)\n api.project.using_project('test_builder_code')\n data.test = api.test.create_access_test_code(data.project)\n\n\n<mask token>\n", "...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for c in s: if c == 'R': t += 1 else: ans = max(ans, t) t = 0 <|reserved_special_token_0|> print(ans) <|reserved_special_token_1|> s = input() ans = 0 t = 0 for c in s: if c == 'R': t...
flexible
{ "blob_id": "85c97dfeb766f127fa51067e5155b2da3a88e3be", "index": 4811, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c in s:\n if c == 'R':\n t += 1\n else:\n ans = max(ans, t)\n t = 0\n<mask token>\nprint(ans)\n", "step-3": "s = input()\nans = 0\nt = 0\nfor c in s:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class _PartitionedResults(BaseResults): <|reserved_special_token_0|> def mask(self, indices): self.theta.mask[indices] = True self.skeletons.mask[indices] = True self.scores.mask[indices] = True self.partitions.mask[indices] = True <|reserved_s...
flexible
{ "blob_id": "b8fcd8e6dce8d210576bc4166dd258e5fd51278d", "index": 517, "step-1": "<mask token>\n\n\nclass _PartitionedResults(BaseResults):\n <mask token>\n\n def mask(self, indices):\n self.theta.mask[indices] = True\n self.skeletons.mask[indices] = True\n self.scores.mask[indices] = T...
[ 10, 19, 20, 24, 26 ]
# Generated by Django 3.0.8 on 2020-08-11 13:43 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('recipe', '0006_recipe_description'), ] operations = [ migrations.AddField( model_name='recipe', name='portions', ...
normal
{ "blob_id": "43dc69c66d94d85337c11eb4cfed48d7fdef2074", "index": 5770, "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 = [('recipe', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('%s Заварушку устроили' % alldude) <|reserved_special_token_1|> threehome = 25 * 3 twotonnel = 40 * 2 alldude = threehome + twotonnel print('%s Заварушку устроили' % alldude)
flexible
{ "blob_id": "e492680efe57bd36b58c00977ecd79196501997a", "index": 7952, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('%s Заварушку устроили' % alldude)\n", "step-3": "threehome = 25 * 3\ntwotonnel = 40 * 2\nalldude = threehome + twotonnel\nprint('%s Заварушку устроили' % alldude)\n", "step-4":...
[ 0, 1, 2 ]
from django.shortcuts import render # Create your views here. from django.shortcuts import redirect from django.contrib.auth.mixins import LoginRequiredMixin from django.http import Http404, HttpResponseForbidden from django.shortcuts import render from django.urls import reverse from django.views.generic.edit import ...
normal
{ "blob_id": "c385fe2af9aebc9c4a42d4db5a341fcedeec3898", "index": 3579, "step-1": "<mask token>\n\n\ndef index(request):\n return render(request, 'canyon/index.html')\n\n\ndef results(request):\n return render(request, 'canyon/results.html')\n", "step-2": "<mask token>\ndjango.setup()\n\n\ndef index(reque...
[ 2, 3, 4, 5, 6 ]
from zExceptions import Unauthorized if REQUEST is not None: raise Unauthorized portal = context.getPortalObject() compute_node = context reference = "TIOCONS-%s-%s" % (compute_node.getReference(), source_reference) version = "%s" % context.getPortalObject().portal_ids.generateNewId( id_group=('slap_tioxml_consum...
normal
{ "blob_id": "6c27f70e820202f6cc4348de3c9198e7b20ec7d9", "index": 4470, "step-1": "<mask token>\n", "step-2": "<mask token>\nif REQUEST is not None:\n raise Unauthorized\n<mask token>\ndocument.submit()\nreturn document.getRelativeUrl()\n", "step-3": "<mask token>\nif REQUEST is not None:\n raise Unauth...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render import codecs import os.path from django.conf import settings OFFSET = 20 def show_raw_data(req): filename = req.GET['file'] lineno = int(req.GET['line']) from_lineno = max(0, lineno - OFFSET) to_lineno = (lineno + OFFSET) ctx = dict() cur_lineno = 1 lin...
normal
{ "blob_id": "576c28bb32b5e0b2b5a82a33cee73e3080dcf3ab", "index": 1737, "step-1": "<mask token>\n\n\ndef show_raw_data(req):\n filename = req.GET['file']\n lineno = int(req.GET['line'])\n from_lineno = max(0, lineno - OFFSET)\n to_lineno = lineno + OFFSET\n ctx = dict()\n cur_lineno = 1\n lin...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if A == 0: print('Impossivel calcular') else: delta = B ** 2 - 4 * A * C if delta < 0.0: print('Impossivel calcular') else: raiz = delta ** 0.5 r1 = (-B + raiz) / (2 * A) r2 = (-B - ...
flexible
{ "blob_id": "f114a86a3c6bea274b01763ce3e8cd5c8aea44a0", "index": 3115, "step-1": "<mask token>\n", "step-2": "<mask token>\nif A == 0:\n print('Impossivel calcular')\nelse:\n delta = B ** 2 - 4 * A * C\n if delta < 0.0:\n print('Impossivel calcular')\n else:\n raiz = delta ** 0.5\n ...
[ 0, 1, 2, 3 ]
class Tienda: def __init__(self, nombre_tienda, lista_productos=[]): self.nombre_tienda = nombre_tienda self.lista_productos = lista_productos <|reserved_special_token_0|> def anhadir_producto(self, producto_nuevo): self.lista_productos.append(producto_nuevo) print('# # # #...
flexible
{ "blob_id": "0ae5d20b78bf7c23418de55ffd4d81cd5284c6d5", "index": 8912, "step-1": "class Tienda:\n\n def __init__(self, nombre_tienda, lista_productos=[]):\n self.nombre_tienda = nombre_tienda\n self.lista_productos = lista_productos\n <mask token>\n\n def anhadir_producto(self, producto_nu...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def data_split_GroupKFold(df, col_index, col_group, n_splits=5, random_state=42 ): """ :param df: :param col_index: :param col_group: :param n_splits: :param random_state: :return: """ group = np.sort(df[col_group].unique()) print('num group: {...
flexible
{ "blob_id": "4d0b08f8ca77d188aa218442ac0689fd2c057a89", "index": 8357, "step-1": "<mask token>\n\n\ndef data_split_GroupKFold(df, col_index, col_group, n_splits=5, random_state=42\n ):\n \"\"\"\n\n :param df:\n :param col_index:\n :param col_group:\n :param n_splits:\n :param random_state:\n...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "a727502063bd0cd959fdde201832d37b29b4db70", "index": 4304, "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 = [('album', '00...
[ 0, 1, 2, 3, 4 ]
import sys import os def my_add(a, b): return a + b
normal
{ "blob_id": "cc81e13bba0ea0186966bce7f5aac05bb106e971", "index": 5935, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef my_add(a, b):\n return a + b\n", "step-3": "import sys\nimport os\n\n\ndef my_add(a, b):\n return a + b\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
from .net import *
normal
{ "blob_id": "73337246bd54df53842360510148f3a6f4763ace", "index": 6251, "step-1": "<mask token>\n", "step-2": "from .net import *\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> class Agent(object): def __init__(self, model=None, lr=0.01, gamma=0.99): self.gamma = gamma self.AC = model self.optimizer = Adam(AC.parameters(), lr=lr) self.logp_as = [] self.values = [] self.rewards = [] def choose_action(self,...
flexible
{ "blob_id": "e1ab4b034c949b8158c6ccc1e8e3f4a960a38c72", "index": 4382, "step-1": "<mask token>\n\n\nclass Agent(object):\n\n def __init__(self, model=None, lr=0.01, gamma=0.99):\n self.gamma = gamma\n self.AC = model\n self.optimizer = Adam(AC.parameters(), lr=lr)\n self.logp_as = ...
[ 4, 7, 8, 10, 11 ]
import pymysql def get_list(sql, args): conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd ='chen0918', db='web') cursor = conn.cursor(cursor=pymysql.cursors.DictCursor) cursor.execute(sql, args) result = cursor.fetchall() cursor.close() conn.close() return res...
normal
{ "blob_id": "80819ec83572737c89044936fc269154b190751a", "index": 2372, "step-1": "<mask token>\n\n\ndef modify(sql, args):\n conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd\n ='chen0918', db='web')\n cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)\n cursor.execute(...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cv2.imshow('Original', img) cv2.imshow('Contorno', contorno) cv2.waitKey() cv2.destroyAllWindows() <|reserved_special_token_1|> <|reserved_special_token_0|> img = cv2.imread('data/j.png', cv2.IMREAD_GRAYSCALE) kernel = cv2.getS...
flexible
{ "blob_id": "809c9ce2b017612bedd1eb889c2b017275ee8b6f", "index": 1729, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('Original', img)\ncv2.imshow('Contorno', contorno)\ncv2.waitKey()\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nimg = cv2.imread('data/j.png', cv2.IMREAD_GRAYSCALE)\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def CharlietheDog(strArr): def walk(food_home, dog, matriz, steps=0): food_home_dx = food_home[0][0] - dog[0] food_home_dy = food_home[0][1] - dog[1] walk_x = food_home_dx / (abs(food_home_dx) if foo...
flexible
{ "blob_id": "731110b02c8a09dc84042a99c14eef990ae33cd2", "index": 5913, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef CharlietheDog(strArr):\n\n def walk(food_home, dog, matriz, steps=0):\n food_home_dx = food_home[0][0] - dog[0]\n food_home_dy = food_home[0][1] - dog[1]\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class LIScore(Serializable['LIScore'], Score): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reser...
flexible
{ "blob_id": "a0086a9d27a091776378cd8bde31c59899fc07ac", "index": 3122, "step-1": "<mask token>\n\n\nclass LIScore(Serializable['LIScore'], Score):\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\n def __str__(sel...
[ 12, 14, 16, 20, 21 ]
# coding: utf-8 # In[1]: import matplotlib.pyplot as plt import matplotlib import pandas as pd import numpy as np from pandas import DataFrame, Series import os, re # In[2]: OUTPUT_EXCEL = '월별원내약품사용현황.xlsx' # In[3]: # 데이타셋 준비 data_source_dir = '사용량월별통계/원내' dfs = [] for fname in os.listdir(data_source_dir): ...
normal
{ "blob_id": "16b425d7b8cde1aabe038ccae6922091afb84415", "index": 411, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_last(s):\n try:\n return max(s)\n except:\n return s\n\n\n<mask token>\n", "step-3": "<mask token>\nOUTPUT_EXCEL = '월별원내약품사용현황.xlsx'\ndata_source_dir = '사...
[ 0, 1, 3, 4, 5 ]
<|reserved_special_token_0|> class TestClass01(TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_case01(self): """Version extraction""" version = versions.extract_version(self.any_string) self.assertEqual(version, '1.1.1') <|reserved_special_token_0...
flexible
{ "blob_id": "21d2de5719fafd94605f31bc07231644f4be18c5", "index": 8749, "step-1": "<mask token>\n\n\nclass TestClass01(TestCase):\n <mask token>\n <mask token>\n\n def test_case01(self):\n \"\"\"Version extraction\"\"\"\n version = versions.extract_version(self.any_string)\n self.ass...
[ 4, 5, 8, 9, 10 ]
""" Contains different comparator classes for model output data structures. """ import copy def tuple_to_string(tuptup): """ Converts a tuple to its string representation. Uses different separators (;, /, |) for different depths of the representation. Parameters ---------- tuptup : list ...
normal
{ "blob_id": "9c935e9ef298484d565256a420b867e800c3df55", "index": 3243, "step-1": "<mask token>\n\n\nclass NVCComparator:\n \"\"\" NVC response comparator. Performs the evaluation based on NVC and non-NVC classes.\n\n \"\"\"\n\n @staticmethod\n def compare(obj_a, obj_b):\n \"\"\" Compares two r...
[ 3, 6, 7, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('----------------') print('{} x {:2} = {:2}'.format(n, 1, 1 * n)) print('{} x {:2} = {:2}'.format(n, 2, 2 * n)) print('{} x {:2} = {:2}'.format(n, 3, 3 * n)) print('{} x {:2} = {:2}'.format(n, 4, 4 * n)) print('{} x {:2} = {...
flexible
{ "blob_id": "9e814e3f1162e248c5d778c2df9960b199854a27", "index": 9306, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('----------------')\nprint('{} x {:2} = {:2}'.format(n, 1, 1 * n))\nprint('{} x {:2} = {:2}'.format(n, 2, 2 * n))\nprint('{} x {:2} = {:2}'.format(n, 3, 3 * n))\nprint('{} x {:2} = ...
[ 0, 1, 2 ]
# -*- coding:utf-8 -*- import requests from lxml import etree import codecs from transfrom import del_extra import re MODIFIED_TEXT = [r'一秒记住.*?。', r'(看书.*?)', r'纯文字.*?问', r'热门.*?>', r'最新章节.*?新', r'は防§.*?e', r'&.*?>', r'r.*?>', r'c.*?>', r'复制.*?>', r'字-符.*?>', r'最新最快,无.*?。', ...
normal
{ "blob_id": "7539042b92a5188a11f625cdfc0f341941f751f0", "index": 6937, "step-1": "<mask token>\n\n\ndef crawl_urls(u):\n response = requests.get(u, headers=HEADER)\n body = etree.HTML(response.content)\n content_urls = body.xpath('//div[@class=\"box_con\"]/div/dl//dd/a/@href')\n for pk_id, u in enume...
[ 4, 5, 6, 7, 8 ]
import torch import torchvision from torch import nn def get_resnet18(pre_imgnet=False, num_classes=64): model = torchvision.models.resnet18(pretrained=pre_imgnet) model.fc = nn.Linear(512, 64) return model
normal
{ "blob_id": "8e05b2723d8c50354e785b4bc7c5de8860aa706d", "index": 5355, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_resnet18(pre_imgnet=False, num_classes=64):\n model = torchvision.models.resnet18(pretrained=pre_imgnet)\n model.fc = nn.Linear(512, 64)\n return model\n", "step-3"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def decrypt(key, ciphertext): plaintext = '' for i in ciphertext: if i.isalpha(): alphabet = ord(i) - key if alphabet < ord('A'): alphabet += 26 letter = chr(al...
flexible
{ "blob_id": "ac31cba94ee8ff7a2903a675954c937c567b5a56", "index": 6739, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef decrypt(key, ciphertext):\n plaintext = ''\n for i in ciphertext:\n if i.isalpha():\n alphabet = ord(i) - key\n if alphabet < ord('A'):\n ...
[ 0, 1, 2, 3 ]
from mesa import Model from mesa.space import SingleGrid from mesa.time import BaseScheduler, RandomActivation, SimultaneousActivation from pdpython_model.fixed_model.agents import PDAgent from mesa.datacollection import DataCollector class PDModel(Model): schedule_types = {"Sequential": BaseScheduler, ...
normal
{ "blob_id": "446c438b79f9957289fa85f21516c13d67e2cfaf", "index": 3270, "step-1": "<mask token>\n\n\nclass PDModel(Model):\n <mask token>\n <mask token>\n\n def make_agents(self):\n for i in range(self.number_of_agents):\n x, y = self.coordinates.pop(0)\n pdagent = PDAgent((x...
[ 3, 5, 6, 7, 8 ]
from django.shortcuts import render class Person(object): def __init__(self,username): self.username = username def index(request): # p = Person("张三") # context = { # 'person': p # } # context = { # 'person': { # 'username':'zhiliao', # } # } # p...
normal
{ "blob_id": "6d2bc28e7742f1063a04ae96fc195515ad70598b", "index": 5666, "step-1": "<mask token>\n\n\nclass Person(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Person(object):\n\n def __init__(self, username):\n self.username = username\n\n\n<mask token>\n", "st...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> my_func = lambda x, y: x ** y
flexible
{ "blob_id": "93baa6ba14d06661731dce3e34ea93d49c06001b", "index": 9043, "step-1": "<mask token>\n", "step-2": "my_func = lambda x, y: x ** y\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from .signals import get_restaurant_coordinates, count_average_price, count_total_calories from .dish import Dish from .ingredients import Ingredient from .restaurants import Restaurant
normal
{ "blob_id": "1935cab249bf559aeadf785ce7abcecb03344c04", "index": 6058, "step-1": "<mask token>\n", "step-2": "from .signals import get_restaurant_coordinates, count_average_price, count_total_calories\nfrom .dish import Dish\nfrom .ingredients import Ingredient\nfrom .restaurants import Restaurant\n", "step-...
[ 0, 1 ]
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_security import SQLAlchemySessionUserDatastore, Security app = Flask(__name__, instance_relative_config=True) app.config.from_pyfile("config.py", silent=True) db = SQLAlchemy(app) from .blueprints.cart.views import cart_blueprint from .bluepr...
normal
{ "blob_id": "5d97a2afed26ec4826c8bce30c84863d21f86001", "index": 9370, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config.from_pyfile('config.py', silent=True)\n<mask token>\napp.register_blueprint(static_blueprint)\napp.register_blueprint(admin_blueprint)\napp.register_blueprint(cart_blueprint)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PaperReader: <|reserved_special_token_0|> def __init__(self, _threshold=0.001, _length_limit=20000): with open(config.wordlist, 'r') as f: self.wordlist = [w for w in list(f.readlines()) if len(w) >= 4] self.tfu_pdf = TrueFormatUpmarkerPdf2HTMLEX...
flexible
{ "blob_id": "4d2cb3e0bdd331a1de7f07eb0109f02c9cf832a8", "index": 7441, "step-1": "<mask token>\n\n\nclass PaperReader:\n <mask token>\n\n def __init__(self, _threshold=0.001, _length_limit=20000):\n with open(config.wordlist, 'r') as f:\n self.wordlist = [w for w in list(f.readlines()) if...
[ 8, 10, 11, 12, 13 ]
# -*- coding: utf-8 -*- """ Created on Mon Mar 5 14:23:28 2018 @author: emily """ import pipeline import numpy as np import matplotlib.pyplot as plt import pstats import cProfile pr = cProfile.Profile() pr.enable() #def try_running(): max_it=200000 rnd_sd = 1 deps = np.concatenate((np.arange(0,10,0.2), np.aran...
normal
{ "blob_id": "cfe5d013c968afdbf1fc80e3c8c3233a3678450b", "index": 9848, "step-1": "<mask token>\n", "step-2": "<mask token>\npr.enable()\n<mask token>\nfor k in range(all_models[1,].size - 1):\n colstr = str(0.75 - k / 2 / all_models[1,].size)\n plt.plot(all_models[:, k], all_models[:, 0], '-', linewidth=...
[ 0, 1, 2, 3, 4 ]
# -*- coding: UTF-8 -*- # File name: ukWorkingDays # Created by JKChang # 29/07/2020, 11:20 # Tag: # Description: from datetime import date,timedelta,datetime from workalendar.europe import UnitedKingdom cal = UnitedKingdom() print(cal.holidays(2020)) def workingDate(start,end): cal = UnitedKingdom() res = [...
normal
{ "blob_id": "feed412278d9e711e49ef209ece0876c1de4a873", "index": 886, "step-1": "<mask token>\n\n\ndef workingDate(start, end):\n cal = UnitedKingdom()\n res = []\n delta = end - start\n for i in range(delta.days + 1):\n day = start + timedelta(days=i)\n if cal.is_working_day(day) or da...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> context.set_state('ProjectSummary', 'proposal_code', '2017.1.01355.L') context.set_state('ProjectSummary', 'piname', 'unknown') context.set_state('ProjectSummary', 'proposal_title', 'unknown') context.set_state('ProjectStructure',...
flexible
{ "blob_id": "290811317ddb49a7d2a9f44ab7e0b6d201db12e1", "index": 7532, "step-1": "<mask token>\n", "step-2": "<mask token>\ncontext.set_state('ProjectSummary', 'proposal_code', '2017.1.01355.L')\ncontext.set_state('ProjectSummary', 'piname', 'unknown')\ncontext.set_state('ProjectSummary', 'proposal_title', 'un...
[ 0, 1, 2, 3, 4 ]
import sys import numpy as np from pymongo import MongoClient from sklearn import linear_model, preprocessing assert str(sys.argv[1]) is not None client = MongoClient(str(sys.argv[1])) db = client.nba_py variables = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13',...
normal
{ "blob_id": "36682c4ab90cdd22b644906e22ede71254eb42ff", "index": 2091, "step-1": "<mask token>\n", "step-2": "<mask token>\nassert str(sys.argv[1]) is not None\n<mask token>\nfor k in ALPHA_VALS:\n total_train_error = 0\n total_train_variance = 0\n total_test_error = 0\n total_test_variance = 0\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class User(Document): surname = StringField(required=True) name = StringField(required=True) middle_name = StringField(required=True) phone = StringField(required=True) email = StringField(required=True) address = StringField(required=True) wishes = StringField...
flexible
{ "blob_id": "dcb2351f9489815fbec8694b446d0a93972a6590", "index": 6388, "step-1": "<mask token>\n\n\nclass User(Document):\n surname = StringField(required=True)\n name = StringField(required=True)\n middle_name = StringField(required=True)\n phone = StringField(required=True)\n email = StringField...
[ 10, 12, 13, 14, 16 ]
<|reserved_special_token_0|> class initDATA(webapp.RequestHandler): <|reserved_special_token_0|> def get(self): user = users.get_current_user() if user == None: self.redirect(users.create_login_url(self.request.uri)) return for ht in hts: htdate = d...
flexible
{ "blob_id": "b8957acb71d435a93b4397a24d3b5cf4b2a817f8", "index": 2602, "step-1": "<mask token>\n\n\nclass initDATA(webapp.RequestHandler):\n <mask token>\n\n def get(self):\n user = users.get_current_user()\n if user == None:\n self.redirect(users.create_login_url(self.request.uri)...
[ 4, 5, 6, 7, 8 ]
# Copyright (c) 2016, the GPyOpt Authors # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np from scipy.special import erfc import time from ..core.errors import InvalidConfigError def compute_integrated_acquisition(acquisition,x): ''' Used to compute the acquisition function when s...
normal
{ "blob_id": "4e7cfbf51ec9bad691d8dd9f103f22728cf5e952", "index": 1229, "step-1": "<mask token>\n\n\ndef compute_integrated_acquisition(acquisition, x):\n \"\"\"\n Used to compute the acquisition function when samples of the hyper-parameters have been generated (used in GP_MCMC model).\n\n :param acquisi...
[ 7, 9, 12, 15, 16 ]
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse class CampaignNegativeKeywords(Client): @sp_endpoint('/v2/sp/campaignNegativeKeywords/{}', method='GET') def get_campaign_negative_keyword(self, keywordId, **kwargs) -> ApiResponse: r""" get_campaign_negative_keyword(...
normal
{ "blob_id": "f6e0215f9992ceab51887aab6a19f58a5d013eb4", "index": 7829, "step-1": "<mask token>\n\n\nclass CampaignNegativeKeywords(Client):\n <mask token>\n\n @sp_endpoint('/v2/sp/campaignNegativeKeywords/{}', method='DELETE')\n def delete_campaign_negative_keyword(self, keywordId, **kwargs\n ) -...
[ 5, 6, 8, 9, 10 ]
#!/usr/bin/env python # https://github.com/git/git/blob/master/Documentation/githooks.txt#L181 # This hook is called by 'git push' and can be used to prevent a push from taking # place. The hook is called with two parameters which provide the name and # location of the destination remote, if a named remote is not bei...
normal
{ "blob_id": "eabc81cacacc40d55234b60927b17069980a08f8", "index": 7245, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.argv.extend(sys.stdin.read().split())\n<mask token>\nif len(sys.argv) > 3:\n local_ref = sys.argv[3]\n local_sha1 = sys.argv[4]\n remote_ref = sys.argv[5]\n remote_sha1 = ...
[ 0, 1, 2, 3, 4 ]
import socket import json from typing import Dict listadionica = ["GS", "MS", "WFC", "VALBZ", "BOND", "VALE", "XLF"] class Burza: def __init__ (self, test): if test: host_name = "test-exch-partitivnisumari" port = 25000 else: host_name = "production" ...
normal
{ "blob_id": "5a895c864c496e1073d75937909c994432a71d75", "index": 9760, "step-1": "import socket\nimport json\n\nfrom typing import Dict\n\nlistadionica = [\"GS\", \"MS\", \"WFC\", \"VALBZ\", \"BOND\", \"VALE\", \"XLF\"]\n\nclass Burza:\n def __init__ (self, test):\n\n if test:\n host_name = ...
[ 0 ]
class Solution(object): def removeNthFromEnd(self, head, n): dummy = ListNode(-1) dummy.next = head first, second = dummy, dummy for i in range(n): first = first.next while first.next: first = first.next second = second.next second...
normal
{ "blob_id": "7e71c97070285b051b23448c755e3d41b2909dda", "index": 3884, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def removeNthFromEnd(self, head, n):\n dummy = ListNode(-1)\n dummy.next = head\n first, s...
[ 0, 1, 2 ]
from flask import url_for from bs4 import BeautifulSoup from unittest.mock import ANY import app from app.notify_client.models import InvitedUser from tests.conftest import sample_invite as create_sample_invite from tests.conftest import mock_check_invite_token as mock_check_token_invite def test_existing_user_acce...
normal
{ "blob_id": "0baa133bd9eb8a162a82b23ba4d26cdd34f701c4", "index": 1507, "step-1": "<mask token>\n\n\ndef test_existing_user_accept_invite_calls_api_and_redirects_to_dashboard(\n client, service_one, api_user_active, sample_invite, mock_get_service,\n mock_check_invite_token, mock_get_user_by_email,\n moc...
[ 8, 10, 11, 12, 13 ]
<|reserved_special_token_0|> @pytest.mark.integration def test_athena_config_query_location_old_plus_new_value_not_allowed(): from datahub.ingestion.source.sql.athena import AthenaConfig with pytest.raises(ValueError): AthenaConfig.parse_obj({'aws_region': 'us-west-1', 's3_staging_dir': 's...
flexible
{ "blob_id": "1304b6373edeca394070b8a3d144608cf07172e3", "index": 9448, "step-1": "<mask token>\n\n\n@pytest.mark.integration\ndef test_athena_config_query_location_old_plus_new_value_not_allowed():\n from datahub.ingestion.source.sql.athena import AthenaConfig\n with pytest.raises(ValueError):\n Ath...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def dump_all_sargas(base_dir): for kaanda_index in book_data.get_subunit_list(file_path=unit_info_file, unit_path_list=[]): if kaanda_index >= 6: continue sarga_list = book_data.get_subunit_list(file_path=unit_info_file, unit_path_list=[...
flexible
{ "blob_id": "f3a63a22f8746d4a1f127bfe9e8c9d822109ab3c", "index": 463, "step-1": "<mask token>\n\n\ndef dump_all_sargas(base_dir):\n for kaanda_index in book_data.get_subunit_list(file_path=unit_info_file,\n unit_path_list=[]):\n if kaanda_index >= 6:\n continue\n sarga_list = b...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class GIFOutput(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, gif_fps=None, color_depth=None, gif_loop=None, height=None, start=None, duration=None, suffix=None, ...
flexible
{ "blob_id": "2362c9a12f97f32f6136aaf16a55cf4acbaf9294", "index": 4753, "step-1": "<mask token>\n\n\nclass GIFOutput(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, gif_fps=None, color_depth=None, gif_loop=None,\n height=None, start=None, duration=...
[ 27, 28, 29, 31, 33 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(x, y + 1): if i > 1: for j in range(2, i): if i % j == 0: break else: count += 1 print(count) <|reserved_special_token_1|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "06848ec0e327fed1da00446cec6392c6f42130af", "index": 2158, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(x, y + 1):\n if i > 1:\n for j in range(2, i):\n if i % j == 0:\n break\n else:\n count += 1\nprint(count)\n", "step...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> [x for x in zip(a, b)] <|reserved_special_token_0|> [x for x in zip(a, c)] <|reserved_special_token_0|> for book, price in zip(books, prices): print('%s的价格是:%3.1f' % (book, price)) [y for y in reversed(b)] for book in sorted(b...
flexible
{ "blob_id": "0eab23f4271f724da587707599eb0cbf2144efa1", "index": 8178, "step-1": "<mask token>\n", "step-2": "<mask token>\n[x for x in zip(a, b)]\n<mask token>\n[x for x in zip(a, c)]\n<mask token>\nfor book, price in zip(books, prices):\n print('%s的价格是:%3.1f' % (book, price))\n[y for y in reversed(b)]\nfo...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TemperatureSensor: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, average_temperature, temperature_variation, min_temperature, max_temperature): self.average_temperature = average_temperature...
flexible
{ "blob_id": "bc890f0f40a7e9c916628d491e473b5ecfa9bb9b", "index": 740, "step-1": "<mask token>\n\n\nclass TemperatureSensor:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, average_temperature, temperature_variation,\n min_temperature, max_temperature):\n self.average...
[ 5, 7, 8, 9, 10 ]
from django.apps import AppConfig class FilebasedUniqueConfig(AppConfig): name = 'papermerge.filebased_unique' label = 'filebased_unique'
normal
{ "blob_id": "2d17229afe154937132c1e4f8c138896da34ab61", "index": 1430, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass FilebasedUniqueConfig(AppConfig):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass FilebasedUniqueConfig(AppConfig):\n name = 'papermerge.filebase...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Older: ' + cache['year']) <|reserved_special_token_0|> print('Newer: ' + cache['year']) print(cache) <|reserved_special_token_0|> print(cache) <|reserved_special_token_0|> print(cache) <|reserved_special_token_1|> <|rese...
flexible
{ "blob_id": "aebc918d6a1d1d2473f74d77b8a915ac25548e3a", "index": 443, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Older: ' + cache['year'])\n<mask token>\nprint('Newer: ' + cache['year'])\nprint(cache)\n<mask token>\nprint(cache)\n<mask token>\nprint(cache)\n", "step-3": "<mask token>\ncache ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf8 -*- ''' dump data from mysql/hive to load into mysql ''' from datetime import datetime,timedelta from optparse import OptionParser import argparse import ConfigParser import sys import os import time import commonutil def getConf(cfgfile): config = ConfigParser.ConfigParser() ...
normal
{ "blob_id": "df984939c109662bebbd1556c12223fce8f643e6", "index": 1773, "step-1": "<mask token>\n\n\ndef truncateFile(fileName):\n fileTemp = open(fileName, 'w')\n fileTemp.truncate()\n fileTemp.close()\n\n\ndef getConnBySecName(dbConf, secName):\n descSec = ''\n secs = dbConf.sections()\n for s...
[ 3, 4, 6, 7, 8 ]
"""Support for binary sensor using I2C abelectronicsiopi chip.""" from custom_components.abelectronicsiopi.IOPi import IOPi import voluptuous as vol from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity from homeassistant.const import DEVICE_DEFAULT_NAME import homeassistant.help...
normal
{ "blob_id": "73d056d4ab0d268841156b21dfc2c54b5fb2f5f1", "index": 5218, "step-1": "<mask token>\n\n\nclass abelectronicsiopiBinarySensor(BinarySensorEntity):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, pinname, pin, pull_mode, invert_logic, bus):\n \"\"...
[ 5, 7, 8, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('O aluno escolhido é {}.'.format(random.choice(names))) <|reserved_special_token_1|> <|reserved_special_token_0|> a = input('Nome do primeiro aluno: ') b = input('Nome do segundo aluno: ') c = input('Nome do terceiro alun...
flexible
{ "blob_id": "bac3cee5e6d129fcf345d92000cb2a257c303dd5", "index": 9805, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('O aluno escolhido é {}.'.format(random.choice(names)))\n", "step-3": "<mask token>\na = input('Nome do primeiro aluno: ')\nb = input('Nome do segundo aluno: ')\nc = input('Nome d...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> MUTATIONS = [ChangeField('ReviewRequest', 'depends_on', initial=None, null= False), ChangeField('ReviewRequestDraft', 'depends_on', initial=None, null=False)] <|reserved_special_token_1|> from django_evolution.mutations...
flexible
{ "blob_id": "286953e381d03c0817d57f9ee4e15f2a0ce808a9", "index": 9776, "step-1": "<mask token>\n", "step-2": "<mask token>\nMUTATIONS = [ChangeField('ReviewRequest', 'depends_on', initial=None, null=\n False), ChangeField('ReviewRequestDraft', 'depends_on', initial=None,\n null=False)]\n", "step-3": "f...
[ 0, 1, 2, 3 ]
""" Copyright (c) Facebook, Inc. and its affiliates. """ # fmt: off """ Every template contains an ordered list of TemplateObjects. TemplateObject is defined in template_objects.py GetMemory templates are written for filters and have an answer_type They represent the action of fetching from the memory using the filte...
normal
{ "blob_id": "ceb714e949a72f621aec8b8728fbd1201e22afd1", "index": 8705, "step-1": "<mask token>\n", "step-2": "<mask token>\nANSWER_WITH_CORRECTION = [[[Human, What, Is, BlockObjectThis], [\n HumanReplace, The, AbstractDescription, BlockObjectLocation]], [[Human,\n What, Is, BlockObjectThis, AbstractDescr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> savecaptcha.write(b64cap[0]) savecaptcha.close() <|reserved_special_token_0|> f.close() <|reserved_special_token_0|> fincapfile.close() <|reserved_special_token_1|> <|reserved_special_token_0|> gInfo = {'obj': g2.go(capUrl), 'H...
flexible
{ "blob_id": "2a5f69fbb26bd1f94c10ff0da687391bf5bd3c23", "index": 6054, "step-1": "<mask token>\n", "step-2": "<mask token>\nsavecaptcha.write(b64cap[0])\nsavecaptcha.close()\n<mask token>\nf.close()\n<mask token>\nfincapfile.close()\n", "step-3": "<mask token>\ngInfo = {'obj': g2.go(capUrl), 'Headers-C-T': g...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def to_rna(str): strtrans = maketrans('ACGT', 'UGCA') return str.translate(strtrans) <|reserved_special_token_1|> from string import maketrans def to_rna(str): strtrans = maketrans('ACGT', 'UGCA') return str...
flexible
{ "blob_id": "aace7bc6684f4a9cec2f8fe270b5123a375780af", "index": 8059, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef to_rna(str):\n strtrans = maketrans('ACGT', 'UGCA')\n return str.translate(strtrans)\n", "step-3": "from string import maketrans\n\n\ndef to_rna(str):\n strtrans = make...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> from .advection_flux_2d import gen_advection_flux_conservative_eno3_pyst_kernel_2d from .advection_timestep_2d import gen_advection_timestep_euler_forward_conservative_eno3_pyst_kernel_2d from .brinkmann_penalise_2d import gen_bri...
flexible
{ "blob_id": "2dddee735e23e8cdb7df83f47f63926727cf8963", "index": 2731, "step-1": "<mask token>\n", "step-2": "<mask token>\nfrom .advection_flux_2d import gen_advection_flux_conservative_eno3_pyst_kernel_2d\nfrom .advection_timestep_2d import gen_advection_timestep_euler_forward_conservative_eno3_pyst_kernel_2...
[ 0, 1, 2 ]
import sqlite3 class announcement: def __init__(eps_df, revenue_df): conn = sqlite3.connect("earnings.db", timeout=120) cur = conn.cursor() symbol_href = self.driver.find_element_by_class_name("lfkTWp") symbol = symbol_href.text eps_history_df = pd.read_sql( '...
normal
{ "blob_id": "b7738c27e11e9566d90157717633312031cdffd6", "index": 818, "step-1": "<mask token>\n\n\nclass announcement:\n\n def __init__(eps_df, revenue_df):\n conn = sqlite3.connect('earnings.db', timeout=120)\n cur = conn.cursor()\n symbol_href = self.driver.find_element_by_class_name('l...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> async def query(request): filters = [] if 'filters' not in request.query: raise web.HTTPBadRequest(reason='Query parameter `filters` is required' ) try: _filters = ujson.loads(request.quer...
flexible
{ "blob_id": "c414e5d3934f741540fb5721a529b48f95e17016", "index": 5982, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def query(request):\n filters = []\n if 'filters' not in request.query:\n raise web.HTTPBadRequest(reason='Query parameter `filters` is required'\n )\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class StackingModelTester: def __init__(self, **kwargs): self.__use_bias = kwargs['use_bias'] self.__use_peepholes = kwargs['use_peepholes'] self.__input_size = kwargs['input_size'] self.__output_size = kwargs['output_size'] self.__binary_train...
flexible
{ "blob_id": "3b7839347f24d39904d29d40e688a5dfd63534d7", "index": 3560, "step-1": "<mask token>\n\n\nclass StackingModelTester:\n\n def __init__(self, **kwargs):\n self.__use_bias = kwargs['use_bias']\n self.__use_peepholes = kwargs['use_peepholes']\n self.__input_size = kwargs['input_size...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in open('9.in'): if line: processing_pattern = False new_line = '' for idx, char in enumerate(line): pattern_found = False if line[idx] == '(' and line[idx + 1].isnumeri...
flexible
{ "blob_id": "3605f46da25eb98767ca8d7248beaa07572d3171", "index": 644, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in open('9.in'):\n if line:\n processing_pattern = False\n new_line = ''\n for idx, char in enumerate(line):\n pattern_found = False\n ...
[ 0, 1, 2 ]
def calcula_norma(x): lista=[] for e in x: lista.append(e**2) v=(sum(lista)**(1/2)) return v
normal
{ "blob_id": "7346992d69250240207a0fc981d0adc245e69f87", "index": 5206, "step-1": "<mask token>\n", "step-2": "def calcula_norma(x):\n lista = []\n for e in x:\n lista.append(e ** 2)\n v = sum(lista) ** (1 / 2)\n return v\n", "step-3": "def calcula_norma(x):\n lista=[]\n for e in x:\n...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Post(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class SurveyHistory(models.Model): post = models.ForeignKey...
flexible
{ "blob_id": "25ce31aee44c80ce4a5c1af7d1ca12c73c14df47", "index": 5530, "step-1": "<mask token>\n\n\nclass Post(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SurveyHistory(models.Model):\n post = models.ForeignKey(to=Post, ...
[ 4, 5, 6, 7, 8 ]
""" Tests for `sqlalchemy-cql` module. """ import pytest from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey metadata = MetaData() users = Table('users', metadata, Column('id', Integer, primary_key=True), Column('name', String), Column('fullname...
normal
{ "blob_id": "f5b18673dd5a3ba3070c07e88ae83a531669311a", "index": 2139, "step-1": "<mask token>\n\n\ndef test_create_all():\n eng = create_engine('cql://user:password@localhost:49154/system')\n metadata.create_all(eng)\n", "step-2": "<mask token>\n\n\ndef test_create_engine():\n eng = create_engine('cq...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Iapp1Config(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Iapp1Config(AppConfig): name = 'iapp1' <|reserved_special_token_1|> from django.apps impo...
flexible
{ "blob_id": "c27ca6a8c38f2b96011e3a09da073ccc0e5a1467", "index": 3386, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Iapp1Config(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Iapp1Config(AppConfig):\n name = 'iapp1'\n", "step-4": "from django.apps import AppConfig...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # pymd2mc.xyzfile """ """ __author__ = 'Mateusz Lis' __version__= '0.1' from optparse import OptionParser import sys from time import time from constants import R, T from energyCalc import EnergyCalculator from latticeProjector import LatticeProjectorSimple from lattices import HexLattice from ...
normal
{ "blob_id": "a325feba1c2bb588321429a045133d6eede9e8cf", "index": 9350, "step-1": "#!/usr/bin/python\n# pymd2mc.xyzfile\n\"\"\"\n\n\"\"\"\n\n__author__ = 'Mateusz Lis'\n__version__= '0.1'\n\n\nfrom optparse import OptionParser\nimport sys\nfrom time import time\n\nfrom constants import R, T\nfrom energyCalc imp...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Neverland2Style(Style): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Neverland2Style(Style): background_color = '#121212' st...
flexible
{ "blob_id": "9dccc19abb6dac9e9606dc1fd83a227b4da9bf1f", "index": 4047, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Neverland2Style(Style):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Neverland2Style(Style):\n background_color = '#121212'\n styles = {Tok...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def itemexists(name): lx.eval('select.item {%s} set' % name) selected = lx.evalN('item.name ?') return name in selected def lockcamera(): if not itemexists('HDRECam_Grp'): lx.eval('select.drop item') lx.eval('group.create') lx.eval('item.name HDRE...
flexible
{ "blob_id": "78a96020abfd393438c2fce1dfd5fd159a23ca5a", "index": 9666, "step-1": "<mask token>\n\n\ndef itemexists(name):\n lx.eval('select.item {%s} set' % name)\n selected = lx.evalN('item.name ?')\n return name in selected\n\n\ndef lockcamera():\n if not itemexists('HDRECam_Grp'):\n lx.eval...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.system('psfex -dd > config.psfex') if ic.use_backsub: prefix = 'b' else: prefix = '' <|reserved_special_token_0|> f.write('\n') f.write('#############################' + '\n') f.write('##### Scripts for PSFEx #####' + '...
flexible
{ "blob_id": "c23125018a77508dad6fd2cb86ec6d556fbd1019", "index": 90, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('psfex -dd > config.psfex')\nif ic.use_backsub:\n prefix = 'b'\nelse:\n prefix = ''\n<mask token>\nf.write('\\n')\nf.write('#############################' + '\\n')\nf.write(...
[ 0, 1, 2, 3, 4 ]
# Name: BoardingPass.py # Description: Class to create and output a boarding pass # Ver. Writer Date Notes # 1.0 Shuvam Chatterjee 05/22/20 Original from random import randint class BoardingPass: def __init__(self, reservation): self.reservation = reservation s...
normal
{ "blob_id": "a3662b4b9569046e67c39c1002234c1fbd85c650", "index": 8102, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BoardingPass:\n <mask token>\n\n def export(self):\n fileName = 'reservations/data_reservation/boarding_passes'\n file = open(fileName, 'a')\n flights...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @app.route('/') def home_page(): with open('/Users/samfunk/ds/metis/project_mcnulty/stock_page.html', 'r' ) as viz_file: return viz_file.read() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') def home_page()...
flexible
{ "blob_id": "3be1947ead65f8e8a9bf73cc8cae2c7d69d8b756", "index": 1641, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home_page():\n with open('/Users/samfunk/ds/metis/project_mcnulty/stock_page.html', 'r'\n ) as viz_file:\n return viz_file.read()\n\n\n<mask token>\n", "step-2": "<mask toke...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Centering(object): def __init__(self, letter, additional_lattice_points): self.letter = letter self.additional_lattice_points = additional_lattice_points def transform(self, op): additional_ops = [] for point in self.additional_lattice_point...
flexible
{ "blob_id": "88731049227629ed84ff56922d7ac11d4a137984", "index": 5376, "step-1": "<mask token>\n\n\nclass Centering(object):\n\n def __init__(self, letter, additional_lattice_points):\n self.letter = letter\n self.additional_lattice_points = additional_lattice_points\n\n def transform(self, o...
[ 15, 28, 33, 34, 44 ]
<|reserved_special_token_0|> class ResizableConv2d(torch.nn.Module): <|reserved_special_token_0|> def forward(self, x): y = self.conv(x) y = self.conv2(y) y = self.resize(y) y = y + self.resize(self.residual_conv(x)) y = self.activation(y) return y class Acto...
flexible
{ "blob_id": "850310b6c431981a246832e8a6f5417a88587b99", "index": 3151, "step-1": "<mask token>\n\n\nclass ResizableConv2d(torch.nn.Module):\n <mask token>\n\n def forward(self, x):\n y = self.conv(x)\n y = self.conv2(y)\n y = self.resize(y)\n y = y + self.resize(self.residual_co...
[ 10, 11, 12, 14, 16 ]
<|reserved_special_token_0|> class GunicornLogger(Logger): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> logzero.setup_logger(**logger_args) logzero.setup_default_logger(**logger_args) <|reserved_special_token_0|> class GunicornLogger(Logger): def __init__(self, ...
flexible
{ "blob_id": "b8b50ef021c4b25edbab355e1db5d62d3c5a28ad", "index": 7257, "step-1": "<mask token>\n\n\nclass GunicornLogger(Logger):\n <mask token>\n", "step-2": "<mask token>\nlogzero.setup_logger(**logger_args)\nlogzero.setup_default_logger(**logger_args)\n<mask token>\n\n\nclass GunicornLogger(Logger):\n\n ...
[ 1, 3, 4, 5, 6 ]
import pandas class _RegressionModelTable(object): def __init__(self, regression_models, function_to_evaluate_model=None, function_to_select_model=None): if not isinstance(regression_models, list): regression_models = [regression_models] self._check_model_inputs(regression_models, fu...
normal
{ "blob_id": "94264e121bb31a08cbd9766be1ff16173d2838ed", "index": 5331, "step-1": "<mask token>\n\n\nclass _RegressionModelTable(object):\n\n def __init__(self, regression_models, function_to_evaluate_model=None,\n function_to_select_model=None):\n if not isinstance(regression_models, list):\n ...
[ 6, 7, 8, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.include_router(default.router) app.include_router(mane.router) app.include_router(mappings.router) def custom_openapi() ->Dict: """Generate custom fields for OpenAPI response.""" if app.openapi_schema: return...
flexible
{ "blob_id": "c6fa8c33630fc2f7ffb08aace1a260e6805ddfa2", "index": 7670, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.include_router(default.router)\napp.include_router(mane.router)\napp.include_router(mappings.router)\n\n\ndef custom_openapi() ->Dict:\n \"\"\"Generate custom fields for OpenAPI re...
[ 0, 2, 3, 4, 5 ]
""" Every block element test will be automatically wrapped inside `<p></p>\n`. Thats why every block test should include this wrapper tag. """ from io import BytesIO from unittest import TestCase from unittest.mock import patch, Mock import pytest from django.core.files import File from django_dynamic_fixture import ...
normal
{ "blob_id": "e5bf57e7a171f7e42928b78d09dda7593a231cf9", "index": 9841, "step-1": "<mask token>\n\n\n@pytest.mark.django_db\nclass TestImage(TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def setUp(self):\n file1 = File(name='file1.jpg', file=BytesIO(b'abcdef'))\n attachment...
[ 2, 3, 4, 5, 6 ]
SPACE = 0 MARK = 1 def frame_to_bit_chunks(frame_values, baud_rate=45.45, start_bit=SPACE, stop_bit=MARK): """フレームごとの信号強度からデータビットのまとまりに変換する""" binary_values = frame_to_binary_values(frame_values) bit_duration_values = binary_values_to_bit_duration(binary_values) bit_values = bit_duration_to_bit_value...
normal
{ "blob_id": "ff67ef77958e78335dc1dc2c7e08bf42998387c6", "index": 2374, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef binary_values_to_bit_duration(binary_values):\n \"\"\"連続する0/1の長さを測る\"\"\"\n previous_binary_value = SPACE\n previous_time = 0\n current_binary_value = SPACE\n curre...
[ 0, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Player: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @property def right(self): return self.pos.sub(Vector(Player.RADI...
flexible
{ "blob_id": "04b02931b749ad06a512b78ca5661ae1f5cb8a9c", "index": 5534, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Player:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def right(self):\n return self.pos.sub(Vector(Player.RADIUS, 0))\n\n...
[ 0, 8, 9, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while i <= lowerlimit: print(i, '*', tablenumber, '=', i * tablenumber) i = i + 1 print('=======================================================') <|reserved_special_token_0|> for foreachnumber in range(upperlimit, lowerli...
flexible
{ "blob_id": "e2c69191d81724cac44bebba3111a773e408b7c8", "index": 639, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile i <= lowerlimit:\n print(i, '*', tablenumber, '=', i * tablenumber)\n i = i + 1\nprint('=======================================================')\n<mask token>\nfor foreachnumb...
[ 0, 1, 2, 3 ]
import numpy as np from sklearn.naive_bayes import BernoulliNB X = np.array([[1, 2, 3, 3], [1, 3, 4, 4], [2, 4, 5, 5]]) y = np.array([1, 2, 3]) """ alpha: 平滑系数 binarize: 将特征二值化的阈值 fit_prior: 使用数据拟合先验概率 """ clf = BernoulliNB(alpha=2.0, binarize=3.0, fit_prior=True) clf.fit(X, y) print("class_prior:", clf.class_prior) ...
normal
{ "blob_id": "98a1fab8cee91f37ceee2cfd868d3a5756a055b0", "index": 7628, "step-1": "<mask token>\n", "step-2": "<mask token>\nclf.fit(X, y)\nprint('class_prior:', clf.class_prior)\nprint('class_count_:', clf.class_count_)\nprint('class_log_prior_:', clf.class_log_prior_)\nprint('feature_count_:', clf.feature_cou...
[ 0, 1, 2, 3, 4 ]
import cv2 import pdb import skvideo import numpy as np import pandas as pd from tqdm import tqdm from harp import fdops from word2number import w2n from harp.vid import VidReader class RegPropData: """ Processes region proposal data. """ _df = None props = None """Dictionary containing regio...
normal
{ "blob_id": "b10badc172be119be5b2ab8ccc32cc95a0ed1e7a", "index": 2680, "step-1": "<mask token>\n\n\nclass RegPropData:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, csv_path):\n \"\"\"\n Initialize a region proposal data instance.\n\n Param...
[ 5, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('\n') if BMI < 18.5: print(Name, ', your BMI calculation is ', format(BMI, '.1f'), ', which indicates your weight category is underweight.', sep='') elif BMI < 24.9: print(Name, ', your BMI calculation is ', ...
flexible
{ "blob_id": "8b009451e9f65ef12e5db1321a9d5347ef7fd756", "index": 9593, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('\\n')\nif BMI < 18.5:\n print(Name, ', your BMI calculation is ', format(BMI, '.1f'),\n ', which indicates your weight category is underweight.', sep='')\nelif BMI < 24.9...
[ 0, 1, 2, 3 ]
import datetime from threading import Thread import cv2 class WebcamVideoStream: #Constructor def __init__(self, src=0): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.read() # initialize the v...
normal
{ "blob_id": "8a4fe88bfa39eeeda42198260a1b22621c33183e", "index": 7894, "step-1": "<mask token>\n\n\nclass WebcamVideoStream:\n <mask token>\n\n def start(self):\n Thread(target=self.update, args=()).start()\n return self\n\n def update(self):\n while True:\n if self.stopp...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_colorization_net(): model_cfg = dict(type='ColorizationNet', input_nc=4, output_nc=2, norm_type='batch') model = MODELS.build(model_cfg) assert model.__class__.__name__ == 'ColorizationNet' input...
flexible
{ "blob_id": "94be205e516c1f1248b6028419c04c927236596e", "index": 618, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_colorization_net():\n model_cfg = dict(type='ColorizationNet', input_nc=4, output_nc=2,\n norm_type='batch')\n model = MODELS.build(model_cfg)\n assert model._...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def is_balanced(tree_root): if tree_root is None: return True nodeQ = [(tree_root, 0)] depths = [] while len(nodeQ): last_node, depth = nodeQ.pop() if not last_node.left and not last_node.right: if depth not...
flexible
{ "blob_id": "833c8234d829dfa1937392f0ad4952aeffa4e26d", "index": 1150, "step-1": "<mask token>\n", "step-2": "def is_balanced(tree_root):\n if tree_root is None:\n return True\n nodeQ = [(tree_root, 0)]\n depths = []\n while len(nodeQ):\n last_node, depth = nodeQ.pop()\n if not...
[ 0, 1, 2 ]
from multiprocessing import Process, Pipe from time import sleep from os import getpid def ponger(pipe, response): while True: msg = pipe.recv() print(f"{getpid()} receiving: {msg}") sleep(1) pipe.send(response) if __name__ == '__main__': ping_conn, pong_conn = Pipe() Pr...
normal
{ "blob_id": "aac9960dafc9e8d3a5670251fcc54eb8e34d4458", "index": 9282, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef ponger(pipe, response):\n while True:\n msg = pipe.recv()\n print(f'{getpid()} receiving: {msg}')\n sleep(1)\n pipe.send(response)\n\n\n<mask token>...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from urllib.request import urlopen from bs4 import BeautifulSoup <|reserved_special_token_1|> #!/C:\Program Files (x86)\Python35-32 #importar librarias necesarias from urllib.request import urlopen from bs4 import BeautifulSoup
flexible
{ "blob_id": "7a59c8c883a9aaa723175783e01aa62e23503fde", "index": 376, "step-1": "<mask token>\n", "step-2": "from urllib.request import urlopen\nfrom bs4 import BeautifulSoup\n", "step-3": "#!/C:\\Program Files (x86)\\Python35-32\n\n#importar librarias necesarias\nfrom urllib.request import urlopen\nfrom bs4...
[ 0, 1, 2 ]