code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/env python # Sanjaya Gajurel, Computational Scientist, Case Western Reserve University, April 2015 import vtk # ------------------------------------------------------------------------------ # Script Entry Point # ------------------------------------------------------------------------------ if __name__ ==...
normal
{ "blob_id": "de7515cb71c8e30018b14baf8846648d0c76a592", "index": 7461, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n print(\n 'vtkGraph: Building a graph using Unstructured Grid & dumping it in a vtk file, vertex.vtu, to be visualized using ParaView'\n )\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> board.display_board() <|reserved_special_token_0|> game.take_shot(""" Choose a spot to fire at in enemy seas: """, board) <|reserved_special_token_1|> <|reserved_special_token_0|> row_num = list(string.ascii_lowercase[:10]) col...
flexible
{ "blob_id": "dd06847c3eb9af6e84f247f8f0dd03961d83688e", "index": 9453, "step-1": "<mask token>\n", "step-2": "<mask token>\nboard.display_board()\n<mask token>\ngame.take_shot(\"\"\"\nChoose a spot to fire at in enemy seas: \"\"\", board)\n", "step-3": "<mask token>\nrow_num = list(string.ascii_lowercase[:10...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def generateExampleBoletoPaymentsJson(n=1, next_day=False): boletos = generateExampleBoletosJson(n=n) boletos = starkbank.boleto.create(boletos) payments = [] for boleto in boletos: payment = deepcopy(exa...
flexible
{ "blob_id": "383d3b35fbfb7921111b28c3160173ce1c200387", "index": 637, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef generateExampleBoletoPaymentsJson(n=1, next_day=False):\n boletos = generateExampleBoletosJson(n=n)\n boletos = starkbank.boleto.create(boletos)\n payments = []\n for b...
[ 0, 1, 2, 3, 4 ]
pokerAssignments = {'2': 20, '3': 30, '4': 40, '5': 50, '6': 60, '7': 70, '8': 80, '9': 90, 'T': 100, 'J': 110, 'Q': 120, 'K': 130, 'A': 140, 'C': 0, 'S': 1, 'H': 2, 'D': 3} #Used to assign each card to a unique three-digit integer configScoring = {(1, 1): 0, (1, 2): 1, (2, 2): 2, (1, 3): 3, (2, 3): 6, (1, 4): 7} #Tra...
normal
{ "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|> <|reserved_special_token_1|> def solution(n): arr = [[(0) for _ in range(i + 1)] for i in range(n)] size = n num = 0 x = 0 y = -1 while True: for _ in range(size): num += 1 y += 1 arr[y][x] = num size -= 1 ...
flexible
{ "blob_id": "3c029adb59cd6db1e3d4a22e6561f5e2ae827d60", "index": 2465, "step-1": "<mask token>\n", "step-2": "def solution(n):\n arr = [[(0) for _ in range(i + 1)] for i in range(n)]\n size = n\n num = 0\n x = 0\n y = -1\n while True:\n for _ in range(size):\n num += 1\n ...
[ 0, 1, 2 ]
count = int(input()) for i in range(1, count + 1): something = '=' num1, num2 = map(int, input().split()) if num1 > num2: something = '>' elif num1 < num2: something = '<' print(f'#{i} {something}')
normal
{ "blob_id": "abcefa0a3312e158517ec8a15421d1d07220da6a", "index": 5271, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, count + 1):\n something = '='\n num1, num2 = map(int, input().split())\n if num1 > num2:\n something = '>'\n elif num1 < num2:\n something = '<...
[ 0, 1, 2 ]
from collections import Counter import numpy as np import random import torch import BidModel from douzero.env.game import GameEnv env_version = "3.2" env_url = "http://od.vcccz.com/hechuan/env.py" Card2Column = {3: 0, 4: 1, 5: 2, 6: 3, 7: 4, 8: 5, 9: 6, 10: 7, 11: 8, 12: 9, 13: 10, 14: 11, 17: 12} Nu...
normal
{ "blob_id": "4015078ee9640c4558a4f29ebbb89f9098a31014", "index": 5720, "step-1": "<mask token>\n\n\nclass Env:\n <mask token>\n\n def __init__(self, objective):\n \"\"\"\n Objective is wp/adp/logadp. It indicates whether considers\n bomb in reward calculation. Here, we use dummy agents...
[ 13, 24, 32, 36, 37 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> UNK_TOKEN = '<unk>' BOS_TOKEN = '<bos>' EOS_TOKEN = '<eos>' PAD_TOKEN = '<pad>' UNK_IDX = 0 LARGE_POSITIVE_FLOAT = 1e+18 LARGE_NEGATIVE_FLOAT = -LARGE_POSITIVE_FLOAT GLOVE_NPZ_SHA1 = {'glove.42B.300d': ('glove.42B.300d.npz', '...
flexible
{ "blob_id": "4dde161d25ed41154e13b94cc9640c6aac055f87", "index": 6164, "step-1": "<mask token>\n", "step-2": "<mask token>\nUNK_TOKEN = '<unk>'\nBOS_TOKEN = '<bos>'\nEOS_TOKEN = '<eos>'\nPAD_TOKEN = '<pad>'\nUNK_IDX = 0\nLARGE_POSITIVE_FLOAT = 1e+18\nLARGE_NEGATIVE_FLOAT = -LARGE_POSITIVE_FLOAT\nGLOVE_NPZ_SHA1...
[ 0, 1, 2 ]
import random # Imports MongoClient for base level access to the local MongoDB from pymongo import MongoClient # Imports datetime class to create timestamp for weather data storage from datetime import datetime # Importing DailyReportModel class to use the implemented method to insert data into daily_report_model ...
normal
{ "blob_id": "a8b1b218e6649545000803c91c803580cfdbd4f1", "index": 459, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb_handle.drop_database(DB_NAME)\n<mask token>\nwith open(RELATIVE_CONFIG_PATH + USER_COLLECTION + '.csv', 'r') as user_fh:\n for user_row in user_fh:\n user_row = user_row.rstri...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> np.random.seed(123) <|reserved_special_token_0|> tf.enable_eager_execution() tf.set_random_seed(123) <|reserved_special_token_0|> gen.add(tf.keras.layers.Dense(H, input_dim=P + R, activation=tf.keras. activations.elu)) gen.add...
flexible
{ "blob_id": "aba3e0907e59bc5125759e90d3c784ceb97fca80", "index": 9941, "step-1": "<mask token>\n", "step-2": "<mask token>\nnp.random.seed(123)\n<mask token>\ntf.enable_eager_execution()\ntf.set_random_seed(123)\n<mask token>\ngen.add(tf.keras.layers.Dense(H, input_dim=P + R, activation=tf.keras.\n activati...
[ 0, 1, 2, 3, 4 ]
import sys prop = float(sys.argv[1]) def kind(n): s = str(n) l = len(s) i = 0 j = i + 1 decr, bouncy, incr = False, False, False while j < l: a = int(s[i]) b = int(s[j]) if s[i] > s[j]: decr = True elif s[i] < s[j]: incr = True i += 1 j += 1 if decr and incr: retu...
normal
{ "blob_id": "0de27101675eb8328d9a2831ed468a969b03e7d3", "index": 5741, "step-1": "<mask token>\n\n\ndef kind(n):\n s = str(n)\n l = len(s)\n i = 0\n j = i + 1\n decr, bouncy, incr = False, False, False\n while j < l:\n a = int(s[i])\n b = int(s[j])\n if s[i] > s[j]:\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class UserVetSchema(ma.Schema): class Meta: model = Uservet <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ma = Marshmallow() class UserVetSchema(ma.Schema): cla...
flexible
{ "blob_id": "677154aa99a5a4876532f3e1edfec45b1790384c", "index": 9511, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass UserVetSchema(ma.Schema):\n\n\n class Meta:\n model = Uservet\n\n\n<mask token>\n", "step-3": "<mask token>\nma = Marshmallow()\n\n\nclass UserVetSchema(ma.Schema):\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def fibonacci(n): if n == 0: return [] elif n == 1: return [1] elif n == 2: return [1, 1] else: lista = fibonacci(n - 1) suma = lista[len(lista) - 1] + lista[len(lista) - 2...
flexible
{ "blob_id": "03062ea08bd6ad88376f7c2aa2c89d2194ed8b2e", "index": 1074, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef fibonacci(n):\n if n == 0:\n return []\n elif n == 1:\n return [1]\n elif n == 2:\n return [1, 1]\n else:\n lista = fibonacci(n - 1)\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for onestore in chikenList: filename = onestore + '.csv' myframe = pd.read_csv(filename, index_col=0, encoding=myencoding) newframe = pd.concat([newframe, myframe], axis=0, ignore_index=True) print(newframe.info()) <|r...
flexible
{ "blob_id": "11a31d3276201105ca7485fa4e4eb711012accd5", "index": 2190, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor onestore in chikenList:\n filename = onestore + '.csv'\n myframe = pd.read_csv(filename, index_col=0, encoding=myencoding)\n newframe = pd.concat([newframe, myframe], axis=0,...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(): colors = vtk.vtkNamedColors() Data = np.load('tessaltions_compressed.npz') indices = meta['sorted_keys'] struct_D = {} for i, s in enumerate(set([x[0] for x in indices])): struct_D[s] = colors_list[i] renderer = vtk.vtkRenderer() renWin = vt...
flexible
{ "blob_id": "7261c5f9ac87c8337383daec312372b345ab7652", "index": 4109, "step-1": "<mask token>\n\n\ndef main():\n colors = vtk.vtkNamedColors()\n Data = np.load('tessaltions_compressed.npz')\n indices = meta['sorted_keys']\n struct_D = {}\n for i, s in enumerate(set([x[0] for x in indices])):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def bin_spatial(img, color_space='RGB', size=(32, 32)): colour_dict = {'RGB': 'RGB', 'BGR': cv2.COLOR_BGR2RGB, 'HLS': cv2. COLOR_BGR2HLS, 'HSV': cv2.COLOR_BGR2HSV, 'LUV': cv2.COLOR_BGR2LUV, 'YUV': cv2.COLOR_R...
flexible
{ "blob_id": "f178ae70ce54244624c2254d0d6256b83144db33", "index": 5085, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef bin_spatial(img, color_space='RGB', size=(32, 32)):\n colour_dict = {'RGB': 'RGB', 'BGR': cv2.COLOR_BGR2RGB, 'HLS': cv2.\n COLOR_BGR2HLS, 'HSV': cv2.COLOR_BGR2HSV, 'LUV'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(obj_list): for obj in obj_list: obj.print_object() print() <|reserved_special_token_1|> <|reserved_special_token_0|> request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key) obj_list...
flexible
{ "blob_id": "c65969bba72142f4a328f978d78e0235cd56e393", "index": 8618, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(obj_list):\n for obj in obj_list:\n obj.print_object()\n print()\n", "step-3": "<mask token>\nrequest_client = RequestClient(api_key=g_api_key, secret_key=g_secr...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for d in doc: word = d.text pos = d.pos_ dep = d.dep_ if re.search('subj', dep): word2 = (ahref + 'http://www.superai.online/solr/search.php?query=' + word + ahref2 + word + '</a>') subj...
flexible
{ "blob_id": "ecc001394c1f3bba78559cba7eeb216dd3a942d8", "index": 4711, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor d in doc:\n word = d.text\n pos = d.pos_\n dep = d.dep_\n if re.search('subj', dep):\n word2 = (ahref + 'http://www.superai.online/solr/search.php?query=' +\n ...
[ 0, 1, 2, 3, 4 ]
import requests import unittest import time from common import HTMLTestReport class Get(unittest.TestCase): TMPTOKEN = '' TOKEN = '' def setUp(self): pass # 获取临时token,opterTmpToken def test_gettmptoken(self): url = 'https://jdapi.jd100.com/uc/core/v1/sys/opterTmpToken' par...
normal
{ "blob_id": "773c217f7f76bd82ed3dabf7ae1aba1871f0932f", "index": 8539, "step-1": "<mask token>\n\n\nclass Get(unittest.TestCase):\n <mask token>\n <mask token>\n\n def setUp(self):\n pass\n <mask token>\n\n def test_gettoken(self):\n url = 'https://jdapi.jd100.com/uc/v1/sys/opterToke...
[ 6, 7, 8, 11, 12 ]
from django.contrib import admin from students.models import Child_detail class ChildAdmin(admin.ModelAdmin): def queryset(self, request): """ Filter the Child objects to only display those for the currently signed in user. """ qs = super(ChildAdmin, self).queryset(reque...
normal
{ "blob_id": "582f2e6972bad85c2aaedd248f050f708c61973b", "index": 2332, "step-1": "<mask token>\n\n\nclass ChildAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass ChildAdmin(admin.ModelAdmin):\n\n def queryset(self, request):\n \"\"\"\n Filter th...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python from xrouter import api api.main()
normal
{ "blob_id": "64368679aa2e387e25a36b2f3d0312a99b819e95", "index": 2147, "step-1": "<mask token>\n", "step-2": "<mask token>\napi.main()\n", "step-3": "from xrouter import api\napi.main()\n", "step-4": "#!/usr/bin/env python\nfrom xrouter import api\napi.main()\n", "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for tr in root.xpath("//div[@id='verdiSection10']/div/div/table/tbody/tr")[1:]: data = {'conviction_date': datetime.strptime(re.match( '(\\d+/\\d+/\\d+)', tr[0].text_content().strip()).group(1), '%d/%m/%Y'), 'b...
flexible
{ "blob_id": "e870900249b121f2416d7be543752ebf6392b6be", "index": 6868, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor tr in root.xpath(\"//div[@id='verdiSection10']/div/div/table/tbody/tr\")[1:]:\n data = {'conviction_date': datetime.strptime(re.match(\n '(\\\\d+/\\\\d+/\\\\d+)', tr[0].text...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> 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_c...
flexible
{ "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|> def func(w, rc): return 1 / np.sqrt(1 + w ** 2 * rc ** 2) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def func(w, rc): return 1 / np.sqrt(1 + w ** 2 * rc ** 2) with open('data/phase.csv') as csvfile: reader = csv.reader(csvfi...
flexible
{ "blob_id": "170d0560c40f3f642f319f6113b68ab8a6bea9ef", "index": 468, "step-1": "<mask token>\n\n\ndef func(w, rc):\n return 1 / np.sqrt(1 + w ** 2 * rc ** 2)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef func(w, rc):\n return 1 / np.sqrt(1 + w ** 2 * rc ** 2)\n\n\nwith open('data/phase.csv') as...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MyGame(arcade.Window): <|reserved_special_token_0|> def __init__(self, width, height, title): """ Initializer """ super().__init__(width, height, title) file_path = os.path.dirname(os.path.abspath(__file__)) os.chdir(file_path...
flexible
{ "blob_id": "28d8f9d9b39c40c43a362e57a7907c0a38a6bd05", "index": 748, "step-1": "<mask token>\n\n\nclass MyGame(arcade.Window):\n <mask token>\n\n def __init__(self, width, height, title):\n \"\"\"\n Initializer\n \"\"\"\n super().__init__(width, height, title)\n file_pat...
[ 6, 7, 9, 12, 13 ]
<|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": "760a5a168575a0ea12b93cb58c1e81e313704e35", "index": 6276, "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 = [('viajes', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': parser = argparse.ArgumentParser(description='EasyVVUQ applied to BOUT++') parser.add_argument('--batch', '-b', help= 'Run on a batch (SLURM) system', action='store_true', default=False) ...
flexible
{ "blob_id": "416f4c6bbd2f2b9562ab2d1477df4ebc45070d8d", "index": 5060, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n parser = argparse.ArgumentParser(description='EasyVVUQ applied to BOUT++')\n parser.add_argument('--batch', '-b', help=\n 'Run on a batch (SLURM)...
[ 0, 1, 2, 3 ]
""" Cores no terminal """ a = 3 b = 5 print('Os valores são \033[32m{}\033[m e \033[31m{}\033[m !!!'.format(a, b)) # Dicionário de cores: nome = 'Kátia' cores = {'limpa':'\033]m', 'azul':'\033[34m', 'amarelo':'\033[33m', 'pretoebranco':'\033[7;30m'} print('Prazer em te conhe...
normal
{ "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 ]
<|reserved_special_token_0|> def individual(list_df: list, seaborn_context: str='poster'): sns.set_context(seaborn_context) for df in list_df: df.plot() <|reserved_special_token_1|> <|reserved_special_token_0|> def group(list_df: list, df_col_index: int=0, seaborn_context: str='poster'): sns....
flexible
{ "blob_id": "d2632461fcdc39509610b96d43dd1ec42dae362f", "index": 5229, "step-1": "<mask token>\n\n\ndef individual(list_df: list, seaborn_context: str='poster'):\n sns.set_context(seaborn_context)\n for df in list_df:\n df.plot()\n", "step-2": "<mask token>\n\n\ndef group(list_df: list, df_col_ind...
[ 1, 2, 3, 4 ]
from flask import Blueprint views = Blueprint('views', __name__) from . import routes
normal
{ "blob_id": "139ccdaf7acb2a2d74649f0c32217d1fe71a954a", "index": 4800, "step-1": "<mask token>\n", "step-2": "<mask token>\nviews = Blueprint('views', __name__)\n<mask token>\n", "step-3": "from flask import Blueprint\nviews = Blueprint('views', __name__)\nfrom . import routes\n", "step-4": null, "step-5...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- __author__ = 'wxy' class ListProcess(object): def __init__(self, rsp, nickname): self.rsp = rsp self.nickname = nickname def get_friend_uin(self): try: for list in self.rsp['result']['info']: if list['nick'] == self.nickname: ...
normal
{ "blob_id": "1154fd3883dc8856e24127d56ce6a983308dc1aa", "index": 3683, "step-1": "# -*- coding: utf-8 -*-\n__author__ = 'wxy'\n\nclass ListProcess(object):\n def __init__(self, rsp, nickname):\n self.rsp = rsp\n self.nickname = nickname\n\n def get_friend_uin(self):\n try:\n ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def retry(retry_count=2, delay=5, action_description='not specified', allowed_exceptions=()): def decorator(func): @wraps(func) def wrapper(*args, **kwargs): for _ in range(retry_count): ...
flexible
{ "blob_id": "79e4592d5ea84cc7c97d68a9390eb5d387045cf0", "index": 4344, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef retry(retry_count=2, delay=5, action_description='not specified',\n allowed_exceptions=()):\n\n def decorator(func):\n\n @wraps(func)\n def wrapper(*args, **kw...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from celery import Celery app = Celery('task', include=['task.tasks']) app.config_from_object('task.config') if __name__ == '__main__': app.start()
normal
{ "blob_id": "68d9f77f91a13c73373c323ef0edbe18af9990a3", "index": 4321, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.config_from_object('task.config')\nif __name__ == '__main__':\n app.start()\n", "step-3": "<mask token>\napp = Celery('task', include=['task.tasks'])\napp.config_from_object('tas...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(): sorts = ['selection-sort', 'insertion-sort', 'shell-sort'] for sort in sorts: exe_path = './build/{}'.format(sort.rstrip()) if not os.path.isfile(exe_path): raise OSError('The executable {} does not exist.'.format(exe_path)) accumula...
flexible
{ "blob_id": "501d50fa933f55c178b4b2eba6cfc5b85592beaa", "index": 8473, "step-1": "<mask token>\n\n\ndef main():\n sorts = ['selection-sort', 'insertion-sort', 'shell-sort']\n for sort in sorts:\n exe_path = './build/{}'.format(sort.rstrip())\n if not os.path.isfile(exe_path):\n rai...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class GeneralInformation(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class Meta: ordering = ['name'] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Ge...
flexible
{ "blob_id": "d0f83e3b7eb5e1bc81a56e46043f394757437af8", "index": 5504, "step-1": "<mask token>\n\n\nclass GeneralInformation(models.Model):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n ordering = ['name']\n <mask token>\n", "step-2": "<mask token>\n\n\nclass GeneralInf...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class CRICAgent(DataSourceAgent): <|reserved_special_token_0|> <|reserved_special_token_0|> def run(self): if self.refresh_interval is None: self.refresh_interval = 60 while True: self.update() time.sleep(self.refresh_interv...
flexible
{ "blob_id": "55c00ce4c1657dc5ce78e5eeccd8e9625c0590dc", "index": 5345, "step-1": "<mask token>\n\n\nclass CRICAgent(DataSourceAgent):\n <mask token>\n <mask token>\n\n def run(self):\n if self.refresh_interval is None:\n self.refresh_interval = 60\n while True:\n self...
[ 2, 3, 4, 5, 6 ]
from entities.GpsFix import GpsFix class Visit(object): """ A Visit, which represents an arrival-departure to a stay point Attributes: id_visit: the id of the visit itself id_stay_point: the id of the stay point pivot_arrival_fix: the GpsFix that corresponds to real wo...
normal
{ "blob_id": "703ed320e7c06856a0798d9c0de9aafe24458767", "index": 7937, "step-1": "<mask token>\n\n\nclass Visit(object):\n <mask token>\n\n def __init__(self, id_visit, id_stay_point, pivot_arrival_fix: GpsFix,\n pivot_departure_fix: GpsFix, detection_arrival_fix: GpsFix,\n detection_departur...
[ 4, 5, 6, 7, 8 ]
import flask from flask.ext.classy import FlaskView, route, request from annotator_supreme.controllers.user_controller import UserController from annotator_supreme.views import view_tools from annotator_supreme.views import error_views from flask import render_template, flash, redirect, url_for from annotator_supreme i...
normal
{ "blob_id": "a2e77298059104b403555af95430d7995f8a697b", "index": 1379, "step-1": "<mask token>\n\n\nclass LoginViewWebApp(FlaskView):\n <mask token>\n\n def __init__(self):\n self.user_controller = UserController()\n\n @route('/register', methods=['GET', 'POST'])\n def register_user(self):\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for data in password: if data != pw: pass else: print('พบข้อมูลรหัสผ่านนี้') print('แล้วเจอกันใหม่') <|reserved_special_token_1|> password = ['123456', '1111'] pw = input('รหัสผ่านคือ>>>') for data in pa...
flexible
{ "blob_id": "6f05b1352e776e20d6a9e0eb457d8914cbfc2d22", "index": 2779, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor data in password:\n if data != pw:\n pass\n else:\n print('พบข้อมูลรหัสผ่านนี้')\nprint('แล้วเจอกันใหม่')\n", "step-3": "password = ['123456', '1111']\npw = inpu...
[ 0, 1, 2, 3 ]
import pygame import numpy as np import random from enum import Enum from .config import * class Actions(Enum): FORWARD = 0 RIGHT = 1 LEFT = 2 BACK = 3 class MazeEnv(): ''' TODO ''' def __init__(self, GW, GH, SW, SH): global GRID_WIDTH, GRID_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, BOX_WID...
normal
{ "blob_id": "751d2a07b97d080988c54511ca13a97a969e06bd", "index": 6405, "step-1": "<mask token>\n\n\nclass MazeEnv:\n <mask token>\n\n def __init__(self, GW, GH, SW, SH):\n global GRID_WIDTH, GRID_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, BOX_WIDTH, BOX_HEIGHT\n GRID_WIDTH = GW\n GRID_HEIGHT...
[ 9, 10, 12, 13, 14 ]
#!/usr/bin/env python def question(): print("02. 「パトカー」+「タクシー」=「パタトクカシーー」") print("「パトカー」+「タクシー」の文字を先頭から交互に連結して文字列「パタトクカシーー」を得よ.") def main(): str1 = "パトカー" str2 = "タクシー" print(''.join([x[0] + x[1] for x in zip(str1, str2)])) if __name__ == '__main__': question() main()
normal
{ "blob_id": "32869a88bb59d47281249b6ebe2357328beb0359", "index": 3572, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n str1 = 'パトカー'\n str2 = 'タクシー'\n print(''.join([(x[0] + x[1]) for x in zip(str1, str2)]))\n\n\n<mask token>\n", "step-3": "def question():\n print('02. 「パトカ...
[ 0, 1, 2, 3, 4 ]
from googleAPI.drive import * class GoogleSheet(GoogleDrive): """ The base class of Google Sheet API. It aims at dealing with the Google Sheet data extract and append. It is not tied to a specific spreadsheet. This class is powered by pandas. Thus, make sure the data in the spreadshe...
normal
{ "blob_id": "9e793bd0faef65dfe8ac4b722e50d2055837449f", "index": 4701, "step-1": "<mask token>\n\n\nclass GoogleSheet(GoogleDrive):\n <mask token>\n <mask token>\n\n def create_spreadsheet(self, spreadsheet_name: str):\n \"\"\"\n Creates a spreadsheet, returning the newly created spreadshe...
[ 4, 8, 10, 12, 13 ]
''' This module creates the models/tables in the database catalog using sqlalchemy ''' from catalog import db class Items(db.Model): ''' Model to store all the information about an item ''' id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String) item = db.Column(db....
normal
{ "blob_id": "ad622ff2e1d9286246b2175694a9ae796f8d2557", "index": 7535, "step-1": "<mask token>\n\n\nclass Items(db.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, email, item, descrip...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class _WATERWAYS: <|reserved_special_token_0|> <|reserved_special_token_1|> class _WATERWAYS: def __init__(self): self.name = 'WATERWAYS' self.definitions = waterway self.parents = [] self.childen = [] self....
flexible
{ "blob_id": "33daf5753b27f6b4bcb7c98e28cf2168e7f0b403", "index": 9541, "step-1": "<mask token>\n", "step-2": "class _WATERWAYS:\n <mask token>\n", "step-3": "class _WATERWAYS:\n\n def __init__(self):\n self.name = 'WATERWAYS'\n self.definitions = waterway\n self.parents = []\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_weather(request): form = WeatherForm() error = '' output = {} if request.method == 'POST': form = WeatherForm(request.POST) if form.is_valid(): data = form.cleaned_data ...
flexible
{ "blob_id": "be5a683309317f1f6ebc20ad3511fd2b2510e806", "index": 5535, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_weather(request):\n form = WeatherForm()\n error = ''\n output = {}\n if request.method == 'POST':\n form = WeatherForm(request.POST)\n if form.is_va...
[ 0, 1, 2, 3 ]
import requests import json import logging import time from alto.server.components.datasource import DBInfo, DataSourceAgent class CRICAgent(DataSourceAgent): def __init__(self, dbinfo: DBInfo, name: str, namespace='default', **cfg): super().__init__(dbinfo, name, namespace) self.uri = self.ensu...
normal
{ "blob_id": "55c00ce4c1657dc5ce78e5eeccd8e9625c0590dc", "index": 5345, "step-1": "<mask token>\n\n\nclass CRICAgent(DataSourceAgent):\n <mask token>\n <mask token>\n\n def run(self):\n if self.refresh_interval is None:\n self.refresh_interval = 60\n while True:\n self...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python3 # crits_ldap.py # This connects to an LDAP server and pulls data about all users. # Then, it either updates existing targets in CRITS or creates a new entry. import json import sys import datetime import logging import logging.config from configparser import ConfigParser from ldap3 import Serve...
normal
{ "blob_id": "5d568c5ac9040ad93749c27bd6fe1a956e7456f7", "index": 9016, "step-1": "#!/usr/bin/env python3\n# crits_ldap.py\n# This connects to an LDAP server and pulls data about all users.\n# Then, it either updates existing targets in CRITS or creates a new entry.\n\nimport json\nimport sys\nimport datetime\nim...
[ 0 ]
#!/usr/bin/python import sys def get_params(fname): d = dict() with open(fname) as f: for line in f: l = line.strip() if (line[0] == '#'): continue param = line.split('=') v = ' '.join(param[1:]) d[param[0]] = v.strip('\n') return d usage_text = "Compares boot configs of two kernels\n" \ "U...
normal
{ "blob_id": "d287a5128ca9352b2edc459c9e42a57ef800ec9c", "index": 7657, "step-1": "#!/usr/bin/python\n\nimport sys\n\ndef get_params(fname):\n\td = dict()\n\twith open(fname) as f:\n\t\tfor line in f:\n\t\t\tl = line.strip()\n\t\t\tif (line[0] == '#'):\n\t\t\t\tcontinue\n\t\t\tparam = line.split('=')\n\t\t\tv = '...
[ 0 ]
<|reserved_special_token_0|> class Client_OrderInline(admin.TabularInline): <|reserved_special_token_0|> class MyAdminSite(AdminSite): site_header = 'Pizza-Day' index_template = 'admin/index.html' @admin.register(Product) class ProductAdmin(admin.ModelAdmin): class PriceListFilter(admin.SimpleLi...
flexible
{ "blob_id": "d301ffa790d6444519e354a2b6f8d65f67d380c0", "index": 1739, "step-1": "<mask token>\n\n\nclass Client_OrderInline(admin.TabularInline):\n <mask token>\n\n\nclass MyAdminSite(AdminSite):\n site_header = 'Pizza-Day'\n index_template = 'admin/index.html'\n\n\n@admin.register(Product)\nclass Prod...
[ 16, 17, 18, 24, 25 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for word in stdin: lst_in = word match = re.finditer('(\\w)\\1+', lst_in) for item in match: lst_in = lst_in.replace(item[0], item[0][0]) print(lst_in, end='') <|reserved_special_token_1|> <|reserved_spe...
flexible
{ "blob_id": "5b7c04f23fb674191639e95dff8c530933379d67", "index": 3686, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor word in stdin:\n lst_in = word\n match = re.finditer('(\\\\w)\\\\1+', lst_in)\n for item in match:\n lst_in = lst_in.replace(item[0], item[0][0])\n print(lst_in, en...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def pad_sequences_1d(sequences, dtype=torch.long, device=torch.device('cpu' ), fixed_length=None): """ Pad a single-nested list or a sequence of n-d array (torch.tensor or np.ndarray) into a (n+1)-d array, only allow the first dim has variable lengths. Args: sequen...
flexible
{ "blob_id": "788d9fa03c4311a8077d492b1a2b06d1f88826a3", "index": 5570, "step-1": "<mask token>\n\n\ndef pad_sequences_1d(sequences, dtype=torch.long, device=torch.device('cpu'\n ), fixed_length=None):\n \"\"\" Pad a single-nested list or a sequence of n-d array (torch.tensor or np.ndarray)\n into a (n+1...
[ 3, 4, 5, 6, 7 ]
from command import Command, is_command, CommandException from event import Event class ItemInfo(Command): @is_command def item_info(self, player, *args): if len(args) == 0: raise CommandException(CommandException.NOT_ENOUGH_ARGUMENTS) item_id = args[0] if item_id in playe...
normal
{ "blob_id": "6b2bd6954f188626fa857ffc37611d3f971d22e2", "index": 5259, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ItemInfo(Command):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ItemInfo(Command):\n\n @is_command\n def item_info(self, player, *args):\n if len(args...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- """ Created on Thu Dec 17 13:07:47 2020 @author: mmm """ n = 2 n1 = 10 for i in range(n,n1): if n > 1: for j in range(2,i): if (i % j!= 0): else: print(i)
normal
{ "blob_id": "1855351b20c7965a29864502e4489ab4324c7859", "index": 4808, "step-1": "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Thu Dec 17 13:07:47 2020\r\n\r\n@author: mmm\r\n\"\"\"\r\n\r\n\r\nn = 2\r\nn1 = 10\r\nfor i in range(n,n1):\r\n if n > 1:\r\n for j in range(2,i):\r\n if (i % j!=...
[ 0 ]
from keras.models import Sequential from keras.layers import Convolution2D # for 2d images from keras.layers import MaxPool2D from keras.layers import Flatten from keras.layers import Dense import tensorflow as tf from keras_preprocessing.image import ImageDataGenerator cnn = Sequential() rgb = 64 # step 1: convolu...
normal
{ "blob_id": "9fa5f4b4aeb7fe42d313a0ec4e57ce15acbfcf46", "index": 3960, "step-1": "<mask token>\n", "step-2": "<mask token>\ncnn.add(Convolution2D(32, 3, 3, input_shape=(rgb, rgb, 3), activation='relu'))\ncnn.add(MaxPool2D(pool_size=(2, 2)))\ncnn.add(Flatten())\ncnn.add(Dense(output_dim=128, activation='relu'))...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def main(): if IS_TRAINING: training_imgs_paths = list_images(TRAINING_IMGS_PATH) train(training_imgs_paths, ENCODER_WEIGHTS_PATH, MODEL_SAVE_PATH, autoencoder_levels=AUTUENCODER_LEVELS_TRAIN, debug=DEBUG, logging_period=LOGGING_PERIOD) ...
flexible
{ "blob_id": "31ed798118f20005b5a26bc1fc0053b7d0a95657", "index": 5366, "step-1": "<mask token>\n\n\ndef main():\n if IS_TRAINING:\n training_imgs_paths = list_images(TRAINING_IMGS_PATH)\n train(training_imgs_paths, ENCODER_WEIGHTS_PATH, MODEL_SAVE_PATH,\n autoencoder_levels=AUTUENCODE...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def my_loss(): return nn.CrossEntropyLoss() <|reserved_special_token_1|> import torch.nn as nn def my_loss(): return nn.CrossEntropyLoss()
flexible
{ "blob_id": "418f2e1cbe4fb3ef369e981e72bf40eeddfd052e", "index": 2408, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef my_loss():\n return nn.CrossEntropyLoss()\n", "step-3": "import torch.nn as nn\n\n\ndef my_loss():\n return nn.CrossEntropyLoss()\n", "step-4": null, "step-5": null, ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(args): np.random.seed(args.random_seed) tf.random.set_seed(args.random_seed) unet_model = UnetModel(args) unet_model.prepare_data(args) unet_model.create_model(args) unet_model.train(args) un...
flexible
{ "blob_id": "588f6f78908e47e0b3f1bc42fffabad34766eede", "index": 9815, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(args):\n np.random.seed(args.random_seed)\n tf.random.set_seed(args.random_seed)\n unet_model = UnetModel(args)\n unet_model.prepare_data(args)\n unet_model.cr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_astype_invalid_nas_to_tdt64_raises(): idx = Index([NaT.asm8] * 2, dtype=object) msg = 'Cannot cast Index to dtype timedelta64\\[ns\\]' with pytest.raises(TypeError, match=msg): idx.astype('m8[ns]') ...
flexible
{ "blob_id": "13b2fea09f5a4300563dd8870fe1841b47756b36", "index": 9972, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_astype_invalid_nas_to_tdt64_raises():\n idx = Index([NaT.asm8] * 2, dtype=object)\n msg = 'Cannot cast Index to dtype timedelta64\\\\[ns\\\\]'\n with pytest.raises(T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Database(object): def __init__(self): self.client = MongoClient(config['db']['url']) self.db = self.client[config['db']['name']] <|reserved_special_token_0|> def find(self, criteria, collection_name, projection=None, sort=None, limit=0, cursor=F...
flexible
{ "blob_id": "bcc76e4dbcc191e7912085cbb92c5b0ebd2b047b", "index": 6550, "step-1": "<mask token>\n\n\nclass Database(object):\n\n def __init__(self):\n self.client = MongoClient(config['db']['url'])\n self.db = self.client[config['db']['name']]\n <mask token>\n\n def find(self, criteria, col...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> @fixture def authenticated_author_client(user, client: Client) ->Client: token = Token.objects.get_or_create(user=user)[0].key client.defaults['HTTP_AUTHORIZATION'] = f'Token {token}' print(client) return client <|reserved_special_token_0|> <|reserved_special_token_1|>...
flexible
{ "blob_id": "347d468f15dee8a8219d201251cedffe21352f7c", "index": 8813, "step-1": "<mask token>\n\n\n@fixture\ndef authenticated_author_client(user, client: Client) ->Client:\n token = Token.objects.get_or_create(user=user)[0].key\n client.defaults['HTTP_AUTHORIZATION'] = f'Token {token}'\n print(client)...
[ 1, 2, 3, 4, 5 ]
class Solution: def asteroidCollision(self, asteroids: List[int]) ->List[int]: output = [] index = 0 for i in asteroids: if len(output) == 0: index = 0 if index == 0: output.append(i) index += 1 continue...
normal
{ "blob_id": "fef4749ce7b8668a5a138aa1245010866a85c853", "index": 2485, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def asteroidCollision(self, asteroids: List[int]) ->List[int]:\n output = []\n index = 0\n for i in astero...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class s3Obj: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class s3Obj: <|reserved_special_token_0|> def getACL(self, client_s3): """ get ACL info and update the object """ ...
flexible
{ "blob_id": "b3f376f4aec81cae853f996a74062e32bb4a8fa3", "index": 2569, "step-1": "<mask token>\n\n\nclass s3Obj:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass s3Obj:\n <mask token>\n\n def getACL(self, client_s3):\n \"\"\"\n get ACL info and update the object\n ...
[ 1, 2, 3, 4, 5 ]
import socket # Packet Sniffing # It's All Binary # Usage: python basic_sniffer.py # create the sniffer raw socket object sniffer = socket.socket(socket.AF_INET,socket.SOCK_RAW, socket.IPPROTO_ICMP) #bind it to localhost sniffer.bind(('0.0.0.0',0)) # make sure that the IP header is included sniffer.setsockopt(soc...
normal
{ "blob_id": "9f2a8e78aa2e3eab8f74847443dec9083603da39", "index": 3643, "step-1": "import socket\n\n# Packet Sniffing\n# It's All Binary\n\n# Usage: python basic_sniffer.py \n\n# create the sniffer raw socket object\nsniffer = socket.socket(socket.AF_INET,socket.SOCK_RAW, socket.IPPROTO_ICMP)\n\n#bind it to local...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: print(dic[55]) except Exception as err: print('Mensagem: ', err) <|reserved_special_token_1|> dic = {} try: print(dic[55]) except Exception as err: print('Mensagem: ', err)
flexible
{ "blob_id": "618aa64c08ebf8d9a0bc9662195ece2bbd485c17", "index": 1079, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err)\n", "step-3": "dic = {}\ntry:\n print(dic[55])\nexcept Exception as err:\n print('Mensagem: ', err...
[ 0, 1, 2 ]
# ------------------------------- # --------- Set Methods --------- # ------------------------------- # difference() return the values in the first set that not in the second set set1 ={1, 2, 3, 4, 5, 6, 7, 8 , 9} set2 = {1, 2, 3, 4, 5, 6, "A", "B"} print(set1) print(set2) print(set1.difference(set2)) print(set1-set2...
normal
{ "blob_id": "faf2f5da92cf45cfedda91955688b3ca1c7c0db9", "index": 8280, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(set1)\nprint(set2)\nprint(set1.difference(set2))\nprint(set1 - set2)\nprint(set2.difference(set1))\nprint(set2 - set1)\nprint(set1)\nprint(set2)\nprint('*' * 40)\n<mask token>\nprin...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # -*- coding: utf-8 -*- # http://stackoverflow.com/questions/5276967/python-in-xcode-4 """tv_write_xyzt2matlab.py: TremVibe Write Accelerometer XYZ and Timestamp to .m file""" __author__ = "Salvador Aguinaga" import sys import MySQLdb import math from itertools import groupby import csv ##########...
normal
{ "blob_id": "4f21fb4168ed29b9540d3ca2b8cf6ef746c30831", "index": 6732, "step-1": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n# http://stackoverflow.com/questions/5276967/python-in-xcode-4\n\n\"\"\"tv_write_xyzt2matlab.py: TremVibe Write Accelerometer XYZ and Timestamp to .m file\"\"\"\n__author__ = \"Salvador ...
[ 0 ]
#!/usr/bin/python import sys BLACK = '\033[30;0m' RED = '\033[31;0m' GREEN = '\033[32;0m' YELLOW = '\033[33;0m' BLUE = '\033[34;0m' PINK = '\033[35;0m' CBLUE = '\033[36;0m' WHITE = '\033[37;0m' def colorPrint(color, str): print(color + str + '\033[0m'); def main(): if sys.argv.__len__() < ...
normal
{ "blob_id": "a49c00dab8d445ce0b08fd31a4a41d6c8976d662", "index": 2263, "step-1": "<mask token>\n\n\ndef colorPrint(color, str):\n print(color + str + '\\x1b[0m')\n\n\ndef main():\n if sys.argv.__len__() < 2:\n print('Wrong usage, exit')\n return\n colorPrint(YELLOW, sys.argv[1])\n\n\n<mask...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestMian: def test_mian(self): MainPage().goto_marketpage().goto_search().search() <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestMian: def test_mi...
flexible
{ "blob_id": "e1751cc6f76f56e62cd02d61db65f1c27a4ff1b9", "index": 7351, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestMian:\n\n def test_mian(self):\n MainPage().goto_marketpage().goto_search().search()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass TestMian:\n\n de...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> @Gtk.Template(resource_path= '/com/github/bilelmoussaoui/Authenticator/settings.ui') class SettingsWindow(Handy.PreferencesWindow): <|reserved_special_token_0|> dark_theme_switch: Gtk.Switch = Gtk.Template.Child() night_light_switch: Gtk.Switch = Gtk.Template.Child() l...
flexible
{ "blob_id": "a7d8efe3231b3e3b9bfc5ef64a936816e8b67d6c", "index": 3127, "step-1": "<mask token>\n\n\n@Gtk.Template(resource_path=\n '/com/github/bilelmoussaoui/Authenticator/settings.ui')\nclass SettingsWindow(Handy.PreferencesWindow):\n <mask token>\n dark_theme_switch: Gtk.Switch = Gtk.Template.Child()...
[ 10, 11, 13, 19, 21 ]
<|reserved_special_token_0|> def read_vivado_report(hls_dir, full_report=False): if not os.path.exists(hls_dir): print('Path {} does not exist. Exiting.'.format(hls_dir)) return prj_dir = None top_func_name = None if os.path.isfile(hls_dir + '/build_prj.tcl'): prj_dir, top_func...
flexible
{ "blob_id": "7d173b0571c20dc8fcae884451e8f69ba3a05763", "index": 8087, "step-1": "<mask token>\n\n\ndef read_vivado_report(hls_dir, full_report=False):\n if not os.path.exists(hls_dir):\n print('Path {} does not exist. Exiting.'.format(hls_dir))\n return\n prj_dir = None\n top_func_name = ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> def restart(): root.destroy() os.startfile('data\\programs\\game with tkinter.py') def disableButton(): global l, restartButton, start b1.config(state='disabled') b2.config(state='disabled') b3.config(state='disabled') b4.config(state='disabled') b5.confi...
flexible
{ "blob_id": "e70c5c9a62faa4c501c0f103ce0a0a419aaf4301", "index": 2096, "step-1": "<mask token>\n\n\ndef restart():\n root.destroy()\n os.startfile('data\\\\programs\\\\game with tkinter.py')\n\n\ndef disableButton():\n global l, restartButton, start\n b1.config(state='disabled')\n b2.config(state=...
[ 11, 12, 14, 15, 18 ]
<|reserved_special_token_0|> class _RestrictData: __slots__ = () <|reserved_special_token_0|> class RestrictBlend: __slots__ = 'context', 'data' def __enter__(self): self.data = _bpy.data self.context = _bpy.context _bpy.data = _data_restrict _bpy.context = _context_re...
flexible
{ "blob_id": "aa4226c377368d1ece4e556db9b7fdd0134472c9", "index": 5450, "step-1": "<mask token>\n\n\nclass _RestrictData:\n __slots__ = ()\n\n\n<mask token>\n\n\nclass RestrictBlend:\n __slots__ = 'context', 'data'\n\n def __enter__(self):\n self.data = _bpy.data\n self.context = _bpy.conte...
[ 6, 9, 10, 11, 13 ]
# coding: utf-8 import logging import uuid import json import xmltodict import bottle from bottle import HTTPError from bottle.ext import sqlalchemy from database import Base, engine from database import JdWaybillSendResp, JdWaybillApplyResp jd = bottle.Bottle(catchall=False) plugin = sqlalchemy.Plugin( engine, ...
normal
{ "blob_id": "a93884757069393b4d96de5ec9c7d815d58a2ea5", "index": 935, "step-1": "<mask token>\n\n\n@jd.get('/routerjson')\ndef apply_jd_waybill(db):\n query = bottle.request.query\n if query['method'] == 'jingdong.etms.waybillcode.get':\n jd_code, resp = jd_get_response_normal()\n logging.deb...
[ 4, 5, 6, 7, 8 ]
from firstfuncs_1618 import * figdir='/home/isabela/Documents/projects/OSNAP/figures_OSNAPwide/Freshwater/Linear/' figdir_paper='/home/isabela/Documents/projects/OSNAP/figures_OSNAPwide/Freshwater/paperfigs' ######################################################################################################## #####...
normal
{ "blob_id": "40b94a3be27ebb0d8e3e67fddabe1dc68646169c", "index": 9881, "step-1": "<mask token>\n\n\ndef get_U_S_T_from_WM(WM):\n U = {}\n S = {}\n T = {}\n for wm in WM.WM:\n U[str(wm.values)] = float(WM['TRANS'].sel(WM=wm).groupby(\n 'TIME.month').mean('TIME').mean(dim='month').val...
[ 10, 11, 13, 14, 16 ]
import ply.lex as lex print("hello word!")
normal
{ "blob_id": "84d0c439fcee4339250ced11dd2264740cc20d9c", "index": 9567, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('hello word!')\n", "step-3": "import ply.lex as lex\nprint('hello word!')\n", "step-4": "import ply.lex as lex\n\nprint(\"hello word!\")\n", "step-5": null, "step-ids": [ ...
[ 0, 1, 2, 3 ]
# # Copyright John Reid 2009 # """ Code to handle bootstrap analyses. """ from itertools import cycle import random import bisect def generate_bootstrap_samples(num_samples, test_universe, test_set_sizes): """ Yield samples that match the sizes given in test_set_sizes """ for sample_idx, sample_siz...
normal
{ "blob_id": "752affdfa1481b9a19a9b7dfe76f9d5d11c80073", "index": 4678, "step-1": "<mask token>\n\n\ndef bootstrap_p_value(bootstrap_stats, stat_value):\n \"\"\"\n Calculate the p-value for the statistic's value given the bootstrap values.\n \"\"\"\n return 1.0 - bisect.bisect_left(bootstrap_stats, st...
[ 1, 2, 3, 4, 5 ]
from point import Point from velocity import Velocity import arcade import config PADDLE_WIDTH = 15 PADDLE_HEIGHT = 30 class Paddle: def __init__(self): self.center = Point(390, 50) self.velocity = Velocity(0, 5) def draw(self): self.drawing = arcade.draw_rectangle_filled(self.center...
normal
{ "blob_id": "cb3c1adb9d91aecee5b21774d61dfe9400a330fa", "index": 619, "step-1": "<mask token>\n\n\nclass Paddle:\n\n def __init__(self):\n self.center = Point(390, 50)\n self.velocity = Velocity(0, 5)\n <mask token>\n\n def move_up(self):\n if self.center.y < config.SCREEN_HEIGHT - ...
[ 4, 5, 6, 7, 8 ]
# Generated by Django 3.0.1 on 2020-03-20 09:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('page', '0004_auto_20200320_1521'), ] operations = [ migrations.AddField( model_name='menu', name='level', ...
normal
{ "blob_id": "807b20f4912ab89bf73966961536a4cd4367f851", "index": 6468, "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 = [('page', '000...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 2.0.4 on 2018-04-30 14:01 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('base...
normal
{ "blob_id": "d13589979ba7b6facd8339111323270c9920a9bf", "index": 8127, "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|> def rename(dir, pattern, titlePattern): for pathAndFilename in glob.iglob(os.path.join(dir, pattern)): title, ext = os.path.splitext(os.path.basename(pathAndFilename)) hexa = title[:2] hexb = title[2:4] title = title[4:] + '_' + str(int(hexa, 16)) + '_'...
flexible
{ "blob_id": "22aa6042b77c3cfd1f102a0ea22a43223e366d2f", "index": 1476, "step-1": "<mask token>\n\n\ndef rename(dir, pattern, titlePattern):\n for pathAndFilename in glob.iglob(os.path.join(dir, pattern)):\n title, ext = os.path.splitext(os.path.basename(pathAndFilename))\n hexa = title[:2]\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class section: def __init__(self, i0, j0, subImg, Params): self.Params = Params self.subParams = {} self.subParams['wLen'] = [6.3e-07, 5.3e-07, 4.3e-07] self.subParams['subSize'] = subImg.shape self.subParams['bigSize'] = [np.int(Params['size']...
flexible
{ "blob_id": "e3c9487f3221ca89b9014b2e6470ca9d4dbc925a", "index": 2239, "step-1": "<mask token>\n\n\nclass section:\n\n def __init__(self, i0, j0, subImg, Params):\n self.Params = Params\n self.subParams = {}\n self.subParams['wLen'] = [6.3e-07, 5.3e-07, 4.3e-07]\n self.subParams['s...
[ 9, 11, 13, 15, 19 ]
from locals import * from random import choice, randint import pygame from gameobjects.vector2 import Vector2 from entity.block import Block def loadImage(filename): return pygame.image.load(filename).convert_alpha() class MapGrid(object): def __init__(self, world): self.grid = [] self.ima...
normal
{ "blob_id": "2b8f4e0c86adfbf0d4ae57f32fa244eb088f2cee", "index": 4773, "step-1": "\nfrom locals import *\nfrom random import choice, randint\n\nimport pygame\n\nfrom gameobjects.vector2 import Vector2\n\nfrom entity.block import Block\n\ndef loadImage(filename):\n return pygame.image.load(filename).convert_al...
[ 0 ]
from PIL import Image from random import randrange class PileMosaic: def __init__(self): self.width, self.height = 2380, 2800 self.filename = "pile_mosaic.png" self.crema = (240, 233, 227) self.choco = (89, 62, 53) self.luna = (43, 97, 123) self.latte = (195, 175, 14...
normal
{ "blob_id": "a484272ace089008e27f4e00d2e641118432665e", "index": 4592, "step-1": "<mask token>\n\n\nclass PileMosaic:\n\n def __init__(self):\n self.width, self.height = 2380, 2800\n self.filename = 'pile_mosaic.png'\n self.crema = 240, 233, 227\n self.choco = 89, 62, 53\n s...
[ 7, 8, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(my_randoms) <|reserved_special_token_1|> <|reserved_special_token_0|> my_randoms = random.sample(100, 10) print(my_randoms) <|reserved_special_token_1|> import random my_randoms = random.sample(100, 10) print(my_random...
flexible
{ "blob_id": "d39f6fca80f32a4d13764eb5cfb29999785b1d16", "index": 1629, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(my_randoms)\n", "step-3": "<mask token>\nmy_randoms = random.sample(100, 10)\nprint(my_randoms)\n", "step-4": "import random\nmy_randoms = random.sample(100, 10)\nprint(my_rando...
[ 0, 1, 2, 3 ]
<|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": "38a79f5b3ce1beb3dc1758880d42ceabc800ece7", "index": 8818, "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 = [('blog', '001...
[ 0, 1, 2, 3, 4 ]
from flask import Blueprint, render_template from bashtube import cache singlevideos = Blueprint('singlevideos', __name__, template_folder='templates') @singlevideos.route('/') def index(): return render_template('singlevideos/single.html')
normal
{ "blob_id": "ee10bca1126b20378c4e9cea4d2dc7ed6a2044ab", "index": 9187, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@singlevideos.route('/')\ndef index():\n return render_template('singlevideos/single.html')\n", "step-3": "<mask token>\nsinglevideos = Blueprint('singlevideos', __name__, templa...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def plot_table(timestamps: dict, threadList: list, mList: list) ->None: """Plot standard deviation chart Args: k (list): Threads/Process used deviation (list): Standard deviation of the timestamps ...
flexible
{ "blob_id": "8804bfc5bed8b93e50279f0cbab561fe09d92a64", "index": 6522, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef plot_table(timestamps: dict, threadList: list, mList: list) ->None:\n \"\"\"Plot standard deviation chart\n\n Args:\n k (list): Threads/Process used\n deviatio...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('twitter', '0002_tweet'), ] operations = [ migrations.CreateModel( name='TwitterKeys', fields=[ ...
normal
{ "blob_id": "c8406db010a506b782030c5d3f84c319851e89d6", "index": 3662, "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 = [('twitter', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> """ 复习 面向对象:考虑问题从对象的角度出发. 抽象:从多个事物中,舍弃个别的/非本质的特征(不重要), 抽出共性的本质(重要的)过程。 三大特征: 封装:将每个变化点单独分解到不同的类中。 例如:老张开车去东北 做法:定义人类,定义车类。 继承:重用现有类的功能和概念,并在此基础上进行扩展。 ...
flexible
{ "blob_id": "2749a262bf8da99aa340e878c15a6dba01acc38c", "index": 7025, "step-1": "<mask token>\n", "step-2": "\"\"\"\n 复习\n 面向对象:考虑问题从对象的角度出发.\n 抽象:从多个事物中,舍弃个别的/非本质的特征(不重要),\n 抽出共性的本质(重要的)过程。\n 三大特征:\n 封装:将每个变化点单独分解到不同的类中。\n 例如:老张开车去东北\n ...
[ 0, 1 ]
import re import os import pandas as pd instruments_file = os.path.abspath("instruments.csv") input_names_file = os.path.abspath("names.txt") output_names_file = os.path.abspath("names.csv") inst_name_file = os.path.abspath("name_instrument.csv") reg_ex = '; |, |\\*|\n' name_header = ["first_name", "last_name"] def ...
normal
{ "blob_id": "8c539dbbb762717393b9a71ddca8eb3872890854", "index": 288, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef process_names():\n \"\"\"\n Opening, reading name file and building name array.\n \"\"\"\n with open(input_names_file, 'r') as data:\n plaintext = data.read()\n ...
[ 0, 1, 2, 3, 4 ]
""" This is the main script """ import datetime import sqlite3 from sqlite3 import Error import nltk.sentiment from chatterbot import ChatBot from pythonosc import udp_client def _create_connection(db_file): """ Create a database connection to the SQLite database """ try: conn = sqlite3.connect(db_fi...
normal
{ "blob_id": "2b8b5b893d61d11d2795f5be96fde759256a15e8", "index": 9741, "step-1": "<mask token>\n\n\ndef _create_connection(db_file):\n \"\"\" Create a database connection to the SQLite database \"\"\"\n try:\n conn = sqlite3.connect(db_file)\n cur = conn.cursor()\n cur.execute('CREATE ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class GraphNN(nn.Module): def __init__(self, dim_in=7, dim_act=6, dim_h=8, dropout=0.0): super(GraphNN, self).__init__() self.ligand_dim = dim_in self.dim_h = dim_h self.dim_act = dim_act self.model_name = 'DockRLGraphNN' self.bond_cuto...
flexible
{ "blob_id": "1c1673b5e54bafef9f36a2583115f8135c112ab4", "index": 1922, "step-1": "<mask token>\n\n\nclass GraphNN(nn.Module):\n\n def __init__(self, dim_in=7, dim_act=6, dim_h=8, dropout=0.0):\n super(GraphNN, self).__init__()\n self.ligand_dim = dim_in\n self.dim_h = dim_h\n self....
[ 26, 31, 34, 35, 39 ]
#17219 tot, inp = map(int, input().split()) ID_dict = {} for _ in range(tot): id, pw = map(str, input().split()) ID_dict[id] = pw for _ in range(inp): print(ID_dict[input()])
normal
{ "blob_id": "cf7556034020d88ddb6b71b9f908c905e2f03cdb", "index": 4076, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(tot):\n id, pw = map(str, input().split())\n ID_dict[id] = pw\nfor _ in range(inp):\n print(ID_dict[input()])\n", "step-3": "tot, inp = map(int, input().split())...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CollectdCollector(Collector): """ Handle dispatching statistics to collectd. """ NAME = 'vCenter' def __init__(self, *args, **kwargs): super(CollectdCollector, self).__init__(*args, **kwargs) self.sleep_time = kwargs.get('sleep_time', 20) d...
flexible
{ "blob_id": "55f76ae1ffe0fb2d2ca2c7a20aab45ffb00cf178", "index": 613, "step-1": "<mask token>\n\n\nclass CollectdCollector(Collector):\n \"\"\"\n Handle dispatching statistics to collectd.\n\n \"\"\"\n NAME = 'vCenter'\n\n def __init__(self, *args, **kwargs):\n super(CollectdCollector, self...
[ 11, 13, 19, 20, 24 ]
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft, Intel Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------...
normal
{ "blob_id": "a61132d2d504ed31d4e1e7889bde670853968559", "index": 5739, "step-1": "<mask token>\n\n\nclass CalibraterBase:\n\n def __init__(self, model_path: Union[str, Path], op_types_to_calibrate:\n Optional[Sequence[str]]=None, augmented_model_path=\n 'augmented_model.onnx', symmetric=False, u...
[ 46, 56, 59, 60, 68 ]
import unittest import numpy import set_solver class TestSets(unittest.TestCase): def test_is_set(self): """Test set validator (Exercise 3a).""" cards = numpy.array([[1, 1, 1, 2, 0], [0, 1, 2, 2, 2], [0, 1, 2, 2, 2], [0, 1, 2, 2, 2]]) self.assertTrue(set_solver.is_set(cards, [...
normal
{ "blob_id": "6065fae2a11f6b525ef10346e297505ec9d4e9d5", "index": 8550, "step-1": "<mask token>\n\n\nclass TestSets(unittest.TestCase):\n\n def test_is_set(self):\n \"\"\"Test set validator (Exercise 3a).\"\"\"\n cards = numpy.array([[1, 1, 1, 2, 0], [0, 1, 2, 2, 2], [0, 1, 2, 2,\n 2],...
[ 2, 3, 4, 5 ]
from typing import Any, Dict from django.http import HttpRequest, HttpResponse from zerver.decorator import REQ, has_request_variables, webhook_view from zerver.lib.response import json_success from zerver.lib.webhooks.common import check_send_webhook_message, get_setup_webhook_message from zerver.models import UserP...
normal
{ "blob_id": "f60d02fb14364fb631d87fcf535b2cb5782e728f", "index": 6539, "step-1": "<mask token>\n\n\n@webhook_view('Freshping')\n@has_request_variables\ndef api_freshping_webhook(request: HttpRequest, user_profile: UserProfile,\n payload: Dict[str, Any]=REQ(argument_type='body')) ->HttpResponse:\n body = ge...
[ 1, 3, 4, 5, 6 ]
print("gist test file4")
normal
{ "blob_id": "ec4725b5b60d10e86b29aab3723917ace5cf52f6", "index": 8452, "step-1": "<mask token>\n", "step-2": "print('gist test file4')\n", "step-3": "print(\"gist test file4\")", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> class AbstractLayer(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod d...
flexible
{ "blob_id": "5a33aeffa740a41bd0bd1d80f45796ae37377a4c", "index": 757, "step-1": "<mask token>\n\n\nclass AbstractLayer(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def filter(cls, *args, **kwa...
[ 12, 17, 18, 19, 22 ]
seq = input('write a sequence of numbers: ') print(seq.split(',')) print(tuple(seq.split(',')))
normal
{ "blob_id": "be867d600f5f267986368f5573006f63004dbf9e", "index": 5094, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(seq.split(','))\nprint(tuple(seq.split(',')))\n", "step-3": "seq = input('write a sequence of numbers: ')\nprint(seq.split(','))\nprint(tuple(seq.split(',')))\n", "step-4": null...
[ 0, 1, 2 ]