code
stringlengths
13
6.09M
order_type
stringclasses
2 values
original_example
dict
step_ids
listlengths
1
5
import visgraph.dbcore as vg_dbcore dbinfo = { 'user':'visgraph', 'password':'ohhai!', 'database':'vg_test', } def vgtest_basic_database(): #vg_dbcore.initGraphDb(dbinfo) gstore = vg_dbcore.DbGraphStore(dbinfo) n1 = gstore.addNode(ninfo={'name':'foo', 'size':20}) n2 = gstore.addNode(ninfo={'name':'bar',...
normal
{ "blob_id": "ffee0b0e00b4cebecefc3671332af3e2ffe7491b", "index": 8155, "step-1": "import visgraph.dbcore as vg_dbcore\n\ndbinfo = {\n'user':'visgraph',\n'password':'ohhai!',\n'database':'vg_test',\n}\n\ndef vgtest_basic_database():\n#vg_dbcore.initGraphDb(dbinfo)\n\n gstore = vg_dbcore.DbGraphStore(dbinfo)\n\...
[ 0 ]
''' Created on Jan 19, 2014 @author: felix ''' import sys from PyPDF2 import PdfFileReader from pytagcloud import create_tag_image, make_tags, LAYOUT_HORIZONTAL from pytagcloud.lang.counter import get_tag_counts def main(): for i in range(0, len(sys.argv)): if (sys.argv[i] == '-f'): try: ...
normal
{ "blob_id": "899cdb5cbdbd0a57af76a5044d54e1fe2a497847", "index": 7144, "step-1": "'''\nCreated on Jan 19, 2014\n\n@author: felix\n'''\nimport sys\nfrom PyPDF2 import PdfFileReader\nfrom pytagcloud import create_tag_image, make_tags, LAYOUT_HORIZONTAL\nfrom pytagcloud.lang.counter import get_tag_counts\n\ndef mai...
[ 0 ]
#!/usr/bin/env python ############## #### Your name: Alexis Vincent ############## import numpy as np import re from skimage.color import convert_colorspace from sklearn.model_selection import GridSearchCV from sklearn import svm, metrics from skimage import io, feature, filters, exposu...
normal
{ "blob_id": "58204b4b035aa06015def7529852e882ffdd369a", "index": 8997, "step-1": "<mask token>\n\n\nclass ImageClassifier:\n <mask token>\n <mask token>\n <mask token>\n\n def extract_image_features(self, data):\n fd = None\n for pic in data:\n rescaled_picture = exposure.res...
[ 5, 7, 9, 10, 12 ]
import os import sys import shutil import re dl_dir = '/home/acarnec/Downloads/' college_dir = '/home/acarnec/Documents/3rdYear' latex_dir = '/home/acarnec/Documents/Latex/' modules = ['mta', 'ana', 'met', 'log', 'mat', 'lin', 'min', 'pol', 'mic', 'mte'] michaelmas = ['mta', 'ana', 'met', 'log', 'mat']...
normal
{ "blob_id": "3989b4c2a15fa8cd54fef86f9d7150fbd0fb74cf", "index": 8724, "step-1": "<mask token>\n\n\ndef change_directory(path):\n \"\"\" \n Changes directory to path. \n \"\"\"\n os.chdir(path)\n\n\n<mask token>\n\n\ndef get_key_from_values(f, catalog):\n \"\"\"\n Gets the full associated with ...
[ 6, 9, 13, 15, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LuckDrawActivity(Base): <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class LuckDrawActivity(Base): @allure.step('参加抽奖活动') def join_luck_draw_activity(self, driver...
flexible
{ "blob_id": "6b1970ee2b0d24504f4dea1f2ad22a165101bfbe", "index": 8958, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass LuckDrawActivity(Base):\n <mask token>\n", "step-3": "<mask token>\n\n\nclass LuckDrawActivity(Base):\n\n @allure.step('参加抽奖活动')\n def join_luck_draw_activity(self, d...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- """Install and activate pre-commit and its hooks into virtual environment.""" from __future__ import (absolute_import, division, print_function, unicode_literals) import os import sys # if sys.version_info[0] > 2 or sys.version_info[1] < 7: # p...
normal
{ "blob_id": "210d1a184d338d77d4c41327d0a9e2a5a56eb2ae", "index": 2724, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n VENV = os.environ[VENV_NAME]\n if VENV == '':\n print(\"Environment variable '%s' is empty\" % VENV_NAME)\n print('Please activate your virtualenv first')\n ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> fresh_tomatoes.open_movies_page(movies) <|reserved_special_token_1|> <|reserved_special_token_0|> alien_covenant = media.Movie('Alien: Covenant', 'The crew of a colony ship, bound for a remote planet, discover an uncharted ...
flexible
{ "blob_id": "9dfc8414628a8b09de3c24c504dd4163efdd3d35", "index": 6010, "step-1": "<mask token>\n", "step-2": "<mask token>\nfresh_tomatoes.open_movies_page(movies)\n", "step-3": "<mask token>\nalien_covenant = media.Movie('Alien: Covenant',\n 'The crew of a colony ship, bound for a remote planet, discover...
[ 0, 1, 2, 3, 4 ]
# Set up path references and dependencies. import os, sys, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0, parentdir) sys.path.append(os.path.join(parentdir, "utils")) # Import important helper libraries. from fla...
normal
{ "blob_id": "7d099012584b84e9767bf0ce9d9df1596ca3bbab", "index": 542, "step-1": "<mask token>\n\n\n@app.route('/')\ndef index():\n result_plot = compute_model_output()\n return render_template('index.html', graphJSON=result_plot)\n\n\ndef compute_model_output():\n num_steps = 500\n init_inf = 5\n ...
[ 2, 3, 4, 5, 6 ]
<|reserved_special_token_0|> def truncateFile(fileName): fileTemp = open(fileName, 'w') fileTemp.truncate() fileTemp.close() def getConnBySecName(dbConf, secName): descSec = '' secs = dbConf.sections() for sec in secs: if sec == secName: descSec = sec conn = getConnOn...
flexible
{ "blob_id": "df984939c109662bebbd1556c12223fce8f643e6", "index": 1773, "step-1": "<mask token>\n\n\ndef truncateFile(fileName):\n fileTemp = open(fileName, 'w')\n fileTemp.truncate()\n fileTemp.close()\n\n\ndef getConnBySecName(dbConf, secName):\n descSec = ''\n secs = dbConf.sections()\n for s...
[ 3, 4, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(res.read().decode('utf-8')) <|reserved_special_token_1|> <|reserved_special_token_0|> context = ssl._create_unverified_context() url = ( 'https://oauth.51job.com/get_login.php?client_id=000001&redirect_uri=https%3A%2F...
flexible
{ "blob_id": "2a37d02c7a0840e855a80adced4794fd757e353a", "index": 2917, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(res.read().decode('utf-8'))\n", "step-3": "<mask token>\ncontext = ssl._create_unverified_context()\nurl = (\n 'https://oauth.51job.com/get_login.php?client_id=000001&redirect_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ''' quarter = 0.25 dime = 0.10 nickel = 0.05 penny = 0.01 ''' #def poschg(dollar_amount,number):
flexible
{ "blob_id": "0deec9058c6f7b77ba4fa3bfc0269c8596ce9612", "index": 1215, "step-1": "<mask token>\n", "step-2": "'''\nquarter = 0.25\ndime = 0.10\nnickel = 0.05\npenny = 0.01\n'''\n\n#def poschg(dollar_amount,number):\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
""" Solution to Codeforces problem 50A Copyright (c) GeneralMing. All rights reserved. https://github.com/GeneralMing/codeforces """ n = input().split() n[0] = int(n[0]) n[1] = int(n[1]) print((n[0]*n[1])//2)
normal
{ "blob_id": "41a80feeb1fdc8ad783706ad261f5fc1124371d6", "index": 8216, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(n[0] * n[1] // 2)\n", "step-3": "<mask token>\nn = input().split()\nn[0] = int(n[0])\nn[1] = int(n[1])\nprint(n[0] * n[1] // 2)\n", "step-4": "\"\"\"\n\tSolution to Codeforces p...
[ 0, 1, 2, 3 ]
#Array In Python from array import array numbers = array("i",[1,2,3]) numbers[0] = 0 print(list(numbers))
normal
{ "blob_id": "ae5f87f1c383478ea5f370af1c85d63a472a7788", "index": 455, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(list(numbers))\n", "step-3": "<mask token>\nnumbers = array('i', [1, 2, 3])\nnumbers[0] = 0\nprint(list(numbers))\n", "step-4": "from array import array\nnumbers = array('i', [1,...
[ 0, 1, 2, 3, 4 ]
import json subjects = [] with open("sub.json", 'r') as subject_file: subjects = json.load(subject_file) print(json.dumps(subjects, separators=(',',':')))
normal
{ "blob_id": "98bd4eb25a76fb9184f9abfcb920a6fbe46b9394", "index": 631, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('sub.json', 'r') as subject_file:\n subjects = json.load(subject_file)\nprint(json.dumps(subjects, separators=(',', ':')))\n", "step-3": "<mask token>\nsubjects = []\nwith o...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> from .kahfm_batch import KaHFMBatch
flexible
{ "blob_id": "8e317d4d8ae8dc3d692d237e7e0abfaf37aecbb6", "index": 7017, "step-1": "<mask token>\n", "step-2": "from .kahfm_batch import KaHFMBatch\n", "step-3": null, "step-4": null, "step-5": null, "step-ids": [ 0, 1 ] }
[ 0, 1 ]
<|reserved_special_token_0|> def test_createColorVector(): k = 2 no_sec_peak = 1 template = 'EEESSSIIISSSBBBSSSHHHSSSSSSIIISSSEEE' kmer_counts = {'EE': 5, 'ES': 7, 'SS': 20, 'SI': 10, 'II': 15, 'IS': 11, 'SB': 5, 'BB': 6, 'BS': 5, 'SH': 4, 'HH': 5, 'HS': 4, 'SE': 7} template_sTree = STree....
flexible
{ "blob_id": "60b1a77d2de4a52ae9597f88917c4a3996c99923", "index": 5626, "step-1": "<mask token>\n\n\ndef test_createColorVector():\n k = 2\n no_sec_peak = 1\n template = 'EEESSSIIISSSBBBSSSHHHSSSSSSIIISSSEEE'\n kmer_counts = {'EE': 5, 'ES': 7, 'SS': 20, 'SI': 10, 'II': 15, 'IS': 11,\n 'SB': 5, ...
[ 1, 3, 4, 5, 6 ]
# Generated by Django 2.2.6 on 2020-05-21 09:44 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('DHOPD', '0015_auto_20200515_0126'), ] operations = [ migrations.CreateModel( name='Patient_c', field...
normal
{ "blob_id": "52da8608e43b2d8dfe00f0956a1187fcf2e7b1ff", "index": 41, "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 = [('DHOPD', '0015...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class DepositForm(base.DepositForm): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> @classmethod def is_automatic(cls, instance):...
flexible
{ "blob_id": "15c1db535beb115c45aeba433a946255f70fa86e", "index": 7845, "step-1": "<mask token>\n\n\nclass DepositForm(base.DepositForm):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n @classmethod\n def is_automatic(cls, instance):\n r...
[ 9, 10, 11, 13, 17 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with urlopen('http://api.nbp.pl/api/exchangerates/tables/A/') as site: data = loads(site.read().decode('utf-8')) rates = data[0]['rates'] exchange = input('Jaką wartość chcesz wymienić na złotówki? ') value, code =...
flexible
{ "blob_id": "3f3d7cdf7732b2a1568cd97574e1443225667327", "index": 9622, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith urlopen('http://api.nbp.pl/api/exchangerates/tables/A/') as site:\n data = loads(site.read().decode('utf-8'))\n rates = data[0]['rates']\n exchange = input('Jaką wartość chc...
[ 0, 1, 2, 3 ]
from django.contrib import admin from .models import Hash admin.site.register(Hash)
normal
{ "blob_id": "e2e4adaa8f7f62662e0c2915faff1bed72986351", "index": 1084, "step-1": "<mask token>\n", "step-2": "<mask token>\nadmin.site.register(Hash)\n", "step-3": "from django.contrib import admin\nfrom .models import Hash\nadmin.site.register(Hash)\n", "step-4": null, "step-5": null, "step-ids": [ ...
[ 0, 1, 2 ]
import heapq as heap import networkx as nx import copy import random def remove_jumps(moves): res = [] for move in moves: if move[2] > 1: move[3].reverse() res.extend(make_moves_from_path(move[3])) else: res.append(move) return res def make_moves_from...
normal
{ "blob_id": "800edfc61635564abf8297c4f33c59d48cc99960", "index": 4058, "step-1": "<mask token>\n\n\ndef make_moves_from_path(path):\n moves = []\n p = path[:]\n for i in range(len(p) - 1):\n moves.append((p[i + 1], p[i], 1, [p[i + 1], p[i]]))\n return moves\n\n\ndef find_nearest_hole(o, r, gra...
[ 7, 11, 12, 16, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for obj_file in OBJ_FILES: cond_results[obj_file] = set() dump = subprocess.run(['objdump', '-M', 'intel', '-dr', PREFIX + obj_file], stdout=subprocess.PIPE, check=True).stdout for line in dump.decode('utf-8')....
flexible
{ "blob_id": "45d69194e14e8c20161e979d4ff34d0b90df4672", "index": 4750, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor obj_file in OBJ_FILES:\n cond_results[obj_file] = set()\n dump = subprocess.run(['objdump', '-M', 'intel', '-dr', PREFIX +\n obj_file], stdout=subprocess.PIPE, check=True...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def longestConsecutive(self, nums) ->int: s = set(nums) answer = 0 for value in s: if value - 1 not in s: ...
flexible
{ "blob_id": "9cb5573fada7a1529507da1d031f836044c10066", "index": 2474, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def longestConsecutive(self, nums) ->int:\n s = set(nums)\n answer = 0\n for value in s:\n if v...
[ 0, 1, 2, 3 ]
################################################################################ # # # This file is part of the Potato Engine (PE). # # ...
normal
{ "blob_id": "595912753d778a0fa8332f0df00e06a9da5cde93", "index": 447, "step-1": "<mask token>\n", "step-2": "<mask token>\nSetOption('num_jobs', 4)\nSetOption('implicit_cache', 1)\n<mask token>\nbuildVariables.Add(PathVariable('QTDIR', 'Qt4 root directory',\n '/usr/share/qt4', PathVariable.PathIsDir))\nbuil...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def send_archs_from_queue_to_main_dataset(context): background_queue_qs = Design.objects.filter(activecontext_id__exact= context.eosscontext.activecontext.id) arch_list = [] for design in background_queue_qs....
flexible
{ "blob_id": "564c613491b0d1797b216a0bd425690e9fae12bc", "index": 7725, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef send_archs_from_queue_to_main_dataset(context):\n background_queue_qs = Design.objects.filter(activecontext_id__exact=\n context.eosscontext.activecontext.id)\n arch_...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for episode in range(EPISODE_COUNT): obs = env.reset() agent.reset() steps = 0 if (episode + 1) % 100 == 0: state = {'model_state': agent.model.state_dict(), 'optim_state': agent.optim.state_dic...
flexible
{ "blob_id": "bf133e73f0c842603dbd7cc3a103a2aa95e2236e", "index": 4359, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor episode in range(EPISODE_COUNT):\n obs = env.reset()\n agent.reset()\n steps = 0\n if (episode + 1) % 100 == 0:\n state = {'model_state': agent.model.state_dict(), ...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for n in range(len(user_input)): explosion_strength = 0 if user_input[n] == '>': explosion_strength += int(user_input[n + 1]) if user_input[n + explosion_strength] != '>': exploded_str = user_in...
flexible
{ "blob_id": "7930bb813bd546747c7c65b661900939f5ba93f1", "index": 273, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor n in range(len(user_input)):\n explosion_strength = 0\n if user_input[n] == '>':\n explosion_strength += int(user_input[n + 1])\n if user_input[n + explosion_streng...
[ 0, 1, 2, 3 ]
"""asks the user for english words to latinize""" def latinize_word(word): """performs bee latin on a word""" if word[0].lower() in 'bcdfghjklmnpqrstvwxyz': word = word[1:] + word[0] + 'uzz' else: word += 'buzz' return word.lower() def latinize_sentence(sentence): """performs bee...
normal
{ "blob_id": "5810739300067e8f207d09bf971484a278372a9a", "index": 5246, "step-1": "<mask token>\n\n\ndef latinize_word(word):\n \"\"\"performs bee latin on a word\"\"\"\n if word[0].lower() in 'bcdfghjklmnpqrstvwxyz':\n word = word[1:] + word[0] + 'uzz'\n else:\n word += 'buzz'\n return ...
[ 1, 2, 3, 4, 5 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('Your name is ' + name + ', you are ' + age + ' years old, and your username is ' + reddit) <|reserved_special_token_1|> name = input('What is your name? ') age = input('How old are you? ') reddit = input('What is you...
flexible
{ "blob_id": "00531c5a7fdcd24204b0546c081bbe7d63d0a6b2", "index": 1520, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('Your name is ' + name + ', you are ' + age +\n ' years old, and your username is ' + reddit)\n", "step-3": "name = input('What is your name? ')\nage = input('How old are you? ...
[ 0, 1, 2, 3 ]
import socket import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(20,GPIO.OUT,initial=GPIO.LOW) #green GPIO.setup(21,GPIO.OUT,initial=GPIO.LOW) #red GPIO.setwarnings(False) host = '192.168.87.191' port = 5560 def setupServer(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print("Soc...
normal
{ "blob_id": "78efe97d838774cb831ef205186db29f392e1953", "index": 1584, "step-1": "<mask token>\n\n\ndef RED(t):\n GPIO.output(21, 1)\n time.sleep(1)\n GPIO.output(21, 0)\n\n\n<mask token>\n\n\ndef dataTransfer(conn):\n while True:\n data = conn.recv(1024)\n data = data.decode('utf-8')\n...
[ 2, 4, 7, 9, 10 ]
def check22(y, x, board): dirs = [[0, 1], [1, 0], [1, 1]] ret = [(y, x)] for d in dirs: dy, dx = y + d[0], x + d[1] if not (0 <= dy < len(board) and 0 <= dx < len(board[0]) and board[ dy][dx] != '0' and board[y][x] == board[dy][dx]): return False else: ...
flexible
{ "blob_id": "938c4325480608b904bfbe0b11c081166aad694b", "index": 7291, "step-1": "def check22(y, x, board):\n dirs = [[0, 1], [1, 0], [1, 1]]\n ret = [(y, x)]\n for d in dirs:\n dy, dx = y + d[0], x + d[1]\n if not (0 <= dy < len(board) and 0 <= dx < len(board[0]) and board[\n d...
[ 1, 2, 3, 4, 5 ]
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/8/15 下午5:04 # @Author : Zessay from .ffm import * from .fm import * from .utils import * from .base_model import * from .base_trainer import * from .logger import * from .metric import * from .input_fn import *
normal
{ "blob_id": "bbdb07a81d785bdf067707c4e56622a2ada76b7b", "index": 1692, "step-1": "<mask token>\n", "step-2": "from .ffm import *\nfrom .fm import *\nfrom .utils import *\nfrom .base_model import *\nfrom .base_trainer import *\nfrom .logger import *\nfrom .metric import *\nfrom .input_fn import *\n", "step-3"...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def evaluate_comparison_range(node): """ evaluate the numerical range of Comparison node, if any else returns None """ return None def is_comparison(node): """ test if node is a Comparison node or not """ return isinstance(node, Comparison) <|reserved_special_t...
flexible
{ "blob_id": "3a05ebee8e70321fe53637b4792f5821ce7044be", "index": 4264, "step-1": "<mask token>\n\n\ndef evaluate_comparison_range(node):\n \"\"\" evaluate the numerical range of Comparison node, if any\n else returns None \"\"\"\n return None\n\n\ndef is_comparison(node):\n \"\"\" test if node is...
[ 14, 15, 16, 17, 18 ]
# terrascript/external/__init__.py import terrascript class external(terrascript.Provider): pass
normal
{ "blob_id": "04e57739e6fb98cd237fbe09caecd17c728c1797", "index": 5548, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass external(terrascript.Provider):\n pass\n", "step-3": "import terrascript\n\n\nclass external(terrascript.Provider):\n pass\n", "step-4": "# terrascript/external/__init...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> @pytest.mark.parametrize(('server_type', 'expected_type'), DB_TYPES + [ param('GEOMETRY', dt.geometry, marks=[skipif_no_geospatial_deps]), param('GEOGRAPHY', dt.geography, marks=[skipif_no_geospatial_deps])] + [param...
flexible
{ "blob_id": "00e9872136e5753364117adbf60793e660c8bef0", "index": 485, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\n@pytest.mark.parametrize(('server_type', 'expected_type'), DB_TYPES + [\n param('GEOMETRY', dt.geometry, marks=[skipif_no_geospatial_deps]),\n param('GEOGRAPHY', dt.geography, ma...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "957db647500433fd73723fdeb3933037ba0641b1", "index": 1527, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
# Imports import numpy as np from ctf.functions2d.function2d import Function2D # Problem class StyblinskiTang(Function2D): """ Styblinski-Tang Function. """ def __init__(self): """ Constructor. """ # Information self.min = np.array([-2.903534, -2.903534]) self.value = -39.16...
normal
{ "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 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if 0 < cal < 2400: print('Tuesday') elif cal < 0: print('Monday') else: print('Wednesday') <|reserved_special_token_1|> offset = input() cal = 1030 + int(offset) * 100 if 0 < cal < 2400: print('Tuesday') elif ca...
flexible
{ "blob_id": "aefb49410e077180a660d17c4c646265a75969a7", "index": 7509, "step-1": "<mask token>\n", "step-2": "<mask token>\nif 0 < cal < 2400:\n print('Tuesday')\nelif cal < 0:\n print('Monday')\nelse:\n print('Wednesday')\n", "step-3": "offset = input()\ncal = 1030 + int(offset) * 100\nif 0 < cal <...
[ 0, 1, 2 ]
<|reserved_special_token_0|> @login_manager.user_loader def load_user(id): user = Student.query.get(int(id)) if user is not None: return user else: return Instructor.query.get(int(id)) <|reserved_special_token_0|> @app.route(base_url + 'instructorProfile', methods=['GET']) def instruct...
flexible
{ "blob_id": "5dc17db0aca109720d1ba62d65b86d9b81714063", "index": 6622, "step-1": "<mask token>\n\n\n@login_manager.user_loader\ndef load_user(id):\n user = Student.query.get(int(id))\n if user is not None:\n return user\n else:\n return Instructor.query.get(int(id))\n\n\n<mask token>\n\n\n...
[ 9, 10, 13, 17, 18 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> with open('movies.csv', 'w') as file: csv_writer = writer(file) csv_writer.writerow(['Name', 'Year']) csv_writer.writerow(['Ratchasan', 2018]) csv_writer.writerow(['Vadachennai', 2018]) csv_writer.writerow(['Na...
flexible
{ "blob_id": "83e231480c618d290089340c642313bbba4f1070", "index": 2035, "step-1": "<mask token>\n", "step-2": "<mask token>\nwith open('movies.csv', 'w') as file:\n csv_writer = writer(file)\n csv_writer.writerow(['Name', 'Year'])\n csv_writer.writerow(['Ratchasan', 2018])\n csv_writer.writerow(['Va...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> if mibBuilder.loadTexts: ds0Bundle.setOrganization('IETF Trunk MIB Working Group') if mibBuilder.loadTexts: ds0Bundle.setContactInfo( """ David Fowler Postal: Newbridge Networks Corporation 600 Marc...
flexible
{ "blob_id": "fab15d34d29301e53a26577725cdd66dca7507bc", "index": 2330, "step-1": "<mask token>\n", "step-2": "<mask token>\nif mibBuilder.loadTexts:\n ds0Bundle.setOrganization('IETF Trunk MIB Working Group')\nif mibBuilder.loadTexts:\n ds0Bundle.setContactInfo(\n \"\"\" David Fowler\n\nPos...
[ 0, 1, 2, 3 ]
from tkinter import * from PIL import ImageTk,Image import sys, os # This will display images and icon root = Tk() root.title("Expanding GUI") # With ubuntu, it did not work the icon part #root.iconbitmap('@/home/gxgarciat/Documents/Tkinter/gdrive.ico') #root.iconphoto(True, PhotoImage(file="@/home/gxgarciat/Docume...
normal
{ "blob_id": "2da10163a40c9720ca9deecd9afb0e39aa885546", "index": 5523, "step-1": "<mask token>\n", "step-2": "<mask token>\nroot.title('Expanding GUI')\n<mask token>\nmy_label.pack()\n<mask token>\nbuttonquit.pack()\nroot.mainloop()\n", "step-3": "<mask token>\nroot = Tk()\nroot.title('Expanding GUI')\nmy_im...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def apply_timezone_datetime(_local_tz: str, _time: datetime.time): """ set time zone + merge now().date() with time() :param _local_tz: :param _time: :return: """ return pytz.timezone(_local_tz).local...
flexible
{ "blob_id": "347627df4b08eca6e2137161472b4d31534cf81b", "index": 1238, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef apply_timezone_datetime(_local_tz: str, _time: datetime.time):\n \"\"\"\n set time zone + merge now().date() with time()\n :param _local_tz:\n :param _time:\n :retu...
[ 0, 1, 2 ]
# Standard Library Imports # Third Party Imports from kivy.clock import Clock from kivy.properties import StringProperty from kivy.uix.screenmanager import Screen, ScreenManager from kivy.uix.widget import Widget # Local Imports from client.source.ui.kv_widgets import ModalPopupButton, SubmissionPopup, FailedSubmissi...
normal
{ "blob_id": "327e9dcba49419b8a8c320940e333765c1d9b980", "index": 5997, "step-1": "<mask token>\n\n\nclass ChatRoomScreen(Screen):\n <mask token>\n <mask token>\n <mask token>\n\n def schedule_update_display_info(self, *args):\n Clock.schedule_interval(self.update_display_info, 1)\n <mask to...
[ 7, 12, 17, 20, 22 ]
<|reserved_special_token_0|> def convertImage(imgData): getI420FromBase64(imgData) <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> sys.path.append(os.path.abspath('./models')) <|reserved_special_token_0|> def getI420FromBase64(codec): base64_data = re.sub('^data:i...
flexible
{ "blob_id": "b84b3206e87176feee2c39fc0866ada994c9ac7a", "index": 8655, "step-1": "<mask token>\n\n\ndef convertImage(imgData):\n getI420FromBase64(imgData)\n\n\n<mask token>\n", "step-2": "<mask token>\nsys.path.append(os.path.abspath('./models'))\n<mask token>\n\n\ndef getI420FromBase64(codec):\n base64...
[ 1, 5, 6, 7, 8 ]
#!/usr/bin/python3 import tkinter from PIL import Image, ImageTk import requests from io import BytesIO from threading import Timer rootWindow = tkinter.Tk() # the following makes the program full-screen RWidth = rootWindow.winfo_screenwidth() RHeight = rootWindow.winfo_screenheight() # rootWindow.overrideredirect(...
normal
{ "blob_id": "be63e8e6e98c9afed66cae033a7f41f1be1561a8", "index": 8077, "step-1": "<mask token>\n\n\ndef refreshCam03():\n try:\n tmp_photo = URL2PhotoImage(cameraURL03)\n image03_label.configure(image=tmp_photo)\n image03_label.image = tmp_photo\n except:\n pass\n if rootWind...
[ 3, 10, 11, 14, 16 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> gerar_senha() <|reserved_special_token_1|> from gerador_senha import gerar_senha gerar_senha()
flexible
{ "blob_id": "e81da535408cc36655328b37ca99b4f775f3a78e", "index": 8435, "step-1": "<mask token>\n", "step-2": "<mask token>\ngerar_senha()\n", "step-3": "from gerador_senha import gerar_senha\ngerar_senha()\n", "step-4": null, "step-5": null, "step-ids": [ 0, 1, 2 ] }
[ 0, 1, 2 ]
#!/usr/bin/env python import os import shutil import glob import re import subprocess list = glob.glob("*en.mrc") for en in list: ef = re.sub("en","ef",en) efAli = re.sub("en","efAli",en) cmd='proc2d %s %s_filt.mrc apix=1.501 lp=20' %(ef,ef[:-4]) subprocess.Popen(cmd,shell=True).wait() cmd="alignhuge %s_fil...
normal
{ "blob_id": "e5cc556d4258ef5c85f7bc5149cdd33471493bdb", "index": 1972, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor en in list:\n ef = re.sub('en', 'ef', en)\n efAli = re.sub('en', 'efAli', en)\n cmd = 'proc2d %s %s_filt.mrc apix=1.501 lp=20' % (ef, ef[:-4])\n subprocess.Popen(cmd, shel...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def append_log(log, message): f = open(log, 'a+') today = datetime.now() f.write('%s %s \n' % (today.strftime('%Y-%m-%d %H:%M:%S'), message)) f.close() def get_root_pass(): with open('/root/.my.cnf') as fp: lines = fp.read().splitlines() for line in lines...
flexible
{ "blob_id": "e09af436f2fb37d16427aa0b1416d6f2d59ad6c4", "index": 214, "step-1": "<mask token>\n\n\ndef append_log(log, message):\n f = open(log, 'a+')\n today = datetime.now()\n f.write('%s %s \\n' % (today.strftime('%Y-%m-%d %H:%M:%S'), message))\n f.close()\n\n\ndef get_root_pass():\n with open(...
[ 10, 11, 13, 14, 15 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print(response.geturl()) <|reserved_special_token_0|> with open('bgdGW.html', 'w', encoding='utf-8') as fp: fp.write(html) print(response.geturl()) <|reserved_special_token_1|> <|reserved_special_token_0|> response = urllib...
flexible
{ "blob_id": "b186ae7a48afbb70edf3be0d9697deed4f31e542", "index": 2258, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint(response.geturl())\n<mask token>\nwith open('bgdGW.html', 'w', encoding='utf-8') as fp:\n fp.write(html)\nprint(response.geturl())\n", "step-3": "<mask token>\nresponse = urlli...
[ 0, 1, 2, 3, 4 ]
import collections # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def isSymmetric(self, root: TreeNode) -> bool: if not root: return True ...
normal
{ "blob_id": "24a4b9246a9b15334bebc45c532a25bd81266918", "index": 9650, "step-1": "<mask token>\n\n\nclass Solution:\n <mask token>\n", "step-2": "<mask token>\n\n\nclass TreeNode:\n <mask token>\n\n\nclass Solution:\n\n def isSymmetric(self, root: TreeNode) ->bool:\n if not root:\n r...
[ 1, 3, 4, 5, 6 ]
from django.core.urlresolvers import reverse from keptar import settings import os, os.path import Image try: from collections import OrderedDict except ImportError: from keptar.odict import OrderedDict class AccessDenied(Exception): pass class FileNotFound(Exception): pass class NotDirectory(Excepti...
normal
{ "blob_id": "d9156c20e046f608563bc6779575e14cc60f4c25", "index": 896, "step-1": "<mask token>\n\n\nclass AccessDenied(Exception):\n pass\n\n\nclass FileNotFound(Exception):\n pass\n\n\nclass NotDirectory(Exception):\n pass\n\n\n<mask token>\n\n\ndef get_parent(path):\n \"\"\"A megadott elem szulokony...
[ 5, 6, 10, 11, 12 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('------rectangle-------') <|reserved_special_token_0|> print('area of rectangle : ', RectArea(1, b)) print('perimeter of rectangle : ', Rectperimeter(1, b)) print() print('-------circle-------') <|reserved_special_token_0|> ...
flexible
{ "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 uuid import json import pytest import requests import httpx from spinta.testing.manifest import bootstrap_manifest from spinta.utils.data import take from spinta.testing.utils import error from spinta.testing.utils import get_error_codes, RowIds from spinta.testing.context import create_test_context from spint...
normal
{ "blob_id": "57e9c1a4ac57f68e0e73c2c67c6828de8efb1b16", "index": 3903, "step-1": "<mask token>\n\n\ndef _push_test_data(app, model, data=None):\n app.authmodel(model, ['insert'])\n resp = app.post('/', json={'_data': [{**res, '_op': 'insert', '_type':\n model} for res in data or test_data]})\n as...
[ 43, 48, 56, 58, 63 ]
<|reserved_special_token_0|> class Ground: <|reserved_special_token_0|> <|reserved_special_token_0|> def draw(self, window): pygame.draw.rect(window, self.color, self.rect) return <|reserved_special_token_1|> <|reserved_special_token_0|> class Ground: def __init__(self, space): ...
flexible
{ "blob_id": "32fc0db68c32c2e644f9c1c2318fbeff41a0543d", "index": 5703, "step-1": "<mask token>\n\n\nclass Ground:\n <mask token>\n <mask token>\n\n def draw(self, window):\n pygame.draw.rect(window, self.color, self.rect)\n return\n", "step-2": "<mask token>\n\n\nclass Ground:\n\n def...
[ 2, 3, 4, 5, 6 ]
import math import decimal from typing import Union, List, Set from sqlalchemy import text from .model import BaseMixin from ..core.db import db Orders = List[Set(str, Union(str, int, decimal.Decimal))] class BaseDBMgr: def get_page(self, cls_:BaseMixin, filters:set, orders:Orders=list(), field:tuple=(), pag...
normal
{ "blob_id": "2c90c4e0b42a75d6d387b9b2d0118d8e991b5a08", "index": 39, "step-1": "<mask token>\n\n\nclass BaseDBMgr:\n\n def get_page(self, cls_: BaseMixin, filters: set, orders: Orders=list(),\n field: tuple=(), page: int=1, per_page: int=10) ->dict:\n \"\"\"获取分页数据\n @param BaseMixin cls 数...
[ 3, 7, 8, 9, 11 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> for i in l: card[i - a] += 1 for j in v: if (j >= a) & (j <= b): print(card[j - a], end=' ') else: print(0, end=' ') <|reserved_special_token_1|> <|reserved_special_token_0|> n = int(sys.stdin.readli...
flexible
{ "blob_id": "6b0081e829f9252e44fa7b81fbfcdd4115856373", "index": 3748, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in l:\n card[i - a] += 1\nfor j in v:\n if (j >= a) & (j <= b):\n print(card[j - a], end=' ')\n else:\n print(0, end=' ')\n", "step-3": "<mask token>\nn = i...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> try: VENV = os.environ[VENV_NAME] if VENV == '': print("Environment variable '%s' is empty" % VENV_NAME) print('Please activate your virtualenv first') sys.exit(3) if not os.path.isdir(VENV): ...
flexible
{ "blob_id": "210d1a184d338d77d4c41327d0a9e2a5a56eb2ae", "index": 2724, "step-1": "<mask token>\n", "step-2": "<mask token>\ntry:\n VENV = os.environ[VENV_NAME]\n if VENV == '':\n print(\"Environment variable '%s' is empty\" % VENV_NAME)\n print('Please activate your virtualenv first')\n ...
[ 0, 1, 2, 3, 4 ]
"""Sorting components: peak waveform features.""" import numpy as np from spikeinterface.core.job_tools import fix_job_kwargs from spikeinterface.core import get_channel_distances from spikeinterface.sortingcomponents.peak_localization import LocalizeCenterOfMass, LocalizeMonopolarTriangulation from spikeinterface.sor...
normal
{ "blob_id": "6fe22b3f98bff1a9b775fce631ae94a4ee22b04c", "index": 4371, "step-1": "<mask token>\n\n\nclass RandomProjectionsFeature(PipelineNode):\n <mask token>\n\n def get_dtype(self):\n return self._dtype\n <mask token>\n\n\nclass RandomProjectionsEnergyFeature(PipelineNode):\n\n def __init_...
[ 22, 24, 28, 31, 40 ]
# created by RomaOkorosso at 21.03.2021 # models.py from datetime import datetime from sqlalchemy import ( Column, Integer, String, Boolean, DateTime, ForeignKey, Date ) from sqlalchemy.dialects import postgresql from sqlalchemy.orm import relationship from Database.database import Base ...
normal
{ "blob_id": "a288e66e64d386afd13bfc7b5b13d4a47d15cd6d", "index": 1316, "step-1": "<mask token>\n\n\nclass Client(Base):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass TakenBook(Base):\n __tablename__ = 'taken_books'\n id = Column(Integ...
[ 3, 7, 8, 10, 12 ]
<|reserved_special_token_0|> class TextDocPrintout(wx.Printout): <|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...
flexible
{ "blob_id": "2790bd80949bafe4e98ab9aca9cf80a6a0f31490", "index": 6200, "step-1": "<mask token>\n\n\nclass TextDocPrintout(wx.Printout):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass PrintFrameworkSample(w...
[ 10, 14, 16, 19, 22 ]
import pandas as pd from pandas import Series, DataFrame def load_excel(data_path, data_name, episode_Num): data_name = data_name + str(episode_Num) + '.xlsx' dataframe = pd.read_excel(data_path + data_name, index_col=0) return dataframe def dataframe_to_numpy(dataframe): numpy_array = dataframe.to_...
normal
{ "blob_id": "b63dc8b9aa2f0593a4a7eb52a722a9c4da6c9e08", "index": 7804, "step-1": "<mask token>\n\n\ndef dataframe_to_numpy(dataframe):\n numpy_array = dataframe.to_numpy()\n return numpy_array\n\n\n<mask token>\n\n\ndef data_slice(data, num_of_data):\n data = data[:, 1:num_of_data + 1]\n return data\...
[ 2, 4, 5, 6 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = [url('^$', show_articles, name='index'), url('^article/$', show_article, name='article'), url('^export/$', export_db, name='article')] <|reserved_special_token_1|> from django.conf.urls import url from .views....
flexible
{ "blob_id": "9fdc7c1eb68a92451d41313861164a915b85fcee", "index": 8988, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = [url('^$', show_articles, name='index'), url('^article/$',\n show_article, name='article'), url('^export/$', export_db, name='article')]\n", "step-3": "from django.conf...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> print('START') time.sleep(30) print('END') <|reserved_special_token_1|> <|reserved_special_token_0|> conf = SparkConf().setAppName('myTestCopyApp') sc = SparkContext(conf=conf) print('START') time.sleep(30) print('END') <|res...
flexible
{ "blob_id": "4b773fbf45d15dff27dc7bd51d6636c5f783477b", "index": 9183, "step-1": "<mask token>\n", "step-2": "<mask token>\nprint('START')\ntime.sleep(30)\nprint('END')\n", "step-3": "<mask token>\nconf = SparkConf().setAppName('myTestCopyApp')\nsc = SparkContext(conf=conf)\nprint('START')\ntime.sleep(30)\np...
[ 0, 1, 2, 3, 4 ]
import simplejson as json json_list = [ "/content/squash-generation/squash/final/Custom.json", "/content/squash-generation/squash/temp/Custom/final_qa_set.json", "/content/squash-generation/squash/temp/Custom/generated_questions.json", "/content/squash-generation/squash...
normal
{ "blob_id": "f37d016dc49820239eb42198ca922e8681a2e0a6", "index": 6929, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor i in json_list:\n with open(i) as f:\n obj = json.load(f)\n f.close()\n outfile = open(i, 'w')\n outfile.write(json.dumps(obj, indent=4, sort_keys=True))\n o...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class ReshapedDistribution(TorchDistribution): <|reserved_special_token_0|> <|reserved_special_token_0|> def __init__(self, base_dist, sample_shape=torch.Size(), reinterpreted_batch_ndims=0): sample_shape = torch.Size(sample_shape) if reinterpreted_bat...
flexible
{ "blob_id": "0f0ea6f07f9a082042ed9aff7a95d372c32b5a13", "index": 1897, "step-1": "<mask token>\n\n\nclass ReshapedDistribution(TorchDistribution):\n <mask token>\n <mask token>\n\n def __init__(self, base_dist, sample_shape=torch.Size(),\n reinterpreted_batch_ndims=0):\n sample_shape = tor...
[ 27, 35, 36, 39, 44 ]
from typing import Dict, Tuple import torch from tqdm import tqdm import schnetpack.properties as structure from schnetpack.data import AtomsLoader __all__ = ["calculate_stats"] def calculate_stats( dataloader: AtomsLoader, divide_by_atoms: Dict[str, bool], atomref: Dict[str, torch.Tensor] = None, ) ->...
normal
{ "blob_id": "b2944a95dbe25057155aaf6198a97d85b3bb620b", "index": 6436, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef calculate_stats(dataloader: AtomsLoader, divide_by_atoms: Dict[str,\n bool], atomref: Dict[str, torch.Tensor]=None) ->Dict[str, Tuple[torch.\n Tensor, torch.Tensor]]:\n \...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> def game_core_v3(number): """Сначала устанавливаем любое random число, а потом уменьшаем или увеличиваем его в зависимости от того, больше оно или меньше нужного. Функция принимает загаданное число и возвращает число попыток""" count = 1 allAnsvers = [x for x in range(1...
flexible
{ "blob_id": "66474b8cdca9a4aa48b8dc710d161a3a16495aed", "index": 6438, "step-1": "<mask token>\n\n\ndef game_core_v3(number):\n \"\"\"Сначала устанавливаем любое random число, а потом уменьшаем или увеличиваем его в зависимости от того, больше оно или меньше нужного.\n Функция принимает загаданное число...
[ 2, 3, 4, 5, 6 ]
import csv import io import pickle import os import pip from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from googleapiclient.http import MediaIoBaseDownload import cv2 import numpy as np SCOPES = ['https:/...
normal
{ "blob_id": "f32b9dc36b2452fea8c8f284fbf800f22608c3ae", "index": 8541, "step-1": "<mask token>\n\n\ndef install(package):\n if hasattr(pip, 'main'):\n pip.main(['install', package])\n else:\n pip._internal.main(['install', package])\n\n\n<mask token>\n\n\ndef get_gdrive_service():\n creds ...
[ 9, 11, 12, 13, 19 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> def test_cant_ever_init_twice(ethtester, root_chain): ethtester.chain.mine() with pytest.raises(TransactionFailed): root_chain.init(sender=ethtester.k0) with pytest.raises(TransactionFailed): root_cha...
flexible
{ "blob_id": "8417b63e2b7b16d3d58175022662c5b3e59e4aaf", "index": 4640, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef test_cant_ever_init_twice(ethtester, root_chain):\n ethtester.chain.mine()\n with pytest.raises(TransactionFailed):\n root_chain.init(sender=ethtester.k0)\n with p...
[ 0, 1, 2 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: <|reserved_special_token_0|> <|reserved_special_token_1|> class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) ->None: """ m->Size of nums1 list n->Size of nums2 list "...
flexible
{ "blob_id": "a732e7141ffb403ca6c5d9c4204cb96c8e831aab", "index": 6814, "step-1": "<mask token>\n", "step-2": "class Solution:\n <mask token>\n", "step-3": "class Solution:\n\n def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) ->None:\n \"\"\"\n m->Size of nums1 list\n ...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Sat Jul 1 10:18:11 2017 @author: Duong """ import pandas as pd import matplotlib.pyplot as plt import psycopg2 from pandas.core.frame import DataFrame # DBS verbinden database = psycopg2.connect(database="TeamYellow_election", user="student", password="pas...
normal
{ "blob_id": "076b852010ddcea69a294f9f2a653bb2fa2f2676", "index": 3531, "step-1": "<mask token>\n", "step-2": "<mask token>\ncursor.execute(\n 'SELECT tweet_date, COUNT(*) FROM projekt_election.tweet as tweet , projekt_election.hashtag_use as use WHERE tweet.tweet_id = use.tweet_id GROUP BY tweet_date ORDER ...
[ 0, 1, 2, 3, 4 ]
import inaccel.coral as inaccel import numpy as np import time class StereoBM: def __init__(self, cameraMA_l=None, cameraMA_r=None, distC_l=None, distC_r=None, irA_l=None, irA_r=None, bm_state=None ): # allocate mem for camera parameters for rectification and bm_state class with inaccel.allocator: if cameraMA_...
normal
{ "blob_id": "66f3590381fe96c49a8926a806b4a845f0d7e25d", "index": 4681, "step-1": "<mask token>\n\n\nclass StereoBM:\n <mask token>\n\n def runAsync(self, left_img, right_img):\n self.m_runStartTime = int(round(time.time() * 1000000))\n if left_img is None:\n raise RuntimeError('Inv...
[ 4, 5, 6, 7, 8 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class DocumentForm(forms.ModelForm): class Meta: model = Upload fields = 'document', <|reserved_special_token_1|> from django import forms from django.contrib.auth.models import User from django.contrib....
flexible
{ "blob_id": "e7b1ccbcbb81ff02561d858a4db54d49a2aa0f8a", "index": 6094, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass DocumentForm(forms.ModelForm):\n\n\n class Meta:\n model = Upload\n fields = 'document',\n", "step-3": "from django import forms\nfrom django.contrib.auth.mod...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> class Student(db.Model): __tablename__ = 'students' id = db.Column(db.Integer, primary_key=True) first_name = db.Column(db.Text) last_name = db.Column(db.Text) excuses = db.relationship('Excuse', backref='student', lazy='dynamic') def __init__(self, first_name, la...
flexible
{ "blob_id": "026e06e777d64f8724ec5e89a7829b3a42a25d6b", "index": 800, "step-1": "<mask token>\n\n\nclass Student(db.Model):\n __tablename__ = 'students'\n id = db.Column(db.Integer, primary_key=True)\n first_name = db.Column(db.Text)\n last_name = db.Column(db.Text)\n excuses = db.relationship('Ex...
[ 13, 14, 15, 16, 17 ]
from django.db import models from django.contrib.gis.db import models from django.contrib.auth.models import User from django.urls import reverse class Project(models.Model): actual_developer = models.ForeignKey(User,null = True,blank=True, on_delete=models.CASCADE) # actual_developer = models.CharField(User,null ...
normal
{ "blob_id": "ac1d38f550e548dff6ba226dbfc3dd1e5ff876a8", "index": 5563, "step-1": "<mask token>\n\n\nclass Project(models.Model):\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 token>\n ...
[ 3, 4, 5, 6, 7 ]
<|reserved_special_token_0|> def mouseMoved(): redraw() <|reserved_special_token_1|> <|reserved_special_token_0|> def setup(): global table table = loadTable('flights.csv', 'header') size(width, height) noLoop() noStroke() <|reserved_special_token_0|> def mouseMoved(): redraw() ...
flexible
{ "blob_id": "a2eabf4dae931d82e4e9eda87d79031711faf1aa", "index": 2221, "step-1": "<mask token>\n\n\ndef mouseMoved():\n redraw()\n", "step-2": "<mask token>\n\n\ndef setup():\n global table\n table = loadTable('flights.csv', 'header')\n size(width, height)\n noLoop()\n noStroke()\n\n\n<mask t...
[ 1, 2, 3, 4, 5 ]
from app.models.tables import Warehouse, Contractor, Articles class ContractorTools(Contractor): """ Работа со справочником КА """ @staticmethod def add_contractor(**kwargs): ca = Contractor(**kwargs) ca.insert() @staticmethod def delete_contractor(**kwargs): ca =...
normal
{ "blob_id": "79c4a2d4503c2639950675b398e000aae367ff4a", "index": 8117, "step-1": "<mask token>\n\n\nclass ArticleTools(Articles):\n <mask token>\n\n @staticmethod\n def add_article(**kwargs):\n ca = Articles(**kwargs)\n ca.insert()\n\n @staticmethod\n def update_article(**kwargs):\n ...
[ 12, 15, 19, 20, 21 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations.Migration): <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> class Migration(migrations....
flexible
{ "blob_id": "71662ff8c68559bf08e1da7f1a1504bfe842c950", "index": 7430, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n", "step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> while 'spam' in my_order: print("I don't like spam!") my_order.remove('spam') print(my_order) <|reserved_special_token_1|> my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam'] while 'spam' in my_order: pr...
flexible
{ "blob_id": "8e8629dd2d4bb601347694b18d7cb6a94880201d", "index": 8192, "step-1": "<mask token>\n", "step-2": "<mask token>\nwhile 'spam' in my_order:\n print(\"I don't like spam!\")\n my_order.remove('spam')\nprint(my_order)\n", "step-3": "my_order = ['spam', 'eggs', 'sausage', 'spam', 'bacon', 'spam']...
[ 0, 1, 2 ]
<|reserved_special_token_0|> def _kernel_shape(nd, k, indim, outdim): if isinstance(k, int): k = [k for _ in range(nd)] k = list(k) assert len(k) == nd k.extend([indim, outdim]) return k <|reserved_special_token_0|> @layer def conv(x, outdim, kernel=3, stride=1, pad=0, padding='SAME', ...
flexible
{ "blob_id": "940c3b4a2b96907644c0f12deddd8aba4086a0f0", "index": 5131, "step-1": "<mask token>\n\n\ndef _kernel_shape(nd, k, indim, outdim):\n if isinstance(k, int):\n k = [k for _ in range(nd)]\n k = list(k)\n assert len(k) == nd\n k.extend([indim, outdim])\n return k\n\n\n<mask token>\n\n...
[ 22, 26, 29, 32, 39 ]
#!/usr/bin/env python3 import matplotlib from matplotlib.colors import to_hex from matplotlib import cm import matplotlib.pyplot as plt import numpy as np import itertools as it from pathlib import Path import subprocess from tqdm import tqdm from koala import plotting as pl from koala import phase_diagrams as pd fr...
normal
{ "blob_id": "d429f03c0f0c241166d6c0a5a45dc1101bcaec16", "index": 5878, "step-1": "<mask token>\n\n\ndef multi_set_symmetric_difference(sets):\n return list(functools.reduce(lambda a, b: a ^ b, [set(s) for s in sets]))\n\n\ndef flood_iteration_plaquettes(l, plaquettes):\n return set(plaquettes) | set(it.cha...
[ 3, 4, 5, 6, 7 ]
import numpy as np import scipy class node(object): """docstring for node""" def __init__(self, feature_idx): super(node, self).__init__() self.children = None self.j = feature_idx self.c = None self.vals = None class decisionTree(object): """docstring for decisionTree""" def __init__(self, arg): sup...
normal
{ "blob_id": "c05994471d6608b5e48b71d253304a43100d583f", "index": 7296, "step-1": "import numpy as np\nimport scipy\n\n\nclass node(object):\n\t\"\"\"docstring for node\"\"\"\n\tdef __init__(self, feature_idx):\n\t\tsuper(node, self).__init__()\n\t\tself.children = None\n\t\tself.j = feature_idx\n\t\tself.c = Non...
[ 0 ]
#求11+12+13+。。。+m m = int(input('请输入一个数:')) S = m for x in range(11,m): S = S+x print('sum =',S)
normal
{ "blob_id": "49ffa225d433ef2263159ba2145da5ba2a95d1f2", "index": 4664, "step-1": "<mask token>\n", "step-2": "<mask token>\nfor x in range(11, m):\n S = S + x\nprint('sum =', S)\n", "step-3": "m = int(input('请输入一个数:'))\nS = m\nfor x in range(11, m):\n S = S + x\nprint('sum =', S)\n", "step-4": "#求11+...
[ 0, 1, 2, 3 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> urlpatterns = patterns('', url('^douban/books$', views.BookList.as_view())) <|reserved_special_token_1|> from django.conf.urls import patterns, url import views urlpatterns = patterns('', url('^douban/books$', views.BookList.as...
flexible
{ "blob_id": "93418e554893db4eb888396e8d6f60a8364d9ee3", "index": 8560, "step-1": "<mask token>\n", "step-2": "<mask token>\nurlpatterns = patterns('', url('^douban/books$', views.BookList.as_view()))\n", "step-3": "from django.conf.urls import patterns, url\nimport views\nurlpatterns = patterns('', url('^dou...
[ 0, 1, 2, 3 ]
# -*- coding: utf-8 -*- """ Created on Tue Mai 15 11:34:22 2018 @author: Diogo Leite """ from SQL_obj_new.Dataset_config_dataset_new_sql import _DS_config_DS_SQL class Dataset_conf_ds(object): """ This class treat the datasets configuration connection tables object has it exists in DATASET_CONF_DS table data...
normal
{ "blob_id": "76d2c3f74e8fae160396b4015ccec478dba97b87", "index": 7422, "step-1": "<mask token>\n\n\nclass Dataset_conf_ds(object):\n <mask token>\n\n def __init__(self, id_ds_conf_ds=-1, value_configuration=-1,\n FK_id_configuration_DCT_DCD=-1, FK_id_dataset_DS_DCD=-1):\n \"\"\"\n Cons...
[ 2, 3, 5, 6, 7 ]
#LIBRERIAS import cv2 import numpy as np #FUNCION: recibe una imagen y te devuelve las coordenadas de las caras def face_detector(img, face_cascade, eye_cascade, face_f): #variables face_f xf = face_f[0] yf = face_f[1] wf = face_f[2] hf = face_f[3] #variables img xi = 0 yi = 0 ...
normal
{ "blob_id": "1df3a5dc8ed767e20d34c2836eed79872a21a016", "index": 9948, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef face_detector(img, face_cascade, eye_cascade, face_f):\n xf = face_f[0]\n yf = face_f[1]\n wf = face_f[2]\n hf = face_f[3]\n xi = 0\n yi = 0\n wi = img.shape[...
[ 0, 1, 2, 3 ]
import requests def get(url): return requests.get(url).text
normal
{ "blob_id": "671ecf23df1da659d186014afa738d0608ad404d", "index": 9251, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef get(url):\n return requests.get(url).text\n", "step-3": "import requests\n\n\ndef get(url):\n return requests.get(url).text\n", "step-4": null, "step-5": null, "step...
[ 0, 1, 2 ]
#!/usr/bin/python2.7 import sys import datetime import psycopg2 import json import collections from pprint import pprint from pyral import Rally, rallyWorkset import copy import os import argparse from ConfigParser import SafeConfigParser import traceback global rally global server_name """ WARNING: This was hacked...
normal
{ "blob_id": "be0afa5184f753ed5f9a483379a4d81cd7af4886", "index": 6845, "step-1": "#!/usr/bin/python2.7\nimport sys\nimport datetime\nimport psycopg2\nimport json\nimport collections\nfrom pprint import pprint\nfrom pyral import Rally, rallyWorkset\nimport copy\nimport os\nimport argparse\nfrom ConfigParser impor...
[ 0 ]
#!/usr/bin/python import sys import itertools as it pop_list = [] #with open("/Users/dashazhernakova/Documents/Doby/GenomeRussia/ancientDNA/GR+Lazaridis.ind") as f: with open(sys.argv[1]) as f: [pop_list.append(l.strip().split("\t")[2]) for l in f if l.strip().split("\t")[2] not in pop_list] triplets = it.combinati...
normal
{ "blob_id": "de7cd231aceb2700acb3ecafe36d1ba1f5c1643b", "index": 6191, "step-1": "#!/usr/bin/python\nimport sys\nimport itertools as it\n\npop_list = []\n\n#with open(\"/Users/dashazhernakova/Documents/Doby/GenomeRussia/ancientDNA/GR+Lazaridis.ind\") as f:\nwith open(sys.argv[1]) as f:\n\t[pop_list.append(l.stri...
[ 0 ]
from flask import Flask, request, render_template, redirect from stories import Story, stories # from flask_debugtoolbar import DebugToolbarExtension app = Flask(__name__) # app.config['SECRET_KEY'] = "secret" # debug = DebugToolbarExtension(app) # my original approach involved using a global story variable to sto...
normal
{ "blob_id": "08ed57ffb7a83973059d62f686f77b1bea136fbd", "index": 3828, "step-1": "<mask token>\n\n\n@app.route('/')\ndef home_page():\n \"\"\"Offer user choice of Madlib Games\"\"\"\n return render_template('index.html', stories=stories.values())\n\n\n<mask token>\n\n\n@app.route('/story')\ndef show_story(...
[ 2, 4, 5, 6, 7 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> <|reserved_special_token_0|> cv.imshow('Threshold Trunc', th3) cv.imshow('Threshold2', th2) cv.imshow('Threshold', th1) cv.imshow('Image', img) cv.imshow('th4', th4) cv.imshow('th5', th5) cv.waitKey(0) cv.destroyAllWindows() <|reserved_special_token_1|> <|...
flexible
{ "blob_id": "6f356840944e11f52a280262697d7e33b3cca650", "index": 2319, "step-1": "<mask token>\n", "step-2": "<mask token>\ncv.imshow('Threshold Trunc', th3)\ncv.imshow('Threshold2', th2)\ncv.imshow('Threshold', th1)\ncv.imshow('Image', img)\ncv.imshow('th4', th4)\ncv.imshow('th5', th5)\ncv.waitKey(0)\ncv.dest...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class BannerAdmin(object): list_display = 'title', 'url', 'index' class BaseSetting(object): enable_themes = True user_bootswatch = True class GlobalSetting(object): site_title = '西游记' site_footer = '咨询在线' <|reserved_special_token_0|> <|reserved_special_token_1...
flexible
{ "blob_id": "263a853f33eb9724101ca87f12b914282dea9981", "index": 1441, "step-1": "<mask token>\n\n\nclass BannerAdmin(object):\n list_display = 'title', 'url', 'index'\n\n\nclass BaseSetting(object):\n enable_themes = True\n user_bootswatch = True\n\n\nclass GlobalSetting(object):\n site_title = '西游记...
[ 6, 7, 8, 9, 10 ]
# coding:utf-8 ''' 对称二叉树 实现一个函数,用来判断一个二叉树是不是对称的 如果一颗二叉树和它的镜像是一样的,就是对称的 ''' class BinaryTreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isSymmetryBonaryTree(self, pRoot): if pRoot is None: return...
normal
{ "blob_id": "c1a9c220b9100a927076753d6483ad7c069dea8c", "index": 4271, "step-1": "# coding:utf-8\n\n'''\n对称二叉树\n实现一个函数,用来判断一个二叉树是不是对称的\n如果一颗二叉树和它的镜像是一样的,就是对称的\n'''\n\n\nclass BinaryTreeNode(object):\n def __init__(self, x):\n self.val = x\n self.left = None\n self.right = None\n\n\nclass ...
[ 0 ]
#! /usr/bin/env python3 import common, os, shutil, sys def main(): os.chdir(common.root) shutil.rmtree('shared/target', ignore_errors = True) shutil.rmtree('platform/build', ignore_errors = True) shutil.rmtree('platform/target', ignore_errors = True) shutil.rmtree('tests/target', ignore_errors = True) shut...
normal
{ "blob_id": "2305d0b7ec0d9e08e3f1c0cedaafa6ed60786e50", "index": 7359, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef main():\n os.chdir(common.root)\n shutil.rmtree('shared/target', ignore_errors=True)\n shutil.rmtree('platform/build', ignore_errors=True)\n shutil.rmtree('platform/ta...
[ 0, 1, 2, 3, 4 ]
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np n_points = 100 n_sims = 1000 def simulate_one_realisation(): return np.random.normal(1, 2, size=n_points) def infer(sample): return {'mean': np.mean(sample), 'std': np.std(sample)} inference = [infer(simulate_one_realisation()) for _ ...
normal
{ "blob_id": "6e8ef901fc614ecbba25df01f84a43c429f25cf6", "index": 4919, "step-1": "<mask token>\n\n\ndef infer(sample):\n return {'mean': np.mean(sample), 'std': np.std(sample)}\n\n\n<mask token>\n", "step-2": "<mask token>\n\n\ndef simulate_one_realisation():\n return np.random.normal(1, 2, size=n_points...
[ 1, 3, 4, 5, 6 ]
import matplotlib.pyplot as plt import matplotlib import numpy as np from PIL import Image from scipy.misc import imsave, imread def plots(epochs, train_acc, test_acc, train_loss, test_loss, train_error, test_error,filename): plt.style.use('bmh') fig=plt.figure(figsize=(8,6)) plt.plot(epochs,train_acc, ...
normal
{ "blob_id": "93150eb1c6746e2b1967eb5305fa526ae36968fd", "index": 2003, "step-1": "<mask token>\n", "step-2": "<mask token>\n\n\ndef write_csv(filename, train_acc, test_acc, train_loss, test_loss,\n train_error, test_error, epoch):\n if epoch == 0:\n with open(filename, 'w') as f:\n f.wr...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> class TicketSetSchema(RebaseSchema): <|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...
flexible
{ "blob_id": "5ebc4f61810f007fd345b52531f7f4318820b9c8", "index": 6333, "step-1": "<mask token>\n\n\nclass TicketSetSchema(RebaseSchema):\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 TicketSetSchema(RebaseSchem...
[ 1, 2, 4, 5 ]
import dlib import cv2 import imageio import torch from PIL import Image from model import AgeGenderModel from mix_model import MixModel from torchvision.transforms import transforms from tqdm import tqdm from retinaface.pre_trained_models import get_model transform = transforms.Compose([ transforms.Resize((112,...
normal
{ "blob_id": "1cc14836808d70c1e53a9ca948a52776ebc89f4a", "index": 4624, "step-1": "<mask token>\n", "step-2": "<mask token>\nmodel.load_state_dict(ckpt['model_state_dict'])\nmodel.eval()\nmodel.to(device)\n<mask token>\nmodel_face.eval()\n<mask token>\nfor img in tqdm(video):\n if img is not None:\n a...
[ 0, 1, 2, 3, 4 ]
<|reserved_special_token_0|> <|reserved_special_token_1|> ''' THROW with or without parameters Which of the following is true about the THROW statement? Answer the question 50XP Possible Answers - The THROW statement without parameters should be placed within a CATCH block. - The THROW statement with p...
flexible
{ "blob_id": "75023c7600fcceda0dc225992e7c433291b1a190", "index": 7254, "step-1": "<mask token>\n", "step-2": "'''\nTHROW with or without parameters\n\n\nWhich of the following is true about the THROW statement?\n\nAnswer the question\n50XP\n\nPossible Answers\n\n - The THROW statement without parameters sho...
[ 0, 1 ]