code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> def main(): detectPeriod('我要去游泳一個小時') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def detectPeriod(data): numWord = '[0-9,一二三四五六七八九十兩半]' hourWord = '小時鐘頭' minWord = '分鐘' secWord = '秒鐘' timePat = ('[' + numWord + ']+...
flexible
{ "blob_id": "397686964acbf640a5463a3a7095d85832545d9e", "index": 6462, "step-1": "<mask token>\n\n\ndef main():\n detectPeriod('我要去游泳一個小時')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef detectPeriod(data):\n numWord = '[0-9,一二三四五六七八九十兩半]'\n hourWord = '小時鐘頭'\n minWord = '分鐘'\n secWord =...
[ 1, 2, 3, 4, 5 ]
from draft import * # create a train station platform = Platform('platform 1') train_station = TrainStation('Linz') train_station.add_platform(platform) # create a train train_1 = ICE('ICE 1') platform.accept_train(train_1) train_section_1 = TrainSection('First section') train_section_2 = TrainSection('Second section')...
normal
{ "blob_id": "5900dc0acde45ac9a31dc9d489aa8dae304d626b", "index": 1791, "step-1": "<mask token>\n", "step-2": "<mask token>\ntrain_station.add_platform(platform)\n<mask token>\nplatform.accept_train(train_1)\n<mask token>\ntrain_1.dock_section(train_section_1)\ntrain_1.dock_section(train_section_2)\ntrain_1.doc...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class RwpInstaller: <|reserved_special_token_0|> def extract(self, target): with zipfile.ZipFile(target) as z: if z.testzip(): return self.output('Corrupt file {}\n'.format(target)) self.output('{} file valid\n\n'.format(target)) ...
flexible
{ "blob_id": "9c751dece67ef33ba8e5cb8281f024d2143e0808", "index": 8811, "step-1": "<mask token>\n\n\nclass RwpInstaller:\n <mask token>\n\n def extract(self, target):\n with zipfile.ZipFile(target) as z:\n if z.testzip():\n return self.output('Corrupt file {}\\n'.format(targ...
[ 4, 6, 7, 8 ]
class Library(object): <|reserved_special_token_0|> <|reserved_special_token_0|> def cache_key(self, key): return self._backend.cache_key(key) <|reserved_special_token_0|> <|reserved_special_token_1|> class Library(object): <|reserved_special_token_0|> <|reserved_special_token_0|> ...
flexible
{ "blob_id": "ccee0e3c47fd3809e0670be24aaa6fd0a9bad3bc", "index": 888, "step-1": "class Library(object):\n <mask token>\n <mask token>\n\n def cache_key(self, key):\n return self._backend.cache_key(key)\n <mask token>\n", "step-2": "class Library(object):\n <mask token>\n <mask token>\n...
[ 2, 3, 4, 5, 6 ]
import pandas as pd df = pd.read_csv("search.csv") df0 = df[df['re_0']<df['re_1']] df1 = df[df['re_0']>df['re_1']].ix[:, ['re_1', 'im_1', 're_0', 'im_0']] df1.columns = ['re_0', 'im_0', 're_1', 'im_1'] df = pd.concat([df0, df1]).sort_values(by=["re_0"]) eps = pow(10.0, -4.0) first = True res = [] val_old = None fo...
normal
{ "blob_id": "709e54daea4fea112539af3da83b00a43a086399", "index": 2629, "step-1": "import pandas as pd\n\ndf = pd.read_csv(\"search.csv\")\n\n\ndf0 = df[df['re_0']<df['re_1']]\ndf1 = df[df['re_0']>df['re_1']].ix[:, ['re_1', 'im_1', 're_0', 'im_0']]\ndf1.columns = ['re_0', 'im_0', 're_1', 'im_1']\ndf = pd.concat(...
[ 0 ]
from auction_type import AuctionType from bid import Bid class Auction(object): def __init__(self, name, type, status, start_price, buy_now_price): self.name = name self.type = type self.status = status if AuctionType.BID == type: self.start_price = start_price ...
normal
{ "blob_id": "9e05f883d80d7583c9f7e16b2fb5d3f67896388d", "index": 5629, "step-1": "<mask token>\n\n\nclass Auction(object):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Auction(object):\n\n def __init__(self, name, type, status, start_price, buy_now_price):\n self.name = ...
[ 1, 2, 3, 4 ]
from metricsManager import MetricsManager def TestDrawGraphs(): manager = MetricsManager() manager.displayMetricsGraph() return def main(): TestDrawGraphs() if __name__ == "__main__": main()
normal
{ "blob_id": "4e8a5b0ba13921fb88d5d6371d50e7120ab01265", "index": 737, "step-1": "<mask token>\n\n\ndef TestDrawGraphs():\n manager = MetricsManager()\n manager.displayMetricsGraph()\n return\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef TestDrawGraphs():\n manager = MetricsManager()\n m...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def get_df_4_model(user_id, n_recommendations=20000): """this function generates the latent dataframes used for the prediction model""" print('Generating dataframe for recommendation model') recipes_df_raw = pd.read_csv( 'data/preprocessed/recipe_pp_20201118_1206.csv')...
flexible
{ "blob_id": "5c8de06176d06c5a2cf78ac138a5cb35e168d617", "index": 5122, "step-1": "<mask token>\n\n\ndef get_df_4_model(user_id, n_recommendations=20000):\n \"\"\"this function generates the latent dataframes used for the prediction model\"\"\"\n print('Generating dataframe for recommendation model')\n r...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> root.mainloop() <|reserved_special_token_1|> <|reserved_special_token_0|> root = RootGUI() root.mainloop() <|reserved_special_token_1|> from RootGUI import RootGUI root = RootGUI() root.mainloop() <|reserved_special_token_...
flexible
{ "blob_id": "d17081ef94df1e14308128341d040559edb81805", "index": 7100, "step-1": "<mask token>\n", "step-2": "<mask token>\nroot.mainloop()\n", "step-3": "<mask token>\nroot = RootGUI()\nroot.mainloop()\n", "step-4": "from RootGUI import RootGUI\nroot = RootGUI()\nroot.mainloop()\n", "step-5": "#This fil...
[ 0, 1, 2, 3, 4 ]
from ocr_helpers import FilePathResolver, ProblemsWriter from ocr_google_client import CfaProblemsBuilder from ocr_google_client_2016 import ParserTwoThousandSixteenAnswers, ParserTwoThousandSixteenQuestions def resolve_build_and_write(year, day_part, file_part, nb_blocks_footer=0, nb_words_footer=0, headers=None, sk...
normal
{ "blob_id": "ab3d443c60ca8ee82f594ae04e9b485a53d53f36", "index": 5665, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef resolve_build_and_write(year, day_part, file_part, nb_blocks_footer=0,\n nb_words_footer=0, headers=None, skip_nb_page=0, parser=None,\n indentation_threshold=15):\n reso...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(test_id) <|reserved_special_token_1|> <|reserved_special_token_0|> client = pymongo.MongoClient('localhost', 27017) db = client['zhihu'] collection = db['zhihu'] document_test = {'name': 'test', 'time': time.strftime('%Y-...
flexible
{ "blob_id": "d1d293a5d2c394e69d93488605f27b5468220286", "index": 6627, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(test_id)\n", "step-3": "<mask token>\nclient = pymongo.MongoClient('localhost', 27017)\ndb = client['zhihu']\ncollection = db['zhihu']\ndocument_test = {'name': 'test', 'time': ti...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(count) print(count['b']) print(count.most_common(1)) print(count.items()) <|reserved_special_token_1|> <|reserved_special_token_0|> list1 = ['a', 'b', 'b', 'c', 'd', 'e', 'a', 'b', 'e'] count = Counter(list1) print(count)...
flexible
{ "blob_id": "f2c592a0ea38d800510323a1001c646cdbecefff", "index": 3009, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(count)\nprint(count['b'])\nprint(count.most_common(1))\nprint(count.items())\n", "step-3": "<mask token>\nlist1 = ['a', 'b', 'b', 'c', 'd', 'e', 'a', 'b', 'e']\ncount = Counter(li...
[ 0, 1, 2, 3, 4 ]
from PyQt5.QtWidgets import QHeaderView, QWidget from presenters.studyings_presenter import StudyingsPresenter from view.q_objects_view import QObjectsView class QStudyingsView(QObjectsView): def __init__(self, parent): QWidget.__init__(self, parent) QObjectsView.__init__(self, parent) se...
normal
{ "blob_id": "f7174bf4e7612921e730ac87141c85654a2f2411", "index": 6194, "step-1": "<mask token>\n\n\nclass QStudyingsView(QObjectsView):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass QStudyingsView(QObjectsView):\n <mask token>\n\n def init_table(self):\n self.table.set...
[ 1, 2, 3, 4 ]
import re def match_regex(filename, regex): with open(filename) as file: lines = file.readlines() for line in reversed(lines): match = re.match(regex, line) if match: regex = yield match.groups()[0] def get_serials(filename): ERROR_RE = 'XFS ERROR (\[sd[a-z]\])' #...
normal
{ "blob_id": "a36a553342cfe605a97ddc0f636bbb73b683f6a6", "index": 1239, "step-1": "<mask token>\n\n\ndef match_regex(filename, regex):\n with open(filename) as file:\n lines = file.readlines()\n for line in reversed(lines):\n match = re.match(regex, line)\n if match:\n regex ...
[ 1, 3, 4, 5, 6 ]
#train a neural network from input video feed import numpy as np import cv2 vid = cv2.VideoCapture('trackmania_test_vid.mp4') w = 1280//2 h = 720//2 vid_data = np.empty((360, 640, 3)) #print(vid_data.shape) def process_frame(img): global vid_data img = cv2.resize(img, (w, h)) cv2.imshow('Frame', img) ...
normal
{ "blob_id": "eb81b0e41743e1785b82e88f6a618dc91eba73e5", "index": 1389, "step-1": "<mask token>\n\n\ndef process_frame(img):\n global vid_data\n img = cv2.resize(img, (w, h))\n cv2.imshow('Frame', img)\n cv2.waitKey(1)\n vid_data = np.append(vid_data, img, axis=0)\n\n\n<mask token>\n", "step-2": ...
[ 1, 2, 3, 4, 5 ]
from .celery import app from home.models import Banner from settings.const import BANNER_COUNT from home.serializers import BannerModelSerializer from django.core.cache import cache from django.conf import settings @app.task def update_banner_list(): # 获取最新内容 banner_query = Banner.objects.filter(is_delete=Fals...
normal
{ "blob_id": "8e85740123467889bdeb6b27d5eaa4b39df280ed", "index": 438, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.task\ndef update_banner_list():\n banner_query = Banner.objects.filter(is_delete=False, is_show=True\n ).order_by('-orders')[:BANNER_COUNT]\n banner_data = BannerMode...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class MyMainWindow(QMainWindow): <|reserved_special_token_0|> <|reserved_special_token_0|> def initConnect(self): self.dataFileChooseButton.clicked.connect(self.chooseData) self.dataFileChooseButtonT.clicked.connect(self.chooseData) self.dataLossSimula...
flexible
{ "blob_id": "302605d8bb45b1529742bf9441d476f0276085b9", "index": 9, "step-1": "<mask token>\n\n\nclass MyMainWindow(QMainWindow):\n <mask token>\n <mask token>\n\n def initConnect(self):\n self.dataFileChooseButton.clicked.connect(self.chooseData)\n self.dataFileChooseButtonT.clicked.conne...
[ 9, 11, 12, 15, 18 ]
from scipy.stats import itemfreq from sklearn.model_selection import StratifiedKFold from keras_utils.keras_utils import * from keras.utils.np_utils import to_categorical from keras.layers import Input, Embedding, Dense, GlobalAveragePooling1D, Flatten from keras.layers import add, multiply, LSTM, Bidirectiona...
normal
{ "blob_id": "0b125e7e9e763d4fd71e381ca823f9e9aa8ea606", "index": 8198, "step-1": "<mask token>\n\n\nclass MaskedGlobalAveragePooling1D(GlobalAveragePooling1D):\n\n def __init__(self, **kwargs):\n super(MaskedGlobalAveragePooling1D, self).__init__(**kwargs)\n self.supports_masking = True\n\n\ncla...
[ 7, 11, 13, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print( """Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. Αν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολόγησε '0r' ενώ, αν θέλεις να βγάλεις το τελευταιο, πληκτρολόγησε 'r' """...
flexible
{ "blob_id": "87bcf53d1c93645a08b10ba0d02edf0d5b0a4906", "index": 5664, "step-1": "<mask token>\n", "step-2": "print(\n \"\"\"Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. \nΑν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολόγησε '0r' ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class A_Swerve(Scene): def construct(self): chassis = Square(side_length=2, stroke_width=0, fill_color=GRAY, fill_opacity=1).shift(2 * RIGHT) fr = Dot().shift(UP + 3 * RIGHT) fl = Dot().shift(UP + RIGHT) rl = Dot().shift(DOWN + RIGHT) ...
flexible
{ "blob_id": "bdde3a3725510d4a83b09421e4b8538a38e29584", "index": 8196, "step-1": "<mask token>\n\n\nclass A_Swerve(Scene):\n\n def construct(self):\n chassis = Square(side_length=2, stroke_width=0, fill_color=GRAY,\n fill_opacity=1).shift(2 * RIGHT)\n fr = Dot().shift(UP + 3 * RIGHT)\...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def get_markdown_file(name, lang='en'): """ Get the contents of a markdown file. """ filename_temp = '{0}_{1}.markdown' md_dir = os.path.join(current_app.config['APP_PATH'], 'markdown') filepath = os.path...
flexible
{ "blob_id": "213ab22a269abc8180524462a8966e5d929ef7d1", "index": 322, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get_markdown_file(name, lang='en'):\n \"\"\"\n Get the contents of a markdown file.\n \"\"\"\n filename_temp = '{0}_{1}.markdown'\n md_dir = os.path.join(current_app...
[ 0, 1, 2, 3, 4 ]
# Generated by Django 3.1.1 on 2020-10-14 16:26 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('Store', '0004_remove_product_mcat'), ] operations = [ migrations.RemoveField( model_name='categ...
normal
{ "blob_id": "ec39dae7217ddc48b1ab5163d234542cb36c1d48", "index": 5351, "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 = [('Store', '00...
[ 0, 1, 2, 3, 4 ]
import math import numpy as np import matplotlib.pyplot as plt def test_func(x): # x is vector; here of length 1 x = x[0] return math.cos(x) * x**2 + x def run_smac(max_fun=30): from smac.facade.func_facade import fmin_smac x, cost, smac = fmin_smac(func=test_func, ...
normal
{ "blob_id": "90218168841dc76febab67d1e992dfc993730ea4", "index": 2455, "step-1": "<mask token>\n\n\ndef run_smac(max_fun=30):\n from smac.facade.func_facade import fmin_smac\n x, cost, smac = fmin_smac(func=test_func, x0=[-0], bounds=[(-5, 5)],\n maxfun=max_fun, rng=1234)\n runhistory = smac.get_...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> class SpriteMoveTo(SpriteLayer): <|reserved_special_token_0|> class FontLayer(Layer): def __init__(self, title='Sprite Exmaple #', subtitle='Goto()'): super(FontLayer, self).__init__() self.title = title self.subtitle = subtitle self.batch = pygl...
flexible
{ "blob_id": "2678aac08104a580e866984bc4cf4adf8cb8ac5c", "index": 5930, "step-1": "<mask token>\n\n\nclass SpriteMoveTo(SpriteLayer):\n <mask token>\n\n\nclass FontLayer(Layer):\n\n def __init__(self, title='Sprite Exmaple #', subtitle='Goto()'):\n super(FontLayer, self).__init__()\n self.titl...
[ 4, 9, 10, 11, 13 ]
import sys import unittest import random from k_order_statistic import k_order_statistic test_case_find = [([0], 0, 0), ([-1, -1, -1, -1], 3, -1), ([-1, -1, -1, -1], 1, -1), ([-1, 0, 3, -10], 3, 3), ([-1, -2, -3, -4, -5], 0, -5), ([1, 2, 3, 4, 5], 1, 2), ([True, False, True], 2, True), ([sys.maxsize], 0, sys ...
normal
{ "blob_id": "b93cd5ad957da37b1a4cca1d465a67723110e926", "index": 2813, "step-1": "<mask token>\n\n\nclass TestKOrderStatistic(unittest.TestCase):\n\n def test_find(self):\n for a, k, ans in test_case_find:\n self.assertEqual(k_order_statistic(a, k), ans)\n <mask token>\n", "step-2": "<m...
[ 2, 3, 4, 5 ]
from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render, HttpResponseRedirect, Http404 from django.contrib.auth import authenticate, login, logout from accounts.forms import RegistrationForm, LoginForm, StudentDetailsForm, companyDetailsForm, SocietyDetailsForm from accounts.models im...
normal
{ "blob_id": "7f21fcc1265be8b3263971a4e76470616459f433", "index": 6061, "step-1": "from django.core.exceptions import ObjectDoesNotExist\nfrom django.shortcuts import render, HttpResponseRedirect, Http404\nfrom django.contrib.auth import authenticate, login, logout\n\nfrom accounts.forms import RegistrationForm, ...
[ 0 ]
"""Command line interface to the OSF These functions implement the functionality of the command-line interface. """ from __future__ import print_function from functools import wraps import getpass import os import sys from six.moves import configparser from six.moves import input from tqdm import tqdm from .api im...
normal
{ "blob_id": "ca551d8e55ebb15a03077af5695782c6d72ff2fd", "index": 8091, "step-1": "<mask token>\n\n\ndef config_from_env(config):\n username = os.getenv('OSF_USERNAME')\n if username is not None:\n config['username'] = username\n project = os.getenv('OSF_PROJECT')\n if project is not None:\n ...
[ 7, 9, 10, 12, 13 ]
from django.contrib.auth.decorators import login_required from django.shortcuts import render from orders.models import Setting def search(request): return render(request, 'ui/search.html') def search_printed(request): print_url = '' setting = Setting.objects.filter(name='printer').first() if settin...
normal
{ "blob_id": "f16d43d9dfb3e9b9589fa92eb82aaa4c73fe48cd", "index": 1264, "step-1": "<mask token>\n\n\ndef search(request):\n return render(request, 'ui/search.html')\n\n\ndef search_printed(request):\n print_url = ''\n setting = Setting.objects.filter(name='printer').first()\n if setting != None:\n ...
[ 2, 3, 4, 5 ]
from numpy import * import KNN_1 import KNN_3 import KNN_suanfa as clf def datingClassTest(): horatio = 0.1 data, datalabels = KNN_1.filel2matrix("datingTestSet2.txt") normMat = KNN_3.autoNorm(data) ml = normMat.shape[0] numTestset = int(ml*horatio) errorcount = 0 a=clf.classify0(normMat[0:n...
normal
{ "blob_id": "3086f62d4057812fc7fb4e21a18bc7d0ba786865", "index": 2526, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef datingClassTest():\n horatio = 0.1\n data, datalabels = KNN_1.filel2matrix('datingTestSet2.txt')\n normMat = KNN_3.autoNorm(data)\n ml = normMat.shape[0]\n numTests...
[ 0, 2, 3, 4, 5 ]
#!/usr/bin/env python import mincemeat import sys from mapinput import FileShardsMapInput from mapinput import JsonFileMapInput def mapfn(k, v): for w in v.split(): yield w, 1 def reducefn(k, vs): result = 0 for v in vs: result += v return result s = mincemeat.Server() s.map_input =...
normal
{ "blob_id": "09c6dd0f32b8d71dacdd8b10d995ea1575f91f6f", "index": 2887, "step-1": "<mask token>\n\n\ndef mapfn(k, v):\n for w in v.split():\n yield w, 1\n\n\ndef reducefn(k, vs):\n result = 0\n for v in vs:\n result += v\n return result\n\n\n<mask token>\n", "step-2": "<mask token>\n\n...
[ 2, 3, 4, 5, 6 ]
"""Tools for working with Scores.""" from typing import List, Optional from citrine._serialization import properties from citrine._serialization.polymorphic_serializable import PolymorphicSerializable from citrine._serialization.serializable import Serializable from citrine._session import Session from citrine.informa...
normal
{ "blob_id": "a0086a9d27a091776378cd8bde31c59899fc07ac", "index": 3122, "step-1": "<mask token>\n\n\nclass LIScore(Serializable['LIScore'], Score):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(sel...
[ 12, 14, 16, 20, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for sheet in sheets: sh = wb[sheet] i = 3 while True: tmp = sh.cell(row=1, column=i).value if tmp: days.append(tmp) else: break i += 1 print(days) days.po...
flexible
{ "blob_id": "37d5696c402737bfafe21b20b90a49e2753fdc4f", "index": 7287, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor sheet in sheets:\n sh = wb[sheet]\n i = 3\n while True:\n tmp = sh.cell(row=1, column=i).value\n if tmp:\n days.append(tmp)\n else:\n ...
[ 0, 2, 3, 4, 5 ]
from django.contrib import admin from .models import Contactus,ContactusAdmin,Company,CompanyAdmin,Products,ProductsAdmin,Brands,BrandsAdmin # Register your models here. admin.site.register(Contactus,ContactusAdmin), admin.site.register(Company,CompanyAdmin), admin.site.register(Products,ProductsAdmin), admin.site.reg...
normal
{ "blob_id": "9586dc118be4388491770d823a38e8068e3b91cb", "index": 5960, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Contactus, ContactusAdmin),\nadmin.site.register(Company, CompanyAdmin),\nadmin.site.register(Products, ProductsAdmin),\nadmin.site.register(Brands, BrandsAdmin),\n", ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def main(): s = input().strip() s = s.replace('BC', 'X') ans = 0 for ax in re.split('[BC]+', s): inds = [] for i in range(len(ax)): if ax[i] == 'A': inds.append(i) ...
flexible
{ "blob_id": "4100415b0df52e8e14b00dd66c7c53cd46c0ea6e", "index": 2378, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n s = input().strip()\n s = s.replace('BC', 'X')\n ans = 0\n for ax in re.split('[BC]+', s):\n inds = []\n for i in range(len(ax)):\n ...
[ 0, 1, 2, 3, 4 ]
import re from captcha.fields import CaptchaField from django import forms from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from django.contrib.auth.models import User from django.core.exceptions import ValidationError from news.models import News, Comment, Profile class UserRegisterForm(Use...
normal
{ "blob_id": "1b4a012f5b491c39c0abd139dd54f2095ea9d221", "index": 3016, "step-1": "<mask token>\n\n\nclass ContactForm(forms.Form):\n \"\"\"Форма обратной связи\"\"\"\n subject = forms.CharField(label='Тема', widget=forms.TextInput(attrs={\n 'class': 'form-control'}))\n content = forms.CharField(l...
[ 7, 11, 14, 16, 18 ]
<|reserved_special_token_0|> class SegMetric(Metric): def __init__(self, iou_thr, prob_thr, img_size, dist_sync_on_step=False): super().__init__(dist_sync_on_step=dist_sync_on_step) self.iou_thr = iou_thr self.prob_thr = prob_thr self.img_size = img_size self.use_ddp = dis...
flexible
{ "blob_id": "8d3f8872a3d5c4351551dc2d46839763d28ebd70", "index": 3586, "step-1": "<mask token>\n\n\nclass SegMetric(Metric):\n\n def __init__(self, iou_thr, prob_thr, img_size, dist_sync_on_step=False):\n super().__init__(dist_sync_on_step=dist_sync_on_step)\n self.iou_thr = iou_thr\n sel...
[ 5, 6, 7, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Hello World!') print('2nd Test') <|reserved_special_token_0|> print(d) print(d['a']) <|reserved_special_token_0|> random.seed(30) <|reserved_special_token_0|> print(r) <|reserved_special_token_0|> np.random.seed for i in range(20): newArray = list(...
flexible
{ "blob_id": "e4a60008ca7d61d825b59e6202b40c6be02841cd", "index": 2024, "step-1": "<mask token>\n", "step-2": "print('Hello World!')\nprint('2nd Test')\n<mask token>\nprint(d)\nprint(d['a'])\n<mask token>\nrandom.seed(30)\n<mask token>\nprint(r)\n<mask token>\nnp.random.seed\nfor i in range(20):\n newArray =...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def func(n): name = n print(name) def func1(): nonlocal name name = 'xiaohong' print(name) func1() print(name) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "b04aef64dc0485d9112a40e00d178042833a9ddd", "index": 4294, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef func(n):\n name = n\n print(name)\n\n def func1():\n nonlocal name\n name = 'xiaohong'\n print(name)\n func1()\n print(name)\n\n\n<mask token>\...
[ 0, 1, 2, 3 ]
from ethereum.common import mk_transaction_sha, mk_receipt_sha from ethereum.exceptions import InsufficientBalance, BlockGasLimitReached, \ InsufficientStartGas, InvalidNonce, UnsignedTransaction from ethereum.messages import apply_transaction from ethereum.slogging import get_logger from ethereum.utils import enco...
normal
{ "blob_id": "e364ba45513167966fe50e31a01f552ccedec452", "index": 6552, "step-1": "<mask token>\n\n\ndef add_transactions(shard_state, collation, txqueue, shard_id,\n min_gasprice=0, mainchain_state=None):\n \"\"\"Add transactions to a collation\n (refer to ethereum.common.add_transactions)\n \"\"\"\n...
[ 4, 5, 6, 7, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if settings.DEBUG: import debug_toolbar urlpatterns += path('__debug__/', include(debug_toolbar.urls)), <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [path('', TemplateView.as_view(template_nam...
flexible
{ "blob_id": "573674e50e05880a2822f306c125207b382d872f", "index": 6389, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG:\n import debug_toolbar\n urlpatterns += path('__debug__/', include(debug_toolbar.urls)),\n", "step-3": "<mask token>\nurlpatterns = [path('', TemplateView.as_vi...
[ 0, 1, 2, 3, 4 ]
import numpy as np import sympy as sp from copy import copy from typing import Any, get_type_hints, Dict from inspect import getclosurevars, getsource, getargs import ast from ast import parse, get_source_segment from .numpy import NumPy from .torch import torch_defs defines = {} defines.update(torch_defs) def check_...
normal
{ "blob_id": "430b5ca7212983743cadc36a2ada987bb721174a", "index": 3537, "step-1": "<mask token>\n\n\ndef check_type(item, target):\n assert item == target\n\n\ndef exec_lines(source: str, body, loc: Dict[str, Any], glob: Dict[str, Any],\n ret: Any):\n\n def get_value(v):\n if isinstance(v, ast.Bin...
[ 3, 4, 5, 6 ]
<|reserved_special_token_0|> class DenseBlock(nn.Module): <|reserved_special_token_0|> def forward(self, x): out = self.denseblock(x) return out <|reserved_special_token_1|> <|reserved_special_token_0|> class BottleNeck(nn.Module): <|reserved_special_token_0|> def forward(self, ...
flexible
{ "blob_id": "c2ba18062b8555c77b329718ec1f2ae7f326c78e", "index": 1988, "step-1": "<mask token>\n\n\nclass DenseBlock(nn.Module):\n <mask token>\n\n def forward(self, x):\n out = self.denseblock(x)\n return out\n", "step-2": "<mask token>\n\n\nclass BottleNeck(nn.Module):\n <mask token>\n...
[ 2, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> random.shuffle(listaAlunos) print('A ordem de apresentação será ', listaAlunos) <|reserved_special_token_1|> <|reserved_special_token_0|> aluno1 = input('Primeiro aluno: ') aluno2 = input('Segundo aluno: ') aluno3 = input('Terc...
flexible
{ "blob_id": "445bb8ad8dadd207a3546f4623de583fc47a2910", "index": 2180, "step-1": "<mask token>\n", "step-2": "<mask token>\nrandom.shuffle(listaAlunos)\nprint('A ordem de apresentação será ', listaAlunos)\n", "step-3": "<mask token>\naluno1 = input('Primeiro aluno: ')\naluno2 = input('Segundo aluno: ')\nalun...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "af523777e32c44112bd37a4b9dcbc0941f7e8236", "index": 4242, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> tree.insert(5, tree.root) tree.insert(15, tree.root) tree.insert(25, tree.root) tree.insert(12, tree.root) tree.insert(35, tree.root) print(tree.height(tree.root)) <|reserved_special_token_1|> <|reserved_special_token_0|> tree ...
flexible
{ "blob_id": "59ddb85d55c342342be4edc1fc3b92af701fa6cc", "index": 4342, "step-1": "<mask token>\n", "step-2": "<mask token>\ntree.insert(5, tree.root)\ntree.insert(15, tree.root)\ntree.insert(25, tree.root)\ntree.insert(12, tree.root)\ntree.insert(35, tree.root)\nprint(tree.height(tree.root))\n", "step-3": "<...
[ 0, 1, 2, 3 ]
import pandas as pd import os import re main_dir = r'C:\Users\Username\Desktop\Python\End-to-End-Data-Analysis\1. Get the Data\table' file = 'CMBS Table.csv' os.chdir(main_dir) cmbs = pd.read_csv(file, encoding='ISO-8859-1') # Delete extra Loan & Seller columns loan_seller_cols = [val for val in cmbs.co...
normal
{ "blob_id": "eb890c68885cbab032ce9d6f3be3fd7013a2788b", "index": 2140, "step-1": "<mask token>\n", "step-2": "<mask token>\nos.chdir(main_dir)\n<mask token>\nfor col in loan_seller_cols:\n cmbs.drop(columns=col, axis=1, inplace=True)\n<mask token>\nfor key, value in regex_dict.items():\n cmbs.columns = [...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def completion_proximity_score(prefix, completion): """Calculate a score based on suffix length where a shorter length always yields a higher score.""" if prefix == completion: return float('inf') else: ...
flexible
{ "blob_id": "24891cdefcd061f04e7b7768b1bde4e32b78adcc", "index": 8690, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef completion_proximity_score(prefix, completion):\n \"\"\"Calculate a score based on suffix length where a shorter length always\n yields a higher score.\"\"\"\n if prefix ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CityscapesTestConfig(CityscapesCommonConfig): <|reserved_special_token_0|> batch_size = 1 list_path = 'val.txt' @classmethod def rules(cls): """Return rules for checking.""" rules_CityscapesTestConfig = {'batch_size': {'type': int}, '...
flexible
{ "blob_id": "f3da38f2c4fda0a1d54e79c2c21070f98002b88d", "index": 3351, "step-1": "<mask token>\n\n\nclass CityscapesTestConfig(CityscapesCommonConfig):\n <mask token>\n batch_size = 1\n list_path = 'val.txt'\n\n @classmethod\n def rules(cls):\n \"\"\"Return rules for checking.\"\"\"\n ...
[ 8, 18, 19, 21, 23 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(friends[0]) print(friends[1]) print(len(friends)) <|reserved_special_token_0|> print(friends[0][0]) friends.append('Jen') print(friends) new_friends.remove(['Anne', 27]) print(new_friends) <|reserved_special_token_1|> fri...
flexible
{ "blob_id": "355d60300cbbed817b4512e9b02cc4dd53d1293e", "index": 2692, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(friends[0])\nprint(friends[1])\nprint(len(friends))\n<mask token>\nprint(friends[0][0])\nfriends.append('Jen')\nprint(friends)\nnew_friends.remove(['Anne', 27])\nprint(new_friends)\...
[ 0, 1, 2, 3 ]
# Generated by Django 3.1.4 on 2020-12-11 17:50 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0016_auto_20201211_2158'), ] operations = [ migrations.CreateModel( name='Question', ...
normal
{ "blob_id": "e8011e98da342e501070febf421e9f8d0b74d64e", "index": 6813, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('core', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def matches_panic_funcs(name): """If the passed name contains one of the known panic_functions, return the match """ for func in panic_functions: if func in name: return func return '' <|reserved_special_token_0|> def any_origin_matches_panic_fu...
flexible
{ "blob_id": "8c0a4d5a86d9ebd38ea05efb5b5b570368ce1449", "index": 1336, "step-1": "<mask token>\n\n\ndef matches_panic_funcs(name):\n \"\"\"If the passed name contains one of the known panic_functions,\n return the match\n \"\"\"\n for func in panic_functions:\n if func in name:\n re...
[ 7, 10, 11, 12, 13 ]
_all__ = ["minning_algo"]
normal
{ "blob_id": "5a7b68648898818e0db47f225f3d4b0972cd5b99", "index": 7521, "step-1": "<mask token>\n", "step-2": "_all__ = ['minning_algo']\n", "step-3": "_all__ = [\"minning_algo\"]\n\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- """ Created on Mon Jul 13 11:43:58 2020 @author: Dr. Tang """ import tensorflow as tf # 需要你编程:将下面转换成tensorflow #x = 10 #y = 2 #u=x/y #z = u- 1 x=tf.placeholder(tf.int32) y=tf.placeholder(tf.int32) u=tf.divide(x,y) z=tf.subtract(u,tf.constant(1.0,dtype=tf.float64)) # 需要你编程:从session中打印 z with t...
normal
{ "blob_id": "ca91052072d7b2da5729cf55f7f4ba4b54608017", "index": 3477, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as sess:\n output = sess.run(z, feed_dict={x: 10, y: 2})\n print(output)\n", "step-3": "<mask token>\nx = tf.placeholder(tf.int32)\ny = tf.placeholder(tf.int32)\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def compare_images(target, ref): scores = [] scores.append(psnr(target, ref)) scores.append(mse(target, ref)) scores.append(ssim(target, ref, multichannel=True)) return scores def prepare_images(path, factor): for file in os.listdir(path): img = cv2.imrea...
flexible
{ "blob_id": "e086bebaa166abeea066fe49076f1b007858951f", "index": 7052, "step-1": "<mask token>\n\n\ndef compare_images(target, ref):\n scores = []\n scores.append(psnr(target, ref))\n scores.append(mse(target, ref))\n scores.append(ssim(target, ref, multichannel=True))\n return scores\n\n\ndef pre...
[ 3, 7, 9, 10, 12 ]
<|reserved_special_token_0|> class BilanComptes(object): <|reserved_special_token_0|> <|reserved_special_token_0|> @staticmethod def creation_lignes(subedition, subgeneraux, consolidation): """ génération des lignes de données du bilan :param subedition: paramètres d'édition ...
flexible
{ "blob_id": "53c874fbe14031c323f83db58f17990f4e60bc58", "index": 2195, "step-1": "<mask token>\n\n\nclass BilanComptes(object):\n <mask token>\n <mask token>\n\n @staticmethod\n def creation_lignes(subedition, subgeneraux, consolidation):\n \"\"\"\n génération des lignes de données du b...
[ 2, 3, 4, 5, 6 ]
import numpy as np import cv2 import myrustlib def detect_lines_hough(img): lines = cv2.HoughLinesP( cv2.bitwise_not(opening), rho = 1, theta = np.pi / 2, threshold=50, minLineLength=120, maxLineGap=10 ) return [line[0] for line in lines] # weird HoughLinesP ...
normal
{ "blob_id": "bb5bea4ea100950b59fb2b168b75dec349938aac", "index": 7195, "step-1": "<mask token>\n\n\ndef detect_lines_hough(img):\n lines = cv2.HoughLinesP(cv2.bitwise_not(opening), rho=1, theta=np.pi / \n 2, threshold=50, minLineLength=120, maxLineGap=10)\n return [line[0] for line in lines]\n\n\n<m...
[ 6, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> __author__ = 'Sol Amour - amoursol@gmail.com' __twitter__ = '@solamour' __version__ = '1.0.0' greaterThan = 10 > 5 greaterThanOrEqualTo = 10 >= 10 lessThan = 5 < 10 lessThanOrEqualTo = 5 <= 5 equals = 5 == 5 notEquals = 5 != 10 x ...
flexible
{ "blob_id": "3b737aaa820da8f70a80480c6404e4d3a9d2262e", "index": 5602, "step-1": "<mask token>\n", "step-2": "<mask token>\n__author__ = 'Sol Amour - amoursol@gmail.com'\n__twitter__ = '@solamour'\n__version__ = '1.0.0'\ngreaterThan = 10 > 5\ngreaterThanOrEqualTo = 10 >= 10\nlessThan = 5 < 10\nlessThanOrEqualT...
[ 0, 1, 2 ]
# Generated by Django 3.2 on 2021-05-22 06:54 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Recuerdos', fields=[ ('id', models.BigAutoFie...
normal
{ "blob_id": "89d0d5d13c5106c504c6727c7784f048a30495dc", "index": 5560, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @app.route('/') def index(): buf = io.BytesIO() buf.write('hello world') buf.seek(0) return send_file(buf, attachment_filename='testing.txt', as_attachment=True ) <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "362c4e572f0fe61b77e54ab5608d4cd052291da4", "index": 4043, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@app.route('/')\ndef index():\n buf = io.BytesIO()\n buf.write('hello world')\n buf.seek(0)\n return send_file(buf, attachment_filename='testing.txt', as_attachment=True\n...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def randomMath(): correct = 0 while correct < 10: str_ops = ['+', '-', '*', '/', '%'] ops = {'+': o.add, '-': o.sub, '*': o.mul, '/': o.floordiv, '%': o.mod} x = r(1, 10) y = r(1, 10) ...
flexible
{ "blob_id": "12f035962925c5380c782e8fad23f16fe9fb9435", "index": 5311, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef randomMath():\n correct = 0\n while correct < 10:\n str_ops = ['+', '-', '*', '/', '%']\n ops = {'+': o.add, '-': o.sub, '*': o.mul, '/': o.floordiv, '%': o.mo...
[ 0, 1, 2, 3, 4 ]
def printBoard(board,pref): border = "+----+----+----+----+----+----+----+----+" for row in board: print(pref,border) cells ="|" for cell in row: if cell == 0: cell = " " elif cell in range(1,10): cell = "0{}".format(cell) ...
normal
{ "blob_id": "07e875a24d0e63ef596db57c4ec402f768225eec", "index": 5103, "step-1": "<mask token>\n", "step-2": "def printBoard(board, pref):\n border = '+----+----+----+----+----+----+----+----+'\n for row in board:\n print(pref, border)\n cells = '|'\n for cell in row:\n if...
[ 0, 1, 2 ]
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-02-07 23:42 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('events', '0005_auto_20160207_1529'), ] operations = [ migrations.AddField( ...
normal
{ "blob_id": "ab3609c27fa002d79735c5d5c09ec7a52fedd040", "index": 3484, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('events', '0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def res(p, y, x): m, dm, sd1, sd2 = p m1 = m m2 = m1 + m y_fit = norm(x, m1, sd1) + norm(x, m2, sd2) error = y - y_fit return error <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def norm(x, media, sd): norm = [] ...
flexible
{ "blob_id": "b3ce17401476afe2edfda3011d5602ba492cd705", "index": 5817, "step-1": "<mask token>\n\n\ndef res(p, y, x):\n m, dm, sd1, sd2 = p\n m1 = m\n m2 = m1 + m\n y_fit = norm(x, m1, sd1) + norm(x, m2, sd2)\n error = y - y_fit\n return error\n\n\n<mask token>\n", "step-2": "<mask token>\n\n...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if not os.path.exists(filepath + pathRGB): os.makedirs(filepath + pathRGB) backSubInstance.setConfig('sample.cfg') for filename in glob.glob(filepath + extension): pathAndFile = os.path.splitext(filename)[0] latestFile...
flexible
{ "blob_id": "506d33587ff6c8b2c3d9bc546307996d2f518d86", "index": 2060, "step-1": "<mask token>\n", "step-2": "<mask token>\nif not os.path.exists(filepath + pathRGB):\n os.makedirs(filepath + pathRGB)\nbackSubInstance.setConfig('sample.cfg')\nfor filename in glob.glob(filepath + extension):\n pathAndFile...
[ 0, 1, 2, 3, 4 ]
from django import forms from .models import GetInTouch class GetInTouchForm(forms.ModelForm): class Meta: model = GetInTouch fields = '__all__'
normal
{ "blob_id": "c8dc143c09aa7f677167a4942ae1c4a0fbf75128", "index": 3219, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass GetInTouchForm(forms.ModelForm):\n\n\n class Meta:\n model = GetInTouch\n fields = '__all__'\n", "step-3": "from django import forms\nfrom .models import GetI...
[ 0, 1, 2 ]
from django.http import HttpResponse from django.shortcuts import render def index(request): return render(request, 'ALR1.html') def search(request): return render(request, 'ALR2.html') def home(request): return render(request, 'ALR3.html') def pdf(request): pdfId = request.GET['id'] # pdf_data=open...
normal
{ "blob_id": "d9f586bbb72021ee0b37ff8660e26b50d7e6a2d3", "index": 569, "step-1": "<mask token>\n\n\ndef index(request):\n return render(request, 'ALR1.html')\n\n\ndef search(request):\n return render(request, 'ALR2.html')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef index(request):\n return r...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> charset = {'big5': ['big5_chinese_ci', 'big5_bin'], 'dec8': [ 'dec8_swedish_ci', 'dec8_bin'], 'cp850': ['cp850_general_ci', 'cp850_bin'], 'hp8': ['hp8_english_ci', 'hp8_bin'], 'koi8r': [ 'koi8r_general_ci', 'koi8r_bin'], 'latin1': ['latin1_swedish...
flexible
{ "blob_id": "5e29c6d1034f6612b0081037f8dc679b49f1dbef", "index": 2855, "step-1": "<mask token>\n", "step-2": "charset = {'big5': ['big5_chinese_ci', 'big5_bin'], 'dec8': [\n 'dec8_swedish_ci', 'dec8_bin'], 'cp850': ['cp850_general_ci',\n 'cp850_bin'], 'hp8': ['hp8_english_ci', 'hp8_bin'], 'koi8r': [\n ...
[ 0, 1, 2 ]
import numpy as np import cv2 from matplotlib import pyplot as plt from matplotlib import cm import imageio # # Backpack values # fx = 7190.247 # lense focal length # baseline = 174.945 # distance in mm between the two cameras (values from middlebury) # units = 0.001 # depth units...
normal
{ "blob_id": "14761cc2593556f58a7dc4e499db71456d7c7048", "index": 3237, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.imshow(imgL, cmap='gray')\nplt.axis('off')\nplt.show()\n<mask token>\nprint(disparity)\nplt.imshow(disparity)\nplt.axis('off')\nplt.show()\n<mask token>\nplt.imshow(depth)\nplt.show()...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS: import debug_toolbar urlpatterns = [path('__debug__/', include(debug_toolbar.urls)) ] + urlpatterns <|reserved_special_token_1|> <|reserved_speci...
flexible
{ "blob_id": "987d6c769a4f593405e889ed2b0e3f9955900406", "index": 856, "step-1": "<mask token>\n", "step-2": "<mask token>\nif settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:\n import debug_toolbar\n urlpatterns = [path('__debug__/', include(debug_toolbar.urls))\n ] + urlpatterns\n",...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def part2(number): if number == target: return 1 if number in memoize.keys(): return memoize[number] paths = 0 if number + 1 in n: paths += part2(number + 1) if number + 2 in n: paths += part2(number + 2) if number + 3 in n: ...
flexible
{ "blob_id": "3179c13968f7bcdccbd00ea35b9f098dc49b42d8", "index": 4450, "step-1": "<mask token>\n\n\ndef part2(number):\n if number == target:\n return 1\n if number in memoize.keys():\n return memoize[number]\n paths = 0\n if number + 1 in n:\n paths += part2(number + 1)\n if ...
[ 1, 2, 3, 4, 5 ]
class Graph: def __init__(self, nvertices): self.N = nvertices self.graph = [[(0) for column in range(nvertices)] for row in range (nvertices)] self.V = ['0' for column in range(nvertices)] def nameVertex(self): for i in range(self.N): print('Qual o rotú...
flexible
{ "blob_id": "51a8b963047215bf864eb4a3e62beb5741dfbafe", "index": 8572, "step-1": "class Graph:\n\n def __init__(self, nvertices):\n self.N = nvertices\n self.graph = [[(0) for column in range(nvertices)] for row in range\n (nvertices)]\n self.V = ['0' for column in range(nverti...
[ 3, 5, 6, 7, 8 ]
<|reserved_special_token_0|> class MarkdownBlock(TextBlock): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class MarkdownBlock(TextBlock): def __init__(self, required=True, help_text=None, **kwargs): self.field = forms.Cha...
flexible
{ "blob_id": "6f271e6cfb03977d52c50562c3c394b962c9af83", "index": 7538, "step-1": "<mask token>\n\n\nclass MarkdownBlock(TextBlock):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass MarkdownBlock(TextBlock):\n\n def __init__(self, required=True, help_text=None, **kwargs):\n s...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class Especialidade(models.Model): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Especialidade(models.Model): def __str__(self): return self.nome <|reserved_special_token_0|> <|rese...
flexible
{ "blob_id": "9cc672702d960088f0230cbd1694b295216d8b5a", "index": 4617, "step-1": "<mask token>\n\n\nclass Especialidade(models.Model):\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Especialidade(models.Model):\n\n def __str__(self):\n return self.nome\n <mask token>\n"...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class Yolo(Yolov3): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def freeze(self): graph_def = tf.graph_util.convert_variables_to_constants(sess=self. sess, input_graph_def=tf.get_default_graph().as_graph_def()...
flexible
{ "blob_id": "f3d34379cc7fbfe211eeebec424112f3da0ab724", "index": 7999, "step-1": "<mask token>\n\n\nclass Yolo(Yolov3):\n <mask token>\n <mask token>\n <mask token>\n\n def freeze(self):\n graph_def = tf.graph_util.convert_variables_to_constants(sess=self.\n sess, input_graph_def=tf...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class AppusersClient(BaseClient): <|reserved_special_token_0|> @api(rule='/app_users/app_order_create_info', method='get', is_json_req =True) def app_order_create_info(self, order_id: int=None): """ 订单创建个人账号页信息 :return: """ <|reserv...
flexible
{ "blob_id": "1af6bda6eb4e7a46b22379180ea82e78c67ce771", "index": 4269, "step-1": "<mask token>\n\n\nclass AppusersClient(BaseClient):\n <mask token>\n\n @api(rule='/app_users/app_order_create_info', method='get', is_json_req\n =True)\n def app_order_create_info(self, order_id: int=None):\n ...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> class DaqListType(IntEnum): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DaqListType(IntEnum): <|reserved_special_token_0|> D...
flexible
{ "blob_id": "71e0137fc02b4f56bdf87cc15c275f5cca1588c4", "index": 8925, "step-1": "<mask token>\n\n\nclass DaqListType(IntEnum):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass DaqListType(IntEnum):\n <mask token>\n DAQ = 1\n STIM = 2\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def getLevel(levelName, no_match=logging.NOTSET): """Return the numeric representation of levelName. see getLevelName() for background """ try: result = logging._nameToLevel.get(levelName) if result is not None: return result return int...
flexible
{ "blob_id": "ba8b46f830abaaaedf1730cba2f04fd677f11da4", "index": 182, "step-1": "<mask token>\n\n\ndef getLevel(levelName, no_match=logging.NOTSET):\n \"\"\"Return the numeric representation of levelName.\n\n see getLevelName() for background\n \"\"\"\n try:\n result = logging._nameToLevel.get...
[ 2, 3, 5, 6, 7 ]
import os import pickle import collections import numpy as np import pandas as pd import matplotlib.pyplot as plt from IPython import embed from optimizers.utils_1 import Model_1, Architecture_1 from optimizers.utils import Model, Architecture colors={ 'BOHB-PC-DARTS': 'darkorange', 'BOHB-DARTS': 'dod...
normal
{ "blob_id": "a757bbb9ad2f6f5bf04cdf4091b97841b8e40432", "index": 6601, "step-1": "<mask token>\n\n\ndef get_trajectories(args, global_min, path='regularized_evolution',\n methods=['RE', 'RS']):\n all_trajectories = {}\n for m in methods:\n dfs = []\n for seed in range(500):\n fi...
[ 3, 4, 5, 6, 7 ]
def main(): a, b = map(int, input().split()) diff = abs(max(b, a) - min(a, b)) if diff % 2 != 0: print("IMPOSSIBLE") else: bigger = max(a, b) ans = bigger - (diff//2) print(ans) if __name__ == "__main__": main()
normal
{ "blob_id": "f73cbc25152a63bb6552e2cd8272c67a1f4277ba", "index": 9044, "step-1": "<mask token>\n", "step-2": "def main():\n a, b = map(int, input().split())\n diff = abs(max(b, a) - min(a, b))\n if diff % 2 != 0:\n print('IMPOSSIBLE')\n else:\n bigger = max(a, b)\n ans = bigger...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(a, type(a)) print(a.attr('href')) print(a.attr.href) <|reserved_special_token_1|> <|reserved_special_token_0|> html = """ <div id="container"> <ul class="list"> <li class="item-0">first item</li> ...
flexible
{ "blob_id": "02ab822dacb26d623a474fa45ebb034f9c1291b8", "index": 1604, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(a, type(a))\nprint(a.attr('href'))\nprint(a.attr.href)\n", "step-3": "<mask token>\nhtml = \"\"\"\n <div id=\"container\">\n <ul class=\"list\">\n <li class=\...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while numero_usuario < 0: print( 'Parece que el pirata se ha quedado dormido en la rampa intenta despertarlo ingresando otro nùmero ' ) numero_usuario = int(input( 'Ingrese un nùmero para empezar s...
flexible
{ "blob_id": "1829bd8e87c470a71fea97dd3a47c30477b6e6f1", "index": 3109, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile numero_usuario < 0:\n print(\n 'Parece que el pirata se ha quedado dormido en la rampa intenta despertarlo ingresando otro nùmero '\n )\n numero_usuario = int(i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> print('Hi, I am Nag')
flexible
{ "blob_id": "0ca751e050244fd85c8110d02d5e7a79eb449ada", "index": 8542, "step-1": "<mask token>\n", "step-2": "print('Hi, I am Nag')\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
class Step: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Step: <|reserved_special_token_0|> <|reserved_special_token_0|> def __repr__(self) ->str: return f'Step: {{action: {self.action.__str__()}}}' <|rese...
flexible
{ "blob_id": "9adff5da4e26088def9f0e32aa712a1f2b0336ba", "index": 925, "step-1": "class Step:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "class Step:\n <mask token>\n <mask token>\n\n def __repr__(self) ->str:\n return f'Step: {{action: {self.action.__str__()}}}'\n", "...
[ 1, 2, 3, 4 ]
list_angle_list = RmList() variable_flag = 0 variable_i = 0 def user_defined_shoot(): global variable_flag global variable_i global list_angle_list variable_i = 1 for count in range(3): gimbal_ctrl.angle_ctrl(list_angle_list[1], list_angle_list[2]) gun_ctrl.fire_once() vari...
normal
{ "blob_id": "012e4112970a07559f27fa2127cdffcc557a1566", "index": 4638, "step-1": "<mask token>\n\n\ndef user_defined_shoot():\n global variable_flag\n global variable_i\n global list_angle_list\n variable_i = 1\n for count in range(3):\n gimbal_ctrl.angle_ctrl(list_angle_list[1], list_angle...
[ 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NEURON(NEURONCellTest): def __init__(self): super(NEURON, self).__init__() self.path = '../NEURON/granule.hoc' self.label = 'granule' self.resultsFile = 'results/cells/granule/NEURON.json' self.currentRange = -0.01, 0.1 <|reserved_spe...
flexible
{ "blob_id": "6dbafbcf126c37edb2187eb28c01e2c1125c1c64", "index": 7134, "step-1": "<mask token>\n\n\nclass NEURON(NEURONCellTest):\n\n def __init__(self):\n super(NEURON, self).__init__()\n self.path = '../NEURON/granule.hoc'\n self.label = 'granule'\n self.resultsFile = 'results/ce...
[ 5, 6, 7, 8, 9 ]
/home/co/Documents/ImageClassifier/tensorflow/tensorflow/contrib/tfprof/__init__.py
normal
{ "blob_id": "ca0616694b30f69263db48282bf8b8c130de0fbb", "index": 8774, "step-1": "/home/co/Documents/ImageClassifier/tensorflow/tensorflow/contrib/tfprof/__init__.py", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
""" Copyright (c) 2017 Cyberhaven Copyright (c) 2017 Dependable Systems Laboratory, EPFL Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the right...
normal
{ "blob_id": "e5921edef3d3c56a73f2674f483ea4d1f3577629", "index": 5186, "step-1": "<mask token>\n\n\ndef _get_user_name():\n \"\"\"\n Get the current user.\n \"\"\"\n return pwd.getpwuid(os.getuid())[0]\n\n\ndef _user_belongs_to(group_name):\n \"\"\"\n Check that the current user belongs to the ...
[ 17, 21, 24, 30, 34 ]
from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import View from django.http import HttpResponse from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied class View1(LoginRequir...
normal
{ "blob_id": "826abb18b11afd7a010e2bfc5a29ba068218c23a", "index": 7550, "step-1": "<mask token>\n\n\nclass View1(LoginRequiredMixin, View):\n <mask token>\n <mask token>\n\n\nclass View2(LoginRequiredMixin, View):\n\n def dispatch(self, request, *args, **kwargs):\n response = super().dispatch(requ...
[ 7, 8, 9, 10, 11 ]
from scipy import misc from math import exp import tensorflow as tf import timeit import os dir_path = os.path.dirname(os.path.realpath(__file__)) IMAGE_WIDTH = 30 IMAGE_HEIGHT = 30 IMAGE_DEPTH = 3 IMAGE_PIXELS = IMAGE_WIDTH * IMAGE_HEIGHT def conv2d(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], p...
normal
{ "blob_id": "8b4bd2d267f20775ee5d41f7fe9ef6f6eeab5bb0", "index": 2516, "step-1": "from scipy import misc\nfrom math import exp\nimport tensorflow as tf\nimport timeit\nimport os \n\ndir_path = os.path.dirname(os.path.realpath(__file__))\n\n\nIMAGE_WIDTH = 30\nIMAGE_HEIGHT = 30\nIMAGE_DEPTH = 3\nIMAGE_PIXELS = ...
[ 0 ]
<|reserved_special_token_0|> class AggregateAgent(Addressable, AbstractAgent): @Inject('aggregated_agents:_AggregateAgent__agents') @InjectOptional('locator') def __init__(self, name=None): self.name = name super(AggregateAgent, self).__init__() for agent in self.__agents.values()...
flexible
{ "blob_id": "85903f0c6bd4c896379c1357a08ae3bfa19d5415", "index": 7065, "step-1": "<mask token>\n\n\nclass AggregateAgent(Addressable, AbstractAgent):\n\n @Inject('aggregated_agents:_AggregateAgent__agents')\n @InjectOptional('locator')\n def __init__(self, name=None):\n self.name = name\n ...
[ 7, 10, 11, 13, 15 ]
<|reserved_special_token_0|> def run_perturbation_experiment(nov_an: NoveltyAnalyzer, X_test: np.ndarray, scoring_func: str=None) ->Tuple[Dict[str, List[float]], Dict[str, List[ float]]]: """Runs the perturbation experiment for a single novelty estimator. Parameters ---------- nov_an: Novelty...
flexible
{ "blob_id": "bf3e7f1aa9fd20b69e751da9ac8970c88b1144eb", "index": 9363, "step-1": "<mask token>\n\n\ndef run_perturbation_experiment(nov_an: NoveltyAnalyzer, X_test: np.ndarray,\n scoring_func: str=None) ->Tuple[Dict[str, List[float]], Dict[str, List[\n float]]]:\n \"\"\"Runs the perturbation experiment ...
[ 1, 2, 3, 4, 5 ]
from flask import Flask, render_template, request, redirect, flash, session from mysqlconnection import connectToMySQL from flask_bcrypt import Bcrypt import re app = Flask(__name__) bcrypt = Bcrypt(app) app.secret_key = "something secret10" DATABASE = "exam_quote_dash" EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-...
normal
{ "blob_id": "e732fa0e2b377a87b8b088303b277cc08cb695b3", "index": 5279, "step-1": "<mask token>\n\n\n@app.route('/')\ndef signin():\n return render_template('index.html')\n\n\n<mask token>\n\n\n@app.route('/login', methods=['POST'])\ndef login():\n mysql = connectToMySQL(DATABASE)\n query = 'SELECT * FRO...
[ 9, 10, 12, 13, 15 ]
<|reserved_special_token_0|> class ModuleChecker(misc.WrapperModuleChecker): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @utils.check_messages('consider-merging-classes-inherited') def vis...
flexible
{ "blob_id": "9f34f94422f4847859e9111f34ade2e1274cb543", "index": 8775, "step-1": "<mask token>\n\n\nclass ModuleChecker(misc.WrapperModuleChecker):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @utils.check_messages('consider-merging-classes-inherited')\n def...
[ 24, 28, 33, 42, 46 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of CbM (https://github.com/ec-jrc/cbm). # Author : Konstantinos Anastasakis # Credits : GTCAP Team # Copyright : 2021 European Commission, Joint Research Centre # License : 3-Clause BSD import os import glob from ipywidgets import (Text, Label...
normal
{ "blob_id": "2f9a081845685a4748c8b028ae4ee3a056a10284", "index": 9779, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef foi_tab_v1():\n path_foi = f\"{config.get_value(['paths', 'temp'])}/foi/\"\n path_foi_func = foi_v1.path_foi_func\n progress = Output()\n\n def outlog(*text):\n ...
[ 0, 2, 3, 4, 5 ]
import pytest from flaat.issuers import IssuerConfig, is_url from flaat.test_env import FLAAT_AT, FLAAT_ISS, environment class TestURLs: def test_url_1(self): assert is_url("http://heise.de") def test_valid_url_http(self): assert is_url("http://heise.de") def test_valid_url_https(self):...
normal
{ "blob_id": "021f224d031477bd305644261ad4d79d9eca98b3", "index": 5474, "step-1": "<mask token>\n\n\nclass TestURLs:\n\n def test_url_1(self):\n assert is_url('http://heise.de')\n <mask token>\n <mask token>\n <mask token>\n\n def test_valid_url_https_path(self):\n assert is_url('http...
[ 3, 4, 7, 8, 10 ]
import flask import numpy as np import pandas as pd import requests from bs4 import BeautifulSoup import pickle from recent_earnings_tickers import ok_tickers import re #---------- Model ----------------# #with open('/Users/samfunk/ds/metis/project_mcnulty/code/REPLACE_WITH_MODEL_PICKLE', 'rb') as f: #PREDICTOR =...
normal
{ "blob_id": "3be1947ead65f8e8a9bf73cc8cae2c7d69d8b756", "index": 1641, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home_page():\n with open('/Users/samfunk/ds/metis/project_mcnulty/stock_page.html', 'r'\n ) as viz_file:\n return viz_file.read()\n\n\n<mask token>\n", "step-2": "<mask toke...
[ 1, 3, 4, 5, 6 ]
from __future__ import division import abc import re import numpy as np class NGram(object): SEP = '' def __init__(self, n, text): self.n = n self.load_text(text) self.load_ngram() @abc.abstractmethod def load_text(self, text): pass def load_ngram(self): counts = self.empty_count() ...
normal
{ "blob_id": "41e3c18b02f9d80f987d09227da1fbc6bde0ed1d", "index": 4812, "step-1": "<mask token>\n\n\nclass NGram(object):\n <mask token>\n <mask token>\n\n @abc.abstractmethod\n def load_text(self, text):\n pass\n\n def load_ngram(self):\n counts = self.empty_count()\n c = self...
[ 7, 9, 11, 13, 15 ]
""" """ import json import logging import re import asyncio from typing import Optional import discord from discord.ext import commands import utils logging.basicConfig(level=logging.INFO, format="[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s") log = logging.getLogger("YTEmbedFixer") client = commands.Bot...
normal
{ "blob_id": "d73832d3f0adf22085a207ab223854e11fffa2e8", "index": 6948, "step-1": "<mask token>\n\n\ndef build_embed(_video_url: str, _video_image_url: Optional[str],\n _video_title: Optional[str], _author_name: Optional[str], _author_url:\n Optional[str]) ->discord.Embed:\n embed = discord.Embed(type='v...
[ 1, 2, 3, 4, 5 ]
ALPHABET = 'abcdefghijklmnopqrstuvwxyz' # Convert the ALPHABET to list ALPHABET = [i for i in ALPHABET] output_string = '' input_string = input('Enter a String : ') key = int(input('Enter the key: ')) for letter in input_string: if letter in input_string: # ALPHABET.index(letter) returns the index of that...
normal
{ "blob_id": "b2db622596d0dff970e44759d25360a62f5fea83", "index": 4725, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor letter in input_string:\n if letter in input_string:\n output_string += ALPHABET[(ALPHABET.index(letter) + key) % 26]\n else:\n output_string += letter\nprint(f'En...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class LoginRegistrationAction(LoginRegistration): def check_welcome_xunyou(self): return self.welcome_xunyou().text <|reserved_special_token_0|> def logged_in_random(self): self.phone_id().send_keys('1831111{}'.format(random.randint(1000, 9999)))...
flexible
{ "blob_id": "e5a698979bc84fe733a9bf5cd51e2f078956d468", "index": 2461, "step-1": "<mask token>\n\n\nclass LoginRegistrationAction(LoginRegistration):\n\n def check_welcome_xunyou(self):\n return self.welcome_xunyou().text\n <mask token>\n\n def logged_in_random(self):\n self.phone_id().sen...
[ 14, 18, 20, 25, 26 ]