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|> random.choice(imgs) <|reserved_special_token_0|> print(served_img) <|reserved_special_token_0|> if input == 'yes': print('YOU FLUCKED IT') elif input == 'no': print('WHAT ARE YOU???..') <|reserved_special_token_1|> <|re...
flexible
{ "blob_id": "4ae611ee8c019c76bb5d7c1d733ffb4bd06e2e8d", "index": 5508, "step-1": "<mask token>\n", "step-2": "<mask token>\nrandom.choice(imgs)\n<mask token>\nprint(served_img)\n<mask token>\nif input == 'yes':\n print('YOU FLUCKED IT')\nelif input == 'no':\n print('WHAT ARE YOU???..')\n", "step-3": "<...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class NodeLookup(object): """Converts integer node ID's to human readable labels.""" def __init__(self, label_lookup_path=None, uid_lookup_path=None): if not label_lookup_path: label_lookup_path = os.path.join(FLAGS.model_dir, 'imagenet_2012_ch...
flexible
{ "blob_id": "b4ce95d754dd0d7c1b91fa0348de0194a4397aca", "index": 6830, "step-1": "<mask token>\n\n\nclass NodeLookup(object):\n \"\"\"Converts integer node ID's to human readable labels.\"\"\"\n\n def __init__(self, label_lookup_path=None, uid_lookup_path=None):\n if not label_lookup_path:\n ...
[ 6, 7, 11, 13, 14 ]
<|reserved_special_token_0|> def connectMongoCollection(collection=COLLECTION): uri = 'mongodb://localhost' client = MongoClient(uri) db = client[DB] return db[collection] <|reserved_special_token_1|> <|reserved_special_token_0|> def connectMongo(): uri = 'mongodb://localhost' client = Mo...
flexible
{ "blob_id": "7a5106456d0fdd905829c5aa1f4a69b027f3a04c", "index": 4198, "step-1": "<mask token>\n\n\ndef connectMongoCollection(collection=COLLECTION):\n uri = 'mongodb://localhost'\n client = MongoClient(uri)\n db = client[DB]\n return db[collection]\n", "step-2": "<mask token>\n\n\ndef connectMong...
[ 1, 2, 3, 4, 5 ]
from p5 import * import numpy as np from numpy.random import default_rng from boids import Boid from data import Data n=30; width = 1920 height = 1080 flock=[] infected=[] rng = default_rng() frames=0 for i in range(n): x = rng.integers(low=0, high=1920) y = rng.integers(low=0, high=1080) if i==0: ...
normal
{ "blob_id": "78c4e14e5afdf857082b60bf4020f0f785d93a0d", "index": 9704, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n):\n x = rng.integers(low=0, high=1920)\n y = rng.integers(low=0, high=1080)\n if i == 0:\n flock.append(Boid(x, y, width, height, infected=True, curado=Fa...
[ 0, 3, 4, 5, 6 ]
import random as rnd import pandas as pd from sklearn.metrics import accuracy_score from sklearn.metrics import f1_score from sklearn.metrics import roc_auc_score from sklearn.metrics import confusion_matrix from sklearn.metrics import precision_recall_fscore_support, roc_auc_score import os def mkdir_tree(source): ...
normal
{ "blob_id": "11ca13aca699b1e0744243645b3dbcbb0dacdb7e", "index": 9588, "step-1": "<mask token>\n\n\ndef mkdir_tree(source):\n if source is None:\n source = 'default'\n base_dirs = ['../data/clf_meta/%s/' % source]\n print('base_dirsssssss', base_dirs)\n for base_dir in base_dirs:\n if n...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def nextsteps(point): for ns in nextsteps2d(point): yield ns if point in portals: yield portals[point] def should_visit(point): return lines[point[0]][point[1]] == '.' <|reserved_special_token_0|> def nextsteps_with_recursion(point): i, j, level = poi...
flexible
{ "blob_id": "973fc3a973d952cb0f192221dfda63e255e4a8a0", "index": 2543, "step-1": "<mask token>\n\n\ndef nextsteps(point):\n for ns in nextsteps2d(point):\n yield ns\n if point in portals:\n yield portals[point]\n\n\ndef should_visit(point):\n return lines[point[0]][point[1]] == '.'\n\n\n<m...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from . import scramsha1, scrammer
flexible
{ "blob_id": "8c336edddadbf4689721b474c254ded061ecf4b5", "index": 743, "step-1": "<mask token>\n", "step-2": "from . import scramsha1, scrammer\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
from django import forms from .models import Appointment, Prescription from account.models import User class AppointmentForm(forms.ModelForm): class Meta: model = Appointment fields = '__all__' widgets = { 'date': forms.DateInput(attrs={'type': 'date'}), 'time': for...
normal
{ "blob_id": "d3425017d4e604a8940997afd0c35a4f7eac1170", "index": 6944, "step-1": "<mask token>\n\n\nclass PrescriptionForm(forms.ModelForm):\n\n\n class Meta:\n model = Prescription\n exclude = ['doctor']\n widgets = {'prescription': forms.Textarea(attrs={'rows': 4})}\n\n def __init__(...
[ 2, 3, 4, 5, 6 ]
a = 10 b = 20 c = a + b d = b - a print(c) print(d)
normal
{ "blob_id": "632fdb95874f0beeb6d178788f7c7e7c9e8512e5", "index": 8239, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(c)\nprint(d)\n", "step-3": "a = 10\nb = 20\nc = a + b\nd = b - a\nprint(c)\nprint(d)\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
import numpy as np import pandas as pd import nltk from collections import defaultdict import os.path stop_words = ['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', 'your', 'yours', 'yourself', 'yourselves', 'he', 'him', 'his', 'himself', 'she', 'her', 'hers', 'herself',...
normal
{ "blob_id": "0356b408624988100c10b20facecef14f1552203", "index": 4537, "step-1": "<mask token>\n\n\ndef build_statements_features(df, vectorizer, train=True, tokenizer=\n tokenizer_nltk):\n filtered_statements_dic = {}\n for index, row in df.iterrows():\n filtered_statement = []\n tokenize...
[ 3, 5, 7, 9, 10 ]
import os import json from nltk.corpus import wordnet as wn from itertools import combinations #計算排列組合 # 需要被計算的分類 myTypes = ['animal', 'vehicle', 'food', 'fashion', 'dog', 'cat', 'car', 'motorcycle'] # 計算完網紅權重存放的位置 scorePath = "..\\data\\score" # getUsersData.py儲存網紅貼文資料的json檔案,拿來計算分數 usersDataFile = "..\\data\\us...
normal
{ "blob_id": "879482e4df9c3d7f32d9b2a883201ae043e1189f", "index": 871, "step-1": "<mask token>\n\n\ndef get_similar_words(words):\n words = [w.lower() for w in words]\n if len(words) > 1:\n maxScore = 0\n firstWord = ''\n secondWord = ''\n labelCom = list(combinations(words, 2))\...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if len(sys.argv) != 3: print('Usage: std_dev_eval.py <std_dir> <ans>') quit() <|reserved_special_token_0|> subprocess.call('rm -f {}/result'.format(std_dir), shell=True) <|reserved_special_token_0|> with open(query, 'rb') ...
flexible
{ "blob_id": "ba216642935d19b85e379b66fb514854ebcdedd9", "index": 666, "step-1": "<mask token>\n", "step-2": "<mask token>\nif len(sys.argv) != 3:\n print('Usage: std_dev_eval.py <std_dir> <ans>')\n quit()\n<mask token>\nsubprocess.call('rm -f {}/result'.format(std_dir), shell=True)\n<mask token>\nwith op...
[ 0, 1, 2, 3, 4 ]
from sqlalchemy import Integer, String, Column from sqlalchemy.orm import Query from server import db class Formation(db): __tablename__ = "formation" query: Query id_form = Column(Integer, primary_key=True) filiere = Column(String, nullable=False) lieu = Column(String, nullable=False) niveau = Column(Str...
normal
{ "blob_id": "fff70312fa7c3259cf4c3d9e7ebd8ca5b9a56887", "index": 2714, "step-1": "<mask token>\n\n\nclass Formation(db):\n <mask token>\n query: Query\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @staticmethod\n def create(filiere: str, lieu: str, niveau: str):\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: data = requests.get('http://en.wikipedia.org/wiki/Python') data.raise_for_status() my_data = bs4.BeautifulSoup(data.text, 'lxml') print('List of all the header tags: \n\n') for the_data in my_data.find_all...
flexible
{ "blob_id": "27e9635adf6109f3ab13b9d8dd5809973b61ca03", "index": 413, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n data = requests.get('http://en.wikipedia.org/wiki/Python')\n data.raise_for_status()\n my_data = bs4.BeautifulSoup(data.text, 'lxml')\n print('List of all the header tag...
[ 0, 1, 2, 3 ]
import hashlib import math import random from set5.ch_4 import get_num_byte_len class Server: def __init__(self): self.private_key = random.randint(0, 2**100) self.salt = random.randint(0, 2**100) self.salt_bytes = self.salt.to_bytes( byteorder="big", length=get_n...
normal
{ "blob_id": "cf7aeacedec211e76f2bfcb7f6e3cb06dbfdc36e", "index": 3907, "step-1": "<mask token>\n\n\nclass Server:\n\n def __init__(self):\n self.private_key = random.randint(0, 2 ** 100)\n self.salt = random.randint(0, 2 ** 100)\n self.salt_bytes = self.salt.to_bytes(byteorder='big', leng...
[ 17, 19, 20, 24, 26 ]
import numpy import multiprocessing from functools import partial from textutil.text import read_file from textutil.util import B import mmap import tqdm class Growable(object): def __init__(self, capacity=1024, dtype=numpy.uint32, grow=2): self.grow = grow self.capacity=capacity self.dty...
normal
{ "blob_id": "8a2fe83ab1adae7de94eb168290ce4843ab39fe1", "index": 9476, "step-1": "<mask token>\n\n\nclass Growable(object):\n\n def __init__(self, capacity=1024, dtype=numpy.uint32, grow=2):\n self.grow = grow\n self.capacity = capacity\n self.dtype = dtype\n self.arr = numpy.empty...
[ 5, 6, 7, 9, 10 ]
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainMenu.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWind...
normal
{ "blob_id": "f4094a81f90cafc9ae76b8cf902221cbdbc4871a", "index": 6711, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Ui_MainWindow(object):\n <mask token>\n\n def retranslateUi(self, MainWindow):\n _translate = QtCore.QCoreApplication.translate\n MainWindow.setWindowTitle(_...
[ 0, 2, 3, 4, 5 ]
<|reserved_special_token_0|> def train(env, nb_epochs, nb_epoch_cycles, render_eval, reward_scale, render, param_noise, actor, critic, normalize_returns, normalize_observations, critic_l2_reg, actor_lr, critic_lr, action_noise, popart, gamma, clip_norm, nb_train_steps, nb_rollout_steps, nb_eval_steps,...
flexible
{ "blob_id": "3f92bf194058c97a40cd5728cfc7c9d1be6b2548", "index": 8099, "step-1": "<mask token>\n\n\ndef train(env, nb_epochs, nb_epoch_cycles, render_eval, reward_scale,\n render, param_noise, actor, critic, normalize_returns,\n normalize_observations, critic_l2_reg, actor_lr, critic_lr,\n action_noise,...
[ 2, 3, 4, 5, 6 ]
import matplotlib.pyplot as plt def xyplot(xdata,ydata,title): fname = "/Users/nalmog/Desktop/swa_equipped_cumulative_"+title+".png" #plt.figure(figsize=(500,500)) plt.plot(xdata, ydata) plt.ylabel('some numbers') # plt.savefig("/Users/nalmog/Desktop/swa_equipped_cumulative_"+title+".png", format...
normal
{ "blob_id": "10a7c1827abb8a87f5965453aa2d8f5e8b4914e5", "index": 6563, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef xyplot(xdata, ydata, title):\n fname = '/Users/nalmog/Desktop/swa_equipped_cumulative_' + title + '.png'\n plt.plot(xdata, ydata)\n plt.ylabel('some numbers')\n plt.ti...
[ 0, 1, 2, 3 ]
import tensorflow as tf import tensorflow_io as tfio import h5py class GeneratorVGGNet(): def __call__(self, filename, is_test): with h5py.File(filename, 'r') as hf: keys = list(hf.keys()) for key in keys: if not is_test: for f, g, z in zip(hf[str(key) + "/left-eye"], hf[str(key) +...
normal
{ "blob_id": "f94fcf6ed54f247093050216c0c331ce188da919", "index": 9228, "step-1": "<mask token>\n\n\nclass Dataset:\n\n def __init__(self, config, path, batch_size, shuffle, is_training,\n is_testing):\n self.config = config\n self.is_training = is_training\n self.is_testing = is_te...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def myswap(a, b): temp = a a = b b = temp if a < b: print(a, b) else: print(b, a) <|reserved_special_token_0|> <|reserved_special_token_1|> def myswap(a, b): temp = a a = b b = temp if a < b: pr...
flexible
{ "blob_id": "e6efd2de5f92d66f1b734a2173fc8681af3c4cc8", "index": 8040, "step-1": "<mask token>\n", "step-2": "def myswap(a, b):\n temp = a\n a = b\n b = temp\n if a < b:\n print(a, b)\n else:\n print(b, a)\n\n\n<mask token>\n", "step-3": "def myswap(a, b):\n temp = a\n a = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class CustomUserAdmin(UserAdmin): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class CustomUserAdmin(UserAdmin): list_display = 'username', 'email', 'is_staff', 'is_activ...
flexible
{ "blob_id": "c95eaa09241428f725d4162e0e9f6ed3ce6f8fdd", "index": 6709, "step-1": "<mask token>\n\n\nclass CustomUserAdmin(UserAdmin):\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass CustomUserAdmin(UserAdmin):\n list_display = 'username', 'email', 'is_staff', 'is...
[ 1, 2, 3, 4, 5 ]
import os from pathlib import Path import Algorithmia API_KEY = os.environ.get('ALGO_API_KEY') DATA_DIR_BASE = os.environ.get('DATA_DIR') ORIGINAL_DATA_DIR = DATA_DIR_BASE + 'original/' TRANSFERD_DATA_DIR = DATA_DIR_BASE + 'transferd/' def upload(client, fnames): for im in fnames: im = Path(im) ...
normal
{ "blob_id": "2536b22c2d154e87bdecb72cc967d8c56ddb73fb", "index": 609, "step-1": "<mask token>\n\n\ndef upload(client, fnames):\n for im in fnames:\n im = Path(im)\n client.file(ORIGINAL_DATA_DIR + str(im.name)).put(im.read_bytes())\n\n\n<mask token>\n\n\ndef style_transfer(fnames, out_folder, fi...
[ 2, 3, 4, 5, 6 ]
import thread import time import ctypes lib = ctypes.CDLL('/home/ubuntu/workspace/35SmartPy/CAN/brain/CANlib.so') init = lib.init read = lib.readGun read.restype = ctypes.POINTER(ctypes.c_ubyte * 8) send = lib.sendBrake init()
normal
{ "blob_id": "866571341a587c8b1b25437f5815429875bbe5ad", "index": 9285, "step-1": "<mask token>\n", "step-2": "<mask token>\ninit()\n", "step-3": "<mask token>\nlib = ctypes.CDLL('/home/ubuntu/workspace/35SmartPy/CAN/brain/CANlib.so')\ninit = lib.init\nread = lib.readGun\nread.restype = ctypes.POINTER(ctypes....
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def execute(event, context): print(event) pass <|reserved_special_token_1|> <|reserved_special_token_0|> environ['ACCESS_KEY'] = '1234567890' environ['SECRET_KEY'] = '1234567890' environ['ENDPOINT_URL'] = 'http://loca...
flexible
{ "blob_id": "a4eca0f5b7d5a03ca3600554ae3fe3b94c59fc68", "index": 8622, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef execute(event, context):\n print(event)\n pass\n", "step-3": "<mask token>\nenviron['ACCESS_KEY'] = '1234567890'\nenviron['SECRET_KEY'] = '1234567890'\nenviron['ENDPOINT_U...
[ 0, 1, 2, 3, 4 ]
# Merge sort is used to sort the elements def merge_sort(arr): if len(arr) > 1: # Recursion is used to continuously split the array in half. mid = len(arr) // 2 # Using Auxiliary storage here left = arr[:mid] right = arr[mid:] # Traverse the left side of the array ...
normal
{ "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|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.subplot(121), plt.imshow(canny, cmap='gray') plt.title('Canny'), plt.xticks([]), plt.yticks([]) <|reserved_special_token_0|> cv2.drawContours(imagen, contornos, -1, (255, 0, 0), 2) cv2.imshow('contornos', imagen) cv2.waitKey(0...
flexible
{ "blob_id": "9f42a9d0ca622d6c4e2cf20bc2e494262c16055b", "index": 7744, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.subplot(121), plt.imshow(canny, cmap='gray')\nplt.title('Canny'), plt.xticks([]), plt.yticks([])\n<mask token>\ncv2.drawContours(imagen, contornos, -1, (255, 0, 0), 2)\ncv2.imshow('co...
[ 0, 1, 2, 3, 4 ]
file = open('../_datasets/moby_dick.txt', mode='r') print(file.read()) print(file.closed) file.close() print(file.closed)
normal
{ "blob_id": "dfe0ee5bbb906e5a23adcf06d2d704700fa1567d", "index": 1179, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(file.read())\nprint(file.closed)\nfile.close()\nprint(file.closed)\n", "step-3": "file = open('../_datasets/moby_dick.txt', mode='r')\nprint(file.read())\nprint(file.closed)\nfile...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def on_connection_resumed(connection, return_code, session_present, **kwargs): print('Connection resumed. return_code: {} session_present: {}'.format( return_code, session_present)) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> d...
flexible
{ "blob_id": "2ff398e38b49d95fdc8a36a08eeb5950aaea1bc9", "index": 2279, "step-1": "<mask token>\n\n\ndef on_connection_resumed(connection, return_code, session_present, **kwargs):\n print('Connection resumed. return_code: {} session_present: {}'.format(\n return_code, session_present))\n\n\n<mask token>...
[ 1, 2, 3, 4, 5 ]
REDIRECT_MAP = { '90':'19904201', '91':'19903329', '92':'19899125', '93':'19901043', '94':'19903192', '95':'19899788', '97':'19904423', '98':'19906163', '99':'19905540', '100':'19907871', '101':'19908147', '102':'19910103', '103':'19909980', '104':'19911813', ...
normal
{ "blob_id": "fb92912e1a752f3766f9439f75ca28379e23823f", "index": 3600, "step-1": "<mask token>\n", "step-2": "REDIRECT_MAP = {'90': '19904201', '91': '19903329', '92': '19899125', '93':\n '19901043', '94': '19903192', '95': '19899788', '97': '19904423', '98':\n '19906163', '99': '19905540', '100': '19907...
[ 0, 1, 2 ]
import getpass print('****************************') print('***** Caixa Eletronico *****') print('****************************') account_typed = input("Digite sua conta: ") password_typed = getpass.getpass("Digite sua senha: ")
normal
{ "blob_id": "44b6ee8488869da447882457897ce87b2fdea726", "index": 7846, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('****************************')\nprint('***** Caixa Eletronico *****')\nprint('****************************')\n<mask token>\n", "step-3": "<mask token>\nprint('*******************...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def process_option(food, option): food_name = list(food.keys())[option - 1] food_price = food[food_name] print(food_price) print('You have chosen: ', option, food_name, '!', ' For unit price: ', food_price) q = int(input('How many...
flexible
{ "blob_id": "07bd3c7cacbf8d0e39d06b21456258ad92cb2294", "index": 676, "step-1": "<mask token>\n", "step-2": "def process_option(food, option):\n food_name = list(food.keys())[option - 1]\n food_price = food[food_name]\n print(food_price)\n print('You have chosen: ', option, food_name, '!', ' For u...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python # -*- coding: utf-8 -*- import sqlite3 as lite con = lite.connect('./logs.db') with con: cur = con.cursor() cur.execute("DROP TABLE IF EXISTS log") cur.execute('''CREATE TABLE log (msg_id text, u_id text, username text, first_name text, last_name text, msg text, ch_id text, d...
normal
{ "blob_id": "1c31649ac75214a6d26bcb6d6822579be91e5074", "index": 2748, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith con:\n cur = con.cursor()\n cur.execute('DROP TABLE IF EXISTS log')\n cur.execute(\n 'CREATE TABLE log (msg_id text, u_id text, username text, first_name text, last_n...
[ 0, 1, 2, 3, 4 ]
""" code: pmap_io_test.py """ import os import time import tables as tb import numpy as np from pytest import mark from .. core.system_of_units_c import units from .. database import load_db from .. sierpe import blr from . import tbl_functions as tbl from ....
normal
{ "blob_id": "c36adc3cf5de2f0ae3ee9b9823304df393ebce63", "index": 5679, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@mark.parametrize('filename, with_', (('test_pmaps_auto.h5', \n True), ('test_pmaps_manu.h5', False)))\ndef test_pmap_writer(config_tmpdir, filename, with_,\n s12_dat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> stu.say() p.sayHello() <|reserved_special_token_1|> <|reserved_special_token_0|> stu = p.Student() stu.say() p.sayHello() <|reserved_special_token_1|> import p01 as p stu = p.Student() stu.say() p.sayHello()
flexible
{ "blob_id": "8be3a3d32da208e2f45aad61813bc6f5ea513f01", "index": 9803, "step-1": "<mask token>\n", "step-2": "<mask token>\nstu.say()\np.sayHello()\n", "step-3": "<mask token>\nstu = p.Student()\nstu.say()\np.sayHello()\n", "step-4": "import p01 as p\nstu = p.Student()\nstu.say()\np.sayHello()\n", "step-...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def length_of_cars(car): return len(car) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def length(data): return len(data) <|reserved_special_token_0|> def year(data): return data['year'] <|reserved_special_token_0|> def l...
flexible
{ "blob_id": "5ab8d9eab30d72557f1a85b5b82c0df456e3843d", "index": 1740, "step-1": "<mask token>\n\n\ndef length_of_cars(car):\n return len(car)\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef length(data):\n return len(data)\n\n\n<mask token>\n\n\ndef year(data):\n return data['year']\n\n\n<mask...
[ 1, 3, 4, 5, 6 ]
import math import os import sys import pandas import numpy as np import seaborn as sns import tensorflow as tf import logging # from utils.simulation_functions import simulation_cox_gompertz from utils.preprocessing import formatted_data, normalize_batch, event_t_bin_prob,risk_t_bin_prob,\ batch_t_categorize, next_b...
normal
{ "blob_id": "ebebdb0e79e9d78b818dab3f93d130ccddd2914e", "index": 1185, "step-1": "<mask token>\n\n\ndef saveDatadic(file_path, name, dataset):\n np.save(file_path + name + '_x', dataset['x'])\n np.save(file_path + name + '_t', dataset['t'])\n np.save(file_path + name + '_e', dataset['e'])\n\n\n<mask tok...
[ 7, 10, 14, 17, 18 ]
import unittest from .context import * class BasicTestSuite(unittest.TestCase): """Basic test cases.""" def test_hello_world(self): self.assertEqual(hello_world(), 'hello world') if __name__ == '__main__': unittest.main()
normal
{ "blob_id": "6420d1b9da7ff205e1e138f72b194f63d1011012", "index": 4554, "step-1": "<mask token>\n\n\nclass BasicTestSuite(unittest.TestCase):\n <mask token>\n\n def test_hello_world(self):\n self.assertEqual(hello_world(), 'hello world')\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass Basi...
[ 2, 3, 4, 5 ]
dict1 = [ {'a':1}, {'a':2}, {'a':3} ] a = dict1[1]['a'] # print(a) correlation_dict = {'${class_id}':123} data = {'token': '${self.token}', 'name': 'api测试','class_id': '${class_id}'} for k in data: for key in correlation_dict: if data[k] in key: data[k] = correlation_dict[key] pr...
normal
{ "blob_id": "9c05b39a12ab29db99397e62315efddd8cdf1df4", "index": 456, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor k in data:\n for key in correlation_dict:\n if data[k] in key:\n data[k] = correlation_dict[key]\nprint(data)\n", "step-3": "dict1 = [{'a': 1}, {'a': 2}, {'a': 3...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with tf.Session() as sess: sess.run(tf.initialize_all_variables()) result = sess.run(fetches=s_t, feed_dict={s_t: [state]}) print(result) result = sess.run(fetches=conv2d, feed_dict={s_t: [state]}) print(result...
flexible
{ "blob_id": "5a3b88f899cfb71ffbfac3a78d38b748bffb2e43", "index": 6295, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith tf.Session() as sess:\n sess.run(tf.initialize_all_variables())\n result = sess.run(fetches=s_t, feed_dict={s_t: [state]})\n print(result)\n result = sess.run(fetches=con...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BaseCache(metaclass=ABCMeta): <|reserved_special_token_0|> @abstractmethod def __init__(self, kvstore, makekey, lifetime, fail_silent): self._kvstore = kvstore self._makekey = makekey self._lifetime = lifetime self._fail_silent = fail_sil...
flexible
{ "blob_id": "e810cde7f77d36c6a43f8c277b66d038b143aae6", "index": 6746, "step-1": "<mask token>\n\n\nclass BaseCache(metaclass=ABCMeta):\n <mask token>\n\n @abstractmethod\n def __init__(self, kvstore, makekey, lifetime, fail_silent):\n self._kvstore = kvstore\n self._makekey = makekey\n ...
[ 3, 4, 5, 6, 7 ]
#! /usr/bin/env python3 import arg_parser import colors import logging import sys def parse_args(argv): parser = arg_parser.RemoteRunArgParser() return parser.parse(argv[1:]) def main(argv): logging.basicConfig( format='%(levelname)s: %(message)s', level='INFO', handlers=[colors...
normal
{ "blob_id": "72d1a0689d4cc4f78007c0cfa01611e95de76176", "index": 3908, "step-1": "<mask token>\n\n\ndef main(argv):\n logging.basicConfig(format='%(levelname)s: %(message)s', level='INFO',\n handlers=[colors.ColorizingStreamHandler(sys.stderr)])\n try:\n args = parse_args(argv)\n except Ex...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class WebcamVideoStream: <|reserved_special_token_0|> def start(self): Thread(target=self.update, args=()).start() return self def update(self): while True: if self.stopped: print('returning') cv2.destroyAll...
flexible
{ "blob_id": "8a4fe88bfa39eeeda42198260a1b22621c33183e", "index": 7894, "step-1": "<mask token>\n\n\nclass WebcamVideoStream:\n <mask token>\n\n def start(self):\n Thread(target=self.update, args=()).start()\n return self\n\n def update(self):\n while True:\n if self.stopp...
[ 4, 5, 6, 7, 8 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- try: from espeak import espeak except ImportError: class espeak(): @classmethod def synth(*args): print('Cannot generate speech. Please, install python3-espeak module.') return 1 def run(*args, **kwargs): text = ' '.jo...
normal
{ "blob_id": "cd5929496b13dd0d5f5ca97500c5bb3572907cc5", "index": 2769, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef run(*args, **kwargs):\n text = ' '.join(map(str, args))\n espeak.synth(text)\n", "step-3": "try:\n from espeak import espeak\nexcept ImportError:\n\n\n class espeak:...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def str2bool(v): return v.lower() in ('true', '1') <|reserved_special_token_0|> def add_argument_group(name): arg = parser.add_argument_group(name) arg_lists.append(arg) return arg <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_...
flexible
{ "blob_id": "dfaea1687238d3d09fee072689cfdea392bc78f9", "index": 8967, "step-1": "<mask token>\n\n\ndef str2bool(v):\n return v.lower() in ('true', '1')\n\n\n<mask token>\n\n\ndef add_argument_group(name):\n arg = parser.add_argument_group(name)\n arg_lists.append(arg)\n return arg\n\n\n<mask token>\...
[ 2, 3, 5, 6, 7 ]
#!/usr/bin/python #Program for functions pay scale from user input hrs = raw_input("Enter Hours:") h = float(hrs) rate = raw_input("Enter Rate:") r = float(rate) def computepay(h,r): if (h>40) : pay = (40*r)+(h-40)*1.5*r else: pay = (h*r) return pay print computepay(h,r)
normal
{ "blob_id": "8f30de819412b03ef12009320978cb1becd85131", "index": 2767, "step-1": "#!/usr/bin/python\n#Program for functions pay scale from user input\n\nhrs = raw_input(\"Enter Hours:\")\n\nh = float(hrs)\n\nrate = raw_input(\"Enter Rate:\")\n\nr = float(rate)\n\n\n\ndef computepay(h,r):\n\n if (h>40) : \n\n ...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def crawl(file): gis = GIS() map = gis.map('United States') map job_df = pd.read_csv(Point_v1.CONSULTING_FILE).append(pd.read_csv( Point_v1.DS_FILE)).append(pd.read_csv(Point_v1.SDE_FILE)) company_loc...
flexible
{ "blob_id": "902159d9ad3a1e36b69142518007b5d4bcaef0f3", "index": 1320, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef crawl(file):\n gis = GIS()\n map = gis.map('United States')\n map\n job_df = pd.read_csv(Point_v1.CONSULTING_FILE).append(pd.read_csv(\n Point_v1.DS_FILE)).appe...
[ 0, 1, 2, 3 ]
'Attempts to use <http://countergram.com/software/pytidylib>.' try: import tidylib def tidy(html): html, errors = tidylib.tidy_document(html, options={'force-output': True, 'output-xhtml': True, 'tidy-mark': False}) return html except ImportError: def tidy(html): return html
normal
{ "blob_id": "33ec822f6149a57244edf6d8d99a5b3726600c2e", "index": 3236, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n import tidylib\n\n def tidy(html):\n html, errors = tidylib.tidy_document(html, options={'force-output':\n True, 'output-xhtml': True, 'tidy-mark': False})\...
[ 0, 1, 2 ]
from __future__ import with_statement # this is to work with python2.5 from pyps import workspace, module def invoke_function(fu, ws): return fu._get_code(activate = module.print_code_out_regions) if __name__=="__main__": workspace.delete('paws_out_regions') with workspace('paws_out_regions.c',name='paws_ou...
normal
{ "blob_id": "299432b095f16c3cb4949319705800d06f534cf9", "index": 1017, "step-1": "from __future__ import with_statement # this is to work with python2.5\nfrom pyps import workspace, module\n\ndef invoke_function(fu, ws):\n return fu._get_code(activate = module.print_code_out_regions)\n\nif __name__==\"__m...
[ 0 ]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 1 11:14:13 2019 @author: dobri """ import numpy as np from astropy.stats import circmean x = np.multiply(np.pi,[(0,1/4,2/4,3/4,4/4),(1,5/4,6/4,7/4,8/4),(5/4,5/4,5/4,5/4,5/4),(0/5,2/5,4/5,6/5,8/5)]) s = np.shape(x) phikprime = np.array(x*0, dtype...
normal
{ "blob_id": "c35ecad842477fc8501a763f7eb972f6e7fc13e1", "index": 7525, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor j in range(0, len(x)):\n for k in range(0, len(x[j, :])):\n phikprime[j, k] = np.complex(np.cos(x[j, k]), np.sin(x[j, k]))\n phikprimebar[j] = np.sum(phikprime[j, :]) / s...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def ping_ip_addresses(ip_addresses): result1 = [] result2 = [] for ip_address in ip_addresses: reply = subprocess.run(['ping', '-c', '3', '-n', ip_address], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8') if reply.returncode == 0: ...
flexible
{ "blob_id": "dd7e8556405f07172ce2b1e9f486c2cd2f4bad58", "index": 7613, "step-1": "<mask token>\n\n\ndef ping_ip_addresses(ip_addresses):\n result1 = []\n result2 = []\n for ip_address in ip_addresses:\n reply = subprocess.run(['ping', '-c', '3', '-n', ip_address],\n stdout=subprocess.P...
[ 2, 3, 4, 5, 6 ]
# -*- coding:utf-8 -*- __author__ = 'yangxin_ryan' """ Solutions: 题目要求非递归的中序遍历, 中序遍历的意思其实就是先遍历左孩子、然后是根结点、最后是右孩子。我们按照这个逻辑,应该先循环到root的最左孩子, 然后依次出栈,然后将结果放入结果集合result,然后是根的val,然后右孩子。 """ class BinaryTreeInorderTraversal(object): def inorderTraversal(self, root: TreeNode) -> List[int]: result = list() ...
normal
{ "blob_id": "8e629ee53f11e29aa026763508d13b06f6ced5ba", "index": 940, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass BinaryTreeInorderTraversal(object):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass BinaryTreeInorderTraversal(object):\n\n def inorderTraversal(self, root: TreeNod...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False ...
flexible
{ "blob_id": "ef1b759872de6602646ce095823ff37f043ffd9d", "index": 5148, "step-1": "<mask token>\n", "step-2": "class Solution(object):\n <mask token>\n", "step-3": "class Solution(object):\n\n def isPalindrome(self, x):\n \"\"\"\n :type x: int\n :rtype: bool\n \"\"\"\n ...
[ 0, 1, 2 ]
print('Hello World!') print('2nd Test') d = dict() d['a'] = dict() d['a']['b'] = 5 d['a']['c'] = 6 d['x'] = dict() d['x']['y'] = 10 print(d) print(d['a']) import random random.seed(30) r = random.randrange(0,5) print(r) import numpy as np np.random.seed for i in range(20): newArray = list(set(np.random.ran...
normal
{ "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 ]
from django.conf import settings from django.contrib import admin from django.urls import path, include, reverse_lazy from django.views.generic import RedirectView, TemplateView from mainapp.views import ShortURLRedirect urlpatterns = [ path('', TemplateView.as_view(template_name='mainapp/index.html'), name='inde...
normal
{ "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 ]
# system import os import numpy as np import random import copy import time # ROS import rospy import std_msgs.msg import sensor_msgs.msg import geometry_msgs.msg import visualization_msgs.msg import tf2_ros import rosbag import actionlib from actionlib_msgs.msg import GoalStatus import ros_numpy # spartan ROS import...
normal
{ "blob_id": "33867677611ceb757f6973eb70368c9f75f3ce92", "index": 1341, "step-1": "# system\nimport os\nimport numpy as np\nimport random\nimport copy\nimport time\n\n# ROS\nimport rospy\nimport std_msgs.msg\nimport sensor_msgs.msg\nimport geometry_msgs.msg\nimport visualization_msgs.msg\nimport tf2_ros\nimport r...
[ 0 ]
#!/usr/bin/python3 from datetime import datetime import time import smbus SENSOR_DATA_FORMAT = "Speed: {} km/h\nSteering: {}\nThrottle: {}\nTemperature: {} C" class SensorDataFrame: def __init__(self, data): self.speed, self.steering, self.throttle, self.temp = data self.timestamp = datetime.now...
normal
{ "blob_id": "cf4170760fe6210d8b06f179484258f4ae3f8796", "index": 7284, "step-1": "<mask token>\n\n\nclass SensorDataFrame:\n\n def __init__(self, data):\n self.speed, self.steering, self.throttle, self.temp = data\n self.timestamp = datetime.now()\n\n def __str__(self):\n return SENSOR...
[ 4, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def strategy(history, memory): if not history.size: counts.clear() for x in patterns: counts.append(0) if memory: return memory.pop(0), memory for i, (pattern, response) in enumera...
flexible
{ "blob_id": "8ae6630ccd2f2b5a10401cadb4574772f6ecbc4a", "index": 4478, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef strategy(history, memory):\n if not history.size:\n counts.clear()\n for x in patterns:\n counts.append(0)\n if memory:\n return memory.pop(0...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> test_beam.add_support(0, 'roller') test_beam.add_support(2, 'roller') test_beam.add_support(6, 'pin') test_beam.add_support(4, 'hinge') test_beam.add_distributed_load(0, 4, -5) test_beam.add_distributed_load(4, 6, '-(-3*(x-5)**2 +...
flexible
{ "blob_id": "bdbeebab70a6d69e7553807d48e3539b78b48add", "index": 2946, "step-1": "<mask token>\n", "step-2": "<mask token>\ntest_beam.add_support(0, 'roller')\ntest_beam.add_support(2, 'roller')\ntest_beam.add_support(6, 'pin')\ntest_beam.add_support(4, 'hinge')\ntest_beam.add_distributed_load(0, 4, -5)\ntest_...
[ 0, 1, 2, 3, 4 ]
# Find a list of patterns in a list of string in python any([ p in s for p in patterns for s in strings ])
normal
{ "blob_id": "c0b6c0636d1900a31cc455795838eb958d1daf65", "index": 9421, "step-1": "<mask token>\n", "step-2": "any([(p in s) for p in patterns for s in strings])\n", "step-3": "# Find a list of patterns in a list of string in python\nany([ p in s for p in patterns for s in strings ])\n", "step-4": null, "...
[ 0, 1, 2 ]
from rlbot.agents.base_agent import BaseAgent, GameTickPacket, SimpleControllerState #from rlbot.utils.structures.game_data_struct import GameTickPacket from Decisions.challengeGame import ChallengeGame from Decisions.info import MyInfo, Car from Decisions.strat import Strategy from Drawing.Drawing import DrawingTool f...
normal
{ "blob_id": "1a0d4e77f09b4ce752631ae36a83ff57f96b89b1", "index": 600, "step-1": "<mask token>\n\n\nclass MyBot(BaseAgent):\n <mask token>\n\n def initialize_agent(self):\n self.boost_pad_tracker.initialize_boosts(self.get_field_info())\n self.info = MyInfo(self.team, self.index)\n self...
[ 5, 6, 7, 8, 9 ]
''' EXERCICIO: Faça um programa que leia quantidade de pessoas que serão convidadas para uma festa. O programa irá perguntar o nome de todas as pessoas e colcar num lista de convidados. Após isso deve imprimir todos os nomes da lista ''' ''' qtd = int(input("Quantas pessoas vão ser convidadas?")) lista_pe...
normal
{ "blob_id": "426a8fb6d1adf5d4577d299083ce047c919dda67", "index": 3525, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Programinha de controle de festinhas 1.0')\nprint('#' * 20)\n<mask token>\nwhile i <= numero_de_convidados:\n nome_do_convidado = input('Coloque o nome do convidado #' + str(i) ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('./KF31.txt', 'w') as writeFile: with open(txt, 'r') as readFile: for text in readFile: listData = text.split('\t') surface = listData[0] if surface == 'EOS\n': ...
flexible
{ "blob_id": "778ee9a0ea7f57535b4de88a38cd741f2d46e092", "index": 6966, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('./KF31.txt', 'w') as writeFile:\n with open(txt, 'r') as readFile:\n for text in readFile:\n listData = text.split('\\t')\n surface = listData[0...
[ 0, 1, 2, 3 ]
__version__ = '1.1.3rc0'
normal
{ "blob_id": "2e5bbc8c6a5eac2ed71c5d8619bedde2e04ee9a6", "index": 4932, "step-1": "<mask token>\n", "step-2": "__version__ = '1.1.3rc0'\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for string_address in ['192.168.1.1', '127.0.0.1']: packed = socket.inet_aton(string_address) print('Originale :', string_address) print('Impacchettato:', binascii.hexlify(packed)) print('Spacchettato :', socket...
flexible
{ "blob_id": "01626772b0f47987157e9f92ba2ce66a0ec2dcb4", "index": 4379, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor string_address in ['192.168.1.1', '127.0.0.1']:\n packed = socket.inet_aton(string_address)\n print('Originale :', string_address)\n print('Impacchettato:', binascii.hexli...
[ 0, 1, 2, 3 ]
import pandas as pd import numpy as np import logging import sklearn from joblib import load import sys import warnings import os if not sys.warnoptions: warnings.simplefilter("ignore") class model: def __init__(self): #from number to labels self.number_to_label = {1 : "Bot",2 : 'DoS attack',3...
normal
{ "blob_id": "c0f3a957613a4f4e04aeb3eb2e3fa4053bd0122c", "index": 8438, "step-1": "<mask token>\n\n\nclass model:\n\n def __init__(self):\n self.number_to_label = {(1): 'Bot', (2): 'DoS attack', (3):\n 'Brute Force', (5): 'DDoS attacks', (4): 0}\n try:\n self.model = load('....
[ 4, 5, 6, 8, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in range(2, 100): lst.append(i * 100) lst.append(i * 10000) lst.append(10000) print(297) print(*lst) <|reserved_special_token_1|> w = int(input()) lst = [(i + 1) for i in range(100)] for i in range(2, 100): ls...
flexible
{ "blob_id": "1d004ec0f4f5c50f49834f169812737d16f22b96", "index": 3967, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(2, 100):\n lst.append(i * 100)\n lst.append(i * 10000)\nlst.append(10000)\nprint(297)\nprint(*lst)\n", "step-3": "w = int(input())\nlst = [(i + 1) for i in range(10...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(' Podaj 5 imion') for i in range(1, 6): imie = input(f' Podaj imie nr {i} ') plik.write(f' {imie} \n') plik.close() <|reserved_special_token_0|> for i in range(1, 101): plik.write(str(i)) plik.write('\n') pli...
flexible
{ "blob_id": "0ac99e2b33f676a99674c9a8e5d9d47c5bce084b", "index": 5820, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(' Podaj 5 imion')\nfor i in range(1, 6):\n imie = input(f' Podaj imie nr {i} ')\n plik.write(f' {imie} \\n')\nplik.close()\n<mask token>\nfor i in range(1, 101):\n plik.wri...
[ 0, 1, 2, 3 ]
from pyecharts.charts.pie import Pie from pyecharts.charts.map import Map import static.name_map from pymongo import MongoClient # html代码头尾 html1 = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>疫情数据可视化</title><script src="/static/echarts/echarts.js"></script><script src="/static/china.js"></...
normal
{ "blob_id": "f1c65fc4acafbda59aeea4f2dfca2cf5012dd389", "index": 8982, "step-1": "<mask token>\n\n\ndef make_PieChart(country):\n global Data\n Data = []\n client = MongoClient()\n db = client.mydb\n if country == 'China':\n tb = db.ChinaData\n else:\n tb = db.WorldData\n re = ...
[ 2, 3, 4, 5, 6 ]
# -*- coding: utf-8 -*- import math # 冒泡排序(Bubble Sort) # 比较相邻的元素。如果第一个比第二个大,就交换它们两个; # 对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对,这样在最后的元素应该会是最大的数; # 针对所有的元素重复以上的步骤,除了最后一个; # 重复步骤1~3,直到排序完成。 # 冒泡排序总的平均时间复杂度为:O(n^2) def bubble_sort(input): print("\nBubble Sort") input_len = len(input) print("length of input: %d" % i...
normal
{ "blob_id": "c967aa647a97b17c9a7493559b9a1577dd95263a", "index": 7806, "step-1": "<mask token>\n\n\ndef select_sort(input):\n print('\\nSelect Sort')\n input_len = len(input)\n for i in range(0, input_len):\n min_index = i\n for j in range(i + 1, input_len):\n if input[j] < inpu...
[ 1, 6, 7, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def search(self, nums: List[int], target: int) ->int: n = len(nums) left, right = 0, n - 1 found = Fal...
flexible
{ "blob_id": "1fe6fab717a77f13ddf7059ef0a5aaef217f0fb0", "index": 5525, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n\n\n<mask token>\n", "step-3": "class Solution:\n\n def search(self, nums: List[int], target: int) ->int:\n n = len(nums)\n left, right = 0, n - 1\...
[ 0, 1, 2, 3 ]
from datetime import datetime, timedelta from request.insider_networking import InsiderTransactions from db import FinanceDB from acquisition.symbol.financial_symbols import Financial_Symbols class FintelInsiderAcquisition(): def __init__(self, trading_date=None): self.task_name = 'FintelInsiderAcquisiti...
normal
{ "blob_id": "08b13069020696d59028003a11b0ff06014a4c68", "index": 3779, "step-1": "<mask token>\n\n\nclass FintelInsiderAcquisition:\n\n def __init__(self, trading_date=None):\n self.task_name = 'FintelInsiderAcquisition'\n self.trading_date = trading_date\n self.symbols = Financial_Symbol...
[ 5, 7, 9, 10, 11 ]
<|reserved_special_token_0|> def getBboxes(bboxes): return [bb for bb in bboxes if sum(bb) > 0.0] <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('./{0}_??.txt'.format(searchAreaName)) <|reserved_special_token_0|> def getBboxes(bboxes): return [bb for bb in ...
flexible
{ "blob_id": "8f9d823785d42d02a0a3d901d66b46a5cd59cdd7", "index": 7465, "step-1": "<mask token>\n\n\ndef getBboxes(bboxes):\n return [bb for bb in bboxes if sum(bb) > 0.0]\n\n\n<mask token>\n", "step-2": "<mask token>\nprint('./{0}_??.txt'.format(searchAreaName))\n<mask token>\n\n\ndef getBboxes(bboxes):\n ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> try: alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' idx = eval(input('请输入一个整数')) print(alp[idx]) except NameError: print('输入错误,请输入一个整数') except: print('其他错误') else: print('没有发生错误') finally: print('程序执行完毕,不知道是否发生了异常') <|reserved_special_token...
flexible
{ "blob_id": "99a6b450792d434e18b8f9ff350c72abe5366d95", "index": 153, "step-1": "<mask token>\n", "step-2": "try:\n alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n idx = eval(input('请输入一个整数'))\n print(alp[idx])\nexcept NameError:\n print('输入错误,请输入一个整数')\nexcept:\n print('其他错误')\nelse:\n print('没有发生错误')\...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class Command: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Command...
flexible
{ "blob_id": "91cef72962332e7efcc86f1b19da4382bd72a466", "index": 9278, "step-1": "<mask token>\n\n\nclass Command:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Command:\n <mask token>\n <mask token>\n ...
[ 1, 3, 4, 5, 6 ]
# Copyright 2021 QuantumBlack Visual Analytics Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # THE SOFTWARE IS PROVIDED "AS IS",...
normal
{ "blob_id": "0069a61127c5968d7014bdf7f8c4441f02e67df0", "index": 6541, "step-1": "<mask token>\n\n\nclass WaitForException(Exception):\n \"\"\"WaitForException: if func doesn't return expected result within the specified time\"\"\"\n\n\ndef _wait_for(func: Callable, expected_result: Any=True, timeout: int=10,...
[ 4, 5, 6, 7, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> DATABASE_NAME = 'user_db' <|reserved_special_token_1|> DATABASE_NAME = "user_db"
flexible
{ "blob_id": "8c8bbbc682889c8d79c893f27def76ad70e8bf8d", "index": 233, "step-1": "<mask token>\n", "step-2": "DATABASE_NAME = 'user_db'\n", "step-3": "DATABASE_NAME = \"user_db\"", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
from datetime import date atual = date.today().year totmaior = 0 totmenor = 0 for pessoas in range(1, 8): nasc = int(input(f'Qual sua data de nascimento? {pessoas}º: ')) idade = atual - nasc if idade >= 21: totmaior += 1 else: totmenor += 1 print(f'Ao todo tivemos {totmaior} pessoas maio...
normal
{ "blob_id": "f6d7ce2d020d11086640a34aac656098ab0b0f33", "index": 9495, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor pessoas in range(1, 8):\n nasc = int(input(f'Qual sua data de nascimento? {pessoas}º: '))\n idade = atual - nasc\n if idade >= 21:\n totmaior += 1\n else:\n ...
[ 0, 1, 2, 3 ]
from fastapi import FastAPI from pydantic import BaseModel from typing import List, Optional from joblib import load app = FastAPI() clf = load("model.joblib") class PredictionRequest(BaseModel): feature_vector: List[float] score: Optional[bool] = False @app.post("/prediction") def predict(req: PredictionReq...
normal
{ "blob_id": "d6fa3039c0987bf556c5bd78b66eb43543fd00fe", "index": 6343, "step-1": "<mask token>\n\n\nclass PredictionRequest(BaseModel):\n feature_vector: List[float]\n score: Optional[bool] = False\n\n\n@app.post('/prediction')\ndef predict(req: PredictionRequest):\n prediction = clf.predict([req.featur...
[ 3, 4, 5, 6, 7 ]
<<<<<<< HEAD {'_data': [['Common', [['Skin', u'Ospecifika hud-reakti oner'], ['General', u'Tr\xf6tthet']]], ['Uncommon', [['GI', u'Buksm\xe4rta, diarr\xe9, f\xf6r-stoppnin g, illam\xe5ende (dessa symptom g\xe5r vanligt-vis \xf6ver vid fortsatt behandling).']]], ['Rare', ...
normal
{ "blob_id": "efe13de4ed5a3f42a9f2ece68fd329d8e3147ca2", "index": 4869, "step-1": "<<<<<<< HEAD\n{'_data': [['Common', [['Skin', u'Ospecifika hud-reakti oner'], ['General', u'Tr\\xf6tthet']]],\n ['Uncommon',\n [['GI',\n u'Buksm\\xe4rta, diarr\\xe9, f\\xf6r-stoppnin g, illam\\xe5e...
[ 0 ]
from turtle import Turtle class Paddle(Turtle): def __init__(self, x_position, y_position): super().__init__() self.shape('square') self.shapesize(stretch_wid=5, stretch_len=1) self.penup() self.color("white") self.goto(x=x_position, y=y_position) self.speed...
normal
{ "blob_id": "f49b80d0b8b42bafc787a36d0a8be98ab7fa53e7", "index": 3558, "step-1": "<mask token>\n\n\nclass Paddle(Turtle):\n <mask token>\n\n def up(self):\n y_pos = self.ycor()\n x_pos = self.xcor()\n self.goto(y=y_pos + 20, x=x_pos)\n\n def down(self):\n y_pos = self.ycor()\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def velocity_field_visualization(xmin, xmax, ymin, ymax): with open('data_sample/argo_MixtureModel_%d_%d_%d_%d' % (xmin, xmax, ymin, ymax), 'rb') as mix_np: mix_model = pickle.load(mix_np) with open('data...
flexible
{ "blob_id": "1284de6474e460f0d95f5c76d066b948bce59228", "index": 5575, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef velocity_field_visualization(xmin, xmax, ymin, ymax):\n with open('data_sample/argo_MixtureModel_%d_%d_%d_%d' % (xmin, xmax,\n ymin, ymax), 'rb') as mix_np:\n mix...
[ 0, 1, 2, 3, 4 ]
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-02 14:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import mptt.fields class Migration(migrations.Migration): dependencies = [ ('barriers', '0011_auto_20170904_1658'), ...
normal
{ "blob_id": "645f8f1ebd3bfa0ba32d5be8058b07e2a30ba9b5", "index": 1314, "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 = [('barriers', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> app_name = 'directory' urlpatterns = [re_path('^directory/uploader/?$', UploaderAPIView.as_view(), name='teacher_uploader'), re_path('^directory/teachers/?$', TeacherListAPIView.as_view(), name='teacher_list'), path( '...
flexible
{ "blob_id": "666e839b4d66dc4eede4e7325bfd4f4b801fd47d", "index": 5330, "step-1": "<mask token>\n", "step-2": "<mask token>\napp_name = 'directory'\nurlpatterns = [re_path('^directory/uploader/?$', UploaderAPIView.as_view(),\n name='teacher_uploader'), re_path('^directory/teachers/?$',\n TeacherListAPIVie...
[ 0, 1, 2, 3 ]
""" Class implementing ReportGenerator """ from urllib.parse import urlparse import requests from src.classes.reporter.flag import Flag from src.classes.reporter.line_finder import LineFinder class ReportGenerator(object): """ Class designed to generate reports after CSP audition The ReportGenerator cla...
normal
{ "blob_id": "2003060f7793de678b4a259ad9424cd5927a57f7", "index": 3167, "step-1": "<mask token>\n\n\nclass ReportGenerator(object):\n <mask token>\n <mask token>\n\n def run(self, html, url):\n print('[#] Running the report generator')\n self.html = html\n self.getting_flags_location...
[ 8, 13, 14, 15, 17 ]
def resolve_data(raw_data, derivatives_prefix): derivatives = {} if isinstance(raw_data, dict): for k, v in raw_data.items(): if isinstance(v, dict): derivatives.update(resolve_data(v, derivatives_prefix + k + '_')) elif isinstance(v, list): ...
normal
{ "blob_id": "31b109d992a1b64816f483e870b00c703643f514", "index": 6577, "step-1": "<mask token>\n", "step-2": "def resolve_data(raw_data, derivatives_prefix):\n derivatives = {}\n if isinstance(raw_data, dict):\n for k, v in raw_data.items():\n if isinstance(v, dict):\n de...
[ 0, 1 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def foo_6(x, y): return y, x <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def foo_6(x, y): return y, x <|reserved_special_token_0|> foo_6(a, b) print(a, b) <|reserved_...
flexible
{ "blob_id": "ad5a9e353d065eee477381aa6b1f233f975ea0ed", "index": 3374, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef foo_6(x, y):\n return y, x\n\n\n<mask token>\n", "step-3": "<mask token>\n\n\ndef foo_6(x, y):\n return y, x\n\n\n<mask token>\nfoo_6(a, b)\nprint(a, b)\n", "step-4": "<...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/python #encoding=utf-8 import os, sys rules = { 'E': ['A'], 'A': ['A+M', 'M'], 'M': ['M*P', 'P'], 'P': ['(E)', 'N'], 'N': [str(i) for i in range(10)], } #st为要扫描的字符串 #target为终止状态,即最后的可接受状态 def back(st, target): reduced_sets = set() #cur为当前规约后的字符串,hist为记录的规约规则 def _back(cur, ...
normal
{ "blob_id": "93953f025fed2bcabf29433591689c0a7adf9569", "index": 8757, "step-1": "#!/usr/bin/python\n#encoding=utf-8\n\nimport os, sys\n\nrules = {\n 'E': ['A'],\n 'A': ['A+M', 'M'],\n 'M': ['M*P', 'P'],\n 'P': ['(E)', 'N'],\n 'N': [str(i) for i in range(10)],\n}\n\n#st为要扫描的字符串\n#target为终止状态,即最后的可...
[ 0 ]
from tkinter import* me=Tk() me.geometry("354x460") me.title("CALCULATOR") melabel = Label(me,text="CALCULATE HERE",bg='PINK',font=("ARIAL",25)) melabel.pack(side=TOP) me.config(background='BROWN') displayStr=StringVar() op="" def but(a): global op op=op+str(a) displayStr.set(op) def eq(): ...
normal
{ "blob_id": "106cca8af164fa4ae946f77b40c76e03accf171c", "index": 9645, "step-1": "<mask token>\n\n\ndef but(a):\n global op\n op = op + str(a)\n displayStr.set(op)\n\n\ndef eq():\n global op\n result = str(eval(op))\n displayStr.set(result)\n op = ''\n\n\ndef clrbut():\n displayStr.set(''...
[ 3, 4, 5, 6, 7 ]
class Solution: # @param num, a list of integer # @return an integer def longestConsecutive(self, num): sted = {} n = len(num) for item in num: if item in sted: continue sted[item] = item if item-1 in sted: sted[item...
normal
{ "blob_id": "d7c4bee7245dab1cbb90ee68b8e99994ce7dd219", "index": 3295, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def longestConsecutive(self, num):\n sted = {}\n n = len(num)\n for item in num:\n if item in s...
[ 0, 1, 2, 3 ]
# Bengisu Ayan - 2236974 # Ceren Gürsoy - 2237485 import numpy as np import cv2 B1 = "THE3-Images/B1.jpg" B2 = "THE3-Images/B2.jpg" B3 = "THE3-Images/B3.jpg" B4 = "THE3-Images/B4.jpg" B5 = "THE3-Images/B5.jpg" def segmentation_function(image, name, blue_mask=False, white_mask=False, yellow_mask=False): # Smo...
normal
{ "blob_id": "1614157c57b3d1b30087c42cb840d617dc91eecb", "index": 493, "step-1": "<mask token>\n\n\ndef segmentation_function(image, name, blue_mask=False, white_mask=False,\n yellow_mask=False):\n image = cv2.GaussianBlur(image, (11, 11), 0)\n hsv_image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)\n low_...
[ 1, 2, 3, 4, 5 ]
from google.cloud import pubsub_v1 import os from flask import Flask, request, jsonify from google.cloud import pubsub_v1 import os from gcloud import storage import json import datetime import time app = Flask(__name__) os.environ[ "GOOGLE_APPLICATION_CREDENTIALS"] = "/home/vishvesh/Documents/Dal/serverless/api-...
normal
{ "blob_id": "a76a0631c97ba539019790e35136f6fd7573e461", "index": 5469, "step-1": "<mask token>\n\n\n@app.route('/publish', methods=['GET', 'POST'])\ndef publish():\n topic_user = request.args.get('touser')\n sub_user = request.args.get('fromuser')\n subscription_id = sub_user\n msg = request.args.get...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> class settings: <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_s...
flexible
{ "blob_id": "5e06dfb7aac64b5b98b4c0d88a86f038baf44feb", "index": 5412, "step-1": "<mask token>\n\n\nclass settings:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\nclass settings:\n order = pf.FIT_...
[ 1, 3, 4, 5, 6 ]
import urllib2 import urllib import json import gzip from StringIO import StringIO service_url = 'https://babelfy.io/v1/disambiguate' lang = 'EN' key = '' filehandle = open('triples/triples2.tsv') # the triples and the sentences where the triples were extracted filehandle_write = open('triples/disambiguated_triples...
normal
{ "blob_id": "cd9f94d55eb13f5fc9959546e89a0af8ab2ea0db", "index": 6147, "step-1": "import urllib2\nimport urllib\nimport json\nimport gzip\n\nfrom StringIO import StringIO\n\nservice_url = 'https://babelfy.io/v1/disambiguate'\nlang = 'EN'\nkey = ''\n\nfilehandle = open('triples/triples2.tsv') # the triples and t...
[ 0 ]
<|reserved_special_token_0|> class DeepFont(tf.keras.Model): def __init__(self): super(DeepFont, self).__init__() self.batch_size = 128 self.model = tf.keras.Sequential() self.model.add(tf.keras.layers.Reshape((96, 96, 1))) self.model.add(tf.keras.layers.Conv2D(trainable=F...
flexible
{ "blob_id": "919239391c6f74d0d8627d3b851beb374eb11d25", "index": 4785, "step-1": "<mask token>\n\n\nclass DeepFont(tf.keras.Model):\n\n def __init__(self):\n super(DeepFont, self).__init__()\n self.batch_size = 128\n self.model = tf.keras.Sequential()\n self.model.add(tf.keras.laye...
[ 10, 11, 12, 13, 14 ]
<|reserved_special_token_0|> def upsample1(d, p): assert 1 <= p <= 10 return d + p def upsample2(d, p): assert 2 <= p <= 3 return d * p def downsample(d, p): assert 2 <= p <= 10 return math.ceil(d / p) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_...
flexible
{ "blob_id": "cb6f68c8b8a6cead1d9fcd25fa2a4e60f7a8fb28", "index": 9746, "step-1": "<mask token>\n\n\ndef upsample1(d, p):\n assert 1 <= p <= 10\n return d + p\n\n\ndef upsample2(d, p):\n assert 2 <= p <= 3\n return d * p\n\n\ndef downsample(d, p):\n assert 2 <= p <= 10\n return math.ceil(d / p)\...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def find_saddle_points(A): B = [] for i in range(A.shape[0]): min_r = np.min(A[i]) ind_r = 0 max_c = 0 ind_c = 0 for j in range(A.shape[1]): if A[i][j] == min_r: min_r = A[i][j] ind_r = j ...
flexible
{ "blob_id": "808fe8f106eaff00cf0080edb1d8189455c4054b", "index": 6706, "step-1": "<mask token>\n\n\ndef find_saddle_points(A):\n B = []\n for i in range(A.shape[0]):\n min_r = np.min(A[i])\n ind_r = 0\n max_c = 0\n ind_c = 0\n for j in range(A.shape[1]):\n if A...
[ 5, 8, 9, 11, 12 ]
<|reserved_special_token_0|> class MongoStorage(object): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, connection): self._connection = connection self._collection = connection.objects ...
flexible
{ "blob_id": "816c11717c4f26b9013f7a83e1dfb2c0578cbcf8", "index": 1269, "step-1": "<mask token>\n\n\nclass MongoStorage(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, connection):\n self._connection = connection\n self._collection = connect...
[ 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def vowel_links(txt): import re lst = txt.split(' ') for i in range(len(lst) - 1): if re.search('[aeiou]', lst[i][-1]) and re.search('[aeiou]', lst[i + 1][0]): return True return F...
flexible
{ "blob_id": "eefd94e7c04896cd6265bbacd624bf7e670be445", "index": 4347, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef vowel_links(txt):\n import re\n lst = txt.split(' ')\n for i in range(len(lst) - 1):\n if re.search('[aeiou]', lst[i][-1]) and re.search('[aeiou]', lst[i +\n ...
[ 0, 1, 2 ]
# models.py from sentiment_data import * from utils import * import nltk from nltk.corpus import stopwords import numpy as np from scipy.sparse import csr_matrix class FeatureExtractor(object): """ Feature extraction base type. Takes a sentence and returns an indexed list of features. """ def get_inde...
normal
{ "blob_id": "5d8d47d77fba9027d7c5ec4e672fc0c597b76eae", "index": 4091, "step-1": "<mask token>\n\n\nclass UnigramFeatureExtractor(FeatureExtractor):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass BigramFeatureExtractor(FeatureExtractor):\n \"\"\"\n Bigram feature extractor analogous to th...
[ 22, 29, 30, 31, 34 ]