code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
#! /usr/bin/python2 # Copyright 2007 John Kasunich and Jeff Epler # # modified by Rudy du Preez to fit with the kinematics component pumakins.c # Note: DH parameters in pumakins halfile should bet set to # A2=400, A3=50, D3=100, D4=400, D6=95 # # z | # ...
normal
{ "blob_id": "ae83a0e1ebf1190ab55459563bc7b86d240de89a", "index": 4146, "step-1": "<mask token>\n", "step-2": "<mask token>\nc.newpin('joint1', hal.HAL_FLOAT, hal.HAL_IN)\nc.newpin('joint2', hal.HAL_FLOAT, hal.HAL_IN)\nc.newpin('joint3', hal.HAL_FLOAT, hal.HAL_IN)\nc.newpin('joint4', hal.HAL_FLOAT, hal.HAL_IN)\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: num1, num2 = float(num1), float(num2) if operation == 'add': result = num1 + num2 print(result) elif operation == 'subtract': result = num1 - num2 print(result) elif operation =...
flexible
{ "blob_id": "bafb6c09ecd0017428441e109733ebcb189863ad", "index": 3598, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n num1, num2 = float(num1), float(num2)\n if operation == 'add':\n result = num1 + num2\n print(result)\n elif operation == 'subtract':\n result = num1 ...
[ 0, 1, 2, 3 ]
import pytest import problem22 as p22 def test_burst(): """Test burst() in Cluster""" print('\nTesting burst()') cluster = p22.Cluster('..#\n#..\n...') assert cluster.infected[p22.Position(0, 2)] == p22.State.Infected assert cluster.infected[p22.Position(1, 0)] == p22.State.Infected assert clus...
normal
{ "blob_id": "f0a3778e74d113a5de778fa17ec321c6680c56c2", "index": 1143, "step-1": "<mask token>\n\n\ndef test_burst_evolved():\n \"\"\"Test burst() in EvolvedCluster\"\"\"\n cluster = p22.EvolvedCluster('..#\\n#..\\n...')\n assert cluster.infected[p22.Position(0, 2)] == p22.State.Infected\n assert clu...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class Purpose(Enum): halide_nightly = 1 halide_testbranch = 2 llvm_nightly = 3 class BuildSystem(Enum): make = 0 cmake = 1 class BuilderType: """A class to encapsulate the settings for a specific Builder. (Do not confuse with CMake's 'BUILD_TYPE', which ...
flexible
{ "blob_id": "4abcca52095a169b71d2527ce52b8367534c42a4", "index": 5989, "step-1": "<mask token>\n\n\nclass Purpose(Enum):\n halide_nightly = 1\n halide_testbranch = 2\n llvm_nightly = 3\n\n\nclass BuildSystem(Enum):\n make = 0\n cmake = 1\n\n\nclass BuilderType:\n \"\"\"A class to encapsulate th...
[ 45, 55, 62, 69, 80 ]
__author__ = 'cromox' from time import sleep import inspect from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from Forex_CFD.features.main_page import FxMainPage class FxBuySell(FxMainPage): def _...
normal
{ "blob_id": "5850be6aef6e4adb36a122cb8e5ffe044b1c9009", "index": 4589, "step-1": "<mask token>\n\n\nclass FxBuySell(FxMainPage):\n <mask token>\n\n def buy(self, amount):\n self.log.info('--> ' + inspect.stack()[0][3] + ' started')\n if self.driver.find_element_by_xpath(\n \"//div[...
[ 3, 5, 8, 9, 11 ]
""" USERS MODEL """ from www import app import mongoengine import datetime class User(mongoengine.Document): username = mongoengine.StringField(required=True) password = mongoengine.StringField(required=True) email = mongoengine.StringField(required=True) active_hash = mongoengine.StringField(re...
normal
{ "blob_id": "51cdb41836415c08609ee6a6bcc3adbaf2533da4", "index": 3697, "step-1": "<mask token>\n\n\nclass User(mongoengine.Document):\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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(2 * 3) <|reserved_special_token_0|> if a >= b: print('You can drive the car, you are ', a) else: print('Sorry, you are too small') <|reserved_special_token_1|> <|reserved_special_token_0|> print(2 * 3) <|reserved_...
flexible
{ "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 ]
from django.db import models from django.contrib.auth.models import AbstractUser from django.db.models import Max from django.core.validators import RegexValidator from django.utils import timezone class User(AbstractUser): is_developer = models.BooleanField('developer status', default=False) is_marketing = mo...
normal
{ "blob_id": "94e9e7c4c09c8c4de4c8f2649707a949d5f5f856", "index": 7836, "step-1": "<mask token>\n\n\nclass Location(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>\n\n...
[ 38, 40, 46, 50, 55 ]
<|reserved_special_token_0|> def Create_list(): i = 0 for file in os.listdir(os.getcwd()): if file.endswith('openplc'): Monitoredlist.append(file) i += 1 if i == 0: print('No Files are being monitored!') else: print('The files being monitored are as foll...
flexible
{ "blob_id": "6f8ce77dd45f555ca092482715b6ccaa33414fd8", "index": 4176, "step-1": "<mask token>\n\n\ndef Create_list():\n i = 0\n for file in os.listdir(os.getcwd()):\n if file.endswith('openplc'):\n Monitoredlist.append(file)\n i += 1\n if i == 0:\n print('No Files ar...
[ 5, 6, 8, 9, 10 ]
from contextlib import contextmanager from filecmp import cmp, dircmp from shutil import copyfile, copytree, rmtree import pytest from demisto_sdk.commands.common.constants import PACKS_DIR, TEST_PLAYBOOKS_DIR from demisto_sdk.commands.common.tools import src_root TEST_DATA = src_root() / 'tests' / 'test_files' TEST_...
normal
{ "blob_id": "8928c2ff49cbad2a54252d41665c10437a471eeb", "index": 1404, "step-1": "<mask token>\n\n\ndef same_folders(src1, src2):\n \"\"\"Assert if folder contains diffrent files\"\"\"\n dcmp = dircmp(src1, src2)\n if dcmp.left_only or dcmp.right_only:\n return False\n for sub_dcmp in dcmp.sub...
[ 6, 8, 9, 12, 15 ]
<|reserved_special_token_0|> class AllFieldsAdmin(admin.ModelAdmin): <|reserved_special_token_0|> def __init__(self, model, admin_site): self.list_display = [field.name for field in model._meta.fields if field.name not in ['id']] super(AllFieldsAdmin, self).__init__(model, admin_...
flexible
{ "blob_id": "821afa85eb783b4bf1018800f598a3294c4cbcfb", "index": 9532, "step-1": "<mask token>\n\n\nclass AllFieldsAdmin(admin.ModelAdmin):\n <mask token>\n\n def __init__(self, model, admin_site):\n self.list_display = [field.name for field in model._meta.fields if \n field.name not in [...
[ 2, 3, 4, 5, 6 ]
from integral_image import calc_integral_image class Region: def __init__(self, x, y, width, height): self.x = x self.y = y self.width = width self.height = height def calc_feature(self, cumul_sum): yy = self.y + self.height xx = self.x + self.width re...
normal
{ "blob_id": "03e92eae4edb4bdbe9fa73e39e7d5f7669746fe5", "index": 3859, "step-1": "<mask token>\n\n\nclass Region:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Region:\n <mask token>\n\n def calc_feature(self, cumul_sum):\n yy = self.y + self.height\n xx = self....
[ 1, 2, 3, 4 ]
try: from LoggerPlugin import LoggerPlugin except ImportError: from RTOC.LoggerPlugin import LoggerPlugin from .holdPeak_VC820.vc820py.vc820 import MultimeterMessage import serial import sys import traceback from PyQt5 import uic from PyQt5 import QtWidgets import logging as log log.basicConfig(level=log.INFO...
normal
{ "blob_id": "c3efaeab600ec9a7a9fffdfad5c9dc1faad8fee7", "index": 726, "step-1": "<mask token>\n\n\nclass Plugin(LoggerPlugin):\n <mask token>\n\n def __init__(self, *args, **kwargs):\n super(Plugin, self).__init__(*args, **kwargs)\n self.setDeviceName(devicename)\n self.smallGUI = True...
[ 5, 8, 10, 11, 12 ]
from flask import Flask, request, redirect, url_for, render_template from flask_modus import Modus from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate app = Flask(__name__) app.config[ 'SQLALCHEMY_DATABASE_URI'] = "postgres://localhost/flask_one_to_many" app.config['SQLALCHEMY_TRACK_MODIFICAT...
normal
{ "blob_id": "026e06e777d64f8724ec5e89a7829b3a42a25d6b", "index": 800, "step-1": "<mask token>\n\n\nclass Student(db.Model):\n __tablename__ = 'students'\n id = db.Column(db.Integer, primary_key=True)\n first_name = db.Column(db.Text)\n last_name = db.Column(db.Text)\n excuses = db.relationship('Ex...
[ 13, 14, 15, 16, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def intToRoman(self, num): normalDic = {(1000): 'M', (500): 'D', (100): 'C', (50): 'L', (10): 'X', (5): 'V', (1): 'I'} specialDic...
flexible
{ "blob_id": "7de06772a1024a81193ac69a1110ad2e8b7f64ac", "index": 9085, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def intToRoman(self, num):\n normalDic = {(1000): 'M', (500): 'D', (100): 'C', (50): 'L', (10):\n 'X', (5): '...
[ 0, 1, 2, 3 ]
import json from week2.Stack import Stack class TransactionStack: def __init__(self): self.stack = Stack() with open("json_file/Transaction_Stack.json") as data: try: temp = json.load(data) except Exception: pass else: ...
normal
{ "blob_id": "30a2358e8396d24d6c3cd72d04321aa9f9f83995", "index": 8233, "step-1": "<mask token>\n\n\nclass TransactionStack:\n <mask token>\n\n def transaction_stack(self, transaction, customer_name, company_name,\n no_of_share, cost, time):\n new_transaction = {'transaction': transaction, 'cu...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class SnapshotMismatchError(Exception): """ Main snapshot mismatch exception. """ def setup_logging(level: int) ->logging.Logger: """ Get Logger instance. Arguments: level -- Log level Returns: Overriden Logger. """ logger = logging....
flexible
{ "blob_id": "f3466fd38ecf472a4342aad4d10410d6f2a67d47", "index": 1779, "step-1": "<mask token>\n\n\nclass SnapshotMismatchError(Exception):\n \"\"\"\n Main snapshot mismatch exception.\n \"\"\"\n\n\ndef setup_logging(level: int) ->logging.Logger:\n \"\"\"\n Get Logger instance.\n\n Arguments:\n...
[ 13, 14, 16, 17, 19 ]
import json import datetime import string import random import logging import jwt from main import db from main.config import config def execute_sql_from_file(filename): # Open and read the file as a single buffer fd = open(filename, 'r') sql_file = fd.read() fd.close() # All SQL commands (spli...
normal
{ "blob_id": "a724b49c4d86400b632c02236ceca58e62ba6c86", "index": 9116, "step-1": "import json\nimport datetime\nimport string\nimport random\nimport logging\n\nimport jwt\n\nfrom main import db\nfrom main.config import config\n\n\ndef execute_sql_from_file(filename):\n # Open and read the file as a single buf...
[ 0 ]
# # @lc app=leetcode.cn id=909 lang=python3 # # [909] 蛇梯棋 # # @lc code=start from typing import List class Solution: def snakesAndLadders(self, board: List[List[int]]) -> int: N = len(board) def get_pos(num): r = (num-1) // N c = (num-1) % N c = c if ((r+1) & 1)...
normal
{ "blob_id": "da5a366d1cc4f192a220dc38c7a74aeb3fba7cdb", "index": 9839, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def snakesAndLadders(self, board: List[List[int]]) ->int:\n N = le...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.figure() plt.xlabel('Time (ms)', fontsize=30) plt.ylabel('Capture rate (%)', fontsize=30) plt.xticks(fontsize=25) plt.yticks(fontsize=25) plt.xlim(x_lower_limit, x_upper_limit) plt.ylim(y_lower_limit, y_upper_limit) plt.plot(s...
flexible
{ "blob_id": "bee96e817dd4d9462c1e3f8eb525c22c2117140a", "index": 9942, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.figure()\nplt.xlabel('Time (ms)', fontsize=30)\nplt.ylabel('Capture rate (%)', fontsize=30)\nplt.xticks(fontsize=25)\nplt.yticks(fontsize=25)\nplt.xlim(x_lower_limit, x_upper_limit)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ReportGenerator(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def run(self, html, url): print('[#] Running the report generator') self.html = html self.getting_flags_locations() self.getting_related_flags(url) <|r...
flexible
{ "blob_id": "2003060f7793de678b4a259ad9424cd5927a57f7", "index": 3167, "step-1": "<mask token>\n\n\nclass ReportGenerator(object):\n <mask token>\n <mask token>\n\n def run(self, html, url):\n print('[#] Running the report generator')\n self.html = html\n self.getting_flags_location...
[ 8, 13, 14, 15, 17 ]
from LinkedList import LinkedList class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ h1 = l1 ...
normal
{ "blob_id": "0f3ecd0a7189f57fdbda2360f6e39bd6101e2fdb", "index": 7435, "step-1": "<mask token>\n\n\nclass ListNode(object):\n\n def __init__(self, x):\n self.val = x\n self.next = None\n\n\nclass Solution(object):\n\n def addTwoNumbers(self, l1, l2):\n \"\"\"\n :type l1: ListNod...
[ 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def is_admin(): """ The function ``is_admin`` detects whether the calling process is running with administrator/superuser privileges. It works cross-platform on either Windows NT systems or Unix-based systems. ...
flexible
{ "blob_id": "f1601d3d820b93631f9b1358627a5716016ad135", "index": 5473, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef is_admin():\n \"\"\"\n The function ``is_admin`` detects whether the calling process is running\n with administrator/superuser privileges. It works cross-platform on \n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_version(): return '2.01' <|reserved_special_token_0|> def restart(): print('restart') try: emby_wsocket.stop() except: sys.exit() sys.exit() print('fin restart') def save_config(config_file, config): with open(config_file, 'w') as ...
flexible
{ "blob_id": "2ff85ac059f160fcc6b39b4298e8216cbad77ab3", "index": 504, "step-1": "<mask token>\n\n\ndef get_version():\n return '2.01'\n\n\n<mask token>\n\n\ndef restart():\n print('restart')\n try:\n emby_wsocket.stop()\n except:\n sys.exit()\n sys.exit()\n print('fin restart')\n\...
[ 21, 24, 25, 27, 28 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): paths = ['..', '.'] absOfEntries = [i.abs for i in Easy.WalkAnIter(paths)] for i in absOfEntries: print(i) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0...
flexible
{ "blob_id": "b720a52f1c2e6e6be7c0887cd94441d248382242", "index": 1836, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n paths = ['..', '.']\n absOfEntries = [i.abs for i in Easy.WalkAnIter(paths)]\n for i in absOfEntries:\n print(i)\n\n\n<mask token>\n", "step-3": "<mask...
[ 0, 1, 2, 3, 4 ]
import math def solution(X, Y, D): # write your code in Python 3.6 xy = Y-X; if xy == 0: return 0 jumps = math.ceil(xy/D) return jumps
normal
{ "blob_id": "bdf819d8a5bc3906febced785c6d95db7dc3a603", "index": 2376, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(X, Y, D):\n xy = Y - X\n if xy == 0:\n return 0\n jumps = math.ceil(xy / D)\n return jumps\n", "step-3": "import math\n\n\ndef solution(X, Y, D):\n ...
[ 0, 1, 2, 3 ]
from z3 import * import re dna = re.compile("dna_(\d+)") opt = Optimize() opt.from_file("../benchmarks/bench.smt2") set_option("sat.random_seed",23) def get_soft(soft): return [f.arg(0) for f in soft.children()] def free_vars(fs): seen = set([]) vars = set([]) def fv(seen, vars, f): if f in...
normal
{ "blob_id": "c0d8f2542f9cf9a5097011c61c90073c031d2708", "index": 9831, "step-1": "<mask token>\n\n\ndef get_soft(soft):\n return [f.arg(0) for f in soft.children()]\n\n\ndef free_vars(fs):\n seen = set([])\n vars = set([])\n\n def fv(seen, vars, f):\n if f in seen:\n return\n ...
[ 7, 8, 9, 10, 11 ]
<|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": "ab3609c27fa002d79735c5d5c09ec7a52fedd040", "index": 3484, "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 = [('events', '0...
[ 0, 1, 2, 3, 4 ]
# coding=gbk from numpy import * import fp_growth ''' #创建树的一个单节点 rootNode=fp_growth.treeNode('pyramid',9,None) #为其增加一个子节点 rootNode.children['eye']=fp_growth.treeNode('eye',13,None) rootNode.disp() #导入事务数据库实例 simpData=fp_growth.loadSimpData() #print("simpData:") #print(simpData) #对数据进行格式化处理 initSet=fp_growth.cre...
normal
{ "blob_id": "e8b0e6e5e68933703e2ac8c9b2b62d68c0c2f53d", "index": 8295, "step-1": "<mask token>\n", "step-2": "<mask token>\nfp_growth.minTree(myFPtree, myHeaderTab, 100000, set([]), myFreqList)\nprint(len(myFreqList))\n", "step-3": "<mask token>\nparsedDat = [line.split() for line in open('kosarak.dat').read...
[ 0, 1, 2, 3, 4 ]
import collect_from_webapi.api_public_data as pdapi from collect_from_webapi import pd_fetch_tourspot_visitor # url = pdapi.pd_gen_url("http://openapi.tour.go.kr/openapi/serviceTourismResourceStatsService/getPchrgTrrsrtVisitorList", # YM='{0:04d}{1:02d}'.format(2017, 1), # ...
normal
{ "blob_id": "c6a6b8f2485528af479fadbdf286e82f10a11de8", "index": 9101, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor items in pd_fetch_tourspot_visitor(district='서울특별시', year=2017, month=7):\n print(items)\n<mask token>\nprint(item)\n", "step-3": "<mask token>\nfor items in pd_fetch_tourspot_vi...
[ 0, 1, 2, 3, 4 ]
''' Paulie Jo Gonzalez CS 4375 - os Lab 0 Last modified: 02/14/2021 This code includes a reference to C code for my_getChar method provided by Dr. Freudenthal. ''' from os import read next_c = 0 limit = 0 def get_char(): global next_c, limit if next_c == limit: next_c = 0 limit = read(0, 10...
normal
{ "blob_id": "67ac5d82bc37b67cfdae73b6667b73b70ed33cfb", "index": 8868, "step-1": "<mask token>\n\n\ndef get_char():\n global next_c, limit\n if next_c == limit:\n next_c = 0\n limit = read(0, 100)\n if limit == 0:\n return ''\n if next_c >= len(limit) - 1:\n return...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class MagicBoxDHT22(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MagicBoxDHT22(object): <|reserved_special_token_0|> def __init__(self): self.pi = pigpio.pi() self.s...
flexible
{ "blob_id": "179b07870d656fb24b73d8b0a1f76ffed08aa5c2", "index": 9665, "step-1": "<mask token>\n\n\nclass MagicBoxDHT22(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MagicBoxDHT22(object):\n <mask token>\n\n def __init__(self):\n self.pi = pigpio.pi()\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def run(): torch.manual_seed(1729) """ Setup """ args = parse() device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') print(device) """ Dataset """ train_dataset = AddTwoDataSet(N=args.N_train, seq_length=args.seq_length) test_dataset = Ad...
flexible
{ "blob_id": "fe1a9804862942491b11b9baceecd37bf628fbb8", "index": 8732, "step-1": "<mask token>\n\n\ndef run():\n torch.manual_seed(1729)\n \"\"\" Setup \"\"\"\n args = parse()\n device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')\n print(device)\n \"\"\" Dataset \"\"\"\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def digits(x): return set(int(d) for d in str(x)) <|reserved_special_token_0|> def euler052(): multiples = range(2, 7) for i in itertools.count(10 ** 5): if same_digits_as_multiples(i, multiples): return i <|reserved_special_token_0|> <|reserved_spe...
flexible
{ "blob_id": "2ec8b9a92f8dd42faf99f0cd569ebf356e12c1d6", "index": 8042, "step-1": "<mask token>\n\n\ndef digits(x):\n return set(int(d) for d in str(x))\n\n\n<mask token>\n\n\ndef euler052():\n multiples = range(2, 7)\n for i in itertools.count(10 ** 5):\n if same_digits_as_multiples(i, multiples)...
[ 2, 3, 4, 5, 6 ]
class Solution: def isUgly(self, num): if num == 0: return False for n in [2, 3, 5]: while num % n == 0: num = num / n return num == 1 a = Solution() print(a.isUgly(14)) print(a.isUgly(8)) print(a.isUgly(6)) print(a.isUgly(0))
normal
{ "blob_id": "d39cc2dbbc83869e559f8355ceba5cf420adea5e", "index": 1662, "step-1": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution:\n\n def isUgly(self, num):\n if num == 0:\n return False\n for n in [2, 3, 5]:\n while num % n == 0:\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('show', t.root.show()) print('sum', t.root.sum()) print('find 3', t.root.find(3) != False) print('evens', t.root.evens()) print('min depth', t.root.min_depth()) <|reserved_special_token_1|> <|reserved_special_token_0|> t ...
flexible
{ "blob_id": "21a7fd5148f73ac47adafc9d5c2361ebe318ae59", "index": 2842, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('show', t.root.show())\nprint('sum', t.root.sum())\nprint('find 3', t.root.find(3) != False)\nprint('evens', t.root.evens())\nprint('min depth', t.root.min_depth())\n", "step-3": ...
[ 0, 1, 2, 3 ]
from datetime import * dd=int(input("enter number day: ")) nn=int(datetime.now().strftime("%w"))+1 # print(dd) # print(nn) print((datetime.now().date())+(timedelta(days=dd-nn)))
normal
{ "blob_id": "d3342507cb1966e14380ff28ae12b5c334abd20a", "index": 5430, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(datetime.now().date() + timedelta(days=dd - nn))\n", "step-3": "<mask token>\ndd = int(input('enter number day: '))\nnn = int(datetime.now().strftime('%w')) + 1\nprint(datetime.no...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def greet(name): hostname = subprocess.check_output('hostname').decode('utf-8')[:-1] return "Hello, {}! I'm {}#{}.".format(name, hostname, os.getppid()) <|reserved_special_token_1|> import os, subprocess def greet(n...
flexible
{ "blob_id": "9bd55a2f224acfa2cb34d0ca14a25e8864d644b3", "index": 5250, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef greet(name):\n hostname = subprocess.check_output('hostname').decode('utf-8')[:-1]\n return \"Hello, {}! I'm {}#{}.\".format(name, hostname, os.getppid())\n", "step-3": "i...
[ 0, 1, 2, 3 ]
import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import KFold import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers.core import Dense,Activation,Dropout from keras.optimizers import SGD,Adam,RMSprop from keras.utils import np_utils x_train=n...
normal
{ "blob_id": "5b919bde9f4fe1da867695ece58f151abb9b70fb", "index": 1492, "step-1": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.model_selection import KFold\nimport keras\nfrom keras.datasets import mnist\nfrom keras.models import Sequential\nfrom keras.layers.core import Dense,Activation,Dro...
[ 0 ]
<|reserved_special_token_0|> class DegreeCourseDetailView(APIView): def get(self, request, pk, *args, **kwargs): response = {'code': 100, 'data': None, 'error': None} try: degree_course = models.DegreeCourse.objects.filter(id=pk).first() ser = DegreeCourseSerializer(degree...
flexible
{ "blob_id": "2b3f8b1ac4735785683c00f6e6ced85d201de53f", "index": 8567, "step-1": "<mask token>\n\n\nclass DegreeCourseDetailView(APIView):\n\n def get(self, request, pk, *args, **kwargs):\n response = {'code': 100, 'data': None, 'error': None}\n try:\n degree_course = models.DegreeCou...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from fixate.reporting.csv import register_csv, unregister_csv
flexible
{ "blob_id": "c70db0fc9d98657e318ecab7eb8af60cc2b19a2c", "index": 4145, "step-1": "<mask token>\n", "step-2": "from fixate.reporting.csv import register_csv, unregister_csv\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def intro(): print( """ ####### ####### ####### # ####### # # #### # ## #### # #### ###### ## # # # # # # # # # # # # # # ...
flexible
{ "blob_id": "11259c92b005a66e5f3c9592875f478df199c813", "index": 6993, "step-1": "<mask token>\n\n\ndef intro():\n print(\n \"\"\"\n####### ####### ####### # ####### \n # # #### # ## #### # #### ###### ##...
[ 6, 7, 8, 9, 10 ]
# -*- coding: utf-8 -*- #!/usr/bin/env python from subprocess import call def query_DB_satellites(outputpath="../data/", user="anonimo", passwd="secreto"): """ Queries the multidark database to extract all the haloes in the box within a ID range. The output is stored as an ascii (CSV) file. """ #...
normal
{ "blob_id": "f1021bfbf11886a01a84033b880d648c3286856b", "index": 4311, "step-1": "# -*- coding: utf-8 -*-\n#!/usr/bin/env python\nfrom subprocess import call\n\n\ndef query_DB_satellites(outputpath=\"../data/\", user=\"anonimo\", passwd=\"secreto\"):\n \"\"\"\n Queries the multidark database to extract all...
[ 0 ]
class Helper: def __init__(self): self.commands = ["help", "lottery", "poll", "polling", "prophecy", "roll", "team", "ub"] ...
normal
{ "blob_id": "fdf76ff20260c25d95a9bf751fa78156071a7825", "index": 7487, "step-1": "class Helper:\n <mask token>\n <mask token>\n\n def display_command(self, command):\n if command not in self.commands:\n return \"That command doesn't exist :/\"\n result = f'__**Command: {command[...
[ 2, 3, 4, 5, 6 ]
import torch import re import sys import os import shutil import filecmp import numpy as np from collections import defaultdict from shutil import copyfile sys.path.append('../') class BoardParser: def __init__(self): self.file = open('../board_output', 'rb') self.data = None def update(se...
normal
{ "blob_id": "3668e8009dca4ea261bdfbd325331c338fdac5a9", "index": 627, "step-1": "<mask token>\n\n\nclass StatusParser:\n\n def __init__(self):\n self.board = np.memmap('../tmp/board', mode='r', dtype=np.int8,\n shape=(20, 10))\n self.combo = np.memmap('../tmp/combo', mode='r', dtype=n...
[ 11, 12, 13, 15, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @measure_time_of_func def fib(n): sequence = [1, 1] for i in range(2, n, 1): sequence.append(sequence[i - 1] + sequence[i - 2]) return sequence <|reserved_special_token_1|> <|reserved_special_token_0|> d...
flexible
{ "blob_id": "2c39660da8fe839c4634cd73ce069acc7b1b29b4", "index": 51, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@measure_time_of_func\ndef fib(n):\n sequence = [1, 1]\n for i in range(2, n, 1):\n sequence.append(sequence[i - 1] + sequence[i - 2])\n return sequence\n", "step-3": ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(N): x[i], y[i], z[i] = (int(x) for x in input().split()) <|reserved_special_token_0|> for sx in (-1, 1): for sy in (-1, 1): for sz in (-1, 1): _x, _y, _z = sx * x, sy * y, sz * z ...
flexible
{ "blob_id": "af40239551709eff02b8a1f034583ab80845d1d7", "index": 1532, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(N):\n x[i], y[i], z[i] = (int(x) for x in input().split())\n<mask token>\nfor sx in (-1, 1):\n for sy in (-1, 1):\n for sz in (-1, 1):\n _x, _y, _z ...
[ 0, 1, 2, 3 ]
from django.test import TestCase, Client from django.contrib.auth.models import User from blog.factories import BlogPostFactory, TagFactory from blog.models import BlogPost from faker import Factory faker = Factory.create() class ServicesTests(TestCase): def setUp(self): self.tag = TagFactory() ...
normal
{ "blob_id": "c9d25460022bb86c821600dfaed17baa70531c9f", "index": 7125, "step-1": "<mask token>\n\n\nclass ServicesTests(TestCase):\n\n def setUp(self):\n self.tag = TagFactory()\n self.blog_post = BlogPostFactory()\n self.client = Client()\n self.user = User.objects.create_user(use...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class ProfileInline(admin.StackedInline): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class UserAdmin(BaseUserAdmin): inlines = ProfileInline, <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_tok...
flexible
{ "blob_id": "a9f3d5f11a9f2781571029b54d54b41d9f1f83b3", "index": 592, "step-1": "<mask token>\n\n\nclass ProfileInline(admin.StackedInline):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass UserAdmin(BaseUserAdmin):\n inlines = ProfileInline,\n\n\n<mask token>\n", "step-2": "<mask token>\n\n...
[ 3, 4, 5, 6, 7 ]
#!/software/python-2.7-2014q3-el6-x86_64/bin/python import SNANA_Reader as simread import REAL_Reader as dataread #import astropy.cosmology as cosmo import traceback import scipy import scipy.stats as stats import numpy as np import matplotlib.pyplot as plt plt.switch_backend('Agg') #import Cosmology import scipy.stats...
normal
{ "blob_id": "27976e9f7fbe030910b3595ea1a13e0e505183e5", "index": 7131, "step-1": "#!/software/python-2.7-2014q3-el6-x86_64/bin/python\nimport SNANA_Reader as simread\nimport REAL_Reader as dataread\n#import astropy.cosmology as cosmo\nimport traceback\nimport scipy\nimport scipy.stats as stats\nimport numpy as n...
[ 0 ]
import torch from torch import nn from torch.nn import functional as F import torchvision import math from torchvision.models.resnet import Bottleneck from dataset import load_image, load_text, ALPHABET, MAX_LEN class ResNetFeatures(nn.Module): def __init__(self, pretrained=True): super().__init__() ...
normal
{ "blob_id": "79522db1316e4a25ab5a598ee035cf9b9a9a9411", "index": 3511, "step-1": "<mask token>\n\n\nclass PositionalEncoding(nn.Module):\n\n def __init__(self, d_model, max_len, dropout=0.1):\n super(PositionalEncoding, self).__init__()\n self.dropout = nn.Dropout(p=dropout)\n pe = torch....
[ 12, 18, 21, 23, 24 ]
import time import optparse from IPy import IP as IPTEST ttlValues = {} THRESH = 5 def checkTTL(ipsrc,ttl): if IPTEST(ipsrc).iptype() == 'PRIVATE': return if not ttlValues.has_key(ipsrc): pkt = srl(IP(dst=ipsrc) / TCMP(),retry=0,timeout=0,verbose=0) ttlValues[ipsrc] = pkt.ttl ...
normal
{ "blob_id": "7081211336793bfde60b5c922f6ab9461a475949", "index": 1616, "step-1": "import time\r\nimport optparse\r\nfrom IPy import IP as IPTEST\r\nttlValues = {}\r\nTHRESH = 5\r\ndef checkTTL(ipsrc,ttl):\r\n if IPTEST(ipsrc).iptype() == 'PRIVATE':\r\n return\r\n if not ttlValues.has_key(ipsrc):\r\n...
[ 0 ]
from collections import defaultdict from mask import Mask from utils import bits_to_decimal def get_program(filename): program = [] mask = None with open(filename, 'r') as f: for line in f: line = line[:-1] if 'mask' in line: if mask is not None: ...
normal
{ "blob_id": "56e8cdec854b3b7a2f925e70d7d59a73b76f9952", "index": 9340, "step-1": "<mask token>\n\n\ndef get_program(filename):\n program = []\n mask = None\n with open(filename, 'r') as f:\n for line in f:\n line = line[:-1]\n if 'mask' in line:\n if mask is n...
[ 1, 3, 4, 5, 6 ]
#Sample Python Code print("Different Code!!!") #print("Hello World!")
normal
{ "blob_id": "1e24952006afebb7bf10a83077fc4effd5cc9c58", "index": 1301, "step-1": "<mask token>\n", "step-2": "print('Different Code!!!')\n", "step-3": "#Sample Python Code\nprint(\"Different Code!!!\")\n#print(\"Hello World!\")\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from math import * import math import re import numpy as np class atom: aid=0 atype='' x=0.0 y=0.0 z=0.0 rid=0 rtype='' model=[] chainid='' def getlen(atm1,atm2): dist=sqrt(pow(atm1.x-atm2.x,2)+pow(atm1.y-atm2.y,2)+pow(atm1.z-atm2.z,2)) return dist def ...
normal
{ "blob_id": "78123c806e5a8c0cc7511a5024769f8c61621efa", "index": 9877, "step-1": "<mask token>\n\n\nclass atom:\n aid = 0\n atype = ''\n x = 0.0\n y = 0.0\n z = 0.0\n rid = 0\n rtype = ''\n model = []\n chainid = ''\n\n\ndef getlen(atm1, atm2):\n dist = sqrt(pow(atm1.x - atm2.x, 2) ...
[ 5, 6, 8, 9, 10 ]
#!/usr/bin/env python from postimg import postimg import argparse import pyperclip import json def main(args): if not args.quiet: print("Uploading.....") resp = postimg.Imgur(args.img_path).upload() if not resp['success']: if not args.quiet: print(json.dumps(resp, sort_keys=True,...
normal
{ "blob_id": "705755340eef72470fc982ebd0004456469d23e4", "index": 4859, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(args):\n if not args.quiet:\n print('Uploading.....')\n resp = postimg.Imgur(args.img_path).upload()\n if not resp['success']:\n if not args.quiet:\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(sql) try: cursor.execute(sql) db.commit() except: db.rollback() db.close() <|reserved_special_token_1|> <|reserved_special_token_0|> db = pymysql.connect(host='localhost', port=3306, user='root', password= ...
flexible
{ "blob_id": "8566e30a6450a72a0e441155321bd03363944b5a", "index": 8236, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(sql)\ntry:\n cursor.execute(sql)\n db.commit()\nexcept:\n db.rollback()\ndb.close()\n", "step-3": "<mask token>\ndb = pymysql.connect(host='localhost', port=3306, user='r...
[ 0, 1, 2, 3, 4 ]
import os import numpy as np import matplotlib.pyplot as plt from scipy.spatial import distance with open('input.txt', 'r') as f: data = f.read() res = [i for i in data.splitlines()] print(res) newHold = [] for line in res: newHold.append((tuple(int(i) for i in line.split(', ')))) print(newHold) mapper = np....
normal
{ "blob_id": "47476fbb78ca8ce14d30bf226795bbd85b5bae45", "index": 6939, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('input.txt', 'r') as f:\n data = f.read()\n<mask token>\nprint(res)\n<mask token>\nfor line in res:\n newHold.append(tuple(int(i) for i in line.split(', ')))\nprint(newHol...
[ 0, 1, 2, 3, 4 ]
def findLCS(read, cassette, rIndex, cIndex, cassettes): LCS = '' while True: if read[rIndex] == cassette[cIndex]: LCS += read[rIndex] rIndex = rIndex + 1 cIndex = cIndex + 1 else: break return LCS <|reserved_special_token_0|> def checkGap(L...
flexible
{ "blob_id": "5cec9e82aa994d07e25d8356a8218fc461bb8b4e", "index": 4728, "step-1": "def findLCS(read, cassette, rIndex, cIndex, cassettes):\n LCS = ''\n while True:\n if read[rIndex] == cassette[cIndex]:\n LCS += read[rIndex]\n rIndex = rIndex + 1\n cIndex = cIndex + 1...
[ 4, 5, 6, 7, 9 ]
# Generated by Django 2.1.2 on 2018-10-26 12:40 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0007_auto_20181010_0852'), ('accounts', '0004_playercards'), ] operations = [ migrations.RenameModel( old_name='PlayerCa...
normal
{ "blob_id": "59596c69df6a2c453fd147a9c8a2c7d47ed79fb3", "index": 3222, "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 = [('core', '000...
[ 0, 1, 2, 3, 4 ]
# coding=UTF-8 #!/usr/bin/env python # for models.py from django.db import models from django.db.models import F, Q, Sum, Avg from django.db import transaction from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.contrib.sites.models import Site # from ...
normal
{ "blob_id": "d551cab1856fbdb91918f9171d5c02b8dab84aba", "index": 8223, "step-1": "<mask token>\n", "step-2": "from django.db import models\nfrom django.db.models import F, Q, Sum, Avg\nfrom django.db import transaction\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.contenttype...
[ 0, 1, 2 ]
#!/usr/bin/env python2 ## -*- coding: utf-8 -*- import sys def sx(bits, value): sign_bit = 1 << (bits - 1) return (value & (sign_bit - 1)) - (value & sign_bit) SymVar_0 = int(sys.argv[1]) ref_263 = SymVar_0 ref_278 = ref_263 # MOV operation ref_5710 = ref_278 # MOV operation ref_5786 = ref_5710 # MOV operati...
normal
{ "blob_id": "22d3ff0fca9a5537da37bfbc968d83ec6f919752", "index": 5162, "step-1": "#!/usr/bin/env python2\n## -*- coding: utf-8 -*-\n\nimport sys\n\ndef sx(bits, value):\n sign_bit = 1 << (bits - 1)\n return (value & (sign_bit - 1)) - (value & sign_bit)\n\nSymVar_0 = int(sys.argv[1])\nref_263 = SymVar_0\nre...
[ 0 ]
import os import io import time import multiprocessing as mp from queue import Empty import picamera from PIL import Image from http import server import socketserver import numpy as np import cv2 class QueueOutputMJPEG(object): def __init__(self, queue, finished): self.queue = queue self.finished ...
normal
{ "blob_id": "ffd034eb5f0482c027dcc344bddb01b90249511c", "index": 3198, "step-1": "<mask token>\n\n\nclass QueueOutputMJPEG(object):\n\n def __init__(self, queue, finished):\n self.queue = queue\n self.finished = finished\n self.stream = io.BytesIO()\n\n def write(self, buf):\n i...
[ 12, 13, 16, 17, 18 ]
S = input() T = int(input()) B = abs(S.count('L') - S.count('R')) + abs(S.count('U') - S.count('D')) print(B + S.count('?') if T == 1 else max(B - S.count('?'), (B - S.count( '?')) % 2))
normal
{ "blob_id": "ce263424b856c07e04bd66cda7ebda646583b1fe", "index": 5962, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(B + S.count('?') if T == 1 else max(B - S.count('?'), (B - S.count(\n '?')) % 2))\n", "step-3": "S = input()\nT = int(input())\nB = abs(S.count('L') - S.count('R')) + abs(S.cou...
[ 0, 1, 2 ]
# Differences between Python 2 and Python 3 print "hello world" # become print("hello world") # in Pyton 3 raw_input('What is your name?') # become input('What is your name?') # in Python 3 # the language of Python # Reserved words and as assert break class continue def del elif else except finally for from g...
normal
{ "blob_id": "40471bfcf05ef45fbb070bbb5bfd4c425fe59b1c", "index": 7523, "step-1": "# Differences between Python 2 and Python 3\n\nprint \"hello world\" \n # become \nprint(\"hello world\") # in Pyton 3\n\nraw_input('What is your name?') \n# become\ninput('What is your name?') # in Python 3\n\n\n# the language of...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> clf.fit(X, y) <|reserved_special_token_0|> print('prediction = ' + str(prediction) + ', actual = ' + str(actual)) plt.matshow(digits.images[-1]) plt.show() <|reserved_special_token_1|> <|reserved_special_token_0|> digits = data...
flexible
{ "blob_id": "0d98472d1c04bfc52378aa6401a47d96582696a2", "index": 4046, "step-1": "<mask token>\n", "step-2": "<mask token>\nclf.fit(X, y)\n<mask token>\nprint('prediction = ' + str(prediction) + ', actual = ' + str(actual))\nplt.matshow(digits.images[-1])\nplt.show()\n", "step-3": "<mask token>\ndigits = dat...
[ 0, 1, 2, 3, 4 ]
import queue import copy import heapq import sys sys.setrecursionlimit(100000) dx =[1,0,0,-1] dy=[0,1,-1,0] class PriorityQueue: pq=[] elements={} task=0 def insert(self , priority,x_val,y_val): entry = [priority, self.task,x_val,y_val] self.elements[self.task]=entry heapq.hea...
normal
{ "blob_id": "6192099bdecffd9ce3576f4034567478145115a0", "index": 1291, "step-1": "<mask token>\n\n\nclass PriorityQueue:\n pq = []\n elements = {}\n task = 0\n\n def insert(self, priority, x_val, y_val):\n entry = [priority, self.task, x_val, y_val]\n self.elements[self.task] = entry\n ...
[ 12, 17, 18, 23, 25 ]
# -*- coding: utf-8 -*- from django.test import TestCase from ..printer import Printer class TestSunlumoProjectPrinter(TestCase): def test_printer(self): sl_prj = Printer('./sunlumo_mapserver/test_data/test_sunlumo.qgs') tmpFile = '/tmp/printtmp' sl_prj.printToPdf({ 'tmpFile...
normal
{ "blob_id": "5e0cba6952cdc677c640a0df325426ffc89189cd", "index": 658, "step-1": "<mask token>\n\n\nclass TestSunlumoProjectPrinter(TestCase):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestSunlumoProjectPrinter(TestCase):\n\n def test_printer(self):\n sl_prj = Printer(...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with ADBConnection('a95x01', domain='dohmens.local') as conn: print(conn.conn) <|reserved_special_token_1|> from adb_local_installer.connection import ADBConnection with ADBConnection('a95x01', domain='dohmens.local') as co...
flexible
{ "blob_id": "6f583fde0eeab84984629b795e428300503a49c9", "index": 9852, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith ADBConnection('a95x01', domain='dohmens.local') as conn:\n print(conn.conn)\n", "step-3": "from adb_local_installer.connection import ADBConnection\nwith ADBConnection('a95x01',...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.insert(0, '/path/to/mm-api/python') sys.path.insert(0, '/path/to/mm-api/distrib/python_osx') print(sys.path) <|reserved_special_token_0|> remote.connect() <|reserved_special_token_0|> remote.shutdown() <|reserved_specia...
flexible
{ "blob_id": "bf6d1ddf66bc0d54320c0491e344925a5f507df7", "index": 861, "step-1": "<mask token>\n", "step-2": "<mask token>\nsys.path.insert(0, '/path/to/mm-api/python')\nsys.path.insert(0, '/path/to/mm-api/distrib/python_osx')\nprint(sys.path)\n<mask token>\nremote.connect()\n<mask token>\nremote.shutdown()\n",...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def run_train(model_name, base_trainer, X, y): cv = StratifiedKFold(n_splits=3, shuffle=True, random_state=config.SEED) trainer = RSACVTrainer(cv, base_trainer) trainer.fit(X=X, y=y, random_state=config.SEED, num_seed=config.NUM_SEED) models = trainer.get_model() dump_...
flexible
{ "blob_id": "23f0ba622097eb4065337ea77ea8104a610d6857", "index": 6317, "step-1": "<mask token>\n\n\ndef run_train(model_name, base_trainer, X, y):\n cv = StratifiedKFold(n_splits=3, shuffle=True, random_state=config.SEED)\n trainer = RSACVTrainer(cv, base_trainer)\n trainer.fit(X=X, y=y, random_state=co...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class SudukoBoard: <|reserved_special_token_0|> <|reserved_special_token_0|> class Cell: def __init__(self, board, row, col): self._values = [None] * SudukoBoard.sz self._value = None self.sets = [] self.row = row ...
flexible
{ "blob_id": "44d9e628e31cdb36088b969da2f6e9af1b1d3efe", "index": 7841, "step-1": "<mask token>\n\n\nclass SudukoBoard:\n <mask token>\n <mask token>\n\n\n class Cell:\n\n def __init__(self, board, row, col):\n self._values = [None] * SudukoBoard.sz\n self._value = None\n ...
[ 6, 8, 9, 10, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> driver.implicitly_wait(10) driver.maximize_window() driver.get('http://demo.automationtesting.in/Register.html') <|reserved_special_token_0|> actions.move_to_element(interactions).move_to_element(drag).move_to_element( static)...
flexible
{ "blob_id": "1a1a217b382f3c58c6c4cd3c1c3f556ae945f5a7", "index": 7850, "step-1": "<mask token>\n", "step-2": "<mask token>\ndriver.implicitly_wait(10)\ndriver.maximize_window()\ndriver.get('http://demo.automationtesting.in/Register.html')\n<mask token>\nactions.move_to_element(interactions).move_to_element(dra...
[ 0, 1, 2, 3, 4 ]
import os import pickle from matplotlib import pyplot as plt cwd = os.path.join(os.getcwd(), 'DEDA_2020SS_Crypto_Options_RND_HD', 'CrypOpt_RiskNeutralDensity') data_path = os.path.join(cwd, 'data') + '/' day = '2020-03-11' res = pickle.load(open(data_path + 'results_{}.pkl'.format(day), 'rb')) ...
normal
{ "blob_id": "a01f812584e4cee14c9fe15e9fb6ede4ae3e937a", "index": 4953, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor key, ax in zip(sorted(res), axes.flatten()):\n print(key, ax)\n ax.plot(res[key]['df'].M, res[key]['df'].iv, '.')\n ax.plot(res[key]['M'], res[key]['smile'])\n ax.text(0.9...
[ 0, 1, 2, 3, 4 ]
#! /usr/bin/python3 import pprint import tkinter as tk from tkinter import messagebox from PIL import Image from tkinter import * from prettytable import PrettyTable import ttk import os import subprocess import mysql.connector from datetime import datetime import time db=mysql.connector.connect(host='localhost',user...
normal
{ "blob_id": "9f3fcc6e097e37479e3ccf1385f20d70d7c3b6c7", "index": 8228, "step-1": "<mask token>\n\n\ndef First_page(root):\n global T1, T2, T3\n frame = Frame(root, height=500, width=800, bg='ivory')\n frame.pack()\n label = Label(root, text='WELCOME TO AGRI MARKET', font=(\n 'Times new roman',...
[ 46, 47, 52, 53, 66 ]
# -*- coding: utf-8 -*- from django.shortcuts import render_to_response from django.views.generic import TemplateView from django.core.context_processors import csrf from django.template import RequestContext from django.views.generic import DetailView, ListView , CreateView , UpdateView , DeleteView , FormView , View ...
normal
{ "blob_id": "8a3694f96203ae8d1e306e1c9a5a47bfe26abeb1", "index": 5178, "step-1": "<mask token>\n\n\nclass ListContact(ListView):\n model = Contact\n", "step-2": "<mask token>\n\n\nclass AddContact(CreateView):\n model = Contact\n success_url = reverse_lazy('home')\n\n\nclass ListContact(ListView):\n ...
[ 2, 4, 5, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def initialize(x: object) ->object: data = [] starttimeinmillis = int(round(time.time())) c = 0 file1 = sys.argv[x] with open(file1) as datafile: for line in datafile: c += 1 i...
flexible
{ "blob_id": "91f3aae4e74f371cadaf10385510bc1c80063f55", "index": 7765, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef initialize(x: object) ->object:\n data = []\n starttimeinmillis = int(round(time.time()))\n c = 0\n file1 = sys.argv[x]\n with open(file1) as datafile:\n for...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class server: def __init__(self): self.commandSock = socket.socket() self.commandPort = 8080 self.transferSock = socket.socket() self.transferPort = 8088 self.chatSock = socket.socket() self.chatPort = 8085 self.host = '' ...
flexible
{ "blob_id": "4736f4e06f166b3c3fd8379a2021eb84a34fcbd3", "index": 6099, "step-1": "<mask token>\n\n\nclass server:\n\n def __init__(self):\n self.commandSock = socket.socket()\n self.commandPort = 8080\n self.transferSock = socket.socket()\n self.transferPort = 8088\n self.ch...
[ 7, 9, 11, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> main() <|reserved_special_token_1|> from .parapred import main main()
flexible
{ "blob_id": "96cb2754db2740767dfb145078ed17969e85123d", "index": 843, "step-1": "<mask token>\n", "step-2": "<mask token>\nmain()\n", "step-3": "from .parapred import main\nmain()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import json import os import time import urllib.request import pandas as pd from lib.db.dbutils import ( check_blacklisted, check_ticker_exists, get_db, update_blacklisted, ) def get_data(url, delay=20): while True: df = json.loads(urllib.request.urlopen(url).read()) if df.get("N...
normal
{ "blob_id": "3c8e6a93c4d5616b9199cf473d298bfa2dc191af", "index": 9971, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef grab_a_ticker(symbol='MSFT', apiKey=None):\n if apiKey is None:\n apiKey = os.environ.get('API_KEY')\n if not check_ticker_exists(symbol) and not check_blacklisted(sy...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(variable_1, variable_2, variable_3, sep=', ') print(variable_4, variable_5, sep=', ', end='!\n') <|reserved_special_token_0|> print(variable_4 + ', ' + user_name + '! ' + 'Ваш возраст: ' + user_age) <|reserved_special_toke...
flexible
{ "blob_id": "12ca9a81574d34d1004ac9ebcb2ee4b31d7171e2", "index": 5623, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(variable_1, variable_2, variable_3, sep=', ')\nprint(variable_4, variable_5, sep=', ', end='!\\n')\n<mask token>\nprint(variable_4 + ', ' + user_name + '! ' + 'Ваш возраст: ' + user...
[ 0, 1, 2 ]
#!/usr/bin/env python import requests import re def get_content(url): paste_info = { 'site': 'pomf', 'url': url } m = re.match('^.*/([0-9a-zA-Z]+)\.([a-zA-Z0-9]+)$',url) response = requests.get(url) if response.status_code != 200: return paste_info['ext'] = m.group(2) ...
normal
{ "blob_id": "78a6202f501bc116e21e98a3e83c9e3f8d6402b4", "index": 3981, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_content(url):\n paste_info = {'site': 'pomf', 'url': url}\n m = re.match('^.*/([0-9a-zA-Z]+)\\\\.([a-zA-Z0-9]+)$', url)\n response = requests.get(url)\n if respons...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def check_duplicate(fp1, fp2): """takes two files, does a diff on them, returns True if same""" try: subprocess.check_output(['diff', fp1, fp2]) return True except subprocess.CalledProcessError: return False def identify_uniq_ads(session_results): ...
flexible
{ "blob_id": "fdae984f7cf5e1c20dee197d3f2518a0c7c38bdc", "index": 8085, "step-1": "<mask token>\n\n\ndef check_duplicate(fp1, fp2):\n \"\"\"takes two files, does a diff on them, returns True if same\"\"\"\n try:\n subprocess.check_output(['diff', fp1, fp2])\n return True\n except subprocess...
[ 10, 14, 15, 16, 18 ]
<|reserved_special_token_0|> class BotModel(nn.Module): def __init__(self, dim, statedim, rel_count): super(BotModel, self).__init__() self.dim = dim self.hid2state = nn.Linear(dim * 3 + statedim * 2, statedim) self.state2probL = nn.ModuleList([nn.Linear(statedim, 7) for i in ...
flexible
{ "blob_id": "699410536c9a195024c5abbcccc88c17e8e095e3", "index": 6003, "step-1": "<mask token>\n\n\nclass BotModel(nn.Module):\n\n def __init__(self, dim, statedim, rel_count):\n super(BotModel, self).__init__()\n self.dim = dim\n self.hid2state = nn.Linear(dim * 3 + statedim * 2, statedi...
[ 7, 9, 10, 11, 12 ]
<|reserved_special_token_0|> @app.before_request def create_session(): g.session = scoped_session(DBSession) <|reserved_special_token_0|> def check_sig(payload, sig): pk = payload['sender_pk'] platform = payload['platform'] payload_json = json.dumps(payload) result = False if platform == '...
flexible
{ "blob_id": "d9bdf466abecb50c399556b99b41896eead0cb4b", "index": 2959, "step-1": "<mask token>\n\n\n@app.before_request\ndef create_session():\n g.session = scoped_session(DBSession)\n\n\n<mask token>\n\n\ndef check_sig(payload, sig):\n pk = payload['sender_pk']\n platform = payload['platform']\n pay...
[ 7, 8, 11, 12, 13 ]
""" Write two functions: 1. `to_list()`, which converts a number to an integer list of its digits. 2. `to_number()`, which converts a list of integers back to its number. ### Examples to_list(235) ➞ [2, 3, 5] to_list(0) ➞ [0] to_number([2, 3, 5]) ➞ 235 to_number([0]) ➞ 0 ### No...
normal
{ "blob_id": "5cced6d9f5e01b88951059bc89c5d10cfd160f60", "index": 8826, "step-1": "\"\"\"\r\n\n\nWrite two functions:\n\n 1. `to_list()`, which converts a number to an integer list of its digits.\n 2. `to_number()`, which converts a list of integers back to its number.\n\n### Examples\n\n to_list(235) ➞ [2, ...
[ 0 ]
class Account: '''은행계좌를 표현하는 클래스''' def __init__(self,name,account): self.name = name self._balance = amount def __str__(self): return '예금주 {}, 잔고 {}'.format(slef.name, self._balance) def _info(self): print('\t')
normal
{ "blob_id": "2dc4a4ae8e02e823073b1a9711dbd864a54bab43", "index": 5072, "step-1": "class Account:\n '''은행계좌를 표현하는 클래스'''\n \n\n def __init__(self,name,account):\n self.name = name\n self._balance = amount\n\n def __str__(self):\n return '예금주 {}, 잔고 {}'.format(slef.name, self._...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> admin.site.register(JobListing) admin.site.register(Employer) <|reserved_special_token_1|> from django.contrib import admin from .models import JobListing from .models import Employer admin.site.register(JobListing) admin.site....
flexible
{ "blob_id": "a96575d507a91472176c99d4d55e2a3bbf8111d1", "index": 2707, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(JobListing)\nadmin.site.register(Employer)\n", "step-3": "from django.contrib import admin\nfrom .models import JobListing\nfrom .models import Employer\nadmin.site....
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(f'NOW PROCESSING POST ID: {POST_ID}') <|reserved_special_token_0|> tts.comment_to_mp3(post_title, './quota.txt', 'titles', 0, randomize=True) <|reserved_special_token_0|> for comment in comments_from_post: tts.comment_to...
flexible
{ "blob_id": "fd57e13269ca00ed5eb05e00bd7999c041141187", "index": 4256, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(f'NOW PROCESSING POST ID: {POST_ID}')\n<mask token>\ntts.comment_to_mp3(post_title, './quota.txt', 'titles', 0, randomize=True)\n<mask token>\nfor comment in comments_from_post:\n ...
[ 0, 1, 2, 3, 4 ]
from covid import FuzzyNet import numpy as np import time if __name__ == '__main__': # mx1,mx2,mx3,my1,my2,my3, dx1,dx2,dx3,dy1,dy2,dy3, p1,p2,p3,p4,p5,p6,p7,p8,p9, q1,q2,q3,q4,q5,q6,q7,q8,q9, r1,r2,r3,r4,r5,r6,r7,r8,r9 generations = 100 for generation in range(generations): population = np.rando...
normal
{ "blob_id": "99f50d393e750bd8fa5bee21d99f08d20b9f5fe9", "index": 9102, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n generations = 100\n for generation in range(generations):\n population = np.random.randint(0, 255, size=(200, 39), dtype=np.uint8)\n print...
[ 0, 1, 2, 3 ]
from django.db import connection from .models import Order from .models import Package from .models import DeliveryStatus from .models import CalcParameters class DataService: def __init__(self): pass @staticmethod def get_all_orders(): orders = Order.objects.order_by('-order_date') ...
normal
{ "blob_id": "2e66a31638eb4e619f14a29d5d3847482d207003", "index": 3996, "step-1": "<mask token>\n\n\nclass StaticDataDao(type):\n\n @property\n def delivery_statuses(cls):\n if getattr(cls, '_delivery_statuses', None) is None:\n cls._delivery_statuses = list(DeliveryStatus.objects.all())\n...
[ 5, 6, 7, 8, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cv2.namedWindow('st', cv2.WINDOW_NORMAL) cv2.imshow('st', img) cv2.imwrite('mes.png', img) cv2.waitKey(0) cv2.destroyAllWindows() <|reserved_special_token_1|> <|reserved_special_token_0|> img = cv2.imread('d:\\st.jpg', 0) cv2.n...
flexible
{ "blob_id": "6b5399effe73d27eade0381f016cd7819a6e104a", "index": 2466, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.namedWindow('st', cv2.WINDOW_NORMAL)\ncv2.imshow('st', img)\ncv2.imwrite('mes.png', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n", "step-3": "<mask token>\nimg = cv2.imread('d:\\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def RegularGramSchmidt(): while True: vectors = utility.get_matrix_from_user(5) if len(vectors) > 0: calc = RGSC.RegularGramSchmidt() result_matrix = calc.calc(vectors) if ...
flexible
{ "blob_id": "b6b3d94db62b47aac9bf78e8224a38ccff9335e3", "index": 7591, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef RegularGramSchmidt():\n while True:\n vectors = utility.get_matrix_from_user(5)\n if len(vectors) > 0:\n calc = RGSC.RegularGramSchmidt()\n ...
[ 0, 1, 2, 3, 4 ]
import retro # pip install gym-retro import numpy as np # pip install numpy #import cv2 # pip install opencv-python import neat # pip install neat-python import pickle # pip install cloudpickle import os import multiprocessing import cv2 import time env = retro.make(game='Pong-...
normal
{ "blob_id": "36e350e0d578e169efaafb9e311566d71d6bc59e", "index": 1438, "step-1": "<mask token>\n\n\ndef eval_genome(genome, config):\n net = neat.nn.FeedForwardNetwork.create(genome, config)\n env.reset()\n ob, _, _, _ = env.step(env.action_space.sample())\n inx = int(ob.shape[0] / 8)\n iny = int(...
[ 3, 4, 5, 6, 7 ]
def main(): # defaults to 0 print a a = 7 a *= 6 print a
normal
{ "blob_id": "0527dc2b6fa0fe703b604c6e28fba44fe6def83b", "index": 1862, "step-1": "def main():\n # defaults to 0\n print a\n\n a = 7\n a *= 6\n print a\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
DATABASE_NAME = "user_db"
normal
{ "blob_id": "8c8bbbc682889c8d79c893f27def76ad70e8bf8d", "index": 233, "step-1": "<mask token>\n", "step-2": "DATABASE_NAME = 'user_db'\n", "step-3": "DATABASE_NAME = \"user_db\"", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
#!/usr/bin/env python3 """Shows how to call C code from python""" __appname__ = "myccalc.py" __author__ = "Joseph Palmer <joseph.palmer18@imperial.ac.uk>" __version__ = "0.0.1" __license__ = "License for this code/" __date__ = "Dec-2018" ## imports ## import os import ctypes # Load the C library into python - needs t...
normal
{ "blob_id": "12ecfd2750f79fd19355665b6e57c2103a3cac3e", "index": 4257, "step-1": "<mask token>\n", "step-2": "<mask token>\nctypes.cdll.LoadLibrary(so_filepath)\n<mask token>\nprint('The sum of %.1f and %.1f is %.1f' % (x, y, a))\n<mask token>\nprint('Subtracting %.1f from %.1f is %.1f' % (x, y, b))\n", "ste...
[ 0, 1, 2, 3, 4 ]
import os, sys import json import paramiko """ Copies the credentials.json file locally from robot """ def copy_credentials_file(hostname, username, password, src_path, dst_path): # create ssh connection ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client....
normal
{ "blob_id": "27f162f2e350fdb284740bd67f4293535f0ab593", "index": 8451, "step-1": "<mask token>\n\n\ndef copy_credentials_file(hostname, username, password, src_path, dst_path):\n ssh_client = paramiko.SSHClient()\n ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n ssh_client.connect(hos...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> TRAIN_INPUT_PATH = '~/Projects/competitions/titanic/data/train.csv' TEST_INPUT_PATH = '~/Projects/competitions/titanic/data/test.csv' OUTPUT_PATH = 'output/' TRAIN_VAL_SPLIT = 0.75 RANDOM_SEED = 42 MODEL = 'LOGISTIC_REGRESSION' LOG_PATH = 'logs/' <|reserved...
flexible
{ "blob_id": "f1f708f00e05941c9a18a24b9a7556558583c3c7", "index": 738, "step-1": "<mask token>\n", "step-2": "TRAIN_INPUT_PATH = '~/Projects/competitions/titanic/data/train.csv'\nTEST_INPUT_PATH = '~/Projects/competitions/titanic/data/test.csv'\nOUTPUT_PATH = 'output/'\nTRAIN_VAL_SPLIT = 0.75\nRANDOM_SEED = 42\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @contextmanager def temp_context() ->Generator[Path, None, None]: origin = Path().absolute() try: with tempfile.TemporaryDirectory(ignore_cleanup_errors=True ) as tempdir: os.chdir(tempdir...
flexible
{ "blob_id": "3c2a611fd001f145703853f5ecfe70d0e93844e4", "index": 4665, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@contextmanager\ndef temp_context() ->Generator[Path, None, None]:\n origin = Path().absolute()\n try:\n with tempfile.TemporaryDirectory(ignore_cleanup_errors=True\n ...
[ 0, 1, 2, 3 ]