code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
<|reserved_special_token_0|> @register.inclusion_tag('user/user_list.html') def user_list(): """show user name list""" users = User.objects.all() return {'users': users} @register.simple_tag() def accept_request(pk_login_user, pk_other_user): RequestFollow.objects.accept_request(pk_login_user, pk_ot...
flexible
{ "blob_id": "999c19fd760ffc482a15f5a14e188d416fcc5f21", "index": 7218, "step-1": "<mask token>\n\n\n@register.inclusion_tag('user/user_list.html')\ndef user_list():\n \"\"\"show user name list\"\"\"\n users = User.objects.all()\n return {'users': users}\n\n\n@register.simple_tag()\ndef accept_request(pk...
[ 4, 5, 6, 7, 8 ]
import sys import pathlib from matplotlib import pyplot as plt import matplotlib as mpl script_name = pathlib.Path(sys.argv[0]).stem FIGURES_DIR = pathlib.Path( __file__).parents[2] / "figures" / "simulations" / script_name FIGURES_DIR.mkdir(exist_ok=True, parents=True) # mpl.rc("text", usetex=True) # mpl.rc("fo...
normal
{ "blob_id": "fc26574ac8628d7e2896e3e6d055ac61264c7db0", "index": 1302, "step-1": "<mask token>\n", "step-2": "<mask token>\nFIGURES_DIR.mkdir(exist_ok=True, parents=True)\n", "step-3": "<mask token>\nscript_name = pathlib.Path(sys.argv[0]).stem\nFIGURES_DIR = pathlib.Path(__file__).parents[2\n ] / 'figure...
[ 0, 1, 2, 3, 4 ]
# Class 1: Flight which contains the flight number(f_id), its origin and destination, the number of stops between the # origin and destination and the type of airlines(f_type) class Flight(): # INIT CONSTRUCTOR def __init__(self, f_id, f_origin, f_destination, no_of_stops, flight_type, p_id, p_type): s...
normal
{ "blob_id": "95a2f5abb37642651316a8954a4289e5b04e4916", "index": 4357, "step-1": "<mask token>\n\n\nclass Passenger(Person):\n <mask token>\n <mask token>\n\n def __init__(self, p_id, p_type, p_gender, p_name, p_phonenumber, f_id,\n pno, f_origin, f_destination, no_of_stops, flight_type):\n ...
[ 5, 7, 13, 16, 17 ]
<|reserved_special_token_0|> class BookRoomThread(threading.Thread): <|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_spe...
flexible
{ "blob_id": "ae775e25179546156485e15d05491e010cf5daca", "index": 9360, "step-1": "<mask token>\n\n\nclass BookRoomThread(threading.Thread):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask ...
[ 3, 8, 15, 17, 18 ]
<|reserved_special_token_0|> class Solution: def __new__(self, p): nr_counts, nr_consonants, replaced = self.count_vowels_consonants(self, p) inversed = ''.join(c.lower() if c.isupper() else c.upper() for c in p) replaced_by_ = p.replace(' ', '-') combined_queries = st...
flexible
{ "blob_id": "ec9de8d54113806ab327f05e077edefa74258adb", "index": 2662, "step-1": "<mask token>\n\n\nclass Solution:\n\n def __new__(self, p):\n nr_counts, nr_consonants, replaced = self.count_vowels_consonants(self,\n p)\n inversed = ''.join(c.lower() if c.isupper() else c.upper() for...
[ 3, 4, 5, 6, 7 ]
# Generated by Django 2.0.13 on 2019-05-23 14:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0001_initial'), ('users', '0003_user_projects'), ] operations = [ migrations.RemoveField( model_name='user'...
normal
{ "blob_id": "547935a67fb079e551534126534234ceb96ed0dd", "index": 7648, "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 = [('projects', ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def update_customer(first_name, surname, cid, customer_repository): customer = customer_repository.fetch_by_id(cid) customer.first_name = first_name customer.surname = surname customer_repository.store(customer) return customer <|reserved_special_token_1|> <|reserve...
flexible
{ "blob_id": "f5e60f2d384242b9675e756f67391ea09afcc262", "index": 5408, "step-1": "<mask token>\n\n\ndef update_customer(first_name, surname, cid, customer_repository):\n customer = customer_repository.fetch_by_id(cid)\n customer.first_name = first_name\n customer.surname = surname\n customer_reposito...
[ 1, 2, 3, 4 ]
from django.shortcuts import render from django.http import HttpResponseRedirect from .forms import PostForm from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 from .models import Post from django.contrib import messages # Create your views here. @login_required def...
normal
{ "blob_id": "4a2437d3d6ba549910bc30a67bf391b9bbafd25f", "index": 6210, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@login_required\ndef post_create(request):\n \"\"\"\n\t\tThis makes sure that the form accpets a POST requests (of some data) or Nothing.\n\t\tWithout this the form would even acce...
[ 0, 1, 2, 3, 4 ]
a=float.input('Valor da conta') print('Valor da conta com 10%: R$',(a))
normal
{ "blob_id": "d1ce6c081dce2e4bdb6087cd61d7f857dbb1348d", "index": 8781, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Valor da conta com 10%: R$', a)\n", "step-3": "a = float.input('Valor da conta')\nprint('Valor da conta com 10%: R$', a)\n", "step-4": "a=float.input('Valor da conta')\nprint('...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class BasicBlock(layers.Layer): <|reserved_special_token_0|> def call(self, inputs, training=None): out = self.conv1(inputs) out = self.bn1(out) out = self.relu1(out) out = self.conv2(out) out = self.bn2(out) out = self.relu2(out) ...
flexible
{ "blob_id": "e626a7f3f9241db8684c3b8c1bd79ea49e03490d", "index": 8141, "step-1": "<mask token>\n\n\nclass BasicBlock(layers.Layer):\n <mask token>\n\n def call(self, inputs, training=None):\n out = self.conv1(inputs)\n out = self.bn1(out)\n out = self.relu1(out)\n out = self.con...
[ 6, 7, 8, 9, 11 ]
#!/usr/bin/python import os; import math; # os.chdir('data/postgres/linux.env') os.chdir('data/mysql/linux.env') # os.chdir('data/mongo/linux.env') col_time = 0; col_read_ops = 1 col_read_err = 2 col_write_ops = 3 col_write_err = 4 class ColumnData: def __init__(self, chart, title, data): self.chart = ...
normal
{ "blob_id": "bb208d40ce098b05594aaf9c579f64b909738d52", "index": 1067, "step-1": "#!/usr/bin/python\n\nimport os;\nimport math;\n\n# os.chdir('data/postgres/linux.env')\nos.chdir('data/mysql/linux.env')\n# os.chdir('data/mongo/linux.env')\n\ncol_time = 0;\ncol_read_ops = 1\ncol_read_err = 2\ncol_write_ops = 3\nc...
[ 0 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Greger Update Agent (GUA) module for the Greger Client Module """ __author__ = "Eric Sandbling" __license__ = 'MIT' __status__ = 'Development' # System modules import os, sys import shutil import logging import subprocess from threading import Event from threading im...
normal
{ "blob_id": "a9b2a4d4924dcdd6e146ea346e71bf42c0259846", "index": 593, "step-1": "<mask token>\n\n\nclass GregerUpdateAgent(Thread):\n <mask token>\n <mask token>\n\n @property\n def localRevisionRecord(self):\n \"\"\"\n Get local revision record (.gcm)\n \"\"\"\n localLog ...
[ 5, 6, 7, 8, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('****************************') print('***** Caixa Eletronico *****') print('****************************') <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('*******************...
flexible
{ "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|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [m...
flexible
{ "blob_id": "2ec8d3853ea4a99d4e764c6c24d7b5a3afb64f63", "index": 2830, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [migrations.sw...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class MazeEnv: <|reserved_special_token_0|> def __init__(self, GW, GH, SW, SH): global GRID_WIDTH, GRID_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, BOX_WIDTH, BOX_HEIGHT GRID_WIDTH = GW GRID_HEIGHT = GH SCREEN_WIDTH = SW SCREEN_HEIGHT = SH ...
flexible
{ "blob_id": "751d2a07b97d080988c54511ca13a97a969e06bd", "index": 6405, "step-1": "<mask token>\n\n\nclass MazeEnv:\n <mask token>\n\n def __init__(self, GW, GH, SW, SH):\n global GRID_WIDTH, GRID_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, BOX_WIDTH, BOX_HEIGHT\n GRID_WIDTH = GW\n GRID_HEIGHT...
[ 9, 10, 12, 13, 14 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class TestJobConfigHistory(WebAppTest): def setUp(self): super(TestJobConfigHistory, self).setUp() config_path = os.getenv('CONFIG_PATH') try: yaml_contents = open('{}/job_config_history....
flexible
{ "blob_id": "51bdbec732bebd73a84b52c6d1d39eead047d29e", "index": 5349, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass TestJobConfigHistory(WebAppTest):\n\n def setUp(self):\n super(TestJobConfigHistory, self).setUp()\n config_path = os.getenv('CONFIG_PATH')\n try:\n ...
[ 0, 2, 3, 4, 5 ]
def cubarea(l2,b2,h2): print("Area of cuboid =",2*(l2+b2+h2)) def cubperimeter(l2,b2,h2): print("Perimeter of cuboid =",4*(l2+b2+h2))
normal
{ "blob_id": "45a85ff765833fd62fc1670404d8994818788707", "index": 6873, "step-1": "<mask token>\n", "step-2": "def cubarea(l2, b2, h2):\n print('Area of cuboid =', 2 * (l2 + b2 + h2))\n\n\n<mask token>\n", "step-3": "def cubarea(l2, b2, h2):\n print('Area of cuboid =', 2 * (l2 + b2 + h2))\n\n\ndef cubpe...
[ 0, 1, 2, 3 ]
from werkzeug.security import check_password_hash, generate_password_hash from datetime import datetime from app import db from app import login from flask_login import UserMixin @login.user_loader def load_user(id): return User.query.get(int(id)) class User(UserMixin, db.Model): user_id = db.Column(db.Integer, p...
normal
{ "blob_id": "5cfdb1f6b99f59a83a9bd42b7daf3e016eee94a8", "index": 2898, "step-1": "<mask token>\n\n\nclass Post(db.Model):\n post_id = db.Column(db.Integer, primary_key=True, nullable=False)\n title = db.Column(db.String(50))\n body = db.Column(db.String(200))\n timestamp = db.Column(db.DateTime, inde...
[ 5, 8, 10, 11, 13 ]
from src.produtos import * class Estoque(object): def __init__(self): self.categorias = [] self.subcategorias = [] self.produtos = [] self.menu_estoque() def save_categoria(self, categoria): pass def save_subcategorias(self, subcategoria): pa...
normal
{ "blob_id": "9f3ca0d5a10a27d926a0f306665889418f8d6a0c", "index": 5884, "step-1": "<mask token>\n\n\nclass Estoque(object):\n <mask token>\n\n def save_categoria(self, categoria):\n pass\n <mask token>\n\n def save_produtos(self, produto):\n pass\n <mask token>\n\n def create_subca...
[ 7, 11, 12, 17, 18 ]
import math import random import time import numpy as np class NeuralNetwork: digits = [ [ 1,1,1,1,1, 1,0,0,0,1, 1,0,0,0,1, 1,0,0,0,1, 1,1,1,1,1 ], [ 0,0,1,0,0, 0,0,1,0,0, 0,0,1,0,0, ...
normal
{ "blob_id": "0af45914c8c111a42b0b9684f5f0ee19ef5eeb70", "index": 7548, "step-1": "<mask token>\n\n\nclass NeuralNetwork:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def withSeed(self, seed):\n self.seed = seed\n return self\n <mask token>\n\n def withMinErro...
[ 7, 12, 13, 14, 19 ]
from util import * def K_step(x): if not x.shape: return S.One assert len(x.shape) == 1 n = x.shape[0] if n == 2: return x[1] return Piecewise((1, Equal(n, 1)), (x[1], Equal(n, 2)), (K(x[:n - 1]) * x[n - 1] + K(x[:n - 2]), True)) K = Fun...
normal
{ "blob_id": "b00c07ee3cdba55800c9701b7b8b0e3c9079e9f8", "index": 6272, "step-1": "<mask token>\n\n\ndef K_step(x):\n if not x.shape:\n return S.One\n assert len(x.shape) == 1\n n = x.shape[0]\n if n == 2:\n return x[1]\n return Piecewise((1, Equal(n, 1)), (x[1], Equal(n, 2)), (K(x[:n...
[ 3, 4, 5, 6, 7 ]
#!/usr/bin/python3 """ @author : Chris Phibbs @created : Sunday Aug 30, 2020 14:05:56 AEST @file : q3 """ class Solution: def minDays(self, grid: List[List[int]]) -> int: # bfs - find 1, run bfs. Then loop through - if any other ones found then disconnected i, j = 0...
normal
{ "blob_id": "cddd5deba0ddc59a604d2926bdc687716e08f226", "index": 1557, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n <mask token>\n", "step-2": "<mask token>\n\n\nclass Solution:\n <mask token>\n <mask token>\n\n def checkLand(self, grid, x, y):\n print(f...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def people_on_image(path_to_image): color_map = [(255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), (255,...
flexible
{ "blob_id": "2193c97b7f1fcf204007c2528ecc47cbf3c67e81", "index": 9992, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef people_on_image(path_to_image):\n color_map = [(255, 255, 255), (255, 255, 255), (255, 255, 255), (255, \n 255, 255), (255, 255, 255), (255, 255, 255), (255, 255, 255), ...
[ 0, 1, 2, 3 ]
$ pip install "<package_name> >= 1.1"
normal
{ "blob_id": "8010c0d53af6d428f29ff3ce63bcd6b5b811b051", "index": 3456, "step-1": "$ pip install \"<package_name> >= 1.1\"\n\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def interpret(trees): for tree in trees: nodetype = tree[0] if nodetype == 'word-element': graphics.word(tree[1]) elif nodetype == 'tag-element': tagname = tree[1] ...
flexible
{ "blob_id": "f3b3bee494493263f8b00827e6f3ff3a1dcd8c37", "index": 6144, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef interpret(trees):\n for tree in trees:\n nodetype = tree[0]\n if nodetype == 'word-element':\n graphics.word(tree[1])\n elif nodetype == 'tag-el...
[ 0, 1, 2, 3 ]
# p.85 (문자 갯수 카운팅) message = \ 'It was a bright cold day in April, and the clocks were striking thirteen.' print(message, type(message)) msg_dict = dict() #빈 dict() 생성 for msg in message: print(msg, message.count(msg)) msg_dict[msg] = message.count(msg) print(msg_dict)
normal
{ "blob_id": "20671470c087719fa9ea8ffa25be55e9ade67681", "index": 5373, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(message, type(message))\n<mask token>\nfor msg in message:\n print(msg, message.count(msg))\n msg_dict[msg] = message.count(msg)\nprint(msg_dict)\n", "step-3": "message = (\...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> subprocess.call(options) subprocess.call([f'./bin/{name}']) <|reserved_special_token_1|> <|reserved_special_token_0|> path = sys.argv[1] name, ext = os.path.splitext(path) options = ['g++', '-O3', 'src/' + path, '-o', f'./bin/{...
flexible
{ "blob_id": "5dd79f8ebd74099871d4367cafd83359c4f24e26", "index": 5385, "step-1": "<mask token>\n", "step-2": "<mask token>\nsubprocess.call(options)\nsubprocess.call([f'./bin/{name}'])\n", "step-3": "<mask token>\npath = sys.argv[1]\nname, ext = os.path.splitext(path)\noptions = ['g++', '-O3', 'src/' + path,...
[ 0, 1, 2, 3, 4 ]
a=[1,2,3,4,5] max=0 for i in a: if i>=max: max=i elif i<=min: min=i print max print min
normal
{ "blob_id": "65da68d33aa382ed6deeff3c66a063ee299c2567", "index": 1448, "step-1": "a=[1,2,3,4,5]\nmax=0\nfor i in a:\n\tif i>=max:\n\t\tmax=i\n\telif i<=min:\n\t\tmin=i\nprint max\nprint min\n\n", "step-2": null, "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0 ] }
[ 0 ]
''' ''' import numpy as np from scipy.spatial import distance def synonym_filter(WordVectors_npArray, WordLabels_npArray): ''' ''' pass def synonym_alternatives_range(WordVectors_npArray, AlternativesVectorOne_npArray, Alternati...
normal
{ "blob_id": "ea0a59953f2571f36e65f8f958774074b39a9ae5", "index": 6996, "step-1": "<mask token>\n\n\ndef synonym_alternatives_range(WordVectors_npArray,\n AlternativesVectorOne_npArray, AlternativesVectorTwo_npArray,\n AlternativesVectorThree_npArray, AlternativesVectorFour_npArray):\n \"\"\"\n \"\"\"...
[ 1, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def log_all_ships(myMap): logging.debug('Logging all ships:') for ship_id, ship in myMap.data_ships[myMap.my_id].items(): logging.debug('ship_id: {}'.format(ship_id)) for k, v in ship.items(): logging.debug(' {}: {}'.format(k, v)) def log_all_plan...
flexible
{ "blob_id": "879bb8d67c0e1e8b125ac5994fcb142e3366c9d8", "index": 9094, "step-1": "<mask token>\n\n\ndef log_all_ships(myMap):\n logging.debug('Logging all ships:')\n for ship_id, ship in myMap.data_ships[myMap.my_id].items():\n logging.debug('ship_id: {}'.format(ship_id))\n for k, v in ship.i...
[ 3, 6, 7, 11, 12 ]
import os import mysql.connector import time from flask import Flask, render_template app = Flask(__name__) def dbconnect(): return mysql.connector.connect(user= , password= , host="mysqlshereen.mysql.database.azure.com", port=3306, database='test') @app.route('/result', methods=['POST', 'GET']) def query(): ...
normal
{ "blob_id": "3314ffdbc2f10170176c590aebf49c416bcc8856", "index": 2136, "step-1": "import os\n\nimport mysql.connector\nimport time\nfrom flask import Flask, render_template\n\napp = Flask(__name__)\n\ndef dbconnect():\n\n return mysql.connector.connect(user= , password= , host=\"mysqlshereen.mysql.database.az...
[ 0 ]
# -*- coding: utf-8 -*- ######################################################################### ## This scaffolding model makes your app work on Google App Engine too ## File is released under public domain and you can use without limitations ######################################################################### ...
normal
{ "blob_id": "93c465f017542cfe9cbc55da0ae5a9e34663cf32", "index": 1978, "step-1": "# -*- coding: utf-8 -*-\n\n#########################################################################\n## This scaffolding model makes your app work on Google App Engine too\n## File is released under public domain and you can use w...
[ 0 ]
<|reserved_special_token_0|> class ServicoForm(forms.ModelForm): <|reserved_special_token_0|> class Meta: model = Servico class ServicosAdmin(CustomModelAdmin): list_display = 'imagem_icone', 'titulo', 'intro' list_display_links = 'titulo', 'intro' search_fields = ['titulo', 'intro', '...
flexible
{ "blob_id": "caac9dfc7d52607c2af67ddc03a3a7bdae9911bb", "index": 8204, "step-1": "<mask token>\n\n\nclass ServicoForm(forms.ModelForm):\n <mask token>\n\n\n class Meta:\n model = Servico\n\n\nclass ServicosAdmin(CustomModelAdmin):\n list_display = 'imagem_icone', 'titulo', 'intro'\n list_displ...
[ 13, 14, 15, 16, 19 ]
import math print ("programa que calcula hipotenusa tomando el valor de los catetos en tipo double---") print ("------------------------------------------------------------------------") print (" ") catA = float(input("igrese el valor del cateto A")) catB = float(input("ingrese el valor del catebo B")) def calcularHi...
normal
{ "blob_id": "af217d0cc111f425282ee21bd47d9007a69a6239", "index": 6297, "step-1": "<mask token>\n\n\ndef calcularHipotenusa(catA, catB):\n hipotenusa = catA ** 2 + catB ** 2\n hipotenusa = math.sqrt(hipotenusa)\n hipotenusa = float(hipotenusa)\n print('la hipotenusa es: ', hipotenusa)\n\n\n<mask token...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> class ray: def __init__(self, *args): if len(args) == 0: self.A = vec3(0, 0, 0) self.B = vec3(1, 0, 0) elif len(args) == 2: if type(args[0]) != vec3 or type(args[1]) != vec3: raise ValueError('Expected two vec3s') ...
flexible
{ "blob_id": "a73e3a07ab0ebb90fa744d3dfc8d9da119f99283", "index": 2070, "step-1": "<mask token>\n\n\nclass ray:\n\n def __init__(self, *args):\n if len(args) == 0:\n self.A = vec3(0, 0, 0)\n self.B = vec3(1, 0, 0)\n elif len(args) == 2:\n if type(args[0]) != vec3 ...
[ 4, 5, 6, 7, 8 ]
from unv.app.base import Application def multiply(): print('multiply', 2 * 2) def setup(app: Application): app.register_run_task(multiply)
normal
{ "blob_id": "760a62a94347171eb9e40015c0c43d72df8f4fc8", "index": 1463, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef setup(app: Application):\n app.register_run_task(multiply)\n", "step-3": "<mask token>\n\n\ndef multiply():\n print('multiply', 2 * 2)\n\n\ndef setup(app: Application):\n ...
[ 0, 1, 2, 3 ]
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a ListNode def insertionSortList(self, head): if not head: return head fh = List...
normal
{ "blob_id": "c234031fa6d43c19515e27c5b12f8e8338f24a1c", "index": 6412, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def insertionSortList(self, head):\n if not head:\n return head\n fh = ListNode(0)\n fh.next = ...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> BOT_NAME = ['lg'] SPIDER_MODULES = ['lg.spiders'] NEWSPIDER_MODULE = 'lg.spiders' DOWNLOAD_DELAY = 0.1 LOG_LEVEL = 'WARNING' <|reserved_special_token_1|> # coding: utf-8 BOT_NAME = ['lg'] SPIDER_MODULES = ['lg.spiders'] NEWSPIDER_MODULE = 'lg.spiders' D...
flexible
{ "blob_id": "bed3d83f682404719a95be360cdd74be9dc87991", "index": 3718, "step-1": "<mask token>\n", "step-2": "BOT_NAME = ['lg']\nSPIDER_MODULES = ['lg.spiders']\nNEWSPIDER_MODULE = 'lg.spiders'\nDOWNLOAD_DELAY = 0.1\nLOG_LEVEL = 'WARNING'\n", "step-3": "# coding: utf-8\n\nBOT_NAME = ['lg']\n\nSPIDER_MODULES ...
[ 0, 1, 2 ]
# coding: utf-8 # # Read Bathy data from ERDDAP # In[ ]: get_ipython().system(u'conda install basemap --yes') # In[1]: import numpy as np import matplotlib.pyplot as plt import urllib import netCDF4 from mpl_toolkits.basemap import Basemap # In[2]: # Definine the domain of interest minlat = 42 maxlat = 45 min...
normal
{ "blob_id": "6d0340a08701b0c4f34e9b833bca27cf455d682d", "index": 827, "step-1": "\n# coding: utf-8\n\n# # Read Bathy data from ERDDAP\n\n# In[ ]:\n\nget_ipython().system(u'conda install basemap --yes')\n\n\n# In[1]:\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport urllib\nimport netCDF4\nfrom mpl_t...
[ 0 ]
#!/usr/bin/env python # -*- coding:utf-8 -*- # # Author : cold # E-mail : wh_linux@126.com # Date : 13/09/05 11:16:58 # Desc : # import twqq from setuptools import setup requires = ["tornado", "pycurl", "tornadohttpclient"] packages = ["twqq"] entry_points = { } setup( name = "twqq", ...
normal
{ "blob_id": "9492142a569da1d21b1927e79d97f9cf6276efdc", "index": 2800, "step-1": "<mask token>\n", "step-2": "<mask token>\nsetup(name='twqq', version=twqq.__version__, description=\n 'An asynchronous webqq client library based on tornado',\n long_description=open('README.rst').read(), author='cold', aut...
[ 0, 1, 2, 3, 4 ]
# Part 1 - Build the CNN from keras.models import Sequential from keras.layers import Convolution2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers import Dense ## Initialize the CNN classifier = Sequential() ## Step 1 - Convolution Layer classifier.add(Convolution2D(32, 3, 3,...
normal
{ "blob_id": "b0aeede44a4b54006cf0b7d541d5b476a7178a93", "index": 6155, "step-1": "<mask token>\n", "step-2": "<mask token>\nclassifier.add(Convolution2D(32, 3, 3, border_mode='same', input_shape=(64,\n 64, 3), activation='relu'))\nclassifier.add(MaxPooling2D(pool_size=(2, 2)))\nclassifier.add(Convolution2D(...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = [(...
flexible
{ "blob_id": "d09984c6e6a0ce82389dbbbade63507e9687355d", "index": 771, "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 = [('Pages', '001...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class PasswordRecoveryForm(forms.Form): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> class TokenRequestForm(forms.Form): email = forms.EmailField() def send(self): url = '{0}/users/{1}/password'.format(settings.TSURU...
flexible
{ "blob_id": "27fc11ae68531c7dbafdcf134f0eef019210e2de", "index": 8347, "step-1": "<mask token>\n\n\nclass PasswordRecoveryForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TokenRequestForm(forms.Form):\n email = forms.EmailField()\n\n def send(self):\n url = '{0}/use...
[ 14, 15, 18, 19, 20 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def getKeys(f): keys = {} f = open(f, 'r') for line in f: apiInfo = line.split(',') keys[apiInfo[0]] = apiInfo[1].strip(string.whitespace) keys.pop('apiName', None) return keys <|reserved_sp...
flexible
{ "blob_id": "3653c6fce33467600a3eea72578ed995606bfc03", "index": 4100, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef getKeys(f):\n keys = {}\n f = open(f, 'r')\n for line in f:\n apiInfo = line.split(',')\n keys[apiInfo[0]] = apiInfo[1].strip(string.whitespace)\n keys.p...
[ 0, 1, 2, 3 ]
# coding: utf-8 """ Negotiation API The <b>Negotiations API</b> gives sellers the ability to proactively send discount offers to buyers who have shown an \"interest\" in their listings. <br><br>By sending buyers discount offers on listings where they have shown an interest, sellers can increase the velocity ...
normal
{ "blob_id": "a93818440410bde004f0203f18112fa1b666959c", "index": 9615, "step-1": "<mask token>\n\n\nclass OfferApi(object):\n <mask token>\n <mask token>\n <mask token>\n\n def find_eligible_items_with_http_info(self, x_ebay_c_marketplace_id,\n **kwargs):\n \"\"\"find_eligible_items # ...
[ 4, 5, 6, 8, 9 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if sys.hexversion < 50331648: from .foo import foo <|reserved_special_token_1|> import sys if sys.hexversion < 50331648: from .foo import foo <|reserved_special_token_1|> import sys if sys.hexversion < 0x03000000: ...
flexible
{ "blob_id": "485729398b51bebd16f38800c6100289b7b0b347", "index": 9023, "step-1": "<mask token>\n", "step-2": "<mask token>\nif sys.hexversion < 50331648:\n from .foo import foo\n", "step-3": "import sys\nif sys.hexversion < 50331648:\n from .foo import foo\n", "step-4": "\nimport sys\n\nif sys.hexver...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> plt.xlabel('Freq (in rad/s)') plt.ylabel('Phase (in deg)') plt.title('Phase plot') plt.semilogx(w, phase1, label='With Controller') plt.semilogx(w, phase2, label='Without Controller') plt.grid() plt.legend() plt.show() <|reserve...
flexible
{ "blob_id": "84e84d9f35702c2572ad5e7daa92a271674986dc", "index": 3882, "step-1": "<mask token>\n", "step-2": "<mask token>\nplt.xlabel('Freq (in rad/s)')\nplt.ylabel('Phase (in deg)')\nplt.title('Phase plot')\nplt.semilogx(w, phase1, label='With Controller')\nplt.semilogx(w, phase2, label='Without Controller')...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class StyblinskiTang(Function2D): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def grad(self, x): """ Grad function. """ g = np.zeros(x.shape) g[...
flexible
{ "blob_id": "5d8715dd02feff4e13919858051abeb5b6828011", "index": 6798, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass StyblinskiTang(Function2D):\n <mask token>\n <mask token>\n <mask token>\n\n def grad(self, x):\n \"\"\" Grad function. \"\"\"\n g = np.zeros(x.shape)\...
[ 0, 3, 6, 7, 8 ]
#파이썬 심화 #클래스 메소드, 인스턴스 메소드, 스테이틱 메소드 # 기본 인스턴스 메소드 class Student(object): """ Student Class Author : Kim Date : 2020.11.07 Description : Class, Static, Instance Method """ #Class Variable tuition_per = 1.0 def __init__(self, id, first_name, last_name, email, grade...
normal
{ "blob_id": "f507fbe7c92134c0a7149aafe7de88debebd42f5", "index": 7760, "step-1": "class Student(object):\n <mask token>\n <mask token>\n <mask token>\n\n def full_name(self):\n return '{} {}'.format(self._first_name, self._last_name)\n\n def detail_info(self):\n return 'Student Detai...
[ 5, 7, 11, 13, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> ours2.append(mine) ours2.append(yours) print(ours1) print(ours2) <|reserved_special_token_0|> print(ours1) print(ours2) <|reserved_special_token_1|> <|reserved_special_token_0|> yours = ['Yale', 'MIT', 'Berkeley'] mine = ['Harv...
flexible
{ "blob_id": "bf65d4a4e066e3e06b888d4b9ed49e10e66b4e78", "index": 8145, "step-1": "<mask token>\n", "step-2": "<mask token>\nours2.append(mine)\nours2.append(yours)\nprint(ours1)\nprint(ours2)\n<mask token>\nprint(ours1)\nprint(ours2)\n", "step-3": "<mask token>\nyours = ['Yale', 'MIT', 'Berkeley']\nmine = ['...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> async def add_time(chat, time): return col.insert_one({'chat': chat, 'time': time}) async def get_time(chat): return col.find_one({'chat': chat}) async def update_time(chat, time): return col.update_one({'chat': ...
flexible
{ "blob_id": "e4ce10f5db56e4e2e1988da3cee542a4a09785a8", "index": 5381, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nasync def add_time(chat, time):\n return col.insert_one({'chat': chat, 'time': time})\n\n\nasync def get_time(chat):\n return col.find_one({'chat': chat})\n\n\nasync def update_...
[ 0, 1, 2, 3 ]
from graphics.rectangle import * from graphics.circle import * from graphics.DGraphics.cuboid import * from graphics.DGraphics.sphere import * print ("------rectangle-------") l=int(input("enter length : ")) b=int(input("enter breadth : ")) print("area of rectangle : ",RectArea(1,b)) print("perimeter of rectang...
normal
{ "blob_id": "f275085a2e4e3efc8eb841b5322d9d71f2e43846", "index": 7998, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('------rectangle-------')\n<mask token>\nprint('area of rectangle : ', RectArea(1, b))\nprint('perimeter of rectangle : ', Rectperimeter(1, b))\nprint()\nprint('-------circle-------...
[ 0, 1, 2, 3, 4 ]
import scipy.sparse from multiprocessing.sharedctypes import Array from ctypes import c_double import numpy as np from multiprocessing import Pool import matplotlib.pyplot as plt from time import time import scipy.io as sio import sys # np.random.seed(1) d = 100 n = 100000 k=10 learning_rate = 0.4 T_freq = 100 num_t...
normal
{ "blob_id": "bf04bf41f657a6ada4777fe5de98d6a68beda9d3", "index": 9769, "step-1": "<mask token>\n\n\ndef getSyntheticData(n, d, k):\n mean = np.array([0] * d)\n alpha = 0.8\n cov_diag = [(alpha ** i) for i in range(d)]\n covariance = np.diag(cov_diag)\n truth = np.sum(cov_diag[:k])\n samples = n...
[ 2, 5, 8, 9, 10 ]
from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('', views.skincare, name="skin"), path('productSearch/', views.productSearch, name="productSearch"), path('detail/', views.detail, name="detail"), ]
normal
{ "blob_id": "c31c59d172b2b23ca4676be0690603f33b56f557", "index": 4867, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [path('', views.skincare, name='skin'), path('productSearch/',\n views.productSearch, name='productSearch'), path('detail/', views.\n detail, name='detail')]\n", "st...
[ 0, 1, 2, 3 ]
_registry = [] def registry(name): _registry.append(name) def registry_names(): return iter(_registry)
normal
{ "blob_id": "51642dbb210600f9ca4e035fb884fbdda030fd04", "index": 1491, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef registry_names():\n return iter(_registry)\n", "step-3": "<mask token>\n\n\ndef registry(name):\n _registry.append(name)\n\n\ndef registry_names():\n return iter(_regis...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> def longest(s1, s2): s = s1 + s2 st = ''.join(sorted(set(s))) return st <|reserved_special_token_0|> <|reserved_special_token_1|> def longest(s1, s2): s = s1 + s2 st = ''.join(sorted(set(s))) return st longest('xyaabbbccccdefww'...
flexible
{ "blob_id": "7d54d5fd855c7c03d2d4739e8ad4f9ab8772ca2b", "index": 3977, "step-1": "<mask token>\n", "step-2": "def longest(s1, s2):\n s = s1 + s2\n st = ''.join(sorted(set(s)))\n return st\n\n\n<mask token>\n", "step-3": "def longest(s1, s2):\n s = s1 + s2\n st = ''.join(sorted(set(s)))\n re...
[ 0, 1, 2, 3 ]
import unittest from battleline.model.Formation import Formation, FormationInvalidError class TestFormation(unittest.TestCase): def test_formation_with_less_than_three_cards_is_considered_invalid(self): self.assertRaisesRegexp( FormationInvalidError, "Formation must have 3 cards", Formation, ...
normal
{ "blob_id": "0ce69b7ce99b9c01892c240d5b268a9510af4503", "index": 1648, "step-1": "<mask token>\n\n\nclass TestFormation(unittest.TestCase):\n <mask token>\n\n def test_formation_with_more_than_three_cards_is_considered_invalid(self):\n self.assertRaisesRegexp(FormationInvalidError,\n 'For...
[ 18, 21, 22, 25, 26 ]
from tqdm import trange import numpy as np class GPTD_fixedGrid: def __init__(self, env, sigma0, gamma, kernel, D, V_mu=[]): self.env = env self.gamma = gamma self.sigma0 = sigma0 self.kernel = kernel.kernel if (not V_mu): V_mu = lambda s: np.zeros((s.sh...
normal
{ "blob_id": "92eaceb46974ba3a5944300139d5929d44673181", "index": 1223, "step-1": "<mask token>\n\n\nclass GPTD_fixedGrid:\n\n def __init__(self, env, sigma0, gamma, kernel, D, V_mu=[]):\n self.env = env\n self.gamma = gamma\n self.sigma0 = sigma0\n self.kernel = kernel.kernel\n ...
[ 3, 5, 6, 7, 8 ]
from sklearn.datasets import fetch_20newsgroups from sklearn.decomposition import TruncatedSVD from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import HashingVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.pipeline import make_pipeline...
normal
{ "blob_id": "53cbc3ca3a34a8aafa97d6964337cfabb1bebac5", "index": 8957, "step-1": "from sklearn.datasets import fetch_20newsgroups\nfrom sklearn.decomposition import TruncatedSVD\nfrom sklearn.feature_extraction.text import TfidfVectorizer\nfrom sklearn.feature_extraction.text import HashingVectorizer\nfrom sklea...
[ 0 ]
# Generated by Django 3.1.5 on 2021-02-24 18:34 from django.db import migrations, models import stdimage.models class Migration(migrations.Migration): dependencies = [ ('Site', '0004_arquivopdf'), ] operations = [ migrations.CreateModel( name='historico', fields=...
normal
{ "blob_id": "321147f2e2d8caf6d9224e2a8969f51ded48baf7", "index": 8130, "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 = [('Site', '000...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class CreateArchive(QtWidgets.QDialog): <|reserved_special_token_0|> <|reserved_special_token_0|> def create_components(self): self.option_widget = QtWidgets.QWidget() self.name_lbl = QtWidgets.QLabel('Nazwa') self.name_edit = QtWidgets.QLineEdit('unti...
flexible
{ "blob_id": "7a41826f65f2f55b4c678df2ac06027df6ca50d4", "index": 3623, "step-1": "<mask token>\n\n\nclass CreateArchive(QtWidgets.QDialog):\n <mask token>\n <mask token>\n\n def create_components(self):\n self.option_widget = QtWidgets.QWidget()\n self.name_lbl = QtWidgets.QLabel('Nazwa')\...
[ 9, 10, 15, 16, 18 ]
<|reserved_special_token_0|> def get_youtube_handler(): """Return the API Youtube object.""" options = {} home = os.path.expanduser('~') default_credentials = os.path.join(home, '.youtube-upload-credentials.json' ) client_secrets = os.path.join(home, '.client_secrets.json') credentials...
flexible
{ "blob_id": "65d08fe1a3f6e5cc2458209706307513d808bdb2", "index": 3824, "step-1": "<mask token>\n\n\ndef get_youtube_handler():\n \"\"\"Return the API Youtube object.\"\"\"\n options = {}\n home = os.path.expanduser('~')\n default_credentials = os.path.join(home, '.youtube-upload-credentials.json'\n ...
[ 4, 5, 6, 7, 8 ]
__author__ = 'piotrek' import os import zipfile import tarfile from PyQt5 import QtWidgets from PyQt5 import QtGui from PyQt5 import QtCore from Widgets.list_view import ListView from Threads.PackThread import PackThread class CreateArchive(QtWidgets.QDialog): def __init__(self, model, index, path, parent=Non...
normal
{ "blob_id": "7a41826f65f2f55b4c678df2ac06027df6ca50d4", "index": 3623, "step-1": "<mask token>\n\n\nclass CreateArchive(QtWidgets.QDialog):\n <mask token>\n <mask token>\n\n def create_components(self):\n self.option_widget = QtWidgets.QWidget()\n self.name_lbl = QtWidgets.QLabel('Nazwa')\...
[ 9, 10, 15, 16, 18 ]
<|reserved_special_token_0|> @app.route('/') def home(): """List all available api routes.""" return ( f'Available Routes:<br/>/api/v1.0/precipitation<br/>/api/v1.0/stations<br/>/api/v1.0/tobs<br/>/api/v1.0/<start><br/>/api/v1.0/<start>/<end><br/>' ) <|reserved_special_token_0|> @app.route...
flexible
{ "blob_id": "7ab964352c1d51b70e3a1a7bf0a624f2d96cfd55", "index": 8168, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home():\n \"\"\"List all available api routes.\"\"\"\n return (\n f'Available Routes:<br/>/api/v1.0/precipitation<br/>/api/v1.0/stations<br/>/api/v1.0/tobs<br/>/api/v1.0/<start><b...
[ 3, 6, 7, 9, 10 ]
<|reserved_special_token_0|> class FDA_node(object): <|reserved_special_token_0|> def grow(self): self.right = FDA_node() self.left = FDA_node() def find_optimal_param(self, x, y): self.m = self.method.find_optimal_param(x, y) if self.left != None and self.right != None: ...
flexible
{ "blob_id": "784b51c05dc7b5e70016634e2664c9ec25b8a65a", "index": 6506, "step-1": "<mask token>\n\n\nclass FDA_node(object):\n <mask token>\n\n def grow(self):\n self.right = FDA_node()\n self.left = FDA_node()\n\n def find_optimal_param(self, x, y):\n self.m = self.method.find_optim...
[ 5, 6, 9, 11, 12 ]
<|reserved_special_token_0|> def from_url(url: str) ->Image.Image: api_response = requests.get(url).content response_bytes = BytesIO(api_response) return Image.open(response_bytes) def from_file(path: str) ->Union[Image.Image, None]: if os.path.exists(path): return Image.open(path) else:...
flexible
{ "blob_id": "f2bb44600f011a205c71985ad94c18f7e058634f", "index": 8, "step-1": "<mask token>\n\n\ndef from_url(url: str) ->Image.Image:\n api_response = requests.get(url).content\n response_bytes = BytesIO(api_response)\n return Image.open(response_bytes)\n\n\ndef from_file(path: str) ->Union[Image.Image...
[ 2, 3, 4, 5, 6 ]
import numpy as np from .metrics import r2_score class LinearRegression: def __init__(self): self.coef_ = None # 系数 self.interception_ = None # 截距 self._theta = None def fit_normal(self, X_train, y_train): assert X_train.shape[0] == y_train.shape[0], "" #!!!impor...
normal
{ "blob_id": "e47e614c88c78fb6e8ff4098ea2b89d21bfa9684", "index": 6935, "step-1": "<mask token>\n\n\nclass LinearRegression:\n\n def __init__(self):\n self.coef_ = None\n self.interception_ = None\n self._theta = None\n <mask token>\n\n def fit_gd(self, X_train, y_train, eta=0.01, n_...
[ 5, 7, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): dependencies = []...
flexible
{ "blob_id": "4a118f9081a8b3baf0b074c8dc14eaeef4559c08", "index": 6684, "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 = []\n operat...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(response.text) <|reserved_special_token_1|> <|reserved_special_token_0|> response = requests.get( 'https://any-api.com:8443/https://rbaskets.in/api/version') print(response.text) <|reserved_special_token_1|> import...
flexible
{ "blob_id": "ab36b3d418be67080e2efaba15edc1354386e191", "index": 6888, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(response.text)\n", "step-3": "<mask token>\nresponse = requests.get(\n 'https://any-api.com:8443/https://rbaskets.in/api/version')\nprint(response.text)\n", "step-4": "import...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> def get_diabetes_data(target='progression'): """Get the SKLearn Diabetes regression dataset, formatted as a DataFrame Parameters ---------- target: String, default='progression' What to name the column in `df` that contains the target output values Returns ...
flexible
{ "blob_id": "285ca945696b32160175f15c4e89b3938f41ebf4", "index": 2172, "step-1": "<mask token>\n\n\ndef get_diabetes_data(target='progression'):\n \"\"\"Get the SKLearn Diabetes regression dataset, formatted as a DataFrame\n\n Parameters\n ----------\n target: String, default='progression'\n W...
[ 1, 2, 3, 4, 5 ]
from pirates.teleport.AreaTeleportActor import AreaTeleportActor class DoorTeleportActor(AreaTeleportActor): pass
normal
{ "blob_id": "b679444fde7cd8eb819443922f37ee54c0f29de4", "index": 424, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DoorTeleportActor(AreaTeleportActor):\n pass\n", "step-3": "from pirates.teleport.AreaTeleportActor import AreaTeleportActor\n\n\nclass DoorTeleportActor(AreaTeleportActor):...
[ 0, 1, 2 ]
<|reserved_special_token_0|> class SessionRun: def __init__(self, sessionId, cypher, params): self.sessionId = sessionId self.cypher = cypher self.params = params class SessionReadTransaction: def __init__(self, sessionId): self.sessionId = sessionId <|reserved_special_to...
flexible
{ "blob_id": "dfcb095b26a21ba0c8ccc2a2c664bcfab29b8351", "index": 8214, "step-1": "<mask token>\n\n\nclass SessionRun:\n\n def __init__(self, sessionId, cypher, params):\n self.sessionId = sessionId\n self.cypher = cypher\n self.params = params\n\n\nclass SessionReadTransaction:\n\n def...
[ 14, 16, 17, 19, 23 ]
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 05:29:19 2020 @author: Gaurav """ from tensorflow.keras.models import load_model import cv2 import os from tensorflow.keras.preprocessing.image import img_to_array import numpy as np model=load_model('E:/AI Application Implementation/trained_model/Classifi...
normal
{ "blob_id": "c3e2bd635a7ff558ed56e7fb35e8b10e1c660c88", "index": 6804, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in arr:\n img = cv2.imread(i)\n img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n img = cv2.resize(img, (32, 32))\n img = img_to_array(img)\n img = np.expand_dims(img, axi...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def sketch(img, threshold=15): """ 素描画生成 param img: Image实例   param threshold: 介于0到100 :return: """ if threshold < 0: threshold = 0 if threshold > 100: threshold = 100 if len(img.s...
flexible
{ "blob_id": "065354d2a8fd8a75e16bf85f624b12641377029a", "index": 8568, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef sketch(img, threshold=15):\n \"\"\"\n 素描画生成\n param img: Image实例\n  param threshold: 介于0到100\n :return:\n \"\"\"\n if threshold < 0:\n threshold = 0\n ...
[ 0, 1, 2, 3 ]
import sys import os arcpy_path = [r'D:\software\ArcGIS\python 27\ArcGIS10.2\Lib\site-packages', r'D:\software\ArcGIS\Desktop 10.2\Desktop10.2\arcpy', r'D:\software\ArcGIS\Desktop 10.2\Desktop10.2\bin', r'D:\software\ArcGIS\Desktop 10.2\Desktop10.2\ArcToolbox\Scripts'] sys.pa...
normal
{ "blob_id": "eab2cdd92d3be5760f13e747b05ca902eaf9aca8", "index": 8287, "step-1": "<mask token>\n\n\ndef CreateCGCS2000prj(shpPath):\n body = (\n 'GEOGCS[\"CGCS_2000\",DATUM[\"D_2000\",SPHEROID[\"S_2000\",6378137.0,298.2572221010041]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]'\n ...
[ 1, 3, 6, 9, 10 ]
<|reserved_special_token_0|> def corr2d(X, K): """ 定义二维互相关运算函数 :param X:输入数组 :param K: 核数组 :return:二维互相关的运算结果 """ h, w = K.shape Y = tf.Variable(tf.zeros((X.shape[0] - h + 1, X.shape[1] - w + 1))) for i in range(Y.shape[0]): for j in range(Y.shape[1]): Y[i, j].a...
flexible
{ "blob_id": "3f473701b186b5287258ba74e478cccdad0f29bf", "index": 2463, "step-1": "<mask token>\n\n\ndef corr2d(X, K):\n \"\"\"\n 定义二维互相关运算函数\n :param X:输入数组\n :param K: 核数组\n :return:二维互相关的运算结果\n \"\"\"\n h, w = K.shape\n Y = tf.Variable(tf.zeros((X.shape[0] - h + 1, X.shape[1] - w + 1)))...
[ 1, 2, 3, 4, 5 ]
def _get_single_variable(self, name, shape=None, dtype=dtypes.float32, initializer=None, regularizer=None, partition_info=None, reuse=None, trainable=True, collections=None, caching_device=None, validate_shape=True, use_resource=None): 'Get or create a single Variable (e.g. a shard or entire variable).\n\n See t...
normal
{ "blob_id": "51ef1c0f6a17e12b2324a80f962b2ce47cc05bcc", "index": 1348, "step-1": "<mask token>\n", "step-2": "def _get_single_variable(self, name, shape=None, dtype=dtypes.float32,\n initializer=None, regularizer=None, partition_info=None, reuse=None,\n trainable=True, collections=None, caching_device=No...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def suck(f): hamdevall = spamdevall = 0.0, 0.0 cost = 0.0 bestcost = 0.0 fp = 0 fn = 0 un = 0 fpp = 0.0 fnp = 0.0 unp = 0.0 htest = 0 stest = 0 get = f.readline while 1: line = get() if line.startswith('-> <stat> tested')...
flexible
{ "blob_id": "4e94e9e2b45d3786aa86be800be882cc3d5a80b5", "index": 8328, "step-1": "<mask token>\n\n\ndef suck(f):\n hamdevall = spamdevall = 0.0, 0.0\n cost = 0.0\n bestcost = 0.0\n fp = 0\n fn = 0\n un = 0\n fpp = 0.0\n fnp = 0.0\n unp = 0.0\n htest = 0\n stest = 0\n get = f.r...
[ 1, 2, 3, 4, 5 ]
import cv2 import numpy as np import pandas as pd import tkinter as tk import random from tkinter import * from tkinter import ttk from tkinter import messagebox from tkinter import Scale,Tk from tkinter.ttk import Notebook refPt = [] PtBGR=[] r=[] g=[] b=[] refPt = [] Serial=[] PtBGR=[] r1=[] r2=[] r3=[] r4=[] rate=[...
normal
{ "blob_id": "a126b1775ffe1ba1aebc288ce17fac8ada0b0756", "index": 312, "step-1": "<mask token>\n\n\ndef quitScreen():\n messagebox.showinfo('collecting data', '點擊視窗開始分析')\n root.destroy()\n root2 = Tk()\n root2.destroy()\n\n\ndef getTextInput():\n global result, result2\n result = text.get(1.0, ...
[ 5, 6, 8, 9, 10 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def backupToZip(folder): folder = os.path.abspath(folder) os.chdir(folder) number = 1 while True: zipFilename = os.path.basename(folder) + '_' + str(number) + '.zip' if not os.path.exists(zipFilen...
flexible
{ "blob_id": "7af19f69e6c419649a5999f594118ad13833a537", "index": 7398, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef backupToZip(folder):\n folder = os.path.abspath(folder)\n os.chdir(folder)\n number = 1\n while True:\n zipFilename = os.path.basename(folder) + '_' + str(numbe...
[ 0, 1, 2, 3, 4 ]
positivo = float(1.0000001) negativo = float(-1.000001) print(negativo, positivo) b_pos = bin(positivo) b_neg = bin(negativo) print(b_neg, b_pos)
normal
{ "blob_id": "5c908697000247056bb63a443f837eef88b4c957", "index": 9196, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(negativo, positivo)\n<mask token>\nprint(b_neg, b_pos)\n", "step-3": "positivo = float(1.0000001)\nnegativo = float(-1.000001)\nprint(negativo, positivo)\nb_pos = bin(positivo)\nb...
[ 0, 1, 2 ]
import pygame import numpy as np import glob from entities.base import AnimatedSprite images_path = sorted(glob.glob('./resources/trophy_sparkle_*.png')) trophy_im_dict = {'sparkle':[pygame.transform.scale(pygame.image.load(img_path),(400,400)) for img_path in images_path]} class Trophy(AnimatedSprite): def __in...
normal
{ "blob_id": "883cb1e3ea227bb5ac5aa3b4348336ab1a7fba70", "index": 3476, "step-1": "<mask token>\n\n\nclass Trophy(AnimatedSprite):\n\n def __init__(self, position, image_dict, hold_for_n_frames=3):\n super().__init__(position, image_dict, hold_for_n_frames)\n self.initial_position = position\n ...
[ 2, 3, 4, 5, 6 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # jan 2014 bbb garden shield attempt # AKA ''' Sensors: analog level sensor, pin AIN0 TMP102 i2c temperature sensor, address 0x48 (if add0 is grounded) or 0x49 (if pulled up) Outputs: Analog RGB LED strip I2C display(?) Pump Activate/Deactivate (GPIO pin) Some measurem...
normal
{ "blob_id": "06992263599fe3290c87ec00c6cb8af3748920c8", "index": 5497, "step-1": "\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# jan 2014 bbb garden shield attempt\n# AKA\n\n'''\nSensors:\nanalog level sensor, pin AIN0\nTMP102 i2c temperature sensor, address 0x48\n(if add0 is grounded) or 0x49 (if pulled up...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if year % 4 == 0 and year % 100 != 0: print('閏年') pass elif year % 400 == 0: print('閏年') pass else: print('平年') pass <|reserved_special_token_1|> year = int(input('西暦>')) if year % 4 == 0 and year % 100 ...
flexible
{ "blob_id": "b381d1110e6a7570cd872d689a43aba2d2580a23", "index": 8449, "step-1": "<mask token>\n", "step-2": "<mask token>\nif year % 4 == 0 and year % 100 != 0:\n print('閏年')\n pass\nelif year % 400 == 0:\n print('閏年')\n pass\nelse:\n print('平年')\n pass\n", "step-3": "year = int(input('西暦>...
[ 0, 1, 2 ]
#n = int(input()) #s = input() n, m = map(int, input().split()) #s, t = input().split() #n, m, l = map(int, input().split()) #s, t, r = input().split() #a = map(int, input().split()) #a = input().split() a = [int(input()) for _ in range(n)] #a = [input() for _ in range(n)] #t = input() #m = int(input()) #p, q = map(in...
normal
{ "blob_id": "a09bc84a14718422894127a519d67dc0c6b13bc9", "index": 746, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in range(n - 1):\n if a[i + 1] - a[i] < m:\n ans += a[i + 1] - a[i]\n else:\n ans += m\nprint(ans)\n", "step-3": "n, m = map(int, input().split())\na = [int(inp...
[ 0, 1, 2, 3 ]
from functions2 import * import numpy as np #from functions import TermStructure,load_data import numpy as np import math from scipy import optimize import pylab as pl from IPython import display as dp class Vasicek(): def __init__(self,rs,vol): self.t = rs.columns self.ps= rs[-1:] self....
normal
{ "blob_id": "b6470ffda9040223951a99abc600ce1e99fe146b", "index": 7902, "step-1": "<mask token>\n\n\nclass Vasicek:\n\n def __init__(self, rs, vol):\n self.t = rs.columns\n self.ps = rs[-1:]\n self.sigma = vol\n <mask token>\n\n def loss(self, x):\n self.a = x[0]\n self...
[ 3, 5, 6, 8, 9 ]
<|reserved_special_token_0|> def multiprocessing_start(obj): cov = init() if cov: multiprocessing.util.Finalize(None, multiprocessing_finish, args=( cov,), exitpriority=1000) <|reserved_special_token_0|> def init(): cov_source = os.environ.get('COV_CORE_SOURCE') cov_config = os...
flexible
{ "blob_id": "243794d36a1c6861c2c3308fe6a52ec19b73df72", "index": 7820, "step-1": "<mask token>\n\n\ndef multiprocessing_start(obj):\n cov = init()\n if cov:\n multiprocessing.util.Finalize(None, multiprocessing_finish, args=(\n cov,), exitpriority=1000)\n\n\n<mask token>\n\n\ndef init():\...
[ 2, 3, 4, 5, 6 ]
import collections import cPickle as pickle import os import shutil import warnings import numpy as np import theano import theano.tensor as T import tables #theano.config.compute_test_value = 'warn' class SGD_Trainer(object): """Implementation of a stochastic gradient descent trainer """ #{{{ Properties ...
normal
{ "blob_id": "17ac827d181650cd8bd6e75ca7ff363d70d3c4a7", "index": 2138, "step-1": "import collections\nimport cPickle as pickle\nimport os\nimport shutil\nimport warnings\n\nimport numpy as np\nimport theano\nimport theano.tensor as T\nimport tables\n#theano.config.compute_test_value = 'warn'\n\n\nclass SGD_Train...
[ 0 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ClipboardEvent(Event): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class ClipboardEvent(Event): def __init__(self, text: str, *args, **kwargs): super().__ini...
flexible
{ "blob_id": "9b02ce0b3acb14bdd6463c5bdba865b28253767c", "index": 7896, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass ClipboardEvent(Event):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass ClipboardEvent(Event):\n\n def __init__(self, text: str, *args, **kwargs):\n super()....
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> monkey.patch_all() <|reserved_special_token_0|> http_server.serve_forever() <|reserved_special_token_1|> <|reserved_special_token_0|> monkey.patch_all() <|reserved_special_token_0|> http_server = WSGIServer(('0.0.0.0', 5000), a...
flexible
{ "blob_id": "c36625dfbd733767b09fcb5505d029ae2b16aa44", "index": 7077, "step-1": "<mask token>\n", "step-2": "<mask token>\nmonkey.patch_all()\n<mask token>\nhttp_server.serve_forever()\n", "step-3": "<mask token>\nmonkey.patch_all()\n<mask token>\nhttp_server = WSGIServer(('0.0.0.0', 5000), app)\nhttp_serve...
[ 0, 1, 2, 3, 4 ]
# coding: utf-8 import pandas as pd import os import numpy as np import json as json import mysql.connector as sqlcnt import datetime as dt import requests from mysql.connector.constants import SQLMode import os import glob import re import warnings warnings.filterwarnings("ignore") from pathlib import Path # In[...
normal
{ "blob_id": "2060f57cfd910a308d60ad35ebbbf9ffd5678b9c", "index": 3519, "step-1": "<mask token>\n", "step-2": "<mask token>\nwarnings.filterwarnings('ignore')\n<mask token>\nos.chdir(lib_path)\n<mask token>\nprint(res.summary())\n<mask token>\nX0\n<mask token>\nb\n<mask token>\ncovid_actual.loc[:, 'Date':'human...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if __name__ == '__main__': datacake_url = ( 'https://api.datacake.co/integrations/api/ae6dd531-4cf6-4966-b5c9-6c43939aae90/' ) serial = 'python0001' number_of_persons_a = 234 number_of_persons_b = 3...
flexible
{ "blob_id": "00af9627242648a5a16a34a18bfc117945f1bc08", "index": 4936, "step-1": "<mask token>\n", "step-2": "<mask token>\nif __name__ == '__main__':\n datacake_url = (\n 'https://api.datacake.co/integrations/api/ae6dd531-4cf6-4966-b5c9-6c43939aae90/'\n )\n serial = 'python0001'\n numbe...
[ 0, 1, 2, 3 ]
#!/usr/bin/python import os from nao.tactics import Tactic from nao.inspector import Inspector def test_file(): print("\n[*] === file ===") name_libmagic_so = 'libmagic.so.1' inspector = Inspector("./sample/file", debug=True) # find_addr = 0x1742D # ret block of is_tar find_addr = 0x173F8 # return ...
normal
{ "blob_id": "a25fb9b59d86de5a3180e4257c4e398f22cdbb05", "index": 6947, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_file():\n print('\\n[*] === file ===')\n name_libmagic_so = 'libmagic.so.1'\n inspector = Inspector('./sample/file', debug=True)\n find_addr = 95224\n cond = i...
[ 0, 1, 2, 3, 4 ]
#embaralhar sorteio import random a1 = input('Primeiro aluno: ') a2 = input('Primeiro segundo: ') a3 = input('Primeiro terceiro: ') a4 = input('Primeiro quarto: ') lista = [a1, a2, a3, a4] random.shuffle(lista) print('A ordem de apresentacao será') print(lista)
normal
{ "blob_id": "9a0e24fbe9f51dc914d891e90196c2ff4e65f04a", "index": 9652, "step-1": "<mask token>\n", "step-2": "<mask token>\nrandom.shuffle(lista)\nprint('A ordem de apresentacao será')\nprint(lista)\n", "step-3": "<mask token>\na1 = input('Primeiro aluno: ')\na2 = input('Primeiro segundo: ')\na3 = input('Pri...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ArchiveParserTest(unittest.TestCase): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> def testReadFile(self): """Tests that file is read correctly. Tests that correctly formatted file in archive is read correct...
flexible
{ "blob_id": "2ea335dd8d879731aad7713499440db6d1f60d36", "index": 2427, "step-1": "<mask token>\n\n\nclass ArchiveParserTest(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n\n def testReadFile(self):\n \"\"\"Tests that file is read correctly.\n\n Tests that correctly fo...
[ 2, 3, 6, 7, 8 ]
from click.testing import CliRunner from apitest.actions.cli import cli def test_sendto_cli_runs_ok(): runner = CliRunner() result = runner.invoke(cli, ["sendto"]) assert result.exit_code == 0
normal
{ "blob_id": "7537deb4560e880365b23a99584d0b1f8fa3daf4", "index": 5675, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_sendto_cli_runs_ok():\n runner = CliRunner()\n result = runner.invoke(cli, ['sendto'])\n assert result.exit_code == 0\n", "step-3": "from click.testing import CliR...
[ 0, 1, 2, 3 ]
#!/usr/bin/env python3 def GetDensity(T, P, config): return P/(T*config["Flow"]["mixture"]["gasConstant"]) def GetViscosity(T, config): if (config["Flow"]["mixture"]["viscosityModel"]["type"] == "Constant"): viscosity = config["Flow"]["mixture"]["viscosityModel"]["Visc"] elif (config["Flow"]["mixture"]...
normal
{ "blob_id": "0e47a7d9cd6809886674291d6a535dd18205a012", "index": 5455, "step-1": "<mask token>\n", "step-2": "def GetDensity(T, P, config):\n return P / (T * config['Flow']['mixture']['gasConstant'])\n\n\n<mask token>\n", "step-3": "def GetDensity(T, P, config):\n return P / (T * config['Flow']['mixtur...
[ 0, 1, 2, 3 ]
from common.get_keyword import GetKeyword from common.operation_Excel import OperationExcel from common.op_database import OpDatabase from interface.login import Login from interface.address import Address import unittest import ddt # 测试数据 op_excel = OperationExcel() add_file = r'D:\pyCharm\Demo\pycode\Requests\201911...
normal
{ "blob_id": "0f0b3eea9dc397d32e81749304041abaf6651e94", "index": 1873, "step-1": "<mask token>\n\n\n@ddt.ddt\nclass TestAddress(unittest.TestCase):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def test_02_check_address(self):\n url = 'http://ecshop.itsoso.cn/ECMobile/?url...
[ 2, 8, 9, 10, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_action_getter(): path = './../Version_1.0/Tests/General/Action_1.json' document = json.loads(open(path).read()) gamestate = Gamestate.from_document(document['gamestate']) nloops = 100 total_time = 0 ...
flexible
{ "blob_id": "b16691429d83f6909a08b10cc0b310bb62cd550d", "index": 3985, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_action_getter():\n path = './../Version_1.0/Tests/General/Action_1.json'\n document = json.loads(open(path).read())\n gamestate = Gamestate.from_document(document['g...
[ 0, 1, 2, 3 ]
from datetime import datetime from poop import objstore class Comment(objstore.Item): __typename__ = 'comment' __table__ = 'comment' relatesToId = objstore.column('relates_to_id') relatesToVersion = objstore.column('relates_to_version') posted = objstore.column() approved = objstore.colum...
normal
{ "blob_id": "e398908ba74306c5a746d7643b38f08651cf92ec", "index": 4205, "step-1": "<mask token>\n\n\nclass Comment(objstore.Item):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __init__(self, *a, **k):\n relatesTo = ...
[ 2, 3, 4, 5, 6 ]