code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
# pick three names
names = ["Mia", "Francis", "Eva"]
# propmpt user for his/her name
print("Please enter your name:")
user_name = input()
if user_name in names:
print("Hi there, {}!".format(user_name))
else:
print("Who goes there?")
| normal | {
"blob_id": "59c33383365d10c108253f7b5a210d40718913a2",
"index": 9653,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Please enter your name:')\n<mask token>\nif user_name in names:\n print('Hi there, {}!'.format(user_name))\nelse:\n print('Who goes there?')\n",
"step-3": "names = ['Mia', ... | [
0,
1,
2,
3
] |
"""
В массиве случайных целых чисел поменять местами минимальный и максимальный элементы.
"""
import random
SIZE = 10
MIN_ITEM = -100
MAX_ITEM = 100
array = [random.randint(MIN_ITEM, MAX_ITEM) for _ in range(SIZE)]
print('Массив случайных чисел:\n', array)
min_el = array[0]
max_el = array[0]
max_el_inx = 0
min_... | normal | {
"blob_id": "6027836b1b5d3cb8b842b1a1b77f5c9777269896",
"index": 7177,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('Массив случайных чисел:\\n', array)\n<mask token>\nfor el in range(SIZE):\n if array[el] > max_el:\n max_el = array[el]\n max_el_inx = el\n if array[el] < min_e... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('Hi Tom')
<|reserved_special_token_1|>
print("Hi Tom") | flexible | {
"blob_id": "e838a52fecbf69719acc6de38b5f045e792e1408",
"index": 9232,
"step-1": "<mask token>\n",
"step-2": "print('Hi Tom')\n",
"step-3": "print(\"Hi Tom\")",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_nukeboxQueue
----------------------------------
Tests for `nukebox2000` module.
"""
import sys
import unittest
from nukebox2000.MongoBox import NukeBoxDB
class TestNukeBoxDB(unittest.TestCase):
'''
'''
def setUp(self):
'''
B{Test... | normal | {
"blob_id": "bf63ceca2347f750cdf38dce620eaa3c73b556f1",
"index": 1733,
"step-1": "<mask token>\n\n\nclass TestNukeBoxDB(unittest.TestCase):\n <mask token>\n\n def setUp(self):\n \"\"\"\n B{Test} Data\n\n - 2 User dict obj.\n - contains basic data required by the MongoDB co... | [
5,
7,
9,
11,
12
] |
<|reserved_special_token_0|>
class TestWhatever(unittest.TestCase):
def test_compile(self):
self.assertEqual(WHATEVER.compile(), '*')
class TestOneOrMore(unittest.TestCase):
def test_compile(self):
self.assertEqual(ONE_OR_MORE.compile(), '+')
class TestFixedWidth(unittest.TestCase):
... | flexible | {
"blob_id": "5a7e535f2ae585f862cc792dab77f2fe0584fddc",
"index": 9986,
"step-1": "<mask token>\n\n\nclass TestWhatever(unittest.TestCase):\n\n def test_compile(self):\n self.assertEqual(WHATEVER.compile(), '*')\n\n\nclass TestOneOrMore(unittest.TestCase):\n\n def test_compile(self):\n self.as... | [
8,
10,
12,
13,
15
] |
print ("Hello, Django girls!")
volume = 57
if volume < 20:
print("It's kinda quiet.")
elif 20 <= volume < 40:
print("It's nice for background music")
elif 40 <= volume < 60:
print("Perfect, I can hear all the details")
elif 60 <= volume < 80:
print("Nice for parties")
elif 80 <= volume < 100:
print... | normal | {
"blob_id": "00fd5efa4c66b7bd4617f4c886eddcdf38b951b7",
"index": 9507,
"step-1": "<mask token>\n",
"step-2": "print('Hello, Django girls!')\n<mask token>\nif volume < 20:\n print(\"It's kinda quiet.\")\nelif 20 <= volume < 40:\n print(\"It's nice for background music\")\nelif 40 <= volume < 60:\n prin... | [
0,
1,
2,
3
] |
import os
import re
import sys
import traceback
import readline
from typing import NamedTuple, List
from PyInquirer import prompt
from pygments import highlight
from pygments.formatters.terminal import TerminalFormatter
from pygments.lexers.python import PythonLexer
import argparse
parser = argparse.ArgumentParser(d... | normal | {
"blob_id": "bec3d8546cd7d27f7da48f5658480cf17c36a255",
"index": 9462,
"step-1": "<mask token>\n\n\nclass Grade(NamedTuple):\n score: int\n message: str\n comments: List[Comment]\n\n\ndef clear():\n os.system('cls' if os.name == 'nt' else 'clear')\n\n\n<mask token>\n\n\ndef complete(comment):\n if... | [
9,
12,
13,
14,
17
] |
#!/usr/bin/env python
"""
This is a Cog used to display processes/ programs running on the client to a discord text channel
Commented using reStructuredText (reST)
ToDo
create and use a database for multiple servers
"""
# Futures
# Built-in/Generic Imports
import os
import sys
import configparser
import shutil
... | normal | {
"blob_id": "8dfef0a4525328be8dfb4723f0a168dc22eb5eb2",
"index": 520,
"step-1": "<mask token>\n\n\nclass ProcessDisplay(commands.Cog):\n <mask token>\n <mask token>\n\n @commands.Cog.listener()\n async def on_ready(self):\n \"\"\"\n Ran when bot is starting up and ready\n Deletes... | [
2,
4,
6,
9,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
lst = []
user_input = int(input('Enter number of elements : '))
rotating_time = int(input('Enter how many times you want to rotate: '))
print('The numbers are:')
for i in range(0, user_input):
... | flexible | {
"blob_id": "74de0da708c7eb792dea15afb23713d9d71af520",
"index": 5491,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n lst = []\n user_input = int(input('Enter number of elements : '))\n rotating_time = int(input('Enter how many times you want to rotate: '))\n print('The numb... | [
0,
1,
2,
3,
4
] |
class Solution:
# This would generate all permutations, but that's not what this question asks for
# def combo(self, cur, n, ret, arr):
# if cur == n:
# arr.append(ret)
# return
# self.combo(cur+1, n, ret + "1", arr)
# self.combo(cur+1, n, ret + "0", arr)
def c... | normal | {
"blob_id": "e9a929dfef327737b54723579d3c57884fe61057",
"index": 7061,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n <mask token>\n",
"step-3": "class Solution:\n\n def combo(self, n):\n if n == 0:\n return ['0']\n elif n == 1:\n return [... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@pytest.mark.parametrize('invalid_line', ['beginningGDG::',
'beginning::end', 'nothing'])
def test_parse_invalid_line(invalid_line):
assert gadget.parse_log_line(invalid_line) is None
<|reserved_special_token_1|>
impo... | flexible | {
"blob_id": "0dd361239d85ed485594ac0f5e7e2168f0684544",
"index": 915,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@pytest.mark.parametrize('invalid_line', ['beginningGDG::',\n 'beginning::end', 'nothing'])\ndef test_parse_invalid_line(invalid_line):\n assert gadget.parse_log_line(invalid_lin... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class person(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0... | flexible | {
"blob_id": "efe5df4005dbdb04cf4e7da1f350dab483c94c92",
"index": 4459,
"step-1": "<mask token>\n\n\nclass person(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",
"step-2": "<mask ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
try:
var = int(input('Введите число: '))
c = 100 / var
print('Полет нормальный!')
except ZeroDivisionError:
c = 0
print('Попытка деления на ноль')
else:
print('Логика, которая выполняется только если нет ис... | flexible | {
"blob_id": "bb02ba68eb6629dad364b5f015680e4126e655f3",
"index": 6173,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n var = int(input('Введите число: '))\n c = 100 / var\n print('Полет нормальный!')\nexcept ZeroDivisionError:\n c = 0\n print('Попытка деления на ноль')\nelse:\n pr... | [
0,
1,
2,
3
] |
import boto3
from app.models import *
from app.config import *
from app.lib.log import save_races_to_db, save_laptimes_to_db
from app.utils.utils import get_sec
import pandas as pd
def import_csv_from_aws():
client = boto3.client(
's3',
aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCE... | normal | {
"blob_id": "b573db8ea0845fb947636b8d82ed462904c6005d",
"index": 5519,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef import_csv_from_aws():\n client = boto3.client('s3', aws_access_key_id=AWS_ACCESS_KEY_ID,\n aws_secret_access_key=AWS_SECRET_ACCESS_KEY)\n client.download_file('ergas... | [
0,
1,
2,
3
] |
from airbot import resolvers
from airbot import utils
import unittest
from grapher import App
import pprint
OPENID_CONFIG = {
'ISSUER_URL': 'https://dev-545796.oktapreview.com',
'CLIENT_ID': '0oafvba1nlTwOqPN40h7',
'REDIRECT_URI': 'http://locahost/implicit/callback'
}
class TestEndToEnd(unittest.TestCas... | normal | {
"blob_id": "9725c4bfea1215e2fb81c31cbb8948fd1656aca9",
"index": 3814,
"step-1": "from airbot import resolvers\nfrom airbot import utils\nimport unittest\nfrom grapher import App\nimport pprint\n\n\nOPENID_CONFIG = {\n 'ISSUER_URL': 'https://dev-545796.oktapreview.com',\n 'CLIENT_ID': '0oafvba1nlTwOqPN40h7... | [
0
] |
<|reserved_special_token_0|>
def get_ratio(username):
try:
print(username)
link = 'https://api.fortnitetracker.com/v1/profile/pc/' + username
response = requests.get(link, headers={'TRN-Api-Key': FORTNITE_API_KEY}
)
if response.status_code == 200:
collection... | flexible | {
"blob_id": "6c6a49dfced680fe034cbbc2fa28d57d2aa1273e",
"index": 8973,
"step-1": "<mask token>\n\n\ndef get_ratio(username):\n try:\n print(username)\n link = 'https://api.fortnitetracker.com/v1/profile/pc/' + username\n response = requests.get(link, headers={'TRN-Api-Key': FORTNITE_API_K... | [
1,
2,
3,
4,
5
] |
# Generated by Django 2.0.4 on 2018-06-09 05:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lists', '0004_auto_20180608_1835'),
]
operations = [
migrations.AlterModelOptions(
name='todo',
options={'ordering':... | normal | {
"blob_id": "b27913d2cd29f174d79652af6da2846e397373fc",
"index": 1549,
"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 = [('lists', '00... | [
0,
1,
2,
3,
4
] |
#!/usr/bin/env python2
from Crypto.PublicKey import RSA
from Crypto.Util.number import *
from timeit import default_timer as timer
import os
import gmpy2
import itertools as it
def extract2(inp):
two = 0
while inp % 2 == 0:
inp //= 2
two += 1
return inp, two
def genkey():
while 1:
... | normal | {
"blob_id": "b29f85ccf396640c2a63bf634b549a3eaa0dbb1b",
"index": 1830,
"step-1": "<mask token>\n\n\ndef extract2(inp):\n two = 0\n while inp % 2 == 0:\n inp //= 2\n two += 1\n return inp, two\n\n\n<mask token>\n\n\ndef solve():\n x = RSA.importKey(open('pub.pem', 'rb').read())\n d0 =... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def process(json_file, outpur_dir, exclude_titles=None, include_titles=None):
"""
:param json_file: original data in json format
:param outpur_dir: the output directory of pre-processed data
:param exclude_titles: article titles to exclude
:param include_titles: articl... | flexible | {
"blob_id": "0c37806f0a7c0976711edd685fd64d2616147cb6",
"index": 4623,
"step-1": "<mask token>\n\n\ndef process(json_file, outpur_dir, exclude_titles=None, include_titles=None):\n \"\"\"\n :param json_file: original data in json format\n :param outpur_dir: the output directory of pre-processed data\n ... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
def check_controls(subpuc_names, subpuc_controls):
if len(subpuc_names) == len(subpuc_controls):
pass
else:
sys.exit(
'There is an issue with your subpuc_controls.csv file. Number of sub-PUC(s) is incorrect.'
)
for i in range(len(subpuc_... | flexible | {
"blob_id": "7413c06a990894c34ee5174d84f0e3bd20abf51f",
"index": 3294,
"step-1": "<mask token>\n\n\ndef check_controls(subpuc_names, subpuc_controls):\n if len(subpuc_names) == len(subpuc_controls):\n pass\n else:\n sys.exit(\n 'There is an issue with your subpuc_controls.csv file.... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(15), unique=True)
email = db.Column(db.String(50), unique=True)
password = db.Column(db.String(80))
def get_reset_token(self, expires_seconds=1800):
s ... | flexible | {
"blob_id": "f6a3693fe81e629d987067265bf4e410bf260bcf",
"index": 1663,
"step-1": "<mask token>\n\n\nclass User(UserMixin, db.Model):\n id = db.Column(db.Integer, primary_key=True)\n username = db.Column(db.String(15), unique=True)\n email = db.Column(db.String(50), unique=True)\n password = db.Column... | [
25,
26,
28,
36,
39
] |
from django.urls import reverse
from django.utils.translation import get_language
from drf_dynamic_fields import DynamicFieldsMixin
from geotrek.api.v2.serializers import AttachmentSerializer
from mapentity.serializers import MapentityGeojsonModelSerializer
from rest_framework import serializers as rest_serializers
fro... | normal | {
"blob_id": "dfd5915428dc8f15fb61c5d81f22dfecfe29af15",
"index": 6409,
"step-1": "<mask token>\n\n\nclass SpeciesSerializer(TranslatedModelSerializer, PictogramSerializerMixin):\n <mask token>\n <mask token>\n <mask token>\n\n\n class Meta:\n model = sensitivity_models.Species\n fields ... | [
10,
11,
12,
13,
16
] |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
from statistics import mean
from tqdm import tqdm
import multiprocessing as mp
from . import model as dymod
class Filter:
"""誤ベクトル数の確認,誤ベクトル数によるフィルタリング処理"""
@classmethod
def get_incorrect_vector_examp... | normal | {
"blob_id": "5d4585dc96d4ebdbc15b7382038cfea959c9a6f3",
"index": 2495,
"step-1": "<mask token>\n\n\nclass Filter:\n <mask token>\n\n @classmethod\n def get_incorrect_vector_example(cls, file_list, example_number):\n \"\"\"含まれる瞬時データの内指定した個数のデータがそれぞれ持つ誤ベクトル数\"\"\"\n incorrect_vector_list = [... | [
5,
9,
10,
11,
12
] |
<|reserved_special_token_0|>
def set_turn_time(time):
def next_turn(screen):
global stop
stop = False
tasks.append(Task(next_turn, time))
def add_attack(func):
attacks.append(func)
return func
<|reserved_special_token_0|>
def set_screen_angle(angle):
global screen_angle
... | flexible | {
"blob_id": "46fd4b976526a1bc70cf902bdb191feea8b84ad9",
"index": 2633,
"step-1": "<mask token>\n\n\ndef set_turn_time(time):\n\n def next_turn(screen):\n global stop\n stop = False\n tasks.append(Task(next_turn, time))\n\n\ndef add_attack(func):\n attacks.append(func)\n return func\n\n\... | [
16,
26,
28,
32,
47
] |
<|reserved_special_token_0|>
class SlicesDataset(utils.Dataset):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def load_image(self, image_id):
"""Returns an image with a given id."""
info = self.image_info[image_id]
patch_path = info['path']
width = info['width... | flexible | {
"blob_id": "8675deb69eae04a722073432eaf69ce3d24a11ad",
"index": 9041,
"step-1": "<mask token>\n\n\nclass SlicesDataset(utils.Dataset):\n <mask token>\n <mask token>\n\n def load_image(self, image_id):\n \"\"\"Returns an image with a given id.\"\"\"\n info = self.image_info[image_id]\n ... | [
2,
4,
5,
6,
7
] |
from models import Sensor
import mysql.connector as mariadb
## CREATE A DB WITH MARIADB ##
mariadb_connection = mariadb.connect(user='web', password='raspberry', database='PlantHubDB')
cursor = mariadb_connection.cursor()
def closeConnection():
cursor.close()
mariadb_connection.close()
return
def getTask... | normal | {
"blob_id": "f471062573a5ec8cfeb194168edfba3d2700cac6",
"index": 9845,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef closeConnection():\n cursor.close()\n mariadb_connection.close()\n return\n\n\ndef getTasks(amount):\n mariadb_connection = mariadb.connect(user='web', password='raspb... | [
0,
3,
4,
5,
6
] |
import sys
input = sys.stdin.readline
N = int(input())
A, B, C, D = [], [], [], []
for i in range(N):
a, b, c, d = map(int, input().split())
A.append(a)
B.append(b)
C.append(c)
D.append(d)
AB = []
CD = []
for i in range(N):
for j in range(N):
AB.append(A[i] + B[j])
CD.append(C[... | normal | {
"blob_id": "2a9426653146603d9aa79a59ce181d97aa3c551c",
"index": 8525,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(N):\n a, b, c, d = map(int, input().split())\n A.append(a)\n B.append(b)\n C.append(c)\n D.append(d)\n<mask token>\nfor i in range(N):\n for j in range(N)... | [
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": "cdc8c8aba384b7b1b5e741ffe4309eaee30aaada",
"index": 5405,
"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 = [('products_ap... | [
0,
1,
2,
3,
4
] |
"""Create a new Node object and attach it a Linked List."""
class Node(object):
"""Build a node object."""
def __init__(self, data=None, next=None):
"""Constructor for the Node object."""
self.data = data
self.next = next
class LinkedList(object):
"""Build linked list."""
d... | normal | {
"blob_id": "192bd3c783f6f822f8e732ddf47d7fc3b22c032b",
"index": 1618,
"step-1": "<mask token>\n\n\nclass LinkedList(object):\n <mask token>\n\n def __init__(self, iterable=()):\n \"\"\"Constructor for the Linked List object.\"\"\"\n self.head = None\n self._counter = 0\n if isi... | [
6,
10,
12,
14,
15
] |
REGION_LIST = [
'Центральный',
'Северо-Западный',
'Южный',
'Северо-Кавказский',
'Приволжский',
'Уральский',
'Сибирский',
'Дальневосточный',
]
CITY_LIST = {
'Абакан': 7,
'Альметьевск': 5,
'Ангарск': 7,
'Архангельск': 2,
'Астрахань': 3,
'Барнаул': 7,
'Батайск':... | normal | {
"blob_id": "2101299d6f6bfcd4726591fc256317968373ca1f",
"index": 3071,
"step-1": "<mask token>\n",
"step-2": "REGION_LIST = ['Центральный', 'Северо-Западный', 'Южный',\n 'Северо-Кавказский', 'Приволжский', 'Уральский', 'Сибирский',\n 'Дальневосточный']\nCITY_LIST = {'Абакан': 7, 'Альметьевск': 5, 'Ангарс... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
embed()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
b = webdriver.Firefox()
embed()
<|reserved_special_token_1|>
from IPython import embed
from selenium import webdriver
b = webdriver.Firefox()
embed()
| flexible | {
"blob_id": "9aa54f1259aceb052cfba74cedcfadfe68778ebd",
"index": 1020,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nembed()\n",
"step-3": "<mask token>\nb = webdriver.Firefox()\nembed()\n",
"step-4": "from IPython import embed\nfrom selenium import webdriver\nb = webdriver.Firefox()\nembed()\n",
... | [
0,
1,
2,
3
] |
# import core modules and community packages
import sys, math, random
import pygame
# import configuration settings
from src.config import *
from src.board.levels import LEVEL_1
# import game elements
from src.pucman import Pucman
from src.ghast import Ghast
from src.board.board import Board
class Session():
def... | normal | {
"blob_id": "f51a21ed71ede4e7462d9c77cb932a5f05b09e71",
"index": 9174,
"step-1": "<mask token>\n\n\nclass Session:\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Session:\n <mask token>\n\n def start(self):\n self.board.draw()\n session = True\n while sess... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while j < len(reader):
image_array = empty([28, 28])
for r in range(0, 28):
row = reader[j]
j += 1
for c in range(0, 28):
if row[c] == '#' or row[c] == '+':
image_array[r... | flexible | {
"blob_id": "aff439361716c35e5f492680a55e7470b4ee0c42",
"index": 5905,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile j < len(reader):\n image_array = empty([28, 28])\n for r in range(0, 28):\n row = reader[j]\n j += 1\n for c in range(0, 28):\n if row[c] == '#... | [
0,
1,
2,
3,
4
] |
from django.contrib import admin
from ticket.models import Ticket, UserTicket, AuxiliaryTicket
@admin.register(Ticket)
class TicketAdmin(admin.ModelAdmin):
pass
@admin.register(AuxiliaryTicket)
class AuxiliaryTicketAdmin(admin.ModelAdmin):
pass
@admin.register(UserTicket)
class UserTicketAdmin(admin.Model... | normal | {
"blob_id": "c73a199d1c1c1867f3d53ceebf614bc9b65c0d5e",
"index": 280,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@admin.register(AuxiliaryTicket)\nclass AuxiliaryTicketAdmin(admin.ModelAdmin):\n pass\n\n\n@admin.register(UserTicket)\nclass UserTicketAdmin(admin.ModelAdmin):\n pass\n",
"st... | [
0,
2,
3,
4
] |
# -*- coding: utf-8 -*-
""" This module provides a function for splitting datasets."""
from skmultilearn.model_selection import IterativeStratification
def iterative_train_test(X, y, test_size):
"""
Iteratively splits data with stratification.
This function is based on the iterative_train_test_split func... | normal | {
"blob_id": "c4c068c7b50d1811f224701ad7e95d88f6734230",
"index": 2867,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef iterative_train_test(X, y, test_size):\n \"\"\"\n Iteratively splits data with stratification.\n\n This function is based on the iterative_train_test_split function from ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class AssetID(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __repr__(self):
return '{:s}:{:s}'.format(self.asset_name, self.policy_id)
def ... | flexible | {
"blob_id": "5762271de166994b2f56e8e09c3f7ca5245b7ce0",
"index": 6249,
"step-1": "<mask token>\n\n\nclass AssetID(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __repr__(self):\n return '{:s}:{:s}'.format(self.asset_name, self.policy_id)\n\n ... | [
4,
5,
7,
8,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
InFileName += [x.replace('\n', '') for x in fo.readlines()]
fo.close()
for bfMatFile in InFileName:
if os.path.isfile(bfMatFile):
lsHTMLName = []
fo = open(bfMatFile)
lsHTMLName += [x.replace('\n', '') ... | flexible | {
"blob_id": "031727fa42b87260abb671518b2baeff1c9524f9",
"index": 8913,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nInFileName += [x.replace('\\n', '') for x in fo.readlines()]\nfo.close()\nfor bfMatFile in InFileName:\n if os.path.isfile(bfMatFile):\n lsHTMLName = []\n fo = open(bfMat... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def make_word_dictionary(word_dict_pkl_path=params[
'default_word_dict_pkl_path'], training_data_path=params[
'default_training_data_path']):
word_dict = dict()
if os.path.isfile(word_dict_pkl_path):
with open(word_dict_pkl_path, 'rb') as f:
word_dict =... | flexible | {
"blob_id": "430e971d2ae41bfd60e7416ecb2c26bb08e4df45",
"index": 6520,
"step-1": "<mask token>\n\n\ndef make_word_dictionary(word_dict_pkl_path=params[\n 'default_word_dict_pkl_path'], training_data_path=params[\n 'default_training_data_path']):\n word_dict = dict()\n if os.path.isfile(word_dict_pkl_... | [
1,
3,
5,
6,
7
] |
__author__='rhyschris'
""" Defines the set of actions.
This functions exactly the same as
Actions.cs in the Unity game.
"""
from enum import Enum
class Actions(Enum):
doNothing = 0
crouch = 1
jump = 3
walkTowards = 0x1 << 2
runTowards = 0x2 << 2
moveAway = 0x3 << 2
blockUp = 0x1 ... | normal | {
"blob_id": "bc0bfb0ff8eaf21b15b06eea2ea333381c70bc75",
"index": 6775,
"step-1": "__author__='rhyschris'\n\n\"\"\" Defines the set of actions.\n This functions exactly the same as \n Actions.cs in the Unity game.\n\"\"\"\nfrom enum import Enum\n\n\nclass Actions(Enum):\n doNothing = 0\n crouch = 1\n ... | [
0
] |
import time
from PyQt5.QtCore import (
QThread,
)
from common import attach_common
from database_downloader import DatabaseDownload
from ai_list_memorize import MemorizeList
from ai_list_morpheme import MorphemeList
from ai_list_ngram import NgramList
from ai_list_none import NoneList
from ai_bot_memorize import Me... | normal | {
"blob_id": "77763f501c6776969d2594f987e5d7ab7d4377fb",
"index": 317,
"step-1": "<mask token>\n\n\n@attach_common\nclass TalkBotThread(QThread):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def run(self):\n self.start_database()\n ... | [
6,
7,
9,
11,
12
] |
"""
OO 05-18-2020
Task
----------------------------------------------------------------------------------------------------------
Your company needs a function that meets the following requirements:
- For a given array of 'n' integers, the function returns the index of the element with the minimum value
... | normal | {
"blob_id": "8fdc9a52b00686e10c97fa61e43ddbbccb64741b",
"index": 8946,
"step-1": "<mask token>\n\n\nclass TestDataEmptyArray(object):\n\n @staticmethod\n def get_array():\n return []\n\n\nclass TestDataUniqueValues(object):\n\n @staticmethod\n def get_array():\n return [5, 3, 2]\n\n ... | [
9,
10,
11,
13,
14
] |
#!/bin/python
"""
len()
lower()
upper()
str()
"""
parrot = "Norwegian Blue"
print len(parrot)
| normal | {
"blob_id": "cd8d95e2bf433020db2db06a21263f75e3f81331",
"index": 9740,
"step-1": "#!/bin/python\n\n\"\"\"\nlen()\nlower()\nupper()\nstr()\n\"\"\"\n\nparrot = \"Norwegian Blue\"\nprint len(parrot)\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
class ListNode:
def __init__(self, value=0, next=None):
self.value = value
self.next = next
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class ListNode:
def __init__(self, value=0, next=None):
self.value = value
self.next = next
def count(node: ListNode) ->i... | flexible | {
"blob_id": "8c6169bd812a5f34693b12ce2c886969542f1ab8",
"index": 2352,
"step-1": "class ListNode:\n\n def __init__(self, value=0, next=None):\n self.value = value\n self.next = next\n\n\n<mask token>\n",
"step-2": "class ListNode:\n\n def __init__(self, value=0, next=None):\n self.va... | [
2,
3,
4,
5,
6
] |
from calc1 import LispTranslator, RPNTranslator, Parser, Lexer
import unittest
class TestTranslators(unittest.TestCase):
def init_rpn(self, program):
return RPNTranslator(Parser(Lexer(program)))
def init_lisp(self, program):
return LispTranslator(Parser(Lexer(program)))
def test_simple_... | normal | {
"blob_id": "d0e957abfe5646fb84aed69902f2382d554dc825",
"index": 4401,
"step-1": "<mask token>\n\n\nclass TestTranslators(unittest.TestCase):\n <mask token>\n\n def init_lisp(self, program):\n return LispTranslator(Parser(Lexer(program)))\n <mask token>\n <mask token>\n\n def test_examples_... | [
3,
5,
6,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while i >= 1:
print(i, end=' ')
i -= 1
<|reserved_special_token_1|>
num = int(input())
i = 10
while i >= 1:
print(i, end=' ')
i -= 1
<|reserved_special_token_1|>
num=int(input())
i=10
while i>=1:
print... | flexible | {
"blob_id": "ec0113dbd79e936e614bb7ee7e48d29aa616d511",
"index": 7389,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile i >= 1:\n print(i, end=' ')\n i -= 1\n",
"step-3": "num = int(input())\ni = 10\nwhile i >= 1:\n print(i, end=' ')\n i -= 1\n",
"step-4": "num=int(input())\r\ni=10\r\... | [
0,
1,
2,
3
] |
# Copyright (c) 2023 Intel Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writ... | normal | {
"blob_id": "de88e2d2cf165b35f247ea89300c91b3c8c07fea",
"index": 7844,
"step-1": "<mask token>\n\n\nclass TemplateTestBCAlgorithm:\n\n @staticmethod\n @abstractmethod\n def list_to_backend_type(data: List) ->TTensor:\n \"\"\"\n Convert list to backend specific type\n\n :param data: ... | [
9,
11,
12,
13,
14
] |
from application.processing_data.twitter import TwitterAPIv2
from azure.ai.textanalytics import TextAnalyticsClient
from azure.core.credentials import AzureKeyCredential
from .twitter import TwitterAPIv2
categories={
'Noise Complaints': {
'loud',
'party',
'noisy',
'noise',
'... | normal | {
"blob_id": "65aa761110877bd93c2d2cb3d097fa3e126f72b1",
"index": 1297,
"step-1": "from application.processing_data.twitter import TwitterAPIv2\nfrom azure.ai.textanalytics import TextAnalyticsClient\nfrom azure.core.credentials import AzureKeyCredential\nfrom .twitter import TwitterAPIv2\n\ncategories={\n 'No... | [
0
] |
from django import template
register = template.Library()
@register.filter(name='phone_number')
def phone_number(number): # Convert a 10 character string into (xxx) xxx-xxxx.
first = number[0:3]
second = number[3:6]
third = number[6:10]
return '(' + first + ')' + ' ' + second + '-' + third
| normal | {
"blob_id": "5e79a8a8fe79aac900fc0c2ff1caaa73ea08ada2",
"index": 5697,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@register.filter(name='phone_number')\ndef phone_number(number):\n first = number[0:3]\n second = number[3:6]\n third = number[6:10]\n return '(' + first + ')' + ' ' + sec... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'ecommerce.settings.development')
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'e... | flexible | {
"blob_id": "1cb320cf57823511b0398adce097b770b2131eb6",
"index": 9307,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nos.environ.setdefault('DJANGO_SETTINGS_MODULE',\n 'ecommerce.settings.development')\n<mask token>\n",
"step-3": "<mask token>\nos.environ.setdefault('DJANGO_SETTINGS_MODULE',\n 'e... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def get_url(url):
response = requests.get(url)
content = response.content.decode('utf8')
return content
def get_json_from_url(url):
content = get_url(url)
js = json.loads(content)
return js
def get_updates(TOKEN):
url = f'{base_url}{TOKEN}/getUpdates'
j... | flexible | {
"blob_id": "501614f9c7df3c862c9951ea343964b6ed47e74a",
"index": 3204,
"step-1": "<mask token>\n\n\ndef get_url(url):\n response = requests.get(url)\n content = response.content.decode('utf8')\n return content\n\n\ndef get_json_from_url(url):\n content = get_url(url)\n js = json.loads(content)\n ... | [
4,
6,
7,
8,
9
] |
""" Codewars kata: Evaluate mathematical expression. https://www.codewars.com/kata/52a78825cdfc2cfc87000005/train/python """
#######################################################################################################################
#
# Import
#
###########################################################... | normal | {
"blob_id": "ac14e88810b848dbf4ff32ea99fd274cd0285e1c",
"index": 3539,
"step-1": "<mask token>\n\n\nclass Calculator(object):\n <mask token>\n\n def _float_to_string_(self, f, p=40):\n result = f'{f:+1.{p}f}'\n if '.' in result:\n result = result.rstrip('0')\n if result[... | [
6,
7,
9,
10,
11
] |
#!/usr/bin/python3
__author__ = "yang.dd"
"""
example 090
"""
# list
# 新建list
testList = [10086, "中国移动", [1, 2, 3, 4]]
# 访问列表长度
print("list len: ", len(testList))
# 切片
print("切片(slice):", testList[1:])
# 追加
print("追加一个元素")
testList.append("i'm new here!");
print("list len: ", len(testLi... | normal | {
"blob_id": "4f19eed272c12be137df92bfd3c72e978408c974",
"index": 3216,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('list len: ', len(testList))\nprint('切片(slice):', testList[1:])\nprint('追加一个元素')\ntestList.append(\"i'm new here!\")\nprint('list len: ', len(testList))\nprint('last item :', testLi... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class ConfigError(ValueError):
pass
| flexible | {
"blob_id": "76dd4d2b5f68683c77f9502a2298e65c97db7c8d",
"index": 1263,
"step-1": "<mask token>\n",
"step-2": "class ConfigError(ValueError):\n pass\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
class ProductForm(forms.Form):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class FindForm(forms.Form):
name = forms.CharField(max_length=100, label='Наименование'... | flexible | {
"blob_id": "e8a024796b6426e572571e46030678e90c537229",
"index": 7549,
"step-1": "<mask token>\n\n\nclass ProductForm(forms.Form):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass FindForm(forms.Form):\n name = forms.CharField(max_length=100, label='Наименов... | [
3,
4,
5,
6,
7
] |
# =============================================================================
# ######################## Creator: Rhys Aeron Williams #######################
# ######################## Last update: 14th March 2019 #######################
# =============================================================================
... | normal | {
"blob_id": "e89ca4907373318bd55d0833730a30d981414992",
"index": 2677,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif classifier is not None:\n print('model is loaded from ', model_file)\n<mask token>\nwhile 1:\n hasFrame, frame = cap.read()\n if not hasFrame:\n break\n h, w, bpp = ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def allocDerivMemory():
for deriv in FUNC_D_I:
cog.outl('\t double* ' + deriv +
' = (double*)malloc(sizeof(double)*n);')
for deriv in FUNC_D_IJ:
cog.outl('\t double* ' + deriv +
' = (double*)malloc(sizeof(double)*n);')
for deriv in FUNC_... | flexible | {
"blob_id": "20a238826640099e6c69aaa383c5fa7e9b02b13b",
"index": 5614,
"step-1": "<mask token>\n\n\ndef allocDerivMemory():\n for deriv in FUNC_D_I:\n cog.outl('\\t double* ' + deriv +\n ' = (double*)malloc(sizeof(double)*n);')\n for deriv in FUNC_D_IJ:\n cog.outl('\\t double* ' + ... | [
3,
4,
5,
6,
7
] |
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Category, Base, CategoryItem, User
engine = create_engine('postgresql:///thegoodybasket')
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSession instance
... | normal | {
"blob_id": "964499c02548a7e790d96efcd780f471ab1fe1e3",
"index": 9923,
"step-1": "from sqlalchemy import create_engine\nfrom sqlalchemy.orm import sessionmaker\n\nfrom database_setup import Category, Base, CategoryItem, User\n\nengine = create_engine('postgresql:///thegoodybasket')\n# Bind the engine to the meta... | [
0
] |
<|reserved_special_token_0|>
class CRITsAPI:
<|reserved_special_token_0|>
def get_object(self, obj_id, obj_type):
type_trans = self._type_translation(obj_type)
get_url = '{}/{}/{}/'.format(self.url, type_trans, obj_id)
params = {'username': self.username, 'api_key': self.api_key}
... | flexible | {
"blob_id": "a505cc0e382554d65447a3fe3a56fac43c1964f2",
"index": 8133,
"step-1": "<mask token>\n\n\nclass CRITsAPI:\n <mask token>\n\n def get_object(self, obj_id, obj_type):\n type_trans = self._type_translation(obj_type)\n get_url = '{}/{}/{}/'.format(self.url, type_trans, obj_id)\n ... | [
6,
7,
8,
9,
11
] |
#!/usr/bin/python
#==========================================================================
#
# Copyright Insight Software Consortium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at... | normal | {
"blob_id": "4f87c2602e3233889888e419296f67fe40a2db0f",
"index": 5886,
"step-1": "#!/usr/bin/python\n#==========================================================================\n#\n# Copyright Insight Software Consortium\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not... | [
0
] |
from marko.parser import Parser # type: ignore
from marko.block import Heading, Paragraph, CodeBlock, List # type: ignore
from marko.inline import CodeSpan # type: ignore
from langcreator.common import Generators, InputOutputGenerator, tag_regex, get_tags, builtin_generators
import collections
import re
def parse(... | normal | {
"blob_id": "0bbc8aa77436193ab47c0fe8cf0d7c6dffcfe097",
"index": 8066,
"step-1": "<mask token>\n\n\ndef _check_tags(generator: InputOutputGenerator, name: str):\n for output, inputs in generator.items():\n necessary_tags = dict(collections.Counter(get_tags(output)))\n for index, input in enumera... | [
4,
5,
6,
7,
8
] |
ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), (
'CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1)
]
| normal | {
"blob_id": "379c666f19537b513169c6b30e0c669dda6e372c",
"index": 9165,
"step-1": "<mask token>\n",
"step-2": "ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), (\n 'CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1)\n ]\n",
"step-3": null,
"step-4": null,
"st... | [
0,
1
] |
<|reserved_special_token_0|>
def test_negativity():
assert make_it_negative(8) == -8
assert complain_about('enthusiasm') == 'I hate enthusiasm. Totally boring.'
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_negativity():
assert make_it_negative(8) =... | flexible | {
"blob_id": "e73e40a63b67ee1a6cca53a328af05e3eb3d8519",
"index": 703,
"step-1": "<mask token>\n\n\ndef test_negativity():\n assert make_it_negative(8) == -8\n assert complain_about('enthusiasm') == 'I hate enthusiasm. Totally boring.'\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_negativity... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with os.scandir(os.path.abspath(beatmap_dir)) as it:
for entry in it:
if entry.is_dir():
try:
beatmap_id = int(str(entry.name).split(' ')[0])
except ValueError:
c... | flexible | {
"blob_id": "cd34f9ef100ae6d116f02258d22c114ec3f3e3e6",
"index": 1581,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith os.scandir(os.path.abspath(beatmap_dir)) as it:\n for entry in it:\n if entry.is_dir():\n try:\n beatmap_id = int(str(entry.name).split(' ')[0])\n... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def get_namespace(xml_path):
with open(xml_path) as f:
namespaces = re.findall('xmlns:(.*?)=\\"(.*?)\\"', f.read())
return dict(namespaces)
def get_comic_data(item, ns):
return {'title': item.find('title').... | flexible | {
"blob_id": "86a15bb2e4d59fb5c8763fa2de31164beb327685",
"index": 7928,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_namespace(xml_path):\n with open(xml_path) as f:\n namespaces = re.findall('xmlns:(.*?)=\\\\\"(.*?)\\\\\"', f.read())\n return dict(namespaces)\n\n\ndef get_comic... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def write_command(serial, comm, verbose=False, dt=None):
""" Encodes a command and sends it over the serial port """
if verbose and comm != '':
if dt is None:
print('{} \t\t-> {}'.format(comm, serial.port))
else:
print('{} \t\t-> {} at {:2.3... | flexible | {
"blob_id": "3ffcab4b36c6ca05f1e667c628ebb873ebdc0d25",
"index": 7866,
"step-1": "<mask token>\n\n\ndef write_command(serial, comm, verbose=False, dt=None):\n \"\"\" Encodes a command and sends it over the serial port \"\"\"\n if verbose and comm != '':\n if dt is None:\n print('{} \\t\\t... | [
4,
6,
7,
8,
9
] |
def rank_and_file(l):
dict = {}
final_list = []
for each in l:
for num in each:
dict[num] = dict[num] + 1 if num in dict else 1
for key in dict:
if dict[key] % 2 != 0:
final_list.append(key)
final_list = sorted(final_list)
return " ".join(map(str, final_list))
f = open('B-large.in.txt', 'r')
f2 = open(... | normal | {
"blob_id": "359f4fa75379cc2dd80d372144ced08b8d15e0a4",
"index": 6758,
"step-1": "<mask token>\n",
"step-2": "def rank_and_file(l):\n dict = {}\n final_list = []\n for each in l:\n for num in each:\n dict[num] = dict[num] + 1 if num in dict else 1\n for key in dict:\n if di... | [
0,
1,
2,
3,
4
] |
N = int(input("ingrese el numero de datos a ingresar "))
SP = 0
SO = 0
CP = 0
for i in range(1,N+1,1):
NUM = int(input("ingrese un numero entero "))
if NUM > 0:
SP += NUM
CP += 1
else:
SO += NUM
PG = (SP+SO)/N
PP = SP/CP
print(f"hay { CP } numeros positivos, el promedio general es de... | normal | {
"blob_id": "efc0b8f1c4887810a9c85e34957d664b01c1e92e",
"index": 1453,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(1, N + 1, 1):\n NUM = int(input('ingrese un numero entero '))\n if NUM > 0:\n SP += NUM\n CP += 1\n else:\n SO += NUM\n<mask token>\nprint(\n ... | [
0,
1,
2,
3
] |
from . import cli
cli.run()
| normal | {
"blob_id": "235623c3f557dbc28fbff855a618e4d26932ca65",
"index": 7630,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncli.run()\n",
"step-3": "from . import cli\ncli.run()\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
from flask import (Flask,
render_template,
request,
url_for,
redirect,
flash,
jsonify)
app = Flask(__name__)
@app.route('/', methods=['GET'])
def showHomepage():
return render_template('home.html')
if __name__ == '__main__':
print('app started')
app.secret_key = 'secretkey'
app.run(debug=True)
| normal | {
"blob_id": "3001534be3364be1148cd51a4a943fd8c975d87e",
"index": 8384,
"step-1": "<mask token>\n\n\n@app.route('/', methods=['GET'])\ndef showHomepage():\n return render_template('home.html')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\n@app.route('/', methods=['GET'])\ndef showHomepage():\n return... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def parse(node, array):
string = ''
string += '\t%s = ScrollView:create();\n' % node
if array.get('IsBounceEnabled') != None and array['IsBounceEnabled']:
string += '\t%s:setBounceEnabled(true);\n' % node
if array.get('InnerNodeSize') ... | flexible | {
"blob_id": "97b94f3388a6e2473d43e3c4c4e281a86a031dbb",
"index": 9288,
"step-1": "<mask token>\n",
"step-2": "def parse(node, array):\n string = ''\n string += '\\t%s = ScrollView:create();\\n' % node\n if array.get('IsBounceEnabled') != None and array['IsBounceEnabled']:\n string += '\\t%s:set... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class OneStepExplorerWithTrace(BaseExplorer):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def step(self, policy: BasePolicy):
if self.n_interaction > self.n_max_interaction:
raise InteractionExceeded()
a = policy.step(self.last_s)
... | flexible | {
"blob_id": "958d7ec966179d63c6ba0a651e99fff70f0db31a",
"index": 5410,
"step-1": "<mask token>\n\n\nclass OneStepExplorerWithTrace(BaseExplorer):\n <mask token>\n <mask token>\n\n def step(self, policy: BasePolicy):\n if self.n_interaction > self.n_max_interaction:\n raise InteractionE... | [
2,
3,
4,
5,
6
] |
# !/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright (c) 2021 Baidu, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | normal | {
"blob_id": "129df937d7d295bae2009cfb65b2f85228206698",
"index": 8657,
"step-1": "<mask token>\n\n\nclass SGD(BasicOptimizer):\n <mask token>\n\n def __init__(self, iterations: int, circuit: BasicCircuit,\n learning_rate: float):\n \"\"\"The constructor of the SGD class\n\n Args:\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
BUILTINS_MODULE_NAME = 'builtins'
<|reserved_special_token_0|>
<|reserved_special_token_1|>
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2023 Beart... | flexible | {
"blob_id": "a42f36fca2f65d0c5c9b65055af1814d8b4b3d42",
"index": 89,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nBUILTINS_MODULE_NAME = 'builtins'\n<mask token>\n",
"step-3": "#!/usr/bin/env python3\n# --------------------( LICENSE )--------------------\n# Copyright (c) 20... | [
0,
1,
2
] |
'''
A empresa Tchau de telefonia cobra:
-Abaixo de 200 minutos, R$ 0,20 por minuto
-Entre 200 e 400 minutos, R$ 0,18 por minuto
-Acima de 400 minutos, R$ 0,15 por minuto
- Bonus: - Acima de 800 minutos, R$ 0,08
Calcule a conta de telefone
'''
minutos = int(input('Minutos utilizados: '))
if minutos > 800:
total ... | normal | {
"blob_id": "1b3e64be988495454535ca96c7a1b6c20aa27076",
"index": 2648,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif minutos > 800:\n total = minutos * 0.08\nelif minutos > 400 and minutos <= 800:\n total = minutos * 0.15\nelif minutos < 200:\n total = minutos * 0.2\nelse:\n total = minut... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
system.trajectories()
<|reserved_special_token_0|>
print('r is ' + str(r))
system.gillespieConcentrations(50000 * r)
system.gillespieTrajectories([[0, 0], [4, 23]], 10000 * r)
<|reserved_special_token_0|>
system.gillespieConcentra... | flexible | {
"blob_id": "87a1624707e4a113a35d975518e432277c851e41",
"index": 9962,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsystem.trajectories()\n<mask token>\nprint('r is ' + str(r))\nsystem.gillespieConcentrations(50000 * r)\nsystem.gillespieTrajectories([[0, 0], [4, 23]], 10000 * r)\n<mask token>\nsystem.g... | [
0,
1,
2,
3,
4
] |
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table as dt
import plotly.express as px
import pandas as pd
import plotly.graph_objects as go
import numpy as np
from datetime import datetime as dat
from sklearn.model_selection import train_test_split
from sklearn... | normal | {
"blob_id": "9b581df505765e895047584c5bb586faef95295f",
"index": 453,
"step-1": "<mask token>\n\n\ndef getStatsByYear(teamID, year, data):\n \"\"\" Returns the stats for a chosen team for a specific year. Choices are 2016 - 2019 \"\"\"\n teamStats = data[data['team_id'] == teamID]\n for index, row in te... | [
8,
9,
11,
12,
13
] |
from lib.utility import start_time, end_time
from lib.prime import read_primes
from bisect import bisect_left
start_time()
primes = read_primes(100)
# limit = 10 ** 16
import random
# limit = random.randint(1000, 10 ** 5)
limit = 43268
# limit = 10 ** 16
print('limit=', limit)
v1 = set()
v2 = set()
def version_100_i... | normal | {
"blob_id": "ea8676a4c55bbe0ae2ff8abf924accfc0bd8f661",
"index": 1272,
"step-1": "<mask token>\n\n\ndef version_100_iq(limit):\n nums = []\n for x in range(2, limit):\n facs = 0\n n = x\n for p in primes:\n if n % p == 0:\n facs += 1\n while n %... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('gist test file4')
<|reserved_special_token_1|>
print("gist test file4") | flexible | {
"blob_id": "ec4725b5b60d10e86b29aab3723917ace5cf52f6",
"index": 8452,
"step-1": "<mask token>\n",
"step-2": "print('gist test file4')\n",
"step-3": "print(\"gist test file4\")",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class kdECSDemo(cdk.Stack):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class kdECSDemo(cdk.Stack):
def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs
... | flexible | {
"blob_id": "12cd3dbf211b202d25dc6f940156536c9fe3f76f",
"index": 3385,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass kdECSDemo(cdk.Stack):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass kdECSDemo(cdk.Stack):\n\n def __init__(self, scope: cdk.Construct, construct_id: str, **kwarg... | [
0,
1,
2,
3,
4
] |
################################################################################
# run_experiment.py #
# Ian Marci 2017 #
# Defines knn classifier and runs 4-fold cross validation on data in ... | normal | {
"blob_id": "dbc599a03d91f369d862f6cc90c31221747ead80",
"index": 2811,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith tf.Session() as sess:\n predictions = []\n labels = []\n accuracies = []\n for i in range(4):\n sess.run(init)\n choice = i + 1\n choose_test_set(str... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = 'text', 'image', 'user', 'article', 'created_at'
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class FavoriteSerializer(serializers.ModelSerializer):
cla... | flexible | {
"blob_id": "fc8b9029955de6b11cbfe8e24107c687f49685c1",
"index": 9179,
"step-1": "<mask token>\n\n\nclass CommentSerializer(serializers.ModelSerializer):\n\n\n class Meta:\n model = Comment\n fields = 'text', 'image', 'user', 'article', 'created_at'\n",
"step-2": "<mask token>\n\n\nclass Favor... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def solve(S, n):
Discriminante = S * S + 4 * n
r = int(Discriminante ** 0.5)
if r * r == Discriminante:
if r % 2 == S % 2:
return (r - S) // 2
else:
return -1
else:
return -1
<|reserved_special_token_0|>
<|reserved_specia... | flexible | {
"blob_id": "f89800e0d8d4026c167381f275ca86c2cf7f011e",
"index": 4066,
"step-1": "<mask token>\n\n\ndef solve(S, n):\n Discriminante = S * S + 4 * n\n r = int(Discriminante ** 0.5)\n if r * r == Discriminante:\n if r % 2 == S % 2:\n return (r - S) // 2\n else:\n retur... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
vect = [0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0,
5.723585101952381, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0,
0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
0.0, 0.0, 0, 0.0, 0.0, 0.0, ... | flexible | {
"blob_id": "dc6cbf43424a31f1aefde8bd71b6f1b7ecf8166b",
"index": 5998,
"step-1": "<mask token>\n",
"step-2": "vect = [0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, \n 5.723585101952381, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0,\n 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0, 0.0, 0.0... | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def run_training(arguments_parser):
data = DatasetLoader(arguments_parser)
data.setup()
arguments_parser.num_training_steps = len(data.train_dataloader()
) * arguments_parser.max_epochs
dict_args = vars(a... | flexible | {
"blob_id": "328a03acab2a0550bea0795d22110a152db6c503",
"index": 806,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run_training(arguments_parser):\n data = DatasetLoader(arguments_parser)\n data.setup()\n arguments_parser.num_training_steps = len(data.train_dataloader()\n ) * ar... | [
0,
1,
2,
3,
4
] |
# The purpose of this bot is to cick the first black pixel.
# Testing a change here done by Git.
# changes through branches
import pyautogui
import keyboard
import win32api
import win32con
import time
# click function, with a 0.01 pause inorder to properly run the script
def click(x, y):
win32api... | normal | {
"blob_id": "9f831b8c90dd428879319b63712bd03fcc01b631",
"index": 8212,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef click(x, y):\n win32api.SetCursorPos((x, y))\n win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)\n time.sleep(0.01)\n win32api.mouse_event(win32con.MOUSEEVENTF... | [
0,
1,
2,
3,
4
] |
num=int(input())
i=10
while i>=1:
print(i,end=" ")
i-=1
| normal | {
"blob_id": "ec0113dbd79e936e614bb7ee7e48d29aa616d511",
"index": 7389,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile i >= 1:\n print(i, end=' ')\n i -= 1\n",
"step-3": "num = int(input())\ni = 10\nwhile i >= 1:\n print(i, end=' ')\n i -= 1\n",
"step-4": "num=int(input())\r\ni=10\r\... | [
0,
1,
2,
3
] |
'''
@mainpage Rat15S Compiler
@section intro_sec Introduction
This will become a Rat15S compiler. Currently working on Lexical Analyzer.
@author Reza Nikoopour
@author Eric Roe
'''
def main():
tokens = Lexer()
if __name__ == '__main__':
sys.path.append('Lib')
from lexicalanalyzer import Lexer
mai... | normal | {
"blob_id": "d081abf3cd9bc323486772b4f6235fbbc9022099",
"index": 5498,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n tokens = Lexer()\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef main():\n tokens = Lexer()\n\n\nif __name__ == '__main__':\n sys.path.append('Lib')\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def loadFiles(subdir, filetype):
"""
example:
dirs = ["dir1", "dir2"]
file_type = ".dat"
files, keys, data = loadFiles(dirs[0], file_type)
"""
dirname = os.path.dirname(__file__)
path = os.path.join(dirname, subdir + '/')
files_path = []
fileNa... | flexible | {
"blob_id": "b310c35b781e3221e2dacc7717ed77e20001bafa",
"index": 5109,
"step-1": "<mask token>\n\n\ndef loadFiles(subdir, filetype):\n \"\"\"\n example:\n dirs = [\"dir1\", \"dir2\"]\n file_type = \".dat\"\n files, keys, data = loadFiles(dirs[0], file_type)\n \n \"\"\"\n dirname = os.path... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if w < 2 or w % 2 != 0 or w <= v:
print('INVALID INPUT')
else:
x = (4 * v - w) // 2
print('TW={0} FW={1}'.format(x, v - x))
<|reserved_special_token_1|>
v = int(input())
w = int(input())
if w < 2 or w % 2 != 0 or w ... | flexible | {
"blob_id": "74939f81e999b8e239eb64fa10b56f48c47f7d94",
"index": 1622,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif w < 2 or w % 2 != 0 or w <= v:\n print('INVALID INPUT')\nelse:\n x = (4 * v - w) // 2\n print('TW={0} FW={1}'.format(x, v - x))\n",
"step-3": "v = int(input())\nw = int(inpu... | [
0,
1,
2,
3
] |
import pyreadstat
import matplotlib.pyplot as plt
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from keras.utils import np_utils
from sklearn.preprocessing import LabelEncoder
# Set random seed for reproducible results
np.random.seed(1)
# Read sav file and create a pandas dataf... | normal | {
"blob_id": "7282af4186a976296ac50840e9169b78a66e118b",
"index": 1683,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nnp.random.seed(1)\n<mask token>\nencoder.fit(Y)\n<mask token>\nmodel.add(Dense(5, input_dim=len(X[0])))\nmodel.add(Dense(32, activation='relu'))\nmodel.add(Dense(len(onehot_Y[0]), activat... | [
0,
1,
2,
3,
4
] |
from scrapy import cmdline
cmdline.execute("scrapy crawl ariz".split()) | normal | {
"blob_id": "abb2cfd2113e8de6c7bba42c357f0ec140b224a9",
"index": 3311,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncmdline.execute('scrapy crawl ariz'.split())\n",
"step-3": "from scrapy import cmdline\ncmdline.execute('scrapy crawl ariz'.split())\n",
"step-4": "from scrapy import cmdline\ncmdline... | [
0,
1,
2,
3
] |
"""
Class: Dataset
This class is responsible of loading datasets
After initializing using load method the class results two parameter:
train: contains train set
test: contains test set
It's able of returning data structure in form of three lists:
- users
- items
- values (which are ratings)
"""
... | normal | {
"blob_id": "b668945820abe893b92fdf26ccd8563ccff804ee",
"index": 1981,
"step-1": "<mask token>\n\n\nclass DatasetLoader(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass DatasetLoader(object):\n <mask token>\n\n def __init__(self, ds_i... | [
1,
4,
5,
6,
7
] |
# Check given matrix is valid sudoku or Not.
| normal | {
"blob_id": "502da0f0dafe42d3464fabb1d92ae1b0d7ef11f3",
"index": 431,
"step-1": "# Check given matrix is valid sudoku or Not.\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
1
]
} | [
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
urlpatterns = [path('status/', StatusAPIView.as_view(), name='status'),
path('log/', LogAPIView.as_view(), name='log'), path('state/',
StateAPIView.as_view(), name='state')]
<|reserved_special_token_1|>
from django.urls... | flexible | {
"blob_id": "1ae8d78c6581d35cd82194e2565e7a11edda1487",
"index": 7265,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nurlpatterns = [path('status/', StatusAPIView.as_view(), name='status'),\n path('log/', LogAPIView.as_view(), name='log'), path('state/',\n StateAPIView.as_view(), name='state')]\n",... | [
0,
1,
2,
3
] |
from __future__ import absolute_import, print_function, division, unicode_literals
import tensorflow as tf
def get_encoder(conf):
if conf.encoder == 'linear':
model = tf.keras.Sequential([tf.keras.layers.Dense(conf.d_model * 2),
tf.keras.layers.ReLU(),
... | normal | {
"blob_id": "548eebb9628374df320021c714454e05d2c606c0",
"index": 5336,
"step-1": "<mask token>\n\n\ndef get_encoder(conf):\n if conf.encoder == 'linear':\n model = tf.keras.Sequential([tf.keras.layers.Dense(conf.d_model * 2\n ), tf.keras.layers.ReLU(), tf.keras.layers.Dense(conf.d_model)])\n... | [
9,
10,
12,
13,
14
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if a >= 70:
print: '통과입니다.'
print: '축하합니다.'
else:
print: '불합격입니다.'
print('안녕')
<|reserved_special_token_1|>
a = int(input('점수를 입력하세요'))
if a >= 70:
print: '통과입니다.'
print: '축하합니다.'
else:
print: '불합격입니다.'
... | flexible | {
"blob_id": "f8d0cc9cb0e5f8adf9077ffb39dd6abedfedaa12",
"index": 5427,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif a >= 70:\n print: '통과입니다.'\n print: '축하합니다.'\nelse:\n print: '불합격입니다.'\nprint('안녕')\n",
"step-3": "a = int(input('점수를 입력하세요'))\nif a >= 70:\n print: '통과입니다.'\n print: ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
sys.path.append('..')
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
sys.path.append('..')
<|reserved_special_token_0|>
account = ACCOUNT.Account('577e4a03-540f9610-f686d434-qz5c4v5b6n',
... | flexible | {
"blob_id": "03147de944c4f75417006a5087e75354dba644ec",
"index": 6339,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsys.path.append('..')\n<mask token>\n",
"step-3": "<mask token>\nsys.path.append('..')\n<mask token>\naccount = ACCOUNT.Account('577e4a03-540f9610-f686d434-qz5c4v5b6n',\n 'dd7b02f5-c... | [
0,
1,
2,
3,
4
] |
from mpi4py import MPI
from random import random
comm = MPI.COMM_WORLD
mydata = comm.rank
data = comm.gather(mydata)
if comm.rank == 0:
print("Data = ", data)
| normal | {
"blob_id": "acf3d188bd6c99774ddf538dcc83f99ad56c7057",
"index": 7431,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif comm.rank == 0:\n print('Data = ', data)\n",
"step-3": "<mask token>\ncomm = MPI.COMM_WORLD\nmydata = comm.rank\ndata = comm.gather(mydata)\nif comm.rank == 0:\n print('Data = ... | [
0,
1,
2,
3,
4
] |
# ethermine.py, Copyright (c) 2019, Nicholas Saparoff <nick.saparoff@gmail.com>: Original implementation
from minermedic.pools.base_pool import BasePool
from phenome_core.util.rest_api import RestAPI
from minermedic.pools.helper import get_algo_index, get_coin_index, get_coin_cost
"""
EtherminePool
This is the ... | normal | {
"blob_id": "921c7255fad46c767f2ec1030ef9498da05b9bb1",
"index": 9958,
"step-1": "<mask token>\n\n\nclass EtherminePool(BasePool):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def build_creation_parameters(self, pool, pool_attrs, pool_classname):\n params = super(Ethermin... | [
6,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from .simulator import SpatialSIRSimulator as Simulator
from .util import Prior
from .util import PriorExperiment
from .util import Truth
from .util import log_likelihood
| flexible | {
"blob_id": "4f06eddfac38574a0ae3bdd0ea2ac81291380166",
"index": 9987,
"step-1": "<mask token>\n",
"step-2": "from .simulator import SpatialSIRSimulator as Simulator\nfrom .util import Prior\nfrom .util import PriorExperiment\nfrom .util import Truth\nfrom .util import log_likelihood\n",
"step-3": null,
"s... | [
0,
1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.