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|> data.replace(to_replace='?', value=np.nan, inplace=True) data.dropna(inplace=True) <|reserved_special_token_0|> kms.fit(data_train) print(kms.predict(data_test)) plt.figure() <|reserved_special_token_1|> <|reserved_special_toke...
flexible
{ "blob_id": "ff331dc0c72378222db9195cce7c794f93799401", "index": 5833, "step-1": "<mask token>\n", "step-2": "<mask token>\ndata.replace(to_replace='?', value=np.nan, inplace=True)\ndata.dropna(inplace=True)\n<mask token>\nkms.fit(data_train)\nprint(kms.predict(data_test))\nplt.figure()\n", "step-3": "<mask ...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.2.5 on 2021-08-28 12:34 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('userProfile', '0022_auto_20210823_1858'), ] operations = [ migrations.RemoveField( model_name='...
normal
{ "blob_id": "96bb865b66e5d9ba62bab210705338f1799cc490", "index": 7022, "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 = [('userProfile...
[ 0, 1, 2, 3, 4 ]
subworkflow data: workdir: "../../data/SlideSeq/Puck_180819_10" include: "../Snakefile"
normal
{ "blob_id": "9847a9cd360649819f51abfe584fb51a81306f68", "index": 4224, "step-1": "subworkflow data:\n workdir:\n \"../../data/SlideSeq/Puck_180819_10\"\n\ninclude: \"../Snakefile\"\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
#Проверяем, является ли введенная пользователем строка полиндромом list_1 = input('Enter something: ') list_1_rev = list_1[::-1] if list_1 == list_1_rev: print('You entered a polindrom!') else: print('Your string is not a polindrom')
normal
{ "blob_id": "45b56103db0a72ebbc7de340c4293e1f70552414", "index": 5254, "step-1": "<mask token>\n", "step-2": "<mask token>\nif list_1 == list_1_rev:\n print('You entered a polindrom!')\nelse:\n print('Your string is not a polindrom')\n", "step-3": "list_1 = input('Enter something: ')\nlist_1_rev = list...
[ 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": "dbea2b1555368460b7d14369d2dfe4f0a01f9e4f", "index": 8423, "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 = [('enrolments'...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class IDrawable(abc.ABC): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class IFocusable(abc.ABC): @property @abc.abstractmethod def focus_dispatcher(self) ->CanvasDispatcher: pass...
flexible
{ "blob_id": "e37f958191c9481c6664e90c17f43419a0b5b606", "index": 8131, "step-1": "<mask token>\n\n\nclass IDrawable(abc.ABC):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass IFocusable(abc.ABC):\n\n @property\n @abc.abstractmethod\n def focus_dispatcher(self) ->CanvasD...
[ 14, 15, 17, 18, 21 ]
<|reserved_special_token_0|> class CSVRecordImporter(CSVImporter): model_class = CSVRecord fields = 'id', 'name', 'number' csv_path = os.path.join(settings.PROJECT_DIR, 'data', 'all_fields_filled.csv') def clean_number(self, value): return 888 <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "559bd0c1821f405d21cdacba55f129ee5220bb5d", "index": 3751, "step-1": "<mask token>\n\n\nclass CSVRecordImporter(CSVImporter):\n model_class = CSVRecord\n fields = 'id', 'name', 'number'\n csv_path = os.path.join(settings.PROJECT_DIR, 'data',\n 'all_fields_filled.csv')\n\n def clean...
[ 3, 4, 6, 7, 8 ]
""" Create a function that takes two number strings and returns their sum as a string. Examples add("111", "111") ➞ "222" add("10", "80") ➞ "90" add("", "20") ➞ "Invalid Operation" Notes If any input is "" or None, return "Invalid Operation". """ def add(n1, n2): if n1 == "" or n2 == "": return "Invali...
normal
{ "blob_id": "7bcbcbe51217b2ea9044a7e4a4bebf315069c92d", "index": 2953, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef add(n1, n2):\n if n1 == '' or n2 == '':\n return 'Invalid Operation'\n elif n1 == None or n2 == None:\n return 'Invalid Operation'\n return str(int(n1) + in...
[ 0, 1, 2, 3 ]
import itertools import urllib import word2vec # MSD: http://corpus.leeds.ac.uk/mocky/ru-table.tab # Universal: http://universaldependencies.org/ru/pos/index.html def convert_pos_MSD_to_Universal(pos): if pos.startswith('A'): return 'ADJ' elif pos.startswith('C'): return 'CCONJ' elif pos....
normal
{ "blob_id": "b2a2e06c5db8b12acbc852bafc4ea869b006c1c8", "index": 9722, "step-1": "<mask token>\n\n\ndef convert_pos_MSD_to_Universal(pos):\n if pos.startswith('A'):\n return 'ADJ'\n elif pos.startswith('C'):\n return 'CCONJ'\n elif pos.startswith('I'):\n return 'INTJ'\n elif pos....
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def main(): s1 = 'mabaabm' s2 = 'moktko!' s3 = ex7(s1, s2) print(s3) <|reserved_special_token_0|> <|reserved_special_token_1|> def main(): s1 = 'mabaabm' s2 = 'moktko!' s3 = ex7(s1, s2) print(s3) def ex7(in1, in2): o...
flexible
{ "blob_id": "f45cae397aa3b7bdba6e3f36e20b926487cb160d", "index": 9238, "step-1": "<mask token>\n", "step-2": "def main():\n s1 = 'mabaabm'\n s2 = 'moktko!'\n s3 = ex7(s1, s2)\n print(s3)\n\n\n<mask token>\n", "step-3": "def main():\n s1 = 'mabaabm'\n s2 = 'moktko!'\n s3 = ex7(s1, s2)\n ...
[ 0, 1, 2, 3 ]
import numpy as np from math import sqrt import warnings from collections import Counter import pandas as pd import random def k_NN(data, predict, k=3): if len(data) >= k: warnings.warn("K is set to a value less than total voting groups !") distances = [] [[ distances.append([np.linalg.norm(np.array(features) - ...
normal
{ "blob_id": "c6ce6ffe46be993bfe74ccb240e1ebf586c9f556", "index": 7656, "step-1": "<mask token>\n\n\ndef k_NN(data, predict, k=3):\n if len(data) >= k:\n warnings.warn('K is set to a value less than total voting groups !')\n distances = []\n [[distances.append([np.linalg.norm(np.array(features) - ...
[ 1, 2, 3, 4, 5 ]
#딕셔너리로 데이터 표현 # sales = {'hong':0,'lee':0,'park':0} # d = {'z':10, 'b':20,'c':30} # print(d) # d.pop('b') # print(d) # d['f']=40 # print(d) # d.pop('z') # d['z'] = 40 # print(d.keys()) #반복문(while) #조건이 참일동안 수행 #while True: # print('python!!!') # a = 0 # while a < 10: # a += 1 # print(a) # a = 0 # while Tr...
normal
{ "blob_id": "38bd18e9c1d17f25c10321ab561372eed58e8abc", "index": 4243, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in data:\n if x < min:\n min = x\nprint(min)\n", "step-3": "data = [5, 6, 2, 8, 9, 1]\nmin = 10\nfor x in data:\n if x < min:\n min = x\nprint(min)\n", "step...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- from django.conf.urls import patterns, include, url from apps.virt.views import node, domain,device,cluster,home urlpatterns = patterns('', # Home url(r'^$', home.HomeView.as_view(), name='home'), # Cluster url(r'^cluster/status/$', cluster.ClusterStatusView.as_view(), name...
normal
{ "blob_id": "484d104a8481a707a187d0bcb30898c3459a88be", "index": 389, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^$', home.HomeView.as_view(), name='home'),\n url('^cluster/status/$', cluster.ClusterStatusView.as_view(), name=\n 'cluster_status'), url('^node/list...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def make_experiment_dir(postfix): home = os.path.expanduser('~') exp_dir = os.path.join(home, postfix) mkdir_p(exp_dir) return exp_dir def save_fig(folder, filename): if folder is None: return filename_out = os.path.join(folder, filename + '.png') pri...
flexible
{ "blob_id": "f253816d08407950caad28f1ce630ac2b099aa70", "index": 3241, "step-1": "<mask token>\n\n\ndef make_experiment_dir(postfix):\n home = os.path.expanduser('~')\n exp_dir = os.path.join(home, postfix)\n mkdir_p(exp_dir)\n return exp_dir\n\n\ndef save_fig(folder, filename):\n if folder is Non...
[ 10, 12, 13, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for word in text.split(): print(word) <|reserved_special_token_1|> text = 'I love Python Programming' for word in text.split(): print(word) <|reserved_special_token_1|> text = "I love Python Programming" for word in ...
flexible
{ "blob_id": "fdc8f9ff9a0e2cd8ad1990948036d9e420fdc074", "index": 4216, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor word in text.split():\n print(word)\n", "step-3": "text = 'I love Python Programming'\nfor word in text.split():\n print(word)\n", "step-4": "text = \"I love Python Programm...
[ 0, 1, 2, 3 ]
from enum import Enum class ImageTaggingChoice(str, Enum): Disabled = "disabled", Basic = "basic", Enhanced = "enhanced", UnknownFutureValue = "unknownFutureValue",
normal
{ "blob_id": "e3fe77867926d9d82963c8125048148de6998e2b", "index": 4374, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ImageTaggingChoice(str, Enum):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ImageTaggingChoice(str, Enum):\n ...
[ 0, 1, 2, 3, 4 ]
import unittest import os import tempfile import numpy as np from keras_piecewise.backend import keras from keras_piecewise import Piecewise2D from .util import MaxPool2D class TestPool2D(unittest.TestCase): @staticmethod def _build_model(input_shape, layer, row_num, col_num, pos_type=Piecewise2D.POS_TYPE_SE...
normal
{ "blob_id": "1af9fb91e69ea78709c47fca6b12e4f7a6fd17a8", "index": 7392, "step-1": "<mask token>\n\n\nclass TestPool2D(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TestPool2D(unittest.TestCase):\n\n @staticmethod\n def _build_model(input_s...
[ 1, 3, 4, 5, 6 ]
import sys import networkx as nx import bcube.generator_bcube as bcube import dcell.generate_dcell as dcell import fat_tree.generate_fat_tree as fatTree import cayley_graphs.generate_bubble_sort as bubbleSort import cayley_graphs.generate_hypercube as hypercube import cayley_graphs.generate_pancake as pancake import ca...
normal
{ "blob_id": "12d59697d5c2ec69d019c64dac762385c8c0cb66", "index": 7224, "step-1": "import sys\nimport networkx as nx\nimport bcube.generator_bcube as bcube\nimport dcell.generate_dcell as dcell\nimport fat_tree.generate_fat_tree as fatTree\nimport cayley_graphs.generate_bubble_sort as bubbleSort\nimport cayley_gr...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def drawBoard(canvas, data): canvas.create_rectangle(10, 10, data.width - 10, data.height - 10, fill ='dark green') canvas.create_rectangle(187, 160, 200, 550, fill='white') canvas.create_rectangle(187, 160, 561, 173, fill='white') can...
flexible
{ "blob_id": "628e625be86053988cbaa3ddfe55f0538136e24d", "index": 3599, "step-1": "<mask token>\n", "step-2": "def drawBoard(canvas, data):\n canvas.create_rectangle(10, 10, data.width - 10, data.height - 10, fill\n ='dark green')\n canvas.create_rectangle(187, 160, 200, 550, fill='white')\n can...
[ 0, 1, 2, 3 ]
class CardHolder: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __getattribute__(self, item): superget = object.__getattribute__ if item == 'acct': return superget(self, 'acct')[:-3] + '***' elif item == 'remain': ...
flexible
{ "blob_id": "602a7676129721dbfd318407dd972f80d681146c", "index": 3062, "step-1": "class CardHolder:\n <mask token>\n <mask token>\n <mask token>\n\n def __getattribute__(self, item):\n superget = object.__getattribute__\n if item == 'acct':\n return superget(self, 'acct')[:-3...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class AnswerFaq(models.Model): account = models.ForeignKey(Account) answer = models.TextField(verbose_name=u'Ответ на вопрос в FAQ') question = models.ForeignKey(QuestionFaq) date = models.DateField(auto_now_add=True) class Meta: verbose_name = u'Ответ на воп...
flexible
{ "blob_id": "b00c9f099fcb31262df947f47d7190912ee66965", "index": 6159, "step-1": "<mask token>\n\n\nclass AnswerFaq(models.Model):\n account = models.ForeignKey(Account)\n answer = models.TextField(verbose_name=u'Ответ на вопрос в FAQ')\n question = models.ForeignKey(QuestionFaq)\n date = models.Date...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> def displayable_info(tagname, comment): cs = comment.split('\t', 1) return ('{}{:<' + str(max_tag_len) + '}{} {}|{}{}{}|{} {}{}{}').format( COLOR_TAGNAME, tagname, COLOR_RESET, COLOR_BAR, COLOR_TAGTYPE, cs[0 ], COLOR_BAR, COLOR_RESET, COLOR_COMMENT, cs[1] if len(cs...
flexible
{ "blob_id": "b220cacc2530ca62b5599a9c1894e979bcfd5109", "index": 9633, "step-1": "<mask token>\n\n\ndef displayable_info(tagname, comment):\n cs = comment.split('\\t', 1)\n return ('{}{:<' + str(max_tag_len) + '}{} {}|{}{}{}|{} {}{}{}').format(\n COLOR_TAGNAME, tagname, COLOR_RESET, COLOR_BAR, COLOR...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Test: <|reserved_special_token_0|> print('called ', count) <|reserved_special_token_0|> <|reserved_special_token_0|> class Screen: @property def width(self): return self._width @width.setter def width(self, width): self._width = widt...
flexible
{ "blob_id": "ececcf40005054e26e21152bcb5e68a1bce33e88", "index": 7947, "step-1": "<mask token>\n\n\nclass Test:\n <mask token>\n print('called ', count)\n <mask token>\n\n\n<mask token>\n\n\nclass Screen:\n\n @property\n def width(self):\n return self._width\n\n @width.setter\n def wi...
[ 12, 14, 15, 17, 19 ]
<|reserved_special_token_0|> def sample_stack(stack, rows=2, cols=2, start_with=0, show_every=1, display1=True): if display1: new_list = [] new_list.append(stack) new_list.append(stack) new_list.append(stack) new_list.append(stack) sample_stack(new_list, 2, 2, 0...
flexible
{ "blob_id": "371c1c9e3ccf7dae35d435bdb013e0462f3add5d", "index": 4831, "step-1": "<mask token>\n\n\ndef sample_stack(stack, rows=2, cols=2, start_with=0, show_every=1,\n display1=True):\n if display1:\n new_list = []\n new_list.append(stack)\n new_list.append(stack)\n new_list.a...
[ 1, 2, 3, 4, 5 ]
/Users/medrine/anaconda/lib/python2.7/UserDict.py
normal
{ "blob_id": "8db90b0bfde61de1c4c1462bc3bcf05ef9056362", "index": 9236, "step-1": "/Users/medrine/anaconda/lib/python2.7/UserDict.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
# -*- coding: utf-8 -*- import math #COMECE SEU CÓDIGO AQUI f = float(input('Digite o valor de f: ')) L = float(input('Digite o valor de L: ')) Q = float(input('Digite o valor de Q: ')) DeltaH = float(input('Digite o valor de DeltaH: ')) v = float(input('Digite o valor de v: ')) g = 9.81 e = 0.000002 #PROCESSAMENTO D =...
normal
{ "blob_id": "b6183daa943cc63fd2959e3e54fc1e6af5d761de", "index": 202, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('valor de D: %.4f' % D)\nprint('valor de Rey: %.4f' % Rey)\nprint('valor de k: %.4f' % k)\n", "step-3": "<mask token>\nf = float(input('Digite o valor de f: '))\nL = float(input('D...
[ 0, 1, 2, 3, 4 ]
import ZooAnnouncerInterface class ZooAnnouncer(ZooAnnouncerInterface): def updateZoo(self,annoucement): print("ZooAnnouncer :" + annoucement)
normal
{ "blob_id": "be9c21ee04a612f711a1e6a82ea9478c77b62a82", "index": 8112, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ZooAnnouncer(ZooAnnouncerInterface):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ZooAnnouncer(ZooAnnouncerInterface):\n\n def updateZoo(self, annoucement):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CrossValidate(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CrossValidate(object): def __init__(self, df, target_cols, problem_type, num_folds=3, shuffle= False, random_sta...
flexible
{ "blob_id": "0dad1937df39c012f7991c3897f27964bed1d5a0", "index": 1533, "step-1": "<mask token>\n\n\nclass CrossValidate(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass CrossValidate(object):\n\n def __init__(self, df, target_cols, problem_type, num_folds=3, shuffle=\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> curses.cbreak() stdscr.keypad(1) rospy.init_node('keyop', anonymous=True) <|reserved_special_token_0|> stdscr.refresh() <|reserved_special_token_0|> while key != ord('q'): key = stdscr.getch() stdscr.refresh() if key =...
flexible
{ "blob_id": "fb332808890e369d1439d1dba61244a0f7b89301", "index": 4524, "step-1": "<mask token>\n", "step-2": "<mask token>\ncurses.cbreak()\nstdscr.keypad(1)\nrospy.init_node('keyop', anonymous=True)\n<mask token>\nstdscr.refresh()\n<mask token>\nwhile key != ord('q'):\n key = stdscr.getch()\n stdscr.ref...
[ 0, 1, 2, 3, 4 ]
class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def shortestPalindrome(self, s): """ :type s: str :rtype: str """ left = 0 for right in reversed(range(len(s))): ...
flexible
{ "blob_id": "4d18c056845403adc9c4b5848fafa06d0fe4ff4c", "index": 3165, "step-1": "class Solution(object):\n <mask token>\n\n\n<mask token>\n", "step-2": "class Solution(object):\n\n def shortestPalindrome(self, s):\n \"\"\"\n :type s: str\n :rtype: str\n \"\"\"\n left =...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- from odoo import models, fields, api class ResPartner(models.Model): _inherit = 'res.partner' purchase_type = fields.Many2one('purchase.order.type', string='Purchase Order Type')
normal
{ "blob_id": "f26b127b4d968c1a168a57825a5acfffbf027bef", "index": 3372, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ResPartner(models.Model):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ResPartner(models.Model):\n _inherit = 'res.partner'\n purchase_type...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class LoadBalancerTest(common.HeatTestCase): def setUp(self): super(LoadBalancerTest, self).setUp() self.lb_template = {'AWSTemplateFormatVersion': '2010-09-09', 'Description': 'fawef', 'Resources': {self. _get_lb_resource_name(): {'Type': ...
flexible
{ "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|> if __name__ == '__main__': i3 = i3ipc.Connection() wp = [int(w['name']) for w in i3.get_workspaces() if w['num'] != -1] for k in range(1, 16): if k not in wp: i3.command('workspace {}'.format(k)) ...
flexible
{ "blob_id": "cd07dd596f760e232db5c0fd8e27360d61bda635", "index": 8947, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n i3 = i3ipc.Connection()\n wp = [int(w['name']) for w in i3.get_workspaces() if w['num'] != -1]\n for k in range(1, 16):\n if k not in wp:\n ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Layer(nn_pb_grpc.LayerDataExchangeServicer): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def init_weights(self, load_weights...
flexible
{ "blob_id": "fa6f251f27b645fc6827285b5578fd9634c8bb30", "index": 6361, "step-1": "<mask token>\n\n\nclass Layer(nn_pb_grpc.LayerDataExchangeServicer):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def init_weights(self, load_weights=None):\n ...
[ 24, 27, 28, 32, 35 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @api_view(['GET']) def votings(request): votings = Votings.objects.all() if votings: return Response({}, status=status.HTTP_404_NOT_FOUND) else: serializer = VotingsSerializer(votings) r = req...
flexible
{ "blob_id": "c3ecac1c0facbf6f0905bb03fd337a7f4f5bbeff", "index": 4376, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@api_view(['GET'])\ndef votings(request):\n votings = Votings.objects.all()\n if votings:\n return Response({}, status=status.HTTP_404_NOT_FOUND)\n else:\n seri...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for _ in range(n): ans = min(ans * 2, ans + k) print(ans) <|reserved_special_token_1|> n, k = [int(input()) for _ in range(2)] ans = 1 for _ in range(n): ans = min(ans * 2, ans + k) print(ans)
flexible
{ "blob_id": "bb730606c7357eeb605292d5b9c05e8e8a797ea2", "index": 5461, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor _ in range(n):\n ans = min(ans * 2, ans + k)\nprint(ans)\n", "step-3": "n, k = [int(input()) for _ in range(2)]\nans = 1\nfor _ in range(n):\n ans = min(ans * 2, ans + k)\npri...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> rambench.perform_benchmark() <|reserved_special_token_1|> import rambench rambench.perform_benchmark()
flexible
{ "blob_id": "3d1f2130043613dc8d5bbd773edd96c87c355de9", "index": 3455, "step-1": "<mask token>\n", "step-2": "<mask token>\nrambench.perform_benchmark()\n", "step-3": "import rambench\nrambench.perform_benchmark()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
############################################################################## # # Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved. # Yoshinori Okuji <yo@nexedi.com> # Christophe Dumez <christophe@nexedi.com> # # WARNING: This program as such is intended to be ...
normal
{ "blob_id": "ffb6379f2f2611fd8aa73f3a3c15fed4550d348f", "index": 5920, "step-1": "<mask token>\n\n\nclass CodeBlock:\n <mask token>\n\n def __init__(self, raw_diff):\n self.body = os.linesep.join(raw_diff.splitlines()[1:])\n self.header = raw_diff.splitlines()[0]\n tmp = re.search('^@@...
[ 13, 19, 22, 24, 26 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for c in range(0, pessoas): peso = float(input('Informe o peso: ')) if c == 1: maior = peso menor = peso else: if peso > maior: maior = peso if peso < menor: meno...
flexible
{ "blob_id": "78c71a4f3c4e8f24f0ae90555a3caf15f35332f6", "index": 1774, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor c in range(0, pessoas):\n peso = float(input('Informe o peso: '))\n if c == 1:\n maior = peso\n menor = peso\n else:\n if peso > maior:\n maio...
[ 0, 1, 2, 3 ]
### 15/04/2020 ### Author: Omer Goder ### Looping through a list months = ['january','fabruary','march','april','may','june','july','august','september','october','november','december'] # Using a for loop to print a list for month in months: print("The next month is:\t" + month) print('\n') print("\nEnd ...
normal
{ "blob_id": "bc8bc5c3b6954302d005fe618827c644f93ad14e", "index": 6030, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor month in months:\n print('The next month is:\\t' + month)\n print('\\n')\nprint(\"\"\"\nEnd of program\n\"\"\")\n", "step-3": "months = ['january', 'fabruary', 'march', 'april...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from tkinter import * from tkinter import filedialog from tkinter import scrolledtext import tkinter as tk import os import sys import subprocess import shlex from subprocess import check_output import pathlib
flexible
{ "blob_id": "11576597429e119cf4887a88139df4a9e6d7eb66", "index": 1409, "step-1": "<mask token>\n", "step-2": "from tkinter import *\nfrom tkinter import filedialog\nfrom tkinter import scrolledtext\nimport tkinter as tk\nimport os\nimport sys\nimport subprocess\nimport shlex\nfrom subprocess import check_outpu...
[ 0, 1 ]
# -*- coding: utf-8 -*- # # Akamatsu CMS # https://github.com/rmed/akamatsu # # MIT License # # Copyright (c) 2020 Rafael Medina García <rafamedgar@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal ...
normal
{ "blob_id": "cde62c5032109bb22aa81d813e30097dad80a9c3", "index": 4924, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@bp_admin.route('/profile', methods=['GET', 'POST'])\n@login_required\ndef profile_edit():\n \"\"\"Show user profile edition form.\"\"\"\n form = ProfileForm(obj=current_user)\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('darksky/', views.DarkSkyView.as_view())] urlpatterns = format_suffix_patterns(urlpatterns) <|reserved_special_token_1|> from rest_framework.urlpatterns import format_suffix_patterns from django.urls import ...
flexible
{ "blob_id": "e40f0a25d0c02f36c254e630133dc1fb11f29d4d", "index": 8156, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('darksky/', views.DarkSkyView.as_view())]\nurlpatterns = format_suffix_patterns(urlpatterns)\n", "step-3": "from rest_framework.urlpatterns import format_suffix_patt...
[ 0, 1, 2 ]
#!/usr/bin/python3 def divisible_by_2(my_list=[]): if my_list is None or len(my_list) == 0: return None new = [] for num in my_list: if num % 2 == 0: new.append(True) else: new.append(False) return new
normal
{ "blob_id": "17f91b612fad14200d2911e2cb14e740b239f9ff", "index": 4894, "step-1": "<mask token>\n", "step-2": "def divisible_by_2(my_list=[]):\n if my_list is None or len(my_list) == 0:\n return None\n new = []\n for num in my_list:\n if num % 2 == 0:\n new.append(True)\n ...
[ 0, 1, 2 ]
class Solution: def numIdenticalPairs(self, nums: List[int]) -> int: count = 0 inputLength = len(nums) for i in range (0, inputLength): for j in range (i, inputLength - 1): if (nums[i] == nums[j + 1]): count += 1 return count
normal
{ "blob_id": "d7570bbea1e8c7674d507f8e86ce04d22058b21b", "index": 7595, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def numIdenticalPairs(self, nums: List[int]) ->int:\n count = 0\n inputLength = len(nums)\n for i in range...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class GameMother: async def a_game(self, num_slots: int, num_colors: int, max_guesses: int, secret_code: list[Color], reference: (str | None)=None) ->Game: async with provide(MongoUnitOfWork) as uow: ...
flexible
{ "blob_id": "8457cdde8f8ad069505c7729b8217e5d272be41e", "index": 957, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GameMother:\n\n async def a_game(self, num_slots: int, num_colors: int, max_guesses:\n int, secret_code: list[Color], reference: (str | None)=None) ->Game:\n asy...
[ 0, 1, 2, 3 ]
#!/usr/local/bin/python3 import time, json, os, sqlite3, uuid, json, base64, sys import requests as http import numpy as np from os.path import isfile, join from datetime import date, datetime from argparse import ArgumentParser PRINTER_IP = "" FRAMERATE = 30 TIMELAPSE_DURATION = 60 TIMELAPSE_PATH = "timelapses" DATA...
normal
{ "blob_id": "d443e9054481984d5372343170254268dca8a3b1", "index": 3235, "step-1": "<mask token>\n\n\ndef is_printing():\n try:\n status = http.get('http://' + PRINTER_IP + '/api/v1/printer/status',\n timeout=1)\n if status.json() == 'printing':\n state = http.get('http://' +...
[ 8, 9, 10, 11, 12 ]
<|reserved_special_token_0|> def evens(upper_limit): return [i for i in range(0, upper_limit, 2)] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def odds(upper_limit): return [i for i in range(1, upper_limit, 2)] def evens(upper_limit): return [i for i in r...
flexible
{ "blob_id": "a2e4e4a0c49c319df2adb073b11107d3f520aa6e", "index": 1883, "step-1": "<mask token>\n\n\ndef evens(upper_limit):\n return [i for i in range(0, upper_limit, 2)]\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef odds(upper_limit):\n return [i for i in range(1, upper_limit, 2)]\n\n\ndef even...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True, autoincrement=True) first_name = db.Column(db.String(50), nullable=False) last_name = db.Column(db.String(50), nullable=False) image_url = db.Column(db.String) class Post(db.Mo...
flexible
{ "blob_id": "9ae92d6ee4b82f7ed335c47d53567b817140a51c", "index": 8922, "step-1": "<mask token>\n\n\nclass User(db.Model):\n __tablename__ = 'users'\n id = db.Column(db.Integer, primary_key=True, autoincrement=True)\n first_name = db.Column(db.String(50), nullable=False)\n last_name = db.Column(db.Str...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class LMS: <|reserved_special_token_0|> <|reserved_special_token_0|> def issue_books(self): books_id = input("Enter book's ID: ") current_date = datetime.datetime.now().strftime('%d-%m-%Y %H:%M:%S') if books_id in self.books_dict.keys(): ...
flexible
{ "blob_id": "1a2616472c8d432c91e2b48260cbae61d3ecfd90", "index": 1746, "step-1": "<mask token>\n\n\nclass LMS:\n <mask token>\n <mask token>\n\n def issue_books(self):\n books_id = input(\"Enter book's ID: \")\n current_date = datetime.datetime.now().strftime('%d-%m-%Y %H:%M:%S')\n ...
[ 4, 5, 6, 7, 9 ]
import numpy as np def output(i, out): with open('B-large.out', 'a') as outfile: outfile.write("Case #{0}: {1}\n".format(i, out)) def solve(i, stack): cursymbol = stack[0] counter = 0 if stack[-1] == "+" else 1 for symbol in stack: if symbol != cursymbol: ...
normal
{ "blob_id": "752679d2484b6b91a734c7cbe4a99bd5676661eb", "index": 9498, "step-1": "<mask token>\n\n\ndef output(i, out):\n with open('B-large.out', 'a') as outfile:\n outfile.write('Case #{0}: {1}\\n'.format(i, out))\n\n\ndef solve(i, stack):\n cursymbol = stack[0]\n counter = 0 if stack[-1] == '+...
[ 2, 3, 4, 5, 6 ]
# coding: utf-8 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License...
normal
{ "blob_id": "4dde161d25ed41154e13b94cc9640c6aac055f87", "index": 6164, "step-1": "<mask token>\n", "step-2": "<mask token>\nUNK_TOKEN = '<unk>'\nBOS_TOKEN = '<bos>'\nEOS_TOKEN = '<eos>'\nPAD_TOKEN = '<pad>'\nUNK_IDX = 0\nLARGE_POSITIVE_FLOAT = 1e+18\nLARGE_NEGATIVE_FLOAT = -LARGE_POSITIVE_FLOAT\nGLOVE_NPZ_SHA1...
[ 0, 1, 2 ]
''' Copyright 2014-2015 Reubenur Rahman All Rights Reserved @author: reuben.13@gmail.com ''' import XenAPI inputs = {'xenserver_master_ip': '15.22.18.17', 'xenserver_password': 'reuben', 'xenserver_user': 'root', 'vm_name': 'SLES11SP2x64', 'target_host': 'xenserver-2' ...
normal
{ "blob_id": "c173c4673fd716a8b88faf751639d52e9ea4ffab", "index": 4482, "step-1": "'''\nCopyright 2014-2015 Reubenur Rahman\nAll Rights Reserved\n@author: reuben.13@gmail.com\n'''\n\nimport XenAPI\n\ninputs = {'xenserver_master_ip': '15.22.18.17',\n 'xenserver_password': 'reuben',\n 'xenserver_u...
[ 0 ]
N=int(input()) S=input() ans=0 for i in range(1000): l=str(i).zfill(3);k=0 for j in range(N): if S[j]==l[k]: k+=1 if k==3:ans+=1;break print(ans)
normal
{ "blob_id": "dabd835ff02f2adb01773fb7dd7099206cbae162", "index": 9903, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1000):\n l = str(i).zfill(3)\n k = 0\n for j in range(N):\n if S[j] == l[k]:\n k += 1\n if k == 3:\n ans += 1\n ...
[ 0, 1, 2, 3 ]
from __future__ import division __author__ = 'Vladimir Iglovikov' import pandas as pd from sklearn.preprocessing import LabelEncoder import numpy as np from sklearn.cross_validation import ShuffleSplit from sklearn.metrics import mean_squared_error import math from sklearn.ensemble import RandomForestRegressor joined...
normal
{ "blob_id": "610fde0db6e3fe0a54a008287e0c36b25b7a482f", "index": 8200, "step-1": "from __future__ import division\n__author__ = 'Vladimir Iglovikov'\n\nimport pandas as pd\nfrom sklearn.preprocessing import LabelEncoder\nimport numpy as np\nfrom sklearn.cross_validation import ShuffleSplit\nfrom sklearn.metrics ...
[ 0 ]
class person(object): population = 50 def __init__(self, name, age): self.name = name self.age = age @classmethod def getpopulation(cls): return cls.population @staticmethod def isadult(age=17): return age >= 18 def display(self): print(self.name, ...
normal
{ "blob_id": "a21942a835f7b2ea70e9dd7b26285ea2dd411750", "index": 1205, "step-1": "class person(object):\n <mask token>\n\n def __init__(self, name, age):\n self.name = name\n self.age = age\n\n @classmethod\n def getpopulation(cls):\n return cls.population\n\n @staticmethod\n ...
[ 5, 6, 7, 8 ]
def multiple_parameters(name, location): print(f"Hello {name}") print(f"I live in {location}") #positional arguments multiple_parameters("Selva", "Chennai") #keyword arguments multiple_parameters(location="Chennai", name="Selva")
normal
{ "blob_id": "baf3bde709ec04b6f41dce8a8b8512ad7847c164", "index": 3100, "step-1": "<mask token>\n", "step-2": "def multiple_parameters(name, location):\n print(f'Hello {name}')\n print(f'I live in {location}')\n\n\n<mask token>\n", "step-3": "def multiple_parameters(name, location):\n print(f'Hello {...
[ 0, 1, 2, 3 ]
import tornado.ioloop import tornado.web import json import utils class BaseHandler(tornado.web.RequestHandler): def set_default_headers(self): self.set_header("Access-Control-Allow-Origin", "*") self.set_header("Access-Control-Allow-Headers", "x-requested-with") class CondaHandler(BaseHandler): ...
normal
{ "blob_id": "44a9bb4d74d2e694f252d8726647bca13baa4df5", "index": 853, "step-1": "<mask token>\n\n\nclass BaseHandler(tornado.web.RequestHandler):\n <mask token>\n\n\nclass CondaHandler(BaseHandler):\n\n def get(self, filePath):\n with open('packages/conda/' + filePath) as f:\n data = json...
[ 5, 7, 8, 9, 10 ]
# Patrick Vanegas - Final project from tkinter import * import frequency import turtle import math import random # intitalize a blank window root = Tk() # initialize turtle window window = turtle.Screen() # Create widgets to be viewed on the Tkinter window label_1 = Label(root, text = "Enter a number less than 5...
normal
{ "blob_id": "0ac99816248e3306ca6340f7bee8a518877bc3e9", "index": 1186, "step-1": "<mask token>\n\n\ndef drawPieChart(central_angles, angle_of_rest, probability_of_rest):\n turtle.reset()\n window.colormode(255)\n turtle.fillcolor('gray')\n turtle.speed(10)\n turtle.begin_fill()\n turtle.circle(...
[ 2, 3, 4, 5, 6 ]
from collections import deque for case in xrange(input()): cards = input() indexes = map(int, raw_input().split()) deck = [0 for i in xrange(cards)] index = -1 for i in xrange(1, cards + 1): while True: index = (index + 1)%cards if deck[index] == 0: break for j in xrange(i - 1): ...
normal
{ "blob_id": "c7ecf8ada74b3e401c2144457d4fa1050f598727", "index": 8787, "step-1": "from collections import deque\n\nfor case in xrange(input()):\n cards = input()\n indexes = map(int, raw_input().split())\n\n deck = [0 for i in xrange(cards)]\n index = -1\n for i in xrange(1, cards + 1):\n while True:\n ...
[ 0 ]
import sqlite3 conn = sqlite3.connect("19-BD/prove.db") cursor = conn.cursor() dipendenti = [ ("Sofia","commessa"), ("Diego","tecnico"), ("Lucia","cassiera"), ("Luca","Magazziniere"), ("Pablo","Capo reparto") ] cursor.executemany("INSERT INTO persone VALUES (null,?,?)", dipendenti) conn.commit() ...
normal
{ "blob_id": "3e1ca6ed4668e75a62baa65ef44346dd86a16491", "index": 3093, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.executemany('INSERT INTO persone VALUES (null,?,?)', dipendenti)\nconn.commit()\nconn.close()\n", "step-3": "<mask token>\nconn = sqlite3.connect('19-BD/prove.db')\ncursor = conn...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import random """ 检查图数据和结构或者链表数据结构中是否存在环 https://www.youtube.com/watch?v=YKE4Vd1ysPI """ def get_all_edge(graph): result = [] for k, v in graph.items(): for i in v: if sorted((k, i)) not in result: result.append(sorted((k, ...
normal
{ "blob_id": "371762a6e3f8b8ed14742a70a709da224ae6712b", "index": 305, "step-1": "<mask token>\n\n\ndef bfs(graph, start):\n result = []\n queue = []\n seen = set()\n queue.append(start)\n seen.add(start)\n while len(queue):\n vertex = queue.pop(0)\n nodes = graph[vertex]\n ...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python #coding=UTF8 ''' @author: devin @time: 2013-11-23 @desc: timer ''' import threading import time class Timer(threading.Thread): ''' 每隔一段时间执行一遍任务 ''' def __init__(self, seconds, fun, **kwargs): ''' seconds为间隔时间,单位为秒 fun为定时执行的任务...
normal
{ "blob_id": "4a546222082e2a25296e31f715baf594c974b7ad", "index": 5844, "step-1": "#!/usr/bin/env python\n#coding=UTF8\n'''\n @author: devin\n @time: 2013-11-23\n @desc:\n timer\n'''\nimport threading\nimport time\n\nclass Timer(threading.Thread):\n '''\n 每隔一段时间执行一遍任务\n '''\n def _...
[ 0 ]
n=int(input("enter the number\n")) sum=0 for i in range(1,n-1): rem=n%i if(rem==0): sum=sum+i if(sum==n): print("the number is perfect") else: print("not prime")
normal
{ "blob_id": "5721786b61cf8706b1d401a46d06f2d32153df8b", "index": 765, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n - 1):\n rem = n % i\n if rem == 0:\n sum = sum + i\nif sum == n:\n print('the number is perfect')\nelse:\n print('not prime')\n", "step-3": "n = in...
[ 0, 1, 2, 3 ]
from django.db import models from django.contrib.auth.models import User class CustomUser(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='custom_user') def get_current_score(self): acc = 0 for score in self.user_scores.all(): acc += score.p...
normal
{ "blob_id": "dc27781d0c3129d11aa98a5889aea0383b5a49d6", "index": 3571, "step-1": "<mask token>\n\n\nclass Team(models.Model):\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name + ' ' + str(self.id)\n\n\nclass Leaderboard(models.Model):\n end_date = models.DateField(auto_no...
[ 8, 9, 10, 13, 15 ]
import PIL from matplotlib import pyplot as plt import matplotlib from keras.preprocessing.image import ImageDataGenerator from keras.models import load_model from keras.models import Sequential from keras.layers import Dense, Dropout from keras.optimizers import RMSprop from keras.layers import Dense, Dropout, Flatten...
normal
{ "blob_id": "d2f760b821fc5c599cda1091334364e18234ab06", "index": 4222, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.fit\n<mask token>\nmodel.save('./T_100_Modelo_C64k33_C128k33_d025_D256_d05_D5.h5')\nplt.plot(history.history['accuracy'], label='accuracy')\nplt.plot(history.history['val_accuracy']...
[ 0, 1, 2, 3, 4 ]
import numpy as np # UM TRABALHO FEITO PELA GRANDE DUPLA PEQUENA Mag e Rud def main(): a = int(input("Informe a sua opção (Aleatório = 0, Você escolhe = outro numero): ")) if(a != 0): linhas = int(input("Informe o número de linhas da matriz: ")) colunas = int(input("Informe o número de colunas...
normal
{ "blob_id": "c80ecb97c8863b724169715b766024ce824b9225", "index": 5572, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n a = int(input(\n 'Informe a sua opção (Aleatório = 0, Você escolhe = outro numero): '))\n if a != 0:\n linhas = int(input('Informe o número de linhas...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class testRegistrazione(TestCase): <|reserved_special_token_0|> def tearDown(self): self.proprietario1.delete() self.proprietario2.delete() self.user1.delete() self.user2.delete() self.sezione1.delete() self.post1.delete() def ...
flexible
{ "blob_id": "cf9339659f49b4093c07e3723a2ede1543be41b8", "index": 4900, "step-1": "<mask token>\n\n\nclass testRegistrazione(TestCase):\n <mask token>\n\n def tearDown(self):\n self.proprietario1.delete()\n self.proprietario2.delete()\n self.user1.delete()\n self.user2.delete()\n...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> runner.run(discover) f.close() <|reserved_special_token_1|> <|reserved_special_token_0|> discover = unittest.defaultTestLoader.discover(start_dir='./', pattern= 'test*.py', top_level_dir=None) f = open('report.html', 'wb+')...
flexible
{ "blob_id": "051062a78d3f8b0caefd15f7a57a8500ddc019a6", "index": 9290, "step-1": "<mask token>\n", "step-2": "<mask token>\nrunner.run(discover)\nf.close()\n", "step-3": "<mask token>\ndiscover = unittest.defaultTestLoader.discover(start_dir='./', pattern=\n 'test*.py', top_level_dir=None)\nf = open('repo...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: pinyin = f.readline().strip() character = f.readline().strip() if not character: break character_dict[pinyin] = character <|reserved_special_token_0|> fout.write('-----------------------------')...
flexible
{ "blob_id": "226bb323597100b57ef83eb0d5e4a9b894b77fd2", "index": 9830, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n pinyin = f.readline().strip()\n character = f.readline().strip()\n if not character:\n break\n character_dict[pinyin] = character\n<mask token>\nfout.writ...
[ 0, 1, 2, 3, 4 ]
lista = [2, 3.2, 4, 52, 6.25] s = sum(lista) print(s)
normal
{ "blob_id": "05aa8eac846154024d25d639da565135e41403c2", "index": 9611, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(s)\n", "step-3": "lista = [2, 3.2, 4, 52, 6.25]\ns = sum(lista)\nprint(s)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(flags) <|reserved_special_token_1|> <|reserved_special_token_0|> flags = [i for i in dir(cv2) if i.startswith('COLOR_')] print(flags) <|reserved_special_token_1|> <|reserved_special_token_0|> import cv2 flags = [i for ...
flexible
{ "blob_id": "ea3b8fe602357fa3d1de4daefce1e71a7de6e010", "index": 2117, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(flags)\n", "step-3": "<mask token>\nflags = [i for i in dir(cv2) if i.startswith('COLOR_')]\nprint(flags)\n", "step-4": "<mask token>\nimport cv2\nflags = [i for i in dir(cv2) i...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import os #os.environ['CUDA_VISIBLE_DEVICES'] = '-1' import keras from keras.layers import Dense, Dropout, Input, Embedding, LSTM, Reshape, CuDNNLSTM from keras.models import Model,Sequential from keras.da...
normal
{ "blob_id": "bb335187dc61fae049ca4a9a55a93f856b3c7822", "index": 2534, "step-1": "# -*- coding: utf-8 -*-\n\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport os\n#os.environ['CUDA_VISIBLE_DEVICES'] = '-1'\nimport keras\nfrom keras.layers import Dense, Dropout, ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def decorate(): print('hi') <|reserved_special_token_0|> <|reserved_special_token_1|> def decorate(): print('hi') @decorate def decorated(): print('decorated') <|reserved_special_token_0|> <|reserved_special_token_1|> def decorate(): ...
flexible
{ "blob_id": "1328d62769ee2a0309021ff40fdbf78a2c5570c9", "index": 9678, "step-1": "<mask token>\n", "step-2": "def decorate():\n print('hi')\n\n\n<mask token>\n", "step-3": "def decorate():\n print('hi')\n\n\n@decorate\ndef decorated():\n print('decorated')\n\n\n<mask token>\n", "step-4": "def deco...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': app.run(port=NLC.port, debug=True) <|reserved_special_token_1|> <|reserved_special_token_0|> app = NLC.create_app() if __name__ == '__main__': app.run(port=NLC.port, debug=True) <|reserved_s...
flexible
{ "blob_id": "de2de26d0c82213393e8174d1144c3510c63b899", "index": 2515, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n app.run(port=NLC.port, debug=True)\n", "step-3": "<mask token>\napp = NLC.create_app()\nif __name__ == '__main__':\n app.run(port=NLC.port, debug=True...
[ 0, 1, 2, 3 ]
from __future__ import division from pyoperators import pcg from pysimulators import profile from qubic import ( create_random_pointings, equ2gal, QubicAcquisition, PlanckAcquisition, QubicPlanckAcquisition, QubicInstrument) from qubic.data import PATH from qubic.io import read_map import healpy as hp import ma...
normal
{ "blob_id": "bcb028bd25732e17ed1478e122ac3b2d1abf2520", "index": 7931, "step-1": "<mask token>\n\n\ndef statstr(vec):\n m = np.mean(vec)\n s = np.std(vec)\n return '{0:.4f} +/- {1:.4f}'.format(m, s)\n\n\ndef plotinst(inst, shift=0.12):\n for xyc, quad in zip(inst.detector.center, inst.detector.quadra...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> @ask.launch def new_game(): pygame.mixer.init() pygame.mixer.music.load('haha2.mp3') pygame.mixer.music.play() welcome_msg = render_template('welcome') return question(welcome_msg) @ask.intent('ChooseIntent', convert={'first': int}) def ask_choose(first): session...
flexible
{ "blob_id": "e4b6304be10ee5a741c8a193dcf65950299ef11a", "index": 1477, "step-1": "<mask token>\n\n\n@ask.launch\ndef new_game():\n pygame.mixer.init()\n pygame.mixer.music.load('haha2.mp3')\n pygame.mixer.music.play()\n welcome_msg = render_template('welcome')\n return question(welcome_msg)\n\n\n@...
[ 6, 7, 8, 9, 10 ]
<|reserved_special_token_0|> class Board(BaseBoard): <|reserved_special_token_0|> EMOJI = ['⌛', '‼', '♝', '♗', '♚', '♔', '♞', '♘', '♟', '♙', '♛', '♕', '♜', '♖', '▪', '▫'] def __init__(self, board=None, _id=None, active_player=True): """ Set up board. """ super().__...
flexible
{ "blob_id": "796fada5dcd45ace8240760ac7e9bad41953ab56", "index": 9347, "step-1": "<mask token>\n\n\nclass Board(BaseBoard):\n <mask token>\n EMOJI = ['⌛', '‼', '♝', '♗', '♚', '♔', '♞', '♘', '♟', '♙', '♛', '♕',\n '♜', '♖', '▪', '▫']\n\n def __init__(self, board=None, _id=None, active_player=True):...
[ 8, 9, 10, 11, 12 ]
from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper from typing import Any, Optional def wrap_oracle_errors() -> None: ... class _UninitializedOperatorsDescriptor: def __get__(self, instance: Any, cls: Optional[Any] = ...): ... class DatabaseWrapper(BaseDatabaseWrapper): vendo...
normal
{ "blob_id": "829b8cd0b648d39c07c20fd1c401bf717ed5b9c4", "index": 9682, "step-1": "<mask token>\n\n\nclass OracleParam:\n force_bytes: Any = ...\n input_size: Any = ...\n\n def __init__(self, param: Any, cursor: Any, strings_only: bool=...) ->None:\n ...\n\n\nclass VariableWrapper:\n var: Any =...
[ 16, 20, 25, 27, 31 ]
def solve(): valid_passes = 0 with open('.\day4.txt') as fp: for line in fp.read().strip().splitlines(): list_of_words = set() add = 1 for word in line.split(): modified_word = ''.join(sorted(word)) if modified_word in list_of_words: ...
normal
{ "blob_id": "870d260b58c10e0379d66c3b44bc45594ff7d666", "index": 4396, "step-1": "<mask token>\n", "step-2": "def solve():\n valid_passes = 0\n with open('.\\\\day4.txt') as fp:\n for line in fp.read().strip().splitlines():\n list_of_words = set()\n add = 1\n for w...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python import os import sys import numpy as np from sklearn.metrics import roc_curve, auc def confusion_matrix(Or, Tr, thres): tpos = np.sum((Or >= thres) * (Tr == 1)) tneg = np.sum((Or < thres) * (Tr == 0)) fpos = np.sum((Or >= thres) * (Tr == 0)) fneg = np.sum((Or < thres) * (Tr == 1...
normal
{ "blob_id": "4892d4f364b03b53b1ad6f4c2177bbe2898edbda", "index": 3691, "step-1": "<mask token>\n\n\ndef cut_off(x):\n if x <= 0:\n print('Cut_off is applied')\n return float('inf')\n return x\n\n\ndef compute_dice(out_fol, steps=100):\n files = [x for x in os.listdir(out_fol) if 'npy' in x...
[ 2, 4, 5, 6, 8 ]
from torch.utils.data import DataLoader from config import Config from torchnet import meter import numpy as np import torch from torch import nn from tensorboardX import SummaryWriter from Funcs import MAvgMeter from vae.base_vae import VAE from vae.data_util import Zinc_dataset import time import torch.optim class ...
normal
{ "blob_id": "8b7894e274647e48e3a1fe12473937bd6c62e943", "index": 8741, "step-1": "<mask token>\n\n\nclass Trainer:\n\n def __init__(self, model=None, opt=Config()):\n self.model = model\n self.opt = opt\n self.criterion = opt.criterion\n self.pred_id = self.opt.predictor_id\n ...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cv2.imshow('output', imgCanny) cv2.waitKey(0) <|reserved_special_token_1|> <|reserved_special_token_0|> img = cv2.imread('Chapter1/resources/jacuzi.jpg') imgGrey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) imgCanny = cv2.Canny(img,...
flexible
{ "blob_id": "292cfecb701ecc179381d4453063aff532a0e877", "index": 8961, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv2.imshow('output', imgCanny)\ncv2.waitKey(0)\n", "step-3": "<mask token>\nimg = cv2.imread('Chapter1/resources/jacuzi.jpg')\nimgGrey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\nimgCanny ...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'test1.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName(...
normal
{ "blob_id": "3222dd7c2d19d86f2e085cb489ab4a48307ba132", "index": 7458, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_Dialog(object):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Ui_Dialog(object):\n\n def setupUi(self, Dialog):\n Dialog.setObjectNam...
[ 0, 1, 2, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(natija) <|reserved_special_token_1|> n = int(input('n=')) x = int(input('x=')) natija = pow(n, x) + pow(6, x) print(natija) <|reserved_special_token_1|> n=int(input("n=")) x=int(input("x=")) natija=pow(n,x)+pow(6,x) ...
flexible
{ "blob_id": "0d6490ae5f60ef21ad344e20179bd1b0f6aa761e", "index": 6214, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(natija)\n", "step-3": "n = int(input('n='))\nx = int(input('x='))\nnatija = pow(n, x) + pow(6, x)\nprint(natija)\n", "step-4": "n=int(input(\"n=\"))\r\nx=int(input(\"x=\"))\r\nn...
[ 0, 1, 2, 3 ]
# Generated by Django 2.2.6 on 2019-11-13 13:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('interface', '0010_auto_20191104_2107'), ] operations = [ migrations.AlterField( model_name='submission', name='revie...
normal
{ "blob_id": "3b42e218acf1c93fab3a0893efa8bf32a274eb23", "index": 448, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('interface', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class UserLoginView(GenericAPIView): def _generate_tokens(self, user_id, with_refresh_token=True): """ 生成token 和refresh_token :param user_id: 用户id :return: token, refresh_token """ now = datetime.utcnow() expiry = now + timedelt...
flexible
{ "blob_id": "0457ac2ecd0a951b0088c887539ab696797d68bc", "index": 4557, "step-1": "<mask token>\n\n\nclass UserLoginView(GenericAPIView):\n\n def _generate_tokens(self, user_id, with_refresh_token=True):\n \"\"\"\n 生成token 和refresh_token\n :param user_id: 用户id\n :return: token, refr...
[ 7, 8, 10, 11, 13 ]
''' Write the necessary code to display the area and perimeter of a rectangle that has a width of 2.4 and a height of 6.4. ''' x, y = 2.4, 6.4 perimeter = (x*2)+(y*2) area = x*y print("Perimeter is "+str(perimeter) + ", Area is " + str(area))
normal
{ "blob_id": "a7de079866d7ac80260b438043cf0403f598cebc", "index": 5091, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Perimeter is ' + str(perimeter) + ', Area is ' + str(area))\n", "step-3": "<mask token>\nx, y = 2.4, 6.4\nperimeter = x * 2 + y * 2\narea = x * y\nprint('Perimeter is ' + str(per...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('transcript.txt', 'w') as f: for line in transcript: f.write(line['text'] + '\n') <|reserved_special_token_1|> <|reserved_special_token_0|> transcript_list = YouTubeTranscriptApi.list_transcripts('i8pOulVU...
flexible
{ "blob_id": "c2d6e4286e1b9d6dc852bde994da60d353e03e5c", "index": 8031, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('transcript.txt', 'w') as f:\n for line in transcript:\n f.write(line['text'] + '\\n')\n", "step-3": "<mask token>\ntranscript_list = YouTubeTranscriptApi.list_trans...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python from imgproc import * from time import sleep # open the webcam #camera = Camera(640, 480) camera = Camera(320, 240) #camera = Camera(160, 120) #while True: # grab an image from the camera frame = camera.grabImage() print frame[x,y] # open a view, setting the view to the size of the captur...
normal
{ "blob_id": "7dc7c7598c9069e5fbb336bb97161ebb7c74366e", "index": 2277, "step-1": "#!/usr/bin/env python\n\nfrom imgproc import *\nfrom time import sleep\n\n# open the webcam\n#camera = Camera(640, 480)\ncamera = Camera(320, 240)\n#camera = Camera(160, 120)\n\n#while True:\n\t\n\t# grab an image from the camera\n...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def permutations(string): return list(''.join(p) for p in set(itertools.permutations(string))) <|reserved_special_token_1|> import itertools def permutations(string): return list(''.join(p) for p in set(itertools.pe...
flexible
{ "blob_id": "3d49d03dbc38ee37eadd603b4b464b0e2e1a33d5", "index": 5280, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef permutations(string):\n return list(''.join(p) for p in set(itertools.permutations(string)))\n", "step-3": "import itertools\n\n\ndef permutations(string):\n return list('...
[ 0, 1, 2, 3 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import sys PY2 = sys.version_info[0] == 2 if PY2: text_type = unicode string_types = basestring, else: text_type = str string_types = str, def with_metaclass(meta, *bases): # This requires a bit of explanation: the basic idea is to make a dummy # met...
normal
{ "blob_id": "414cb9a173ac70ad9ad1fc540aec569321fd3f8b", "index": 9477, "step-1": "<mask token>\n\n\ndef with_metaclass(meta, *bases):\n\n\n class metaclass(meta):\n\n def __new__(cls, name, this_bases, d):\n return meta(name, bases, d)\n return type.__new__(metaclass, 'temporary_class', (...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import rospy import json import requests import time import logging import numpy as np from matplotlib import path from geometry_msgs.msg import PoseWithCovarianceStamped from std_msgs.msg import String from people_msgs.msg import People import rsb import sys # -busy stat...
normal
{ "blob_id": "094e7c150456888389c764d4dd7bf3c9a87a022c", "index": 9006, "step-1": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport rospy\nimport json\nimport requests\nimport time\nimport logging\nimport numpy as np\nfrom matplotlib import path\nfrom geometry_msgs.msg import PoseWithCovarianceStamped\nfr...
[ 0 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-23 17:10 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('sepomex', '0006_auto_20151113_2154'), ] operations...
normal
{ "blob_id": "99c27d13349eba391866cfed25cc052b40910ea5", "index": 2837, "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 = [('sepomex', '...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import gc import logging import os import mock import sys import time from shellbot import Context, Engine from shellbot.i18n import Localization, localization as l10n, _ class LocalizationTests(unittest.TestCase): def test_default(self): lo...
normal
{ "blob_id": "debd51b923a6fc3b278a5083478bfb271a5913a8", "index": 162, "step-1": "<mask token>\n\n\nclass LocalizationTests(unittest.TestCase):\n\n def test_default(self):\n logging.info('*** default ***')\n localization = Localization()\n text = 'hello world'\n self.assertEqual(loc...
[ 3, 4, 5, 6, 7 ]
from libs.storage.blocks.iterators.base import BaseBlockIterator from libs.storage.const import SEPARATOR class ContentsBlockIterator(BaseBlockIterator): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.contents = self.block_content.split(SEPARATOR) self.titles ...
normal
{ "blob_id": "b888745b3ce815f7c9eb18f5e76bacfadfbff3f5", "index": 3153, "step-1": "<mask token>\n\n\nclass ContentsBlockIterator(BaseBlockIterator):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass ContentsBlockIterator(BaseBlockIterator):\n\n def __init__(self, *args, **kwargs):\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('sentences:\n', sentences) <|reserved_special_token_0|> for sentence in sentences: words = [] for word in sentence: if word not in punctuation: words.append(word) tokenized.append(words) print...
flexible
{ "blob_id": "5c61ec549a3e78da4ea8a18bb4f8382f2b5c2cfa", "index": 4438, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('sentences:\\n', sentences)\n<mask token>\nfor sentence in sentences:\n words = []\n for word in sentence:\n if word not in punctuation:\n words.append(word)...
[ 0, 1, 2, 3, 4 ]
import datetime from httpx import AsyncClient from testing.conftest import (LESSONS_PATH, REVIEWS_PATH, pytestmark, register_and_get_token) class TestReview: async def test_review_add_get(self, ac, fill_db): # Creating users first token = await register_and_get_tok...
normal
{ "blob_id": "3ec858c04a7622ae621bf322730b6b3ba9f4d07e", "index": 5826, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestReview:\n\n async def test_review_add_get(self, ac, fill_db):\n token = await register_and_get_token(ac)\n token2 = await register_and_get_token(ac, main_us...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python import fileinput import sys import os from argparse import ArgumentParser from probin.model.composition import multinomial as mn from probin.dna import DNA from Bio import SeqIO from corrbin.misc import all_but_index, Uniq_id, GenomeGroup from corrbin.multinomial import Experiment from corrbin.co...
normal
{ "blob_id": "b9a262bd6ddbca3b214825a473d870e70e8b5e57", "index": 9443, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main(open_name_file, dir_path, kmer_length, x_set):\n groups = []\n DNA.generate_kmer_hash(kmer_length)\n for line in open_name_file:\n if line[0:12] == 'family_na...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def register(request): context = {'title': '注册', 'top': '0'} return render(request, 'df_user/register.html', context) def login(request): context = {'title': '登录', 'top': '0'} return render(request, 'df_user/login.html', context) def register_handle(request): dict ...
flexible
{ "blob_id": "1ef40d4162ca1b1bd6a5a5010485c78eb9d8d736", "index": 9621, "step-1": "<mask token>\n\n\ndef register(request):\n context = {'title': '注册', 'top': '0'}\n return render(request, 'df_user/register.html', context)\n\n\ndef login(request):\n context = {'title': '登录', 'top': '0'}\n return rende...
[ 6, 7, 9, 11, 12 ]