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|> def content_loss(content_layer, generated_layer): return tf.scalar_mul(0.5, tf.nn.l2_loss(content_layer - generated_layer)) <|reserved_special_token_0|> def get_gram_matrix(matrix, num_filters): matrix_vectorized = t...
flexible
{ "blob_id": "f92b939bf9813e5c78bc450ff270d5fb6171792a", "index": 4810, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef content_loss(content_layer, generated_layer):\n return tf.scalar_mul(0.5, tf.nn.l2_loss(content_layer - generated_layer))\n\n\n<mask token>\n\n\ndef get_gram_matrix(matrix, num...
[ 0, 2, 3, 4, 5 ]
from rest_framework import serializers from .models import Twit, Comment, Message from django.contrib.auth.models import User class TwitSerializer(serializers.ModelSerializer): class Meta: model = Twit fields = '__all__' class CommentSerializer(serializers.ModelSerializer): class Meta: ...
normal
{ "blob_id": "536a67935527eb99bc0424613c9b931401db0b06", "index": 6461, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass CommentSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Comment\n fields = '__all__'\n\n\nclass MessageSerializer(serializers.ModelSerialize...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class BasicMC(commands.Cog): <|reserved_special_token_0|> @commands.command(name='stealskin', aliases=['skinsteal', 'skin']) @commands.cooldown(1, 4, commands.BucketType.user) async def skinner(self, ctx, gamertag: str): response = await self.session.get( ...
flexible
{ "blob_id": "a6f242a0443ffbad835f86098b70ede41c03515b", "index": 7652, "step-1": "<mask token>\n\n\nclass BasicMC(commands.Cog):\n <mask token>\n\n @commands.command(name='stealskin', aliases=['skinsteal', 'skin'])\n @commands.cooldown(1, 4, commands.BucketType.user)\n async def skinner(self, ctx, ga...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def process_the_source(fname, dest=None, host_ip=None, verbose=False): assert os.path.exists(fname) and os.path.isfile(fname ), 'Cannot proceed without the fname in process_the_source().' the_lines = [] with open(fname, 'r') as fIn: for line in fIn: ...
flexible
{ "blob_id": "d6af9a75fbe8bdf1a81a352cee71ac81fb373b86", "index": 9926, "step-1": "<mask token>\n\n\ndef process_the_source(fname, dest=None, host_ip=None, verbose=False):\n assert os.path.exists(fname) and os.path.isfile(fname\n ), 'Cannot proceed without the fname in process_the_source().'\n the_li...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def solve(dpArr, list, box, i): global boxes global ans if box == boxes: s = 0 for j in list: s += len(j) if s == len(dpArr): mx = 0 for j in list: ...
flexible
{ "blob_id": "883b4de18dddede97f850e3a184a0e1072bda99e", "index": 814, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef solve(dpArr, list, box, i):\n global boxes\n global ans\n if box == boxes:\n s = 0\n for j in list:\n s += len(j)\n if s == len(dpArr):\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def register_cccmacms(cmap='all'): """create my personal colormaps with discrete colors and register them. default is to register all of them. can also specify which one. (@@ input arg cmap not im...
flexible
{ "blob_id": "31a5bf0b275238e651dcb93ce80446a49a4edcf4", "index": 6561, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef register_cccmacms(cmap='all'):\n \"\"\"create my personal colormaps with discrete colors and register them.\n \n \n default is to register all of them. can also specif...
[ 0, 1, 2, 3, 4 ]
alias_macro = { "class": "Application", "method": "alias_macro", "doc": """ Returns or modifies the macro of a command alias. """, "syntax": """ Rhino.AliasMacro (strAlias [, strMacro]) """, "params": { 0: { "name": "alias", "...
normal
{ "blob_id": "1574f034ff9b6ddb785e4c54758b2057009198ed", "index": 7587, "step-1": "<mask token>\n", "step-2": "alias_macro = {'class': 'Application', 'method': 'alias_macro', 'doc':\n \"\"\"\n Returns or modifies the macro of a command alias.\n \"\"\",\n 'syntax': \"\"\"\n Rhino.AliasMacr...
[ 0, 1, 2 ]
import unittest def is_multiple(value, base): return 0 == (value % base) def fizz_buzz(value): if is_multiple(value, 5) and is_multiple(value, 3): return "FizzBuzz" if is_multiple(value, 3): return "Fizz" if is_multiple(value, 5): return "Buzz" return str(value) class F...
normal
{ "blob_id": "59d543ed443c156ac65f9c806ba5bada6bcd0c21", "index": 6891, "step-1": "<mask token>\n\n\nclass FizzBuzzTest(unittest.TestCase):\n\n def check_fizz_buzz(self, value, expected):\n result = fizz_buzz(value)\n self.assertEqual(expected, result)\n <mask token>\n\n def test_fizz_buzz_...
[ 7, 10, 11, 12, 14 ]
<|reserved_special_token_0|> class Test(unittest.TestCase): <|reserved_special_token_0|> def tearDown(self): pass def test_these_should_win_for_x(self): self.assertEqual(TicTacToe_Board.IsWinningBoard_static([['x', 'x', 'x'], ['o', 'x', 'o'], ['o', 'x', 'o']]), 'x', 'should r...
flexible
{ "blob_id": "1968923cd923e68dc5ff2148802f18e40a5e6c33", "index": 939, "step-1": "<mask token>\n\n\nclass Test(unittest.TestCase):\n <mask token>\n\n def tearDown(self):\n pass\n\n def test_these_should_win_for_x(self):\n self.assertEqual(TicTacToe_Board.IsWinningBoard_static([['x', 'x',\n ...
[ 9, 12, 13, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def bfs(start_nodes, g): dq = deque() dq.extend(start_nodes) for i, j in start_nodes: g[i][j] = -1 while dq: y, x = dq.popleft() for k in range(4): b, a = dy[k] + y, dx[k] + x ...
flexible
{ "blob_id": "0e3bf0ddd654b92b2cd962a2f3935c639eeb0695", "index": 2155, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef bfs(start_nodes, g):\n dq = deque()\n dq.extend(start_nodes)\n for i, j in start_nodes:\n g[i][j] = -1\n while dq:\n y, x = dq.popleft()\n for k i...
[ 0, 1, 2, 3, 5 ]
#Takes - Contact Name(Must be saved in phone's contact list), Message, Time as input # and sends message to the given contact at given time # Accuracy Level ~ Seconds. (Also depends on your network speed) from selenium import webdriver PATH = 'C:\Program Files (x86)\chromedriver.exe' driver = webdriver.Chrome(PATH) f...
normal
{ "blob_id": "1811c0c5aca9d209638e2221cad2c30e80ee5199", "index": 3116, "step-1": "<mask token>\n\n\ndef send_msg():\n global nameofcontact, msg\n css_path = 'span[title=\"' + nameofcontact + '\"]'\n nameofcontact = driver.find_element_by_css_selector(css_path)\n nameofcontact.click()\n chatbox = d...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class VolttronWebRPC(object): def __init__(self, url, username='admin', password='admin'): """ :param url: Jsonrpc endpoint for posting data. :param username: :param password: """ self._url = url self._username = username ...
flexible
{ "blob_id": "6fdfcbcfdf2b680a1fbdb74f77fd5d1a9f7eac0b", "index": 6105, "step-1": "<mask token>\n\n\nclass VolttronWebRPC(object):\n\n def __init__(self, url, username='admin', password='admin'):\n \"\"\"\n :param url: Jsonrpc endpoint for posting data.\n :param username:\n :param p...
[ 11, 12, 14, 15, 18 ]
""" Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example 1: Input: A = "ab", B = "ba" Output: true """ class Solution: def buddyStrings(self, A: str, B: str) -> bool: if len(A) != len(B): return False...
normal
{ "blob_id": "dd902f99ee8dc23f56641b8e75544a2d4576c19a", "index": 4437, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Solution:\n\n def buddyStrings(self, A: str, B: str) ->bool:\n if len(A) != len(B):\n r...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def job_spider(jid='1913e38066dd3c8e1Hd40t--FVE~', ka='search_list_1', i=0): job_url = 'https://www.zhipin.com/job_detail/' + jid + '.html' headers = {'cache-control': 'no-cache', 'user-agent': 'Mozilla/5.0 (Wind...
flexible
{ "blob_id": "5b894eac93bff44931df4ef8d845c23071a03227", "index": 3461, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef job_spider(jid='1913e38066dd3c8e1Hd40t--FVE~', ka='search_list_1', i=0):\n job_url = 'https://www.zhipin.com/job_detail/' + jid + '.html'\n headers = {'cache-control': 'no-c...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def swap(arr, start, end): while start < end: arr[start], arr[end] = arr[end], arr[start] start += 1 end -= 1 <|reserved_special_token_0|> <|reserved_special_token_1|> def swap(arr, start, end): while start < end: ...
flexible
{ "blob_id": "2180146da7ea745f5917ee66fd8c467437b5af4c", "index": 6761, "step-1": "<mask token>\n", "step-2": "def swap(arr, start, end):\n while start < end:\n arr[start], arr[end] = arr[end], arr[start]\n start += 1\n end -= 1\n\n\n<mask token>\n", "step-3": "def swap(arr, start, end...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- from odoo import fields, models class LunchWizard(models.TransientModel): _name = "lunch.wizard" _description = "LunchWizard" lun_type = fields.Char(string="Set New Lunch Type") lunch_id = fields.Many2one('lunch.lunch', string="Lunch Id") def action_process_lunch(self):...
normal
{ "blob_id": "85e5bf57f7eba2cbee0fbb8a4d37b5180208f9b7", "index": 3830, "step-1": "<mask token>\n\n\nclass LunchWizard(models.TransientModel):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass LunchWizard(models.TransientModel):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class DotProductTest(simtest): <|reserved_special_token_0|> <|reserved_special_token_0|> def _check(self, c, d): d = numpy.array(d) ds = d.copy() ds[d > 511] = d[d > 511] - 1024 c = numpy.array(c) cq = self._set_coeff(c) cs = cq...
flexible
{ "blob_id": "53110d6e7923cf65c514d54950a0be165582e9a0", "index": 4909, "step-1": "<mask token>\n\n\nclass DotProductTest(simtest):\n <mask token>\n <mask token>\n\n def _check(self, c, d):\n d = numpy.array(d)\n ds = d.copy()\n ds[d > 511] = d[d > 511] - 1024\n c = numpy.arra...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def treeCounter(moveRight, moveDown): row = 0 index = 0 trees = 0 finished = False while not finished: row += moveDown if len(data) > row: index = (index + moveRight) % len(data[ro...
flexible
{ "blob_id": "c22651437094723b711a959e031f1c7f928f735a", "index": 7645, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef treeCounter(moveRight, moveDown):\n row = 0\n index = 0\n trees = 0\n finished = False\n while not finished:\n row += moveDown\n if len(data) > row:\n...
[ 0, 1, 2, 3, 4 ]
import cv2 print(cv2.__version__) image = cv2.imread("download.jpeg", 1) print(image) print(image.shape) print(image[0]) print("~~~~~~~~~~~~~~~") print(image.shape[0]) print("~~~~~~~~~~~~~~~") print(len(image))
normal
{ "blob_id": "0b0ae6101fd80bdbcf37b935268f3e49230599fb", "index": 5715, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(cv2.__version__)\n<mask token>\nprint(image)\nprint(image.shape)\nprint(image[0])\nprint('~~~~~~~~~~~~~~~')\nprint(image.shape[0])\nprint('~~~~~~~~~~~~~~~')\nprint(len(image))\n", ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @log.route('/login', methods=['GET', 'POST']) def login(): print(request.path) if request.method == 'GET': return render_template('exec/login.html') else: username = request.form.get('username') ...
flexible
{ "blob_id": "763e2db4eb9ad5953273fb310c8e9714964a39e6", "index": 9576, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@log.route('/login', methods=['GET', 'POST'])\ndef login():\n print(request.path)\n if request.method == 'GET':\n return render_template('exec/login.html')\n else:\n ...
[ 0, 1, 2, 3, 4 ]
import math def math_builtins(): assert abs(-123) == 123 assert abs(-123.456) == 123.456 assert abs(2+3j) == math.sqrt(2**2 + 3**2) assert divmod(5, 2) == (2, 1) assert max(1, 2, 3, 4) == 4 assert min(1, 2, 3, 4) == 1 a = 2 b = 3 c = 7 assert pow(a, b) == a ** b assert po...
normal
{ "blob_id": "c77db71844c65eb96946ac0cc384de43ad49ca99", "index": 6007, "step-1": "<mask token>\n\n\ndef math_builtins():\n assert abs(-123) == 123\n assert abs(-123.456) == 123.456\n assert abs(2 + 3.0j) == math.sqrt(2 ** 2 + 3 ** 2)\n assert divmod(5, 2) == (2, 1)\n assert max(1, 2, 3, 4) == 4\n ...
[ 2, 3, 4, 5, 6 ]
from django.conf.urls import url from django.contrib import admin from comments.api.views import CommentListAPIView, CommentDetailAPIView urlpatterns = [ url(r'^$', CommentListAPIView.as_view(), name='list'), url(r'^(?P<pk>\d+)/$', CommentDetailAPIView, name='detail'), ]
normal
{ "blob_id": "e08820ff4fb35a3770fcb110ef7181aad1abbae5", "index": 8778, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', CommentListAPIView.as_view(), name='list'), url(\n '^(?P<pk>\\\\d+)/$', CommentDetailAPIView, name='detail')]\n", "step-3": "from django.conf.urls import url...
[ 0, 1, 2, 3 ]
no=int(input("enter no:")) rev=0 while no!=0: r=no%10 no=no//10 rev=rev*10+r print("reverse no is:",rev)
normal
{ "blob_id": "b2371f9c774c605a52ff1a4fae2dd44a856076aa", "index": 5522, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile no != 0:\n r = no % 10\n no = no // 10\n rev = rev * 10 + r\nprint('reverse no is:', rev)\n", "step-3": "no = int(input('enter no:'))\nrev = 0\nwhile no != 0:\n r = no...
[ 0, 1, 2, 3 ]
from flask import Flask, render_template, flash, request import pandas as pd from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField df = pd.read_csv('data1.csv') try: row = df[df['District'] == 'Delhi'].index[0] except: print("now city found") DEBUG = True app = Flask(__name_...
normal
{ "blob_id": "8240e6483f47abbe12e7bef02493bd147ad3fec6", "index": 6998, "step-1": "from flask import Flask, render_template, flash, request\nimport pandas as pd\nfrom wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField\n\ndf = pd.read_csv('data1.csv')\ntry:\n row = df[df['Distri...
[ 0 ]
<|reserved_special_token_0|> def get_copy_var_ops(src_scope_name: str, dest_scope_name: str) ->list: holder = [] src_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope= src_scope_name) dest_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope= dest_scope_name) ...
flexible
{ "blob_id": "9a40861239268aa62075b77b3ed452f31bb14fac", "index": 2458, "step-1": "<mask token>\n\n\ndef get_copy_var_ops(src_scope_name: str, dest_scope_name: str) ->list:\n holder = []\n src_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=\n src_scope_name)\n dest_vars = tf.get_...
[ 4, 5, 6, 7, 8 ]
<|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": "1eb5df463bbd39002c5dbc3f88459e2f26d4b465", "index": 8505, "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 = [('produksi', ...
[ 0, 1, 2, 3, 4 ]
AuthorPath = 'data/Author.csv' PaperPath = 'buff/Paper.TitleCut.csv' PaperAuthorPath = 'data/PaperAuthor.csv' AffilListPath = 'buff/AffilList2.csv' StopwordPath = 'InternalData/en.lst'
normal
{ "blob_id": "690e7cc9047b3a445bf330524df52e2b359f1f13", "index": 958, "step-1": "<mask token>\n", "step-2": "AuthorPath = 'data/Author.csv'\nPaperPath = 'buff/Paper.TitleCut.csv'\nPaperAuthorPath = 'data/PaperAuthor.csv'\nAffilListPath = 'buff/AffilList2.csv'\nStopwordPath = 'InternalData/en.lst'\n", "step-3...
[ 0, 1 ]
from rest_framework.urlpatterns import format_suffix_patterns from django.urls import path from external_api import views urlpatterns = [path('darksky/', views.DarkSkyView.as_view())] urlpatterns = format_suffix_patterns(urlpatterns)
normal
{ "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 ]
<|reserved_special_token_0|> def getLectures(name, url): urlprefix = 'http://www.ocw.titech.ac.jp' response = requests.get(url) soup = BeautifulSoup(response.content, 'lxml') table = soup.find('table', class_='ranking-list').tbody for item in table.find_all('tr'): code = item.find('td', cl...
flexible
{ "blob_id": "24274dddbeb1be743cfcac331ee688d48c9a46dd", "index": 8647, "step-1": "<mask token>\n\n\ndef getLectures(name, url):\n urlprefix = 'http://www.ocw.titech.ac.jp'\n response = requests.get(url)\n soup = BeautifulSoup(response.content, 'lxml')\n table = soup.find('table', class_='ranking-list...
[ 1, 2, 3, 4, 5 ]
# We will try to implement add noise to audio file and filter it using Mean and Median Filters. import numpy as np import scipy import matplotlib.pyplot as plt from scipy.io.wavfile import read from scipy.io.wavfile import write rate,audio_original = read('Audio_Original.wav') audio = audio_original[:,0] write("Audi...
normal
{ "blob_id": "844b8e2d4f05a51282b356c995f2733d6935a5d6", "index": 5552, "step-1": "<mask token>\n\n\ndef Plot_Audio(audio):\n s = audio.shape[0]\n time = np.arange(s)\n plt.plot(time, audio)\n plt.show()\n\n\ndef Add_Noise(audio, mu=0, sigma=1):\n \"\"\"\n\tAdding Gaussian Noise\n\t\"\"\"\n gaus...
[ 4, 5, 6, 7, 8 ]
import numpy as np class nearest(svm): name="MLLKM2" def __init__(self): svm.__init__(self) def fit(self,x,y): self.x=x self.y=y def predict(self,x): diff=np.subtract(x,self.x) distance=np.linalg.norm(diff,axis=1) dmin= np.argmin( distance ) ...
normal
{ "blob_id": "7d1ca15129b1bf6b713e1d5eda4436d4a8539ad1", "index": 5939, "step-1": "<mask token>\n\n\nclass nearest(svm):\n <mask token>\n\n def __init__(self):\n svm.__init__(self)\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass nearest(svm):\n <mask token>\n\n def ...
[ 2, 3, 5, 6, 7 ]
import argparse # for handling command line arguments import collections # for container types like OrderedDict import configparser import hashlib # for SHA-1 import os import re import sys import zlib # git compresses everything using zlib argparser = argparse.ArgumentParser(description="The stupid content tracker") ...
normal
{ "blob_id": "1c8145007edb09d77a3b15de5c34d0bc86c0ba97", "index": 8343, "step-1": "import argparse # for handling command line arguments\nimport collections # for container types like OrderedDict\nimport configparser\nimport hashlib # for SHA-1\nimport os\nimport re\nimport sys\nimport zlib # git compresses every...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ScooterHutAUSpider(StockInStoreSpider): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_sp...
flexible
{ "blob_id": "e37f4422c1063df50453f7abf72a0a9a31156d8b", "index": 899, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ScooterHutAUSpider(StockInStoreSpider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ReplaceCornersAtCertainAngles(object): def __init__(self): windowWidth = 250 windowHeight = 140 windowWidthResize = 100 windowHeightResize = 0 self.w = vanilla.FloatingWindow((windowWidth, windowHeight), 'Replace Corners At Ce...
flexible
{ "blob_id": "540ae4be6a41d52d9c803f829fc8b13b523b31bc", "index": 116, "step-1": "<mask token>\n\n\nclass ReplaceCornersAtCertainAngles(object):\n\n def __init__(self):\n windowWidth = 250\n windowHeight = 140\n windowWidthResize = 100\n windowHeightResize = 0\n self.w = vani...
[ 8, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while True: if c0 % 2 == 0: c0 //= 2 if c0 != 1: step += 1 print(' New value is ', c0, ':', 'step', step) continue elif c0 == 1: step += 1 pri...
flexible
{ "blob_id": "e7db3390d30f86e19eee930c48e5f848f41cc579", "index": 645, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile True:\n if c0 % 2 == 0:\n c0 //= 2\n if c0 != 1:\n step += 1\n print(' New value is ', c0, ':', 'step', step)\n continue\n el...
[ 0, 1, 2, 3 ]
import datetime import discord def getTeams(reign, uprising, hunters, fuel, mayhem, gladiators, charge, outlaws, spark, spitfire, excelsior, eternal, fusion, dynasty, shock, dragons, defiant, valiant, titans, justice) : teamList = discord.Embed( title="Overwatch League Teams", description="2021 Sea...
normal
{ "blob_id": "9a02e09cbfe2c9b6ebb9d20ba6cea639871f0838", "index": 7647, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getTeams(reign, uprising, hunters, fuel, mayhem, gladiators, charge,\n outlaws, spark, spitfire, excelsior, eternal, fusion, dynasty, shock,\n dragons, defiant, valiant, tit...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> featureProvider.add(shapeFeatureProvider) featureProvider.add(statisticsFeatureProvider) <|reserved_special_token_0|> featureExtractor.extractFeatures(nodeFeatures, edgeFeatures, featureProvider) <|reserved_special_token_1|> <|...
flexible
{ "blob_id": "37d817436ce977339594867ef917177e7371a212", "index": 6847, "step-1": "<mask token>\n", "step-2": "<mask token>\nfeatureProvider.add(shapeFeatureProvider)\nfeatureProvider.add(statisticsFeatureProvider)\n<mask token>\nfeatureExtractor.extractFeatures(nodeFeatures, edgeFeatures, featureProvider)\n", ...
[ 0, 1, 2, 3, 4 ]
import sys import os import unittest from wireless.trex_wireless_manager import APMode from wireless.trex_wireless_manager_private import * class APInfoTest(unittest.TestCase): """Tests methods for the APInfo class.""" def test_init_correct(self): """Test the __init__ method when parameters are corr...
normal
{ "blob_id": "ae5dfa7fa6a0d7349d6ae29aeac819903facb48f", "index": 3518, "step-1": "<mask token>\n\n\nclass APInfoTest(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def test_init_no_ip(self):\n \"\"\"Test the __init__ method when parameter 'ip' is None.\n Since the ...
[ 10, 11, 13, 14, 16 ]
<|reserved_special_token_0|> class MouseButton: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MouseButton: Left = 0 Right = 1 Middle = 2 <|reserved_special_token_1|> class ClickActi...
flexible
{ "blob_id": "cabebeb5ca02da2505df4a138e8b28f74dd108fa", "index": 4362, "step-1": "<mask token>\n\n\nclass MouseButton:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MouseButton:\n Left = 0\n Right = 1\n Middle = 2\n", "step-3": "class ClickAction:\n ...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> cassandra = {'nodes': ['localhost'], 'keyspace': 'coffee'}
flexible
{ "blob_id": "0738fc48bc367f1df75567ab97ce20d3e747dc18", "index": 8897, "step-1": "<mask token>\n", "step-2": "cassandra = {'nodes': ['localhost'], 'keyspace': 'coffee'}\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from bs4 import BeautifulSoup import requests import pymongo client = pymongo.MongoClient('localhost', 27017) ku = client['ku'] url_list1 = ku['url_list_index'] start_url="http://news.ccsu.cn/index.htm" url_host="http://news.ccsu.cn/" def get_channel_urls(url): wb_data = requests.get(url) wb_data.encoding = 'ut...
normal
{ "blob_id": "4791b210f328dff5d48ff5afc381a98a5a1a2b7b", "index": 1969, "step-1": "<mask token>\n\n\ndef get_channel_urls(url):\n wb_data = requests.get(url)\n wb_data.encoding = 'utf-8'\n soup = BeautifulSoup(wb_data.text, 'lxml')\n links = soup.select('body > div.navWrap.clearfix > div > ul > li > a...
[ 1, 2, 3, 4, 5 ]
# -*- coding: utf-8 -*- import requests import json url = "http://39.108.188.34:9090/spider/zhongdengdengji.go" # url = "http://localhost:9090/spider/zhongdengdengji.go" input = { "timelimit": "1年", "title": "GD20190305001", "maincontractno": "YT20181228001", "maincontractcurrency": "人民币", "mainc...
normal
{ "blob_id": "ad024a2001dc6a6fa3a2a9c1b51f79132e914897", "index": 7592, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(response.text)\n", "step-3": "<mask token>\nurl = 'http://39.108.188.34:9090/spider/zhongdengdengji.go'\ninput = {'timelimit': '1年', 'title': 'GD20190305001', 'maincontractno':\n ...
[ 0, 1, 2, 3, 4 ]
import json import requests import random import boto3 from email.parser import BytesParser, Parser from email.policy import default ################################## endpoint = 'https://5295t8jcs0.execute-api.us-east-1.amazonaws.com/Prod' ################################## def get_msg_body(msg): type = msg.get_...
normal
{ "blob_id": "cc99811321083147540a00e8029b792c8afc2ada", "index": 3233, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_msg_body(msg):\n type = msg.get_content_maintype()\n if type == 'multipart':\n for part in msg.get_payload():\n if part.get_content_maintype() == 'text...
[ 0, 2, 3, 4, 5 ]
# -*- coding: cp1251 -*- import arcpy as a from arcpy import AddMessage as msg, AddWarning as warning, AddError as error from os import mkdir, walk from os.path import join, dirname, basename, splitext from glob import glob as get_files from shutil import copy from collections import OrderedDict input_folder = a.GetP...
normal
{ "blob_id": "409e0fc0b1c1d86c5526d33ba271a8387eecf748", "index": 9872, "step-1": "<mask token>\n", "step-2": "<mask token>\nmsg(\"\"\"\nПроверка на наличие подпапок исходной папки в выходной:\"\"\")\nfor folder in input_folders:\n if folder in output_folders:\n warning(' ' + folder)\n else:\n ...
[ 0, 1, 2, 3, 4 ]
# -*- coding:utf-8 -*- import re # 普通字符串 匹配本身 re_str = r'abc' result = re.fullmatch(re_str, 'abc') print(result) # 匹配任意字符 一个.只能匹配一个字符 re_str = r'a.c' result = re.fullmatch(re_str, 'abc') print(result) # \w匹配字母数字或下划线 # 匹配一个长度是5的字符串并且字符串的前两位是数字字母或者下划线后面是三个任意字符串 \w中文也能匹配 re_str = r'\w\w...' result = re.fullmatch(re_str, ...
normal
{ "blob_id": "e0e00688a75021c2f8b608d4c942f5e68f6a6a48", "index": 6282, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)\n<mask token>\nprint(result)...
[ 0, 1, 2, 3, 4 ]
import input_data import tensorflow as tf from infogan import InfoGAN if __name__ == '__main__': # get input data mnist_data = input_data.load_mnist_dataset('../../dataset/mnist_data', one_hot=True) num_sample = mnist_data.train.num_examples dataset = 'mnist' if dataset == 'mnist': input_di...
normal
{ "blob_id": "02a28b61ad9d664c89829df019f4887c2c869f91", "index": 6046, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n mnist_data = input_data.load_mnist_dataset('../../dataset/mnist_data',\n one_hot=True)\n num_sample = mnist_data.train.num_examples\n dataset ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def crawl_bitcoin_price(): print('start crawling!') bitcoin_prices = get_web_content(COIN_MARKET_CAP_URL) bitcoin_prices = filter_invalid_records(bitcoin_prices) if crawl_enabled: Timer(BITCOIN_CRAWLING_PERIOD_SEC, crawl_bitcoin_price).start() else: pri...
flexible
{ "blob_id": "ebbc6f9115e6b4ca7d1050a59cf175d123b6f3aa", "index": 4871, "step-1": "<mask token>\n\n\ndef crawl_bitcoin_price():\n print('start crawling!')\n bitcoin_prices = get_web_content(COIN_MARKET_CAP_URL)\n bitcoin_prices = filter_invalid_records(bitcoin_prices)\n if crawl_enabled:\n Time...
[ 3, 4, 5, 6, 8 ]
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'PhoneUser.last_contacted' db.add_column(u'smslink_phoneuser', 'last_contacted', ...
normal
{ "blob_id": "2c1de638ac25a9f27b1af94fa075b7c1b9df6884", "index": 993, "step-1": "<mask token>\n\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n db.add_column(u'smslink_phoneuser', 'last_contacted', self.gf(\n 'django.db.models.fields.DateTimeField')(null=True, blank=True)...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.fixture(scope='session') def me(api): return api.people.me() <|reserved_special_token_1|> <|reserved_special_token_0|> import pytest import ciscosparkapi from tests.utils import create_string @pytest.fixture(sco...
flexible
{ "blob_id": "9b7ffa2bb62a8decbec51c6bdea38b4338726816", "index": 1891, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.fixture(scope='session')\ndef me(api):\n return api.people.me()\n", "step-3": "<mask token>\nimport pytest\nimport ciscosparkapi\nfrom tests.utils import create_string\n\...
[ 0, 1, 2, 3 ]
import json import nltk with open('posts.json', 'r') as infile: posts = [] for line in infile: posts.append(json.loads(line[0:len(line)-2])) for post in posts: print '\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n' print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
normal
{ "blob_id": "2f15814d97708e33585ea6b45e89b5a5e69d82fe", "index": 5694, "step-1": "import json\nimport nltk\n\nwith open('posts.json', 'r') as infile:\n\tposts = []\n\tfor line in infile:\n\t\tposts.append(json.loads(line[0:len(line)-2]))\n\nfor post in posts:\n print '\\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
[ 0 ]
import pandas as pd import numpy as np #from ctaFunction import std_normalized def barStdNormal(bars, timeperiod=5): '''Std Normal ''' close = bars['close'] result = close.rolling(timeperiod).apply(std_normalized) return result
normal
{ "blob_id": "6fa0e1dabd178507c32c62146b404bb42f8445d4", "index": 9860, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef barStdNormal(bars, timeperiod=5):\n \"\"\"Std Normal \"\"\"\n close = bars['close']\n result = close.rolling(timeperiod).apply(std_normalized)\n return result\n", "s...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> for _ in range(int(input())): n = int(input()) s = input() cur = 0 for i in s[::-1]: if i == ')': cur += 1 else: break print('Yes') if cur > n // 2 else print('No') <|reserved_special_token_1|> fo...
flexible
{ "blob_id": "31b420adebbe0d3ee6da2ed8236ece1526bdb063", "index": 6290, "step-1": "<mask token>\n", "step-2": "for _ in range(int(input())):\n n = int(input())\n s = input()\n cur = 0\n for i in s[::-1]:\n if i == ')':\n cur += 1\n else:\n break\n print('Yes') ...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('', ('^admin/', include('django.contrib.admin.urls') ), ('^polls/', include('goimcommunity.polls.urls')), ('^league/', include('goimcommunity.leaguesystem.urls')), ('^board/', include( 'sphene.sp...
flexible
{ "blob_id": "f44ff7488ae8fc64bc1785fb6cbe80c4cc011fbe", "index": 6808, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', ('^admin/', include('django.contrib.admin.urls')\n ), ('^polls/', include('goimcommunity.polls.urls')), ('^league/',\n include('goimcommunity.leaguesystem...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Keychains(DeviceFeature): <|reserved_special_token_0|> class DeviceAttributes(genie.conf.base.attributes.DeviceSubAttributes): class KeyChainAttributes(KeyedSubAttributes): def __init__(self, parent, key): self.key_chain = key ...
flexible
{ "blob_id": "6d2581b83a2839dcbc644ca572b05b158d80b58d", "index": 2479, "step-1": "<mask token>\n\n\nclass Keychains(DeviceFeature):\n <mask token>\n\n\n class DeviceAttributes(genie.conf.base.attributes.DeviceSubAttributes):\n\n\n class KeyChainAttributes(KeyedSubAttributes):\n\n def __in...
[ 4, 6, 7, 8, 9 ]
from django.urls import path from . import views urlpatterns = [ # @app.route("/") path('', views.home), path("teams", views.showTeams), path("teams/new", views.new), path("teams/<teamname>", views.showSpecificTeam), # path("allfood", views.showAllFoodItems), # path("team/<teamname>",...
normal
{ "blob_id": "e267108177841110493061a4f84ae3d29850d028", "index": 1853, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.home), path('teams', views.showTeams), path(\n 'teams/new', views.new), path('teams/<teamname>', views.showSpecificTeam)]\n", "step-3": "from django.url...
[ 0, 1, 2, 3 ]
import itertools def permutations(string): return list("".join(p) for p in set(itertools.permutations(string)))
normal
{ "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 ]
#Exercise 5 #Define with names stair1, stair2, and stair3 (from bottom up to top), and insert within the building model, the 3 stair models of the building.
normal
{ "blob_id": "4c42bad4197b51be0e9d18307c7b954a29281fe1", "index": 3259, "step-1": "#Exercise 5\n#Define with names stair1, stair2, and stair3 (from bottom up to top), and insert within the building model, the 3 stair models of the building.", "step-2": null, "step-3": null, "step-4": null, "step-5": null,...
[ 1 ]
<|reserved_special_token_0|> def test_keywordbid_rule_init(kwb_rule, account): assert kwb_rule.get_max_bid_display() == kwb_rule.max_bid * 1000000 assert kwb_rule.get_bid_increase_percentage_display( ) == kwb_rule.bid_increase_percentage / 100 assert kwb_rule.get_target_bid_diff_display( )...
flexible
{ "blob_id": "e0435b0b34fc011e7330ab8882865131f7f78882", "index": 922, "step-1": "<mask token>\n\n\ndef test_keywordbid_rule_init(kwb_rule, account):\n assert kwb_rule.get_max_bid_display() == kwb_rule.max_bid * 1000000\n assert kwb_rule.get_bid_increase_percentage_display(\n ) == kwb_rule.bid_increa...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(dataset.info()) <|reserved_special_token_0|> regressor.fit(features, labels) <|reserved_special_token_0|> regressor.predict(x) <|reserved_special_token_1|> <|reserved_special_token_0|> dataset = pd.read_csv('University_da...
flexible
{ "blob_id": "94e8f0532da76c803b23fe2217b07dc8cf285710", "index": 950, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dataset.info())\n<mask token>\nregressor.fit(features, labels)\n<mask token>\nregressor.predict(x)\n", "step-3": "<mask token>\ndataset = pd.read_csv('University_data.csv')\nprint(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def extractPatternOccurrence(songName, inStart, inEnd, useTies, songs): """ given song name, occurrence start, occurrence end, and the database of score files, return the notes of the associated pattern occurrence useTies is a boolean determining whether or not tied notes ...
flexible
{ "blob_id": "eb9135c6bcf89a62534cfc8480e5d44a089fe5a8", "index": 1216, "step-1": "<mask token>\n\n\ndef extractPatternOccurrence(songName, inStart, inEnd, useTies, songs):\n \"\"\"\n given song name, occurrence start, occurrence end, and the database of score files,\n return the notes of the associated ...
[ 3, 8, 9, 10, 11 ]
from pandas_datareader import data as pdr from datetime import date class YahooHelper: """ Class to fetch Yahoo data """ def __init__(self): """ Default constructor which initiates object """ pass def get_data(self, symbol): """ Function to collect...
normal
{ "blob_id": "b4b4dad5cf630dc1a627e323ea63577583d1e1c3", "index": 1551, "step-1": "<mask token>\n\n\nclass YahooHelper:\n <mask token>\n\n def __init__(self):\n \"\"\"\n Default constructor which initiates object\n \"\"\"\n pass\n <mask token>\n\n def get_stock_data(symbol)...
[ 4, 5, 6, 7, 8 ]
import os import multiprocessing import time import psycopg2 #os.system("myproject1\\runscrapy2.py") #from scrapy import cmdline #os.system("scrapy crawl parts") #cmdline.execute("cd myproject1".split()) #cmdline.execute("myproject1\\runscrapy.bat".split()) # start = time.perf_counter() connection = psycopg2.conne...
normal
{ "blob_id": "8e0d729fa55aabede123d89a507296b7d8a45c8b", "index": 1705, "step-1": "<mask token>\n\n\ndef urls():\n os.system('urls.bat')\n\n\ndef urls_1():\n os.system('urls_1.bat')\n\n\n<mask token>\n\n\ndef urls_3():\n os.system('urls_3.bat')\n\n\ndef urls_4():\n os.system('urls_4.bat')\n\n\ndef url...
[ 39, 53, 59, 67, 75 ]
from django.shortcuts import render from django.views.generic import ListView, DetailView from django.views.generic.edit import CreateView, UpdateView from django.urls import reverse_lazy from django.utils import timezone from time import time import json from .models import Attendance, Disciple from users.models imp...
normal
{ "blob_id": "38c78a51a50ee9844aec8b8cdcdd42b858748518", "index": 2552, "step-1": "<mask token>\n\n\nclass AttendanceDetailView(DetailView):\n <mask token>\n <mask token>\n\n\n<mask token>\n\n\nclass AttendanceCreateView(CreateView):\n model = Attendance\n template_name = 'attendance_new.html'\n fi...
[ 5, 8, 9, 10, 11 ]
<|reserved_special_token_0|> class Encoder(object): def __init__(self, pin_x='P4', pin_y='P5', pin_mode=Pin.PULL_UP, scale= 1, min=0, max=100, reverse=False): self.pin_x = pin_x if isinstance(pin_x, Pin) else Pin(pin_x, mode= Pin.IN, pull=pin_mode) self.pin_y = pin_y if isinst...
flexible
{ "blob_id": "1406b2ab78b52823a8f455c8e2719f6bd84bd168", "index": 822, "step-1": "<mask token>\n\n\nclass Encoder(object):\n\n def __init__(self, pin_x='P4', pin_y='P5', pin_mode=Pin.PULL_UP, scale=\n 1, min=0, max=100, reverse=False):\n self.pin_x = pin_x if isinstance(pin_x, Pin) else Pin(pin_x...
[ 7, 9, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(now.year, now.month, now.day, now.hour, now.minute, now.second) <|reserved_special_token_1|> <|reserved_special_token_0|> now = datetime.datetime.now() print(now.year, now.month, now.day, now.hour, now.minute, now.second)...
flexible
{ "blob_id": "3af91de0b25f575ec9d981d7711c710a7e9695e4", "index": 6819, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(now.year, now.month, now.day, now.hour, now.minute, now.second)\n", "step-3": "<mask token>\nnow = datetime.datetime.now()\nprint(now.year, now.month, now.day, now.hour, now.minut...
[ 0, 1, 2, 3 ]
import nltk import A from collections import defaultdict from nltk.align import Alignment, AlignedSent class BerkeleyAligner(): def __init__(self, align_sents, num_iter): self.t, self.q = self.train(align_sents, num_iter) # TODO: Computes the alignments for align_sent, using this model's parameters. Return...
normal
{ "blob_id": "bf40b516e202af14469cd4012597ba412e663f56", "index": 5898, "step-1": "import nltk\nimport A\nfrom collections import defaultdict\nfrom nltk.align import Alignment, AlignedSent\n\nclass BerkeleyAligner():\n\n def __init__(self, align_sents, num_iter):\n\tself.t, self.q = self.train(align_sents, num...
[ 0 ]
<|reserved_special_token_0|> @clockit def analyze_cover(benchmarks, result_dir, calc_f1, append): if not append: print_headers(result_dir) for benchmark in benchmarks: count_benchmark_cover(result_dir, calc_f1, benchmark) <|reserved_special_token_0|> def f1_score(community, ground_truth): ...
flexible
{ "blob_id": "dc5b9600828857cc5ea434a7b010cd8aa2589d22", "index": 6568, "step-1": "<mask token>\n\n\n@clockit\ndef analyze_cover(benchmarks, result_dir, calc_f1, append):\n if not append:\n print_headers(result_dir)\n for benchmark in benchmarks:\n count_benchmark_cover(result_dir, calc_f1, be...
[ 2, 3, 5, 6, 7 ]
import tensorflow as tf import numpy as np import time import os from sklearn.metrics import roc_curve import matplotlib.pyplot as plt from src.model import get_args from src.funcs import linear from src.youtubeface import load_ytf_data from src.lfw import load_lfw_data from src.facescrub import load_fs_data from src...
normal
{ "blob_id": "459dd9302f7100ad02119cc94b735b19287f21e5", "index": 5956, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n os.environ['CUDA_VISIBLE_DEVICES'] = '0'\n total_iteration = 300000\n m = 512\n q = 32\n lam = 0.01\n beta = 1.0\n margin = 0.5\n s = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class LogisticRegression: <|reserved_special_token_0|> def __init__(self, max_iter=2000, learning_rate=0.01): self.max_iter = max_iter self.learning_rate = learning_rate print('LogisticRegression Model(learning_rate={}, max_iteration={})' .form...
flexible
{ "blob_id": "1dd62264aafe8ee745a3cfdfb994ac6a40c1af42", "index": 1848, "step-1": "<mask token>\n\n\nclass LogisticRegression:\n <mask token>\n\n def __init__(self, max_iter=2000, learning_rate=0.01):\n self.max_iter = max_iter\n self.learning_rate = learning_rate\n print('LogisticRegre...
[ 7, 11, 13, 14, 15 ]
from Stack import Stack from Regex import Regex from Symbol import Symbol class Postfix: def __init__(self, regex): self.__regex = regex.expression self.__modr = Postfix.modRegex(self.__regex) self.__pila = Stack() self.__postfix = self.convertInfixToPostfix() def getRegex(...
normal
{ "blob_id": "acc39044fa1ae444dd4a737ea37a0baa60a2c7bd", "index": 4040, "step-1": "<mask token>\n\n\nclass Postfix:\n\n def __init__(self, regex):\n self.__regex = regex.expression\n self.__modr = Postfix.modRegex(self.__regex)\n self.__pila = Stack()\n self.__postfix = self.convert...
[ 4, 5, 7, 9, 11 ]
''' Created on 14 november 2015 @author: federico ''' import paho.mqtt.client as mosquitto import json import urllib,urllib2 import datetime import threading import time from pygame import mixer from datetime import timedelta #ALARM SOUND PATH alarm_path="/home/pi/SmartBed/Smart_Bed/src/Rooster.wav" #DWEET&FREEBOA...
normal
{ "blob_id": "05bd95966d72dd40b9b828932b0bf70e40ddb573", "index": 1511, "step-1": "'''\nCreated on 14 november 2015\n\n@author: federico\n'''\n\nimport paho.mqtt.client as mosquitto\nimport json\nimport urllib,urllib2\nimport datetime\nimport threading\nimport time\nfrom pygame import mixer\nfrom datetime import ...
[ 0 ]
flags =[] sourcefiles:str = [] headerfiles:str = [] mainfile:str = "" outfilename = "a.out" assemblyfilename = "a.asm" includedfilenames = [] class Variables: size:bytes name:str class cstruct: structname:string def claprocessor(): print(sys.argv) i=0 for stri in sys.argv: if stri....
normal
{ "blob_id": "24187284ff3e03cf79b8545415005c71f9355ddc", "index": 9062, "step-1": "<mask token>\n\n\nclass Variables:\n size: bytes\n name: str\n\n\nclass cstruct:\n structname: string\n\n\n<mask token>\n\n\ndef cpreprosscssor():\n maintokens = lexer(mainfile)\n return\n\n\ndef cprocessor():\n r...
[ 4, 5, 6, 7, 8 ]
from django.conf import settings from .base import * import os DEBUG = True SECRET_KEY = os.environ['SECRET_KEY'] ROOT_URLCONF = 'floweryroad.urls.docker_production' ALLOWED_HOSTS = [os.environ['WEB_HOST']] CORS_ORIGIN_WHITELIST = [os.environ['CORS']] DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql_ps...
normal
{ "blob_id": "ab35684166f07a3ab9e64f2ff98980e25a3fc576", "index": 1643, "step-1": "<mask token>\n", "step-2": "<mask token>\nDEBUG = True\nSECRET_KEY = os.environ['SECRET_KEY']\nROOT_URLCONF = 'floweryroad.urls.docker_production'\nALLOWED_HOSTS = [os.environ['WEB_HOST']]\nCORS_ORIGIN_WHITELIST = [os.environ['CO...
[ 0, 1, 2 ]
import numpy as np raw = np.load("raw_with_freq.npy").item() for i in list(raw.keys()): if len(i) > 8: del(raw[i]) print(raw) print(len(list(raw.keys()))) np.save("shorten_raw_with_freq.npy", raw)
normal
{ "blob_id": "ffb17b370c892696b341f6d37a2cfe106a5670a5", "index": 4265, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in list(raw.keys()):\n if len(i) > 8:\n del raw[i]\nprint(raw)\nprint(len(list(raw.keys())))\nnp.save('shorten_raw_with_freq.npy', raw)\n", "step-3": "<mask token>\nraw ...
[ 0, 1, 2, 3, 4 ]
g7 = int(input()) h7 = g7 / 2 i = g7 - 1 print(int(h7 * i))
normal
{ "blob_id": "abb08956f55fd1e8af27ce12fa94a4137d7d908e", "index": 7251, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(int(h7 * i))\n", "step-3": "g7 = int(input())\nh7 = g7 / 2\ni = g7 - 1\nprint(int(h7 * i))\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import functools import re import nltk.data from nltk.corpus import stopwords from nltk.probability import FreqDist from nltk.tokenize import RegexpTokenizer def clean(string): string = re.sub(r"\'s", " \'s", string) string = re.sub(r"\'ve", " \'ve", string) string = re.sub(r"n\'t", " n\'t", string) s...
normal
{ "blob_id": "837e84d4a58d8fd0d0ffc24973d196ae57f9a260", "index": 1723, "step-1": "<mask token>\n\n\ndef reorder_sentences(output_sentences, input):\n\n def custom_sort(s1, s2):\n return input.find(s1) - input.find(s2)\n output_sentences.sort(key=functools.cmp_to_key(custom_sort))\n return output_...
[ 1, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class Documents(Base): __tablename__ = 'documents' id = Column(Integer, primary_key=True, index=True) name_doc = Column(String, index=True) exp = Column(DATE, index=True) notif = Column(Integer) descrip = Column(String, index=True) owner_username = Column(Strin...
flexible
{ "blob_id": "acf69cd714f04aeceb4be39b8a7b2bc5d77cd69f", "index": 3307, "step-1": "<mask token>\n\n\nclass Documents(Base):\n __tablename__ = 'documents'\n id = Column(Integer, primary_key=True, index=True)\n name_doc = Column(String, index=True)\n exp = Column(DATE, index=True)\n notif = Column(In...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> api_key = '078c8443640961d5ce547c8269db5fd7' <|reserved_special_token_1|> # OpenWeatherMap API Key api_key = "078c8443640961d5ce547c8269db5fd7"
flexible
{ "blob_id": "4eb3d94a5fd22fc29000ec32475de9cbae1c183a", "index": 5255, "step-1": "<mask token>\n", "step-2": "api_key = '078c8443640961d5ce547c8269db5fd7'\n", "step-3": "# OpenWeatherMap API Key\napi_key = \"078c8443640961d5ce547c8269db5fd7\"\n", "step-4": null, "step-5": null, "step-ids": [ 0, ...
[ 0, 1, 2 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import airflow from airflow import DAG from airflow.operators.python_operator import PythonOperator from airflow.operators import BashOperator, DummyOperator from datetime import datetime, timedelta # -----------------------------------------------------...
normal
{ "blob_id": "49492ad1a1734be02ebefb77095fd560a7a7efd8", "index": 7155, "step-1": "<mask token>\n", "step-2": "<mask token>\ndefault_args = {'owner': 'Jaimin', 'depends_on_past': False, 'start_date':\n datetime.now(), 'email': ['airflow@airflow.com'], 'email_on_failure': \n False, 'email_on_retry': False,...
[ 0, 1, 2, 3 ]
# coding=utf8 from __future__ import unicode_literals, absolute_import, division, print_function """This is a method to read files, online and local, and cache them""" import os from .Read import read as botread from .Database import db as botdb class BotNotes(): def __init__(self): self.notes = botdb....
normal
{ "blob_id": "2a062f0c2836850320cdd39eee6a354032ba5c33", "index": 4565, "step-1": "<mask token>\n\n\nclass BotNotes:\n\n def __init__(self):\n self.notes = botdb.get_plugin_value('SpiceBot_Release_Notes', 'notes'\n ) or dict()\n self.dir_to_scan = botread.get_config_dirs('SpiceBot_Rele...
[ 3, 4, 5, 6, 7 ]
import sys import re import math s=sys.stdin.read() digits=re.findall(r"-?\d+",s) listline= [int(e) for e in digits ] x=listline[-1] del(listline[-1]) n=len(listline)//2 customers=listline[:n] grumpy=listline[n:] maxcus=0 if x==n: print(sum(customers)) else: for i in range(n-x): total=0 for j in...
normal
{ "blob_id": "24bc43c1fe035430afde05fec1330e27fb5f1d86", "index": 8809, "step-1": "<mask token>\n", "step-2": "<mask token>\ndel listline[-1]\n<mask token>\nif x == n:\n print(sum(customers))\nelse:\n for i in range(n - x):\n total = 0\n for j in range(i, i + x):\n total += custom...
[ 0, 1, 2, 3, 4 ]
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload fr...
normal
{ "blob_id": "aa79d5cbe656979bf9c228f6a576f2bbf7e405ca", "index": 2950, "step-1": "<mask token>\n\n\n@pulumi.input_type\nclass _UserGpgKeyState:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\ncl...
[ 11, 19, 22, 26, 29 ]
from django.shortcuts import render, HttpResponseRedirect, HttpResponse from django.views.generic import View from django.contrib.auth import login from django.contrib.auth.models import User class RegisterView(View): def get(self, request): return render(request, 'users/register.html', locals()) def...
normal
{ "blob_id": "c9191df0fc04818b4df9c93a9479f75a60688aa9", "index": 6372, "step-1": "<mask token>\n\n\nclass RegisterView(View):\n <mask token>\n <mask token>\n\n\nclass HomeView(View):\n\n def get(self, request):\n return HttpResponse(f'Home Page | Logged in as - {request.user}')\n", "step-2": "<...
[ 3, 4, 5, 6, 7 ]
# 4 Pillars of OOP: # 1. Encapsulation: Encapsulation in Python is the process of wrapping up variables and methods into a single entity.In programming, a class is an example that wraps all the variables and methods defined inside it. # 2. Abstraction: Abstraction in Python is the process of hiding the real implementat...
normal
{ "blob_id": "0e4c82d6eb77d2b6357925c9aab516bcc3310a4c", "index": 140, "step-1": "<mask token>\n\n\nclass House2:\n <mask token>\n <mask token>\n\n\nclass Vehicle(ABC):\n\n def __init__(self, speed, year):\n self.speed = speed\n self.year = year\n\n def start(self):\n print('Start...
[ 9, 12, 13, 14, 17 ]
import os from registration import Registration from login import Login def login(): """ redirect to login page""" login_page = Login() login_page.login_main_page() def registration(): """Register the new user""" registration_page = Registration() registration_page.registration_main_page() ...
normal
{ "blob_id": "8ebc11f4b9e28254ef40175b26744f2a5ab0c831", "index": 2930, "step-1": "import os\n\nfrom registration import Registration\nfrom login import Login\n\n\ndef login():\n \"\"\" redirect to login page\"\"\"\n login_page = Login()\n login_page.login_main_page()\n\n\ndef registration():\n \"\"\"...
[ 0 ]
<|reserved_special_token_0|> @app.route('/probability', methods=['POST']) def make_probability(): try: data = request.get_json() except Exception as e: raise e if data == {}: return bad_request() else: try: lang = data['lang'] except: try...
flexible
{ "blob_id": "b51e0ee80a2488197470627821204d1f74cd62a1", "index": 5437, "step-1": "<mask token>\n\n\n@app.route('/probability', methods=['POST'])\ndef make_probability():\n try:\n data = request.get_json()\n except Exception as e:\n raise e\n if data == {}:\n return bad_request()\n ...
[ 7, 8, 10, 11, 12 ]
<|reserved_special_token_0|> def calculadora(calcu): if calcu == '1': os.system('clear') s1 = int(input('Ingrese un numero\n')) s2 = int(input('Ingrese otro\n')) os.system('clear') print(f'{s1} + {s2} = {s1 + s2}') input('\nPresione una tecla para continuar.') e...
flexible
{ "blob_id": "ac033e45ea61770c302be677f4dfc95945e2cca5", "index": 6100, "step-1": "<mask token>\n\n\ndef calculadora(calcu):\n if calcu == '1':\n os.system('clear')\n s1 = int(input('Ingrese un numero\\n'))\n s2 = int(input('Ingrese otro\\n'))\n os.system('clear')\n print(f'{...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def rearrange_digits(input_list): if len(input_list) == 0: return [] merge_sort(input_list) first_number = '' second_number = '' for i in range(0, len(input_list)): if i % 2 == 0: first_number += str(input_list[i]) else: ...
flexible
{ "blob_id": "264b48c2b9ce4ec948ca5ba548e708848760f3dc", "index": 8271, "step-1": "<mask token>\n\n\ndef rearrange_digits(input_list):\n if len(input_list) == 0:\n return []\n merge_sort(input_list)\n first_number = ''\n second_number = ''\n for i in range(0, len(input_list)):\n if i ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Solution(object): <|reserved_special_token_0|> class TestMethods(unittest.TestCase): def test_Local(self): self.assertEqual(1, 1) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Solution(object): def mergeTr...
flexible
{ "blob_id": "42371760d691eac9c3dfe5693b03cbecc13fd94d", "index": 6066, "step-1": "<mask token>\n\n\nclass Solution(object):\n <mask token>\n\n\nclass TestMethods(unittest.TestCase):\n\n def test_Local(self):\n self.assertEqual(1, 1)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Solution...
[ 3, 4, 7, 8, 10 ]
def primo(num): if num < 1: print(f"El numero {num} no es primo") return None else: if num == 2: print(f"El numero {num} es primo") return None else: for i in range(2, num): if num % i == 0: print(f"El numer...
normal
{ "blob_id": "29eb1a1642d38160c138733e269bb3ba0c5d4bba", "index": 9834, "step-1": "<mask token>\n\n\ndef leerNumero():\n numer = int(input('Escribe un numero ==> '))\n primo(numer)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef leerNumero():\n numer = int(input('Escribe un numero ==> '))\n p...
[ 1, 2, 3, 4, 5 ]
from django.apps import AppConfig class EasyTechConfig(AppConfig): name = 'easy_tech'
normal
{ "blob_id": "0ef172ced411213c0f7daccd632f8d5ec97379c3", "index": 5604, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass EasyTechConfig(AppConfig):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass EasyTechConfig(AppConfig):\n name = 'easy_tech'\n", "step-4": "from django.apps import...
[ 0, 1, 2, 3 ]
import numpy as np import pandas as pd import math import sklearn import sklearn.preprocessing import datetime import os import matplotlib.pyplot as plt import yfinance as yf import math from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout from tensorflow.keras.layers impor...
normal
{ "blob_id": "97ea837961c92b5c92a93ec33ac016de7ff1e876", "index": 2449, "step-1": "<mask token>\n\n\nclass simpleLSTM:\n <mask token>\n\n def create_dataset(self, dataset, look_back=4):\n dataX, dataY = [], []\n for i in range(len(dataset) - look_back - 1):\n a = dataset.iloc[i:i + ...
[ 4, 7, 8, 9, 10 ]
<|reserved_special_token_0|> def group_list(request): groups = Group.objects.all() return render(request, 'group_list.html', {'groups': groups}) <|reserved_special_token_0|> def group_add(request): if request.method == 'POST': form = GroupForm(request.POST) if form.is_valid(): ...
flexible
{ "blob_id": "b9fe758d5fe12b5a15097c0e5a33cb2d57edfdd2", "index": 7484, "step-1": "<mask token>\n\n\ndef group_list(request):\n groups = Group.objects.all()\n return render(request, 'group_list.html', {'groups': groups})\n\n\n<mask token>\n\n\ndef group_add(request):\n if request.method == 'POST':\n ...
[ 4, 6, 8, 10, 11 ]
class Queue(object): def __init__(self, val_list=None): self.stack_one = [] self.stack_two = [] if val_list: for item in val_list: self.stack_one.append(item) def push(self, val=None): if val: self.stack_one.append(val) <|reserved_spe...
flexible
{ "blob_id": "d4d8d800b81a50f2c520f0394412935738d1a8ee", "index": 2986, "step-1": "class Queue(object):\n\n def __init__(self, val_list=None):\n self.stack_one = []\n self.stack_two = []\n if val_list:\n for item in val_list:\n self.stack_one.append(item)\n\n d...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(dir(grok)) grok.testA() <|reserved_special_token_1|> from mypackage.A import grok print(dir(grok)) grok.testA() <|reserved_special_token_1|> # PROBLEM: Code organized in package and want to import a submodule from one...
flexible
{ "blob_id": "ad9facb9c8e552845df9171549f886f3e9cba193", "index": 7544, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(dir(grok))\ngrok.testA()\n", "step-3": "from mypackage.A import grok\nprint(dir(grok))\ngrok.testA()\n", "step-4": "# PROBLEM: Code organized in package and want to import a su...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def longest_word(s, d): lengths = [(entry, len(entry)) for entry in d] sorted_d = sorted(lengths, key=lambda x: (-x[1], x[0])) for word, length in sorted_d: j = 0 for i in range(0, len(s)): if j < len(word) and word[j] ...
flexible
{ "blob_id": "86de5b4a72978e2c49e060eefc513e3ed61272ae", "index": 4004, "step-1": "<mask token>\n", "step-2": "def longest_word(s, d):\n lengths = [(entry, len(entry)) for entry in d]\n sorted_d = sorted(lengths, key=lambda x: (-x[1], x[0]))\n for word, length in sorted_d:\n j = 0\n for i...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ''' Model package should containt all data types for the database engine, which means that projects like PyCIM can be included within '''
flexible
{ "blob_id": "ce3c1a7210632d0a8475fe886d514eb91d3c75ac", "index": 7700, "step-1": "<mask token>\n", "step-2": "''' Model package should containt all data types for the database engine, \nwhich means that projects like PyCIM can be included within '''", "step-3": null, "step-4": null, "step-5": null, "st...
[ 0, 1 ]
n =int(input("nhap gia tri")) for i in range(1,n+1): print(i)
normal
{ "blob_id": "21b295e28a7e4443ea116df1b22ff5074dca955a", "index": 246, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(1, n + 1):\n print(i)\n", "step-3": "n = int(input('nhap gia tri'))\nfor i in range(1, n + 1):\n print(i)\n", "step-4": "n =int(input(\"nhap gia tri\"))\nfor i in...
[ 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": "787397473c431d2560bf8c488af58e976c1864d0", "index": 6730, "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 = [('lkft', '002...
[ 0, 1, 2, 3, 4 ]
# # # ## from __future__ import print_function, unicode_literals import inspect import os import pprint as pp import time from time import gmtime, strftime import subprocess from local import * from slurm import * class Job_status( object ): """ Enumerate class for job statuses, this is done differently in pyt...
normal
{ "blob_id": "222a02f97df5ded6fea49e9eb201ed784a2a2423", "index": 5037, "step-1": "#\n# \n# \n##\n\nfrom __future__ import print_function, unicode_literals\nimport inspect\nimport os\nimport pprint as pp\nimport time\nfrom time import gmtime, strftime\nimport subprocess\n\nfrom local import *\nfrom slurm import *...
[ 0 ]