code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if number <= 100: print('Your number is smaller than equal to 100') else: print('Your number is greater than 100') <|reserved_special_token_1|> number = int(input('Enter an integer')) if number <= 100: print('Your n...
flexible
{ "blob_id": "9666c87b4d4dc721683ea33fdbbeadefc65a0cd1", "index": 1860, "step-1": "<mask token>\n", "step-2": "<mask token>\nif number <= 100:\n print('Your number is smaller than equal to 100')\nelse:\n print('Your number is greater than 100')\n", "step-3": "number = int(input('Enter an integer'))\nif ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def is_element(el, tag): return isinstance(el, Tag) and el.name == tag class ElemIterator: def __init__(self, els): self.els = els self.i = 0 def peek(self): try: return self.els[self.i] except IndexError: return None...
flexible
{ "blob_id": "cb08f64d1ad7e53f1041684d4ca4ef65036c138d", "index": 44, "step-1": "<mask token>\n\n\ndef is_element(el, tag):\n return isinstance(el, Tag) and el.name == tag\n\n\nclass ElemIterator:\n\n def __init__(self, els):\n self.els = els\n self.i = 0\n\n def peek(self):\n try:\n...
[ 10, 12, 14, 15, 16 ]
import pytest def test_template(): assert True
normal
{ "blob_id": "e7fa84dbc037253c7f852aa618e6ea88d1fda909", "index": 1939, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_template():\n assert True\n", "step-3": "import pytest\n\n\ndef test_template():\n assert True\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, ...
[ 0, 1, 2 ]
import numpy as np import cv2 import os from moviepy.editor import * N = 1 # Initiate SIFT detector sift = cv2.xfeatures2d.SIFT_create() # count file number in folder frames list = os.listdir('./frames') number_files = len(list) # array to store similarity of 2 consecutive frames similarity = [] boundaries = [] ke...
normal
{ "blob_id": "397d9b1030a1ec08d04d2101f65a83547495b861", "index": 7165, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(0, number_files - N - 1, N):\n img1 = cv2.imread('./frames/frame%d.jpg' % i, 0)\n img2 = cv2.imread('./frames/frame%d.jpg' % (i + N), 0)\n kp1, des1 = sift.detectA...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SolverError(Exception): pass <|reserved_special_token_0|> def ecos_solve(A, b, c, dim_dict, **kwargs): """Wraps ecos.solve for convenience.""" ecos_cones = {'l': dim_dict['l'] if 'l' in dim_dict else 0, 'q': dim_dict['q'] if 'q' in dim_dict else []} if '...
flexible
{ "blob_id": "00a0668d5fcb8358b4bd7736c48e4867afc0f5b6", "index": 780, "step-1": "<mask token>\n\n\nclass SolverError(Exception):\n pass\n\n\n<mask token>\n\n\ndef ecos_solve(A, b, c, dim_dict, **kwargs):\n \"\"\"Wraps ecos.solve for convenience.\"\"\"\n ecos_cones = {'l': dim_dict['l'] if 'l' in dim_dic...
[ 2, 3, 4, 5, 6 ]
from states.state import State class MoveDigState(State): #init attributes of state def __init__(self): super().__init__("MoveDig", "ScanDig") self.transitionReady = False self.digSiteDistance = 0 #implementation for each state: overridden def run(self, moveInstructions): ...
normal
{ "blob_id": "ce4ecff2012cfda4a458912713b0330a218fa186", "index": 873, "step-1": "<mask token>\n\n\nclass MoveDigState(State):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MoveDigState(State):\n\n def __init__(self):\n super().__init__('MoveDig', 'ScanDi...
[ 1, 2, 4, 5, 6 ]
import bz2 import json import os from pyspark.context import SparkContext from pyspark.accumulators import AccumulatorParam import numpy as np from scipy import spatial import pandas as pd import re import operator import csv CACHE_DIR = "D:\TwitterDatastream\PYTHONCACHE_SMALL" EDU_DATA = 'merged.csv' TRAIN_FEAT_CSV =...
normal
{ "blob_id": "ee58ed68d2f3c43f9611f6c6e4cd2b99adcb43d2", "index": 2616, "step-1": "<mask token>\n\n\nclass WordsSetAccumulatorParam(AccumulatorParam):\n\n def zero(self, v):\n return set()\n\n def addInPlace(self, acc1, acc2):\n return acc1.union(acc2)\n\n\nclass WordsDictAccumulatorParam(Accu...
[ 10, 14, 15, 18, 20 ]
from battleship.board import Board from battleship.game import Game import string # Board row_num = list(string.ascii_lowercase[:10]) # A-J col_num = 10 board = Board(row_num, col_num) board.display_board() # Game guesses = 25 quit = 'q' game = Game(guesses, quit) game.take_shot("\nChoose a spot to fire at in enemy...
normal
{ "blob_id": "dd06847c3eb9af6e84f247f8f0dd03961d83688e", "index": 9453, "step-1": "<mask token>\n", "step-2": "<mask token>\nboard.display_board()\n<mask token>\ngame.take_shot(\"\"\"\nChoose a spot to fire at in enemy seas: \"\"\", board)\n", "step-3": "<mask token>\nrow_num = list(string.ascii_lowercase[:10...
[ 0, 1, 2, 3, 4 ]
class Solution: <|reserved_special_token_0|> def gameOfLife(self, board): """ Do not return anything, modify board in-place instead. """ self.gameOfLife_2(board) def gameOfLife_1(self, board): """ Space complexity is O(M*N).Time complexity is O(M*N) ...
flexible
{ "blob_id": "5b6ed75279b39a1dad1bf92535c4b129bb599350", "index": 3612, "step-1": "class Solution:\n <mask token>\n\n def gameOfLife(self, board):\n \"\"\"\n Do not return anything, modify board in-place instead.\n \"\"\"\n self.gameOfLife_2(board)\n\n def gameOfLife_1(self, b...
[ 4, 6, 7, 8, 9 ]
"""Test functions for util.mrbump_util""" import pickle import os import sys import unittest from ample.constants import AMPLE_PKL, SHARE_DIR from ample.util import mrbump_util class Test(unittest.TestCase): @classmethod def setUpClass(cls): cls.thisd = os.path.abspath(os.path.dirname(__file__)) ...
normal
{ "blob_id": "f6dd5acc75d1a85a996629e22e81cdef316c1dcd", "index": 8939, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n\n def test_final_summary(self):\n pkl = os.path.join(self.testfiles_dir, AMPLE_PKL)\n if not os.path.isfile(pkl):\n return\n wi...
[ 3, 4, 5, 6, 7 ]
import csv import os events = {} eventTypes = set() eventIndices = {} i = 0 with open('Civ VI Modding Companion - Events.csv', newline='') as csvfile: reader = csv.reader(csvfile, delimiter=',', quotechar='|') for row in reader: if i < 4: i += 1 continue eventName = row[3] eventType = "GameEvents" if...
normal
{ "blob_id": "5ce98ae241c0982eeb1027ffcff5b770f94ff1a3", "index": 77, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('Civ VI Modding Companion - Events.csv', newline='') as csvfile:\n reader = csv.reader(csvfile, delimiter=',', quotechar='|')\n for row in reader:\n if i < 4:\n ...
[ 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": "1f63ce2c791f0b8763aeae15df4875769f6de848", "index": 4942, "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 = [('currency_ex...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Food(models.Model): Food_ID = models.AutoField(primary_key=True) Food_Name = models.CharField(max_length=250) Food_Pic = models.ImageField(upload_to='Restaurants/Pictures/Food') Food_Category_ID = models.ForeignKey(FoodCategory, on_delete=models.CASCADE ) ...
flexible
{ "blob_id": "7ea1ee7c55cd53f7137c933790c3a22957f0ffea", "index": 4987, "step-1": "<mask token>\n\n\nclass Food(models.Model):\n Food_ID = models.AutoField(primary_key=True)\n Food_Name = models.CharField(max_length=250)\n Food_Pic = models.ImageField(upload_to='Restaurants/Pictures/Food')\n Food_Cate...
[ 2, 4, 5, 6, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('o dobro deste numero é', t3 * 2) print('O triplo deste numero é', t3 * 3) print('E a raiz quadrada deste numero é', t3 ** (1 / 2)) <|reserved_special_token_1|> t3 = float(input('Digite um numero: ')) print('o dobro deste...
flexible
{ "blob_id": "005ea8a1e75447b2b1c030a645bde5d0cdc8fb53", "index": 3532, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('o dobro deste numero é', t3 * 2)\nprint('O triplo deste numero é', t3 * 3)\nprint('E a raiz quadrada deste numero é', t3 ** (1 / 2))\n", "step-3": "t3 = float(input('Digite um nu...
[ 0, 1, 2 ]
#-*- coding: utf-8 -*- espacos = ["__1__", "__2__", "__3__", "__4__"] facil_respostas=["ouro","leao","capsula do poder","relampago de plasma"] media_respostas=["Ares","Saga","Gemeos","Athena"] dificil_respostas=["Shion","Aries","Saga","Gemeos"] def inicio_game(): apresentacao=raw_input("Bem vindo ao qui...
normal
{ "blob_id": "d205c38e18b1acf8043a5976a90939b14358dc40", "index": 7855, "step-1": "#-*- coding: utf-8 -*-\r\nespacos = [\"__1__\", \"__2__\", \"__3__\", \"__4__\"]\r\nfacil_respostas=[\"ouro\",\"leao\",\"capsula do poder\",\"relampago de plasma\"]\r\nmedia_respostas=[\"Ares\",\"Saga\",\"Gemeos\",\"Athena\"]\r\ndi...
[ 0 ]
<|reserved_special_token_0|> def start_button_callback(obj, w, h, amount): _max = int(w.get()) * int(h.get()) if not (obj.validation_check(w) and obj.validation_check(h) and obj. validation_check(amount, _max)): ctypes.windll.user32.MessageBoxW(0, 'Wprowadź poprawne dane', 'Błąd', 1 ...
flexible
{ "blob_id": "65eb7d01ccea137605d54d816b707c2cd3709931", "index": 2067, "step-1": "<mask token>\n\n\ndef start_button_callback(obj, w, h, amount):\n _max = int(w.get()) * int(h.get())\n if not (obj.validation_check(w) and obj.validation_check(h) and obj.\n validation_check(amount, _max)):\n ct...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def player(x, y): screen.blit(player_image, (x, y)) def fire_bullet(x, y, n): global bullet_fired bullet_fired[n] = True screen.blit(bullet_image, (x + 16, y + 10)) def add_bullet(): global num_bullet num_bullet += 1 bullet_X.append(0) bullet_Y.append(p...
flexible
{ "blob_id": "f5dffa3c22bb35ed07cb5ca28f2ba02ea3c07dda", "index": 1083, "step-1": "<mask token>\n\n\ndef player(x, y):\n screen.blit(player_image, (x, y))\n\n\ndef fire_bullet(x, y, n):\n global bullet_fired\n bullet_fired[n] = True\n screen.blit(bullet_image, (x + 16, y + 10))\n\n\ndef add_bullet():\...
[ 15, 16, 18, 19, 20 ]
from django.conf.urls import url from django.urls import path from .views import * from flujo.views import * """ URL para el Sprint crear, listar y modificar """ urlpatterns = [ url(r'^$', SprintListView.as_view(), name='sprint_list'), path('create/', view=CreateSprintView.as_view(), name='create_sprint'), ...
normal
{ "blob_id": "2b1ec422a42af59a048c708f86b686eb0564b51f", "index": 2456, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', SprintListView.as_view(), name='sprint_list'),\n path('create/', view=CreateSprintView.as_view(), name='create_sprint'),\n path('modificar/<int:sprint_pk>/'...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class LibpopplerConan(ConanFile): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_t...
flexible
{ "blob_id": "848394e1e23d568f64df8a98527a8e177b937767", "index": 3380, "step-1": "<mask token>\n\n\nclass LibpopplerConan(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>...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(x) <|reserved_special_token_1|> <|reserved_special_token_0|> client = pymongo.MongoClient('mongodb://localhost:27017/') db = client['Test'] col = db['C100'] x = col.find_one() print(x) <|reserved_special_token_1|> impo...
flexible
{ "blob_id": "7d10fb58aa5213516c656c05966fcaad6868ae81", "index": 1548, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(x)\n", "step-3": "<mask token>\nclient = pymongo.MongoClient('mongodb://localhost:27017/')\ndb = client['Test']\ncol = db['C100']\nx = col.find_one()\nprint(x)\n", "step-4": "im...
[ 0, 1, 2, 3, 4 ]
import sys,argparse import os,glob import numpy as np import pandas as pd import re,bisect from scipy import stats import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt matplotlib.rcParams['font.size']=11 import seaborn as sns sns.set(font_scale=1.1) sns.set_style("whitegrid", {'axes.grid' : False})...
normal
{ "blob_id": "4ee47435bff1b0b4a7877c06fb13d13cf53b7fce", "index": 3910, "step-1": "<mask token>\n\n\ndef return_dci_df(DCI_dir, subdir, hm_mark, compr_type, suffix):\n dci_file = '{}/{}/{}_{}{}.csv'.format(DCI_dir, subdir, hm_mark,\n compr_type, suffix)\n if os.path.isfile(dci_file):\n dci_df ...
[ 3, 4, 5, 6, 7 ]
from textmagic.rest import TextmagicRestClient username = 'lucychibukhchyan' api_key = 'sjbEMjfNrrglXY4zCFufIw9IPlZ3SA' client = TextmagicRestClient(username, api_key) message = client.message.create(phones="7206337812", text="wow i sent a text from python!!!!")
normal
{ "blob_id": "1ba39cfc1187b0efc7fc7e905a15de8dc7f80e0d", "index": 8888, "step-1": "<mask token>\n", "step-2": "<mask token>\nusername = 'lucychibukhchyan'\napi_key = 'sjbEMjfNrrglXY4zCFufIw9IPlZ3SA'\nclient = TextmagicRestClient(username, api_key)\nmessage = client.message.create(phones='7206337812', text=\n ...
[ 0, 1, 2, 3 ]
ii = [('CookGHP3.py', 2), ('MarrFDI.py', 1), ('GodwWSL2.py', 2), ( 'ChanWS.py', 6), ('SadlMLP.py', 1), ('WilbRLW.py', 1), ('AubePRP2.py', 1), ('MartHSI2.py', 1), ('WilbRLW5.py', 1), ('KnowJMM.py', 1), ( 'AubePRP.py', 2), ('ChalTPW2.py', 1), ('ClarGE2.py', 2), ('CarlTFR.py', 3), ('SeniNSP.py', 4), ('Gri...
normal
{ "blob_id": "b80ccee42489aefb2858b8491008b252f6a2b9b7", "index": 4864, "step-1": "<mask token>\n", "step-2": "ii = [('CookGHP3.py', 2), ('MarrFDI.py', 1), ('GodwWSL2.py', 2), (\n 'ChanWS.py', 6), ('SadlMLP.py', 1), ('WilbRLW.py', 1), ('AubePRP2.py', \n 1), ('MartHSI2.py', 1), ('WilbRLW5.py', 1), ('KnowJM...
[ 0, 1 ]
<|reserved_special_token_0|> class GroupVariable(GroupElement, Variable): def __init__(self, g: Group, symbol: str): GroupElement.__init__(self, g) Variable.__init__(self, symbol) def __hash__(self): return hash((self.group, self.symbol)) def __eq__(self, x): return type...
flexible
{ "blob_id": "93133b9a62d50e4e48e37721585116c1c7d70761", "index": 2490, "step-1": "<mask token>\n\n\nclass GroupVariable(GroupElement, Variable):\n\n def __init__(self, g: Group, symbol: str):\n GroupElement.__init__(self, g)\n Variable.__init__(self, symbol)\n\n def __hash__(self):\n r...
[ 18, 31, 34, 35, 37 ]
from enum import Enum EXIT_CODES = [ "SUCCESS", "BUILD_FAILURE", "PARSING_FAILURE", "COMMAND_LINE_ERROR", "TESTS_FAILED", "PARTIAL_ANALYSIS_FAILURE", "NO_TESTS_FOUND", "RUN_FAILURE", "ANALYSIS_FAILURE", "INTERRUPTED", "LOCK_HEL...
normal
{ "blob_id": "5e86e97281b9d18a06efc62b20f5399611e3510d", "index": 8000, "step-1": "<mask token>\n\n\nclass CPU(DistantEnum):\n k8 = 'k8'\n piii = 'piii'\n darwin = 'darwin'\n freebsd = 'freebsd'\n armeabi = 'armeabi-v7a'\n arm = 'arm'\n aarch64 = 'aarch64'\n x64_windows = 'x64_windows'\n ...
[ 4, 5, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def sort_descending(numbers): numbers.sort(reverse=True)
flexible
{ "blob_id": "46dc9917d9b3a7caf8d7ba5024b17d3b755fc5db", "index": 7278, "step-1": "<mask token>\n", "step-2": "def sort_descending(numbers):\n numbers.sort(reverse=True)\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> Generation().addTool(SignalRepeatedHadronization) <|reserved_special_token_0|> ToolSvc().addTool(EvtGenDecay) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> Generation().EventType = 16303...
flexible
{ "blob_id": "7cc9d445d712d485eaebd090d2485dac0c38b3fb", "index": 5918, "step-1": "<mask token>\n", "step-2": "<mask token>\nGeneration().addTool(SignalRepeatedHadronization)\n<mask token>\nToolSvc().addTool(EvtGenDecay)\n<mask token>\n", "step-3": "<mask token>\nGeneration().EventType = 16303437\nGeneration(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Item(object): <|reserved_special_token_0|> def convert_string_to_item(self, string): tokens = str(string).split(',') self._platform_type = tokens[0] self._sensor_name = tokens[1] self._topic = tokens[2] self._frequent = int(tokens[3])...
flexible
{ "blob_id": "3375bc94d214b0b1c67986d35b0587714dd63bcd", "index": 7723, "step-1": "<mask token>\n\n\nclass Item(object):\n <mask token>\n\n def convert_string_to_item(self, string):\n tokens = str(string).split(',')\n self._platform_type = tokens[0]\n self._sensor_name = tokens[1]\n ...
[ 13, 17, 18, 19, 20 ]
<|reserved_special_token_0|> class Solution: def countStudents(self, students, sandwiches) ->int: if not students or not sandwiches: return 0 while students: top_san = sandwiches[0] if top_san == students[0]: students = students[1:] ...
flexible
{ "blob_id": "235fce2615e2a5879f455aac9bcecbc2d152679b", "index": 4548, "step-1": "<mask token>\n\n\nclass Solution:\n\n def countStudents(self, students, sandwiches) ->int:\n if not students or not sandwiches:\n return 0\n while students:\n top_san = sandwiches[0]\n ...
[ 2, 3, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> setup(name=NagAconda.__name__, version=NagAconda.__version__, description= 'NagAconda is a Python Nagios wrapper.', long_description=open('README' ).read(), author='Steven Schlegel', author_email='steven@schlegel.tech', ...
flexible
{ "blob_id": "c3719f30bcf13061134b34b0925dfa2af4535f14", "index": 7854, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name=NagAconda.__name__, version=NagAconda.__version__, description=\n 'NagAconda is a Python Nagios wrapper.', long_description=open('README'\n ).read(), author='Steven Schle...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Mon Sep 11 07:41:34 2017 @author: Gabriel """ months = 12 balance = 4773 annualInterestRate = 0.2 monthlyPaymentRate = 434.9 monthlyInterestRate = annualInterestRate / 12 while months > 0: minimumMonPayment = monthlyPaymentRate * balance monthlyUnpaidBa...
normal
{ "blob_id": "299b437c007d78c3d9a53205de96f04d2c6118e0", "index": 7662, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile months > 0:\n minimumMonPayment = monthlyPaymentRate * balance\n monthlyUnpaidBalan = balance - monthlyPaymentRate\n balance = monthlyUnpaidBalan + monthlyInterestRate * mo...
[ 0, 1, 2, 3 ]
from django.db import models class Event(models.Model): name = models.TextField() host = models.TextField(null=True) fields = models.TextField(null=True) description = models.TextField(null=True) date = models.TextField() start_time = models.TextField() end_time = models.TextField() ba...
normal
{ "blob_id": "170716ccaaf45db2ee974de260883a8d70513f52", "index": 7583, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Event(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 t...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Quest: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class NoobQuest(Quest): def __init__(self): self.quest_status = 0 self.quest_name = 'Kill the Rat!' self.reward_gold = 250 self.reward_exp...
flexible
{ "blob_id": "4d31985cf1266619406d79a7dbae269c10f21bda", "index": 5510, "step-1": "<mask token>\n\n\nclass Quest:\n <mask token>\n <mask token>\n <mask token>\n\n\nclass NoobQuest(Quest):\n\n def __init__(self):\n self.quest_status = 0\n self.quest_name = 'Kill the Rat!'\n self.re...
[ 5, 6, 8, 9, 10 ]
from django import forms from django.forms import inlineformset_factory from django.utils.translation import ugettext, ugettext_lazy as _ from django.contrib.auth.models import User from django.conf import settings from django.db.models import Max from auction.models import * from datetime import * from decimal import ...
normal
{ "blob_id": "5215b5e4efe2e126f18b3c4457dc3e3902923d49", "index": 6360, "step-1": "<mask token>\n\n\nclass UserForm(forms.ModelForm):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = User\n fields = 'first_name', 'last_name', 'email'\n <mask token>\n <mask t...
[ 10, 11, 15, 16, 17 ]
# The Minion Game # Kevin and Stuart want to play the 'The Minion Game'. # Your task is to determine the winner of the game and their score. """ Game Rules Both players are given the same string, S. Both players have to make substrings using the letters of the string S. Stuart has to make words starting with consonant...
normal
{ "blob_id": "c96ebfe41b778e85e954e2b7d6de4b078e72c81f", "index": 7203, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(len(string)):\n if string[i] in vowels:\n Kevin += len(string) - i\n else:\n Stuart += len(string) - i\nif Kevin > Stuart:\n print('Kevin', Kevin)\ne...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in r: print(i.group(1)) provinceName = i.group(1) provinceShortName = i.group(2) confirmedCount = i.group(3) iter_dict.setdefault(provinceShortName, confirmedCount) <|reserved_special_token_1|> <|reser...
flexible
{ "blob_id": "5aecd021297fee4407d6b529c24afb3c6398f7ba", "index": 7205, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in r:\n print(i.group(1))\n provinceName = i.group(1)\n provinceShortName = i.group(2)\n confirmedCount = i.group(3)\n iter_dict.setdefault(provinceShortName, confirm...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BayesNetClassifier: def __init__(self, train_file, out_file): self.train_file = train_file self.out_file = out_file self.word_count_loc = {} self.word_probs = {} self.l_probs = {} self.word_counts = {} self.common_words = ...
flexible
{ "blob_id": "dee7b12862d02837fbb0f2310b136dd768ca7bab", "index": 3277, "step-1": "<mask token>\n\n\nclass BayesNetClassifier:\n\n def __init__(self, train_file, out_file):\n self.train_file = train_file\n self.out_file = out_file\n self.word_count_loc = {}\n self.word_probs = {}\n ...
[ 3, 6, 7, 8, 10 ]
import re def parse_rule(rule): elem_regex = re.compile("(\d+) (.*) bags?.*") rule = rule[:-1] color, inside = tuple(rule.split(" bags contain")) result = [] for element in inside.split(","): match = elem_regex.search(element) if match: result.append((match.gro...
normal
{ "blob_id": "730aaa0404a0c776ce4d3a351f292f90768b6867", "index": 7781, "step-1": "<mask token>\n\n\ndef get_neighbours(graph, v):\n return [color for color, _ in graph[v]]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef parse_rule(rule):\n elem_regex = re.compile('(\\\\d+) (.*) bags?.*')\n rule...
[ 1, 4, 5, 6, 7 ]
import tkinter as tk from pickplace import PickPlace import sys import math from tkinter import messagebox import os DEBUG = False class GerberCanvas: file_gto = False file_gtp = False units = 0 units_string = ('i', 'm') """ my canvas """ def __init__(self, frame): self.x_fo...
normal
{ "blob_id": "6b2f10449909d978ee294a502a376c8091af06e0", "index": 1285, "step-1": "<mask token>\n\n\nclass GerberCanvas:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, frame):\n self.x_format = ''\n self.y_format = ''\n self...
[ 18, 19, 20, 23, 25 ]
<|reserved_special_token_0|> class ModuloConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ModuloConfig(AppConfig): <|reserved_special_token_0|> <|reserved_special_token_0|>...
flexible
{ "blob_id": "31275ca9e20da9d2709ea396e55c113b3ff4f571", "index": 7738, "step-1": "<mask token>\n\n\nclass ModuloConfig(AppConfig):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ModuloConfig(AppConfig):\n <mask token>\n <mask token>\n\n def ready(self):\n ...
[ 1, 2, 3, 4, 5 ]
from multiprocessing import Process, Queue def f(q): for i in range(0,100): print("come on baby") q.put([42, None, 'hello']) if __name__ == '__main__': q = Queue() p = Process(target=f, args=(q,)) p.start() for j in range(0, 2000): if j == 1800: print(q.get()) ...
normal
{ "blob_id": "c7258d77db2fe6e1470c972ddd94b2ed02f48003", "index": 3390, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef f(q):\n for i in range(0, 100):\n print('come on baby')\n q.put([42, None, 'hello'])\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef f(q):\n for i in rang...
[ 0, 1, 2, 3, 4 ]
import json import jieba import util from pypinyin import pinyin, Style class Song: def __init__(self, songName, artistName, lyric): self.songName = songName self.artistName = artistName self.lyric = lyric self.phrasePinyinDict = util.lyricToPinYi(self.lyric) def getSongName(se...
normal
{ "blob_id": "fa3cec0781b9ca5c1d99a7500748104d7cdce631", "index": 130, "step-1": "<mask token>\n\n\nclass Song:\n\n def __init__(self, songName, artistName, lyric):\n self.songName = songName\n self.artistName = artistName\n self.lyric = lyric\n self.phrasePinyinDict = util.lyricToP...
[ 6, 7, 8, 9, 10 ]
import uuid from cqlengine import columns from cqlengine.models import Model from datetime import datetime as dt class MBase(Model): __abstract__ = True #__keyspace__ = model_keyspace class Post(MBase): id = columns.BigInt(index=True, primary_key=True) user_id = columns.Integer(required=True, index=...
normal
{ "blob_id": "9cb734f67d5149b052ff1d412d446aea1654fa69", "index": 9543, "step-1": "<mask token>\n\n\nclass User(MBase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass UserTimeLine(MBase):\n \"\"\"\n POSTs that user will see in their timeline\n \"\"\"\...
[ 30, 32, 35, 37, 41 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for line in f1: f2.write(line.replace('_', '\n')) f1.close() f2.close() <|reserved_special_token_0|> open('ANSWER.txt', 'w').writelines(lines[:+1]) <|reserved_special_token_1|> <|reserved_special_token_0|> f1 = open('Comple...
flexible
{ "blob_id": "d02ef5fc27cde353e90dda4090905b89b5be5c49", "index": 2897, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor line in f1:\n f2.write(line.replace('_', '\\n'))\nf1.close()\nf2.close()\n<mask token>\nopen('ANSWER.txt', 'w').writelines(lines[:+1])\n", "step-3": "<mask token>\nf1 = open('Com...
[ 0, 1, 2, 3, 4 ]
from collections import defaultdict def solution(clothes): answer = 1 hash_map = defaultdict(lambda : 0) for value, key in clothes: hash_map[key] += 1 for v in hash_map.values(): answer *= v + 1 return answer - 1
normal
{ "blob_id": "601089c2555e6fc75803087ee1d8af7f8180f651", "index": 4199, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solution(clothes):\n answer = 1\n hash_map = defaultdict(lambda : 0)\n for value, key in clothes:\n hash_map[key] += 1\n for v in hash_map.values():\n an...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class AudioEffectsChain: def __init__(self): self.command = [] def equalizer(self, frequency, q=1.0, db=-3.0): """equalizer takes three parameters: filter center frequency in Hz, "q" or band-width (default=1.0), and a signed number for gain or att...
flexible
{ "blob_id": "f98f2ef0d94839711b473ad1ca32b85645d4014e", "index": 8764, "step-1": "<mask token>\n\n\nclass AudioEffectsChain:\n\n def __init__(self):\n self.command = []\n\n def equalizer(self, frequency, q=1.0, db=-3.0):\n \"\"\"equalizer takes three parameters: filter center frequency in Hz,...
[ 22, 27, 29, 31, 42 ]
# Problem No.: 77 # Solver: Jinmin Goh # Date: 20191230 # URL: https://leetcode.com/problems/combinations/ import sys class Solution: def combine(self, n: int, k: int) -> List[List[int]]: if k == 0: return [[]] ans = [] for i in range(k, n + 1) : for tem...
normal
{ "blob_id": "e4a2c605ef063eee46880515dfff05562916ab81", "index": 9976, "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 combine(self, n: int, k: int) ->List[List[int]]:\n if k == 0:\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class SourcePanel(AbstractPanel): def __init__(self): super(SourcePanel, self).__init__() def packagePath(self): """ This file holds the link to the active panels. The structure is a dictionary, the key is the class name and the values is ...
flexible
{ "blob_id": "aa0a69e3286934fcfdf31bd713eca1e8dd90aeaa", "index": 6914, "step-1": "<mask token>\n\n\nclass SourcePanel(AbstractPanel):\n\n def __init__(self):\n super(SourcePanel, self).__init__()\n\n def packagePath(self):\n \"\"\"\n This file holds the link to the active panels.\n ...
[ 4, 5, 6, 7, 8 ]
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
normal
{ "blob_id": "2ab303a2f36cdd64e2119856312dd5e38ee728d6", "index": 9632, "step-1": "<mask token>\n\n\nclass LoadBalancerTest(common.HeatTestCase):\n\n def setUp(self):\n super(LoadBalancerTest, self).setUp()\n self.lb_template = {'AWSTemplateFormatVersion': '2010-09-09',\n 'Description'...
[ 62, 89, 97, 102, 126 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Test(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Test(unittest.TestCase): def test(self): pass <|reserved_special_token_1|> impo...
flexible
{ "blob_id": "cb08b95e3b9c80fb74d4415b3798ddbb36cd76e7", "index": 419, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Test(unittest.TestCase):\n\n def test(self):\n pass\n", "step-4": "import unittest...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class IOHandler: <|reserved_special_token_0|> def dump_data(self): """save the data contained in data_instance, checking whether the directories already exist and asking whether to create them if not. """ while not path.isdir(self.directory): p...
flexible
{ "blob_id": "267276eab470b5216a2102f3e7616f7aecadcfe9", "index": 9428, "step-1": "<mask token>\n\n\nclass IOHandler:\n <mask token>\n\n def dump_data(self):\n \"\"\"save the data contained in data_instance, checking whether the\n directories already exist and asking whether to create them if ...
[ 3, 4, 5, 6, 7 ]
#Voir paragraphe "3.6 Normalizing Text", page 107 de NLP with Python from nltk.stem.snowball import SnowballStemmer from nltk.stem.wordnet import WordNetLemmatizer # Il faut retirer les stopwords avant de stemmer stemmer = SnowballStemmer("english", ignore_stopwords=True) lemmatizer = WordNetLemmatizer() source = ...
normal
{ "blob_id": "1f1677687ba6ca47b18728b0fd3b9926436e9796", "index": 2949, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(stems1)\nprint(stems2)\nprint(stems3)\n", "step-3": "<mask token>\nstemmer = SnowballStemmer('english', ignore_stopwords=True)\nlemmatizer = WordNetLemmatizer()\nsource = ['having...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with ____.____(____): doc = ____ print(____) <|reserved_special_token_1|> <|reserved_special_token_0|> nlp = spacy.load('en_core_web_sm') text = ( 'Chick-fil-A is an American fast food restaurant chain headquartered...
flexible
{ "blob_id": "6eecf0ff1ad762089db6e9498e906e68b507370c", "index": 1875, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith ____.____(____):\n doc = ____\n print(____)\n", "step-3": "<mask token>\nnlp = spacy.load('en_core_web_sm')\ntext = (\n 'Chick-fil-A is an American fast food restaurant ch...
[ 0, 1, 2, 3, 4 ]
#Small enough? - Beginner # You will be given an array and a limit value. # You must check that all values in the array are # below or equal to the limit value. If they are, # return true. Else, return false. def small_enough(array, limit): counter = "" for arr in array: if arr <= limit: ...
normal
{ "blob_id": "117b340b13b9b1c53d3df1646cd5924f0118ab5d", "index": 5512, "step-1": "<mask token>\n", "step-2": "def small_enough(array, limit):\n counter = ''\n for arr in array:\n if arr <= limit:\n counter += 'True,'\n else:\n counter += 'False,'\n if 'False' in cou...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ciscoL2natMIB.setRevisions(('2013-04-16 00:00',)) if mibBuilder.loadTexts: ciscoL2natMIB.setLastUpdated('201304160000Z') if mibBuilder.loadTexts: ciscoL2natMIB.setOrganization('Cisco Systems, Inc.') <|reserved_special_toke...
flexible
{ "blob_id": "2fb95fa2b7062085f31c6b1dbb8c1336c3871e93", "index": 3271, "step-1": "<mask token>\n", "step-2": "<mask token>\nciscoL2natMIB.setRevisions(('2013-04-16 00:00',))\nif mibBuilder.loadTexts:\n ciscoL2natMIB.setLastUpdated('201304160000Z')\nif mibBuilder.loadTexts:\n ciscoL2natMIB.setOrganization...
[ 0, 1, 2, 3 ]
#!usr/bin/env python # -*- coding:utf-8 _* """ @File : build_model_2.py @Author : ljt @Description: xx @Time : 2021/6/12 21:46 """ import numpy as np import SimpleITK as sitk import skimage.restoration.deconvolution from numpy.fft import fftn, ifftn new_img = sitk.ReadImage("../../data/ground_data/new_img.nii") s...
normal
{ "blob_id": "f84ab1530cbc6bd25c45fc607d8f1cd461b180bf", "index": 2089, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor h in range(11, 41):\n for i in range(model_img_array.shape[0]):\n for j in range(model_img_array.shape[2]):\n dis = np.sqrt(pow(13 - i, 2) + pow(9 - j, 2))\n ...
[ 0, 1, 2, 3, 4 ]
data=[1,4,2,3,6,8,9,7] def partition(data,l,h): i=l j=h pivot=data[l] while(i<j): while(data[i]<=pivot and i<=h-1): i=i+1 while(data[j]>pivot and j>=l+1): j=j-1 if(i<j): data[i],dat...
normal
{ "blob_id": "1cd82883e9a73cfbe067d58c30659b9b2e5bf473", "index": 9349, "step-1": "<mask token>\n\n\ndef partition(data, l, h):\n i = l\n j = h\n pivot = data[l]\n while i < j:\n while data[i] <= pivot and i <= h - 1:\n i = i + 1\n while data[j] > pivot and j >= l + 1:\n ...
[ 1, 2, 3, 4, 5 ]
# 14. Sort dataframe (birds) first by the values in the 'age' in decending order, then by the value in the 'visits' column in ascending order. import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/") mydb = myclient["divya_db"] mycol = mydb["vani_data"] # age column in decending order myquery = my...
normal
{ "blob_id": "d91bacfd4b45832a79189c0f1ec4f4cb3ef14851", "index": 2210, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(list(myquery))\n<mask token>\nprint(list(myquery))\n", "step-3": "<mask token>\nmyclient = pymongo.MongoClient('mongodb://localhost:27017/')\nmydb = myclient['divya_db']\nmycol = ...
[ 0, 1, 2, 3, 4 ]
import matplotlib.pyplot as plt import numpy as np import random plt.ion() def draw_board(grid_size, hole_pos,wall_pos): board = np.ones((grid_size,grid_size)) board[wall_pos] = 10 board[hole_pos] = 0 return board class Game(): """ A class which implements the Gobble game. Initializes with a ...
normal
{ "blob_id": "a74f2050a057f579a8a8b77ac04ef09073cdb6cf", "index": 6057, "step-1": "<mask token>\n\n\nclass Game:\n <mask token>\n\n def __init__(self, grid_size):\n self.grid_size = grid_size\n self.start_game(grid_size)\n plt.title(\"Nate's Lame Game\")\n\n def start_game(self, grid...
[ 8, 9, 10, 12, 13 ]
import collections def range(state): ran = state["tmp"]["analysis"]["range"] rang = { key : [ state["rank"][i] for i in val & ran ] for key, val in state["tmp"]["analysis"]["keys"].items() if val & ran } for item in state["tmp"]["items"]: item.setdefault("rank", 0) item_keys = set(item.keys()) rang_...
normal
{ "blob_id": "51868f26599c5878f8eb976d928c30d0bf61547d", "index": 9701, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef range(state):\n ran = state['tmp']['analysis']['range']\n rang = {key: [state['rank'][i] for i in val & ran] for key, val in\n state['tmp']['analysis']['keys'].items(...
[ 0, 1, 2, 3, 4 ]
from mlagents_envs.registry import default_registry from mlagents_envs.envs.pettingzoo_env_factory import logger, PettingZooEnvFactory # Register each environment in default_registry as a PettingZooEnv for key in default_registry: env_name = key if key[0].isdigit(): env_name = key.replace("3", "Three")...
normal
{ "blob_id": "3bec28561c306a46c43dafc8bdc2e01f2ea06180", "index": 9491, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor key in default_registry:\n env_name = key\n if key[0].isdigit():\n env_name = key.replace('3', 'Three')\n if not env_name.isidentifier():\n logger.warning(\n ...
[ 0, 1, 2, 3 ]
class TestContext: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class TestContext: <|reserved_special_token_0|> def test_should_get_variable_from_local_state(self, fake_context): expected = 'test' fake_context...
flexible
{ "blob_id": "e83a9a4675e5beed938860037658d33c4d347b29", "index": 8528, "step-1": "class TestContext:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class TestContext:\n <mask token>\n\n def test_should_get_variable_from_local_state(self, fake_context):\n expected = 'test'\n ...
[ 1, 2, 3, 4, 5 ]
import os pil = 'y' while(pil=='y'): os.system("cls") print("===============================") print("== KALKULATOR SEDERHANA ==") print("===============================") print("MENU-UTAMA : ") print("1 Penjumlahan") print("2 Pengurangan") print("3 Perkalian") print("4 Pembagia...
normal
{ "blob_id": "9e7dee9c0fd4cd290f4710649ffc4a94fedf0358", "index": 356, "step-1": "import os\npil = 'y'\nwhile(pil=='y'):\n os.system(\"cls\")\n print(\"===============================\")\n print(\"== KALKULATOR SEDERHANA ==\")\n print(\"===============================\")\n print(\"MENU-UTAMA :...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with tf.Session() as sess: output_1, output_2 = sess.run([output_1, output_2]) print(output_1, output_2) <|reserved_special_token_1|> <|reserved_special_token_0|> os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' <|reserved_special_...
flexible
{ "blob_id": "da2e388c64bbf65bcef7d09d7596c2869f51524a", "index": 4025, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as sess:\n output_1, output_2 = sess.run([output_1, output_2])\nprint(output_1, output_2)\n", "step-3": "<mask token>\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n<ma...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class DockerUtils: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DockerUtils: <|reserved_special_token_0|> @staticmethod def remove_current_docker_container(user_id, is_retry=False): ...
flexible
{ "blob_id": "e2e2e746d0a8f6b01e6f54e930c7def2d48c2d62", "index": 4653, "step-1": "<mask token>\n\n\nclass DockerUtils:\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DockerUtils:\n <mask token>\n\n @staticmethod\n def remove_current_docker_container(user_id, is_retry=False)...
[ 1, 2, 3, 4, 5 ]
# Generated by Django 3.0.5 on 2020-04-23 11:23 from django.conf import settings from django.db import migrations class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('review', '0002_auto_20200419_1409'), ] operations = [ ...
normal
{ "blob_id": "8471e6a3b6623236740ad5219e5038a64e0c0056", "index": 2083, "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 ]
# pylint: disable=wrong-import-position,wrong-import-order from gevent import monkey monkey.patch_all() from gevent.pywsgi import WSGIServer from waitlist.app import app http_server = WSGIServer(("0.0.0.0", 5000), app) http_server.serve_forever()
normal
{ "blob_id": "c36625dfbd733767b09fcb5505d029ae2b16aa44", "index": 7077, "step-1": "<mask token>\n", "step-2": "<mask token>\nmonkey.patch_all()\n<mask token>\nhttp_server.serve_forever()\n", "step-3": "<mask token>\nmonkey.patch_all()\n<mask token>\nhttp_server = WSGIServer(('0.0.0.0', 5000), app)\nhttp_serve...
[ 0, 1, 2, 3, 4 ]
from django import forms from django.forms import ModelForm from django.contrib.auth.models import User from .models import Attendance, Holidays #I think the update forms are not required here. They might be required in the profiles app. For this app, update attendance option can be available to the staff and faculty...
normal
{ "blob_id": "d48f02d8d5469b966f109e8652f25352bc9b3b80", "index": 7252, "step-1": "<mask token>\n\n\nclass AttendanceUpdateForm(ModelForm):\n\n\n class Meta:\n model = Attendance\n fields = 'enrollment_id', 'date', 'present', 'absent', 'outpass'\n", "step-2": "<mask token>\n\n\nclass HolidaysUp...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def post_detail(request, pk): post = get_object_or_404(Post, pk=pk) return render(request, 'blog/post_detail.html', {'post': post}) <|reserved_special_token_1|> <|reserved_special_token_0|> def list_of_posts(request...
flexible
{ "blob_id": "71a0900dc09b1ff55e4e5a4cc7cab617b9c73406", "index": 4519, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef post_detail(request, pk):\n post = get_object_or_404(Post, pk=pk)\n return render(request, 'blog/post_detail.html', {'post': post})\n", "step-3": "<mask token>\n\n\ndef li...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class Cube: <|reserved_special_token_0|> def sortPieces(self): self.pieces.sort(key=lambda x: x.location[2] * cubeSize * cubeSize + x.location[1] * cubeSize + x.location[0]) <|reserved_special_token_0|> def countUnmatched(self): colorList = [R...
flexible
{ "blob_id": "1d8e48aab59869831defcccdd8902230b0f3daa7", "index": 5368, "step-1": "<mask token>\n\n\nclass Cube:\n <mask token>\n\n def sortPieces(self):\n self.pieces.sort(key=lambda x: x.location[2] * cubeSize * cubeSize +\n x.location[1] * cubeSize + x.location[0])\n <mask token>\n\n...
[ 19, 23, 24, 26, 29 ]
data = [] ##用來裝reviews.txt的留言 count = 0 ##計數目前檔案讀取到第幾筆 with open('reviews.txt', 'r') as f: for line in f: data.append(line) count += 1 if count % 1000 == 0: print(len(data)) total = len(data) print('檔案讀取完了,總共有', len(data), '筆資料') print(len(data)) #印出data串列的--項目數量 print(le...
normal
{ "blob_id": "835beebe452a252fb744a06d3e6ff221469af6bf", "index": 6699, "step-1": "data = [] ##用來裝reviews.txt的留言\ncount = 0 ##計數目前檔案讀取到第幾筆\n\nwith open('reviews.txt', 'r') as f:\n for line in f:\n data.append(line)\n count += 1\n if count % 1000 == 0:\n print(len(data))\ntotal...
[ 0 ]
import boto3 class NetworkLookup: def __init__(self): self.loaded = 0 self.subnets = {} self.vpcs = {} def load(self): if self.loaded: return client = boto3.client('ec2') # load subnets subnets_r = client.describe_subnets() subnets_...
normal
{ "blob_id": "767c0e6d956701fcedddb153b6c47f404dec535a", "index": 65, "step-1": "<mask token>\n\n\nclass NetworkLookup:\n\n def __init__(self):\n self.loaded = 0\n self.subnets = {}\n self.vpcs = {}\n\n def load(self):\n if self.loaded:\n return\n client = boto3...
[ 6, 7, 9, 10, 11 ]
""" 采集端任务状态统计 直接在数据库查找数据 create by judy 2018/10/22 update by judy 2019/03/05 更改统一输出为output """ from datetime import datetime import time import traceback import pytz from datacontract import ETaskStatus from datacontract.clientstatus.statustask import StatusTask from idownclient.clientdbmanager import DbManager from...
normal
{ "blob_id": "de0d0588106ab651a8d6141a44cd9e286b0ad3a5", "index": 1299, "step-1": "<mask token>\n\n\nclass ClientTaskStatus(object):\n <mask token>\n <mask token>\n\n def start(self):\n while True:\n try:\n self.get_task_status_info()\n lines = StatusTask(s...
[ 2, 3, 4, 5, 6 ]
# Generated by Django 3.0 on 2019-12-15 16:20 import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('blog', '0013_auto_20191215_1619'), ] operations = [ migrations.AlterField( m...
normal
{ "blob_id": "38a79f5b3ce1beb3dc1758880d42ceabc800ece7", "index": 8818, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('blog', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ExtractSubscriptionPDFView(AccountMixin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Extract...
flexible
{ "blob_id": "431f109903e014a29aed7f125d47f327e17b9f65", "index": 4366, "step-1": "<mask token>\n\n\nclass ExtractSubscriptionPDFView(AccountMixin):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ExtractSubscriptionPDFView(Account...
[ 1, 4, 6, 7, 8 ]
"""Unit tests for the `esmvalcore.preprocessor._rolling_window` function.""" import unittest import iris.coords import iris.exceptions import numpy as np from cf_units import Unit from iris.cube import Cube from numpy.testing import assert_equal from esmvalcore.preprocessor._rolling_window import rolling_window_stati...
normal
{ "blob_id": "9539d2a4da87af1ff90b83bbcf72dfc8ab7b6db0", "index": 5501, "step-1": "<mask token>\n\n\nclass TestRollingWindow(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Te...
[ 1, 7, 8, 9, 11 ]
class Solution: # @param num, a list of integer # @return an integer def rob(self, num): n = len(num) if n == 0: return 0 if(n == 1): return num[0] f = [0] * n f[0] = num[0] f[1] = max(num[0],num[1]) for i in xrange(2,n): ...
normal
{ "blob_id": "bca0baaffefed6917939614defadf9960ffa4727", "index": 8062, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def rob(self, num):\n n = len(num)\n if n == 0:\n return 0\n if n == 1:\n return num...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Task: <|reserved_special_token_0|> <|reserved_special_token_0|> def set_subtasks(self, subtasks): self.subtasks = subtasks <|reserved_special_token_1|> class Task: def __init__(self): self.title = '' self.sub...
flexible
{ "blob_id": "3cf2ffbc8163c2a447016c93ff4dd13e410fff2b", "index": 7353, "step-1": "<mask token>\n", "step-2": "class Task:\n <mask token>\n <mask token>\n\n def set_subtasks(self, subtasks):\n self.subtasks = subtasks\n", "step-3": "class Task:\n\n def __init__(self):\n self.title = ...
[ 0, 2, 3, 4, 5 ]
import os import json import requests from fin import myBuilder, myParser import time def open_config(): if os.path.isfile('fin/config.json') != True: return ('no config found') else: print('config found') with open('fin/config.json') as conf: conf = json.load(conf) return conf conf = open_config() logf...
normal
{ "blob_id": "e690587c9b056f8d5a1be6dd062a2aa32e215f50", "index": 2328, "step-1": "<mask token>\n\n\ndef open_config():\n if os.path.isfile('fin/config.json') != True:\n return 'no config found'\n else:\n print('config found')\n with open('fin/config.json') as conf:\n conf = json.loa...
[ 3, 6, 7, 9, 11 ]
from hicity.graphics.graphics import HiCityGUI def GUI(): app = HiCityGUI() app.mainloop() if __name__ == '__main__': GUI()
normal
{ "blob_id": "dd96b7f73c07bf0c74e6ce4dbff1a9cc09729b72", "index": 7918, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef GUI():\n app = HiCityGUI()\n app.mainloop()\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef GUI():\n app = HiCityGUI()\n app.mainloop()\n\n\nif __name__ == '_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_begin_data(url): headers = {'ser-Agent': '', 'Cookie': ''} request = urllib2.Request(url, headers=headers) web_data = urllib2.urlopen(request) soup = BeautifulSoup(web_data, 'html.parser') results = soup.select('table > tr > td > a') answers = soup.select('...
flexible
{ "blob_id": "790110a8cba960eb19593e816b579080dfc46a4e", "index": 4572, "step-1": "<mask token>\n\n\ndef get_begin_data(url):\n headers = {'ser-Agent': '', 'Cookie': ''}\n request = urllib2.Request(url, headers=headers)\n web_data = urllib2.urlopen(request)\n soup = BeautifulSoup(web_data, 'html.parse...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class mainwin: def __init__(self, master): self.master = master master.title master.title('University of Utah XRD Analysis Multi-tool') self.tab_parent = ttk.Notebook(master) self.tab1 = ttk.Frame(self.tab_parent) self.tab2 = ttk.Frame(...
flexible
{ "blob_id": "137ed9c36265781dbebabbd1ee0ea84c9850201a", "index": 1642, "step-1": "<mask token>\n\n\nclass mainwin:\n\n def __init__(self, master):\n self.master = master\n master.title\n master.title('University of Utah XRD Analysis Multi-tool')\n self.tab_parent = ttk.Notebook(mas...
[ 2, 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 = [(...
flexible
{ "blob_id": "3a5d55ea5a2f4f6cf7aaf55055593db9f8bb3562", "index": 6308, "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 = [('descriptor'...
[ 0, 1, 2, 3, 4 ]
import imgui print("begin") imgui.create_context() imgui.get_io().display_size = 100, 100 imgui.get_io().fonts.get_tex_data_as_rgba32() imgui.new_frame() imgui.begin("Window", True) imgui.text("HelloWorld") imgui.end() imgui.render() imgui.end_frame() print("end")
normal
{ "blob_id": "146cae8f60b908f04bc09b10c4e30693daec89b4", "index": 6560, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('begin')\nimgui.create_context()\n<mask token>\nimgui.get_io().fonts.get_tex_data_as_rgba32()\nimgui.new_frame()\nimgui.begin('Window', True)\nimgui.text('HelloWorld')\nimgui.end()\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def log_dir_name(learning_rate, dense_layers, nodes, activation): """ Creates a directory named after the set of hyperparameters that was recently selected. A helper function to log the results of training every constructed model. """ s = './2_logs/lr_{0:.0e}_layers{1}_nodes{2}...
flexible
{ "blob_id": "db9068e54607e9df48328435ef07f15b4c25a6db", "index": 7412, "step-1": "<mask token>\n\n\ndef log_dir_name(learning_rate, dense_layers, nodes, activation):\n \"\"\"\n\tCreates a directory named after the set of hyperparameters that was recently selected. A helper function\n\tto log the results of tr...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class SpectrumMap: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class SpectrumMap2: def __init__(self): devices = sd.query_devices() device = 11 ...
flexible
{ "blob_id": "fbde00d727d7ea99d1a7704f46cb9850c8b210d7", "index": 2610, "step-1": "<mask token>\n\n\nclass SpectrumMap:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass SpectrumMap2:\n\n def __init__(self):\n devices = sd.query_devices()\n devic...
[ 12, 14, 16, 18, 19 ]
from distutils.core import setup setup(name='dcnn_visualizer', version='', packages=['dcnn_visualizer', 'dcnn_visualizer.backward_functions'], url='', license='', author= 'Aiga SUZUKI', author_email='tochikuji@gmail.com', description='', requires=['numpy', 'chainer', 'chainercv'])
normal
{ "blob_id": "b9a75f4e106efade3a1ebdcfe66413107d7eccd0", "index": 7884, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='dcnn_visualizer', version='', packages=['dcnn_visualizer',\n 'dcnn_visualizer.backward_functions'], url='', license='', author=\n 'Aiga SUZUKI', author_email='tochikuji@...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(n - 1): if a[i + 1] - a[i] < m: ans += a[i + 1] - a[i] else: ans += m print(ans) <|reserved_special_token_1|> n, m = map(int, input().split()) a = [int(input()) for _ in range(n)] cnt, ans...
flexible
{ "blob_id": "a09bc84a14718422894127a519d67dc0c6b13bc9", "index": 746, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n - 1):\n if a[i + 1] - a[i] < m:\n ans += a[i + 1] - a[i]\n else:\n ans += m\nprint(ans)\n", "step-3": "n, m = map(int, input().split())\na = [int(inp...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: channel # Author: Maria Camila Herrera Ramos # Generated: Thu Aug 2 18:09:17 2018 ################################################## from gnuradio import analog from gnuradio import blocks from gnuradio ...
normal
{ "blob_id": "8adf25fbffc14d6927d665931e54a7d699a3b439", "index": 6202, "step-1": "<mask token>\n\n\nclass channel(gr.hier_block2):\n <mask token>\n <mask token>\n\n def set_k(self, k):\n self.k = k\n self.channels_fading_model_0.set_K(self.k)\n\n def get_tchannel(self):\n return ...
[ 5, 6, 7, 8, 10 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.8 on 2018-04-12 12:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cstasker', '0001_initial'), ] operations = [ migrations.AlterField( ...
normal
{ "blob_id": "2fbf312e1f8388008bb9ab9ba0ee4ccee1a8beae", "index": 3594, "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 = [('cstasker', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class IndexView(edit.FormView): success_url = '/facilities' form_class = LoginForm template_name = 'users/index.html' def form_valid(self, form): username = form.cleaned_data['username'] password = form.cleaned_data['password'] user = authenticate(...
flexible
{ "blob_id": "6bd9c8e38373e696193c146b88ebf6601170cf0e", "index": 9549, "step-1": "<mask token>\n\n\nclass IndexView(edit.FormView):\n success_url = '/facilities'\n form_class = LoginForm\n template_name = 'users/index.html'\n\n def form_valid(self, form):\n username = form.cleaned_data['userna...
[ 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- """ Created on Thu Jun 25 15:14:15 2020 @author: luisa """ horast = int(input("Horas Trabajadas: "+"\n\t\t")) tarifa = int(input("Tarifa por hora: "+"\n\t\t")) descu = int(input("Descuentos: "+"\n\t\t")) resp0 = horast - descu resp1 = (resp0 * tarifa)/2 resp2 = (horast * tarifa) ...
normal
{ "blob_id": "4d9575c178b672815bb561116689b9b0721cb5ba", "index": 919, "step-1": "<mask token>\n", "step-2": "<mask token>\nif horast >= 41:\n print('Valor a Pagar: ', resp3)\nelif horast <= 40:\n print('Valor a Pagar: ', resp4)\n", "step-3": "<mask token>\nhorast = int(input('Horas Trabajadas: ' + '\\n...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "a58949d25a719dc9ce0626948ab0397814e9ea0e", "index": 1574, "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 = [('analysis', ...
[ 0, 1, 2, 3, 4 ]
import argparse from time import sleep from threading import Thread from threading import Lock from multiprocessing.connection import Listener from multiprocessing.connection import Client ADDRESS = '127.0.0.1' PORT = 5000 # Threaded function snippet def threaded(fn): def wrapper(*args, **kwargs): thread ...
normal
{ "blob_id": "c5a2c00d53111d62df413907d4ff4ca5a02d4035", "index": 7005, "step-1": "<mask token>\n\n\nclass Process:\n <mask token>\n <mask token>\n <mask token>\n\n def send_neighbours(self, data, exceptions=[]):\n for i in [x for x in self.neighbours if x not in exceptions]:\n self....
[ 2, 8, 9, 11, 12 ]
if __name__== '__main__': with open('./input/day6', 'r') as f: orbit_input = [l.strip().split(")") for l in f.readlines()] planets = [planet[0] for planet in orbit_input] planets1 = [planet[1] for planet in orbit_input] planets = set(planets+planets1) system = {} print(orbit_input) ...
normal
{ "blob_id": "96778a238d8ed8ae764d0cf8ec184618dc7cfe18", "index": 5790, "step-1": "<mask token>\n", "step-2": "if __name__ == '__main__':\n with open('./input/day6', 'r') as f:\n orbit_input = [l.strip().split(')') for l in f.readlines()]\n planets = [planet[0] for planet in orbit_input]\n plane...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with veil_component.init_component(__name__): from .material import list_category_materials from .material import list_material_categories from .material import list_issue_materials from .material import list_issue...
flexible
{ "blob_id": "acad268a228b544d60966a8767734cbf9c1237ac", "index": 9979, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith veil_component.init_component(__name__):\n from .material import list_category_materials\n from .material import list_material_categories\n from .material import list_issue_...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def expandgrid(*itrs): product = list(itertools.product(*itrs)) return {'Var{}'.format(i + 1): [x[i] for x in product] for i in range( len(itrs))} <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> heart.columns <|reserved_special_t...
flexible
{ "blob_id": "0d862715524bd35347626e7708c7c8f8b370bb3a", "index": 7769, "step-1": "<mask token>\n\n\ndef expandgrid(*itrs):\n product = list(itertools.product(*itrs))\n return {'Var{}'.format(i + 1): [x[i] for x in product] for i in range(\n len(itrs))}\n\n\n<mask token>\n", "step-2": "<mask token>...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ConvolutionalNetwork(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 6, 3, 1) self.conv2 = nn.Conv2d(6, 16, 3, 1) self.fc1 = nn.Linear(54 * 54 * 16, 120) self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Lin...
flexible
{ "blob_id": "7821b07a49db9f3f46bedc30f2271160e281806f", "index": 4814, "step-1": "<mask token>\n\n\nclass ConvolutionalNetwork(nn.Module):\n\n def __init__(self):\n super().__init__()\n self.conv1 = nn.Conv2d(3, 6, 3, 1)\n self.conv2 = nn.Conv2d(6, 16, 3, 1)\n self.fc1 = nn.Linear(...
[ 3, 4, 5, 6, 7 ]
class HashTable: <|reserved_special_token_0|> def put(self, key, data): hashvalue = self.hashfunction(key, len(self.slots)) if self.slots[hashvalue] == None: self.slots[hashvalue] = key self.data[hashvalue] = data elif self.slots[hashvalue] == key: se...
flexible
{ "blob_id": "75741d11bebcd74b790efe7e5633d4507e65a25f", "index": 6034, "step-1": "class HashTable:\n <mask token>\n\n def put(self, key, data):\n hashvalue = self.hashfunction(key, len(self.slots))\n if self.slots[hashvalue] == None:\n self.slots[hashvalue] = key\n self....
[ 5, 6, 7, 8, 9 ]
<|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": "45969b346d6d5cbdef2f5d2f74270cf12024072d", "index": 3, "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 = [('search', '0003...
[ 0, 1, 2, 3, 4 ]