code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def add_transactions(shard_state, collation, txqueue, shard_id, min_gasprice=0, mainchain_state=None): """Add transactions to a collation (refer to ethereum.common.add_transactions) """ if not txqueue: return pre_txs = len(collation.transactions) log.in...
flexible
{ "blob_id": "e364ba45513167966fe50e31a01f552ccedec452", "index": 6552, "step-1": "<mask token>\n\n\ndef add_transactions(shard_state, collation, txqueue, shard_id,\n min_gasprice=0, mainchain_state=None):\n \"\"\"Add transactions to a collation\n (refer to ethereum.common.add_transactions)\n \"\"\"\n...
[ 4, 5, 6, 7, 10 ]
# from the top # clean up dependencies from flask import Flask app = Flask(__name__) @app.route("/") def index(): return "<h1>Congratulations, it's a web app!</h1>" if __name__ == "__main__": app.run(host="127.0.0.1", port=8080, debug=True)
normal
{ "blob_id": "612535d95e655f2e2d2c58f41b2aa99afa7fbcbc", "index": 874, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n return \"<h1>Congratulations, it's a web app!</h1>\"\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n return \"<h1>Congratulations, it's a w...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(10): line = sys.stdin.readline() height = int(line) heights.append(height) heights.sort() heights.reverse() for i in range(3): print(heights[i]) <|reserved_special_token_1|> <|reserved_special_tok...
flexible
{ "blob_id": "3e48de2e3b12965de1b3b5cb6c3cf68c90ec6212", "index": 2274, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(10):\n line = sys.stdin.readline()\n height = int(line)\n heights.append(height)\nheights.sort()\nheights.reverse()\nfor i in range(3):\n print(heights[i])\n", ...
[ 0, 1, 2, 3 ]
# coding: utf-8 etc_dictionary = { '2 30대': '이삼십대', '20~30대': '이삼십대', '20, 30대': '이십대 삼십대', '1+1': '원플러스원', '3에서 6개월인': '3개월에서 육개월인', } english_dictionary = { 'Devsisters': '데브시스터즈', 'track': '트랙', # krbook 'LA': '엘에이', '...
normal
{ "blob_id": "ccd1e57518065963158984dda52297db45ce204e", "index": 2471, "step-1": "<mask token>\n", "step-2": "etc_dictionary = {'2 30대': '이삼십대', '20~30대': '이삼십대', '20, 30대': '이십대 삼십대',\n '1+1': '원플러스원', '3에서 6개월인': '3개월에서 육개월인'}\nenglish_dictionary = {'Devsisters': '데브시스터즈', 'track': '트랙', 'LA': '엘에이',\n ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Meters: <|reserved_special_token_0|> def indicate(self, kmh=None, amp=None, led=None): if self.pi: if kmh != None: kmh = SPEED_MAX if kmh > SPEED_MAX else kmh kmh = 0 if kmh < 0 else kmh self.pi.hardware_PW...
flexible
{ "blob_id": "25532102cc36da139a22a61d226dff613f06ab31", "index": 4714, "step-1": "<mask token>\n\n\nclass Meters:\n <mask token>\n\n def indicate(self, kmh=None, amp=None, led=None):\n if self.pi:\n if kmh != None:\n kmh = SPEED_MAX if kmh > SPEED_MAX else kmh\n ...
[ 8, 11, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app = web.application(urls, globals()) <|reserved_special_token_1|> <|reserved_special_token_0|> import web from myapp.urls import urls app = web.application(urls, globals()) <|reserved_special_token_1|> #coding=utf-8 '初始化P...
flexible
{ "blob_id": "4480b305a6f71ff64022f2b890998326bf402bf0", "index": 1669, "step-1": "<mask token>\n", "step-2": "<mask token>\napp = web.application(urls, globals())\n", "step-3": "<mask token>\nimport web\nfrom myapp.urls import urls\napp = web.application(urls, globals())\n", "step-4": "#coding=utf-8\r\n'初始...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class ZydisDisassembler(disassemblerAbstract): def diassemble(self, filename, bits='32bit'): """ Disassembly executable file return iterable instruction set. :param filename : Executable file path :type filename: str :param bit...
flexible
{ "blob_id": "fedec397ac0346bad1790315b4f85fbb1a662a4e", "index": 9466, "step-1": "<mask token>\n\n\nclass ZydisDisassembler(disassemblerAbstract):\n\n def diassemble(self, filename, bits='32bit'):\n \"\"\"\n Disassembly executable file return iterable instruction set.\n\n :param f...
[ 3, 4, 5, 6, 7 ]
# este script comprar diferente metodos de base2number from sklearn.model_selection import KFold from sklearn.model_selection import train_test_split #from matplotlib import pyplot as plt #from matplotlib import cm import matplotlib.pyplot as plt from matplotlib import pyplot import math import os import sys import ...
normal
{ "blob_id": "9696e5799d46adb5b92c0900e2064b927addfd93", "index": 2506, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor sequence_file in sequences:\n f_in = open(current_dir + '/sample_genomes/' + sequence_file, 'r')\n f_out.write(f_in.read())\n f_in.close()\n data = []\n fa_file = curre...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def list_types(): return ['application/tar'] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def list_types(): return ['application/tar'] def handle_part(data, ctype, filename, payload): if ctype == 'application/tar': dir...
flexible
{ "blob_id": "98b27c268fe1f47a899269e988ddf798faf827df", "index": 8401, "step-1": "<mask token>\n\n\ndef list_types():\n return ['application/tar']\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef list_types():\n return ['application/tar']\n\n\ndef handle_part(data, ctype, filename, payload):\n i...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print(10 - 10) print(1000 - 80) print(10 / 5) print(10 / 6) print(10 // 6) print(10 * 800) print(55 * 5) <|reserved_special_token_1|> print(10-10) print(1000-80) print(10/5) print(10/6) print(10//6) # remoção das casas decimais print(10*800) print(...
flexible
{ "blob_id": "e488761c15ee8cddbb7577d5340ee9001193c1a4", "index": 4767, "step-1": "<mask token>\n", "step-2": "print(10 - 10)\nprint(1000 - 80)\nprint(10 / 5)\nprint(10 / 6)\nprint(10 // 6)\nprint(10 * 800)\nprint(55 * 5)\n", "step-3": "print(10-10)\r\nprint(1000-80)\r\nprint(10/5)\r\nprint(10/6)\r\nprint(10/...
[ 0, 1, 2 ]
def countdown(n): def next(): nonlocal n r = n n -= 1 return r return next a = countdown(12) while True: v = a() if not v: break
normal
{ "blob_id": "01eef391f6d37d1e74cb032c5b27e1d8fc4395da", "index": 6122, "step-1": "<mask token>\n", "step-2": "def countdown(n):\n\n def next():\n nonlocal n\n r = n\n n -= 1\n return r\n return next\n\n\n<mask token>\n", "step-3": "def countdown(n):\n\n def next():\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open(file_one) as fo: reader = csv.reader(fo) header = next(reader) album = {} dates, cd_income, dd_income, total_profit, artist_payout = [], [], [], [ ], [] for row in reader: if row[2].st...
flexible
{ "blob_id": "53380810a3d9787fe7c373cf1829f2d849a91c3c", "index": 8456, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open(file_one) as fo:\n reader = csv.reader(fo)\n header = next(reader)\n album = {}\n dates, cd_income, dd_income, total_profit, artist_payout = [], [], [], [\n ]...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @utils.part def part_1(): commands = ['south', 'take food ration', 'west', 'north', 'north', 'east', 'take astrolabe', 'west', 'south', 'south', 'east', 'north', 'east', 'south', 'take weather machine', 'west...
flexible
{ "blob_id": "e3aa38b5d01823ed27bca65331e9c7315238750a", "index": 8974, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@utils.part\ndef part_1():\n commands = ['south', 'take food ration', 'west', 'north', 'north',\n 'east', 'take astrolabe', 'west', 'south', 'south', 'east', 'north',\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def parse_and_print_args(): fields = None in_args = None if request.args is not None: in_args = dict(copy.copy(request.args)) fields = copy.copy(in_args.get('fields', None)) if fields: del in_args['fields'] offset = copy.copy(in_args...
flexible
{ "blob_id": "d03a8076b77851ae4df5cf657ff898eb132c49c3", "index": 5616, "step-1": "<mask token>\n\n\ndef parse_and_print_args():\n fields = None\n in_args = None\n if request.args is not None:\n in_args = dict(copy.copy(request.args))\n fields = copy.copy(in_args.get('fields', None))\n ...
[ 7, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @guest_calendar_post.route('/calendars/<link_id>/bookings/', methods=['POST']) @expects_json(guest_calendar_schema) def booking(link_id): request_body = request.get_json() link = get_link(link_id) if link is None: ...
flexible
{ "blob_id": "75ef5dd2b82cf79819f18045559f9850c74bb55a", "index": 5565, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@guest_calendar_post.route('/calendars/<link_id>/bookings/', methods=['POST'])\n@expects_json(guest_calendar_schema)\ndef booking(link_id):\n request_body = request.get_json()\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': filename = 'example_payloads/payload1.json' data = open(filename, 'rb').read() headers = {'Accept': 'application/json', 'Content-Type': 'application/json' } response = requests.po...
flexible
{ "blob_id": "255130082ee5f8428f1700b47dee717465fed72f", "index": 4067, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n filename = 'example_payloads/payload1.json'\n data = open(filename, 'rb').read()\n headers = {'Accept': 'application/json', 'Content-Type': 'applicat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> disp.begin() disp.clear() disp.display() <|reserved_special_token_1|> <|reserved_special_token_0|> RST = 24 DC = 23 SPI_PORT = 0 SPI_DEVICE = 0 disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.SpiDev( SPI_PORT...
flexible
{ "blob_id": "d8cbed25f4c97be5a74a6e1f097fcb9fa9439a9a", "index": 8160, "step-1": "<mask token>\n", "step-2": "<mask token>\ndisp.begin()\ndisp.clear()\ndisp.display()\n", "step-3": "<mask token>\nRST = 24\nDC = 23\nSPI_PORT = 0\nSPI_DEVICE = 0\ndisp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.S...
[ 0, 1, 2, 3, 4 ]
from django.db import models from django.contrib.auth.models import AbstractUser from django.core.validators import MinLengthValidator, MaxLengthValidator, RegexValidator from pizzaclub.settings import MAX_DNI_LENGTH, MAX_CUIL_LENGTH, PASSWORD_RESET_TIMEOUT from pizzaclub.settings import MIN_DNI_LENGTH, MIN_CUIL_LENGT...
normal
{ "blob_id": "b7511c156c241accaf1668d83ee0a5263b41af0d", "index": 3465, "step-1": "<mask token>\n\n\nclass User(AbstractUser):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def check_token(self, token):\n \"\"\"\n ...
[ 8, 13, 15, 16, 18 ]
from flask.ext.wtf import Form from wtforms import TextField from wtforms.validators import Required class VerifyHandphoneForm(Form): handphone_hash = TextField('Enter verification code here', validators=[ Required()])
normal
{ "blob_id": "cb0df06ee474576b3024678fa0f63ce400d773ea", "index": 4096, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass VerifyHandphoneForm(Form):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass VerifyHandphoneForm(Form):\n handphone_hash = TextField('Enter verification code here', ...
[ 0, 1, 2, 3 ]
class State: def __init__(self, id): self.id = id def NotinClosed(problem, node): #restituisce 1 se lo stato non è stato già visitato (al netto di controlli sulla depth) è quindi bisogna aggiungerlo NotVisited = 1 for tuple in problem.closed: if node.state.id == tuple[0].id and node.depth...
normal
{ "blob_id": "200deda300e39b07e0e558277a340b7ad01c7dee", "index": 2216, "step-1": "<mask token>\n", "step-2": "class State:\n <mask token>\n\n\n<mask token>\n", "step-3": "class State:\n\n def __init__(self, id):\n self.id = id\n\n\n<mask token>\n", "step-4": "class State:\n\n def __init__(s...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if u_avg < u_bat_min: print('proper shut down of the machine due to low battery') else: print('tout va bien dormez braves gens') <|reserved_special_token_1|> <|reserved_special_token_0|> pidcmes = Pidcmes() u_bat_min = ...
flexible
{ "blob_id": "67b967b688aeac1270eee836e0f6e6b3555b933e", "index": 5, "step-1": "<mask token>\n", "step-2": "<mask token>\nif u_avg < u_bat_min:\n print('proper shut down of the machine due to low battery')\nelse:\n print('tout va bien dormez braves gens')\n", "step-3": "<mask token>\npidcmes = Pidcmes()...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class InsertWord(Operation): @classmethod def getValue(cls, t, h, w, b, arg=None): return math.log(arg['prob']) * w[cls] <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def transFormT_H(cls, t_h, arg=None): parentNodeIndex =...
flexible
{ "blob_id": "355e3932c8bd9105e0c1ce9259e3b7416997523c", "index": 3668, "step-1": "<mask token>\n\n\nclass InsertWord(Operation):\n\n @classmethod\n def getValue(cls, t, h, w, b, arg=None):\n return math.log(arg['prob']) * w[cls]\n <mask token>\n <mask token>\n\n @classmethod\n def transF...
[ 3, 4, 5, 6, 7 ]
from Models.AdminPageModel import AdminPageModel class StudentDebtsController: def __init__(self, master, model, view): self._master = master self._model = model self._view = view def BackToAdminPage(self): from Views.AdminPage import AdminPage self._master.switch_fra...
normal
{ "blob_id": "8aacc8dbfdd70d24689ae17b9c29b1ffc80fb231", "index": 9013, "step-1": "<mask token>\n\n\nclass StudentDebtsController:\n\n def __init__(self, master, model, view):\n self._master = master\n self._model = model\n self._view = view\n <mask token>\n <mask token>\n <mask t...
[ 2, 3, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: myclient = pymongo.MongoClient('mongodb://localhost:27017/') myclient.server_info() print('Database Connected') except: print('Database Error') <|reserved_special_token_0|> <|reserved_special_token_1|> <|re...
flexible
{ "blob_id": "aafdd228cf2859d7f013b088263eab544e19c481", "index": 9995, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n myclient.server_info()\n print('Database Connected')\nexcept:\n print('Database Error')\n<mask token>\n",...
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 """ Upbit Open API ## REST API for Upbit Exchange - Base URL: [https://api.upbit.com] - Official Upbit API Documents: [https://docs.upbit.com] - Official Support email: [open-api@upbit.com] # noqa: E501 OpenAPI spec version: 1.0.0 Contact: ujhin942@gmail.com Generated by: https:...
normal
{ "blob_id": "b9bd1c0f4a5d2e6eeb75ba4f27d33ad5fb22530e", "index": 557, "step-1": "<mask token>\n\n\nclass DepositCompleteResponse(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @property\n def currency(self):\n \"\"\"Gets the currency of this De...
[ 6, 9, 11, 16, 17 ]
######################################## __author__ = "Abdelrahman Eldesokey" __license__ = "GNU GPLv3" __version__ = "0.1" __maintainer__ = "Abdelrahman Eldesokey" __email__ = "abdo.eldesokey@gmail.com" ######################################## import torch import torch.nn.functional as F import torch.nn as nn from to...
normal
{ "blob_id": "64b4deaad548a38ba646423d33fc6a985483a042", "index": 3592, "step-1": "<mask token>\n\n\nclass NConv2d(_ConvNd):\n <mask token>\n <mask token>\n\n def init_parameters(self):\n if self.init_method == 'x':\n torch.nn.init.xavier_uniform_(self.weight)\n elif self.init_me...
[ 15, 17, 18, 19, 21 ]
# -*- coding: utf-8 -*- ############################################################################### # This file is part of metalibm (https://github.com/kalray/metalibm) ############################################################################### # MIT License # # Copyright (c) 2018 Kalray # # Permission is here...
normal
{ "blob_id": "3a05ebee8e70321fe53637b4792f5821ce7044be", "index": 4264, "step-1": "<mask token>\n\n\ndef evaluate_comparison_range(node):\n \"\"\" evaluate the numerical range of Comparison node, if any\n else returns None \"\"\"\n return None\n\n\ndef is_comparison(node):\n \"\"\" test if node is...
[ 14, 15, 16, 17, 18 ]
# -*- coding: utf-8 -*- from flask import Blueprint, render_template, flash, redirect, url_for from flask_login import login_required, current_user from ..extensions import db from .forms import MyTaskForm from .models import MyTaskModel tasks = Blueprint('tasks', __name__, url_prefix='/tasks') @tasks.route('/my...
normal
{ "blob_id": "7882504f08e871f2610ff633608eb3d380179041", "index": 1735, "step-1": "<mask token>\n\n\n@tasks.route('/my_tasks', methods=['GET', 'POST'])\n@login_required\ndef my_tasks():\n _all_tasks = MyTaskModel.query.filter_by(users_id=current_user.id).all()\n return render_template('tasks/my_tasks.html',...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> omniORB.updateModule('managedElementManager') <|reserved_special_token_0|> <|reserved_special_token_1|> import omniORB omniORB.updateModule('managedElementManager') import managedElementManager_idl <|reserved_special_token_1|...
flexible
{ "blob_id": "7727896d4e1b2b415c398b206f9fb7e228e6f26d", "index": 8602, "step-1": "<mask token>\n", "step-2": "<mask token>\nomniORB.updateModule('managedElementManager')\n<mask token>\n", "step-3": "import omniORB\nomniORB.updateModule('managedElementManager')\nimport managedElementManager_idl\n", "step-4"...
[ 0, 1, 2, 3 ]
import pygame import os from network import Network from card import Card from game import Game, Player pygame.font.init() # Initializing window WIDTH, HEIGHT = 700, 800 WIN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Zole") CARD_WIDTH = 60 ############################## Uploading cards de...
normal
{ "blob_id": "9c478c59398618d0e447276f9ff6c1c143702f12", "index": 2360, "step-1": "<mask token>\n\n\ndef get_card_size(card_width, image):\n card_height = image.get_height() / (image.get_width() / card_width)\n return round(card_height)\n\n\n<mask token>\n\n\ndef upload_card_images(card_name):\n card_n =...
[ 6, 7, 8, 9, 10 ]
# Generated by Django 3.1.6 on 2021-04-22 07:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0004_project_is_featured'), ] operations = [ migrations.AlterField( model_name='project', name='pin_id',...
normal
{ "blob_id": "24ed29dfaaf7ce508b2d80740bad1304b291c596", "index": 8466, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('projects', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Ridge(object): """A ridge. Attributes: - `E_r`: Equality set of a facet - `ar, br`: Affine hull of the facet s.t. P_{E_0} = P intersection {x | ar x = br}. """ def __init__(self, E, a, b): self.E_r = E self.ar = a self.br = b...
flexible
{ "blob_id": "707c83bc83f606b570af973094574e6675cfc83f", "index": 8793, "step-1": "<mask token>\n\n\nclass Ridge(object):\n \"\"\"A ridge.\n\n Attributes:\n\n - `E_r`: Equality set of a facet\n\n - `ar, br`: Affine hull of the facet\n s.t. P_{E_0} = P intersection {x | ar x = br}.\n \"\"\"\n\n...
[ 7, 9, 16, 18, 20 ]
import cv2 import numpy as np img1 = cv2.imread('img0008.jpg') img2 = cv2.imread('img0009.jpg') #img3 = cv2.imread('img0009.jpg') img3 = np.zeros(img1.shape) iter = 51 def sumas(ux, uy, wx, wy, dx, dy, img_i, img_j): suma = 0 x = ux - wx y = uy - wy while x < ux + wx: while y < uy + wy: ...
normal
{ "blob_id": "749e6a1f807843c9e2591f51561174cc51668b11", "index": 1588, "step-1": "<mask token>\n\n\ndef sumas(ux, uy, wx, wy, dx, dy, img_i, img_j):\n suma = 0\n x = ux - wx\n y = uy - wy\n while x < ux + wx:\n while y < uy + wy:\n xdx = x + dx if x + dx < img1.shape[0] else x\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(parsed_json2) <|reserved_special_token_1|> <|reserved_special_token_0|> fake_header = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36...
flexible
{ "blob_id": "166a1dfbd3baf766230080361d98648ec0a64455", "index": 1038, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(parsed_json2)\n", "step-3": "<mask token>\nfake_header = {'user-agent':\n 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 import argparse from glob import glob import sys import numpy as np import matplotlib.pyplot as plt import pysam import math import pandas as pd import haplotagging_stats import os import collections import seaborn as sns NUM_CONTIGS="num_contigs" TOTAL_LEN="total_len" HAPLOTYPE="haplotype" HAPL...
normal
{ "blob_id": "0c7816028e6cbd12684b0c7484835e735f1d2838", "index": 4327, "step-1": "<mask token>\n\n\ndef parse_args(args=None):\n parser = argparse.ArgumentParser(\n 'Plots information from haplotagging_stats tsv')\n parser.add_argument('--input_csv', '-i', dest='input_csv', default=None,\n re...
[ 3, 5, 6, 7, 8 ]
# uncompyle6 version 3.2.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] # Embedded file name: filecmp import os, stat from itertools import ifilter, ifilterfalse, imap, izip __all__ = [ 'cmp', 'dircmp', 'cmpfiles'] _cache = {} BU...
normal
{ "blob_id": "38f6700b283bdc68a0271cb3ec397ce72aa2de3c", "index": 6589, "step-1": "# uncompyle6 version 3.2.4\n# Python bytecode 2.7 (62211)\n# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]\n# Embedded file name: filecmp\nimport os, stat\nfrom itertools imp...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if not os.path.exists(directory): os.makedirs(directory) <|reserved_special_token_0|> if not file_exists: x = open(op, 'w') x.write(rand_facts) <|reserved_special_token_1|> <|reserved_special_token_0|> directory = '...
flexible
{ "blob_id": "a2c93fd632a637d47f05e0a4fda851b465d03a31", "index": 4674, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not os.path.exists(directory):\n os.makedirs(directory)\n<mask token>\nif not file_exists:\n x = open(op, 'w')\n x.write(rand_facts)\n", "step-3": "<mask token>\ndirectory =...
[ 0, 1, 2, 3, 4 ]
from src.config import Config mock = { "entities": { "foo": [ "bar", "foobar" ] }, "synonimous": { "fizz": [ "fizzfuzz", "fuzz"] }, "templates": [ { "text": "{synonimous.fizz} and {entities.foo}", "intention": "fizzfoo" } ] } def test_sho...
normal
{ "blob_id": "987f8ce668f2002b731822fa5f3de143a80aaafe", "index": 9807, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_should_config_start_correctly():\n c = Config(mock)\n assert c._entities == mock['entities']\n assert c._synonimous == mock['synonimous']\n assert c.templates == ...
[ 0, 1, 2, 3, 4 ]
# day one question 1 solution # find product of two numbers in input.txt list that sum to 2020 # pull everything out of input file nums = [] with open('input.txt', 'r') as file: for line in file: nums.append(int(line)) target = 0 product = 0 # for each number in the input, figure out what it's complement...
normal
{ "blob_id": "38504dae7b010c2df8c16b752c2179b6b3561c0e", "index": 7770, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('input.txt', 'r') as file:\n for line in file:\n nums.append(int(line))\n<mask token>\nfor ini in nums:\n target = 2020 - ini\n for chk in nums:\n if chk ...
[ 0, 1, 2, 3 ]
import tensorflow as tf import keras import numpy as np def house_model(y_new): xs = np.array([0, 1, 2, 4, 6, 8, 10], dtype=float) # Your Code Here# ys = np.array([0.50, 0.100, 1.50, 2.50, 3.50, 4.50, 5.50], dtype=float) # Your Code Here# model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape...
normal
{ "blob_id": "0b3f16ee9b287c6c77acde674abec9deb4053c83", "index": 946, "step-1": "<mask token>\n\n\ndef house_model(y_new):\n xs = np.array([0, 1, 2, 4, 6, 8, 10], dtype=float)\n ys = np.array([0.5, 0.1, 1.5, 2.5, 3.5, 4.5, 5.5], dtype=float)\n model = tf.keras.Sequential([keras.layers.Dense(units=1, inp...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> api.add_resource(Store, '/store/<string:name>') api.add_resource(Item, '/item/<string:name>') api.add_resource(ItemList, '/items') api.add_resource(StoreList, '/stores') api.add_resource(UserRegister, '/register') if __name__ == '...
flexible
{ "blob_id": "7525691ece4fe66bb175e470db3ac78f701e3730", "index": 199, "step-1": "<mask token>\n", "step-2": "<mask token>\napi.add_resource(Store, '/store/<string:name>')\napi.add_resource(Item, '/item/<string:name>')\napi.add_resource(ItemList, '/items')\napi.add_resource(StoreList, '/stores')\napi.add_resour...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MendeleyViewsTestCase(OsfTestCase): def setUp(self): super(MendeleyViewsTestCase, self).setUp() self.account = MendeleyAccountFactory() self.user = AuthUserFactory(external_accounts=[self.account]) self.account.display_name = self.user.fullname ...
flexible
{ "blob_id": "f69351474fb3eb48eeb65eaf1aa46d2f4a390471", "index": 1887, "step-1": "<mask token>\n\n\nclass MendeleyViewsTestCase(OsfTestCase):\n\n def setUp(self):\n super(MendeleyViewsTestCase, self).setUp()\n self.account = MendeleyAccountFactory()\n self.user = AuthUserFactory(external_...
[ 11, 14, 16, 20, 25 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @itchat.msg_register(itchat.content.TEXT) def text_reply(msg): return msg.text <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @itchat.msg_register(itchat.content.TEXT) def text_...
flexible
{ "blob_id": "2b87b8571664989e78790bd9df23eee9cbd44035", "index": 1363, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@itchat.msg_register(itchat.content.TEXT)\ndef text_reply(msg):\n return msg.text\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\n@itchat.msg_register(itchat.content.TEXT)\nde...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TestShellBootstrap(object): <|reserved_special_token_0|> def tearDown(self): self.shell.restore() <|reserved_special_token_0|> def _test_bootstrap_stream_type(self, attr): assert_is_instance(getattr(sys, attr), ThreadLocalStream) <|reserved_spec...
flexible
{ "blob_id": "1983340b3ce7ba8b631ba090871bea1ef7044943", "index": 9333, "step-1": "<mask token>\n\n\nclass TestShellBootstrap(object):\n <mask token>\n\n def tearDown(self):\n self.shell.restore()\n <mask token>\n\n def _test_bootstrap_stream_type(self, attr):\n assert_is_instance(getatt...
[ 7, 10, 12, 13 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> 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')] <|reserve...
flexible
{ "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 ]
#!/usr/bin/env python3 from flask import Flask, request from flask_restplus import Resource, Api, fields from pymongo import MongoClient from bson.objectid import ObjectId import requests, datetime, re #------------- CONFIG CONSTANTS -------------# DEBUG = True MAX_PAGE_LIMIT = 2 COLLECTION = 'indicators' DB_CONFIG =...
normal
{ "blob_id": "75958b48a3372b56e072a0caa468171ab6b99eb6", "index": 8917, "step-1": "<mask token>\n\n\n@api.route(f'/{COLLECTION}/<collection_id>', endpoint=f'{COLLECTION}_by_id')\n@api.param('collection_id', f'Unique id, used to distinguish {COLLECTION}.')\nclass CollectionsById(Resource):\n\n @api.doc(descript...
[ 7, 11, 15, 16, 19 ]
<|reserved_special_token_0|> class MaoyanSpider(object): def __init__(self): self.url = 'https://maoyan.com/board/4?offset={}' def get_html(self, url): headers = {'User-Agent': random.choice(ua_list)} req = request.Request(url=url, headers=headers) res = request.urlopen(req) ...
flexible
{ "blob_id": "7ef0bb3e8cbba4a29249a09cf7bc91e053411361", "index": 2225, "step-1": "<mask token>\n\n\nclass MaoyanSpider(object):\n\n def __init__(self):\n self.url = 'https://maoyan.com/board/4?offset={}'\n\n def get_html(self, url):\n headers = {'User-Agent': random.choice(ua_list)}\n ...
[ 6, 9, 10, 11, 12 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/7/10 14:26 # @Author : MengHe # @File : c1.py # @Software: PyCharm import re a = 'Python|Java|C#|C++|Kotlin|JavaScript' r = re.findall('Java', a) print(r) # print(a.index('Python') > -1) # print('Kotlin' in a)
normal
{ "blob_id": "e05f545ca969e0c2330779ed54a33a594d6ebb25", "index": 2501, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(r)\n", "step-3": "<mask token>\na = 'Python|Java|C#|C++|Kotlin|JavaScript'\nr = re.findall('Java', a)\nprint(r)\n", "step-4": "import re\na = 'Python|Java|C#|C++|Kotlin|JavaScri...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(t) <|reserved_special_token_1|> <|reserved_special_token_0|> t = dt.datetime.today() print(t) <|reserved_special_token_1|> <|reserved_special_token_0|> import datetime as dt t = dt.datetime.today() print(t) <|reserve...
flexible
{ "blob_id": "b1fbc8f3616b70e5d35898fd895c37e838c87dc9", "index": 9293, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(t)\n", "step-3": "<mask token>\nt = dt.datetime.today()\nprint(t)\n", "step-4": "<mask token>\nimport datetime as dt\nt = dt.datetime.today()\nprint(t)\n", "step-5": "# -*- co...
[ 0, 1, 2, 3, 4 ]
__author__ = 'laispace.com' import sqlite3 dbname = 'alloyteam.db' def createTable(): conn = sqlite3.connect(dbname) c = conn.cursor() c.execute('''CREATE TABLE IF NOT EXISTS posts (url text primary key, title text, date text, authorLink ...
normal
{ "blob_id": "602df213c0d588404597c566001cd9c96b5034d0", "index": 4530, "step-1": "<mask token>\n\n\ndef createPosts(posts):\n conn = sqlite3.connect(dbname)\n c = conn.cursor()\n for post in posts:\n c.execute('INSERT OR REPLACE INTO posts VALUES (?,?,?,?,?,?)', post)\n conn.commit()\n conn...
[ 3, 4, 5, 6, 7 ]
# -*- encoding: utf-8 -*- """ Created by eniocc at 11/10/2020 """ import ctypes from py_dss_interface.models.Base import Base class MonitorsS(Base): """ This interface can be used to read/write certain properties of the active DSS object. The structure of the interface is as follows: CStr Monit...
normal
{ "blob_id": "f6f0dcb806fbc1e14c0907dd500fdc6a609a19f7", "index": 5598, "step-1": "<mask token>\n\n\nclass MonitorsS(Base):\n <mask token>\n <mask token>\n <mask token>\n\n def monitors_write_name(self, argument) ->str:\n \"\"\"Sets the active Monitor object by name.\"\"\"\n result = cty...
[ 3, 4, 6, 7, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if re.findall(pattern, n): print(n, 'は電話番号の形式です') else: print(n, 'は電話番号の形式ではありません') <|reserved_special_token_1|> <|reserved_special_token_0|> n = input('電話番号を入力してください>>') pattern = ( '[\\(]{0,1}[0-9]{2,4}[\\)\\-\\(]...
flexible
{ "blob_id": "7ea81f83f556fcc55c9c9d44bcd63c583829fc08", "index": 8977, "step-1": "<mask token>\n", "step-2": "<mask token>\nif re.findall(pattern, n):\n print(n, 'は電話番号の形式です')\nelse:\n print(n, 'は電話番号の形式ではありません')\n", "step-3": "<mask token>\nn = input('電話番号を入力してください>>')\npattern = (\n '[\\\\(]{0,1}[...
[ 0, 1, 2, 3, 4 ]
# from https://web.archive.org/web/20121220025758/http://xkcd.com/actuary.py.txt # script written by Randall Munroe. Most comments by Emily Cain (although there were a few brief ones explaining how the program worked before I looked at it) # Summary of program (by Emily): # this program takes inputs of current ages ...
normal
{ "blob_id": "f0702c8555ef07aac9e667c35b5b5fd85820ec54", "index": 4355, "step-1": "# from https://web.archive.org/web/20121220025758/http://xkcd.com/actuary.py.txt\n\n# script written by Randall Munroe. Most comments by Emily Cain (although there were a few brief ones explaining how the program worked before I lo...
[ 0 ]
def ip_address(address): new_address = "" split_address = address.split(".") seprator = "[.]" new_address = seprator.join(split_address) return new_address if __name__ == "__main__": ipaddress = ip_address("192.168.1.1") print(ipaddress)
normal
{ "blob_id": "7ef62e5545930ab13312f8ae1ea70a74386d8bfa", "index": 1231, "step-1": "<mask token>\n", "step-2": "def ip_address(address):\n new_address = ''\n split_address = address.split('.')\n seprator = '[.]'\n new_address = seprator.join(split_address)\n return new_address\n\n\n<mask token>\n"...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for file in file_list_excel: """遍历所有excel文件,删除空行""" file_path = os.path.join(file_dir, file) df = pd.read_excel(file_path) data = pd.DataFrame(df.iloc[:, :]).dropna(axis=0, how='any') new_list.append(data) <|re...
flexible
{ "blob_id": "ea646068d48a9a4b5a578a5fb1399d83a4812b02", "index": 1134, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor file in file_list_excel:\n \"\"\"遍历所有excel文件,删除空行\"\"\"\n file_path = os.path.join(file_dir, file)\n df = pd.read_excel(file_path)\n data = pd.DataFrame(df.iloc[:, :]).dro...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class VideoClassifier: def __init__(self, train_mode='late_fusion', video_model_path=None, time_step=16, base_path='/user/vlongobardi/AFEW/aligned/', feature_name='emobase2010_100', stride=1): self.time_step = time_step self.train_mode = train_mode ...
flexible
{ "blob_id": "c925bed2f4d8120e156caebbe8e6bf9d6a51ee37", "index": 3330, "step-1": "<mask token>\n\n\nclass VideoClassifier:\n\n def __init__(self, train_mode='late_fusion', video_model_path=None,\n time_step=16, base_path='/user/vlongobardi/AFEW/aligned/',\n feature_name='emobase2010_100', stride...
[ 7, 11, 13, 14, 18 ]
from .context import mango from solana.publickey import PublicKey def test_token_lookup(): data = { "tokens": [ { "address": "So11111111111111111111111111111111111111112", "symbol": "SOL", "name": "Wrapped SOL", "decimals": 9, ...
normal
{ "blob_id": "5e7a589af69a604021ed9558fcce721a8e254fee", "index": 5269, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_token_lookups_with_full_data():\n token_lookup = mango.SplTokenLookup.load(mango.SplTokenLookup.\n DefaultDataFilepath)\n assert token_lookup.find_by_symbol('BTC...
[ 0, 1, 2, 3, 4 ]
import torch from torch import nn from torch.nn import functional as F from models.blocks import UnetConv3, MultiAttentionBlock, UnetGridGatingSignal3, UnetUp3_CT, UnetDsv3 class AttentionGatedUnet3D(nn.Module): """ Attention Gated Unet for 3D semantic segmentation. Args: config: Mus...
normal
{ "blob_id": "55a392d63838cbef027f9cf525999c41416e3575", "index": 3875, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass AttentionGatedUnet3D(nn.Module):\n <mask token>\n\n def __init__(self, config):\n super(AttentionGatedUnet3D, self).__init__()\n assert hasattr(config, 'num_...
[ 0, 3, 4, 5, 6 ]
import re s=input('enter the string:') def end_num(s): text = re.compile(r".*[0-9]$") if text.match(s): return 'Yes!Number is present at the end of string' else: return 'No!Number is not present at the end of string' print(end_num(s))
normal
{ "blob_id": "94334f91b1556c05dce0ed6f23c074bb8875f185", "index": 2505, "step-1": "<mask token>\n\n\ndef end_num(s):\n text = re.compile('.*[0-9]$')\n if text.match(s):\n return 'Yes!Number is present at the end of string'\n else:\n return 'No!Number is not present at the end of string'\n\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def fun(st, n): suffix = [(0) for i in range(n)] prefix = [(0) for i in range(n)] count = 0 for i, val in enumerate(st): if val == '*': if i == 0: prefix[i] = 0 count += 1 else: ...
flexible
{ "blob_id": "77c7ca3391426d1e56e15a93ef3e6227a45140fc", "index": 2829, "step-1": "<mask token>\n", "step-2": "def fun(st, n):\n suffix = [(0) for i in range(n)]\n prefix = [(0) for i in range(n)]\n count = 0\n for i, val in enumerate(st):\n if val == '*':\n if i == 0:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app.register_blueprint(test_controller, url_prefix='/test') app.register_blueprint(user_controller, url_prefix='/') if __name__ == '__main__': app.run(debug=True) <|reserved_special_token_1|> from setup import app, manager ...
flexible
{ "blob_id": "afa22db946f77e9b33a443657592c20fbea21eb1", "index": 6146, "step-1": "<mask token>\n", "step-2": "<mask token>\napp.register_blueprint(test_controller, url_prefix='/test')\napp.register_blueprint(user_controller, url_prefix='/')\nif __name__ == '__main__':\n app.run(debug=True)\n", "step-3": "...
[ 0, 1, 2, 3 ]
from django.contrib import admin from TestApp.models import Parcel # Register your models here. class ParcelAdmin(admin.ModelAdmin): list_display = ['billno','shippername','rate'] admin.site.register(Parcel,ParcelAdmin)
normal
{ "blob_id": "a550b9406e9dd301b863744bb28bc81fac0cd80c", "index": 9607, "step-1": "<mask token>\n\n\nclass ParcelAdmin(admin.ModelAdmin):\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass ParcelAdmin(admin.ModelAdmin):\n list_display = ['billno', 'shippername', 'rate']\n\n\n<mask tok...
[ 1, 2, 3, 4, 5 ]
from telegram.ext import Updater, Filters, MessageHandler, PicklePersistence import telegram import logging logging.basicConfig(format='%(asctime)s %(message)s\n', level=logging.INFO,filename='log.json') logger = logging.getLogger(__name__) def main(): # my_persistence = PicklePersistence(...
normal
{ "blob_id": "0a90f29a4e18c2aed23cb31b4239d44d23526327", "index": 9133, "step-1": "<mask token>\n\n\ndef main():\n updater = Updater('', use_context=True)\n dp = updater.dispatcher\n jobs = updater.job_queue\n dp.add_error_handler(error)\n updater.start_polling()\n updater.idle()\n\n\n<mask toke...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class IndexView(generic.ListView): template_name = 'players/players.html' context_object_name = 'players' def get_queryset(self): return list(chain(Player.objects.all(), Player._meta.get_fields())) <|reserved_special_token_0|> @permission_required('admin.can_addlo...
flexible
{ "blob_id": "bce794616889b80c152a8ebec8d02e49a96684e9", "index": 2955, "step-1": "<mask token>\n\n\nclass IndexView(generic.ListView):\n template_name = 'players/players.html'\n context_object_name = 'players'\n\n def get_queryset(self):\n return list(chain(Player.objects.all(), Player._meta.get_...
[ 4, 7, 8, 9, 10 ]
""" Subfunction A31 is responsible for inputting the component parameters and then using the information about the component to determine the pressure drop across that component ---------------------------------------------------------- Using data structure from /SysEng/jsonParameterFileFormat/ recall that each cell is...
normal
{ "blob_id": "4b8038ddea60f371aa8da168ea4456372d6f0388", "index": 2357, "step-1": "<mask token>\n\n\nclass A31:\n\n def __init__(self, dict):\n self.dict = dict\n self.CID = self.dict['CID']\n self.val = self.dict['values']\n self.calc = self.val['calculated']\n self.comp = s...
[ 3, 5, 6, 7, 8 ]
#!/usr/bin/python """ An extensible private pypi index. NOTES ON PACKAGE NAMES ---------------------- MPyPi tries the following when it does not find a package with the given name in the index: - replaces all _ with - and - lowercases the package name """ from __future__ import print_function from __future__ ...
normal
{ "blob_id": "bd25b97de78f04510e43f13d356eb6c0025e223d", "index": 8121, "step-1": "<mask token>\n\n\ndef canonicalize_name(name):\n return _canonicalize_regex.sub('-', name).lower()\n\n\ndef page_index(packages):\n yield PAGE_FMT\n for p in packages:\n name = p.name\n url = name\n yi...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> def execute_cmd(cmd): """ Sockets: https://docs.python.org/2/library/socket.html How to use the socket s: # Establish socket connection s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) Readi...
flexible
{ "blob_id": "e0f25addad8af4541f1404b76d4798d2223d9715", "index": 5116, "step-1": "<mask token>\n\n\ndef execute_cmd(cmd):\n \"\"\"\n Sockets: https://docs.python.org/2/library/socket.html\n How to use the socket s:\n\n # Establish socket connection\n s = socket.socket(socke...
[ 1, 2, 3, 4, 5 ]
''' Factory for creating and running ssimulations against optimization tools Author: Matthew Barber <mfmbarber@gmail.com> ''' from .strategy_annealer import StrategyAnnealer from .strategy_deap import StrategyDeap class CalulateStrategyWith: @staticmethod def Annealing(car, include_initial_ty...
normal
{ "blob_id": "1cab38721e6b96a9877bd67cbddaa4d6b4e53d1b", "index": 8175, "step-1": "<mask token>\n\n\nclass CalulateStrategyWith:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CalulateStrategyWith:\n <mask token>\n\n @staticmethod\n def geneticAlgorithm(car, include_initial_...
[ 1, 2, 3, 4, 5 ]
# 3번 반복하고 싶은 경우 # 별 10개를 한줄로 for x in range(0, 10, 3): # 3번째 숫자는 증감할 양을 정해줌. # print(x) print("★", end=" ") print() print("------------------------") #이중 for문 for y in range(0, 10): for x in range(0, 10): # print(x) print("★", end=" ") print()
normal
{ "blob_id": "b360ba7412bd10e2818511cee81302d407f88fd1", "index": 1895, "step-1": "<mask token>\n", "step-2": "for x in range(0, 10, 3):\n print('★', end=' ')\nprint()\nprint('------------------------')\nfor y in range(0, 10):\n for x in range(0, 10):\n print('★', end=' ')\n print()\n", "step-...
[ 0, 1, 2 ]
class Solution(object): def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ ns = [0]*len(nums) for i in range(0, len(nums), 1): ns[nums[i]-1] = 1 ret = [] for j in range(0, len(ns), 1): ...
normal
{ "blob_id": "87504fb88cbbf810ad8bab08bc59284d2cf37cce", "index": 850, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution(object):\n\n def findDisappearedNumbers(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: Li...
[ 1, 2, 3, 4, 5 ]
learningRateBase = 0.001 learningRateDecreaseStep = 80 epochNum = 100 generateNum = 3 batchSize = 16 trainPoems = "./data/poems.txt" checkpointsPath = "./model/"
normal
{ "blob_id": "2fb299f5454c251dc1c77c2597ee23bf414c716e", "index": 4845, "step-1": "<mask token>\n", "step-2": "learningRateBase = 0.001\nlearningRateDecreaseStep = 80\nepochNum = 100\ngenerateNum = 3\nbatchSize = 16\ntrainPoems = './data/poems.txt'\ncheckpointsPath = './model/'\n", "step-3": "learningRateBase...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'KEY.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_KEY(object): def setupUi(self, KEY): KEY.setObjectName("KEY") ...
normal
{ "blob_id": "1dab0084666588f61d0f9f95f88f06ed9d884e5b", "index": 3892, "step-1": "<mask token>\n\n\nclass Ui_KEY(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_KEY(object):\n\n def setupUi(self, KEY):\n KEY.setObjectName('KEY')\n KEY.resize(419, 106)\n ...
[ 1, 2, 3, 4, 5 ]
############################################################################### # Copyright (c) 2017-2020 Koren Lev (Cisco Systems), # # Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others # # # ...
normal
{ "blob_id": "d60810ea0b19cc9163ce526e6a5a54da9c8b3f68", "index": 3595, "step-1": "<mask token>\n\n\nclass TestKubeFetchContainers(KubeTestBase):\n\n\n class DummyConfig(object):\n\n def __init__(self, _environment):\n self.environment = _environment\n <mask token>\n <mask token>\n\n ...
[ 5, 6, 7, 8, 10 ]
import cv2 import dlib import faceBlendCommon as face from matplotlib import pyplot as plt from scipy.spatial import distance as dist import numpy as np import cmapy import math def eye_aspect_ratio(eye): A = dist.euclidean(eye[1], eye[5]) B = dist.euclidean(eye[2], eye[4]) C = dist.euclidean(eye[0], eye[...
normal
{ "blob_id": "65ff3b5137c94890c3293a2ae3f57dee1f60a54c", "index": 9097, "step-1": "<mask token>\n\n\ndef findIris(eyeMask, im, thresh):\n r = im[:, :, 2]\n _, binaryIm = cv2.threshold(r, thresh, 255, cv2.THRESH_BINARY_INV)\n kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (4, 4))\n morph = cv2.d...
[ 3, 6, 8, 10, 11 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_visual_coding_2p_analysis ---------------------------------- Tests for `visual_coding_2p_analysis` module. """ import pytest @pytest.fixture def decorated_example(): """Sample pytest fixture. See more at: http://doc.pytest.org/en/latest/fixture.html ...
normal
{ "blob_id": "ae3198e68d9479605327b729c01fb15eae87ab98", "index": 3282, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture\ndef decorated_example():\n \"\"\"Sample pytest fixture.\n See more at: http://doc.pytest.org/en/latest/fixture.html\n \"\"\"\n\n\n<mask token>\n", "step-3"...
[ 0, 1, 2, 3, 4 ]
import sys import time import numpy as np import vii import cnn from cnn._utils import (FLOAT_DTYPE, _multi_convolve_image, _opencl_multi_convolve_image, _relu_max_pool_image, _opencl_relu_max_pool_image) GROUPS = 25, 20...
normal
{ "blob_id": "8ec257d5dfe84e363e3c3aa5adee3470c20d1765", "index": 5866, "step-1": "<mask token>\n\n\n@probe_time\ndef opencl_multi_convolve_image(*args):\n return _opencl_multi_convolve_image(*args)\n\n\n<mask token>\n\n\ndef multi_convolve_image(data, kernel, bias, dil_x, dil_y):\n if device < 0:\n ...
[ 2, 6, 7, 9, 12 ]
import numpy as np from sklearn.metrics import mutual_info_score def mimic_binary(max_iter=100, fitness_func=None, space=None): assert fitness_func is not None assert space is not None idx = np.random.permutation(np.arange(len(space))) pool = space[idx[:int(len(space)/2)]] # randomly sample 50% of th...
normal
{ "blob_id": "360e661d8538a8f40b7546a54e9a9582fa64bd67", "index": 700, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef mutual_info(parent, child):\n parent = [int(x) for x in parent]\n child = [int(x) for x in child]\n return mutual_info_score(parent, child)\n", "step-3": "<mask token>\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def py_make_float_array(cst, op_version=None): """ Creates an array with a single element from a constant. @param cst constant @param op_version unused @return array .. runpython:: :showcode: :warningout: Dep...
flexible
{ "blob_id": "fdf6c28e65b50c52550a95c2d991b1eb3ec53a2f", "index": 3540, "step-1": "<mask token>\n\n\ndef py_make_float_array(cst, op_version=None):\n \"\"\"\n Creates an array with a single element\n from a constant.\n\n @param cst constant\n @param op_version unused\n @return...
[ 5, 6, 7, 9, 10 ]
<|reserved_special_token_0|> def get_gpu_name(): try: out_str = subprocess.run(['nvidia-smi', '--query-gpu=gpu_name', '--format=csv'], stdout=subprocess.PIPE).stdout out_list = out_str.decode('utf-8').split('\n') out_list = out_list[1:-1] return out_list except Exce...
flexible
{ "blob_id": "6eec95932ef445ba588f200233495f59c4d77aac", "index": 5396, "step-1": "<mask token>\n\n\ndef get_gpu_name():\n try:\n out_str = subprocess.run(['nvidia-smi', '--query-gpu=gpu_name',\n '--format=csv'], stdout=subprocess.PIPE).stdout\n out_list = out_str.decode('utf-8').split...
[ 5, 6, 7, 8, 11 ]
# Cutting a Rod | DP-13 # Difficulty Level : Medium # Last Updated : 13 Nov, 2020 # Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces. For example, if length of the rod is...
normal
{ "blob_id": "9cca73ebdf2b05fe29c14dc63ec1b1a7c917b085", "index": 6508, "step-1": "<mask token>\n\n\ndef cut_rod2(price, n):\n val = [(0) for x in range(n + 1)]\n val[0] = 0\n for i in range(1, n + 1):\n max_val = -1\n for j in range(i):\n max_val = max(max_val, price[j] + val[i ...
[ 2, 3, 4, 5, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "464980a2f17aeedfa08548d6c4e247f8c047e2cb", "index": 5743, "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 = [('profiles', ...
[ 0, 1, 2, 3, 4 ]
COPY_GOOGLE_DOC_KEY = '1CdafeVmmtNa_PMV99TapPHvLUVzYz0xkvHcpINQtQ6c' DEPLOY_SLUG = 'al-qassemi' NUM_SLIDES_AFTER_CONTENT = 2 # Configuration AUDIO = True VIDEO = False FILMSTRIP = False PROGRESS_BAR = False
normal
{ "blob_id": "f398b724fc28bc25ddb8baf492f34075db0c1f61", "index": 7703, "step-1": "<mask token>\n", "step-2": "COPY_GOOGLE_DOC_KEY = '1CdafeVmmtNa_PMV99TapPHvLUVzYz0xkvHcpINQtQ6c'\nDEPLOY_SLUG = 'al-qassemi'\nNUM_SLIDES_AFTER_CONTENT = 2\nAUDIO = True\nVIDEO = False\nFILMSTRIP = False\nPROGRESS_BAR = False\n", ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(max((y - x + 9) // 10, 0)) <|reserved_special_token_1|> x, y = map(int, input().split()) print(max((y - x + 9) // 10, 0))
flexible
{ "blob_id": "c9f3e956d4016846c8efe0382b79882559d6ce64", "index": 1488, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(max((y - x + 9) // 10, 0))\n", "step-3": "x, y = map(int, input().split())\nprint(max((y - x + 9) // 10, 0))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import config import web import hashlib import sys db = web.database(dbn="mysql", db=config.db, user=config.user, pw=config.passwd) def signIn(user, pw): pwhash = hashlib.md5(pw).hexdigest() uid = db.insert("users", uname=user, passwd=pwhash) r...
normal
{ "blob_id": "6d032df195854703f36dce7d27524c8f5089c04d", "index": 2334, "step-1": "#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n\r\nimport config\r\nimport web\r\nimport hashlib\r\nimport sys\r\n\r\n\r\ndb = web.database(dbn=\"mysql\", db=config.db, user=config.user, pw=config.passwd)\r\n\r\ndef signIn(use...
[ 0 ]
# The sort() method sorts the list ascending by default. #syntax # list.sort(reverse=True|False, key=myFunc) # Parameter Description # reverse Optional. reverse=True will sort the list descending. Default is reverse=False # key Optional. A function to specify the sorting criteria(s) cars ...
normal
{ "blob_id": "5ab8d9eab30d72557f1a85b5b82c0df456e3843d", "index": 1740, "step-1": "<mask token>\n\n\ndef length_of_cars(car):\n return len(car)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef length(data):\n return len(data)\n\n\n<mask token>\n\n\ndef year(data):\n return data['year']\n\n\n<mask...
[ 1, 3, 4, 5, 6 ]
<|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 = [m...
flexible
{ "blob_id": "f7a335db0ddf8a871e98eac54b59c41a40622153", "index": 4566, "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 = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def preprocess_img(img, size): img = np.rollaxis(img, 0, 3) img = skimage.transform.resize(img, size) img = skimage.color.rgb2gray(img) return img <|reserved_special_token_1|> import numpy as np import skimage...
flexible
{ "blob_id": "9706b9ba81f41b131c364a16bb17a0c1e31e3a04", "index": 6608, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef preprocess_img(img, size):\n img = np.rollaxis(img, 0, 3)\n img = skimage.transform.resize(img, size)\n img = skimage.color.rgb2gray(img)\n return img\n", "step-3": ...
[ 0, 1, 2, 3 ]
import re from pathlib import Path RAW_DUMP_XML = Path("raw_data/Wikipedia.xml") def count_regexp(): """Counts the occurences of the regular expressions you will write. """ # Here's an example regular expression that roughly matches a valid email address. # The ones you write below should b...
normal
{ "blob_id": "8a4269f2094fa8ab8f6a93e653183dafb141232e", "index": 5717, "step-1": "<mask token>\n\n\ndef count_regexp():\n \"\"\"Counts the occurences of the regular expressions you will write.\n \"\"\"\n email = re.compile('[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\\\\.[a-zA-Z]{2,5}')\n subheading = re.compile('...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> f.close() <|reserved_special_token_0|> for element in word_token: if element in token_dictionary: token_dictionary[element] += 1 else: token_dictionary[element] = 1 for key in sorted(token_dictionary.keys()...
flexible
{ "blob_id": "2e27302abbe239c1a6067a9eb52f5a857fff7dd2", "index": 1736, "step-1": "<mask token>\n", "step-2": "<mask token>\nf.close()\n<mask token>\nfor element in word_token:\n if element in token_dictionary:\n token_dictionary[element] += 1\n else:\n token_dictionary[element] = 1\nfor key...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def to_absolute_path(filepath): filepath = os.path.expanduser(filepath) return os.path.abspath(filepath) def is_valid_path(path): abs_path = to_absolute_path(path) if os.path.exists(abs_path) and os.path.isdir(abs_path): return True else: return False...
flexible
{ "blob_id": "1cf573863fca660cc1fec71ab64743e7a2dd74d8", "index": 1730, "step-1": "<mask token>\n\n\ndef to_absolute_path(filepath):\n filepath = os.path.expanduser(filepath)\n return os.path.abspath(filepath)\n\n\ndef is_valid_path(path):\n abs_path = to_absolute_path(path)\n if os.path.exists(abs_pa...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> IMAGE_SIZE = 640, 480 <|reserved_special_token_1|> IMAGE_SIZE=(640, 480)
flexible
{ "blob_id": "af80cb4d4ce5c071efc39e85f89bb412cff6bf6e", "index": 4489, "step-1": "<mask token>\n", "step-2": "IMAGE_SIZE = 640, 480\n", "step-3": "IMAGE_SIZE=(640, 480)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
msg = "eduardo foi a feira" if 'feira' in msg: print('Sim, foi a feira') else: print('não ele não foi a feira')
normal
{ "blob_id": "2a83bc9157e2210da46e58c56fc0b7199856f4c0", "index": 6287, "step-1": "<mask token>\n", "step-2": "<mask token>\nif 'feira' in msg:\n print('Sim, foi a feira')\nelse:\n print('não ele não foi a feira')\n", "step-3": "msg = 'eduardo foi a feira'\nif 'feira' in msg:\n print('Sim, foi a feir...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> log_info(f'Just initialized a bot named {bot.name}') log_ok(f'Bot is given cash: {bot.cash}') log_error('Nothing else to do ! :(') <|reserved_special_token_1|> <|reserved_special_token_0|> bot = TradeBot() log_info(f'Just initi...
flexible
{ "blob_id": "18eed41cbc419ecbb215f77235be99f15f86ea9a", "index": 7468, "step-1": "<mask token>\n", "step-2": "<mask token>\nlog_info(f'Just initialized a bot named {bot.name}')\nlog_ok(f'Bot is given cash: {bot.cash}')\nlog_error('Nothing else to do ! :(')\n", "step-3": "<mask token>\nbot = TradeBot()\nlog_i...
[ 0, 1, 2, 3, 4 ]
from sys import stdin Read = stdin.readline INF = int(1e9) n, m = map(int, Read().split()) graph = [[INF] * (n+1) for _ in range(n+1)] for i in range(1, n+1): for j in range(1, n+1): if i == j: graph[i][j] = 0 for _ in range(m): a, b = map(int, Read().split()) graph[a][b] = 1 for k i...
normal
{ "blob_id": "6ec39aa712c8abe610418e410883ff168d73126d", "index": 3292, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n + 1):\n for j in range(1, n + 1):\n if i == j:\n graph[i][j] = 0\nfor _ in range(m):\n a, b = map(int, Read().split())\n graph[a][b] = 1\nfo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def download_images(links, name): dir_name = name.replace(' ', '_') if not os.path.isdir(dir_name): os.mkdir(dir_name) for i, img_link in enumerate(links): img_path = os.path.join(dir_name, '{:06}.png'.format(i)) ulib.urlretrieve(img_link, img_path) <...
flexible
{ "blob_id": "02ffdd1c03cc20883eddc691fc841022b4ff40fd", "index": 1601, "step-1": "<mask token>\n\n\ndef download_images(links, name):\n dir_name = name.replace(' ', '_')\n if not os.path.isdir(dir_name):\n os.mkdir(dir_name)\n for i, img_link in enumerate(links):\n img_path = os.path.join(...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> os.chdir( '/Volumes/lesleydata/manual_Curation_app/images/svviz_JMZook/1000_Rand_Samp_INS_DEL_2/app_images/DEL/PBDEL' ) for f in os.listdir(): file_name, file_ext = os.path.splitext(f) file_name = file_name.replace...
flexible
{ "blob_id": "d483314fa7e8a2514fd5089b872b9e480e7454f4", "index": 8116, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir(\n '/Volumes/lesleydata/manual_Curation_app/images/svviz_JMZook/1000_Rand_Samp_INS_DEL_2/app_images/DEL/PBDEL'\n )\nfor f in os.listdir():\n file_name, file_ext = os.pat...
[ 0, 1, 2, 3, 4 ]
a = int(input("Enter no. of over: ")) print("total ball:",a*6 ) import random comp_runs = random.randint(0,36) print("computer's run:" ,comp_runs) comp_runs = comp_runs+1 print("runs need to win:",comp_runs) chances_1 = a*6 no_of_chances_1 = 0 your_runs = 0 print("-----------------------------------------...
normal
{ "blob_id": "00312f57e8a78444937f46cecb62a2b684b4fc91", "index": 8779, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('total ball:', a * 6)\n<mask token>\nprint(\"computer's run:\", comp_runs)\n<mask token>\nprint('runs need to win:', comp_runs)\n<mask token>\nprint(\"\"\"--------------------------...
[ 0, 1, 2, 3, 4 ]
from django.conf.urls import url from . import views from .import admin urlpatterns = [ url(r'^$', views.showberanda, name='showberanda'), url(r'^sentimenanalisis/$', views.showsentimenanalisis, name='showsentimenanalisis'), url(r'^bantuan/$', views.showbantuan, name='showbantuan'), url(r'^tweets/', vi...
normal
{ "blob_id": "077c596f71aae22e85589fdaf78d5cdae8085443", "index": 8710, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', views.showberanda, name='showberanda'), url(\n '^sentimenanalisis/$', views.showsentimenanalisis, name=\n 'showsentimenanalisis'), url('^bantuan/$', views.s...
[ 0, 1, 2, 3 ]
import os from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file, rmdir from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration requi...
normal
{ "blob_id": "fe1c499efe492dbd4f5c9b99bd6339c503c7902b", "index": 5766, "step-1": "<mask token>\n\n\nclass RuyConan(ConanFile):\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 <...
[ 4, 12, 14, 15, 17 ]
# Generated by Django 2.1.2 on 2018-11-05 12:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('PDPAPI', '0011_auto_20181105_1021'), ] operations = [ migrations.RemoveField( model_name='optionvoting', name='total...
normal
{ "blob_id": "53519c704ca9aff62140f187d4246208350fa9ba", "index": 4610, "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 = [('PDPAPI', '0...
[ 0, 1, 2, 3, 4 ]