code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
class Notification(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class SendMail(Notification):
def __init__(self, config,... | flexible | {
"blob_id": "01849a6bf5ce5eb75c549af28312f61711ad2494",
"index": 4425,
"step-1": "<mask token>\n\n\nclass Notification(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SendMail(Notification):\n\n def __init__(self, config, dry_run)... | [
11,
12,
15,
20,
21
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
game = tools.Game(setup.STATE_DICT, 'menu')
game.run()
<|reserved_special_token_1|>
from source import tools, setup
if __name__ == '__main__':
game = tools.Game(setup.STATE_DICT, 'menu')
... | flexible | {
"blob_id": "a7deec1693c411988445528dceb602bf69e47d21",
"index": 2532,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n game = tools.Game(setup.STATE_DICT, 'menu')\n game.run()\n",
"step-3": "from source import tools, setup\nif __name__ == '__main__':\n game = tools.... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def calc_fib(n):
fib_lis = dict()
for i in range(n + 1):
if i <= 1:
fib_lis[i] = i
else:
fib_lis[i] = fib_lis[i - 2] + fib_lis[i - 1]
return fib_lis[n]
<|reserved_special_token_0|>
<|reserved_special_tok... | flexible | {
"blob_id": "426b711571d3b5c4f8c7b0bad3a613951902e60b",
"index": 4129,
"step-1": "<mask token>\n",
"step-2": "def calc_fib(n):\n fib_lis = dict()\n for i in range(n + 1):\n if i <= 1:\n fib_lis[i] = i\n else:\n fib_lis[i] = fib_lis[i - 2] + fib_lis[i - 1]\n return f... | [
0,
1,
2,
3,
4
] |
<|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": "4cc138016cb1f82e12c76c185be19188d3e38bf9",
"index": 2186,
"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 = [('api', '0006... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from .alexnet import *
from .lenet import *
from .net import *
from .vae import *
| flexible | {
"blob_id": "56d5915d30e85285da549cc69ef25714bacc6f3a",
"index": 8304,
"step-1": "<mask token>\n",
"step-2": "from .alexnet import *\nfrom .lenet import *\nfrom .net import *\nfrom .vae import *\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
import csv
import tweepy
import pandas as pd
####input your credentials here
from tweepy.auth import OAuthHandler
auth = OAuthHandler('WNUpykrIjiGF0NKoV7qk7uiNj', 'Nhe0GjOkbaQKbPMLTqcAYQnqMnz3Edpdup28h2R2KqRLa6iBDN')
auth.set_access_token('956917059287375875-EThit80MxgQPTJlh7ZObqyHsoV8Q2D7', 'eLv893meGppqfX3xOr8SJ93kps... | normal | {
"blob_id": "b68cc09347584dfc613b2e38d036b124c9af7952",
"index": 1904,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nauth.set_access_token('956917059287375875-EThit80MxgQPTJlh7ZObqyHsoV8Q2D7',\n 'eLv893meGppqfX3xOr8SJ93kpsbZpoOiRsVM3XTgJryZM')\n<mask token>\nauth.set_access_token('956917059287375875-... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class CreatePasswordEmailValidationSerializer(serializers.Serializer):
<|reserved_special_token_0|>
def save(self):
validation_code = randrange(10000000, 100000000)
email = Email.objects.create(validation_code=validation_code, to=
self.validated_data.g... | flexible | {
"blob_id": "9f34bf3a0bb24db428b7af1a354aec1d3a72df98",
"index": 359,
"step-1": "<mask token>\n\n\nclass CreatePasswordEmailValidationSerializer(serializers.Serializer):\n <mask token>\n\n def save(self):\n validation_code = randrange(10000000, 100000000)\n email = Email.objects.create(valida... | [
15,
16,
18,
19,
21
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('Insert a number')
<|reserved_special_token_0|>
if num1 > 0:
print(f'The square root of {num1} is {math.sqrt(num1)}')
else:
print(f'The square of {num1} is {num1 ** 2}')
<|reserved_special_token_1|>
<|reserved_spe... | flexible | {
"blob_id": "a68d682ba6d441b9d7fb69ec1ee318a0ef65ed40",
"index": 3146,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Insert a number')\n<mask token>\nif num1 > 0:\n print(f'The square root of {num1} is {math.sqrt(num1)}')\nelse:\n print(f'The square of {num1} is {num1 ** 2}')\n",
"step-3"... | [
0,
1,
2,
3,
4
] |
# encoding=utf-8
'''
Finding log2() using sqrt()
原理: sqrt( 2**l * 2**h ) = 2**( (l+h)/2 )
而 a+b /2 正好是binary search, 与sqrt对应上了
题目应当是要求
意思就是找到2**x == y
'''
class Solution:
def log2(self, val):
if 0<val<1: return -self.log2(1.0/val)
if val==1: return 0
h = 1; accuracy = 0.001; ... | normal | {
"blob_id": "6ea41b0a76ddde04bcaffacea604f218eac9ac71",
"index": 1783,
"step-1": "# encoding=utf-8\n'''\nFinding log2() using sqrt()\n\n\n原理: sqrt( 2**l * 2**h ) = 2**( (l+h)/2 )\n而 a+b /2 正好是binary search, 与sqrt对应上了\n\n题目应当是要求\n\n意思就是找到2**x == y\n'''\n\nclass Solution:\n def log2(self, val):\n ... | [
0
] |
class User:
def __init__(self, username, password):
self.username = username
self.password = password
def __str__(self):
return 'Credentials: ' + self.username + ' - ' + self.password
def login(self):
print('Login done by "%s".' % self.username)
felipe = User(username='f... | normal | {
"blob_id": "fb26337be29ce06674ca2cb2a82eaff7624aa17f",
"index": 9259,
"step-1": "class User:\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass Admin(User):\n\n def __init__(self, username, password, phone, email):\n super().__init__(username, password)\n self.ph... | [
5,
8,
9,
10
] |
<|reserved_special_token_0|>
def dataX(features, set):
data_x = np.array([])
count = 0
for filepath in glob.iglob(set):
globpath = filepath + '\\*.jpg'
for filepath in glob.iglob('' + globpath):
count = count + 1
img = Image.open(filepath).convert('L')
d... | flexible | {
"blob_id": "f8d815bcdc74452b66a1b3b33bf0fbe976e728c8",
"index": 231,
"step-1": "<mask token>\n\n\ndef dataX(features, set):\n data_x = np.array([])\n count = 0\n for filepath in glob.iglob(set):\n globpath = filepath + '\\\\*.jpg'\n for filepath in glob.iglob('' + globpath):\n ... | [
3,
4,
5,
6,
7
] |
from packet import Packet
from packetConstructor import PacketConstructor
import threading
import time
class PacketSender:
"""
Packet represents a simulated UDP packet.
"""
# The next seq num for sent packets
seq_num = 0
# The next seq num for acks that we're waiting for
next_seq_num = 0
... | normal | {
"blob_id": "47c1ad4bd1ceffa38eef467ea8eb59dbd2fc2ebb",
"index": 262,
"step-1": "<mask token>\n\n\nclass PacketSender:\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 def awa... | [
3,
5,
9,
10,
11
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# sockdemo.py
#
# test
import struct, threading, signal
a = ''
if not a:
print 'a'
else:
print 'b'
import datetime, time, os
print datetime.datetime.now().strftime('%m-%d %H:%M:%S')
def double(x): return x*x
arr = [1, 2, 3, 4, 5]
print map(double, arr)
print 2**16
... | normal | {
"blob_id": "54d6121898dc027d6ecaf9c9e7c25391778e0d21",
"index": 7311,
"step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# sockdemo.py\n#\n# test\n\nimport struct, threading, signal\n\na = ''\n\nif not a:\n\tprint 'a'\nelse:\n\tprint 'b'\n\nimport datetime, time, os\n\nprint datetime.datetime.now().strf... | [
0
] |
# Write function that determines if a string a palindrome off of any permutation
def palinPerm(str):
# Create empty set
charSet = set()
# Loop through string, if character does not exist in set, add it. If it does, remove it.
for c in str:
if c not in charSet:
charSet.add(c)
else:
charSet.r... | normal | {
"blob_id": "04487dce97231a7be2bf3b164e93f0ea4d01ba05",
"index": 1160,
"step-1": "<mask token>\n",
"step-2": "def palinPerm(str):\n charSet = set()\n for c in str:\n if c not in charSet:\n charSet.add(c)\n else:\n charSet.remove(c)\n return len(charSet) == 1 or len(... | [
0,
1,
2,
3,
4
] |
import sys
import queue as q
from utils import *
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lines = sys.stdin.readlines()
i_max = len(lines)
j_max = len(lines[0])
deltas = [
((0, 0), (0, 1), (0, 2)),
((0, 1), (0, 2), (0, 0)),
((0, 0), (1, 0), (2, 0)),
((1, 0), (2, 0), (0, 0)),
]
p... | normal | {
"blob_id": "973fc3a973d952cb0f192221dfda63e255e4a8a0",
"index": 2543,
"step-1": "<mask token>\n\n\ndef nextsteps(point):\n for ns in nextsteps2d(point):\n yield ns\n if point in portals:\n yield portals[point]\n\n\ndef should_visit(point):\n return lines[point[0]][point[1]] == '.'\n\n\n<m... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
class CodeGenerator:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "8443d208a6a6bef82240235eeadbf6f8eaf77bcb",
"index": 2995,
"step-1": "<mask token>\n\n\nclass CodeGenerator:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask t... | [
43,
45,
82,
94,
103
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 09:54:28 2020
@author: rushirajsinhparmar
"""
import matplotlib.pyplot as plt
from skimage import io
import numpy as np
from skimage.filters import threshold_otsu
import cv2
img = io.imread("texture.png", as_gray=True)
#######################... | normal | {
"blob_id": "ab6c3d3c6faa2d1fe5e064dbdebd8904b9434f15",
"index": 5214,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.imshow(img_var, cmap='gray')\n<mask token>\nplt.imshow(filtered_image, cmap='gray')\n<mask token>\nplt.imshow(entropy_img)\nplt.hist(entropy_img.flat, bins=100, range=(0, 7))\n<mask t... | [
0,
1,
2,
3,
4
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.