code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
a = [3, 4, 2, 3, 5, 8, 23, 32, 35, 34, 4, 6, 9] print("") print("Lesson #2") print("Program start:") for i in a: if i < 9: print(i) print("End")
normal
{ "blob_id": "58f7810e2731721562e3459f92684589dc66862c", "index": 881, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('')\nprint('Lesson #2')\nprint('Program start:')\nfor i in a:\n if i < 9:\n print(i)\nprint('End')\n", "step-3": "a = [3, 4, 2, 3, 5, 8, 23, 32, 35, 34, 4, 6, 9]\nprint('...
[ 0, 1, 2, 3 ]
import hashlib import json #import logger import Login.loger as logger #configurations import Configurations.config as config def generate_data(*args): #add data into seperate variables try: station_data = args[0] except KeyError as e: logger.log(log_type=config.log_error,params=e) ...
normal
{ "blob_id": "2a5c6f442e6e6cec6c4663b764c8a9a15aec8c40", "index": 6971, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generate_id(parameter, station_id):\n meta_data = parameter + station_id\n hash_id = hashlib.sha256(config.encryption_key)\n hash_id.update(json.dumps(meta_data).encode()...
[ 0, 1, 2, 3, 4 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "a91d42764fa14111afca4551edd6c889903ed9bd", "index": 8056, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ModelTest(TestCase): def test_expense_form_valid_data(self): form = StudentForm(data={'student_id': 500, 'firstName': 'Emre', 'lastName': 'Tan', 'department': 'Panama', 'mathScore': 100, 'physicsScore': 70, 'chemistryScore': 40, 'biologyScore': 1...
flexible
{ "blob_id": "6dc7c7de972388f3984a1238a2d62e53c60c622e", "index": 6252, "step-1": "<mask token>\n\n\nclass ModelTest(TestCase):\n\n def test_expense_form_valid_data(self):\n form = StudentForm(data={'student_id': 500, 'firstName': 'Emre',\n 'lastName': 'Tan', 'department': 'Panama', 'mathScor...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> INPUT_MINBIAS = '/build/RAWReference/MinBias_RAW_320_STARTUP.root' INPUT_TTBAR = '/build/RAWReference/TTbar_RAW_320_STARTUP.root' puSTARTUP_TTBAR = ( '/build/RAWReference/TTbar_Tauola_PileUp_RAW_320_STARTUP.root') relval = {'step1': {'step': 'GEN-HLT', 't...
flexible
{ "blob_id": "78c9f92349ba834bc64dc84f884638c4316a9ea4", "index": 352, "step-1": "<mask token>\n", "step-2": "INPUT_MINBIAS = '/build/RAWReference/MinBias_RAW_320_STARTUP.root'\nINPUT_TTBAR = '/build/RAWReference/TTbar_RAW_320_STARTUP.root'\npuSTARTUP_TTBAR = (\n '/build/RAWReference/TTbar_Tauola_PileUp_RAW_...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.system('dir ' + org_GIS + '*' + ext + ' /s/d/b >' + org_GIS + 'tempext.txt') <|reserved_special_token_0|> for line in lines: ln = line.rstrip('\n') shutil.copy(ln, outputfolder) file1.close() os.system('del ' + org_GIS ...
flexible
{ "blob_id": "778cf8064fa45e3e25a66f2165dcf6885c72fb8a", "index": 634, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.system('dir ' + org_GIS + '*' + ext + ' /s/d/b >' + org_GIS + 'tempext.txt')\n<mask token>\nfor line in lines:\n ln = line.rstrip('\\n')\n shutil.copy(ln, outputfolder)\nfile1.clo...
[ 0, 1, 2, 3, 4 ]
import os from setuptools import setup from django_spaghetti import __version__ with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( nam...
normal
{ "blob_id": "6e557c2b85031a0038afd6a9987e3417b926218f", "index": 6184, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:\n README = readme.read()\nos.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))\nse...
[ 0, 1, 2, 3 ]
from flask import Flask from flask import render_template from flask import make_response import json from lib import powerswitch app = Flask(__name__) @app.route('/') def hello_world(): return render_template('index.html') @app.route('/on/') def on(): state = powerswitch.on() return json.dumps(state) ...
normal
{ "blob_id": "18d3f58048b7e5d792eb2494ecc62bb158ac7407", "index": 254, "step-1": "<mask token>\n\n\n@app.route('/')\ndef hello_world():\n return render_template('index.html')\n\n\n<mask token>\n\n\n@app.route('/off/')\ndef off():\n state = powerswitch.off()\n return json.dumps(state)\n\n\n@app.route('/to...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Response: <|reserved_special_token_0|> <|reserved_special_token_0|> def chain_size(self): server_chain_size = self.node.get_ledger_size() self.return_response(1, server_chain_size) def chain_sync(self): u = Utils() blocks = [u.dict_t...
flexible
{ "blob_id": "55b8590410bfe8f12ce3b52710238a79d27189a7", "index": 5125, "step-1": "<mask token>\n\n\nclass Response:\n <mask token>\n <mask token>\n\n def chain_size(self):\n server_chain_size = self.node.get_ledger_size()\n self.return_response(1, server_chain_size)\n\n def chain_sync(s...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Os valores são \x1b[32m{}\x1b[m e \x1b[31m{}\x1b[m !!!'.format(a, b)) <|reserved_special_token_0|> print('Prazer em te conhecer, {}{}{}!!!'.format(cores['azul'], nome, cores[ 'amarelo'])) <|reserved_special_token_1|> ...
flexible
{ "blob_id": "7bbbd30ba1578c1165ccf5c2fff22609c16dfd64", "index": 393, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Os valores são \\x1b[32m{}\\x1b[m e \\x1b[31m{}\\x1b[m !!!'.format(a, b))\n<mask token>\nprint('Prazer em te conhecer, {}{}{}!!!'.format(cores['azul'], nome, cores[\n 'amarelo'])...
[ 0, 1, 2, 3 ]
# accessing array elements rows/columns import numpy as np a = np.array([[1, 2, 3, 4, 5, 6, 7], [9, 8, 7, 6, 5, 4, 3]]) print(a.shape) # array shape print(a) print('\n') # specific array element [r,c] # item 6 print(a[0][5]) # item 8 print(a[1][1]) # or print(a[1][-6]) # get a specific row/specific column print(a...
normal
{ "blob_id": "8cc97ebe0ff7617eaf31919d40fa6c312d7b6f94", "index": 8814, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a.shape)\nprint(a)\nprint('\\n')\nprint(a[0][5])\nprint(a[1][1])\nprint(a[1][-6])\nprint(a[1])\nprint(a[0])\nprint(a[0, :])\nprint(a[:, 1])\nprint('\\n')\nprint('even numbers from f...
[ 0, 1, 2, 3, 4 ]
import time from wxpy import * bot = Bot(cache_path='wxpy.pkl') def get(i): with open('晚安.txt', 'r', encoding='utf-8') as f: line = f.readlines()[i] return line def send(i): myfriend = bot.friends().search('微信好友昵称')[0] myfriend.send(get(i)) i += 1 def main(): for i in range(3650): ...
normal
{ "blob_id": "a7d11f130e0d5d6c9b4ac7c5d3a804fb9f79b943", "index": 2284, "step-1": "<mask token>\n\n\ndef get(i):\n with open('晚安.txt', 'r', encoding='utf-8') as f:\n line = f.readlines()[i]\n return line\n\n\n<mask token>\n\n\ndef main():\n for i in range(3650):\n send(i)\n time.slee...
[ 2, 4, 5, 6 ]
#!/usr/bin/env python import serial from action import Action import math comm = serial.Serial("/dev/ttyACM3", 115200, timeout=1) #comm = None robot = Action(comm) from flask import Flask from flask import send_from_directory import os static_dir = os.path.join(os.getcwd(), "ControlApp") print "serving from " + sta...
normal
{ "blob_id": "54a6405e3447d488aa4fca88159ccaac2506df2c", "index": 5995, "step-1": "#!/usr/bin/env python\n\nimport serial\nfrom action import Action\nimport math\n\ncomm = serial.Serial(\"/dev/ttyACM3\", 115200, timeout=1)\n#comm = None\nrobot = Action(comm)\n\nfrom flask import Flask\nfrom flask import send_from...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def line_evaluation(param_list, param_eval, file_name='line evaluation', ** kwargs): """ Evaluates a list of parameter pairs across repeated trials and aggregates the result. Parameters ---------- param_...
flexible
{ "blob_id": "d65f858c3ad06226b83d2627f6d38e03eae5b36c", "index": 266, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef line_evaluation(param_list, param_eval, file_name='line evaluation', **\n kwargs):\n \"\"\"\n Evaluates a list of parameter pairs across repeated trials and aggregates the...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # encoding: utf-8 ''' 1D2DCNN抽取特征,LSTM后提取特征,最后将提取的特征进行拼接,CNN与LSTM是交叉在一起的 ''' # 导入相关的包 import keras # 导入相关层的结构 from keras.models import Sequential from keras.layers import Conv1D, Conv2D, MaxPooling1D, MaxPooling2D, Flatten, Dense, Dropout,LSTM,Reshape from keras import Model # 可视化神经网络 from ...
normal
{ "blob_id": "cce1b6f8e4b3f78adfa2243fe49b4994d35c5a38", "index": 9898, "step-1": "<mask token>\n\n\ndef merge_model(model_1, model_2):\n \"\"\"\n keras将两个独立的模型融合起来\n :param model_1:\n :param model_2:\n :return:\n \"\"\"\n inp1 = model_1.input\n inp2 = model_2.input\n r1 = model_1.outpu...
[ 2, 3, 4, 5, 6 ]
# Number Guessing Game import random #assign secrectNumber to random number from range 1-10, inclusive of 10 secrectNumber = random.randint (1, 11) #initialize number or guesses to 1 and call it guess numGuesses = 1 #prompt user to enter their name and enter their guess name = int (input("Enter your name: )) print(...
normal
{ "blob_id": "d2da346e11fa9508cab22a3a2fd3ca57a0a755e6", "index": 5420, "step-1": "# Number Guessing Game\nimport random\n#assign secrectNumber to random number from range 1-10, inclusive of 10\nsecrectNumber = random.randint (1, 11)\n#initialize number or guesses to 1 and call it guess\nnumGuesses = 1\n#prompt ...
[ 0 ]
from aws_cdk import core as cdk # For consistency with other languages, `cdk` is the preferred import name for # the CDK's core module. The following line also imports it as `core` for use # with examples from the CDK Developer's Guide, which are in the process of # being updated to use `cdk`. You may delete this im...
normal
{ "blob_id": "12cd3dbf211b202d25dc6f940156536c9fe3f76f", "index": 3385, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass kdECSDemo(cdk.Stack):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass kdECSDemo(cdk.Stack):\n\n def __init__(self, scope: cdk.Construct, construct_id: str, **kwarg...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> time.sleep(2) def write(i): ser.write(struct.pack('>BBB', 255, 0, i)) write(0) time.sleep(1) <|reserved_special_token_1|> <|reserved_special_token_0|> usbport = '/dev/ttyS3' ser = serial.Serial(usbport, 9600, timeout=1)...
flexible
{ "blob_id": "6c98be473bf4cd458ea8a801f8b1197c9d8a07b3", "index": 3514, "step-1": "<mask token>\n", "step-2": "<mask token>\ntime.sleep(2)\n\n\ndef write(i):\n ser.write(struct.pack('>BBB', 255, 0, i))\n\n\nwrite(0)\ntime.sleep(1)\n", "step-3": "<mask token>\nusbport = '/dev/ttyS3'\nser = serial.Serial(usb...
[ 0, 2, 3, 4, 5 ]
from abc import ABC, abstractmethod class Shape(ABC): # Shape is a child class of ABC @abstractmethod def area(self): pass @abstractmethod def perimeter(self): pass class Square(Shape): def __init__(self, length): self.length = length square = Square(4) # this will co...
normal
{ "blob_id": "520b9246c3c617b18ca57f31ff51051cc3ff51ca", "index": 5517, "step-1": "<mask token>\n\n\nclass Shape(ABC):\n\n @abstractmethod\n def area(self):\n pass\n <mask token>\n\n\nclass Square(Shape):\n\n def __init__(self, length):\n self.length = length\n\n\n<mask token>\n", "ste...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> get_train_data(sys.argv[1], sys.argv[2]) <|reserved_special_token_1|> from Classify import get_train_data import sys <|reserved_special_token_0|> get_train_data(sys.argv[1], sys.argv[2]) <|reserved_special_token_1|> #-*-codi...
flexible
{ "blob_id": "513aff6cf29bbce55e2382943767a9a21df2e98e", "index": 5080, "step-1": "<mask token>\n", "step-2": "<mask token>\nget_train_data(sys.argv[1], sys.argv[2])\n", "step-3": "from Classify import get_train_data\nimport sys\n<mask token>\nget_train_data(sys.argv[1], sys.argv[2])\n", "step-4": "#-*-codi...
[ 0, 1, 2, 3 ]
import os import json from page import Page from random import choice from os.path import join, expanduser from file_handler import f_read, f_readlines, open_local import config class LetterPage(Page): def __init__(self, page_num,n): super(LetterPage, self).__init__(page_num) self.title = "Letters"...
normal
{ "blob_id": "e714fe0e27ec9ea5acb3120a4d2114d3d7674fcf", "index": 5601, "step-1": "<mask token>\n\n\nclass LetterPage(Page):\n\n def __init__(self, page_num, n):\n super(LetterPage, self).__init__(page_num)\n self.title = 'Letters'\n self.in_index = False\n self.n = n\n self....
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def classify(img, c_model): """ classifies images in a given folder using the 'model'""" im_size = 128 img = cv2.resize(img, (im_size, im_size)) img = img.astype('float') / 255.0 img = np.expand_dims(img, axi...
flexible
{ "blob_id": "c7d51f6448400af5630bdc0c29493320af88288e", "index": 7424, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef classify(img, c_model):\n \"\"\" classifies images in a given folder using the 'model'\"\"\"\n im_size = 128\n img = cv2.resize(img, (im_size, im_size))\n img = img.as...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def merge_the_tools(string, k): if len(string) % k != 0: exit() else: L = [] for i in range(0, len(string), k): L.append(''.join(list(dict.fromkeys(string[i:i + k])))) print('\n'.join(L)) <|reserved_specia...
flexible
{ "blob_id": "0004e90622f8b13ec7ce0c1f49e8c8df7ea07269", "index": 7098, "step-1": "<mask token>\n", "step-2": "def merge_the_tools(string, k):\n if len(string) % k != 0:\n exit()\n else:\n L = []\n for i in range(0, len(string), k):\n L.append(''.join(list(dict.fromkeys(str...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def createNewDataFrame(): columns = ['document_id', 'content', 'cat', 'subcat'] df_ = pd.DataFrame(columns=columns) return df_ def getcategories(foldername): cats = foldername.split('_') print('The cats are ', cats, len(cats)) cat = '' sub = '' if len(cat...
flexible
{ "blob_id": "1aa01845ab98005b1fee33b4fc153bb029e450e0", "index": 2061, "step-1": "<mask token>\n\n\ndef createNewDataFrame():\n columns = ['document_id', 'content', 'cat', 'subcat']\n df_ = pd.DataFrame(columns=columns)\n return df_\n\n\ndef getcategories(foldername):\n cats = foldername.split('_')\n...
[ 2, 3, 4, 5, 6 ]
import sys import numpy as np #################################################################################################### ### These functions all perform QA checks on input files. ### These should catch many errors, but is not exhaustive. #####################################################################...
normal
{ "blob_id": "7413c06a990894c34ee5174d84f0e3bd20abf51f", "index": 3294, "step-1": "<mask token>\n\n\ndef check_controls(subpuc_names, subpuc_controls):\n if len(subpuc_names) == len(subpuc_controls):\n pass\n else:\n sys.exit(\n 'There is an issue with your subpuc_controls.csv file....
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class PredictDigitView(MethodView): def post(self): repo = ClassifierRepo(CLASSIFIER_STORAGE) service = PredictDigitService(repo) image_data_uri = request.json['image'] prediction = service.handle(image_data_uri) return Response(str(prediction)...
flexible
{ "blob_id": "3ea42e7ad5301314a39bf522280c084342cd18c5", "index": 332, "step-1": "<mask token>\n\n\nclass PredictDigitView(MethodView):\n\n def post(self):\n repo = ClassifierRepo(CLASSIFIER_STORAGE)\n service = PredictDigitService(repo)\n image_data_uri = request.json['image']\n pr...
[ 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def main(): """ main entry point for module execution """ argument_spec = dict(src=dict(type='path'), replace_src=dict(), lines= dict(aliases=['commands'], type='list'), parents=dict(type='list'), before=dict(type='list'), after=di...
flexible
{ "blob_id": "99b5ac74da95dff399c31d58e19bac65e538a34b", "index": 8012, "step-1": "<mask token>\n", "step-2": "def main():\n \"\"\" main entry point for module execution\n \"\"\"\n argument_spec = dict(src=dict(type='path'), replace_src=dict(), lines=\n dict(aliases=['commands'], type='list'), p...
[ 0, 1, 2 ]
import random import csv # 提取随机问,同类组成正例,异类组成负例,正:负=1:3 with open('final_regroup.csv', 'w', newline='') as train: writer = csv.writer(train) with open('final_syn_train.csv', 'r') as zhidao: reader = csv.reader(zhidao) cluster = [] cur = [] stand = '' # 将同一标准问...
normal
{ "blob_id": "3a09cbd71d23b1320af9b8ddcfc65b223e487b21", "index": 1811, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('final_regroup.csv', 'w', newline='') as train:\n writer = csv.writer(train)\n with open('final_syn_train.csv', 'r') as zhidao:\n reader = csv.reader(zhidao)\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': logging.basicConfig(level=logging.INFO) logging.getLogger('crawl').setLevel(logging.INFO) logging.getLogger('elasticsearch').setLevel(logging.ERROR) es = Elasticsearch() crawl.crawl_d...
flexible
{ "blob_id": "21d07c2b80aa00d0c75da342d37195b6829593b6", "index": 1110, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n logging.basicConfig(level=logging.INFO)\n logging.getLogger('crawl').setLevel(logging.INFO)\n logging.getLogger('elasticsearch').setLevel(logging.ERR...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> start() <|reserved_special_token_1|> from adventurelib import * from horror import * from dating import * from popquiz import * from comedy import * from island import * start()
flexible
{ "blob_id": "8a37299154aded37147e1650cbf52a5cdf7d91da", "index": 4225, "step-1": "<mask token>\n", "step-2": "<mask token>\nstart()\n", "step-3": "from adventurelib import *\nfrom horror import *\nfrom dating import *\nfrom popquiz import *\nfrom comedy import *\nfrom island import *\nstart()\n", "step-4":...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for threshold in range(1, 6): rolls = np.random.randint(1, 7, size=10 ** 7) rerolls = np.random.randint(1, 7, size=10 ** 7) avg_roll = np.mean(np.where(rolls <= threshold, rerolls, rolls)) print( f'Rerollin...
flexible
{ "blob_id": "e5d704541acd0f68a7885d7323118e1552e064c9", "index": 6170, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor threshold in range(1, 6):\n rolls = np.random.randint(1, 7, size=10 ** 7)\n rerolls = np.random.randint(1, 7, size=10 ** 7)\n avg_roll = np.mean(np.where(rolls <= threshold, ...
[ 0, 1, 2, 3 ]
from django.contrib import admin # Register your models here. from .models import Participant class ParticipantAdmin(admin.ModelAdmin): fieldsets = [ ("Personal information", {'fields': ['email', 'name', 'institution', 'assistant']}), ("Asistance", {'fields': ['assistant', 'participant_hash']}), ...
normal
{ "blob_id": "c43b899234ffff09225153dcaf097591c7176430", "index": 841, "step-1": "<mask token>\n\n\nclass ParticipantAdmin(admin.ModelAdmin):\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass ParticipantAdmin(admin.ModelAdmin):\n fieldsets = [('Per...
[ 1, 2, 3, 4, 5 ]
import os import subprocess import sys import time # print sys.argv start = time.time() subprocess.call(sys.argv[1:], shell=True) stop = time.time() print "\nTook %.1f seconds" % (stop - start)
normal
{ "blob_id": "530ec3df27cc4c8f0798566f0c66cfbffe510786", "index": 8611, "step-1": "import os\r\nimport subprocess\r\nimport sys\r\nimport time\r\n\r\n# print sys.argv\r\nstart = time.time()\r\nsubprocess.call(sys.argv[1:], shell=True)\r\nstop = time.time()\r\nprint \"\\nTook %.1f seconds\" % (stop - start)\r\n", ...
[ 0 ]
<|reserved_special_token_0|> class ActionWeather(Action): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ActionWeather(Action): <|reserved_special_token_0|> def run(self, dispatcher, tracker, domain): loc = tracke...
flexible
{ "blob_id": "f87d08f3bb6faa237cce8379de3aaaa3270a4a34", "index": 3854, "step-1": "<mask token>\n\n\nclass ActionWeather(Action):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ActionWeather(Action):\n <mask token>\n\n def run(self, dispatcher, tracker, domain):\n loc = ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(5): score = int(input()) if score < 40: score = 40 result += score print(result // 5) <|reserved_special_token_1|> result = 0 for i in range(5): score = int(input()) if score < 40: ...
flexible
{ "blob_id": "4a13a0d7aa2371d7c8963a01b7cc1b93f4110d5e", "index": 5356, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(5):\n score = int(input())\n if score < 40:\n score = 40\n result += score\nprint(result // 5)\n", "step-3": "result = 0\nfor i in range(5):\n score = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def check(request): if not request.user.is_authenticated: return redirect('/auth/login/') else: return redirect('/worker/') def loginpg(request): return render(request, 'registration/login.html') <|reserved_special_token_0|> <|reserved_special_token_1|> ...
flexible
{ "blob_id": "fc2afc99dc754b58c36bc76c723727337851cc3e", "index": 5326, "step-1": "<mask token>\n\n\ndef check(request):\n if not request.user.is_authenticated:\n return redirect('/auth/login/')\n else:\n return redirect('/worker/')\n\n\ndef loginpg(request):\n return render(request, 'regis...
[ 2, 3, 4, 5, 6 ]
__all__ = ['language'] from StringTemplate import *
normal
{ "blob_id": "e70c25ce1d61437aacfe7fad0a51e096e1ce4f5d", "index": 5212, "step-1": "<mask token>\n", "step-2": "__all__ = ['language']\n<mask token>\n", "step-3": "__all__ = ['language']\nfrom StringTemplate import *\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> def generar_numero_aleatorio(): return random.randint(1, 100) def es_el_numero(resp_usuario, resp_correc): return resp_usuario == resp_correc def numero_dado_es_mayor(resp_usuario, resp_correc): return resp_usuario > resp_correc <|reserved_special_token_0|> def el_nume...
flexible
{ "blob_id": "8498ba69e4cc5c5f480644ac20d878fb2a632bee", "index": 5128, "step-1": "<mask token>\n\n\ndef generar_numero_aleatorio():\n return random.randint(1, 100)\n\n\ndef es_el_numero(resp_usuario, resp_correc):\n return resp_usuario == resp_correc\n\n\ndef numero_dado_es_mayor(resp_usuario, resp_correc)...
[ 5, 6, 7, 9, 10 ]
""" Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: root = [1, 2, 2, 3, 4, 4, 3] Output: true 1 / \ 2 2 / \ / \ 3 4 4 3 Example 2: Input: root = [1, 2, 2, None, 3, None, 3] Output: false 1 / ...
normal
{ "blob_id": "9cfbb06df4bc286ff56983d6e843b33e4da6ccf8", "index": 7803, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_symmetric(root):\n\n def helper(left, right):\n if left is None and right is None:\n return True\n elif left and right:\n return helper(l...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in sys.stdin: line = line.strip() twits = line.split() i = 0 while i < len(twits): j = 0 while j < len(twits): if i != j: print('%s%s\t%d' % (twits[i] + ' ', twi...
flexible
{ "blob_id": "e884825325ceb401142cab0618d9d4e70e475cf5", "index": 893, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in sys.stdin:\n line = line.strip()\n twits = line.split()\n i = 0\n while i < len(twits):\n j = 0\n while j < len(twits):\n if i != j:\n ...
[ 0, 1, 2, 3, 4 ]
<|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": "24ed29dfaaf7ce508b2d80740bad1304b291c596", "index": 8466, "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 = [('projects', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with io.open(file_name, 'rb') as image_file: content = image_file.read() <|reserved_special_token_0|> print(response) print(response.safe_search_annotation.adult) for label in response.label_annotations: print(label.descri...
flexible
{ "blob_id": "800573786913ff2fc37845193b5584a0a815533f", "index": 8340, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith io.open(file_name, 'rb') as image_file:\n content = image_file.read()\n<mask token>\nprint(response)\nprint(response.safe_search_annotation.adult)\nfor label in response.label_ann...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render from .. login.models import * def user(request): context = { "users" : User.objects.all(), "user_level" : User.objects.get(id = request.session['user_id']) } return render(request, 'dashboard/user.html', context) def admin(request): context = { ...
normal
{ "blob_id": "3d737d0ee9c3af1f8ebe4c6998ad30fa34f42856", "index": 570, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef user(request):\n context = {'users': User.objects.all(), 'user_level': User.objects.get(\n id=request.session['user_id'])}\n return render(request, 'dashboard/user.htm...
[ 0, 1, 2, 3, 4 ]
class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def twoSum(self, nums, target): d = dict([(nums[i], i) for i in range(len(nums))]) for n in range(len(nums)): dif = target - nums[n] if dif in d an...
flexible
{ "blob_id": "16cc85324b555f0cfec8d577b776b86872578822", "index": 6016, "step-1": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution:\n\n def twoSum(self, nums, target):\n d = dict([(nums[i], i) for i in range(len(nums))])\n for n in range(len(nums)):\n ...
[ 1, 2, 3, 4, 5 ]
'''import math x = 5 print("sqrt of 5 is", math.sqrt(64)) str1 = "bollywood" str2 = 'ody' if str2 in str1: print("String found") else: print("String not found") print(10+20)''' #try: #block of code #except Exception l: #block of code #else: #this code executes if except block is executed try...
normal
{ "blob_id": "c5b40b373953a2375eeca453a65c49bdbb8715f1", "index": 6586, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n fh = open('testfile.txt', 'w')\n fh.write('This is my test file for exception handling! !')\nexcept IOError:\n print(\"Error: can't find file or read data\")\nelse:\n p...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def my_kron(A, B): D = A[..., :, None, :, None] * B[..., None, :, None, :] ds = D.shape newshape = *ds[:-4], ds[-4] * ds[-3], ds[-2] * ds[-1] return D.reshape(newshape) def _identity(x): return x <|reserved_special_token_0|> def sde_fn1(x, _): lam = 0.1 s...
flexible
{ "blob_id": "c5e7fdcbd4a9281597a35a180f2853caac68f811", "index": 7562, "step-1": "<mask token>\n\n\ndef my_kron(A, B):\n D = A[..., :, None, :, None] * B[..., None, :, None, :]\n ds = D.shape\n newshape = *ds[:-4], ds[-4] * ds[-3], ds[-2] * ds[-1]\n return D.reshape(newshape)\n\n\ndef _identity(x):\n...
[ 97, 100, 123, 125, 137 ]
<|reserved_special_token_0|> def daemon(): p = multiprocessing.current_process() print('Starting:', p.name, p.pid) sys.stdout.flush() time.sleep(2) print('Exiting :', p.name, p.pid) sys.stdout.flush() <|reserved_special_token_0|> def main2(): d = multiprocessing.Process(name='daemon_pr...
flexible
{ "blob_id": "9bb6fd6fbe212bdc29e2d1ec37fa6ec6ca9a9469", "index": 1060, "step-1": "<mask token>\n\n\ndef daemon():\n p = multiprocessing.current_process()\n print('Starting:', p.name, p.pid)\n sys.stdout.flush()\n time.sleep(2)\n print('Exiting :', p.name, p.pid)\n sys.stdout.flush()\n\n\n<mask ...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def initialize(): hands_file = open('euler54_poker.txt') hands_string = hands_file.read() tempList = [] newString = hands_string.replace('\n', ' ').replace(' ', '') for i in range(0, len(newString), 2): tempList.append(newString[i:i + 2]) hands_list = [] ...
flexible
{ "blob_id": "a2a3e8d52fd467178460b178c5dbf9ccd72706e7", "index": 8251, "step-1": "<mask token>\n\n\ndef initialize():\n hands_file = open('euler54_poker.txt')\n hands_string = hands_file.read()\n tempList = []\n newString = hands_string.replace('\\n', ' ').replace(' ', '')\n for i in range(0, len(...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def test_configuration(host): sshd = host.file('/etc/ssh/sshd_config') assert sshd.contains('^PermitRootLogin no$') assert sshd.contains('^X11Forwarding no$') assert sshd.contains('^UsePAM yes$') assert sshd.contains('\\sPermitTTY no$') ssh = host.file('/etc/ssh/ss...
flexible
{ "blob_id": "2345d1f72fb695ccec5af0ed157c0606f197009c", "index": 3398, "step-1": "<mask token>\n\n\ndef test_configuration(host):\n sshd = host.file('/etc/ssh/sshd_config')\n assert sshd.contains('^PermitRootLogin no$')\n assert sshd.contains('^X11Forwarding no$')\n assert sshd.contains('^UsePAM yes$...
[ 1, 2, 3, 4, 5 ]
import pyttsx3 from pydub import AudioSegment engine = pyttsx3.init() # object creation """ RATE""" #printing current voice rate engine.setProperty('rate', 150) # setting up new voice rate rate = engine.getProperty('rate') # getting details of current speaking rate print (rate) ...
normal
{ "blob_id": "32f4f7ad61b99848c907e092c5ed7a839f0b352b", "index": 6399, "step-1": "<mask token>\n", "step-2": "<mask token>\nengine.setProperty('rate', 150)\n<mask token>\nprint(rate)\n<mask token>\nwhile i < l:\n engine.save_to_file(a[i], 'TTS/trump/{}.mp3'.format(str(i)))\n engine.runAndWait()\n if i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('\n\n\n\n') <|reserved_special_token_0|> admin1.describe_user() print('\n') admin1.set_user_name('Reven10') print('\n') admin1.describe_user() admin1.privileges.show_privileges() <|reserved_special_token_1|> <|reserved_sp...
flexible
{ "blob_id": "169ad888e7629faff9509399ac7ead7a149a9602", "index": 543, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('\\n\\n\\n\\n')\n<mask token>\nadmin1.describe_user()\nprint('\\n')\nadmin1.set_user_name('Reven10')\nprint('\\n')\nadmin1.describe_user()\nadmin1.privileges.show_privileges()\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('-' * 40) print('LOJA SUPER BARATÃO') print('-' * 40) while True: produto = str(input('Nome do Produto: ')) preco = float(input('Preço: ')) cont += 1 total += preco if preco > 1000: totmil += 1 ...
flexible
{ "blob_id": "35b24ffa14f8b3c2040d5becc8a35721e86d8b3d", "index": 345, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('-' * 40)\nprint('LOJA SUPER BARATÃO')\nprint('-' * 40)\nwhile True:\n produto = str(input('Nome do Produto: '))\n preco = float(input('Preço: '))\n cont += 1\n total += ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def main(targetsrting): email = '' key = '' target = base64.b64encode(targetsrting.encode('utf-8')).decode('utf-8') url = ( 'https://fofa.so/api/v1/search/all?email={}&key={}&qbase64={}&fields=host,server,title&size=1000' .format(email, key, target)) re...
flexible
{ "blob_id": "5f13866bd5c6d20e8ddc112fb1d1335e3fd46c3e", "index": 1817, "step-1": "<mask token>\n\n\ndef main(targetsrting):\n email = ''\n key = ''\n target = base64.b64encode(targetsrting.encode('utf-8')).decode('utf-8')\n url = (\n 'https://fofa.so/api/v1/search/all?email={}&key={}&qbase64={...
[ 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 ]
#!/usr/bin/env python 3 # -*- coding: utf-8 -*- # # Copyright (c) 2020 PanXu, Inc. All Rights Reserved # """ 测试 label index decoder Authors: PanXu Date: 2020/07/05 15:10:00 """ import pytest import torch from easytext.tests import ASSERT from easytext.data import LabelVocabulary from easytext.modules import Cond...
normal
{ "blob_id": "f64138ee5a64f09deb72b47b86bd7795acddad4d", "index": 9980, "step-1": "<mask token>\n\n\nclass CRFData:\n \"\"\"\n 测试用的 crf 数据\n \"\"\"\n\n def __init__(self):\n bio_labels = [['O', 'I-X', 'B-X', 'I-Y', 'B-Y']]\n self.label_vocabulary = LabelVocabulary(labels=bio_labels, padd...
[ 3, 5, 6, 7, 8 ]
default_app_config = 'teacher.apps.A1Config'
normal
{ "blob_id": "c466c7e05608b1fbba5eea5bec16d301cee3688f", "index": 9817, "step-1": "<mask token>\n", "step-2": "default_app_config = 'teacher.apps.A1Config'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def date_handler(obj): return obj.isoformat() if hasattr(obj, 'isoformat') else obj def run(): parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('--input-base', required=True, help='') parser.add_argument('--output-base', default=...
flexible
{ "blob_id": "2c22f891f30825bcb97987c78a98988ad2a92210", "index": 385, "step-1": "<mask token>\n\n\ndef date_handler(obj):\n return obj.isoformat() if hasattr(obj, 'isoformat') else obj\n\n\ndef run():\n parser = argparse.ArgumentParser(description='Process some integers.')\n parser.add_argument('--input...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_sgd_optimizer(args, model): opimizer = torch.optim.SGD(model.parameters(), lr=args.lr, weight_decay =0.0001) return opimizer <|reserved_special_token_1|> <|reserved_special_token_0|> import torch def...
flexible
{ "blob_id": "5dca187cfe221f31189ca9a9309ece4b9144ac66", "index": 2812, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_sgd_optimizer(args, model):\n opimizer = torch.optim.SGD(model.parameters(), lr=args.lr, weight_decay\n =0.0001)\n return opimizer\n", "step-3": "<mask token>\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SpecValidator: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class SpecValidator: def __init__(self, type=None, default=None, choices=[]...
flexible
{ "blob_id": "4db93bdab2d73e7226dcad61827f5faea8513767", "index": 9888, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass SpecValidator:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass SpecValidator:\n\n def __init__(self, type=None, default=None, choices=[], min=Non...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_lazymap(): data = list(range(10)) lm = LazyMap(data, lambda x: 2 * x) assert len(lm) == 10 assert lm[1] == 2 assert isinstance(lm[1:4], LazyMap) assert lm.append == data.append assert repr(lm...
flexible
{ "blob_id": "3e7d80fdd1adb570934e4b252bc25d5746b4c68e", "index": 3912, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_lazymap():\n data = list(range(10))\n lm = LazyMap(data, lambda x: 2 * x)\n assert len(lm) == 10\n assert lm[1] == 2\n assert isinstance(lm[1:4], LazyMap)\n ...
[ 0, 1, 2, 3 ]
print('SYL_2整型数组_12 合并排序数组')
normal
{ "blob_id": "571636be9d213d19bddfd1d04688bc0955c9eae5", "index": 4427, "step-1": "<mask token>\n", "step-2": "print('SYL_2整型数组_12 合并排序数组')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from eventnotipy import app import json json_data = open('eventnotipy/config.json') data = json.load(json_data) json_data.close() username = data['dbuser'] password = data['password'] host = data['dbhost'] db_name = data['database'] email_host = data['email_host'] email_localhost = data['email_localhost'] sms_host = da...
normal
{ "blob_id": "1f0680c45afb36439c56a1d202537261df5f9afc", "index": 5895, "step-1": "<mask token>\n", "step-2": "<mask token>\njson_data.close()\n<mask token>\n", "step-3": "<mask token>\njson_data = open('eventnotipy/config.json')\ndata = json.load(json_data)\njson_data.close()\nusername = data['dbuser']\npass...
[ 0, 1, 2, 3 ]
from setuptools import setup from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='SumoSound', packages=['SumoSound'], version='1.0.2', license='MIT', description='A pyt...
normal
{ "blob_id": "81c9cabaa611f8e884708d535f0b99ff83ec1c0d", "index": 8319, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:\n long_description = f.read()\nsetup(name='SumoSound', packages=['SumoSound'], version='1.0.2', license=\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> l1: list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print('The original list: ', l1) <|reserved_special_token_0|> while i < len(l1): l1[i] = l1[i] + 100 i = i + 1 print('The modified new list is: ', l1) <|reserved_special_token_0|>...
flexible
{ "blob_id": "6a3fd3323ed8792853afdf5af76161f3e20d4896", "index": 4443, "step-1": "<mask token>\n", "step-2": "<mask token>\nl1: list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nprint('The original list: ', l1)\n<mask token>\nwhile i < len(l1):\n l1[i] = l1[i] + 100\n i = i + 1\nprint('The modified new list is: ',...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def calc_common_prefix_length(lhs_iterable, rhs_iterable, /, *, __eq__=None): if __eq__ is None: __eq__ = operator.__eq__ idx = -1 for a, b, idx in zip(lhs_iterable, rhs_iterable, itertools.count(0)): if not __eq__(a, b): return idx else: ...
flexible
{ "blob_id": "2b73c4e07bba7ed5c89a31ebd45655eaa85dcdcc", "index": 2689, "step-1": "<mask token>\n\n\ndef calc_common_prefix_length(lhs_iterable, rhs_iterable, /, *, __eq__=None):\n if __eq__ is None:\n __eq__ = operator.__eq__\n idx = -1\n for a, b, idx in zip(lhs_iterable, rhs_iterable, itertools...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/python # -*- coding: latin-1 -*- from flask import Flask, render_template app = Flask(__name__) @app.route('/') def index(): return render_template('index.html', titre="Ludovic DELSOL - Portfolio") @app.route('/etude') def etude(): return render_template('etude.html', titre="Portfolio Ludovic DEL...
normal
{ "blob_id": "c7037b6a576374f211580b304f8447349bbbbea3", "index": 9583, "step-1": "<mask token>\n\n\n@app.route('/etude')\ndef etude():\n return render_template('etude.html', titre=\n 'Portfolio Ludovic DELSOL - Etude')\n\n\n@app.route('/experience')\ndef experience():\n return render_template('exper...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def scoring(msg, space, score_func, min_score=0.5, **score_func_params): """ Run the score function over the given message and over a parametric value x. Return all the values x as a FuzzySet (guess) which sc...
flexible
{ "blob_id": "99048ddb3f42382c8b8b435d832a45011a031cf1", "index": 8537, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef scoring(msg, space, score_func, min_score=0.5, **score_func_params):\n \"\"\" Run the score function over the given message and over a parametric\n value x. Return all t...
[ 0, 1, 2, 3 ]
#!/usr/bin/python3 """Locked class module""" class LockedClass: """test class with locked dynamic attruibute creation """ __slots__ = 'first_name'
normal
{ "blob_id": "d90a4b00d97cecf3612915a72e48a363c5dcc97b", "index": 5006, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LockedClass:\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LockedClass:\n <mask token>\n __slots__ = 'first_name'\n", "step-4": "<mask tok...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def downgrade(): op.drop_constraint(None, 'user', type_='unique') op.drop_constraint(None, 'user', type_='unique') op.drop_column('user', 'money') <|reserved_special_token_1|> <|reserved_special_token_0|> def upgrade(): op.add_column('user', sa.Column('money', sa.Inte...
flexible
{ "blob_id": "f727c0551f20fb0dc72b4d81b7b3ed8ce9b1b6f4", "index": 2072, "step-1": "<mask token>\n\n\ndef downgrade():\n op.drop_constraint(None, 'user', type_='unique')\n op.drop_constraint(None, 'user', type_='unique')\n op.drop_column('user', 'money')\n", "step-2": "<mask token>\n\n\ndef upgrade():\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while currentWeight > goalWeight: endDate += datetime.timedelta(days=7) currentWeight -= avgKgPerWeek print(endDate, round(currentWeight, 2)) print(f'Start date: {startDate.month.no}, end date: {endDate} ') print( ...
flexible
{ "blob_id": "7fb568880c40895870a0c541d9a88a8070a79e5b", "index": 5762, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile currentWeight > goalWeight:\n endDate += datetime.timedelta(days=7)\n currentWeight -= avgKgPerWeek\n print(endDate, round(currentWeight, 2))\nprint(f'Start date: {startDat...
[ 0, 1, 2, 3, 4 ]
from django.contrib import admin from .models import Predictions @admin.register(Predictions) class PredictionsAdmin(admin.ModelAdmin): pass
normal
{ "blob_id": "bab78e8a88f9a26cc13fe0c301f82880cee2b680", "index": 965, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@admin.register(Predictions)\nclass PredictionsAdmin(admin.ModelAdmin):\n pass\n", "step-3": "from django.contrib import admin\nfrom .models import Predictions\n\n\n@admin.registe...
[ 0, 1, 2 ]
import time, json, glob, os, enum import serial import threading import responder # 環境によって書き換える変数 isMCUConnected = True # マイコンがUSBポートに接続されているか SERIALPATH_RASPI = '/dev/ttyACM0' # ラズパイのシリアルポート SERIALPATH_WIN = 'COM16' # Windowsのシリアルポート # 各種定数 PIN_SERVO1 = 12 # GPIO12 PWM0 Pin PIN_SERVO2 = 13 # GP...
normal
{ "blob_id": "25532102cc36da139a22a61d226dff613f06ab31", "index": 4714, "step-1": "<mask token>\n\n\nclass Meters:\n <mask token>\n\n def indicate(self, kmh=None, amp=None, led=None):\n if self.pi:\n if kmh != None:\n kmh = SPEED_MAX if kmh > SPEED_MAX else kmh\n ...
[ 8, 11, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(file_name, 'r') as f: stop = 1 while stop != 0: line = f.readline() if len(line) < 1: break tot += float(line) print(tot) <|reserved_special_token_1|> file_name = '013_large...
flexible
{ "blob_id": "bcdf1c03d996520f3d4d8d12ec4ef34ea63ef3cf", "index": 3936, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(file_name, 'r') as f:\n stop = 1\n while stop != 0:\n line = f.readline()\n if len(line) < 1:\n break\n tot += float(line)\nprint(tot)\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class LoginPage(BasePage, LoginPageLocators): def __init__(self, driver=None): super(LoginPage, self).__init__(driver=driver) self.identifier = self.IDENTIFIER <|reserved_special_token_0|> def get_error_messages(self): invalid_user = self.get_text(sel...
flexible
{ "blob_id": "c1bcce809aa073ecd6e64dfa65ead9bd48aee3ff", "index": 7406, "step-1": "<mask token>\n\n\nclass LoginPage(BasePage, LoginPageLocators):\n\n def __init__(self, driver=None):\n super(LoginPage, self).__init__(driver=driver)\n self.identifier = self.IDENTIFIER\n <mask token>\n\n def...
[ 3, 4, 5, 6 ]
import asyncio import secrets import pytest from libp2p.host.ping import ID, PING_LENGTH from libp2p.tools.factories import pair_of_connected_hosts @pytest.mark.asyncio async def test_ping_once(): async with pair_of_connected_hosts() as (host_a, host_b): stream = await host_b.new_stream(host_a.get_id(),...
normal
{ "blob_id": "0233b46da3b9351f110ffc7f8622ca8f9ee9944d", "index": 3000, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.asyncio\nasync def test_ping_once():\n async with pair_of_connected_hosts() as (host_a, host_b):\n stream = await host_b.new_stream(host_a.get_id(), (ID,))\n ...
[ 0, 1, 2, 3, 4 ]
ss = str(input()) print(len(ss) - ss.count(' '))
normal
{ "blob_id": "7f72f6a2ff0c7ceacb0f893d04c20402e850421a", "index": 1840, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(len(ss) - ss.count(' '))\n", "step-3": "ss = str(input())\nprint(len(ss) - ss.count(' '))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import datetime import logging from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional from dagster import check from dagster.core.utils import coerce_valid_log_level, make_new_run_id if TYPE_CHECKING: from dagster.core.events import DagsterEvent DAGSTER_META_KEY = "dagster_meta" class DagsterM...
normal
{ "blob_id": "f900e08c06ae736f5e32ac748e282700f9d0a969", "index": 7922, "step-1": "<mask token>\n\n\nclass DagsterMessageProps(NamedTuple('_DagsterMessageProps', [(\n 'orig_message', Optional[str]), ('log_message_id', Optional[str]), (\n 'log_timestamp', Optional[str]), ('dagster_event', Optional[Any])])):\...
[ 16, 18, 21, 22, 25 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def build_shift_dict(self, shift): """ Creates a dictionary that can be used to apply a cipher to a letter. The dictionary maps every uppercase and lowercase letter to a character shifted down the alphabet by the input shift. The dictionary ...
flexible
{ "blob_id": "07d2da14d0122ad2c8407bb13b8567ca62356bef", "index": 7515, "step-1": "<mask token>\n", "step-2": "def build_shift_dict(self, shift):\n \"\"\"\n Creates a dictionary that can be used to apply a cipher to a letter.\n The dictionary maps every uppercase and lowercase letter to a\n characte...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @api_view(['POST']) @permission_classes((IsAuthenticated,)) def create_account_genre_view(request): title = request.data.get('title', '0') try: genre = Genre.objects.get(title=title) except Genre.DoesNotExist: return Response(status=status.HTTP_404_NOT_FOUND) ...
flexible
{ "blob_id": "ff53a549222b0d5e2fcb518c1e44b656c45ce76e", "index": 5183, "step-1": "<mask token>\n\n\n@api_view(['POST'])\n@permission_classes((IsAuthenticated,))\ndef create_account_genre_view(request):\n title = request.data.get('title', '0')\n try:\n genre = Genre.objects.get(title=title)\n exce...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> flow_data.registerTempTable('flowtab') <|reserved_special_token_0|> df.show(1000) <|reserved_special_token_0|> df.show(1000) <|reserved_special_token_0|> for dstip in dstIPs: sql = ( "select src_address, dst_address, s...
flexible
{ "blob_id": "691075aa5c629e2d0c486ec288cd39bc142cdc7a", "index": 3448, "step-1": "<mask token>\n", "step-2": "<mask token>\nflow_data.registerTempTable('flowtab')\n<mask token>\ndf.show(1000)\n<mask token>\ndf.show(1000)\n<mask token>\nfor dstip in dstIPs:\n sql = (\n \"select src_address, dst_addres...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def datingClassTest(): horatio = 0.1 data, datalabels = KNN_1.filel2matrix('datingTestSet2.txt') normMat = KNN_3.autoNorm(data) ml = normMat.shape[0] numTestset = int(ml * horatio) errorcount = 0 a = ...
flexible
{ "blob_id": "3086f62d4057812fc7fb4e21a18bc7d0ba786865", "index": 2526, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef datingClassTest():\n horatio = 0.1\n data, datalabels = KNN_1.filel2matrix('datingTestSet2.txt')\n normMat = KNN_3.autoNorm(data)\n ml = normMat.shape[0]\n numTests...
[ 0, 2, 3, 4, 5 ]
"""These are views that are used for viewing and editing characters.""" from django.contrib import messages from django.contrib.auth.mixins import UserPassesTestMixin,\ LoginRequiredMixin, PermissionRequiredMixin from django.db import transaction from django.db.models import F from django.http import HttpResponseR...
normal
{ "blob_id": "55ea522b096b189ff67b0da0058af777b0a910e3", "index": 4970, "step-1": "<mask token>\n\n\nclass CharacterDropHeaderView(APIView):\n \"\"\"\n Set of AJAX views for a Characters\n\n This handles different API calls for character actions.\n \"\"\"\n authentication_classes = [SessionAuthenti...
[ 33, 48, 59, 68, 81 ]
<|reserved_special_token_0|> class TestTNSWatcher: <|reserved_special_token_0|> @pytest.mark.xfail(raises=pandas.errors.ParserError) def test_tns_watcher(self): log('Connecting to DB') mongo = Mongo(host=config['database']['host'], port=config[ 'database']['port'], replica_set...
flexible
{ "blob_id": "e7ffa852d16e8e55b4e2b6ab2383561fe359a169", "index": 1778, "step-1": "<mask token>\n\n\nclass TestTNSWatcher:\n <mask token>\n\n @pytest.mark.xfail(raises=pandas.errors.ParserError)\n def test_tns_watcher(self):\n log('Connecting to DB')\n mongo = Mongo(host=config['database'][...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> options.register('file', '', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, 'File path for storing output') options.parseArguments() <|reserved_special_token_0|> process.load('FWCore.Messag...
flexible
{ "blob_id": "6aff61ce5cef537e6b1b19e382d8bf80e3a61693", "index": 1423, "step-1": "<mask token>\n", "step-2": "<mask token>\noptions.register('file', '', VarParsing.VarParsing.multiplicity.singleton,\n VarParsing.VarParsing.varType.string, 'File path for storing output')\noptions.parseArguments()\n<mask toke...
[ 0, 1, 2, 3, 4 ]
class Graph: def __init__(self, num_vertices): self.adj_list = {} for i in range(num_vertices): self.adj_list[i] = [] def add_vertice(self, source): self.adj_list[source] = [] def add_edge(self, source, dest): self.adj_list[source].append(dest) <|reserved_s...
flexible
{ "blob_id": "ae5ec7919b9de4fbf578547c31837add32826f60", "index": 7448, "step-1": "class Graph:\n\n def __init__(self, num_vertices):\n self.adj_list = {}\n for i in range(num_vertices):\n self.adj_list[i] = []\n\n def add_vertice(self, source):\n self.adj_list[source] = []\n...
[ 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': SERVICE = MediathekViewService() SERVICE.init() SERVICE.run() SERVICE.exit() del SERVICE <|reserved_special_token_1|> <|reserved_special_token_0|> from resources.lib.service import...
flexible
{ "blob_id": "e769e930ab8f0356116679bc38a09b83886eb8f6", "index": 4003, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n SERVICE = MediathekViewService()\n SERVICE.init()\n SERVICE.run()\n SERVICE.exit()\n del SERVICE\n", "step-3": "<mask token>\nfrom resources....
[ 0, 1, 2, 3 ]
# coding=utf-8 import sys if len(sys.argv) == 2: filepath = sys.argv[1] pRead = open(filepath,'r')#wordlist.txt pWrite = open("..\\pro\\hmmsdef.mmf",'w') time = 0 for line in pRead: if line != '\n': line = line[0: len(line) - 1] #去除最后的\n if line == "sil ": ...
normal
{ "blob_id": "9bd6da909baeb859153e3833f0f43d8cbcb66200", "index": 9324, "step-1": "# coding=utf-8\nimport sys\nif len(sys.argv) == 2:\n filepath = sys.argv[1]\n pRead = open(filepath,'r')#wordlist.txt\n pWrite = open(\"..\\\\pro\\\\hmmsdef.mmf\",'w')\n time = 0\n for line in pRead:\n if line...
[ 0 ]
<|reserved_special_token_0|> def start(caller): if not caller: return caller.ndb._menutree.points = {'attributes': 20, 'skills': 20} caller.ndb._menutree.character = {'home_planet': None, 'full_name': None, 'origin': None, 'stats': {}, 'age': 16, 'is_psionic': False, 'current_term'...
flexible
{ "blob_id": "99eeb039e1a369e450247d10ba22a1aa0b35dae9", "index": 6875, "step-1": "<mask token>\n\n\ndef start(caller):\n if not caller:\n return\n caller.ndb._menutree.points = {'attributes': 20, 'skills': 20}\n caller.ndb._menutree.character = {'home_planet': None, 'full_name':\n None, 'o...
[ 14, 15, 19, 22, 27 ]
<|reserved_special_token_0|> class SerialTester: def write(self, line): print(line) def read(self, num): return class Antenna: azimuth = initial_az altitude = initial_alt parked = True def set_position(self, az, alt): self.azimuth = az self.altitude = alt ...
flexible
{ "blob_id": "468b5bd8d7b045ca8dd46c76a1829fc499e16950", "index": 5756, "step-1": "<mask token>\n\n\nclass SerialTester:\n\n def write(self, line):\n print(line)\n\n def read(self, num):\n return\n\n\nclass Antenna:\n azimuth = initial_az\n altitude = initial_alt\n parked = True\n\n ...
[ 15, 18, 21, 25, 26 ]
import strawberry as stb from app.crud import cruduser from app.db import get_session @stb.type class Query: @stb.field async def ReadUser(self, info, username: str): ses = await get_session() fields = info.field_nodes[0].selection_set.selections[0] return await cruduser.get_user(ses,...
normal
{ "blob_id": "0992297ffc19b1bc4dc3d5e8a75307009c837032", "index": 5134, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@stb.type\nclass Query:\n\n @stb.field\n async def ReadUser(self, info, username: str):\n ses = await get_session()\n fields = info.field_nodes[0].selection_set.se...
[ 0, 1, 2 ]
""" commands/map.py description: Generates a blank configuration file in the current directory """ from json import dumps from .base_command import BaseCommand class Map(BaseCommand): def run(self): from lib.models import Mapping from lib.models import Migration migration = Migration.load(self.options['MI...
normal
{ "blob_id": "07783921da2fb4ae9452324f833b08b3f92ba294", "index": 546, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Map(BaseCommand):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Map(BaseCommand):\n\n def run(self):\n from lib.models import Mapping\n from lib.mod...
[ 0, 1, 2, 3, 4 ]
from django.contrib.auth import authenticate, login, logout from django.template import loader from django.http import (HttpResponse, JsonResponse, HttpResponseForbidden, HttpResponseBadRequest) from django.shortcuts import redirect from django.views.decorators.http import require_POST import ...
normal
{ "blob_id": "41ca762fe6865613ae4ef2f657f86b516353676f", "index": 9784, "step-1": "<mask token>\n\n\ndef index(request, err_msg=None):\n \"\"\"\n Renders the index page.\n \"\"\"\n template = loader.get_template('aimodel/index.html')\n context = {}\n context['err_msg'] = err_msg\n return Http...
[ 13, 16, 17, 19, 22 ]
<|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_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "a718d82713503c4ce3d94225ff0db04991ad4094", "index": 9744, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('number of lines :' + str(len(read))) while i <= len(read) - 1: counter = counter + read[i].count('\n') + read[i].count(' ') total += len(read[i]) - read[i].count('\n') - read[i].count(' ') i += 1 counter += 1 pr...
flexible
{ "blob_id": "5ad8db85f4f705173cf5d0649af6039ebe1544b2", "index": 7488, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('number of lines :' + str(len(read)))\nwhile i <= len(read) - 1:\n counter = counter + read[i].count('\\n') + read[i].count(' ')\n total += len(read[i]) - read[i].count('\\n')...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class TestIsBalanced(unittest.TestCase): def test_is_balanced(self): self.assertEquals(descending_order(0), 0) self.assertEquals(descending_order(15), 51) self.assertEquals(descending_order(123456789), 987654321) self.assertEquals(descending_order(1201...
flexible
{ "blob_id": "fc5d0dd16b87ab073bf4b054bd2641bdec88e019", "index": 6594, "step-1": "<mask token>\n\n\nclass TestIsBalanced(unittest.TestCase):\n\n def test_is_balanced(self):\n self.assertEquals(descending_order(0), 0)\n self.assertEquals(descending_order(15), 51)\n self.assertEquals(descen...
[ 2, 3, 4, 5 ]
#!/usr/bin/env python3 import operator from functools import reduce import music21 def get_top_line(piece): top_part = piece.parts[0] if len(top_part.voices) > 0: top_part = top_part.voices[0] # replace all chords with top note of chord for item in top_part.notes: if isinstance(item...
normal
{ "blob_id": "92ee66565eb1d0e3cd8fa1ec16747f15e0d92be8", "index": 2885, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_notes(piece):\n part = piece.parts[0]\n measures = filter(lambda x: isinstance(x, music21.stream.Measure), part\n .elements)\n notes = reduce(operator.add, map...
[ 0, 1, 2, 3, 4 ]
from flask import request, Flask import ldap3 app = Flask(__name__) @app.route("/normal") def normal(): """ A RemoteFlowSource is used directly as DN and search filter """ unsafe_dc = request.args['dc'] unsafe_filter = request.args['username'] dn = "dc={}".format(unsafe_dc) search_filte...
normal
{ "blob_id": "b51591de921f6e153c1dd478cec7fad42ff4251a", "index": 749, "step-1": "<mask token>\n\n\n@app.route('/direct')\ndef direct():\n \"\"\"\n A RemoteFlowSource is used directly as DN and search filter using a oneline call to .search\n \"\"\"\n unsafe_dc = request.args['dc']\n unsafe_filter =...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- """ CST 383, measles simulation homework # Here's a question. Suppose 1% of people have measles, that the # test for measles if 98% accurate if you do have measles, and 98% # accurate if you don't have measles. Then what is the probability # that you have measles, given that you have...
normal
{ "blob_id": "076d9f0c14a8070993039bbda2ffe4d52c8d2273", "index": 1512, "step-1": "<mask token>\n\n\ndef t200():\n return np.random.choice(2, 200, p=[0.1, 0.9])\n\n\n<mask token>\n\n\ndef t1000():\n return np.random.choice(2, 1000, p=[0.1, 0.9])\n\n\n<mask token>\n\n\ndef prob_cond_given_pos(prob_cond, prob...
[ 4, 6, 7, 8, 9 ]
class Node: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Node: def __init__(self, val): self.childleft = None self.childright = None self.nodedata = val <|reserved_special_token_0|> def trying(): if message == 'root': ...
flexible
{ "blob_id": "73e4346007acae769b94a55ef53a48a9d3325002", "index": 7262, "step-1": "class Node:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Node:\n\n def __init__(self, val):\n self.childleft = None\n self.childright = None\n self.nodedata = val\n\n\n<mask token>\n\n\ndef try...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class TestMicrophone: <|reserved_special_token_0|> def test_config(self): required_config = ['card_number', 'device_index', 'sample_rate', 'phrase_time_limit', 'energy_threshold'] for config_key in required_config: assert config_key in self...
flexible
{ "blob_id": "164167590051fac3f3fd80c5ed82621ba55c4cc4", "index": 9597, "step-1": "<mask token>\n\n\nclass TestMicrophone:\n <mask token>\n\n def test_config(self):\n required_config = ['card_number', 'device_index', 'sample_rate',\n 'phrase_time_limit', 'energy_threshold']\n for co...
[ 3, 4, 5, 6, 7 ]