code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
from flask import Flask, render_template, request from distance import get_distance app = Flask(__name__) @app.route('/hello') @app.route('/hello/<name>') def hello(name=None): name = "World" if not name else name return "Hello %s" % name @app.route('/') def index(): return render_template('index.html'...
normal
{ "blob_id": "05052e9ccbd076e71e9ec6148887ce7b82ed316d", "index": 6256, "step-1": "<mask token>\n\n\n@app.route('/hello')\n@app.route('/hello/<name>')\ndef hello(name=None):\n name = 'World' if not name else name\n return 'Hello %s' % name\n\n\n@app.route('/')\ndef index():\n return render_template('inde...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def uniquePaths(self, m: int, n: int) ->int: map_: List[List[int]] = [[(0 if i > 0 and j > 0 else 1) for j in ...
flexible
{ "blob_id": "e2a38d38d2ab750cf775ed0fbdb56bc6fc7300c4", "index": 8934, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n\n def uniquePaths(self, m: int, n: int) ->int:\n map_: List[List[int]] = [[(0 if i > 0 and j > 0 e...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def main(): A1, A2, A3 = map(int, input().split()) A = A1 + A2 + A3 if A >= 22: ans = 'bust' else: ans = 'win' print(ans) <|reserved_special_token_0|> <|reserved_special_token_1|> def main(): A1, A2, A3 = map(int, ...
flexible
{ "blob_id": "753e062940e0580d7d33c88c1165977142dcd202", "index": 8060, "step-1": "<mask token>\n", "step-2": "def main():\n A1, A2, A3 = map(int, input().split())\n A = A1 + A2 + A3\n if A >= 22:\n ans = 'bust'\n else:\n ans = 'win'\n print(ans)\n\n\n<mask token>\n", "step-3": "d...
[ 0, 1, 2, 3 ]
import numpy as np import matplotlib.pyplot as plt import math filename = '/home/kolan/mycode/python/dektak/data/t10_1_1_normal.csv' #filename = '/home/kolan/mycode/python/dektak/t10_1_3_normal.csv' #filename = '/home/kolan/mycode/python/dektak/t10_1_6_normal.csv' #filename = '/home/kolan/mycode/python/dektak/t10_1_7...
normal
{ "blob_id": "139d06497a44031f6414980ad54454477e3d0b2c", "index": 4540, "step-1": "import numpy as np \nimport matplotlib.pyplot as plt\nimport math\n\nfilename = '/home/kolan/mycode/python/dektak/data/t10_1_1_normal.csv'\n#filename = '/home/kolan/mycode/python/dektak/t10_1_3_normal.csv'\n#filename = '/home/kolan...
[ 0 ]
<|reserved_special_token_0|> def decode(value): out_value = '' char = [value[i:i + 2] for i in range(0, len(value), 2)] for i in range(0, len(char)): out_value += decoded[encoded.index(char[i])] return out_value <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_...
flexible
{ "blob_id": "23236cd8262eb414666db88215c01d973abf1d97", "index": 1247, "step-1": "<mask token>\n\n\ndef decode(value):\n out_value = ''\n char = [value[i:i + 2] for i in range(0, len(value), 2)]\n for i in range(0, len(char)):\n out_value += decoded[encoded.index(char[i])]\n return out_value\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def exercise_gen(ret_val, times): """Return `ret_value` `times` times. If generator will receive some value from outside, update `ret_value`""" def exercise1(): """Make it pass""" g1 = exercise_gen(42, 3) assert next(g1) == 42 assert g1.send('new val') == 'new va...
flexible
{ "blob_id": "e5979aeb7cff0e2a75966924382bae87aebcfcb2", "index": 3312, "step-1": "<mask token>\n\n\ndef exercise_gen(ret_val, times):\n \"\"\"Return `ret_value` `times` times.\n If generator will receive some value from outside, update `ret_value`\"\"\"\n\n\ndef exercise1():\n \"\"\"Make it pass\"\"\"\n...
[ 2, 4, 6, 9, 10 ]
from random import randrange import random """ both user and computer funcs: """ def check_ok(boat, taken_positions): # input: boat, taken_positions # this func checks if the boat outside the playground or the position of the boat is already in taken_position # return: boat. boat will returned as [-1] or its...
normal
{ "blob_id": "95584dfdb232be7f507dc9d29ed2f1d95fa2b653", "index": 9642, "step-1": "<mask token>\n\n\ndef check_ok(boat, taken_positions):\n boat.sort()\n for i in range(len(boat)):\n if boat[i] in taken_positions:\n boat = [-1]\n break\n elif boat[i] > 99 or boat[i] < 0:\...
[ 7, 10, 11, 12, 16 ]
import os import requests import sqlite3 from models import analytics, jcanalytics def populate(): url = 'https://api.clicky.com/api/stats/4?site_id=100716069&sitekey=93c104e29de28bd9&type=visitors-list' date = '&date=last-30-days' limit = '&limit=all' output = '&output=json' total = url+date+limi...
normal
{ "blob_id": "e8226ab6be5c21335d843cba720e66646a2dee4e", "index": 241, "step-1": "import os\nimport requests\nimport sqlite3\nfrom models import analytics, jcanalytics\n\n\ndef populate():\n url = 'https://api.clicky.com/api/stats/4?site_id=100716069&sitekey=93c104e29de28bd9&type=visitors-list'\n date = '&d...
[ 0 ]
from pet import Pet class Ninja: def __init__(self, first_name, last_name, treats, pet_food, pet): self.first_name = first_name self.last_name = last_name self.treats = treats self.pet_food = pet_food self.pet = pet def walk(self): self.pet.play() def fe...
normal
{ "blob_id": "b210784a198eaa3e57b5a65ec182a746aecc0e2b", "index": 1695, "step-1": "<mask token>\n\n\nclass Ninja:\n\n def __init__(self, first_name, last_name, treats, pet_food, pet):\n self.first_name = first_name\n self.last_name = last_name\n self.treats = treats\n self.pet_food ...
[ 3, 5, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def K_Wilson(w, Tr, Pr): import numpy as np K_value_Output = 1 / Pr * np.exp(5.37 * (1 + w) * (1 - 1 / Tr)) return K_value_Output <|reserved_special_token_1|> def K_Wilson(w, Tr, Pr): # Inserting necessary libraries import numpy...
flexible
{ "blob_id": "0b42f458097d11d66160bcb8e706ccb9b5c4682a", "index": 5744, "step-1": "<mask token>\n", "step-2": "def K_Wilson(w, Tr, Pr):\n import numpy as np\n K_value_Output = 1 / Pr * np.exp(5.37 * (1 + w) * (1 - 1 / Tr))\n return K_value_Output\n", "step-3": "def K_Wilson(w, Tr, Pr):\r\n \r\n ...
[ 0, 1, 2 ]
import sys import math def get_max_sum(arr): max_sum = -math.inf for i in range(1, 5): for j in range(1, 5): temp = arr[i][j] + arr[i - 1][j - 1] + arr[i - 1][j] + arr[i - 1][ j + 1] + arr[i + 1][j + 1] + arr[i + 1][j] + arr[i + 1][j - 1] max_sum = max(max_sum, ...
normal
{ "blob_id": "c99f1333c5ca3221e9932d9a9ba1d95a77924f0d", "index": 351, "step-1": "<mask token>\n\n\ndef get_max_sum(arr):\n max_sum = -math.inf\n for i in range(1, 5):\n for j in range(1, 5):\n temp = arr[i][j] + arr[i - 1][j - 1] + arr[i - 1][j] + arr[i - 1][\n j + 1] + arr...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BaseMyAdminView(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class GlobalSettings(object): """ site_title 左上角名称 site_footer 底部名称 menu_style 更改左边样式 """ site_title = '学习网后台管理系统' site_footer = ...
flexible
{ "blob_id": "d7b830890400203ee45c9ec59611c0b20ab6bfc7", "index": 8496, "step-1": "<mask token>\n\n\nclass BaseMyAdminView(object):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass GlobalSettings(object):\n \"\"\"\n site_title 左上角名称\n site_footer 底部名称\n menu_style 更改左边样式\n \"\"\"\n ...
[ 8, 10, 11, 12, 13 ]
<|reserved_special_token_0|> def main(lista, getnum): password = '' for i in range(0, getnum): passchar = random.choice(lista) password = password + passchar print(password) passwordagain() def passwordagain(): again = input('Do you want to generate another password(y/n)?: ') ...
flexible
{ "blob_id": "c40bb410ad68808c2e0cc636820ec6a2ec2739b8", "index": 4053, "step-1": "<mask token>\n\n\ndef main(lista, getnum):\n password = ''\n for i in range(0, getnum):\n passchar = random.choice(lista)\n password = password + passchar\n print(password)\n passwordagain()\n\n\ndef passw...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import seaborn as sb import matplotlib as mp data = pd.read_csv("/Users/stevenbaez/Desktop/train.csv") # In[2]: data.head() # In[3]: subset = data[['Survived','Age', 'Sex']] # In[5]: import numpy as np import matplotli...
normal
{ "blob_id": "41006ff35299aa72b69c6dc1c71a45b44dca7d6c", "index": 1184, "step-1": "<mask token>\n", "step-2": "<mask token>\ndata.head()\n<mask token>\nsb.catplot(x='Age', y='Sex', hue='Survived', col='Embarked', notch=False,\n palette='Set2', data=data, kind='box', height=4, aspect=0.7)\nsb.catplot(x='Age',...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class classifier(nn.Module): <|reserved_special_token_0|> <|reserved_special_token_0|> class AT_LSTM(nn.Module): def __init__(self, embedding_dim, aspect_embedding_dim, hidden_dim, output_dim, n_layers, embed_weights, at=True, ae=False, dropout=0): super()._...
flexible
{ "blob_id": "4692b2d19f64b3b4bd10c5eadd22a4b5a2f2ef37", "index": 3923, "step-1": "<mask token>\n\n\nclass classifier(nn.Module):\n <mask token>\n <mask token>\n\n\nclass AT_LSTM(nn.Module):\n\n def __init__(self, embedding_dim, aspect_embedding_dim, hidden_dim,\n output_dim, n_layers, embed_weigh...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> s.connect((RHOST, RPORT)) <|reserved_special_token_0|> shellcode_calc += b'\xba\xd5\x90\xd2}\xdb\xd5\xd9t$' shellcode_calc += b'\xf4X1\xc9\xb161P\x13\x83' shellcode_calc += b"\xe8\xfc\x03P\xdar'\x81\x0c\xf0" shellcode_calc += b'\x...
flexible
{ "blob_id": "280a4e1fb35937bb5a5c604f69337d30a4b956a9", "index": 6302, "step-1": "<mask token>\n", "step-2": "<mask token>\ns.connect((RHOST, RPORT))\n<mask token>\nshellcode_calc += b'\\xba\\xd5\\x90\\xd2}\\xdb\\xd5\\xd9t$'\nshellcode_calc += b'\\xf4X1\\xc9\\xb161P\\x13\\x83'\nshellcode_calc += b\"\\xe8\\xfc\...
[ 0, 1, 2, 3, 4 ]
import json import os import numpy as np import pandas as pd import py4design.py2radiance as py2radiance import py4design.py3dmodel.calculate as calculate from py4design import py3dmodel __author__ = "Jimeno A. Fonseca" __copyright__ = "Copyright 2017, Architecture and Building Systems - ETH Zurich" __credits__ = ["J...
normal
{ "blob_id": "164b0afde225119a8fbd4ccfccbbbc3550aa75fe", "index": 2634, "step-1": "<mask token>\n\n\ndef create_sensor_input_file(rad, chunk_n):\n sensor_file_path = os.path.join(rad.data_folder_path, 'points_' + str(\n chunk_n) + '.pts')\n sensor_file = open(sensor_file_path, 'w')\n sensor_pts_da...
[ 6, 7, 9, 10, 11 ]
<|reserved_special_token_0|> class ModelBase: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, schema): self.schema = schema <|reserved_special_token_0|> @property def uid(self): return self.schema.uid def refr...
flexible
{ "blob_id": "5917c891d2885f779dc33f189f1a875efbd0c302", "index": 163, "step-1": "<mask token>\n\n\nclass ModelBase:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, schema):\n self.schema = schema\n <mask token>\n\n @property\n def uid(self):\n return self.sc...
[ 6, 8, 9, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(dic['name']) <|reserved_special_token_1|> dic = {'name': 'Eric', 'age': '25'} print(dic['name']) <|reserved_special_token_1|> dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태 print(dic['name'])
flexible
{ "blob_id": "09c3a10230e7d0b3b893ccf236c39fc2dc12b2c6", "index": 1097, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dic['name'])\n", "step-3": "dic = {'name': 'Eric', 'age': '25'}\nprint(dic['name'])\n", "step-4": "dic = {'name': 'Eric', 'age': '25'} # 딕셔너리 형태\n\n\nprint(dic['name'])\n", ...
[ 0, 1, 2, 3 ]
import discord from discord.ext import commands from discord.ext.commands import Bot import asyncio import random import requests import os #Discord Tech Stuff BOT_PREFIX = ("!") client = discord.Client() client = Bot(command_prefix=BOT_PREFIX) #Functions of the Funny Coin @client.command() async def wasitfunny():...
normal
{ "blob_id": "f047afeb6462ab01a8fea1f3c8693608335eb960", "index": 3488, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@client.command()\nasync def wasitfunny():\n possible_responses = [\n 'Per the judgement from the committee of comedy, we have decided that the joke was indeed funny'\n ...
[ 0, 1, 2, 3, 4 ]
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.lines import Line2D np.random.seed(42) n_samples = 5000 MU = np.array([0.5, 1.5]) COV = np.array([[1., 0.7], [0.7, 2.]]) def get_samples(n): return np.random.multivariate_normal(me...
normal
{ "blob_id": "d61b04539295f6b25e7f6589d32f313e3c6df82f", "index": 1180, "step-1": "<mask token>\n\n\nclass BackgroundCheck(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def predict_proba(self, x):\n return self.prob_background(x)\n\n\nclass GaussianEstimation(objec...
[ 8, 10, 12, 13, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def ex(x, y): max = 0 print(x) if x > y else print(y) return max
flexible
{ "blob_id": "4ffc00e9425992bdd8277341d67a0739119a4798", "index": 2773, "step-1": "<mask token>\n", "step-2": "def ex(x, y):\n max = 0\n print(x) if x > y else print(y)\n return max\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> @api.route('/predict') @api.expect(parser) class Predict(Resource): <|reserved_special_token_0|> @api.route('/predict/<string:companyid>/<string:accountid>') @api.expect(parser) class PredictEmployeeByCompany(Resource): @api.marshal_with(modelByEmployee) def get(self, compa...
flexible
{ "blob_id": "c76fd9b196b50e6fcced7e56517c0cd8ab30e24e", "index": 7891, "step-1": "<mask token>\n\n\n@api.route('/predict')\n@api.expect(parser)\nclass Predict(Resource):\n <mask token>\n\n\n@api.route('/predict/<string:companyid>/<string:accountid>')\n@api.expect(parser)\nclass PredictEmployeeByCompany(Resour...
[ 6, 7, 8, 10, 15 ]
from Task2.src.EmailInterpreter import EmailInterpreter import os # Part B: # ------- # Write a child-class of the previously written base class, which # implements the 'split_file' function, simply by treating each line as a # unit (it returns the list of lines). class LineBreaker(EmailInterpreter): def split_file...
normal
{ "blob_id": "1c6077d965f5bc8c03344b53d11851f5cd50bca8", "index": 3346, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LineBreaker(EmailInterpreter):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LineBreaker(EmailInterpreter):\n\n def split_file(self, file_name):\n with op...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def click(): ent_text = ent.get() lab = Label(root, text=ent_text) lab.pack() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ent.pack() def click(): ent_text = ent.get() lab = Label(root, text=ent_text) lab.pack() <|...
flexible
{ "blob_id": "49f1b4c9c6d15b8322b83396c22e1027d241da33", "index": 2311, "step-1": "<mask token>\n\n\ndef click():\n ent_text = ent.get()\n lab = Label(root, text=ent_text)\n lab.pack()\n\n\n<mask token>\n", "step-2": "<mask token>\nent.pack()\n\n\ndef click():\n ent_text = ent.get()\n lab = Label...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def arena_preprocess(frame, M): processed_arena = cv2.warpPerspective(frame, M, (900, 600)) in_corners = np.array([[10, 18], [10, 590], [890, 590], [890, 15]]) h, w = processed_arena.shape[:2] result_mask = np.zeros((h, w), np.uint8) mask = np.zeros((h + 2, w + 2), np....
flexible
{ "blob_id": "228852f960e9343d9f45abdd3204cfab7bb54bc6", "index": 8230, "step-1": "<mask token>\n\n\ndef arena_preprocess(frame, M):\n processed_arena = cv2.warpPerspective(frame, M, (900, 600))\n in_corners = np.array([[10, 18], [10, 590], [890, 590], [890, 15]])\n h, w = processed_arena.shape[:2]\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Reader: <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Reader: def read(self, filePath): """ Reads text file with nodes and returns the result dict wi...
flexible
{ "blob_id": "c796123fbbf3adcde59779a104dcafb30a673a79", "index": 6422, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Reader:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Reader:\n\n def read(self, filePath):\n \"\"\"\n Reads text file with nodes and returns the resul...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging from django.db import transaction from ralph_scrooge.models import ProfitCenter from ralph_scrooge.plugins import plugin_runner ...
normal
{ "blob_id": "d3f52d4713ba4b7b4cd736b26809968e259be63c", "index": 6883, "step-1": "<mask token>\n\n\n@plugin_runner.register(chain='scrooge')\ndef ralph3_profit_center(**kwargs):\n new_pc = total = 0\n for pc in get_from_ralph('profit-centers', logger):\n created = update_profit_center(pc)\n i...
[ 1, 2, 3, 4, 5 ]
# --- Do not remove these libs --- from freqtrade.strategy.interface import IStrategy from typing import Dict, List from functools import reduce from pandas import DataFrame # -------------------------------- import datetime import talib.abstract as ta import freqtrade.vendor.qtpylib.indicators as qtpylib import numpy...
normal
{ "blob_id": "7b047ba110732d1b0a749bcbbaa9b55306ca2071", "index": 6434, "step-1": "<mask token>\n\n\nclass ema(IStrategy):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask ...
[ 2, 4, 5, 6, 7 ]
import easyocr import cv2 import json import numpy as np import os import os.path import glob def convert(o): if isinstance(o, np.generic): return o.item() raise TypeError readers = [ easyocr.Reader(['la', 'en', 'de', 'fr', 'es', 'cs', 'is'], gpu = False), #easyocr.Reader(['ch_tra'], g...
normal
{ "blob_id": "7057b882ca1ce2c08e9ba7add5f115636b9b319e", "index": 8745, "step-1": "<mask token>\n\n\ndef convert(o):\n if isinstance(o, np.generic):\n return o.item()\n raise TypeError\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef convert(o):\n if isinstance(o, np.generic):\n ret...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Please enter your name:') <|reserved_special_token_0|> if user_name in names: print('Hi there, {}!'.format(user_name)) else: print('Who goes there?') <|reserved_special_token_1|> names = ['Mia', 'Francis', 'Eva']...
flexible
{ "blob_id": "59c33383365d10c108253f7b5a210d40718913a2", "index": 9653, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Please enter your name:')\n<mask token>\nif user_name in names:\n print('Hi there, {}!'.format(user_name))\nelse:\n print('Who goes there?')\n", "step-3": "names = ['Mia', ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if LDB_TOKEN == '': raise Exception( 'Please configure your OpenLDBWS token in getDepartureBoardExample!') <|reserved_special_token_0|> def main(stdscr): res = client.service.GetDepartureBoard(numRows=10, crs='NA...
flexible
{ "blob_id": "302634b93725ceb9333e236021cbb64e023ff798", "index": 2135, "step-1": "<mask token>\n", "step-2": "<mask token>\nif LDB_TOKEN == '':\n raise Exception(\n 'Please configure your OpenLDBWS token in getDepartureBoardExample!')\n<mask token>\n\n\ndef main(stdscr):\n res = client.service.Get...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @app.route('/') def index(): return render_template('Main_page.html') @app.route('/prediction.html') def predict(): return render_template('prediction.html') @app.route('/About_us.html') def about_us(): return render_template('About_us.html') @app.route('/Result1.html', ...
flexible
{ "blob_id": "ccfcc5b644d592090786ceb35a85124c9d3275ad", "index": 5719, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return render_template('Main_page.html')\n\n\n@app.route('/prediction.html')\ndef predict():\n return render_template('prediction.html')\n\n\n@app.route('/About_us.html')\ndef...
[ 4, 5, 6, 7, 8 ]
# Tip Calculator # Dan Soloha # 9/12/2019 total = int(input("What was the total your bill came to? ")) print(f"With a total of {total}, you should tip ${int(total + (total * 0.15))}. If the waiter did a really good job, you should tip ${int(total + (total * 0.20))}. ") # Multiplying by 1.x was returning the numb...
normal
{ "blob_id": "45d5c75a993ff50e1a88510bdb16e963403c5356", "index": 8588, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(\n f'With a total of {total}, you should tip ${int(total + total * 0.15)}. If the waiter did a really good job, you should tip ${int(total + total * 0.2)}. '\n )\n", "step-3...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Tue Mar 24 12:16:15 2020 @author: zhangjuefei """ import sys sys.path.append('../..') import numpy as np from sklearn.datasets import fetch_openml from sklearn.preprocessing import OneHotEncoder import matrixslow as ms # 加载MNIST数据集,取一部分样本并归一化 X, y = fetch_openml('mnist_784', v...
normal
{ "blob_id": "63f155f7da958e9b6865007c701f7cf986b0cbac", "index": 7800, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.append('../..')\n<mask token>\nfor epoch in range(60):\n batch_count = 0\n for i in range(len(X)):\n feature = np.mat(X.values[i]).reshape(img_shape)\n label ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ROOT_PATH = os.path.split(os.path.abspath(__name__))[0] DEBUG = True JWT_SECRET_KEY = 'shop' SQLALCHEMY_TRACK_MODIFICATIONS = False user = 'shop' passwd = 'shopadmin' db = 'shopdb' SQLALCHEMY_DATABASE_URI = ( f'mysql+pymysql:/...
flexible
{ "blob_id": "3908d303d0e41677aae332fbdbe9b681bffe5391", "index": 1044, "step-1": "<mask token>\n", "step-2": "<mask token>\nROOT_PATH = os.path.split(os.path.abspath(__name__))[0]\nDEBUG = True\nJWT_SECRET_KEY = 'shop'\nSQLALCHEMY_TRACK_MODIFICATIONS = False\nuser = 'shop'\npasswd = 'shopadmin'\ndb = 'shopdb'\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class abelectronicsiopiBinarySensor(BinarySensorEntity): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, pinname, pin, pull_mode, invert_logic, bus): """Initialize the pin."...
flexible
{ "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|> def delete_pdp(pdp_id): from moon_manager.db_driver import PDPManager PDPManager.delete_pdp('', pdp_id) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def delete_pdp(pdp_id): from moon_manager.db_driver import PDPManager PDPMa...
flexible
{ "blob_id": "af35075eaca9bba3d6bdb73353eaf944869cdede", "index": 799, "step-1": "<mask token>\n\n\ndef delete_pdp(pdp_id):\n from moon_manager.db_driver import PDPManager\n PDPManager.delete_pdp('', pdp_id)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef delete_pdp(pdp_id):\n from moon_manager....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class SearchProblem: """ This class outlines the structure of a search problem, but doesn't implement any of the methods (in object-oriented terminology: an abstract class). You do not need to change anything in this class, ever. """ def getStartState(self): ...
flexible
{ "blob_id": "e7b96c0161e65f3f22f2ad0832fc6d1bb529f150", "index": 9772, "step-1": "<mask token>\n\n\nclass SearchProblem:\n \"\"\"\n This class outlines the structure of a search problem, but doesn't implement\n any of the methods (in object-oriented terminology: an abstract class).\n\n You do not nee...
[ 8, 10, 12, 13, 15 ]
<|reserved_special_token_0|> def _render(resp): response = make_response(jsonify(resp)) return response <|reserved_special_token_0|> def json_detail_render(code, data=[], message=None): if message is None: message = STATUS_CODE.get(code) resp = dict(code=code, message=message, data=data) ...
flexible
{ "blob_id": "a87ab07bb1502a75a7e705cd5c92db829ebdd966", "index": 8689, "step-1": "<mask token>\n\n\ndef _render(resp):\n response = make_response(jsonify(resp))\n return response\n\n\n<mask token>\n\n\ndef json_detail_render(code, data=[], message=None):\n if message is None:\n message = STATUS_C...
[ 2, 3, 5, 6, 7 ]
__version__ = "1.2.0" import hashlib from collections import Counter from re import findall from secrets import choice from string import ascii_letters, ascii_lowercase, ascii_uppercase from string import digits as all_digits from string import punctuation import requests def check_password(password): """Check ...
normal
{ "blob_id": "eafe89de10c4187057b0cc1e0e9772f03a576b0d", "index": 9771, "step-1": "<mask token>\n\n\nclass PasswordGenerator:\n <mask token>\n\n def __init__(self, length, *, uppercase=True, lowercase=True, digits=\n True, special=True):\n self.length = length\n self.uppercase = upperca...
[ 4, 6, 10, 12, 13 ]
from emulator import Emulator from device import Device from devices.compactflash import CompactFlash from devices.mc68681 import MC68681 from musashi import m68k def add_arguments(parser): parser.add_argument('--rom', type=str, help='ROM image') parser.add_argu...
normal
{ "blob_id": "9eef202a42bfc10b2f52d1b9153d664c5046c13f", "index": 1965, "step-1": "<mask token>\n\n\nclass CB030Ticker(Device):\n\n def __init__(self, args, **options):\n super().__init__(args=args, name='CB030Ticker', required_options=[\n 'address'], **options)\n self.size = 4096\n ...
[ 7, 11, 13, 14, 15 ]
class Leg(): __smelly = True def bend_knee(self): print("knee bent") @property def smelly(self): return self.__smelly @smelly.setter def smelly(self,smell): self.__smelly = smell def is_smelly(self): return self.__smelly
normal
{ "blob_id": "a4ecc578a163ee4657a2c9302f79f15c2e4e39de", "index": 672, "step-1": "class Leg:\n <mask token>\n <mask token>\n\n @property\n def smelly(self):\n return self.__smelly\n <mask token>\n\n def is_smelly(self):\n return self.__smelly\n", "step-2": "class Leg:\n <mask ...
[ 3, 4, 5, 6, 7 ]
# terrascript/spotinst/__init__.py import terrascript class spotinst(terrascript.Provider): pass
normal
{ "blob_id": "0ae626df5a471af77f7361bb765b46b861ee8a2c", "index": 7142, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass spotinst(terrascript.Provider):\n pass\n", "step-3": "import terrascript\n\n\nclass spotinst(terrascript.Provider):\n pass\n", "step-4": "# terrascript/spotinst/__init...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def letterCombinations(self, digits): """ :type digits: str :rtype: List[str] """ if not digits: return [...
flexible
{ "blob_id": "aec311cae7cb6cbe3e3a927a133ec20a2d2afbf5", "index": 1312, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def letterCombinations(self, digits):\n \"\"\"\n :type digits: str\n :rtype: List[str]\n \"\"\"\n ...
[ 0, 1, 2 ]
# Алексей Головлев, группа БСБО-07-19 def lucky(ticket): def sum_(number): number = str(number) while len(number) != 6: number = '0' + number x = list(map(int, number)) return sum(x[:3]) == sum(x[3:]) return 'Счастливый' if sum_(ticket) == sum_(lastTicket) else 'Нес...
normal
{ "blob_id": "85ac851e28dba3816f18fefb727001b8e396cc2b", "index": 5278, "step-1": "<mask token>\n", "step-2": "def lucky(ticket):\n\n def sum_(number):\n number = str(number)\n while len(number) != 6:\n number = '0' + number\n x = list(map(int, number))\n return sum(x[:...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class State(object): def __init__(self, i, j, is_cliff=False, is_goal=False): self.i = i self.j = j self.is_cliff = is_cliff self.is_goal = is_goal self.q_values = np.array([0.0, 0.0, 0.0, 0.0]) def __str__(self): return '({}, {})'...
flexible
{ "blob_id": "cb2e800cc2802031847b170a462778e5c0b3c6f9", "index": 40, "step-1": "<mask token>\n\n\nclass State(object):\n\n def __init__(self, i, j, is_cliff=False, is_goal=False):\n self.i = i\n self.j = j\n self.is_cliff = is_cliff\n self.is_goal = is_goal\n self.q_values =...
[ 14, 16, 20, 21, 22 ]
<|reserved_special_token_0|> class web_scrap: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, seed): self.seed = seed self.set_tag() self.set_attr() self.fetch_web(self.seed) self.crawl() def fetch_...
flexible
{ "blob_id": "f26dc3139413c4ed4b04484c095a433e53039cdb", "index": 3028, "step-1": "<mask token>\n\n\nclass web_scrap:\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, seed):\n self.seed = seed\n self.set_tag()\n self.set_attr()\n self.fetch_web(self.seed)...
[ 8, 10, 11, 12, 13 ]
from extras.plugins import PluginConfig from .version import __version__ class QRCodeConfig(PluginConfig): name = 'netbox_qrcode' verbose_name = 'qrcode' description = 'Generate QR codes for the objects' version = __version__ author = 'Nikolay Yuzefovich' author_email = 'mgk.kolek@gmail.com' ...
normal
{ "blob_id": "6306acd1508698687842ba6b55a839743af420cc", "index": 5840, "step-1": "<mask token>\n\n\nclass QRCodeConfig(PluginConfig):\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\n<mask token>\n", "step-2": "...
[ 1, 2, 3, 4, 5 ]
class Violation(object): def __init__(self, line, column, code, message): self.line = line self.column = column self.code = code self.message = message def __str__(self): return self.message def __repr__(self): return 'Violation(line={}, column={}, code="{}...
normal
{ "blob_id": "c513ad6ef12ae7be5d17d8d44787691cbc065207", "index": 9989, "step-1": "class Violation(object):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Violation(object):\n\n def __init__(self, line, column, code, message):\n self.line = line\n self.column = colum...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class State: <|reserved_special_token_0|> def __init__(self, x, y, theta, parent=None, parent_action=None, g= float('inf'), h=float('inf')): self.x = x self.y = y self.theta = theta % (2 * math.pi) self.g = g self.h = h self...
flexible
{ "blob_id": "c8f899958ce19e7e2bf1307a685e65873695f140", "index": 9028, "step-1": "<mask token>\n\n\nclass State:\n <mask token>\n\n def __init__(self, x, y, theta, parent=None, parent_action=None, g=\n float('inf'), h=float('inf')):\n self.x = x\n self.y = y\n self.theta = theta...
[ 8, 9, 10, 11, 12 ]
<|reserved_special_token_0|> def _get_environmentdef(): """ Retreive the EnvironmentDefinition from the fabric env. """ if 'environmentdef' not in env: abort('Environment needs to be configured') environmentdef = env.environmentdef if env.host_string: environmentdef = environme...
flexible
{ "blob_id": "cc019c732003ed72db80a7893096a0bef0f12e47", "index": 4168, "step-1": "<mask token>\n\n\ndef _get_environmentdef():\n \"\"\"\n Retreive the EnvironmentDefinition from the fabric env.\n \"\"\"\n if 'environmentdef' not in env:\n abort('Environment needs to be configured')\n enviro...
[ 5, 6, 7, 8, 9 ]
<|reserved_special_token_0|> class Neural_Network(nn.Module): <|reserved_special_token_0|> def __init__(self, input_size=2, output_size=1, hidden_size=3): super(Neural_Network, self).__init__() self.input_size = input_size self.output_size = output_size self.hidden_size = hidd...
flexible
{ "blob_id": "2d5e7c57f58f189e8d0c7d703c1672ea3586e4ac", "index": 6771, "step-1": "<mask token>\n\n\nclass Neural_Network(nn.Module):\n <mask token>\n\n def __init__(self, input_size=2, output_size=1, hidden_size=3):\n super(Neural_Network, self).__init__()\n self.input_size = input_size\n ...
[ 9, 10, 12, 13, 14 ]
from random import randint, shuffle class Generator: opset = ['+', '-', '*', '/', '²', '√', 'sin', 'cos', 'tan'] @staticmethod def generate(level): """ 根据 level 生成指定等级的算术题 0:小学;1:初中;2:高中 """ """ 生成操作数序列以及二元运算符序列 """ length = randint(0 if lev...
normal
{ "blob_id": "6e3bb17696953256af6d8194128427acebf1daac", "index": 524, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Generator:\n <mask token>\n\n @staticmethod\n def generate(level):\n \"\"\"\n 根据 level 生成指定等级的算术题\n 0:小学;1:初中;2:高中\n \"\"\"\n \"\"\"\n...
[ 0, 2, 3, 4 ]
import os import pytest def get_client(): from apiserver import app, is_caching_enabled app.config['TESTING'] = True app.enable_cache(is_caching_enabled()) return app.test_client() @pytest.fixture def client(): os.environ['FLASK_ENV'] = 'testing' yield get_client() @pytest.fixture def clie...
normal
{ "blob_id": "c0b5a0605bdfcb7cb84211d3ad0d24f78f838cdf", "index": 5421, "step-1": "<mask token>\n\n\n@pytest.fixture\ndef client():\n os.environ['FLASK_ENV'] = 'testing'\n yield get_client()\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef get_client():\n from apiserver import app, is_caching_ena...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> def get_csv_path(): path = input('enter csv path:') if os.path.isfile(path): return path else: print('csv file not exsit,try again:') return get_csv_path() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def...
flexible
{ "blob_id": "857e3e04b99cb346fd89b34c0d14957d65b7ac38", "index": 9566, "step-1": "<mask token>\n\n\ndef get_csv_path():\n path = input('enter csv path:')\n if os.path.isfile(path):\n return path\n else:\n print('csv file not exsit,try again:')\n return get_csv_path()\n\n\n<mask toke...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def usuario(): global usser usser = input('Introduce un usuario : ') if len(usser) < 5 or len(usser) > 15: print('El usuario debe tener entre 5 y 15 caracteres') usuario() elif usser.isalnum() == ...
flexible
{ "blob_id": "ce75c23c6b0862dde797225f53c900b4ebc56428", "index": 514, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef usuario():\n global usser\n usser = input('Introduce un usuario : ')\n if len(usser) < 5 or len(usser) > 15:\n print('El usuario debe tener entre 5 y 15 caracteres'...
[ 0, 1, 2, 3, 4 ]
import dash_table import pandas as pd import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output from dash_oop_components import DashComponent import dash_table import dash_bootstrap_components as dbc from dash.dependencies import Input, Output, State from dash_oo...
normal
{ "blob_id": "485f85ec5e3f38148978453ea5e7f9a54eb310e1", "index": 160, "step-1": "<mask token>\n\n\nclass Table(DashComponent):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Table(DashComponent):\n\n def __init__(self, plot_factory, df, title='...
[ 1, 3, 5, 6, 7 ]
import torch import torch.nn.functional as f import time import matplotlib.pyplot as plt from matplotlib.lines import Line2D import numpy as np dtype = torch.float device = torch.device("cpu") # device = torch.device("cuda:0") # Uncomment this to run on GPU N, D_in, H, D_out = 64, 1000, 100, 10 x = torch.randn(N, D...
normal
{ "blob_id": "0fb424dafaac184882ea56f36265e0b19b5a4c50", "index": 9758, "step-1": "<mask token>\n\n\ndef plot_grad_flow(named_parameters):\n \"\"\"Plots the gradients flowing through different layers in the net during training.\n Can be used for checking for possible gradient vanishing / exploding problems....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def registry_names(): return iter(_registry) <|reserved_special_token_1|> <|reserved_special_token_0|> def registry(name): _registry.append(name) def registry_names(): return iter(_registry) <|reserved_speci...
flexible
{ "blob_id": "51642dbb210600f9ca4e035fb884fbdda030fd04", "index": 1491, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef registry_names():\n return iter(_registry)\n", "step-3": "<mask token>\n\n\ndef registry(name):\n _registry.append(name)\n\n\ndef registry_names():\n return iter(_regis...
[ 0, 1, 2, 3 ]
import time from typing import List from classiclikeiguana.timeout import timeout class ExecutionMetrics: def __init__(self, duration, succeeded: bool, timed_out: bool, lines: int, error: List[str] = None): if error is None: error = list() self.duration = duration self.succeed...
normal
{ "blob_id": "f870c776a62f3b743356c5515cd25e588dbfca15", "index": 8183, "step-1": "<mask token>\n\n\nclass ExecutionMetrics:\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass ExecutionMetrics:\n\n def __init__(self, duration, succeeded: bool, timed_out: bool, lines:...
[ 1, 3, 4, 5, 6 ]
import sqlite3 connection = sqlite3.connect("../db.sqlite3") cursor = connection.cursor() sql_file = open("sample.sql") sql_as_string = sql_file.read() cursor.executescript(sql_as_string) for row in cursor.execute("SELECT * FROM results_states"): print(row)
normal
{ "blob_id": "10a981e35ce00ee8e32a613823d3bc919fafaae8", "index": 8225, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.executescript(sql_as_string)\nfor row in cursor.execute('SELECT * FROM results_states'):\n print(row)\n", "step-3": "<mask token>\nconnection = sqlite3.connect('../db.sqlite3'...
[ 0, 1, 2, 3, 4 ]
import datetime import logging import random import transform import timelapse # merge two iterators producing sorted values def merge(s1, s2): try: x1 = next(s1) except StopIteration: yield from s2 return try: x2 = next(s2) except StopIteration: yield from s1 ...
normal
{ "blob_id": "c651d49c98a4cf457c8252c94c6785dea8e9af60", "index": 3909, "step-1": "<mask token>\n\n\nclass Sliders(timelapse.TimeLapse):\n\n def __init__(self, server_list, nick='Sliders', channel='#sliders',\n realname='Sliders', sliding_window=60, **params):\n super().__init__(server_list, nick...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> model.to(device) <|reserved_special_token_0|> ... for epoch in range(epochs): running_loss = 0 running_acc = 0 train_loss = 0 model.train() for image, label in tqdm(train_dataloader, desc='Epoch [%d/%d]' % ( ...
flexible
{ "blob_id": "c3aee5d822d48c9dc826f8f2f8d4a56e11513b9c", "index": 2882, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.to(device)\n<mask token>\n...\nfor epoch in range(epochs):\n running_loss = 0\n running_acc = 0\n train_loss = 0\n model.train()\n for image, label in tqdm(train_data...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sleeping(): time.sleep(5) print('Ended') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sleeping(): time.sleep(5) print('Ended') Thread(target=sleeping, da...
flexible
{ "blob_id": "628fdf848079d0ecf5bf4f5bd46e07ad6cd10358", "index": 5070, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sleeping():\n time.sleep(5)\n print('Ended')\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef sleeping():\n time.sleep(5)\n print('Ended')\n\n\nThread(target=s...
[ 0, 1, 2, 3 ]
T = int(input()) for cnt in range(1, T + 1): S = input() S_list = [] card = {'S': 13, 'D': 13, 'H': 13, 'C': 13} print('#' + str(cnt), end=' ') for i in range(0, len(S), 3): S_list.append(S[i:i + 3]) if len(set(S_list)) != len(S_list): print('ERROR') else: for i in S_...
normal
{ "blob_id": "45750152313fd3670867c61d0173e4cb11a806ba", "index": 4468, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor cnt in range(1, T + 1):\n S = input()\n S_list = []\n card = {'S': 13, 'D': 13, 'H': 13, 'C': 13}\n print('#' + str(cnt), end=' ')\n for i in range(0, len(S), 3):\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from . import find_resault from . import sql
flexible
{ "blob_id": "6f05d1915cd2e123dd72233b59d4de43fd724035", "index": 7743, "step-1": "<mask token>\n", "step-2": "from . import find_resault\nfrom . import sql\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def draw_text(surf, text, size, x, y): font_name = pygame.font.match_font('OCR A Extended') font = pygame.font.Font(font_name, size) text_surface = font.render(text, True, WHITE) text_rect = text_surface.get_rect() text_rect.midtop = x, y surf.blit(text_surface, te...
flexible
{ "blob_id": "7301a521586049ebb5e8e49b604cc96e3acc1fe9", "index": 3512, "step-1": "<mask token>\n\n\ndef draw_text(surf, text, size, x, y):\n font_name = pygame.font.match_font('OCR A Extended')\n font = pygame.font.Font(font_name, size)\n text_surface = font.render(text, True, WHITE)\n text_rect = te...
[ 3, 4, 5, 6, 7 ]
import collections import re from collections import Counter import operator import pickle import math import json path='C:/Users/rahul/Desktop/CSCI 544/HW 2/op_spam_train/' #path=sys.argv[1] badWordList = ['and','the','was','for'] RE=r'\b[^\W\d_]+\b' # NEGATIVE TWEETS c=collections.Counter() NT="negativeTweets.txt/...
normal
{ "blob_id": "42e16def0fcf234f3d7c2709de36a321d8ddf29e", "index": 7598, "step-1": "import collections\nimport re\nfrom collections import Counter\nimport operator\nimport pickle\nimport math\nimport json\n\npath='C:/Users/rahul/Desktop/CSCI 544/HW 2/op_spam_train/'\n#path=sys.argv[1]\n\nbadWordList = ['and','the'...
[ 0 ]
<|reserved_special_token_0|> class NoViz: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def addfile(self, *a, **kw): pass def addgcode(self, *a, **kw): pass def addgcodehighlight(self, *a, **kw): pass <|reserved_special_to...
flexible
{ "blob_id": "3cc473f6bb4b2e1dd806edb8b096a6118fe7056a", "index": 7202, "step-1": "<mask token>\n\n\nclass NoViz:\n <mask token>\n <mask token>\n <mask token>\n\n def addfile(self, *a, **kw):\n pass\n\n def addgcode(self, *a, **kw):\n pass\n\n def addgcodehighlight(self, *a, **kw):...
[ 9, 10, 11, 15, 16 ]
from . import utils from . import objects START = (0, 0) STARTING_LIFE = 10 WHITE = (255, 255, 255) class RoughLightGame: def __init__(self, game_map, width, height, **kwargs): self.map = game_map self.width = width self.height = height self.objects = kwargs.get('objects', list...
normal
{ "blob_id": "5f089c3e67452fe6d14f96a70d792bc0d056b375", "index": 9227, "step-1": "<mask token>\n\n\nclass RoughLightGame:\n\n def __init__(self, game_map, width, height, **kwargs):\n self.map = game_map\n self.width = width\n self.height = height\n self.objects = kwargs.get('object...
[ 4, 5, 6, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution: def mostCommonWord(self, paragraph, banned): """ ...
flexible
{ "blob_id": "3bb50b61c7a3e98ede0a31e574f39b4ea7f22de5", "index": 9197, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def mostCommonWord(self, paragraph, banned):\n \"\"\"\n :ty...
[ 0, 1, 2, 3, 4 ]
from django.shortcuts import render, redirect from .models import Game, Player, CardsInHand, Feedback from django.db.models import Q from .forms import GameForm, JoinForm, FeedbackForm from django.shortcuts import get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.vie...
normal
{ "blob_id": "d650f578ea30772489625ee26f3e4bf04131964b", "index": 6140, "step-1": "<mask token>\n\n\ndef join_game(request):\n if request.method != 'POST':\n return HttpResponseRedirect('/game')\n form_data = json.loads(request.body.decode('utf-8'))\n form = JoinForm(form_data)\n if form.is_val...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class UserFormView(View): form_class = UserForm template_name = 'shop/signup.html' def get(self, request): form = self.form_class(None) return render(request, self.template_name, {'form': form}) def post(self, request): form = self.form_class(requ...
flexible
{ "blob_id": "1d72a9882aea1e0f808969828ed2e69ecd79ac71", "index": 7522, "step-1": "<mask token>\n\n\nclass UserFormView(View):\n form_class = UserForm\n template_name = 'shop/signup.html'\n\n def get(self, request):\n form = self.form_class(None)\n return render(request, self.template_name,...
[ 4, 6, 8, 9, 10 ]
<|reserved_special_token_0|> class UserService(object): <|reserved_special_token_0|> @staticmethod def get(id): """获取单条记录 [description] Arguments: id int -- 主键 return: User Model 实例 | None """ if not id: raise JsonErro...
flexible
{ "blob_id": "d1ed43bab6171c876b2ad9ef9db834ab8f9026d5", "index": 8411, "step-1": "<mask token>\n\n\nclass UserService(object):\n <mask token>\n\n @staticmethod\n def get(id):\n \"\"\"获取单条记录\n\n [description]\n\n Arguments:\n id int -- 主键\n\n return:\n Us...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> @dataclass class Actions: """ The class for a set of actions. This class is a collection of actions. It is used to for the four primary usecases: - to serialize the list of actions into a dataframe - to serialize the list of actions into a markdown/html table ...
flexible
{ "blob_id": "4d0f612c74dc175766f489580fc4a492e1bfd085", "index": 4345, "step-1": "<mask token>\n\n\n@dataclass\nclass Actions:\n \"\"\" The class for a set of actions.\n\n This class is a collection of actions. It is used to for the four primary\n usecases:\n - to serialize the list of actions in...
[ 10, 13, 19, 23, 25 ]
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-01-13 15:01 import pickle import numpy as np from bert_serving.client import BertClient from pyhanlp import * CharTable = JClass('com.hankcs.hanlp.dictionary.other.CharTable') # bc = BertClient(ip='192.168.1.88') # ip address of the server bc = BertClient(ip='127...
normal
{ "blob_id": "38e167630519b73bffea4ff527bc7b7272a49f1a", "index": 348, "step-1": "<mask token>\n\n\ndef embed_last_token(text):\n result = bc.encode(text, show_tokens=True)\n batch = []\n for sent, tensor, tokens in zip(text, result[0], result[1]):\n valid = []\n tid = 0\n buffer = '...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def get_ports(): ports = serial.tools.list_ports.comports() ports_str = [] for port in ports: ports_str.append(port.device) return ports_str def start(): opt_mode = mode.get() opt_filename = filename.get() opt_port = portname.get() if not opt_mode...
flexible
{ "blob_id": "6455741bbda42b9d84428545ddd50a5d1b54a7ba", "index": 1376, "step-1": "<mask token>\n\n\ndef get_ports():\n ports = serial.tools.list_ports.comports()\n ports_str = []\n for port in ports:\n ports_str.append(port.device)\n return ports_str\n\n\ndef start():\n opt_mode = mode.get(...
[ 2, 4, 5, 6, 7 ]
""" CP1404 Practical unreliable car test """ from unreliable_car import UnreliableCar def main(): good_car = UnreliableCar("good car", 100, 80) bad_car = UnreliableCar("bad car", 100, 10) for i in range(10): print("try to drive {} km".format(i)) print("{:10} drove {:2}km".format(good_car....
normal
{ "blob_id": "f29ad02f3781c7a7d2a1f0c97626dd5c7ea2417e", "index": 7867, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n good_car = UnreliableCar('good car', 100, 80)\n bad_car = UnreliableCar('bad car', 100, 10)\n for i in range(10):\n print('try to drive {} km'.format(i))...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(f'resultado: {resultado} || seu tipo: {type(resultado)}') print('--------------\n') print(f"""Nasca de bacana: {Counter('Nasca de bacana')}""") print('--------------\n') <|reserved_special_token_0|> print(f'ocorrencias de ...
flexible
{ "blob_id": "4989d01f31ca034aacdda28eff56adb2e0bb15da", "index": 1889, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'resultado: {resultado} || seu tipo: {type(resultado)}')\nprint('--------------\\n')\nprint(f\"\"\"Nasca de bacana: \n {Counter('Nasca de bacana')}\"\"\")\nprint('--------------\\n...
[ 0, 1, 2, 3, 4 ]
# Inspiration: [Fake Album Covers](https://fakealbumcovers.com/) from IPython.display import Image as IPythonImage from PIL import Image from PIL import ImageFont from PIL import ImageDraw import requests from xml.etree import ElementTree as ET def display_cover(top,bottom ): name='album_art_raw.png' alb...
normal
{ "blob_id": "07215403750be53994ae36727b6f790202b88697", "index": 253, "step-1": "# Inspiration: [Fake Album Covers](https://fakealbumcovers.com/)\nfrom IPython.display import Image as IPythonImage\nfrom PIL import Image\nfrom PIL import ImageFont\nfrom PIL import ImageDraw\n\nimport requests\nfrom xml.etree impo...
[ 0 ]
<|reserved_special_token_0|> def Viterbi(sentence, q, e): K = list(Count_y.keys()) Pi = {} bp = {} n = len(sentence) for i in range(n + 1): Pi[i - 1] = {} bp[i - 1] = {} Pi[-1]['*', '*'] = 1 for k in range(n): K0 = K K1 = K K2 = K if k == 0: ...
flexible
{ "blob_id": "9683c7df01eda0d97615fb3e8f9496ecc95d1d32", "index": 8494, "step-1": "<mask token>\n\n\ndef Viterbi(sentence, q, e):\n K = list(Count_y.keys())\n Pi = {}\n bp = {}\n n = len(sentence)\n for i in range(n + 1):\n Pi[i - 1] = {}\n bp[i - 1] = {}\n Pi[-1]['*', '*'] = 1\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @api.route('/login/', methods=['POST']) def login(): email = request.get_json().get('email') pwd = request.get_json().get('password') user = User.query.filter_by(email=email).first() if not user: return j...
flexible
{ "blob_id": "a0dbb374f803cb05a35f823f54ef5f14eaf328b2", "index": 3688, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@api.route('/login/', methods=['POST'])\ndef login():\n email = request.get_json().get('email')\n pwd = request.get_json().get('password')\n user = User.query.filter_by(email...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def main(): """ Execute main program """ import argparse parser = argparse.ArgumentParser(description='Check nodes status.') parser.add_argument('-o', '--show-job-owners', action='store_true', help='List jobs running on nodes') parser.add_argument('-s', '--...
flexible
{ "blob_id": "381b59ab9fa85561932a9bfb9ab8cef635901a35", "index": 7249, "step-1": "<mask token>\n\n\ndef main():\n \"\"\" Execute main program\n \"\"\"\n import argparse\n parser = argparse.ArgumentParser(description='Check nodes status.')\n parser.add_argument('-o', '--show-job-owners', action='st...
[ 1, 2, 3, 4, 5 ]
import time # Returns time in seconds for func(arg) to run def time_func(func, arg): start = time.time() func(arg) return time.time() - start
normal
{ "blob_id": "7f406c1cd4d56da3a7d5f8739e0b65b0e61cf637", "index": 5290, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef time_func(func, arg):\n start = time.time()\n func(arg)\n return time.time() - start\n", "step-3": "import time\n\n\ndef time_func(func, arg):\n start = time.time()\...
[ 0, 1, 2, 3 ]
from .gsclient import GSClient from .gspath import GSPath __all__ = [ "GSClient", "GSPath", ]
normal
{ "blob_id": "7b726dd8ebbd5c49f9ce5bddb4779fcfbaaeb479", "index": 5651, "step-1": "<mask token>\n", "step-2": "<mask token>\n__all__ = ['GSClient', 'GSPath']\n", "step-3": "from .gsclient import GSClient\nfrom .gspath import GSPath\n__all__ = ['GSClient', 'GSPath']\n", "step-4": "from .gsclient import GSCli...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': conn = sqlite3.connect('donations.sqlite') c = conn.cursor() query = 'DROP TABLE IF EXISTS factions;' c.execute(query) query = 'DROP TABLE IF EXISTS members;' c.execute(query) ...
flexible
{ "blob_id": "b6b8dfaa9644fa4f4c250358b89f4a30c26c317f", "index": 4788, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n conn = sqlite3.connect('donations.sqlite')\n c = conn.cursor()\n query = 'DROP TABLE IF EXISTS factions;'\n c.execute(query)\n query = 'DROP TA...
[ 0, 1, 2, 3 ]
from ROOT import * gSystem.Load("libAnalysis") import sys import argparse parser = argparse.ArgumentParser(description="Python script to process and merge showers.") group = parser.add_mutually_exclusive_group() group.add_argument("-v", "--verbose", help="Turn on verbose output", action="store_tru...
normal
{ "blob_id": "d57b91bf41f031e3362dabdef8c67a0da04fe577", "index": 7540, "step-1": "from ROOT import *\ngSystem.Load(\"libAnalysis\")\nimport sys\n\nimport argparse\n\nparser = argparse.ArgumentParser(description=\"Python script to process and merge showers.\")\ngroup = parser.add_mutually_exclusive_group()\ngroup...
[ 0 ]
# coding: utf-8 # In[50]: ## Description ## Adds the Fibonacci numbers smaller than 4 million ## Weekly Journal ## When using while True, "break" MUST be used to avoid infinite loops ## Questions ## None fib=[1,2] counter=1 while True: if fib[counter]>4000000: flag=0 break else: f...
normal
{ "blob_id": "e2572b48f7183353ba2aab0500130dc8a71a0b22", "index": 5286, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n if fib[counter] > 4000000:\n flag = 0\n break\n else:\n fib.append(fib[counter] + fib[counter - 1])\n counter += 1\n<mask token>\nprint(tot...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('bob' in adict) print('name' in adict) for key in adict: print('%s:%s' % (key, adict[key])) print('%(name)s:%(age)s' % adict) <|reserved_special_token_1|> adict = {'name': 'bob', 'age': 23} print('bob' in adict) print...
flexible
{ "blob_id": "aa4d872c6a529d8acf18f1c3b477bc1816ac2887", "index": 575, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('bob' in adict)\nprint('name' in adict)\nfor key in adict:\n print('%s:%s' % (key, adict[key]))\nprint('%(name)s:%(age)s' % adict)\n", "step-3": "adict = {'name': 'bob', 'age': ...
[ 0, 1, 2 ]
print("calificacion de los alumnos") lista2_calificaciones=[] for i in range (0,5): lista2_calificaciones.append(int(input(f"ingrese la calificacion corresponfiente al alumno"))) print(lista2_calificaciones) for n in range(0,len(lista2_calificaciones)): if lista2_calificaciones[i] >=0 and lista2_calific...
normal
{ "blob_id": "1cc9c89182f69a5f1eb9a0e7f3433dc30c8d7035", "index": 2938, "step-1": "<mask token>\n", "step-2": "print('calificacion de los alumnos')\n<mask token>\nfor i in range(0, 5):\n lista2_calificaciones.append(int(input(\n f'ingrese la calificacion corresponfiente al alumno')))\n print(lista2...
[ 0, 1, 2, 3 ]
from .server import CanvasServer try: from .jupyter import JupyterCanvas, create_jupyter_canvas HAS_JUPYTER = True except: HAS_JUPYTER = False JupyterCanvas = None # type: ignore def http_server( file: str = None, host: str = "localhost", port: int = 5050 ) -> CanvasServer: """Creates a new...
normal
{ "blob_id": "b11e2837d3ba9c14770b8039186a2175adc41ea1", "index": 283, "step-1": "<mask token>\n\n\ndef http_server(file: str=None, host: str='localhost', port: int=5050\n ) ->CanvasServer:\n \"\"\"Creates a new HTTP server for displaying the network, using WebSockets to\n transmit data. The server will ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('Quotes.txt', 'w') as ff: for q in quote: msg = q.find('span', {'class': 'text'}) print(msg.text) ff.write(msg.text) author = q.find('small', {'class': 'author'}) print(author....
flexible
{ "blob_id": "777c08876a2de803fc95de937d9e921044545ef8", "index": 3674, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('Quotes.txt', 'w') as ff:\n for q in quote:\n msg = q.find('span', {'class': 'text'})\n print(msg.text)\n ff.write(msg.text)\n author = q.find('sm...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db.execute( 'CREATE TABLE IF NOT EXISTS employee (id INTEGER PRIMAR KEY, employee_name TEXT, employee_salary INTEGER, employee_age INTEGER, profile_image BLOB)' ) for employee in packages_json['data']: db.execute('INSE...
flexible
{ "blob_id": "497203be99643e2bb0087977f292f4ed890f9ead", "index": 7111, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.execute(\n 'CREATE TABLE IF NOT EXISTS employee (id INTEGER PRIMAR KEY, employee_name TEXT, employee_salary INTEGER, employee_age INTEGER, profile_image BLOB)'\n )\nfor employee ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def f(q): for i in range(0, 100): print('come on baby') q.put([42, None, 'hello']) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def f(q): for i in range(0, 100...
flexible
{ "blob_id": "c7258d77db2fe6e1470c972ddd94b2ed02f48003", "index": 3390, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef f(q):\n for i in range(0, 100):\n print('come on baby')\n q.put([42, None, 'hello'])\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef f(q):\n for i in rang...
[ 0, 1, 2, 3, 4 ]
import stockquote import time import datetime from datetime import date from connection import db start_date='20100101' def prices(symbol): """ Loads the prices from the start date for the given symbol Only new quotes are downloaded. """ to = date.today().strftime("%Y%m%d") c = db.cursor() c.execute("SEL...
normal
{ "blob_id": "1b58d294f02ce85bf19da03f94100af87408081d", "index": 1326, "step-1": "import stockquote\nimport time\nimport datetime\nfrom datetime import date\nfrom connection import db\n\nstart_date='20100101'\ndef prices(symbol):\n \"\"\"\n Loads the prices from the start date for the given symbol\n Only new ...
[ 0 ]
<|reserved_special_token_0|> class Trainer(object): <|reserved_special_token_0|> def __init__(self, data_loader, model_name, model, optimizer_fn, final_steps, lr_scheduler_fn=None, step=0, ckpt_path=None, log_path =None, n_epochs=None, save_steps=None, log_steps=10, device='cuda', use...
flexible
{ "blob_id": "9fa534664056a8cf9e9a64ccc7d6dd4de2ec0936", "index": 1514, "step-1": "<mask token>\n\n\nclass Trainer(object):\n <mask token>\n\n def __init__(self, data_loader, model_name, model, optimizer_fn,\n final_steps, lr_scheduler_fn=None, step=0, ckpt_path=None, log_path\n =None, n_epoch...
[ 8, 12, 13, 14, 15 ]
import uuid from fastapi import APIRouter, Depends, HTTPException, Form, Body from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from sqlalchemy.orm import Session # dependency from configs.config_sqlalchemy import get_db # schema from schema import store_schema # define the url the clie...
normal
{ "blob_id": "64bbf2e3b961a6e0b5d7e551278bb21990df2ed9", "index": 5526, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@router.post('/account/register', summary='register to create a new store',\n response_model=store_schema.Store, status_code=201)\nasync def account_register(StoreName: str=Body(.....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def test_stringify_nums(): """.""" from radixsort import stringify_nums nums = [1, 2, 3, 4, 5] stringified_nums = stringify_nums(nums) assert stringified_nums == ['1', '2', '3', '4', '5'] def test_while_condition(): """.""" from radixsort import while_conditi...
flexible
{ "blob_id": "fd907dbcea01679c08aeae6bcbf6e61786f40260", "index": 2511, "step-1": "<mask token>\n\n\ndef test_stringify_nums():\n \"\"\".\"\"\"\n from radixsort import stringify_nums\n nums = [1, 2, 3, 4, 5]\n stringified_nums = stringify_nums(nums)\n assert stringified_nums == ['1', '2', '3', '4',...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def reachNumber(self, target): target = abs(target) k = 0 while target > 0: ...
flexible
{ "blob_id": "4b255b648f67e6bcc30eecc7975bbb1a356b2499", "index": 2656, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution(object):\n\n def reachNumber(self, target):\n target = abs(target)\n k = 0\n while ta...
[ 0, 1, 2, 3, 4 ]