code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#!/usr/bin/python # Point of origin (connector J3, pad 1, net 3V3) x = 0.0 y = 0.0 drillDiameter = 1.0 padWidth = 1.6 from os.path import exists from pad import * filename="iCEstick.kicad_mod" header = "" footer = "" if exists(filename): # Read existing footprint f = open(filename) footprint = f.read...
normal
{ "blob_id": "c71e367ad320d7eadabbbfda728d94448db6441d", "index": 2109, "step-1": "<mask token>\n", "step-2": "<mask token>\nif exists(filename):\n f = open(filename)\n footprint = f.read()\n f.close()\n headerEndIndex = footprint.find('(pad ')\n header = footprint[:headerEndIndex]\n lastPadIn...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> @gen.coroutine def pop_promotion_key(promotion_key): conn = yield connection() result = yield r.table('promotion_keys').get(promotion_key).delete( return_changes=True).run(conn) if result['changes']: return result['changes'][0]['old_val'] return None <|re...
flexible
{ "blob_id": "66cdfdfa797c9991e5cb169c4b94a1e7041ca458", "index": 4772, "step-1": "<mask token>\n\n\n@gen.coroutine\ndef pop_promotion_key(promotion_key):\n conn = yield connection()\n result = yield r.table('promotion_keys').get(promotion_key).delete(\n return_changes=True).run(conn)\n if result[...
[ 1, 2, 3, 4, 5 ]
#https://codeforces.com/problemset/problem/1321/A n=int(input()) r=list(map(int,input().split())) b=list(map(int,input().split())) l=[0]*n x=0 y=0 for i in range(n): if r[i]-b[i]==1: x+=1 elif r[i]-b[i]==-1: y+=1 if x==0: print(-1) else: print(y//x+min(y%x+1,1))
normal
{ "blob_id": "7aa6bba8483082354a94ed5c465e59a0fc97fe23", "index": 1248, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n if r[i] - b[i] == 1:\n x += 1\n elif r[i] - b[i] == -1:\n y += 1\nif x == 0:\n print(-1)\nelse:\n print(y // x + min(y % x + 1, 1))\n", "s...
[ 0, 1, 2, 3 ]
import requests import json import datetime from bs4 import BeautifulSoup from pymongo import MongoClient, UpdateOne import sys #usage: python freesound_crawler.py [from_page] [to_page] SOUND_URL = "https://freesound.org/apiv2/sounds/" SEARCH_URL = "https://freesound.org/apiv2/search/text/" AUTORIZE_URL = "https://fr...
normal
{ "blob_id": "2294dc21ede759e755e51471705fa8ef784528a7", "index": 8707, "step-1": "import requests\nimport json\nimport datetime\nfrom bs4 import BeautifulSoup\nfrom pymongo import MongoClient, UpdateOne\nimport sys\n\n#usage: python freesound_crawler.py [from_page] [to_page]\n\nSOUND_URL = \"https://freesound.or...
[ 0 ]
<|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": "3b42e218acf1c93fab3a0893efa8bf32a274eb23", "index": 448, "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 = [('interface', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> pull_links(artist) <|reserved_special_token_0|> os.remove('./links.json') shutil.rmtree('./songs') <|reserved_special_token_0|> for song in sentimentScores: print(song + ': ') print(sentimentScores[song]) <|reserved_spec...
flexible
{ "blob_id": "5055743c9ed8c92bcfab5379162f28315409ff91", "index": 2200, "step-1": "<mask token>\n", "step-2": "<mask token>\npull_links(artist)\n<mask token>\nos.remove('./links.json')\nshutil.rmtree('./songs')\n<mask token>\nfor song in sentimentScores:\n print(song + ': ')\n print(sentimentScores[song])...
[ 0, 1, 2, 3, 4 ]
import json from bottle import request, response, route, get, run, default_app app = application = default_app() @route('/candidate/hired', method=['POST']) def update_delete_handler(): response.content_type = 'application/json' return json.dumps({"hired": True}) def main(): run(host='localhost', port...
normal
{ "blob_id": "50e759ff24cdb8fbb5a98d9381afb13ebc1a74f1", "index": 7317, "step-1": "<mask token>\n\n\n@route('/candidate/hired', method=['POST'])\ndef update_delete_handler():\n response.content_type = 'application/json'\n return json.dumps({'hired': True})\n\n\n<mask token>\n", "step-2": "<mask token>\n\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def group_by_owners(files): print(files, type(files)) for k, v in files.items(): print(k, v) for f in files: print(f[0]) for g in v: print(g) _files = sorted(files.items(), key=operator.itemgetter(1), reverse=False) print('Sorted: ',...
flexible
{ "blob_id": "4843239a41fe1ecff6c8c3a97aceef76a3785647", "index": 7334, "step-1": "<mask token>\n\n\ndef group_by_owners(files):\n print(files, type(files))\n for k, v in files.items():\n print(k, v)\n for f in files:\n print(f[0])\n for g in v:\n print(g)\n _files = so...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.imshow(img_var, cmap='gray') <|reserved_special_token_0|> plt.imshow(filtered_image, cmap='gray') <|reserved_special_token_0|> plt.imshow(entropy_img) plt.hist(entropy_img.flat, bins=100, range=(0, 7)) <|reserved_special_token...
flexible
{ "blob_id": "ab6c3d3c6faa2d1fe5e064dbdebd8904b9434f15", "index": 5214, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.imshow(img_var, cmap='gray')\n<mask token>\nplt.imshow(filtered_image, cmap='gray')\n<mask token>\nplt.imshow(entropy_img)\nplt.hist(entropy_img.flat, bins=100, range=(0, 7))\n<mask t...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cursor.execute(sql) db.close() <|reserved_special_token_1|> <|reserved_special_token_0|> db = pymysql.connect('localhost', 'root', '', 'order_db', use_unicode=True, charset='utf8') cursor = db.cursor() sql = 'DROP TABLE cus...
flexible
{ "blob_id": "1aa2bff245322a34438cc836e23f430926dfac6c", "index": 3414, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute(sql)\ndb.close()\n", "step-3": "<mask token>\ndb = pymysql.connect('localhost', 'root', '', 'order_db', use_unicode=True,\n charset='utf8')\ncursor = db.cursor()\nsql ...
[ 0, 1, 2, 3, 4 ]
import unittest import ConvertListToDict as cldf class MyDictTestCase(unittest.TestCase): def test_Dict(self): # Testcase1 (len(keys) == len(values)) actualDict1 = cldf.ConvertListsToDict([1, 2, 3],['a','b','c']) expectedDict1 = {1: 'a', 2: 'b', 3: 'c'} self.assertEqual(actualDict1,...
normal
{ "blob_id": "3421c3b839721694945bdbb4f17183bceaed5296", "index": 786, "step-1": "<mask token>\n\n\nclass MyDictTestCase(unittest.TestCase):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass MyDictTestCase(unittest.TestCase):\n\n def test_Dict(self):\n actualDict1 = cldf.Conve...
[ 1, 2, 3, 4, 5 ]
""" ********************************************************************* * Project : POP1 (Practical Exam) * Program name : q2.py * Author : varunk01 * Purpose : Attempts to solve the question 2 from the exam paper * Date created : 28/05/2018 * * Date Author Ver Comment * 28/05/2018 varunk...
normal
{ "blob_id": "f7d487ec99e2fa901677ab9aec0760a396722e12", "index": 8245, "step-1": "<mask token>\n\n\ndef get_choice(attempt):\n \"\"\"\n return an integer input from the user\n \"\"\"\n try:\n user_text = ''\n if attempt == 1:\n user_text = 'Guess a number between 0 and 99:'\n...
[ 2, 3, 4, 5, 6 ]
import os from NeuralEmulator.Configurators.NormalLeakSourceConfigurator import NormalLeakSourceConfigurator from NeuralEmulator.Configurators.OZNeuronConfigurator import OZNeuronConfigurator from NeuralEmulator.Configurators.PulseSynapseConfigurator import PulseSynapseConfigurator from NeuralEmulator.NormalLeakS...
normal
{ "blob_id": "177401f25471cf1cbd32dd0770acdc12bf271361", "index": 8030, "step-1": "<mask token>\n\n\nclass NeuronsGenerator:\n\n def __init__(self, neuronsNumber, synapse, lowerBound=100.0 * 10 ** -3,\n upperBound=800.0 * 10 ** -3, randomVals=False):\n noramalLeakSourceConfigurator = NormalLeakSo...
[ 3, 4, 5, 6, 7 ]
''' Note: a TimeOutException appear when distance even 0. ''' import smbus import time #slave arduino address address_arduino = 0x04 bus = smbus.SMBus(1) #get a measure by i2c def getUSMeasure(): bus.write_byte(address_arduino, 1) distance = bus.read_byte(address_arduino) return distance #request rotate...
normal
{ "blob_id": "6fa7aef7c2b91de409a0e8574e362efefa642ee7", "index": 1715, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getUSMeasure():\n bus.write_byte(address_arduino, 1)\n distance = bus.read_byte(address_arduino)\n return distance\n\n\ndef forward():\n bus.write_byte(address_arduino...
[ 0, 2, 3, 6, 7 ]
<|reserved_special_token_0|> def write_to_file(file, line): file.write(line + '\n') <|reserved_special_token_0|> <|reserved_special_token_1|> try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET <|reserved_special_token_0|> def write_to_file(file, line): ...
flexible
{ "blob_id": "04538cc5c9c68582cc9aa2959faae2d7547ab2ee", "index": 302, "step-1": "<mask token>\n\n\ndef write_to_file(file, line):\n file.write(line + '\\n')\n\n\n<mask token>\n", "step-2": "try:\n import xml.etree.cElementTree as ET\nexcept ImportError:\n import xml.etree.ElementTree as ET\n<mask toke...
[ 1, 3, 4, 5, 6 ]
# mathematical operators ''' * multiply / divide (normal) // divide (integer) % modulus (remainder) + add - subtract ** exponent (raise to) ''' print(2 * 3) # comparison operators ''' == equal to != not equal to > greater than < less than >= greater or equal to <= less or equal t...
normal
{ "blob_id": "911257bad3baab89e29db3facb08ec41269b41e3", "index": 9953, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(2 * 3)\n<mask token>\nif a >= b:\n print('You can drive the car, you are ', a)\nelse:\n print('Sorry, you are too small')\n", "step-3": "<mask token>\nprint(2 * 3)\n<mask to...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def filter_frames(frames, method=cv2.HISTCMP_CORREL, target_size=(64, 64), threshold=0.65): """Filter noisy frames out Args: frames (list<numpy.ndarray[H, W, 3]>): video frames method (int, optional)...
flexible
{ "blob_id": "1da93e9113089f1a2881d4094180ba524d0d4a86", "index": 8531, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef filter_frames(frames, method=cv2.HISTCMP_CORREL, target_size=(64, 64),\n threshold=0.65):\n \"\"\"Filter noisy frames out\n\n Args:\n frames (list<numpy.ndarray[H,...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class HBNBCommand(cmd.Cmd): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def emptyline(self): """Do nothing""" pass def do_create(self, line): ...
flexible
{ "blob_id": "7cbf2082d530c315fdcfdb94f5c6ac4755ea2081", "index": 1267, "step-1": "<mask token>\n\n\nclass HBNBCommand(cmd.Cmd):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def emptyline(self):\n \"\"\"Do nothing\"\"\"\n pass\n\n def do_create(...
[ 9, 11, 12, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^stats/$', views.get_stats, name='stats'), url( '^follow/me/$', views.follow_me, name='follow_me'), url( '^follower/confirm/$', views.confirm_follower, name='follower_confirm'), url('^execute/', vie...
flexible
{ "blob_id": "33b68246dd3da9561c1d4adb5a3403cba656dcee", "index": 9175, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^stats/$', views.get_stats, name='stats'), url(\n '^follow/me/$', views.follow_me, name='follow_me'), url(\n '^follower/confirm/$', views.confirm_follower, name=...
[ 0, 1, 2, 3 ]
# Generated by Django 2.1.4 on 2019-04-17 03:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('historiasClinicas', '0001_initial'), ] operations = [ migrations.AlterField( model_name='actualizacion', name='valor...
normal
{ "blob_id": "4aefabf064cdef963f9c62bd5c93892207c301d3", "index": 3076, "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 = [('historiasCl...
[ 0, 1, 2, 3, 4 ]
#coding:utf-8 x = '上' res = x.encode('gbk') print(res, type(res)) print(res.decode('gbk'))
normal
{ "blob_id": "3c053bf1b572759eddcd310d185f7e44d82171a5", "index": 9153, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(res, type(res))\nprint(res.decode('gbk'))\n", "step-3": "x = '上'\nres = x.encode('gbk')\nprint(res, type(res))\nprint(res.decode('gbk'))\n", "step-4": "#coding:utf-8\n\nx = '上'\...
[ 0, 1, 2, 3 ]
# -*- encoding: utf-8 -*- #---------------------------------------------------------------------------- # # Copyright (C) 2014 . # Coded by: Borni DHIFI (dhifi.borni@gmail.com) # #---------------------------------------------------------------------------- import models import wizard import parser # vim:expa...
normal
{ "blob_id": "a3216aa41cd28b91653b99017e21a03e43372e9b", "index": 4137, "step-1": "<mask token>\n", "step-2": "import models\nimport wizard\nimport parser\n", "step-3": "# -*- encoding: utf-8 -*-\n#----------------------------------------------------------------------------\n#\n# Copyright (C) 2014 .\n# ...
[ 0, 1, 2 ]
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os try: import Image except ImportError: from PIL import Image import sys sys.path.append(os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, 'DropPy.Common'))) from file_tools import get_file_paths_from_director...
normal
{ "blob_id": "df3208a00f7a5dd1ddd76542ac0de85762cc45ab", "index": 7236, "step-1": "<mask token>\n\n\nclass Task(object):\n <mask token>\n <mask token>\n\n @staticmethod\n def rotate_file(input_file, output_dir, degrees, expand):\n output_file_name = os.path.basename(input_file)\n output_...
[ 2, 3, 4, 6, 7 ]
from flask import Flask, json, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow import warnings app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root:1234@localhost/escuela' app.config['SQLALCHEMY_TRACK_MODIFICATIONS']=False db = SQLAlche...
normal
{ "blob_id": "5c1d1eafb913822be9b6e46b15c6886f8bf3e2e1", "index": 3622, "step-1": "<mask token>\n\n\nclass curso(db.Model):\n idcurso = db.Column(db.Integer, primary_key=True)\n nombre_curso = db.Column(db.String(45))\n precio = db.Column(db.Integer)\n\n def __init__(self, nombre, precio):\n se...
[ 9, 10, 11, 13, 14 ]
class Odwroc(): def __init__(self,dane): self.dane = dane self.indeks = len(dane) def __iter__(self): return self def __next__(self): if self.indeks == 0: raise StopIteration self.indeks -= 1 return self.dane[self.indeks] for i in Odwroc('Martu...
normal
{ "blob_id": "763c0baf919b48ff135f7aa18974da5b85ee40f5", "index": 1133, "step-1": "class Odwroc:\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "class Odwroc:\n\n def __init__(self, dane):\n self.dane = dane\n self.indeks = len(dane)\n <mask token>\n\n ...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for letter in 'zYxWvUtSrQpOnMlKjIhGfEdCbA': print('{:s}'.format(letter), end='') <|reserved_special_token_1|> #!/usr/bin/python3 """ list = list(range(97, 123) for (i in list): if (i % 2 == 0): i = (i - 32) """ ...
flexible
{ "blob_id": "55a061a1c0cd20e5ab7413c671bc03573de1bbdf", "index": 7754, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor letter in 'zYxWvUtSrQpOnMlKjIhGfEdCbA':\n print('{:s}'.format(letter), end='')\n", "step-3": "#!/usr/bin/python3\n\"\"\"\nlist = list(range(97, 123)\nfor (i in list):\n if (i ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Cliente: <|reserved_special_token_0|> <|reserved_special_token_0|> def BD(self): conectar = Base_de_datos.BaseDeDatos() comando = ("INSERT INTO public.cliente(id, nombre) VALUES('" + self .id.get() + "','" + self.nombre.get() + "')") ...
flexible
{ "blob_id": "63d9aa55463123f32fd608ada83e555be4b5fe2c", "index": 6946, "step-1": "<mask token>\n\n\nclass Cliente:\n <mask token>\n <mask token>\n\n def BD(self):\n conectar = Base_de_datos.BaseDeDatos()\n comando = (\"INSERT INTO public.cliente(id, nombre) VALUES('\" + self\n ....
[ 2, 5, 6, 7, 8 ]
from django.urls import path from rest_framework.routers import DefaultRouter from . import views app_name = "rooms" router = DefaultRouter() router.register("", views.RoomViewSet) urlpatterns = router.urls # # urlpatterns = [ # # path("list/", views.ListRoomsView.as_view()), # # path("list/", views.rooms_vie...
normal
{ "blob_id": "96708216c5ffa56a60475b295c21b18225e6eed9", "index": 6056, "step-1": "<mask token>\n", "step-2": "<mask token>\nrouter.register('', views.RoomViewSet)\n<mask token>\n", "step-3": "<mask token>\napp_name = 'rooms'\nrouter = DefaultRouter()\nrouter.register('', views.RoomViewSet)\nurlpatterns = rou...
[ 0, 1, 2, 3, 4 ]
import ttk import Tkinter as tk from rwb.runner.log import RobotLogTree, RobotLogMessages from rwb.lib import AbstractRwbGui from rwb.widgets import Statusbar from rwb.runner.listener import RemoteRobotListener NAME = "monitor" HELP_URL="https://github.com/boakley/robotframework-workbench/wiki/rwb.monitor-User-Guide"...
normal
{ "blob_id": "572d58eec652207e6ec5a5e1d4c2f4310f2a70f3", "index": 1665, "step-1": "import ttk\nimport Tkinter as tk\nfrom rwb.runner.log import RobotLogTree, RobotLogMessages\nfrom rwb.lib import AbstractRwbGui\nfrom rwb.widgets import Statusbar\n\nfrom rwb.runner.listener import RemoteRobotListener\n\nNAME = \"m...
[ 0 ]
<|reserved_special_token_0|> def addOptions(parser): parser.add_option('--NNfile', default='', help= 'Config json file for the data to pass to the model') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def addOptions(parser): parser.add_option('--NNfile',...
flexible
{ "blob_id": "83a92c0b645b9a2a483a01c19a47ab5c296ccbd9", "index": 6907, "step-1": "<mask token>\n\n\ndef addOptions(parser):\n parser.add_option('--NNfile', default='', help=\n 'Config json file for the data to pass to the model')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef addOptions(parse...
[ 1, 2, 3, 4, 5 ]
def solution(n, money): save = [0] * (n+1) save[0] = 1 for i in range(len(money)): for j in range(1, n+1): if j - money[i] >= 0: save[j] += (save[j - money[i]] % 1000000007) return save[n]
normal
{ "blob_id": "deeba82536d0366b3793bcbe78f78e4cfeabb612", "index": 6241, "step-1": "<mask token>\n", "step-2": "def solution(n, money):\n save = [0] * (n + 1)\n save[0] = 1\n for i in range(len(money)):\n for j in range(1, n + 1):\n if j - money[i] >= 0:\n save[j] += sav...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class FtpDownloaderPostProcess: <|reserved_special_token_0|> <|reserved_special_token_0|> @property def logger(self): return logging.getLogger(__name__) def iterate(self, *args, **kwargs): """ Uses worker queues to perform the postprocessing :...
flexible
{ "blob_id": "56a41f432d332aaebbde15c52e133eee51b22ce1", "index": 2833, "step-1": "<mask token>\n\n\nclass FtpDownloaderPostProcess:\n <mask token>\n <mask token>\n\n @property\n def logger(self):\n return logging.getLogger(__name__)\n\n def iterate(self, *args, **kwargs):\n \"\"\"\nU...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .auth import Auth from .banDetection import BanDetectionThread from .botLogging import BotLoggingThread from .clientLauncher import ClientLauncher from .log import LogThread, Log from .mainThread import MainThread from .nexonServer import NexonServer fro...
flexible
{ "blob_id": "b7038ad73bf0e284474f0d89d6c34967d39541c0", "index": 6566, "step-1": "<mask token>\n", "step-2": "from .auth import Auth\nfrom .banDetection import BanDetectionThread\nfrom .botLogging import BotLoggingThread\nfrom .clientLauncher import ClientLauncher\nfrom .log import LogThread, Log\nfrom .mainTh...
[ 0, 1 ]
<|reserved_special_token_0|> def getScale(NumFrame, t_gt, seq_num): txt_file = open('/media/cordin/새 볼륨/rosbag/dataset/poses/{0:02d}.txt'. format(seq_num)) x_prev = float(t_gt[0]) y_prev = float(t_gt[1]) z_prev = float(t_gt[2]) line = txt_file.readlines() line_sp = line[NumFrame].split...
flexible
{ "blob_id": "73e7e43e9cfb3c0884480809bc03ade687d641d6", "index": 733, "step-1": "<mask token>\n\n\ndef getScale(NumFrame, t_gt, seq_num):\n txt_file = open('/media/cordin/새 볼륨/rosbag/dataset/poses/{0:02d}.txt'.\n format(seq_num))\n x_prev = float(t_gt[0])\n y_prev = float(t_gt[1])\n z_prev = f...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python import socket import datetime as dt import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation from matplotlib import style import pickle # Create figure for plotting time_list = [] gain_list = [] HOST = '127.0.0.1' # Standard loopba...
normal
{ "blob_id": "a4d5064decdc9963dae1712c7c6918b3e5902bf2", "index": 9825, "step-1": "<mask token>\n\n\ndef recieve_data():\n while True:\n data = conn.recv(1024)\n if not data:\n break\n conn.sendall(data)\n msg = pickle.loads(data)\n time = float(msg[0])\n ga...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def test_version(): assert __version__ == '0.1.0' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_version(): assert __version__ == '0.1.0' @pytest.mark.vcr() def test_asteroid_closest_approach(): asteroid_json = asteroid...
flexible
{ "blob_id": "7dd4dc60b23c72ba450025bececb0e6d89df69c3", "index": 8263, "step-1": "<mask token>\n\n\ndef test_version():\n assert __version__ == '0.1.0'\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef test_version():\n assert __version__ == '0.1.0'\n\n\n@pytest.mark.vcr()\ndef test_asteroid_closest...
[ 1, 2, 3, 4 ]
########################################################################## # # Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redis...
normal
{ "blob_id": "d4c297af395581c6d955eb31a842ab86e599d23c", "index": 4576, "step-1": "<mask token>\n\n\nclass TestMotionPrimitive(unittest.TestCase):\n <mask token>\n\n def testItems(self):\n m = IECoreScene.MotionPrimitive()\n m[0] = IECoreScene.PointsPrimitive(1)\n m[1] = IECoreScene.Poi...
[ 4, 5, 6, 7, 8 ]
import pygame from math import sqrt, sin, cos from numpy import arctan from os import path # try these colors or create your own! # each valid color is 3-tuple with values in range [0, 255] BLACK = (0, 0, 0) WHITE = (255, 255, 255) WHITEGRAY = (192, 192, 192) RED = (255, 0, 0) MIDRED = (192, 0, 0) DARKRED = (128, 0, 0...
normal
{ "blob_id": "838279b4f8d9e656c2f90ff06eaff3bd9c12bbef", "index": 3265, "step-1": "<mask token>\n\n\ndef next_point(p1, p2):\n diff_x = p1[0] - p2[0]\n diff_y = p1[1] - p2[1]\n angle = arctan(abs(diff_x) / abs(diff_y))\n new_diff_x = int(sin(angle) * curr_length)\n new_diff_y = int(cos(angle) * cur...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> greeting.pack() <|reserved_special_token_0|> guess.pack() <|reserved_special_token_0|> submit.pack() window.mainloop() <|reserved_special_token_1|> <|reserved_special_token_0|> secret = random.randint(1, 100) window = Tkinter.T...
flexible
{ "blob_id": "59eb705d6d388de9afbcc0df3003f4d4f45f1fbd", "index": 3989, "step-1": "<mask token>\n", "step-2": "<mask token>\ngreeting.pack()\n<mask token>\nguess.pack()\n<mask token>\nsubmit.pack()\nwindow.mainloop()\n", "step-3": "<mask token>\nsecret = random.randint(1, 100)\nwindow = Tkinter.Tk()\ngreeting...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ClusterMonitor: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ClusterMonitor: def __init__(self, cluster): self.cluster = cluster self.token = self.cluster.get_cluster_token...
flexible
{ "blob_id": "da41f26489c477e0df9735606457bd4ee4e5a396", "index": 4465, "step-1": "<mask token>\n\n\nclass ClusterMonitor:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ClusterMonitor:\n\n def __init__(self, cluster):\n self.cluster = cluster\n self.token = self.clu...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class TestForms(TestCase): <|reserved_special_token_0|> def test_wrong_data_ResearchFormMKI_form(self): with open(os.path.abspath(os.curdir) + 'Test.txt', 'wb') as f: f.write(b'ABOBA') with open(os.path.abspath(os.curdir) + 'Test.txt', 'rb') as f: ...
flexible
{ "blob_id": "c5d0b23396e084ad6ffade15b3aa3c59b6be3cc0", "index": 2706, "step-1": "<mask token>\n\n\nclass TestForms(TestCase):\n <mask token>\n\n def test_wrong_data_ResearchFormMKI_form(self):\n with open(os.path.abspath(os.curdir) + 'Test.txt', 'wb') as f:\n f.write(b'ABOBA')\n w...
[ 5, 6, 7, 8, 9 ]
from __future__ import absolute_import import itertools from django.contrib import messages from django.core.context_processors import csrf from django.db import transaction from django.http import HttpResponseRedirect from django.views.decorators.cache import never_cache from django.utils.decorators import method_de...
normal
{ "blob_id": "46f218829e1bf324d4c50ea0ff7003bc48b64e2a", "index": 4258, "step-1": "<mask token>\n\n\nclass AccountNotificationView(BaseView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass AccountNotificationView(BaseView):\n <mask token>\n\n @method_decorator(never_cache)\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def index() ->dict: return {} <|reserved_special_token_0|> @pytest.fixture def client(app): return TestClient(app) def test_request_id_can_be_autogenerated(client): response = client.get('/') assert response.headers['x-request-id'] assert RequestId.get_request_id...
flexible
{ "blob_id": "f41ab6813fb7067089abe223b9006adde40630cd", "index": 1941, "step-1": "<mask token>\n\n\ndef index() ->dict:\n return {}\n\n\n<mask token>\n\n\n@pytest.fixture\ndef client(app):\n return TestClient(app)\n\n\ndef test_request_id_can_be_autogenerated(client):\n response = client.get('/')\n a...
[ 6, 9, 10, 11, 12 ]
#!/usr/bin/env python #_*_coding:utf-8_*_ #作者:Paul哥 from fabric.api import settings,run,cd,env,hosts from fabric.colors import * env.hosts=['192.168.75.130:22'] env.password='hello123' env.user='root' def test(): with cd('/home'): print yellow(run('ls -l')) test()
normal
{ "blob_id": "6b45541c54f1a4ce94d6bd457701ecd1b90a4c4c", "index": 1129, "step-1": "#!/usr/bin/env python\n#_*_coding:utf-8_*_\n#作者:Paul哥\n\n\n\nfrom fabric.api import settings,run,cd,env,hosts\nfrom fabric.colors import *\n\nenv.hosts=['192.168.75.130:22']\nenv.password='hello123'\nenv.user='root'\ndef test():\n\...
[ 0 ]
import numpy as np import pytest import torch from ignite.contrib.metrics.regression import MeanNormalizedBias from ignite.engine import Engine from ignite.exceptions import NotComputableError def test_zero_sample(): m = MeanNormalizedBias() with pytest.raises( NotComputableError, match=r"MeanNormali...
normal
{ "blob_id": "452f35fe2ae9609949a3f92ad7768fc37094a2f1", "index": 3786, "step-1": "<mask token>\n\n\ndef test_zero_sample():\n m = MeanNormalizedBias()\n with pytest.raises(NotComputableError, match=\n 'MeanNormalizedBias must have at least one example before it can be computed'\n ):\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def run(): rand_seed = None stderr_filename = None stdout_filename = None if len(sys.argv) >= 4: rand_seed = int(sys.argv[3]) if len(sys.argv) >= 3: stderr_filename = sys.argv[2] if len(sys.argv) >= 2: stdout_filename = sys.argv[1] stdou...
flexible
{ "blob_id": "b7db0d2f4bbbc2c7763b9d2e6bede74979b65161", "index": 4283, "step-1": "<mask token>\n\n\ndef run():\n rand_seed = None\n stderr_filename = None\n stdout_filename = None\n if len(sys.argv) >= 4:\n rand_seed = int(sys.argv[3])\n if len(sys.argv) >= 3:\n stderr_filename = sys...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SuiteResultDTO: <|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|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "84c3427a994bd6c57d9fa8449e4fc7a3de801170", "index": 9271, "step-1": "<mask token>\n\n\nclass SuiteResultDTO:\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 ...
[ 13, 14, 15, 16, 21 ]
<|reserved_special_token_0|> class UserSerializer(serializers.ModelSerializer): pointseau = serializers.PrimaryKeyRelatedField(many=True, queryset= PointEau.objects.all()) class Meta: model = User fields = 'id', 'username', 'pointseau' <|reserved_special_token_1|> <|reserved_speci...
flexible
{ "blob_id": "51f171b3847b3dbf5657625fdf3b7fe771e0e004", "index": 4743, "step-1": "<mask token>\n\n\nclass UserSerializer(serializers.ModelSerializer):\n pointseau = serializers.PrimaryKeyRelatedField(many=True, queryset=\n PointEau.objects.all())\n\n\n class Meta:\n model = User\n fiel...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def euler_29(max_a, max_b): gen = (a ** b for a, b in itertools.product(range(2, max_a + 1), range( 2, max_b + 1))) return len(set(gen)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_s...
flexible
{ "blob_id": "c93bd042340a6e1d0124d8f6176bdf17ab56e405", "index": 2229, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef euler_29(max_a, max_b):\n gen = (a ** b for a, b in itertools.product(range(2, max_a + 1), range(\n 2, max_b + 1)))\n return len(set(gen))\n\n\n<mask token>\n", "st...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(0, 46): cnt_number.append(0) for i in range(0, len(df2)): for j in range(0, 7): cnt_index = df2[i][j] cnt_number[int(cnt_index)] += 1 for k in range(1, 46): print('%5d -> %3d times' % (k,...
flexible
{ "blob_id": "b257e36b3cb4bda28cf18e192aa95598105f5ae9", "index": 2705, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, 46):\n cnt_number.append(0)\nfor i in range(0, len(df2)):\n for j in range(0, 7):\n cnt_index = df2[i][j]\n cnt_number[int(cnt_index)] += 1\nfor k in...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(1, N + 1, 1): NUM = int(input('ingrese un numero entero ')) if NUM > 0: SP += NUM CP += 1 else: SO += NUM <|reserved_special_token_0|> print( f'hay {CP} numeros positivos, el ...
flexible
{ "blob_id": "efc0b8f1c4887810a9c85e34957d664b01c1e92e", "index": 1453, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, N + 1, 1):\n NUM = int(input('ingrese un numero entero '))\n if NUM > 0:\n SP += NUM\n CP += 1\n else:\n SO += NUM\n<mask token>\nprint(\n ...
[ 0, 1, 2, 3 ]
from django.views.generic import TemplateView, FormView, CreateView, ListView from .models import Order from .form import OrderForm class OrdersListView(ListView): template_name = 'orders/index.html' queryset = Order.objects.all() context_object_name = 'order_list' class OrderCreateView(CreateView): ...
normal
{ "blob_id": "afd184962e8e69843ca518e140d5fdde3d7c9ed2", "index": 7456, "step-1": "<mask token>\n\n\nclass OrderCreateView(CreateView):\n template_name = 'orders/form.html'\n form_class = OrderForm\n success_url = '/'\n", "step-2": "<mask token>\n\n\nclass OrdersListView(ListView):\n <mask token>\n ...
[ 2, 3, 4, 5 ]
import threading import serial import time bno = serial.Serial('/dev/ttyUSB0', 115200, timeout=.5) compass_heading = -1.0 def readBNO(): global compass_heading try: bno.write(b'g') response = bno.readline().decode() if response != '': compass_heading = float(response.split(...
normal
{ "blob_id": "63a7225abc511b239a69f625b12c1458c75b4090", "index": 8904, "step-1": "<mask token>\n\n\ndef readContinuous():\n while True:\n readBNO()\n time.sleep(0.1)\n\n\n<mask token>\n\n\ndef get_heading():\n return compass_heading\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef rea...
[ 2, 3, 4, 5, 7 ]
from scipy.stats import rv_discrete import torch import torch.nn.functional as F import numpy as np from utils import * def greedy_max(doc_length,px,sentence_embed,sentences,device,sentence_lengths,length_limit=200,lamb=0.2): ''' prob: sum should be 1 sentence embed: [doc_length, embed_dim] ''' x = list(range(do...
normal
{ "blob_id": "cc6e827eec5256ce0dbe13958b6178c59bcd94a7", "index": 8802, "step-1": "<mask token>\n\n\ndef compute_reward(score_batch, input_lengths, output, sentences_batch,\n reference_batch, device, sentence_lengths_batch, number_of_sample=5,\n lamb=0.1):\n reward_batch = []\n rl_label_batch = torch....
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CAresRecipe(GnuRecipe): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CAresRecipe(GnuRecipe): def __init__(self, *args, **kwargs): super(CAresRecipe, sel...
flexible
{ "blob_id": "bf7676dc2c47d9cd2f1ce2d436202ae2c5061265", "index": 8634, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CAresRecipe(GnuRecipe):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass CAresRecipe(GnuRecipe):\n\n def __init__(self, *args, **kwargs):\n super(CAresRecipe...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def increment(number: int) ->int: """Increment a number. Args: number (int): The number to increment. Returns: int: The incremented number. """ return number + 1
flexible
{ "blob_id": "b0cc2efda4d6586b66e04b41dfe1bbce8d009e2e", "index": 6871, "step-1": "<mask token>\n", "step-2": "def increment(number: int) ->int:\n \"\"\"Increment a number.\n\n Args:\n number (int): The number to increment.\n\n Returns:\n int: The incremented number.\n \"\"\"\n retu...
[ 0, 1 ]
import pickle from absl import flags from absl import app from absl import logging import time import numpy as np FLAGS = flags.FLAGS flags.DEFINE_string('sent2vec_dir', '2020-04-10/sent2vec/', 'out path') flags.DEFINE_integer('num_chunks', 36, 'how many files') flags.DEFINE_string('out_dir', '2020-04-10/', 'out pat...
normal
{ "blob_id": "8aa35bcaa4e564306125b37c70a8a92f26da736d", "index": 7418, "step-1": "<mask token>\n\n\ndef load_all_vectors(num_chunks):\n all_vectors = []\n meta_data = []\n for chunk_id in range(num_chunks):\n logging.info('Processing file %s', chunk_id)\n t = time.time()\n vectors =...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class MyIde: <|reserved_special_token_0|> class Laptop: def code(self, ide): ide.execute() <|reserved_special_token_0|> <|reserved_special_token_1|> class PyCharm: <|reserved_special_token_0|> class MyIde: def execute(self): print('MyIde running'...
flexible
{ "blob_id": "9ab3dd87f17ac75a3831e9ec1f0746ad81fad70d", "index": 501, "step-1": "<mask token>\n\n\nclass MyIde:\n <mask token>\n\n\nclass Laptop:\n\n def code(self, ide):\n ide.execute()\n\n\n<mask token>\n", "step-2": "class PyCharm:\n <mask token>\n\n\nclass MyIde:\n\n def execute(self):\n...
[ 3, 5, 7, 8, 9 ]
<|reserved_special_token_0|> class Collector: <|reserved_special_token_0|> def get_api(): parser = ConfigParser() parser.read('twitter_auth.ini') consumer_key = parser.get('Keys', 'consumer_key').strip("'") consumer_secret = parser.get('Secrets', 'consumer_secret').strip("'") ...
flexible
{ "blob_id": "372d8c8cb9ec8f579db8588aff7799c73c5af255", "index": 519, "step-1": "<mask token>\n\n\nclass Collector:\n <mask token>\n\n def get_api():\n parser = ConfigParser()\n parser.read('twitter_auth.ini')\n consumer_key = parser.get('Keys', 'consumer_key').strip(\"'\")\n co...
[ 5, 9, 11, 12, 14 ]
<|reserved_special_token_0|> def backup_db(cursor): for table in tables_schema: backup_table(cursor, table) def backup_table(cursor, table): cursor.execute(f'{tables_schema[table]}' + f"INTO OUTFILE '/tmp/{table.lower()}_data.csv' " + "FIELDS TERMINATED BY ',' " + "LINES TERMINATED B...
flexible
{ "blob_id": "fd76a7dd90bac7c7ba9201b6db62e6cb3eedeced", "index": 4390, "step-1": "<mask token>\n\n\ndef backup_db(cursor):\n for table in tables_schema:\n backup_table(cursor, table)\n\n\ndef backup_table(cursor, table):\n cursor.execute(f'{tables_schema[table]}' +\n f\"INTO OUTFILE '/tmp/{ta...
[ 4, 5, 6, 7, 9 ]
<|reserved_special_token_0|> class Player: def __init__(self, name, location): self.name = name self.location = location self.square = None self.money = 0 self.quest = None self.job = None self.phase = 'day' self.equipped_weapon = None self....
flexible
{ "blob_id": "535c0975c688a19963e4c53f6029626d286b41d6", "index": 5630, "step-1": "<mask token>\n\n\nclass Player:\n\n def __init__(self, name, location):\n self.name = name\n self.location = location\n self.square = None\n self.money = 0\n self.quest = None\n self.job...
[ 23, 31, 32, 38, 42 ]
<|reserved_special_token_0|> class bcolors: RED = '\x1b[31m' GREEN = '\x1b[32m' NORMAL = '\x1b[0m' def check_result(title, map1, map2): result = True print(title) for y in range(0, common.constants.MAP_HEIGHT): v = '' for x in range(0, common.constants.MAP_WIDTH): ...
flexible
{ "blob_id": "602d2c545c6e3eabe5c6285d2ab0c7f4216a00f5", "index": 1563, "step-1": "<mask token>\n\n\nclass bcolors:\n RED = '\\x1b[31m'\n GREEN = '\\x1b[32m'\n NORMAL = '\\x1b[0m'\n\n\ndef check_result(title, map1, map2):\n result = True\n print(title)\n for y in range(0, common.constants.MAP_HE...
[ 3, 4, 5, 6, 7 ]
import json import os import pickle import random import urllib.request from pathlib import Path import tensorflow as tf from matplotlib import pyplot as plt class CNN(object): def __init__(self): self.model = tf.keras.Sequential([ tf.keras.layers.Conv2D(32, (3, 3), activation='relu', input_...
normal
{ "blob_id": "9535335c70129f997d7b8739444a503d0b984ac8", "index": 9753, "step-1": "<mask token>\n\n\nclass CNN(object):\n\n def __init__(self):\n self.model = tf.keras.Sequential([tf.keras.layers.Conv2D(32, (3, 3),\n activation='relu', input_shape=(150, 150, 1)), tf.keras.layers.\n ...
[ 12, 13, 14, 15, 16 ]
from django.contrib import admin from django.urls import path, include from accounts import views urlpatterns = [ path('google/login', views.google_login), path('google/callback/', views.google_callback), path('accounts/google/login/finish/', views.GoogleLogin.as_view(), name = 'google_login_todjango'), ]...
normal
{ "blob_id": "68319663aad13b562e56b8ee25f25c7b548417df", "index": 4739, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('google/login', views.google_login), path(\n 'google/callback/', views.google_callback), path(\n 'accounts/google/login/finish/', views.GoogleLogin.as_view(), na...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Entity(Agent): <|reserved_special_token_0|> def __init__(self, unique_id, model): super().__init__(unique_id, model) self.type = '' self.position = '' self.log = [] self.move_probability = None self.retire_probability = None ...
flexible
{ "blob_id": "68b967ecf18d576758cf05e889919944cfc34dcd", "index": 250, "step-1": "<mask token>\n\n\nclass Entity(Agent):\n <mask token>\n\n def __init__(self, unique_id, model):\n super().__init__(unique_id, model)\n self.type = ''\n self.position = ''\n self.log = []\n se...
[ 5, 6, 7, 9, 10 ]
#/usr/share/python3 from sklearn.linear_model import LogisticRegression from sklearn.ensemble import GradientBoostingClassifier from sklearn.model_selection import train_test_split import numpy as np import seaborn as sb import pandas as pd from pmlb import fetch_data, classification_dataset_names import util # f...
normal
{ "blob_id": "4c010f9d9e7813a4ae4f592ade60130933b51958", "index": 6125, "step-1": "<mask token>\n\n\ndef score_model(X, y, model):\n train_X, test_X, train_y, test_y = train_test_split(X, y)\n model.fit(train_X, train_y)\n return model.score(test_X, test_y)\n\n\n<mask token>\n\n\ndef main():\n ds_name...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class WINRM(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def connect(self): """ Method to connect to a Windows machine. """ try: self.host_win_ip = 'http://' + self.host_ip + ':5985/wsman' self....
flexible
{ "blob_id": "96ac9088650490a7da00c7a20f634b76e673ca2d", "index": 1174, "step-1": "<mask token>\n\n\nclass WINRM(object):\n <mask token>\n <mask token>\n\n def connect(self):\n \"\"\"\n Method to connect to a Windows machine.\n \"\"\"\n try:\n self.host_win_ip =...
[ 3, 4, 5, 6, 7 ]
from __future__ import annotations from typing import TYPE_CHECKING from datetime import datetime from sqlalchemy import Column, ForeignKey, String, DateTime, Float, Integer from sqlalchemy.orm import relationship from app.db.base_class import Base if TYPE_CHECKING: from .account import Account # noqa: F401 ...
normal
{ "blob_id": "60d8276a5715899823b12ffdf132925c6f2693bd", "index": 8675, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Voucher(Base):\n __tablename__ = 't_juju_voucher'\n code = Column(String(100), index=True, unique=True)\n serial_no = Column(String(120), index=True, unique=True)\n ...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> SSMDocumentName = 'AWS-RunPowerShellScript' InstanceId = ['i-081a7260c79feb260'] Querytimeoutseconds = 3600 OutputS3BucketName = 'hccake' OutputS3KeyPrefix = 'log_' region_name = 'us-east-2' aws_access_key_id = '' aws_secret_access_key = '' workingdirectory =...
flexible
{ "blob_id": "e55fe845c18ff70ba12bb7c2db28ceded8ae9129", "index": 1580, "step-1": "<mask token>\n", "step-2": "SSMDocumentName = 'AWS-RunPowerShellScript'\nInstanceId = ['i-081a7260c79feb260']\nQuerytimeoutseconds = 3600\nOutputS3BucketName = 'hccake'\nOutputS3KeyPrefix = 'log_'\nregion_name = 'us-east-2'\naws_...
[ 0, 1, 2 ]
from urllib.request import urlopen from bs4 import BeautifulSoup import json def get_webcasts(year): url = "https://www.sans.org/webcasts/archive/" + str(year) page = urlopen(url) soup = BeautifulSoup(page, 'html.parser') table = soup.find('table', {"class": "table table-bordered table-striped"}) ...
normal
{ "blob_id": "14971842092c7aa41477f28cec87628a73a8ffd6", "index": 8407, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_webcasts(year):\n url = 'https://www.sans.org/webcasts/archive/' + str(year)\n page = urlopen(url)\n soup = BeautifulSoup(page, 'html.parser')\n table = soup.find(...
[ 0, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2017-10-27 21:59 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import phonenumber_field.modelfields class Migration(migrations.Migration): dependencies = [ ('regions', '0002_auto_2...
normal
{ "blob_id": "1330addd53c6187a41dfea6957bf47aaecca1135", "index": 7180, "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 = [('regions', '...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def parse_msg(msg): line_org = msg.split('\n') N = len(line_org) - 2 line = line_org[N] return line def get_vals(msg): rhs = msg.split('=') try: nums = rhs[1].split('/') min_num = float(nums[0]) ave_num = float(nums[1]) max_num = f...
flexible
{ "blob_id": "3f2221f5f3a699020dd5986acb793e3083976dff", "index": 7176, "step-1": "<mask token>\n\n\ndef parse_msg(msg):\n line_org = msg.split('\\n')\n N = len(line_org) - 2\n line = line_org[N]\n return line\n\n\ndef get_vals(msg):\n rhs = msg.split('=')\n try:\n nums = rhs[1].split('/'...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def integrate_sine(f, a, b, n=2): I_t = trapezoidal(f, a, b, n) I_m = midpoint() return None <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def integrate_sine(f, a, b, n...
flexible
{ "blob_id": "d99278c8f539322fd83ae5459c3121effc044b88", "index": 5193, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef integrate_sine(f, a, b, n=2):\n I_t = trapezoidal(f, a, b, n)\n I_m = midpoint()\n return None\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef integrate_sine(f, ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def plot3D(xValues, labels, figure=0): minClass = min(labels) numberOfClasses = int(max(labels) - minClass) fig = plt.figure(figure) ax = plt.axes(projection='3d') colors = ['r', 'b', 'y', 'c', 'm'] for i...
flexible
{ "blob_id": "8dfd92ab0ce0e71b41ce94bd8fcf057c8995a2a4", "index": 1668, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef plot3D(xValues, labels, figure=0):\n minClass = min(labels)\n numberOfClasses = int(max(labels) - minClass)\n fig = plt.figure(figure)\n ax = plt.axes(projection='3d')...
[ 0, 1, 2, 3 ]
#loadconc.py - possibly these classes will be added to ajustador/loader.py when ready # -*- coding:utf-8 -*- from __future__ import print_function, division import numpy as np from ajustador import xml,nrd_fitness import glob import os import operator msec_per_sec=1000 nM_per_uM=1000 nM_per_mM=1e6 class trace(ob...
normal
{ "blob_id": "20649decd3ff21b1aa814d0a04180195cac3629b", "index": 498, "step-1": "<mask token>\n\n\nclass CSV_conc(object):\n <mask token>\n <mask token>\n\n\nclass CSV_conc_set(object):\n\n def __init__(self, rootname, stim_time=0, features=[]):\n self.stim_time = stim_time * msec_per_sec\n ...
[ 3, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def execute(): for ps in frappe.get_all('Property Setter', filters={'property': '_idx' }, fields=['doc_type', 'value']): custom_fields = frappe.get_all('Custom Field', filters={'dt': ps. doc_type}...
flexible
{ "blob_id": "6f951815d0edafb08e7734d0e95e6564ab1be1f7", "index": 2375, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef execute():\n for ps in frappe.get_all('Property Setter', filters={'property': '_idx'\n }, fields=['doc_type', 'value']):\n custom_fields = frappe.get_all('Custom ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') @app.route('/index') def index(): return 'Hello world' <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') @app.route('/index') def index(): retur...
flexible
{ "blob_id": "9d8c4bf9f9279d5e30d0e9742cdd31713e5f4b9e", "index": 2104, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\n@app.route('/index')\ndef index():\n return 'Hello world'\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@app.route('/')\n@app.route('/index')\ndef index():\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class UppercaseBrandFeed(CSVMerchantFeed): def get_brand(self, obj): return obj.brand.upper() class CSVMerchantFeedTest(TestCase): def test_csv_empty(self): feed = CSVMerchantFeed([]) output = feed.get_content() self.assertEquals(output, CSV_HEA...
flexible
{ "blob_id": "924fd89a835528fa28e1226912a2e4be9c4e1d5d", "index": 152, "step-1": "<mask token>\n\n\nclass UppercaseBrandFeed(CSVMerchantFeed):\n\n def get_brand(self, obj):\n return obj.brand.upper()\n\n\nclass CSVMerchantFeedTest(TestCase):\n\n def test_csv_empty(self):\n feed = CSVMerchantFe...
[ 10, 13, 14, 16, 17 ]
"""Test suite for phlsys_tryloop.""" from __future__ import absolute_import import datetime import itertools import unittest import phlsys_tryloop # ============================================================================= # TEST PLAN # -----------------------------------------...
normal
{ "blob_id": "87130c2bbf919cacd3d5dd823cd310dcad4dc790", "index": 8157, "step-1": "\"\"\"Test suite for phlsys_tryloop.\"\"\"\n\nfrom __future__ import absolute_import\n\nimport datetime\nimport itertools\nimport unittest\n\nimport phlsys_tryloop\n\n# ==============================================================...
[ 0 ]
import numpy as np import matplotlib as plt import math from DoublePendulum import DP #imports useful modules and double pendulum class from DoublePendulum.py import json import pandas as pd import copy from pathlib import Path #accessing config file with open('config.json') as config_file: initdata = ...
normal
{ "blob_id": "c2b6e51622681ac916e860ed4ff5715808dff102", "index": 9725, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('config.json') as config_file:\n initdata = json.load(config_file)\n<mask token>\npend.updCartesian()\npend.updEnergies()\n<mask token>\nif method == 1:\n for n in range(n...
[ 0, 1, 2, 3, 4 ]
from django import forms BET_CHOICES = ( ('1', 'Will rise'), ('x', 'Will stay'), ('2', 'Will fall'), ) class NormalBetForm(forms.Form): song = forms.CharField() data = forms.ChoiceField(BET_CHOICES)
normal
{ "blob_id": "2f6d51d5c14ddc1f6cd60ab9f3b5d4a879d14af0", "index": 4590, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass NormalBetForm(forms.Form):\n song = forms.CharField()\n data = forms.ChoiceField(BET_CHOICES)\n", "step-3": "<mask token>\nBET_CHOICES = ('1', 'Will rise'), ('x', 'Will ...
[ 0, 2, 3, 4, 5 ]
# Benthic Parameters - USEPA OPP defaults from EXAMS benthic_params = { "depth": 0.05, # benthic depth (m) "porosity": 0.65, # benthic porosity "bulk_density": 1, # bulk density, dry solid mass/total vol (g/cm3) "froc": 0, # benthic organic carbon fraction "doc": 5, # benthic dissolved organic ...
normal
{ "blob_id": "5890525b16b42578ac06e7ab2170c5613feea0a5", "index": 6494, "step-1": "<mask token>\n\n\ndef partition_benthic(reach, runoff, runoff_mass, erosion_mass):\n from .parameters import soil, stream_channel, benthic\n try:\n reach = self.region.flow_file.fetch(reach)\n q, v, l = reach.q,...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def modify(nyt_url, jh_url): try: nyt_df = pd.read_csv(nyt_url, header=0, names=['Date', 'Cases', 'Deaths'], dtype={'Cases': 'Int64', 'Deaths': 'Int64'}) nyt_df['Date'] = pd.to_datetime(nyt_df['Da...
flexible
{ "blob_id": "c60971b3b0649fce8c435813de4a738f4eacda27", "index": 4377, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef modify(nyt_url, jh_url):\n try:\n nyt_df = pd.read_csv(nyt_url, header=0, names=['Date', 'Cases',\n 'Deaths'], dtype={'Cases': 'Int64', 'Deaths': 'Int64'})\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Card_profile(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|> <|reserved_special_t...
flexible
{ "blob_id": "01153a695b4744465b706acb4c417217c5e3cefd", "index": 3516, "step-1": "<mask token>\n\n\nclass Card_profile(models.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 <mask token>\n <mask token>...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/python3 # Distributed with a free-will license. # Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # ADC121C_MQ131 # This code is designed to work with the ADC121C_I2CGAS_MQ131 I2C Mini Module available from ControlEverything.com. # https://www.controleveryth...
normal
{ "blob_id": "678189ac5b0105c90178647843335f9d4402dc66", "index": 1416, "step-1": "<mask token>\n\n\ndef getOzoneData():\n data = bus.read_i2c_block_data(80, 0, 2)\n raw_adc = (data[0] & 15) * 256 + data[1]\n ppm = 1.99 * raw_adc / 4096.0 + 0.01\n return ppm\n\n\n<mask token>\n", "step-2": "<mask to...
[ 1, 2, 3, 4, 5 ]
# # romaO # www.fabiocrameri.ch/colourmaps from matplotlib.colors import LinearSegmentedColormap cm_data = [[0.45137, 0.22346, 0.34187], [0.45418, 0.22244, 0.3361], [0.45696, 0.22158, 0.33043], [0.45975, 0.2209, 0.32483], ...
normal
{ "blob_id": "5082182af5a08970568dc1ab7a53ee5337260687", "index": 45, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n import matplotlib.pyplot as plt\n import numpy as np\n try:\n from viscm import viscm\n viscm(romaO_map)\n except ImportError:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestUserRegister(BaseCase): <|reserved_special_token_0|> <|reserved_special_token_0|> def test_signup_with_non_existing_field(self): payload = json.dumps({'username': 'userjw', 'password': '1q2w3e4r', 'email': 'foo@bar.de'}) response = self.a...
flexible
{ "blob_id": "486362463dc07bdafea85de39a4a6d58cb8c8f26", "index": 9643, "step-1": "<mask token>\n\n\nclass TestUserRegister(BaseCase):\n <mask token>\n <mask token>\n\n def test_signup_with_non_existing_field(self):\n payload = json.dumps({'username': 'userjw', 'password': '1q2w3e4r',\n ...
[ 3, 5, 6, 8, 9 ]
from .login import LoginTask from .tag_search import TagSearchTask from .timeline import TimelineTask from .get_follower import GetFollowerTask from .followback import FollowBackTask from .unfollow import UnFollowTask
normal
{ "blob_id": "e899b093152ee0923f1e5ad3b5719bbf9eb4339c", "index": 7466, "step-1": "<mask token>\n", "step-2": "from .login import LoginTask\nfrom .tag_search import TagSearchTask\nfrom .timeline import TimelineTask\nfrom .get_follower import GetFollowerTask\nfrom .followback import FollowBackTask\nfrom .unfollo...
[ 0, 1 ]
<|reserved_special_token_0|> class Banana(object): id = 10 <|reserved_special_token_0|> def template_village_file(tick): """ Creates a template villages.dat file that i can modify later on """ cat = nbt.NBTFile() cat2 = cat['data'] = nbt.TAG_Compound() cat2['Villages'] = nbt.TAG_List(B...
flexible
{ "blob_id": "4e9674ea46bdf930d1e99bcda56eaa300c84deef", "index": 7196, "step-1": "<mask token>\n\n\nclass Banana(object):\n id = 10\n\n\n<mask token>\n\n\ndef template_village_file(tick):\n \"\"\"\n Creates a template villages.dat file that i can modify later on\n \"\"\"\n cat = nbt.NBTFile()\n ...
[ 14, 15, 19, 21, 23 ]
import copy import math import operator import numpy as np, pprint def turn_left(action): switcher = { (-1, 0): (0, -1), (0, 1): (-1, 0), (1, 0): (0, 1), (0, -1): (1, 0) } return switcher.get(action) def turn_right(action): switcher = { (-1, 0): (0, 1), ...
normal
{ "blob_id": "e1c68c7eb899718dd1c28dc6e95d5538c2b8ad74", "index": 4510, "step-1": "import copy\nimport math\nimport operator\n\nimport numpy as np, pprint\n\n\ndef turn_left(action):\n switcher = {\n (-1, 0): (0, -1),\n (0, 1): (-1, 0),\n (1, 0): (0, 1),\n (0, -1): (1, 0)\n\n }\n...
[ 0 ]
<|reserved_special_token_0|> @app.route('/', methods=['POST']) def hello_world(): if request.method == 'POST': json_data = request.get_data().decode('utf-8') _data = json.loads(json_data) orderNo = _data['orderNo'] name = _data['name'] idcard = _data['idcard'] mobil...
flexible
{ "blob_id": "4652cd5548b550cc21d126fc4fbe3e316ecb71b2", "index": 143, "step-1": "<mask token>\n\n\n@app.route('/', methods=['POST'])\ndef hello_world():\n if request.method == 'POST':\n json_data = request.get_data().decode('utf-8')\n _data = json.loads(json_data)\n orderNo = _data['order...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> db.drop_all() db.create_all() User.query.delete() Feedback.query.delete() <|reserved_special_token_0|> db.session.add(john) db.session.commit() <|reserved_special_token_0|> db.session.add(feed) db.session.commit() <|reserved_spe...
flexible
{ "blob_id": "d520f9d681125937fbd9dff316bdc5f922f25ff3", "index": 8050, "step-1": "<mask token>\n", "step-2": "<mask token>\ndb.drop_all()\ndb.create_all()\nUser.query.delete()\nFeedback.query.delete()\n<mask token>\ndb.session.add(john)\ndb.session.commit()\n<mask token>\ndb.session.add(feed)\ndb.session.commi...
[ 0, 1, 2, 3, 4 ]
from urllib.request import urlopen from bs4 import BeautifulSoup import re url = input('Enter - ') html = urlopen(url).read() soup = BeautifulSoup(html, "html.parser") tags = soup.find_all('tr', {'id': re.compile(r'nonplayingnow.*')}) for i in tags: casa = i.find("td", {'class': re.compile(r'team-home')}).find(...
normal
{ "blob_id": "d07a26a69ccbbccf61402632dd6011315e0d61ed", "index": 2710, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in tags:\n casa = i.find('td', {'class': re.compile('team-home')}).find('a')\n visitante = i.find('td', {'class': re.compile('team-away')}).find('a')\n print('Partido-> ' +...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def Main(): try: radius = float(input('Please enter the radius: ')) area = math.pi * radius ** 2 print('Area =', area) except: print('You did not enter a number') <|reserved_special_toke...
flexible
{ "blob_id": "33c4e0504425c5d22cefb9b4c798c3fd56a63771", "index": 3641, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef Main():\n try:\n radius = float(input('Please enter the radius: '))\n area = math.pi * radius ** 2\n print('Area =', area)\n except:\n print('You...
[ 0, 1, 2, 3, 4 ]
import os from datetime import timedelta ROOT_PATH = os.path.split(os.path.abspath(__name__))[0] DEBUG = True JWT_SECRET_KEY = 'shop' # SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format( # os.path.join(ROOT_PATH, 's_shop_flask.db')) SQLALCHEMY_TRACK_MODIFICATIONS = False user = 'shop' passwd = 'shopadmin' db = 'shop...
normal
{ "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 ]
cars=100 drivers=30 passengers=70 print "There are",cars,"cars available." print "There are only",drivers,"drivers available." print "Each driver needs to drive",passengers/drivers-1,"passengers."
normal
{ "blob_id": "b1a1287c2c3b624eb02f2955760f6e9eca8cdcf9", "index": 1241, "step-1": "cars=100\ndrivers=30\npassengers=70\nprint \"There are\",cars,\"cars available.\"\nprint \"There are only\",drivers,\"drivers available.\"\nprint \"Each driver needs to drive\",passengers/drivers-1,\"passengers.\"\n", "step-2": n...
[ 0 ]
from scipy.io import wavfile import numpy from matplotlib import pyplot as plt import librosa import noisereduce def loadWavFile(fileName, filePath, savePlot, maxAudioLength, reduceNoise = True): # Read file # rate, data = wavfile.read(filePath) # print(filePath, rate, data.shape, "audio length", data.shap...
normal
{ "blob_id": "07ac061d7d1eaf23b6c95fbcbf6753f25e568188", "index": 157, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef loadWavFile(fileName, filePath, savePlot, maxAudioLength, reduceNoise=True\n ):\n data, rate = librosa.load(filePath, sr=None)\n if reduceNoise:\n noiseRemovedData ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def cal_factor_alpha_return(factor_name, beg_date, end_date, cal_period): group_number = 8 year_trade_days = 242 min_stock_number = 100 out_path = 'E:\\3_Data\\5_stock_data\\3_alpha_model\\' alpha_remove_extreme_value = True alpha_standard = True alpha_industry...
flexible
{ "blob_id": "1d0730e8fd120e1c4bc5b89cbd766234e1fa3bca", "index": 2197, "step-1": "<mask token>\n\n\ndef cal_factor_alpha_return(factor_name, beg_date, end_date, cal_period):\n group_number = 8\n year_trade_days = 242\n min_stock_number = 100\n out_path = 'E:\\\\3_Data\\\\5_stock_data\\\\3_alpha_model...
[ 1, 2, 3, 4, 5 ]
import datetime import hashlib import json from flask import Flask, jsonify, request import requests from uuid import uuid4 from urllib.parse import urlparse from Crypto.PublicKey import RSA # Part 1 - Building a Blockchain class Blockchain: #chain(emptylist) , farmer_details(emptylist), nodes(set), cre...
normal
{ "blob_id": "f8c222b1a84a092a3388cb801a88495bc227b1d5", "index": 9748, "step-1": "<mask token>\n\n\nclass Blockchain:\n\n def __init__(self):\n self.chain = []\n self.farmer_details = []\n self.create_block(proof=1, previous_hash='0')\n self.nodes = set()\n\n def create_block(se...
[ 13, 15, 16, 18, 21 ]
<|reserved_special_token_0|> class TrafficScriptArg: <|reserved_special_token_0|> <|reserved_special_token_0|> def get_arg(self, arg_name): """Get argument value. :param arg_name: Argument name. :type arg_name: str :returns: Argument value. :rtype: str """...
flexible
{ "blob_id": "ea6d726e8163ed0f93b8078323fa5f4e9115ad73", "index": 1639, "step-1": "<mask token>\n\n\nclass TrafficScriptArg:\n <mask token>\n <mask token>\n\n def get_arg(self, arg_name):\n \"\"\"Get argument value.\n\n :param arg_name: Argument name.\n :type arg_name: str\n :...
[ 2, 3, 4, 5, 6 ]